summaryrefslogtreecommitdiff
path: root/TAO/tao
diff options
context:
space:
mode:
authorWilliam R. Otte <wotte@dre.vanderbilt.edu>2006-07-24 15:50:21 +0000
committerWilliam R. Otte <wotte@dre.vanderbilt.edu>2006-07-24 15:50:21 +0000
commit0e49389337be86641451a5c36c24bf742fe97523 (patch)
tree197c810e5f5bce17b1233a7cb8d7b50c0bcd25e2 /TAO/tao
parent8008dd09ccf88d4edef237a184a698cac42f2952 (diff)
downloadATCD-0e49389337be86641451a5c36c24bf742fe97523.tar.gz
Repo restructuring
Diffstat (limited to 'TAO/tao')
-rw-r--r--TAO/tao/Abstract_Servant_Base.cpp31
-rw-r--r--TAO/tao/Abstract_Servant_Base.h178
-rw-r--r--TAO/tao/Acceptor_Filter.cpp13
-rw-r--r--TAO/tao/Acceptor_Filter.h70
-rw-r--r--TAO/tao/Acceptor_Impl.cpp216
-rw-r--r--TAO/tao/Acceptor_Impl.h121
-rw-r--r--TAO/tao/Acceptor_Registry.cpp899
-rw-r--r--TAO/tao/Acceptor_Registry.h162
-rw-r--r--TAO/tao/Acceptor_Registry.i19
-rw-r--r--TAO/tao/Adapter.cpp15
-rw-r--r--TAO/tao/Adapter.h116
-rw-r--r--TAO/tao/Adapter_Factory.cpp13
-rw-r--r--TAO/tao/Adapter_Factory.h48
-rw-r--r--TAO/tao/Adapter_Registry.cpp199
-rw-r--r--TAO/tao/Adapter_Registry.h123
-rw-r--r--TAO/tao/Allocator.h50
-rw-r--r--TAO/tao/AnyTypeCode.mpc134
-rw-r--r--TAO/tao/AnyTypeCode/Alias_TypeCode.cpp204
-rw-r--r--TAO/tao/AnyTypeCode/Alias_TypeCode.h144
-rw-r--r--TAO/tao/AnyTypeCode/Alias_TypeCode.inl31
-rw-r--r--TAO/tao/AnyTypeCode/Alias_TypeCode_Static.cpp178
-rw-r--r--TAO/tao/AnyTypeCode/Alias_TypeCode_Static.h134
-rw-r--r--TAO/tao/AnyTypeCode/Alias_TypeCode_Static.inl22
-rw-r--r--TAO/tao/AnyTypeCode/Any.cpp774
-rw-r--r--TAO/tao/AnyTypeCode/Any.h404
-rw-r--r--TAO/tao/AnyTypeCode/Any.inl372
-rw-r--r--TAO/tao/AnyTypeCode/AnySeq.pidl33
-rw-r--r--TAO/tao/AnyTypeCode/AnyTypeCode_Adapter_Impl.cpp192
-rw-r--r--TAO/tao/AnyTypeCode/AnyTypeCode_Adapter_Impl.h135
-rw-r--r--TAO/tao/AnyTypeCode/AnyTypeCode_methods.h60
-rw-r--r--TAO/tao/AnyTypeCode/Any_Arg_Traits.h52
-rw-r--r--TAO/tao/AnyTypeCode/Any_Array_Impl_T.cpp177
-rw-r--r--TAO/tao/AnyTypeCode/Any_Array_Impl_T.h84
-rw-r--r--TAO/tao/AnyTypeCode/Any_Array_Impl_T.inl16
-rw-r--r--TAO/tao/AnyTypeCode/Any_Basic_Impl.cpp386
-rw-r--r--TAO/tao/AnyTypeCode/Any_Basic_Impl.h102
-rw-r--r--TAO/tao/AnyTypeCode/Any_Basic_Impl_T.cpp158
-rw-r--r--TAO/tao/AnyTypeCode/Any_Basic_Impl_T.h81
-rw-r--r--TAO/tao/AnyTypeCode/Any_Basic_Impl_T.inl15
-rw-r--r--TAO/tao/AnyTypeCode/Any_Dual_Impl_T.cpp216
-rw-r--r--TAO/tao/AnyTypeCode/Any_Dual_Impl_T.h97
-rw-r--r--TAO/tao/AnyTypeCode/Any_Dual_Impl_T.inl16
-rw-r--r--TAO/tao/AnyTypeCode/Any_Impl.cpp140
-rw-r--r--TAO/tao/AnyTypeCode/Any_Impl.h121
-rw-r--r--TAO/tao/AnyTypeCode/Any_Impl_T.cpp193
-rw-r--r--TAO/tao/AnyTypeCode/Any_Impl_T.h96
-rw-r--r--TAO/tao/AnyTypeCode/Any_Impl_T.inl17
-rw-r--r--TAO/tao/AnyTypeCode/Any_Special_Impl_T.cpp230
-rw-r--r--TAO/tao/AnyTypeCode/Any_Special_Impl_T.h86
-rw-r--r--TAO/tao/AnyTypeCode/Any_Special_Impl_T.inl17
-rw-r--r--TAO/tao/AnyTypeCode/Any_SystemException.cpp210
-rw-r--r--TAO/tao/AnyTypeCode/Any_SystemException.h87
-rw-r--r--TAO/tao/AnyTypeCode/Any_Unknown_IDL_Type.cpp311
-rw-r--r--TAO/tao/AnyTypeCode/Any_Unknown_IDL_Type.h89
-rw-r--r--TAO/tao/AnyTypeCode/Bounds.pidl45
-rw-r--r--TAO/tao/AnyTypeCode/DomainA.cpp300
-rw-r--r--TAO/tao/AnyTypeCode/DomainA.h136
-rw-r--r--TAO/tao/AnyTypeCode/Dynamic.pidl52
-rw-r--r--TAO/tao/AnyTypeCode/DynamicA.cpp291
-rw-r--r--TAO/tao/AnyTypeCode/DynamicA.h146
-rw-r--r--TAO/tao/AnyTypeCode/DynamicC.cpp208
-rw-r--r--TAO/tao/AnyTypeCode/DynamicC.h258
-rw-r--r--TAO/tao/AnyTypeCode/DynamicS.h28
-rw-r--r--TAO/tao/AnyTypeCode/Dynamic_Parameter.pidl43
-rw-r--r--TAO/tao/AnyTypeCode/Empty_Param_TypeCode.cpp87
-rw-r--r--TAO/tao/AnyTypeCode/Empty_Param_TypeCode.h102
-rw-r--r--TAO/tao/AnyTypeCode/Empty_Param_TypeCode.inl13
-rw-r--r--TAO/tao/AnyTypeCode/Enum_TypeCode.cpp224
-rw-r--r--TAO/tao/AnyTypeCode/Enum_TypeCode.h143
-rw-r--r--TAO/tao/AnyTypeCode/Enum_TypeCode.inl24
-rw-r--r--TAO/tao/AnyTypeCode/Enum_TypeCode_Static.cpp217
-rw-r--r--TAO/tao/AnyTypeCode/Enum_TypeCode_Static.h139
-rw-r--r--TAO/tao/AnyTypeCode/Enum_TypeCode_Static.inl24
-rw-r--r--TAO/tao/AnyTypeCode/ExceptionA.cpp122
-rw-r--r--TAO/tao/AnyTypeCode/ExceptionA.h53
-rw-r--r--TAO/tao/AnyTypeCode/Fixed_TypeCode.cpp113
-rw-r--r--TAO/tao/AnyTypeCode/Fixed_TypeCode.h118
-rw-r--r--TAO/tao/AnyTypeCode/Fixed_TypeCode.inl18
-rw-r--r--TAO/tao/AnyTypeCode/Marshal.cpp253
-rw-r--r--TAO/tao/AnyTypeCode/Marshal.h459
-rw-r--r--TAO/tao/AnyTypeCode/Marshal.inl83
-rw-r--r--TAO/tao/AnyTypeCode/NVList.cpp501
-rw-r--r--TAO/tao/AnyTypeCode/NVList.h314
-rw-r--r--TAO/tao/AnyTypeCode/NVList.inl130
-rw-r--r--TAO/tao/AnyTypeCode/NVList_Adapter_Impl.cpp81
-rw-r--r--TAO/tao/AnyTypeCode/NVList_Adapter_Impl.h59
-rw-r--r--TAO/tao/AnyTypeCode/Null_RefCount_Policy.h84
-rw-r--r--TAO/tao/AnyTypeCode/Objref_TypeCode.cpp157
-rw-r--r--TAO/tao/AnyTypeCode/Objref_TypeCode.h125
-rw-r--r--TAO/tao/AnyTypeCode/Objref_TypeCode.inl19
-rw-r--r--TAO/tao/AnyTypeCode/Objref_TypeCode_Static.cpp151
-rw-r--r--TAO/tao/AnyTypeCode/Objref_TypeCode_Static.h121
-rw-r--r--TAO/tao/AnyTypeCode/Objref_TypeCode_Static.inl18
-rw-r--r--TAO/tao/AnyTypeCode/OctetSeqA.cpp146
-rw-r--r--TAO/tao/AnyTypeCode/OctetSeqA.h71
-rw-r--r--TAO/tao/AnyTypeCode/PolicyA.cpp561
-rw-r--r--TAO/tao/AnyTypeCode/PolicyA.h159
-rw-r--r--TAO/tao/AnyTypeCode/Recursive_Type_TypeCode.cpp141
-rw-r--r--TAO/tao/AnyTypeCode/Recursive_Type_TypeCode.h220
-rw-r--r--TAO/tao/AnyTypeCode/Recursive_Type_TypeCode.inl153
-rw-r--r--TAO/tao/AnyTypeCode/RefCount_Policy_Traits.h82
-rw-r--r--TAO/tao/AnyTypeCode/Sequence_TypeCode.cpp150
-rw-r--r--TAO/tao/AnyTypeCode/Sequence_TypeCode.h138
-rw-r--r--TAO/tao/AnyTypeCode/Sequence_TypeCode.inl27
-rw-r--r--TAO/tao/AnyTypeCode/Sequence_TypeCode_Static.cpp150
-rw-r--r--TAO/tao/AnyTypeCode/Sequence_TypeCode_Static.h127
-rw-r--r--TAO/tao/AnyTypeCode/Sequence_TypeCode_Static.inl20
-rw-r--r--TAO/tao/AnyTypeCode/String_TypeCode.cpp93
-rw-r--r--TAO/tao/AnyTypeCode/String_TypeCode.h115
-rw-r--r--TAO/tao/AnyTypeCode/String_TypeCode.inl18
-rw-r--r--TAO/tao/AnyTypeCode/String_TypeCode_Static.cpp88
-rw-r--r--TAO/tao/AnyTypeCode/String_TypeCode_Static.h110
-rw-r--r--TAO/tao/AnyTypeCode/String_TypeCode_Static.inl18
-rw-r--r--TAO/tao/AnyTypeCode/String_TypeCode_Traits.h81
-rw-r--r--TAO/tao/AnyTypeCode/Struct_TypeCode.cpp349
-rw-r--r--TAO/tao/AnyTypeCode/Struct_TypeCode.h158
-rw-r--r--TAO/tao/AnyTypeCode/Struct_TypeCode.inl50
-rw-r--r--TAO/tao/AnyTypeCode/Struct_TypeCode_Static.cpp320
-rw-r--r--TAO/tao/AnyTypeCode/Struct_TypeCode_Static.h154
-rw-r--r--TAO/tao/AnyTypeCode/Struct_TypeCode_Static.inl26
-rw-r--r--TAO/tao/AnyTypeCode/SystemExceptionA.cpp185
-rw-r--r--TAO/tao/AnyTypeCode/SystemExceptionA.h93
-rw-r--r--TAO/tao/AnyTypeCode/TAO_AnyTypeCode.pc.in11
-rw-r--r--TAO/tao/AnyTypeCode/TAO_AnyTypeCode_Export.h40
-rw-r--r--TAO/tao/AnyTypeCode/TC_Constants_Forward.h20
-rw-r--r--TAO/tao/AnyTypeCode/True_RefCount_Policy.cpp20
-rw-r--r--TAO/tao/AnyTypeCode/True_RefCount_Policy.h119
-rw-r--r--TAO/tao/AnyTypeCode/True_RefCount_Policy.inl28
-rw-r--r--TAO/tao/AnyTypeCode/TypeCode.cpp489
-rw-r--r--TAO/tao/AnyTypeCode/TypeCode.h594
-rw-r--r--TAO/tao/AnyTypeCode/TypeCode.inl162
-rw-r--r--TAO/tao/AnyTypeCode/TypeCodeA.cpp63
-rw-r--r--TAO/tao/AnyTypeCode/TypeCode_Base_Attributes.cpp12
-rw-r--r--TAO/tao/AnyTypeCode/TypeCode_Base_Attributes.h101
-rw-r--r--TAO/tao/AnyTypeCode/TypeCode_Base_Attributes.inl54
-rw-r--r--TAO/tao/AnyTypeCode/TypeCode_CDR_Extraction.cpp1403
-rw-r--r--TAO/tao/AnyTypeCode/TypeCode_CDR_Extraction.h200
-rw-r--r--TAO/tao/AnyTypeCode/TypeCode_Case_Base_T.cpp89
-rw-r--r--TAO/tao/AnyTypeCode/TypeCode_Case_Base_T.h210
-rw-r--r--TAO/tao/AnyTypeCode/TypeCode_Case_Base_T.inl79
-rw-r--r--TAO/tao/AnyTypeCode/TypeCode_Case_T.cpp164
-rw-r--r--TAO/tao/AnyTypeCode/TypeCode_Case_T.h147
-rw-r--r--TAO/tao/AnyTypeCode/TypeCode_Case_T.inl34
-rw-r--r--TAO/tao/AnyTypeCode/TypeCode_Constants.cpp114
-rw-r--r--TAO/tao/AnyTypeCode/TypeCode_Constants.h124
-rw-r--r--TAO/tao/AnyTypeCode/TypeCode_Struct_Field.h91
-rw-r--r--TAO/tao/AnyTypeCode/TypeCode_Traits.h126
-rw-r--r--TAO/tao/AnyTypeCode/TypeCode_Value_Field.h93
-rw-r--r--TAO/tao/AnyTypeCode/Typecode_typesA.h47
-rw-r--r--TAO/tao/AnyTypeCode/UShortSeqA.cpp146
-rw-r--r--TAO/tao/AnyTypeCode/UShortSeqA.h112
-rw-r--r--TAO/tao/AnyTypeCode/Union_TypeCode.cpp463
-rw-r--r--TAO/tao/AnyTypeCode/Union_TypeCode.h182
-rw-r--r--TAO/tao/AnyTypeCode/Union_TypeCode.inl59
-rw-r--r--TAO/tao/AnyTypeCode/Union_TypeCode_Static.cpp422
-rw-r--r--TAO/tao/AnyTypeCode/Union_TypeCode_Static.h171
-rw-r--r--TAO/tao/AnyTypeCode/Union_TypeCode_Static.inl29
-rw-r--r--TAO/tao/AnyTypeCode/ValueModifier.pidl38
-rw-r--r--TAO/tao/AnyTypeCode/Value_TypeCode.cpp465
-rw-r--r--TAO/tao/AnyTypeCode/Value_TypeCode.h181
-rw-r--r--TAO/tao/AnyTypeCode/Value_TypeCode.inl60
-rw-r--r--TAO/tao/AnyTypeCode/Value_TypeCode_Static.cpp425
-rw-r--r--TAO/tao/AnyTypeCode/Value_TypeCode_Static.h170
-rw-r--r--TAO/tao/AnyTypeCode/Value_TypeCode_Static.inl30
-rw-r--r--TAO/tao/AnyTypeCode/Visibility.pidl36
-rw-r--r--TAO/tao/AnyTypeCode/WrongTransactionA.cpp151
-rw-r--r--TAO/tao/AnyTypeCode/WrongTransactionA.h112
-rw-r--r--TAO/tao/AnyTypeCode/append.cpp1329
-rw-r--r--TAO/tao/AnyTypeCode/skip.cpp1078
-rw-r--r--TAO/tao/AnyTypeCode_Adapter.cpp15
-rw-r--r--TAO/tao/AnyTypeCode_Adapter.h142
-rw-r--r--TAO/tao/Any_Insert_Policy_T.h119
-rw-r--r--TAO/tao/Arg_Traits_T.h41
-rw-r--r--TAO/tao/Argument.cpp57
-rw-r--r--TAO/tao/Argument.h141
-rw-r--r--TAO/tao/Array_Traits_T.h82
-rw-r--r--TAO/tao/Array_VarOut_T.cpp95
-rw-r--r--TAO/tao/Array_VarOut_T.h246
-rw-r--r--TAO/tao/Array_VarOut_T.inl385
-rw-r--r--TAO/tao/Asynch_Queued_Message.cpp186
-rw-r--r--TAO/tao/Asynch_Queued_Message.h105
-rw-r--r--TAO/tao/Asynch_Reply_Dispatcher_Base.cpp149
-rw-r--r--TAO/tao/Asynch_Reply_Dispatcher_Base.h171
-rw-r--r--TAO/tao/Asynch_Reply_Dispatcher_Base.i18
-rw-r--r--TAO/tao/Auto_Functor.h39
-rw-r--r--TAO/tao/BD_String_Argument_T.cpp155
-rw-r--r--TAO/tao/BD_String_Argument_T.h181
-rw-r--r--TAO/tao/BD_String_Argument_T.inl110
-rw-r--r--TAO/tao/Base_Transport_Property.cpp58
-rw-r--r--TAO/tao/Base_Transport_Property.h77
-rw-r--r--TAO/tao/Base_Transport_Property.inl31
-rw-r--r--TAO/tao/Basic_Argument_T.cpp110
-rw-r--r--TAO/tao/Basic_Argument_T.h162
-rw-r--r--TAO/tao/Basic_Argument_T.inl95
-rw-r--r--TAO/tao/Basic_Arguments.h121
-rw-r--r--TAO/tao/Basic_Types.h100
-rw-r--r--TAO/tao/BiDir_Adapter.cpp13
-rw-r--r--TAO/tao/BiDir_Adapter.h52
-rw-r--r--TAO/tao/BiDir_GIOP.mpc43
-rw-r--r--TAO/tao/BiDir_GIOP/BiDirGIOP.cpp117
-rw-r--r--TAO/tao/BiDir_GIOP/BiDirGIOP.h83
-rw-r--r--TAO/tao/BiDir_GIOP/BiDirPolicy.pidl43
-rw-r--r--TAO/tao/BiDir_GIOP/BiDirPolicy_Validator.cpp60
-rw-r--r--TAO/tao/BiDir_GIOP/BiDirPolicy_Validator.h58
-rw-r--r--TAO/tao/BiDir_GIOP/BiDir_ORBInitializer.cpp69
-rw-r--r--TAO/tao/BiDir_GIOP/BiDir_ORBInitializer.h67
-rw-r--r--TAO/tao/BiDir_GIOP/BiDir_PolicyFactory.cpp52
-rw-r--r--TAO/tao/BiDir_GIOP/BiDir_PolicyFactory.h60
-rw-r--r--TAO/tao/BiDir_GIOP/BiDir_Policy_i.cpp94
-rw-r--r--TAO/tao/BiDir_GIOP/BiDir_Policy_i.h89
-rw-r--r--TAO/tao/BiDir_GIOP/TAO_BiDirGIOP.pc.in11
-rw-r--r--TAO/tao/BiDir_GIOP/TAO_BiDir_GIOP.rc30
-rw-r--r--TAO/tao/BiDir_GIOP/bidirgiop_export.h40
-rw-r--r--TAO/tao/Bind_Dispatcher_Guard.cpp42
-rw-r--r--TAO/tao/Bind_Dispatcher_Guard.h68
-rw-r--r--TAO/tao/Bind_Dispatcher_Guard.i46
-rw-r--r--TAO/tao/Block_Flushing_Strategy.cpp52
-rw-r--r--TAO/tao/Block_Flushing_Strategy.h44
-rw-r--r--TAO/tao/Blocked_Connect_Strategy.cpp45
-rw-r--r--TAO/tao/Blocked_Connect_Strategy.h55
-rw-r--r--TAO/tao/BooleanSeq.pidl31
-rw-r--r--TAO/tao/Bounded_Array_Allocation_Traits_T.h55
-rw-r--r--TAO/tao/Bounded_Array_Sequence_T.h149
-rw-r--r--TAO/tao/Bounded_Basic_String_Sequence_T.h118
-rw-r--r--TAO/tao/Bounded_Object_Reference_Sequence_T.h105
-rw-r--r--TAO/tao/Bounded_Reference_Allocation_Traits_T.h65
-rw-r--r--TAO/tao/Bounded_Sequence_CDR_T.h520
-rw-r--r--TAO/tao/Bounded_String_Sequence_T.h42
-rw-r--r--TAO/tao/Bounded_Value_Allocation_Traits_T.h60
-rw-r--r--TAO/tao/Bounded_Value_Sequence_T.h100
-rw-r--r--TAO/tao/Bounded_Wstring_Sequence_T.h42
-rw-r--r--TAO/tao/Buffer_Allocator_T.cpp45
-rw-r--r--TAO/tao/Buffer_Allocator_T.h62
-rw-r--r--TAO/tao/Buffering_Constraint_Policy.cpp92
-rw-r--r--TAO/tao/Buffering_Constraint_Policy.h94
-rw-r--r--TAO/tao/Buffering_Constraint_Policy.i13
-rw-r--r--TAO/tao/CDR.cpp332
-rw-r--r--TAO/tao/CDR.h459
-rw-r--r--TAO/tao/CDR.i377
-rw-r--r--TAO/tao/CONV_FRAME.pidl49
-rw-r--r--TAO/tao/CORBALOC_Parser.cpp391
-rw-r--r--TAO/tao/CORBALOC_Parser.h106
-rw-r--r--TAO/tao/CORBALOC_Parser.i25
-rw-r--r--TAO/tao/CORBANAME_Parser.cpp169
-rw-r--r--TAO/tao/CORBANAME_Parser.h68
-rw-r--r--TAO/tao/CORBA_String.cpp145
-rw-r--r--TAO/tao/CORBA_String.h297
-rw-r--r--TAO/tao/CORBA_String.inl23
-rw-r--r--TAO/tao/CORBA_methods.h86
-rw-r--r--TAO/tao/CSD_Framework.mpc47
-rw-r--r--TAO/tao/CSD_Framework/CSD_Default_Servant_Dispatcher.cpp70
-rw-r--r--TAO/tao/CSD_Framework/CSD_Default_Servant_Dispatcher.h53
-rw-r--r--TAO/tao/CSD_Framework/CSD_FW_Export.h58
-rw-r--r--TAO/tao/CSD_Framework/CSD_FW_Server_Request_Wrapper.cpp474
-rw-r--r--TAO/tao/CSD_Framework/CSD_FW_Server_Request_Wrapper.h128
-rw-r--r--TAO/tao/CSD_Framework/CSD_FW_Server_Request_Wrapper.inl46
-rw-r--r--TAO/tao/CSD_Framework/CSD_Framework.pidl53
-rw-r--r--TAO/tao/CSD_Framework/CSD_Framework_Loader.cpp32
-rw-r--r--TAO/tao/CSD_Framework/CSD_Framework_Loader.h47
-rw-r--r--TAO/tao/CSD_Framework/CSD_ORBInitializer.cpp36
-rw-r--r--TAO/tao/CSD_Framework/CSD_ORBInitializer.h70
-rw-r--r--TAO/tao/CSD_Framework/CSD_Object_Adapter.cpp45
-rw-r--r--TAO/tao/CSD_Framework/CSD_Object_Adapter.h57
-rw-r--r--TAO/tao/CSD_Framework/CSD_Object_Adapter_Factory.cpp96
-rw-r--r--TAO/tao/CSD_Framework/CSD_Object_Adapter_Factory.h50
-rw-r--r--TAO/tao/CSD_Framework/CSD_POA.cpp134
-rw-r--r--TAO/tao/CSD_Framework/CSD_POA.h111
-rw-r--r--TAO/tao/CSD_Framework/CSD_POA.inl14
-rw-r--r--TAO/tao/CSD_Framework/CSD_Strategy_Base.cpp132
-rw-r--r--TAO/tao/CSD_Framework/CSD_Strategy_Base.h174
-rw-r--r--TAO/tao/CSD_Framework/CSD_Strategy_Base.inl144
-rw-r--r--TAO/tao/CSD_Framework/CSD_Strategy_Proxy.cpp50
-rw-r--r--TAO/tao/CSD_Framework/CSD_Strategy_Proxy.h114
-rw-r--r--TAO/tao/CSD_Framework/CSD_Strategy_Proxy.inl104
-rw-r--r--TAO/tao/CSD_Framework/CSD_Strategy_Repository.cpp117
-rw-r--r--TAO/tao/CSD_Framework/CSD_Strategy_Repository.h78
-rw-r--r--TAO/tao/CSD_Framework/TAO_CSD_Framework.pc.in11
-rw-r--r--TAO/tao/CSD_ThreadPool.mpc39
-rw-r--r--TAO/tao/CSD_ThreadPool/CSD_TP_Cancel_Visitor.cpp48
-rw-r--r--TAO/tao/CSD_ThreadPool/CSD_TP_Cancel_Visitor.h87
-rw-r--r--TAO/tao/CSD_ThreadPool/CSD_TP_Cancel_Visitor.inl32
-rw-r--r--TAO/tao/CSD_ThreadPool/CSD_TP_Collocated_Asynch_Request.cpp60
-rw-r--r--TAO/tao/CSD_ThreadPool/CSD_TP_Collocated_Asynch_Request.h90
-rw-r--r--TAO/tao/CSD_ThreadPool/CSD_TP_Collocated_Asynch_Request.inl24
-rw-r--r--TAO/tao/CSD_ThreadPool/CSD_TP_Collocated_Synch_Request.cpp56
-rw-r--r--TAO/tao/CSD_ThreadPool/CSD_TP_Collocated_Synch_Request.h109
-rw-r--r--TAO/tao/CSD_ThreadPool/CSD_TP_Collocated_Synch_Request.inl59
-rw-r--r--TAO/tao/CSD_ThreadPool/CSD_TP_Collocated_Synch_With_Server_Request.cpp72
-rw-r--r--TAO/tao/CSD_ThreadPool/CSD_TP_Collocated_Synch_With_Server_Request.h110
-rw-r--r--TAO/tao/CSD_ThreadPool/CSD_TP_Collocated_Synch_With_Server_Request.inl32
-rw-r--r--TAO/tao/CSD_ThreadPool/CSD_TP_Corba_Request.cpp19
-rw-r--r--TAO/tao/CSD_ThreadPool/CSD_TP_Corba_Request.h103
-rw-r--r--TAO/tao/CSD_ThreadPool/CSD_TP_Corba_Request.inl45
-rw-r--r--TAO/tao/CSD_ThreadPool/CSD_TP_Custom_Asynch_Request.cpp52
-rw-r--r--TAO/tao/CSD_ThreadPool/CSD_TP_Custom_Asynch_Request.h79
-rw-r--r--TAO/tao/CSD_ThreadPool/CSD_TP_Custom_Asynch_Request.inl15
-rw-r--r--TAO/tao/CSD_ThreadPool/CSD_TP_Custom_Request.cpp19
-rw-r--r--TAO/tao/CSD_ThreadPool/CSD_TP_Custom_Request.h81
-rw-r--r--TAO/tao/CSD_ThreadPool/CSD_TP_Custom_Request.inl48
-rw-r--r--TAO/tao/CSD_ThreadPool/CSD_TP_Custom_Request_Operation.cpp19
-rw-r--r--TAO/tao/CSD_ThreadPool/CSD_TP_Custom_Request_Operation.h99
-rw-r--r--TAO/tao/CSD_ThreadPool/CSD_TP_Custom_Request_Operation.inl51
-rw-r--r--TAO/tao/CSD_ThreadPool/CSD_TP_Custom_Synch_Request.cpp35
-rw-r--r--TAO/tao/CSD_ThreadPool/CSD_TP_Custom_Synch_Request.h92
-rw-r--r--TAO/tao/CSD_ThreadPool/CSD_TP_Custom_Synch_Request.inl23
-rw-r--r--TAO/tao/CSD_ThreadPool/CSD_TP_Dispatchable_Visitor.cpp53
-rw-r--r--TAO/tao/CSD_ThreadPool/CSD_TP_Dispatchable_Visitor.h94
-rw-r--r--TAO/tao/CSD_ThreadPool/CSD_TP_Dispatchable_Visitor.inl31
-rw-r--r--TAO/tao/CSD_ThreadPool/CSD_TP_Export.h58
-rw-r--r--TAO/tao/CSD_ThreadPool/CSD_TP_Queue.cpp127
-rw-r--r--TAO/tao/CSD_ThreadPool/CSD_TP_Queue.h101
-rw-r--r--TAO/tao/CSD_ThreadPool/CSD_TP_Queue.inl29
-rw-r--r--TAO/tao/CSD_ThreadPool/CSD_TP_Queue_Visitor.cpp19
-rw-r--r--TAO/tao/CSD_ThreadPool/CSD_TP_Queue_Visitor.h79
-rw-r--r--TAO/tao/CSD_ThreadPool/CSD_TP_Queue_Visitor.inl12
-rw-r--r--TAO/tao/CSD_ThreadPool/CSD_TP_Remote_Request.cpp60
-rw-r--r--TAO/tao/CSD_ThreadPool/CSD_TP_Remote_Request.h102
-rw-r--r--TAO/tao/CSD_ThreadPool/CSD_TP_Remote_Request.inl24
-rw-r--r--TAO/tao/CSD_ThreadPool/CSD_TP_Request.cpp27
-rw-r--r--TAO/tao/CSD_ThreadPool/CSD_TP_Request.h136
-rw-r--r--TAO/tao/CSD_ThreadPool/CSD_TP_Request.inl111
-rw-r--r--TAO/tao/CSD_ThreadPool/CSD_TP_Servant_State.cpp19
-rw-r--r--TAO/tao/CSD_ThreadPool/CSD_TP_Servant_State.h92
-rw-r--r--TAO/tao/CSD_ThreadPool/CSD_TP_Servant_State.inl29
-rw-r--r--TAO/tao/CSD_ThreadPool/CSD_TP_Servant_State_Map.cpp11
-rw-r--r--TAO/tao/CSD_ThreadPool/CSD_TP_Servant_State_Map.h95
-rw-r--r--TAO/tao/CSD_ThreadPool/CSD_TP_Servant_State_Map.inl70
-rw-r--r--TAO/tao/CSD_ThreadPool/CSD_TP_Strategy.cpp289
-rw-r--r--TAO/tao/CSD_ThreadPool/CSD_TP_Strategy.h210
-rw-r--r--TAO/tao/CSD_ThreadPool/CSD_TP_Strategy.inl35
-rw-r--r--TAO/tao/CSD_ThreadPool/CSD_TP_Strategy_Factory.cpp154
-rw-r--r--TAO/tao/CSD_ThreadPool/CSD_TP_Strategy_Factory.h65
-rw-r--r--TAO/tao/CSD_ThreadPool/CSD_TP_Synch_Helper.cpp11
-rw-r--r--TAO/tao/CSD_ThreadPool/CSD_TP_Synch_Helper.h110
-rw-r--r--TAO/tao/CSD_ThreadPool/CSD_TP_Synch_Helper.inl55
-rw-r--r--TAO/tao/CSD_ThreadPool/CSD_TP_Task.cpp312
-rw-r--r--TAO/tao/CSD_ThreadPool/CSD_TP_Task.h164
-rw-r--r--TAO/tao/CSD_ThreadPool/CSD_TP_Task.inl22
-rw-r--r--TAO/tao/CSD_ThreadPool/CSD_ThreadPool.cpp23
-rw-r--r--TAO/tao/CSD_ThreadPool/CSD_ThreadPool.h65
-rw-r--r--TAO/tao/CSD_ThreadPool/TAO_CSD_ThreadPool.pc.in11
-rw-r--r--TAO/tao/Cache_Entries.cpp52
-rw-r--r--TAO/tao/Cache_Entries.h208
-rw-r--r--TAO/tao/Cache_Entries.inl195
-rw-r--r--TAO/tao/CharSeq.pidl33
-rw-r--r--TAO/tao/Cleanup_Func_Registry.cpp52
-rw-r--r--TAO/tao/Cleanup_Func_Registry.h92
-rw-r--r--TAO/tao/Cleanup_Func_Registry.inl19
-rw-r--r--TAO/tao/ClientRequestInterceptor_Adapter.cpp13
-rw-r--r--TAO/tao/ClientRequestInterceptor_Adapter.h122
-rw-r--r--TAO/tao/ClientRequestInterceptor_Adapter_Factory.cpp13
-rw-r--r--TAO/tao/ClientRequestInterceptor_Adapter_Factory.h54
-rw-r--r--TAO/tao/Client_Strategy_Factory.cpp80
-rw-r--r--TAO/tao/Client_Strategy_Factory.h104
-rw-r--r--TAO/tao/CodecFactory.mpc44
-rw-r--r--TAO/tao/CodecFactory/CDR_Encaps_Codec.cpp368
-rw-r--r--TAO/tao/CodecFactory/CDR_Encaps_Codec.h138
-rw-r--r--TAO/tao/CodecFactory/CodecFactory.cpp52
-rw-r--r--TAO/tao/CodecFactory/CodecFactory.h59
-rw-r--r--TAO/tao/CodecFactory/CodecFactory_impl.cpp151
-rw-r--r--TAO/tao/CodecFactory/CodecFactory_impl.h100
-rw-r--r--TAO/tao/CodecFactory/IOP_Codec.pidl78
-rw-r--r--TAO/tao/CodecFactory/IOP_CodecA.h3
-rw-r--r--TAO/tao/CodecFactory/IOP_Codec_include.pidl44
-rw-r--r--TAO/tao/CodecFactory/IOP_Codec_includeA.h44
-rw-r--r--TAO/tao/CodecFactory/IOP_Codec_includeC.h72
-rw-r--r--TAO/tao/CodecFactory/IOP_Codec_includeS.h28
-rw-r--r--TAO/tao/CodecFactory/TAO_CodecFactory.pc.in11
-rw-r--r--TAO/tao/CodecFactory/TAO_CodecFactory.rc30
-rw-r--r--TAO/tao/CodecFactory/codecfactory_export.h40
-rw-r--r--TAO/tao/Codeset.mpc33
-rw-r--r--TAO/tao/Codeset/Codeset.cpp48
-rw-r--r--TAO/tao/Codeset/Codeset.h43
-rw-r--r--TAO/tao/Codeset/Codeset_Descriptor.cpp135
-rw-r--r--TAO/tao/Codeset/Codeset_Descriptor.h65
-rw-r--r--TAO/tao/Codeset/Codeset_Manager_Factory.cpp50
-rw-r--r--TAO/tao/Codeset/Codeset_Manager_Factory.h59
-rw-r--r--TAO/tao/Codeset/Codeset_Manager_i.cpp510
-rw-r--r--TAO/tao/Codeset/Codeset_Manager_i.h150
-rw-r--r--TAO/tao/Codeset/Codeset_Translator_Factory.cpp81
-rw-r--r--TAO/tao/Codeset/Codeset_Translator_Factory.h92
-rw-r--r--TAO/tao/Codeset/Codeset_Translator_Factory_T.cpp92
-rw-r--r--TAO/tao/Codeset/Codeset_Translator_Factory_T.h85
-rw-r--r--TAO/tao/Codeset/UTF16_BOM_Factory.cpp142
-rw-r--r--TAO/tao/Codeset/UTF16_BOM_Factory.h71
-rw-r--r--TAO/tao/Codeset/UTF16_BOM_Translator.cpp444
-rw-r--r--TAO/tao/Codeset/UTF16_BOM_Translator.h101
-rw-r--r--TAO/tao/Codeset/UTF8_Latin1_Factory.cpp91
-rw-r--r--TAO/tao/Codeset/UTF8_Latin1_Factory.h53
-rw-r--r--TAO/tao/Codeset/UTF8_Latin1_Translator.cpp224
-rw-r--r--TAO/tao/Codeset/UTF8_Latin1_Translator.h89
-rw-r--r--TAO/tao/Codeset/codeset_export.h40
-rw-r--r--TAO/tao/Codeset_Descriptor_Base.h49
-rw-r--r--TAO/tao/Codeset_Manager.cpp23
-rw-r--r--TAO/tao/Codeset_Manager.h103
-rw-r--r--TAO/tao/Codeset_Manager_Factory_Base.cpp51
-rw-r--r--TAO/tao/Codeset_Manager_Factory_Base.h77
-rw-r--r--TAO/tao/Codeset_Translator_Base.cpp33
-rw-r--r--TAO/tao/Codeset_Translator_Base.h79
-rw-r--r--TAO/tao/Codeset_Translator_Factory.h29
-rw-r--r--TAO/tao/Collocated_Invocation.cpp172
-rw-r--r--TAO/tao/Collocated_Invocation.h101
-rw-r--r--TAO/tao/Collocation_Proxy_Broker.cpp17
-rw-r--r--TAO/tao/Collocation_Proxy_Broker.h77
-rw-r--r--TAO/tao/Collocation_Resolver.cpp15
-rw-r--r--TAO/tao/Collocation_Resolver.h64
-rw-r--r--TAO/tao/Collocation_Strategy.h48
-rw-r--r--TAO/tao/Condition.cpp62
-rw-r--r--TAO/tao/Condition.h127
-rw-r--r--TAO/tao/Condition.inl55
-rw-r--r--TAO/tao/Configurable_Refcount.cpp9
-rw-r--r--TAO/tao/Configurable_Refcount.h69
-rw-r--r--TAO/tao/Configurable_Refcount.inl55
-rw-r--r--TAO/tao/Connect_Strategy.cpp59
-rw-r--r--TAO/tao/Connect_Strategy.h103
-rw-r--r--TAO/tao/Connection_Handler.cpp434
-rw-r--r--TAO/tao/Connection_Handler.h209
-rw-r--r--TAO/tao/Connection_Handler.inl40
-rw-r--r--TAO/tao/Connection_Purging_Strategy.cpp25
-rw-r--r--TAO/tao/Connection_Purging_Strategy.h68
-rw-r--r--TAO/tao/Connection_Purging_Strategy.inl14
-rw-r--r--TAO/tao/Connector_Impl.cpp65
-rw-r--r--TAO/tao/Connector_Impl.h115
-rw-r--r--TAO/tao/Connector_Registry.cpp271
-rw-r--r--TAO/tao/Connector_Registry.h113
-rw-r--r--TAO/tao/Connector_Registry.i19
-rw-r--r--TAO/tao/Current.pidl35
-rw-r--r--TAO/tao/DLL_Parser.cpp80
-rw-r--r--TAO/tao/DLL_Parser.h100
-rw-r--r--TAO/tao/Default_Collocation_Resolver.cpp29
-rw-r--r--TAO/tao/Default_Collocation_Resolver.h57
-rw-r--r--TAO/tao/Default_Endpoint_Selector_Factory.cpp45
-rw-r--r--TAO/tao/Default_Endpoint_Selector_Factory.h87
-rw-r--r--TAO/tao/Default_Protocols_Hooks.cpp182
-rw-r--r--TAO/tao/Default_Protocols_Hooks.h123
-rw-r--r--TAO/tao/Default_Stub_Factory.cpp50
-rw-r--r--TAO/tao/Default_Stub_Factory.h65
-rw-r--r--TAO/tao/Default_Thread_Lane_Resources_Manager.cpp120
-rw-r--r--TAO/tao/Default_Thread_Lane_Resources_Manager.h111
-rw-r--r--TAO/tao/Domain.mpc35
-rw-r--r--TAO/tao/Domain.pidl77
-rw-r--r--TAO/tao/Domain/DomainS.cpp1692
-rw-r--r--TAO/tao/Domain/DomainS.h504
-rw-r--r--TAO/tao/Domain/DomainS.inl158
-rw-r--r--TAO/tao/Domain/DomainS_T.cpp41
-rw-r--r--TAO/tao/Domain/DomainS_T.h226
-rw-r--r--TAO/tao/Domain/DomainS_T.inl304
-rw-r--r--TAO/tao/Domain/TAO_Domain.pc.in11
-rw-r--r--TAO/tao/Domain/TAO_Domain.rc30
-rw-r--r--TAO/tao/Domain/diffs/Domain.diff23
-rw-r--r--TAO/tao/Domain/domain_export.h39
-rw-r--r--TAO/tao/DomainC.cpp687
-rw-r--r--TAO/tao/DomainC.h491
-rw-r--r--TAO/tao/DomainC.inl93
-rw-r--r--TAO/tao/DoubleSeq.pidl33
-rw-r--r--TAO/tao/DynamicAny.mpc44
-rw-r--r--TAO/tao/DynamicAny/DynAnyFactory.cpp383
-rw-r--r--TAO/tao/DynamicAny/DynAnyFactory.h100
-rw-r--r--TAO/tao/DynamicAny/DynAny_i.cpp561
-rw-r--r--TAO/tao/DynamicAny/DynAny_i.h132
-rw-r--r--TAO/tao/DynamicAny/DynArray_i.cpp664
-rw-r--r--TAO/tao/DynamicAny/DynArray_i.h172
-rw-r--r--TAO/tao/DynamicAny/DynCommon.cpp1855
-rw-r--r--TAO/tao/DynamicAny/DynCommon.h558
-rw-r--r--TAO/tao/DynamicAny/DynEnum_i.cpp350
-rw-r--r--TAO/tao/DynamicAny/DynEnum_i.h163
-rw-r--r--TAO/tao/DynamicAny/DynSequence_i.cpp834
-rw-r--r--TAO/tao/DynamicAny/DynSequence_i.h185
-rw-r--r--TAO/tao/DynamicAny/DynStruct_i.cpp825
-rw-r--r--TAO/tao/DynamicAny/DynStruct_i.h192
-rw-r--r--TAO/tao/DynamicAny/DynUnion_i.cpp1126
-rw-r--r--TAO/tao/DynamicAny/DynUnion_i.h221
-rw-r--r--TAO/tao/DynamicAny/DynamicAny.cpp51
-rw-r--r--TAO/tao/DynamicAny/DynamicAny.h59
-rw-r--r--TAO/tao/DynamicAny/DynamicAny.pidl221
-rw-r--r--TAO/tao/DynamicAny/TAO_DynamicAny.pc.in11
-rw-r--r--TAO/tao/DynamicAny/TAO_DynamicAny.rc30
-rw-r--r--TAO/tao/DynamicAny/diffs/DynamicAny.pidl.diff158
-rw-r--r--TAO/tao/DynamicAny/dynamicany_export.h40
-rw-r--r--TAO/tao/DynamicInterface.mpc35
-rw-r--r--TAO/tao/DynamicInterface/Context.cpp203
-rw-r--r--TAO/tao/DynamicInterface/Context.h209
-rw-r--r--TAO/tao/DynamicInterface/Context.inl97
-rw-r--r--TAO/tao/DynamicInterface/DII_Arguments.cpp146
-rw-r--r--TAO/tao/DynamicInterface/DII_Arguments.h99
-rw-r--r--TAO/tao/DynamicInterface/DII_Arguments.inl33
-rw-r--r--TAO/tao/DynamicInterface/DII_CORBA_methods.h68
-rw-r--r--TAO/tao/DynamicInterface/DII_Invocation.cpp234
-rw-r--r--TAO/tao/DynamicInterface/DII_Invocation.h122
-rw-r--r--TAO/tao/DynamicInterface/DII_Invocation_Adapter.cpp194
-rw-r--r--TAO/tao/DynamicInterface/DII_Invocation_Adapter.h169
-rw-r--r--TAO/tao/DynamicInterface/DII_Reply_Dispatcher.cpp147
-rw-r--r--TAO/tao/DynamicInterface/DII_Reply_Dispatcher.h80
-rw-r--r--TAO/tao/DynamicInterface/Dynamic_Adapter_Impl.cpp157
-rw-r--r--TAO/tao/DynamicInterface/Dynamic_Adapter_Impl.h101
-rw-r--r--TAO/tao/DynamicInterface/Dynamic_Implementation.cpp221
-rw-r--r--TAO/tao/DynamicInterface/Dynamic_Implementation.h113
-rw-r--r--TAO/tao/DynamicInterface/ExceptionList.cpp108
-rw-r--r--TAO/tao/DynamicInterface/ExceptionList.h137
-rw-r--r--TAO/tao/DynamicInterface/ExceptionList.inl58
-rw-r--r--TAO/tao/DynamicInterface/Request.cpp359
-rw-r--r--TAO/tao/DynamicInterface/Request.h274
-rw-r--r--TAO/tao/DynamicInterface/Request.inl202
-rw-r--r--TAO/tao/DynamicInterface/Server_Request.cpp243
-rw-r--r--TAO/tao/DynamicInterface/Server_Request.h187
-rw-r--r--TAO/tao/DynamicInterface/Server_Request.inl86
-rw-r--r--TAO/tao/DynamicInterface/TAO_DynamicInterface.pc.in11
-rw-r--r--TAO/tao/DynamicInterface/TAO_DynamicInterface.rc30
-rw-r--r--TAO/tao/DynamicInterface/Unknown_User_Exception.cpp139
-rw-r--r--TAO/tao/DynamicInterface/Unknown_User_Exception.h112
-rw-r--r--TAO/tao/DynamicInterface/dynamicinterface_export.h40
-rw-r--r--TAO/tao/Dynamic_Adapter.cpp15
-rw-r--r--TAO/tao/Dynamic_Adapter.h116
-rw-r--r--TAO/tao/Endpoint.cpp30
-rw-r--r--TAO/tao/Endpoint.h178
-rw-r--r--TAO/tao/Endpoint.i40
-rw-r--r--TAO/tao/EndpointPolicy.mpc43
-rw-r--r--TAO/tao/EndpointPolicy/EndpointPolicy.cpp62
-rw-r--r--TAO/tao/EndpointPolicy/EndpointPolicy.h51
-rw-r--r--TAO/tao/EndpointPolicy/EndpointPolicy.pidl35
-rw-r--r--TAO/tao/EndpointPolicy/EndpointPolicyType.pidl31
-rw-r--r--TAO/tao/EndpointPolicy/EndpointPolicyTypeA.cpp33
-rw-r--r--TAO/tao/EndpointPolicy/EndpointPolicyTypeA.h55
-rw-r--r--TAO/tao/EndpointPolicy/EndpointPolicyTypeC.cpp49
-rw-r--r--TAO/tao/EndpointPolicy/EndpointPolicyTypeC.h90
-rw-r--r--TAO/tao/EndpointPolicy/EndpointPolicy_Export.h58
-rw-r--r--TAO/tao/EndpointPolicy/EndpointPolicy_Factory.cpp94
-rw-r--r--TAO/tao/EndpointPolicy/EndpointPolicy_Factory.h67
-rw-r--r--TAO/tao/EndpointPolicy/EndpointPolicy_ORBInitializer.cpp86
-rw-r--r--TAO/tao/EndpointPolicy/EndpointPolicy_ORBInitializer.h79
-rw-r--r--TAO/tao/EndpointPolicy/EndpointPolicy_i.cpp84
-rw-r--r--TAO/tao/EndpointPolicy/EndpointPolicy_i.h93
-rw-r--r--TAO/tao/EndpointPolicy/Endpoint_Acceptor_Filter.cpp156
-rw-r--r--TAO/tao/EndpointPolicy/Endpoint_Acceptor_Filter.h70
-rw-r--r--TAO/tao/EndpointPolicy/Endpoint_Acceptor_Filter_Factory.cpp56
-rw-r--r--TAO/tao/EndpointPolicy/Endpoint_Acceptor_Filter_Factory.h56
-rw-r--r--TAO/tao/EndpointPolicy/Endpoint_Value_Impl.cpp20
-rw-r--r--TAO/tao/EndpointPolicy/Endpoint_Value_Impl.h61
-rw-r--r--TAO/tao/EndpointPolicy/IIOPEndpointValue.pidl33
-rw-r--r--TAO/tao/EndpointPolicy/IIOPEndpointValue_i.cpp122
-rw-r--r--TAO/tao/EndpointPolicy/IIOPEndpointValue_i.h120
-rw-r--r--TAO/tao/EndpointPolicy/TAO_EndpointPolicy.pc.in11
-rw-r--r--TAO/tao/Endpoint_Selector_Factory.cpp15
-rw-r--r--TAO/tao/Endpoint_Selector_Factory.h80
-rw-r--r--TAO/tao/Environment.cpp212
-rw-r--r--TAO/tao/Environment.h162
-rw-r--r--TAO/tao/Environment.i54
-rw-r--r--TAO/tao/Exception.cpp143
-rw-r--r--TAO/tao/Exception.h238
-rw-r--r--TAO/tao/Exception.i19
-rw-r--r--TAO/tao/Exception_Data.h68
-rw-r--r--TAO/tao/Exclusive_TMS.cpp131
-rw-r--r--TAO/tao/Exclusive_TMS.h97
-rw-r--r--TAO/tao/FILE_Parser.cpp92
-rw-r--r--TAO/tao/FILE_Parser.h60
-rw-r--r--TAO/tao/Fault_Tolerance_Service.cpp66
-rw-r--r--TAO/tao/Fault_Tolerance_Service.h109
-rw-r--r--TAO/tao/Fault_Tolerance_Service.i34
-rw-r--r--TAO/tao/Fixed_Array_Argument_T.cpp131
-rw-r--r--TAO/tao/Fixed_Array_Argument_T.h169
-rw-r--r--TAO/tao/Fixed_Array_Argument_T.inl117
-rw-r--r--TAO/tao/Fixed_Size_Argument_T.cpp111
-rw-r--r--TAO/tao/Fixed_Size_Argument_T.h162
-rw-r--r--TAO/tao/Fixed_Size_Argument_T.inl100
-rw-r--r--TAO/tao/FlResource.mpc31
-rw-r--r--TAO/tao/FlResource/FlResource_Factory.cpp39
-rw-r--r--TAO/tao/FlResource/FlResource_Factory.h62
-rw-r--r--TAO/tao/FlResource/FlResource_Loader.cpp29
-rw-r--r--TAO/tao/FlResource/FlResource_Loader.h59
-rw-r--r--TAO/tao/FlResource/TAO_FlResource_Export.h58
-rw-r--r--TAO/tao/FloatSeq.pidl34
-rw-r--r--TAO/tao/Flushing_Strategy.cpp16
-rw-r--r--TAO/tao/Flushing_Strategy.h79
-rw-r--r--TAO/tao/GIOP.pidl62
-rw-r--r--TAO/tao/GIOP_Fragmentation_Strategy.cpp9
-rw-r--r--TAO/tao/GIOP_Fragmentation_Strategy.h85
-rw-r--r--TAO/tao/GIOP_Message_Base.cpp2107
-rw-r--r--TAO/tao/GIOP_Message_Base.h320
-rw-r--r--TAO/tao/GIOP_Message_Generator_Parser.cpp171
-rw-r--r--TAO/tao/GIOP_Message_Generator_Parser.h123
-rw-r--r--TAO/tao/GIOP_Message_Generator_Parser_10.cpp498
-rw-r--r--TAO/tao/GIOP_Message_Generator_Parser_10.h102
-rw-r--r--TAO/tao/GIOP_Message_Generator_Parser_11.cpp15
-rw-r--r--TAO/tao/GIOP_Message_Generator_Parser_11.h49
-rw-r--r--TAO/tao/GIOP_Message_Generator_Parser_12.cpp583
-rw-r--r--TAO/tao/GIOP_Message_Generator_Parser_12.h128
-rw-r--r--TAO/tao/GIOP_Message_Generator_Parser_Impl.cpp9
-rw-r--r--TAO/tao/GIOP_Message_Generator_Parser_Impl.h67
-rw-r--r--TAO/tao/GIOP_Message_Generator_Parser_Impl.inl35
-rw-r--r--TAO/tao/GIOP_Message_Lite.cpp1769
-rw-r--r--TAO/tao/GIOP_Message_Lite.h305
-rw-r--r--TAO/tao/GIOP_Message_Locate_Header.cpp11
-rw-r--r--TAO/tao/GIOP_Message_Locate_Header.h82
-rw-r--r--TAO/tao/GIOP_Message_Locate_Header.i53
-rw-r--r--TAO/tao/GIOP_Message_State.cpp267
-rw-r--r--TAO/tao/GIOP_Message_State.h136
-rw-r--r--TAO/tao/GIOP_Message_State.inl57
-rw-r--r--TAO/tao/GIOP_Message_Version.cpp10
-rw-r--r--TAO/tao/GIOP_Message_Version.h75
-rw-r--r--TAO/tao/GIOP_Message_Version.inl59
-rw-r--r--TAO/tao/GIOP_Utils.cpp81
-rw-r--r--TAO/tao/GIOP_Utils.h155
-rw-r--r--TAO/tao/GUIResource_Factory.cpp59
-rw-r--r--TAO/tao/GUIResource_Factory.h100
-rw-r--r--TAO/tao/Generic_Sequence_T.h320
-rw-r--r--TAO/tao/IFR_Client.mpc45
-rw-r--r--TAO/tao/IFR_Client/IFR_Base.pidl400
-rw-r--r--TAO/tao/IFR_Client/IFR_BaseA.h44
-rw-r--r--TAO/tao/IFR_Client/IFR_Basic.pidl424
-rw-r--r--TAO/tao/IFR_Client/IFR_BasicA.h44
-rw-r--r--TAO/tao/IFR_Client/IFR_Client_Adapter_Impl.cpp230
-rw-r--r--TAO/tao/IFR_Client/IFR_Client_Adapter_Impl.h96
-rw-r--r--TAO/tao/IFR_Client/IFR_Components.pidl289
-rw-r--r--TAO/tao/IFR_Client/IFR_ComponentsA.h44
-rw-r--r--TAO/tao/IFR_Client/IFR_Extended.pidl223
-rw-r--r--TAO/tao/IFR_Client/IFR_ExtendedA.h44
-rw-r--r--TAO/tao/IFR_Client/TAO_IFR_Client.pc.in11
-rw-r--r--TAO/tao/IFR_Client/TAO_IFR_Client.rc30
-rw-r--r--TAO/tao/IFR_Client/ifr_client_export.h39
-rw-r--r--TAO/tao/IFR_Client_Adapter.cpp8
-rw-r--r--TAO/tao/IFR_Client_Adapter.h104
-rw-r--r--TAO/tao/IIOP.pidl52
-rw-r--r--TAO/tao/IIOP_Acceptor.cpp1219
-rw-r--r--TAO/tao/IIOP_Acceptor.h279
-rw-r--r--TAO/tao/IIOP_Acceptor.i45
-rw-r--r--TAO/tao/IIOP_Connection_Handler.cpp531
-rw-r--r--TAO/tao/IIOP_Connection_Handler.h145
-rw-r--r--TAO/tao/IIOP_Connector.cpp650
-rw-r--r--TAO/tao/IIOP_Connector.h174
-rw-r--r--TAO/tao/IIOP_Endpoint.cpp608
-rw-r--r--TAO/tao/IIOP_Endpoint.h234
-rw-r--r--TAO/tao/IIOP_Endpoint.i37
-rw-r--r--TAO/tao/IIOP_Endpoints.pidl42
-rw-r--r--TAO/tao/IIOP_Factory.cpp97
-rw-r--r--TAO/tao/IIOP_Factory.h75
-rw-r--r--TAO/tao/IIOP_Lite_Factory.cpp103
-rw-r--r--TAO/tao/IIOP_Lite_Factory.h77
-rw-r--r--TAO/tao/IIOP_Profile.cpp825
-rw-r--r--TAO/tao/IIOP_Profile.h193
-rw-r--r--TAO/tao/IIOP_Transport.cpp519
-rw-r--r--TAO/tao/IIOP_Transport.h166
-rw-r--r--TAO/tao/IOP.pidl33
-rw-r--r--TAO/tao/IOP_IOR.pidl114
-rw-r--r--TAO/tao/IORInterceptor.mpc51
-rw-r--r--TAO/tao/IORInterceptor/IORInfo.cpp197
-rw-r--r--TAO/tao/IORInterceptor/IORInfo.h173
-rw-r--r--TAO/tao/IORInterceptor/IORInfo.inl20
-rw-r--r--TAO/tao/IORInterceptor/IORInfo.pidl66
-rw-r--r--TAO/tao/IORInterceptor/IORInterceptor.h23
-rw-r--r--TAO/tao/IORInterceptor/IORInterceptor.pidl67
-rw-r--r--TAO/tao/IORInterceptor/IORInterceptor_Adapter_Factory_Impl.cpp60
-rw-r--r--TAO/tao/IORInterceptor/IORInterceptor_Adapter_Factory_Impl.h70
-rw-r--r--TAO/tao/IORInterceptor/IORInterceptor_Adapter_Impl.cpp254
-rw-r--r--TAO/tao/IORInterceptor/IORInterceptor_Adapter_Impl.h97
-rw-r--r--TAO/tao/IORInterceptor/IORInterceptor_Details.cpp23
-rw-r--r--TAO/tao/IORInterceptor/IORInterceptor_Details.h63
-rw-r--r--TAO/tao/IORInterceptor/TAO_IORInterceptor.pc.in11
-rw-r--r--TAO/tao/IORInterceptor/TAO_IORInterceptor.rc30
-rw-r--r--TAO/tao/IORInterceptor/iorinterceptor_export.h40
-rw-r--r--TAO/tao/IORInterceptor_Adapter.cpp15
-rw-r--r--TAO/tao/IORInterceptor_Adapter.h114
-rw-r--r--TAO/tao/IORInterceptor_Adapter_Factory.cpp14
-rw-r--r--TAO/tao/IORInterceptor_Adapter_Factory.h55
-rw-r--r--TAO/tao/IORManipulation.mpc45
-rw-r--r--TAO/tao/IORManipulation/IOR.pidl201
-rw-r--r--TAO/tao/IORManipulation/IORA.h27
-rw-r--r--TAO/tao/IORManipulation/IORManip_Loader.cpp46
-rw-r--r--TAO/tao/IORManipulation/IORManip_Loader.h62
-rw-r--r--TAO/tao/IORManipulation/IORManipulation.cpp382
-rw-r--r--TAO/tao/IORManipulation/IORManipulation.h172
-rw-r--r--TAO/tao/IORManipulation/TAO_IORManip.pc.in11
-rw-r--r--TAO/tao/IORManipulation/TAO_IORManip.rc30
-rw-r--r--TAO/tao/IORManipulation/ior_manip_export.h40
-rw-r--r--TAO/tao/IORTable.mpc44
-rw-r--r--TAO/tao/IORTable/IORTable.cpp28
-rw-r--r--TAO/tao/IORTable/IORTable.h48
-rw-r--r--TAO/tao/IORTable/IORTable.pidl79
-rw-r--r--TAO/tao/IORTable/IOR_Table_Impl.cpp108
-rw-r--r--TAO/tao/IORTable/IOR_Table_Impl.h119
-rw-r--r--TAO/tao/IORTable/TAO_IORTable.pc.in11
-rw-r--r--TAO/tao/IORTable/TAO_IORTable.rc30
-rw-r--r--TAO/tao/IORTable/Table_Adapter.cpp195
-rw-r--r--TAO/tao/IORTable/Table_Adapter.h94
-rw-r--r--TAO/tao/IORTable/iortable_export.h40
-rw-r--r--TAO/tao/IOR_Parser.cpp14
-rw-r--r--TAO/tao/IOR_Parser.h71
-rw-r--r--TAO/tao/ImR_Client.mpc51
-rw-r--r--TAO/tao/ImR_Client/ImR_Client.cpp268
-rw-r--r--TAO/tao/ImR_Client/ImR_Client.h80
-rw-r--r--TAO/tao/ImR_Client/ImplRepo.pidl176
-rw-r--r--TAO/tao/ImR_Client/ImplRepoA.h44
-rw-r--r--TAO/tao/ImR_Client/ServerObject.pidl36
-rw-r--r--TAO/tao/ImR_Client/ServerObject_i.cpp41
-rw-r--r--TAO/tao/ImR_Client/ServerObject_i.h71
-rw-r--r--TAO/tao/ImR_Client/TAO_IMR_Client.rc30
-rw-r--r--TAO/tao/ImR_Client/TAO_ImR_Client.pc.in11
-rw-r--r--TAO/tao/ImR_Client/imr_client_export.h39
-rw-r--r--TAO/tao/Incoming_Message_Queue.cpp379
-rw-r--r--TAO/tao/Incoming_Message_Queue.h205
-rw-r--r--TAO/tao/Incoming_Message_Queue.inl46
-rw-r--r--TAO/tao/Incoming_Message_Stack.cpp11
-rwxr-xr-xTAO/tao/Incoming_Message_Stack.h89
-rwxr-xr-xTAO/tao/Incoming_Message_Stack.inl63
-rw-r--r--TAO/tao/InterfaceDef.pidl26
-rw-r--r--TAO/tao/Intrusive_Ref_Count_Base_T.cpp21
-rw-r--r--TAO/tao/Intrusive_Ref_Count_Base_T.h80
-rw-r--r--TAO/tao/Intrusive_Ref_Count_Base_T.inl38
-rw-r--r--TAO/tao/Intrusive_Ref_Count_Handle_T.cpp12
-rw-r--r--TAO/tao/Intrusive_Ref_Count_Handle_T.h159
-rw-r--r--TAO/tao/Intrusive_Ref_Count_Handle_T.inl157
-rw-r--r--TAO/tao/InvalidName.pidl55
-rw-r--r--TAO/tao/Invocation_Adapter.cpp421
-rw-r--r--TAO/tao/Invocation_Adapter.h294
-rw-r--r--TAO/tao/Invocation_Adapter.inl31
-rw-r--r--TAO/tao/Invocation_Base.cpp280
-rw-r--r--TAO/tao/Invocation_Base.h251
-rw-r--r--TAO/tao/Invocation_Base.inl96
-rw-r--r--TAO/tao/Invocation_Endpoint_Selectors.cpp98
-rw-r--r--TAO/tao/Invocation_Endpoint_Selectors.h109
-rw-r--r--TAO/tao/Invocation_Utils.h77
-rw-r--r--TAO/tao/LF_CH_Event.cpp105
-rw-r--r--TAO/tao/LF_CH_Event.h121
-rw-r--r--TAO/tao/LF_Connect_Strategy.cpp67
-rw-r--r--TAO/tao/LF_Connect_Strategy.h67
-rw-r--r--TAO/tao/LF_Event.cpp50
-rw-r--r--TAO/tao/LF_Event.h157
-rw-r--r--TAO/tao/LF_Event.inl37
-rw-r--r--TAO/tao/LF_Event_Binder.cpp20
-rw-r--r--TAO/tao/LF_Event_Binder.h57
-rw-r--r--TAO/tao/LF_Event_Binder.inl15
-rw-r--r--TAO/tao/LF_Event_Loop_Thread_Helper.cpp11
-rw-r--r--TAO/tao/LF_Event_Loop_Thread_Helper.h67
-rw-r--r--TAO/tao/LF_Event_Loop_Thread_Helper.inl33
-rw-r--r--TAO/tao/LF_Follower.cpp41
-rw-r--r--TAO/tao/LF_Follower.h80
-rw-r--r--TAO/tao/LF_Follower.inl19
-rw-r--r--TAO/tao/LF_Follower_Auto_Adder.cpp20
-rw-r--r--TAO/tao/LF_Follower_Auto_Adder.h60
-rw-r--r--TAO/tao/LF_Follower_Auto_Adder.inl17
-rw-r--r--TAO/tao/LF_Follower_Auto_Ptr.cpp20
-rw-r--r--TAO/tao/LF_Follower_Auto_Ptr.h64
-rw-r--r--TAO/tao/LF_Follower_Auto_Ptr.inl32
-rw-r--r--TAO/tao/LF_Invocation_Event.cpp92
-rw-r--r--TAO/tao/LF_Invocation_Event.h86
-rw-r--r--TAO/tao/LF_Multi_Event.cpp123
-rw-r--r--TAO/tao/LF_Multi_Event.h101
-rw-r--r--TAO/tao/LF_Strategy.cpp15
-rw-r--r--TAO/tao/LF_Strategy.h82
-rw-r--r--TAO/tao/LF_Strategy_Complete.cpp51
-rw-r--r--TAO/tao/LF_Strategy_Complete.h55
-rw-r--r--TAO/tao/LRU_Connection_Purging_Strategy.cpp31
-rw-r--r--TAO/tao/LRU_Connection_Purging_Strategy.h61
-rw-r--r--TAO/tao/Leader_Follower.cpp495
-rw-r--r--TAO/tao/Leader_Follower.h299
-rw-r--r--TAO/tao/Leader_Follower.i227
-rw-r--r--TAO/tao/Leader_Follower_Flushing_Strategy.cpp73
-rw-r--r--TAO/tao/Leader_Follower_Flushing_Strategy.h48
-rw-r--r--TAO/tao/Load_Protocol_Factory_T.h116
-rw-r--r--TAO/tao/LocalObject.cpp240
-rw-r--r--TAO/tao/LocalObject.h268
-rw-r--r--TAO/tao/LocalObject.i55
-rw-r--r--TAO/tao/LocateRequest_Invocation.cpp192
-rw-r--r--TAO/tao/LocateRequest_Invocation.h84
-rw-r--r--TAO/tao/LocateRequest_Invocation_Adapter.cpp117
-rw-r--r--TAO/tao/LocateRequest_Invocation_Adapter.h79
-rw-r--r--TAO/tao/LongDoubleSeq.pidl31
-rw-r--r--TAO/tao/LongLongSeq.pidl31
-rw-r--r--TAO/tao/LongSeq.pidl31
-rw-r--r--TAO/tao/MCAST_Parser.cpp524
-rw-r--r--TAO/tao/MCAST_Parser.h100
-rw-r--r--TAO/tao/MCAST_Parser.i12
-rw-r--r--TAO/tao/MMAP_Allocator.cpp99
-rw-r--r--TAO/tao/MMAP_Allocator.h77
-rw-r--r--TAO/tao/MProfile.cpp382
-rw-r--r--TAO/tao/MProfile.h259
-rw-r--r--TAO/tao/MProfile.i204
-rw-r--r--TAO/tao/Makefile.am4222
-rw-r--r--TAO/tao/Messaging.mpc62
-rw-r--r--TAO/tao/Messaging/AMH_Response_Handler.cpp263
-rw-r--r--TAO/tao/Messaging/AMH_Response_Handler.h222
-rw-r--r--TAO/tao/Messaging/Asynch_Invocation.cpp196
-rw-r--r--TAO/tao/Messaging/Asynch_Invocation.h74
-rw-r--r--TAO/tao/Messaging/Asynch_Invocation_Adapter.cpp197
-rw-r--r--TAO/tao/Messaging/Asynch_Invocation_Adapter.h111
-rw-r--r--TAO/tao/Messaging/Asynch_Reply_Dispatcher.cpp283
-rw-r--r--TAO/tao/Messaging/Asynch_Reply_Dispatcher.h79
-rw-r--r--TAO/tao/Messaging/Asynch_Timeout_Handler.cpp78
-rw-r--r--TAO/tao/Messaging/Asynch_Timeout_Handler.h82
-rw-r--r--TAO/tao/Messaging/Connection_Timeout_Policy_i.cpp200
-rw-r--r--TAO/tao/Messaging/Connection_Timeout_Policy_i.h106
-rw-r--r--TAO/tao/Messaging/ExceptionHolder.pidl43
-rw-r--r--TAO/tao/Messaging/ExceptionHolder_i.cpp95
-rw-r--r--TAO/tao/Messaging/ExceptionHolder_i.h100
-rw-r--r--TAO/tao/Messaging/Messaging.cpp118
-rw-r--r--TAO/tao/Messaging/Messaging.h98
-rw-r--r--TAO/tao/Messaging/Messaging.pidl53
-rw-r--r--TAO/tao/Messaging/MessagingA.cpp170
-rw-r--r--TAO/tao/Messaging/MessagingA.h87
-rw-r--r--TAO/tao/Messaging/MessagingC.cpp243
-rw-r--r--TAO/tao/Messaging/MessagingC.h251
-rw-r--r--TAO/tao/Messaging/MessagingC.inl66
-rw-r--r--TAO/tao/Messaging/MessagingS.cpp803
-rw-r--r--TAO/tao/Messaging/MessagingS.h213
-rw-r--r--TAO/tao/Messaging/MessagingS_T.cpp41
-rw-r--r--TAO/tao/Messaging/MessagingS_T.h114
-rw-r--r--TAO/tao/Messaging/MessagingS_T.inl123
-rw-r--r--TAO/tao/Messaging/Messaging_Loader.cpp85
-rw-r--r--TAO/tao/Messaging/Messaging_Loader.h50
-rw-r--r--TAO/tao/Messaging/Messaging_No_Impl.pidl140
-rw-r--r--TAO/tao/Messaging/Messaging_No_ImplA.cpp499
-rw-r--r--TAO/tao/Messaging/Messaging_No_ImplA.h160
-rw-r--r--TAO/tao/Messaging/Messaging_No_ImplC.cpp1494
-rw-r--r--TAO/tao/Messaging/Messaging_No_ImplC.h1774
-rw-r--r--TAO/tao/Messaging/Messaging_ORBInitializer.cpp192
-rw-r--r--TAO/tao/Messaging/Messaging_ORBInitializer.h83
-rw-r--r--TAO/tao/Messaging/Messaging_PolicyFactory.cpp111
-rw-r--r--TAO/tao/Messaging/Messaging_PolicyFactory.h66
-rw-r--r--TAO/tao/Messaging/Messaging_Policy_i.cpp346
-rw-r--r--TAO/tao/Messaging/Messaging_Policy_i.h167
-rw-r--r--TAO/tao/Messaging/Messaging_Policy_i.i17
-rw-r--r--TAO/tao/Messaging/Messaging_RT_Policy.pidl49
-rw-r--r--TAO/tao/Messaging/Messaging_SyncScope_Policy.pidl47
-rw-r--r--TAO/tao/Messaging/Pollable.pidl61
-rw-r--r--TAO/tao/Messaging/TAO_Ext.pidl46
-rw-r--r--TAO/tao/Messaging/TAO_Messaging.pc.in11
-rw-r--r--TAO/tao/Messaging/TAO_Messaging.rc30
-rw-r--r--TAO/tao/Messaging/diffs/Messaging.diff50
-rw-r--r--TAO/tao/Messaging/diffs/Messaging_No_Impl.diff14
-rw-r--r--TAO/tao/Messaging/messaging_export.h40
-rw-r--r--TAO/tao/Messaging_PolicyValue.pidl45
-rw-r--r--TAO/tao/Messaging_SyncScope.pidl34
-rw-r--r--TAO/tao/Muxed_TMS.cpp232
-rw-r--r--TAO/tao/Muxed_TMS.h98
-rw-r--r--TAO/tao/NVList_Adapter.cpp15
-rw-r--r--TAO/tao/NVList_Adapter.h64
-rw-r--r--TAO/tao/New_Leader_Generator.cpp17
-rw-r--r--TAO/tao/New_Leader_Generator.h51
-rw-r--r--TAO/tao/Null_Fragmentation_Strategy.cpp17
-rw-r--r--TAO/tao/Null_Fragmentation_Strategy.h64
-rw-r--r--TAO/tao/ORB.cpp2009
-rw-r--r--TAO/tao/ORB.h674
-rw-r--r--TAO/tao/ORB.i85
-rw-r--r--TAO/tao/ORBInitializer_Registry.cpp90
-rw-r--r--TAO/tao/ORBInitializer_Registry.h48
-rw-r--r--TAO/tao/ORBInitializer_Registry_Adapter.cpp18
-rw-r--r--TAO/tao/ORBInitializer_Registry_Adapter.h104
-rw-r--r--TAO/tao/ORB_Constants.h240
-rw-r--r--TAO/tao/ORB_Core.cpp3580
-rw-r--r--TAO/tao/ORB_Core.h1452
-rw-r--r--TAO/tao/ORB_Core.i648
-rw-r--r--TAO/tao/ORB_Core_Auto_Ptr.cpp33
-rw-r--r--TAO/tao/ORB_Core_Auto_Ptr.h79
-rw-r--r--TAO/tao/ORB_Core_Auto_Ptr.inl59
-rw-r--r--TAO/tao/ORB_Core_TSS_Resources.cpp32
-rw-r--r--TAO/tao/ORB_Core_TSS_Resources.h91
-rw-r--r--TAO/tao/ORB_Table.cpp186
-rw-r--r--TAO/tao/ORB_Table.h208
-rw-r--r--TAO/tao/ORB_Table.inl96
-rw-r--r--TAO/tao/ObjRefTemplate.mpc53
-rw-r--r--TAO/tao/ObjRefTemplate/Default_ORT.pidl36
-rw-r--r--TAO/tao/ObjRefTemplate/ORT_Adapter_Factory_Impl.cpp58
-rw-r--r--TAO/tao/ObjRefTemplate/ORT_Adapter_Factory_Impl.h70
-rw-r--r--TAO/tao/ObjRefTemplate/ORT_Adapter_Impl.cpp117
-rw-r--r--TAO/tao/ObjRefTemplate/ORT_Adapter_Impl.h120
-rw-r--r--TAO/tao/ObjRefTemplate/ObjectReferenceTemplate.h26
-rw-r--r--TAO/tao/ObjRefTemplate/ObjectReferenceTemplate.pidl56
-rw-r--r--TAO/tao/ObjRefTemplate/ObjectReferenceTemplateA.h3
-rw-r--r--TAO/tao/ObjRefTemplate/ObjectReferenceTemplate_i.cpp80
-rw-r--r--TAO/tao/ObjRefTemplate/ObjectReferenceTemplate_i.h124
-rw-r--r--TAO/tao/ObjRefTemplate/ObjectReferenceTemplate_include.pidl37
-rw-r--r--TAO/tao/ObjRefTemplate/ObjectReferenceTemplate_includeA.h66
-rw-r--r--TAO/tao/ObjRefTemplate/ObjectReferenceTemplate_includeC.h98
-rw-r--r--TAO/tao/ObjRefTemplate/ObjectReferenceTemplate_includeS.h67
-rw-r--r--TAO/tao/ObjRefTemplate/TAO_ObjRefTemplate.pc.in11
-rw-r--r--TAO/tao/ObjRefTemplate/TAO_ObjRefTemplate.rc30
-rw-r--r--TAO/tao/ObjRefTemplate/ort_export.h40
-rw-r--r--TAO/tao/Object.cpp1010
-rw-r--r--TAO/tao/Object.h465
-rw-r--r--TAO/tao/Object.i100
-rw-r--r--TAO/tao/ObjectIdList.pidl45
-rw-r--r--TAO/tao/ObjectKey_Table.cpp186
-rw-r--r--TAO/tao/ObjectKey_Table.h146
-rw-r--r--TAO/tao/Object_Argument_T.cpp121
-rw-r--r--TAO/tao/Object_Argument_T.h176
-rw-r--r--TAO/tao/Object_Argument_T.inl104
-rw-r--r--TAO/tao/Object_Key.pidl22
-rw-r--r--TAO/tao/Object_KeyC.cpp265
-rw-r--r--TAO/tao/Object_KeyC.h189
-rw-r--r--TAO/tao/Object_Loader.cpp16
-rw-r--r--TAO/tao/Object_Loader.h71
-rw-r--r--TAO/tao/Object_Proxy_Broker.cpp15
-rw-r--r--TAO/tao/Object_Proxy_Broker.h88
-rw-r--r--TAO/tao/Object_Ref_Table.cpp86
-rw-r--r--TAO/tao/Object_Ref_Table.h132
-rw-r--r--TAO/tao/Object_Ref_Table.inl75
-rw-r--r--TAO/tao/Object_Reference_Sequence_Element_T.h131
-rw-r--r--TAO/tao/Object_Reference_Traits_Base_T.h56
-rw-r--r--TAO/tao/Object_Reference_Traits_T.h83
-rw-r--r--TAO/tao/Object_T.cpp136
-rw-r--r--TAO/tao/Object_T.h82
-rw-r--r--TAO/tao/Objref_VarOut_T.cpp195
-rw-r--r--TAO/tao/Objref_VarOut_T.h136
-rw-r--r--TAO/tao/OctetSeq.pidl36
-rw-r--r--TAO/tao/OctetSeqC.cpp124
-rw-r--r--TAO/tao/OctetSeqC.h175
-rw-r--r--TAO/tao/OctetSeqS.h28
-rw-r--r--TAO/tao/On_Demand_Fragmentation_Strategy.cpp93
-rw-r--r--TAO/tao/On_Demand_Fragmentation_Strategy.h77
-rw-r--r--TAO/tao/PI.mpc67
-rw-r--r--TAO/tao/PI/ClientRequestDetails.cpp77
-rw-r--r--TAO/tao/PI/ClientRequestDetails.h84
-rw-r--r--TAO/tao/PI/ClientRequestDetails.inl27
-rw-r--r--TAO/tao/PI/ClientRequestInfo.cpp745
-rw-r--r--TAO/tao/PI/ClientRequestInfo.h288
-rw-r--r--TAO/tao/PI/ClientRequestInfo.pidl49
-rw-r--r--TAO/tao/PI/ClientRequestInterceptor.pidl50
-rw-r--r--TAO/tao/PI/ClientRequestInterceptor_Adapter_Impl.cpp321
-rw-r--r--TAO/tao/PI/ClientRequestInterceptor_Adapter_Impl.h142
-rw-r--r--TAO/tao/PI/ClientRequestInterceptor_Adapter_Impl.inl15
-rw-r--r--TAO/tao/PI/ClientRequestInterceptor_Factory_Impl.cpp49
-rw-r--r--TAO/tao/PI/ClientRequestInterceptor_Factory_Impl.h55
-rw-r--r--TAO/tao/PI/Interceptor.pidl38
-rw-r--r--TAO/tao/PI/Interceptor_List_T.cpp245
-rw-r--r--TAO/tao/PI/Interceptor_List_T.h108
-rw-r--r--TAO/tao/PI/InvalidSlot.pidl32
-rw-r--r--TAO/tao/PI/ORBInitInfo.cpp468
-rw-r--r--TAO/tao/PI/ORBInitInfo.h344
-rw-r--r--TAO/tao/PI/ORBInitInfo.inl26
-rw-r--r--TAO/tao/PI/ORBInitInfo.pidl90
-rw-r--r--TAO/tao/PI/ORBInitInfoA.h40
-rw-r--r--TAO/tao/PI/ORBInitializer.pidl43
-rw-r--r--TAO/tao/PI/ORBInitializer_Registry_Impl.cpp255
-rw-r--r--TAO/tao/PI/ORBInitializer_Registry_Impl.h109
-rw-r--r--TAO/tao/PI/PI.cpp72
-rw-r--r--TAO/tao/PI/PI.h62
-rw-r--r--TAO/tao/PI/PICurrent.cpp126
-rw-r--r--TAO/tao/PI/PICurrent.h152
-rw-r--r--TAO/tao/PI/PICurrent.inl13
-rw-r--r--TAO/tao/PI/PICurrent.pidl38
-rw-r--r--TAO/tao/PI/PICurrent_Impl.cpp141
-rw-r--r--TAO/tao/PI/PICurrent_Impl.h133
-rw-r--r--TAO/tao/PI/PICurrent_Impl.inl61
-rw-r--r--TAO/tao/PI/PICurrent_Loader.cpp55
-rw-r--r--TAO/tao/PI/PICurrent_Loader.h57
-rw-r--r--TAO/tao/PI/PIForwardRequest.pidl37
-rw-r--r--TAO/tao/PI/PI_ORBInitializer.cpp107
-rw-r--r--TAO/tao/PI/PI_ORBInitializer.h84
-rw-r--r--TAO/tao/PI/PI_PolicyFactory.cpp48
-rw-r--r--TAO/tao/PI/PI_PolicyFactory.h52
-rw-r--r--TAO/tao/PI/PolicyFactory.pidl36
-rw-r--r--TAO/tao/PI/PolicyFactoryA.cpp56
-rw-r--r--TAO/tao/PI/PolicyFactoryA.h62
-rw-r--r--TAO/tao/PI/PolicyFactoryC.cpp180
-rw-r--r--TAO/tao/PI/PolicyFactoryC.h218
-rw-r--r--TAO/tao/PI/PolicyFactoryS.h28
-rw-r--r--TAO/tao/PI/PolicyFactory_Loader.cpp50
-rw-r--r--TAO/tao/PI/PolicyFactory_Loader.h52
-rw-r--r--TAO/tao/PI/PolicyFactory_Registry.cpp123
-rw-r--r--TAO/tao/PI/PolicyFactory_Registry.h102
-rw-r--r--TAO/tao/PI/ProcessingModePolicy.cpp59
-rw-r--r--TAO/tao/PI/ProcessingModePolicy.h72
-rw-r--r--TAO/tao/PI/ProcessingModePolicy.pidl42
-rw-r--r--TAO/tao/PI/RequestInfo.pidl54
-rw-r--r--TAO/tao/PI/RequestInfo_Util.cpp113
-rw-r--r--TAO/tao/PI/RequestInfo_Util.h91
-rw-r--r--TAO/tao/PI/TAO_PI.pc.in11
-rw-r--r--TAO/tao/PI/diff/PolicyFactory.diff164
-rw-r--r--TAO/tao/PI/pi_export.h40
-rw-r--r--TAO/tao/PI_Forward.pidl53
-rw-r--r--TAO/tao/PI_Server.mpc42
-rw-r--r--TAO/tao/PI_Server/PICurrent_Guard.cpp72
-rw-r--r--TAO/tao/PI_Server/PICurrent_Guard.h96
-rw-r--r--TAO/tao/PI_Server/PI_Server.cpp22
-rw-r--r--TAO/tao/PI_Server/PI_Server.h53
-rw-r--r--TAO/tao/PI_Server/PI_Server_Loader.cpp87
-rw-r--r--TAO/tao/PI_Server/PI_Server_Loader.h48
-rw-r--r--TAO/tao/PI_Server/PI_Server_include.pidl15
-rw-r--r--TAO/tao/PI_Server/PI_Server_includeA.h44
-rw-r--r--TAO/tao/PI_Server/PI_Server_includeC.h56
-rw-r--r--TAO/tao/PI_Server/PI_Server_includeS.h41
-rw-r--r--TAO/tao/PI_Server/Policy_Creator_T.h53
-rw-r--r--TAO/tao/PI_Server/PortableServer_ORBInitializer.cpp111
-rw-r--r--TAO/tao/PI_Server/PortableServer_ORBInitializer.h65
-rw-r--r--TAO/tao/PI_Server/PortableServer_PolicyFactory.cpp125
-rw-r--r--TAO/tao/PI_Server/PortableServer_PolicyFactory.h45
-rw-r--r--TAO/tao/PI_Server/ServerInterceptorAdapter.cpp607
-rw-r--r--TAO/tao/PI_Server/ServerInterceptorAdapter.h195
-rw-r--r--TAO/tao/PI_Server/ServerRequestDetails.cpp77
-rw-r--r--TAO/tao/PI_Server/ServerRequestDetails.h83
-rw-r--r--TAO/tao/PI_Server/ServerRequestDetails.inl27
-rw-r--r--TAO/tao/PI_Server/ServerRequestInfo.cpp591
-rw-r--r--TAO/tao/PI_Server/ServerRequestInfo.h317
-rw-r--r--TAO/tao/PI_Server/ServerRequestInfo.inl60
-rw-r--r--TAO/tao/PI_Server/ServerRequestInfo.pidl51
-rw-r--r--TAO/tao/PI_Server/ServerRequestInterceptor.pidl51
-rw-r--r--TAO/tao/PI_Server/ServerRequestInterceptorA.cpp58
-rw-r--r--TAO/tao/PI_Server/ServerRequestInterceptorA.h65
-rw-r--r--TAO/tao/PI_Server/ServerRequestInterceptorC.cpp173
-rw-r--r--TAO/tao/PI_Server/ServerRequestInterceptorC.h314
-rw-r--r--TAO/tao/PI_Server/ServerRequestInterceptorS.h28
-rw-r--r--TAO/tao/PI_Server/ServerRequestInterceptor_Factory_Impl.cpp50
-rw-r--r--TAO/tao/PI_Server/ServerRequestInterceptor_Factory_Impl.h55
-rw-r--r--TAO/tao/PI_Server/TAO_PI_Server.pc.in11
-rw-r--r--TAO/tao/PI_Server/diffs/ServerRequestInterceptor.diff24
-rw-r--r--TAO/tao/PI_Server/pi_server_export.h40
-rw-r--r--TAO/tao/PP_Memory_Management.txt136
-rw-r--r--TAO/tao/ParameterMode.pidl37
-rw-r--r--TAO/tao/Parser_Registry.cpp78
-rw-r--r--TAO/tao/Parser_Registry.h93
-rw-r--r--TAO/tao/Parser_Registry.i19
-rw-r--r--TAO/tao/Pluggable_Messaging.cpp16
-rw-r--r--TAO/tao/Pluggable_Messaging.h210
-rw-r--r--TAO/tao/Pluggable_Messaging_Utils.cpp23
-rw-r--r--TAO/tao/Pluggable_Messaging_Utils.h193
-rw-r--r--TAO/tao/Pluggable_Messaging_Utils.i33
-rw-r--r--TAO/tao/Policy.pidl96
-rw-r--r--TAO/tao/PolicyC.cpp1044
-rw-r--r--TAO/tao/PolicyC.h686
-rw-r--r--TAO/tao/PolicyC.inl62
-rw-r--r--TAO/tao/PolicyFactory_Registry_Adapter.cpp17
-rw-r--r--TAO/tao/PolicyFactory_Registry_Adapter.h94
-rw-r--r--TAO/tao/PolicyFactory_Registry_Factory.cpp15
-rw-r--r--TAO/tao/PolicyFactory_Registry_Factory.h47
-rw-r--r--TAO/tao/PolicyS.h23
-rw-r--r--TAO/tao/Policy_Current.cpp83
-rw-r--r--TAO/tao/Policy_Current.h94
-rw-r--r--TAO/tao/Policy_Current.inl12
-rw-r--r--TAO/tao/Policy_Current_Impl.cpp42
-rw-r--r--TAO/tao/Policy_Current_Impl.h86
-rw-r--r--TAO/tao/Policy_Current_Impl.inl29
-rw-r--r--TAO/tao/Policy_Forward.pidl51
-rw-r--r--TAO/tao/Policy_Manager.cpp40
-rw-r--r--TAO/tao/Policy_Manager.h99
-rw-r--r--TAO/tao/Policy_Manager.i38
-rw-r--r--TAO/tao/Policy_Set.cpp373
-rw-r--r--TAO/tao/Policy_Set.h136
-rw-r--r--TAO/tao/Policy_Set.i27
-rw-r--r--TAO/tao/Policy_Validator.cpp104
-rw-r--r--TAO/tao/Policy_Validator.h120
-rw-r--r--TAO/tao/PortableInterceptor.h47
-rw-r--r--TAO/tao/PortableInterceptor.pidl59
-rw-r--r--TAO/tao/PortableServer.mpc74
-rw-r--r--TAO/tao/PortableServer/Acceptor_Filter_Factory.cpp46
-rw-r--r--TAO/tao/PortableServer/Acceptor_Filter_Factory.h73
-rw-r--r--TAO/tao/PortableServer/Active_Object_Map.cpp938
-rw-r--r--TAO/tao/PortableServer/Active_Object_Map.h626
-rw-r--r--TAO/tao/PortableServer/Active_Object_Map.i264
-rw-r--r--TAO/tao/PortableServer/Active_Object_Map_Entry.cpp21
-rw-r--r--TAO/tao/PortableServer/Active_Object_Map_Entry.h65
-rw-r--r--TAO/tao/PortableServer/Active_Policy_Strategies.cpp241
-rw-r--r--TAO/tao/PortableServer/Active_Policy_Strategies.h107
-rw-r--r--TAO/tao/PortableServer/Active_Policy_Strategies.inl62
-rw-r--r--TAO/tao/PortableServer/AdapterActivator.pidl34
-rw-r--r--TAO/tao/PortableServer/Adapter_Activator.cpp70
-rw-r--r--TAO/tao/PortableServer/Adapter_Activator.h66
-rw-r--r--TAO/tao/PortableServer/Any_SArg_Traits.h51
-rw-r--r--TAO/tao/PortableServer/BD_String_SArgument_T.cpp154
-rw-r--r--TAO/tao/PortableServer/BD_String_SArgument_T.h183
-rw-r--r--TAO/tao/PortableServer/BD_String_SArgument_T.inl89
-rw-r--r--TAO/tao/PortableServer/Basic_SArgument_T.cpp110
-rw-r--r--TAO/tao/PortableServer/Basic_SArgument_T.h163
-rw-r--r--TAO/tao/PortableServer/Basic_SArgument_T.inl73
-rw-r--r--TAO/tao/PortableServer/Basic_SArguments.h114
-rw-r--r--TAO/tao/PortableServer/Collocated_Object_Proxy_Broker.cpp330
-rw-r--r--TAO/tao/PortableServer/Collocated_Object_Proxy_Broker.h82
-rw-r--r--TAO/tao/PortableServer/Creation_Time.cpp10
-rw-r--r--TAO/tao/PortableServer/Creation_Time.h104
-rw-r--r--TAO/tao/PortableServer/Creation_Time.inl126
-rw-r--r--TAO/tao/PortableServer/Default_Acceptor_Filter.cpp58
-rw-r--r--TAO/tao/PortableServer/Default_Acceptor_Filter.h64
-rw-r--r--TAO/tao/PortableServer/Default_Policy_Validator.cpp157
-rw-r--r--TAO/tao/PortableServer/Default_Policy_Validator.h68
-rw-r--r--TAO/tao/PortableServer/Default_Servant_Dispatcher.cpp69
-rw-r--r--TAO/tao/PortableServer/Default_Servant_Dispatcher.h77
-rw-r--r--TAO/tao/PortableServer/Direct_Collocation_Upcall_Wrapper.cpp73
-rw-r--r--TAO/tao/PortableServer/Direct_Collocation_Upcall_Wrapper.h78
-rw-r--r--TAO/tao/PortableServer/Fixed_Array_SArgument_T.cpp132
-rw-r--r--TAO/tao/PortableServer/Fixed_Array_SArgument_T.h173
-rw-r--r--TAO/tao/PortableServer/Fixed_Array_SArgument_T.inl95
-rw-r--r--TAO/tao/PortableServer/Fixed_Size_SArgument_T.cpp115
-rw-r--r--TAO/tao/PortableServer/Fixed_Size_SArgument_T.h234
-rw-r--r--TAO/tao/PortableServer/Fixed_Size_SArgument_T.inl71
-rw-r--r--TAO/tao/PortableServer/ForwardRequest.pidl28
-rw-r--r--TAO/tao/PortableServer/IdAssignmentPolicy.cpp71
-rw-r--r--TAO/tao/PortableServer/IdAssignmentPolicy.h81
-rw-r--r--TAO/tao/PortableServer/IdAssignmentPolicy.pidl36
-rw-r--r--TAO/tao/PortableServer/IdAssignmentStrategy.cpp46
-rw-r--r--TAO/tao/PortableServer/IdAssignmentStrategy.h59
-rw-r--r--TAO/tao/PortableServer/IdAssignmentStrategyFactory.h52
-rw-r--r--TAO/tao/PortableServer/IdAssignmentStrategyFactoryImpl.cpp73
-rw-r--r--TAO/tao/PortableServer/IdAssignmentStrategyFactoryImpl.h54
-rw-r--r--TAO/tao/PortableServer/IdAssignmentStrategySystem.cpp44
-rw-r--r--TAO/tao/PortableServer/IdAssignmentStrategySystem.h49
-rw-r--r--TAO/tao/PortableServer/IdAssignmentStrategyUser.cpp42
-rw-r--r--TAO/tao/PortableServer/IdAssignmentStrategyUser.h49
-rw-r--r--TAO/tao/PortableServer/IdUniquenessPolicy.cpp71
-rw-r--r--TAO/tao/PortableServer/IdUniquenessPolicy.h81
-rw-r--r--TAO/tao/PortableServer/IdUniquenessPolicy.pidl37
-rw-r--r--TAO/tao/PortableServer/IdUniquenessStrategy.h56
-rw-r--r--TAO/tao/PortableServer/IdUniquenessStrategyFactory.h53
-rw-r--r--TAO/tao/PortableServer/IdUniquenessStrategyFactoryImpl.cpp100
-rw-r--r--TAO/tao/PortableServer/IdUniquenessStrategyFactoryImpl.h53
-rw-r--r--TAO/tao/PortableServer/IdUniquenessStrategyMultiple.cpp67
-rw-r--r--TAO/tao/PortableServer/IdUniquenessStrategyMultiple.h59
-rw-r--r--TAO/tao/PortableServer/IdUniquenessStrategyUnique.cpp79
-rw-r--r--TAO/tao/PortableServer/IdUniquenessStrategyUnique.h65
-rw-r--r--TAO/tao/PortableServer/IdUniquenessStrategyUniqueFactoryImpl.cpp68
-rw-r--r--TAO/tao/PortableServer/IdUniquenessStrategyUniqueFactoryImpl.h55
-rw-r--r--TAO/tao/PortableServer/ImR_Client_Adapter.cpp21
-rw-r--r--TAO/tao/PortableServer/ImR_Client_Adapter.h65
-rw-r--r--TAO/tao/PortableServer/ImplicitActivationPolicy.cpp71
-rw-r--r--TAO/tao/PortableServer/ImplicitActivationPolicy.h81
-rw-r--r--TAO/tao/PortableServer/ImplicitActivationPolicy.pidl35
-rw-r--r--TAO/tao/PortableServer/ImplicitActivationStrategy.cpp31
-rw-r--r--TAO/tao/PortableServer/ImplicitActivationStrategy.h45
-rw-r--r--TAO/tao/PortableServer/ImplicitActivationStrategyExplicit.cpp38
-rw-r--r--TAO/tao/PortableServer/ImplicitActivationStrategyExplicit.h48
-rw-r--r--TAO/tao/PortableServer/ImplicitActivationStrategyFactory.h52
-rw-r--r--TAO/tao/PortableServer/ImplicitActivationStrategyFactoryImpl.cpp75
-rw-r--r--TAO/tao/PortableServer/ImplicitActivationStrategyFactoryImpl.h54
-rw-r--r--TAO/tao/PortableServer/ImplicitActivationStrategyImplicit.cpp39
-rw-r--r--TAO/tao/PortableServer/ImplicitActivationStrategyImplicit.h48
-rw-r--r--TAO/tao/PortableServer/Key_Adapters.cpp152
-rw-r--r--TAO/tao/PortableServer/Key_Adapters.h129
-rw-r--r--TAO/tao/PortableServer/LifespanPolicy.cpp71
-rw-r--r--TAO/tao/PortableServer/LifespanPolicy.h81
-rw-r--r--TAO/tao/PortableServer/LifespanPolicy.pidl37
-rw-r--r--TAO/tao/PortableServer/LifespanStrategy.cpp52
-rw-r--r--TAO/tao/PortableServer/LifespanStrategy.h89
-rw-r--r--TAO/tao/PortableServer/LifespanStrategyFactory.h53
-rw-r--r--TAO/tao/PortableServer/LifespanStrategyFactoryImpl.cpp101
-rw-r--r--TAO/tao/PortableServer/LifespanStrategyFactoryImpl.h55
-rw-r--r--TAO/tao/PortableServer/LifespanStrategyPersistent.cpp159
-rw-r--r--TAO/tao/PortableServer/LifespanStrategyPersistent.h73
-rw-r--r--TAO/tao/PortableServer/LifespanStrategyPersistentFactoryImpl.cpp67
-rw-r--r--TAO/tao/PortableServer/LifespanStrategyPersistentFactoryImpl.h55
-rw-r--r--TAO/tao/PortableServer/LifespanStrategyTransient.cpp118
-rw-r--r--TAO/tao/PortableServer/LifespanStrategyTransient.h70
-rw-r--r--TAO/tao/PortableServer/LifespanStrategyTransientFactoryImpl.cpp68
-rw-r--r--TAO/tao/PortableServer/LifespanStrategyTransientFactoryImpl.h57
-rw-r--r--TAO/tao/PortableServer/Local_Servant_Base.cpp24
-rw-r--r--TAO/tao/PortableServer/Local_Servant_Base.h62
-rw-r--r--TAO/tao/PortableServer/Local_Servant_Base.inl13
-rw-r--r--TAO/tao/PortableServer/Non_Servant_Upcall.cpp95
-rw-r--r--TAO/tao/PortableServer/Non_Servant_Upcall.h79
-rw-r--r--TAO/tao/PortableServer/Non_Servant_Upcall.inl19
-rw-r--r--TAO/tao/PortableServer/ORT_Adapter.h117
-rw-r--r--TAO/tao/PortableServer/ORT_Adapter_Factory.cpp18
-rw-r--r--TAO/tao/PortableServer/ORT_Adapter_Factory.h74
-rw-r--r--TAO/tao/PortableServer/Object_Adapter.cpp1289
-rw-r--r--TAO/tao/PortableServer/Object_Adapter.h521
-rw-r--r--TAO/tao/PortableServer/Object_Adapter.i170
-rw-r--r--TAO/tao/PortableServer/Object_Adapter_Factory.cpp30
-rw-r--r--TAO/tao/PortableServer/Object_Adapter_Factory.h46
-rw-r--r--TAO/tao/PortableServer/Object_SArg_Traits.h61
-rw-r--r--TAO/tao/PortableServer/Object_SArgument_T.cpp125
-rw-r--r--TAO/tao/PortableServer/Object_SArgument_T.h187
-rw-r--r--TAO/tao/PortableServer/Object_SArgument_T.inl83
-rw-r--r--TAO/tao/PortableServer/Operation_Table.cpp25
-rw-r--r--TAO/tao/PortableServer/Operation_Table.h139
-rw-r--r--TAO/tao/PortableServer/Operation_Table_Binary_Search.cpp91
-rw-r--r--TAO/tao/PortableServer/Operation_Table_Binary_Search.h69
-rw-r--r--TAO/tao/PortableServer/Operation_Table_Dynamic_Hash.cpp133
-rw-r--r--TAO/tao/PortableServer/Operation_Table_Dynamic_Hash.h84
-rw-r--r--TAO/tao/PortableServer/Operation_Table_Linear_Search.cpp93
-rw-r--r--TAO/tao/PortableServer/Operation_Table_Linear_Search.h65
-rw-r--r--TAO/tao/PortableServer/Operation_Table_Perfect_Hash.cpp103
-rw-r--r--TAO/tao/PortableServer/Operation_Table_Perfect_Hash.h74
-rw-r--r--TAO/tao/PortableServer/POA.pidl255
-rw-r--r--TAO/tao/PortableServer/POAManager.cpp413
-rw-r--r--TAO/tao/PortableServer/POAManager.h191
-rw-r--r--TAO/tao/PortableServer/POAManager.i137
-rw-r--r--TAO/tao/PortableServer/POAManager.pidl52
-rw-r--r--TAO/tao/PortableServer/POAManagerFactory.cpp165
-rw-r--r--TAO/tao/PortableServer/POAManagerFactory.h87
-rw-r--r--TAO/tao/PortableServer/POAManagerFactory.pidl51
-rw-r--r--TAO/tao/PortableServer/POA_Cached_Policies.cpp174
-rw-r--r--TAO/tao/PortableServer/POA_Cached_Policies.h114
-rw-r--r--TAO/tao/PortableServer/POA_Cached_Policies.i85
-rw-r--r--TAO/tao/PortableServer/POA_Current.cpp94
-rw-r--r--TAO/tao/PortableServer/POA_Current.h104
-rw-r--r--TAO/tao/PortableServer/POA_Current_Factory.cpp32
-rw-r--r--TAO/tao/PortableServer/POA_Current_Factory.h49
-rw-r--r--TAO/tao/PortableServer/POA_Current_Impl.cpp110
-rw-r--r--TAO/tao/PortableServer/POA_Current_Impl.h194
-rw-r--r--TAO/tao/PortableServer/POA_Current_Impl.inl103
-rw-r--r--TAO/tao/PortableServer/POA_Guard.cpp49
-rw-r--r--TAO/tao/PortableServer/POA_Guard.h58
-rw-r--r--TAO/tao/PortableServer/POA_Policy_Set.cpp98
-rw-r--r--TAO/tao/PortableServer/POA_Policy_Set.h83
-rw-r--r--TAO/tao/PortableServer/POA_Policy_Set.i59
-rw-r--r--TAO/tao/PortableServer/PS_Current.pidl43
-rw-r--r--TAO/tao/PortableServer/PS_Forward.pidl42
-rw-r--r--TAO/tao/PortableServer/PS_ForwardA.cpp56
-rw-r--r--TAO/tao/PortableServer/PS_ForwardA.h63
-rw-r--r--TAO/tao/PortableServer/PS_ForwardC.cpp46
-rw-r--r--TAO/tao/PortableServer/PS_ForwardC.h128
-rw-r--r--TAO/tao/PortableServer/PolicyS.cpp1088
-rw-r--r--TAO/tao/PortableServer/PolicyS.h326
-rw-r--r--TAO/tao/PortableServer/PolicyS_T.cpp41
-rw-r--r--TAO/tao/PortableServer/PolicyS_T.h154
-rw-r--r--TAO/tao/PortableServer/PolicyS_T.inl172
-rw-r--r--TAO/tao/PortableServer/Policy_Strategy.h50
-rw-r--r--TAO/tao/PortableServer/PortableServer.cpp177
-rw-r--r--TAO/tao/PortableServer/PortableServer.h59
-rw-r--r--TAO/tao/PortableServer/PortableServer.pidl50
-rw-r--r--TAO/tao/PortableServer/PortableServerA.h3
-rw-r--r--TAO/tao/PortableServer/PortableServerC.cpp53
-rw-r--r--TAO/tao/PortableServer/PortableServerC.h81
-rw-r--r--TAO/tao/PortableServer/PortableServerS.h28
-rw-r--r--TAO/tao/PortableServer/PortableServer_Functions.cpp60
-rw-r--r--TAO/tao/PortableServer/PortableServer_Functions.h59
-rw-r--r--TAO/tao/PortableServer/PortableServer_WFunctions.cpp71
-rw-r--r--TAO/tao/PortableServer/PortableServer_WFunctions.h58
-rw-r--r--TAO/tao/PortableServer/PortableServer_include.pidl40
-rw-r--r--TAO/tao/PortableServer/PortableServer_includeA.h44
-rw-r--r--TAO/tao/PortableServer/PortableServer_includeC.h74
-rw-r--r--TAO/tao/PortableServer/PortableServer_includeS.h28
-rw-r--r--TAO/tao/PortableServer/Regular_POA.cpp73
-rw-r--r--TAO/tao/PortableServer/Regular_POA.h79
-rw-r--r--TAO/tao/PortableServer/Regular_POA.inl14
-rw-r--r--TAO/tao/PortableServer/RequestProcessingPolicy.cpp73
-rw-r--r--TAO/tao/PortableServer/RequestProcessingPolicy.h81
-rw-r--r--TAO/tao/PortableServer/RequestProcessingPolicy.pidl46
-rw-r--r--TAO/tao/PortableServer/RequestProcessingStrategy.cpp61
-rw-r--r--TAO/tao/PortableServer/RequestProcessingStrategy.h145
-rw-r--r--TAO/tao/PortableServer/RequestProcessingStrategyAOMOnly.cpp185
-rw-r--r--TAO/tao/PortableServer/RequestProcessingStrategyAOMOnly.h121
-rw-r--r--TAO/tao/PortableServer/RequestProcessingStrategyAOMOnlyFactoryImpl.cpp69
-rw-r--r--TAO/tao/PortableServer/RequestProcessingStrategyAOMOnlyFactoryImpl.h55
-rw-r--r--TAO/tao/PortableServer/RequestProcessingStrategyDefaultServant.cpp288
-rw-r--r--TAO/tao/PortableServer/RequestProcessingStrategyDefaultServant.h123
-rw-r--r--TAO/tao/PortableServer/RequestProcessingStrategyDefaultServantFI.cpp75
-rw-r--r--TAO/tao/PortableServer/RequestProcessingStrategyDefaultServantFI.h58
-rw-r--r--TAO/tao/PortableServer/RequestProcessingStrategyFactory.h54
-rw-r--r--TAO/tao/PortableServer/RequestProcessingStrategyFactoryImpl.cpp150
-rw-r--r--TAO/tao/PortableServer/RequestProcessingStrategyFactoryImpl.h54
-rw-r--r--TAO/tao/PortableServer/RequestProcessingStrategyServantActivator.cpp355
-rw-r--r--TAO/tao/PortableServer/RequestProcessingStrategyServantActivator.h98
-rw-r--r--TAO/tao/PortableServer/RequestProcessingStrategyServantActivatorFI.cpp86
-rw-r--r--TAO/tao/PortableServer/RequestProcessingStrategyServantActivatorFI.h59
-rw-r--r--TAO/tao/PortableServer/RequestProcessingStrategyServantLocator.cpp259
-rw-r--r--TAO/tao/PortableServer/RequestProcessingStrategyServantLocator.h89
-rw-r--r--TAO/tao/PortableServer/RequestProcessingStrategyServantLocatorFI.cpp87
-rw-r--r--TAO/tao/PortableServer/RequestProcessingStrategyServantLocatorFI.h58
-rw-r--r--TAO/tao/PortableServer/RequestProcessingStrategyServantManager.cpp102
-rw-r--r--TAO/tao/PortableServer/RequestProcessingStrategyServantManager.h80
-rw-r--r--TAO/tao/PortableServer/Root_POA.cpp2985
-rw-r--r--TAO/tao/PortableServer/Root_POA.h1053
-rw-r--r--TAO/tao/PortableServer/Root_POA.inl246
-rw-r--r--TAO/tao/PortableServer/SArg_Traits_T.h42
-rw-r--r--TAO/tao/PortableServer/ServantActivator.pidl54
-rw-r--r--TAO/tao/PortableServer/ServantLocator.pidl63
-rw-r--r--TAO/tao/PortableServer/ServantManager.pidl37
-rw-r--r--TAO/tao/PortableServer/ServantRetentionPolicy.cpp71
-rw-r--r--TAO/tao/PortableServer/ServantRetentionPolicy.h81
-rw-r--r--TAO/tao/PortableServer/ServantRetentionPolicy.pidl45
-rw-r--r--TAO/tao/PortableServer/ServantRetentionStrategy.h166
-rw-r--r--TAO/tao/PortableServer/ServantRetentionStrategyFactory.h52
-rw-r--r--TAO/tao/PortableServer/ServantRetentionStrategyFactoryImpl.cpp96
-rw-r--r--TAO/tao/PortableServer/ServantRetentionStrategyFactoryImpl.h53
-rw-r--r--TAO/tao/PortableServer/ServantRetentionStrategyNonRetain.cpp347
-rw-r--r--TAO/tao/PortableServer/ServantRetentionStrategyNonRetain.h173
-rw-r--r--TAO/tao/PortableServer/ServantRetentionStrategyNonRetainFactoryImpl.cpp72
-rw-r--r--TAO/tao/PortableServer/ServantRetentionStrategyNonRetainFactoryImpl.h57
-rw-r--r--TAO/tao/PortableServer/ServantRetentionStrategyRetain.cpp1096
-rw-r--r--TAO/tao/PortableServer/ServantRetentionStrategyRetain.h196
-rw-r--r--TAO/tao/PortableServer/ServantRetentionStrategyRetainFactoryImpl.cpp68
-rw-r--r--TAO/tao/PortableServer/ServantRetentionStrategyRetainFactoryImpl.h54
-rw-r--r--TAO/tao/PortableServer/Servant_Base.cpp361
-rw-r--r--TAO/tao/PortableServer/Servant_Base.h197
-rw-r--r--TAO/tao/PortableServer/Servant_Base.i13
-rw-r--r--TAO/tao/PortableServer/Servant_Dispatcher.cpp16
-rw-r--r--TAO/tao/PortableServer/Servant_Dispatcher.h91
-rw-r--r--TAO/tao/PortableServer/Servant_Location.h38
-rw-r--r--TAO/tao/PortableServer/Servant_Upcall.cpp473
-rw-r--r--TAO/tao/PortableServer/Servant_Upcall.h251
-rw-r--r--TAO/tao/PortableServer/Servant_Upcall.inl108
-rwxr-xr-xTAO/tao/PortableServer/Servant_var.cpp65
-rwxr-xr-xTAO/tao/PortableServer/Servant_var.h170
-rwxr-xr-xTAO/tao/PortableServer/Servant_var.inl182
-rw-r--r--TAO/tao/PortableServer/Special_Basic_SArgument_T.cpp145
-rw-r--r--TAO/tao/PortableServer/Special_Basic_SArgument_T.h177
-rw-r--r--TAO/tao/PortableServer/Special_Basic_SArgument_T.inl96
-rw-r--r--TAO/tao/PortableServer/Special_Basic_SArguments.h83
-rw-r--r--TAO/tao/PortableServer/StrategyFactory.cpp22
-rw-r--r--TAO/tao/PortableServer/StrategyFactory.h45
-rw-r--r--TAO/tao/PortableServer/TAO_PortableServer.pc.in11
-rw-r--r--TAO/tao/PortableServer/TAO_PortableServer.rc30
-rw-r--r--TAO/tao/PortableServer/ThreadPolicy.cpp70
-rw-r--r--TAO/tao/PortableServer/ThreadPolicy.h81
-rw-r--r--TAO/tao/PortableServer/ThreadPolicy.pidl44
-rw-r--r--TAO/tao/PortableServer/ThreadStrategy.cpp28
-rw-r--r--TAO/tao/PortableServer/ThreadStrategy.h52
-rw-r--r--TAO/tao/PortableServer/ThreadStrategyFactory.h54
-rw-r--r--TAO/tao/PortableServer/ThreadStrategyFactoryImpl.cpp102
-rw-r--r--TAO/tao/PortableServer/ThreadStrategyFactoryImpl.h53
-rw-r--r--TAO/tao/PortableServer/ThreadStrategyORBControl.cpp50
-rw-r--r--TAO/tao/PortableServer/ThreadStrategyORBControl.h54
-rw-r--r--TAO/tao/PortableServer/ThreadStrategySingle.cpp54
-rw-r--r--TAO/tao/PortableServer/ThreadStrategySingle.h67
-rw-r--r--TAO/tao/PortableServer/ThreadStrategySingleFactoryImpl.cpp72
-rw-r--r--TAO/tao/PortableServer/ThreadStrategySingleFactoryImpl.h57
-rw-r--r--TAO/tao/PortableServer/TypeCode_SArg_Traits.h61
-rw-r--r--TAO/tao/PortableServer/UB_String_SArgument_T.cpp105
-rw-r--r--TAO/tao/PortableServer/UB_String_SArgument_T.h162
-rw-r--r--TAO/tao/PortableServer/UB_String_SArgument_T.inl65
-rw-r--r--TAO/tao/PortableServer/UB_String_SArguments.h59
-rw-r--r--TAO/tao/PortableServer/Upcall_Command.cpp17
-rw-r--r--TAO/tao/PortableServer/Upcall_Command.h67
-rw-r--r--TAO/tao/PortableServer/Upcall_Wrapper.cpp302
-rw-r--r--TAO/tao/PortableServer/Upcall_Wrapper.h131
-rw-r--r--TAO/tao/PortableServer/Var_Array_SArgument_T.cpp142
-rw-r--r--TAO/tao/PortableServer/Var_Array_SArgument_T.h176
-rw-r--r--TAO/tao/PortableServer/Var_Array_SArgument_T.inl95
-rw-r--r--TAO/tao/PortableServer/Var_Size_SArgument_T.cpp117
-rw-r--r--TAO/tao/PortableServer/Var_Size_SArgument_T.h165
-rw-r--r--TAO/tao/PortableServer/Var_Size_SArgument_T.inl67
-rw-r--r--TAO/tao/PortableServer/diffs/PS_Forward.diff63
-rw-r--r--TAO/tao/PortableServer/diffs/PortableServer.diff247
-rw-r--r--TAO/tao/PortableServer/diffs/PortableServer_include.diff11
-rw-r--r--TAO/tao/PortableServer/get_arg.h105
-rw-r--r--TAO/tao/PortableServer/poa_macros.h43
-rw-r--r--TAO/tao/PortableServer/portableserver_export.h40
-rw-r--r--TAO/tao/Principal.cpp67
-rw-r--r--TAO/tao/Principal.h115
-rw-r--r--TAO/tao/Principal.i64
-rw-r--r--TAO/tao/Profile.cpp977
-rw-r--r--TAO/tao/Profile.h461
-rw-r--r--TAO/tao/Profile.i67
-rw-r--r--TAO/tao/Profile_Transport_Resolver.cpp278
-rw-r--r--TAO/tao/Profile_Transport_Resolver.h222
-rw-r--r--TAO/tao/Profile_Transport_Resolver.inl76
-rw-r--r--TAO/tao/Protocol_Factory.cpp65
-rw-r--r--TAO/tao/Protocol_Factory.h84
-rw-r--r--TAO/tao/Protocols_Hooks.cpp59
-rw-r--r--TAO/tao/Protocols_Hooks.h210
-rw-r--r--TAO/tao/Pseudo_VarOut_T.cpp29
-rw-r--r--TAO/tao/Pseudo_VarOut_T.h143
-rw-r--r--TAO/tao/Pseudo_VarOut_T.inl177
-rw-r--r--TAO/tao/QtResource.mpc31
-rw-r--r--TAO/tao/QtResource/QtResource_Factory.cpp47
-rw-r--r--TAO/tao/QtResource/QtResource_Factory.h68
-rw-r--r--TAO/tao/QtResource/QtResource_Loader.cpp29
-rw-r--r--TAO/tao/QtResource/QtResource_Loader.h58
-rw-r--r--TAO/tao/QtResource/TAO_QtResource_Export.h58
-rw-r--r--TAO/tao/Queued_Message.cpp105
-rw-r--r--TAO/tao/Queued_Message.h225
-rw-r--r--TAO/tao/RTCORBA.mpc37
-rw-r--r--TAO/tao/RTCORBA/Continuous_Priority_Mapping.cpp135
-rw-r--r--TAO/tao/RTCORBA/Continuous_Priority_Mapping.h81
-rw-r--r--TAO/tao/RTCORBA/Direct_Priority_Mapping.cpp42
-rw-r--r--TAO/tao/RTCORBA/Direct_Priority_Mapping.h61
-rw-r--r--TAO/tao/RTCORBA/Linear_Network_Priority_Mapping.cpp142
-rw-r--r--TAO/tao/RTCORBA/Linear_Network_Priority_Mapping.h64
-rw-r--r--TAO/tao/RTCORBA/Linear_Priority_Mapping.cpp168
-rw-r--r--TAO/tao/RTCORBA/Linear_Priority_Mapping.h77
-rw-r--r--TAO/tao/RTCORBA/Multi_Priority_Mapping.cpp243
-rw-r--r--TAO/tao/RTCORBA/Multi_Priority_Mapping.h98
-rw-r--r--TAO/tao/RTCORBA/Network_Priority_Mapping.cpp21
-rw-r--r--TAO/tao/RTCORBA/Network_Priority_Mapping.h66
-rw-r--r--TAO/tao/RTCORBA/Network_Priority_Mapping_Manager.cpp61
-rw-r--r--TAO/tao/RTCORBA/Network_Priority_Mapping_Manager.h159
-rw-r--r--TAO/tao/RTCORBA/Network_Priority_Mapping_Manager.i225
-rw-r--r--TAO/tao/RTCORBA/Priority_Mapping.cpp21
-rw-r--r--TAO/tao/RTCORBA/Priority_Mapping.h61
-rw-r--r--TAO/tao/RTCORBA/Priority_Mapping_Manager.cpp54
-rw-r--r--TAO/tao/RTCORBA/Priority_Mapping_Manager.h154
-rw-r--r--TAO/tao/RTCORBA/Priority_Mapping_Manager.i224
-rw-r--r--TAO/tao/RTCORBA/RTCORBA.cpp20
-rw-r--r--TAO/tao/RTCORBA/RTCORBA.h55
-rw-r--r--TAO/tao/RTCORBA/RTCORBA.pidl315
-rw-r--r--TAO/tao/RTCORBA/RTCORBAA.cpp2471
-rw-r--r--TAO/tao/RTCORBA/RTCORBAA.h3
-rw-r--r--TAO/tao/RTCORBA/RTCORBAC.cpp2739
-rw-r--r--TAO/tao/RTCORBA/RTCORBAC.h3507
-rw-r--r--TAO/tao/RTCORBA/RTCORBAS.h3
-rw-r--r--TAO/tao/RTCORBA/RTCORBA_include.pidl37
-rw-r--r--TAO/tao/RTCORBA/RTCORBA_includeA.h4
-rw-r--r--TAO/tao/RTCORBA/RTCORBA_includeC.h100
-rw-r--r--TAO/tao/RTCORBA/RTCORBA_includeS.h4
-rw-r--r--TAO/tao/RTCORBA/RT_Current.cpp72
-rw-r--r--TAO/tao/RTCORBA/RT_Current.h84
-rw-r--r--TAO/tao/RTCORBA/RT_Endpoint_Selector_Factory.cpp52
-rw-r--r--TAO/tao/RTCORBA/RT_Endpoint_Selector_Factory.h78
-rw-r--r--TAO/tao/RTCORBA/RT_Endpoint_Utils.cpp56
-rw-r--r--TAO/tao/RTCORBA/RT_Endpoint_Utils.h60
-rw-r--r--TAO/tao/RTCORBA/RT_Invocation_Endpoint_Selectors.cpp380
-rw-r--r--TAO/tao/RTCORBA/RT_Invocation_Endpoint_Selectors.h77
-rw-r--r--TAO/tao/RTCORBA/RT_Mutex.cpp97
-rw-r--r--TAO/tao/RTCORBA/RT_Mutex.h123
-rw-r--r--TAO/tao/RTCORBA/RT_ORB.cpp559
-rw-r--r--TAO/tao/RTCORBA/RT_ORB.h337
-rw-r--r--TAO/tao/RTCORBA/RT_ORBInitializer.cpp312
-rw-r--r--TAO/tao/RTCORBA/RT_ORBInitializer.h145
-rw-r--r--TAO/tao/RTCORBA/RT_ORB_Loader.cpp208
-rw-r--r--TAO/tao/RTCORBA/RT_ORB_Loader.h57
-rw-r--r--TAO/tao/RTCORBA/RT_PolicyFactory.cpp109
-rw-r--r--TAO/tao/RTCORBA/RT_PolicyFactory.h71
-rw-r--r--TAO/tao/RTCORBA/RT_Policy_i.cpp1410
-rw-r--r--TAO/tao/RTCORBA/RT_Policy_i.h912
-rw-r--r--TAO/tao/RTCORBA/RT_Protocols_Hooks.cpp829
-rw-r--r--TAO/tao/RTCORBA/RT_Protocols_Hooks.h197
-rw-r--r--TAO/tao/RTCORBA/RT_Stub.cpp304
-rw-r--r--TAO/tao/RTCORBA/RT_Stub.h140
-rw-r--r--TAO/tao/RTCORBA/RT_Stub_Factory.cpp57
-rw-r--r--TAO/tao/RTCORBA/RT_Stub_Factory.h68
-rw-r--r--TAO/tao/RTCORBA/RT_Thread_Lane_Resources_Manager.cpp160
-rw-r--r--TAO/tao/RTCORBA/RT_Thread_Lane_Resources_Manager.h117
-rw-r--r--TAO/tao/RTCORBA/RT_Transport_Descriptor.cpp117
-rw-r--r--TAO/tao/RTCORBA/RT_Transport_Descriptor.h80
-rw-r--r--TAO/tao/RTCORBA/RT_Transport_Descriptor.inl24
-rw-r--r--TAO/tao/RTCORBA/RT_Transport_Descriptor_Property.cpp80
-rw-r--r--TAO/tao/RTCORBA/RT_Transport_Descriptor_Property.h144
-rw-r--r--TAO/tao/RTCORBA/RT_Transport_Descriptor_Property.inl57
-rw-r--r--TAO/tao/RTCORBA/TAO_RTCORBA.pc.in11
-rw-r--r--TAO/tao/RTCORBA/TAO_RTCORBA.rc30
-rw-r--r--TAO/tao/RTCORBA/Thread_Pool.cpp957
-rw-r--r--TAO/tao/RTCORBA/Thread_Pool.h477
-rw-r--r--TAO/tao/RTCORBA/Thread_Pool.inl140
-rw-r--r--TAO/tao/RTCORBA/diffs/RTCORBA.diff76
-rw-r--r--TAO/tao/RTCORBA/rtcorba_export.h40
-rw-r--r--TAO/tao/RTCORBA/rtcorba_typedefs.h62
-rw-r--r--TAO/tao/RTPortableServer.mpc43
-rw-r--r--TAO/tao/RTPortableServer/RTPortableServer.cpp32
-rw-r--r--TAO/tao/RTPortableServer/RTPortableServer.h50
-rw-r--r--TAO/tao/RTPortableServer/RTPortableServer.pidl57
-rw-r--r--TAO/tao/RTPortableServer/RTPortableServerA.h3
-rw-r--r--TAO/tao/RTPortableServer/RTPortableServer_include.pidl40
-rw-r--r--TAO/tao/RTPortableServer/RTPortableServer_includeA.h3
-rw-r--r--TAO/tao/RTPortableServer/RTPortableServer_includeC.h91
-rw-r--r--TAO/tao/RTPortableServer/RTPortableServer_includeS.h28
-rw-r--r--TAO/tao/RTPortableServer/RT_Acceptor_Filters.cpp69
-rw-r--r--TAO/tao/RTPortableServer/RT_Acceptor_Filters.h75
-rw-r--r--TAO/tao/RTPortableServer/RT_Collocation_Resolver.cpp124
-rw-r--r--TAO/tao/RTPortableServer/RT_Collocation_Resolver.h60
-rw-r--r--TAO/tao/RTPortableServer/RT_Object_Adapter_Factory.cpp66
-rw-r--r--TAO/tao/RTPortableServer/RT_Object_Adapter_Factory.h50
-rw-r--r--TAO/tao/RTPortableServer/RT_POA.cpp958
-rw-r--r--TAO/tao/RTPortableServer/RT_POA.h330
-rw-r--r--TAO/tao/RTPortableServer/RT_POA.i144
-rw-r--r--TAO/tao/RTPortableServer/RT_Policy_Validator.cpp602
-rw-r--r--TAO/tao/RTPortableServer/RT_Policy_Validator.h102
-rw-r--r--TAO/tao/RTPortableServer/RT_Servant_Dispatcher.cpp403
-rw-r--r--TAO/tao/RTPortableServer/RT_Servant_Dispatcher.h81
-rw-r--r--TAO/tao/RTPortableServer/TAO_RTPortableServer.pc.in11
-rw-r--r--TAO/tao/RTPortableServer/TAO_RTPortableServer.rc30
-rw-r--r--TAO/tao/RTPortableServer/diffs/RTPortableServer_include.diff11
-rw-r--r--TAO/tao/RTPortableServer/rtportableserver_export.h40
-rw-r--r--TAO/tao/RTScheduler.mpc43
-rw-r--r--TAO/tao/RTScheduling/Current.cpp994
-rw-r--r--TAO/tao/RTScheduling/Current.h391
-rw-r--r--TAO/tao/RTScheduling/Distributable_Thread.cpp53
-rw-r--r--TAO/tao/RTScheduling/Distributable_Thread.h43
-rw-r--r--TAO/tao/RTScheduling/RTScheduler.cpp15
-rw-r--r--TAO/tao/RTScheduling/RTScheduler.h48
-rw-r--r--TAO/tao/RTScheduling/RTScheduler.pidl213
-rw-r--r--TAO/tao/RTScheduling/RTSchedulerA.cpp273
-rw-r--r--TAO/tao/RTScheduling/RTSchedulerA.h3
-rw-r--r--TAO/tao/RTScheduling/RTSchedulerC.cpp946
-rw-r--r--TAO/tao/RTScheduling/RTSchedulerC.h1292
-rw-r--r--TAO/tao/RTScheduling/RTScheduler_Initializer.cpp178
-rw-r--r--TAO/tao/RTScheduling/RTScheduler_Initializer.h67
-rw-r--r--TAO/tao/RTScheduling/RTScheduler_Loader.cpp83
-rw-r--r--TAO/tao/RTScheduling/RTScheduler_Loader.h52
-rw-r--r--TAO/tao/RTScheduling/RTScheduler_Manager.cpp46
-rw-r--r--TAO/tao/RTScheduling/RTScheduler_Manager.h143
-rw-r--r--TAO/tao/RTScheduling/RTScheduler_Manager.i234
-rw-r--r--TAO/tao/RTScheduling/RTScheduler_include.pidl38
-rw-r--r--TAO/tao/RTScheduling/RTScheduler_includeA.h100
-rw-r--r--TAO/tao/RTScheduling/RTScheduler_includeC.h100
-rw-r--r--TAO/tao/RTScheduling/RTScheduler_includeS.h28
-rw-r--r--TAO/tao/RTScheduling/Request_Interceptor.cpp510
-rw-r--r--TAO/tao/RTScheduling/Request_Interceptor.h108
-rw-r--r--TAO/tao/RTScheduling/TAO_RTScheduler.pc.in11
-rw-r--r--TAO/tao/RTScheduling/TAO_RTScheduler.rc30
-rw-r--r--TAO/tao/RTScheduling/ThreadAction.h28
-rw-r--r--TAO/tao/RTScheduling/diffs/RTScheduler.diff45
-rw-r--r--TAO/tao/RTScheduling/rtscheduler_export.h56
-rw-r--r--TAO/tao/Range_Checking_T.h150
-rw-r--r--TAO/tao/Reactive_Connect_Strategy.cpp99
-rw-r--r--TAO/tao/Reactive_Connect_Strategy.h63
-rw-r--r--TAO/tao/Reactive_Flushing_Strategy.cpp83
-rw-r--r--TAO/tao/Reactive_Flushing_Strategy.h46
-rw-r--r--TAO/tao/Refcounted_ObjectKey.cpp41
-rw-r--r--TAO/tao/Refcounted_ObjectKey.h79
-rw-r--r--TAO/tao/Refcounted_ObjectKey.inl20
-rw-r--r--TAO/tao/Remote_Invocation.cpp209
-rw-r--r--TAO/tao/Remote_Invocation.h102
-rw-r--r--TAO/tao/Remote_Object_Proxy_Broker.cpp152
-rw-r--r--TAO/tao/Remote_Object_Proxy_Broker.h80
-rw-r--r--TAO/tao/Reply_Dispatcher.cpp27
-rw-r--r--TAO/tao/Reply_Dispatcher.h100
-rw-r--r--TAO/tao/Reply_Dispatcher.i14
-rw-r--r--TAO/tao/Request_Dispatcher.cpp31
-rw-r--r--TAO/tao/Request_Dispatcher.h68
-rw-r--r--TAO/tao/Resource_Factory.cpp233
-rw-r--r--TAO/tao/Resource_Factory.h283
-rw-r--r--TAO/tao/Resume_Handle.cpp81
-rw-r--r--TAO/tao/Resume_Handle.h103
-rw-r--r--TAO/tao/Resume_Handle.inl40
-rw-r--r--TAO/tao/Seq_Out_T.cpp12
-rw-r--r--TAO/tao/Seq_Out_T.h70
-rw-r--r--TAO/tao/Seq_Out_T.inl83
-rw-r--r--TAO/tao/Seq_Var_T.cpp76
-rw-r--r--TAO/tao/Seq_Var_T.h142
-rw-r--r--TAO/tao/Seq_Var_T.inl220
-rw-r--r--TAO/tao/Sequence_T.h16
-rw-r--r--TAO/tao/ServerRequestInterceptor_Adapter.cpp15
-rw-r--r--TAO/tao/ServerRequestInterceptor_Adapter.h178
-rw-r--r--TAO/tao/ServerRequestInterceptor_Adapter_Factory.cpp14
-rw-r--r--TAO/tao/ServerRequestInterceptor_Adapter_Factory.h52
-rw-r--r--TAO/tao/Server_Strategy_Factory.cpp78
-rw-r--r--TAO/tao/Server_Strategy_Factory.h137
-rw-r--r--TAO/tao/Service_Callbacks.cpp97
-rw-r--r--TAO/tao/Service_Callbacks.h128
-rw-r--r--TAO/tao/Service_Context.cpp224
-rw-r--r--TAO/tao/Service_Context.h161
-rw-r--r--TAO/tao/Service_Context.inl57
-rw-r--r--TAO/tao/Services.pidl54
-rw-r--r--TAO/tao/Services_Activate.cpp13
-rw-r--r--TAO/tao/Services_Activate.h64
-rw-r--r--TAO/tao/ShortSeq.pidl32
-rw-r--r--TAO/tao/SmartProxies.mpc35
-rw-r--r--TAO/tao/SmartProxies/SmartProxies.rc30
-rw-r--r--TAO/tao/SmartProxies/Smart_Proxies.cpp16
-rw-r--r--TAO/tao/SmartProxies/Smart_Proxies.h63
-rw-r--r--TAO/tao/SmartProxies/Smart_Proxies.inl23
-rw-r--r--TAO/tao/SmartProxies/TAO_SmartProxies.pc.in11
-rw-r--r--TAO/tao/SmartProxies/smartproxies_export.h40
-rw-r--r--TAO/tao/Special_Basic_Argument_T.cpp141
-rw-r--r--TAO/tao/Special_Basic_Argument_T.h184
-rw-r--r--TAO/tao/Special_Basic_Argument_T.inl120
-rw-r--r--TAO/tao/Special_Basic_Arguments.h80
-rw-r--r--TAO/tao/Strategies.mpc45
-rw-r--r--TAO/tao/Strategies/DIOP_Acceptor.cpp763
-rw-r--r--TAO/tao/Strategies/DIOP_Acceptor.h191
-rw-r--r--TAO/tao/Strategies/DIOP_Acceptor.i28
-rw-r--r--TAO/tao/Strategies/DIOP_Connection_Handler.cpp306
-rw-r--r--TAO/tao/Strategies/DIOP_Connection_Handler.h167
-rw-r--r--TAO/tao/Strategies/DIOP_Connector.cpp242
-rw-r--r--TAO/tao/Strategies/DIOP_Connector.h124
-rw-r--r--TAO/tao/Strategies/DIOP_Endpoint.cpp251
-rw-r--r--TAO/tao/Strategies/DIOP_Endpoint.h147
-rw-r--r--TAO/tao/Strategies/DIOP_Endpoint.i25
-rw-r--r--TAO/tao/Strategies/DIOP_Factory.cpp109
-rw-r--r--TAO/tao/Strategies/DIOP_Factory.h87
-rw-r--r--TAO/tao/Strategies/DIOP_Profile.cpp478
-rw-r--r--TAO/tao/Strategies/DIOP_Profile.h132
-rw-r--r--TAO/tao/Strategies/DIOP_Transport.cpp355
-rw-r--r--TAO/tao/Strategies/DIOP_Transport.h133
-rw-r--r--TAO/tao/Strategies/FIFO_Connection_Purging_Strategy.cpp31
-rw-r--r--TAO/tao/Strategies/FIFO_Connection_Purging_Strategy.h57
-rw-r--r--TAO/tao/Strategies/LFU_Connection_Purging_Strategy.cpp23
-rw-r--r--TAO/tao/Strategies/LFU_Connection_Purging_Strategy.h52
-rw-r--r--TAO/tao/Strategies/LF_Strategy_Null.cpp36
-rw-r--r--TAO/tao/Strategies/LF_Strategy_Null.h60
-rw-r--r--TAO/tao/Strategies/LF_Strategy_Null.inl6
-rw-r--r--TAO/tao/Strategies/NULL_Connection_Purging_Strategy.cpp27
-rw-r--r--TAO/tao/Strategies/NULL_Connection_Purging_Strategy.h52
-rw-r--r--TAO/tao/Strategies/OC_Endpoint_Selector_Factory.cpp67
-rw-r--r--TAO/tao/Strategies/OC_Endpoint_Selector_Factory.h87
-rw-r--r--TAO/tao/Strategies/OC_Endpoint_Selector_Loader.cpp28
-rw-r--r--TAO/tao/Strategies/OC_Endpoint_Selector_Loader.h63
-rw-r--r--TAO/tao/Strategies/Optimized_Connection_Endpoint_Selector.cpp178
-rw-r--r--TAO/tao/Strategies/Optimized_Connection_Endpoint_Selector.h80
-rw-r--r--TAO/tao/Strategies/SCIOP_Acceptor.cpp1040
-rw-r--r--TAO/tao/Strategies/SCIOP_Acceptor.h231
-rw-r--r--TAO/tao/Strategies/SCIOP_Acceptor.i28
-rw-r--r--TAO/tao/Strategies/SCIOP_Connection_Handler.cpp390
-rw-r--r--TAO/tao/Strategies/SCIOP_Connection_Handler.h144
-rw-r--r--TAO/tao/Strategies/SCIOP_Connector.cpp430
-rw-r--r--TAO/tao/Strategies/SCIOP_Connector.h134
-rw-r--r--TAO/tao/Strategies/SCIOP_Endpoint.cpp370
-rw-r--r--TAO/tao/Strategies/SCIOP_Endpoint.h172
-rw-r--r--TAO/tao/Strategies/SCIOP_Endpoint.i24
-rw-r--r--TAO/tao/Strategies/SCIOP_Factory.cpp96
-rw-r--r--TAO/tao/Strategies/SCIOP_Factory.h77
-rw-r--r--TAO/tao/Strategies/SCIOP_Lite_Factory.cpp100
-rw-r--r--TAO/tao/Strategies/SCIOP_Lite_Factory.h77
-rw-r--r--TAO/tao/Strategies/SCIOP_Profile.cpp518
-rw-r--r--TAO/tao/Strategies/SCIOP_Profile.h143
-rw-r--r--TAO/tao/Strategies/SCIOP_Transport.cpp387
-rw-r--r--TAO/tao/Strategies/SCIOP_Transport.h148
-rw-r--r--TAO/tao/Strategies/SHMIOP_Acceptor.cpp514
-rw-r--r--TAO/tao/Strategies/SHMIOP_Acceptor.h154
-rw-r--r--TAO/tao/Strategies/SHMIOP_Connection_Handler.cpp257
-rw-r--r--TAO/tao/Strategies/SHMIOP_Connection_Handler.h112
-rw-r--r--TAO/tao/Strategies/SHMIOP_Connector.cpp354
-rw-r--r--TAO/tao/Strategies/SHMIOP_Connector.h137
-rw-r--r--TAO/tao/Strategies/SHMIOP_Endpoint.cpp266
-rw-r--r--TAO/tao/Strategies/SHMIOP_Endpoint.h148
-rw-r--r--TAO/tao/Strategies/SHMIOP_Endpoint.i25
-rw-r--r--TAO/tao/Strategies/SHMIOP_Factory.cpp133
-rw-r--r--TAO/tao/Strategies/SHMIOP_Factory.h99
-rw-r--r--TAO/tao/Strategies/SHMIOP_Profile.cpp516
-rw-r--r--TAO/tao/Strategies/SHMIOP_Profile.h131
-rw-r--r--TAO/tao/Strategies/SHMIOP_Transport.cpp372
-rw-r--r--TAO/tao/Strategies/SHMIOP_Transport.h125
-rw-r--r--TAO/tao/Strategies/TAO_Strategies.pc.in11
-rw-r--r--TAO/tao/Strategies/TAO_Strategies.rc30
-rw-r--r--TAO/tao/Strategies/UIOP_Acceptor.cpp486
-rw-r--r--TAO/tao/Strategies/UIOP_Acceptor.h146
-rw-r--r--TAO/tao/Strategies/UIOP_Connection_Handler.cpp234
-rw-r--r--TAO/tao/Strategies/UIOP_Connection_Handler.h106
-rw-r--r--TAO/tao/Strategies/UIOP_Connector.cpp411
-rw-r--r--TAO/tao/Strategies/UIOP_Connector.h142
-rw-r--r--TAO/tao/Strategies/UIOP_Endpoint.cpp109
-rw-r--r--TAO/tao/Strategies/UIOP_Endpoint.h105
-rw-r--r--TAO/tao/Strategies/UIOP_Endpoint.i23
-rw-r--r--TAO/tao/Strategies/UIOP_Factory.cpp105
-rw-r--r--TAO/tao/Strategies/UIOP_Factory.h90
-rw-r--r--TAO/tao/Strategies/UIOP_Lite_Factory.cpp107
-rw-r--r--TAO/tao/Strategies/UIOP_Lite_Factory.h92
-rw-r--r--TAO/tao/Strategies/UIOP_Profile.cpp454
-rw-r--r--TAO/tao/Strategies/UIOP_Profile.h130
-rw-r--r--TAO/tao/Strategies/UIOP_Transport.cpp200
-rw-r--r--TAO/tao/Strategies/UIOP_Transport.h121
-rw-r--r--TAO/tao/Strategies/advanced_resource.cpp649
-rw-r--r--TAO/tao/Strategies/advanced_resource.h145
-rw-r--r--TAO/tao/Strategies/sciop_endpoints.pidl41
-rw-r--r--TAO/tao/Strategies/strategies_export.h40
-rw-r--r--TAO/tao/Strategies/uiop_endpoints.pidl39
-rw-r--r--TAO/tao/StringSeq.pidl30
-rw-r--r--TAO/tao/String_Alloc.cpp102
-rw-r--r--TAO/tao/String_Alloc.h57
-rw-r--r--TAO/tao/String_Manager_T.h140
-rw-r--r--TAO/tao/String_Sequence_Element_T.h128
-rw-r--r--TAO/tao/String_Traits_Base_T.h112
-rw-r--r--TAO/tao/String_Traits_T.h77
-rw-r--r--TAO/tao/Stub.cpp680
-rw-r--r--TAO/tao/Stub.h452
-rw-r--r--TAO/tao/Stub.i400
-rw-r--r--TAO/tao/Stub_Factory.cpp15
-rw-r--r--TAO/tao/Stub_Factory.h72
-rw-r--r--TAO/tao/Synch_Invocation.cpp826
-rw-r--r--TAO/tao/Synch_Invocation.h215
-rw-r--r--TAO/tao/Synch_Invocation.inl30
-rw-r--r--TAO/tao/Synch_Queued_Message.cpp184
-rw-r--r--TAO/tao/Synch_Queued_Message.h99
-rw-r--r--TAO/tao/Synch_Reply_Dispatcher.cpp120
-rw-r--r--TAO/tao/Synch_Reply_Dispatcher.h95
-rw-r--r--TAO/tao/SystemException.cpp984
-rw-r--r--TAO/tao/SystemException.h249
-rw-r--r--TAO/tao/SystemException.inl116
-rw-r--r--TAO/tao/TAO.pc.in11
-rw-r--r--TAO/tao/TAO.pidl74
-rw-r--r--TAO/tao/TAO_Export.h40
-rw-r--r--TAO/tao/TAO_Internal.cpp898
-rw-r--r--TAO/tao/TAO_Internal.h81
-rw-r--r--TAO/tao/TAO_Server_Request.cpp577
-rw-r--r--TAO/tao/TAO_Server_Request.h388
-rw-r--r--TAO/tao/TAO_Server_Request.i274
-rw-r--r--TAO/tao/TAO_Singleton.cpp209
-rw-r--r--TAO/tao/TAO_Singleton.h142
-rw-r--r--TAO/tao/TAO_Singleton.inl23
-rw-r--r--TAO/tao/TAO_Singleton_Manager.cpp363
-rw-r--r--TAO/tao/TAO_Singleton_Manager.h197
-rw-r--r--TAO/tao/TAO_Singleton_Manager.inl30
-rw-r--r--TAO/tao/TAO_Utils.pc.in11
-rw-r--r--TAO/tao/TSS_Resources.cpp51
-rw-r--r--TAO/tao/TSS_Resources.h114
-rw-r--r--TAO/tao/Tagged_Components.cpp344
-rw-r--r--TAO/tao/Tagged_Components.h169
-rw-r--r--TAO/tao/Tagged_Components.i82
-rw-r--r--TAO/tao/Tagged_Profile.cpp197
-rw-r--r--TAO/tao/Tagged_Profile.h155
-rw-r--r--TAO/tao/Tagged_Profile.i67
-rw-r--r--TAO/tao/Thread_Lane_Resources.cpp558
-rw-r--r--TAO/tao/Thread_Lane_Resources.h219
-rw-r--r--TAO/tao/Thread_Lane_Resources_Manager.cpp38
-rw-r--r--TAO/tao/Thread_Lane_Resources_Manager.h120
-rw-r--r--TAO/tao/Thread_Per_Connection_Handler.cpp87
-rw-r--r--TAO/tao/Thread_Per_Connection_Handler.h87
-rw-r--r--TAO/tao/TimeBase.pidl96
-rw-r--r--TAO/tao/Timeprobe.h100
-rw-r--r--TAO/tao/TkResource.mpc31
-rw-r--r--TAO/tao/TkResource/TAO_TkResource_Export.h58
-rw-r--r--TAO/tao/TkResource/TkResource_Factory.cpp41
-rw-r--r--TAO/tao/TkResource/TkResource_Factory.h64
-rw-r--r--TAO/tao/TkResource/TkResource_Loader.cpp31
-rw-r--r--TAO/tao/TkResource/TkResource_Loader.h60
-rw-r--r--TAO/tao/Transport.cpp2444
-rw-r--r--TAO/tao/Transport.h1082
-rw-r--r--TAO/tao/Transport.inl192
-rw-r--r--TAO/tao/Transport_Acceptor.cpp29
-rw-r--r--TAO/tao/Transport_Acceptor.h166
-rw-r--r--TAO/tao/Transport_Acceptor.inl13
-rw-r--r--TAO/tao/Transport_Cache_Manager.cpp723
-rw-r--r--TAO/tao/Transport_Cache_Manager.h276
-rw-r--r--TAO/tao/Transport_Cache_Manager.inl157
-rw-r--r--TAO/tao/Transport_Connector.cpp727
-rw-r--r--TAO/tao/Transport_Connector.h243
-rw-r--r--TAO/tao/Transport_Connector.inl25
-rw-r--r--TAO/tao/Transport_Descriptor_Interface.cpp42
-rw-r--r--TAO/tao/Transport_Descriptor_Interface.h104
-rw-r--r--TAO/tao/Transport_Descriptor_Interface.inl39
-rw-r--r--TAO/tao/Transport_Mux_Strategy.cpp23
-rw-r--r--TAO/tao/Transport_Mux_Strategy.h105
-rw-r--r--TAO/tao/Transport_Queueing_Strategies.cpp231
-rw-r--r--TAO/tao/Transport_Queueing_Strategies.h185
-rw-r--r--TAO/tao/Transport_Timer.cpp24
-rw-r--r--TAO/tao/Transport_Timer.h61
-rw-r--r--TAO/tao/TypeCodeFactory.mpc41
-rw-r--r--TAO/tao/TypeCodeFactory/README27
-rw-r--r--TAO/tao/TypeCodeFactory/Recursive_TypeCode.cpp281
-rw-r--r--TAO/tao/TypeCodeFactory/Recursive_TypeCode.h131
-rw-r--r--TAO/tao/TypeCodeFactory/Recursive_TypeCode.inl31
-rw-r--r--TAO/tao/TypeCodeFactory/TAO_TypeCodeFactory.pc.in11
-rw-r--r--TAO/tao/TypeCodeFactory/TypeCodeFactory.pidl145
-rw-r--r--TAO/tao/TypeCodeFactory/TypeCodeFactory.rc30
-rw-r--r--TAO/tao/TypeCodeFactory/TypeCodeFactory_Adapter_Impl.cpp423
-rw-r--r--TAO/tao/TypeCodeFactory/TypeCodeFactory_Adapter_Impl.h264
-rw-r--r--TAO/tao/TypeCodeFactory/TypeCodeFactory_Loader.cpp64
-rw-r--r--TAO/tao/TypeCodeFactory/TypeCodeFactory_Loader.h65
-rw-r--r--TAO/tao/TypeCodeFactory/TypeCodeFactory_i.cpp2095
-rw-r--r--TAO/tao/TypeCodeFactory/TypeCodeFactory_i.h323
-rw-r--r--TAO/tao/TypeCodeFactory/typecodefactory_export.h40
-rw-r--r--TAO/tao/TypeCodeFactory_Adapter.cpp14
-rw-r--r--TAO/tao/TypeCodeFactory_Adapter.h282
-rw-r--r--TAO/tao/Typecode_types.pidl58
-rw-r--r--TAO/tao/Typecode_typesC.cpp71
-rw-r--r--TAO/tao/Typecode_typesC.h152
-rw-r--r--TAO/tao/Typecode_typesS.h28
-rw-r--r--TAO/tao/UB_String_Argument_T.cpp131
-rw-r--r--TAO/tao/UB_String_Argument_T.h162
-rw-r--r--TAO/tao/UB_String_Argument_T.inl99
-rw-r--r--TAO/tao/UB_String_Arguments.h55
-rw-r--r--TAO/tao/ULongLongSeq.pidl31
-rw-r--r--TAO/tao/ULongSeq.pidl33
-rw-r--r--TAO/tao/UShortSeq.pidl33
-rw-r--r--TAO/tao/UShortSeqC.cpp127
-rw-r--r--TAO/tao/UShortSeqC.h177
-rw-r--r--TAO/tao/UShortSeqS.h28
-rw-r--r--TAO/tao/Unbounded_Array_Allocation_Traits_T.h54
-rw-r--r--TAO/tao/Unbounded_Array_Sequence_T.h155
-rw-r--r--TAO/tao/Unbounded_Basic_String_Sequence_T.h112
-rw-r--r--TAO/tao/Unbounded_Object_Reference_Sequence_T.h108
-rw-r--r--TAO/tao/Unbounded_Octet_Sequence_T.h365
-rw-r--r--TAO/tao/Unbounded_Reference_Allocation_Traits_T.h69
-rw-r--r--TAO/tao/Unbounded_Sequence_CDR_T.h571
-rw-r--r--TAO/tao/Unbounded_String_Sequence_T.h43
-rw-r--r--TAO/tao/Unbounded_Value_Allocation_Traits_T.h54
-rw-r--r--TAO/tao/Unbounded_Value_Sequence_T.h101
-rw-r--r--TAO/tao/Unbounded_Wstring_Sequence_T.h43
-rw-r--r--TAO/tao/UserException.cpp50
-rw-r--r--TAO/tao/UserException.h90
-rw-r--r--TAO/tao/UserException.inl38
-rw-r--r--TAO/tao/Utils.mpc35
-rw-r--r--TAO/tao/Utils/Auto_Functor.h34
-rw-r--r--TAO/tao/Utils/Encodable.cpp11
-rw-r--r--TAO/tao/Utils/Encodable.h62
-rw-r--r--TAO/tao/Utils/Implicit_Deactivator.cpp38
-rw-r--r--TAO/tao/Utils/Implicit_Deactivator.h63
-rw-r--r--TAO/tao/Utils/ORB_Destroyer.cpp27
-rw-r--r--TAO/tao/Utils/ORB_Destroyer.h62
-rw-r--r--TAO/tao/Utils/ORB_Manager.cpp371
-rw-r--r--TAO/tao/Utils/ORB_Manager.h257
-rw-r--r--TAO/tao/Utils/PolicyList_Destroyer.cpp41
-rw-r--r--TAO/tao/Utils/PolicyList_Destroyer.h54
-rw-r--r--TAO/tao/Utils/PolicyList_Destroyer.inl13
-rw-r--r--TAO/tao/Utils/RIR_Narrow.cpp60
-rw-r--r--TAO/tao/Utils/RIR_Narrow.h75
-rw-r--r--TAO/tao/Utils/Servant_Var.cpp14
-rw-r--r--TAO/tao/Utils/Servant_Var.h177
-rw-r--r--TAO/tao/Utils/Servant_Var.inl226
-rw-r--r--TAO/tao/Utils/Server_Main.cpp135
-rw-r--r--TAO/tao/Utils/Server_Main.h100
-rw-r--r--TAO/tao/Utils/Synch_Refcountable.cpp29
-rw-r--r--TAO/tao/Utils/Synch_Refcountable.h63
-rw-r--r--TAO/tao/Utils/Synch_Refcountable.inl29
-rw-r--r--TAO/tao/Utils/utils_export.h60
-rw-r--r--TAO/tao/Value_Traits_T.h53
-rw-r--r--TAO/tao/Valuetype.mpc41
-rw-r--r--TAO/tao/Valuetype/AbstractBase.cpp436
-rw-r--r--TAO/tao/Valuetype/AbstractBase.h180
-rw-r--r--TAO/tao/Valuetype/AbstractBase.inl58
-rw-r--r--TAO/tao/Valuetype/AbstractBase_Invocation_Adapter.cpp34
-rw-r--r--TAO/tao/Valuetype/AbstractBase_Invocation_Adapter.h74
-rw-r--r--TAO/tao/Valuetype/AbstractBase_T.cpp119
-rw-r--r--TAO/tao/Valuetype/AbstractBase_T.h65
-rw-r--r--TAO/tao/Valuetype/Bounded_Valuetype_Allocation_Traits_T.h65
-rw-r--r--TAO/tao/Valuetype/Bounded_Valuetype_Sequence_T.h144
-rw-r--r--TAO/tao/Valuetype/Sequence_T.h6
-rw-r--r--TAO/tao/Valuetype/StringValue.pidl23
-rw-r--r--TAO/tao/Valuetype/TAO_Valuetype.pc.in11
-rw-r--r--TAO/tao/Valuetype/TAO_Valuetype.rc30
-rw-r--r--TAO/tao/Valuetype/Unbounded_Valuetype_Allocation_Traits_T.h69
-rw-r--r--TAO/tao/Valuetype/Unbounded_Valuetype_Sequence_T.h145
-rw-r--r--TAO/tao/Valuetype/ValueBase.cpp918
-rw-r--r--TAO/tao/Valuetype/ValueBase.h371
-rw-r--r--TAO/tao/Valuetype/ValueBase.inl77
-rw-r--r--TAO/tao/Valuetype/ValueFactory.cpp87
-rw-r--r--TAO/tao/Valuetype/ValueFactory.h134
-rw-r--r--TAO/tao/Valuetype/ValueFactory_Map.cpp108
-rw-r--r--TAO/tao/Valuetype/ValueFactory_Map.h92
-rw-r--r--TAO/tao/Valuetype/Value_CORBA_methods.h56
-rw-r--r--TAO/tao/Valuetype/Value_VarOut_T.cpp187
-rw-r--r--TAO/tao/Valuetype/Value_VarOut_T.h129
-rw-r--r--TAO/tao/Valuetype/Valuetype_Adapter_Factory_Impl.cpp59
-rw-r--r--TAO/tao/Valuetype/Valuetype_Adapter_Factory_Impl.h70
-rw-r--r--TAO/tao/Valuetype/Valuetype_Adapter_Impl.cpp99
-rw-r--r--TAO/tao/Valuetype/Valuetype_Adapter_Impl.h80
-rw-r--r--TAO/tao/Valuetype/Valuetype_Sequence_Element_T.h127
-rw-r--r--TAO/tao/Valuetype/Valuetype_Traits_Base_T.h57
-rw-r--r--TAO/tao/Valuetype/Valuetype_Traits_T.h82
-rw-r--r--TAO/tao/Valuetype/valuetype_export.h40
-rw-r--r--TAO/tao/Valuetype_Adapter.cpp15
-rw-r--r--TAO/tao/Valuetype_Adapter.h88
-rw-r--r--TAO/tao/Valuetype_Adapter_Factory.cpp14
-rw-r--r--TAO/tao/Valuetype_Adapter_Factory.h55
-rw-r--r--TAO/tao/VarOut_T.cpp72
-rw-r--r--TAO/tao/VarOut_T.h172
-rw-r--r--TAO/tao/VarOut_T.inl271
-rw-r--r--TAO/tao/Var_Array_Argument_T.cpp141
-rw-r--r--TAO/tao/Var_Array_Argument_T.h171
-rw-r--r--TAO/tao/Var_Array_Argument_T.inl107
-rw-r--r--TAO/tao/Var_Size_Argument_T.cpp136
-rw-r--r--TAO/tao/Var_Size_Argument_T.h163
-rw-r--r--TAO/tao/Var_Size_Argument_T.inl99
-rw-r--r--TAO/tao/Version.h9
-rw-r--r--TAO/tao/Versioned_Namespace.h58
-rw-r--r--TAO/tao/WCharSeq.pidl31
-rw-r--r--TAO/tao/WStringSeq.pidl31
-rw-r--r--TAO/tao/Wait_On_LF_No_Upcall.cpp109
-rw-r--r--TAO/tao/Wait_On_LF_No_Upcall.h64
-rw-r--r--TAO/tao/Wait_On_Leader_Follower.cpp74
-rw-r--r--TAO/tao/Wait_On_Leader_Follower.h64
-rw-r--r--TAO/tao/Wait_On_Reactor.cpp121
-rw-r--r--TAO/tao/Wait_On_Reactor.h56
-rw-r--r--TAO/tao/Wait_On_Read.cpp142
-rw-r--r--TAO/tao/Wait_On_Read.h55
-rw-r--r--TAO/tao/Wait_Strategy.cpp41
-rw-r--r--TAO/tao/Wait_Strategy.h108
-rw-r--r--TAO/tao/Wait_Strategy.inl17
-rw-r--r--TAO/tao/WrongTransaction.pidl45
-rw-r--r--TAO/tao/WrongTransactionC.cpp193
-rw-r--r--TAO/tao/WrongTransactionC.h150
-rw-r--r--TAO/tao/WrongTransactionS.h28
-rw-r--r--TAO/tao/XtResource.mpc31
-rw-r--r--TAO/tao/XtResource/TAO_XtResource_Export.h58
-rw-r--r--TAO/tao/XtResource/XtResource_Factory.cpp45
-rw-r--r--TAO/tao/XtResource/XtResource_Factory.h61
-rw-r--r--TAO/tao/XtResource/XtResource_Loader.cpp26
-rw-r--r--TAO/tao/XtResource/XtResource_Loader.h50
-rw-r--r--TAO/tao/corba.h80
-rw-r--r--TAO/tao/corbafwd.h38
-rw-r--r--TAO/tao/debug.cpp18
-rw-r--r--TAO/tao/debug.h44
-rw-r--r--TAO/tao/default_client.cpp426
-rw-r--r--TAO/tao/default_client.h121
-rw-r--r--TAO/tao/default_environment.h43
-rw-r--r--TAO/tao/default_ports.h77
-rw-r--r--TAO/tao/default_resource.cpp1230
-rw-r--r--TAO/tao/default_resource.h288
-rw-r--r--TAO/tao/default_server.cpp393
-rw-r--r--TAO/tao/default_server.h95
-rw-r--r--TAO/tao/diffs/Domain.diff88
-rw-r--r--TAO/tao/diffs/Object_Key.diff190
-rw-r--r--TAO/tao/diffs/OctetSeq.diff21
-rw-r--r--TAO/tao/diffs/Policy.diff55
-rw-r--r--TAO/tao/diffs/Typecode_types.diff55
-rw-r--r--TAO/tao/diffs/UShortSeq.diff21
-rwxr-xr-xTAO/tao/extra_anytypecode.mpb8
-rw-r--r--TAO/tao/extra_core.mpb16
-rw-r--r--TAO/tao/objectid.h113
-rw-r--r--TAO/tao/operation_details.cpp86
-rw-r--r--TAO/tao/operation_details.h227
-rw-r--r--TAO/tao/operation_details.i200
-rw-r--r--TAO/tao/orb.idl62
-rw-r--r--TAO/tao/orb_types.pidl38
-rw-r--r--TAO/tao/orbconf.h832
-rw-r--r--TAO/tao/params.cpp312
-rw-r--r--TAO/tao/params.h375
-rw-r--r--TAO/tao/params.i294
-rw-r--r--TAO/tao/tao.mpc638
-rw-r--r--TAO/tao/tao.mwc6
-rw-r--r--TAO/tao/tao.rc30
-rw-r--r--TAO/tao/target_specification.cpp12
-rw-r--r--TAO/tao/target_specification.h139
-rw-r--r--TAO/tao/target_specification.i87
-rw-r--r--TAO/tao/varbase.h49
1882 files changed, 281799 insertions, 0 deletions
diff --git a/TAO/tao/Abstract_Servant_Base.cpp b/TAO/tao/Abstract_Servant_Base.cpp
new file mode 100644
index 00000000000..1e48a102f8c
--- /dev/null
+++ b/TAO/tao/Abstract_Servant_Base.cpp
@@ -0,0 +1,31 @@
+// $Id$
+
+#include "tao/Abstract_Servant_Base.h"
+
+ACE_RCSID (tao,
+ Abstract_Servant_Base,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Abstract_ServantBase::TAO_Abstract_ServantBase (void)
+{
+ // No-Op.
+}
+
+TAO_Abstract_ServantBase::~TAO_Abstract_ServantBase (void)
+{
+ // No-Op.
+}
+
+TAO_Abstract_ServantBase::TAO_Abstract_ServantBase (const TAO_Abstract_ServantBase &)
+{
+ // No-Op
+}
+
+TAO_Abstract_ServantBase & TAO_Abstract_ServantBase::operator= (const TAO_Abstract_ServantBase&)
+{
+ return *this;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Abstract_Servant_Base.h b/TAO/tao/Abstract_Servant_Base.h
new file mode 100644
index 00000000000..de7ea8b1a13
--- /dev/null
+++ b/TAO/tao/Abstract_Servant_Base.h
@@ -0,0 +1,178 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Abstract_Servant_Base.h
+ *
+ * $Id$
+ *
+ * This files contains the TAO_Abstract_ServantBase, which is used
+ * as a way to decuple the PortableServer from the TAO Core,
+ * and make it possible to keep the reference to the servant in
+ * the CORBA::Object class.
+ *
+ * @author Angelo Corsaro <corsaro@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_ABSTRACT_SERVANT_BASE_H_
+#define TAO_ABSTRACT_SERVANT_BASE_H_
+
+#include /**/ "ace/pre.h"
+
+#include "ace/CORBA_macros.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/TAO_Export.h"
+#include "tao/Basic_Types.h"
+#include "tao/Collocation_Strategy.h"
+#include "tao/CORBA_methods.h"
+#include "tao/Pseudo_VarOut_T.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_ServerRequest;
+class TAO_Stub;
+class TAO_Abstract_ServantBase;
+
+namespace CORBA
+{
+ class InterfaceDef;
+ typedef InterfaceDef *InterfaceDef_ptr;
+
+ class Environment;
+
+ class Object;
+ typedef Object *Object_ptr;
+ typedef TAO_Pseudo_Var_T<Object> Object_var;
+ typedef TAO_Pseudo_Out_T<Object> Object_out;
+}
+
+namespace TAO
+{
+ class Argument;
+}
+
+typedef void (*TAO_Skeleton)(
+ TAO_ServerRequest &,
+ void *,
+ void *
+#if !defined (TAO_HAS_EXCEPTIONS) || defined (ACE_ENV_BKWD_COMPAT)
+ , CORBA::Environment &
+#endif
+ );
+
+typedef void (*TAO_Collocated_Skeleton)(
+ TAO_Abstract_ServantBase *,
+ TAO::Argument **,
+ int
+#if !defined (TAO_HAS_EXCEPTIONS) || defined (ACE_ENV_BKWD_COMPAT)
+ , CORBA::Environment &
+#endif
+ );
+
+class TAO_Export TAO_Abstract_ServantBase
+{
+public:
+ /// Destructor
+ virtual ~TAO_Abstract_ServantBase (void);
+
+ /// Local implementation of the CORBA::Object::_is_a method.
+ virtual CORBA::Boolean _is_a (const char* logical_type_id
+ ACE_ENV_ARG_DECL) = 0;
+
+ /// Default @c _non_existent: always returns false.
+ virtual CORBA::Boolean _non_existent (
+ ACE_ENV_SINGLE_ARG_DECL) = 0;
+
+ /// Query the Interface Repository.
+ virtual CORBA::InterfaceDef_ptr _get_interface (
+ ACE_ENV_SINGLE_ARG_DECL
+ ) = 0;
+
+ /// Default @c_get_component: always returns nil.
+ virtual CORBA::Object_ptr _get_component (
+ ACE_ENV_SINGLE_ARG_DECL) = 0;
+
+ /// Default @c_repository_id
+ virtual char * _repository_id (
+ ACE_ENV_SINGLE_ARG_DECL) = 0;
+
+ //@{
+ /**
+ * @name Reference Counting Operations
+ */
+ /// Increase reference count by one.
+ virtual void _add_ref (
+ ACE_ENV_SINGLE_ARG_DECL) = 0;
+
+ /**
+ * Decreases reference count by one; if the resulting reference
+ * count equals zero, _remove_ref invokes delete on its this pointer
+ * in order to destroy the servant.
+ */
+ virtual void _remove_ref (
+ ACE_ENV_SINGLE_ARG_DECL) = 0;
+
+ /// Returns the current reference count value.
+ virtual CORBA::ULong _refcount_value (
+ ACE_ENV_SINGLE_ARG_DECL) const = 0;
+ //@}
+
+ /// This is an auxiliary method for _this() and _narrow().
+ virtual TAO_Stub *_create_stub (ACE_ENV_SINGLE_ARG_DECL) = 0;
+
+ /// Find an operation in the operation table and return a
+ /// TAO_Skeleton which can be used to make upcalls
+ virtual int _find (const char *opname,
+ TAO_Skeleton &skelfunc,
+ const size_t length = 0) = 0;
+
+ /// Find an operation in the operation table and return a
+ /// TAO_Collocated_Skeleton which can be used to make upcalls onto
+ /// collocated servants.
+ virtual int _find (const char *opname,
+ TAO_Collocated_Skeleton &skelfunc,
+ TAO::Collocation_Strategy s,
+ const size_t length = 0) = 0;
+
+protected:
+
+ /// Default constructor, only derived classes can be created.
+ TAO_Abstract_ServantBase (void);
+
+ /// Copy constructor, protected so no instances can be created.
+ TAO_Abstract_ServantBase (const TAO_Abstract_ServantBase &);
+
+ /// Assignment operator.
+ TAO_Abstract_ServantBase &operator= (const TAO_Abstract_ServantBase &);
+
+ /// Dispatches a request to the object
+ /**
+ * Find the operation, cast the type to the most derived type,
+ * demarshall all the parameters from the request and finally
+ * invokes the operation, storing the results and out parameters (if
+ * any) or the exceptions thrown into @a request.
+ */
+ virtual void _dispatch (TAO_ServerRequest &request,
+ void *servant_upcall
+ ACE_ENV_ARG_DECL) = 0;
+
+ virtual void synchronous_upcall_dispatch (TAO_ServerRequest &req,
+ void *servant_upcall,
+ void *derived_this
+ ACE_ENV_ARG_DECL) = 0;
+
+ /// Get this interface's repository id (TAO specific).
+ virtual const char *_interface_repository_id (void) const = 0;
+
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_ABSTRACT_SERVANT_BASE_H_ */
diff --git a/TAO/tao/Acceptor_Filter.cpp b/TAO/tao/Acceptor_Filter.cpp
new file mode 100644
index 00000000000..e0412bc4c07
--- /dev/null
+++ b/TAO/tao/Acceptor_Filter.cpp
@@ -0,0 +1,13 @@
+// $Id$
+
+#include "tao/Acceptor_Filter.h"
+
+ACE_RCSID(tao, Acceptor_Filter, "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Acceptor_Filter::~TAO_Acceptor_Filter (void)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Acceptor_Filter.h b/TAO/tao/Acceptor_Filter.h
new file mode 100644
index 00000000000..c628731eba5
--- /dev/null
+++ b/TAO/tao/Acceptor_Filter.h
@@ -0,0 +1,70 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Acceptor_Filter.h
+ *
+ * $Id$
+ *
+ * @author Marina Spivak (marina@cs.wustl.edu)
+ * @author Carlos O'Ryan (coryan@uci.edu)
+ */
+//=============================================================================
+
+#ifndef TAO_ACCEPTOR_FILTER_H
+#define TAO_ACCEPTOR_FILTER_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+#include "tao/TAO_Export.h"
+#include "tao/Basic_Types.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ class ObjectKey;
+}
+
+class TAO_MProfile;
+class TAO_Acceptor;
+
+/**
+ * @class TAO_Acceptor_Filter
+ *
+ * @brief Interface for mprofile creation strategies.
+ *
+ * Concrete Acceptor_Filter encapsulates a strategy for populating
+ * mprofile with profiles: it decides which endpoints are included
+ * into mprofile and which ones are not.
+ */
+class TAO_Export TAO_Acceptor_Filter
+{
+public:
+ virtual ~TAO_Acceptor_Filter (void);
+
+ /**
+ * Populate @a mprofile with profiles. Profiles are created for
+ * selected acceptors (endpoints) from the array delimited by
+ * @a acceptors_begin and @a acceptors_end.
+ */
+ virtual int fill_profile (const TAO::ObjectKey &object_key,
+ TAO_MProfile &mprofile,
+ TAO_Acceptor **acceptors_begin,
+ TAO_Acceptor **acceptors_end,
+ CORBA::Short priority = TAO_INVALID_PRIORITY) = 0;
+
+ /// Encodes the endpoints in the profiles into the TAO_TAG_ENDPOINTS
+ /// tag component of profiles.
+ virtual int encode_endpoints (TAO_MProfile &mprofile) = 0;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_ACCEPTOR_FILTER_H */
diff --git a/TAO/tao/Acceptor_Impl.cpp b/TAO/tao/Acceptor_Impl.cpp
new file mode 100644
index 00000000000..f1b5d150049
--- /dev/null
+++ b/TAO/tao/Acceptor_Impl.cpp
@@ -0,0 +1,216 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO
+//
+// = FILENAME
+// Acceptor_Impl.cpp
+//
+// = AUTHOR
+// Carlos O'Ryan <coryan@uci.edu>
+// Ossama Othman <ossama@dre.vanderbilt.edu>
+//
+// ============================================================================
+
+#ifndef TAO_ACCEPTOR_IMPL_CPP
+#define TAO_ACCEPTOR_IMPL_CPP
+
+#include "tao/Acceptor_Impl.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Thread_Per_Connection_Handler.h"
+#include "tao/Server_Strategy_Factory.h"
+#include "tao/ORB_Core.h"
+#include "tao/Transport_Cache_Manager.h"
+#include "tao/Thread_Lane_Resources.h"
+#include "tao/Transport.h"
+#include "tao/debug.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+//////////////////////////////////////////////////////////////////////////////
+
+template <class SVC_HANDLER>
+TAO_Creation_Strategy<SVC_HANDLER>::TAO_Creation_Strategy (TAO_ORB_Core *orb_core,
+ CORBA::Boolean flag)
+ : ACE_Creation_Strategy<SVC_HANDLER> (0, orb_core->reactor()),
+ orb_core_ (orb_core),
+ lite_flag_ (flag)
+{
+}
+
+template <class SVC_HANDLER> int
+TAO_Creation_Strategy<SVC_HANDLER>::make_svc_handler (SVC_HANDLER *&sh)
+{
+ if (sh == 0)
+ {
+ // Purge connections (if necessary)
+ this->orb_core_->lane_resources ().transport_cache ().purge ();
+
+ ACE_NEW_RETURN (sh,
+ SVC_HANDLER (this->orb_core_,
+ this->lite_flag_),
+ -1);
+ }
+
+ return 0;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+template <class SVC_HANDLER>
+TAO_Concurrency_Strategy<SVC_HANDLER>::TAO_Concurrency_Strategy (TAO_ORB_Core *orb_core)
+ : orb_core_ (orb_core)
+{
+}
+
+template <class SVC_HANDLER> int
+TAO_Concurrency_Strategy<SVC_HANDLER>::activate_svc_handler (SVC_HANDLER *sh,
+ void *arg)
+{
+ sh->transport ()->opened_as (TAO::TAO_SERVER_ROLE);
+
+ // Indicate that this transport was opened in the server role
+ if (TAO_debug_level > 6)
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - Concurrency_Strategy::activate_svc_handler, "
+ "opened as TAO_SERVER_ROLE\n"));
+
+ // Here the service handler has been created and the new connection
+ // has been accepted. #REFCOUNT# is one at this point.
+
+ if (this->ACE_Concurrency_Strategy<SVC_HANDLER>::activate_svc_handler (sh,
+ arg) == -1)
+ return -1;
+
+ // The service handler has been activated. Now cache the handler.
+ if (sh->add_transport_to_cache () == -1)
+ {
+ // Adding to the cache fails, close the handler.
+ sh->close ();
+
+ // #REFCOUNT# is zero at this point.
+
+ if (TAO_debug_level > 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) - Concurrency_Strategy::activate_svc_handler, ")
+ ACE_TEXT ("could not add the handler to cache \n")));
+ }
+
+ return -1;
+ }
+
+ // Registration with cache is successful, #REFCOUNT# is two at this
+ // point.
+
+ TAO_Server_Strategy_Factory *f =
+ this->orb_core_->server_factory ();
+
+ int result = 0;
+
+ // Do we need to create threads?
+ if (f->activate_server_connections ())
+ {
+ // Thread-per-connection concurrency model
+ TAO_Thread_Per_Connection_Handler *tpch = 0;
+
+ ACE_NEW_RETURN (tpch,
+ TAO_Thread_Per_Connection_Handler (sh,
+ this->orb_core_),
+ -1);
+
+ result =
+ tpch->activate (f->server_connection_thread_flags (),
+ f->server_connection_thread_count ());
+ }
+ else
+ {
+ // Otherwise, it is the reactive concurrency model. We may want
+ // to register ourselves with the reactor. Call the register
+ // handler on the transport.
+ result =
+ sh->transport ()->register_handler ();
+ }
+
+ if (result != -1)
+ {
+ // Activation/registration successful: the handler has been
+ // registered with either the Reactor or the
+ // Thread-per-Connection_Handler, and the Transport Cache.
+ // #REFCOUNT# is three at this point.
+
+ // We can let go of our reference.
+ sh->transport ()->remove_reference ();
+ }
+ else
+ {
+ // Activation/registration failure. #REFCOUNT# is two at this
+ // point.
+
+ // Remove from cache.
+ sh->transport ()->purge_entry ();
+
+ // #REFCOUNT# is one at this point.
+
+ // Close handler.
+ sh->close ();
+
+ // #REFCOUNT# is zero at this point.
+
+ if (TAO_debug_level > 0)
+ {
+ const ACE_TCHAR *error = 0;
+ if (f->activate_server_connections ())
+ error = ACE_TEXT("could not activate new connection");
+ else
+ error = ACE_TEXT("could not register new connection in the reactor");
+
+ ACE_ERROR ((LM_ERROR,
+ "TAO (%P|%t) - Concurrency_Strategy::activate_svc_handler, "
+ "%s\n", error));
+ }
+
+ return -1;
+ }
+
+ // Success: #REFCOUNT# is two at this point.
+ return result;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1>
+TAO_Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::TAO_Accept_Strategy (TAO_ORB_Core *orb_core)
+ : orb_core_ (orb_core)
+{
+}
+
+template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1> int
+TAO_Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::open (const ACE_PEER_ACCEPTOR_ADDR &local_addr,
+ int restart)
+{
+
+ return ACCEPT_STRATEGY_BASE::open (local_addr,
+ restart);
+}
+
+template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1> int
+TAO_Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::accept_svc_handler (SVC_HANDLER *svc_handler)
+{
+ return ACCEPT_STRATEGY_BASE::accept_svc_handler (svc_handler);
+}
+
+
+/////////////////////////////////////////////////////////////////////
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_ACCEPTOR_IMPL_CPP */
diff --git a/TAO/tao/Acceptor_Impl.h b/TAO/tao/Acceptor_Impl.h
new file mode 100644
index 00000000000..36311040936
--- /dev/null
+++ b/TAO/tao/Acceptor_Impl.h
@@ -0,0 +1,121 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Acceptor_Impl.h
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan <coryan@cs.wustl.edu>
+ * @author Ossama Othman <othman@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_ACCEPTOR_IMPL_H
+#define TAO_ACCEPTOR_IMPL_H
+
+#include /**/ "ace/pre.h"
+
+#include "ace/Strategies_T.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Basic_Types.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Forward declarations.
+class TAO_ORB_Core;
+
+/**
+ * @class TAO_Creation_Strategy
+ *
+ * @brief Creates a Svc_Handler and set the ORB_Core pointer on it.
+ */
+template <class SVC_HANDLER>
+class TAO_Creation_Strategy : public ACE_Creation_Strategy<SVC_HANDLER>
+{
+public:
+ /**
+ * Constructor.
+ */
+ TAO_Creation_Strategy (TAO_ORB_Core *orb_core,
+ CORBA::Boolean flag = false);
+
+ /// Create a SVC_HANDLER and set the ORB_Core pointer on it.
+ int make_svc_handler (SVC_HANDLER *&sh);
+
+protected:
+ /// Pointer to the ORB Core.
+ TAO_ORB_Core *orb_core_;
+
+ /// Should we use the Lite version for any protocol?
+ CORBA::Boolean lite_flag_;
+};
+
+/**
+ * @class TAO_Concurrency_Strategy
+ *
+ * @brief Activates the Svc_Handler, and then if specified by the
+ * TAO_Server_Strategy_Factory, it activates the Svc_Handler to
+ * run in its own thread.
+ */
+template <class SVC_HANDLER>
+class TAO_Concurrency_Strategy : public ACE_Concurrency_Strategy<SVC_HANDLER>
+{
+public:
+ /// Constructor.
+ TAO_Concurrency_Strategy (TAO_ORB_Core *orb_core);
+
+ /**
+ * Activates the Svc_Handler, and then if specified by the
+ * TAO_Server_Strategy_Factory, it activates the Svc_Handler to run
+ * in its own thread.
+ */
+ int activate_svc_handler (SVC_HANDLER *svc_handler,
+ void *arg);
+
+protected:
+ /// Pointer to the ORB Core.
+ TAO_ORB_Core *orb_core_;
+};
+
+template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1>
+class TAO_Accept_Strategy : public ACE_Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>
+{
+public:
+
+ /// Constructor.
+ TAO_Accept_Strategy (TAO_ORB_Core *orb_core);
+
+ /// Initialize the <peer_acceptor_> with <local_addr>. If the
+ /// process runs out of handles, purge some "old" connections.
+ int open (const ACE_PEER_ACCEPTOR_ADDR &local_addr,
+ int restart = 0);
+
+ /// Delegates to the <accept> method of the PEER_ACCEPTOR. If the
+ /// process runs out of handles, purge some "old" connections.
+ int accept_svc_handler (SVC_HANDLER *svc_handler);
+
+protected:
+ /// Base class.
+ typedef ACE_Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2> ACCEPT_STRATEGY_BASE;
+
+ /// Pointer to the ORB Core.
+ TAO_ORB_Core *orb_core_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+#include "tao/Acceptor_Impl.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
+#pragma implementation ("Acceptor_Impl.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_ACCEPTOR_IMPL_H */
diff --git a/TAO/tao/Acceptor_Registry.cpp b/TAO/tao/Acceptor_Registry.cpp
new file mode 100644
index 00000000000..3ac1c6a4528
--- /dev/null
+++ b/TAO/tao/Acceptor_Registry.cpp
@@ -0,0 +1,899 @@
+// $Id$
+
+#include "tao/Acceptor_Registry.h"
+#include "tao/Profile.h"
+#include "tao/Transport_Acceptor.h"
+#include "tao/Protocol_Factory.h"
+#include "tao/Environment.h"
+#include "tao/ORB_Core.h"
+#include "tao/params.h"
+#include "tao/MProfile.h"
+#include "tao/debug.h"
+#include "tao/Acceptor_Filter.h"
+#include "tao/Endpoint.h"
+#include "tao/ORB_Constants.h"
+#include "tao/SystemException.h"
+#if defined (ACE_WIN32) && defined (ACE_HAS_IPV6)
+# include "tao/IIOP_Acceptor.h"
+#endif /* ACE_WIN32 && ACE_HAS_IPV6 */
+
+#include "ace/Auto_Ptr.h"
+#include "ace/OS_NS_string.h"
+#include "ace/os_include/os_ctype.h"
+
+#if !defined(__ACE_INLINE__)
+#include "tao/Acceptor_Registry.i"
+#endif /* __ACE_INLINE__ */
+
+
+ACE_RCSID (tao,
+ Acceptor_Registry,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Acceptor_Registry::TAO_Acceptor_Registry (void)
+ : acceptors_ (0),
+ size_ (0)
+{
+}
+
+TAO_Acceptor_Registry::~TAO_Acceptor_Registry (void)
+{
+ this->close_all ();
+
+ delete [] this->acceptors_;
+}
+
+size_t
+TAO_Acceptor_Registry::endpoint_count (void)
+{
+ int count = 0;
+ const TAO_AcceptorSetIterator end = this->end ();
+
+ for (TAO_AcceptorSetIterator i = this->begin (); i != end; ++i)
+ {
+ count += (*i)->endpoint_count ();
+ }
+
+ return count;
+}
+
+int
+TAO_Acceptor_Registry::is_collocated (const TAO_MProfile &mprofile)
+{
+ const TAO_AcceptorSetIterator end = this->end ();
+
+ const CORBA::ULong count = mprofile.profile_count ();
+
+ // If at least one endpoint in one of the profiles matches one of
+ // the acceptors, we are collocated.
+ for (TAO_AcceptorSetIterator i = this->begin (); i != end; ++i)
+ {
+ for (TAO_PHandle j = 0; j != count; ++j)
+ {
+ const TAO_Profile *profile = mprofile.get_profile (j);
+
+ // @@ We need to invoke a nonconst <endpoint> method on
+ // <profile>. The content of profile/endpoint will not
+ // be modified.
+ TAO_Profile *pf = const_cast<TAO_Profile *> (profile);
+
+ // Check all endpoints for address equality.
+ if ((*i)->tag () == pf->tag ())
+ {
+ // @note This can be a potentially expensive (O(n^2))
+ // operation if the below is_collocated() call
+ // also executes a loop.
+ for (TAO_Endpoint *endp = pf->endpoint ();
+ endp != 0;
+ endp = endp->next ())
+ {
+ if ((*i)->is_collocated (endp))
+ {
+ return 1;
+ }
+ }
+ }
+ }
+ }
+
+ return 0;
+}
+
+TAO_Acceptor*
+TAO_Acceptor_Registry::get_acceptor (CORBA::ULong tag)
+{
+ TAO_AcceptorSetIterator end = this->end ();
+ TAO_AcceptorSetIterator acceptor = this->begin ();
+
+ for (; acceptor != end; ++acceptor)
+ {
+ if ((*acceptor)->tag () == tag)
+ {
+ return *acceptor;
+ }
+ }
+
+ return 0;
+}
+
+int
+TAO_Acceptor_Registry::open (TAO_ORB_Core *orb_core,
+ ACE_Reactor *reactor,
+ const TAO_EndpointSet &endpoint_set,
+ bool ignore_address
+ ACE_ENV_ARG_DECL)
+{
+ if (endpoint_set.is_empty ()
+ // No endpoints were specified, we let each protocol pick its
+ // own default.
+
+ // All TAO pluggable protocols are expected to have the ability
+ // to create a default endpoint.
+ && this->open_default (orb_core, reactor, 0) == -1)
+ {
+ ACE_THROW_RETURN (CORBA::INTERNAL (
+ CORBA::SystemException::_tao_minor_code (
+ TAO_ACCEPTOR_REGISTRY_OPEN_LOCATION_CODE,
+ 0),
+ CORBA::COMPLETED_NO),
+ -1);
+ }
+
+ // Count the maximum number of endpoints in the set. This will be
+ // the maximum number of acceptors that need to be created.
+ size_t acceptor_count = 0;
+ TAO_EndpointSetIterator endpts (endpoint_set);
+
+ for (ACE_CString *ep = 0;
+ endpts.next (ep) != 0;
+ endpts.advance ())
+ {
+ const ACE_CString &iop = (*ep);
+
+ // IOP://address1,address2
+ // ^ slot
+ ACE_CString::size_type const slot = iop.find ("://", 0);
+
+ if (slot == iop.npos)
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) Invalid endpoint ")
+ ACE_TEXT ("specification: <%s>.\n"),
+ ACE_TEXT_CHAR_TO_TCHAR (iop.c_str ())));
+ }
+
+ ACE_THROW_RETURN (CORBA::BAD_PARAM (
+ CORBA::SystemException::_tao_minor_code (
+ TAO_ACCEPTOR_REGISTRY_OPEN_LOCATION_CODE,
+ EINVAL),
+ CORBA::COMPLETED_NO),
+ -1);
+ }
+
+ ++acceptor_count; // We've got at least one acceptor so far.
+#if defined (ACE_WIN32) && defined (ACE_HAS_IPV6)
+ // Since Win32 has single-stack IPv4/IPv6 we need an additional
+ // acceptor if an iiop protocol without endpoints is specified
+ // to open explicitly on IPv6 ANY *and* IPv4 ANY.
+
+ // Now get the list of available protocol factories.
+ const TAO_ProtocolFactorySetItor end =
+ orb_core->protocol_factories ()->end ();
+
+ // extract the protocol prefix
+ const ACE_CString prefix (iop.substring (0, slot));
+
+ for (TAO_ProtocolFactorySetItor factory =
+ orb_core->protocol_factories ()->begin ();
+ factory != end;
+ ++factory)
+ {
+ if ((*factory)->factory ()->match_prefix (prefix))
+ {
+ if ((*factory)->factory ()->tag () == IOP::TAG_INTERNET_IOP)
+ {
+ // just add additional space to cover for possibility
+ ++acceptor_count;
+ }
+ break; // we found the protocol, no need to go on
+ }
+ }
+#endif /* ACE_WIN32 && ACE_HAS_IPV6 */
+
+ // Now count the number of commas. That number will be the
+ // remaining number of endpoints in the current endpoint
+ // specification.
+ const char *ep_end =
+ ep->c_str () + ACE_OS::strlen (ep->c_str ());
+
+ for (const char *e = ACE_OS::strchr (ep->c_str (), ',');
+ e != 0 && e != ep_end;
+ e = ACE_OS::strchr (e, ','))
+ {
+ ++acceptor_count;
+ ++e;
+ }
+ }
+
+ // The array containing the TAO_Acceptors will never contain more
+ // than the number of endpoints stored in TAO_ORB_Parameters.
+ if (this->acceptors_ == 0)
+ {
+ ACE_NEW_THROW_EX (this->acceptors_,
+ TAO_Acceptor *[acceptor_count],
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ TAO_ACCEPTOR_REGISTRY_OPEN_LOCATION_CODE,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (-1);
+ }
+
+ TAO_EndpointSetIterator endpoints (endpoint_set);
+
+ for (ACE_CString *endpoint = 0;
+ endpoints.next (endpoint) != 0;
+ endpoints.advance ())
+ {
+ const ACE_CString &iop = (*endpoint);
+
+ // IOP://address1,address2
+ // ^ slot
+ ACE_CString::size_type const slot = iop.find ("://", 0);
+
+ if (slot == iop.npos)
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) Invalid endpoint ")
+ ACE_TEXT ("specification: <%s>.\n"),
+ ACE_TEXT_CHAR_TO_TCHAR (iop.c_str ())));
+ }
+
+ ACE_THROW_RETURN (CORBA::BAD_PARAM (
+ CORBA::SystemException::_tao_minor_code (
+ TAO_ACCEPTOR_REGISTRY_OPEN_LOCATION_CODE,
+ EINVAL),
+ CORBA::COMPLETED_NO),
+ -1);
+ }
+
+ const ACE_CString prefix (iop.substring (0, slot));
+
+ // @@ We could move the protocol factory loop to the outermost
+ // level but for now we leave it inside the endpoint loop
+ // under the assumption that there will be more endpoints
+ // than protocols.
+
+ // Now get the list of available protocol factories.
+ const TAO_ProtocolFactorySetItor end =
+ orb_core->protocol_factories ()->end ();
+
+ bool found = false;
+ // If usable protocol (factory) is found then this will be
+ // set equal to true.
+
+ for (TAO_ProtocolFactorySetItor factory =
+ orb_core->protocol_factories ()->begin ();
+ factory != end;
+ ++factory)
+ {
+ if ((*factory)->factory ()->match_prefix (prefix))
+ {
+ // increment slot past the "://" (i.e. add 3)
+ ACE_CString addrs = iop.substring (slot + 3);
+
+ const int result = this->open_i (orb_core,
+ reactor,
+ addrs,
+ factory,
+ ignore_address
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ if (result != 0)
+ {
+ return -1;
+ }
+
+ found = true; // A usable protocol was found.
+ }
+ else
+ {
+ continue;
+ }
+ }
+
+ if (found == false)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) ")
+ ACE_TEXT ("no usable transport protocol ")
+ ACE_TEXT ("was found.\n")));
+
+ ACE_THROW_RETURN (CORBA::BAD_PARAM (
+ CORBA::SystemException::_tao_minor_code (
+ TAO_ACCEPTOR_REGISTRY_OPEN_LOCATION_CODE,
+ EINVAL),
+ CORBA::COMPLETED_NO),
+ -1);
+ }
+ }
+
+ return 0;
+}
+
+// Iterate through the loaded transport protocols and create a default
+// server for each protocol.
+int TAO_Acceptor_Registry::open_default (TAO_ORB_Core *orb_core,
+ ACE_Reactor *reactor,
+ const char *options)
+{
+ // Flag that indicates at least one endpoint was opened. If one
+ // wasn't opened then there is a problem.
+ bool opened_endpoint = false;
+
+#if defined (ACE_WIN32) && defined (ACE_HAS_IPV6)
+ if (!orb_core->orb_params ()->connect_ipv6_only () && this->acceptors_ == 0)
+ {
+ // Since Win32 has single-stack IPv4/IPv6 we need an additional
+ // acceptor to open explicitly on IPv6 ANY *and* IPv4 ANY.
+ // This code takes care of that.
+
+ TAO_ProtocolFactorySet *pfs = orb_core->protocol_factories ();
+
+ // Number of acceptors to set up
+ size_t acceptor_count = 0;
+
+ const TAO_ProtocolFactorySetItor end = pfs->end ();
+
+ // Loop through all the loaded protocols...
+ for (TAO_ProtocolFactorySetItor i = pfs->begin (); i != end; ++i)
+ {
+ if (!(*i)->factory ()->requires_explicit_endpoint ())
+ {
+ if ((*i)->factory ()->tag () == IOP::TAG_INTERNET_IOP)
+ acceptor_count += 2; // IPv4 AND IPv6 endpoints
+ else
+ acceptor_count += 1;
+ }
+ }
+
+ // Allocate TAO_Acceptor array
+ ACE_NEW_RETURN (this->acceptors_,
+ TAO_Acceptor *[acceptor_count],
+ -1);
+
+ // Loop through all the loaded protocols...
+ for (TAO_ProtocolFactorySetItor i = pfs->begin (); i != end; ++i)
+ {
+ // If the protocol requires an explicit -ORBEndpoint option then
+ // don't use it, otherwise open a default endpoint for that
+ // protocol, this solves the problem with persistent endpoints
+ // (such as UNIX domain rendesvouz points) that are not cleaned
+ // up if the server crashes.
+ if (!(*i)->factory ()->requires_explicit_endpoint ())
+ {
+ // Make an acceptor
+ TAO_Acceptor *acceptor =
+ (*i)->factory ()->make_acceptor ();
+
+ if (acceptor == 0)
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_ERROR ((
+ LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) unable to create ")
+ ACE_TEXT ("an acceptor for <%s>\n"),
+ ACE_TEXT_CHAR_TO_TCHAR ((*i)->protocol_name ().c_str ())
+ ));
+ }
+
+ return -1;
+ }
+
+ if ((*i)->factory ()->tag () == IOP::TAG_INTERNET_IOP)
+ {
+ // Open first acceptor on IPv4 ANY
+ ACE_INET_Addr addr(static_cast<unsigned short> (0)); // IPv4 ANY
+
+ TAO_IIOP_Acceptor* iiop_acceptor = dynamic_cast<TAO_IIOP_Acceptor*> (acceptor);
+ iiop_acceptor->set_default_address (addr);
+
+ if (this->open_default_i (orb_core,
+ reactor,
+ TAO_DEF_GIOP_MAJOR, // default major
+ TAO_DEF_GIOP_MINOR, // default minor
+ i,
+ acceptor,
+ options) != 0)
+ {
+ return -1;
+ }
+
+ // record the port chosen for the IPv4 acceptor
+ u_short port = iiop_acceptor->default_address ().get_port_number ();
+
+ // Create second acceptor for IPV6 traffic
+ acceptor =
+ (*i)->factory ()->make_acceptor ();
+
+ if (acceptor == 0)
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_ERROR ((
+ LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) unable to create ")
+ ACE_TEXT ("an acceptor for <%s>\n"),
+ ACE_TEXT_CHAR_TO_TCHAR ((*i)->protocol_name ().c_str ())
+ ));
+ }
+
+ return -1;
+ }
+
+ addr.set (port, ACE_IPV6_ANY, AF_INET6); // IPv6 ANY on specified port
+
+ iiop_acceptor = dynamic_cast<TAO_IIOP_Acceptor*> (acceptor);
+ iiop_acceptor->set_default_address (addr);
+
+ if (this->open_default_i (orb_core,
+ reactor,
+ TAO_DEF_GIOP_MAJOR, // default major
+ TAO_DEF_GIOP_MINOR, // default minor
+ i,
+ acceptor,
+ options) != 0)
+ {
+ return -1;
+ }
+ }
+ else
+ {
+ if (this->open_default_i (orb_core,
+ reactor,
+ TAO_DEF_GIOP_MAJOR, // default major
+ TAO_DEF_GIOP_MINOR, // default minor
+ i,
+ acceptor,
+ options) != 0)
+ {
+ return -1;
+ }
+ }
+
+ opened_endpoint = true;
+ }
+ }
+ }
+ else
+ {
+#endif /* ACE_WIN32 && ACE_HAS_IPV6 */
+ TAO_ProtocolFactorySet *pfs = orb_core->protocol_factories ();
+
+ // If the TAO_Acceptor array is zero by the time we get here then no
+ // endpoints were specified by the user, meaning that the number of
+ // acceptors will never be more than the number of loaded protocols
+ // in the ORB core.
+ if (this->acceptors_ == 0)
+ {
+ ACE_NEW_RETURN (this->acceptors_,
+ TAO_Acceptor *[pfs->size ()],
+ -1);
+ }
+
+ const TAO_ProtocolFactorySetItor end = pfs->end ();
+
+ // Loop through all the loaded protocols...
+ for (TAO_ProtocolFactorySetItor i = pfs->begin (); i != end; ++i)
+ {
+ // If the protocol requires an explicit -ORBEndpoint option then
+ // don't use it, otherwise open a default endpoint for that
+ // protocol, this solves the problem with persistent endpoints
+ // (such as UNIX domain rendesvouz points) that are not cleaned
+ // up if the server crashes.
+ if (!(*i)->factory ()->requires_explicit_endpoint ())
+ {
+ if (this->open_default (orb_core,
+ reactor,
+ TAO_DEF_GIOP_MAJOR, // default major
+ TAO_DEF_GIOP_MINOR, // default minor
+ i,
+ options) != 0)
+ {
+ return -1;
+ }
+
+ opened_endpoint = true;
+ }
+ }
+#if defined (ACE_WIN32) && defined (ACE_HAS_IPV6)
+ }
+#endif /* ACE_WIN32) && ACE_HAS_IPV6 */
+
+ if (!opened_endpoint)
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) No default endpoints ")
+ ACE_TEXT ("opened.\n")
+ ACE_TEXT ("Please specify one or more using ")
+ ACE_TEXT ("the \"-ORBListenEndpoints\" ")
+ ACE_TEXT ("option.\n")));
+ }
+
+ return -1;
+ }
+
+ return 0;
+}
+
+// Used when no endpoints were specified. Open a default server for
+// the indicated protocol.
+int
+TAO_Acceptor_Registry::open_default (TAO_ORB_Core *orb_core,
+ ACE_Reactor *reactor,
+ int major,
+ int minor,
+ TAO_ProtocolFactorySetItor &factory,
+ const char *options)
+{
+ // No endpoints were specified, we let each protocol pick its own
+ // default endpoint.
+
+ // Make an acceptor
+ TAO_Acceptor *acceptor =
+ (*factory)->factory ()->make_acceptor ();
+
+ if (acceptor == 0)
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_ERROR ((
+ LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) unable to create ")
+ ACE_TEXT ("an acceptor for <%s>\n"),
+ ACE_TEXT_CHAR_TO_TCHAR ((*factory)->protocol_name ().c_str ())
+ ));
+ }
+
+ return -1;
+ }
+
+ return this->open_default_i (orb_core,
+ reactor,
+ major,
+ minor,
+ factory,
+ acceptor,
+ options);
+}
+
+// Open a default server.
+int
+TAO_Acceptor_Registry::open_default_i (TAO_ORB_Core *orb_core,
+ ACE_Reactor *reactor,
+ int major,
+ int minor,
+ TAO_ProtocolFactorySetItor &factory,
+ TAO_Acceptor* acceptor,
+ const char *options)
+{
+ // Initialize the acceptor to listen on a default endpoint.
+ if (acceptor->open_default (orb_core,
+ reactor,
+ major,
+ minor,
+ options) == -1)
+ {
+ delete acceptor;
+
+ if (TAO_debug_level > 0)
+ {
+ ACE_ERROR ((
+ LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) unable to open ")
+ ACE_TEXT ("default acceptor for <%s>%p\n"),
+ ACE_TEXT_CHAR_TO_TCHAR ((*factory)->protocol_name ().c_str ()),
+ ACE_TEXT ("")
+ ));
+ }
+
+ return -1;
+ }
+
+ this->acceptors_[this->size_++] = acceptor;
+
+ return 0;
+}
+
+int
+TAO_Acceptor_Registry::close_all (void)
+{
+ const TAO_AcceptorSetIterator end = this->end ();
+
+ for (TAO_AcceptorSetIterator i = this->begin (); i != end; ++i)
+ {
+ if (*i == 0)
+ {
+ continue;
+ }
+
+ (*i)->close ();
+
+ delete *i;
+ }
+
+ this->size_ = 0;
+ return 0;
+}
+
+void
+TAO_Acceptor_Registry::extract_endpoint_options (ACE_CString &addrs,
+ ACE_CString &options,
+ TAO_Protocol_Factory *factory)
+{
+ ACE_CString::size_type const options_index =
+ addrs.find (factory->options_delimiter ());
+
+ if (options_index == addrs.length () - 1)
+ {
+ // Get rid of trailing option delimiter.
+ addrs = addrs.substring (0, addrs.length () - 1);
+ }
+ else if (options_index != ACE_CString::npos)
+ {
+ options = addrs.substring (options_index + 1);
+ addrs = addrs.substring (0, options_index);
+ }
+}
+
+void
+TAO_Acceptor_Registry::extract_endpoint_version (ACE_CString &address,
+ int &major,
+ int &minor)
+{
+ // Check if an "N.n@" version prefix was
+ // specified.
+ major = TAO_DEF_GIOP_MAJOR;
+ minor = TAO_DEF_GIOP_MINOR;
+
+ if (isdigit (address[0])
+ && address[1] == '.'
+ && isdigit (address[2])
+ && address[3] == '@')
+ {
+ major = address[0] - '0';
+ minor = address[2] - '0';
+ address = address.substring (4);
+ }
+}
+
+int
+TAO_Acceptor_Registry::open_i (TAO_ORB_Core *orb_core,
+ ACE_Reactor *reactor,
+ ACE_CString &addrs,
+ TAO_ProtocolFactorySetItor &factory,
+ bool ignore_address
+ ACE_ENV_ARG_DECL)
+{
+ ACE_CString options_tmp;
+ this->extract_endpoint_options (addrs,
+ options_tmp,
+ (*factory)->factory ());
+
+ const char *options = 0;
+
+ if (options_tmp.length () > 0)
+ options = options_tmp.c_str ();
+
+ char *last_addr = 0;
+ ACE_Auto_Basic_Array_Ptr<char> addr_str (addrs.rep ());
+
+ const char *astr = ACE_OS::strtok_r (addr_str.get (),
+ ",",
+ &last_addr);
+
+ // Iterate over the addrs specified in the endpoint.
+
+ do
+ {
+ // For the first time only through the loop, it is
+ // possible for astr to be 0. This indicates that
+ // the user is requesting the default endpoint for
+ // the specified protocol.
+ ACE_CString address (astr == 0 ? "" : astr);
+
+ TAO_Acceptor *acceptor =
+ (*factory)->factory ()->make_acceptor ();
+
+ if (acceptor != 0)
+ {
+ // Extract the desired endpoint/protocol version if one
+ // exists.
+ int major = TAO_DEF_GIOP_MAJOR;
+ int minor = TAO_DEF_GIOP_MINOR;
+ this->extract_endpoint_version (address,
+ major,
+ minor);
+
+ // Check for existence of endpoint.
+ if (ignore_address || address.length () == 0)
+ {
+ // Protocol prefix was specified without any endpoints.
+ // All TAO pluggable protocols are expected to have the
+ // ability to create a default endpoint.
+#if defined (ACE_WIN32) && defined (ACE_HAS_IPV6)
+ if ((*factory)->factory ()->tag () == IOP::TAG_INTERNET_IOP)
+ {
+ // Open first acceptor on IPv4 ANY
+ ACE_INET_Addr addr(static_cast<unsigned short> (0)); // IPv4 ANY
+
+ TAO_IIOP_Acceptor* iiop_acceptor = dynamic_cast<TAO_IIOP_Acceptor*> (acceptor);
+ iiop_acceptor->set_default_address (addr);
+
+ if (this->open_default_i (orb_core,
+ reactor,
+ major,
+ minor,
+ factory,
+ acceptor,
+ options) == 0)
+ {
+ // record the port chosen for the IPv4 acceptor
+ u_short port = iiop_acceptor->default_address ().get_port_number ();
+
+ // Create second acceptor for IPV6 traffic
+ acceptor =
+ (*factory)->factory ()->make_acceptor ();
+
+ if (acceptor == 0)
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_ERROR ((
+ LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) unable to create ")
+ ACE_TEXT ("an acceptor for <%s>\n"),
+ ACE_TEXT_CHAR_TO_TCHAR ((*factory)->protocol_name ().c_str ())
+ ));
+ }
+
+ ACE_THROW_RETURN (CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ TAO_ACCEPTOR_REGISTRY_OPEN_LOCATION_CODE,
+ ENOMEM),
+ CORBA::COMPLETED_NO),
+ -1);
+ }
+
+ addr.set (port, ACE_IPV6_ANY, AF_INET6); // IPv6 ANY on specified port
+
+ iiop_acceptor = dynamic_cast<TAO_IIOP_Acceptor*> (acceptor);
+ iiop_acceptor->set_default_address (addr);
+
+ if (this->open_default_i (orb_core,
+ reactor,
+ major,
+ minor,
+ factory,
+ acceptor,
+ options) == 0)
+ {
+ continue;
+ }
+ }
+
+ }
+ else
+ {
+ if (this->open_default_i (orb_core,
+ reactor,
+ major,
+ minor,
+ factory,
+ acceptor,
+ options) == 0)
+ {
+ continue;
+ }
+ }
+
+ // Could not open a default endpoint, nor an explicit
+ // one.
+ ACE_THROW_RETURN (CORBA::INTERNAL (
+ CORBA::SystemException::_tao_minor_code (
+ TAO_ACCEPTOR_REGISTRY_OPEN_LOCATION_CODE,
+ 0),
+ CORBA::COMPLETED_NO),
+ -1);
+#else /* ACE_WIN32 && ACE_HAS_IPV6 */
+ if (this->open_default_i (orb_core,
+ reactor,
+ major,
+ minor,
+ factory,
+ acceptor,
+ options) == 0)
+ continue;
+
+ // Could not open a default endpoint, nor an explicit
+ // one.
+ else
+ {
+ ACE_THROW_RETURN (CORBA::INTERNAL (
+ CORBA::SystemException::_tao_minor_code (
+ TAO_ACCEPTOR_REGISTRY_OPEN_LOCATION_CODE,
+ 0),
+ CORBA::COMPLETED_NO),
+ -1);
+ }
+#endif /* !ACE_WIN32 || !ACE_HAS_IPV6 */
+ }
+ // An explicit endpoint was provided.
+ else if (acceptor->open (orb_core,
+ reactor,
+ major,
+ minor,
+ address.c_str (),
+ options) == -1)
+ {
+ /* Need to save the errno value from the acceptor->open(),
+ * because errno will get reset when we delete acceptor */
+ const int errno_value = errno;
+ delete acceptor;
+
+ if (TAO_debug_level > 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) ")
+ ACE_TEXT ("unable to open acceptor ")
+ ACE_TEXT ("for <%s>%p\n"),
+ ACE_TEXT_CHAR_TO_TCHAR (address.c_str ()),
+ ACE_TEXT ("")));
+ }
+
+ ACE_THROW_RETURN (CORBA::BAD_PARAM (
+ CORBA::SystemException::_tao_minor_code (
+ TAO_ACCEPTOR_REGISTRY_OPEN_LOCATION_CODE,
+ errno_value),
+ CORBA::COMPLETED_NO),
+ -1);
+ }
+
+ // add acceptor to list
+ this->acceptors_[this->size_++] = acceptor;
+ }
+ else
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) unable to create ")
+ ACE_TEXT ("an acceptor for <%s>.\n"),
+ ACE_TEXT_CHAR_TO_TCHAR (address.c_str ())));
+ }
+
+ ACE_THROW_RETURN (CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ TAO_ACCEPTOR_REGISTRY_OPEN_LOCATION_CODE,
+ ENOMEM),
+ CORBA::COMPLETED_NO),
+ -1);
+ }
+ }
+ while (astr != 0 && (astr = ACE_OS::strtok_r (0, ",", &last_addr)) != 0);
+
+ return 0;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Acceptor_Registry.h b/TAO/tao/Acceptor_Registry.h
new file mode 100644
index 00000000000..8b6ab5acc24
--- /dev/null
+++ b/TAO/tao/Acceptor_Registry.h
@@ -0,0 +1,162 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Acceptor_Registry.h
+ *
+ * $Id$
+ *
+ * Interface for the TAO pluggable protocol framework.
+ *
+ * @author Fred Kuhns <fredk@cs.wustl.edu>
+ * @author Ossama Othman <ossama@uci.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_ACCEPTOR_REGISTRY_H
+#define TAO_ACCEPTOR_REGISTRY_H
+
+#include /**/ "ace/pre.h"
+#include "ace/Unbounded_Set.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/TAO_Export.h"
+#include "tao/Exception.h"
+#include "tao/params.h"
+
+ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+class ACE_Addr;
+class ACE_Reactor;
+ACE_END_VERSIONED_NAMESPACE_DECL
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_ORB_Core;
+class TAO_Acceptor;
+class TAO_Acceptor_Filter;
+class TAO_Stub;
+class TAO_Profile;
+class TAO_MProfile;
+class TAO_Protocol_Factory;
+class TAO_Protocol_Item;
+
+typedef ACE_Unbounded_Set_Iterator<TAO_Protocol_Item *>
+ TAO_ProtocolFactorySetItor;
+
+typedef TAO_Acceptor** TAO_AcceptorSetIterator;
+
+/**
+ * @class TAO_Acceptor_Registry
+ *
+ * @brief Acceptor Registry and Generic Acceptor interface definitions.
+ * All loaded ESIOP or GIOP acceptor bridges must register with
+ * this object.
+ *
+ * This class maintains a list os acceptor factories
+ * for all loaded ORB protocols.
+ * There is one Acceptor_Registry per ORB_Core.
+ */
+class TAO_Export TAO_Acceptor_Registry
+{
+public:
+ // = Initialization and termination methods.
+ /// Default constructor.
+ TAO_Acceptor_Registry (void);
+
+ /// Default destructor.
+ ~TAO_Acceptor_Registry (void);
+
+ /// Initialize all registered acceptors. Return -1 on error.
+ int open (TAO_ORB_Core *orb_core,
+ ACE_Reactor *reactor,
+ const TAO_EndpointSet &endpoint_set,
+ bool ignore_address
+ ACE_ENV_ARG_DECL);
+
+ /// Close all open acceptors.
+ int close_all (void);
+
+ /// Returns the total number of endpoints in all of its acceptors.
+ size_t endpoint_count (void);
+
+ /// Check if there is at least one profile in @a mprofile that
+ /// corresponds to a collocated object.
+ int is_collocated (const TAO_MProfile& mprofile);
+
+ /// Return the acceptor bridges
+ TAO_Acceptor *get_acceptor (CORBA::ULong tag);
+
+ // = Iterator.
+ TAO_AcceptorSetIterator begin (void);
+ TAO_AcceptorSetIterator end (void);
+
+private:
+
+ /// Create a default acceptor for all loaded protocols.
+ int open_default (TAO_ORB_Core *orb_core,
+ ACE_Reactor *reactor,
+ const char *options);
+
+ /// Create a default acceptor using the specified protocol factory.
+ int open_default (TAO_ORB_Core *orb_core,
+ ACE_Reactor *reactor,
+ int major,
+ int minor,
+ TAO_ProtocolFactorySetItor &factory,
+ const char *options);
+
+ /// Open a default acceptor.
+ int open_default_i (TAO_ORB_Core *orb_core,
+ ACE_Reactor *reactor,
+ int major,
+ int minor,
+ TAO_ProtocolFactorySetItor &factory,
+ TAO_Acceptor* acceptor,
+ const char *options);
+
+ /// Extract endpoint-specific options from the endpoint string.
+ void extract_endpoint_options (ACE_CString &addrs,
+ ACE_CString &options,
+ TAO_Protocol_Factory *factory);
+
+ /// Extract endpoint/address specific version from the endpoint
+ /// string.
+ void extract_endpoint_version (ACE_CString &address,
+ int &major,
+ int &minor);
+
+ /// Iterator through addrs in the string <iop>, and create an
+ /// acceptor for each one.
+ int open_i (TAO_ORB_Core *orb_core,
+ ACE_Reactor *reactor,
+ ACE_CString &address,
+ TAO_ProtocolFactorySetItor &factory,
+ bool ignore_address
+ ACE_ENV_ARG_DECL);
+
+private:
+
+ // The acceptor registry should not be copied.
+ TAO_Acceptor_Registry (const TAO_Acceptor_Registry&);
+ void operator= (const TAO_Acceptor_Registry&);
+
+private:
+ /// List of acceptors that are currently open.
+ TAO_Acceptor **acceptors_;
+
+ /// Number of acceptors that are currently open.
+ size_t size_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined(__ACE_INLINE__)
+#include "tao/Acceptor_Registry.i"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_ACCEPTOR_REGISTRY_H */
diff --git a/TAO/tao/Acceptor_Registry.i b/TAO/tao/Acceptor_Registry.i
new file mode 100644
index 00000000000..b086cbf1c1b
--- /dev/null
+++ b/TAO/tao/Acceptor_Registry.i
@@ -0,0 +1,19 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE TAO_AcceptorSetIterator
+TAO_Acceptor_Registry::begin (void)
+{
+ return this->acceptors_;
+}
+
+ACE_INLINE TAO_AcceptorSetIterator
+TAO_Acceptor_Registry::end (void)
+{
+ return this->acceptors_ + this->size_;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Adapter.cpp b/TAO/tao/Adapter.cpp
new file mode 100644
index 00000000000..d85ab3b7bac
--- /dev/null
+++ b/TAO/tao/Adapter.cpp
@@ -0,0 +1,15 @@
+// $Id$
+
+#include "tao/Adapter.h"
+
+ACE_RCSID (tao,
+ Adapter,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Adapter::~TAO_Adapter (void)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Adapter.h b/TAO/tao/Adapter.h
new file mode 100644
index 00000000000..86750d406bd
--- /dev/null
+++ b/TAO/tao/Adapter.h
@@ -0,0 +1,116 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Adapter.h
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan (coryan@uci.edu)
+ */
+//=============================================================================
+
+#ifndef TAO_ADAPTER_H
+#define TAO_ADAPTER_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/SystemException.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/CORBA_methods.h"
+#include "tao/Pseudo_VarOut_T.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace CORBA
+{
+ typedef TAO_Pseudo_Var_T<Object> Object_var;
+ typedef TAO_Pseudo_Out_T<Object> Object_out;
+}
+
+namespace TAO
+{
+ class ObjectKey;
+}
+
+class TAO_ORB_Core;
+class TAO_Stub;
+class TAO_MProfile;
+class TAO_ServerRequest;
+
+class TAO_Export TAO_Adapter
+{
+public:
+ virtual ~TAO_Adapter (void);
+
+ /// Initialize the Adapter
+ virtual void open (ACE_ENV_SINGLE_ARG_DECL) = 0;
+
+ /// The ORB is shutting down, destroy any resources attached to this
+ /// adapter.
+ virtual void close (int wait_for_completion
+ ACE_ENV_ARG_DECL) = 0;
+
+ /// Check if the adapter can be closed in the current context, raise
+ /// an exception if not.
+ virtual void check_close (int wait_for_completion
+ ACE_ENV_ARG_DECL) = 0;
+
+ /**
+ * Return the priority assigned to this adapter.
+ * Adapters at higher priority are used first, the first adapter
+ * that matches a key is used to dispatch a request.
+ */
+ virtual int priority (void) const = 0;
+
+ /// Return the status....
+ virtual int dispatch (TAO::ObjectKey &key,
+ TAO_ServerRequest &request,
+ CORBA::Object_out forward_to
+ ACE_ENV_ARG_DECL) = 0;
+
+ enum {
+ /// The operation was successfully dispatched, an exception may
+ /// have been raised, but that is a correct execution too.
+ DS_OK,
+
+ /// There was a problem in dispatching the operation.
+ DS_FAILED,
+
+ /// The key is not in the right format for this Adapter, try the
+ /// next one.
+ DS_MISMATCHED_KEY,
+
+ /// Forward the request to another object reference, this decouples
+ /// the ORB from the PortableServer::ForwardRequest exception
+ DS_FORWARD
+ };
+
+ /// Return the name, i.e. the object id used to resolve it in the
+ /// ORB.
+ virtual const char *name (void) const = 0;
+
+ /**
+ * Return the root of the Object Adapter.
+ * Each adapter defines its own IDL interface accessed through the
+ * method above.
+ */
+ virtual CORBA::Object_ptr root (void) = 0;
+
+ /// Create a collocated object using the given profile and stub.
+ virtual CORBA::Object_ptr create_collocated_object (TAO_Stub *,
+ const TAO_MProfile &) = 0;
+ /// Initialize a collocated object using the given stub
+ /// pointer for lazily evaluated object references.
+ virtual CORBA::Long initialize_collocated_object (TAO_Stub *) = 0;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_ADAPTER_H */
diff --git a/TAO/tao/Adapter_Factory.cpp b/TAO/tao/Adapter_Factory.cpp
new file mode 100644
index 00000000000..104a5662569
--- /dev/null
+++ b/TAO/tao/Adapter_Factory.cpp
@@ -0,0 +1,13 @@
+// $Id$
+
+#include "tao/Adapter_Factory.h"
+
+// ****************************************************************
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Adapter_Factory::~TAO_Adapter_Factory (void)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Adapter_Factory.h b/TAO/tao/Adapter_Factory.h
new file mode 100644
index 00000000000..8fa53f30628
--- /dev/null
+++ b/TAO/tao/Adapter_Factory.h
@@ -0,0 +1,48 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Adapter_Factory.h
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan (coryan@uci.edu)
+ */
+//=============================================================================
+
+#ifndef TAO_ADAPTER_FACTORY_H
+#define TAO_ADAPTER_FACTORY_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/TAO_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Versioned_Namespace.h"
+
+#include "ace/Service_Object.h"
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Adapter;
+class TAO_ORB_Core;
+
+class TAO_Export TAO_Adapter_Factory : public ACE_Service_Object
+{
+public:
+ /// Destructor
+ virtual ~TAO_Adapter_Factory (void);
+
+ /// Create a new adapter
+ virtual TAO_Adapter *create (TAO_ORB_Core *orb_core) = 0;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_ADAPTER_FACTORY_H */
diff --git a/TAO/tao/Adapter_Registry.cpp b/TAO/tao/Adapter_Registry.cpp
new file mode 100644
index 00000000000..16aa66007e0
--- /dev/null
+++ b/TAO/tao/Adapter_Registry.cpp
@@ -0,0 +1,199 @@
+// $Id$
+
+#include "tao/Object.h"
+#include "tao/Stub.h"
+#include "tao/Adapter_Registry.h"
+#include "tao/Adapter.h"
+#include "tao/SystemException.h"
+#include "tao/debug.h"
+
+#include "ace/Log_Msg.h"
+#include "ace/OS_NS_string.h"
+
+ACE_RCSID (tao,
+ Adapter_Registry,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Adapter_Registry::TAO_Adapter_Registry (TAO_ORB_Core *oc)
+ : orb_core_ (oc),
+ adapters_capacity_ (16), // @@ Make it configurable
+ adapters_count_ (0),
+ adapters_ (0)
+{
+ ACE_NEW (this->adapters_,
+ TAO_Adapter*[this->adapters_capacity_]);
+}
+
+TAO_Adapter_Registry::~TAO_Adapter_Registry (void)
+{
+ for (size_t i = 0; i != this->adapters_count_; ++i)
+ delete this->adapters_[i];
+
+ delete[] this->adapters_;
+}
+
+void
+TAO_Adapter_Registry::close (int wait_for_completion
+ ACE_ENV_ARG_DECL)
+{
+ ACE_TRY
+ {
+ for (size_t i = 0; i != this->adapters_count_; ++i)
+ {
+ this->adapters_[i]->close (wait_for_completion
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ }
+ ACE_CATCHANY
+ {
+ if (TAO_debug_level > 3)
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "Exception in TAO_Adapter_Registry::close ()");
+ }
+ return;
+ }
+ ACE_ENDTRY;
+
+ return;
+}
+
+void
+TAO_Adapter_Registry::check_close (int wait_for_completion
+ ACE_ENV_ARG_DECL)
+{
+ for (size_t i = 0; i != this->adapters_count_; ++i)
+ {
+ this->adapters_[i]->check_close (wait_for_completion
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+}
+
+void
+TAO_Adapter_Registry::insert (TAO_Adapter *adapter
+ ACE_ENV_ARG_DECL)
+{
+ if (this->adapters_capacity_ == this->adapters_count_)
+ {
+ this->adapters_capacity_ *= 2;
+ TAO_Adapter **tmp = 0;
+ ACE_NEW_THROW_EX (tmp,
+ TAO_Adapter*[this->adapters_capacity_],
+ CORBA::NO_MEMORY ());
+ ACE_CHECK;
+
+ for (size_t i = 0; i != this->adapters_count_; ++i)
+ tmp[i] = this->adapters_[i];
+ delete[] this->adapters_;
+ this->adapters_ = tmp;
+ }
+
+ int const priority = adapter->priority ();
+ for (size_t i = 0; i != this->adapters_count_; ++i)
+ {
+ if (this->adapters_[i]->priority () >= priority)
+ {
+ for (size_t j = this->adapters_count_ + 1;
+ j > i;
+ --j)
+ {
+ this->adapters_[j] = this->adapters_[j - 1];
+ }
+ this->adapters_[i] = adapter;
+ ++this->adapters_count_;
+ return;
+ }
+ }
+ this->adapters_[this->adapters_count_++] = adapter;
+}
+
+void
+TAO_Adapter_Registry::dispatch (TAO::ObjectKey &key,
+ TAO_ServerRequest &request,
+ CORBA::Object_out forward_to
+ ACE_ENV_ARG_DECL)
+{
+ for (size_t i = 0; i != this->adapters_count_; ++i)
+ {
+ int const r = this->adapters_[i]->dispatch (key,
+ request,
+ forward_to
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (r != TAO_Adapter::DS_MISMATCHED_KEY)
+ {
+ return;
+ }
+ }
+
+ if (CORBA::is_nil (forward_to))
+ {
+ ACE_THROW (CORBA::OBJECT_NOT_EXIST ());
+ }
+}
+
+CORBA::Object_ptr
+TAO_Adapter_Registry::create_collocated_object (TAO_Stub *stub,
+ const TAO_MProfile &mprofile)
+{
+ for (size_t i = 0; i != this->adapters_count_; ++i)
+ {
+ CORBA::Object_ptr x =
+ this->adapters_[i]->create_collocated_object (stub,
+ mprofile);
+ if (x != 0)
+ {
+ if (!stub->collocated_servant ())
+ {
+ // This adapter created an object but it was not able to locate
+ // a servant so we need to give the rest of the adapters a chance to
+ // initialise the stub and find a servant or forward us or whatever.
+ for (CORBA::Long go_on = 1; go_on && i != this->adapters_count_; ++i)
+ {
+ // initialize_collocated_object only returns 0 if it has completely
+ // initialised the object.
+ go_on = this->adapters_[i]->initialize_collocated_object (stub);
+ }
+ }
+ return x;
+ }
+ }
+ return 0;
+}
+
+CORBA::Long
+TAO_Adapter_Registry::initialize_collocated_object (TAO_Stub *stub)
+{
+ for (size_t i = 0; i != this->adapters_count_; ++i)
+ {
+ int const retval =
+ this->adapters_[i]->initialize_collocated_object (stub);
+ if (retval == 0)
+ {
+ // initialize_collocated_object only returns 0 if it has completely
+ // initialised the object. We can return early.
+ return retval;
+ }
+ }
+ return 0;
+}
+
+TAO_Adapter *
+TAO_Adapter_Registry::find_adapter (const char *name) const
+{
+ for (TAO_Adapter **i = this->adapters_;
+ i != this->adapters_ + this->adapters_count_;
+ ++i)
+ if (ACE_OS::strcmp ((*i)->name (), name) == 0)
+ return *i;
+
+ return 0;
+
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Adapter_Registry.h b/TAO/tao/Adapter_Registry.h
new file mode 100644
index 00000000000..3af900bf370
--- /dev/null
+++ b/TAO/tao/Adapter_Registry.h
@@ -0,0 +1,123 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Adapter_Registry.h
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan (coryan@uci.edu)
+ */
+//=============================================================================
+
+#ifndef TAO_ADAPTER_REGISTRY_H
+#define TAO_ADAPTER_REGISTRY_H
+
+#include /**/ "ace/pre.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/SystemException.h"
+
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+#include "tao/CORBA_methods.h"
+#include "tao/Pseudo_VarOut_T.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace CORBA
+{
+ typedef TAO_Pseudo_Var_T<Object> Object_var;
+ typedef TAO_Pseudo_Out_T<Object> Object_out;
+}
+
+namespace TAO
+{
+ class ObjectKey;
+}
+
+class TAO_ORB_Core;
+class TAO_Stub;
+class TAO_MProfile;
+class TAO_ServerRequest;
+class TAO_Adapter;
+
+class TAO_Export TAO_Adapter_Registry
+{
+public:
+ TAO_Adapter_Registry (TAO_ORB_Core *orb_core);
+
+ /// Close the
+ ~TAO_Adapter_Registry (void);
+
+ /**
+ * Close each of of the Adapters and then cleanup the Registry.
+ * It is possible that an Adapter will reject a close() call if it
+ * is invoked in an innapropriate context (think shutting down the
+ * POA while performing an upcall).
+ */
+ void close (int wait_for_completion
+ ACE_ENV_ARG_DECL);
+
+ /**
+ * Verify if the close() call can be invoked in the current
+ * context for *all* adapters.
+ * Raise the right exception if not.
+ */
+ void check_close (int wait_for_completion
+ ACE_ENV_ARG_DECL);
+
+ /// Insert a new adapter into the registry.
+ void insert (TAO_Adapter *adapter
+ ACE_ENV_ARG_DECL);
+
+ /**
+ * Dispatch the request to all the adapters.
+ * It tries the adapters ordered by priority, stopping when the
+ * adapter returns a status different from DS_MISMATCHED_KEY
+ */
+ void dispatch (TAO::ObjectKey &key,
+ TAO_ServerRequest &request,
+ CORBA::Object_out forward_to
+ ACE_ENV_ARG_DECL);
+
+ /// Create a collocated object using the given profile and stub.
+ CORBA::Object_ptr create_collocated_object (TAO_Stub *,
+ const TAO_MProfile &);
+
+ /// Initialize a collocated object using the given stub and object
+ /// pointer for lazily evaluated object references.
+ CORBA::Long initialize_collocated_object (TAO_Stub *);
+
+ /// Fetch the adapter named @a name
+ TAO_Adapter *find_adapter (const char *name) const;
+
+private:
+ /// The ORB Core
+ TAO_ORB_Core *orb_core_;
+
+ /**
+ * @name A simple array of adapters.
+ */
+ //@{
+ size_t adapters_capacity_;
+ size_t adapters_count_;
+ TAO_Adapter **adapters_;
+ //@}
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_ADAPTER_REGISTRY_H */
diff --git a/TAO/tao/Allocator.h b/TAO/tao/Allocator.h
new file mode 100644
index 00000000000..ec6567fc0dd
--- /dev/null
+++ b/TAO/tao/Allocator.h
@@ -0,0 +1,50 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Allocator.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen (jwillemsen@remedy.nl)
+ */
+//=============================================================================
+
+#ifndef TAO_ALLOCATOR_H
+#define TAO_ALLOCATOR_H
+
+#include /**/ "ace/pre.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Versioned_Namespace.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ /**
+ * @class TAO_Allocator
+ *
+ * @brief Abstract class for TAO allocators. This will be used for derived
+ * allocator templates that are capable of allocating a specific type of
+ * objects
+ */
+ template <typename handler_type>
+ class TAO_Allocator
+ {
+ public:
+
+ virtual ~TAO_Allocator (void) {}
+
+ virtual handler_type *allocate () = 0;
+ virtual void release (handler_type *ptr) = 0;
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_ALLOCATOR_H */
diff --git a/TAO/tao/AnyTypeCode.mpc b/TAO/tao/AnyTypeCode.mpc
new file mode 100644
index 00000000000..c5d1d8080b2
--- /dev/null
+++ b/TAO/tao/AnyTypeCode.mpc
@@ -0,0 +1,134 @@
+//$Id$
+project : taolib, core, extra_anytypecode, tao_versioning_idl_defaults {
+ sharedname = TAO_AnyTypeCode
+ dynamicflags = TAO_ANYTYPECODE_BUILD_DLL
+
+ Source_Files(TAO_ANYTYPECODE_COMPONENTS) {
+ AnyTypeCode/Alias_TypeCode_Static.cpp
+ AnyTypeCode/Any.cpp
+ AnyTypeCode/AnySeqA.cpp
+ AnyTypeCode/AnySeqC.cpp
+ AnyTypeCode/Any_Basic_Impl.cpp
+ AnyTypeCode/Any_Impl.cpp
+ AnyTypeCode/Any_SystemException.cpp
+ AnyTypeCode/Any_Unknown_IDL_Type.cpp
+ AnyTypeCode/AnyTypeCode_Adapter_Impl.cpp
+ AnyTypeCode/append.cpp
+ AnyTypeCode/BooleanSeqA.cpp
+ AnyTypeCode/BoundsA.cpp
+ AnyTypeCode/BoundsC.cpp
+ AnyTypeCode/CharSeqA.cpp
+ AnyTypeCode/CONV_FRAMEA.cpp
+ AnyTypeCode/CurrentA.cpp
+ AnyTypeCode/DoubleSeqA.cpp
+ AnyTypeCode/DynamicA.cpp
+ AnyTypeCode/DynamicC.cpp
+ AnyTypeCode/Dynamic_ParameterA.cpp
+ AnyTypeCode/Dynamic_ParameterC.cpp
+ AnyTypeCode/Empty_Param_TypeCode.cpp
+ AnyTypeCode/Enum_TypeCode_Static.cpp
+ AnyTypeCode/ExceptionA.cpp
+ AnyTypeCode/FloatSeqA.cpp
+ AnyTypeCode/GIOPA.cpp
+ AnyTypeCode/IIOPA.cpp
+ AnyTypeCode/IIOP_EndpointsA.cpp
+ AnyTypeCode/IOP_IORA.cpp
+ AnyTypeCode/LongDoubleSeqA.cpp
+ AnyTypeCode/LongLongSeqA.cpp
+ AnyTypeCode/LongSeqA.cpp
+ AnyTypeCode/Marshal.cpp
+ AnyTypeCode/Messaging_PolicyValueA.cpp
+ AnyTypeCode/NVList.cpp
+ AnyTypeCode/NVList_Adapter_Impl.cpp
+ AnyTypeCode/ObjectIdListA.cpp
+ AnyTypeCode/Objref_TypeCode_Static.cpp
+ AnyTypeCode/OctetSeqA.cpp
+ AnyTypeCode/orb_typesA.cpp
+ AnyTypeCode/ParameterModeA.cpp
+ AnyTypeCode/PI_ForwardA.cpp
+ AnyTypeCode/PolicyA.cpp
+ AnyTypeCode/Policy_ForwardA.cpp
+ AnyTypeCode/PortableInterceptorA.cpp
+ AnyTypeCode/Sequence_TypeCode_Static.cpp
+ AnyTypeCode/ShortSeqA.cpp
+ AnyTypeCode/skip.cpp
+ AnyTypeCode/StringSeqA.cpp
+ AnyTypeCode/String_TypeCode_Static.cpp
+ AnyTypeCode/Struct_TypeCode_Static.cpp
+ AnyTypeCode/SystemExceptionA.cpp
+ AnyTypeCode/TAOA.cpp
+ AnyTypeCode/TimeBaseA.cpp
+ AnyTypeCode/True_RefCount_Policy.cpp
+ AnyTypeCode/TypeCode.cpp
+ AnyTypeCode/TypeCodeA.cpp
+ AnyTypeCode/TypeCode_CDR_Extraction.cpp
+ AnyTypeCode/TypeCode_Constants.cpp
+ AnyTypeCode/ULongLongSeqA.cpp
+ AnyTypeCode/ULongSeqA.cpp
+ AnyTypeCode/Union_TypeCode_Static.cpp
+ AnyTypeCode/UShortSeqA.cpp
+ AnyTypeCode/Value_TypeCode_Static.cpp
+ AnyTypeCode/ValueModifierC.cpp
+ AnyTypeCode/ValueModifierA.cpp
+ AnyTypeCode/VisibilityA.cpp
+ AnyTypeCode/VisibilityC.cpp
+ AnyTypeCode/WCharSeqA.cpp
+ AnyTypeCode/WrongTransactionA.cpp
+ AnyTypeCode/WStringSeqA.cpp
+ }
+
+ Header_Files {
+ AnyTypeCode/*.h
+ }
+
+ Inline_Files {
+ AnyTypeCode/*.inl
+ }
+
+ Template_Files {
+ AnyTypeCode/*_T.cpp
+ AnyTypeCode/Alias_TypeCode.cpp
+ AnyTypeCode/Enum_TypeCode.cpp
+ AnyTypeCode/Fixed_TypeCode.cpp
+ AnyTypeCode/Objref_TypeCode.cpp
+ AnyTypeCode/Recursive_Type_TypeCode.cpp
+ AnyTypeCode/Sequence_TypeCode.cpp
+ AnyTypeCode/String_TypeCode.cpp
+ AnyTypeCode/Struct_TypeCode.cpp
+ AnyTypeCode/TypeCode_Base_Attributes.cpp
+ AnyTypeCode/Union_TypeCode.cpp
+ AnyTypeCode/Value_TypeCode.cpp
+ }
+
+ Resource_Files {
+ AnyTypeCode
+ }
+
+ PIDL_Files {
+ }
+
+ IDL_Files {
+ idlflags += -Gp -Gd -Sci -SS -Sorb -GA -Ge 1 \
+ -Wb,export_macro=TAO_AnyTypeCode_Export \
+ -Wb,export_include=tao/AnyTypeCode/TAO_AnyTypeCode_Export.h \
+ -o AnyTypeCode
+ idlflags -= -Sa -St
+ AnyTypeCode/AnySeq.pidl
+ AnyTypeCode/Dynamic_Parameter.pidl
+ AnyTypeCode/ValueModifier.pidl
+ AnyTypeCode/Visibility.pidl
+ }
+
+ IDL_Files {
+ idlflags += -Gp -Gd -Sci -SS -GA -Ge 1 \
+ -Wb,export_macro=TAO_AnyTypeCode_Export \
+ -Wb,export_include=tao/AnyTypeCode/TAO_AnyTypeCode_Export.h \
+ -o AnyTypeCode
+ idlflags -= -Sa -St
+ AnyTypeCode/Bounds.pidl
+ }
+
+ Pkgconfig_Files {
+ AnyTypeCode/TAO_AnyTypeCode.pc.in
+ }
+}
diff --git a/TAO/tao/AnyTypeCode/Alias_TypeCode.cpp b/TAO/tao/AnyTypeCode/Alias_TypeCode.cpp
new file mode 100644
index 00000000000..d968f65b205
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Alias_TypeCode.cpp
@@ -0,0 +1,204 @@
+// $Id$
+
+#ifndef TAO_ALIAS_TYPECODE_CPP
+#define TAO_ALIAS_TYPECODE_CPP
+
+#include "tao/AnyTypeCode/Alias_TypeCode.h"
+
+#ifndef __ACE_INLINE__
+# include "tao/AnyTypeCode/Alias_TypeCode.inl"
+#endif /* !__ACE_INLINE__ */
+
+#include "tao/ORB_Core.h"
+#include "tao/CDR.h"
+#include "tao/AnyTypeCode/TypeCode_Traits.h"
+
+#include "ace/Dynamic_Service.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template <typename StringType,
+ typename TypeCodeType,
+ class RefCountPolicy>
+bool
+TAO::TypeCode::Alias<StringType,
+ TypeCodeType,
+ RefCountPolicy>::tao_marshal (TAO_OutputCDR & cdr,
+ CORBA::ULong offset) const
+{
+ // A tk_alias TypeCode has a "complex" parameter list type (see
+ // Table 15-2 in Section 15.3.5.1 "TypeCode" in the CDR section of
+ // the CORBA specification), meaning that it must be marshaled into
+ // a CDR encapsulation.
+
+ // Create a CDR encapsulation.
+
+ TAO_OutputCDR enc;
+
+ // Account for the encoded CDR encapsulation length and byte order.
+ //
+ // Aligning on an octet since the next value after the CDR
+ // encapsulation length will always be the byte order octet/boolean
+ // in this case.
+ offset = ACE_align_binary (offset + 4,
+ ACE_CDR::OCTET_ALIGN);
+
+ return
+ enc << TAO_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER)
+ && enc << TAO_OutputCDR::from_string (this->attributes_.id (), 0)
+ && enc << TAO_OutputCDR::from_string (this->attributes_.name (), 0)
+ && marshal (enc,
+ Traits<StringType>::get_typecode (this->content_type_),
+ offset + enc.total_length ())
+ && cdr << static_cast<CORBA::ULong> (enc.total_length ())
+ && cdr.write_octet_array_mb (enc.begin ());
+}
+
+template<typename StringType,
+ typename TypeCodeType,
+ class RefCountPolicy>
+void
+TAO::TypeCode::Alias<StringType,
+ TypeCodeType,
+ RefCountPolicy>::tao_duplicate (void)
+{
+ this->RefCountPolicy::add_ref ();
+}
+
+template<typename StringType,
+ typename TypeCodeType,
+ class RefCountPolicy>
+void
+TAO::TypeCode::Alias<StringType,
+ TypeCodeType,
+ RefCountPolicy>::tao_release (void)
+{
+ this->RefCountPolicy::remove_ref ();
+}
+
+template<typename StringType,
+ typename TypeCodeType,
+ class RefCountPolicy>
+CORBA::Boolean
+TAO::TypeCode::Alias<StringType,
+ TypeCodeType,
+ RefCountPolicy>::equal_i (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const
+{
+ // The CORBA::TypeCode base class already verified equality of the
+ // base attributes (id and name). Perform an equality comparison of
+ // the content.
+
+ CORBA::TypeCode_var rhs_content_type =
+ tc->content_type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ return
+ Traits<StringType>::get_typecode (this->content_type_)->equal (
+ rhs_content_type.in ()
+ ACE_ENV_ARG_PARAMETER);
+}
+
+template<typename StringType,
+ typename TypeCodeType,
+ class RefCountPolicy>
+CORBA::Boolean
+TAO::TypeCode::Alias<StringType,
+ TypeCodeType,
+ RefCountPolicy>::equivalent_i (
+ CORBA::TypeCode_ptr
+ ACE_ENV_ARG_DECL_NOT_USED) const
+{
+ // Equivalence already verified in the base class
+ // CORBA::TypeCode::equivalent() method.
+
+ return true;
+}
+
+template<typename StringType,
+ typename TypeCodeType,
+ class RefCountPolicy>
+CORBA::TypeCode_ptr
+TAO::TypeCode::Alias<StringType,
+ TypeCodeType,
+ RefCountPolicy>::get_compact_typecode_i (
+ ACE_ENV_SINGLE_ARG_DECL) const
+{
+ TAO_TypeCodeFactory_Adapter * const adapter =
+ ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance (
+ TAO_ORB_Core::typecodefactory_adapter_name ()
+ );
+
+ if (adapter == 0)
+ {
+ ACE_THROW_RETURN (CORBA::INITIALIZE (),
+ CORBA::TypeCode::_nil ());
+ }
+
+ CORBA::TypeCode_var compact_content_type =
+ Traits<StringType>::get_typecode (
+ this->content_type_)->get_compact_typecode (
+ ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::TypeCode::_nil ());
+
+ if (this->kind_ == CORBA::tk_alias)
+ {
+ return adapter->create_alias_tc (this->attributes_.id (),
+ "", /* empty name */
+ compact_content_type.in ()
+ ACE_ENV_ARG_PARAMETER);
+ }
+ else
+ {
+ return adapter->create_value_box_tc (this->attributes_.id (),
+ "", /* empty name */
+ compact_content_type.in ()
+ ACE_ENV_ARG_PARAMETER);
+ }
+}
+
+template<typename StringType,
+ typename TypeCodeType,
+ class RefCountPolicy>
+char const *
+TAO::TypeCode::Alias<StringType,
+ TypeCodeType,
+ RefCountPolicy>::id_i (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED) const
+{
+ // Ownership is retained by the TypeCode, as required by the C++
+ // mapping.
+ return this->attributes_.id ();
+}
+
+template<typename StringType,
+ typename TypeCodeType,
+ class RefCountPolicy>
+char const *
+TAO::TypeCode::Alias<StringType,
+ TypeCodeType,
+ RefCountPolicy>::name_i (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED) const
+{
+ // Ownership is retained by the TypeCode, as required by the C++
+ // mapping.
+ return this->attributes_.name ();
+}
+
+template<typename StringType,
+ typename TypeCodeType,
+ class RefCountPolicy>
+CORBA::TypeCode_ptr
+TAO::TypeCode::Alias<StringType,
+ TypeCodeType,
+ RefCountPolicy>::content_type_i (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED) const
+{
+ return
+ CORBA::TypeCode::_duplicate (
+ Traits<StringType>::get_typecode (this->content_type_));
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_ALIAS_TYPECODE_CPP */
diff --git a/TAO/tao/AnyTypeCode/Alias_TypeCode.h b/TAO/tao/AnyTypeCode/Alias_TypeCode.h
new file mode 100644
index 00000000000..201f3f001fc
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Alias_TypeCode.h
@@ -0,0 +1,144 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Alias_TypeCode.h
+ *
+ * $Id$
+ *
+ * Header file for a @c tk_alias and @c tk_value_box
+ * @c CORBA::TypeCode.
+ *
+ * @author Ossama Othman <ossama@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_ALIAS_TYPECODE_H
+#define TAO_ALIAS_TYPECODE_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/AnyTypeCode/TypeCode.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/TypeCodeFactory_Adapter.h"
+#include "tao/AnyTypeCode/TypeCode_Base_Attributes.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace TypeCode
+ {
+ /**
+ * @class Alias
+ *
+ * @brief @c CORBA::TypeCode implementation for an OMG IDL
+ * @c typedef.
+ *
+ * This class implements a @c CORBA::TypeCode for an OMG IDL
+ * @c typedef.
+ */
+ template <typename StringType,
+ typename TypeCodeType,
+ class RefCountPolicy>
+ class Alias
+ : public CORBA::TypeCode,
+ private RefCountPolicy
+ {
+ public:
+
+ /// Constructor.
+ Alias (CORBA::TCKind kind,
+ char const * id,
+ char const * name,
+#if defined (__BORLANDC__) && (__BORLANDC__ < 0x572)
+ // Borland C++ currently can't handle a reference to
+ // const pointer to const CORBA::TypeCode_ptr
+ TypeCodeType tc);
+#else
+ TypeCodeType const & tc);
+#endif
+
+ /**
+ * @name TAO-specific @c CORBA::TypeCode Methods
+ *
+ * Methods required by TAO's implementation of the
+ * @c CORBA::TypeCode class.
+ *
+ * @see @c CORBA::TypeCode
+ */
+ //@{
+ virtual bool tao_marshal (TAO_OutputCDR & cdr,
+ CORBA::ULong offset) const;
+ virtual void tao_duplicate (void);
+ virtual void tao_release (void);
+ //@}
+
+ protected:
+
+ /**
+ * @name @c TAO CORBA::TypeCode Template Methods
+ *
+ * @c tk_alias and @c tk_value_box @c CORBA::TypeCode -specific
+ * template methods.
+ *
+ * @see @c CORBA::TypeCode
+ */
+ //@{
+ virtual CORBA::Boolean equal_i (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const;
+ virtual CORBA::Boolean equivalent_i (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const;
+ virtual CORBA::TypeCode_ptr get_compact_typecode_i (
+ ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual char const * id_i (ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual char const * name_i (ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual CORBA::TypeCode_ptr content_type_i (ACE_ENV_SINGLE_ARG_DECL) const;
+
+ private:
+
+ /// Base attributes for this @c TypeCode containing the
+ /// repository ID and name of the @c typedef.
+ Base_Attributes<StringType> attributes_;
+
+ /// The @c TypeCode corresponding to the original type upon
+ /// which the IDL @c typedef was made.
+ /**
+ * A pointer to the @c CORBA::TypeCode_ptr rather than the
+ * @c CORBA::TypeCode_ptr itself is stored since that address is
+ * well-defined. We may not know the value of the @c
+ * CORBA::TypeCode_ptr when creating this @c Field statically at
+ * compile-time, hence the indirection.
+ *
+ * @note This @c TypeCode is released upon destruction of this
+ * @c TypeCode::Alias.
+ */
+ TypeCodeType const content_type_;
+
+ };
+
+ } // End namespace TypeCode
+} // End namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+
+#ifdef __ACE_INLINE__
+# include "tao/AnyTypeCode/Alias_TypeCode.inl"
+#endif /* __ACE_INLINE__ */
+
+#ifdef ACE_TEMPLATES_REQUIRE_SOURCE
+# include "tao/AnyTypeCode/Alias_TypeCode.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#ifdef ACE_TEMPLATES_REQUIRE_PRAGMA
+# pragma implementation ("Alias_TypeCode.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_ALIAS_TYPECODE_H */
diff --git a/TAO/tao/AnyTypeCode/Alias_TypeCode.inl b/TAO/tao/AnyTypeCode/Alias_TypeCode.inl
new file mode 100644
index 00000000000..d781ee5641f
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Alias_TypeCode.inl
@@ -0,0 +1,31 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template<typename StringType,
+ typename TypeCodeType,
+ class RefCountPolicy>
+ACE_INLINE
+TAO::TypeCode::Alias<StringType,
+ TypeCodeType,
+ RefCountPolicy>::Alias (
+ CORBA::TCKind kind,
+ char const * id,
+ char const * name,
+#if defined (__BORLANDC__) && (__BORLANDC__ < 0x572)
+ // Borland C++ currently can't handle a reference to
+ // const pointer to const CORBA::TypeCode_ptr
+ TypeCodeType tc)
+#else
+ TypeCodeType const & tc)
+#endif
+ : ::CORBA::TypeCode (kind)
+ , RefCountPolicy ()
+ , attributes_ (id, name)
+ , content_type_ (tc)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/AnyTypeCode/Alias_TypeCode_Static.cpp b/TAO/tao/AnyTypeCode/Alias_TypeCode_Static.cpp
new file mode 100644
index 00000000000..c3c9e26c1a6
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Alias_TypeCode_Static.cpp
@@ -0,0 +1,178 @@
+// $Id$
+
+#include "tao/AnyTypeCode/Alias_TypeCode_Static.h"
+
+#ifndef __ACE_INLINE__
+# include "tao/AnyTypeCode/Alias_TypeCode_Static.inl"
+#endif /* !__ACE_INLINE__ */
+
+#include "tao/AnyTypeCode/TypeCode_Traits.h"
+
+#include "tao/ORB_Core.h"
+#include "tao/CDR.h"
+#include "tao/TypeCodeFactory_Adapter.h"
+
+#include "ace/Dynamic_Service.h"
+
+
+ACE_RCSID (AnyTypeCode,
+ Alias_TypeCode_Static,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+bool
+TAO::TypeCode::Alias<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::Null_RefCount_Policy>::tao_marshal (
+ TAO_OutputCDR & cdr,
+ CORBA::ULong offset) const
+{
+ // A tk_alias TypeCode has a "complex" parameter list type (see
+ // Table 15-2 in Section 15.3.5.1 "TypeCode" in the CDR section of
+ // the CORBA specification), meaning that it must be marshaled into
+ // a CDR encapsulation.
+
+ // Create a CDR encapsulation.
+
+ TAO_OutputCDR enc;
+
+ // Account for the encoded CDR encapsulation length and byte order.
+ //
+ // Aligning on an octet since the next value after the CDR
+ // encapsulation length will always be the byte order octet/boolean
+ // in this case.
+ offset = ACE_align_binary (offset + 4,
+ ACE_CDR::OCTET_ALIGN);
+
+ return
+ enc << TAO_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER)
+ && enc << TAO_OutputCDR::from_string (this->attributes_.id (), 0)
+ && enc << TAO_OutputCDR::from_string (this->attributes_.name (), 0)
+ && marshal (enc,
+ Traits<char const *>::get_typecode (this->content_type_),
+ offset + enc.total_length ())
+ && cdr << static_cast<CORBA::ULong> (enc.total_length ())
+ && cdr.write_octet_array_mb (enc.begin ());
+}
+
+void
+TAO::TypeCode::Alias<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::Null_RefCount_Policy>::tao_duplicate (void)
+{
+}
+
+void
+TAO::TypeCode::Alias<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::Null_RefCount_Policy>::tao_release (void)
+{
+}
+
+CORBA::Boolean
+TAO::TypeCode::Alias<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::Null_RefCount_Policy>::equal_i (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const
+{
+ // The CORBA::TypeCode base class already verified equality of the
+ // base attributes (id and name). Perform an equality comparison of
+ // the content.
+
+ CORBA::TypeCode_var rhs_content_type =
+ tc->content_type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ return
+ Traits<char const *>::get_typecode (this->content_type_)->equal (
+ rhs_content_type.in ()
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::Boolean
+TAO::TypeCode::Alias<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::Null_RefCount_Policy>::equivalent_i (
+ CORBA::TypeCode_ptr
+ ACE_ENV_ARG_DECL_NOT_USED) const
+{
+ // Equivalence already verified in the base class
+ // CORBA::TypeCode::equivalent() method.
+
+ return true;
+}
+
+CORBA::TypeCode_ptr
+TAO::TypeCode::Alias<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::Null_RefCount_Policy>::get_compact_typecode_i (
+ ACE_ENV_SINGLE_ARG_DECL) const
+{
+ TAO_TypeCodeFactory_Adapter * const adapter =
+ ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance (
+ TAO_ORB_Core::typecodefactory_adapter_name ()
+ );
+
+ if (adapter == 0)
+ {
+ ACE_THROW_RETURN (CORBA::INITIALIZE (),
+ CORBA::TypeCode::_nil ());
+ }
+
+ CORBA::TypeCode_var compact_content_type =
+ Traits<char const *>::get_typecode (
+ this->content_type_)->get_compact_typecode (
+ ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::TypeCode::_nil ());
+
+ if (this->kind_ == CORBA::tk_alias)
+ {
+ return adapter->create_alias_tc (this->attributes_.id (),
+ "", /* empty name */
+ compact_content_type.in ()
+ ACE_ENV_ARG_PARAMETER);
+ }
+ else
+ {
+ return adapter->create_value_box_tc (this->attributes_.id (),
+ "", /* empty name */
+ compact_content_type.in ()
+ ACE_ENV_ARG_PARAMETER);
+ }
+}
+
+char const *
+TAO::TypeCode::Alias<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::Null_RefCount_Policy>::id_i (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED) const
+{
+ // Ownership is retained by the TypeCode, as required by the C++
+ // mapping.
+ return this->attributes_.id ();
+}
+
+char const *
+TAO::TypeCode::Alias<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::Null_RefCount_Policy>::name_i (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED) const
+{
+ // Ownership is retained by the TypeCode, as required by the C++
+ // mapping.
+ return this->attributes_.name ();
+}
+
+CORBA::TypeCode_ptr
+TAO::TypeCode::Alias<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::Null_RefCount_Policy>::content_type_i (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED) const
+{
+ return
+ CORBA::TypeCode::_duplicate (
+ Traits<char const *>::get_typecode (this->content_type_));
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/AnyTypeCode/Alias_TypeCode_Static.h b/TAO/tao/AnyTypeCode/Alias_TypeCode_Static.h
new file mode 100644
index 00000000000..ce78541df83
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Alias_TypeCode_Static.h
@@ -0,0 +1,134 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Alias_TypeCode_Static.h
+ *
+ * $Id$
+ *
+ * Header file for a static @c tk_alias and @c tk_value_box
+ * @c CORBA::TypeCode.
+ *
+ * @author Ossama Othman <ossama@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_ALIAS_TYPECODE_STATIC_H
+#define TAO_ALIAS_TYPECODE_STATIC_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/AnyTypeCode/TypeCode.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/AnyTypeCode/TypeCode_Base_Attributes.h"
+#include "tao/AnyTypeCode/Null_RefCount_Policy.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace TypeCode
+ {
+ template <typename StringType,
+ typename TypeCodeType,
+ class RefCountPolicy> class Alias;
+
+ /**
+ * @class Alias
+ *
+ * @brief @c CORBA::TypeCode implementation for an OMG IDL
+ * @c typedef.
+ *
+ * This class implements a @c CORBA::TypeCode for an OMG IDL
+ * @c typedef.
+ */
+ template<>
+ class TAO_AnyTypeCode_Export Alias<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::Null_RefCount_Policy>
+ : public CORBA::TypeCode,
+ private TAO::Null_RefCount_Policy
+ {
+ public:
+
+ /// Constructor.
+ Alias (CORBA::TCKind kind,
+ char const * id,
+ char const * name,
+ CORBA::TypeCode_ptr const * tc);
+
+ /**
+ * @name TAO-specific @c CORBA::TypeCode Methods
+ *
+ * Methods required by TAO's implementation of the
+ * @c CORBA::TypeCode class.
+ *
+ * @see @c CORBA::TypeCode
+ */
+ //@{
+ virtual bool tao_marshal (TAO_OutputCDR & cdr,
+ CORBA::ULong offset) const;
+ virtual void tao_duplicate (void);
+ virtual void tao_release (void);
+ //@}
+
+ protected:
+
+ /**
+ * @name @c TAO CORBA::TypeCode Template Methods
+ *
+ * @c tk_alias and @c tk_value_box @c CORBA::TypeCode -specific
+ * template methods.
+ *
+ * @see @c CORBA::TypeCode
+ */
+ //@{
+ virtual CORBA::Boolean equal_i (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const;
+ virtual CORBA::Boolean equivalent_i (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const;
+ virtual CORBA::TypeCode_ptr get_compact_typecode_i (
+ ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual char const * id_i (ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual char const * name_i (ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual CORBA::TypeCode_ptr content_type_i (ACE_ENV_SINGLE_ARG_DECL) const;
+
+ private:
+
+ /// Base attributes for this @c TypeCode containing the
+ /// repository ID and name of the @c typedef.
+ Base_Attributes<char const *> attributes_;
+
+ /// The @c TypeCode corresponding to the original type upon
+ /// which the IDL @c typedef was made.
+ /**
+ * A pointer to the @c CORBA::TypeCode_ptr rather than the
+ * @c CORBA::TypeCode_ptr itself is stored since that address is
+ * well-defined. We may not know the value of the @c
+ * CORBA::TypeCode_ptr when creating this @c Field statically at
+ * compile-time, hence the indirection.
+ *
+ * @note This @c TypeCode is released upon destruction of this
+ * @c TypeCode::Alias.
+ */
+ CORBA::TypeCode_ptr const * content_type_;
+
+ };
+
+ } // End namespace TypeCode
+} // End namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+
+#ifdef __ACE_INLINE__
+# include "tao/AnyTypeCode/Alias_TypeCode_Static.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_ALIAS_TYPECODE_STATIC_H */
diff --git a/TAO/tao/AnyTypeCode/Alias_TypeCode_Static.inl b/TAO/tao/AnyTypeCode/Alias_TypeCode_Static.inl
new file mode 100644
index 00000000000..0f077af6689
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Alias_TypeCode_Static.inl
@@ -0,0 +1,22 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO::TypeCode::Alias<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::Null_RefCount_Policy>::Alias (
+ CORBA::TCKind kind,
+ char const * id,
+ char const * name,
+ CORBA::TypeCode_ptr const * tc)
+ : ::CORBA::TypeCode (kind)
+ , ::TAO::Null_RefCount_Policy ()
+ , attributes_ (id, name)
+ , content_type_ (tc)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/AnyTypeCode/Any.cpp b/TAO/tao/AnyTypeCode/Any.cpp
new file mode 100644
index 00000000000..19a025db41e
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Any.cpp
@@ -0,0 +1,774 @@
+// $Id$
+
+#include "tao/AnyTypeCode/Any.h"
+#include "tao/AnyTypeCode/Any_Basic_Impl.h"
+#include "tao/AnyTypeCode/Any_Impl_T.h"
+#include "tao/AnyTypeCode/Any_Special_Impl_T.h"
+#include "tao/AnyTypeCode/Any_Dual_Impl_T.h"
+#include "tao/AnyTypeCode/Any_Unknown_IDL_Type.h"
+#include "tao/AnyTypeCode/TypeCode.h"
+#include "tao/AnyTypeCode/TypeCode_Constants.h"
+#include "tao/SystemException.h"
+#include "tao/CDR.h"
+
+#include "ace/Log_Msg.h"
+#include "ace/OS_NS_string.h"
+#include "ace/OS_NS_wchar.h"
+#include "ace/OS_Memory.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/AnyTypeCode/Any.inl"
+#endif /* ! __ACE_INLINE__ */
+
+ACE_RCSID (AnyTypeCode,
+ Any,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+using namespace TAO;
+
+CORBA::Any::Any (void)
+ : impl_ (0)
+{
+}
+
+CORBA::Any::Any (const CORBA::Any &rhs)
+ : impl_ (rhs.impl_)
+{
+ if (this->impl_ != 0)
+ {
+ this->impl_->_add_ref ();
+ }
+}
+
+CORBA::Any::~Any (void)
+{
+ if (this->impl_ != 0)
+ {
+ this->impl_->_remove_ref ();
+ }
+}
+
+CORBA::Any &
+CORBA::Any::operator= (const CORBA::Any &rhs)
+{
+ if (this->impl_ != rhs.impl_)
+ {
+ if (this->impl_ != 0)
+ {
+ this->impl_->_remove_ref ();
+ }
+
+ this->impl_ = rhs.impl_;
+
+ if (this->impl_ != 0)
+ {
+ this->impl_->_add_ref ();
+ }
+ }
+
+ return *this;
+}
+
+void
+CORBA::Any::replace (TAO::Any_Impl *new_impl)
+{
+ ACE_ASSERT (new_impl != 0);
+
+ if (this->impl_ != 0)
+ {
+ this->impl_->_remove_ref ();
+ }
+
+ this->impl_ = new_impl;
+}
+
+CORBA::TypeCode_ptr
+CORBA::Any::type (void) const
+{
+ if (this->impl_ != 0)
+ {
+ return this->impl_->type ();
+ }
+
+ return CORBA::TypeCode::_duplicate (CORBA::_tc_null);
+}
+
+CORBA::TypeCode_ptr
+CORBA::Any::_tao_get_typecode (void) const
+{
+ if (this->impl_ != 0)
+ {
+ return this->impl_->_tao_get_typecode ();
+ }
+
+ return CORBA::_tc_null;
+}
+
+void
+CORBA::Any::_tao_set_typecode (const CORBA::TypeCode_ptr tc)
+{
+ if (this->impl_ == 0)
+ {
+ ACE_NEW (this->impl_,
+ TAO::Unknown_IDL_Type (tc));
+ }
+ else
+ {
+ this->impl_->type (tc);
+ }
+}
+
+int
+CORBA::Any::_tao_byte_order (void) const
+{
+ if (this->impl_ != 0)
+ {
+ return this->impl_->_tao_byte_order ();
+ }
+
+ return TAO_ENCAP_BYTE_ORDER;
+}
+
+void
+CORBA::Any::type (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL)
+{
+ CORBA::Boolean equiv = false;
+
+ if (this->impl_ != 0)
+ {
+ equiv =
+ this->impl_->_tao_get_typecode ()->equivalent (tc
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ if (equiv)
+ {
+ this->impl_->type (tc);
+ }
+ else
+ {
+ ACE_THROW (CORBA::BAD_TYPECODE ());
+ }
+}
+
+void
+CORBA::Any::_tao_any_destructor (void *x)
+{
+ CORBA::Any *tmp = static_cast<CORBA::Any *> (x);
+ delete tmp;
+}
+
+CORBA::Any::to_object::to_object (CORBA::Object_out obj)
+ : ref_ (obj.ptr ())
+{
+}
+
+CORBA::Any::to_abstract_base::to_abstract_base (CORBA::AbstractBase_ptr &obj)
+ : ref_ (obj)
+{
+}
+
+CORBA::Any::to_value::to_value (CORBA::ValueBase *& obj)
+ : ref_ (obj)
+{
+}
+
+CORBA::Boolean
+CORBA::Any::checked_to_object (CORBA::Object_ptr &_tao_elem) const
+{
+ if (this->impl_ == 0)
+ {
+ return 0;
+ }
+
+ return this->impl_->to_object (_tao_elem);
+}
+
+CORBA::Boolean
+CORBA::Any::checked_to_value (CORBA::ValueBase *&_tao_elem) const
+{
+ if (this->impl_ == 0)
+ {
+ return false;
+ }
+
+ return this->impl_->to_value (_tao_elem);
+}
+
+CORBA::Boolean
+CORBA::Any::checked_to_abstract_base (
+ CORBA::AbstractBase_ptr &_tao_elem
+ ) const
+{
+ if (this->impl_ == 0)
+ {
+ return false;
+ }
+
+ return this->impl_->to_abstract_base (_tao_elem);
+}
+
+// ****************************************************************
+
+CORBA::Any_var::Any_var (const CORBA::Any_var &r)
+ : ptr_ (0)
+{
+ if (r.ptr_ != 0)
+ {
+ ACE_NEW (this->ptr_,
+ CORBA::Any (*r.ptr_));
+ }
+}
+
+CORBA::Any_var &
+CORBA::Any_var::operator= (CORBA::Any *p)
+{
+ if (this->ptr_ != p)
+ {
+ delete this->ptr_;
+ this->ptr_ = p;
+ }
+
+ return *this;
+}
+
+CORBA::Any_var &
+CORBA::Any_var::operator= (const CORBA::Any_var &r)
+{
+ delete this->ptr_;
+ this->ptr_ = 0;
+
+ if (r.ptr_ != 0)
+ {
+ ACE_NEW_RETURN (this->ptr_,
+ CORBA::Any (*r.ptr_),
+ *this);
+ }
+
+ return *this;
+}
+
+// ***********************************************************************
+
+CORBA::Boolean
+operator<< (TAO_OutputCDR &cdr, const CORBA::Any &any)
+{
+ TAO::Any_Impl *impl = any.impl ();
+
+ if (impl != 0)
+ {
+ return impl->marshal (cdr);
+ }
+
+ return (cdr << CORBA::_tc_null);
+}
+
+CORBA::Boolean
+operator>> (TAO_InputCDR &cdr, CORBA::Any &any)
+{
+ CORBA::TypeCode_var tc;
+
+ if ((cdr >> tc.out ()) == 0)
+ {
+ return false;
+ }
+
+ ACE_TRY_NEW_ENV
+ {
+ TAO::Unknown_IDL_Type *impl = 0;
+ ACE_NEW_RETURN (impl,
+ TAO::Unknown_IDL_Type (tc.in ()),
+ false);
+
+ any.replace (impl);
+ impl->_tao_decode (cdr
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCH (CORBA::Exception, ex)
+ {
+ return false;
+ }
+ ACE_ENDTRY;
+
+ return true;
+}
+
+// =======================================================================
+
+// Insertion of the special basic types.
+
+void
+CORBA::Any::operator<<= (CORBA::Any::from_boolean b)
+{
+ TAO::Any_Basic_Impl::insert (*this,
+ CORBA::_tc_boolean,
+ &b.val_);
+}
+
+void
+CORBA::Any::operator<<= (CORBA::Any::from_octet o)
+{
+ TAO::Any_Basic_Impl::insert (*this,
+ CORBA::_tc_octet,
+ &o.val_);
+}
+
+void
+CORBA::Any::operator<<= (CORBA::Any::from_char c)
+{
+ TAO::Any_Basic_Impl::insert (*this,
+ CORBA::_tc_char,
+ &c.val_);
+}
+
+void
+CORBA::Any::operator<<= (CORBA::Any::from_wchar wc)
+{
+ TAO::Any_Basic_Impl::insert (*this,
+ CORBA::_tc_wchar,
+ &wc.val_);
+}
+
+void
+CORBA::Any::operator<<= (CORBA::Any::from_string s)
+{
+ if (s.bound_ > 0 && s.val_ != 0 && ACE_OS::strlen (s.val_) > s.bound_)
+ {
+ return;
+ }
+
+ TAO::Any_Special_Impl_T<
+ char,
+ CORBA::Any::from_string,
+ CORBA::Any::to_string
+ >::insert (*this,
+ TAO::Any_Impl::_tao_any_string_destructor,
+ CORBA::_tc_string,
+ s.nocopy_ ? s.val_ : CORBA::string_dup (s.val_),
+ s.bound_);
+}
+
+void
+CORBA::Any::operator<<= (CORBA::Any::from_wstring ws)
+{
+ if (ws.bound_ > 0 && ws.val_ != 0 && ACE_OS::wslen (ws.val_) > ws.bound_)
+ {
+ return;
+ }
+
+ TAO::Any_Special_Impl_T<
+ CORBA::WChar,
+ CORBA::Any::from_wstring,
+ CORBA::Any::to_wstring
+ >::insert (*this,
+ TAO::Any_Impl::_tao_any_wstring_destructor,
+ CORBA::_tc_wstring,
+ ws.nocopy_ ? ws.val_ : CORBA::wstring_dup (ws.val_),
+ ws.bound_);
+}
+
+// Insertion of the other basic types.
+
+void
+operator<<= (CORBA::Any &any, CORBA::Short s)
+{
+ TAO::Any_Basic_Impl::insert (any,
+ CORBA::_tc_short,
+ &s);
+}
+
+void
+operator<<= (CORBA::Any &any, CORBA::UShort us)
+{
+ TAO::Any_Basic_Impl::insert (any,
+ CORBA::_tc_ushort,
+ &us);
+}
+
+void
+operator<<= (CORBA::Any &any, CORBA::Long l)
+{
+ TAO::Any_Basic_Impl::insert (any,
+ CORBA::_tc_long,
+ &l);
+}
+
+void
+operator<<= (CORBA::Any &any, CORBA::ULong ul)
+{
+ TAO::Any_Basic_Impl::insert (any,
+ CORBA::_tc_ulong,
+ &ul);
+}
+
+void
+operator<<= (CORBA::Any &any, CORBA::LongLong ll)
+{
+ TAO::Any_Basic_Impl::insert (any,
+ CORBA::_tc_longlong,
+ &ll);
+}
+
+void
+operator<<= (CORBA::Any &any, CORBA::ULongLong ull)
+{
+ TAO::Any_Basic_Impl::insert (any,
+ CORBA::_tc_ulonglong,
+ &ull);
+}
+
+void
+operator<<= (CORBA::Any &any, CORBA::Float f)
+{
+ TAO::Any_Basic_Impl::insert (any,
+ CORBA::_tc_float,
+ &f);
+}
+
+void
+operator<<= (CORBA::Any &any, CORBA::Double d)
+{
+ TAO::Any_Basic_Impl::insert (any,
+ CORBA::_tc_double,
+ &d);
+}
+
+void
+operator<<= (CORBA::Any &any, CORBA::LongDouble ld)
+{
+ TAO::Any_Basic_Impl::insert (any,
+ CORBA::_tc_longdouble,
+ &ld);
+}
+
+// Insertion of Any - copying.
+void
+operator<<= (CORBA::Any &any, const CORBA::Any &a)
+{
+ if (0 == &a) // Trying to de-reference NULL Any
+ any <<= static_cast<CORBA::Any *>( 0 ); // Use non-copying insertion of a NULL
+ else
+ TAO::Any_Dual_Impl_T<CORBA::Any>::insert_copy (
+ any,
+ CORBA::Any::_tao_any_destructor,
+ CORBA::_tc_any,
+ a
+ );
+}
+
+// Insertion of Any - non-copying.
+void
+operator<<= (CORBA::Any &any, CORBA::Any *a)
+{
+ TAO::Any_Dual_Impl_T<CORBA::Any>::insert (any,
+ CORBA::Any::_tao_any_destructor,
+ CORBA::_tc_any,
+ a);
+}
+
+// Insertion of TypeCode - copying.
+void
+operator<<= (CORBA::Any &any, CORBA::TypeCode_ptr tc)
+{
+ CORBA::TypeCode_ptr dup = CORBA::TypeCode::_duplicate (tc);
+ any <<= &dup;
+}
+
+// Insertion of TypeCode - non-copying.
+void
+operator<<= (CORBA::Any &any, CORBA::TypeCode_ptr * tc)
+{
+ TAO::Any_Impl_T<CORBA::TypeCode>::insert (
+ any,
+ CORBA::TypeCode::_tao_any_destructor,
+ CORBA::_tc_TypeCode,
+ *tc
+ );
+}
+
+// Insertion of CORBA object - copying.
+void
+operator<<= (CORBA::Any &any, const CORBA::Object_ptr obj)
+{
+ CORBA::Object_ptr dup = CORBA::Object::_duplicate (obj);
+ any <<= &dup;
+}
+
+// Insertion of CORBA object - non-copying.
+void
+operator<<= (CORBA::Any &any, CORBA::Object_ptr *objptr)
+{
+ TAO::Any_Impl_T<CORBA::Object>::insert (any,
+ CORBA::Object::_tao_any_destructor,
+ CORBA::_tc_Object,
+ *objptr);
+}
+
+// These are copying versions for unbounded (w)strings. They are not inlined,
+// to avoid use in Any.i before definition in ORB.i.
+
+void
+operator<<= (CORBA::Any &any, const char *s)
+{
+ TAO::Any_Special_Impl_T<
+ char,
+ CORBA::Any::from_string,
+ CORBA::Any::to_string
+ >::insert (any,
+ TAO::Any_Impl::_tao_any_string_destructor,
+ CORBA::_tc_string,
+ CORBA::string_dup (s),
+ 0);
+}
+
+void
+operator<<= (CORBA::Any &any, const CORBA::WChar *ws)
+{
+ TAO::Any_Special_Impl_T<
+ CORBA::WChar,
+ CORBA::Any::from_wstring,
+ CORBA::Any::to_wstring
+ >::insert (any,
+ TAO::Any_Impl::_tao_any_wstring_destructor,
+ CORBA::_tc_wstring,
+ CORBA::wstring_dup (ws),
+ 0);
+}
+
+// Extraction: these are safe and hence we have to check that the
+// typecode of the Any is equal to the one we are trying to extract
+// into.
+
+// Extraction into the special basic types.
+
+CORBA::Boolean
+CORBA::Any::operator>>= (CORBA::Any::to_boolean b) const
+{
+ return TAO::Any_Basic_Impl::extract (*this,
+ CORBA::_tc_boolean,
+ &b.ref_);
+}
+
+CORBA::Boolean
+CORBA::Any::operator>>= (CORBA::Any::to_octet o) const
+{
+ return TAO::Any_Basic_Impl::extract (*this,
+ CORBA::_tc_octet,
+ &o.ref_);
+}
+
+CORBA::Boolean
+CORBA::Any::operator>>= (CORBA::Any::to_char c) const
+{
+ return TAO::Any_Basic_Impl::extract (*this,
+ CORBA::_tc_char,
+ &c.ref_);
+}
+
+CORBA::Boolean
+CORBA::Any::operator>>= (CORBA::Any::to_wchar wc) const
+{
+ return TAO::Any_Basic_Impl::extract (*this,
+ CORBA::_tc_wchar,
+ &wc.ref_);
+}
+
+CORBA::Boolean
+CORBA::Any::operator>>= (CORBA::Any::to_string s) const
+{
+ return
+ TAO::Any_Special_Impl_T<
+ char,
+ CORBA::Any::from_string,
+ CORBA::Any::to_string
+ >::extract (*this,
+ TAO::Any_Impl::_tao_any_string_destructor,
+ CORBA::_tc_string,
+ s.val_,
+ s.bound_);
+}
+
+CORBA::Boolean
+CORBA::Any::operator>>= (CORBA::Any::to_wstring ws) const
+{
+ return
+ TAO::Any_Special_Impl_T<
+ CORBA::WChar,
+ CORBA::Any::from_wstring,
+ CORBA::Any::to_wstring
+ >::extract (*this,
+ TAO::Any_Impl::_tao_any_wstring_destructor,
+ CORBA::_tc_wstring,
+ ws.val_,
+ ws.bound_);
+}
+
+CORBA::Boolean
+CORBA::Any::operator>>= (CORBA::Any::to_object obj) const
+{
+ return this->checked_to_object (obj.ref_);
+}
+
+CORBA::Boolean
+CORBA::Any::operator>>= (CORBA::Any::to_abstract_base obj) const
+{
+ return this->checked_to_abstract_base (obj.ref_);
+}
+
+CORBA::Boolean
+CORBA::Any::operator>>= (CORBA::Any::to_value obj) const
+{
+ return this->checked_to_value (obj.ref_);
+}
+
+// Extraction into the other basic types.
+
+CORBA::Boolean
+operator>>= (const CORBA::Any &any, CORBA::Short &s)
+{
+ return TAO::Any_Basic_Impl::extract (any,
+ CORBA::_tc_short,
+ &s);
+}
+
+CORBA::Boolean
+operator>>= (const CORBA::Any &any, CORBA::UShort &us)
+{
+ return TAO::Any_Basic_Impl::extract (any,
+ CORBA::_tc_ushort,
+ &us);
+}
+
+CORBA::Boolean
+operator>>= (const CORBA::Any &any, CORBA::Long &l)
+{
+ return TAO::Any_Basic_Impl::extract (any,
+ CORBA::_tc_long,
+ &l);
+}
+
+CORBA::Boolean
+operator>>= (const CORBA::Any &any, CORBA::ULong &ul)
+{
+ return TAO::Any_Basic_Impl::extract (any,
+ CORBA::_tc_ulong,
+ &ul);
+}
+
+CORBA::Boolean
+operator>>= (const CORBA::Any &any, CORBA::LongLong &ll)
+{
+ return
+ TAO::Any_Basic_Impl::extract (any,
+ CORBA::_tc_longlong,
+ &ll);
+}
+
+CORBA::Boolean
+operator>>= (const CORBA::Any &any, CORBA::ULongLong &ull)
+{
+ return
+ TAO::Any_Basic_Impl::extract (any,
+ CORBA::_tc_ulonglong,
+ &ull);
+}
+
+CORBA::Boolean
+operator>>= (const CORBA::Any &any, CORBA::Float &f)
+{
+ return TAO::Any_Basic_Impl::extract (any,
+ CORBA::_tc_float,
+ &f);
+}
+
+CORBA::Boolean
+operator>>= (const CORBA::Any &any, CORBA::Double &d)
+{
+ return TAO::Any_Basic_Impl::extract (any,
+ CORBA::_tc_double,
+ &d);
+}
+
+CORBA::Boolean
+operator>>= (const CORBA::Any &any, CORBA::LongDouble &ld)
+{
+ return
+ TAO::Any_Basic_Impl::extract (any,
+ CORBA::_tc_longdouble,
+ &ld);
+}
+
+CORBA::Boolean
+operator>>= (const CORBA::Any &any, const CORBA::Any *&a)
+{
+ return TAO::Any_Dual_Impl_T<CORBA::Any>::extract (
+ any,
+ CORBA::Any::_tao_any_destructor,
+ CORBA::_tc_any,
+ a
+ );
+}
+
+CORBA::Boolean
+operator>>= (const CORBA::Any &any, const CORBA::Char *&s)
+{
+ return
+ TAO::Any_Special_Impl_T<
+ char,
+ CORBA::Any::from_string,
+ CORBA::Any::to_string
+ >::extract (any,
+ TAO::Any_Impl::_tao_any_string_destructor,
+ CORBA::_tc_string,
+ s,
+ 0);
+}
+
+CORBA::Boolean
+operator>>= (const CORBA::Any &any, const CORBA::WChar *&ws)
+{
+ return
+ TAO::Any_Special_Impl_T<
+ CORBA::WChar,
+ CORBA::Any::from_wstring,
+ CORBA::Any::to_wstring
+ >::extract (any,
+ TAO::Any_Impl::_tao_any_wstring_destructor,
+ CORBA::_tc_wstring,
+ ws,
+ 0);
+}
+
+CORBA::Boolean
+operator>>= (const CORBA::Any &any, CORBA::TypeCode_ptr &tc)
+{
+ return TAO::Any_Impl_T<CORBA::TypeCode>::extract (
+ any,
+ CORBA::TypeCode::_tao_any_destructor,
+ CORBA::_tc_TypeCode,
+ tc
+ );
+}
+
+// ================================================================
+// Any_Impl_T template specializations.
+
+namespace TAO
+{
+ template<>
+ CORBA::Boolean
+ Any_Impl_T<CORBA::Object>::to_object (
+ CORBA::Object_ptr &_tao_elem
+ ) const
+ {
+ _tao_elem = CORBA::Object::_duplicate (this->value_);
+ return true;
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/AnyTypeCode/Any.h b/TAO/tao/AnyTypeCode/Any.h
new file mode 100644
index 00000000000..b158adc7feb
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Any.h
@@ -0,0 +1,404 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Any.h
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan
+ * @author Jeff Parsons
+ */
+//=============================================================================
+
+#ifndef TAO_ANY_H
+#define TAO_ANY_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/AnyTypeCode/TAO_AnyTypeCode_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/AnyTypeCode/AnyTypeCode_methods.h"
+#include "tao/Pseudo_VarOut_T.h"
+#include "tao/Arg_Traits_T.h"
+#include "tao/Object.h"
+
+#include "ace/CDR_Stream.h"
+#include "ace/CORBA_macros.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ class Any_Impl;
+}
+
+namespace CORBA
+{
+ class Any;
+ typedef Any *Any_ptr;
+ class Any_var;
+ class Any_out;
+
+ class TypeCode;
+ typedef TypeCode *TypeCode_ptr;
+
+ class AbstractBase;
+ typedef AbstractBase *AbstractBase_ptr;
+
+ class ValueBase;
+ class Exception;
+ class Environment;
+
+ /**
+ * @class Any
+ *
+ * @brief Generic container for IDL types.
+ *
+ * This is the top-level class of the Any implementation. It exposes the
+ * spec-required functionality, but is mostly a wrapper for one of the
+ * template classes below.
+ */
+ class TAO_AnyTypeCode_Export Any
+ {
+ public:
+ typedef Any_ptr _ptr_type;
+ typedef Any_var _var_type;
+ typedef Any_out _out_type;
+
+ Any (void);
+ Any (const Any &);
+
+ ~Any (void);
+
+ Any &operator= (const Any &);
+ TAO::Any_Impl *impl (void) const;
+
+ /// Used in our destruction if we ourselves are stored in an Any.
+ static void _tao_any_destructor (void *);
+
+ /// These are needed for insertion and extraction of booleans,
+ /// octets, chars, and bounded strings. CORBA spec requires
+ /// that they be here, we just typedef to the already-defined
+ /// ACE_OutputCDR types.
+
+ typedef ACE_OutputCDR::from_boolean from_boolean;
+ typedef ACE_OutputCDR::from_octet from_octet;
+ typedef ACE_OutputCDR::from_char from_char;
+ typedef ACE_OutputCDR::from_wchar from_wchar;
+ typedef ACE_OutputCDR::from_string from_string;
+ typedef ACE_OutputCDR::from_wstring from_wstring;
+
+ /// Insertion of the special types.
+
+ void operator<<= (from_boolean);
+ void operator<<= (from_char);
+ void operator<<= (from_wchar);
+ void operator<<= (from_octet);
+ void operator<<= (from_string);
+ void operator<<= (from_wstring);
+
+ /// These extract octets, chars, booleans, bounded strings, and
+ /// object references. All these are defined in ACE_InputCDR.
+
+ typedef ACE_InputCDR::to_boolean to_boolean;
+ typedef ACE_InputCDR::to_char to_char;
+ typedef ACE_InputCDR::to_wchar to_wchar;
+ typedef ACE_InputCDR::to_octet to_octet;
+ typedef ACE_InputCDR::to_string to_string;
+ typedef ACE_InputCDR::to_wstring to_wstring;
+
+ /// These are not in ACE.
+
+ struct TAO_AnyTypeCode_Export to_object
+ {
+ // This signature reflects the change set out in
+ // issue 154 of the 1.3 RTF.
+ explicit to_object (Object_out obj);
+ Object_ptr &ref_;
+ };
+
+ struct TAO_AnyTypeCode_Export to_abstract_base
+ {
+ explicit to_abstract_base (AbstractBase_ptr &obj);
+ AbstractBase_ptr &ref_;
+ };
+
+ struct TAO_AnyTypeCode_Export to_value
+ {
+ explicit to_value (ValueBase *&base);
+ ValueBase *&ref_;
+ };
+
+ /// Extraction of the special types.
+
+ Boolean operator>>= (to_boolean) const;
+ Boolean operator>>= (to_octet) const;
+ Boolean operator>>= (to_char) const;
+ Boolean operator>>= (to_wchar) const;
+ Boolean operator>>= (to_string) const;
+ Boolean operator>>= (to_wstring) const;
+ Boolean operator>>= (to_object) const;
+ Boolean operator>>= (to_abstract_base) const;
+ Boolean operator>>= (to_value) const;
+
+ /// TAO-specific signature.
+ void replace (TAO::Any_Impl *);
+
+ /// Return TypeCode of the element stored in the Any.
+ TypeCode_ptr type (void) const;
+
+ /// For use along with <<= of a value of aliased type when the alias must
+ /// be preserved.
+ void type (TypeCode_ptr
+ ACE_ENV_ARG_DECL);
+
+ /// TAO extension, does not return a duplicate.
+ CORBA::TypeCode_ptr _tao_get_typecode (void) const;
+
+ /// TAO extension.
+ void _tao_set_typecode (const CORBA::TypeCode_ptr);
+
+ int _tao_byte_order (void) const;
+
+ private:
+ CORBA::Boolean checked_to_object (CORBA::Object_ptr &) const;
+ CORBA::Boolean checked_to_value (CORBA::ValueBase *&) const;
+ CORBA::Boolean checked_to_abstract_base (CORBA::AbstractBase_ptr &) const;
+
+ // Unimplemented - hides unsigned char insert/extract.
+ void operator<<= (unsigned char);
+ CORBA::Boolean operator>>= (unsigned char&) const;
+
+ private:
+ TAO::Any_Impl *impl_;
+
+ friend class TAO_Marshal_Any;
+ };
+
+ /**
+ * @class CORBA::Any_var
+ *
+ * @brief Provide for automatic storage deallocation on going out of
+ * scope.
+ */
+ class TAO_AnyTypeCode_Export Any_var
+ {
+ public:
+ Any_var (void);
+ Any_var (Any *a);
+ Any_var (const Any_var &);
+ ~Any_var (void);
+
+ Any_var &operator= (Any *);
+
+ /**
+ * Assignment from an Any_var
+ * This operation requires memory allocation.
+ * If the allocation fails, *this is returned
+ * unmodified.
+ */
+ Any_var &operator= (const Any_var &);
+
+ /// Arrow operator (smart pointer).
+ Any *operator-> (void);
+
+ /// Cast.
+ operator const Any *() const;
+
+ /// Cast.
+ operator Any *&();
+
+ /// For in Any parameter.
+ const Any &in (void) const;
+
+ /// For inout Any parameter.
+ Any &inout (void);
+
+ /// For out Any parameter.
+ Any *&out (void);
+
+ /// For Any return type.
+ Any *_retn (void);
+
+ /// TAO specific extension
+ Any *ptr (void) const;
+ private:
+ /// Holds the Any.
+ Any *ptr_;
+ };
+
+ /**
+ * @class CORBA::Any_out
+ *
+ * @brief CORBA::Any_out
+ *
+ * The _out class for CORBA::Any. This is used to help in
+ * managing the out parameters.
+ */
+ class TAO_AnyTypeCode_Export Any_out
+ {
+ public:
+ Any_out (Any *&);
+ Any_out (Any_var &);
+ Any_out (const Any_out &);
+
+ /// Assignment from a Any_out.
+ Any_out &operator= (const Any_out &s);
+
+ /// Assignment from a Any.
+ Any_out &operator= (Any *);
+
+ /// Cast.
+ operator Any *&();
+
+ /// Return underlying instance.
+ Any *& ptr (void);
+
+ Any *operator-> (void);
+
+ private:
+ /// Assignment from _var disallowed.
+ void operator= (const Any_var &);
+
+ private:
+ /// Instance.
+ Any *&ptr_;
+ };
+}
+
+TAO_AnyTypeCode_Export CORBA::Boolean operator<< (TAO_OutputCDR &, const CORBA::Any &);
+TAO_AnyTypeCode_Export CORBA::Boolean operator>> (TAO_InputCDR &, CORBA::Any &);
+
+/// Typesafe insertion.
+
+TAO_AnyTypeCode_Export void operator<<= (CORBA::Any &, CORBA::Short);
+TAO_AnyTypeCode_Export void operator<<= (CORBA::Any &, CORBA::UShort);
+TAO_AnyTypeCode_Export void operator<<= (CORBA::Any &, CORBA::Long);
+TAO_AnyTypeCode_Export void operator<<= (CORBA::Any &, CORBA::ULong);
+TAO_AnyTypeCode_Export void operator<<= (CORBA::Any &, CORBA::LongLong);
+TAO_AnyTypeCode_Export void operator<<= (CORBA::Any &, CORBA::ULongLong);
+TAO_AnyTypeCode_Export void operator<<= (CORBA::Any &, CORBA::Float);
+TAO_AnyTypeCode_Export void operator<<= (CORBA::Any &, CORBA::Double);
+TAO_AnyTypeCode_Export void operator<<= (CORBA::Any &, CORBA::LongDouble);
+TAO_AnyTypeCode_Export void operator<<= (CORBA::Any &, const CORBA::Any &);
+TAO_AnyTypeCode_Export void operator<<= (CORBA::Any &, CORBA::Any *);
+TAO_AnyTypeCode_Export void operator<<= (CORBA::Any &, const char *);
+TAO_AnyTypeCode_Export void operator<<= (CORBA::Any &, const CORBA::WChar *);
+TAO_AnyTypeCode_Export void operator<<= (CORBA::Any &, CORBA::TypeCode_ptr);
+TAO_AnyTypeCode_Export void operator<<= (CORBA::Any &, CORBA::TypeCode_ptr *);
+TAO_AnyTypeCode_Export void operator<<= (CORBA::Any &, const CORBA::Object_ptr);
+TAO_AnyTypeCode_Export void operator<<= (CORBA::Any &, CORBA::Object_ptr *);
+
+/// Typesafe extraction.
+
+TAO_AnyTypeCode_Export CORBA::Boolean operator>>= (const CORBA::Any &,
+ CORBA::Short &);
+TAO_AnyTypeCode_Export CORBA::Boolean operator>>= (const CORBA::Any &,
+ CORBA::UShort &);
+TAO_AnyTypeCode_Export CORBA::Boolean operator>>= (const CORBA::Any &,
+ CORBA::Long &);
+TAO_AnyTypeCode_Export CORBA::Boolean operator>>= (const CORBA::Any &,
+ CORBA::ULong &);
+TAO_AnyTypeCode_Export CORBA::Boolean operator>>= (const CORBA::Any &,
+ CORBA::LongLong &);
+TAO_AnyTypeCode_Export CORBA::Boolean operator>>= (const CORBA::Any &,
+ CORBA::ULongLong &);
+TAO_AnyTypeCode_Export CORBA::Boolean operator>>= (const CORBA::Any &,
+ CORBA::Float &);
+TAO_AnyTypeCode_Export CORBA::Boolean operator>>= (const CORBA::Any &,
+ CORBA::Double &);
+TAO_AnyTypeCode_Export CORBA::Boolean operator>>= (const CORBA::Any &,
+ CORBA::LongDouble &);
+TAO_AnyTypeCode_Export CORBA::Boolean operator>>= (const CORBA::Any &,
+ const CORBA::Any *&);
+TAO_AnyTypeCode_Export CORBA::Boolean operator>>= (const CORBA::Any &,
+ CORBA::TypeCode_ptr &);
+TAO_AnyTypeCode_Export CORBA::Boolean operator>>= (const CORBA::Any &,
+ const CORBA::Char *&);
+TAO_AnyTypeCode_Export CORBA::Boolean operator>>= (const CORBA::Any &,
+ const CORBA::WChar *&);
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/AnyTypeCode/Any.inl"
+#else
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/// Copying versions of insertion operators for basic types
+/// must also be defined for CORBA::Any_var.
+
+TAO_AnyTypeCode_Export void operator<<= (CORBA::Any_var &, CORBA::Short);
+TAO_AnyTypeCode_Export void operator<<= (CORBA::Any_var &, CORBA::UShort);
+TAO_AnyTypeCode_Export void operator<<= (CORBA::Any_var &, CORBA::Long);
+TAO_AnyTypeCode_Export void operator<<= (CORBA::Any_var &, CORBA::ULong);
+TAO_AnyTypeCode_Export void operator<<= (CORBA::Any_var &, CORBA::LongLong);
+TAO_AnyTypeCode_Export void operator<<= (CORBA::Any_var &, CORBA::ULongLong);
+TAO_AnyTypeCode_Export void operator<<= (CORBA::Any_var &, CORBA::Float);
+TAO_AnyTypeCode_Export void operator<<= (CORBA::Any_var &, CORBA::Double);
+TAO_AnyTypeCode_Export void operator<<= (CORBA::Any_var &, const CORBA::Any *&);
+TAO_AnyTypeCode_Export void operator<<= (CORBA::Any_var &, const char *);
+TAO_AnyTypeCode_Export void operator<<= (CORBA::Any_var &, CORBA::TypeCode_ptr);
+TAO_AnyTypeCode_Export void operator<<= (CORBA::Any_var &, const CORBA::Object_ptr);
+TAO_AnyTypeCode_Export void operator<<= (CORBA::Any_var &, ACE_OutputCDR::from_boolean);
+TAO_AnyTypeCode_Export void operator<<= (CORBA::Any_var &, CORBA::Any::from_char);
+TAO_AnyTypeCode_Export void operator<<= (CORBA::Any_var &, CORBA::Any::from_wchar);
+TAO_AnyTypeCode_Export void operator<<= (CORBA::Any_var &, CORBA::Any::from_octet);
+TAO_AnyTypeCode_Export void operator<<= (CORBA::Any_var &, CORBA::Any::from_string);
+TAO_AnyTypeCode_Export void operator<<= (CORBA::Any_var &, CORBA::Any::from_wstring);
+
+/// These are not required by the spec, but will make users
+/// of other ORBs that are used to them more comfortable.
+
+TAO_AnyTypeCode_Export CORBA::Boolean operator>>= (const CORBA::Any_var &,
+ CORBA::Short &);
+TAO_AnyTypeCode_Export CORBA::Boolean operator>>= (const CORBA::Any_var &,
+ CORBA::UShort &);
+TAO_AnyTypeCode_Export CORBA::Boolean operator>>= (const CORBA::Any_var &,
+ CORBA::Long &);
+TAO_AnyTypeCode_Export CORBA::Boolean operator>>= (const CORBA::Any_var &,
+ CORBA::ULong &);
+TAO_AnyTypeCode_Export CORBA::Boolean operator>>= (const CORBA::Any_var &,
+ CORBA::LongLong &);
+TAO_AnyTypeCode_Export CORBA::Boolean operator>>= (const CORBA::Any_var &,
+ CORBA::ULongLong &);
+TAO_AnyTypeCode_Export CORBA::Boolean operator>>= (const CORBA::Any_var &,
+ CORBA::Float &);
+TAO_AnyTypeCode_Export CORBA::Boolean operator>>= (const CORBA::Any_var &,
+ CORBA::Double &);
+TAO_AnyTypeCode_Export CORBA::Boolean operator>>= (const CORBA::Any_var &,
+ CORBA::Any &);
+TAO_AnyTypeCode_Export CORBA::Boolean operator>>= (const CORBA::Any_var &,
+ CORBA::TypeCode_ptr &);
+TAO_AnyTypeCode_Export CORBA::Boolean operator>>= (const CORBA::Any_var &,
+ const char *&);
+TAO_AnyTypeCode_Export CORBA::Boolean operator>>= (const CORBA::Any_var &,
+ const CORBA::WChar *&);
+TAO_AnyTypeCode_Export CORBA::Boolean operator>>= (const CORBA::Any_var &,
+ CORBA::Any::to_boolean);
+TAO_AnyTypeCode_Export CORBA::Boolean operator>>= (const CORBA::Any_var &,
+ CORBA::Any::to_octet);
+TAO_AnyTypeCode_Export CORBA::Boolean operator>>= (const CORBA::Any_var &,
+ CORBA::Any::to_char);
+TAO_AnyTypeCode_Export CORBA::Boolean operator>>= (const CORBA::Any_var &,
+ CORBA::Any::to_wchar);
+TAO_AnyTypeCode_Export CORBA::Boolean operator>>= (const CORBA::Any_var &,
+ CORBA::Any::to_string);
+TAO_AnyTypeCode_Export CORBA::Boolean operator>>= (const CORBA::Any_var &,
+ CORBA::Any::to_wstring);
+TAO_AnyTypeCode_Export CORBA::Boolean operator>>= (const CORBA::Any_var &,
+ CORBA::Any::to_object);
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_ANY_H */
diff --git a/TAO/tao/AnyTypeCode/Any.inl b/TAO/tao/AnyTypeCode/Any.inl
new file mode 100644
index 00000000000..761f4d13175
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Any.inl
@@ -0,0 +1,372 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE TAO::Any_Impl *
+CORBA::Any::impl (void) const
+{
+ return this->impl_;
+}
+
+// *************************************************************
+// Inline operations for class CORBA::Any_var
+// *************************************************************
+
+ACE_INLINE
+CORBA::Any_var::Any_var (void)
+ : ptr_ (0)
+{
+}
+
+ACE_INLINE
+CORBA::Any_var::Any_var (CORBA::Any *p)
+ : ptr_ (p)
+{
+}
+
+ACE_INLINE
+CORBA::Any_var::~Any_var (void)
+{
+ delete this->ptr_;
+}
+
+ACE_INLINE
+CORBA::Any_var::operator CORBA::Any *&()
+{
+ return this->ptr_;
+}
+
+ACE_INLINE
+CORBA::Any_var::operator const CORBA::Any *() const
+{
+ return this->ptr_;
+}
+
+ACE_INLINE CORBA::Any *
+CORBA::Any_var::operator-> (void)
+{
+ return this->ptr_;
+}
+
+ACE_INLINE const CORBA::Any &
+CORBA::Any_var::in (void) const
+{
+ return *this->ptr_;
+}
+
+ACE_INLINE CORBA::Any &
+CORBA::Any_var::inout (void)
+{
+ return *this->ptr_;
+}
+
+ACE_INLINE CORBA::Any *&
+CORBA::Any_var::out (void)
+{
+ delete this->ptr_;
+ this->ptr_ = 0;
+ return this->ptr_;
+}
+
+ACE_INLINE CORBA::Any *
+CORBA::Any_var::_retn (void)
+{
+ CORBA::Any *temp = this->ptr_;
+ this->ptr_ = 0;
+ return temp;
+}
+
+ACE_INLINE CORBA::Any *
+CORBA::Any_var::ptr (void) const
+{
+ return this->ptr_;
+}
+
+// *************************************************************
+// CORBA::Any_var insertion operators
+// *************************************************************
+
+ACE_INLINE void
+operator <<= (CORBA::Any_var &lhs, CORBA::Short rhs)
+{
+ lhs.inout () <<= rhs;
+}
+
+ACE_INLINE void
+operator <<= (CORBA::Any_var &lhs, CORBA::UShort rhs)
+{
+ lhs.inout () <<= rhs;
+}
+
+ACE_INLINE void
+operator <<= (CORBA::Any_var &lhs, CORBA::Long rhs)
+{
+ lhs.inout () <<= rhs;
+}
+
+ACE_INLINE void
+operator <<= (CORBA::Any_var &lhs, CORBA::ULong rhs)
+{
+ lhs.inout () <<= rhs;
+}
+
+ACE_INLINE void
+operator <<= (CORBA::Any_var &lhs, CORBA::LongLong rhs)
+{
+ lhs.inout () <<= rhs;
+}
+
+ACE_INLINE void
+operator <<= (CORBA::Any_var &lhs, CORBA::ULongLong rhs)
+{
+ lhs.inout () <<= rhs;
+}
+
+ACE_INLINE void
+operator <<= (CORBA::Any_var &lhs, CORBA::Float rhs)
+{
+ lhs.inout () <<= rhs;
+}
+
+ACE_INLINE void
+operator <<= (CORBA::Any_var &lhs, CORBA::Double rhs)
+{
+ lhs.inout () <<= rhs;
+}
+
+ACE_INLINE void
+operator <<= (CORBA::Any_var &lhs, const CORBA::Any& rhs)
+{
+ lhs.inout () <<= rhs;
+}
+
+ACE_INLINE void
+operator <<= (CORBA::Any_var &lhs, const char* rhs)
+{
+ lhs.inout () <<= rhs;
+}
+
+ACE_INLINE void
+operator <<= (CORBA::Any_var &lhs, CORBA::TypeCode_ptr rhs)
+{
+ lhs.inout () <<= rhs;
+}
+
+ACE_INLINE void
+operator <<= (CORBA::Any_var &lhs, const CORBA::Object_ptr rhs)
+{
+ lhs.inout () <<= rhs;
+}
+
+ACE_INLINE void
+operator <<= (CORBA::Any_var &lhs, ACE_OutputCDR::from_boolean rhs)
+{
+ lhs.inout () <<= rhs;
+}
+
+ACE_INLINE void
+operator <<= (CORBA::Any_var &lhs, CORBA::Any::from_char rhs)
+{
+ lhs.inout () <<= rhs;
+}
+
+ACE_INLINE void
+operator <<= (CORBA::Any_var &lhs, CORBA::Any::from_wchar rhs)
+{
+ lhs.inout () <<= rhs;
+}
+
+ACE_INLINE void
+operator <<= (CORBA::Any_var &lhs, CORBA::Any::from_octet rhs)
+{
+ lhs.inout () <<= rhs;
+}
+
+ACE_INLINE void
+operator <<= (CORBA::Any_var &lhs, CORBA::Any::from_string rhs)
+{
+ lhs.inout () <<= rhs;
+}
+
+ACE_INLINE void
+operator <<= (CORBA::Any_var &lhs, CORBA::Any::from_wstring rhs)
+{
+ lhs.inout () <<= rhs;
+}
+
+// *************************************************************
+// CORBA::Any_var extraction operators
+// *************************************************************
+
+ACE_INLINE CORBA::Boolean
+operator >>= (const CORBA::Any_var &lhs, CORBA::Short &rhs)
+{
+ return lhs.in () >>= rhs;
+}
+
+ACE_INLINE CORBA::Boolean
+operator >>= (const CORBA::Any_var &lhs, CORBA::UShort &rhs)
+{
+ return lhs.in () >>= rhs;
+}
+
+ACE_INLINE CORBA::Boolean
+operator >>= (const CORBA::Any_var &lhs, CORBA::Long &rhs)
+{
+ return lhs.in () >>= rhs;
+}
+
+ACE_INLINE CORBA::Boolean
+operator >>= (const CORBA::Any_var &lhs, CORBA::ULong &rhs)
+{
+ return lhs.in () >>= rhs;
+}
+
+ACE_INLINE CORBA::Boolean
+operator >>= (const CORBA::Any_var &lhs, CORBA::LongLong &rhs)
+{
+ return lhs.in () >>= rhs;
+}
+
+ACE_INLINE CORBA::Boolean
+operator >>= (const CORBA::Any_var &lhs, CORBA::ULongLong &rhs)
+{
+ return lhs.in () >>= rhs;
+}
+
+ACE_INLINE CORBA::Boolean
+operator >>= (const CORBA::Any_var &lhs, CORBA::Float &rhs)
+{
+ return lhs.in () >>= rhs;
+}
+
+ACE_INLINE CORBA::Boolean
+operator >>= (const CORBA::Any_var &lhs, CORBA::Double &rhs)
+{
+ return lhs.in () >>= rhs;
+}
+
+ACE_INLINE CORBA::Boolean
+operator >>= (const CORBA::Any_var &lhs, const CORBA::Any *&rhs)
+{
+ return lhs.in () >>= rhs;
+}
+
+ACE_INLINE CORBA::Boolean
+operator >>= (const CORBA::Any_var &lhs, CORBA::TypeCode_ptr &rhs)
+{
+ return lhs.in () >>= rhs;
+}
+
+ACE_INLINE CORBA::Boolean
+operator >>= (const CORBA::Any_var &lhs, const char *&rhs)
+{
+ return lhs.in () >>= rhs;
+}
+
+ACE_INLINE CORBA::Boolean
+operator >>= (const CORBA::Any_var &lhs, const CORBA::WChar *&rhs)
+{
+ return lhs.in () >>= rhs;
+}
+
+ACE_INLINE CORBA::Boolean
+operator >>= (const CORBA::Any_var &lhs, CORBA::Any::to_boolean rhs)
+{
+ return lhs.in () >>= rhs;
+}
+
+ACE_INLINE CORBA::Boolean
+operator >>= (const CORBA::Any_var &lhs, CORBA::Any::to_octet rhs)
+{
+ return lhs.in () >>= rhs;
+}
+
+ACE_INLINE CORBA::Boolean
+operator >>= (const CORBA::Any_var &lhs, CORBA::Any::to_char rhs)
+{
+ return lhs.in () >>= rhs;
+}
+
+ACE_INLINE CORBA::Boolean
+operator >>= (const CORBA::Any_var &lhs, CORBA::Any::to_wchar rhs)
+{
+ return lhs.in () >>= rhs;
+}
+
+ACE_INLINE CORBA::Boolean
+operator >>= (const CORBA::Any_var &lhs, CORBA::Any::to_string rhs)
+{
+ return lhs.in () >>= rhs;
+}
+
+ACE_INLINE CORBA::Boolean
+operator >>= (const CORBA::Any_var &lhs, CORBA::Any::to_wstring rhs)
+{
+ return lhs.in () >>= rhs;
+}
+
+ACE_INLINE CORBA::Boolean
+operator >>= (const CORBA::Any_var &lhs, CORBA::Any::to_object rhs)
+{
+ return lhs.in () >>= rhs;
+}
+
+// *************************************************************
+// Inline operations for class CORBA::Any_out
+// *************************************************************
+
+ACE_INLINE
+CORBA::Any_out::Any_out (CORBA::Any *&s)
+ : ptr_ (s)
+{
+ this->ptr_ = 0;
+}
+
+ACE_INLINE
+CORBA::Any_out::Any_out (CORBA::Any_var &s)
+ : ptr_ (s.out ())
+{
+}
+
+ACE_INLINE
+CORBA::Any_out::Any_out (const CORBA::Any_out &s)
+ : ptr_ (s.ptr_)
+{
+}
+
+ACE_INLINE CORBA::Any_out &
+CORBA::Any_out::operator= (const CORBA::Any_out &s)
+{
+ this->ptr_ = s.ptr_;
+ return *this;
+}
+
+ACE_INLINE CORBA::Any_out &
+CORBA::Any_out::operator= (CORBA::Any *s)
+{
+ this->ptr_ = s;
+ return *this;
+}
+
+ACE_INLINE
+CORBA::Any_out::operator CORBA::Any *&()
+{
+ return this->ptr_;
+}
+
+ACE_INLINE CORBA::Any *&
+CORBA::Any_out::ptr (void)
+{
+ return this->ptr_;
+}
+
+ACE_INLINE CORBA::Any *
+CORBA::Any_out::operator-> (void)
+{
+ return this->ptr_;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/AnyTypeCode/AnySeq.pidl b/TAO/tao/AnyTypeCode/AnySeq.pidl
new file mode 100644
index 00000000000..18cf94274d6
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/AnySeq.pidl
@@ -0,0 +1,33 @@
+// -*- IDL -*-
+//
+// $Id$
+
+// ================================================================
+/**
+ * This file was used to generate the code in AnySeq*.*
+ * The command used to generate code is:
+ *
+ * tao_idl
+ * -o orig -Ge 1 -GA -SS -Sci
+ * -Wb,export_macro=TAO_Export
+ * -Wb,export_include="tao/TAO_Export.h"
+ * -Wb,pre_include="ace/pre.h"
+ * -Wb,post_include="ace/post.h"
+ * -Wb,versioning_begin=TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+ * -Wb,versioning_end=TAO_END_VERSIONED_NAMESPACE_DECL
+ * AnySeq.pidl
+ *
+ */
+// ================================================================
+
+#ifndef TAO_CORBA_ANY_SEQ_IDL
+#define TAO_CORBA_ANY_SEQ_IDL
+
+#pragma prefix "omg.org"
+
+module CORBA
+{
+ typedef sequence<any> AnySeq;
+};
+
+#endif /* TAO_CORBA_ANY_SEQ_IDL */
diff --git a/TAO/tao/AnyTypeCode/AnyTypeCode_Adapter_Impl.cpp b/TAO/tao/AnyTypeCode/AnyTypeCode_Adapter_Impl.cpp
new file mode 100644
index 00000000000..86a170d7639
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/AnyTypeCode_Adapter_Impl.cpp
@@ -0,0 +1,192 @@
+// $Id$
+
+#include "tao/AnyTypeCode/AnyTypeCode_Adapter_Impl.h"
+#include "tao/AnyTypeCode/SystemExceptionA.h"
+#include "tao/AnyTypeCode/WrongTransactionA.h"
+#include "tao/AnyTypeCode/PolicyA.h"
+#include "tao/AnyTypeCode/Any.h"
+
+ACE_RCSID (AnyTypeCode,
+ TAO_AnyTypeCode_Adapter,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+#define STANDARD_EXCEPTION_LIST \
+ TAO_SYSTEM_EXCEPTION (UNKNOWN) \
+ TAO_SYSTEM_EXCEPTION (BAD_PARAM) \
+ TAO_SYSTEM_EXCEPTION (NO_MEMORY) \
+ TAO_SYSTEM_EXCEPTION (IMP_LIMIT) \
+ TAO_SYSTEM_EXCEPTION (COMM_FAILURE) \
+ TAO_SYSTEM_EXCEPTION (INV_OBJREF) \
+ TAO_SYSTEM_EXCEPTION (OBJECT_NOT_EXIST) \
+ TAO_SYSTEM_EXCEPTION (NO_PERMISSION) \
+ TAO_SYSTEM_EXCEPTION (INTERNAL) \
+ TAO_SYSTEM_EXCEPTION (MARSHAL) \
+ TAO_SYSTEM_EXCEPTION (INITIALIZE) \
+ TAO_SYSTEM_EXCEPTION (NO_IMPLEMENT) \
+ TAO_SYSTEM_EXCEPTION (BAD_TYPECODE) \
+ TAO_SYSTEM_EXCEPTION (BAD_OPERATION) \
+ TAO_SYSTEM_EXCEPTION (NO_RESOURCES) \
+ TAO_SYSTEM_EXCEPTION (NO_RESPONSE) \
+ TAO_SYSTEM_EXCEPTION (PERSIST_STORE) \
+ TAO_SYSTEM_EXCEPTION (BAD_INV_ORDER) \
+ TAO_SYSTEM_EXCEPTION (TRANSIENT) \
+ TAO_SYSTEM_EXCEPTION (FREE_MEM) \
+ TAO_SYSTEM_EXCEPTION (INV_IDENT) \
+ TAO_SYSTEM_EXCEPTION (INV_FLAG) \
+ TAO_SYSTEM_EXCEPTION (INTF_REPOS) \
+ TAO_SYSTEM_EXCEPTION (BAD_CONTEXT) \
+ TAO_SYSTEM_EXCEPTION (OBJ_ADAPTER) \
+ TAO_SYSTEM_EXCEPTION (DATA_CONVERSION) \
+ TAO_SYSTEM_EXCEPTION (INV_POLICY) \
+ TAO_SYSTEM_EXCEPTION (REBIND) \
+ TAO_SYSTEM_EXCEPTION (TIMEOUT) \
+ TAO_SYSTEM_EXCEPTION (TRANSACTION_UNAVAILABLE) \
+ TAO_SYSTEM_EXCEPTION (TRANSACTION_MODE) \
+ TAO_SYSTEM_EXCEPTION (TRANSACTION_REQUIRED) \
+ TAO_SYSTEM_EXCEPTION (TRANSACTION_ROLLEDBACK) \
+ TAO_SYSTEM_EXCEPTION (INVALID_TRANSACTION) \
+ TAO_SYSTEM_EXCEPTION (CODESET_INCOMPATIBLE) \
+ TAO_SYSTEM_EXCEPTION (BAD_QOS) \
+ TAO_SYSTEM_EXCEPTION (INVALID_ACTIVITY) \
+ TAO_SYSTEM_EXCEPTION (ACTIVITY_COMPLETED) \
+ TAO_SYSTEM_EXCEPTION (ACTIVITY_REQUIRED) \
+ TAO_SYSTEM_EXCEPTION (THREAD_CANCELLED) \
+ TAO_SYSTEM_EXCEPTION (WrongTransaction) \
+ TAO_SYSTEM_EXCEPTION (PolicyError) \
+ TAO_SYSTEM_EXCEPTION (InvalidPolicies)
+
+#define TAO_SYSTEM_EXCEPTION(name) \
+CORBA::TypeCode_ptr \
+TAO_AnyTypeCode_Adapter_Impl::_tao_type_ ## name (void) const \
+{ \
+ return CORBA::_tc_ ## name; \
+}
+
+STANDARD_EXCEPTION_LIST
+#undef TAO_SYSTEM_EXCEPTION
+
+void
+TAO_AnyTypeCode_Adapter_Impl::insert_into_any (CORBA::Any * any, CORBA::Char const * mychar)
+{
+ (*any) <<= mychar;
+}
+
+void
+TAO_AnyTypeCode_Adapter_Impl::insert_into_any (CORBA::Any * any, CORBA::WChar const * mywchar)
+{
+ (*any) <<= mywchar;
+}
+
+void
+TAO_AnyTypeCode_Adapter_Impl::insert_into_any (CORBA::Any * any, CORBA::Long value)
+{
+ (*any) <<= value;
+}
+
+void
+TAO_AnyTypeCode_Adapter_Impl::insert_into_any (CORBA::Any * any, CORBA::Short value)
+{
+ (*any) <<= value;
+}
+
+void
+TAO_AnyTypeCode_Adapter_Impl::insert_into_any (CORBA::Any * any, CORBA::UShort value)
+{
+ (*any) <<= value;
+}
+
+void
+TAO_AnyTypeCode_Adapter_Impl::insert_into_any (CORBA::Any * any, CORBA::Float value)
+{
+ (*any) <<= value;
+}
+
+void
+TAO_AnyTypeCode_Adapter_Impl::insert_into_any (CORBA::Any * any, CORBA::Double value)
+{
+ (*any) <<= value;
+}
+
+void
+TAO_AnyTypeCode_Adapter_Impl::insert_into_any (CORBA::Any * any, CORBA::LongLong value)
+{
+ (*any) <<= value;
+}
+
+void
+TAO_AnyTypeCode_Adapter_Impl::insert_into_any (CORBA::Any * any, CORBA::ULongLong value)
+{
+ (*any) <<= value;
+}
+
+void
+TAO_AnyTypeCode_Adapter_Impl::insert_into_any (CORBA::Any * any, CORBA::LongDouble value)
+{
+ (*any) <<= value;
+}
+
+void
+TAO_AnyTypeCode_Adapter_Impl::insert_into_any (CORBA::Any * any, CORBA::Policy_ptr policy)
+{
+ (*any) <<= policy;
+}
+
+void
+TAO_AnyTypeCode_Adapter_Impl::insert_into_any (CORBA::Any * any, CORBA::Policy_ptr * policy)
+{
+ (*any) <<= policy;
+}
+
+void
+TAO_AnyTypeCode_Adapter_Impl::insert_into_any (CORBA::Any * any, CORBA::ULong value)
+{
+ (*any) <<= value;
+}
+
+void
+TAO_AnyTypeCode_Adapter_Impl::insert_into_any (CORBA::Any * any, ACE_OutputCDR::from_wchar value)
+{
+ (*any) <<= value;
+}
+
+void
+TAO_AnyTypeCode_Adapter_Impl::insert_into_any (CORBA::Any * any, ACE_OutputCDR::from_char value)
+{
+ (*any) <<= value;
+}
+
+void
+TAO_AnyTypeCode_Adapter_Impl::insert_into_any (CORBA::Any * any, ACE_OutputCDR::from_octet value)
+{
+ (*any) <<= value;
+}
+
+void
+TAO_AnyTypeCode_Adapter_Impl::insert_into_any (CORBA::Any * any, ACE_OutputCDR::from_boolean value)
+{
+ (*any) <<= value;
+}
+
+int
+TAO_AnyTypeCode_Adapter_Impl::Initializer (void)
+{
+ return ACE_Service_Config::process_directive (
+ ace_svc_desc_TAO_AnyTypeCode_Adapter_Impl
+ );
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DEFINE (
+ TAO_AnyTypeCode_Adapter_Impl,
+ ACE_TEXT ("AnyTypeCode_Adapter"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (TAO_AnyTypeCode_Adapter_Impl),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0)
+
+ACE_FACTORY_DEFINE (TAO_AnyTypeCode, TAO_AnyTypeCode_Adapter_Impl)
+
+
diff --git a/TAO/tao/AnyTypeCode/AnyTypeCode_Adapter_Impl.h b/TAO/tao/AnyTypeCode/AnyTypeCode_Adapter_Impl.h
new file mode 100644
index 00000000000..389623b086c
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/AnyTypeCode_Adapter_Impl.h
@@ -0,0 +1,135 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file AnyTypeCode_Adapter_Impl.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+
+#ifndef TAO_ANYTYPECODE_ADAPTER_IMPL_H
+#define TAO_ANYTYPECODE_ADAPTER_IMPL_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/AnyTypeCode/TAO_AnyTypeCode_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/AnyTypeCode_Adapter.h"
+#include "ace/Service_Config.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_AnyTypeCode_Adapter
+ */
+class TAO_AnyTypeCode_Export TAO_AnyTypeCode_Adapter_Impl
+ : public TAO_AnyTypeCode_Adapter
+{
+public:
+ // Used to force the initialization of the code.
+ static int Initializer (void);
+
+#define ANYTYPECODE__EXCEPTION_LIST \
+ TAO_SYSTEM_EXCEPTION (UNKNOWN) \
+ TAO_SYSTEM_EXCEPTION (BAD_PARAM) \
+ TAO_SYSTEM_EXCEPTION (NO_MEMORY) \
+ TAO_SYSTEM_EXCEPTION (IMP_LIMIT) \
+ TAO_SYSTEM_EXCEPTION (COMM_FAILURE) \
+ TAO_SYSTEM_EXCEPTION (INV_OBJREF) \
+ TAO_SYSTEM_EXCEPTION (OBJECT_NOT_EXIST) \
+ TAO_SYSTEM_EXCEPTION (NO_PERMISSION) \
+ TAO_SYSTEM_EXCEPTION (INTERNAL) \
+ TAO_SYSTEM_EXCEPTION (MARSHAL) \
+ TAO_SYSTEM_EXCEPTION (INITIALIZE) \
+ TAO_SYSTEM_EXCEPTION (NO_IMPLEMENT) \
+ TAO_SYSTEM_EXCEPTION (BAD_TYPECODE) \
+ TAO_SYSTEM_EXCEPTION (BAD_OPERATION) \
+ TAO_SYSTEM_EXCEPTION (NO_RESOURCES) \
+ TAO_SYSTEM_EXCEPTION (NO_RESPONSE) \
+ TAO_SYSTEM_EXCEPTION (PERSIST_STORE) \
+ TAO_SYSTEM_EXCEPTION (BAD_INV_ORDER) \
+ TAO_SYSTEM_EXCEPTION (TRANSIENT) \
+ TAO_SYSTEM_EXCEPTION (FREE_MEM) \
+ TAO_SYSTEM_EXCEPTION (INV_IDENT) \
+ TAO_SYSTEM_EXCEPTION (INV_FLAG) \
+ TAO_SYSTEM_EXCEPTION (INTF_REPOS) \
+ TAO_SYSTEM_EXCEPTION (BAD_CONTEXT) \
+ TAO_SYSTEM_EXCEPTION (OBJ_ADAPTER) \
+ TAO_SYSTEM_EXCEPTION (DATA_CONVERSION) \
+ TAO_SYSTEM_EXCEPTION (INV_POLICY) \
+ TAO_SYSTEM_EXCEPTION (REBIND) \
+ TAO_SYSTEM_EXCEPTION (TIMEOUT) \
+ TAO_SYSTEM_EXCEPTION (TRANSACTION_UNAVAILABLE) \
+ TAO_SYSTEM_EXCEPTION (TRANSACTION_MODE) \
+ TAO_SYSTEM_EXCEPTION (TRANSACTION_REQUIRED) \
+ TAO_SYSTEM_EXCEPTION (TRANSACTION_ROLLEDBACK) \
+ TAO_SYSTEM_EXCEPTION (INVALID_TRANSACTION) \
+ TAO_SYSTEM_EXCEPTION (CODESET_INCOMPATIBLE) \
+ TAO_SYSTEM_EXCEPTION (BAD_QOS) \
+ TAO_SYSTEM_EXCEPTION (INVALID_ACTIVITY) \
+ TAO_SYSTEM_EXCEPTION (ACTIVITY_COMPLETED) \
+ TAO_SYSTEM_EXCEPTION (ACTIVITY_REQUIRED) \
+ TAO_SYSTEM_EXCEPTION (THREAD_CANCELLED) \
+ TAO_SYSTEM_EXCEPTION (WrongTransaction) \
+ TAO_SYSTEM_EXCEPTION (PolicyError) \
+ TAO_SYSTEM_EXCEPTION (InvalidPolicies)
+
+#define TAO_SYSTEM_EXCEPTION(name) \
+ virtual CORBA::TypeCode_ptr _tao_type_ ## name (void) const;
+
+ANYTYPECODE__EXCEPTION_LIST
+#undef TAO_SYSTEM_EXCEPTION
+
+ virtual void insert_into_any (CORBA::Any * any, CORBA::Char const * mychar);
+
+ virtual void insert_into_any (CORBA::Any * any, CORBA::WChar const * mywchar);
+
+ virtual void insert_into_any (CORBA::Any * any, CORBA::Long value);
+
+ virtual void insert_into_any (CORBA::Any * any, CORBA::Short value);
+
+ virtual void insert_into_any (CORBA::Any * any, CORBA::UShort value);
+
+ virtual void insert_into_any (CORBA::Any * any, CORBA::Float value);
+
+ virtual void insert_into_any (CORBA::Any * any, CORBA::Double value);
+
+ virtual void insert_into_any (CORBA::Any * any, CORBA::LongLong value);
+
+ virtual void insert_into_any (CORBA::Any * any, CORBA::ULongLong value);
+
+ virtual void insert_into_any (CORBA::Any * any, CORBA::LongDouble value);
+
+ virtual void insert_into_any (CORBA::Any * any, CORBA::Policy_ptr policy);
+
+ virtual void insert_into_any (CORBA::Any * any, CORBA::Policy_ptr * policy);
+
+ virtual void insert_into_any (CORBA::Any * any, CORBA::ULong value);
+
+ virtual void insert_into_any (CORBA::Any * any, ACE_OutputCDR::from_wchar value);
+
+ virtual void insert_into_any (CORBA::Any * any, ACE_OutputCDR::from_char value);
+
+ virtual void insert_into_any (CORBA::Any * any, ACE_OutputCDR::from_octet value);
+
+ virtual void insert_into_any (CORBA::Any * any, ACE_OutputCDR::from_boolean value);
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE (TAO_AnyTypeCode_Adapter_Impl)
+ACE_FACTORY_DECLARE (TAO_AnyTypeCode, TAO_AnyTypeCode_Adapter_Impl)
+
+static int TAO_Requires_TAO_AnyTypeCode_Adapter_Impl =
+ TAO_AnyTypeCode_Adapter_Impl::Initializer ();
+
+#include /**/ "ace/post.h"
+#endif /* TAO_ANYTYPECODE_ADAPTER_IMPL_H */
diff --git a/TAO/tao/AnyTypeCode/AnyTypeCode_methods.h b/TAO/tao/AnyTypeCode/AnyTypeCode_methods.h
new file mode 100644
index 00000000000..d954af4b0ad
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/AnyTypeCode_methods.h
@@ -0,0 +1,60 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file AnyTypeCode_methods.h
+ *
+ * $Id$
+ *
+ * Declarations of NamedValue and NVlist methods in the CORBA namespace.
+ *
+ * @author Jeff Parsons <j.parsons@vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_ANYTYPECODE_METHODS_H
+#define TAO_ANYTYPECODE_METHODS_H
+
+#include /**/ "ace/pre.h"
+#include "tao/AnyTypeCode/TAO_AnyTypeCode_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if defined (TAO_EXPORT_MACRO)
+#undef TAO_EXPORT_MACRO
+#endif
+#define TAO_EXPORT_MACRO TAO_AnyTypeCode_Export
+
+#include "tao/Basic_Types.h"
+#include "tao/orbconf.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace CORBA
+{
+ class NamedValue;
+ typedef NamedValue *NamedValue_ptr;
+
+ class NVList;
+ typedef NVList *NVList_ptr;
+
+ class TypeCode;
+ typedef TypeCode *TypeCode_ptr;
+
+ TAO_NAMESPACE_INLINE_FUNCTION void release (NamedValue_ptr);
+ TAO_NAMESPACE_INLINE_FUNCTION Boolean is_nil (NamedValue_ptr);
+
+ TAO_NAMESPACE_INLINE_FUNCTION void release (NVList_ptr);
+ TAO_NAMESPACE_INLINE_FUNCTION Boolean is_nil (NVList_ptr );
+
+ TAO_NAMESPACE_INLINE_FUNCTION Boolean is_nil (TypeCode_ptr);
+ TAO_NAMESPACE_INLINE_FUNCTION void release (TypeCode_ptr);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_ANYTYPECODE_METHODS_H */
diff --git a/TAO/tao/AnyTypeCode/Any_Arg_Traits.h b/TAO/tao/AnyTypeCode/Any_Arg_Traits.h
new file mode 100644
index 00000000000..56bdc4ace51
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Any_Arg_Traits.h
@@ -0,0 +1,52 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Any_Arg_Traits.h
+ *
+ * $Id$
+ *
+ * @author Jeff Parsons
+ */
+//=============================================================================
+
+
+#ifndef TAO_ANY_ARG_TRAITS_H
+#define TAO_ANY_ARG_TRAITS_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/AnyTypeCode/TAO_AnyTypeCode_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Var_Size_Argument_T.h"
+#include "tao/Arg_Traits_T.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace CORBA
+{
+ class Any;
+}
+
+namespace TAO
+{
+ template<>
+ class TAO_AnyTypeCode_Export Arg_Traits<CORBA::Any>
+ : public
+ Var_Size_Arg_Traits_T<
+ CORBA::Any,
+ TAO::Any_Insert_Policy_Stream <CORBA::Any>
+ >
+ {
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_ANY_ARG_TRAITS_H */
diff --git a/TAO/tao/AnyTypeCode/Any_Array_Impl_T.cpp b/TAO/tao/AnyTypeCode/Any_Array_Impl_T.cpp
new file mode 100644
index 00000000000..97cda1e2d59
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Any_Array_Impl_T.cpp
@@ -0,0 +1,177 @@
+// $Id$
+
+#ifndef TAO_ANY_ARRAY_IMPL_T_CPP
+#define TAO_ANY_ARRAY_IMPL_T_CPP
+
+#include "tao/AnyTypeCode/Any_Array_Impl_T.h"
+#include "tao/AnyTypeCode/Any.h"
+#include "tao/AnyTypeCode/Any_Unknown_IDL_Type.h"
+#include "tao/AnyTypeCode/Marshal.h"
+#include "tao/debug.h"
+#include "tao/CDR.h"
+#include "tao/SystemException.h"
+
+#include "ace/CORBA_macros.h"
+#include "ace/Auto_Ptr.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/AnyTypeCode/Any_Array_Impl_T.inl"
+#endif /* ! __ACE_INLINE__ */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template<typename T_slice, typename T_forany>
+TAO::Any_Array_Impl_T<T_slice, T_forany>::Any_Array_Impl_T (
+ _tao_destructor destructor,
+ CORBA::TypeCode_ptr tc,
+ T_slice * const val
+ )
+ : Any_Impl (destructor,
+ tc),
+ value_ (val)
+{
+}
+
+template<typename T_slice, typename T_forany>
+TAO::Any_Array_Impl_T<T_slice, T_forany>::~Any_Array_Impl_T (void)
+{
+}
+
+template<typename T_slice, typename T_forany>
+void
+TAO::Any_Array_Impl_T<T_slice, T_forany>::insert (CORBA::Any & any,
+ _tao_destructor destructor,
+ CORBA::TypeCode_ptr tc,
+ T_slice * const value)
+{
+ TAO::Any_Array_Impl_T<T_slice, T_forany> *new_impl = 0;
+ typedef TAO::Any_Array_Impl_T<T_slice, T_forany> ARRAY_ANY_IMPL;
+ ACE_NEW (new_impl,
+ ARRAY_ANY_IMPL (destructor,
+ tc,
+ value));
+ any.replace (new_impl);
+}
+
+template<typename T_slice, typename T_forany>
+CORBA::Boolean
+TAO::Any_Array_Impl_T<T_slice, T_forany>::extract (const CORBA::Any & any,
+ _tao_destructor destructor,
+ CORBA::TypeCode_ptr tc,
+ T_slice *& _tao_elem)
+{
+ _tao_elem = 0;
+
+ ACE_TRY_NEW_ENV
+ {
+ CORBA::TypeCode_ptr any_tc = any._tao_get_typecode ();
+ CORBA::Boolean const _tao_equiv =
+ any_tc->equivalent (tc
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (_tao_equiv == false)
+ {
+ return false;
+ }
+
+ TAO::Any_Impl *impl = any.impl ();
+
+ if (!impl->encoded ())
+ {
+ TAO::Any_Array_Impl_T<T_slice, T_forany> *narrow_impl =
+ dynamic_cast <TAO::Any_Array_Impl_T <T_slice, T_forany> *> (impl);
+
+ if (narrow_impl == 0)
+ {
+ return false;
+ }
+
+ _tao_elem = reinterpret_cast <T_slice*> (narrow_impl->value_);
+ return true;
+ }
+
+ TAO::Any_Array_Impl_T<T_slice, T_forany> *replacement = 0;
+ typedef TAO::Any_Array_Impl_T<T_slice, T_forany> ARRAY_ANY_IMPL;
+ ACE_NEW_RETURN (replacement,
+ ARRAY_ANY_IMPL (destructor,
+ any_tc,
+ T_forany::tao_alloc ()),
+ false);
+
+ auto_ptr<TAO::Any_Array_Impl_T<T_slice, T_forany> > replacement_safety (
+ replacement
+ );
+
+ // We know this will work since the unencoded case is covered above.
+ TAO::Unknown_IDL_Type *unk =
+ dynamic_cast<TAO::Unknown_IDL_Type *> (impl);
+
+ // We don't want the rd_ptr of unk to move, in case it is
+ // shared by another Any. This copies the state, not the buffer.
+ TAO_InputCDR for_reading (unk->_tao_get_cdr ());
+
+ CORBA::Boolean const good_decode =
+ replacement->demarshal_value (for_reading);
+
+ if (good_decode)
+ {
+ _tao_elem = reinterpret_cast <T_slice*> (replacement->value_);
+ const_cast<CORBA::Any &> (any).replace (replacement);
+ replacement_safety.release ();
+ return true;
+ }
+
+ // Duplicated by Any_Impl base class constructor.
+ ::CORBA::release (any_tc);
+ }
+ ACE_CATCHANY
+ {
+ }
+ ACE_ENDTRY;
+
+ return 0;
+}
+
+template<typename T_slice, typename T_forany>
+CORBA::Boolean
+TAO::Any_Array_Impl_T<T_slice, T_forany>::marshal_value (TAO_OutputCDR &cdr)
+{
+ return (cdr << T_forany (this->value_));
+}
+
+template<typename T_slice, typename T_forany>
+const void *
+TAO::Any_Array_Impl_T<T_slice, T_forany>::value (void) const
+{
+ return this->value_;
+}
+
+template<typename T_slice, typename T_forany>
+void
+TAO::Any_Array_Impl_T<T_slice, T_forany>::free_value (void)
+{
+ if (this->value_destructor_ != 0)
+ {
+ (*this->value_destructor_) (this->value_);
+ this->value_destructor_ = 0;
+ }
+
+ this->value_ = 0;
+ ::CORBA::release (this->type_);
+}
+
+template<typename T_slice, typename T_forany>
+void
+TAO::Any_Array_Impl_T<T_slice, T_forany>::_tao_decode (TAO_InputCDR &cdr
+ ACE_ENV_ARG_DECL)
+{
+ if (! this->demarshal_value (cdr))
+ {
+ ACE_THROW (CORBA::MARSHAL ());
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_ANY_ARRAY_IMPL_T_CPP */
diff --git a/TAO/tao/AnyTypeCode/Any_Array_Impl_T.h b/TAO/tao/AnyTypeCode/Any_Array_Impl_T.h
new file mode 100644
index 00000000000..f7c0d1656ab
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Any_Array_Impl_T.h
@@ -0,0 +1,84 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Any_Array_Impl_T.h
+ *
+ * $Id$
+ *
+ * @authors Carlos O'Ryan and Jeff Parsons
+ */
+//=============================================================================
+
+
+#ifndef TAO_ANY_ARRAY_IMPL_T_H
+#define TAO_ANY_ARRAY_IMPL_T_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/AnyTypeCode/Any_Impl.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ /**
+ * @class Any_Array_Impl_T
+ *
+ * @brief Template Any class for array types.
+ *
+ * Used for arrays
+ */
+ template<typename T_slice, typename T_forany>
+ class Any_Array_Impl_T : public Any_Impl
+ {
+ public:
+ Any_Array_Impl_T (_tao_destructor destructor,
+ CORBA::TypeCode_ptr,
+ T_slice * const);
+ virtual ~Any_Array_Impl_T (void);
+
+ static void insert (CORBA::Any &,
+ _tao_destructor destructor,
+ CORBA::TypeCode_ptr,
+ T_slice * const);
+ static CORBA::Boolean extract (const CORBA::Any &,
+ _tao_destructor,
+ CORBA::TypeCode_ptr,
+ T_slice *&);
+
+ virtual CORBA::Boolean marshal_value (TAO_OutputCDR &);
+ CORBA::Boolean demarshal_value (TAO_InputCDR &);
+ virtual void _tao_decode (TAO_InputCDR &
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ virtual const void *value (void) const;
+ virtual void free_value (void);
+
+ private:
+ T_slice * value_;
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/AnyTypeCode/Any_Array_Impl_T.inl"
+#endif /* __ACE_INLINE__ */
+
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+#include "tao/AnyTypeCode/Any_Array_Impl_T.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
+#pragma implementation ("Any_Array_Impl_T.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_ANY_ARRAY_IMPL_T_H */
+
diff --git a/TAO/tao/AnyTypeCode/Any_Array_Impl_T.inl b/TAO/tao/AnyTypeCode/Any_Array_Impl_T.inl
new file mode 100644
index 00000000000..939a2e9d3e3
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Any_Array_Impl_T.inl
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template<typename T_slice, typename T_forany>
+ACE_INLINE
+CORBA::Boolean
+TAO::Any_Array_Impl_T<T_slice, T_forany>::demarshal_value (TAO_InputCDR &cdr)
+{
+ T_forany tmp (this->value_);
+ return (cdr >> tmp);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/AnyTypeCode/Any_Basic_Impl.cpp b/TAO/tao/AnyTypeCode/Any_Basic_Impl.cpp
new file mode 100644
index 00000000000..d5e0e364af3
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Any_Basic_Impl.cpp
@@ -0,0 +1,386 @@
+// $Id$
+
+#include "tao/AnyTypeCode/Any_Basic_Impl.h"
+#include "tao/AnyTypeCode/Any_Unknown_IDL_Type.h"
+#include "tao/AnyTypeCode/Any.h"
+#include "tao/AnyTypeCode/TypeCode.h"
+#include "tao/CDR.h"
+#include "tao/SystemException.h"
+
+#include "ace/Auto_Ptr.h"
+#include "ace/OS_NS_string.h"
+
+ACE_RCSID (AnyTypeCode,
+ Any_Basic_Impl,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ Any_Basic_Impl::Any_Basic_Impl (CORBA::TypeCode_ptr tc,
+ void *value)
+ : Any_Impl (0, tc),
+ kind_ (CORBA::tk_null)
+ {
+ ACE_DECLARE_NEW_CORBA_ENV;
+ this->kind_ = TAO::unaliased_kind (tc
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ switch (this->kind_)
+ {
+ case CORBA::tk_short:
+ this->u_.s = *static_cast<CORBA::Short *> (value);
+ break;
+ case CORBA::tk_ushort:
+ this->u_.us = *static_cast<CORBA::UShort *> (value);
+ break;
+ case CORBA::tk_long:
+ this->u_.l = *static_cast<CORBA::Long *> (value);
+ break;
+ case CORBA::tk_ulong:
+ this->u_.ul = *static_cast<CORBA::ULong *> (value);
+ break;
+ case CORBA::tk_float:
+ this->u_.f = *static_cast<CORBA::Float *> (value);
+ break;
+ case CORBA::tk_double:
+ this->u_.d = *static_cast<CORBA::Double *> (value);
+ break;
+ case CORBA::tk_boolean:
+ this->u_.b = *static_cast<CORBA::Boolean *> (value);
+ break;
+ case CORBA::tk_char:
+ this->u_.c = *static_cast<CORBA::Char *> (value);
+ break;
+ case CORBA::tk_octet:
+ this->u_.o = *static_cast<CORBA::Octet *> (value);
+ break;
+ case CORBA::tk_longlong:
+ this->u_.ll = *static_cast<CORBA::LongLong *> (value);
+ break;
+#if !defined (ACE_LACKS_LONGLONG_T)
+ case CORBA::tk_ulonglong:
+ #if !defined (ACE_LACKS_UNSIGNEDLONGLONG_T)
+ this->u_.ull = *static_cast<CORBA::ULongLong *> (value);
+ #else
+ this->u_.ull = *static_cast<CORBA::LongLong *> (value);
+ #endif
+ break;
+#endif
+ case CORBA::tk_longdouble:
+ this->u_.ld = *static_cast<CORBA::LongDouble *> (value);
+ break;
+ case CORBA::tk_wchar:
+ this->u_.wc = *static_cast<CORBA::WChar *> (value);
+ break;
+ default:
+ break;
+ }
+ }
+
+ Any_Basic_Impl::~Any_Basic_Impl (void)
+ {
+ }
+
+ void
+ Any_Basic_Impl::insert (CORBA::Any &any,
+ CORBA::TypeCode_ptr tc,
+ const void *value)
+ {
+ Any_Basic_Impl *new_impl = 0;
+ ACE_NEW (new_impl,
+ Any_Basic_Impl (tc,
+ const_cast<void *> (value)));
+ any.replace (new_impl);
+ }
+
+ CORBA::Boolean
+ Any_Basic_Impl::extract (const CORBA::Any &any,
+ CORBA::TypeCode_ptr tc,
+ void *_tao_elem)
+ {
+ ACE_TRY_NEW_ENV
+ {
+ CORBA::TypeCode_ptr any_tc = any._tao_get_typecode ();
+ CORBA::Boolean _tao_equiv =
+ any_tc->equivalent (tc
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (!_tao_equiv)
+ {
+ return false;
+ }
+
+ TAO::Any_Impl *impl = any.impl ();
+
+ if (!impl->encoded ())
+ {
+ TAO::Any_Basic_Impl *narrow_impl =
+ dynamic_cast<TAO::Any_Basic_Impl *> (impl);
+
+ if (narrow_impl == 0)
+ {
+ return false;
+ }
+
+ Any_Basic_Impl::assign_value (_tao_elem,
+ narrow_impl);
+ return true;
+ }
+
+ TAO::Any_Basic_Impl *replacement =
+ TAO::Any_Basic_Impl::create_empty (any_tc);
+
+ auto_ptr<TAO::Any_Basic_Impl> replacement_safety (replacement);
+
+ // We know this will work since the unencoded case is covered above.
+ TAO::Unknown_IDL_Type *unk =
+ dynamic_cast<TAO::Unknown_IDL_Type *> (impl);
+
+ // Get the kind of the type where we are extracting in ie. the
+ // aliased type if there are any. Passing the aliased kind
+ // will not help.
+ CORBA::TCKind const tck = tc->kind (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ // We don't want the rd_ptr of unk to move, in case it is
+ // shared by another Any. This copies the state, not the buffer.
+ TAO_InputCDR for_reading (unk->_tao_get_cdr ());
+
+ CORBA::Boolean const good_decode =
+ replacement->demarshal_value (for_reading,
+ static_cast<CORBA::Long> (tck));
+
+ if (good_decode)
+ {
+ Any_Basic_Impl::assign_value (_tao_elem,
+ replacement,
+ tck);
+ const_cast<CORBA::Any &> (any).replace (replacement);
+ replacement_safety.release ();
+ return true;
+ }
+
+ // Duplicated by Any_Impl base class constructor.
+ ::CORBA::release (any_tc);
+ }
+ ACE_CATCHANY
+ {
+ }
+ ACE_ENDTRY;
+
+ return false;
+ }
+
+ CORBA::Boolean
+ Any_Basic_Impl::marshal_value (TAO_OutputCDR &cdr)
+ {
+ CORBA::TCKind tckind = static_cast<CORBA::TCKind> (this->kind_);
+
+ switch (tckind)
+ {
+ case CORBA::tk_short:
+ return cdr << this->u_.s;
+ case CORBA::tk_ushort:
+ return cdr << this->u_.us;
+ case CORBA::tk_long:
+ return cdr << this->u_.l;
+ case CORBA::tk_ulong:
+ return cdr << this->u_.ul;
+ case CORBA::tk_float:
+ return cdr << this->u_.f;
+ case CORBA::tk_double:
+ return cdr << this->u_.d;
+ case CORBA::tk_boolean:
+ return cdr << CORBA::Any::from_boolean (this->u_.b);
+ case CORBA::tk_char:
+ return cdr << CORBA::Any::from_char (this->u_.c);
+ case CORBA::tk_octet:
+ return cdr << CORBA::Any::from_octet (this->u_.o);
+ case CORBA::tk_longlong:
+ return cdr << this->u_.ll;
+#if !defined (ACE_LACKS_LONGLONG_T)
+ case CORBA::tk_ulonglong:
+ return cdr << this->u_.ull;
+#endif
+ case CORBA::tk_longdouble:
+ return cdr << this->u_.ld;
+ case CORBA::tk_wchar:
+ return cdr << CORBA::Any::from_wchar (this->u_.wc);
+ default:
+ return 0;
+ }
+ }
+
+ CORBA::Boolean
+ Any_Basic_Impl::demarshal_value (TAO_InputCDR &cdr)
+ {
+ return this->demarshal_value (cdr,
+ this->kind_);
+ }
+
+ CORBA::Boolean
+ Any_Basic_Impl::demarshal_value (TAO_InputCDR &cdr,
+ CORBA::Long tck)
+ {
+ CORBA::TCKind const tckind = static_cast<CORBA::TCKind> (tck);
+ switch (tckind)
+ {
+ case CORBA::tk_short:
+ return cdr >> this->u_.s;
+ case CORBA::tk_ushort:
+ return cdr >> this->u_.us;
+ case CORBA::tk_long:
+ return cdr >> this->u_.l;
+ case CORBA::tk_ulong:
+ return cdr >> this->u_.ul;
+ case CORBA::tk_float:
+ return cdr >> this->u_.f;
+ case CORBA::tk_double:
+ return cdr >> this->u_.d;
+ case CORBA::tk_boolean:
+ return cdr >> CORBA::Any::to_boolean (this->u_.b);
+ case CORBA::tk_char:
+ return cdr >> CORBA::Any::to_char (this->u_.c);
+ case CORBA::tk_octet:
+ return cdr >> CORBA::Any::to_octet (this->u_.o);
+ case CORBA::tk_longlong:
+ return cdr >> this->u_.ll;
+#if !defined (ACE_LACKS_LONGLONG_T)
+ case CORBA::tk_ulonglong:
+ return cdr >> this->u_.ull;
+#endif
+ case CORBA::tk_longdouble:
+ return cdr >> this->u_.ld;
+ case CORBA::tk_wchar:
+ return cdr >> CORBA::Any::to_wchar (this->u_.wc);
+ default:
+ return 0;
+ }
+ }
+
+ void
+ Any_Basic_Impl::_tao_decode (TAO_InputCDR &cdr
+ ACE_ENV_ARG_DECL)
+ {
+ if (! this->demarshal_value (cdr))
+ {
+ ACE_THROW (CORBA::MARSHAL ());
+ }
+ }
+
+ Any_Basic_Impl *
+ Any_Basic_Impl::create_empty (CORBA::TypeCode_ptr tc)
+ {
+ ACE_DECLARE_NEW_CORBA_ENV;
+ CORBA::TCKind const kind = tc->kind (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ TAO::Any_Basic_Impl * retval = 0;
+
+ switch (kind)
+ {
+ case CORBA::tk_longlong:
+ {
+ CORBA::LongLong tmp = ACE_CDR_LONGLONG_INITIALIZER;
+ ACE_NEW_RETURN (retval,
+ TAO::Any_Basic_Impl (tc, &tmp),
+ 0);
+ }
+
+ break;
+ case CORBA::tk_longdouble:
+ {
+ CORBA::LongDouble tmp = ACE_CDR_LONG_DOUBLE_INITIALIZER;
+ ACE_NEW_RETURN (retval,
+ TAO::Any_Basic_Impl (tc, &tmp),
+ 0);
+ }
+
+ break;
+ default:
+ {
+ CORBA::ULongLong tmp = 0;
+ ACE_NEW_RETURN (retval,
+ TAO::Any_Basic_Impl (tc, &tmp),
+ 0);
+ }
+
+ break;
+ }
+
+ return retval;
+ }
+
+ void
+ Any_Basic_Impl::assign_value (void *dest, Any_Basic_Impl *src)
+ {
+ Any_Basic_Impl::assign_value (dest,
+ src,
+ src->kind_);
+ }
+
+ void
+ Any_Basic_Impl::assign_value (void *dest,
+ Any_Basic_Impl *src,
+ CORBA::Long tck)
+ {
+ CORBA::TCKind const kind = static_cast<CORBA::TCKind> (tck);
+
+ switch (kind)
+ {
+ case CORBA::tk_short:
+ *static_cast<CORBA::Short *> (dest) = src->u_.s;
+ break;
+ case CORBA::tk_ushort:
+ *static_cast<CORBA::UShort *> (dest) = src->u_.us;
+ break;
+ case CORBA::tk_long:
+ *static_cast<CORBA::Long *> (dest) = src->u_.l;
+ break;
+ case CORBA::tk_ulong:
+ *static_cast<CORBA::ULong *> (dest) = src->u_.ul;
+ break;
+ case CORBA::tk_float:
+ *static_cast<CORBA::Float *> (dest) = src->u_.f;
+ break;
+ case CORBA::tk_double:
+ *static_cast<CORBA::Double *> (dest) = src->u_.d;
+ break;
+ case CORBA::tk_boolean:
+ *static_cast<CORBA::Boolean *> (dest) = src->u_.b;
+ break;
+ case CORBA::tk_char:
+ *static_cast<CORBA::Char *> (dest) = src->u_.c;
+ break;
+ case CORBA::tk_octet:
+ *static_cast<CORBA::Octet *> (dest) = src->u_.o;
+ break;
+ case CORBA::tk_longlong:
+ *static_cast<CORBA::LongLong *> (dest) = src->u_.ll;
+ break;
+#if !defined (ACE_LACKS_LONGLONG_T)
+ case CORBA::tk_ulonglong:
+ #if !defined (ACE_LACKS_UNSIGNEDLONGLONG_T)
+ *static_cast<CORBA::ULongLong *> (dest) = src->u_.ull;
+ break;
+ #else
+ *static_cast<CORBA::LongLong *> (dest) = src->u_.ull;
+ #endif
+#endif
+ case CORBA::tk_longdouble:
+ *static_cast<CORBA::LongDouble *> (dest) = src->u_.ld;
+ break;
+ case CORBA::tk_wchar:
+ *static_cast<CORBA::WChar *> (dest) = src->u_.wc;
+ break;
+ default:
+ break;
+ }
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/AnyTypeCode/Any_Basic_Impl.h b/TAO/tao/AnyTypeCode/Any_Basic_Impl.h
new file mode 100644
index 00000000000..563a252d54a
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Any_Basic_Impl.h
@@ -0,0 +1,102 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Any_Basic_Impl.h
+ *
+ * $Id$
+ *
+ * @authors Carlos O'Ryan and Jeff Parsons
+ */
+//=============================================================================
+
+#ifndef TAO_ANY_BASIC_IMPL_H
+#define TAO_ANY_BASIC_IMPL_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/AnyTypeCode/Any_Impl.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace CORBA
+{
+ class Any;
+}
+
+namespace TAO
+{
+ /**
+ * @class Any_Basic_Impl
+ *
+ * @brief Non-template class for all the basic types.
+ *
+ */
+ class TAO_AnyTypeCode_Export Any_Basic_Impl : public Any_Impl
+ {
+ public:
+ Any_Basic_Impl (CORBA::TypeCode_ptr,
+ void *value);
+
+ virtual ~Any_Basic_Impl (void);
+
+ static void insert (CORBA::Any &,
+ CORBA::TypeCode_ptr,
+ const void *);
+ static CORBA::Boolean extract (const CORBA::Any &,
+ CORBA::TypeCode_ptr,
+ void *);
+
+ virtual CORBA::Boolean marshal_value (TAO_OutputCDR &);
+
+ CORBA::Boolean demarshal_value (TAO_InputCDR &);
+ CORBA::Boolean demarshal_value (TAO_InputCDR &,
+ CORBA::Long);
+
+ virtual void _tao_decode (TAO_InputCDR &
+ ACE_ENV_ARG_DECL);
+
+ static Any_Basic_Impl *create_empty (CORBA::TypeCode_ptr);
+
+ private:
+ static void assign_value (void *, Any_Basic_Impl *);
+
+ static void assign_value (void *,
+ Any_Basic_Impl *,
+ CORBA::Long tck);
+ private:
+ CORBA::Long kind_;
+ union
+ {
+ CORBA::Short s;
+ CORBA::UShort us;
+ CORBA::Long l;
+ CORBA::ULong ul;
+ CORBA::Float f;
+ CORBA::Double d;
+ CORBA::Boolean b;
+ CORBA::Char c;
+ CORBA::Octet o;
+ CORBA::LongLong ll;
+#if !defined (ACE_LACKS_LONGLONG_T) && !defined (ACE_LACKS_UNSIGNEDLONGLONG_T)
+ CORBA::ULongLong ull;
+#elif defined (ACE_LACKS_UNSIGNEDLONGLONG_T)
+ // Platform has signed long long but not unsigned long long.
+ // Use signed long long as the container.
+ CORBA::LongLong ull;
+#endif
+ CORBA::LongDouble ld;
+ CORBA::WChar wc;
+ }u_;
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_ANY_BASIC_IMPL_H */
diff --git a/TAO/tao/AnyTypeCode/Any_Basic_Impl_T.cpp b/TAO/tao/AnyTypeCode/Any_Basic_Impl_T.cpp
new file mode 100644
index 00000000000..7c892b754d3
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Any_Basic_Impl_T.cpp
@@ -0,0 +1,158 @@
+// $Id$
+
+#ifndef TAO_ANY_BASIC_IMPL_T_CPP
+#define TAO_ANY_BASIC_IMPL_T_CPP
+
+#include "tao/AnyTypeCode/Any_Basic_Impl_T.h"
+#include "tao/AnyTypeCode/Any.h"
+#include "tao/AnyTypeCode/Any_Unknown_IDL_Type.h"
+#include "tao/AnyTypeCode/Marshal.h"
+#include "tao/Environment.h"
+#include "tao/SystemException.h"
+#include "tao/CDR.h"
+
+#include "ace/CORBA_macros.h"
+#include "ace/Auto_Ptr.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/AnyTypeCode/Any_Basic_Impl_T.inl"
+#endif /* ! __ACE_INLINE__ */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template<typename T>
+TAO::Any_Basic_Impl_T<T>::Any_Basic_Impl_T (CORBA::TypeCode_ptr tc,
+ const T & val)
+ : Any_Impl (0,
+ tc),
+ value_ (val)
+{
+}
+
+template<typename T>
+TAO::Any_Basic_Impl_T<T>::~Any_Basic_Impl_T (void)
+{
+}
+
+template<typename T>
+void
+TAO::Any_Basic_Impl_T<T>::insert (CORBA::Any & any,
+ CORBA::TypeCode_ptr tc,
+ const T & value)
+{
+ Any_Basic_Impl_T<T> *new_impl = 0;
+ ACE_NEW (new_impl,
+ Any_Basic_Impl_T (tc,
+ value));
+ any.replace (new_impl);
+}
+
+template<typename T>
+CORBA::Boolean
+TAO::Any_Basic_Impl_T<T>::extract (const CORBA::Any & any,
+ CORBA::TypeCode_ptr tc,
+ T & _tao_elem)
+{
+ ACE_TRY_NEW_ENV
+ {
+ CORBA::TypeCode_ptr any_tc = any._tao_get_typecode ();
+ CORBA::Boolean const _tao_equiv = any_tc->equivalent (tc
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (_tao_equiv == false)
+ {
+ return false;
+ }
+
+ TAO::Any_Impl *impl = any.impl ();
+
+ if (!impl->encoded ())
+ {
+ TAO::Any_Basic_Impl_T<T> *narrow_impl =
+ dynamic_cast <TAO::Any_Basic_Impl_T<T> *> (impl);
+
+ if (narrow_impl == 0)
+ {
+ return false;
+ }
+
+ _tao_elem = narrow_impl->value_;
+ return true;
+ }
+
+ TAO::Any_Basic_Impl_T<T> *replacement =
+ TAO::Any_Basic_Impl_T<T>::create_empty (any_tc);
+
+ auto_ptr<TAO::Any_Basic_Impl_T<T> > replacement_safety (replacement);
+
+ // We know this will work since the unencoded case is covered above.
+ TAO::Unknown_IDL_Type *unk =
+ dynamic_cast<TAO::Unknown_IDL_Type *> (impl);
+
+ // We don't want the rd_ptr of unk to move, in case it is
+ // shared by another Any. This copies the state, not the buffer.
+ TAO_InputCDR for_reading (unk->_tao_get_cdr ());
+
+ CORBA::Boolean const good_decode =
+ replacement->demarshal_value (for_reading);
+
+ if (good_decode)
+ {
+ _tao_elem = replacement->value_;
+ const_cast<CORBA::Any &> (any).replace (replacement);
+ replacement_safety.release ();
+ return true;
+ }
+
+ // Duplicated by Any_Impl base class constructor.
+ ::CORBA::release (any_tc);
+ }
+ ACE_CATCHANY
+ {
+ }
+ ACE_ENDTRY;
+
+ return false;
+}
+
+template<typename T>
+CORBA::Boolean
+TAO::Any_Basic_Impl_T<T>::marshal_value (TAO_OutputCDR &cdr)
+{
+ return (cdr << this->value_);
+}
+
+template<typename T>
+const void *
+TAO::Any_Basic_Impl_T<T>::value (void) const
+{
+ return &this->value_;
+}
+
+template<typename T>
+TAO::Any_Basic_Impl_T<T> *
+TAO::Any_Basic_Impl_T<T>::create_empty (CORBA::TypeCode_ptr tc)
+{
+ TAO::Any_Basic_Impl_T<T> * retval = 0;
+ ACE_NEW_RETURN (retval,
+ TAO::Any_Basic_Impl_T<T> (tc,
+ static_cast<T> (0)),
+ 0);
+ return retval;
+}
+
+template<typename T>
+void
+TAO::Any_Basic_Impl_T<T>::_tao_decode (TAO_InputCDR &cdr
+ ACE_ENV_ARG_DECL)
+{
+ if (! this->demarshal_value (cdr))
+ {
+ ACE_THROW (CORBA::MARSHAL ());
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_ANY_BASIC_IMPL_T_CPP */
diff --git a/TAO/tao/AnyTypeCode/Any_Basic_Impl_T.h b/TAO/tao/AnyTypeCode/Any_Basic_Impl_T.h
new file mode 100644
index 00000000000..aff9109b34b
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Any_Basic_Impl_T.h
@@ -0,0 +1,81 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Any_Basic_Impl_T.h
+ *
+ * $Id$
+ *
+ * @authors Carlos O'Ryan and Jeff Parsons
+ */
+//=============================================================================
+
+
+#ifndef TAO_ANY_BASIC_IMPL_T_H
+#define TAO_ANY_BASIC_IMPL_T_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/AnyTypeCode/Any_Impl.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ /**
+ * @class Any_Basic_Impl_T
+ *
+ * @brief Template Any class for basic types.
+ *
+ * Used for all basic IDL types except bounded (w)strings.
+ */
+ template<typename T>
+ class Any_Basic_Impl_T : public Any_Impl
+ {
+ public:
+ Any_Basic_Impl_T (CORBA::TypeCode_ptr,
+ const T & val);
+ virtual ~Any_Basic_Impl_T (void);
+
+ static void insert (CORBA::Any &,
+ CORBA::TypeCode_ptr,
+ const T &);
+ static CORBA::Boolean extract (const CORBA::Any &,
+ CORBA::TypeCode_ptr,
+ T &);
+
+ virtual CORBA::Boolean marshal_value (TAO_OutputCDR &);
+ CORBA::Boolean demarshal_value (TAO_InputCDR &);
+ virtual void _tao_decode (TAO_InputCDR &
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ virtual const void *value (void) const;
+ static Any_Basic_Impl_T<T> *create_empty (CORBA::TypeCode_ptr);
+
+ private:
+ T value_;
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/AnyTypeCode/Any_Basic_Impl_T.inl"
+#endif /* __ACE_INLINE__ */
+
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+#include "tao/AnyTypeCode/Any_Basic_Impl_T.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
+#pragma implementation ("Any_Basic_Impl_T.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_ANY_BASIC_IMPL_T_H */
+
diff --git a/TAO/tao/AnyTypeCode/Any_Basic_Impl_T.inl b/TAO/tao/AnyTypeCode/Any_Basic_Impl_T.inl
new file mode 100644
index 00000000000..3114614a725
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Any_Basic_Impl_T.inl
@@ -0,0 +1,15 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template<typename T>
+ACE_INLINE
+CORBA::Boolean
+TAO::Any_Basic_Impl_T<T>::demarshal_value (TAO_InputCDR &cdr)
+{
+ return (cdr >> this->value_);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/AnyTypeCode/Any_Dual_Impl_T.cpp b/TAO/tao/AnyTypeCode/Any_Dual_Impl_T.cpp
new file mode 100644
index 00000000000..91dc8bdab29
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Any_Dual_Impl_T.cpp
@@ -0,0 +1,216 @@
+// $Id$
+
+#ifndef TAO_ANY_DUAL_IMPL_T_CPP
+#define TAO_ANY_DUAL_IMPL_T_CPP
+
+#include "tao/AnyTypeCode/Any_Dual_Impl_T.h"
+#include "tao/AnyTypeCode/Any.h"
+#include "tao/AnyTypeCode/Any_Unknown_IDL_Type.h"
+#include "tao/AnyTypeCode/Marshal.h"
+#include "tao/CORBA_String.h"
+#include "tao/Environment.h"
+#include "tao/SystemException.h"
+#include "tao/CDR.h"
+#include "tao/AnyTypeCode/TypeCode.h"
+
+#include "ace/CORBA_macros.h"
+#include "ace/Auto_Ptr.h"
+#include "ace/OS_Memory.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/AnyTypeCode/Any_Dual_Impl_T.inl"
+#endif /* ! __ACE_INLINE__ */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template<typename T>
+TAO::Any_Dual_Impl_T<T>::Any_Dual_Impl_T (_tao_destructor destructor,
+ CORBA::TypeCode_ptr tc,
+ T * const val)
+ : Any_Impl (destructor,
+ tc),
+ value_ (val)
+{
+}
+
+template<typename T> void
+TAO::Any_Dual_Impl_T<T>::value (const T & val)
+{
+ ACE_NEW (this->value_,
+ T (val));
+}
+
+template<typename T>
+TAO::Any_Dual_Impl_T<T>::Any_Dual_Impl_T (_tao_destructor destructor,
+ CORBA::TypeCode_ptr tc,
+ const T & val)
+ : Any_Impl (destructor,
+ tc)
+{
+ this->value (val);
+}
+
+template<typename T>
+TAO::Any_Dual_Impl_T<T>::Any_Dual_Impl_T (CORBA::TypeCode_ptr tc)
+ : Any_Impl (0,
+ tc)
+{
+}
+
+template<typename T>
+TAO::Any_Dual_Impl_T<T>::~Any_Dual_Impl_T (void)
+{
+}
+
+template<typename T>
+void
+TAO::Any_Dual_Impl_T<T>::insert (CORBA::Any & any,
+ _tao_destructor destructor,
+ CORBA::TypeCode_ptr tc,
+ T * const value)
+{
+ Any_Dual_Impl_T<T> *new_impl = 0;
+ ACE_NEW (new_impl,
+ Any_Dual_Impl_T (destructor,
+ tc,
+ value));
+ any.replace (new_impl);
+}
+
+template<typename T>
+void
+TAO::Any_Dual_Impl_T<T>::insert_copy (CORBA::Any & any,
+ _tao_destructor destructor,
+ CORBA::TypeCode_ptr tc,
+ const T & value)
+{
+ Any_Dual_Impl_T<T> *new_impl = 0;
+ ACE_NEW (new_impl,
+ Any_Dual_Impl_T (destructor,
+ tc,
+ value));
+ any.replace (new_impl);
+}
+
+template<typename T>
+CORBA::Boolean
+TAO::Any_Dual_Impl_T<T>::extract (const CORBA::Any & any,
+ _tao_destructor destructor,
+ CORBA::TypeCode_ptr tc,
+ const T *& _tao_elem)
+{
+ _tao_elem = 0;
+
+ ACE_TRY_NEW_ENV
+ {
+ CORBA::TypeCode_ptr any_tc = any._tao_get_typecode ();
+ CORBA::Boolean _tao_equiv = any_tc->equivalent (tc
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (_tao_equiv == false)
+ {
+ return false;
+ }
+
+ TAO::Any_Impl *impl = any.impl ();
+
+ if (!impl->encoded ())
+ {
+ TAO::Any_Dual_Impl_T<T> *narrow_impl =
+ dynamic_cast <TAO::Any_Dual_Impl_T<T> *> (impl);
+
+ if (narrow_impl == 0)
+ {
+ return false;
+ }
+
+ _tao_elem = narrow_impl->value_;
+ return true;
+ }
+
+ T *empty_value = 0;
+ ACE_NEW_RETURN (empty_value,
+ T,
+ false);
+ TAO::Any_Dual_Impl_T<T> *replacement = 0;
+ ACE_NEW_RETURN (replacement,
+ TAO::Any_Dual_Impl_T<T> (destructor,
+ any_tc,
+ empty_value),
+ false);
+
+ auto_ptr<TAO::Any_Dual_Impl_T<T> > replacement_safety (replacement);
+
+ // We know this will work since the unencoded case is covered above.
+ TAO::Unknown_IDL_Type *unk =
+ dynamic_cast<TAO::Unknown_IDL_Type *> (impl);
+
+ // We don't want the rd_ptr of unk to move, in case it is
+ // shared by another Any. This copies the state, not the buffer.
+ TAO_InputCDR for_reading (unk->_tao_get_cdr ());
+
+ CORBA::Boolean const good_decode =
+ replacement->demarshal_value (for_reading);
+
+ if (good_decode)
+ {
+ _tao_elem = replacement->value_;
+ const_cast<CORBA::Any &> (any).replace (replacement);
+ replacement_safety.release ();
+ return true;
+ }
+
+ // Duplicated by Any_Impl base class constructor.
+ ::CORBA::release (any_tc);
+ }
+ ACE_CATCHANY
+ {
+ }
+ ACE_ENDTRY;
+
+ return false;
+}
+
+template<typename T>
+CORBA::Boolean
+TAO::Any_Dual_Impl_T<T>::marshal_value (TAO_OutputCDR &cdr)
+{
+ return (cdr << *this->value_);
+}
+
+template<typename T>
+const void *
+TAO::Any_Dual_Impl_T<T>::value (void) const
+{
+ return this->value_;
+}
+
+template<typename T>
+void
+TAO::Any_Dual_Impl_T<T>::free_value (void)
+{
+ if (this->value_destructor_ != 0)
+ {
+ (*this->value_destructor_) (this->value_);
+ this->value_destructor_ = 0;
+ }
+
+ ::CORBA::release (this->type_);
+ this->value_ = 0;
+}
+
+template<typename T>
+void
+TAO::Any_Dual_Impl_T<T>::_tao_decode (TAO_InputCDR &cdr
+ ACE_ENV_ARG_DECL)
+{
+ if (! this->demarshal_value (cdr))
+ {
+ ACE_THROW (CORBA::MARSHAL ());
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_ANY_DUAL_IMPL_T_CPP */
diff --git a/TAO/tao/AnyTypeCode/Any_Dual_Impl_T.h b/TAO/tao/AnyTypeCode/Any_Dual_Impl_T.h
new file mode 100644
index 00000000000..e09cdad1f77
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Any_Dual_Impl_T.h
@@ -0,0 +1,97 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Any_Dual_Impl_T.h
+ *
+ * $Id$
+ *
+ * @authors Carlos O'Ryan and Jeff Parsons
+ */
+//=============================================================================
+
+
+#ifndef TAO_ANY_DUAL_IMPL_T_H
+#define TAO_ANY_DUAL_IMPL_T_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/AnyTypeCode/Any_Impl.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ /**
+ * @class Any_Dual_Impl_T
+ *
+ * @brief Template Any class for IDL types with 2 modes of insertion
+ *
+ * Used for the IDL types that have copying and non-copying insertion,
+ * but which are not (de)marshaled as pointers - struct, union, sequence,
+ * and exception.
+ */
+ template<typename T>
+ class Any_Dual_Impl_T : public Any_Impl
+ {
+ public:
+ Any_Dual_Impl_T (_tao_destructor destructor,
+ CORBA::TypeCode_ptr,
+ T * const);
+ Any_Dual_Impl_T (_tao_destructor destructor,
+ CORBA::TypeCode_ptr,
+ const T &);
+ Any_Dual_Impl_T (CORBA::TypeCode_ptr);
+ virtual ~Any_Dual_Impl_T (void);
+
+ static void insert (CORBA::Any &,
+ _tao_destructor,
+ CORBA::TypeCode_ptr,
+ T * const);
+ static void insert_copy (CORBA::Any &,
+ _tao_destructor destructor,
+ CORBA::TypeCode_ptr,
+ const T &);
+ static CORBA::Boolean extract (const CORBA::Any &,
+ _tao_destructor,
+ CORBA::TypeCode_ptr,
+ const T *&);
+
+ virtual CORBA::Boolean marshal_value (TAO_OutputCDR &);
+ CORBA::Boolean demarshal_value (TAO_InputCDR &);
+ virtual void _tao_decode (TAO_InputCDR &
+ ACE_ENV_ARG_DECL);
+
+ virtual const void *value (void) const;
+ virtual void free_value (void);
+
+ protected:
+ void value (const T &);
+
+ T * value_;
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/AnyTypeCode/Any_Dual_Impl_T.inl"
+#endif /* __ACE_INLINE__ */
+
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+#include "tao/AnyTypeCode/Any_Dual_Impl_T.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
+#pragma implementation ("Any_Dual_Impl_T.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_ANY_DUAL_IMPL_T_H */
+
diff --git a/TAO/tao/AnyTypeCode/Any_Dual_Impl_T.inl b/TAO/tao/AnyTypeCode/Any_Dual_Impl_T.inl
new file mode 100644
index 00000000000..f1fa29d7a4c
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Any_Dual_Impl_T.inl
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+//
+// $Id$
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template<typename T>
+ACE_INLINE
+CORBA::Boolean
+TAO::Any_Dual_Impl_T<T>::demarshal_value (TAO_InputCDR &cdr)
+{
+ return (cdr >> *this->value_);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/AnyTypeCode/Any_Impl.cpp b/TAO/tao/AnyTypeCode/Any_Impl.cpp
new file mode 100644
index 00000000000..f00e5898d4d
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Any_Impl.cpp
@@ -0,0 +1,140 @@
+// $Id$
+
+#include "tao/AnyTypeCode/Any_Impl.h"
+#include "tao/AnyTypeCode/TypeCode.h"
+#include "tao/AnyTypeCode/Marshal.h"
+
+#include "tao/CORBA_String.h"
+#include "tao/SystemException.h"
+
+#include "ace/Guard_T.h"
+
+ACE_RCSID (AnyTypeCode,
+ Any_Impl,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO::Any_Impl::Any_Impl (_tao_destructor destructor,
+ CORBA::TypeCode_ptr tc,
+ bool encoded)
+ : value_destructor_ (destructor)
+ , type_ (CORBA::TypeCode::_duplicate (tc))
+ , encoded_ (encoded)
+ , refcount_ (1)
+{
+}
+
+TAO::Any_Impl::~Any_Impl (void)
+{
+}
+
+CORBA::Boolean
+TAO::Any_Impl::marshal (TAO_OutputCDR &cdr)
+{
+ if ((cdr << this->type_) == 0)
+ {
+ return false;
+ }
+
+ return this->marshal_value (cdr);
+}
+
+void
+TAO::Any_Impl::free_value (void)
+{
+ // We always have to do this.
+ ::CORBA::release (this->type_);
+}
+
+CORBA::TypeCode_ptr
+TAO::Any_Impl::type (void) const
+{
+ return CORBA::TypeCode::_duplicate (this->type_);
+}
+
+CORBA::TypeCode_ptr
+TAO::Any_Impl::_tao_get_typecode (void) const
+{
+ return this->type_;
+}
+
+void
+TAO::Any_Impl::type (CORBA::TypeCode_ptr tc)
+{
+ ::CORBA::release (this->type_);
+ this->type_ = CORBA::TypeCode::_duplicate (tc);
+}
+
+int
+TAO::Any_Impl::_tao_byte_order (void) const
+{
+ return TAO_ENCAP_BYTE_ORDER;
+}
+
+void
+TAO::Any_Impl::_tao_any_string_destructor (void *x)
+{
+ char *tmp = static_cast<char *> (x);
+ CORBA::string_free (tmp);
+}
+
+void
+TAO::Any_Impl::_tao_any_wstring_destructor (void *x)
+{
+ CORBA::WChar *tmp = static_cast<CORBA::WChar *> (x);
+ CORBA::wstring_free (tmp);
+}
+
+void
+TAO::Any_Impl::_add_ref (void)
+{
+ ++this->refcount_;
+}
+
+void
+TAO::Any_Impl::_remove_ref (void)
+{
+ const CORBA::ULong new_count = --this->refcount_;
+
+ if (new_count != 0)
+ return;
+
+ this->free_value ();
+
+ delete this;
+}
+
+void
+TAO::Any_Impl::_tao_decode (TAO_InputCDR &
+ ACE_ENV_ARG_DECL)
+{
+ ACE_THROW (CORBA::NO_IMPLEMENT ());
+}
+
+CORBA::Boolean
+TAO::Any_Impl::to_object (CORBA::Object_ptr &) const
+{
+ return false;
+}
+
+CORBA::Boolean
+TAO::Any_Impl::to_value (CORBA::ValueBase *&) const
+{
+ return false;
+}
+
+CORBA::Boolean
+TAO::Any_Impl::to_abstract_base (CORBA::AbstractBase_ptr &) const
+{
+ return false;
+}
+
+bool
+TAO::Any_Impl::encoded (void) const
+{
+ return this->encoded_;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/AnyTypeCode/Any_Impl.h b/TAO/tao/AnyTypeCode/Any_Impl.h
new file mode 100644
index 00000000000..0e04ce527b5
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Any_Impl.h
@@ -0,0 +1,121 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Any_Impl.h
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan
+ * @author Jeff Parsons
+ */
+//=============================================================================
+
+#ifndef TAO_ANY_IMPL_H
+#define TAO_ANY_IMPL_H
+
+#include /**/ "ace/pre.h"
+#include "ace/CORBA_macros.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/AnyTypeCode/TAO_AnyTypeCode_Export.h"
+
+#include "tao/Basic_Types.h"
+#include "tao/orbconf.h"
+
+#include "ace/Synch_Traits.h"
+#include "ace/Null_Mutex.h"
+#include "ace/Thread_Mutex.h"
+#include "ace/Atomic_Op.h"
+
+ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+class ACE_Message_Block;
+ACE_END_VERSIONED_NAMESPACE_DECL
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_OutputCDR;
+class TAO_InputCDR;
+
+namespace CORBA
+{
+ class TypeCode;
+ typedef TypeCode *TypeCode_ptr;
+
+ class Object;
+ typedef Object *Object_ptr;
+
+ class ValueBase;
+ class AbstractBase;
+ typedef AbstractBase *AbstractBase_ptr;
+
+ class Environment;
+}
+
+namespace TAO
+{
+ /**
+ * @class Any_Impl
+ *
+ * @brief Base class for the Any template subclasses.
+ *
+ * Contains common functionality and some pure virtual methods.
+ */
+ class TAO_AnyTypeCode_Export Any_Impl
+ {
+ public:
+ /// Generated data types define a 'destructor' function that
+ /// correctly destroys an object stored in an Any.
+ typedef void (*_tao_destructor)(void *);
+
+ CORBA::Boolean marshal (TAO_OutputCDR &);
+ virtual CORBA::Boolean marshal_value (TAO_OutputCDR &) = 0;
+
+ virtual void free_value (void);
+
+ CORBA::TypeCode_ptr type (void) const;
+ CORBA::TypeCode_ptr _tao_get_typecode (void) const;
+ void type (CORBA::TypeCode_ptr);
+
+ virtual int _tao_byte_order (void) const;
+
+ virtual void _add_ref (void);
+ virtual void _remove_ref (void);
+
+ /// Used to release these CORBA basic types.
+ static void _tao_any_string_destructor (void *);
+ static void _tao_any_wstring_destructor (void *);
+
+ virtual void _tao_decode (TAO_InputCDR &
+ ACE_ENV_ARG_DECL);
+
+ virtual CORBA::Boolean to_object (CORBA::Object_ptr &) const;
+ virtual CORBA::Boolean to_value (CORBA::ValueBase *&) const;
+ virtual CORBA::Boolean to_abstract_base (CORBA::AbstractBase_ptr &) const;
+
+ bool encoded (void) const;
+
+ protected:
+ Any_Impl (_tao_destructor,
+ CORBA::TypeCode_ptr,
+ bool encoded = false);
+ virtual ~Any_Impl (void);
+
+ TAO::Any_Impl::_tao_destructor value_destructor_;
+ CORBA::TypeCode_ptr type_;
+ bool encoded_;
+
+ private:
+ /// Reference counter.
+ ACE_Atomic_Op<TAO_SYNCH_MUTEX, unsigned long> refcount_;
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_ANY_IMPL_H */
diff --git a/TAO/tao/AnyTypeCode/Any_Impl_T.cpp b/TAO/tao/AnyTypeCode/Any_Impl_T.cpp
new file mode 100644
index 00000000000..4555bf32e9e
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Any_Impl_T.cpp
@@ -0,0 +1,193 @@
+// $Id$
+
+#ifndef TAO_ANY_IMPL_T_CPP
+#define TAO_ANY_IMPL_T_CPP
+
+#include "tao/AnyTypeCode/Any_Impl_T.h"
+#include "tao/AnyTypeCode/Any_Unknown_IDL_Type.h"
+#include "tao/AnyTypeCode/Marshal.h"
+#include "tao/CDR.h"
+#include "tao/Environment.h"
+#include "tao/SystemException.h"
+#include "tao/AnyTypeCode/TypeCode.h"
+
+#include "ace/CORBA_macros.h"
+#include "ace/Auto_Ptr.h"
+#include "ace/OS_Memory.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/AnyTypeCode/Any_Impl_T.inl"
+#endif /* ! __ACE_INLINE__ */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template<typename T>
+TAO::Any_Impl_T<T>::Any_Impl_T (_tao_destructor destructor,
+ CORBA::TypeCode_ptr tc,
+ T * const val)
+ : Any_Impl (destructor,
+ tc),
+ value_ (val)
+{
+}
+
+template<typename T>
+TAO::Any_Impl_T<T>::~Any_Impl_T (void)
+{
+}
+
+template<typename T>
+void
+TAO::Any_Impl_T<T>::insert (CORBA::Any & any,
+ _tao_destructor destructor,
+ CORBA::TypeCode_ptr tc,
+ T * const value)
+{
+ TAO::Any_Impl_T<T> *new_impl = 0;
+ ACE_NEW (new_impl,
+ TAO::Any_Impl_T<T> (destructor,
+ tc,
+ value));
+ any.replace (new_impl);
+}
+
+template<typename T>
+CORBA::Boolean
+TAO::Any_Impl_T<T>::extract (const CORBA::Any & any,
+ _tao_destructor destructor,
+ CORBA::TypeCode_ptr tc,
+ T *& _tao_elem)
+{
+ _tao_elem = 0;
+
+ ACE_TRY_NEW_ENV
+ {
+ CORBA::TypeCode_ptr any_tc = any._tao_get_typecode ();
+ CORBA::Boolean _tao_equiv = any_tc->equivalent (tc
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (_tao_equiv == 0)
+ {
+ return false;
+ }
+
+ TAO::Any_Impl *impl = any.impl ();
+
+ if (!impl->encoded ())
+ {
+ TAO::Any_Impl_T<T> *narrow_impl =
+ dynamic_cast <TAO::Any_Impl_T<T> *> (impl);
+
+ if (narrow_impl == 0)
+ {
+ return false;
+ }
+
+ _tao_elem = (T *) narrow_impl->value_;
+ return true;
+ }
+
+ TAO::Any_Impl_T<T> *replacement = 0;
+ ACE_NEW_RETURN (replacement,
+ TAO::Any_Impl_T<T> (destructor,
+ any_tc,
+ 0),
+ false);
+
+ auto_ptr<TAO::Any_Impl_T<T> > replacement_safety (replacement);
+
+ // We know this will work since the unencoded case is covered above.
+ TAO::Unknown_IDL_Type *unk =
+ dynamic_cast<TAO::Unknown_IDL_Type *> (impl);
+
+ // We don't want the rd_ptr of unk to move, in case it is
+ // shared by another Any. This copies the state, not the buffer.
+ TAO_InputCDR for_reading (unk->_tao_get_cdr ());
+
+ CORBA::Boolean const good_decode =
+ replacement->demarshal_value (for_reading);
+
+ if (good_decode)
+ {
+ _tao_elem = const_cast<T *> (replacement->value_);
+ const_cast<CORBA::Any &> (any).replace (replacement);
+ replacement_safety.release ();
+ return true;
+ }
+
+ // Duplicated by Any_Impl base class constructor.
+ ::CORBA::release (any_tc);
+ }
+ ACE_CATCHANY
+ {
+ }
+ ACE_ENDTRY;
+
+ return 0;
+}
+
+template<typename T>
+CORBA::Boolean
+TAO::Any_Impl_T<T>::to_object (CORBA::Object_ptr &) const
+{
+ return 0;
+}
+
+template<typename T>
+CORBA::Boolean
+TAO::Any_Impl_T<T>::to_value (CORBA::ValueBase *&) const
+{
+ return 0;
+}
+
+template<typename T>
+
+CORBA::Boolean
+TAO::Any_Impl_T<T>::to_abstract_base (CORBA::AbstractBase_ptr &) const
+{
+ return 0;
+}
+
+template<typename T>
+CORBA::Boolean
+TAO::Any_Impl_T<T>::marshal_value (TAO_OutputCDR &cdr)
+{
+ return (cdr << this->value_);
+}
+
+template<typename T>
+const void *
+TAO::Any_Impl_T<T>::value (void) const
+{
+ return this->value_;
+}
+
+template<typename T>
+void
+TAO::Any_Impl_T<T>::free_value (void)
+{
+ if (this->value_destructor_ != 0)
+ {
+ (*this->value_destructor_) (this->value_);
+ this->value_destructor_ = 0;
+ }
+
+ ::CORBA::release (this->type_);
+ this->value_ = 0;
+}
+
+template<typename T>
+void
+TAO::Any_Impl_T<T>::_tao_decode (TAO_InputCDR &cdr
+ ACE_ENV_ARG_DECL)
+{
+ if (! this->demarshal_value (cdr))
+ {
+ ACE_THROW (CORBA::MARSHAL ());
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_ANY_IMPL_T_CPP */
diff --git a/TAO/tao/AnyTypeCode/Any_Impl_T.h b/TAO/tao/AnyTypeCode/Any_Impl_T.h
new file mode 100644
index 00000000000..bddd912ecc9
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Any_Impl_T.h
@@ -0,0 +1,96 @@
+// This may look like C, but it's really -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Any_Impl_T.h
+ *
+ * $Id$
+ *
+ * @authors Carlos O'Ryan and Jeff Parsons
+ */
+//=============================================================================
+
+
+#ifndef TAO_ANY_IMPL_T_H
+#define TAO_ANY_IMPL_T_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/AnyTypeCode/Any_Impl.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace CORBA
+{
+ class Any;
+ class Environment;
+}
+
+namespace TAO
+{
+ /**
+ * @class Any_Impl_T
+ *
+ * @brief Template Any class for pointer types.
+ *
+ * Used for interfaces and typecodes
+ */
+ template<typename T>
+ class Any_Impl_T : public Any_Impl
+ {
+ public:
+ Any_Impl_T (_tao_destructor destructor,
+ CORBA::TypeCode_ptr,
+ T * const);
+ virtual ~Any_Impl_T (void);
+
+ static void insert (CORBA::Any &,
+ _tao_destructor destructor,
+ CORBA::TypeCode_ptr,
+ T * const);
+ static CORBA::Boolean extract (const CORBA::Any &,
+ _tao_destructor,
+ CORBA::TypeCode_ptr,
+ T *&);
+
+ virtual CORBA::Boolean to_object (CORBA::Object_ptr &) const;
+ virtual CORBA::Boolean to_value (CORBA::ValueBase *&) const;
+ virtual CORBA::Boolean to_abstract_base (CORBA::AbstractBase_ptr &) const;
+
+ virtual CORBA::Boolean marshal_value (TAO_OutputCDR &);
+ CORBA::Boolean demarshal_value (TAO_InputCDR &);
+ virtual void _tao_decode (TAO_InputCDR & ACE_ENV_ARG_DECL);
+ virtual const void *value (void) const;
+ virtual void free_value (void);
+
+ private:
+ T * value_;
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/AnyTypeCode/Any_Impl_T.inl"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#endif /* __ACE_INLINE__ */
+
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+#include "tao/AnyTypeCode/Any_Impl_T.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
+#pragma implementation ("Any_Impl_T.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_ANY_IMPL_T_H */
diff --git a/TAO/tao/AnyTypeCode/Any_Impl_T.inl b/TAO/tao/AnyTypeCode/Any_Impl_T.inl
new file mode 100644
index 00000000000..d459bc57e67
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Any_Impl_T.inl
@@ -0,0 +1,17 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// These three are overridden in generated code where appropriate.
+
+template<typename T>
+ACE_INLINE
+CORBA::Boolean
+TAO::Any_Impl_T<T>::demarshal_value (TAO_InputCDR &cdr)
+{
+ return (cdr >> this->value_);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/AnyTypeCode/Any_Special_Impl_T.cpp b/TAO/tao/AnyTypeCode/Any_Special_Impl_T.cpp
new file mode 100644
index 00000000000..adc32568b3f
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Any_Special_Impl_T.cpp
@@ -0,0 +1,230 @@
+// $Id$
+
+#ifndef TAO_ANY_SPECIAL_IMPL_T_CPP
+#define TAO_ANY_SPECIAL_IMPL_T_CPP
+
+#include "tao/AnyTypeCode/Any_Special_Impl_T.h"
+#include "tao/AnyTypeCode/Any_Unknown_IDL_Type.h"
+#include "tao/AnyTypeCode/Marshal.h"
+#include "tao/Environment.h"
+#include "tao/AnyTypeCode/String_TypeCode_Traits.h"
+
+#include "ace/CORBA_macros.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/AnyTypeCode/Any_Special_Impl_T.inl"
+#endif /* ! __ACE_INLINE__ */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template<typename T, typename from_T, typename to_T>
+TAO::Any_Special_Impl_T<T, from_T, to_T>::Any_Special_Impl_T (
+ _tao_destructor destructor,
+ CORBA::TypeCode_ptr tc,
+ T * const val,
+ CORBA::ULong bound
+ )
+ : Any_Impl (destructor,
+ tc),
+ value_ (val),
+ bound_ (bound)
+{
+}
+
+template<typename T, typename from_T, typename to_T>
+TAO::Any_Special_Impl_T<T, from_T, to_T>::~Any_Special_Impl_T (void)
+{
+}
+
+template<typename T, typename from_T, typename to_T>
+void
+TAO::Any_Special_Impl_T<T, from_T, to_T>::insert (CORBA::Any & any,
+ _tao_destructor destructor,
+ CORBA::TypeCode_ptr tc,
+ T * const value,
+ CORBA::ULong bound
+ )
+{
+ CORBA::TypeCode_var bounded_tc;
+
+ if (bound > 0)
+ {
+ ACE_DECLARE_NEW_CORBA_ENV;
+ CORBA::TCKind const kind = tc->kind (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ bounded_tc =
+ TAO::TypeCodeFactory::String_Traits<from_T>::create_typecode (kind,
+ bound);
+ }
+ else
+ {
+ bounded_tc = CORBA::TypeCode::_duplicate (tc);
+ }
+
+ if (CORBA::is_nil (bounded_tc.in ()))
+ return;
+
+ Any_Special_Impl_T<T, from_T, to_T> * new_impl;
+ ACE_NEW (new_impl,
+ Any_Special_Impl_T (destructor,
+ bounded_tc.in (),
+ value,
+ bound));
+
+ any.replace (new_impl);
+}
+
+template<typename T, typename from_T, typename to_T>
+CORBA::Boolean
+TAO::Any_Special_Impl_T<T, from_T, to_T>::extract (const CORBA::Any & any,
+ _tao_destructor destructor,
+ CORBA::TypeCode_ptr tc,
+ const T *& _tao_elem,
+ CORBA::ULong bound
+ )
+{
+ _tao_elem = 0;
+
+ ACE_TRY_NEW_ENV
+ {
+ CORBA::TypeCode_ptr any_type = any._tao_get_typecode ();
+ CORBA::TypeCode_var unaliased_any_type =
+ TAO::unaliased_typecode (any_type
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ CORBA::TCKind any_kind =
+ unaliased_any_type->kind (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ CORBA::TCKind try_kind = tc->kind (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (any_kind != try_kind)
+ {
+ return false;
+ }
+
+ CORBA::ULong length =
+ unaliased_any_type->length (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (length != bound)
+ {
+ return false;
+ }
+
+ TAO::Any_Impl *impl = any.impl ();
+
+ typedef TAO::Any_Special_Impl_T<T, from_T, to_T>
+ BOUNDED_TSTRING_ANY_IMPL;
+
+ if (!impl->encoded ())
+ {
+ TAO::Any_Special_Impl_T<T, from_T, to_T> *narrow_impl =
+ dynamic_cast <BOUNDED_TSTRING_ANY_IMPL *> (impl);
+
+ if (narrow_impl == 0)
+ {
+ return false;
+ }
+
+ _tao_elem = (T *) narrow_impl->value_;
+ return true;
+ }
+
+ TAO::Any_Special_Impl_T<T, from_T, to_T> *replacement = 0;
+ ACE_NEW_RETURN (replacement,
+ BOUNDED_TSTRING_ANY_IMPL (destructor,
+ tc,
+ 0,
+ bound),
+ false);
+
+ auto_ptr<TAO::Any_Special_Impl_T<T, from_T, to_T> > replacement_safety (
+ replacement
+ );
+
+ // We know this will work since the unencoded case is covered above.
+ TAO::Unknown_IDL_Type *unk =
+ dynamic_cast<TAO::Unknown_IDL_Type *> (impl);
+
+ // We don't want the rd_ptr of unk to move, in case it is
+ // shared by another Any. This copies the state, not the buffer.
+ TAO_InputCDR for_reading (unk->_tao_get_cdr ());
+
+ CORBA::Boolean const good_decode =
+ replacement->demarshal_value (for_reading);
+
+ if (good_decode)
+ {
+ _tao_elem = replacement->value_;
+ const_cast<CORBA::Any &> (any).replace (replacement);
+ replacement_safety.release ();
+ return true;
+ }
+
+ // Duplicated by Any_Impl base class constructor.
+ ::CORBA::release (tc);
+ }
+ ACE_CATCHANY
+ {
+ }
+ ACE_ENDTRY;
+
+ return 0;
+}
+
+template<typename T, typename from_T, typename to_T>
+CORBA::Boolean
+TAO::Any_Special_Impl_T<T, from_T, to_T>::marshal_value (
+ TAO_OutputCDR &cdr
+ )
+{
+ return (cdr << from_T (this->value_, this->bound_));
+}
+
+template<typename T, typename from_T, typename to_T>
+const void *
+TAO::Any_Special_Impl_T<T, from_T, to_T>::value (void) const
+{
+ return this->value_;
+}
+
+template<typename T, typename from_T, typename to_T>
+void
+TAO::Any_Special_Impl_T<T, from_T, to_T>::free_value (void)
+{
+ if (this->value_destructor_ != 0)
+ {
+ (*this->value_destructor_) (this->value_);
+ this->value_destructor_ = 0;
+ }
+
+ ::CORBA::release (this->type_);
+ this->value_ = 0;
+}
+
+template<typename T, typename from_T, typename to_T>
+void
+TAO::Any_Special_Impl_T<T, from_T, to_T>::_tao_decode (
+ TAO_InputCDR &cdr
+ ACE_ENV_ARG_DECL
+ )
+{
+ if (this->value_destructor_ != 0)
+ {
+ (*this->value_destructor_) (this->value_);
+ this->value_ = 0;
+ }
+
+ if (! this->demarshal_value (cdr))
+ {
+ ACE_THROW (CORBA::MARSHAL ());
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_ANY_T_CPP */
diff --git a/TAO/tao/AnyTypeCode/Any_Special_Impl_T.h b/TAO/tao/AnyTypeCode/Any_Special_Impl_T.h
new file mode 100644
index 00000000000..c166c9293ca
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Any_Special_Impl_T.h
@@ -0,0 +1,86 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Any_Special_Impl_T.h
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan and Jeff Parsons
+ */
+//=============================================================================
+
+
+#ifndef TAO_ANY_SPECIAL_IMPL_T_H
+#define TAO_ANY_SPECIAL_IMPL_T_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/AnyTypeCode/Any_Impl.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ /**
+ * @class Any_Special_Impl_T
+ *
+ * @brief Template Any class for bounded IDL (w)strings.
+ */
+ template<typename T, typename from_T, typename to_T>
+ class Any_Special_Impl_T : public Any_Impl
+ {
+ public:
+ Any_Special_Impl_T (_tao_destructor destructor,
+ CORBA::TypeCode_ptr,
+ T * const,
+ CORBA::ULong bound);
+ virtual ~Any_Special_Impl_T (void);
+
+ static void insert (CORBA::Any &,
+ _tao_destructor destructor,
+ CORBA::TypeCode_ptr,
+ T * const,
+ CORBA::ULong bound);
+ static CORBA::Boolean extract (const CORBA::Any &,
+ _tao_destructor,
+ CORBA::TypeCode_ptr,
+ const T *&,
+ CORBA::ULong bound);
+
+ virtual CORBA::Boolean marshal_value (TAO_OutputCDR &);
+ CORBA::Boolean demarshal_value (TAO_InputCDR &);
+ virtual void _tao_decode (TAO_InputCDR &
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ virtual const void *value (void) const;
+ virtual void free_value (void);
+
+ private:
+ T * value_;
+ CORBA::ULong bound_;
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/AnyTypeCode/Any_Special_Impl_T.inl"
+#endif /* __ACE_INLINE__ */
+
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+#include "tao/AnyTypeCode/Any_Special_Impl_T.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
+#pragma implementation ("Any_Special_Impl_T.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_ANY_SPECIAL_IMPL_T_H */
+
diff --git a/TAO/tao/AnyTypeCode/Any_Special_Impl_T.inl b/TAO/tao/AnyTypeCode/Any_Special_Impl_T.inl
new file mode 100644
index 00000000000..257a7681bd9
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Any_Special_Impl_T.inl
@@ -0,0 +1,17 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template<typename T, typename from_T, typename to_T>
+ACE_INLINE
+CORBA::Boolean
+TAO::Any_Special_Impl_T<T, from_T, to_T>::demarshal_value (
+ TAO_InputCDR &cdr
+ )
+{
+ return (cdr >> to_T (this->value_, this->bound_));
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/AnyTypeCode/Any_SystemException.cpp b/TAO/tao/AnyTypeCode/Any_SystemException.cpp
new file mode 100644
index 00000000000..015d7231ce5
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Any_SystemException.cpp
@@ -0,0 +1,210 @@
+// $Id$
+
+#include "tao/AnyTypeCode/Any_SystemException.h"
+#include "tao/AnyTypeCode/Any.h"
+#include "tao/AnyTypeCode/Any_Unknown_IDL_Type.h"
+#include "tao/AnyTypeCode/Marshal.h"
+#include "tao/AnyTypeCode/TypeCode.h"
+
+#include "tao/CDR.h"
+#include "tao/Exception.h"
+#include "tao/Environment.h"
+#include "tao/CORBA_String.h"
+#include "tao/SystemException.h"
+
+#include "ace/Auto_Ptr.h"
+#include "ace/CORBA_macros.h"
+#include "ace/Auto_Ptr.h"
+
+ACE_RCSID (AnyTypeCode,
+ Any_SystemException,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO::Any_SystemException::Any_SystemException (_tao_destructor destructor,
+ CORBA::TypeCode_ptr tc,
+ CORBA::SystemException * const val)
+ : Any_Impl (destructor,
+ tc),
+ value_ (val)
+{
+}
+
+TAO::Any_SystemException::Any_SystemException (_tao_destructor destructor,
+ CORBA::TypeCode_ptr tc,
+ const CORBA::SystemException & val)
+ : Any_Impl (destructor,
+ tc)
+{
+ this->value_ =
+ dynamic_cast <CORBA::SystemException *> (val._tao_duplicate ());
+}
+
+TAO::Any_SystemException::Any_SystemException (CORBA::TypeCode_ptr tc)
+ : Any_Impl (0,
+ tc)
+{
+}
+
+TAO::Any_SystemException::~Any_SystemException (void)
+{
+}
+
+void
+TAO::Any_SystemException::insert (CORBA::Any & any,
+ _tao_destructor destructor,
+ CORBA::TypeCode_ptr tc,
+ CORBA::SystemException * const value)
+{
+ Any_SystemException *new_impl = 0;
+ ACE_NEW (new_impl,
+ Any_SystemException (destructor,
+ tc,
+ value));
+ any.replace (new_impl);
+}
+
+void
+TAO::Any_SystemException::insert_copy (CORBA::Any & any,
+ _tao_destructor destructor,
+ CORBA::TypeCode_ptr tc,
+ const CORBA::SystemException & value)
+{
+ Any_SystemException *new_impl = 0;
+ ACE_NEW (new_impl,
+ Any_SystemException (destructor,
+ tc,
+ value));
+ any.replace (new_impl);
+}
+
+CORBA::Boolean
+TAO::Any_SystemException::extract (const CORBA::Any & any,
+ _tao_destructor destructor,
+ CORBA::TypeCode_ptr tc,
+ const CORBA::SystemException *& _tao_elem,
+ TAO::excp_factory f)
+{
+ _tao_elem = 0;
+
+ ACE_TRY_NEW_ENV
+ {
+ CORBA::TypeCode_ptr any_tc = any._tao_get_typecode ();
+ CORBA::Boolean const _tao_equiv = any_tc->equivalent (tc
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (_tao_equiv == false)
+ {
+ return false;
+ }
+
+ TAO::Any_Impl *impl = any.impl ();
+
+ if (!impl->encoded ())
+ {
+ TAO::Any_SystemException *narrow_impl =
+ dynamic_cast <TAO::Any_SystemException *> (impl);
+
+ if (narrow_impl == 0)
+ {
+ return false;
+ }
+
+ _tao_elem = narrow_impl->value_;
+ return true;
+ }
+
+ CORBA::SystemException *empty_value = (*f) ();
+
+ TAO::Any_SystemException *replacement = 0;
+ ACE_NEW_RETURN (replacement,
+ TAO::Any_SystemException (destructor,
+ any_tc,
+ empty_value),
+ false);
+
+ auto_ptr<TAO::Any_SystemException > replacement_safety (replacement);
+
+ // We know this will work since the unencoded case is covered above.
+ TAO::Unknown_IDL_Type *unk =
+ dynamic_cast<TAO::Unknown_IDL_Type *> (impl);
+
+ // We don't want the rd_ptr of unk to move, in case it is
+ // shared by another Any. This copies the state, not the buffer.
+ TAO_InputCDR for_reading (unk->_tao_get_cdr ());
+
+ CORBA::Boolean const good_decode =
+ replacement->demarshal_value (for_reading);
+
+ if (good_decode)
+ {
+ _tao_elem = replacement->value_;
+ const_cast<CORBA::Any &> (any).replace (replacement);
+ replacement_safety.release ();
+ return true;
+ }
+ }
+ ACE_CATCHANY
+ {
+ }
+ ACE_ENDTRY;
+
+ return 0;
+}
+
+void
+TAO::Any_SystemException::free_value (void)
+{
+ if (this->value_destructor_ != 0)
+ {
+ (*this->value_destructor_) (this->value_);
+ this->value_destructor_ = 0;
+ }
+
+ this->value_ = 0;
+}
+
+const void *
+TAO::Any_SystemException::value (void) const
+{
+ return this->value_;
+}
+
+CORBA::Boolean
+TAO::Any_SystemException::marshal_value (TAO_OutputCDR &cdr)
+{
+ ACE_TRY_NEW_ENV
+ {
+ this->value_->_tao_encode (cdr
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ return true;
+ }
+ ACE_CATCHANY
+ {
+ }
+ ACE_ENDTRY;
+ return false;
+}
+
+CORBA::Boolean
+TAO::Any_SystemException::demarshal_value (TAO_InputCDR &cdr)
+{
+ ACE_TRY_NEW_ENV
+ {
+ this->value_->_tao_decode (cdr
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ return true;
+ }
+ ACE_CATCHANY
+ {
+ }
+ ACE_ENDTRY;
+ return false;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/AnyTypeCode/Any_SystemException.h b/TAO/tao/AnyTypeCode/Any_SystemException.h
new file mode 100644
index 00000000000..a26dacfe1c1
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Any_SystemException.h
@@ -0,0 +1,87 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Any_SystemException.h
+ *
+ * $Id$
+ *
+ * @authors Carlos O'Ryan and Jeff Parsons
+ */
+//=============================================================================
+#ifndef TAO_ANY_SYSTEMEXCEPTION_H
+#define TAO_ANY_SYSTEMEXCEPTION_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/AnyTypeCode/Any_Impl.h"
+#include "tao/SystemException.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace CORBA
+{
+ class Any;
+}
+
+namespace TAO
+{
+ /**
+ * @class Any_SystemException
+ *
+ * @brief Template Any class for IDL types with 2 modes of insertion
+ *
+ * Used for the IDL types that have copying and non-copying insertion,
+ * but which are not (de)marshaled as pointers - struct, union, sequence,
+ * and exception.
+ */
+ class Any_SystemException : public Any_Impl
+ {
+ public:
+ Any_SystemException (_tao_destructor destructor,
+ CORBA::TypeCode_ptr,
+ CORBA::SystemException* const);
+
+ Any_SystemException (_tao_destructor destructor,
+ CORBA::TypeCode_ptr,
+ const CORBA::SystemException &);
+
+ Any_SystemException (CORBA::TypeCode_ptr);
+
+ virtual ~Any_SystemException (void);
+
+ static void insert (CORBA::Any &,
+ _tao_destructor,
+ CORBA::TypeCode_ptr,
+ CORBA::SystemException * const);
+
+ static void insert_copy (CORBA::Any &,
+ _tao_destructor destructor,
+ CORBA::TypeCode_ptr,
+ const CORBA::SystemException &);
+
+ static CORBA::Boolean extract (const CORBA::Any &,
+ _tao_destructor,
+ CORBA::TypeCode_ptr,
+ const CORBA::SystemException *&,
+ excp_factory f);
+
+ virtual CORBA::Boolean marshal_value (TAO_OutputCDR &);
+ CORBA::Boolean demarshal_value (TAO_InputCDR &);
+
+ virtual const void *value (void) const;
+ virtual void free_value (void);
+
+ protected:
+ CORBA::SystemException *value_;
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /*TAO_ANY_SYSTEMEXCEPTION_H*/
diff --git a/TAO/tao/AnyTypeCode/Any_Unknown_IDL_Type.cpp b/TAO/tao/AnyTypeCode/Any_Unknown_IDL_Type.cpp
new file mode 100644
index 00000000000..e9a050dde77
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Any_Unknown_IDL_Type.cpp
@@ -0,0 +1,311 @@
+// $Id$
+
+#include "tao/AnyTypeCode/Any_Unknown_IDL_Type.h"
+#include "tao/AnyTypeCode/Marshal.h"
+#include "tao/AnyTypeCode/TypeCode.h"
+#include "tao/Valuetype_Adapter.h"
+#include "tao/ORB_Core.h"
+#include "tao/SystemException.h"
+#include "tao/CDR.h"
+
+#include "ace/Dynamic_Service.h"
+#include "ace/OS_NS_string.h"
+
+ACE_RCSID (AnyTypeCode,
+ Any_Unknown_IDL_Type,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+
+ACE_Lock *
+TAO::Unknown_IDL_Type::lock_i (void)
+{
+ static ACE_Auto_Ptr<ACE_Lock> lock_ (new ACE_Lock_Adapter<TAO_SYNCH_MUTEX>());
+ return lock_.get ();
+}
+
+TAO::Unknown_IDL_Type::Unknown_IDL_Type (
+ CORBA::TypeCode_ptr tc,
+ TAO_InputCDR &cdr
+ )
+ : TAO::Any_Impl (0, tc, true)
+ , cdr_ (static_cast<ACE_Message_Block*>(0), lock_i ())
+{
+ ACE_TRY_NEW_ENV
+ {
+ this->_tao_decode (cdr ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCH (CORBA::Exception, ex)
+ {
+ }
+ ACE_ENDTRY;
+}
+
+TAO::Unknown_IDL_Type::Unknown_IDL_Type (
+ CORBA::TypeCode_ptr tc
+ )
+ : TAO::Any_Impl (0, tc, true)
+ , cdr_ (static_cast<ACE_Message_Block*>(0), lock_i ())
+{
+}
+
+TAO::Unknown_IDL_Type::~Unknown_IDL_Type (void)
+{
+}
+
+CORBA::Boolean
+TAO::Unknown_IDL_Type::marshal_value (TAO_OutputCDR &cdr)
+{
+ ACE_TRY_NEW_ENV
+ {
+ // We don't want the rd_ptr to move, in case we are shared by
+ // another Any, so we use this to copy the state, not the buffer.
+ TAO_InputCDR for_reading (this->cdr_);
+
+ TAO::traverse_status status =
+ TAO_Marshal_Object::perform_append (this->type_,
+ &for_reading,
+ &cdr
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (status != TAO::TRAVERSE_CONTINUE)
+ {
+ return false;
+ }
+ }
+ ACE_CATCH (CORBA::Exception, ex)
+ {
+ return false;
+ }
+ ACE_ENDTRY;
+
+ return true;
+}
+
+const void *
+TAO::Unknown_IDL_Type::value (void) const
+{
+ return this->cdr_.start ();
+}
+
+void
+TAO::Unknown_IDL_Type::free_value (void)
+{
+ ::CORBA::release (this->type_);
+}
+
+TAO_InputCDR &
+TAO::Unknown_IDL_Type::_tao_get_cdr (void)
+{
+ return this->cdr_;
+}
+
+int
+TAO::Unknown_IDL_Type::_tao_byte_order (void) const
+{
+ return this->cdr_.byte_order ();
+}
+void
+TAO::Unknown_IDL_Type::_tao_decode (TAO_InputCDR &cdr
+ ACE_ENV_ARG_DECL)
+{
+ // @@ (JP) The following code depends on the fact that
+ // TAO_InputCDR does not contain chained message blocks,
+ // otherwise <begin> and <end> could be part of
+ // different buffers!
+
+ // This will be the start of a new message block.
+ char *begin = cdr.rd_ptr ();
+
+ // Skip over the next argument.
+ TAO::traverse_status status =
+ TAO_Marshal_Object::perform_skip (this->type_,
+ &cdr
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (status != TAO::TRAVERSE_CONTINUE)
+ {
+ ACE_THROW (CORBA::MARSHAL ());
+ }
+
+ // This will be the end of the new message block.
+ char *end = cdr.rd_ptr ();
+
+ // The ACE_CDR::mb_align() call can shift the rd_ptr by up to
+ // ACE_CDR::MAX_ALIGNMENT - 1 bytes. Similarly, the offset adjustment
+ // can move the rd_ptr by up to the same amount. We accommodate
+ // this by including 2 * ACE_CDR::MAX_ALIGNMENT bytes of additional
+ // space in the message block.
+ size_t const size = end - begin;
+
+ ACE_Message_Block new_mb (size + 2 * ACE_CDR::MAX_ALIGNMENT);
+
+ ACE_CDR::mb_align (&new_mb);
+ ptrdiff_t offset = ptrdiff_t (begin) % ACE_CDR::MAX_ALIGNMENT;
+
+ if (offset < 0)
+ {
+ offset += ACE_CDR::MAX_ALIGNMENT;
+ }
+
+ new_mb.rd_ptr (offset);
+ new_mb.wr_ptr (offset + size);
+
+ ACE_OS::memcpy (new_mb.rd_ptr (),
+ begin,
+ size);
+
+ this->cdr_.reset (&new_mb, cdr.byte_order ());
+ this->cdr_.char_translator (cdr.char_translator ());
+ this->cdr_.wchar_translator (cdr.wchar_translator ());
+
+ // Take over the GIOP version, the input cdr can have a different
+ // version then our current GIOP version.
+ ACE_CDR::Octet major_version;
+ ACE_CDR::Octet minor_version;
+ cdr.get_version (major_version, minor_version);
+ this->cdr_.set_version (major_version, minor_version);
+}
+
+CORBA::Boolean
+TAO::Unknown_IDL_Type::to_object (CORBA::Object_ptr &obj) const
+{
+ ACE_TRY_NEW_ENV
+ {
+ CORBA::ULong kind =
+ this->type_->kind (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ CORBA::TypeCode_var tcvar =
+ CORBA::TypeCode::_duplicate (this->type_);
+
+ while (kind == CORBA::tk_alias)
+ {
+ tcvar = tcvar->content_type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ kind = tcvar->kind (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+
+ if (kind != CORBA::tk_objref)
+ {
+ return 0;
+ }
+
+ return this->cdr_ >> obj;
+ }
+ ACE_CATCH (CORBA::Exception, ex)
+ {
+ }
+ ACE_ENDTRY;
+
+ return 0;
+}
+
+CORBA::Boolean
+TAO::Unknown_IDL_Type::to_value (CORBA::ValueBase *&val) const
+{
+ ACE_TRY_NEW_ENV
+ {
+ CORBA::ULong kind =
+ this->type_->kind (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ CORBA::TypeCode_var tcvar =
+ CORBA::TypeCode::_duplicate (this->type_);
+
+ while (kind == CORBA::tk_alias)
+ {
+ tcvar = tcvar->content_type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ kind = tcvar->kind (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+
+ if (kind != CORBA::tk_value)
+ {
+ return 0;
+ }
+
+ TAO_ORB_Core *orb_core = this->cdr_.orb_core ();
+ if (orb_core == 0)
+ {
+ orb_core = TAO_ORB_Core_instance ();
+
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_WARNING,
+ "TAO (%P|%t) WARNING: extracting "
+ "valuetype using default ORB_Core\n"));
+ }
+ }
+
+ TAO_Valuetype_Adapter *adapter = orb_core->valuetype_adapter();
+ return adapter->stream_to_value (this->cdr_, val);
+ }
+ ACE_CATCH (CORBA::Exception, ex)
+ {
+ }
+ ACE_ENDTRY;
+
+ return 0;
+}
+
+CORBA::Boolean
+TAO::Unknown_IDL_Type::to_abstract_base (CORBA::AbstractBase_ptr &obj) const
+{
+ ACE_TRY_NEW_ENV
+ {
+ CORBA::ULong kind =
+ this->type_->kind (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ CORBA::TypeCode_var tcvar =
+ CORBA::TypeCode::_duplicate (this->type_);
+
+ while (kind == CORBA::tk_alias)
+ {
+ tcvar = tcvar->content_type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ kind = tcvar->kind (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+
+ if (kind != CORBA::tk_value)
+ {
+ return 0;
+ }
+
+ TAO_ORB_Core *orb_core = this->cdr_.orb_core ();
+ if (orb_core == 0)
+ {
+ orb_core = TAO_ORB_Core_instance ();
+
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_WARNING,
+ "TAO (%P|%t) WARNING: extracting "
+ "valuetype using default ORB_Core\n"));
+ }
+ }
+
+ TAO_Valuetype_Adapter *adapter = orb_core->valuetype_adapter();
+ return adapter->stream_to_abstract_base (this->cdr_,
+ obj);
+ }
+ ACE_CATCH (CORBA::Exception, ex)
+ {
+ }
+ ACE_ENDTRY;
+
+ return 0;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/AnyTypeCode/Any_Unknown_IDL_Type.h b/TAO/tao/AnyTypeCode/Any_Unknown_IDL_Type.h
new file mode 100644
index 00000000000..063fb77aeba
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Any_Unknown_IDL_Type.h
@@ -0,0 +1,89 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Any_Unknown_IDL_Type.h
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan
+ * @author Jeff Parsons
+ */
+//=============================================================================
+
+#ifndef TAO_ANY_UNKNOWN_IDL_TYPE_H
+#define TAO_ANY_UNKNOWN_IDL_TYPE_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/AnyTypeCode/Any_Impl.h"
+#include "tao/CDR.h"
+
+#include "ace/Auto_Ptr.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ /**
+ * @class Unknown_IDL_Type
+ *
+ * @brief CDR-based Any impl class.
+ *
+ * Used when demarshaling an Any, and with DII/DSI, and Dynamic Anys.
+ */
+ class TAO_AnyTypeCode_Export Unknown_IDL_Type : public Any_Impl
+ {
+ public:
+ Unknown_IDL_Type (CORBA::TypeCode_ptr,
+ TAO_InputCDR &cdr);
+
+ Unknown_IDL_Type (CORBA::TypeCode_ptr);
+
+ virtual ~Unknown_IDL_Type (void);
+
+ virtual CORBA::Boolean marshal_value (TAO_OutputCDR &);
+ virtual const void *value (void) const;
+ virtual void free_value (void);
+
+ virtual TAO_InputCDR &_tao_get_cdr (void);
+ virtual int _tao_byte_order (void) const;
+
+ virtual void _tao_decode (TAO_InputCDR &
+ ACE_ENV_ARG_DECL);
+
+ virtual CORBA::Boolean to_object (CORBA::Object_ptr &) const;
+ virtual CORBA::Boolean to_value (CORBA::ValueBase *&) const;
+ virtual CORBA::Boolean to_abstract_base (CORBA::AbstractBase_ptr &) const;
+
+ private:
+ // We make the lock global, so that it won't be deleted when shared.
+ // For instance, see Any_Basic_Impl::extract() which copies the insides
+ // from an Unknown_IDL_Type to an Any_Basic_Impl.
+
+ // [Iliyan] However, having a global static makes this a subject
+ // to the whim of the specific compiler implentation. It is the
+ // one deciding the order in which our instance is initialized and
+ // destroyed and that is boundto be a problem
+ // somewhere. Typically, it becomes a problem when a code that
+ // depends on that instance finds that the runtime has already
+ // destroyed it. The scenario plays allmost always in the process
+ // shutdown code, after main() exits, having to debug which is a
+ // lot of fun :) ... Bottom line, use a static function, which
+ // encapsulates a local static initializer, guaranteed to be
+ // initialized at the first invocation.
+ static ACE_Lock *lock_i (void);
+
+ mutable TAO_InputCDR cdr_;
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_ANY_UNKNOWN_IDL_TYPE_H */
diff --git a/TAO/tao/AnyTypeCode/Bounds.pidl b/TAO/tao/AnyTypeCode/Bounds.pidl
new file mode 100644
index 00000000000..f0155c854ab
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Bounds.pidl
@@ -0,0 +1,45 @@
+/**
+ * @file Bounds.pidl
+ *
+ * $Id$
+ *
+ * @brief Pre-compiled IDL source for the CORBA::Bounds
+ * exception.
+ *
+ * This file is used to generate BoundsC.{h,inl,cpp}, using the
+ * following command:
+ *
+ * tao_idl
+ * -o orig -Ge 1 -GA -Sci
+ * -Wb,export_macro=TAO_Export
+ * -Wb,export_include=TAO_Export.h
+ * -Wb,pre_include="ace/pre.h"
+ * -Wb,post_include="ace/post.h"
+ * -Wb,versioning_begin=TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+ * -Wb,versioning_end=TAO_END_VERSIONED_NAMESPACE_DECL
+ * Bounds.pidl
+ *
+ * and then:
+ *
+ * cp orig/BoundsC.{h,cpp} .
+ *
+ */
+#ifndef TAO_CORBA_BOUNDS_PIDL
+#define TAO_CORBA_BOUNDS_PIDL
+
+#pragma prefix "omg.org"
+
+module CORBA
+{
+ /**
+ * @exception Bounds
+ *
+ * @brief UserException for NVList::item()
+ *
+ * This exception is thrown on attempts to access 'out of bounds'
+ * items in an NVList.
+ */
+ exception Bounds {};
+};
+
+#endif /* TAO_CORBA_BOUNDS_PIDL */
diff --git a/TAO/tao/AnyTypeCode/DomainA.cpp b/TAO/tao/AnyTypeCode/DomainA.cpp
new file mode 100644
index 00000000000..6f6db000bc2
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/DomainA.cpp
@@ -0,0 +1,300 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+#include "tao/AnyTypeCode/DomainA.h"
+#include "tao/AnyTypeCode/Null_RefCount_Policy.h"
+#include "tao/AnyTypeCode/TypeCode_Constants.h"
+#include "tao/AnyTypeCode/Alias_TypeCode_Static.h"
+#include "tao/AnyTypeCode/Objref_TypeCode_Static.h"
+#include "tao/AnyTypeCode/Sequence_TypeCode_Static.h"
+#include "tao/CDR.h"
+#include "tao/AnyTypeCode/Any.h"
+#include "tao/AnyTypeCode/Any_Impl_T.h"
+#include "tao/AnyTypeCode/Any_Dual_Impl_T.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/objref_typecode.cpp:76
+
+static TAO::TypeCode::Objref<char const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_CORBA_DomainManager (
+ CORBA::tk_objref,
+ "IDL:omg.org/CORBA/DomainManager:1.0",
+ "DomainManager");
+
+namespace CORBA
+{
+ ::CORBA::TypeCode_ptr const _tc_DomainManager =
+ &_tao_tc_CORBA_DomainManager;
+}
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/objref_typecode.cpp:76
+
+static TAO::TypeCode::Objref<char const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_CORBA_ConstructionPolicy (
+ CORBA::tk_objref,
+ "IDL:omg.org/CORBA/ConstructionPolicy:1.0",
+ "ConstructionPolicy");
+
+namespace CORBA
+{
+ ::CORBA::TypeCode_ptr const _tc_ConstructionPolicy =
+ &_tao_tc_CORBA_ConstructionPolicy;
+}
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/alias_typecode.cpp:50
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/typecode_defn.cpp:937
+
+
+#ifndef _TAO_TYPECODE_CORBA_DomainManagerList_GUARD
+#define _TAO_TYPECODE_CORBA_DomainManagerList_GUARD
+namespace TAO
+{
+ namespace TypeCode
+ {
+ TAO::TypeCode::Sequence< ::CORBA::TypeCode_ptr const *,
+ TAO::Null_RefCount_Policy>
+ CORBA_DomainManagerList_0 (
+ CORBA::tk_sequence,
+ &CORBA::_tc_DomainManager,
+ 0U);
+
+ ::CORBA::TypeCode_ptr const tc_CORBA_DomainManagerList_0 =
+ &CORBA_DomainManagerList_0;
+
+ }
+}
+
+
+#endif /* _TAO_TYPECODE_CORBA_DomainManagerList_GUARD */
+
+static TAO::TypeCode::Alias<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_CORBA_DomainManagerList (
+ CORBA::tk_alias,
+ "IDL:omg.org/CORBA/DomainManagerList:1.0",
+ "DomainManagerList",
+ &TAO::TypeCode::tc_CORBA_DomainManagerList_0);
+
+namespace CORBA
+{
+ ::CORBA::TypeCode_ptr const _tc_DomainManagerList =
+ &_tao_tc_CORBA_DomainManagerList;
+}
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/any_op_cs.cpp:50
+
+namespace TAO
+{
+ template<>
+ CORBA::Boolean
+ Any_Impl_T<CORBA::DomainManager>::to_object (
+ CORBA::Object_ptr &_tao_elem
+ ) const
+ {
+ _tao_elem = CORBA::Object::_duplicate (this->value_);
+ return true;
+ }
+}
+
+// Copying insertion.
+void
+operator<<= (
+ CORBA::Any &_tao_any,
+ CORBA::DomainManager_ptr _tao_elem
+ )
+{
+ CORBA::DomainManager_ptr _tao_objptr =
+ CORBA::DomainManager::_duplicate (_tao_elem);
+ _tao_any <<= &_tao_objptr;
+}
+
+// Non-copying insertion.
+void
+operator<<= (
+ CORBA::Any &_tao_any,
+ CORBA::DomainManager_ptr *_tao_elem
+ )
+{
+ TAO::Any_Impl_T<CORBA::DomainManager>::insert (
+ _tao_any,
+ CORBA::DomainManager::_tao_any_destructor,
+ CORBA::_tc_DomainManager,
+ *_tao_elem
+ );
+}
+
+CORBA::Boolean
+operator>>= (
+ const CORBA::Any &_tao_any,
+ CORBA::DomainManager_ptr &_tao_elem
+ )
+{
+ return
+ TAO::Any_Impl_T<CORBA::DomainManager>::extract (
+ _tao_any,
+ CORBA::DomainManager::_tao_any_destructor,
+ CORBA::_tc_DomainManager,
+ _tao_elem
+ );
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/any_op_cs.cpp:50
+
+namespace TAO
+{
+ template<>
+ CORBA::Boolean
+ Any_Impl_T<CORBA::ConstructionPolicy>::to_object (
+ CORBA::Object_ptr &_tao_elem
+ ) const
+ {
+ _tao_elem = CORBA::Object::_duplicate (this->value_);
+ return true;
+ }
+}
+
+// Copying insertion.
+void
+operator<<= (
+ CORBA::Any &_tao_any,
+ CORBA::ConstructionPolicy_ptr _tao_elem
+ )
+{
+ CORBA::ConstructionPolicy_ptr _tao_objptr =
+ CORBA::ConstructionPolicy::_duplicate (_tao_elem);
+ _tao_any <<= &_tao_objptr;
+}
+
+// Non-copying insertion.
+void
+operator<<= (
+ CORBA::Any &_tao_any,
+ CORBA::ConstructionPolicy_ptr *_tao_elem
+ )
+{
+ TAO::Any_Impl_T<CORBA::ConstructionPolicy>::insert (
+ _tao_any,
+ CORBA::ConstructionPolicy::_tao_any_destructor,
+ CORBA::_tc_ConstructionPolicy,
+ *_tao_elem
+ );
+}
+
+CORBA::Boolean
+operator>>= (
+ const CORBA::Any &_tao_any,
+ CORBA::ConstructionPolicy_ptr &_tao_elem
+ )
+{
+ return
+ TAO::Any_Impl_T<CORBA::ConstructionPolicy>::extract (
+ _tao_any,
+ CORBA::ConstructionPolicy::_tao_any_destructor,
+ CORBA::_tc_ConstructionPolicy,
+ _tao_elem
+ );
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_sequence/any_op_cs.cpp:54
+
+
+// Copying insertion.
+void operator<<= (
+ CORBA::Any &_tao_any,
+ const CORBA::DomainManagerList &_tao_elem
+ )
+{
+ TAO::Any_Dual_Impl_T<CORBA::DomainManagerList>::insert_copy (
+ _tao_any,
+ CORBA::DomainManagerList::_tao_any_destructor,
+ TAO::TypeCode::tc_CORBA_DomainManagerList_0,
+ _tao_elem
+ );
+}
+
+// Non-copying insertion.
+void operator<<= (
+ CORBA::Any &_tao_any,
+ CORBA::DomainManagerList *_tao_elem
+ )
+{
+ TAO::Any_Dual_Impl_T<CORBA::DomainManagerList>::insert (
+ _tao_any,
+ CORBA::DomainManagerList::_tao_any_destructor,
+ TAO::TypeCode::tc_CORBA_DomainManagerList_0,
+ _tao_elem
+ );
+}
+
+// Extraction to non-const pointer (deprecated).
+CORBA::Boolean operator>>= (
+ const CORBA::Any &_tao_any,
+ CORBA::DomainManagerList *&_tao_elem
+ )
+{
+ return _tao_any >>= const_cast<
+ const CORBA::DomainManagerList *&> (
+ _tao_elem
+ );
+}
+
+// Extraction to const pointer.
+CORBA::Boolean operator>>= (
+ const CORBA::Any &_tao_any,
+ const CORBA::DomainManagerList *&_tao_elem
+ )
+{
+ return
+ TAO::Any_Dual_Impl_T<CORBA::DomainManagerList>::extract (
+ _tao_any,
+ CORBA::DomainManagerList::_tao_any_destructor,
+ TAO::TypeCode::tc_CORBA_DomainManagerList_0,
+ _tao_elem
+ );
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/AnyTypeCode/DomainA.h b/TAO/tao/AnyTypeCode/DomainA.h
new file mode 100644
index 00000000000..72c5b0f95ac
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/DomainA.h
@@ -0,0 +1,136 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:153
+
+#ifndef _TAO_IDL_ORIG_DOMAINA_H_
+#define _TAO_IDL_ORIG_DOMAINA_H_
+
+#include /**/ "ace/pre.h"
+
+
+#include "ace/config-all.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/AnyTypeCode/TAO_AnyTypeCode_Export.h"
+#include "tao/AnyTypeCode/AnyTypeCode_methods.h"
+#include "tao/DomainC.h"
+
+#if defined (TAO_EXPORT_MACRO)
+#undef TAO_EXPORT_MACRO
+#endif
+#define TAO_EXPORT_MACRO TAO_AnyTypeCode_Export
+
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+#if defined (__BORLANDC__)
+#pragma option push -w-rvl -w-rch -w-ccc -w-inl
+#endif /* __BORLANDC__ */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// TAO_IDL - Generated from
+// be\be_visitor_root/root_ch.cpp:62
+
+namespace TAO
+{
+ class Collocation_Proxy_Broker;
+ template<typename T> class Narrow_Utils;
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_module/module_ch.cpp:48
+
+namespace CORBA
+{
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:44
+
+ extern TAO_AnyTypeCode_Export ::CORBA::TypeCode_ptr const _tc_DomainManager;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:44
+
+ extern TAO_AnyTypeCode_Export ::CORBA::TypeCode_ptr const _tc_ConstructionPolicy;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:44
+
+ extern TAO_AnyTypeCode_Export ::CORBA::TypeCode_ptr const _tc_DomainManagerList;
+
+// TAO_IDL - Generated from
+// be\be_visitor_module/module_ch.cpp:66
+
+} // module CORBA
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/any_op_ch.cpp:52
+
+TAO_AnyTypeCode_Export void operator<<= (CORBA::Any &, CORBA::DomainManager_ptr); // copying
+TAO_AnyTypeCode_Export void operator<<= (CORBA::Any &, CORBA::DomainManager_ptr *); // non-copying
+TAO_AnyTypeCode_Export CORBA::Boolean operator>>= (const CORBA::Any &, CORBA::DomainManager_ptr &);
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/any_op_ch.cpp:52
+
+TAO_AnyTypeCode_Export void operator<<= (CORBA::Any &, CORBA::ConstructionPolicy_ptr); // copying
+TAO_AnyTypeCode_Export void operator<<= (CORBA::Any &, CORBA::ConstructionPolicy_ptr *); // non-copying
+TAO_AnyTypeCode_Export CORBA::Boolean operator>>= (const CORBA::Any &, CORBA::ConstructionPolicy_ptr &);
+
+// TAO_IDL - Generated from
+// be\be_visitor_sequence/any_op_ch.cpp:52
+
+TAO_AnyTypeCode_Export void operator<<= (CORBA::Any &, const CORBA::DomainManagerList &); // copying version
+TAO_AnyTypeCode_Export void operator<<= (CORBA::Any &, CORBA::DomainManagerList*); // noncopying version
+TAO_AnyTypeCode_Export CORBA::Boolean operator>>= (const CORBA::Any &, CORBA::DomainManagerList *&); // deprecated
+TAO_AnyTypeCode_Export CORBA::Boolean operator>>= (const CORBA::Any &, const CORBA::DomainManagerList *&);
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:955
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#if defined (__BORLANDC__)
+#pragma option pop
+#endif /* __BORLANDC__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* ifndef */
+
+
diff --git a/TAO/tao/AnyTypeCode/Dynamic.pidl b/TAO/tao/AnyTypeCode/Dynamic.pidl
new file mode 100644
index 00000000000..48bd24f4971
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Dynamic.pidl
@@ -0,0 +1,52 @@
+// -*- IDL -*-
+
+// ================================================================
+/**
+ * @file Dynamic.pidl
+ *
+ * $Id$
+ *
+ * This file was used to generate the code in DynamicC.* The command
+ * used to generate code is:
+ *
+ * tao_idl
+ * -o orig -Ge 1 -GA -SS -Sci
+ * -Wb,export_macro=TAO_Export
+ * -Wb,export_include="tao/TAO_Export.h"
+ * -Wb,pre_include="ace/pre.h"
+ * -Wb,post_include="ace/post.h"
+ * -Wb,versioning_begin=TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+ * -Wb,versioning_end=TAO_END_VERSIONED_NAMESPACE_DECL
+ * Dynamic.pidl
+ *
+ */
+// ================================================================
+
+// File: Dynamic.idl
+// Used primarily for Interceptors
+
+#include "tao/AnyTypeCode/Dynamic_Parameter.pidl"
+#include "tao/StringSeq.pidl"
+
+#ifndef _DYNAMIC_IDL_
+#define _DYNAMIC_IDL_
+
+module CORBA
+{
+ interface TypeCode;
+};
+
+module Dynamic
+{
+ typeprefix Dynamic "omg.org";
+
+ typedef sequence<Parameter> ParameterList;
+
+ typedef CORBA::StringSeq ContextList;
+
+ typedef sequence<CORBA::TypeCode> ExceptionList;
+
+ typedef CORBA::StringSeq RequestContext;
+};
+
+#endif // _DYNAMIC_IDL_
diff --git a/TAO/tao/AnyTypeCode/DynamicA.cpp b/TAO/tao/AnyTypeCode/DynamicA.cpp
new file mode 100644
index 00000000000..4f17ea24008
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/DynamicA.cpp
@@ -0,0 +1,291 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+#include "tao/AnyTypeCode/DynamicA.h"
+#include "tao/AnyTypeCode/Null_RefCount_Policy.h"
+#include "tao/AnyTypeCode/TypeCode_Constants.h"
+#include "tao/AnyTypeCode/Alias_TypeCode_Static.h"
+#include "tao/AnyTypeCode/Sequence_TypeCode_Static.h"
+#include "tao/AnyTypeCode/String_TypeCode_Static.h"
+#include "tao/CDR.h"
+#include "tao/AnyTypeCode/Any.h"
+#include "tao/AnyTypeCode/Any_Dual_Impl_T.h"
+
+#include "tao/AnyTypeCode/StringSeqA.h"
+#include "tao/AnyTypeCode/Dynamic_ParameterA.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+#ifndef _TAO_TYPECODE_Dynamic_ParameterList_GUARD
+#define _TAO_TYPECODE_Dynamic_ParameterList_GUARD
+namespace TAO
+{
+ namespace TypeCode
+ {
+ TAO::TypeCode::Sequence< ::CORBA::TypeCode_ptr const *,
+ TAO::Null_RefCount_Policy>
+ Dynamic_ParameterList_0 (
+ CORBA::tk_sequence,
+ &Dynamic::_tc_Parameter,
+ 0U);
+
+ ::CORBA::TypeCode_ptr const tc_Dynamic_ParameterList_0 =
+ &Dynamic_ParameterList_0;
+
+ }
+}
+
+
+#endif /* _TAO_TYPECODE_Dynamic_ParameterList_GUARD */
+
+static TAO::TypeCode::Alias<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_Dynamic_ParameterList (
+ CORBA::tk_alias,
+ "IDL:omg.org/Dynamic/ParameterList:1.0",
+ "ParameterList",
+ &TAO::TypeCode::tc_Dynamic_ParameterList_0);
+
+namespace Dynamic
+{
+ ::CORBA::TypeCode_ptr const _tc_ParameterList =
+ &_tao_tc_Dynamic_ParameterList;
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/alias_typecode.cpp:50
+
+static TAO::TypeCode::Alias<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_Dynamic_ContextList (
+ CORBA::tk_alias,
+ "IDL:omg.org/Dynamic/ContextList:1.0",
+ "ContextList",
+ &CORBA::_tc_StringSeq);
+
+namespace Dynamic
+{
+ ::CORBA::TypeCode_ptr const _tc_ContextList =
+ &_tao_tc_Dynamic_ContextList;
+}
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/alias_typecode.cpp:50
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/typecode_defn.cpp:937
+
+namespace CORBA
+{
+ extern ::CORBA::TypeCode_ptr const _tc_TypeCode;
+}
+
+
+#ifndef _TAO_TYPECODE_Dynamic_ExceptionList_GUARD
+#define _TAO_TYPECODE_Dynamic_ExceptionList_GUARD
+namespace TAO
+{
+ namespace TypeCode
+ {
+ TAO::TypeCode::Sequence< ::CORBA::TypeCode_ptr const *,
+ TAO::Null_RefCount_Policy>
+ Dynamic_ExceptionList_0 (
+ CORBA::tk_sequence,
+ &CORBA::_tc_TypeCode,
+ 0U);
+
+ ::CORBA::TypeCode_ptr const tc_Dynamic_ExceptionList_0 =
+ &Dynamic_ExceptionList_0;
+
+ }
+}
+
+
+#endif /* _TAO_TYPECODE_Dynamic_ExceptionList_GUARD */
+
+static TAO::TypeCode::Alias<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_Dynamic_ExceptionList (
+ CORBA::tk_alias,
+ "IDL:omg.org/Dynamic/ExceptionList:1.0",
+ "ExceptionList",
+ &TAO::TypeCode::tc_Dynamic_ExceptionList_0);
+
+namespace Dynamic
+{
+ ::CORBA::TypeCode_ptr const _tc_ExceptionList =
+ &_tao_tc_Dynamic_ExceptionList;
+}
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/alias_typecode.cpp:50
+
+static TAO::TypeCode::Alias<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_Dynamic_RequestContext (
+ CORBA::tk_alias,
+ "IDL:omg.org/Dynamic/RequestContext:1.0",
+ "RequestContext",
+ &CORBA::_tc_StringSeq);
+
+namespace Dynamic
+{
+ ::CORBA::TypeCode_ptr const _tc_RequestContext =
+ &_tao_tc_Dynamic_RequestContext;
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_sequence/any_op_cs.cpp:54
+
+
+// Copying insertion.
+void operator<<= (
+ CORBA::Any &_tao_any,
+ const Dynamic::ParameterList &_tao_elem
+ )
+{
+ TAO::Any_Dual_Impl_T<Dynamic::ParameterList>::insert_copy (
+ _tao_any,
+ Dynamic::ParameterList::_tao_any_destructor,
+ TAO::TypeCode::tc_Dynamic_ParameterList_0,
+ _tao_elem
+ );
+}
+
+// Non-copying insertion.
+void operator<<= (
+ CORBA::Any &_tao_any,
+ Dynamic::ParameterList *_tao_elem
+ )
+{
+ TAO::Any_Dual_Impl_T<Dynamic::ParameterList>::insert (
+ _tao_any,
+ Dynamic::ParameterList::_tao_any_destructor,
+ TAO::TypeCode::tc_Dynamic_ParameterList_0,
+ _tao_elem
+ );
+}
+
+// Extraction to non-const pointer (deprecated).
+CORBA::Boolean operator>>= (
+ const CORBA::Any &_tao_any,
+ Dynamic::ParameterList *&_tao_elem
+ )
+{
+ return _tao_any >>= const_cast<
+ const Dynamic::ParameterList *&> (
+ _tao_elem
+ );
+}
+
+// Extraction to const pointer.
+CORBA::Boolean operator>>= (
+ const CORBA::Any &_tao_any,
+ const Dynamic::ParameterList *&_tao_elem
+ )
+{
+ return
+ TAO::Any_Dual_Impl_T<Dynamic::ParameterList>::extract (
+ _tao_any,
+ Dynamic::ParameterList::_tao_any_destructor,
+ TAO::TypeCode::tc_Dynamic_ParameterList_0,
+ _tao_elem
+ );
+}
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_sequence/any_op_cs.cpp:54
+
+
+// Copying insertion.
+void operator<<= (
+ CORBA::Any &_tao_any,
+ const Dynamic::ExceptionList &_tao_elem
+ )
+{
+ TAO::Any_Dual_Impl_T<Dynamic::ExceptionList>::insert_copy (
+ _tao_any,
+ Dynamic::ExceptionList::_tao_any_destructor,
+ TAO::TypeCode::tc_Dynamic_ExceptionList_0,
+ _tao_elem
+ );
+}
+
+// Non-copying insertion.
+void operator<<= (
+ CORBA::Any &_tao_any,
+ Dynamic::ExceptionList *_tao_elem
+ )
+{
+ TAO::Any_Dual_Impl_T<Dynamic::ExceptionList>::insert (
+ _tao_any,
+ Dynamic::ExceptionList::_tao_any_destructor,
+ TAO::TypeCode::tc_Dynamic_ExceptionList_0,
+ _tao_elem
+ );
+}
+
+// Extraction to non-const pointer (deprecated).
+CORBA::Boolean operator>>= (
+ const CORBA::Any &_tao_any,
+ Dynamic::ExceptionList *&_tao_elem
+ )
+{
+ return _tao_any >>= const_cast<
+ const Dynamic::ExceptionList *&> (
+ _tao_elem
+ );
+}
+
+// Extraction to const pointer.
+CORBA::Boolean operator>>= (
+ const CORBA::Any &_tao_any,
+ const Dynamic::ExceptionList *&_tao_elem
+ )
+{
+ return
+ TAO::Any_Dual_Impl_T<Dynamic::ExceptionList>::extract (
+ _tao_any,
+ Dynamic::ExceptionList::_tao_any_destructor,
+ TAO::TypeCode::tc_Dynamic_ExceptionList_0,
+ _tao_elem
+ );
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/AnyTypeCode/DynamicA.h b/TAO/tao/AnyTypeCode/DynamicA.h
new file mode 100644
index 00000000000..a327a5a461a
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/DynamicA.h
@@ -0,0 +1,146 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:153
+
+#ifndef _TAO_IDL_ORIG_DYNAMICA_H_
+#define _TAO_IDL_ORIG_DYNAMICA_H_
+
+#include /**/ "ace/pre.h"
+
+
+#include "ace/config-all.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/AnyTypeCode/TAO_AnyTypeCode_Export.h"
+#include "tao/AnyTypeCode/DynamicC.h"
+
+#if defined (TAO_EXPORT_MACRO)
+#undef TAO_EXPORT_MACRO
+#endif
+#define TAO_EXPORT_MACRO TAO_AnyTypeCode_Export
+
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+#if defined (__BORLANDC__)
+#pragma option push -w-rvl -w-rch -w-ccc -w-inl
+#endif /* __BORLANDC__ */
+
+// TAO_IDL - Generated from
+// be\be_visitor_module/module_ch.cpp:48
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace CORBA
+{
+} // module CORBA
+
+// TAO_IDL - Generated from
+// be\be_visitor_module/module_ch.cpp:48
+
+namespace Dynamic
+{
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:44
+
+ extern TAO_AnyTypeCode_Export ::CORBA::TypeCode_ptr const _tc_ParameterList;
+
+ extern TAO_AnyTypeCode_Export ::CORBA::TypeCode_ptr const _tc_ContextList;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:44
+
+ extern TAO_AnyTypeCode_Export ::CORBA::TypeCode_ptr const _tc_ExceptionList;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:44
+
+ extern TAO_AnyTypeCode_Export ::CORBA::TypeCode_ptr const _tc_RequestContext;
+
+// TAO_IDL - Generated from
+// be\be_visitor_module/module_ch.cpp:66
+
+} // module Dynamic
+
+// TAO_IDL - Generated from
+// be\be_visitor_traits.cpp:61
+
+// TAO_IDL - Generated from
+// be\be_visitor_sequence/any_op_ch.cpp:52
+
+TAO_AnyTypeCode_Export void operator<<= (CORBA::Any &, const Dynamic::ParameterList &); // copying version
+TAO_AnyTypeCode_Export void operator<<= (CORBA::Any &, Dynamic::ParameterList*); // noncopying version
+TAO_AnyTypeCode_Export CORBA::Boolean operator>>= (const CORBA::Any &, Dynamic::ParameterList *&); // deprecated
+TAO_AnyTypeCode_Export CORBA::Boolean operator>>= (const CORBA::Any &, const Dynamic::ParameterList *&);
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface_fwd/any_op_ch.cpp:63
+
+TAO_AnyTypeCode_Export void operator<<= (CORBA::Any &, CORBA::TypeCode_ptr); // copying
+TAO_AnyTypeCode_Export void operator<<= (CORBA::Any &, CORBA::TypeCode_ptr *); // non-copying
+TAO_AnyTypeCode_Export CORBA::Boolean operator>>= (const CORBA::Any &, CORBA::TypeCode *&);
+
+// TAO_IDL - Generated from
+// be\be_visitor_sequence/any_op_ch.cpp:52
+
+TAO_AnyTypeCode_Export void operator<<= (CORBA::Any &, const Dynamic::ExceptionList &); // copying version
+TAO_AnyTypeCode_Export void operator<<= (CORBA::Any &, Dynamic::ExceptionList*); // noncopying version
+TAO_AnyTypeCode_Export CORBA::Boolean operator>>= (const CORBA::Any &, Dynamic::ExceptionList *&); // deprecated
+TAO_AnyTypeCode_Export CORBA::Boolean operator>>= (const CORBA::Any &, const Dynamic::ExceptionList *&);
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface_fwd/cdr_op_ch.cpp:66
+
+TAO_AnyTypeCode_Export CORBA::Boolean operator<< (TAO_OutputCDR &, const CORBA::TypeCode_ptr );
+TAO_AnyTypeCode_Export CORBA::Boolean operator>> (TAO_InputCDR &, CORBA::TypeCode_ptr &);
+
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:955
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#if defined (__BORLANDC__)
+#pragma option pop
+#endif /* __BORLANDC__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* ifndef */
+
+
diff --git a/TAO/tao/AnyTypeCode/DynamicC.cpp b/TAO/tao/AnyTypeCode/DynamicC.cpp
new file mode 100644
index 00000000000..4cd49b59b28
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/DynamicC.cpp
@@ -0,0 +1,208 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:291
+
+
+#include "tao/AnyTypeCode/DynamicC.h"
+#include "tao/CDR.h"
+
+#if defined (__BORLANDC__)
+#pragma option -w-rvl -w-rch -w-ccc -w-aus -w-sig
+#endif /* __BORLANDC__ */
+
+// TAO_IDL - Generated from
+// be\be_visitor_arg_traits.cpp:70
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Arg traits specializations.
+namespace TAO
+{
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_sequence/sequence_cs.cpp:65
+
+#if !defined (_DYNAMIC_PARAMETERLIST_CS_)
+#define _DYNAMIC_PARAMETERLIST_CS_
+
+Dynamic::ParameterList::ParameterList (void)
+{}
+
+Dynamic::ParameterList::ParameterList (
+ CORBA::ULong max
+ )
+ : TAO::unbounded_value_sequence<
+ Dynamic::Parameter
+ >
+ (max)
+{}
+
+Dynamic::ParameterList::ParameterList (
+ CORBA::ULong max,
+ CORBA::ULong length,
+ Dynamic::Parameter * buffer,
+ CORBA::Boolean release
+ )
+ : TAO::unbounded_value_sequence<
+ Dynamic::Parameter
+ >
+ (max, length, buffer, release)
+{}
+
+Dynamic::ParameterList::ParameterList (
+ const ParameterList &seq
+ )
+ : TAO::unbounded_value_sequence<
+ Dynamic::Parameter
+ >
+ (seq)
+{}
+
+Dynamic::ParameterList::~ParameterList (void)
+{}
+
+void Dynamic::ParameterList::_tao_any_destructor (
+ void * _tao_void_pointer
+ )
+{
+ ParameterList * _tao_tmp_pointer =
+ static_cast<ParameterList *> (_tao_void_pointer);
+ delete _tao_tmp_pointer;
+}
+
+#endif /* end #if !defined */
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_sequence/sequence_cs.cpp:65
+
+#if !defined (_DYNAMIC_EXCEPTIONLIST_CS_)
+#define _DYNAMIC_EXCEPTIONLIST_CS_
+
+Dynamic::ExceptionList::ExceptionList (void)
+{}
+
+Dynamic::ExceptionList::ExceptionList (
+ CORBA::ULong max
+ )
+ : TAO::unbounded_object_reference_sequence<
+ CORBA::TypeCode,
+ CORBA::TypeCode_var
+ >
+ (max)
+{}
+
+Dynamic::ExceptionList::ExceptionList (
+ CORBA::ULong max,
+ CORBA::ULong length,
+ CORBA::TypeCode_ptr * buffer,
+ CORBA::Boolean release
+ )
+ : TAO::unbounded_object_reference_sequence<
+ CORBA::TypeCode,
+ CORBA::TypeCode_var
+ >
+ (max, length, buffer, release)
+{}
+
+Dynamic::ExceptionList::ExceptionList (
+ const ExceptionList &seq
+ )
+ : TAO::unbounded_object_reference_sequence<
+ CORBA::TypeCode,
+ CORBA::TypeCode_var
+ >
+ (seq)
+{}
+
+Dynamic::ExceptionList::~ExceptionList (void)
+{}
+
+void Dynamic::ExceptionList::_tao_any_destructor (
+ void * _tao_void_pointer
+ )
+{
+ ExceptionList * _tao_tmp_pointer =
+ static_cast<ExceptionList *> (_tao_void_pointer);
+ delete _tao_tmp_pointer;
+}
+
+#endif /* end #if !defined */
+
+// TAO_IDL - Generated from
+// be\be_visitor_sequence/cdr_op_cs.cpp:96
+
+#if !defined _TAO_CDR_OP_Dynamic_ParameterList_CPP_
+#define _TAO_CDR_OP_Dynamic_ParameterList_CPP_
+
+CORBA::Boolean operator<< (
+ TAO_OutputCDR &strm,
+ const Dynamic::ParameterList &_tao_sequence
+ )
+{
+ return TAO::marshal_sequence(strm, _tao_sequence);
+}
+
+CORBA::Boolean operator>> (
+ TAO_InputCDR &strm,
+ Dynamic::ParameterList &_tao_sequence
+ )
+{
+ return TAO::demarshal_sequence(strm, _tao_sequence);
+}
+
+#endif /* _TAO_CDR_OP_Dynamic_ParameterList_CPP_ */
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_sequence/cdr_op_cs.cpp:96
+
+#if !defined _TAO_CDR_OP_Dynamic_ExceptionList_CPP_
+#define _TAO_CDR_OP_Dynamic_ExceptionList_CPP_
+
+CORBA::Boolean operator<< (
+ TAO_OutputCDR &strm,
+ const Dynamic::ExceptionList &_tao_sequence
+ )
+{
+ return TAO::marshal_sequence(strm, _tao_sequence);
+}
+
+CORBA::Boolean operator>> (
+ TAO_InputCDR &strm,
+ Dynamic::ExceptionList &_tao_sequence
+ )
+{
+ return TAO::demarshal_sequence(strm, _tao_sequence);
+}
+
+#endif /* _TAO_CDR_OP_Dynamic_ExceptionList_CPP_ */
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/AnyTypeCode/DynamicC.h b/TAO/tao/AnyTypeCode/DynamicC.h
new file mode 100644
index 00000000000..92e2d9ba9b9
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/DynamicC.h
@@ -0,0 +1,258 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:153
+
+#ifndef _TAO_IDL_ORIG_DYNAMICC_H_
+#define _TAO_IDL_ORIG_DYNAMICC_H_
+
+#include /**/ "ace/pre.h"
+
+
+#include "ace/config-all.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/AnyTypeCode/TAO_AnyTypeCode_Export.h"
+#include "tao/AnyTypeCode/TypeCode.h"
+#include "tao/AnyTypeCode/TypeCode_Constants.h"
+#include "tao/AnyTypeCode/Dynamic_ParameterC.h"
+#include "tao/ORB.h"
+#include "tao/Environment.h"
+#include "tao/Sequence_T.h"
+#include "tao/Objref_VarOut_T.h"
+#include "tao/Seq_Var_T.h"
+#include "tao/Seq_Out_T.h"
+
+#include "tao/StringSeqC.h"
+
+#if defined (TAO_EXPORT_MACRO)
+#undef TAO_EXPORT_MACRO
+#endif
+#define TAO_EXPORT_MACRO TAO_AnyTypeCode_Export
+
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+#if defined (__BORLANDC__)
+#pragma option push -w-rvl -w-rch -w-ccc -w-inl
+#endif /* __BORLANDC__ */
+
+// TAO_IDL - Generated from
+// be\be_visitor_module/module_ch.cpp:48
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace CORBA
+{
+
+ // TAO_IDL - Generated from
+ // be\be_interface.cpp:598
+
+// TAO_IDL - Generated from
+// be\be_visitor_module/module_ch.cpp:66
+
+} // module CORBA
+
+// TAO_IDL - Generated from
+// be\be_visitor_module/module_ch.cpp:48
+
+namespace Dynamic
+{
+ // TAO_IDL - Generated from
+ // be\be_visitor_sequence/sequence_ch.cpp:101
+
+#if !defined (_DYNAMIC_PARAMETERLIST_CH_)
+#define _DYNAMIC_PARAMETERLIST_CH_
+
+ class ParameterList;
+
+ typedef
+ TAO_VarSeq_Var_T<
+ ParameterList
+ >
+ ParameterList_var;
+
+ typedef
+ TAO_Seq_Out_T<
+ ParameterList
+ >
+ ParameterList_out;
+
+ class TAO_AnyTypeCode_Export ParameterList
+ : public
+ TAO::unbounded_value_sequence<
+ Parameter
+ >
+ {
+ public:
+ ParameterList (void);
+ ParameterList (CORBA::ULong max);
+ ParameterList (
+ CORBA::ULong max,
+ CORBA::ULong length,
+ Parameter* buffer,
+ CORBA::Boolean release = false
+ );
+ ParameterList (const ParameterList &);
+ ~ParameterList (void);
+
+ static void _tao_any_destructor (void *);
+
+ typedef ParameterList_var _var_type;
+ };
+
+#endif /* end #if !defined */
+
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typedef/typedef_ch.cpp:472
+
+ typedef CORBA::StringSeq ContextList;
+ typedef CORBA::StringSeq_var ContextList_var;
+ typedef CORBA::StringSeq_out ContextList_out;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_sequence/sequence_ch.cpp:101
+
+#if !defined (_DYNAMIC_EXCEPTIONLIST_CH_)
+#define _DYNAMIC_EXCEPTIONLIST_CH_
+
+ class ExceptionList;
+
+ typedef
+ TAO_VarSeq_Var_T<
+ ExceptionList
+ >
+ ExceptionList_var;
+
+ typedef
+ TAO_Seq_Out_T<
+ ExceptionList
+ >
+ ExceptionList_out;
+
+ class TAO_AnyTypeCode_Export ExceptionList
+ : public
+ TAO::unbounded_object_reference_sequence<
+ CORBA::TypeCode,
+ CORBA::TypeCode_var
+ >
+ {
+ public:
+ ExceptionList (void);
+ ExceptionList (CORBA::ULong max);
+ ExceptionList (
+ CORBA::ULong max,
+ CORBA::ULong length,
+ CORBA::TypeCode_ptr* buffer,
+ CORBA::Boolean release = false
+ );
+ ExceptionList (const ExceptionList &);
+ ~ExceptionList (void);
+
+ static void _tao_any_destructor (void *);
+
+ typedef ExceptionList_var _var_type;
+ };
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typedef/typedef_ch.cpp:472
+
+ typedef CORBA::StringSeq RequestContext;
+ typedef CORBA::StringSeq_var RequestContext_var;
+ typedef CORBA::StringSeq_out RequestContext_out;
+
+// TAO_IDL - Generated from
+// be\be_visitor_module/module_ch.cpp:66
+
+} // module Dynamic
+
+// TAO_IDL - Generated from
+// be\be_visitor_traits.cpp:61
+
+// TAO_IDL - Generated from
+// be\be_visitor_sequence/cdr_op_ch.cpp:71
+
+#if !defined _TAO_CDR_OP_Dynamic_ParameterList_H_
+#define _TAO_CDR_OP_Dynamic_ParameterList_H_
+
+TAO_AnyTypeCode_Export CORBA::Boolean operator<< (
+ TAO_OutputCDR &,
+ const Dynamic::ParameterList &
+ );
+TAO_AnyTypeCode_Export CORBA::Boolean operator>> (
+ TAO_InputCDR &,
+ Dynamic::ParameterList &
+ );
+
+#endif /* _TAO_CDR_OP_Dynamic_ParameterList_H_ */
+
+
+// Traits specializations.
+// TAO_IDL - Generated from
+// be\be_visitor_sequence/cdr_op_ch.cpp:71
+
+#if !defined _TAO_CDR_OP_Dynamic_ExceptionList_H_
+#define _TAO_CDR_OP_Dynamic_ExceptionList_H_
+
+TAO_AnyTypeCode_Export CORBA::Boolean operator<< (
+ TAO_OutputCDR &,
+ const Dynamic::ExceptionList &
+ );
+TAO_AnyTypeCode_Export CORBA::Boolean operator>> (
+ TAO_InputCDR &,
+ Dynamic::ExceptionList &
+ );
+
+#endif /* _TAO_CDR_OP_Dynamic_ExceptionList_H_ */
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:955
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#if defined (__BORLANDC__)
+#pragma option pop
+#endif /* __BORLANDC__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* ifndef */
+
+
diff --git a/TAO/tao/AnyTypeCode/DynamicS.h b/TAO/tao/AnyTypeCode/DynamicS.h
new file mode 100644
index 00000000000..17b1360599e
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/DynamicS.h
@@ -0,0 +1,28 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// Skeleton file generation suppressed with command line option -SS
diff --git a/TAO/tao/AnyTypeCode/Dynamic_Parameter.pidl b/TAO/tao/AnyTypeCode/Dynamic_Parameter.pidl
new file mode 100644
index 00000000000..aee0f76d991
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Dynamic_Parameter.pidl
@@ -0,0 +1,43 @@
+// -*- IDL -*-
+
+// ================================================================
+/**
+ * @file Dynamic_Parameter.pidl
+ *
+ * $Id$
+ *
+ * This file was used to generate the code in Dynamic_ParameterC.* The command
+ * used to generate code is:
+ *
+ * tao_idl
+ * -o orig -Ge 1 -GA -Sci
+ * -Wb,export_macro=TAO_Export
+ * -Wb,export_include="tao/TAO_Export.h"
+ * -Wb,pre_include="ace/pre.h"
+ * -Wb,post_include="ace/post.h"
+ * -Wb,versioning_begin=TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+ * -Wb,versioning_end=TAO_END_VERSIONED_NAMESPACE_DECL
+ * Dynamic_Parameter.pidl
+ *
+ */
+// ================================================================
+
+// File: Dynamic_Parameter.idl
+// Piece of module Dynamic generated separately for use by
+// template argument helper classes.
+
+#ifndef _DYNAMIC_PARAMETER_IDL_
+#define _DYNAMIC_PARAMETER_IDL_
+
+#include "tao/ParameterMode.pidl"
+
+module Dynamic
+{
+ struct Parameter
+ {
+ any argument;
+ CORBA::ParameterMode mode;
+ };
+};
+
+#endif // _DYNAMIC_PARAMETER_IDL_
diff --git a/TAO/tao/AnyTypeCode/Empty_Param_TypeCode.cpp b/TAO/tao/AnyTypeCode/Empty_Param_TypeCode.cpp
new file mode 100644
index 00000000000..9c77532c4e3
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Empty_Param_TypeCode.cpp
@@ -0,0 +1,87 @@
+// $Id$
+
+#include "tao/AnyTypeCode/Empty_Param_TypeCode.h"
+
+#ifndef __ACE_INLINE__
+# include "tao/AnyTypeCode/Empty_Param_TypeCode.inl"
+#endif /* !__ACE_INLINE__ */
+
+
+ACE_RCSID (AnyTypeCode,
+ Empty_Param_TypeCode,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+bool
+TAO::TypeCode::Empty_Param::tao_marshal (TAO_OutputCDR &,
+ CORBA::ULong) const
+{
+ // Empty parameter list. Nothing to marshal.
+
+ return true;
+}
+
+void
+TAO::TypeCode::Empty_Param::tao_duplicate (void)
+{
+ // No-op since empty parameter TypeCodes are never created
+ // dynamically, meaning there is no need to implement reference
+ // counting.
+}
+
+void
+TAO::TypeCode::Empty_Param::tao_release (void)
+{
+ // No-op since empty parameter TypeCodes are never created
+ // dynamically, meaning there is no need to implement reference
+ // counting.
+}
+
+CORBA::Boolean
+TAO::TypeCode::Empty_Param::equal_i (CORBA::TypeCode_ptr
+ ACE_ENV_ARG_DECL_NOT_USED) const
+{
+ // Equality has already been established in the
+ // CORBA::TypeCode base class.
+
+ return true;
+}
+
+CORBA::Boolean
+TAO::TypeCode::Empty_Param::equivalent_i (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const
+{
+ // We could refactor this code to the CORBA::TypeCode::equivalent()
+ // method but doing so would force us to determine the unaliased
+ // kind of this TypeCode. Since we already know the unaliased kind
+ // of this TypeCode, choose to optimize away the additional kind
+ // unaliasing operation rather than save space.
+
+ CORBA::TCKind const tc_kind =
+ TAO::unaliased_kind (tc
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ if (tc_kind != this->kind_)
+ return false;
+
+ return true;
+}
+
+CORBA::TypeCode_ptr
+TAO::TypeCode::Empty_Param::get_compact_typecode_i (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED) const
+{
+ // Already compact since parameter list is empty.
+
+ // Since empty parameter TypeCodes are never created
+ // dynamically, there is no need to manipulate a reference count.
+
+ static TAO::TypeCode::Empty_Param compact_typecode (this->kind_);
+
+ return &compact_typecode;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/AnyTypeCode/Empty_Param_TypeCode.h b/TAO/tao/AnyTypeCode/Empty_Param_TypeCode.h
new file mode 100644
index 00000000000..62b9936a1a9
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Empty_Param_TypeCode.h
@@ -0,0 +1,102 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Empty_Param_TypeCode.h
+ *
+ * $Id$
+ *
+ * Header file for @c CORBA::TypeCodes with empty parameter lists.
+ *
+ * @author Ossama Othman <ossama@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_EMPTY_PARAM_TYPECODE_H
+#define TAO_EMPTY_PARAM_TYPECODE_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/AnyTypeCode/TypeCode.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace TypeCode
+ {
+
+ /**
+ * @class Empty_Param
+ *
+ * @brief @c CORBA::TypeCode implementation for OMG IDL types with
+ * empty parameter lists.
+ *
+ * This class implements a @c CORBA::TypeCode for OMG IDL types
+ * with empty parameter lists.
+ *
+ * @note @c Empty_Param @c TypeCodes are not reference counted in
+ * TAO since they are static, exist as constants for the
+ * length of a given OS process, and cannot be created
+ * through the @c CORBA::ORB or @c CORBA::TypeCodeFactory
+ * interfaces.
+ */
+ class Empty_Param : public CORBA::TypeCode
+ {
+ public:
+
+ /// Constructor.
+ Empty_Param (CORBA::TCKind k);
+
+ /**
+ * @name TAO-specific @c CORBA::TypeCode Methods
+ *
+ * Methods required by TAO's implementation of the
+ * @c CORBA::TypeCode class.
+ *
+ * @see @c CORBA::TypeCode
+ */
+ //@{
+ virtual bool tao_marshal (TAO_OutputCDR & cdr,
+ CORBA::ULong offset) const;
+ virtual void tao_duplicate (void);
+ virtual void tao_release (void);
+ //@}
+
+ protected:
+
+ /**
+ * @name @c TAO CORBA::TypeCode Template Methods
+ *
+ * @c CORBA::TypeCode template methods specific to @c TypeCodes
+ * with empty parameter lists.
+ *
+ * @see @c CORBA::TypeCode
+ */
+ //@{
+ virtual CORBA::Boolean equal_i (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const;
+ virtual CORBA::Boolean equivalent_i (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const;
+ virtual CORBA::TypeCode_ptr get_compact_typecode_i (
+ ACE_ENV_SINGLE_ARG_DECL) const;
+
+ };
+
+ } // End namespace TypeCode
+} // End namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+
+#ifdef __ACE_INLINE__
+# include "tao/AnyTypeCode/Empty_Param_TypeCode.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_EMPTY_PARAM_TYPECODE_H */
diff --git a/TAO/tao/AnyTypeCode/Empty_Param_TypeCode.inl b/TAO/tao/AnyTypeCode/Empty_Param_TypeCode.inl
new file mode 100644
index 00000000000..0cf77cec3bc
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Empty_Param_TypeCode.inl
@@ -0,0 +1,13 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO::TypeCode::Empty_Param::Empty_Param (CORBA::TCKind k)
+ : ::CORBA::TypeCode (k)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/AnyTypeCode/Enum_TypeCode.cpp b/TAO/tao/AnyTypeCode/Enum_TypeCode.cpp
new file mode 100644
index 00000000000..b84a50f9b72
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Enum_TypeCode.cpp
@@ -0,0 +1,224 @@
+// $Id$
+
+#ifndef TAO_ENUM_TYPECODE_CPP
+#define TAO_ENUM_TYPECODE_CPP
+
+#include "tao/AnyTypeCode/Enum_TypeCode.h"
+#include "tao/AnyTypeCode/TypeCode_Traits.h"
+#include "tao/TypeCodeFactory_Adapter.h"
+#include "tao/ORB_Core.h"
+#include "tao/CDR.h"
+
+#include "ace/Dynamic_Service.h"
+
+#ifndef __ACE_INLINE__
+# include "tao/AnyTypeCode/Enum_TypeCode.inl"
+#endif /* !__ACE_INLINE__ */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template <typename StringType, class EnumeratorArrayType, class RefCountPolicy>
+bool
+TAO::TypeCode::Enum<StringType,
+ EnumeratorArrayType,
+ RefCountPolicy>::tao_marshal (TAO_OutputCDR & cdr,
+ CORBA::ULong) const
+{
+ // A tk_enum TypeCode has a "complex" parameter list type (see
+ // Table 15-2 in Section 15.3.5.1 "TypeCode" in the CDR section of
+ // the CORBA specification), meaning that it must be marshaled into
+ // a CDR encapsulation.
+
+ // Create a CDR encapsulation.
+ TAO_OutputCDR enc;
+
+ bool const success =
+ (enc << TAO_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER))
+ && (enc << TAO_OutputCDR::from_string (this->base_attributes_.id (), 0))
+ && (enc << TAO_OutputCDR::from_string (this->base_attributes_.name (), 0))
+ && (enc << this->nenumerators_);
+
+ if (!success)
+ return false;
+
+ StringType const * const begin = &this->enumerators_[0];
+ StringType const * const end = begin + this->nenumerators_;
+
+ for (StringType const * i = begin; i != end; ++i)
+ {
+ StringType const & enumerator = *i;
+
+ if (!(enc << TAO_OutputCDR::from_string (
+ Traits<StringType>::get_string (enumerator), 0)))
+ return false;
+ }
+
+ return
+ cdr << static_cast<CORBA::ULong> (enc.total_length ())
+ && cdr.write_octet_array_mb (enc.begin ());
+}
+
+template <typename StringType, class EnumeratorArrayType, class RefCountPolicy>
+void
+TAO::TypeCode::Enum<StringType,
+ EnumeratorArrayType,
+ RefCountPolicy>::tao_duplicate (void)
+{
+ this->RefCountPolicy::add_ref ();
+}
+
+template <typename StringType, class EnumeratorArrayType, class RefCountPolicy>
+void
+TAO::TypeCode::Enum<StringType,
+ EnumeratorArrayType,
+ RefCountPolicy>::tao_release (void)
+{
+ this->RefCountPolicy::remove_ref ();
+}
+
+template <typename StringType, class EnumeratorArrayType, class RefCountPolicy>
+CORBA::Boolean
+TAO::TypeCode::Enum<StringType,
+ EnumeratorArrayType,
+ RefCountPolicy>::equal_i (
+ CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const
+{
+ // This call shouldn't throw since CORBA::TypeCode::equal() verified
+ // that the TCKind is the same as our's prior to invoking this
+ // method, meaning that member_count() is supported.
+
+ CORBA::ULong const tc_nenumerators =
+ tc->member_count (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ if (tc_nenumerators != this->nenumerators_)
+ return false;
+
+ for (CORBA::ULong i = 0; i < this->nenumerators_; ++i)
+ {
+ StringType const & lhs_enumerator = this->enumerators_[i];
+
+ char const * const lhs_name =
+ Traits<StringType>::get_string (lhs_enumerator);
+ char const * const rhs_name = tc->member_name (i
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ if (ACE_OS::strcmp (lhs_name, rhs_name) != 0)
+ return false;
+ }
+
+ return true;
+}
+
+template <typename StringType, class EnumeratorArrayType, class RefCountPolicy>
+CORBA::Boolean
+TAO::TypeCode::Enum<StringType,
+ EnumeratorArrayType,
+ RefCountPolicy>::equivalent_i (
+ CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const
+{
+ // Perform a structural comparison, excluding the name() and
+ // member_name() operations.
+
+ CORBA::ULong const tc_nenumerators =
+ tc->member_count (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ if (tc_nenumerators != this->nenumerators_)
+ return false;
+
+ return true;
+}
+
+template <typename StringType, class EnumeratorArrayType, class RefCountPolicy>
+CORBA::TypeCode_ptr
+TAO::TypeCode::Enum<StringType,
+ EnumeratorArrayType,
+ RefCountPolicy>::get_compact_typecode_i (
+ ACE_ENV_SINGLE_ARG_DECL) const
+{
+ ACE_Array_Base<CORBA::String_var> tc_enumerators (this->nenumerators_);
+
+ // Dynamically construct a new array of enumerators stripped of
+ // member names.
+
+ static char const empty_name[] = "";
+
+ for (CORBA::ULong i = 0; i < this->nenumerators_; ++i)
+ {
+ // Member names will be stripped, i.e. not embedded within
+ // the compact TypeCode.
+
+ tc_enumerators[i] = empty_name;
+ }
+
+ TAO_TypeCodeFactory_Adapter * adapter =
+ ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance (
+ TAO_ORB_Core::typecodefactory_adapter_name ());
+
+ if (adapter == 0)
+ {
+ ACE_THROW_RETURN (CORBA::INTERNAL (),
+ CORBA::TypeCode::_nil ());
+ }
+
+ return
+ adapter->create_enum_tc (this->base_attributes_.id (),
+ "" /* empty name */,
+ tc_enumerators,
+ this->nenumerators_
+ ACE_ENV_ARG_PARAMETER);
+}
+
+template <typename StringType, class EnumeratorArrayType, class RefCountPolicy>
+char const *
+TAO::TypeCode::Enum<StringType, EnumeratorArrayType, RefCountPolicy>::id_i (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED) const
+{
+ // Ownership is retained by the TypeCode, as required by the C++
+ // mapping.
+ return this->base_attributes_.id ();
+}
+
+template <typename StringType, class EnumeratorArrayType, class RefCountPolicy>
+char const *
+TAO::TypeCode::Enum<StringType, EnumeratorArrayType, RefCountPolicy>::name_i (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED) const
+{
+ // Ownership is retained by the TypeCode, as required by the C++
+ // mapping.
+ return this->base_attributes_.name ();
+}
+
+template <typename StringType, class EnumeratorArrayType, class RefCountPolicy>
+CORBA::ULong
+TAO::TypeCode::Enum<StringType,
+ EnumeratorArrayType,
+ RefCountPolicy>::member_count_i (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED) const
+{
+ return this->nenumerators_;
+}
+
+template <typename StringType, class EnumeratorArrayType, class RefCountPolicy>
+char const *
+TAO::TypeCode::Enum<StringType,
+ EnumeratorArrayType,
+ RefCountPolicy>::member_name_i (
+ CORBA::ULong index
+ ACE_ENV_ARG_DECL) const
+{
+ // Ownership is retained by the TypeCode, as required by the C++
+ // mapping.
+ if (index >= this->nenumerators_)
+ ACE_THROW_RETURN (CORBA::TypeCode::Bounds (), 0);
+
+ return Traits<StringType>::get_string (this->enumerators_[index]);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_ENUM_TYPECODE_CPP */
diff --git a/TAO/tao/AnyTypeCode/Enum_TypeCode.h b/TAO/tao/AnyTypeCode/Enum_TypeCode.h
new file mode 100644
index 00000000000..64a4d7bf9b0
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Enum_TypeCode.h
@@ -0,0 +1,143 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Enum_TypeCode.h
+ *
+ * $Id$
+ *
+ * Header file for a @c tk_enum CORBA::TypeCode.
+ *
+ * @author Ossama Othman <ossama@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_ENUM_TYPECODE_H
+#define TAO_ENUM_TYPECODE_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/AnyTypeCode/TypeCode.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/AnyTypeCode/TypeCode_Base_Attributes.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace TypeCode
+ {
+ /**
+ * @class Enum
+ *
+ * @brief @c CORBA::TypeCode implementation for an OMG IDL
+ * @c enum.
+ *
+ * This class implements a @c CORBA::TypeCode for an OMG IDL
+ * @c enum.
+ */
+ template <typename StringType,
+ class EnumeratorArrayType,
+ class RefCountPolicy>
+ class Enum
+ : public CORBA::TypeCode,
+ private RefCountPolicy
+ {
+ public:
+
+ /// Constructor.
+ Enum (char const * id,
+ char const * name,
+ EnumeratorArrayType const & enumerators,
+ CORBA::ULong nenumerators);
+
+ /**
+ * @name TAO-specific @c CORBA::TypeCode Methods
+ *
+ * Methods required by TAO's implementation of the
+ * @c CORBA::TypeCode class.
+ *
+ * @see @c CORBA::TypeCode
+ */
+ //@{
+ virtual bool tao_marshal (TAO_OutputCDR & cdr,
+ CORBA::ULong offset) const;
+ virtual void tao_duplicate (void);
+ virtual void tao_release (void);
+ //@}
+
+ protected:
+
+ /**
+ * @name @c TAO CORBA::TypeCode Template Methods
+ *
+ * @c tk_enum @c CORBA::TypeCode -specific template methods.
+ *
+ * @see @c CORBA::TypeCode
+ */
+ //@{
+ virtual CORBA::Boolean equal_i (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const;
+ virtual CORBA::Boolean equivalent_i (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const;
+ virtual CORBA::TypeCode_ptr get_compact_typecode_i (
+ ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual char const * id_i (ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual char const * name_i (ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual CORBA::ULong member_count_i (ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual char const * member_name_i (CORBA::ULong index
+ ACE_ENV_ARG_DECL) const;
+ //@}
+
+ private:
+
+ /**
+ * @c Enum Attributes
+ *
+ * Attributes representing the structure of an OMG IDL
+ * @c enum.
+ *
+ * @note These attributes are declared in the order in which
+ * they are marshaled into a CDR stream in order to
+ * increase cache hits by improving spatial locality.
+ */
+ //@{
+
+ /// Base attributes containing repository ID and name of
+ /// structure type.
+ Base_Attributes<StringType> base_attributes_;
+
+ /// The number of enumerators in the OMG IDL enumeration.
+ CORBA::ULong const nenumerators_;
+
+ /// Array of @c TAO::TypeCode enumerators representing
+ /// enumerators in the OMG IDL defined @c enum.
+ EnumeratorArrayType const enumerators_;
+
+ };
+
+ } // End namespace TypeCode
+} // End namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#ifdef __ACE_INLINE__
+# include "tao/AnyTypeCode/Enum_TypeCode.inl"
+#endif /* __ACE_INLINE__ */
+
+#ifdef ACE_TEMPLATES_REQUIRE_SOURCE
+# include "tao/AnyTypeCode/Enum_TypeCode.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#ifdef ACE_TEMPLATES_REQUIRE_PRAGMA
+# pragma implementation ("Enum_TypeCode.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_ENUM_TYPECODE_H */
diff --git a/TAO/tao/AnyTypeCode/Enum_TypeCode.inl b/TAO/tao/AnyTypeCode/Enum_TypeCode.inl
new file mode 100644
index 00000000000..64c14e65f51
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Enum_TypeCode.inl
@@ -0,0 +1,24 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template <typename StringType,
+ class EnumeratorArrayType,
+ class RefCountPolicy>
+ACE_INLINE
+TAO::TypeCode::Enum<StringType, EnumeratorArrayType, RefCountPolicy>::Enum (
+ char const * id,
+ char const * name,
+ EnumeratorArrayType const & enumerators,
+ CORBA::ULong nenumerators)
+ : ::CORBA::TypeCode (CORBA::tk_enum)
+ , RefCountPolicy ()
+ , base_attributes_ (id, name)
+ , nenumerators_ (nenumerators)
+ , enumerators_ (enumerators)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/AnyTypeCode/Enum_TypeCode_Static.cpp b/TAO/tao/AnyTypeCode/Enum_TypeCode_Static.cpp
new file mode 100644
index 00000000000..64cd8f00d37
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Enum_TypeCode_Static.cpp
@@ -0,0 +1,217 @@
+// $Id$
+
+#include "tao/AnyTypeCode/Enum_TypeCode_Static.h"
+#include "tao/AnyTypeCode/TypeCode_Traits.h"
+#include "tao/ORB_Core.h"
+#include "tao/CDR.h"
+#include "tao/TypeCodeFactory_Adapter.h"
+
+#include "ace/Dynamic_Service.h"
+
+#ifndef __ACE_INLINE__
+# include "tao/AnyTypeCode/Enum_TypeCode_Static.inl"
+#endif /* !__ACE_INLINE__ */
+
+
+ACE_RCSID (AnyTypeCode,
+ Enum_TypeCode_Static,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+bool
+TAO::TypeCode::Enum<char const *,
+ char const * const *,
+ TAO::Null_RefCount_Policy>::tao_marshal (
+ TAO_OutputCDR & cdr,
+ CORBA::ULong) const
+{
+ // A tk_enum TypeCode has a "complex" parameter list type (see
+ // Table 15-2 in Section 15.3.5.1 "TypeCode" in the CDR section of
+ // the CORBA specification), meaning that it must be marshaled into
+ // a CDR encapsulation.
+
+ // Create a CDR encapsulation.
+ TAO_OutputCDR enc;
+
+ bool const success =
+ (enc << TAO_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER))
+ && (enc << TAO_OutputCDR::from_string (this->base_attributes_.id (), 0))
+ && (enc << TAO_OutputCDR::from_string (this->base_attributes_.name (), 0))
+ && (enc << this->nenumerators_);
+
+ if (!success)
+ return false;
+
+ char const * const * const begin = &this->enumerators_[0];
+ char const * const * const end = begin + this->nenumerators_;
+
+ for (char const * const * i = begin; i != end; ++i)
+ {
+ char const * const & enumerator = *i;
+
+ if (!(enc << TAO_OutputCDR::from_string (
+ Traits<char const *>::get_string (enumerator), 0)))
+ return false;
+ }
+
+ return
+ cdr << static_cast<CORBA::ULong> (enc.total_length ())
+ && cdr.write_octet_array_mb (enc.begin ());
+}
+
+void
+TAO::TypeCode::Enum<char const *,
+ char const * const *,
+ TAO::Null_RefCount_Policy>::tao_duplicate (void)
+{
+}
+
+void
+TAO::TypeCode::Enum<char const *,
+ char const * const *,
+ TAO::Null_RefCount_Policy>::tao_release (void)
+{
+}
+
+CORBA::Boolean
+TAO::TypeCode::Enum<char const *,
+ char const * const *,
+ TAO::Null_RefCount_Policy>::equal_i (
+ CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const
+{
+ // This call shouldn't throw since CORBA::TypeCode::equal() verified
+ // that the TCKind is the same as our's prior to invoking this
+ // method, meaning that member_count() is supported.
+
+ CORBA::ULong const tc_nenumerators =
+ tc->member_count (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ if (tc_nenumerators != this->nenumerators_)
+ return false;
+
+ for (CORBA::ULong i = 0; i < this->nenumerators_; ++i)
+ {
+ char const * const & lhs_enumerator = this->enumerators_[i];
+
+ char const * const lhs_name =
+ Traits<char const *>::get_string (lhs_enumerator);
+ char const * const rhs_name = tc->member_name (i
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ if (ACE_OS::strcmp (lhs_name, rhs_name) != 0)
+ return false;
+ }
+
+ return true;
+}
+
+CORBA::Boolean
+TAO::TypeCode::Enum<char const *,
+ char const * const *,
+ TAO::Null_RefCount_Policy>::equivalent_i (
+ CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const
+{
+ // Perform a structural comparison, excluding the name() and
+ // member_name() operations.
+
+ CORBA::ULong const tc_nenumerators =
+ tc->member_count (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ if (tc_nenumerators != this->nenumerators_)
+ return false;
+
+ return true;
+}
+
+CORBA::TypeCode_ptr
+TAO::TypeCode::Enum<char const *,
+ char const * const *,
+ TAO::Null_RefCount_Policy>::get_compact_typecode_i (
+ ACE_ENV_SINGLE_ARG_DECL) const
+{
+ ACE_Array_Base<CORBA::String_var> tc_enumerators (this->nenumerators_);
+
+ // Dynamically construct a new array of enumerators stripped of
+ // member names.
+
+ static char const empty_name[] = "";
+
+ for (CORBA::ULong i = 0; i < this->nenumerators_; ++i)
+ {
+ // Member names will be stripped, i.e. not embedded within
+ // the compact TypeCode.
+
+ tc_enumerators[i] = empty_name;
+ }
+
+ TAO_TypeCodeFactory_Adapter * adapter =
+ ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance (
+ TAO_ORB_Core::typecodefactory_adapter_name ());
+
+ if (adapter == 0)
+ {
+ ACE_THROW_RETURN (CORBA::INTERNAL (),
+ CORBA::TypeCode::_nil ());
+ }
+
+ return
+ adapter->create_enum_tc (this->base_attributes_.id (),
+ "" /* empty name */,
+ tc_enumerators,
+ this->nenumerators_
+ ACE_ENV_ARG_PARAMETER);
+}
+
+char const *
+TAO::TypeCode::Enum<char const *,
+ char const * const *,
+ TAO::Null_RefCount_Policy>::id_i (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED) const
+{
+ // Ownership is retained by the TypeCode, as required by the C++
+ // mapping.
+ return this->base_attributes_.id ();
+}
+
+char const *
+TAO::TypeCode::Enum<char const *,
+ char const * const *,
+ TAO::Null_RefCount_Policy>::name_i (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED) const
+{
+ // Ownership is retained by the TypeCode, as required by the C++
+ // mapping.
+ return this->base_attributes_.name ();
+}
+
+CORBA::ULong
+TAO::TypeCode::Enum<char const *,
+ char const * const *,
+ TAO::Null_RefCount_Policy>::member_count_i (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED) const
+{
+ return this->nenumerators_;
+}
+
+char const *
+TAO::TypeCode::Enum<char const *,
+ char const * const *,
+ TAO::Null_RefCount_Policy>::member_name_i (
+ CORBA::ULong index
+ ACE_ENV_ARG_DECL) const
+{
+ // Ownership is retained by the TypeCode, as required by the C++
+ // mapping.
+ if (index >= this->nenumerators_)
+ ACE_THROW_RETURN (CORBA::TypeCode::Bounds (), 0);
+
+ return Traits<char const *>::get_string (this->enumerators_[index]);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/AnyTypeCode/Enum_TypeCode_Static.h b/TAO/tao/AnyTypeCode/Enum_TypeCode_Static.h
new file mode 100644
index 00000000000..d9f22d44271
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Enum_TypeCode_Static.h
@@ -0,0 +1,139 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Enum_TypeCode_Static.h
+ *
+ * $Id$
+ *
+ * Header file for a static @c tk_enum CORBA::TypeCode.
+ *
+ * @author Ossama Othman <ossama@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_ENUM_TYPECODE_STATIC_H
+#define TAO_ENUM_TYPECODE_STATIC_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/AnyTypeCode/TypeCode.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/AnyTypeCode/TypeCode_Base_Attributes.h"
+#include "tao/AnyTypeCode/Null_RefCount_Policy.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace TypeCode
+ {
+ template <typename StringType,
+ class EnumeratorArrayType,
+ class RefCountPolicy> class Enum;
+
+ /**
+ * @class Enum
+ *
+ * @brief @c CORBA::TypeCode implementation for an OMG IDL
+ * @c enum.
+ *
+ * This class implements a @c CORBA::TypeCode for an OMG IDL
+ * @c enum.
+ */
+ template<>
+ class TAO_AnyTypeCode_Export Enum<char const *,
+ char const * const *,
+ TAO::Null_RefCount_Policy>
+ : public CORBA::TypeCode,
+ private TAO::Null_RefCount_Policy
+ {
+ public:
+
+ /// Constructor.
+ Enum (char const * id,
+ char const * name,
+ char const * const * enumerators,
+ CORBA::ULong nenumerators);
+
+ /**
+ * @name TAO-specific @c CORBA::TypeCode Methods
+ *
+ * Methods required by TAO's implementation of the
+ * @c CORBA::TypeCode class.
+ *
+ * @see @c CORBA::TypeCode
+ */
+ //@{
+ virtual bool tao_marshal (TAO_OutputCDR & cdr,
+ CORBA::ULong offset) const;
+ virtual void tao_duplicate (void);
+ virtual void tao_release (void);
+ //@}
+
+ protected:
+
+ /**
+ * @name @c TAO CORBA::TypeCode Template Methods
+ *
+ * @c tk_enum @c CORBA::TypeCode -specific template methods.
+ *
+ * @see @c CORBA::TypeCode
+ */
+ //@{
+ virtual CORBA::Boolean equal_i (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const;
+ virtual CORBA::Boolean equivalent_i (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const;
+ virtual CORBA::TypeCode_ptr get_compact_typecode_i (
+ ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual char const * id_i (ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual char const * name_i (ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual CORBA::ULong member_count_i (ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual char const * member_name_i (CORBA::ULong index
+ ACE_ENV_ARG_DECL) const;
+ //@}
+
+ private:
+
+ /**
+ * @c Enum Attributes
+ *
+ * Attributes representing the structure of an OMG IDL
+ * @c enum.
+ *
+ * @note These attributes are declared in the order in which
+ * they are marshaled into a CDR stream in order to
+ * increase cache hits by improving spatial locality.
+ */
+ //@{
+
+ /// Base attributes containing repository ID and name of
+ /// structure type.
+ Base_Attributes<char const *> base_attributes_;
+
+ /// The number of enumerators in the OMG IDL enumeration.
+ CORBA::ULong const nenumerators_;
+
+ /// Array of @c TAO::TypeCode enumerators representing
+ /// enumerators in the OMG IDL defined @c enum.
+ char const * const * const enumerators_;
+
+ };
+
+ } // End namespace TypeCode
+} // End namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#ifdef __ACE_INLINE__
+# include "tao/AnyTypeCode/Enum_TypeCode_Static.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_ENUM_TYPECODE_STATIC_H */
diff --git a/TAO/tao/AnyTypeCode/Enum_TypeCode_Static.inl b/TAO/tao/AnyTypeCode/Enum_TypeCode_Static.inl
new file mode 100644
index 00000000000..8d2f31eba9c
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Enum_TypeCode_Static.inl
@@ -0,0 +1,24 @@
+// -*- C++ -*-
+//
+// $Id$
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO::TypeCode::Enum<char const *,
+ char const * const *,
+ TAO::Null_RefCount_Policy>::Enum (
+ char const * id,
+ char const * name,
+ char const * const * enumerators,
+ CORBA::ULong nenumerators)
+ : ::CORBA::TypeCode (CORBA::tk_enum)
+ , ::TAO::Null_RefCount_Policy ()
+ , base_attributes_ (id, name)
+ , nenumerators_ (nenumerators)
+ , enumerators_ (enumerators)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/AnyTypeCode/ExceptionA.cpp b/TAO/tao/AnyTypeCode/ExceptionA.cpp
new file mode 100644
index 00000000000..a38566ee6b7
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/ExceptionA.cpp
@@ -0,0 +1,122 @@
+// $Id$
+
+#include "tao/AnyTypeCode/ExceptionA.h"
+#include "tao/AnyTypeCode/Any_Dual_Impl_T.h"
+#include "tao/SystemException.h"
+#include "tao/Environment.h"
+#include "tao/ORB_Constants.h"
+#include "tao/CORBA_String.h"
+#include "tao/CDR.h"
+#include "tao/debug.h"
+
+#include "ace/Malloc.h"
+#include "ace/SString.h"
+#include "ace/OS_NS_string.h"
+
+#include "ace/OS_NS_stdio.h"
+
+ACE_RCSID (AnyTypeCode,
+ Exception,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Specializations for CORBA::Exception Any operators.
+namespace TAO
+{
+ template<>
+ void
+ Any_Dual_Impl_T<CORBA::Exception>::value (
+ const CORBA::Exception & val
+ )
+ {
+ this->value_ = val._tao_duplicate ();
+ }
+
+ template<>
+ CORBA::Boolean
+ Any_Dual_Impl_T<CORBA::Exception>::marshal_value (TAO_OutputCDR &cdr)
+ {
+ ACE_TRY_NEW_ENV
+ {
+ this->value_->_tao_encode (cdr
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ return true;
+ }
+ ACE_CATCHANY
+ {
+ }
+ ACE_ENDTRY;
+
+ return false;
+ }
+
+ template<>
+ CORBA::Boolean
+ Any_Dual_Impl_T<CORBA::Exception>::demarshal_value (TAO_InputCDR &cdr)
+ {
+ ACE_TRY_NEW_ENV
+ {
+ this->value_->_tao_decode (cdr
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ return true;
+ }
+ ACE_CATCHANY
+ {
+ }
+ ACE_ENDTRY;
+
+ return false;
+ }
+
+ // This should never get called since we don't have extraction operators
+ // for CORBA::Exception, but it is here to sidestep the constructor call
+ // in the unspecialized version that causes a problem with compilers that
+ // require explicit instantiation
+ template<>
+ CORBA::Boolean
+ Any_Dual_Impl_T<CORBA::Exception>::extract (
+ const CORBA::Any &,
+ _tao_destructor,
+ CORBA::TypeCode_ptr,
+ const CORBA::Exception *&
+ )
+ {
+ return false;
+ }
+}
+
+// =======================================================================
+
+
+// Insertion of CORBA::Exception - copying.
+void
+operator<<= (CORBA::Any &any, const CORBA::Exception &exception)
+{
+ TAO::Any_Dual_Impl_T<CORBA::Exception>::insert_copy (
+ any,
+ CORBA::Exception::_tao_any_destructor,
+ exception._tao_type (),
+ exception
+ );
+}
+
+// Insertion of CORBA::Exception - non-copying.
+void
+operator<<= (CORBA::Any &any, CORBA::Exception *exception)
+{
+ TAO::Any_Dual_Impl_T<CORBA::Exception>::insert (
+ any,
+ CORBA::Exception::_tao_any_destructor,
+ exception->_tao_type (),
+ exception
+ );
+}
+
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/AnyTypeCode/ExceptionA.h b/TAO/tao/AnyTypeCode/ExceptionA.h
new file mode 100644
index 00000000000..44f6cd6834c
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/ExceptionA.h
@@ -0,0 +1,53 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file ExceptionA.h
+ *
+ * $Id$
+ *
+ * This file defines way in which CORBA exceptions are reported.
+ *
+ * @author DOC Group at Vanderbilt U., Wash U, and UCI
+ */
+//=============================================================================
+
+#ifndef TAO_EXCEPTIONA_H
+#define TAO_EXCEPTIONA_H
+
+#include /**/ "ace/pre.h"
+
+// Do not try removing this. If you remove this for subsetting lots of
+// things go wrong in TAO.
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+// This is used in the implementation of the _raise methods
+#if defined (TAO_HAS_EXCEPTIONS)
+#define TAO_RAISE(EXCEPTION) throw EXCEPTION
+#else
+#define TAO_RAISE(EXCEPTION)
+#endif /* ACE_HAS_EXCEPTIONS */
+
+#include "tao/AnyTypeCode/TAO_AnyTypeCode_Export.h"
+#include "tao/Exception.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace CORBA
+{
+ class Any;
+ typedef Any *Any_ptr;
+}
+
+TAO_AnyTypeCode_Export void operator<<= (CORBA::Any &, const CORBA::Exception &);
+TAO_AnyTypeCode_Export void operator<<= (CORBA::Any &, CORBA::Exception *);
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/"ace/post.h"
+
+#endif /* TAO_EXCEPTIONA_H */
diff --git a/TAO/tao/AnyTypeCode/Fixed_TypeCode.cpp b/TAO/tao/AnyTypeCode/Fixed_TypeCode.cpp
new file mode 100644
index 00000000000..0fae62d507c
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Fixed_TypeCode.cpp
@@ -0,0 +1,113 @@
+// $Id$
+
+#ifndef TAO_FIXED_TYPECODE_CPP
+#define TAO_FIXED_TYPECODE_CPP
+
+#include "tao/AnyTypeCode/Fixed_TypeCode.h"
+#include "tao/CDR.h"
+
+#ifndef __ACE_INLINE__
+# include "tao/AnyTypeCode/Fixed_TypeCode.inl"
+#endif /* !__ACE_INLINE__ */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template <class RefCountPolicy>
+bool
+TAO::TypeCode::Fixed<RefCountPolicy>::tao_marshal (TAO_OutputCDR & cdr,
+ CORBA::ULong) const
+{
+ // A tk_fixed TypeCode has a "simple" parameter list type (see
+ // Table 15-2 in Section 15.3.5.1 "TypeCode" in the CDR section of
+ // the CORBA specification), meaning that its parameter(s) must be
+ // marshaled immediately following the TCKind. No CDR encapsulation
+ // is to be created.
+
+ return (cdr << this->digits_) && (cdr << this->scale_);
+}
+
+template <class RefCountPolicy>
+void
+TAO::TypeCode::Fixed<RefCountPolicy>::tao_duplicate (void)
+{
+ this->RefCountPolicy::add_ref ();
+}
+
+template <class RefCountPolicy>
+void
+TAO::TypeCode::Fixed<RefCountPolicy>::tao_release (void)
+{
+ this->RefCountPolicy::remove_ref ();
+}
+
+template <class RefCountPolicy>
+CORBA::Boolean
+TAO::TypeCode::Fixed<RefCountPolicy>::equal_i (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const
+{
+ // The following call won't throw since CORBA::TypeCode::equal() has
+ // already established the kind of tc is the same as our kind.
+ CORBA::UShort const tc_digits =
+ tc->fixed_digits (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ CORBA::UShort const tc_scale =
+ tc->fixed_scale (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ return (this->digits_ == tc_digits
+ && this->scale_ == tc_scale);
+}
+
+template <class RefCountPolicy>
+CORBA::Boolean
+TAO::TypeCode::Fixed<RefCountPolicy>::equivalent_i (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const
+{
+ // Since TCKind comparisons must be performed before equal_i() is
+ // called, we can also call it to determine equivalence of
+ // tk_fixed TypeCodes.
+ return this->equal_i (tc
+ ACE_ENV_ARG_PARAMETER);
+}
+
+template <class RefCountPolicy>
+CORBA::TypeCode_ptr
+TAO::TypeCode::Fixed<RefCountPolicy>::get_compact_typecode_i (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED) const
+{
+ // Already compact since tk_fixed TypeCodes have no name or member
+ // names, meaning that we can simply call _duplicate() on this
+ // TypeCode.
+
+
+ // @@ There is a potential problem here if this TypeCode is a static
+ // and const since it may have been placed in read-only memory by
+ // the compiler. A const_cast<> can return undefined results in
+ // that case.
+
+ CORBA::TypeCode_ptr mutable_tc =
+ const_cast<TAO::TypeCode::Fixed<RefCountPolicy> *> (this);
+
+ return CORBA::TypeCode::_duplicate (mutable_tc);
+}
+
+template <class RefCountPolicy>
+CORBA::UShort
+TAO::TypeCode::Fixed<RefCountPolicy>::fixed_digits_i (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED) const
+{
+ return this->digits_;
+}
+
+template <class RefCountPolicy>
+CORBA::UShort
+TAO::TypeCode::Fixed<RefCountPolicy>::fixed_scale_i (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED) const
+{
+ return this->scale_;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_FIXED_TYPECODE_CPP */
diff --git a/TAO/tao/AnyTypeCode/Fixed_TypeCode.h b/TAO/tao/AnyTypeCode/Fixed_TypeCode.h
new file mode 100644
index 00000000000..3e300cb3658
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Fixed_TypeCode.h
@@ -0,0 +1,118 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Fixed_TypeCode.h
+ *
+ * $Id$
+ *
+ * Header file for @c CORBA::tk_fixed @c CORBA::TypeCodes.
+ *
+ * @author Ossama Othman <ossama@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_FIXED_TYPECODE_H
+#define TAO_FIXED_TYPECODE_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/AnyTypeCode/TypeCode.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace TypeCode
+ {
+
+ /**
+ * @class Fixed
+ *
+ * @brief @c CORBA::TypeCode implementation for the OMG IDL @fixed
+ * types.
+ *
+ * This class implements a @c CORBA::TypeCode for the OMG IDL @c
+ * fixed types.
+ */
+ template <class RefCountPolicy>
+ class Fixed
+ : public CORBA::TypeCode
+ , private RefCountPolicy
+ {
+ public:
+
+ /// Constructor.
+ Fixed (CORBA::UShort digits, CORBA::UShort scale);
+
+ /**
+ * @name TAO-specific @c CORBA::TypeCode Methods
+ *
+ * Methods required by TAO's implementation of the
+ * @c CORBA::TypeCode class.
+ *
+ * @see @c CORBA::TypeCode
+ */
+ //@{
+ virtual bool tao_marshal (TAO_OutputCDR & cdr,
+ CORBA::ULong offset) const;
+ virtual void tao_duplicate (void);
+ virtual void tao_release (void);
+ //@}
+
+ protected:
+
+ /**
+ * @name @c TAO CORBA::TypeCode Template Methods
+ *
+ * @c CORBA::TypeCode template methods specific to @c tk_fixed
+ * @c TypeCodes.
+ *
+ * @see @c CORBA::TypeCode
+ */
+ //@{
+ virtual CORBA::Boolean equal_i (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const;
+ virtual CORBA::Boolean equivalent_i (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const;
+ virtual CORBA::TypeCode_ptr get_compact_typecode_i (
+ ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual CORBA::UShort fixed_digits_i (ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual CORBA::UShort fixed_scale_i (ACE_ENV_SINGLE_ARG_DECL) const;
+
+ private:
+
+ /// The number of significant digits.
+ CORBA::UShort const digits_;
+
+ /// The scale factor.
+ CORBA::UShort const scale_;
+
+ };
+
+ } // End namespace TypeCode
+} // End namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+
+#ifdef __ACE_INLINE__
+# include "tao/AnyTypeCode/Fixed_TypeCode.inl"
+#endif /* __ACE_INLINE__ */
+
+#ifdef ACE_TEMPLATES_REQUIRE_SOURCE
+# include "tao/AnyTypeCode/Fixed_TypeCode.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#ifdef ACE_TEMPLATES_REQUIRE_PRAGMA
+# pragma implementation ("Fixed_TypeCode.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_FIXED_TYPECODE_H */
diff --git a/TAO/tao/AnyTypeCode/Fixed_TypeCode.inl b/TAO/tao/AnyTypeCode/Fixed_TypeCode.inl
new file mode 100644
index 00000000000..62f3e63aac5
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Fixed_TypeCode.inl
@@ -0,0 +1,18 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template <class RefCountPolicy>
+ACE_INLINE
+TAO::TypeCode::Fixed<RefCountPolicy>::Fixed (CORBA::UShort digits,
+ CORBA::UShort scale)
+ : ::CORBA::TypeCode (CORBA::tk_fixed)
+ , RefCountPolicy ()
+ , digits_ (digits)
+ , scale_ (scale)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/AnyTypeCode/Marshal.cpp b/TAO/tao/AnyTypeCode/Marshal.cpp
new file mode 100644
index 00000000000..0172cf90d26
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Marshal.cpp
@@ -0,0 +1,253 @@
+
+//=============================================================================
+/**
+ * @file Marshal.cpp
+ *
+ * $Id$
+ *
+ * Implements the Marshal_Object class and the factory
+ * The original encoder and decoder code now appears in files encode.cpp and
+ * decode.cpp
+ *
+ * @author Aniruddha S. Gokhale
+ * @author Copyright 1994-1995 by Sun Microsystems Inc.
+ */
+//=============================================================================
+
+#include "tao/AnyTypeCode/Marshal.h"
+#include "tao/AnyTypeCode/TypeCode.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/AnyTypeCode/Marshal.inl"
+#endif /* ! __ACE_INLINE__ */
+
+ACE_RCSID (AnyTypeCode,
+ Marshal,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Marshal_Object::~TAO_Marshal_Object (void)
+{
+}
+
+TAO::traverse_status
+TAO_Marshal_Object::perform_skip (CORBA::TypeCode_ptr tc,
+ TAO_InputCDR *stream
+ ACE_ENV_ARG_DECL)
+{
+ CORBA::ULong const kind = tc->kind (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO::TRAVERSE_STOP);
+
+ switch (kind)
+ {
+ default:
+ case CORBA::tk_fixed:
+ case CORBA::tk_native:
+ case CORBA::tk_abstract_interface:
+ case CORBA::tk_component:
+ case CORBA::tk_home:
+ // @@ We don't know how to handle any of them yet.
+ return TAO::TRAVERSE_STOP;
+
+ case CORBA::tk_null:
+ case CORBA::tk_void:
+ case CORBA::tk_short:
+ case CORBA::tk_long:
+ case CORBA::tk_ushort:
+ case CORBA::tk_ulong:
+ case CORBA::tk_float:
+ case CORBA::tk_double:
+ case CORBA::tk_boolean:
+ case CORBA::tk_char:
+ case CORBA::tk_octet:
+ case CORBA::tk_longlong:
+ case CORBA::tk_ulonglong:
+ case CORBA::tk_longdouble:
+ case CORBA::tk_wchar:
+ case CORBA::tk_enum:
+ {
+ TAO_Marshal_Primitive marshal;
+ return marshal.skip (tc, stream ACE_ENV_ARG_PARAMETER);
+ }
+
+ case CORBA::tk_any:
+ {
+ TAO_Marshal_Any marshal;
+ return marshal.skip (tc, stream ACE_ENV_ARG_PARAMETER);
+ }
+ case CORBA::tk_TypeCode:
+ {
+ TAO_Marshal_TypeCode marshal;
+ return marshal.skip (tc, stream ACE_ENV_ARG_PARAMETER);
+ }
+ case CORBA::tk_Principal:
+ {
+ TAO_Marshal_Principal marshal;
+ return marshal.skip (tc, stream ACE_ENV_ARG_PARAMETER);
+ }
+ case CORBA::tk_objref:
+ {
+ TAO_Marshal_ObjRef marshal;
+ return marshal.skip (tc, stream ACE_ENV_ARG_PARAMETER);
+ }
+ case CORBA::tk_struct:
+ {
+ TAO_Marshal_Struct marshal;
+ return marshal.skip (tc, stream ACE_ENV_ARG_PARAMETER);
+ }
+ case CORBA::tk_union:
+ {
+ TAO_Marshal_Union marshal;
+ return marshal.skip (tc, stream ACE_ENV_ARG_PARAMETER);
+ }
+ case CORBA::tk_string:
+ {
+ TAO_Marshal_String marshal;
+ return marshal.skip (tc, stream ACE_ENV_ARG_PARAMETER);
+ }
+ case CORBA::tk_sequence:
+ {
+ TAO_Marshal_Sequence marshal;
+ return marshal.skip (tc, stream ACE_ENV_ARG_PARAMETER);
+ }
+ case CORBA::tk_array:
+ {
+ TAO_Marshal_Array marshal;
+ return marshal.skip (tc, stream ACE_ENV_ARG_PARAMETER);
+ }
+ case CORBA::tk_alias:
+ {
+ TAO_Marshal_Alias marshal;
+ return marshal.skip (tc, stream ACE_ENV_ARG_PARAMETER);
+ }
+ case CORBA::tk_except:
+ {
+ TAO_Marshal_Except marshal;
+ return marshal.skip (tc, stream ACE_ENV_ARG_PARAMETER);
+ }
+ case CORBA::tk_wstring:
+ {
+ TAO_Marshal_WString marshal;
+ return marshal.skip (tc, stream ACE_ENV_ARG_PARAMETER);
+ }
+ case CORBA::tk_value_box:
+ case CORBA::tk_value:
+ {
+ TAO_Marshal_Value marshal;
+ return marshal.skip (tc, stream ACE_ENV_ARG_PARAMETER);
+ }
+ }
+}
+
+TAO::traverse_status
+TAO_Marshal_Object::perform_append (CORBA::TypeCode_ptr tc,
+ TAO_InputCDR *src,
+ TAO_OutputCDR *dest
+ ACE_ENV_ARG_DECL)
+{
+ CORBA::ULong kind = tc->kind (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO::TRAVERSE_STOP);
+
+ switch (kind)
+ {
+ default:
+ case CORBA::tk_fixed:
+ case CORBA::tk_native:
+ case CORBA::tk_abstract_interface:
+ case CORBA::tk_component:
+ case CORBA::tk_home:
+ // @@ We don't know how to handle any of them yet.
+ return TAO::TRAVERSE_STOP;
+
+ case CORBA::tk_null:
+ case CORBA::tk_void:
+ case CORBA::tk_short:
+ case CORBA::tk_long:
+ case CORBA::tk_ushort:
+ case CORBA::tk_ulong:
+ case CORBA::tk_float:
+ case CORBA::tk_double:
+ case CORBA::tk_boolean:
+ case CORBA::tk_char:
+ case CORBA::tk_octet:
+ case CORBA::tk_longlong:
+ case CORBA::tk_ulonglong:
+ case CORBA::tk_longdouble:
+ case CORBA::tk_wchar:
+ case CORBA::tk_enum:
+ {
+ TAO_Marshal_Primitive marshal;
+ return marshal.append (tc, src, dest ACE_ENV_ARG_PARAMETER);
+ }
+
+ case CORBA::tk_any:
+ {
+ TAO_Marshal_Any marshal;
+ return marshal.append (tc, src, dest ACE_ENV_ARG_PARAMETER);
+ }
+ case CORBA::tk_TypeCode:
+ {
+ TAO_Marshal_TypeCode marshal;
+ return marshal.append (tc, src, dest ACE_ENV_ARG_PARAMETER);
+ }
+ case CORBA::tk_Principal:
+ {
+ TAO_Marshal_Principal marshal;
+ return marshal.append (tc, src, dest ACE_ENV_ARG_PARAMETER);
+ }
+ case CORBA::tk_objref:
+ {
+ TAO_Marshal_ObjRef marshal;
+ return marshal.append (tc, src, dest ACE_ENV_ARG_PARAMETER);
+ }
+ case CORBA::tk_struct:
+ {
+ TAO_Marshal_Struct marshal;
+ return marshal.append (tc, src, dest ACE_ENV_ARG_PARAMETER);
+ }
+ case CORBA::tk_union:
+ {
+ TAO_Marshal_Union marshal;
+ return marshal.append (tc, src, dest ACE_ENV_ARG_PARAMETER);
+ }
+ case CORBA::tk_string:
+ {
+ TAO_Marshal_String marshal;
+ return marshal.append (tc, src, dest ACE_ENV_ARG_PARAMETER);
+ }
+ case CORBA::tk_sequence:
+ {
+ TAO_Marshal_Sequence marshal;
+ return marshal.append (tc, src, dest ACE_ENV_ARG_PARAMETER);
+ }
+ case CORBA::tk_array:
+ {
+ TAO_Marshal_Array marshal;
+ return marshal.append (tc, src, dest ACE_ENV_ARG_PARAMETER);
+ }
+ case CORBA::tk_alias:
+ {
+ TAO_Marshal_Alias marshal;
+ return marshal.append (tc, src, dest ACE_ENV_ARG_PARAMETER);
+ }
+ case CORBA::tk_except:
+ {
+ TAO_Marshal_Except marshal;
+ return marshal.append (tc, src, dest ACE_ENV_ARG_PARAMETER);
+ }
+ case CORBA::tk_wstring:
+ {
+ TAO_Marshal_WString marshal;
+ return marshal.append (tc, src, dest ACE_ENV_ARG_PARAMETER);
+ }
+ case CORBA::tk_value_box:
+ case CORBA::tk_value:
+ {
+ TAO_Marshal_Value marshal;
+ return marshal.append (tc, src, dest ACE_ENV_ARG_PARAMETER);
+ }
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/AnyTypeCode/Marshal.h b/TAO/tao/AnyTypeCode/Marshal.h
new file mode 100644
index 00000000000..6232bc5f87d
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Marshal.h
@@ -0,0 +1,459 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Marshal.h
+ *
+ * $Id$
+ *
+ * Classes that marshal various IDL data types.
+ *
+ *
+ * @author Aniruddha S. Gokhale
+ */
+//=============================================================================
+
+
+#ifndef TAO_MARSHAL_H
+#define TAO_MARSHAL_H
+
+#include /**/ "ace/pre.h"
+#include "ace/CORBA_macros.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/AnyTypeCode/TAO_AnyTypeCode_Export.h"
+#include "tao/Basic_Types.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace CORBA
+{
+ class TypeCode;
+ typedef TypeCode *TypeCode_ptr;
+
+ class Environment;
+}
+
+class TAO_OutputCDR;
+class TAO_InputCDR;
+
+// = Forward declarations.
+class TAO_Marshal_Object;
+class TAO_Marshal_Primitive;
+class TAO_Marshal_Any;
+class TAO_Marshal_TypeCode;
+class TAO_Marshal_Principal;
+class TAO_Marshal_ObjRef;
+class TAO_Marshal_Struct;
+class TAO_Marshal_Union;
+class TAO_Marshal_String;
+class TAO_Marshal_Sequence;
+class TAO_Marshal_Array;
+class TAO_Marshal_Alias;
+class TAO_Marshal_Except;
+class TAO_Marshal_WString;
+class TAO_Marshal_Value;
+
+namespace TAO
+{
+ enum traverse_status
+ {
+ TRAVERSE_STOP,
+ TRAVERSE_CONTINUE
+ };
+}
+
+/**
+ * @class TAO_Marshal_Object
+ *
+ * @brief TAO_Marshal_Object
+ *
+ * The Marshaling object that provides a common interface to the
+ * CDR object for marshaling different IDL data types
+ * Provides a set of virtual methods for appending and skipping
+ * data over a CDR stream.
+ */
+class TAO_AnyTypeCode_Export TAO_Marshal_Object
+{
+public:
+ /// constructor
+ TAO_Marshal_Object (void);
+
+ /// destructor
+ virtual ~TAO_Marshal_Object (void);
+
+ /// skip entry point, it allocates the right kind of Marshal_Object
+ /// and invokes skip on it.
+ static TAO::traverse_status perform_skip (CORBA::TypeCode_ptr tc,
+ TAO_InputCDR *context
+ ACE_ENV_ARG_DECL);
+
+ /// skip operation
+ virtual TAO::traverse_status skip (CORBA::TypeCode_ptr tc,
+ TAO_InputCDR *context
+ ACE_ENV_ARG_DECL) = 0;
+
+ /// append entry point, it allocates the right kind of Marshal_Object
+ /// and invokes skip on it.
+ static TAO::traverse_status perform_append (CORBA::TypeCode_ptr tc,
+ TAO_InputCDR *src,
+ TAO_OutputCDR *dest
+ ACE_ENV_ARG_DECL);
+
+ /// append operation
+ virtual TAO::traverse_status append (CORBA::TypeCode_ptr tc,
+ TAO_InputCDR *src,
+ TAO_OutputCDR *dest
+ ACE_ENV_ARG_DECL) = 0;
+};
+
+/**
+ * @class TAO_Marshal_Primitive:
+ *
+ * @brief TAO_Marshal_Primitive
+ *
+ * marshaling primitives
+ */
+class TAO_AnyTypeCode_Export TAO_Marshal_Primitive: public TAO_Marshal_Object
+{
+public:
+ TAO_Marshal_Primitive (void);
+
+ /// skip operation
+ virtual TAO::traverse_status skip (CORBA::TypeCode_ptr tc,
+ TAO_InputCDR *context
+ ACE_ENV_ARG_DECL);
+
+ /// append operation
+ virtual TAO::traverse_status append (CORBA::TypeCode_ptr tc,
+ TAO_InputCDR *src,
+ TAO_OutputCDR *dest
+ ACE_ENV_ARG_DECL);
+};
+
+/**
+ * @class TAO_Marshal_Any:
+ *
+ * @brief TAO_Marshal_Any
+ *
+ * Marshal an Any
+ */
+class TAO_AnyTypeCode_Export TAO_Marshal_Any: public TAO_Marshal_Object
+{
+public:
+ TAO_Marshal_Any (void);
+
+ /// skip operation
+ virtual TAO::traverse_status skip (CORBA::TypeCode_ptr tc,
+ TAO_InputCDR *context
+ ACE_ENV_ARG_DECL);
+
+ /// append operation
+ virtual TAO::traverse_status append (CORBA::TypeCode_ptr tc,
+ TAO_InputCDR *src,
+ TAO_OutputCDR *dest
+ ACE_ENV_ARG_DECL);
+};
+
+/**
+ * @class TAO_Marshal_TypeCode:
+ *
+ * @brief TAO_Marshal_TypeCode
+ *
+ * marshal a typecode
+ */
+class TAO_AnyTypeCode_Export TAO_Marshal_TypeCode: public TAO_Marshal_Object
+{
+public:
+ TAO_Marshal_TypeCode (void);
+
+ /// skip operation
+ virtual TAO::traverse_status skip (CORBA::TypeCode_ptr tc,
+ TAO_InputCDR *context
+ ACE_ENV_ARG_DECL);
+
+ /// append operation
+ virtual TAO::traverse_status append (CORBA::TypeCode_ptr tc,
+ TAO_InputCDR *src,
+ TAO_OutputCDR *dest
+ ACE_ENV_ARG_DECL);
+};
+
+/**
+ * @class TAO_Marshal_Principal:
+ *
+ * @brief TAO_Marshal_Principal
+ *
+ * marshal a principal
+ */
+class TAO_AnyTypeCode_Export TAO_Marshal_Principal: public TAO_Marshal_Object
+{
+public:
+ TAO_Marshal_Principal (void);
+
+ /// skip operation
+ virtual TAO::traverse_status skip (CORBA::TypeCode_ptr tc,
+ TAO_InputCDR *context
+ ACE_ENV_ARG_DECL);
+
+ /// append operation
+ virtual TAO::traverse_status append (CORBA::TypeCode_ptr tc,
+ TAO_InputCDR *src,
+ TAO_OutputCDR *dest
+ ACE_ENV_ARG_DECL);
+};
+
+/**
+ * @class TAO_Marshal_ObjRef:
+ *
+ * @brief TAO_Marshal_ObjRef
+ *
+ * marshal an object reference
+ */
+class TAO_AnyTypeCode_Export TAO_Marshal_ObjRef: public TAO_Marshal_Object
+{
+public:
+ TAO_Marshal_ObjRef (void);
+
+ /// skip operation
+ virtual TAO::traverse_status skip (CORBA::TypeCode_ptr tc,
+ TAO_InputCDR *context
+ ACE_ENV_ARG_DECL);
+
+ /// append operation
+ virtual TAO::traverse_status append (CORBA::TypeCode_ptr tc,
+ TAO_InputCDR *src,
+ TAO_OutputCDR *dest
+ ACE_ENV_ARG_DECL);
+};
+
+/**
+ * @class TAO_Marshal_Struct:
+ *
+ * @brief TAO_Marshal_Struct
+ *
+ * marshal a struct
+ */
+class TAO_AnyTypeCode_Export TAO_Marshal_Struct: public TAO_Marshal_Object
+{
+public:
+ TAO_Marshal_Struct (void);
+
+ /// skip operation
+ virtual TAO::traverse_status skip (CORBA::TypeCode_ptr tc,
+ TAO_InputCDR *context
+ ACE_ENV_ARG_DECL);
+
+ /// append operation
+ virtual TAO::traverse_status append (CORBA::TypeCode_ptr tc,
+ TAO_InputCDR *src,
+ TAO_OutputCDR *dest
+ ACE_ENV_ARG_DECL);
+};
+
+/**
+ * @class TAO_Marshal_Union:
+ *
+ * @brief TAO_Marshal_Union
+ *
+ * marshal a union
+ */
+class TAO_AnyTypeCode_Export TAO_Marshal_Union: public TAO_Marshal_Object
+{
+public:
+ TAO_Marshal_Union (void);
+
+ /// skip operation
+ virtual TAO::traverse_status skip (CORBA::TypeCode_ptr tc,
+ TAO_InputCDR *context
+ ACE_ENV_ARG_DECL);
+
+ /// append operation
+ virtual TAO::traverse_status append (CORBA::TypeCode_ptr tc,
+ TAO_InputCDR *src,
+ TAO_OutputCDR *dest
+ ACE_ENV_ARG_DECL);
+};
+
+/**
+ * @class TAO_Marshal_String:
+ *
+ * @brief TAO_Marshal_String
+ *
+ * marshal a string
+ */
+class TAO_AnyTypeCode_Export TAO_Marshal_String: public TAO_Marshal_Object
+{
+public:
+ TAO_Marshal_String (void);
+
+ /// skip operation
+ virtual TAO::traverse_status skip (CORBA::TypeCode_ptr tc,
+ TAO_InputCDR *context
+ ACE_ENV_ARG_DECL);
+
+ /// append operation
+ virtual TAO::traverse_status append (CORBA::TypeCode_ptr tc,
+ TAO_InputCDR *src,
+ TAO_OutputCDR *dest
+ ACE_ENV_ARG_DECL);
+};
+
+/**
+ * @class TAO_Marshal_Sequence:
+ *
+ * @brief TAO_Marshal_Sequence
+ *
+ * marshal a sequence
+ */
+class TAO_AnyTypeCode_Export TAO_Marshal_Sequence: public TAO_Marshal_Object
+{
+public:
+ TAO_Marshal_Sequence (void);
+
+ /// skip operation
+ virtual TAO::traverse_status skip (CORBA::TypeCode_ptr tc,
+ TAO_InputCDR *context
+ ACE_ENV_ARG_DECL);
+
+ /// append operation
+ virtual TAO::traverse_status append (CORBA::TypeCode_ptr tc,
+ TAO_InputCDR *src,
+ TAO_OutputCDR *dest
+ ACE_ENV_ARG_DECL);
+};
+
+/**
+ * @class TAO_Marshal_Array:
+ *
+ * @brief TAO_Marshal_Array
+ *
+ * marshal an array
+ */
+class TAO_AnyTypeCode_Export TAO_Marshal_Array: public TAO_Marshal_Object
+{
+public:
+ TAO_Marshal_Array (void);
+
+ /// skip operation
+ virtual TAO::traverse_status skip (CORBA::TypeCode_ptr tc,
+ TAO_InputCDR *context
+ ACE_ENV_ARG_DECL);
+
+ /// append operation
+ virtual TAO::traverse_status append (CORBA::TypeCode_ptr tc,
+ TAO_InputCDR *src,
+ TAO_OutputCDR *dest
+ ACE_ENV_ARG_DECL);
+};
+
+/**
+ * @class TAO_Marshal_Alias:
+ *
+ * @brief TAO_Marshal_Alias
+ *
+ * marshal an alias
+ */
+class TAO_AnyTypeCode_Export TAO_Marshal_Alias: public TAO_Marshal_Object
+{
+public:
+ TAO_Marshal_Alias (void);
+
+ /// skip operation
+ virtual TAO::traverse_status skip (CORBA::TypeCode_ptr tc,
+ TAO_InputCDR *context
+ ACE_ENV_ARG_DECL);
+
+ /// append operation
+ virtual TAO::traverse_status append (CORBA::TypeCode_ptr tc,
+ TAO_InputCDR *src,
+ TAO_OutputCDR *dest
+ ACE_ENV_ARG_DECL);
+};
+
+/**
+ * @class TAO_Marshal_Except:
+ *
+ * @brief TAO_Marshal_Except
+ *
+ * marshal an exception
+ */
+class TAO_AnyTypeCode_Export TAO_Marshal_Except: public TAO_Marshal_Object
+{
+public:
+ TAO_Marshal_Except (void);
+
+ /// skip operation
+ virtual TAO::traverse_status skip (CORBA::TypeCode_ptr tc,
+ TAO_InputCDR *context
+ ACE_ENV_ARG_DECL);
+
+ /// append operation
+ virtual TAO::traverse_status append (CORBA::TypeCode_ptr tc,
+ TAO_InputCDR *src,
+ TAO_OutputCDR *dest
+ ACE_ENV_ARG_DECL);
+};
+
+/**
+ * @class TAO_Marshal_WString
+ *
+ * @brief TAO_Marshal_WString
+ *
+ * marshal a wide string
+ */
+class TAO_AnyTypeCode_Export TAO_Marshal_WString : public TAO_Marshal_Object
+{
+public:
+ TAO_Marshal_WString (void);
+
+ /// skip operation
+ virtual TAO::traverse_status skip (CORBA::TypeCode_ptr tc,
+ TAO_InputCDR *context
+ ACE_ENV_ARG_DECL);
+
+ /// append operation
+ virtual TAO::traverse_status append (CORBA::TypeCode_ptr tc,
+ TAO_InputCDR *src,
+ TAO_OutputCDR *dest
+ ACE_ENV_ARG_DECL);
+};
+
+/**
+ * @class TAO_Marshal_Value:
+ *
+ * @brief TAO_Marshal_Value
+ *
+ * marshal a valuetype
+ */
+class TAO_AnyTypeCode_Export TAO_Marshal_Value: public TAO_Marshal_Object
+{
+public:
+ TAO_Marshal_Value (void);
+
+ /// skip operation
+ virtual TAO::traverse_status skip (CORBA::TypeCode_ptr tc,
+ TAO_InputCDR *context
+ ACE_ENV_ARG_DECL);
+
+ /// append operation
+ virtual TAO::traverse_status append (CORBA::TypeCode_ptr tc,
+ TAO_InputCDR *src,
+ TAO_OutputCDR *dest
+ ACE_ENV_ARG_DECL);
+
+private:
+ CORBA::Boolean nested_processing_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/AnyTypeCode/Marshal.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_MARSHAL_H */
diff --git a/TAO/tao/AnyTypeCode/Marshal.inl b/TAO/tao/AnyTypeCode/Marshal.inl
new file mode 100644
index 00000000000..cb1fb80d2c4
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Marshal.inl
@@ -0,0 +1,83 @@
+// -*- C++ -*-
+//
+//$Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO_Marshal_Object::TAO_Marshal_Object (void)
+{
+}
+
+ACE_INLINE
+TAO_Marshal_Primitive::TAO_Marshal_Primitive (void)
+{
+}
+
+ACE_INLINE
+TAO_Marshal_Any::TAO_Marshal_Any (void)
+{
+}
+
+ACE_INLINE
+TAO_Marshal_Principal::TAO_Marshal_Principal (void)
+{
+}
+
+ACE_INLINE
+TAO_Marshal_TypeCode::TAO_Marshal_TypeCode (void)
+{
+}
+
+ACE_INLINE
+TAO_Marshal_ObjRef::TAO_Marshal_ObjRef (void)
+{
+}
+
+ACE_INLINE
+TAO_Marshal_Struct::TAO_Marshal_Struct (void)
+{
+}
+
+ACE_INLINE
+TAO_Marshal_Union::TAO_Marshal_Union (void)
+{
+}
+
+ACE_INLINE
+TAO_Marshal_String::TAO_Marshal_String (void)
+{
+}
+
+ACE_INLINE
+TAO_Marshal_Sequence::TAO_Marshal_Sequence (void)
+{
+}
+
+ACE_INLINE
+TAO_Marshal_Array::TAO_Marshal_Array (void)
+{
+}
+
+ACE_INLINE
+TAO_Marshal_Alias::TAO_Marshal_Alias (void)
+{
+}
+
+ACE_INLINE
+TAO_Marshal_Except::TAO_Marshal_Except (void)
+{
+}
+
+ACE_INLINE
+TAO_Marshal_WString::TAO_Marshal_WString (void)
+{
+}
+
+ACE_INLINE
+TAO_Marshal_Value::TAO_Marshal_Value (void)
+ : nested_processing_ (false)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/AnyTypeCode/NVList.cpp b/TAO/tao/AnyTypeCode/NVList.cpp
new file mode 100644
index 00000000000..0a0b9ef54ee
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/NVList.cpp
@@ -0,0 +1,501 @@
+// $Id$
+
+
+// Implementation of Named Value List and NamedValue classes
+
+#include "tao/AnyTypeCode/NVList.h"
+#include "tao/AnyTypeCode/BoundsC.h"
+#include "tao/AnyTypeCode/TypeCode.h"
+#include "tao/AnyTypeCode/Marshal.h"
+#include "tao/AnyTypeCode/Any_Impl.h"
+
+#include "tao/SystemException.h"
+#include "tao/CORBA_String.h"
+#include "tao/CDR.h"
+#include "tao/debug.h"
+
+#include "ace/Auto_Ptr.h"
+#include "ace/Log_Msg.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/AnyTypeCode/NVList.inl"
+#endif /* ! __ACE_INLINE__ */
+
+ACE_RCSID (AnyTypeCode,
+ NVList,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Reference counting for DII Request object
+
+CORBA::ULong
+CORBA::NamedValue::_incr_refcnt (void)
+{
+ return ++this->refcount_;
+}
+
+CORBA::ULong
+CORBA::NamedValue::_decr_refcnt (void)
+{
+ const CORBA::ULong new_count = --this->refcount_;
+
+ if (new_count == 0)
+ delete this;
+
+ return new_count;
+}
+
+CORBA::NamedValue::~NamedValue (void)
+{
+ if (this->name_)
+ {
+ CORBA::string_free (this->name_);
+ this->name_ = 0;
+ }
+ // the any will be destroyed by itself
+}
+
+// ****************************************************************
+
+CORBA::ULong
+CORBA::NVList::_incr_refcnt (void)
+{
+ return ++this->refcount_;
+}
+
+CORBA::ULong
+CORBA::NVList::_decr_refcnt (void)
+{
+ const CORBA::ULong new_count = --this->refcount_;
+
+ if (new_count == 0)
+ delete this;
+
+ return new_count;
+}
+
+CORBA::NVList::~NVList (void)
+{
+ // initialize an iterator and delete each NamedValue
+ ACE_Unbounded_Queue_Iterator<CORBA::NamedValue_ptr> iter (this->values_);
+
+ for (iter.first (); !iter.done (); iter.advance ())
+ {
+ CORBA::NamedValue_ptr *nv = 0;
+ (void) iter.next (nv);
+ delete *nv;
+ }
+
+ this->max_ = 0;
+
+ // Remove the CDR stream if it is present.
+ delete this->incoming_;
+}
+
+// add an element and just initialize its flags
+CORBA::NamedValue_ptr
+CORBA::NVList::add (CORBA::Flags flags
+ ACE_ENV_ARG_DECL)
+{
+ // call the helper to allocate a NamedValue element (if necessary)
+ return this->add_element (flags
+ ACE_ENV_ARG_PARAMETER);
+}
+
+// add an element and just initialize its flags and name
+CORBA::NamedValue_ptr
+CORBA::NVList::add_item (const char *name,
+ CORBA::Flags flags
+ ACE_ENV_ARG_DECL)
+{
+ // call the helper to allocate a NamedValue element
+ CORBA::NamedValue_ptr nv = this->add_element (flags
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ if (nv)
+ {
+ // now initialize the fields
+ nv->name_ = CORBA::string_dup (name);
+ return nv;
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+// add a value. If necessary, increment the list
+CORBA::NamedValue_ptr
+CORBA::NVList::add_value (const char *name,
+ const CORBA::Any &value,
+ CORBA::Flags flags
+ ACE_ENV_ARG_DECL)
+{
+ // Call the helper to allocate a NamedValue element.
+ CORBA::NamedValue_ptr nv = this->add_element (flags
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ if (nv)
+ {
+ nv->name_ = CORBA::string_dup (name);
+
+ // With the original Any implementation, we had alternate
+ // paths for the assignment based on the IN_COPY_VALUE flag.
+ // Now that the Any's contained Any_Impl is refcounted, the
+ // distinction between the ORB "copying" or "borrowing" the
+ // memory is irrelevant. The IN_COPY_VALUE flag was not
+ // checked anywhere else in the ORB anyway.
+ nv->any_ = value;
+ return nv;
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+// add an element and just initialize its flags and name
+CORBA::NamedValue_ptr
+CORBA::NVList::add_item_consume (char *name,
+ CORBA::Flags flags
+ ACE_ENV_ARG_DECL)
+{
+
+ // call the helper to allocate a NamedValue element
+ CORBA::NamedValue_ptr nv = this->add_element (flags
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ if (nv)
+ {
+ // now initialize the fields
+
+ // consume the name
+ nv->name_ = name;
+ return nv;
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+// add a value. If necessary, increment the list
+CORBA::NamedValue_ptr
+CORBA::NVList::add_value_consume (char * name,
+ CORBA::Any * value,
+ CORBA::Flags flags
+ ACE_ENV_ARG_DECL)
+{
+ // call the helper to allocate a NamedValue element
+ CORBA::NamedValue_ptr nv = this->add_element (flags
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ if (nv)
+ {
+ // now initialize the fields
+
+ // consume name
+ nv->name_ = name;
+
+ // consume the value @@ (ASG) have we? we may need to destroy
+ // the in parameter
+ nv->any_ = *value;
+ return nv;
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+//CORBA::Status
+void
+CORBA::NVList::remove (CORBA::ULong /* n */
+ ACE_ENV_ARG_DECL_NOT_USED)
+{
+ // not implemented
+ // @@ (ASG) - TODO
+}
+
+// Helper method
+CORBA::NamedValue_ptr
+CORBA::NVList::add_element (CORBA::Flags flags
+ ACE_ENV_ARG_DECL)
+{
+ this->evaluate (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::NamedValue::_nil ());
+
+ if (ACE_BIT_DISABLED (flags,
+ CORBA::ARG_IN | CORBA::ARG_OUT | CORBA::ARG_INOUT))
+ {
+ ACE_THROW_RETURN (CORBA::BAD_PARAM (),
+ CORBA::NamedValue::_nil ());
+ }
+
+ CORBA::NamedValue_ptr nv;
+
+ // allocate a new NamedValue
+ ACE_NEW_THROW_EX (nv,
+ CORBA::NamedValue,
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (CORBA::NamedValue::_nil ());
+
+ // set the flags and enqueue in the queue
+ nv->flags_ = flags;
+
+ if (this->values_.enqueue_tail (nv) == -1)
+ {
+ delete nv;
+ return 0;
+ }
+
+ this->max_++;
+ return nv; // success
+}
+
+// return the item at location n
+CORBA::NamedValue_ptr
+CORBA::NVList::item (CORBA::ULong n
+ ACE_ENV_ARG_DECL)
+{
+ this->evaluate (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::NamedValue::_nil ());
+
+ if (n >= this->max_)
+ {
+ ACE_THROW_RETURN (CORBA::Bounds (),
+ CORBA::NamedValue::_nil ());
+ }
+
+ CORBA::NamedValue_ptr *nv = 0;
+
+ this->values_.get (nv, n);
+ return *nv;
+}
+
+void
+CORBA::NVList::_tao_incoming_cdr (TAO_InputCDR &cdr,
+ int flag,
+ bool &lazy_evaluation
+ ACE_ENV_ARG_DECL)
+{
+ // If the list is empty then using lazy evaluation is the only
+ // choice.
+ // @@ There are other cases where we can use lazy evaluation, for
+ // example if the list is not empty but the anys own all their
+ // objects.
+ if (lazy_evaluation == false && this->max_ == 0)
+ {
+ lazy_evaluation = true;
+ }
+
+ if (lazy_evaluation == false)
+ {
+ this->_tao_decode (cdr,
+ flag
+ ACE_ENV_ARG_PARAMETER);
+ return;
+ }
+
+ ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->lock_);
+
+ if (this->incoming_ != 0)
+ {
+ delete this->incoming_;
+ this->incoming_ = 0;
+ }
+
+ ACE_NEW (this->incoming_, TAO_InputCDR (cdr));
+ this->incoming_flag_ = flag;
+}
+
+void
+CORBA::NVList::_tao_encode (TAO_OutputCDR &cdr,
+ int flag
+ ACE_ENV_ARG_DECL)
+{
+ ACE_GUARD (TAO_SYNCH_MUTEX,
+ ace_mon,
+ this->lock_);
+
+ if (this->incoming_ != 0)
+ {
+ if (this->max_ == 0)
+ {
+ // The list is empty aggresively reduce copies and just send
+ // the CDR stream, we assume that
+ // TAO_Server_Request::init_reply
+ // has inserted appropiated padding already to make this
+ // operation correct
+ cdr.write_octet_array_mb (this->incoming_->start ());
+ return;
+ }
+
+ // Then unmarshal each "in" and "inout" parameter.
+ ACE_Unbounded_Queue_Iterator<CORBA::NamedValue_ptr> i (this->values_);
+
+ for (i.first (); !i.done (); i.advance ())
+ {
+ CORBA::NamedValue_ptr *item = 0;
+ (void) i.next (item);
+
+ CORBA::NamedValue_ptr nv = *item;
+
+ if (ACE_BIT_DISABLED (nv->flags (), flag))
+ {
+ continue;
+ }
+
+ if (TAO_debug_level > 3)
+ {
+ const char* arg = nv->name ();
+
+ if (arg == 0)
+ {
+ arg = "(nil)";
+ }
+
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("NVList::_tao_encode - parameter <%s>\n"),
+ ACE_TEXT_CHAR_TO_TCHAR (arg)));
+ }
+ CORBA::TypeCode_ptr tc = nv->value ()->_tao_get_typecode ();
+ (void) TAO_Marshal_Object::perform_append (tc,
+ this->incoming_,
+ &cdr
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ delete this->incoming_;
+ this->incoming_ = 0;
+ return;
+ }
+
+ // The list is already evaluated, we cannot optimize the copies, go
+ // ahead with the slow way to do things.
+
+ // Then marshal each "in" and "inout" parameter.
+ ACE_Unbounded_Queue_Iterator<CORBA::NamedValue_ptr> i (this->values_);
+
+ for (i.first (); !i.done (); i.advance ())
+ {
+ CORBA::NamedValue_ptr *item = 0;
+ (void) i.next (item);
+
+ CORBA::NamedValue_ptr nv = *item;
+
+ if (ACE_BIT_DISABLED (nv->flags (), flag))
+ {
+ continue;
+ }
+
+ nv->value ()->impl ()->marshal_value (cdr);
+ }
+}
+
+void
+CORBA::NVList::_tao_decode (TAO_InputCDR &incoming,
+ int flag
+ ACE_ENV_ARG_DECL)
+{
+ if (TAO_debug_level > 3)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) : NVList::_tao_decode\n")));
+ }
+
+ // Then unmarshal each "in" and "inout" parameter.
+ ACE_Unbounded_Queue_Iterator<CORBA::NamedValue_ptr> i (this->values_);
+
+ for (i.first (); !i.done (); i.advance ())
+ {
+ CORBA::NamedValue_ptr *item = 0;
+ (void) i.next (item);
+
+ CORBA::NamedValue_ptr nv = *item;
+
+ // check if it is an in or inout parameter
+ // @@ this is where we assume that the NVList is coming from
+ // a Server-side request, we could probably handle both
+ // cases with a flag, but there is no clear need for that.
+ if (ACE_BIT_DISABLED (nv->flags (), flag))
+ {
+ continue;
+ }
+
+ if (TAO_debug_level > 3)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) : NVList::_tao_decode - %s\n"),
+ ACE_TEXT_CHAR_TO_TCHAR (nv->name ()? nv->name () : "(no name given)" )));
+ }
+
+ CORBA::Any_ptr any = nv->value ();
+ any->impl ()->_tao_decode (incoming
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+}
+
+ptrdiff_t
+CORBA::NVList::_tao_target_alignment (void)
+{
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
+ ace_mon,
+ this->lock_,
+ ACE_CDR::MAX_ALIGNMENT);
+
+ if (this->incoming_ == 0)
+ {
+ return ACE_CDR::MAX_ALIGNMENT;
+ }
+
+ const char* rd = this->incoming_->start ()->rd_ptr ();
+ ptrdiff_t t = ptrdiff_t (rd) % ACE_CDR::MAX_ALIGNMENT;
+
+ if (t < 0)
+ {
+ t += ACE_CDR::MAX_ALIGNMENT;
+ }
+
+ return t;
+}
+
+void
+CORBA::NVList::evaluate (ACE_ENV_SINGLE_ARG_DECL)
+{
+ ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->lock_);
+
+ if (this->incoming_ == 0)
+ {
+ return;
+ }
+
+ auto_ptr<TAO_InputCDR> incoming (this->incoming_);
+ this->incoming_ = 0;
+
+ this->_tao_decode (*(incoming.get ()),
+ this->incoming_flag_
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::Boolean
+CORBA::NVList::_lazy_has_arguments (void) const
+{
+ if (this->incoming_ != 0)
+ {
+ return this->incoming_->length () == 0 ? 0 : 1;
+ }
+ else
+ {
+ return this->count () == 0 ? 0 : 1;
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/AnyTypeCode/NVList.h b/TAO/tao/AnyTypeCode/NVList.h
new file mode 100644
index 00000000000..d78a228726a
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/NVList.h
@@ -0,0 +1,314 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file NVList.h
+ *
+ * $Id$
+ *
+ * @author Copyright 1994-1995 by Sun Microsystems Inc.
+ * @author Aniruddha Gokhale <gokhale@cs.wustl.edu>
+ */
+//=============================================================================
+
+
+#ifndef TAO_NVLIST_H
+#define TAO_NVLIST_H
+
+#include /**/ "ace/pre.h"
+#include "ace/CORBA_macros.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/AnyTypeCode/AnyTypeCode_methods.h"
+#include "tao/AnyTypeCode/Any.h"
+#include "tao/AnyTypeCode/NVList_Adapter_Impl.h"
+
+#include "tao/Environment.h"
+
+#include "ace/Unbounded_Queue.h"
+#include "ace/Thread_Mutex.h"
+#include "ace/Atomic_Op.h"
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_InputCDR;
+
+namespace CORBA
+{
+ enum
+ {
+ // = Flags for NVList add methods
+ ARG_IN = 0x01,
+ ARG_OUT = 0x02,
+ ARG_INOUT = 0x04,
+ IN_COPY_VALUE = 0x08,
+ OUT_LIST_MEMORY = 0x10,
+ DEPENDENT_LIST = 0x20,
+
+ // = (Unused) flags for Context methods
+ CTX_RESTRICT_SCOPE = 0x40,
+ CTX_DELETE_DESCENDENTS = 0x80,
+
+ // = Flags for deferred synchronous methods
+ INV_NO_RESPONSE = 0x100,
+ INV_TERM_ON_ERR = 0x200,
+ RESP_NO_WAIT = 0x400
+ };
+
+ typedef TAO_Pseudo_Var_T<NamedValue> NamedValue_var;
+ typedef TAO_Pseudo_Out_T<NamedValue> NamedValue_out;
+
+ typedef ULong Flags;
+
+ /**
+ * @class NamedValue
+ *
+ * @brief CORBA Name/value pair implementation.
+ *
+ * These occur only in "NVList" (named value list) data structures.
+ * The binary form of the data structure is frozen and visible to
+ * programs using it (e.g. from C). The C++ class supports some
+ * programming discipline, e.g. to avoid memory leaks. They just
+ * represent parameters to calls. The name is optional, and the
+ * value is packaged as an Any. The flags indicate parameter mode,
+ * and some ownership rules for "top level" memory.
+ */
+ class TAO_AnyTypeCode_Export NamedValue
+ {
+ friend class ::TAO_NVList_Adapter_Impl;
+ friend class NVList;
+ friend class Request;
+
+ public:
+ /// optional name
+ const char * name (void) const;
+
+ /// return the value
+ Any_ptr value (void) const;
+
+ /// return the parameter mode flag
+ Flags flags (void) const;
+
+ // The pseudo object static methods..
+ static NamedValue * _duplicate (NamedValue *);
+ static NamedValue * _nil (void);
+
+ // = Reference counting.
+ ULong _incr_refcnt (void);
+ ULong _decr_refcnt (void);
+
+ // Useful for template programming.
+ typedef NamedValue_ptr _ptr_type;
+ typedef NamedValue_var _var_type;
+ typedef NamedValue_out _out_type;
+
+ protected:
+
+ /// Destructor
+ /**
+ * Protected destructor to enforce proper memory management
+ * through the reference counting mechanism.
+ */
+ ~NamedValue (void);
+
+ private:
+
+ /// private constructor. Cannot be directly instantiated other than
+ /// by its friends.
+ NamedValue (void);
+
+ private:
+
+ /// Reference counter.
+ ACE_Atomic_Op<TAO_SYNCH_MUTEX, unsigned long> refcount_;
+
+ /// holds the value
+ Any any_;
+
+ /// parameter mode flags
+ Flags flags_;
+
+ /// optional IDL name of the parameter
+ char * name_;
+ };
+
+ // ****************************************************************
+
+ typedef TAO_Pseudo_Var_T<NVList> NVList_var;
+ typedef TAO_Pseudo_Out_T<NVList> NVList_out;
+
+ /**
+ * @class NVList
+ *
+ * @brief CORBA::NVList implementation.
+
+ * This is used in the (client side) DII (Dynamic Invocation
+ * Interface) to hold parameters, except for the return
+ * parameter. It's used in the same role in the (server side) DSI
+ * (Dynamic Skeleton Interface).
+ *
+ * Each user (client, server) provides the typecode and memory for
+ * each parameter using an NVList, then talks to the ORB using a
+ * Request or ServerRequest pseudo-object. The ORB copies data
+ * to/from the IPC messages (e.g. IIOP::Request, IIOP::Response)
+ * as appropriate.
+ */
+ class TAO_AnyTypeCode_Export NVList
+ {
+ friend class ::TAO_NVList_Adapter_Impl;
+ friend class Request;
+
+ public:
+
+ /// return the current number of elements in the list
+ ULong count (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) const;
+
+ /// add an element and just initialize the flags
+ NamedValue_ptr add (Flags
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ /// add an element and initialize its name and flags
+ NamedValue_ptr add_item (const char *,
+ Flags
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ /// initializes a value, name, and flags
+ NamedValue_ptr add_value (const char *,
+ const Any &,
+ Flags
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ /// just like add_item. In addition, memory management of char *
+ /// name is taken over by the NVList
+ NamedValue_ptr add_item_consume (char *,
+ Flags
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ /// just like add_value. In addition, the NVList controls the
+ /// memory management of the char *name and Any *value parameter
+ NamedValue_ptr add_value_consume (char *,
+ Any_ptr,
+ Flags
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ /// retrieve the item at the nth location. Raises Bounds
+ NamedValue_ptr item (ULong n
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ // CORBA::Status
+ /// remove element at index n. Raises Bounds
+ void remove (ULong n
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ // The pseudo object static methods..
+ static NVList * _duplicate (NVList *);
+ static NVList * _nil (void);
+
+ // = Reference counting.
+ ULong _incr_refcnt (void);
+ ULong _decr_refcnt (void);
+
+ // = TAO Extensions:
+
+ /**
+ * Set the incoming CDR stream, this is used by TAO to perform lazy
+ * evaluation of the NVList in an incoming ServerRequest.
+ * The <flag> is used to check which parameters (IN, OUT and/or
+ * INOUT) are to be extracted
+ */
+ void _tao_incoming_cdr (TAO_InputCDR & cdr,
+ int flag,
+ bool &lazy_evaluation
+ ACE_ENV_ARG_DECL);
+
+ /// Encode the NVList into the CDR stream. <flag> masks the type of
+ /// arguments (IN, OUT or INOUT) that are to be marshaled.
+ void _tao_encode (TAO_OutputCDR & cdr,
+ int flag
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ /// Decode the NVList arguments from the <cdr> stream.
+ void _tao_decode (TAO_InputCDR & cdr,
+ int flag
+ ACE_ENV_ARG_DECL);
+
+ /**
+ * Return the required alignment to marshal the NVList without any
+ * re-alignment.
+ * It returns ACE_CDR::MAX_ALIGNMENT to indicate errors.
+ */
+ ptrdiff_t _tao_target_alignment (void);
+
+ /**
+ * If this list is used by a DII request, this will tell us if
+ * our CDR stream contains any marshaled arguments (needed for
+ * GIOP 1.2).
+ */
+ Boolean _lazy_has_arguments (void) const;
+
+ // Useful for template programming.
+ typedef NVList_ptr _ptr_type;
+ typedef NVList_var _var_type;
+ typedef NVList_out _out_type;
+
+ protected:
+
+ /// Destructor
+ /**
+ * Protected destructor to enforce proper memory management
+ * through the reference counting mechanism.
+ */
+ ~NVList (void);
+
+ private:
+ /// constructor - cannot be instantiated directly other than
+ /// through the CORBA::ORB::create_list method
+ NVList (void);
+
+ /// helper to increase the list size. This is used by all the add_
+ /// methods of the NVList class
+ NamedValue_ptr add_element (Flags
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ /// Lazy evaluation routine to fill up the Anys in the NVList from
+ /// the CDR stream.
+ void evaluate (ACE_ENV_SINGLE_ARG_DECL);
+
+ private:
+ /// internal list of parameters stored as NamedValues
+ ACE_Unbounded_Queue<NamedValue_ptr> values_;
+
+ /// maximum length of list
+ ULong max_;
+
+ /// Reference counter.
+ ACE_Atomic_Op<TAO_SYNCH_MUTEX, unsigned long> refcount_;
+
+ /// Protects the incoming pointer.
+ TAO_SYNCH_MUTEX lock_;
+
+ /**
+ * When the NVList is used as part of a Server Request we can simply
+ * store the CDR buffer and perform lazy evaluation to compute the
+ * Anys.
+ */
+ TAO_InputCDR * incoming_;
+
+ /// The flags used to check which parameters are actually extracted
+ /// from the <incoming_> buffer
+ int incoming_flag_;
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/AnyTypeCode/NVList.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_NVLIST_H */
diff --git a/TAO/tao/AnyTypeCode/NVList.inl b/TAO/tao/AnyTypeCode/NVList.inl
new file mode 100644
index 00000000000..e89db0e4dfb
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/NVList.inl
@@ -0,0 +1,130 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE CORBA::Boolean
+CORBA::is_nil (CORBA::NamedValue_ptr nv)
+{
+ return nv == 0;
+}
+
+ACE_INLINE void
+CORBA::release (CORBA::NamedValue_ptr nv)
+{
+ if (nv)
+ nv->_decr_refcnt ();
+}
+
+// *************************************************************
+
+ACE_INLINE
+CORBA::NamedValue::NamedValue (void)
+ : refcount_ (1),
+ flags_ (0),
+ name_ (0)
+{
+}
+
+ACE_INLINE
+const char *
+CORBA::NamedValue::name (void) const
+{
+ return this->name_;
+}
+
+ACE_INLINE
+CORBA::Any_ptr
+CORBA::NamedValue::value (void) const
+{
+ return const_cast<CORBA::Any_ptr> (&this->any_);
+}
+
+ACE_INLINE
+CORBA::Flags
+CORBA::NamedValue::flags (void) const
+{
+ return this->flags_;
+}
+
+ACE_INLINE
+CORBA::NamedValue *
+CORBA::NamedValue::_duplicate (CORBA::NamedValue * x)
+{
+ if (x != 0)
+ {
+ x->_incr_refcnt ();
+ }
+
+ return x;
+}
+
+ACE_INLINE
+CORBA::NamedValue*
+CORBA::NamedValue::_nil (void)
+{
+ return 0;
+}
+
+// *************************************************************
+
+ACE_INLINE
+CORBA::Boolean
+CORBA::is_nil (CORBA::NVList_ptr nvl)
+{
+ return (CORBA::Boolean) (nvl == 0);
+}
+
+ACE_INLINE
+void
+CORBA::release (CORBA::NVList_ptr nvl)
+{
+ if (nvl)
+ {
+ nvl->_decr_refcnt ();
+ }
+}
+
+// ****************************************************************
+
+ACE_INLINE
+CORBA::NVList::NVList (void)
+ : max_ (0),
+ refcount_ (1),
+ incoming_ (0),
+ incoming_flag_ (0)
+{
+}
+
+ACE_INLINE
+CORBA::ULong
+CORBA::NVList::count (ACE_ENV_SINGLE_ARG_DECL) const
+{
+ (const_cast<CORBA::NVList *> (this))->evaluate (
+ ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ return this->max_;
+}
+
+ACE_INLINE
+CORBA::NVList *
+CORBA::NVList::_duplicate (CORBA::NVList * x)
+{
+ if (x != 0)
+ {
+ x->_incr_refcnt ();
+ }
+
+ return x;
+}
+
+ACE_INLINE
+CORBA::NVList *
+CORBA::NVList::_nil (void)
+{
+ return 0;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/AnyTypeCode/NVList_Adapter_Impl.cpp b/TAO/tao/AnyTypeCode/NVList_Adapter_Impl.cpp
new file mode 100644
index 00000000000..7ed8cb3d983
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/NVList_Adapter_Impl.cpp
@@ -0,0 +1,81 @@
+// @(#) $Id$
+
+#include "tao/AnyTypeCode/NVList_Adapter_Impl.h"
+
+ACE_RCSID (AnyTypeCode,
+ NVList_Adapter_Impl,
+ "$Id$")
+
+#include "tao/AnyTypeCode/NVList.h"
+#include "tao/SystemException.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+void
+TAO_NVList_Adapter_Impl::create_list (
+ CORBA::Long count,
+ CORBA::NVList_ptr &new_list
+ ACE_ENV_ARG_DECL)
+{
+ ACE_ASSERT (CORBA::ULong (count) <= UINT_MAX);
+ // Create an empty list
+ ACE_NEW_THROW_EX (new_list,
+ CORBA::NVList,
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ 0,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_CHECK;
+
+ // If count is greater than 0, create a list of NamedValues.
+ if (count != 0)
+ {
+ new_list->max_ = (CORBA::ULong) count;
+
+ for (CORBA::Long i = 0; i < count; ++i)
+ {
+ CORBA::NamedValue_ptr nv = 0;
+ ACE_NEW_THROW_EX (nv,
+ CORBA::NamedValue,
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ 0,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_CHECK;
+
+ new_list->values_.enqueue_tail (nv);
+ }
+ }
+}
+
+void
+TAO_NVList_Adapter_Impl::create_named_value (
+ CORBA::NamedValue_ptr &nv
+ ACE_ENV_ARG_DECL)
+{
+ ACE_NEW_THROW_EX (nv,
+ CORBA::NamedValue,
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ 0,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+}
+
+int
+TAO_NVList_Adapter_Impl::Initializer (void)
+{
+ return ACE_Service_Config::process_directive (ace_svc_desc_TAO_NVList_Adapter_Impl);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DEFINE (TAO_NVList_Adapter_Impl,
+ ACE_TEXT ("TAO_NVList_Adapter"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (TAO_NVList_Adapter_Impl),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0)
+ACE_FACTORY_DEFINE (TAO_AnyTypeCode, TAO_NVList_Adapter_Impl)
diff --git a/TAO/tao/AnyTypeCode/NVList_Adapter_Impl.h b/TAO/tao/AnyTypeCode/NVList_Adapter_Impl.h
new file mode 100644
index 00000000000..e24ebd357c5
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/NVList_Adapter_Impl.h
@@ -0,0 +1,59 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file NVList_Adapter_Impl.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_NVLIST_ADAPTER_IMPL_H
+#define TAO_NVLIST_ADAPTER_IMPL_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/AnyTypeCode/TAO_AnyTypeCode_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/NVList_Adapter.h"
+#include "ace/Service_Config.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_NVList_Adapter
+ */
+class TAO_AnyTypeCode_Export TAO_NVList_Adapter_Impl
+ : public TAO_NVList_Adapter
+{
+public:
+ virtual void create_list (
+ CORBA::Long count,
+ CORBA::NVList_ptr &new_list
+ ACE_ENV_ARG_DECL);
+
+ virtual void create_named_value (
+ CORBA::NamedValue_ptr &nv
+ ACE_ENV_ARG_DECL);
+
+ /// Used to force the initialization of the NVList adapter
+ static int Initializer (void);
+};
+
+static int TAO_Requires_NVList_Adapter_Impl_Initializer =
+ TAO_NVList_Adapter_Impl::Initializer ();
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE (TAO_NVList_Adapter_Impl)
+ACE_FACTORY_DECLARE (TAO_AnyTypeCode, TAO_NVList_Adapter_Impl)
+
+
+#include /**/ "ace/post.h"
+#endif /* TAO_NVLIST_ADAPTER_IMPL_H */
diff --git a/TAO/tao/AnyTypeCode/Null_RefCount_Policy.h b/TAO/tao/AnyTypeCode/Null_RefCount_Policy.h
new file mode 100644
index 00000000000..8a39b8e9c52
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Null_RefCount_Policy.h
@@ -0,0 +1,84 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Null_RefCount_Policy.h
+ *
+ * $Id$
+ *
+ * Header file for TAO's reference count policy (unrelated to CORBA
+ * policies).
+ *
+ * @author Ossama Othman <ossama@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_NULL_REFCOUNT_POLICY_H
+#define TAO_NULL_REFCOUNT_POLICY_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/AnyTypeCode/TAO_AnyTypeCode_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Versioned_Namespace.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+
+ /**
+ * @class Null_RefCount_Policy
+ *
+ * @brief No-op reference counting policy.
+ *
+ * This class is intended to be used as a "policy" argument to a
+ * host class template that implements no-op reference counting.
+ * That class would then inherit privately from it like so:
+ *
+ * @code
+ * template <class RefCountPolicy>
+ * class MyHostClass : private RefCountPolicy
+ * {
+ * public:
+ * void my_add_ref (void) { this->RefCountPolicy::add_ref (); }
+ * void my_remove_ref (void) { this->RefCountPolicy::remove_ref (); }
+ * };
+ * @endcode
+ *
+ * and use it like so:
+ *
+ * @code
+ * typedef MyHostClass<TAO::Null_RefCount_Policy> MyNonRefCountedClass;
+ * MyNonRefCountedClass m;
+ * ...
+ * @endcode
+ *
+ * @note In order to incur no size overhead on the host class due to
+ * virtual tables, no base class defining an interface is
+ * defined. This allows C++ compilers to apply the Empty Base
+ * Class Optimization.
+ */
+ class TAO_AnyTypeCode_Export Null_RefCount_Policy
+ {
+ public:
+
+ /// No-op reference increment.
+ void add_ref (void) { }
+
+ /// No-op reference decrement.
+ void remove_ref (void) { }
+
+ };
+
+} // End namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_NULL_REFCOUNT_POLICY_H */
diff --git a/TAO/tao/AnyTypeCode/Objref_TypeCode.cpp b/TAO/tao/AnyTypeCode/Objref_TypeCode.cpp
new file mode 100644
index 00000000000..c897143e4dc
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Objref_TypeCode.cpp
@@ -0,0 +1,157 @@
+// $Id$
+
+#ifndef TAO_OBJREF_TYPECODE_CPP
+#define TAO_OBJREF_TYPECODE_CPP
+
+#include "tao/AnyTypeCode/Objref_TypeCode.h"
+
+#ifndef __ACE_INLINE__
+# include "tao/AnyTypeCode/Objref_TypeCode.inl"
+#endif /* !__ACE_INLINE__ */
+
+#include "tao/CDR.h"
+#include "tao/ORB_Core.h"
+
+#include "ace/OS_NS_string.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template <typename StringType, class RefCountPolicy>
+bool
+TAO::TypeCode::Objref<StringType, RefCountPolicy>::tao_marshal (
+ TAO_OutputCDR & cdr,
+ CORBA::ULong) const
+{
+ // A tk_objref TypeCode has a "complex" parameter list type (see
+ // Table 15-2 in Section 15.3.5.1 "TypeCode" in the CDR section of
+ // the CORBA specification), meaning that it must be marshaled into
+ // a CDR encapsulation.
+
+ // Create a CDR encapsulation.
+ TAO_OutputCDR enc;
+
+ return
+ enc << TAO_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER)
+ && enc << TAO_OutputCDR::from_string (this->attributes_.id (), 0)
+ && enc << TAO_OutputCDR::from_string (this->attributes_.name (), 0)
+ && cdr << static_cast<CORBA::ULong> (enc.total_length ())
+ && cdr.write_octet_array_mb (enc.begin ());
+}
+
+template <typename StringType, class RefCountPolicy>
+void
+TAO::TypeCode::Objref<StringType, RefCountPolicy>::tao_duplicate (void)
+{
+ this->RefCountPolicy::add_ref ();
+}
+
+template <typename StringType, class RefCountPolicy>
+void
+TAO::TypeCode::Objref<StringType, RefCountPolicy>::tao_release (void)
+{
+ this->RefCountPolicy::remove_ref ();
+}
+
+template <typename StringType, class RefCountPolicy>
+CORBA::Boolean
+TAO::TypeCode::Objref<StringType, RefCountPolicy>::equal_i (
+ CORBA::TypeCode_ptr /* tc */
+ ACE_ENV_ARG_DECL_NOT_USED) const
+{
+ // Equality has already been established in the
+ // CORBA::TypeCode base class.
+
+ return true;
+}
+
+template <typename StringType, class RefCountPolicy>
+CORBA::Boolean
+TAO::TypeCode::Objref<StringType, RefCountPolicy>::equivalent_i (
+ CORBA::TypeCode_ptr
+ ACE_ENV_ARG_DECL_NOT_USED) const
+{
+ // Equivalence already verified in the base class
+ // CORBA::TypeCode::equivalent() method.
+
+ return true;
+}
+
+template <typename StringType, class RefCountPolicy>
+CORBA::TypeCode_ptr
+TAO::TypeCode::Objref<StringType,
+ RefCountPolicy>::get_compact_typecode_i (
+ ACE_ENV_SINGLE_ARG_DECL) const
+{
+ TAO_TypeCodeFactory_Adapter * const adapter =
+ ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance (
+ TAO_ORB_Core::typecodefactory_adapter_name ()
+ );
+
+ if (adapter == 0)
+ {
+ ACE_THROW_RETURN (CORBA::INTERNAL (),
+ CORBA::TypeCode::_nil ());
+ }
+
+ if (this->kind_ == CORBA::tk_abstract_interface)
+ {
+ return adapter->create_abstract_interface_tc (this->attributes_.id (),
+ "" /* empty name */
+ ACE_ENV_ARG_PARAMETER);
+ }
+ else if (this->kind_ == CORBA::tk_component)
+ {
+ return adapter->create_component_tc (this->attributes_.id (),
+ "" /* empty name */
+ ACE_ENV_ARG_PARAMETER);
+ }
+ else if (this->kind_ == CORBA::tk_home)
+ {
+ return adapter->create_home_tc (this->attributes_.id (),
+ "" /* empty name */
+ ACE_ENV_ARG_PARAMETER);
+ }
+ else if (this->kind_ == CORBA::tk_local_interface)
+ {
+ return adapter->create_local_interface_tc (this->attributes_.id (),
+ "" /* empty name */
+ ACE_ENV_ARG_PARAMETER);
+
+ }
+ else if (this->kind_ == CORBA::tk_native)
+ {
+ return adapter->create_native_tc (this->attributes_.id (),
+ "" /* empty name */
+ ACE_ENV_ARG_PARAMETER);
+ }
+ else // CORBA::tk_objref
+ {
+ return adapter->create_interface_tc (this->attributes_.id (),
+ "" /* empty name */
+ ACE_ENV_ARG_PARAMETER);
+ }
+}
+
+template <typename StringType, class RefCountPolicy>
+char const *
+TAO::TypeCode::Objref<StringType, RefCountPolicy>::id_i (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED) const
+{
+ // Ownership is retained by the TypeCode, as required by the C++
+ // mapping.
+ return this->attributes_.id ();
+}
+
+template <typename StringType, class RefCountPolicy>
+char const *
+TAO::TypeCode::Objref<StringType, RefCountPolicy>::name_i (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED) const
+{
+ // Ownership is retained by the TypeCode, as required by the C++
+ // mapping.
+ return this->attributes_.name ();
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_OBJREF_TYPECODE_CPP */
diff --git a/TAO/tao/AnyTypeCode/Objref_TypeCode.h b/TAO/tao/AnyTypeCode/Objref_TypeCode.h
new file mode 100644
index 00000000000..8444669513a
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Objref_TypeCode.h
@@ -0,0 +1,125 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Objref_TypeCode.h
+ *
+ * $Id$
+ *
+ * Header file for
+ * @c tk_abstract_interface,
+ * @c tk_component,
+ * @c tk_home,
+ * @c tk_local_interface,
+ * @c tk_native and
+ * @c tk_objref
+ * @c CORBA::TypeCodes.
+ *
+ * @author Ossama Othman <ossama@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_OBJREF_TYPECODE_H
+#define TAO_OBJREF_TYPECODE_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/AnyTypeCode/TypeCode.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/AnyTypeCode/TypeCode_Base_Attributes.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace TypeCode
+ {
+ /**
+ * @class Objref_Base
+ *
+ * @brief @c CORBA::TypeCode implementation for an OMG IDL
+ * @c object and object-like types.
+ *
+ * This class implements a @c CORBA::TypeCode for an OMG IDL
+ * @c object (interface) and object-like types (abstract
+ * interface, component, home, local interface and native).
+ */
+ template <typename StringType, class RefCountPolicy>
+ class Objref
+ : public CORBA::TypeCode,
+ private RefCountPolicy
+ {
+ public:
+
+ /// Constructor.
+ Objref (CORBA::TCKind kind,
+ char const * id,
+ char const * name);
+
+ /**
+ * @name TAO-specific @c CORBA::TypeCode Methods
+ *
+ * Methods required by TAO's implementation of the
+ * @c CORBA::TypeCode class.
+ *
+ * @see @c CORBA::TypeCode
+ */
+ //@{
+ virtual bool tao_marshal (TAO_OutputCDR & cdr,
+ CORBA::ULong offset) const;
+ virtual void tao_duplicate (void);
+ virtual void tao_release (void);
+ //@}
+
+ protected:
+
+ /**
+ * @name @c TAO CORBA::TypeCode Template Methods
+ *
+ * @c tk_abstract_interface, @c tk_component, @c
+ * tk_local_interface, @c tk_native and @c tk_objref
+ * @c CORBA::TypeCode -specific template methods.
+ *
+ * @see @c CORBA::TypeCode
+ */
+ //@{
+ virtual CORBA::Boolean equal_i (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const;
+ virtual CORBA::Boolean equivalent_i (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const;
+ virtual CORBA::TypeCode_ptr get_compact_typecode_i (
+ ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual char const * id_i (ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual char const * name_i (ACE_ENV_SINGLE_ARG_DECL) const;
+
+ protected:
+
+ /// Base attributes (@c id and @c name).
+ Base_Attributes<StringType> attributes_;
+
+ };
+
+ } // End namespace TypeCode
+} // End namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#ifdef __ACE_INLINE__
+# include "tao/AnyTypeCode/Objref_TypeCode.inl"
+#endif /* __ACE_INLINE__ */
+
+#ifdef ACE_TEMPLATES_REQUIRE_SOURCE
+# include "tao/AnyTypeCode/Objref_TypeCode.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#ifdef ACE_TEMPLATES_REQUIRE_PRAGMA
+# pragma implementation ("Objref_TypeCode.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_OBJREF_TYPECODE_H */
diff --git a/TAO/tao/AnyTypeCode/Objref_TypeCode.inl b/TAO/tao/AnyTypeCode/Objref_TypeCode.inl
new file mode 100644
index 00000000000..de813439b87
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Objref_TypeCode.inl
@@ -0,0 +1,19 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template <typename StringType, class RefCountPolicy>
+ACE_INLINE
+TAO::TypeCode::Objref<StringType, RefCountPolicy>::Objref (
+ CORBA::TCKind kind,
+ char const * id,
+ char const * name)
+ : ::CORBA::TypeCode (kind)
+ , RefCountPolicy ()
+ , attributes_ (id, name)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/AnyTypeCode/Objref_TypeCode_Static.cpp b/TAO/tao/AnyTypeCode/Objref_TypeCode_Static.cpp
new file mode 100644
index 00000000000..883b13ab3ed
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Objref_TypeCode_Static.cpp
@@ -0,0 +1,151 @@
+// $Id$
+
+#include "tao/AnyTypeCode/Objref_TypeCode_Static.h"
+
+#ifndef __ACE_INLINE__
+# include "tao/AnyTypeCode/Objref_TypeCode_Static.inl"
+#endif /* !__ACE_INLINE__ */
+
+#include "tao/CDR.h"
+#include "tao/TypeCodeFactory_Adapter.h"
+#include "tao/ORB_Core.h"
+
+#include "ace/Dynamic_Service.h"
+#include "ace/OS_NS_string.h"
+
+
+ACE_RCSID (AnyTypeCode,
+ Objref_TypeCode_Static,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+bool
+TAO::TypeCode::Objref<char const *, TAO::Null_RefCount_Policy>::tao_marshal (
+ TAO_OutputCDR & cdr,
+ CORBA::ULong) const
+{
+ // A tk_objref TypeCode has a "complex" parameter list type (see
+ // Table 15-2 in Section 15.3.5.1 "TypeCode" in the CDR section of
+ // the CORBA specification), meaning that it must be marshaled into
+ // a CDR encapsulation.
+
+ // Create a CDR encapsulation.
+ TAO_OutputCDR enc;
+
+ return
+ enc << TAO_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER)
+ && enc << TAO_OutputCDR::from_string (this->attributes_.id (), 0)
+ && enc << TAO_OutputCDR::from_string (this->attributes_.name (), 0)
+ && cdr << static_cast<CORBA::ULong> (enc.total_length ())
+ && cdr.write_octet_array_mb (enc.begin ());
+}
+
+void
+TAO::TypeCode::Objref<char const *,
+ TAO::Null_RefCount_Policy>::tao_duplicate (void)
+{
+}
+
+void
+TAO::TypeCode::Objref<char const *,
+ TAO::Null_RefCount_Policy>::tao_release (void)
+{
+}
+
+CORBA::Boolean
+TAO::TypeCode::Objref<char const *, TAO::Null_RefCount_Policy>::equal_i (
+ CORBA::TypeCode_ptr /* tc */
+ ACE_ENV_ARG_DECL_NOT_USED) const
+{
+ // Equality has already been established in the
+ // CORBA::TypeCode base class.
+
+ return true;
+}
+
+CORBA::Boolean
+TAO::TypeCode::Objref<char const *, TAO::Null_RefCount_Policy>::equivalent_i (
+ CORBA::TypeCode_ptr
+ ACE_ENV_ARG_DECL_NOT_USED) const
+{
+ // Equivalence already verified in the base class
+ // CORBA::TypeCode::equivalent() method.
+
+ return true;
+}
+
+CORBA::TypeCode_ptr
+TAO::TypeCode::Objref<char const *,
+ TAO::Null_RefCount_Policy>::get_compact_typecode_i (
+ ACE_ENV_SINGLE_ARG_DECL) const
+{
+ TAO_TypeCodeFactory_Adapter * const adapter =
+ ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance (
+ TAO_ORB_Core::typecodefactory_adapter_name ()
+ );
+
+ if (adapter == 0)
+ {
+ ACE_THROW_RETURN (CORBA::INTERNAL (),
+ CORBA::TypeCode::_nil ());
+ }
+
+ if (this->kind_ == CORBA::tk_abstract_interface)
+ {
+ return adapter->create_abstract_interface_tc (this->attributes_.id (),
+ "" /* empty name */
+ ACE_ENV_ARG_PARAMETER);
+ }
+ else if (this->kind_ == CORBA::tk_component)
+ {
+ return adapter->create_component_tc (this->attributes_.id (),
+ "" /* empty name */
+ ACE_ENV_ARG_PARAMETER);
+ }
+ else if (this->kind_ == CORBA::tk_home)
+ {
+ return adapter->create_home_tc (this->attributes_.id (),
+ "" /* empty name */
+ ACE_ENV_ARG_PARAMETER);
+ }
+ else if (this->kind_ == CORBA::tk_local_interface)
+ {
+ return adapter->create_local_interface_tc (this->attributes_.id (),
+ "" /* empty name */
+ ACE_ENV_ARG_PARAMETER);
+
+ }
+ else if (this->kind_ == CORBA::tk_native)
+ {
+ return adapter->create_native_tc (this->attributes_.id (),
+ "" /* empty name */
+ ACE_ENV_ARG_PARAMETER);
+ }
+ else // CORBA::tk_objref
+ {
+ return adapter->create_interface_tc (this->attributes_.id (),
+ "" /* empty name */
+ ACE_ENV_ARG_PARAMETER);
+ }
+}
+
+char const *
+TAO::TypeCode::Objref<char const *, TAO::Null_RefCount_Policy>::id_i (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED) const
+{
+ // Ownership is retained by the TypeCode, as required by the C++
+ // mapping.
+ return this->attributes_.id ();
+}
+
+char const *
+TAO::TypeCode::Objref<char const *, TAO::Null_RefCount_Policy>::name_i (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED) const
+{
+ // Ownership is retained by the TypeCode, as required by the C++
+ // mapping.
+ return this->attributes_.name ();
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/AnyTypeCode/Objref_TypeCode_Static.h b/TAO/tao/AnyTypeCode/Objref_TypeCode_Static.h
new file mode 100644
index 00000000000..f67bb980e66
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Objref_TypeCode_Static.h
@@ -0,0 +1,121 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Objref_TypeCode_Static.h
+ *
+ * $Id$
+ *
+ * Header file for static
+ * @c tk_abstract_interface,
+ * @c tk_component,
+ * @c tk_home,
+ * @c tk_local_interface,
+ * @c tk_native and
+ * @c tk_objref
+ * @c CORBA::TypeCodes.
+ *
+ * @author Ossama Othman <ossama@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_OBJREF_TYPECODE_STATIC_H
+#define TAO_OBJREF_TYPECODE_STATIC_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/AnyTypeCode/TypeCode.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/AnyTypeCode/TypeCode_Base_Attributes.h"
+#include "tao/AnyTypeCode/Null_RefCount_Policy.h"
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace TypeCode
+ {
+ template <typename StringType, class RefCountPolicy> class Objref;
+
+ /**
+ * @class Objref
+ *
+ * @brief @c CORBA::TypeCode implementation for an OMG IDL
+ * @c object and object-like types.
+ *
+ * This class implements a @c CORBA::TypeCode for an OMG IDL
+ * @c object (interface) and object-like types (abstract
+ * interface, component, home, local interface and native).
+ */
+ template<>
+ class TAO_AnyTypeCode_Export Objref<char const *, TAO::Null_RefCount_Policy>
+ : public CORBA::TypeCode,
+ private TAO::Null_RefCount_Policy
+ {
+ public:
+
+ /// Constructor.
+ Objref (CORBA::TCKind kind,
+ char const * id,
+ char const * name);
+
+ /**
+ * @name TAO-specific @c CORBA::TypeCode Methods
+ *
+ * Methods required by TAO's implementation of the
+ * @c CORBA::TypeCode class.
+ *
+ * @see @c CORBA::TypeCode
+ */
+ //@{
+ virtual bool tao_marshal (TAO_OutputCDR & cdr,
+ CORBA::ULong offset) const;
+ virtual void tao_duplicate (void);
+ virtual void tao_release (void);
+ //@}
+
+ protected:
+
+ /**
+ * @name @c TAO CORBA::TypeCode Template Methods
+ *
+ * @c tk_abstract_interface, @c tk_component, @c
+ * tk_local_interface, @c tk_native and @c tk_objref
+ * @c CORBA::TypeCode -specific template methods.
+ *
+ * @see @c CORBA::TypeCode
+ */
+ //@{
+ virtual CORBA::Boolean equal_i (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const;
+ virtual CORBA::Boolean equivalent_i (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const;
+ virtual CORBA::TypeCode_ptr get_compact_typecode_i (
+ ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual char const * id_i (ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual char const * name_i (ACE_ENV_SINGLE_ARG_DECL) const;
+
+ protected:
+
+ /// Base attributes (@c id and @c name).
+ Base_Attributes<char const *> attributes_;
+
+ };
+
+ } // End namespace TypeCode
+} // End namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#ifdef __ACE_INLINE__
+# include "tao/AnyTypeCode/Objref_TypeCode_Static.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_OBJREF_TYPECODE_STATIC_H */
diff --git a/TAO/tao/AnyTypeCode/Objref_TypeCode_Static.inl b/TAO/tao/AnyTypeCode/Objref_TypeCode_Static.inl
new file mode 100644
index 00000000000..b9492be9bf2
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Objref_TypeCode_Static.inl
@@ -0,0 +1,18 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO::TypeCode::Objref<char const *, TAO::Null_RefCount_Policy>::Objref (
+ CORBA::TCKind kind,
+ char const * id,
+ char const * name)
+ : ::CORBA::TypeCode (kind)
+ , ::TAO::Null_RefCount_Policy ()
+ , attributes_ (id, name)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/AnyTypeCode/OctetSeqA.cpp b/TAO/tao/AnyTypeCode/OctetSeqA.cpp
new file mode 100644
index 00000000000..dd6b7864968
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/OctetSeqA.cpp
@@ -0,0 +1,146 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+#include "tao/AnyTypeCode/OctetSeqA.h"
+#include "tao/AnyTypeCode/Null_RefCount_Policy.h"
+#include "tao/AnyTypeCode/TypeCode_Constants.h"
+#include "tao/AnyTypeCode/Alias_TypeCode_Static.h"
+#include "tao/AnyTypeCode/Sequence_TypeCode_Static.h"
+#include "tao/CDR.h"
+#include "tao/AnyTypeCode/Any.h"
+#include "tao/AnyTypeCode/Any_Dual_Impl_T.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/alias_typecode.cpp:50
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/typecode_defn.cpp:937
+
+
+#ifndef _TAO_TYPECODE_CORBA_OctetSeq_GUARD
+#define _TAO_TYPECODE_CORBA_OctetSeq_GUARD
+namespace TAO
+{
+ namespace TypeCode
+ {
+ TAO::TypeCode::Sequence< ::CORBA::TypeCode_ptr const *,
+ TAO::Null_RefCount_Policy>
+ CORBA_OctetSeq_0 (
+ CORBA::tk_sequence,
+ &CORBA::_tc_octet,
+ 0U);
+
+ ::CORBA::TypeCode_ptr const tc_CORBA_OctetSeq_0 =
+ &CORBA_OctetSeq_0;
+
+ }
+}
+
+
+#endif /* _TAO_TYPECODE_CORBA_OctetSeq_GUARD */
+
+static TAO::TypeCode::Alias<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_CORBA_OctetSeq (
+ CORBA::tk_alias,
+ "IDL:omg.org/CORBA/OctetSeq:1.0",
+ "OctetSeq",
+ &TAO::TypeCode::tc_CORBA_OctetSeq_0);
+
+namespace CORBA
+{
+ ::CORBA::TypeCode_ptr const _tc_OctetSeq =
+ &_tao_tc_CORBA_OctetSeq;
+}
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_sequence/any_op_cs.cpp:54
+
+
+// Copying insertion.
+void operator<<= (
+ CORBA::Any &_tao_any,
+ const CORBA::OctetSeq &_tao_elem
+ )
+{
+ TAO::Any_Dual_Impl_T<CORBA::OctetSeq>::insert_copy (
+ _tao_any,
+ CORBA::OctetSeq::_tao_any_destructor,
+ TAO::TypeCode::tc_CORBA_OctetSeq_0,
+ _tao_elem
+ );
+}
+
+// Non-copying insertion.
+void operator<<= (
+ CORBA::Any &_tao_any,
+ CORBA::OctetSeq *_tao_elem
+ )
+{
+ TAO::Any_Dual_Impl_T<CORBA::OctetSeq>::insert (
+ _tao_any,
+ CORBA::OctetSeq::_tao_any_destructor,
+ TAO::TypeCode::tc_CORBA_OctetSeq_0,
+ _tao_elem
+ );
+}
+
+// Extraction to non-const pointer (deprecated).
+CORBA::Boolean operator>>= (
+ const CORBA::Any &_tao_any,
+ CORBA::OctetSeq *&_tao_elem
+ )
+{
+ return _tao_any >>= const_cast<
+ const CORBA::OctetSeq *&> (
+ _tao_elem
+ );
+}
+
+// Extraction to const pointer.
+CORBA::Boolean operator>>= (
+ const CORBA::Any &_tao_any,
+ const CORBA::OctetSeq *&_tao_elem
+ )
+{
+ return
+ TAO::Any_Dual_Impl_T<CORBA::OctetSeq>::extract (
+ _tao_any,
+ CORBA::OctetSeq::_tao_any_destructor,
+ TAO::TypeCode::tc_CORBA_OctetSeq_0,
+ _tao_elem
+ );
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/AnyTypeCode/OctetSeqA.h b/TAO/tao/AnyTypeCode/OctetSeqA.h
new file mode 100644
index 00000000000..8b94976cb20
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/OctetSeqA.h
@@ -0,0 +1,71 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:788
+
+#ifndef _TAO_IDL_ANYTYPECODE_OCTETSEQA_H_
+#define _TAO_IDL_ANYTYPECODE_OCTETSEQA_H_
+
+#include /**/ "ace/pre.h"
+
+#include "tao/AnyTypeCode/TAO_AnyTypeCode_Export.h"
+#include "tao/AnyTypeCode/AnyTypeCode_methods.h"
+#include "tao/OctetSeqC.h"
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_module/module_ch.cpp:59
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace CORBA
+{
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:49
+
+ extern TAO_AnyTypeCode_Export ::CORBA::TypeCode_ptr const _tc_OctetSeq;
+
+// TAO_IDL - Generated from
+// be\be_visitor_module/module_ch.cpp:86
+
+} // module CORBA
+
+// TAO_IDL - Generated from
+// be\be_visitor_sequence/any_op_ch.cpp:53
+
+TAO_AnyTypeCode_Export void operator<<= (CORBA::Any &, const CORBA::OctetSeq &); // copying version
+TAO_AnyTypeCode_Export void operator<<= (CORBA::Any &, CORBA::OctetSeq*); // noncopying version
+TAO_AnyTypeCode_Export CORBA::Boolean operator>>= (const CORBA::Any &, CORBA::OctetSeq *&); // deprecated
+TAO_AnyTypeCode_Export CORBA::Boolean operator>>= (const CORBA::Any &, const CORBA::OctetSeq *&);
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* ifndef */
diff --git a/TAO/tao/AnyTypeCode/PolicyA.cpp b/TAO/tao/AnyTypeCode/PolicyA.cpp
new file mode 100644
index 00000000000..9d49724bc2f
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/PolicyA.cpp
@@ -0,0 +1,561 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+#include "tao/AnyTypeCode/PolicyA.h"
+#include "tao/AnyTypeCode/Null_RefCount_Policy.h"
+#include "tao/AnyTypeCode/TypeCode_Constants.h"
+#include "tao/AnyTypeCode/Alias_TypeCode_Static.h"
+#include "tao/AnyTypeCode/Objref_TypeCode_Static.h"
+#include "tao/AnyTypeCode/Struct_TypeCode_Static.h"
+#include "tao/AnyTypeCode/TypeCode_Struct_Field.h"
+#include "tao/CDR.h"
+#include "tao/AnyTypeCode/Any.h"
+#include "tao/AnyTypeCode/Any_Impl_T.h"
+#include "tao/AnyTypeCode/Any_Dual_Impl_T.h"
+
+#include "tao/AnyTypeCode/UShortSeqA.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/alias_typecode.cpp:50
+
+static TAO::TypeCode::Alias<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_CORBA_PolicyErrorCode (
+ CORBA::tk_alias,
+ "IDL:omg.org/CORBA/PolicyErrorCode:1.0",
+ "PolicyErrorCode",
+ &CORBA::_tc_short);
+
+namespace CORBA
+{
+ ::CORBA::TypeCode_ptr const _tc_PolicyErrorCode =
+ &_tao_tc_CORBA_PolicyErrorCode;
+}
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/struct_typecode.cpp:87
+
+static TAO::TypeCode::Struct_Field<char const *, CORBA::TypeCode_ptr const *> const _tao_fields_CORBA_PolicyError[] =
+ {
+ { "reason", &CORBA::_tc_PolicyErrorCode }
+
+ };
+static TAO::TypeCode::Struct<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::TypeCode::Struct_Field<char const *, CORBA::TypeCode_ptr const *> const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_CORBA_PolicyError (
+ CORBA::tk_except,
+ "IDL:omg.org/CORBA/PolicyError:1.0",
+ "PolicyError",
+ _tao_fields_CORBA_PolicyError,
+ 1);
+
+namespace CORBA
+{
+ ::CORBA::TypeCode_ptr const _tc_PolicyError =
+ &_tao_tc_CORBA_PolicyError;
+}
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/struct_typecode.cpp:87
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/typecode_defn.cpp:937
+
+static TAO::TypeCode::Struct_Field<char const *, CORBA::TypeCode_ptr const *> const _tao_fields_CORBA_InvalidPolicies[] =
+ {
+ { "indices", &CORBA::_tc_UShortSeq }
+
+ };
+static TAO::TypeCode::Struct<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::TypeCode::Struct_Field<char const *, CORBA::TypeCode_ptr const *> const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_CORBA_InvalidPolicies (
+ CORBA::tk_except,
+ "IDL:omg.org/CORBA/InvalidPolicies:1.0",
+ "InvalidPolicies",
+ _tao_fields_CORBA_InvalidPolicies,
+ 1);
+
+namespace CORBA
+{
+ ::CORBA::TypeCode_ptr const _tc_InvalidPolicies =
+ &_tao_tc_CORBA_InvalidPolicies;
+}
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/objref_typecode.cpp:76
+
+static TAO::TypeCode::Objref<char const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_CORBA_Policy (
+ CORBA::tk_objref,
+ "IDL:omg.org/CORBA/Policy:1.0",
+ "Policy");
+
+namespace CORBA
+{
+ ::CORBA::TypeCode_ptr const _tc_Policy =
+ &_tao_tc_CORBA_Policy;
+}
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/objref_typecode.cpp:76
+
+static TAO::TypeCode::Objref<char const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_CORBA_PolicyManager (
+ CORBA::tk_local_interface,
+ "IDL:omg.org/CORBA/PolicyManager:1.0",
+ "PolicyManager");
+
+namespace CORBA
+{
+ ::CORBA::TypeCode_ptr const _tc_PolicyManager =
+ &_tao_tc_CORBA_PolicyManager;
+}
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/objref_typecode.cpp:76
+
+static TAO::TypeCode::Objref<char const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_CORBA_PolicyCurrent (
+ CORBA::tk_local_interface,
+ "IDL:omg.org/CORBA/PolicyCurrent:1.0",
+ "PolicyCurrent");
+
+namespace CORBA
+{
+ ::CORBA::TypeCode_ptr const _tc_PolicyCurrent =
+ &_tao_tc_CORBA_PolicyCurrent;
+}
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_exception/any_op_cs.cpp:50
+
+namespace TAO
+{
+ template<>
+ CORBA::Boolean
+ Any_Dual_Impl_T<CORBA::PolicyError>::demarshal_value (
+ TAO_InputCDR & cdr
+ )
+ {
+ CORBA::String_var id;
+
+ if (!(cdr >> id.out ()))
+ {
+ return false;
+ }
+
+ ACE_TRY_NEW_ENV
+ {
+ this->value_->_tao_decode (cdr ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ return false;
+ }
+ ACE_ENDTRY;
+
+ return true;
+ }
+}
+
+// Copying insertion.
+void operator<<= (
+ CORBA::Any &_tao_any,
+ const CORBA::PolicyError &_tao_elem
+ )
+{
+ TAO::Any_Dual_Impl_T<CORBA::PolicyError>::insert_copy (
+ _tao_any,
+ CORBA::PolicyError::_tao_any_destructor,
+ CORBA::_tc_PolicyError,
+ _tao_elem
+ );
+}
+
+// Non-copying insertion.
+void operator<<= (
+ CORBA::Any &_tao_any,
+ CORBA::PolicyError *_tao_elem
+ )
+{
+ TAO::Any_Dual_Impl_T<CORBA::PolicyError>::insert (
+ _tao_any,
+ CORBA::PolicyError::_tao_any_destructor,
+ CORBA::_tc_PolicyError,
+ _tao_elem
+ );
+}
+
+// Extraction to non-const pointer (deprecated).
+CORBA::Boolean operator>>= (
+ const CORBA::Any &_tao_any,
+ CORBA::PolicyError *&_tao_elem
+ )
+{
+ return _tao_any >>= const_cast<
+ const CORBA::PolicyError *&> (
+ _tao_elem
+ );
+}
+
+// Extraction to const pointer.
+CORBA::Boolean operator>>= (
+ const CORBA::Any &_tao_any,
+ const CORBA::PolicyError *&_tao_elem
+ )
+{
+ return
+ TAO::Any_Dual_Impl_T<CORBA::PolicyError>::extract (
+ _tao_any,
+ CORBA::PolicyError::_tao_any_destructor,
+ CORBA::_tc_PolicyError,
+ _tao_elem
+ );
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_exception/any_op_cs.cpp:50
+
+namespace TAO
+{
+ template<>
+ CORBA::Boolean
+ Any_Dual_Impl_T<CORBA::InvalidPolicies>::demarshal_value (
+ TAO_InputCDR & cdr
+ )
+ {
+ CORBA::String_var id;
+
+ if (!(cdr >> id.out ()))
+ {
+ return false;
+ }
+
+ ACE_TRY_NEW_ENV
+ {
+ this->value_->_tao_decode (cdr ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ return false;
+ }
+ ACE_ENDTRY;
+
+ return true;
+ }
+}
+
+// Copying insertion.
+void operator<<= (
+ CORBA::Any &_tao_any,
+ const CORBA::InvalidPolicies &_tao_elem
+ )
+{
+ TAO::Any_Dual_Impl_T<CORBA::InvalidPolicies>::insert_copy (
+ _tao_any,
+ CORBA::InvalidPolicies::_tao_any_destructor,
+ CORBA::_tc_InvalidPolicies,
+ _tao_elem
+ );
+}
+
+// Non-copying insertion.
+void operator<<= (
+ CORBA::Any &_tao_any,
+ CORBA::InvalidPolicies *_tao_elem
+ )
+{
+ TAO::Any_Dual_Impl_T<CORBA::InvalidPolicies>::insert (
+ _tao_any,
+ CORBA::InvalidPolicies::_tao_any_destructor,
+ CORBA::_tc_InvalidPolicies,
+ _tao_elem
+ );
+}
+
+// Extraction to non-const pointer (deprecated).
+CORBA::Boolean operator>>= (
+ const CORBA::Any &_tao_any,
+ CORBA::InvalidPolicies *&_tao_elem
+ )
+{
+ return _tao_any >>= const_cast<
+ const CORBA::InvalidPolicies *&> (
+ _tao_elem
+ );
+}
+
+// Extraction to const pointer.
+CORBA::Boolean operator>>= (
+ const CORBA::Any &_tao_any,
+ const CORBA::InvalidPolicies *&_tao_elem
+ )
+{
+ return
+ TAO::Any_Dual_Impl_T<CORBA::InvalidPolicies>::extract (
+ _tao_any,
+ CORBA::InvalidPolicies::_tao_any_destructor,
+ CORBA::_tc_InvalidPolicies,
+ _tao_elem
+ );
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/any_op_cs.cpp:50
+
+namespace TAO
+{
+ template<>
+ CORBA::Boolean
+ Any_Impl_T<CORBA::Policy>::to_object (
+ CORBA::Object_ptr &_tao_elem
+ ) const
+ {
+ _tao_elem = CORBA::Object::_duplicate (this->value_);
+ return true;
+ }
+}
+
+// Copying insertion.
+void
+operator<<= (
+ CORBA::Any &_tao_any,
+ CORBA::Policy_ptr _tao_elem
+ )
+{
+ CORBA::Policy_ptr _tao_objptr =
+ CORBA::Policy::_duplicate (_tao_elem);
+ _tao_any <<= &_tao_objptr;
+}
+
+// Non-copying insertion.
+void
+operator<<= (
+ CORBA::Any &_tao_any,
+ CORBA::Policy_ptr *_tao_elem
+ )
+{
+ TAO::Any_Impl_T<CORBA::Policy>::insert (
+ _tao_any,
+ CORBA::Policy::_tao_any_destructor,
+ CORBA::_tc_Policy,
+ *_tao_elem
+ );
+}
+
+CORBA::Boolean
+operator>>= (
+ const CORBA::Any &_tao_any,
+ CORBA::Policy_ptr &_tao_elem
+ )
+{
+ return
+ TAO::Any_Impl_T<CORBA::Policy>::extract (
+ _tao_any,
+ CORBA::Policy::_tao_any_destructor,
+ CORBA::_tc_Policy,
+ _tao_elem
+ );
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/any_op_cs.cpp:50
+
+namespace TAO
+{
+ template<>
+ CORBA::Boolean
+ Any_Impl_T<CORBA::PolicyManager>::to_object (
+ CORBA::Object_ptr &_tao_elem
+ ) const
+ {
+ _tao_elem = CORBA::Object::_duplicate (this->value_);
+ return true;
+ }
+}
+
+namespace TAO
+{
+ template<>
+ CORBA::Boolean
+ Any_Impl_T<CORBA::PolicyManager>::marshal_value (TAO_OutputCDR &)
+ {
+ return false;
+ }
+
+ template<>
+ CORBA::Boolean
+ Any_Impl_T<CORBA::PolicyManager>::demarshal_value (TAO_InputCDR &)
+ {
+ return false;
+ }
+}
+
+// Copying insertion.
+void
+operator<<= (
+ CORBA::Any &_tao_any,
+ CORBA::PolicyManager_ptr _tao_elem
+ )
+{
+ CORBA::PolicyManager_ptr _tao_objptr =
+ CORBA::PolicyManager::_duplicate (_tao_elem);
+ _tao_any <<= &_tao_objptr;
+}
+
+// Non-copying insertion.
+void
+operator<<= (
+ CORBA::Any &_tao_any,
+ CORBA::PolicyManager_ptr *_tao_elem
+ )
+{
+ TAO::Any_Impl_T<CORBA::PolicyManager>::insert (
+ _tao_any,
+ CORBA::PolicyManager::_tao_any_destructor,
+ CORBA::_tc_PolicyManager,
+ *_tao_elem
+ );
+}
+
+CORBA::Boolean
+operator>>= (
+ const CORBA::Any &_tao_any,
+ CORBA::PolicyManager_ptr &_tao_elem
+ )
+{
+ return
+ TAO::Any_Impl_T<CORBA::PolicyManager>::extract (
+ _tao_any,
+ CORBA::PolicyManager::_tao_any_destructor,
+ CORBA::_tc_PolicyManager,
+ _tao_elem
+ );
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/any_op_cs.cpp:50
+
+namespace TAO
+{
+ template<>
+ CORBA::Boolean
+ Any_Impl_T<CORBA::PolicyCurrent>::to_object (
+ CORBA::Object_ptr &_tao_elem
+ ) const
+ {
+ _tao_elem = CORBA::Object::_duplicate (this->value_);
+ return true;
+ }
+}
+
+namespace TAO
+{
+ template<>
+ CORBA::Boolean
+ Any_Impl_T<CORBA::PolicyCurrent>::marshal_value (TAO_OutputCDR &)
+ {
+ return false;
+ }
+
+ template<>
+ CORBA::Boolean
+ Any_Impl_T<CORBA::PolicyCurrent>::demarshal_value (TAO_InputCDR &)
+ {
+ return false;
+ }
+}
+
+// Copying insertion.
+void
+operator<<= (
+ CORBA::Any &_tao_any,
+ CORBA::PolicyCurrent_ptr _tao_elem
+ )
+{
+ CORBA::PolicyCurrent_ptr _tao_objptr =
+ CORBA::PolicyCurrent::_duplicate (_tao_elem);
+ _tao_any <<= &_tao_objptr;
+}
+
+// Non-copying insertion.
+void
+operator<<= (
+ CORBA::Any &_tao_any,
+ CORBA::PolicyCurrent_ptr *_tao_elem
+ )
+{
+ TAO::Any_Impl_T<CORBA::PolicyCurrent>::insert (
+ _tao_any,
+ CORBA::PolicyCurrent::_tao_any_destructor,
+ CORBA::_tc_PolicyCurrent,
+ *_tao_elem
+ );
+}
+
+CORBA::Boolean
+operator>>= (
+ const CORBA::Any &_tao_any,
+ CORBA::PolicyCurrent_ptr &_tao_elem
+ )
+{
+ return
+ TAO::Any_Impl_T<CORBA::PolicyCurrent>::extract (
+ _tao_any,
+ CORBA::PolicyCurrent::_tao_any_destructor,
+ CORBA::_tc_PolicyCurrent,
+ _tao_elem
+ );
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/AnyTypeCode/PolicyA.h b/TAO/tao/AnyTypeCode/PolicyA.h
new file mode 100644
index 00000000000..ed2c78d1e3a
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/PolicyA.h
@@ -0,0 +1,159 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:153
+
+#ifndef _TAO_IDL_ORIG_POLICYA_H_
+#define _TAO_IDL_ORIG_POLICYA_H_
+
+#include /**/ "ace/pre.h"
+
+
+#include "ace/config-all.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/AnyTypeCode/TAO_AnyTypeCode_Export.h"
+#include "tao/AnyTypeCode/AnyTypeCode_methods.h"
+#include "tao/PolicyC.h"
+
+#if defined (TAO_EXPORT_MACRO)
+#undef TAO_EXPORT_MACRO
+#endif
+#define TAO_EXPORT_MACRO TAO_AnyTypeCode_Export
+
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+#if defined (__BORLANDC__)
+#pragma option push -w-rvl -w-rch -w-ccc -w-inl
+#endif /* __BORLANDC__ */
+
+// TAO_IDL - Generated from
+// be\be_visitor_module/module_ch.cpp:48
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace CORBA
+{
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:44
+
+ extern TAO_AnyTypeCode_Export ::CORBA::TypeCode_ptr const _tc_PolicyErrorCode;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:44
+
+ extern TAO_AnyTypeCode_Export ::CORBA::TypeCode_ptr const _tc_PolicyError;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:44
+
+ extern TAO_AnyTypeCode_Export ::CORBA::TypeCode_ptr const _tc_InvalidPolicies;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:44
+
+ extern TAO_AnyTypeCode_Export ::CORBA::TypeCode_ptr const _tc_Policy;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:44
+
+ extern TAO_AnyTypeCode_Export ::CORBA::TypeCode_ptr const _tc_PolicyManager;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:44
+
+ extern TAO_AnyTypeCode_Export ::CORBA::TypeCode_ptr const _tc_PolicyCurrent;
+
+// TAO_IDL - Generated from
+// be\be_visitor_module/module_ch.cpp:66
+
+} // module CORBA
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_exception/any_op_ch.cpp:52
+
+TAO_AnyTypeCode_Export void operator<<= (CORBA::Any &, const CORBA::PolicyError &); // copying version
+TAO_AnyTypeCode_Export void operator<<= (CORBA::Any &, CORBA::PolicyError*); // noncopying version
+TAO_AnyTypeCode_Export CORBA::Boolean operator>>= (const CORBA::Any &, CORBA::PolicyError *&); // deprecated
+TAO_AnyTypeCode_Export CORBA::Boolean operator>>= (const CORBA::Any &, const CORBA::PolicyError *&);
+
+// TAO_IDL - Generated from
+// be\be_visitor_exception/any_op_ch.cpp:52
+
+TAO_AnyTypeCode_Export void operator<<= (CORBA::Any &, const CORBA::InvalidPolicies &); // copying version
+TAO_AnyTypeCode_Export void operator<<= (CORBA::Any &, CORBA::InvalidPolicies*); // noncopying version
+TAO_AnyTypeCode_Export CORBA::Boolean operator>>= (const CORBA::Any &, CORBA::InvalidPolicies *&); // deprecated
+TAO_AnyTypeCode_Export CORBA::Boolean operator>>= (const CORBA::Any &, const CORBA::InvalidPolicies *&);
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/any_op_ch.cpp:52
+
+TAO_AnyTypeCode_Export void operator<<= (CORBA::Any &, CORBA::Policy_ptr); // copying
+TAO_AnyTypeCode_Export void operator<<= (CORBA::Any &, CORBA::Policy_ptr *); // non-copying
+TAO_AnyTypeCode_Export CORBA::Boolean operator>>= (const CORBA::Any &, CORBA::Policy_ptr &);
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/any_op_ch.cpp:52
+
+TAO_AnyTypeCode_Export void operator<<= (CORBA::Any &, CORBA::PolicyManager_ptr); // copying
+TAO_AnyTypeCode_Export void operator<<= (CORBA::Any &, CORBA::PolicyManager_ptr *); // non-copying
+TAO_AnyTypeCode_Export CORBA::Boolean operator>>= (const CORBA::Any &, CORBA::PolicyManager_ptr &);
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/any_op_ch.cpp:52
+
+TAO_AnyTypeCode_Export void operator<<= (CORBA::Any &, CORBA::PolicyCurrent_ptr); // copying
+TAO_AnyTypeCode_Export void operator<<= (CORBA::Any &, CORBA::PolicyCurrent_ptr *); // non-copying
+TAO_AnyTypeCode_Export CORBA::Boolean operator>>= (const CORBA::Any &, CORBA::PolicyCurrent_ptr &);
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:955
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#if defined (__BORLANDC__)
+#pragma option pop
+#endif /* __BORLANDC__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* ifndef */
+
+
diff --git a/TAO/tao/AnyTypeCode/Recursive_Type_TypeCode.cpp b/TAO/tao/AnyTypeCode/Recursive_Type_TypeCode.cpp
new file mode 100644
index 00000000000..be526f4b094
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Recursive_Type_TypeCode.cpp
@@ -0,0 +1,141 @@
+// $Id$
+
+#include "tao/CDR.h"
+
+#ifndef __ACE_INLINE__
+# include "tao/AnyTypeCode/Recursive_Type_TypeCode.inl"
+#endif /* __ACE_INLINE__ */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template <class TypeCodeBase, typename TypeCodeType, typename MemberArrayType>
+bool
+TAO::TypeCode::Recursive_Type<TypeCodeBase,
+ TypeCodeType,
+ MemberArrayType>::tao_marshal (
+ TAO_OutputCDR & cdr,
+ CORBA::ULong offset) const
+{
+ ACE_GUARD_RETURN (TAO_SYNCH_RECURSIVE_MUTEX,
+ guard,
+ this->lock_,
+ false);
+
+ // Top-level TypeCode case.
+ if (!(this->in_recursion_))
+ {
+ this->in_recursion_ = true;
+
+ // Starting offset should point to the CORBA::TCKind value.
+
+ // Note that this doesn't need to take into account alignment
+ // padding since CORBA::TCKind (encoded as a CORBA::ULong) is
+ // already aligned on the appropriate boundary, and since the
+ // CORBA::TCKind was the last thing marshaled into the CDR
+ // stream before getting here.
+ offset = sizeof (CORBA::ULong);
+
+ // Reset recursion flag to false in an exception-safe manner once
+ // marshaling is done.
+ //
+ // Only reset the recursion flag at the top-level.
+ Reset flag (this->in_recursion_);
+
+ return this->TypeCodeBase::tao_marshal (cdr, offset);
+ }
+
+ // Recursive/indirected TypeCode case.
+
+// ACE_ASSERT (offset > 4
+// && offset < static_cast<CORBA::ULong> (ACE_INT32_MAX));
+
+ return (cdr << -static_cast<CORBA::Long> (offset));
+}
+
+template <class TypeCodeBase, typename TypeCodeType, typename MemberArrayType>
+CORBA::Boolean
+TAO::TypeCode::Recursive_Type<TypeCodeBase,
+ TypeCodeType,
+ MemberArrayType>::equal_i (
+ CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const
+{
+ ACE_GUARD_RETURN (TAO_SYNCH_RECURSIVE_MUTEX,
+ guard,
+ this->lock_,
+ false);
+
+ // Top-level TypeCode case.
+ if (!(this->in_recursion_))
+ {
+ this->in_recursion_ = true;
+
+ // Reset recursion flag to false in an exception-safe manner once
+ // equality determination is done.
+ //
+ // Only reset the recursion flag at the top-level.
+ Reset flag (this->in_recursion_);
+
+ return this->TypeCodeBase::equal_i (tc
+ ACE_ENV_ARG_PARAMETER);
+ }
+
+ // Nothing else to do.
+ return true;
+}
+
+template <class TypeCodeBase, typename TypeCodeType, typename MemberArrayType>
+CORBA::Boolean
+TAO::TypeCode::Recursive_Type<TypeCodeBase,
+ TypeCodeType,
+ MemberArrayType>::equivalent_i (
+ CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const
+{
+ ACE_GUARD_RETURN (TAO_SYNCH_RECURSIVE_MUTEX,
+ guard,
+ this->lock_,
+ false);
+
+ // Top-level TypeCode case.
+ if (!(this->in_recursion_))
+ {
+ this->in_recursion_ = true;
+
+ // Reset recursion flag to false in an exception-safe manner once
+ // equivalence determination is done.
+ //
+ // Only reset the recursion flag at the top-level.
+ Reset flag (this->in_recursion_);
+
+ return this->TypeCodeBase::equivalent_i (tc
+ ACE_ENV_ARG_PARAMETER);
+ }
+
+ // Nothing else to do.
+ return true;
+}
+
+template <class TypeCodeBase, typename TypeCodeType, typename MemberArrayType>
+bool
+TAO::TypeCode::Recursive_Type<TypeCodeBase,
+ TypeCodeType,
+ MemberArrayType>::tao_marshal_kind (
+ TAO_OutputCDR & cdr) const
+{
+ ACE_GUARD_RETURN (TAO_SYNCH_RECURSIVE_MUTEX,
+ guard,
+ this->lock_,
+ false);
+
+ // Top-level TypeCode case.
+ if (!(this->in_recursion_))
+ return this->::CORBA::TypeCode::tao_marshal_kind (cdr);
+
+ // Recursive/indirected TypeCode case.
+ CORBA::ULong const indirection_kind = 0xffffffff;
+
+ return (cdr << indirection_kind);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/AnyTypeCode/Recursive_Type_TypeCode.h b/TAO/tao/AnyTypeCode/Recursive_Type_TypeCode.h
new file mode 100644
index 00000000000..027100bb476
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Recursive_Type_TypeCode.h
@@ -0,0 +1,220 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Recursive_Type_TypeCode.h
+ *
+ * $Id$
+ *
+ * Header file for a recursive type (@c struct, @c union or
+ * @c valuetype) CORBA::TypeCode.
+ *
+ * @author Ossama Othman
+ */
+//=============================================================================
+
+#ifndef TAO_RECURSIVE_TYPE_TYPECODE_H
+#define TAO_RECURSIVE_TYPE_TYPECODE_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Basic_Types.h"
+#include "tao/Typecode_typesC.h"
+#include "ace/Recursive_Thread_Mutex.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace TypeCode
+ {
+
+ /**
+ * @class Recursive_Type
+ *
+ * @brief Recursive type @c TypeCode decorator template.
+ *
+ * This class template decorates the underlying @c TypeCode
+ * implementation @a TypeCodeBase to provide support for IDL
+ * defined recursive types. Only IDL an @c struct, @c union or
+ * @c valuetype may be recursive, which is why this decorator only
+ * supports constructors for the corresponding @c TypeCode
+ * implementations.
+ */
+ template <class TypeCodeBase,
+ typename TypeCodeType,
+ typename MemberArrayType>
+ class Recursive_Type
+ : public TypeCodeBase
+ {
+ public:
+
+ /// Recursive @c struct constructor.
+ Recursive_Type (CORBA::TCKind kind,
+ char const * id,
+ char const * name,
+ MemberArrayType const & fields,
+ CORBA::ULong nfields);
+
+ /// Recursive @c union constructor.
+ Recursive_Type (char const * id,
+ char const * name,
+#if defined (__BORLANDC__) && (__BORLANDC__ < 0x572)
+ // Borland C++ currently can't handle a
+ // reference to const pointer to const
+ // CORBA::TypeCode_ptr.
+ TypeCodeType discriminant_type,
+#else
+ TypeCodeType const & discriminant_type,
+#endif
+ MemberArrayType const & cases,
+ CORBA::ULong ncases,
+ CORBA::Long default_index);
+
+ /// Recursive @c valuetype constructor.
+ Recursive_Type (CORBA::TCKind kind,
+ char const * id,
+ char const * name,
+ CORBA::ValueModifier modifier,
+#if defined (__BORLANDC__) && (__BORLANDC__ < 0x572)
+ // Borland C++ currently can't handle a
+ // reference to const pointer to const
+ // CORBA::TypeCode_ptr.
+ TypeCodeType concrete_base,
+#else
+ TypeCodeType const & concrete_base,
+#endif
+ MemberArrayType const & fields,
+ CORBA::ULong nfields);
+
+ /// Dynamic @c Recursive_Type TypeCode constructor.
+ Recursive_Type (CORBA::TCKind kind,
+ char const * id);
+
+ /**
+ * @name TAO-specific @c CORBA::TypeCode Methods
+ *
+ * Methods required by TAO's implementation of the
+ * @c CORBA::TypeCode class.
+ *
+ * @par
+ *
+ * These are recursive type @c TypeCode marshaling operation
+ * overrides.
+ *
+ * @see @c CORBA::TypeCode
+ */
+ //@{
+ virtual bool tao_marshal_kind (TAO_OutputCDR & cdr) const;
+ virtual bool tao_marshal (TAO_OutputCDR & cdr,
+ CORBA::ULong offset) const;
+ //@}
+
+ protected:
+
+ /**
+ * @name TAO @c CORBA::TypeCode Template Methods
+ *
+ * Recursive type @c CORBA::TypeCode -specific
+ * template methods.
+ *
+ * @see @c CORBA::TypeCode
+ */
+ //@{
+ virtual CORBA::Boolean equal_i (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const;
+ virtual CORBA::Boolean equivalent_i (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const;
+ //@}
+
+
+ public:
+
+ /// Set @c struct @c TypeCode parameters.
+ void struct_parameters (char const * name,
+ MemberArrayType const & fields,
+ CORBA::ULong nfields);
+
+ /// Set @c union @c TypeCode parameters.
+ void union_parameters (
+ char const * name,
+#if defined (__BORLANDC__) && (__BORLANDC__ < 0x572)
+ // Borland C++ currently can't handle a
+ // reference to const pointer to const
+ // CORBA::TypeCode_ptr.
+ TypeCodeType discriminant_type,
+#else
+ TypeCodeType const & discriminant_type,
+#endif
+ MemberArrayType const & cases,
+ CORBA::ULong ncases,
+ CORBA::Long default_index);
+
+ /// Set @c valuetype or @c eventtype @c TypeCode parameters.
+ void valuetype_parameters (char const * name,
+ CORBA::ValueModifier modifier,
+#if defined (__BORLANDC__) && (__BORLANDC__ < 0x572)
+ // Borland C++ currently can't handle a
+ // reference to const pointer to const
+ // CORBA::TypeCode_ptr.
+ TypeCodeType concrete_base,
+#else
+ TypeCodeType const & concrete_base,
+#endif
+ MemberArrayType const & fields,
+ CORBA::ULong nfields);
+
+ private:
+
+ /**
+ * @class Reset
+ *
+ * @brief Reset flag to false in an exception-safe manner.
+ *
+ * Reset flag to false in an exception-safe manner.
+ */
+ class Reset
+ {
+ public:
+ Reset (bool & flag) : flag_ (flag) { }
+ ~Reset (void) { this->flag_ = false; }
+ private:
+ bool & flag_;
+ };
+
+ private:
+
+ /// Internal state thread synchronization mutex.
+ mutable TAO_SYNCH_RECURSIVE_MUTEX lock_;
+
+ /// @c true if equality or equivalence is being determined
+ /// recursively.
+ /**
+ * This flag is used to prevent @c TypeCode equality and
+ * equivalence operations from recursing indefinitely.
+ */
+ mutable bool in_recursion_;
+
+ };
+
+ } // End namespace TypeCode
+} // End namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+
+#ifdef __ACE_INLINE__
+# include "tao/AnyTypeCode/Recursive_Type_TypeCode.inl"
+#endif /* __ACE_INLINE__ */
+
+#ifdef ACE_TEMPLATES_REQUIRE_SOURCE
+# include "tao/AnyTypeCode/Recursive_Type_TypeCode.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#ifdef ACE_TEMPLATES_REQUIRE_PRAGMA
+# pragma implementation ("Recursive_Type_TypeCode.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_RECURSIVE_TYPE_TYPECODE_H */
diff --git a/TAO/tao/AnyTypeCode/Recursive_Type_TypeCode.inl b/TAO/tao/AnyTypeCode/Recursive_Type_TypeCode.inl
new file mode 100644
index 00000000000..efd9091a125
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Recursive_Type_TypeCode.inl
@@ -0,0 +1,153 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template <class TypeCodeBase, typename TypeCodeType, typename MemberArrayType>
+ACE_INLINE
+TAO::TypeCode::Recursive_Type<TypeCodeBase,
+ TypeCodeType,
+ MemberArrayType>::Recursive_Type (
+ CORBA::TCKind kind,
+ char const * id,
+ char const * name,
+ MemberArrayType const & fields,
+ CORBA::ULong nfields)
+ : TypeCodeBase (kind, id, name, fields, nfields)
+ , lock_ ()
+ , in_recursion_ (false)
+{
+ // ACE_ASSERT (kind != CORBA::tk_except);
+}
+
+template <class TypeCodeBase, typename TypeCodeType, typename MemberArrayType>
+ACE_INLINE
+TAO::TypeCode::Recursive_Type<TypeCodeBase,
+ TypeCodeType,
+ MemberArrayType>::Recursive_Type (
+ char const * id,
+ char const * name,
+#if defined (__BORLANDC__) && (__BORLANDC__ < 0x572)
+ TypeCodeType discriminant_type,
+#else
+ TypeCodeType const & discriminant_type,
+#endif
+ MemberArrayType const & cases,
+ CORBA::ULong ncases,
+ CORBA::Long default_index)
+ : TypeCodeBase (id,
+ name,
+ discriminant_type,
+ cases,
+ ncases,
+ default_index)
+ , lock_ ()
+ , in_recursion_ (false)
+{
+}
+
+template <class TypeCodeBase, typename TypeCodeType, typename MemberArrayType>
+ACE_INLINE
+TAO::TypeCode::Recursive_Type<TypeCodeBase,
+ TypeCodeType,
+ MemberArrayType>::Recursive_Type (
+ CORBA::TCKind kind,
+ char const * id,
+ char const * name,
+ CORBA::ValueModifier modifier,
+#if defined (__BORLANDC__) && (__BORLANDC__ < 0x572)
+ TypeCodeType concrete_base,
+#else
+ TypeCodeType const & concrete_base,
+#endif
+ MemberArrayType const & fields,
+ CORBA::ULong nfields)
+ : TypeCodeBase (kind,
+ id,
+ name,
+ modifier,
+ concrete_base,
+ fields,
+ nfields)
+ , lock_ ()
+ , in_recursion_ (false)
+{
+}
+
+template <class TypeCodeBase, typename TypeCodeType, typename MemberArrayType>
+ACE_INLINE
+TAO::TypeCode::Recursive_Type<TypeCodeBase,
+ TypeCodeType,
+ MemberArrayType>::Recursive_Type (
+ CORBA::TCKind kind,
+ char const * id)
+ : TypeCodeBase (kind, id)
+ , lock_ ()
+ , in_recursion_ (false)
+{
+// ACE_ASSERT (kind == CORBA::tk_struct
+// || kind == CORBA::tk_union
+// || kind == CORBA::tk_value
+// || kind == CORBA::tk_event);
+}
+
+template <class TypeCodeBase, typename TypeCodeType, typename MemberArrayType>
+ACE_INLINE void
+TAO::TypeCode::Recursive_Type<TypeCodeBase,
+ TypeCodeType,
+ MemberArrayType>::struct_parameters (
+ char const * name,
+ MemberArrayType const & fields,
+ CORBA::ULong nfields)
+{
+ this->base_attributes_.name (name);
+ this->fields_ = fields;
+ this->nfields_ = nfields;
+}
+
+template <class TypeCodeBase, typename TypeCodeType, typename MemberArrayType>
+ACE_INLINE void
+TAO::TypeCode::Recursive_Type<TypeCodeBase,
+ TypeCodeType,
+ MemberArrayType>::union_parameters (
+ char const * name,
+#if defined (__BORLANDC__) && (__BORLANDC__ < 0x572)
+ TypeCodeType discriminant_type,
+#else
+ TypeCodeType const & discriminant_type,
+#endif
+ MemberArrayType const & cases,
+ CORBA::ULong ncases,
+ CORBA::Long default_index)
+{
+ this->base_attributes_.name (name);
+ this->discriminant_type_ = discriminant_type;
+ this->cases_ = cases;
+ this->ncases_ = ncases;
+ this->default_index_ = default_index;
+}
+
+template <class TypeCodeBase, typename TypeCodeType, typename MemberArrayType>
+ACE_INLINE void
+TAO::TypeCode::Recursive_Type<TypeCodeBase,
+ TypeCodeType,
+ MemberArrayType>::valuetype_parameters (
+ char const * name,
+ CORBA::ValueModifier modifier,
+#if defined (__BORLANDC__) && (__BORLANDC__ < 0x572)
+ TypeCodeType concrete_base,
+#else
+ TypeCodeType const & concrete_base,
+#endif
+ MemberArrayType const & fields,
+ CORBA::ULong nfields)
+{
+ this->base_attributes_.name (name);
+ this->type_modifier_ = modifier;
+ this->concrete_base_ = concrete_base;
+ this->fields_ = fields;
+ this->nfields_ = nfields;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/AnyTypeCode/RefCount_Policy_Traits.h b/TAO/tao/AnyTypeCode/RefCount_Policy_Traits.h
new file mode 100644
index 00000000000..d5e4f08d50d
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/RefCount_Policy_Traits.h
@@ -0,0 +1,82 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file RefCount_Policy_Traits.h
+ *
+ * $Id$
+ *
+ * Header file for TAO's reference count policy (unrelated to CORBA
+ * policies) traits.
+ *
+ * @author Ossama Othman <ossama@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_REFCOUNT_POLICY_TRAITS_H
+#define TAO_REFCOUNT_POLICY_TRAITS_H
+
+#include /**/ "ace/pre.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/AnyTypeCode/AnyTypeCode_methods.h"
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ class Null_RefCount_Policy;
+ class True_RefCount_Policy;
+
+ /**
+ * @struct RefCount_Policy_Traits
+ *
+ * @brief Compile-time selection of RefCount_Policy operations,
+ * etc.
+ *
+ * This primary template is used to select RefCount_Policy
+ * operations, etc at compile-time based on the reference counting
+ * policy and type being operated on.
+ *
+ * @note This merely a forward declaration since we really only care
+ * about the partial specializations below.
+ */
+ template<class RefCountPolicy, typename TypePtr>
+ struct RefCount_Policy_Traits;
+
+ /**
+ * @struct RefCount_Policy_Traits
+ *
+ * @brief No-op reference count policy traits.
+ *
+ * This partial specialization performs no-op reference counting
+ * operations on values of type @a TypePtr if the @a RefCountPolicy
+ * first argument is @c Null_RefCount_Policy.
+ */
+ template<typename TypePtr>
+ struct RefCount_Policy_Traits<Null_RefCount_Policy, TypePtr>
+ {
+ /// No-op "release" operation.
+ static void release (TypePtr) { }
+ };
+
+ template<typename TypePtr>
+ struct RefCount_Policy_Traits<True_RefCount_Policy, TypePtr>
+ {
+ /// Call actual "release" operation on @a ptr value.
+ static void release (TypePtr ptr)
+ {
+ CORBA::release (ptr);
+ }
+ };
+} // End namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_REFCOUNT_POLICY_TRAITS_H */
diff --git a/TAO/tao/AnyTypeCode/Sequence_TypeCode.cpp b/TAO/tao/AnyTypeCode/Sequence_TypeCode.cpp
new file mode 100644
index 00000000000..76016fe93fe
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Sequence_TypeCode.cpp
@@ -0,0 +1,150 @@
+// $Id$
+
+#ifndef TAO_SEQUENCE_TYPECODE_CPP
+#define TAO_SEQUENCE_TYPECODE_CPP
+
+#include "tao/AnyTypeCode/Sequence_TypeCode.h"
+#include "tao/CDR.h"
+#include "tao/AnyTypeCode/TypeCode_Traits.h"
+
+#ifndef __ACE_INLINE__
+# include "tao/AnyTypeCode/Sequence_TypeCode.inl"
+#endif /* !__ACE_INLINE__ */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template <typename TypeCodeType, class RefCountPolicy>
+bool
+TAO::TypeCode::Sequence<TypeCodeType, RefCountPolicy>::tao_marshal (
+ TAO_OutputCDR & cdr,
+ CORBA::ULong offset) const
+{
+ // A tk_array or tk_sequence TypeCode has a "complex" parameter list
+ // type (see Table 15-2 in Section 15.3.5.1 "TypeCode" in the CDR
+ // section of the CORBA specification), meaning that it must be
+ // marshaled into a CDR encapsulation.
+
+ // Create a CDR encapsulation.
+ TAO_OutputCDR enc;
+
+ // Account for the encoded CDR encapsulation length and byte order.
+ //
+ // Aligning on an octet since the next value after the CDR
+ // encapsulation length will always be the byte order octet/boolean
+ // in this case.
+ offset = ACE_align_binary (offset + 4,
+ ACE_CDR::OCTET_ALIGN);
+
+ return
+ enc << TAO_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER)
+ && marshal (enc,
+ Traits<TypeCodeType>::get_typecode (this->content_type_),
+ offset + enc.total_length ())
+ && enc << this->length_
+ && cdr << static_cast<CORBA::ULong> (enc.total_length ())
+ && cdr.write_octet_array_mb (enc.begin ());
+}
+
+template <typename TypeCodeType, class RefCountPolicy>
+void
+TAO::TypeCode::Sequence<TypeCodeType, RefCountPolicy>::tao_duplicate (void)
+{
+ this->RefCountPolicy::add_ref ();
+}
+
+template <typename TypeCodeType, class RefCountPolicy>
+void
+TAO::TypeCode::Sequence<TypeCodeType, RefCountPolicy>::tao_release (void)
+{
+ this->RefCountPolicy::remove_ref ();
+}
+
+template <typename TypeCodeType, class RefCountPolicy>
+CORBA::Boolean
+TAO::TypeCode::Sequence<TypeCodeType,
+ RefCountPolicy>::equal_i (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const
+{
+ // The following calls won't throw since CORBA::TypeCode::equal()
+ // has already established the kind of tc is the same as our kind.
+ CORBA::ULong const tc_length = tc->length (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ if (this->length_ != tc_length)
+ return 0;
+
+ CORBA::TypeCode_var rhs_content_type =
+ tc->content_type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ return
+ Traits<TypeCodeType>::get_typecode (this->content_type_)->equal (
+ rhs_content_type.in ()
+ ACE_ENV_ARG_PARAMETER);
+}
+
+template <typename TypeCodeType, class RefCountPolicy>
+CORBA::Boolean
+TAO::TypeCode::Sequence<TypeCodeType,
+ RefCountPolicy>::equivalent_i (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const
+{
+ // The following calls won't throw since CORBA::TypeCode::equal()
+ // has already established the kind of tc is the same as our kind.
+ CORBA::ULong const tc_length = tc->length (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ if (this->length_ != tc_length)
+ return 0;
+
+ CORBA::TypeCode_var rhs_content_type =
+ tc->content_type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ return
+ Traits<TypeCodeType>::get_typecode (this->content_type_)->equivalent (
+ rhs_content_type.in ()
+ ACE_ENV_ARG_PARAMETER);
+}
+
+template <typename TypeCodeType, class RefCountPolicy>
+CORBA::TypeCode_ptr
+TAO::TypeCode::Sequence<TypeCodeType, RefCountPolicy>::get_compact_typecode_i (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED) const
+{
+ // Already compact since tk_sequence and tk_array TypeCodes have no
+ // name or member names, meaning that we can simply call
+ // _duplicate() on this TypeCode.
+
+ // @@ There is a potential problem here if this TypeCode is a static
+ // and const since it may have been placed in read-only memory by
+ // the compiler. A const_cast<> can return undefined results in
+ // that case.
+
+ CORBA::TypeCode_ptr mutable_tc =
+ const_cast<TAO::TypeCode::Sequence<TypeCodeType, RefCountPolicy> *> (this);
+
+ return CORBA::TypeCode::_duplicate (mutable_tc);
+}
+
+template <typename TypeCodeType, class RefCountPolicy>
+CORBA::ULong
+TAO::TypeCode::Sequence<TypeCodeType, RefCountPolicy>::length_i (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED) const
+{
+ return this->length_;
+}
+
+template <typename TypeCodeType, class RefCountPolicy>
+CORBA::TypeCode_ptr
+TAO::TypeCode::Sequence<TypeCodeType, RefCountPolicy>::content_type_i (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED) const
+{
+ return
+ CORBA::TypeCode::_duplicate (
+ Traits<TypeCodeType>::get_typecode (this->content_type_));
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_SEQUENCE_TYPECODE_CPP */
diff --git a/TAO/tao/AnyTypeCode/Sequence_TypeCode.h b/TAO/tao/AnyTypeCode/Sequence_TypeCode.h
new file mode 100644
index 00000000000..3b8cd242ade
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Sequence_TypeCode.h
@@ -0,0 +1,138 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Sequence_TypeCode.h
+ *
+ * $Id$
+ *
+ * Header file for @c tk_sequence and @c tk_array @c CORBA::TypeCodes.
+ *
+ * @author Ossama Othman <ossama@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_SEQUENCE_TYPECODE_H
+#define TAO_SEQUENCE_TYPECODE_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/AnyTypeCode/TypeCode.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace TypeCode
+ {
+
+ /**
+ * @class Sequence
+ *
+ * @brief @c CORBA::TypeCode implementation for OMG IDL
+ * @c sequence and @c array types.
+ *
+ * This class implements a @c CORBA::TypeCode for OMG IDL
+ * @c sequence and array types.
+ */
+ template <typename TypeCodeType, class RefCountPolicy>
+ class Sequence
+ : public CORBA::TypeCode
+ , private RefCountPolicy
+ {
+ public:
+
+ /// Constructor.
+ Sequence (CORBA::TCKind kind,
+#if defined (__BORLANDC__) && (__BORLANDC__ < 0x572)
+ // Borland C++ currently can't handle a reference to
+ // const pointer to const CORBA::TypeCode_ptr
+ TypeCodeType content_type,
+#else
+ TypeCodeType const & content_type,
+#endif
+ CORBA::ULong length);
+
+ /**
+ * @name TAO-specific @c CORBA::TypeCode Methods
+ *
+ * Methods required by TAO's implementation of the
+ * @c CORBA::TypeCode class.
+ *
+ * @see @c CORBA::TypeCode
+ */
+ //@{
+ virtual bool tao_marshal (TAO_OutputCDR & cdr,
+ CORBA::ULong offset) const;
+ virtual void tao_duplicate (void);
+ virtual void tao_release (void);
+ //@}
+
+ protected:
+
+ /**
+ * @name @c TAO CORBA::TypeCode Template Methods
+ *
+ * @c CORBA::TypeCode template methods specific to @c tk_sequence
+ * @c TypeCodes.
+ *
+ * @see @c CORBA::TypeCode
+ */
+ //@{
+ virtual CORBA::Boolean equal_i (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const;
+ virtual CORBA::Boolean equivalent_i (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const;
+ virtual CORBA::TypeCode_ptr get_compact_typecode_i (
+ ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual CORBA::ULong length_i (ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual CORBA::TypeCode_ptr content_type_i (
+ ACE_ENV_SINGLE_ARG_DECL) const;
+
+ private:
+
+ /// Element type of the sequence.
+ /**
+ * A pointer to the @c CORBA::TypeCode_ptr rather than the
+ * @c CORBA::TypeCode_ptr itself is stored since that address is
+ * well-defined. We may not know the value of the @c
+ * CORBA::TypeCode_ptr when creating this @c Field statically at
+ * compile-time, hence the indirection.
+ *
+ * @note This @c TypeCode is released upon destruction of this
+ * @c TypeCode::Sequence.
+ */
+ TypeCodeType const content_type_;
+
+ /// Length of the @c sequence or array. A length of zero
+ /// indicates an unbounded @c sequence.
+ CORBA::ULong const length_;
+
+ };
+
+ } // End namespace TypeCode
+} // End namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#ifdef __ACE_INLINE__
+# include "tao/AnyTypeCode/Sequence_TypeCode.inl"
+#endif /* __ACE_INLINE__ */
+
+#ifdef ACE_TEMPLATES_REQUIRE_SOURCE
+# include "tao/AnyTypeCode/Sequence_TypeCode.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#ifdef ACE_TEMPLATES_REQUIRE_PRAGMA
+# pragma implementation ("Sequence_TypeCode.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_SEQUENCE_TYPECODE_H */
diff --git a/TAO/tao/AnyTypeCode/Sequence_TypeCode.inl b/TAO/tao/AnyTypeCode/Sequence_TypeCode.inl
new file mode 100644
index 00000000000..eced0644709
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Sequence_TypeCode.inl
@@ -0,0 +1,27 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template <typename TypeCodeType, class RefCountPolicy>
+ACE_INLINE
+TAO::TypeCode::Sequence<TypeCodeType, RefCountPolicy>::Sequence (
+ CORBA::TCKind kind,
+#if defined (__BORLANDC__) && (__BORLANDC__ < 0x572)
+ // Borland C++ currently can't handle a reference to
+ // const pointer to const CORBA::TypeCode_ptr
+ TypeCodeType content_type,
+#else
+ TypeCodeType const & content_type,
+#endif
+ CORBA::ULong length)
+ : ::CORBA::TypeCode (kind)
+ , RefCountPolicy ()
+ , content_type_ (content_type)
+ , length_ (length)
+{
+ // ACE_ASSERT (kind == CORBA::tk_array || kind == CORBA::tk_sequence);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/AnyTypeCode/Sequence_TypeCode_Static.cpp b/TAO/tao/AnyTypeCode/Sequence_TypeCode_Static.cpp
new file mode 100644
index 00000000000..874fe38365b
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Sequence_TypeCode_Static.cpp
@@ -0,0 +1,150 @@
+// $Id$
+
+#include "tao/AnyTypeCode/Sequence_TypeCode_Static.h"
+#include "tao/CDR.h"
+#include "tao/AnyTypeCode/TypeCode_Traits.h"
+
+#ifndef __ACE_INLINE__
+# include "tao/AnyTypeCode/Sequence_TypeCode_Static.inl"
+#endif /* !__ACE_INLINE__ */
+
+
+ACE_RCSID (AnyTypeCode,
+ Sequence_TypeCode_Static,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+bool
+TAO::TypeCode::Sequence<CORBA::TypeCode_ptr const *,
+ TAO::Null_RefCount_Policy>::tao_marshal (
+ TAO_OutputCDR & cdr,
+ CORBA::ULong offset) const
+{
+ // A tk_array or tk_sequence TypeCode has a "complex" parameter list
+ // type (see Table 15-2 in Section 15.3.5.1 "TypeCode" in the CDR
+ // section of the CORBA specification), meaning that it must be
+ // marshaled into a CDR encapsulation.
+
+ // Create a CDR encapsulation.
+ TAO_OutputCDR enc;
+
+ // Account for the encoded CDR encapsulation length and byte order.
+ //
+ // Aligning on an octet since the next value after the CDR
+ // encapsulation length will always be the byte order octet/boolean
+ // in this case.
+ offset = ACE_align_binary (offset + 4,
+ ACE_CDR::OCTET_ALIGN);
+
+ return
+ enc << TAO_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER)
+ && marshal (enc,
+ Traits<CORBA::TypeCode_ptr const *>::get_typecode (
+ this->content_type_),
+ offset + enc.total_length ())
+ && enc << this->length_
+ && cdr << static_cast<CORBA::ULong> (enc.total_length ())
+ && cdr.write_octet_array_mb (enc.begin ());
+}
+
+void
+TAO::TypeCode::Sequence<CORBA::TypeCode_ptr const *,
+ TAO::Null_RefCount_Policy>::tao_duplicate (void)
+{
+}
+
+void
+TAO::TypeCode::Sequence<CORBA::TypeCode_ptr const *,
+ TAO::Null_RefCount_Policy>::tao_release (void)
+{
+}
+
+CORBA::Boolean
+TAO::TypeCode::Sequence<CORBA::TypeCode_ptr const *,
+ TAO::Null_RefCount_Policy>::equal_i (
+ CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const
+{
+ // The following calls won't throw since CORBA::TypeCode::equal()
+ // has already established the kind of tc is the same as our kind.
+ CORBA::ULong const tc_length = tc->length (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ if (this->length_ != tc_length)
+ return 0;
+
+ CORBA::TypeCode_var rhs_content_type =
+ tc->content_type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ return
+ Traits<CORBA::TypeCode_ptr const *>::get_typecode (this->content_type_)->equal (
+ rhs_content_type.in ()
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::Boolean
+TAO::TypeCode::Sequence<CORBA::TypeCode_ptr const *,
+ TAO::Null_RefCount_Policy>::equivalent_i (
+ CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const
+{
+ // The following calls won't throw since CORBA::TypeCode::equal()
+ // has already established the kind of tc is the same as our kind.
+ CORBA::ULong const tc_length = tc->length (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ if (this->length_ != tc_length)
+ return 0;
+
+ CORBA::TypeCode_var rhs_content_type =
+ tc->content_type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ return
+ Traits<CORBA::TypeCode_ptr const *>::get_typecode (this->content_type_)->equivalent (
+ rhs_content_type.in ()
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::TypeCode_ptr
+TAO::TypeCode::Sequence<CORBA::TypeCode_ptr const *,
+ TAO::Null_RefCount_Policy>::get_compact_typecode_i (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED) const
+{
+ // Already compact since tk_sequence and tk_array TypeCodes have no
+ // name or member names, meaning that we can simply call
+ // _duplicate() on this TypeCode.
+
+ // @@ There is a potential problem here if this TypeCode is a static
+ // and const since it may have been placed in read-only memory by
+ // the compiler. A const_cast<> can return undefined results in
+ // that case.
+
+ CORBA::TypeCode_ptr mutable_tc =
+ const_cast<TAO::TypeCode::Sequence<CORBA::TypeCode_ptr const *,
+ TAO::Null_RefCount_Policy> *> (this);
+
+ return CORBA::TypeCode::_duplicate (mutable_tc);
+}
+
+CORBA::ULong
+TAO::TypeCode::Sequence<CORBA::TypeCode_ptr const *,
+ TAO::Null_RefCount_Policy>::length_i (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED) const
+{
+ return this->length_;
+}
+
+CORBA::TypeCode_ptr
+TAO::TypeCode::Sequence<CORBA::TypeCode_ptr const *,
+ TAO::Null_RefCount_Policy>::content_type_i (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED) const
+{
+ return
+ CORBA::TypeCode::_duplicate (
+ Traits<CORBA::TypeCode_ptr const *>::get_typecode (this->content_type_));
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/AnyTypeCode/Sequence_TypeCode_Static.h b/TAO/tao/AnyTypeCode/Sequence_TypeCode_Static.h
new file mode 100644
index 00000000000..7c3d4746fbc
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Sequence_TypeCode_Static.h
@@ -0,0 +1,127 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Sequence_TypeCode_Static.h
+ *
+ * $Id$
+ *
+ * Header file for static @c tk_sequence and @c tk_array
+ * @c CORBA::TypeCodes.
+ *
+ * @author Ossama Othman <ossama@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_SEQUENCE_TYPECODE_STATIC_H
+#define TAO_SEQUENCE_TYPECODE_STATIC_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/AnyTypeCode/TypeCode.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/AnyTypeCode/Null_RefCount_Policy.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace TypeCode
+ {
+ template <typename TypeCodeType, class RefCountPolicy> class Sequence;
+
+ /**
+ * @class Sequence
+ *
+ * @brief @c CORBA::TypeCode implementation for OMG IDL
+ * @c sequence and @c array types.
+ *
+ * This class implements a @c CORBA::TypeCode for OMG IDL
+ * @c sequence and array types.
+ */
+ template<>
+ class TAO_AnyTypeCode_Export Sequence<CORBA::TypeCode_ptr const *,
+ TAO::Null_RefCount_Policy>
+ : public CORBA::TypeCode
+ , private TAO::Null_RefCount_Policy
+ {
+ public:
+
+ /// Constructor.
+ Sequence (CORBA::TCKind kind,
+ CORBA::TypeCode_ptr const * content_type,
+ CORBA::ULong length);
+
+ /**
+ * @name TAO-specific @c CORBA::TypeCode Methods
+ *
+ * Methods required by TAO's implementation of the
+ * @c CORBA::TypeCode class.
+ *
+ * @see @c CORBA::TypeCode
+ */
+ //@{
+ virtual bool tao_marshal (TAO_OutputCDR & cdr,
+ CORBA::ULong offset) const;
+ virtual void tao_duplicate (void);
+ virtual void tao_release (void);
+ //@}
+
+ protected:
+
+ /**
+ * @name @c TAO CORBA::TypeCode Template Methods
+ *
+ * @c CORBA::TypeCode template methods specific to @c tk_sequence
+ * @c TypeCodes.
+ *
+ * @see @c CORBA::TypeCode
+ */
+ //@{
+ virtual CORBA::Boolean equal_i (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const;
+ virtual CORBA::Boolean equivalent_i (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const;
+ virtual CORBA::TypeCode_ptr get_compact_typecode_i (
+ ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual CORBA::ULong length_i (ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual CORBA::TypeCode_ptr content_type_i (
+ ACE_ENV_SINGLE_ARG_DECL) const;
+
+ private:
+
+ /// Element type of the sequence.
+ /**
+ * A pointer to the @c CORBA::TypeCode_ptr rather than the
+ * @c CORBA::TypeCode_ptr itself is stored since that address is
+ * well-defined. We may not know the value of the @c
+ * CORBA::TypeCode_ptr when creating this @c Field statically at
+ * compile-time, hence the indirection.
+ *
+ * @note This @c TypeCode is released upon destruction of this
+ * @c TypeCode::Sequence.
+ */
+ CORBA::TypeCode_ptr const * const content_type_;
+
+ /// Length of the @c sequence or array. A length of zero
+ /// indicates an unbounded @c sequence.
+ CORBA::ULong const length_;
+
+ };
+
+ } // End namespace TypeCode
+} // End namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#ifdef __ACE_INLINE__
+# include "tao/AnyTypeCode/Sequence_TypeCode_Static.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_SEQUENCE_TYPECODE_STATIC_H */
diff --git a/TAO/tao/AnyTypeCode/Sequence_TypeCode_Static.inl b/TAO/tao/AnyTypeCode/Sequence_TypeCode_Static.inl
new file mode 100644
index 00000000000..84361bf52de
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Sequence_TypeCode_Static.inl
@@ -0,0 +1,20 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO::TypeCode::Sequence<CORBA::TypeCode_ptr const *,
+ TAO::Null_RefCount_Policy>::Sequence (
+ CORBA::TCKind kind,
+ CORBA::TypeCode_ptr const * content_type,
+ CORBA::ULong length)
+ : ::CORBA::TypeCode (kind)
+ , ::TAO::Null_RefCount_Policy ()
+ , content_type_ (content_type)
+ , length_ (length)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/AnyTypeCode/String_TypeCode.cpp b/TAO/tao/AnyTypeCode/String_TypeCode.cpp
new file mode 100644
index 00000000000..bae404af34e
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/String_TypeCode.cpp
@@ -0,0 +1,93 @@
+// $Id$
+
+#ifndef TAO_STRING_TYPECODE_CPP
+#define TAO_STRING_TYPECODE_CPP
+
+#include "tao/AnyTypeCode/String_TypeCode.h"
+#include "tao/CDR.h"
+
+#ifndef __ACE_INLINE__
+# include "tao/AnyTypeCode/String_TypeCode.inl"
+#endif /* !__ACE_INLINE__ */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template <class RefCountPolicy>
+bool
+TAO::TypeCode::String<RefCountPolicy>::tao_marshal (TAO_OutputCDR & cdr,
+ CORBA::ULong) const
+{
+ // A tk_string TypeCode has a "simple" parameter list type (see
+ // Table 15-2 in Section 15.3.5.1 "TypeCode" in the CDR section of
+ // the CORBA specification), meaning that its parameter(s) must be
+ // marshaled immediately following the TCKind. No CDR encapsulation
+ // is to be created.
+
+ return (cdr << this->length_);
+}
+
+template <class RefCountPolicy>
+void
+TAO::TypeCode::String<RefCountPolicy>::tao_duplicate (void)
+{
+ this->RefCountPolicy::add_ref ();
+}
+
+template <class RefCountPolicy>
+void
+TAO::TypeCode::String<RefCountPolicy>::tao_release (void)
+{
+ this->RefCountPolicy::remove_ref ();
+}
+
+template <class RefCountPolicy>
+CORBA::Boolean
+TAO::TypeCode::String<RefCountPolicy>::equal_i (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const
+{
+ // The following call won't throw since CORBA::TypeCode::equal() has
+ // already established the kind of tc is the same as our kind.
+ CORBA::ULong const tc_length = tc->length (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ return (this->length_ == tc_length);
+}
+
+template <class RefCountPolicy>
+CORBA::Boolean
+TAO::TypeCode::String<RefCountPolicy>::equivalent_i (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const
+{
+ // Since TCKind comparisons must be performed before equal_i() is
+ // called, we can also call it to determine equivalence of
+ // tk_string-based TypeCodes.
+ return this->equal_i (tc
+ ACE_ENV_ARG_PARAMETER);
+}
+
+template <class RefCountPolicy>
+CORBA::TypeCode_ptr
+TAO::TypeCode::String<RefCountPolicy>::get_compact_typecode_i (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED) const
+{
+ // Already compact since tk_string and tk_wstring TypeCodes have no
+ // name or member names, meaning that we can simply call
+ // _duplicate() on this TypeCode.
+
+ CORBA::TypeCode_ptr mutable_tc =
+ const_cast<TAO::TypeCode::String<RefCountPolicy> *> (this);
+
+ return CORBA::TypeCode::_duplicate (mutable_tc);
+}
+
+template <class RefCountPolicy>
+CORBA::ULong
+TAO::TypeCode::String<RefCountPolicy>::length_i (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED) const
+{
+ return this->length_;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_STRING_TYPECODE_CPP */
diff --git a/TAO/tao/AnyTypeCode/String_TypeCode.h b/TAO/tao/AnyTypeCode/String_TypeCode.h
new file mode 100644
index 00000000000..86a7270f12b
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/String_TypeCode.h
@@ -0,0 +1,115 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file String_TypeCode.h
+ *
+ * $Id$
+ *
+ * Header file for @c CORBA::tk_string or @c CORBA::tk_wstring
+ * @c CORBA::TypeCodes.
+ *
+ * @author Ossama Othman <ossama@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_STRING_TYPECODE_H
+#define TAO_STRING_TYPECODE_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/AnyTypeCode/TypeCode.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace TypeCode
+ {
+
+ /**
+ * @class String
+ *
+ * @brief @c CORBA::TypeCode implementation for OMG IDL string
+ * types.
+ *
+ * This class implements a @c CORBA::TypeCode for OMG IDL string
+ * types, including @c wstring.
+ */
+ template <class RefCountPolicy>
+ class String
+ : public CORBA::TypeCode,
+ private RefCountPolicy
+ {
+ public:
+
+ /// Constructor.
+ String (CORBA::TCKind kind, CORBA::ULong length);
+
+ /**
+ * @name TAO-specific @c CORBA::TypeCode Methods
+ *
+ * Methods required by TAO's implementation of the
+ * @c CORBA::TypeCode class.
+ *
+ * @see @c CORBA::TypeCode
+ */
+ //@{
+ virtual bool tao_marshal (TAO_OutputCDR & cdr,
+ CORBA::ULong offset) const;
+ virtual void tao_duplicate (void);
+ virtual void tao_release (void);
+ //@}
+
+ protected:
+
+ /**
+ * @name @c TAO CORBA::TypeCode Template Methods
+ *
+ * @c CORBA::TypeCode template methods specific to @c tk_string
+ * @c TypeCodes.
+ *
+ * @see @c CORBA::TypeCode
+ */
+ //@{
+ virtual CORBA::Boolean equal_i (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const;
+ virtual CORBA::Boolean equivalent_i (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const;
+ virtual CORBA::TypeCode_ptr get_compact_typecode_i (
+ ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual CORBA::ULong length_i (ACE_ENV_SINGLE_ARG_DECL) const;
+
+ private:
+
+ /// Length of the @c string. A length of zero indicates an
+ /// unbounded @c string.
+ CORBA::ULong const length_;
+
+ };
+
+ } // End namespace TypeCode
+} // End namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+
+#ifdef __ACE_INLINE__
+# include "tao/AnyTypeCode/String_TypeCode.inl"
+#endif /* __ACE_INLINE__ */
+
+#ifdef ACE_TEMPLATES_REQUIRE_SOURCE
+# include "tao/AnyTypeCode/String_TypeCode.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#ifdef ACE_TEMPLATES_REQUIRE_PRAGMA
+# pragma implementation ("String_TypeCode.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_STRING_TYPECODE_H */
diff --git a/TAO/tao/AnyTypeCode/String_TypeCode.inl b/TAO/tao/AnyTypeCode/String_TypeCode.inl
new file mode 100644
index 00000000000..c83c7be8667
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/String_TypeCode.inl
@@ -0,0 +1,18 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template <class RefCountPolicy>
+ACE_INLINE
+TAO::TypeCode::String<RefCountPolicy>::String (CORBA::TCKind kind,
+ CORBA::ULong length)
+ : ::CORBA::TypeCode (kind)
+ , RefCountPolicy ()
+ , length_ (length)
+{
+ // ACE_ASSERT (kind == CORBA::tk_string || kind == CORBA::tk_wstring);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/AnyTypeCode/String_TypeCode_Static.cpp b/TAO/tao/AnyTypeCode/String_TypeCode_Static.cpp
new file mode 100644
index 00000000000..2066078627a
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/String_TypeCode_Static.cpp
@@ -0,0 +1,88 @@
+// $Id$
+
+#include "tao/AnyTypeCode/String_TypeCode_Static.h"
+#include "tao/CDR.h"
+
+#ifndef __ACE_INLINE__
+# include "tao/AnyTypeCode/String_TypeCode_Static.inl"
+#endif /* !__ACE_INLINE__ */
+
+
+ACE_RCSID (AnyTypeCode,
+ String_TypeCode_Static,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+bool
+TAO::TypeCode::String<TAO::Null_RefCount_Policy>::tao_marshal (
+ TAO_OutputCDR & cdr,
+ CORBA::ULong) const
+{
+ // A tk_string TypeCode has a "simple" parameter list type (see
+ // Table 15-2 in Section 15.3.5.1 "TypeCode" in the CDR section of
+ // the CORBA specification), meaning that its parameter(s) must be
+ // marshaled immediately following the TCKind. No CDR encapsulation
+ // is to be created.
+
+ return (cdr << this->length_);
+}
+
+void
+TAO::TypeCode::String<TAO::Null_RefCount_Policy>::tao_duplicate (void)
+{
+}
+
+void
+TAO::TypeCode::String<TAO::Null_RefCount_Policy>::tao_release (void)
+{
+}
+
+CORBA::Boolean
+TAO::TypeCode::String<TAO::Null_RefCount_Policy>::equal_i (
+ CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const
+{
+ // The following call won't throw since CORBA::TypeCode::equal() has
+ // already established the kind of tc is the same as our kind.
+ CORBA::ULong const tc_length = tc->length (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ return (this->length_ == tc_length);
+}
+
+CORBA::Boolean
+TAO::TypeCode::String<TAO::Null_RefCount_Policy>::equivalent_i (
+ CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const
+{
+ // Since TCKind comparisons must be performed before equal_i() is
+ // called, we can also call it to determine equivalence of
+ // tk_string-based TypeCodes.
+ return this->equal_i (tc
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::TypeCode_ptr
+TAO::TypeCode::String<TAO::Null_RefCount_Policy>::get_compact_typecode_i (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED) const
+{
+ // Already compact since tk_string and tk_wstring TypeCodes have no
+ // name or member names, meaning that we can simply call
+ // _duplicate() on this TypeCode.
+
+ CORBA::TypeCode_ptr mutable_tc =
+ const_cast<TAO::TypeCode::String<TAO::Null_RefCount_Policy> *> (this);
+
+ return CORBA::TypeCode::_duplicate (mutable_tc);
+}
+
+CORBA::ULong
+TAO::TypeCode::String<TAO::Null_RefCount_Policy>::length_i (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED) const
+{
+ return this->length_;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/AnyTypeCode/String_TypeCode_Static.h b/TAO/tao/AnyTypeCode/String_TypeCode_Static.h
new file mode 100644
index 00000000000..8911843a9ee
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/String_TypeCode_Static.h
@@ -0,0 +1,110 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file String_TypeCode_Static.h
+ *
+ * $Id$
+ *
+ * Header file for static @c CORBA::tk_string or @c CORBA::tk_wstring
+ * @c CORBA::TypeCodes.
+ *
+ * @author Ossama Othman <ossama@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_STRING_TYPECODE_STATIC_H
+#define TAO_STRING_TYPECODE_STATIC_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/AnyTypeCode/TypeCode.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/AnyTypeCode/Null_RefCount_Policy.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace TypeCode
+ {
+ template <class RefCountPolicy> class String;
+
+ /**
+ * @class String
+ *
+ * @brief @c CORBA::TypeCode implementation for OMG IDL string
+ * types.
+ *
+ * This class implements a @c CORBA::TypeCode for OMG IDL string
+ * types, including @c wstring.
+ */
+ template<>
+ class TAO_AnyTypeCode_Export String<TAO::Null_RefCount_Policy>
+ : public CORBA::TypeCode,
+ private TAO::Null_RefCount_Policy
+ {
+ public:
+
+ /// Constructor.
+ String (CORBA::TCKind kind, CORBA::ULong length);
+
+ /**
+ * @name TAO-specific @c CORBA::TypeCode Methods
+ *
+ * Methods required by TAO's implementation of the
+ * @c CORBA::TypeCode class.
+ *
+ * @see @c CORBA::TypeCode
+ */
+ //@{
+ virtual bool tao_marshal (TAO_OutputCDR & cdr,
+ CORBA::ULong offset) const;
+ virtual void tao_duplicate (void);
+ virtual void tao_release (void);
+ //@}
+
+ protected:
+
+ /**
+ * @name @c TAO CORBA::TypeCode Template Methods
+ *
+ * @c CORBA::TypeCode template methods specific to @c tk_string
+ * @c TypeCodes.
+ *
+ * @see @c CORBA::TypeCode
+ */
+ //@{
+ virtual CORBA::Boolean equal_i (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const;
+ virtual CORBA::Boolean equivalent_i (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const;
+ virtual CORBA::TypeCode_ptr get_compact_typecode_i (
+ ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual CORBA::ULong length_i (ACE_ENV_SINGLE_ARG_DECL) const;
+
+ private:
+
+ /// Length of the @c string. A length of zero indicates an
+ /// unbounded @c string.
+ CORBA::ULong const length_;
+
+ };
+
+ } // End namespace TypeCode
+} // End namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+
+#ifdef __ACE_INLINE__
+# include "tao/AnyTypeCode/String_TypeCode_Static.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_STRING_TYPECODE_STATIC_H */
diff --git a/TAO/tao/AnyTypeCode/String_TypeCode_Static.inl b/TAO/tao/AnyTypeCode/String_TypeCode_Static.inl
new file mode 100644
index 00000000000..f9b3517f049
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/String_TypeCode_Static.inl
@@ -0,0 +1,18 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO::TypeCode::String<TAO::Null_RefCount_Policy>::String (
+ CORBA::TCKind kind,
+ CORBA::ULong length)
+ : ::CORBA::TypeCode (kind)
+ , ::TAO::Null_RefCount_Policy ()
+ , length_ (length)
+{
+ // ACE_ASSERT (kind == CORBA::tk_string || kind == CORBA::tk_wstring);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/AnyTypeCode/String_TypeCode_Traits.h b/TAO/tao/AnyTypeCode/String_TypeCode_Traits.h
new file mode 100644
index 00000000000..670e6a835ba
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/String_TypeCode_Traits.h
@@ -0,0 +1,81 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file String_TypeCode_Traits.h
+ *
+ * $Id$
+ *
+ * Header file for bound
+ * @c tk_string,
+ * @c tk_wstring,
+ * @c CORBA::TypeCode factories.
+ *
+ * @author Ossama Othman <ossama@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_STRING_TYPECODE_TRAITS_H
+#define TAO_STRING_TYPECODE_TRAITS_H
+
+#include /**/ "ace/pre.h"
+
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/AnyTypeCode/String_TypeCode.h"
+#include "tao/AnyTypeCode/True_RefCount_Policy.h"
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace TypeCodeFactory
+ {
+ template <typename T> struct String_Traits;
+
+ template<>
+ struct String_Traits<CORBA::Any::from_string>
+ {
+ static CORBA::TypeCode_ptr create_typecode (CORBA::TCKind kind,
+ CORBA::ULong bound)
+ {
+ typedef TAO::TypeCode::String<TAO::True_RefCount_Policy> typecode_type;
+
+ CORBA::TypeCode_ptr tc = CORBA::TypeCode::_nil ();
+ ACE_NEW_RETURN (tc,
+ typecode_type (kind, bound),
+ tc);
+
+ return tc;
+ }
+ };
+
+ template <>
+ struct String_Traits<CORBA::Any::from_wstring>
+ {
+ static CORBA::TypeCode_ptr create_typecode (CORBA::TCKind kind,
+ CORBA::ULong bound)
+ {
+ typedef TAO::TypeCode::String<TAO::True_RefCount_Policy> typecode_type;
+
+ CORBA::TypeCode_ptr tc = CORBA::TypeCode::_nil ();
+ ACE_NEW_RETURN (tc,
+ typecode_type (kind, bound),
+ tc);
+
+ return tc;
+ }
+ };
+
+ } // End namespace TypeCodeFactory
+} // End namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_STRING_TYPECODE_TRAITS_H */
diff --git a/TAO/tao/AnyTypeCode/Struct_TypeCode.cpp b/TAO/tao/AnyTypeCode/Struct_TypeCode.cpp
new file mode 100644
index 00000000000..aa50e7bdf78
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Struct_TypeCode.cpp
@@ -0,0 +1,349 @@
+// $Id$
+
+#ifndef TAO_STRUCT_TYPECODE_CPP
+#define TAO_STRUCT_TYPECODE_CPP
+
+#include "tao/AnyTypeCode/Struct_TypeCode.h"
+#include "tao/AnyTypeCode/TypeCode_Struct_Field.h"
+#include "tao/AnyTypeCode/TypeCode_Traits.h"
+#include "tao/ORB_Core.h"
+#include "tao/TypeCodeFactory_Adapter.h"
+#include "tao/CDR.h"
+
+
+#ifndef __ACE_INLINE__
+# include "tao/AnyTypeCode/Struct_TypeCode.inl"
+#endif /* !__ACE_INLINE__ */
+
+#include "ace/Dynamic_Service.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template <typename StringType,
+ typename TypeCodeType,
+ class FieldArrayType,
+ class RefCountPolicy>
+bool
+TAO::TypeCode::Struct<StringType,
+ TypeCodeType,
+ FieldArrayType,
+ RefCountPolicy>::tao_marshal (TAO_OutputCDR & cdr,
+ CORBA::ULong offset) const
+{
+ // A tk_struct TypeCode has a "complex" parameter list type (see
+ // Table 15-2 in Section 15.3.5.1 "TypeCode" in the CDR section of
+ // the CORBA specification), meaning that it must be marshaled into
+ // a CDR encapsulation.
+
+ // Create a CDR encapsulation.
+ TAO_OutputCDR enc;
+
+ // Account for the encoded CDR encapsulation length and byte order.
+ //
+ // Aligning on an octet since the next value after the CDR
+ // encapsulation length will always be the byte order octet/boolean
+ // in this case.
+ offset = ACE_align_binary (offset + 4,
+ ACE_CDR::OCTET_ALIGN);
+
+ bool const success =
+ (enc << TAO_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER))
+ && (enc << TAO_OutputCDR::from_string (this->base_attributes_.id (), 0))
+ && (enc << TAO_OutputCDR::from_string (this->base_attributes_.name (), 0))
+ && (enc << this->nfields_);
+
+ if (!success)
+ return false;
+
+ Struct_Field<StringType, TypeCodeType> const * const begin =
+ &this->fields_[0];
+ Struct_Field<StringType, TypeCodeType> const * const end =
+ begin + this->nfields_;
+
+ for (Struct_Field<StringType, TypeCodeType> const * i = begin; i != end; ++i)
+ {
+ Struct_Field<StringType, TypeCodeType> const & field = *i;
+
+ if (!(enc << TAO_OutputCDR::from_string (
+ Traits<StringType>::get_string (field.name), 0))
+ || !marshal (enc,
+ Traits<StringType>::get_typecode (field.type),
+ offset + enc.total_length ()))
+ return false;
+ }
+
+ return
+ cdr << static_cast<CORBA::ULong> (enc.total_length ())
+ && cdr.write_octet_array_mb (enc.begin ());
+}
+
+template <typename StringType,
+ typename TypeCodeType,
+ class FieldArrayType,
+ class RefCountPolicy>
+void
+TAO::TypeCode::Struct<StringType,
+ TypeCodeType,
+ FieldArrayType,
+ RefCountPolicy>::tao_duplicate (void)
+{
+ this->RefCountPolicy::add_ref ();
+}
+
+template <typename StringType,
+ typename TypeCodeType,
+ class FieldArrayType,
+ class RefCountPolicy>
+void
+TAO::TypeCode::Struct<StringType,
+ TypeCodeType,
+ FieldArrayType,
+ RefCountPolicy>::tao_release (void)
+{
+ this->RefCountPolicy::remove_ref ();
+}
+
+template <typename StringType,
+ typename TypeCodeType,
+ class FieldArrayType,
+ class RefCountPolicy>
+CORBA::Boolean
+TAO::TypeCode::Struct<StringType,
+ TypeCodeType,
+ FieldArrayType,
+ RefCountPolicy>::equal_i (
+ CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const
+{
+ // This call shouldn't throw since CORBA::TypeCode::equal() verified
+ // that the TCKind is the same as our's prior to invoking this
+ // method, meaning that member_count() is supported.
+
+ CORBA::ULong const tc_nfields =
+ tc->member_count (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ if (tc_nfields != this->nfields_)
+ return false;
+
+ for (CORBA::ULong i = 0; i < this->nfields_; ++i)
+ {
+ Struct_Field<StringType, TypeCodeType> const & lhs_field =
+ this->fields_[i];
+
+ char const * const lhs_name =
+ Traits<StringType>::get_string (lhs_field.name);
+ char const * const rhs_name = tc->member_name (i
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ if (ACE_OS::strcmp (lhs_name, rhs_name) != 0)
+ return false;
+
+ CORBA::TypeCode_ptr const lhs_tc =
+ Traits<StringType>::get_typecode (lhs_field.type);
+ CORBA::TypeCode_var const rhs_tc =
+ tc->member_type (i
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ CORBA::Boolean const equal_members =
+ lhs_tc->equal (rhs_tc.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ if (!equal_members)
+ return false;
+ }
+
+ return true;
+}
+
+template <typename StringType,
+ typename TypeCodeType,
+ class FieldArrayType,
+ class RefCountPolicy>
+CORBA::Boolean
+TAO::TypeCode::Struct<StringType,
+ TypeCodeType,
+ FieldArrayType,
+ RefCountPolicy>::equivalent_i (
+ CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const
+{
+ // Perform a structural comparison, excluding the name() and
+ // member_name() operations.
+
+ CORBA::ULong const tc_nfields =
+ tc->member_count (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ if (tc_nfields != this->nfields_)
+ return false;
+
+ for (CORBA::ULong i = 0; i < this->nfields_; ++i)
+ {
+ CORBA::TypeCode_ptr const lhs =
+ Traits<StringType>::get_typecode (this->fields_[i].type);
+ CORBA::TypeCode_var const rhs =
+ tc->member_type (i
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ CORBA::Boolean const equiv_members =
+ lhs->equivalent (rhs.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ if (!equiv_members)
+ return false;
+ }
+
+ return true;
+}
+
+template <typename StringType,
+ typename TypeCodeType,
+ class FieldArrayType,
+ class RefCountPolicy>
+CORBA::TypeCode_ptr
+TAO::TypeCode::Struct<StringType,
+ TypeCodeType,
+ FieldArrayType,
+ RefCountPolicy>::get_compact_typecode_i (
+ ACE_ENV_SINGLE_ARG_DECL) const
+{
+ ACE_Array_Base<Struct_Field<CORBA::String_var,
+ CORBA::TypeCode_var> >
+ tc_fields (this->nfields_);
+
+ if (this->nfields_ > 0)
+ {
+ // Dynamically construct a new array of fields stripped of
+ // member names.
+
+ static char const empty_name[] = "";
+
+ for (CORBA::ULong i = 0; i < this->nfields_; ++i)
+ {
+ // Member names will be stripped, i.e. not embedded within
+ // the compact TypeCode.
+
+ tc_fields[i].name = empty_name;
+ tc_fields[i].type =
+ Traits<StringType>::get_typecode (
+ this->fields_[i].type)->get_compact_typecode (
+ ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::TypeCode::_nil ());
+ }
+ }
+
+ TAO_TypeCodeFactory_Adapter * const adapter =
+ ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance (
+ TAO_ORB_Core::typecodefactory_adapter_name ());
+
+ if (adapter == 0)
+ {
+ ACE_THROW_RETURN (CORBA::INTERNAL (),
+ CORBA::TypeCode::_nil ());
+ }
+
+ return
+ adapter->create_struct_except_tc (this->kind_,
+ this->base_attributes_.id (),
+ "" /* empty name */,
+ tc_fields,
+ this->nfields_
+ ACE_ENV_ARG_PARAMETER);
+}
+
+template <typename StringType,
+ typename TypeCodeType,
+ class FieldArrayType,
+ class RefCountPolicy>
+char const *
+TAO::TypeCode::Struct<StringType,
+ TypeCodeType,
+ FieldArrayType,
+ RefCountPolicy>::id_i (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED) const
+{
+ // Ownership is retained by the TypeCode, as required by the C++
+ // mapping.
+ return this->base_attributes_.id ();
+}
+
+template <typename StringType,
+ typename TypeCodeType,
+ class FieldArrayType,
+ class RefCountPolicy>
+char const *
+TAO::TypeCode::Struct<StringType,
+ TypeCodeType,
+ FieldArrayType,
+ RefCountPolicy>::name_i (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED) const
+{
+ // Ownership is retained by the TypeCode, as required by the C++
+ // mapping.
+ return this->base_attributes_.name ();
+}
+
+template <typename StringType,
+ typename TypeCodeType,
+ class FieldArrayType,
+ class RefCountPolicy>
+CORBA::ULong
+TAO::TypeCode::Struct<StringType,
+ TypeCodeType,
+ FieldArrayType,
+ RefCountPolicy>::member_count_i (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED) const
+{
+ return this->nfields_;
+}
+
+template <typename StringType,
+ typename TypeCodeType,
+ class FieldArrayType,
+ class RefCountPolicy>
+char const *
+TAO::TypeCode::Struct<StringType,
+ TypeCodeType,
+ FieldArrayType,
+ RefCountPolicy>::member_name_i (
+ CORBA::ULong index
+ ACE_ENV_ARG_DECL) const
+{
+ // Ownership is retained by the TypeCode, as required by the C++
+ // mapping.
+ if (index >= this->nfields_)
+ ACE_THROW_RETURN (CORBA::TypeCode::Bounds (), 0);
+
+ return Traits<StringType>::get_string (this->fields_[index].name);
+}
+
+template <typename StringType,
+ typename TypeCodeType,
+ class FieldArrayType,
+ class RefCountPolicy>
+CORBA::TypeCode_ptr
+TAO::TypeCode::Struct<StringType,
+ TypeCodeType,
+ FieldArrayType,
+ RefCountPolicy>::member_type_i (
+ CORBA::ULong index
+ ACE_ENV_ARG_DECL) const
+{
+ if (index >= this->nfields_)
+ ACE_THROW_RETURN (CORBA::TypeCode::Bounds (),
+ CORBA::TypeCode::_nil ());
+
+ return
+ CORBA::TypeCode::_duplicate (
+ Traits<StringType>::get_typecode (this->fields_[index].type));
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_STRUCT_TYPECODE_CPP */
diff --git a/TAO/tao/AnyTypeCode/Struct_TypeCode.h b/TAO/tao/AnyTypeCode/Struct_TypeCode.h
new file mode 100644
index 00000000000..df44f2d2a3a
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Struct_TypeCode.h
@@ -0,0 +1,158 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Struct_TypeCode.h
+ *
+ * $Id$
+ *
+ * Header file for a @c tk_struct and @c tk_except
+ * @c CORBA::TypeCodes.
+ *
+ * @author Ossama Othman <ossama@dre.vanderbilt.edu>
+ * @author Carlos O'Ryan
+ */
+//=============================================================================
+
+#ifndef TAO_STRUCT_TYPECODE_H
+#define TAO_STRUCT_TYPECODE_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/AnyTypeCode/TypeCode.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/AnyTypeCode/TypeCode_Base_Attributes.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace TypeCode
+ {
+ template<typename StringType, typename TypeCodeType> struct Struct_Field;
+
+ /**
+ * @class Struct
+ *
+ * @brief @c CORBA::TypeCode implementation for an OMG IDL
+ * @c struct or @c exception.
+ *
+ * This class implements a @c CORBA::TypeCode for an OMG IDL
+ * @c struct or @c exception.
+ */
+ template <typename StringType,
+ typename TypeCodeType,
+ class FieldArrayType,
+ class RefCountPolicy>
+ class Struct
+ : public CORBA::TypeCode,
+ private RefCountPolicy
+ {
+ public:
+
+ /// Constructor.
+ Struct (CORBA::TCKind kind,
+ char const * id,
+ char const * name,
+ FieldArrayType const & fields,
+ CORBA::ULong nfields);
+
+ /// Constructor used for recursive TypeCodes.
+ Struct (CORBA::TCKind kind,
+ char const * id);
+
+ /**
+ * @name TAO-specific @c CORBA::TypeCode Methods
+ *
+ * Methods required by TAO's implementation of the
+ * @c CORBA::TypeCode class.
+ *
+ * @see @c CORBA::TypeCode
+ */
+ //@{
+ virtual bool tao_marshal (TAO_OutputCDR & cdr,
+ CORBA::ULong offset) const;
+ virtual void tao_duplicate (void);
+ virtual void tao_release (void);
+ //@}
+
+ protected:
+
+ /**
+ * @name @c TAO CORBA::TypeCode Template Methods
+ *
+ * @c tk_struct or @c tk_except @c CORBA::TypeCode -specific
+ * template methods.
+ *
+ * @see @c CORBA::TypeCode
+ */
+ //@{
+ virtual CORBA::Boolean equal_i (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const;
+ virtual CORBA::Boolean equivalent_i (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const;
+ virtual CORBA::TypeCode_ptr get_compact_typecode_i (
+ ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual char const * id_i (ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual char const * name_i (ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual CORBA::ULong member_count_i (ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual char const * member_name_i (CORBA::ULong index
+ ACE_ENV_ARG_DECL) const;
+ virtual CORBA::TypeCode_ptr member_type_i (CORBA::ULong index
+ ACE_ENV_ARG_DECL) const;
+ //@}
+
+ protected:
+
+ /**
+ * @c Struct Attributes
+ *
+ * Attributes representing the structure of an OMG IDL
+ * @c struct or @c exception.
+ *
+ * @note These attributes are declared in the order in which
+ * they are marshaled into a CDR stream in order to
+ * increase cache hits by improving spatial locality.
+ */
+ //@{
+
+ /// Base attributes containing repository ID and name of
+ /// structure type.
+ Base_Attributes<StringType> base_attributes_;
+
+ /// The number of fields in the OMG IDL structure.
+ CORBA::ULong nfields_;
+
+ /// Array of @c TAO::TypeCode fields representing structure of the
+ /// OMG IDL defined @c struct.
+ FieldArrayType fields_;
+
+ //@}
+
+ };
+
+ } // End namespace TypeCode
+} // End namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#ifdef __ACE_INLINE__
+# include "tao/AnyTypeCode/Struct_TypeCode.inl"
+#endif /* __ACE_INLINE__ */
+
+#ifdef ACE_TEMPLATES_REQUIRE_SOURCE
+# include "tao/AnyTypeCode/Struct_TypeCode.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#ifdef ACE_TEMPLATES_REQUIRE_PRAGMA
+# pragma implementation ("Struct_TypeCode.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_STRUCT_TYPECODE_H */
diff --git a/TAO/tao/AnyTypeCode/Struct_TypeCode.inl b/TAO/tao/AnyTypeCode/Struct_TypeCode.inl
new file mode 100644
index 00000000000..d064338ee22
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Struct_TypeCode.inl
@@ -0,0 +1,50 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template <typename StringType,
+ typename TypeCodeType,
+ class FieldArrayType,
+ class RefCountPolicy>
+ACE_INLINE
+TAO::TypeCode::Struct<StringType,
+ TypeCodeType,
+ FieldArrayType,
+ RefCountPolicy>::Struct (
+ CORBA::TCKind kind,
+ char const * id,
+ char const * name,
+ FieldArrayType const & fields,
+ CORBA::ULong nfields)
+ : ::CORBA::TypeCode (kind)
+ , RefCountPolicy ()
+ , base_attributes_ (id, name)
+ , nfields_ (nfields)
+ , fields_ (fields)
+{
+}
+
+template <typename StringType,
+ typename TypeCodeType,
+ class FieldArrayType,
+ class RefCountPolicy>
+ACE_INLINE
+TAO::TypeCode::Struct<StringType,
+ TypeCodeType,
+ FieldArrayType,
+ RefCountPolicy>::Struct (
+ CORBA::TCKind kind,
+ char const * id)
+ : ::CORBA::TypeCode (kind)
+ , RefCountPolicy ()
+ , base_attributes_ (id)
+ , nfields_ (0)
+ , fields_ ()
+{
+ // CORBA::tk_except is not allowed in the recursive TypeCode case.
+ // ACE_ASSERT (kind == CORBA::tk_struct);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/AnyTypeCode/Struct_TypeCode_Static.cpp b/TAO/tao/AnyTypeCode/Struct_TypeCode_Static.cpp
new file mode 100644
index 00000000000..57e6be6de4e
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Struct_TypeCode_Static.cpp
@@ -0,0 +1,320 @@
+// $Id$
+
+#include "tao/AnyTypeCode/Struct_TypeCode_Static.h"
+#include "tao/AnyTypeCode/TypeCode_Struct_Field.h"
+#include "tao/AnyTypeCode/TypeCode_Traits.h"
+#include "tao/ORB_Core.h"
+#include "tao/TypeCodeFactory_Adapter.h"
+#include "tao/CDR.h"
+
+
+#ifndef __ACE_INLINE__
+# include "tao/AnyTypeCode/Struct_TypeCode_Static.inl"
+#endif /* !__ACE_INLINE__ */
+
+#include "ace/Dynamic_Service.h"
+
+
+ACE_RCSID (AnyTypeCode,
+ Struct_TypeCode_Static,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+bool
+TAO::TypeCode::Struct<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::TypeCode::Struct_Field<char const *,
+ CORBA::TypeCode_ptr const *> const *,
+ TAO::Null_RefCount_Policy>::tao_marshal (
+ TAO_OutputCDR & cdr,
+ CORBA::ULong offset) const
+{
+ // A tk_struct TypeCode has a "complex" parameter list type (see
+ // Table 15-2 in Section 15.3.5.1 "TypeCode" in the CDR section of
+ // the CORBA specification), meaning that it must be marshaled into
+ // a CDR encapsulation.
+
+ // Create a CDR encapsulation.
+ TAO_OutputCDR enc;
+
+ // Account for the encoded CDR encapsulation length and byte order.
+ //
+ // Aligning on an octet since the next value after the CDR
+ // encapsulation length will always be the byte order octet/boolean
+ // in this case.
+ offset = ACE_align_binary (offset + 4,
+ ACE_CDR::OCTET_ALIGN);
+
+ bool const success =
+ (enc << TAO_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER))
+ && (enc << TAO_OutputCDR::from_string (this->base_attributes_.id (), 0))
+ && (enc << TAO_OutputCDR::from_string (this->base_attributes_.name (), 0))
+ && (enc << this->nfields_);
+
+ if (!success)
+ return false;
+
+ Struct_Field<char const *, CORBA::TypeCode_ptr const *> const * const begin =
+ &this->fields_[0];
+ Struct_Field<char const *, CORBA::TypeCode_ptr const *> const * const end =
+ begin + this->nfields_;
+
+ for (Struct_Field<char const *, CORBA::TypeCode_ptr const *> const * i =
+ begin;
+ i != end;
+ ++i)
+ {
+ Struct_Field<char const *, CORBA::TypeCode_ptr const *> const & field =
+ *i;
+
+ if (!(enc << TAO_OutputCDR::from_string (
+ Traits<char const *>::get_string (field.name), 0))
+ || !marshal (enc,
+ Traits<char const *>::get_typecode (field.type),
+ offset + enc.total_length ()))
+ return false;
+ }
+
+ return
+ cdr << static_cast<CORBA::ULong> (enc.total_length ())
+ && cdr.write_octet_array_mb (enc.begin ());
+}
+
+void
+TAO::TypeCode::Struct<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::TypeCode::Struct_Field<char const *,
+ CORBA::TypeCode_ptr const *> const *,
+ TAO::Null_RefCount_Policy>::tao_duplicate (void)
+{
+}
+
+void
+TAO::TypeCode::Struct<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::TypeCode::Struct_Field<char const *,
+ CORBA::TypeCode_ptr const *> const *,
+ TAO::Null_RefCount_Policy>::tao_release (void)
+{
+}
+
+CORBA::Boolean
+TAO::TypeCode::Struct<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::TypeCode::Struct_Field<char const *,
+ CORBA::TypeCode_ptr const *> const *,
+ TAO::Null_RefCount_Policy>::equal_i (
+ CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const
+{
+ // This call shouldn't throw since CORBA::TypeCode::equal() verified
+ // that the TCKind is the same as our's prior to invoking this
+ // method, meaning that member_count() is supported.
+
+ CORBA::ULong const tc_nfields =
+ tc->member_count (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ if (tc_nfields != this->nfields_)
+ return false;
+
+ for (CORBA::ULong i = 0; i < this->nfields_; ++i)
+ {
+ Struct_Field<char const *, CORBA::TypeCode_ptr const *> const &
+ lhs_field = this->fields_[i];
+
+ char const * const lhs_name =
+ Traits<char const *>::get_string (lhs_field.name);
+ char const * const rhs_name = tc->member_name (i
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ if (ACE_OS::strcmp (lhs_name, rhs_name) != 0)
+ return false;
+
+ CORBA::TypeCode_ptr const lhs_tc =
+ Traits<char const *>::get_typecode (lhs_field.type);
+ CORBA::TypeCode_var const rhs_tc =
+ tc->member_type (i
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ CORBA::Boolean const equal_members =
+ lhs_tc->equal (rhs_tc.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ if (!equal_members)
+ return false;
+ }
+
+ return true;
+}
+
+CORBA::Boolean
+TAO::TypeCode::Struct<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::TypeCode::Struct_Field<char const *,
+ CORBA::TypeCode_ptr const *> const *,
+ TAO::Null_RefCount_Policy>::equivalent_i (
+ CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const
+{
+ // Perform a structural comparison, excluding the name() and
+ // member_name() operations.
+
+ CORBA::ULong const tc_nfields =
+ tc->member_count (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ if (tc_nfields != this->nfields_)
+ return false;
+
+ for (CORBA::ULong i = 0; i < this->nfields_; ++i)
+ {
+ CORBA::TypeCode_ptr const lhs =
+ Traits<char const *>::get_typecode (this->fields_[i].type);
+ CORBA::TypeCode_var const rhs =
+ tc->member_type (i
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ CORBA::Boolean const equiv_members =
+ lhs->equivalent (rhs.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ if (!equiv_members)
+ return false;
+ }
+
+ return true;
+}
+
+CORBA::TypeCode_ptr
+TAO::TypeCode::Struct<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::TypeCode::Struct_Field<char const *,
+ CORBA::TypeCode_ptr const *> const *,
+ TAO::Null_RefCount_Policy>::get_compact_typecode_i (
+ ACE_ENV_SINGLE_ARG_DECL) const
+{
+ ACE_Array_Base<Struct_Field<CORBA::String_var,
+ CORBA::TypeCode_var> >
+ tc_fields (this->nfields_);
+
+ if (this->nfields_ > 0)
+ {
+ // Dynamically construct a new array of fields stripped of
+ // member names.
+
+ static char const empty_name[] = "";
+
+ for (CORBA::ULong i = 0; i < this->nfields_; ++i)
+ {
+ // Member names will be stripped, i.e. not embedded within
+ // the compact TypeCode.
+
+ tc_fields[i].name = empty_name;
+ tc_fields[i].type =
+ Traits<char const *>::get_typecode (
+ this->fields_[i].type)->get_compact_typecode (
+ ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::TypeCode::_nil ());
+ }
+ }
+
+ TAO_TypeCodeFactory_Adapter * const adapter =
+ ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance (
+ TAO_ORB_Core::typecodefactory_adapter_name ());
+
+ if (adapter == 0)
+ {
+ ACE_THROW_RETURN (CORBA::INTERNAL (),
+ CORBA::TypeCode::_nil ());
+ }
+
+ return
+ adapter->create_struct_except_tc (this->kind_,
+ this->base_attributes_.id (),
+ "" /* empty name */,
+ tc_fields,
+ this->nfields_
+ ACE_ENV_ARG_PARAMETER);
+}
+
+char const *
+TAO::TypeCode::Struct<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::TypeCode::Struct_Field<char const *,
+ CORBA::TypeCode_ptr const *> const *,
+ TAO::Null_RefCount_Policy>::id_i (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED) const
+{
+ // Ownership is retained by the TypeCode, as required by the C++
+ // mapping.
+ return this->base_attributes_.id ();
+}
+
+char const *
+TAO::TypeCode::Struct<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::TypeCode::Struct_Field<char const *,
+ CORBA::TypeCode_ptr const *> const *,
+ TAO::Null_RefCount_Policy>::name_i (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED) const
+{
+ // Ownership is retained by the TypeCode, as required by the C++
+ // mapping.
+ return this->base_attributes_.name ();
+}
+
+CORBA::ULong
+TAO::TypeCode::Struct<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::TypeCode::Struct_Field<char const *,
+ CORBA::TypeCode_ptr const *> const *,
+ TAO::Null_RefCount_Policy>::member_count_i (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED) const
+{
+ return this->nfields_;
+}
+
+char const *
+TAO::TypeCode::Struct<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::TypeCode::Struct_Field<char const *,
+ CORBA::TypeCode_ptr const *> const *,
+ TAO::Null_RefCount_Policy>::member_name_i (
+ CORBA::ULong index
+ ACE_ENV_ARG_DECL) const
+{
+ // Ownership is retained by the TypeCode, as required by the C++
+ // mapping.
+ if (index >= this->nfields_)
+ ACE_THROW_RETURN (CORBA::TypeCode::Bounds (), 0);
+
+ return Traits<char const *>::get_string (this->fields_[index].name);
+}
+
+CORBA::TypeCode_ptr
+TAO::TypeCode::Struct<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::TypeCode::Struct_Field<char const *,
+ CORBA::TypeCode_ptr const *> const *,
+ TAO::Null_RefCount_Policy>::member_type_i (
+ CORBA::ULong index
+ ACE_ENV_ARG_DECL) const
+{
+ if (index >= this->nfields_)
+ ACE_THROW_RETURN (CORBA::TypeCode::Bounds (),
+ CORBA::TypeCode::_nil ());
+
+ return
+ CORBA::TypeCode::_duplicate (
+ Traits<char const *>::get_typecode (this->fields_[index].type));
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/AnyTypeCode/Struct_TypeCode_Static.h b/TAO/tao/AnyTypeCode/Struct_TypeCode_Static.h
new file mode 100644
index 00000000000..dea9405238b
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Struct_TypeCode_Static.h
@@ -0,0 +1,154 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Struct_TypeCode_Static.h
+ *
+ * $Id$
+ *
+ * Header file for static @c tk_struct and @c tk_except
+ * @c CORBA::TypeCodes.
+ *
+ * @author Ossama Othman <ossama@dre.vanderbilt.edu>
+ * @author Carlos O'Ryan
+ */
+//=============================================================================
+
+#ifndef TAO_STRUCT_TYPECODE_STATIC_H
+#define TAO_STRUCT_TYPECODE_STATIC_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/AnyTypeCode/TypeCode.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/AnyTypeCode/TypeCode_Base_Attributes.h"
+#include "tao/AnyTypeCode/Null_RefCount_Policy.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace TypeCode
+ {
+ template<typename StringType, typename TypeCodeType> struct Struct_Field;
+ template <typename StringType,
+ typename TypeCodeType,
+ class FieldArrayType,
+ class RefCountPolicy> class Struct;
+
+
+ /**
+ * @class Struct
+ *
+ * @brief @c CORBA::TypeCode implementation for an OMG IDL
+ * @c struct or @c exception.
+ *
+ * This class implements a @c CORBA::TypeCode for an OMG IDL
+ * @c struct or @c exception.
+ */
+ template<>
+ class TAO_AnyTypeCode_Export Struct<char const *,
+ CORBA::TypeCode_ptr const *,
+ Struct_Field<char const *,
+ CORBA::TypeCode_ptr const *> const *,
+ TAO::Null_RefCount_Policy>
+ : public CORBA::TypeCode,
+ private TAO::Null_RefCount_Policy
+ {
+ public:
+
+ /// Constructor.
+ Struct (CORBA::TCKind kind,
+ char const * id,
+ char const * name,
+ Struct_Field<char const *,
+ CORBA::TypeCode_ptr const *> const * fields,
+ CORBA::ULong nfields);
+
+ /**
+ * @name TAO-specific @c CORBA::TypeCode Methods
+ *
+ * Methods required by TAO's implementation of the
+ * @c CORBA::TypeCode class.
+ *
+ * @see @c CORBA::TypeCode
+ */
+ //@{
+ virtual bool tao_marshal (TAO_OutputCDR & cdr,
+ CORBA::ULong offset) const;
+ virtual void tao_duplicate (void);
+ virtual void tao_release (void);
+ //@}
+
+ protected:
+
+ /**
+ * @name @c TAO CORBA::TypeCode Template Methods
+ *
+ * @c tk_struct or @c tk_except @c CORBA::TypeCode -specific
+ * template methods.
+ *
+ * @see @c CORBA::TypeCode
+ */
+ //@{
+ virtual CORBA::Boolean equal_i (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const;
+ virtual CORBA::Boolean equivalent_i (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const;
+ virtual CORBA::TypeCode_ptr get_compact_typecode_i (
+ ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual char const * id_i (ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual char const * name_i (ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual CORBA::ULong member_count_i (ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual char const * member_name_i (CORBA::ULong index
+ ACE_ENV_ARG_DECL) const;
+ virtual CORBA::TypeCode_ptr member_type_i (CORBA::ULong index
+ ACE_ENV_ARG_DECL) const;
+ //@}
+
+ private:
+
+ /**
+ * @c Struct Attributes
+ *
+ * Attributes representing the structure of an OMG IDL
+ * @c struct or @c exception.
+ *
+ * @note These attributes are declared in the order in which
+ * they are marshaled into a CDR stream in order to
+ * increase cache hits by improving spatial locality.
+ */
+ //@{
+
+ /// Base attributes containing repository ID and name of
+ /// structure type.
+ Base_Attributes<char const *> const base_attributes_;
+
+ /// The number of fields in the OMG IDL structure.
+ CORBA::ULong const nfields_;
+
+ /// Array of @c TAO::TypeCode fields representing structure of the
+ /// OMG IDL defined @c struct.
+ Struct_Field<char const *,
+ CORBA::TypeCode_ptr const *> const * const fields_;
+
+ //@}
+
+ };
+
+ } // End namespace TypeCode
+} // End namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#ifdef __ACE_INLINE__
+# include "tao/AnyTypeCode/Struct_TypeCode_Static.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_STRUCT_TYPECODE_H */
diff --git a/TAO/tao/AnyTypeCode/Struct_TypeCode_Static.inl b/TAO/tao/AnyTypeCode/Struct_TypeCode_Static.inl
new file mode 100644
index 00000000000..7b2d60faa3f
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Struct_TypeCode_Static.inl
@@ -0,0 +1,26 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO::TypeCode::Struct<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::TypeCode::Struct_Field<char const *,
+ CORBA::TypeCode_ptr const *> const *,
+ TAO::Null_RefCount_Policy>::Struct (
+ CORBA::TCKind kind,
+ char const * id,
+ char const * name,
+ Struct_Field<char const *, CORBA::TypeCode_ptr const *> const * fields,
+ CORBA::ULong nfields)
+ : ::CORBA::TypeCode (kind)
+ , ::TAO::Null_RefCount_Policy ()
+ , base_attributes_ (id, name)
+ , nfields_ (nfields)
+ , fields_ (fields)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/AnyTypeCode/SystemExceptionA.cpp b/TAO/tao/AnyTypeCode/SystemExceptionA.cpp
new file mode 100644
index 00000000000..61aa6cd380f
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/SystemExceptionA.cpp
@@ -0,0 +1,185 @@
+// $Id$
+
+#include "tao/AnyTypeCode/SystemExceptionA.h"
+#include "tao/AnyTypeCode/Any_SystemException.h"
+#include "tao/AnyTypeCode/Any_Dual_Impl_T.h"
+#include "tao/AnyTypeCode/TypeCode.h"
+#include "tao/AnyTypeCode/TypeCode_Constants.h"
+#include "tao/AnyTypeCode/Enum_TypeCode_Static.h"
+#include "tao/AnyTypeCode/TypeCode_Struct_Field.h"
+#include "tao/AnyTypeCode/Struct_TypeCode_Static.h"
+#include "tao/AnyTypeCode/Null_RefCount_Policy.h"
+
+#include "tao/CORBA_String.h"
+
+ACE_RCSID (AnyTypeCode,
+ SystemExceptionA,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+#if defined (THREAD_CANCELLED)
+#undef THREAD_CANCELLED
+#endif /* THREAD_CANCELLED */
+
+// List of standard/system exceptions ... used to create static
+// storage for their typecodes.
+
+#define STANDARD_EXCEPTION_LIST \
+ TAO_SYSTEM_EXCEPTION (UNKNOWN) \
+ TAO_SYSTEM_EXCEPTION (BAD_PARAM) \
+ TAO_SYSTEM_EXCEPTION (NO_MEMORY) \
+ TAO_SYSTEM_EXCEPTION (IMP_LIMIT) \
+ TAO_SYSTEM_EXCEPTION (COMM_FAILURE) \
+ TAO_SYSTEM_EXCEPTION (INV_OBJREF) \
+ TAO_SYSTEM_EXCEPTION (OBJECT_NOT_EXIST) \
+ TAO_SYSTEM_EXCEPTION (NO_PERMISSION) \
+ TAO_SYSTEM_EXCEPTION (INTERNAL) \
+ TAO_SYSTEM_EXCEPTION (MARSHAL) \
+ TAO_SYSTEM_EXCEPTION (INITIALIZE) \
+ TAO_SYSTEM_EXCEPTION (NO_IMPLEMENT) \
+ TAO_SYSTEM_EXCEPTION (BAD_TYPECODE) \
+ TAO_SYSTEM_EXCEPTION (BAD_OPERATION) \
+ TAO_SYSTEM_EXCEPTION (NO_RESOURCES) \
+ TAO_SYSTEM_EXCEPTION (NO_RESPONSE) \
+ TAO_SYSTEM_EXCEPTION (PERSIST_STORE) \
+ TAO_SYSTEM_EXCEPTION (BAD_INV_ORDER) \
+ TAO_SYSTEM_EXCEPTION (TRANSIENT) \
+ TAO_SYSTEM_EXCEPTION (FREE_MEM) \
+ TAO_SYSTEM_EXCEPTION (INV_IDENT) \
+ TAO_SYSTEM_EXCEPTION (INV_FLAG) \
+ TAO_SYSTEM_EXCEPTION (INTF_REPOS) \
+ TAO_SYSTEM_EXCEPTION (BAD_CONTEXT) \
+ TAO_SYSTEM_EXCEPTION (OBJ_ADAPTER) \
+ TAO_SYSTEM_EXCEPTION (DATA_CONVERSION) \
+ TAO_SYSTEM_EXCEPTION (INV_POLICY) \
+ TAO_SYSTEM_EXCEPTION (REBIND) \
+ TAO_SYSTEM_EXCEPTION (TIMEOUT) \
+ TAO_SYSTEM_EXCEPTION (TRANSACTION_UNAVAILABLE) \
+ TAO_SYSTEM_EXCEPTION (TRANSACTION_MODE) \
+ TAO_SYSTEM_EXCEPTION (TRANSACTION_REQUIRED) \
+ TAO_SYSTEM_EXCEPTION (TRANSACTION_ROLLEDBACK) \
+ TAO_SYSTEM_EXCEPTION (INVALID_TRANSACTION) \
+ TAO_SYSTEM_EXCEPTION (CODESET_INCOMPATIBLE) \
+ TAO_SYSTEM_EXCEPTION (BAD_QOS) \
+ TAO_SYSTEM_EXCEPTION (INVALID_ACTIVITY) \
+ TAO_SYSTEM_EXCEPTION (ACTIVITY_COMPLETED) \
+ TAO_SYSTEM_EXCEPTION (ACTIVITY_REQUIRED) \
+ TAO_SYSTEM_EXCEPTION (THREAD_CANCELLED)
+
+namespace TAO
+{
+ namespace TypeCode
+ {
+ char const * const enumerators_CORBA_CompletionStatus[] =
+ {
+ "COMPLETED_YES",
+ "COMPLETED_NO",
+ "COMPLETED_MAYBE"
+ };
+
+ Enum<char const *,
+ char const * const *,
+ TAO::Null_RefCount_Policy>
+ tc_CompletionStatus ("IDL:omg.org/CORBA/CompletionStatus:1.0",
+ "CompletionStatus",
+ enumerators_CORBA_CompletionStatus,
+ 3 /* # of enumerators */);
+ }
+}
+
+namespace CORBA
+{
+ // An internal TypeCode.
+ TypeCode_ptr const _tc_CompletionStatus =
+ &TAO::TypeCode::tc_CompletionStatus;
+}
+
+namespace TAO
+{
+ namespace TypeCode
+ {
+ Struct_Field<char const *,
+ CORBA::TypeCode_ptr const *> const
+ fields_CORBA_SystemException[] =
+ {
+ { "minor", &CORBA::_tc_ulong },
+ { "completed", &CORBA::_tc_CompletionStatus }
+ };
+
+ typedef TAO::TypeCode::Struct<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::TypeCode::Struct_Field<char const *,
+ CORBA::TypeCode_ptr const *> const *,
+ TAO::Null_RefCount_Policy> tc_SystemException;
+ }
+}
+
+#define TAO_SYSTEM_EXCEPTION(name) \
+namespace TAO \
+{ \
+ namespace TypeCode \
+ { \
+ tc_SystemException tc_CORBA_ ## name ( \
+ CORBA::tk_except, \
+ "IDL:omg.org/CORBA/" #name ":1.0", \
+ #name, \
+ TAO::TypeCode::fields_CORBA_SystemException, \
+ 2 /* # of fields */); \
+ } \
+} \
+CORBA::TypeCode_ptr const CORBA::_tc_ ## name = \
+ &TAO::TypeCode::tc_CORBA_ ## name;
+
+STANDARD_EXCEPTION_LIST
+#undef TAO_SYSTEM_EXCEPTION
+
+
+#define TAO_SYSTEM_EXCEPTION(name) \
+void \
+CORBA::operator<<= (CORBA::Any &any, const CORBA::name &ex) \
+{ \
+ TAO::Any_SystemException::insert_copy ( \
+ any, \
+ CORBA::name ::_tao_any_destructor, \
+ CORBA::_tc_ ## name, \
+ ex \
+ ); \
+}
+
+STANDARD_EXCEPTION_LIST
+#undef TAO_SYSTEM_EXCEPTION
+
+#define TAO_SYSTEM_EXCEPTION(name) \
+void \
+CORBA::operator<<= (CORBA::Any &any, CORBA::name *ex) \
+{ \
+ TAO::Any_SystemException::insert ( \
+ any, \
+ CORBA::name ::_tao_any_destructor, \
+ CORBA::_tc_ ## name, \
+ ex \
+ ); \
+}
+
+STANDARD_EXCEPTION_LIST
+#undef TAO_SYSTEM_EXCEPTION
+
+#define TAO_SYSTEM_EXCEPTION(name) \
+CORBA::Boolean operator>>= (const CORBA::Any &any, \
+ const CORBA::name *&ex) \
+{ \
+ return \
+ TAO::Any_SystemException::extract ( \
+ any, \
+ CORBA::name ::_tao_any_destructor, \
+ CORBA::_tc_ ## name, \
+ (const CORBA::SystemException *&) ex, \
+ &CORBA::name ::_tao_create); \
+}
+
+STANDARD_EXCEPTION_LIST
+#undef TAO_SYSTEM_EXCEPTION
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/AnyTypeCode/SystemExceptionA.h b/TAO/tao/AnyTypeCode/SystemExceptionA.h
new file mode 100644
index 00000000000..b6ca62d2e55
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/SystemExceptionA.h
@@ -0,0 +1,93 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file SystemExceptionA.h
+ *
+ * $Id$
+ *
+ * SystemException Any operator and typecode decls.
+ *
+ * @author Jeff Parsons <j.parsons@vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_SYSTEMEXCEPTIONA_H
+#define TAO_SYSTEMEXCEPTIONA_H
+
+#include /**/ "ace/pre.h"
+#include "tao/AnyTypeCode/TAO_AnyTypeCode_Export.h"
+#include "tao/AnyTypeCode/AnyTypeCode_methods.h"
+#include "tao/SystemException.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace CORBA
+{
+ class TypeCode;
+ typedef TypeCode *TypeCode_ptr;
+
+ class Any;
+ typedef Any *Any_ptr;
+
+#define TAO_SYSTEM_EXCEPTION(name) \
+ TAO_AnyTypeCode_Export void operator<<= (CORBA::Any &, \
+ const CORBA::name &); \
+ TAO_AnyTypeCode_Export void operator<<= (CORBA::Any &, \
+ CORBA::name *); \
+ TAO_AnyTypeCode_Export CORBA::Boolean operator>>= (const CORBA::Any &, \
+ const CORBA::name *&); \
+ extern TAO_AnyTypeCode_Export TypeCode_ptr const _tc_ ## name
+
+ TAO_SYSTEM_EXCEPTION(UNKNOWN); // the unknown exception
+ TAO_SYSTEM_EXCEPTION(BAD_PARAM); // an invalid parameter was passed
+ TAO_SYSTEM_EXCEPTION(NO_MEMORY); // memory allocation failure
+ TAO_SYSTEM_EXCEPTION(IMP_LIMIT); // violated implementation limit
+ TAO_SYSTEM_EXCEPTION(COMM_FAILURE); // communication failure
+ TAO_SYSTEM_EXCEPTION(INV_OBJREF); // invalid object reference
+ TAO_SYSTEM_EXCEPTION(OBJECT_NOT_EXIST); // no such object
+ TAO_SYSTEM_EXCEPTION(NO_PERMISSION); // no permission for operation
+ TAO_SYSTEM_EXCEPTION(INTERNAL); // ORB internal error
+ TAO_SYSTEM_EXCEPTION(MARSHAL); // error marshaling param/result
+ TAO_SYSTEM_EXCEPTION(INITIALIZE); // ORB initialization failure
+ TAO_SYSTEM_EXCEPTION(NO_IMPLEMENT); // implementation unavailable
+ TAO_SYSTEM_EXCEPTION(BAD_TYPECODE); // bad typecode
+ TAO_SYSTEM_EXCEPTION(BAD_OPERATION); // invalid operation
+ TAO_SYSTEM_EXCEPTION(NO_RESOURCES); // out of resources for request
+ TAO_SYSTEM_EXCEPTION(NO_RESPONSE); // response not yet available
+ TAO_SYSTEM_EXCEPTION(PERSIST_STORE); // persistent storage failure
+ TAO_SYSTEM_EXCEPTION(BAD_INV_ORDER); // routine invocations out of order
+ TAO_SYSTEM_EXCEPTION(TRANSIENT); // transient error, try again later
+ TAO_SYSTEM_EXCEPTION(FREE_MEM); // cannot free memory
+ TAO_SYSTEM_EXCEPTION(INV_IDENT); // invalid identifier syntax
+ TAO_SYSTEM_EXCEPTION(INV_FLAG); // invalid flag was specified
+ TAO_SYSTEM_EXCEPTION(INTF_REPOS); // interface repository unavailable
+ TAO_SYSTEM_EXCEPTION(BAD_CONTEXT); // error processing context object
+ TAO_SYSTEM_EXCEPTION(OBJ_ADAPTER); // object adapter failure
+ TAO_SYSTEM_EXCEPTION(DATA_CONVERSION); // data conversion error
+ TAO_SYSTEM_EXCEPTION(INV_POLICY); // invalid policies present
+ TAO_SYSTEM_EXCEPTION(REBIND); // rebind needed
+ TAO_SYSTEM_EXCEPTION(TIMEOUT); // operation timed out
+ TAO_SYSTEM_EXCEPTION(TRANSACTION_UNAVAILABLE); // no transaction
+ TAO_SYSTEM_EXCEPTION(TRANSACTION_MODE); // invalid transaction mode
+ TAO_SYSTEM_EXCEPTION(TRANSACTION_REQUIRED); // operation needs transaction
+ TAO_SYSTEM_EXCEPTION(TRANSACTION_ROLLEDBACK); // operation was a no-op
+ TAO_SYSTEM_EXCEPTION(INVALID_TRANSACTION); // invalid TP context passed
+ TAO_SYSTEM_EXCEPTION(CODESET_INCOMPATIBLE); // incompatible code set
+ TAO_SYSTEM_EXCEPTION(BAD_QOS); // bad quality of service
+ TAO_SYSTEM_EXCEPTION(INVALID_ACTIVITY);
+ TAO_SYSTEM_EXCEPTION(ACTIVITY_COMPLETED);
+ TAO_SYSTEM_EXCEPTION(ACTIVITY_REQUIRED);
+ TAO_SYSTEM_EXCEPTION(THREAD_CANCELLED);
+
+#undef TAO_SYSTEM_EXCEPTION
+
+} // End CORBA namespace
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_SYSTEMEXCEPTIONA_H */
+
+
diff --git a/TAO/tao/AnyTypeCode/TAO_AnyTypeCode.pc.in b/TAO/tao/AnyTypeCode/TAO_AnyTypeCode.pc.in
new file mode 100644
index 00000000000..3e73594ee47
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/TAO_AnyTypeCode.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: TAO_AnyTypeCode
+Description: TAO AnyTypeCode Library
+Requires: TAO
+Version: @VERSION@
+Libs: -L${libdir} -lTAO_AnyTypeCode
+Cflags: -I${includedir}
diff --git a/TAO/tao/AnyTypeCode/TAO_AnyTypeCode_Export.h b/TAO/tao/AnyTypeCode/TAO_AnyTypeCode_Export.h
new file mode 100644
index 00000000000..4767016fbcc
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/TAO_AnyTypeCode_Export.h
@@ -0,0 +1,40 @@
+
+// -*- C++ -*-
+// $Id$
+// Definition for Win32 Export directives.
+// This file is generated automatically by generate_export_file.pl
+// ------------------------------
+#ifndef TAO_ANYTYPECODE_EXPORT_H
+#define TAO_ANYTYPECODE_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if defined (TAO_AS_STATIC_LIBS)
+# if !defined (TAO_ANYTYPECODE_HAS_DLL)
+# define TAO_ANYTYPECODE_HAS_DLL 0
+# endif /* ! TAO_ANYTYPECODE_HAS_DLL */
+#else
+# if !defined (TAO_ANYTYPECODE_HAS_DLL)
+# define TAO_ANYTYPECODE_HAS_DLL 1
+# endif /* ! TAO_ANYTYPECODE_HAS_DLL */
+#endif
+
+#if defined (TAO_ANYTYPECODE_HAS_DLL) && (TAO_ANYTYPECODE_HAS_DLL == 1)
+# if defined (TAO_ANYTYPECODE_BUILD_DLL)
+# define TAO_AnyTypeCode_Export ACE_Proper_Export_Flag
+# define TAO_ANYTYPECODE_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# define TAO_ANYTYPECODE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# else /* TAO_ANYTYPECODE_BUILD_DLL */
+# define TAO_AnyTypeCode_Export ACE_Proper_Import_Flag
+# define TAO_ANYTYPECODE_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# define TAO_ANYTYPECODE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# endif /* TAO_ANYTYPECODE_BUILD_DLL */
+#else /* TAO_ANYTYPECODE_HAS_DLL == 1 */
+# define TAO_AnyTypeCode_Export
+# define TAO_ANYTYPECODE_SINGLETON_DECLARATION(T)
+# define TAO_ANYTYPECODE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+#endif /* TAO_ANYTYPECODE_HAS_DLL == 1 */
+
+#endif /* TAO_ANYTYPECODE_EXPORT_H */
+
+// End of auto generated file.
diff --git a/TAO/tao/AnyTypeCode/TC_Constants_Forward.h b/TAO/tao/AnyTypeCode/TC_Constants_Forward.h
new file mode 100644
index 00000000000..e0d8853654d
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/TC_Constants_Forward.h
@@ -0,0 +1,20 @@
+// -*- C++ -*-
+
+// -------------------------------------------------------------
+/**
+ * @file TC_Constants_Forward.h
+ *
+ * $Id$
+ *
+ * Backward compatibility header.
+ *
+ * @deprecated Use TypeCode_Constants.h instead.
+ */
+// -------------------------------------------------------------
+
+#ifndef TAO_TC_CONSTANTS_FORWARD_H
+#define TAO_TC_CONSTANTS_FORWARD_H
+
+#include "tao/AnyTypeCode/TypeCode_Constants.h"
+
+#endif /* TAO_TC_CONSTANTS_FORWARD_H */
diff --git a/TAO/tao/AnyTypeCode/True_RefCount_Policy.cpp b/TAO/tao/AnyTypeCode/True_RefCount_Policy.cpp
new file mode 100644
index 00000000000..7c88dcd4577
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/True_RefCount_Policy.cpp
@@ -0,0 +1,20 @@
+// $Id$
+
+#include "tao/AnyTypeCode/True_RefCount_Policy.h"
+
+#ifndef __ACE_INLINE__
+# include "True_RefCount_Policy.inl"
+#endif /* !__ACE_INLINE__ */
+
+
+ACE_RCSID (AnyTypeCode,
+ True_RefCount_Policy,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO::True_RefCount_Policy::~True_RefCount_Policy (void)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/AnyTypeCode/True_RefCount_Policy.h b/TAO/tao/AnyTypeCode/True_RefCount_Policy.h
new file mode 100644
index 00000000000..6bef507fae0
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/True_RefCount_Policy.h
@@ -0,0 +1,119 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file True_RefCount_Policy.h
+ *
+ * $Id$
+ *
+ * Header file for TAO's true reference count policy (unrelated to
+ * CORBA policies).
+ *
+ * @author Ossama Othman <ossama@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_TRUE_REFCOUNT_POLICY_H
+#define TAO_TRUE_REFCOUNT_POLICY_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/AnyTypeCode/TAO_AnyTypeCode_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/orbconf.h"
+
+#include "ace/Thread_Mutex.h"
+#include "ace/Atomic_Op.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ /**
+ * @class True_RefCount_Policy
+ *
+ * @brief True reference counting policy.
+ *
+ * This class is intended to be used as a "policy" argument to a
+ * host class template that requires true/functional reference
+ * counting. That class would then inherit privately from it like
+ * so:
+ *
+ * @code
+ * template <class RefCountPolicy>
+ * class MyHostClass : private RefCountPolicy
+ * {
+ * public:
+ * void my_add_ref (void) { this->RefCountPolicy::add_ref (); }
+ * void my_remove_ref (void) { this->RefCountPolicy::remove_ref (); }
+ * };
+ * @endcode
+ *
+ * and use it like so:
+ *
+ * @code
+ * typedef MyHostClass<TAO::True_RefCount_Policy> MyRefCountedClass;
+ * MyRefCountedClass * p = new MyRefCountedClass;
+ * ...
+ * p->my_remove_ref ();
+ * @endcode
+ *
+ * @note Ideally, the host class should declare a protected
+ * destructor to enforce proper memory management through the
+ * reference counting mechanism, i.e. to prevent clients from
+ * calling @c operator @c delete() directly on the host class
+ * object.
+ */
+ class TAO_AnyTypeCode_Export True_RefCount_Policy
+ {
+ public:
+
+ /// Increase the reference count on this object.
+ void add_ref (void);
+
+ /// Decrease the reference count on this object.
+ /**
+ * Decrease the reference count on this object. Once the
+ * reference count drops to zero, call @c operator @c delete()
+ * on this object.
+ */
+ void remove_ref (void);
+
+ protected:
+
+ /// Constructor.
+ /**
+ * @note This constructor is protected since it not meant to be
+ * instantiated/used as a standalone object.
+ */
+ True_RefCount_Policy (void);
+
+ /// Destructor.
+ /**
+ * @note The destructor must be virtual to ensure that subclass
+ * destructors are called when the reference count drops to
+ * zero, i.e. when @c remove_ref() calls @c operator
+ * @c delete @c this.
+ */
+ virtual ~True_RefCount_Policy (void);
+
+ private:
+ /// Reference counter.
+ ACE_Atomic_Op<TAO_SYNCH_MUTEX, unsigned long> refcount_;
+ };
+
+} // End namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#ifdef __ACE_INLINE__
+# include "tao/AnyTypeCode/True_RefCount_Policy.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_TRUE_REFCOUNT_POLICY_H */
diff --git a/TAO/tao/AnyTypeCode/True_RefCount_Policy.inl b/TAO/tao/AnyTypeCode/True_RefCount_Policy.inl
new file mode 100644
index 00000000000..db9631237de
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/True_RefCount_Policy.inl
@@ -0,0 +1,28 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO::True_RefCount_Policy::True_RefCount_Policy (void)
+ : refcount_ (1)
+{
+}
+
+ACE_INLINE void
+TAO::True_RefCount_Policy::add_ref (void)
+{
+ ++this->refcount_;
+}
+
+ACE_INLINE void
+TAO::True_RefCount_Policy::remove_ref (void)
+{
+ const unsigned long new_count = --this->refcount_;
+
+ if (new_count == 0)
+ delete this;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/AnyTypeCode/TypeCode.cpp b/TAO/tao/AnyTypeCode/TypeCode.cpp
new file mode 100644
index 00000000000..596b4484cac
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/TypeCode.cpp
@@ -0,0 +1,489 @@
+// $Id$
+
+#include "tao/AnyTypeCode/TypeCode.h"
+
+ACE_RCSID (AnyTypeCode,
+ TypeCode,
+ "$Id$")
+
+
+#if !defined (__ACE_INLINE__)
+# include "tao/AnyTypeCode/TypeCode.inl"
+#endif /* ! __ACE_INLINE__ */
+
+#include "tao/SystemException.h"
+#include "tao/CDR.h"
+#include "tao/ORB_Constants.h"
+#include "tao/debug.h"
+
+#include "ace/OS_NS_string.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+CORBA::TypeCode::~TypeCode (void)
+{
+}
+
+bool
+CORBA::TypeCode::tao_marshal_kind (TAO_OutputCDR & cdr) const
+{
+ return cdr << this->kind_;
+}
+
+CORBA::Boolean
+CORBA::TypeCode::equal (TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const
+{
+ if (this == tc)
+ {
+ return true;
+ }
+ else if (CORBA::is_nil (tc))
+ {
+ ACE_THROW_RETURN (CORBA::BAD_PARAM (CORBA::OMGVMCID | 13,
+ CORBA::COMPLETED_NO),
+ false);
+ }
+
+ CORBA::TCKind const tc_kind = tc->kind (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ if (tc_kind != this->kind_)
+ return 0;
+
+ ACE_TRY
+ {
+ char const * const tc_id = tc->id (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ char const * const this_id = this->id (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (ACE_OS::strcmp (this_id, tc_id) != 0)
+ return 0;
+
+ char const * const tc_name = tc->name (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ char const * const this_name = this->name (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (ACE_OS::strcmp (this_name, tc_name) != 0)
+ return 0;
+ }
+ ACE_CATCH (CORBA::TypeCode::BadKind, ex)
+ {
+ // Some TypeCodes do not support the id() and name()
+ // operations. Ignore the failure, and continue equality
+ // verification using TypeCode subclass-specific techniques
+ // below.
+ }
+ ACE_ENDTRY;
+ ACE_CHECK_RETURN (0);
+
+ return this->equal_i (tc
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::Boolean
+CORBA::TypeCode::equivalent (TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const
+{
+ if (this == tc)
+ {
+ return true;
+ }
+ else if (CORBA::is_nil (tc))
+ {
+ ACE_THROW_RETURN (CORBA::BAD_PARAM (CORBA::OMGVMCID | 13,
+ CORBA::COMPLETED_NO),
+ false);
+ }
+
+ CORBA::TypeCode_ptr const mutable_this =
+ const_cast<CORBA::TypeCode_ptr> (this);
+
+ CORBA::TypeCode_var unaliased_this =
+ TAO::unaliased_typecode (mutable_this
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ CORBA::TypeCode_var unaliased_tc =
+ TAO::unaliased_typecode (tc
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+
+ CORBA::TCKind const this_kind =
+ unaliased_this->kind (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ CORBA::TCKind const tc_kind =
+ unaliased_tc->kind (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ if (tc_kind != this_kind)
+ return false;
+
+ ACE_TRY
+ {
+ char const * const this_id =
+ unaliased_this->id (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ char const * const tc_id =
+ unaliased_tc->id (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (ACE_OS::strlen (this_id) == 0
+ || ACE_OS::strlen (tc_id) == 0)
+ {
+ return unaliased_this->equivalent_i (unaliased_tc.in ()
+ ACE_ENV_ARG_PARAMETER);
+ }
+ else if (ACE_OS::strcmp (this_id, tc_id) != 0)
+ {
+ return false;
+ }
+ }
+ ACE_CATCH (CORBA::TypeCode::BadKind, ex)
+ {
+ // Some TypeCodes do not support the id() operation. Ignore the
+ // failure, and continue equivalence verification using TypeCode
+ // subclass-specific techniques.
+ return unaliased_this->equivalent_i (unaliased_tc.in ()
+ ACE_ENV_ARG_PARAMETER);
+ }
+ ACE_ENDTRY;
+ ACE_CHECK_RETURN (false);
+
+ return true;
+}
+
+char const *
+CORBA::TypeCode::id_i (ACE_ENV_SINGLE_ARG_DECL) const
+{
+ ACE_THROW_RETURN (CORBA::TypeCode::BadKind (), 0);
+}
+
+char const *
+CORBA::TypeCode::name_i (ACE_ENV_SINGLE_ARG_DECL) const
+{
+ ACE_THROW_RETURN (CORBA::TypeCode::BadKind (), 0);
+}
+
+CORBA::ULong
+CORBA::TypeCode::member_count_i (ACE_ENV_SINGLE_ARG_DECL) const
+{
+ ACE_THROW_RETURN (CORBA::TypeCode::BadKind (), 0);
+}
+
+char const *
+CORBA::TypeCode::member_name_i (CORBA::ULong /* index */
+ ACE_ENV_ARG_DECL) const
+{
+ ACE_THROW_RETURN (CORBA::TypeCode::BadKind (), 0);
+}
+
+CORBA::TypeCode_ptr
+CORBA::TypeCode::member_type_i (CORBA::ULong /* index */
+ ACE_ENV_ARG_DECL) const
+{
+ ACE_THROW_RETURN (CORBA::TypeCode::BadKind (),
+ CORBA::TypeCode::_nil ());
+}
+
+CORBA::Any *
+CORBA::TypeCode::member_label_i (CORBA::ULong /* index */
+ ACE_ENV_ARG_DECL) const
+{
+ ACE_THROW_RETURN (CORBA::TypeCode::BadKind (), 0);
+}
+
+CORBA::TypeCode_ptr
+CORBA::TypeCode::discriminator_type_i (ACE_ENV_SINGLE_ARG_DECL) const
+{
+ ACE_THROW_RETURN (CORBA::TypeCode::BadKind (),
+ CORBA::TypeCode::_nil ());
+}
+
+CORBA::Long
+CORBA::TypeCode::default_index_i (ACE_ENV_SINGLE_ARG_DECL) const
+{
+ ACE_THROW_RETURN (CORBA::TypeCode::BadKind (), 0);
+}
+
+CORBA::ULong
+CORBA::TypeCode::length_i (ACE_ENV_SINGLE_ARG_DECL) const
+{
+ ACE_THROW_RETURN (CORBA::TypeCode::BadKind (), 0);
+}
+
+CORBA::TypeCode_ptr
+CORBA::TypeCode::content_type_i (ACE_ENV_SINGLE_ARG_DECL) const
+{
+ ACE_THROW_RETURN (CORBA::TypeCode::BadKind (),
+ CORBA::TypeCode::_nil ());
+}
+
+CORBA::UShort
+CORBA::TypeCode::fixed_digits_i (ACE_ENV_SINGLE_ARG_DECL) const
+{
+ ACE_THROW_RETURN (CORBA::TypeCode::BadKind (), 0);
+}
+
+CORBA::UShort
+CORBA::TypeCode::fixed_scale_i (ACE_ENV_SINGLE_ARG_DECL) const
+{
+ ACE_THROW_RETURN (CORBA::TypeCode::BadKind (), 0);
+}
+
+CORBA::Visibility
+CORBA::TypeCode::member_visibility_i (CORBA::ULong /* index */
+ ACE_ENV_ARG_DECL) const
+{
+ ACE_THROW_RETURN (CORBA::TypeCode::BadKind (),
+ CORBA::PRIVATE_MEMBER);
+}
+
+CORBA::ValueModifier
+CORBA::TypeCode::type_modifier_i (ACE_ENV_SINGLE_ARG_DECL) const
+{
+ ACE_THROW_RETURN (CORBA::TypeCode::BadKind (),
+ CORBA::VM_NONE);
+}
+
+CORBA::TypeCode_ptr
+CORBA::TypeCode::concrete_base_type_i (ACE_ENV_SINGLE_ARG_DECL) const
+{
+ ACE_THROW_RETURN (CORBA::TypeCode::BadKind (),
+ CORBA::TypeCode::_nil ());
+}
+
+// ---------------------------------------------------------------
+
+CORBA::TypeCode::Bounds::Bounds (void)
+ : CORBA::UserException ("IDL:omg.org/CORBA/TypeCode/Bounds:1.0",
+ "Bounds")
+{
+}
+
+CORBA::TypeCode::Bounds*
+CORBA::TypeCode::Bounds::_downcast (CORBA::Exception *ex)
+{
+ return dynamic_cast <CORBA::TypeCode::Bounds*> (ex);
+}
+
+CORBA::Exception *
+CORBA::TypeCode::Bounds::_alloc (void)
+{
+ CORBA::Exception *retval = 0;
+ ACE_NEW_RETURN (retval, ::CORBA::TypeCode::Bounds, 0);
+ return retval;
+}
+
+CORBA::Exception *
+CORBA::TypeCode::Bounds::_tao_duplicate (void) const
+{
+ CORBA::Exception *result;
+ ACE_NEW_RETURN (result,
+ CORBA::TypeCode::Bounds (*this),
+ 0);
+ return result;
+}
+
+void
+CORBA::TypeCode::Bounds::_raise (void) const
+{
+ TAO_RAISE(*this);
+}
+
+void
+CORBA::TypeCode::Bounds::_tao_encode (TAO_OutputCDR &cdr
+ ACE_ENV_ARG_DECL) const
+{
+ if (cdr << this->_rep_id ())
+ {
+ return;
+ }
+
+ ACE_THROW (CORBA::MARSHAL ());
+}
+
+void
+CORBA::TypeCode::Bounds::_tao_decode (TAO_InputCDR &
+ ACE_ENV_ARG_DECL_NOT_USED)
+{
+}
+
+// ****************************************************************
+
+CORBA::TypeCode::BadKind::BadKind (void)
+ : CORBA::UserException ("IDL:omg.org/CORBA/TypeCode/BadKind:1.0",
+ "BadKind")
+{
+}
+
+CORBA::TypeCode::BadKind*
+CORBA::TypeCode::BadKind::_downcast (CORBA::Exception *ex)
+{
+ return dynamic_cast <CORBA::TypeCode::BadKind*> (ex);
+}
+
+CORBA::Exception *
+CORBA::TypeCode::BadKind::_tao_duplicate (void) const
+{
+ CORBA::Exception *result = 0;
+ ACE_NEW_RETURN (result,
+ CORBA::TypeCode::BadKind (*this),
+ 0);
+ return result;
+}
+
+void
+CORBA::TypeCode::BadKind::_raise (void) const
+{
+ TAO_RAISE(*this);
+}
+
+void
+CORBA::TypeCode::BadKind::_tao_encode (TAO_OutputCDR &cdr
+ ACE_ENV_ARG_DECL) const
+{
+ if (cdr << this->_rep_id ())
+ {
+ return;
+ }
+
+ ACE_THROW (CORBA::MARSHAL ());
+}
+
+void
+CORBA::TypeCode::BadKind::_tao_decode (TAO_InputCDR &
+ ACE_ENV_ARG_DECL_NOT_USED)
+{
+}
+
+// ---------------------------------------------------------------
+
+bool
+TAO::TypeCode::marshal (TAO_OutputCDR & cdr,
+ CORBA::TypeCode_ptr tc,
+ CORBA::ULong offset)
+{
+ // Marshal the TypeCode TCKind and TypeCode body.
+ //
+ // Update the offset value in case a recursive TypeCode is being
+ // marshaled.
+
+ return
+ tc != 0
+ && tc->tao_marshal_kind (cdr)
+ && tc->tao_marshal (cdr, aligned_offset (offset) + sizeof (CORBA::ULong));
+}
+
+CORBA::ULong
+TAO::TypeCode::aligned_offset (CORBA::ULong offset)
+{
+ ptrdiff_t const unaligned_offset =
+ static_cast<ptrdiff_t> (offset);
+
+ return
+ static_cast<CORBA::ULong> (ACE_align_binary (unaligned_offset,
+ ACE_CDR::LONG_ALIGN));
+}
+
+// ---------------------------------------------------------------
+
+CORBA::Boolean
+operator<< (TAO_OutputCDR & cdr,
+ const CORBA::TypeCode_ptr tc)
+{
+ return TAO::TypeCode::marshal (cdr, tc, 0);
+}
+
+// ---------------------------------------------------------------
+
+CORBA::TypeCode_ptr
+TAO::unaliased_typecode (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL)
+{
+ if (CORBA::is_nil (tc))
+ {
+ ACE_THROW_RETURN (CORBA::BAD_PARAM (CORBA::OMGVMCID | 13,
+ CORBA::COMPLETED_NO),
+ tc);
+ }
+
+ CORBA::TCKind tc_kind = tc->kind (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (tc);
+
+ if (tc_kind == CORBA::tk_alias)
+ {
+ CORBA::TypeCode_var tc_content =
+ CORBA::TypeCode::_duplicate (tc);
+
+ // Iterate until we get to the actual unaliased type.
+ do
+ {
+ tc_content =
+ tc_content->content_type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (tc);
+
+ tc_kind = tc_content->kind (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (tc);
+ }
+ while (tc_kind == CORBA::tk_alias);
+
+ return tc_content._retn ();
+ }
+
+ return CORBA::TypeCode::_duplicate (tc);
+}
+
+// =========================================================
+
+// Traits specializations for CORBA::TypeCode.
+namespace TAO
+{
+ CORBA::TypeCode_ptr
+ Objref_Traits<CORBA::TypeCode>::duplicate (CORBA::TypeCode_ptr p)
+ {
+ return CORBA::TypeCode::_duplicate (p);
+ }
+
+ void
+ Objref_Traits<CORBA::TypeCode>::release (CORBA::TypeCode_ptr p)
+ {
+ ::CORBA::release (p);
+ }
+
+ CORBA::TypeCode_ptr
+ Objref_Traits<CORBA::TypeCode>::nil (void)
+ {
+ return CORBA::TypeCode::_nil ();
+ }
+
+ CORBA::Boolean
+ Objref_Traits<CORBA::TypeCode>::marshal (CORBA::TypeCode_ptr p,
+ TAO_OutputCDR & cdr)
+ {
+ return cdr << p;
+ }
+}
+
+// =========================================================
+
+CORBA::TCKind
+TAO::unaliased_kind (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL)
+{
+ CORBA::TypeCode_var unaliased_tc =
+ TAO::unaliased_typecode (tc
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::TAO_TC_KIND_COUNT);
+
+ return unaliased_tc->kind (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/AnyTypeCode/TypeCode.h b/TAO/tao/AnyTypeCode/TypeCode.h
new file mode 100644
index 00000000000..5502f17609d
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/TypeCode.h
@@ -0,0 +1,594 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file TypeCode.h
+ *
+ * $Id$
+ *
+ * Header file the @c CORBA::TypeCode class.
+ *
+ * @author Ossama Othman <ossama@dre.vanderbilt.edu>
+ * @author DOC group at Vanderbilt University, Washington University
+ * and the University of California at Irvine.
+ */
+//=============================================================================
+
+#ifndef TAO_TYPECODE_H
+#define TAO_TYPECODE_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/AnyTypeCode/TAO_AnyTypeCode_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/AnyTypeCode/AnyTypeCode_methods.h"
+#include "tao/AnyTypeCode/ValueModifierC.h"
+#include "tao/AnyTypeCode/VisibilityC.h"
+#include "tao/UserException.h"
+#include "tao/Basic_Types.h"
+#include "tao/Typecode_typesC.h"
+#include "tao/Any_Insert_Policy_T.h"
+#include "tao/CORBA_methods.h"
+#include "tao/Pseudo_VarOut_T.h"
+#include "tao/Object_Argument_T.h"
+#include "tao/Arg_Traits_T.h"
+#include "tao/Objref_VarOut_T.h"
+
+#if defined (TAO_EXPORT_MACRO)
+#undef TAO_EXPORT_MACRO
+#endif
+#define TAO_EXPORT_MACRO TAO_AnyTypeCode_Export
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace CORBA
+{
+ typedef TAO_Pseudo_Var_T<TypeCode> TypeCode_var;
+ typedef TAO_Pseudo_Out_T<TypeCode> TypeCode_out;
+
+ /**
+ * @class TypeCode
+ *
+ * @brief A representation of the structure of a given OMG
+ * IDL-declared type.
+ *
+ * @c TypeCodes are primarily used by @c CORBA::Anys, the CORBA
+ * Interface Repository and the CORBA Dynamic Invocation Interface.
+ */
+ class TAO_AnyTypeCode_Export TypeCode
+ {
+ public:
+
+ /**
+ * @class Bounds
+ *
+ * @brief Out-of-bounds member index exception.
+ *
+ * Exception thrown when attempting to pass an out-of-bounds index
+ * value to a @c TypeCode operation that accepts a member index
+ * argument.
+ */
+ class TAO_AnyTypeCode_Export Bounds : public UserException
+ {
+ public:
+
+ /// Constructor.
+ Bounds (void);
+
+ static Bounds * _downcast (CORBA::Exception * ex);
+ static CORBA::Exception * _alloc (void);
+
+ virtual CORBA::Exception * _tao_duplicate (void) const;
+
+ virtual void _raise (void) const;
+
+ virtual void _tao_encode (TAO_OutputCDR & cdr
+ ACE_ENV_ARG_DECL) const;
+ virtual void _tao_decode (TAO_InputCDR & cdr
+ ACE_ENV_ARG_DECL);
+
+ };
+
+ /**
+ * @class BadKind
+ *
+ * @brief Invalid @c TypeCode operation exception.
+ *
+ * Exception thrown when attempting to invoke a @c TypeCode
+ * operation that is not valid for the type represented by the
+ * @c TypeCode.
+ */
+ class TAO_AnyTypeCode_Export BadKind : public CORBA::UserException
+ {
+ public:
+
+ BadKind (void);
+
+ static BadKind * _downcast (CORBA::Exception * ex);
+ static CORBA::Exception * _alloc (void);
+
+ virtual CORBA::Exception * _tao_duplicate (void) const;
+
+ virtual void _raise (void) const;
+
+ virtual void _tao_encode (TAO_OutputCDR & cdr
+ ACE_ENV_ARG_DECL) const;
+ virtual void _tao_decode (TAO_InputCDR & cdr
+ ACE_ENV_ARG_DECL);
+
+ };
+
+ static CORBA::TypeCode_ptr const _tc_Bounds;
+ static CORBA::TypeCode_ptr const _tc_BadKind;
+
+ /// Duplicate this @c TypeCode.
+ /**
+ * Statically instantiated @c TypeCodes incur no reference count
+ * manipulation, i.e. reference counting is a no-op.
+ *
+ * Dynamically instantiated @c TypeCodes will have their reference
+ * count incremented by one each time this function is called.
+ */
+ static CORBA::TypeCode_ptr _duplicate (CORBA::TypeCode_ptr tc);
+
+ /// Returns a NULL typecode.
+ static CORBA::TypeCode_ptr _nil (void);
+
+ /**
+ * @name @c CORBA::TypeCode Methods
+ *
+ * These methods are part of the public interface of @c
+ * CORBA::TypeCode class, as defined by the OMG CORBA
+ * specification and C++ mapping.
+ *
+ * The C++ mapping does not declare the methods in the public
+ * @c CORBA::TypeCode API as @c virtual, so work around that by
+ * making these methods inlined to forward all calls to the
+ * corresponding protected template method (i.e. the design
+ * pattern, not the C++ feature) listed below in the @c protected
+ * block.
+ */
+ //@{
+ /// Equality of two @c TypeCodes.
+ /**
+ * @return @c true if and only if the set of legal operations is
+ * the same and invoking any operation on the this
+ * @c TypeCode and @a tc returns identical results.
+ */
+ Boolean equal (TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const;
+
+ /// Equivalence of two @c TypeCodes.
+ /**
+ * Equivalence of two @c TypeCodes satisfies a subset of the
+ * requirements necessary for equality.
+ *
+ * @see equal
+ */
+ Boolean equivalent (TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const;
+
+ /// The kind of @c TypeCode.
+ TCKind kind (ACE_ENV_SINGLE_ARG_DECL) const;
+
+ /// Return @c TypeCode stripped of optional @c name and
+ /// @c member_name fields.
+ /**
+ * @note Calling this method will incur additional run-time memory
+ * consumption since TAO's implementation relies on the
+ * TypeCodeFactory to dynamically create a compact @c
+ * TypeCode; the exception being @c TypeCodes with empty
+ * parameter lists. Those @c TypeCodes are already compact,
+ * meaning that call this method on such @c TypeCodes incurs
+ * no additional run-time memory requirements.
+ *
+ * Unless you need to send compact @c TypeCodes
+ * "over-the-wire" or your @c TypeCode corresponds to a
+ * type with a large number of members, try to stick with
+ * the existing potentially non-compact @c TypeCode.
+ *
+ * @note Compact @c TypeCodes may also be generated statically by
+ * the TAO_IDL compiler by invoking it with its "-Gt"
+ * (i.e. enable optimized TypeCodes) command line option.
+ */
+ TypeCode_ptr get_compact_typecode (ACE_ENV_SINGLE_ARG_DECL) const;
+
+ /// The @c RepositoryId globally identifying the type.
+ /**
+ * This method is valid for the following kinds of @c TypeCodes:
+ *
+ * @li @c tk_objref
+ * @li @c tk_struct
+ * @li @c tk_union
+ * @li @c tk_enum
+ * @li @c tk_alias
+ * @li @c tk_value
+ * @li @c tk_value_box
+ * @li @c tk_native
+ * @li @c tk_abstract_interface
+ * @li @c tk_local_interface
+ * @li @c tk_except
+ * @li @c tk_component
+ * @li @c tk_home
+ * @li @c tk_event
+ *
+ * @note CORBA::TypeCode::id() does not follow the usual parameter
+ * passing rules defined by the C++ mapping. This behavior
+ * is required by the C++ mapping. In particular, ownership
+ * is maintained by the @c TypeCode.
+ */
+ char const * id (ACE_ENV_SINGLE_ARG_DECL) const;
+
+ /// The simple name identifying the type within its enclosing
+ /// scope.
+ /**
+ * This method is valid for the following kinds of @c TypeCodes:
+ *
+ * @li @c tk_objref
+ * @li @c tk_struct
+ * @li @c tk_union
+ * @li @c tk_enum
+ * @li @c tk_alias
+ * @li @c tk_value
+ * @li @c tk_value_box
+ * @li @c tk_native
+ * @li @c tk_abstract_interface
+ * @li @c tk_local_interface
+ * @li @c tk_except
+ * @li @c tk_component
+ * @li @c tk_home
+ * @li @c tk_event
+ *
+ * @note CORBA::TypeCode::name() does not follow the usual
+ * parameter passing rules defined by the C++ mapping. This
+ * behavior is required by the C++ mapping. In particular,
+ * ownership is maintained by the @c TypeCode.
+ */
+ char const * name (ACE_ENV_SINGLE_ARG_DECL) const;
+
+ /// The type member count.
+ /**
+ * This method is valid for the following kinds of @c TypeCodes:
+ *
+ * @li @c tk_struct
+ * @li @c tk_union
+ * @li @c tk_enum
+ * @li @c tk_value
+ * @li @c tk_except
+ * @li @c tk_event
+ */
+ ULong member_count (ACE_ENV_SINGLE_ARG_DECL) const;
+
+ /// The type member name.
+ /**
+ * This method is valid for the following kinds of @c TypeCodes:
+ *
+ * @li @c tk_struct
+ * @li @c tk_union
+ * @li @c tk_enum
+ * @li @c tk_value
+ * @li @c tk_except
+ * @li @c tk_event
+ *
+ * @note CORBA::TypeCode::member_name() does not follow the usual
+ * parameter passing rules defined by the C++ mapping. This
+ * behavior is required by the C++ mapping. In particular,
+ * ownership is maintained by the @c TypeCode.
+ */
+ char const * member_name (ULong index
+ ACE_ENV_ARG_DECL) const;
+
+ /// The type member @c TypeCode.
+ /**
+ * This method is valid for the following kinds of @c TypeCodes:
+ *
+ * @li @c tk_struct
+ * @li @c tk_union
+ * @li @c tk_value
+ * @li @c tk_except
+ * @li @c tk_event
+ */
+ TypeCode_ptr member_type (ULong index
+ ACE_ENV_ARG_DECL) const;
+
+ /// The union member label.
+ /**
+ * This method is valid for the following kinds of @c TypeCodes:
+ *
+ * @li @c tk_union
+ */
+ Any * member_label (ULong index
+ ACE_ENV_ARG_DECL) const;
+
+ /// The type of all non-default union member labels.
+ /**
+ * This method is valid for the following kinds of @c TypeCodes:
+ *
+ * @li @c tk_union
+ */
+ TypeCode_ptr discriminator_type (ACE_ENV_SINGLE_ARG_DECL) const;
+
+ /// The index of the default union member.
+ /**
+ * This method is valid for the following kinds of @c TypeCodes:
+ *
+ * @li @c tk_union
+ */
+ Long default_index (ACE_ENV_SINGLE_ARG_DECL) const;
+
+ /// The length of the type.
+ /**
+ * This method is valid for the following kinds of @c TypeCodes:
+ *
+ * @li @c tk_string
+ * @li @c tk_wstring
+ * @li @c tk_sequence
+ * @li @c tk_array
+ */
+ ULong length (ACE_ENV_SINGLE_ARG_DECL) const;
+
+ /// The underlying content type.
+ /**
+ * This method is valid for the following kinds of @c TypeCodes:
+ *
+ * @li @c tk_sequence
+ * @li @c tk_array
+ * @li @c tk_value_box
+ * @li @c tk_alias
+ */
+ TypeCode_ptr content_type (ACE_ENV_SINGLE_ARG_DECL) const;
+
+ /// The number of significant digits.
+ /**
+ * This method is valid for the following kinds of @c TypeCodes:
+ *
+ * @li @c tk_fixed
+ */
+ UShort fixed_digits (ACE_ENV_SINGLE_ARG_DECL) const;
+
+ /// The scale factor.
+ /**
+ * This method is valid for the following kinds of @c TypeCodes:
+ *
+ * @li @c tk_fixed
+ */
+ UShort fixed_scale (ACE_ENV_SINGLE_ARG_DECL) const;
+
+ /// The @c Visibility of the @c valuetype or @c eventtype member
+ /// corresponding to index @a index.
+ /**
+ * This method is valid for the following kinds of @c TypeCodes:
+ *
+ * @li @c tk_value
+ * @li @c tk_event
+ */
+ Visibility member_visibility (ULong index
+ ACE_ENV_ARG_DECL) const;
+
+ /// The @c ValueModifier of the @c valuetype of @c eventtype
+ /// represented by this @c TypeCode.
+ /**
+ * This method is valid for the following kinds of @c TypeCodes:
+ *
+ * @li @c tk_value
+ * @li @c tk_event
+ */
+ ValueModifier type_modifier (ACE_ENV_SINGLE_ARG_DECL) const;
+
+ /// The @c TypeCode corresponding to the concrete base
+ /// @c valuetype or @c eventtype.
+ /**
+ * This method is valid for the following kinds of @c TypeCodes:
+ *
+ * @li @c tk_value
+ * @li @c tk_event
+ *
+ * @return @c TypeCode corresponding to the concrete base
+ * @c valuetype or @c eventtype.
+ * @c CORBA::TypeCode::_nil() if no concrete base exists.
+ */
+ TypeCode_ptr concrete_base_type (ACE_ENV_SINGLE_ARG_DECL) const;
+ //@}
+
+ /// Marshal the @c TypeCode @c TCKind.
+ /**
+ *
+ */
+ virtual bool tao_marshal_kind (TAO_OutputCDR & cdr) const;
+
+ /// Marshal this @c TypeCode into a CDR output stream.
+ /**
+ * Marshal this @c TypeCode into the @a cdr output CDR stream,
+ * excluding the @c TypeCode kind. Existing @a cdr contents will
+ * not be altered. The marshaled @c TypeCode will be appended to
+ * the given @a cdr CDR output stream.
+ *
+ * @param cdr Output CDR stream into which the @c TypeCode will be
+ * marshaled.
+ *
+ * @param offset Number of bytes currently in the output CDR
+ * stream, including the top-level TypeCode @c
+ * TCKind. This argument is useful for recursive
+ * @c TypeCodes. @c TypeCodes that contain other
+ * @c TypeCodes should pass an updated @a offset
+ * value to the marshaling operation for those
+ * contained @c TypeCodes.
+ *
+ * @return @c true if marshaling was successful.
+ *
+ * @note This is a TAO-specific method that is not part of the
+ * standard @c CORBA::TypeCode interface.
+ *
+ * @note If this method returns @false, the contents of the @a cdr
+ * output CDR stream are undefined.
+ */
+ virtual bool tao_marshal (TAO_OutputCDR & cdr,
+ CORBA::ULong offset) const = 0;
+
+ /// Increase the reference count on this @c TypeCode.
+ virtual void tao_duplicate (void) = 0;
+
+ /// Decrease the reference count on this object.
+ virtual void tao_release (void) = 0;
+
+ /// Destruction callback for Anys.
+ static void _tao_any_destructor (void * x);
+
+ typedef CORBA::TypeCode_ptr _ptr_type;
+ typedef CORBA::TypeCode_var _var_type;
+ typedef CORBA::TypeCode_out _out_type;
+
+ protected:
+
+ /// Constructor.
+ TypeCode (CORBA::TCKind kind);
+
+ /// Destructor.
+ /**
+ * Protected destructor to enforce proper memory management
+ * through the reference counting mechanism.
+ */
+ virtual ~TypeCode (void);
+
+ /**
+ * @name @c TypeCode Template Methods
+ *
+ * Methods that must be implemented by @c CORBA::TypeCode
+ * subclasses if valid for those subclasses.
+ *
+ * The default implementations of the non-pure virtual methods
+ * throw the @c CORBA::TypeCode::BadKind exception since many of
+ * these methods are @c TypeCode type-specific. This reduces code
+ * duplication and bloat.
+ *
+ * The @c TypeCode @c equal(), @c equivalent(), @c kind() and
+ * @c get_compact_typecode() methods are valid for all
+ * @c TypeCodes which is why their template method "@c _i"
+ * counterparts are pure virtual.
+ */
+ //@{
+ virtual Boolean equal_i (TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const = 0;
+ virtual Boolean equivalent_i (TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const = 0;
+ virtual TypeCode_ptr get_compact_typecode_i (
+ ACE_ENV_SINGLE_ARG_DECL) const = 0;
+
+ virtual char const * id_i (ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual char const * name_i (ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual ULong member_count_i (ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual char const * member_name_i (ULong index
+ ACE_ENV_ARG_DECL) const;
+ virtual TypeCode_ptr member_type_i (ULong index
+ ACE_ENV_ARG_DECL) const;
+ virtual Any * member_label_i (ULong index
+ ACE_ENV_ARG_DECL) const;
+ virtual TypeCode_ptr discriminator_type_i (
+ ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual Long default_index_i (ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual ULong length_i (ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual TypeCode_ptr content_type_i (ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual UShort fixed_digits_i (ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual UShort fixed_scale_i (ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual Visibility member_visibility_i (ULong index
+ ACE_ENV_ARG_DECL) const;
+ virtual ValueModifier type_modifier_i (ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual TypeCode_ptr concrete_base_type_i (
+ ACE_ENV_SINGLE_ARG_DECL) const;
+ //@}
+
+ private:
+
+ // Prevent copying and assignment.
+ TypeCode (TypeCode const &);
+ void operator= (TypeCode const &);
+
+ protected:
+
+ /// The kind of TypeCode.
+ TCKind const kind_;
+
+ };
+} // End namespace CORBA
+
+
+TAO_AnyTypeCode_Export
+CORBA::Boolean operator<< (TAO_OutputCDR & cdr,
+ const CORBA::TypeCode_ptr tc);
+
+TAO_AnyTypeCode_Export
+CORBA::Boolean operator>> (TAO_InputCDR & cdr,
+ CORBA::TypeCode_ptr & tc);
+
+namespace TAO
+{
+ namespace TypeCode
+ {
+ /// Marshal the @c TypeCode @a tc in to the output CDR stream @a
+ /// cdr.
+ /**
+ * @see @CORBA::TypeCode::tao_marshal() description for details.
+ */
+
+ TAO_AnyTypeCode_Export bool marshal (TAO_OutputCDR & cdr,
+ CORBA::TypeCode_ptr tc,
+ CORBA::ULong offset);
+
+ /// Return @a offset aligned on the appropriate CDR boundary.
+ TAO_AnyTypeCode_Export CORBA::ULong aligned_offset (CORBA::ULong offset);
+ }
+
+ /// Return the unaliased content @c TypeCode of the given
+ /// @c TypeCode.
+ TAO_AnyTypeCode_Export CORBA::TypeCode_ptr unaliased_typecode (
+ CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL);
+
+ /// Return the unaliased @c TCKind of the given @c TypeCode.
+ /**
+ * @note This is a convenience function that simply calls @c kind()
+ * on the unaliased @c TypeCode returned from
+ * @c unaliased_typecode().
+ */
+ TAO_AnyTypeCode_Export
+ CORBA::TCKind unaliased_kind (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL);
+
+ // ---------------------------------------------------------------
+
+ // Used in generated code if CORBA::TypeCode is an argument or
+ // return type.
+ template<>
+ class TAO_AnyTypeCode_Export Arg_Traits<CORBA::TypeCode>
+ : public Object_Arg_Traits_T<CORBA::TypeCode_ptr,
+ CORBA::TypeCode_var,
+ CORBA::TypeCode_out,
+ TAO::Objref_Traits<CORBA::TypeCode>,
+ TAO::Any_Insert_Policy_Stream <CORBA::TypeCode_ptr> >
+ {
+ };
+
+ template<>
+ struct TAO_AnyTypeCode_Export Objref_Traits< ::CORBA::TypeCode>
+ {
+ static ::CORBA::TypeCode_ptr duplicate (::CORBA::TypeCode_ptr);
+ static void release (::CORBA::TypeCode_ptr);
+ static ::CORBA::TypeCode_ptr nil (void);
+ static CORBA::Boolean marshal (::CORBA::TypeCode_ptr p,
+ TAO_OutputCDR & cdr);
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/AnyTypeCode/TypeCode.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_TYPECODE_H */
diff --git a/TAO/tao/AnyTypeCode/TypeCode.inl b/TAO/tao/AnyTypeCode/TypeCode.inl
new file mode 100644
index 00000000000..f06f9f5ba2d
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/TypeCode.inl
@@ -0,0 +1,162 @@
+// -*- C++ -*-
+//
+// $Id$
+
+#include "tao/Environment.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE CORBA::Boolean
+CORBA::is_nil (CORBA::TypeCode_ptr obj)
+{
+ return obj == 0;
+}
+
+ACE_INLINE void
+CORBA::release (CORBA::TypeCode_ptr obj)
+{
+ if (obj)
+ obj->tao_release ();
+}
+
+// --------------------------------------------------------------
+
+ACE_INLINE
+CORBA::TypeCode::TypeCode (CORBA::TCKind k)
+ : kind_ (k)
+{
+}
+
+ACE_INLINE CORBA::TypeCode_ptr
+CORBA::TypeCode::_duplicate (CORBA::TypeCode_ptr tc)
+{
+ if (!CORBA::is_nil (tc))
+ tc->tao_duplicate ();
+
+ return tc;
+}
+
+ACE_INLINE CORBA::TypeCode_ptr
+CORBA::TypeCode::_nil (void)
+{
+ return static_cast<CORBA::TypeCode_ptr> (0);
+}
+
+ACE_INLINE CORBA::TCKind
+CORBA::TypeCode::kind (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) const
+{
+ return this->kind_;
+}
+
+ACE_INLINE CORBA::TypeCode_ptr
+CORBA::TypeCode::get_compact_typecode (ACE_ENV_SINGLE_ARG_DECL) const
+{
+ return this->get_compact_typecode_i (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+ACE_INLINE char const *
+CORBA::TypeCode::id (ACE_ENV_SINGLE_ARG_DECL) const
+{
+ return this->id_i (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+ACE_INLINE char const *
+CORBA::TypeCode::name (ACE_ENV_SINGLE_ARG_DECL) const
+{
+ return this->name_i (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+ACE_INLINE CORBA::ULong
+CORBA::TypeCode::member_count (ACE_ENV_SINGLE_ARG_DECL) const
+{
+ return this->member_count_i (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+ACE_INLINE char const *
+CORBA::TypeCode::member_name (ULong index
+ ACE_ENV_ARG_DECL) const
+{
+ return this->member_name_i (index
+ ACE_ENV_ARG_PARAMETER);
+}
+
+ACE_INLINE CORBA::TypeCode_ptr
+CORBA::TypeCode::member_type (ULong index
+ ACE_ENV_ARG_DECL) const
+{
+ return this->member_type_i (index
+ ACE_ENV_ARG_PARAMETER);
+}
+
+ACE_INLINE CORBA::Any *
+CORBA::TypeCode::member_label (ULong index
+ ACE_ENV_ARG_DECL) const
+{
+ return this->member_label_i (index
+ ACE_ENV_ARG_PARAMETER);
+}
+
+ACE_INLINE CORBA::TypeCode_ptr
+CORBA::TypeCode::discriminator_type (ACE_ENV_SINGLE_ARG_DECL) const
+{
+ return this->discriminator_type_i (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+ACE_INLINE CORBA::Long
+CORBA::TypeCode::default_index (ACE_ENV_SINGLE_ARG_DECL) const
+{
+ return this->default_index_i (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+ACE_INLINE CORBA::ULong
+CORBA::TypeCode::length (ACE_ENV_SINGLE_ARG_DECL) const
+{
+ return this->length_i (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+ACE_INLINE CORBA::TypeCode_ptr
+CORBA::TypeCode::content_type (ACE_ENV_SINGLE_ARG_DECL) const
+{
+ return this->content_type_i (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+ACE_INLINE CORBA::UShort
+CORBA::TypeCode::fixed_digits (ACE_ENV_SINGLE_ARG_DECL) const
+{
+ return this->fixed_digits_i (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+ACE_INLINE CORBA::UShort
+CORBA::TypeCode::fixed_scale (ACE_ENV_SINGLE_ARG_DECL) const
+{
+ return this->fixed_scale_i (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+ACE_INLINE CORBA::Visibility
+CORBA::TypeCode::member_visibility (ULong index
+ ACE_ENV_ARG_DECL) const
+{
+ return this->member_visibility_i (index
+ ACE_ENV_ARG_PARAMETER);
+}
+
+ACE_INLINE CORBA::ValueModifier
+CORBA::TypeCode::type_modifier (ACE_ENV_SINGLE_ARG_DECL) const
+{
+ return this->type_modifier_i (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+ACE_INLINE CORBA::TypeCode_ptr
+CORBA::TypeCode::concrete_base_type (ACE_ENV_SINGLE_ARG_DECL) const
+{
+ return this->concrete_base_type_i (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+ACE_INLINE void
+CORBA::TypeCode::_tao_any_destructor (void * x)
+{
+ ::CORBA::release (static_cast <CORBA::TypeCode_ptr> (x));
+}
+
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/AnyTypeCode/TypeCodeA.cpp b/TAO/tao/AnyTypeCode/TypeCodeA.cpp
new file mode 100644
index 00000000000..ca3156f5d15
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/TypeCodeA.cpp
@@ -0,0 +1,63 @@
+// $Id$
+
+#include "tao/AnyTypeCode/Struct_TypeCode_Static.h"
+#include "tao/AnyTypeCode/Null_RefCount_Policy.h"
+
+
+ACE_RCSID (AnyTypeCode,
+ TypeCode,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace TypeCode
+ {
+ // Notice that these are all statically instantiated and not
+ // exported.
+
+ char const tc_bounds_id[] = "IDL:omg.org/CORBA/TypeCode/Bounds:1.0";
+ char const tc_bounds_name[] = "Bounds";
+ Struct<char const *,
+ CORBA::TypeCode_ptr const *,
+ Struct_Field<char const *,
+ CORBA::TypeCode_ptr const *> const *,
+ TAO::Null_RefCount_Policy> tc_Bounds (CORBA::tk_except,
+ tc_bounds_id,
+ tc_bounds_name,
+ 0,
+ 0);
+
+ char const tc_bad_kind_id[] = "IDL:omg.org/CORBA/TypeCode/BadKind:1.0";
+ char const tc_bad_kind_name[] = "BadKind";
+ Struct<char const *,
+ CORBA::TypeCode_ptr const *,
+ Struct_Field<char const *,
+ CORBA::TypeCode_ptr const *> const *,
+ TAO::Null_RefCount_Policy> tc_BadKind (CORBA::tk_except,
+ tc_bad_kind_id,
+ tc_bad_kind_name,
+ 0,
+ 0);
+ }
+}
+
+
+// ------------------------------------------------------------------
+// OMG defined TypeCode constants
+// ------------------------------------------------------------------
+
+// Notice that these are constant TypeCode references/pointers, not
+// constant TypeCodes. TypeCodes are effectively read-only since
+// all non-static TypeCode operations are const.
+
+
+CORBA::TypeCode_ptr const CORBA::TypeCode::_tc_BadKind =
+ &TAO::TypeCode::tc_BadKind;
+CORBA::TypeCode_ptr const CORBA::TypeCode::_tc_Bounds =
+ &TAO::TypeCode::tc_Bounds;
+
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/AnyTypeCode/TypeCode_Base_Attributes.cpp b/TAO/tao/AnyTypeCode/TypeCode_Base_Attributes.cpp
new file mode 100644
index 00000000000..da416b4314f
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/TypeCode_Base_Attributes.cpp
@@ -0,0 +1,12 @@
+// $Id$
+
+#ifndef TAO_TYPECODE_BASE_ATTRIBUTES_CPP
+#define TAO_TYPECODE_BASE_ATTRIBUTES_CPP
+
+#include "tao/AnyTypeCode/TypeCode_Base_Attributes.h"
+
+#ifndef __ACE_INLINE__
+# include "tao/AnyTypeCode/TypeCode_Base_Attributes.inl"
+#endif /* !__ACE_INLINE__ */
+
+#endif /* TAO_TYPECODE_BASE_ATTRIBUTES_CPP */
diff --git a/TAO/tao/AnyTypeCode/TypeCode_Base_Attributes.h b/TAO/tao/AnyTypeCode/TypeCode_Base_Attributes.h
new file mode 100644
index 00000000000..03740852534
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/TypeCode_Base_Attributes.h
@@ -0,0 +1,101 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file TypeCode_Base_Attributes.h
+ *
+ * $Id$
+ *
+ * @author Ossama Othman <ossama@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_TYPECODE_BASE_ATTRIBUTES_H
+#define TAO_TYPECODE_BASE_ATTRIBUTES_H
+
+#include /**/ "ace/pre.h"
+
+#include "ace/config-all.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Versioned_Namespace.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace TypeCode
+ {
+
+ /**
+ * @class Base_Attributes
+ *
+ * @brief Attributes contained by most @c TypeCodes with complex
+ * parameter lists.
+ *
+ * Most @c TypeCodes with complex parameter lists (see Section
+ * 15.3.5.1 "TypeCode" in the CORBA specification) contain these
+ * attributes, namely a repository ID and a name.
+ */
+ template <typename STRING_TYPE>
+ class Base_Attributes
+ {
+ public:
+
+ /// Constructor.
+ Base_Attributes (char const * id,
+ char const * name);
+
+ /// Constructor used by recursive @c TypeCodes.
+ Base_Attributes (char const * id);
+
+ /// Get the @c RepositoryId globally identifying the type.
+ char const * id (void) const;
+
+ /// Get the simple name identifying the type within its
+ /// enclosing scope.
+ char const * name (void) const;
+
+ /// Set the simple name identifying the type within its
+ /// enclosing scope.
+ /**
+ * @note This method only used when creating a recursive
+ * TypeCode.
+ */
+ void name (char const * the_name);
+
+ private:
+
+ /// The @c RepositoryId globally identifying the type.
+ STRING_TYPE const id_;
+
+ /// The simple name identifying the type within its enclosing
+ /// scope.
+ STRING_TYPE name_;
+
+ };
+
+ } // End namespace TypeCode
+} // End namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#ifdef __ACE_INLINE__
+# include "tao/AnyTypeCode/TypeCode_Base_Attributes.inl"
+#endif /* __ACE_INLINE__ */
+
+#ifdef ACE_TEMPLATES_REQUIRE_SOURCE
+# include "tao/AnyTypeCode/TypeCode_Base_Attributes.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#ifdef ACE_TEMPLATES_REQUIRE_PRAGMA
+# pragma implementation ("TypeCode_Base_Attributes.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_TYPECODE_BASE_ATTRIBUTES_H */
diff --git a/TAO/tao/AnyTypeCode/TypeCode_Base_Attributes.inl b/TAO/tao/AnyTypeCode/TypeCode_Base_Attributes.inl
new file mode 100644
index 00000000000..915e4ed9411
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/TypeCode_Base_Attributes.inl
@@ -0,0 +1,54 @@
+// -*- C++ -*-
+//
+// $Id$
+
+#include "tao/AnyTypeCode/TypeCode_Traits.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template <typename STRING_TYPE>
+ACE_INLINE
+TAO::TypeCode::Base_Attributes<STRING_TYPE>::Base_Attributes (
+ char const * id,
+ char const * name)
+ : id_ (id),
+ name_ (name)
+{
+}
+
+template <typename STRING_TYPE>
+ACE_INLINE
+TAO::TypeCode::Base_Attributes<STRING_TYPE>::Base_Attributes (
+ char const * id)
+ : id_ (id),
+ name_ ()
+{
+ // Only used in the dynamic (when STRING_TYPE == CORBA::String_var)
+ // recursive TypeCode case.
+}
+
+template <typename STRING_TYPE>
+ACE_INLINE char const *
+TAO::TypeCode::Base_Attributes<STRING_TYPE>::id (void) const
+{
+ return Traits<STRING_TYPE>::get_string (this->id_);
+}
+
+template <typename STRING_TYPE>
+ACE_INLINE char const *
+TAO::TypeCode::Base_Attributes<STRING_TYPE>::name (void) const
+{
+ return Traits<STRING_TYPE>::get_string (this->name_);
+}
+
+template <typename STRING_TYPE>
+ACE_INLINE void
+TAO::TypeCode::Base_Attributes<STRING_TYPE>::name (char const * the_name)
+{
+ // This method will only be instantiated in the dynamic TypeCode
+ // case, i.e. when STRING_TYPE is CORBA::String_var.
+
+ this->name_ = the_name;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/AnyTypeCode/TypeCode_CDR_Extraction.cpp b/TAO/tao/AnyTypeCode/TypeCode_CDR_Extraction.cpp
new file mode 100644
index 00000000000..6670f1a10c6
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/TypeCode_CDR_Extraction.cpp
@@ -0,0 +1,1403 @@
+// $Id$
+
+#include "tao/AnyTypeCode/TypeCode_CDR_Extraction.h"
+
+#include "tao/AnyTypeCode/TypeCode_Constants.h"
+#include "tao/AnyTypeCode/True_RefCount_Policy.h"
+
+#include "tao/AnyTypeCode/Alias_TypeCode.h"
+#include "tao/AnyTypeCode/Enum_TypeCode.h"
+#include "tao/AnyTypeCode/Fixed_TypeCode.h"
+#include "tao/AnyTypeCode/Objref_TypeCode.h"
+#include "tao/AnyTypeCode/Sequence_TypeCode.h"
+#include "tao/AnyTypeCode/String_TypeCode.h"
+#include "tao/AnyTypeCode/Struct_TypeCode.h"
+#include "tao/AnyTypeCode/Union_TypeCode.h"
+#include "tao/AnyTypeCode/Value_TypeCode.h"
+#include "tao/AnyTypeCode/Any.h"
+
+#include "tao/AnyTypeCode/Recursive_Type_TypeCode.h"
+
+#include "tao/AnyTypeCode/TypeCode_Case_T.h"
+#include "tao/AnyTypeCode/TypeCode_Struct_Field.h"
+#include "tao/AnyTypeCode/TypeCode_Value_Field.h"
+
+#include "tao/CDR.h"
+
+#include "ace/Array_Base.h"
+#include "ace/Value_Ptr.h"
+
+
+ACE_RCSID (AnyTypeCode,
+ TypeCode_CDR_Extraction,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace TypeCodeFactory
+ {
+ // An array of TC_Info objects is used instead of a map of
+ // repository IDs to TypeCodes since it is presumed that the
+ // number of directly or indirectly embedded types in a TypeCode
+ // capable of holding another TypeCode will be small enough to
+ // make traversing a list faster than performing a map lookup.
+ // Use a simple array also reduces static and run-time footprint.
+
+ struct TC_Info
+ {
+ /// Constructor.
+ TC_Info (void) : id (0), type () {}
+
+ /// Repository ID.
+ char const * id;
+
+ /// TypeCode
+ CORBA::TypeCode_ptr type;
+ };
+
+ typedef ACE_Array_Base<TC_Info> TC_Info_List;
+ }
+}
+
+namespace
+{
+ bool start_cdr_encap_extraction (TAO_InputCDR & cdr)
+ {
+ CORBA::Boolean byte_order;
+
+ // Don't bother demarshaling the encapsulation length. Prefer
+ // speed over early error checking. Any CDR length related
+ // failures will be detected when demarshaling the remainder of
+ // the complex parameter list TypeCode.
+
+ if (!(cdr.skip_ulong () // Skip encapsulation length.
+ && cdr >> TAO_InputCDR::to_boolean (byte_order)))
+ return false;
+
+ cdr.reset_byte_order (byte_order);
+
+ return true;
+ }
+
+ // ---------------------------------------------------------
+
+ CORBA::ULong const TYPECODE_INDIRECTION = 0xffffffff;
+
+ // ---------------------------------------------------------
+
+ // Use an ACE::Value_Ptr to provide exception safety and proper
+ // copying semantics.
+ typedef ACE::Value_Ptr<TAO::TypeCode::Case<CORBA::String_var, CORBA::TypeCode_var> > union_elem_type;
+ typedef ACE_Array_Base<union_elem_type> union_case_array_type;
+
+ // ------------------------------------------------------------
+
+ /// Demarshal a TypeCode.
+ bool tc_demarshal (TAO_InputCDR & cdr,
+ CORBA::TypeCode_ptr & tc,
+ TAO::TypeCodeFactory::TC_Info_List & infos);
+
+ /// Demarshal an indirected TypeCode.
+ bool tc_demarshal_indirection (TAO_InputCDR & cdr,
+ CORBA::TypeCode_ptr & tc,
+ TAO::TypeCodeFactory::TC_Info_List & infos);
+
+ bool find_recursive_tc (char const * id,
+ TAO::TypeCodeFactory::TC_Info_List & tcs,
+ TAO::TypeCodeFactory::TC_Info_List & infos)
+ {
+ // See comments above for rationale behind using an array instead
+ // of a map.
+
+ size_t const len = infos.size ();
+
+ for (size_t i = 0; i < len; ++i)
+ {
+ TAO::TypeCodeFactory::TC_Info & info = infos[i];
+
+ if (ACE_OS::strcmp (info.id, id) == 0)
+ {
+ // We have a mathing id, so store the typecode in the out array
+ // and then compare the others.
+ size_t const old_size = tcs.size ();
+ if (tcs.size (old_size + 1) == -1) // Incremental growth -- *sigh*
+ return false;
+
+ TAO::TypeCodeFactory::TC_Info & new_info = tcs[old_size];
+ new_info.type = info.type;
+ }
+ }
+
+ return (tcs.size () > 0) ;
+ }
+}
+
+bool
+TAO::TypeCodeFactory::tc_null_factory (CORBA::TCKind,
+ TAO_InputCDR &,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List &)
+{
+ tc = CORBA::TypeCode::_duplicate (CORBA::_tc_null);
+
+ return true;
+}
+
+bool
+TAO::TypeCodeFactory::tc_void_factory (CORBA::TCKind,
+ TAO_InputCDR &,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List &)
+{
+ tc = CORBA::TypeCode::_duplicate (CORBA::_tc_void);
+
+ return true;
+}
+
+bool
+TAO::TypeCodeFactory::tc_short_factory (CORBA::TCKind,
+ TAO_InputCDR &,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List &)
+{
+ tc = CORBA::TypeCode::_duplicate (CORBA::_tc_short);
+
+ return true;
+}
+
+bool
+TAO::TypeCodeFactory::tc_long_factory (CORBA::TCKind,
+ TAO_InputCDR &,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List &)
+{
+ tc = CORBA::TypeCode::_duplicate (CORBA::_tc_long);
+
+ return true;
+}
+
+bool
+TAO::TypeCodeFactory::tc_ushort_factory (CORBA::TCKind,
+ TAO_InputCDR &,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List &)
+{
+ tc = CORBA::TypeCode::_duplicate (CORBA::_tc_ushort);
+
+ return true;
+}
+
+bool
+TAO::TypeCodeFactory::tc_ulong_factory (CORBA::TCKind,
+ TAO_InputCDR &,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List &)
+{
+ tc = CORBA::TypeCode::_duplicate (CORBA::_tc_ulong);
+
+ return true;
+}
+
+bool
+TAO::TypeCodeFactory::tc_float_factory (CORBA::TCKind,
+ TAO_InputCDR &,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List &)
+{
+ tc = CORBA::TypeCode::_duplicate (CORBA::_tc_float);
+
+ return true;
+}
+
+bool
+TAO::TypeCodeFactory::tc_double_factory (CORBA::TCKind,
+ TAO_InputCDR &,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List &)
+{
+ tc = CORBA::TypeCode::_duplicate (CORBA::_tc_double);
+
+ return true;
+}
+
+bool
+TAO::TypeCodeFactory::tc_boolean_factory (CORBA::TCKind,
+ TAO_InputCDR &,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List &)
+{
+ tc = CORBA::TypeCode::_duplicate (CORBA::_tc_boolean);
+
+ return true;
+}
+
+bool
+TAO::TypeCodeFactory::tc_char_factory (CORBA::TCKind,
+ TAO_InputCDR &,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List &)
+{
+ tc = CORBA::TypeCode::_duplicate (CORBA::_tc_char);
+
+ return true;
+}
+
+bool
+TAO::TypeCodeFactory::tc_octet_factory (CORBA::TCKind,
+ TAO_InputCDR &,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List &)
+{
+ tc = CORBA::TypeCode::_duplicate (CORBA::_tc_octet);
+
+ return true;
+}
+
+bool
+TAO::TypeCodeFactory::tc_any_factory (CORBA::TCKind,
+ TAO_InputCDR &,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List &)
+{
+ tc = CORBA::TypeCode::_duplicate (CORBA::_tc_any);
+
+ return true;
+}
+
+bool
+TAO::TypeCodeFactory::tc_TypeCode_factory (CORBA::TCKind,
+ TAO_InputCDR &,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List &)
+{
+ tc = CORBA::TypeCode::_duplicate (CORBA::_tc_TypeCode);
+
+ return true;
+}
+
+bool
+TAO::TypeCodeFactory::tc_Principal_factory (CORBA::TCKind,
+ TAO_InputCDR &,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List &)
+{
+ tc = CORBA::TypeCode::_duplicate (CORBA::_tc_Principal);
+
+ return true;
+}
+
+bool
+TAO::TypeCodeFactory::tc_objref_factory (CORBA::TCKind kind,
+ TAO_InputCDR & cdr,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List &)
+{
+ // The remainder of a tk_objref TypeCode is encoded in a CDR
+ // encapsulation.
+ if (!start_cdr_encap_extraction (cdr))
+ return false;
+
+ // Extract the repository ID and name.
+ CORBA::String_var id;
+ if (!(cdr >> TAO_InputCDR::to_string (id.out (), 0)))
+ return false;
+
+ static char const Object_id[] = "IDL:omg.org/CORBA/Object:1.0";
+ static char const CCMObject_id[] = "IDL:omg.org/CORBA/CCMObject:1.0";
+ static char const CCMHome_id[] = "IDL:omg.org/CORBA/CCMHome:1.0";
+
+ char const * tc_constant_id = "";
+
+ switch (kind)
+ {
+ case CORBA::tk_component:
+ tc_constant_id = CCMObject_id;
+ break;
+ case CORBA::tk_home:
+ tc_constant_id = CCMHome_id;
+ break;
+ case CORBA::tk_objref:
+ tc_constant_id = Object_id;
+ break;
+ default:
+ break;
+ }
+
+ if (ACE_OS::strcmp (id.in (), // len >= 0!!!
+ tc_constant_id) == 0)
+ {
+ if (!cdr.skip_string ()) // No need to demarshal the name.
+ return false;
+
+ CORBA::TypeCode_ptr tc_constant = CORBA::TypeCode::_nil ();
+ switch (kind)
+ {
+ case CORBA::tk_component:
+ tc_constant = CORBA::_tc_Component;
+ break;
+ case CORBA::tk_home:
+ tc_constant = CORBA::_tc_Home;
+ break;
+ case CORBA::tk_objref:
+ tc_constant = CORBA::_tc_Object;
+ break;
+ default:
+ break;
+ }
+
+ // No need to create a TypeCode. Just use the TypeCode
+ // constant.
+ tc =
+ CORBA::TypeCode::_duplicate (tc_constant);
+ }
+ else
+ {
+ CORBA::String_var name;
+
+ if (!(cdr >> TAO_InputCDR::to_string (name.out (), 0)))
+ return false;
+
+ typedef TAO::TypeCode::Objref<CORBA::String_var,
+ TAO::True_RefCount_Policy> typecode_type;
+
+ ACE_NEW_RETURN (tc,
+ typecode_type (kind,
+ id.in (),
+ name.in ()),
+ false);
+ }
+
+ return true;
+}
+
+bool
+TAO::TypeCodeFactory::tc_struct_factory (CORBA::TCKind kind,
+ TAO_InputCDR & cdr,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos)
+{
+ ACE_ASSERT (kind == CORBA::tk_struct || kind == CORBA::tk_except);
+
+ // The remainder of a tk_struct/tk_except TypeCode is encoded in
+ // a CDR encapsulation.
+ if (!start_cdr_encap_extraction (cdr))
+ return false;
+
+ // Extract the repository ID, name and number of fields.
+ CORBA::String_var id, name;
+ CORBA::ULong nfields;
+
+ if (!(cdr >> TAO_InputCDR::to_string (id.out (), 0)
+ && cdr >> TAO_InputCDR::to_string (name.out (), 0)
+ && cdr >> nfields))
+ return false;
+
+ typedef ACE_Array_Base<TAO::TypeCode::Struct_Field<CORBA::String_var,
+ CORBA::TypeCode_var> >
+ member_array_type;
+
+ member_array_type fields (nfields);
+
+ for (CORBA::ULong i = 0; i < nfields; ++i)
+ {
+ if (!(cdr >> TAO_InputCDR::to_string (fields[i].name.out (), 0)
+ && tc_demarshal (cdr, fields[i].type.out (), infos)))
+ return false;
+ }
+
+ typedef TAO::TypeCode::Struct<
+ CORBA::String_var,
+ CORBA::TypeCode_var,
+ member_array_type,
+ TAO::True_RefCount_Policy> typecode_type;
+
+
+ // Check if struct TypeCode is recursive.
+ TAO::TypeCodeFactory::TC_Info_List recursive_tc;
+ if (kind == CORBA::tk_struct && find_recursive_tc (id.in (), recursive_tc, infos))
+ {
+ // Set remaining parameters.
+
+ typedef TAO::TypeCode::Recursive_Type<typecode_type,
+ CORBA::TypeCode_var,
+ member_array_type>
+ recursive_typecode_type;
+
+ size_t const len = recursive_tc.size ();
+
+ for (size_t i = 0; i < len; ++i)
+ {
+ TAO::TypeCodeFactory::TC_Info & info = recursive_tc[i];
+
+ recursive_typecode_type * const rtc =
+ dynamic_cast<recursive_typecode_type *> (info.type);
+
+ ACE_ASSERT (rtc);
+
+ rtc->struct_parameters (name.in (),
+ fields,
+ nfields);
+ }
+
+ tc = recursive_tc[0].type;
+ }
+ else
+ {
+ ACE_NEW_RETURN (tc,
+ typecode_type (kind,
+ id.in (),
+ name.in (),
+ fields, // Will be copied.
+ nfields),
+ false);
+ }
+
+ return true;
+}
+
+bool
+TAO::TypeCodeFactory::tc_union_factory (CORBA::TCKind /* kind */,
+ TAO_InputCDR & cdr,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos)
+{
+ // The remainder of a tk_enum TypeCode is encoded in a CDR
+ // encapsulation.
+
+ if (!start_cdr_encap_extraction (cdr))
+ return false;
+
+ // Extract the repository ID, name, discriminant type, default index
+ // and case count.
+ CORBA::String_var id, name;
+ CORBA::TypeCode_var discriminant_type;
+ CORBA::Long default_index = -1;
+ CORBA::ULong ncases = 0; // Just 'n case :-)
+
+ if (!(cdr >> TAO_InputCDR::to_string (id.out (), 0)
+ && cdr >> TAO_InputCDR::to_string (name.out (), 0)
+ && cdr >> discriminant_type.out ())) // No need to use tc_demarshal()
+ return false;
+
+ ACE_DECLARE_NEW_CORBA_ENV;
+ CORBA::TCKind const discriminant_kind =
+ discriminant_type->kind (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ // Check for valid discriminant type.
+ if (!(discriminant_kind == CORBA::tk_enum
+ || discriminant_kind == CORBA::tk_ulong
+ || discriminant_kind == CORBA::tk_long
+ || discriminant_kind == CORBA::tk_ushort
+ || discriminant_kind == CORBA::tk_short
+ || discriminant_kind == CORBA::tk_char
+ || discriminant_kind == CORBA::tk_boolean
+ || discriminant_kind == CORBA::tk_longlong
+ || discriminant_kind == CORBA::tk_ulonglong))
+ return false;
+
+ if (!(cdr >> default_index
+ && default_index >= -1
+ && cdr >> ncases))
+ return false;
+
+ typedef union_elem_type elem_type;
+ typedef union_case_array_type case_array_type;
+
+ case_array_type cases (ncases);
+
+ for (CORBA::ULong i = 0; i < ncases; ++i)
+ {
+ elem_type & member = cases[i];
+
+ TAO::TypeCode::Case<CORBA::String_var, CORBA::TypeCode_var> * the_case = 0;
+
+ // Ugly. *sigh*
+ switch (discriminant_kind)
+ {
+ case CORBA::tk_enum: // Enumerators are encoded as unsigned longs.
+ case CORBA::tk_ulong:
+ {
+ CORBA::ULong label;
+ if (!(cdr >> label))
+ return false;
+
+ typedef TypeCode::Case_T<CORBA::ULong,
+ CORBA::String_var,
+ CORBA::TypeCode_var> case_type;
+
+ ACE_NEW_RETURN (the_case,
+ case_type (label),
+ false);
+ }
+ break;
+ case CORBA::tk_long:
+ {
+ CORBA::Long label;
+ if (!(cdr >> label))
+ return false;
+
+ typedef TypeCode::Case_T<CORBA::Long,
+ CORBA::String_var,
+ CORBA::TypeCode_var> case_type;
+
+ ACE_NEW_RETURN (the_case,
+ case_type (label),
+ false);
+ }
+ break;
+ case CORBA::tk_ushort:
+ {
+ CORBA::UShort label;
+ if (!(cdr >> label))
+ return false;
+
+ typedef TypeCode::Case_T<CORBA::UShort,
+ CORBA::String_var,
+ CORBA::TypeCode_var> case_type;
+
+ ACE_NEW_RETURN (the_case,
+ case_type (label),
+ false);
+ }
+ break;
+ case CORBA::tk_short:
+ {
+ CORBA::Short label;
+ if (!(cdr >> label))
+ return false;
+
+ typedef TypeCode::Case_T<CORBA::Short,
+ CORBA::String_var,
+ CORBA::TypeCode_var> case_type;
+
+ ACE_NEW_RETURN (the_case,
+ case_type (label),
+ false);
+ }
+ break;
+ case CORBA::tk_char:
+ {
+ CORBA::Char label;
+ if (!(cdr >> CORBA::Any::to_char (label)))
+ return false;
+
+ typedef TypeCode::Case_T<CORBA::Char,
+ CORBA::String_var,
+ CORBA::TypeCode_var> case_type;
+
+ ACE_NEW_RETURN (the_case,
+ case_type (label),
+ false);
+ }
+ break;
+ case CORBA::tk_boolean:
+ {
+ CORBA::Boolean label;
+ if (!(cdr >> CORBA::Any::to_boolean (label)))
+ return false;
+
+ typedef TypeCode::Case_T<CORBA::Boolean,
+ CORBA::String_var,
+ CORBA::TypeCode_var> case_type;
+
+ ACE_NEW_RETURN (the_case,
+ case_type (label),
+ false);
+ }
+ break;
+ case CORBA::tk_longlong:
+ {
+ CORBA::LongLong label;
+ if (!(cdr >> label))
+ return false;
+
+ typedef TypeCode::Case_T<CORBA::LongLong,
+ CORBA::String_var,
+ CORBA::TypeCode_var> case_type;
+
+ ACE_NEW_RETURN (the_case,
+ case_type (label),
+ false);
+ }
+ break;
+#if !defined (ACE_LACKS_LONGLONG_T)
+ case CORBA::tk_ulonglong:
+ {
+ CORBA::ULongLong label;
+ if (!(cdr >> label))
+ return false;
+
+ typedef TypeCode::Case_T<CORBA::ULongLong,
+ CORBA::String_var,
+ CORBA::TypeCode_var> case_type;
+
+ ACE_NEW_RETURN (the_case,
+ case_type (label),
+ false);
+ }
+ break;
+#endif /* !ACE_LACKS_LONGLONG_T */
+ default:
+ return false;
+ }
+
+ elem_type case_value (the_case);
+ member.swap (case_value); // Exception-safe
+
+ CORBA::String_var the_name;
+ CORBA::TypeCode_var the_type;
+
+ if (!(cdr >> TAO_InputCDR::to_string (the_name.out (), 0)
+ && tc_demarshal (cdr, the_type.out (), infos)))
+ return false;
+
+ member->name (the_name.in ());
+ member->type (the_type.in ());
+ }
+
+ typedef TAO::TypeCode::Union<CORBA::String_var,
+ CORBA::TypeCode_var,
+ case_array_type,
+ TAO::True_RefCount_Policy> typecode_type;
+
+ // Check if we have recursive members, this could be multiple
+ TAO::TypeCodeFactory::TC_Info_List recursive_tc;
+ if (find_recursive_tc (id.in (), recursive_tc, infos))
+ {
+ // Set remaining parameters.
+
+ typedef TAO::TypeCode::Recursive_Type<typecode_type,
+ CORBA::TypeCode_var,
+ case_array_type>
+ recursive_typecode_type;
+
+ size_t const len = recursive_tc.size ();
+
+ for (size_t i = 0; i < len; ++i)
+ {
+ TAO::TypeCodeFactory::TC_Info & info = recursive_tc[i];
+
+ recursive_typecode_type * const rtc =
+ dynamic_cast<recursive_typecode_type *> (info.type);
+
+ ACE_ASSERT (rtc);
+
+ rtc->union_parameters (name.in (),
+ discriminant_type,
+ cases, // Will be copied.
+ ncases,
+ default_index);
+ }
+
+ tc = recursive_tc[0].type;
+ }
+ else
+ {
+ ACE_NEW_RETURN (tc,
+ typecode_type (id.in (),
+ name.in (),
+ discriminant_type,
+ cases, // Will be copied.
+ ncases,
+ default_index),
+ false);
+ }
+
+ return true;
+}
+
+bool
+TAO::TypeCodeFactory::tc_enum_factory (CORBA::TCKind /* kind */,
+ TAO_InputCDR & cdr,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List &)
+{
+ // The remainder of a tk_enum TypeCode is encoded in a CDR
+ // encapsulation.
+
+ if (!start_cdr_encap_extraction (cdr))
+ return false;
+
+ // Extract the repository ID, name and number of fields.
+ CORBA::String_var id, name;
+ CORBA::ULong nenumerators;
+
+ if (!(cdr >> TAO_InputCDR::to_string (id.out (), 0)
+ && cdr >> TAO_InputCDR::to_string (name.out (), 0)
+ && cdr >> nenumerators))
+ return false;
+
+ ACE_Array_Base<CORBA::String_var> enumerators (nenumerators);
+
+ for (CORBA::ULong i = 0; i < nenumerators; ++i)
+ {
+ if (!(cdr >> TAO_InputCDR::to_string (enumerators[i].out (), 0)))
+ return false;
+ }
+
+ typedef TAO::TypeCode::Enum<
+ CORBA::String_var,
+ ACE_Array_Base<CORBA::String_var>,
+ TAO::True_RefCount_Policy> typecode_type;
+
+ ACE_NEW_RETURN (tc,
+ typecode_type (id.in (),
+ name.in (),
+ enumerators, // Will be copied.
+ nenumerators),
+ false);
+
+ return true;
+}
+
+bool
+TAO::TypeCodeFactory::tc_string_factory (CORBA::TCKind kind,
+ TAO_InputCDR & cdr,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List &)
+{
+ // A tk_string/tk_wstring TypeCode has a simple parameter list,
+ // i.e. it is not encoded in a CDR encapsulation.
+
+ CORBA::ULong bound;
+ if (!(cdr >> bound))
+ return false;
+
+ if (bound == 0)
+ {
+ // Just use the TypeCode constant.
+ if (kind == CORBA::tk_string)
+ tc = CORBA::TypeCode::_duplicate (CORBA::_tc_string);
+ else if (kind == CORBA::tk_wstring)
+ tc = CORBA::TypeCode::_duplicate (CORBA::_tc_wstring);
+ else
+ return false;
+
+ return true;
+ }
+
+ typedef TAO::TypeCode::String<TAO::True_RefCount_Policy> typecode_type;
+
+ ACE_NEW_RETURN (tc,
+ typecode_type (kind, bound),
+ false);
+
+ return true;
+}
+
+bool
+TAO::TypeCodeFactory::tc_sequence_factory (CORBA::TCKind kind,
+ TAO_InputCDR & cdr,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos)
+{
+ ACE_ASSERT (kind == CORBA::tk_sequence || kind == CORBA::tk_array);
+
+ // The remainder of a tk_sequence TypeCode is encoded in a CDR
+ // encapsulation.
+
+ if (!start_cdr_encap_extraction (cdr))
+ return false;
+
+ // Extract the repository ID, name and content type.
+ CORBA::TypeCode_var content_type;
+ CORBA::ULong length;
+
+ if (!(tc_demarshal (cdr, content_type.out (), infos)
+ && cdr >> length))
+ return false;
+
+ typedef TAO::TypeCode::Sequence<
+ CORBA::TypeCode_var,
+ TAO::True_RefCount_Policy> typecode_type;
+
+ ACE_NEW_RETURN (tc,
+ typecode_type (kind, content_type, length),
+ false);
+
+ return true;
+}
+
+bool
+TAO::TypeCodeFactory::tc_array_factory (CORBA::TCKind kind,
+ TAO_InputCDR & cdr,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos)
+{
+ return tc_sequence_factory (kind, cdr, tc, infos);
+}
+
+bool
+TAO::TypeCodeFactory::tc_alias_factory (CORBA::TCKind kind,
+ TAO_InputCDR & cdr,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos)
+{
+ // The remainder of a tk_alias or tk_value_box TypeCode is encoded
+ // in a CDR encapsulation.
+
+ if (!start_cdr_encap_extraction (cdr))
+ return false;
+
+ // Extract the repository ID, name and content type.
+ CORBA::String_var id, name;
+ CORBA::TypeCode_var content_type;
+ if (!(cdr >> TAO_InputCDR::to_string (id.out (), 0)
+ && cdr >> TAO_InputCDR::to_string (name.out (), 0)
+ && tc_demarshal (cdr, content_type.out (), infos)))
+ return false;
+
+ typedef TAO::TypeCode::Alias<
+ CORBA::String_var,
+ CORBA::TypeCode_var,
+ TAO::True_RefCount_Policy> typecode_type;
+
+ ACE_NEW_RETURN (tc,
+ typecode_type (kind,
+ id.in (),
+ name.in (),
+ content_type),
+ false);
+
+ return true;
+}
+
+bool
+TAO::TypeCodeFactory::tc_except_factory (CORBA::TCKind kind,
+ TAO_InputCDR & cdr,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos)
+{
+ return tc_struct_factory (kind, cdr, tc, infos);
+}
+
+bool
+TAO::TypeCodeFactory::tc_longlong_factory (CORBA::TCKind,
+ TAO_InputCDR &,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List &)
+{
+ tc = CORBA::TypeCode::_duplicate (CORBA::_tc_longlong);
+
+ return true;
+}
+
+bool
+TAO::TypeCodeFactory::tc_ulonglong_factory (CORBA::TCKind,
+ TAO_InputCDR &,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List &)
+{
+ tc = CORBA::TypeCode::_duplicate (CORBA::_tc_ulonglong);
+
+ return true;
+}
+
+bool
+TAO::TypeCodeFactory::tc_longdouble_factory (CORBA::TCKind,
+ TAO_InputCDR &,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List &)
+{
+ tc = CORBA::TypeCode::_duplicate (CORBA::_tc_longdouble);
+
+ return true;
+}
+
+bool
+TAO::TypeCodeFactory::tc_wchar_factory (CORBA::TCKind,
+ TAO_InputCDR &,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List &)
+{
+ tc = CORBA::TypeCode::_duplicate (CORBA::_tc_wchar);
+
+ return true;
+}
+
+bool
+TAO::TypeCodeFactory::tc_wstring_factory (CORBA::TCKind kind,
+ TAO_InputCDR & cdr,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos)
+{
+ return tc_string_factory (kind, cdr, tc, infos);
+}
+
+bool
+TAO::TypeCodeFactory::tc_fixed_factory (CORBA::TCKind,
+ TAO_InputCDR & cdr,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List &)
+{
+ // A tk_fixed TypeCode has a simple parameter list, i.e. it is not
+ // encoded in a CDR encapsulation.
+
+ CORBA::UShort digits, scale;
+ if (!(cdr >> digits && cdr >> scale))
+ return false;
+
+ typedef TAO::TypeCode::Fixed<TAO::True_RefCount_Policy> typecode_type;
+
+ ACE_NEW_RETURN (tc,
+ typecode_type (digits, scale),
+ false);
+
+ return true;
+}
+
+bool
+TAO::TypeCodeFactory::tc_value_factory (CORBA::TCKind kind,
+ TAO_InputCDR & cdr,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos)
+{
+ // The remainder of a tk_value/tk_event TypeCode is encoded in a
+ // CDR encapsulation
+
+ if (!start_cdr_encap_extraction (cdr))
+ return false;
+
+ // Extract the repository ID, name and number of fields.
+ CORBA::String_var id;
+ if (!(cdr >> TAO_InputCDR::to_string (id.out (), 0)))
+ return false;
+
+// if (ACE_OS::strcmp (id.in (), "IDL:omg.org/CORBA/ValueBase:1.0") == 0)
+// {
+// // No need to create a TypeCode. Just use the TypeCode
+// // constant.
+// tc = CORBA::TypeCode::_duplicate (CORBA::_tc_ValueBase);
+
+// return true;
+// }
+// else if (ACE_OS::strcmp (id.in (),
+// "IDL:omg.org/CORBA/EventBase:1.0") == 0)
+// {
+// // No need to create a TypeCode. Just use the TypeCode
+// // constant.
+// tc = CORBA::TypeCode::_duplicate (CORBA::_tc_EventBase);
+
+// return true;
+// }
+
+ CORBA::String_var name;
+ CORBA::ValueModifier type_modifier;
+ CORBA::TypeCode_var concrete_base;
+ CORBA::ULong nfields;
+
+ if (!(cdr >> TAO_InputCDR::to_string (name.out (), 0)
+ && cdr >> type_modifier
+ && cdr >> concrete_base.out ()
+ && cdr >> nfields))
+ return false;
+
+ typedef ACE_Array_Base<TAO::TypeCode::Value_Field<CORBA::String_var,
+ CORBA::TypeCode_var> >
+ member_array_type;
+
+ member_array_type fields (nfields);
+
+ for (CORBA::ULong i = 0; i < nfields; ++i)
+ {
+ TAO::TypeCode::Value_Field<CORBA::String_var,
+ CORBA::TypeCode_var> & field = fields[i];
+
+ if (!(cdr >> TAO_InputCDR::to_string (field.name.out (), 0)
+ && tc_demarshal (cdr, field.type.out (), infos)
+ && cdr >> field.visibility))
+ return false;
+ }
+
+ typedef TAO::TypeCode::Value<
+ CORBA::String_var,
+ CORBA::TypeCode_var,
+ member_array_type,
+ TAO::True_RefCount_Policy> typecode_type;
+
+ // Check if valuetype/eventtype TypeCode is recursive.
+ TAO::TypeCodeFactory::TC_Info_List recursive_tc;
+ if (find_recursive_tc (id.in (), recursive_tc, infos))
+ {
+ // Set remaining parameters.
+
+ typedef TAO::TypeCode::Recursive_Type<typecode_type,
+ CORBA::TypeCode_var,
+ member_array_type>
+ recursive_typecode_type;
+
+ size_t const len = recursive_tc.size ();
+
+ for (size_t i = 0; i < len; ++i)
+ {
+ TAO::TypeCodeFactory::TC_Info & info = recursive_tc[i];
+
+ recursive_typecode_type * const rtc =
+ dynamic_cast<recursive_typecode_type *> (info.type);
+
+ ACE_ASSERT (rtc);
+
+ rtc->valuetype_parameters (name.in (),
+ type_modifier,
+ concrete_base,
+ fields, // Will be copied.
+ nfields);
+ }
+ tc = recursive_tc[0].type;
+ }
+ else
+ {
+ ACE_NEW_RETURN (tc,
+ typecode_type (kind,
+ id.in (),
+ name.in (),
+ type_modifier,
+ concrete_base,
+ fields, // Will be copied.
+ nfields),
+ false);
+ }
+
+ return true;
+}
+
+bool
+TAO::TypeCodeFactory::tc_value_box_factory (CORBA::TCKind kind,
+ TAO_InputCDR & cdr,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos)
+{
+ return tc_alias_factory (kind, cdr, tc, infos);
+}
+
+bool
+TAO::TypeCodeFactory::tc_native_factory (CORBA::TCKind,
+ TAO_InputCDR & cdr,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos)
+{
+ return tc_objref_factory (CORBA::tk_native, cdr, tc, infos);
+}
+
+bool
+TAO::TypeCodeFactory::tc_abstract_interface_factory (CORBA::TCKind,
+ TAO_InputCDR & cdr,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos)
+{
+ return tc_objref_factory (CORBA::tk_abstract_interface, cdr, tc, infos);
+}
+
+bool
+TAO::TypeCodeFactory::tc_local_interface_factory (CORBA::TCKind,
+ TAO_InputCDR & cdr,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos)
+{
+ return tc_objref_factory (CORBA::tk_local_interface, cdr, tc, infos);
+}
+
+bool
+TAO::TypeCodeFactory::tc_component_factory (CORBA::TCKind,
+ TAO_InputCDR & cdr,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos)
+{
+ return tc_objref_factory (CORBA::tk_component, cdr, tc, infos);
+}
+
+bool
+TAO::TypeCodeFactory::tc_home_factory (CORBA::TCKind,
+ TAO_InputCDR & cdr,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos)
+{
+ return tc_objref_factory (CORBA::tk_home, cdr, tc, infos);
+}
+
+bool
+TAO::TypeCodeFactory::tc_event_factory (CORBA::TCKind kind,
+ TAO_InputCDR & cdr,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos)
+{
+ return tc_value_factory (kind, cdr, tc, infos);
+}
+
+// ---------------------------------------------------------------
+
+namespace
+{
+ bool
+ tc_demarshal (TAO_InputCDR & cdr,
+ CORBA::TypeCode_ptr & tc,
+ TAO::TypeCodeFactory::TC_Info_List & infos)
+ {
+ // ULong since we need to detect indirected TypeCodes, too.
+
+ CORBA::ULong kind;
+ if (!(cdr >> kind)
+ || (kind >= static_cast<CORBA::ULong> (CORBA::TAO_TC_KIND_COUNT)
+ && kind != TYPECODE_INDIRECTION))
+ return false;
+
+ if (kind == TYPECODE_INDIRECTION)
+ return tc_demarshal_indirection (cdr, tc, infos);
+
+ using namespace TAO::TypeCodeFactory;
+
+ static factory const factory_map[] =
+ {
+ tc_null_factory,
+ tc_void_factory,
+ tc_short_factory,
+ tc_long_factory,
+ tc_ushort_factory,
+ tc_ulong_factory,
+ tc_float_factory,
+ tc_double_factory,
+ tc_boolean_factory,
+ tc_char_factory,
+ tc_octet_factory,
+ tc_any_factory,
+ tc_TypeCode_factory,
+ tc_Principal_factory,
+ tc_objref_factory,
+ tc_struct_factory,
+ tc_union_factory,
+ tc_enum_factory,
+ tc_string_factory,
+ tc_sequence_factory,
+ tc_array_factory,
+ tc_alias_factory,
+ tc_except_factory,
+ tc_longlong_factory,
+ tc_ulonglong_factory,
+ tc_longdouble_factory,
+ tc_wchar_factory,
+ tc_wstring_factory,
+ tc_fixed_factory,
+ tc_value_factory,
+ tc_value_box_factory,
+ tc_native_factory,
+ tc_abstract_interface_factory,
+ tc_local_interface_factory,
+ tc_component_factory,
+ tc_home_factory,
+ tc_event_factory
+ };
+
+ return factory_map[kind] (static_cast<CORBA::TCKind> (kind),
+ cdr,
+ tc,
+ infos);
+ }
+
+ bool
+ tc_demarshal_indirection (TAO_InputCDR & cdr,
+ CORBA::TypeCode_ptr & tc,
+ TAO::TypeCodeFactory::TC_Info_List & infos)
+ {
+ CORBA::Long offset;
+
+ if (!(cdr >> offset) || offset >= -4)
+ {
+ // Offsets must be negative since they point back to a
+ // TypeCode found earlier in the CDR stream. They must be
+ // less than -4 since an offset of -4 points back to the
+ // indirection TypeCode itself, meaning that it would be
+ // self-indirecting.
+ return false;
+ }
+
+// ACE_Message_Block * const mb =
+// const_cast<ACE_Message_Block *> (cdr.start ());
+
+// TAO_InputCDR indir_stream (mb->rd_ptr () + offset - 4,
+ TAO_InputCDR indir_stream (cdr.rd_ptr () + offset - sizeof (CORBA::Long),
+ (-offset) + sizeof (CORBA::Long),
+ cdr.byte_order ());
+
+ if (!indir_stream.good_bit ())
+ {
+ return false;
+ }
+
+ CORBA::TCKind kind;
+ if (!(indir_stream >> kind)
+
+ // Indirected TypeCode must point to top-level TypeCode.
+ || static_cast<CORBA::ULong> (kind) == TYPECODE_INDIRECTION
+
+ // Only struct, union and valuetype TypeCodes may be recursive.
+ || !(kind == CORBA::tk_struct
+ || kind == CORBA::tk_union
+ || kind == CORBA::tk_value
+ || kind == CORBA::tk_event)
+
+ // Currently all recursive TypeCodes have complex parameter
+ // lists, meaning they are encoded as CDR encapsulations.
+ || !start_cdr_encap_extraction (indir_stream))
+ {
+ return false;
+ }
+
+ /**
+ * @todo Recursive TypeCode demarshaling is currently suboptimal
+ * due to redundant demarshaling of TypeCode parameters,
+ * such as repository ID, and excessive
+ * allocations/copying.
+ */
+
+ CORBA::String_var id;
+ if (!(indir_stream >> TAO_InputCDR::to_string (id.out (), 0)))
+ return false;
+
+ // Don't bother demarshaling the rest of the parameters. They will
+ // be handled by the top-level TypeCode demarshaling call.
+ bool new_tc = false;
+
+ switch (kind)
+ {
+ case CORBA::tk_struct:
+ {
+ // Check if we already have a tc for this type, if yes, use that
+ TAO::TypeCodeFactory::TC_Info_List recursive_tc;
+ if (find_recursive_tc (id.in (), recursive_tc, infos))
+ {
+ tc = recursive_tc[0].type;
+ }
+ else
+ {
+ new_tc = true;
+
+ typedef ACE_Array_Base<
+ TAO::TypeCode::Struct_Field<
+ CORBA::String_var,
+ CORBA::TypeCode_var> > member_array_type;
+
+ typedef TAO::TypeCode::Struct<
+ CORBA::String_var,
+ CORBA::TypeCode_var,
+ member_array_type,
+ TAO::True_RefCount_Policy> typecode_type;
+
+ typedef TAO::TypeCode::Recursive_Type<typecode_type,
+ CORBA::TypeCode_var,
+ member_array_type>
+ recursive_typecode_type;
+
+ ACE_NEW_RETURN (tc,
+ recursive_typecode_type (kind,
+ id.in ()),
+ false);
+ }
+ }
+ break;
+ case CORBA::tk_union:
+ {
+ // Check if we already have a tc for this type, if yes, use that
+ TAO::TypeCodeFactory::TC_Info_List recursive_tc;
+ if (find_recursive_tc (id.in (), recursive_tc, infos))
+ {
+ tc = recursive_tc[0].type;
+ }
+ else
+ {
+ new_tc = true;
+
+ typedef union_case_array_type member_array_type;
+
+ typedef TAO::TypeCode::Union<
+ CORBA::String_var,
+ CORBA::TypeCode_var,
+ member_array_type,
+ TAO::True_RefCount_Policy> typecode_type;
+
+ typedef TAO::TypeCode::Recursive_Type<typecode_type,
+ CORBA::TypeCode_var,
+ member_array_type>
+ recursive_typecode_type;
+
+ ACE_NEW_RETURN (tc,
+ recursive_typecode_type (kind,
+ id.in ()),
+ false);
+ }
+ }
+ break;
+ case CORBA::tk_value:
+ case CORBA::tk_event:
+ {
+ // Check if we already have a tc for this type, if yes, use that
+ TAO::TypeCodeFactory::TC_Info_List recursive_tc;
+ if (find_recursive_tc (id.in (), recursive_tc, infos))
+ {
+ tc = recursive_tc[0].type;
+ }
+ else
+ {
+ new_tc = true;
+
+ typedef ACE_Array_Base<
+ TAO::TypeCode::Value_Field<
+ CORBA::String_var,
+ CORBA::TypeCode_var> > member_array_type;
+
+ typedef TAO::TypeCode::Value<
+ CORBA::String_var,
+ CORBA::TypeCode_var,
+ member_array_type,
+ TAO::True_RefCount_Policy> typecode_type;
+
+ typedef TAO::TypeCode::Recursive_Type<typecode_type,
+ CORBA::TypeCode_var,
+ member_array_type>
+ recursive_typecode_type;
+
+ ACE_NEW_RETURN (tc,
+ recursive_typecode_type (kind,
+ id.in ()),
+ false);
+ }
+ }
+ break;
+ default:
+ return false; // We should never get here.
+ };
+
+ // Only when we created a new tc add it to the list.
+ if (new_tc)
+ {
+ size_t const old_size = infos.size ();
+ if (infos.size (old_size + 1) == -1) // Incremental growth -- *sigh*
+ return false;
+
+ TAO::TypeCodeFactory::TC_Info & info = infos[old_size];
+
+ ACE_DECLARE_NEW_CORBA_ENV;
+ info.id = tc->id (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false); // Should never throw!
+
+ info.type = tc;
+ }
+
+ return true;
+ }
+}
+
+// ----------------------------------------------------------------
+
+CORBA::Boolean
+operator>> (TAO_InputCDR & cdr,
+ CORBA::TypeCode_ptr & tc)
+{
+ TAO::TypeCodeFactory::TC_Info_List infos;
+
+ return tc_demarshal (cdr, tc, infos);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/AnyTypeCode/TypeCode_CDR_Extraction.h b/TAO/tao/AnyTypeCode/TypeCode_CDR_Extraction.h
new file mode 100644
index 00000000000..0e6d6015c97
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/TypeCode_CDR_Extraction.h
@@ -0,0 +1,200 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file TypeCode_CDR_Extraction.h
+ *
+ * $Id$
+ *
+ * Header file for TAO TypeCode CDR extraction operations.
+ *
+ * @author Ossama Othman <ossama@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_TYPECODE_CDR_EXTRACTION_H
+#define TAO_TYPECODE_CDR_EXTRACTION_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Typecode_typesC.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+template <class T> class ACE_Array_Base;
+ACE_END_VERSIONED_NAMESPACE_DECL
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace TypeCodeFactory
+ {
+ struct TC_Info;
+ typedef ACE_Array_Base<TC_Info> TC_Info_List;
+
+ typedef bool (*factory) (CORBA::TCKind,
+ TAO_InputCDR &,
+ CORBA::TypeCode_ptr &,
+ TC_Info_List &);
+
+ bool tc_null_factory (CORBA::TCKind kind,
+ TAO_InputCDR & cdr,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
+ bool tc_void_factory (CORBA::TCKind kind,
+ TAO_InputCDR & cdr,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
+ bool tc_short_factory (CORBA::TCKind kind,
+ TAO_InputCDR & cdr,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
+ bool tc_long_factory (CORBA::TCKind kind,
+ TAO_InputCDR & cdr,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
+ bool tc_ushort_factory (CORBA::TCKind kind,
+ TAO_InputCDR & cdr,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
+ bool tc_ulong_factory (CORBA::TCKind kind,
+ TAO_InputCDR & cdr,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
+ bool tc_float_factory (CORBA::TCKind kind,
+ TAO_InputCDR & cdr,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
+ bool tc_double_factory (CORBA::TCKind kind,
+ TAO_InputCDR & cdr,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
+ bool tc_boolean_factory (CORBA::TCKind kind,
+ TAO_InputCDR & cdr,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
+ bool tc_char_factory (CORBA::TCKind kind,
+ TAO_InputCDR & cdr,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
+ bool tc_octet_factory (CORBA::TCKind kind,
+ TAO_InputCDR & cdr,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
+ bool tc_any_factory (CORBA::TCKind kind,
+ TAO_InputCDR & cdr,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
+ bool tc_TypeCode_factory (CORBA::TCKind kind,
+ TAO_InputCDR & cdr,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
+ bool tc_Principal_factory (CORBA::TCKind kind,
+ TAO_InputCDR & cdr,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
+ bool tc_objref_factory (CORBA::TCKind kind,
+ TAO_InputCDR & cdr,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
+ bool tc_struct_factory (CORBA::TCKind kind,
+ TAO_InputCDR & cdr,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
+ bool tc_union_factory (CORBA::TCKind kind,
+ TAO_InputCDR & cdr,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
+ bool tc_enum_factory (CORBA::TCKind kind,
+ TAO_InputCDR & cdr,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
+ bool tc_string_factory (CORBA::TCKind kind,
+ TAO_InputCDR & cdr,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
+ bool tc_sequence_factory (CORBA::TCKind kind,
+ TAO_InputCDR & cdr,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
+ bool tc_array_factory (CORBA::TCKind kind,
+ TAO_InputCDR & cdr,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
+ bool tc_alias_factory (CORBA::TCKind kind,
+ TAO_InputCDR & cdr,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
+ bool tc_except_factory (CORBA::TCKind kind,
+ TAO_InputCDR & cdr,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
+ bool tc_longlong_factory (CORBA::TCKind kind,
+ TAO_InputCDR & cdr,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
+ bool tc_ulonglong_factory (CORBA::TCKind kind,
+ TAO_InputCDR & cdr,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
+ bool tc_longdouble_factory (CORBA::TCKind kind,
+ TAO_InputCDR & cdr,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
+ bool tc_wchar_factory (CORBA::TCKind kind,
+ TAO_InputCDR & cdr,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
+ bool tc_wstring_factory (CORBA::TCKind kind,
+ TAO_InputCDR & cdr,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
+ bool tc_fixed_factory (CORBA::TCKind kind,
+ TAO_InputCDR & cdr,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
+ bool tc_value_factory (CORBA::TCKind kind,
+ TAO_InputCDR & cdr,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
+ bool tc_value_box_factory (CORBA::TCKind kind,
+ TAO_InputCDR & cdr,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
+ bool tc_native_factory (CORBA::TCKind kind,
+ TAO_InputCDR & cdr,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
+ bool tc_abstract_interface_factory (CORBA::TCKind kind,
+ TAO_InputCDR & cdr,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
+ bool tc_local_interface_factory (CORBA::TCKind kind,
+ TAO_InputCDR & cdr,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
+ bool tc_component_factory (CORBA::TCKind kind,
+ TAO_InputCDR & cdr,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
+ bool tc_home_factory (CORBA::TCKind kind,
+ TAO_InputCDR & cdr,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
+ bool tc_event_factory (CORBA::TCKind kind,
+ TAO_InputCDR & cdr,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
+
+ } // End namespace TypeCodeFactory
+} // End namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_TYPECODE_CDR_EXTRACTION_H */
diff --git a/TAO/tao/AnyTypeCode/TypeCode_Case_Base_T.cpp b/TAO/tao/AnyTypeCode/TypeCode_Case_Base_T.cpp
new file mode 100644
index 00000000000..67edee2d6b8
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/TypeCode_Case_Base_T.cpp
@@ -0,0 +1,89 @@
+// $Id$
+
+#ifndef TAO_TYPECODE_CASE_CPP
+#define TAO_TYPECODE_CASE_CPP
+
+#include "tao/AnyTypeCode/TypeCode_Case_Base_T.h"
+#include "ace/OS_NS_string.h"
+
+#ifndef __ACE_INLINE__
+# include "tao/AnyTypeCode/TypeCode_Case_Base_T.inl"
+#endif /* __ACE_INLINE__ */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template <typename StringType, typename TypeCodeType>
+TAO::TypeCode::Case<StringType, TypeCodeType>::~Case (void)
+{
+}
+
+template <typename StringType, typename TypeCodeType>
+bool
+TAO::TypeCode::Case<StringType, TypeCodeType>::equal (CORBA::ULong index,
+ CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const
+{
+ // Check case names.
+ char const * const lhs_name = this->name ();
+ char const * const rhs_name = tc->member_name (index
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ if (ACE_OS::strcmp (lhs_name, rhs_name) != 0)
+ return 0;
+
+ // Check case TypeCodes.
+ CORBA::TypeCode_ptr const lhs_tc = this->type ();
+ CORBA::TypeCode_var const rhs_tc =
+ tc->member_type (index
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ CORBA::Boolean const equal_members =
+ lhs_tc->equal (rhs_tc.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ if (!equal_members)
+ return 0;
+
+ // Check case label.
+ return this->equal_label (index,
+ tc
+ ACE_ENV_ARG_PARAMETER);
+}
+
+template <typename StringType, typename TypeCodeType>
+bool
+TAO::TypeCode::Case<StringType, TypeCodeType>::equivalent (
+ CORBA::ULong index,
+ CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const
+{
+ // Member names are ignore when determining equivalence.
+
+ // Check case TypeCodes.
+ CORBA::TypeCode_ptr const lhs_tc = this->type ();
+ CORBA::TypeCode_var const rhs_tc =
+ tc->member_type (index
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ CORBA::Boolean const equivalent_members =
+ lhs_tc->equivalent (rhs_tc.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ if (!equivalent_members)
+ return 0;
+
+ // Check case label.
+ // The label must be equal when determining equivalence, too.
+ return this->equal_label (index,
+ tc
+ ACE_ENV_ARG_PARAMETER);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_TYPECODE_CASE_CPP */
diff --git a/TAO/tao/AnyTypeCode/TypeCode_Case_Base_T.h b/TAO/tao/AnyTypeCode/TypeCode_Case_Base_T.h
new file mode 100644
index 00000000000..638051bcb6a
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/TypeCode_Case_Base_T.h
@@ -0,0 +1,210 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file TypeCode_Case_Base_T.h
+ *
+ * $Id$
+ *
+ * Header file for @c TAO::TypeCode::Case type.
+ *
+ * @author Ossama Othman
+ */
+//=============================================================================
+
+#ifndef TAO_TYPECODE_CASE_H
+#define TAO_TYPECODE_CASE_H
+
+#include /**/ "ace/pre.h"
+
+#include "ace/config-all.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace CORBA
+{
+ class TypeCode;
+ typedef TypeCode* TypeCode_ptr;
+
+ class Any;
+}
+
+namespace TAO
+{
+ namespace TypeCode
+ {
+
+ /**
+ * @class Case
+ *
+ * @brief Abstract base class for that represents an IDL @c union
+ * case/member.
+ *
+ * This class hides the actual IDL @c union member label value
+ * from the @c TAO::TypeCode::Union class by relying on a
+ * CORBA::Any return value that corresponds to the @c
+ * CORBA::TypeCode::member_label() return type. It also allows
+ * the @c TAO::TypeCode::Union class to marshal the member label
+ * values into a CDR stream without knowledge of the underlying
+ * member label values.
+ */
+ template <typename StringType, typename TypeCodeType>
+ class Case
+ {
+ public:
+
+ /// Constructor.
+ /**
+ * Constructor used when creating static @c union @c TypeCodes.
+ */
+ Case (char const * name,
+ TypeCodeType tc);
+
+ /// Constructor.
+ /**
+ * Constructor used when creating dynamic @c union @c TypeCodes.
+ */
+ Case (void);
+
+ /// Destructor.
+ virtual ~Case (void);
+
+ /// Cloning/copying operation.
+ virtual Case * clone (void) const = 0;
+
+ /// Return the IDL @c union case label value embedded within a
+ /// @c CORBA::Any.
+ virtual CORBA::Any * label (ACE_ENV_SINGLE_ARG_DECL) const = 0;
+
+ /// Get the name of the @c union case/member.
+ char const * name (void) const;
+
+ /// Set the name of the @c union case/member.
+ void name (char const * the_name);
+
+ /// Get the @c CORBA::TypeCode of the @c union case/member.
+ /**
+ * @note The reference count is not manipulated by this method,
+ * i.e., ownership is retained by this class.
+ */
+ CORBA::TypeCode_ptr type (void) const;
+
+ /// Set the @c CORBA::TypeCode of the @c union case/member.
+ /**
+ * @note @c CORBA::TypeCode::_duplicate() is called on the
+ * @c TypeCode @a tc.
+ */
+ void type (CORBA::TypeCode_ptr tc);
+
+ /// Marshal this IDL @c union member into the given output CDR
+ /// stream.
+ bool marshal (TAO_OutputCDR & cdr,
+ CORBA::ULong offset) const;
+
+ /// Check for equality of the @c case attributes contained by this
+ /// class and the corresponding member attributes at index "@a
+ /// index" in the given @c TypeCode @a tc.
+ bool equal (CORBA::ULong index,
+ CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const;
+
+ /// Check for equivalence of the @c case attributes contained by
+ /// this class and the corresponding member attributes at index
+ /// "@a index" in the given @c TypeCode @a tc.
+ bool equivalent (CORBA::ULong index,
+ CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const;
+
+ protected:
+
+ /// Marshal the IDL @c union @c case label value into the given
+ /// output CDR stream.
+ virtual bool marshal_label (TAO_OutputCDR & cdr) const = 0;
+
+ /// Verify equality of member labels.
+ /**
+ * Performing member label equality comparisons in the @c Case
+ * subclass allows us to avoid performing interpretive
+ * extraction of the value from the @c Any returned from the
+ * "right hand side" operand @c TypeCode since the @c Case
+ * subclass already knows what type and value should be
+ * extracted from the @c Any.
+ *
+ * @param index Member index of given @c TypeCode @a tc being
+ * tested.
+ * @param tc The @c TypeCode whose member "@a index" label is
+ * being tested.
+ */
+ virtual bool equal_label (CORBA::ULong index,
+ CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const = 0;
+
+ private:
+
+ /// The name of the case.
+ StringType name_;
+
+ /// Pointer to the @c CORBA::TypeCode of the case.
+ /**
+ * A pointer to the @c CORBA::TypeCode_ptr rather than the
+ * @c CORBA::TypeCode_ptr itself is stored since that address is
+ * well-defined. We may not know the value of the @c
+ * CORBA::TypeCode_ptr when creating this @c Case statically at
+ * compile-time, hence the indirection.
+ *
+ * @note This @c TypeCode is released upon destruction of this
+ * @c Case.
+ */
+ TypeCodeType type_;
+
+ };
+
+ typedef Case<CORBA::String_var, CORBA::TypeCode_var> Case_Dynamic;
+
+ } // End namespace TypeCode
+} // End namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace ACE
+{
+ /// @see ace/Value_Ptr.h.
+ template <typename T> struct VP_traits;
+
+ template <>
+ struct TAO_AnyTypeCode_Export VP_traits<TAO::TypeCode::Case_Dynamic>
+ {
+ /// Copy the given object.
+ static TAO::TypeCode::Case_Dynamic * clone (
+ TAO::TypeCode::Case_Dynamic const * p)
+ {
+ return p->clone ();
+ }
+ };
+
+} // End namespace ACE.
+
+ACE_END_VERSIONED_NAMESPACE_DECL
+
+
+#ifdef __ACE_INLINE__
+# include "tao/AnyTypeCode/TypeCode_Case_Base_T.inl"
+#endif /* __ACE_INLINE__ */
+
+#ifdef ACE_TEMPLATES_REQUIRE_SOURCE
+# include "tao/AnyTypeCode/TypeCode_Case_Base_T.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#ifdef ACE_TEMPLATES_REQUIRE_PRAGMA
+# pragma implementation ("TypeCode_Case_Base_T.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_TYPECODE_CASE_H */
diff --git a/TAO/tao/AnyTypeCode/TypeCode_Case_Base_T.inl b/TAO/tao/AnyTypeCode/TypeCode_Case_Base_T.inl
new file mode 100644
index 00000000000..4bd6b4f8a79
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/TypeCode_Case_Base_T.inl
@@ -0,0 +1,79 @@
+// -*- C++ -*-
+//
+// $Id$
+
+#include "tao/CDR.h"
+#include "tao/AnyTypeCode/TypeCode_Traits.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template <typename StringType, typename TypeCodeType>
+ACE_INLINE
+TAO::TypeCode::Case<StringType, TypeCodeType>::Case (
+ char const * member_name,
+ TypeCodeType member_type)
+ : name_ (member_name)
+ , type_ (member_type)
+{
+}
+
+template <typename StringType, typename TypeCodeType>
+ACE_INLINE
+TAO::TypeCode::Case<StringType, TypeCodeType>::Case (void)
+ : name_ ()
+ , type_ ()
+{
+ // Only used when StringType and TypeCodeType are CORBA::String_var
+ // and CORBA::TypeCode_var, respectively.
+}
+
+template <typename StringType, typename TypeCodeType>
+ACE_INLINE bool
+TAO::TypeCode::Case<StringType, TypeCodeType>::marshal (
+ TAO_OutputCDR & cdr,
+ CORBA::ULong offset) const
+{
+ return
+ this->marshal_label (cdr)
+ && (cdr << TAO_OutputCDR::from_string (
+ Traits<StringType>::get_string (this->name_), 0))
+ && TAO::TypeCode::marshal (cdr,
+ Traits<StringType>::get_typecode (this->type_),
+ offset + cdr.total_length ());
+}
+
+template <typename StringType, typename TypeCodeType>
+ACE_INLINE char const *
+TAO::TypeCode::Case<StringType, TypeCodeType>::name (void) const
+{
+ return
+ Traits<StringType>::get_string (this->name_);
+}
+
+template <typename StringType, typename TypeCodeType>
+ACE_INLINE void
+TAO::TypeCode::Case<StringType, TypeCodeType>::name (
+ char const * the_name)
+{
+ this->name_ = the_name;
+}
+
+template <typename StringType, typename TypeCodeType>
+ACE_INLINE CORBA::TypeCode_ptr
+TAO::TypeCode::Case<StringType, TypeCodeType>::type (void) const
+{
+ return
+ Traits<StringType>::get_typecode (this->type_);
+}
+
+template <typename StringType, typename TypeCodeType>
+ACE_INLINE void
+TAO::TypeCode::Case<StringType, TypeCodeType>::type (CORBA::TypeCode_ptr tc)
+{
+ // This assignment works since it is only used when TypeCodeType is
+ // "CORBA::TypeCode_var", not in the "CORBA::TypeCode_ptr const *"
+ // case.
+ this->type_ = CORBA::TypeCode::_duplicate (tc);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/AnyTypeCode/TypeCode_Case_T.cpp b/TAO/tao/AnyTypeCode/TypeCode_Case_T.cpp
new file mode 100644
index 00000000000..fc7533e98ae
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/TypeCode_Case_T.cpp
@@ -0,0 +1,164 @@
+// $Id$
+
+#ifndef TAO_TYPECODE_CASE_T_CPP
+#define TAO_TYPECODE_CASE_T_CPP
+
+#include "tao/AnyTypeCode/TypeCode_Case_T.h"
+
+#include "tao/CDR.h"
+#include "tao/AnyTypeCode/Any.h"
+#include "tao/SystemException.h"
+
+#ifndef __ACE_INLINE__
+# include "tao/AnyTypeCode/TypeCode_Case_T.inl"
+#endif /* __ACE_INLINE__ */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace TypeCode
+ {
+ template <typename T>
+ struct Case_Traits
+ {
+ inline static T any_from (T v)
+ {
+ return v;
+ }
+
+ inline static T & any_to (T & v)
+ {
+ return v;
+ }
+ };
+
+ // Specializations for types that require wrapper for Any
+ // insertion. Note that we only define specializations for types
+ // that can be used in an IDL union discriminator.
+
+ template <>
+ struct Case_Traits<CORBA::Boolean>
+ {
+ inline static CORBA::Any::from_boolean any_from (CORBA::Boolean v)
+ {
+ return CORBA::Any::from_boolean (v);
+ }
+
+ inline static CORBA::Any::to_boolean any_to (CORBA::Boolean & v)
+ {
+ return CORBA::Any::to_boolean (v);
+ }
+ };
+
+ template <>
+ struct Case_Traits<CORBA::Char>
+ {
+ inline static CORBA::Any::from_char any_from (CORBA::Char v)
+ {
+ return CORBA::Any::from_char (v);
+ }
+
+ inline static CORBA::Any::to_char any_to (CORBA::Char & v)
+ {
+ return CORBA::Any::to_char (v);
+ }
+ };
+
+ } // End TypeCode namespace
+} // End TAO namespace
+
+// ----------------------------------------------------------------
+
+
+template <typename DiscriminatorType,
+ typename StringType,
+ typename TypeCodeType>
+TAO::TypeCode::Case<StringType, TypeCodeType> *
+TAO::TypeCode::Case_T<DiscriminatorType,
+ StringType,
+ TypeCodeType>::clone (void) const
+{
+ Case<StringType, TypeCodeType> * p = 0;
+
+ typedef Case_T<DiscriminatorType,
+ StringType,
+ TypeCodeType> case_type;
+
+ // The compiler generated memberwise copy constructor is sufficient.
+ ACE_NEW_RETURN (p,
+ case_type (*this),
+ p);
+
+ return p;
+}
+
+template <typename DiscriminatorType,
+ typename StringType,
+ typename TypeCodeType>
+bool
+TAO::TypeCode::Case_T<DiscriminatorType,
+ StringType,
+ TypeCodeType>::marshal_label (TAO_OutputCDR & cdr) const
+{
+ return
+ (cdr <<
+ TAO::TypeCode::Case_Traits<DiscriminatorType>::any_from (this->label_));
+}
+
+template <typename DiscriminatorType,
+ typename StringType,
+ typename TypeCodeType>
+bool
+TAO::TypeCode::Case_T<DiscriminatorType,
+ StringType,
+ TypeCodeType>::equal_label (CORBA::ULong index,
+ CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const
+{
+ CORBA::Any_var const any = tc->member_label (index
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ // The equality operator == below is guaranteed to be defined for
+ // the discriminator type since an IDL union discriminator type must
+ // be any of the following: (1) an integer, (2) a character, (3) a
+ // boolean, or (4) an enumeration.
+
+ DiscriminatorType tc_label;
+ if ((any.in ()
+ >>= TAO::TypeCode::Case_Traits<DiscriminatorType>::any_to (tc_label))
+ && this->label_ == tc_label)
+ {
+ return true;
+ }
+
+ return false;
+}
+
+template <typename DiscriminatorType,
+ typename StringType,
+ typename TypeCodeType>
+CORBA::Any *
+TAO::TypeCode::Case_T<DiscriminatorType,
+ StringType,
+ TypeCodeType>::label (ACE_ENV_SINGLE_ARG_DECL) const
+{
+ CORBA::Any * value = 0;
+
+ ACE_NEW_THROW_EX (value,
+ CORBA::Any,
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (0);
+
+ CORBA::Any_var safe_value (value);
+
+ *value <<=
+ TAO::TypeCode::Case_Traits<DiscriminatorType>::any_from (this->label_);
+
+ return safe_value._retn ();
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_TYPECODE_CASE_T_CPP */
diff --git a/TAO/tao/AnyTypeCode/TypeCode_Case_T.h b/TAO/tao/AnyTypeCode/TypeCode_Case_T.h
new file mode 100644
index 00000000000..c0cff25b880
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/TypeCode_Case_T.h
@@ -0,0 +1,147 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file TypeCode_Case_T.h
+ *
+ * $Id$
+ *
+ * Header file for @c TAO::TypeCode::Case_T template.
+ *
+ * @author Ossama Othman
+ */
+//=============================================================================
+
+#ifndef TAO_TYPECODE_CASE_T_H
+#define TAO_TYPECODE_CASE_T_H
+
+#include /**/ "ace/pre.h"
+
+#include "ace/config-all.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/AnyTypeCode/TypeCode_Case_Base_T.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace TypeCode
+ {
+ /**
+ * @class Case_T
+ *
+ * @brief Representation of an OMG IDL defined @c union @c case.
+ *
+ * A @c Case_T contains the corresponding case label value, name and
+ * pointer to the @c CORBA::TypeCode for a given OMG IDL @c union
+ * @c case. For
+ * example, the cases in following OMG IDL @c union:
+ *
+ * \code
+ * union Foo switch (short)
+ * {
+ * case 0:
+ * case 1: short a;
+ * case 2: long b;
+ * default: octet c;
+ * };
+ * \endcode
+ *
+ * would be represented using the following statically instantiated
+ * @c TAO::TypeCode::Case_T array:
+ *
+ * \code
+ * typedef TAO::TypeCode::Case_T<CORBA::Short, char const *> Foo_Case;
+ * Foo_Case _tao_cases_Foo[] =
+ * {
+ * Foo_Case (0, "a", &CORBA::_tc_short),
+ * Foo_Case (1, "a", &CORBA::_tc_short),
+ * Foo_Case (2, "b", &CORBA::_tc_long),
+ * Foo_Case (0, "c", &CORBA::_tc_octet)
+ * };
+ * \endcode
+ *
+ * The @c default index is passed directly to the
+ * @c TAO::TypeCode::Union constructor.
+ *
+ * The template parameter @a DISCRIMINATOR_TYPE is the
+ * corresponding C++ type for the IDL defined @c union
+ * discriminator type. For example, a @c union with an IDL @c
+ * short discriminator will have a corresponding @c CORBA::Short
+ * C++ type. This template parameter is necessary to allow the
+ * actual @c case label value to be stored as its actual type,
+ * which is particularly important when marshaling that value into
+ * a CDR stream.
+ *
+ * The template parameter @a StringType is either @c char @c
+ * const @c * or @c CORBA::String_var. The latter is only used
+ * when creating @c CORBA::tk_union @c TypeCode dynamically, such
+ * as through the TypeCodeFactory.
+ */
+ template <typename DiscriminatorType,
+ typename StringType,
+ typename TypeCodeType>
+ class Case_T : public Case<StringType, TypeCodeType>
+ {
+ public:
+
+ /// Constructor.
+ Case_T (DiscriminatorType member_label,
+ char const * member_name,
+ TypeCodeType member_type);
+
+ /// Constructor.
+ /**
+ * Constructor only used in the dynamically constructed @c union
+ * @c TypeCode case.
+ */
+ Case_T (DiscriminatorType member_label);
+
+ /**
+ * @name @c TAO::TypeCode::Case Methods
+ *
+ * Methods required by the @c TAO::TypeCode::Case abstract base
+ * class.
+ *
+ * @see @c TAO::TypeCode::Case
+ */
+ //@{
+ Case<StringType, TypeCodeType> * clone (void) const;
+ virtual CORBA::Any * label (ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual bool marshal_label (TAO_OutputCDR & cdr) const;
+ virtual bool equal_label (CORBA::ULong index,
+ CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const;
+ //@}
+
+ private:
+
+ /// IDL @c union case/member label value.
+ DiscriminatorType const label_;
+
+ };
+
+ } // End namespace TypeCode
+} // End namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#ifdef __ACE_INLINE__
+# include "tao/AnyTypeCode/TypeCode_Case_T.inl"
+#endif /* __ACE_INLINE__ */
+
+#ifdef ACE_TEMPLATES_REQUIRE_SOURCE
+# include "tao/AnyTypeCode/TypeCode_Case_T.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#ifdef ACE_TEMPLATES_REQUIRE_PRAGMA
+# pragma implementation ("TypeCode_Case_T.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_TYPECODE_CASE_T_H */
diff --git a/TAO/tao/AnyTypeCode/TypeCode_Case_T.inl b/TAO/tao/AnyTypeCode/TypeCode_Case_T.inl
new file mode 100644
index 00000000000..f95b599c795
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/TypeCode_Case_T.inl
@@ -0,0 +1,34 @@
+// -*- C++ -*-
+//
+// $Id$
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template <typename DiscriminatorType,
+ typename StringType,
+ typename TypeCodeType>
+ACE_INLINE
+TAO::TypeCode::Case_T<DiscriminatorType,
+ StringType,
+ TypeCodeType>::Case_T (DiscriminatorType member_label,
+ char const * member_name,
+ TypeCodeType member_type)
+ : Case<StringType, TypeCodeType> (member_name, member_type)
+ , label_ (member_label)
+{
+}
+
+template <typename DiscriminatorType,
+ typename StringType,
+ typename TypeCodeType>
+ACE_INLINE
+TAO::TypeCode::Case_T<DiscriminatorType,
+ StringType,
+ TypeCodeType>::Case_T (DiscriminatorType member_label)
+ : Case<StringType, TypeCodeType> ()
+ , label_ (member_label)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/AnyTypeCode/TypeCode_Constants.cpp b/TAO/tao/AnyTypeCode/TypeCode_Constants.cpp
new file mode 100644
index 00000000000..cc156f63533
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/TypeCode_Constants.cpp
@@ -0,0 +1,114 @@
+// $Id$
+
+
+#include "tao/AnyTypeCode/TypeCode_Constants.h"
+
+
+ACE_RCSID (AnyTypeCode,
+ TypeCode_Constants,
+ "$Id$")
+
+
+#include "tao/AnyTypeCode/Null_RefCount_Policy.h"
+#include "tao/AnyTypeCode/Empty_Param_TypeCode.h"
+#include "tao/AnyTypeCode/Objref_TypeCode_Static.h"
+#include "tao/AnyTypeCode/String_TypeCode_Static.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace TypeCode
+ {
+ // Notice that these are all statically instantiated and not
+ // exported. There CORBA::TypeCode_ptr counterparts are, however,
+ // exported.
+
+ Empty_Param tc_null (CORBA::tk_null);
+ Empty_Param tc_void (CORBA::tk_void);
+ Empty_Param tc_boolean (CORBA::tk_boolean);
+ Empty_Param tc_char (CORBA::tk_char);
+ Empty_Param tc_wchar (CORBA::tk_wchar);
+ Empty_Param tc_short (CORBA::tk_short);
+ Empty_Param tc_ushort (CORBA::tk_ushort);
+ Empty_Param tc_long (CORBA::tk_long);
+ Empty_Param tc_ulong (CORBA::tk_ulong);
+ Empty_Param tc_longlong (CORBA::tk_longlong);
+ Empty_Param tc_ulonglong (CORBA::tk_ulonglong);
+ Empty_Param tc_float (CORBA::tk_float);
+ Empty_Param tc_double (CORBA::tk_double);
+ Empty_Param tc_longdouble (CORBA::tk_longdouble);
+ Empty_Param tc_octet (CORBA::tk_octet);
+ Empty_Param tc_any (CORBA::tk_any);
+ Empty_Param tc_TypeCode (CORBA::tk_TypeCode);
+ Empty_Param tc_Principal (CORBA::tk_Principal);
+
+ // --------------
+
+ String<TAO::Null_RefCount_Policy> tc_string (CORBA::tk_string, 0);
+ String<TAO::Null_RefCount_Policy> tc_wstring (CORBA::tk_wstring, 0);
+
+ // --------------
+
+ char const tc_object_id[] = "IDL:omg.org/CORBA/Object:1.0";
+ char const tc_object_name[] = "Object";
+ Objref<char const *,
+ TAO::Null_RefCount_Policy> tc_Object (CORBA::tk_objref,
+ tc_object_id,
+ tc_object_name);
+
+ char const tc_component_id[] = "IDL:omg.org/CORBA/CCMObject:1.0";
+ char const tc_component_name[] = "CCMObject";
+ Objref<char const *,
+ TAO::Null_RefCount_Policy> tc_Component (CORBA::tk_component,
+ tc_component_id,
+ tc_component_name);
+
+ char const tc_home_id[] = "IDL:omg.org/CORBA/CCMHome:1.0";
+ char const tc_home_name[] = "CCMHome";
+ Objref<char const *,
+ TAO::Null_RefCount_Policy> tc_Home (CORBA::tk_home,
+ tc_home_id,
+ tc_home_name);
+ } // End TypeCode namespace
+} // End TAO namespace
+
+// ------------------------------------------------------------------
+// OMG defined TypeCode constants
+// ------------------------------------------------------------------
+
+namespace CORBA
+{
+ // Notice that these are constant TypeCode references/pointers, not
+ // constant TypeCodes. TypeCodes are effectively read-only since
+ // all non-static TypeCode operations are const.
+
+ TypeCode_ptr const _tc_null = &TAO::TypeCode::tc_null;
+ TypeCode_ptr const _tc_void = &TAO::TypeCode::tc_void;
+ TypeCode_ptr const _tc_boolean = &TAO::TypeCode::tc_boolean;
+ TypeCode_ptr const _tc_char = &TAO::TypeCode::tc_char;
+ TypeCode_ptr const _tc_wchar = &TAO::TypeCode::tc_wchar;
+ TypeCode_ptr const _tc_short = &TAO::TypeCode::tc_short;
+ TypeCode_ptr const _tc_ushort = &TAO::TypeCode::tc_ushort;
+ TypeCode_ptr const _tc_long = &TAO::TypeCode::tc_long;
+ TypeCode_ptr const _tc_ulong = &TAO::TypeCode::tc_ulong;
+ TypeCode_ptr const _tc_longlong = &TAO::TypeCode::tc_longlong;
+ TypeCode_ptr const _tc_ulonglong = &TAO::TypeCode::tc_ulonglong;
+ TypeCode_ptr const _tc_float = &TAO::TypeCode::tc_float;
+ TypeCode_ptr const _tc_double = &TAO::TypeCode::tc_double;
+ TypeCode_ptr const _tc_longdouble = &TAO::TypeCode::tc_longdouble;
+ TypeCode_ptr const _tc_octet = &TAO::TypeCode::tc_octet;
+ TypeCode_ptr const _tc_any = &TAO::TypeCode::tc_any;
+ TypeCode_ptr const _tc_TypeCode = &TAO::TypeCode::tc_TypeCode;
+ TypeCode_ptr const _tc_Principal = &TAO::TypeCode::tc_Principal;
+
+ TypeCode_ptr const _tc_string = &TAO::TypeCode::tc_string;
+ TypeCode_ptr const _tc_wstring = &TAO::TypeCode::tc_wstring;
+
+ TypeCode_ptr const _tc_Object = &TAO::TypeCode::tc_Object;
+ TypeCode_ptr const _tc_Component = &TAO::TypeCode::tc_Component;
+ TypeCode_ptr const _tc_Home = &TAO::TypeCode::tc_Home;
+
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/AnyTypeCode/TypeCode_Constants.h b/TAO/tao/AnyTypeCode/TypeCode_Constants.h
new file mode 100644
index 00000000000..2aea3471df7
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/TypeCode_Constants.h
@@ -0,0 +1,124 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file TypeCode_Constants.h
+ *
+ * $Id$
+ *
+ * Declare the @c TypeCode constants available to the ORB and user
+ * applications.
+ *
+ * @author Jeff Parsons
+ * @author Ossama Othman
+ */
+//=============================================================================
+
+#ifndef TAO_TYPECODE_CONSTANTS_H
+#define TAO_TYPECODE_CONSTANTS_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/AnyTypeCode/TAO_AnyTypeCode_Export.h"
+
+#include "tao/Versioned_Namespace.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace CORBA
+{
+ class TypeCode;
+ typedef TypeCode * TypeCode_ptr;
+
+ /**
+ * @name TypeCode Constants
+ *
+ * All the TypeCode constants
+ */
+ //@{
+ extern TAO_AnyTypeCode_Export TypeCode_ptr const _tc_null;
+ extern TAO_AnyTypeCode_Export TypeCode_ptr const _tc_void;
+ extern TAO_AnyTypeCode_Export TypeCode_ptr const _tc_boolean;
+ extern TAO_AnyTypeCode_Export TypeCode_ptr const _tc_char;
+ extern TAO_AnyTypeCode_Export TypeCode_ptr const _tc_wchar;
+ extern TAO_AnyTypeCode_Export TypeCode_ptr const _tc_short;
+ extern TAO_AnyTypeCode_Export TypeCode_ptr const _tc_ushort;
+ extern TAO_AnyTypeCode_Export TypeCode_ptr const _tc_long;
+ extern TAO_AnyTypeCode_Export TypeCode_ptr const _tc_ulong;
+ extern TAO_AnyTypeCode_Export TypeCode_ptr const _tc_longlong;
+ extern TAO_AnyTypeCode_Export TypeCode_ptr const _tc_ulonglong;
+ extern TAO_AnyTypeCode_Export TypeCode_ptr const _tc_float;
+ extern TAO_AnyTypeCode_Export TypeCode_ptr const _tc_double;
+ extern TAO_AnyTypeCode_Export TypeCode_ptr const _tc_longdouble;
+ extern TAO_AnyTypeCode_Export TypeCode_ptr const _tc_octet;
+ extern TAO_AnyTypeCode_Export TypeCode_ptr const _tc_any;
+ extern TAO_AnyTypeCode_Export TypeCode_ptr const _tc_TypeCode;
+ extern TAO_AnyTypeCode_Export TypeCode_ptr const _tc_Principal;
+
+ extern TAO_AnyTypeCode_Export TypeCode_ptr const _tc_string;
+ extern TAO_AnyTypeCode_Export TypeCode_ptr const _tc_wstring;
+
+ extern TAO_AnyTypeCode_Export TypeCode_ptr const _tc_Object;
+ extern TAO_AnyTypeCode_Export TypeCode_ptr const _tc_Component;
+ extern TAO_AnyTypeCode_Export TypeCode_ptr const _tc_Home;
+ //@}
+
+#define TAO_SYSTEM_EXCEPTION_LIST \
+ TAO_SYSTEM_EXCEPTION(UNKNOWN); \
+ TAO_SYSTEM_EXCEPTION(BAD_PARAM); \
+ TAO_SYSTEM_EXCEPTION(NO_MEMORY); \
+ TAO_SYSTEM_EXCEPTION(IMP_LIMIT); \
+ TAO_SYSTEM_EXCEPTION(COMM_FAILURE); \
+ TAO_SYSTEM_EXCEPTION(INV_OBJREF); \
+ TAO_SYSTEM_EXCEPTION(OBJECT_NOT_EXIST); \
+ TAO_SYSTEM_EXCEPTION(NO_PERMISSION); \
+ TAO_SYSTEM_EXCEPTION(INTERNAL); \
+ TAO_SYSTEM_EXCEPTION(MARSHAL); \
+ TAO_SYSTEM_EXCEPTION(INITIALIZE); \
+ TAO_SYSTEM_EXCEPTION(NO_IMPLEMENT); \
+ TAO_SYSTEM_EXCEPTION(BAD_TYPECODE); \
+ TAO_SYSTEM_EXCEPTION(BAD_OPERATION); \
+ TAO_SYSTEM_EXCEPTION(NO_RESOURCES); \
+ TAO_SYSTEM_EXCEPTION(NO_RESPONSE); \
+ TAO_SYSTEM_EXCEPTION(PERSIST_STORE); \
+ TAO_SYSTEM_EXCEPTION(BAD_INV_ORDER); \
+ TAO_SYSTEM_EXCEPTION(TRANSIENT); \
+ TAO_SYSTEM_EXCEPTION(FREE_MEM); \
+ TAO_SYSTEM_EXCEPTION(INV_IDENT); \
+ TAO_SYSTEM_EXCEPTION(INV_FLAG); \
+ TAO_SYSTEM_EXCEPTION(INTF_REPOS); \
+ TAO_SYSTEM_EXCEPTION(BAD_CONTEXT); \
+ TAO_SYSTEM_EXCEPTION(OBJ_ADAPTER); \
+ TAO_SYSTEM_EXCEPTION(DATA_CONVERSION); \
+ TAO_SYSTEM_EXCEPTION(INV_POLICY); \
+ TAO_SYSTEM_EXCEPTION(REBIND); \
+ TAO_SYSTEM_EXCEPTION(TIMEOUT); \
+ TAO_SYSTEM_EXCEPTION(TRANSACTION_UNAVAILABLE); \
+ TAO_SYSTEM_EXCEPTION(TRANSACTION_MODE); \
+ TAO_SYSTEM_EXCEPTION(TRANSACTION_REQUIRED); \
+ TAO_SYSTEM_EXCEPTION(TRANSACTION_ROLLEDBACK); \
+ TAO_SYSTEM_EXCEPTION(INVALID_TRANSACTION); \
+ TAO_SYSTEM_EXCEPTION(CODESET_INCOMPATIBLE); \
+ TAO_SYSTEM_EXCEPTION(BAD_QOS); \
+ TAO_SYSTEM_EXCEPTION(INVALID_ACTIVITY); \
+ TAO_SYSTEM_EXCEPTION(ACTIVITY_COMPLETED); \
+ TAO_SYSTEM_EXCEPTION(ACTIVITY_REQUIRED); \
+ TAO_SYSTEM_EXCEPTION(THREAD_CANCELLED);
+
+ // = Typecode constants for system exceptions.
+#define TAO_SYSTEM_EXCEPTION(name) \
+ extern TAO_AnyTypeCode_Export TypeCode_ptr const _tc_ ## name
+ TAO_SYSTEM_EXCEPTION_LIST
+#undef TAO_SYSTEM_EXCEPTION
+ //@}
+
+ extern TAO_AnyTypeCode_Export TypeCode_ptr const _tc_Current;
+
+ extern TAO_AnyTypeCode_Export TypeCode_ptr const _tc_NamedValue;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_TYPECODE_CONSTANTS_H */
diff --git a/TAO/tao/AnyTypeCode/TypeCode_Struct_Field.h b/TAO/tao/AnyTypeCode/TypeCode_Struct_Field.h
new file mode 100644
index 00000000000..1a3d8c9deb4
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/TypeCode_Struct_Field.h
@@ -0,0 +1,91 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file TypeCode_Struct_Field.h
+ *
+ * $Id$
+ *
+ * Header file for @c TAO::TypeCode::Struct_Field type.
+ *
+ * @author Ossama Othman <ossama@dre.vanderbilt.edu>
+ * @author Carlos O'Ryan
+ */
+//=============================================================================
+
+#ifndef TAO_TYPECODE_STRUCT_FIELD_H
+#define TAO_TYPECODE_STRUCT_FIELD_H
+
+#include /**/ "ace/pre.h"
+
+#include "ace/config-all.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace CORBA
+{
+ class TypeCode;
+ typedef TypeCode* TypeCode_ptr;
+}
+
+namespace TAO
+{
+ namespace TypeCode
+ {
+ /**
+ * @struct Struct_Field
+ *
+ * @brief Name/type pair for fields of an OMG IDL defined
+ * structure or exception.
+ *
+ * A @c Struct_Field contains the corresponding name and pointer
+ * to the @c CORBA::TypeCode for a given OMG IDL defined type.
+ * For example, the fields in following OMG IDL structure:
+ *
+ * \code
+ * struct Foo
+ * {
+ * long the_number;
+ * string the_string;
+ * };
+ * \endcode
+ *
+ * would be represented using the following statically instantiated
+ * @c TAO::TypeCode::Struct_Field array:
+ *
+ * \code
+ * TAO::TypeCode::Struct_Field<char const *> _tao_fields_Foo[] =
+ * {
+ * { "the_number", &CORBA::_tc_long },
+ * { "the_string", &CORBA::_tc_string },
+ * };
+ * \endcode
+ *
+ * The template parameter @a STRING_TYPE is either @c char
+ * @c const @c * or @c CORBA::String_var. The latter is only used
+ * when creating @c CORBA::tk_struct or @c CORBA::tk_except
+ * @c TypeCodes dynamically, such as through the TypeCodeFactory.
+ */
+ template <typename StringType, typename TypeCodeType>
+ struct Struct_Field
+ {
+ /// The name of the field.
+ StringType name;
+
+ /// The @c CORBA::TypeCode of the field.
+ TypeCodeType type;
+
+ };
+
+ } // End namespace TypeCode
+} // End namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_TYPECODE_STRUCT_FIELD_H */
diff --git a/TAO/tao/AnyTypeCode/TypeCode_Traits.h b/TAO/tao/AnyTypeCode/TypeCode_Traits.h
new file mode 100644
index 00000000000..7c1fe02b47e
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/TypeCode_Traits.h
@@ -0,0 +1,126 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file TypeCode_Traits.h
+ *
+ * $Id$
+ *
+ * @author Ossama Othman <ossama@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_TYPECODE_TRAITS_H
+#define TAO_TYPECODE_TRAITS_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/CORBA_String.h"
+#include "tao/AnyTypeCode/TypeCode.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ class Null_RefCount_Policy;
+ class True_RefCount_Policy;
+
+ namespace TypeCode
+ {
+
+// enum Storage { STATIC_TYPECODE, DYNAMIC_TYPECODE };
+
+// template<Storage S> struct Traits;
+
+ // ----
+ // @@ Work around limitations in MSVC++ 6.
+ typedef char const * STATIC_TYPECODE;
+ typedef CORBA::String_var DYNAMIC_TYPECODE;
+
+ template<typename S> struct Traits;
+ // ----
+
+ template<>
+ struct Traits<STATIC_TYPECODE>
+ {
+ typedef char const * string_type;
+
+ /**
+ * A pointer to the @c CORBA::TypeCode_ptr rather than the
+ * @c CORBA::TypeCode_ptr itself is stored since that address is
+ * well-defined. We may not know the value of the
+ * @c CORBA::TypeCode_ptr when creating a static object that
+ * refers to it, hence the indirection.
+ */
+ typedef CORBA::TypeCode_ptr const * typecode_type;
+
+ typedef TAO::Null_RefCount_Policy refcount_policy_type;
+
+ static char const * get_string (string_type const & str)
+ {
+ return str;
+ }
+
+ static CORBA::TypeCode_ptr get_typecode (typecode_type const & tc)
+ {
+ return (tc == 0 ? CORBA::TypeCode::_nil () : *tc);
+ }
+ };
+
+ template<>
+ struct Traits<DYNAMIC_TYPECODE>
+ {
+ typedef CORBA::String_var string_type;
+ typedef CORBA::TypeCode_var typecode_type;
+ typedef TAO::True_RefCount_Policy refcount_policy_type;
+
+ static char const * get_string (string_type const & str)
+ {
+ return str.in ();
+ }
+
+ static CORBA::TypeCode_ptr get_typecode (typecode_type const & tc)
+ {
+ return tc.in ();
+ }
+ };
+
+ // ---------------
+
+ // Traits based on TypeCode type template parameters.
+
+ template<>
+ struct Traits<Traits<STATIC_TYPECODE>::typecode_type>
+ {
+ typedef Traits<STATIC_TYPECODE>::typecode_type typecode_type;
+
+ static CORBA::TypeCode_ptr get_typecode (typecode_type const & tc)
+ {
+ return (tc == 0 ? CORBA::TypeCode::_nil () : *tc);
+ }
+ };
+
+ template<>
+ struct Traits<Traits<DYNAMIC_TYPECODE>::typecode_type>
+ {
+ typedef Traits<DYNAMIC_TYPECODE>::typecode_type typecode_type;
+
+ static CORBA::TypeCode_ptr get_typecode (typecode_type const & tc)
+ {
+ return tc.in ();
+ }
+
+ };
+
+ } // End namespace TypeCode
+} // End namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_TYPECODE_TRAITS_H */
diff --git a/TAO/tao/AnyTypeCode/TypeCode_Value_Field.h b/TAO/tao/AnyTypeCode/TypeCode_Value_Field.h
new file mode 100644
index 00000000000..c421189f0f5
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/TypeCode_Value_Field.h
@@ -0,0 +1,93 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file TypeCode_Value_Field.h
+ *
+ * $Id$
+ *
+ * Header file for @c TAO::TypeCode::Value_Field type.
+ *
+ * @author Ossama Othman <ossama@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_TYPECODE_VALUE_FIELD_H
+#define TAO_TYPECODE_VALUE_FIELD_H
+
+#include /**/ "ace/pre.h"
+
+#include "ace/config-all.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace CORBA
+{
+ class TypeCode;
+ typedef TypeCode* TypeCode_ptr;
+}
+
+namespace TAO
+{
+ namespace TypeCode
+ {
+ /**
+ * @struct Value_Field
+ *
+ * @brief Name/type/visibility tuple fields of an OMG IDL defined
+ * @c valuetype or @c eventtype.
+ *
+ * A @c Value_Field contains the corresponding name and pointer to the
+ * @c CORBA::TypeCode for a given OMG IDL defined type. For
+ * example, the fields in following OMG IDL structure:
+ *
+ * \code
+ * struct Foo
+ * {
+ * long the_number;
+ * string the_string;
+ * };
+ * \endcode
+ *
+ * would be represented using the following statically instantiated
+ * @c TAO::TypeCode::Value_Field array:
+ *
+ * \code
+ * TAO::TypeCode::Value_Field<char const *> _tao_fields_Foo[] =
+ * {
+ * { "the_number", &CORBA::_tc_long },
+ * { "the_string", &CORBA::_tc_string },
+ * };
+ * \endcode
+ *
+ * The template parameter @a STRING_TYPE is either @c char
+ * @c const @c * or @c CORBA::String_var. The latter is only used
+ * when creating @c CORBA::tk_value or @c CORBA::tk_event
+ * @c TypeCodes dynamically, such as through the TypeCodeFactory.
+ */
+ template <typename StringType, typename TypeCodeType>
+ struct Value_Field
+ {
+ /// The name of the field.
+ StringType name;
+
+ /// The @c CORBA::TypeCode of the field.
+ TypeCodeType type;
+
+ /// The visibility of the field.
+ CORBA::Visibility visibility;
+
+ };
+
+ } // End namespace TypeCode
+} // End namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_TYPECODE_VALUE_FIELD_H */
diff --git a/TAO/tao/AnyTypeCode/Typecode_typesA.h b/TAO/tao/AnyTypeCode/Typecode_typesA.h
new file mode 100644
index 00000000000..ccc5218c384
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Typecode_typesA.h
@@ -0,0 +1,47 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:153
+
+#ifndef _TAO_IDL_ORIG_TYPECODE_TYPESA_H_
+#define _TAO_IDL_ORIG_TYPECODE_TYPESA_H_
+
+#include /**/ "ace/pre.h"
+
+
+#include "ace/config-all.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include /**/ "ace/post.h"
+
+#endif /* ifndef */
+
+
diff --git a/TAO/tao/AnyTypeCode/UShortSeqA.cpp b/TAO/tao/AnyTypeCode/UShortSeqA.cpp
new file mode 100644
index 00000000000..582d15d69d0
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/UShortSeqA.cpp
@@ -0,0 +1,146 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+#include "tao/AnyTypeCode/UShortSeqA.h"
+#include "tao/AnyTypeCode/Null_RefCount_Policy.h"
+#include "tao/AnyTypeCode/TypeCode_Constants.h"
+#include "tao/AnyTypeCode/Alias_TypeCode_Static.h"
+#include "tao/AnyTypeCode/Sequence_TypeCode_Static.h"
+#include "tao/CDR.h"
+#include "tao/AnyTypeCode/Any.h"
+#include "tao/AnyTypeCode/Any_Dual_Impl_T.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/alias_typecode.cpp:50
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/typecode_defn.cpp:937
+
+
+#ifndef _TAO_TYPECODE_CORBA_UShortSeq_GUARD
+#define _TAO_TYPECODE_CORBA_UShortSeq_GUARD
+namespace TAO
+{
+ namespace TypeCode
+ {
+ TAO::TypeCode::Sequence< ::CORBA::TypeCode_ptr const *,
+ TAO::Null_RefCount_Policy>
+ CORBA_UShortSeq_0 (
+ CORBA::tk_sequence,
+ &CORBA::_tc_ushort,
+ 0U);
+
+ ::CORBA::TypeCode_ptr const tc_CORBA_UShortSeq_0 =
+ &CORBA_UShortSeq_0;
+
+ }
+}
+
+
+#endif /* _TAO_TYPECODE_CORBA_UShortSeq_GUARD */
+
+static TAO::TypeCode::Alias<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_CORBA_UShortSeq (
+ CORBA::tk_alias,
+ "IDL:omg.org/CORBA/UShortSeq:1.0",
+ "UShortSeq",
+ &TAO::TypeCode::tc_CORBA_UShortSeq_0);
+
+namespace CORBA
+{
+ ::CORBA::TypeCode_ptr const _tc_UShortSeq =
+ &_tao_tc_CORBA_UShortSeq;
+}
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_sequence/any_op_cs.cpp:54
+
+
+// Copying insertion.
+void operator<<= (
+ CORBA::Any &_tao_any,
+ const CORBA::UShortSeq &_tao_elem
+ )
+{
+ TAO::Any_Dual_Impl_T<CORBA::UShortSeq>::insert_copy (
+ _tao_any,
+ CORBA::UShortSeq::_tao_any_destructor,
+ TAO::TypeCode::tc_CORBA_UShortSeq_0,
+ _tao_elem
+ );
+}
+
+// Non-copying insertion.
+void operator<<= (
+ CORBA::Any &_tao_any,
+ CORBA::UShortSeq *_tao_elem
+ )
+{
+ TAO::Any_Dual_Impl_T<CORBA::UShortSeq>::insert (
+ _tao_any,
+ CORBA::UShortSeq::_tao_any_destructor,
+ TAO::TypeCode::tc_CORBA_UShortSeq_0,
+ _tao_elem
+ );
+}
+
+// Extraction to non-const pointer (deprecated).
+CORBA::Boolean operator>>= (
+ const CORBA::Any &_tao_any,
+ CORBA::UShortSeq *&_tao_elem
+ )
+{
+ return _tao_any >>= const_cast<
+ const CORBA::UShortSeq *&> (
+ _tao_elem
+ );
+}
+
+// Extraction to const pointer.
+CORBA::Boolean operator>>= (
+ const CORBA::Any &_tao_any,
+ const CORBA::UShortSeq *&_tao_elem
+ )
+{
+ return
+ TAO::Any_Dual_Impl_T<CORBA::UShortSeq>::extract (
+ _tao_any,
+ CORBA::UShortSeq::_tao_any_destructor,
+ TAO::TypeCode::tc_CORBA_UShortSeq_0,
+ _tao_elem
+ );
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/AnyTypeCode/UShortSeqA.h b/TAO/tao/AnyTypeCode/UShortSeqA.h
new file mode 100644
index 00000000000..824246509de
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/UShortSeqA.h
@@ -0,0 +1,112 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:153
+
+#ifndef _TAO_IDL_ORIG_USHORTSEQA_H_
+#define _TAO_IDL_ORIG_USHORTSEQA_H_
+
+#include /**/ "ace/pre.h"
+
+
+#include "ace/config-all.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/AnyTypeCode/TAO_AnyTypeCode_Export.h"
+#include "tao/AnyTypeCode/AnyTypeCode_methods.h"
+#include "tao/UShortSeqC.h"
+
+#if defined (TAO_EXPORT_MACRO)
+#undef TAO_EXPORT_MACRO
+#endif
+#define TAO_EXPORT_MACRO TAO_AnyTypeCode_Export
+
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+#if defined (__BORLANDC__)
+#pragma option push -w-rvl -w-rch -w-ccc -w-inl
+#endif /* __BORLANDC__ */
+
+// TAO_IDL - Generated from
+// be\be_visitor_module/module_ch.cpp:48
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace CORBA
+{
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:44
+
+ extern TAO_AnyTypeCode_Export ::CORBA::TypeCode_ptr const _tc_UShortSeq;
+
+// TAO_IDL - Generated from
+// be\be_visitor_module/module_ch.cpp:66
+
+} // module CORBA
+
+// TAO_IDL - Generated from
+// be\be_visitor_traits.cpp:61
+
+// Traits specializations.
+namespace TAO
+{
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_sequence/any_op_ch.cpp:52
+
+TAO_AnyTypeCode_Export void operator<<= (CORBA::Any &, const CORBA::UShortSeq &); // copying version
+TAO_AnyTypeCode_Export void operator<<= (CORBA::Any &, CORBA::UShortSeq*); // noncopying version
+TAO_AnyTypeCode_Export CORBA::Boolean operator>>= (const CORBA::Any &, CORBA::UShortSeq *&); // deprecated
+TAO_AnyTypeCode_Export CORBA::Boolean operator>>= (const CORBA::Any &, const CORBA::UShortSeq *&);
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:955
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#if defined (__BORLANDC__)
+#pragma option pop
+#endif /* __BORLANDC__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* ifndef */
+
+
diff --git a/TAO/tao/AnyTypeCode/Union_TypeCode.cpp b/TAO/tao/AnyTypeCode/Union_TypeCode.cpp
new file mode 100644
index 00000000000..25aba5c6340
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Union_TypeCode.cpp
@@ -0,0 +1,463 @@
+// $Id$
+
+#ifndef TAO_UNION_TYPECODE_CPP
+#define TAO_UNION_TYPECODE_CPP
+
+#include "tao/AnyTypeCode/Union_TypeCode.h"
+#include "tao/AnyTypeCode/TypeCode_Case_Base_T.h"
+
+#ifndef __ACE_INLINE__
+# include "tao/AnyTypeCode/Union_TypeCode.inl"
+#endif /* !__ACE_INLINE__ */
+
+#include "tao/SystemException.h"
+#include "tao/AnyTypeCode/Any.h"
+
+#include "ace/Value_Ptr.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template <typename StringType,
+ typename TypeCodeType,
+ class CaseArrayType,
+ class RefCountPolicy>
+bool
+TAO::TypeCode::Union<StringType,
+ TypeCodeType,
+ CaseArrayType,
+ RefCountPolicy>::tao_marshal (
+ TAO_OutputCDR & cdr,
+ CORBA::ULong offset) const
+{
+ // A tk_union TypeCode has a "complex" parameter list type (see
+ // Table 15-2 in Section 15.3.5.1 "TypeCode" in the CDR section of
+ // the CORBA specification), meaning that it must be marshaled into
+ // a CDR encapsulation.
+
+ // Create a CDR encapsulation.
+ TAO_OutputCDR enc;
+
+ // Account for the encoded CDR encapsulation length and byte order.
+ //
+ // Aligning on an octet since the next value after the CDR
+ // encapsulation length will always be the byte order octet/boolean
+ // in this case.
+ offset = ACE_align_binary (offset + 4,
+ ACE_CDR::OCTET_ALIGN);
+
+ bool const success =
+ (enc << TAO_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER))
+ && (enc << TAO_OutputCDR::from_string (this->base_attributes_.id (), 0))
+ && (enc << TAO_OutputCDR::from_string (this->base_attributes_.name (), 0))
+ && marshal (enc,
+ Traits<StringType>::get_typecode (this->discriminant_type_),
+ offset + enc.total_length ())
+ && (enc << this->default_index_)
+ && (enc << this->ncases_);
+
+ if (!success)
+ return false;
+
+ offset += enc.total_length ();
+
+ for (CORBA::ULong i = 0; i < this->ncases_; ++i)
+ {
+ TAO_OutputCDR case_enc;
+ offset = ACE_align_binary (offset,
+ ACE_CDR::LONG_ALIGN);
+
+ case_type const & c = *this->cases_[i];
+
+ if (!c.marshal (case_enc, offset))
+ return false;
+
+ offset += case_enc.total_length ();
+
+ if (!enc.write_octet_array_mb (case_enc.begin ()))
+ return false;
+ }
+
+ return
+ cdr << static_cast<CORBA::ULong> (enc.total_length ())
+ && cdr.write_octet_array_mb (enc.begin ());
+}
+
+template <typename StringType,
+ typename TypeCodeType,
+ class CaseArrayType,
+ class RefCountPolicy>
+void
+TAO::TypeCode::Union<StringType,
+ TypeCodeType,
+ CaseArrayType,
+ RefCountPolicy>::tao_duplicate (void)
+{
+ this->RefCountPolicy::add_ref ();
+}
+
+template <typename StringType,
+ typename TypeCodeType,
+ class CaseArrayType,
+ class RefCountPolicy>
+void
+TAO::TypeCode::Union<StringType,
+ TypeCodeType,
+ CaseArrayType,
+ RefCountPolicy>::tao_release (void)
+{
+ this->RefCountPolicy::remove_ref ();
+}
+
+template <typename StringType,
+ typename TypeCodeType,
+ class CaseArrayType,
+ class RefCountPolicy>
+CORBA::Boolean
+TAO::TypeCode::Union<StringType,
+ TypeCodeType,
+ CaseArrayType,
+ RefCountPolicy>::equal_i (
+ CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const
+{
+ // These calls shouldn't throw since CORBA::TypeCode::equal()
+ // verified that the TCKind is the same as our's prior to invoking
+ // this method, meaning that the CORBA::tk_union TypeCode methods
+ // are supported.
+
+ CORBA::ULong const tc_count =
+ tc->member_count (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ CORBA::Long tc_def = tc->default_index (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ if (tc_count != this->ncases_
+ || tc_def != this->default_index_)
+ return false;
+
+ // Check the discriminator type.
+ CORBA::TypeCode_var tc_discriminator =
+ tc->discriminator_type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ CORBA::Boolean const equal_discriminators =
+ Traits<StringType>::get_typecode (this->discriminant_type_)->equal (
+ tc_discriminator.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ if (!equal_discriminators)
+ return false;
+
+ for (CORBA::ULong i = 0; i < this->ncases_; ++i)
+ {
+ if (this->default_index_ > -1
+ && static_cast<CORBA::ULong> (this->default_index_) == i)
+ {
+ // Don't bother checking equality of default case label. It
+ // will always be the zero octet (the CDR encoded value is
+ // ignored).
+ continue;
+ }
+
+ case_type const & lhs_case = *this->cases_[i];
+
+ bool const equal_case =
+ lhs_case.equal (i,
+ tc
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ if (!equal_case)
+ return false;
+ }
+
+ return true;
+}
+
+template <typename StringType,
+ typename TypeCodeType,
+ class CaseArrayType,
+ class RefCountPolicy>
+CORBA::Boolean
+TAO::TypeCode::Union<StringType,
+ TypeCodeType,
+ CaseArrayType,
+ RefCountPolicy>::equivalent_i (
+ CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const
+{
+ // Perform a structural comparison, excluding the name() and
+ // member_name() operations.
+
+ CORBA::ULong const tc_count =
+ tc->member_count (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ CORBA::Long tc_def = tc->default_index (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ if (tc_count != this->ncases_
+ || tc_def != this->default_index_)
+ return false;
+
+ CORBA::TypeCode_var tc_discriminator =
+ tc->discriminator_type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ CORBA::Boolean const equiv_discriminators =
+ Traits<StringType>::get_typecode (this->discriminant_type_)->equivalent (
+ tc_discriminator.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ if (!equiv_discriminators)
+ return false;
+
+ for (CORBA::ULong i = 0; i < this->ncases_; ++i)
+ {
+ if (this->default_index_ > -1
+ && static_cast<CORBA::ULong> (this->default_index_) == i)
+ {
+ // Don't bother checking equality/equivalence of default
+ // case label. It will always be the zero octet (the CDR
+ // encoded value is ignored).
+ continue;
+ }
+
+ case_type const & lhs_case = *this->cases_[i];
+
+ bool const equivalent_case =
+ lhs_case.equivalent (i,
+ tc
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ if (!equivalent_case)
+ return false;
+ }
+
+ return true;
+}
+
+template <typename StringType,
+ typename TypeCodeType,
+ class CaseArrayType,
+ class RefCountPolicy>
+CORBA::TypeCode_ptr
+TAO::TypeCode::Union<StringType,
+ TypeCodeType,
+ CaseArrayType,
+ RefCountPolicy>::get_compact_typecode_i (
+ ACE_ENV_SINGLE_ARG_DECL) const
+{
+// typedef ACE::Value_Ptr<TAO::TypeCode::Case<CORBA::String_var,
+// CORBA::TypeCode_var> > elem_type;
+
+// ACE_Array_Base<elem_type> tc_cases (this->ncases_);
+
+// if (this->ncases_ > 0)
+// {
+// // Dynamically construct a new array of cases stripped of
+// // member names.
+
+// static char const empty_name[] = "";
+
+// for (CORBA::ULong i = 0; i < this->ncases_; ++i)
+// {
+// // Member names will be stripped, i.e. not embedded within
+// // the compact TypeCode.
+// tc_cases[i].name = empty_name;
+// tc_cases[i].type =
+// this->cases_[i]->type ()->get_compact_typecode (
+// ACE_ENV_ARG_PARAMETER);
+// ACE_CHECK_RETURN (CORBA::TypeCode::_nil ());
+// }
+// }
+
+// // Create the compact union TypeCode.
+// TAO_TypeCodeFactory_Adapter * adapter =
+// ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance (
+// TAO_ORB_Core::typecodefactory_adapter_name ());
+
+// if (adapter == 0)
+// {
+// ACE_THROW_RETURN (CORBA::INTERNAL (),
+// CORBA::TypeCode::_nil ());
+// }
+
+// return
+// adapter->create_union_tc (
+// this->base_attributes_.id (),
+// "", /* empty name */
+// Traits<StringType>::get_typecode (this->discriminant_type_),
+// tc_cases,
+// this->ncases_,
+// this->default_index_,
+// "",
+// Traits<StringType>::get_typecode (this->default_case_.type)
+// ACE_ENV_ARG_PARAMETER);
+// ACE_CHECK_RETURN (CORBA::TypeCode::_nil ());
+
+ ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), CORBA::TypeCode::_nil ());
+
+ ACE_NOTREACHED (return CORBA::TypeCode::_nil ());
+}
+
+template <typename StringType,
+ typename TypeCodeType,
+ class CaseArrayType,
+ class RefCountPolicy>
+char const *
+TAO::TypeCode::Union<StringType,
+ TypeCodeType,
+ CaseArrayType,
+ RefCountPolicy>::id_i (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED) const
+{
+ // Ownership is retained by the TypeCode, as required by the C++
+ // mapping.
+ return this->base_attributes_.id ();
+}
+
+template <typename StringType,
+ typename TypeCodeType,
+ class CaseArrayType,
+ class RefCountPolicy>
+char const *
+TAO::TypeCode::Union<StringType,
+ TypeCodeType,
+ CaseArrayType,
+ RefCountPolicy>::name_i (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED) const
+{
+ // Ownership is retained by the TypeCode, as required by the C++
+ // mapping.
+ return this->base_attributes_.name ();
+}
+
+template <typename StringType,
+ typename TypeCodeType,
+ class CaseArrayType,
+ class RefCountPolicy>
+CORBA::ULong
+TAO::TypeCode::Union<StringType,
+ TypeCodeType,
+ CaseArrayType,
+ RefCountPolicy>::member_count_i (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED) const
+{
+ return this->ncases_;
+}
+
+template <typename StringType,
+ typename TypeCodeType,
+ class CaseArrayType,
+ class RefCountPolicy>
+char const *
+TAO::TypeCode::Union<StringType,
+ TypeCodeType,
+ CaseArrayType,
+ RefCountPolicy>::member_name_i (CORBA::ULong index
+ ACE_ENV_ARG_DECL) const
+{
+ // Ownership is retained by the TypeCode, as required by the C++
+ // mapping.
+ if (index >= this->ncases_)
+ ACE_THROW_RETURN (CORBA::TypeCode::Bounds (), 0);
+
+ return this->cases_[index]->name ();
+}
+
+template <typename StringType,
+ typename TypeCodeType,
+ class CaseArrayType,
+ class RefCountPolicy>
+CORBA::TypeCode_ptr
+TAO::TypeCode::Union<StringType,
+ TypeCodeType,
+ CaseArrayType,
+ RefCountPolicy>::member_type_i (CORBA::ULong index
+ ACE_ENV_ARG_DECL) const
+{
+ if (index >= this->ncases_)
+ ACE_THROW_RETURN (CORBA::TypeCode::Bounds (),
+ CORBA::TypeCode::_nil ());
+
+ return CORBA::TypeCode::_duplicate (this->cases_[index]->type ());
+}
+
+template <typename StringType,
+ typename TypeCodeType,
+ class CaseArrayType,
+ class RefCountPolicy>
+CORBA::Any *
+TAO::TypeCode::Union<StringType,
+ TypeCodeType,
+ CaseArrayType,
+ RefCountPolicy>::member_label_i (CORBA::ULong index
+ ACE_ENV_ARG_DECL) const
+{
+ if (index >= this->ncases_)
+ ACE_THROW_RETURN (CORBA::TypeCode::Bounds (),
+ 0);
+
+ // Default case.
+ if (this->default_index_ > -1
+ && static_cast<CORBA::ULong> (this->default_index_) == index)
+ {
+ CORBA::Any * any = 0;
+ ACE_NEW_THROW_EX (any,
+ CORBA::Any,
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (0);
+
+ CORBA::Any_var safe_any (any);
+
+ // Default case's label is a zero octet.
+ CORBA::Any::from_octet const zero_octet (0);
+
+ // Default case/member has a zero octet label value.
+ (*any) <<= zero_octet;
+
+ return safe_any._retn ();
+ }
+
+ // Non-default cases.
+ return this->cases_[index]->label (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+template <typename StringType,
+ typename TypeCodeType,
+ class CaseArrayType,
+ class RefCountPolicy>
+CORBA::TypeCode_ptr
+TAO::TypeCode::Union<StringType,
+ TypeCodeType,
+ CaseArrayType,
+ RefCountPolicy>::discriminator_type_i (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED) const
+{
+ return
+ CORBA::TypeCode::_duplicate (
+ Traits<StringType>::get_typecode (this->discriminant_type_));
+}
+
+template <typename StringType,
+ typename TypeCodeType,
+ class CaseArrayType,
+ class RefCountPolicy>
+CORBA::Long
+TAO::TypeCode::Union<StringType,
+ TypeCodeType,
+ CaseArrayType,
+ RefCountPolicy>::default_index_i (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED) const
+{
+ return this->default_index_;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_UNION_TYPECODE_CPP */
diff --git a/TAO/tao/AnyTypeCode/Union_TypeCode.h b/TAO/tao/AnyTypeCode/Union_TypeCode.h
new file mode 100644
index 00000000000..8089aeea48f
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Union_TypeCode.h
@@ -0,0 +1,182 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Union_TypeCode.h
+ *
+ * $Id$
+ *
+ * Header file for a @c tk_union CORBA::TypeCode.
+ *
+ * @author Ossama Othman
+ */
+//=============================================================================
+
+#ifndef TAO_UNION_TYPECODE_H
+#define TAO_UNION_TYPECODE_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/AnyTypeCode/TypeCode.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/AnyTypeCode/TypeCode_Base_Attributes.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace TypeCode
+ {
+
+ /**
+ * @class Union
+ *
+ * @brief @c CORBA::TypeCode implementation for an OMG IDL
+ * @c union.
+ *
+ * This class implements a @c CORBA::TypeCode for an OMG IDL
+ * @c union.
+ */
+ template <typename StringType,
+ typename TypeCodeType,
+ class CaseArrayType,
+ class RefCountPolicy>
+ class Union
+ : public CORBA::TypeCode,
+ private RefCountPolicy
+ {
+ public:
+
+ /// @typedef Type of individual case array element, not the
+ /// array itself.
+ typedef TAO::TypeCode::Case<StringType, TypeCodeType> case_type;
+
+ /// Constructor.
+ Union (char const * id,
+ char const * name,
+#if defined (__BORLANDC__) && (__BORLANDC__ < 0x572)
+ // Borland C++ currently can't handle a reference to
+ // const pointer to const CORBA::TypeCode_ptr
+ TypeCodeType discriminant_type,
+#else
+ TypeCodeType const & discriminant_type,
+#endif
+ CaseArrayType const & cases,
+ CORBA::ULong ncases,
+ CORBA::Long default_index);
+
+ /// Constructor used for recursive TypeCodes.
+ Union (CORBA::TCKind kind,
+ char const * id);
+
+ /**
+ * @name TAO-specific @c CORBA::TypeCode Methods
+ *
+ * Methods required by TAO's implementation of the
+ * @c CORBA::TypeCode class.
+ *
+ * @see @c CORBA::TypeCode
+ */
+ //@{
+ virtual bool tao_marshal (TAO_OutputCDR & cdr,
+ CORBA::ULong offset) const;
+ virtual void tao_duplicate (void);
+ virtual void tao_release (void);
+ //@}
+
+ protected:
+
+ /**
+ * @name @c TAO CORBA::TypeCode Template Methods
+ *
+ * @c tk_union @c CORBA::TypeCode -specific template methods.
+ *
+ * @see @c CORBA::TypeCode
+ */
+ //@{
+ virtual CORBA::Boolean equal_i (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const;
+ virtual CORBA::Boolean equivalent_i (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const;
+ virtual CORBA::TypeCode_ptr get_compact_typecode_i (
+ ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual char const * id_i (ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual char const * name_i (ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual CORBA::ULong member_count_i (ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual char const * member_name_i (CORBA::ULong index
+ ACE_ENV_ARG_DECL) const;
+ virtual CORBA::TypeCode_ptr member_type_i (CORBA::ULong index
+ ACE_ENV_ARG_DECL) const;
+ virtual CORBA::Any * member_label_i (CORBA::ULong index
+ ACE_ENV_ARG_DECL) const;
+ virtual CORBA::TypeCode_ptr discriminator_type_i (
+ ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual CORBA::Long default_index_i (ACE_ENV_SINGLE_ARG_DECL) const;
+ //@}
+
+ protected:
+
+ /**
+ * @c Union Attributes
+ *
+ * Attributes representing the structure of an OMG IDL
+ * @c union.
+ *
+ * @note These attributes are declared in the order in which
+ * they are marshaled into a CDR stream in order to
+ * increase cache hits by improving spatial locality.
+ */
+ //@{
+
+ /// Base attributes containing repository ID and name of
+ /// union type.
+ Base_Attributes<StringType> base_attributes_;
+
+ /// Type of IDL @c union discriminant.
+ TypeCodeType discriminant_type_;
+
+ /// Index of the default union case.
+ /**
+ * This value will be -1 if no default case is found in the
+ * union.
+ */
+ CORBA::Long default_index_;
+
+ /// The number of cases in the OMG IDL union, excluding the
+ /// @c default case.
+ CORBA::ULong ncases_;
+
+ /// Array of @c TAO::TypeCode::Case representing structure of
+ /// the OMG IDL defined @c union.
+ CaseArrayType cases_;
+
+ //@}
+
+ };
+
+ } // End namespace TypeCode
+} // End namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+
+#ifdef __ACE_INLINE__
+# include "tao/AnyTypeCode/Union_TypeCode.inl"
+#endif /* __ACE_INLINE__ */
+
+#ifdef ACE_TEMPLATES_REQUIRE_SOURCE
+# include "tao/AnyTypeCode/Union_TypeCode.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#ifdef ACE_TEMPLATES_REQUIRE_PRAGMA
+# pragma implementation ("Union_TypeCode.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_UNION_TYPECODE_H */
diff --git a/TAO/tao/AnyTypeCode/Union_TypeCode.inl b/TAO/tao/AnyTypeCode/Union_TypeCode.inl
new file mode 100644
index 00000000000..ab001d57baf
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Union_TypeCode.inl
@@ -0,0 +1,59 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template <typename StringType,
+ typename TypeCodeType,
+ class CaseArrayType,
+ class RefCountPolicy>
+ACE_INLINE
+TAO::TypeCode::Union<StringType,
+ TypeCodeType,
+ CaseArrayType,
+ RefCountPolicy>::Union (
+ char const * id,
+ char const * name,
+#if defined (__BORLANDC__) && (__BORLANDC__ < 0x572)
+ // Borland C++ currently can't handle a reference to
+ // const pointer to const CORBA::TypeCode_ptr
+ TypeCodeType discriminant_type,
+#else
+ TypeCodeType const & discriminant_type,
+#endif
+ CaseArrayType const & cases,
+ CORBA::ULong ncases,
+ CORBA::Long default_index)
+ : ::CORBA::TypeCode (CORBA::tk_union)
+ , RefCountPolicy ()
+ , base_attributes_ (id, name)
+ , discriminant_type_ (discriminant_type)
+ , default_index_ (default_index)
+ , ncases_ (ncases)
+ , cases_ (cases)
+{
+}
+
+template <typename StringType,
+ typename TypeCodeType,
+ class CaseArrayType,
+ class RefCountPolicy>
+ACE_INLINE
+TAO::TypeCode::Union<StringType,
+ TypeCodeType,
+ CaseArrayType,
+ RefCountPolicy>::Union (
+ CORBA::TCKind,
+ char const * id)
+ : ::CORBA::TypeCode (CORBA::tk_union)
+ , RefCountPolicy ()
+ , base_attributes_ (id)
+ , discriminant_type_ (0)
+ , default_index_ (-1)
+ , ncases_ (0)
+ , cases_ ()
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/AnyTypeCode/Union_TypeCode_Static.cpp b/TAO/tao/AnyTypeCode/Union_TypeCode_Static.cpp
new file mode 100644
index 00000000000..2d5677d317e
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Union_TypeCode_Static.cpp
@@ -0,0 +1,422 @@
+// $Id$
+
+#include "tao/AnyTypeCode/Union_TypeCode_Static.h"
+#include "tao/AnyTypeCode/TypeCode_Case_Base_T.h"
+#include "tao/AnyTypeCode/Any.h"
+
+#ifndef __ACE_INLINE__
+# include "tao/AnyTypeCode/Union_TypeCode_Static.inl"
+#endif /* !__ACE_INLINE__ */
+
+#include "tao/SystemException.h"
+
+#include "ace/Value_Ptr.h"
+
+
+ACE_RCSID (AnyTypeCode,
+ Union_TypeCode_Static,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+bool
+TAO::TypeCode::Union<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::TypeCode::Case<char const *,
+ CORBA::TypeCode_ptr const *> const * const *,
+ TAO::Null_RefCount_Policy>::tao_marshal (
+ TAO_OutputCDR & cdr,
+ CORBA::ULong offset) const
+{
+ // A tk_union TypeCode has a "complex" parameter list type (see
+ // Table 15-2 in Section 15.3.5.1 "TypeCode" in the CDR section of
+ // the CORBA specification), meaning that it must be marshaled into
+ // a CDR encapsulation.
+
+ // Create a CDR encapsulation.
+ TAO_OutputCDR enc;
+
+ // Account for the encoded CDR encapsulation length and byte order.
+ //
+ // Aligning on an octet since the next value after the CDR
+ // encapsulation length will always be the byte order octet/boolean
+ // in this case.
+ offset = ACE_align_binary (offset + 4,
+ ACE_CDR::OCTET_ALIGN);
+
+ bool const success =
+ (enc << TAO_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER))
+ && (enc << TAO_OutputCDR::from_string (this->base_attributes_.id (), 0))
+ && (enc << TAO_OutputCDR::from_string (this->base_attributes_.name (), 0))
+ && marshal (enc,
+ Traits<char const *>::get_typecode (this->discriminant_type_),
+ offset + enc.total_length ())
+ && (enc << this->default_index_)
+ && (enc << this->ncases_);
+
+ if (!success)
+ return false;
+
+ offset += enc.total_length ();
+
+ // Note that we handle the default case below, too.
+
+ for (CORBA::ULong i = 0; i < this->ncases_; ++i)
+ {
+ TAO_OutputCDR case_enc;
+ offset = ACE_align_binary (offset,
+ ACE_CDR::LONG_ALIGN);
+ case_type const & c = *this->cases_[i];
+
+ if (!c.marshal (case_enc, offset))
+ return false;
+
+ offset += case_enc.total_length ();
+
+ if (!enc.write_octet_array_mb (case_enc.begin ()))
+ return false;
+ }
+
+ return
+ cdr << static_cast<CORBA::ULong> (enc.total_length ())
+ && cdr.write_octet_array_mb (enc.begin ());
+}
+
+void
+TAO::TypeCode::Union<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::TypeCode::Case<char const *,
+ CORBA::TypeCode_ptr const *> const * const *,
+ TAO::Null_RefCount_Policy>::tao_duplicate (void)
+{
+}
+
+void
+TAO::TypeCode::Union<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::TypeCode::Case<char const *,
+ CORBA::TypeCode_ptr const *> const * const *,
+ TAO::Null_RefCount_Policy>::tao_release (void)
+{
+}
+
+CORBA::Boolean
+TAO::TypeCode::Union<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::TypeCode::Case<char const *,
+ CORBA::TypeCode_ptr const *> const * const *,
+ TAO::Null_RefCount_Policy>::equal_i (
+ CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const
+{
+ // These calls shouldn't throw since CORBA::TypeCode::equal()
+ // verified that the TCKind is the same as our's prior to invoking
+ // this method, meaning that the CORBA::tk_union TypeCode methods
+ // are supported.
+
+ CORBA::ULong const tc_count =
+ tc->member_count (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ CORBA::Long tc_def = tc->default_index (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ if (tc_count != this->ncases_
+ || tc_def != this->default_index_)
+ return false;
+
+ // Check the discriminator type.
+ CORBA::TypeCode_var tc_discriminator =
+ tc->discriminator_type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ CORBA::Boolean const equal_discriminators =
+ Traits<char const *>::get_typecode (this->discriminant_type_)->equal (
+ tc_discriminator.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ if (!equal_discriminators)
+ return false;
+
+ for (CORBA::ULong i = 0; i < this->ncases_; ++i)
+ {
+ if (this->default_index_ > -1
+ && static_cast<CORBA::ULong> (this->default_index_) == i)
+ {
+ // Don't bother checking equality of default case label. It
+ // will always be the zero octet (the CDR encoded value is
+ // ignored).
+ continue;
+ }
+
+ case_type const & lhs_case = *this->cases_[i];
+
+ bool const equal_case =
+ lhs_case.equal (i,
+ tc
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ if (!equal_case)
+ return false;
+ }
+
+ return true;
+}
+
+CORBA::Boolean
+TAO::TypeCode::Union<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::TypeCode::Case<char const *,
+ CORBA::TypeCode_ptr const *> const * const *,
+ TAO::Null_RefCount_Policy>::equivalent_i (
+ CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const
+{
+ // Perform a structural comparison, excluding the name() and
+ // member_name() operations.
+
+ CORBA::ULong const tc_count =
+ tc->member_count (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ CORBA::Long tc_def = tc->default_index (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ if (tc_count != this->ncases_
+ || tc_def != this->default_index_)
+ return false;
+
+ CORBA::TypeCode_var tc_discriminator =
+ tc->discriminator_type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ CORBA::Boolean const equiv_discriminators =
+ Traits<char const *>::get_typecode (this->discriminant_type_)->equivalent (
+ tc_discriminator.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ if (!equiv_discriminators)
+ return false;
+
+ for (CORBA::ULong i = 0; i < this->ncases_; ++i)
+ {
+ if (this->default_index_ > -1
+ && static_cast<CORBA::ULong> (this->default_index_) == i)
+ {
+ // Don't bother checking equality/equivalence of default
+ // case label. It will always be the zero octet (the CDR
+ // encoded value is ignored).
+ continue;
+ }
+
+ case_type const & lhs_case = *this->cases_[i];
+
+ bool const equivalent_case =
+ lhs_case.equivalent (i,
+ tc
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ if (!equivalent_case)
+ return false;
+ }
+
+ return true;
+}
+
+CORBA::TypeCode_ptr
+TAO::TypeCode::Union<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::TypeCode::Case<char const *,
+ CORBA::TypeCode_ptr const *> const * const *,
+ TAO::Null_RefCount_Policy>::get_compact_typecode_i (
+ ACE_ENV_SINGLE_ARG_DECL) const
+{
+// typedef ACE::Value_Ptr<TAO::TypeCode::Case<CORBA::String_var,
+// CORBA::TypeCode_var> > elem_type;
+
+// ACE_Array_Base<elem_type> tc_cases (this->ncases_);
+
+// if (this->ncases_ > 0)
+// {
+// // Dynamically construct a new array of cases stripped of
+// // member names.
+
+// static char const empty_name[] = "";
+
+// for (CORBA::ULong i = 0; i < this->ncases_; ++i)
+// {
+// // Member names will be stripped, i.e. not embedded within
+// // the compact TypeCode.
+// tc_cases[i].name = empty_name;
+// tc_cases[i].type =
+// this->cases_[i]->type ()->get_compact_typecode (
+// ACE_ENV_ARG_PARAMETER);
+// ACE_CHECK_RETURN (CORBA::TypeCode::_nil ());
+// }
+// }
+
+// // Create the compact union TypeCode.
+// TAO_TypeCodeFactory_Adapter * adapter =
+// ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance (
+// TAO_ORB_Core::typecodefactory_adapter_name ());
+
+// if (adapter == 0)
+// {
+// ACE_THROW_RETURN (CORBA::INTERNAL (),
+// CORBA::TypeCode::_nil ());
+// }
+
+// return
+// adapter->create_union_tc (
+// this->base_attributes_.id (),
+// "", /* empty name */
+// Traits<char const *>::get_typecode (this->discriminant_type_),
+// tc_cases,
+// this->ncases_,
+// this->default_index_,
+// "",
+// Traits<char const *>::get_typecode (this->default_case_.type)
+// ACE_ENV_ARG_PARAMETER);
+// ACE_CHECK_RETURN (CORBA::TypeCode::_nil ());
+
+ ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), CORBA::TypeCode::_nil ());
+}
+
+char const *
+TAO::TypeCode::Union<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::TypeCode::Case<char const *,
+ CORBA::TypeCode_ptr const *> const * const *,
+ TAO::Null_RefCount_Policy>::id_i (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED) const
+{
+ // Ownership is retained by the TypeCode, as required by the C++
+ // mapping.
+ return this->base_attributes_.id ();
+}
+
+char const *
+TAO::TypeCode::Union<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::TypeCode::Case<char const *,
+ CORBA::TypeCode_ptr const *> const * const *,
+ TAO::Null_RefCount_Policy>::name_i (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED) const
+{
+ // Ownership is retained by the TypeCode, as required by the C++
+ // mapping.
+ return this->base_attributes_.name ();
+}
+
+CORBA::ULong
+TAO::TypeCode::Union<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::TypeCode::Case<char const *,
+ CORBA::TypeCode_ptr const *> const * const *,
+ TAO::Null_RefCount_Policy>::member_count_i (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED) const
+{
+ return this->ncases_;
+}
+
+char const *
+TAO::TypeCode::Union<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::TypeCode::Case<char const *,
+ CORBA::TypeCode_ptr const *> const * const *,
+ TAO::Null_RefCount_Policy>::member_name_i (
+ CORBA::ULong index
+ ACE_ENV_ARG_DECL) const
+{
+ // Ownership is retained by the TypeCode, as required by the C++
+ // mapping.
+ if (index >= this->ncases_)
+ ACE_THROW_RETURN (CORBA::TypeCode::Bounds (), 0);
+
+ return this->cases_[index]->name ();
+}
+
+CORBA::TypeCode_ptr
+TAO::TypeCode::Union<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::TypeCode::Case<char const *,
+ CORBA::TypeCode_ptr const *> const * const *,
+ TAO::Null_RefCount_Policy>::member_type_i (
+ CORBA::ULong index
+ ACE_ENV_ARG_DECL) const
+{
+ if (index >= this->ncases_)
+ ACE_THROW_RETURN (CORBA::TypeCode::Bounds (),
+ CORBA::TypeCode::_nil ());
+
+ return CORBA::TypeCode::_duplicate (this->cases_[index]->type ());
+}
+
+CORBA::Any *
+TAO::TypeCode::Union<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::TypeCode::Case<char const *,
+ CORBA::TypeCode_ptr const *> const * const *,
+ TAO::Null_RefCount_Policy>::member_label_i (
+ CORBA::ULong index
+ ACE_ENV_ARG_DECL) const
+{
+ if (index >= this->ncases_)
+ ACE_THROW_RETURN (CORBA::TypeCode::Bounds (),
+ 0);
+
+ // Default case.
+ if (this->default_index_ > -1
+ && static_cast<CORBA::ULong> (this->default_index_) == index)
+ {
+ CORBA::Any * any = 0;
+ ACE_NEW_THROW_EX (any,
+ CORBA::Any,
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (0);
+
+ CORBA::Any_var safe_any (any);
+
+ // Default case's label is a zero octet.
+ CORBA::Any::from_octet const zero_octet (0);
+
+ // Default case/member has a zero octet label value.
+ (*any) <<= zero_octet;
+
+ return safe_any._retn ();
+ }
+
+ // Non-default cases.
+ return this->cases_[index]->label (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+CORBA::TypeCode_ptr
+TAO::TypeCode::Union<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::TypeCode::Case<char const *,
+ CORBA::TypeCode_ptr const *> const * const *,
+ TAO::Null_RefCount_Policy>::discriminator_type_i (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED) const
+{
+ return
+ CORBA::TypeCode::_duplicate (
+ Traits<char const *>::get_typecode (this->discriminant_type_));
+}
+
+CORBA::Long
+TAO::TypeCode::Union<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::TypeCode::Case<char const *,
+ CORBA::TypeCode_ptr const *> const * const *,
+ TAO::Null_RefCount_Policy>::default_index_i (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED) const
+{
+ return this->default_index_;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/AnyTypeCode/Union_TypeCode_Static.h b/TAO/tao/AnyTypeCode/Union_TypeCode_Static.h
new file mode 100644
index 00000000000..bf58345e03f
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Union_TypeCode_Static.h
@@ -0,0 +1,171 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Union_TypeCode_Static.h
+ *
+ * $Id$
+ *
+ * Header file for a static @c tk_union CORBA::TypeCode.
+ *
+ * @author Ossama Othman
+ */
+//=============================================================================
+
+#ifndef TAO_UNION_TYPECODE_STATIC_H
+#define TAO_UNION_TYPECODE_STATIC_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/AnyTypeCode/TypeCode.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/AnyTypeCode/TypeCode_Base_Attributes.h"
+#include "tao/AnyTypeCode/Null_RefCount_Policy.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace TypeCode
+ {
+ template <typename StringType,
+ typename TypeCodeType,
+ class CaseArrayType,
+ class RefCountPolicy> class Union;
+ template <typename StringType, typename TypeCodeType> class Case;
+ /**
+ * @class Union
+ *
+ * @brief @c CORBA::TypeCode implementation for an OMG IDL
+ * @c union.
+ *
+ * This class implements a @c CORBA::TypeCode for an OMG IDL
+ * @c union.
+ */
+ template<>
+ class TAO_AnyTypeCode_Export Union<char const *,
+ CORBA::TypeCode_ptr const *,
+ Case<char const *,
+ CORBA::TypeCode_ptr const *> const * const *,
+ TAO::Null_RefCount_Policy>
+ : public CORBA::TypeCode,
+ private TAO::Null_RefCount_Policy
+ {
+ public:
+
+ /// @typedef Type of individual case array element, not the
+ /// array itself.
+ typedef TAO::TypeCode::Case<char const *,
+ CORBA::TypeCode_ptr const *> case_type;
+
+ /// Constructor.
+ Union (char const * id,
+ char const * name,
+ CORBA::TypeCode_ptr const * discriminant_type,
+ Case<char const *,
+ CORBA::TypeCode_ptr const *> const * const * cases,
+ CORBA::ULong ncases,
+ CORBA::Long default_index);
+
+ /**
+ * @name TAO-specific @c CORBA::TypeCode Methods
+ *
+ * Methods required by TAO's implementation of the
+ * @c CORBA::TypeCode class.
+ *
+ * @see @c CORBA::TypeCode
+ */
+ //@{
+ virtual bool tao_marshal (TAO_OutputCDR & cdr,
+ CORBA::ULong offset) const;
+ virtual void tao_duplicate (void);
+ virtual void tao_release (void);
+ //@}
+
+ protected:
+
+ /**
+ * @name @c TAO CORBA::TypeCode Template Methods
+ *
+ * @c tk_union @c CORBA::TypeCode -specific template methods.
+ *
+ * @see @c CORBA::TypeCode
+ */
+ //@{
+ virtual CORBA::Boolean equal_i (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const;
+ virtual CORBA::Boolean equivalent_i (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const;
+ virtual CORBA::TypeCode_ptr get_compact_typecode_i (
+ ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual char const * id_i (ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual char const * name_i (ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual CORBA::ULong member_count_i (ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual char const * member_name_i (CORBA::ULong index
+ ACE_ENV_ARG_DECL) const;
+ virtual CORBA::TypeCode_ptr member_type_i (CORBA::ULong index
+ ACE_ENV_ARG_DECL) const;
+ virtual CORBA::Any * member_label_i (CORBA::ULong index
+ ACE_ENV_ARG_DECL) const;
+ virtual CORBA::TypeCode_ptr discriminator_type_i (
+ ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual CORBA::Long default_index_i (ACE_ENV_SINGLE_ARG_DECL) const;
+ //@}
+
+ private:
+
+ /**
+ * @c Union Attributes
+ *
+ * Attributes representing the structure of an OMG IDL
+ * @c union.
+ *
+ * @note These attributes are declared in the order in which
+ * they are marshaled into a CDR stream in order to
+ * increase cache hits by improving spatial locality.
+ */
+ //@{
+
+ /// Base attributes containing repository ID and name of
+ /// union type.
+ Base_Attributes<char const *> const base_attributes_;
+
+ /// Type of IDL @c union discriminant.
+ CORBA::TypeCode_ptr const * const discriminant_type_;
+
+ /// Index of the default union case.
+ /**
+ * This value will be -1 if no default case is found in the
+ * union.
+ */
+ CORBA::Long const default_index_;
+
+ /// The number of cases in the OMG IDL union, excluding the
+ /// @c default case.
+ CORBA::ULong const ncases_;
+
+ /// Array of @c TAO::TypeCode::Case representing structure of
+ /// the OMG IDL defined @c union.
+ Case<char const *,
+ CORBA::TypeCode_ptr const *> const * const * const cases_;
+
+ //@}
+
+ };
+
+ } // End namespace TypeCode
+} // End namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#ifdef __ACE_INLINE__
+# include "tao/AnyTypeCode/Union_TypeCode_Static.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_UNION_TYPECODE_STATIC_H */
diff --git a/TAO/tao/AnyTypeCode/Union_TypeCode_Static.inl b/TAO/tao/AnyTypeCode/Union_TypeCode_Static.inl
new file mode 100644
index 00000000000..39b9465a2da
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Union_TypeCode_Static.inl
@@ -0,0 +1,29 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO::TypeCode::Union<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::TypeCode::Case<char const *,
+ CORBA::TypeCode_ptr const *> const * const *,
+ TAO::Null_RefCount_Policy>::Union (
+ char const * id,
+ char const * name,
+ CORBA::TypeCode_ptr const * discriminant_type,
+ Case<char const *, CORBA::TypeCode_ptr const *> const * const * cases,
+ CORBA::ULong ncases,
+ CORBA::Long default_index)
+ : ::CORBA::TypeCode (CORBA::tk_union)
+ , ::TAO::Null_RefCount_Policy ()
+ , base_attributes_ (id, name)
+ , discriminant_type_ (discriminant_type)
+ , default_index_ (default_index)
+ , ncases_ (ncases)
+ , cases_ (cases)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/AnyTypeCode/ValueModifier.pidl b/TAO/tao/AnyTypeCode/ValueModifier.pidl
new file mode 100644
index 00000000000..794ac4af092
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/ValueModifier.pidl
@@ -0,0 +1,38 @@
+// -*- IDL -*-
+
+// ================================================================
+/**
+ * @file ValueModifier.pidl
+ *
+ * $Id$
+ *
+ * This file was used to generate the code in ValueModifierC.* The command
+ * used to generate code is:
+ *
+ * tao_idl
+ * -o orig -Ge 1 -SS -Sci -St
+ * -Wb,export_macro=TAO_Export
+ * -Wb,export_include="tao/TAO_Export.h"
+ * -Wb,pre_include="ace/pre.h"
+ * -Wb,post_include="ace/post.h"
+ * -Wb,versioning_begin=TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+ * -Wb,versioning_end=TAO_END_VERSIONED_NAMESPACE_DECL
+ * ValueModifier.pidl
+ */
+// ================================================================
+
+#ifndef TAO_VALUEMODIFIER_PIDL
+#define TAO_VALUEMODIFIER_PIDL
+
+#pragma prefix "omg.org"
+
+module CORBA
+{
+ typedef short ValueModifier;
+ const ValueModifier VM_NONE = 0;
+ const ValueModifier VM_CUSTOM = 1;
+ const ValueModifier VM_ABSTRACT = 2;
+ const ValueModifier VM_TRUNCATABLE = 3;
+};
+
+#endif /* TAO_VALUEMODIFIER_PIDL */
diff --git a/TAO/tao/AnyTypeCode/Value_TypeCode.cpp b/TAO/tao/AnyTypeCode/Value_TypeCode.cpp
new file mode 100644
index 00000000000..8955d4be01b
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Value_TypeCode.cpp
@@ -0,0 +1,465 @@
+// $Id$
+
+#ifndef TAO_VALUE_TYPECODE_CPP
+#define TAO_VALUE_TYPECODE_CPP
+
+#include "tao/AnyTypeCode/Value_TypeCode.h"
+#include "tao/AnyTypeCode/TypeCode_Value_Field.h"
+#include "tao/CDR.h"
+
+#include "tao/ORB_Core.h"
+#include "tao/TypeCodeFactory_Adapter.h"
+
+#include "ace/Dynamic_Service.h"
+
+#ifndef __ACE_INLINE__
+# include "tao/AnyTypeCode/Value_TypeCode.inl"
+#endif /* !__ACE_INLINE__ */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template <typename StringType,
+ typename TypeCodeType,
+ class FieldArrayType,
+ class RefCountPolicy>
+bool
+TAO::TypeCode::Value<StringType,
+ TypeCodeType,
+ FieldArrayType,
+ RefCountPolicy>::tao_marshal (
+ TAO_OutputCDR & cdr,
+ CORBA::ULong offset) const
+{
+ // A tk_value TypeCode has a "complex" parameter list type (see
+ // Table 15-2 in Section 15.3.5.1 "TypeCode" in the CDR section of
+ // the CORBA specification), meaning that it must be marshaled into
+ // a CDR encapsulation.
+
+ // Create a CDR encapsulation.
+ TAO_OutputCDR enc;
+
+ // Account for the encoded CDR encapsulation length and byte order.
+ //
+ // Aligning on an octet since the next value after the CDR
+ // encapsulation length will always be the byte order octet/boolean
+ // in this case.
+ offset = ACE_align_binary (offset + 4,
+ ACE_CDR::OCTET_ALIGN);
+
+ bool const success =
+ (enc << TAO_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER))
+ && (enc << TAO_OutputCDR::from_string (this->base_attributes_.id (), 0))
+ && (enc << TAO_OutputCDR::from_string (this->base_attributes_.name (), 0))
+ && (enc << this->type_modifier_)
+ && marshal (enc,
+ Traits<StringType>::get_typecode (this->concrete_base_),
+ offset + enc.total_length ())
+ && (enc << this->nfields_);
+
+ if (!success)
+ return false;
+
+ Value_Field<StringType, TypeCodeType> const * const begin =
+ &this->fields_[0];
+ Value_Field<StringType, TypeCodeType> const * const end =
+ begin + this->nfields_;
+
+ for (Value_Field<StringType, TypeCodeType> const * i = begin; i != end; ++i)
+ {
+ Value_Field<StringType, TypeCodeType> const & field = *i;
+
+ if (!(enc << Traits<StringType>::get_string (field.name))
+ || !marshal (enc,
+ Traits<StringType>::get_typecode (field.type),
+ offset + enc.total_length ())
+ || !(enc << field.visibility))
+ return false;
+ }
+
+ return
+ cdr << static_cast<CORBA::ULong> (enc.total_length ())
+ && cdr.write_octet_array_mb (enc.begin ());
+}
+
+template <typename StringType,
+ typename TypeCodeType,
+ class FieldArrayType,
+ class RefCountPolicy>
+void
+TAO::TypeCode::Value<StringType,
+ TypeCodeType,
+ FieldArrayType,
+ RefCountPolicy>::tao_duplicate (void)
+{
+ this->RefCountPolicy::add_ref ();
+}
+
+template <typename StringType,
+ typename TypeCodeType,
+ class FieldArrayType,
+ class RefCountPolicy>
+void
+TAO::TypeCode::Value<StringType,
+ TypeCodeType,
+ FieldArrayType,
+ RefCountPolicy>::tao_release (void)
+{
+ this->RefCountPolicy::remove_ref ();
+}
+
+template <typename StringType,
+ typename TypeCodeType,
+ class FieldArrayType,
+ class RefCountPolicy>
+CORBA::Boolean
+TAO::TypeCode::Value<StringType,
+ TypeCodeType,
+ FieldArrayType,
+ RefCountPolicy>::equal_i (
+ CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const
+{
+ // None of these calls should throw since CORBA::TypeCode::equal()
+ // verified that the TCKind is the same as our's prior to invoking
+ // this method.
+
+ CORBA::ValueModifier const tc_type_modifier =
+ tc->type_modifier (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ if (tc_type_modifier != this->type_modifier_)
+ return false;
+
+ CORBA::TypeCode_var rhs_concrete_base_type =
+ tc->concrete_base_type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ CORBA::Boolean const equal_concrete_base_types =
+ this->equal (rhs_concrete_base_type.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ if (!equal_concrete_base_types)
+ return false;
+
+ CORBA::ULong const tc_nfields =
+ tc->member_count (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ if (tc_nfields != this->nfields_)
+ return false;
+
+ for (CORBA::ULong i = 0; i < this->nfields_; ++i)
+ {
+ Value_Field<StringType, TypeCodeType> const & lhs_field =
+ this->fields_[i];
+
+ CORBA::Visibility const lhs_visibility = lhs_field.visibility;
+ CORBA::Visibility const rhs_visibility =
+ tc->member_visibility (i
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ if (lhs_visibility != rhs_visibility)
+ return false;
+
+ char const * const lhs_name =
+ Traits<StringType>::get_string (lhs_field.name);;
+ char const * const rhs_name = tc->member_name (i
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ if (ACE_OS::strcmp (lhs_name, rhs_name) != 0)
+ return false;
+
+ CORBA::TypeCode_ptr const lhs_tc =
+ Traits<StringType>::get_typecode (lhs_field.type);
+ CORBA::TypeCode_var const rhs_tc =
+ tc->member_type (i
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ CORBA::Boolean const equal_members =
+ lhs_tc->equal (rhs_tc.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ if (!equal_members)
+ return false;
+ }
+
+ return true;
+}
+
+template <typename StringType,
+ typename TypeCodeType,
+ class FieldArrayType,
+ class RefCountPolicy>
+CORBA::Boolean
+TAO::TypeCode::Value<StringType,
+ TypeCodeType,
+ FieldArrayType,
+ RefCountPolicy>::equivalent_i (
+ CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const
+{
+ CORBA::ValueModifier const tc_type_modifier =
+ tc->type_modifier (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ if (tc_type_modifier != this->type_modifier_)
+ return false;
+
+ CORBA::TypeCode_var rhs_concrete_base_type =
+ tc->concrete_base_type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ CORBA::Boolean const equivalent_concrete_base_types =
+ this->equivalent (rhs_concrete_base_type.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ if (!equivalent_concrete_base_types)
+ return false;
+
+ // Perform a structural comparison, excluding the name() and
+ // member_name() operations.
+
+ CORBA::ULong const tc_nfields =
+ tc->member_count (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ if (tc_nfields != this->nfields_)
+ return false;
+
+ for (CORBA::ULong i = 0; i < this->nfields_; ++i)
+ {
+ Value_Field<StringType, TypeCodeType> const & lhs_field =
+ this->fields_[i];
+
+ CORBA::Visibility const lhs_visibility =
+ lhs_field.visibility;
+ CORBA::Visibility const rhs_visibility =
+ tc->member_visibility (i
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ if (lhs_visibility != rhs_visibility)
+ return false;
+
+ CORBA::TypeCode_ptr const lhs_tc =
+ Traits<StringType>::get_typecode (lhs_field.type);
+ CORBA::TypeCode_var const rhs_tc =
+ tc->member_type (i
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ CORBA::Boolean const equiv_types =
+ lhs_tc->equivalent (rhs_tc.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ if (!equiv_types)
+ return false;
+ }
+
+ return true;
+}
+
+template <typename StringType,
+ typename TypeCodeType,
+ class FieldArrayType,
+ class RefCountPolicy>
+CORBA::TypeCode_ptr
+TAO::TypeCode::Value<StringType,
+ TypeCodeType,
+ FieldArrayType,
+ RefCountPolicy>::get_compact_typecode_i (
+ ACE_ENV_SINGLE_ARG_DECL) const
+{
+ ACE_Array_Base<Value_Field<CORBA::String_var, CORBA::TypeCode_var> >
+ tc_fields (this->nfields_);
+
+ if (this->nfields_ > 0)
+ {
+ // Dynamically construct a new array of fields stripped of
+ // member names.
+
+ static char const empty_name[] = "";
+
+ for (CORBA::ULong i = 0; i < this->nfields_; ++i)
+ {
+ // Member names will be stripped, i.e. not embedded within
+ // the compact TypeCode.
+
+ tc_fields[i].name = empty_name;
+ tc_fields[i].type =
+ Traits<StringType>::get_typecode (
+ this->fields_[i].type)->get_compact_typecode (
+ ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::TypeCode::_nil ());
+ tc_fields[i].visibility = this->fields_[i].visibility;
+ }
+ }
+
+ TAO_TypeCodeFactory_Adapter * const adapter =
+ ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance (
+ TAO_ORB_Core::typecodefactory_adapter_name ());
+
+ if (adapter == 0)
+ {
+ ACE_THROW_RETURN (CORBA::INTERNAL (),
+ CORBA::TypeCode::_nil ());
+ }
+
+ return
+ adapter->create_value_event_tc (
+ this->kind_,
+ this->base_attributes_.id (),
+ "", // empty name
+ this->type_modifier_,
+ Traits<StringType>::get_typecode (this->concrete_base_),
+ tc_fields,
+ this->nfields_
+ ACE_ENV_ARG_PARAMETER);
+}
+
+template <typename StringType,
+ typename TypeCodeType,
+ class FieldArrayType,
+ class RefCountPolicy>
+char const *
+TAO::TypeCode::Value<StringType,
+ TypeCodeType,
+ FieldArrayType,
+ RefCountPolicy>::id_i (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED) const
+{
+ // Ownership is retained by the TypeCode, as required by the C++
+ // mapping.
+ return this->base_attributes_.id ();
+}
+
+template <typename StringType,
+ typename TypeCodeType,
+ class FieldArrayType,
+ class RefCountPolicy>
+char const *
+TAO::TypeCode::Value<StringType,
+ TypeCodeType,
+ FieldArrayType,
+ RefCountPolicy>::name_i (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED) const
+{
+ // Ownership is retained by the TypeCode, as required by the C++
+ // mapping.
+ return this->base_attributes_.name ();
+}
+
+template <typename StringType,
+ typename TypeCodeType,
+ class FieldArrayType,
+ class RefCountPolicy>
+CORBA::ULong
+TAO::TypeCode::Value<StringType,
+ TypeCodeType,
+ FieldArrayType,
+ RefCountPolicy>::member_count_i (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED) const
+{
+ return this->nfields_;
+}
+
+template <typename StringType,
+ typename TypeCodeType,
+ class FieldArrayType,
+ class RefCountPolicy>
+char const *
+TAO::TypeCode::Value<StringType,
+ TypeCodeType,
+ FieldArrayType,
+ RefCountPolicy>::member_name_i (
+ CORBA::ULong index
+ ACE_ENV_ARG_DECL) const
+{
+ // Ownership is retained by the TypeCode, as required by the C++
+ // mapping.
+ if (index >= this->nfields_)
+ ACE_THROW_RETURN (CORBA::TypeCode::Bounds (), 0);
+
+ return Traits<StringType>::get_string (this->fields_[index].name);
+}
+
+template <typename StringType,
+ typename TypeCodeType,
+ class FieldArrayType,
+ class RefCountPolicy>
+CORBA::TypeCode_ptr
+TAO::TypeCode::Value<StringType,
+ TypeCodeType,
+ FieldArrayType,
+ RefCountPolicy>::member_type_i (
+ CORBA::ULong index
+ ACE_ENV_ARG_DECL) const
+{
+ if (index >= this->nfields_)
+ ACE_THROW_RETURN (CORBA::TypeCode::Bounds (),
+ CORBA::TypeCode::_nil ());
+
+ return
+ CORBA::TypeCode::_duplicate (
+ Traits<StringType>::get_typecode (this->fields_[index].type));
+}
+
+template <typename StringType,
+ typename TypeCodeType,
+ class FieldArrayType,
+ class RefCountPolicy>
+CORBA::Visibility
+TAO::TypeCode::Value<StringType,
+ TypeCodeType,
+ FieldArrayType,
+ RefCountPolicy>::member_visibility_i (
+ CORBA::ULong index
+ ACE_ENV_ARG_DECL) const
+{
+ if (index >= this->nfields_)
+ ACE_THROW_RETURN (CORBA::TypeCode::Bounds (),
+ CORBA::PRIVATE_MEMBER);
+
+ return this->fields_[index].visibility;
+}
+
+template <typename StringType,
+ typename TypeCodeType,
+ class FieldArrayType,
+ class RefCountPolicy>
+CORBA::ValueModifier
+TAO::TypeCode::Value<StringType,
+ TypeCodeType,
+ FieldArrayType,
+ RefCountPolicy>::type_modifier_i (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED) const
+{
+ return this->type_modifier_;
+}
+
+template <typename StringType,
+ typename TypeCodeType,
+ class FieldArrayType,
+ class RefCountPolicy>
+CORBA::TypeCode_ptr
+TAO::TypeCode::Value<StringType,
+ TypeCodeType,
+ FieldArrayType,
+ RefCountPolicy>::concrete_base_type_i (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED) const
+{
+ return
+ CORBA::TypeCode::_duplicate (
+ Traits<StringType>::get_typecode (this->concrete_base_));
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_VALUE_TYPECODE_CPP */
diff --git a/TAO/tao/AnyTypeCode/Value_TypeCode.h b/TAO/tao/AnyTypeCode/Value_TypeCode.h
new file mode 100644
index 00000000000..ffc18532e6f
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Value_TypeCode.h
@@ -0,0 +1,181 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Value_TypeCode.h
+ *
+ * $Id$
+ *
+ * Header file for a @c tk_value and @c tk_event
+ * @c CORBA::TypeCodes.
+ *
+ * @author Ossama Othman <ossama@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_VALUE_TYPECODE_H
+#define TAO_VALUE_TYPECODE_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/AnyTypeCode/TypeCode.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/AnyTypeCode/TypeCode_Base_Attributes.h"
+#include "tao/AnyTypeCode/ValueModifierC.h"
+#include "tao/AnyTypeCode/VisibilityC.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace TypeCode
+ {
+ template<typename StringType, typename TypeCodeType> struct Value_Field;
+
+ /**
+ * @class Value
+ *
+ * @brief @c CORBA::TypeCode implementation for an OMG IDL
+ * @c valuetype or @c event.
+ *
+ * This class implements a @c CORBA::TypeCode for an OMG IDL
+ * @c valuetype or @c event.
+ */
+ template <typename StringType,
+ typename TypeCodeType,
+ class FieldArrayType,
+ class RefCountPolicy>
+ class Value
+ : public CORBA::TypeCode,
+ private RefCountPolicy
+ {
+ public:
+
+ /// Constructor.
+ Value (CORBA::TCKind kind,
+ char const * id,
+ char const * name,
+ CORBA::ValueModifier modifier,
+#if defined (__BORLANDC__) && (__BORLANDC__ < 0x572)
+ // Borland C++ currently can't handle a reference to
+ // const pointer to const CORBA::TypeCode_ptr
+ TypeCodeType concrete_base,
+#else
+ TypeCodeType const & concrete_base,
+#endif
+ FieldArrayType const & fields,
+ CORBA::ULong nfields);
+
+ /// Constructor used for recursive TypeCodes.
+ Value (CORBA::TCKind kind,
+ char const * id);
+
+ /**
+ * @name TAO-specific @c CORBA::TypeCode Methods
+ *
+ * Methods required by TAO's implementation of the
+ * @c CORBA::TypeCode class.
+ *
+ * @see @c CORBA::TypeCode
+ */
+ //@{
+ virtual bool tao_marshal (TAO_OutputCDR & cdr,
+ CORBA::ULong offset) const;
+ virtual void tao_duplicate (void);
+ virtual void tao_release (void);
+ //@}
+
+ protected:
+
+ /**
+ * @name @c TAO CORBA::TypeCode Template Methods
+ *
+ * @c tk_value or @c tk_event @c CORBA::TypeCode -specific
+ * template methods.
+ *
+ * @see @c CORBA::TypeCode
+ */
+ //@{
+ virtual CORBA::Boolean equal_i (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const;
+ virtual CORBA::Boolean equivalent_i (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const;
+ virtual CORBA::TypeCode_ptr get_compact_typecode_i (
+ ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual char const * id_i (ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual char const * name_i (ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual CORBA::ULong member_count_i (ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual char const * member_name_i (CORBA::ULong index
+ ACE_ENV_ARG_DECL) const;
+ virtual CORBA::TypeCode_ptr member_type_i (CORBA::ULong index
+ ACE_ENV_ARG_DECL) const;
+ virtual CORBA::Visibility member_visibility_i (CORBA::ULong index
+ ACE_ENV_ARG_DECL) const;
+ virtual CORBA::ValueModifier type_modifier_i (
+ ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual CORBA::TypeCode_ptr concrete_base_type_i (
+ ACE_ENV_SINGLE_ARG_DECL) const;
+ //@}
+
+ protected:
+
+ /**
+ * @c Valuetype Attributes
+ *
+ * Attributes representing the structure of an OMG IDL
+ * @c valuetype or @c event.
+ *
+ * @note These attributes are declared in the order in which
+ * they are marshaled into a CDR stream in order to
+ * increase cache hits by improving spatial locality.
+ */
+ //@{
+
+ /// Base attributes containing repository ID and name of
+ /// @c valuetype.
+ Base_Attributes<StringType> base_attributes_;
+
+ /// The @c ValueModifier of the @c valuetype of @c eventtype
+ /// represented by this @c TypeCode.
+ CORBA::ValueModifier type_modifier_;
+
+ /// The @c TypeCode corresponding to the concrete base
+ /// @c valuetype or @c eventtype.
+ TypeCodeType concrete_base_;
+
+ /// The number of fields in the OMG IDL value.
+ CORBA::ULong nfields_;
+
+ /// Array of @c TAO::TypeCode fields representing structure of the
+ /// OMG IDL defined @c value.
+ FieldArrayType fields_;
+
+ //@}
+
+ };
+
+ } // End namespace TypeCode
+} // End namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#ifdef __ACE_INLINE__
+# include "tao/AnyTypeCode/Value_TypeCode.inl"
+#endif /* __ACE_INLINE__ */
+
+#ifdef ACE_TEMPLATES_REQUIRE_SOURCE
+# include "tao/AnyTypeCode/Value_TypeCode.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#ifdef ACE_TEMPLATES_REQUIRE_PRAGMA
+# pragma implementation ("Value_TypeCode.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_VALUE_TYPECODE_H */
diff --git a/TAO/tao/AnyTypeCode/Value_TypeCode.inl b/TAO/tao/AnyTypeCode/Value_TypeCode.inl
new file mode 100644
index 00000000000..e5b0b3ab2f1
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Value_TypeCode.inl
@@ -0,0 +1,60 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template <typename StringType,
+ typename TypeCodeType,
+ class FieldArrayType,
+ class RefCountPolicy>
+ACE_INLINE
+TAO::TypeCode::Value<StringType,
+ TypeCodeType,
+ FieldArrayType,
+ RefCountPolicy>::Value (
+ CORBA::TCKind kind,
+ char const * id,
+ char const * name,
+ CORBA::ValueModifier modifier,
+#if defined (__BORLANDC__) && (__BORLANDC__ < 0x572)
+ // Borland C++ currently can't handle a reference to
+ // const pointer to const CORBA::TypeCode_ptr
+ TypeCodeType concrete_base,
+#else
+ TypeCodeType const & concrete_base,
+#endif
+ FieldArrayType const & fields,
+ CORBA::ULong nfields)
+ : ::CORBA::TypeCode (kind)
+ , RefCountPolicy ()
+ , base_attributes_ (id, name)
+ , type_modifier_ (modifier)
+ , concrete_base_ (concrete_base)
+ , nfields_ (nfields)
+ , fields_ (fields)
+{
+}
+
+template <typename StringType,
+ typename TypeCodeType,
+ class FieldArrayType,
+ class RefCountPolicy>
+ACE_INLINE
+TAO::TypeCode::Value<StringType,
+ TypeCodeType,
+ FieldArrayType,
+ RefCountPolicy>::Value (
+ CORBA::TCKind kind,
+ char const * id)
+ : ::CORBA::TypeCode (kind)
+ , RefCountPolicy ()
+ , base_attributes_ (id)
+ , type_modifier_ (CORBA::VM_NONE)
+ , concrete_base_ ()
+ , nfields_ (0)
+ , fields_ ()
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/AnyTypeCode/Value_TypeCode_Static.cpp b/TAO/tao/AnyTypeCode/Value_TypeCode_Static.cpp
new file mode 100644
index 00000000000..f8f661e4bdc
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Value_TypeCode_Static.cpp
@@ -0,0 +1,425 @@
+// $Id$
+
+#include "tao/AnyTypeCode/Value_TypeCode_Static.h"
+#include "tao/AnyTypeCode/TypeCode_Value_Field.h"
+#include "tao/CDR.h"
+
+#include "tao/ORB_Core.h"
+#include "tao/TypeCodeFactory_Adapter.h"
+
+#include "ace/Dynamic_Service.h"
+
+#ifndef __ACE_INLINE__
+# include "tao/AnyTypeCode/Value_TypeCode_Static.inl"
+#endif /* !__ACE_INLINE__ */
+
+
+ACE_RCSID (AnyTypeCode,
+ Value_TypeCode_Static,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+bool
+TAO::TypeCode::Value<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::TypeCode::Value_Field<char const *,
+ CORBA::TypeCode_ptr const *> const *,
+ TAO::Null_RefCount_Policy>::tao_marshal (
+ TAO_OutputCDR & cdr,
+ CORBA::ULong offset) const
+{
+ // A tk_value TypeCode has a "complex" parameter list type (see
+ // Table 15-2 in Section 15.3.5.1 "TypeCode" in the CDR section of
+ // the CORBA specification), meaning that it must be marshaled into
+ // a CDR encapsulation.
+
+ // Create a CDR encapsulation.
+ TAO_OutputCDR enc;
+
+ // Account for the encoded CDR encapsulation length and byte order.
+ //
+ // Aligning on an octet since the next value after the CDR
+ // encapsulation length will always be the byte order octet/boolean
+ // in this case.
+ offset = ACE_align_binary (offset + 4,
+ ACE_CDR::OCTET_ALIGN);
+
+ bool const success =
+ (enc << TAO_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER))
+ && (enc << TAO_OutputCDR::from_string (this->base_attributes_.id (), 0))
+ && (enc << TAO_OutputCDR::from_string (this->base_attributes_.name (), 0))
+ && (enc << this->type_modifier_)
+ && marshal (enc,
+ Traits<char const *>::get_typecode (this->concrete_base_),
+ offset + enc.total_length ())
+ && (enc << this->nfields_);
+
+ if (!success)
+ return false;
+
+ Value_Field<char const *, CORBA::TypeCode_ptr const *> const * const begin =
+ &this->fields_[0];
+ Value_Field<char const *, CORBA::TypeCode_ptr const *> const * const end =
+ begin + this->nfields_;
+
+ for (Value_Field<char const *, CORBA::TypeCode_ptr const *> const * i =
+ begin;
+ i != end;
+ ++i)
+ {
+ Value_Field<char const *, CORBA::TypeCode_ptr const *> const & field = *i;
+
+ if (!(enc << Traits<char const *>::get_string (field.name))
+ || !marshal (enc,
+ Traits<char const *>::get_typecode (field.type),
+ offset + enc.total_length ())
+ || !(enc << field.visibility))
+ return false;
+ }
+
+ return
+ cdr << static_cast<CORBA::ULong> (enc.total_length ())
+ && cdr.write_octet_array_mb (enc.begin ());
+}
+
+void
+TAO::TypeCode::Value<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::TypeCode::Value_Field<char const *,
+ CORBA::TypeCode_ptr const *> const *,
+ TAO::Null_RefCount_Policy>::tao_duplicate (void)
+{
+}
+
+void
+TAO::TypeCode::Value<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::TypeCode::Value_Field<char const *,
+ CORBA::TypeCode_ptr const *> const *,
+ TAO::Null_RefCount_Policy>::tao_release (void)
+{
+}
+
+CORBA::Boolean
+TAO::TypeCode::Value<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::TypeCode::Value_Field<char const *,
+ CORBA::TypeCode_ptr const *> const *,
+ TAO::Null_RefCount_Policy>::equal_i (
+ CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const
+{
+ // None of these calls should throw since CORBA::TypeCode::equal()
+ // verified that the TCKind is the same as our's prior to invoking
+ // this method.
+
+ CORBA::ValueModifier const tc_type_modifier =
+ tc->type_modifier (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ if (tc_type_modifier != this->type_modifier_)
+ return false;
+
+ CORBA::TypeCode_var rhs_concrete_base_type =
+ tc->concrete_base_type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ CORBA::Boolean const equal_concrete_base_types =
+ this->equal (rhs_concrete_base_type.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ if (!equal_concrete_base_types)
+ return false;
+
+ CORBA::ULong const tc_nfields =
+ tc->member_count (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ if (tc_nfields != this->nfields_)
+ return false;
+
+ for (CORBA::ULong i = 0; i < this->nfields_; ++i)
+ {
+ Value_Field<char const *, CORBA::TypeCode_ptr const *> const & lhs_field =
+ this->fields_[i];
+
+ CORBA::Visibility const lhs_visibility = lhs_field.visibility;
+ CORBA::Visibility const rhs_visibility =
+ tc->member_visibility (i
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ if (lhs_visibility != rhs_visibility)
+ return false;
+
+ char const * const lhs_name =
+ Traits<char const *>::get_string (lhs_field.name);;
+ char const * const rhs_name = tc->member_name (i
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ if (ACE_OS::strcmp (lhs_name, rhs_name) != 0)
+ return false;
+
+ CORBA::TypeCode_ptr const lhs_tc =
+ Traits<char const *>::get_typecode (lhs_field.type);
+ CORBA::TypeCode_var const rhs_tc =
+ tc->member_type (i
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ CORBA::Boolean const equal_members =
+ lhs_tc->equal (rhs_tc.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ if (!equal_members)
+ return false;
+ }
+
+ return true;
+}
+
+CORBA::Boolean
+TAO::TypeCode::Value<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::TypeCode::Value_Field<char const *,
+ CORBA::TypeCode_ptr const *> const *,
+ TAO::Null_RefCount_Policy>::equivalent_i (
+ CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const
+{
+ CORBA::ValueModifier const tc_type_modifier =
+ tc->type_modifier (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ if (tc_type_modifier != this->type_modifier_)
+ return false;
+
+ CORBA::TypeCode_var rhs_concrete_base_type =
+ tc->concrete_base_type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ CORBA::Boolean const equivalent_concrete_base_types =
+ this->equivalent (rhs_concrete_base_type.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ if (!equivalent_concrete_base_types)
+ return false;
+
+ // Perform a structural comparison, excluding the name() and
+ // member_name() operations.
+
+ CORBA::ULong const tc_nfields =
+ tc->member_count (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ if (tc_nfields != this->nfields_)
+ return false;
+
+ for (CORBA::ULong i = 0; i < this->nfields_; ++i)
+ {
+ Value_Field<char const *,
+ CORBA::TypeCode_ptr const *> const & lhs_field =
+ this->fields_[i];
+
+ CORBA::Visibility const lhs_visibility =
+ lhs_field.visibility;
+ CORBA::Visibility const rhs_visibility =
+ tc->member_visibility (i
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ if (lhs_visibility != rhs_visibility)
+ return false;
+
+ CORBA::TypeCode_ptr const lhs_tc =
+ Traits<char const *>::get_typecode (lhs_field.type);
+ CORBA::TypeCode_var const rhs_tc =
+ tc->member_type (i
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ CORBA::Boolean const equiv_types =
+ lhs_tc->equivalent (rhs_tc.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ if (!equiv_types)
+ return false;
+ }
+
+ return true;
+}
+
+CORBA::TypeCode_ptr
+TAO::TypeCode::Value<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::TypeCode::Value_Field<char const *,
+ CORBA::TypeCode_ptr const *> const *,
+ TAO::Null_RefCount_Policy>::get_compact_typecode_i (
+ ACE_ENV_SINGLE_ARG_DECL) const
+{
+ ACE_Array_Base<Value_Field<CORBA::String_var, CORBA::TypeCode_var> >
+ tc_fields (this->nfields_);
+
+ if (this->nfields_ > 0)
+ {
+ // Dynamically construct a new array of fields stripped of
+ // member names.
+
+ static char const empty_name[] = "";
+
+ for (CORBA::ULong i = 0; i < this->nfields_; ++i)
+ {
+ // Member names will be stripped, i.e. not embedded within
+ // the compact TypeCode.
+
+ tc_fields[i].name = empty_name;
+ tc_fields[i].type =
+ Traits<char const *>::get_typecode (
+ this->fields_[i].type)->get_compact_typecode (
+ ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::TypeCode::_nil ());
+ tc_fields[i].visibility = this->fields_[i].visibility;
+ }
+ }
+
+ TAO_TypeCodeFactory_Adapter * const adapter =
+ ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance (
+ TAO_ORB_Core::typecodefactory_adapter_name ());
+
+ if (adapter == 0)
+ {
+ ACE_THROW_RETURN (CORBA::INTERNAL (),
+ CORBA::TypeCode::_nil ());
+ }
+
+ return
+ adapter->create_value_event_tc (
+ this->kind_,
+ this->base_attributes_.id (),
+ "", // empty name
+ this->type_modifier_,
+ Traits<char const *>::get_typecode (this->concrete_base_),
+ tc_fields,
+ this->nfields_
+ ACE_ENV_ARG_PARAMETER);
+}
+
+char const *
+TAO::TypeCode::Value<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::TypeCode::Value_Field<char const *,
+ CORBA::TypeCode_ptr const *> const *,
+ TAO::Null_RefCount_Policy>::id_i (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED) const
+{
+ // Ownership is retained by the TypeCode, as required by the C++
+ // mapping.
+ return this->base_attributes_.id ();
+}
+
+char const *
+TAO::TypeCode::Value<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::TypeCode::Value_Field<char const *,
+ CORBA::TypeCode_ptr const *> const *,
+ TAO::Null_RefCount_Policy>::name_i (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED) const
+{
+ // Ownership is retained by the TypeCode, as required by the C++
+ // mapping.
+ return this->base_attributes_.name ();
+}
+
+CORBA::ULong
+TAO::TypeCode::Value<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::TypeCode::Value_Field<char const *,
+ CORBA::TypeCode_ptr const *> const *,
+ TAO::Null_RefCount_Policy>::member_count_i (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED) const
+{
+ return this->nfields_;
+}
+
+char const *
+TAO::TypeCode::Value<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::TypeCode::Value_Field<char const *,
+ CORBA::TypeCode_ptr const *> const *,
+ TAO::Null_RefCount_Policy>::member_name_i (
+ CORBA::ULong index
+ ACE_ENV_ARG_DECL) const
+{
+ // Ownership is retained by the TypeCode, as required by the C++
+ // mapping.
+ if (index >= this->nfields_)
+ ACE_THROW_RETURN (CORBA::TypeCode::Bounds (), 0);
+
+ return Traits<char const *>::get_string (this->fields_[index].name);
+}
+
+CORBA::TypeCode_ptr
+TAO::TypeCode::Value<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::TypeCode::Value_Field<char const *,
+ CORBA::TypeCode_ptr const *> const *,
+ TAO::Null_RefCount_Policy>::member_type_i (
+ CORBA::ULong index
+ ACE_ENV_ARG_DECL) const
+{
+ if (index >= this->nfields_)
+ ACE_THROW_RETURN (CORBA::TypeCode::Bounds (),
+ CORBA::TypeCode::_nil ());
+
+ return
+ CORBA::TypeCode::_duplicate (
+ Traits<char const *>::get_typecode (this->fields_[index].type));
+}
+
+CORBA::Visibility
+TAO::TypeCode::Value<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::TypeCode::Value_Field<char const *,
+ CORBA::TypeCode_ptr const *> const *,
+ TAO::Null_RefCount_Policy>::member_visibility_i (
+ CORBA::ULong index
+ ACE_ENV_ARG_DECL) const
+{
+ if (index >= this->nfields_)
+ ACE_THROW_RETURN (CORBA::TypeCode::Bounds (),
+ CORBA::PRIVATE_MEMBER);
+
+ return this->fields_[index].visibility;
+}
+
+CORBA::ValueModifier
+TAO::TypeCode::Value<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::TypeCode::Value_Field<char const *,
+ CORBA::TypeCode_ptr const *> const *,
+ TAO::Null_RefCount_Policy>::type_modifier_i (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED) const
+{
+ return this->type_modifier_;
+}
+
+CORBA::TypeCode_ptr
+TAO::TypeCode::Value<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::TypeCode::Value_Field<char const *,
+ CORBA::TypeCode_ptr const *> const *,
+ TAO::Null_RefCount_Policy>::concrete_base_type_i (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED) const
+{
+ return
+ CORBA::TypeCode::_duplicate (
+ Traits<char const *>::get_typecode (this->concrete_base_));
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/AnyTypeCode/Value_TypeCode_Static.h b/TAO/tao/AnyTypeCode/Value_TypeCode_Static.h
new file mode 100644
index 00000000000..57ba318ab03
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Value_TypeCode_Static.h
@@ -0,0 +1,170 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Value_TypeCode_Static.h
+ *
+ * $Id$
+ *
+ * Header file for static @c tk_value and @c tk_event
+ * @c CORBA::TypeCodes.
+ *
+ * @author Ossama Othman <ossama@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_VALUE_TYPECODE_STATIC_H
+#define TAO_VALUE_TYPECODE_STATIC_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/AnyTypeCode/TypeCode.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/AnyTypeCode/TypeCode_Base_Attributes.h"
+#include "tao/AnyTypeCode/ValueModifierC.h"
+#include "tao/AnyTypeCode/VisibilityC.h"
+#include "tao/AnyTypeCode/Null_RefCount_Policy.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace TypeCode
+ {
+ template<typename StringType, typename TypeCodeType> struct Value_Field;
+ template <typename StringType,
+ typename TypeCodeType,
+ class FieldArrayType,
+ class RefCountPolicy> class Value;
+
+ /**
+ * @class Value
+ *
+ * @brief @c CORBA::TypeCode implementation for an OMG IDL
+ * @c valuetype or @c event.
+ *
+ * This class implements a @c CORBA::TypeCode for an OMG IDL
+ * @c valuetype or @c event.
+ */
+ template<>
+ class TAO_AnyTypeCode_Export Value<char const *,
+ CORBA::TypeCode_ptr const *,
+ Value_Field<char const *,
+ CORBA::TypeCode_ptr const *> const *,
+ TAO::Null_RefCount_Policy>
+ : public CORBA::TypeCode,
+ private TAO::Null_RefCount_Policy
+ {
+ public:
+
+ /// Constructor.
+ Value (CORBA::TCKind kind,
+ char const * id,
+ char const * name,
+ CORBA::ValueModifier modifier,
+ CORBA::TypeCode_ptr const * concrete_base,
+ Value_Field<char const *,
+ CORBA::TypeCode_ptr const *> const * fields,
+ CORBA::ULong nfields);
+
+ /**
+ * @name TAO-specific @c CORBA::TypeCode Methods
+ *
+ * Methods required by TAO's implementation of the
+ * @c CORBA::TypeCode class.
+ *
+ * @see @c CORBA::TypeCode
+ */
+ //@{
+ virtual bool tao_marshal (TAO_OutputCDR & cdr,
+ CORBA::ULong offset) const;
+ virtual void tao_duplicate (void);
+ virtual void tao_release (void);
+ //@}
+
+ protected:
+
+ /**
+ * @name @c TAO CORBA::TypeCode Template Methods
+ *
+ * @c tk_value or @c tk_event @c CORBA::TypeCode -specific
+ * template methods.
+ *
+ * @see @c CORBA::TypeCode
+ */
+ //@{
+ virtual CORBA::Boolean equal_i (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const;
+ virtual CORBA::Boolean equivalent_i (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const;
+ virtual CORBA::TypeCode_ptr get_compact_typecode_i (
+ ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual char const * id_i (ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual char const * name_i (ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual CORBA::ULong member_count_i (ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual char const * member_name_i (CORBA::ULong index
+ ACE_ENV_ARG_DECL) const;
+ virtual CORBA::TypeCode_ptr member_type_i (CORBA::ULong index
+ ACE_ENV_ARG_DECL) const;
+ virtual CORBA::Visibility member_visibility_i (CORBA::ULong index
+ ACE_ENV_ARG_DECL) const;
+ virtual CORBA::ValueModifier type_modifier_i (
+ ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual CORBA::TypeCode_ptr concrete_base_type_i (
+ ACE_ENV_SINGLE_ARG_DECL) const;
+ //@}
+
+ private:
+
+ /**
+ * @c Valuetype Attributes
+ *
+ * Attributes representing the structure of an OMG IDL
+ * @c valuetype or @c event.
+ *
+ * @note These attributes are declared in the order in which
+ * they are marshaled into a CDR stream in order to
+ * increase cache hits by improving spatial locality.
+ */
+ //@{
+
+ /// Base attributes containing repository ID and name of
+ /// @c valuetype.
+ Base_Attributes<char const *> const base_attributes_;
+
+ /// The @c ValueModifier of the @c valuetype of @c eventtype
+ /// represented by this @c TypeCode.
+ CORBA::ValueModifier const type_modifier_;
+
+ /// The @c TypeCode corresponding to the concrete base
+ /// @c valuetype or @c eventtype.
+ CORBA::TypeCode_ptr const * const concrete_base_;
+
+ /// The number of fields in the OMG IDL value.
+ CORBA::ULong const nfields_;
+
+ /// Array of @c TAO::TypeCode fields representing structure of the
+ /// OMG IDL defined @c value.
+ Value_Field<char const *,
+ CORBA::TypeCode_ptr const *> const * const fields_;
+
+ //@}
+
+ };
+
+ } // End namespace TypeCode
+} // End namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#ifdef __ACE_INLINE__
+# include "tao/AnyTypeCode/Value_TypeCode_Static.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_VALUE_TYPECODE_STATIC_H */
diff --git a/TAO/tao/AnyTypeCode/Value_TypeCode_Static.inl b/TAO/tao/AnyTypeCode/Value_TypeCode_Static.inl
new file mode 100644
index 00000000000..c35fbce0b42
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Value_TypeCode_Static.inl
@@ -0,0 +1,30 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO::TypeCode::Value<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::TypeCode::Value_Field<char const *,
+ CORBA::TypeCode_ptr const *> const *,
+ TAO::Null_RefCount_Policy>::Value (
+ CORBA::TCKind kind,
+ char const * id,
+ char const * name,
+ CORBA::ValueModifier modifier,
+ CORBA::TypeCode_ptr const * concrete_base,
+ Value_Field<char const *, CORBA::TypeCode_ptr const *> const * fields,
+ CORBA::ULong nfields)
+ : ::CORBA::TypeCode (kind)
+ , ::TAO::Null_RefCount_Policy ()
+ , base_attributes_ (id, name)
+ , type_modifier_ (modifier)
+ , concrete_base_ (concrete_base)
+ , nfields_ (nfields)
+ , fields_ (fields)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/AnyTypeCode/Visibility.pidl b/TAO/tao/AnyTypeCode/Visibility.pidl
new file mode 100644
index 00000000000..27f4f755c8b
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/Visibility.pidl
@@ -0,0 +1,36 @@
+// -*- IDL -*-
+
+// ================================================================
+/**
+ * @file Visibility.pidl
+ *
+ * $Id$
+ *
+ * This file was used to generate the code in VisibiltyC.* The command
+ * used to generate code is:
+ *
+ * tao_idl
+ * -o orig -SS -Ge 1 -Sci
+ * -Wb,export_macro=TAO_Export
+ * -Wb,export_include="tao/TAO_Export.h"
+ * -Wb,pre_include="ace/pre.h"
+ * -Wb,post_include="ace/post.h"
+ * -Wb,versioning_begin=TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+ * -Wb,versioning_end=TAO_END_VERSIONED_NAMESPACE_DECL
+ * Visibilty.pidl
+ */
+// ================================================================
+
+#ifndef TAO_VISIBILITY_PIDL
+#define TAO_VISIBILITY_PIDL
+
+#pragma prefix "omg.org"
+
+module CORBA
+{
+ typedef short Visibility;
+ const Visibility PRIVATE_MEMBER = 0;
+ const Visibility PUBLIC_MEMBER = 1;
+};
+
+#endif /* TAO_VISIBILITY_PIDL */
diff --git a/TAO/tao/AnyTypeCode/WrongTransactionA.cpp b/TAO/tao/AnyTypeCode/WrongTransactionA.cpp
new file mode 100644
index 00000000000..9c6fd0a62f2
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/WrongTransactionA.cpp
@@ -0,0 +1,151 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+#include "tao/AnyTypeCode/WrongTransactionA.h"
+#include "tao/AnyTypeCode/Null_RefCount_Policy.h"
+#include "tao/AnyTypeCode/TypeCode_Constants.h"
+#include "tao/AnyTypeCode/Alias_TypeCode_Static.h"
+#include "tao/AnyTypeCode/Struct_TypeCode_Static.h"
+#include "tao/AnyTypeCode/TypeCode_Struct_Field.h"
+#include "tao/CDR.h"
+#include "tao/AnyTypeCode/Any.h"
+#include "tao/AnyTypeCode/Any_Dual_Impl_T.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/struct_typecode.cpp:87
+
+static TAO::TypeCode::Struct_Field<char const *, CORBA::TypeCode_ptr const *> const * const _tao_fields_CORBA_WrongTransaction = 0;
+static TAO::TypeCode::Struct<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::TypeCode::Struct_Field<char const *, CORBA::TypeCode_ptr const *> const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_CORBA_WrongTransaction (
+ CORBA::tk_except,
+ "IDL:omg.org/CORBA/WrongTransaction:1.0",
+ "WrongTransaction",
+ _tao_fields_CORBA_WrongTransaction,
+ 0);
+
+namespace CORBA
+{
+ ::CORBA::TypeCode_ptr const _tc_WrongTransaction =
+ &_tao_tc_CORBA_WrongTransaction;
+}
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_exception/any_op_cs.cpp:50
+
+namespace TAO
+{
+ template<>
+ CORBA::Boolean
+ Any_Dual_Impl_T<CORBA::WrongTransaction>::demarshal_value (
+ TAO_InputCDR & cdr
+ )
+ {
+ CORBA::String_var id;
+
+ if (!(cdr >> id.out ()))
+ {
+ return false;
+ }
+
+ ACE_TRY_NEW_ENV
+ {
+ this->value_->_tao_decode (cdr ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ return false;
+ }
+ ACE_ENDTRY;
+
+ return true;
+ }
+}
+
+// Copying insertion.
+void operator<<= (
+ CORBA::Any &_tao_any,
+ const CORBA::WrongTransaction &_tao_elem
+ )
+{
+ TAO::Any_Dual_Impl_T<CORBA::WrongTransaction>::insert_copy (
+ _tao_any,
+ CORBA::WrongTransaction::_tao_any_destructor,
+ CORBA::_tc_WrongTransaction,
+ _tao_elem
+ );
+}
+
+// Non-copying insertion.
+void operator<<= (
+ CORBA::Any &_tao_any,
+ CORBA::WrongTransaction *_tao_elem
+ )
+{
+ TAO::Any_Dual_Impl_T<CORBA::WrongTransaction>::insert (
+ _tao_any,
+ CORBA::WrongTransaction::_tao_any_destructor,
+ CORBA::_tc_WrongTransaction,
+ _tao_elem
+ );
+}
+
+// Extraction to non-const pointer (deprecated).
+CORBA::Boolean operator>>= (
+ const CORBA::Any &_tao_any,
+ CORBA::WrongTransaction *&_tao_elem
+ )
+{
+ return _tao_any >>= const_cast<
+ const CORBA::WrongTransaction *&> (
+ _tao_elem
+ );
+}
+
+// Extraction to const pointer.
+CORBA::Boolean operator>>= (
+ const CORBA::Any &_tao_any,
+ const CORBA::WrongTransaction *&_tao_elem
+ )
+{
+ return
+ TAO::Any_Dual_Impl_T<CORBA::WrongTransaction>::extract (
+ _tao_any,
+ CORBA::WrongTransaction::_tao_any_destructor,
+ CORBA::_tc_WrongTransaction,
+ _tao_elem
+ );
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/AnyTypeCode/WrongTransactionA.h b/TAO/tao/AnyTypeCode/WrongTransactionA.h
new file mode 100644
index 00000000000..745c0aa5f39
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/WrongTransactionA.h
@@ -0,0 +1,112 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:153
+
+#ifndef _TAO_IDL_ORIG_WRONGTRANSACTIONA_H_
+#define _TAO_IDL_ORIG_WRONGTRANSACTIONA_H_
+
+#include /**/ "ace/pre.h"
+
+
+#include "ace/config-all.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/AnyTypeCode/TAO_AnyTypeCode_Export.h"
+#include "tao/AnyTypeCode/AnyTypeCode_methods.h"
+#include "tao/WrongTransactionC.h"
+
+#if defined (TAO_EXPORT_MACRO)
+#undef TAO_EXPORT_MACRO
+#endif
+#define TAO_EXPORT_MACRO TAO_AnyTypeCode_Export
+
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+#if defined (__BORLANDC__)
+#pragma option push -w-rvl -w-rch -w-ccc -w-inl
+#endif /* __BORLANDC__ */
+
+// TAO_IDL - Generated from
+// be\be_visitor_module/module_ch.cpp:48
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace CORBA
+{
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:44
+
+ extern TAO_AnyTypeCode_Export ::CORBA::TypeCode_ptr const _tc_WrongTransaction;
+
+// TAO_IDL - Generated from
+// be\be_visitor_module/module_ch.cpp:66
+
+} // module CORBA
+
+// TAO_IDL - Generated from
+// be\be_visitor_traits.cpp:61
+
+// Traits specializations.
+namespace TAO
+{
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_exception/any_op_ch.cpp:52
+
+TAO_AnyTypeCode_Export void operator<<= (CORBA::Any &, const CORBA::WrongTransaction &); // copying version
+TAO_AnyTypeCode_Export void operator<<= (CORBA::Any &, CORBA::WrongTransaction*); // noncopying version
+TAO_AnyTypeCode_Export CORBA::Boolean operator>>= (const CORBA::Any &, CORBA::WrongTransaction *&); // deprecated
+TAO_AnyTypeCode_Export CORBA::Boolean operator>>= (const CORBA::Any &, const CORBA::WrongTransaction *&);
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:955
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#if defined (__BORLANDC__)
+#pragma option pop
+#endif /* __BORLANDC__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* ifndef */
+
+
diff --git a/TAO/tao/AnyTypeCode/append.cpp b/TAO/tao/AnyTypeCode/append.cpp
new file mode 100644
index 00000000000..618c273141a
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/append.cpp
@@ -0,0 +1,1329 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO
+//
+// = FILENAME
+// append.cpp
+//
+// = DESCRIPTION
+// Appends a CDR stream to another CDR stream. Due to the
+// stringent alignment requirements, it is not possible to simply
+// append or memcpy. Instead we go thru the same CDR encoding rules
+//
+// = AUTHOR
+// Copyright 1994-1995 by Sun Microsystems Inc.
+// and Aniruddha Gokhale
+//
+// ============================================================================
+
+#include "tao/AnyTypeCode/TypeCode.h"
+#include "tao/AnyTypeCode/Marshal.h"
+#include "tao/AnyTypeCode/Any_Unknown_IDL_Type.h"
+#include "tao/AnyTypeCode/TypeCode_Constants.h"
+#include "tao/AnyTypeCode/OctetSeqA.h"
+#include "tao/AnyTypeCode/Any.h"
+#include "tao/Environment.h"
+#include "tao/debug.h"
+#include "tao/Valuetype_Adapter.h"
+#include "tao/ORB_Core.h"
+#include "tao/CDR.h"
+#include "tao/SystemException.h"
+
+#include "ace/Dynamic_Service.h"
+
+ACE_RCSID (AnyTypeCode,
+ append,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Encode instances of arbitrary data types based only on typecode.
+// "data" points to the data type; if it's not a primitve data type,
+// the TypeCode interpreter is used to recursively encode its
+// components. "context" is the marshaling stream on which to encode
+// the data value.
+
+TAO::traverse_status
+TAO_Marshal_Primitive::append (CORBA::TypeCode_ptr tc,
+ TAO_InputCDR *src,
+ TAO_OutputCDR *dest
+ ACE_ENV_ARG_DECL)
+{
+ CORBA::Boolean continue_append = 1;
+ TAO::traverse_status retval =
+ TAO::TRAVERSE_CONTINUE; // status of encode operation
+
+ CORBA::TCKind const k = tc->kind (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO::TRAVERSE_STOP);
+
+ switch (k)
+ {
+ case CORBA::tk_null:
+ case CORBA::tk_void:
+ break;
+ case CORBA::tk_short:
+ case CORBA::tk_ushort:
+ continue_append = dest->append_short (*src);
+ break;
+ case CORBA::tk_long:
+ case CORBA::tk_ulong:
+ case CORBA::tk_float:
+ case CORBA::tk_enum:
+ continue_append = dest->append_long (*src);
+ break;
+ case CORBA::tk_double:
+ case CORBA::tk_longlong:
+ case CORBA::tk_ulonglong:
+ continue_append = dest->append_double (*src);
+ break;
+ case CORBA::tk_boolean:
+ continue_append = dest->append_boolean (*src);
+ break;
+ case CORBA::tk_char:
+ case CORBA::tk_octet:
+ continue_append = dest->append_octet (*src);
+ break;
+ case CORBA::tk_longdouble:
+ continue_append = dest->append_longdouble (*src);
+ break;
+ case CORBA::tk_wchar:
+ continue_append = dest->append_wchar (*src);
+ break;
+ default:
+ retval = TAO::TRAVERSE_STOP;
+ // we are not a primitive type
+ }
+
+ if (retval == TAO::TRAVERSE_CONTINUE
+ && continue_append == 1)
+ return TAO::TRAVERSE_CONTINUE;
+
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT ("TAO_Marshal_Primitive::append detected error\n")
+ ));
+
+ ACE_THROW_RETURN (CORBA::MARSHAL (0,
+ CORBA::COMPLETED_MAYBE),
+ TAO::TRAVERSE_STOP);
+}
+
+TAO::traverse_status
+TAO_Marshal_Any::append (CORBA::TypeCode_ptr,
+ TAO_InputCDR *src,
+ TAO_OutputCDR *dest
+ ACE_ENV_ARG_DECL)
+{
+ // Typecode of the element that makes the Any.
+ CORBA::TypeCode_var elem_tc;
+
+ if (!(*src >> elem_tc.inout ()))
+ ACE_THROW_RETURN (CORBA::MARSHAL (0,
+ CORBA::COMPLETED_MAYBE),
+ TAO::TRAVERSE_STOP);
+
+ if (!(*dest << elem_tc.in ()))
+ ACE_THROW_RETURN (CORBA::MARSHAL (0,
+ CORBA::COMPLETED_MAYBE),
+ TAO::TRAVERSE_STOP);
+
+ // append the data
+ TAO::traverse_status retval =
+ TAO_Marshal_Object::perform_append (elem_tc.in (),
+ src,
+ dest
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO::TRAVERSE_STOP);
+
+ if (retval != TAO::TRAVERSE_CONTINUE)
+ {
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO_Marshal_Any::append detected error\n")));
+
+ ACE_THROW_RETURN (CORBA::MARSHAL (0,
+ CORBA::COMPLETED_MAYBE),
+ TAO::TRAVERSE_STOP);
+ }
+
+ return retval;
+}
+
+TAO::traverse_status
+TAO_Marshal_TypeCode::append (CORBA::TypeCode_ptr,
+ TAO_InputCDR *src,
+ TAO_OutputCDR *dest
+ ACE_ENV_ARG_DECL)
+{
+ CORBA::Boolean continue_append = 1;
+ TAO::traverse_status retval =
+ TAO::TRAVERSE_CONTINUE;
+ CORBA::ULong kind;
+
+ // Decode the "kind" field of the typecode from the src for further
+ // use. However, also write it back into the destination
+ continue_append = (CORBA::Boolean) (src->read_ulong (kind)
+ ? dest->write_ulong (kind)
+ : 0);
+
+ if (continue_append == 1)
+ {
+ // Typecodes with empty parameter lists all have preallocated
+ // constants. We use those to reduce memory consumption and
+ // heap access ... also, to speed things up!
+ if ((kind < CORBA::TAO_TC_KIND_COUNT)
+ || (kind == ~0u))
+ {
+ // Either a non-constant typecode or an indirected typecode.
+ switch (kind)
+ {
+ // Need special handling for all kinds of typecodes that
+ // have nonempty parameter lists ...
+ default:
+ // nothing to de done
+ break;
+ case CORBA::tk_string:
+ case CORBA::tk_wstring:
+ {
+ // read and write the bounds
+ retval =
+ TAO_Marshal_Object::perform_append (CORBA::_tc_long,
+ src,
+ dest
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO::TRAVERSE_STOP);
+ }
+ break;
+
+ // Indirected typecodes, illegal at "top level"
+ case ~0u:
+ {
+ // read and write the negative offset
+ retval =
+ TAO_Marshal_Object::perform_append (CORBA::_tc_long,
+ src,
+ dest
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO::TRAVERSE_STOP);
+ }
+ break;
+
+ // The rest have "complex" parameter lists that are
+ // encoded as bulk octets ...
+ case CORBA::tk_objref:
+ case CORBA::tk_struct:
+ case CORBA::tk_union:
+ case CORBA::tk_enum:
+ case CORBA::tk_sequence:
+ case CORBA::tk_array:
+ case CORBA::tk_alias:
+ case CORBA::tk_except:
+ case CORBA::tk_value:
+ case CORBA::tk_value_box:
+ case CORBA::tk_native:
+ case CORBA::tk_abstract_interface:
+ case CORBA::tk_local_interface:
+ case CORBA::tk_component:
+ case CORBA::tk_home:
+ case CORBA::tk_event:
+ {
+ // write the encapsulation i.e., octet sequence
+ retval =
+ TAO_Marshal_Object::perform_append (CORBA::_tc_OctetSeq,
+ src,
+ dest
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO::TRAVERSE_STOP);
+ }
+ } // end of switch
+ }
+ else // bad kind_ value to be decoded
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO_Marshal_TypeCode: ")
+ ACE_TEXT ("Bad kind_ value in CDR stream\n")));
+ }
+
+ ACE_THROW_RETURN (CORBA::BAD_TYPECODE (),
+ TAO::TRAVERSE_STOP);
+ }
+ }
+
+ if (continue_append == 1 && retval == TAO::TRAVERSE_CONTINUE)
+ {
+ return TAO::TRAVERSE_CONTINUE;
+ }
+
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO_Marshal_TypeCode::append detected error\n")));
+ }
+
+ ACE_THROW_RETURN (CORBA::MARSHAL (0,
+ CORBA::COMPLETED_MAYBE),
+ TAO::TRAVERSE_STOP);
+}
+
+TAO::traverse_status
+TAO_Marshal_Principal::append (CORBA::TypeCode_ptr,
+ TAO_InputCDR *src,
+ TAO_OutputCDR *dest
+ ACE_ENV_ARG_DECL)
+{
+ // write the octet sequence representing the Principal
+ return TAO_Marshal_Object::perform_append (CORBA::_tc_OctetSeq,
+ src,
+ dest
+ ACE_ENV_ARG_PARAMETER);
+}
+
+TAO::traverse_status
+TAO_Marshal_ObjRef::append (CORBA::TypeCode_ptr,
+ TAO_InputCDR *src,
+ TAO_OutputCDR *dest
+ ACE_ENV_ARG_DECL)
+{
+ CORBA::Boolean continue_append = 1;
+
+ // First, append the type hint. This will be the type_id encoded in an
+ // object reference.
+ dest->append_string (*src);
+
+ // Read the profiles, discarding all until an IIOP profile comes by.
+ // Once we see an IIOP profile, ignore any further ones.
+ //
+ // XXX this will need to change someday to let different protocol
+ // code be accessed, not just IIOP. Protocol modules will be
+ // dynamically loaded from shared libraries via ORB_init (), and we
+ // just need to be able to access such preloaded libraries here as
+ // we unmarshal objrefs.
+
+ CORBA::ULong profiles = 0;
+
+ // get the count of profiles that follow. This will tell us the
+ // length of the sequence
+ continue_append = (CORBA::Boolean) (src->read_ulong (profiles)
+ ? dest->write_ulong (profiles)
+ : 0);
+
+ // No profiles means a NIL objref.
+ while (profiles-- != 0 && continue_append)
+ {
+ CORBA::ULong tag = 0;
+
+ // get the profile ID tag
+ if ((continue_append = (CORBA::Boolean) (src->read_ulong (tag)
+ ? dest->write_ulong (tag)
+ : 0)) == 0)
+ continue;
+
+ CORBA::ULong length = 0;
+ if ((continue_append = (CORBA::Boolean) (src->read_ulong (length)
+ ? dest->write_ulong (length)
+ : 0)) == 0)
+ continue;
+
+ // @@ This can be optimized! Pre-allocating on the destination
+ // and then copying directly into that.
+ CORBA::Octet* body = 0;
+ ACE_NEW_RETURN (body,
+ CORBA::Octet[length],
+ TAO::TRAVERSE_STOP);
+ continue_append =
+ (CORBA::Boolean) (src->read_octet_array (body, length)
+ ? dest->write_octet_array (body, length)
+ : 0);
+ delete [] body;
+ }
+
+ if (continue_append == 1)
+ return TAO::TRAVERSE_CONTINUE;
+
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT ("TAO_Marshal_ObjRef::append detected error\n")
+ ));
+
+ ACE_THROW_RETURN (CORBA::MARSHAL (0,
+ CORBA::COMPLETED_MAYBE),
+ TAO::TRAVERSE_STOP);
+}
+
+TAO::traverse_status
+TAO_Marshal_Struct::append (CORBA::TypeCode_ptr tc,
+ TAO_InputCDR *src,
+ TAO_OutputCDR *dest
+ ACE_ENV_ARG_DECL)
+{
+ TAO::traverse_status retval =
+ TAO::TRAVERSE_CONTINUE;
+ CORBA::TypeCode_var param;
+
+ // Number of fields in the struct.
+ const CORBA::ULong member_count =
+ tc->member_count (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO::TRAVERSE_STOP);
+
+ for (CORBA::ULong i = 0;
+ i < member_count && retval == TAO::TRAVERSE_CONTINUE;
+ ++i)
+ {
+ // get member type
+ param = tc->member_type (i ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO::TRAVERSE_STOP);
+
+ retval =
+ TAO_Marshal_Object::perform_append (param.in (),
+ src,
+ dest
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO::TRAVERSE_STOP);
+ }
+
+ if (retval == TAO::TRAVERSE_CONTINUE)
+ return TAO::TRAVERSE_CONTINUE;
+
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO_Marshal_Struct::append detected error\n")));
+
+ ACE_THROW_RETURN (CORBA::MARSHAL (0,
+ CORBA::COMPLETED_MAYBE),
+ TAO::TRAVERSE_STOP);
+}
+
+TAO::traverse_status
+TAO_Marshal_Union::append (CORBA::TypeCode_ptr tc,
+ TAO_InputCDR *src,
+ TAO_OutputCDR *dest
+ ACE_ENV_ARG_DECL)
+{
+ CORBA::TypeCode_var discrim_tc =
+ tc->discriminator_type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO::TRAVERSE_STOP);
+
+ CORBA::ULong kind =
+ discrim_tc->kind (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO::TRAVERSE_STOP);
+
+ // Save the discriminator value in a temporary variable...
+ CORBA::Short short_v = CORBA::Short();
+ CORBA::UShort ushort_v = CORBA::UShort();
+ CORBA::Long long_v = CORBA::Long();
+ CORBA::ULong ulong_v = CORBA::ULong();
+ CORBA::ULong enum_v = CORBA::ULong();
+ CORBA::Char char_v = CORBA::Char();
+ CORBA::WChar wchar_v = CORBA::WChar();
+ CORBA::Boolean boolean_v = false;
+
+ switch (kind)
+ {
+ case CORBA::tk_short:
+ {
+ if (!src->read_short (short_v)
+ || !dest->write_short (short_v))
+ return TAO::TRAVERSE_STOP;
+ }
+ break;
+
+ case CORBA::tk_ushort:
+ {
+ if (!src->read_ushort (ushort_v)
+ || !dest->write_ushort (ushort_v))
+ return TAO::TRAVERSE_STOP;
+ }
+ break;
+
+ case CORBA::tk_long:
+ {
+ if (!src->read_long (long_v)
+ || !dest->write_long (long_v))
+ return TAO::TRAVERSE_STOP;
+ }
+ break;
+
+ case CORBA::tk_ulong:
+ {
+ if (!src->read_ulong (ulong_v)
+ || !dest->write_ulong (ulong_v))
+ return TAO::TRAVERSE_STOP;
+ }
+ break;
+
+ case CORBA::tk_enum:
+ {
+ if (!src->read_ulong (enum_v)
+ || !dest->write_ulong (enum_v))
+ return TAO::TRAVERSE_STOP;
+ }
+ break;
+
+ case CORBA::tk_char:
+ {
+ if (!src->read_char (char_v)
+ || !dest->write_char (char_v))
+ return TAO::TRAVERSE_STOP;
+ }
+ break;
+
+ case CORBA::tk_wchar:
+ {
+ if (!src->read_wchar (wchar_v)
+ || !dest->write_wchar (wchar_v))
+ return TAO::TRAVERSE_STOP;
+ }
+ break;
+
+ case CORBA::tk_boolean:
+ {
+ if (!src->read_boolean (boolean_v)
+ || !dest->write_boolean (boolean_v))
+ return TAO::TRAVERSE_STOP;
+ }
+ break;
+
+ default:
+ return TAO::TRAVERSE_STOP;
+ }
+
+ const CORBA::ULong member_count =
+ tc->member_count (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO::TRAVERSE_STOP);
+
+ const CORBA::ULong null_member = ~static_cast<CORBA::ULong> (0U);
+
+ CORBA::ULong current_member = null_member;
+ CORBA::ULong default_member = null_member;
+
+ for (CORBA::ULong i = 0;
+ i < member_count && current_member == null_member;
+ ++i)
+ {
+ CORBA::Any_var any = tc->member_label (i
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO::TRAVERSE_STOP);
+
+ CORBA::Octet o;
+
+ if ((any >>= CORBA::Any::to_octet (o)) && o == 0)
+ {
+ CORBA::ULong default_index =
+ tc->default_index (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO::TRAVERSE_STOP);
+
+ if (i != default_index)
+ ACE_THROW_RETURN (CORBA::BAD_TYPECODE (),
+ TAO::TRAVERSE_STOP);
+ // Found the default branch, save its position and continue
+ // trying to find the current value...
+ default_member = i;
+ continue;
+ }
+
+ switch (kind)
+ {
+ case CORBA::tk_short:
+ {
+ CORBA::Short d;
+ if ((any >>= d) && d == short_v)
+ current_member = i;
+ }
+ break;
+
+ case CORBA::tk_ushort:
+ {
+ CORBA::UShort d;
+ if ((any >>= d) && d == ushort_v)
+ current_member = i;
+ }
+ break;
+
+ case CORBA::tk_long:
+ {
+ CORBA::Long d;
+ if ((any >>= d) && d == long_v)
+ current_member = i;
+ }
+ break;
+
+ case CORBA::tk_ulong:
+ {
+ CORBA::ULong d;
+ if ((any >>= d) && d == ulong_v)
+ current_member = i;
+ }
+ break;
+
+ case CORBA::tk_enum:
+ {
+ CORBA::ULong d;
+ TAO::Any_Impl *impl = any->impl ();
+
+ if (impl->encoded ())
+ {
+ TAO::Unknown_IDL_Type *unk =
+ dynamic_cast<TAO::Unknown_IDL_Type *> (impl);
+
+ // We don't want unk's rd_ptr to move, in case
+ // we are shared by another Any, so we use this
+ // to copy the state, not the buffer.
+ TAO_InputCDR for_reading (unk->_tao_get_cdr ());
+
+ for_reading.read_ulong (d);
+ }
+ else
+ {
+ TAO_OutputCDR out;
+ impl->marshal_value (out);
+ TAO_InputCDR cdr (out);
+ cdr.read_ulong (d);
+ }
+
+ if (d == enum_v)
+ {
+ current_member = i;
+ }
+ }
+ break;
+
+ case CORBA::tk_char:
+ {
+ CORBA::Char d;
+ if ((any >>= CORBA::Any::to_char (d)) && d == char_v)
+ current_member = i;
+ }
+ break;
+
+ case CORBA::tk_wchar:
+ {
+ CORBA::WChar d;
+ if ((any >>= CORBA::Any::to_wchar (d)) && d == wchar_v)
+ current_member = i;
+ }
+ break;
+
+ case CORBA::tk_boolean:
+ {
+ CORBA::Boolean d;
+ if ((any >>= CORBA::Any::to_boolean (d)) && d == boolean_v)
+ current_member = i;
+ }
+ break;
+
+ default:
+ return TAO::TRAVERSE_STOP;
+ }
+ }
+
+ if (current_member == null_member)
+ {
+ // Cannot find the current member, check if there is a
+ // default...
+ if (default_member != null_member)
+ {
+ // Good, use the default to append...
+ CORBA::TypeCode_var member_tc =
+ tc->member_type (default_member ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO::TRAVERSE_STOP);
+ return TAO_Marshal_Object::perform_append (member_tc.in (),
+ src,
+ dest
+ ACE_ENV_ARG_PARAMETER);
+ }
+
+ // If we're here, we have an implicit default case, and we
+ // should just return without appending anything, since no
+ // union member was marshaled in the first place.
+ return TAO::TRAVERSE_CONTINUE;
+ }
+
+ // If we found the member successfully then just use that one...
+ CORBA::TypeCode_var member_tc =
+ tc->member_type (current_member ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO::TRAVERSE_STOP);
+ return TAO_Marshal_Object::perform_append (member_tc.in (),
+ src,
+ dest
+ ACE_ENV_ARG_PARAMETER);
+}
+
+TAO::traverse_status
+TAO_Marshal_String::append (CORBA::TypeCode_ptr,
+ TAO_InputCDR *src,
+ TAO_OutputCDR *dest
+ ACE_ENV_ARG_DECL)
+{
+ CORBA::Boolean continue_append = 1;
+
+ // On decode, omit the check against specified string bounds, and
+ // cope with illegal "zero length" strings (all lengths on the wire
+ // must include a NUL).
+ //
+ // This is on the principle of being gracious in what we accept; we
+ // don't generate messages that fail to comply with protocol specs,
+ // but we will accept them when it's clear how to do so.
+
+ continue_append = dest->append_string (*src);
+ if (continue_append == 1)
+ return TAO::TRAVERSE_CONTINUE;
+
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO_Marshal_TypeCode::append detected error\n")));
+
+ ACE_THROW_RETURN (CORBA::MARSHAL (0,
+ CORBA::COMPLETED_MAYBE),
+ TAO::TRAVERSE_STOP);
+}
+
+TAO::traverse_status
+TAO_Marshal_Sequence::append (CORBA::TypeCode_ptr tc,
+ TAO_InputCDR *src,
+ TAO_OutputCDR *dest
+ ACE_ENV_ARG_DECL)
+{
+ // Size of element.
+ CORBA::ULong bounds;
+
+ // First unmarshal the sequence length ... we trust it to be right
+ // here, on the "be gracious in what you accept" principle. We
+ // don't generate illegal sequences (i.e. length > bounds).
+
+ CORBA::Boolean continue_append =
+ (CORBA::Boolean) (src->read_ulong (bounds)
+ ? dest->write_ulong (bounds)
+ : 0);
+
+ if (!continue_append)
+ {
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT ("TAO_Marshal_Sequence::append detected error\n")
+ ));
+ ACE_THROW_RETURN (CORBA::MARSHAL (),
+ TAO::TRAVERSE_STOP);
+ }
+
+ if (bounds == 0)
+ {
+ return TAO::TRAVERSE_CONTINUE;
+ }
+
+ if (continue_append)
+ {
+ // Get element typecode.
+ CORBA::TypeCode_var tc2 =
+ tc->content_type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO::TRAVERSE_STOP);
+
+ TAO::traverse_status retval =
+ TAO::TRAVERSE_CONTINUE;
+
+ CORBA::TCKind kind = tc2->kind (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO::TRAVERSE_STOP);
+
+ switch (kind)
+ {
+ case CORBA::tk_octet:
+ {
+ char* buf;
+ if (dest->adjust (ACE_CDR::OCTET_SIZE * bounds,
+ ACE_CDR::OCTET_ALIGN, buf) == 0)
+ {
+ if (src->read_octet_array ((ACE_CDR::Octet*)buf, bounds) == 0)
+ retval = TAO::TRAVERSE_STOP;
+ }
+ }
+ break;
+ case CORBA::tk_boolean:
+ {
+ char* buf;
+ if (dest->adjust (ACE_CDR::OCTET_SIZE * bounds,
+ ACE_CDR::OCTET_ALIGN, buf) == 0)
+ {
+ if (src->read_boolean_array ((ACE_CDR::Boolean*)buf, bounds) == 0)
+ retval = TAO::TRAVERSE_STOP;
+ }
+ }
+ break;
+ case CORBA::tk_char:
+ {
+ char* buf;
+ if (dest->adjust (ACE_CDR::OCTET_SIZE * bounds,
+ ACE_CDR::OCTET_ALIGN, buf) == 0)
+ {
+ if (src->read_char_array ((ACE_CDR::Char*)buf, bounds) == 0)
+ retval = TAO::TRAVERSE_STOP;
+ }
+ }
+ break;
+ case CORBA::tk_short:
+ {
+ char* buf;
+ if (dest->adjust (ACE_CDR::SHORT_SIZE * bounds,
+ ACE_CDR::SHORT_ALIGN, buf) == 0)
+ {
+ if (src->read_short_array ((ACE_CDR::Short*)buf, bounds) == 0)
+ retval = TAO::TRAVERSE_STOP;
+ }
+ }
+ break;
+ case CORBA::tk_ushort:
+ {
+ char* buf;
+ if (dest->adjust (ACE_CDR::SHORT_SIZE * bounds,
+ ACE_CDR::SHORT_ALIGN, buf) == 0)
+ {
+ if (src->read_ushort_array ((ACE_CDR::UShort*)buf, bounds) == 0)
+ retval = TAO::TRAVERSE_STOP;
+ }
+ }
+ break;
+ case CORBA::tk_wchar:
+ {
+ char* buf;
+ if (dest->adjust (ACE_CDR::SHORT_SIZE * bounds,
+ ACE_CDR::SHORT_ALIGN, buf) == 0)
+ {
+ if (src->read_wchar_array ((ACE_CDR::WChar*)buf, bounds) == 0)
+ retval = TAO::TRAVERSE_STOP;
+ }
+ }
+ break;
+ case CORBA::tk_long:
+ {
+ char* buf;
+ if (dest->adjust (ACE_CDR::LONG_SIZE * bounds,
+ ACE_CDR::LONG_ALIGN, buf) == 0)
+ {
+ if (src->read_long_array ((ACE_CDR::Long*)buf, bounds) == 0)
+ retval = TAO::TRAVERSE_STOP;
+ }
+ }
+ break;
+ case CORBA::tk_ulong:
+ {
+ char* buf;
+ if (dest->adjust (ACE_CDR::LONG_SIZE * bounds,
+ ACE_CDR::LONG_ALIGN, buf) == 0)
+ {
+ if (src->read_ulong_array ((ACE_CDR::ULong*)buf, bounds) == 0)
+ retval = TAO::TRAVERSE_STOP;
+ }
+ }
+ break;
+ case CORBA::tk_float:
+ {
+ char* buf;
+ if (dest->adjust (ACE_CDR::LONG_SIZE * bounds,
+ ACE_CDR::LONG_ALIGN, buf) == 0)
+ {
+ if (src->read_float_array ((ACE_CDR::Float*)buf, bounds) == 0)
+ retval = TAO::TRAVERSE_STOP;
+ }
+ }
+ break;
+ case CORBA::tk_double:
+ {
+ char* buf;
+ if (dest->adjust (ACE_CDR::LONGLONG_SIZE * bounds,
+ ACE_CDR::LONGLONG_ALIGN, buf) == 0)
+ {
+ if (src->read_double_array ((ACE_CDR::Double*)buf, bounds) == 0)
+ retval = TAO::TRAVERSE_STOP;
+ }
+ }
+ break;
+ case CORBA::tk_longlong:
+ {
+ char* buf;
+ if (dest->adjust (ACE_CDR::LONGLONG_SIZE * bounds,
+ ACE_CDR::LONGLONG_ALIGN, buf) == 0)
+ {
+ if (src->read_longlong_array ((ACE_CDR::LongLong*)buf, bounds) == 0)
+ retval = TAO::TRAVERSE_STOP;
+ }
+ }
+ break;
+ case CORBA::tk_ulonglong:
+ {
+ char* buf;
+ if (dest->adjust (ACE_CDR::LONGLONG_SIZE * bounds,
+ ACE_CDR::LONGLONG_ALIGN, buf) == 0)
+ {
+ if (src->read_ulonglong_array ((ACE_CDR::ULongLong*)buf, bounds) == 0)
+ retval = TAO::TRAVERSE_STOP;
+ }
+ }
+ break;
+ case CORBA::tk_longdouble:
+ {
+ char* buf;
+ if (dest->adjust (ACE_CDR::LONGDOUBLE_SIZE * bounds,
+ ACE_CDR::LONGDOUBLE_ALIGN, buf) == 0)
+ {
+ if (src->read_longdouble_array ((ACE_CDR::LongDouble*)buf, bounds) == 0)
+ retval = TAO::TRAVERSE_STOP;
+ }
+ }
+ break;
+
+ default:
+ while (bounds-- && retval == TAO::TRAVERSE_CONTINUE)
+ {
+ retval = TAO_Marshal_Object::perform_append (tc2.in (),
+ src,
+ dest
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO::TRAVERSE_STOP);
+ }
+ break;
+ }// end of switch
+
+ if (retval == TAO::TRAVERSE_CONTINUE)
+ return TAO::TRAVERSE_CONTINUE;
+ }
+ // error exit
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT ("marshaling TAO_Marshal_Sequence::append detected error\n")
+ ));
+
+ ACE_THROW_RETURN (CORBA::MARSHAL (),
+ TAO::TRAVERSE_STOP);
+}
+
+TAO::traverse_status
+TAO_Marshal_Array::append (CORBA::TypeCode_ptr tc,
+ TAO_InputCDR *src,
+ TAO_OutputCDR *dest
+ ACE_ENV_ARG_DECL)
+{
+ // retrieve the bounds of the array
+ CORBA::ULong bounds = tc->length (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO::TRAVERSE_STOP);
+
+ // get element typecode
+ CORBA::TypeCode_var tc2 = tc->content_type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO::TRAVERSE_STOP);
+
+ // For CORBA basic types, the copy can be optimized
+ CORBA::TCKind kind = tc2->kind (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO::TRAVERSE_STOP);
+
+ // Return status.
+ TAO::traverse_status retval =
+ TAO::TRAVERSE_CONTINUE;
+
+ switch (kind)
+ {
+ case CORBA::tk_octet:
+ {
+ char* buf;
+ if (dest->adjust (ACE_CDR::OCTET_SIZE * bounds,
+ ACE_CDR::OCTET_ALIGN, buf) == 0)
+ {
+ if (src->read_octet_array ((ACE_CDR::Octet*)buf, bounds) == 0)
+ retval = TAO::TRAVERSE_STOP;
+ }
+ }
+ break;
+ case CORBA::tk_boolean:
+ {
+ char* buf;
+ if (dest->adjust (ACE_CDR::OCTET_SIZE * bounds,
+ ACE_CDR::OCTET_ALIGN, buf) == 0)
+ {
+ if (src->read_boolean_array ((ACE_CDR::Boolean*)buf, bounds) == 0)
+ retval = TAO::TRAVERSE_STOP;
+ }
+ }
+ break;
+ case CORBA::tk_char:
+ {
+ char* buf;
+ if (dest->adjust (ACE_CDR::OCTET_SIZE * bounds,
+ ACE_CDR::OCTET_ALIGN, buf) == 0)
+ {
+ if (src->read_char_array ((ACE_CDR::Char*)buf, bounds) == 0)
+ retval = TAO::TRAVERSE_STOP;
+ }
+ }
+ break;
+ case CORBA::tk_short:
+ {
+ char* buf;
+ if (dest->adjust (ACE_CDR::SHORT_SIZE * bounds,
+ ACE_CDR::SHORT_ALIGN, buf) == 0)
+ {
+ if (src->read_short_array ((ACE_CDR::Short*)buf, bounds) == 0)
+ retval = TAO::TRAVERSE_STOP;
+ }
+ }
+ break;
+ case CORBA::tk_ushort:
+ {
+ char* buf;
+ if (dest->adjust (ACE_CDR::SHORT_SIZE * bounds,
+ ACE_CDR::SHORT_ALIGN, buf) == 0)
+ {
+ if (src->read_ushort_array ((ACE_CDR::UShort*)buf, bounds) == 0)
+ retval = TAO::TRAVERSE_STOP;
+ }
+ }
+ break;
+ case CORBA::tk_wchar:
+ {
+ char* buf;
+ if (dest->adjust (ACE_CDR::SHORT_SIZE * bounds,
+ ACE_CDR::SHORT_ALIGN, buf) == 0)
+ {
+ if (src->read_wchar_array ((ACE_CDR::WChar*)buf, bounds) == 0)
+ retval = TAO::TRAVERSE_STOP;
+ }
+ }
+ break;
+ case CORBA::tk_long:
+ {
+ char* buf;
+ if (dest->adjust (ACE_CDR::LONG_SIZE * bounds,
+ ACE_CDR::LONG_ALIGN, buf) == 0)
+ {
+ if (src->read_long_array ((ACE_CDR::Long*)buf, bounds) == 0)
+ retval = TAO::TRAVERSE_STOP;
+ }
+ }
+ break;
+ case CORBA::tk_ulong:
+ {
+ char* buf;
+ if (dest->adjust (ACE_CDR::LONG_SIZE * bounds,
+ ACE_CDR::LONG_ALIGN, buf) == 0)
+ {
+ if (src->read_ulong_array ((ACE_CDR::ULong*)buf, bounds) == 0)
+ retval = TAO::TRAVERSE_STOP;
+ }
+ }
+ break;
+ case CORBA::tk_float:
+ {
+ char* buf;
+ if (dest->adjust (ACE_CDR::LONG_SIZE * bounds,
+ ACE_CDR::LONG_ALIGN, buf) == 0)
+ {
+ if (src->read_float_array ((ACE_CDR::Float*)buf, bounds) == 0)
+ retval = TAO::TRAVERSE_STOP;
+ }
+ }
+ break;
+ case CORBA::tk_double:
+ {
+ char* buf;
+ if (dest->adjust (ACE_CDR::LONGLONG_SIZE * bounds,
+ ACE_CDR::LONGLONG_ALIGN, buf) == 0)
+ {
+ if (src->read_double_array ((ACE_CDR::Double*)buf, bounds) == 0)
+ retval = TAO::TRAVERSE_STOP;
+ }
+ }
+ break;
+ case CORBA::tk_longlong:
+ {
+ char* buf;
+ if (dest->adjust (ACE_CDR::LONGLONG_SIZE * bounds,
+ ACE_CDR::LONGLONG_ALIGN, buf) == 0)
+ {
+ if (src->read_longlong_array ((ACE_CDR::LongLong*)buf, bounds) == 0)
+ retval = TAO::TRAVERSE_STOP;
+ }
+ }
+ break;
+ case CORBA::tk_ulonglong:
+ {
+ char* buf;
+ if (dest->adjust (ACE_CDR::LONGLONG_SIZE * bounds,
+ ACE_CDR::LONGLONG_ALIGN, buf) == 0)
+ {
+ if (src->read_ulonglong_array ((ACE_CDR::ULongLong*)buf, bounds) == 0)
+ retval = TAO::TRAVERSE_STOP;
+ }
+ }
+ break;
+ case CORBA::tk_longdouble:
+ {
+ char* buf;
+ if (dest->adjust (ACE_CDR::LONGDOUBLE_SIZE * bounds,
+ ACE_CDR::LONGDOUBLE_ALIGN, buf) == 0)
+ {
+ if (src->read_longdouble_array ((ACE_CDR::LongDouble*)buf, bounds) == 0)
+ retval = TAO::TRAVERSE_STOP;
+ }
+ }
+ break;
+ default:
+ while (bounds-- && retval == TAO::TRAVERSE_CONTINUE)
+ {
+ retval = TAO_Marshal_Object::perform_append (tc2.in (),
+ src,
+ dest
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO::TRAVERSE_STOP);
+ }
+ break;
+ }// end of switch
+
+ if (retval == TAO::TRAVERSE_CONTINUE)
+ return retval;
+
+ // error exit
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO_Marshal_Sequence::append detected error\n")));
+
+ ACE_THROW_RETURN (CORBA::MARSHAL (),
+ TAO::TRAVERSE_STOP);
+}
+
+TAO::traverse_status
+TAO_Marshal_Alias::append (CORBA::TypeCode_ptr tc,
+ TAO_InputCDR *src,
+ TAO_OutputCDR *dest
+ ACE_ENV_ARG_DECL)
+{
+ // Typecode of the aliased type.
+ CORBA::TypeCode_var tc2;
+ CORBA::Boolean continue_append = 1;
+
+ // Status of decode operation.
+ TAO::traverse_status retval =
+ TAO::TRAVERSE_CONTINUE;
+
+ tc2 = tc->content_type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO::TRAVERSE_STOP);
+
+ retval = TAO_Marshal_Object::perform_append (tc2.in (),
+ src,
+ dest
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO::TRAVERSE_STOP);
+
+ if (retval == TAO::TRAVERSE_CONTINUE
+ && continue_append == 1)
+ return TAO::TRAVERSE_CONTINUE;
+
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO_Marshal_Alias::append detected error\n")));
+ ACE_THROW_RETURN (CORBA::MARSHAL (0,
+ CORBA::COMPLETED_MAYBE),
+ TAO::TRAVERSE_STOP);
+}
+
+// Decode exception For exceptions, the "hidden" type ID near the
+// front of the on-wire representation was previously unmarshaled and
+// mapped to the "tc" typcode we're using to traverse the memory ...
+// at the same time its vtable, refcount, and other state was
+// established.
+//
+// NOTE: This is asymmetric with respect to encoding exceptions.
+TAO::traverse_status
+TAO_Marshal_Except::append (CORBA::TypeCode_ptr tc,
+ TAO_InputCDR *src,
+ TAO_OutputCDR *dest
+ ACE_ENV_ARG_DECL)
+{
+ TAO::traverse_status retval =
+ TAO::TRAVERSE_CONTINUE;
+ CORBA::Boolean continue_append = 1;
+ CORBA::TypeCode_var param;
+
+ // first append the RepositoryID
+ continue_append = dest->append_string (*src);
+
+ // Number of fields in the struct.
+ const CORBA::ULong member_count =
+ tc->member_count (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO::TRAVERSE_STOP);
+
+ for (CORBA::ULong i = 0;
+ i < member_count
+ && retval == TAO::TRAVERSE_CONTINUE
+ && continue_append == 1;
+ ++i)
+ {
+ param = tc->member_type (i ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO::TRAVERSE_STOP);
+
+ retval = TAO_Marshal_Object::perform_append (param.in (),
+ src,
+ dest
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO::TRAVERSE_STOP);
+ }
+
+ if (retval == TAO::TRAVERSE_CONTINUE
+ && continue_append == 1)
+ return TAO::TRAVERSE_CONTINUE;
+
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO_Marshal_Except::append detected error\n")));
+
+ ACE_THROW_RETURN (CORBA::MARSHAL (0,
+ CORBA::COMPLETED_MAYBE),
+ TAO::TRAVERSE_STOP);
+}
+
+TAO::traverse_status
+TAO_Marshal_WString::append (CORBA::TypeCode_ptr,
+ TAO_InputCDR *src,
+ TAO_OutputCDR *dest
+ ACE_ENV_ARG_DECL)
+{
+ CORBA::Boolean continue_append = 1;
+
+ // On decode, omit the check against specified wstring bounds, and
+ // cope with illegal "zero length" strings (all lengths on the wire
+ // must include a NUL).
+ //
+ // This is on the principle of being gracious in what we accept; we
+ // don't generate messages that fail to comply with protocol specs,
+ // but we will accept them when it's clear how to do so.
+
+ continue_append = dest->append_wstring (*src);
+
+ if (continue_append == 1)
+ return TAO::TRAVERSE_CONTINUE;
+
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO_Marshal_WString::append detected error\n")));
+
+ ACE_THROW_RETURN (CORBA::MARSHAL (0,
+ CORBA::COMPLETED_MAYBE),
+ TAO::TRAVERSE_STOP);
+}
+
+TAO::traverse_status
+TAO_Marshal_Value::append (CORBA::TypeCode_ptr tc,
+ TAO_InputCDR *src,
+ TAO_OutputCDR *dest
+ ACE_ENV_ARG_DECL)
+{
+ TAO::traverse_status retval =
+ TAO::TRAVERSE_CONTINUE;
+
+ // Use the same method to append our base valuetype.
+ // To achive this we'll need to distinguish between
+ // first-time/nested appends so that we won't attempt to
+ // append rep_id several times.
+ //
+ if (this->nested_processing_ == 0)
+ {
+ this->nested_processing_ = 1;
+
+ CORBA::ULong value_tag;
+
+ if (!src->read_ulong (value_tag) ||
+ !dest->write_ulong (value_tag))
+ {
+ return TAO::TRAVERSE_STOP;
+ }
+
+ TAO_ORB_Core *orb_core = src->orb_core ();
+ if (orb_core == 0)
+ {
+ orb_core = TAO_ORB_Core_instance ();
+
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_WARNING,
+ "TAO (%P|%t) WARNING: extracting "
+ "valuetype using default ORB_Core\n"));
+ }
+ }
+
+ TAO_Valuetype_Adapter *adapter = orb_core->valuetype_adapter();
+
+ if (value_tag == 0) // Null value type pointer.
+ {
+ //We are done.
+ return retval;
+ }
+ else if (value_tag & adapter->type_info_single ())
+ {
+ // Append repository id which is of type string.
+ dest->append_string (*src);
+ }
+ else
+ {
+ //@@ boris: VT CDR
+ return TAO::TRAVERSE_STOP;
+ }
+ }
+
+ // Handle our base valuetype if any.
+ CORBA::TypeCode_var param =
+ tc->concrete_base_type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO::TRAVERSE_STOP);
+
+ CORBA::TCKind const param_kind = param->kind (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO::TRAVERSE_STOP);
+
+ if (param_kind != CORBA::tk_null)
+ {
+ retval = this->append (param.in (),
+ src,
+ dest
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO::TRAVERSE_STOP);
+
+ if (retval != TAO::TRAVERSE_CONTINUE)
+ {
+ return retval;
+ }
+ }
+
+ // Number of fields in the struct.
+ const CORBA::ULong member_count =
+ tc->member_count (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO::TRAVERSE_STOP);
+
+ for (CORBA::ULong i = 0;
+ i < member_count && retval == TAO::TRAVERSE_CONTINUE;
+ ++i)
+ {
+ // get member type
+ param = tc->member_type (i ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO::TRAVERSE_STOP);
+
+ retval =
+ TAO_Marshal_Object::perform_append (param.in (),
+ src,
+ dest
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO::TRAVERSE_STOP);
+ }
+
+ if (retval == TAO::TRAVERSE_CONTINUE)
+ return TAO::TRAVERSE_CONTINUE;
+
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO_Marshal_Value::append detected error\n")));
+
+ ACE_THROW_RETURN (CORBA::MARSHAL (0,
+ CORBA::COMPLETED_MAYBE),
+ TAO::TRAVERSE_STOP);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/AnyTypeCode/skip.cpp b/TAO/tao/AnyTypeCode/skip.cpp
new file mode 100644
index 00000000000..f8c486bc6a2
--- /dev/null
+++ b/TAO/tao/AnyTypeCode/skip.cpp
@@ -0,0 +1,1078 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO
+//
+// = FILENAME
+// skip.cpp
+//
+// = DESCRIPTION
+// Code for skipping different data types
+//
+// Data types encoded as CDR streams need to be skipped when they
+// are part of an Any.
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#include "tao/AnyTypeCode/Marshal.h"
+#include "tao/AnyTypeCode/TypeCode.h"
+#include "tao/AnyTypeCode/Any_Unknown_IDL_Type.h"
+#include "tao/AnyTypeCode/Any.h"
+
+#include "tao/debug.h"
+#include "tao/Valuetype_Adapter.h"
+#include "tao/ORB_Core.h"
+#include "tao/CDR.h"
+#include "tao/SystemException.h"
+
+#include "ace/Dynamic_Service.h"
+
+ACE_RCSID (AnyTypeCode,
+ skip,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO::traverse_status
+TAO_Marshal_Primitive::skip (CORBA::TypeCode_ptr tc,
+ TAO_InputCDR *stream
+ ACE_ENV_ARG_DECL)
+{
+ CORBA::Boolean continue_skipping = true;
+
+ // Status of skip operation.
+ TAO::traverse_status retval = TAO::TRAVERSE_CONTINUE;
+
+ CORBA::TCKind const k = tc->kind (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO::TRAVERSE_STOP);
+
+ switch (k)
+ {
+ case CORBA::tk_null:
+ case CORBA::tk_void:
+ break;
+ case CORBA::tk_short:
+ case CORBA::tk_ushort:
+ continue_skipping = stream->skip_short ();
+ break;
+ case CORBA::tk_long:
+ case CORBA::tk_ulong:
+ case CORBA::tk_float:
+ case CORBA::tk_enum:
+ continue_skipping = stream->skip_long ();
+ break;
+ case CORBA::tk_double:
+ case CORBA::tk_longlong:
+ case CORBA::tk_ulonglong:
+ continue_skipping = stream->skip_longlong ();
+ break;
+ case CORBA::tk_boolean:
+ continue_skipping = stream->skip_boolean ();
+ break;
+ case CORBA::tk_char:
+ case CORBA::tk_octet:
+ continue_skipping = stream->skip_char ();
+ break;
+ case CORBA::tk_longdouble:
+ continue_skipping = stream->skip_longdouble ();
+ break;
+ case CORBA::tk_wchar:
+ continue_skipping = stream->skip_wchar ();
+ break;
+ default:
+ retval = TAO::TRAVERSE_STOP;
+ // we are not a primitive type
+ }
+ if (retval == TAO::TRAVERSE_CONTINUE && continue_skipping)
+ return TAO::TRAVERSE_CONTINUE;
+ else
+ {
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT ("TAO_Marshal_Primitive::skip detected error\n")
+ ));
+ ACE_THROW_RETURN (CORBA::MARSHAL (0,
+ CORBA::COMPLETED_MAYBE),
+ TAO::TRAVERSE_STOP);
+ }
+}
+
+TAO::traverse_status
+TAO_Marshal_Any::skip (CORBA::TypeCode_ptr,
+ TAO_InputCDR *stream
+ ACE_ENV_ARG_DECL)
+{
+ // Typecode of the element that makes the Any.
+ CORBA::TypeCode_var elem_tc;
+
+ // Status of encode operation.
+ if (!(*stream >> elem_tc.inout ()))
+ return TAO::TRAVERSE_STOP;
+
+ return TAO_Marshal_Object::perform_skip (elem_tc.in (),
+ stream
+ ACE_ENV_ARG_PARAMETER);
+}
+
+TAO::traverse_status
+TAO_Marshal_TypeCode::skip (CORBA::TypeCode_ptr,
+ TAO_InputCDR *stream
+ ACE_ENV_ARG_DECL)
+{
+ CORBA::Boolean continue_skipping = true;
+
+ // Typecode kind.
+ CORBA::ULong kind;
+
+ // Decode the "kind" field of the typecode from the stream.
+ continue_skipping = stream->read_ulong (kind);
+
+ if (continue_skipping)
+ {
+ // Typecodes with empty parameter lists all have preallocated
+ // constants. We use those to reduce memory consumption and
+ // heap access ... also, to speed things up!
+ if ((kind < CORBA::TAO_TC_KIND_COUNT) ||
+ (kind == ~0u))
+ {
+ // Either a non-constant typecode or an indirected typecode.
+ switch (kind)
+ {
+ // Need special handling for all kinds of typecodes that
+ // have nonempty parameter lists ...
+ default:
+ // simple typecodes, nothing to do
+ break;
+ case CORBA::tk_string:
+ case CORBA::tk_wstring:
+ {
+ // skip the bounds
+ continue_skipping = stream->skip_ulong ();
+ }
+ break;
+
+ // Indirected typecodes, illegal at "top level".
+ case ~0u:
+ {
+ // skip the long indicating the encapsulation offset,
+ continue_skipping = stream->skip_long ();
+ }
+ break;
+
+ // The rest have "complex" parameter lists that are
+ // encoded as bulk octets ...
+ case CORBA::tk_objref:
+ case CORBA::tk_struct:
+ case CORBA::tk_union:
+ case CORBA::tk_enum:
+ case CORBA::tk_sequence:
+ case CORBA::tk_array:
+ case CORBA::tk_alias:
+ case CORBA::tk_except:
+ case CORBA::tk_value:
+ case CORBA::tk_value_box:
+ case CORBA::tk_native:
+ case CORBA::tk_abstract_interface:
+ case CORBA::tk_local_interface:
+ case CORBA::tk_component:
+ case CORBA::tk_home:
+ case CORBA::tk_event:
+ {
+ CORBA::ULong length;
+
+ // get the encapsulation length
+ continue_skipping = stream->read_ulong (length);
+ if (!continue_skipping)
+ break;
+ // skip the encapsulation
+ continue_skipping = stream->skip_bytes (length);
+ }
+ } // end of switch
+ }
+ else // bad kind_ value to be decoded
+ {
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO_Marshal_TypeCode::skip: ")
+ ACE_TEXT ("Bad kind_ value in CDR stream\n")));
+ ACE_THROW_RETURN (CORBA::BAD_TYPECODE (),
+ TAO::TRAVERSE_STOP);
+ }
+ }
+
+ if (continue_skipping)
+ return TAO::TRAVERSE_CONTINUE;
+ else
+ {
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT ("TAO_Marshal_TypeCode::skip detected error\n")
+ ));
+ ACE_THROW_RETURN (CORBA::MARSHAL (0,
+ CORBA::COMPLETED_MAYBE),
+ TAO::TRAVERSE_STOP);
+ }
+}
+
+TAO::traverse_status
+TAO_Marshal_Principal::skip (CORBA::TypeCode_ptr,
+ TAO_InputCDR *stream
+ ACE_ENV_ARG_DECL)
+{
+ CORBA::Boolean continue_skipping = true;
+
+ // specifies the number of bytes in the Principal
+ CORBA::ULong len;
+
+ continue_skipping = stream->read_ulong (len);
+ if (len > 0 && continue_skipping)
+ {
+ continue_skipping = stream->skip_bytes (len);
+ }
+
+ if (continue_skipping)
+ return TAO::TRAVERSE_CONTINUE;
+ else
+ {
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT ("TAO_Marshal_Principal::skip detected error\n")
+ ));
+ ACE_THROW_RETURN (CORBA::MARSHAL (0,
+ CORBA::COMPLETED_MAYBE),
+ TAO::TRAVERSE_STOP);
+ }
+}
+
+TAO::traverse_status
+TAO_Marshal_ObjRef::skip (CORBA::TypeCode_ptr,
+ TAO_InputCDR *stream
+ ACE_ENV_ARG_DECL)
+{
+ CORBA::Boolean continue_skipping = true;
+
+ // return status
+ TAO::traverse_status retval =
+ TAO::TRAVERSE_CONTINUE;
+
+ // First, skip the type hint. This will be the type_id encoded in an
+ // object reference.
+ stream->skip_string ();
+
+ // Read the profiles, discarding all until an IIOP profile comes by.
+ // Once we see an IIOP profile, ignore any further ones.
+ //
+ // XXX this will need to change someday to let different protocol
+ // code be accessed, not just IIOP. Protocol modules will be
+ // dynamically loaded from shared libraries via ORB_init (), and we
+ // just need to be able to access such preloaded libraries here as
+ // we unmarshal objrefs.
+ CORBA::ULong profiles = 0;
+
+ // get the count of profiles that follow
+ continue_skipping = stream->read_ulong (profiles);
+
+ while (profiles-- != 0 && continue_skipping)
+ {
+ CORBA::ULong tag;
+
+ // get the profile ID tag
+ if ( (continue_skipping = stream->read_ulong (tag)) == 0)
+ continue;
+
+ CORBA::ULong encap_len;
+ // ProfileData is encoded as a sequence of octet. So first get
+ // the length of the sequence.
+ // Create the decoding stream from the encapsulation in the
+ // buffer, and skip the encapsulation.
+ if ( (continue_skipping = stream->read_ulong (encap_len)) == 0)
+ continue;
+
+ continue_skipping = stream->skip_bytes (encap_len);
+ }
+
+ if (retval == TAO::TRAVERSE_CONTINUE && continue_skipping)
+ return TAO::TRAVERSE_CONTINUE;
+ else
+ {
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT ("TAO_Marshal_ObjRef::skip detected error\n")
+ ));
+ ACE_THROW_RETURN (CORBA::MARSHAL (0,
+ CORBA::COMPLETED_MAYBE),
+ TAO::TRAVERSE_STOP);
+ }
+}
+
+TAO::traverse_status
+TAO_Marshal_Struct::skip (CORBA::TypeCode_ptr tc,
+ TAO_InputCDR *stream
+ ACE_ENV_ARG_DECL)
+{
+ TAO::traverse_status retval = TAO::TRAVERSE_CONTINUE;
+ CORBA::TypeCode_var param;
+
+ // Number of fields in the struct.
+ CORBA::ULong const member_count =
+ tc->member_count (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO::TRAVERSE_STOP);
+
+ for (CORBA::ULong i = 0;
+ i < member_count && retval == TAO::TRAVERSE_CONTINUE;
+ ++i)
+ {
+ param = tc->member_type (i ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO::TRAVERSE_STOP);
+
+ retval = TAO_Marshal_Object::perform_skip (param.in (),
+ stream
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO::TRAVERSE_STOP);
+ }
+
+ if (retval == TAO::TRAVERSE_CONTINUE)
+ return TAO::TRAVERSE_CONTINUE;
+
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO_Marshal_Struct::skip detected error\n")));
+
+ ACE_THROW_RETURN (CORBA::MARSHAL (0,
+ CORBA::COMPLETED_MAYBE),
+ TAO::TRAVERSE_STOP);
+}
+
+TAO::traverse_status
+TAO_Marshal_Union::skip (CORBA::TypeCode_ptr tc,
+ TAO_InputCDR *src
+ ACE_ENV_ARG_DECL)
+{
+ CORBA::TypeCode_var discrim_tc =
+ tc->discriminator_type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO::TRAVERSE_STOP);
+
+ CORBA::ULong const kind =
+ discrim_tc->kind (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO::TRAVERSE_STOP);
+
+ // Save the discriminator value in a temporary variable...
+ CORBA::Short short_v = CORBA::Short();
+ CORBA::UShort ushort_v = CORBA::UShort();
+ CORBA::Long long_v = CORBA::Long();
+ CORBA::ULong ulong_v = CORBA::ULong();
+ CORBA::ULong enum_v = CORBA::ULong();
+ CORBA::Char char_v = CORBA::Char();
+ CORBA::WChar wchar_v = CORBA::WChar();
+ CORBA::Boolean boolean_v = false;
+
+ switch (kind)
+ {
+ case CORBA::tk_short:
+ {
+ if (!src->read_short (short_v))
+ return TAO::TRAVERSE_STOP;
+ }
+ break;
+
+ case CORBA::tk_ushort:
+ {
+ if (!src->read_ushort (ushort_v))
+ return TAO::TRAVERSE_STOP;
+ }
+ break;
+
+ case CORBA::tk_long:
+ {
+ if (!src->read_long (long_v))
+ return TAO::TRAVERSE_STOP;
+ }
+ break;
+
+ case CORBA::tk_ulong:
+ {
+ if (!src->read_ulong (ulong_v))
+ return TAO::TRAVERSE_STOP;
+ }
+ break;
+
+ case CORBA::tk_enum:
+ {
+ if (!src->read_ulong (enum_v))
+ return TAO::TRAVERSE_STOP;
+ }
+ break;
+
+ case CORBA::tk_char:
+ {
+ if (!src->read_char (char_v))
+ return TAO::TRAVERSE_STOP;
+ }
+ break;
+
+ case CORBA::tk_wchar:
+ {
+ if (!src->read_wchar (wchar_v))
+ return TAO::TRAVERSE_STOP;
+ }
+ break;
+
+ case CORBA::tk_boolean:
+ {
+ if (!src->read_boolean (boolean_v))
+ return TAO::TRAVERSE_STOP;
+ }
+ break;
+
+ default:
+ return TAO::TRAVERSE_STOP;
+ }
+
+ const CORBA::ULong member_count =
+ tc->member_count (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO::TRAVERSE_STOP);
+
+ const CORBA::ULong null_member = ~static_cast<CORBA::ULong> (0U);
+
+ CORBA::ULong current_member = null_member;
+ CORBA::ULong default_member = null_member;
+
+ for (CORBA::ULong i = 0;
+ i < member_count && current_member == null_member;
+ ++i)
+ {
+ CORBA::Any_var any = tc->member_label (i ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO::TRAVERSE_STOP);
+
+ CORBA::Octet o;
+ if ((any >>= CORBA::Any::to_octet (o)) && o == 0)
+ {
+ CORBA::ULong default_index =
+ tc->default_index (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO::TRAVERSE_STOP);
+
+ if (i != default_index)
+ ACE_THROW_RETURN (CORBA::BAD_TYPECODE (),
+ TAO::TRAVERSE_STOP);
+ // Found the default branch, save its position and continue
+ // trying to find the current value...
+ default_member = i;
+ continue;
+ }
+
+ switch (kind)
+ {
+ case CORBA::tk_short:
+ {
+ CORBA::Short d;
+ if ((any >>= d) && d == short_v)
+ current_member = i;
+ }
+ break;
+
+ case CORBA::tk_ushort:
+ {
+ CORBA::UShort d;
+ if ((any >>= d) && d == ushort_v)
+ current_member = i;
+ }
+ break;
+
+ case CORBA::tk_long:
+ {
+ CORBA::Long d;
+ if ((any >>= d) && d == long_v)
+ current_member = i;
+ }
+ break;
+
+ case CORBA::tk_ulong:
+ {
+ CORBA::ULong d;
+ if ((any >>= d) && d == ulong_v)
+ current_member = i;
+ }
+ break;
+
+ case CORBA::tk_enum:
+ {
+ CORBA::ULong d;
+ TAO::Any_Impl *impl = any->impl ();
+
+ if (impl->encoded ())
+ {
+ TAO::Unknown_IDL_Type *unk =
+ dynamic_cast<TAO::Unknown_IDL_Type *> (impl);
+
+ // We don't want unk's rd_ptr to move, in case
+ // we are shared by another Any, so we use this
+ // to copy the state, not the buffer.
+ TAO_InputCDR for_reading (unk->_tao_get_cdr ());
+
+ for_reading.read_ulong (d);
+ }
+ else
+ {
+ TAO_OutputCDR out;
+ impl->marshal_value (out);
+ TAO_InputCDR cdr (out);
+ cdr.read_ulong (d);
+ }
+
+ if (d == enum_v)
+ {
+ current_member = i;
+ }
+ }
+ break;
+
+ case CORBA::tk_char:
+ {
+ CORBA::Char d;
+ if ((any >>= CORBA::Any::to_char (d)) && d == char_v)
+ current_member = i;
+ }
+ break;
+
+ case CORBA::tk_wchar:
+ {
+ CORBA::WChar d;
+ if ((any >>= CORBA::Any::to_wchar (d)) && d == wchar_v)
+ current_member = i;
+ }
+ break;
+
+ case CORBA::tk_boolean:
+ {
+ CORBA::Boolean d;
+ if ((any >>= CORBA::Any::to_boolean (d)) && d == boolean_v)
+ current_member = i;
+ }
+ break;
+
+ default:
+ return TAO::TRAVERSE_STOP;
+ }
+ }
+
+ if (current_member == null_member)
+ {
+ // Cannot find the current member, check if there is a
+ // default...
+ if (default_member != null_member)
+ {
+ // Good, use the default to append...
+ CORBA::TypeCode_var member_tc =
+ tc->member_type (default_member ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO::TRAVERSE_STOP);
+ return TAO_Marshal_Object::perform_skip (member_tc.in (),
+ src
+ ACE_ENV_ARG_PARAMETER);
+ }
+
+ // If we're here, we have an implicit default case, and we
+ // should just return without skipping anything, since no
+ // union member was marshaled in the first place.
+ return TAO::TRAVERSE_CONTINUE;
+ }
+
+ // If we found the member successfully then just use that one...
+ CORBA::TypeCode_var member_tc =
+ tc->member_type (current_member ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO::TRAVERSE_STOP);
+
+ return TAO_Marshal_Object::perform_skip (member_tc.in (),
+ src
+ ACE_ENV_ARG_PARAMETER);
+}
+
+TAO::traverse_status
+TAO_Marshal_String::skip (CORBA::TypeCode_ptr,
+ TAO_InputCDR *stream
+ ACE_ENV_ARG_DECL)
+{
+ CORBA::Boolean continue_skipping = true;
+
+ // On decode, omit the check against specified string bounds, and
+ // cope with illegal "zero length" strings (all lengths on the wire
+ // must include a NUL).
+ //
+ // This is on the principle of being gracious in what we accept; we
+ // don't generate messages that fail to comply with protocol specs,
+ // but we will accept them when it's clear how to do so.
+
+ continue_skipping = stream->skip_string ();
+ if (continue_skipping)
+ return TAO::TRAVERSE_CONTINUE;
+ else
+ {
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO_Marshal_String::skip detected error\n")));
+ ACE_THROW_RETURN (CORBA::MARSHAL (0,
+ CORBA::COMPLETED_MAYBE),
+ TAO::TRAVERSE_STOP);
+ }
+}
+
+TAO::traverse_status
+TAO_Marshal_Sequence::skip (CORBA::TypeCode_ptr tc,
+ TAO_InputCDR *stream
+ ACE_ENV_ARG_DECL)
+{
+ // Size of element.
+ CORBA::ULong bounds;
+
+ // First unmarshal the sequence length ... we trust it to be right
+ // here, on the "be gracious in what you accept" principle. We
+ // don't generate illegal sequences (i.e. length > bounds).
+
+ CORBA::Boolean continue_skipping =
+ stream->read_ulong (bounds);
+
+ if (!continue_skipping)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO_Marshal_Sequence::skip detected error\n")));
+ ACE_THROW_RETURN (CORBA::MARSHAL (),
+ TAO::TRAVERSE_STOP);
+ }
+
+ // No point decoding an empty sequence.
+ if (bounds == 0)
+ return TAO::TRAVERSE_CONTINUE;
+
+ // Get element typecode.
+ CORBA::TypeCode_var tc2 =
+ tc->content_type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO::TRAVERSE_STOP);
+
+ // For CORBA basic types, the skip can be optimized
+ CORBA::TCKind const kind = tc2->kind (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO::TRAVERSE_STOP);
+
+ char *dummy;
+ switch (kind)
+ {
+ case CORBA::tk_octet:
+ case CORBA::tk_boolean:
+ case CORBA::tk_char:
+ {
+ stream->adjust (0, ACE_CDR::OCTET_ALIGN, dummy);
+ continue_skipping =
+ stream->skip_bytes (ACE_CDR::OCTET_SIZE * bounds);
+ }
+ break;
+ case CORBA::tk_short:
+ case CORBA::tk_ushort:
+ case CORBA::tk_wchar:
+ {
+ stream->adjust (0, ACE_CDR::SHORT_ALIGN, dummy);
+ continue_skipping =
+ stream->skip_bytes (ACE_CDR::SHORT_SIZE * bounds);
+ }
+ break;
+ case CORBA::tk_long:
+ case CORBA::tk_ulong:
+ case CORBA::tk_float:
+ {
+ stream->adjust (0, ACE_CDR::LONG_ALIGN, dummy);
+ continue_skipping =
+ stream->skip_bytes (ACE_CDR::LONG_SIZE * bounds);
+ }
+ break;
+ case CORBA::tk_double:
+ case CORBA::tk_longlong:
+ case CORBA::tk_ulonglong:
+ {
+ stream->adjust (0, ACE_CDR::LONGLONG_ALIGN, dummy);
+ continue_skipping =
+ stream->skip_bytes (ACE_CDR::LONGLONG_SIZE * bounds);
+ }
+ break;
+ case CORBA::tk_longdouble:
+ {
+ stream->adjust (0, ACE_CDR::LONGDOUBLE_ALIGN, dummy);
+ continue_skipping =
+ stream->skip_bytes (ACE_CDR::LONGDOUBLE_SIZE * bounds);
+ }
+ break;
+
+ default:
+ while (bounds-- && continue_skipping)
+ {
+ continue_skipping =
+ TAO_Marshal_Object::perform_skip (tc2.in (),
+ stream
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO::TRAVERSE_STOP);
+ }
+ break;
+ }// end of switch
+
+ if (continue_skipping)
+ return TAO::TRAVERSE_CONTINUE;
+
+ // error exit
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO_Marshal_Sequence::skip detected error\n")));
+
+ ACE_THROW_RETURN (CORBA::MARSHAL (),
+ TAO::TRAVERSE_STOP);
+}
+
+TAO::traverse_status
+TAO_Marshal_Array::skip (CORBA::TypeCode_ptr tc,
+ TAO_InputCDR *stream
+ ACE_ENV_ARG_DECL)
+{
+ CORBA::Boolean continue_skipping = true;
+
+ // retrieve the bounds of the array
+ CORBA::ULong bounds = tc->length (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO::TRAVERSE_STOP);
+
+ // get element typecode
+ // Typecode of the element.
+ CORBA::TypeCode_var tc2 = tc->content_type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO::TRAVERSE_STOP);
+
+ // For CORBA basic types, the skip can be optimized
+ CORBA::TCKind const kind = tc2->kind (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO::TRAVERSE_STOP);
+
+ char *dummy;
+ switch (kind)
+ {
+ case CORBA::tk_octet:
+ case CORBA::tk_boolean:
+ case CORBA::tk_char:
+ {
+ stream->adjust (0, ACE_CDR::OCTET_ALIGN, dummy);
+ continue_skipping =
+ stream->skip_bytes (ACE_CDR::OCTET_SIZE * bounds);
+ }
+ break;
+ case CORBA::tk_short:
+ case CORBA::tk_ushort:
+ case CORBA::tk_wchar:
+ {
+ stream->adjust (0, ACE_CDR::SHORT_ALIGN, dummy);
+ continue_skipping =
+ stream->skip_bytes (ACE_CDR::SHORT_SIZE * bounds);
+ }
+ break;
+ case CORBA::tk_long:
+ case CORBA::tk_ulong:
+ case CORBA::tk_float:
+ {
+ stream->adjust (0, ACE_CDR::LONG_ALIGN, dummy);
+ continue_skipping =
+ stream->skip_bytes (ACE_CDR::LONG_SIZE * bounds);
+ }
+ break;
+ case CORBA::tk_double:
+ case CORBA::tk_longlong:
+ case CORBA::tk_ulonglong:
+ {
+ stream->adjust (0, ACE_CDR::LONGLONG_ALIGN, dummy);
+ continue_skipping =
+ stream->skip_bytes (ACE_CDR::LONGLONG_SIZE * bounds);
+ }
+ break;
+ case CORBA::tk_longdouble:
+ {
+ stream->adjust (0, ACE_CDR::LONGDOUBLE_ALIGN, dummy);
+ continue_skipping =
+ stream->skip_bytes (ACE_CDR::LONGDOUBLE_SIZE * bounds);
+ }
+ break;
+
+ default:
+ while (bounds-- && continue_skipping)
+ {
+ int stop =
+ TAO_Marshal_Object::perform_skip (tc2.in (),
+ stream
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO::TRAVERSE_STOP);
+ if (stop == TAO::TRAVERSE_STOP)
+ continue_skipping = false;
+ }
+ break;
+ }// end of switch
+
+ if (continue_skipping)
+ return TAO::TRAVERSE_CONTINUE;
+
+ // error exit
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO_Marshal_Sequence::skip detected error\n")));
+
+ ACE_THROW_RETURN (CORBA::MARSHAL (),
+ TAO::TRAVERSE_STOP);
+}
+
+TAO::traverse_status
+TAO_Marshal_Alias::skip (CORBA::TypeCode_ptr tc,
+ TAO_InputCDR *stream
+ ACE_ENV_ARG_DECL)
+{
+ // Typecode of the aliased type.
+ CORBA::TypeCode_var tc2;
+ CORBA::Boolean continue_skipping = true;
+
+ // Status of decode operation.
+ TAO::traverse_status retval =
+ TAO::TRAVERSE_CONTINUE;
+
+ tc2 = tc->content_type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO::TRAVERSE_STOP);
+
+ retval = TAO_Marshal_Object::perform_skip (tc2.in (),
+ stream
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO::TRAVERSE_STOP);
+
+ // tc2->_decr_refcnt ();
+ if (retval == TAO::TRAVERSE_CONTINUE
+ && continue_skipping)
+ return TAO::TRAVERSE_CONTINUE;
+
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO_Marshal_Alias::skip detected error\n")));
+
+ ACE_THROW_RETURN (CORBA::MARSHAL (0,
+ CORBA::COMPLETED_MAYBE),
+ TAO::TRAVERSE_STOP);
+}
+
+// Decode exception For exceptions, the "hidden" type ID near the
+// front of the on-wire representation was previously unmarshaled and
+// mapped to the "tc" typcode we're using to traverse the memory ...
+// at the same time its vtable, refcount, and other state was
+// established.
+//
+// NOTE: This is asymmetric with respect to encoding exceptions.
+TAO::traverse_status
+TAO_Marshal_Except::skip (CORBA::TypeCode_ptr tc,
+ TAO_InputCDR *stream
+ ACE_ENV_ARG_DECL)
+{
+ TAO::traverse_status retval =
+ TAO::TRAVERSE_CONTINUE;
+ CORBA::TypeCode_var param;
+
+ // skip the Repository ID
+ if (!stream->skip_string ())
+ return TAO::TRAVERSE_STOP;
+
+ // Number of fields in the exception
+ const CORBA::ULong member_count =
+ tc->member_count (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO::TRAVERSE_STOP);
+
+ for (CORBA::ULong i = 0;
+ i < member_count && retval == TAO::TRAVERSE_CONTINUE;
+ ++i)
+ {
+ param = tc->member_type (i ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO::TRAVERSE_STOP);
+
+ retval = TAO_Marshal_Object::perform_skip (param.in (),
+ stream
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO::TRAVERSE_STOP);
+ }
+
+ if (retval == TAO::TRAVERSE_CONTINUE)
+ return TAO::TRAVERSE_CONTINUE;
+
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO_Marshal_Except::skip detected error\n")));
+
+ ACE_THROW_RETURN (CORBA::MARSHAL (0,
+ CORBA::COMPLETED_MAYBE),
+ TAO::TRAVERSE_STOP);
+}
+
+// decode wstring
+TAO::traverse_status
+TAO_Marshal_WString::skip (CORBA::TypeCode_ptr,
+ TAO_InputCDR *stream
+ ACE_ENV_ARG_DECL)
+{
+ CORBA::Boolean continue_skipping = true;
+
+ // On decode, omit the check against specified wstring bounds, and
+ // cope with illegal "zero length" strings (all lengths on the wire
+ // must include a NUL).
+ //
+ // This is on the principle of being gracious in what we accept; we
+ // don't generate messages that fail to comply with protocol specs,
+ // but we will accept them when it's clear how to do so.
+
+ // "zero length" wstrings are legal in GIOP 1.2.
+
+ continue_skipping = stream->skip_wstring ();
+
+ if (continue_skipping)
+ return TAO::TRAVERSE_CONTINUE;
+
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO_Marshal_WString::skip detected error\n")));
+ ACE_THROW_RETURN (CORBA::MARSHAL (0,
+ CORBA::COMPLETED_MAYBE),
+ TAO::TRAVERSE_STOP);
+}
+
+TAO::traverse_status
+TAO_Marshal_Value::skip (CORBA::TypeCode_ptr tc,
+ TAO_InputCDR *stream
+ ACE_ENV_ARG_DECL)
+{
+ TAO::traverse_status retval = TAO::TRAVERSE_CONTINUE;
+ CORBA::TypeCode_var param;
+
+ // Use the same method to skip over our base valuetype.
+ // To achive this we'll need to distinguish between
+ // first-time/nested skips so that we won't attempt to
+ // skip rep_id several times.
+ //
+ if (this->nested_processing_ == false)
+ {
+ this->nested_processing_ = true;
+
+ CORBA::Long value_tag;
+
+ if (!stream->read_long (value_tag))
+ {
+ return TAO::TRAVERSE_STOP;
+ }
+
+ TAO_ORB_Core *orb_core = stream->orb_core ();
+ if (orb_core == 0)
+ {
+ orb_core = TAO_ORB_Core_instance ();
+
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_WARNING,
+ "TAO (%P|%t) WARNING: extracting "
+ "valuetype using default ORB_Core\n"));
+ }
+ }
+
+ TAO_Valuetype_Adapter *adapter = orb_core->valuetype_adapter();
+
+ if (value_tag == 0) // Null value type pointer.
+ {
+ // We are done.
+ return retval;
+ }
+ else if (adapter->is_type_info_single(value_tag))
+ {
+ // Skip a single repository id which is of type string.
+ stream->skip_string ();
+ }
+ else if (adapter->is_type_info_list(value_tag))
+ {
+ CORBA::Long num_types;
+ if (!stream->read_long (num_types))
+ {
+ return TAO::TRAVERSE_STOP;
+ }
+ while (num_types > 0)
+ {
+ stream->skip_string();
+ num_types--;
+ }
+ }
+ else if (!adapter->is_type_info_implied (value_tag))
+ {
+ //@@ boris: VT CDR
+ return TAO::TRAVERSE_STOP;
+ }
+
+ if (adapter->is_value_chunked (value_tag))
+ {
+ CORBA::Long chunk_tag = 0;
+ while (chunk_tag != -1)
+ {
+ if (!stream->read_long (chunk_tag))
+ return TAO::TRAVERSE_STOP;
+
+ if (chunk_tag > 0)
+ {
+ if (!stream->skip_bytes(chunk_tag))
+ return TAO::TRAVERSE_STOP;
+ }
+ }
+ return TAO::TRAVERSE_CONTINUE;
+ }
+
+ }
+
+ // Handle our base valuetype if any.
+ param = tc->concrete_base_type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO::TRAVERSE_STOP);
+
+ CORBA::TCKind const k = param->kind (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO::TRAVERSE_STOP);
+
+ if (k != CORBA::tk_null)
+ {
+ retval = this->skip (param.in (), stream ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO::TRAVERSE_STOP);
+
+ if (retval != TAO::TRAVERSE_CONTINUE)
+ {
+ return retval;
+ }
+ }
+
+ // Number of fields in the valuetype.
+ CORBA::ULong const member_count =
+ tc->member_count (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO::TRAVERSE_STOP);
+
+ for (CORBA::ULong i = 0;
+ i < member_count && retval == TAO::TRAVERSE_CONTINUE;
+ ++i)
+ {
+ param = tc->member_type (i ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO::TRAVERSE_STOP);
+
+ retval = TAO_Marshal_Object::perform_skip (param.in (),
+ stream
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO::TRAVERSE_STOP);
+ }
+
+ if (retval == TAO::TRAVERSE_CONTINUE)
+ return TAO::TRAVERSE_CONTINUE;
+
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO_Marshal_Value::skip detected error\n")));
+
+ ACE_THROW_RETURN (CORBA::MARSHAL (0,
+ CORBA::COMPLETED_MAYBE),
+ TAO::TRAVERSE_STOP);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/AnyTypeCode_Adapter.cpp b/TAO/tao/AnyTypeCode_Adapter.cpp
new file mode 100644
index 00000000000..d9da63d780f
--- /dev/null
+++ b/TAO/tao/AnyTypeCode_Adapter.cpp
@@ -0,0 +1,15 @@
+// $Id$
+
+#include "tao/AnyTypeCode_Adapter.h"
+
+ACE_RCSID (tao,
+ TAO_AnyTypeCode_Adapter,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_AnyTypeCode_Adapter::~TAO_AnyTypeCode_Adapter (void)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/AnyTypeCode_Adapter.h b/TAO/tao/AnyTypeCode_Adapter.h
new file mode 100644
index 00000000000..9fd002af542
--- /dev/null
+++ b/TAO/tao/AnyTypeCode_Adapter.h
@@ -0,0 +1,142 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file AnyTypeCode_Adapter.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+
+#ifndef TAO_ANYTYPECODE_ADAPTER
+#define TAO_ANYTYPECODE_ADAPTER
+
+#include /**/ "ace/pre.h"
+
+#include "tao/TAO_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/Service_Object.h"
+#include "ace/CDR_Stream.h"
+
+#include "tao/Basic_Types.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace CORBA
+{
+ class TypeCode;
+ typedef TypeCode *TypeCode_ptr;
+
+ class Any;
+
+ class Policy;
+ typedef Policy *Policy_ptr;
+}
+
+
+/**
+ * @class TAO_AnyTypeCode_Adapter
+ */
+class TAO_Export TAO_AnyTypeCode_Adapter
+ : public ACE_Service_Object
+{
+public:
+ virtual ~TAO_AnyTypeCode_Adapter (void);
+
+#define ANYTYPECODE__EXCEPTION_LIST \
+ TAO_SYSTEM_EXCEPTION (UNKNOWN) \
+ TAO_SYSTEM_EXCEPTION (BAD_PARAM) \
+ TAO_SYSTEM_EXCEPTION (NO_MEMORY) \
+ TAO_SYSTEM_EXCEPTION (IMP_LIMIT) \
+ TAO_SYSTEM_EXCEPTION (COMM_FAILURE) \
+ TAO_SYSTEM_EXCEPTION (INV_OBJREF) \
+ TAO_SYSTEM_EXCEPTION (OBJECT_NOT_EXIST) \
+ TAO_SYSTEM_EXCEPTION (NO_PERMISSION) \
+ TAO_SYSTEM_EXCEPTION (INTERNAL) \
+ TAO_SYSTEM_EXCEPTION (MARSHAL) \
+ TAO_SYSTEM_EXCEPTION (INITIALIZE) \
+ TAO_SYSTEM_EXCEPTION (NO_IMPLEMENT) \
+ TAO_SYSTEM_EXCEPTION (BAD_TYPECODE) \
+ TAO_SYSTEM_EXCEPTION (BAD_OPERATION) \
+ TAO_SYSTEM_EXCEPTION (NO_RESOURCES) \
+ TAO_SYSTEM_EXCEPTION (NO_RESPONSE) \
+ TAO_SYSTEM_EXCEPTION (PERSIST_STORE) \
+ TAO_SYSTEM_EXCEPTION (BAD_INV_ORDER) \
+ TAO_SYSTEM_EXCEPTION (TRANSIENT) \
+ TAO_SYSTEM_EXCEPTION (FREE_MEM) \
+ TAO_SYSTEM_EXCEPTION (INV_IDENT) \
+ TAO_SYSTEM_EXCEPTION (INV_FLAG) \
+ TAO_SYSTEM_EXCEPTION (INTF_REPOS) \
+ TAO_SYSTEM_EXCEPTION (BAD_CONTEXT) \
+ TAO_SYSTEM_EXCEPTION (OBJ_ADAPTER) \
+ TAO_SYSTEM_EXCEPTION (DATA_CONVERSION) \
+ TAO_SYSTEM_EXCEPTION (INV_POLICY) \
+ TAO_SYSTEM_EXCEPTION (REBIND) \
+ TAO_SYSTEM_EXCEPTION (TIMEOUT) \
+ TAO_SYSTEM_EXCEPTION (TRANSACTION_UNAVAILABLE) \
+ TAO_SYSTEM_EXCEPTION (TRANSACTION_MODE) \
+ TAO_SYSTEM_EXCEPTION (TRANSACTION_REQUIRED) \
+ TAO_SYSTEM_EXCEPTION (TRANSACTION_ROLLEDBACK) \
+ TAO_SYSTEM_EXCEPTION (INVALID_TRANSACTION) \
+ TAO_SYSTEM_EXCEPTION (CODESET_INCOMPATIBLE) \
+ TAO_SYSTEM_EXCEPTION (BAD_QOS) \
+ TAO_SYSTEM_EXCEPTION (INVALID_ACTIVITY) \
+ TAO_SYSTEM_EXCEPTION (ACTIVITY_COMPLETED) \
+ TAO_SYSTEM_EXCEPTION (ACTIVITY_REQUIRED) \
+ TAO_SYSTEM_EXCEPTION (THREAD_CANCELLED) \
+ TAO_SYSTEM_EXCEPTION (WrongTransaction) \
+ TAO_SYSTEM_EXCEPTION (PolicyError) \
+ TAO_SYSTEM_EXCEPTION (InvalidPolicies)
+
+#define TAO_SYSTEM_EXCEPTION(name) \
+ virtual CORBA::TypeCode_ptr _tao_type_ ## name (void) const = 0;
+
+ANYTYPECODE__EXCEPTION_LIST
+#undef TAO_SYSTEM_EXCEPTION
+
+ virtual void insert_into_any (CORBA::Any * any, CORBA::Char const * mychar) = 0;
+
+ virtual void insert_into_any (CORBA::Any * any, CORBA::WChar const * mywchar) = 0;
+
+ virtual void insert_into_any (CORBA::Any * any, CORBA::Policy_ptr policy) = 0;
+
+ virtual void insert_into_any (CORBA::Any * any, CORBA::Policy_ptr * policy) = 0;
+
+ virtual void insert_into_any (CORBA::Any * any, CORBA::ULong value) = 0;
+
+ virtual void insert_into_any (CORBA::Any * any, CORBA::Long value) = 0;
+
+ virtual void insert_into_any (CORBA::Any * any, CORBA::Short value) = 0;
+
+ virtual void insert_into_any (CORBA::Any * any, CORBA::UShort value) = 0;
+
+ virtual void insert_into_any (CORBA::Any * any, CORBA::Float value) = 0;
+
+ virtual void insert_into_any (CORBA::Any * any, CORBA::Double value) = 0;
+
+ virtual void insert_into_any (CORBA::Any * any, CORBA::LongLong value) = 0;
+
+ virtual void insert_into_any (CORBA::Any * any, CORBA::ULongLong value) = 0;
+
+ virtual void insert_into_any (CORBA::Any * any, CORBA::LongDouble value) = 0;
+
+ virtual void insert_into_any (CORBA::Any * any, ACE_OutputCDR::from_wchar value) = 0;
+
+ virtual void insert_into_any (CORBA::Any * any, ACE_OutputCDR::from_char value) = 0;
+
+ virtual void insert_into_any (CORBA::Any * any, ACE_OutputCDR::from_octet value) = 0;
+
+ virtual void insert_into_any (CORBA::Any * any, ACE_OutputCDR::from_boolean value) = 0;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_ANYTYPECODE_ADAPTER */
diff --git a/TAO/tao/Any_Insert_Policy_T.h b/TAO/tao/Any_Insert_Policy_T.h
new file mode 100644
index 00000000000..0745821d7cb
--- /dev/null
+++ b/TAO/tao/Any_Insert_Policy_T.h
@@ -0,0 +1,119 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Any_Insert_Policy_T.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_ANY_INSERT_POLICY_H
+#define TAO_ANY_INSERT_POLICY_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/UB_String_Argument_T.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Arg_Traits_T.h"
+#include "tao/Argument.h"
+#include "tao/AnyTypeCode_Adapter.h"
+
+#include "ace/Dynamic_Service.h"
+#include "ace/Log_Msg.h"
+#include "tao/debug.h"
+#include "tao/IFR_Client_Adapter.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ template <typename S>
+ class Any_Insert_Policy_Stream
+ {
+ public:
+
+ static inline void any_insert (CORBA::Any* p, S const & x)
+ {
+ (*p) <<= x;
+ }
+ };
+
+ template <typename S>
+ class Any_Insert_Policy_AnyTypeCode_Adapter
+ {
+ public:
+
+ static inline void any_insert (CORBA::Any* p, S const & x)
+ {
+ TAO_AnyTypeCode_Adapter *adapter =
+ ACE_Dynamic_Service<TAO_AnyTypeCode_Adapter>::instance (
+ "AnyTypeCode_Adapter"
+ );
+
+ if (adapter)
+ {
+ adapter->insert_into_any (p, x);
+ }
+ else
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) %p\n"),
+ ACE_TEXT ("ERROR: unable to find AnyTypeCode Adapter ")));
+ }
+ }
+ };
+
+ template <typename S>
+ class Any_Insert_Policy_IFR_Client_Adapter
+ {
+ public:
+
+ static inline void any_insert (CORBA::Any* p, S const & x)
+ {
+ TAO_IFR_Client_Adapter *adapter =
+ ACE_Dynamic_Service<TAO_IFR_Client_Adapter>::instance (
+ "Concrete_IFR_Client_Adapter"
+ );
+
+ adapter->interfacedef_any_insert (p, x);
+ }
+ };
+
+ template <typename S>
+ class Any_Insert_Policy_Noop
+ {
+ public:
+ static inline void any_insert (CORBA::Any* , S const &)
+ {
+ }
+ };
+
+ template <typename S>
+ class Any_Insert_Policy_CORBA_Object
+ {
+ public:
+
+ static inline void any_insert (CORBA::Any* , S const &)
+ {
+ if (TAO_debug_level > 2)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - Cannot insert a vanilla CORBA Object"
+ " into an Any for returning the return value.\n"));
+ }
+ }
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_ANY_INSERT_POLICY_H */
diff --git a/TAO/tao/Arg_Traits_T.h b/TAO/tao/Arg_Traits_T.h
new file mode 100644
index 00000000000..f71e79b2f27
--- /dev/null
+++ b/TAO/tao/Arg_Traits_T.h
@@ -0,0 +1,41 @@
+// This may look like C, but it's really -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Arg_Traits_T.h
+ *
+ * $Id$
+ *
+ * @authors Jeff Parsons and Carlos O'Ryan
+ */
+//=============================================================================
+
+#ifndef TAO_ARG_TRAITS_T_H
+#define TAO_ARG_TRAITS_T_H
+
+#include /**/ "ace/pre.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ /**
+ *
+ * @brief Base class for all stub arg traits specializations.
+ *
+ */
+ template<typename T>
+ class Arg_Traits
+ {
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_ARG_TRAITS_T_H */
diff --git a/TAO/tao/Argument.cpp b/TAO/tao/Argument.cpp
new file mode 100644
index 00000000000..d1819d1cc51
--- /dev/null
+++ b/TAO/tao/Argument.cpp
@@ -0,0 +1,57 @@
+
+// $Id$
+
+#include "tao/Argument.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO::Argument::~Argument (void)
+{
+}
+
+CORBA::Boolean
+TAO::Argument::marshal (TAO_OutputCDR &)
+{
+ return true;
+}
+
+CORBA::Boolean
+TAO::Argument::demarshal (TAO_InputCDR &)
+{
+ return true;
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+void
+TAO::Argument::interceptor_value (CORBA::Any *) const
+{
+}
+
+CORBA::ParameterMode
+TAO::InArgument::mode (void) const
+{
+ return CORBA::PARAM_IN;
+}
+
+CORBA::ParameterMode
+TAO::InoutArgument::mode (void) const
+{
+ return CORBA::PARAM_INOUT;
+}
+
+CORBA::ParameterMode
+TAO::OutArgument::mode (void) const
+{
+ return CORBA::PARAM_OUT;
+}
+
+CORBA::ParameterMode
+TAO::RetArgument::mode (void) const
+{
+ return CORBA::PARAM_OUT;
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Argument.h b/TAO/tao/Argument.h
new file mode 100644
index 00000000000..056ef2596b7
--- /dev/null
+++ b/TAO/tao/Argument.h
@@ -0,0 +1,141 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Argument.h
+ *
+ * $Id$
+ *
+ * @author Jeff Parsons
+ * @author Carlos O'Ryan
+ */
+//=============================================================================
+
+
+#ifndef TAO_ARGUMENT_H
+#define TAO_ARGUMENT_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Basic_Types.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/orbconf.h"
+#include "tao/TAO_Export.h"
+#include "tao/ParameterModeC.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace CORBA
+{
+ class Any;
+}
+
+class TAO_OutputCDR;
+class TAO_InputCDR;
+
+namespace TAO
+{
+ /**
+ * @class Argument
+ *
+ * @brief Base class for argument class templates.
+ *
+ * @c Argument subclasses override the virtual methods
+ * appropriately. For example, a stub "IN" argument class
+ * template would override the @c marshal() method, but wouldn't
+ * need to override the @c demarshal() method.
+ */
+ class TAO_Export Argument
+ {
+ public:
+
+ /// Destructor.
+ virtual ~Argument (void);
+
+ /// Marshal the argument into the given CDR output stream.
+ /**
+ * @note The default implementation simply returns @c true.
+ */
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+
+ /// Demarshal the argument from the given CDR input stream.
+ /**
+ * @note The default implementation simply returns @c true.
+ */
+ virtual CORBA::Boolean demarshal (TAO_InputCDR &);
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+ /**
+ * @name Portable Interceptor Related Methods
+ *
+ * These methods are only used when setting up
+ * @c PortableInterceptor::RequestInfo instances with the
+ * appropriate operation-specific parameter list and return
+ * value, if either or both exist.
+ */
+ //@{
+ /// Populate the given @a CORBA::Any result argument.
+ /**
+ * @note The default implementation is a no-op.
+ */
+ virtual void interceptor_value (CORBA::Any *) const;
+
+ /// Get the parameter mode of this argument
+ virtual CORBA::ParameterMode mode (void) const = 0;
+ //@}
+
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+
+ };
+
+#if TAO_HAS_INTERCEPTORS == 1
+ class TAO_Export InArgument : public Argument
+ {
+ public:
+ virtual CORBA::ParameterMode mode (void) const;
+ };
+#else
+ typedef Argument InArgument;
+#endif
+
+#if TAO_HAS_INTERCEPTORS == 1
+ class TAO_Export InoutArgument : public Argument
+ {
+ public:
+ virtual CORBA::ParameterMode mode (void) const;
+ };
+#else
+ typedef Argument InoutArgument;
+#endif
+
+#if TAO_HAS_INTERCEPTORS == 1
+ class TAO_Export OutArgument : public Argument
+ {
+ public:
+ virtual CORBA::ParameterMode mode (void) const;
+ };
+#else
+ typedef Argument OutArgument;
+#endif
+
+#if TAO_HAS_INTERCEPTORS == 1
+ class TAO_Export RetArgument : public Argument
+ {
+ public:
+ virtual CORBA::ParameterMode mode (void) const;
+ };
+#else
+ typedef Argument RetArgument;
+#endif
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_ARGUMENT_H */
diff --git a/TAO/tao/Array_Traits_T.h b/TAO/tao/Array_Traits_T.h
new file mode 100644
index 00000000000..3e3178af511
--- /dev/null
+++ b/TAO/tao/Array_Traits_T.h
@@ -0,0 +1,82 @@
+#ifndef guard_array_traits_hpp
+#define guard_array_traits_hpp
+/**
+ * @file
+ *
+ * @brief Implement the element manipulation traits for types with
+ * array-like semantics.
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan
+ */
+
+#include <algorithm>
+#include "tao/Array_VarOut_T.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+namespace details
+{
+
+template <typename T_forany>
+struct array_traits
+{
+ typedef T_forany forany_type;
+ typedef typename T_forany::_array_type value_type;
+ typedef typename T_forany::_array_type const const_value_type;
+ typedef typename T_forany::_slice_type slice_type;
+
+ inline static void copy (slice_type * _tao_to, const slice_type * _tao_from)
+ {
+ TAO::Array_Traits<forany_type>::copy (_tao_to, _tao_from);
+ }
+
+ inline static void free (slice_type * value)
+ {
+ TAO::Array_Traits<forany_type>::free (value);
+ }
+
+ inline static slice_type * alloc (void)
+ {
+ return TAO::Array_Traits<forany_type>::alloc ();
+ }
+
+ inline static slice_type * dup(
+ const slice_type * value)
+ {
+ return TAO::Array_Traits<forany_type>::dup (value);
+ }
+
+ inline static void zero_range(
+ value_type * begin, value_type * end)
+ {
+ std::for_each(
+ begin, end, &TAO::Array_Traits<forany_type>::zero);
+ }
+
+ inline static void initialize_range(
+ value_type * begin, value_type * end)
+ {
+ std::for_each(
+ begin, end, &TAO::Array_Traits<forany_type>::zero);
+ }
+
+ inline static void copy_range(
+ value_type * begin, value_type * end, value_type *dst)
+ {
+ for(value_type * i = begin; i != end; ++i, ++dst)
+ {
+ TAO::Array_Traits<forany_type>::copy(*dst, *i);
+ }
+ }
+};
+
+} // namespace details
+} // namespace CORBA
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif // guard_array_traits_hpp
diff --git a/TAO/tao/Array_VarOut_T.cpp b/TAO/tao/Array_VarOut_T.cpp
new file mode 100644
index 00000000000..23fcc598ff1
--- /dev/null
+++ b/TAO/tao/Array_VarOut_T.cpp
@@ -0,0 +1,95 @@
+// $Id$
+
+#ifndef TAO_ARRAY_VAROUT_T_CPP
+#define TAO_ARRAY_VAROUT_T_CPP
+
+#include "tao/Array_VarOut_T.h"
+
+#if !defined (__ACE_INLINE__)
+#include "tao/Array_VarOut_T.inl"
+#endif /* __ACE_INLINE__ */
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template<typename T, typename T_slice, typename TAG>
+TAO_FixedArray_Var_T<T,T_slice,TAG> &
+TAO_FixedArray_Var_T<T,T_slice,TAG>::operator= (T_slice * p)
+{
+ // Is what we own the same that is being assigned to us?
+ if (this->ptr_ != p)
+ {
+ // Delete our stuff and assume ownership of p.
+ TAO::Array_Traits<FORANY>::free (this->ptr_);
+ this->ptr_ = p;
+ }
+
+ return *this;
+}
+
+template<typename T, typename T_slice, typename TAG>
+TAO_FixedArray_Var_T<T,T_slice,TAG> &
+TAO_FixedArray_Var_T<T,T_slice,TAG>::operator= (
+ const TAO_FixedArray_Var_T<T,T_slice,TAG> & p
+ )
+{
+ if (this != &p)
+ {
+ TAO::Array_Traits<FORANY>::free (this->ptr_);
+
+ // Deep copy.
+ this->ptr_ = TAO::Array_Traits<FORANY>::dup (p.in ());
+ }
+
+ return *this;
+}
+
+// *************************************************************
+
+template<typename T, typename T_slice, typename TAG>
+TAO_VarArray_Var_T<T,T_slice,TAG> &
+TAO_VarArray_Var_T<T,T_slice,TAG>::operator= (T_slice * p)
+{
+ // Is what we own the same that is being assigned to us?
+ if (this->ptr_ != p)
+ {
+ // Delete our stuff and assume ownership of p.
+ TAO::Array_Traits<FORANY>::free (this->ptr_);
+ this->ptr_ = p;
+ }
+
+ return *this;
+}
+
+template<typename T, typename T_slice, typename TAG>
+TAO_VarArray_Var_T<T,T_slice,TAG> &
+TAO_VarArray_Var_T<T,T_slice,TAG>::operator= (
+ const TAO_VarArray_Var_T<T,T_slice,TAG> & p
+ )
+{
+ if (this != &p)
+ {
+ TAO::Array_Traits<FORANY>::free (this->ptr_);
+
+ // Deep copy.
+ this->ptr_ = TAO::Array_Traits<FORANY>::dup (p.in ());
+ }
+
+ return *this;
+}
+
+// *************************************************************
+
+template<typename T, typename T_slice, typename TAG>
+void
+TAO_Array_Forany_T<T,T_slice,TAG>::_tao_any_destructor (
+ void * _tao_void_pointer
+ )
+{
+ T_slice * tmp = static_cast<T_slice *> (_tao_void_pointer);
+ TAO::Array_Traits<FORANY>::free (tmp);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_ARRAY_VAROUT_T_CPP */
diff --git a/TAO/tao/Array_VarOut_T.h b/TAO/tao/Array_VarOut_T.h
new file mode 100644
index 00000000000..b70fd19c6b6
--- /dev/null
+++ b/TAO/tao/Array_VarOut_T.h
@@ -0,0 +1,246 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Array_VarOut_T.h
+ *
+ * $Id$
+ *
+ * @author Jeff Parsons
+ * @author Johnny Willemsen
+ */
+//=============================================================================
+
+
+#ifndef TAO_ARRAY_VAROUT_T_H
+#define TAO_ARRAY_VAROUT_T_H
+
+#include /**/ "ace/pre.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ /**
+ * @struct Array_Traits
+ *
+ * @brief Specialized for each array in generated code.
+ *
+ */
+ template<typename T_forany>
+ struct Array_Traits;
+}
+
+/**
+ * @class TAO_Array_Forany_T
+ *
+ * @brief Parametrized implementation of _forany class for arrays.
+ *
+ */
+template<typename T, typename T_slice, typename TAG>
+class TAO_Array_Forany_T
+{
+public:
+ typedef T _array_type;
+ typedef T_slice _slice_type;
+
+ TAO_Array_Forany_T (void);
+ TAO_Array_Forany_T (_slice_type *, CORBA::Boolean nocopy = false);
+ TAO_Array_Forany_T (const TAO_Array_Forany_T<T,T_slice,TAG> &);
+ ~TAO_Array_Forany_T (void);
+
+ static void _tao_any_destructor (void *);
+
+ TAO_Array_Forany_T & operator= (_slice_type *);
+ TAO_Array_Forany_T & operator= (const TAO_Array_Forany_T<T,T_slice,TAG> &);
+
+ _slice_type & operator[] (CORBA::ULong index);
+ const _slice_type & operator[] (CORBA::ULong index) const;
+
+ operator _slice_type * const & () const;
+ operator _slice_type *& ();
+
+ typedef const _slice_type * _in_type;
+ typedef _slice_type * _inout_type;
+ typedef _slice_type * & _out_type;
+ typedef _slice_type * _retn_type;
+ typedef _slice_type *& _retn_arg_type;
+
+ // in, inout, out, _retn
+ _in_type in (void) const;
+ _inout_type inout (void);
+ _out_type out (void);
+ _retn_type _retn (void);
+ _slice_type * ptr (void) const;
+ CORBA::Boolean nocopy (void) const;
+
+ static _slice_type * tao_alloc (void);
+private:
+ typedef TAO_Array_Forany_T<T,T_slice,TAG> FORANY;
+ _slice_type * ptr_;
+ CORBA::Boolean nocopy_;
+};
+
+/**
+ * @class TAO_Array_Var_Base_T
+ *
+ * @brief Parametrized implementation of _var base class for arrays.
+ *
+ */
+template<typename T, typename T_slice, typename TAG>
+class TAO_Array_Var_Base_T
+{
+public:
+ typedef T_slice _slice_type;
+ typedef T_slice const & _const_subscript_type;
+ typedef T_slice & _subscript_type;
+
+ TAO_Array_Var_Base_T (void);
+ TAO_Array_Var_Base_T (_slice_type *);
+ TAO_Array_Var_Base_T (const TAO_Array_Var_Base_T<T,T_slice,TAG> &);
+ ~TAO_Array_Var_Base_T (void);
+
+ _subscript_type operator[] (CORBA::ULong index);
+ _const_subscript_type operator[] (CORBA::ULong index) const;
+ operator _slice_type * const & () const;
+
+ typedef const _slice_type * _in_type;
+ typedef _slice_type * _inout_type;
+ typedef _slice_type * _retn_type;
+ typedef _slice_type *& _retn_arg_type;
+
+ // in, inout, out, _retn
+ _in_type in (void) const;
+ _inout_type inout (void);
+ _retn_type _retn (void);
+ _retn_arg_type _retn_arg (void);
+
+ // TAO extension.
+ _retn_type ptr (void) const;
+protected:
+ typedef TAO_Array_Forany_T<T,T_slice,TAG> FORANY;
+ _slice_type * ptr_;
+};
+
+/**
+ * @class TAO_FixedArray_Var_T
+ *
+ * @brief Parametrized implementation of _var class for arrays with
+ * elements of fixed size.
+ *
+ */
+template<typename T, typename T_slice, typename TAG>
+class TAO_FixedArray_Var_T : public TAO_Array_Var_Base_T<T,T_slice,TAG>
+{
+public:
+ typedef T_slice _slice_type;
+ typedef T_slice *_out_type;
+
+ TAO_FixedArray_Var_T (void);
+ TAO_FixedArray_Var_T (_slice_type *);
+ TAO_FixedArray_Var_T (const TAO_FixedArray_Var_T<T,T_slice,TAG> &);
+
+ TAO_FixedArray_Var_T<T,T_slice,TAG> &operator= (_slice_type *);
+ TAO_FixedArray_Var_T<T,T_slice,TAG> &operator= (
+ const TAO_FixedArray_Var_T<T,T_slice,TAG> &
+ );
+
+ _out_type out (void);
+
+private:
+ // Some compilers don't look into the base class when parsing
+ // templates unless they are force to.
+ typedef typename TAO_Array_Var_Base_T<T,T_slice,TAG>::FORANY FORANY;
+};
+
+/**
+ * @class TAO_VarArray_Var_T
+ *
+ * @brief Parametrized implementation of _var class for arrays with
+ * elements of variable size.
+ *
+ */
+template<typename T, typename T_slice, typename TAG>
+class TAO_VarArray_Var_T : public TAO_Array_Var_Base_T<T,T_slice,TAG>
+{
+public:
+ typedef T_slice _slice_type;
+ typedef T_slice *&_out_type;
+
+ TAO_VarArray_Var_T (void);
+ TAO_VarArray_Var_T (_slice_type *);
+ TAO_VarArray_Var_T (const TAO_VarArray_Var_T<T,T_slice,TAG> &);
+
+ TAO_VarArray_Var_T<T,T_slice,TAG> &operator= (_slice_type *);
+ TAO_VarArray_Var_T<T,T_slice,TAG> &operator= (
+ const TAO_VarArray_Var_T<T,T_slice,TAG> &
+ );
+
+ _out_type out (void);
+
+ operator _slice_type *& ();
+
+private:
+ // Some compilers don't look into the base class when parsing
+ // templates unless they are force to.
+ typedef typename TAO_Array_Var_Base_T<T,T_slice,TAG>::FORANY FORANY;
+};
+
+/**
+ * @class TAO_Array_Out_T
+ *
+ * @brief Parametrized implementation of _out class for arrays.
+ *
+ */
+template<typename T, typename T_var, typename T_slice, typename TAG>
+class TAO_Array_Out_T
+{
+public:
+ typedef T_slice _slice_type;
+ typedef T_var _value_type;
+ typedef T_var _var_type;
+
+ TAO_Array_Out_T (_slice_type *&);
+ TAO_Array_Out_T (_value_type &);
+ TAO_Array_Out_T (const TAO_Array_Out_T<T,T_var,T_slice,TAG> &);
+
+ TAO_Array_Out_T<T,T_var,T_slice,TAG> &operator= (
+ const TAO_Array_Out_T<T,T_var,T_slice,TAG> &
+ );
+ TAO_Array_Out_T<T,T_var,T_slice,TAG> &operator= (_slice_type *);
+
+ operator _slice_type *& ();
+ _slice_type *& ptr (void);
+
+ _slice_type & operator[] (CORBA::ULong index);
+ const _slice_type & operator[] (CORBA::ULong index) const;
+private:
+ typedef TAO_Array_Forany_T<T,T_slice,TAG> FORANY;
+ typedef TAO_Array_Out_T<T,T_var,T_slice,TAG> THIS_OUT_TYPE;
+ _slice_type *& ptr_;
+
+ // Assignment from T_var not allowed.
+ void operator= (const _value_type &);
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+#include "tao/Array_VarOut_T.inl"
+#endif /* __ACE_INLINE__ */
+
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+#include "tao/Array_VarOut_T.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
+#pragma implementation ("Array_VarOut_T.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_ARRAY_VAROUT_T_H */
diff --git a/TAO/tao/Array_VarOut_T.inl b/TAO/tao/Array_VarOut_T.inl
new file mode 100644
index 00000000000..85b5aa7532d
--- /dev/null
+++ b/TAO/tao/Array_VarOut_T.inl
@@ -0,0 +1,385 @@
+// -*- C++ -*-
+//
+//$Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template<typename T, typename T_slice, typename TAG>
+ACE_INLINE
+TAO_Array_Var_Base_T<T,T_slice,TAG>::TAO_Array_Var_Base_T (void)
+ : ptr_ (0)
+{}
+
+template<typename T, typename T_slice, typename TAG>
+ACE_INLINE
+TAO_Array_Var_Base_T<T,T_slice,TAG>::TAO_Array_Var_Base_T (T_slice * p)
+ : ptr_ (p)
+{}
+
+template<typename T, typename T_slice, typename TAG>
+ACE_INLINE
+TAO_Array_Var_Base_T<T,T_slice,TAG>::TAO_Array_Var_Base_T (
+ const TAO_Array_Var_Base_T & p
+ )
+{
+ this->ptr_ = TAO::Array_Traits<FORANY>::dup (p.in ());
+}
+
+template<typename T, typename T_slice, typename TAG>
+ACE_INLINE
+TAO_Array_Var_Base_T<T,T_slice,TAG>::~TAO_Array_Var_Base_T (void)
+{
+ TAO::Array_Traits<FORANY>::free (this->ptr_);
+}
+
+template<typename T, typename T_slice, typename TAG>
+ACE_INLINE
+TAO_Array_Var_Base_T<T,T_slice,TAG>::operator T_slice * const & () const
+{
+ return this->ptr_;
+}
+
+template<typename T, typename T_slice, typename TAG>
+ACE_INLINE
+T_slice const &
+TAO_Array_Var_Base_T<T,T_slice,TAG>::operator[] (CORBA::ULong index) const
+{
+ return this->ptr_[index];
+}
+
+template<typename T, typename T_slice, typename TAG>
+ACE_INLINE
+T_slice &
+TAO_Array_Var_Base_T<T,T_slice,TAG>::operator[] (CORBA::ULong index)
+{
+ return this->ptr_[index];
+}
+
+template<typename T, typename T_slice, typename TAG>
+ACE_INLINE
+const T_slice *
+TAO_Array_Var_Base_T<T,T_slice,TAG>::in (void) const
+{
+ // @todo Replace with C++ cast after vc6 has been dropped,
+ // vc6 can't handle this as const cast
+ return (const T_slice *) this->ptr_;
+}
+
+template<typename T, typename T_slice, typename TAG>
+ACE_INLINE
+T_slice *
+TAO_Array_Var_Base_T<T,T_slice,TAG>::inout (void)
+{
+ return this->ptr_;
+}
+
+template<typename T, typename T_slice, typename TAG>
+ACE_INLINE
+T_slice *&
+TAO_Array_Var_Base_T<T,T_slice,TAG>::_retn_arg (void)
+{
+ TAO::Array_Traits<FORANY>::free (this->ptr_);
+ this->ptr_ = 0;
+ return this->ptr_;
+}
+
+template<typename T, typename T_slice, typename TAG>
+ACE_INLINE
+T_slice *
+TAO_Array_Var_Base_T<T,T_slice,TAG>::_retn (void)
+{
+ T_slice * tmp = this->ptr_;
+ this->ptr_ = 0;
+ return tmp;
+}
+
+template<typename T, typename T_slice, typename TAG>
+ACE_INLINE
+T_slice *
+TAO_Array_Var_Base_T<T,T_slice,TAG>::ptr (void) const
+{
+ return this->ptr_;
+}
+
+// *************************************************************
+
+template<typename T, typename T_slice, typename TAG>
+ACE_INLINE
+TAO_FixedArray_Var_T<T,T_slice,TAG>::TAO_FixedArray_Var_T (void)
+{}
+
+template<typename T, typename T_slice, typename TAG>
+ACE_INLINE
+TAO_FixedArray_Var_T<T,T_slice,TAG>::TAO_FixedArray_Var_T (T_slice * p)
+ : TAO_Array_Var_Base_T<T,T_slice,TAG> (p)
+{}
+
+template<typename T, typename T_slice, typename TAG>
+ACE_INLINE
+TAO_FixedArray_Var_T<T,T_slice,TAG>::TAO_FixedArray_Var_T (
+ const TAO_FixedArray_Var_T & p
+ )
+ : TAO_Array_Var_Base_T<T,T_slice,TAG> (p)
+{}
+
+
+template<typename T, typename T_slice, typename TAG>
+ACE_INLINE
+T_slice *
+TAO_FixedArray_Var_T<T,T_slice,TAG>::out (void)
+{
+ return this->ptr_;
+}
+
+// *************************************************************
+
+template<typename T, typename T_slice, typename TAG>
+ACE_INLINE
+TAO_VarArray_Var_T<T,T_slice,TAG>::TAO_VarArray_Var_T (void)
+{}
+
+template<typename T, typename T_slice, typename TAG>
+ACE_INLINE
+TAO_VarArray_Var_T<T,T_slice,TAG>::TAO_VarArray_Var_T (T_slice * p)
+ : TAO_Array_Var_Base_T<T,T_slice,TAG> (p)
+{}
+
+template<typename T, typename T_slice, typename TAG>
+ACE_INLINE
+TAO_VarArray_Var_T<T,T_slice,TAG>::TAO_VarArray_Var_T (
+ const TAO_VarArray_Var_T & p
+ )
+ : TAO_Array_Var_Base_T<T,T_slice,TAG> (p)
+{}
+
+template<typename T, typename T_slice, typename TAG>
+ACE_INLINE
+TAO_VarArray_Var_T<T,T_slice,TAG>::operator T_slice *& ()
+{
+ return this->ptr_;
+}
+
+template<typename T, typename T_slice, typename TAG>
+ACE_INLINE
+T_slice *&
+TAO_VarArray_Var_T<T,T_slice,TAG>::out (void)
+{
+ TAO::Array_Traits<FORANY>::free (this->ptr_);
+ this->ptr_ = 0;
+ return this->ptr_;
+}
+
+// *************************************************************
+
+template<typename T, typename T_var, typename T_slice, typename TAG>
+ACE_INLINE
+TAO_Array_Out_T<T,T_var,T_slice,TAG>::TAO_Array_Out_T (T_slice *& p)
+ : ptr_ (p)
+{
+ this->ptr_ = 0;
+}
+
+template<typename T, typename T_var, typename T_slice, typename TAG>
+ACE_INLINE
+TAO_Array_Out_T<T,T_var,T_slice,TAG>::TAO_Array_Out_T (T_var & p)
+ : ptr_ (p.out ())
+{
+ TAO::Array_Traits<FORANY>::free (this->ptr_);
+ this->ptr_ = 0;
+}
+
+template<typename T, typename T_var, typename T_slice, typename TAG>
+ACE_INLINE
+TAO_Array_Out_T<T,T_var,T_slice,TAG>::TAO_Array_Out_T (
+ const TAO_Array_Out_T<T,T_var,T_slice,TAG> & p
+ )
+ : ptr_ (const_cast<THIS_OUT_TYPE &> (p).ptr_)
+{}
+
+template<typename T, typename T_var, typename T_slice, typename TAG>
+ACE_INLINE
+TAO_Array_Out_T<T,T_var,T_slice,TAG> &
+TAO_Array_Out_T<T,T_var,T_slice,TAG>::operator= (
+ const TAO_Array_Out_T<T,T_var,T_slice,TAG> & p
+ )
+{
+ this->ptr_ = const_cast<THIS_OUT_TYPE &> (p).ptr_;
+ return *this;
+}
+
+template<typename T, typename T_var, typename T_slice, typename TAG>
+ACE_INLINE
+TAO_Array_Out_T<T,T_var,T_slice,TAG> &
+TAO_Array_Out_T<T,T_var,T_slice,TAG>::operator= (T_slice *p)
+{
+ this->ptr_ = p;
+ return *this;
+}
+
+template<typename T, typename T_var, typename T_slice, typename TAG>
+ACE_INLINE
+TAO_Array_Out_T<T,T_var,T_slice,TAG>::operator T_slice *& ()
+{
+ return this->ptr_;
+}
+
+template<typename T, typename T_var, typename T_slice, typename TAG>
+ACE_INLINE
+T_slice &
+TAO_Array_Out_T<T,T_var,T_slice,TAG>::operator[] (CORBA::ULong index)
+{
+ return this->ptr_[index];
+}
+
+template<typename T, typename T_var, typename T_slice, typename TAG>
+ACE_INLINE
+T_slice *&
+TAO_Array_Out_T<T,T_var,T_slice,TAG>::ptr (void)
+{
+ return this->ptr_;
+}
+
+// *************************************************************
+
+template<typename T, typename T_slice, typename TAG>
+ACE_INLINE
+TAO_Array_Forany_T<T,T_slice,TAG>::TAO_Array_Forany_T (void)
+ : ptr_ (0),
+ nocopy_ (false)
+{}
+
+template<typename T, typename T_slice, typename TAG>
+ACE_INLINE
+TAO_Array_Forany_T<T,T_slice,TAG>::TAO_Array_Forany_T (
+ T_slice * p,
+ CORBA::Boolean nocopy
+ )
+ : ptr_ (p),
+ nocopy_ (nocopy)
+{}
+
+template<typename T, typename T_slice, typename TAG>
+ACE_INLINE
+TAO_Array_Forany_T<T,T_slice,TAG>::TAO_Array_Forany_T (
+ const TAO_Array_Forany_T<T,T_slice,TAG> & p
+ )
+ : ptr_ (p.ptr_),
+ nocopy_ (p.nocopy_)
+{
+}
+
+template<typename T, typename T_slice, typename TAG>
+ACE_INLINE
+TAO_Array_Forany_T<T,T_slice,TAG>::~TAO_Array_Forany_T (void)
+{
+}
+
+template<typename T, typename T_slice, typename TAG>
+ACE_INLINE
+TAO_Array_Forany_T<T,T_slice,TAG> &
+TAO_Array_Forany_T<T,T_slice,TAG>::operator= (T_slice * p)
+{
+ this->ptr_ = p;
+ return *this;
+}
+
+template<typename T, typename T_slice, typename TAG>
+ACE_INLINE
+TAO_Array_Forany_T<T,T_slice,TAG> &
+TAO_Array_Forany_T<T,T_slice,TAG>::operator= (
+ const TAO_Array_Forany_T<T,T_slice,TAG> & p
+ )
+{
+ this->ptr_ = p.ptr_;
+ this->nocopy_ = p.nocopy_;
+ return *this;
+}
+
+template<typename T, typename T_slice, typename TAG>
+ACE_INLINE
+TAO_Array_Forany_T<T,T_slice,TAG>::operator T_slice * const & () const
+{
+ return this->ptr_;
+}
+
+template<typename T, typename T_slice, typename TAG>
+ACE_INLINE
+TAO_Array_Forany_T<T,T_slice,TAG>::operator T_slice *& ()
+{
+ return this->ptr_;
+}
+
+template<typename T, typename T_slice, typename TAG>
+ACE_INLINE
+const T_slice &
+TAO_Array_Forany_T<T,T_slice,TAG>::operator[] (CORBA::ULong index) const
+{
+ const T_slice & tmp = this->ptr_[index];
+ return tmp;
+}
+
+template<typename T, typename T_slice, typename TAG>
+ACE_INLINE
+T_slice &
+TAO_Array_Forany_T<T,T_slice,TAG>::operator[] (CORBA::ULong index)
+{
+ return this->ptr_[index];
+}
+
+template<typename T, typename T_slice, typename TAG>
+ACE_INLINE
+const T_slice *
+TAO_Array_Forany_T<T,T_slice,TAG>::in (void) const
+{
+ return this->ptr_;
+}
+
+template<typename T, typename T_slice, typename TAG>
+ACE_INLINE
+T_slice *
+TAO_Array_Forany_T<T,T_slice,TAG>::inout (void)
+{
+ return this->ptr_;
+}
+
+template<typename T, typename T_slice, typename TAG>
+ACE_INLINE
+T_slice *&
+TAO_Array_Forany_T<T,T_slice,TAG>::out (void)
+{
+ return this->ptr_;
+}
+
+template<typename T, typename T_slice, typename TAG>
+ACE_INLINE
+T_slice *
+TAO_Array_Forany_T<T,T_slice,TAG>::_retn (void)
+{
+ return this->ptr_;
+}
+
+template<typename T, typename T_slice, typename TAG>
+ACE_INLINE
+CORBA::Boolean
+TAO_Array_Forany_T<T,T_slice,TAG>::nocopy (void) const
+{
+ return this->nocopy_;
+}
+
+template<typename T, typename T_slice, typename TAG>
+ACE_INLINE
+T_slice *
+TAO_Array_Forany_T<T,T_slice,TAG>::ptr (void) const
+{
+ return this->ptr_;
+}
+
+template<typename T, typename T_slice, typename TAG>
+ACE_INLINE
+T_slice *
+TAO_Array_Forany_T<T,T_slice,TAG>::tao_alloc (void)
+{
+ return TAO::Array_Traits<FORANY>::alloc ();
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Asynch_Queued_Message.cpp b/TAO/tao/Asynch_Queued_Message.cpp
new file mode 100644
index 00000000000..7c6ec5020e8
--- /dev/null
+++ b/TAO/tao/Asynch_Queued_Message.cpp
@@ -0,0 +1,186 @@
+#include "tao/Asynch_Queued_Message.h"
+#include "tao/debug.h"
+#include "tao/ORB_Core.h"
+
+#include "ace/OS_Memory.h"
+#include "ace/OS_NS_string.h"
+#include "ace/os_include/sys/os_uio.h"
+#include "ace/Log_Msg.h"
+#include "ace/Message_Block.h"
+#include "ace/Malloc_Base.h"
+
+
+ACE_RCSID (tao,
+ Asynch_Queued_Message,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Asynch_Queued_Message::TAO_Asynch_Queued_Message (
+ const ACE_Message_Block *contents,
+ TAO_ORB_Core *oc,
+ ACE_Allocator *alloc,
+ bool is_heap_allocated)
+ : TAO_Queued_Message (oc, alloc, is_heap_allocated)
+ , size_ (contents->total_length ())
+ , offset_ (0)
+{
+ // @@ Use a pool for these guys!!
+ ACE_NEW (this->buffer_, char[this->size_]);
+
+ size_t copy_offset = 0;
+ for (const ACE_Message_Block *i = contents;
+ i != 0;
+ i = i->cont ())
+ {
+ ACE_OS::memcpy (this->buffer_ + copy_offset,
+ i->rd_ptr (),
+ i->length ());
+ copy_offset += i->length ();
+ }
+}
+
+TAO_Asynch_Queued_Message::TAO_Asynch_Queued_Message (char *buf,
+ TAO_ORB_Core *oc,
+ size_t size,
+ ACE_Allocator *alloc)
+ : TAO_Queued_Message (oc, alloc)
+ , size_ (size)
+ , offset_ (0)
+ , buffer_ (buf)
+{
+}
+
+TAO_Asynch_Queued_Message::~TAO_Asynch_Queued_Message (void)
+{
+ // @@ Use a pool for these guys!
+ delete [] this->buffer_;
+}
+
+size_t
+TAO_Asynch_Queued_Message::message_length (void) const
+{
+ return this->size_ - this->offset_;
+}
+
+int
+TAO_Asynch_Queued_Message::all_data_sent (void) const
+{
+ return this->size_ == this->offset_;
+}
+
+void
+TAO_Asynch_Queued_Message::fill_iov (int iovcnt_max,
+ int &iovcnt,
+ iovec iov[]) const
+{
+ ACE_ASSERT (iovcnt_max > iovcnt);
+ ACE_UNUSED_ARG (iovcnt_max); // not used if ACE_ASSERT() is empty
+
+ iov[iovcnt].iov_base = this->buffer_ + this->offset_;
+ iov[iovcnt].iov_len = static_cast<u_long> (this->size_ - this->offset_);
+ ++iovcnt;
+}
+
+void
+TAO_Asynch_Queued_Message::bytes_transferred (size_t &byte_count)
+{
+ this->state_changed_i (TAO_LF_Event::LFS_ACTIVE);
+
+ size_t const remaining_bytes = this->size_ - this->offset_;
+ if (byte_count > remaining_bytes)
+ {
+ this->offset_ = this->size_;
+ byte_count -= remaining_bytes;
+ return;
+ }
+ this->offset_ += byte_count;
+ byte_count = 0;
+
+ if (this->all_data_sent ())
+ this->state_changed (TAO_LF_Event::LFS_SUCCESS,
+ this->orb_core_->leader_follower ());
+}
+
+
+TAO_Queued_Message *
+TAO_Asynch_Queued_Message::clone (ACE_Allocator *alloc)
+{
+ char *buf = 0;
+
+ // @@todo: Need to use a memory pool. But certain things need to
+ // change a bit in this class for that. Till then.
+
+ // Just allocate and copy data that needs to be sent, no point
+ // copying the whole buffer.
+ size_t const sz = this->size_ - this->offset_;
+
+ ACE_NEW_RETURN (buf,
+ char[sz],
+ 0);
+
+ ACE_OS::memcpy (buf,
+ this->buffer_ + this->offset_,
+ sz);
+
+ TAO_Asynch_Queued_Message *qm = 0;
+
+ if (alloc)
+ {
+ ACE_NEW_MALLOC_RETURN (qm,
+ static_cast<TAO_Asynch_Queued_Message *> (
+ alloc->malloc (sizeof (TAO_Asynch_Queued_Message))),
+ TAO_Asynch_Queued_Message (buf,
+ this->orb_core_,
+ sz,
+ alloc),
+ 0);
+ }
+ else
+ {
+ // No allocator, so use the common heap!
+ if (TAO_debug_level == 4)
+ {
+ // This debug is for testing purposes!
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - Asynch_Queued_Message::clone\n"
+ "Using global pool for allocation \n"));
+ }
+
+ ACE_NEW_RETURN (qm,
+ TAO_Asynch_Queued_Message (buf,
+ this->orb_core_,
+ sz),
+ 0);
+ }
+
+ // Set the flag to indicate that <qm> is created on the heap.
+ if (qm)
+ qm->is_heap_created_ = true;
+
+ return qm;
+}
+
+void
+TAO_Asynch_Queued_Message::destroy (void)
+{
+ if (this->is_heap_created_)
+ {
+ // If we have an allocator release the memory to the allocator
+ // pool.
+ if (this->allocator_)
+ {
+ ACE_DES_FREE (this,
+ this->allocator_->free,
+ TAO_Asynch_Queued_Message);
+
+ }
+ else // global release..
+ {
+ delete this;
+ }
+ }
+
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Asynch_Queued_Message.h b/TAO/tao/Asynch_Queued_Message.h
new file mode 100644
index 00000000000..045f3dcd4fd
--- /dev/null
+++ b/TAO/tao/Asynch_Queued_Message.h
@@ -0,0 +1,105 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Asynch_Queued_Message.h
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan <coryan@uci.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_ASYNCH_QUEUED_MESSAGE_H
+#define TAO_ASYNCH_QUEUED_MESSAGE_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Queued_Message.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_Asynch_Queued_Message
+ *
+ * @brief Specialize TAO_Queued_Message for asynch requests,
+ * i.e. oneways sent with SYNC_NONE policy.
+ *
+ */
+class TAO_Export TAO_Asynch_Queued_Message : public TAO_Queued_Message
+{
+public:
+ /// Constructor
+ /**
+ * @param contents The message block chain that must be sent.
+ *
+ * @param alloc Allocator used for creating @c this object.
+ *
+ * @todo I'm almost sure this class will require a callback
+ * interface for AMIs sent with SYNC_NONE policy. Those guys
+ * need to hear when the connection timeouts or closes, but
+ * cannot block waiting for the message to be delivered.
+ */
+ TAO_Asynch_Queued_Message (const ACE_Message_Block *contents,
+ TAO_ORB_Core *oc,
+ ACE_Allocator *alloc = 0,
+ bool is_heap_allocated = false);
+
+
+ /// Destructor
+ virtual ~TAO_Asynch_Queued_Message (void);
+
+ /**
+ * @name Implement the Template Methods from TAO_Queued_Message
+ */
+ //@{
+ virtual size_t message_length (void) const;
+ virtual int all_data_sent (void) const;
+ virtual void fill_iov (int iovcnt_max, int &iovcnt, iovec iov[]) const;
+ virtual void bytes_transferred (size_t &byte_count);
+ /// @note No reason to believe why this would be called. But have
+ /// it here for the sake of uniformity.
+ virtual TAO_Queued_Message *clone (ACE_Allocator *alloc);
+ virtual void destroy (void);
+ //@}
+
+protected:
+ /// Constructor
+ /**
+ * @param buf The buffer that needs to be sent on the wire. The
+ * buffer will be owned by this class. The buffer will be
+ * deleted when the destructor is called and hence the
+ * buffer should always come off the heap!
+ *
+ * @param size The size of the buffer <buf> that is being handed
+ * over.
+ *
+ * @param alloc Allocator used for creating <this> object.
+ */
+ TAO_Asynch_Queued_Message (char *buf,
+ TAO_ORB_Core *oc,
+ size_t size,
+ ACE_Allocator *alloc = 0);
+private:
+ /// The number of bytes in the buffer
+ const size_t size_;
+
+ /// The offset in the buffer
+ /**
+ * Data up to @c offset has been sent already, only the
+ * [offset_,size_) range remains to be sent.
+ */
+ size_t offset_;
+
+ /// The buffer containing the complete message.
+ char *buffer_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_ASYNCH_QUEUED_MESSAGE_H */
diff --git a/TAO/tao/Asynch_Reply_Dispatcher_Base.cpp b/TAO/tao/Asynch_Reply_Dispatcher_Base.cpp
new file mode 100644
index 00000000000..edda3e1c449
--- /dev/null
+++ b/TAO/tao/Asynch_Reply_Dispatcher_Base.cpp
@@ -0,0 +1,149 @@
+// $Id$
+
+#include "tao/Asynch_Reply_Dispatcher_Base.h"
+#include "tao/Pluggable_Messaging_Utils.h"
+#include "tao/ORB_Core.h"
+#include "tao/debug.h"
+#include "tao/Transport.h"
+
+#if !defined (__ACE_INLINE__)
+#include "tao/Asynch_Reply_Dispatcher_Base.i"
+#endif /* __ACE_INLINE__ */
+
+ACE_RCSID (tao,
+ Asynch_Reply_Dispatcher_Base,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Constructor.
+TAO_Asynch_Reply_Dispatcher_Base::TAO_Asynch_Reply_Dispatcher_Base (
+ TAO_ORB_Core *orb_core,
+ ACE_Allocator *allocator
+ )
+ : db_ (sizeof buf_,
+ ACE_Message_Block::MB_DATA,
+ this->buf_,
+ orb_core->input_cdr_buffer_allocator (),
+ orb_core->locking_strategy (),
+ ACE_Message_Block::DONT_DELETE,
+ orb_core->input_cdr_dblock_allocator ()),
+ reply_cdr_ (&db_,
+ ACE_Message_Block::MB_DATA,
+ TAO_ENCAP_BYTE_ORDER,
+ TAO_DEF_GIOP_MAJOR,
+ TAO_DEF_GIOP_MINOR,
+ orb_core)
+ , transport_ (0)
+ , lock_ (0)
+ , refcount_ (1)
+ , is_reply_dispatched_ (false)
+ , allocator_ (allocator)
+{
+ // @@ NOTE: Need a seperate option for this..
+ this->lock_ =
+ orb_core->resource_factory ()->create_cached_connection_lock ();
+}
+
+// Destructor.
+TAO_Asynch_Reply_Dispatcher_Base::~TAO_Asynch_Reply_Dispatcher_Base (void)
+{
+ // Release the transport that we own
+ if (this->transport_ != 0)
+ this->transport_->remove_reference ();
+
+ if (this->lock_)
+ delete this->lock_;
+}
+
+void
+TAO_Asynch_Reply_Dispatcher_Base::transport (TAO_Transport *t)
+{
+ if (this->transport_ != 0)
+ this->transport_->remove_reference ();
+
+ this->transport_ = t;
+
+ this->transport_->add_reference ();
+}
+
+// Must override pure virtual method in TAO_Reply_Dispatcher.
+int
+TAO_Asynch_Reply_Dispatcher_Base::dispatch_reply (
+ TAO_Pluggable_Reply_Params & /*params*/
+ )
+{
+ return 0;
+}
+
+void
+TAO_Asynch_Reply_Dispatcher_Base::connection_closed (void)
+{
+}
+
+void
+TAO_Asynch_Reply_Dispatcher_Base::reply_timed_out (void)
+{
+}
+
+void
+TAO_Asynch_Reply_Dispatcher_Base::incr_refcount (void)
+{
+ ACE_GUARD (ACE_Lock,
+ mutex,
+ *this->lock_);
+ ++this->refcount_;
+}
+
+void
+TAO_Asynch_Reply_Dispatcher_Base::decr_refcount (void)
+{
+ {
+ ACE_GUARD (ACE_Lock,
+ mutex,
+ *this->lock_);
+ --this->refcount_;
+
+ if (this->refcount_ > 0)
+ return;
+ }
+
+ if (this->allocator_)
+ {
+ ACE_DES_FREE (this,
+ this->allocator_->free,
+ TAO_Asynch_Reply_Dispatcher_Base);
+ }
+ else
+ {
+ delete this;
+ }
+
+ return;
+}
+
+bool
+TAO_Asynch_Reply_Dispatcher_Base::try_dispatch_reply (void)
+{
+ if (this->is_reply_dispatched_)
+ {
+ return false;
+ }
+ else
+ {
+ ACE_GUARD_RETURN (ACE_Lock,
+ mutex,
+ *this->lock_,
+ false);
+
+ if (!this->is_reply_dispatched_)
+ {
+ this->is_reply_dispatched_ = true;
+ return true;
+ }
+ }
+
+ return false;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Asynch_Reply_Dispatcher_Base.h b/TAO/tao/Asynch_Reply_Dispatcher_Base.h
new file mode 100644
index 00000000000..d2d81cbb221
--- /dev/null
+++ b/TAO/tao/Asynch_Reply_Dispatcher_Base.h
@@ -0,0 +1,171 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Asynch_Reply_Dispatcher_Base.h
+ *
+ * $Id$
+ *
+ * @author Alexander Babu Arulanthu <alex@cs.wustl.edu>
+ * @author Jeff Parsons <parsons@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_ASYNCH_REPLY_DISPATCHER_BASE_H
+#define TAO_ASYNCH_REPLY_DISPATCHER_BASE_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Reply_Dispatcher.h"
+#include "tao/CDR.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/IOP_IORC.h"
+
+ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+class ACE_Time_Value;
+class ACE_Lock;
+class ACE_Allocator;
+ACE_END_VERSIONED_NAMESPACE_DECL
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Pluggable_Reply_Params;
+class TAO_ORB_Core;
+class TAO_Transport;
+/**
+ * @class TAO_Asynch_Reply_Dispatcher_Base
+ *
+ * @brief Base class for TAO_Asynch_Reply_Dispatcher and
+ * TAO_DII_Deferred_Reply_Dispatcher
+ */
+class TAO_Export TAO_Asynch_Reply_Dispatcher_Base
+ : public TAO_Reply_Dispatcher
+{
+public:
+ /// Default constructor.
+ TAO_Asynch_Reply_Dispatcher_Base (TAO_ORB_Core *orb_core,
+ ACE_Allocator *allocator = 0);
+
+ /// Sets the transport for this invocation.
+ void transport (TAO_Transport *t);
+
+ /// @name The Reply Dispatcher methods
+ //@{
+ virtual int dispatch_reply (TAO_Pluggable_Reply_Params &) = 0;
+
+ virtual void connection_closed (void) = 0;
+ //@}
+
+ /// Inform that the reply timed out
+ virtual void reply_timed_out (void) = 0;
+
+ /// Install the timeout handler
+ virtual long schedule_timer (CORBA::ULong ,
+ const ACE_Time_Value &
+ ACE_ENV_ARG_DECL) = 0;
+
+ /// @name Mutators for refcount
+ //@{
+ void incr_refcount (void);
+ void decr_refcount (void);
+ //@}
+
+ /// A helper method that can be used by the subclasses
+ /**
+ * The semantics of this helper method needs careful attention. A
+ * call to this method will do the following
+ *
+ * - If the reply has already been dispatched, the return value
+ * will be false to signify not to try.
+ *
+ * - If the reply has not been dispatched, this method will set
+ * the flag to be true and return a true value to signify that
+ * the caller thread can go ahead and dispatch reply.
+ *
+ * Why are we clumping everything in one method. Answer is we need
+ * atomicity?
+ */
+ bool try_dispatch_reply (void);
+
+protected:
+
+ /// Destructor.
+ virtual ~TAO_Asynch_Reply_Dispatcher_Base (void);
+
+protected:
+ /// The service context list.
+ /**
+ * Note, that this is not a reference as in
+ * the synchronous case. We own the reply_service_info
+ * because our TAO_Asynch_Invocation or TAO_DII_Deferred_Invocation
+ * will go out of scope before we are done.
+ */
+ IOP::ServiceContextList reply_service_info_;
+
+ /// The buffer that is used to initialise the data block
+ char buf_[ACE_CDR::DEFAULT_BUFSIZE];
+
+ /// Datablock that is created on the stack to initialise the CDR
+ /// stream underneath.
+ ACE_Data_Block db_;
+
+ /// CDR stream which has the reply information that needs to be
+ /// demarshalled by the stubs
+ TAO_InputCDR reply_cdr_;
+
+ /// This invocation is using this transport, may change...
+ TAO_Transport *transport_;
+
+private:
+ /// Lock to protect refcount and @c is_reply_dispatched_ flag.
+ ACE_Lock *lock_;
+
+ /// Refcount paraphernalia for this class
+ CORBA::ULong refcount_;
+
+ /// Has the reply been dispatched?
+ bool is_reply_dispatched_;
+
+ /// Allocator that was used to allocate this reply dispatcher. In case of
+ /// zero we come from the heap.
+ ACE_Allocator *allocator_;
+};
+
+namespace TAO
+{
+ /**
+ * @class ARDB_Refcount_Functor
+ *
+ * @brief Functor for refcounting of Asynch_Reply_Dispatcher_Base
+ *
+ * This is used to safely handle the destruction of
+ * Asynch_Reply_Dispatcher_Base objects which are created on the
+ * heap. We cannot use auto_ptr <> since it calls delete on the
+ * pointer, and calling delete on Asynch_Reply_Dispatcher_Base *
+ * will not work. Hence this functor will be used with Auto_Functor
+ * class to handle the memory safely.
+ *
+ * @todo Ideally, this class can be a generic class. But that
+ * requires quite a bit of cleanup within TAO to be more useful.
+ */
+ class TAO_Export ARDB_Refcount_Functor
+ {
+ public:
+ void operator() (TAO_Asynch_Reply_Dispatcher_Base *ardb)
+ ACE_THROW_SPEC (());
+ };
+
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+#include "tao/Asynch_Reply_Dispatcher_Base.i"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_ASYNCH_REPLY_DISPATCHER_BASE_H */
diff --git a/TAO/tao/Asynch_Reply_Dispatcher_Base.i b/TAO/tao/Asynch_Reply_Dispatcher_Base.i
new file mode 100644
index 00000000000..c63371d74a4
--- /dev/null
+++ b/TAO/tao/Asynch_Reply_Dispatcher_Base.i
@@ -0,0 +1,18 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ ACE_INLINE void
+ ARDB_Refcount_Functor::operator () (
+ TAO_Asynch_Reply_Dispatcher_Base *ardb)
+ ACE_THROW_SPEC (())
+ {
+ (void) ardb->decr_refcount ();
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Auto_Functor.h b/TAO/tao/Auto_Functor.h
new file mode 100644
index 00000000000..a764aea0e3d
--- /dev/null
+++ b/TAO/tao/Auto_Functor.h
@@ -0,0 +1,39 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Auto_Functor.h
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan <coryan@atdesk.com>
+ */
+//=============================================================================
+#ifndef TAO_AUTO_FUNCTOR_H
+#define TAO_AUTO_FUNCTOR_H
+#include /**/ "ace/pre.h"
+
+#include "ace/config-all.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/Auto_Functor.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Utils
+ {
+
+ using namespace ACE_Utils;
+
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_AUTO_FUNCTOR_H*/
diff --git a/TAO/tao/BD_String_Argument_T.cpp b/TAO/tao/BD_String_Argument_T.cpp
new file mode 100644
index 00000000000..93bbc94fae9
--- /dev/null
+++ b/TAO/tao/BD_String_Argument_T.cpp
@@ -0,0 +1,155 @@
+// $Id$
+
+#ifndef TAO_BD_STRING_ARGUMENT_T_CPP
+#define TAO_BD_STRING_ARGUMENT_T_CPP
+
+#include "tao/BD_String_Argument_T.h"
+
+#if !defined (__ACE_INLINE__)
+#include "tao/BD_String_Argument_T.inl"
+#endif /* __ACE_INLINE__ */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template<typename S_var,
+ size_t BOUND,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::In_BD_String_Argument_T<S_var,BOUND,Insert_Policy>::marshal (
+ TAO_OutputCDR & cdr
+ )
+{
+ typedef typename S_var::s_traits::from_type from_type;
+ return cdr << from_type (this->x_, BOUND);
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S_var,
+ size_t BOUND,
+ class Insert_Policy>
+void
+TAO::In_BD_String_Argument_T<S_var,BOUND,Insert_Policy>::interceptor_value (
+ CORBA::Any *any) const
+{
+ typedef typename S_var::s_traits::from_type from_type;
+ Insert_Policy::any_insert (
+ any,
+ from_type (this->x_, BOUND)
+ );
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+// ===========================================================
+
+template<typename S_var,
+ size_t BOUND,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::Inout_BD_String_Argument_T<S_var,BOUND,Insert_Policy>::marshal (
+ TAO_OutputCDR & cdr
+ )
+{
+ typedef typename S_var::s_traits::from_type from_type;
+ return cdr << from_type (this->x_, BOUND);
+}
+
+template<typename S_var,
+ size_t BOUND,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::Inout_BD_String_Argument_T<S_var,BOUND,Insert_Policy>::demarshal (
+ TAO_InputCDR & cdr
+ )
+{
+ typedef typename S_var::s_traits::to_type to_type;
+ delete [] this->x_;
+ return cdr >> to_type (this->x_, BOUND);
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S_var,
+ size_t BOUND,
+ class Insert_Policy>
+void
+TAO::Inout_BD_String_Argument_T<S_var,BOUND,Insert_Policy>::interceptor_value (
+ CORBA::Any *any) const
+{
+ typedef typename S_var::s_traits::from_type from_type;
+ Insert_Policy::any_insert (
+ any,
+ from_type (this->x_, BOUND)
+ );
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+// ==============================================================
+
+template<typename S_var,
+ size_t BOUND,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::Out_BD_String_Argument_T<S_var,BOUND,Insert_Policy>::demarshal (
+ TAO_InputCDR & cdr
+ )
+{
+ typedef typename S_var::s_traits::to_type to_type;
+ return cdr >> to_type (this->x_, BOUND);
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S_var,
+ size_t BOUND,
+ class Insert_Policy>
+void
+TAO::Out_BD_String_Argument_T<S_var,BOUND,Insert_Policy>::interceptor_value (
+ CORBA::Any *any) const
+{
+ typedef typename S_var::s_traits::from_type from_type;
+ Insert_Policy::any_insert (
+ any,
+ from_type (this->x_, BOUND)
+ );
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+// ============================================================
+
+template<typename S_var,
+ size_t BOUND,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::Ret_BD_String_Argument_T<S_var,BOUND,Insert_Policy>::demarshal (
+ TAO_InputCDR & cdr
+ )
+{
+ typedef typename S_var::s_traits::to_type to_type;
+ return cdr >> to_type (this->x_.out (), BOUND);
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S_var,
+ size_t BOUND,
+ class Insert_Policy>
+void
+TAO::Ret_BD_String_Argument_T<S_var,BOUND,Insert_Policy>::interceptor_value (
+ CORBA::Any *any) const
+{
+ typedef typename S_var::s_traits::from_type from_type;
+ Insert_Policy::any_insert (
+ any,
+ from_type (this->x_.in (), BOUND)
+ );
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_BD_STRING_ARGUMENT_T_CPP */
diff --git a/TAO/tao/BD_String_Argument_T.h b/TAO/tao/BD_String_Argument_T.h
new file mode 100644
index 00000000000..3c682f63183
--- /dev/null
+++ b/TAO/tao/BD_String_Argument_T.h
@@ -0,0 +1,181 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file BD_String_Argument_T.h
+ *
+ * $Id$
+ *
+ * @authors Jeff Parsons and Carlos O'Ryan
+ */
+//=============================================================================
+
+
+#ifndef TAO_BD_STRING_ARGUMENT_T_H
+#define TAO_BD_STRING_ARGUMENT_T_H
+
+#include /**/ "ace/pre.h"
+
+#include "ace/CDR_Stream.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Argument.h"
+#include "tao/Any_Insert_Policy_T.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ /**
+ * @class In_BD_String_Argument_T
+ *
+ * @brief Template class for IN bounded (w)string argument.
+ *
+ */
+ template<typename S_var,
+ size_t BOUND,
+ class Insert_Policy>
+ class In_BD_String_Argument_T : public InArgument
+ {
+ public:
+ In_BD_String_Argument_T (const typename S_var::s_traits::char_type * x);
+
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+
+ typename S_var::s_traits::char_type const * arg (void) const;
+
+ private:
+ typename S_var::s_traits::char_type const * x_;
+ };
+
+ /**
+ * @class Inout_BD_String_Argument_T
+ *
+ * @brief Template class for INOUT bounded (w)string argument.
+ *
+ */
+ template<typename S_var,
+ size_t BOUND,
+ class Insert_Policy>
+ class Inout_BD_String_Argument_T : public InoutArgument
+ {
+ public:
+ Inout_BD_String_Argument_T (typename S_var::s_traits::char_type *& x);
+
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+ virtual CORBA::Boolean demarshal (TAO_InputCDR &cdr);
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ typename S_var::s_traits::char_type *& arg (void);
+
+ private:
+ typename S_var::s_traits::char_type *& x_;
+ };
+
+ /**
+ * @class Out_BD_String_Argument_T
+ *
+ * @brief Template class for OUT bounded (w)string argument.
+ *
+ */
+ template<typename S_var,
+ size_t BOUND,
+ class Insert_Policy>
+ class Out_BD_String_Argument_T : public OutArgument
+ {
+ public:
+ Out_BD_String_Argument_T (typename S_var::s_traits::string_out x);
+
+ virtual CORBA::Boolean demarshal (TAO_InputCDR &);
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ typename S_var::s_traits::char_type *& arg (void);
+
+ private:
+ typename S_var::s_traits::char_type *& x_;
+ };
+
+ /**
+ * @class Ret_BD_String_Argument_T
+ *
+ * @brief Template class for return stub value of bd (w)string argument.
+ *
+ */
+ template<typename S_var,
+ size_t BOUND,
+ class Insert_Policy>
+ class Ret_BD_String_Argument_T : public RetArgument
+ {
+ public:
+ Ret_BD_String_Argument_T (void);
+
+ virtual CORBA::Boolean demarshal (TAO_InputCDR &);
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ typename S_var::s_traits::char_type *& arg (void);
+
+ typename S_var::s_traits::char_type * excp (void);
+ typename S_var::s_traits::char_type * retn (void);
+
+ private:
+ S_var x_;
+ };
+
+ /**
+ * @struct BD_String_Arg_Traits_T
+ *
+ * @brief Template class for stub argument traits of bounded (w)strings.
+ *
+ */
+ template<typename T_var,
+ size_t BOUND,
+ class Insert_Policy>
+ struct BD_String_Arg_Traits_T
+ {
+ typedef typename T_var::s_traits::char_type * ret_type;
+ typedef typename T_var::s_traits::char_type const * in_type;
+ typedef typename T_var::s_traits::char_type *& inout_type;
+ typedef typename T_var::s_traits::string_out out_type;
+
+ typedef In_BD_String_Argument_T<T_var,
+ BOUND,
+ Insert_Policy> in_arg_val;
+ typedef Inout_BD_String_Argument_T<T_var,
+ BOUND,
+ Insert_Policy> inout_arg_val;
+ typedef Out_BD_String_Argument_T<T_var,
+ BOUND,
+ Insert_Policy> out_arg_val;
+ typedef Ret_BD_String_Argument_T<T_var,
+ BOUND,
+ Insert_Policy> ret_val;
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+#include "tao/BD_String_Argument_T.inl"
+#endif /* __ACE_INLINE__ */
+
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+#include "tao/BD_String_Argument_T.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
+#pragma implementation ("BD_String_Argument_T.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_BD_STRING_ARGUMENT_T_H */
diff --git a/TAO/tao/BD_String_Argument_T.inl b/TAO/tao/BD_String_Argument_T.inl
new file mode 100644
index 00000000000..4ba189fa769
--- /dev/null
+++ b/TAO/tao/BD_String_Argument_T.inl
@@ -0,0 +1,110 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template<typename S_var,
+ size_t BOUND,
+ class Insert_Policy>
+ACE_INLINE
+TAO::In_BD_String_Argument_T<S_var,BOUND,Insert_Policy>::In_BD_String_Argument_T (
+ const typename S_var::s_traits::char_type * x
+ )
+ : x_ (x)
+{}
+
+template<typename S_var,
+ size_t BOUND,
+ class Insert_Policy>
+ACE_INLINE
+const typename S_var::s_traits::char_type *
+TAO::In_BD_String_Argument_T<S_var,BOUND,Insert_Policy>::arg (void) const
+{
+ return this->x_;
+}
+
+// ==========================================================================
+
+template<typename S_var,
+ size_t BOUND,
+ class Insert_Policy>
+ACE_INLINE
+TAO::Inout_BD_String_Argument_T<S_var,BOUND,Insert_Policy>::
+Inout_BD_String_Argument_T (typename S_var::s_traits::char_type *& x)
+ : x_ (x)
+{}
+
+template<typename S_var,
+ size_t BOUND,
+ class Insert_Policy>
+ACE_INLINE
+typename S_var::s_traits::char_type *&
+TAO::Inout_BD_String_Argument_T<S_var,BOUND,Insert_Policy>::arg (void)
+{
+ return this->x_;
+}
+
+// ==========================================================================
+
+template<typename S_var,
+ size_t BOUND,
+ class Insert_Policy>
+ACE_INLINE
+TAO::Out_BD_String_Argument_T<S_var,BOUND,Insert_Policy>::
+Out_BD_String_Argument_T (typename S_var::s_traits::string_out x)
+ : x_ (x.ptr ())
+{}
+
+template<typename S_var,
+ size_t BOUND,
+ class Insert_Policy>
+ACE_INLINE
+typename S_var::s_traits::char_type *&
+TAO::Out_BD_String_Argument_T<S_var,BOUND,Insert_Policy>::arg (void)
+{
+ return this->x_;
+}
+
+// ==========================================================================
+
+template<typename S_var,
+ size_t BOUND,
+ class Insert_Policy>
+ACE_INLINE
+TAO::Ret_BD_String_Argument_T<S_var,BOUND,Insert_Policy>::
+Ret_BD_String_Argument_T (void)
+{
+}
+
+template<typename S_var,
+ size_t BOUND,
+ class Insert_Policy>
+ACE_INLINE
+typename S_var::s_traits::char_type *
+TAO::Ret_BD_String_Argument_T<S_var,BOUND,Insert_Policy>::excp (void)
+{
+ return this->x_.ptr ();
+}
+
+template<typename S_var,
+ size_t BOUND,
+ class Insert_Policy>
+ACE_INLINE
+typename S_var::s_traits::char_type *
+TAO::Ret_BD_String_Argument_T<S_var,BOUND,Insert_Policy>::retn (void)
+{
+ return this->x_._retn ();
+}
+
+template<typename S_var,
+ size_t BOUND,
+ class Insert_Policy>
+ACE_INLINE
+typename S_var::s_traits::char_type *&
+TAO::Ret_BD_String_Argument_T<S_var,BOUND,Insert_Policy>::arg (void)
+{
+ return this->x_.out ();
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Base_Transport_Property.cpp b/TAO/tao/Base_Transport_Property.cpp
new file mode 100644
index 00000000000..121aea34b89
--- /dev/null
+++ b/TAO/tao/Base_Transport_Property.cpp
@@ -0,0 +1,58 @@
+//$Id$
+
+#include "tao/Base_Transport_Property.h"
+#include "ace/OS_Memory.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/Base_Transport_Property.inl"
+#endif /* __ACE_INLINE__ */
+
+ACE_RCSID (tao,
+ Base_Transport_Property,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Base_Transport_Property::~TAO_Base_Transport_Property (void)
+{
+}
+
+TAO_Transport_Descriptor_Interface *
+TAO_Base_Transport_Property::duplicate (void)
+{
+ // Get a copy of the underlying endpoint
+ TAO_Endpoint *endpt = this->endpoint_->duplicate ();
+ if (endpt == 0)
+ return 0;
+
+ // Construct a copy of our class
+ TAO_Base_Transport_Property *prop = 0;
+ ACE_NEW_RETURN (prop,
+ TAO_Base_Transport_Property (endpt,
+ 1),
+ 0);
+ return prop;
+}
+
+
+CORBA::Boolean
+TAO_Base_Transport_Property::is_equivalent (
+ const TAO_Transport_Descriptor_Interface *rhs)
+{
+ const TAO_Base_Transport_Property *other_desc =
+ dynamic_cast<const TAO_Base_Transport_Property *> (rhs);
+
+ if (other_desc == 0)
+ return 0;
+
+ return this->endpoint_->is_equivalent (other_desc->endpoint_);
+}
+
+
+u_long
+TAO_Base_Transport_Property::hash (void) const
+{
+ return this->endpoint_->hash ();
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Base_Transport_Property.h b/TAO/tao/Base_Transport_Property.h
new file mode 100644
index 00000000000..623eb7e4a55
--- /dev/null
+++ b/TAO/tao/Base_Transport_Property.h
@@ -0,0 +1,77 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// ===================================================================
+/**
+ * @file Base_Transport_Property.h
+ *
+ * $Id$
+ *
+ * @author Bala Natarajan <bala@cs.wustl.edu>
+ */
+// ===================================================================
+
+#ifndef TAO_BASE_CONNECTION_PROPERTY_H
+#define TAO_BASE_CONNECTION_PROPERTY_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Transport_Descriptor_Interface.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Endpoint.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_Base_Transport_Property
+ *
+ * @brief A concrete implementation for connnection property
+ *
+ * This class is a concrete implementation of a simple connection
+ * property class. This provides an implementation for the virtual
+ * functions declared in TAO_Transport_Descriptor_Interface.
+ */
+class TAO_Export TAO_Base_Transport_Property
+ : public TAO_Transport_Descriptor_Interface
+{
+public:
+
+ /// Default constructor
+ TAO_Base_Transport_Property (void);
+
+ /// Constructor
+ TAO_Base_Transport_Property (TAO_Endpoint *endpoint,
+ CORBA::Boolean flag = false);
+
+ /// Destructor
+ virtual ~TAO_Base_Transport_Property (void);
+
+ /// The copy constructor.
+ TAO_Base_Transport_Property (const TAO_Base_Transport_Property &rhs);
+
+ /// This call allocates and copies the contents of this class and
+ /// returns the pointer
+ virtual TAO_Transport_Descriptor_Interface *duplicate (void);
+
+ /// Try to determine if this object is same as the @a other_prop.
+ virtual CORBA::Boolean is_equivalent (
+ const TAO_Transport_Descriptor_Interface *other_prop);
+
+ /// Generate hash value for our class
+ virtual u_long hash (void) const;
+
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/Base_Transport_Property.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+#endif /*TAO_BASE_CONNECTION_PROPERTY_H*/
diff --git a/TAO/tao/Base_Transport_Property.inl b/TAO/tao/Base_Transport_Property.inl
new file mode 100644
index 00000000000..3c097130fd4
--- /dev/null
+++ b/TAO/tao/Base_Transport_Property.inl
@@ -0,0 +1,31 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO_Base_Transport_Property::TAO_Base_Transport_Property (void)
+{
+
+}
+
+ACE_INLINE
+TAO_Base_Transport_Property::
+ TAO_Base_Transport_Property (TAO_Endpoint *endpoint,
+ CORBA::Boolean flag)
+ : TAO_Transport_Descriptor_Interface (endpoint,
+ flag)
+{
+}
+
+ACE_INLINE
+TAO_Base_Transport_Property::TAO_Base_Transport_Property (
+ const TAO_Base_Transport_Property &rhs)
+ : TAO_Transport_Descriptor_Interface (rhs.endpoint_->duplicate (),
+ 1)
+{
+
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Basic_Argument_T.cpp b/TAO/tao/Basic_Argument_T.cpp
new file mode 100644
index 00000000000..f122331be07
--- /dev/null
+++ b/TAO/tao/Basic_Argument_T.cpp
@@ -0,0 +1,110 @@
+// $Id$
+
+#ifndef TAO_BASIC_ARGUMENT_T_CPP
+#define TAO_BASIC_ARGUMENT_T_CPP
+
+#include "tao/Basic_Argument_T.h"
+
+#if !defined (__ACE_INLINE__)
+#include "tao/Basic_Argument_T.inl"
+#endif /* __ACE_INLINE__ */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template<typename S,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::In_Basic_Argument_T<S, Insert_Policy>::marshal (TAO_OutputCDR &cdr)
+{
+ return cdr << this->x_;
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S,
+ class Insert_Policy>
+void
+TAO::In_Basic_Argument_T<S, Insert_Policy>::interceptor_value (CORBA::Any *any) const
+{
+ Insert_Policy::any_insert (any, this->x_);
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+// ===========================================================
+
+template<typename S,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::Inout_Basic_Argument_T<S, Insert_Policy>::marshal (TAO_OutputCDR &cdr)
+{
+ return cdr << this->x_;
+}
+
+template<typename S,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::Inout_Basic_Argument_T<S, Insert_Policy>::demarshal (TAO_InputCDR & cdr)
+{
+ return cdr >> this->x_;
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S,
+ class Insert_Policy>
+void
+TAO::Inout_Basic_Argument_T<S, Insert_Policy>::interceptor_value (CORBA::Any *any) const
+{
+ Insert_Policy::any_insert (any, this->x_);
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+// ==============================================================
+
+template<typename S,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::Out_Basic_Argument_T<S, Insert_Policy>::demarshal (TAO_InputCDR & cdr)
+{
+ return cdr >> this->x_;
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S,
+ class Insert_Policy>
+void
+TAO::Out_Basic_Argument_T<S, Insert_Policy>::interceptor_value (CORBA::Any *any) const
+{
+ Insert_Policy::any_insert (any, this->x_);
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+// ============================================================
+
+template<typename S,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::Ret_Basic_Argument_T<S, Insert_Policy>::demarshal (TAO_InputCDR & cdr)
+{
+ return cdr >> this->x_;
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S,
+ class Insert_Policy>
+void
+TAO::Ret_Basic_Argument_T<S, Insert_Policy>::interceptor_value (CORBA::Any *any) const
+{
+ Insert_Policy::any_insert (any, this->x_);
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_BASIC_ARGUMENT_T_CPP */
diff --git a/TAO/tao/Basic_Argument_T.h b/TAO/tao/Basic_Argument_T.h
new file mode 100644
index 00000000000..d38aa4ead57
--- /dev/null
+++ b/TAO/tao/Basic_Argument_T.h
@@ -0,0 +1,162 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Basic_Argument_T.h
+ *
+ * $Id$
+ *
+ * @authors Jeff Parsons and Carlos O'Ryan
+ */
+//=============================================================================
+
+
+#ifndef TAO_BASIC_ARGUMENT_T_H
+#define TAO_BASIC_ARGUMENT_T_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Argument.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ /**
+ * @class In_Basic_Argument_T
+ *
+ * @brief Template class for IN stub argument of basic IDL types.
+ */
+ template<typename S,
+ class Insert_Policy>
+ class In_Basic_Argument_T : public InArgument
+ {
+ public:
+ In_Basic_Argument_T (S const & x);
+
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ S arg (void) const;
+
+ private:
+ S const & x_;
+ };
+
+ /**
+ * @class Inout_Basic_Argument_T
+ *
+ * @brief Template class for INOUT stub argument of basic IDL types.
+ *
+ */
+ template<typename S,
+ class Insert_Policy>
+ class Inout_Basic_Argument_T : public InoutArgument
+ {
+ public:
+ Inout_Basic_Argument_T (S & x);
+
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+ virtual CORBA::Boolean demarshal (TAO_InputCDR &);
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ S & arg (void);
+
+ private:
+ S & x_;
+ };
+
+ /**
+ * @class Out_Basic_Argument_T
+ *
+ * @brief Template class for OUT stub argument of basic IDL types.
+ *
+ */
+ template<typename S,
+ class Insert_Policy>
+ class Out_Basic_Argument_T : public OutArgument
+ {
+ public:
+ Out_Basic_Argument_T (S & x);
+
+ virtual CORBA::Boolean demarshal (TAO_InputCDR &);
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ S & arg (void);
+
+ private:
+ S & x_;
+ };
+
+ /**
+ * @class Ret_Basic_Argument_T
+ *
+ * @brief Template class for return stub value of basic IDL types.
+ *
+ */
+ template<typename S,
+ class Insert_Policy>
+ class Ret_Basic_Argument_T : public RetArgument
+ {
+ public:
+ Ret_Basic_Argument_T (void);
+
+ virtual CORBA::Boolean demarshal (TAO_InputCDR &);
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ S & arg (void);
+
+ S excp (void);
+ S retn (void);
+
+ private:
+ S x_;
+ };
+
+
+ /**
+ * @struct Basic_Arg_Traits_T
+ *
+ * @brief Template class for stub argument traits of basic IDL types.
+ *
+ */
+ template<typename T, class Insert_Policy>
+ struct Basic_Arg_Traits_T
+ {
+ typedef T ret_type;
+ typedef T in_type;
+ typedef T & inout_type;
+ typedef T & out_type;
+
+ typedef In_Basic_Argument_T<T, Insert_Policy> in_arg_val;
+ typedef Inout_Basic_Argument_T<T, Insert_Policy> inout_arg_val;
+ typedef Out_Basic_Argument_T<T, Insert_Policy> out_arg_val;
+ typedef Ret_Basic_Argument_T<T, Insert_Policy> ret_val;
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+#include "tao/Basic_Argument_T.inl"
+#endif /* __ACE_INLINE__ */
+
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+#include "tao/Basic_Argument_T.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
+#pragma implementation ("Basic_Argument_T.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_BASIC_ARGUMENT_T_H */
diff --git a/TAO/tao/Basic_Argument_T.inl b/TAO/tao/Basic_Argument_T.inl
new file mode 100644
index 00000000000..022e09eb5af
--- /dev/null
+++ b/TAO/tao/Basic_Argument_T.inl
@@ -0,0 +1,95 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template<typename S,
+ class Insert_Policy>
+ACE_INLINE
+TAO::In_Basic_Argument_T<S, Insert_Policy>::In_Basic_Argument_T (S const & x)
+ : x_ (x)
+{}
+
+template<typename S,
+ class Insert_Policy>
+ACE_INLINE
+S
+TAO::In_Basic_Argument_T<S, Insert_Policy>::arg (void) const
+{
+ return this->x_;
+}
+
+// ================================================================
+
+template<typename S,
+ class Insert_Policy>
+ACE_INLINE
+TAO::Inout_Basic_Argument_T<S, Insert_Policy>::Inout_Basic_Argument_T (S & x)
+ : x_ (x)
+{}
+
+template<typename S,
+ class Insert_Policy>
+ACE_INLINE
+S &
+TAO::Inout_Basic_Argument_T<S, Insert_Policy>::arg (void)
+{
+ return this->x_;
+}
+
+// ================================================================
+
+template<typename S,
+ class Insert_Policy>
+ACE_INLINE
+TAO::Out_Basic_Argument_T<S, Insert_Policy>::Out_Basic_Argument_T (S & x)
+ : x_ (x)
+{}
+
+template<typename S,
+ class Insert_Policy>
+ACE_INLINE
+S &
+TAO::Out_Basic_Argument_T<S, Insert_Policy>::arg (void)
+{
+ return this->x_;
+}
+
+// ================================================================
+
+template<typename S,
+ class Insert_Policy>
+ACE_INLINE
+TAO::Ret_Basic_Argument_T<S, Insert_Policy>::Ret_Basic_Argument_T (void)
+{
+}
+
+template<typename S,
+ class Insert_Policy>
+ACE_INLINE
+S &
+TAO::Ret_Basic_Argument_T<S, Insert_Policy>::arg (void)
+{
+ return this->x_;
+}
+
+template<typename S,
+ class Insert_Policy>
+ACE_INLINE
+S
+TAO::Ret_Basic_Argument_T<S, Insert_Policy>::excp (void)
+{
+ return this->x_;
+}
+
+template<typename S,
+ class Insert_Policy>
+ACE_INLINE
+S
+TAO::Ret_Basic_Argument_T<S, Insert_Policy>::retn (void)
+{
+ return this->x_;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Basic_Arguments.h b/TAO/tao/Basic_Arguments.h
new file mode 100644
index 00000000000..a4327115f8b
--- /dev/null
+++ b/TAO/tao/Basic_Arguments.h
@@ -0,0 +1,121 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Basic_Arguments.h
+ *
+ * $Id$
+ *
+ * @authors Jeff Parsons and Carlos O'Ryan
+ */
+//=============================================================================
+
+
+#ifndef TAO_BASIC_ARGUMENTS_H
+#define TAO_BASIC_ARGUMENTS_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Basic_Argument_T.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Arg_Traits_T.h"
+#include "tao/Any_Insert_Policy_T.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ /**
+ *
+ * @brief Specialization for void return type.
+ *
+ */
+ template<>
+ class TAO_Export Arg_Traits<void>
+ {
+ public:
+ typedef void ret_type;
+
+ typedef RetArgument ret_val;
+ };
+
+ /**
+ *
+ * @brief Specializations for basic stub arg types,
+ * except (w)char/boolean/octet.
+ *
+ */
+
+ template<>
+ class TAO_Export Arg_Traits<CORBA::Short>
+ : public Basic_Arg_Traits_T<CORBA::Short,
+ TAO::Any_Insert_Policy_AnyTypeCode_Adapter <CORBA::Short> >
+ {
+ };
+
+ template<>
+ class TAO_Export Arg_Traits<CORBA::Long>
+ : public Basic_Arg_Traits_T<CORBA::Long,
+ TAO::Any_Insert_Policy_AnyTypeCode_Adapter <CORBA::Long> >
+ {
+ };
+
+ template<>
+ class TAO_Export Arg_Traits<CORBA::UShort>
+ : public Basic_Arg_Traits_T<CORBA::UShort,
+ TAO::Any_Insert_Policy_AnyTypeCode_Adapter <CORBA::UShort> >
+ {
+ };
+
+ template<>
+ class TAO_Export Arg_Traits<CORBA::ULong>
+ : public Basic_Arg_Traits_T<CORBA::ULong,
+ TAO::Any_Insert_Policy_AnyTypeCode_Adapter <CORBA::ULong> >
+ {
+ };
+
+ template<>
+ class TAO_Export Arg_Traits<CORBA::Float>
+ : public Basic_Arg_Traits_T<CORBA::Float,
+ TAO::Any_Insert_Policy_AnyTypeCode_Adapter <CORBA::Float> >
+ {
+ };
+
+ template<>
+ class TAO_Export Arg_Traits<CORBA::Double>
+ : public Basic_Arg_Traits_T<CORBA::Double,
+ TAO::Any_Insert_Policy_AnyTypeCode_Adapter <CORBA::Double> >
+ {
+ };
+
+ template<>
+ class TAO_Export Arg_Traits<CORBA::LongLong>
+ : public Basic_Arg_Traits_T<CORBA::LongLong,
+ TAO::Any_Insert_Policy_AnyTypeCode_Adapter <CORBA::LongLong> >
+ {
+ };
+
+ template<>
+ class TAO_Export Arg_Traits<CORBA::ULongLong>
+ : public Basic_Arg_Traits_T<CORBA::ULongLong,
+ TAO::Any_Insert_Policy_AnyTypeCode_Adapter <CORBA::ULongLong> >
+ {
+ };
+
+ template<>
+ class TAO_Export Arg_Traits<CORBA::LongDouble>
+ : public Basic_Arg_Traits_T<CORBA::LongDouble,
+ TAO::Any_Insert_Policy_AnyTypeCode_Adapter <CORBA::LongDouble> >
+ {
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_BASIC_ARGUMENTS_H */
diff --git a/TAO/tao/Basic_Types.h b/TAO/tao/Basic_Types.h
new file mode 100644
index 00000000000..e9686f535e3
--- /dev/null
+++ b/TAO/tao/Basic_Types.h
@@ -0,0 +1,100 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Basic_Types.h
+ *
+ * $Id$
+ *
+ * @authors Jeff Parsons
+ */
+//=============================================================================
+
+
+#ifndef TAO_BASIC_TYPES_H
+#define TAO_BASIC_TYPES_H
+
+#include /**/ "ace/pre.h"
+#include "ace/CDR_Base.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/orbconf.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ template <typename charT> class String_var;
+ template <typename charT> class String_out;
+}
+
+namespace CORBA
+{
+ /**
+ * @name CORBA Primitive Types
+ *
+ * Declarations of all CORBA primitive types.
+ */
+ //@{
+ typedef ACE_CDR::Boolean Boolean;
+ typedef Boolean &Boolean_out;
+
+ typedef ACE_CDR::Octet Octet;
+ typedef Octet &Octet_out;
+
+ typedef ACE_CDR::Short Short;
+ typedef Short &Short_out;
+
+ typedef ACE_CDR::UShort UShort;
+ typedef UShort &UShort_out;
+
+ typedef ACE_CDR::Long Long;
+ typedef Long &Long_out;
+
+ typedef ACE_CDR::ULong ULong;
+ typedef ULong &ULong_out;
+
+ typedef ACE_CDR::LongLong LongLong;
+ typedef LongLong &LongLong_out;
+
+ typedef ACE_CDR::ULongLong ULongLong;
+ typedef ULongLong &ULongLong_out;
+
+ typedef ACE_CDR::Float Float;
+ typedef Float &Float_out;
+
+ typedef ACE_CDR::Double Double;
+ typedef Double &Double_out;
+
+ typedef ACE_CDR::LongDouble LongDouble;
+ typedef LongDouble &LongDouble_out;
+
+ typedef ACE_CDR::Char Char;
+ typedef Char &Char_out;
+
+ typedef ACE_CDR::WChar WChar;
+ typedef WChar &WChar_out;
+ //@}
+
+ typedef TAO::String_var<CORBA::Char> String_var;
+ typedef TAO::String_out<CORBA::Char> String_out;
+ typedef TAO::String_var<CORBA::WChar> WString_var;
+ typedef TAO::String_out<CORBA::WChar> WString_out;
+
+ class TypeCode;
+ typedef TypeCode *TypeCode_ptr;
+
+ class Any;
+}
+
+class TAO_InputCDR;
+class TAO_OutputCDR;
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_BASIC_TYPES_H */
diff --git a/TAO/tao/BiDir_Adapter.cpp b/TAO/tao/BiDir_Adapter.cpp
new file mode 100644
index 00000000000..b564942d5db
--- /dev/null
+++ b/TAO/tao/BiDir_Adapter.cpp
@@ -0,0 +1,13 @@
+// $Id$
+
+#include "tao/BiDir_Adapter.h"
+
+ACE_RCSID(tao, BiDir_Adapter, "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_BiDir_Adapter::~TAO_BiDir_Adapter (void)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/BiDir_Adapter.h b/TAO/tao/BiDir_Adapter.h
new file mode 100644
index 00000000000..a1a394d8b5b
--- /dev/null
+++ b/TAO/tao/BiDir_Adapter.h
@@ -0,0 +1,52 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file BiDir_Adapter.h
+ *
+ * $Id$
+ *
+ * @author Balachandran Natarajan <parsons@cs.wustl.edu>
+ */
+//=============================================================================
+#ifndef TAO_BIDIR_ADAPTER_H
+#define TAO_BIDIR_ADAPTER_H
+
+#include /**/ "ace/pre.h"
+#include "ace/Service_Object.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/SystemException.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Policy_Validator;
+
+/**
+ * @class TAO_BiDir_Adapter
+ *
+ * @brief TAO_BiDir_Adapter.
+ *
+ * Class that offers an interface to the ORB to load and manipulate
+ * BiDirGIOP library.
+ */
+class TAO_Export TAO_BiDir_Adapter : public ACE_Service_Object
+{
+public:
+
+ /// The virtual destructor
+ virtual ~TAO_BiDir_Adapter (void);
+
+ virtual void load_policy_validators (TAO_Policy_Validator &validator ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException)) = 0;
+
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_BIDIR_ADAPTER_H */
diff --git a/TAO/tao/BiDir_GIOP.mpc b/TAO/tao/BiDir_GIOP.mpc
new file mode 100644
index 00000000000..af2a4bce1ea
--- /dev/null
+++ b/TAO/tao/BiDir_GIOP.mpc
@@ -0,0 +1,43 @@
+//$Id$
+project : taolib, core, pi, tao_versioning_idl_defaults {
+ sharedname = TAO_BiDirGIOP
+ dynamicflags = TAO_BIDIRGIOP_BUILD_DLL
+
+ Source_Files {
+ BiDir_GIOP
+ }
+
+ Header_Files {
+ BiDir_GIOP
+ }
+
+ Inline_Files {
+ BiDir_GIOP
+ }
+
+ Template_Files {
+ BiDir_GIOP
+ }
+
+ Resource_Files {
+ BiDir_GIOP
+ }
+
+ PIDL_Files {
+ BiDir_GIOP
+ }
+
+ IDL_Files {
+ idlflags += -Gp -Gd -Ge 1 -Sci -SS -Sorb -Sa -St \
+ -Wb,export_macro=TAO_BiDirGIOP_Export \
+ -Wb,export_include=tao/BiDir_GIOP/bidirgiop_export.h \
+ -Wb,include_guard=TAO_BIDIRGIOP_SAFE_INCLUDE \
+ -Wb,safe_include=tao/BiDir_GIOP/BiDirGIOP.h \
+ -o BiDir_GIOP
+ BiDir_GIOP/BiDirPolicy.pidl
+ }
+
+ Pkgconfig_Files {
+ BiDir_GIOP/TAO_BiDirGIOP.pc.in
+ }
+}
diff --git a/TAO/tao/BiDir_GIOP/BiDirGIOP.cpp b/TAO/tao/BiDir_GIOP/BiDirGIOP.cpp
new file mode 100644
index 00000000000..a4943a47b04
--- /dev/null
+++ b/TAO/tao/BiDir_GIOP/BiDirGIOP.cpp
@@ -0,0 +1,117 @@
+#include "tao/BiDir_GIOP/BiDir_ORBInitializer.h"
+#include "tao/BiDir_GIOP/BiDirGIOP.h"
+#include "tao/BiDir_GIOP/BiDirPolicy_Validator.h"
+#include "tao/ORB_Core.h"
+#include "tao/debug.h"
+#include "tao/ORBInitializer_Registry.h"
+
+ACE_RCSID (BiDir_GIOP,
+ BiDirGIOP,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Set the flag to zero to start with
+int TAO_BiDirGIOP_Loader::is_activated_ = 0;
+
+TAO_BiDirGIOP_Loader::TAO_BiDirGIOP_Loader (void)
+{
+}
+
+TAO_BiDirGIOP_Loader::~TAO_BiDirGIOP_Loader (void)
+{
+}
+
+int
+TAO_BiDirGIOP_Loader::init (int,
+ ACE_TCHAR* [])
+{
+ if (TAO_BiDirGIOP_Loader::is_activated_ == 0 && TAO_DEF_GIOP_MINOR >= 2)
+ {
+ PortableInterceptor::ORBInitializer_ptr tmp_orb_initializer =
+ PortableInterceptor::ORBInitializer::_nil ();
+ PortableInterceptor::ORBInitializer_var bidir_orb_initializer;
+
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ /// Register the BiDir ORBInitializer.
+ ACE_NEW_THROW_EX (tmp_orb_initializer,
+ TAO_BiDir_ORBInitializer,
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_TRY_CHECK;
+
+ bidir_orb_initializer = tmp_orb_initializer;
+
+ PortableInterceptor::register_orb_initializer (
+ bidir_orb_initializer.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ TAO_BiDirGIOP_Loader::is_activated_ = 1;
+ }
+ ACE_CATCHANY
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "Caught exception:");
+ }
+ return -1;
+ }
+ ACE_ENDTRY;
+ }
+
+ return 0;
+}
+
+void
+TAO_BiDirGIOP_Loader::load_policy_validators (TAO_Policy_Validator &val
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ // Is this true? Does the GIOP protocol version matter here?
+ if (TAO_DEF_GIOP_MINOR < 2)
+ return;
+
+ TAO_BiDirPolicy_Validator *validator = 0;
+ ACE_NEW_THROW_EX (validator,
+ TAO_BiDirPolicy_Validator (val.orb_core ()),
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_CHECK;
+
+ // We may be adding another TAO_BiDirPolicy_Validator instance for
+ // the same ORB (different POA). In cases where huge numbers of
+ // bi-directional POA instances are created, having a validator
+ // instance per POA may introduce additional delays in policy
+ // validation and hence, the overal policy creation time. Since this
+ // is out of the critical invocation processing path, I plan to keep
+ // the design simple and not try to avoid an ineficiency of such
+ // small proportions.
+ val.add_validator (validator);
+}
+
+int
+TAO_BiDirGIOP_Loader::Initializer (void)
+{
+ return ACE_Service_Config::process_directive (ace_svc_desc_TAO_BiDirGIOP_Loader);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DEFINE (TAO_BiDirGIOP_Loader,
+ ACE_TEXT ("BiDirGIOP_Loader"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (TAO_BiDirGIOP_Loader),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0)
+
+ACE_FACTORY_DEFINE (TAO_BiDirGIOP, TAO_BiDirGIOP_Loader)
diff --git a/TAO/tao/BiDir_GIOP/BiDirGIOP.h b/TAO/tao/BiDir_GIOP/BiDirGIOP.h
new file mode 100644
index 00000000000..fce8ed7395e
--- /dev/null
+++ b/TAO/tao/BiDir_GIOP/BiDirGIOP.h
@@ -0,0 +1,83 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file BiDirGIOP.h
+ *
+ * $Id$
+ *
+ * Dynamic loader object for BiDir GIOP
+ *
+ *
+ * @author Balachandran Natarajan <bala@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_BIDIR_GIOP_H
+#define TAO_BIDIR_GIOP_H
+#include /**/ "ace/pre.h"
+
+#include "tao/BiDir_GIOP/bidirgiop_export.h"
+
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PI/PI.h"
+#include "tao/BiDir_Adapter.h"
+#include "ace/Service_Config.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_BiDirPolicy_Validator;
+
+/**
+ * @class TAO_BiDirGIOP_Loader
+ *
+ * @brief Class that loads the BiDir library.
+ */
+
+class TAO_BiDirGIOP_Export TAO_BiDirGIOP_Loader : public TAO_BiDir_Adapter
+{
+public:
+
+ /// Constructor
+ TAO_BiDirGIOP_Loader (void);
+
+ /// Destructor
+ virtual ~TAO_BiDirGIOP_Loader (void);
+
+ /// Initialize the BiDIR loader hooks.
+ virtual int init (int argc,
+ ACE_TCHAR* []);
+
+ virtual void load_policy_validators (TAO_Policy_Validator &validator
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Used to force the initialization of the ORB code.
+ static int Initializer (void);
+
+private:
+
+ /// Flag to indicate whether the BiDirGIOP library has been
+ /// activated.
+ static int is_activated_;
+};
+
+static int
+TAO_Requires_BiDirGIOP_Initializer = TAO_BiDirGIOP_Loader::Initializer ();
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE (TAO_BiDirGIOP_Loader)
+ACE_FACTORY_DECLARE (TAO_BiDirGIOP, TAO_BiDirGIOP_Loader)
+
+
+#define TAO_BIDIRGIOP_SAFE_INCLUDE
+#include "tao/BiDir_GIOP/BiDirPolicyC.h"
+#undef TAO_BIDIRGIOP_SAFE_INCLUDE
+
+#include /**/ "ace/post.h"
+#endif /* TAO_BIDIR_GIOP_H */
diff --git a/TAO/tao/BiDir_GIOP/BiDirPolicy.pidl b/TAO/tao/BiDir_GIOP/BiDirPolicy.pidl
new file mode 100644
index 00000000000..91c6be9dc4c
--- /dev/null
+++ b/TAO/tao/BiDir_GIOP/BiDirPolicy.pidl
@@ -0,0 +1,43 @@
+// $Id$
+
+/**
+ * This file was used to generate the code in
+ * BiDirPolicy*.* The command used to generate code
+ * is:
+ *
+ * tao_idl -o orig -Ge 1 -Sa -St -Sci \
+ * -Wb,export_macro=TAO_BiDirGIOP_Export \
+ * -Wb,export_include="bidirgiop_export.h" \
+ * -Wb,pre_include="ace/pre.h" \
+ * -Wb,post_include="ace/post.h" \
+ * -Wb,versioning_begin=TAO_BEGIN_VERSIONED_NAMESPACE_DECL \
+ * -Wb,versioning_end=TAO_END_VERSIONED_NAMESPACE_DECL \
+ * BiDirPolicy.pidl
+ *
+ * This is from the GIOP 1.2 spec for Bi Dir IIOP.
+ */
+
+#ifndef TAO_BIDIR_POLICY_PIDL
+#define TAO_BIDIR_POLICY_PIDL
+
+#include "tao/Policy.pidl"
+
+#pragma prefix "omg.org"
+
+// Self contained module for Bi-directional GIOP policy
+module BiDirPolicy
+{
+ typedef unsigned short BidirectionalPolicyValue;
+ const BidirectionalPolicyValue NORMAL = 0;
+ const BidirectionalPolicyValue BOTH = 1;
+ const CORBA::PolicyType BIDIRECTIONAL_POLICY_TYPE = 37;
+
+ // @@ This has been made local. It was not so in the spec. Any reason
+ // why this shouldn't be a local interface ?
+ local interface BidirectionalPolicy : CORBA::Policy
+ {
+ readonly attribute BidirectionalPolicyValue value;
+ };
+};
+
+#endif /* TAO_BIDIR_POLICY_PIDL*/
diff --git a/TAO/tao/BiDir_GIOP/BiDirPolicy_Validator.cpp b/TAO/tao/BiDir_GIOP/BiDirPolicy_Validator.cpp
new file mode 100644
index 00000000000..0d6734ae2b0
--- /dev/null
+++ b/TAO/tao/BiDir_GIOP/BiDirPolicy_Validator.cpp
@@ -0,0 +1,60 @@
+#include "tao/BiDir_GIOP/BiDirPolicy_Validator.h"
+#include "tao/BiDir_GIOP/BiDir_Policy_i.h"
+#include "tao/Policy_Set.h"
+#include "tao/ORB_Core.h"
+
+ACE_RCSID (BiDir_GIOP,
+ BiDirPolicy_Validator,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_BiDirPolicy_Validator::TAO_BiDirPolicy_Validator (TAO_ORB_Core &orb_core)
+ : TAO_Policy_Validator (orb_core)
+{
+}
+
+
+void
+TAO_BiDirPolicy_Validator::validate_impl (TAO_Policy_Set &policies
+ ACE_ENV_ARG_DECL)
+{
+ CORBA::Policy_var policy =
+ policies.get_cached_policy (TAO_CACHED_POLICY_BIDIRECTIONAL_GIOP
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (policy.in () == 0)
+ return;
+
+ BiDirPolicy::BidirectionalPolicy_var srp =
+ BiDirPolicy::BidirectionalPolicy::_narrow (policy.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (srp.in () == 0)
+ return;
+
+ BiDirPolicy::BidirectionalPolicyValue val =
+ srp->value (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Set the flag in the ORB_Core
+ if (val == BiDirPolicy::BOTH)
+ orb_core_.bidir_giop_policy (true);
+}
+
+void
+TAO_BiDirPolicy_Validator::merge_policies_impl (TAO_Policy_Set & /*policies*/
+ ACE_ENV_ARG_DECL_NOT_USED)
+{
+ return ;
+}
+
+CORBA::Boolean
+TAO_BiDirPolicy_Validator::legal_policy_impl (CORBA::PolicyType type)
+{
+ return (type == BiDirPolicy::BIDIRECTIONAL_POLICY_TYPE);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/BiDir_GIOP/BiDirPolicy_Validator.h b/TAO/tao/BiDir_GIOP/BiDirPolicy_Validator.h
new file mode 100644
index 00000000000..106b1a834c8
--- /dev/null
+++ b/TAO/tao/BiDir_GIOP/BiDirPolicy_Validator.h
@@ -0,0 +1,58 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file BiDirPolicy_Validator.h
+ *
+ * $Id$
+ *
+ * This file contains the declaration for the BiDir policy validator
+ * interface.
+ *
+ * @author Angelo Corsaro <corsaro@cs.wustl.edu>
+ * @author Frank Hunleth <fhuntleth@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_BIDIR_POLICY_VALIDATOR_H_
+#define TAO_BIDIR_POLICY_VALIDATOR_H_
+
+#include /**/ "ace/pre.h"
+#include "tao/BiDir_GIOP/bidirgiop_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+#include "tao/Policy_Validator.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Policy_Set;
+class TAO_ORB_Core;
+
+/**
+ * @class TAO_BiDirPolicy_Validator
+ *
+ * @brief Policy Validator for BiDir GIOP class
+ *
+ */
+class TAO_BiDirGIOP_Export TAO_BiDirPolicy_Validator : public TAO_Policy_Validator
+{
+public:
+
+ TAO_BiDirPolicy_Validator (TAO_ORB_Core &orb_core);
+
+ virtual void validate_impl (TAO_Policy_Set &policies
+ ACE_ENV_ARG_DECL);
+
+ virtual void merge_policies_impl (TAO_Policy_Set &policies
+ ACE_ENV_ARG_DECL);
+
+ virtual CORBA::Boolean legal_policy_impl (CORBA::PolicyType type);
+
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_BIDIR_POLICY_VALIDATOR_H_ */
diff --git a/TAO/tao/BiDir_GIOP/BiDir_ORBInitializer.cpp b/TAO/tao/BiDir_GIOP/BiDir_ORBInitializer.cpp
new file mode 100644
index 00000000000..2aff9aa8432
--- /dev/null
+++ b/TAO/tao/BiDir_GIOP/BiDir_ORBInitializer.cpp
@@ -0,0 +1,69 @@
+// $Id$
+
+#include "tao/BiDir_GIOP/BiDir_ORBInitializer.h"
+#include "tao/BiDir_GIOP/BiDir_PolicyFactory.h"
+#include "tao/BiDir_GIOP/BiDirGIOP.h"
+
+#include "tao/ORB_Constants.h"
+
+ACE_RCSID (BiDir_GIOP,
+ BiDir_ORBInitializer,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+void
+TAO_BiDir_ORBInitializer::pre_init (
+ PortableInterceptor::ORBInitInfo_ptr
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ //
+}
+
+void
+TAO_BiDir_ORBInitializer::post_init (
+ PortableInterceptor::ORBInitInfo_ptr info
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->register_policy_factories (info
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+void
+TAO_BiDir_ORBInitializer::register_policy_factories (
+ PortableInterceptor::ORBInitInfo_ptr info
+ ACE_ENV_ARG_DECL)
+{
+ /// Register the BiDir policy factories.
+ PortableInterceptor::PolicyFactory_ptr temp_factory =
+ PortableInterceptor::PolicyFactory::_nil ();
+ /// This policy factory is used for all BiDir related policies.
+ ACE_NEW_THROW_EX (temp_factory,
+ TAO_BiDir_PolicyFactory,
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_CHECK;
+
+ PortableInterceptor::PolicyFactory_var policy_factory = temp_factory;
+
+ /// Bind the same policy factory to all BiDir related policy
+ /// types since a single policy factory is used to create each of
+ /// the different types of BiDir policies.
+
+ CORBA::PolicyType type;
+
+ type = BiDirPolicy::BIDIRECTIONAL_POLICY_TYPE;
+ info->register_policy_factory (type,
+ policy_factory.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/BiDir_GIOP/BiDir_ORBInitializer.h b/TAO/tao/BiDir_GIOP/BiDir_ORBInitializer.h
new file mode 100644
index 00000000000..b09a94da506
--- /dev/null
+++ b/TAO/tao/BiDir_GIOP/BiDir_ORBInitializer.h
@@ -0,0 +1,67 @@
+// -*- C++ -*-
+//
+// ===================================================================
+/**
+ * @file BiDir_ORBInitializer.h
+ *
+ * $Id$
+ *
+ * @author Balachandran Natarajan <bala@cs.wustl.edu>
+ */
+// ===================================================================
+#ifndef TAO_BIDIR_ORB_INITIALIZER_H
+#define TAO_BIDIR_ORB_INITIALIZER_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/BiDir_GIOP/bidirgiop_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PI/PI.h"
+#include "tao/LocalObject.h"
+
+// This is to remove "inherits via dominance" warnings from MSVC.
+// MSVC is being a little too paranoid.
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/// Messaging ORB initializer.
+class TAO_BiDir_ORBInitializer
+ : public virtual PortableInterceptor::ORBInitializer
+ , public virtual TAO_Local_RefCounted_Object
+{
+public:
+
+ virtual void pre_init (PortableInterceptor::ORBInitInfo_ptr info
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual void post_init (PortableInterceptor::ORBInitInfo_ptr info
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+private:
+
+ ///< Register BiDir policy factories.
+ void register_policy_factories (
+ PortableInterceptor::ORBInitInfo_ptr info
+ ACE_ENV_ARG_DECL);
+
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_BIDIR_ORB_INITIALIZER_H */
diff --git a/TAO/tao/BiDir_GIOP/BiDir_PolicyFactory.cpp b/TAO/tao/BiDir_GIOP/BiDir_PolicyFactory.cpp
new file mode 100644
index 00000000000..98ef7218f99
--- /dev/null
+++ b/TAO/tao/BiDir_GIOP/BiDir_PolicyFactory.cpp
@@ -0,0 +1,52 @@
+#include "tao/BiDir_GIOP/BiDir_PolicyFactory.h"
+#include "tao/BiDir_GIOP/BiDirGIOP.h"
+#include "tao/BiDir_GIOP/BiDir_Policy_i.h"
+
+#include "tao/ORB_Constants.h"
+#include "tao/AnyTypeCode/Any.h"
+
+ACE_RCSID (BiDir_GIOP,
+ BiDir_PolicyFactory,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+CORBA::Policy_ptr
+TAO_BiDir_PolicyFactory::create_policy (
+ CORBA::PolicyType type,
+ const CORBA::Any &value
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ CORBA::PolicyError))
+{
+ CORBA::Policy_ptr policy = CORBA::Policy::_nil ();
+
+ if (type == BiDirPolicy::BIDIRECTIONAL_POLICY_TYPE)
+ {
+ BiDirPolicy::BidirectionalPolicyValue val;
+
+ // Extract the value from the any.
+ value >>= val;
+ if ((value >>= val) == 0)
+ {
+ ACE_THROW_RETURN (CORBA::PolicyError (CORBA::BAD_POLICY_VALUE),
+ CORBA::Policy::_nil ());
+ }
+
+ ACE_NEW_THROW_EX (policy,
+ TAO_BidirectionalPolicy (val),
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+
+ return policy;
+ }
+
+ ACE_THROW_RETURN (CORBA::PolicyError (CORBA::BAD_POLICY_TYPE),
+ CORBA::Policy::_nil ());
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/BiDir_GIOP/BiDir_PolicyFactory.h b/TAO/tao/BiDir_GIOP/BiDir_PolicyFactory.h
new file mode 100644
index 00000000000..9a4175257b5
--- /dev/null
+++ b/TAO/tao/BiDir_GIOP/BiDir_PolicyFactory.h
@@ -0,0 +1,60 @@
+// -*- C++ -*-
+//
+// ===================================================================
+/**
+ * @file BiDir_PolicyFactory.h
+ *
+ * $Id$
+ *
+ * @author Balachandran Natarajan <bala@cs.wustl.edu>
+ */
+// ===================================================================
+#ifndef TAO_BIDIR_POLICY_FACTORY_H
+#define TAO_BIDIR_POLICY_FACTORY_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/BiDir_GIOP/bidirgiop_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+
+#include "tao/PI/PI.h"
+#include "tao/LocalObject.h"
+
+// This is to remove "inherits via dominance" warnings from MSVC.
+// MSVC is being a little too paranoid.
+#if defined(_MSC_VER)
+# pragma warning(push)
+# pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/// Policy factory for all Messaging related policies.
+class TAO_BiDir_PolicyFactory
+ : public PortableInterceptor::PolicyFactory
+ , public TAO_Local_RefCounted_Object
+{
+public:
+
+ virtual CORBA::Policy_ptr create_policy (CORBA::PolicyType type,
+ const CORBA::Any & value
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ CORBA::PolicyError));
+
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined(_MSC_VER)
+# pragma warning(pop)
+#endif /* _MSC_VER */
+
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_BIDIR_POLICY_FACTORY_H */
diff --git a/TAO/tao/BiDir_GIOP/BiDir_Policy_i.cpp b/TAO/tao/BiDir_GIOP/BiDir_Policy_i.cpp
new file mode 100644
index 00000000000..c040e779226
--- /dev/null
+++ b/TAO/tao/BiDir_GIOP/BiDir_Policy_i.cpp
@@ -0,0 +1,94 @@
+// $Id$
+
+#include "tao/BiDir_GIOP/BiDir_Policy_i.h"
+
+#include "tao/Stub.h"
+#include "tao/debug.h"
+#include "tao/ORB_Constants.h"
+
+ACE_RCSID (TAO,
+ BiDir_Policy_i,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_BidirectionalPolicy::TAO_BidirectionalPolicy (
+ const BiDirPolicy::BidirectionalPolicyValue val)
+ : ::CORBA::Object ()
+ , ::CORBA::Policy ()
+ , ::BiDirPolicy::BidirectionalPolicy ()
+ , ::CORBA::LocalObject ()
+ , TAO_Local_RefCounted_Object ()
+ , value_ (val)
+{
+}
+
+TAO_BidirectionalPolicy::TAO_BidirectionalPolicy (const TAO_BidirectionalPolicy &rhs)
+ : ::CORBA::Object ()
+ , ::CORBA::Policy ()
+ , ::BiDirPolicy::BidirectionalPolicy ()
+ , ::CORBA::LocalObject ()
+ , TAO_Local_RefCounted_Object ()
+ , value_ (rhs.value_)
+{
+}
+
+CORBA::PolicyType
+TAO_BidirectionalPolicy::policy_type (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ // Future policy implementors: notice how this minimizes the
+ // footprint of the class.
+ return BiDirPolicy::BIDIRECTIONAL_POLICY_TYPE;
+}
+
+
+TAO_BidirectionalPolicy *
+TAO_BidirectionalPolicy::clone (void) const
+{
+ TAO_BidirectionalPolicy *copy = 0;
+ ACE_NEW_RETURN (copy,
+ TAO_BidirectionalPolicy (*this),
+ 0);
+ return copy;
+}
+
+CORBA::Policy_ptr
+TAO_BidirectionalPolicy::copy (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ // Future policy implementors: notice how the following code is
+ // exception safe!
+
+ TAO_BidirectionalPolicy* tmp;
+ ACE_NEW_THROW_EX (tmp, TAO_BidirectionalPolicy (*this),
+ CORBA::NO_MEMORY (TAO::VMCID,
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+
+ return tmp;
+}
+
+void
+TAO_BidirectionalPolicy::destroy (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+}
+
+BiDirPolicy::BidirectionalPolicyValue
+TAO_BidirectionalPolicy::value (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException))
+{
+ return this->value_;
+}
+
+
+TAO_Cached_Policy_Type
+TAO_BidirectionalPolicy::_tao_cached_type (void) const
+{
+ return TAO_CACHED_POLICY_BIDIRECTIONAL_GIOP;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/BiDir_GIOP/BiDir_Policy_i.h b/TAO/tao/BiDir_GIOP/BiDir_Policy_i.h
new file mode 100644
index 00000000000..93ef62f6c19
--- /dev/null
+++ b/TAO/tao/BiDir_GIOP/BiDir_Policy_i.h
@@ -0,0 +1,89 @@
+// -*- C++ -*-
+
+// ===================================================================
+/**
+ * @file BiDir_Policy_i.h
+ *
+ * $Id$
+ *
+ * @author Balachandran Natarajan <bala@cs.wustl.edu>
+ */
+// ===================================================================
+
+#ifndef TAO_BIDIR_POLICY_I_H
+#define TAO_BIDIR_POLICY_I_H
+#include /**/ "ace/pre.h"
+#include "tao/BiDir_GIOP/bidirgiop_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/BiDir_GIOP/BiDirGIOP.h"
+#include "tao/LocalObject.h"
+
+#if defined(_MSC_VER)
+# pragma warning(push)
+# pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_BidirectionalPolicy
+ *
+ * @brief Implementation of the BiDirPolicy::BidirectionalPolicy
+ *
+ * This policy controls the whether the connections established by the
+ * clients can be made bi-directional or not. Further, this policy
+ * also needs to be set by the server to use the connections
+ * established by the clients to send requests.
+ */
+class TAO_BidirectionalPolicy
+ : public virtual BiDirPolicy::BidirectionalPolicy
+ , public virtual TAO_Local_RefCounted_Object
+{
+public:
+
+ /// Constructor.
+ TAO_BidirectionalPolicy (const BiDirPolicy::BidirectionalPolicyValue val);
+
+ /// Copy constructor.
+ TAO_BidirectionalPolicy (const TAO_BidirectionalPolicy &rhs);
+
+ /// Returns a copy of <this>.
+ virtual TAO_BidirectionalPolicy *clone (void) const;
+
+ /// = The BiDir::BidirectionalPolicy methods
+ virtual BiDirPolicy::BidirectionalPolicyValue value (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ virtual CORBA::PolicyType policy_type (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual CORBA::Policy_ptr copy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual void destroy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual TAO_Cached_Policy_Type _tao_cached_type (void) const;
+
+private:
+
+ /// The attribute
+ BiDirPolicy::BidirectionalPolicyValue value_;
+
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined(_MSC_VER)
+# pragma warning(pop)
+#endif /* _MSC_VER */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_BIDIR_POLICY_I_H */
diff --git a/TAO/tao/BiDir_GIOP/TAO_BiDirGIOP.pc.in b/TAO/tao/BiDir_GIOP/TAO_BiDirGIOP.pc.in
new file mode 100644
index 00000000000..b2f5df3a839
--- /dev/null
+++ b/TAO/tao/BiDir_GIOP/TAO_BiDirGIOP.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: TAO_BiDirGIOP
+Description: TAO Bidirection GIOP Library
+Requires: TAO_PI, TAO_CodecFactory, TAO_AnyTypeCode, TAO
+Version: @VERSION@
+Libs: -L${libdir} -lTAO_BiDirGIOP
+Cflags: -I${includedir}
diff --git a/TAO/tao/BiDir_GIOP/TAO_BiDir_GIOP.rc b/TAO/tao/BiDir_GIOP/TAO_BiDir_GIOP.rc
new file mode 100644
index 00000000000..13c255b63ad
--- /dev/null
+++ b/TAO/tao/BiDir_GIOP/TAO_BiDir_GIOP.rc
@@ -0,0 +1,30 @@
+#include "..\Version.h"
+
+1 VERSIONINFO
+ FILEVERSION TAO_MAJOR_VERSION,TAO_MINOR_VERSION,TAO_BETA_VERSION,0
+ PRODUCTVERSION TAO_MAJOR_VERSION,TAO_MINOR_VERSION,TAO_BETA_VERSION,0
+ FILEFLAGSMASK 0x3fL
+ FILEFLAGS 0x0L
+ FILEOS 0x4L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904B0"
+ BEGIN
+ VALUE "FileDescription", "BiDir_GIOP\0"
+ VALUE "FileVersion", TAO_VERSION "\0"
+ VALUE "InternalName", "TAO_BiDirGIOPDLL\0"
+ VALUE "LegalCopyright", "\0"
+ VALUE "LegalTrademarks", "\0"
+ VALUE "OriginalFilename", "TAO_BiDirGIOP.DLL\0"
+ VALUE "ProductName", "TAO\0"
+ VALUE "ProductVersion", TAO_VERSION "\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
diff --git a/TAO/tao/BiDir_GIOP/bidirgiop_export.h b/TAO/tao/BiDir_GIOP/bidirgiop_export.h
new file mode 100644
index 00000000000..664fba705b7
--- /dev/null
+++ b/TAO/tao/BiDir_GIOP/bidirgiop_export.h
@@ -0,0 +1,40 @@
+
+// -*- C++ -*-
+// $Id$
+// Definition for Win32 Export directives.
+// This file is generated automatically by generate_export_file.pl
+// ------------------------------
+#ifndef TAO_BIDIRGIOP_EXPORT_H
+#define TAO_BIDIRGIOP_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if defined (TAO_AS_STATIC_LIBS)
+# if !defined (TAO_BIDIRGIOP_HAS_DLL)
+# define TAO_BIDIRGIOP_HAS_DLL 0
+# endif /* ! TAO_BIDIRGIOP_HAS_DLL */
+#else
+# if !defined (TAO_BIDIRGIOP_HAS_DLL)
+# define TAO_BIDIRGIOP_HAS_DLL 1
+# endif /* ! TAO_BIDIRGIOP_HAS_DLL */
+#endif
+
+#if defined (TAO_BIDIRGIOP_HAS_DLL) && (TAO_BIDIRGIOP_HAS_DLL == 1)
+# if defined (TAO_BIDIRGIOP_BUILD_DLL)
+# define TAO_BiDirGIOP_Export ACE_Proper_Export_Flag
+# define TAO_BIDIRGIOP_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# define TAO_BIDIRGIOP_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# else /* TAO_BIDIRGIOP_BUILD_DLL */
+# define TAO_BiDirGIOP_Export ACE_Proper_Import_Flag
+# define TAO_BIDIRGIOP_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# define TAO_BIDIRGIOP_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# endif /* TAO_BIDIRGIOP_BUILD_DLL */
+#else /* TAO_BIDIRGIOP_HAS_DLL == 1 */
+# define TAO_BiDirGIOP_Export
+# define TAO_BIDIRGIOP_SINGLETON_DECLARATION(T)
+# define TAO_BIDIRGIOP_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+#endif /* TAO_BIDIRGIOP_HAS_DLL == 1 */
+
+#endif /* TAO_BIDIRGIOP_EXPORT_H */
+
+// End of auto generated file.
diff --git a/TAO/tao/Bind_Dispatcher_Guard.cpp b/TAO/tao/Bind_Dispatcher_Guard.cpp
new file mode 100644
index 00000000000..624d5344f22
--- /dev/null
+++ b/TAO/tao/Bind_Dispatcher_Guard.cpp
@@ -0,0 +1,42 @@
+// This may look like C, but it's really -*- C++ -*-
+// $Id$
+
+#include "tao/Bind_Dispatcher_Guard.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/Bind_Dispatcher_Guard.i"
+#endif /* ! __ACE_INLINE__ */
+
+ACE_RCSID (tao,
+ Bind_Dispatcher_Guard,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Bind_Dispatcher_Guard::TAO_Bind_Dispatcher_Guard (
+ CORBA::ULong request_id,
+ TAO_Reply_Dispatcher* rd,
+ TAO_Transport_Mux_Strategy* tms)
+ : status_(TAO_Bind_Dispatcher_Guard::UNBIND),
+ request_id_(request_id),
+ rd_(rd),
+ tms_(tms)
+{
+ int const retval =
+ this->tms_->bind_dispatcher (this->request_id_,
+ this->rd_);
+
+ if (retval == -1 )
+ this->status_ =
+ TAO_Bind_Dispatcher_Guard::NO_UNBIND;
+}
+
+TAO_Bind_Dispatcher_Guard::~TAO_Bind_Dispatcher_Guard (void)
+{
+ // We try unbinding. If it works it works, else cant do much about
+ // it..
+ if (this->status_ == TAO_Bind_Dispatcher_Guard::UNBIND)
+ (void) this->tms_->unbind_dispatcher (this->request_id_);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Bind_Dispatcher_Guard.h b/TAO/tao/Bind_Dispatcher_Guard.h
new file mode 100644
index 00000000000..ae86b126b92
--- /dev/null
+++ b/TAO/tao/Bind_Dispatcher_Guard.h
@@ -0,0 +1,68 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Bind_Dispatcher_Guard.h
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan <coryan@uci.edu>
+ * @author Chad Elliott <elliott_c@ociweb.com>
+ */
+//=============================================================================
+
+#ifndef TAO_BIND_DISPATCHER_GUARD_H
+#define TAO_BIND_DISPATCHER_GUARD_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Basic_Types.h"
+#include "tao/TAO_Export.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Reply_Dispatcher;
+class TAO_Transport_Mux_Strategy;
+
+class TAO_Export TAO_Bind_Dispatcher_Guard
+{
+public:
+ TAO_Bind_Dispatcher_Guard (CORBA::ULong request_id,
+ TAO_Reply_Dispatcher* rd,
+ TAO_Transport_Mux_Strategy* tms);
+
+ ~TAO_Bind_Dispatcher_Guard (void);
+
+ /// Returns 0 if succesful and non-zero otherwise.
+ int unbind_dispatcher (void);
+
+ /// State information
+ enum
+ {
+ /// Unbind the dispatcher
+ UNBIND = 0,
+ /// Do not unbind dispatcher
+ NO_UNBIND
+ };
+
+ /// Get status
+ int status (void) const;
+
+ /// Set status
+ void status (int status);
+
+private:
+ int status_;
+ CORBA::ULong request_id_;
+ TAO_Reply_Dispatcher* rd_;
+ TAO_Transport_Mux_Strategy* tms_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/Bind_Dispatcher_Guard.i"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+#endif
diff --git a/TAO/tao/Bind_Dispatcher_Guard.i b/TAO/tao/Bind_Dispatcher_Guard.i
new file mode 100644
index 00000000000..c4a3477f7ee
--- /dev/null
+++ b/TAO/tao/Bind_Dispatcher_Guard.i
@@ -0,0 +1,46 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// ===========================================================================
+//
+// = LIBRARY
+// TAO
+//
+// = AUTHOR
+// Carlos O'Ryan <coryan@uci.edu>,
+// Chad Elliott <elliott_c@ociweb.com>
+//
+// ===========================================================================
+
+#include "tao/Reply_Dispatcher.h"
+#include "tao/Transport_Mux_Strategy.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE void
+TAO_Bind_Dispatcher_Guard::status (int s)
+{
+ this->status_ = s;
+}
+
+ACE_INLINE int
+TAO_Bind_Dispatcher_Guard::status (void) const
+{
+ return this->status_;
+}
+
+ACE_INLINE int
+TAO_Bind_Dispatcher_Guard::unbind_dispatcher (void)
+{
+ int const retval =
+ this->tms_->unbind_dispatcher (this->request_id_);
+
+ // Already unbound and so do not try again during destruction.
+ this->status_ =
+ TAO_Bind_Dispatcher_Guard::NO_UNBIND;
+
+ return retval;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Block_Flushing_Strategy.cpp b/TAO/tao/Block_Flushing_Strategy.cpp
new file mode 100644
index 00000000000..8e0282ecfdd
--- /dev/null
+++ b/TAO/tao/Block_Flushing_Strategy.cpp
@@ -0,0 +1,52 @@
+// $Id$
+
+#include "tao/Block_Flushing_Strategy.h"
+#include "tao/Transport.h"
+#include "tao/Queued_Message.h"
+
+ACE_RCSID(tao, Block_Flushing_Strategy, "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+int
+TAO_Block_Flushing_Strategy::schedule_output (TAO_Transport *transport)
+{
+ while (!transport->queue_is_empty_i ())
+ {
+ if (transport->drain_queue_i () == -1)
+ return -1;
+ }
+ return 0;
+}
+
+int
+TAO_Block_Flushing_Strategy::cancel_output (TAO_Transport *)
+{
+ return 0;
+}
+
+int
+TAO_Block_Flushing_Strategy::flush_message (TAO_Transport *transport,
+ TAO_Queued_Message *msg,
+ ACE_Time_Value *)
+{
+ while (!msg->all_data_sent ())
+ {
+ if (transport->handle_output () == -1)
+ return -1;
+ }
+ return 0;
+}
+
+int
+TAO_Block_Flushing_Strategy::flush_transport (TAO_Transport *transport)
+{
+ while (!transport->queue_is_empty ())
+ {
+ if (transport->handle_output () == -1)
+ return -1;
+ }
+ return 0;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Block_Flushing_Strategy.h b/TAO/tao/Block_Flushing_Strategy.h
new file mode 100644
index 00000000000..835b97755e7
--- /dev/null
+++ b/TAO/tao/Block_Flushing_Strategy.h
@@ -0,0 +1,44 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Block_Flushing_Strategy.h
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan <coryan@uci.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_BLOCK_FLUSHING_STRATEGY_H
+#define TAO_BLOCK_FLUSHING_STRATEGY_H
+#include /**/ "ace/pre.h"
+
+#include "tao/Flushing_Strategy.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_Block_Flushing_Strategy
+ *
+ * @brief Implement a flushing strategy that blocks on write to flush
+ */
+class TAO_Block_Flushing_Strategy : public TAO_Flushing_Strategy
+{
+public:
+ virtual int schedule_output (TAO_Transport *transport);
+ virtual int cancel_output (TAO_Transport *transport);
+ virtual int flush_message (TAO_Transport *transport,
+ TAO_Queued_Message *msg,
+ ACE_Time_Value *max_wait_time);
+ virtual int flush_transport (TAO_Transport *transport);
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_BLOCK_FLUSHING_STRATEGY_H */
diff --git a/TAO/tao/Blocked_Connect_Strategy.cpp b/TAO/tao/Blocked_Connect_Strategy.cpp
new file mode 100644
index 00000000000..6cd123fcf49
--- /dev/null
+++ b/TAO/tao/Blocked_Connect_Strategy.cpp
@@ -0,0 +1,45 @@
+#include "tao/Blocked_Connect_Strategy.h"
+#include "tao/Connection_Handler.h"
+
+#include "ace/Synch_Options.h"
+
+ACE_RCSID(tao,
+ Blocked_Connect_Strategy,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Blocked_Connect_Strategy::TAO_Blocked_Connect_Strategy (
+ TAO_ORB_Core *orb_core)
+ : TAO_Connect_Strategy (orb_core)
+{
+}
+
+void
+TAO_Blocked_Connect_Strategy::synch_options (ACE_Time_Value *timeout,
+ ACE_Synch_Options &options)
+{
+ if (timeout != 0)
+ {
+ // Blocking with a timeout
+ options.set (ACE_Synch_Options::USE_TIMEOUT,
+ *timeout);
+ }
+ else
+ {
+ // Making it sure it is blocking.
+ options.set (0,
+ ACE_Time_Value::zero);
+ }
+}
+
+int
+TAO_Blocked_Connect_Strategy::wait_i (TAO_LF_Event *,
+ TAO_Transport *,
+ ACE_Time_Value * )
+{
+ // We cannot wait for connection completion
+ return -1;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Blocked_Connect_Strategy.h b/TAO/tao/Blocked_Connect_Strategy.h
new file mode 100644
index 00000000000..9e140e316ec
--- /dev/null
+++ b/TAO/tao/Blocked_Connect_Strategy.h
@@ -0,0 +1,55 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Blocked_Connect_Strategy.h
+ *
+ * $Id$
+ *
+ * @author Balachandran Natarajan <bala@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_BLOCKED_CONNECT_STRATEGY_H
+#define TAO_BLOCKED_CONNECT_STRATEGY_H
+#include /**/ "ace/pre.h"
+
+#include "tao/Connect_Strategy.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_Blocked_Connect_Strategy
+ *
+ * @brief Concrete implementation of a connect strategy that blocks
+ * during connects
+ *
+ */
+class TAO_Export TAO_Blocked_Connect_Strategy : public TAO_Connect_Strategy
+{
+public:
+ /// Constructor
+ TAO_Blocked_Connect_Strategy (TAO_ORB_Core *orb);
+
+ /*
+ * Concrete implementation for this class. Please see
+ * Connect_Strategy.h for details
+ */
+ virtual void synch_options (ACE_Time_Value *val,
+ ACE_Synch_Options &opt);
+
+protected:
+ virtual int wait_i (TAO_LF_Event *ev,
+ TAO_Transport *t,
+ ACE_Time_Value *val);
+
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /*TAO_BLOCKED_CONNECT_STRATEGY_H*/
diff --git a/TAO/tao/BooleanSeq.pidl b/TAO/tao/BooleanSeq.pidl
new file mode 100644
index 00000000000..34ad2ac2aa9
--- /dev/null
+++ b/TAO/tao/BooleanSeq.pidl
@@ -0,0 +1,31 @@
+// -*- IDL -*-
+//
+// $Id$
+
+/**
+ * This file was used to generate the code in BooleanSeqC.*
+ * The command used to generate code is:
+ *
+ * tao_idl
+ * -oA AnyTypeCode
+ * -Ge 1 -GA -SS -Sci
+ * -Wb,pre_include=ace/pre.h
+ * -Wb,post_include=ace/post.h
+ * -Wb,export_macro=TAO_Export
+ * -Wb,export_include=tao/TAO_Export.h
+ * -Wb,anyop_export_macro=TAO_AnyTypeCode_Export
+ * -Wb,anyop_export_include=tao/AnyTypeCode/TAO_AnyTypeCode_Export.h
+ * BooleanSeq.pidl
+ */
+
+#ifndef TAO_CORBA_BOOLEAN_SEQ_IDL
+#define TAO_CORBA_BOOLEAN_SEQ_IDL
+
+#pragma prefix "omg.org"
+
+module CORBA
+{
+ typedef sequence<boolean> BooleanSeq;
+};
+
+#endif /* TAO_CORBA_BOOLEAN_SEQ_IDL */
diff --git a/TAO/tao/Bounded_Array_Allocation_Traits_T.h b/TAO/tao/Bounded_Array_Allocation_Traits_T.h
new file mode 100644
index 00000000000..af6849f407c
--- /dev/null
+++ b/TAO/tao/Bounded_Array_Allocation_Traits_T.h
@@ -0,0 +1,55 @@
+#ifndef guard_bounded_array_allocation_traits_hpp
+#define guard_bounded_array_allocation_traits_hpp
+/**
+ * @file
+ *
+ * @brief Details can be found in the documentation for
+ * TAO::details::generic_sequence
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan
+ */
+
+#include "tao/Basic_Types.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+namespace details
+{
+
+template<typename T, CORBA::ULong MAX, bool dummy>
+struct bounded_array_allocation_traits
+{
+ typedef T value_type;
+
+ inline static CORBA::ULong default_maximum()
+ {
+ return MAX;
+ }
+
+ inline static value_type * default_buffer_allocation()
+ {
+ return allocbuf(MAX);
+ }
+
+ inline static value_type * allocbuf(CORBA::ULong /* maximum */)
+ {
+ return new value_type[MAX];
+ }
+
+ inline static void freebuf(value_type * buffer)
+ {
+ delete[] buffer;
+ }
+};
+
+} // namespace details
+} // namespace TAO
+
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif // guard_unbounded_array_allocation_traits_hpp
diff --git a/TAO/tao/Bounded_Array_Sequence_T.h b/TAO/tao/Bounded_Array_Sequence_T.h
new file mode 100644
index 00000000000..88020bc725a
--- /dev/null
+++ b/TAO/tao/Bounded_Array_Sequence_T.h
@@ -0,0 +1,149 @@
+#ifndef guard_bounded_array_sequence_hpp
+#define guard_bounded_array_sequence_hpp
+/**
+ * @file
+ *
+ * @brief Implement unbounded sequences for arrays.
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan
+ */
+#include "tao/Bounded_Array_Allocation_Traits_T.h"
+#include "tao/Generic_Sequence_T.h"
+#include "tao/Array_Traits_T.h"
+#include "tao/SystemException.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+
+template<typename T_array, typename T_slice, typename T_tag, CORBA::ULong MAX>
+class bounded_array_sequence
+{
+public:
+ typedef T_array * element_type;
+ typedef T_array value_type;
+ typedef T_array * T_slice_ptr;
+ typedef T_slice_ptr * const_value_type;
+ typedef value_type & subscript_type;
+ typedef value_type const & const_subscript_type;
+
+ typedef details::bounded_array_allocation_traits<value_type,MAX,true> allocation_traits;
+ typedef TAO_Array_Forany_T<T_array, T_slice, T_tag> forany;
+ typedef details::array_traits <forany> element_traits;
+ typedef details::generic_sequence<value_type, allocation_traits, element_traits> implementation_type;
+
+ inline bounded_array_sequence()
+ : impl_()
+ {}
+ inline bounded_array_sequence(
+ CORBA::ULong length,
+ value_type * data,
+ CORBA::Boolean release = false)
+ : impl_(MAX, length, data, release)
+ {}
+ inline CORBA::ULong maximum() const {
+ return impl_.maximum();
+ }
+ inline CORBA::Boolean release() const {
+ return impl_.release();
+ }
+ inline CORBA::ULong length() const {
+ return impl_.length();
+ }
+ inline void length(CORBA::ULong length) {
+ impl_.length(length);
+ }
+ inline value_type const & operator[](CORBA::ULong i) const {
+ return impl_[i];
+ }
+ inline value_type & operator[](CORBA::ULong i) {
+ return impl_[i];
+ }
+ inline void replace(
+ CORBA::ULong length,
+ value_type * data,
+ CORBA::Boolean release = false) {
+ impl_.replace(MAX, length, data, release);
+ }
+ inline value_type const * get_buffer() const {
+ return impl_.get_buffer();
+ }
+ inline value_type * get_buffer(CORBA::Boolean orphan = false) {
+ return impl_.get_buffer(orphan);
+ }
+ inline void swap(bounded_array_sequence & rhs) throw() {
+ impl_.swap(rhs.impl_);
+ }
+ static value_type * allocbuf(CORBA::ULong maximum) {
+ return implementation_type::allocbuf(maximum);
+ }
+ static void freebuf(value_type * buffer) {
+ implementation_type::freebuf(buffer);
+ }
+
+private:
+ implementation_type impl_;
+};
+}
+
+namespace TAO
+{
+ template <typename stream, typename T_array, typename T_slice, typename T_tag, CORBA::ULong MAX>
+ bool demarshal_sequence(stream & strm, TAO::bounded_array_sequence<T_array, T_slice, T_tag, MAX> & target) {
+ typedef typename TAO::bounded_array_sequence<T_array, T_slice, T_tag, MAX> sequence;
+ typedef TAO_Array_Forany_T<T_array, T_slice, T_tag> forany;
+ typedef TAO::Array_Traits<forany> array_traits;
+
+ ::CORBA::ULong new_length = 0;
+ if (!(strm >> new_length)) {
+ return false;
+ }
+ if ((new_length > strm.length()) || (new_length > target.maximum ())) {
+ return false;
+ }
+ sequence tmp;
+ tmp.length(new_length);
+ typename sequence::value_type * buffer = tmp.get_buffer();
+ for(CORBA::ULong i = 0; i < new_length; ++i) {
+ forany tmp (array_traits::alloc ());
+ bool const _tao_marshal_flag = (strm >> tmp);
+ if (_tao_marshal_flag) {
+ array_traits::copy (buffer[i], tmp.in ());
+ }
+ array_traits::free (tmp.inout ());
+ if (!_tao_marshal_flag) {
+ return false;
+ }
+ }
+ tmp.swap(target);
+ return true;
+ }
+
+ template <typename stream, typename T_array, typename T_slice, typename T_tag, CORBA::ULong MAX>
+ bool marshal_sequence(stream & strm, const TAO::bounded_array_sequence<T_array, T_slice, T_tag, MAX> & source) {
+ if (0 == &source)
+ ACE_THROW_RETURN (::CORBA::BAD_PARAM(0, CORBA::COMPLETED_MAYBE), false);
+ typedef TAO_Array_Forany_T<T_array, T_slice, T_tag> forany;
+ typedef TAO_FixedArray_Var_T <T_array, T_slice, T_tag> fixed_array;
+ typedef TAO::Array_Traits<forany> array_traits;
+ ::CORBA::ULong const length = source.length ();
+ if (!(strm << length)) {
+ return false;
+ }
+ for(CORBA::ULong i = 0; i < length; ++i) {
+ fixed_array tmp_array = array_traits::dup (source[i]);
+ forany tmp (tmp_array.inout ());
+ if (!(strm << tmp)) {
+ return false;
+ }
+ }
+ return true;
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif // guard_bounded_array_sequence_hpp
diff --git a/TAO/tao/Bounded_Basic_String_Sequence_T.h b/TAO/tao/Bounded_Basic_String_Sequence_T.h
new file mode 100644
index 00000000000..da573662bc7
--- /dev/null
+++ b/TAO/tao/Bounded_Basic_String_Sequence_T.h
@@ -0,0 +1,118 @@
+#ifndef guard_bounded_basic_string_sequence_hpp
+#define guard_bounded_basic_string_sequence_hpp
+/**
+ * @file
+ *
+ * @brief Implement bounded sequences for strings and wide-strings.
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan
+ */
+#include "tao/Bounded_Reference_Allocation_Traits_T.h"
+#include "tao/String_Traits_T.h"
+#include "tao/Generic_Sequence_T.h"
+#include "tao/String_Sequence_Element_T.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+namespace details
+{
+
+template<typename charT, CORBA::ULong MAX>
+class bounded_basic_string_sequence
+{
+public:
+ typedef charT character_type;
+ typedef charT * value_type;
+ typedef charT const * const_value_type;
+
+ typedef details::string_traits<charT,true> element_traits;
+ typedef details::bounded_reference_allocation_traits<value_type,element_traits,MAX,true> allocation_traits;
+
+ typedef details::string_sequence_element<element_traits> element_type;
+ typedef element_type subscript_type;
+ typedef const_value_type const_subscript_type;
+
+ typedef details::generic_sequence<value_type, allocation_traits, element_traits> implementation_type;
+
+ /// @copydoc generic_sequence::generic_sequence
+ inline bounded_basic_string_sequence()
+ : impl_()
+ {}
+ /// @copydoc generic_sequence::generic_sequence
+ inline bounded_basic_string_sequence(
+ CORBA::ULong length,
+ value_type * data,
+ CORBA::Boolean release)
+ : impl_(MAX, length, data, release)
+ {}
+ /// @copydoc generic_sequence::maximum
+ inline CORBA::ULong maximum() const {
+ return impl_.maximum();
+ }
+ /// @copydoc generic_sequence::release
+ inline CORBA::Boolean release() const {
+ return impl_.release();
+ }
+ /// @copydoc generic_sequence::length
+ inline CORBA::ULong length() const {
+ return impl_.length();
+ }
+
+ /// @copydoc generic_sequence::length
+ inline void length(CORBA::ULong length) {
+ implementation_type::range::check_length(length, MAX);
+ impl_.length(length);
+ }
+ /// @copydoc generic_sequence::operator[]
+ inline const_value_type operator[](CORBA::ULong i) const {
+ return impl_[i];
+ }
+ /// @copydoc generic_sequence::operator[]
+ inline element_type operator[](CORBA::ULong i) {
+ return element_type(impl_[i], release());
+ }
+ /// @copydoc generic_sequence::get_buffer
+ inline const_value_type const * get_buffer() const {
+ return impl_.get_buffer();
+ }
+ /// @copydoc generic_sequence::replace
+ inline void replace(
+ CORBA::ULong length,
+ value_type * data,
+ CORBA::Boolean release = false) {
+ impl_.replace(MAX, length, data, release);
+ }
+ /// @copydoc generic_sequence::get_buffer(CORBA::Boolean)
+ inline value_type * get_buffer(CORBA::Boolean orphan = false) {
+ return impl_.get_buffer(orphan);
+ }
+ inline void swap(bounded_basic_string_sequence & rhs) throw() {
+ impl_.swap(rhs.impl_);
+ }
+
+ static value_type * allocbuf(CORBA::ULong maximum)
+ {
+ return implementation_type::allocbuf(maximum);
+ }
+ static value_type * allocbuf() {
+ return implementation_type::allocbuf(MAX);
+ }
+ static void freebuf(value_type * buffer)
+ {
+ implementation_type::freebuf(buffer);
+ }
+
+private:
+ implementation_type impl_;
+};
+
+} // namespace details
+} // namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif // guard_bounded_basic_string_sequence_hpp
diff --git a/TAO/tao/Bounded_Object_Reference_Sequence_T.h b/TAO/tao/Bounded_Object_Reference_Sequence_T.h
new file mode 100644
index 00000000000..9754820576c
--- /dev/null
+++ b/TAO/tao/Bounded_Object_Reference_Sequence_T.h
@@ -0,0 +1,105 @@
+#ifndef guard_bounded_object_reference_sequence_hpp
+#define guard_bounded_object_reference_sequence_hpp
+/**
+ * @file
+ *
+ * @brief Implement bounded sequences for object references.
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan
+ */
+#include "Bounded_Reference_Allocation_Traits_T.h"
+#include "Object_Reference_Traits_T.h"
+#include "Generic_Sequence_T.h"
+#include "Object_Reference_Sequence_Element_T.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+
+template<typename object_t, typename object_t_var, CORBA::ULong MAX>
+class bounded_object_reference_sequence
+{
+public:
+ typedef object_t object_type;
+ typedef object_type * value_type;
+ typedef value_type const const_value_type;
+ typedef object_t_var object_type_var;
+
+ typedef details::object_reference_traits<object_type,object_type_var,true> element_traits;
+ typedef details::bounded_reference_allocation_traits<value_type,element_traits,MAX,true> allocation_traits;
+
+ typedef details::object_reference_sequence_element<element_traits> element_type;
+ typedef element_type subscript_type;
+ typedef value_type const & const_subscript_type;
+
+ typedef details::generic_sequence<value_type, allocation_traits, element_traits> implementation_type;
+
+ inline bounded_object_reference_sequence()
+ : impl_()
+ {}
+ inline bounded_object_reference_sequence(
+ CORBA::ULong length,
+ value_type * data,
+ CORBA::Boolean release)
+ : impl_(MAX, length, data, release)
+ {}
+
+ /* Use default ctor, operator= and dtor */
+ inline CORBA::ULong maximum() const {
+ return impl_.maximum();
+ }
+ inline CORBA::Boolean release() const {
+ return impl_.release();
+ }
+ inline CORBA::ULong length() const {
+ return impl_.length();
+ }
+
+ inline void length(CORBA::ULong length) {
+ implementation_type::range::check_length(length, MAX);
+ impl_.length(length);
+ }
+ inline value_type const & operator[](CORBA::ULong i) const {
+ return impl_[i];
+ }
+ inline element_type operator[](CORBA::ULong i) {
+ return element_type(impl_[i], release());
+ }
+ inline value_type const * get_buffer() const {
+ return impl_.get_buffer();
+ }
+ inline void replace(
+ CORBA::ULong length,
+ value_type * data,
+ CORBA::Boolean release = false) {
+ impl_.replace(MAX, length, data, release);
+ }
+ inline value_type * get_buffer(CORBA::Boolean orphan = false) {
+ return impl_.get_buffer(orphan);
+ }
+ inline void swap(bounded_object_reference_sequence & rhs) throw() {
+ impl_.swap(rhs.impl_);
+ }
+
+ static value_type * allocbuf(CORBA::ULong maximum)
+ {
+ return implementation_type::allocbuf(maximum);
+ }
+ static void freebuf(value_type * buffer)
+ {
+ implementation_type::freebuf(buffer);
+ }
+
+
+private:
+ implementation_type impl_;
+};
+
+} // namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif // guard_bounded_object_reference_sequence_hpp
diff --git a/TAO/tao/Bounded_Reference_Allocation_Traits_T.h b/TAO/tao/Bounded_Reference_Allocation_Traits_T.h
new file mode 100644
index 00000000000..b5ff17fca98
--- /dev/null
+++ b/TAO/tao/Bounded_Reference_Allocation_Traits_T.h
@@ -0,0 +1,65 @@
+#ifndef guard_bounded_reference_allocation_traits_hpp
+#define guard_bounded_reference_allocation_traits_hpp
+/**
+ * @file
+ *
+ * @brief Details can be found in the documentation for
+ * TAO::details::generic_sequence
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan
+ */
+
+#include "tao/Basic_Types.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+namespace details
+{
+
+template<typename T, class ref_traits, CORBA::ULong MAX, bool dummy>
+struct bounded_reference_allocation_traits
+{
+ typedef T value_type;
+ typedef ref_traits reference_traits;
+
+ inline static CORBA::ULong default_maximum()
+ {
+ return MAX;
+ }
+
+ inline static value_type * default_buffer_allocation()
+ {
+ return allocbuf(MAX);
+ }
+
+ inline static value_type * allocbuf(CORBA::ULong /* maximum */)
+ {
+ value_type * buffer = new value_type[MAX];
+ // no throw
+ reference_traits::zero_range(buffer, buffer + MAX);
+
+ return buffer;
+ }
+
+ inline static void freebuf(value_type * buffer)
+ {
+ reference_traits::release_range(buffer, buffer + MAX);
+ delete[] buffer;
+ }
+
+ inline static CORBA::ULong maximum()
+ {
+ return MAX;
+ }
+};
+
+} // namespace details
+} // namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif // guard_bounded_reference_allocation_traits_hpp
diff --git a/TAO/tao/Bounded_Sequence_CDR_T.h b/TAO/tao/Bounded_Sequence_CDR_T.h
new file mode 100644
index 00000000000..58b4844bda1
--- /dev/null
+++ b/TAO/tao/Bounded_Sequence_CDR_T.h
@@ -0,0 +1,520 @@
+#ifndef guard_bounded_sequence_cdr
+#define guard_bounded_sequence_cdr
+/**
+ * @file
+ *
+ * @brief Extract the sequence
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan
+ * @author Johnny Willemsen
+ */
+
+#include "tao/orbconf.h"
+#include "tao/SystemException.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO {
+ template <typename stream, CORBA::ULong MAX>
+ bool demarshal_sequence(stream & strm, TAO::bounded_value_sequence <CORBA::Short, MAX> & target) {
+ typedef TAO::bounded_value_sequence <CORBA::Short, MAX> sequence;
+ ::CORBA::ULong new_length = 0;
+ if (!(strm >> new_length)) {
+ return false;
+ }
+ if ((new_length > strm.length()) || (new_length > target.maximum ())) {
+ return false;
+ }
+ sequence tmp;
+ tmp.length(new_length);
+ typename sequence::value_type * buffer = tmp.get_buffer();
+ if (!strm.read_short_array (buffer, new_length)) {
+ return false;
+ }
+ tmp.swap(target);
+ return true;
+ }
+
+ template <typename stream, CORBA::ULong MAX>
+ bool demarshal_sequence(stream & strm, TAO::bounded_value_sequence <CORBA::Long, MAX> & target) {
+ typedef TAO::bounded_value_sequence <CORBA::Long, MAX> sequence;
+ ::CORBA::ULong new_length = 0;
+ if (!(strm >> new_length)) {
+ return false;
+ }
+ if ((new_length > strm.length()) || (new_length > target.maximum ())) {
+ return false;
+ }
+ sequence tmp;
+ tmp.length(new_length);
+ typename sequence::value_type * buffer = tmp.get_buffer();
+ if (!strm.read_long_array (buffer, new_length)) {
+ return false;
+ }
+ tmp.swap(target);
+ return true;
+ }
+
+ template <typename stream, CORBA::ULong MAX>
+ bool demarshal_sequence(stream & strm, TAO::bounded_value_sequence <CORBA::ULong, MAX> & target) {
+ typedef TAO::bounded_value_sequence <CORBA::ULong, MAX> sequence;
+ ::CORBA::ULong new_length = 0;
+ if (!(strm >> new_length)) {
+ return false;
+ }
+ if ((new_length > strm.length()) || (new_length > target.maximum ())) {
+ return false;
+ }
+ sequence tmp;
+ tmp.length(new_length);
+ typename sequence::value_type * buffer = tmp.get_buffer();
+ if (!strm.read_ulong_array (buffer, new_length)) {
+ return false;
+ }
+ tmp.swap(target);
+ return true;
+ }
+
+ template <typename stream, CORBA::ULong MAX>
+ bool demarshal_sequence(stream & strm, TAO::bounded_value_sequence <CORBA::UShort, MAX> & target) {
+ typedef TAO::bounded_value_sequence <CORBA::UShort, MAX> sequence;
+ ::CORBA::ULong new_length = 0;
+ if (!(strm >> new_length)) {
+ return false;
+ }
+ if ((new_length > strm.length()) || (new_length > target.maximum ())) {
+ return false;
+ }
+ sequence tmp;
+ tmp.length(new_length);
+ typename sequence::value_type * buffer = tmp.get_buffer();
+ if (!strm.read_ushort_array (buffer, new_length)) {
+ return false;
+ }
+ tmp.swap(target);
+ return true;
+ }
+
+ template <typename stream, CORBA::ULong MAX>
+ bool demarshal_sequence(stream & strm, TAO::bounded_value_sequence <CORBA::Octet, MAX> & target) {
+ typedef TAO::bounded_value_sequence <CORBA::Octet, MAX> sequence;
+ ::CORBA::ULong new_length = 0;
+ if (!(strm >> new_length)) {
+ return false;
+ }
+ if ((new_length > strm.length()) || (new_length > target.maximum ())) {
+ return false;
+ }
+ sequence tmp;
+ tmp.length(new_length);
+ typename sequence::value_type * buffer = tmp.get_buffer();
+ if (!strm.read_octet_array (buffer, new_length)) {
+ return false;
+ }
+ tmp.swap(target);
+ return true;
+ }
+
+ template <typename stream, CORBA::ULong MAX>
+ bool demarshal_sequence(stream & strm, TAO::bounded_value_sequence <CORBA::Char, MAX> & target) {
+ typedef TAO::bounded_value_sequence <CORBA::Char, MAX> sequence;
+ ::CORBA::ULong new_length = 0;
+ if (!(strm >> new_length)) {
+ return false;
+ }
+ if ((new_length > strm.length()) || (new_length > target.maximum ())) {
+ return false;
+ }
+ sequence tmp;
+ tmp.length(new_length);
+ typename sequence::value_type * buffer = tmp.get_buffer();
+ if (!strm.read_char_array (buffer, new_length)) {
+ return false;
+ }
+ tmp.swap(target);
+ return true;
+ }
+
+# if defined (ACE_HAS_WCHAR) || defined (ACE_HAS_XPG4_MULTIBYTE_CHAR)
+ template <typename stream, CORBA::ULong MAX>
+ bool demarshal_sequence(stream & strm, TAO::bounded_value_sequence <CORBA::WChar, MAX> & target) {
+ typedef TAO::bounded_value_sequence <CORBA::WChar, MAX> sequence;
+ ::CORBA::ULong new_length = 0;
+ if (!(strm >> new_length)) {
+ return false;
+ }
+ if ((new_length > strm.length()) || (new_length > target.maximum ())) {
+ return false;
+ }
+ sequence tmp;
+ tmp.length(new_length);
+ typename sequence::value_type * buffer = tmp.get_buffer();
+ if (!strm.read_wchar_array (buffer, new_length)) {
+ return false;
+ }
+ tmp.swap(target);
+ return true;
+ }
+#endif
+
+ template <typename stream, CORBA::ULong MAX>
+ bool demarshal_sequence(stream & strm, TAO::bounded_value_sequence <CORBA::Float, MAX> & target) {
+ typedef TAO::bounded_value_sequence <CORBA::Float, MAX> sequence;
+ ::CORBA::ULong new_length = 0;
+ if (!(strm >> new_length)) {
+ return false;
+ }
+ if ((new_length > strm.length()) || (new_length > target.maximum ())) {
+ return false;
+ }
+ sequence tmp;
+ tmp.length(new_length);
+ typename sequence::value_type * buffer = tmp.get_buffer();
+ if (!strm.read_float_array (buffer, new_length)) {
+ return false;
+ }
+ tmp.swap(target);
+ return true;
+ }
+
+ template <typename stream, CORBA::ULong MAX>
+ bool demarshal_sequence(stream & strm, TAO::bounded_value_sequence <CORBA::Double, MAX> & target) {
+ typedef TAO::bounded_value_sequence <CORBA::Double, MAX> sequence;
+ ::CORBA::ULong new_length = 0;
+ if (!(strm >> new_length)) {
+ return false;
+ }
+ if ((new_length > strm.length()) || (new_length > target.maximum ())) {
+ return false;
+ }
+ sequence tmp;
+ tmp.length(new_length);
+ typename sequence::value_type * buffer = tmp.get_buffer();
+ if (!strm.read_double_array (buffer, new_length)) {
+ return false;
+ }
+ tmp.swap(target);
+ return true;
+ }
+
+ template <typename stream, CORBA::ULong MAX>
+ bool demarshal_sequence(stream & strm, TAO::bounded_value_sequence <CORBA::ULongLong, MAX> & target) {
+ typedef TAO::bounded_value_sequence <CORBA::ULongLong, MAX> sequence;
+ ::CORBA::ULong new_length = 0;
+ if (!(strm >> new_length)) {
+ return false;
+ }
+ if ((new_length > strm.length()) || (new_length > target.maximum ())) {
+ return false;
+ }
+ sequence tmp;
+ tmp.length(new_length);
+ typename sequence::value_type * buffer = tmp.get_buffer();
+ if (!strm.read_ulonglong_array (buffer, new_length)) {
+ return false;
+ }
+ tmp.swap(target);
+ return true;
+ }
+
+ template <typename stream, CORBA::ULong MAX>
+ bool demarshal_sequence(stream & strm, TAO::bounded_value_sequence <CORBA::LongDouble, MAX> & target) {
+ typedef TAO::bounded_value_sequence <CORBA::LongDouble, MAX> sequence;
+ ::CORBA::ULong new_length = 0;
+ if (!(strm >> new_length)) {
+ return false;
+ }
+ if ((new_length > strm.length()) || (new_length > target.maximum ())) {
+ return false;
+ }
+ sequence tmp;
+ tmp.length(new_length);
+ typename sequence::value_type * buffer = tmp.get_buffer();
+ if (!strm.read_longdouble_array (buffer, new_length)) {
+ return false;
+ }
+ tmp.swap(target);
+ return true;
+ }
+
+ template <typename stream, CORBA::ULong MAX>
+ bool demarshal_sequence(stream & strm, TAO::bounded_value_sequence <CORBA::Boolean, MAX> & target) {
+ typedef TAO::bounded_value_sequence <CORBA::Boolean, MAX> sequence;
+ ::CORBA::ULong new_length = 0;
+ if (!(strm >> new_length)) {
+ return false;
+ }
+ if ((new_length > strm.length()) || (new_length > target.maximum ())) {
+ return false;
+ }
+ sequence tmp;
+ tmp.length(new_length);
+ typename sequence::value_type * buffer = tmp.get_buffer();
+ if (!strm.read_boolean_array (buffer, new_length)) {
+ return false;
+ }
+ tmp.swap(target);
+ return true;
+ }
+
+ template <typename stream, typename value_t, CORBA::ULong MAX>
+ bool demarshal_sequence(stream & strm, TAO::bounded_value_sequence <value_t, MAX> & target) {
+ typedef TAO::bounded_value_sequence <value_t, MAX> sequence;
+ ::CORBA::ULong new_length = 0;
+ if (!(strm >> new_length)) {
+ return false;
+ }
+ if ((new_length > strm.length()) || (new_length > target.maximum ())) {
+ return false;
+ }
+ sequence tmp;
+ tmp.length(new_length);
+ typename sequence::value_type * buffer = tmp.get_buffer();
+ for(CORBA::ULong i = 0; i < new_length; ++i) {
+ if (!(strm >> buffer[i])) {
+ return false;
+ }
+ }
+ tmp.swap(target);
+ return true;
+ }
+
+ template <typename stream, typename charT, CORBA::ULong MAX>
+ bool demarshal_sequence(stream & strm, TAO::details::bounded_basic_string_sequence <charT, MAX> & target) {
+ typedef typename TAO::details::bounded_basic_string_sequence <charT, MAX> sequence;
+ typedef typename sequence::element_traits::string_var string_var;
+ ::CORBA::ULong new_length = 0;
+ if (!(strm >> new_length)) {
+ return false;
+ }
+ if ((new_length > strm.length()) || (new_length > target.maximum ())) {
+ return false;
+ }
+ sequence tmp;
+ tmp.length(new_length);
+ for(CORBA::ULong i = 0; i < new_length; ++i) {
+ string_var string;
+ if (!(strm >> string.inout ())) {
+ return false;
+ }
+ else {
+ tmp[i] = string._retn ();
+ }
+ }
+ tmp.swap(target);
+ return true;
+ }
+
+ template <typename stream, typename object_t, typename object_t_var, CORBA::ULong MAX>
+ bool demarshal_sequence(stream & strm, TAO::bounded_object_reference_sequence<object_t, object_t_var, MAX> & target) {
+ typedef typename TAO::bounded_object_reference_sequence<object_t, object_t_var, MAX> sequence;
+ ::CORBA::ULong new_length = 0;
+ if (!(strm >> new_length)) {
+ return false;
+ }
+ if ((new_length > strm.length()) || (new_length > target.maximum ())) {
+ return false;
+ }
+ sequence tmp;
+ tmp.length(new_length);
+ typename sequence::value_type * buffer = tmp.get_buffer();
+ for(CORBA::ULong i = 0; i < new_length; ++i) {
+ if (!(strm >> buffer[i])) {
+ return false;
+ }
+ }
+ tmp.swap(target);
+ return true;
+ }
+}
+
+namespace TAO {
+ template <typename stream, CORBA::ULong MAX>
+ bool marshal_sequence(stream & strm, const TAO::bounded_value_sequence <CORBA::Short, MAX> & source) {
+ if (0 == &source)
+ ACE_THROW_RETURN (::CORBA::BAD_PARAM(0, CORBA::COMPLETED_MAYBE), false);
+ ::CORBA::ULong const length = source.length ();
+ if (!(strm << length)) {
+ return false;
+ }
+ return strm.write_short_array (source.get_buffer (), length);
+ }
+
+ template <typename stream, CORBA::ULong MAX>
+ bool marshal_sequence(stream & strm, const TAO::bounded_value_sequence <CORBA::Long, MAX> & source) {
+ if (0 == &source)
+ ACE_THROW_RETURN (::CORBA::BAD_PARAM(0, CORBA::COMPLETED_MAYBE), false);
+ ::CORBA::ULong const length = source.length ();
+ if (!(strm << length)) {
+ return false;
+ }
+ return strm.write_long_array (source.get_buffer (), length);
+ }
+
+ template <typename stream, CORBA::ULong MAX>
+ bool marshal_sequence(stream & strm, const TAO::bounded_value_sequence <CORBA::ULong, MAX> & source) {
+ if (0 == &source)
+ ACE_THROW_RETURN (::CORBA::BAD_PARAM(0, CORBA::COMPLETED_MAYBE), false);
+ ::CORBA::ULong const length = source.length ();
+ if (!(strm << length)) {
+ return false;
+ }
+ return strm.write_ulong_array (source.get_buffer (), length);
+ }
+
+ template <typename stream, CORBA::ULong MAX>
+ bool marshal_sequence(stream & strm, const TAO::bounded_value_sequence <CORBA::UShort, MAX> & source) {
+ if (0 == &source)
+ ACE_THROW_RETURN (::CORBA::BAD_PARAM(0, CORBA::COMPLETED_MAYBE), false);
+ ::CORBA::ULong const length = source.length ();
+ if (!(strm << length)) {
+ return false;
+ }
+ return strm.write_ushort_array (source.get_buffer (), length);
+ }
+
+ template <typename stream, CORBA::ULong MAX>
+ bool marshal_sequence(stream & strm, const TAO::bounded_value_sequence <CORBA::Octet, MAX> & source) {
+ if (0 == &source)
+ ACE_THROW_RETURN (::CORBA::BAD_PARAM(0, CORBA::COMPLETED_MAYBE), false);
+ ::CORBA::ULong const length = source.length ();
+ if (!(strm << length)) {
+ return false;
+ }
+ return strm.write_octet_array (source.get_buffer (), length);
+ }
+
+ template <typename stream, CORBA::ULong MAX>
+ bool marshal_sequence(stream & strm, const TAO::bounded_value_sequence <CORBA::Char, MAX> & source) {
+ if (0 == &source)
+ ACE_THROW_RETURN (::CORBA::BAD_PARAM(0, CORBA::COMPLETED_MAYBE), false);
+ ::CORBA::ULong const length = source.length ();
+ if (!(strm << length)) {
+ return false;
+ }
+ return strm.write_char_array (source.get_buffer (), length);
+ }
+
+# if defined (ACE_HAS_WCHAR) || defined (ACE_HAS_XPG4_MULTIBYTE_CHAR)
+ template <typename stream, CORBA::ULong MAX>
+ bool marshal_sequence(stream & strm, const TAO::bounded_value_sequence <CORBA::WChar, MAX> & source) {
+ if (0 == &source)
+ ACE_THROW_RETURN (::CORBA::BAD_PARAM(0, CORBA::COMPLETED_MAYBE), false);
+ ::CORBA::ULong const length = source.length ();
+ if (!(strm << length)) {
+ return false;
+ }
+ return strm.write_wchar_array (source.get_buffer (), length);
+ }
+#endif
+
+ template <typename stream, CORBA::ULong MAX>
+ bool marshal_sequence(stream & strm, const TAO::bounded_value_sequence <CORBA::Float, MAX> & source) {
+ if (0 == &source)
+ ACE_THROW_RETURN (::CORBA::BAD_PARAM(0, CORBA::COMPLETED_MAYBE), false);
+ ::CORBA::ULong const length = source.length ();
+ if (!(strm << length)) {
+ return false;
+ }
+ return strm.write_float_array (source.get_buffer (), length);
+ }
+
+ template <typename stream, CORBA::ULong MAX>
+ bool marshal_sequence(stream & strm, const TAO::bounded_value_sequence <CORBA::Double, MAX> & source) {
+ if (0 == &source)
+ ACE_THROW_RETURN (::CORBA::BAD_PARAM(0, CORBA::COMPLETED_MAYBE), false);
+ ::CORBA::ULong const length = source.length ();
+ if (!(strm << length)) {
+ return false;
+ }
+ return strm.write_double_array (source.get_buffer (), length);
+ }
+
+ template <typename stream, CORBA::ULong MAX>
+ bool marshal_sequence(stream & strm, const TAO::bounded_value_sequence <CORBA::ULongLong, MAX> & source) {
+ if (0 == &source)
+ ACE_THROW_RETURN (::CORBA::BAD_PARAM(0, CORBA::COMPLETED_MAYBE), false);
+ ::CORBA::ULong const length = source.length ();
+ if (!(strm << length)) {
+ return false;
+ }
+ return strm.write_ulonglong_array (source.get_buffer (), length);
+ }
+
+ template <typename stream, CORBA::ULong MAX>
+ bool marshal_sequence(stream & strm, const TAO::bounded_value_sequence <CORBA::LongDouble, MAX> & source) {
+ if (0 == &source)
+ ACE_THROW_RETURN (::CORBA::BAD_PARAM(0, CORBA::COMPLETED_MAYBE), false);
+ ::CORBA::ULong const length = source.length ();
+ if (!(strm << length)) {
+ return false;
+ }
+ return strm.write_longdouble_array (source.get_buffer (), length);
+ }
+
+ template <typename stream, CORBA::ULong MAX>
+ bool marshal_sequence(stream & strm, const TAO::bounded_value_sequence <CORBA::Boolean, MAX> & source) {
+ if (0 == &source)
+ ACE_THROW_RETURN (::CORBA::BAD_PARAM(0, CORBA::COMPLETED_MAYBE), false);
+ ::CORBA::ULong const length = source.length ();
+ if (!(strm << length)) {
+ return false;
+ }
+ return strm.write_boolean_array (source.get_buffer (), length);
+ }
+
+ template <typename stream, typename value_t, CORBA::ULong MAX>
+ bool marshal_sequence(stream & strm, const TAO::bounded_value_sequence <value_t, MAX> & source) {
+ if (0 == &source)
+ ACE_THROW_RETURN (::CORBA::BAD_PARAM(0, CORBA::COMPLETED_MAYBE), false);
+ ::CORBA::ULong const length = source.length ();
+ if (!(strm << length)) {
+ return false;
+ }
+ for(CORBA::ULong i = 0; i < length; ++i) {
+ if (!(strm << source[i])) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ template <typename stream, typename charT, CORBA::ULong MAX>
+ bool marshal_sequence(stream & strm, const TAO::details::bounded_basic_string_sequence <charT, MAX> & source) {
+ if (0 == &source)
+ ACE_THROW_RETURN (::CORBA::BAD_PARAM(0, CORBA::COMPLETED_MAYBE), false);
+ ::CORBA::ULong const length = source.length ();
+ if (!(strm << length)) {
+ return false;
+ }
+ for(CORBA::ULong i = 0; i < length; ++i) {
+ if (!(strm << source[i])) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ template <typename stream, typename object_t, typename object_t_var, CORBA::ULong MAX>
+ bool marshal_sequence(stream & strm, const TAO::bounded_object_reference_sequence<object_t, object_t_var, MAX> & source) {
+ typedef typename TAO::bounded_object_reference_sequence<object_t, object_t_var, MAX>::object_type object_type;
+ if (0 == &source)
+ ACE_THROW_RETURN (::CORBA::BAD_PARAM(0, CORBA::COMPLETED_MAYBE), false);
+ ::CORBA::ULong const length = source.length ();
+ if (!(strm << length)) {
+ return false;
+ }
+ for(CORBA::ULong i = 0; i < length; ++i) {
+ if (!TAO::Objref_Traits<object_type>::marshal (source[i], strm)) {
+ return false;
+ }
+ }
+ return true;
+ }
+} // namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* guard_bounded_sequence_cdr */
diff --git a/TAO/tao/Bounded_String_Sequence_T.h b/TAO/tao/Bounded_String_Sequence_T.h
new file mode 100644
index 00000000000..9f6373343b6
--- /dev/null
+++ b/TAO/tao/Bounded_String_Sequence_T.h
@@ -0,0 +1,42 @@
+#ifndef guard_bounded_string_sequence_hpp
+#define guard_bounded_string_sequence_hpp
+/**
+ * @file
+ *
+ * @brief Implement bounded sequences for strings.
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan
+ */
+
+#include "tao/Bounded_Basic_String_Sequence_T.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+
+template<CORBA::ULong MAX>
+class bounded_string_sequence
+ : public details::bounded_basic_string_sequence<char,MAX>
+{
+public:
+ inline bounded_string_sequence()
+ : details::bounded_basic_string_sequence<char,MAX>()
+ {}
+ inline bounded_string_sequence(
+ CORBA::ULong length,
+ char * * data,
+ CORBA::Boolean release = false)
+ : details::bounded_basic_string_sequence<char,MAX>(
+ length, data, release)
+ {}
+};
+
+
+} // namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif // guard_bounded_string_sequence_hpp
diff --git a/TAO/tao/Bounded_Value_Allocation_Traits_T.h b/TAO/tao/Bounded_Value_Allocation_Traits_T.h
new file mode 100644
index 00000000000..aa94641e539
--- /dev/null
+++ b/TAO/tao/Bounded_Value_Allocation_Traits_T.h
@@ -0,0 +1,60 @@
+#ifndef guard_bounded_value_allocation_traits_hpp
+#define guard_bounded_value_allocation_traits_hpp
+/**
+ * @file
+ *
+ * @brief Details can be found in the documentation for
+ * TAO::details::generic_sequence
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan
+ */
+
+#include "tao/Basic_Types.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+namespace details
+{
+
+template<typename T, CORBA::ULong MAX, bool dummy>
+struct bounded_value_allocation_traits
+{
+ typedef T value_type;
+
+ inline static CORBA::ULong default_maximum()
+ {
+ return MAX;
+ }
+
+ inline static value_type * default_buffer_allocation()
+ {
+ return allocbuf(MAX);
+ }
+
+ inline static value_type * allocbuf(CORBA::ULong /* maximum */)
+ {
+ return new value_type[MAX];
+ }
+
+ inline static void freebuf(value_type * buffer)
+ {
+ delete[] buffer;
+ }
+
+ inline static CORBA::ULong maximum()
+ {
+ return MAX;
+ }
+ /* static CORBA::ULong const MAXIMUM = MAX; */
+};
+
+} // namespace details
+} // namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif // guard_bounded_value_allocation_traits_hpp
diff --git a/TAO/tao/Bounded_Value_Sequence_T.h b/TAO/tao/Bounded_Value_Sequence_T.h
new file mode 100644
index 00000000000..dbb466fac3a
--- /dev/null
+++ b/TAO/tao/Bounded_Value_Sequence_T.h
@@ -0,0 +1,100 @@
+#ifndef guard_bounded_value_sequence_hpp
+#define guard_bounded_value_sequence_hpp
+/**
+ * @file
+ *
+ * @brief Implement bounded sequences for types with value-like
+ * semantics.
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan
+ */
+
+#include "tao/Bounded_Value_Allocation_Traits_T.h"
+#include "tao/Value_Traits_T.h"
+#include "tao/Generic_Sequence_T.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+
+template<class T, CORBA::ULong MAX>
+class bounded_value_sequence
+{
+public:
+ typedef T value_type;
+ typedef T element_type;
+ typedef T const const_value_type;
+ typedef value_type & subscript_type;
+ typedef value_type const & const_subscript_type;
+
+ typedef details::bounded_value_allocation_traits<value_type,MAX,true> allocation_traits;
+ typedef details::value_traits<value_type,true> element_traits;
+ typedef details::generic_sequence<value_type, allocation_traits, element_traits> implementation_type;
+
+ inline bounded_value_sequence()
+ : impl_()
+ {}
+ inline bounded_value_sequence(
+ CORBA::ULong length,
+ value_type * data,
+ CORBA::Boolean release = false)
+ : impl_(MAX, length, data, release)
+ {}
+ /* Use default ctor, operator= and dtor */
+ inline CORBA::ULong maximum() const {
+ return impl_.maximum();
+ }
+ inline CORBA::Boolean release() const {
+ return impl_.release();
+ }
+ inline CORBA::ULong length() const {
+ return impl_.length();
+ }
+ inline void length(CORBA::ULong length) {
+ implementation_type::range::check_length(length, MAX);
+ impl_.length(length);
+ }
+ inline value_type const & operator[](CORBA::ULong i) const {
+ return impl_[i];
+ }
+ inline value_type & operator[](CORBA::ULong i) {
+ return impl_[i];
+ }
+ inline void replace(
+ CORBA::ULong length,
+ value_type * data,
+ CORBA::Boolean release = false) {
+ impl_.replace(MAX, length, data, release);
+ }
+ inline value_type const * get_buffer() const {
+ return impl_.get_buffer();
+ }
+ inline value_type * get_buffer(CORBA::Boolean orphan = false) {
+ return impl_.get_buffer(orphan);
+ }
+ inline void swap(bounded_value_sequence & rhs) throw() {
+ impl_.swap(rhs.impl_);
+ }
+ static value_type * allocbuf(CORBA::ULong maximum) {
+ return implementation_type::allocbuf(maximum);
+ }
+ static value_type * allocbuf() {
+ return implementation_type::allocbuf(MAX);
+ }
+ static void freebuf(value_type * buffer)
+ {
+ implementation_type::freebuf(buffer);
+ }
+
+private:
+ implementation_type impl_;
+};
+
+} // namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif // guard_bounded_string_sequence_hpp
diff --git a/TAO/tao/Bounded_Wstring_Sequence_T.h b/TAO/tao/Bounded_Wstring_Sequence_T.h
new file mode 100644
index 00000000000..c0ed84f289e
--- /dev/null
+++ b/TAO/tao/Bounded_Wstring_Sequence_T.h
@@ -0,0 +1,42 @@
+#ifndef guard_bounded_wstring_sequence_hpp
+#define guard_bounded_wstring_sequence_hpp
+/**
+ * @file
+ *
+ * @brief Implement bounded sequences for wstrings.
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan
+ */
+
+#include "tao/Bounded_Basic_String_Sequence_T.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+
+template<CORBA::ULong MAX>
+class bounded_wstring_sequence
+ : public details::bounded_basic_string_sequence<CORBA::WChar,MAX>
+{
+public:
+ inline bounded_wstring_sequence()
+ : details::bounded_basic_string_sequence<CORBA::WChar,MAX>()
+ {}
+ inline bounded_wstring_sequence(
+ CORBA::ULong length,
+ CORBA::WChar * * data,
+ CORBA::Boolean release = false)
+ : details::bounded_basic_string_sequence<CORBA::WChar,MAX>(
+ length, data, release)
+ {}
+};
+
+
+} // namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif // guard_bounded_wstring_sequence_hpp
diff --git a/TAO/tao/Buffer_Allocator_T.cpp b/TAO/tao/Buffer_Allocator_T.cpp
new file mode 100644
index 00000000000..52ae87f3c33
--- /dev/null
+++ b/TAO/tao/Buffer_Allocator_T.cpp
@@ -0,0 +1,45 @@
+// $Id$
+
+#ifndef TAO_BUFFER_ALLOCATOR_T_CPP
+#define TAO_BUFFER_ALLOCATOR_T_CPP
+
+#include "tao/Buffer_Allocator_T.h"
+#include "ace/Global_Macros.h"
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ template <typename handler_type, typename alloc_type>
+ TAO_Buffer_Allocator<handler_type, alloc_type>::TAO_Buffer_Allocator (alloc_type *allocator) :
+ allocator_(allocator)
+ {
+ }
+
+ template <typename handler_type, typename alloc_type>
+ handler_type*
+ TAO_Buffer_Allocator<handler_type, alloc_type>::allocate (void)
+ {
+ handler_type* myvalue = 0;
+ ACE_NEW_MALLOC_RETURN (myvalue,
+ static_cast <handler_type*>(
+ allocator_->malloc (sizeof (handler_type))),
+ handler_type (), 0);
+
+ return myvalue;
+ }
+
+ template <typename handler_type, typename alloc_type>
+ void
+ TAO_Buffer_Allocator<handler_type, alloc_type>::release (handler_type *ptr)
+ {
+ ACE_DES_FREE (ptr,
+ allocator_->free,
+ handler_type);
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_BUFFER_ALLOCATOR_T_CPP */
diff --git a/TAO/tao/Buffer_Allocator_T.h b/TAO/tao/Buffer_Allocator_T.h
new file mode 100644
index 00000000000..3d29c153ac9
--- /dev/null
+++ b/TAO/tao/Buffer_Allocator_T.h
@@ -0,0 +1,62 @@
+/* -*- C++ -*- */
+
+//=============================================================================
+/**
+ * @file Buffer_Allocator_T.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen (jwillemsen@remedy.nl)
+ */
+//=============================================================================
+
+#ifndef TAO_BUFFER_ALLOCATOR_T_H
+#define TAO_BUFFER_ALLOCATOR_T_H
+
+#include /**/ "ace/pre.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Allocator.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ /**
+ * @class TAO_Buffer_Allocator
+ *
+ * @brief Generic buffer allocator for TAO
+ *
+ * handler_type is the type of object to allocator, alloc_type is the type
+ * of allocator to be used to allocate the object.
+ */
+ template <typename handler_type, typename alloc_type>
+ class TAO_Buffer_Allocator : public TAO_Allocator<handler_type>
+ {
+ public:
+ typedef handler_type HANDLER_TYPE;
+ typedef alloc_type ALLOC_TYPE;
+ TAO_Buffer_Allocator (alloc_type *allocator);
+
+ virtual handler_type *allocate (void);
+ virtual void release (handler_type *ptr);
+ private:
+ alloc_type* allocator_;
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+#include "tao/Buffer_Allocator_T.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
+#pragma implementation ("Buffer_Allocator_T.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_BUFFER_ALLOCATOR_T_H */
diff --git a/TAO/tao/Buffering_Constraint_Policy.cpp b/TAO/tao/Buffering_Constraint_Policy.cpp
new file mode 100644
index 00000000000..a3d9ddd3cd0
--- /dev/null
+++ b/TAO/tao/Buffering_Constraint_Policy.cpp
@@ -0,0 +1,92 @@
+// $Id$
+
+#include "tao/Buffering_Constraint_Policy.h"
+
+#if (TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1)
+
+#include "tao/TAOC.h"
+#include "tao/SystemException.h"
+
+ACE_RCSID (tao,
+ Buffering_Constraint_Policy,
+ "$Id$")
+
+#if ! defined (__ACE_INLINE__)
+#include "tao/Buffering_Constraint_Policy.i"
+#endif /* __ACE_INLINE__ */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Buffering_Constraint_Policy::TAO_Buffering_Constraint_Policy (const TAO::BufferingConstraint &buffering_constraint)
+ : ::CORBA::Object ()
+ , ::CORBA::Policy ()
+ , ::CORBA::LocalObject ()
+ , TAO::BufferingConstraintPolicy ()
+ , TAO_Local_RefCounted_Object ()
+ , buffering_constraint_ (buffering_constraint)
+{
+}
+
+TAO_Buffering_Constraint_Policy::TAO_Buffering_Constraint_Policy (const TAO_Buffering_Constraint_Policy &rhs)
+
+ : ::CORBA::Object ()
+ , ::CORBA::Policy ()
+ , ::CORBA::LocalObject ()
+ , TAO::BufferingConstraintPolicy ()
+ , TAO_Local_RefCounted_Object ()
+ , buffering_constraint_ (rhs.buffering_constraint_)
+{
+}
+
+CORBA::PolicyType
+TAO_Buffering_Constraint_Policy::policy_type (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return TAO::BUFFERING_CONSTRAINT_POLICY_TYPE;
+}
+
+TAO_Buffering_Constraint_Policy *
+TAO_Buffering_Constraint_Policy::clone (void) const
+{
+ TAO_Buffering_Constraint_Policy *copy = 0;
+ ACE_NEW_RETURN (copy,
+ TAO_Buffering_Constraint_Policy (*this),
+ 0);
+ return copy;
+}
+
+TAO::BufferingConstraint
+TAO_Buffering_Constraint_Policy::buffering_constraint (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return this->buffering_constraint_;
+}
+
+CORBA::Policy_ptr
+TAO_Buffering_Constraint_Policy::copy (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ TAO_Buffering_Constraint_Policy* servant = 0;
+ ACE_NEW_THROW_EX (servant,
+ TAO_Buffering_Constraint_Policy (*this),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+
+ return servant;
+}
+
+void
+TAO_Buffering_Constraint_Policy::destroy (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+}
+
+TAO_Cached_Policy_Type
+TAO_Buffering_Constraint_Policy::_tao_cached_type (void) const
+{
+ return TAO_CACHED_POLICY_BUFFERING_CONSTRAINT;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1 */
diff --git a/TAO/tao/Buffering_Constraint_Policy.h b/TAO/tao/Buffering_Constraint_Policy.h
new file mode 100644
index 00000000000..4c7c107a01a
--- /dev/null
+++ b/TAO/tao/Buffering_Constraint_Policy.h
@@ -0,0 +1,94 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Buffering_Constraint_Policy.h
+ *
+ * $Id$
+ *
+ * @author Irfan Pyarali (irfan@cs.wustl.edu)
+ */
+//=============================================================================
+
+
+#ifndef TAO_BUFFERING_CONSTRAINT_POLICY_H
+#define TAO_BUFFERING_CONSTRAINT_POLICY_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/TAOC.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if (TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1)
+
+#include "tao/LocalObject.h"
+
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_Buffering_Constraint_Policy
+ *
+ * @brief Implementation class for TAO-specific Buffering Constraint Policy.
+ *
+ * This policy is used to control the buffering of requests by the ORB.
+ */
+class TAO_Export TAO_Buffering_Constraint_Policy
+ : public TAO::BufferingConstraintPolicy,
+ public TAO_Local_RefCounted_Object
+{
+public:
+ /// Constructor.
+ TAO_Buffering_Constraint_Policy (const TAO::BufferingConstraint &buffering_constraint);
+
+ /// Copy constructor.
+ TAO_Buffering_Constraint_Policy (const TAO_Buffering_Constraint_Policy &rhs);
+
+ /// Returns a copy of <this>.
+ virtual TAO_Buffering_Constraint_Policy *clone (void) const;
+
+ // = The TAO::Buffering_Constraint_Policy methods
+
+ virtual TAO::BufferingConstraint buffering_constraint (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ void get_buffering_constraint (TAO::BufferingConstraint &) const;
+
+ virtual CORBA::PolicyType policy_type (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual CORBA::Policy_ptr copy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual void destroy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ // Return the cached policy type for this policy.
+ virtual TAO_Cached_Policy_Type _tao_cached_type (void) const;
+
+private:
+ /// The attribute
+ TAO::BufferingConstraint buffering_constraint_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#if defined (__ACE_INLINE__)
+#include "tao/Buffering_Constraint_Policy.i"
+#endif /* __ACE_INLINE__ */
+
+#endif /* TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1 */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_BUFFERING_CONSTRAINT_POLICY_H */
diff --git a/TAO/tao/Buffering_Constraint_Policy.i b/TAO/tao/Buffering_Constraint_Policy.i
new file mode 100644
index 00000000000..2176d0efc36
--- /dev/null
+++ b/TAO/tao/Buffering_Constraint_Policy.i
@@ -0,0 +1,13 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE void
+TAO_Buffering_Constraint_Policy::get_buffering_constraint (TAO::BufferingConstraint &bc) const
+{
+ bc = this->buffering_constraint_;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/CDR.cpp b/TAO/tao/CDR.cpp
new file mode 100644
index 00000000000..4ac35f5e957
--- /dev/null
+++ b/TAO/tao/CDR.cpp
@@ -0,0 +1,332 @@
+// $Id$
+
+#include "tao/CDR.h"
+#include "tao/Timeprobe.h"
+#include "tao/ORB_Core.h"
+#include "tao/Environment.h"
+#include "tao/SystemException.h"
+#include "tao/GIOP_Fragmentation_Strategy.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/CDR.i"
+#endif /* ! __ACE_INLINE__ */
+
+
+ACE_RCSID (tao,
+ CDR,
+ "$Id$")
+
+
+#if defined (ACE_ENABLE_TIMEPROBES)
+
+static const char *TAO_CDR_Timeprobe_Description[] =
+{
+ "OutputCDR::ctor[1] - enter",
+ "OutputCDR::ctor[1] - leave",
+ "OutputCDR::ctor[2] - enter",
+ "OutputCDR::ctor[2] - leave",
+ "OutputCDR::ctor[3] - enter",
+ "OutputCDR::ctor[3] - leave",
+ "OutputCDR::ctor[4] - enter",
+ "OutputCDR::ctor[4] - leave",
+ "OutputCDR::ctor[5] - enter",
+ "OutputCDR::ctor[5] - leave"
+};
+
+enum
+{
+ TAO_OUTPUT_CDR_CTOR1_ENTER = 2000,
+ TAO_OUTPUT_CDR_CTOR1_LEAVE,
+ TAO_OUTPUT_CDR_CTOR2_ENTER,
+ TAO_OUTPUT_CDR_CTOR2_LEAVE,
+ TAO_OUTPUT_CDR_CTOR3_ENTER,
+ TAO_OUTPUT_CDR_CTOR3_LEAVE,
+ TAO_OUTPUT_CDR_CTOR4_ENTER,
+ TAO_OUTPUT_CDR_CTOR4_LEAVE,
+ TAO_OUTPUT_CDR_CTOR5_ENTER,
+ TAO_OUTPUT_CDR_CTOR5_LEAVE
+};
+
+// Setup Timeprobes
+ACE_TIMEPROBE_EVENT_DESCRIPTIONS (TAO_CDR_Timeprobe_Description,
+ TAO_OUTPUT_CDR_CTOR1_ENTER);
+
+#endif /* ACE_ENABLE_TIMEPROBES */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_OutputCDR::TAO_OutputCDR (size_t size,
+ int byte_order,
+ ACE_Allocator *buffer_allocator,
+ ACE_Allocator *data_block_allocator,
+ ACE_Allocator* message_block_allocator,
+ size_t memcpy_tradeoff,
+ ACE_CDR::Octet major_version,
+ ACE_CDR::Octet minor_version)
+ : ACE_OutputCDR (size,
+ byte_order,
+ buffer_allocator,
+ data_block_allocator,
+ message_block_allocator,
+ memcpy_tradeoff,
+ major_version,
+ minor_version)
+ , fragmentation_strategy_ (0)
+ , more_fragments_ (false)
+ , request_id_ (0)
+ , stub_ (0)
+ , message_semantics_ (-1)
+ , timeout_ (0)
+{
+ ACE_FUNCTION_TIMEPROBE (TAO_OUTPUT_CDR_CTOR1_ENTER);
+}
+
+TAO_OutputCDR::TAO_OutputCDR (char *data,
+ size_t size,
+ int byte_order,
+ ACE_Allocator *buffer_allocator,
+ ACE_Allocator *data_block_allocator,
+ ACE_Allocator* message_block_allocator,
+ size_t memcpy_tradeoff,
+ ACE_CDR::Octet major_version,
+ ACE_CDR::Octet minor_version)
+ : ACE_OutputCDR (data,
+ size,
+ byte_order,
+ buffer_allocator,
+ data_block_allocator,
+ message_block_allocator,
+ memcpy_tradeoff,
+ major_version,
+ minor_version)
+ , fragmentation_strategy_ (0)
+ , more_fragments_ (false)
+ , request_id_ (0)
+ , stub_ (0)
+ , message_semantics_ (-1)
+ , timeout_ (0)
+{
+ ACE_FUNCTION_TIMEPROBE (TAO_OUTPUT_CDR_CTOR2_ENTER);
+}
+
+TAO_OutputCDR::TAO_OutputCDR (char *data,
+ size_t size,
+ int byte_order,
+ ACE_Allocator* buffer_allocator,
+ ACE_Allocator* data_block_allocator,
+ ACE_Allocator* message_block_allocator,
+ size_t memcpy_tradeoff,
+ TAO_GIOP_Fragmentation_Strategy * fs,
+ ACE_CDR::Octet major_version,
+ ACE_CDR::Octet minor_version)
+ : ACE_OutputCDR (data,
+ size,
+ byte_order,
+ buffer_allocator,
+ data_block_allocator,
+ message_block_allocator,
+ memcpy_tradeoff,
+ major_version,
+ minor_version)
+ , fragmentation_strategy_ (fs)
+ , more_fragments_ (false)
+ , request_id_ (0)
+ , stub_ (0)
+ , message_semantics_ (-1)
+ , timeout_ (0)
+{
+ ACE_FUNCTION_TIMEPROBE (TAO_OUTPUT_CDR_CTOR3_ENTER);
+}
+
+TAO_OutputCDR::TAO_OutputCDR (ACE_Message_Block *data,
+ int byte_order,
+ size_t memcpy_tradeoff,
+ ACE_CDR::Octet major_version,
+ ACE_CDR::Octet minor_version)
+ : ACE_OutputCDR (data,
+ byte_order,
+ memcpy_tradeoff,
+ major_version,
+ minor_version)
+ , fragmentation_strategy_ (0)
+ , more_fragments_ (false)
+ , request_id_ (0)
+ , stub_ (0)
+ , message_semantics_ (-1)
+ , timeout_ (0)
+{
+ ACE_FUNCTION_TIMEPROBE (TAO_OUTPUT_CDR_CTOR4_ENTER);
+}
+
+TAO_OutputCDR::TAO_OutputCDR (ACE_Data_Block *data_block,
+ int byte_order,
+ ACE_Allocator* message_block_allocator,
+ size_t memcpy_tradeoff,
+ TAO_GIOP_Fragmentation_Strategy * fs,
+ ACE_CDR::Octet major_version,
+ ACE_CDR::Octet minor_version)
+ : ACE_OutputCDR (data_block,
+ byte_order,
+ message_block_allocator,
+ memcpy_tradeoff,
+ major_version,
+ minor_version)
+ , fragmentation_strategy_ (fs)
+ , more_fragments_ (false)
+ , request_id_ (0)
+ , stub_ (0)
+ , message_semantics_ (-1)
+ , timeout_ (0)
+{
+ ACE_FUNCTION_TIMEPROBE (TAO_OUTPUT_CDR_CTOR5_ENTER);
+}
+
+void
+TAO_OutputCDR::throw_stub_exception (int error_num ACE_ENV_ARG_DECL)
+{
+ switch (error_num)
+ {
+ case 0 :
+ break;
+ case EINVAL : // wchar from a GIOP 1.0
+ ACE_THROW (CORBA::MARSHAL (CORBA::OMGVMCID | 5, CORBA::COMPLETED_NO));
+ ACE_NOTREACHED (break);
+#if (ERANGE != EINVAL)
+ case ERANGE : // untranslatable character
+ ACE_THROW (CORBA::DATA_CONVERSION (CORBA::OMGVMCID | 1,
+ CORBA::COMPLETED_NO));
+ ACE_NOTREACHED (break);
+#endif
+ case EACCES : // wchar but no codeset
+ ACE_THROW (CORBA::INV_OBJREF (CORBA::OMGVMCID | 2, CORBA::COMPLETED_NO));
+ ACE_NOTREACHED (break);
+ default :
+ ACE_THROW (CORBA::MARSHAL ());
+ }
+}
+
+void
+TAO_OutputCDR::throw_skel_exception (int error_num ACE_ENV_ARG_DECL)
+{
+ switch (error_num)
+ {
+ case 0 :
+ break;
+
+ case EINVAL : // wchar from a GIOP 1.0
+ ACE_THROW (CORBA::MARSHAL (CORBA::OMGVMCID | 5, CORBA::COMPLETED_YES));
+ ACE_NOTREACHED (break);
+
+ case EACCES : // wchar but no codeset
+ ACE_THROW (CORBA::BAD_PARAM (CORBA::OMGVMCID | 23,
+ CORBA::COMPLETED_YES));
+ ACE_NOTREACHED (break);
+
+#if (ERANGE != EINVAL)
+ case ERANGE : // untranslatable character
+ ACE_THROW (CORBA::DATA_CONVERSION (CORBA::OMGVMCID | 1,
+ CORBA::COMPLETED_YES));
+ ACE_NOTREACHED (break);
+#endif
+
+ default :
+ ACE_THROW (CORBA::MARSHAL (0, CORBA::COMPLETED_YES));
+
+ }
+}
+
+bool
+TAO_OutputCDR::fragment_stream (ACE_CDR::ULong pending_alignment,
+ ACE_CDR::ULong pending_length)
+{
+ if (this->fragmentation_strategy_)
+ {
+ return (this->fragmentation_strategy_->fragment (*this,
+ pending_alignment,
+ pending_length) == 0);
+ }
+
+ return true; // Success.
+}
+
+
+// ****************************************************************
+
+TAO_InputCDR::TAO_InputCDR (const TAO_OutputCDR& rhs,
+ ACE_Allocator* buffer_allocator,
+ ACE_Allocator* data_block_allocator,
+ ACE_Allocator* message_block_allocator,
+ TAO_ORB_Core* orb_core)
+ : ACE_InputCDR (rhs,
+ buffer_allocator
+ ? buffer_allocator
+ : (orb_core ? orb_core->output_cdr_buffer_allocator () : 0),
+ data_block_allocator
+ ? data_block_allocator
+ : (orb_core ? orb_core->output_cdr_dblock_allocator () :
+ 0),
+ message_block_allocator
+ ? message_block_allocator
+ : (orb_core ?
+ orb_core->output_cdr_msgblock_allocator () : 0)),
+ orb_core_ (orb_core)
+{
+}
+
+void
+TAO_InputCDR::throw_stub_exception (int error_num ACE_ENV_ARG_DECL)
+{
+ switch (error_num)
+ {
+ case 0 :
+ break;
+ case EINVAL : // wchar from a GIOP 1.0
+ ACE_THROW (CORBA::MARSHAL (CORBA::OMGVMCID | 6, CORBA::COMPLETED_YES));
+ ACE_NOTREACHED(break);
+#if (ERANGE != EINVAL)
+ case ERANGE : // untranslatable character
+ ACE_THROW (CORBA::DATA_CONVERSION (CORBA::OMGVMCID | 1, CORBA::COMPLETED_YES));
+ ACE_NOTREACHED(break);
+#endif
+ case EACCES : // wchar but no codeset
+ ACE_THROW (CORBA::INV_OBJREF (CORBA::OMGVMCID | 2, CORBA::COMPLETED_YES));
+ ACE_NOTREACHED(break);
+ default :
+ ACE_THROW (CORBA::MARSHAL (0, CORBA::COMPLETED_YES));
+ }
+}
+
+void
+TAO_InputCDR::throw_skel_exception (int error_num ACE_ENV_ARG_DECL)
+{
+ switch (error_num)
+ {
+ case 0 :
+ break;
+ case EINVAL : // wchar from a GIOP 1.0
+ ACE_THROW (CORBA::MARSHAL(CORBA::OMGVMCID | 5, CORBA::COMPLETED_NO));
+ ACE_NOTREACHED(break);
+
+ case EACCES : // wchar but no codeset
+ ACE_THROW (CORBA::BAD_PARAM(CORBA::OMGVMCID | 23, CORBA::COMPLETED_NO));
+ ACE_NOTREACHED(break);
+
+#if (ERANGE != EINVAL)
+ case ERANGE : // untranslatable character
+ ACE_THROW (CORBA::DATA_CONVERSION(CORBA::OMGVMCID | 1, CORBA::COMPLETED_NO));
+ ACE_NOTREACHED(break);
+#endif
+
+ default :
+ ACE_THROW (CORBA::MARSHAL());
+
+ }
+}
+
+ACE_Message_Block::Message_Flags
+TAO_InputCDR::clr_mb_flags( ACE_Message_Block::Message_Flags less_flags )
+{
+ return start_.clr_self_flags( less_flags );
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/CDR.h b/TAO/tao/CDR.h
new file mode 100644
index 00000000000..4820a469316
--- /dev/null
+++ b/TAO/tao/CDR.h
@@ -0,0 +1,459 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file CDR.h
+ *
+ * $Id$
+ *
+ * Common Data Representation (CDR) marshaling streams.
+ *
+ * This implementation assumes that the native numeric
+ * representation is two's complement for integers, IEEE
+ * single/double for floats. Also that characters are in ISO
+ * Latin/1.
+ *
+ * Note that CDR itself makes no such assumptions, but this
+ * implementation makes such assumptions for reasons of
+ * efficiency. Careful enhancements could preserve that
+ * efficiency where the assumptions are true, yet still allow the
+ * code to work when they aren't true.
+ *
+ * The implementation expects that buffers are aligned according
+ * to the strongest CDR alignment restriction.
+ *
+ * NOTE: this does everything "CDR 1.1" does ... that is, it
+ * supports the five extended OMG-IDL data types in UNO Appendix
+ * A, which provide richer arithmetic types (64 bit integers,
+ * "quad precision" FP) and UNICODE-based characters and strings.
+ * Those types are not standard parts of OMG-IDL at this time.
+ *
+ * THREADING NOTE: CDR data structures must be protected against
+ * concurrent access by their owning thread.
+ *
+ *
+ * @author Copyright 1994-1995 by Sun Microsystems Inc.
+ * @author Aniruddha Gokhale
+ * @author Carlos O'Ryan
+ */
+//=============================================================================
+
+
+#ifndef TAO_CDR_H
+#define TAO_CDR_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/TAO_Export.h"
+#include "tao/Basic_Types.h"
+
+#include "ace/CORBA_macros.h"
+#include "ace/CDR_Stream.h"
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_ORB_Core;
+class TAO_GIOP_Fragmentation_Strategy;
+class TAO_Stub;
+
+namespace CORBA
+{
+ class Environment;
+}
+
+/**
+ * @class TAO_OutputCDR
+ *
+ * @brief A CDR stream for writing, i.e. for marshalling.
+ *
+ * This class is based on the the CORBA spec for Java (98-02-29),
+ * java class omg.org.CORBA.portable.OutputStream.
+ * It diverts in a few ways:
+ * + Operations taking arrays don't have offsets, because in C++
+ * it is easier to describe an array starting from x+offset.
+ * + Operations return an error status, because exceptions are
+ * not widely available in C++ (yet).
+ * A particularly useful static member function for this buffer is
+ * an interpretive encoding routine, usable as a typecode
+ * interpreter callback. Ditto for decoding. These are used to
+ * support all OMG-IDL datatypes, even those not supported
+ * directly by put/get primitives.
+ */
+class TAO_Export TAO_OutputCDR : public ACE_OutputCDR
+{
+public:
+ /// For reading from a output CDR stream.
+ friend class TAO_InputCDR;
+
+ // The default values for the allocators and memcpy_tradeoff
+ // in these constructors are not 0, but are generated by the
+ // ORB. Refer to the constructor bodies in CDR.cpp for the
+ // code that supplies these values to the base class constructor.
+
+ /// Default constructor, allocates <size> bytes in the internal
+ /// buffer, if <size> == 0 it allocates the default size.
+ TAO_OutputCDR (size_t size = 0,
+ int byte_order = ACE_CDR_BYTE_ORDER,
+ ACE_Allocator* buffer_allocator = 0,
+ ACE_Allocator* data_block_allocator = 0,
+ ACE_Allocator* message_block_allocator = 0,
+ size_t memcpy_tradeoff = 0,
+ ACE_CDR::Octet major_version =
+ TAO_DEF_GIOP_MAJOR,
+ ACE_CDR::Octet minor_version =
+ TAO_DEF_GIOP_MINOR);
+
+ /// Build a CDR stream with an initial buffer, it will *not* remove
+ /// <data>, since it did not allocated it.
+ TAO_OutputCDR (char *data,
+ size_t size,
+ int byte_order = ACE_CDR_BYTE_ORDER,
+ ACE_Allocator* buffer_allocator = 0,
+ ACE_Allocator* data_block_allocator = 0,
+ ACE_Allocator* message_block_allocator = 0,
+ size_t memcpy_tradeoff = 0,
+ ACE_CDR::Octet major_version =
+ TAO_DEF_GIOP_MAJOR,
+ ACE_CDR::Octet minor_version =
+ TAO_DEF_GIOP_MINOR);
+
+ /// Build a CDR stream with an initial buffer, it will *not* remove
+ /// @a data since it did not allocated it, and enable fragmentation
+ /// support.
+ TAO_OutputCDR (char *data,
+ size_t size,
+ int byte_order,
+ ACE_Allocator* buffer_allocator,
+ ACE_Allocator* data_block_allocator,
+ ACE_Allocator* message_block_allocator,
+ size_t memcpy_tradeoff,
+ TAO_GIOP_Fragmentation_Strategy * fs,
+ ACE_CDR::Octet major_version,
+ ACE_CDR::Octet minor_version);
+
+ /// Build a CDR stream with an initial Message_Block chain, it will *not*
+ /// remove <data>, since it did not allocate it.
+ TAO_OutputCDR (ACE_Message_Block *data,
+ int byte_order = ACE_CDR_BYTE_ORDER,
+ size_t memcpy_tradeoff = 0,
+ ACE_CDR::Octet major_version =
+ TAO_DEF_GIOP_MAJOR,
+ ACE_CDR::Octet minor_version =
+ TAO_DEF_GIOP_MINOR);
+
+ /// Build a CDR stream with an initial data block, it will *not* remove
+ /// <data_block>, since it did not allocated it.
+ TAO_OutputCDR (ACE_Data_Block *data,
+ int byte_order = ACE_CDR_BYTE_ORDER,
+ ACE_Allocator* message_block_allocator = 0,
+ size_t memcpy_tradeoff = 0,
+ TAO_GIOP_Fragmentation_Strategy * fs = 0,
+ ACE_CDR::Octet major_version =
+ TAO_DEF_GIOP_MAJOR,
+ ACE_CDR::Octet minor_version =
+ TAO_DEF_GIOP_MINOR);
+
+ /// Destructor.
+ ~TAO_OutputCDR (void);
+
+ // @todo do we want a special method to write an array of
+ // strings and wstrings?
+
+ // = TAO specific methods.
+ static void throw_stub_exception (int error_num ACE_ENV_ARG_DECL);
+ static void throw_skel_exception (int error_num ACE_ENV_ARG_DECL);
+
+ /**
+ * @name Outgoing GIOP Fragment Related Methods
+ *
+ * These methods are only used when fragmenting outgoing GIOP
+ * requests and replies.
+ */
+ //@{
+ /// Fragment this output CDR stream if necessary.
+ /**
+ * Fragmentation will done through GIOP fragments when the length of
+ * the CDR stream length will exceed the configured threshold.
+ */
+ bool fragment_stream (ACE_CDR::ULong pending_alignment,
+ ACE_CDR::ULong pending_length);
+
+ /// Are there more data fragments to come?
+ bool more_fragments (void) const;
+
+ /// Specify whether there are more data fragments to come.
+ void more_fragments (bool more);
+
+ /// Set fragmented message attributes.
+ void message_attributes (CORBA::ULong request_id,
+ TAO_Stub * stub,
+ int message_semantics,
+ ACE_Time_Value * timeout);
+
+ /// Fragmented message request ID.
+ CORBA::ULong request_id (void) const;
+
+ /// Stub object associated with the request.
+ TAO_Stub * stub (void) const;
+
+ /// Message semantics (twoway, oneway, reply)
+ int message_semantics (void) const;
+
+ /// Maximum time to wait for outgoing message to be sent.
+ ACE_Time_Value * timeout (void) const;
+ //@}
+
+private:
+
+ // disallow copying...
+ TAO_OutputCDR (const TAO_OutputCDR& rhs);
+ TAO_OutputCDR& operator= (const TAO_OutputCDR& rhs);
+
+private:
+
+ /**
+ * @name Outgoing GIOP Fragment Related Attributes
+ *
+ * These attributes are only used when fragmenting outgoing GIOP
+ * requests and replies.
+ */
+ //@{
+ /// Strategy that sends data currently marshaled into this
+ /// TAO_OutputCDR stream if necessary.
+ TAO_GIOP_Fragmentation_Strategy * const fragmentation_strategy_;
+
+ /// Are there more data fragments to come?
+ bool more_fragments_;
+
+ /// Request ID for the request currently being marshaled.
+ CORBA::ULong request_id_;
+
+ /// Stub object associated with the request.
+ TAO_Stub * stub_;
+
+ /// Twoway, oneway, reply?
+ /**
+ * @see TAO_Transport
+ */
+ int message_semantics_;
+
+ /// Request/reply send timeout.
+ ACE_Time_Value * timeout_;
+ //@}
+
+};
+
+/**
+ * @class TAO_InputCDR
+ *
+ * @brief A CDR stream for reading, i.e. for demarshalling.
+ *
+ * This class is based on the the CORBA spec for Java (98-02-29),
+ * java class omg.org.CORBA.portable.InputStream.
+ * It diverts in a few ways:
+ * + Operations to retrieve basic types take parameters by
+ * reference.
+ * + Operations taking arrays don't have offsets, because in C++
+ * it is easier to describe an array starting from x+offset.
+ * + Operations return an error status, because exceptions are
+ * not widely available in C++ (yet).
+ * A particularly useful static member function for this buffer is
+ * an interpretive encoding routine, usable as a typecode
+ * interpreter callback. Ditto for decoding. These are used to
+ * support all OMG-IDL datatypes, even those not supported
+ * directly by put/get primitives.
+ */
+class TAO_Export TAO_InputCDR : public ACE_InputCDR
+{
+public:
+ /**
+ * Create an input stream from an arbitrary buffer, care must be
+ * exercised wrt alignment, because this contructor will *not* work
+ * if the buffer is unproperly aligned.
+ */
+ TAO_InputCDR (const char* buf,
+ size_t bufsiz,
+ int byte_order = ACE_CDR_BYTE_ORDER,
+ ACE_CDR::Octet major_version =
+ TAO_DEF_GIOP_MAJOR,
+ ACE_CDR::Octet minor_version =
+ TAO_DEF_GIOP_MINOR,
+ TAO_ORB_Core* orb_core = 0);
+
+ /// Create an empty input stream. The caller is responsible for
+ /// putting the right data and providing the right alignment.
+ TAO_InputCDR (size_t bufsiz,
+ int byte_order = ACE_CDR_BYTE_ORDER,
+ ACE_CDR::Octet major_version =
+ TAO_DEF_GIOP_MAJOR,
+ ACE_CDR::Octet minor_version =
+ TAO_DEF_GIOP_MINOR,
+ TAO_ORB_Core* orb_core = 0);
+
+ /// Create an input stream from an ACE_Message_Block
+ TAO_InputCDR (const ACE_Message_Block *data,
+ int byte_order = ACE_CDR_BYTE_ORDER,
+ ACE_CDR::Octet major_version =
+ TAO_DEF_GIOP_MAJOR,
+ ACE_CDR::Octet minor_version =
+ TAO_DEF_GIOP_MINOR,
+ TAO_ORB_Core* orb_core = 0);
+
+ /// Create an input stream from an ACE_Message_Block with an optional lock
+ /// used to protect the data.
+ TAO_InputCDR (const ACE_Message_Block *data,
+ ACE_Lock* lock,
+ int byte_order = ACE_CDR_BYTE_ORDER,
+ ACE_CDR::Octet major_version = TAO_DEF_GIOP_MAJOR,
+ ACE_CDR::Octet minor_version = TAO_DEF_GIOP_MINOR,
+ TAO_ORB_Core* orb_core = 0);
+
+
+ /// Create an input stream from an ACE_Data_Block
+ TAO_InputCDR (ACE_Data_Block *data,
+ ACE_Message_Block::Message_Flags flag = 0,
+ int byte_order = ACE_CDR_BYTE_ORDER,
+ ACE_CDR::Octet major_version =
+ TAO_DEF_GIOP_MAJOR,
+ ACE_CDR::Octet minor_version =
+ TAO_DEF_GIOP_MINOR,
+ TAO_ORB_Core* orb_core = 0);
+
+ /// Create an input stream from an ACE_Data_Block
+ TAO_InputCDR (ACE_Data_Block *data,
+ ACE_Message_Block::Message_Flags flag,
+ size_t read_pointer_position,
+ size_t write_pointer_position,
+ int byte_order = ACE_CDR_BYTE_ORDER,
+ ACE_CDR::Octet major_version =
+ TAO_DEF_GIOP_MAJOR,
+ ACE_CDR::Octet minor_version =
+ TAO_DEF_GIOP_MINOR,
+ TAO_ORB_Core* orb_core = 0);
+
+ /**
+ * Make a copy of the current stream state, but does not copy the
+ * internal buffer; so the same stream can be read multiple times
+ * efficiently.
+ */
+ TAO_InputCDR (const TAO_InputCDR& rhs);
+
+ /// When interpreting indirected TypeCodes it is useful to make a
+ /// "copy" of the stream starting in the new position.
+ TAO_InputCDR (const TAO_InputCDR& rhs,
+ size_t size,
+ ACE_CDR::Long offset);
+ /**
+ * This creates an encapsulated stream, the first byte must be (per
+ * the spec) the byte order of the encapsulation. The default
+ * values for the allocators in this constructor are not 0, but are
+ * generated by the ORB. Refer to the constructor body in CDR.cpp
+ * for the code that supplies these values to the base class
+ * constructor.
+ */
+ TAO_InputCDR (const TAO_InputCDR& rhs,
+ size_t size);
+
+ /// Create an input CDR from an output CDR.
+ TAO_InputCDR (const TAO_OutputCDR& rhs,
+ ACE_Allocator* buffer_allocator = 0,
+ ACE_Allocator* data_block_allocator = 0,
+ ACE_Allocator* message_block_allocator = 0,
+ TAO_ORB_Core* orb_core = 0);
+
+ /// Initialize the contents of one CDR from another, without data
+ /// copying and with minimimum locking overhead.
+ TAO_InputCDR (ACE_InputCDR::Transfer_Contents rhs,
+ TAO_ORB_Core* orb_core = 0);
+
+ /// destructor
+ ~TAO_InputCDR (void);
+
+ // = TAO specific methods.
+
+ /// Accessor
+ TAO_ORB_Core *orb_core (void) const;
+
+ ACE_Message_Block::Message_Flags
+ clr_mb_flags( ACE_Message_Block::Message_Flags less_flags );
+
+ // = TAO specific methods.
+ static void throw_stub_exception (int error_num ACE_ENV_ARG_DECL);
+ static void throw_skel_exception (int error_num ACE_ENV_ARG_DECL);
+
+private:
+ /// The ORB_Core, required to extract object references.
+ TAO_ORB_Core* orb_core_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined(__ACE_INLINE__)
+# include "tao/CDR.i"
+#else
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// CDR output operators for CORBA types
+
+TAO_Export CORBA::Boolean operator<< (TAO_OutputCDR &os,
+ CORBA::Short x);
+TAO_Export CORBA::Boolean operator<< (TAO_OutputCDR &os,
+ CORBA::UShort x);
+TAO_Export CORBA::Boolean operator<< (TAO_OutputCDR &os,
+ CORBA::Long x);
+TAO_Export CORBA::Boolean operator<< (TAO_OutputCDR &os,
+ CORBA::ULong x);
+TAO_Export CORBA::Boolean operator<< (TAO_OutputCDR &os,
+ CORBA::LongLong x);
+TAO_Export CORBA::Boolean operator<< (TAO_OutputCDR &os,
+ CORBA::ULongLong x);
+TAO_Export CORBA::Boolean operator<< (TAO_OutputCDR& os,
+ CORBA::LongDouble x);
+TAO_Export CORBA::Boolean operator<< (TAO_OutputCDR &os,
+ CORBA::Float x);
+TAO_Export CORBA::Boolean operator<< (TAO_OutputCDR &os,
+ CORBA::Double x);
+TAO_Export CORBA::Boolean operator<< (TAO_OutputCDR &os,
+ const CORBA::Char* x);
+TAO_Export CORBA::Boolean operator<< (TAO_OutputCDR &os,
+ const CORBA::WChar* x);
+
+// CDR input operators for CORBA types
+
+TAO_Export CORBA::Boolean operator>> (TAO_InputCDR &is,
+ CORBA::Short &x);
+TAO_Export CORBA::Boolean operator>> (TAO_InputCDR &is,
+ CORBA::UShort &x);
+TAO_Export CORBA::Boolean operator>> (TAO_InputCDR &is,
+ CORBA::Long &x);
+TAO_Export CORBA::Boolean operator>> (TAO_InputCDR &is,
+ CORBA::ULong &x);
+TAO_Export CORBA::Boolean operator>> (TAO_InputCDR &is,
+ CORBA::LongLong &x);
+TAO_Export CORBA::Boolean operator>> (TAO_InputCDR &is,
+ CORBA::ULongLong &x);
+TAO_Export CORBA::Boolean operator>> (TAO_InputCDR &is,
+ CORBA::LongDouble &x);
+TAO_Export CORBA::Boolean operator>> (TAO_InputCDR &is,
+ CORBA::Float &x);
+TAO_Export CORBA::Boolean operator>> (TAO_InputCDR &is,
+ CORBA::Double &x);
+TAO_Export CORBA::Boolean operator>> (TAO_InputCDR &is,
+ CORBA::Char* &x);
+TAO_Export CORBA::Boolean operator>> (TAO_InputCDR &is,
+ CORBA::WChar* &x);
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* __ACE_INLINE */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_CDR_H */
diff --git a/TAO/tao/CDR.i b/TAO/tao/CDR.i
new file mode 100644
index 00000000000..57162a0e0c4
--- /dev/null
+++ b/TAO/tao/CDR.i
@@ -0,0 +1,377 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO_OutputCDR::~TAO_OutputCDR (void)
+{
+}
+
+ACE_INLINE bool
+TAO_OutputCDR::more_fragments (void) const
+{
+ return this->more_fragments_;
+}
+
+ACE_INLINE void
+TAO_OutputCDR::more_fragments (bool more)
+{
+ this->more_fragments_ = more;
+}
+
+ACE_INLINE void
+TAO_OutputCDR::message_attributes (CORBA::ULong request_id,
+ TAO_Stub * stub,
+ int message_semantics,
+ ACE_Time_Value * timeout)
+{
+ this->request_id_ = request_id;
+ this->stub_ = stub;
+ this->message_semantics_ = message_semantics;
+ this->timeout_ = timeout;
+}
+
+ACE_INLINE CORBA::ULong
+TAO_OutputCDR::request_id (void) const
+{
+ return this->request_id_;
+}
+
+ACE_INLINE TAO_Stub *
+TAO_OutputCDR::stub (void) const
+{
+ return this->stub_;
+}
+
+ACE_INLINE int
+TAO_OutputCDR::message_semantics (void) const
+{
+ return this->message_semantics_;
+}
+
+ACE_INLINE ACE_Time_Value *
+TAO_OutputCDR::timeout (void) const
+{
+ return this->timeout_;
+}
+
+// -------------------------------------------------------------------
+
+ACE_INLINE
+TAO_InputCDR::TAO_InputCDR (const char *buf,
+ size_t bufsiz,
+ int byte_order,
+ ACE_CDR::Octet major_version,
+ ACE_CDR::Octet minor_version,
+ TAO_ORB_Core* orb_core)
+ : ACE_InputCDR (buf,
+ bufsiz,
+ byte_order,
+ major_version,
+ minor_version),
+ orb_core_ (orb_core)
+{
+}
+
+ACE_INLINE
+TAO_InputCDR::TAO_InputCDR (size_t bufsiz,
+ int byte_order,
+ ACE_CDR::Octet major_version,
+ ACE_CDR::Octet minor_version,
+ TAO_ORB_Core* orb_core)
+ : ACE_InputCDR (bufsiz,
+ byte_order,
+ major_version,
+ minor_version),
+ orb_core_ (orb_core)
+{
+}
+
+ACE_INLINE
+TAO_InputCDR::TAO_InputCDR (const ACE_Message_Block *data,
+ int byte_order,
+ ACE_CDR::Octet major_version,
+ ACE_CDR::Octet minor_version,
+ TAO_ORB_Core* orb_core)
+ : ACE_InputCDR (data,
+ byte_order,
+ major_version,
+ minor_version),
+ orb_core_ (orb_core)
+{
+}
+
+ACE_INLINE
+TAO_InputCDR::TAO_InputCDR (const ACE_Message_Block *data,
+ ACE_Lock* lock,
+ int byte_order,
+ ACE_CDR::Octet major_version,
+ ACE_CDR::Octet minor_version,
+ TAO_ORB_Core* orb_core)
+ : ACE_InputCDR (data,
+ byte_order,
+ major_version,
+ minor_version,
+ lock),
+ orb_core_ (orb_core)
+{
+}
+
+ACE_INLINE
+TAO_InputCDR::TAO_InputCDR (ACE_Data_Block *data,
+ ACE_Message_Block::Message_Flags flag,
+ int byte_order,
+ ACE_CDR::Octet major_version,
+ ACE_CDR::Octet minor_version,
+ TAO_ORB_Core* orb_core)
+ : ACE_InputCDR (data,
+ flag,
+ byte_order,
+ major_version,
+ minor_version),
+ orb_core_ (orb_core)
+{
+}
+
+
+ACE_INLINE
+TAO_InputCDR::TAO_InputCDR (ACE_Data_Block *data,
+ ACE_Message_Block::Message_Flags flag,
+ size_t rd_pos,
+ size_t wr_pos,
+ int byte_order,
+ ACE_CDR::Octet major_version,
+ ACE_CDR::Octet minor_version,
+ TAO_ORB_Core* orb_core)
+ : ACE_InputCDR (data,
+ flag,
+ rd_pos,
+ wr_pos,
+ byte_order,
+ major_version,
+ minor_version),
+ orb_core_ (orb_core)
+{
+}
+
+
+ACE_INLINE
+TAO_InputCDR::TAO_InputCDR (const TAO_InputCDR& rhs,
+ size_t size,
+ ACE_CDR::Long offset)
+ : ACE_InputCDR (rhs,
+ size,
+ offset),
+ orb_core_ (rhs.orb_core_)
+{
+}
+
+ACE_INLINE
+TAO_InputCDR::TAO_InputCDR (const TAO_InputCDR& rhs,
+ size_t size)
+ : ACE_InputCDR (rhs,
+ size),
+ orb_core_ (rhs.orb_core_)
+{
+}
+
+ACE_INLINE
+TAO_InputCDR::TAO_InputCDR (const TAO_InputCDR& rhs)
+ : ACE_InputCDR (rhs),
+ orb_core_ (rhs.orb_core_)
+{
+}
+
+ACE_INLINE
+TAO_InputCDR::TAO_InputCDR (ACE_InputCDR::Transfer_Contents rhs,
+ TAO_ORB_Core* orb_core)
+ : ACE_InputCDR (rhs),
+ orb_core_ (orb_core)
+{
+}
+
+ACE_INLINE
+TAO_InputCDR::~TAO_InputCDR (void)
+{
+}
+
+ACE_INLINE TAO_ORB_Core*
+TAO_InputCDR::orb_core (void) const
+{
+ return this->orb_core_;
+}
+
+// ****************************************************************
+
+ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &os,
+ CORBA::Short x)
+{
+ return
+ os.fragment_stream (ACE_CDR::SHORT_ALIGN,
+ sizeof (CORBA::Short))
+ && static_cast<ACE_OutputCDR &> (os) << x;
+}
+
+ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &os,
+ CORBA::UShort x)
+{
+ return
+ os.fragment_stream (ACE_CDR::SHORT_ALIGN,
+ sizeof (CORBA::UShort))
+ && static_cast<ACE_OutputCDR &> (os) << x;
+}
+
+ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &os,
+ CORBA::Long x)
+{
+ return
+ os.fragment_stream (ACE_CDR::LONG_ALIGN,
+ sizeof (CORBA::Long))
+ && static_cast<ACE_OutputCDR &> (os) << x;
+}
+
+ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &os,
+ CORBA::ULong x)
+{
+ return
+ os.fragment_stream (ACE_CDR::LONG_ALIGN,
+ sizeof (CORBA::ULong))
+ && static_cast<ACE_OutputCDR &> (os) << x;
+}
+
+ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &os,
+ CORBA::LongLong x)
+{
+ return
+ os.fragment_stream (ACE_CDR::LONGLONG_ALIGN,
+ sizeof (CORBA::LongLong))
+ && static_cast<ACE_OutputCDR &> (os) << x;
+}
+
+ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &os,
+ CORBA::ULongLong x)
+{
+ return
+ os.fragment_stream (ACE_CDR::LONGLONG_ALIGN,
+ sizeof (CORBA::ULongLong))
+ && static_cast<ACE_OutputCDR &> (os) << x;
+}
+
+ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR& os,
+ CORBA::LongDouble x)
+{
+ return
+ os.fragment_stream (ACE_CDR::LONGDOUBLE_ALIGN,
+ sizeof (CORBA::LongDouble))
+ && static_cast<ACE_OutputCDR &> (os) << x;
+}
+
+ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &os,
+ CORBA::Float x)
+{
+ return
+ os.fragment_stream (ACE_CDR::LONG_ALIGN,
+ sizeof (CORBA::Float))
+ && static_cast<ACE_OutputCDR &> (os) << x;
+}
+
+ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &os,
+ CORBA::Double x)
+{
+ return
+ os.fragment_stream (ACE_CDR::LONGLONG_ALIGN,
+ sizeof (CORBA::Double))
+ && static_cast<ACE_OutputCDR &> (os) << x;
+}
+
+ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &os,
+ const char * x)
+{
+ return
+ os.fragment_stream (ACE_CDR::OCTET_ALIGN,
+ sizeof (char))
+ && static_cast<ACE_OutputCDR &> (os) << x;
+}
+
+ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &os,
+ const CORBA::WChar * x)
+{
+ return
+ os.fragment_stream ((sizeof (CORBA::WChar) == 2
+ ? ACE_CDR::SHORT_ALIGN
+ : ACE_CDR::LONG_ALIGN),
+ sizeof (CORBA::WChar))
+ && static_cast<ACE_OutputCDR &> (os) << x;
+}
+
+// ****************************************************************
+
+ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is,
+ CORBA::Short &x)
+{
+ return static_cast<ACE_InputCDR &> (is) >> x;
+}
+
+ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is,
+ CORBA::UShort &x)
+{
+ return static_cast<ACE_InputCDR &> (is) >> x;
+}
+
+ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is,
+ CORBA::Long &x)
+{
+ return static_cast<ACE_InputCDR&> (is) >> x;
+}
+
+ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is,
+ CORBA::ULong &x)
+{
+ return static_cast<ACE_InputCDR &> (is) >> x;
+}
+
+ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is,
+ CORBA::LongLong &x)
+{
+ return static_cast<ACE_InputCDR &> (is) >> x;
+}
+
+ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is,
+ CORBA::ULongLong &x)
+{
+ return static_cast<ACE_InputCDR &> (is) >> x;
+}
+
+ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is,
+ CORBA::LongDouble &x)
+{
+ return static_cast<ACE_InputCDR &> (is) >> x;
+}
+
+ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is,
+ CORBA::Float &x)
+{
+ return static_cast<ACE_InputCDR &> (is) >> x;
+}
+
+ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is,
+ CORBA::Double &x)
+{
+ return static_cast<ACE_InputCDR &> (is) >> x;
+}
+
+ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is,
+ CORBA::Char* &x)
+{
+ return static_cast<ACE_InputCDR &> (is) >> x;
+}
+
+ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is,
+ CORBA::WChar* &x)
+{
+ return static_cast<ACE_InputCDR &> (is) >> x;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/CONV_FRAME.pidl b/TAO/tao/CONV_FRAME.pidl
new file mode 100644
index 00000000000..671887bff88
--- /dev/null
+++ b/TAO/tao/CONV_FRAME.pidl
@@ -0,0 +1,49 @@
+// -*- IDL -*-
+
+/**
+ * @file CONV_FRAME.pidl
+ *
+ * $Id$
+ *
+ * This file is used to generate CONV_FRAMEC.{h,cpp}, using the
+ * following command:
+ *
+ * tao_idl
+ * -o orig -Ge 1 -GA -SS -Sci -Sc
+ * -Wb,export_macro=TAO_Export
+ * -Wb,export_include="tao/TAO_Export.h"
+ * -Wb,pre_include="ace/pre.h"
+ * -Wb,post_include="ace/post.h"
+ * -Wb,versioning_begin=TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+ * -Wb,versioning_end=TAO_END_VERSIONED_NAMESPACE_DECL
+ * CONV_FRAME.pidl
+ *
+ * The files are ready to use.
+ */
+
+#ifndef TAO_CORBA_CONV_FRAME_PIDL
+#define TAO_CORBA_CONV_FRAME_PIDL
+
+#pragma prefix "omg.org"
+
+module CONV_FRAME {
+ typedef unsigned long CodeSetId;
+ typedef sequence<CodeSetId> CodeSetIdSeq;
+
+ struct CodeSetComponent {
+ CodeSetId native_code_set;
+ CodeSetIdSeq conversion_code_sets;
+ };
+
+ struct CodeSetComponentInfo {
+ CodeSetComponent ForCharData;
+ CodeSetComponent ForWcharData;
+ };
+
+ struct CodeSetContext {
+ CodeSetId char_data;
+ CodeSetId wchar_data;
+ };
+};
+
+#endif /* TAO_CORBA_CONV_FRAME_PIDL */
diff --git a/TAO/tao/CORBALOC_Parser.cpp b/TAO/tao/CORBALOC_Parser.cpp
new file mode 100644
index 00000000000..d3b8fbb84a7
--- /dev/null
+++ b/TAO/tao/CORBALOC_Parser.cpp
@@ -0,0 +1,391 @@
+#include "tao/CORBALOC_Parser.h"
+#include "tao/ORB_Core.h"
+#include "tao/Stub.h"
+#include "tao/MProfile.h"
+#include "tao/Connector_Registry.h"
+#include "tao/Transport_Connector.h"
+#include "tao/Protocol_Factory.h"
+#include "tao/debug.h"
+#include "ace/Vector_T.h"
+#include "ace/INET_Addr.h"
+#include "ace/OS_NS_string.h"
+
+#include "ace/os_include/os_netdb.h"
+
+#if !defined(__ACE_INLINE__)
+#include "tao/CORBALOC_Parser.i"
+#endif /* __ACE_INLINE__ */
+
+ACE_RCSID (tao,
+ CORBALOC_Parser,
+ "$Id$")
+
+static const char prefix[] = "corbaloc:";
+static const size_t prefix_len = sizeof prefix - 1;
+static const char rir_token[] = "rir:";
+static const size_t rir_token_len = sizeof rir_token - 1;
+static const char iiop_token[] = "iiop:";
+static const char iiop_token_len = sizeof iiop_token - 1;
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_CORBALOC_Parser::~TAO_CORBALOC_Parser (void)
+{
+}
+
+int
+TAO_CORBALOC_Parser::match_prefix (const char *ior_string) const
+{
+ // Check if the prefix is 'corbaloc:' and return the result.
+ return (ACE_OS::strncmp (ior_string,
+ prefix,
+ prefix_len) == 0);
+}
+
+CORBA::Object_ptr
+TAO_CORBALOC_Parser::make_stub_from_mprofile (CORBA::ORB_ptr orb,
+ TAO_MProfile &mprofile
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ // Create a TAO_Stub.
+ TAO_Stub *data = orb->orb_core ()->create_stub ((const char *) 0,
+ mprofile
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Object::_nil ());
+
+ TAO_Stub_Auto_Ptr safe_data (data);
+
+ CORBA::Object_var obj = orb->orb_core ()->create_object (data);
+
+ if (!CORBA::is_nil (obj.in ()))
+ {
+ /// All is well, so release the stub object from its
+ /// auto_ptr.
+ (void) safe_data.release ();
+
+ /// Return the object reference to the application.
+ return obj._retn ();
+ }
+
+ /// Shouldnt come here: if so, return nil reference.
+ return CORBA::Object::_nil ();
+}
+
+CORBA::Object_ptr
+TAO_CORBALOC_Parser::parse_string_rir_helper (const char * ior,
+ CORBA::ORB_ptr orb
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ // Pass the key string as an argument to resolve_initial_references.
+ // NameService is the default if an empty key string is supplied.
+ const char *objkey = ior + rir_token_len;
+ if (*objkey == '/') // there is an explicit object key, which may
+ // validly be null.
+ objkey++;
+
+ CORBA::Object_var rir_obj =
+ orb->resolve_initial_references (*objkey == '\0' ? "NameService" :
+ objkey
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Object::_nil ());
+
+ return rir_obj._retn ();
+}
+
+CORBA::Object_ptr
+TAO_CORBALOC_Parser::parse_string (const char * ior,
+ CORBA::ORB_ptr orb
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ // The decomposition of a corbaloc string is in Section 13.6.10.
+ //
+ // following the "corbaloc:"
+ // a comma separated list of <prot_addr> strings
+ // for each,
+ // Separate out the key, delimited by '/'
+ // Split out the various parts of our corbaloc string, comma-delimited
+ // For each part
+ // Determine the protocol
+ // If rir, defer to another function and return the object
+ // If iiop, make the profile with <endpoint>:<port>/<key>
+ // If another protocol, use <remainder>/<key>
+ // Search through the collection of protocols for the correct one
+ // If not found, throw exception
+ // If found, make our_connector from it.
+ // our_connector->make_mprofile_unchecked (...);
+ // object = this->make_stub_from_mprofile (...);
+ // Return the object
+
+ // Skip the prefix. We know it is there because this method is only
+ // called if match_prefix() returns 1.
+ ior += ACE_OS::strlen(prefix);
+
+ // First check for rir
+ if (ACE_OS::strncmp (ior,rir_token,rir_token_len) == 0)
+ return this->parse_string_rir_helper (ior,orb
+ ACE_ENV_ARG_PARAMETER);
+
+ // set up space for parsed endpoints. there will be at least 1, and
+ // most likely commas will separate endpoints, although they could be
+ // part of an endpoint address for some protocols.
+ size_t max_endpoint_count = 1;
+ for (const char *comma = ACE_OS::strchr (ior,',');
+ comma;
+ comma = ACE_OS::strchr (comma+1,','))
+ max_endpoint_count++;
+
+ ACE_Array<parsed_endpoint> endpoints(max_endpoint_count);
+ endpoints.size (0);
+
+ // Get the Connector Registry from the ORB.
+ TAO_Connector_Registry *conn_reg =
+ orb->orb_core ()->connector_registry(ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Object::_nil ());
+
+ while (1) { // will loop on comma only.
+ size_t len = 0;
+ size_t ndx = endpoints.size();
+ endpoints.size(ndx+1);
+ int uiop_compatible = 0;
+ TAO_ConnectorSetIterator conn_iter = 0;
+ for (conn_iter = conn_reg->begin();
+ conn_iter != conn_reg->end() &&
+ endpoints[ndx].profile_ == 0;
+ conn_iter ++)
+ {
+ endpoints[ndx].profile_ =
+ (*conn_iter)->corbaloc_scan(ior,len
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Object::_nil ());
+
+ if (endpoints[ndx].profile_)
+ {
+ endpoints[ndx].obj_key_sep_ =
+ (*conn_iter)->object_key_delimiter();
+ uiop_compatible = (endpoints[ndx].obj_key_sep_ == '|');
+ this->make_canonical (ior,len,endpoints[ndx].prot_addr_
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Object::_nil ());
+ ior += len;
+ break;
+ }
+ }
+
+ if (endpoints[ndx].profile_ == 0)
+ {
+ if (TAO_debug_level)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT("(%P|%t) TAO_CORBALOC_Parser::parse_string ")
+ ACE_TEXT("could not parse from %s"),
+ ACE_TEXT_CHAR_TO_TCHAR(ior)));
+ ACE_THROW_RETURN (CORBA::BAD_PARAM (CORBA::OMGVMCID | 10,
+ CORBA::COMPLETED_NO),
+ CORBA::Object::_nil ());
+ }
+ if (*ior == ',') // more endpoints follow
+ {
+ ior++;
+ continue;
+ }
+
+ if (*ior == '/') // found key separator
+ {
+ ior ++;
+ break;
+ }
+
+ if (*ior == '\0') // no key separator appended, use default key
+ {
+ break;
+ }
+
+ if (uiop_compatible && *(ior - 1) == '|')
+ // Assume this is an old uiop style corbaloc. No need to warn here,
+ // the UIOP_Connector::corbaloc_scan already did.
+ break;
+
+ // anything else is a violation.
+ if (TAO_debug_level)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT("(%P|%t) TAO_CORBALOC_Parser::parse_string ")
+ ACE_TEXT("could not parse from %s"),
+ ACE_TEXT_CHAR_TO_TCHAR(ior)));
+ ACE_THROW_RETURN (CORBA::BAD_PARAM (CORBA::OMGVMCID | 10,
+ CORBA::COMPLETED_NO),
+ CORBA::Object::_nil ());
+ } // end of while
+
+ // At this point, ior points at the start of the object key
+ ACE_CString obj_key (*ior ? ior : (const char *)"NameService");
+
+ // now take the collection of endpoints along with the decoded key and
+ // mix them together to get the mprofile.
+ TAO_MProfile mprofile (endpoints.size());
+
+ for (size_t i = 0; i < endpoints.size(); i++)
+ {
+ ACE_CString full_ep = endpoints[i].prot_addr_ +
+ endpoints[i].obj_key_sep_ +
+ obj_key;
+ const char * str = full_ep.c_str();
+ endpoints[i].profile_->parse_string (str ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Object::_nil ());
+ int share = orb->orb_core()->orb_params()->shared_profile();
+ if (mprofile.give_profile(endpoints[i].profile_, share) != -1)
+ endpoints[i].profile_ = 0;
+ else
+ {
+ // Although this ought never happen, we want to make some
+ // indication back to the caller, more as an audit trail than
+ // anything else. The only failure possible is that there was
+ // insufficient heap to allocate the mprofile, hence the
+ // mprofile's size is 0, and give_profile fails.
+ if (TAO_debug_level)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT("(%P|%t) TAO_CORBALOC_Parser::parse_string ")
+ ACE_TEXT("mprofile.give_profile failed for i = %d\n"),
+ i));
+ ACE_THROW_RETURN (CORBA::BAD_PARAM (CORBA::OMGVMCID | 10,
+ CORBA::COMPLETED_NO),
+ CORBA::Object::_nil ());
+ }
+ }
+
+ CORBA::Object_ptr object = CORBA::Object::_nil ();
+ // Get an object stub out.
+ object = this->make_stub_from_mprofile (orb,
+ mprofile
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Object::_nil ());
+
+ return object;
+}
+
+void
+TAO_CORBALOC_Parser::make_canonical (const char *ior,
+ size_t prot_addr_len,
+ ACE_CString &canonical_endpoint
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ const char *separator = ACE_OS::strchr (ior, ':');
+
+ // A special case for handling iiop
+ if (ior[0] != ':' && ACE_OS::strncmp (ior,iiop_token,iiop_token_len) != 0)
+ {
+ canonical_endpoint.set (separator+1,
+ prot_addr_len - (separator - ior) - 1,1);
+ return;
+ }
+
+ const char *addr_base = separator+1;
+ const char *addr_tail = ior + prot_addr_len;
+ // skip past version, if any
+ separator = ACE_OS::strchr (addr_base,'@');
+ if (separator != 0 && separator < addr_tail)
+ {
+ canonical_endpoint.set (addr_base,(separator - addr_base)+1,1);
+ addr_base = separator + 1;
+ }
+ else
+ canonical_endpoint.clear ();
+
+ ACE_CString raw_host;
+ ACE_CString raw_port;
+ separator = ACE_OS::strchr (addr_base,':');
+#if defined (ACE_HAS_IPV6)
+ // IPv6 numeric address in host string?
+
+ // Check if this is an address containing a decimal IPv6 address representation.
+ if (addr_base < addr_tail && addr_base[0] == '[')
+ {
+ // In this case we have to find the end of the numeric address and
+ // start looking for the port separator from there.
+ const char *cp_pos = ACE_OS::strchr(addr_base, ']');
+ if (cp_pos == 0 || cp_pos >= addr_tail)
+ {
+ // No valid IPv6 address specified but that will come out later.
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_ERROR,
+ ACE_TEXT ("\nTAO (%P|%t) TAO_CORBALOC_Parser: ")
+ ACE_TEXT ("Invalid IPv6 decimal address specified.\n")));
+ }
+ separator = 0;
+ }
+ else
+ {
+ if (cp_pos[1] == ':') // Look for a port
+ separator = cp_pos + 1;
+ else
+ separator = 0;
+ }
+ }
+#endif /* ACE_HAS_IPV6 */
+
+ if (separator != 0 && separator < addr_tail)
+ {
+ // we have a port number
+ raw_host.set (addr_base, (separator - addr_base), 1);
+ raw_port.set (separator, (addr_tail - separator), 1);
+ }
+ else
+ {
+ // we must default port #
+ if (addr_base < addr_tail)
+ raw_host.set (addr_base, (addr_tail - addr_base),1);
+ raw_port.set (":2809");
+ }
+
+ if (raw_host.length() == 0)
+ {
+ ACE_INET_Addr host_addr;
+
+ char tmp_host [MAXHOSTNAMELEN + 1];
+
+ // If no host is specified: assign the default host, i.e. the
+ // local host.
+ if (host_addr.get_host_name (tmp_host,
+ sizeof (tmp_host)) != 0)
+ {
+ // Can't get the IP address since the INET_Addr wasn't
+ // initialized. Just throw an exception.
+
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) ")
+ ACE_TEXT ("cannot determine hostname.\n")));
+
+ ACE_THROW (CORBA::INV_OBJREF
+ (CORBA::SystemException::_tao_minor_code
+ (TAO::VMCID, EINVAL),
+ CORBA::COMPLETED_NO));
+ }
+ else
+ {
+ canonical_endpoint += tmp_host;
+ }
+ }
+ else
+ {
+ canonical_endpoint += raw_host;
+ }
+
+ canonical_endpoint += raw_port;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DEFINE (TAO_CORBALOC_Parser,
+ ACE_TEXT ("CORBALOC_Parser"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (TAO_CORBALOC_Parser),
+ ACE_Service_Type::DELETE_THIS |
+ ACE_Service_Type::DELETE_OBJ,
+ 0)
+
+ACE_FACTORY_DEFINE (TAO, TAO_CORBALOC_Parser)
+
diff --git a/TAO/tao/CORBALOC_Parser.h b/TAO/tao/CORBALOC_Parser.h
new file mode 100644
index 00000000000..b9ecab51756
--- /dev/null
+++ b/TAO/tao/CORBALOC_Parser.h
@@ -0,0 +1,106 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file CORBALOC_Parser.h
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan (coryan@cs.wustl.edu)
+ * @author Priyanka Gontla (pgontla@uci.edu)
+ */
+//=============================================================================
+
+
+#ifndef TAO_CORBALOC_PARSER_H
+#define TAO_CORBALOC_PARSER_H
+#include /**/ "ace/pre.h"
+
+#include "tao/IOR_Parser.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/Service_Config.h"
+#include "ace/Array.h"
+#include "tao/Profile.h"
+#include "ace/SString.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_MProfile;
+
+/**
+ * @class TAO_CORBALOC_Parser
+ *
+ * @brief Implements the <corbaloc:> IOR format
+ *
+ * This class implements the <corbaloc:> IOR format.
+ * It is dynamically loaded by the ORB and used to parse the
+ * string to separate the individual <obj_addr> from the list of object
+ * addresses <obj_addr_list>.
+ */
+class TAO_CORBALOC_Parser : public TAO_IOR_Parser
+{
+public:
+ /// Constructor
+ TAO_CORBALOC_Parser (void);
+
+ /// The destructor
+ virtual ~TAO_CORBALOC_Parser (void);
+
+ /// = The IOR_Parser methods, please read the documentation in
+ /// IOR_Parser.h
+ virtual int match_prefix (const char *ior_string) const;
+
+ /// Parse the ior-string that is passed.
+ virtual CORBA::Object_ptr parse_string (const char *ior,
+ CORBA::ORB_ptr orb
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+private:
+
+ /**
+ * Make a stub from the MProfile that is created in
+ * parse_string_mprofile_helper. Using this stub, create an object
+ * reference which is sent to the application.
+ */
+ CORBA::Object_ptr make_stub_from_mprofile (CORBA::ORB_ptr orb,
+ TAO_MProfile &mprofile
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Gets the pointer to the key_string when the protocol used is RIR
+ CORBA::Object_ptr parse_string_rir_helper (const char *corbaloc_name,
+ CORBA::ORB_ptr orb
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ void make_canonical (const char *ior,
+ size_t ior_len,
+ ACE_CString &canonical_endpoint
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ struct parsed_endpoint {
+ parsed_endpoint ();
+ ~parsed_endpoint ();
+ TAO_Profile *profile_;
+ char obj_key_sep_;
+ ACE_CString prot_addr_;
+ };
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/CORBALOC_Parser.i"
+#endif /* __ACE_INLINE__ */
+
+ACE_STATIC_SVC_DECLARE_EXPORT (TAO, TAO_CORBALOC_Parser)
+ACE_FACTORY_DECLARE (TAO, TAO_CORBALOC_Parser)
+
+#include /**/ "ace/post.h"
+#endif /* TAO_CORBALOC_PARSER_H */
diff --git a/TAO/tao/CORBALOC_Parser.i b/TAO/tao/CORBALOC_Parser.i
new file mode 100644
index 00000000000..53f39cf5a05
--- /dev/null
+++ b/TAO/tao/CORBALOC_Parser.i
@@ -0,0 +1,25 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO_CORBALOC_Parser::TAO_CORBALOC_Parser (void)
+{
+}
+
+ACE_INLINE
+TAO_CORBALOC_Parser::parsed_endpoint::parsed_endpoint (void)
+ : profile_ (0)
+{
+}
+
+ACE_INLINE
+TAO_CORBALOC_Parser::parsed_endpoint::~parsed_endpoint (void)
+{
+ if (this->profile_ != 0)
+ this->profile_->_decr_refcnt();
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/CORBANAME_Parser.cpp b/TAO/tao/CORBANAME_Parser.cpp
new file mode 100644
index 00000000000..8924feee395
--- /dev/null
+++ b/TAO/tao/CORBANAME_Parser.cpp
@@ -0,0 +1,169 @@
+// $Id$
+
+#include "tao/CORBANAME_Parser.h"
+#include "tao/ORB.h"
+#include "tao/Object.h"
+#include "tao/SystemException.h"
+#include "tao/UB_String_Arguments.h"
+#include "tao/Invocation_Adapter.h"
+#include "tao/debug.h"
+
+#include "ace/Log_Msg.h"
+#include "ace/SString.h"
+#include "ace/OS_NS_string.h"
+
+
+ACE_RCSID (tao,
+ CORBANAME_Parser,
+ "$Id$")
+
+static const char corbaname_prefix[] = "corbaname:";
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_CORBANAME_Parser::~TAO_CORBANAME_Parser (void)
+{
+}
+
+int
+TAO_CORBANAME_Parser::match_prefix (const char *ior_string) const
+{
+ return (ACE_OS::strncmp (ior_string,
+ corbaname_prefix,
+ sizeof corbaname_prefix - 1) == 0);
+}
+
+CORBA::Object_ptr
+TAO_CORBANAME_Parser::
+parse_string_dynamic_request_helper (CORBA::Object_ptr naming_context,
+ ACE_CString &key_string
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ TAO::Arg_Traits<CORBA::Object>::ret_val _tao_retval;
+ TAO::Arg_Traits<CORBA::Char *>::in_arg_val _tao_id (key_string.c_str ());
+
+ TAO::Argument *_tao_signature [] =
+ {
+ &_tao_retval,
+ &_tao_id
+ };
+
+ TAO::Invocation_Adapter tao_call (naming_context,
+ _tao_signature,
+ 2,
+ "resolve_str",
+ 11,
+ 0);
+
+ tao_call.invoke (0, 0 ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (_tao_retval.excp ());
+
+ return _tao_retval.retn ();
+}
+
+CORBA::Object_ptr
+TAO_CORBANAME_Parser::parse_string (const char *ior,
+ CORBA::ORB_ptr orb
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+
+ // Skip the prefix, we know it is there because this method in only
+ // called if <match_prefix> returns 1.
+ const char *corbaname =
+ ior + sizeof corbaname_prefix - 1;
+
+ CORBA::Object_ptr obj = CORBA::Object::_nil ();
+
+ ACE_TRY
+ {
+ // The position of the seperator between the obj_addr and key
+ // string
+ ACE_CString::size_type pos_seperator = 0;
+
+ ACE_CString corbaname_str (corbaname, 0, 1);
+
+ pos_seperator = corbaname_str.find ("#", 0);
+
+ // Get the Key String
+ ACE_CString key_string;
+
+ if (pos_seperator != ACE_CString::npos)
+ {
+ key_string = corbaname_str.substring (pos_seperator + 1,
+ ACE_CString::npos);
+ }
+
+ // Prepare a suitable corbaloc string for the name service.
+ // CORBALOC assumes "NameService" for the object key if none
+ // is provided, so just pass everything between "corbaname:"
+ // and "#" as the address
+ ACE_CString corbaloc_addr ("corbaloc:", 0, 1);
+ corbaloc_addr += corbaname_str.substring (0, pos_seperator);
+
+ // Obtain a reference to the naming context
+ CORBA::Object_var name_context =
+ orb->string_to_object (corbaloc_addr.c_str ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ // Check if the Object reference is nil.
+ if (CORBA::is_nil (name_context.in ()))
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Cannot resolve Naming Service: CORBANAME_Parser\n"),
+ 0);
+
+ CORBA::Boolean is_a =
+ name_context->_is_a ("IDL:omg.org/CosNaming/NamingContextExt:1.0"
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (!is_a)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Cannot narrow Naming Service: "
+ "CORBANAME_Parser\n"),
+ 0);
+ }
+
+ if (key_string.length () != 0)
+ {
+
+ // Make a dynamic request for resolve_str in this naming context
+ obj = this->parse_string_dynamic_request_helper (name_context.in (),
+ key_string
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ else
+ { // There was no key string which implies that the caller wants
+ // the object reference of the naming service.
+ obj = name_context._retn ();
+ }
+ }
+ ACE_CATCH (CORBA::SystemException, ex)
+ {
+ if (TAO_debug_level >= 4)
+ {
+ ACE_PRINT_EXCEPTION (ex, "CORBANAME_Parser");
+ }
+ }
+ ACE_ENDTRY;
+ ACE_CHECK_RETURN (CORBA::Object::_nil ());
+
+ return obj;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DEFINE (TAO_CORBANAME_Parser,
+ ACE_TEXT ("CORBANAME_Parser"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (TAO_CORBANAME_Parser),
+ ACE_Service_Type::DELETE_THIS |
+ ACE_Service_Type::DELETE_OBJ,
+ 0)
+
+ACE_FACTORY_DEFINE (TAO, TAO_CORBANAME_Parser)
+
diff --git a/TAO/tao/CORBANAME_Parser.h b/TAO/tao/CORBANAME_Parser.h
new file mode 100644
index 00000000000..9580d770885
--- /dev/null
+++ b/TAO/tao/CORBANAME_Parser.h
@@ -0,0 +1,68 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file CORBANAME_Parser.h
+ *
+ * $Id$
+ *
+ * @author Priyanka Gontla (pgontla@uci.edu)
+ */
+//=============================================================================
+
+
+#ifndef TAO_CORBANAME_PARSER_H
+#define TAO_CORBANAME_PARSER_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/IOR_Parser.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/Service_Config.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_CORBANAME_Parser
+ *
+ * @brief Implements the <corbaname:> IOR format
+ *
+ * This class implements the <corbaname:> IOR format.
+ * It is dynamically loaded by the ORB and used to get reference
+ * to a naming service at the given address and port and then resolve an
+ * object in that context.
+ */
+class TAO_CORBANAME_Parser : public TAO_IOR_Parser
+{
+public:
+
+ /// The destructor
+ virtual ~TAO_CORBANAME_Parser (void);
+
+ // = The IOR_Parser methods, please read the documentation in
+ // IOR_Parser.h
+ virtual int match_prefix (const char *ior_string) const;
+ virtual CORBA::Object_ptr parse_string (const char *ior,
+ CORBA::ORB_ptr orb
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ private:
+ virtual CORBA::Object_ptr
+ parse_string_dynamic_request_helper (CORBA::Object_ptr naming_context,
+ ACE_CString &key_string
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE_EXPORT (TAO, TAO_CORBANAME_Parser)
+ACE_FACTORY_DECLARE (TAO, TAO_CORBANAME_Parser)
+
+#include /**/ "ace/post.h"
+#endif /* TAO_CORBANAME_PARSER_H */
diff --git a/TAO/tao/CORBA_String.cpp b/TAO/tao/CORBA_String.cpp
new file mode 100644
index 00000000000..f1787d50852
--- /dev/null
+++ b/TAO/tao/CORBA_String.cpp
@@ -0,0 +1,145 @@
+#include "tao/CORBA_String.h"
+#include "tao/String_Manager_T.h"
+
+#include "ace/OS_NS_string.h"
+#include "ace/OS_NS_wchar.h"
+#include "ace/OS_Memory.h"
+
+// FUZZ: disable check_for_streams_include
+#include "ace/streams.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/CORBA_String.inl"
+#endif /* ! __ACE_INLINE__ */
+
+ACE_RCSID (tao,
+ CORBA_String,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// *************************************************************
+// C++ iostream operators for (W)String_var and (W)String_out
+// *************************************************************
+
+#if !defined (ACE_LACKS_IOSTREAM_TOTALLY)
+
+ostream &
+operator<< (ostream &os, const CORBA::String_var &sv)
+{
+ os << sv.in ();
+ return os;
+}
+
+istream &
+operator>> (istream &is, CORBA::String_var &sv)
+{
+ is.seekg (0, ios::end);
+ sv = CORBA::string_alloc (is.tellg ());
+ is.seekg (0, ios::beg);
+ is >> sv.inout ();
+ return is;
+}
+
+ostream &
+operator<< (ostream &os, CORBA::String_out &so)
+{
+ os << so.ptr ();
+ return os;
+}
+
+istream &
+operator>> (istream &is, CORBA::String_out &so)
+{
+ is.seekg (0, ios::end);
+ so = CORBA::string_alloc (is.tellg ());
+ is.seekg (0, ios::beg);
+ is >> so.ptr ();
+ return is;
+}
+
+// Until we implement WString support for platforms with a
+// 4-byte wchar_t, we just define the following to emit
+// the CORBA::WChars one by one.
+
+ostream &
+operator<< (ostream &os, const CORBA::WString_var &wsv)
+{
+ CORBA::ULong const len =
+ static_cast <CORBA::ULong> (ACE_OS::strlen (wsv.in ()));
+
+ for (CORBA::ULong i = 0; i < len; ++i)
+ {
+ os << wsv[i];
+ }
+
+ return os;
+}
+
+istream &
+operator>> (istream &is, CORBA::WString_var &wsv)
+{
+ is.seekg (0, ios::end);
+ // @@ is.tellg()/sizeof(CORBA::WChar) instead?
+ CORBA::ULong const len = is.tellg ();
+ wsv = CORBA::wstring_alloc (len);
+ is.seekg (0, ios::beg);
+
+ for (CORBA::ULong i = 0; i < len; ++i)
+ {
+ CORBA::WChar wc = 0;
+
+ // Unformatted input is used to work around overloaded
+ // extraction operator (>>) ambiguities on some platforms.
+ is.read (reinterpret_cast<char *> (&wc), sizeof (wc));
+
+ wsv[i] = wc;
+ }
+
+ wsv[len] = 0; // NULL terminate
+
+ return is;
+}
+
+ostream &
+operator<< (ostream &os, CORBA::WString_out &wso)
+{
+ CORBA::WChar *tmp = wso.ptr ();
+ const size_t len = ACE_OS::strlen (tmp);
+
+ for (size_t i = 0; i < len; ++i)
+ {
+ os << tmp[i];
+ }
+
+ return os;
+}
+
+istream &
+operator>> (istream &is, CORBA::WString_out &wso)
+{
+ is.seekg (0, ios::end);
+ // @@ is.tellg()/sizeof(CORBA::WChar) instead?
+ const CORBA::ULong len = is.tellg ();
+ wso = CORBA::wstring_alloc (len);
+ is.seekg (0, ios::beg);
+
+ for (CORBA::ULong i = 0; i < len; ++i)
+ {
+ CORBA::WChar wc = 0;
+
+ // Unformatted input is used to work around overloaded
+ // extraction operator (>>) ambiguities on some platforms.
+ is.read (reinterpret_cast<char *> (&wc), sizeof (wc));
+
+ wso.ptr ()[i] = wc;
+ }
+
+ wso.ptr ()[len] = 0; // NULL terminate
+
+ return is;
+}
+
+#endif /* ACE_LACKS_IOSTREAM_TOTALLY */
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/CORBA_String.h b/TAO/tao/CORBA_String.h
new file mode 100644
index 00000000000..810a73e0424
--- /dev/null
+++ b/TAO/tao/CORBA_String.h
@@ -0,0 +1,297 @@
+// -*- C++ -*-
+//=============================================================================
+/**
+ * @file CORBA_String.h
+ *
+ * $Id$
+ *
+ * Header file for the CORBA string types.
+ *
+ * @author DOC Group at Wash U, UCI, and Vanderbilt U.
+ */
+//=============================================================================
+
+#ifndef TAO_CORBA_STRING_H
+#define TAO_CORBA_STRING_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/TAO_Export.h"
+#include "tao/Basic_Types.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/String_Traits_Base_T.h"
+// For the (W)String_var and (W)String_out iostream operators.
+#include "ace/iosfwd.h"
+
+#include <algorithm>
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ template <typename charT> class String_Manager_T; // Forward declaration.
+ typedef String_Manager_T<CORBA::Char> String_Manager;
+ typedef String_Manager_T<CORBA::WChar> WString_Manager;
+}
+
+namespace TAO
+{
+ /**
+ * @class String_var
+ *
+ * Provides automatic deallocation of storage for the string once it
+ * goes out of scope.
+ */
+ template <typename charT>
+ class String_var
+ {
+ public:
+ typedef charT character_type;
+ typedef TAO::details::string_traits_base <character_type> s_traits;
+
+ /// Default constructor.
+ inline String_var (void) : ptr_ (0)
+ {
+ }
+
+ /// Constructor, owns p.
+ inline String_var (character_type *p) : ptr_ (p)
+ {
+ }
+
+ /// Constructor. Makes a copy of p.
+ inline String_var (const character_type *p) : ptr_ (s_traits::duplicate (p))
+ {
+ }
+
+ /// Copy constructor.
+ inline String_var (String_var<charT> const &s) : ptr_(s_traits::duplicate(s.ptr_))
+ {
+ }
+
+ /// Destructor.
+ inline ~String_var (void)
+ {
+ s_traits::release (this->ptr_);
+ }
+
+ /// Assignment operator.
+ inline String_var &operator= (character_type *p)
+ {
+ String_var <charT> tmp (p);
+ std::swap (this->ptr_, tmp.ptr_);
+ return *this;
+ }
+
+ /// Assignment to a const char*. Makes a copy.
+ inline String_var &operator= (const character_type *p)
+ {
+ String_var <charT> tmp (p);
+ std::swap (this->ptr_, tmp.ptr_);
+ return *this;
+ }
+
+ /// Assignment operator.
+ inline String_var &operator= (String_var<character_type> const &s)
+ {
+ String_var <charT> tmp (s);
+ std::swap (this->ptr_, tmp.ptr_);
+ return *this;
+ }
+
+ /// Spec-defined read/write version.
+ inline operator character_type *&()
+ {
+ return this->ptr_;
+ }
+
+ /// Only read privileges.
+ inline operator const character_type *() const
+ {
+ return this->ptr_;
+ }
+
+ /// Allows access and modification using an slot.
+ inline character_type &operator[] (CORBA::ULong slot)
+ {
+ // We need to verify bounds else raise some exception.
+ return this->ptr_[slot];
+ }
+
+ /// Allows only accessing thru an slot.
+ inline character_type operator[] (CORBA::ULong slot) const
+ {
+ // We need to verify bounds else raise some exception.
+ return this->ptr_[slot];
+ }
+
+ /// For in parameter.
+ inline const character_type *in (void) const
+ {
+ return this->ptr_;
+ }
+
+ /// For inout parameter.
+ inline character_type *&inout (void)
+ {
+ return this->ptr_;
+ }
+
+ /// For out parameter.
+ inline character_type *&out (void)
+ {
+ s_traits::release (this->ptr_);
+ this->ptr_ = 0;
+ return this->ptr_;
+ }
+
+ /// For string of return type.
+ inline character_type *_retn (void)
+ {
+ character_type *temp = this->ptr_;
+ this->ptr_ = 0;
+ return temp;
+ }
+
+ private:
+ /// Instance.
+ character_type *ptr_;
+ };
+
+ /**
+ * @class String_out
+ *
+ * @brief String_out
+ *
+ * To support the memory management for "out" parameter passing
+ * mode.
+ */
+ template <typename charT>
+ class String_out
+ {
+ public:
+ typedef charT character_type;
+ typedef TAO::details::string_traits_base <character_type> s_traits;
+ typedef typename s_traits::string_mgr string_mgr;
+
+ /// Construction from a reference to a string.
+ inline String_out (character_type *&p) : ptr_ (p)
+ {
+ this->ptr_ = 0;
+ }
+
+ /// Construction from a var.
+ inline String_out (String_var <character_type> &p) : ptr_ (p.out ())
+ {
+ }
+
+ /// Construction from a TAO::String_Manager.
+ inline String_out (string_mgr &p) : ptr_ (p.out ())
+ {
+ }
+
+ /// Copy constructor.
+ inline String_out (const String_out<charT> &s) : ptr_ (s.ptr_)
+ {
+ }
+
+ /// Assignment from a string_out.
+ inline String_out &operator= (String_out<charT> const &s)
+ {
+ this->ptr_ = s.ptr_;
+ return *this;
+ }
+
+ /// Assignment from a string.
+ inline String_out &operator= (character_type *p)
+ {
+ this->ptr_ = p;
+ return *this;
+ }
+
+ /// Assignment from a constant char*.
+ inline String_out& operator= (const character_type* p)
+ {
+ this->ptr_ = s_traits::duplicate (p);
+ return *this;
+ }
+
+ /// Cast.
+ inline operator character_type *&()
+ {
+ return this->ptr_;
+ }
+
+ /// Return underlying instance.
+ inline character_type *&ptr (void)
+ {
+ return this->ptr_;
+ }
+
+ private:
+ /// Instance.
+ character_type *&ptr_;
+
+ // Assignment from _var disallowed
+ void operator= (const typename s_traits::string_var &);
+ };
+
+ /**
+ * @struct TAO-specific @c {W}String_var Equality Functor
+ *
+ * This functor exist to simplify usage of @c {W}String_var in
+ * containers.
+ */
+ struct String_Var_Equal_To
+ {
+ bool operator() (CORBA::String_var const & lhs,
+ CORBA::String_var const & rhs) const;
+
+ bool operator() (CORBA::WString_var const & lhs,
+ CORBA::WString_var const & rhs) const;
+ };
+}
+
+namespace CORBA
+{
+ typedef TAO::String_var <char> String_var;
+ typedef TAO::String_out <char> String_out;
+ typedef TAO::String_var <CORBA::WChar> WString_var;
+ typedef TAO::String_out <CORBA::WChar> WString_out;
+}
+
+
+# if !defined (ACE_LACKS_IOSTREAM_TOTALLY)
+
+TAO_Export ostream &
+operator<< (ostream &, const CORBA::String_var &);
+TAO_Export istream &
+operator>> (istream &, CORBA::String_var &);
+TAO_Export ostream &
+operator<< (ostream &, CORBA::String_out &);
+TAO_Export istream &
+operator>> (istream &, CORBA::String_out &);
+TAO_Export ostream &
+operator<< (ostream &, const CORBA::WString_var &);
+TAO_Export istream &
+operator>> (istream &, CORBA::WString_var &);
+TAO_Export ostream &
+operator<< (ostream &, CORBA::WString_out &);
+TAO_Export istream &
+operator>> (istream &, CORBA::WString_out &);
+
+# endif /* ACE_LACKS_IOSTREAM_TOTALLY */
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/CORBA_String.inl"
+#endif /* ! __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_CORBA_STRING_H */
diff --git a/TAO/tao/CORBA_String.inl b/TAO/tao/CORBA_String.inl
new file mode 100644
index 00000000000..daeecf0628c
--- /dev/null
+++ b/TAO/tao/CORBA_String.inl
@@ -0,0 +1,23 @@
+// -*- C++ -*-
+//
+// $Id$
+
+#include "ace/OS_NS_string.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE bool
+TAO::String_Var_Equal_To::operator() (CORBA::String_var const & lhs,
+ CORBA::String_var const & rhs) const
+{
+ return (ACE_OS::strcmp (lhs.in (), rhs.in ()) == 0);
+}
+
+ACE_INLINE bool
+TAO::String_Var_Equal_To::operator() (CORBA::WString_var const & lhs,
+ CORBA::WString_var const & rhs) const
+{
+ return (ACE_OS::strcmp (lhs.in (), rhs.in ()) == 0);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/CORBA_methods.h b/TAO/tao/CORBA_methods.h
new file mode 100644
index 00000000000..62d95e56a1e
--- /dev/null
+++ b/TAO/tao/CORBA_methods.h
@@ -0,0 +1,86 @@
+// -*- C++ -*-
+//=============================================================================
+/**
+ * @file CORBA_methods.h
+ *
+ * $Id$
+ *
+ * Declarations of common methods in the CORBA namespace.
+ *
+ * @author Jeff Parsons
+ */
+//=============================================================================
+
+#ifndef TAO_CORBA_METHODS_H
+#define TAO_CORBA_METHODS_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/TAO_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Basic_Types.h"
+#include "tao/orbconf.h"
+
+#if defined (TAO_EXPORT_MACRO)
+#undef TAO_EXPORT_MACRO
+#endif
+#define TAO_EXPORT_MACRO TAO_Export
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace CORBA
+{
+ class ORB;
+ typedef ORB *ORB_ptr;
+
+ class Environment;
+ typedef Environment *Environment_ptr;
+
+ class Object;
+ typedef Object *Object_ptr;
+
+ class Principal;
+ typedef Principal *Principal_ptr;
+
+ class OperationDef;
+ typedef OperationDef *OperationDef_ptr;
+
+ /**
+ * @name ORB Initialization
+ *
+ * These could be combined into a single version using an environment macro.
+ *
+ */
+ //@{
+ extern TAO_Export ORB_ptr ORB_init (int & argc,
+ char * argv[],
+ const char * orb_name = 0);
+
+ extern TAO_Export ORB_ptr ORB_init (int & argc,
+ char * argv[],
+ const char * orb_name,
+ Environment & ACE_TRY_ENV);
+ //@}
+
+ TAO_NAMESPACE_INLINE_FUNCTION Boolean is_nil (Environment_ptr);
+ TAO_NAMESPACE_INLINE_FUNCTION void release (Environment_ptr);
+
+ TAO_NAMESPACE_INLINE_FUNCTION Boolean is_nil (ORB_ptr);
+ TAO_NAMESPACE_INLINE_FUNCTION void release (ORB_ptr);
+
+ TAO_NAMESPACE_INLINE_FUNCTION Boolean is_nil (Object_ptr);
+ TAO_NAMESPACE_INLINE_FUNCTION void release (Object_ptr);
+
+ TAO_NAMESPACE_INLINE_FUNCTION Boolean is_nil (Principal_ptr);
+ TAO_NAMESPACE_INLINE_FUNCTION void release (Principal_ptr);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_CORBA_METHODS_H */
diff --git a/TAO/tao/CSD_Framework.mpc b/TAO/tao/CSD_Framework.mpc
new file mode 100644
index 00000000000..e366ec7a3ba
--- /dev/null
+++ b/TAO/tao/CSD_Framework.mpc
@@ -0,0 +1,47 @@
+//$Id$
+project : taolib, portableserver, core, pi, tao_versioning_idl_defaults {
+ sharedname = TAO_CSD_Framework
+ dynamicflags = TAO_CSD_FW_BUILD_DLL
+ includes += $(TAO_ROOT)/tao
+
+ Source_Files {
+ CSD_Framework
+ }
+
+ Header_Files {
+ CSD_Framework
+ }
+
+ Inline_Files {
+ CSD_Framework
+ }
+
+ Template_Files {
+ CSD_Framework
+ }
+
+ Resource_Files {
+ CSD_Framework
+ }
+
+ IDL_Files {
+ CSD_Framework
+ }
+
+ PIDL_Files {
+ CSD_Framework
+ }
+
+ IDL_Files {
+ idlflags += -Sci -SS -Gp -Gd -Ge 1 -Sorb -GA -Sal \
+ -Wb,export_macro=TAO_CSD_FW_Export \
+ -Wb,export_include=tao/CSD_Framework/CSD_FW_Export.h \
+ -o CSD_Framework
+ idlflags -= -Sa -St
+ CSD_Framework/CSD_Framework.pidl
+ }
+
+ Pkgconfig_Files {
+ CSD_Framework/TAO_CSD_Framework.pc.in
+ }
+}
diff --git a/TAO/tao/CSD_Framework/CSD_Default_Servant_Dispatcher.cpp b/TAO/tao/CSD_Framework/CSD_Default_Servant_Dispatcher.cpp
new file mode 100644
index 00000000000..2eb88cc49d3
--- /dev/null
+++ b/TAO/tao/CSD_Framework/CSD_Default_Servant_Dispatcher.cpp
@@ -0,0 +1,70 @@
+// $Id$
+
+#include "tao/CSD_Framework/CSD_Default_Servant_Dispatcher.h"
+#include "tao/CSD_Framework/CSD_POA.h"
+#include "tao/CSD_Framework/CSD_Strategy_Repository.h"
+#include "ace/Dynamic_Service.h"
+
+ACE_RCSID(CSD_Framework,
+ CSD_Default_Servant_Dispatcher,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_CSD_Default_Servant_Dispatcher::~TAO_CSD_Default_Servant_Dispatcher (void)
+{
+}
+
+
+TAO_Root_POA *
+TAO_CSD_Default_Servant_Dispatcher::create_Root_POA (const ACE_CString &name,
+ PortableServer::POAManager_ptr poa_manager,
+ const TAO_POA_Policy_Set &policies,
+ ACE_Lock &lock,
+ TAO_SYNCH_MUTEX &thread_lock,
+ TAO_ORB_Core &orb_core,
+ TAO_Object_Adapter *object_adapter
+ ACE_ENV_ARG_DECL)
+ {
+ TAO_CSD_POA *poa = 0;
+
+ ACE_NEW_THROW_EX (poa,
+ TAO_CSD_POA (name,
+ poa_manager,
+ policies,
+ 0,
+ lock,
+ thread_lock,
+ orb_core,
+ object_adapter
+ ACE_ENV_ARG_PARAMETER),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (0);
+
+
+ TAO_CSD_Strategy_Repository *repo =
+ ACE_Dynamic_Service<TAO_CSD_Strategy_Repository>::instance ("TAO_CSD_Strategy_Repository");
+
+ if (repo == 0)
+ {
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT("(%P|%t) CSD_Default_Servant_Dispatcher::")
+ ACE_TEXT("create_POA could not find ")
+ ACE_TEXT("TAO_CSD_Strategy_Repository\n")));
+ return 0;
+ }
+
+ CSD_Framework::Strategy_var strategy = repo->find (name);
+
+ if (! ::CORBA::is_nil (strategy.in ()))
+ {
+ poa->set_csd_strategy (strategy.in () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+ }
+
+ return poa;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/CSD_Framework/CSD_Default_Servant_Dispatcher.h b/TAO/tao/CSD_Framework/CSD_Default_Servant_Dispatcher.h
new file mode 100644
index 00000000000..1d041331e99
--- /dev/null
+++ b/TAO/tao/CSD_Framework/CSD_Default_Servant_Dispatcher.h
@@ -0,0 +1,53 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file CSD_Default_Servant_Dispatcher.h
+ *
+ * $Id$
+ *
+ * @author Yan Dai (dai_y@ociweb.com)
+ */
+//=============================================================================
+
+#ifndef TAO_CSD_DEFAULT_SERVANT_DISPATCHER_H
+#define TAO_CSD_DEFAULT_SERVANT_DISPATCHER_H
+#include /**/ "ace/pre.h"
+
+#include "tao/CSD_Framework/CSD_FW_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/Default_Servant_Dispatcher.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_CSD_Default_Servant_Dispatcher
+ *
+ * @brief Interface for CSD_POA servant dispatching strategies.
+ */
+class TAO_CSD_FW_Export TAO_CSD_Default_Servant_Dispatcher
+ : public virtual TAO_Default_Servant_Dispatcher
+{
+public:
+ virtual ~TAO_CSD_Default_Servant_Dispatcher (void);
+
+
+ /// Factory method for creating new CSD Root POA.
+ virtual TAO_Root_POA *create_Root_POA (const ACE_CString &name,
+ PortableServer::POAManager_ptr poa_manager,
+ const TAO_POA_Policy_Set &policies,
+ ACE_Lock &lock,
+ TAO_SYNCH_MUTEX &thread_lock,
+ TAO_ORB_Core &orb_core,
+ TAO_Object_Adapter *object_adapter
+ ACE_ENV_ARG_DECL);
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_CSD_DEFAULT_SERVANT_DISPATCHER_H */
diff --git a/TAO/tao/CSD_Framework/CSD_FW_Export.h b/TAO/tao/CSD_Framework/CSD_FW_Export.h
new file mode 100644
index 00000000000..edeb9119dc4
--- /dev/null
+++ b/TAO/tao/CSD_Framework/CSD_FW_Export.h
@@ -0,0 +1,58 @@
+
+// -*- C++ -*-
+// $Id$
+// Definition for Win32 Export directives.
+// This file is generated automatically by generate_export_file.pl -s TAO_CSD_FW
+// ------------------------------
+#ifndef TAO_CSD_FW_EXPORT_H
+#define TAO_CSD_FW_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if defined (ACE_AS_STATIC_LIBS) && !defined (TAO_CSD_FW_HAS_DLL)
+# define TAO_CSD_FW_HAS_DLL 0
+#endif /* ACE_AS_STATIC_LIBS && TAO_CSD_FW_HAS_DLL */
+
+#if !defined (TAO_CSD_FW_HAS_DLL)
+# define TAO_CSD_FW_HAS_DLL 1
+#endif /* ! TAO_CSD_FW_HAS_DLL */
+
+#if defined (TAO_CSD_FW_HAS_DLL) && (TAO_CSD_FW_HAS_DLL == 1)
+# if defined (TAO_CSD_FW_BUILD_DLL)
+# define TAO_CSD_FW_Export ACE_Proper_Export_Flag
+# define TAO_CSD_FW_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# define TAO_CSD_FW_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# else /* TAO_CSD_FW_BUILD_DLL */
+# define TAO_CSD_FW_Export ACE_Proper_Import_Flag
+# define TAO_CSD_FW_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# define TAO_CSD_FW_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# endif /* TAO_CSD_FW_BUILD_DLL */
+#else /* TAO_CSD_FW_HAS_DLL == 1 */
+# define TAO_CSD_FW_Export
+# define TAO_CSD_FW_SINGLETON_DECLARATION(T)
+# define TAO_CSD_FW_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+#endif /* TAO_CSD_FW_HAS_DLL == 1 */
+
+// Set TAO_CSD_FW_NTRACE = 0 to turn on library specific tracing even if
+// tracing is turned off for ACE.
+#if !defined (TAO_CSD_FW_NTRACE)
+# if (ACE_NTRACE == 1)
+# define TAO_CSD_FW_NTRACE 1
+# else /* (ACE_NTRACE == 1) */
+# define TAO_CSD_FW_NTRACE 0
+# endif /* (ACE_NTRACE == 1) */
+#endif /* !TAO_CSD_FW_NTRACE */
+
+#if (TAO_CSD_FW_NTRACE == 1)
+# define TAO_CSD_FW_TRACE(X)
+#else /* (TAO_CSD_FW_NTRACE == 1) */
+# if !defined (ACE_HAS_TRACE)
+# define ACE_HAS_TRACE
+# endif /* ACE_HAS_TRACE */
+# define TAO_CSD_FW_TRACE(X) ACE_TRACE_IMPL(X)
+# include "ace/Trace.h"
+#endif /* (TAO_CSD_FW_NTRACE == 1) */
+
+#endif /* TAO_CSD_FW_EXPORT_H */
+
+// End of auto generated file.
diff --git a/TAO/tao/CSD_Framework/CSD_FW_Server_Request_Wrapper.cpp b/TAO/tao/CSD_Framework/CSD_FW_Server_Request_Wrapper.cpp
new file mode 100644
index 00000000000..24684bf7866
--- /dev/null
+++ b/TAO/tao/CSD_Framework/CSD_FW_Server_Request_Wrapper.cpp
@@ -0,0 +1,474 @@
+// $Id$
+#include "tao/CSD_Framework/CSD_FW_Server_Request_Wrapper.h"
+#include "tao/debug.h"
+#include "tao/ORB_Constants.h"
+#include "tao/ORB_Core.h"
+#include "tao/Transport.h"
+#include "tao/CDR.h"
+
+
+ACE_RCSID (CSD_Framework,
+ FW_Server_Request_Wrapper,
+ "$Id$")
+
+#if !defined (__ACE_INLINE__)
+# include "tao/CSD_Framework/CSD_FW_Server_Request_Wrapper.inl"
+#endif /* ! __ACE_INLINE__ */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO::CSD::FW_Server_Request_Wrapper::~FW_Server_Request_Wrapper()
+{
+ // Only delete the request if we cloned it.
+ if (this->is_clone_)
+ {
+ // The TAO_Tagged_Profile type_id_ may have been duplicated.
+ if (this->request_->profile_.type_id_ != 0)
+ CORBA::string_free (
+ const_cast<char*> (this->request_->profile_.type_id_));
+
+ // Since this TAO_ServerRequest object is a clone, it
+ // "owns" the input and output CDR objects held by the
+ // incoming_ and outgoing_ data members, respectfully.
+ // Thus, for the clone case, the TAO_ServerRequest dtor
+ // needs to release (aka, delete) the CDR objects.
+ delete this->request_->incoming_;
+
+ // Get the start message block that reference to the data allocated
+ // on the heap.
+ if (this->request_->outgoing_ != 0)
+ {
+ char* buffer = this->request_->outgoing_->begin ()->base ();
+ delete [] buffer;
+ delete this->request_->outgoing_;
+ }
+ if (this->request_->operation_details_ != 0)
+ {
+ char* opname = (char*)this->request_->operation_details_->opname_;
+ delete [] opname;
+ delete this->request_->operation_details_;
+ }
+
+ if (this->request_->transport_ != 0)
+ this->request_->transport_->remove_reference ();
+
+ delete this->request_;
+ }
+}
+
+
+// Assumes that the servant argument is not a NULL pointer.
+void
+TAO::CSD::FW_Server_Request_Wrapper::dispatch
+ (PortableServer::Servant servant
+ ACE_ENV_ARG_DECL)
+{
+ ACE_TRY
+ {
+ servant->_dispatch(*this->request_, 0 ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ // Only CORBA exceptions are caught here.
+ ACE_CATCHANY
+ {
+ if (this->request_->collocated())
+ {
+ // For collocated requests, we re-throw the exception.
+ ACE_RE_THROW;
+ }
+ else if (!this->request_->sync_with_server() &&
+ this->request_->response_expected() &&
+ !this->request_->deferred_reply())
+ {
+ // The request is a remote request that is expecting a reply.
+ this->request_->tao_send_reply_exception(ACE_ANY_EXCEPTION);
+ }
+ else if (TAO_debug_level > 0)
+ {
+ // It is unfortunate that an exception (probably a system
+ // exception) was thrown by the dispatch code (even by the
+ // user) when the client was not expecting a response.
+ // However, in this case, we cannot close the connection
+ // down, since it really isn't the client's fault.
+
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) exception thrown ")
+ ACE_TEXT ("but client is not waiting a response\n")));
+
+ ACE_PRINT_EXCEPTION (
+ ACE_ANY_EXCEPTION,
+ "FW_Server_Request_Wrapper::dispatch ()");
+ }
+ }
+#if defined (TAO_HAS_EXCEPTIONS)
+ ACE_CATCHALL
+ {
+ // @@ TODO some c++ exception or another, but what do we do with
+ // it?
+ // We are supposed to map it into a CORBA::UNKNOWN exception.
+ // BTW, this cannot be detected if using the <env> mapping. If
+ // we have native exceptions but no support for them in the ORB
+ // we should still be able to catch it. If we don't have native
+ // exceptions it couldn't have been raised in the first place!
+ CORBA::UNKNOWN exception (CORBA::SystemException::_tao_minor_code
+ (TAO_UNHANDLED_SERVER_CXX_EXCEPTION, 0),
+ CORBA::COMPLETED_MAYBE);
+
+ if (this->request_->collocated())
+ {
+ // For collocated requests, we re-throw the exception.
+ ACE_RE_THROW;
+ }
+ else if (!this->request_->sync_with_server() &&
+ this->request_->response_expected() &&
+ !this->request_->deferred_reply())
+ {
+ // The request is a remote request that is expecting a reply.
+ this->request_->tao_send_reply_exception(exception);
+ }
+ else if (TAO_debug_level > 0)
+ {
+ // It is unfortunate that an exception (probably a system
+ // exception) was thrown by the dispatch code (even by the
+ // user) when the client was not expecting a response.
+ // However, in this case, we cannot close the connection
+ // down, since it really isn't the client's fault.
+
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) exception thrown ")
+ ACE_TEXT ("but client is not waiting a response\n")));
+
+ ACE_PRINT_EXCEPTION (
+ exception,
+ "FW_Server_Request_Wrapper::dispatch ()");
+ }
+ }
+#endif /* TAO_HAS_EXCEPTIONS */
+
+ ACE_ENDTRY;
+}
+
+
+TAO_ServerRequest*
+TAO::CSD::FW_Server_Request_Wrapper::clone (TAO_ServerRequest*& request)
+{
+ // TBD-CSD: Ultimately add an argument for an allocator.
+ TAO_ServerRequest* clone_obj;
+ ACE_NEW_RETURN (clone_obj,
+ TAO_ServerRequest (),
+ 0);
+
+ if (clone_obj == 0)
+ {
+ return 0;
+ }
+
+ // TYPE: TAO_Pluggable_Messaging*
+ // ACTION: Assuming that a shallow-copy is ok here.
+ clone_obj->mesg_base_ = request->mesg_base_;
+
+ // TYPE: const char*
+ // ACTION: Method performs deep-copy of string contents.
+ clone_obj->operation (CORBA::string_dup (request->operation ()),
+ request->operation_length (),
+ 1);
+
+ // TYPE: CORBA::Object_var
+ // ACTION: Assignment performs reference-counted copy of object ref.
+ clone_obj->forward_location_ = request->forward_location_;
+
+ // TYPE: TAO_InputCDR*
+ // ACTION: This *must* be "cloned".
+ if (request->incoming_ != 0)
+ {
+ clone_obj->incoming_ = this->clone (request->incoming_);
+ }
+
+ // TYPE: TAO_OutputCDR*
+ // ACTION: This *must* be "cloned".
+ if (request->outgoing_ != 0)
+ {
+ clone_obj->outgoing_ = this->create_new_output_cdr ();
+ }
+
+ // TYPE: TAO_Transport*
+ // ACTION: Assuming that a shallow-copy is ok here.
+ clone_obj->transport_ = request->transport_;
+ if (clone_obj->transport_ != 0)
+ clone_obj->transport_->add_reference ();
+
+ // TYPE: CORBA::Boolean
+ // ACTION: Primitive data type assignment.
+ clone_obj->response_expected_ = request->response_expected_;
+
+ // TYPE: CORBA::Boolean
+ // ACTION: Primitive data type assignment.
+ clone_obj->deferred_reply_ = request->deferred_reply_;
+
+ // TYPE: CORBA::Boolean
+ // ACTION: Primitive data type assignment.
+ clone_obj->sync_with_server_ = request->sync_with_server_;
+
+ // TYPE: CORBA::Boolean
+ // ACTION: Primitive data type assignment.
+ clone_obj->is_dsi_ = request->is_dsi_;
+
+ // TYPE: CORBA::ULong
+ // ACTION: Primitive data type assignment.
+ clone_obj->exception_type_ = request->exception_type_;
+
+ // TYPE: TAO_ORB_Core*
+ // ACTION: Assuming that a shallow-copy is ok here.
+ clone_obj->orb_core_ = request->orb_core_;
+
+ // TYPE: TAO_Service_Context
+ // ACTION: No copy/assignment operator, so adding/using a clone operation.
+ this->clone (request->request_service_context_, clone_obj->request_service_context_);
+
+ // TYPE: TAO_Service_Context
+ // ACTION: No copy/assignment operator, so adding/using a clone operation.
+ this->clone (request->reply_service_context_, clone_obj->reply_service_context_);
+
+ // TYPE: CORBA::ULong
+ // ACTION: Primitive data type assignment.
+ clone_obj->request_id_ = request->request_id_;
+
+ // TYPE: TAO_Tagged_Profile
+ // ACTION: No copy/assignment operator, so adding/using a clone operation.
+ this->clone (request->profile_, clone_obj->profile_);
+
+ // TYPE: CORBA::OctetSeq_var
+ // ACTION: Assignment performs reference-counted copy of sequence.
+ clone_obj->requesting_principal_ = request->requesting_principal_;
+
+ // TYPE: ptrdiff_t
+ // ACTION: Primitive data type assignment (unsigned integral type).
+ clone_obj->dsi_nvlist_align_ = request->dsi_nvlist_align_;
+
+ // TYPE: TAO_Operation_Details const * const
+ // ACTION: Need to clone this.
+ if (request->operation_details_ != 0)
+ {
+ ACE_ASSERT (request->incoming_ == 0);
+ if (this->clone (request->operation_details_,
+ clone_obj->operation_details_,
+ clone_obj->incoming_) == false)
+ {
+ return 0;
+ }
+ }
+
+ // TYPE: CORBA::Boolean
+ // ACTION: Primitive data type assignment.
+ clone_obj->argument_flag_ = request->argument_flag_;
+
+ //#if TAO_HAS_INTERCEPTORS == 1
+ // TYPE: size_t
+ // ACTION: Primitive data type assignment.
+ // Just leave this alone for a clone.
+ //
+ //clone_obj->interceptor_count_ = request->interceptor_count_;
+
+ // TYPE: TAO::PICurrent_Impl
+ // ACTION: Copy/assignment operator disabled on purpose.
+ // Just leave this alone for a clone.
+ //
+ // clone_obj->rs_pi_current_
+
+ // TYPE: CORBA::OctetSeq_var
+ // ACTION: Assignment performs reference-counted copy of sequence.
+ // Assuming that this is ok.
+ // Just leave this alone for a clone.
+ //
+ //clone_obj->result_seq_ = request->result_seq_;
+ //#endif /* TAO_HAS_INTERCEPTORS == 1 */
+
+ if (clone_obj->transport_ != 0)
+ {
+ clone_obj->transport_->assign_translators(clone_obj->incoming_,
+ clone_obj->outgoing_);
+ }
+ return clone_obj;
+}
+
+
+TAO_InputCDR*
+TAO::CSD::FW_Server_Request_Wrapper::clone (TAO_InputCDR*& from)
+{
+ TAO_InputCDR* clone_ptr = 0;
+ ACE_NEW_RETURN (clone_ptr,
+ TAO_InputCDR(*from),
+ 0);
+ return clone_ptr;
+}
+
+
+bool
+TAO::CSD::FW_Server_Request_Wrapper::clone (TAO_Operation_Details const *& from,
+ TAO_Operation_Details const *& to,
+ TAO_InputCDR*& cdr)
+{
+ TAO_Operation_Details *& from_non_const
+ = const_cast <TAO_Operation_Details *&>(from);
+
+ char* cloned_op_name;
+ ACE_NEW_RETURN (cloned_op_name,
+ char[from_non_const->opname_len_ + 1],
+ false);
+ ACE_OS::strncpy(cloned_op_name, from_non_const->opname_, from_non_const->opname_len_);
+ cloned_op_name[from_non_const->opname_len_] = '\0';
+
+ static const size_t mb_size = 2048;
+ ACE_NEW_RETURN (cdr,
+ TAO_InputCDR (mb_size),
+ false);
+
+ // To avoid duplicating and copying the data block, allow the
+ // TAO_OutputCDR to share the data block of TAO_InputCDR's message block.
+ ACE_Message_Block* mb = const_cast<ACE_Message_Block*> (cdr->start ());
+ TAO_OutputCDR outcdr (mb);
+
+ if (! from_non_const->marshal_args (outcdr))
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT("(%P|%T) TAO::CSD::FW_Server_Request_Wrapper::")
+ ACE_TEXT("clone TAO_Operation_Details failed\n")));
+ return false;
+ }
+
+ // The TAO_OutputCDR made a new message block around the data block
+ // held by the message block owned by the TAO_InputCDR. We need to
+ // make sure that the results of marshaling are propagated back to the
+ // message block in the TAO_InputCDR.
+ const ACE_Message_Block* begin = outcdr.begin ();
+ if (begin == outcdr.current ())
+ {
+ // A chain was not made, so we can just adjust the read and write
+ // pointers
+ mb->rd_ptr (begin->rd_ptr ());
+ mb->wr_ptr (begin->wr_ptr ());
+ }
+ else
+ {
+ // A costly, but necessary, copying of data blocks. This shouldn't
+ // happen that often assuming that the size of the message block
+ // allocated during the allocation of TAO_InputCDR is "big enough"
+ // for most operation parameters.
+ cdr->reset (begin, outcdr.byte_order ());
+ }
+
+ // CSD-TBD: Eventually need to use allocators.
+
+ // CSD-TBD: Assert that this->ex_data_ and this->ex_count_ are both == 0
+ TAO_Operation_Details* to_non_const;
+ ACE_NEW_RETURN (to_non_const,
+ TAO_Operation_Details(cloned_op_name,
+ from_non_const->opname_len_,
+ from_non_const->argument_flag_,
+ 0,
+ 0,
+ 0,
+ 0),
+ false);
+
+
+ // DATA MEMBER: const char *opname_;
+ // DATA MEMBER: CORBA::ULong opname_len_;
+ // DATA MEMBER: CORBA::Boolean argument_flag_;
+ // DATA MEMBER: TAO::Argument **args_;
+ // DATA MEMBER: CORBA::ULong num_args_;
+ // DATA MEMBER: TAO::Exception_Data *ex_data_;
+ // DATA MEMBER: CORBA::ULong ex_count_;
+ //
+ // ACTION: None - handled in ctor
+ //
+
+ // DATA MEMBER: CORBA::ULong request_id_;
+ // DATA MEMBER: CORBA::Octet response_flags_;
+ // DATA MEMBER: TAO_Target_Specification::TAO_Target_Address addressing_mode_;
+ // DATA MEMBER: TAO_Service_Context request_service_info_;
+ // DATA MEMBER: TAO_Service_Context reply_service_info_;
+ //
+ // ACTION: Use assignment op to copy from "this" object to the clone.
+ //
+ to_non_const->request_id_ = from->request_id_;
+ to_non_const->response_flags_ = from->response_flags_;
+ to_non_const->addressing_mode_ = from->addressing_mode_;
+
+ // DATA MEMBER: TAO_Service_Context request_service_info_;
+ // DATA MEMBER: TAO_Service_Context reply_service_info_;
+ //
+ // ACTION: Use the TAO_Service_Context clone() method.
+ //
+ this->clone (from_non_const->request_service_info_, to_non_const->request_service_info_);
+ this->clone (from_non_const->reply_service_info_, to_non_const->reply_service_info_);
+
+ to = to_non_const;
+
+ return true;
+}
+
+
+void
+TAO::CSD::FW_Server_Request_Wrapper::clone (TAO_Tagged_Profile& from,
+ TAO_Tagged_Profile& to)
+{
+ to.orb_core_ = from.orb_core_;
+ to.discriminator_ = from.discriminator_;
+ to.object_key_extracted_ = from.object_key_extracted_;
+ to.object_key_ = from.object_key_;
+ to.profile_ = from.profile_;
+ to.profile_index_ = from.profile_index_;
+ to.type_id_ = from.type_id_ == 0 ? 0 :
+ CORBA::string_dup (from.type_id_);
+}
+
+
+void
+TAO::CSD::FW_Server_Request_Wrapper::clone (TAO_Service_Context& from,
+ TAO_Service_Context& to)
+{
+ to.service_context_ = from.service_context_;
+}
+
+TAO_OutputCDR*
+TAO::CSD::FW_Server_Request_Wrapper::create_new_output_cdr ()
+{
+ TAO_OutputCDR* cdr = 0;
+
+ // A buffer that we will use to initialise the CDR stream
+ char* repbuf;
+ ACE_NEW_RETURN (repbuf,
+ char[ACE_CDR::DEFAULT_BUFSIZE],
+ 0);
+
+ ACE_CDR::Octet major;
+ ACE_CDR::Octet minor;
+ this->request_->outgoing_->get_version (major, minor);
+
+ // Initialze an output CDR on the stack
+ // NOTE: Don't jump to a conclusion as to why we are using the
+ // input_cdr and hence the global pool here. These pools will move
+ // to the lanes anyway at some point of time. Further, it would have
+ // been awesome to have this in TSS. But for some reason the cloning
+ // that happens when the ORB gets flow controlled while writing a
+ // reply is messing things up. We crash horribly. Doing this adds a
+ // lock, we need to set things like this -- put stuff in TSS here
+ // and transfer to global memory when we get flow controlled. We
+ // need to work on the message block to get it right!
+ ACE_NEW_RETURN (cdr,
+ TAO_OutputCDR (repbuf,
+ ACE_CDR::DEFAULT_BUFSIZE,
+ TAO_ENCAP_BYTE_ORDER,
+ this->request_->orb_core_->input_cdr_buffer_allocator (),
+ this->request_->orb_core_->input_cdr_dblock_allocator (),
+ this->request_->orb_core_->input_cdr_msgblock_allocator (),
+ this->request_->orb_core_->orb_params ()->cdr_memcpy_tradeoff (),
+ major,
+ minor),
+ 0);
+
+ return cdr;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/CSD_Framework/CSD_FW_Server_Request_Wrapper.h b/TAO/tao/CSD_Framework/CSD_FW_Server_Request_Wrapper.h
new file mode 100644
index 00000000000..5268fb8a357
--- /dev/null
+++ b/TAO/tao/CSD_Framework/CSD_FW_Server_Request_Wrapper.h
@@ -0,0 +1,128 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file CSD_FW_Server_Request_Wrapper.h
+ *
+ * $Id$
+ *
+ * @author Tim Bradley <bradley_t@ociweb.com>
+ */
+//=============================================================================
+
+#ifndef TAO_CSD_FW_SERVER_REQUEST_WRAPPER_H
+#define TAO_CSD_FW_SERVER_REQUEST_WRAPPER_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/CSD_Framework/CSD_FW_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/TAO_Server_Request.h"
+#include "tao/operation_details.h"
+#include "tao/PortableServer/Servant_Base.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace CSD
+ {
+
+ /**
+ * @class FW_Server_Request_Wrapper
+ *
+ * @brief Wrapper around a TAO_Server_Request that will be cloned
+ * at the proper time.
+ *
+ * This CSD Framework class is used to provide an interface to a
+ * TAO_ServerRequest object such that it can be used for CSD strategies
+ * that need to clone TAO_Server_Requests (ie, so that they may be
+ * placed on a queue to be dispatched by another thread).
+ *
+ * There are several purposes for this class, with the main thing being
+ * that the TAO_ServerRequest object is not used directly by the
+ * CSD Strategies since it is, after all, an internal TAO class that was
+ * never meant to be exposed. Future changes to TAO's internal design
+ * may cause disruption in the TAO_ServerRequest class. These changes
+ * would only need to be accounted for here in this
+ * FW_Server_Request_Wrapper class' implementation, and all CSD
+ * Strategies will work again. It's a maintenance issue.
+ *
+ * @note: The CSD namespace is inside of TAO namespace in current
+ * implementation. This can be changed but, at least for now, it's
+ * already been delivered to some customs, we leave it as-is. If it
+ * needs to change, we will make this change.
+ */
+ class TAO_CSD_FW_Export FW_Server_Request_Wrapper
+ {
+ public:
+
+ /// Constructor.
+ FW_Server_Request_Wrapper(TAO_ServerRequest& server_request);
+
+ /// Destructor.
+ ~FW_Server_Request_Wrapper();
+
+ /// Perform the clone operation.
+ void clone();
+
+ /// Dispatch the request to the servant.
+ void dispatch(PortableServer::Servant servant ACE_ENV_ARG_DECL);
+
+ /// Cancel the request.
+ void cancel();
+
+
+ private:
+
+ /// Create a deep copy of the request_ object.
+ /// The other clone methods are used to support the TAO_ServerRequest clone.
+ TAO_ServerRequest* clone (TAO_ServerRequest*& from);
+
+ /// Clone an input cdr stream.
+ TAO_InputCDR* clone (TAO_InputCDR*& from);
+
+ /// Create a deep copy of a TAO_Operation_Details object and marshall
+ /// the arguments into a TAO_InputCDR stream. The cloned TAO_Operation_Details
+ /// object is created without any arguments. This would help the skeleton
+ /// code to determine whether the arguments are in the operation_details_
+ /// object or should be demarshalled from the incoming_ stream in the request_
+ /// object.
+ bool clone (TAO_Operation_Details const *& from,
+ TAO_Operation_Details const *& to,
+ TAO_InputCDR* & cdr);
+
+ /// Clone the TAO_Tagged_Profile object.
+ void clone (TAO_Tagged_Profile& from, TAO_Tagged_Profile& to);
+
+ /// Clone the TAO_Service_Context object.
+ void clone (TAO_Service_Context& from, TAO_Service_Context& to);
+
+ /// Create a TAO_OutputCDR stream initialized with a heap allocated
+ /// buffer.
+ TAO_OutputCDR* create_new_output_cdr ();
+
+ /// A flag that indicates that the TAO_ServerRequest object
+ /// is already cloned.
+ bool is_clone_;
+
+ /// Pointer to the underlying TAO_ServerRequest object.
+ TAO_ServerRequest* request_;
+ };
+
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/CSD_Framework/CSD_FW_Server_Request_Wrapper.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_CSD_FW_SERVER_REQUEST_WRAPPER_H */
diff --git a/TAO/tao/CSD_Framework/CSD_FW_Server_Request_Wrapper.inl b/TAO/tao/CSD_Framework/CSD_FW_Server_Request_Wrapper.inl
new file mode 100644
index 00000000000..13d78a1664c
--- /dev/null
+++ b/TAO/tao/CSD_Framework/CSD_FW_Server_Request_Wrapper.inl
@@ -0,0 +1,46 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO::CSD::FW_Server_Request_Wrapper::FW_Server_Request_Wrapper
+ (TAO_ServerRequest& server_request)
+ : is_clone_(false),
+ request_(&server_request)
+{
+}
+
+
+ACE_INLINE
+void
+TAO::CSD::FW_Server_Request_Wrapper::clone()
+{
+ // Only clone the TAO_Server_Request object if we have not performed the
+ // clone already. This really should only be called once, but this code
+ // makes sure that we do not introduce a leak.
+ if (!this->is_clone_)
+ {
+ this->request_ = this->clone (this->request_);
+ this->is_clone_ = true;
+ }
+}
+
+
+ACE_INLINE
+void
+TAO::CSD::FW_Server_Request_Wrapper::cancel()
+{
+ // We only need to handle remote requests that are expecting a reply.
+ if (!this->request_->collocated() &&
+ !this->request_->sync_with_server() &&
+ this->request_->response_expected() &&
+ !this->request_->deferred_reply())
+ {
+ CORBA::NO_IMPLEMENT ex;
+ this->request_->tao_send_reply_exception(ex);
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/CSD_Framework/CSD_Framework.pidl b/TAO/tao/CSD_Framework/CSD_Framework.pidl
new file mode 100644
index 00000000000..f0ab5b1a1fe
--- /dev/null
+++ b/TAO/tao/CSD_Framework/CSD_Framework.pidl
@@ -0,0 +1,53 @@
+// -*- IDL -*-
+/**
+ * @file CSD_Framework.pidl
+ *
+ * $Id$
+ *
+ * @brief Pre-compiled IDL source for the CSD_Framework module.
+ *
+ * This file was used to generate the code in
+ * CSD_FrameworkC.{h,inl,cpp}, using the following command:
+ *
+ * $ACE_ROOT/bin/tao_idl \
+ * -o orig -Gp -Gd -Ge 1 -Gt -GA -I$TAO_ROOT -Sci \
+ * -Wb,export_macro=TAO_CSD_FW_Export \
+ * -Wb,export_include="CSD_FW_Export.h" \
+ * -Wb,pre_include="ace/pre.h" \
+ * -Wb,post_include="ace/post.h" \
+ * -Wb,versioning_begin=TAO_BEGIN_VERSIONED_NAMESPACE_DECL \
+ * -Wb,versioning_end=TAO_END_VERSIONED_NAMESPACE_DECL \
+ * CSD_Framework.pidl
+ */
+
+#ifndef CSD_FRAMEWORK_PIDL
+#define CSD_FRAMEWORK_PIDL
+
+#include "tao/PortableServer/PortableServer_include.pidl"
+
+module CSD_Framework {
+
+ # pragma version CSD_Framework 2.3
+
+ // This is a common base interface for all CSD strategy
+ // implementations
+ local interface Strategy {
+
+ # pragma version Strategy 2.3
+
+ // This is support for a legacy method of supplying a strategy to a
+ // POA.
+ boolean apply_to(in PortableServer::POA p);
+ };
+
+ // Specialized POA providing a method to supply a strategy object to
+ // the POA.
+ local interface POA : PortableServer::POA {
+
+ # pragma version POA 2.3
+
+ void set_csd_strategy (in Strategy s);
+ };
+};
+
+#endif //CSD_FRAMEWORK_PIDL
diff --git a/TAO/tao/CSD_Framework/CSD_Framework_Loader.cpp b/TAO/tao/CSD_Framework/CSD_Framework_Loader.cpp
new file mode 100644
index 00000000000..dcdcc711e48
--- /dev/null
+++ b/TAO/tao/CSD_Framework/CSD_Framework_Loader.cpp
@@ -0,0 +1,32 @@
+// $Id$
+
+#include "tao/CSD_Framework/CSD_Framework_Loader.h"
+#include "tao/CSD_Framework/CSD_Object_Adapter_Factory.h"
+#include "tao/CSD_Framework/CSD_Strategy_Repository.h"
+#include "ace/Dynamic_Service.h"
+#include "ace/Service_Gestalt.h"
+
+ACE_RCSID (CSD_Framework,
+ CSD_Framework_Loader,
+ "$Id$")
+
+#include "tao/ORB_Core.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+int
+TAO_CSD_Framework_Loader::init (void)
+{
+ ACE_Service_Config::process_directive
+ (ace_svc_desc_TAO_CSD_Object_Adapter_Factory);
+
+ ACE_Service_Config::process_directive
+ (ace_svc_desc_TAO_CSD_Strategy_Repository);
+
+ TAO_ORB_Core::set_poa_factory ("TAO_CSD_Object_Adapter_Factory",
+ "dynamic TAO_CSD_Object_Adapter_Factory Service_Object * TAO_CSD_Framework:_make_TAO_CSD_Object_Adapter_Factory()");
+
+ return 0;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/CSD_Framework/CSD_Framework_Loader.h b/TAO/tao/CSD_Framework/CSD_Framework_Loader.h
new file mode 100644
index 00000000000..44aa1f5c73c
--- /dev/null
+++ b/TAO/tao/CSD_Framework/CSD_Framework_Loader.h
@@ -0,0 +1,47 @@
+/* -*- C++ -*- */
+
+//=============================================================================
+/**
+ * @file CSD_Framework_Loader.h
+ *
+ * $Id$
+ *
+ * Header file for loading CSD framework service objects.
+ *
+ * @author Yan Dai (dai_y@ociweb.com)
+ */
+//=============================================================================
+
+#ifndef TAO_CSD_FRAMEWORK_LOADER_H
+#define TAO_CSD_FRAMEWORK_LOADER_H
+#include /**/ "ace/pre.h"
+
+#include "tao/CSD_Framework/CSD_FW_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Versioned_Namespace.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_CSD_Framework_Loader
+ *
+ * @brief TAO_CSD_Framework_Loader.
+ *
+ * This class acts as a facade for the CSD_Framework library to the
+ * ORB.
+ */
+class TAO_CSD_FW_Export TAO_CSD_Framework_Loader
+{
+ public:
+ /// Used to force the initialization of the ORB code.
+ static int init (void);
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_CSD_FRAMEWORK_LOADER_H */
diff --git a/TAO/tao/CSD_Framework/CSD_ORBInitializer.cpp b/TAO/tao/CSD_Framework/CSD_ORBInitializer.cpp
new file mode 100644
index 00000000000..b67ea4bbc08
--- /dev/null
+++ b/TAO/tao/CSD_Framework/CSD_ORBInitializer.cpp
@@ -0,0 +1,36 @@
+// $Id$
+#include "tao/CSD_Framework/CSD_ORBInitializer.h"
+
+#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
+
+ACE_RCSID (CSD_Framework,
+ CSD_ORBInitializer,
+ "$Id$")
+
+#include "tao/CSD_Framework/CSD_Object_Adapter_Factory.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_CSD_ORBInitializer::TAO_CSD_ORBInitializer ()
+{
+}
+
+void
+TAO_CSD_ORBInitializer::pre_init (
+ PortableInterceptor::ORBInitInfo_ptr
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+}
+
+void
+TAO_CSD_ORBInitializer::post_init (
+ PortableInterceptor::ORBInitInfo_ptr
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
diff --git a/TAO/tao/CSD_Framework/CSD_ORBInitializer.h b/TAO/tao/CSD_Framework/CSD_ORBInitializer.h
new file mode 100644
index 00000000000..8d6aa8a03e5
--- /dev/null
+++ b/TAO/tao/CSD_Framework/CSD_ORBInitializer.h
@@ -0,0 +1,70 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file CSD_ORBInitializer.h
+ *
+ * $Id$
+ *
+ * @author Yan Dai (dai_y@ociweb.com)
+ */
+//=============================================================================
+
+
+#ifndef TAO_CSD_ORB_INITIALIZER_H
+#define TAO_CSD_ORB_INITIALIZER_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
+
+#include "tao/CSD_Framework/CSD_FW_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+//#include "tao/PortableInterceptorC.h"
+#include "tao/LocalObject.h"
+#include "tao/PI/ORBInitializerC.h"
+
+// This is to remove "inherits via dominance" warnings from MSVC.
+// MSVC is being a little too paranoid.
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/// CSD ORB initializer.
+class TAO_CSD_ORBInitializer
+ : public virtual PortableInterceptor::ORBInitializer
+ , public virtual TAO_Local_RefCounted_Object
+{
+public:
+
+ TAO_CSD_ORBInitializer ();
+
+ virtual void pre_init (PortableInterceptor::ORBInitInfo_ptr info
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual void post_init (PortableInterceptor::ORBInitInfo_ptr info
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_CSD_ORB_INITIALIZER_H */
diff --git a/TAO/tao/CSD_Framework/CSD_Object_Adapter.cpp b/TAO/tao/CSD_Framework/CSD_Object_Adapter.cpp
new file mode 100644
index 00000000000..ed74e7c413b
--- /dev/null
+++ b/TAO/tao/CSD_Framework/CSD_Object_Adapter.cpp
@@ -0,0 +1,45 @@
+// $Id$
+
+#include "tao/CSD_Framework/CSD_Object_Adapter.h"
+#include "tao/CSD_Framework/CSD_Strategy_Proxy.h"
+#include "tao/CSD_Framework/CSD_POA.h"
+
+ACE_RCSID (CSD_Framework,
+ CSD_Object_Adapter,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_CSD_Object_Adapter::TAO_CSD_Object_Adapter (
+ const TAO_Server_Strategy_Factory::Active_Object_Map_Creation_Parameters &creation_parameters,
+ TAO_ORB_Core &orb_core)
+ : TAO_Object_Adapter (creation_parameters, orb_core)
+{
+
+}
+
+TAO_CSD_Object_Adapter::~TAO_CSD_Object_Adapter ()
+{
+}
+
+void
+TAO_CSD_Object_Adapter::do_dispatch (
+ TAO_ServerRequest& req,
+ TAO::Portable_Server::Servant_Upcall& upcall
+ ACE_ENV_ARG_DECL)
+{
+ TAO_Root_POA& poa = upcall.poa ();
+ TAO_CSD_POA* csd_poa = dynamic_cast<TAO_CSD_POA*> (&poa);
+
+ if (csd_poa == 0)
+ {
+ ACE_THROW (CORBA::BAD_PARAM ());
+ }
+
+ TAO::CSD::Strategy_Proxy& proxy
+ = csd_poa->servant_dispatching_strategy_proxy ();
+ proxy.dispatch_request (req, upcall ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/CSD_Framework/CSD_Object_Adapter.h b/TAO/tao/CSD_Framework/CSD_Object_Adapter.h
new file mode 100644
index 00000000000..34016654cba
--- /dev/null
+++ b/TAO/tao/CSD_Framework/CSD_Object_Adapter.h
@@ -0,0 +1,57 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file CSD_Object_Adapter.h
+ *
+ * $Id$
+ *
+ * @author Yan Dai (dai_y@ociweb.com)
+ */
+//=============================================================================
+
+
+#ifndef TAO_CSD_OBJECT_ADAPTER_H
+#define TAO_CSD_OBJECT_ADAPTER_H
+#include /**/ "ace/pre.h"
+
+#include "tao/CSD_Framework/CSD_FW_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/Object_Adapter.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_CSD_Object_Adapter
+ *
+ * @brief Defines the CSD version Object Adapter which overrides
+ * default dispatch implementation.
+ *
+ * This class will be used as a facade for the CSD POAs in a server
+ */
+class TAO_CSD_FW_Export TAO_CSD_Object_Adapter : public TAO_Object_Adapter
+{
+public:
+
+ /// Constructor
+ TAO_CSD_Object_Adapter (const TAO_Server_Strategy_Factory::Active_Object_Map_Creation_Parameters &creation_parameters,
+ TAO_ORB_Core &orb_core);
+
+ /// Destructor
+ virtual ~TAO_CSD_Object_Adapter (void);
+
+ /// Hand the request to the Service_Dispatching_Strategy_Proxy for
+ /// dispatching.
+ virtual void do_dispatch (TAO_ServerRequest& req,
+ TAO::Portable_Server::Servant_Upcall& upcall
+ ACE_ENV_ARG_DECL);
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_CSD_OBJECT_ADAPTER_H */
diff --git a/TAO/tao/CSD_Framework/CSD_Object_Adapter_Factory.cpp b/TAO/tao/CSD_Framework/CSD_Object_Adapter_Factory.cpp
new file mode 100644
index 00000000000..fa06817ec2c
--- /dev/null
+++ b/TAO/tao/CSD_Framework/CSD_Object_Adapter_Factory.cpp
@@ -0,0 +1,96 @@
+// $Id$
+
+#include "tao/CSD_Framework/CSD_Object_Adapter_Factory.h"
+#include "tao/CSD_Framework/CSD_Strategy_Repository.h"
+#include "tao/CSD_Framework/CSD_Object_Adapter.h"
+#include "tao/CSD_Framework/CSD_ORBInitializer.h"
+#include "tao/CSD_Framework/CSD_Default_Servant_Dispatcher.h"
+#include "tao/ORB_Core.h"
+#include "tao/ORBInitializer_Registry.h"
+#include "ace/Dynamic_Service.h"
+
+ACE_RCSID (CSD_Framework,
+ CSD_Object_Adapter_Factory,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_CSD_Object_Adapter_Factory::TAO_CSD_Object_Adapter_Factory (void)
+{
+}
+
+TAO_Adapter*
+TAO_CSD_Object_Adapter_Factory::create (TAO_ORB_Core *oc)
+{
+ // Create the CSD object adapter.
+ TAO_CSD_Object_Adapter *object_adapter = 0;
+ ACE_NEW_RETURN (object_adapter,
+ TAO_CSD_Object_Adapter (oc->server_factory ()->
+ active_object_map_creation_parameters (),
+ *oc),
+ 0);
+
+ // Create and register the CSD servant dispatcher.
+ TAO_CSD_Default_Servant_Dispatcher * csd_servant_dispatcher = 0;
+ ACE_NEW_RETURN (csd_servant_dispatcher,
+ TAO_CSD_Default_Servant_Dispatcher,
+ 0);
+ object_adapter->servant_dispatcher (csd_servant_dispatcher);
+
+ return object_adapter;
+}
+
+int
+TAO_CSD_Object_Adapter_Factory::init (int /* argc */,
+ ACE_TCHAR* /* argv */ [])
+{
+ TAO_CSD_Strategy_Repository *repo =
+ ACE_Dynamic_Service<TAO_CSD_Strategy_Repository>::instance ("TAO_CSD_Strategy_Repository");
+
+ if (repo != 0)
+ repo->init(0,0);
+
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ /// Register the Messaging ORBInitializer.
+ PortableInterceptor::ORBInitializer_ptr temp_orb_initializer =
+ PortableInterceptor::ORBInitializer::_nil ();
+
+ ACE_NEW_THROW_EX (temp_orb_initializer,
+ TAO_CSD_ORBInitializer,
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_TRY_CHECK;
+
+ PortableInterceptor::ORBInitializer_var orb_initializer =
+ temp_orb_initializer;
+
+ PortableInterceptor::register_orb_initializer (orb_initializer.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "Caught exception:");
+ return -1;
+ }
+ ACE_ENDTRY;
+
+ return 0;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_FACTORY_DEFINE (TAO_CSD_FW, TAO_CSD_Object_Adapter_Factory)
+ACE_STATIC_SVC_DEFINE (TAO_CSD_Object_Adapter_Factory,
+ ACE_TEXT ("TAO_CSD_Object_Adapter_Factory"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (TAO_CSD_Object_Adapter_Factory),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0)
diff --git a/TAO/tao/CSD_Framework/CSD_Object_Adapter_Factory.h b/TAO/tao/CSD_Framework/CSD_Object_Adapter_Factory.h
new file mode 100644
index 00000000000..cda859315bf
--- /dev/null
+++ b/TAO/tao/CSD_Framework/CSD_Object_Adapter_Factory.h
@@ -0,0 +1,50 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file CSD_Object_Adapter_Factory.h
+ *
+ * $Id$
+ *
+ * @author Yan Dai (dai_y@ociweb.com)
+ */
+//=============================================================================
+
+
+#ifndef TAO_CSD_OBJECT_ADAPTER_FACTORY_H
+#define TAO_CSD_OBJECT_ADAPTER_FACTORY_H
+#include /**/ "ace/pre.h"
+
+#include "tao/CSD_Framework/CSD_FW_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PI/PI.h"
+#include "tao/Adapter_Factory.h"
+#include "ace/Service_Config.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_CSD_FW_Export TAO_CSD_Object_Adapter_Factory : public TAO_Adapter_Factory
+{
+public:
+ /// Constructor
+ TAO_CSD_Object_Adapter_Factory (void);
+
+ // = The TAO_Adapter_Factory methods, please read tao/Adapter.h for
+ // details.
+ virtual TAO_Adapter *create (TAO_ORB_Core *orb_core);
+
+ virtual int init (int argc,
+ ACE_TCHAR* argv[]);
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE_EXPORT (TAO_CSD_FW, TAO_CSD_Object_Adapter_Factory)
+ACE_FACTORY_DECLARE (TAO_CSD_FW, TAO_CSD_Object_Adapter_Factory)
+
+#include /**/ "ace/post.h"
+#endif /* TAO_CSD_OBJECT_ADAPTER_FACTORY_H */
diff --git a/TAO/tao/CSD_Framework/CSD_POA.cpp b/TAO/tao/CSD_Framework/CSD_POA.cpp
new file mode 100644
index 00000000000..f3cc8e605f5
--- /dev/null
+++ b/TAO/tao/CSD_Framework/CSD_POA.cpp
@@ -0,0 +1,134 @@
+// $Id$
+
+#include "tao/CSD_Framework/CSD_POA.h"
+#include "tao/CSD_Framework/CSD_Strategy_Repository.h"
+#include "tao/CSD_Framework/CSD_Strategy_Base.h"
+
+#include "ace/Dynamic_Service.h"
+
+ACE_RCSID (CSD_Framework,
+ CSD_POA,
+ "$Id$")
+
+#if !defined (__ACE_INLINE__)
+# include "tao/CSD_Framework/CSD_POA.inl"
+#endif /* ! __ACE_INLINE__ */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Implementation skeleton constructor
+TAO_CSD_POA::TAO_CSD_POA (const String &name,
+ PortableServer::POAManager_ptr poa_manager,
+ const TAO_POA_Policy_Set &policies,
+ TAO_Root_POA *parent,
+ ACE_Lock &lock,
+ TAO_SYNCH_MUTEX &thread_lock,
+ TAO_ORB_Core &orb_core,
+ TAO_Object_Adapter *object_adapter
+ ACE_ENV_ARG_DECL)
+: TAO_Regular_POA (name,
+ poa_manager,
+ policies,
+ parent,
+ lock,
+ thread_lock,
+ orb_core,
+ object_adapter
+ ACE_ENV_ARG_PARAMETER)
+{
+ ACE_NEW_THROW_EX (this->sds_proxy_,
+ TAO::CSD::Strategy_Proxy (),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK;
+}
+
+
+// Implementation skeleton destructor
+TAO_CSD_POA::~TAO_CSD_POA (void)
+{
+ delete this->sds_proxy_;
+}
+
+void TAO_CSD_POA::set_csd_strategy (
+ ::CSD_Framework::Strategy_ptr strategy
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ if (CORBA::is_nil (strategy))
+ {
+ ACE_THROW (CORBA::BAD_PARAM ());
+ }
+ this->sds_proxy_->custom_strategy (strategy);
+}
+
+TAO_Root_POA *
+TAO_CSD_POA::new_POA (const String &name,
+ PortableServer::POAManager_ptr poa_manager,
+ const TAO_POA_Policy_Set &policies,
+ TAO_Root_POA *parent,
+ ACE_Lock &lock,
+ TAO_SYNCH_MUTEX &thread_lock,
+ TAO_ORB_Core &orb_core,
+ TAO_Object_Adapter *object_adapter
+ ACE_ENV_ARG_DECL)
+{
+ TAO_CSD_POA *poa = 0;
+
+ ACE_NEW_THROW_EX (poa,
+ TAO_CSD_POA (name,
+ poa_manager,
+ policies,
+ parent,
+ lock,
+ thread_lock,
+ orb_core,
+ object_adapter
+ ACE_ENV_ARG_PARAMETER),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (0);
+
+ TAO_CSD_Strategy_Repository *repo =
+ ACE_Dynamic_Service<TAO_CSD_Strategy_Repository>::instance ("TAO_CSD_Strategy_Repository");
+
+
+ CSD_Framework::Strategy_var strategy = repo->find (name);
+
+ if (! ::CORBA::is_nil (strategy.in ()))
+ {
+ poa->set_csd_strategy (strategy.in () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+ }
+
+ return poa;
+}
+
+void TAO_CSD_POA::poa_activated_hook ()
+{
+ this->sds_proxy_->poa_activated_event ();
+}
+
+void TAO_CSD_POA::poa_deactivated_hook ()
+{
+ this->sds_proxy_->poa_deactivated_event ();
+}
+
+void TAO_CSD_POA::servant_activated_hook (PortableServer::Servant servant,
+ const PortableServer::ObjectId& oid
+ ACE_ENV_ARG_DECL)
+{
+ this->sds_proxy_->servant_activated_event (servant, oid ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+void TAO_CSD_POA::servant_deactivated_hook (PortableServer::Servant servant,
+ const PortableServer::ObjectId& oid
+ ACE_ENV_ARG_DECL)
+{
+ this->sds_proxy_->servant_deactivated_event (servant, oid ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/CSD_Framework/CSD_POA.h b/TAO/tao/CSD_Framework/CSD_POA.h
new file mode 100644
index 00000000000..bcbf2e0495f
--- /dev/null
+++ b/TAO/tao/CSD_Framework/CSD_POA.h
@@ -0,0 +1,111 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file CSD_POA.h
+ *
+ * $Id$
+ *
+ * @author Yan Dai (dai_y@ociweb.com)
+ */
+//=============================================================================
+
+#ifndef TAO_CSD_POA_H
+#define TAO_CSD_POA_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/CSD_Framework/CSD_FW_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+#pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/Regular_POA.h"
+#include "tao/CSD_Framework/CSD_Strategy_Proxy.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_CSD_POA
+ *
+ * @brief Implementation of the CSD_Framework::POA interface.
+ *
+ * Implementation of the CSD_Framework::POA interface.
+ */
+class TAO_CSD_FW_Export TAO_CSD_POA
+ : public virtual CSD_Framework::POA,
+ public virtual TAO_Regular_POA
+{
+public:
+ //Constructor
+ TAO_CSD_POA (const String &name,
+ PortableServer::POAManager_ptr poa_manager,
+ const TAO_POA_Policy_Set &policies,
+ TAO_Root_POA *parent,
+ ACE_Lock &lock,
+ TAO_SYNCH_MUTEX &thread_lock,
+ TAO_ORB_Core &orb_core,
+ TAO_Object_Adapter *object_adapter
+ ACE_ENV_ARG_DECL);
+
+ //Destructor
+ virtual ~TAO_CSD_POA (void);
+
+ /// Pass the Strategy object reference to the CSD poa.
+ virtual
+ void set_csd_strategy (
+ ::CSD_Framework::Strategy_ptr s
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ /// Hook - The POA has been (or is being) activated.
+ virtual void poa_activated_hook ();
+
+ /// Hook - The POA has been deactivated.
+ virtual void poa_deactivated_hook ();
+
+ /// Hook - A servant has been activated.
+ virtual void servant_activated_hook (PortableServer::Servant servant,
+ const PortableServer::ObjectId& oid
+ ACE_ENV_ARG_DECL);
+
+ /// Hook - A servant has been deactivated.
+ virtual void servant_deactivated_hook (PortableServer::Servant servant,
+ const PortableServer::ObjectId& oid
+ ACE_ENV_ARG_DECL);
+
+ ///Method for creating new CSD POA.
+ TAO_Root_POA * new_POA (const String &name,
+ PortableServer::POAManager_ptr poa_manager,
+ const TAO_POA_Policy_Set &policies,
+ TAO_Root_POA *parent,
+ ACE_Lock &lock,
+ TAO_SYNCH_MUTEX &thread_lock,
+ TAO_ORB_Core &orb_core,
+ TAO_Object_Adapter *object_adapter
+ ACE_ENV_ARG_DECL);
+
+ /// Servant Dispatching Strategy proxy accessor.
+ TAO::CSD::Strategy_Proxy&
+ servant_dispatching_strategy_proxy (void) const;
+
+private:
+
+ TAO::CSD::Strategy_Proxy* sds_proxy_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+
+#if defined (__ACE_INLINE__)
+# include "tao/CSD_Framework/CSD_POA.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_CSD_POA_H */
+
diff --git a/TAO/tao/CSD_Framework/CSD_POA.inl b/TAO/tao/CSD_Framework/CSD_POA.inl
new file mode 100644
index 00000000000..5e94cf5401e
--- /dev/null
+++ b/TAO/tao/CSD_Framework/CSD_POA.inl
@@ -0,0 +1,14 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO::CSD::Strategy_Proxy&
+TAO_CSD_POA::servant_dispatching_strategy_proxy (void) const
+{
+ return *sds_proxy_;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/CSD_Framework/CSD_Strategy_Base.cpp b/TAO/tao/CSD_Framework/CSD_Strategy_Base.cpp
new file mode 100644
index 00000000000..aa641fe9bc7
--- /dev/null
+++ b/TAO/tao/CSD_Framework/CSD_Strategy_Base.cpp
@@ -0,0 +1,132 @@
+// $Id$
+
+#include "tao/CSD_Framework/CSD_Strategy_Base.h"
+#include "tao/CSD_Framework/CSD_POA.h"
+#include "tao/CSD_Framework/CSD_Strategy_Proxy.h"
+#include "tao/PortableServer/Root_POA.h"
+#include "tao/PortableServer/POAManager.h"
+#include "tao/PortableServer/Servant_Base.h"
+#include "tao/TAO_Server_Request.h"
+
+ACE_RCSID (CSD_Framework,
+ CSD_Strategy_Base,
+ "$Id$")
+
+#if !defined (__ACE_INLINE__)
+# include "tao/CSD_Framework/CSD_Strategy_Base.inl"
+#endif /* ! __ACE_INLINE__ */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO::CSD::Strategy_Base::~Strategy_Base()
+{
+}
+
+CORBA::Boolean
+TAO::CSD::Strategy_Base::apply_to (PortableServer::POA_ptr poa
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ if (CORBA::is_nil(poa))
+ {
+ if (TAO_debug_level > 0)
+ ACE_ERROR((LM_ERROR,
+ ACE_TEXT("(%P|%t) CSD Strategy cannot ")
+ ACE_TEXT("be applied to a nil POA.\n")));
+ return false;
+ }
+
+ if (!CORBA::is_nil(this->poa_.in()))
+ {
+ if (TAO_debug_level > 0)
+ ACE_ERROR((LM_ERROR,
+ ACE_TEXT("(%P|%t) CSD Strategy already ")
+ ACE_TEXT("applied to a POA.\n")));
+ return false;
+ }
+
+ // The POA is a local interface (IDL terminology), and thus we know that
+ // we can downcast the POA_ptr to its (TAO) implementation type.
+ TAO_CSD_POA* poa_impl = dynamic_cast<TAO_CSD_POA*>(poa);
+
+ if (poa_impl == 0)
+ {
+ if (TAO_debug_level > 0)
+ ACE_ERROR((LM_ERROR,
+ ACE_TEXT("(%P|%t) CSD Strategy cannot ")
+ ACE_TEXT("be applied to a non CSD POA.\n")));
+ return false;
+ }
+
+ // We need to check to see if the POA is already "active". If this is
+ // the case, then we need to handle the poa_activated_event() right now.
+ // If the POA is not already "active", then we can just wait until it
+ // does get activated, and we (the strategy) will be informed of the
+ // poa_activated_event() at that time.
+ if (poa_impl->tao_poa_manager().get_state() ==
+ PortableServer::POAManager::ACTIVE)
+ {
+ // The POA is already "active" (since its POAManager is active).
+ // We need to "raise" the poa_activated_event() now. Otherwise,
+ // the event will be raised when the POAManager does become active.
+ if (!this->poa_activated_event())
+ {
+ // An error has been already been reported to the log with
+ // the detailed reason for the failure to handle the event.
+ return false;
+ }
+ }
+
+ // Set the CSD Strategy_Base on the strategy proxy object owned by the POA.
+ bool strategy_set = false;
+ ACE_TRY_NEW_ENV
+ {
+ poa_impl->set_csd_strategy (this ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ strategy_set = true;
+ }
+ ACE_CATCHANY
+ {
+ }
+ ACE_ENDTRY;
+
+ if (! strategy_set)
+ {
+ // We need to make sure that we raise a poa_deactivated_event() if
+ // we earlier raised a poa_activated_event().
+ this->poa_deactivated_event();
+
+ // An error has been already been reported to the log with
+ // the detailed reason why the proxy will not accept the
+ // custom strategy.
+ return false;
+ }
+
+ // Save a duplicate of the poa into our data member.
+ this->poa_ = PortableServer::POA::_duplicate (poa);
+
+ // Success
+ return true;
+}
+
+
+void
+TAO::CSD::Strategy_Base::servant_activated_event_i
+ (PortableServer::Servant ,
+ const PortableServer::ObjectId&
+ ACE_ENV_ARG_DECL)
+{
+ // do nothing.
+}
+
+
+void
+TAO::CSD::Strategy_Base::servant_deactivated_event_i
+ (PortableServer::Servant,
+ const PortableServer::ObjectId&
+ ACE_ENV_ARG_DECL)
+{
+ // do nothing.
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/CSD_Framework/CSD_Strategy_Base.h b/TAO/tao/CSD_Framework/CSD_Strategy_Base.h
new file mode 100644
index 00000000000..d65753a27f7
--- /dev/null
+++ b/TAO/tao/CSD_Framework/CSD_Strategy_Base.h
@@ -0,0 +1,174 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file CSD_Strategy_Base.h
+ *
+ * $Id$
+ *
+ * @author Tim Bradley <bradley_t@ociweb.com>
+ */
+//=============================================================================
+
+#ifndef TAO_CSD_FW_CUSTOM_SERVANT_DISPATCHING_STRATEGY_H
+#define TAO_CSD_FW_CUSTOM_SERVANT_DISPATCHING_STRATEGY_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/CSD_Framework/CSD_FW_Export.h"
+
+#include "tao/PortableServer/PortableServer.h"
+#include "tao/PortableServer/Servant_Upcall.h"
+#include "tao/PortableServer/Servant_Base.h"
+#include "tao/TAO_Server_Request.h"
+#include "tao/LocalObject.h"
+
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/CSD_Framework/CSD_FrameworkC.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Root_POA;
+namespace PortableServer
+{
+ class POAManager;
+}
+
+namespace TAO
+{
+ namespace CSD
+ {
+ /**
+ * @class Strategy_Base
+ *
+ * @brief Base class for all Custom Servant Dispatching Strategies.
+ *
+ * This class serves as the base class for all "custom" strategies that
+ * perform servant dispatching. An instance of (a subclass of) this class
+ * can be applied to a POA object. Any servant requests for the POA will
+ * be "dispatched" to this strategy object.
+ *
+ */
+ class TAO_CSD_FW_Export Strategy_Base
+ : public CSD_Framework::Strategy,
+ public TAO_Local_RefCounted_Object
+ {
+ public:
+
+ /// Result Type for dispatching method(s).
+ enum DispatchResult
+ {
+ // The request dispatching has been handled.
+ DISPATCH_HANDLED,
+
+ // The request dispatching has been rejected.
+ DISPATCH_REJECTED,
+
+ // Defer to "default" dispatching strategy (use the caller's thread).
+ DISPATCH_DEFERRED
+ };
+
+ /// Virtual Destructor.
+ virtual ~Strategy_Base();
+
+ /// This method is invoked to "attach" this strategy object to
+ /// the supplied POA. Returns true for success, and false for failure.
+ CORBA::Boolean apply_to(PortableServer::POA_ptr poa ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC((CORBA::SystemException));
+
+ protected:
+ /// Default Constructor.
+ Strategy_Base();
+
+ /// Subclass provides implementation to dispatch a remote request.
+ virtual DispatchResult dispatch_remote_request_i
+ (TAO_ServerRequest& server_request,
+ const PortableServer::ObjectId& object_id,
+ PortableServer::POA_ptr poa,
+ const char* operation,
+ PortableServer::Servant servant
+ ACE_ENV_ARG_DECL) = 0;
+
+ /// Subclass provides implementation to dispatch a collocated request.
+ virtual DispatchResult dispatch_collocated_request_i
+ (TAO_ServerRequest& server_request,
+ const PortableServer::ObjectId& object_id,
+ PortableServer::POA_ptr poa,
+ const char* operation,
+ PortableServer::Servant servant
+ ACE_ENV_ARG_DECL) = 0;
+
+ /// Event - The POA has been activated.
+ virtual bool poa_activated_event_i() = 0;
+
+ /// Event - The POA has been deactivated.
+ virtual void poa_deactivated_event_i() = 0;
+
+ /// Event - A servant has been activated.
+ virtual void servant_activated_event_i
+ (PortableServer::Servant servant,
+ const PortableServer::ObjectId& oid
+ ACE_ENV_ARG_DECL);
+
+ /// Event - A servant has been deactivated.
+ virtual void servant_deactivated_event_i
+ (PortableServer::Servant servant,
+ const PortableServer::ObjectId& oid
+ ACE_ENV_ARG_DECL);
+
+ private:
+
+ /// Only our friend, the proxy, is allowed to invoke our private operations.
+ /// This allows us to not pollute the public interface of the CSD Strategy_Base
+ /// subclasses with methods that should never be called (except by the
+ /// proxy, of course).
+ friend class Strategy_Proxy;
+
+ /// This CSD Strategy_Base has been asked to dispatch a (collocated or remote)
+ /// request.
+ void dispatch_request(TAO_ServerRequest& server_request,
+ ::TAO::Portable_Server::Servant_Upcall& upcall
+ ACE_ENV_ARG_DECL);
+
+ /// Event - The POA has been activated. This happens when the POA_Manager
+ /// is activated.
+ bool poa_activated_event();
+
+ /// Event - The POA has been deactivated. This happens when the
+ /// POAManager is deactivated, or when the POA is destroyed.
+ void poa_deactivated_event();
+
+ /// Event - A servant has been activated.
+ void servant_activated_event(PortableServer::Servant servant,
+ const PortableServer::ObjectId& oid
+ ACE_ENV_ARG_DECL);
+
+ /// Event - A servant has been deactivated. This also occurs when
+ /// the POA is destroyed.
+ void servant_deactivated_event(PortableServer::Servant servant,
+ const PortableServer::ObjectId& oid
+ ACE_ENV_ARG_DECL);
+
+ /// The POA to which this strategy has been applied.
+ ::PortableServer::POA_var poa_;
+
+ /// This flag indicates that the POA is currently active (true) or
+ /// currently inactive (false).
+ bool poa_activated_;
+ };
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/CSD_Framework/CSD_Strategy_Base.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_CSD_FW_CUSTOM_SERVANT_DISPATCHING_STRATEGY_H */
diff --git a/TAO/tao/CSD_Framework/CSD_Strategy_Base.inl b/TAO/tao/CSD_Framework/CSD_Strategy_Base.inl
new file mode 100644
index 00000000000..6dce0cf7397
--- /dev/null
+++ b/TAO/tao/CSD_Framework/CSD_Strategy_Base.inl
@@ -0,0 +1,144 @@
+// -*- C++ -*-
+//
+// $Id$
+
+#include "tao/debug.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO::CSD::Strategy_Base::Strategy_Base()
+ : poa_activated_(false)
+{
+}
+
+ACE_INLINE
+void
+TAO::CSD::Strategy_Base::dispatch_request
+ (TAO_ServerRequest& server_request,
+ TAO::Portable_Server::Servant_Upcall& upcall
+ ACE_ENV_ARG_DECL)
+{
+ DispatchResult result;
+
+ if (server_request.collocated())
+ {
+ result = this->dispatch_collocated_request_i(server_request,
+ upcall.user_id(),
+ this->poa_.in(),
+ server_request.operation(),
+ upcall.servant()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else
+ {
+ result = this->dispatch_remote_request_i(server_request,
+ upcall.user_id(),
+ this->poa_.in(),
+ server_request.operation(),
+ upcall.servant()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ switch (result)
+ {
+ case DISPATCH_HANDLED:
+ // Do nothing. Everything has been handled.
+ break;
+
+ case DISPATCH_REJECTED:
+ if (server_request.collocated ())
+ {
+ CORBA::NO_IMPLEMENT ex;
+ ex._raise ();
+ }
+ else
+ {
+ // Raise an appropriate SystemException if the request is expecting
+ // a reply.
+ if (!server_request.sync_with_server() &&
+ server_request.response_expected() &&
+ !server_request.deferred_reply())
+ {
+ CORBA::NO_IMPLEMENT ex;
+ server_request.tao_send_reply_exception(ex);
+ }
+ }
+ break;
+
+ case DISPATCH_DEFERRED:
+ // Perform the "default" dispatching strategy logic for this request
+ // right now, using the current thread.
+ upcall.servant()->_dispatch(server_request,
+ (void*)&upcall
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ break;
+
+ default:
+ if (TAO_debug_level > 0)
+ ACE_ERROR((LM_ERROR,
+ ACE_TEXT("(%P|%t) Unknown result (%d) from call to ")
+ ACE_TEXT("dispatch_remote_request_i().\n"), result));
+ // Since we do not know what to do here, just do the minimum, which
+ // treats this case just like the DISPATCH_HANDLED case, for better
+ // or worse. Hitting this default case means a coding error.
+ break;
+ }
+}
+
+
+ACE_INLINE
+bool
+TAO::CSD::Strategy_Base::poa_activated_event()
+{
+ // Notify the subclass of the event, saving the result.
+ this->poa_activated_ = this->poa_activated_event_i();
+
+ // Return the result
+ return this->poa_activated_;
+}
+
+ACE_INLINE
+void
+TAO::CSD::Strategy_Base::poa_deactivated_event()
+{
+ if (this->poa_activated_)
+ {
+ this->poa_activated_ = false;
+
+ // Notify the subclass of the event.
+ this->poa_deactivated_event_i();
+
+ // Reset the poa to nil to decrement the reference count.
+ // This will break the circular dependency of the deletion
+ // of the CSD POA.
+ this->poa_ = 0;
+ }
+}
+
+ACE_INLINE
+void
+TAO::CSD::Strategy_Base::servant_activated_event
+ (PortableServer::Servant servant,
+ const PortableServer::ObjectId& oid
+ ACE_ENV_ARG_DECL)
+{
+ this->servant_activated_event_i(servant, oid ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+ACE_INLINE
+void
+TAO::CSD::Strategy_Base::servant_deactivated_event
+ (PortableServer::Servant servant,
+ const PortableServer::ObjectId& oid
+ ACE_ENV_ARG_DECL)
+{
+ this->servant_deactivated_event_i(servant, oid ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/CSD_Framework/CSD_Strategy_Proxy.cpp b/TAO/tao/CSD_Framework/CSD_Strategy_Proxy.cpp
new file mode 100644
index 00000000000..b163134be56
--- /dev/null
+++ b/TAO/tao/CSD_Framework/CSD_Strategy_Proxy.cpp
@@ -0,0 +1,50 @@
+// $Id$
+
+#include "tao/CSD_Framework/CSD_Strategy_Proxy.h"
+#include "tao/TAO_Server_Request.h"
+#include "tao/debug.h"
+
+ACE_RCSID (CSD_Framework,
+ CSD_Strategy_Base,
+ "$Id$")
+
+
+#if !defined (__ACE_INLINE__)
+# include "tao/CSD_Framework/CSD_Strategy_Proxy.inl"
+#endif /* ! __ACE_INLINE__ */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+bool
+TAO::CSD::Strategy_Proxy::custom_strategy
+ (CSD_Framework::Strategy_ptr strategy)
+{
+ if (this->strategy_impl_)
+ {
+ if (TAO_debug_level > 0)
+ ACE_ERROR((LM_ERROR,
+ ACE_TEXT("(%P|%t) Error - TAO::CSD::Strategy_Proxy ")
+ ACE_TEXT("object already has a custom strategy.\n")));
+
+ return false;
+ }
+
+ if (CORBA::is_nil(strategy))
+ {
+ if (TAO_debug_level > 0)
+ ACE_ERROR((LM_ERROR,
+ ACE_TEXT("(%P|%t) Error - TAO::CSD::Strategy_Proxy ")
+ ACE_TEXT("supplied with a NIL custom strategy.\n")));
+
+ return false;
+ }
+
+ // We need to bump up the reference count of the strategy before saving
+ // it off into our handle (smart pointer) data member.
+ this->strategy_ = CSD_Framework::Strategy::_duplicate(strategy);
+ this->strategy_impl_ = dynamic_cast <TAO::CSD::Strategy_Base*> (strategy);
+
+ return true;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/CSD_Framework/CSD_Strategy_Proxy.h b/TAO/tao/CSD_Framework/CSD_Strategy_Proxy.h
new file mode 100644
index 00000000000..959a7cb9ebb
--- /dev/null
+++ b/TAO/tao/CSD_Framework/CSD_Strategy_Proxy.h
@@ -0,0 +1,114 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file CSD_Strategy_Proxy.h
+ *
+ * $Id$
+ *
+ * @author Tim Bradley <bradley_t@ociweb.com>
+ */
+//=============================================================================
+
+#ifndef TAO_SERVANT_DISPATCHING_STRATEGY_PROXY_H
+#define TAO_SERVANT_DISPATCHING_STRATEGY_PROXY_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/CSD_Framework/CSD_FW_Export.h"
+
+#include "tao/PortableServer/PortableServer.h"
+#include "tao/PortableServer/Servant_Upcall.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/CSD_Framework/CSD_Strategy_Base.h"
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_ServerRequest;
+
+namespace TAO
+{
+ namespace CSD
+ {
+ /**
+ * @class Strategy_Proxy
+ *
+ * @brief Proxy class for the Custom Servant Dispatching Strategy.
+ *
+ * If no custom servant dispatching strategy is provided to the proxy,
+ * then the "default servant dispatching strategy" logic is used.
+ */
+ class TAO_CSD_FW_Export Strategy_Proxy
+ {
+ public:
+
+ /// Default Constructor.
+ Strategy_Proxy();
+
+ /// Destructor.
+ ~Strategy_Proxy();
+
+ /// Mutator to provide the proxy with a CSD Strategy object.
+ /// A return value of true indicates success, and false indicates
+ /// failure to set the custom strategy on the proxy object.
+ bool custom_strategy(CSD_Framework::Strategy_ptr strategy);
+
+ /// Invoked by the Object_Adapter using an ORB thread.
+ ///
+ /// If the proxy object holds a custom strategy object, then this method
+ /// will simply delegate to the custom strategy object. Otherwise,
+ /// this method will perform the "default servant dispatching strategy"
+ /// logic, preserving the original logic path as it was prior to the
+ /// introduction of the Custom Servant Dispatching feature.
+ ///
+ /// This method will be inlined (if inlining is turned on during the build).
+ ///
+ /// The added cost to the original logic path will be this method
+ /// invocation + one conditional (an is_nil() call/comparison for truth on
+ /// the smart pointer to the custom dispatching strategy object).
+ void dispatch_request(TAO_ServerRequest& server_request,
+ TAO::Portable_Server::Servant_Upcall& upcall
+ ACE_ENV_ARG_DECL);
+
+
+ /// Event - The POA has been (or is being) activated.
+ bool poa_activated_event();
+
+ /// Event - The POA has been deactivated.
+ void poa_deactivated_event();
+
+ /// Event - A servant has been activated.
+ void servant_activated_event(PortableServer::Servant servant,
+ const PortableServer::ObjectId& oid
+ ACE_ENV_ARG_DECL);
+
+ /// Event - A servant has been deactivated.
+ void servant_deactivated_event(PortableServer::Servant servant,
+ const PortableServer::ObjectId& oid
+ ACE_ENV_ARG_DECL);
+
+ private:
+
+ /// Smart Pointer to a custom servant dispatching strategy object.
+ /// This smart pointer will be in the "nil" state when the "default"
+ /// strategy is to be applied.
+ CSD_Framework::Strategy_var strategy_;
+ TAO::CSD::Strategy_Base *strategy_impl_;
+ };
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/CSD_Framework/CSD_Strategy_Proxy.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif
diff --git a/TAO/tao/CSD_Framework/CSD_Strategy_Proxy.inl b/TAO/tao/CSD_Framework/CSD_Strategy_Proxy.inl
new file mode 100644
index 00000000000..957852e6517
--- /dev/null
+++ b/TAO/tao/CSD_Framework/CSD_Strategy_Proxy.inl
@@ -0,0 +1,104 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO::CSD::Strategy_Proxy::Strategy_Proxy()
+ : strategy_impl_(0)
+{
+}
+
+ACE_INLINE
+TAO::CSD::Strategy_Proxy::~Strategy_Proxy()
+{
+ strategy_impl_ = 0; // don't delete it! The var will do it for us.
+}
+
+ACE_INLINE
+void
+TAO::CSD::Strategy_Proxy::dispatch_request
+ (TAO_ServerRequest& server_request,
+ TAO::Portable_Server::Servant_Upcall& upcall
+ ACE_ENV_ARG_DECL)
+{
+
+ if (this->strategy_impl_ == 0)
+ {
+ // This is the "default" strategy implementation.
+ upcall.servant()->_dispatch(server_request,
+ (void*)&upcall
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else
+ {
+ // Delegate to the custom strategy object.
+ this->strategy_impl_->dispatch_request(server_request,
+ upcall
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+}
+
+ACE_INLINE
+bool
+TAO::CSD::Strategy_Proxy::poa_activated_event()
+{
+ // Delegate to the custom strategy object (or return true if this proxy
+ // is not holding a custom strategy).
+ return (this->strategy_impl_ == 0) ? true
+ : this->strategy_impl_->poa_activated_event();
+}
+
+
+ACE_INLINE
+void
+TAO::CSD::Strategy_Proxy::poa_deactivated_event()
+{
+ // We only need to do something if this proxy holds a custom strategy.
+ if (this->strategy_impl_)
+ {
+ // Delegate to the custom strategy object.
+ this->strategy_impl_->poa_deactivated_event();
+ }
+}
+
+ACE_INLINE
+void
+TAO::CSD::Strategy_Proxy::servant_activated_event
+ (PortableServer::Servant servant,
+ const PortableServer::ObjectId& oid
+ ACE_ENV_ARG_DECL)
+{
+ // We only need to do something if this proxy holds a custom strategy.
+ if (this->strategy_impl_)
+ {
+ // Delegate to the custom strategy object.
+ this->strategy_impl_->servant_activated_event(servant,
+ oid
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+}
+
+ACE_INLINE
+void
+TAO::CSD::Strategy_Proxy::servant_deactivated_event
+ (PortableServer::Servant servant,
+ const PortableServer::ObjectId& oid
+ ACE_ENV_ARG_DECL)
+{
+ // We only need to do something if this proxy holds a custom strategy.
+ if (this->strategy_impl_)
+ {
+ // Delegate to the custom strategy object.
+ this->strategy_impl_->servant_deactivated_event(servant,
+ oid
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/CSD_Framework/CSD_Strategy_Repository.cpp b/TAO/tao/CSD_Framework/CSD_Strategy_Repository.cpp
new file mode 100644
index 00000000000..5a169516bf5
--- /dev/null
+++ b/TAO/tao/CSD_Framework/CSD_Strategy_Repository.cpp
@@ -0,0 +1,117 @@
+// $Id$
+
+#include "tao/CSD_Framework/CSD_Strategy_Repository.h"
+#include "tao/debug.h"
+
+ACE_RCSID (CSD_Framework,
+ CSD_Strategy_Factory,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_CSD_Strategy_Repository::TAO_CSD_Strategy_Repository()
+{
+}
+
+
+TAO_CSD_Strategy_Repository::~TAO_CSD_Strategy_Repository()
+{
+ delete this->strategy_list_head_;
+}
+
+int
+TAO_CSD_Strategy_Repository::init(int, ACE_TCHAR **)
+{
+
+ static int initialized = 0;
+
+ // Only allow initialization once.
+ if (initialized)
+ return 0;
+
+ initialized = 1;
+ this->strategy_list_head_ = 0;
+ return 0;
+}
+
+CSD_Framework::Strategy_ptr
+TAO_CSD_Strategy_Repository::find (const ACE_CString& name)
+{
+
+ if (this->strategy_list_head_ != 0)
+ {
+ Strategy_Node *node = this->strategy_list_head_->find(name);
+ if (node != 0)
+ return CSD_Framework::Strategy::_duplicate (node->strategy_.in());
+ }
+
+ return CSD_Framework::Strategy::_nil();
+}
+
+
+int
+TAO_CSD_Strategy_Repository::add_strategy (const ACE_CString& name,
+ CSD_Framework::Strategy_ptr strat)
+{
+ Strategy_Node *node = 0;
+ ACE_NEW_RETURN (node, Strategy_Node(name,strat),-1);
+ if (this->strategy_list_head_ == 0)
+ this->strategy_list_head_ = node;
+ else
+ this->strategy_list_head_->add_node(node);
+
+ if (TAO_debug_level > 3)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT("Strategy_Repository::add_strategy for %s \n"),
+ name.c_str ()));
+ }
+ return 0;
+}
+
+TAO_CSD_Strategy_Repository::Strategy_Node::Strategy_Node (const ACE_CString& name,
+ CSD_Framework::Strategy_ptr strat)
+ : poa_name_(name),
+ strategy_(CSD_Framework::Strategy::_duplicate(strat)),
+ next_(0)
+{
+}
+
+TAO_CSD_Strategy_Repository::Strategy_Node::~Strategy_Node ()
+{
+ if (this->next_)
+ delete this->next_;
+}
+
+void
+TAO_CSD_Strategy_Repository::Strategy_Node::add_node(Strategy_Node *node)
+{
+ if (this->next_)
+ this->next_->add_node(node);
+ else
+ this->next_ = node;
+}
+
+TAO_CSD_Strategy_Repository::Strategy_Node *
+TAO_CSD_Strategy_Repository::Strategy_Node::find(const ACE_CString &name)
+{
+ if (this->poa_name_ == name)
+ return this;
+ if (this->next_)
+ return this->next_->find(name);
+ return 0;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+/////////////////////////////////////////////////////////////////////
+
+ACE_FACTORY_DEFINE (TAO_CSD_FW, TAO_CSD_Strategy_Repository)
+ACE_STATIC_SVC_DEFINE (TAO_CSD_Strategy_Repository,
+ ACE_TEXT ("TAO_CSD_Strategy_Repository"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (TAO_CSD_Strategy_Repository),
+ ACE_Service_Type::DELETE_THIS
+ | ACE_Service_Type::DELETE_OBJ,
+ 0)
diff --git a/TAO/tao/CSD_Framework/CSD_Strategy_Repository.h b/TAO/tao/CSD_Framework/CSD_Strategy_Repository.h
new file mode 100644
index 00000000000..7e50fe5f62f
--- /dev/null
+++ b/TAO/tao/CSD_Framework/CSD_Strategy_Repository.h
@@ -0,0 +1,78 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file CSD_Strategy_Repository.h
+ *
+ * $Id$
+ *
+ * @author Yan Dai <dai_y@ociweb.com>
+ */
+//=============================================================================
+
+#ifndef TAO_CSD_STRATEGY_FACTORY_H
+#define TAO_CSD_STRATEGY_FACTORY_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/CSD_Framework/CSD_FW_Export.h"
+#include "tao/CSD_Framework/CSD_FrameworkC.h"
+#include "ace/Service_Object.h"
+#include "ace/Service_Config.h"
+#include "ace/Synch.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_CSD_Strategy_Factory
+ *
+ * @brief An ACE_Service_Object capable of creating TP_Strategy objects.
+ *
+ * TBD - Explain in more detail.
+ *
+ */
+class TAO_CSD_FW_Export TAO_CSD_Strategy_Repository : public ACE_Service_Object
+{
+public:
+
+ /// Constructor.
+ TAO_CSD_Strategy_Repository();
+
+ /// Virtual Destructor.
+ virtual ~TAO_CSD_Strategy_Repository();
+
+ int init (int argc, ACE_TCHAR ** argv);
+
+ /// Factory method used to create a CSD_Strategy object.
+ CSD_Framework::Strategy_ptr find (const ACE_CString& poa_name);
+
+ int add_strategy (const ACE_CString& poa_name,
+ CSD_Framework::Strategy_ptr strategy);
+
+private:
+ struct Strategy_Node {
+ Strategy_Node(const ACE_CString& poa_name,
+ CSD_Framework::Strategy_ptr strategy);
+ ~Strategy_Node();
+ void add_node (Strategy_Node *);
+ Strategy_Node *find(const ACE_CString& name);
+
+ ACE_CString poa_name_;
+ CSD_Framework::Strategy_var strategy_;
+ Strategy_Node * next_;
+ };
+ Strategy_Node * strategy_list_head_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE_EXPORT (TAO_CSD_FW, TAO_CSD_Strategy_Repository)
+ACE_FACTORY_DECLARE (TAO_CSD_FW, TAO_CSD_Strategy_Repository)
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_CSD_STRATEGY_FACTORY_H */
diff --git a/TAO/tao/CSD_Framework/TAO_CSD_Framework.pc.in b/TAO/tao/CSD_Framework/TAO_CSD_Framework.pc.in
new file mode 100644
index 00000000000..bef4a93f175
--- /dev/null
+++ b/TAO/tao/CSD_Framework/TAO_CSD_Framework.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: TAO_CSD_Framework
+Description: TAO CSD Framework Library
+Requires: TAO_PortableServer, TAO_PI, TAO
+Version: @VERSION@
+Libs: -L${libdir} -lTAO
+Cflags: -I${includedir}
diff --git a/TAO/tao/CSD_ThreadPool.mpc b/TAO/tao/CSD_ThreadPool.mpc
new file mode 100644
index 00000000000..9181084a3fa
--- /dev/null
+++ b/TAO/tao/CSD_ThreadPool.mpc
@@ -0,0 +1,39 @@
+//$Id$
+project : csd_framework, core {
+ sharedname = TAO_CSD_ThreadPool
+ dynamicflags = TAO_CSD_TP_BUILD_DLL
+ includes += $(TAO_ROOT)/tao
+ requires += threads
+
+ Source_Files {
+ CSD_ThreadPool
+ }
+
+ Header_Files {
+ CSD_ThreadPool
+ }
+
+ Inline_Files {
+ CSD_ThreadPool
+ }
+
+ Template_Files {
+ CSD_ThreadPool
+ }
+
+ Resource_Files {
+ CSD_ThreadPool
+ }
+
+ IDL_Files {
+ CSD_ThreadPool
+ }
+
+ PIDL_Files {
+ CSD_ThreadPool
+ }
+
+ Pkgconfig_Files {
+ CSD_ThreadPool/TAO_CSD_ThreadPool.pc.in
+ }
+}
diff --git a/TAO/tao/CSD_ThreadPool/CSD_TP_Cancel_Visitor.cpp b/TAO/tao/CSD_ThreadPool/CSD_TP_Cancel_Visitor.cpp
new file mode 100644
index 00000000000..35b6b316012
--- /dev/null
+++ b/TAO/tao/CSD_ThreadPool/CSD_TP_Cancel_Visitor.cpp
@@ -0,0 +1,48 @@
+// $Id$
+
+#include "tao/CSD_ThreadPool/CSD_TP_Cancel_Visitor.h"
+#include "tao/CSD_ThreadPool/CSD_TP_Request.h"
+
+ACE_RCSID (CSD_TP,
+ Cancel_Visitor,
+ "$Id$")
+
+#if !defined (__ACE_INLINE__)
+# include "tao/CSD_ThreadPool/CSD_TP_Cancel_Visitor.inl"
+#endif /* ! __ACE_INLINE__ */
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO::CSD::TP_Cancel_Visitor::~TP_Cancel_Visitor()
+{
+}
+
+
+bool
+TAO::CSD::TP_Cancel_Visitor::visit_request(TP_Request* request,
+ bool& remove_flag)
+{
+ // If our servant_ data member is in the 'nil' state, then
+ // we are supposed to cancel *ALL* requests that we visit.
+ //
+ // Otherwise, if our servant_ data member is not in the 'nil' state,
+ // we are supposed to cancel only requests that target our specific
+ // servant_.
+
+ if ((this->servant_.in() == 0) || (request->is_target(this->servant_.in())))
+ {
+ // Set the remove_flag to true so that this request is removed
+ // (and released) from the queue when we finish our visit.
+ remove_flag = true;
+
+ // Cancel the request
+ request->cancel();
+ }
+
+ // Since we are either cancelling requests to any servant or a
+ // specific servant, always continue visitation.
+ return true;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/CSD_ThreadPool/CSD_TP_Cancel_Visitor.h b/TAO/tao/CSD_ThreadPool/CSD_TP_Cancel_Visitor.h
new file mode 100644
index 00000000000..d9b2472e507
--- /dev/null
+++ b/TAO/tao/CSD_ThreadPool/CSD_TP_Cancel_Visitor.h
@@ -0,0 +1,87 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file CSD_TP_Cancel_Visitor.h
+ *
+ * $Id$
+ *
+ * @author Tim Bradley <bradley_t@ociweb.com>
+ */
+//=============================================================================
+
+#ifndef TAO_CSD_TP_CANCEL_VISITOR_H
+#define TAO_CSD_TP_CANCEL_VISITOR_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/CSD_ThreadPool/CSD_TP_Export.h"
+#include "tao/PortableServer/Servant_Base.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/CSD_ThreadPool/CSD_TP_Queue_Visitor.h"
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace CSD
+ {
+ /**
+ * @class TP_Cancel_Visitor
+ *
+ * @brief Used to extract/cancel request(s) from the queue.
+ *
+ * This visitor is used to cancel certain requests in the queue
+ * as they are visited.
+ *
+ * Note that this is currently implemented to cancel *all*
+ * requests in the queue, or requests that are targeted for a specific
+ * servant. This could be extended in the future to perhaps
+ * cancel all requests that have the same operation name, or something
+ * else.
+ *
+ */
+ class TAO_CSD_TP_Export TP_Cancel_Visitor : public TP_Queue_Visitor
+ {
+ public:
+
+ /// Default Constructor - cancel *all* requests.
+ TP_Cancel_Visitor();
+
+ /// Constructor with provided servant - cancel requests that
+ /// target the supplied servant.
+ TP_Cancel_Visitor(PortableServer::Servant servant);
+
+ /// Virtual Destructor.
+ virtual ~TP_Cancel_Visitor();
+
+ /// Returns true to continue visitation. Returns false to stop
+ /// visitation. Sets the remove_flag to true if the request should
+ /// be removed from the queue as a result of the visit. Leaves the
+ /// remove_flag alone otherwise.
+ virtual bool visit_request(TP_Request* request, bool& remove_flag);
+
+ private:
+
+ /// Left as nil if we are to cancel all requests, or set to a specific
+ /// servant if only requests targeting that servant should be cancelled.
+ PortableServer::ServantBase_var servant_;
+ };
+
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/CSD_ThreadPool/CSD_TP_Cancel_Visitor.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_CSD_TP_DISPATCHABLE_VISITOR_H */
diff --git a/TAO/tao/CSD_ThreadPool/CSD_TP_Cancel_Visitor.inl b/TAO/tao/CSD_ThreadPool/CSD_TP_Cancel_Visitor.inl
new file mode 100644
index 00000000000..e1602e2dde3
--- /dev/null
+++ b/TAO/tao/CSD_ThreadPool/CSD_TP_Cancel_Visitor.inl
@@ -0,0 +1,32 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO::CSD::TP_Cancel_Visitor::TP_Cancel_Visitor()
+{
+}
+
+
+ACE_INLINE
+TAO::CSD::TP_Cancel_Visitor::TP_Cancel_Visitor(PortableServer::Servant servant)
+ : servant_(servant)
+{
+ // This try-catch block is not really necessary for current implementation
+ // since the _add_ref does not throw exception, but we have to add it to
+ // satisfy the non-exception builds. If _add_ref really throws an exception
+ // then this constructor needs deal with the exception.
+ ACE_TRY_NEW_ENV
+ {
+ this->servant_->_add_ref (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHALL
+ {
+ }
+ ACE_ENDTRY;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/CSD_ThreadPool/CSD_TP_Collocated_Asynch_Request.cpp b/TAO/tao/CSD_ThreadPool/CSD_TP_Collocated_Asynch_Request.cpp
new file mode 100644
index 00000000000..0e4c596f682
--- /dev/null
+++ b/TAO/tao/CSD_ThreadPool/CSD_TP_Collocated_Asynch_Request.cpp
@@ -0,0 +1,60 @@
+// $Id$
+
+#include "tao/CSD_ThreadPool/CSD_TP_Collocated_Asynch_Request.h"
+
+ACE_RCSID (CSD_ThreadPool,
+ TP_Collocated_Asynch_Request,
+ "$Id$")
+
+#if !defined (__ACE_INLINE__)
+# include "tao/CSD_ThreadPool/CSD_TP_Collocated_Asynch_Request.inl"
+#endif /* ! __ACE_INLINE__ */
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO::CSD::TP_Collocated_Asynch_Request::~TP_Collocated_Asynch_Request()
+{
+}
+
+
+void
+TAO::CSD::TP_Collocated_Asynch_Request::prepare_for_queue_i()
+{
+ this->do_clone();
+}
+
+
+void
+TAO::CSD::TP_Collocated_Asynch_Request::dispatch_i()
+{
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ this->do_dispatch(ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ // Eat these. We probably should log these, but since we have already
+ // unblocked the requesting thread there is no point in saving it or
+ // doing anything with it.
+ }
+#if defined (TAO_HAS_EXCEPTIONS)
+ ACE_CATCHALL
+ {
+ // Eat these. We probably should log these, but since we have already
+ // unblocked the requesting thread there is no point in saving it or
+ // doing anything with it.
+ }
+#endif
+ ACE_ENDTRY;
+}
+
+void
+TAO::CSD::TP_Collocated_Asynch_Request::cancel_i()
+{
+ this->do_cancel();
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/CSD_ThreadPool/CSD_TP_Collocated_Asynch_Request.h b/TAO/tao/CSD_ThreadPool/CSD_TP_Collocated_Asynch_Request.h
new file mode 100644
index 00000000000..6cfa149f73a
--- /dev/null
+++ b/TAO/tao/CSD_ThreadPool/CSD_TP_Collocated_Asynch_Request.h
@@ -0,0 +1,90 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file CSD_TP_Collocated_Asynch_Request.h
+ *
+ * $Id$
+ *
+ * @author Tim Bradley <bradley_t@ociweb.com>
+ */
+//=============================================================================
+
+#ifndef TAO_CSD_TP_COLLOCATED_ASYNCH_REQUEST_H
+#define TAO_CSD_TP_COLLOCATED_ASYNCH_REQUEST_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/CSD_ThreadPool/CSD_TP_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/CSD_ThreadPool/CSD_TP_Corba_Request.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace CSD
+ {
+
+ class TP_Collocated_Asynch_Request;
+ typedef TAO_Intrusive_Ref_Count_Handle<TP_Collocated_Asynch_Request>
+ TP_Collocated_Asynch_Request_Handle;
+
+ /**
+ * @class TP_Collocated_Asynch_Request
+ *
+ * @brief Represents a "queue-able", collocated, asynchronous,
+ * CORBA request.
+ *
+ * This kind request is one-way collocated request with the default
+ * SYNC_SCOPE policy (SYNC_WITH_TRANSPORT) applied. It is cloned
+ * before enqueuing and the "enqueuing" thread never blocks.
+ */
+ class TAO_CSD_TP_Export TP_Collocated_Asynch_Request
+ : public TP_Corba_Request
+ {
+ public:
+
+ /// Constructor.
+ TP_Collocated_Asynch_Request
+ (TAO_ServerRequest& server_request,
+ const PortableServer::ObjectId& object_id,
+ PortableServer::POA_ptr poa,
+ const char* operation,
+ PortableServer::Servant servant,
+ TP_Servant_State* servant_state);
+
+ /// Virtual Destructor.
+ virtual ~TP_Collocated_Asynch_Request();
+
+
+ protected:
+
+ /// Prepare this TP_Collocated_Asynch_Request object to be placed
+ /// into the request queue. This will cause the underlying
+ /// TAO_ServerRequest object to be cloned.
+ virtual void prepare_for_queue_i();
+
+ /// Dispatch the request to the servant.
+ virtual void dispatch_i();
+
+ /// Cancel the request.
+ virtual void cancel_i();
+ };
+
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/CSD_ThreadPool/CSD_TP_Collocated_Asynch_Request.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_CSD_TP_COLLOCATED_ASYNCH_REQUEST_H */
diff --git a/TAO/tao/CSD_ThreadPool/CSD_TP_Collocated_Asynch_Request.inl b/TAO/tao/CSD_ThreadPool/CSD_TP_Collocated_Asynch_Request.inl
new file mode 100644
index 00000000000..d44f0bc56dd
--- /dev/null
+++ b/TAO/tao/CSD_ThreadPool/CSD_TP_Collocated_Asynch_Request.inl
@@ -0,0 +1,24 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO::CSD::TP_Collocated_Asynch_Request::TP_Collocated_Asynch_Request
+ (TAO_ServerRequest& server_request,
+ const PortableServer::ObjectId& object_id,
+ PortableServer::POA_ptr poa,
+ const char* operation,
+ PortableServer::Servant servant,
+ TP_Servant_State* servant_state)
+ : TP_Corba_Request(object_id,
+ poa,
+ operation,
+ servant,
+ servant_state,
+ server_request)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/CSD_ThreadPool/CSD_TP_Collocated_Synch_Request.cpp b/TAO/tao/CSD_ThreadPool/CSD_TP_Collocated_Synch_Request.cpp
new file mode 100644
index 00000000000..c7d7d00fcde
--- /dev/null
+++ b/TAO/tao/CSD_ThreadPool/CSD_TP_Collocated_Synch_Request.cpp
@@ -0,0 +1,56 @@
+// $Id$
+
+#include "tao/CSD_ThreadPool/CSD_TP_Collocated_Synch_Request.h"
+
+ACE_RCSID (CSD_ThreadPool,
+ TP_Collocated_Synch_Request,
+ "$Id$")
+
+#include "tao/ORB_Core.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/CSD_ThreadPool/CSD_TP_Collocated_Synch_Request.inl"
+#endif /* ! __ACE_INLINE__ */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO::CSD::TP_Collocated_Synch_Request::~TP_Collocated_Synch_Request()
+{
+}
+
+
+void
+TAO::CSD::TP_Collocated_Synch_Request::dispatch_i()
+{
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ this->do_dispatch(ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ // We need to save off a copy of the exception.
+ this->exception_ = ACE_ANY_EXCEPTION._tao_duplicate();
+ }
+#if defined (TAO_HAS_EXCEPTIONS)
+ ACE_CATCHALL
+ {
+ ACE_NEW (this->exception_ ,
+ CORBA::UNKNOWN (CORBA::SystemException::_tao_minor_code
+ (TAO_UNHANDLED_SERVER_CXX_EXCEPTION, 0),
+ CORBA::COMPLETED_MAYBE));
+ }
+#endif
+ ACE_ENDTRY;
+
+ this->synch_helper_.dispatched();
+}
+
+void
+TAO::CSD::TP_Collocated_Synch_Request::cancel_i()
+{
+ this->synch_helper_.cancelled();
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/CSD_ThreadPool/CSD_TP_Collocated_Synch_Request.h b/TAO/tao/CSD_ThreadPool/CSD_TP_Collocated_Synch_Request.h
new file mode 100644
index 00000000000..cad5fa52bd5
--- /dev/null
+++ b/TAO/tao/CSD_ThreadPool/CSD_TP_Collocated_Synch_Request.h
@@ -0,0 +1,109 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file CSD_TP_Collocated_Synch_Request.h
+ *
+ * $Id$
+ *
+ * @author Tim Bradley <bradley_t@ociweb.com>
+ */
+//=============================================================================
+
+#ifndef TAO_CSD_TP_COLLOCATED_SYNCH_REQUEST_H
+#define TAO_CSD_TP_COLLOCATED_SYNCH_REQUEST_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/CSD_ThreadPool/CSD_TP_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/CSD_ThreadPool/CSD_TP_Corba_Request.h"
+#include "tao/CSD_ThreadPool/CSD_TP_Synch_Helper.h"
+#include "tao/Exception.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace CSD
+ {
+
+ class TP_Collocated_Synch_Request;
+ typedef TAO_Intrusive_Ref_Count_Handle<TP_Collocated_Synch_Request>
+ TP_Collocated_Synch_Request_Handle;
+
+ /**
+ * @class TP_Collocated_Synch_Request
+ *
+ * @brief Represents a "queue-able", synchronous, collocated,
+ * CORBA request.
+ *
+ * This kind request is the two-way or oneway(with SYNC_WITH_TARGET
+ * policy applied) collocated request. It is NOT cloned before
+ * enqueuing and the "enqueuing" thread will block until the request
+ * is dispatched/handled or cancelled.
+ */
+ class TAO_CSD_TP_Export TP_Collocated_Synch_Request
+ : public TP_Corba_Request
+ {
+ public:
+
+ /// Constructor.
+ TP_Collocated_Synch_Request
+ (TAO_ServerRequest& server_request,
+ const PortableServer::ObjectId& object_id,
+ PortableServer::POA_ptr poa,
+ const char* operation,
+ PortableServer::Servant servant,
+ TP_Servant_State* servant_state);
+
+ /// Virtual Destructor.
+ virtual ~TP_Collocated_Synch_Request();
+
+ /// Wait until the request has been dispatched (and completed), or
+ /// until it has been cancelled.
+ /// Returns true if the request has been dispatched, and returns
+ /// false if the request has been cancelled.
+ bool wait(ACE_ENV_SINGLE_ARG_DECL);
+
+
+ protected:
+
+ /// Note that we do not override our base class implementation of
+ /// prepare_for_queue_i() (which does nothing), because we don't
+ /// need to clone the Server Request object.
+
+ /// Dispatch the request to the servant.
+ virtual void dispatch_i();
+
+ /// Cancel the request.
+ virtual void cancel_i();
+
+
+ private:
+
+ /// Helper used to block and unblock the thread that invokes our
+ /// wait() method.
+ TP_Synch_Helper synch_helper_;
+
+ /// Set to NULL initially, and will only be set thereafter if an
+ /// exception is raised from the dispatch() call on the server_request_.
+ CORBA::Exception* exception_;
+ };
+
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/CSD_ThreadPool/CSD_TP_Collocated_Synch_Request.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_CSD_TP_COLLOCATED_SYNCH_REQUEST_H */
diff --git a/TAO/tao/CSD_ThreadPool/CSD_TP_Collocated_Synch_Request.inl b/TAO/tao/CSD_ThreadPool/CSD_TP_Collocated_Synch_Request.inl
new file mode 100644
index 00000000000..c92dfe4719f
--- /dev/null
+++ b/TAO/tao/CSD_ThreadPool/CSD_TP_Collocated_Synch_Request.inl
@@ -0,0 +1,59 @@
+// -*- C++ -*-
+//
+// $Id$
+
+#include "ace/Auto_Ptr.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO::CSD::TP_Collocated_Synch_Request::TP_Collocated_Synch_Request
+ (TAO_ServerRequest& server_request,
+ const PortableServer::ObjectId& object_id,
+ PortableServer::POA_ptr poa,
+ const char* operation,
+ PortableServer::Servant servant,
+ TP_Servant_State* servant_state)
+ : TP_Corba_Request(object_id,
+ poa,
+ operation,
+ servant,
+ servant_state,
+ server_request),
+ exception_(0)
+{
+}
+
+
+ACE_INLINE
+bool
+TAO::CSD::TP_Collocated_Synch_Request::wait(ACE_ENV_SINGLE_ARG_DECL)
+{
+ bool dispatched = this->synch_helper_.wait_while_pending();
+
+ if (dispatched)
+ {
+ // Check to see if the dispatching caused an exception to be raised.
+ if (this->exception_ != 0)
+ {
+ // An exception was raised during the actual dispatching to
+ // the servant. We need to raise the exception to our caller,
+ // which is the thread that made the collocated request in the
+ // first place.
+ CORBA::Exception* ex = this->exception_;
+ this->exception_ = 0;
+
+#if defined (TAO_HAS_EXCEPTIONS)
+ ACE_Auto_Basic_Ptr<CORBA::Exception> ex_holder(ex);
+ ex->_raise ();
+#else
+ ACE_TRY_ENV.exception (ex);
+#endif /* ACE_HAS_EXCEPTIONS */
+ }
+ }
+
+ return dispatched;
+
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/CSD_ThreadPool/CSD_TP_Collocated_Synch_With_Server_Request.cpp b/TAO/tao/CSD_ThreadPool/CSD_TP_Collocated_Synch_With_Server_Request.cpp
new file mode 100644
index 00000000000..70f43c863c7
--- /dev/null
+++ b/TAO/tao/CSD_ThreadPool/CSD_TP_Collocated_Synch_With_Server_Request.cpp
@@ -0,0 +1,72 @@
+// $Id$
+
+#include "tao/CSD_ThreadPool/CSD_TP_Collocated_Synch_With_Server_Request.h"
+
+ACE_RCSID (CSD_ThreadPool,
+ TP_Collocated_Synch_With_Server_Request,
+ "$Id$")
+
+#include "tao/Exception.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/CSD_ThreadPool/CSD_TP_Collocated_Synch_With_Server_Request.inl"
+#endif /* ! __ACE_INLINE__ */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO::CSD::TP_Collocated_Synch_With_Server_Request::~TP_Collocated_Synch_With_Server_Request()
+{
+}
+
+
+void
+TAO::CSD::TP_Collocated_Synch_With_Server_Request::prepare_for_queue_i()
+{
+ // NOTE: We *NEED* clone the TAO_ServerRequest for a collocated,
+ // one-way SYNC_WITH_SERVER request. This is because the
+ // calling thread is signalled just *before* the request is
+ // dispatched. It's (very) possible that the calling thread
+ // will destroy the underlying TAO_ServerRequest object while
+ // the request is dispatching to servant. This is why we make
+ // a clone - so that we have our own copy that won't be destroyed
+ // while we are using it.
+ this->do_clone();
+}
+
+
+void
+TAO::CSD::TP_Collocated_Synch_With_Server_Request::dispatch_i()
+{
+ // This is done *before* we do_dispatch().
+ this->synch_helper_.dispatched();
+
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ this->do_dispatch(ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ // Eat these. We probably should log these, but since we have already
+ // unblocked the requesting thread there is no point in saving it or
+ // doing anything with it.
+ }
+#if defined (TAO_HAS_EXCEPTIONS)
+ ACE_CATCHALL
+ {
+ // Eat these. We probably should log these, but since we have already
+ // unblocked the requesting thread there is no point in saving it or
+ // doing anything with it.
+ }
+#endif
+ ACE_ENDTRY;
+}
+
+void
+TAO::CSD::TP_Collocated_Synch_With_Server_Request::cancel_i()
+{
+ this->synch_helper_.cancelled();
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/CSD_ThreadPool/CSD_TP_Collocated_Synch_With_Server_Request.h b/TAO/tao/CSD_ThreadPool/CSD_TP_Collocated_Synch_With_Server_Request.h
new file mode 100644
index 00000000000..0b54d87ed06
--- /dev/null
+++ b/TAO/tao/CSD_ThreadPool/CSD_TP_Collocated_Synch_With_Server_Request.h
@@ -0,0 +1,110 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file CSD_TP_Collocated_Synch_With_Server_Request.h
+ *
+ * $Id$
+ *
+ * @author Tim Bradley <bradley_t@ociweb.com>
+ */
+//=============================================================================
+
+#ifndef TAO_CSD_TP_COLLOCATED_SYNCH_WITH_SERVER_REQUEST_H
+#define TAO_CSD_TP_COLLOCATED_SYNCH_WITH_SERVER_REQUEST_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/CSD_ThreadPool/CSD_TP_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/CSD_ThreadPool/CSD_TP_Corba_Request.h"
+#include "tao/CSD_ThreadPool/CSD_TP_Synch_Helper.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace CSD
+ {
+
+ class TP_Collocated_Synch_With_Server_Request;
+ typedef TAO_Intrusive_Ref_Count_Handle
+ <TP_Collocated_Synch_With_Server_Request>
+ TP_Collocated_Synch_With_Server_Request_Handle;
+
+ /**
+ * @class TP_Collocated_Synch_With_Server_Request
+ *
+ * @brief Represents a "queue-able", one-way, collocated, CORBA
+ * request with a "Synch Scope" policy of SYNC_WITH_SERVER.
+ *
+ * This kind of request is one-way request with the SYNC_WITH_SERVER
+ * policy applied. It is cloned before enqueuing and the "enqueuing"
+ * thread will block until it is signalled by the TP_Task thread that
+ * will happen just before the request is dispatched or the request
+ * is cancelled.
+ */
+ class TAO_CSD_TP_Export TP_Collocated_Synch_With_Server_Request
+ : public TP_Corba_Request
+ {
+ public:
+
+ /// Constructor.
+ TP_Collocated_Synch_With_Server_Request
+ (TAO_ServerRequest& server_request,
+ const PortableServer::ObjectId& object_id,
+ PortableServer::POA_ptr poa,
+ const char* operation,
+ PortableServer::Servant servant,
+ TP_Servant_State* servant_state);
+
+ /// Virtual Destructor.
+ virtual ~TP_Collocated_Synch_With_Server_Request();
+
+ /// Wait until the request has been dispatched (but not completed), or
+ /// until it has been cancelled. Note that this will wait until just
+ /// *before* the request is dispatched by a worker thread. This is
+ /// different than the TP_Collocated_Synch_Request which waits until
+ /// just *after* the request is dispatched by a worker thread.
+ /// Returns true if the request has been dispatched, and returns
+ /// false if the request has been cancelled.
+ bool wait(ACE_ENV_SINGLE_ARG_DECL);
+
+
+ protected:
+
+ /// Prepare this TP_Collocated_Synch_With_Server_Request object to be
+ /// placed into the request queue. This will cause the underlying
+ /// TAO_ServerRequest object to be cloned.
+ virtual void prepare_for_queue_i();
+
+ /// Dispatch the request to the servant.
+ virtual void dispatch_i();
+
+ /// Cancel the request.
+ virtual void cancel_i();
+
+
+ private:
+
+ /// Helper used to block and unblock the thread that invokes our
+ /// wait() method.
+ TP_Synch_Helper synch_helper_;
+ };
+
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/CSD_ThreadPool/CSD_TP_Collocated_Synch_With_Server_Request.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_CSD_TP_COLLOCATED_SYNCH_WITH_SERVER_REQUEST_H */
diff --git a/TAO/tao/CSD_ThreadPool/CSD_TP_Collocated_Synch_With_Server_Request.inl b/TAO/tao/CSD_ThreadPool/CSD_TP_Collocated_Synch_With_Server_Request.inl
new file mode 100644
index 00000000000..1ff0407d6fd
--- /dev/null
+++ b/TAO/tao/CSD_ThreadPool/CSD_TP_Collocated_Synch_With_Server_Request.inl
@@ -0,0 +1,32 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO::CSD::TP_Collocated_Synch_With_Server_Request::TP_Collocated_Synch_With_Server_Request
+ (TAO_ServerRequest& server_request,
+ const PortableServer::ObjectId& object_id,
+ PortableServer::POA_ptr poa,
+ const char* operation,
+ PortableServer::Servant servant,
+ TP_Servant_State* servant_state)
+ : TP_Corba_Request(object_id,
+ poa,
+ operation,
+ servant,
+ servant_state,
+ server_request)
+{
+}
+
+
+ACE_INLINE
+bool
+TAO::CSD::TP_Collocated_Synch_With_Server_Request::wait(ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+{
+ return this->synch_helper_.wait_while_pending();
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/CSD_ThreadPool/CSD_TP_Corba_Request.cpp b/TAO/tao/CSD_ThreadPool/CSD_TP_Corba_Request.cpp
new file mode 100644
index 00000000000..ff2aa4709c9
--- /dev/null
+++ b/TAO/tao/CSD_ThreadPool/CSD_TP_Corba_Request.cpp
@@ -0,0 +1,19 @@
+// $Id$
+
+#include "tao/CSD_ThreadPool/CSD_TP_Corba_Request.h"
+
+ACE_RCSID (CSD_ThreadPool,
+ TP_Corba_Request,
+ "$Id$")
+
+#if !defined (__ACE_INLINE__)
+# include "tao/CSD_ThreadPool/CSD_TP_Corba_Request.inl"
+#endif /* ! __ACE_INLINE__ */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO::CSD::TP_Corba_Request::~TP_Corba_Request()
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/CSD_ThreadPool/CSD_TP_Corba_Request.h b/TAO/tao/CSD_ThreadPool/CSD_TP_Corba_Request.h
new file mode 100644
index 00000000000..2e0a6c7996f
--- /dev/null
+++ b/TAO/tao/CSD_ThreadPool/CSD_TP_Corba_Request.h
@@ -0,0 +1,103 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file CSD_TP_Corba_Request.h
+ *
+ * $Id$
+ *
+ * @author Tim Bradley <bradley_t@ociweb.com>
+ */
+//=============================================================================
+
+#ifndef TAO_CSD_TP_CORBA_REQUEST_H
+#define TAO_CSD_TP_CORBA_REQUEST_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/CSD_ThreadPool/CSD_TP_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/CSD_ThreadPool/CSD_TP_Request.h"
+#include "tao/CSD_Framework/CSD_FW_Server_Request_Wrapper.h"
+#include "tao/PortableServer/PortableServer.h"
+#include "tao/PortableServer/Servant_Base.h"
+#include "ace/SString.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace CSD
+ {
+
+ class TP_Corba_Request;
+ typedef TAO_Intrusive_Ref_Count_Handle<TP_Corba_Request>
+ TP_Corba_Request_Handle;
+
+ /**
+ * @class TP_Corba_Request
+ *
+ * @brief Base class for "queue-able" CORBA requests.
+ *
+ * TBD - Add description
+ *
+ */
+ class TAO_CSD_TP_Export TP_Corba_Request : public TP_Request
+ {
+ public:
+
+ /// Virtual Destructor.
+ virtual ~TP_Corba_Request();
+
+
+ protected:
+
+ /// Constructor.
+ TP_Corba_Request(const PortableServer::ObjectId& object_id,
+ PortableServer::POA_ptr poa,
+ const char* operation,
+ PortableServer::Servant servant,
+ TP_Servant_State* servant_state,
+ TAO_ServerRequest& server_request);
+
+ /// Delegate to the FW_Server_Request_Wrapper clone() method.
+ void do_clone();
+
+ /// Delegate to the FW_Server_Request_Wrapper dispatch() method.
+ void do_dispatch(ACE_ENV_SINGLE_ARG_DECL);
+
+ /// Delegate to the FW_Server_Request_Wrapper cancel() method.
+ void do_cancel();
+
+
+ private:
+
+ /// The ObjectId for the target servant.
+ PortableServer::ObjectId object_id_;
+
+ /// The POA.
+ PortableServer::POA_var poa_;
+
+ /// The name of the IDL operation.
+ ACE_CString operation_;
+
+ /// The TAO_ServerRequest object wrapper.
+ FW_Server_Request_Wrapper server_request_;
+ };
+
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/CSD_ThreadPool/CSD_TP_Corba_Request.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_CSD_TP_CORBA_REQUEST_H */
diff --git a/TAO/tao/CSD_ThreadPool/CSD_TP_Corba_Request.inl b/TAO/tao/CSD_ThreadPool/CSD_TP_Corba_Request.inl
new file mode 100644
index 00000000000..18d273c34a5
--- /dev/null
+++ b/TAO/tao/CSD_ThreadPool/CSD_TP_Corba_Request.inl
@@ -0,0 +1,45 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO::CSD::TP_Corba_Request::TP_Corba_Request
+ (const PortableServer::ObjectId& object_id,
+ PortableServer::POA_ptr poa,
+ const char* operation,
+ PortableServer::Servant servant,
+ TP_Servant_State* servant_state,
+ TAO_ServerRequest& server_request)
+ : TP_Request(servant,servant_state),
+ object_id_(object_id),
+ operation_(operation),
+ server_request_(server_request)
+{
+ this->poa_ = PortableServer::POA::_duplicate(poa);
+}
+
+ACE_INLINE
+void
+TAO::CSD::TP_Corba_Request::do_clone()
+{
+ this->server_request_.clone();
+}
+
+ACE_INLINE
+void
+TAO::CSD::TP_Corba_Request::do_dispatch(ACE_ENV_SINGLE_ARG_DECL)
+{
+ this->server_request_.dispatch(this->servant() ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+ACE_INLINE
+void
+TAO::CSD::TP_Corba_Request::do_cancel()
+{
+ this->server_request_.cancel();
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/CSD_ThreadPool/CSD_TP_Custom_Asynch_Request.cpp b/TAO/tao/CSD_ThreadPool/CSD_TP_Custom_Asynch_Request.cpp
new file mode 100644
index 00000000000..6765f02eff6
--- /dev/null
+++ b/TAO/tao/CSD_ThreadPool/CSD_TP_Custom_Asynch_Request.cpp
@@ -0,0 +1,52 @@
+// $Id$
+
+#include "tao/CSD_ThreadPool/CSD_TP_Custom_Asynch_Request.h"
+
+ACE_RCSID (CSD_ThreadPool,
+ TP_Custom_Asynch_Request,
+ "$Id$")
+
+#if !defined (__ACE_INLINE__)
+# include "tao/CSD_ThreadPool/CSD_TP_Custom_Asynch_Request.inl"
+#endif /* ! __ACE_INLINE__ */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO::CSD::TP_Custom_Asynch_Request::~TP_Custom_Asynch_Request()
+{
+}
+
+
+void
+TAO::CSD::TP_Custom_Asynch_Request::dispatch_i()
+{
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ this->execute_op();
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ // Eat these. We probably should log these, but since we have already
+ // unblocked the requesting thread there is no point in saving it or
+ // doing anything with it.
+ }
+#if defined (TAO_HAS_EXCEPTIONS)
+ ACE_CATCHALL
+ {
+ // Eat these. We probably should log these, but since we have already
+ // unblocked the requesting thread there is no point in saving it or
+ // doing anything with it.
+ }
+#endif
+ ACE_ENDTRY;
+}
+
+void
+TAO::CSD::TP_Custom_Asynch_Request::cancel_i()
+{
+ this->cancel_op();
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/CSD_ThreadPool/CSD_TP_Custom_Asynch_Request.h b/TAO/tao/CSD_ThreadPool/CSD_TP_Custom_Asynch_Request.h
new file mode 100644
index 00000000000..aed6d8f88f5
--- /dev/null
+++ b/TAO/tao/CSD_ThreadPool/CSD_TP_Custom_Asynch_Request.h
@@ -0,0 +1,79 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file CSD_TP_Custom_Asynch_Request.h
+ *
+ * $Id$
+ *
+ * @author Tim Bradley <bradley_t@ociweb.com>
+ */
+//=============================================================================
+
+#ifndef TAO_CSD_TP_CUSTOM_ASYNCH_REQUEST_H
+#define TAO_CSD_TP_CUSTOM_ASYNCH_REQUEST_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/CSD_ThreadPool/CSD_TP_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/CSD_ThreadPool/CSD_TP_Custom_Request.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace CSD
+ {
+
+ class TP_Custom_Asynch_Request;
+ typedef TAO_Intrusive_Ref_Count_Handle<TP_Custom_Asynch_Request>
+ TP_Custom_Asynch_Request_Handle;
+
+ /**
+ * @class TP_Custom_Asynch_Request
+ *
+ * @brief Base class for "queue-able", Custom (non-CORBA),
+ * Synchronous requests.
+ *
+ * TBD - Add description
+ *
+ */
+ class TAO_CSD_TP_Export TP_Custom_Asynch_Request
+ : public TP_Custom_Request
+ {
+ public:
+
+ /// Constructor.
+ TP_Custom_Asynch_Request(TP_Custom_Request_Operation* op,
+ TP_Servant_State* servant_state);
+
+ /// Virtual Destructor.
+ virtual ~TP_Custom_Asynch_Request();
+
+
+ protected:
+
+ /// Dispatch the request to the servant.
+ virtual void dispatch_i();
+
+ /// Cancel the request.
+ virtual void cancel_i();
+ };
+
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/CSD_ThreadPool/CSD_TP_Custom_Asynch_Request.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_CSD_TP_CUSTOM_ASYNCH_REQUEST_H */
diff --git a/TAO/tao/CSD_ThreadPool/CSD_TP_Custom_Asynch_Request.inl b/TAO/tao/CSD_ThreadPool/CSD_TP_Custom_Asynch_Request.inl
new file mode 100644
index 00000000000..4242ce41e5d
--- /dev/null
+++ b/TAO/tao/CSD_ThreadPool/CSD_TP_Custom_Asynch_Request.inl
@@ -0,0 +1,15 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO::CSD::TP_Custom_Asynch_Request::TP_Custom_Asynch_Request
+ (TP_Custom_Request_Operation* op,
+ TP_Servant_State* servant_state)
+ : TP_Custom_Request(op,servant_state)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/CSD_ThreadPool/CSD_TP_Custom_Request.cpp b/TAO/tao/CSD_ThreadPool/CSD_TP_Custom_Request.cpp
new file mode 100644
index 00000000000..fbe24fc0c53
--- /dev/null
+++ b/TAO/tao/CSD_ThreadPool/CSD_TP_Custom_Request.cpp
@@ -0,0 +1,19 @@
+// $Id$
+
+#include "tao/CSD_ThreadPool/CSD_TP_Custom_Request.h"
+
+ACE_RCSID (CSD_ThreadPool,
+ TP_Custom_Request,
+ "$Id$")
+
+#if !defined (__ACE_INLINE__)
+# include "tao/CSD_ThreadPool/CSD_TP_Custom_Request.inl"
+#endif /* ! __ACE_INLINE__ */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO::CSD::TP_Custom_Request::~TP_Custom_Request()
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/CSD_ThreadPool/CSD_TP_Custom_Request.h b/TAO/tao/CSD_ThreadPool/CSD_TP_Custom_Request.h
new file mode 100644
index 00000000000..c4c5bcbb0b4
--- /dev/null
+++ b/TAO/tao/CSD_ThreadPool/CSD_TP_Custom_Request.h
@@ -0,0 +1,81 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file CSD_TP_Custom_Request.h
+ *
+ * $Id$
+ *
+ * @author Tim Bradley <bradley_t@ociweb.com>
+ */
+//=============================================================================
+
+#ifndef TAO_CSD_TP_CUSTOM_REQUEST_H
+#define TAO_CSD_TP_CUSTOM_REQUEST_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/CSD_ThreadPool/CSD_TP_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/CSD_ThreadPool/CSD_TP_Request.h"
+#include "tao/CSD_ThreadPool/CSD_TP_Custom_Request_Operation.h"
+#include "tao/PortableServer/Servant_Base.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace CSD
+ {
+
+ class TP_Custom_Request;
+ typedef TAO_Intrusive_Ref_Count_Handle<TP_Custom_Request>
+ TP_Custom_Request_Handle;
+
+ /**
+ * @class TP_Custom_Request
+ *
+ * @brief Base class for "queue-able" Custom (non-CORBA) requests.
+ *
+ * TBD - Add description
+ *
+ */
+ class TAO_CSD_TP_Export TP_Custom_Request : public TP_Request
+ {
+ public:
+
+ /// Virtual Destructor.
+ virtual ~TP_Custom_Request();
+
+
+ protected:
+
+ /// Constructor.
+ TP_Custom_Request(TP_Custom_Request_Operation* op,
+ TP_Servant_State* servant_state);
+
+ void execute_op();
+ void cancel_op();
+
+
+ private:
+
+ TP_Custom_Request_Operation_Handle op_;
+ };
+
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/CSD_ThreadPool/CSD_TP_Custom_Request.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_CSD_TP_CUSTOM_REQUEST_H */
diff --git a/TAO/tao/CSD_ThreadPool/CSD_TP_Custom_Request.inl b/TAO/tao/CSD_ThreadPool/CSD_TP_Custom_Request.inl
new file mode 100644
index 00000000000..c63696ab628
--- /dev/null
+++ b/TAO/tao/CSD_ThreadPool/CSD_TP_Custom_Request.inl
@@ -0,0 +1,48 @@
+// -*- C++ -
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO::CSD::TP_Custom_Request::TP_Custom_Request
+ (TP_Custom_Request_Operation* op,
+ TP_Servant_State* servant_state)
+ : TP_Request(op->servant(),servant_state),
+ op_(op, false)
+{
+}
+
+
+ACE_INLINE
+void
+TAO::CSD::TP_Custom_Request::execute_op()
+{
+ this->op_->execute();
+
+ // Now drop the reference to the custom operation object.
+ // This is necessary so that custom operation objects can be created
+ // on the stack for synchronous custom requests. If we do not do this,
+ // then there is a race condition which could result in the stack-created
+ // custom operation object having a reference count of 2 when it falls
+ // out of scope (and destructs). Our op_ data member would be the one
+ // that held the other reference, and when our op_ data member destructs,
+ // it attempts to perform a _remove_ref() on the underlying operation
+ // object - which has already been destructed! Thus, we reset the op_
+ // data member here to the 'nil' state - causing the _remove_ref() to
+ // be performed now.
+ this->op_ = 0;
+}
+
+
+ACE_INLINE
+void
+TAO::CSD::TP_Custom_Request::cancel_op()
+{
+ this->op_->cancel();
+
+ // See comments in the execute_op() method.
+ this->op_ = 0;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/CSD_ThreadPool/CSD_TP_Custom_Request_Operation.cpp b/TAO/tao/CSD_ThreadPool/CSD_TP_Custom_Request_Operation.cpp
new file mode 100644
index 00000000000..e2702b6c5a5
--- /dev/null
+++ b/TAO/tao/CSD_ThreadPool/CSD_TP_Custom_Request_Operation.cpp
@@ -0,0 +1,19 @@
+// $Id$
+
+#include "tao/CSD_ThreadPool/CSD_TP_Custom_Request_Operation.h"
+
+ACE_RCSID (CSD_ThreadPool,
+ TP_Custom_Request_Operation,
+ "$Id$")
+
+#if !defined (__ACE_INLINE__)
+# include "tao/CSD_ThreadPool/CSD_TP_Custom_Request_Operation.inl"
+#endif /* ! __ACE_INLINE__ */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO::CSD::TP_Custom_Request_Operation::~TP_Custom_Request_Operation()
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/CSD_ThreadPool/CSD_TP_Custom_Request_Operation.h b/TAO/tao/CSD_ThreadPool/CSD_TP_Custom_Request_Operation.h
new file mode 100644
index 00000000000..e3b85853f9f
--- /dev/null
+++ b/TAO/tao/CSD_ThreadPool/CSD_TP_Custom_Request_Operation.h
@@ -0,0 +1,99 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file CSD_TP_Custom_Request_Operation.h
+ *
+ * $Id$
+ *
+ * @author Tim Bradley <bradley_t@ociweb.com>
+ */
+//=============================================================================
+
+#ifndef TAO_CSD_TP_CUSTOM_REQUEST_OPERATION_H
+#define TAO_CSD_TP_CUSTOM_REQUEST_OPERATION_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/CSD_ThreadPool/CSD_TP_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Intrusive_Ref_Count_Base_T.h"
+#include "tao/Intrusive_Ref_Count_Handle_T.h"
+#include "tao/PortableServer/Servant_Base.h"
+#include "ace/Synch.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace CSD
+ {
+
+ class TP_Custom_Request_Operation;
+ typedef TAO_Intrusive_Ref_Count_Handle<TP_Custom_Request_Operation>
+ TP_Custom_Request_Operation_Handle;
+
+
+ /**
+ * @class TP_Custom_Request_Operation
+ *
+ * @brief Base class for all custom request operations.
+ *
+ * @note The caller that creates a new TP_Custom_Request_Operation
+ * object needs call _add_ref () on the servant before
+ * constructing it and the TP_Custom_Request_Operation object
+ * is responsible to decrement the reference count.
+ *
+ * TBD - Add description
+ */
+ class TAO_CSD_TP_Export TP_Custom_Request_Operation
+ : public TAO_Intrusive_Ref_Count_Base<ACE_SYNCH_MUTEX>
+ {
+ public:
+
+ /// Virtual Destructor.
+ virtual ~TP_Custom_Request_Operation();
+
+ /// Invoked by a worker thread to perform the operation.
+ void execute();
+
+ /// Invoked when the request has been cancelled.
+ void cancel();
+
+ /// Used by the TP_Strategy to obtain the target servant in order
+ /// to construct the custom request object. Returns the servant as
+ /// an "in" argument (the caller does not get a new 'copy'). This
+ /// is useful for chaining.
+ PortableServer::Servant servant();
+
+
+ protected:
+
+ /// Constructor.
+ TP_Custom_Request_Operation(PortableServer::Servant servant);
+
+ virtual void execute_i() = 0;
+ virtual void cancel_i() = 0;
+
+
+ private:
+
+ PortableServer::ServantBase_var servant_;
+ };
+
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/CSD_ThreadPool/CSD_TP_Custom_Request_Operation.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_CSD_TP_CUSTOM_REQUEST_OPERATION_H */
diff --git a/TAO/tao/CSD_ThreadPool/CSD_TP_Custom_Request_Operation.inl b/TAO/tao/CSD_ThreadPool/CSD_TP_Custom_Request_Operation.inl
new file mode 100644
index 00000000000..6a05c5df7ee
--- /dev/null
+++ b/TAO/tao/CSD_ThreadPool/CSD_TP_Custom_Request_Operation.inl
@@ -0,0 +1,51 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO::CSD::TP_Custom_Request_Operation::TP_Custom_Request_Operation
+ (PortableServer::Servant servant)
+: servant_ (servant)
+{
+ // This try-catch block is not really necessary for current implementation
+ // since the _add_ref does not throw exception, but we have to add it to
+ // satisfy the non-exception builds. If _add_ref really throws an exception
+ // then this constructor needs deal with the exception.
+ ACE_TRY_NEW_ENV
+ {
+ this->servant_->_add_ref (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHALL
+ {
+ }
+ ACE_ENDTRY;
+}
+
+
+ACE_INLINE
+void
+TAO::CSD::TP_Custom_Request_Operation::execute()
+{
+ this->execute_i();
+}
+
+
+ACE_INLINE
+void
+TAO::CSD::TP_Custom_Request_Operation::cancel()
+{
+ this->cancel_i();
+}
+
+
+ACE_INLINE
+PortableServer::Servant
+TAO::CSD::TP_Custom_Request_Operation::servant()
+{
+ return this->servant_.in();
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/CSD_ThreadPool/CSD_TP_Custom_Synch_Request.cpp b/TAO/tao/CSD_ThreadPool/CSD_TP_Custom_Synch_Request.cpp
new file mode 100644
index 00000000000..287e516d7b4
--- /dev/null
+++ b/TAO/tao/CSD_ThreadPool/CSD_TP_Custom_Synch_Request.cpp
@@ -0,0 +1,35 @@
+// $Id$
+
+#include "tao/CSD_ThreadPool/CSD_TP_Custom_Synch_Request.h"
+
+ACE_RCSID (CSD_ThreadPool,
+ TP_Custom_Synch_Request,
+ "$Id$")
+
+#if !defined (__ACE_INLINE__)
+# include "tao/CSD_ThreadPool/CSD_TP_Custom_Synch_Request.inl"
+#endif /* ! __ACE_INLINE__ */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO::CSD::TP_Custom_Synch_Request::~TP_Custom_Synch_Request()
+{
+}
+
+
+void
+TAO::CSD::TP_Custom_Synch_Request::dispatch_i()
+{
+ this->execute_op();
+ this->synch_helper_.dispatched();
+}
+
+
+void
+TAO::CSD::TP_Custom_Synch_Request::cancel_i()
+{
+ this->cancel_op();
+ this->synch_helper_.cancelled();
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/CSD_ThreadPool/CSD_TP_Custom_Synch_Request.h b/TAO/tao/CSD_ThreadPool/CSD_TP_Custom_Synch_Request.h
new file mode 100644
index 00000000000..02d66b20597
--- /dev/null
+++ b/TAO/tao/CSD_ThreadPool/CSD_TP_Custom_Synch_Request.h
@@ -0,0 +1,92 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file CSD_TP_Custom_Synch_Request.h
+ *
+ * $Id$
+ *
+ * @author Tim Bradley <bradley_t@ociweb.com>
+ */
+//=============================================================================
+
+#ifndef TAO_CSD_TP_CUSTOM_SYNCH_REQUEST_H
+#define TAO_CSD_TP_CUSTOM_SYNCH_REQUEST_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/CSD_ThreadPool/CSD_TP_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/CSD_ThreadPool/CSD_TP_Custom_Request.h"
+#include "tao/CSD_ThreadPool/CSD_TP_Synch_Helper.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace CSD
+ {
+
+ class TP_Custom_Synch_Request;
+ typedef TAO_Intrusive_Ref_Count_Handle<TP_Custom_Synch_Request>
+ TP_Custom_Synch_Request_Handle;
+
+ /**
+ * @class TP_Custom_Synch_Request
+ *
+ * @brief Base class for "queue-able", Custom (non-CORBA),
+ * Synchronous requests.
+ *
+ * TBD - Add description
+ *
+ */
+ class TAO_CSD_TP_Export TP_Custom_Synch_Request : public TP_Custom_Request
+ {
+ public:
+
+ /// Constructor.
+ TP_Custom_Synch_Request(TP_Custom_Request_Operation* op,
+ TP_Servant_State* servant_state);
+
+ /// Virtual Destructor.
+ virtual ~TP_Custom_Synch_Request();
+
+ /// Wait until the request has been executed (and completes), or
+ /// until it has been cancelled. Returns true if the request has
+ /// been executed/completed, and returns false if the request has
+ /// been cancelled.
+ bool wait();
+
+
+ protected:
+
+ /// Dispatch the request to the servant.
+ virtual void dispatch_i();
+
+ /// Cancel the request.
+ virtual void cancel_i();
+
+
+ private:
+
+ /// Helper used to block and unblock the thread that invokes our
+ /// wait() method.
+ TP_Synch_Helper synch_helper_;
+ };
+
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/CSD_ThreadPool/CSD_TP_Custom_Synch_Request.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_CSD_TP_CUSTOM_SYNCH_REQUEST_H */
diff --git a/TAO/tao/CSD_ThreadPool/CSD_TP_Custom_Synch_Request.inl b/TAO/tao/CSD_ThreadPool/CSD_TP_Custom_Synch_Request.inl
new file mode 100644
index 00000000000..cec37afcdac
--- /dev/null
+++ b/TAO/tao/CSD_ThreadPool/CSD_TP_Custom_Synch_Request.inl
@@ -0,0 +1,23 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO::CSD::TP_Custom_Synch_Request::TP_Custom_Synch_Request
+ (TP_Custom_Request_Operation* op,
+ TP_Servant_State* servant_state)
+ : TP_Custom_Request(op,servant_state)
+{
+}
+
+
+ACE_INLINE
+bool
+TAO::CSD::TP_Custom_Synch_Request::wait()
+{
+ return this->synch_helper_.wait_while_pending();
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/CSD_ThreadPool/CSD_TP_Dispatchable_Visitor.cpp b/TAO/tao/CSD_ThreadPool/CSD_TP_Dispatchable_Visitor.cpp
new file mode 100644
index 00000000000..aeb5454c252
--- /dev/null
+++ b/TAO/tao/CSD_ThreadPool/CSD_TP_Dispatchable_Visitor.cpp
@@ -0,0 +1,53 @@
+// $Id$
+
+#include "tao/CSD_ThreadPool/CSD_TP_Dispatchable_Visitor.h"
+
+ACE_RCSID (CSD_TP,
+ Dispatchable_Visitor,
+ "$Id$")
+
+#if !defined (__ACE_INLINE__)
+# include "tao/CSD_ThreadPool/CSD_TP_Dispatchable_Visitor.inl"
+#endif /* ! __ACE_INLINE__ */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO::CSD::TP_Dispatchable_Visitor::~TP_Dispatchable_Visitor()
+{
+}
+
+
+bool
+TAO::CSD::TP_Dispatchable_Visitor::visit_request(TP_Request* request,
+ bool& remove_flag)
+{
+ // Ask the request object if the target servant is "ready" to accept
+ // a request being dispatched to it.
+ if (request->is_ready())
+ {
+ // Ok. This request is a "dispatchable" request. It is what we were
+ // hoping to find.
+
+ // Save a copy of the request in our handle data member.
+ request->_add_ref();
+ this->request_ = request;
+
+ // Make sure that the queue will extract the request from the queue
+ // upon our return.
+ remove_flag = true;
+
+ // Mark the target servant as being "busy".
+ request->mark_as_busy();
+
+ // Stop the visitation by returning false.
+ return false;
+ }
+
+ // The target servant object of the request isn't ready, so the request
+ // is not considered to be a "dispatchable" request.
+
+ // Return true to visit the next request in the queue (if there is one).
+ return true;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/CSD_ThreadPool/CSD_TP_Dispatchable_Visitor.h b/TAO/tao/CSD_ThreadPool/CSD_TP_Dispatchable_Visitor.h
new file mode 100644
index 00000000000..01aea59828a
--- /dev/null
+++ b/TAO/tao/CSD_ThreadPool/CSD_TP_Dispatchable_Visitor.h
@@ -0,0 +1,94 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file CSD_TP_Dispatchable_Visitor.h
+ *
+ * $Id$
+ *
+ * @author Tim Bradley <bradley_t@ociweb.com>
+ */
+//=============================================================================
+
+#ifndef TAO_CSD_TP_DISPATCHABLE_VISITOR_H
+#define TAO_CSD_TP_DISPATCHABLE_VISITOR_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/CSD_ThreadPool/CSD_TP_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/CSD_ThreadPool/CSD_TP_Queue_Visitor.h"
+#include "tao/CSD_ThreadPool/CSD_TP_Request.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace CSD
+ {
+
+ /**
+ * @class TP_Dispatchable_Visitor
+ *
+ * @brief Used to extract the first "dispatchable" request from the queue.
+ *
+ * An instance of this visitor class is used by one of the worker
+ * threads to locate the first "dispatchable" request in the queue. If
+ * such a request is visited, then this visitor will save a "copy" of
+ * the request, indicate that the request should be removed from the
+ * queue, and indicate that visitation should stop.
+ *
+ * An method is provided to retrieve a "copy" of the "dispatchable"
+ * request that was saved off during visitation. A nil reference
+ * (ie, a NULL pointer) will be returned if no dispatchable request
+ * was found.
+ *
+ */
+ class TAO_CSD_TP_Export TP_Dispatchable_Visitor : public TP_Queue_Visitor
+ {
+ public:
+
+ /// Default Constructor.
+ TP_Dispatchable_Visitor();
+
+ /// Virtual Destructor.
+ virtual ~TP_Dispatchable_Visitor();
+
+ /// Reset this visitor object in order to re-use it for another
+ /// visitation of the request queue. This sets the vistor's "result"
+ /// (the TP_Request* data member) to its default value (a nil handle).
+ void reset();
+
+ /// Returns true to continue visitation. Returns false to stop
+ /// visitation. Sets the remove_flag to true if the request should
+ /// be removed from the queue as a result of the visit. Leaves the
+ /// remove_flag alone otherwise.
+ virtual bool visit_request(TP_Request* request, bool& remove_flag);
+
+ /// This returns a "copy" of the located request, or 0 if no request
+ /// was located.
+ TP_Request* request();
+
+
+ private:
+
+ /// A handle to the located request.
+ TP_Request_Handle request_;
+ };
+
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/CSD_ThreadPool/CSD_TP_Dispatchable_Visitor.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_CSD_TP_DISPATCHABLE_VISITOR_H */
diff --git a/TAO/tao/CSD_ThreadPool/CSD_TP_Dispatchable_Visitor.inl b/TAO/tao/CSD_ThreadPool/CSD_TP_Dispatchable_Visitor.inl
new file mode 100644
index 00000000000..c2c16d34e26
--- /dev/null
+++ b/TAO/tao/CSD_ThreadPool/CSD_TP_Dispatchable_Visitor.inl
@@ -0,0 +1,31 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO::CSD::TP_Dispatchable_Visitor::TP_Dispatchable_Visitor()
+{
+}
+
+
+ACE_INLINE
+void
+TAO::CSD::TP_Dispatchable_Visitor::reset()
+{
+ // Set the handle to 0 to have it release any request it may currently
+ // be referencing.
+ this->request_ = 0;
+}
+
+
+ACE_INLINE
+TAO::CSD::TP_Request*
+TAO::CSD::TP_Dispatchable_Visitor::request()
+{
+ TP_Request_Handle handle(this->request_.in(), false);
+ return handle._retn();
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/CSD_ThreadPool/CSD_TP_Export.h b/TAO/tao/CSD_ThreadPool/CSD_TP_Export.h
new file mode 100644
index 00000000000..1eeb556e4f8
--- /dev/null
+++ b/TAO/tao/CSD_ThreadPool/CSD_TP_Export.h
@@ -0,0 +1,58 @@
+
+// -*- C++ -*-
+// $Id$
+// Definition for Win32 Export directives.
+// This file is generated automatically by generate_export_file.pl -s TAO_CSD_TP
+// ------------------------------
+#ifndef TAO_CSD_TP_EXPORT_H
+#define TAO_CSD_TP_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if defined (ACE_AS_STATIC_LIBS) && !defined (TAO_CSD_TP_HAS_DLL)
+# define TAO_CSD_TP_HAS_DLL 0
+#endif /* ACE_AS_STATIC_LIBS && TAO_CSD_TP_HAS_DLL */
+
+#if !defined (TAO_CSD_TP_HAS_DLL)
+# define TAO_CSD_TP_HAS_DLL 1
+#endif /* ! TAO_CSD_TP_HAS_DLL */
+
+#if defined (TAO_CSD_TP_HAS_DLL) && (TAO_CSD_TP_HAS_DLL == 1)
+# if defined (TAO_CSD_TP_BUILD_DLL)
+# define TAO_CSD_TP_Export ACE_Proper_Export_Flag
+# define TAO_CSD_TP_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# define TAO_CSD_TP_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# else /* TAO_CSD_TP_BUILD_DLL */
+# define TAO_CSD_TP_Export ACE_Proper_Import_Flag
+# define TAO_CSD_TP_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# define TAO_CSD_TP_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# endif /* TAO_CSD_TP_BUILD_DLL */
+#else /* TAO_CSD_TP_HAS_DLL == 1 */
+# define TAO_CSD_TP_Export
+# define TAO_CSD_TP_SINGLETON_DECLARATION(T)
+# define TAO_CSD_TP_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+#endif /* TAO_CSD_TP_HAS_DLL == 1 */
+
+// Set TAO_CSD_TP_NTRACE = 0 to turn on library specific tracing even if
+// tracing is turned off for ACE.
+#if !defined (TAO_CSD_TP_NTRACE)
+# if (ACE_NTRACE == 1)
+# define TAO_CSD_TP_NTRACE 1
+# else /* (ACE_NTRACE == 1) */
+# define TAO_CSD_TP_NTRACE 0
+# endif /* (ACE_NTRACE == 1) */
+#endif /* !TAO_CSD_TP_NTRACE */
+
+#if (TAO_CSD_TP_NTRACE == 1)
+# define TAO_CSD_TP_TRACE(X)
+#else /* (TAO_CSD_TP_NTRACE == 1) */
+# if !defined (ACE_HAS_TRACE)
+# define ACE_HAS_TRACE
+# endif /* ACE_HAS_TRACE */
+# define TAO_CSD_TP_TRACE(X) ACE_TRACE_IMPL(X)
+# include "ace/Trace.h"
+#endif /* (TAO_CSD_TP_NTRACE == 1) */
+
+#endif /* TAO_CSD_TP_EXPORT_H */
+
+// End of auto generated file.
diff --git a/TAO/tao/CSD_ThreadPool/CSD_TP_Queue.cpp b/TAO/tao/CSD_ThreadPool/CSD_TP_Queue.cpp
new file mode 100644
index 00000000000..cb7b0ecf8e1
--- /dev/null
+++ b/TAO/tao/CSD_ThreadPool/CSD_TP_Queue.cpp
@@ -0,0 +1,127 @@
+// $Id$
+
+#include "tao/CSD_ThreadPool/CSD_TP_Queue.h"
+#include "tao/CSD_ThreadPool/CSD_TP_Request.h"
+#include "tao/CSD_ThreadPool/CSD_TP_Queue_Visitor.h"
+
+ACE_RCSID (CSD_ThreadPool,
+ TP_Queue,
+ "$Id$")
+
+#if !defined (__ACE_INLINE__)
+# include "tao/CSD_ThreadPool/CSD_TP_Queue.inl"
+#endif /* ! __ACE_INLINE__ */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+void
+TAO::CSD::TP_Queue::put(TP_Request* request)
+{
+ // The request is passed in as an "in" argument, and we would like to
+ // hold on to a "copy" within the queue (the linked list). We will
+ // perform an _add_ref() on the request now to make the queue's "copy".
+ request->_add_ref();
+
+ if (this->tail_ == 0)
+ {
+ // The tail_ is a NULL pointer only when the queue is empty.
+ // Make the request be the only element in the queue.
+ this->head_ = this->tail_ = request;
+
+ // Make sure the request's prev_ and next_ pointers are set to NULL.
+ request->prev_ = request->next_ = 0;
+ }
+ else
+ {
+ // There is at least one request already in the queue. "Append" the
+ // supplied request object to the end of the queue.
+ request->prev_ = this->tail_;
+ request->next_ = 0;
+ this->tail_->next_ = request;
+ this->tail_ = request;
+ }
+}
+
+
+void
+TAO::CSD::TP_Queue::accept_visitor(TP_Queue_Visitor& visitor)
+{
+ TP_Request* cur = this->head_;
+
+ while (cur != 0)
+ {
+ TP_Request* prev = cur->prev_;
+ TP_Request* next = cur->next_;
+
+ // Pass the current request to the visitor. Also pass-in a reference
+ // to the remove_from_queue flag. The visitor may decide that it
+ // wants to keep the current request for itself, and desires that the
+ // request be (surgically) removed from the queue. The visitor also
+ // gets to decide, via its return value, whether or not visitation
+ // should continue (or cease to continue).
+ bool remove_from_queue = false;
+
+ bool continue_visitation = visitor.visit_request(cur,remove_from_queue);
+
+ if (remove_from_queue)
+ {
+ // Create a local handle to release the current request once
+ // the handle falls out of scope. We need to do this because the
+ // queue "owns" a "copy" of each request in the queue.
+ TP_Request_Handle handle = cur;
+
+ if (this->head_ == cur)
+ {
+ // The current request is at the front (the head_) of the queue.
+
+ // Move the head_ to the next request in the queue.
+ this->head_ = next;
+
+ if (this->head_ == 0)
+ {
+ // Not only was the current request at the front of the
+ // queue - it was the *only* request in the queue.
+ // Update the tail_ pointer now that the queue is empty.
+ this->tail_ = 0;
+ }
+ else
+ {
+ // Set the (new) head_ request's prev_ pointer to be NULL.
+ this->head_->prev_ = 0;
+ }
+ }
+ else if (this->tail_ == cur)
+ {
+ // The current request is not at the front of the queue,
+ // but it is at the back of the queue. This implies that
+ // the queue currently contains at least two requests -
+ // the current request (cur), and the previous request (prev).
+ // The point is that we can now assume that the 'prev' pointer
+ // is never NULL in this case.
+ this->tail_ = prev;
+ this->tail_->next_ = 0;
+ }
+ else
+ {
+ // The current request is not at the front or at the back.
+ // This implies that there are at least three requests in
+ // the queue. We can assume that the 'next' and 'prev'
+ // pointers are never NULL in this case.
+ prev->next_ = next;
+ next->prev_ = prev;
+ }
+ }
+
+ if (!continue_visitation)
+ {
+ // The visitor doesn't want to procede with any further visitation.
+ // Break out of the visitation loop now.
+ break;
+ }
+
+ // Move on to the next request in the queue.
+ cur = next;
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/CSD_ThreadPool/CSD_TP_Queue.h b/TAO/tao/CSD_ThreadPool/CSD_TP_Queue.h
new file mode 100644
index 00000000000..9912c0e613a
--- /dev/null
+++ b/TAO/tao/CSD_ThreadPool/CSD_TP_Queue.h
@@ -0,0 +1,101 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file CSD_TP_Queue.h
+ *
+ * $Id$
+ *
+ * @author Tim Bradley <bradley_t@ociweb.com>
+ */
+//=============================================================================
+
+#ifndef TAO_CSD_TP_QUEUE_H
+#define TAO_CSD_TP_QUEUE_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/CSD_ThreadPool/CSD_TP_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Versioned_Namespace.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace CSD
+ {
+
+ class TP_Request;
+ class TP_Queue_Visitor;
+
+ /**
+ * @class TP_Queue
+ *
+ * @brief Queue of servant requests that need to be dispatched.
+ *
+ * This is the queue of pending servant requests that is "owned"
+ * by a TP_Strategy object. When an ORB thread dispatches
+ * a servant request to the strategy object, it will create the
+ * appropriate (subclass of) TP_Request object to "wrap"
+ * the servant request in a "queue-friendly" wrapper. The ORB thread
+ * will then place the TP_Request object on to the queue. Note that
+ * this scenario pertains to what are being called "remote requests".
+ * There are other scenarios in which other types of requests can
+ * get added to this queue.
+ *
+ * The strategy object will employ a set of worker threads that are
+ * responsible for "servicing" the servant requests in the queue.
+ *
+ * Note: In the future, support will be added to allow the client
+ * application inject "custom" TP_Request objects into
+ * a TP_Strategy object, causing them to be placed in
+ * the queue.
+ */
+ class TAO_CSD_TP_Export TP_Queue
+ {
+ public:
+
+ /// Default Constructor.
+ TP_Queue();
+
+ /// Destructor.
+ ~TP_Queue();
+
+ /// Place a request at the end of the queue.
+ void put(TP_Request* request);
+
+ /// Returns true if the queue is empty. Returns false otherwise.
+ bool is_empty() const;
+
+ /// Visitors will visit each request in the queue, from front to back,
+ /// and have the ability to stop visiting at any time (ie, before
+ /// visiting every request).
+ void accept_visitor(TP_Queue_Visitor& visitor);
+
+
+ private:
+
+ /// The request at the front of the queue.
+ TP_Request* head_;
+
+ /// The request at the end of the queue.
+ TP_Request* tail_;
+ };
+
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/CSD_ThreadPool/CSD_TP_Queue.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_CSD_TP_QUEUE_H */
diff --git a/TAO/tao/CSD_ThreadPool/CSD_TP_Queue.inl b/TAO/tao/CSD_ThreadPool/CSD_TP_Queue.inl
new file mode 100644
index 00000000000..9e26d265f10
--- /dev/null
+++ b/TAO/tao/CSD_ThreadPool/CSD_TP_Queue.inl
@@ -0,0 +1,29 @@
+// -*- C++ -*-
+//
+// $Id$
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO::CSD::TP_Queue::TP_Queue()
+ : head_(0),
+ tail_(0)
+{
+}
+
+
+ACE_INLINE
+TAO::CSD::TP_Queue::~TP_Queue()
+{
+}
+
+
+ACE_INLINE
+bool
+TAO::CSD::TP_Queue::is_empty() const
+{
+ return (this->head_ == 0);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/CSD_ThreadPool/CSD_TP_Queue_Visitor.cpp b/TAO/tao/CSD_ThreadPool/CSD_TP_Queue_Visitor.cpp
new file mode 100644
index 00000000000..3ede8818521
--- /dev/null
+++ b/TAO/tao/CSD_ThreadPool/CSD_TP_Queue_Visitor.cpp
@@ -0,0 +1,19 @@
+// $Id$
+
+#include "tao/CSD_ThreadPool/CSD_TP_Queue_Visitor.h"
+
+ACE_RCSID (CSD_ThreadPool,
+ TP_Queue_Visitor,
+ "$Id$")
+
+#if !defined (__ACE_INLINE__)
+# include "tao/CSD_ThreadPool/CSD_TP_Queue_Visitor.inl"
+#endif /* ! __ACE_INLINE__ */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO::CSD::TP_Queue_Visitor::~TP_Queue_Visitor()
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/CSD_ThreadPool/CSD_TP_Queue_Visitor.h b/TAO/tao/CSD_ThreadPool/CSD_TP_Queue_Visitor.h
new file mode 100644
index 00000000000..f86467ae64d
--- /dev/null
+++ b/TAO/tao/CSD_ThreadPool/CSD_TP_Queue_Visitor.h
@@ -0,0 +1,79 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file CSD_TP_Queue_Visitor.h
+ *
+ * $Id$
+ *
+ * @author Tim Bradley <bradley_t@ociweb.com>
+ */
+//=============================================================================
+
+#ifndef TAO_CSD_TP_QUEUE_VISITOR_H
+#define TAO_CSD_TP_QUEUE_VISITOR_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/CSD_ThreadPool/CSD_TP_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Versioned_Namespace.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace CSD
+ {
+
+ class TP_Request;
+
+
+ /**
+ * @class TP_Queue_Visitor
+ *
+ * @brief Base class for vistors of the elements in the TP_Queue.
+ *
+ * Provides a way to perform thread-safe iteration over the
+ * TP_Request objects contained within a TP_Queue object.
+ *
+ * This also provides a means to encapsulate each distinct algorithm
+ * within a distinct subclass of TP_Queue_Visitor.
+ *
+ */
+ class TAO_CSD_TP_Export TP_Queue_Visitor
+ {
+ public:
+
+ /// Virtual Destructor.
+ virtual ~TP_Queue_Visitor();
+
+ /// Returns true to continue visitation. Return false to stop
+ /// visitation. Sets the remove_flag to true if the request should
+ /// be removed from the queue as a result of the visit. Leaves the
+ /// remove_flag alone otherwise.
+ virtual bool visit_request(TP_Request* request, bool& remove_flag) = 0;
+
+
+ protected:
+
+ /// Default Constructor.
+ TP_Queue_Visitor();
+ };
+
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/CSD_ThreadPool/CSD_TP_Queue_Visitor.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_CSD_TP_QUEUE_VISITOR_H */
diff --git a/TAO/tao/CSD_ThreadPool/CSD_TP_Queue_Visitor.inl b/TAO/tao/CSD_ThreadPool/CSD_TP_Queue_Visitor.inl
new file mode 100644
index 00000000000..36bd9fc5608
--- /dev/null
+++ b/TAO/tao/CSD_ThreadPool/CSD_TP_Queue_Visitor.inl
@@ -0,0 +1,12 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO::CSD::TP_Queue_Visitor::TP_Queue_Visitor()
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/CSD_ThreadPool/CSD_TP_Remote_Request.cpp b/TAO/tao/CSD_ThreadPool/CSD_TP_Remote_Request.cpp
new file mode 100644
index 00000000000..45529af5802
--- /dev/null
+++ b/TAO/tao/CSD_ThreadPool/CSD_TP_Remote_Request.cpp
@@ -0,0 +1,60 @@
+// $Id$
+
+#include "tao/CSD_ThreadPool/CSD_TP_Remote_Request.h"
+
+ACE_RCSID (CSD_ThreadPool,
+ TP_Remote_Request,
+ "$Id$")
+
+#if !defined (__ACE_INLINE__)
+# include "tao/CSD_ThreadPool/CSD_TP_Remote_Request.inl"
+#endif /* ! __ACE_INLINE__ */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO::CSD::TP_Remote_Request::~TP_Remote_Request()
+{
+}
+
+
+void
+TAO::CSD::TP_Remote_Request::prepare_for_queue_i()
+{
+ this->do_clone();
+}
+
+
+void
+TAO::CSD::TP_Remote_Request::dispatch_i()
+{
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ this->do_dispatch(ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ // Eat these. We probably should log these, but since we have already
+ // unblocked the requesting thread there is no point in saving it or
+ // doing anything with it.
+ }
+#if defined (TAO_HAS_EXCEPTIONS)
+ ACE_CATCHALL
+ {
+ // Eat these. We probably should log these, but since we have already
+ // unblocked the requesting thread there is no point in saving it or
+ // doing anything with it.
+ }
+#endif
+ ACE_ENDTRY;
+}
+
+
+void
+TAO::CSD::TP_Remote_Request::cancel_i()
+{
+ this->do_cancel();
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/CSD_ThreadPool/CSD_TP_Remote_Request.h b/TAO/tao/CSD_ThreadPool/CSD_TP_Remote_Request.h
new file mode 100644
index 00000000000..57303e81e91
--- /dev/null
+++ b/TAO/tao/CSD_ThreadPool/CSD_TP_Remote_Request.h
@@ -0,0 +1,102 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file CSD_TP_Remote_Request.h
+ *
+ * $Id$
+ *
+ * @author Tim Bradley <bradley_t@ociweb.com>
+ */
+//=============================================================================
+
+#ifndef TAO_CSD_TP_REMOTE_REQUEST_H
+#define TAO_CSD_TP_REMOTE_REQUEST_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/CSD_ThreadPool/CSD_TP_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/CSD_ThreadPool/CSD_TP_Corba_Request.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace CSD
+ {
+
+ class TP_Remote_Request;
+ typedef TAO_Intrusive_Ref_Count_Handle<TP_Remote_Request>
+ TP_Remote_Request_Handle;
+
+ /**
+ * @class TP_Remote_Request
+ *
+ * @brief Represents a "queue-able", remote, CORBA request.
+ * Both syncronous and asynchronous remote CORBA requests
+ * are represented by the class.
+ *
+ * TBD - Go over the following comments and clean up.
+ *
+ * Since this class derives from the TP_Request class, it can be
+ * added to a TP_Queue (ie, it is a "queueable" request). It
+ * represents a servant request that has been made by a remote
+ * CORBA client (as opposed to a collocated CORBA client). The
+ * term "CORBA client" is being used here to distinguish CORBA
+ * servant requests (those made thru a CORBA object reference), and
+ * "Custom" servant requests that can be "dispatched" to the strategy
+ * directly by the client application code (ie, not thru a CORBA
+ * object reference). Thus, there are "CORBA clients" and
+ * "Direct clients".
+ *
+ * In summary, this class represents a servant request made when a
+ * remote client invokes a method on a CORBA object reference.
+ *
+ */
+ class TAO_CSD_TP_Export TP_Remote_Request : public TP_Corba_Request
+ {
+ public:
+
+ /// Constructor.
+ TP_Remote_Request(TAO_ServerRequest& server_request,
+ const PortableServer::ObjectId& object_id,
+ PortableServer::POA_ptr poa,
+ const char* operation,
+ PortableServer::Servant servant,
+ TP_Servant_State* servant_state);
+
+ /// Virtual Destructor.
+ virtual ~TP_Remote_Request();
+
+
+ protected:
+
+ /// Prepare this TP_Remote_Request object to be placed into the
+ /// request queue. This will cause the underlying TAO_ServerRequest
+ /// object to be cloned.
+ virtual void prepare_for_queue_i();
+
+ /// Dispatch the request to the servant.
+ virtual void dispatch_i();
+
+ /// Cancel the request.
+ virtual void cancel_i();
+ };
+
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/CSD_ThreadPool/CSD_TP_Remote_Request.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_CSD_TP_REMOTE_REQUEST_H */
diff --git a/TAO/tao/CSD_ThreadPool/CSD_TP_Remote_Request.inl b/TAO/tao/CSD_ThreadPool/CSD_TP_Remote_Request.inl
new file mode 100644
index 00000000000..14a37aa44a9
--- /dev/null
+++ b/TAO/tao/CSD_ThreadPool/CSD_TP_Remote_Request.inl
@@ -0,0 +1,24 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO::CSD::TP_Remote_Request::TP_Remote_Request
+ (TAO_ServerRequest& server_request,
+ const PortableServer::ObjectId& object_id,
+ PortableServer::POA_ptr poa,
+ const char* operation,
+ PortableServer::Servant servant,
+ TP_Servant_State* servant_state)
+ : TP_Corba_Request(object_id,
+ poa,
+ operation,
+ servant,
+ servant_state,
+ server_request)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/CSD_ThreadPool/CSD_TP_Request.cpp b/TAO/tao/CSD_ThreadPool/CSD_TP_Request.cpp
new file mode 100644
index 00000000000..e1926f93e8b
--- /dev/null
+++ b/TAO/tao/CSD_ThreadPool/CSD_TP_Request.cpp
@@ -0,0 +1,27 @@
+// $Id$
+
+#include "tao/CSD_ThreadPool/CSD_TP_Request.h"
+
+ACE_RCSID (CSD_ThreadPool,
+ TP_Request,
+ "$Id$")
+
+#if !defined (__ACE_INLINE__)
+# include "tao/CSD_ThreadPool/CSD_TP_Request.inl"
+#endif /* ! __ACE_INLINE__ */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO::CSD::TP_Request::~TP_Request()
+{
+}
+
+
+void
+TAO::CSD::TP_Request::prepare_for_queue_i()
+{
+ // Default implementation is to do nothing. Subclasses can provide
+ // their own implementation if needed.
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/CSD_ThreadPool/CSD_TP_Request.h b/TAO/tao/CSD_ThreadPool/CSD_TP_Request.h
new file mode 100644
index 00000000000..104d741d3b9
--- /dev/null
+++ b/TAO/tao/CSD_ThreadPool/CSD_TP_Request.h
@@ -0,0 +1,136 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file CSD_TP_Request.h
+ *
+ * $Id$
+ *
+ * @author Tim Bradley <bradley_t@ociweb.com>
+ */
+//=============================================================================
+
+#ifndef TAO_CSD_TP_REQUEST_H
+#define TAO_CSD_TP_REQUEST_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/CSD_ThreadPool/CSD_TP_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/CSD_ThreadPool/CSD_TP_Servant_State.h"
+#include "tao/PortableServer/Servant_Base.h"
+#include "tao/Intrusive_Ref_Count_Base_T.h"
+#include "tao/Intrusive_Ref_Count_Handle_T.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace CSD
+ {
+
+ class TP_Request;
+ typedef TAO_Intrusive_Ref_Count_Handle<TP_Request> TP_Request_Handle;
+
+ class TP_Queue;
+
+
+ /**
+ * @class TP_Request
+ *
+ * @brief Base class for "queue-able" requests.
+ *
+ * This class serves as the abstract base class for all types of
+ * "servant requests" that can be inserted into a TP_Queue
+ * object.
+ */
+ class TAO_CSD_TP_Export TP_Request
+ : public TAO_Intrusive_Ref_Count_Base<ACE_SYNCH_MUTEX>
+ {
+ public:
+
+ /// Virtual Destructor.
+ virtual ~TP_Request();
+
+ /// Prepare the request to be placed into the request queue.
+ void prepare_for_queue();
+
+ /// Invoked to dispatch the request to the servant.
+ void dispatch();
+
+ /// Invoked to cancel the request.
+ void cancel();
+
+ /// Is the target servant ready to accept a request?
+ bool is_ready() const;
+
+ /// Mark the target servant as being busy.
+ void mark_as_busy();
+
+ /// Mark the target servant as being ready (ie, not busy).
+ void mark_as_ready();
+
+ /// This method returns true if this request targets the supplied
+ /// servant object.
+ bool is_target(PortableServer::Servant servant);
+
+
+ protected:
+
+ /// Constructor.
+ TP_Request(PortableServer::Servant servant,
+ TP_Servant_State* servant_state);
+
+ /// Accessor for the servant. Does not return a new (ref counted)
+ /// reference! This is used for chaining.
+ PortableServer::Servant servant();
+
+ /// The subclass knows if it needs to do anything in preparation
+ /// of being placed into the request queue. The default implementation
+ /// does nothing, so only subclasses that have something to do
+ /// need to provide their own implementation.
+ virtual void prepare_for_queue_i();
+
+ /// The subclass knows how to carry out its own way of dispatching
+ /// the request to the servant.
+ virtual void dispatch_i() = 0;
+
+ /// Ask the subclass to perform its duties to carry out the cancellation.
+ virtual void cancel_i() = 0;
+
+
+ private:
+
+ /// The TP_Queue class is our friend since it needs access to
+ /// the prev_ and next_ (private) data members.
+ friend class TP_Queue;
+
+ /// The previous TP_Request object (in the queue).
+ TP_Request* prev_;
+
+ /// The next TP_Request object (in the queue).
+ TP_Request* next_;
+
+ /// Reference to the servant object.
+ PortableServer::ServantBase_var servant_;
+
+ /// Reference to the servant "state" object (contains the busy flag).
+ TP_Servant_State::HandleType servant_state_;
+ };
+
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/CSD_ThreadPool/CSD_TP_Request.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_CSD_TP_REQUEST_H */
diff --git a/TAO/tao/CSD_ThreadPool/CSD_TP_Request.inl b/TAO/tao/CSD_ThreadPool/CSD_TP_Request.inl
new file mode 100644
index 00000000000..341a449091e
--- /dev/null
+++ b/TAO/tao/CSD_ThreadPool/CSD_TP_Request.inl
@@ -0,0 +1,111 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO::CSD::TP_Request::TP_Request(PortableServer::Servant servant,
+ TP_Servant_State* servant_state)
+ : prev_(0),
+ next_(0),
+ servant_ (servant),
+ servant_state_(servant_state, false)
+{
+ // This try-catch block is not really necessary for current implementation
+ // since the _add_ref does not throw exception, but we have to add it to
+ // satisfy the non-exception builds. If _add_ref really throws an exception
+ // then this constructor needs deal with the exception.
+ ACE_TRY_NEW_ENV
+ {
+ this->servant_->_add_ref (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHALL
+ {
+ }
+ ACE_ENDTRY;
+}
+
+
+ACE_INLINE
+void
+TAO::CSD::TP_Request::prepare_for_queue()
+{
+ this->prepare_for_queue_i();
+}
+
+
+ACE_INLINE
+PortableServer::Servant
+TAO::CSD::TP_Request::servant()
+{
+ // Used for chaining so we do not return a new "copy".
+ return this->servant_.in();
+}
+
+
+ACE_INLINE
+bool
+TAO::CSD::TP_Request::is_ready() const
+{
+ if (this->servant_state_.is_nil())
+ {
+ // This means that the serialization of servants is off.
+ // We always answer true here to indicate that the servant is
+ // never busy.
+ return true;
+ }
+
+ return !this->servant_state_->busy_flag();
+}
+
+
+ACE_INLINE
+void
+TAO::CSD::TP_Request::mark_as_busy()
+{
+ if (!this->servant_state_.is_nil())
+ {
+ this->servant_state_->busy_flag(true);
+ }
+}
+
+
+ACE_INLINE
+void
+TAO::CSD::TP_Request::mark_as_ready()
+{
+ if (!this->servant_state_.is_nil())
+ {
+ this->servant_state_->busy_flag(false);
+ }
+}
+
+
+ACE_INLINE
+bool
+TAO::CSD::TP_Request::is_target(PortableServer::Servant servant)
+{
+ // Compare pointers. Return true only if these are the exact same object.
+ return (servant == this->servant_.in());
+}
+
+
+ACE_INLINE
+void
+TAO::CSD::TP_Request::dispatch()
+{
+ this->dispatch_i();
+
+}
+
+
+ACE_INLINE
+void
+TAO::CSD::TP_Request::cancel()
+{
+ this->cancel_i();
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/CSD_ThreadPool/CSD_TP_Servant_State.cpp b/TAO/tao/CSD_ThreadPool/CSD_TP_Servant_State.cpp
new file mode 100644
index 00000000000..28fbc8da7ba
--- /dev/null
+++ b/TAO/tao/CSD_ThreadPool/CSD_TP_Servant_State.cpp
@@ -0,0 +1,19 @@
+// $Id$
+
+#include "tao/CSD_ThreadPool/CSD_TP_Servant_State.h"
+
+ACE_RCSID (CSD_TP,
+ Servant_State,
+ "$Id$")
+
+#if !defined (__ACE_INLINE__)
+# include "tao/CSD_ThreadPool/CSD_TP_Servant_State.inl"
+#endif /* ! __ACE_INLINE__ */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO::CSD::TP_Servant_State::~TP_Servant_State()
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/CSD_ThreadPool/CSD_TP_Servant_State.h b/TAO/tao/CSD_ThreadPool/CSD_TP_Servant_State.h
new file mode 100644
index 00000000000..dbfebedb64c
--- /dev/null
+++ b/TAO/tao/CSD_ThreadPool/CSD_TP_Servant_State.h
@@ -0,0 +1,92 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file CSD_TP_Servant_State.h
+ *
+ * $Id$
+ *
+ * @author Tim Bradley <bradley_t@ociweb.com>
+ */
+//=============================================================================
+
+#ifndef TAO_CSD_TP_SERVANT_STATE_H
+#define TAO_CSD_TP_SERVANT_STATE_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/CSD_ThreadPool/CSD_TP_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Intrusive_Ref_Count_Base_T.h"
+#include "tao/Intrusive_Ref_Count_Handle_T.h"
+#include "ace/Synch.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace CSD
+ {
+
+ /**
+ * @class TP_Servant_State
+ *
+ * @brief Maintains state information for a particular servant.
+ *
+ * This TP_Servant_State class is an intrusively reference-counted
+ * class. This allows it to be held in a "smart pointer" (aka, handle)
+ * object that will manage the reference-counting automagically.
+ *
+ * One TP_Servant_State object is created for each servant object for
+ * which a request is to be dispatched. The servant state objects are
+ * held (via smart pointers) in a TP_Servant_State_Map object. In turn,
+ * the TP_Servant_State_Map object is a data member of the TP_Stategy
+ * class. Each request placed on to the request queue will hold a
+ * reference (via a smart pointer) to the servant state object.
+ *
+ * Currently, the only "state" info held in this TP_Servant_State class
+ * is the servant's busy flag.
+ *
+ */
+ class TAO_CSD_TP_Export TP_Servant_State
+ : public TAO_Intrusive_Ref_Count_Base<ACE_SYNCH_MUTEX>
+ {
+ public:
+
+ /// Handle Type (aka, Smart Pointer Type).
+ typedef TAO_Intrusive_Ref_Count_Handle<TP_Servant_State> HandleType;
+
+ /// Default Constructor.
+ TP_Servant_State();
+
+ /// Virtual Destructor.
+ virtual ~TP_Servant_State();
+
+ /// Accessor for the servant busy flag.
+ bool busy_flag() const;
+
+ /// Mutator for the servant busy flag.
+ void busy_flag(bool new_value);
+
+ private:
+
+ /// The servant's current "busy" state (true == busy, false == not busy)
+ bool busy_flag_;
+ };
+
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/CSD_ThreadPool/CSD_TP_Servant_State.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_CSD_TP_SERVANT_STATE_H */
diff --git a/TAO/tao/CSD_ThreadPool/CSD_TP_Servant_State.inl b/TAO/tao/CSD_ThreadPool/CSD_TP_Servant_State.inl
new file mode 100644
index 00000000000..5ef996bcb6e
--- /dev/null
+++ b/TAO/tao/CSD_ThreadPool/CSD_TP_Servant_State.inl
@@ -0,0 +1,29 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO::CSD::TP_Servant_State::TP_Servant_State()
+ : busy_flag_(false)
+{
+}
+
+
+ACE_INLINE
+bool
+TAO::CSD::TP_Servant_State::busy_flag() const
+{
+ return this->busy_flag_;
+}
+
+
+ACE_INLINE
+void
+TAO::CSD::TP_Servant_State::busy_flag(bool new_value)
+{
+ this->busy_flag_ = new_value;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/CSD_ThreadPool/CSD_TP_Servant_State_Map.cpp b/TAO/tao/CSD_ThreadPool/CSD_TP_Servant_State_Map.cpp
new file mode 100644
index 00000000000..846f3a6e723
--- /dev/null
+++ b/TAO/tao/CSD_ThreadPool/CSD_TP_Servant_State_Map.cpp
@@ -0,0 +1,11 @@
+// $Id$
+
+#include "tao/CSD_ThreadPool/CSD_TP_Servant_State_Map.h"
+
+ACE_RCSID (CSD_TP,
+ Servant_State_Map,
+ "$Id$")
+
+#if !defined (__ACE_INLINE__)
+# include "tao/CSD_ThreadPool/CSD_TP_Servant_State_Map.inl"
+#endif /* ! __ACE_INLINE__ */
diff --git a/TAO/tao/CSD_ThreadPool/CSD_TP_Servant_State_Map.h b/TAO/tao/CSD_ThreadPool/CSD_TP_Servant_State_Map.h
new file mode 100644
index 00000000000..e6726098b72
--- /dev/null
+++ b/TAO/tao/CSD_ThreadPool/CSD_TP_Servant_State_Map.h
@@ -0,0 +1,95 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file CSD_TP_Servant_State_Map.h
+ *
+ * $Id$
+ *
+ * @author Tim Bradley <bradley_t@ociweb.com>
+ */
+//=============================================================================
+
+#ifndef TAO_CSD_TP_SERVANT_STATE_MAP_H
+#define TAO_CSD_TP_SERVANT_STATE_MAP_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/CSD_ThreadPool/CSD_TP_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/CSD_ThreadPool/CSD_TP_Servant_State.h"
+#include "tao/PortableServer/PortableServer.h"
+#include "ace/Hash_Map_Manager.h"
+#include "ace/Synch.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace CSD
+ {
+
+ /**
+ * @class TP_Servant_State_Map
+ *
+ * @brief Map of Servant_State objects - one per servant.
+ *
+ * A TP_Stategy object holds an instance of a TP_Servant_State_Map object
+ * as a (held-by-value) data member. The strategy uses this map to
+ * find or create the TP_Servant_State object for a particular servant
+ * object.
+ *
+ */
+ class TAO_CSD_TP_Export TP_Servant_State_Map
+ {
+ public:
+
+ /// Default Constructor.
+ TP_Servant_State_Map();
+
+ /// Destructor.
+ ~TP_Servant_State_Map();
+
+ /// Accessor for the servant busy flag.
+ TP_Servant_State* find(PortableServer::Servant servant
+ ACE_ENV_ARG_DECL);
+
+ /// Insert the servant to map.
+ void insert(PortableServer::Servant servant
+ ACE_ENV_ARG_DECL);
+
+ /// Remove the servant from map.
+ void remove(PortableServer::Servant servant
+ ACE_ENV_ARG_DECL);
+
+
+ private:
+
+ /// Underlying Map Type - Hash-Based -
+ /// Key Type: void*, Value Type: TP_Servant_State::HandleType
+ typedef ACE_Hash_Map_Manager_Ex<void*,
+ TP_Servant_State::HandleType,
+ ACE_Hash<void*>,
+ ACE_Equal_To<void*>,
+ ACE_SYNCH_MUTEX> MapType;
+
+ /// The underlying map of servant state objects.
+ MapType map_;
+ };
+
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/CSD_ThreadPool/CSD_TP_Servant_State_Map.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_CSD_TP_SERVANT_STATE_MAP_H */
diff --git a/TAO/tao/CSD_ThreadPool/CSD_TP_Servant_State_Map.inl b/TAO/tao/CSD_ThreadPool/CSD_TP_Servant_State_Map.inl
new file mode 100644
index 00000000000..1faeb7ad536
--- /dev/null
+++ b/TAO/tao/CSD_ThreadPool/CSD_TP_Servant_State_Map.inl
@@ -0,0 +1,70 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO::CSD::TP_Servant_State_Map::TP_Servant_State_Map()
+{
+}
+
+
+ACE_INLINE
+TAO::CSD::TP_Servant_State_Map::~TP_Servant_State_Map()
+{
+}
+
+
+ACE_INLINE
+TAO::CSD::TP_Servant_State*
+TAO::CSD::TP_Servant_State_Map::find(PortableServer::Servant servant
+ ACE_ENV_ARG_DECL)
+{
+ void* key = servant;
+
+ TP_Servant_State::HandleType value;
+
+ if (this->map_.find(key, value) != 0)
+ {
+ ACE_THROW_RETURN (PortableServer::POA::ServantNotActive (), 0);
+ }
+
+ return value._retn();
+}
+
+
+ACE_INLINE
+void
+TAO::CSD::TP_Servant_State_Map::insert(PortableServer::Servant servant
+ ACE_ENV_ARG_DECL)
+{
+ void* key = servant;
+
+ TP_Servant_State::HandleType value = new TP_Servant_State ();
+
+ int result = this->map_.bind(key, value);
+
+ if (result == 1)
+ {
+ ACE_THROW (PortableServer::POA::ServantAlreadyActive ());
+ }
+
+ ACE_ASSERT (result == 0);
+}
+
+
+ACE_INLINE
+void
+TAO::CSD::TP_Servant_State_Map::remove(PortableServer::Servant servant
+ ACE_ENV_ARG_DECL)
+{
+ void* key = servant;
+
+ if (this->map_.unbind(key) == -1)
+ {
+ ACE_THROW (PortableServer::POA::ServantNotActive ());
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/CSD_ThreadPool/CSD_TP_Strategy.cpp b/TAO/tao/CSD_ThreadPool/CSD_TP_Strategy.cpp
new file mode 100644
index 00000000000..1a9c86ec8da
--- /dev/null
+++ b/TAO/tao/CSD_ThreadPool/CSD_TP_Strategy.cpp
@@ -0,0 +1,289 @@
+// $Id$
+
+#include "tao/CSD_ThreadPool/CSD_TP_Strategy.h"
+#include "tao/CSD_ThreadPool/CSD_TP_Remote_Request.h"
+#include "tao/CSD_ThreadPool/CSD_TP_Collocated_Synch_Request.h"
+#include "tao/CSD_ThreadPool/CSD_TP_Collocated_Asynch_Request.h"
+#include "tao/CSD_ThreadPool/CSD_TP_Custom_Synch_Request.h"
+#include "tao/CSD_ThreadPool/CSD_TP_Custom_Asynch_Request.h"
+#include "tao/CSD_ThreadPool/CSD_TP_Collocated_Synch_With_Server_Request.h"
+#include "ace/Trace.h"
+
+ACE_RCSID (CSD_ThreadPool,
+ TP_Strategy,
+ "$Id$")
+
+#if !defined (__ACE_INLINE__)
+# include "tao/CSD_ThreadPool/CSD_TP_Strategy.inl"
+#endif /* ! __ACE_INLINE__ */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO::CSD::TP_Strategy::~TP_Strategy()
+{
+}
+
+
+
+TAO::CSD::TP_Strategy::CustomRequestOutcome
+TAO::CSD::TP_Strategy::custom_synch_request(TP_Custom_Request_Operation* op
+ ACE_ENV_ARG_DECL)
+{
+ TP_Servant_State::HandleType servant_state =
+ this->get_servant_state(op->servant()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (REQUEST_REJECTED);
+
+ TP_Custom_Synch_Request_Handle request = new
+ TP_Custom_Synch_Request(op, servant_state.in());
+
+ if (!this->task_.add_request(request.in()))
+ {
+ // The request was rejected by the task.
+ return REQUEST_REJECTED;
+ }
+
+ // Now we wait until the request is handled (executed or cancelled).
+ return (request->wait()) ? REQUEST_EXECUTED : REQUEST_CANCELLED;
+}
+
+
+TAO::CSD::TP_Strategy::CustomRequestOutcome
+TAO::CSD::TP_Strategy::custom_asynch_request(TP_Custom_Request_Operation* op
+ ACE_ENV_ARG_DECL)
+{
+ TP_Servant_State::HandleType servant_state =
+ this->get_servant_state(op->servant()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (REQUEST_REJECTED);
+
+ TP_Custom_Asynch_Request_Handle request = new
+ TP_Custom_Asynch_Request(op, servant_state.in());
+
+ return (this->task_.add_request(request.in()))
+ ? REQUEST_DISPATCHED : REQUEST_REJECTED;
+}
+
+
+bool
+TAO::CSD::TP_Strategy::poa_activated_event_i()
+{
+ // Activates the worker threads, and waits until all have been started.
+ return (this->task_.open(&(this->num_threads_)) == 0);
+}
+
+
+void
+TAO::CSD::TP_Strategy::poa_deactivated_event_i()
+{
+ // Passing in a value of 1 means that we want to shutdown the task, which
+ // equates to causing all worker threads to shutdown. The worker threads
+ // themselves will also invoke the close() method, but the passed-in value
+ // will be 0. So, a 1 means "shutdown", and a 0 means "a single worker
+ // thread is going away".
+ this->task_.close(1);
+}
+
+
+TAO::CSD::Strategy_Base::DispatchResult
+TAO::CSD::TP_Strategy::dispatch_remote_request_i
+ (TAO_ServerRequest& server_request,
+ const PortableServer::ObjectId& object_id,
+ PortableServer::POA_ptr poa,
+ const char* operation,
+ PortableServer::Servant servant
+ ACE_ENV_ARG_DECL)
+{
+ TP_Servant_State::HandleType servant_state =
+ this->get_servant_state(servant
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (DISPATCH_REJECTED);
+
+ // Now we can create the TP_Remote_Request object, and then add it to our
+ // task_'s "request queue".
+ //
+ // TBD-CSD: Need to use a Cached Allocator to "create" the
+ // TP_Remote_Request objects. For now, use the heap.
+ TP_Remote_Request_Handle request =
+ new TP_Remote_Request(server_request,
+ object_id,
+ poa,
+ operation,
+ servant,
+ servant_state.in());
+
+ // Hand the request object to our task so that it can add the request
+ // to its "request queue".
+ if (!this->task_.add_request(request.in()))
+ {
+ // Return the DISPATCH_REJECTED return code so that the caller (our
+ // base class' dispatch_request() method) knows that we did
+ // not handle the request, and that it should be rejected.
+ return TAO::CSD::Strategy_Base::DISPATCH_REJECTED;
+ }
+
+ return TAO::CSD::Strategy_Base::DISPATCH_HANDLED;
+}
+
+
+TAO::CSD::Strategy_Base::DispatchResult
+TAO::CSD::TP_Strategy::dispatch_collocated_request_i
+ (TAO_ServerRequest& server_request,
+ const PortableServer::ObjectId& object_id,
+ PortableServer::POA_ptr poa,
+ const char* operation,
+ PortableServer::Servant servant
+ ACE_ENV_ARG_DECL)
+{
+ TP_Servant_State::HandleType servant_state =
+ this->get_servant_state(servant
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (DISPATCH_REJECTED);
+
+ bool is_sync_with_server = server_request.sync_with_server();
+ bool is_synchronous = server_request.response_expected();
+
+ TP_Collocated_Synch_Request_Handle synch_request;
+ TP_Collocated_Synch_With_Server_Request_Handle synch_with_server_request;
+ TP_Request_Handle request;
+
+ // Create the request object using the appropriate concrete type.
+ if (is_sync_with_server)
+ {
+ synch_with_server_request =
+ new TP_Collocated_Synch_With_Server_Request
+ (server_request,
+ object_id,
+ poa,
+ operation,
+ servant,
+ servant_state.in());
+
+ // Give the request handle its own "copy".
+ synch_with_server_request->_add_ref();
+ request = synch_with_server_request.in();
+ }
+ else if (is_synchronous)
+ {
+ synch_request = new TP_Collocated_Synch_Request(server_request,
+ object_id,
+ poa,
+ operation,
+ servant,
+ servant_state.in());
+
+ // Give the request handle its own "copy".
+ synch_request->_add_ref();
+ request = synch_request.in();
+ }
+ else
+ {
+ // Just use the (base) request handle to hold the request object.
+ request = new TP_Collocated_Asynch_Request(server_request,
+ object_id,
+ poa,
+ operation,
+ servant,
+ servant_state.in());
+ }
+
+ // Hand the request object to our task so that it can add the request
+ // to its "request queue".
+ if (!this->task_.add_request(request.in()))
+ {
+ // Return the DISPATCH_REJECTED return code so that the caller (our
+ // base class' dispatch_request() method) knows that we did
+ // not handle the request, and that it should be rejected.
+ return DISPATCH_REJECTED;
+ }
+
+ // We need to wait on the request object if the request type is a
+ // synchronous request.
+ if (!synch_request.is_nil())
+ {
+ int srw = synch_request->wait(ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (DISPATCH_REJECTED);
+ if (srw == false)
+ {
+ // Raise exception when request was cancelled.
+ ACE_THROW_RETURN(CORBA::NO_IMPLEMENT(), DISPATCH_REJECTED);
+ }
+ }
+ else if (!synch_with_server_request.is_nil())
+ {
+ bool swsr = synch_with_server_request->wait(ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (DISPATCH_REJECTED);
+ if (swsr == false)
+ {
+ // Raise exception when request was cancelled.
+ ACE_THROW_RETURN(CORBA::NO_IMPLEMENT(), DISPATCH_REJECTED);
+ }
+ }
+
+ return DISPATCH_HANDLED;
+}
+
+
+void
+TAO::CSD::TP_Strategy::servant_activated_event_i
+ (PortableServer::Servant servant,
+ const PortableServer::ObjectId& oid
+ ACE_ENV_ARG_DECL)
+{
+ ACE_UNUSED_ARG(oid);
+
+ if (this->serialize_servants_)
+ {
+ // Add the servant to the servant state map.
+ this->servant_state_map_.insert(servant ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+}
+
+
+void
+TAO::CSD::TP_Strategy::servant_deactivated_event_i
+ (PortableServer::Servant servant,
+ const PortableServer::ObjectId& oid
+ ACE_ENV_ARG_DECL)
+{
+ ACE_UNUSED_ARG(oid);
+
+ // Cancel all requests stuck in the queue for the specified servant.
+ this->task_.cancel_servant(servant ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (this->serialize_servants_)
+ {
+ // Remove the servant from the servant state map.
+ this->servant_state_map_.remove(servant ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+}
+
+
+void
+TAO::CSD::TP_Strategy::cancel_requests(PortableServer::Servant servant
+ ACE_ENV_ARG_DECL)
+{
+ // Cancel all requests stuck in the queue for the specified servant.
+ this->task_.cancel_servant(servant ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+
+TAO::CSD::TP_Servant_State::HandleType
+TAO::CSD::TP_Strategy::get_servant_state(PortableServer::Servant servant
+ ACE_ENV_ARG_DECL)
+{
+ TP_Servant_State::HandleType servant_state;
+
+ if (this->serialize_servants_)
+ {
+ servant_state = this->servant_state_map_.find(servant
+ ACE_ENV_ARG_PARAMETER);
+ }
+
+ return servant_state;
+}
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/CSD_ThreadPool/CSD_TP_Strategy.h b/TAO/tao/CSD_ThreadPool/CSD_TP_Strategy.h
new file mode 100644
index 00000000000..2e069caeb6d
--- /dev/null
+++ b/TAO/tao/CSD_ThreadPool/CSD_TP_Strategy.h
@@ -0,0 +1,210 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file CSD_TP_Strategy.h
+ *
+ * $Id$
+ *
+ * @author Tim Bradley <bradley_t@ociweb.com>
+ */
+//=============================================================================
+
+#ifndef TAO_CSD_TP_STRATEGY_H
+#define TAO_CSD_TP_STRATEGY_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/CSD_ThreadPool/CSD_TP_Export.h"
+
+#include "tao/CSD_ThreadPool/CSD_TP_Task.h"
+#include "tao/CSD_ThreadPool/CSD_TP_Servant_State_Map.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/CSD_Framework/CSD_Strategy_Base.h"
+#include "tao/Intrusive_Ref_Count_Handle_T.h"
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace CSD
+ {
+
+ class TP_Strategy;
+ typedef TAO_Intrusive_Ref_Count_Handle<TP_Strategy> TP_Strategy_Handle;
+
+ class TP_Custom_Request_Operation;
+
+ /**
+ * @class TP_Strategy
+ *
+ * @brief A simple custom Thread-Pool servant dispatching strategy class.
+ *
+ * This class represents a concrete implementation of a "Custom
+ * Servant Dispatching Strategy". This implementation is being called
+ * the "Thread Pool Strategy" reference implementation.
+ *
+ * A custom servant dispatching strategy object can be applied to a
+ * POA object in order to carry out the servant dispatching duties
+ * for that POA.
+ *
+ */
+ class TAO_CSD_TP_Export TP_Strategy
+ : public Strategy_Base
+ {
+ public:
+
+ /// Constructor.
+ TP_Strategy(Thread_Counter num_threads = 1,
+ bool serialize_servants = true);
+
+ /// Virtual Destructor.
+ virtual ~TP_Strategy();
+
+ /// Set the number of threads in the pool (must be > 0).
+ void set_num_threads(Thread_Counter num_threads);
+
+ /// Turn on/off serialization of servants.
+ void set_servant_serialization(bool serialize_servants);
+
+ /// Return codes for the custom dispatch_request() methods.
+ enum CustomRequestOutcome
+ {
+ /// The request was successfully put on the request queue.
+ REQUEST_DISPATCHED,
+ /// The request has been executed/completed by a worker thread.
+ REQUEST_EXECUTED,
+ /// The request was removed from the queue and cancelled.
+ REQUEST_CANCELLED,
+ /// The request queue rejected the request
+ REQUEST_REJECTED
+ };
+
+ /// Inject a synchronous, custom request into the request queue.
+ /// This will block the calling thread until the request is handled
+ /// (dispatched or cancelled) or rejected.
+ /// Will return REQUEST_EXECUTED, REQUEST_CANCELLED, or REQUEST_REJECTED.
+ CustomRequestOutcome custom_synch_request
+ (TP_Custom_Request_Operation* op
+ ACE_ENV_ARG_DECL);
+
+ /// Inject an asynchronous, custom request into the request queue.
+ /// This will return control to the calling thread once the request
+ /// has been placed into the queue (or rejected).
+ /// Will return REQUEST_DISPATCHED or REQUEST_REJECTED.
+ CustomRequestOutcome custom_asynch_request
+ (TP_Custom_Request_Operation* op
+ ACE_ENV_ARG_DECL);
+
+ /// Cancel all requests that are targeted for the provided servant.
+ /// This is requested on the user application level.
+ void cancel_requests(PortableServer::Servant servant
+ ACE_ENV_ARG_DECL);
+
+ protected:
+
+ /// Handle the dispatching of a remote request.
+ ///
+ /// This will cause a new "request" object to be created and pushed
+ /// on to a "request queue". The worker threads are responsible for
+ /// servicing the queue, and performing the actual dispatch logic.
+ virtual Strategy_Base::DispatchResult dispatch_remote_request_i
+ (TAO_ServerRequest& server_request,
+ const PortableServer::ObjectId& object_id,
+ PortableServer::POA_ptr poa,
+ const char* operation,
+ PortableServer::Servant servant
+ ACE_ENV_ARG_DECL);
+
+ /// Handle the dispatching of a collocated request.
+ ///
+ /// This will cause a new "request" object to be created and pushed
+ /// on to a "request queue". The worker threads are responsible for
+ /// servicing the queue, and performing the actual dispatch logic.
+ virtual Strategy_Base::DispatchResult dispatch_collocated_request_i
+ (TAO_ServerRequest& server_request,
+ const PortableServer::ObjectId& object_id,
+ PortableServer::POA_ptr poa,
+ const char* operation,
+ PortableServer::Servant servant
+ ACE_ENV_ARG_DECL);
+
+ /// Event - The POA has been activated.
+ /// This will activate the worker thread(s).
+ /// Returns true if the worker threads were activated successfully.
+ /// Otherwise, returns false.
+ virtual bool poa_activated_event_i();
+
+ /// Event - The POA has been deactivated.
+ /// This will shutdown the worker thread(s).
+ virtual void poa_deactivated_event_i();
+
+ /// Event - A servant has been activated
+ virtual void servant_activated_event_i
+ (PortableServer::Servant servant,
+ const PortableServer::ObjectId& oid
+ ACE_ENV_ARG_DECL);
+
+ /// Event - A servant has been deactivated
+ virtual void servant_deactivated_event_i
+ (PortableServer::Servant servant,
+ const PortableServer::ObjectId& oid
+ ACE_ENV_ARG_DECL);
+
+
+ private:
+
+ /**
+ * Helper method that is responsible for looking up the servant
+ * state object in the servant state map *if* the "serialize
+ * servants" flag is set to true. In the case where the
+ * "serialize servants" flag is set to false, then a "nil"
+ * servant state handle object is returned.
+ *
+ * @param servant - input - a pointer to the servant object.
+ *
+ * @returns a handle to a servant state object.
+ *
+ * @throw PortableServer::POA::ServantNotActive if the servant
+ * state cannot be determined.
+ */
+ TP_Servant_State::HandleType get_servant_state
+ (PortableServer::Servant servant
+ ACE_ENV_ARG_DECL);
+
+
+ /// This is the active object used by the worker threads.
+ /// The request queue is owned/managed by the task object.
+ /// The strategy object puts requests into the task's request
+ /// queue, and the worker threads service the queued requests
+ /// by performing the actual servant request dispatching logic.
+ TP_Task task_;
+
+ /// The number of worker threads to use for the task.
+ Thread_Counter num_threads_;
+
+ /// The "serialize servants" flag.
+ bool serialize_servants_;
+
+ /// The map of servant state objects - only used when the
+ /// "serialize servants" flag is set to true.
+ TP_Servant_State_Map servant_state_map_;
+ };
+
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/CSD_ThreadPool/CSD_TP_Strategy.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_CSD_TP_STRATEGY_H */
diff --git a/TAO/tao/CSD_ThreadPool/CSD_TP_Strategy.inl b/TAO/tao/CSD_ThreadPool/CSD_TP_Strategy.inl
new file mode 100644
index 00000000000..312484f5c8c
--- /dev/null
+++ b/TAO/tao/CSD_ThreadPool/CSD_TP_Strategy.inl
@@ -0,0 +1,35 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO::CSD::TP_Strategy::TP_Strategy(Thread_Counter num_threads,
+ bool serialize_servants)
+ : num_threads_(num_threads),
+ serialize_servants_(serialize_servants)
+{
+ // Assumes that num_threads > 0.
+}
+
+
+ACE_INLINE
+void
+TAO::CSD::TP_Strategy::set_num_threads(Thread_Counter num_threads)
+{
+ // Simple Mutator. Assumes that num_threads > 0.
+ this->num_threads_ = num_threads;
+}
+
+
+ACE_INLINE
+void
+TAO::CSD::TP_Strategy::set_servant_serialization(bool serialize_servants)
+{
+ // Simple Mutator.
+ this->serialize_servants_ = serialize_servants;
+}
+
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/CSD_ThreadPool/CSD_TP_Strategy_Factory.cpp b/TAO/tao/CSD_ThreadPool/CSD_TP_Strategy_Factory.cpp
new file mode 100644
index 00000000000..fd03281a261
--- /dev/null
+++ b/TAO/tao/CSD_ThreadPool/CSD_TP_Strategy_Factory.cpp
@@ -0,0 +1,154 @@
+// $Id$
+
+#include "tao/CSD_ThreadPool/CSD_TP_Strategy_Factory.h"
+#include "tao/CSD_ThreadPool/CSD_TP_Strategy.h"
+#include "tao/CSD_ThreadPool/CSD_ThreadPool.h"
+#include "tao/CSD_Framework/CSD_Strategy_Repository.h"
+#include "tao/debug.h"
+#include "ace/Dynamic_Service.h"
+#include "ace/OS_NS_strings.h"
+
+ACE_RCSID (CSD_ThreadPool,
+ TP_Strategy_Factory,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO::CSD::TP_Strategy_Factory::TP_Strategy_Factory()
+{
+}
+
+
+TAO::CSD::TP_Strategy_Factory::~TP_Strategy_Factory()
+{
+}
+
+
+int
+TAO::CSD::TP_Strategy_Factory::init (int argc,
+ ACE_TCHAR* argv[])
+{
+ ACE_TRACE ("TAO::CSD::TP_Strategy_Factory::init");
+
+ static int initialized = 0;
+
+ // Only allow initialization once.
+ if (initialized)
+ return 0;
+
+ initialized = 1;
+ TAO_CSD_Strategy_Repository *repo =
+ ACE_Dynamic_Service<TAO_CSD_Strategy_Repository>::instance ("TAO_CSD_Strategy_Repository");
+
+ if (repo != 0)
+ repo->init(0,0);
+
+ // Parse any service configurator parameters.
+ for (int curarg = 0; curarg < argc; curarg++)
+ if (ACE_OS::strcasecmp (argv[curarg],
+ ACE_TEXT("-CSDtp")) == 0)
+ {
+ ACE_CString poa_name;
+ unsigned long num_threads = 1;
+ bool serialize_servants = true;
+
+ curarg++;
+ if (curarg < argc)
+ {
+ // Parse the parameter
+ ACE_CString arg ((const char *)argv[curarg]);
+ ACE_CString::size_type pos = arg.find (':');
+
+ if (pos == ACE_CString::npos)
+ {
+ poa_name = arg;
+ }
+ else
+ {
+ poa_name = arg.substr (0, pos);
+
+ ACE_CString arg_remainder =
+ arg.substr (pos + 1, arg.length () - pos);
+
+ ACE_CString num_thread_str;
+
+ pos = arg_remainder.find (':');
+
+ if (pos == ACE_CString::npos)
+ {
+ num_thread_str = arg_remainder;
+ }
+ else
+ {
+ num_thread_str = arg_remainder.substr (0, pos);
+
+ ACE_CString off_str =
+ arg_remainder.substr (pos + 1, arg.length () - pos);
+
+ // Case-insensitive string comparison.
+ if (ACE_OS::strcasecmp (ACE_TEXT_CHAR_TO_TCHAR (off_str.c_str()),
+ ACE_TEXT("OFF")) == 0)
+ {
+ serialize_servants = false;
+ }
+ }
+
+ num_threads = ACE_OS::strtoul (num_thread_str.c_str (), 0, 10);
+
+ if (num_threads == 0)
+ {
+ // Minimum of 1 thread required.
+ num_threads = 1;
+ }
+ }
+
+ // Create the ThreadPool strategy for each named poa.
+ TP_Strategy* strategy = 0;
+ ACE_NEW_RETURN (strategy,
+ TP_Strategy (num_threads, serialize_servants),
+ -1);
+ CSD_Framework::Strategy_var objref = strategy;
+
+ TAO_CSD_Strategy_Repository *repo =
+ ACE_Dynamic_Service<TAO_CSD_Strategy_Repository>::instance
+ ("TAO_CSD_Strategy_Repository");
+
+ if (repo == 0)
+ {
+ TAO_CSD_ThreadPool::init ();
+ repo = ACE_Dynamic_Service<TAO_CSD_Strategy_Repository>::instance (
+ "TAO_CSD_Strategy_Repository"
+ );
+ }
+
+
+ repo->add_strategy (poa_name, strategy);
+ }
+ }
+ else
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_ERROR,
+ ACE_TEXT("CSD_ORB_Loader: Unknown option ")
+ ACE_TEXT("<%s>.\n"),
+ argv[curarg]));
+ }
+ }
+
+
+ return 0;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_FACTORY_NAMESPACE_DEFINE(TAO_CSD_TP,
+ TAO_CSD_TP_Strategy_Factory,
+ TAO::CSD::TP_Strategy_Factory)
+
+ACE_STATIC_SVC_DEFINE(TAO_CSD_TP_Strategy_Factory,
+ ACE_TEXT("TAO_CSD_TP_Strategy_Factory"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME(TAO_CSD_TP_Strategy_Factory),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0)
diff --git a/TAO/tao/CSD_ThreadPool/CSD_TP_Strategy_Factory.h b/TAO/tao/CSD_ThreadPool/CSD_TP_Strategy_Factory.h
new file mode 100644
index 00000000000..abc3da5b005
--- /dev/null
+++ b/TAO/tao/CSD_ThreadPool/CSD_TP_Strategy_Factory.h
@@ -0,0 +1,65 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file CSD_TP_Strategy_Factory.h
+ *
+ * $Id$
+ *
+ * @author Tim Bradley <bradley_t@ociweb.com>
+ */
+//=============================================================================
+
+#ifndef TAO_CSD_TP_STRATEGY_FACTORY_H
+#define TAO_CSD_TP_STRATEGY_FACTORY_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/CSD_ThreadPool/CSD_TP_Export.h"
+#include "tao/Versioned_Namespace.h"
+#include "ace/Service_Object.h"
+#include "ace/Service_Config.h"
+
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace CSD
+ {
+
+ /**
+ * @class TP_Strategy_Factory
+ *
+ * @brief An ACE_Service_Object capable of creating TP_Strategy objects.
+ *
+ * TBD - Explain in more detail.
+ *
+ */
+ class TAO_CSD_TP_Export TP_Strategy_Factory : public ACE_Service_Object
+ {
+ public:
+
+ /// Constructor.
+ TP_Strategy_Factory();
+
+ /// Virtual Destructor.
+ virtual ~TP_Strategy_Factory();
+
+ int init (int argc, ACE_TCHAR* argv[]);
+ };
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE_EXPORT(TAO_CSD_TP, TAO_CSD_TP_Strategy_Factory)
+ACE_FACTORY_DECLARE(TAO_CSD_TP, TAO_CSD_TP_Strategy_Factory)
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_CSD_TP_STRATEGY_FACTORY_H */
diff --git a/TAO/tao/CSD_ThreadPool/CSD_TP_Synch_Helper.cpp b/TAO/tao/CSD_ThreadPool/CSD_TP_Synch_Helper.cpp
new file mode 100644
index 00000000000..79a0a195097
--- /dev/null
+++ b/TAO/tao/CSD_ThreadPool/CSD_TP_Synch_Helper.cpp
@@ -0,0 +1,11 @@
+// $Id$
+
+#include "tao/CSD_ThreadPool/CSD_TP_Synch_Helper.h"
+
+ACE_RCSID (CSD_ThreadPool,
+ TP_Synch_Helper,
+ "$Id$")
+
+#if !defined (__ACE_INLINE__)
+# include "tao/CSD_ThreadPool/CSD_TP_Synch_Helper.inl"
+#endif /* ! __ACE_INLINE__ */
diff --git a/TAO/tao/CSD_ThreadPool/CSD_TP_Synch_Helper.h b/TAO/tao/CSD_ThreadPool/CSD_TP_Synch_Helper.h
new file mode 100644
index 00000000000..2056f1ab032
--- /dev/null
+++ b/TAO/tao/CSD_ThreadPool/CSD_TP_Synch_Helper.h
@@ -0,0 +1,110 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file CSD_TP_Synch_Helper.h
+ *
+ * $Id$
+ *
+ * @author Tim Bradley <bradley_t@ociweb.com>
+ */
+//=============================================================================
+
+#ifndef TAO_CSD_TP_SYNCH_HELPER_H
+#define TAO_CSD_TP_SYNCH_HELPER_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/CSD_ThreadPool/CSD_TP_Export.h"
+#include "tao/Condition.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/Synch.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace CSD
+ {
+
+ /**
+ * @class TP_Synch_Helper
+ *
+ * @brief Helper class for synchronous requests to block the requesting
+ * thread until the appropriate time (when it will be un-blocked).
+ *
+ * TBD - Description here
+ *
+ */
+ class TAO_CSD_TP_Export TP_Synch_Helper
+ {
+ public:
+
+ /// Constructor. Sets initial state to PENDING.
+ TP_Synch_Helper();
+
+ /// Destructor.
+ ~TP_Synch_Helper();
+
+ /// Returns true if the helper state is DISPATCHED, and false if
+ /// the helper state is CANCELLED. However, if the helper state
+ /// is PENDING, then this method will block the calling thread
+ /// until the state changes to something other than PENDING
+ /// (ie, DISPATCHED or CANCELLED).
+ bool wait_while_pending();
+
+ /// Change the state of this helper to DISPATCHED, which will cause
+ /// wait_while_pending() to unblock.
+ void dispatched();
+
+ /// Change the state of this helper to CANCELLED, which will cause
+ /// wait_while_pending() to unblock.
+ void cancelled();
+
+
+ private:
+
+ /// Enumeration Type for all possible states of this helper object.
+ enum HelperState
+ {
+ PENDING,
+ DISPATCHED,
+ CANCELLED
+ };
+
+ /// Thread lock type
+ typedef ACE_SYNCH_MUTEX LockType;
+
+ /// Thread guard type
+ typedef ACE_Guard<LockType> GuardType;
+
+ /// Thread condition type
+ typedef TAO_Condition<LockType> ConditionType;
+
+ /// Lock used to protect the state and condition.
+ LockType lock_;
+
+ /// Used to denote the state of the request dispatching.
+ HelperState state_;
+
+ /// The condition used to block the calling thread until the
+ /// state is something other than the PENDING state.
+ ConditionType condition_;
+ };
+
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/CSD_ThreadPool/CSD_TP_Synch_Helper.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_CSD_TP_SYNCH_HELPER_H */
diff --git a/TAO/tao/CSD_ThreadPool/CSD_TP_Synch_Helper.inl b/TAO/tao/CSD_ThreadPool/CSD_TP_Synch_Helper.inl
new file mode 100644
index 00000000000..f4c5a1380c1
--- /dev/null
+++ b/TAO/tao/CSD_ThreadPool/CSD_TP_Synch_Helper.inl
@@ -0,0 +1,55 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO::CSD::TP_Synch_Helper::TP_Synch_Helper()
+ : state_(PENDING),
+ condition_(this->lock_)
+{
+}
+
+
+ACE_INLINE
+TAO::CSD::TP_Synch_Helper::~TP_Synch_Helper()
+{
+}
+
+
+ACE_INLINE
+bool
+TAO::CSD::TP_Synch_Helper::wait_while_pending()
+{
+ GuardType guard(this->lock_);
+
+ while (this->state_ == PENDING)
+ {
+ this->condition_.wait();
+ }
+
+ return (this->state_ == DISPATCHED);
+}
+
+
+ACE_INLINE
+void
+TAO::CSD::TP_Synch_Helper::dispatched()
+{
+ GuardType guard(this->lock_);
+ this->state_ = DISPATCHED;
+ this->condition_.signal();
+}
+
+
+ACE_INLINE
+void
+TAO::CSD::TP_Synch_Helper::cancelled()
+{
+ GuardType guard(this->lock_);
+ this->state_ = CANCELLED;
+ this->condition_.signal();
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/CSD_ThreadPool/CSD_TP_Task.cpp b/TAO/tao/CSD_ThreadPool/CSD_TP_Task.cpp
new file mode 100644
index 00000000000..a196ea9583d
--- /dev/null
+++ b/TAO/tao/CSD_ThreadPool/CSD_TP_Task.cpp
@@ -0,0 +1,312 @@
+// $Id$
+
+#include "tao/CSD_ThreadPool/CSD_TP_Task.h"
+#include "tao/CSD_ThreadPool/CSD_TP_Request.h"
+#include "tao/CSD_ThreadPool/CSD_TP_Dispatchable_Visitor.h"
+#include "tao/CSD_ThreadPool/CSD_TP_Cancel_Visitor.h"
+
+ACE_RCSID (CSD_ThreadPool,
+ TP_Task,
+ "$Id$")
+
+#if !defined (__ACE_INLINE__)
+# include "tao/CSD_ThreadPool/CSD_TP_Task.inl"
+#endif /* ! __ACE_INLINE__ */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO::CSD::TP_Task::~TP_Task()
+{
+}
+
+
+bool
+TAO::CSD::TP_Task::add_request(TP_Request* request)
+{
+ GuardType guard(this->lock_);
+
+ if (!this->accepting_requests_)
+ {
+ ACE_DEBUG((LM_DEBUG,"(%P|%t) TP_Task::add_request() - "
+ "not accepting requests\n"));
+ return false;
+ }
+
+ // We have made the decision that the request is going to be placed upon
+ // the queue_. Inform the request that it is about to be placed into
+ // a request queue. Some requests may not need to do anything in
+ // preparation of being placed into a queue. Others, however, may need
+ // to perfom a "clone" operation on some underlying request data before
+ // the request can be properly placed into a queue.
+ request->prepare_for_queue();
+
+ this->queue_.put(request);
+
+ this->work_available_.signal();
+
+ return true;
+}
+
+
+int
+TAO::CSD::TP_Task::open(void* num_threads_ptr)
+{
+ Thread_Counter num = 1;
+
+ if (num_threads_ptr != 0)
+ {
+ Thread_Counter* tmp = static_cast<Thread_Counter*> (num_threads_ptr);
+
+ if (tmp == 0)
+ {
+ ACE_ERROR_RETURN((LM_ERROR,
+ "(%P|%t) TP_Task failed to open. "
+ "Invalid argument type passed to open().\n"),
+ -1);
+ }
+
+ num = *tmp;
+ }
+
+ // We can't activate 0 threads. Make sure this isn't the case.
+ if (num < 1)
+ {
+ ACE_ERROR_RETURN((LM_ERROR,
+ "(%P|%t) TP_Task failed to open. "
+ "num_threads (%u) is less-than 1.\n",
+ num),
+ -1);
+ }
+
+ // Likewise, we can't activate too many. Make sure this isn't the case.
+ if (num > MAX_THREADPOOL_TASK_WORKER_THREADS)
+ {
+ ACE_ERROR_RETURN((LM_ERROR,
+ "(%P|%t) TP_Task failed to open. "
+ "num_threads (%u) is too large. Max is %d.\n",
+ num, MAX_THREADPOOL_TASK_WORKER_THREADS),
+ -1);
+ }
+
+ // We need the lock acquired from here on out.
+ GuardType guard(this->lock_);
+
+ // We can assume that we are in the proper state to handle this open()
+ // call as long as we haven't been open()'ed before.
+ if (this->opened_)
+ {
+ ACE_ERROR_RETURN((LM_ERROR,
+ "(%P|%t) TP_Task failed to open. "
+ "Task has previously been open()'ed.\n"),
+ -1);
+ }
+
+ // Activate this task object with 'num' worker threads.
+ if (this->activate(THR_NEW_LWP | THR_JOINABLE, num) != 0)
+ {
+ // Assumes that when activate returns non-zero return code that
+ // no threads were activated.
+ ACE_ERROR_RETURN((LM_ERROR,
+ "(%P|%t) TP_Task failed to activate "
+ "(%d) worker threads.\n",
+ num),
+ -1);
+ }
+
+ // Now we have past the point where we can say we've been open()'ed before.
+ this->opened_ = true;
+
+ // Now we wait until all of the threads have started.
+ while (this->num_threads_ != num)
+ {
+ this->active_workers_.wait();
+ }
+
+ // We can now accept requests (via our add_request() method).
+ this->accepting_requests_ = true;
+
+ return 0;
+}
+
+
+int
+TAO::CSD::TP_Task::svc()
+{
+ // Account for this current worker thread having started the
+ // execution of this svc() method.
+ {
+ GuardType guard(this->lock_);
+ // Put the thread id into a collection which is used to check whether
+ // the orb shutdown is called by one of the threads in the pool.
+ ACE_thread_t thr_id = ACE_OS::thr_self ();
+ if (this->activated_threads_.set(thr_id, this->num_threads_) == -1)
+ {
+ ACE_ERROR_RETURN((LM_ERROR,
+ ACE_TEXT("(%P|%t)TP_Task::svc: number of threads is out of range \n")),
+ 0);
+ }
+ ++this->num_threads_;
+ this->active_workers_.signal();
+ }
+
+ // This visitor object will be re-used over and over again as part of
+ // the "GetWork" logic below.
+ TP_Dispatchable_Visitor dispatchable_visitor;
+
+ // Start the "GetWork-And-PerformWork" loop for the current worker thread.
+ while (1)
+ {
+ TP_Request_Handle request;
+
+ // Do the "GetWork" step.
+ {
+ // Acquire the lock until just before we decide to "PerformWork".
+ GuardType guard(this->lock_);
+
+ // Start the "GetWork" loop.
+ while (request.is_nil())
+ {
+ if (this->shutdown_initiated_)
+ {
+ // This breaks us out of all loops with one fell swoop.
+ return 0;
+ }
+
+ // There is no need to visit the queue if it is empty.
+ if (!this->queue_.is_empty())
+ {
+ // Visit the requests in the queue in hopes of
+ // locating the first "dispatchable" (ie, not busy) request.
+ // If a dispatchable request is located, it is extracted
+ // from the queue and saved in a handle data member in the
+ // visitor object.
+ this->queue_.accept_visitor(dispatchable_visitor);
+
+ // If a dispatchable request is located, it is extracted
+ // from the queue and saved in a handle data member in the
+ // visitor object. Let's get a "copy" (or a NULL pointer
+ // if the visitor didn't locate/extract one).
+ request = dispatchable_visitor.request();
+ }
+
+ // Either the queue is empty or we couldn't find any dispatchable
+ // requests in the queue at this time.
+ if (request.is_nil())
+ {
+ // Let's wait until we hear about the possibility of
+ // work before we go look again.
+ this->work_available_.wait();
+ }
+ }
+
+ // We have dropped out of the "while (request.is_nil())" loop.
+ // We only get here is we located/extracted a dispatchable request
+ // from the queue. Note that the visitor will have already
+ // marked the target servant as now being busy (because of us).
+ // We can now safely release the lock.
+ }
+
+ // Do the "PerformWork" step. We don't need the lock_ to do this.
+ request->dispatch();
+
+ // Now that the request has been dispatched, we need to mark the target
+ // servant as no longer being busy, and we need to signal any wait()'ing
+ // worker threads that there may be some dispatchable requests in the
+ // queue now for this not-busy servant. We need the lock_ to do this.
+ {
+ GuardType guard(this->lock_);
+ request->mark_as_ready();
+ this->work_available_.signal();
+ }
+
+ // Reset the visitor since we use it over and over. This
+ // will cause the visitor to drop any reference to
+ // the dispatched request.
+ dispatchable_visitor.reset();
+
+ // Note that the request will be "released" here when the request
+ // handle falls out of scope and its destructor performs the
+ // _remove_ref() call on the underlying TP_Request object.
+ }
+
+ // This will never get executed.
+ return 0;
+}
+
+
+int
+TAO::CSD::TP_Task::close(u_long flag)
+{
+ GuardType guard(this->lock_);
+
+ if (flag == 0)
+ {
+ // Worker thread is closing.
+ --this->num_threads_;
+ this->active_workers_.signal();
+ }
+ else
+ {
+ // Strategy object is shutting down the task.
+
+ // Do nothing if this task has never been open()'ed.
+ if (!this->opened_)
+ {
+ return 0;
+ }
+
+ // Set the shutdown flag to true.
+ this->shutdown_initiated_ = true;
+
+ // Stop accepting requests.
+ this->accepting_requests_ = false;
+
+ // Signal all worker threads waiting on the work_available_ condition.
+ this->work_available_.broadcast();
+
+ size_t num_waiting_threads = 0;
+
+ ACE_thread_t my_thr_id = ACE_OS::thr_self ();
+
+ // Check whether the calling thread(calling orb shutdown) is one of the
+ // threads in the pool. If it is then it should not wait itself.
+ size_t size = this->activated_threads_.size ();
+
+ for (size_t i = 0; i < size; i ++)
+ {
+ ACE_thread_t thr_id = 0;
+ if (activated_threads_.get (thr_id, i) == 0 && thr_id == my_thr_id)
+ {
+ num_waiting_threads = 1;
+ break;
+ }
+ }
+
+ // Wait until all worker threads have shutdown.
+ while (this->num_threads_ != num_waiting_threads)
+ {
+ this->active_workers_.wait();
+ }
+
+ // Cancel all requests.
+ TP_Cancel_Visitor cancel_visitor;
+ this->queue_.accept_visitor(cancel_visitor);
+ }
+
+ return 0;
+}
+
+
+
+void
+TAO::CSD::TP_Task::cancel_servant (PortableServer::Servant servant
+ ACE_ENV_ARG_DECL)
+{
+ GuardType guard(this->lock_);
+
+ // Cancel the requests targeted for the provided servant.
+ TP_Cancel_Visitor cancel_visitor(servant);
+ this->queue_.accept_visitor(cancel_visitor);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/CSD_ThreadPool/CSD_TP_Task.h b/TAO/tao/CSD_ThreadPool/CSD_TP_Task.h
new file mode 100644
index 00000000000..65839aeb3b7
--- /dev/null
+++ b/TAO/tao/CSD_ThreadPool/CSD_TP_Task.h
@@ -0,0 +1,164 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file CSD_TP_Task.h
+ *
+ * $Id$
+ *
+ * @author Tim Bradley <bradley_t@ociweb.com>
+ */
+//=============================================================================
+
+#ifndef TAO_CSD_TP_TASK_H
+#define TAO_CSD_TP_TASK_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/CSD_ThreadPool/CSD_TP_Export.h"
+
+#include "tao/CSD_ThreadPool/CSD_TP_Queue.h"
+#include "tao/PortableServer/PortableServer.h"
+#include "tao/Condition.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/Task.h"
+#include "ace/Synch.h"
+#include "ace/Containers_T.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace CSD
+ {
+ /// Typedef for the number of threads.
+ typedef unsigned long Thread_Counter;
+
+ /**
+ * @class TP_Task
+ *
+ * @brief Active Object managing a queue of request objects.
+ *
+ * There are two types of "users" of a TP_Task object:
+ *
+ * 1) The TP_Strategy object that "owns" this task object.
+ * 2) The worker threads that "run" this task object as an
+ * "active object".
+ *
+ * The TP_Strategy object that "owns" this task object dictates
+ * when the worker threads are activated and when they are shutdown. It
+ * also injects requests into this task's queue via calls to the
+ * add_request() method. It is also the TP_Strategy object that
+ * dictates the number of worker threads to be activated via a call to
+ * the set_num_threads() method.
+ *
+ * The active object pattern is implemented via the use of the
+ * the ACE_Task_Base base class, and each worker thread will
+ * invoke this task's svc() method, and when the svc() returns, the
+ * worker thread will invoke this task's close() method (with the
+ * flag argument equal to 0).
+ *
+ * @note I just wanted to document an idea... When the pool consists
+ * of only one worker thread, we could care less about checking
+ * if target servant objects are busy or not. The simple fact
+ * that only one thread will be dispatching all requests means
+ * that servant objects will never be busy when the thread
+ * tests to see if a request is "ready_for_dispatch()". I'm
+ * just wondering if this knowledge can be applied to the
+ * implementation such that the "pool with one worker thread" case
+ * performs more efficiently. This is STP vs SSTP.
+ *
+ */
+ class TAO_CSD_TP_Export TP_Task : public ACE_Task_Base
+ {
+ public:
+
+ /// Default Constructor.
+ TP_Task();
+
+ /// Virtual Destructor.
+ virtual ~TP_Task();
+
+ /// Put a request object on to the request queue.
+ /// Returns true if successful, false otherwise (it has been "rejected").
+ bool add_request(TP_Request* request);
+
+ /// Activate the worker threads
+ virtual int open(void* num_threads_ptr = 0);
+
+ /// The "mainline" executed by each worker thread.
+ virtual int svc();
+
+ /// Multi-purpose: argument value is used to differentiate purpose.
+ ///
+ /// 0) Invoked by each worker thread after its invocation of the
+ /// svc() method has completed (ie, returned).
+ /// 1) Invoked by the strategy object to shutdown all worker threads.
+ virtual int close(u_long flag = 0);
+
+ /// Cancel all requests that are targeted for the provided servant.
+ void cancel_servant (PortableServer::Servant servant
+ ACE_ENV_ARG_DECL);
+
+
+ private:
+
+ typedef TAO_SYNCH_MUTEX LockType;
+ typedef ACE_Guard<LockType> GuardType;
+ typedef TAO_Condition<LockType> ConditionType;
+
+
+ /// Lock to protect the "state" (all of the data members) of this object.
+ LockType lock_;
+
+ /// Condition used to signal worker threads that they may be able to
+ /// find a request in the queue_ that needs to be dispatched to a
+ /// servant that is currently "not busy".
+ /// This condition will be signal()'ed each time a new request is
+ /// added to the queue_, and also when a servant has become "not busy".
+ ConditionType work_available_;
+
+ /// This condition will be signal()'ed each time the num_threads_
+ /// data member has its value changed. This is used to keep the
+ /// close(1) invocation (ie, a shutdown request) blocked until all
+ /// of the worker threads have stopped running.
+ ConditionType active_workers_;
+
+ /// Flag used to indicate when this task will (or will not) accept
+ /// requests via the the add_request() method.
+ bool accepting_requests_;
+
+ /// Flag used to initiate a shutdown request to all worker threads.
+ bool shutdown_initiated_;
+
+ /// Flag used to avoid multiple open() calls.
+ bool opened_;
+
+ /// The number of currently active worker threads.
+ Thread_Counter num_threads_;
+
+ /// The queue of pending servant requests (a.k.a. the "request queue").
+ TP_Queue queue_;
+
+ typedef ACE_Array <ACE_thread_t> Thread_Ids;
+
+ /// The list of ids for the threads launched by this task.
+ Thread_Ids activated_threads_;
+ };
+
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/CSD_ThreadPool/CSD_TP_Task.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_CSD_TP_TASK_H */
diff --git a/TAO/tao/CSD_ThreadPool/CSD_TP_Task.inl b/TAO/tao/CSD_ThreadPool/CSD_TP_Task.inl
new file mode 100644
index 00000000000..d9c203f45ce
--- /dev/null
+++ b/TAO/tao/CSD_ThreadPool/CSD_TP_Task.inl
@@ -0,0 +1,22 @@
+// -*- C++ -*-
+//
+// $Id$
+
+namespace { enum { MAX_THREADPOOL_TASK_WORKER_THREADS = 50 }; }
+namespace { const ACE_thread_t default_thread_id = 0; }
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO::CSD::TP_Task::TP_Task()
+ : work_available_(this->lock_),
+ active_workers_(this->lock_),
+ accepting_requests_(false),
+ shutdown_initiated_(false),
+ opened_(false),
+ num_threads_(0),
+ activated_threads_ ((size_t)MAX_THREADPOOL_TASK_WORKER_THREADS, default_thread_id)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/CSD_ThreadPool/CSD_ThreadPool.cpp b/TAO/tao/CSD_ThreadPool/CSD_ThreadPool.cpp
new file mode 100644
index 00000000000..2ae022711f5
--- /dev/null
+++ b/TAO/tao/CSD_ThreadPool/CSD_ThreadPool.cpp
@@ -0,0 +1,23 @@
+// $Id$
+
+#include "tao/CSD_ThreadPool/CSD_ThreadPool.h"
+#include "tao/CSD_ThreadPool/CSD_TP_Strategy_Factory.h"
+#include "tao/CSD_Framework/CSD_Framework_Loader.h"
+#include "tao/debug.h"
+#include "ace/Dynamic_Service.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+int
+TAO_CSD_ThreadPool::init (void)
+{
+ static int initialized = 0;
+ if (initialized == 1)
+ return 0;
+ initialized = 1;
+
+ TAO_CSD_Framework_Loader::init();
+ return ACE_Service_Config::process_directive (ace_svc_desc_TAO_CSD_TP_Strategy_Factory);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/CSD_ThreadPool/CSD_ThreadPool.h b/TAO/tao/CSD_ThreadPool/CSD_ThreadPool.h
new file mode 100644
index 00000000000..bb1bd448284
--- /dev/null
+++ b/TAO/tao/CSD_ThreadPool/CSD_ThreadPool.h
@@ -0,0 +1,65 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file CSD_ThreadPool.h
+ *
+ * $Id$
+ *
+ * @author Tim Bradley <bradley_t@ociweb.com>
+ */
+//=============================================================================
+
+#ifndef TAO_CSD_THREADPOOL_H
+#define TAO_CSD_THREADPOOL_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/CSD_ThreadPool/CSD_TP_Export.h"
+#include "tao/Versioned_Namespace.h"
+#include "ace/Service_Object.h"
+#include "ace/Service_Config.h"
+
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TP_Strategy_Factory
+ *
+ * @brief An ACE_Service_Object capable of creating TP_Strategy objects.
+ *
+ * TBD - Explain in more detail.
+ *
+ */
+class TAO_CSD_TP_Export TAO_CSD_ThreadPool
+{
+ public:
+ /// Used to force the initialization of the ORB code.
+ static int init (void);
+};
+
+#if defined(ACE_HAS_BROKEN_STATIC_CONSTRUCTORS)
+
+typedef int (*TAO_CSD_Threadpool) (void);
+
+static TAO_CSD_Threadpool
+TAO_Requires_CSD_Threadpool =
+ &TAO_CSD_ThreadPool::init;
+
+#else
+
+static int
+TAO_Requires_CSD_Threadpool =
+ TAO_CSD_ThreadPool::init ();
+
+#endif /* ACE_HAS_BROKEN_STATIC_CONSTRUCTORS */
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_CSD_THREADPOOL_H */
diff --git a/TAO/tao/CSD_ThreadPool/TAO_CSD_ThreadPool.pc.in b/TAO/tao/CSD_ThreadPool/TAO_CSD_ThreadPool.pc.in
new file mode 100644
index 00000000000..7b2b894a6d7
--- /dev/null
+++ b/TAO/tao/CSD_ThreadPool/TAO_CSD_ThreadPool.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: TAO_CSD_ThreadPool
+Description: TAO CSD ThreadPool Library
+Requires: TAO_CSD_Framework
+Version: @VERSION@
+Libs: -L${libdir} -lTAO
+Cflags: -I${includedir}
diff --git a/TAO/tao/Cache_Entries.cpp b/TAO/tao/Cache_Entries.cpp
new file mode 100644
index 00000000000..99ecb2ad72b
--- /dev/null
+++ b/TAO/tao/Cache_Entries.cpp
@@ -0,0 +1,52 @@
+//$Id$
+
+#include "tao/Cache_Entries.h"
+#include "tao/Transport.h"
+
+
+#if !defined (__ACE_INLINE__)
+# include "tao/Cache_Entries.inl"
+#endif /* __ACE_INLINE__ */
+
+ACE_RCSID(tao,
+ Cache_Entries,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ Cache_IntId::Cache_IntId (TAO_Transport *transport)
+ : transport_ (transport)
+ , recycle_state_ (ENTRY_UNKNOWN)
+ {
+ transport->add_reference ();
+ }
+
+ Cache_IntId::~Cache_IntId (void)
+ {
+ if (this->transport_)
+ this->transport_->remove_reference ();
+ }
+
+ Cache_IntId&
+ Cache_IntId::operator= (const Cache_IntId &rhs)
+ {
+ if (this != &rhs)
+ {
+ this->recycle_state_ = rhs.recycle_state_;
+
+ TAO_Transport *old_transport = this->transport_;
+ this->transport_ = rhs.transport_;
+ if (this->transport_)
+ this->transport_->add_reference ();
+ if (old_transport)
+ old_transport->remove_reference ();
+ }
+
+ return *this;
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Cache_Entries.h b/TAO/tao/Cache_Entries.h
new file mode 100644
index 00000000000..993cc36de11
--- /dev/null
+++ b/TAO/tao/Cache_Entries.h
@@ -0,0 +1,208 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Cache_Entries.h
+ *
+ * $Id$
+ *
+ *
+ * @author Bala Natarajan <bala@cs.wustl.edu>
+ */
+//=============================================================================
+
+
+#ifndef TAO_CACHE_ENTRIES_H
+#define TAO_CACHE_ENTRIES_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Transport_Descriptor_Interface.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Transport;
+
+#ifdef index
+# undef index
+#endif /* index */
+
+namespace TAO
+{
+ /// States of a recyclable object.
+ /// @@todo: A lifecycle needs to be designed. It can wait for
+ /// sometime.
+ enum Cache_Entries_State
+ {
+ /// Idle and can be purged.
+ ENTRY_IDLE_AND_PURGABLE,
+
+ /// Idle but cannot be purged.
+ ENTRY_IDLE_BUT_NOT_PURGABLE,
+
+ /// Can be purged, but is not idle (mostly for debugging).
+ ENTRY_PURGABLE_BUT_NOT_IDLE,
+
+ /// Busy (i.e., cannot be recycled or purged).
+ ENTRY_BUSY,
+
+ /// Closed.
+ ENTRY_CLOSED,
+
+ /// Unknown state.
+ ENTRY_UNKNOWN
+ };
+
+ /**
+ * @class Cache_IntId
+ *
+ * @brief Helper class for TAO_Transport_Cache_Manager
+ *
+ * Helper class that wraps the <value> part of the Map or
+ * table holding the Transport state.: unifies data items, so
+ * they can be stored together as a <value> for a <key> in a
+ * table holding the state of the Transport Cache.
+ */
+ class TAO_Export Cache_IntId
+ {
+ public:
+
+ /// Constructor.
+ Cache_IntId (void);
+
+ /// Constructor.
+ Cache_IntId (TAO_Transport *transport);
+
+ /// Copy constructor.
+ Cache_IntId (const Cache_IntId & rhs);
+
+ /// Destructor.
+ ~Cache_IntId (void);
+
+ /// Assignment operator (does copy memory).
+ Cache_IntId& operator= (const Cache_IntId &rhs);
+
+ /// Equality comparison operator (must match both id_ and kind_).
+ bool operator== (const Cache_IntId &rhs) const;
+
+ /// Inequality comparison operator.
+ bool operator!= (const Cache_IntId &rhs) const;
+
+ /// Return the underlying transport
+ TAO_Transport *transport (void);
+
+ /// Return the underlying transport
+ const TAO_Transport *transport (void) const;
+
+ /// Set <recycle_state>.
+ void recycle_state (Cache_Entries_State new_state);
+
+ /// Get <recycle_state>.
+ Cache_Entries_State recycle_state (void);
+
+ /// Relinquish ownership of the TAO_Transport object associated with
+ /// this Cache_IntId.
+ /**
+ * @note This method should go away once the
+ * Transport_Cache_Map_Manager is improved so that it returns
+ * TAO_Transport objects when performing a find() operation.
+ * This method really only exists to get around inadequacies
+ * in the Transport_Cache_Map_Manager interface.
+ */
+ TAO_Transport *relinquish_transport (void);
+
+ private:
+ /// The transport that needs to be cached.
+ TAO_Transport *transport_;
+
+ /// The state of the handle
+ Cache_Entries_State recycle_state_;
+ };
+
+
+ /**
+ * @class Cache_ExtId
+ *
+ * @brief Helper class for TAO_Transport_Cache_Manager: unifies
+ * several data items, so they can be stored together as a
+ * <value> for a <key> in a hash table holding the state of the
+ * Transport Cache.
+ */
+ class TAO_Export Cache_ExtId
+ {
+ public:
+
+ /// Constructor.
+ Cache_ExtId (void);
+
+ /// Constructor.
+ Cache_ExtId (TAO_Transport_Descriptor_Interface *prop);
+
+ /// Copy constructor.
+ Cache_ExtId (const Cache_ExtId & rhs);
+
+ /// Destructor.
+ ~Cache_ExtId (void);
+
+ // = Assignment and comparison operators.
+ /// Assignment operator (does copy memory).
+ Cache_ExtId& operator= (const Cache_ExtId &rhs);
+
+ /// Equality comparison operator (must match both id_ and kind_).
+ bool operator== (const Cache_ExtId &rhs) const;
+
+ /// Inequality comparison operator.
+ bool operator!= (const Cache_ExtId &rhs) const;
+
+ /// <hash> function is required in order for this class to be usable by
+ /// ACE_Hash_Map_Manager_Ex.
+ u_long hash (void) const;
+
+ /// Make a deep copy of the underlying pointer
+ void duplicate (void);
+
+ /// Return the index value
+ CORBA::ULong index (void) const;
+
+ /// Set the index value. This calls should not be used by any users
+ /// but for the TAO_Transport_Cache_Manager class.
+ void index (CORBA::ULong index);
+
+ /// Increment the index value
+ void incr_index (void);
+
+ // = Accessors
+ /// Get the underlying the property pointer
+ TAO_Transport_Descriptor_Interface *property (void) const;
+
+ private:
+
+ /// A property object that we represent.
+ TAO_Transport_Descriptor_Interface *transport_property_;
+
+ /// Do we need to delete transport_property?
+ CORBA::Boolean is_delete_;
+
+ /**
+ * This is a supplementary index. Would be set to zero by
+ * default. Would be altered by the Transport_Cache of TAO. Please
+ * see the documentation of TAO_Transport_Cache_Manager for
+ * details.
+ */
+ CORBA::ULong index_;
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/Cache_Entries.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_CACHE_ENTRIES_H */
diff --git a/TAO/tao/Cache_Entries.inl b/TAO/tao/Cache_Entries.inl
new file mode 100644
index 00000000000..475f8865a0d
--- /dev/null
+++ b/TAO/tao/Cache_Entries.inl
@@ -0,0 +1,195 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ ACE_INLINE
+ Cache_IntId::Cache_IntId (void)
+ : transport_ (0),
+ recycle_state_ (ENTRY_UNKNOWN)
+ {
+ }
+
+ ACE_INLINE
+ Cache_IntId::Cache_IntId (const Cache_IntId &rhs)
+ : transport_ (0),
+ recycle_state_ (ENTRY_UNKNOWN)
+ {
+ *this = rhs;
+ }
+
+ ACE_INLINE bool
+ Cache_IntId::operator== (const Cache_IntId &rhs) const
+ {
+ return (this->transport_ == rhs.transport_);
+ }
+
+ ACE_INLINE bool
+ Cache_IntId::operator!= (const Cache_IntId &rhs) const
+ {
+ return (this->transport_ != rhs.transport_);
+ }
+
+ ACE_INLINE TAO_Transport *
+ Cache_IntId::transport (void)
+ {
+ return this->transport_;
+ }
+
+ ACE_INLINE const TAO_Transport *
+ Cache_IntId::transport (void) const
+ {
+ return this->transport_;
+ }
+
+ ACE_INLINE void
+ Cache_IntId::recycle_state (Cache_Entries_State st)
+ {
+ this->recycle_state_ = st;
+ }
+
+ ACE_INLINE Cache_Entries_State
+ Cache_IntId::recycle_state (void)
+ {
+ return this->recycle_state_;
+ }
+
+ ACE_INLINE TAO_Transport *
+ Cache_IntId::relinquish_transport (void)
+ {
+ // Yield ownership of the TAO_Transport object.
+ TAO_Transport *val = this->transport_;
+ this->transport_ = 0;
+ return val;
+ }
+
+ /*******************************************************/
+ ACE_INLINE
+ Cache_ExtId::Cache_ExtId (void)
+ : transport_property_ (0),
+ is_delete_ (0),
+ index_ (0)
+ {
+ }
+
+ ACE_INLINE
+ Cache_ExtId::Cache_ExtId (TAO_Transport_Descriptor_Interface *prop)
+ : transport_property_ (prop),
+ is_delete_ (0),
+ index_ (0)
+ {
+
+ }
+
+ ACE_INLINE
+ Cache_ExtId::~Cache_ExtId (void)
+ {
+ if (this->is_delete_)
+ delete this->transport_property_;
+ }
+
+ ACE_INLINE Cache_ExtId &
+ Cache_ExtId::operator= (const Cache_ExtId &rhs)
+ {
+ if (this != &rhs)
+ {
+ // Do a deep copy
+ this->transport_property_ =
+ rhs.transport_property_->duplicate ();
+
+ if (this->transport_property_ == 0)
+ {
+ this->is_delete_ = 0;
+ this->index_ = 0;
+ }
+ else
+ {
+ this->is_delete_ = 1;
+ this->index_ = rhs.index_;
+ }
+ }
+ return *this;
+ }
+
+ ACE_INLINE
+ Cache_ExtId::Cache_ExtId (const Cache_ExtId &rhs)
+ : transport_property_ (0),
+ is_delete_ (0),
+ index_ (0)
+ {
+ *this = rhs;
+ }
+
+ ACE_INLINE bool
+ Cache_ExtId::operator== (const Cache_ExtId &rhs) const
+ {
+ return (this->transport_property_->is_equivalent (rhs.transport_property_) &&
+ this->index_ == rhs.index_);
+ }
+
+ ACE_INLINE bool
+ Cache_ExtId::operator!= (const Cache_ExtId &rhs) const
+ {
+ if (this->transport_property_->is_equivalent (rhs.transport_property_) &&
+ this->index_ == rhs.index_)
+ return false;
+
+ return true;
+ }
+
+ ACE_INLINE u_long
+ Cache_ExtId::hash (void) const
+ {
+ return (this->transport_property_->hash () + this->index_);
+ }
+
+ ACE_INLINE void
+ Cache_ExtId::duplicate (void)
+ {
+ TAO_Transport_Descriptor_Interface *prop = 0;
+
+ // Make a deep copy
+ prop = this->transport_property_->duplicate ();
+
+ if (prop == 0)
+ return;
+
+ // Release memory if there was some allocated in the first place
+ if (this->is_delete_)
+ delete this->transport_property_;
+
+ this->is_delete_ = 1;
+ this->transport_property_ = prop;
+ }
+
+
+ ACE_INLINE CORBA::ULong
+ Cache_ExtId::index (void) const
+ {
+ return this->index_;
+ }
+
+
+ ACE_INLINE void
+ Cache_ExtId::index (CORBA::ULong index)
+ {
+ this->index_ = index;
+ }
+
+ ACE_INLINE void
+ Cache_ExtId::incr_index (void)
+ {
+ ++this->index_;
+ }
+
+ ACE_INLINE TAO_Transport_Descriptor_Interface *
+ Cache_ExtId::property (void) const
+ {
+ return this->transport_property_;
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/CharSeq.pidl b/TAO/tao/CharSeq.pidl
new file mode 100644
index 00000000000..b5e93d86565
--- /dev/null
+++ b/TAO/tao/CharSeq.pidl
@@ -0,0 +1,33 @@
+// -*- IDL -*-
+//
+// $Id$
+
+/**
+ * This file was used to generate the code in CharSeqC.*
+ * The command used to generate code is:
+ *
+ * tao_idl
+ * -oA AnyTypeCode
+ * -Ge 1 -GA -SS -Sci
+ * -Wb,pre_include=ace/pre.h
+ * -Wb,post_include=ace/post.h
+ * -Wb,export_macro=TAO_Export
+ * -Wb,export_include=tao/TAO_Export.h
+ * -Wb,anyop_export_macro=TAO_AnyTypeCode_Export
+ * -Wb,anyop_export_include=tao/AnyTypeCode/TAO_AnyTypeCode_Export.h
+ * -Wb,versioning_begin=TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+ * -Wb,versioning_end=TAO_END_VERSIONED_NAMESPACE_DECL
+ * CharSeq.pidl
+ */
+
+#ifndef TAO_CORBA_CHAR_SEQ_IDL
+#define TAO_CORBA_CHAR_SEQ_IDL
+
+#pragma prefix "omg.org"
+
+module CORBA
+{
+ typedef sequence<char> CharSeq;
+};
+
+#endif /* TAO_CORBA_CHAR_SEQ_IDL */
diff --git a/TAO/tao/Cleanup_Func_Registry.cpp b/TAO/tao/Cleanup_Func_Registry.cpp
new file mode 100644
index 00000000000..9b89b0f32d8
--- /dev/null
+++ b/TAO/tao/Cleanup_Func_Registry.cpp
@@ -0,0 +1,52 @@
+#include "tao/Cleanup_Func_Registry.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/Cleanup_Func_Registry.inl"
+#endif /* __ACE_INLINE__ */
+
+#include "ace/Log_Msg.h"
+
+ACE_RCSID (tao,
+ Cleanup_Func_Registry,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+int
+TAO_Cleanup_Func_Registry::register_cleanup_function (
+ ACE_CLEANUP_FUNC func,
+ size_t &slot_id)
+{
+ size_t const slot = this->cleanup_funcs_.size ();
+
+ if (this->cleanup_funcs_.size (slot + 1) != 0)
+ return -1;
+
+ this->cleanup_funcs_[slot] = func;
+ slot_id = slot;
+
+ return 0;
+}
+
+void
+TAO_Cleanup_Func_Registry::cleanup (ACE_Array_Base<void *> &ts_objects)
+{
+ size_t const len = ts_objects.size ();
+
+ // The allocated slot may never have been used. It is therefore
+ // possible that the TSS array size may be less than the cleanup
+ // function size. However, there is still a one-to-one
+ // correspondence between cleanup_func[foo] and ts_object[foo].
+
+ ACE_ASSERT (len <= this->cleanup_funcs_.size ());
+
+ /// Cleanup each TSS object.
+ for (size_t i = 0; i < len; ++i)
+ {
+ ACE_CLEANUP_FUNC destructor = this->cleanup_funcs_[i];
+ if (destructor != 0)
+ destructor (ts_objects[i], 0);
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Cleanup_Func_Registry.h b/TAO/tao/Cleanup_Func_Registry.h
new file mode 100644
index 00000000000..cc2c6162c97
--- /dev/null
+++ b/TAO/tao/Cleanup_Func_Registry.h
@@ -0,0 +1,92 @@
+// -*- C++ -*-
+
+// ===================================================================
+/**
+ * @file Cleanup_Func_Registry.h
+ *
+ * $Id$
+ *
+ * @author Ossama Othman <ossama@dre.vanderbilt.edu>
+ */
+// ===================================================================
+
+#ifndef TAO_CLEANUP_FUNC_REGISTRY_H
+#define TAO_CLEANUP_FUNC_REGISTRY_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/TAO_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Versioned_Namespace.h"
+
+#include "ace/Array_Base.h"
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_Cleanup_Func_Registry
+ *
+ * @brief
+ * This is a helper class that is designed to perform cleanup on
+ * thread-specific objects registered in the ORB Core TSS resources by
+ * invoking the corresponding cleanup function on each object. Hence,
+ * there is a tight coupling between this class and the TAO ORB Core.
+ */
+class TAO_Cleanup_Func_Registry
+{
+ friend class TAO_ORB_Core;
+
+public:
+
+ /// Constructor.
+ TAO_Cleanup_Func_Registry (void);
+
+ /// Return the number of registered cleanup functions.
+ size_t size (void) const;
+
+protected:
+
+ /// Register a cleanup function. The number of slot the cleanup
+ /// function is placed is in will match the one reserved for the
+ /// corresponding thread specific object in the ORB Core TSS
+ /// resources. The slot_id is returned via the second reference
+ /// argument. This method returns 0 on failure, and -1 on failure.
+ int register_cleanup_function (ACE_CLEANUP_FUNC func,
+ size_t &slot_id);
+
+ /// Invoke the corresponding cleanup function on each
+ /// thread-specific object.
+ void cleanup (ACE_Array_Base<void *> &ts_objects);
+
+private:
+
+ /// Prevent copying through the copy constructor and the assignment
+ /// operator.
+ TAO_Cleanup_Func_Registry (const TAO_Cleanup_Func_Registry &);
+ void operator= (const TAO_Cleanup_Func_Registry &);
+
+private:
+
+ /// Array of registered cleanup functions. The number of
+ /// registered cleanup functions should be the same as the number
+ /// of registered thread-specific objects in the ORB Core TSS
+ /// resources.
+ ACE_Array_Base<ACE_CLEANUP_FUNC> cleanup_funcs_;
+
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/Cleanup_Func_Registry.inl"
+#endif /* __ACE_INLINE__ */
+
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_CLEANUP_FUNC_REGISTRY_H */
diff --git a/TAO/tao/Cleanup_Func_Registry.inl b/TAO/tao/Cleanup_Func_Registry.inl
new file mode 100644
index 00000000000..2216dce7c34
--- /dev/null
+++ b/TAO/tao/Cleanup_Func_Registry.inl
@@ -0,0 +1,19 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO_Cleanup_Func_Registry::TAO_Cleanup_Func_Registry (void)
+ : cleanup_funcs_ ()
+{
+}
+
+ACE_INLINE size_t
+TAO_Cleanup_Func_Registry::size (void) const
+{
+ return this->cleanup_funcs_.size ();
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/ClientRequestInterceptor_Adapter.cpp b/TAO/tao/ClientRequestInterceptor_Adapter.cpp
new file mode 100644
index 00000000000..bf3d334201e
--- /dev/null
+++ b/TAO/tao/ClientRequestInterceptor_Adapter.cpp
@@ -0,0 +1,13 @@
+#include "tao/ClientRequestInterceptor_Adapter.h"
+
+ACE_RCSID (tao,
+ ClientInterceptorAdapter,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO::ClientRequestInterceptor_Adapter::~ClientRequestInterceptor_Adapter (void)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/ClientRequestInterceptor_Adapter.h b/TAO/tao/ClientRequestInterceptor_Adapter.h
new file mode 100644
index 00000000000..0a5c83b8b94
--- /dev/null
+++ b/TAO/tao/ClientRequestInterceptor_Adapter.h
@@ -0,0 +1,122 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file ClientRequestInterceptor_Adapter.h
+ *
+ * $Id$
+ *
+ * This file an adapter class to simplify the support of
+ * interceptors.
+ *
+ * @author Nanbor Wang <nanbor@cs.wustl.edu>
+ * @author Ossama Othman <ossama@uci.edu>
+ * @author Kirthika Parameswaran <kirthika@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_CLIENT_REQUEST_INTERCEPTOR_ADAPTER_H
+#define TAO_CLIENT_REQUEST_INTERCEPTOR_ADAPTER_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/TAO_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/CORBA_macros.h"
+#include "tao/SystemException.h"
+#include "tao/Invocation_Utils.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_ClientRequestInfo;
+
+namespace PortableInterceptor
+{
+ class ClientRequestInterceptor;
+ typedef ClientRequestInterceptor *ClientRequestInterceptor_ptr;
+
+ typedef CORBA::Short ReplyStatus;
+}
+
+namespace CORBA
+{
+ class PolicyList;
+}
+
+namespace TAO
+{
+ class Invocation_Base;
+
+ /**
+ * @class ClientRequestInterceptor_Adapter
+ *
+ * @brief A convenient helper class to invoke registered client request
+ * interceptors
+ *
+ * This class invokes all registered interceptors at interception
+ * point, and enforces flow rules dictated by the Portable Interceptor
+ * specification/chapter.
+ */
+ class TAO_Export ClientRequestInterceptor_Adapter
+ {
+ public:
+ virtual ~ClientRequestInterceptor_Adapter (void);
+
+ /**
+ * @name PortableInterceptor Client Side Interception Points
+ *
+ * Each of these methods corresponds to a client side interception
+ * point. There are no "intermediate" interception points on the
+ * client side, only "starting" and "ending" interception points.
+ *
+ */
+ //@{
+ /// This method implements one of the "starting" client side
+ /// interception points.
+ virtual void send_request (Invocation_Base &invocation
+ ACE_ENV_ARG_DECL) = 0;
+
+ /// This method implements one of the "ending" client side
+ /// interception point.
+ virtual void receive_reply (Invocation_Base &invocation
+ ACE_ENV_ARG_DECL) = 0;
+
+ /// This method implements one of the "ending" client side
+ /// interception point.
+ virtual void receive_exception (Invocation_Base &invocation
+ ACE_ENV_ARG_DECL) = 0;
+
+ /// This method implements one of the "ending" client side
+ /// interception point.
+ virtual void receive_other (Invocation_Base &invocation
+ ACE_ENV_ARG_DECL) = 0;
+
+ /// Register an interceptor.
+ virtual void add_interceptor (
+ PortableInterceptor::ClientRequestInterceptor_ptr interceptor
+ ACE_ENV_ARG_DECL) = 0;
+
+ /// Register an interceptor with policies.
+ virtual void add_interceptor (
+ PortableInterceptor::ClientRequestInterceptor_ptr interceptor,
+ const CORBA::PolicyList& policies
+ ACE_ENV_ARG_DECL) = 0;
+
+ virtual void destroy_interceptors (ACE_ENV_SINGLE_ARG_DECL) = 0;
+
+ /// Convert TAO Invocation status to a PI status
+ virtual PortableInterceptor::ReplyStatus reply_status (
+ TAO::Invocation_Base const &invocation_base) = 0;
+ };
+
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_CLIENT_REQUEST_INTERCEPTOR_ADAPTER_H */
diff --git a/TAO/tao/ClientRequestInterceptor_Adapter_Factory.cpp b/TAO/tao/ClientRequestInterceptor_Adapter_Factory.cpp
new file mode 100644
index 00000000000..ee3178eea83
--- /dev/null
+++ b/TAO/tao/ClientRequestInterceptor_Adapter_Factory.cpp
@@ -0,0 +1,13 @@
+#include "tao/ClientRequestInterceptor_Adapter_Factory.h"
+
+ACE_RCSID (tao,
+ ClientRequestInterceptorAdapterFactory,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_ClientRequestInterceptor_Adapter_Factory::~TAO_ClientRequestInterceptor_Adapter_Factory (void)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/ClientRequestInterceptor_Adapter_Factory.h b/TAO/tao/ClientRequestInterceptor_Adapter_Factory.h
new file mode 100644
index 00000000000..805608c2af0
--- /dev/null
+++ b/TAO/tao/ClientRequestInterceptor_Adapter_Factory.h
@@ -0,0 +1,54 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file ClientRequestInterceptor_Adapter_Factory.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+
+#ifndef TAO_CLIENTREQUESTINTERCEPTOR_ADAPTER_FACTORY_H
+#define TAO_CLIENTREQUESTINTERCEPTOR_ADAPTER_FACTORY_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/TAO_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Versioned_Namespace.h"
+
+#include "ace/Service_Object.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ class ClientRequestInterceptor_Adapter;
+}
+
+/**
+ * @class TAO_ClientRequestInterceptor_Adapter_Factory
+ *
+ * @brief TAO_ClientRequestInterceptor_Adapter_Factory.
+ */
+class TAO_Export TAO_ClientRequestInterceptor_Adapter_Factory
+ : public ACE_Service_Object
+{
+public:
+ virtual ~TAO_ClientRequestInterceptor_Adapter_Factory (void);
+
+ virtual TAO::ClientRequestInterceptor_Adapter *create (void) = 0;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_CLIENTREQUESTINTERCEPTOR_ADAPTER_FACTORY_H */
diff --git a/TAO/tao/Client_Strategy_Factory.cpp b/TAO/tao/Client_Strategy_Factory.cpp
new file mode 100644
index 00000000000..2cc73497870
--- /dev/null
+++ b/TAO/tao/Client_Strategy_Factory.cpp
@@ -0,0 +1,80 @@
+// $Id$
+
+#include "tao/Client_Strategy_Factory.h"
+
+ACE_RCSID(tao, Client_Strategy_Factory, "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Client_Strategy_Factory::~TAO_Client_Strategy_Factory (void)
+{
+}
+
+ACE_Lock *
+TAO_Client_Strategy_Factory::create_profile_lock (void)
+{
+ return 0;
+}
+
+TAO_Configurable_Refcount
+TAO_Client_Strategy_Factory::create_profile_refcount (void)
+{
+ return TAO_Configurable_Refcount (
+ TAO_Configurable_Refcount::TAO_NULL_LOCK);
+}
+
+TAO_Transport_Mux_Strategy *
+TAO_Client_Strategy_Factory::create_transport_mux_strategy (TAO_Transport *)
+{
+ return 0;
+}
+
+ACE_Lock *
+TAO_Client_Strategy_Factory::create_transport_mux_strategy_lock (void)
+{
+ return 0;
+}
+
+int
+TAO_Client_Strategy_Factory::reply_dispatcher_table_size (void) const
+{
+ return 0;
+}
+
+TAO_Wait_Strategy *
+TAO_Client_Strategy_Factory::create_wait_strategy (TAO_Transport *)
+{
+ return 0;
+}
+
+TAO_Client_Strategy_Factory::Connect_Strategy
+TAO_Client_Strategy_Factory::connect_strategy (void) const
+{
+ return TAO_BLOCKED_CONNECT;
+}
+
+TAO_Connect_Strategy *
+TAO_Client_Strategy_Factory::create_connect_strategy (TAO_ORB_Core *)
+{
+ return 0;
+}
+
+int
+TAO_Client_Strategy_Factory::allow_callback (void)
+{
+ return 0;
+}
+
+ACE_Lock *
+TAO_Client_Strategy_Factory::create_ft_service_retention_id_lock (void)
+{
+ return 0;
+}
+
+bool
+TAO_Client_Strategy_Factory::use_cleanup_options (void) const
+{
+ return false;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Client_Strategy_Factory.h b/TAO/tao/Client_Strategy_Factory.h
new file mode 100644
index 00000000000..14eb2370c77
--- /dev/null
+++ b/TAO/tao/Client_Strategy_Factory.h
@@ -0,0 +1,104 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Client_Strategy_Factory.h
+ *
+ * $Id$
+ *
+ * @author Chris Cleeland <cleeland@cs.wustl.edu>
+ */
+//=============================================================================
+
+
+#ifndef TAO_CLIENT_STRATEGY_FACTORY_H
+#define TAO_CLIENT_STRATEGY_FACTORY_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/TAO_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Versioned_Namespace.h"
+#include "tao/Configurable_Refcount.h"
+
+#include "ace/Service_Object.h"
+
+ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+class ACE_Lock;
+ACE_END_VERSIONED_NAMESPACE_DECL
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Transport_Mux_Strategy;
+class TAO_Wait_Strategy;
+class TAO_Transport;
+class TAO_ORB_Core;
+class TAO_Connect_Strategy;
+
+/**
+ * @class TAO_Client_Strategy_Factory
+ *
+ * @brief Abstract factory used by the client to manufacture various
+ * strategies used on the client-side.
+ */
+class TAO_Export TAO_Client_Strategy_Factory : public ACE_Service_Object
+{
+public:
+
+ /// Destructor
+ virtual ~TAO_Client_Strategy_Factory (void);
+
+ /**
+ * Create the lock for the stub and the profile
+ */
+ virtual ACE_Lock* create_profile_lock (void);
+
+ /// Create the refcount for the profile
+ virtual TAO_Configurable_Refcount create_profile_refcount (void);
+
+ /// Create the correct client request muxing strategy.
+ virtual TAO_Transport_Mux_Strategy *create_transport_mux_strategy (TAO_Transport *transport);
+
+ /// Create the correct lock for request muxing strategy.
+ virtual ACE_Lock *create_transport_mux_strategy_lock (void);
+
+ /// Return the size of the reply dispatcher table
+ virtual int reply_dispatcher_table_size (void) const;
+
+ /// Create the correct client <wait_for_reply> strategy.
+ virtual TAO_Wait_Strategy *create_wait_strategy (TAO_Transport *transport);
+
+ /// Create the correct client <asynch_connect> strategy.
+ virtual TAO_Connect_Strategy *create_connect_strategy (TAO_ORB_Core *);
+
+ enum Connect_Strategy
+ {
+ TAO_BLOCKED_CONNECT,
+ TAO_REACTIVE_CONNECT,
+ TAO_LEADER_FOLLOWER_CONNECT
+ };
+ /// Return the selected connection strategy option.
+ virtual Connect_Strategy connect_strategy (void) const;
+
+ /// Does the client allow any form of callback?
+ virtual int allow_callback (void);
+
+ /// Create a lock to be used by the TAO_Fault_Tolerant_Service class
+ /// to generate unique retention ids
+ virtual ACE_Lock *create_ft_service_retention_id_lock (void);
+
+ /// Cleanup options for wait strategy.
+ /**
+ * Only applicable to RW wait strategy
+ */
+ virtual bool use_cleanup_options (void) const;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_CLIENT_STRATEGY_FACTORY_H */
diff --git a/TAO/tao/CodecFactory.mpc b/TAO/tao/CodecFactory.mpc
new file mode 100644
index 00000000000..e19070e2433
--- /dev/null
+++ b/TAO/tao/CodecFactory.mpc
@@ -0,0 +1,44 @@
+//$Id$
+project : taolib, core, core_anytypecode, tao_versioning_idl_defaults {
+ sharedname = TAO_CodecFactory
+ dynamicflags = TAO_CODECFACTORY_BUILD_DLL
+
+ Source_Files {
+ CodecFactory
+ }
+
+ Header_Files {
+ CodecFactory
+ }
+
+ Inline_Files {
+ CodecFactory
+ }
+
+ Template_Files {
+ CodecFactory
+ }
+
+ Resource_Files {
+ CodecFactory
+ }
+
+ PIDL_Files {
+ CodecFactory
+ }
+
+ IDL_Files {
+ idlflags += -Gp -Gd -Ge 1 -Sci -SS -Sorb -Sal \
+ -Wb,export_macro=TAO_CodecFactory_Export \
+ -Wb,export_include=tao/CodecFactory/codecfactory_export.h \
+ -Wb,include_guard=TAO_CODECFACTORY_SAFE_INCLUDE \
+ -Wb,safe_include=tao/CodecFactory/CodecFactory.h \
+ -o CodecFactory
+ idlflags -= -Sa -St
+ CodecFactory/IOP_Codec.pidl
+ }
+
+ Pkgconfig_Files {
+ CodecFactory/TAO_CodecFactory.pc.in
+ }
+}
diff --git a/TAO/tao/CodecFactory/CDR_Encaps_Codec.cpp b/TAO/tao/CodecFactory/CDR_Encaps_Codec.cpp
new file mode 100644
index 00000000000..f9db6518360
--- /dev/null
+++ b/TAO/tao/CodecFactory/CDR_Encaps_Codec.cpp
@@ -0,0 +1,368 @@
+// $Id$
+
+#include "tao/CodecFactory/CDR_Encaps_Codec.h"
+
+#include "tao/CDR.h"
+#include "tao/OctetSeqC.h"
+#include "tao/AnyTypeCode/Any.h"
+#include "tao/AnyTypeCode/Any_Impl.h"
+#include "tao/AnyTypeCode/TypeCode.h"
+#include "tao/AnyTypeCode/Marshal.h"
+#include "tao/AnyTypeCode/Any_Unknown_IDL_Type.h"
+#include "tao/AnyTypeCode/TypeCode_Constants.h"
+#include "tao/SystemException.h"
+#include "tao/ORB_Constants.h"
+#include "tao/Codeset_Translator_Base.h"
+
+#include "ace/Auto_Ptr.h"
+#include "ace/OS_NS_string.h"
+
+
+ACE_RCSID (CodecFactory,
+ CDR_Encaps_Codec,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_CDR_Encaps_Codec::TAO_CDR_Encaps_Codec (
+ CORBA::Octet major,
+ CORBA::Octet minor,
+ TAO_ORB_Core * orb_core,
+ TAO_Codeset_Translator_Base * char_trans,
+ TAO_Codeset_Translator_Base * wchar_trans)
+ : major_ (major),
+ minor_ (minor),
+ orb_core_ (orb_core),
+ char_translator_ (char_trans),
+ wchar_translator_ (wchar_trans)
+{
+}
+
+TAO_CDR_Encaps_Codec::~TAO_CDR_Encaps_Codec (void)
+{
+}
+
+CORBA::OctetSeq *
+TAO_CDR_Encaps_Codec::encode (const CORBA::Any & data
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ IOP::Codec::InvalidTypeForEncoding))
+{
+ this->check_type_for_encoding (data
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ // ----------------------------------------------------------------
+
+ TAO_OutputCDR cdr ((size_t) 0, // size
+ (int) TAO_ENCAP_BYTE_ORDER,
+ (ACE_Allocator *) 0, // buffer_allocator
+ (ACE_Allocator *) 0, // data_block_allocator
+ (ACE_Allocator *) 0, // message_block_allocator
+ 0, // memcpy_tradeoff
+ this->major_,
+ this->minor_);
+
+ if (this->char_translator_)
+ {
+ this->char_translator_->assign (&cdr);
+ }
+ if (this->wchar_translator_)
+ {
+ this->wchar_translator_->assign (&cdr);
+ }
+
+ if ((cdr << TAO_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER))
+ && (cdr << data))
+ {
+ CORBA::OctetSeq * octet_seq = 0;
+
+ ACE_NEW_THROW_EX (octet_seq,
+ CORBA::OctetSeq,
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ 0,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (0);
+
+ CORBA::OctetSeq_var safe_octet_seq = octet_seq;
+
+ octet_seq->length (static_cast<CORBA::ULong> (cdr.total_length ()));
+ CORBA::Octet *buf = octet_seq->get_buffer ();
+
+ for (const ACE_Message_Block *i = cdr.begin ();
+ i != 0;
+ i = i->cont ())
+ {
+ size_t const len = i->length ();
+ ACE_OS::memcpy (buf, i->rd_ptr (), len);
+ buf += len;
+ }
+
+ return safe_octet_seq._retn ();
+ }
+
+ ACE_THROW_RETURN (CORBA::MARSHAL (), 0);
+}
+
+CORBA::Any *
+TAO_CDR_Encaps_Codec::decode (const CORBA::OctetSeq & data
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ IOP::Codec::FormatMismatch))
+{
+ // @todo How do we check for a format mismatch so that we can throw
+ // a IOP::Codec::FormatMismatch exception?
+ // @todo Is this the best way to extract the Any from the OctetSeq?
+
+ // Notice that we need to extract the TypeCode and the value from
+ // the octet sequence, and place them into the Any. We can't just
+ // insert the octet sequence into the Any.
+
+ ACE_Message_Block mb (data.length () + 2 * ACE_CDR::MAX_ALIGNMENT);
+ ACE_CDR::mb_align (&mb);
+
+ ACE_OS::memcpy (mb.rd_ptr (), data.get_buffer (), data.length ());
+
+ size_t rd_pos = mb.rd_ptr () - mb.base ();
+ size_t wr_pos = mb.wr_ptr () - mb.base () + data.length ();
+
+ TAO_InputCDR cdr (mb.data_block (),
+ ACE_Message_Block::DONT_DELETE,
+ rd_pos,
+ wr_pos,
+ ACE_CDR_BYTE_ORDER,
+ this->major_,
+ this->minor_,
+ this->orb_core_);
+
+ if (this->char_translator_)
+ {
+ this->char_translator_->assign (&cdr);
+ }
+ if (this->wchar_translator_)
+ {
+ this->wchar_translator_->assign (&cdr);
+ }
+
+ CORBA::Boolean byte_order;
+ if (cdr >> TAO_InputCDR::to_boolean (byte_order))
+ {
+ cdr.reset_byte_order (static_cast<int> (byte_order));
+
+ CORBA::Any * any = 0;
+ ACE_NEW_THROW_EX (any,
+ CORBA::Any,
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ 0,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (0);
+
+ CORBA::Any_var safe_any = any;
+
+ if (cdr >> (*any))
+ return safe_any._retn ();
+ }
+
+ ACE_THROW_RETURN (IOP::Codec::FormatMismatch (),
+ 0);
+}
+
+CORBA::OctetSeq *
+TAO_CDR_Encaps_Codec::encode_value (const CORBA::Any & data
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ IOP::Codec::InvalidTypeForEncoding))
+{
+ this->check_type_for_encoding (data
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ // ----------------------------------------------------------------
+ TAO_OutputCDR cdr ((size_t) 0, // size
+ (int) TAO_ENCAP_BYTE_ORDER,
+ (ACE_Allocator *) 0, // buffer_allocator
+ (ACE_Allocator *) 0, // data_block_allocator
+ (ACE_Allocator *) 0, // message_block_allocator
+ 0, // memcpy_tradeoff
+ this->major_,
+ this->minor_);
+
+ if (this->char_translator_)
+ {
+ this->char_translator_->assign (&cdr);
+ }
+ if (this->wchar_translator_)
+ {
+ this->wchar_translator_->assign (&cdr);
+ }
+
+ if ((cdr << TAO_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER)))
+ {
+ TAO::Any_Impl *impl = data.impl ();
+
+ if (impl->encoded ())
+ {
+ TAO::Unknown_IDL_Type *unk =
+ dynamic_cast<TAO::Unknown_IDL_Type *> (impl);
+
+ // We don't want unk's rd_ptr to move, in case we are shared by
+ // another Any, so we use this to copy the state, not the buffer.
+ TAO_InputCDR for_reading (unk->_tao_get_cdr ());
+
+ TAO_Marshal_Object::perform_append (data._tao_get_typecode (),
+ &for_reading,
+ &cdr
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+ }
+ else
+ {
+ impl->marshal_value (cdr);
+ }
+
+ // TAO extension: replace the contents of the octet sequence with
+ // the CDR stream.
+ CORBA::OctetSeq * octet_seq = 0;
+
+ ACE_NEW_THROW_EX (octet_seq,
+ CORBA::OctetSeq,
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ 0,
+ ENOMEM
+ ),
+ CORBA::COMPLETED_NO
+ ));
+ ACE_CHECK_RETURN (0);
+
+ CORBA::OctetSeq_var safe_octet_seq = octet_seq;
+
+ octet_seq->length (static_cast<CORBA::ULong> (cdr.total_length ()));
+ CORBA::Octet *buf = octet_seq->get_buffer ();
+
+ for (const ACE_Message_Block *i = cdr.begin ();
+ i != 0;
+ i = i->cont ())
+ {
+ size_t len = i->length ();
+ ACE_OS::memcpy (buf,
+ i->rd_ptr (),
+ len);
+ buf += len;
+ }
+
+ return safe_octet_seq._retn ();
+ }
+
+ ACE_THROW_RETURN (CORBA::MARSHAL (),
+ 0);
+}
+
+CORBA::Any *
+TAO_CDR_Encaps_Codec::decode_value (const CORBA::OctetSeq & data,
+ CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ IOP::Codec::FormatMismatch,
+ IOP::Codec::TypeMismatch))
+{
+ // The ACE_CDR::mb_align() call can shift the rd_ptr by up
+ // to ACE_CDR::MAX_ALIGNMENT-1 bytes. Similarly, the offset
+ // adjustment can move the rd_ptr by up to the same amount.
+ // We accommodate this by including
+ // 2 * ACE_CDR::MAX_ALIGNMENT bytes of additional space in
+ // the message block.
+ ACE_Message_Block mb (data.length () + 2 * ACE_CDR::MAX_ALIGNMENT);
+ ACE_CDR::mb_align (&mb);
+
+ ACE_OS::memcpy (mb.rd_ptr (),
+ data.get_buffer (),
+ data.length ());
+
+ // @todo How do we check for a type mismatch so that we can
+ // throw a IOP::Codec::TypeMismatch exception?
+ // @@ I added a check below. See the comment. I'm not sure
+ // if it is a valid check.
+ // -Ossama
+
+ // @todo Most of this code was copied from
+ // operator>> (TAO_InputCDR &cdr, CORBA::Any &x)
+ // in Any.cpp. Rather than copy the code, the code should be
+ // refactored to make it possible to use the given TypeCode
+ // rather than attempt to extract it from the CDR
+ // encapsulation.
+
+ size_t rd_pos = mb.rd_ptr () - mb.base ();
+ size_t wr_pos = mb.wr_ptr () - mb.base () + data.length ();
+
+ TAO_InputCDR cdr (mb.data_block (),
+ ACE_Message_Block::DONT_DELETE,
+ rd_pos,
+ wr_pos,
+ ACE_CDR_BYTE_ORDER,
+ this->major_,
+ this->minor_,
+ this->orb_core_);
+
+ if (this->char_translator_)
+ {
+ this->char_translator_->assign (&cdr);
+ }
+ if (this->wchar_translator_)
+ {
+ this->wchar_translator_->assign (&cdr);
+ }
+
+ CORBA::Boolean byte_order;
+
+ if (cdr >> TAO_InputCDR::to_boolean (byte_order))
+ {
+ cdr.reset_byte_order (static_cast<int> (byte_order));
+
+ CORBA::Any * any = 0;
+ ACE_NEW_THROW_EX (any,
+ CORBA::Any,
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ 0,
+ ENOMEM
+ ),
+ CORBA::COMPLETED_NO
+ ));
+ ACE_CHECK_RETURN (0);
+
+ CORBA::Any_var safe_any = any;
+
+ // Stick it into the Any.
+ TAO::Unknown_IDL_Type *unk = 0;
+ ACE_NEW_RETURN (unk,
+ TAO::Unknown_IDL_Type (tc, cdr),
+ 0);
+ any->replace (unk);
+ return safe_any._retn ();
+ }
+
+ ACE_THROW_RETURN (IOP::Codec::FormatMismatch (),
+ 0);
+}
+
+void
+TAO_CDR_Encaps_Codec::check_type_for_encoding (
+ const CORBA::Any & data
+ ACE_ENV_ARG_DECL
+ )
+{
+ // @@ TODO: Are there any other conditions we need to check?
+
+ CORBA::TypeCode_var typecode = data.type ();
+ if (this->major_ == 1
+ && this->minor_ == 0
+ && typecode->equivalent (CORBA::_tc_wstring ACE_ENV_ARG_PARAMETER))
+ ACE_THROW (IOP::Codec::InvalidTypeForEncoding ());
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/CodecFactory/CDR_Encaps_Codec.h b/TAO/tao/CodecFactory/CDR_Encaps_Codec.h
new file mode 100644
index 00000000000..37672c1e4de
--- /dev/null
+++ b/TAO/tao/CodecFactory/CDR_Encaps_Codec.h
@@ -0,0 +1,138 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file CDR_Encaps_Codec.h
+ *
+ * $Id$
+ *
+ * @author Ossama Othman <ossama@uci.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_CDR_ENCAPS_CODEC_H
+#define TAO_CDR_ENCAPS_CODEC_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/CodecFactory/IOP_Codec_includeC.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/LocalObject.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Codeset_Translator_Base;
+
+/**
+ * @class TAO_CDR_Encaps_Codec
+ *
+ * @brief Implementation of a CDR encapsulation coder/decoder
+ * (Codec).
+ *
+ * This coder/decoder (Codec) class encodes and decodes data to and
+ * from a CDR encapsulation, respectively. It is useful for creation
+ * of octet sequences that contain CDR encapsulations. Those octet
+ * sequences can then be placed in a IOP::ServiceContext or an
+ * IOP::TaggedComponent, for example.
+ *
+ * @note This Codec should not be used for operations internal to the
+ * ORB core since it uses interpretive marshaling rather than compiled
+ * marshaling.
+ */
+class TAO_CDR_Encaps_Codec
+ : public virtual IOP::Codec,
+ public virtual TAO_Local_RefCounted_Object
+{
+public:
+
+ /// Constructor.
+ TAO_CDR_Encaps_Codec (CORBA::Octet major,
+ CORBA::Octet minor,
+ TAO_ORB_Core * orb_core,
+ TAO_Codeset_Translator_Base * char_trans,
+ TAO_Codeset_Translator_Base * wchar_trans);
+
+ /// Encode the given data, including the TypeCode, into an octet
+ /// sequence.
+ virtual CORBA::OctetSeq * encode (const CORBA::Any & data
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ IOP::Codec::InvalidTypeForEncoding));
+
+ /// Extract the TypeCode and the value from the octet sequence and
+ /// place them into an Any.
+ virtual CORBA::Any * decode (const CORBA::OctetSeq & data
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ IOP::Codec::FormatMismatch));
+
+ /// Encode the given data, excluding the TypeCode, into an octet
+ /// sequence.
+ virtual CORBA::OctetSeq * encode_value (const CORBA::Any & data
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ IOP::Codec::InvalidTypeForEncoding));
+
+ /// Extract the value from the octet sequence, based on the given
+ /// TypeCode, and place it into an Any.
+ virtual CORBA::Any * decode_value (const CORBA::OctetSeq & data,
+ CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ IOP::Codec::FormatMismatch,
+ IOP::Codec::TypeMismatch));
+
+protected:
+
+ /// Destructor.
+ /**
+ * Only allow this class to be instantiated on the heap since it is
+ * reference counted.
+ */
+ virtual ~TAO_CDR_Encaps_Codec (void);
+
+ /// Verify that it is possible to encode the given data using this
+ /// Codec.
+ /**
+ * Typical reasons for failure include attempting to encode a type
+ * that isn't supported for the version of GIOP associated with this
+ * Codec.
+ */
+ void check_type_for_encoding (const CORBA::Any & data
+ ACE_ENV_ARG_DECL);
+
+private:
+
+ /// Prevent copying through the copy constructor and the assignment
+ /// operator.
+ TAO_CDR_Encaps_Codec (const TAO_CDR_Encaps_Codec &);
+ void operator= (const TAO_CDR_Encaps_Codec &);
+
+private:
+
+ /// The major GIOP version associated with this Codec.
+ CORBA::Octet const major_;
+
+ /// The minor GIOP version associated with this Codec.
+ CORBA::Octet const minor_;
+
+ /// The ORB Core to be used when decoding values from a CDR
+ /// encapsulation.
+ TAO_ORB_Core * const orb_core_;
+
+ /// Char codeset translator
+ TAO_Codeset_Translator_Base * char_translator_;
+
+ /// WChar codeset translator
+ TAO_Codeset_Translator_Base * wchar_translator_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_CDR_ENCAPS_CODEC_H */
diff --git a/TAO/tao/CodecFactory/CodecFactory.cpp b/TAO/tao/CodecFactory/CodecFactory.cpp
new file mode 100644
index 00000000000..f532539a4fd
--- /dev/null
+++ b/TAO/tao/CodecFactory/CodecFactory.cpp
@@ -0,0 +1,52 @@
+// =================================================================
+/**
+ * @file CodecFactory.cpp
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+// =================================================================
+
+#include "tao/CodecFactory/CodecFactory.h"
+#include "tao/CodecFactory/CodecFactory_impl.h"
+
+#include "tao/ORB.h"
+#include "tao/debug.h"
+
+ACE_RCSID (CodecFactory,
+ CodecFactory,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+CORBA::Object_ptr
+TAO_CodecFactory_Loader::create_object (
+ CORBA::ORB_ptr orb,
+ int,
+ ACE_TCHAR *[]
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ CORBA::Object_ptr obj = CORBA::Object::_nil ();
+ ACE_NEW_RETURN (obj,
+ TAO_CodecFactory (orb->orb_core ()),
+ CORBA::Object::_nil ());
+ return obj;
+}
+
+int
+TAO_CodecFactory_Loader::Initializer (void)
+{
+ return ACE_Service_Config::process_directive (ace_svc_desc_TAO_CodecFactory_Loader);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DEFINE (TAO_CodecFactory_Loader,
+ ACE_TEXT ("CodecFactory_Loader"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (TAO_CodecFactory_Loader),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0)
+ACE_FACTORY_DEFINE (TAO_CodecFactory, TAO_CodecFactory_Loader)
diff --git a/TAO/tao/CodecFactory/CodecFactory.h b/TAO/tao/CodecFactory/CodecFactory.h
new file mode 100644
index 00000000000..230914bbbac
--- /dev/null
+++ b/TAO/tao/CodecFactory/CodecFactory.h
@@ -0,0 +1,59 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file CodecFactory.h
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan <coryan@uci.edu>
+ */
+//=============================================================================
+
+
+#ifndef TAO_CODECFACTORY_H
+#define TAO_CODECFACTORY_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/CodecFactory/codecfactory_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#define TAO_CODECFACTORY_SAFE_INCLUDE
+#include "tao/CodecFactory/IOP_CodecC.h"
+#undef TAO_CODECFACTORY_SAFE_INCLUDE
+
+#include "tao/Object_Loader.h"
+#include "ace/Service_Config.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_CodecFactory_Export TAO_CodecFactory_Loader
+ : public TAO_Object_Loader
+{
+public:
+ /// Creates a Codec factory and returns it.
+ virtual CORBA::Object_ptr create_object (CORBA::ORB_ptr orb,
+ int argc,
+ ACE_TCHAR *argv []
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Used to force the initialization of the ORB code.
+ static int Initializer (void);
+};
+
+static int
+TAO_Requires_CodecFactory_Initializer = TAO_CodecFactory_Loader::Initializer ();
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE (TAO_CodecFactory_Loader)
+ACE_FACTORY_DECLARE (TAO_CodecFactory, TAO_CodecFactory_Loader)
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_CODECFACTORY_H */
diff --git a/TAO/tao/CodecFactory/CodecFactory_impl.cpp b/TAO/tao/CodecFactory/CodecFactory_impl.cpp
new file mode 100644
index 00000000000..2b1462c9693
--- /dev/null
+++ b/TAO/tao/CodecFactory/CodecFactory_impl.cpp
@@ -0,0 +1,151 @@
+// -*- C++ -*-
+//
+// $Id$
+
+#include "tao/CodecFactory/CodecFactory_impl.h"
+#include "tao/CodecFactory/CDR_Encaps_Codec.h"
+#include "tao/SystemException.h"
+#include "tao/ORB_Constants.h"
+#include "tao/ORB_Core.h"
+#include "tao/Codeset_Manager.h"
+#include "ace/Codeset_Symbols.h"
+
+ACE_RCSID (CodecFactory_impl,
+ CodecFactory,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_CodecFactory::TAO_CodecFactory (TAO_ORB_Core * orb_core)
+ : orb_core_ (orb_core)
+{
+}
+
+IOP::Codec_ptr
+TAO_CodecFactory::create_codec_with_codesets (const IOP::Encoding_1_2 & enc
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ IOP::CodecFactory::UnknownEncoding,
+ IOP::CodecFactory::UnsupportedCodeset))
+{
+ TAO_Codeset_Translator_Base *char_trans = 0;
+ TAO_Codeset_Translator_Base *wchar_trans = 0;
+ CONV_FRAME::CodeSetId ncsc;
+ CONV_FRAME::CodeSetId ncsw;
+
+ TAO_Codeset_Manager *csm = this->orb_core_->codeset_manager ();
+
+ if (csm)
+ {
+ char_trans = csm->get_char_trans (enc.char_codeset);
+ wchar_trans = csm->get_wchar_trans (enc.wchar_codeset);
+ csm->get_ncs (ncsc,ncsw); // pass by reference
+ }
+ else
+ {
+ // No codeset manager, so also raise an unsupported codeset
+ ACE_THROW_RETURN (IOP::CodecFactory::UnsupportedCodeset (
+ enc.wchar_codeset),
+ IOP::Codec::_nil ());
+ }
+
+ if (wchar_trans == 0 &&
+ enc.wchar_codeset != ACE_CODESET_ID_ISO_UTF_16 &&
+ enc.wchar_codeset != ncsw)
+ {
+ ACE_THROW_RETURN (IOP::CodecFactory::UnsupportedCodeset (
+ enc.wchar_codeset),
+ IOP::Codec::_nil ());
+ }
+
+ if (char_trans == 0 &&
+ enc.char_codeset != ncsc)
+ {
+ ACE_THROW_RETURN (IOP::CodecFactory::UnsupportedCodeset (
+ enc.char_codeset),
+ IOP::Codec::_nil ());
+ }
+
+ return this->create_codec_i (enc.major_version,
+ enc.minor_version,
+ enc.format,
+ char_trans,
+ wchar_trans
+ ACE_ENV_ARG_PARAMETER);
+}
+
+IOP::Codec_ptr
+TAO_CodecFactory::create_codec (const IOP::Encoding & enc
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ IOP::CodecFactory::UnknownEncoding))
+{
+ return this->create_codec_i (enc.major_version,
+ enc.minor_version,
+ enc.format,
+ 0,
+ 0
+ ACE_ENV_ARG_PARAMETER);
+}
+
+IOP::Codec_ptr
+TAO_CodecFactory::create_codec_i (CORBA::Octet major,
+ CORBA::Octet minor,
+ IOP::EncodingFormat encoding_format,
+ TAO_Codeset_Translator_Base * char_trans,
+ TAO_Codeset_Translator_Base * wchar_trans
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ IOP::CodecFactory::UnknownEncoding))
+{
+ // @todo: Ideally we should have some sort of CodecFactory
+ // registry to make it possible to add factories
+ // dynamically. However, there currently isn't a need to
+ // support anything other than CDR encapsulations yet so we
+ // hardcode its Codec. This may change once TAO starts to
+ // support messaging formats other than GIOP.
+
+ IOP::Codec_ptr codec = IOP::Codec::_nil ();
+
+ switch (encoding_format)
+ {
+
+ // @@ MSVC 6 gets confused and thinks that
+ // IOP::ENCODING_CDR_ENCAPS is not a constant, so its actual
+ // value (0) is used instead.
+ case 0 /* IOP::ENCODING_CDR_ENCAPS */:
+ if (major < 1)
+ {
+ // There is no such thing as a "0.x" CDR encapsulation.
+ ACE_THROW_RETURN (CORBA::BAD_PARAM (
+ CORBA::SystemException::_tao_minor_code (
+ 0,
+ EINVAL),
+ CORBA::COMPLETED_NO),
+ IOP::Codec::_nil ());
+ }
+
+ ACE_NEW_THROW_EX (codec,
+ TAO_CDR_Encaps_Codec (major,
+ minor,
+ this->orb_core_,
+ char_trans,
+ wchar_trans),
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ 0,
+ ENOMEM),
+ CORBA::COMPLETED_MAYBE));
+ ACE_CHECK_RETURN (IOP::Codec::_nil ());
+ break;
+
+ default:
+ ACE_THROW_RETURN (IOP::CodecFactory::UnknownEncoding (),
+ IOP::Codec::_nil ());
+
+ }
+
+ return codec;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/CodecFactory/CodecFactory_impl.h b/TAO/tao/CodecFactory/CodecFactory_impl.h
new file mode 100644
index 00000000000..ba0859f667b
--- /dev/null
+++ b/TAO/tao/CodecFactory/CodecFactory_impl.h
@@ -0,0 +1,100 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file CodecFactory_impl.h
+ *
+ * $Id$
+ *
+ * @author Ossama Othman <ossama@uci.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_CODEC_FACTORY_IMPL_H
+#define TAO_CODEC_FACTORY_IMPL_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/CodecFactory/IOP_Codec_includeC.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/LocalObject.h"
+
+// This is to remove "inherits via dominance" warnings from MSVC.
+// MSVC is being a little too paranoid.
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Codeset_Translator_Base;
+
+/**
+ * @class TAO_CodecFactory
+ *
+ * @brief Implementation of the IOP::CodecFactory interface.
+ *
+ * This class can be used to create Codec (coder/decoder) of a given
+ * type, such as a CDR encapsulation Codec.
+ */
+class TAO_CodecFactory
+ : public virtual IOP::CodecFactory,
+ public virtual TAO_Local_RefCounted_Object
+{
+public:
+
+ /// Constructor
+ TAO_CodecFactory (TAO_ORB_Core * orb_core);
+
+ /// Create a Coder/Decoder for the given type of encoding.
+ virtual IOP::Codec_ptr create_codec (const IOP::Encoding & enc
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ IOP::CodecFactory::UnknownEncoding));
+
+ /// Create a Coder/Decoder for the given type of encoding and codesets.
+ virtual IOP::Codec_ptr create_codec_with_codesets (const IOP::Encoding_1_2 & enc
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ IOP::CodecFactory::UnknownEncoding,
+ IOP::CodecFactory::UnsupportedCodeset));
+
+private:
+ /// Prevent copying through the copy constructor and the assignment
+ /// operator.
+ TAO_CodecFactory (const TAO_CodecFactory &);
+ void operator= (const TAO_CodecFactory &);
+
+ IOP::Codec_ptr create_codec_i (CORBA::Octet major,
+ CORBA::Octet minor,
+ IOP::EncodingFormat encoding_format,
+ TAO_Codeset_Translator_Base * char_trans,
+ TAO_Codeset_Translator_Base * wchar_trans
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ IOP::CodecFactory::UnknownEncoding));
+private:
+
+ /// Pointer to the ORB Core.
+ /**
+ * Some Codec implementations may need access to the ORB Core with
+ * which they are associated.
+ */
+ TAO_ORB_Core * const orb_core_;
+
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_CODEC_FACTORY_IMPL_H */
diff --git a/TAO/tao/CodecFactory/IOP_Codec.pidl b/TAO/tao/CodecFactory/IOP_Codec.pidl
new file mode 100644
index 00000000000..ef3dd5a8dac
--- /dev/null
+++ b/TAO/tao/CodecFactory/IOP_Codec.pidl
@@ -0,0 +1,78 @@
+// -*- IDL -*-
+
+/**
+ * @file IOP_Codec.pidl
+ *
+ * $Id$
+ *
+ * @brief Pre-compiled IDL source for the IOP module.
+ *
+ * This file is used to generate IOPC.{h,cpp}, using the following
+ * command:
+ *
+ * tao_idl.exe
+ * -o orig -Gp -Gd -Ge 1 -SS -Sci
+ * -Wb,export_macro=TAO_Export
+ * -Wb,export_include=tao/TAO_Export.h
+ * -Wb,pre_include="ace/pre.h"
+ * -Wb,post_include="ace/post.h"
+ * -Wb,versioning_begin=TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+ * -Wb,versioning_end=TAO_END_VERSIONED_NAMESPACE_DECL
+ * IOP_Codec.pidl
+ *
+ */
+
+#ifndef TAO_IOP_CODEC_PIDL
+#define TAO_IOP_CODEC_PIDL
+
+#include "tao/Typecode_types.pidl"
+#include "tao/OctetSeq.pidl"
+#include "tao/CONV_FRAME.pidl"
+
+#pragma prefix "omg.org"
+
+module IOP
+{
+ local interface Codec {
+ exception InvalidTypeForEncoding {};
+ exception FormatMismatch {};
+ exception TypeMismatch {};
+
+ CORBA::OctetSeq encode (in any data) raises (InvalidTypeForEncoding);
+ any decode (in CORBA::OctetSeq data) raises (FormatMismatch);
+ CORBA::OctetSeq encode_value (in any data) raises (InvalidTypeForEncoding);
+ any decode_value (in CORBA::OctetSeq data, in CORBA::TypeCode tc)
+ raises (FormatMismatch, TypeMismatch);
+ };
+
+ typedef short EncodingFormat;
+ const EncodingFormat ENCODING_CDR_ENCAPS = 0;
+
+ struct Encoding {
+ EncodingFormat format;
+ octet major_version;
+ octet minor_version;
+ };
+
+ struct Encoding_1_2 {
+ EncodingFormat format;
+ octet major_version;
+ octet minor_version;
+ CONV_FRAME::CodeSetId char_codeset;
+ CONV_FRAME::CodeSetId wchar_codeset;
+ };
+
+ local interface CodecFactory {
+ exception UnknownEncoding {};
+ exception UnsupportedCodeset {
+ CONV_FRAME::CodeSetId codeset;
+ };
+
+ Codec create_codec (in Encoding enc) raises (UnknownEncoding);
+ Codec create_codec_with_codesets (in Encoding_1_2 enc) raises (UnknownEncoding, UnsupportedCodeset);
+ };
+};
+
+#pragma prefix ""
+
+#endif /* TAO_IOP_CODEC_PIDL */
diff --git a/TAO/tao/CodecFactory/IOP_CodecA.h b/TAO/tao/CodecFactory/IOP_CodecA.h
new file mode 100644
index 00000000000..e543e41332e
--- /dev/null
+++ b/TAO/tao/CodecFactory/IOP_CodecA.h
@@ -0,0 +1,3 @@
+// $Id$
+// This file deliberately empty. See bugzilla #2549.
+
diff --git a/TAO/tao/CodecFactory/IOP_Codec_include.pidl b/TAO/tao/CodecFactory/IOP_Codec_include.pidl
new file mode 100644
index 00000000000..c98f6883e65
--- /dev/null
+++ b/TAO/tao/CodecFactory/IOP_Codec_include.pidl
@@ -0,0 +1,44 @@
+// -*- IDL -*-
+
+/**
+ * @file IOP_Codec_include.pidl
+ *
+ * $Id$
+ *
+ * @brief Include file for use in applications that need IOP_Codec.pidl.
+ *
+ * This file just includes IOP_Codec.pidl. The *C.h file generated from
+ * this is hand-crafted to itself include CodecFactory.h instead of
+ * IOP_CodecC.h (which will produce a compiler error message if
+ * included directly). The IOP_Codec_includeC.h file can then be
+ * included directly and automatically by the IDL compiler when
+ * building the application.
+ *
+ * 1. Run the tao_idl compiler on the pidl file. The command used for
+ * this is:
+ *
+ * tao_idl -o orig -St -Sp -Sci -SS
+ * -Wb,export_macro=TAO_CodecFactory_Export \
+ * -Wb,export_include="tao/CodecFactory/codecfactory_export.h" \
+ * -Wb,pre_include="ace/pre.h"
+ * -Wb,post_include="ace/post.h"
+ * -Wb,versioning_begin=TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+ * -Wb,versioning_end=TAO_END_VERSIONED_NAMESPACE_DECL
+ * IOP_Codec_include.pidl
+ *
+ * 2. Then change this line in IOP_Codec_includeC.h:
+ *
+ * #include "IOP_CodecC.h"
+ *
+ * to
+ *
+ * #include "CodecFactory.h"
+ */
+
+#ifndef _IOP_CODEC_INCLUDE_IDL_
+#define _IOP_CODEC_INCLUDE_IDL_
+
+///FUZZ: disable check_for_include/
+#include "tao/CodecFactory/IOP_Codec.pidl"
+
+#endif /* _IOP_CODEC_INCLUDE_IDL_ */
diff --git a/TAO/tao/CodecFactory/IOP_Codec_includeA.h b/TAO/tao/CodecFactory/IOP_Codec_includeA.h
new file mode 100644
index 00000000000..77742d1e1be
--- /dev/null
+++ b/TAO/tao/CodecFactory/IOP_Codec_includeA.h
@@ -0,0 +1,44 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:390
+
+#ifndef _TAO_IDL_ORIG_IOPCODEC_INCLUDEA_H_
+#define _TAO_IDL_ORIG_IOPCODEC_INCLUDEA_H_
+
+#include /**/ "ace/pre.h"
+
+#include "tao/CodecFactory/IOP_Codec_includeC.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include /**/ "ace/post.h"
+#endif /* ifndef */
+
diff --git a/TAO/tao/CodecFactory/IOP_Codec_includeC.h b/TAO/tao/CodecFactory/IOP_Codec_includeC.h
new file mode 100644
index 00000000000..dae38bfa7b4
--- /dev/null
+++ b/TAO/tao/CodecFactory/IOP_Codec_includeC.h
@@ -0,0 +1,72 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:154
+
+#ifndef _TAO_IDL_ORIG_IOP_CODEC_INCLUDEC_H_
+#define _TAO_IDL_ORIG_IOP_CODEC_INCLUDEC_H_
+
+#include /**/ "ace/pre.h"
+
+
+#include "ace/config-all.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/CodecFactory/codecfactory_export.h"
+#include "tao/CodecFactory/CodecFactory.h"
+#include "tao/ORB.h"
+#include "tao/Environment.h"
+
+#if defined (TAO_EXPORT_MACRO)
+#undef TAO_EXPORT_MACRO
+#endif
+#define TAO_EXPORT_MACRO TAO_CodecFactory_Export
+
+// TAO_IDL - Generated from
+// be\be_visitor_traits.cpp:61
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Traits specializations.
+namespace TAO
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:1040
+
+#include /**/ "ace/post.h"
+
+#endif /* ifndef */
+
+
diff --git a/TAO/tao/CodecFactory/IOP_Codec_includeS.h b/TAO/tao/CodecFactory/IOP_Codec_includeS.h
new file mode 100644
index 00000000000..17b1360599e
--- /dev/null
+++ b/TAO/tao/CodecFactory/IOP_Codec_includeS.h
@@ -0,0 +1,28 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// Skeleton file generation suppressed with command line option -SS
diff --git a/TAO/tao/CodecFactory/TAO_CodecFactory.pc.in b/TAO/tao/CodecFactory/TAO_CodecFactory.pc.in
new file mode 100644
index 00000000000..da619f43d8f
--- /dev/null
+++ b/TAO/tao/CodecFactory/TAO_CodecFactory.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: TAO_CodecFactory
+Description: TAO CodecFactory Library
+Requires: TAO_AnyTypeCode, TAO
+Version: @VERSION@
+Libs: -L${libdir} -lTAO_CodecFactory
+Cflags: -I${includedir}
diff --git a/TAO/tao/CodecFactory/TAO_CodecFactory.rc b/TAO/tao/CodecFactory/TAO_CodecFactory.rc
new file mode 100644
index 00000000000..a234c757563
--- /dev/null
+++ b/TAO/tao/CodecFactory/TAO_CodecFactory.rc
@@ -0,0 +1,30 @@
+#include "..\Version.h"
+
+1 VERSIONINFO
+ FILEVERSION TAO_MAJOR_VERSION,TAO_MINOR_VERSION,TAO_BETA_VERSION,0
+ PRODUCTVERSION TAO_MAJOR_VERSION,TAO_MINOR_VERSION,TAO_BETA_VERSION,0
+ FILEFLAGSMASK 0x3fL
+ FILEFLAGS 0x0L
+ FILEOS 0x4L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904B0"
+ BEGIN
+ VALUE "FileDescription", "CodecFactory\0"
+ VALUE "FileVersion", TAO_VERSION "\0"
+ VALUE "InternalName", "TAO_CodecFactoryDLL\0"
+ VALUE "LegalCopyright", "\0"
+ VALUE "LegalTrademarks", "\0"
+ VALUE "OriginalFilename", "TAO_CodecFactory.DLL\0"
+ VALUE "ProductName", "TAO\0"
+ VALUE "ProductVersion", TAO_VERSION "\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
diff --git a/TAO/tao/CodecFactory/codecfactory_export.h b/TAO/tao/CodecFactory/codecfactory_export.h
new file mode 100644
index 00000000000..7c93ff47968
--- /dev/null
+++ b/TAO/tao/CodecFactory/codecfactory_export.h
@@ -0,0 +1,40 @@
+
+// -*- C++ -*-
+// $Id$
+// Definition for Win32 Export directives.
+// This file is generated automatically by generate_export_file.pl
+// ------------------------------
+#ifndef TAO_CODECFACTORY_EXPORT_H
+#define TAO_CODECFACTORY_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if defined (TAO_AS_STATIC_LIBS)
+# if !defined (TAO_CODECFACTORY_HAS_DLL)
+# define TAO_CODECFACTORY_HAS_DLL 0
+# endif /* ! TAO_CODECFACTORY_HAS_DLL */
+#else
+# if !defined (TAO_CODECFACTORY_HAS_DLL)
+# define TAO_CODECFACTORY_HAS_DLL 1
+# endif /* ! TAO_CODECFACTORY_HAS_DLL */
+#endif
+
+#if defined (TAO_CODECFACTORY_HAS_DLL) && (TAO_CODECFACTORY_HAS_DLL == 1)
+# if defined (TAO_CODECFACTORY_BUILD_DLL)
+# define TAO_CodecFactory_Export ACE_Proper_Export_Flag
+# define TAO_CODECFACTORY_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# define TAO_CODECFACTORY_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# else /* TAO_CODECFACTORY_BUILD_DLL */
+# define TAO_CodecFactory_Export ACE_Proper_Import_Flag
+# define TAO_CODECFACTORY_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# define TAO_CODECFACTORY_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# endif /* TAO_CODECFACTORY_BUILD_DLL */
+#else /* TAO_CODECFACTORY_HAS_DLL == 1 */
+# define TAO_CodecFactory_Export
+# define TAO_CODECFACTORY_SINGLETON_DECLARATION(T)
+# define TAO_CODECFACTORY_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+#endif /* TAO_CODECFACTORY_HAS_DLL == 1 */
+
+#endif /* TAO_CODECFACTORY_EXPORT_H */
+
+// End of auto generated file.
diff --git a/TAO/tao/Codeset.mpc b/TAO/tao/Codeset.mpc
new file mode 100644
index 00000000000..67405531582
--- /dev/null
+++ b/TAO/tao/Codeset.mpc
@@ -0,0 +1,33 @@
+//$Id$
+
+project : taolib, core, tao_versioning_idl_defaults {
+ sharedname = TAO_Codeset
+ dynamicflags = TAO_CODESET_BUILD_DLL
+ pch_header =
+ pch_source =
+
+ Source_Files {
+ Codeset
+ }
+
+ Header_Files {
+ Codeset
+ }
+
+ Inline_Files {
+ Codeset
+ }
+
+ Template_Files {
+ Codeset
+ }
+
+ Resource_Files {
+ }
+
+ PIDL_Files {
+ }
+
+ IDL_Files {
+ }
+}
diff --git a/TAO/tao/Codeset/Codeset.cpp b/TAO/tao/Codeset/Codeset.cpp
new file mode 100644
index 00000000000..c946ad4c3b5
--- /dev/null
+++ b/TAO/tao/Codeset/Codeset.cpp
@@ -0,0 +1,48 @@
+// -*- C++ -*-
+
+// =================================================================
+/**
+ * @file Codeset.cpp
+ *
+ * $Id$
+ *
+ * @author Phil Mesnier <mesnier_p@ociweb.com>
+ */
+// =================================================================
+
+#include "tao/Codeset/Codeset.h"
+#include "tao/Codeset/Codeset_Manager_Factory.h"
+#include "tao/Codeset/UTF8_Latin1_Factory.h"
+#include "tao/Codeset/UTF16_BOM_Factory.h"
+
+#include "ace/Dynamic_Service.h"
+
+
+ACE_RCSID (Codeset, Codeset, "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+int
+TAO_Codeset_Initializer::init (void)
+{
+ int result = 0;
+
+ result += ACE_Service_Config::process_directive
+ (ace_svc_desc_TAO_UTF8_Latin1_Factory);
+
+ result += ACE_Service_Config::process_directive
+ (ace_svc_desc_TAO_UTF16_BOM_Factory);
+
+ TAO_Codeset_Manager_Factory *cmf = ACE_Dynamic_Service<TAO_Codeset_Manager_Factory>::instance("TAO_Codeset");
+
+ if (cmf != 0)
+ {
+ return result;
+ }
+
+ result += ACE_Service_Config::process_directive
+ (ace_svc_desc_TAO_Codeset_Manager_Factory,1); // force replacement
+ return result;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Codeset/Codeset.h b/TAO/tao/Codeset/Codeset.h
new file mode 100644
index 00000000000..73dc459283d
--- /dev/null
+++ b/TAO/tao/Codeset/Codeset.h
@@ -0,0 +1,43 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Codeset.h
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan <coryan@uci.edu>
+ */
+//=============================================================================
+
+
+#ifndef TAO_CODESET_H
+#define TAO_CODESET_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Codeset/codeset_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Versioned_Namespace.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Codeset_Export TAO_Codeset_Initializer
+{
+public:
+ /// Used to force the initialization of the ORB code.
+ static int init (void);
+};
+
+static int
+TAO_Requires_Codeset_Initializer = TAO_Codeset_Initializer::init ();
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_CODESET_H */
diff --git a/TAO/tao/Codeset/Codeset_Descriptor.cpp b/TAO/tao/Codeset/Codeset_Descriptor.cpp
new file mode 100644
index 00000000000..cede07a2aa3
--- /dev/null
+++ b/TAO/tao/Codeset/Codeset_Descriptor.cpp
@@ -0,0 +1,135 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO/tao/Codeset
+//
+// = FILENAME
+// Codeset_Translator_Factory.cpp
+//
+// = DESCRIPTION
+// The base for all the translator factories. Translator factories are
+// responsible for supplying the proper translator on demand.
+//
+// = AUTHORS
+// Phil Mesnier <mesnier_p@ociweb.com>
+//
+// ============================================================================
+
+#include "tao/Codeset/Codeset_Descriptor.h"
+#include "tao/Codeset/Codeset_Translator_Factory.h"
+
+#include "ace/Codeset_Registry.h"
+#include "ace/Log_Msg.h"
+#include "tao/debug.h"
+
+ACE_RCSID (Codeset,
+ Codeset_Manager_i,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Codeset_Descriptor::TAO_Codeset_Descriptor ()
+ :ncs_ (0),
+ max_bytes_ (1),
+ num_translators_ (0),
+ trans_base_(0)
+{
+}
+
+TAO_Codeset_Descriptor::~TAO_Codeset_Descriptor ()
+{
+ Translator_Node *temp = trans_base_;
+ while (temp)
+ {
+ temp = trans_base_->next_;
+ // don't need to delete the associated translator factory, it is
+ // owned by the service registry
+ ACE_OS::free (trans_base_->name_);
+ delete trans_base_;
+ trans_base_ = temp;
+ }
+}
+
+void
+TAO_Codeset_Descriptor::ncs (const ACE_TCHAR *name)
+{
+ ACE_CDR::ULong n = 0;
+ if (ACE_Codeset_Registry::locale_to_registry
+ (ACE_TEXT_ALWAYS_CHAR(name), n) == 0)
+ {
+ char **endPtr = 0;
+ n = static_cast<ACE_CDR::ULong> (
+ ACE_OS::strtoul(ACE_TEXT_ALWAYS_CHAR(name), endPtr, 0));
+ }
+ this->ncs(n);
+}
+
+void
+TAO_Codeset_Descriptor::ncs (ACE_CDR::ULong n)
+{
+ this->ncs_ = n;
+ // Validate the CodesetId
+ this->max_bytes_ = ACE_Codeset_Registry::get_max_bytes(n);
+ if (this->max_bytes_ == 0)
+ {
+ if (TAO_debug_level > 0)
+ ACE_ERROR((LM_ERROR,
+ ACE_TEXT("(%P|%t) TAO_Codeset_Descriptor::ncs, ")
+ ACE_TEXT("unknown codeset id 0x%x\n"),
+ n));
+ this->ncs_ = 0;
+ }
+}
+
+ACE_CDR::ULong
+TAO_Codeset_Descriptor::ncs (void) const
+{
+ return this->ncs_;
+}
+
+int
+TAO_Codeset_Descriptor::num_translators (void) const
+{
+ return this->num_translators_;
+}
+
+int
+TAO_Codeset_Descriptor::max_bytes (void) const
+{
+ return this->max_bytes_;
+}
+
+void
+TAO_Codeset_Descriptor::add_translator (const ACE_TCHAR *name)
+{
+ Translator_Node *temp = trans_base_;
+ if (this->trans_base_ == 0)
+ {
+ ACE_NEW (this->trans_base_, Translator_Node);
+ temp = trans_base_;
+ }
+ else
+ {
+ while (temp->next_ != 0)
+ temp = temp->next_;
+ ACE_NEW (temp->next_, Translator_Node);
+ temp = temp->next_;
+ }
+ if (temp)
+ {
+ this->num_translators_ ++;
+ temp->name_ = ACE_OS::strdup (name);
+ temp->translator_factory_ = 0;
+ temp->next_ = 0;
+ }
+}
+
+TAO_Codeset_Descriptor::Translator_Node *
+TAO_Codeset_Descriptor::translators (void)
+{
+ return this->trans_base_;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Codeset/Codeset_Descriptor.h b/TAO/tao/Codeset/Codeset_Descriptor.h
new file mode 100644
index 00000000000..a0a8b89363c
--- /dev/null
+++ b/TAO/tao/Codeset/Codeset_Descriptor.h
@@ -0,0 +1,65 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Codeset_Descriptor.h
+ *
+ * $Id$
+ *
+ * @author Phil Mesnier
+ */
+//=============================================================================
+
+#ifndef TAO_CODESET_DESCRIPTOR_H
+#define TAO_CODESET_DESCRIPTOR_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Codeset/codeset_export.h"
+#include "ace/CDR_Base.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Codeset_Descriptor_Base.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Codeset_Translator_Factory;
+
+class TAO_Codeset_Export TAO_Codeset_Descriptor
+ : public TAO_Codeset_Descriptor_Base
+{
+public:
+ TAO_Codeset_Descriptor ();
+ virtual ~TAO_Codeset_Descriptor ();
+
+ struct Translator_Node
+ {
+ ACE_TCHAR *name_;
+ TAO_Codeset_Translator_Factory *translator_factory_;
+ Translator_Node *next_;
+ };
+
+ void ncs (ACE_CDR::ULong ncs);
+ void ncs (const ACE_TCHAR *name);
+ ACE_CDR::ULong ncs (void) const;
+ int max_bytes (void) const;
+ int num_translators (void) const;
+
+ void add_translator (const ACE_TCHAR *name);
+ Translator_Node *translators (void);
+
+private:
+ ACE_CDR::ULong ncs_;
+ int max_bytes_;
+ int num_translators_;
+ Translator_Node *trans_base_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_CODESET_DESCRIPTOR_H */
diff --git a/TAO/tao/Codeset/Codeset_Manager_Factory.cpp b/TAO/tao/Codeset/Codeset_Manager_Factory.cpp
new file mode 100644
index 00000000000..7f89626dc47
--- /dev/null
+++ b/TAO/tao/Codeset/Codeset_Manager_Factory.cpp
@@ -0,0 +1,50 @@
+/* -*- C++ -*- */
+
+// =================================================================
+/**
+ * @file Codeset_Manager_Factory.cpp
+ *
+ * $Id$
+ *
+ * @author Phil Mesnier <mesnier_p@ociweb.com>
+ *
+ */
+// =================================================================
+
+#include "tao/Codeset/Codeset_Manager_Factory.h"
+#include "ace/Service_Config.h"
+#include "tao/Codeset/Codeset_Manager_i.h"
+
+ACE_RCSID (Codeset, Codeset_Manager_Factory, "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Codeset_Manager_Factory::~TAO_Codeset_Manager_Factory ()
+{
+}
+
+bool
+TAO_Codeset_Manager_Factory::is_default() const
+{
+ return false;
+}
+
+
+TAO_Codeset_Manager *
+TAO_Codeset_Manager_Factory::create ()
+{
+ TAO_Codeset_Manager_i *csm = 0;
+ ACE_NEW_RETURN (csm, TAO_Codeset_Manager_i, 0);
+
+ return csm;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_FACTORY_DEFINE (TAO_Codeset, TAO_Codeset_Manager_Factory)
+ACE_STATIC_SVC_DEFINE (TAO_Codeset_Manager_Factory,
+ ACE_TEXT ("TAO_Codeset"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (TAO_Codeset_Manager_Factory),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0)
diff --git a/TAO/tao/Codeset/Codeset_Manager_Factory.h b/TAO/tao/Codeset/Codeset_Manager_Factory.h
new file mode 100644
index 00000000000..44ed6f20d8c
--- /dev/null
+++ b/TAO/tao/Codeset/Codeset_Manager_Factory.h
@@ -0,0 +1,59 @@
+/* -*- C++ -*- */
+
+
+//=============================================================================
+/**
+ * @file Codeset_Manager_Factory.h
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan <coryan@uci.edu>
+ */
+//=============================================================================
+
+
+#ifndef TAO_CODESET_MANAGER_FACTORY_H
+#define TAO_CODESET_MANAGER_FACTORY_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Codeset/codeset_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/Service_Config.h"
+#include "tao/Codeset_Manager_Factory_Base.h"
+
+
+// ****************************************************************
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_Codeset_Manager_Factory
+ *
+ * @brief Class loader for initializing a codeset manager
+ */
+
+class TAO_Codeset_Export TAO_Codeset_Manager_Factory :
+ public TAO_Codeset_Manager_Factory_Base
+{
+public:
+ virtual ~TAO_Codeset_Manager_Factory ();
+ virtual TAO_Codeset_Manager *create(void);
+ virtual bool is_default(void) const;
+
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE (TAO_Codeset_Manager_Factory)
+ACE_FACTORY_DECLARE (TAO_Codeset, TAO_Codeset_Manager_Factory)
+
+
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_CODESET_MANAGER_FACTORY_H */
diff --git a/TAO/tao/Codeset/Codeset_Manager_i.cpp b/TAO/tao/Codeset/Codeset_Manager_i.cpp
new file mode 100644
index 00000000000..98664b6f60e
--- /dev/null
+++ b/TAO/tao/Codeset/Codeset_Manager_i.cpp
@@ -0,0 +1,510 @@
+// $Id$
+
+#include "tao/TAO_Server_Request.h"
+#include "tao/operation_details.h"
+#include "tao/Transport.h"
+#include "tao/Profile.h"
+#include "tao/SystemException.h"
+#include "tao/debug.h"
+#include "tao/CDR.h"
+#include "tao/ORB_Core.h"
+
+#include "tao/Codeset/Codeset_Descriptor.h"
+#include "tao/Codeset/Codeset_Manager_i.h"
+#include "tao/Codeset/Codeset_Translator_Factory.h"
+#include "tao/Codeset/Codeset.h"
+
+#include "ace/Dynamic_Service.h"
+#include "ace/Codeset_Registry.h"
+#include "ace/OS_NS_string.h"
+#include "ace/Service_Config.h"
+
+
+ACE_RCSID (Codeset,
+ Codeset_Manager_i,
+ "$Id$")
+
+
+// These numbers are assigned by the OpenGroup, a database is
+// available at
+//
+// ftp://ftp.opengroup.org/pub/code_set_registry/
+//
+#define TAO_CODESET_ID_ISO8859_1 0x00010001U
+#define TAO_CODESET_ID_UNICODE 0x00010109U
+#define TAO_CODESET_ID_XOPEN_UTF_8 0x05010001U
+
+// These are the default codesets that TAO declares, of course they
+// will be different on each platform, once the complete support for
+// character sets is implemented
+
+#if (defined TAO_DEFAULT_CHAR_CODESET_ID)
+# undef TAO_DEFAULT_CHAR_CODESET_ID
+#endif /* defined TAO_DEFAULT_CHAR_CODESET_ID */
+
+#if (defined TAO_DEFAULT_WCHAR_CODESET_ID)
+# undef TAO_DEFAULT_WCHAR_CODESET_ID
+#endif /* defined TAO_DEFAULT_WCHAR_CODESET_ID */
+
+//#define TAO_DEFAULT_CHAR_CODESET_ID TAO_CODESET_ID_XOPEN_UTF_8
+#define TAO_DEFAULT_CHAR_CODESET_ID TAO_CODESET_ID_ISO8859_1
+#define TAO_DEFAULT_WCHAR_CODESET_ID TAO_CODESET_ID_UNICODE
+
+// ****************************************************************
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/// NCS for char is defaulted to ISO 8859-1:1987; Latin Alphabet No. 1
+CONV_FRAME::CodeSetId
+TAO_Codeset_Manager_i::default_char_codeset = TAO_DEFAULT_CHAR_CODESET_ID;
+/// NCS for wchar is not defaulted by the CORBA specification, but a default
+/// may be set here if desired
+CONV_FRAME::CodeSetId
+TAO_Codeset_Manager_i::default_wchar_codeset = TAO_DEFAULT_WCHAR_CODESET_ID;
+
+TAO_Codeset_Manager_i::TAO_Codeset_Manager_i (void)
+ : codeset_info_ (),
+ char_descriptor_ (),
+ wchar_descriptor_ ()
+{
+ char_descriptor_.ncs(TAO_Codeset_Manager_i::default_char_codeset);
+ char_descriptor_.add_translator (ACE_TEXT ("UTF8_Latin1_Factory"));
+
+ wchar_descriptor_.ncs(TAO_Codeset_Manager_i::default_wchar_codeset);
+ wchar_descriptor_.add_translator (ACE_TEXT ("UTF16_BOM_Factory"));
+
+}
+
+TAO_Codeset_Manager_i::~TAO_Codeset_Manager_i (void)
+{
+}
+
+TAO_Codeset_Descriptor_Base *
+TAO_Codeset_Manager_i::char_codeset_descriptor (void)
+{
+ return &this->char_descriptor_;
+}
+
+TAO_Codeset_Descriptor_Base *
+TAO_Codeset_Manager_i::wchar_codeset_descriptor (void)
+{
+ return &this->wchar_descriptor_;
+}
+
+void
+TAO_Codeset_Manager_i::set_codeset (TAO_Tagged_Components& tc) const
+{
+ tc.set_code_sets (this->codeset_info_);
+}
+
+void
+TAO_Codeset_Manager_i::set_tcs (TAO_Profile &theProfile,
+ TAO_Transport &trans)
+{
+ /// If tcs is already set on the transport then do not process,
+ /// use existing transport as CDR have translators set.
+ TAO_Tagged_Components& theTaggedComp = theProfile.tagged_components ();
+
+ CONV_FRAME::CodeSetComponentInfo remote;
+
+ /// Get the codeset component
+ if (theTaggedComp.get_code_sets(remote) == 0 )
+ {
+ if (trans.is_tcs_set ())
+ {
+ if(TAO_debug_level > 2)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - Codeset_Manager_i::set_tcs, ")
+ ACE_TEXT ("transport already set\n")));
+ return;
+ }
+ if (TAO_debug_level > 2)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - Codeset_Manager_i::set_tcs, ")
+ ACE_TEXT ("No codeset component in profile\n")));
+
+ // These are the "fallback" codeset ids for use if no context is
+ // available
+ remote.ForCharData.native_code_set =
+ TAO_CODESET_ID_XOPEN_UTF_8;
+ remote.ForWcharData.native_code_set =
+ TAO_CODESET_ID_UNICODE;
+
+ trans.char_translator
+ (this->get_char_trans
+ (TAO_Codeset_Manager_i::default_char_codeset));
+ trans.wchar_translator
+ (this->get_wchar_trans
+ (TAO_Codeset_Manager_i::default_wchar_codeset));
+ }
+ else
+ {
+ CONV_FRAME::CodeSetId tcs =
+ computeTCS (remote.ForCharData,
+ this->codeset_info_.ForCharData);
+ if (TAO_debug_level > 2)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT("TAO (%P|%t) - Codeset_Manager_i::set_tcs, ")
+ ACE_TEXT("setting char translator (%08x)\n"),
+ tcs));
+ trans.char_translator(this->get_char_trans (tcs));
+
+ tcs = computeTCS (remote.ForWcharData,
+ this->codeset_info_.ForWcharData);
+
+ if (TAO_debug_level > 2)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT("TAO (%P|%t) - Codeset_Manager_i::set_tcs, ")
+ ACE_TEXT("setting wchar translator (%08x)\n"),
+ tcs));
+ trans.wchar_translator(this->get_wchar_trans (tcs));
+ }
+}
+
+void
+TAO_Codeset_Manager_i::process_service_context (TAO_ServerRequest &request)
+{
+ // Get the service Context from an object of TAO_ServerRequest
+ // and set the TCS values on the Transport
+ TAO_Service_Context &service_cntx = request.request_service_context ();
+ IOP::ServiceContext context;
+ context.context_id = IOP::CodeSets;
+
+ // These are the "fallback" codeset ids for use if no other codeset
+ // can be computed based on our local set and those in the context
+ CONV_FRAME::CodeSetId tcs_c = TAO_CODESET_ID_XOPEN_UTF_8;
+ CONV_FRAME::CodeSetId tcs_w = TAO_CODESET_ID_UNICODE;
+
+ if (service_cntx.get_context(context))
+ {
+ // Convert the Service Context to Codeset Context
+ const char *buffer =
+ reinterpret_cast<const char*> (context.context_data.get_buffer ());
+
+ TAO_InputCDR cdr (buffer,context.context_data.length ());
+ CORBA::Boolean byte_order;
+
+ if (cdr >> TAO_InputCDR::to_boolean (byte_order))
+ {
+ cdr.reset_byte_order (static_cast<int> (byte_order));
+ cdr >> tcs_c;
+ cdr >> tcs_w;
+ }
+ }
+ else
+ {
+ if (request.transport()->is_tcs_set())
+ return;
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT("TAO (%P|%t) - ")
+ ACE_TEXT("Codeset_Manager_i::process_service_context ")
+ ACE_TEXT("no codeset context in request, using defaults\n")
+ ));
+ tcs_c = TAO_Codeset_Manager_i::default_char_codeset;
+ tcs_w = TAO_Codeset_Manager_i::default_wchar_codeset;
+ }
+ if (TAO_debug_level > 2)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - Codeset_Manager_i::")
+ ACE_TEXT ("process_service_context, ")
+ ACE_TEXT ("using tcsc = %08x, tcsw = %08x\n"),
+ tcs_c,tcs_w));
+ }
+
+ request.transport()->char_translator(this->get_char_trans (tcs_c));
+ request.transport()->wchar_translator(this->get_wchar_trans (tcs_w));
+}
+
+void
+TAO_Codeset_Manager_i::generate_service_context (TAO_Operation_Details &opd,
+ TAO_Transport &trans)
+{
+ TAO_Service_Context &service_cntx = opd.request_service_context ();
+ CONV_FRAME::CodeSetContext codeset_cntx;
+
+ // Generating codeset context
+ // Assuming the TCS values from Transport will be defaulted
+ TAO_Codeset_Translator_Factory *tf =
+ dynamic_cast<TAO_Codeset_Translator_Factory*>(trans.char_translator());
+
+ codeset_cntx.char_data =
+ tf ? tf->tcs () : this->codeset_info_.ForCharData.native_code_set;
+
+ tf =
+ dynamic_cast<TAO_Codeset_Translator_Factory*>(trans.wchar_translator());
+
+ codeset_cntx.wchar_data =
+ tf ? tf->tcs () : this->codeset_info_.ForWcharData.native_code_set;
+
+ if (TAO_debug_level > 2)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - Codeset_Manager_i::")
+ ACE_TEXT ("generate_service_context, ")
+ ACE_TEXT ("using tcs_c = %08x, tcs_w = %08x\n"),
+ codeset_cntx.char_data,
+ codeset_cntx.wchar_data));
+ }
+
+ TAO_OutputCDR codeset_cdr;
+ codeset_cdr << TAO_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER);
+ codeset_cdr << codeset_cntx;
+
+ service_cntx.set_context (IOP::CodeSets,codeset_cdr);
+}
+
+/// Checks whether the NCS is a part of CCS
+int
+TAO_Codeset_Manager_i::isElementOf (CONV_FRAME::CodeSetId id,
+ CONV_FRAME::CodeSetComponent &cs_comp)
+{
+ for (CORBA::ULong i = 0L;
+ i < cs_comp.conversion_code_sets.length ();
+ ++i )
+ {
+ if (id == cs_comp.conversion_code_sets[i])
+ return 1;
+ }
+
+ return 0;
+}
+
+/// Find the Intersection of Client and Server CCS's
+CONV_FRAME::CodeSetId
+TAO_Codeset_Manager_i::intersectionOf (CONV_FRAME::CodeSetComponent &cs_comp1,
+ CONV_FRAME::CodeSetComponent &cs_comp2)
+{
+ for(CORBA::ULong index = 0L;
+ index < cs_comp1.conversion_code_sets.length();
+ ++index )
+ {
+ if (this->isElementOf(cs_comp1.conversion_code_sets[index], cs_comp2))
+ {
+ return cs_comp1.conversion_code_sets[index];
+ }
+ }
+
+ return 0;
+}
+
+int
+TAO_Codeset_Manager_i::isCompatible(CONV_FRAME::CodeSetId cs1,
+ CONV_FRAME::CodeSetId cs2 )
+{
+ // Call the is_compatible method of ACE_Codeset_Registry
+ return ACE_Codeset_Registry::is_compatible(cs1,cs2);
+}
+
+/// returns the TCS for Char / Wchar
+CONV_FRAME::CodeSetId
+TAO_Codeset_Manager_i::computeTCS (CONV_FRAME::CodeSetComponent &remote,
+ CONV_FRAME::CodeSetComponent &local )
+{
+ if (remote.native_code_set == local.native_code_set)
+ {
+ return local.native_code_set;
+ }
+
+ if (this->isElementOf (remote.native_code_set, local))
+ {
+ return remote.native_code_set;
+ }
+
+ if (this->isElementOf (local.native_code_set, remote))
+ {
+ return local.native_code_set;
+ }
+
+ CONV_FRAME::CodeSetId tcs;
+
+ if ((tcs = this->intersectionOf (remote, local)) == 0)
+ {
+ if (isCompatible (local.native_code_set, remote.native_code_set))
+ {
+ return remote.native_code_set;
+ }
+ else
+ {
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_THROW_RETURN(CORBA::CODESET_INCOMPATIBLE (), 0);
+ }
+ }
+
+ return tcs;
+}
+
+void
+TAO_Codeset_Manager_i::open(void)
+{
+#if 0
+ // These translators help comply with the CORBA 3.0.2 specifcation
+ TAO_Codeset_Translator_Factory *fact =
+ ACE_Dynamic_Service<TAO_Codeset_Translator_Factory>::
+ instance ("UTF8_Latin1_Factory");
+ if (fact == 0)
+ ACE_Service_Config::process_directive
+ (ACE_DYNAMIC_SERVICE_DIRECTIVE ("UTF8_Latin1_Factory",
+ "TAO_Codeset",
+ "_make_TAO_UTF8_Latin1_Factory",
+ ""));
+ else
+ {
+ if (TAO_debug_level > 2)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT("TAO (%P|%t) - Codeset_Manager_i::open skipping ")
+ ACE_TEXT("redundant load of UTF8_Latin1_Factory\n")
+ ));
+ }
+
+ fact = ACE_Dynamic_Service<TAO_Codeset_Translator_Factory>::
+ instance ("UTF16_BOM_Factory");
+ if (fact == 0)
+ ACE_Service_Config::process_directive
+ (ACE_DYNAMIC_SERVICE_DIRECTIVE ("UTF16_BOM_Factory",
+ "TAO_Codeset",
+ "_make_TAO_UTF16_BOM_Factory",
+ ""));
+ else
+ {
+ if (TAO_debug_level > 2)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT("TAO (%P|%t) - Codeset_Manager_i::open skipping ")
+ ACE_TEXT("redundant load of UTF16_BOM_Factory\n")
+ ));
+ }
+#endif
+
+ // add in from the service configurator
+ this->codeset_info_.ForCharData.native_code_set =
+ this->char_descriptor_.ncs();
+ this->codeset_info_.ForWcharData.native_code_set =
+ this->wchar_descriptor_.ncs();
+ ACE_OutputCDR::wchar_maxbytes(this->wchar_descriptor_.max_bytes());
+
+ if (init_ccs (this->char_descriptor_,
+ this->codeset_info_.ForCharData) == -1)
+ {
+ if (TAO_debug_level)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) - Codeset_Manager_i::")
+ ACE_TEXT ("configure_codeset_factories, failed to init ")
+ ACE_TEXT ("char codeset factories\n")));
+ }
+
+ if (init_ccs (this->wchar_descriptor_,
+ this->codeset_info_.ForWcharData) == -1)
+ {
+ if (TAO_debug_level)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) - Codeset_Manager_i::")
+ ACE_TEXT ("configure_codeset_factories, failed to init ")
+ ACE_TEXT ("wchar codeset factories\n")));
+ }
+}
+
+// Initialise the specific type codeset factories
+int
+TAO_Codeset_Manager_i::init_ccs (TAO_Codeset_Descriptor& cd,
+ CONV_FRAME::CodeSetComponent& cs_comp)
+{
+ cs_comp.conversion_code_sets.length
+ (static_cast<CORBA::ULong> (cd.num_translators()));
+
+ CORBA::ULong index;
+ TAO_Codeset_Descriptor::Translator_Node *tlist = cd.translators();
+
+ for (index = 0; tlist; tlist = tlist->next_)
+ {
+ tlist->translator_factory_ =
+ ACE_Dynamic_Service<TAO_Codeset_Translator_Factory>::instance
+ (ACE_TEXT_ALWAYS_CHAR (tlist->name_));
+
+ if (tlist->translator_factory_ == 0)
+ {
+ if (TAO_debug_level)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) - Codeset_Manager_i::")
+ ACE_TEXT ("init_ccs, Unable to load ")
+ ACE_TEXT ("code set translator <%s>, %m\n"),
+ tlist->name_));
+ continue;
+ }
+
+ if (tlist->translator_factory_->ncs() != cs_comp.native_code_set)
+ {
+ if (TAO_debug_level)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) - Codeset_Manager_i::")
+ ACE_TEXT ("init_ccs, codeset translator <%s> ")
+ ACE_TEXT ("has wrong ncs (%d), %m\n"),
+ tlist->name_,
+ tlist->translator_factory_->ncs()));
+ tlist->translator_factory_ = 0;
+ continue;
+ }
+
+ // this is a special case for the utf16 bom translator.
+ if (tlist->translator_factory_->tcs() == cs_comp.native_code_set)
+ continue;
+
+ cs_comp.conversion_code_sets[index++] =
+ tlist->translator_factory_->tcs();
+ if (TAO_debug_level > 2)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - Codeset_Manager_i::")
+ ACE_TEXT ("init_ccs, Loaded Codeset translator ")
+ ACE_TEXT ("<%s>, ncs = %08x tcs = %08x\n"),
+ tlist->name_,
+ tlist->translator_factory_->ncs(),
+ tlist->translator_factory_->tcs()
+ ));
+ }
+ }
+
+ cs_comp.conversion_code_sets.length(index);
+ return 0;
+}
+
+TAO_Codeset_Translator_Base *
+TAO_Codeset_Manager_i::get_char_trans (CONV_FRAME::CodeSetId tcs)
+{
+ if (this->codeset_info_.ForCharData.native_code_set == tcs)
+ return 0;
+ return this->get_translator_i (this->char_descriptor_,tcs);
+}
+
+TAO_Codeset_Translator_Base *
+TAO_Codeset_Manager_i::get_wchar_trans (CONV_FRAME::CodeSetId tcs)
+{
+ if (tcs == this->codeset_info_.ForWcharData.native_code_set &&
+ tcs != ACE_CODESET_ID_ISO_UTF_16)
+ return 0;
+ return this->get_translator_i (this->wchar_descriptor_,tcs);
+}
+
+TAO_Codeset_Translator_Base *
+TAO_Codeset_Manager_i::get_translator_i (TAO_Codeset_Descriptor& cd,
+ CONV_FRAME::CodeSetId tcs)
+{
+ for (TAO_Codeset_Descriptor::Translator_Node *tlist = cd.translators();
+ tlist; tlist = tlist->next_)
+ {
+ TAO_Codeset_Translator_Factory *fact = tlist->translator_factory_;
+ if (fact && tcs == fact->tcs ())
+ return fact;
+ }
+ return 0;
+}
+
+void
+TAO_Codeset_Manager_i::get_ncs (CONV_FRAME::CodeSetId &ncsc,
+ CONV_FRAME::CodeSetId &ncsw)
+{
+ ncsc = this->char_descriptor_.ncs();
+ ncsw = this->wchar_descriptor_.ncs();
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Codeset/Codeset_Manager_i.h b/TAO/tao/Codeset/Codeset_Manager_i.h
new file mode 100644
index 00000000000..a9167804b1c
--- /dev/null
+++ b/TAO/tao/Codeset/Codeset_Manager_i.h
@@ -0,0 +1,150 @@
+// This may look like C, but it's really -*- C++ -*-
+
+//======================================================================
+/*
+ * @file Codeset_Manager_i.h
+ *
+ * $Id$
+ *
+ * Interface for the TAO CodeSet Manager.
+ *
+ * @author Phil Mesnier
+ */
+//======================================================================
+
+#ifndef TAO_CODESET_MANAGER_I_H
+#define TAO_CODESET_MANAGER_I_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/CONV_FRAMEC.h"
+#include "tao/Codeset_Manager.h"
+#include "tao/Codeset/codeset_export.h"
+#include "tao/Codeset/Codeset_Descriptor.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/Unbounded_Set.h"
+#include "ace/Dynamic_Service_Dependency.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Profile;
+class TAO_Transport;
+class TAO_Operation_Details;
+
+class TAO_ServerRequest;
+class TAO_Tagged_Components;
+class TAO_Codeset_Descriptor;
+
+// ****************************************************************
+
+/**
+ * @class TAO_Codeset_Manager
+ *
+ * @brief The encapsulation of logic for codeset negotiation
+ *
+ * The Codeset Manager is owned by the ORB_Core, initialized through Resource
+ * Factory configuration options. The codeset manager participates in profile
+ * creation by servers and connection establishment by clients. The involvement
+ * is necessary to supply a codeset component to the profile including for both
+ * chars and wide chars the native code set and any conversion code sets for
+ * which translators are available. The codeset manager is also responsible for
+ * determining the transmission codesets based an the local and remote codeset
+ * information. The transmission codesets are communicated via a service
+ * context attached to the first request sent on the new connection.
+ *
+ */
+
+class TAO_Codeset_Export TAO_Codeset_Manager_i :
+ public TAO_Codeset_Manager
+{
+
+public:
+ /// NCS for char is defaulted to ISO 8859-1:1987; Latin Alphabet
+ /// No. 1
+ static CONV_FRAME::CodeSetId default_char_codeset;
+ /// NCS for wchar is defaulted to 0 (not used), but people wishing
+ /// to provide a non-compliant default wchar codeset may do so.
+ static CONV_FRAME::CodeSetId default_wchar_codeset;
+
+ TAO_Codeset_Manager_i (void);
+ ~TAO_Codeset_Manager_i (void);
+
+ /// Called by an object of TAO_Acceptor to set NCS and CCS values
+ /// for Char/Wchar in to the Object Reference.
+ void set_codeset (TAO_Tagged_Components& ) const;
+ ///
+ /// Called from an object of "TAO_GIOP_Invocation" to set TCS on the
+ /// Transport
+ void set_tcs (TAO_Profile &theProfile, TAO_Transport &);
+
+ /// Called from an Object of TAO_Messaging for every request at
+ /// server side to process service context and set TCS for
+ /// Char/WChar
+ void process_service_context (TAO_ServerRequest &);
+
+ /// Called by a client object to generate service context
+ /// at this time Transport has the TCS for Char and WChar
+ void generate_service_context (TAO_Operation_Details&, TAO_Transport & );
+
+ /// Called by the resource factory to signify the end of
+ /// initialization. This will traverse the list of named codeset
+ /// translator factories and add any of those that have a native
+ /// codeset id matching the manager's native codeset id.
+ void open(void);
+
+ virtual TAO_Codeset_Descriptor_Base *char_codeset_descriptor (void);
+ virtual TAO_Codeset_Descriptor_Base *wchar_codeset_descriptor (void);
+
+private:
+ // Compute the TCS for Char/WChar asper the CORBA Specification
+ CONV_FRAME::CodeSetId computeTCS (CONV_FRAME::CodeSetComponent &,
+ CONV_FRAME::CodeSetComponent &);
+
+ // Find CodesetId in the codeset component
+ int isElementOf (CONV_FRAME::CodeSetId,
+ CONV_FRAME::CodeSetComponent & );
+
+ // find the intersection of CodesetIds between Client and Server CCS
+ CONV_FRAME::CodeSetId intersectionOf (CONV_FRAME::CodeSetComponent &,
+ CONV_FRAME::CodeSetComponent &);
+
+ // determine compatibility between two codesets via the codeset
+ // registry
+ int isCompatible (CONV_FRAME::CodeSetId, CONV_FRAME::CodeSetId);
+
+ // traverse the list of codeset factories, populating the list of
+ // conversion codeset values with the translated codeset id from
+ // each factory that has a matching native codeset. Those factories
+ // that do not have a matching codeset are not retained in the list.
+ int init_ccs (TAO_Codeset_Descriptor&,
+ CONV_FRAME::CodeSetComponent&);
+
+ // get the translator between our ncs_c and the supplied tcs_c
+ TAO_Codeset_Translator_Base * get_char_trans (CONV_FRAME::CodeSetId);
+
+ // get the translator between our ncs_w and the supplied tcs_w
+ TAO_Codeset_Translator_Base * get_wchar_trans (CONV_FRAME::CodeSetId);
+
+ TAO_Codeset_Translator_Base * get_translator_i (TAO_Codeset_Descriptor&,
+ CONV_FRAME::CodeSetId);
+
+ void get_ncs (CONV_FRAME::CodeSetId &ncsc, CONV_FRAME::CodeSetId& ncsw);
+
+ // The CodeSetComponentInfo struct contains all of the information
+ // regarding the code sets this application recognizes. This is
+ // where the native code set for both char and wchar are stored.
+ CONV_FRAME::CodeSetComponentInfo codeset_info_;
+
+ TAO_Codeset_Descriptor char_descriptor_;
+ TAO_Codeset_Descriptor wchar_descriptor_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_CODESET_MANAGER_I_H */
diff --git a/TAO/tao/Codeset/Codeset_Translator_Factory.cpp b/TAO/tao/Codeset/Codeset_Translator_Factory.cpp
new file mode 100644
index 00000000000..bd3a915c51d
--- /dev/null
+++ b/TAO/tao/Codeset/Codeset_Translator_Factory.cpp
@@ -0,0 +1,81 @@
+// -*- C++ -*-
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO/tao/Codeset
+//
+// = FILENAME
+// Codeset_Translator_Factory.cpp
+//
+// = DESCRIPTION
+// The base for all the translator factories. Translator factories are
+// responsible for supplying the proper translator on demand.
+//
+// = AUTHORS
+// Phil Mesnier <mesnier_p@ociweb.com>
+//
+// ============================================================================
+
+#include "tao/Codeset/Codeset_Translator_Factory.h"
+#include "tao/CDR.h"
+
+ACE_RCSID (Codeset,
+ Codeset_Translator_Factory,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Codeset_Translator_Factory::TAO_Codeset_Translator_Factory ()
+{
+
+}
+
+TAO_Codeset_Translator_Factory::~TAO_Codeset_Translator_Factory ()
+{
+
+}
+
+int
+TAO_Codeset_Translator_Factory::init (int , ACE_TCHAR **)
+{
+ return 0;
+}
+
+void
+TAO_Codeset_Translator_Factory::assign_i (
+ TAO_InputCDR *cdr,
+ ACE_Char_Codeset_Translator *trans
+ ) const
+{
+ cdr->char_translator(trans);
+}
+
+void
+TAO_Codeset_Translator_Factory::assign_i (
+ TAO_OutputCDR *cdr,
+ ACE_Char_Codeset_Translator *trans
+ ) const
+{
+ cdr->char_translator(trans);
+}
+
+void
+TAO_Codeset_Translator_Factory::assign_i (
+ TAO_InputCDR *cdr,
+ ACE_WChar_Codeset_Translator *trans
+ ) const
+{
+ cdr->wchar_translator(trans);
+}
+
+void
+TAO_Codeset_Translator_Factory::assign_i (
+ TAO_OutputCDR *cdr,
+ ACE_WChar_Codeset_Translator *trans
+ ) const
+{
+ cdr->wchar_translator(trans);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Codeset/Codeset_Translator_Factory.h b/TAO/tao/Codeset/Codeset_Translator_Factory.h
new file mode 100644
index 00000000000..518a168de63
--- /dev/null
+++ b/TAO/tao/Codeset/Codeset_Translator_Factory.h
@@ -0,0 +1,92 @@
+// -*- C++ -*-
+
+// ===================================================================
+/**
+ * @file Codeset_Translator_Factory.h
+ *
+ * $Id$
+ *
+ * @author Phil Mesnier <mesnier_p@ociweb.com>
+ */
+// ===================================================================
+
+#ifndef TAO_CODESET_TRANSLATOR_FACTORY_H
+#define TAO_CODESET_TRANSLATOR_FACTORY_H
+
+#include /**/ "ace/pre.h"
+#include "ace/Service_Object.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/CONV_FRAMEC.h"
+#include "tao/Codeset_Translator_Base.h"
+#include "tao/Codeset/codeset_export.h"
+
+
+ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+class ACE_Char_Codeset_Translator;
+class ACE_WChar_Codeset_Translator;
+ACE_END_VERSIONED_NAMESPACE_DECL
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_InputCDR;
+class TAO_OutputCDR;
+
+// ****************************************************************
+
+/**
+ * @class TAO_Codeset_Translator_Factory
+ *
+ * @brief Abstract base class for factories providing codeset translators
+ *
+ * The codeset translator factory is a loadable service object. It is used to
+ * supply the actual translator used in converting between two codesets. The
+ * intent of using a factory is to avoid requiring codeset translators to be
+ * multiply inherited both from the translator base class and the service
+ * object base. The translator factory is also responsible for assigning
+ * translators to CDR streams. Since there is no common base class between
+ * input and output CDRs, the assingment code must be duplicated.
+ */
+
+class TAO_Codeset_Export TAO_Codeset_Translator_Factory :
+ public TAO_Codeset_Translator_Base,
+ public ACE_Service_Object
+{
+public:
+ TAO_Codeset_Translator_Factory ();
+ virtual ~TAO_Codeset_Translator_Factory ();
+ virtual int init (int argc, ACE_TCHAR *argv[]);
+
+protected:
+ /// Assign the translator to the supplied input CDR. The template instance
+ /// will have a translator that is based on either the Char or Wchar
+ /// translator, so the compiler will select the appropriate call from
+ /// assign().
+ void assign_i (TAO_InputCDR *, ACE_Char_Codeset_Translator* ) const;
+ /// Assign the translator to the supplied input CDR. The template instance
+ /// will have a translator that is based on either the Char or Wchar
+ /// translator, so the compiler will select the appropriate call from
+ /// assign().
+ void assign_i (TAO_InputCDR *, ACE_WChar_Codeset_Translator* ) const;
+ /// Assign the translator to the supplied output CDR. The template instance
+ /// will have a translator that is based on either the Char or Wchar
+ /// translator, so the compiler will select the appropriate call from
+ /// assign().
+ void assign_i (TAO_OutputCDR *, ACE_Char_Codeset_Translator* ) const;
+ /// Assign the translator to the supplied output CDR. The template instance
+ /// will have a translator that is based on either the Char or Wchar
+ /// translator, so the compiler will select the appropriate call from
+ /// assign().
+ void assign_i (TAO_OutputCDR *, ACE_WChar_Codeset_Translator* ) const;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+// Get the template includes last
+#include "tao/Codeset/Codeset_Translator_Factory_T.h"
+
+#include /**/ "ace/post.h"
+#endif /* TAO_Codeset_Translator_Factory */
diff --git a/TAO/tao/Codeset/Codeset_Translator_Factory_T.cpp b/TAO/tao/Codeset/Codeset_Translator_Factory_T.cpp
new file mode 100644
index 00000000000..734417e9934
--- /dev/null
+++ b/TAO/tao/Codeset/Codeset_Translator_Factory_T.cpp
@@ -0,0 +1,92 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO/tao
+//
+// = FILENAME
+// Codeset_Translator_Factory_T.cpp
+//
+// = DESCRIPTION
+// The template for creating a particular instance of a codeset translator
+//
+// = AUTHORS
+// Phil Mesnier <mesnier_p@ociweb.com>
+//
+// ============================================================================
+#ifndef TAO_CODESET_TRANSLATOR_FACTORY_T_CPP
+#define TAO_CODESET_TRANSLATOR_FACTORY_T_CPP
+
+#include "tao/Codeset/Codeset_Translator_Factory_T.h"
+#include "tao/debug.h"
+#include "tao/CDR.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template<class NCS_TO_TCS>
+TAO_Codeset_Translator_Factory_T<NCS_TO_TCS>::TAO_Codeset_Translator_Factory_T () :
+ translator_(0)
+{
+}
+
+template<class NCS_TO_TCS>
+TAO_Codeset_Translator_Factory_T<NCS_TO_TCS>::~TAO_Codeset_Translator_Factory_T ()
+{
+ delete translator_;
+}
+
+template<class NCS_TO_TCS>
+int
+TAO_Codeset_Translator_Factory_T<NCS_TO_TCS>::init (int argc, ACE_TCHAR* argv[])
+{
+ this->TAO_Codeset_Translator_Factory::init (argc,argv);
+ ACE_NEW_RETURN (translator_,NCS_TO_TCS,-1);
+ if( TAO_debug_level > 0 )
+ ACE_DEBUG((LM_DEBUG, "TAO_Codeset_Translator_Factory_T<NCS_TO_TCS>::init() entered\n"));
+ return 0;
+}
+
+// ncs & tcs values set at compile time as a result of instantiating the
+// template.
+template<class NCS_TO_TCS>
+CONV_FRAME::CodeSetId
+TAO_Codeset_Translator_Factory_T<NCS_TO_TCS>::ncs () const
+{
+ return this->translator_->ncs();
+}
+
+template<class NCS_TO_TCS>
+CONV_FRAME::CodeSetId
+TAO_Codeset_Translator_Factory_T<NCS_TO_TCS>::tcs () const
+{
+ return this->translator_->tcs();
+}
+
+// Assign either a reference to teh existing translator or a new translator
+// for input CDR streams
+template<class NCS_TO_TCS>
+void
+TAO_Codeset_Translator_Factory_T<NCS_TO_TCS>::assign (TAO_InputCDR *cdr) const
+{
+ if (cdr)
+ {
+ this->assign_i(cdr,this->translator_);
+ }
+}
+
+// Assign either a reference to teh existing translator or a new translator
+// for input CDR streams
+template<class NCS_TO_TCS>
+void
+TAO_Codeset_Translator_Factory_T<NCS_TO_TCS>::assign (TAO_OutputCDR *cdr) const
+{
+ if (cdr)
+ {
+ this->assign_i(cdr,this->translator_);
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_CODESET_TRANSLATOR_FACTORY_T_CPP */
diff --git a/TAO/tao/Codeset/Codeset_Translator_Factory_T.h b/TAO/tao/Codeset/Codeset_Translator_Factory_T.h
new file mode 100644
index 00000000000..ce5a902c7fe
--- /dev/null
+++ b/TAO/tao/Codeset/Codeset_Translator_Factory_T.h
@@ -0,0 +1,85 @@
+// -*- C++ -*-
+
+// ===================================================================
+/**
+ * @file Codeset_Translator_Factory_T.h
+ *
+ * $Id$
+ *
+ * @author Phil Mesnier <mesnier_p@ociweb.com>
+ */
+// ===================================================================
+
+#ifndef TAO_CODESET_TRANSLATOR_FACTORY_T_H
+#define TAO_CODESET_TRANSLATOR_FACTORY_T_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Codeset/Codeset_Translator_Factory.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_Codeset_Translator_Factory_T
+ *
+ * @brief Template for translator factory classes.
+ *
+ * The template argument is the actual translator class. The factory creates an
+ * instance of the translator during initialization. Other than that, the
+ * template returns the actual values for the native and translated codeset
+ * ids, and performs the translator assignment to the CDR objects as needed.
+ */
+
+template<class NCS_TO_TCS>
+class TAO_Codeset_Translator_Factory_T
+: public TAO_Codeset_Translator_Factory
+{
+public:
+
+ TAO_Codeset_Translator_Factory_T ();
+ virtual ~TAO_Codeset_Translator_Factory_T ();
+
+ /// initialize the factory service object. Instantiates the translator.
+ int init( int argc, ACE_TCHAR* argv[]);
+
+ /// ncs returns the translator's native codeset ID.
+ CONV_FRAME::CodeSetId ncs () const;
+ /// tcs returns the translator's transmission codeset ID.
+ CONV_FRAME::CodeSetId tcs () const;
+
+ /// Assign the translator to the input CDR. The inherited assign_i is used
+ /// to assign either a char or wchar translator, depending on the base type
+ /// of NCS_TO_TCS. A null input CDR is permitted, in which case assign is a
+ /// no-op.
+ virtual void assign (TAO_InputCDR *) const;
+ /// Assign the translator to the output CDR. The inherited assign_i is used
+ /// to assign either a char or wchar translator, depending on the base type
+ /// of NCS_TO_TCS. A null output CDR is permitted, in which case assign is a
+ /// no-op.
+ virtual void assign (TAO_OutputCDR *) const;
+
+private:
+ NCS_TO_TCS *translator_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+#include "tao/Codeset/Codeset_Translator_Factory_T.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
+#pragma implementation ("Codeset_Translator_Factory_T.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_Codeset_Translator_Factory_T */
diff --git a/TAO/tao/Codeset/UTF16_BOM_Factory.cpp b/TAO/tao/Codeset/UTF16_BOM_Factory.cpp
new file mode 100644
index 00000000000..1140d84a6bb
--- /dev/null
+++ b/TAO/tao/Codeset/UTF16_BOM_Factory.cpp
@@ -0,0 +1,142 @@
+// -*- C++ -*-
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// tao
+//
+// = FILENAME
+// UTF16_BOM_Factory.cpp
+//
+// = DESCRIPTION
+// Loader for an instance of the UTF16_BOM_Translator.
+//
+// = AUTHOR
+// Phil Mesnier <mesnier_p@ociweb.com>
+//
+// ============================================================================
+
+#include "tao/debug.h"
+#include "tao/Codeset/UTF16_BOM_Factory.h"
+#include "ace/OS_NS_strings.h"
+#include "ace/Dynamic_Service.h"
+#include "ace/Log_Msg.h"
+
+ACE_STATIC_SVC_DEFINE (TAO_UTF16_BOM_Factory,
+ ACE_TEXT ("UTF16_BOM_Factory"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (TAO_UTF16_BOM_Factory),
+ ACE_Service_Type::DELETE_THIS
+ | ACE_Service_Type::DELETE_OBJ,
+ 0)
+ACE_FACTORY_DEFINE (TAO_Codeset, TAO_UTF16_BOM_Factory)
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_UTF16_BOM_Factory::TAO_UTF16_BOM_Factory ()
+ : translator_ (0)
+ , forceBE_ (false)
+{
+}
+
+TAO_UTF16_BOM_Factory::~TAO_UTF16_BOM_Factory ()
+{
+ delete this->translator_;
+}
+
+int
+TAO_UTF16_BOM_Factory::init (int argc, ACE_TCHAR *argv[])
+{
+ TAO_Codeset_Translator_Factory::init (argc, argv);
+
+ for (int narg = 0; narg < argc;)
+ {
+ int consumed = parse_one_arg (argc - narg, &argv[narg]);
+ if (consumed > 0)
+ {
+ narg += consumed;
+ }
+ else
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t)TAO_UTF16_BOM_Factory parameter error: %s\n")
+ ACE_TEXT ("Usage: TAO_UTF16_BOM_Factory \"-forceBE\"\n")
+ , argv[narg]
+ ));
+ return -1;
+ }
+ }
+ return 0;
+}
+
+int
+TAO_UTF16_BOM_Factory::parse_one_arg (int argc, ACE_TCHAR *argv[])
+{
+ int consumed = 0;
+ if ((argc > 0) && (ACE_OS::strcasecmp (argv[0], ACE_TEXT("-forcebe")) == 0))
+ {
+ this->forceBE_ = true;
+ consumed = 1;
+ }
+ return consumed;
+}
+
+CONV_FRAME::CodeSetId
+TAO_UTF16_BOM_Factory::ncs () const
+{
+ create_translator();
+ return this->translator_->ncs();
+}
+
+CONV_FRAME::CodeSetId
+TAO_UTF16_BOM_Factory::tcs () const
+{
+ create_translator();
+ return this->translator_->tcs();
+}
+
+// Assign either a reference to the existing translator or a new translator
+// for input CDR streams
+void
+TAO_UTF16_BOM_Factory::assign (TAO_InputCDR *cdr) const
+{
+ if (cdr)
+ {
+ create_translator ();
+ this->assign_i (cdr, this->translator_);
+ }
+}
+
+// Assign either a reference to the existing translator or a new translator
+// for output CDR streams
+void
+TAO_UTF16_BOM_Factory::assign (TAO_OutputCDR *cdr) const
+{
+ if (cdr)
+ {
+ create_translator ();
+ this->assign_i (cdr, this->translator_);
+ }
+}
+
+void
+TAO_UTF16_BOM_Factory::create_translator () const
+{
+ if (this->translator_ == 0)
+ {
+ TAO_UTF16_BOM_Factory * pthis = const_cast<TAO_UTF16_BOM_Factory *> (this);
+ ACE_NEW (pthis->translator_, TAO_UTF16_BOM_Translator (this->forceBE_));
+ if (this->translator_ == 0)
+ {
+ if (TAO_debug_level)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) - UTF16_BOM_Factory: ")
+ ACE_TEXT ("Cannot create translator\n")
+ ));
+ }
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Codeset/UTF16_BOM_Factory.h b/TAO/tao/Codeset/UTF16_BOM_Factory.h
new file mode 100644
index 00000000000..a72652a7458
--- /dev/null
+++ b/TAO/tao/Codeset/UTF16_BOM_Factory.h
@@ -0,0 +1,71 @@
+// -*- C++ -*-
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO
+//
+// = FILENAME
+// UTF16_BOM_Factory.h
+//
+// = DESCRIPTION
+// Loader for an instance of the UTF16_BOM_Translator.
+//
+// = AUTHOR
+// Phil Mesnier <mesnier_p@ociweb.com>
+//
+// ============================================================================
+
+#ifndef UTF16_BOM_FACTORY_H
+#define UTF16_BOM_FACTORY_H
+
+#include /**/ "ace/pre.h"
+#include "ace/Service_Config.h"
+#include "tao/Codeset/Codeset_Translator_Factory.h"
+
+#include "tao/Codeset/UTF16_BOM_Translator.h"
+#include "tao/Codeset/codeset_export.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Codeset_Export TAO_UTF16_BOM_Factory
+ : public TAO_Codeset_Translator_Factory
+{
+public:
+ TAO_UTF16_BOM_Factory ();
+ virtual ~TAO_UTF16_BOM_Factory ();
+ virtual int init (int argc, ACE_TCHAR *argv[]);
+
+ /// ncs returns the translator's native codeset ID.
+ CONV_FRAME::CodeSetId ncs () const;
+ /// tcs returns the translator's transmission codeset ID.
+ CONV_FRAME::CodeSetId tcs () const;
+
+ /// Assign the translator to the input CDR. The inherited assign_i is used
+ /// to assign either a char or wchar translator, depending on the base type
+ /// of NCS_TO_TCS. A null input CDR is permitted, in which case assign is a
+ /// no-op.
+ virtual void assign (TAO_InputCDR *) const;
+ /// Assign the translator to the output CDR. The inherited assign_i is used
+ /// to assign either a char or wchar translator, depending on the base type
+ /// of NCS_TO_TCS. A null output CDR is permitted, in which case assign is a
+ /// no-op.
+ virtual void assign (TAO_OutputCDR *) const;
+
+private:
+ void create_translator () const;
+ int parse_one_arg (int argc, ACE_TCHAR *argv[]);
+
+private:
+ TAO_UTF16_BOM_Translator *translator_;
+ bool forceBE_; // force big endian wchar, warray, & wstring
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE_EXPORT (TAO_Codeset, TAO_UTF16_BOM_Factory)
+ACE_FACTORY_DECLARE (TAO_Codeset, TAO_UTF16_BOM_Factory)
+
+#include /**/ "ace/post.h"
+#endif /* UTF16_BOM_FACTORY_H */
diff --git a/TAO/tao/Codeset/UTF16_BOM_Translator.cpp b/TAO/tao/Codeset/UTF16_BOM_Translator.cpp
new file mode 100644
index 00000000000..0feaca04783
--- /dev/null
+++ b/TAO/tao/Codeset/UTF16_BOM_Translator.cpp
@@ -0,0 +1,444 @@
+// $Id$
+
+// ============================================================================
+// Manages the transformation between native and transmitted UTF-16. It is
+// Required because transmitted UTF-16 may carry a byte order marker (BOM)
+// that is not part of the data contents. If no BOM is present, then the
+// serialized UTF-16 data is big-endian, regardless of the byte order of
+// the containing encapsulation.
+//
+// AUTHOR
+// Phil Mesnier <mesnier_p@ociweb.com>
+//
+// ============================================================================
+
+#include "tao/Codeset/UTF16_BOM_Translator.h"
+#include "ace/OS_Memory.h"
+#include "tao/debug.h"
+#include "ace/Log_Msg.h"
+
+ACE_RCSID (Codeset,
+ TAO_UTF16_BOM_Translator,
+ "$Id$")
+
+
+ // ****************************************************************
+
+
+typedef ACE_CDR::UShort ACE_UTF16_T;
+static const size_t ACE_UTF16_CODEPOINT_SIZE = sizeof (ACE_UTF16_T);
+static const unsigned short ACE_UNICODE_BOM_CORRECT = 0xFEFFU;
+static const unsigned short ACE_UNICODE_BOM_SWAPPED = 0xFFFEU;
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/////////////////////////////
+// TAO_UTF16_BOM_Translator implementation
+
+TAO_UTF16_BOM_Translator::TAO_UTF16_BOM_Translator (bool forceBE)
+ : forceBE_(forceBE)
+{
+ if (TAO_debug_level > 1)
+ ACE_DEBUG((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - UTF16_BOM_Translator: ")
+ ACE_TEXT("forceBE %d\n"), this->forceBE_ ? 1:0 ));
+}
+
+TAO_UTF16_BOM_Translator::~TAO_UTF16_BOM_Translator (void)
+{
+}
+
+// = Documented in $ACE_ROOT/ace/CDR_Stream.h
+ACE_CDR::Boolean
+TAO_UTF16_BOM_Translator::read_wchar (ACE_InputCDR &cdr, ACE_CDR::WChar &x)
+{
+ if (static_cast<ACE_CDR::Short> (this->major_version (cdr)) == 1 &&
+ static_cast<ACE_CDR::Short> (this->minor_version (cdr)) == 2)
+ {
+ ACE_CDR::Octet len;
+ if (! this->read_1 (cdr, &len))
+ return 0;
+
+ if (len == 2) // no BOM present
+ {
+ ACE_CDR::Short sx;
+
+ if (!this->read_array (cdr,
+ reinterpret_cast<char *> (&sx), 1,1,2))
+ return 0;
+
+#if defined (ACE_LITTLE_ENDIAN)
+ ACE_CDR::Short ux;
+ ACE_CDR::swap_2 (reinterpret_cast<const char*> (&sx),
+ reinterpret_cast<char *> (&ux));
+ x = static_cast<ACE_CDR::WChar> (ux);
+#else
+ x = static_cast<ACE_CDR::WChar> (sx);
+#endif // ACE_LITTLE_ENDIAN
+ return 1;
+ }
+
+ ACE_UTF16_T buf[2];
+ if (len != 4 || !this->read_array (cdr,
+ reinterpret_cast<char *> (buf),
+ 1,1,4)) // get BO & payload
+ return 0;
+ // Check for byte order mark, if found, consume and honor it.
+ if (buf[0] == ACE_UNICODE_BOM_CORRECT ||
+ buf[0] == ACE_UNICODE_BOM_SWAPPED)
+ {
+ // if we found it, but it came in in the wrong order
+ // invert the byte order flag for the duration of this method
+ if (buf[0] == ACE_UNICODE_BOM_SWAPPED)
+ {
+ ACE_CDR::Short ux;
+ ACE_CDR::swap_2 (reinterpret_cast<const char*> (&buf[1]),
+ reinterpret_cast<char *> (&ux));
+ x = static_cast<ACE_CDR::WChar> (ux);
+ }
+ else
+ x = static_cast<ACE_CDR::WChar> (buf[1]);
+ return 1;
+ }
+ // What do we do here? The length is > 2 but the first word
+ // is not a BOM. Just return an error I suppose
+ return 0;
+ }
+
+ ACE_UTF16_T sx;
+ if (this->read_2 (cdr, &sx))
+ {
+ x = static_cast<ACE_CDR::WChar> (sx);
+ return 1;
+ }
+ return 0;
+}
+
+ACE_CDR::Boolean
+TAO_UTF16_BOM_Translator::read_wstring (ACE_InputCDR &cdr,
+ ACE_CDR::WChar *&x)
+{
+ ACE_CDR::ULong len;
+ if (!this->read_4 (cdr, &len))
+ return 0;
+
+ // A check for the length being too great is done later in the
+ // call to read_char_array but we want to have it done before
+ // the memory is allocated.
+ if (len > 0 && len <= cdr.length ())
+ {
+ if (static_cast<ACE_CDR::Short> (this->major_version (cdr)) == 1
+ && static_cast<ACE_CDR::Short> (this->minor_version (cdr)) > 1)
+ {
+ len /= ACE_UTF16_CODEPOINT_SIZE;
+
+ //allocating one extra for the null character needed by applications
+ ACE_NEW_RETURN (x,
+ ACE_CDR::WChar [len + 1],
+ 0);
+
+ x[len] = L'\x00';
+ if (this->read_wchar_array_i (cdr, x, len, 1))
+ {
+ // Since reading the array may have adjusted the length,
+ // we simply rewrite the null terminator
+ x[len] = L'\x00';
+ return 1;
+ }
+ }
+ else
+ {
+ ACE_NEW_RETURN (x,
+ ACE_CDR::WChar [len],
+ 0);
+ if (this->read_wchar_array (cdr, x, len))
+ return 1;
+ }
+ delete [] x;
+ }
+ else if (len == 0)
+ {
+ // Convert any null strings to empty strings since empty
+ // strings can cause crashes. (See bug 58.)
+ ACE_NEW_RETURN (x,
+ ACE_CDR::WChar[1],
+ 0);
+ x[0] = '\x00';
+ return 1;
+ }
+ x = 0;
+ return 0;
+}
+
+ACE_CDR::Boolean
+TAO_UTF16_BOM_Translator::read_wchar_array_i (ACE_InputCDR & cdr,
+ ACE_CDR::WChar *x,
+ ACE_CDR::ULong &length,
+ int adjust_len)
+{
+ int has_bom = 0;
+ int must_swap = 0;
+ char* buf;
+ static const size_t align = ACE_CDR::SHORT_ALIGN;
+ if (cdr.adjust (ACE_UTF16_CODEPOINT_SIZE * length, align, buf) == 0)
+ {
+ // check for byte order mark. If found, honor it then discard it
+ ACE_UTF16_T *sb = reinterpret_cast<ACE_UTF16_T *> (buf);
+ if (*sb == ACE_UNICODE_BOM_CORRECT || *sb == ACE_UNICODE_BOM_SWAPPED)
+ {
+ must_swap = (*sb == ACE_UNICODE_BOM_SWAPPED);
+ has_bom = 1;
+ }
+ else
+ {
+#if defined (ACE_LITTLE_ENDIAN)
+ must_swap = 1;
+#endif // ACE_LITTLE_ENDIAN
+ }
+
+ if (has_bom)
+ {
+ buf += ACE_UTF16_CODEPOINT_SIZE;
+ ++sb;
+
+ if (adjust_len)
+ length -= 1;
+ }
+
+ for (size_t i = 0; i < length; ++i)
+#if defined (ACE_DISABLE_SWAP_ON_READ)
+ x[i] = static_cast<ACE_CDR::WChar> (sb[i]);
+#else
+ if (!must_swap)
+ {
+ x[i] = static_cast<ACE_CDR::WChar> (sb[i]);
+ }
+ else
+ {
+ ACE_CDR::UShort sx;
+ ACE_CDR::swap_2 (&buf[i*2], reinterpret_cast<char *> (&sx));
+ x[i] = static_cast<ACE_CDR::WChar> (sx);
+ }
+#endif /* ACE_DISABLE_SWAP_ON_READ */
+
+ if (has_bom && !adjust_len)
+ {
+ cdr.adjust (ACE_UTF16_CODEPOINT_SIZE, align, buf);
+ }
+ return 1;
+ }
+ return 0;
+}
+
+ACE_CDR::Boolean
+TAO_UTF16_BOM_Translator::read_wchar_array (ACE_InputCDR & cdr,
+ ACE_CDR::WChar *x,
+ ACE_CDR::ULong length)
+{
+ if (length == 0)
+ return 1;
+
+ if (static_cast<ACE_CDR::Short> (this->major_version (cdr)) == 1
+ && static_cast<ACE_CDR::Short> (this->minor_version (cdr)) > 1)
+ {
+ for (size_t i = 0; i < length; ++i)
+ if (!this->read_wchar (cdr, x[i]))
+ return 0;
+
+ return 1;
+ }
+ else
+ return this->read_wchar_array_i (cdr, x, length);
+}
+
+ACE_CDR::Boolean
+TAO_UTF16_BOM_Translator::write_wchar (ACE_OutputCDR &cdr,
+ ACE_CDR::WChar x)
+{
+ return this->write_wchar_i (cdr, x, true);
+}
+
+ACE_CDR::Boolean
+TAO_UTF16_BOM_Translator::write_wchar_i (ACE_OutputCDR &cdr,
+ ACE_CDR::WChar x,
+ bool allow_BOM)
+{
+ if (static_cast<ACE_CDR::Short> (this->major_version (cdr)) == 1
+ && static_cast<ACE_CDR::Short> (this->minor_version (cdr)) > 1)
+ {
+ int len = 0;
+ ACE_CDR::UShort buffer[2];
+
+ if( allow_BOM && cdr.byte_order())
+ {
+ len = 2;
+#if defined (ACE_LITTLE_ENDIAN)
+ if (this->forceBE_)
+ {
+ // force both the byte order mark and the data to Big Endian order
+ buffer[0] = ACE_UNICODE_BOM_SWAPPED;
+ ACE_CDR::swap_2 (reinterpret_cast<const char *> (&x),
+ reinterpret_cast<char *> (&buffer[1]));
+ }
+ else
+#endif
+ {
+ // store both the byte order mark and the data in native order
+ buffer[0] = ACE_UNICODE_BOM_CORRECT;
+ buffer[1] = static_cast<ACE_CDR::Short> (x);
+ }
+ }
+ else
+ {
+ // not using a byte order mark
+ // force it to be big endian w/o BOM
+ len = 1;
+ if (cdr.byte_order ())
+ ACE_CDR::swap_2 (reinterpret_cast<const char *> (&x),
+ reinterpret_cast<char *> (buffer));
+ else
+ buffer[0] = static_cast<ACE_CDR::Short> (x);
+ }
+
+ unsigned char tcsize =
+ static_cast<unsigned char> (len * ACE_UTF16_CODEPOINT_SIZE);
+
+ if (this->write_1 (cdr, &tcsize))
+ return this->write_array(cdr, &buffer, tcsize, 1, 1);
+ else
+ return 0;
+ }
+ else if (static_cast<ACE_CDR::Short> (this->minor_version (cdr)) != 0)
+ {
+ // GIOP 1.1 simple support
+ ACE_UTF16_T sx = static_cast<ACE_UTF16_T> (x);
+ return this->write_2 (cdr, &sx);
+ }
+ else
+ { // wchar is not allowed with GIOP 1.0.
+ errno = EINVAL;
+ return 0;
+ }
+}
+
+ACE_CDR::Boolean
+TAO_UTF16_BOM_Translator::write_wstring (ACE_OutputCDR & cdr,
+ ACE_CDR::ULong len,
+ const ACE_CDR::WChar *x)
+{
+ // we'll accept a null pointer but only for an empty string
+ ACE_ASSERT (x != 0 || len == 0);
+ if (static_cast<ACE_CDR::Short> (this->major_version (cdr)) == 1
+ && static_cast<ACE_CDR::Short> (this->minor_version (cdr)) > 1)
+ {
+ if (len == 0) // for zero length strings, only write a length of
+ // zero. The BOM is not needed in this case.
+ return this->write_4(cdr, &len);
+
+ if (this->forceBE_ && cdr.byte_order())
+ {
+ ACE_CDR::ULong l = (len+1) *
+ static_cast<ACE_CDR::ULong> (
+ ACE_UTF16_CODEPOINT_SIZE);
+ if (this->write_4 (cdr, &l) &&
+ this->write_2 (cdr, &ACE_UNICODE_BOM_SWAPPED) &&
+ x != 0)
+ return this->write_swapped_wchar_array_i (cdr, x, len);
+ }
+ else
+ {
+ ACE_CDR::ULong l = (len+1) *
+ static_cast<ACE_CDR::ULong> (
+ ACE_UTF16_CODEPOINT_SIZE);
+ if (this->write_4 (cdr, &l) &&
+ this->write_2 (cdr, &ACE_UNICODE_BOM_CORRECT) &&
+ x != 0)
+ return this->write_wchar_array_i (cdr, x, len);
+ }
+ }
+ else
+ {
+ // pre GIOP 1.2: include null terminator in length
+ ACE_CDR::ULong l = len + 1;
+ if (this->write_4 (cdr, &l))
+ if (x != 0)
+ return this->write_wchar_array_i (cdr, x, len + 1);
+ else
+ {
+ ACE_UTF16_T s = 0;
+ return this->write_2 (cdr,&s);
+ }
+ }
+
+ return 0;
+}
+
+ACE_CDR::Boolean
+TAO_UTF16_BOM_Translator::write_wchar_array (ACE_OutputCDR & cdr,
+ const ACE_CDR::WChar *x,
+ ACE_CDR::ULong length)
+{
+ if (static_cast<ACE_CDR::Short> (this->major_version (cdr)) == 1
+ && static_cast<ACE_CDR::Short> (this->minor_version (cdr)) > 1)
+ {
+ for (size_t i = 0; i < length; ++i)
+ if (this->write_wchar_i (cdr, x[i], false) == 0)
+ return 0;
+
+ return 1;
+ }
+
+ return this->write_wchar_array_i (cdr, x, length);
+}
+
+ACE_CDR::Boolean
+TAO_UTF16_BOM_Translator::write_wchar_array_i (ACE_OutputCDR & cdr,
+ const ACE_CDR::WChar *x,
+ ACE_CDR::ULong length)
+{
+ if (length == 0)
+ return 1;
+ char* buf;
+ static const size_t align = ACE_CDR::SHORT_ALIGN;
+ if (cdr.adjust (ACE_UTF16_CODEPOINT_SIZE * length, align, buf)
+ != 0)
+ {
+ return 0;
+ }
+
+ ACE_UTF16_T *sb = reinterpret_cast<ACE_UTF16_T *> (buf);
+
+ for (size_t i = 0; i < length; ++i)
+ {
+ sb[i] = static_cast<ACE_UTF16_T> (x[i]);
+ }
+ return 1;
+
+}
+
+ACE_CDR::Boolean
+TAO_UTF16_BOM_Translator::write_swapped_wchar_array_i (ACE_OutputCDR & cdr,
+ const ACE_CDR::WChar *x,
+ ACE_CDR::ULong length)
+{
+ if (length == 0)
+ return 1;
+ char* buf;
+ static const size_t align = ACE_CDR::SHORT_ALIGN;
+ if (cdr.adjust (ACE_UTF16_CODEPOINT_SIZE * length, align, buf)
+ != 0)
+ {
+ return 0;
+ }
+
+ ACE_UTF16_T *sb = reinterpret_cast<ACE_UTF16_T *> (buf);
+
+ for (size_t i = 0; i < length; ++i)
+ {
+ ACE_CDR::swap_2 (reinterpret_cast<const char*> (&x[i]),
+ reinterpret_cast<char *> (&sb[i]));
+ }
+ return 1;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Codeset/UTF16_BOM_Translator.h b/TAO/tao/Codeset/UTF16_BOM_Translator.h
new file mode 100644
index 00000000000..6dbe046621d
--- /dev/null
+++ b/TAO/tao/Codeset/UTF16_BOM_Translator.h
@@ -0,0 +1,101 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file UTF16_BOM_Translator.h
+ *
+ * $Id$
+ *
+ *
+ *
+ * @author Phil Mesnier <mesnier_p@ociweb.com>
+ */
+//=============================================================================
+
+#ifndef UTF16_BOM_TRANSLATOR_H
+#define UTF16_BOM_TRANSLATOR_H
+#include /**/ "ace/pre.h"
+
+#include "ace/config-all.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Codeset/codeset_export.h"
+#include "tao/Versioned_Namespace.h"
+#include "ace/CDR_Stream.h"
+
+
+// ****************************************************************
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_UTF16_BOM_Translator
+ *
+ * @brief Codeset translation specialization - Manages Byte Order Marker
+ *
+ * This class performs the codeset translation:
+ * - Native: UTF16 (i.e. Unicode)
+ * - Stream: UTF16 with Byte Order Marker
+ */
+class TAO_Codeset_Export TAO_UTF16_BOM_Translator
+ : public ACE_WChar_Codeset_Translator
+{
+public:
+ /// constructor
+ /// @param forceBE: true forces all wchar, warray, and wstrings to big-endian byte order
+ TAO_UTF16_BOM_Translator (bool forceBE);
+
+ /// Virtual destruction
+ virtual ~TAO_UTF16_BOM_Translator (void);
+
+ // = Documented in $ACE_ROOT/ace/CDR_Stream.h
+ virtual ACE_CDR::Boolean read_wchar (ACE_InputCDR &,
+ ACE_CDR::WChar &);
+ virtual ACE_CDR::Boolean read_wstring (ACE_InputCDR &,
+ ACE_CDR::WChar *&);
+ virtual ACE_CDR::Boolean read_wchar_array (ACE_InputCDR &,
+ ACE_CDR::WChar *,
+ ACE_CDR::ULong);
+ virtual ACE_CDR::Boolean write_wchar (ACE_OutputCDR &,
+ ACE_CDR::WChar);
+ virtual ACE_CDR::Boolean write_wstring (ACE_OutputCDR &,
+ ACE_CDR::ULong,
+ const ACE_CDR::WChar *);
+ virtual ACE_CDR::Boolean write_wchar_array (ACE_OutputCDR &,
+ const ACE_CDR::WChar *,
+ ACE_CDR::ULong);
+ virtual ACE_CDR::ULong ncs () {return 0x00010109;}
+ virtual ACE_CDR::ULong tcs () {return 0x00010109;}
+
+private:
+ ACE_CDR::Boolean read_wchar_array_i (ACE_InputCDR &,
+ ACE_CDR::WChar *,
+ ACE_CDR::ULong&,
+ int adjust_len = 0);
+
+ ACE_CDR::Boolean write_wchar_array_i (ACE_OutputCDR &,
+ const ACE_CDR::WChar *,
+ ACE_CDR::ULong);
+
+ ACE_CDR::Boolean write_swapped_wchar_array_i (ACE_OutputCDR & cdr,
+ const ACE_CDR::WChar *x,
+ ACE_CDR::ULong length);
+
+
+ ACE_CDR::Boolean write_wchar_i (ACE_OutputCDR &,
+ ACE_CDR::WChar ,
+ bool allow_BOM);
+
+private:
+ /// if this flag is true, force wchar's to big endian order
+ bool forceBE_;
+
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* UTF16_BOM_TRANSLATOR_H */
diff --git a/TAO/tao/Codeset/UTF8_Latin1_Factory.cpp b/TAO/tao/Codeset/UTF8_Latin1_Factory.cpp
new file mode 100644
index 00000000000..2298e093c7d
--- /dev/null
+++ b/TAO/tao/Codeset/UTF8_Latin1_Factory.cpp
@@ -0,0 +1,91 @@
+// $Id$
+#include "tao/debug.h"
+#include "ace/Dynamic_Service.h"
+#include "ace/Log_Msg.h"
+#include "tao/Codeset/UTF8_Latin1_Factory.h"
+
+ACE_STATIC_SVC_DEFINE (TAO_UTF8_Latin1_Factory,
+ ACE_TEXT ("UTF8_Latin1_Factory"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (TAO_UTF8_Latin1_Factory),
+ ACE_Service_Type::DELETE_THIS
+ | ACE_Service_Type::DELETE_OBJ,
+ 0)
+ACE_FACTORY_DEFINE (TAO_Codeset, TAO_UTF8_Latin1_Factory)
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_UTF8_Latin1_Factory::TAO_UTF8_Latin1_Factory()
+ : translator_ (0)
+{
+}
+
+TAO_UTF8_Latin1_Factory::~TAO_UTF8_Latin1_Factory ()
+{
+ delete this->translator_;
+}
+int
+TAO_UTF8_Latin1_Factory::init (int argc, ACE_TCHAR *argv[])
+{
+ TAO_Codeset_Translator_Factory::init (argc, argv);
+ return 0;
+}
+
+CONV_FRAME::CodeSetId
+TAO_UTF8_Latin1_Factory::ncs () const
+{
+ create_translator();
+ return this->translator_->ncs();
+}
+
+CONV_FRAME::CodeSetId
+TAO_UTF8_Latin1_Factory::tcs () const
+{
+ create_translator();
+ return this->translator_->tcs();
+}
+
+// Assign either a reference to the existing translator or a new translator
+// for input CDR streams
+void
+TAO_UTF8_Latin1_Factory::assign (TAO_InputCDR *cdr) const
+{
+ if (cdr)
+ {
+ create_translator();
+ this->assign_i(cdr,this->translator_);
+ }
+}
+
+// Assign either a reference to the existing translator or a new translator
+// for output CDR streams
+void
+TAO_UTF8_Latin1_Factory::assign (TAO_OutputCDR *cdr) const
+{
+ if (cdr)
+ {
+ create_translator();
+ this->assign_i(cdr,this->translator_);
+ }
+}
+
+void
+TAO_UTF8_Latin1_Factory::create_translator () const
+{
+ if (this->translator_ == 0)
+ {
+ TAO_UTF8_Latin1_Factory * pthis =
+ const_cast <TAO_UTF8_Latin1_Factory *>(this);
+ ACE_NEW (pthis->translator_, TAO_UTF8_Latin1_Translator);
+ if (this->translator_ == 0)
+ {
+ if (TAO_debug_level)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) TAO_UTF8_Latin1_Factory cannot ")
+ ACE_TEXT("create TAO_UTF8_Latin1_Translator\n")
+ ));
+ }
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Codeset/UTF8_Latin1_Factory.h b/TAO/tao/Codeset/UTF8_Latin1_Factory.h
new file mode 100644
index 00000000000..292333ad7e0
--- /dev/null
+++ b/TAO/tao/Codeset/UTF8_Latin1_Factory.h
@@ -0,0 +1,53 @@
+// -*- C++ -*-
+// $Id$
+
+#ifndef UTF8_LATIN1_FACTORY_H
+#define UTF8_LATIN1_FACTORY_H
+
+#include /**/ "ace/pre.h"
+#include "tao/Codeset/codeset_export.h"
+#include "ace/Service_Config.h"
+#include "tao/Codeset/Codeset_Translator_Factory.h"
+
+#include "tao/Codeset/UTF8_Latin1_Translator.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Codeset_Export TAO_UTF8_Latin1_Factory
+ : public TAO_Codeset_Translator_Factory
+{
+public:
+ TAO_UTF8_Latin1_Factory ();
+ virtual ~TAO_UTF8_Latin1_Factory ();
+ virtual int init (int argc, ACE_TCHAR *argv[]);
+
+ /// ncs returns the translator's native codeset ID.
+ CONV_FRAME::CodeSetId ncs () const;
+ /// tcs returns the translator's transmission codeset ID.
+ CONV_FRAME::CodeSetId tcs () const;
+
+ /// Assign the translator to the input CDR. The inherited assign_i is used
+ /// to assign either a char or wchar translator, depending on the base type
+ /// of NCS_TO_TCS. A null input CDR is permitted, in which case assign is a
+ /// no-op.
+ virtual void assign (TAO_InputCDR *) const;
+ /// Assign the translator to the output CDR. The inherited assign_i is used
+ /// to assign either a char or wchar translator, depending on the base type
+ /// of NCS_TO_TCS. A null output CDR is permitted, in which case assign is a
+ /// no-op.
+ virtual void assign (TAO_OutputCDR *) const;
+
+private:
+ void create_translator () const;
+
+private:
+ TAO_UTF8_Latin1_Translator *translator_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE_EXPORT (TAO_Codeset, TAO_UTF8_Latin1_Factory)
+ACE_FACTORY_DECLARE (TAO_Codeset, TAO_UTF8_Latin1_Factory)
+
+#include /**/ "ace/post.h"
+#endif /* UTF8_LATIN1_FACTORY_H */
diff --git a/TAO/tao/Codeset/UTF8_Latin1_Translator.cpp b/TAO/tao/Codeset/UTF8_Latin1_Translator.cpp
new file mode 100644
index 00000000000..204a1dc0bd6
--- /dev/null
+++ b/TAO/tao/Codeset/UTF8_Latin1_Translator.cpp
@@ -0,0 +1,224 @@
+// -*- C++ -*-
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// ace
+//
+// = FILENAME
+// UTF8_Latin1_Translator.cpp
+//
+// = DESCRIPTION
+// Defines the methods required to convert UTF-8 based unicode strings
+// to the Latin-1 codeset.
+//
+// = AUTHOR
+// Phil Mesnier <mesnier_p@ociweb.com>
+//
+// ============================================================================
+#include "tao/Codeset/UTF8_Latin1_Translator.h"
+#include "tao/debug.h"
+#include "ace/OS_Memory.h"
+
+// ****************************************************************
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/////////////////////////////
+// UTF8_Latin1_Translator implementation
+
+TAO_UTF8_Latin1_Translator::TAO_UTF8_Latin1_Translator ()
+{
+}
+
+TAO_UTF8_Latin1_Translator::~TAO_UTF8_Latin1_Translator (void)
+{
+}
+
+// = Documented in $ACE_ROOT/ace/CDR_Stream.h
+ACE_CDR::Boolean
+TAO_UTF8_Latin1_Translator::read_char (ACE_InputCDR &cdr, ACE_CDR::Char &x)
+{
+ // We cannot have a codepoint > 0xBF at this point, since we are expecting
+ // only one single char.
+ ACE_CDR::Octet ox;
+ if (this->read_1 (cdr, &ox))
+ {
+ if (ox < 0xC0)
+ {
+ x = ox;
+ return 1;
+ }
+ }
+ return 0;
+}
+
+ACE_CDR::ULong
+TAO_UTF8_Latin1_Translator::read_char_i (ACE_InputCDR &cdr, ACE_CDR::Char &x)
+{
+ // This will read up to 2 octets and combine them into one char if possible
+ ACE_CDR::Octet upper;
+ if (this->read_1 (cdr, &upper))
+ {
+ if ( upper >= 0xC4) // Anything with a leading char > 110001xx converts
+ // to a codepoint value > 0x00FF, thus won't fit in
+ // a single char.
+ return 0;
+ if ( upper < 0xC0 )
+ {
+ x = static_cast<ACE_CDR::Char>(upper);
+ return 1;
+ }
+ ACE_CDR::Octet lower;
+ if (this->read_1 (cdr, &lower))
+ {
+ ACE_CDR::Octet final = ((upper & 0xBF) << 6) + (lower & 0xC0);
+ x = static_cast<ACE_CDR::Char>(final);
+ return 2;
+ };
+ }
+ return 0;
+}
+
+ACE_CDR::Boolean
+TAO_UTF8_Latin1_Translator::read_string (ACE_InputCDR &cdr,
+ ACE_CDR::Char *&x)
+{
+ ACE_CDR::ULong len;
+ if (!cdr.read_ulong (len))
+ return 0;
+
+ // A check for the length being too great is done later in the
+ // call to read_char_array but we want to have it done before
+ // the memory is allocated.
+ if (len > 0 && len <= cdr.length())
+ {
+ ACE_NEW_RETURN (x,
+ ACE_CDR::Char [len],
+ 0);
+ // pos keeps track of the character position, it will never be
+ // greater than len
+ size_t pos = 0;
+ ACE_CDR::ULong incr = 1;
+ for (ACE_CDR::ULong i = 0; incr > 0 && i < len; i += incr)
+ {
+ incr = this->read_char_i(cdr,x[pos++]);
+ }
+ if (incr > 0)
+ return 1;
+ delete [] x;
+ }
+ else if (len == 0)
+ {
+ // Convert any null strings to empty strings since empty
+ // strings can cause crashes. (See bug 58.)
+ ACE_NEW_RETURN (x,
+ ACE_CDR::Char[1],
+ 0);
+ x[0] = '\x00';
+ return 1;
+ }
+ x = 0;
+ return 0;
+}
+
+ACE_CDR::Boolean
+TAO_UTF8_Latin1_Translator::read_char_array (ACE_InputCDR & cdr,
+ ACE_CDR::Char *x,
+ ACE_CDR::ULong length)
+{
+ if (length == 0)
+ return 1;
+
+ for (size_t i = 0; i < length; ++i)
+ if (!this->read_char(cdr,x[i]))
+ return 0;
+
+ return 1;
+}
+
+ACE_CDR::Boolean
+TAO_UTF8_Latin1_Translator::write_char (ACE_OutputCDR &cdr,
+ ACE_CDR::Char x)
+{
+ ACE_CDR::Octet ox = x;
+ if (ox < 0xC0)
+ return this->write_1 (cdr,&ox);
+ else
+ { // character cannot be represented in a single octet
+ errno = EINVAL;
+ return 0;
+ }
+}
+
+ACE_CDR::Boolean
+TAO_UTF8_Latin1_Translator::write_char_i (ACE_OutputCDR &cdr,
+ ACE_CDR::Char x)
+{
+ // @@@ Strictly speaking, we should test for 7F < x < C0 and do
+ // something else in that case, but for now we will just let it
+ // pass.
+
+ ACE_CDR::Octet ox = x;
+ if (ox < 0xC0)
+ return this->write_1 (cdr,&ox);
+ else
+ { // character cannot be represented in a single octet
+ // Since the source will never be > 0xFF, we don't have to worry about
+ // using a third octet.
+ ACE_CDR::Octet upper = 0xC0 + (ox >> 6);
+ ACE_CDR::Octet lower = 0x80 + (ox & 0x3F);
+ if (this->write_1(cdr, &upper))
+ return this->write_1(cdr, &lower);
+ }
+ return 0;
+}
+
+ACE_CDR::Boolean
+TAO_UTF8_Latin1_Translator::write_string (ACE_OutputCDR & cdr,
+ ACE_CDR::ULong len,
+ const ACE_CDR::Char *x)
+{
+ // we'll accept a null pointer but only for an empty string
+ if (x == 0 && len != 0)
+ return 0;
+
+ ACE_CDR::ULong l = len;
+ // Compute the real buffer size by adding in multi-byte codepoints.
+ for (ACE_CDR::ULong i = 0; i < len; i++)
+ if (static_cast<ACE_CDR::Octet>(x[i]) > 0xbf) l++;
+
+ // Always add one for the nul
+ l++;
+ if (cdr.write_ulong (l))
+ {
+ for (ACE_CDR::ULong i = 0; i < len; ++i)
+ {
+ if (this->write_char_i (cdr,x[i]) == 0)
+ return 0;
+ }
+ ACE_CDR::Octet s = 0;
+ return this->write_1 (cdr, &s);
+ }
+ return 0;
+}
+
+ACE_CDR::Boolean
+TAO_UTF8_Latin1_Translator::write_char_array (ACE_OutputCDR & cdr,
+ const ACE_CDR::Char *x,
+ ACE_CDR::ULong length)
+{
+ if (length == 0)
+ return 1;
+
+ for (size_t i = 0; i < length; ++i)
+ // We still have to write each char individually, as any translated
+ // value may fail to fit in a single octet.
+ if (this->write_char (cdr, x[i]) == 0)
+ return 0;
+
+ return 1;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Codeset/UTF8_Latin1_Translator.h b/TAO/tao/Codeset/UTF8_Latin1_Translator.h
new file mode 100644
index 00000000000..791ea994d43
--- /dev/null
+++ b/TAO/tao/Codeset/UTF8_Latin1_Translator.h
@@ -0,0 +1,89 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file UTF8_Latin1_Translator.h
+ *
+ * $Id$
+ *
+ *
+ *
+ * @author Phil Mesnier <mesnier_p@ociweb.com>
+ */
+//=============================================================================
+
+#ifndef UTF8_LATIN1_TRANSLATOR_H
+#define UTF8_LATIN1_TRANSLATOR_H
+#include /**/ "ace/pre.h"
+
+#include "ace/config-all.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Codeset/codeset_export.h"
+#include "tao/Versioned_Namespace.h"
+#include "ace/CDR_Stream.h"
+
+// ****************************************************************
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class UTF8_Latin1_Translator
+ *
+ * @brief Codeset translation specialization - Manages Byte Order Marker
+ *
+ * This class performs the codeset translation:
+ * - Native: ISO-8859-1 (i.e. Latin 1)
+ * - Stream: UTF-8 (8 bit unicode mapping)
+ *
+ * When writing chars, it is possible to raise a DATA_CONVERSION exception
+ * because some valid Latin codepoints map to 2-byte utf-8 codepoints.
+ *
+ * When reading strings, it is possible to raise a DATA_CONVERSION exception
+ * because the string may include utf-8 unicode codepoints > 0x00FF.
+ */
+class TAO_Codeset_Export TAO_UTF8_Latin1_Translator
+ : public ACE_Char_Codeset_Translator
+{
+public:
+ /// constructor
+ TAO_UTF8_Latin1_Translator ();
+
+ /// Virtual destruction
+ virtual ~TAO_UTF8_Latin1_Translator (void);
+
+ // = Documented in $ACE_ROOT/ace/CDR_Stream.h
+ virtual ACE_CDR::Boolean read_char (ACE_InputCDR &,
+ ACE_CDR::Char &);
+ virtual ACE_CDR::Boolean read_string (ACE_InputCDR &,
+ ACE_CDR::Char *&);
+ virtual ACE_CDR::Boolean read_char_array (ACE_InputCDR &,
+ ACE_CDR::Char *,
+ ACE_CDR::ULong);
+ virtual ACE_CDR::Boolean write_char (ACE_OutputCDR &,
+ ACE_CDR::Char);
+ virtual ACE_CDR::Boolean write_string (ACE_OutputCDR &,
+ ACE_CDR::ULong,
+ const ACE_CDR::Char *);
+ virtual ACE_CDR::Boolean write_char_array (ACE_OutputCDR &,
+ const ACE_CDR::Char *,
+ ACE_CDR::ULong);
+ virtual ACE_CDR::ULong ncs () {return 0x00010001U;}
+ virtual ACE_CDR::ULong tcs () {return 0x05010001U;}
+
+private:
+ ACE_CDR::ULong read_char_i (ACE_InputCDR &,
+ ACE_CDR::Char &);
+
+ ACE_CDR::Boolean write_char_i (ACE_OutputCDR &,
+ ACE_CDR::Char);
+
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* UTF8_LATIN1_TRANSLATOR_H */
diff --git a/TAO/tao/Codeset/codeset_export.h b/TAO/tao/Codeset/codeset_export.h
new file mode 100644
index 00000000000..0c7a2863484
--- /dev/null
+++ b/TAO/tao/Codeset/codeset_export.h
@@ -0,0 +1,40 @@
+
+// -*- C++ -*-
+// $Id$
+// Definition for Win32 Export directives.
+// This file is generated automatically by generate_export_file.pl
+// ------------------------------
+#ifndef TAO_CODESET_EXPORT_H
+#define TAO_CODESET_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if defined (TAO_AS_STATIC_LIBS)
+# if !defined (TAO_CODESET_HAS_DLL)
+# define TAO_CODESET_HAS_DLL 0
+# endif /* ! TAO_CODESET_HAS_DLL */
+#else
+# if !defined (TAO_CODESET_HAS_DLL)
+# define TAO_CODESET_HAS_DLL 1
+# endif /* ! TAO_CODESET_HAS_DLL */
+#endif
+
+#if defined (TAO_CODESET_HAS_DLL) && (TAO_CODESET_HAS_DLL == 1)
+# if defined (TAO_CODESET_BUILD_DLL)
+# define TAO_Codeset_Export ACE_Proper_Export_Flag
+# define TAO_CODESET_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# define TAO_CODESET_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# else /* TAO_CODESET_BUILD_DLL */
+# define TAO_Codeset_Export ACE_Proper_Import_Flag
+# define TAO_CODESET_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# define TAO_CODESET_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# endif /* TAO_CODESET_BUILD_DLL */
+#else /* TAO_CODESET_HAS_DLL == 1 */
+# define TAO_Codeset_Export
+# define TAO_CODESET_SINGLETON_DECLARATION(T)
+# define TAO_CODESET_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+#endif /* TAO_CODESET_HAS_DLL == 1 */
+
+#endif /* TAO_CODESET_EXPORT_H */
+
+// End of auto generated file.
diff --git a/TAO/tao/Codeset_Descriptor_Base.h b/TAO/tao/Codeset_Descriptor_Base.h
new file mode 100644
index 00000000000..201de5e9bd3
--- /dev/null
+++ b/TAO/tao/Codeset_Descriptor_Base.h
@@ -0,0 +1,49 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Codeset_Descriptor_Base.h
+ *
+ * $Id$
+ *
+ * @author Phil Mesnier
+ */
+//=============================================================================
+
+#ifndef TAO_CODESET_DESCRIPTOR_BASE_H
+#define TAO_CODESET_DESCRIPTOR_BASE_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/TAO_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Versioned_Namespace.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/*
+ * TAO_Codeset_Descriptor_Base describes the necessary interface for
+ * Objects within libTAO to be able to supply information to the codeset
+ * subsystem, as required.
+ *
+ * This class also serves as a default implementation when codeset support
+ * is not linked in.
+ */
+class TAO_Export TAO_Codeset_Descriptor_Base
+{
+public:
+ virtual ~TAO_Codeset_Descriptor_Base (void);
+
+ virtual void ncs (const ACE_TCHAR *name) = 0;
+ virtual void add_translator (const ACE_TCHAR *name) = 0;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_CODESET_DESCRIPTOR_BASE_H */
diff --git a/TAO/tao/Codeset_Manager.cpp b/TAO/tao/Codeset_Manager.cpp
new file mode 100644
index 00000000000..0402bfc6aea
--- /dev/null
+++ b/TAO/tao/Codeset_Manager.cpp
@@ -0,0 +1,23 @@
+// $Id$
+
+#include "tao/Codeset_Manager.h"
+#include "tao/Codeset_Descriptor_Base.h"
+
+ACE_RCSID (tao,
+ Codeset_Manager,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Codeset_Manager::~TAO_Codeset_Manager (void)
+{
+}
+
+// Add the destructor for the codeset_descriptor_base here, because
+// it is only ever used in conjunction with the codeset manager.
+
+TAO_Codeset_Descriptor_Base::~TAO_Codeset_Descriptor_Base (void)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Codeset_Manager.h b/TAO/tao/Codeset_Manager.h
new file mode 100644
index 00000000000..163014327b1
--- /dev/null
+++ b/TAO/tao/Codeset_Manager.h
@@ -0,0 +1,103 @@
+// -*- C++ -*-
+
+//=============================================================================
+/*
+ * @file Codeset_Manager.h
+ *
+ * $Id$
+ *
+ * Interface for the TAO CodeSet Manager.
+ *
+ * @author Mahesh Vedantam <mahesh@ociweb.com>
+ */
+//=============================================================================
+
+#ifndef TAO_CODESET_MANAGER_H
+#define TAO_CODESET_MANAGER_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/TAO_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/CONV_FRAMEC.h"
+
+ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+class ACE_WChar_Codeset_Translator;
+ACE_END_VERSIONED_NAMESPACE_DECL
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Profile;
+class TAO_Transport;
+class TAO_Operation_Details;
+
+class TAO_ServerRequest;
+class TAO_Tagged_Components;
+class TAO_Codeset_Translator_Base;
+class TAO_Codeset_Descriptor_Base;
+
+
+// ****************************************************************
+
+/**
+ * @class TAO_Codeset_Manager
+ *
+ * @brief The encapsulation of logic for codeset negotiation
+ *
+ * The Codeset Manager is owned by the ORB_Core, initialized through Resource
+ * Factory configuration options. The codeset manager participates in profile
+ * creation by servers and connection establishment by clients. The involvement
+ * is necessary to supply a codeset component to the profile including for both
+ * chars and wide chars the native code set and any conversion code sets for
+ * which translators are available. The codeset manager is also responsible for
+ * determining the transmission codesets based an the local and remote codeset
+ * information. The transmission codesets are communicated via a service
+ * context attached to the first request sent on the new connection.
+ *
+ */
+class TAO_Export TAO_Codeset_Manager
+{
+
+public:
+
+ /// Destructor.
+ virtual ~TAO_Codeset_Manager (void);
+
+ /// Called by an object of TAO_Acceptor to set NCS and CCS values for
+ /// Char/Wchar in to the Object Reference.
+ virtual void set_codeset (TAO_Tagged_Components& ) const = 0;
+
+ /// Called from an object of "TAO_GIOP_Invocation" to set TCS on the
+ /// Transport
+ virtual void set_tcs (TAO_Profile &theProfile, TAO_Transport &) = 0;
+
+ /// Called from an Object of TAO_Messaging for every request at server side
+ /// to process service context and set TCS for Char/WChar
+ virtual void process_service_context (TAO_ServerRequest &) = 0;
+
+ /// Called by a client object to generate service context
+ /// at this time Transport has the TCS for Char and WChar
+ virtual void generate_service_context (TAO_Operation_Details&, TAO_Transport & ) = 0;
+
+ virtual TAO_Codeset_Translator_Base * get_char_trans (CONV_FRAME::CodeSetId tcs) = 0;
+
+ virtual TAO_Codeset_Translator_Base * get_wchar_trans (CONV_FRAME::CodeSetId tcs) = 0;
+
+ virtual void open (void) = 0;
+
+ virtual TAO_Codeset_Descriptor_Base *char_codeset_descriptor (void) = 0;
+ virtual TAO_Codeset_Descriptor_Base *wchar_codeset_descriptor (void) = 0;
+
+ virtual void get_ncs (CONV_FRAME::CodeSetId &ncsc,
+ CONV_FRAME::CodeSetId &ncsw) = 0;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_CODESET_MANAGER_H */
diff --git a/TAO/tao/Codeset_Manager_Factory_Base.cpp b/TAO/tao/Codeset_Manager_Factory_Base.cpp
new file mode 100644
index 00000000000..96a37e46d02
--- /dev/null
+++ b/TAO/tao/Codeset_Manager_Factory_Base.cpp
@@ -0,0 +1,51 @@
+// $Id$
+
+#include "tao/ORB_Core.h"
+#include "tao/Codeset_Manager.h"
+#include "tao/Codeset_Manager_Factory_Base.h"
+
+ACE_RCSID (tao,
+ Codeset_Manager_Factory_Base,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Codeset_Manager_Factory_Base::~TAO_Codeset_Manager_Factory_Base (void)
+{
+}
+
+bool
+TAO_Codeset_Manager_Factory_Base::is_default (void) const
+{
+ return true;
+}
+
+TAO_Codeset_Manager *
+TAO_Codeset_Manager_Factory_Base::create (void)
+{
+ return 0;
+
+}
+
+int
+TAO_Codeset_Manager_Factory_Base::initialize (void)
+{
+ return ACE_Service_Config::process_directive
+ (ace_svc_desc_TAO_Codeset_Manager_Factory_Base);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if 0
+static int
+TAO_Requires_Codeset_Manager_Factory_Base =
+TAO_Codeset_Manager_Factory_Base::initialize ();
+#endif
+
+ACE_FACTORY_DEFINE (TAO, TAO_Codeset_Manager_Factory_Base)
+ACE_STATIC_SVC_DEFINE (TAO_Codeset_Manager_Factory_Base,
+ ACE_TEXT ("TAO_Codeset"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (TAO_Codeset_Manager_Factory_Base),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0)
diff --git a/TAO/tao/Codeset_Manager_Factory_Base.h b/TAO/tao/Codeset_Manager_Factory_Base.h
new file mode 100644
index 00000000000..bb7ed57bb88
--- /dev/null
+++ b/TAO/tao/Codeset_Manager_Factory_Base.h
@@ -0,0 +1,77 @@
+// -*- C++ -*-
+
+//=============================================================================
+/*
+ * @file Codeset_Manager_Factory_Base.h
+ *
+ * $Id$
+ *
+ * Interface for the TAO CodeSet Manager.
+ *
+ * @author Mahesh Vedantam <mahesh@ociweb.com>
+ */
+//=============================================================================
+
+#ifndef TAO_CODESET_MANAGER_FACTORY_BASE_H
+#define TAO_CODESET_MANAGER_FACTORY_BASE_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/TAO_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Versioned_Namespace.h"
+
+#include "ace/Service_Object.h"
+#include "ace/Service_Config.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Codeset_Manager;
+
+/**
+ * @class TAO_Codeset_Manager_Factory_Base
+ *
+ * @brief Base class for creating instances of the codeset manager.
+ *
+ * @description The base also provides a default implementation which
+ * instantiates nothing. This default impl is replaced by the actual
+ * implementation if libTAO_Codeset is loaded.
+ *
+ */
+
+class TAO_Export TAO_Codeset_Manager_Factory_Base : public ACE_Service_Object
+{
+public:
+ virtual ~TAO_Codeset_Manager_Factory_Base ();
+
+ /// Create makes a new instance of the codeset manager for every
+ /// call. This allows multiple ORBs to have their own (or none).
+ /// This default implementation returns a null pointer only.
+ virtual TAO_Codeset_Manager *create(void);
+
+ /// Is_default is called by the ORB Core to determine if it needs
+ /// to reload the factory with a dynamically linked libTAO_Codeset.
+ /// Statically linked applications get derive implementation by
+ /// including "tao/Codeset/Codeset.h" somewhere in their source code.
+ virtual bool is_default (void) const;
+
+ /// Static initializer ensures the factory is loaded
+ static int initialize (void);
+};
+
+static int
+TAO_Requires_Base_Codeset_Initializer =
+ TAO_Codeset_Manager_Factory_Base::initialize ();
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE (TAO_Codeset_Manager_Factory_Base)
+ACE_FACTORY_DECLARE (TAO, TAO_Codeset_Manager_Factory_Base)
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_CODESET_MANAGER_FACTORY_BASE_H */
diff --git a/TAO/tao/Codeset_Translator_Base.cpp b/TAO/tao/Codeset_Translator_Base.cpp
new file mode 100644
index 00000000000..e72a02359f3
--- /dev/null
+++ b/TAO/tao/Codeset_Translator_Base.cpp
@@ -0,0 +1,33 @@
+// -*- C++ -*-
+
+// =====================================================================
+//
+// = LIBRARY
+// TAO/tao
+//
+// = FILENAME
+// Codeset_Translator_Base.cpp
+//
+// = DESCRIPTION The base for all the translator factories. Translator
+// factories are responsible for supplying the proper translator on
+// demand.
+//
+// = AUTHORS
+// Phil Mesnier <mesnier_p@ociweb.com>
+//
+// =====================================================================
+
+#include "tao/Codeset_Translator_Base.h"
+
+ACE_RCSID (tao,
+ Codeset_Translator_Base,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Codeset_Translator_Base::~TAO_Codeset_Translator_Base (void)
+{
+
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Codeset_Translator_Base.h b/TAO/tao/Codeset_Translator_Base.h
new file mode 100644
index 00000000000..c2af91a7522
--- /dev/null
+++ b/TAO/tao/Codeset_Translator_Base.h
@@ -0,0 +1,79 @@
+// -*- C++ -*-
+
+// ===================================================================
+/**
+ * @file Codeset_Translator_Base.h
+ *
+ * $Id$
+ *
+ * @author Phil Mesnier <mesnier_p@ociweb.com>
+ */
+// ===================================================================
+
+#ifndef TAO_CODESET_TRANSLATOR_BASE_H
+#define TAO_CODESET_TRANSLATOR_BASE_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/TAO_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/CONV_FRAMEC.h"
+#include "tao/Codeset_Translator_Base.h"
+#include "ace/Service_Object.h"
+
+ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+class ACE_Char_Codeset_Translator;
+class ACE_WChar_Codeset_Translator;
+ACE_END_VERSIONED_NAMESPACE_DECL
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_InputCDR;
+class TAO_OutputCDR;
+
+// ****************************************************************
+
+/**
+ * @class TAO_Codeset_Translator_Base
+ *
+ * @brief Abstract base Translator component for interaction with TAO
+ *
+ * Certain elements of TAO need an interface defined in the TAO module
+ * Through which the actual codeset translator instance may be assigned
+ * to CDR streams.
+ */
+
+class TAO_Export TAO_Codeset_Translator_Base
+{
+public:
+ virtual ~TAO_Codeset_Translator_Base ();
+ virtual int init (int argc, ACE_TCHAR *argv[]) = 0;
+
+ /// Get the native codeset ID from the base. There is no reasonable
+ /// default for this method, so it is left abstract.
+ virtual CONV_FRAME::CodeSetId ncs () const = 0;
+
+ /// Get the translated codeset ID from the base. There is no reasonable
+ /// default for this method, so it is left abstract.
+ virtual CONV_FRAME::CodeSetId tcs () const = 0;
+
+ /// Assign the translator to the supplied input CDR. This is left abstract
+ /// since the base base does not have a reference to the actual translator
+ /// instance. The template instance provides this implementation.
+ virtual void assign (TAO_InputCDR *) const = 0;
+
+ /// Assign the translator to the supplied output CDR. This is left abstract
+ /// since the base base does not have a reference to the actual translator
+ /// instance. The template instance provides this implementation.
+ virtual void assign (TAO_OutputCDR *) const = 0;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_Codeset_Translator_Base */
diff --git a/TAO/tao/Codeset_Translator_Factory.h b/TAO/tao/Codeset_Translator_Factory.h
new file mode 100644
index 00000000000..98ad65a0a8b
--- /dev/null
+++ b/TAO/tao/Codeset_Translator_Factory.h
@@ -0,0 +1,29 @@
+// -*- C++ -*-
+
+// ===================================================================
+/**
+ * @file Codeset_Translator_Factory.h
+ *
+ * $Id$
+ *
+ * @author Phil Mesnier <mesnier_p@ociweb.com>
+ */
+// =========================
+
+#ifndef TAO_CODESET_TRANSLATOR_FACTORY_DEPRECATED_H
+#define TAO_CODESET_TRANSLATOR_FACTORY_DEPRECATED_H
+
+#include /**/ "ace/pre.h"
+
+// TAO_Codeset_Translator_Factroy is now part of the TAO_Codeset
+// library. Since it is possible that people have supplied their
+// own codeset translator classes, this header is included as a
+// migration aid.
+//
+// Anyone with their own translator should also add the new
+// codeset.mpb to their MPC project's list of dependencies.
+
+#include "tao/Codeset/Codeset_Translator_Factory.h"
+
+#include /**/ "ace/post.h"
+#endif /* TAO_Codeset_Translator_Factory */
diff --git a/TAO/tao/Collocated_Invocation.cpp b/TAO/tao/Collocated_Invocation.cpp
new file mode 100644
index 00000000000..80b2efca949
--- /dev/null
+++ b/TAO/tao/Collocated_Invocation.cpp
@@ -0,0 +1,172 @@
+#include "tao/Collocated_Invocation.h"
+#include "tao/Collocation_Proxy_Broker.h"
+#include "tao/ORB_Core.h"
+#include "tao/Request_Dispatcher.h"
+#include "tao/TAO_Server_Request.h"
+#include "tao/Stub.h"
+#include "tao/operation_details.h"
+
+#if TAO_HAS_INTERCEPTORS == 1
+# include "tao/PortableInterceptorC.h"
+#endif /*TAO_HAS_INTERCEPTORS */
+
+ACE_RCSID (tao,
+ Collocated_Invocation,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ Collocated_Invocation::Collocated_Invocation (CORBA::Object_ptr t,
+ CORBA::Object_ptr et,
+ TAO_Stub *stub,
+ TAO_Operation_Details &detail,
+ bool response_expected)
+ : Invocation_Base (t,
+ et,
+ stub,
+ detail,
+ response_expected,
+ false /* request_is_remote */ )
+ {
+ }
+
+ Invocation_Status
+ Collocated_Invocation::invoke (Collocation_Proxy_Broker *cpb,
+ Collocation_Strategy strat
+ ACE_ENV_ARG_DECL)
+ {
+ Invocation_Status s = TAO_INVOKE_FAILURE;
+
+ /// Start the interception point
+#if TAO_HAS_INTERCEPTORS == 1
+ s =
+ this->send_request_interception (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO_INVOKE_FAILURE);
+
+ if (s != TAO_INVOKE_SUCCESS)
+ return s;
+#endif /*TAO_HAS_INTERCEPTORS */
+
+ ACE_TRY
+ {
+ if (strat == TAO_CS_THRU_POA_STRATEGY)
+ {
+ // Perform invocations on the servant through the servant's ORB.
+ CORBA::ORB_var servant_orb =
+ this->effective_target ()->_stubobj ()->servant_orb_ptr ();
+ TAO_ORB_Core * const orb_core = servant_orb->orb_core ();
+
+ TAO_ServerRequest request (orb_core,
+ this->details_,
+ this->effective_target ());
+
+ TAO_Request_Dispatcher * const dispatcher =
+ orb_core->request_dispatcher ();
+
+ // Retain ownership of the servant's ORB_Core in case
+ // another thread attempts to destroy it (e.g. via
+ // CORBA::ORB::destroy()) before this thread complete the
+ // invocation.
+ orb_core->_incr_refcnt ();
+ TAO_ORB_Core_Auto_Ptr my_orb_core (orb_core);
+
+ dispatcher->dispatch (orb_core,
+ request,
+ this->forwarded_to_.out ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ else
+ {
+ cpb->dispatch (this->effective_target (),
+ this->forwarded_to_.out (),
+ this->details_.args (),
+ this->details_.args_num (),
+ this->details_.opname (),
+ this->details_.opname_len (),
+ strat
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+
+ // Invocation completed succesfully
+ s = TAO_INVOKE_SUCCESS;
+
+#if TAO_HAS_INTERCEPTORS == 1
+ if (this->forwarded_to_.in () ||
+ this->response_expected_ == false)
+ {
+ if (this->forwarded_to_.in ())
+ this->reply_received (TAO_INVOKE_RESTART);
+
+ s =
+ this->receive_other_interception (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ // NOTE: Any other condition that needs handling?
+ else if (this->response_expected ())
+ {
+ this->reply_received (TAO_INVOKE_SUCCESS);
+
+ s =
+ this->receive_reply_interception (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ if (s != TAO_INVOKE_SUCCESS)
+ return s;
+#endif /*TAO_HAS_INTERCEPTORS */
+ }
+ ACE_CATCHANY
+ {
+ // Ignore exceptions for oneways
+ if (this->response_expected_ == false)
+ return TAO_INVOKE_SUCCESS;
+
+#if TAO_HAS_INTERCEPTORS == 1
+ PortableInterceptor::ReplyStatus const status =
+ this->handle_any_exception (&ACE_ANY_EXCEPTION
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (status == PortableInterceptor::LOCATION_FORWARD ||
+ status == PortableInterceptor::TRANSPORT_RETRY)
+ s = TAO_INVOKE_RESTART;
+ else
+#endif /*TAO_HAS_INTERCEPTORS*/
+ ACE_RE_THROW;
+ }
+# if defined (ACE_HAS_EXCEPTIONS) \
+ && defined (ACE_HAS_BROKEN_UNEXPECTED_EXCEPTIONS)
+ ACE_CATCHALL
+ {
+ if (this->response_expected () == false)
+ return TAO_INVOKE_SUCCESS;
+#if TAO_HAS_INTERCEPTORS == 1
+ PortableInterceptor::ReplyStatus const st =
+ this->handle_all_exception (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (st == PortableInterceptor::LOCATION_FORWARD ||
+ st == PortableInterceptor::TRANSPORT_RETRY)
+ s = TAO_INVOKE_RESTART;
+ else
+#endif /*TAO_HAS_INTERCEPTORS == 1*/
+ ACE_RE_THROW;
+ }
+# endif /* ACE_HAS_EXCEPTIONS &&
+ ACE_HAS_BROKEN_UNEXPECTED_EXCEPTIONS */
+ ACE_ENDTRY;
+ ACE_CHECK_RETURN (TAO_INVOKE_FAILURE);
+
+ if (this->forwarded_to_.in () != 0)
+ s = TAO_INVOKE_RESTART;
+
+ return s;
+ }
+
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Collocated_Invocation.h b/TAO/tao/Collocated_Invocation.h
new file mode 100644
index 00000000000..a9d2b0950fc
--- /dev/null
+++ b/TAO/tao/Collocated_Invocation.h
@@ -0,0 +1,101 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Collocated_Invocation.h
+ *
+ * $Id$
+ *
+ *
+ * @author Balachandran Natarajan <bala@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_COLLOCATED_INVOCATION_H
+#define TAO_COLLOCATED_INVOCATION_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/TAO_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Collocation_Strategy.h"
+#include "tao/Invocation_Base.h"
+#include "tao/Exception.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Operation_Details;
+class TAO_Stub;
+
+namespace TAO
+{
+ class Profile_Transport_Resolver;
+ class Argument;
+ class Collocation_Proxy_Broker;
+
+ /**
+ * @class Collocated_Invocation
+ *
+ * @brief Class for Collocated invocations
+ *
+ * @note Reliable oneways are not handled properly including use of
+ * interceptors. This class should technically serve as the base
+ * for all invocation types. But now, this is the only class that
+ * handles collocated invocations and that too in a brain dead way.
+ */
+ class TAO_Export Collocated_Invocation : public Invocation_Base
+ {
+ public:
+ /// Constructor used by TAO::Invocation_Adapter
+ /**
+ * @param t The target on which invocation first started.
+ *
+ * @param et The effective target in which this invocation is now
+ * flowing
+ *
+ * @param stub Stub for effective target @a et
+ *
+ * @param detail operation details of the invocation including
+ * the service context list
+ *
+ * @param response_expected flag to indicate whether the
+ * operation encapsulated by @a detail returns a response or not.
+ */
+ Collocated_Invocation (CORBA::Object_ptr t,
+ CORBA::Object_ptr et,
+ TAO_Stub *stub,
+ TAO_Operation_Details &detail,
+ bool response_expected = true);
+
+ /// Invocation on the collocated object mediated through this
+ /// class.
+ /**
+ * Practically this method is a place holder to do the
+ * following
+ * - Call the start and end interception points on the client
+ * side.
+ *
+ * - Handle location forwards that could be thrown by the
+ * servant.
+ *
+ */
+ Invocation_Status invoke (Collocation_Proxy_Broker *cpb,
+ Collocation_Strategy strat
+ ACE_ENV_ARG_DECL);
+
+ private:
+
+ // Disallow default construction.
+ Collocated_Invocation (void);
+
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /*TAO_COLLOCATED_INVOCATION_H*/
diff --git a/TAO/tao/Collocation_Proxy_Broker.cpp b/TAO/tao/Collocation_Proxy_Broker.cpp
new file mode 100644
index 00000000000..e2c0653139f
--- /dev/null
+++ b/TAO/tao/Collocation_Proxy_Broker.cpp
@@ -0,0 +1,17 @@
+// $Id$
+
+#include "tao/Collocation_Proxy_Broker.h"
+
+
+ACE_RCSID (tao,
+ Collocation_Proxy_Broker,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO::Collocation_Proxy_Broker::~Collocation_Proxy_Broker (void)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Collocation_Proxy_Broker.h b/TAO/tao/Collocation_Proxy_Broker.h
new file mode 100644
index 00000000000..2110fb9adb6
--- /dev/null
+++ b/TAO/tao/Collocation_Proxy_Broker.h
@@ -0,0 +1,77 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Collocation_Proxy_Broker.h
+ *
+ * $Id$
+ *
+ *
+ * @author Balachandran Natarajan <bala@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_COLLOCATION_PROXY_BROKER_H
+#define TAO_COLLOCATION_PROXY_BROKER_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/TAO_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Collocation_Strategy.h"
+#include "tao/Versioned_Namespace.h"
+
+#include "ace/CORBA_macros.h"
+#include "ace/os_include/os_stddef.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template<typename T> class TAO_Pseudo_Var_T;
+template<typename T> class TAO_Pseudo_Out_T;
+
+namespace CORBA
+{
+ class Object;
+ typedef Object *Object_ptr;
+ typedef TAO_Pseudo_Var_T<Object> Object_var;
+ typedef TAO_Pseudo_Out_T<Object> Object_out;
+ class Environment;
+}
+
+namespace TAO
+{
+ class Argument;
+
+ /**
+ * @class Collocation_Proxy_Broker
+ */
+ class TAO_Export Collocation_Proxy_Broker
+ {
+
+ public:
+
+ virtual ~Collocation_Proxy_Broker (void);
+
+ virtual Collocation_Strategy get_strategy (CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL) = 0;
+
+ virtual void dispatch (CORBA::Object_ptr obj,
+ CORBA::Object_out forward_obj,
+ Argument ** args,
+ int num_args,
+ const char * op,
+ size_t op_len,
+ Collocation_Strategy strategy
+ ACE_ENV_ARG_DECL) = 0;
+ };
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+}
+
+#include /**/ "ace/post.h"
+
+#endif /*TAO_COLLOCATION_PROXY_BROKER_H */
diff --git a/TAO/tao/Collocation_Resolver.cpp b/TAO/tao/Collocation_Resolver.cpp
new file mode 100644
index 00000000000..23d15bfc269
--- /dev/null
+++ b/TAO/tao/Collocation_Resolver.cpp
@@ -0,0 +1,15 @@
+// $Id$
+
+#include "tao/Collocation_Resolver.h"
+
+ACE_RCSID (tao,
+ Collocation_Resolver,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Collocation_Resolver::~TAO_Collocation_Resolver (void)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Collocation_Resolver.h b/TAO/tao/Collocation_Resolver.h
new file mode 100644
index 00000000000..b837f9acf15
--- /dev/null
+++ b/TAO/tao/Collocation_Resolver.h
@@ -0,0 +1,64 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Collocation_Resolver.h
+ *
+ * $Id$
+ *
+ * @author Irfan Pyarali
+ */
+// ===================================================================
+
+#ifndef TAO_COLLOCATION_RESOLVER_H
+#define TAO_COLLOCATION_RESOLVER_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/TAO_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Basic_Types.h"
+
+#include "ace/Service_Object.h"
+#include "ace/CORBA_macros.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace CORBA
+{
+ class Object;
+ typedef Object *Object_ptr;
+
+ class Environment;
+}
+
+/**
+ * @class TAO_Collocation_Resolver
+ *
+ * @brief This class helps in resolving if a CORBA:Object is collocated.
+ *
+ * \nosubgrouping
+ *
+ **/
+class TAO_Export TAO_Collocation_Resolver
+ : public ACE_Service_Object
+{
+public:
+
+ /// Destructor.
+ virtual ~TAO_Collocation_Resolver (void);
+
+ /// Is @a object collocated?
+ virtual CORBA::Boolean is_collocated (CORBA::Object_ptr object
+ ACE_ENV_ARG_DECL) const = 0;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_COLLOCATION_RESOLVER_H */
diff --git a/TAO/tao/Collocation_Strategy.h b/TAO/tao/Collocation_Strategy.h
new file mode 100644
index 00000000000..236149a387b
--- /dev/null
+++ b/TAO/tao/Collocation_Strategy.h
@@ -0,0 +1,48 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Collocation_Strategy.h
+ *
+ * $Id$
+ *
+ * @author DOC Group - Wash U and UCI
+ */
+//=============================================================================
+
+#ifndef TAO_COLLOCATION_STRATEGY_H
+#define TAO_COLLOCATION_STRATEGY_H
+
+#include /**/ "ace/pre.h"
+#include "tao/orbconf.h"
+#include "tao/Versioned_Namespace.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/// Define symbolic names for the ORB collocation strategies.
+namespace TAO
+{
+ enum Collocation_Strategy
+ {
+ /// i.e no collocation.
+ TAO_CS_REMOTE_STRATEGY,
+
+ /// Calls to the collocated object are forwarded by the POA.
+ TAO_CS_THRU_POA_STRATEGY,
+
+ /// Calls to the collocated object are made directly to its
+ /// servant.
+ TAO_CS_DIRECT_STRATEGY,
+
+ /// This value should always be the last value in the enumeration.
+ /// It provides the count for the number of collocation
+ /// strategies.
+ TAO_CS_LAST
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_COLLOCATION_STRATEGY_H */
diff --git a/TAO/tao/Condition.cpp b/TAO/tao/Condition.cpp
new file mode 100644
index 00000000000..06e17912045
--- /dev/null
+++ b/TAO/tao/Condition.cpp
@@ -0,0 +1,62 @@
+// $Id$
+
+#ifndef TAO_CONDITION_CPP
+#define TAO_CONDITION_CPP
+#include "tao/Condition.h"
+#include "ace/Log_Msg.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/Condition.inl"
+#endif /* __ACE_INLINE__ */
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template <class MUTEX>
+TAO_Condition<MUTEX>::TAO_Condition (MUTEX &m)
+
+ : mutex_ (&m),
+ delete_lock_ (0),
+ cond_ (0)
+{
+ // @@todo: Need to add the allocatore here..
+ ACE_NEW (this->cond_,
+ TAO_SYNCH_CONDITION (*this->mutex_));
+}
+
+template <class MUTEX>
+TAO_Condition<MUTEX>::TAO_Condition (void)
+ : mutex_ (0),
+ delete_lock_ (0),
+ cond_ (0)
+
+{
+ // @@todo: Need to add the allocatore here..
+
+ ACE_NEW (this->mutex_,
+ MUTEX);
+
+ this->delete_lock_ = 1;
+
+ ACE_NEW (this->cond_,
+ TAO_SYNCH_CONDITION (*this->mutex_));
+}
+
+
+template <class MUTEX>
+TAO_Condition<MUTEX>::~TAO_Condition (void)
+{
+ if (this->remove () == -1)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("%p\n"),
+ ACE_TEXT ("TAO_Condition::~TAO_Condition")));
+
+ delete this->cond_;
+
+ if (this->delete_lock_)
+ delete this->mutex_;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_CONDITION_CPP */
diff --git a/TAO/tao/Condition.h b/TAO/tao/Condition.h
new file mode 100644
index 00000000000..5a1d1bada70
--- /dev/null
+++ b/TAO/tao/Condition.h
@@ -0,0 +1,127 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Condition.h
+ *
+ * $Id$
+ *
+ * @author From ACE to TAO by Balachandran Natarajan <bala@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_CONDITION_H
+#define TAO_CONDITION_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/Condition_T.h"
+#include "ace/Global_Macros.h"
+
+ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+class ACE_Time_Value;
+ACE_END_VERSIONED_NAMESPACE_DECL
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_Condition
+ *
+ * @brief Same as to the ACE_Condition variable wrapper
+ *
+ * This class differs from ACE_Condition in that it uses a
+ * TAO_SYNCH_CONDITION instead of ACE_cond_t under the hood to
+ * provide blocking.
+ */
+template <class MUTEX>
+class TAO_Condition
+{
+public:
+
+ /// Useful typedef
+ typedef MUTEX LOCK;
+
+ // = Initialiation and termination methods.
+ /// Initialize the condition variable.
+ TAO_Condition (MUTEX &m);
+
+ /// A default constructor. Since no lock is provided by the user,
+ /// one will be created internally.
+ TAO_Condition (void);
+
+ /// Implicitly destroy the condition variable.
+ ~TAO_Condition (void);
+
+ // = Lock accessors.
+ /**
+ * Block on condition, or until absolute time-of-day has passed. If
+ * abstime == 0 use "blocking" <wait> semantics. Else, if <abstime>
+ * != 0 and the call times out before the condition is signaled
+ * <wait> returns -1 and sets errno to ETIME.
+ */
+ int wait (const ACE_Time_Value *abstime);
+
+ /// Block on condition.
+ int wait (void);
+
+ /**
+ * Block on condition or until absolute time-of-day has passed. If
+ * abstime == 0 use "blocking" wait() semantics on the <mutex>
+ * passed as a parameter (this is useful if you need to store the
+ * <Condition> in shared memory). Else, if <abstime> != 0 and the
+ * call times out before the condition is signaled <wait> returns -1
+ * and sets errno to ETIME.
+ */
+ int wait (MUTEX &mutex, const ACE_Time_Value *abstime = 0);
+
+ /// Signal one waiting thread.
+ int signal (void);
+
+ /// Signal *all* waiting threads.
+ int broadcast (void);
+
+ // = Utility methods.
+ /// Explicitly destroy the condition variable.
+ int remove (void);
+
+ /// Returns a reference to the underlying mutex_;
+ MUTEX *mutex (void);
+
+private:
+
+ /// Reference to mutex lock.
+ MUTEX *mutex_;
+
+ /// A flag to indicate whether the lock needs to be deleted.
+ int delete_lock_;
+
+ /// Condition variable.
+ TAO_SYNCH_CONDITION *cond_;
+
+ // = Prevent assignment and initialization.
+ ACE_UNIMPLEMENTED_FUNC (void operator= (const TAO_Condition<MUTEX> &))
+ ACE_UNIMPLEMENTED_FUNC (TAO_Condition (const TAO_Condition<MUTEX> &))
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+#include "tao/Condition.inl"
+#endif /* __ACE_INLINE__ */
+
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+#include "tao/Condition.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
+#pragma implementation ("Condition.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+#include /**/ "ace/post.h"
+#endif /*TAO_CONDITION_H*/
diff --git a/TAO/tao/Condition.inl b/TAO/tao/Condition.inl
new file mode 100644
index 00000000000..0e69d8b1bf1
--- /dev/null
+++ b/TAO/tao/Condition.inl
@@ -0,0 +1,55 @@
+// -*- C++ -*-
+//
+//$Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template <class MUTEX> ACE_INLINE int
+TAO_Condition<MUTEX>::wait (void)
+{
+ return this->cond_->wait ();
+}
+
+template <class MUTEX> ACE_INLINE int
+TAO_Condition<MUTEX>::wait (MUTEX &mutex,
+ const ACE_Time_Value *abstime)
+{
+ return this->cond_->wait (mutex,
+ abstime);
+}
+
+// Peform an "alertable" timed wait. If the argument ABSTIME == 0
+// then we do a regular cond_wait(), else we do a timed wait for up to
+// ABSTIME using the Solaris cond_timedwait() function.
+
+template <class MUTEX> ACE_INLINE int
+TAO_Condition<MUTEX>::wait (const ACE_Time_Value *abstime)
+{
+ return this->wait (*this->mutex_, abstime);
+}
+
+template<class MUTEX> ACE_INLINE int
+TAO_Condition<MUTEX>::remove (void)
+{
+ return this->cond_->remove ();
+}
+
+template<class MUTEX> ACE_INLINE MUTEX *
+TAO_Condition<MUTEX>::mutex (void)
+{
+ return this->mutex_;
+}
+
+template <class MUTEX> ACE_INLINE int
+TAO_Condition<MUTEX>::signal (void)
+{
+ return this->cond_->signal ();
+}
+
+template <class MUTEX> ACE_INLINE int
+TAO_Condition<MUTEX>::broadcast (void)
+{
+ return this->cond_->broadcast ();
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Configurable_Refcount.cpp b/TAO/tao/Configurable_Refcount.cpp
new file mode 100644
index 00000000000..44f5f7f6138
--- /dev/null
+++ b/TAO/tao/Configurable_Refcount.cpp
@@ -0,0 +1,9 @@
+#include "Configurable_Refcount.h"
+
+#if !defined (__ACE_INLINE__)
+# include "Configurable_Refcount.inl"
+#endif /* __ACE_INLINE__ */
+
+ACE_RCSID (tao,
+ Configurable_Refcount,
+ "$Id$")
diff --git a/TAO/tao/Configurable_Refcount.h b/TAO/tao/Configurable_Refcount.h
new file mode 100644
index 00000000000..cf2af53a2ba
--- /dev/null
+++ b/TAO/tao/Configurable_Refcount.h
@@ -0,0 +1,69 @@
+// This may look like C, but it's really
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Configurable_Refcount.h
+ *
+ * $Id$
+ *
+ * Definition for a synchronised refcountable interface.
+ *
+ * @author Fred Kuhns <fredk@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_CONFIGURABLE_REFCOUNT_H
+#define TAO_CONFIGURABLE_REFCOUNT_H
+
+#include /**/ "ace/pre.h"
+#include "ace/Atomic_Op.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/Null_Mutex.h"
+#include "tao/TAO_Export.h"
+#include "tao/orbconf.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_Configurable_Refcount
+ *
+ * @brief Definition for a synchronised refcountable interface.
+ */
+class TAO_Export TAO_Configurable_Refcount
+{
+public:
+ enum Lock_Type
+ {
+ TAO_NULL_LOCK,
+ TAO_THREAD_LOCK
+ };
+
+ TAO_Configurable_Refcount (Lock_Type type = TAO_THREAD_LOCK,
+ unsigned long value = 1);
+
+ unsigned long increment (void);
+ unsigned long decrement (void);
+
+ unsigned long value (void) const;
+
+private:
+ Lock_Type type_;
+ ACE_Atomic_Op<ACE_SYNCH_NULL_MUTEX, unsigned long> null_refcount_;
+ ACE_Atomic_Op<TAO_SYNCH_MUTEX, unsigned long> mutex_refcount_;
+};
+
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "Configurable_Refcount.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_CONFIGURABLE_REFCOUNT */
diff --git a/TAO/tao/Configurable_Refcount.inl b/TAO/tao/Configurable_Refcount.inl
new file mode 100644
index 00000000000..c885976bbc6
--- /dev/null
+++ b/TAO/tao/Configurable_Refcount.inl
@@ -0,0 +1,55 @@
+// -*- C++ -*-
+//$Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO_Configurable_Refcount::TAO_Configurable_Refcount (
+ TAO_Configurable_Refcount::Lock_Type type,
+ unsigned long value)
+ : type_ (type),
+ null_refcount_ (value),
+ mutex_refcount_ (value)
+{
+}
+
+ACE_INLINE unsigned long
+TAO_Configurable_Refcount::increment (void)
+{
+ switch(this->type_)
+ {
+ case TAO_NULL_LOCK:
+ return this->null_refcount_++;
+ case TAO_THREAD_LOCK:
+ default:
+ return this->mutex_refcount_++;
+ }
+}
+
+ACE_INLINE unsigned long
+TAO_Configurable_Refcount::decrement (void)
+{
+ switch(this->type_)
+ {
+ case TAO_NULL_LOCK:
+ return --this->null_refcount_;
+ case TAO_THREAD_LOCK:
+ default:
+ return --this->mutex_refcount_;
+ }
+}
+
+ACE_INLINE unsigned long
+TAO_Configurable_Refcount::value (void) const
+{
+ switch(this->type_)
+ {
+ case TAO_NULL_LOCK:
+ return this->null_refcount_.value ();
+ case TAO_THREAD_LOCK:
+ default:
+ return this->mutex_refcount_.value ();
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Connect_Strategy.cpp b/TAO/tao/Connect_Strategy.cpp
new file mode 100644
index 00000000000..9a79bece571
--- /dev/null
+++ b/TAO/tao/Connect_Strategy.cpp
@@ -0,0 +1,59 @@
+#include "tao/Connect_Strategy.h"
+#include "tao/Transport.h"
+#include "tao/Connection_Handler.h"
+#include "tao/LF_Multi_Event.h"
+
+ACE_RCSID (tao,
+ Connect_Strategy,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Connect_Strategy::TAO_Connect_Strategy (TAO_ORB_Core *orb_core)
+ : orb_core_ (orb_core)
+{
+}
+
+
+TAO_Connect_Strategy::~TAO_Connect_Strategy (void)
+{
+}
+
+int
+TAO_Connect_Strategy::wait (TAO_Connection_Handler *ch,
+ ACE_Time_Value *max_wait_time)
+{
+ if (ch == 0)
+ return -1;
+
+ return this->wait_i (ch, ch->transport (),max_wait_time);
+}
+
+int
+TAO_Connect_Strategy::wait (TAO_Transport *t,
+ ACE_Time_Value *max_wait_time)
+{
+ // Basically the connection was EINPROGRESS, but before we could
+ // wait for it some other thread detected a failure and cleaned up
+ // the connection handler.
+ if (t == 0)
+ return -1;
+
+ return this->wait_i (t->connection_handler(),t,max_wait_time);
+}
+
+int
+TAO_Connect_Strategy::wait (TAO_LF_Multi_Event *mev,
+ ACE_Time_Value *max_wait_time)
+{
+ return this->wait_i (mev, mev->base_transport(), max_wait_time);
+}
+
+int
+TAO_Connect_Strategy::poll (TAO_LF_Multi_Event *mev)
+{
+ ACE_Time_Value zero(ACE_Time_Value::zero);
+ return this->wait_i (mev, mev->base_transport(), &zero);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Connect_Strategy.h b/TAO/tao/Connect_Strategy.h
new file mode 100644
index 00000000000..4783039326a
--- /dev/null
+++ b/TAO/tao/Connect_Strategy.h
@@ -0,0 +1,103 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Connect_Strategy.h
+ *
+ * $Id$
+ *
+ * @author Balachandran Natarajan <bala@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_CONNECT_STRATEGY_H
+#define TAO_CONNECT_STRATEGY_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/TAO_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Versioned_Namespace.h"
+
+ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+class ACE_Synch_Options;
+class ACE_Time_Value;
+ACE_END_VERSIONED_NAMESPACE_DECL
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_ORB_Core;
+class TAO_Connector;
+class TAO_Connection_Handler;
+class TAO_Transport;
+class TAO_LF_Multi_Event;
+class TAO_LF_Event;
+
+/**
+ * @class TAO_Connect_Strategy
+ *
+ * @brief Define the interface for the connect strategy, i.e. the
+ * algorithm that controls how does the ORB establishes remote
+ * connections.
+ *
+ * The thread that establishes remote connections can either make a
+ * blocking or a non-blocking connect. The strategy to wait for the
+ * connection completion can also be different.
+ *
+ * This strategy controls how does the ORB schedules and waits for
+ * connection completion.
+ */
+
+class TAO_Export TAO_Connect_Strategy
+{
+public:
+
+ /// Constructor
+ TAO_Connect_Strategy (TAO_ORB_Core *orb);
+
+ /// Destructor
+ virtual ~TAO_Connect_Strategy (void);
+
+ /// Obtain the synch options that can be passed to ACE_Connector
+ /* Return the synch option for the connector, based on the timeout
+ * and the strategy in place. ACE_Connectors behavior can be altered
+ * by passing the right ACE_Synch_Options to the connect () call.
+ */
+ virtual void synch_options (ACE_Time_Value *val,
+ ACE_Synch_Options &opt) = 0;
+
+ /// Wait for the connection to be completed till a timeout occurs.
+ /* If the connection establishment fails the state within the
+ * connection handler is set appropriately.
+ */
+ int wait (TAO_Connection_Handler *ch, ACE_Time_Value *val);
+
+ int wait (TAO_Transport *t, ACE_Time_Value *val);
+
+ /// Wait for one of many connections to complete. Returns when one
+ /// succeeds or all fail.
+ int wait (TAO_LF_Multi_Event *ev, ACE_Time_Value *val);
+
+ /// Do a quick check to see if any connections are complete. This
+ /// does the same as the wait with an explicit time value of 0.
+ int poll (TAO_LF_Multi_Event *ev);
+
+protected:
+ /// This is the method that does all the real interesting stuff.
+ virtual int wait_i (TAO_LF_Event *ev,
+ TAO_Transport *t,
+ ACE_Time_Value *val) = 0;
+
+ /// Cached copy of the ORB core pointer
+ TAO_ORB_Core * const orb_core_;
+
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /*TAO_CONNECT_STRATEGY_H*/
diff --git a/TAO/tao/Connection_Handler.cpp b/TAO/tao/Connection_Handler.cpp
new file mode 100644
index 00000000000..4b6c78baebb
--- /dev/null
+++ b/TAO/tao/Connection_Handler.cpp
@@ -0,0 +1,434 @@
+//$Id$
+
+#include "tao/Connection_Handler.h"
+#include "tao/ORB_Core.h"
+#include "tao/debug.h"
+#include "tao/Resume_Handle.h"
+#include "tao/Transport.h"
+#include "tao/Wait_Strategy.h"
+
+#include "ace/SOCK.h"
+#include "ace/Reactor.h"
+#include "ace/os_include/sys/os_socket.h"
+
+//@@ CONNECTION_HANDLER_SPL_INCLUDE_FORWARD_DECL_ADD_HOOK
+
+#if !defined (__ACE_INLINE__)
+#include "tao/Connection_Handler.inl"
+#endif /* __ACE_INLINE__ */
+
+ACE_RCSID (tao,
+ Connection_Handler,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Connection_Handler::TAO_Connection_Handler (TAO_ORB_Core *orb_core)
+ : orb_core_ (orb_core)
+ , transport_ (0)
+{
+ // @@todo: We need to have a distinct option/ method in the resource
+ // factory for this and TAO_Transport.
+ this->lock_ =
+ this->orb_core_->resource_factory ()->create_cached_connection_lock ();
+
+ // Put ourselves in the connection wait state as soon as we get
+ // created
+ this->state_changed (TAO_LF_Event::LFS_CONNECTION_WAIT,
+ this->orb_core_->leader_follower ());
+}
+
+TAO_Connection_Handler::~TAO_Connection_Handler (void)
+{
+ int const result =
+ this->release_os_resources ();
+
+ if (result == -1 && TAO_debug_level)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "TAO (%P|%t) - Connection_Handler::~Connection_Handler,"
+ "release_os_resources() failed %m\n"));
+ }
+
+ // @@ TODO Use auto_ptr<>
+ delete this->lock_;
+
+ //@@ CONNECTION_HANDLER_DESTRUCTOR_ADD_HOOK
+}
+
+
+int
+TAO_Connection_Handler::set_socket_option (ACE_SOCK &sock,
+ int snd_size,
+ int rcv_size)
+{
+#if !defined (ACE_LACKS_SOCKET_BUFSIZ)
+
+ if (snd_size != 0
+ && sock.set_option (SOL_SOCKET,
+ SO_SNDBUF,
+ (void *) &snd_size,
+ sizeof (snd_size)) == -1
+ && errno != ENOTSUP)
+ {
+ return -1;
+ }
+
+ if (rcv_size != 0
+ && sock.set_option (SOL_SOCKET,
+ SO_RCVBUF,
+ (void *) &rcv_size,
+ sizeof (int)) == -1
+ && errno != ENOTSUP)
+ {
+ return -1;
+ }
+#else
+ ACE_UNUSED_ARG (snd_size);
+ ACE_UNUSED_ARG (rcv_size);
+#endif /* !ACE_LACKS_SOCKET_BUFSIZ */
+
+ (void) sock.enable (ACE_CLOEXEC);
+ // Set the close-on-exec flag for that file descriptor. If the
+ // operation fails we are out of luck (some platforms do not support
+ // it and return -1).
+
+ return 0;
+}
+
+int
+TAO_Connection_Handler::svc_i (void)
+{
+ int result = 0;
+
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - Connection_Handler::svc_i begin\n")));
+
+ // Here we simply synthesize the "typical" event loop one might find
+ // in a reactive handler, except that this can simply block waiting
+ // for input.
+
+ ACE_Time_Value *max_wait_time = 0;
+ ACE_Time_Value timeout;
+ ACE_Time_Value current_timeout;
+
+ if (this->orb_core_->thread_per_connection_timeout (timeout))
+ {
+ current_timeout = timeout;
+ max_wait_time = &current_timeout;
+ }
+
+ TAO_Resume_Handle rh (this->orb_core_,
+ ACE_INVALID_HANDLE);
+
+ // We exit of the loop if
+ // - If the ORB core is shutdown by another thread
+ // - Or if the transport is null. This could happen if an error
+ // occured.
+ // - Or if during processing a return value of -1 is received.
+ while (!this->orb_core_->has_shutdown ()
+ && result >= 0)
+ {
+ // Let the transport know that it is used
+ (void) this->transport ()->update_transport ();
+
+ result =
+ this->transport ()->handle_input (rh,
+ max_wait_time);
+
+ if (result == -1 && errno == ETIME)
+ {
+ // Ignore timeouts, they are only used to wake up and
+ // shutdown.
+ result = 0;
+
+ // Reset errno to make sure we don't trip over an old value
+ // of errno in case it is not reset when the recv() call
+ // fails if the socket has been closed.
+ errno = 0;
+ }
+ else if (result == -1)
+ {
+ // Something went wrong with the socket. Just quit
+ return result;
+ }
+
+ current_timeout = timeout;
+
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - Connection_Handler::svc_i - "
+ "loop <%d>\n", current_timeout.msec ()));
+ }
+
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - Connection_Handler::svc_i end\n"));
+
+ return result;
+}
+
+void
+TAO_Connection_Handler::transport (TAO_Transport* transport)
+{
+ this->transport_ = transport;
+
+ // Enable reference counting on the event handler.
+ this->transport_->event_handler_i ()->reference_counting_policy ().value (
+ ACE_Event_Handler::Reference_Counting_Policy::ENABLED
+ );
+}
+
+int
+TAO_Connection_Handler::handle_output_eh (
+ ACE_HANDLE, ACE_Event_Handler * eh)
+{
+ // Let the transport that it is going to be used
+ (void) this->transport ()->update_transport ();
+
+ // Instantiate the resume handle here.. This will automatically
+ // resume the handle once data is written..
+ TAO_Resume_Handle resume_handle (this->orb_core (),
+ eh->get_handle ());
+
+ int return_value = 0;
+ this->pre_io_hook (return_value);
+ if (return_value != 0)
+ {
+ resume_handle.set_flag (TAO_Resume_Handle::TAO_HANDLE_LEAVE_SUSPENDED);
+ return return_value;
+ }
+
+ return_value = this->transport ()->handle_output ();
+
+ this->pos_io_hook (return_value);
+
+ if (return_value != 0)
+ {
+ resume_handle.set_flag (TAO_Resume_Handle::TAO_HANDLE_LEAVE_SUSPENDED);
+ }
+
+ return return_value;
+}
+
+int
+TAO_Connection_Handler::handle_input_eh (
+ ACE_HANDLE h, ACE_Event_Handler *eh)
+{
+ // If we can't process upcalls just return
+ if (!this->transport ()->wait_strategy ()->can_process_upcalls ())
+ {
+ if (TAO_debug_level > 6)
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - Connection_Handler[%d]::handle_input_eh, "
+ "not going to handle_input on transport "
+ "because upcalls temporarily suspended on this thread\n",
+ this->transport()->id()));
+ return 0;
+ }
+
+ int const result = this->handle_input_internal (h, eh);
+
+ if (result == -1)
+ {
+ this->close_connection ();
+ return 0;
+ }
+
+ return result;
+}
+
+int
+TAO_Connection_Handler::handle_input_internal (
+ ACE_HANDLE h, ACE_Event_Handler * eh)
+{
+ // Let the transport know that it is used
+ (void) this->transport ()->update_transport ();
+
+ // Grab the transport id now and use the cached value for printing
+ // since the transport could dissappear by the time the thread
+ // returns.
+ size_t const t_id =
+ this->transport ()->id ();
+
+ if (TAO_debug_level > 6)
+ {
+ ACE_HANDLE handle = eh->get_handle();
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - Connection_Handler[%d]::handle_input, "
+ "handle = %d/%d\n",
+ t_id, handle, h));
+ }
+
+ TAO_Resume_Handle resume_handle (this->orb_core (),
+ eh->get_handle ());
+
+ int return_value = 0;
+
+ this->pre_io_hook (return_value);
+ if (return_value != 0)
+ return return_value;
+
+ return_value = this->transport ()->handle_input (resume_handle);
+
+ this->pos_io_hook (return_value);
+
+ // Bug 1647; might need to change resume_handle's flag or
+ // change handle_input return value.
+ resume_handle.handle_input_return_value_hook(return_value);
+
+ if (TAO_debug_level > 6)
+ {
+ ACE_HANDLE handle = eh->get_handle ();
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - Connection_Handler[%d]::handle_input, "
+ "handle = %d/%d, retval = %d\n",
+ t_id, handle, h, return_value));
+ }
+
+ if (return_value == -1)
+ resume_handle.set_flag (TAO_Resume_Handle::TAO_HANDLE_LEAVE_SUSPENDED);
+ return return_value;
+}
+
+int
+TAO_Connection_Handler::close_connection_eh (ACE_Event_Handler *eh)
+{
+ // Save the ID for debugging messages
+ ACE_HANDLE handle = eh->get_handle ();
+
+ size_t const id = this->transport ()->id ();
+ if (TAO_debug_level)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - Connection_Handler[%d]::"
+ "close_connection_eh, purging entry from cache\n",
+ handle));
+ }
+
+ this->transport ()->purge_entry ();
+
+ // @@ This seems silly, but if we have no reason to be in the
+ // reactor, then we dont remove ourselves.
+ if (this->transport ()->wait_strategy ()->is_registered ())
+ {
+ ACE_Reactor *eh_reactor = eh->reactor ();
+
+ if (this->orb_core_->has_shutdown () == 0)
+ {
+ // If the ORB is nill, get the reactor from orb_core which gets it
+ // from LF.
+ if (eh_reactor == 0)
+ eh_reactor = this->transport()->orb_core()->reactor ();
+ }
+
+ // The Reactor must not be null, otherwise something else is
+ // horribly broken.
+ ACE_ASSERT (eh_reactor != 0);
+
+ if (TAO_debug_level)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - Connection_Handler[%d]::"
+ "close_connection_eh, removing from the reactor\n",
+ handle));
+ }
+
+ // Use id instead of handle. Why? "handle" may be invalid for RW
+ // cases when drop_reply_on_shutdown is on, and when the
+ // orb_core is shutting down. This means that the handler will
+ // be left behind in the reactor which would create problems
+ // later. Just forcefully remove them. If none exists reactor
+ // will make things safer.
+ ACE_HANDLE tmp_handle = handle;
+ if (this->orb_core_->has_shutdown ())
+ tmp_handle = (ACE_HANDLE) id;
+
+ eh_reactor->remove_handler (tmp_handle,
+ ACE_Event_Handler::ALL_EVENTS_MASK |
+ ACE_Event_Handler::DONT_CALL);
+
+ // Also cancel any timers, we may create those for time-limited
+ // buffering
+ if (TAO_debug_level)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - Connection_Handler[%d]::"
+ "close_connection_eh, cancel all timers\n",
+ handle));
+ }
+
+ eh_reactor->cancel_timer (eh);
+
+ // @@ This seems silly, the reactor is a much better authority to
+ // find out if a handle is registered...
+ this->transport ()->wait_strategy ()->is_registered (false);
+ }
+
+ // This call should be made only after the cache and reactor are
+ // cleaned up. This call can make upcalls to the application which
+ // in turn can make remote calls (Bug 1551 and Bug 1482). The remote
+ // calls from the application can try to use this handler from the
+ // cache or from the reactor. So clean them up before this is
+ // called.
+ this->transport ()->send_connection_closed_notifications ();
+ this->state_changed (TAO_LF_Event::LFS_CONNECTION_CLOSED,
+ this->orb_core_->leader_follower ());
+
+ if (TAO_debug_level)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - Connection_Handler[%d]::"
+ "close_connection_eh\n",
+ id));
+ }
+
+ return 1;
+}
+
+/*
+ * Comment hook to comment the base class implementations
+ * that do nothing. Specialized versions from derived
+ * class will directly override these methods. Add
+ * all methods that are virtual, have do nothing implementations
+ * within this hook for later specialization.
+ */
+//@@ CONNECTION_HANDLER_SPL_COMMENT_HOOK_START
+
+int
+TAO_Connection_Handler::set_dscp_codepoint (CORBA::Boolean)
+{
+ return 0;
+}
+
+int
+TAO_Connection_Handler::release_os_resources (void)
+{
+ return 0;
+}
+
+//@@ CONNECTION_HANDLER_SPL_COMMENT_HOOK_END
+
+void
+TAO_Connection_Handler::pre_io_hook (int &)
+{
+}
+
+void
+TAO_Connection_Handler::pos_io_hook (int &)
+{
+}
+
+int
+TAO_Connection_Handler::close_handler (void)
+{
+ this->state_changed (TAO_LF_Event::LFS_CONNECTION_CLOSED,
+ this->orb_core_->leader_follower ());
+ this->transport ()->remove_reference ();
+ return 0;
+}
+
+//@@ CONNECTION_HANDLER_SPL_METHODS_ADD_HOOK
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Connection_Handler.h b/TAO/tao/Connection_Handler.h
new file mode 100644
index 00000000000..e17ff6af08f
--- /dev/null
+++ b/TAO/tao/Connection_Handler.h
@@ -0,0 +1,209 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Connection_Handler.h
+ *
+ * $Id$
+ *
+ * @author Balachandran Natarajan <bala@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_CONNECTION_HANDLER_H
+#define TAO_CONNECTION_HANDLER_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/LF_CH_Event.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Basic_Types.h"
+
+ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+class ACE_SOCK;
+class ACE_Lock;
+class ACE_Event_Handler;
+ACE_END_VERSIONED_NAMESPACE_DECL
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_ORB_Core;
+class TAO_Transport;
+
+/*
+ * Hook to specialize the connection handler with the
+ * concrete connection handler implementation.
+ */
+//@@ CONNECTION_HANDLER_SPL_INCLUDE_FORWARD_DECL_ADD_HOOK
+
+/**
+ * @class TAO_Connection_Handler
+ *
+ * @brief TAO_Connection_Handler
+ *
+ * This class is an abstraction for the connection handlers. The
+ * connections handler in every protocol can derive from this
+ * class as well as the ACE_Svc_Handler specialised for the
+ * right protocol. This way, most of the common code for the
+ * different protocols would be in this implementation.
+ */
+class TAO_Export TAO_Connection_Handler : public TAO_LF_CH_Event
+{
+public:
+
+ /// Constructor
+ TAO_Connection_Handler (void);
+
+ /// Constructor
+ TAO_Connection_Handler (TAO_ORB_Core *orb_core);
+
+ /// Destructor
+ virtual ~TAO_Connection_Handler (void);
+
+ /// Return the underlying transport object
+ TAO_Transport *transport (void);
+
+ /// Set the underlying transport object
+ void transport (TAO_Transport* transport);
+
+ /// Is the handler closed?
+ bool is_closed (void) const;
+
+ /// Is the handler open?
+ bool is_open (void) const;
+
+ /// Is the handler in the process of being connected?
+ bool is_connecting (void) const;
+
+ /// Close the underlying connection.
+ /**
+ * Used by the ORB to actively close connections that are idle,
+ * stale or somehow are determined to be broken before the Reactor
+ * does.
+ *
+ * @return Return 0 if the connection was already closed, non-zero
+ * otherwise.
+ */
+ virtual int close_connection (void) = 0;
+
+ /// The event handler calls, here so that other objects who hold a
+ /// reference to this object can call the event handler methods.
+ virtual int handle_input (ACE_HANDLE fd) = 0;
+
+ /// This method is invoked from the svc () method of the Svc_Handler
+ /// Object.
+ int svc_i (void);
+
+ /// A open () hook
+ /**
+ * See Thread_Per_Connection_Handler for a use case
+ */
+ virtual int open_handler (void *) = 0;
+
+ /// A close() hook, called by the Transport Connector when they want to close
+ /// this handler
+ virtual int close_handler (void);
+
+ /// Set the Diff-Serv codepoint on outgoing packets. Only has
+ /// effect for remote protocols (e.g., IIOP); no effect for local
+ /// protocols (UIOP). Default implementation is for local
+ /// protocols. Remote protocols must overwrite implementation.
+ virtual int set_dscp_codepoint (CORBA::Boolean set_network_priority);
+
+ /// Release the OS resources related to this handler.
+ virtual int release_os_resources (void);
+
+ /*
+ * Hook to add public methods from concrete connection handler
+ * implementation onto the base connection handler.
+ */
+
+ //@@ CONNECTION_HANDLER_SPL_PUBLIC_METHODS_ADD_HOOK
+
+protected:
+
+ /// Return our TAO_ORB_Core pointer
+ TAO_ORB_Core *orb_core (void);
+
+ /// Set options on the socket
+ int set_socket_option (ACE_SOCK &sock,
+ int snd_size,
+ int rcv_size);
+
+ //@{
+ /**
+ * @name Helper methods for Event_Handler-based derived classes.
+ *
+ * Many (actually all so far) implementations of
+ * TAO_Connection_Handler are a mixin of TAO_Connection_Handler and
+ * some form of ACE_Event_Handler. The following methods simplify
+ * such implementations by capturing the common code in a single
+ * place.
+ */
+
+ /// Implement the handle_output() callback
+ int handle_output_eh (ACE_HANDLE h, ACE_Event_Handler * eh);
+
+ /// Implement the handle_input() callback
+ // We're actually going to pull the code from the protocol-specific
+ // handlers back into this class, because they ALL look exactly the same.
+ // If some other protocol comes along and needs to do something different,
+ // it is always free to override handle_input() as it sees fit.
+ int handle_input_eh (ACE_HANDLE h, ACE_Event_Handler * eh);
+ int handle_input_internal (ACE_HANDLE h, ACE_Event_Handler *eh);
+
+ /// Implement close_connection() for Connection_Handlers that are
+ /// also Event_Handlers.
+ int close_connection_eh (ACE_Event_Handler * eh);
+
+ /// Pre-invocation hook for I/O operations (handle_input() &
+ /// handle_output())
+ /**
+ * See the SSLIOP protocol for an interesting use-case
+ */
+ virtual void pre_io_hook (int & return_value);
+
+ /// Post-invocation hook for I/O operations (handle_input() &
+ /// handle_output())
+ /**
+ * See the SSLIOP protocol for an interesting use-case
+ */
+ virtual void pos_io_hook (int & return_value);
+ //@}
+
+
+private:
+ /// Pointer to the TAO_ORB_Core
+ TAO_ORB_Core * const orb_core_;
+
+ /// Transport object reference
+ TAO_Transport* transport_;
+
+ /// Internal state lock, needs to be separate from the reference
+ /// count / pending upcalls lock because they interleave.
+ ACE_Lock * lock_;
+
+ /*
+ * Hook to add instance members from derived class
+ * onto base Connection_Handler class. Any further
+ * additions to this class should go before this
+ * hook.
+ */
+ //@@ CONNECTION_HANDLER_SPL_PRIVATE_DATA_ADD_HOOK
+};
+
+//@@ CONNECTION_HANDLER_SPL_EXTERN_ADD_HOOK
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+#include "tao/Connection_Handler.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /*TAO_CONNECTION_HANDLER_H*/
diff --git a/TAO/tao/Connection_Handler.inl b/TAO/tao/Connection_Handler.inl
new file mode 100644
index 00000000000..5841cf3aebc
--- /dev/null
+++ b/TAO/tao/Connection_Handler.inl
@@ -0,0 +1,40 @@
+// -*- C++ -*-
+//
+//$Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE TAO_ORB_Core *
+TAO_Connection_Handler::orb_core (void)
+{
+ return this->orb_core_;
+}
+
+ACE_INLINE TAO_Transport *
+TAO_Connection_Handler::transport (void)
+{
+ return this->transport_;
+}
+
+ACE_INLINE bool
+TAO_Connection_Handler::is_closed (void) const
+{
+ return (this->state_ == TAO_LF_Event::LFS_CONNECTION_CLOSED ||
+ this->state_ == TAO_LF_Event::LFS_TIMEOUT);
+}
+
+ACE_INLINE bool
+TAO_Connection_Handler::is_open (void) const
+{
+ return this->state_ == TAO_LF_Event::LFS_SUCCESS;
+}
+
+ACE_INLINE bool
+TAO_Connection_Handler::is_connecting (void) const
+{
+ return this->state_ == TAO_LF_Event::LFS_CONNECTION_WAIT;
+}
+
+//@@ CONNECTION_HANDLER_SPL_METHODS_ADD_HOOK
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Connection_Purging_Strategy.cpp b/TAO/tao/Connection_Purging_Strategy.cpp
new file mode 100644
index 00000000000..8bcf332a835
--- /dev/null
+++ b/TAO/tao/Connection_Purging_Strategy.cpp
@@ -0,0 +1,25 @@
+// $Id$
+
+#include "tao/Connection_Purging_Strategy.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/Connection_Purging_Strategy.inl"
+#endif /* __ACE_INLINE__ */
+
+ACE_RCSID (tao,
+ Connection_Purging_Strategy,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Connection_Purging_Strategy::~TAO_Connection_Purging_Strategy (void)
+{
+}
+
+int
+TAO_Connection_Purging_Strategy::cache_maximum (void) const
+{
+ return cache_maximum_;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Connection_Purging_Strategy.h b/TAO/tao/Connection_Purging_Strategy.h
new file mode 100644
index 00000000000..c93038f7de3
--- /dev/null
+++ b/TAO/tao/Connection_Purging_Strategy.h
@@ -0,0 +1,68 @@
+// -*- C++ -*-
+
+// ================================================================
+/**
+ * @file Connection_Purging_Strategy.h
+ *
+ * $Id$
+ *
+ * @author Chad Elliott (elliott_c@ociweb.com)
+ */
+// ================================================================
+
+#ifndef TAO_PURGING_STRATEGY_H
+#define TAO_PURGING_STRATEGY_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/TAO_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Versioned_Namespace.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Transport;
+
+// ****************************************************************
+
+/**
+ * @class TAO_Connection_Purging_Strategy
+ *
+ * @brief The base class for all purging strategies
+ *
+ * This class is used by the Transport_Cache_Manager to maintain
+ * ordering information on each Transport that is created.
+ */
+
+class TAO_Export TAO_Connection_Purging_Strategy
+{
+public:
+ /// The constructor
+ TAO_Connection_Purging_Strategy (int cache_maximum);
+
+ /// The destructor
+ virtual ~TAO_Connection_Purging_Strategy (void);
+
+ /// Return the maximum number of cache entries
+ virtual int cache_maximum (void) const;
+
+ /// Sub-classes must implement these methods
+ virtual void update_item (TAO_Transport* transport) = 0;
+
+private:
+ /// The maximum number of cach entries
+ int cache_maximum_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/Connection_Purging_Strategy.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_PURGING_STRATEGY_H */
diff --git a/TAO/tao/Connection_Purging_Strategy.inl b/TAO/tao/Connection_Purging_Strategy.inl
new file mode 100644
index 00000000000..a361f536198
--- /dev/null
+++ b/TAO/tao/Connection_Purging_Strategy.inl
@@ -0,0 +1,14 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO_Connection_Purging_Strategy::TAO_Connection_Purging_Strategy (
+ int cache_maximum)
+ : cache_maximum_ (cache_maximum)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Connector_Impl.cpp b/TAO/tao/Connector_Impl.cpp
new file mode 100644
index 00000000000..3e7c5742320
--- /dev/null
+++ b/TAO/tao/Connector_Impl.cpp
@@ -0,0 +1,65 @@
+// $Id$
+
+#ifndef TAO_CONNECTOR_IMPL_CPP
+#define TAO_CONNECTOR_IMPL_CPP
+
+#include "tao/Connector_Impl.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template <class SVC_HANDLER>
+TAO_Connect_Creation_Strategy<SVC_HANDLER>::
+ TAO_Connect_Creation_Strategy (ACE_Thread_Manager* t,
+ TAO_ORB_Core *orb_core,
+ CORBA::Boolean flag)
+ : ACE_Creation_Strategy <SVC_HANDLER> (t),
+ orb_core_ (orb_core),
+ lite_flag_ (flag)
+{
+
+}
+
+template <class SVC_HANDLER> int
+TAO_Connect_Creation_Strategy<SVC_HANDLER>::make_svc_handler (SVC_HANDLER *&sh)
+{
+ if (sh == 0)
+ ACE_NEW_RETURN (sh,
+ SVC_HANDLER (this->orb_core_,
+ this->lite_flag_),
+ -1);
+
+ // We add to the #REFCOUNT# since the Connector needs this. See
+ // Connector::make_connection() for details.
+ sh->add_reference ();
+
+ // At this point, the #REFCOUNT# is two.
+
+ return 0;
+}
+
+
+////////////////////////////////////////////////////////////////
+
+template <class SVC_HANDLER>
+TAO_Connect_Concurrency_Strategy<SVC_HANDLER>::
+ TAO_Connect_Concurrency_Strategy (TAO_ORB_Core *orb_core)
+ : orb_core_ (orb_core)
+{
+}
+
+template <class SVC_HANDLER> int
+TAO_Connect_Concurrency_Strategy<SVC_HANDLER>::
+ activate_svc_handler (SVC_HANDLER *sh,
+ void *arg)
+{
+ return ACE_Concurrency_Strategy<SVC_HANDLER>::activate_svc_handler (sh,
+ arg);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_CONNECTOR_IMPL_CPP */
diff --git a/TAO/tao/Connector_Impl.h b/TAO/tao/Connector_Impl.h
new file mode 100644
index 00000000000..f0fa11a2676
--- /dev/null
+++ b/TAO/tao/Connector_Impl.h
@@ -0,0 +1,115 @@
+// -*- C++ -*-
+
+// ===================================================================
+/**
+ * @file Connector_Impl.h
+ *
+ * $Id$
+ *
+ * @author Balachandran Natarajan <bala@cs.wustl.edu>
+ */
+// ===================================================================
+
+#ifndef TAO_CONNECTOR_IMPL_H
+#define TAO_CONNECTOR_IMPL_H
+
+#include /**/ "ace/pre.h"
+#include "ace/Strategies_T.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Basic_Types.h"
+
+ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+class ACE_Thread_Manager;
+ACE_END_VERSIONED_NAMESPACE_DECL
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_ORB_Core;
+
+/**
+ * @class TAO_Connect_Creation_Strategy
+ *
+ * @brief Creation strategy helper
+ *
+ * Creates the TAO_*_Connection_Handler object for the TAO_*_Connector
+ * objects. This template class can now be used by all the Connector
+ * objects instead of having to duplicate code. This class can be used
+ * to set any required properties on the connection handlers at
+ * creation time.
+ *
+ */
+
+template <class SVC_HANDLER>
+class TAO_Connect_Creation_Strategy : public ACE_Creation_Strategy<SVC_HANDLER>
+{
+public:
+
+ /// Constructor.
+ TAO_Connect_Creation_Strategy (ACE_Thread_Manager * = 0,
+ TAO_ORB_Core* orb_core = 0,
+ CORBA::Boolean flag = false);
+
+ /// Makes TAO_*_Client_Connection_Handlers
+ virtual int make_svc_handler (SVC_HANDLER *&sh);
+
+
+private:
+
+ /// Pointer to the ORB_Core on which we are activated
+ TAO_ORB_Core * const orb_core_;
+
+ /// Are we using GIOP lite?
+ CORBA::Boolean const lite_flag_;
+};
+
+
+
+/**
+ * @class TAO_Connect_Concurrency_Strategy
+ *
+ * @brief Concurrency strategy helper
+ *
+ * Activates the Svc_Handler, and then if the correct wait strategy is
+ * in use registers the handler with the reactor.
+ *
+ */
+
+template <class SVC_HANDLER>
+class TAO_Connect_Concurrency_Strategy :
+ public ACE_Concurrency_Strategy<SVC_HANDLER>
+{
+public:
+
+ /// Constructor.
+ TAO_Connect_Concurrency_Strategy (TAO_ORB_Core *orb_core);
+
+
+ /// Activates the Svc_Handler, and if the right wait strategy is in
+ /// use, registers the handle with the reactor.
+ int activate_svc_handler (SVC_HANDLER *svc_handler,
+ void *arg);
+
+private:
+
+ /// Pointer to the ORB Core.
+ TAO_ORB_Core * const orb_core_;
+
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+#include "tao/Connector_Impl.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
+#pragma implementation ("Connector_Impl.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+#include /**/ "ace/post.h"
+#endif /*TAO_CONNECTOR_IMPL_H*/
diff --git a/TAO/tao/Connector_Registry.cpp b/TAO/tao/Connector_Registry.cpp
new file mode 100644
index 00000000000..ed452c2602c
--- /dev/null
+++ b/TAO/tao/Connector_Registry.cpp
@@ -0,0 +1,271 @@
+// $Id$
+
+#include "tao/Connector_Registry.h"
+#include "tao/ORB_Core.h"
+#include "tao/Profile.h"
+#include "tao/Transport_Connector.h"
+#include "tao/Protocol_Factory.h"
+#include "tao/debug.h"
+#include "tao/ORB_Constants.h"
+#include "tao/CDR.h"
+#include "tao/SystemException.h"
+#include "ace/Auto_Ptr.h"
+
+#if !defined(__ACE_INLINE__)
+#include "tao/Connector_Registry.i"
+#endif /* __ACE_INLINE__ */
+
+
+ACE_RCSID (tao,
+ Connector_Registry,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Connector_Registry::TAO_Connector_Registry (void)
+ : connectors_ (0),
+ size_ (0)
+{
+}
+
+TAO_Connector_Registry::~TAO_Connector_Registry (void)
+{
+ this->close_all ();
+
+ delete [] this->connectors_;
+}
+
+TAO_Connector *
+TAO_Connector_Registry::get_connector (CORBA::ULong tag) const
+{
+ const TAO_ConnectorSetIterator end = this->end ();
+
+ for (TAO_ConnectorSetIterator connector = this->begin ();
+ connector != end;
+ ++connector)
+ {
+ if ((*connector)->tag () == tag)
+ return *connector;
+ }
+
+ return 0;
+}
+
+int
+TAO_Connector_Registry::open (TAO_ORB_Core *orb_core)
+{
+ TAO_ProtocolFactorySet * const pfs =
+ orb_core->protocol_factories ();
+
+ // The array containing the TAO_Connectors will never contain more
+ // than the number of loaded protocols in the ORB core.
+ if (this->connectors_ == 0)
+ ACE_NEW_RETURN (this->connectors_,
+ TAO_Connector *[pfs->size ()],
+ -1);
+
+ // Open one connector for each loaded protocol!
+ const TAO_ProtocolFactorySetItor end = pfs->end ();
+
+ for (TAO_ProtocolFactorySetItor factory = pfs->begin ();
+ factory != end;
+ ++factory)
+ {
+ auto_ptr <TAO_Connector> connector (
+ (*factory)->factory ()->make_connector ());
+
+ if (connector.get ())
+ {
+ if (connector->open (orb_core) != 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) unable to open connector for ")
+ ACE_TEXT ("<%s>.\n"),
+ ACE_TEXT_CHAR_TO_TCHAR((*factory)->protocol_name ().c_str ())),
+ -1);
+ }
+
+ this->connectors_[this->size_++] =
+ connector.release ();
+ }
+ else
+ return -1;
+ }
+
+ return 0;
+}
+
+int
+TAO_Connector_Registry::close_all (void)
+{
+ const TAO_ConnectorSetIterator end = this->end ();
+
+ for (TAO_ConnectorSetIterator i = this->begin ();
+ i != end;
+ ++i)
+ {
+ if (*i == 0)
+ continue;
+
+ (*i)->close ();
+
+ delete *i;
+ }
+
+ this->size_ = 0;
+
+ return 0;
+}
+
+int
+TAO_Connector_Registry::make_mprofile (const char *ior,
+ TAO_MProfile &mprofile
+ ACE_ENV_ARG_DECL)
+{
+ if (!ior)
+ // Failure: Null IOR string pointer
+ ACE_THROW_RETURN (CORBA::INV_OBJREF (
+ CORBA::SystemException::_tao_minor_code (
+ 0,
+ EINVAL),
+ CORBA::COMPLETED_NO),
+ -1);
+
+ const TAO_ConnectorSetIterator first_connector = this->begin ();
+ const TAO_ConnectorSetIterator last_connector = this->end ();
+
+ for (TAO_ConnectorSetIterator connector = first_connector;
+ connector != last_connector;
+ ++connector)
+ {
+ if (*connector)
+ {
+ const int mp_result =
+ (*connector)->make_mprofile (ior,
+ mprofile
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (mp_result);
+
+ if (mp_result == 0)
+ return 0; // Success
+ }
+ else
+ // Failure: Null pointer to connector in connector registry.
+ ACE_THROW_RETURN (CORBA::INV_OBJREF (
+ CORBA::SystemException::_tao_minor_code (
+ 0,
+ EINVAL),
+ CORBA::COMPLETED_NO),
+ -1);
+ }
+
+ // Failure: None of the connectors were able to parse the URL style
+ // IOR into an MProfile.
+ ACE_THROW_RETURN (CORBA::INV_OBJREF (
+ CORBA::SystemException::_tao_minor_code (
+ TAO_CONNECTOR_REGISTRY_NO_USABLE_PROTOCOL,
+ 0),
+ CORBA::COMPLETED_NO),
+ -1);
+}
+
+TAO_Profile *
+TAO_Connector_Registry::create_profile (TAO_InputCDR &cdr)
+{
+ CORBA::ULong tag = 0;
+
+ // If there is an error we abort.
+ if ((cdr >> tag) == 0)
+ return 0;
+
+ TAO_Connector *connector =
+ this->get_connector (tag);
+
+ if (connector == 0)
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) Unknown profile tag 0x%x\n"),
+ tag));
+ }
+
+ TAO_ORB_Core *orb_core = cdr.orb_core ();
+ if (orb_core == 0)
+ {
+ orb_core = TAO_ORB_Core_instance ();
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_WARNING,
+ ACE_TEXT ("TAO (%P|%t) - TAO_Connector_Registry")
+ ACE_TEXT ("::create_profile: ")
+ ACE_TEXT ("WARNING: extracting object from ")
+ ACE_TEXT ("default ORB_Core\n")));
+ }
+ }
+
+
+ TAO_Profile *pfile = 0;
+ ACE_NEW_RETURN (pfile,
+ TAO_Unknown_Profile (tag,
+ orb_core),
+ 0);
+ if (pfile->decode (cdr) == -1)
+ {
+ pfile->_decr_refcnt ();
+ pfile = 0;
+ }
+
+ return pfile;
+ }
+
+ // OK, we've got a known profile. It's going to be encapsulated
+ // ProfileData. Create a new decoding stream and context for it,
+ // and skip the data in the parent stream
+
+ // ProfileData is encoded as a sequence of octet. So first get the
+ // length of the sequence.
+ CORBA::ULong encap_len = 0;
+ if ((cdr >> encap_len) == 0)
+ return 0;
+
+ // Create the decoding stream from the encapsulation in the buffer,
+ // and skip the encapsulation.
+ TAO_InputCDR str (cdr, encap_len);
+
+ if (str.good_bit () == 0
+ || cdr.skip_bytes (encap_len) == 0)
+ return 0;
+
+ return connector->create_profile (str);
+}
+
+char
+TAO_Connector_Registry::object_key_delimiter (const char *ior)
+{
+ if (!ior)
+ {
+ errno = EINVAL;
+ return 0; // Failure: Null IOR string pointer
+ }
+
+ const TAO_ConnectorSetIterator first_connector = this->begin ();
+ const TAO_ConnectorSetIterator last_connector = this->end ();
+
+ for (TAO_ConnectorSetIterator connector = first_connector;
+ connector != last_connector;
+ ++connector)
+ {
+ if (*connector)
+ {
+ if ((*connector)->check_prefix (ior) == 0)
+ return (*connector)->object_key_delimiter ();
+ }
+ }
+
+ // Failure: None of the connectors were able to match their protocol
+ // against the provided string.
+ return 0;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Connector_Registry.h b/TAO/tao/Connector_Registry.h
new file mode 100644
index 00000000000..7c97caa3f0c
--- /dev/null
+++ b/TAO/tao/Connector_Registry.h
@@ -0,0 +1,113 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Connector_Registry.h
+ *
+ * $Id$
+ *
+ * Interface for the TAO Connector Registry
+ *
+ * @author Fred Kuhns <fredk@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_CONNECTOR_REGISTRY_H
+#define TAO_CONNECTOR_REGISTRY_H
+#include /**/ "ace/pre.h"
+
+#include "tao/TAO_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/CORBA_macros.h"
+#include "tao/Basic_Types.h"
+#include "ace/Global_Macros.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Forward declarations.
+class TAO_ORB_Core;
+class TAO_Connector;
+class TAO_MProfile;
+class TAO_Profile;
+class TAO_InputCDR;
+
+namespace CORBA
+{
+ class Environment;
+}
+
+typedef TAO_Connector** TAO_ConnectorSetIterator;
+
+/**
+ * @class TAO_Connector_Registry
+ *
+ * @brief Per-ORB TAO Connector Registry
+ *
+ * Connector Registry and Generic Connector interface definitions.
+ * All loaded ESIOP or GIOP connector bridges must register with
+ * this object.
+ * This class is able to dynamically load a set of
+ * concrete protocol connectors which have registered with the service
+ * configurator and added their Factory name to the Resource_Factory
+ * line of the svc.conf file.
+ */
+class TAO_Export TAO_Connector_Registry
+{
+public:
+ /// Default constructor.
+ TAO_Connector_Registry (void);
+
+ /// Default destructor.
+ ~TAO_Connector_Registry (void);
+
+ /// Return the connector bridges
+ TAO_Connector *get_connector (CORBA::ULong tag) const;
+
+ /// Initialize all registered connectors.
+ int open (TAO_ORB_Core *orb_core);
+
+ /// Close all open connectors.
+ int close_all (void);
+
+ /// Parse a string containing a URL style IOR and return an
+ /// MProfile.
+ int make_mprofile (const char *ior,
+ TAO_MProfile &mprofile
+ ACE_ENV_ARG_DECL);
+
+ /// Create a profile based on the contents of @a cdr
+ TAO_Profile* create_profile (TAO_InputCDR& cdr);
+
+ /// Obtain the object key delimiter used by the protocol specified in
+ /// the provided URL style IOR.
+ char object_key_delimiter (const char *ior);
+
+ // = Iterator.
+ TAO_ConnectorSetIterator begin (void) const;
+ TAO_ConnectorSetIterator end (void) const;
+
+private:
+ // Disallow copying and assignment.
+ TAO_Connector_Registry (const TAO_Connector_Registry&);
+ void operator= (const TAO_Connector_Registry&);
+
+private:
+ /// List of connectors that are currently open.
+ TAO_Connector** connectors_;
+
+ /// Number of connectors that are currently open.
+ size_t size_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined(__ACE_INLINE__)
+#include "tao/Connector_Registry.i"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_CONNECTOR_REGISTRY_H */
diff --git a/TAO/tao/Connector_Registry.i b/TAO/tao/Connector_Registry.i
new file mode 100644
index 00000000000..9ecc29436b5
--- /dev/null
+++ b/TAO/tao/Connector_Registry.i
@@ -0,0 +1,19 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE TAO_ConnectorSetIterator
+TAO_Connector_Registry::begin (void) const
+{
+ return this->connectors_;
+}
+
+ACE_INLINE TAO_ConnectorSetIterator
+TAO_Connector_Registry::end (void) const
+{
+ return this->connectors_ + this->size_;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Current.pidl b/TAO/tao/Current.pidl
new file mode 100644
index 00000000000..643ffdc6914
--- /dev/null
+++ b/TAO/tao/Current.pidl
@@ -0,0 +1,35 @@
+// -*- IDL -*-
+
+/**
+ * @file Current.pidl
+ *
+ * $Id$
+ *
+ * This file is used to generate CurrentC.{h,cpp}, using the
+ * following command:
+ *
+ * tao_idl.exe
+ * -o orig -Gp -Gd -Ge 1 -GA -SS -Sci
+ * -Wb,export_macro=TAO_Export
+ * -Wb,export_include="tao/TAO_Export.h"
+ * -Wb,pre_include="ace/pre.h"
+ * -Wb,post_include="ace/post.h"
+ * -Wb,versioning_begin=TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+ * -Wb,versioning_end=TAO_END_VERSIONED_NAMESPACE_DECL
+ * Current.pidl
+ *
+ *
+ * The files are ready to use.
+ */
+
+#ifndef TAO_CURRENT_PIDL
+#define TAO_CURRENT_PIDL
+
+#pragma prefix "omg.org"
+
+module CORBA
+{
+ local interface Current {};
+};
+
+#endif /* TAO_CURRENT_PIDL */
diff --git a/TAO/tao/DLL_Parser.cpp b/TAO/tao/DLL_Parser.cpp
new file mode 100644
index 00000000000..87fb45d897f
--- /dev/null
+++ b/TAO/tao/DLL_Parser.cpp
@@ -0,0 +1,80 @@
+// $Id$
+
+#include "tao/DLL_Parser.h"
+#include "tao/Object_Loader.h"
+#include "tao/Object.h"
+#include "tao/Environment.h"
+#include "tao/ORB_Constants.h"
+#include "tao/SystemException.h"
+#include "tao/ORB_Core.h"
+
+#include "ace/Dynamic_Service.h"
+#include "ace/Log_Msg.h"
+#include "ace/OS_NS_string.h"
+
+
+ACE_RCSID (tao,
+ DLL_Parser,
+ "$Id$")
+
+static const char dll_prefix[] = "DLL:";
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_DLL_Parser::~TAO_DLL_Parser (void)
+{
+}
+
+
+int
+TAO_DLL_Parser::match_prefix (const char *ior_string) const
+{
+ return (ACE_OS::strncmp (ior_string,
+ ::dll_prefix,
+ sizeof (::dll_prefix) - 1) == 0);
+}
+
+CORBA::Object_ptr
+TAO_DLL_Parser::parse_string (const char *ior,
+ CORBA::ORB_ptr orb
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ // Skip the prefix, we know it is there because this method in only
+ // called if <match_prefix> returns 1.
+ const char *name =
+ ior + sizeof (::dll_prefix) - 1;
+
+ TAO_ORB_Core *oc = orb->orb_core ();
+
+ TAO_Object_Loader *loader =
+ ACE_Dynamic_Service<TAO_Object_Loader>::instance
+ (oc->configuration(), name);
+
+ if (loader == 0)
+ {
+ ACE_THROW_RETURN
+ (CORBA::INV_OBJREF
+ (CORBA::SystemException::_tao_minor_code (
+ 0,
+ EINVAL),
+ CORBA::COMPLETED_NO),
+ CORBA::Object::_nil ());
+ }
+
+ return loader->create_object (orb, 0, 0 ACE_ENV_ARG_PARAMETER);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DEFINE (TAO_DLL_Parser,
+ ACE_TEXT ("DLL_Parser"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (TAO_DLL_Parser),
+ ACE_Service_Type::DELETE_THIS |
+ ACE_Service_Type::DELETE_OBJ,
+ 0)
+
+
+ACE_FACTORY_DEFINE (TAO, TAO_DLL_Parser)
+
diff --git a/TAO/tao/DLL_Parser.h b/TAO/tao/DLL_Parser.h
new file mode 100644
index 00000000000..62feb63a54c
--- /dev/null
+++ b/TAO/tao/DLL_Parser.h
@@ -0,0 +1,100 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file DLL_Parser.h
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan (coryan@cs.wustl.edu)
+ */
+//=============================================================================
+
+#ifndef TAO_DLL_PARSER_H
+#define TAO_DLL_PARSER_H
+
+#include /**/ "ace/pre.h"
+#include "ace/Service_Config.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/IOR_Parser.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_DLL_Parser
+ *
+ * @brief Implment the parser for the DLL-style IORs.
+ *
+ * The DLL-style IORs allows applications to transparently load object
+ * implementations. The ORB can parse an IOR in the format:
+ *
+ * DLL:Service_Name
+ *
+ * the string_to_object() function will use ACE's Service Configurator
+ * framework to dynamically load the service named 'Service_Name'
+ * using all the normal platform-independent naming conventions and
+ * environment variable lookup rules that are normally used by @c
+ * ACE_DLL::open(). The ORB assumes that this service implements the
+ * TAO_Object_Loader interface, and uses that interface to create a
+ * new object implementation locally. The object reference for this
+ * local object is returned to the application.
+ *
+ * This can be used in applications that sometimes require local
+ * object while other times they may use a remote implementation.
+ * For example, the application could be configured to use a remote
+ * Event Service or to dynamically load an Event Service
+ * implementation and use the local copy instead. The local Event
+ * Service would federate to its remote peers to work as-if a single
+ * Event Service was in place.
+ *
+ * Such an application could be written as follows:
+ *
+ * int main (int argc, char* argv)
+ * {
+ * CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
+ *
+ * CORBA::Object_var object =
+ * orb->resolve_initial_references("EventService");
+ * // Use <object> here...
+ * }
+ *
+ * if the application is invoked using:
+ *
+ * $ program -ORBInitRef EventService=IOR:....
+ *
+ * then a remote event service is used, but the application could also
+ * be invoked using:
+ *
+ * $ program -ORBInitRef EventService=DLL:Event_Service_Loader
+ *
+ * In this case the Event_Service implementation will be dynamically
+ * loaded without any modifications to the application code.
+ *
+ */
+class TAO_DLL_Parser : public TAO_IOR_Parser
+{
+public:
+
+ /// The destructor
+ virtual ~TAO_DLL_Parser (void);
+
+ // = The IOR_Parser methods, please read the documentation in
+ // IOR_Parser.h
+ virtual int match_prefix (const char *ior_string) const;
+ virtual CORBA::Object_ptr parse_string (const char *ior,
+ CORBA::ORB_ptr orb
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE_EXPORT (TAO, TAO_DLL_Parser)
+ACE_FACTORY_DECLARE (TAO, TAO_DLL_Parser)
+
+#include /**/ "ace/post.h"
+#endif /* TAO_DLL_PARSER_H */
diff --git a/TAO/tao/Default_Collocation_Resolver.cpp b/TAO/tao/Default_Collocation_Resolver.cpp
new file mode 100644
index 00000000000..78ccc5c4b5c
--- /dev/null
+++ b/TAO/tao/Default_Collocation_Resolver.cpp
@@ -0,0 +1,29 @@
+// $Id$
+
+#include "tao/Default_Collocation_Resolver.h"
+
+ACE_RCSID (tao,
+ Default_Collocation_Resolver,
+ "$Id$")
+
+#include "tao/Object.h"
+#include "ace/Log_Msg.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+CORBA::Boolean
+TAO_Default_Collocation_Resolver::is_collocated (CORBA::Object_ptr object
+ ACE_ENV_ARG_DECL_NOT_USED) const
+{
+ return object->_is_collocated ();
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DEFINE (TAO_Default_Collocation_Resolver,
+ ACE_TEXT ("Default_Collocation_Resolver"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (TAO_Default_Collocation_Resolver),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0)
+ACE_FACTORY_DEFINE (TAO, TAO_Default_Collocation_Resolver)
diff --git a/TAO/tao/Default_Collocation_Resolver.h b/TAO/tao/Default_Collocation_Resolver.h
new file mode 100644
index 00000000000..c98aefae6d5
--- /dev/null
+++ b/TAO/tao/Default_Collocation_Resolver.h
@@ -0,0 +1,57 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Default_Collocation_Resolver.h
+ *
+ * $Id$
+ *
+ * @author Irfan Pyarali
+ */
+// ===================================================================
+
+#ifndef TAO_DEFAULT_COLLOCATION_RESOLVER_H
+#define TAO_DEFAULT_COLLOCATION_RESOLVER_H
+
+#include /**/ "ace/pre.h"
+#include "ace/Service_Config.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Collocation_Resolver.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace CORBA
+{
+ class Environment;
+}
+/**
+ * @class TAO_Default_Collocation_Resolver
+ *
+ * @brief Simple resolver used to decide if a CORBA::Object is
+ * collocated.
+ *
+ * \nosubgrouping
+ *
+ **/
+class TAO_Export TAO_Default_Collocation_Resolver :
+ public TAO_Collocation_Resolver
+{
+public:
+
+ /// Is @a object collocated?
+ virtual CORBA::Boolean is_collocated (CORBA::Object_ptr object
+ ACE_ENV_ARG_DECL) const;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE_EXPORT (TAO, TAO_Default_Collocation_Resolver)
+ACE_FACTORY_DECLARE (TAO, TAO_Default_Collocation_Resolver)
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_DEFAULT_COLLOCATION_RESOLVER_H */
diff --git a/TAO/tao/Default_Endpoint_Selector_Factory.cpp b/TAO/tao/Default_Endpoint_Selector_Factory.cpp
new file mode 100644
index 00000000000..64fb8f94608
--- /dev/null
+++ b/TAO/tao/Default_Endpoint_Selector_Factory.cpp
@@ -0,0 +1,45 @@
+// $Id$
+
+#include "tao/Default_Endpoint_Selector_Factory.h"
+#include "tao/Invocation_Endpoint_Selectors.h"
+
+#include "ace/Log_Msg.h"
+
+
+ACE_RCSID (tao,
+ Default_Endpoint_Selector_Factory,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Default_Endpoint_Selector_Factory::TAO_Default_Endpoint_Selector_Factory (
+ void)
+ : default_endpoint_selector_ (new TAO_Default_Endpoint_Selector)
+{
+}
+
+TAO_Default_Endpoint_Selector_Factory::~TAO_Default_Endpoint_Selector_Factory (void)
+{
+ delete this->default_endpoint_selector_;
+}
+
+
+TAO_Invocation_Endpoint_Selector *
+TAO_Default_Endpoint_Selector_Factory::get_selector (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+{
+ // Trivial endpoint selector. Just return the default selector.
+ return this->default_endpoint_selector_;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+// ****************************************************************
+
+ACE_STATIC_SVC_DEFINE (TAO_Default_Endpoint_Selector_Factory,
+ ACE_TEXT ("Default_Endpoint_Selector_Factory"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (TAO_Default_Endpoint_Selector_Factory),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0)
+ACE_FACTORY_DEFINE (TAO, TAO_Default_Endpoint_Selector_Factory)
diff --git a/TAO/tao/Default_Endpoint_Selector_Factory.h b/TAO/tao/Default_Endpoint_Selector_Factory.h
new file mode 100644
index 00000000000..b521cab81dd
--- /dev/null
+++ b/TAO/tao/Default_Endpoint_Selector_Factory.h
@@ -0,0 +1,87 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Default_Endpoint_Selector_Factory.h
+ *
+ * $Id$
+ *
+ * Strategies for selecting profile/endpoint from an IOR for making an
+ * invocation.
+ *
+ * @author Marina Spivak <marina@cs.wustl.edu>
+ * @author Frank Hunleth <fhunleth@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_DEFAULT_ENDPOINT_SELECTOR_FACTORY_H
+#define TAO_DEFAULT_ENDPOINT_SELECTOR_FACTORY_H
+
+#include /**/ "ace/pre.h"
+#include "ace/Service_Config.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Endpoint_Selector_Factory.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Forward references
+class TAO_Default_Endpoint_Selector;
+
+// ****************************************************************
+
+/**
+ * @class TAO_Default_Endpoint_Selector_Factory
+ *
+ * @brief Factory for initializing <Endpoint_Selection_State> and
+ * obtaining appropriate <Invocation_Endpoint_Selector>.
+ *
+ * Used by Invocation classes to intialize its endpoint selection
+ * strategy and state based on the effective policies.
+ * Endpoint selection strategies are stateless objects - all the
+ * state they need is contained by Invocation in
+ * <Endpoint_Selection_State>. Thus, rather than allocating an
+ * endpoint selection strategy object for each Invocation, the
+ * factory simply returns the appropriate one from the
+ * set preallocated in the ORB_Core. One endpoint selection
+ * strategy object can be used by many invocations concurrently.
+ */
+class TAO_Export TAO_Default_Endpoint_Selector_Factory
+ : public TAO_Endpoint_Selector_Factory
+{
+public:
+ /// Constructor.
+ TAO_Default_Endpoint_Selector_Factory (void);
+
+ /// Destructor.
+ virtual ~TAO_Default_Endpoint_Selector_Factory (void);
+
+ /// Get an Invocation's endpoint selection strategy and
+ /// initialize the endpoint selection state instance.
+ virtual TAO_Invocation_Endpoint_Selector *get_selector (
+ ACE_ENV_SINGLE_ARG_DECL);
+
+private:
+
+ // Prevent copying/assignment.
+ TAO_Default_Endpoint_Selector_Factory (TAO_Default_Endpoint_Selector_Factory const &);
+ void operator= (TAO_Default_Endpoint_Selector_Factory const &);
+
+protected:
+
+ /// The possible endpoint selector strategies that can be
+ /// returned by this factory
+ TAO_Default_Endpoint_Selector * const default_endpoint_selector_;
+
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE_EXPORT (TAO, TAO_Default_Endpoint_Selector_Factory)
+ACE_FACTORY_DECLARE (TAO, TAO_Default_Endpoint_Selector_Factory)
+
+#include /**/ "ace/post.h"
+#endif /* TAO_DEFAULT_ENDPOINT_SELECTOR_FACTORY_H */
diff --git a/TAO/tao/Default_Protocols_Hooks.cpp b/TAO/tao/Default_Protocols_Hooks.cpp
new file mode 100644
index 00000000000..a06a1307aba
--- /dev/null
+++ b/TAO/tao/Default_Protocols_Hooks.cpp
@@ -0,0 +1,182 @@
+// $Id$
+
+#include "tao/Default_Protocols_Hooks.h"
+#include "ace/Log_Msg.h"
+
+ACE_RCSID (tao,
+ Default_Protocols_Hooks,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Default_Protocols_Hooks::~TAO_Default_Protocols_Hooks (void)
+{
+}
+
+void
+TAO_Default_Protocols_Hooks::init_hooks (TAO_ORB_Core *
+ ACE_ENV_ARG_DECL_NOT_USED)
+{
+}
+
+void
+TAO_Default_Protocols_Hooks::add_rt_service_context_hook (TAO_Service_Context &,
+ CORBA::Policy *,
+ CORBA::Short &
+ ACE_ENV_ARG_DECL_NOT_USED)
+{
+}
+
+void
+TAO_Default_Protocols_Hooks::get_selector_hook (CORBA::Policy *,
+ CORBA::Boolean &,
+ CORBA::Short &)
+{
+}
+
+void
+TAO_Default_Protocols_Hooks::get_selector_bands_policy_hook (CORBA::Policy *,
+ CORBA::Short,
+ CORBA::Short &,
+ CORBA::Short &,
+ int &)
+{
+}
+
+int
+TAO_Default_Protocols_Hooks::get_thread_CORBA_priority (CORBA::Short &
+ ACE_ENV_ARG_DECL_NOT_USED)
+{
+ return 0;
+}
+
+int
+TAO_Default_Protocols_Hooks::get_thread_native_priority (CORBA::Short &
+ ACE_ENV_ARG_DECL_NOT_USED)
+{
+ return 0;
+}
+
+int
+TAO_Default_Protocols_Hooks::get_thread_CORBA_and_native_priority (CORBA::Short &,
+ CORBA::Short &
+ ACE_ENV_ARG_DECL_NOT_USED)
+{
+ return 0;
+}
+
+int
+TAO_Default_Protocols_Hooks::set_thread_CORBA_priority (CORBA::Short
+ ACE_ENV_ARG_DECL_NOT_USED)
+{
+ return 0;
+}
+
+int
+TAO_Default_Protocols_Hooks::set_thread_native_priority (CORBA::Short
+ ACE_ENV_ARG_DECL_NOT_USED)
+{
+ return 0;
+}
+
+void
+TAO_Default_Protocols_Hooks::rt_service_context (TAO_Stub *,
+ TAO_Service_Context &,
+ CORBA::Boolean
+ ACE_ENV_ARG_DECL_NOT_USED)
+{
+}
+
+CORBA::Boolean
+TAO_Default_Protocols_Hooks::set_client_network_priority (IOP::ProfileId,
+ TAO_Stub *
+ ACE_ENV_ARG_DECL_NOT_USED)
+{
+ return false;
+}
+
+CORBA::Boolean
+TAO_Default_Protocols_Hooks::set_server_network_priority (IOP::ProfileId,
+ CORBA::Policy *
+ ACE_ENV_ARG_DECL_NOT_USED)
+{
+ return false;
+}
+
+void
+TAO_Default_Protocols_Hooks::server_protocol_properties_at_orb_level (TAO_IIOP_Protocol_Properties &
+ ACE_ENV_ARG_DECL_NOT_USED)
+{
+}
+
+void
+TAO_Default_Protocols_Hooks::client_protocol_properties_at_orb_level (TAO_IIOP_Protocol_Properties &
+ ACE_ENV_ARG_DECL_NOT_USED)
+{
+}
+
+void
+TAO_Default_Protocols_Hooks::server_protocol_properties_at_orb_level (TAO_UIOP_Protocol_Properties &
+ ACE_ENV_ARG_DECL_NOT_USED)
+{
+}
+
+void
+TAO_Default_Protocols_Hooks::client_protocol_properties_at_orb_level (TAO_UIOP_Protocol_Properties &
+ ACE_ENV_ARG_DECL_NOT_USED)
+{
+}
+
+void
+TAO_Default_Protocols_Hooks::server_protocol_properties_at_orb_level (TAO_SHMIOP_Protocol_Properties &
+ ACE_ENV_ARG_DECL_NOT_USED)
+{
+}
+
+void
+TAO_Default_Protocols_Hooks::client_protocol_properties_at_orb_level (TAO_SHMIOP_Protocol_Properties &
+ ACE_ENV_ARG_DECL_NOT_USED)
+{
+}
+
+void
+TAO_Default_Protocols_Hooks::server_protocol_properties_at_orb_level (TAO_DIOP_Protocol_Properties &
+ ACE_ENV_ARG_DECL_NOT_USED)
+{
+}
+
+void
+TAO_Default_Protocols_Hooks::client_protocol_properties_at_orb_level (TAO_DIOP_Protocol_Properties &
+ ACE_ENV_ARG_DECL_NOT_USED)
+{
+}
+
+void
+TAO_Default_Protocols_Hooks::server_protocol_properties_at_orb_level (TAO_SCIOP_Protocol_Properties &
+ ACE_ENV_ARG_DECL_NOT_USED)
+{
+}
+
+void
+TAO_Default_Protocols_Hooks::client_protocol_properties_at_orb_level (TAO_SCIOP_Protocol_Properties &
+ ACE_ENV_ARG_DECL_NOT_USED)
+{
+}
+
+CORBA::Long
+TAO_Default_Protocols_Hooks::get_dscp_codepoint (void)
+{
+ return 0;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+// ****************************************************************
+
+ACE_STATIC_SVC_DEFINE (TAO_Default_Protocols_Hooks,
+ ACE_TEXT ("Protocols_Hooks"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (TAO_Default_Protocols_Hooks),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0)
+ACE_FACTORY_DEFINE (TAO, TAO_Default_Protocols_Hooks)
diff --git a/TAO/tao/Default_Protocols_Hooks.h b/TAO/tao/Default_Protocols_Hooks.h
new file mode 100644
index 00000000000..540ed7b70fb
--- /dev/null
+++ b/TAO/tao/Default_Protocols_Hooks.h
@@ -0,0 +1,123 @@
+// -*- C++ -*-
+
+// ===================================================================
+/**
+ * @file Default_Protocols_Hooks.h
+ *
+ * $Id$
+ *
+ * @author Priyanka Gontla <pgontla@ece.uci.edu>
+ */
+// ===================================================================
+
+#ifndef TAO_DEFAULT_PROTOCOLS_HOOKS_H
+#define TAO_DEFAULT_PROTOCOLS_HOOKS_H
+
+#include /**/ "ace/pre.h"
+#include "ace/Service_Config.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Protocols_Hooks.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_POA;
+
+class TAO_Export TAO_Default_Protocols_Hooks : public TAO_Protocols_Hooks
+{
+public:
+
+ /// destructor
+ virtual ~TAO_Default_Protocols_Hooks (void);
+
+ void init_hooks (TAO_ORB_Core *orb_core
+ ACE_ENV_ARG_DECL);
+
+ CORBA::Boolean set_client_network_priority (IOP::ProfileId protocol_tag,
+ TAO_Stub *stub
+ ACE_ENV_ARG_DECL);
+
+ CORBA::Boolean set_server_network_priority (IOP::ProfileId protocol_tag,
+ CORBA::Policy *policy
+ ACE_ENV_ARG_DECL);
+
+ void server_protocol_properties_at_orb_level (TAO_IIOP_Protocol_Properties &protocol_properties
+ ACE_ENV_ARG_DECL);
+
+ void client_protocol_properties_at_orb_level (TAO_IIOP_Protocol_Properties &protocol_properties
+ ACE_ENV_ARG_DECL);
+
+ void server_protocol_properties_at_orb_level (TAO_UIOP_Protocol_Properties &protocol_properties
+ ACE_ENV_ARG_DECL);
+
+ void client_protocol_properties_at_orb_level (TAO_UIOP_Protocol_Properties &protocol_properties
+ ACE_ENV_ARG_DECL);
+
+ void server_protocol_properties_at_orb_level (TAO_SHMIOP_Protocol_Properties &protocol_properties
+ ACE_ENV_ARG_DECL);
+
+ void client_protocol_properties_at_orb_level (TAO_SHMIOP_Protocol_Properties &protocol_properties
+ ACE_ENV_ARG_DECL);
+
+ void server_protocol_properties_at_orb_level (TAO_DIOP_Protocol_Properties &protocol_properties
+ ACE_ENV_ARG_DECL);
+
+ void client_protocol_properties_at_orb_level (TAO_DIOP_Protocol_Properties &protocol_properties
+ ACE_ENV_ARG_DECL);
+
+ void server_protocol_properties_at_orb_level (TAO_SCIOP_Protocol_Properties &protocol_properties
+ ACE_ENV_ARG_DECL);
+
+ void client_protocol_properties_at_orb_level (TAO_SCIOP_Protocol_Properties &protocol_properties
+ ACE_ENV_ARG_DECL);
+
+ CORBA::Long get_dscp_codepoint (void);
+
+ void rt_service_context (TAO_Stub *stub,
+ TAO_Service_Context &service_context,
+ CORBA::Boolean restart
+ ACE_ENV_ARG_DECL);
+
+ void add_rt_service_context_hook (TAO_Service_Context &service_context,
+ CORBA::Policy *model_policy,
+ CORBA::Short &client_priority
+ ACE_ENV_ARG_DECL);
+
+ void get_selector_hook (CORBA::Policy *model_policy,
+ CORBA::Boolean
+ &is_client_propagated,
+ CORBA::Short &server_priority);
+
+ void get_selector_bands_policy_hook (CORBA::Policy *bands_policy,
+ CORBA::Short p,
+ CORBA::Short &min_priority,
+ CORBA::Short &max_priority,
+ int &in_range);
+
+ int get_thread_CORBA_priority (CORBA::Short &
+ ACE_ENV_ARG_DECL);
+
+ int get_thread_native_priority (CORBA::Short &
+ ACE_ENV_ARG_DECL);
+
+ int get_thread_CORBA_and_native_priority (CORBA::Short &,
+ CORBA::Short &
+ ACE_ENV_ARG_DECL);
+
+ int set_thread_CORBA_priority (CORBA::Short
+ ACE_ENV_ARG_DECL);
+
+ int set_thread_native_priority (CORBA::Short
+ ACE_ENV_ARG_DECL);
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE_EXPORT (TAO, TAO_Default_Protocols_Hooks)
+ACE_FACTORY_DECLARE (TAO, TAO_Default_Protocols_Hooks)
+
+#include /**/ "ace/post.h"
+#endif /* TAO_DEFAULT_PROTOCOLS_HOOKS_H */
diff --git a/TAO/tao/Default_Stub_Factory.cpp b/TAO/tao/Default_Stub_Factory.cpp
new file mode 100644
index 00000000000..180a81b60e4
--- /dev/null
+++ b/TAO/tao/Default_Stub_Factory.cpp
@@ -0,0 +1,50 @@
+// $Id$
+
+#include "tao/Default_Stub_Factory.h"
+#include "tao/Stub.h"
+#include "tao/ORB_Constants.h"
+#include "tao/SystemException.h"
+
+#include "ace/Log_Msg.h"
+
+
+ACE_RCSID (tao,
+ TAO_Default_Stub_Factory,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Default_Stub_Factory::~TAO_Default_Stub_Factory (void)
+{
+}
+
+TAO_Stub *
+TAO_Default_Stub_Factory::create_stub (const char *repository_id,
+ const TAO_MProfile &profiles,
+ TAO_ORB_Core *orb_core
+ ACE_ENV_ARG_DECL)
+{
+ TAO_Stub *retval = 0;
+
+ ACE_NEW_THROW_EX (retval,
+ TAO_Stub (repository_id, profiles, orb_core),
+ CORBA::NO_MEMORY (0,
+ CORBA::COMPLETED_MAYBE));
+ ACE_CHECK_RETURN (retval);
+
+ return retval;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+// ****************************************************************
+
+ACE_STATIC_SVC_DEFINE (
+ TAO_Default_Stub_Factory,
+ ACE_TEXT ("Default_Stub_Factory"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (TAO_Default_Stub_Factory),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0
+ )
+ACE_FACTORY_DEFINE (TAO, TAO_Default_Stub_Factory)
diff --git a/TAO/tao/Default_Stub_Factory.h b/TAO/tao/Default_Stub_Factory.h
new file mode 100644
index 00000000000..e0a4c60c5ec
--- /dev/null
+++ b/TAO/tao/Default_Stub_Factory.h
@@ -0,0 +1,65 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Default_Stub_Factory.h
+ *
+ * $Id$
+ *
+ * Defines the a factory interface for creating Stubs.
+ * This class creates the default stub, that is used in
+ * plain CORBA.
+ *
+ *
+ * @author Angelo Corsaro <corsaro@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_DEFAULT_STUB_FACTORY_H_
+#define TAO_DEFAULT_STUB_FACTORY_H_
+
+#include /**/ "ace/pre.h"
+#include "ace/Service_Config.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Stub_Factory.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_Default_Stub_Factory
+ *
+ * This class is a factory whose product is the plain TAO_Stub used by
+ * TAO. Its subclasses build Stub object that are specialization of
+ * the TAO_Stub. As an example TAO_RT_Stub_Factory creates
+ * RT_TAO_Stub. This factory, or one of its subclasses is dynamically
+ * plugged into the ORB_Core, and is used by the ORB_Core to create
+ * Stub Objects.
+ */
+class TAO_Export TAO_Default_Stub_Factory
+ : public TAO_Stub_Factory
+{
+public:
+
+ /// Destructor.
+ virtual ~TAO_Default_Stub_Factory (void);
+
+ /// Creates a Stub Object.
+ virtual TAO_Stub *create_stub (const char *repository_id,
+ const TAO_MProfile &profiles,
+ TAO_ORB_Core *orb_core
+ ACE_ENV_ARG_DECL);
+
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE_EXPORT (TAO, TAO_Default_Stub_Factory)
+ACE_FACTORY_DECLARE (TAO, TAO_Default_Stub_Factory)
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_DEFAULT_STUB_FACTORY_H_ */
diff --git a/TAO/tao/Default_Thread_Lane_Resources_Manager.cpp b/TAO/tao/Default_Thread_Lane_Resources_Manager.cpp
new file mode 100644
index 00000000000..4c6f322ec02
--- /dev/null
+++ b/TAO/tao/Default_Thread_Lane_Resources_Manager.cpp
@@ -0,0 +1,120 @@
+// $Id$
+
+#include "tao/Default_Thread_Lane_Resources_Manager.h"
+#include "tao/Thread_Lane_Resources.h"
+#include "tao/Exception.h"
+#include "tao/Environment.h"
+#include "tao/ORB_Core.h"
+#include "ace/Log_Msg.h"
+
+
+ACE_RCSID (tao,
+ Default_Thread_Lane_Resources_Manager,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Default_Thread_Lane_Resources_Manager::TAO_Default_Thread_Lane_Resources_Manager (TAO_ORB_Core &orb_core)
+ : TAO_Thread_Lane_Resources_Manager (orb_core),
+ lane_resources_ (new TAO_Thread_Lane_Resources (orb_core))
+{
+}
+
+TAO_Default_Thread_Lane_Resources_Manager::~TAO_Default_Thread_Lane_Resources_Manager (void)
+{
+ // Delete the default resources.
+ delete this->lane_resources_;
+}
+
+int
+TAO_Default_Thread_Lane_Resources_Manager::open_default_resources (ACE_ENV_SINGLE_ARG_DECL)
+{
+ TAO_ORB_Parameters * const params =
+ this->orb_core_->orb_params ();
+
+ TAO_EndpointSet endpoint_set;
+
+ params->get_endpoint_set (TAO_DEFAULT_LANE,
+ endpoint_set);
+
+ bool ignore_address = false;
+
+ int const result =
+ this->lane_resources_->open_acceptor_registry (endpoint_set,
+ ignore_address
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ return result;
+}
+
+void
+TAO_Default_Thread_Lane_Resources_Manager::finalize (void)
+{
+ // Finalize default resources.
+ this->lane_resources_->finalize ();
+}
+
+TAO_Thread_Lane_Resources &
+TAO_Default_Thread_Lane_Resources_Manager::lane_resources (void)
+{
+ return *this->lane_resources_;
+}
+
+TAO_Thread_Lane_Resources &
+TAO_Default_Thread_Lane_Resources_Manager::default_lane_resources (void)
+{
+ return this->lane_resources ();
+}
+
+void
+TAO_Default_Thread_Lane_Resources_Manager::shutdown_reactor (void)
+{
+ this->lane_resources_->shutdown_reactor ();
+}
+
+void
+TAO_Default_Thread_Lane_Resources_Manager::cleanup_rw_transports (void)
+{
+ this->lane_resources_->cleanup_rw_transports ();
+}
+
+int
+TAO_Default_Thread_Lane_Resources_Manager::is_collocated (const TAO_MProfile &mprofile)
+{
+ return this->lane_resources_->is_collocated (mprofile);
+}
+
+// -------------------------------------------------------
+
+TAO_Default_Thread_Lane_Resources_Manager_Factory::
+~TAO_Default_Thread_Lane_Resources_Manager_Factory (void)
+{
+}
+
+TAO_Thread_Lane_Resources_Manager *
+TAO_Default_Thread_Lane_Resources_Manager_Factory::create_thread_lane_resources_manager (TAO_ORB_Core &core)
+{
+ TAO_Thread_Lane_Resources_Manager *manager = 0;
+
+ /// Create the Default Thread Lane Resources Manager.
+ ACE_NEW_RETURN (manager,
+ TAO_Default_Thread_Lane_Resources_Manager (core),
+ 0);
+
+ return manager;
+}
+
+// -------------------------------------------------------
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+
+ACE_STATIC_SVC_DEFINE (TAO_Default_Thread_Lane_Resources_Manager_Factory,
+ ACE_TEXT ("Default_Thread_Lane_Resources_Manager_Factory"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (TAO_Default_Thread_Lane_Resources_Manager_Factory),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0)
+ACE_FACTORY_DEFINE (TAO, TAO_Default_Thread_Lane_Resources_Manager_Factory)
diff --git a/TAO/tao/Default_Thread_Lane_Resources_Manager.h b/TAO/tao/Default_Thread_Lane_Resources_Manager.h
new file mode 100644
index 00000000000..89f94829417
--- /dev/null
+++ b/TAO/tao/Default_Thread_Lane_Resources_Manager.h
@@ -0,0 +1,111 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Default_Thread_Lane_Resources_Manager.h
+ *
+ * $Id$
+ *
+ * @author Irfan Pyarali
+ */
+// ===================================================================
+
+#ifndef TAO_DEFAULT_THREAD_LANE_RESOURCES_MANAGER_H
+#define TAO_DEFAULT_THREAD_LANE_RESOURCES_MANAGER_H
+
+#include /**/ "ace/pre.h"
+#include "ace/Service_Config.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Thread_Lane_Resources_Manager.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_Default_Thread_Lane_Resources_Manager
+ *
+ * @brief Simple manager for thread lane resources.
+ *
+
+ * \nosubgrouping
+ *
+ **/
+class TAO_Export TAO_Default_Thread_Lane_Resources_Manager
+ : public TAO_Thread_Lane_Resources_Manager
+{
+public:
+
+ /// Constructor.
+ TAO_Default_Thread_Lane_Resources_Manager (TAO_ORB_Core &orb_core);
+
+ /// Destructor.
+ ~TAO_Default_Thread_Lane_Resources_Manager (void);
+
+ /// Finalize resources.
+ void finalize (void);
+
+ /// Open default resources.
+ int open_default_resources (ACE_ENV_SINGLE_ARG_DECL);
+
+ /// Shutdown reactor.
+ void shutdown_reactor (void);
+
+ /// Shutdown reactor.
+ virtual void cleanup_rw_transports (void);
+
+ /// Does @a mprofile belong to us?
+ int is_collocated (const TAO_MProfile &mprofile);
+
+ /// @name Accessors
+ // @{
+
+ TAO_Thread_Lane_Resources &lane_resources (void);
+
+ TAO_Thread_Lane_Resources &default_lane_resources (void);
+
+ // @}
+
+private:
+
+ TAO_Default_Thread_Lane_Resources_Manager (TAO_Default_Thread_Lane_Resources_Manager const &);
+ void operator= (TAO_Default_Thread_Lane_Resources_Manager const &);
+
+protected:
+
+ /// Default lane resources.
+ TAO_Thread_Lane_Resources * const lane_resources_;
+
+};
+
+/**
+ * @class TAO_Default_Thread_Lane_Resources_Manager_Factory
+ *
+ * @brief This class is a factory for managers of thread resources.
+ *
+ * \nosubgrouping
+ *
+ **/
+class TAO_Export TAO_Default_Thread_Lane_Resources_Manager_Factory
+ : public TAO_Thread_Lane_Resources_Manager_Factory
+{
+public:
+
+ /// Destructor.
+ virtual ~TAO_Default_Thread_Lane_Resources_Manager_Factory (void);
+
+ /// Factory method.
+ TAO_Thread_Lane_Resources_Manager *create_thread_lane_resources_manager (TAO_ORB_Core &core);
+
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE_EXPORT (TAO, TAO_Default_Thread_Lane_Resources_Manager_Factory)
+ACE_FACTORY_DECLARE (TAO, TAO_Default_Thread_Lane_Resources_Manager_Factory)
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_DEFAULT_THREAD_LANE_RESOURCES_MANAGER_H */
diff --git a/TAO/tao/Domain.mpc b/TAO/tao/Domain.mpc
new file mode 100644
index 00000000000..d3f79463993
--- /dev/null
+++ b/TAO/tao/Domain.mpc
@@ -0,0 +1,35 @@
+//$Id$
+project : taolib, core, ifr_client, portableserver {
+ sharedname = TAO_Domain
+ dynamicflags = TAO_DOMAIN_BUILD_DLL
+
+ Source_Files {
+ Domain
+ }
+
+ Header_Files {
+ Domain
+ }
+
+ Inline_Files {
+ Domain
+ }
+
+ Template_Files {
+ Domain
+ }
+
+ Resource_Files {
+ Domain
+ }
+
+ PIDL_Files {
+ }
+
+ IDL_Files {
+ }
+
+ Pkgconfig_Files {
+ Domain/TAO_Domain.pc.in
+ }
+}
diff --git a/TAO/tao/Domain.pidl b/TAO/tao/Domain.pidl
new file mode 100644
index 00000000000..b221159edee
--- /dev/null
+++ b/TAO/tao/Domain.pidl
@@ -0,0 +1,77 @@
+// -*- IDL -*-
+
+/**
+ * @file Domain.pidl
+ *
+ * $Id$
+ *
+ * @brief Pre-compiled IDL source for the CORBA::Domain related
+ * classes.
+ *
+ * This file was used to generate the code in DomainC.{h,inl,cpp}.
+ *
+ * The steps to regenerate the code are as follows:
+ *
+ * 1. Run the tao_idl compiler on the patched pidl file. The
+ * command used for this is:
+ *
+ * tao_idl
+ * -o orig -Gp -Gd -Ge 1 -GA
+ * -Wb,export_macro=TAO_Export
+ * -Wb,export_include=TAO_Export.h
+ * -Wb,pre_include="ace/pre.h"
+ * -Wb,post_include="ace/post.h"
+ * -Wb,versioning_begin=TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+ * -Wb,versioning_end=TAO_END_VERSIONED_NAMESPACE_DECL
+ * Domain.pidl
+ *
+ * 2. Then patch the generated code. This patch (a) eliminates
+ * cycles in the include dependencies.
+ *
+ * Apply patches using the following commands:
+ *
+ * cp orig/DomainC.{h,i,cpp} .
+ * cp orig/Domain{S,S_T}.{h,i,cpp} Domain
+ * patch < diffs/Domain.diff
+ *
+ * 3. You'll have to move the Domain skeleton files from TAO/tao
+ * to the TAO_Domain library by hand.
+ *
+ * Note: The diffs were generated with these commands:
+ *
+ * for i in DomainC.{h,cpp}; do
+ * diff -wBbu orig/$i $i;
+ * done > diffs/Domain.diff
+ */
+
+#ifndef TAO_CORBA_DOMAIN_PIDL
+#define TAO_CORBA_DOMAIN_PIDL
+
+#include "tao/Policy.pidl"
+#include "tao/InterfaceDef.pidl"
+
+#pragma prefix "omg.org"
+
+module CORBA
+{
+ interface DomainManager
+ {
+ Policy get_domain_policy (
+ in PolicyType policy_type
+ );
+ };
+
+ const PolicyType SecConstruction = 11;
+
+ interface ConstructionPolicy : Policy
+ {
+ void make_domain_manager (
+ in InterfaceDef object_type,
+ in boolean constr_policy
+ );
+ };
+
+ typedef sequence <DomainManager> DomainManagerList;
+};
+
+#endif /* TAO_CORBA_DOMAIN_IDL */
diff --git a/TAO/tao/Domain/DomainS.cpp b/TAO/tao/Domain/DomainS.cpp
new file mode 100644
index 00000000000..cb4c792f819
--- /dev/null
+++ b/TAO/tao/Domain/DomainS.cpp
@@ -0,0 +1,1692 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:599
+
+#ifndef _TAO_IDL_ORIG_DOMAINS_CPP_
+#define _TAO_IDL_ORIG_DOMAINS_CPP_
+
+
+#include "tao/Domain/DomainS.h"
+#include "tao/PortableServer/Operation_Table_Perfect_Hash.h"
+#include "tao/PortableServer/Direct_Collocation_Upcall_Wrapper.h"
+#include "tao/PortableServer/Upcall_Command.h"
+#include "tao/PortableServer/Upcall_Wrapper.h"
+#include "tao/PortableServer/Basic_SArguments.h"
+#include "tao/PortableServer/Object_SArgument_T.h"
+#include "tao/PortableServer/Special_Basic_SArguments.h"
+#include "tao/PortableServer/UB_String_SArguments.h"
+#include "tao/PortableServer/TypeCode_SArg_Traits.h"
+#include "tao/PortableServer/Object_SArg_Traits.h"
+#include "tao/PortableServer/get_arg.h"
+#include "tao/Special_Basic_Arguments.h"
+#include "tao/UB_String_Arguments.h"
+#include "tao/TAO_Server_Request.h"
+#include "tao/ORB_Core.h"
+#include "tao/Profile.h"
+#include "tao/Stub.h"
+#include "tao/IFR_Client_Adapter.h"
+#include "tao/Object_T.h"
+#include "tao/AnyTypeCode/TypeCode.h"
+#include "tao/AnyTypeCode/DynamicC.h"
+#include "tao/CDR.h"
+#include "tao/operation_details.h"
+#include "tao/PortableInterceptor.h"
+#include "tao/Basic_Arguments.h"
+#include "tao/Object_Argument_T.h"
+#include "tao/Special_Basic_Arguments.h"
+#include "ace/Dynamic_Service.h"
+#include "ace/Malloc_Allocator.h"
+
+#if defined (__BORLANDC__)
+#pragma option -w-rvl -w-rch -w-ccc -w-aus
+#endif /* __BORLANDC__ */
+
+#if !defined (__ACE_INLINE__)
+#include "tao/Domain/DomainS.inl"
+#endif /* !defined INLINE */
+
+// TAO_IDL - Generated from
+// be\be_visitor_arg_traits.cpp:69
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Arg traits specializations.
+namespace TAO
+{
+
+#if !defined (_CORBA_POLICY__SARG_TRAITS_SS_)
+#define _CORBA_POLICY__SARG_TRAITS_SS_
+
+ template<>
+ class SArg_Traits<CORBA::Policy>
+ : public
+ Object_SArg_Traits_T<
+ CORBA::Policy_ptr,
+ CORBA::Policy_var,
+ CORBA::Policy_out,
+ TAO::Any_Insert_Policy_AnyTypeCode_Adapter <CORBA::Policy_ptr>
+ >
+ {
+ };
+
+#endif /* end #if !defined */
+
+#if !defined (_CORBA_INTERFACEDEF__SARG_TRAITS_SS_)
+#define _CORBA_INTERFACEDEF__SARG_TRAITS_SS_
+
+ template<>
+ class SArg_Traits<CORBA::InterfaceDef>
+ : public
+ Object_SArg_Traits_T<
+ CORBA::InterfaceDef_ptr,
+ CORBA::InterfaceDef_var,
+ CORBA::InterfaceDef_out,
+ TAO::Any_Insert_Policy_IFR_Client_Adapter <CORBA::InterfaceDef_ptr>
+ >
+ {
+ };
+
+#endif /* end #if !defined */
+}
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_arg_traits.cpp:69
+
+// Arg traits specializations.
+namespace TAO
+{
+
+#if !defined (_CORBA_POLICY__ARG_TRAITS_SS_)
+#define _CORBA_POLICY__ARG_TRAITS_SS_
+
+ template<>
+ class Arg_Traits<CORBA::Policy>
+ : public
+ Object_Arg_Traits_T<
+ CORBA::Policy_ptr,
+ CORBA::Policy_var,
+ CORBA::Policy_out,
+ TAO::Objref_Traits<CORBA::Policy>,
+ TAO::Any_Insert_Policy_Stream <CORBA::Policy_ptr>
+ >
+ {
+ };
+
+#endif /* end #if !defined */
+
+#if !defined (_CORBA_INTERFACEDEF__ARG_TRAITS_SS_)
+#define _CORBA_INTERFACEDEF__ARG_TRAITS_SS_
+
+ template<>
+ class Arg_Traits<CORBA::InterfaceDef>
+ : public
+ Object_Arg_Traits_T<
+ CORBA::InterfaceDef_ptr,
+ CORBA::InterfaceDef_var,
+ CORBA::InterfaceDef_out,
+ TAO::Objref_Traits<CORBA::InterfaceDef>,
+ TAO::Any_Insert_Policy_Stream <CORBA::InterfaceDef_ptr>
+ >
+ {
+ };
+
+#endif /* end #if !defined */
+}
+
+
+// TAO_IDL - Generated from
+// be\be_interface.cpp:1455
+
+class TAO_CORBA_DomainManager_Perfect_Hash_OpTable
+ : public TAO_Perfect_Hash_OpTable
+{
+private:
+ unsigned int hash (const char *str, unsigned int len);
+
+public:
+ const TAO_operation_db_entry * lookup (const char *str, unsigned int len);
+};
+
+/* C++ code produced by gperf version 2.8 (ACE version) */
+/* Command-line: c:\ACE\latest\ACE_wrappers\bin\gperf.exe -m -M -J -c -C -D -E -T -f 0 -F 0,0 -a -o -t -p -K opname -L C++ -Z TAO_CORBA_DomainManager_Perfect_Hash_OpTable -N lookup */
+unsigned int
+TAO_CORBA_DomainManager_Perfect_Hash_OpTable::hash (const char *str, unsigned int len)
+{
+ static const unsigned char asso_values[] =
+ {
+#if defined (ACE_MVS)
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 0,
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 0,
+ 18, 18, 18, 5, 18, 0, 18, 18, 18, 18,
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 0, 18, 18, 18, 18, 0, 18,
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 18, 18,
+#else
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 18, 0, 18, 0, 18, 18,
+ 18, 5, 18, 0, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 18, 18, 0, 18, 18, 18,
+ 18, 0, 18, 18, 18, 18, 18, 18,
+#endif /* ACE_MVS */
+ };
+ return len + asso_values[(int) str[len - 1]] + asso_values[(int) str[0]];
+}
+
+const TAO_operation_db_entry *
+TAO_CORBA_DomainManager_Perfect_Hash_OpTable::lookup (const char *str, unsigned int len)
+{
+ enum
+ {
+ TOTAL_KEYWORDS = 5,
+ MIN_WORD_LENGTH = 5,
+ MAX_WORD_LENGTH = 17,
+ MIN_HASH_VALUE = 5,
+ MAX_HASH_VALUE = 17,
+ HASH_VALUE_RANGE = 13,
+ DUPLICATES = 0,
+ WORDLIST_SIZE = 10
+ };
+
+ static const TAO_operation_db_entry wordlist[] =
+ {
+ {"",0,0},{"",0,0},{"",0,0},{"",0,0},{"",0,0},
+ {"_is_a", &POA_CORBA::DomainManager::_is_a_skel, 0},
+ {"",0,0},{"",0,0},{"",0,0},{"",0,0},
+ {"_component", &POA_CORBA::DomainManager::_component_skel, 0},
+ {"",0,0},{"",0,0},
+ {"_non_existent", &POA_CORBA::DomainManager::_non_existent_skel, 0},
+ {"",0,0},
+ {"_interface", &POA_CORBA::DomainManager::_interface_skel, 0},
+ {"",0,0},
+ {"get_domain_policy", &POA_CORBA::DomainManager::get_domain_policy_skel, &POA_CORBA::_TAO_DomainManager_Direct_Proxy_Impl::get_domain_policy},
+ };
+
+ if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
+ {
+ unsigned int key = hash (str, len);
+
+ if (key <= MAX_HASH_VALUE && key >= MIN_HASH_VALUE)
+ {
+ const char *s = wordlist[key].opname;
+
+ if (*str == *s && !strncmp (str + 1, s + 1, len - 1))
+ return &wordlist[key];
+ }
+ }
+ return 0;
+}
+
+static TAO_CORBA_DomainManager_Perfect_Hash_OpTable tao_CORBA_DomainManager_optable;
+///////////////////////////////////////////////////////////////////////
+// Strategized Proxy Broker Implementation
+//
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/strategized_proxy_broker_ss.cpp:40
+
+// Factory function Implementation.
+POA_CORBA::_TAO_DomainManager_Strategized_Proxy_Broker *
+POA_CORBA::_TAO_DomainManager_Strategized_Proxy_Broker::the_TAO_DomainManager_Strategized_Proxy_Broker (void)
+{
+ static POA_CORBA::_TAO_DomainManager_Strategized_Proxy_Broker
+ strategized_proxy_broker;
+
+ return &strategized_proxy_broker;
+}
+
+POA_CORBA::_TAO_DomainManager_Strategized_Proxy_Broker::_TAO_DomainManager_Strategized_Proxy_Broker (void)
+{
+}
+
+POA_CORBA::_TAO_DomainManager_Strategized_Proxy_Broker::~_TAO_DomainManager_Strategized_Proxy_Broker (void)
+{
+}
+
+TAO::Collocation_Strategy
+POA_CORBA::_TAO_DomainManager_Strategized_Proxy_Broker::get_strategy (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ TAO::Collocation_Strategy strategy =
+ TAO_ORB_Core::collocation_strategy (obj ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO::TAO_CS_REMOTE_STRATEGY);
+
+ return strategy;
+}
+
+void
+POA_CORBA::_TAO_DomainManager_Strategized_Proxy_Broker::dispatch (
+ CORBA::Object_ptr obj,
+ CORBA::Object_out forward_obj,
+ TAO::Argument ** args,
+ int num_args,
+ const char * op,
+ size_t op_len,
+ TAO::Collocation_Strategy strategy
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::Exception))
+{
+ TAO::Direct_Collocation_Upcall_Wrapper collocation_upcall_wrapper;
+ collocation_upcall_wrapper.upcall (
+ obj,
+ forward_obj,
+ args,
+ num_args,
+ op,
+ op_len,
+ strategy
+ ACE_ENV_ARG_PARAMETER);
+}
+
+//
+// End Strategized Proxy Broker Implementation
+///////////////////////////////////////////////////////////////////////
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/interface_ss.cpp:999
+
+TAO::Collocation_Proxy_Broker *
+CORBA__TAO_DomainManager_Proxy_Broker_Factory_function (CORBA::Object_ptr)
+{
+ return
+ ::POA_CORBA::_TAO_DomainManager_Strategized_Proxy_Broker::the_TAO_DomainManager_Strategized_Proxy_Broker ();
+}
+
+int
+CORBA__TAO_DomainManager_Proxy_Broker_Factory_Initializer (size_t)
+{
+ CORBA__TAO_DomainManager_Proxy_Broker_Factory_function_pointer =
+ CORBA__TAO_DomainManager_Proxy_Broker_Factory_function;
+
+ return 0;
+}
+
+static int
+CORBA__TAO_DomainManager_Proxy_Broker_Stub_Factory_Initializer_Scarecrow =
+ CORBA__TAO_DomainManager_Proxy_Broker_Factory_Initializer (
+ reinterpret_cast<size_t> (CORBA__TAO_DomainManager_Proxy_Broker_Factory_Initializer)
+ );
+
+
+
+///////////////////////////////////////////////////////////////////////
+// Direct Proxy Implementation
+//
+
+POA_CORBA::_TAO_DomainManager_Direct_Proxy_Impl::_TAO_DomainManager_Direct_Proxy_Impl (void)
+{}
+
+// TAO_IDL - Generated from
+// be\be_visitor_operation/direct_proxy_impl_ss.cpp:42
+
+void
+POA_CORBA::_TAO_DomainManager_Direct_Proxy_Impl::get_domain_policy (
+ TAO_Abstract_ServantBase *servant,
+ TAO::Argument ** args,
+ int
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ ((TAO::Arg_Traits< CORBA::Policy>::ret_val *) args[0])->arg () =
+ dynamic_cast<POA_CORBA::DomainManager_ptr>
+ (servant)
+ ->get_domain_policy (
+ ((TAO::Arg_Traits< ::CORBA::PolicyType>::in_arg_val *) args[1])->arg ()
+ ACE_ENV_ARG_PARAMETER
+ );
+ ACE_CHECK;
+}
+
+
+//
+// End Direct Proxy Implementation
+///////////////////////////////////////////////////////////////////////
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/interface_ss.cpp:103
+
+POA_CORBA::DomainManager::DomainManager (void)
+ : TAO_ServantBase ()
+{
+ this->optable_ = &tao_CORBA_DomainManager_optable;
+}
+
+POA_CORBA::DomainManager::DomainManager (const DomainManager& rhs)
+ : TAO_Abstract_ServantBase (rhs),
+ TAO_ServantBase (rhs)
+{
+}
+
+POA_CORBA::DomainManager::~DomainManager (void)
+{
+}
+namespace POA_CORBA
+{
+
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/upcall_command_ss.cpp:127
+
+ class get_domain_policy_DomainManager
+ : public TAO::Upcall_Command
+ {
+ public:
+ inline get_domain_policy_DomainManager (
+ POA_CORBA::DomainManager * servant,
+ TAO_Operation_Details const * operation_details,
+ TAO::Argument * const args[])
+ : servant_ (servant)
+ , operation_details_ (operation_details)
+ , args_ (args)
+ {
+ }
+
+ virtual void execute (ACE_ENV_SINGLE_ARG_DECL)
+ {
+ TAO::SArg_Traits< CORBA::Policy>::ret_arg_type retval =
+ TAO::Portable_Server::get_ret_arg< CORBA::Policy> (
+ this->operation_details_,
+ this->args_);
+
+ TAO::SArg_Traits< ::CORBA::PolicyType>::in_arg_type arg_1 =
+ TAO::Portable_Server::get_in_arg< ::CORBA::PolicyType> (
+ this->operation_details_,
+ this->args_,
+ 1);
+
+
+ retval =
+ this->servant_->get_domain_policy (
+ arg_1
+ ACE_ENV_ARG_PARAMETER);
+
+ }
+
+ private:
+ POA_CORBA::DomainManager * const servant_;
+ TAO_Operation_Details const * const operation_details_;
+ TAO::Argument * const * const args_;
+ };
+
+}
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_operation/operation_ss.cpp:192
+
+void POA_CORBA::DomainManager::get_domain_policy_skel (
+ TAO_ServerRequest & server_request,
+ void * TAO_INTERCEPTOR (servant_upcall),
+ void * servant
+ ACE_ENV_ARG_DECL
+ )
+{
+
+
+#if TAO_HAS_INTERCEPTORS == 1
+ static CORBA::TypeCode_ptr const * const exceptions = 0;
+ static ::CORBA::ULong const nexceptions = 0;
+#endif /* TAO_HAS_INTERCEPTORS */
+
+ TAO::SArg_Traits< CORBA::Policy>::ret_val retval;
+ TAO::SArg_Traits< ::CORBA::PolicyType>::in_arg_val _tao_policy_type;
+
+ TAO::Argument * const args[] =
+ {
+ &retval,
+ &_tao_policy_type
+ };
+
+ static size_t const nargs = 2;
+
+ POA_CORBA::DomainManager * const impl =
+ static_cast<POA_CORBA::DomainManager *> (servant);
+
+ get_domain_policy_DomainManager command (
+ impl,
+ server_request.operation_details (),
+ args);
+
+ TAO::Upcall_Wrapper upcall_wrapper;
+ upcall_wrapper.upcall (server_request
+ , args
+ , nargs
+ , command
+#if TAO_HAS_INTERCEPTORS == 1
+ , servant_upcall
+ , exceptions
+ , nexceptions
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/interface_ss.cpp:169
+
+namespace POA_CORBA
+{
+
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/upcall_command_ss.cpp:127
+
+ class _is_a_DomainManager_Upcall_Command
+ : public TAO::Upcall_Command
+ {
+ public:
+ inline _is_a_DomainManager_Upcall_Command (
+ POA_CORBA::DomainManager * servant,
+ TAO_Operation_Details const * operation_details,
+ TAO::Argument * const args[])
+ : servant_ (servant)
+ , operation_details_ (operation_details)
+ , args_ (args)
+ {
+ }
+
+ virtual void execute (ACE_ENV_SINGLE_ARG_DECL)
+ {
+ TAO::SArg_Traits< ::ACE_InputCDR::to_boolean>::ret_arg_type retval =
+ TAO::Portable_Server::get_ret_arg< ::ACE_InputCDR::to_boolean> (
+ this->operation_details_,
+ this->args_);
+
+ TAO::SArg_Traits< CORBA::Char *>::in_arg_type arg_1 =
+ TAO::Portable_Server::get_in_arg< CORBA::Char *> (
+ this->operation_details_,
+ this->args_,
+ 1);
+
+
+ retval =
+ this->servant_-> _is_a (
+ arg_1
+ ACE_ENV_ARG_PARAMETER);
+
+ }
+
+ private:
+ POA_CORBA::DomainManager * const servant_;
+ TAO_Operation_Details const * const operation_details_;
+ TAO::Argument * const * const args_;
+ };
+
+}
+void POA_CORBA::DomainManager::_is_a_skel (
+ TAO_ServerRequest & server_request,
+ void * TAO_INTERCEPTOR (servant_upcall),
+ void * servant
+ ACE_ENV_ARG_DECL
+ )
+{
+
+
+#if TAO_HAS_INTERCEPTORS == 1
+ static CORBA::TypeCode_ptr const * const exceptions = 0;
+ static CORBA::ULong const nexceptions = 0;
+#endif /* TAO_HAS_INTERCEPTORS */
+
+ TAO::SArg_Traits< ::ACE_InputCDR::to_boolean>::ret_val retval;
+ TAO::SArg_Traits< CORBA::Char *>::in_arg_val _tao_repository_id;
+
+ TAO::Argument * const args[] =
+ {
+ &retval,
+ &_tao_repository_id
+ };
+
+ static size_t const nargs = 2;
+
+ POA_CORBA::DomainManager * const impl =
+ static_cast<POA_CORBA::DomainManager *> (servant);
+
+ _is_a_DomainManager_Upcall_Command command (
+ impl,
+ server_request.operation_details (),
+ args);
+
+ TAO::Upcall_Wrapper upcall_wrapper;
+ upcall_wrapper.upcall (server_request
+ , args
+ , nargs
+ , command
+#if TAO_HAS_INTERCEPTORS == 1
+ , servant_upcall
+ , exceptions
+ , nexceptions
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+}
+
+namespace POA_CORBA
+{
+
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/upcall_command_ss.cpp:127
+
+ class _non_existent_DomainManager_Upcall_Command
+ : public TAO::Upcall_Command
+ {
+ public:
+ inline _non_existent_DomainManager_Upcall_Command (
+ POA_CORBA::DomainManager * servant,
+ TAO_Operation_Details const * operation_details,
+ TAO::Argument * const args[])
+ : servant_ (servant)
+ , operation_details_ (operation_details)
+ , args_ (args)
+ {
+ }
+
+ virtual void execute (ACE_ENV_SINGLE_ARG_DECL)
+ {
+ TAO::SArg_Traits< ::ACE_InputCDR::to_boolean>::ret_arg_type retval =
+ TAO::Portable_Server::get_ret_arg< ::ACE_InputCDR::to_boolean> (
+ this->operation_details_,
+ this->args_);
+
+
+ retval =
+ this->servant_-> _non_existent (
+ ACE_ENV_SINGLE_ARG_PARAMETER);
+
+ }
+
+ private:
+ POA_CORBA::DomainManager * const servant_;
+ TAO_Operation_Details const * const operation_details_;
+ TAO::Argument * const * const args_;
+ };
+
+}
+void POA_CORBA::DomainManager::_non_existent_skel (
+ TAO_ServerRequest & server_request,
+ void * TAO_INTERCEPTOR (servant_upcall),
+ void * servant
+ ACE_ENV_ARG_DECL
+ )
+{
+
+
+#if TAO_HAS_INTERCEPTORS == 1
+ static CORBA::TypeCode_ptr const * const exceptions = 0;
+ static CORBA::ULong const nexceptions = 0;
+#endif /* TAO_HAS_INTERCEPTORS */
+
+ TAO::SArg_Traits< ::ACE_InputCDR::to_boolean>::ret_val retval;
+
+ TAO::Argument * const args[] =
+ {
+ &retval
+ };
+
+ static size_t const nargs = 1;
+
+ POA_CORBA::DomainManager * const impl =
+ static_cast<POA_CORBA::DomainManager *> (servant);
+
+ _non_existent_DomainManager_Upcall_Command command (
+ impl,
+ server_request.operation_details (),
+ args);
+
+ TAO::Upcall_Wrapper upcall_wrapper;
+ upcall_wrapper.upcall (server_request
+ , args
+ , nargs
+ , command
+#if TAO_HAS_INTERCEPTORS == 1
+ , servant_upcall
+ , exceptions
+ , nexceptions
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+}
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/interface_ss.cpp:393
+
+
+
+void POA_CORBA::DomainManager::_interface_skel (
+ TAO_ServerRequest & server_request,
+ void * /* servant_upcall */,
+ void * servant
+ ACE_ENV_ARG_DECL
+ )
+{
+ TAO_IFR_Client_Adapter *_tao_adapter =
+ ACE_Dynamic_Service<TAO_IFR_Client_Adapter>::instance (
+ TAO_ORB_Core::ifr_client_adapter_name ()
+ );
+
+ if (_tao_adapter == 0)
+ {
+ ACE_THROW (CORBA::INTF_REPOS (CORBA::OMGVMCID | 1,
+ CORBA::COMPLETED_NO));
+ }
+
+ POA_CORBA::DomainManager * const impl =
+ static_cast<POA_CORBA::DomainManager *> (servant);
+ CORBA::InterfaceDef_ptr _tao_retval =
+ impl->_get_interface (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ server_request.init_reply ();
+ TAO_OutputCDR &_tao_out = *server_request.outgoing ();
+
+ CORBA::Boolean const _tao_result =
+ _tao_adapter->interfacedef_cdr_insert (
+ _tao_out,
+ _tao_retval
+ );
+
+ _tao_adapter->dispose (_tao_retval);
+
+ if (_tao_result == 0)
+ {
+ ACE_THROW (CORBA::MARSHAL ());
+ }
+}
+
+namespace POA_CORBA
+{
+
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/upcall_command_ss.cpp:127
+
+ class _get_component_DomainManager_Upcall_Command
+ : public TAO::Upcall_Command
+ {
+ public:
+ inline _get_component_DomainManager_Upcall_Command (
+ POA_CORBA::DomainManager * servant,
+ TAO_Operation_Details const * operation_details,
+ TAO::Argument * const args[])
+ : servant_ (servant)
+ , operation_details_ (operation_details)
+ , args_ (args)
+ {
+ }
+
+ virtual void execute (ACE_ENV_SINGLE_ARG_DECL)
+ {
+ TAO::SArg_Traits< ::CORBA::Object>::ret_arg_type retval =
+ TAO::Portable_Server::get_ret_arg< ::CORBA::Object> (
+ this->operation_details_,
+ this->args_);
+
+
+ retval =
+ this->servant_-> _get_component (
+ ACE_ENV_SINGLE_ARG_PARAMETER);
+
+ }
+
+ private:
+ POA_CORBA::DomainManager * const servant_;
+ TAO_Operation_Details const * const operation_details_;
+ TAO::Argument * const * const args_;
+ };
+
+}
+void POA_CORBA::DomainManager::_component_skel (
+ TAO_ServerRequest & server_request,
+ void * TAO_INTERCEPTOR (servant_upcall),
+ void * servant
+ ACE_ENV_ARG_DECL
+ )
+{
+
+
+#if TAO_HAS_INTERCEPTORS == 1
+ static CORBA::TypeCode_ptr const * const exceptions = 0;
+ static CORBA::ULong const nexceptions = 0;
+#endif /* TAO_HAS_INTERCEPTORS */
+
+ TAO::SArg_Traits< ::CORBA::Object>::ret_val retval;
+
+ TAO::Argument * const args[] =
+ {
+ &retval
+ };
+
+ static size_t const nargs = 1;
+
+ POA_CORBA::DomainManager * const impl =
+ static_cast<POA_CORBA::DomainManager *> (servant);
+
+ _get_component_DomainManager_Upcall_Command command (
+ impl,
+ server_request.operation_details (),
+ args);
+
+ TAO::Upcall_Wrapper upcall_wrapper;
+ upcall_wrapper.upcall (server_request
+ , args
+ , nargs
+ , command
+#if TAO_HAS_INTERCEPTORS == 1
+ , servant_upcall
+ , exceptions
+ , nexceptions
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+}
+
+CORBA::Boolean POA_CORBA::DomainManager::_is_a (
+ const char* value
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return
+ (
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/DomainManager:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/Object:1.0"
+ )
+ );
+}
+
+const char* POA_CORBA::DomainManager::_interface_repository_id (void) const
+{
+ return "IDL:omg.org/CORBA/DomainManager:1.0";
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/interface_ss.cpp:940
+
+void POA_CORBA::DomainManager::_dispatch (
+ TAO_ServerRequest & req,
+ void * servant_upcall
+ ACE_ENV_ARG_DECL
+ )
+{
+ this->synchronous_upcall_dispatch (req,
+ servant_upcall,
+ this
+ ACE_ENV_ARG_PARAMETER);
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/interface_ss.cpp:891
+
+CORBA::DomainManager *
+POA_CORBA::DomainManager::_this (ACE_ENV_SINGLE_ARG_DECL)
+{
+ TAO_Stub *stub = this->_create_stub (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ TAO_Stub_Auto_Ptr safe_stub (stub);
+ CORBA::Object_ptr tmp = CORBA::Object::_nil ();
+
+ CORBA::Boolean _tao_opt_colloc =
+ stub->servant_orb_var ()->orb_core ()->optimize_collocation_objects ();
+
+ ACE_NEW_RETURN (
+ tmp,
+ CORBA::Object (stub, _tao_opt_colloc, this),
+ 0
+ );
+
+ CORBA::Object_var obj = tmp;
+ (void) safe_stub.release ();
+
+ typedef ::CORBA::DomainManager STUB_SCOPED_NAME;
+ return
+ TAO::Narrow_Utils<STUB_SCOPED_NAME>::unchecked_narrow (
+ obj.in (),
+ CORBA__TAO_DomainManager_Proxy_Broker_Factory_function_pointer
+ );
+}
+
+// TAO_IDL - Generated from
+// be\be_interface.cpp:1455
+
+class TAO_CORBA_ConstructionPolicy_Perfect_Hash_OpTable
+ : public TAO_Perfect_Hash_OpTable
+{
+private:
+ unsigned int hash (const char *str, unsigned int len);
+
+public:
+ const TAO_operation_db_entry * lookup (const char *str, unsigned int len);
+};
+
+/* C++ code produced by gperf version 2.8 (ACE version) */
+/* Command-line: c:\ACE\latest\ACE_wrappers\bin\gperf.exe -m -M -J -c -C -D -E -T -f 0 -F 0,0 -a -o -t -p -K opname -L C++ -Z TAO_CORBA_ConstructionPolicy_Perfect_Hash_OpTable -N lookup */
+unsigned int
+TAO_CORBA_ConstructionPolicy_Perfect_Hash_OpTable::hash (const char *str, unsigned int len)
+{
+ static const unsigned char asso_values[] =
+ {
+#if defined (ACE_MVS)
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 0,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 0,
+ 22, 0, 0, 5, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 0, 22,
+ 22, 22, 22, 0, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 0, 22, 22, 22, 22, 0, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22,
+#else
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 0, 22, 0, 22, 0,
+ 0, 5, 22, 22, 22, 22, 22, 22, 22, 0,
+ 22, 22, 22, 22, 0, 22, 0, 22, 22, 22,
+ 22, 0, 22, 22, 22, 22, 22, 22,
+#endif /* ACE_MVS */
+ };
+ return len + asso_values[(int) str[len - 1]] + asso_values[(int) str[0]];
+}
+
+const TAO_operation_db_entry *
+TAO_CORBA_ConstructionPolicy_Perfect_Hash_OpTable::lookup (const char *str, unsigned int len)
+{
+ enum
+ {
+ TOTAL_KEYWORDS = 8,
+ MIN_WORD_LENGTH = 4,
+ MAX_WORD_LENGTH = 19,
+ MIN_HASH_VALUE = 4,
+ MAX_HASH_VALUE = 21,
+ HASH_VALUE_RANGE = 18,
+ DUPLICATES = 0,
+ WORDLIST_SIZE = 12
+ };
+
+ static const TAO_operation_db_entry wordlist[] =
+ {
+ {"",0,0},{"",0,0},{"",0,0},{"",0,0},
+ {"copy", &POA_CORBA::ConstructionPolicy::copy_skel, &POA_CORBA::_TAO_ConstructionPolicy_Direct_Proxy_Impl::copy},
+ {"_is_a", &POA_CORBA::ConstructionPolicy::_is_a_skel, 0},
+ {"",0,0},
+ {"destroy", &POA_CORBA::ConstructionPolicy::destroy_skel, &POA_CORBA::_TAO_ConstructionPolicy_Direct_Proxy_Impl::destroy},
+ {"",0,0},{"",0,0},
+ {"_component", &POA_CORBA::ConstructionPolicy::_component_skel, 0},
+ {"",0,0},{"",0,0},
+ {"_non_existent", &POA_CORBA::ConstructionPolicy::_non_existent_skel, 0},
+ {"",0,0},
+ {"_interface", &POA_CORBA::ConstructionPolicy::_interface_skel, 0},
+ {"",0,0},{"",0,0},{"",0,0},
+ {"make_domain_manager", &POA_CORBA::ConstructionPolicy::make_domain_manager_skel, &POA_CORBA::_TAO_ConstructionPolicy_Direct_Proxy_Impl::make_domain_manager},
+ {"",0,0},
+ {"_get_policy_type", &POA_CORBA::ConstructionPolicy::_get_policy_type_skel, &POA_CORBA::_TAO_ConstructionPolicy_Direct_Proxy_Impl::_get_policy_type},
+ };
+
+ if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
+ {
+ unsigned int key = hash (str, len);
+
+ if (key <= MAX_HASH_VALUE && key >= MIN_HASH_VALUE)
+ {
+ const char *s = wordlist[key].opname;
+
+ if (*str == *s && !strncmp (str + 1, s + 1, len - 1))
+ return &wordlist[key];
+ }
+ }
+ return 0;
+}
+
+static TAO_CORBA_ConstructionPolicy_Perfect_Hash_OpTable tao_CORBA_ConstructionPolicy_optable;
+///////////////////////////////////////////////////////////////////////
+// Strategized Proxy Broker Implementation
+//
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/strategized_proxy_broker_ss.cpp:40
+
+// Factory function Implementation.
+POA_CORBA::_TAO_ConstructionPolicy_Strategized_Proxy_Broker *
+POA_CORBA::_TAO_ConstructionPolicy_Strategized_Proxy_Broker::the_TAO_ConstructionPolicy_Strategized_Proxy_Broker (void)
+{
+ static POA_CORBA::_TAO_ConstructionPolicy_Strategized_Proxy_Broker
+ strategized_proxy_broker;
+
+ return &strategized_proxy_broker;
+}
+
+POA_CORBA::_TAO_ConstructionPolicy_Strategized_Proxy_Broker::_TAO_ConstructionPolicy_Strategized_Proxy_Broker (void)
+{
+}
+
+POA_CORBA::_TAO_ConstructionPolicy_Strategized_Proxy_Broker::~_TAO_ConstructionPolicy_Strategized_Proxy_Broker (void)
+{
+}
+
+TAO::Collocation_Strategy
+POA_CORBA::_TAO_ConstructionPolicy_Strategized_Proxy_Broker::get_strategy (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ TAO::Collocation_Strategy strategy =
+ TAO_ORB_Core::collocation_strategy (obj ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO::TAO_CS_REMOTE_STRATEGY);
+
+ return strategy;
+}
+
+void
+POA_CORBA::_TAO_ConstructionPolicy_Strategized_Proxy_Broker::dispatch (
+ CORBA::Object_ptr obj,
+ CORBA::Object_out forward_obj,
+ TAO::Argument ** args,
+ int num_args,
+ const char * op,
+ size_t op_len,
+ TAO::Collocation_Strategy strategy
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::Exception))
+{
+ TAO::Direct_Collocation_Upcall_Wrapper collocation_upcall_wrapper;
+ collocation_upcall_wrapper.upcall (
+ obj,
+ forward_obj,
+ args,
+ num_args,
+ op,
+ op_len,
+ strategy
+ ACE_ENV_ARG_PARAMETER);
+}
+
+//
+// End Strategized Proxy Broker Implementation
+///////////////////////////////////////////////////////////////////////
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/interface_ss.cpp:999
+
+TAO::Collocation_Proxy_Broker *
+CORBA__TAO_ConstructionPolicy_Proxy_Broker_Factory_function (CORBA::Object_ptr)
+{
+ return
+ ::POA_CORBA::_TAO_ConstructionPolicy_Strategized_Proxy_Broker::the_TAO_ConstructionPolicy_Strategized_Proxy_Broker ();
+}
+
+int
+CORBA__TAO_ConstructionPolicy_Proxy_Broker_Factory_Initializer (size_t)
+{
+ CORBA__TAO_ConstructionPolicy_Proxy_Broker_Factory_function_pointer =
+ CORBA__TAO_ConstructionPolicy_Proxy_Broker_Factory_function;
+
+ return 0;
+}
+
+static int
+CORBA__TAO_ConstructionPolicy_Proxy_Broker_Stub_Factory_Initializer_Scarecrow =
+ CORBA__TAO_ConstructionPolicy_Proxy_Broker_Factory_Initializer (
+ reinterpret_cast<size_t> (CORBA__TAO_ConstructionPolicy_Proxy_Broker_Factory_Initializer)
+ );
+
+
+
+///////////////////////////////////////////////////////////////////////
+// Direct Proxy Implementation
+//
+
+POA_CORBA::_TAO_ConstructionPolicy_Direct_Proxy_Impl::_TAO_ConstructionPolicy_Direct_Proxy_Impl (void)
+{}
+
+// TAO_IDL - Generated from
+// be\be_visitor_operation/direct_proxy_impl_ss.cpp:42
+
+void
+POA_CORBA::_TAO_ConstructionPolicy_Direct_Proxy_Impl::make_domain_manager (
+ TAO_Abstract_ServantBase *servant,
+ TAO::Argument ** args,
+ int
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ dynamic_cast<POA_CORBA::ConstructionPolicy_ptr>
+ (servant)
+ ->make_domain_manager (
+ ((TAO::Arg_Traits< CORBA::InterfaceDef>::in_arg_val *) args[1])->arg (),
+ ((TAO::Arg_Traits< ::ACE_InputCDR::to_boolean>::in_arg_val *) args[2])->arg ()
+ ACE_ENV_ARG_PARAMETER
+ );
+ ACE_CHECK;
+}
+
+
+//
+// End Direct Proxy Implementation
+///////////////////////////////////////////////////////////////////////
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/interface_ss.cpp:103
+
+POA_CORBA::ConstructionPolicy::ConstructionPolicy (void)
+ : TAO_ServantBase ()
+{
+ this->optable_ = &tao_CORBA_ConstructionPolicy_optable;
+}
+
+POA_CORBA::ConstructionPolicy::ConstructionPolicy (const ConstructionPolicy& rhs)
+ : TAO_Abstract_ServantBase (rhs),
+ TAO_ServantBase (rhs),
+ ::POA_CORBA::Policy (rhs)
+{
+}
+
+POA_CORBA::ConstructionPolicy::~ConstructionPolicy (void)
+{
+}
+namespace POA_CORBA
+{
+
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/upcall_command_ss.cpp:127
+
+ class make_domain_manager_ConstructionPolicy
+ : public TAO::Upcall_Command
+ {
+ public:
+ inline make_domain_manager_ConstructionPolicy (
+ POA_CORBA::ConstructionPolicy * servant,
+ TAO_Operation_Details const * operation_details,
+ TAO::Argument * const args[])
+ : servant_ (servant)
+ , operation_details_ (operation_details)
+ , args_ (args)
+ {
+ }
+
+ virtual void execute (ACE_ENV_SINGLE_ARG_DECL)
+ {
+ TAO::SArg_Traits< CORBA::InterfaceDef>::in_arg_type arg_1 =
+ TAO::Portable_Server::get_in_arg< CORBA::InterfaceDef> (
+ this->operation_details_,
+ this->args_,
+ 1);
+
+ TAO::SArg_Traits< ::ACE_InputCDR::to_boolean>::in_arg_type arg_2 =
+ TAO::Portable_Server::get_in_arg< ::ACE_InputCDR::to_boolean> (
+ this->operation_details_,
+ this->args_,
+ 2);
+
+ this->servant_->make_domain_manager (
+ arg_1
+ , arg_2
+ ACE_ENV_ARG_PARAMETER);
+
+ }
+
+ private:
+ POA_CORBA::ConstructionPolicy * const servant_;
+ TAO_Operation_Details const * const operation_details_;
+ TAO::Argument * const * const args_;
+ };
+
+}
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_operation/operation_ss.cpp:192
+
+void POA_CORBA::ConstructionPolicy::make_domain_manager_skel (
+ TAO_ServerRequest & server_request,
+ void * TAO_INTERCEPTOR (servant_upcall),
+ void * servant
+ ACE_ENV_ARG_DECL
+ )
+{
+
+
+#if TAO_HAS_INTERCEPTORS == 1
+ static CORBA::TypeCode_ptr const * const exceptions = 0;
+ static CORBA::ULong const nexceptions = 0;
+#endif /* TAO_HAS_INTERCEPTORS */
+
+ TAO::SArg_Traits< void>::ret_val retval;
+ TAO::SArg_Traits< CORBA::InterfaceDef>::in_arg_val _tao_object_type;
+ TAO::SArg_Traits< ::ACE_InputCDR::to_boolean>::in_arg_val _tao_constr_policy;
+
+ TAO::Argument * const args[] =
+ {
+ &retval,
+ &_tao_object_type,
+ &_tao_constr_policy
+ };
+
+ static size_t const nargs = 3;
+
+ POA_CORBA::ConstructionPolicy * const impl =
+ static_cast<POA_CORBA::ConstructionPolicy *> (servant);
+
+ make_domain_manager_ConstructionPolicy command (
+ impl,
+ server_request.operation_details (),
+ args);
+
+ TAO::Upcall_Wrapper upcall_wrapper;
+ upcall_wrapper.upcall (server_request
+ , args
+ , nargs
+ , command
+#if TAO_HAS_INTERCEPTORS == 1
+ , servant_upcall
+ , exceptions
+ , nexceptions
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/interface_ss.cpp:169
+
+namespace POA_CORBA
+{
+
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/upcall_command_ss.cpp:127
+
+ class _is_a_ConstructionPolicy_Upcall_Command
+ : public TAO::Upcall_Command
+ {
+ public:
+ inline _is_a_ConstructionPolicy_Upcall_Command (
+ POA_CORBA::ConstructionPolicy * servant,
+ TAO_Operation_Details const * operation_details,
+ TAO::Argument * const args[])
+ : servant_ (servant)
+ , operation_details_ (operation_details)
+ , args_ (args)
+ {
+ }
+
+ virtual void execute (ACE_ENV_SINGLE_ARG_DECL)
+ {
+ TAO::SArg_Traits< ::ACE_InputCDR::to_boolean>::ret_arg_type retval =
+ TAO::Portable_Server::get_ret_arg< ::ACE_InputCDR::to_boolean> (
+ this->operation_details_,
+ this->args_);
+
+ TAO::SArg_Traits< CORBA::Char *>::in_arg_type arg_1 =
+ TAO::Portable_Server::get_in_arg< CORBA::Char *> (
+ this->operation_details_,
+ this->args_,
+ 1);
+
+
+ retval =
+ this->servant_-> _is_a (
+ arg_1
+ ACE_ENV_ARG_PARAMETER);
+
+ }
+
+ private:
+ POA_CORBA::ConstructionPolicy * const servant_;
+ TAO_Operation_Details const * const operation_details_;
+ TAO::Argument * const * const args_;
+ };
+
+}
+void POA_CORBA::ConstructionPolicy::_is_a_skel (
+ TAO_ServerRequest & server_request,
+ void * TAO_INTERCEPTOR (servant_upcall),
+ void * servant
+ ACE_ENV_ARG_DECL
+ )
+{
+
+
+#if TAO_HAS_INTERCEPTORS == 1
+ static CORBA::TypeCode_ptr const * const exceptions = 0;
+ static CORBA::ULong const nexceptions = 0;
+#endif /* TAO_HAS_INTERCEPTORS */
+
+ TAO::SArg_Traits< ::ACE_InputCDR::to_boolean>::ret_val retval;
+ TAO::SArg_Traits< CORBA::Char *>::in_arg_val _tao_repository_id;
+
+ TAO::Argument * const args[] =
+ {
+ &retval,
+ &_tao_repository_id
+ };
+
+ static size_t const nargs = 2;
+
+ POA_CORBA::ConstructionPolicy * const impl =
+ static_cast<POA_CORBA::ConstructionPolicy *> (servant);
+
+ _is_a_ConstructionPolicy_Upcall_Command command (
+ impl,
+ server_request.operation_details (),
+ args);
+
+ TAO::Upcall_Wrapper upcall_wrapper;
+ upcall_wrapper.upcall (server_request
+ , args
+ , nargs
+ , command
+#if TAO_HAS_INTERCEPTORS == 1
+ , servant_upcall
+ , exceptions
+ , nexceptions
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+}
+
+namespace POA_CORBA
+{
+
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/upcall_command_ss.cpp:127
+
+ class _non_existent_ConstructionPolicy_Upcall_Command
+ : public TAO::Upcall_Command
+ {
+ public:
+ inline _non_existent_ConstructionPolicy_Upcall_Command (
+ POA_CORBA::ConstructionPolicy * servant,
+ TAO_Operation_Details const * operation_details,
+ TAO::Argument * const args[])
+ : servant_ (servant)
+ , operation_details_ (operation_details)
+ , args_ (args)
+ {
+ }
+
+ virtual void execute (ACE_ENV_SINGLE_ARG_DECL)
+ {
+ TAO::SArg_Traits< ::ACE_InputCDR::to_boolean>::ret_arg_type retval =
+ TAO::Portable_Server::get_ret_arg< ::ACE_InputCDR::to_boolean> (
+ this->operation_details_,
+ this->args_);
+
+
+ retval =
+ this->servant_-> _non_existent (
+ ACE_ENV_SINGLE_ARG_PARAMETER);
+
+ }
+
+ private:
+ POA_CORBA::ConstructionPolicy * const servant_;
+ TAO_Operation_Details const * const operation_details_;
+ TAO::Argument * const * const args_;
+ };
+
+}
+void POA_CORBA::ConstructionPolicy::_non_existent_skel (
+ TAO_ServerRequest & server_request,
+ void * TAO_INTERCEPTOR (servant_upcall),
+ void * servant
+ ACE_ENV_ARG_DECL
+ )
+{
+
+
+#if TAO_HAS_INTERCEPTORS == 1
+ static CORBA::TypeCode_ptr const * const exceptions = 0;
+ static CORBA::ULong const nexceptions = 0;
+#endif /* TAO_HAS_INTERCEPTORS */
+
+ TAO::SArg_Traits< ::ACE_InputCDR::to_boolean>::ret_val retval;
+
+ TAO::Argument * const args[] =
+ {
+ &retval
+ };
+
+ static size_t const nargs = 1;
+
+ POA_CORBA::ConstructionPolicy * const impl =
+ static_cast<POA_CORBA::ConstructionPolicy *> (servant);
+
+ _non_existent_ConstructionPolicy_Upcall_Command command (
+ impl,
+ server_request.operation_details (),
+ args);
+
+ TAO::Upcall_Wrapper upcall_wrapper;
+ upcall_wrapper.upcall (server_request
+ , args
+ , nargs
+ , command
+#if TAO_HAS_INTERCEPTORS == 1
+ , servant_upcall
+ , exceptions
+ , nexceptions
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+}
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/interface_ss.cpp:393
+
+
+
+void POA_CORBA::ConstructionPolicy::_interface_skel (
+ TAO_ServerRequest & server_request,
+ void * /* servant_upcall */,
+ void * servant
+ ACE_ENV_ARG_DECL
+ )
+{
+ TAO_IFR_Client_Adapter *_tao_adapter =
+ ACE_Dynamic_Service<TAO_IFR_Client_Adapter>::instance (
+ TAO_ORB_Core::ifr_client_adapter_name ()
+ );
+
+ if (_tao_adapter == 0)
+ {
+ ACE_THROW (CORBA::INTF_REPOS (CORBA::OMGVMCID | 1,
+ CORBA::COMPLETED_NO));
+ }
+
+ POA_CORBA::ConstructionPolicy * const impl =
+ static_cast<POA_CORBA::ConstructionPolicy *> (servant);
+ CORBA::InterfaceDef_ptr _tao_retval =
+ impl->_get_interface (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ server_request.init_reply ();
+ TAO_OutputCDR &_tao_out = *server_request.outgoing ();
+
+ CORBA::Boolean const _tao_result =
+ _tao_adapter->interfacedef_cdr_insert (
+ _tao_out,
+ _tao_retval
+ );
+
+ _tao_adapter->dispose (_tao_retval);
+
+ if (_tao_result == 0)
+ {
+ ACE_THROW (CORBA::MARSHAL ());
+ }
+}
+
+namespace POA_CORBA
+{
+
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/upcall_command_ss.cpp:127
+
+ class _get_component_ConstructionPolicy_Upcall_Command
+ : public TAO::Upcall_Command
+ {
+ public:
+ inline _get_component_ConstructionPolicy_Upcall_Command (
+ POA_CORBA::ConstructionPolicy * servant,
+ TAO_Operation_Details const * operation_details,
+ TAO::Argument * const args[])
+ : servant_ (servant)
+ , operation_details_ (operation_details)
+ , args_ (args)
+ {
+ }
+
+ virtual void execute (ACE_ENV_SINGLE_ARG_DECL)
+ {
+ TAO::SArg_Traits< ::CORBA::Object>::ret_arg_type retval =
+ TAO::Portable_Server::get_ret_arg< ::CORBA::Object> (
+ this->operation_details_,
+ this->args_);
+
+
+ retval =
+ this->servant_-> _get_component (
+ ACE_ENV_SINGLE_ARG_PARAMETER);
+
+ }
+
+ private:
+ POA_CORBA::ConstructionPolicy * const servant_;
+ TAO_Operation_Details const * const operation_details_;
+ TAO::Argument * const * const args_;
+ };
+
+}
+void POA_CORBA::ConstructionPolicy::_component_skel (
+ TAO_ServerRequest & server_request,
+ void * TAO_INTERCEPTOR (servant_upcall),
+ void * servant
+ ACE_ENV_ARG_DECL
+ )
+{
+
+
+#if TAO_HAS_INTERCEPTORS == 1
+ static CORBA::TypeCode_ptr const * const exceptions = 0;
+ static CORBA::ULong const nexceptions = 0;
+#endif /* TAO_HAS_INTERCEPTORS */
+
+ TAO::SArg_Traits< ::CORBA::Object>::ret_val retval;
+
+ TAO::Argument * const args[] =
+ {
+ &retval
+ };
+
+ static size_t const nargs = 1;
+
+ POA_CORBA::ConstructionPolicy * const impl =
+ static_cast<POA_CORBA::ConstructionPolicy *> (servant);
+
+ _get_component_ConstructionPolicy_Upcall_Command command (
+ impl,
+ server_request.operation_details (),
+ args);
+
+ TAO::Upcall_Wrapper upcall_wrapper;
+ upcall_wrapper.upcall (server_request
+ , args
+ , nargs
+ , command
+#if TAO_HAS_INTERCEPTORS == 1
+ , servant_upcall
+ , exceptions
+ , nexceptions
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+}
+
+CORBA::Boolean POA_CORBA::ConstructionPolicy::_is_a (
+ const char* value
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return
+ (
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/Policy:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/ConstructionPolicy:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/Object:1.0"
+ )
+ );
+}
+
+const char* POA_CORBA::ConstructionPolicy::_interface_repository_id (void) const
+{
+ return "IDL:omg.org/CORBA/ConstructionPolicy:1.0";
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/interface_ss.cpp:940
+
+void POA_CORBA::ConstructionPolicy::_dispatch (
+ TAO_ServerRequest & req,
+ void * servant_upcall
+ ACE_ENV_ARG_DECL
+ )
+{
+ this->synchronous_upcall_dispatch (req,
+ servant_upcall,
+ this
+ ACE_ENV_ARG_PARAMETER);
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/interface_ss.cpp:891
+
+CORBA::ConstructionPolicy *
+POA_CORBA::ConstructionPolicy::_this (ACE_ENV_SINGLE_ARG_DECL)
+{
+ TAO_Stub *stub = this->_create_stub (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ TAO_Stub_Auto_Ptr safe_stub (stub);
+ CORBA::Object_ptr tmp = CORBA::Object::_nil ();
+
+ CORBA::Boolean _tao_opt_colloc =
+ stub->servant_orb_var ()->orb_core ()->optimize_collocation_objects ();
+
+ ACE_NEW_RETURN (
+ tmp,
+ CORBA::Object (stub, _tao_opt_colloc, this),
+ 0
+ );
+
+ CORBA::Object_var obj = tmp;
+ (void) safe_stub.release ();
+
+ typedef ::CORBA::ConstructionPolicy STUB_SCOPED_NAME;
+ return
+ TAO::Narrow_Utils<STUB_SCOPED_NAME>::unchecked_narrow (
+ obj.in (),
+ CORBA__TAO_ConstructionPolicy_Proxy_Broker_Factory_function_pointer
+ );
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* ifndef */
+
diff --git a/TAO/tao/Domain/DomainS.h b/TAO/tao/Domain/DomainS.h
new file mode 100644
index 00000000000..0983a05f4fd
--- /dev/null
+++ b/TAO/tao/Domain/DomainS.h
@@ -0,0 +1,504 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:391
+
+#ifndef _TAO_IDL_ORIG_DOMAINS_H_
+#define _TAO_IDL_ORIG_DOMAINS_H_
+
+#include /**/ "ace/pre.h"
+
+#include "tao/IFR_Client/IFR_ExtendedC.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/PolicyS.h"
+#include "tao/PortableServer/PortableServer.h"
+#include "tao/PortableServer/Servant_Base.h"
+#include "tao/Collocation_Proxy_Broker.h"
+#include "tao/DomainC.h"
+
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+#if defined (__BORLANDC__)
+#pragma option push -w-rvl -w-rch -w-ccc -w-inl
+#endif /* __BORLANDC__ */
+
+#include "tao/Domain/domain_export.h"
+
+#if defined (TAO_EXPORT_MACRO)
+#undef TAO_EXPORT_MACRO
+#endif
+#define TAO_EXPORT_MACRO TAO_Domain_Export
+
+// TAO_IDL - Generated from
+// be\be_visitor_module/module_sh.cpp:49
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace POA_CORBA
+{
+
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_sh.cpp:87
+
+ class DomainManager;
+ typedef DomainManager *DomainManager_ptr;
+
+ class _TAO_DomainManager_Direct_Proxy_Impl;
+ class _TAO_DomainManager_Strategized_Proxy_Broker;
+
+ class TAO_Domain_Export DomainManager
+ : public virtual PortableServer::ServantBase
+ {
+ protected:
+ DomainManager (void);
+
+ public:
+ // Useful for template programming.
+ typedef ::CORBA::DomainManager _stub_type;
+ typedef ::CORBA::DomainManager_ptr _stub_ptr_type;
+ typedef ::CORBA::DomainManager_var _stub_var_type;
+
+ DomainManager (const DomainManager& rhs);
+ virtual ~DomainManager (void);
+
+ virtual CORBA::Boolean _is_a (
+ const char* logical_type_id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static void _is_a_skel (
+ TAO_ServerRequest & req,
+ void * servant_upcall,
+ void * servant
+ ACE_ENV_ARG_DECL
+ );
+
+ static void _non_existent_skel (
+ TAO_ServerRequest & req,
+ void * servant_upcall,
+ void * servant
+ ACE_ENV_ARG_DECL
+ );
+
+ static void _interface_skel (
+ TAO_ServerRequest & req,
+ void * servant_upcall,
+ void * servant
+ ACE_ENV_ARG_DECL
+ );
+
+ static void _component_skel (
+ TAO_ServerRequest & req,
+ void * servant_upcall,
+ void * servant
+ ACE_ENV_ARG_DECL
+ );
+
+ virtual void _dispatch (
+ TAO_ServerRequest & req,
+ void * servant_upcall
+ ACE_ENV_ARG_DECL
+ );
+
+ ::CORBA::DomainManager *_this (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ );
+
+ virtual const char* _interface_repository_id (void) const;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_sh.cpp:45
+
+ virtual ::CORBA::Policy_ptr get_domain_policy (
+ ::CORBA::PolicyType policy_type
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ static void get_domain_policy_skel (
+ TAO_ServerRequest & server_request,
+ void * servant_upcall,
+ void * servant
+ ACE_ENV_ARG_DECL
+ );
+ };
+
+ ///////////////////////////////////////////////////////////////////////
+ // Strategized Proxy Broker Declaration
+ //
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/strategized_proxy_broker_sh.cpp:36
+
+ class TAO_Domain_Export _TAO_DomainManager_Strategized_Proxy_Broker
+ : public virtual TAO::Collocation_Proxy_Broker
+ {
+ public:
+ _TAO_DomainManager_Strategized_Proxy_Broker (void);
+
+ virtual ~_TAO_DomainManager_Strategized_Proxy_Broker (void);
+
+ TAO::Collocation_Strategy
+ get_strategy (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ void
+ dispatch (
+ CORBA::Object_ptr obj,
+ CORBA::Object_out forward_obj,
+ TAO::Argument ** args,
+ int num_args,
+ const char * op,
+ size_t op_len,
+ TAO::Collocation_Strategy strategy
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::Exception));
+
+ static _TAO_DomainManager_Strategized_Proxy_Broker *
+ the_TAO_DomainManager_Strategized_Proxy_Broker (void);
+ };
+
+ //
+ // End Strategized Proxy Broker Declaration
+ ///////////////////////////////////////////////////////////////////////
+
+
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/direct_proxy_impl_sh.cpp:31
+
+ ///////////////////////////////////////////////////////////////////////
+ // Direct Impl. Declaration
+ //
+
+ class TAO_Domain_Export _TAO_DomainManager_Direct_Proxy_Impl
+ {
+ public:
+ _TAO_DomainManager_Direct_Proxy_Impl (void);
+
+ virtual ~_TAO_DomainManager_Direct_Proxy_Impl (void) {}
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/proxy_impl_xh.cpp:24
+
+ static void
+ get_domain_policy (
+ TAO_Abstract_ServantBase *servant,
+ TAO::Argument ** args,
+ int num_args
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+ };
+
+ //
+ // Direct Proxy Impl. Declaration
+ ///////////////////////////////////////////////////////////////////////
+
+
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_sh.cpp:87
+
+ class ConstructionPolicy;
+ typedef ConstructionPolicy *ConstructionPolicy_ptr;
+
+ class _TAO_ConstructionPolicy_Direct_Proxy_Impl;
+ class _TAO_ConstructionPolicy_Strategized_Proxy_Broker;
+
+ class TAO_Domain_Export ConstructionPolicy
+ : public virtual POA_CORBA::Policy
+ {
+ protected:
+ ConstructionPolicy (void);
+
+ public:
+ // Useful for template programming.
+ typedef ::CORBA::ConstructionPolicy _stub_type;
+ typedef ::CORBA::ConstructionPolicy_ptr _stub_ptr_type;
+ typedef ::CORBA::ConstructionPolicy_var _stub_var_type;
+
+ ConstructionPolicy (const ConstructionPolicy& rhs);
+ virtual ~ConstructionPolicy (void);
+
+ virtual CORBA::Boolean _is_a (
+ const char* logical_type_id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static void _is_a_skel (
+ TAO_ServerRequest & req,
+ void * servant_upcall,
+ void * servant
+ ACE_ENV_ARG_DECL
+ );
+
+ static void _non_existent_skel (
+ TAO_ServerRequest & req,
+ void * servant_upcall,
+ void * servant
+ ACE_ENV_ARG_DECL
+ );
+
+ static void _interface_skel (
+ TAO_ServerRequest & req,
+ void * servant_upcall,
+ void * servant
+ ACE_ENV_ARG_DECL
+ );
+
+ static void _component_skel (
+ TAO_ServerRequest & req,
+ void * servant_upcall,
+ void * servant
+ ACE_ENV_ARG_DECL
+ );
+
+ virtual void _dispatch (
+ TAO_ServerRequest & req,
+ void * servant_upcall
+ ACE_ENV_ARG_DECL
+ );
+
+ ::CORBA::ConstructionPolicy *_this (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ );
+
+ virtual const char* _interface_repository_id (void) const;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_sh.cpp:45
+
+ virtual void make_domain_manager (
+ ::CORBA::InterfaceDef_ptr object_type,
+ ::CORBA::Boolean constr_policy
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ static void make_domain_manager_skel (
+ TAO_ServerRequest & server_request,
+ void * servant_upcall,
+ void * servant
+ ACE_ENV_ARG_DECL
+ );
+
+ static void
+ _get_policy_type_skel (
+ TAO_ServerRequest & server_request,
+ void * servant_upcall,
+ void * servant
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ // TAO_IDL - Generated from
+ // be\be_interface.cpp:1859
+
+ static void
+ copy_skel (
+ TAO_ServerRequest & server_request,
+ void * servant_upcall,
+ void * servant
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ // TAO_IDL - Generated from
+ // be\be_interface.cpp:1859
+
+ static void
+ destroy_skel (
+ TAO_ServerRequest & server_request,
+ void * servant_upcall,
+ void * servant
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+ };
+
+ ///////////////////////////////////////////////////////////////////////
+ // Strategized Proxy Broker Declaration
+ //
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/strategized_proxy_broker_sh.cpp:36
+
+ class TAO_Domain_Export _TAO_ConstructionPolicy_Strategized_Proxy_Broker
+ : public virtual TAO::Collocation_Proxy_Broker
+ {
+ public:
+ _TAO_ConstructionPolicy_Strategized_Proxy_Broker (void);
+
+ virtual ~_TAO_ConstructionPolicy_Strategized_Proxy_Broker (void);
+
+ TAO::Collocation_Strategy
+ get_strategy (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ void
+ dispatch (
+ CORBA::Object_ptr obj,
+ CORBA::Object_out forward_obj,
+ TAO::Argument ** args,
+ int num_args,
+ const char * op,
+ size_t op_len,
+ TAO::Collocation_Strategy strategy
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::Exception));
+
+ static _TAO_ConstructionPolicy_Strategized_Proxy_Broker *
+ the_TAO_ConstructionPolicy_Strategized_Proxy_Broker (void);
+ };
+
+ //
+ // End Strategized Proxy Broker Declaration
+ ///////////////////////////////////////////////////////////////////////
+
+
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/direct_proxy_impl_sh.cpp:31
+
+ ///////////////////////////////////////////////////////////////////////
+ // Direct Impl. Declaration
+ //
+
+ class TAO_Domain_Export _TAO_ConstructionPolicy_Direct_Proxy_Impl
+ : public virtual ::POA_CORBA::_TAO_Policy_Direct_Proxy_Impl
+ {
+ public:
+ _TAO_ConstructionPolicy_Direct_Proxy_Impl (void);
+
+ virtual ~_TAO_ConstructionPolicy_Direct_Proxy_Impl (void) {}
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/proxy_impl_xh.cpp:24
+
+ static void
+ make_domain_manager (
+ TAO_Abstract_ServantBase *servant,
+ TAO::Argument ** args,
+ int num_args
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));static void
+ _get_policy_type (
+ TAO_Abstract_ServantBase *servant,
+ TAO::Argument ** args,
+ int num_args
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ // TAO_IDL - Generated from
+ // be\be_interface.cpp:2050
+
+ static void
+ copy (
+ TAO_Abstract_ServantBase *servant,
+ TAO::Argument ** args,
+ int num_args
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ // TAO_IDL - Generated from
+ // be\be_interface.cpp:2050
+
+ static void
+ destroy (
+ TAO_Abstract_ServantBase *servant,
+ TAO::Argument ** args,
+ int num_args
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+ };
+
+ //
+ // Direct Proxy Impl. Declaration
+ ///////////////////////////////////////////////////////////////////////
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_module/module_sh.cpp:80
+
+} // module CORBA
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:995
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include "tao/Domain/DomainS_T.h"
+
+#if defined (__ACE_INLINE__)
+#include "tao/Domain/DomainS.inl"
+#endif /* defined INLINE */
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#if defined (__BORLANDC__)
+#pragma option pop
+#endif /* __BORLANDC__ */
+
+#include /**/ "ace/post.h"
+#endif /* ifndef */
+
diff --git a/TAO/tao/Domain/DomainS.inl b/TAO/tao/Domain/DomainS.inl
new file mode 100644
index 00000000000..5e1b77f1084
--- /dev/null
+++ b/TAO/tao/Domain/DomainS.inl
@@ -0,0 +1,158 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+void
+POA_CORBA::ConstructionPolicy::_get_policy_type_skel (
+ TAO_ServerRequest & server_request,
+ void * servant_upcall,
+ void * servant
+ ACE_ENV_ARG_DECL
+ )
+{
+ POA_CORBA::Policy * const impl = static_cast<POA_CORBA::ConstructionPolicy *> (servant);
+ POA_CORBA::Policy::_get_policy_type_skel (
+ server_request,
+ servant_upcall,
+ impl
+ ACE_ENV_ARG_PARAMETER
+ );
+}
+
+// TAO_IDL - Generated from
+// be\be_interface.cpp:1859
+
+ACE_INLINE
+void
+POA_CORBA::ConstructionPolicy::copy_skel (
+ TAO_ServerRequest & server_request,
+ void * servant_upcall,
+ void * servant
+ ACE_ENV_ARG_DECL
+ )
+{
+ POA_CORBA::Policy * const impl = static_cast<POA_CORBA::ConstructionPolicy *> (servant);
+ POA_CORBA::Policy::copy_skel (
+ server_request,
+ servant_upcall,
+ impl
+ ACE_ENV_ARG_PARAMETER
+ );
+}
+
+// TAO_IDL - Generated from
+// be\be_interface.cpp:1859
+
+ACE_INLINE
+void
+POA_CORBA::ConstructionPolicy::destroy_skel (
+ TAO_ServerRequest & server_request,
+ void * servant_upcall,
+ void * servant
+ ACE_ENV_ARG_DECL
+ )
+{
+ POA_CORBA::Policy * const impl = static_cast<POA_CORBA::ConstructionPolicy *> (servant);
+ POA_CORBA::Policy::destroy_skel (
+ server_request,
+ servant_upcall,
+ impl
+ ACE_ENV_ARG_PARAMETER
+ );
+}
+
+// TAO_IDL - Generated from
+// be\be_interface.cpp:1244
+
+ACE_INLINE void
+POA_CORBA::_TAO_ConstructionPolicy_Direct_Proxy_Impl::_get_policy_type (
+ TAO_Abstract_ServantBase *servant,
+ TAO::Argument ** args,
+ int num_args
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ POA_CORBA::_TAO_Policy_Direct_Proxy_Impl::_get_policy_type (
+ servant,
+ args,
+ num_args
+ ACE_ENV_ARG_PARAMETER
+ );
+}
+
+
+// TAO_IDL - Generated from
+// be\be_interface.cpp:1244
+
+ACE_INLINE void
+POA_CORBA::_TAO_ConstructionPolicy_Direct_Proxy_Impl::copy (
+ TAO_Abstract_ServantBase *servant,
+ TAO::Argument ** args,
+ int num_args
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ POA_CORBA::_TAO_Policy_Direct_Proxy_Impl::copy (
+ servant,
+ args,
+ num_args
+ ACE_ENV_ARG_PARAMETER
+ );
+}
+
+
+// TAO_IDL - Generated from
+// be\be_interface.cpp:1244
+
+ACE_INLINE void
+POA_CORBA::_TAO_ConstructionPolicy_Direct_Proxy_Impl::destroy (
+ TAO_Abstract_ServantBase *servant,
+ TAO::Argument ** args,
+ int num_args
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ POA_CORBA::_TAO_Policy_Direct_Proxy_Impl::destroy (
+ servant,
+ args,
+ num_args
+ ACE_ENV_ARG_PARAMETER
+ );
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Domain/DomainS_T.cpp b/TAO/tao/Domain/DomainS_T.cpp
new file mode 100644
index 00000000000..1cf3d0d6643
--- /dev/null
+++ b/TAO/tao/Domain/DomainS_T.cpp
@@ -0,0 +1,41 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:677
+
+#ifndef _TAO_IDL_ORIG_DOMAINS_T_CPP_
+#define _TAO_IDL_ORIG_DOMAINS_T_CPP_
+
+#include "tao/Domain/DomainS_T.h"
+
+#if !defined (__ACE_INLINE__)
+#include "tao/Domain/DomainS_T.inl"
+#endif /* !defined INLINE */
+
+
+#endif /* ifndef */
diff --git a/TAO/tao/Domain/DomainS_T.h b/TAO/tao/Domain/DomainS_T.h
new file mode 100644
index 00000000000..253698af938
--- /dev/null
+++ b/TAO/tao/Domain/DomainS_T.h
@@ -0,0 +1,226 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:536
+
+#ifndef _TAO_IDL_ORIG_DOMAINS_T_H_
+#define _TAO_IDL_ORIG_DOMAINS_T_H_
+
+#include /**/ "ace/pre.h"
+
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// TAO_IDL - Generated from
+// be\be_visitor_root/root_sth.cpp:116
+
+namespace POA_CORBA
+{
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/tie_sh.cpp:87
+
+ // TIE class: Refer to CORBA v2.2, Section 20.34.4
+ template <class T>
+ class DomainManager_tie : public DomainManager
+ {
+ public:
+ DomainManager_tie (T &t);
+ // the T& ctor
+ DomainManager_tie (T &t, PortableServer::POA_ptr poa);
+ // ctor taking a POA
+ DomainManager_tie (T *tp, CORBA::Boolean release = 1);
+ // ctor taking pointer and an ownership flag
+ DomainManager_tie (
+ T *tp,
+ PortableServer::POA_ptr poa,
+ CORBA::Boolean release = 1
+ );
+ // ctor with T*, ownership flag and a POA
+ ~DomainManager_tie (void);
+ // dtor
+
+ // TIE specific functions
+ T *_tied_object (void);
+ // return the underlying object
+ void _tied_object (T &obj);
+ // set the underlying object
+ void _tied_object (T *obj, CORBA::Boolean release = 1);
+ // set the underlying object and the ownership flag
+ CORBA::Boolean _is_owner (void);
+ // do we own it
+ void _is_owner (CORBA::Boolean b);
+ // set the ownership
+
+ // overridden ServantBase operations
+ PortableServer::POA_ptr _default_POA (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ );
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/tie_sh.cpp:60
+
+ ::CORBA::Policy_ptr get_domain_policy (
+ ::CORBA::PolicyType policy_type
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ private:
+ T *ptr_;
+ PortableServer::POA_var poa_;
+ CORBA::Boolean rel_;
+
+ // copy and assignment are not allowed
+ DomainManager_tie (const DomainManager_tie &);
+ void operator= (const DomainManager_tie &);
+ };
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/tie_sh.cpp:87
+
+ // TIE class: Refer to CORBA v2.2, Section 20.34.4
+ template <class T>
+ class ConstructionPolicy_tie : public ConstructionPolicy
+ {
+ public:
+ ConstructionPolicy_tie (T &t);
+ // the T& ctor
+ ConstructionPolicy_tie (T &t, PortableServer::POA_ptr poa);
+ // ctor taking a POA
+ ConstructionPolicy_tie (T *tp, CORBA::Boolean release = 1);
+ // ctor taking pointer and an ownership flag
+ ConstructionPolicy_tie (
+ T *tp,
+ PortableServer::POA_ptr poa,
+ CORBA::Boolean release = 1
+ );
+ // ctor with T*, ownership flag and a POA
+ ~ConstructionPolicy_tie (void);
+ // dtor
+
+ // TIE specific functions
+ T *_tied_object (void);
+ // return the underlying object
+ void _tied_object (T &obj);
+ // set the underlying object
+ void _tied_object (T *obj, CORBA::Boolean release = 1);
+ // set the underlying object and the ownership flag
+ CORBA::Boolean _is_owner (void);
+ // do we own it
+ void _is_owner (CORBA::Boolean b);
+ // set the ownership
+
+ // overridden ServantBase operations
+ PortableServer::POA_ptr _default_POA (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ );
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/tie_sh.cpp:60
+
+ CORBA::PolicyType policy_type (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/tie_sh.cpp:60
+
+ ::CORBA::Policy_ptr copy (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/tie_sh.cpp:60
+
+ void destroy (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/tie_sh.cpp:60
+
+ void make_domain_manager (
+ ::CORBA::InterfaceDef_ptr object_type,
+ ::CORBA::Boolean constr_policy
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ private:
+ T *ptr_;
+ PortableServer::POA_var poa_;
+ CORBA::Boolean rel_;
+
+ // copy and assignment are not allowed
+ ConstructionPolicy_tie (const ConstructionPolicy_tie &);
+ void operator= (const ConstructionPolicy_tie &);
+ };
+} // module CORBA
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:1096
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+#include "tao/Domain/DomainS_T.inl"
+#endif /* defined INLINE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+#include "tao/Domain/DomainS_T.cpp"
+#endif /* defined REQUIRED SOURCE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
+#pragma implementation ("DomainS_T.cpp")
+#endif /* defined REQUIRED PRAGMA */
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#include /**/ "ace/post.h"
+#endif /* ifndef */
+
diff --git a/TAO/tao/Domain/DomainS_T.inl b/TAO/tao/Domain/DomainS_T.inl
new file mode 100644
index 00000000000..2287aa6ba7e
--- /dev/null
+++ b/TAO/tao/Domain/DomainS_T.inl
@@ -0,0 +1,304 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/tie_si.cpp:96
+
+template <class T> ACE_INLINE
+POA_CORBA::DomainManager_tie<T>::DomainManager_tie (T &t)
+ : ptr_ (&t),
+ poa_ (PortableServer::POA::_nil ()),
+ rel_ (0)
+{}
+
+template <class T> ACE_INLINE
+POA_CORBA::DomainManager_tie<T>::DomainManager_tie (T &t, PortableServer::POA_ptr poa)
+ : ptr_ (&t),
+ poa_ (PortableServer::POA::_duplicate (poa)),
+ rel_ (0)
+{}
+
+template <class T> ACE_INLINE
+POA_CORBA::DomainManager_tie<T>::DomainManager_tie (T *tp, CORBA::Boolean release)
+ : ptr_ (tp),
+ poa_ (PortableServer::POA::_nil ()),
+ rel_ (release)
+{}
+
+template <class T> ACE_INLINE
+POA_CORBA::DomainManager_tie<T>::DomainManager_tie (T *tp, PortableServer::POA_ptr poa, CORBA::Boolean release)
+ : ptr_ (tp),
+ poa_ (PortableServer::POA::_duplicate (poa)),
+ rel_ (release)
+{}
+
+template <class T> ACE_INLINE
+POA_CORBA::DomainManager_tie<T>::~DomainManager_tie (void)
+{
+ if (this->rel_)
+ {
+ delete this->ptr_;
+ }
+}
+
+template <class T> ACE_INLINE T *
+POA_CORBA::DomainManager_tie<T>::_tied_object (void)
+{
+ return this->ptr_;
+}
+
+template <class T> ACE_INLINE void
+POA_CORBA::DomainManager_tie<T>::_tied_object (T &obj)
+{
+ if (this->rel_)
+ {
+ delete this->ptr_;
+ }
+
+ this->ptr_ = &obj;
+ this->rel_ = 0;
+}
+
+template <class T> ACE_INLINE void
+POA_CORBA::DomainManager_tie<T>::_tied_object (T *obj, CORBA::Boolean release)
+{
+ if (this->rel_)
+ {
+ delete this->ptr_;
+ }
+
+ this->ptr_ = obj;
+ this->rel_ = release;
+}
+
+template <class T> ACE_INLINE CORBA::Boolean
+POA_CORBA::DomainManager_tie<T>::_is_owner (void)
+{
+ return this->rel_;
+}
+
+template <class T> ACE_INLINE void
+POA_CORBA::DomainManager_tie<T>::_is_owner (CORBA::Boolean b)
+{
+ this->rel_ = b;
+}
+
+template <class T> ACE_INLINE PortableServer::POA_ptr
+POA_CORBA::DomainManager_tie<T>::_default_POA (ACE_ENV_SINGLE_ARG_DECL)
+{
+ if (!CORBA::is_nil (this->poa_.in ()))
+ {
+ return PortableServer::POA::_duplicate (this->poa_.in ());
+ }
+
+ return this->DomainManager::_default_POA (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_operation/tie_si.cpp:68
+
+template <class T> ACE_INLINE
+::CORBA::Policy_ptr POA_CORBA::DomainManager_tie<T>::get_domain_policy (
+ ::CORBA::PolicyType policy_type
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ return this->ptr_->get_domain_policy (
+ policy_type
+ ACE_ENV_ARG_PARAMETER
+ );
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/tie_si.cpp:96
+
+template <class T> ACE_INLINE
+POA_CORBA::ConstructionPolicy_tie<T>::ConstructionPolicy_tie (T &t)
+ : ptr_ (&t),
+ poa_ (PortableServer::POA::_nil ()),
+ rel_ (0)
+{}
+
+template <class T> ACE_INLINE
+POA_CORBA::ConstructionPolicy_tie<T>::ConstructionPolicy_tie (T &t, PortableServer::POA_ptr poa)
+ : ptr_ (&t),
+ poa_ (PortableServer::POA::_duplicate (poa)),
+ rel_ (0)
+{}
+
+template <class T> ACE_INLINE
+POA_CORBA::ConstructionPolicy_tie<T>::ConstructionPolicy_tie (T *tp, CORBA::Boolean release)
+ : ptr_ (tp),
+ poa_ (PortableServer::POA::_nil ()),
+ rel_ (release)
+{}
+
+template <class T> ACE_INLINE
+POA_CORBA::ConstructionPolicy_tie<T>::ConstructionPolicy_tie (T *tp, PortableServer::POA_ptr poa, CORBA::Boolean release)
+ : ptr_ (tp),
+ poa_ (PortableServer::POA::_duplicate (poa)),
+ rel_ (release)
+{}
+
+template <class T> ACE_INLINE
+POA_CORBA::ConstructionPolicy_tie<T>::~ConstructionPolicy_tie (void)
+{
+ if (this->rel_)
+ {
+ delete this->ptr_;
+ }
+}
+
+template <class T> ACE_INLINE T *
+POA_CORBA::ConstructionPolicy_tie<T>::_tied_object (void)
+{
+ return this->ptr_;
+}
+
+template <class T> ACE_INLINE void
+POA_CORBA::ConstructionPolicy_tie<T>::_tied_object (T &obj)
+{
+ if (this->rel_)
+ {
+ delete this->ptr_;
+ }
+
+ this->ptr_ = &obj;
+ this->rel_ = 0;
+}
+
+template <class T> ACE_INLINE void
+POA_CORBA::ConstructionPolicy_tie<T>::_tied_object (T *obj, CORBA::Boolean release)
+{
+ if (this->rel_)
+ {
+ delete this->ptr_;
+ }
+
+ this->ptr_ = obj;
+ this->rel_ = release;
+}
+
+template <class T> ACE_INLINE CORBA::Boolean
+POA_CORBA::ConstructionPolicy_tie<T>::_is_owner (void)
+{
+ return this->rel_;
+}
+
+template <class T> ACE_INLINE void
+POA_CORBA::ConstructionPolicy_tie<T>::_is_owner (CORBA::Boolean b)
+{
+ this->rel_ = b;
+}
+
+template <class T> ACE_INLINE PortableServer::POA_ptr
+POA_CORBA::ConstructionPolicy_tie<T>::_default_POA (ACE_ENV_SINGLE_ARG_DECL)
+{
+ if (!CORBA::is_nil (this->poa_.in ()))
+ {
+ return PortableServer::POA::_duplicate (this->poa_.in ());
+ }
+
+ return this->ConstructionPolicy::_default_POA (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_operation/tie_si.cpp:68
+
+template <class T> ACE_INLINE
+CORBA::PolicyType POA_CORBA::ConstructionPolicy_tie<T>::policy_type (
+ ACE_ENV_SINGLE_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ return this->ptr_->policy_type (
+ ACE_ENV_SINGLE_ARG_PARAMETER
+ );
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_operation/tie_si.cpp:68
+
+template <class T> ACE_INLINE
+::CORBA::Policy_ptr POA_CORBA::ConstructionPolicy_tie<T>::copy (
+ ACE_ENV_SINGLE_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ return this->ptr_->copy (
+ ACE_ENV_SINGLE_ARG_PARAMETER
+ );
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_operation/tie_si.cpp:68
+
+template <class T> ACE_INLINE
+void POA_CORBA::ConstructionPolicy_tie<T>::destroy (
+ ACE_ENV_SINGLE_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ this->ptr_->destroy (
+ ACE_ENV_SINGLE_ARG_PARAMETER
+ );
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_operation/tie_si.cpp:68
+
+template <class T> ACE_INLINE
+void POA_CORBA::ConstructionPolicy_tie<T>::make_domain_manager (
+ ::CORBA::InterfaceDef_ptr object_type,
+ ::CORBA::Boolean constr_policy
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ this->ptr_->make_domain_manager (
+ object_type,
+ constr_policy
+ ACE_ENV_ARG_PARAMETER
+ );
+}
+
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Domain/TAO_Domain.pc.in b/TAO/tao/Domain/TAO_Domain.pc.in
new file mode 100644
index 00000000000..70cac3c8549
--- /dev/null
+++ b/TAO/tao/Domain/TAO_Domain.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: TAO_Domain
+Description: TAO Domain Library
+Requires: TAO_PortableServer, TAO_IFR_Client, TAO_AnyTypeCode, TAO
+Version: @VERSION@
+Libs: -L${libdir} -lTAO_Domain
+Cflags: -I${includedir}
diff --git a/TAO/tao/Domain/TAO_Domain.rc b/TAO/tao/Domain/TAO_Domain.rc
new file mode 100644
index 00000000000..38d9e0edc5b
--- /dev/null
+++ b/TAO/tao/Domain/TAO_Domain.rc
@@ -0,0 +1,30 @@
+#include "..\Version.h"
+
+1 VERSIONINFO
+ FILEVERSION TAO_MAJOR_VERSION,TAO_MINOR_VERSION,TAO_BETA_VERSION,0
+ PRODUCTVERSION TAO_MAJOR_VERSION,TAO_MINOR_VERSION,TAO_BETA_VERSION,0
+ FILEFLAGSMASK 0x3fL
+ FILEFLAGS 0x0L
+ FILEOS 0x4L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904B0"
+ BEGIN
+ VALUE "FileDescription", "Domain\0"
+ VALUE "FileVersion", TAO_VERSION "\0"
+ VALUE "InternalName", "TAO_DomainDLL\0"
+ VALUE "LegalCopyright", "\0"
+ VALUE "LegalTrademarks", "\0"
+ VALUE "OriginalFilename", "TAO_Domain.DLL\0"
+ VALUE "ProductName", "TAO\0"
+ VALUE "ProductVersion", TAO_VERSION "\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
diff --git a/TAO/tao/Domain/diffs/Domain.diff b/TAO/tao/Domain/diffs/Domain.diff
new file mode 100644
index 00000000000..6ab958e7571
--- /dev/null
+++ b/TAO/tao/Domain/diffs/Domain.diff
@@ -0,0 +1,23 @@
+--- orig/DomainS.h 2005-02-22 13:41:14.148656000 +0100
++++ DomainS.h 2005-02-22 13:42:55.244024000 +0100
+@@ -33,17 +33,17 @@
+
+ #include /**/ "ace/pre.h"
+
+-#include "DomainC.h"
+-#include "tao/PolicyS.h"
+-#include "tao/InterfaceDefS.h"
++#include "tao/DomainC.h"
+
+ #if !defined (ACE_LACKS_PRAGMA_ONCE)
+ # pragma once
+ #endif /* ACE_LACKS_PRAGMA_ONCE */
+
++#include "tao/PortableServer/PolicyS.h"
+ #include "tao/Collocation_Proxy_Broker.h"
+ #include "tao/PortableServer/PortableServer.h"
+ #include "tao/PortableServer/Servant_Base.h"
++#include "tao/IFR_Client/IFR_ExtendedC.h"
+
+ #if defined(_MSC_VER)
+ #pragma warning(push)
diff --git a/TAO/tao/Domain/domain_export.h b/TAO/tao/Domain/domain_export.h
new file mode 100644
index 00000000000..5969e95bd37
--- /dev/null
+++ b/TAO/tao/Domain/domain_export.h
@@ -0,0 +1,39 @@
+// -*- C++ -*-
+// $Id$
+// Definition for Win32 Export directives.
+// This file is generated automatically by generate_export_file.pl
+// ------------------------------
+#ifndef TAO_DOMAIN_EXPORT_H
+#define TAO_DOMAIN_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if defined (TAO_AS_STATIC_LIBS)
+# if !defined (TAO_DOMAIN_HAS_DLL)
+# define TAO_DOMAIN_HAS_DLL 0
+# endif /* ! TAO_DOMAIN_HAS_DLL */
+#else
+# if !defined (TAO_DOMAIN_HAS_DLL)
+# define TAO_DOMAIN_HAS_DLL 1
+# endif /* ! TAO_DOMAIN_HAS_DLL */
+#endif
+
+#if defined (TAO_DOMAIN_HAS_DLL) && (TAO_DOMAIN_HAS_DLL == 1)
+# if defined (TAO_DOMAIN_BUILD_DLL)
+# define TAO_Domain_Export ACE_Proper_Export_Flag
+# define TAO_DOMAIN_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# define TAO_DOMAIN_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# else /* TAO_DOMAIN_BUILD_DLL */
+# define TAO_Domain_Export ACE_Proper_Import_Flag
+# define TAO_DOMAIN_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# define TAO_DOMAIN_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# endif /* TAO_DOMAIN_BUILD_DLL */
+#else /* TAO_DOMAIN_HAS_DLL == 1 */
+# define TAO_Domain_Export
+# define TAO_DOMAIN_SINGLETON_DECLARATION(T)
+# define TAO_DOMAIN_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+#endif /* TAO_DOMAIN_HAS_DLL == 1 */
+
+#endif /* TAO_DOMAIN_EXPORT_H */
+
+// End of auto generated file.
diff --git a/TAO/tao/DomainC.cpp b/TAO/tao/DomainC.cpp
new file mode 100644
index 00000000000..cd48cc1d9f4
--- /dev/null
+++ b/TAO/tao/DomainC.cpp
@@ -0,0 +1,687 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:291
+
+
+#include "tao/DomainC.h"
+#include "tao/CDR.h"
+#include "tao/Invocation_Adapter.h"
+#include "tao/Object_T.h"
+#include "tao/Basic_Arguments.h"
+#include "tao/Object_Argument_T.h"
+#include "tao/Special_Basic_Arguments.h"
+#include "ace/OS_NS_string.h"
+
+#include "tao/ORB_Core.h"
+#include "tao/IFR_Client_Adapter.h"
+#include "tao/Any_Insert_Policy_T.h"
+#include "ace/Dynamic_Service.h"
+
+#if defined (__BORLANDC__)
+#pragma option -w-rvl -w-rch -w-ccc -w-aus -w-sig
+#endif /* __BORLANDC__ */
+
+#if !defined (__ACE_INLINE__)
+#include "tao/DomainC.inl"
+#endif /* !defined INLINE */
+
+// TAO_IDL - Generated from
+// be\be_visitor_arg_traits.cpp:70
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// TAO specific stuff.
+namespace CORBA
+{
+ class InterfaceDef;
+ typedef InterfaceDef *InterfaceDef_ptr;
+ typedef TAO_Objref_Var_T<InterfaceDef> InterfaceDef_var;
+ typedef TAO_Objref_Out_T<InterfaceDef> InterfaceDef_out;
+}
+
+namespace TAO
+{
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+ template<>
+ CORBA::Boolean
+ In_Object_Argument_T<CORBA::InterfaceDef_ptr, TAO::Any_Insert_Policy_IFR_Client_Adapter <CORBA::InterfaceDef_ptr> >::marshal (TAO_OutputCDR &cdr)
+ {
+ TAO_IFR_Client_Adapter *adapter =
+ ACE_Dynamic_Service<TAO_IFR_Client_Adapter>::instance (
+ TAO_ORB_Core::ifr_client_adapter_name ()
+ );
+
+ return adapter->interfacedef_cdr_insert (cdr, this->x_);
+ }
+}
+
+// Arg traits specializations.
+namespace TAO
+{
+
+#if !defined (_CORBA_POLICY__ARG_TRAITS_CS_)
+#define _CORBA_POLICY__ARG_TRAITS_CS_
+
+ template<>
+ class Arg_Traits<CORBA::Policy>
+ : public
+ Object_Arg_Traits_T<
+ CORBA::Policy_ptr,
+ CORBA::Policy_var,
+ CORBA::Policy_out,
+ TAO::Objref_Traits<CORBA::Policy>,
+ TAO::Any_Insert_Policy_AnyTypeCode_Adapter <CORBA::Policy_ptr>
+ >
+ {
+ };
+
+#endif /* end #if !defined */
+
+#if !defined (_CORBA_INTERFACEDEF__ARG_TRAITS_CS_)
+#define _CORBA_INTERFACEDEF__ARG_TRAITS_CS_
+
+ template<>
+ class Arg_Traits<CORBA::InterfaceDef>
+ : public
+ Object_Arg_Traits_T<
+ CORBA::InterfaceDef_ptr,
+ CORBA::InterfaceDef_var,
+ CORBA::InterfaceDef_out,
+ TAO::Objref_Traits<CORBA::InterfaceDef>,
+ TAO::Any_Insert_Policy_IFR_Client_Adapter <CORBA::InterfaceDef_ptr>
+ >
+ {
+ };
+
+#endif /* end #if !defined */
+}
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/interface_cs.cpp:60
+
+// Traits specializations for CORBA::DomainManager.
+
+CORBA::DomainManager_ptr
+TAO::Objref_Traits<CORBA::DomainManager>::duplicate (
+ CORBA::DomainManager_ptr p
+ )
+{
+ return CORBA::DomainManager::_duplicate (p);
+}
+
+void
+TAO::Objref_Traits<CORBA::DomainManager>::release (
+ CORBA::DomainManager_ptr p
+ )
+{
+ ::CORBA::release (p);
+}
+
+CORBA::DomainManager_ptr
+TAO::Objref_Traits<CORBA::DomainManager>::nil (void)
+{
+ return CORBA::DomainManager::_nil ();
+}
+
+CORBA::Boolean
+TAO::Objref_Traits<CORBA::DomainManager>::marshal (
+ const CORBA::DomainManager_ptr p,
+ TAO_OutputCDR & cdr
+ )
+{
+ return CORBA::Object::marshal (p, cdr);
+}
+
+// Function pointer for collocation factory initialization.
+TAO::Collocation_Proxy_Broker *
+(*CORBA__TAO_DomainManager_Proxy_Broker_Factory_function_pointer) (
+ CORBA::Object_ptr obj
+ ) = 0;
+
+// TAO_IDL - Generated from
+// be\be_visitor_operation/operation_cs.cpp:78
+
+::CORBA::Policy_ptr CORBA::DomainManager::get_domain_policy (
+ ::CORBA::PolicyType policy_type
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ if (!this->is_evaluated ())
+ {
+ ::CORBA::Object::tao_object_initialize (this);
+ }
+
+ if (this->the_TAO_DomainManager_Proxy_Broker_ == 0)
+ {
+ CORBA_DomainManager_setup_collocation ();
+ }
+
+ TAO::Arg_Traits< ::CORBA::Policy>::ret_val _tao_retval;
+ TAO::Arg_Traits< ::CORBA::PolicyType>::in_arg_val _tao_policy_type (policy_type);
+
+ TAO::Argument *_the_tao_operation_signature [] =
+ {
+ &_tao_retval,
+ &_tao_policy_type
+ };
+
+ TAO::Invocation_Adapter _tao_call (
+ this,
+ _the_tao_operation_signature,
+ 2,
+ "get_domain_policy",
+ 17,
+ this->the_TAO_DomainManager_Proxy_Broker_
+ );
+
+ _tao_call.invoke (0, 0 ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (_tao_retval.excp ());
+
+ return _tao_retval.retn ();
+}
+
+CORBA::DomainManager::DomainManager (void)
+ : the_TAO_DomainManager_Proxy_Broker_ (0)
+{
+ this->CORBA_DomainManager_setup_collocation ();
+}
+
+void
+CORBA::DomainManager::CORBA_DomainManager_setup_collocation ()
+{
+ if (::CORBA__TAO_DomainManager_Proxy_Broker_Factory_function_pointer)
+ {
+ this->the_TAO_DomainManager_Proxy_Broker_ =
+ ::CORBA__TAO_DomainManager_Proxy_Broker_Factory_function_pointer (this);
+ }
+}
+
+CORBA::DomainManager::~DomainManager (void)
+{}
+
+void
+CORBA::DomainManager::_tao_any_destructor (void *_tao_void_pointer)
+{
+ DomainManager *_tao_tmp_pointer =
+ static_cast<DomainManager *> (_tao_void_pointer);
+ ::CORBA::release (_tao_tmp_pointer);
+}
+
+CORBA::DomainManager_ptr
+CORBA::DomainManager::_narrow (
+ CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL
+ )
+{
+ return
+ TAO::Narrow_Utils<DomainManager>::narrow (
+ _tao_objref,
+ "IDL:omg.org/CORBA/DomainManager:1.0",
+ CORBA__TAO_DomainManager_Proxy_Broker_Factory_function_pointer
+ ACE_ENV_ARG_PARAMETER
+ );
+}
+
+CORBA::DomainManager_ptr
+CORBA::DomainManager::_unchecked_narrow (
+ CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL
+ )
+{
+ return
+ TAO::Narrow_Utils<DomainManager>::unchecked_narrow (
+ _tao_objref,
+ "IDL:omg.org/CORBA/DomainManager:1.0",
+ CORBA__TAO_DomainManager_Proxy_Broker_Factory_function_pointer
+ ACE_ENV_ARG_PARAMETER
+ );
+}
+
+CORBA::DomainManager_ptr
+CORBA::DomainManager::_duplicate (DomainManager_ptr obj)
+{
+ if (! ::CORBA::is_nil (obj))
+ {
+ obj->_add_ref ();
+ }
+
+ return obj;
+}
+
+void
+CORBA::DomainManager::_tao_release (DomainManager_ptr obj)
+{
+ ::CORBA::release (obj);
+}
+
+CORBA::Boolean
+CORBA::DomainManager::_is_a (
+ const char *value
+ ACE_ENV_ARG_DECL
+ )
+{
+ if (
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/DomainManager:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/Object:1.0"
+ )
+ )
+ {
+ return true; // success using local knowledge
+ }
+ else
+ {
+ return this->::CORBA::Object::_is_a (
+ value
+ ACE_ENV_ARG_PARAMETER
+ );
+ }
+}
+
+const char* CORBA::DomainManager::_interface_repository_id (void) const
+{
+ return "IDL:omg.org/CORBA/DomainManager:1.0";
+}
+
+CORBA::Boolean
+CORBA::DomainManager::marshal (TAO_OutputCDR &cdr)
+{
+ return (cdr << this);
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/interface_cs.cpp:60
+
+// Traits specializations for CORBA::ConstructionPolicy.
+
+CORBA::ConstructionPolicy_ptr
+TAO::Objref_Traits<CORBA::ConstructionPolicy>::duplicate (
+ CORBA::ConstructionPolicy_ptr p
+ )
+{
+ return CORBA::ConstructionPolicy::_duplicate (p);
+}
+
+void
+TAO::Objref_Traits<CORBA::ConstructionPolicy>::release (
+ CORBA::ConstructionPolicy_ptr p
+ )
+{
+ ::CORBA::release (p);
+}
+
+CORBA::ConstructionPolicy_ptr
+TAO::Objref_Traits<CORBA::ConstructionPolicy>::nil (void)
+{
+ return CORBA::ConstructionPolicy::_nil ();
+}
+
+CORBA::Boolean
+TAO::Objref_Traits<CORBA::ConstructionPolicy>::marshal (
+ const CORBA::ConstructionPolicy_ptr p,
+ TAO_OutputCDR & cdr
+ )
+{
+ return CORBA::Object::marshal (p, cdr);
+}
+
+// Function pointer for collocation factory initialization.
+TAO::Collocation_Proxy_Broker *
+(*CORBA__TAO_ConstructionPolicy_Proxy_Broker_Factory_function_pointer) (
+ CORBA::Object_ptr obj
+ ) = 0;
+
+// TAO_IDL - Generated from
+// be\be_visitor_operation/operation_cs.cpp:78
+
+void CORBA::ConstructionPolicy::make_domain_manager (
+ ::CORBA::InterfaceDef_ptr object_type,
+ ::CORBA::Boolean constr_policy
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ if (!this->is_evaluated ())
+ {
+ ::CORBA::Object::tao_object_initialize (this);
+ }
+
+ if (this->the_TAO_ConstructionPolicy_Proxy_Broker_ == 0)
+ {
+ CORBA_ConstructionPolicy_setup_collocation ();
+ }
+
+ TAO::Arg_Traits< void>::ret_val _tao_retval;
+ TAO::Arg_Traits< ::CORBA::InterfaceDef>::in_arg_val _tao_object_type (object_type);
+ TAO::Arg_Traits< ::ACE_InputCDR::to_boolean>::in_arg_val _tao_constr_policy (constr_policy);
+
+ TAO::Argument *_the_tao_operation_signature [] =
+ {
+ &_tao_retval,
+ &_tao_object_type,
+ &_tao_constr_policy
+ };
+
+ TAO::Invocation_Adapter _tao_call (
+ this,
+ _the_tao_operation_signature,
+ 3,
+ "make_domain_manager",
+ 19,
+ this->the_TAO_ConstructionPolicy_Proxy_Broker_
+ );
+
+ _tao_call.invoke (0, 0 ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+CORBA::ConstructionPolicy::ConstructionPolicy (void)
+ : the_TAO_ConstructionPolicy_Proxy_Broker_ (0)
+{
+ this->CORBA_ConstructionPolicy_setup_collocation ();
+}
+
+void
+CORBA::ConstructionPolicy::CORBA_ConstructionPolicy_setup_collocation ()
+{
+ if (::CORBA__TAO_ConstructionPolicy_Proxy_Broker_Factory_function_pointer)
+ {
+ this->the_TAO_ConstructionPolicy_Proxy_Broker_ =
+ ::CORBA__TAO_ConstructionPolicy_Proxy_Broker_Factory_function_pointer (this);
+ }
+
+ this->CORBA_Policy_setup_collocation ();
+}
+
+CORBA::ConstructionPolicy::~ConstructionPolicy (void)
+{}
+
+void
+CORBA::ConstructionPolicy::_tao_any_destructor (void *_tao_void_pointer)
+{
+ ConstructionPolicy *_tao_tmp_pointer =
+ static_cast<ConstructionPolicy *> (_tao_void_pointer);
+ ::CORBA::release (_tao_tmp_pointer);
+}
+
+CORBA::ConstructionPolicy_ptr
+CORBA::ConstructionPolicy::_narrow (
+ CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL
+ )
+{
+ return
+ TAO::Narrow_Utils<ConstructionPolicy>::narrow (
+ _tao_objref,
+ "IDL:omg.org/CORBA/ConstructionPolicy:1.0",
+ CORBA__TAO_ConstructionPolicy_Proxy_Broker_Factory_function_pointer
+ ACE_ENV_ARG_PARAMETER
+ );
+}
+
+CORBA::ConstructionPolicy_ptr
+CORBA::ConstructionPolicy::_unchecked_narrow (
+ CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL
+ )
+{
+ return
+ TAO::Narrow_Utils<ConstructionPolicy>::unchecked_narrow (
+ _tao_objref,
+ "IDL:omg.org/CORBA/ConstructionPolicy:1.0",
+ CORBA__TAO_ConstructionPolicy_Proxy_Broker_Factory_function_pointer
+ ACE_ENV_ARG_PARAMETER
+ );
+}
+
+CORBA::ConstructionPolicy_ptr
+CORBA::ConstructionPolicy::_duplicate (ConstructionPolicy_ptr obj)
+{
+ if (! ::CORBA::is_nil (obj))
+ {
+ obj->_add_ref ();
+ }
+
+ return obj;
+}
+
+void
+CORBA::ConstructionPolicy::_tao_release (ConstructionPolicy_ptr obj)
+{
+ ::CORBA::release (obj);
+}
+
+CORBA::Boolean
+CORBA::ConstructionPolicy::_is_a (
+ const char *value
+ ACE_ENV_ARG_DECL
+ )
+{
+ if (
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/Policy:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/ConstructionPolicy:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/Object:1.0"
+ )
+ )
+ {
+ return true; // success using local knowledge
+ }
+ else
+ {
+ return this->::CORBA::Object::_is_a (
+ value
+ ACE_ENV_ARG_PARAMETER
+ );
+ }
+}
+
+const char* CORBA::ConstructionPolicy::_interface_repository_id (void) const
+{
+ return "IDL:omg.org/CORBA/ConstructionPolicy:1.0";
+}
+
+CORBA::Boolean
+CORBA::ConstructionPolicy::marshal (TAO_OutputCDR &cdr)
+{
+ return (cdr << this);
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_sequence/sequence_cs.cpp:65
+
+#if !defined (_CORBA_DOMAINMANAGERLIST_CS_)
+#define _CORBA_DOMAINMANAGERLIST_CS_
+
+CORBA::DomainManagerList::DomainManagerList (void)
+{}
+
+CORBA::DomainManagerList::DomainManagerList (
+ CORBA::ULong max
+ )
+ : TAO::unbounded_object_reference_sequence<
+ CORBA::DomainManager, CORBA::DomainManager_var
+ >
+ (max)
+{}
+
+CORBA::DomainManagerList::DomainManagerList (
+ CORBA::ULong max,
+ CORBA::ULong length,
+ CORBA::DomainManager_ptr * buffer,
+ CORBA::Boolean release
+ )
+ : TAO::unbounded_object_reference_sequence<
+ CORBA::DomainManager, CORBA::DomainManager_var
+ >
+ (max, length, buffer, release)
+{}
+
+CORBA::DomainManagerList::DomainManagerList (
+ const DomainManagerList &seq
+ )
+ : TAO::unbounded_object_reference_sequence<
+ CORBA::DomainManager, CORBA::DomainManager_var
+ >
+ (seq)
+{}
+
+CORBA::DomainManagerList::~DomainManagerList (void)
+{}
+
+void CORBA::DomainManagerList::_tao_any_destructor (
+ void * _tao_void_pointer
+ )
+{
+ DomainManagerList * _tao_tmp_pointer =
+ static_cast<DomainManagerList *> (_tao_void_pointer);
+ delete _tao_tmp_pointer;
+}
+
+#endif /* end #if !defined */
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/cdr_op_cs.cpp:63
+
+CORBA::Boolean operator<< (
+ TAO_OutputCDR &strm,
+ const CORBA::DomainManager_ptr _tao_objref
+ )
+{
+ CORBA::Object_ptr _tao_corba_obj = _tao_objref;
+ return (strm << _tao_corba_obj);
+}
+
+CORBA::Boolean operator>> (
+ TAO_InputCDR &strm,
+ CORBA::DomainManager_ptr &_tao_objref
+ )
+{
+ CORBA::Object_var obj;
+
+ if (!(strm >> obj.inout ()))
+ {
+ return false;
+ }
+
+ typedef ::CORBA::DomainManager RHS_SCOPED_NAME;
+
+ // Narrow to the right type.
+ _tao_objref =
+ TAO::Narrow_Utils<RHS_SCOPED_NAME>::unchecked_narrow (
+ obj.in (),
+ CORBA__TAO_DomainManager_Proxy_Broker_Factory_function_pointer
+ );
+
+ return 1;
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/cdr_op_cs.cpp:63
+
+CORBA::Boolean operator<< (
+ TAO_OutputCDR &strm,
+ const CORBA::ConstructionPolicy_ptr _tao_objref
+ )
+{
+ CORBA::Object_ptr _tao_corba_obj = _tao_objref;
+ return (strm << _tao_corba_obj);
+}
+
+CORBA::Boolean operator>> (
+ TAO_InputCDR &strm,
+ CORBA::ConstructionPolicy_ptr &_tao_objref
+ )
+{
+ CORBA::Object_var obj;
+
+ if (!(strm >> obj.inout ()))
+ {
+ return false;
+ }
+
+ typedef ::CORBA::ConstructionPolicy RHS_SCOPED_NAME;
+
+ // Narrow to the right type.
+ _tao_objref =
+ TAO::Narrow_Utils<RHS_SCOPED_NAME>::unchecked_narrow (
+ obj.in (),
+ CORBA__TAO_ConstructionPolicy_Proxy_Broker_Factory_function_pointer
+ );
+
+ return 1;
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_sequence/cdr_op_cs.cpp:96
+
+#if !defined _TAO_CDR_OP_CORBA_DomainManagerList_CPP_
+#define _TAO_CDR_OP_CORBA_DomainManagerList_CPP_
+
+CORBA::Boolean operator<< (
+ TAO_OutputCDR &strm,
+ const CORBA::DomainManagerList &_tao_sequence
+ )
+{
+ return TAO::marshal_sequence(strm, _tao_sequence);
+}
+
+CORBA::Boolean operator>> (
+ TAO_InputCDR &strm,
+ CORBA::DomainManagerList &_tao_sequence
+ )
+{
+ return TAO::demarshal_sequence(strm, _tao_sequence);
+}
+
+#endif /* _TAO_CDR_OP_CORBA_DomainManagerList_CPP_ */
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/DomainC.h b/TAO/tao/DomainC.h
new file mode 100644
index 00000000000..6abc992cfd7
--- /dev/null
+++ b/TAO/tao/DomainC.h
@@ -0,0 +1,491 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:153
+
+#ifndef _TAO_IDL_ORIG_DOMAINC_H_
+#define _TAO_IDL_ORIG_DOMAINC_H_
+
+#include /**/ "ace/pre.h"
+
+
+#include "ace/config-all.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/TAO_Export.h"
+#include "tao/ORB.h"
+#include "tao/SystemException.h"
+#include "tao/Environment.h"
+#include "tao/Object.h"
+#include "tao/Sequence_T.h"
+#include "tao/Objref_VarOut_T.h"
+#include "tao/Seq_Var_T.h"
+#include "tao/Seq_Out_T.h"
+
+#include "tao/PolicyC.h"
+
+#if defined (TAO_EXPORT_MACRO)
+#undef TAO_EXPORT_MACRO
+#endif
+#define TAO_EXPORT_MACRO TAO_Export
+
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+#if defined (__BORLANDC__)
+#pragma option push -w-rvl -w-rch -w-ccc -w-inl
+#endif /* __BORLANDC__ */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// TAO_IDL - Generated from
+// be\be_visitor_root/root_ch.cpp:62
+
+namespace TAO
+{
+ class Collocation_Proxy_Broker;
+ template<typename T> class Narrow_Utils;
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_module/module_ch.cpp:48
+
+namespace CORBA
+{
+
+ // TAO_IDL - Generated from
+ // be\be_interface.cpp:598
+
+#if !defined (_CORBA_DOMAINMANAGER__VAR_OUT_CH_)
+#define _CORBA_DOMAINMANAGER__VAR_OUT_CH_
+
+ class DomainManager;
+ typedef DomainManager *DomainManager_ptr;
+
+ typedef
+ TAO_Objref_Var_T<
+ DomainManager
+ >
+ DomainManager_var;
+
+ typedef
+ TAO_Objref_Out_T<
+ DomainManager
+ >
+ DomainManager_out;
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:54
+
+#if !defined (_CORBA_DOMAINMANAGER_CH_)
+#define _CORBA_DOMAINMANAGER_CH_
+
+ class TAO_Export DomainManager
+ : public virtual CORBA::Object
+ {
+ public:
+ friend class TAO::Narrow_Utils<DomainManager>;
+ typedef DomainManager_ptr _ptr_type;
+ typedef DomainManager_var _var_type;
+
+ // The static operations.
+ static DomainManager_ptr _duplicate (DomainManager_ptr obj);
+
+ static void _tao_release (DomainManager_ptr obj);
+
+ static DomainManager_ptr _narrow (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static DomainManager_ptr _unchecked_narrow (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static DomainManager_ptr _nil (void)
+ {
+ return static_cast<DomainManager_ptr> (0);
+ }
+
+ static void _tao_any_destructor (void *);
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual ::CORBA::Policy_ptr get_domain_policy (
+ ::CORBA::PolicyType policy_type
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:210
+
+ virtual CORBA::Boolean _is_a (
+ const char *type_id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ virtual const char* _interface_repository_id (void) const;
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+ private:
+ TAO::Collocation_Proxy_Broker *the_TAO_DomainManager_Proxy_Broker_;
+
+ protected:
+ // Concrete interface only.
+ DomainManager (void);
+
+ // These methods travese the inheritance tree and set the
+ // parents piece of the given class in the right mode.
+ virtual void CORBA_DomainManager_setup_collocation (void);
+
+ // Concrete non-local interface only.
+ DomainManager (
+ IOP::IOR *ior,
+ TAO_ORB_Core *orb_core = 0
+ );
+
+ // Non-local interface only.
+ DomainManager (
+ TAO_Stub *objref,
+ CORBA::Boolean _tao_collocated = 0,
+ TAO_Abstract_ServantBase *servant = 0,
+ TAO_ORB_Core *orb_core = 0
+ );
+
+ virtual ~DomainManager (void);
+
+ private:
+ // Private and unimplemented for concrete interfaces.
+ DomainManager (const DomainManager &);
+
+ void operator= (const DomainManager &);
+ };
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_constant/constant_ch.cpp:52
+
+ const CORBA::PolicyType SecConstruction = 11U;
+
+ // TAO_IDL - Generated from
+ // be\be_interface.cpp:598
+
+#if !defined (_CORBA_CONSTRUCTIONPOLICY__VAR_OUT_CH_)
+#define _CORBA_CONSTRUCTIONPOLICY__VAR_OUT_CH_
+
+ class ConstructionPolicy;
+ typedef ConstructionPolicy *ConstructionPolicy_ptr;
+
+ typedef
+ TAO_Objref_Var_T<
+ ConstructionPolicy
+ >
+ ConstructionPolicy_var;
+
+ typedef
+ TAO_Objref_Out_T<
+ ConstructionPolicy
+ >
+ ConstructionPolicy_out;
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:54
+
+#if !defined (_CORBA_CONSTRUCTIONPOLICY_CH_)
+#define _CORBA_CONSTRUCTIONPOLICY_CH_
+
+ class TAO_Export ConstructionPolicy
+ : public virtual ::CORBA::Policy
+ {
+ public:
+ friend class TAO::Narrow_Utils<ConstructionPolicy>;
+ typedef ConstructionPolicy_ptr _ptr_type;
+ typedef ConstructionPolicy_var _var_type;
+
+ // The static operations.
+ static ConstructionPolicy_ptr _duplicate (ConstructionPolicy_ptr obj);
+
+ static void _tao_release (ConstructionPolicy_ptr obj);
+
+ static ConstructionPolicy_ptr _narrow (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static ConstructionPolicy_ptr _unchecked_narrow (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static ConstructionPolicy_ptr _nil (void)
+ {
+ return static_cast<ConstructionPolicy_ptr> (0);
+ }
+
+ static void _tao_any_destructor (void *);
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void make_domain_manager (
+ ::CORBA::InterfaceDef_ptr object_type,
+ ::CORBA::Boolean constr_policy
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:210
+
+ virtual CORBA::Boolean _is_a (
+ const char *type_id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ virtual const char* _interface_repository_id (void) const;
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+ private:
+ TAO::Collocation_Proxy_Broker *the_TAO_ConstructionPolicy_Proxy_Broker_;
+
+ protected:
+ // Concrete interface only.
+ ConstructionPolicy (void);
+
+ // These methods travese the inheritance tree and set the
+ // parents piece of the given class in the right mode.
+ virtual void CORBA_ConstructionPolicy_setup_collocation (void);
+
+ // Concrete non-local interface only.
+ ConstructionPolicy (
+ IOP::IOR *ior,
+ TAO_ORB_Core *orb_core = 0
+ );
+
+ // Non-local interface only.
+ ConstructionPolicy (
+ TAO_Stub *objref,
+ CORBA::Boolean _tao_collocated = 0,
+ TAO_Abstract_ServantBase *servant = 0,
+ TAO_ORB_Core *orb_core = 0
+ );
+
+ virtual ~ConstructionPolicy (void);
+
+ private:
+ // Private and unimplemented for concrete interfaces.
+ ConstructionPolicy (const ConstructionPolicy &);
+
+ void operator= (const ConstructionPolicy &);
+ };
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_sequence/sequence_ch.cpp:101
+
+#if !defined (_CORBA_DOMAINMANAGERLIST_CH_)
+#define _CORBA_DOMAINMANAGERLIST_CH_
+
+ class DomainManagerList;
+
+ typedef
+ TAO_VarSeq_Var_T<
+ DomainManagerList
+ >
+ DomainManagerList_var;
+
+ typedef
+ TAO_Seq_Out_T<
+ DomainManagerList
+ >
+ DomainManagerList_out;
+
+ class TAO_Export DomainManagerList
+ : public
+ TAO::unbounded_object_reference_sequence<
+ DomainManager, DomainManager_var
+ >
+ {
+ public:
+ DomainManagerList (void);
+ DomainManagerList (CORBA::ULong max);
+ DomainManagerList (
+ CORBA::ULong max,
+ CORBA::ULong length,
+ DomainManager_ptr* buffer,
+ CORBA::Boolean release = false
+ );
+ DomainManagerList (const DomainManagerList &);
+ ~DomainManagerList (void);
+
+ static void _tao_any_destructor (void *);
+
+ typedef DomainManagerList_var _var_type;
+ };
+
+#endif /* end #if !defined */
+
+// TAO_IDL - Generated from
+// be\be_visitor_module/module_ch.cpp:66
+
+} // module CORBA
+
+// Proxy Broker Factory function pointer declarations.
+
+// TAO_IDL - Generated from
+// be\be_visitor_root/root.cpp:139
+
+extern TAO_Export
+TAO::Collocation_Proxy_Broker *
+(*CORBA__TAO_DomainManager_Proxy_Broker_Factory_function_pointer) (
+ CORBA::Object_ptr obj
+ );
+
+extern TAO_Export
+TAO::Collocation_Proxy_Broker *
+(*CORBA__TAO_ConstructionPolicy_Proxy_Broker_Factory_function_pointer) (
+ CORBA::Object_ptr obj
+ );
+
+// TAO_IDL - Generated from
+// be\be_visitor_traits.cpp:61
+
+// Traits specializations.
+namespace TAO
+{
+
+#if !defined (_CORBA_DOMAINMANAGER__TRAITS_CH_)
+#define _CORBA_DOMAINMANAGER__TRAITS_CH_
+
+ template<>
+ struct TAO_Export Objref_Traits< ::CORBA::DomainManager>
+ {
+ static ::CORBA::DomainManager_ptr duplicate (
+ ::CORBA::DomainManager_ptr
+ );
+ static void release (
+ ::CORBA::DomainManager_ptr
+ );
+ static ::CORBA::DomainManager_ptr nil (void);
+ static CORBA::Boolean marshal (
+ const ::CORBA::DomainManager_ptr p,
+ TAO_OutputCDR & cdr
+ );
+ };
+
+#endif /* end #if !defined */
+
+#if !defined (_CORBA_CONSTRUCTIONPOLICY__TRAITS_CH_)
+#define _CORBA_CONSTRUCTIONPOLICY__TRAITS_CH_
+
+ template<>
+ struct TAO_Export Objref_Traits< ::CORBA::ConstructionPolicy>
+ {
+ static ::CORBA::ConstructionPolicy_ptr duplicate (
+ ::CORBA::ConstructionPolicy_ptr
+ );
+ static void release (
+ ::CORBA::ConstructionPolicy_ptr
+ );
+ static ::CORBA::ConstructionPolicy_ptr nil (void);
+ static CORBA::Boolean marshal (
+ const ::CORBA::ConstructionPolicy_ptr p,
+ TAO_OutputCDR & cdr
+ );
+ };
+
+#endif /* end #if !defined */
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/cdr_op_ch.cpp:55
+
+TAO_Export CORBA::Boolean operator<< (TAO_OutputCDR &, const CORBA::DomainManager_ptr );
+TAO_Export CORBA::Boolean operator>> (TAO_InputCDR &, CORBA::DomainManager_ptr &);
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/cdr_op_ch.cpp:55
+
+TAO_Export CORBA::Boolean operator<< (TAO_OutputCDR &, const CORBA::ConstructionPolicy_ptr );
+TAO_Export CORBA::Boolean operator>> (TAO_InputCDR &, CORBA::ConstructionPolicy_ptr &);
+
+// TAO_IDL - Generated from
+// be\be_visitor_sequence/cdr_op_ch.cpp:71
+
+#if !defined _TAO_CDR_OP_CORBA_DomainManagerList_H_
+#define _TAO_CDR_OP_CORBA_DomainManagerList_H_
+
+TAO_Export CORBA::Boolean operator<< (
+ TAO_OutputCDR &,
+ const CORBA::DomainManagerList &
+ );
+TAO_Export CORBA::Boolean operator>> (
+ TAO_InputCDR &,
+ CORBA::DomainManagerList &
+ );
+
+#endif /* _TAO_CDR_OP_CORBA_DomainManagerList_H_ */
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:955
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+#include "tao/DomainC.inl"
+#endif /* defined INLINE */
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#if defined (__BORLANDC__)
+#pragma option pop
+#endif /* __BORLANDC__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* ifndef */
+
+
diff --git a/TAO/tao/DomainC.inl b/TAO/tao/DomainC.inl
new file mode 100644
index 00000000000..68d8edb83aa
--- /dev/null
+++ b/TAO/tao/DomainC.inl
@@ -0,0 +1,93 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/interface_ci.cpp:70
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+#if !defined (_CORBA_DOMAINMANAGER___CI_)
+#define _CORBA_DOMAINMANAGER___CI_
+
+ACE_INLINE
+CORBA::DomainManager::DomainManager (
+ TAO_Stub *objref,
+ CORBA::Boolean _tao_collocated,
+ TAO_Abstract_ServantBase *servant,
+ TAO_ORB_Core *oc
+ )
+ : ::CORBA::Object (objref, _tao_collocated, servant, oc),
+ the_TAO_DomainManager_Proxy_Broker_ (0)
+{
+ this->CORBA_DomainManager_setup_collocation ();
+}
+
+ACE_INLINE
+CORBA::DomainManager::DomainManager (
+ IOP::IOR *ior,
+ TAO_ORB_Core *oc
+ )
+ : ::CORBA::Object (ior, oc),
+ the_TAO_DomainManager_Proxy_Broker_ (0)
+{
+}
+
+#endif /* end #if !defined */
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/interface_ci.cpp:70
+
+#if !defined (_CORBA_CONSTRUCTIONPOLICY___CI_)
+#define _CORBA_CONSTRUCTIONPOLICY___CI_
+
+ACE_INLINE
+CORBA::ConstructionPolicy::ConstructionPolicy (
+ TAO_Stub *objref,
+ CORBA::Boolean _tao_collocated,
+ TAO_Abstract_ServantBase *servant,
+ TAO_ORB_Core *oc
+ )
+ : ::CORBA::Object (objref, _tao_collocated, servant, oc),
+ the_TAO_ConstructionPolicy_Proxy_Broker_ (0)
+{
+ this->CORBA_ConstructionPolicy_setup_collocation ();
+}
+
+ACE_INLINE
+CORBA::ConstructionPolicy::ConstructionPolicy (
+ IOP::IOR *ior,
+ TAO_ORB_Core *oc
+ )
+ : ::CORBA::Object (ior, oc),
+ the_TAO_ConstructionPolicy_Proxy_Broker_ (0)
+{
+}
+
+#endif /* end #if !defined */
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/DoubleSeq.pidl b/TAO/tao/DoubleSeq.pidl
new file mode 100644
index 00000000000..d9d603f0ca1
--- /dev/null
+++ b/TAO/tao/DoubleSeq.pidl
@@ -0,0 +1,33 @@
+// -*- IDL -*-
+//
+// $Id$
+
+/**
+ * This file was used to generate the code in DoubleSeqC.*
+ * The command used to generate code is:
+ *
+ * tao_idl
+ * -oA AnyTypeCode
+ * -Ge 1 -GA -SS -Sci
+ * -Wb,pre_include=ace/pre.h
+ * -Wb,post_include=ace/post.h
+ * -Wb,export_macro=TAO_Export
+ * -Wb,export_include=tao/TAO_Export.h
+ * -Wb,anyop_export_macro=TAO_AnyTypeCode_Export
+ * -Wb,anyop_export_include=tao/AnyTypeCode/TAO_AnyTypeCode_Export.h
+ * -Wb,versioning_begin=TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+ * -Wb,versioning_end=TAO_END_VERSIONED_NAMESPACE_DECL
+ * DoubleSeq.pidl
+ */
+
+#ifndef TAO_CORBA_DOUBLE_SEQ_IDL
+#define TAO_CORBA_DOUBLE_SEQ_IDL
+
+#pragma prefix "omg.org"
+
+module CORBA
+{
+ typedef sequence<double> DoubleSeq;
+};
+
+#endif /* TAO_CORBA_DOUBLE_SEQ_IDL */
diff --git a/TAO/tao/DynamicAny.mpc b/TAO/tao/DynamicAny.mpc
new file mode 100644
index 00000000000..c2d87143030
--- /dev/null
+++ b/TAO/tao/DynamicAny.mpc
@@ -0,0 +1,44 @@
+//$Id$
+
+project : taolib, core, core_anytypecode, tao_versioning_idl_defaults {
+ sharedname = TAO_DynamicAny
+ dynamicflags = TAO_DYNAMICANY_BUILD_DLL
+
+ Source_Files {
+ DynamicAny
+ }
+
+ Header_Files {
+ DynamicAny
+ }
+
+ Inline_Files {
+ DynamicAny
+ }
+
+ Template_Files {
+ DynamicAny
+ }
+
+ Resource_Files {
+ DynamicAny
+ }
+
+ PIDL_Files {
+ DynamicAny
+ }
+
+ IDL_Files {
+ idlflags += -Gp -Gd -Ge 1 -Sci -SS -Sorb \
+ -Wb,export_macro=TAO_DynamicAny_Export \
+ -Wb,export_include=tao/DynamicAny/dynamicany_export.h \
+ -Wb,include_guard=TAO_DYNAMICANY_SAFE_INCLUDE \
+ -Wb,safe_include=tao/DynamicAny/DynamicAny.h \
+ -o DynamicAny
+ DynamicAny/DynamicAny.pidl
+ }
+
+ Pkgconfig_Files {
+ DynamicAny/TAO_DynamicAny.pc.in
+ }
+}
diff --git a/TAO/tao/DynamicAny/DynAnyFactory.cpp b/TAO/tao/DynamicAny/DynAnyFactory.cpp
new file mode 100644
index 00000000000..cdc92ac4c3c
--- /dev/null
+++ b/TAO/tao/DynamicAny/DynAnyFactory.cpp
@@ -0,0 +1,383 @@
+//=============================================================================
+/**
+ * @file DynAnyFactory.cpp
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan <coryan@uci.edu>
+ */
+//=============================================================================
+
+
+#include "tao/AnyTypeCode/AnyTypeCode_methods.h"
+
+#include "tao/DynamicAny/DynAnyFactory.h"
+
+#include "tao/DynamicAny/DynAny_i.h"
+#include "tao/DynamicAny/DynStruct_i.h"
+#include "tao/DynamicAny/DynSequence_i.h"
+#include "tao/DynamicAny/DynEnum_i.h"
+#include "tao/DynamicAny/DynArray_i.h"
+#include "tao/DynamicAny/DynUnion_i.h"
+
+#include "ace/Auto_Ptr.h"
+
+ACE_RCSID (DynamicAny,
+ DynAnyFactory,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Constructor from typecode
+TAO_DynAnyFactory::TAO_DynAnyFactory (void)
+{
+}
+
+// Utility function called by all the DynAny classes
+// to extract the TCKind of possibly aliased types.
+CORBA::TCKind
+TAO_DynAnyFactory::unalias (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL)
+{
+ CORBA::TCKind tck = tc->kind (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::tk_null);
+
+ while (tck == CORBA::tk_alias)
+ {
+ CORBA::TypeCode_var temp =
+ tc->content_type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::tk_null);
+
+ tck = TAO_DynAnyFactory::unalias (temp.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::tk_null);
+ }
+
+ return tck;
+}
+
+// Same as above, but returns the type code.
+CORBA::TypeCode_ptr
+TAO_DynAnyFactory::strip_alias (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL)
+{
+ CORBA::TypeCode_var retval = CORBA::TypeCode::_duplicate (tc);
+ CORBA::TCKind tck = retval->kind (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::TypeCode::_nil ());
+
+ while (tck == CORBA::tk_alias)
+ {
+ retval = retval->content_type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::TypeCode::_nil ());
+
+ tck = retval->kind (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::TypeCode::_nil ());
+ }
+
+ return retval._retn ();
+}
+
+DynamicAny::DynAny_ptr
+TAO_DynAnyFactory::create_dyn_any (
+ const CORBA::Any & value
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAnyFactory::InconsistentTypeCode
+ ))
+{
+ return TAO_DynAnyFactory::make_dyn_any (value ACE_ENV_ARG_PARAMETER);
+}
+
+DynamicAny::DynAny_ptr
+TAO_DynAnyFactory::create_dyn_any_from_type_code (
+ CORBA::TypeCode_ptr type
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAnyFactory::InconsistentTypeCode
+ ))
+{
+ return TAO_DynAnyFactory::make_dyn_any (type ACE_ENV_ARG_PARAMETER);
+}
+
+DynamicAny::DynAny_ptr
+TAO_DynAnyFactory::make_dyn_any (const CORBA::Any &any
+ ACE_ENV_ARG_DECL)
+{
+ CORBA::TypeCode_var tc = any.type ();
+ CORBA::TCKind kind = TAO_DynAnyFactory::unalias (tc.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (DynamicAny::DynAny::_nil ());
+
+ switch (kind)
+ {
+ case CORBA::tk_null:
+ case CORBA::tk_void:
+ case CORBA::tk_short:
+ case CORBA::tk_long:
+ case CORBA::tk_ushort:
+ case CORBA::tk_ulong:
+ case CORBA::tk_float:
+ case CORBA::tk_double:
+ case CORBA::tk_longlong:
+ case CORBA::tk_ulonglong:
+ case CORBA::tk_boolean:
+ case CORBA::tk_char:
+ case CORBA::tk_wchar:
+ case CORBA::tk_octet:
+ case CORBA::tk_any:
+ case CORBA::tk_TypeCode:
+ case CORBA::tk_objref:
+ case CORBA::tk_string:
+ case CORBA::tk_wstring:
+ {
+ TAO_DynAny_i *p = 0;
+
+ ACE_NEW_THROW_EX (p,
+ TAO_DynAny_i,
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (0);
+
+ ACE_Auto_Basic_Ptr<TAO_DynAny_i> dp (p);
+ p->init (any ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ return dp.release ();
+ }
+ case CORBA::tk_struct:
+ case CORBA::tk_except:
+ {
+ TAO_DynStruct_i *p = 0;
+
+ ACE_NEW_THROW_EX (p,
+ TAO_DynStruct_i,
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (0);
+
+ ACE_Auto_Basic_Ptr<TAO_DynStruct_i> dp (p);
+ p->init (any ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ return dp.release ();
+ }
+ case CORBA::tk_sequence:
+ {
+ TAO_DynSequence_i *p = 0;
+
+ ACE_NEW_THROW_EX (p,
+ TAO_DynSequence_i,
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (0);
+
+ ACE_Auto_Basic_Ptr<TAO_DynSequence_i> dp (p);
+ p->init (any ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ return dp.release ();
+ }
+ case CORBA::tk_union:
+ {
+ TAO_DynUnion_i *p = 0;
+
+ ACE_NEW_THROW_EX (p,
+ TAO_DynUnion_i,
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (0);
+
+ ACE_Auto_Basic_Ptr<TAO_DynUnion_i> dp (p);
+ p->init (any ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ return dp.release ();
+ }
+ case CORBA::tk_enum:
+ {
+ TAO_DynEnum_i *p = 0;
+
+ ACE_NEW_THROW_EX (p,
+ TAO_DynEnum_i,
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (0);
+
+ ACE_Auto_Basic_Ptr<TAO_DynEnum_i> dp (p);
+ p->init (any ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ return dp.release ();
+ }
+ case CORBA::tk_array:
+ {
+ TAO_DynArray_i *p = 0;
+
+ ACE_NEW_THROW_EX (p,
+ TAO_DynArray_i,
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (0);
+
+ ACE_Auto_Basic_Ptr<TAO_DynArray_i> dp (p);
+ p->init (any ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ return dp.release ();
+ }
+
+ case CORBA::tk_fixed:
+ case CORBA::tk_value:
+ case CORBA::tk_value_box:
+ case CORBA::tk_abstract_interface:
+ case CORBA::tk_component:
+ case CORBA::tk_home:
+ ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (),
+ DynamicAny::DynAny::_nil ());
+ case CORBA::tk_native:
+ ACE_THROW_RETURN (DynamicAny::DynAnyFactory::InconsistentTypeCode (),
+ DynamicAny::DynAny::_nil ());
+ default:
+ break;
+ }
+
+ return DynamicAny::DynAny::_nil ();
+}
+
+DynamicAny::DynAny_ptr
+TAO_DynAnyFactory::make_dyn_any (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL)
+{
+ CORBA::TCKind kind =
+ TAO_DynAnyFactory::unalias (tc ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (DynamicAny::DynAny::_nil ());
+
+ switch (kind)
+ {
+ case CORBA::tk_null:
+ case CORBA::tk_void:
+ case CORBA::tk_short:
+ case CORBA::tk_long:
+ case CORBA::tk_ushort:
+ case CORBA::tk_ulong:
+ case CORBA::tk_float:
+ case CORBA::tk_double:
+ case CORBA::tk_longlong:
+ case CORBA::tk_ulonglong:
+ case CORBA::tk_boolean:
+ case CORBA::tk_char:
+ case CORBA::tk_wchar:
+ case CORBA::tk_octet:
+ case CORBA::tk_any:
+ case CORBA::tk_TypeCode:
+ case CORBA::tk_objref:
+ case CORBA::tk_string:
+ case CORBA::tk_wstring:
+ {
+ TAO_DynAny_i *p = 0;
+
+ ACE_NEW_THROW_EX (p,
+ TAO_DynAny_i,
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (0);
+
+ ACE_Auto_Basic_Ptr<TAO_DynAny_i> dp (p);
+ p->init (tc ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ return dp.release ();
+ }
+ case CORBA::tk_struct:
+ case CORBA::tk_except:
+ {
+ TAO_DynStruct_i *p = 0;
+
+ ACE_NEW_THROW_EX (p,
+ TAO_DynStruct_i,
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (0);
+
+ ACE_Auto_Basic_Ptr<TAO_DynStruct_i> dp (p);
+ p->init (tc ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ return dp.release ();
+ }
+ case CORBA::tk_sequence:
+ {
+ TAO_DynSequence_i *p = 0;
+
+ ACE_NEW_THROW_EX (p,
+ TAO_DynSequence_i,
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (0);
+
+ ACE_Auto_Basic_Ptr<TAO_DynSequence_i> dp (p);
+ p->init (tc ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ return dp.release ();
+ }
+ case CORBA::tk_union:
+ {
+ TAO_DynUnion_i *p = 0;
+
+ ACE_NEW_THROW_EX (p,
+ TAO_DynUnion_i,
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (0);
+
+ ACE_Auto_Basic_Ptr<TAO_DynUnion_i> dp (p);
+ p->init (tc ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ return dp.release ();
+ }
+ case CORBA::tk_enum:
+ {
+ TAO_DynEnum_i *p = 0;
+
+ ACE_NEW_THROW_EX (p,
+ TAO_DynEnum_i,
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (0);
+
+ ACE_Auto_Basic_Ptr<TAO_DynEnum_i> dp (p);
+ p->init (tc ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ return dp.release ();
+ }
+ case CORBA::tk_array:
+ {
+ TAO_DynArray_i *p = 0;
+
+ ACE_NEW_THROW_EX (p,
+ TAO_DynArray_i,
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (0);
+
+ ACE_Auto_Basic_Ptr<TAO_DynArray_i> dp (p);
+ p->init (tc ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ return dp.release ();
+ }
+
+ case CORBA::tk_fixed:
+ case CORBA::tk_value:
+ case CORBA::tk_value_box:
+ case CORBA::tk_abstract_interface:
+ case CORBA::tk_component:
+ case CORBA::tk_home:
+ ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (),
+ DynamicAny::DynAny::_nil ());
+ case CORBA::tk_native:
+ ACE_THROW_RETURN (DynamicAny::DynAnyFactory::InconsistentTypeCode (),
+ DynamicAny::DynAny::_nil ());
+ default:
+ break;
+ }
+
+ return DynamicAny::DynAny::_nil ();
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/DynamicAny/DynAnyFactory.h b/TAO/tao/DynamicAny/DynAnyFactory.h
new file mode 100644
index 00000000000..f37cda716b8
--- /dev/null
+++ b/TAO/tao/DynamicAny/DynAnyFactory.h
@@ -0,0 +1,100 @@
+// -*- C++ -*-
+//
+// $Id$
+
+//=============================================================================
+/**
+ * @file DynAnyFactory.h
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan <coryan@uci.edu>
+ */
+//=============================================================================
+
+
+#ifndef TAO_DYNANYFACTORY_H
+#define TAO_DYNANYFACTORY_H
+#include /**/ "ace/pre.h"
+
+#include "tao/DynamicAny/DynamicAny.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/LocalObject.h"
+
+#if defined (_MSC_VER)
+# pragma warning(push)
+# pragma warning (disable:4250)
+#endif /* _MSC_VER */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_DynAnyFactory
+ *
+ * Implements the DynamicAnyFactory interface and provides several
+ * utility functions shared by all the Dynamic Any components.
+ */
+class TAO_DynamicAny_Export TAO_DynAnyFactory
+ : public virtual DynamicAny::DynAnyFactory,
+ public virtual TAO_Local_RefCounted_Object
+{
+public:
+ /// Constructor.
+ TAO_DynAnyFactory (void);
+
+ /// Obtain the kind of object, after all aliasing has been removed.
+ static CORBA::TCKind unalias (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL);
+
+ /// Same as above, but returns type code instead of TCKind. Caller
+ /// must release the return value.
+ static CORBA::TypeCode_ptr strip_alias (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL);
+
+ /// Create the correct type of DynAny object for <any>.
+ static DynamicAny::DynAny_ptr
+ make_dyn_any (const CORBA::Any &any
+ ACE_ENV_ARG_DECL);
+
+ /// Create the correct type of DynAny object for <tc>
+ static DynamicAny::DynAny_ptr
+ make_dyn_any (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL);
+
+ // = The DynamicAnyFactory methods.
+ virtual DynamicAny::DynAny_ptr create_dyn_any (
+ const CORBA::Any & value
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAnyFactory::InconsistentTypeCode
+ ));
+
+ virtual DynamicAny::DynAny_ptr create_dyn_any_from_type_code (
+ CORBA::TypeCode_ptr type
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAnyFactory::InconsistentTypeCode
+ ));
+
+private:
+ // Not allowed.
+ TAO_DynAnyFactory (const TAO_DynAnyFactory &src);
+ TAO_DynAnyFactory &operator= (const TAO_DynAnyFactory &src);
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined(_MSC_VER)
+# pragma warning(pop)
+#endif /* _MSC_VER */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_DYNANYFACTORY_H */
diff --git a/TAO/tao/DynamicAny/DynAny_i.cpp b/TAO/tao/DynamicAny/DynAny_i.cpp
new file mode 100644
index 00000000000..5bbdac5e629
--- /dev/null
+++ b/TAO/tao/DynamicAny/DynAny_i.cpp
@@ -0,0 +1,561 @@
+// $Id$
+
+#include "tao/AnyTypeCode/Any_Unknown_IDL_Type.h"
+#include "tao/AnyTypeCode/AnyTypeCode_methods.h"
+#include "tao/DynamicAny/DynAny_i.h"
+#include "tao/DynamicAny/DynAnyFactory.h"
+#include "tao/CDR.h"
+#include "ace/OS_NS_wchar.h"
+#include "ace/OS_NS_string.h"
+
+
+ACE_RCSID (DynamicAny,
+ DynAny_i,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_DynAny_i::TAO_DynAny_i (void)
+{
+}
+
+TAO_DynAny_i::~TAO_DynAny_i (void)
+{
+}
+
+void
+TAO_DynAny_i::check_typecode (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL)
+{
+ // Check to see if it's a simple type.
+ CORBA::TCKind tk = TAO_DynAnyFactory::unalias (tc ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ switch (tk)
+ {
+ case CORBA::tk_null:
+ case CORBA::tk_void:
+ case CORBA::tk_short:
+ case CORBA::tk_long:
+ case CORBA::tk_ushort:
+ case CORBA::tk_ulong:
+ case CORBA::tk_float:
+ case CORBA::tk_double:
+ case CORBA::tk_longlong:
+ case CORBA::tk_ulonglong:
+ case CORBA::tk_boolean:
+ case CORBA::tk_char:
+ case CORBA::tk_wchar:
+ case CORBA::tk_octet:
+ case CORBA::tk_any:
+ case CORBA::tk_TypeCode:
+ case CORBA::tk_objref:
+ case CORBA::tk_string:
+ case CORBA::tk_wstring:
+ break;
+ default:
+ ACE_THROW (DynamicAny::DynAnyFactory::InconsistentTypeCode ());
+ }
+}
+
+void
+TAO_DynAny_i::set_to_default_value (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL)
+{
+ CORBA::TCKind tk = TAO_DynAnyFactory::unalias (tc ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ switch (tk)
+ {
+ case CORBA::tk_null:
+ break;
+ case CORBA::tk_void:
+ this->any_._tao_set_typecode (CORBA::_tc_void);
+ break;
+ case CORBA::tk_short:
+ this->any_ <<= static_cast<CORBA::Short> (0);
+ break;
+ case CORBA::tk_long:
+ this->any_ <<= static_cast<CORBA::Long> (0);
+ break;
+ case CORBA::tk_ushort:
+ this->any_ <<= static_cast<CORBA::UShort> (0);
+ break;
+ case CORBA::tk_ulong:
+ this->any_ <<= static_cast<CORBA::ULong> (0);
+ break;
+#if !defined (ACE_LACKS_LONGLONG_T)
+ case CORBA::tk_longlong:
+ this->any_ <<= static_cast<CORBA::LongLong> (0);
+ break;
+ case CORBA::tk_ulonglong:
+ this->any_ <<= static_cast<CORBA::ULongLong> (0);
+ break;
+#endif /* ACE_LACKS_LONGLONG_T */
+ case CORBA::tk_boolean:
+ this->any_ <<= CORBA::Any::from_boolean (0);
+ break;
+ case CORBA::tk_octet:
+ this->any_ <<= CORBA::Any::from_octet (0);
+ break;
+ case CORBA::tk_char:
+ this->any_ <<= CORBA::Any::from_char (0);
+ break;
+ case CORBA::tk_wchar:
+ this->any_ <<= CORBA::Any::from_wchar (0);
+ break;
+ case CORBA::tk_float:
+ this->any_ <<= static_cast<CORBA::Float> (0);
+ break;
+ case CORBA::tk_double:
+ this->any_ <<= static_cast<CORBA::Double> (0);
+ break;
+ case CORBA::tk_any:
+ this->any_._tao_set_typecode (CORBA::_tc_null);
+ break;
+ case CORBA::tk_TypeCode:
+ this->any_ <<= CORBA::_tc_null;
+ break;
+ case CORBA::tk_objref:
+ {
+ TAO_OutputCDR stream;
+ stream << CORBA::Object::_nil ();
+ TAO_InputCDR in (stream);
+ TAO::Unknown_IDL_Type *unk = 0;
+ ACE_NEW (unk,
+ TAO::Unknown_IDL_Type (tc, in));
+ this->any_.replace (unk);
+ break;
+ }
+ case CORBA::tk_string:
+ this->any_ <<= "";
+ break;
+ case CORBA::tk_wstring:
+ {
+ CORBA::WChar wstr[1];
+ wstr[0] = 0;
+ this->any_ <<= wstr;
+ break;
+ }
+ default:
+ // Should never get here - check_typecode() has already been called.
+ break;
+ }
+}
+
+void
+TAO_DynAny_i::init_common (void)
+{
+ this->ref_to_component_ = 0;
+ this->container_is_destroying_ = 0;
+ this->has_components_ = 0;
+ this->destroyed_ = 0;
+ this->current_position_ = -1;
+ this->component_count_ = 0;
+}
+
+void
+TAO_DynAny_i::init (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL)
+{
+ this->check_typecode (tc
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->set_to_default_value (tc
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->init_common ();
+
+ this->type_ = CORBA::TypeCode::_duplicate (tc);
+}
+
+void
+TAO_DynAny_i::init (const CORBA::Any& any
+ ACE_ENV_ARG_DECL)
+{
+ this->type_ = any.type ();
+ this->check_typecode (this->type_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->init_common ();
+
+ this->any_ = any;
+}
+
+// ****************************************************************
+
+TAO_DynAny_i *
+TAO_DynAny_i::_narrow (CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED)
+{
+ if (CORBA::is_nil (_tao_objref))
+ {
+ return 0;
+ }
+
+ return dynamic_cast<TAO_DynAny_i *> (_tao_objref);
+}
+
+// ****************************************************************
+
+void
+TAO_DynAny_i::from_any (const CORBA::Any &any
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW (CORBA::OBJECT_NOT_EXIST ());
+ }
+
+ CORBA::TypeCode_var any_tc = any.type ();
+
+ CORBA::Boolean equiv =
+ this->type_->equivalent (any_tc.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (!equiv)
+ {
+ ACE_THROW (DynamicAny::DynAny::TypeMismatch ());
+ }
+
+// @@@ (JP) Spec also says we should check for illegal Any
+// value here, and throw InvalidValue if we find one.
+// Something like a null string will be caught in the constructor.
+
+ this->any_ = any;
+}
+
+CORBA::Any_ptr
+TAO_DynAny_i::to_any (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (),
+ 0);
+ }
+
+ CORBA::Any_ptr retval;
+
+ ACE_NEW_THROW_EX (retval,
+ CORBA::Any (this->any_),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (0);
+
+ return retval;
+}
+
+CORBA::Boolean
+TAO_DynAny_i::equal (DynamicAny::DynAny_ptr rhs
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (),
+ 0);
+ }
+
+ TAO_DynAny_i *rhs_n = TAO_DynAny_i::_narrow (rhs
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ if (rhs_n == 0)
+ {
+ return 0;
+ }
+
+ CORBA::Boolean equiv = this->type_->equivalent (rhs_n->type_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ if (!equiv)
+ {
+ return 0;
+ }
+
+ CORBA::TCKind tk = TAO_DynAnyFactory::unalias (this->type_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ switch (tk)
+ {
+ case CORBA::tk_null:
+ case CORBA::tk_void:
+ return 1;
+ case CORBA::tk_short:
+ {
+ CORBA::Short rhs_v;
+ rhs_n->any_ >>= rhs_v;
+ CORBA::Short lhs_v;
+ this->any_ >>= lhs_v;
+ return (lhs_v == rhs_v);
+ }
+ case CORBA::tk_long:
+ {
+ CORBA::Long rhs_v;
+ rhs_n->any_ >>= rhs_v;
+ CORBA::Long lhs_v;
+ this->any_ >>= lhs_v;
+ return (lhs_v == rhs_v);
+ }
+ case CORBA::tk_ushort:
+ {
+ CORBA::UShort rhs_v;
+ rhs_n->any_ >>= rhs_v;
+ CORBA::UShort lhs_v;
+ this->any_ >>= lhs_v;
+ return (lhs_v == rhs_v);
+ }
+ case CORBA::tk_ulong:
+ {
+ CORBA::ULong rhs_v;
+ rhs_n->any_ >>= rhs_v;
+ CORBA::ULong lhs_v;
+ this->any_ >>= lhs_v;
+ return (lhs_v == rhs_v);
+ }
+ case CORBA::tk_float:
+ {
+ CORBA::Float rhs_v;
+ rhs_n->any_ >>= rhs_v;
+ CORBA::Float lhs_v;
+ this->any_ >>= lhs_v;
+ return (lhs_v == rhs_v);
+ }
+ case CORBA::tk_double:
+ {
+ CORBA::Double rhs_v;
+ rhs_n->any_ >>= rhs_v;
+ CORBA::Double lhs_v;
+ this->any_ >>= lhs_v;
+ return (lhs_v == rhs_v);
+ }
+ case CORBA::tk_longlong:
+ {
+ CORBA::LongLong rhs_v;
+ rhs_n->any_ >>= rhs_v;
+ CORBA::LongLong lhs_v;
+ this->any_ >>= lhs_v;
+ return (lhs_v == rhs_v);
+ }
+ case CORBA::tk_ulonglong:
+ {
+ CORBA::ULongLong rhs_v;
+ rhs_n->any_ >>= rhs_v;
+ CORBA::ULongLong lhs_v;
+ this->any_ >>= lhs_v;
+ return (lhs_v == rhs_v);
+ }
+ case CORBA::tk_boolean:
+ {
+ CORBA::Boolean rhs_v;
+ rhs_n->any_ >>= CORBA::Any::to_boolean (rhs_v);
+ CORBA::Boolean lhs_v;
+ this->any_ >>= CORBA::Any::to_boolean (lhs_v);
+ return (lhs_v == rhs_v);
+ }
+ case CORBA::tk_char:
+ {
+ CORBA::Char rhs_v;
+ rhs_n->any_ >>= CORBA::Any::to_char (rhs_v);
+ CORBA::Char lhs_v;
+ this->any_ >>= CORBA::Any::to_char (lhs_v);
+ return (lhs_v == rhs_v);
+ }
+ case CORBA::tk_wchar:
+ {
+ CORBA::WChar rhs_v;
+ rhs_n->any_ >>= CORBA::Any::to_wchar (rhs_v);
+ CORBA::WChar lhs_v;
+ this->any_ >>= CORBA::Any::to_wchar (lhs_v);
+ return (lhs_v == rhs_v);
+ }
+ case CORBA::tk_octet:
+ {
+ CORBA::Octet rhs_v;
+ rhs_n->any_ >>= CORBA::Any::to_octet (rhs_v);
+ CORBA::Octet lhs_v;
+ this->any_ >>= CORBA::Any::to_octet (lhs_v);
+ return (lhs_v == rhs_v);
+ }
+ case CORBA::tk_any:
+ {
+ const CORBA::Any *rhs_v;
+ rhs_n->any_ >>= rhs_v;
+ const CORBA::Any *lhs_v;
+ this->any_ >>= lhs_v;
+
+ DynamicAny::DynAny_var rhs_dyn =
+ TAO_DynAnyFactory::make_dyn_any (*rhs_v
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ DynamicAny::DynAny_var lhs_dyn =
+ TAO_DynAnyFactory::make_dyn_any (*lhs_v
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ CORBA::Boolean b = rhs_dyn->equal (lhs_dyn.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ rhs_dyn->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ lhs_dyn->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ return b;
+ }
+ case CORBA::tk_TypeCode:
+ {
+ CORBA::TypeCode_ptr rhs_v;
+ rhs_n->any_ >>= rhs_v;
+ CORBA::TypeCode_ptr lhs_v;
+ this->any_ >>= lhs_v;
+ // See CORBA 2.4.2 - must use equal() here.
+ return lhs_v->equal (lhs_v
+ ACE_ENV_ARG_PARAMETER);
+ }
+ case CORBA::tk_objref:
+ {
+ CORBA::Object_ptr rhs_v;
+ rhs_n->any_ >>= CORBA::Any::to_object (rhs_v);
+ CORBA::Object_ptr lhs_v;
+ this->any_ >>= CORBA::Any::to_object (lhs_v);
+ return lhs_v->_is_equivalent (lhs_v
+ ACE_ENV_ARG_PARAMETER);
+ }
+ case CORBA::tk_string:
+ {
+ CORBA::TypeCode_var unaliased_tc =
+ TAO_DynAnyFactory::strip_alias (this->type_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ CORBA::ULong bound =
+ unaliased_tc->length (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ const char *rhs_v, *lhs_v;
+ CORBA::Boolean rstatus, lstatus;
+
+ if (bound == 0)
+ {
+ rstatus = rhs_n->any_ >>= rhs_v;
+ lstatus = this->any_ >>= lhs_v;
+
+ if ((rstatus && lstatus) == 0)
+ {
+ return 0;
+ }
+ }
+ else
+ {
+ rstatus = rhs_n->any_ >>= CORBA::Any::to_string (rhs_v,
+ bound);
+ lstatus = this->any_ >>= CORBA::Any::to_string (lhs_v,
+ bound);
+
+ if ((rstatus && lstatus) == 0)
+ {
+ return 0;
+ }
+ }
+
+ return ACE_OS::strcmp (rhs_v, lhs_v) == 0;
+ }
+ case CORBA::tk_wstring:
+ {
+ CORBA::TypeCode_var unaliased_tc =
+ TAO_DynAnyFactory::strip_alias (this->type_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ CORBA::ULong bound =
+ unaliased_tc->length (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ const CORBA::WChar *rhs_v, *lhs_v;
+ CORBA::Boolean rstatus, lstatus;
+
+ if (bound == 0)
+ {
+ rstatus = rhs_n->any_ >>= rhs_v;
+ lstatus = this->any_ >>= lhs_v;
+
+ if ((rstatus && lstatus) == 0)
+ {
+ return 0;
+ }
+ }
+ else
+ {
+ rstatus = rhs_n->any_ >>= CORBA::Any::to_wstring (rhs_v,
+ bound);
+ lstatus = this->any_ >>= CORBA::Any::to_wstring (lhs_v,
+ bound);
+
+ if ((rstatus && lstatus) == 0)
+ {
+ return 0;
+ }
+ }
+
+ return ACE_OS::wscmp (rhs_v, lhs_v) == 0;
+ }
+ default:
+ break; // Cannot happen...
+ }
+
+ return 0;
+}
+
+void
+TAO_DynAny_i::destroy (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW (CORBA::OBJECT_NOT_EXIST ());
+ }
+
+ if (!this->ref_to_component_ || this->container_is_destroying_)
+ {
+ this->destroyed_ = 1;
+ }
+}
+
+
+DynamicAny::DynAny_ptr
+TAO_DynAny_i::current_component (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (),
+ DynamicAny::DynAny::_nil ());
+ }
+
+ ACE_THROW_RETURN (DynamicAny::DynAny::TypeMismatch (),
+ DynamicAny::DynAny::_nil ());
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/DynamicAny/DynAny_i.h b/TAO/tao/DynamicAny/DynAny_i.h
new file mode 100644
index 00000000000..89c96f90350
--- /dev/null
+++ b/TAO/tao/DynamicAny/DynAny_i.h
@@ -0,0 +1,132 @@
+// -*- C++ -*-
+//
+// $Id$
+
+//=============================================================================
+/**
+ * @file DynAny_i.h
+ *
+ * $Id$
+ *
+ * @author Jeff Parsons <parsons@cs.wustl.edu>
+ */
+//=============================================================================
+
+
+#ifndef TAO_DYNANY_I_H
+#define TAO_DYNANY_I_H
+#include /**/ "ace/pre.h"
+
+#include "tao/DynamicAny/DynamicAny.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/DynamicAny/DynCommon.h"
+#include "tao/LocalObject.h"
+
+#if defined (_MSC_VER)
+# pragma warning(push)
+# pragma warning (disable:4250)
+#endif /* _MSC_VER */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_DynAny_i
+ *
+ * @brief Implementation of the basic Dynamic Any datatype.
+ */
+class TAO_DynamicAny_Export TAO_DynAny_i
+ : public virtual DynamicAny::DynAny,
+ public virtual TAO_DynCommon,
+ public virtual TAO_Local_RefCounted_Object
+{
+public:
+ /// Constructor.
+ TAO_DynAny_i (void);
+
+ /// Destructor.
+ ~TAO_DynAny_i (void);
+
+ /// Initialize using just a TypeCode
+ void init (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL);
+
+ /// Initialize using an Any.
+ void init (const CORBA::Any& any
+ ACE_ENV_ARG_DECL);
+
+ // = LocalObject methods.
+ static TAO_DynAny_i *_narrow (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ // = DynAny common functions not implemented in class TAO_DynCommon.
+
+ virtual void from_any (
+ const CORBA::Any & value
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ));
+
+ virtual CORBA::Any * to_any (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ virtual CORBA::Boolean equal (
+ DynamicAny::DynAny_ptr dyn_any
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ virtual void destroy (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ virtual DynamicAny::DynAny_ptr current_component (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch
+ ));
+
+private:
+ /// Check if the typecode is acceptable.
+ void check_typecode (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL);
+
+ /// Used when we are created from a typecode.
+ void set_to_default_value (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL);
+
+ /// Called by both versions of init().
+ void init_common (void);
+
+ // Use copy() or assign() instead of these.
+ TAO_DynAny_i (const TAO_DynAny_i &src);
+ TAO_DynAny_i &operator= (const TAO_DynAny_i &src);
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined(_MSC_VER)
+# pragma warning(pop)
+#endif /* _MSC_VER */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_DYNANY_I_H */
diff --git a/TAO/tao/DynamicAny/DynArray_i.cpp b/TAO/tao/DynamicAny/DynArray_i.cpp
new file mode 100644
index 00000000000..11a03a7677d
--- /dev/null
+++ b/TAO/tao/DynamicAny/DynArray_i.cpp
@@ -0,0 +1,664 @@
+// $Id$
+
+#include "tao/AnyTypeCode/Marshal.h"
+#include "tao/AnyTypeCode/Any_Unknown_IDL_Type.h"
+#include "tao/AnyTypeCode/AnyTypeCode_methods.h"
+#include "tao/DynamicAny/DynArray_i.h"
+#include "tao/DynamicAny/DynAnyFactory.h"
+#include "tao/CDR.h"
+
+ACE_RCSID (DynamicAny,
+ DynArray_i,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_DynArray_i::TAO_DynArray_i (void)
+{
+}
+
+TAO_DynArray_i::~TAO_DynArray_i (void)
+{
+}
+
+void
+TAO_DynArray_i::init_common (void)
+{
+ this->ref_to_component_ = 0;
+ this->container_is_destroying_ = 0;
+ this->has_components_ = 1;
+ this->destroyed_ = 0;
+ this->current_position_ = 0;
+ this->component_count_ = static_cast<CORBA::ULong> (this->da_members_.size ());
+}
+
+void
+TAO_DynArray_i::init (const CORBA::Any & any
+ ACE_ENV_ARG_DECL)
+{
+ CORBA::TypeCode_var tc = any.type ();
+
+ CORBA::TCKind kind = TAO_DynAnyFactory::unalias (tc.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (kind != CORBA::tk_array)
+ {
+ ACE_THROW (DynamicAny::DynAnyFactory::InconsistentTypeCode ());
+ }
+
+ this->type_ = tc;
+
+ CORBA::ULong numfields = this->get_tc_length (tc.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ // Resize the array.
+ this->da_members_.size (numfields);
+
+ this->init_common ();
+
+ // Get the CDR stream of the Any, if there isn't one, make one.
+ TAO::Any_Impl *impl = any.impl ();
+ TAO_OutputCDR out;
+ TAO_InputCDR cdr (static_cast<ACE_Message_Block *> (0));
+
+ if (impl->encoded ())
+ {
+ TAO::Unknown_IDL_Type *unk =
+ dynamic_cast<TAO::Unknown_IDL_Type *> (impl);
+
+ cdr = unk->_tao_get_cdr ();
+ }
+ else
+ {
+ impl->marshal_value (out);
+ TAO_InputCDR tmp_in (out);
+ cdr = tmp_in;
+ }
+
+ CORBA::TypeCode_var field_tc =
+ this->get_element_type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ for (CORBA::ULong i = 0; i < numfields; ++i)
+ {
+ CORBA::Any field_any;
+ TAO::Unknown_IDL_Type *field_unk = 0;
+ TAO_InputCDR unk_in (cdr);
+ ACE_NEW (field_unk,
+ TAO::Unknown_IDL_Type (field_tc.in (),
+ unk_in));
+ field_any.replace (field_unk);
+
+ // This recursive step will call the correct constructor
+ // based on the type of field_any.
+ this->da_members_[i] =
+ TAO_DynAnyFactory::make_dyn_any (field_any
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Move to the next field in the CDR stream.
+ (void) TAO_Marshal_Object::perform_skip (field_tc.in (),
+ &cdr
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+}
+
+void
+TAO_DynArray_i::init (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL)
+{
+ CORBA::TCKind kind = TAO_DynAnyFactory::unalias (tc
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (kind != CORBA::tk_array)
+ {
+ ACE_THROW (DynamicAny::DynAnyFactory::InconsistentTypeCode ());
+ }
+
+ this->type_ = CORBA::TypeCode::_duplicate (tc);
+
+ CORBA::ULong numfields = this->get_tc_length (tc
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Resize the array.
+ this->da_members_.size (numfields);
+
+ this->init_common ();
+
+ CORBA::TypeCode_var elemtype =
+ this->get_element_type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ for (CORBA::ULong i = 0; i < numfields; ++i)
+ {
+ // Recursively initialize each element.
+ this->da_members_[i] =
+ TAO_DynAnyFactory::make_dyn_any (elemtype.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+}
+
+CORBA::TypeCode_ptr
+TAO_DynArray_i::get_element_type (ACE_ENV_SINGLE_ARG_DECL)
+{
+ CORBA::TypeCode_var element_type =
+ CORBA::TypeCode::_duplicate (this->type_.in ());
+
+ // Strip away aliases (if any) on top of the outer type
+ CORBA::TCKind kind = element_type->kind (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::TypeCode::_nil ());
+
+ while (kind != CORBA::tk_array)
+ {
+ element_type =
+ element_type->content_type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::TypeCode::_nil ());
+
+ kind = element_type->kind (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::TypeCode::_nil ());
+ }
+
+ // Return the content type.
+ CORBA::TypeCode_ptr retval =
+ element_type->content_type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::TypeCode::_nil ());
+
+ return retval;
+}
+
+// Get the length from the (possibly aliased) typecode.
+CORBA::ULong
+TAO_DynArray_i::get_tc_length (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL)
+{
+ CORBA::TypeCode_var tctmp = CORBA::TypeCode::_duplicate (tc);
+ CORBA::TCKind kind = tctmp->kind (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ while (kind == CORBA::tk_alias)
+ {
+ tctmp = tctmp->content_type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+ kind = tctmp->kind (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+ }
+
+ CORBA::ULong retval = tctmp->length (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ return retval;
+}
+
+// ****************************************************************
+
+TAO_DynArray_i *
+TAO_DynArray_i::_narrow (CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED)
+{
+ if (CORBA::is_nil (_tao_objref))
+ {
+ return 0;
+ }
+
+ return dynamic_cast<TAO_DynArray_i *> (_tao_objref);
+}
+
+// ****************************************************************
+
+DynamicAny::AnySeq *
+TAO_DynArray_i::get_elements (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (),
+ 0);
+ }
+
+ CORBA::ULong length = static_cast<CORBA::ULong> (this->da_members_.size ());
+
+ DynamicAny::AnySeq *elements = 0;
+ ACE_NEW_THROW_EX (elements,
+ DynamicAny::AnySeq (length),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (0);
+
+ elements->length (length);
+ DynamicAny::AnySeq_var safe_retval (elements);
+
+ CORBA::Any_var tmp;
+
+ // Initialize each Any.
+ for (CORBA::ULong i = 0; i < length; i++)
+ {
+ tmp = this->da_members_[i]->to_any (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ safe_retval[i] = tmp.in ();
+ }
+
+ return safe_retval._retn ();
+}
+
+void
+TAO_DynArray_i::set_elements (const DynamicAny::AnySeq & value
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW (CORBA::OBJECT_NOT_EXIST ());
+ }
+
+ CORBA::ULong length = value.length ();
+
+ if (length != this->da_members_.size ())
+ {
+ ACE_THROW (DynamicAny::DynAny::InvalidValue ());
+ }
+
+ CORBA::TypeCode_var value_tc;
+ CORBA::TypeCode_var element_type =
+ this->get_element_type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ for (CORBA::ULong i = 0; i < length; i++)
+ {
+ // Check each arg element for type match.
+ value_tc = value[i].type ();
+ CORBA::Boolean equivalent =
+ value_tc->equivalent (element_type.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (equivalent)
+ {
+ this->da_members_[i]->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->da_members_[i] =
+ TAO_DynAnyFactory::make_dyn_any (value[i]
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else
+ {
+ ACE_THROW (DynamicAny::DynAny::TypeMismatch ());
+ }
+ }
+}
+
+DynamicAny::DynAnySeq *
+TAO_DynArray_i::get_elements_as_dyn_any (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (),
+ 0);
+ }
+
+ DynamicAny::DynAnySeq *retval = 0;
+ ACE_NEW_THROW_EX (retval,
+ DynamicAny::DynAnySeq (this->component_count_),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (0);
+
+ retval->length (this->component_count_);
+ DynamicAny::DynAnySeq_var safe_retval (retval);
+
+ for (CORBA::ULong i = 0; i < this->component_count_; ++i)
+ {
+ // A deep copy is made only by copy() (CORBA 2.4.2 section 9.2.3.6).
+ // Set the flag so the caller can't destroy.
+ this->set_flag (this->da_members_[i].in (),
+ 0
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ safe_retval[i] =
+ DynamicAny::DynAny::_duplicate (this->da_members_[i].in ());
+ ACE_CHECK_RETURN (0);
+ }
+
+ return safe_retval._retn ();
+}
+
+void
+TAO_DynArray_i::set_elements_as_dyn_any (
+ const DynamicAny::DynAnySeq & values
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW (CORBA::OBJECT_NOT_EXIST ());
+ }
+
+ CORBA::ULong length = static_cast<CORBA::ULong> (this->da_members_.size ());
+
+ if (values.length () != length)
+ {
+ ACE_THROW (DynamicAny::DynAny::InvalidValue ());
+ }
+
+ CORBA::TypeCode_var element_type =
+ this->get_element_type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ CORBA::TypeCode_var val_type;
+ CORBA::Boolean equivalent;
+
+ for (CORBA::ULong i = 0; i < length; ++i)
+ {
+ val_type = values[i]->type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ equivalent = val_type->equivalent (element_type.in ()
+ ACE_ENV_ARG_PARAMETER);
+
+ ACE_CHECK;
+
+ if (equivalent)
+ {
+ this->da_members_[i] =
+ values[i]->copy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else
+ {
+ ACE_THROW (DynamicAny::DynAny::TypeMismatch ());
+ }
+ }
+}
+
+// ****************************************************************
+
+void
+TAO_DynArray_i::from_any (const CORBA::Any& any
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW (CORBA::OBJECT_NOT_EXIST ());
+ }
+
+ CORBA::TypeCode_var tc = any.type ();
+ CORBA::Boolean equivalent =
+ this->type_.in ()->equivalent (tc.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (equivalent)
+ {
+ // Get the CDR stream of the Any,if there isn't one, make one.
+ TAO::Any_Impl *impl = any.impl ();
+ TAO_OutputCDR out;
+ TAO_InputCDR cdr (static_cast<ACE_Message_Block *> (0));
+
+ if (impl->encoded ())
+ {
+ TAO::Unknown_IDL_Type *unk =
+ dynamic_cast<TAO::Unknown_IDL_Type *> (impl);
+
+ cdr = unk->_tao_get_cdr ();
+ }
+ else
+ {
+ impl->marshal_value (out);
+ TAO_InputCDR tmp_in (out);
+ cdr = tmp_in;
+ }
+
+ CORBA::ULong length = static_cast<CORBA::ULong> (this->da_members_.size ());
+ CORBA::ULong arg_length = this->get_tc_length (tc.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (length != arg_length)
+ {
+ ACE_THROW (DynamicAny::DynAny::TypeMismatch ());
+ }
+
+ CORBA::TypeCode_var field_tc =
+ this->get_element_type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ for (CORBA::ULong i = 0; i < arg_length; ++i)
+ {
+ CORBA::Any field_any;
+ TAO_InputCDR unk_in (cdr);
+ TAO::Unknown_IDL_Type *field_unk = 0;
+ ACE_NEW (field_unk,
+ TAO::Unknown_IDL_Type (field_tc.in (),
+ unk_in));
+ field_any.replace (field_unk);
+
+ this->da_members_[i]->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->da_members_[i] =
+ TAO_DynAnyFactory::make_dyn_any (field_any
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Move to the next field in the CDR stream.
+ (void) TAO_Marshal_Object::perform_skip (field_tc.in (),
+ &cdr
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ this->current_position_ = arg_length ? 0 : -1;
+ }
+ else
+ {
+ ACE_THROW (DynamicAny::DynAny::TypeMismatch ());
+ }
+}
+
+CORBA::Any_ptr
+TAO_DynArray_i::to_any (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (),
+ 0);
+ }
+
+ CORBA::TypeCode_var field_tc =
+ this->get_element_type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ TAO_OutputCDR out_cdr;
+ CORBA::Any_var field_any;
+ size_t length = this->da_members_.size ();
+
+ for (size_t i = 0; i < length; ++i)
+ {
+ // Recursive step.
+ field_any =
+ this->da_members_[i]->to_any (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ TAO::Any_Impl *field_impl = field_any->impl ();
+ TAO_OutputCDR field_out;
+ TAO_InputCDR field_cdr (static_cast<ACE_Message_Block *> (0));
+
+ if (field_impl->encoded ())
+ {
+ TAO::Unknown_IDL_Type *field_unk =
+ dynamic_cast<TAO::Unknown_IDL_Type *> (field_impl);
+
+ field_cdr = field_unk->_tao_get_cdr ();
+ }
+ else
+ {
+ field_impl->marshal_value (field_out);
+ TAO_InputCDR tmp_in (field_out);
+ field_cdr = tmp_in;
+ }
+
+ (void) TAO_Marshal_Object::perform_append (field_tc.in (),
+ &field_cdr,
+ &out_cdr
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+ }
+
+ TAO_InputCDR in_cdr (out_cdr);
+
+ CORBA::Any_ptr retval = 0;
+ ACE_NEW_THROW_EX (retval,
+ CORBA::Any,
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (0);
+
+ TAO::Unknown_IDL_Type *unk = 0;
+ ACE_NEW_THROW_EX (unk,
+ TAO::Unknown_IDL_Type (this->type_.in (),
+ in_cdr),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (0);
+
+ retval->replace (unk);
+ return retval;
+}
+
+CORBA::Boolean
+TAO_DynArray_i::equal (DynamicAny::DynAny_ptr rhs
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (),
+ 0);
+ }
+
+ CORBA::TypeCode_var tc = rhs->type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ CORBA::Boolean equivalent = tc->equivalent (this->type_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ if (!equivalent)
+ {
+ return 0;
+ }
+
+ DynamicAny::DynAny_var tmp;
+ CORBA::Boolean member_equal;
+
+ for (CORBA::ULong i = 0; i < this->component_count_; ++i)
+ {
+ rhs->seek (static_cast<CORBA::Long> (i)
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ tmp = rhs->current_component (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ // Recursive step.
+ member_equal = tmp->equal (this->da_members_[i].in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ if (!member_equal)
+ {
+ return 0;
+ }
+ }
+
+ return 1;
+}
+
+void
+TAO_DynArray_i::destroy (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW (CORBA::OBJECT_NOT_EXIST ());
+ }
+
+ if (!this->ref_to_component_ || this->container_is_destroying_)
+ {
+ // Do a deep destroy.
+ for (CORBA::ULong i = 0; i < this->component_count_; ++i)
+ {
+ this->set_flag (da_members_[i].in (),
+ 1
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->da_members_[i]->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ this->destroyed_ = 1;
+ }
+}
+
+DynamicAny::DynAny_ptr
+TAO_DynArray_i::current_component (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (),
+ DynamicAny::DynAny::_nil ());
+ }
+
+ if (this->current_position_ == -1)
+ {
+ return DynamicAny::DynAny::_nil ();
+ }
+
+ CORBA::ULong index = static_cast<CORBA::ULong> (this->current_position_);
+
+ this->set_flag (this->da_members_[index].in (),
+ 0
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (DynamicAny::DynAny::_nil ());
+
+ return DynamicAny::DynAny::_duplicate (
+ this->da_members_[index].in ()
+ );
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/DynamicAny/DynArray_i.h b/TAO/tao/DynamicAny/DynArray_i.h
new file mode 100644
index 00000000000..8e28d989cae
--- /dev/null
+++ b/TAO/tao/DynamicAny/DynArray_i.h
@@ -0,0 +1,172 @@
+// -*- C++ -*-
+
+// $Id$
+
+//=============================================================================
+/**
+ * @file DynArray_i.h
+ *
+ * $Id$
+ *
+ * @author Jeff Parsons <parsons@cs.wustl.edu>
+ */
+//=============================================================================
+
+
+#ifndef TAO_DYNARRAY_I_H
+#define TAO_DYNARRAY_I_H
+#include /**/ "ace/pre.h"
+
+#include "tao/DynamicAny/DynamicAny.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/DynamicAny/DynCommon.h"
+#include "tao/LocalObject.h"
+#include "ace/Containers.h"
+
+#if defined (_MSC_VER)
+# pragma warning(push)
+# pragma warning (disable:4250)
+#endif /* _MSC_VER */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_DynArray_i
+ *
+ * Implementation of Dynamic Any type for arrays
+ */
+class TAO_DynamicAny_Export TAO_DynArray_i
+ : public virtual DynamicAny::DynArray,
+ public virtual TAO_DynCommon,
+ public virtual TAO_Local_RefCounted_Object
+{
+public:
+ /// Constructor.
+ TAO_DynArray_i (void);
+
+ /// Destructor.
+ ~TAO_DynArray_i (void);
+
+ /// Initialize using just a TypeCode.
+ void init (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL);
+
+ /// Initialize using an Any.
+ void init (const CORBA::Any& any
+ ACE_ENV_ARG_DECL);
+
+ // = LocalObject methods
+ static TAO_DynArray_i *_narrow (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ // = Functions specific to DynArray.
+
+ virtual DynamicAny::AnySeq * get_elements (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ virtual void set_elements (
+ const DynamicAny::AnySeq & value
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ));
+
+ virtual DynamicAny::DynAnySeq * get_elements_as_dyn_any (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ virtual void set_elements_as_dyn_any (
+ const DynamicAny::DynAnySeq & value
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ));
+
+ // = DynAny common functions not implemented in class TAO_DynCommon.
+
+ virtual void from_any (
+ const CORBA::Any & value
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ));
+
+ virtual CORBA::Any * to_any (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ virtual CORBA::Boolean equal (
+ DynamicAny::DynAny_ptr dyn_any
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ virtual void destroy (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ virtual DynamicAny::DynAny_ptr current_component (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch
+ ));
+
+private:
+ /// Returns the type of elements contained in the array.
+ CORBA::TypeCode_ptr get_element_type (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS);
+
+ /// Gets the length of the array from the typecode.
+ CORBA::ULong get_tc_length (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ /// Called by both versions of init().
+ void init_common (void);
+
+ // Use copy() or assign() instead of these.
+ TAO_DynArray_i (const TAO_DynArray_i &src);
+ TAO_DynArray_i &operator= (const TAO_DynArray_i &src);
+
+private:
+ /// Each component is also a DynAny.
+ ACE_Array_Base<DynamicAny::DynAny_var> da_members_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined(_MSC_VER)
+# pragma warning(pop)
+#endif /* _MSC_VER */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_DYNARRAY_I_H */
diff --git a/TAO/tao/DynamicAny/DynCommon.cpp b/TAO/tao/DynamicAny/DynCommon.cpp
new file mode 100644
index 00000000000..0a37bd4f9fe
--- /dev/null
+++ b/TAO/tao/DynamicAny/DynCommon.cpp
@@ -0,0 +1,1855 @@
+// $Id$
+
+#include "tao/AnyTypeCode/Any_Unknown_IDL_Type.h"
+#include "tao/AnyTypeCode/AnyTypeCode_methods.h"
+#include "tao/DynamicAny/DynCommon.h"
+#include "tao/DynamicAny/DynAnyFactory.h"
+#include "tao/DynamicAny/DynAny_i.h"
+#include "tao/DynamicAny/DynArray_i.h"
+#include "tao/DynamicAny/DynEnum_i.h"
+#include "tao/DynamicAny/DynSequence_i.h"
+#include "tao/DynamicAny/DynStruct_i.h"
+#include "tao/DynamicAny/DynUnion_i.h"
+#include "tao/CDR.h"
+#include "ace/OS_NS_wchar.h"
+#include "ace/OS_NS_string.h"
+
+
+ACE_RCSID (DynamicAny,
+ DynCommon,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_DynCommon::TAO_DynCommon (void)
+{
+}
+
+TAO_DynCommon::~TAO_DynCommon (void)
+{
+}
+
+// *****************************************************************
+
+CORBA::TypeCode_ptr
+TAO_DynCommon::type (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (),
+ CORBA::TypeCode::_nil ());
+ }
+
+ return CORBA::TypeCode::_duplicate (this->type_.in ());
+}
+
+void
+TAO_DynCommon::assign (DynamicAny::DynAny_ptr dyn_any
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW (CORBA::OBJECT_NOT_EXIST ());
+ }
+
+ CORBA::TypeCode_var tc = dyn_any->type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ CORBA::Boolean equivalent =
+ this->type_.in ()->equivalent (tc.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (equivalent)
+ {
+ CORBA::Any_var any = dyn_any->to_any (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->from_any (any.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else
+ {
+ ACE_THROW (DynamicAny::DynAny::TypeMismatch ());
+ }
+}
+
+void
+TAO_DynCommon::insert_boolean (CORBA::Boolean value
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW (CORBA::OBJECT_NOT_EXIST ());
+ }
+
+ if (this->has_components_)
+ {
+ DynamicAny::DynAny_var cc =
+ this->check_component (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ cc->insert_boolean (value
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else
+ {
+ this->check_type (CORBA::_tc_boolean
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->any_ <<= CORBA::Any::from_boolean (value);
+ }
+}
+
+void
+TAO_DynCommon::insert_octet (CORBA::Octet value
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW (CORBA::OBJECT_NOT_EXIST ());
+ }
+
+ if (this->has_components_)
+ {
+ DynamicAny::DynAny_var cc =
+ this->check_component (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ cc->insert_octet (value
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else
+ {
+ this->check_type (CORBA::_tc_octet
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->any_ <<= CORBA::Any::from_octet (value);
+ }
+}
+
+void
+TAO_DynCommon::insert_char (CORBA::Char value
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW (CORBA::OBJECT_NOT_EXIST ());
+ }
+
+ if (this->has_components_)
+ {
+ DynamicAny::DynAny_var cc =
+ this->check_component (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ cc->insert_char (value
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else
+ {
+ this->check_type (CORBA::_tc_char
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->any_ <<= CORBA::Any::from_char (value);
+ }
+}
+
+void
+TAO_DynCommon::insert_short (CORBA::Short value
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW (CORBA::OBJECT_NOT_EXIST ());
+ }
+
+ if (this->has_components_)
+ {
+ DynamicAny::DynAny_var cc =
+ this->check_component (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ cc->insert_short (value
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else
+ {
+ this->check_type (CORBA::_tc_short
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->any_ <<= value;
+ }
+}
+
+void
+TAO_DynCommon::insert_ushort (CORBA::UShort value
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW (CORBA::OBJECT_NOT_EXIST ());
+ }
+
+ if (this->has_components_)
+ {
+ DynamicAny::DynAny_var cc =
+ this->check_component (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ cc->insert_ushort (value
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else
+ {
+ this->check_type (CORBA::_tc_ushort
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->any_ <<= value;
+ }
+}
+
+void
+TAO_DynCommon::insert_long (CORBA::Long value
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW (CORBA::OBJECT_NOT_EXIST ());
+ }
+
+ if (this->has_components_)
+ {
+ DynamicAny::DynAny_var cc =
+ this->check_component (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ cc->insert_long (value
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else
+ {
+ this->check_type (CORBA::_tc_long
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->any_ <<= value;
+ }
+}
+
+void
+TAO_DynCommon::insert_ulong (CORBA::ULong value
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW (CORBA::OBJECT_NOT_EXIST ());
+ }
+
+ if (this->has_components_)
+ {
+ DynamicAny::DynAny_var cc =
+ this->check_component (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ cc->insert_ulong (value
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else
+ {
+ this->check_type (CORBA::_tc_ulong
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->any_ <<= value;
+ }
+}
+
+void
+TAO_DynCommon::insert_float (CORBA::Float value
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW (CORBA::OBJECT_NOT_EXIST ());
+ }
+
+ if (this->has_components_)
+ {
+ DynamicAny::DynAny_var cc =
+ this->check_component (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ cc->insert_float (value
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else
+ {
+ this->check_type (CORBA::_tc_float
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->any_ <<= value;
+ }
+}
+
+void
+TAO_DynCommon::insert_double (CORBA::Double value
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW (CORBA::OBJECT_NOT_EXIST ());
+ }
+
+ if (this->has_components_)
+ {
+ DynamicAny::DynAny_var cc =
+ this->check_component (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ cc->insert_double (value
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else
+ {
+ this->check_type (CORBA::_tc_double
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->any_ <<= value;
+ }
+}
+
+void
+TAO_DynCommon::insert_string (const char * value
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW (CORBA::OBJECT_NOT_EXIST ());
+ }
+
+ if (this->has_components_)
+ {
+ DynamicAny::DynAny_var cc =
+ this->check_component (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ cc->insert_string (value
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else
+ {
+ CORBA::TypeCode_var unaliased_tc =
+ TAO_DynAnyFactory::strip_alias (this->type_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ CORBA::TCKind kind =
+ unaliased_tc->kind (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (kind != CORBA::tk_string)
+ {
+ ACE_THROW (DynamicAny::DynAny::TypeMismatch ());
+ }
+
+ CORBA::ULong bound =
+ unaliased_tc->length (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (bound > 0 && bound < ACE_OS::strlen (value))
+ {
+ ACE_THROW (DynamicAny::DynAny::InvalidValue ());
+ }
+
+ this->any_ <<= CORBA::Any::from_string (const_cast<char *> (value),
+ bound);
+ }
+}
+
+void
+TAO_DynCommon::insert_reference (CORBA::Object_ptr value
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW (CORBA::OBJECT_NOT_EXIST ());
+ }
+
+ if (this->has_components_)
+ {
+ DynamicAny::DynAny_var cc =
+ this->check_component (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ cc->insert_reference (value
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else
+ {
+ CORBA::Boolean good_type = 1;
+ CORBA::TCKind kind =
+ TAO_DynAnyFactory::unalias (this->type_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (kind != CORBA::tk_objref)
+ {
+ good_type = 0;
+ }
+ else if (!CORBA::is_nil (value))
+ {
+ const char *value_id = value->_interface_repository_id ();
+
+ if (ACE_OS::strcmp (value_id, "IDL:omg.org/CORBA/Object:1.0") != 0)
+ {
+ const char *my_id =
+ this->type_->id (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (ACE_OS::strcmp (value_id, my_id) != 0)
+ {
+ good_type = value->_is_a (my_id
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ }
+ }
+
+ if (good_type)
+ {
+ TAO_OutputCDR cdr;
+
+ if (CORBA::is_nil (value))
+ {
+ // Empty type hint, no profile.
+ cdr.write_ulong (1);
+ cdr.write_char ('\0');
+ cdr.write_ulong (0);
+ }
+ else
+ {
+ value->marshal (cdr);
+ }
+
+ TAO_InputCDR in (cdr);
+ TAO::Unknown_IDL_Type *unk = 0;
+ ACE_NEW (unk,
+ TAO::Unknown_IDL_Type (this->type_.in (),
+ in));
+ this->any_.replace (unk);
+ }
+ else
+ {
+ ACE_THROW (DynamicAny::DynAny::TypeMismatch ());
+ }
+ }
+}
+
+void
+TAO_DynCommon::insert_typecode (CORBA::TypeCode_ptr value
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW (CORBA::OBJECT_NOT_EXIST ());
+ }
+
+ if (this->has_components_)
+ {
+ DynamicAny::DynAny_var cc =
+ this->check_component (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ cc->insert_typecode (value
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else
+ {
+ this->check_type (CORBA::_tc_TypeCode
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->any_ <<= value;
+ }
+}
+
+void
+TAO_DynCommon::insert_longlong (CORBA::LongLong value
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW (CORBA::OBJECT_NOT_EXIST ());
+ }
+
+ if (this->has_components_)
+ {
+ DynamicAny::DynAny_var cc =
+ this->check_component (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ cc->insert_longlong (value
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else
+ {
+ this->check_type (CORBA::_tc_longlong
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->any_ <<= value;
+ }
+}
+
+void
+TAO_DynCommon::insert_ulonglong (CORBA::ULongLong value
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW (CORBA::OBJECT_NOT_EXIST ());
+ }
+
+ if (this->has_components_)
+ {
+ DynamicAny::DynAny_var cc =
+ this->check_component (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ cc->insert_ulonglong (value
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else
+ {
+ this->check_type (CORBA::_tc_ulonglong
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->any_ <<= value;
+ }
+}
+
+void
+TAO_DynCommon::insert_longdouble (CORBA::LongDouble value
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW (CORBA::OBJECT_NOT_EXIST ());
+ }
+
+ if (this->has_components_)
+ {
+ DynamicAny::DynAny_var cc =
+ this->check_component (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ cc->insert_longdouble (value
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else
+ {
+ this->check_type (CORBA::_tc_longdouble
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->any_ <<= value;
+ }
+}
+
+void
+TAO_DynCommon::insert_wchar (CORBA::WChar value
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW (CORBA::OBJECT_NOT_EXIST ());
+ }
+
+ if (this->has_components_)
+ {
+ DynamicAny::DynAny_var cc =
+ this->check_component (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ cc->insert_wchar (value
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else
+ {
+ this->check_type (CORBA::_tc_wchar
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->any_ <<= CORBA::Any::from_wchar (value);
+ }
+}
+
+void
+TAO_DynCommon::insert_wstring (const CORBA::WChar * value
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW (CORBA::OBJECT_NOT_EXIST ());
+ }
+
+ if (this->has_components_)
+ {
+ DynamicAny::DynAny_var cc =
+ this->check_component (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ cc->insert_wstring (value
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else
+ {
+ CORBA::TypeCode_var unaliased_tc =
+ this->check_type_and_unalias (CORBA::_tc_wstring
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ CORBA::ULong bound = unaliased_tc->length (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (bound > 0 && bound < ACE_OS::wslen (value))
+ {
+ ACE_THROW (DynamicAny::DynAny::InvalidValue ());
+ }
+
+ this->any_ <<= CORBA::Any::from_wstring (const_cast<CORBA::WChar *> (value),
+ bound);
+ }
+}
+
+void
+TAO_DynCommon::insert_any (const CORBA::Any &value
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW (CORBA::OBJECT_NOT_EXIST ());
+ }
+
+ if (this->has_components_)
+ {
+ DynamicAny::DynAny_var cc =
+ this->check_component (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ cc->insert_any (value
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else
+ {
+ this->check_type (CORBA::_tc_any
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->any_ <<= value;
+ }
+}
+
+// @@@ (JP) TODO - optimize - this version was intended by the OMG to
+// have fewer Any/DynAny conversions than insert_any, not more.
+void
+TAO_DynCommon::insert_dyn_any (DynamicAny::DynAny_ptr value
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW (CORBA::OBJECT_NOT_EXIST ());
+ }
+
+ CORBA::Any_var any = value->to_any (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->insert_any (any.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+void
+TAO_DynCommon::insert_val (CORBA::ValueBase *
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ))
+{
+ ACE_THROW (CORBA::NO_IMPLEMENT ());
+}
+
+// ****************************************************************
+
+CORBA::Boolean
+TAO_DynCommon::get_boolean (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (),
+ 0);
+ }
+
+ if (this->has_components_)
+ {
+ DynamicAny::DynAny_var cc =
+ this->check_component (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ return cc->get_boolean (ACE_ENV_SINGLE_ARG_PARAMETER);
+ }
+ else
+ {
+ CORBA::Boolean retval;
+
+ if ((this->any_ >>= CORBA::Any::to_boolean (retval)) == 0)
+ {
+ ACE_THROW_RETURN (DynamicAny::DynAny::TypeMismatch (),
+ 0);
+ }
+
+ return retval;
+ }
+}
+
+CORBA::Octet
+TAO_DynCommon::get_octet (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (),
+ 0);
+ }
+
+ if (this->has_components_)
+ {
+ DynamicAny::DynAny_var cc =
+ this->check_component (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ return cc->get_octet (ACE_ENV_SINGLE_ARG_PARAMETER);
+ }
+ else
+ {
+ CORBA::Octet retval;
+
+ if ((this->any_ >>= CORBA::Any::to_octet (retval)) == 0)
+ {
+ ACE_THROW_RETURN (DynamicAny::DynAny::TypeMismatch (),
+ 0);
+ }
+
+ return retval;
+ }
+}
+
+CORBA::Char
+TAO_DynCommon::get_char (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (),
+ 0);
+ }
+
+ if (this->has_components_)
+ {
+ DynamicAny::DynAny_var cc =
+ this->check_component (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ return cc->get_char (ACE_ENV_SINGLE_ARG_PARAMETER);
+ }
+ else
+ {
+ CORBA::Char retval;
+
+ if ((this->any_ >>= CORBA::Any::to_char (retval)) == 0)
+ {
+ ACE_THROW_RETURN (DynamicAny::DynAny::TypeMismatch (),
+ 0);
+ }
+
+ return retval;
+ }
+}
+
+CORBA::Short
+TAO_DynCommon::get_short (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (),
+ 0);
+ }
+
+ if (this->has_components_)
+ {
+ DynamicAny::DynAny_var cc =
+ this->check_component (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ return cc->get_short (ACE_ENV_SINGLE_ARG_PARAMETER);
+ }
+ else
+ {
+ CORBA::Short retval;
+
+ if ((this->any_ >>= retval) == 0)
+ {
+ ACE_THROW_RETURN (DynamicAny::DynAny::TypeMismatch (),
+ 0);
+ }
+
+ return retval;
+ }
+}
+
+CORBA::UShort
+TAO_DynCommon::get_ushort (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (),
+ 0);
+ }
+
+ if (this->has_components_)
+ {
+ DynamicAny::DynAny_var cc =
+ this->check_component (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ return cc->get_ushort (ACE_ENV_SINGLE_ARG_PARAMETER);
+ }
+ else
+ {
+ CORBA::UShort retval;
+
+ if ((this->any_ >>= retval) == 0)
+ {
+ ACE_THROW_RETURN (DynamicAny::DynAny::TypeMismatch (),
+ 0);
+ }
+
+ return retval;
+ }
+}
+
+CORBA::Long
+TAO_DynCommon::get_long (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (),
+ 0);
+ }
+
+ if (this->has_components_)
+ {
+ DynamicAny::DynAny_var cc =
+ this->check_component (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ return cc->get_long (ACE_ENV_SINGLE_ARG_PARAMETER);
+ }
+ else
+ {
+ CORBA::Long retval;
+
+ if ((this->any_ >>= retval) == 0)
+ {
+ ACE_THROW_RETURN (DynamicAny::DynAny::TypeMismatch (),
+ 0);
+ }
+
+ return retval;
+ }
+}
+
+CORBA::ULong
+TAO_DynCommon::get_ulong (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (),
+ 0);
+ }
+
+ if (this->has_components_)
+ {
+ DynamicAny::DynAny_var cc =
+ this->check_component (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ return cc->get_ulong (ACE_ENV_SINGLE_ARG_PARAMETER);
+ }
+ else
+ {
+ CORBA::ULong retval;
+
+ if ((this->any_ >>= retval) == 0)
+ {
+ ACE_THROW_RETURN (DynamicAny::DynAny::TypeMismatch (),
+ 0);
+ }
+
+ return retval;
+ }
+}
+
+CORBA::Float
+TAO_DynCommon::get_float (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (),
+ 0);
+ }
+
+ if (this->has_components_)
+ {
+ DynamicAny::DynAny_var cc =
+ this->check_component (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ return cc->get_float (ACE_ENV_SINGLE_ARG_PARAMETER);
+ }
+ else
+ {
+ CORBA::Float retval;
+
+ if ((this->any_ >>= retval) == 0)
+ {
+ ACE_THROW_RETURN (DynamicAny::DynAny::TypeMismatch (),
+ 0);
+ }
+
+ return retval;
+ }
+}
+
+CORBA::Double
+TAO_DynCommon::get_double (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (),
+ 0);
+ }
+
+ if (this->has_components_)
+ {
+ DynamicAny::DynAny_var cc =
+ this->check_component (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ return cc->get_double (ACE_ENV_SINGLE_ARG_PARAMETER);
+ }
+ else
+ {
+ CORBA::Double retval;
+
+ if ((this->any_ >>= retval) == 0)
+ {
+ ACE_THROW_RETURN (DynamicAny::DynAny::TypeMismatch (),
+ 0);
+ }
+
+ return retval;
+ }
+}
+
+char *
+TAO_DynCommon::get_string (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (),
+ 0);
+ }
+
+ if (this->has_components_)
+ {
+ DynamicAny::DynAny_var cc =
+ this->check_component (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ return cc->get_string (ACE_ENV_SINGLE_ARG_PARAMETER);
+ }
+ else
+ {
+ CORBA::TypeCode_var unaliased_tc =
+ TAO_DynAnyFactory::strip_alias (this->type_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ CORBA::TCKind kind =
+ unaliased_tc->kind (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ if (kind != CORBA::tk_string)
+ {
+ ACE_THROW_RETURN (DynamicAny::DynAny::TypeMismatch (),
+ 0);
+ }
+
+ char *retval = 0;
+
+ CORBA::ULong bound =
+ unaliased_tc->length (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ // We will have caught a type mismatch above, so if this fails,
+ // it must be for some other reason.
+ if ((this->any_ >>= CORBA::Any::to_string (retval, bound)) == 0)
+ {
+ ACE_THROW_RETURN (DynamicAny::DynAny::InvalidValue (),
+ 0);
+ }
+
+ return CORBA::string_dup (retval);
+ }
+}
+
+CORBA::Object_ptr
+TAO_DynCommon::get_reference (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (),
+ CORBA::Object::_nil ());
+ }
+
+ if (this->has_components_)
+ {
+ DynamicAny::DynAny_var cc =
+ this->check_component (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Object::_nil ());
+
+ return cc->get_reference (ACE_ENV_SINGLE_ARG_PARAMETER);
+ }
+ else
+ {
+ CORBA::Object_var retval;
+
+ if ((this->any_ >>= CORBA::Any::to_object (retval.inout ())) == 0)
+ {
+ ACE_THROW_RETURN (DynamicAny::DynAny::TypeMismatch (),
+ CORBA::Object::_nil ());
+ }
+
+ return retval._retn ();
+ }
+}
+
+CORBA::TypeCode_ptr
+TAO_DynCommon::get_typecode (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (),
+ CORBA::TypeCode::_nil ());
+ }
+
+ if (this->has_components_)
+ {
+ DynamicAny::DynAny_var cc =
+ this->check_component (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ return cc->get_typecode (ACE_ENV_SINGLE_ARG_PARAMETER);
+ }
+ else
+ {
+ CORBA::TypeCode_ptr retval;
+
+ if ((this->any_ >>= retval) == 0)
+ {
+ ACE_THROW_RETURN (DynamicAny::DynAny::TypeMismatch (),
+ CORBA::TypeCode::_nil ());
+ }
+
+ return CORBA::TypeCode::_duplicate (retval);
+ }
+}
+
+CORBA::LongLong
+TAO_DynCommon::get_longlong (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ))
+{
+ CORBA::LongLong retval = ACE_CDR_LONGLONG_INITIALIZER;
+
+ if (this->destroyed_)
+ {
+ ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (),
+ retval);
+ }
+
+ if (this->has_components_)
+ {
+ DynamicAny::DynAny_var cc =
+ this->check_component (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (retval);
+
+ return cc->get_longlong (ACE_ENV_SINGLE_ARG_PARAMETER);
+ }
+ else
+ {
+ if ((this->any_ >>= retval) == 0)
+ {
+ ACE_THROW_RETURN (DynamicAny::DynAny::TypeMismatch (),
+ retval);
+ }
+
+ return retval;
+ }
+}
+
+CORBA::ULongLong
+TAO_DynCommon::get_ulonglong (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ))
+{
+ CORBA::ULongLong retval = 0;
+
+ if (this->destroyed_)
+ {
+ ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (),
+ retval);
+ }
+
+ if (this->has_components_)
+ {
+ DynamicAny::DynAny_var cc =
+ this->check_component (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (retval);
+
+ return cc->get_ulonglong (ACE_ENV_SINGLE_ARG_PARAMETER);
+ }
+ else
+ {
+ if ((this->any_ >>= retval) == 0)
+ {
+ ACE_THROW_RETURN (DynamicAny::DynAny::TypeMismatch (),
+ retval);
+ }
+
+ return retval;
+ }
+}
+
+CORBA::LongDouble
+TAO_DynCommon::get_longdouble (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ))
+{
+ CORBA::LongDouble retval = ACE_CDR_LONG_DOUBLE_INITIALIZER;
+
+ if (this->destroyed_)
+ {
+ ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (),
+ retval);
+ }
+
+ if (this->has_components_)
+ {
+ DynamicAny::DynAny_var cc =
+ this->check_component (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (retval);
+
+ return cc->get_longdouble (ACE_ENV_SINGLE_ARG_PARAMETER);
+ }
+ else
+ {
+ if ((this->any_ >>= retval) == 0)
+ {
+ ACE_THROW_RETURN (DynamicAny::DynAny::TypeMismatch (),
+ retval);
+ }
+
+ return retval;
+ }
+}
+
+CORBA::WChar
+TAO_DynCommon::get_wchar (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (),
+ 0);
+ }
+
+ if (this->has_components_)
+ {
+ DynamicAny::DynAny_var cc =
+ this->check_component (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ return cc->get_wchar (ACE_ENV_SINGLE_ARG_PARAMETER);
+ }
+ else
+ {
+ CORBA::WChar retval;
+
+ if ((this->any_ >>= CORBA::Any::to_wchar (retval)) == 0)
+ {
+ ACE_THROW_RETURN (DynamicAny::DynAny::TypeMismatch (),
+ 0);
+ }
+
+ return retval;
+ }
+}
+
+CORBA::WChar *
+TAO_DynCommon::get_wstring (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (),
+ 0);
+ }
+
+ if (this->has_components_)
+ {
+ DynamicAny::DynAny_var cc =
+ this->check_component (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ return cc->get_wstring (ACE_ENV_SINGLE_ARG_PARAMETER);
+ }
+ else
+ {
+ // @@@ (JP) Someday try to find a way to avoid checking for
+ // type code equivalence twice without risking a throw of
+ // BadKind.
+ CORBA::TypeCode_var unaliased_tc =
+ this->check_type_and_unalias (CORBA::_tc_wstring
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ CORBA::WChar *retval = 0;
+
+ CORBA::ULong bound =
+ unaliased_tc->length (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ (void) (this->any_ >>= CORBA::Any::to_wstring (retval,
+ bound));
+
+ return CORBA::wstring_dup (retval);
+ }
+}
+
+CORBA::Any_ptr
+TAO_DynCommon::get_any (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (),
+ 0);
+ }
+
+ if (this->has_components_)
+ {
+ DynamicAny::DynAny_var cc =
+ this->check_component (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ return cc->get_any (ACE_ENV_SINGLE_ARG_PARAMETER);
+ }
+ else
+ {
+ const CORBA::Any *tmp = 0;
+
+ if ((this->any_ >>= tmp) == 0)
+ {
+ ACE_THROW_RETURN (DynamicAny::DynAny::TypeMismatch (),
+ 0);
+ }
+
+ CORBA::Any *retval = 0;
+ ACE_NEW_RETURN (retval,
+ CORBA::Any (*tmp),
+ 0);
+ return retval;
+ }
+}
+
+// @@@ (JP) TODO - optimize - this version was intended by the OMG to
+// have fewer Any/DynAny conversions than get_any, not more.
+DynamicAny::DynAny_ptr
+TAO_DynCommon::get_dyn_any (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (),
+ 0);
+ }
+
+ CORBA::Any_var any = this->get_any (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ return TAO_DynAnyFactory::make_dyn_any (any.in ()
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::ValueBase *
+TAO_DynCommon::get_val (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ))
+{
+ ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (),
+ 0);
+}
+
+// ****************************************************************
+
+CORBA::Boolean
+TAO_DynCommon::seek (CORBA::Long slot
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (),
+ 0);
+ }
+
+ if (this->has_components_ == 0)
+ {
+ ACE_UNUSED_ARG (slot);
+ this->current_position_ = -1;
+ return 0;
+ }
+ else if (slot < 0 || slot >= static_cast<CORBA::Long> (this->component_count_))
+ {
+ this->current_position_ = -1;
+ return 0;
+ }
+ else
+ {
+ this->current_position_ = slot;
+ return 1;
+ }
+}
+
+void
+TAO_DynCommon::rewind (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW (CORBA::OBJECT_NOT_EXIST ());
+ }
+
+ (void) this->seek (0
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+CORBA::Boolean
+TAO_DynCommon::next (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (),
+ 0);
+ }
+
+ if (this->has_components_ == 0
+ || this->current_position_ + 1 >= static_cast<CORBA::Long> (this->component_count_
+ ))
+ {
+ this->current_position_ = -1;
+ return 0;
+ }
+ else
+ {
+ ++this->current_position_;
+ return 1;
+ }
+}
+
+DynamicAny::DynAny_ptr
+TAO_DynCommon::copy (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (),
+ DynamicAny::DynAny::_nil ());
+ }
+
+ CORBA::Any_var any = this->to_any (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (DynamicAny::DynAny::_nil ());
+
+ DynamicAny::DynAny_ptr retval =
+ TAO_DynAnyFactory::make_dyn_any (any.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (DynamicAny::DynAny::_nil ());
+
+ return retval;
+}
+
+CORBA::ULong
+TAO_DynCommon::component_count (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (),
+ 0);
+ }
+
+ return this->component_count_;
+}
+
+void
+TAO_DynCommon::set_flag (DynamicAny::DynAny_ptr component,
+ CORBA::Boolean destroying
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ CORBA::TypeCode_var tc = component->type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ CORBA::TCKind tk = TAO_DynAnyFactory::unalias (tc.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ switch (tk)
+ {
+ case CORBA::tk_array:
+ {
+ TAO_DynArray_i *tmp =
+ TAO_DynArray_i::_narrow (component
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (destroying)
+ {
+ tmp->container_is_destroying_ = 1;
+ }
+ else
+ {
+ tmp->ref_to_component_ = 1;
+ }
+
+ break;
+ }
+ case CORBA::tk_enum:
+ {
+ TAO_DynEnum_i *tmp = TAO_DynEnum_i::_narrow (component
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (destroying)
+ {
+ tmp->container_is_destroying_ = 1;
+ }
+ else
+ {
+ tmp->ref_to_component_ = 1;
+ }
+
+ break;
+ }
+ case CORBA::tk_sequence:
+ {
+ TAO_DynSequence_i *tmp =
+ TAO_DynSequence_i::_narrow (component
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (destroying)
+ {
+ tmp->container_is_destroying_ = 1;
+ }
+ else
+ {
+ tmp->ref_to_component_ = 1;
+ }
+
+ break;
+ }
+ case CORBA::tk_struct:
+ {
+ TAO_DynStruct_i *tmp =
+ TAO_DynStruct_i::_narrow (component
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (destroying)
+ {
+ tmp->container_is_destroying_ = 1;
+ }
+ else
+ {
+ tmp->ref_to_component_ = 1;
+ }
+
+ break;
+ }
+ case CORBA::tk_union:
+ {
+ TAO_DynUnion_i *tmp =
+ TAO_DynUnion_i::_narrow (component
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (destroying)
+ {
+ tmp->container_is_destroying_ = 1;
+ }
+ else
+ {
+ tmp->ref_to_component_ = 1;
+ }
+
+ break;
+ }
+ case CORBA::tk_fixed:
+ case CORBA::tk_value:
+ case CORBA::tk_value_box:
+ ACE_THROW (CORBA::NO_IMPLEMENT ());
+ default:
+ {
+ TAO_DynAny_i *tmp = TAO_DynAny_i::_narrow (component
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (destroying)
+ {
+ tmp->container_is_destroying_ = 1;
+ }
+ else
+ {
+ tmp->ref_to_component_ = 1;
+ }
+
+ break;
+ }
+ }
+}
+
+DynamicAny::DynAny_ptr
+TAO_DynCommon::check_component (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ))
+{
+ if (this->current_position_ == -1)
+ {
+ ACE_THROW_RETURN (DynamicAny::DynAny::InvalidValue (),
+ DynamicAny::DynAny::_nil ());
+ }
+
+ DynamicAny::DynAny_var cc =
+ this->current_component (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (DynamicAny::DynAny::_nil ());
+
+ CORBA::TypeCode_var tc = cc->type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (DynamicAny::DynAny::_nil ());
+
+ CORBA::TCKind kind = TAO_DynAnyFactory::unalias (tc.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (DynamicAny::DynAny::_nil ());
+
+ // We are here because we are a component that is the target of
+ // an insert_*() call on our container. It is
+ // illegal to insert anything into a component that itself has
+ // components.
+ switch (kind)
+ {
+ case CORBA::tk_array:
+ case CORBA::tk_except:
+ case CORBA::tk_sequence:
+ case CORBA::tk_struct:
+ case CORBA::tk_union:
+ ACE_THROW_RETURN (DynamicAny::DynAny::TypeMismatch (),
+ DynamicAny::DynAny::_nil ());
+ default:
+ return cc._retn ();
+ }
+}
+
+void
+TAO_DynCommon::check_type (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch
+ ))
+{
+ CORBA::Boolean equivalent =
+ this->type_->equivalent (tc
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (!equivalent)
+ {
+ ACE_THROW (DynamicAny::DynAny::TypeMismatch ());
+ }
+}
+
+CORBA::TypeCode_ptr
+TAO_DynCommon::check_type_and_unalias (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch
+ ))
+{
+ this->check_type (tc
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::TypeCode::_nil ());
+
+ return TAO_DynAnyFactory::strip_alias (tc
+ ACE_ENV_ARG_PARAMETER);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/DynamicAny/DynCommon.h b/TAO/tao/DynamicAny/DynCommon.h
new file mode 100644
index 00000000000..dccc16e617a
--- /dev/null
+++ b/TAO/tao/DynamicAny/DynCommon.h
@@ -0,0 +1,558 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file DynCommon.h
+ *
+ * $Id$
+ *
+ * @author Jeff Parsons <parsons@cs.wustl.edu>
+ */
+//=============================================================================
+
+
+#ifndef TAO_DYNCOMMON_H
+#define TAO_DYNCOMMON_H
+#include /**/ "ace/pre.h"
+
+#include "tao/DynamicAny/DynamicAny.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if defined (_MSC_VER)
+# pragma warning(push)
+# pragma warning (disable:4250)
+#endif /* _MSC_VER */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_DynCommon
+ *
+ * Contains most of the functionality common to all the
+ * Dynamic Any implementation classes.
+ */
+class TAO_DynamicAny_Export TAO_DynCommon
+ : public virtual DynamicAny::DynAny
+{
+public:
+ /// Constructor.
+ TAO_DynCommon (void);
+
+ /// Destructor.
+ virtual ~TAO_DynCommon (void);
+
+ // = Some functions common to all Dynamic Any types.
+
+ virtual CORBA::TypeCode_ptr type (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ virtual void assign (
+ DynamicAny::DynAny_ptr dyn_any
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch
+ ));
+
+ virtual void insert_boolean (
+ CORBA::Boolean value
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ));
+
+ virtual void insert_octet (
+ CORBA::Octet value
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ));
+
+ virtual void insert_char (
+ CORBA::Char value
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ));
+
+ virtual void insert_short (
+ CORBA::Short value
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ));
+
+ virtual void insert_ushort (
+ CORBA::UShort value
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ));
+
+ virtual void insert_long (
+ CORBA::Long value
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ));
+
+ virtual void insert_ulong (
+ CORBA::ULong value
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ));
+
+ virtual void insert_float (
+ CORBA::Float value
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ));
+
+ virtual void insert_double (
+ CORBA::Double value
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ));
+
+ virtual void insert_string (
+ const char * value
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ));
+
+ virtual void insert_reference (
+ CORBA::Object_ptr value
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ));
+
+ virtual void insert_typecode (
+ CORBA::TypeCode_ptr value
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ));
+
+ virtual void insert_longlong (
+ CORBA::LongLong value
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ));
+
+ virtual void insert_ulonglong (
+ CORBA::ULongLong value
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ));
+
+ virtual void insert_longdouble (
+ CORBA::LongDouble value
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ));
+
+ virtual void insert_wchar (
+ CORBA::WChar value
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ));
+
+ virtual void insert_wstring (
+ const CORBA::WChar * value
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ));
+
+ virtual void insert_any (
+ const CORBA::Any & value
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ));
+
+ virtual void insert_dyn_any (
+ DynamicAny::DynAny_ptr value
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ));
+
+ virtual void insert_val (
+ CORBA::ValueBase * value
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ));
+
+ virtual CORBA::Boolean get_boolean (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ));
+
+ virtual CORBA::Octet get_octet (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ));
+
+ virtual CORBA::Char get_char (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ));
+
+ virtual CORBA::Short get_short (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ));
+
+ virtual CORBA::UShort get_ushort (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ));
+
+ virtual CORBA::Long get_long (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ));
+
+ virtual CORBA::ULong get_ulong (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ));
+
+ virtual CORBA::Float get_float (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ));
+
+ virtual CORBA::Double get_double (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ));
+
+ virtual char * get_string (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ));
+
+ virtual CORBA::Object_ptr get_reference (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ));
+
+ virtual CORBA::TypeCode_ptr get_typecode (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ));
+
+ virtual CORBA::LongLong get_longlong (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ));
+
+ virtual CORBA::ULongLong get_ulonglong (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ));
+
+ virtual CORBA::LongDouble get_longdouble (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ));
+
+ virtual CORBA::WChar get_wchar (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ));
+
+ virtual CORBA::WChar * get_wstring (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ));
+
+ virtual CORBA::Any * get_any (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ));
+
+ virtual DynamicAny::DynAny_ptr get_dyn_any (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ));
+
+ virtual CORBA::ValueBase * get_val (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ));
+
+ virtual CORBA::Boolean seek (
+ CORBA::Long index
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ virtual void rewind (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ virtual CORBA::Boolean next (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ virtual DynamicAny::DynAny_ptr copy (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ virtual CORBA::ULong component_count (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+protected:
+ /// This sets one of two flags in this base class. CORBA 2.4.2
+ /// requires that destroy() do nothing if it is called on
+ /// the result of current_component(), the only non-deep-copying
+ /// method in the Dynamic Any API. If the boolean arg below is 0,
+ /// the call is from inside current_component(), and the flag
+ /// ref_to_component_ is set. If the boolean arg is 1, the call
+ /// is from inside destroy(), and the container_is_destroying_
+ /// flag is set, overriding the first flag in the component's
+ /// destroy() method.
+ void set_flag (
+ DynamicAny::DynAny_ptr component,
+ CORBA::Boolean destroying
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+protected:
+ /// Were we created by current_component()?
+ CORBA::Boolean ref_to_component_;
+
+ /// Flag to let destroy() call by container override the flag above.
+ CORBA::Boolean container_is_destroying_;
+
+ /// Do we contain other Dynamic Anys?
+ CORBA::Boolean has_components_;
+
+ /// Has destroy() been called on us yet?
+ CORBA::Boolean destroyed_;
+
+ /// Slot of the current component (if any).
+ CORBA::Long current_position_;
+
+ /// Number of components, as defined by CORBA 2.4.2.
+ CORBA::ULong component_count_;
+
+ /// Holder for our type code.
+ CORBA::TypeCode_var type_;
+
+ /// Gets a value only for basic types, but used in insert_*
+ /// and get_*, defined in this base class.
+ CORBA::Any any_;
+
+private:
+ // Utility functions used by insert_* and get_*.
+
+ DynamicAny::DynAny_ptr check_component (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ));
+
+ void check_type (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch
+ ));
+
+ CORBA::TypeCode_ptr check_type_and_unalias (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch
+ ));
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined(_MSC_VER)
+# pragma warning(pop)
+#endif /* _MSC_VER */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_DYNCOMMON_H */
diff --git a/TAO/tao/DynamicAny/DynEnum_i.cpp b/TAO/tao/DynamicAny/DynEnum_i.cpp
new file mode 100644
index 00000000000..2d94ed2a047
--- /dev/null
+++ b/TAO/tao/DynamicAny/DynEnum_i.cpp
@@ -0,0 +1,350 @@
+// $Id$
+
+#include "tao/AnyTypeCode/Any_Unknown_IDL_Type.h"
+#include "tao/AnyTypeCode/AnyTypeCode_methods.h"
+#include "tao/DynamicAny/DynEnum_i.h"
+#include "tao/DynamicAny/DynAnyFactory.h"
+#include "tao/CDR.h"
+
+#include "ace/OS_NS_string.h"
+
+
+ACE_RCSID (DynamicAny,
+ DynEnum_i,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_DynEnum_i::TAO_DynEnum_i (void)
+{
+}
+
+TAO_DynEnum_i::~TAO_DynEnum_i (void)
+{
+}
+
+void
+TAO_DynEnum_i::init_common (void)
+{
+ this->ref_to_component_ = 0;
+ this->container_is_destroying_ = 0;
+ this->has_components_ = 0;
+ this->destroyed_ = 0;
+ this->current_position_ = -1;
+ this->component_count_ = 0;
+}
+
+void
+TAO_DynEnum_i::init (const CORBA::Any &any
+ ACE_ENV_ARG_DECL)
+{
+ CORBA::TypeCode_var tc = any.type ();
+
+ CORBA::TCKind kind =
+ TAO_DynAnyFactory::unalias (tc.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (kind != CORBA::tk_enum)
+ {
+ ACE_THROW (DynamicAny::DynAnyFactory::InconsistentTypeCode ());
+ }
+
+ this->type_ = tc;
+
+ TAO::Any_Impl *impl = any.impl ();
+
+ if (impl->encoded ())
+ {
+ TAO::Unknown_IDL_Type *unk =
+ dynamic_cast<TAO::Unknown_IDL_Type *> (impl);
+
+ // We don't want unk's rd_ptr to move, in case we are shared by
+ // another Any, so we use this to copy the state, not the buffer.
+ TAO_InputCDR for_reading (unk->_tao_get_cdr ());
+ for_reading.read_ulong (this->value_);
+ }
+ else
+ {
+ TAO_OutputCDR out;
+ impl->marshal_value (out);
+ TAO_InputCDR in (out);
+ in.read_ulong (this->value_);
+ }
+
+ this->init_common ();
+}
+
+void
+TAO_DynEnum_i::init (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL)
+{
+ CORBA::TCKind kind = TAO_DynAnyFactory::unalias (tc
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (kind != CORBA::tk_enum)
+ {
+ ACE_THROW (DynamicAny::DynAnyFactory::InconsistentTypeCode ());
+ }
+
+ this->type_ = CORBA::TypeCode::_duplicate (tc);
+
+ this->value_ = 0;
+
+ this->init_common ();
+}
+
+// ****************************************************************
+
+TAO_DynEnum_i *
+TAO_DynEnum_i::_narrow (CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED)
+{
+ if (CORBA::is_nil (_tao_objref))
+ {
+ return 0;
+ }
+
+ return dynamic_cast<TAO_DynEnum_i *> (_tao_objref);
+}
+
+// ****************************************************************
+
+char *
+TAO_DynEnum_i::get_as_string (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ const char *retval =
+ this->type_.in ()->member_name (this->value_
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ return CORBA::string_dup (retval);
+}
+
+void
+TAO_DynEnum_i::set_as_string (const char *value_as_string
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::InvalidValue
+ ))
+{
+ CORBA::ULong count =
+ this->type_.in ()->member_count (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ CORBA::ULong i;
+ const char *temp = 0;
+
+ for (i = 0; i < count; ++i)
+ {
+ temp = this->type_.in ()->member_name (i
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (!ACE_OS::strcmp (value_as_string,
+ temp))
+ {
+ break;
+ }
+ }
+
+ if (i < count)
+ {
+ this->value_ = i;
+ }
+ else
+ {
+ ACE_THROW (DynamicAny::DynAny::InvalidValue ());
+ }
+}
+
+CORBA::ULong
+TAO_DynEnum_i::get_as_ulong (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ return this->value_;
+}
+
+void
+TAO_DynEnum_i::set_as_ulong (CORBA::ULong value_as_ulong
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::InvalidValue
+ ))
+{
+ CORBA::ULong max =
+ this->type_.in ()->member_count (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (value_as_ulong < max)
+ {
+ this->value_ = value_as_ulong;
+ }
+ else
+ {
+ ACE_THROW (DynamicAny::DynAny::InvalidValue ());
+ }
+}
+
+// ****************************************************************
+
+void
+TAO_DynEnum_i::from_any (const CORBA::Any& any
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ))
+{
+ CORBA::TypeCode_var tc = any.type ();
+ CORBA::TCKind kind = TAO_DynAnyFactory::unalias (tc.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (kind == CORBA::tk_enum)
+ {
+ // Get the CDR stream of the Any, if there isn't one, make one.
+ TAO::Any_Impl *impl = any.impl ();
+
+ if (impl->encoded ())
+ {
+ TAO::Unknown_IDL_Type *unk =
+ dynamic_cast<TAO::Unknown_IDL_Type *> (impl);
+
+ // We don't want unk's rd_ptr to move, in case we are shared by
+ // another Any, so we use this to copy the state, not the buffer.
+ TAO_InputCDR for_reading (unk->_tao_get_cdr ());
+ for_reading.read_ulong (this->value_);
+ }
+ else
+ {
+ TAO_OutputCDR out;
+ impl->marshal_value (out);
+ TAO_InputCDR in (out);
+ in.read_ulong (this->value_);
+ }
+ }
+ else
+ {
+ ACE_THROW (DynamicAny::DynAny::TypeMismatch ());
+ }
+}
+
+CORBA::Any_ptr
+TAO_DynEnum_i::to_any (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ TAO_OutputCDR out_cdr;
+
+ out_cdr.write_ulong (this->value_);
+
+ CORBA::Any *retval;
+ ACE_NEW_THROW_EX (retval,
+ CORBA::Any,
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (0);
+
+ TAO_InputCDR in_cdr (out_cdr);
+ TAO::Unknown_IDL_Type *unk = 0;
+ ACE_NEW_THROW_EX (unk,
+ TAO::Unknown_IDL_Type (this->type_.in (),
+ in_cdr),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (0);
+
+ retval->replace (unk);
+ return retval;
+}
+
+CORBA::Boolean
+TAO_DynEnum_i::equal (DynamicAny::DynAny_ptr rhs
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ CORBA::TypeCode_var tc = rhs->type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ CORBA::Boolean equivalent = tc->equivalent (this->type_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ if (!equivalent)
+ {
+ return 0;
+ }
+
+ CORBA::Any_var any = rhs->to_any (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ TAO::Any_Impl *impl = any->impl ();
+ CORBA::ULong value;
+
+ if (impl->encoded ())
+ {
+ TAO::Unknown_IDL_Type *unk =
+ dynamic_cast<TAO::Unknown_IDL_Type *> (impl);
+
+ // We don't want unk's rd_ptr to move, in case we are shared by
+ // another Any, so we use this to copy the state, not the buffer.
+ TAO_InputCDR for_reading (unk->_tao_get_cdr ());
+ for_reading.read_ulong (value);
+ }
+ else
+ {
+ TAO_OutputCDR out;
+ impl->marshal_value (out);
+ TAO_InputCDR in (out);
+ in.read_ulong (value);
+ }
+
+ return value == this->value_;
+}
+
+void
+TAO_DynEnum_i::destroy (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW (CORBA::OBJECT_NOT_EXIST ());
+ }
+
+ if (!this->ref_to_component_ || this->container_is_destroying_)
+ {
+ this->destroyed_ = 1;
+ }
+}
+
+DynamicAny::DynAny_ptr
+TAO_DynEnum_i::current_component (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (),
+ DynamicAny::DynAny::_nil ());
+ }
+
+ ACE_THROW_RETURN (DynamicAny::DynAny::TypeMismatch (),
+ DynamicAny::DynAny::_nil ());
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/DynamicAny/DynEnum_i.h b/TAO/tao/DynamicAny/DynEnum_i.h
new file mode 100644
index 00000000000..6732653721e
--- /dev/null
+++ b/TAO/tao/DynamicAny/DynEnum_i.h
@@ -0,0 +1,163 @@
+// -*- C++ -*-
+
+// $Id$
+
+//=============================================================================
+/**
+ * @file DynEnum_i.h
+ *
+ * $Id$
+ *
+ * @author Jeff Parsons <parsons@cs.wustl.edu>
+ */
+//=============================================================================
+
+
+#ifndef TAO_DYNENUM_I_H
+#define TAO_DYNENUM_I_H
+#include /**/ "ace/pre.h"
+
+#include "tao/DynamicAny/DynamicAny.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/DynamicAny/DynCommon.h"
+#include "tao/LocalObject.h"
+#include "ace/Containers.h"
+
+#if defined (_MSC_VER)
+# pragma warning(push)
+# pragma warning (disable:4250)
+#endif /* _MSC_VER */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_DynEnum_i
+ *
+ * Implementation of Dynamic Any type for enums
+ */
+class TAO_DynamicAny_Export TAO_DynEnum_i
+ : public virtual DynamicAny::DynEnum,
+ public virtual TAO_DynCommon,
+ public virtual TAO_Local_RefCounted_Object
+{
+public:
+ /// Constructor.
+ TAO_DynEnum_i (void);
+
+ /// Destructor.
+ ~TAO_DynEnum_i (void);
+
+ /// Initialize using just a TypeCode.
+ void init (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL);
+
+ /// Initialize using an Any.
+ void init (const CORBA::Any& any
+ ACE_ENV_ARG_DECL);
+
+ // = LocalObject methods.
+ static TAO_DynEnum_i *_narrow (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ // = Functions specific to DynEnum.
+
+ virtual char * get_as_string (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ virtual void set_as_string (
+ const char * value
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::InvalidValue
+ ));
+
+ virtual CORBA::ULong get_as_ulong (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ virtual void set_as_ulong (
+ CORBA::ULong value
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::InvalidValue
+ ));
+
+ // = DynAny common functions not implemented in class TAO_DynCommon.
+
+ virtual void from_any (
+ const CORBA::Any & value
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ));
+
+ virtual CORBA::Any * to_any (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ virtual CORBA::Boolean equal (
+ DynamicAny::DynAny_ptr dyn_any
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ virtual void destroy (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ virtual DynamicAny::DynAny_ptr current_component (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch
+ ));
+
+private:
+ // Called by both versions of init().
+ void init_common (void);
+
+ // = Use copy() or assign() instead of these.
+ TAO_DynEnum_i (const TAO_DynEnum_i &src);
+ TAO_DynEnum_i &operator= (const TAO_DynEnum_i &src);
+
+private:
+ /// Current numeric value of the enum.
+ CORBA::ULong value_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined(_MSC_VER)
+# pragma warning(pop)
+#endif /* _MSC_VER */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_DYNENUM_I_H */
diff --git a/TAO/tao/DynamicAny/DynSequence_i.cpp b/TAO/tao/DynamicAny/DynSequence_i.cpp
new file mode 100644
index 00000000000..40422885eae
--- /dev/null
+++ b/TAO/tao/DynamicAny/DynSequence_i.cpp
@@ -0,0 +1,834 @@
+// $Id$
+
+#include "tao/AnyTypeCode/Marshal.h"
+#include "tao/AnyTypeCode/Any_Unknown_IDL_Type.h"
+#include "tao/AnyTypeCode/AnyTypeCode_methods.h"
+#include "tao/DynamicAny/DynSequence_i.h"
+#include "tao/DynamicAny/DynAnyFactory.h"
+#include "tao/CDR.h"
+
+ACE_RCSID (DynamicAny,
+ DynSequence_i,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_DynSequence_i::TAO_DynSequence_i (void)
+{
+}
+
+TAO_DynSequence_i::~TAO_DynSequence_i (void)
+{
+}
+
+void
+TAO_DynSequence_i::init_common (void)
+{
+ this->ref_to_component_ = 0;
+ this->container_is_destroying_ = 0;
+ this->has_components_ = 1;
+ this->destroyed_ = 0;
+ this->current_position_ = -1;
+ this->component_count_ = static_cast<CORBA::ULong> (this->da_members_.size ());
+}
+
+void
+TAO_DynSequence_i::init (const CORBA::Any& any
+ ACE_ENV_ARG_DECL)
+{
+ CORBA::TypeCode_var tc = any.type ();
+
+ CORBA::TCKind kind =
+ TAO_DynAnyFactory::unalias (tc.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (kind != CORBA::tk_sequence)
+ {
+ ACE_THROW (DynamicAny::DynAnyFactory::InconsistentTypeCode ());
+ }
+
+ this->type_ = tc;
+
+ // Get the CDR stream of the Any, if there isn't one, make one.
+ TAO::Any_Impl *impl = any.impl ();
+ CORBA::ULong length;
+ TAO_OutputCDR out;
+ TAO_InputCDR cdr (static_cast<ACE_Message_Block *> (0));
+
+ if (impl->encoded ())
+ {
+ TAO::Unknown_IDL_Type *unk =
+ dynamic_cast<TAO::Unknown_IDL_Type *> (impl);
+
+ cdr = unk->_tao_get_cdr ();
+ }
+ else
+ {
+ impl->marshal_value (out);
+ TAO_InputCDR tmp_in (out);
+ cdr = tmp_in;
+ }
+
+ // If the any is a sequence, first 4 bytes of cdr hold the
+ // length.
+ cdr.read_ulong (length);
+
+ // Resize the array.
+ this->da_members_.size (length);
+
+ this->init_common ();
+
+ // Get the type of the sequence elments.
+ CORBA::TypeCode_var field_tc =
+ this->get_element_type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ for (CORBA::ULong i = 0; i < length; ++i)
+ {
+ CORBA::Any field_any;
+ TAO_InputCDR unk_in (cdr);
+ TAO::Unknown_IDL_Type *field_unk = 0;
+ ACE_NEW (field_unk,
+ TAO::Unknown_IDL_Type (field_tc.in (),
+ unk_in));
+ field_any.replace (field_unk);
+
+ // This recursive step will call the correct constructor
+ // based on the type of field_any.
+ this->da_members_[i] =
+ TAO_DynAnyFactory::make_dyn_any (field_any
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Move to the next field in the CDR stream.
+ (void) TAO_Marshal_Object::perform_skip (field_tc.in (),
+ &cdr
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+}
+
+void
+TAO_DynSequence_i::init (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL)
+{
+ CORBA::TCKind kind = TAO_DynAnyFactory::unalias (tc
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (kind != CORBA::tk_sequence)
+ {
+ ACE_THROW (DynamicAny::DynAnyFactory::InconsistentTypeCode ());
+ }
+
+ // Empty sequence.
+ this->da_members_.size (0);
+
+ this->init_common ();
+
+ this->type_ = CORBA::TypeCode::_duplicate (tc);
+}
+
+// ****************************************************************
+
+TAO_DynSequence_i *
+TAO_DynSequence_i::_narrow (CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED)
+{
+ if (CORBA::is_nil (_tao_objref))
+ {
+ return 0;
+ }
+
+ return dynamic_cast<TAO_DynSequence_i *> (_tao_objref);
+}
+
+// ****************************************************************
+
+CORBA::TypeCode_ptr
+TAO_DynSequence_i::get_element_type (ACE_ENV_SINGLE_ARG_DECL)
+{
+ CORBA::TypeCode_var element_type =
+ CORBA::TypeCode::_duplicate (this->type_.in ());
+
+ // Strip away aliases (if any) on top of the outer type.
+ CORBA::TCKind kind = element_type->kind (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::TypeCode::_nil ());
+
+ while (kind != CORBA::tk_sequence)
+ {
+ element_type = element_type->content_type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::TypeCode::_nil ());
+
+ kind = element_type->kind (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::TypeCode::_nil ());
+ }
+
+ // Return the content type.
+ CORBA::TypeCode_ptr retval =
+ element_type->content_type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::TypeCode::_nil ());
+
+ return retval;
+}
+
+// = Functions specific to DynSequence.
+
+CORBA::ULong
+TAO_DynSequence_i::get_length (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (),
+ 0);
+ }
+
+ return this->component_count_;
+}
+
+void
+TAO_DynSequence_i::set_length (CORBA::ULong length
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::InvalidValue
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW (CORBA::OBJECT_NOT_EXIST ());
+ }
+
+ // CORBA::TypeCode::length() does not accept aliased type codes.
+ CORBA::TypeCode_var stripped_tc =
+ TAO_DynAnyFactory::strip_alias (this->type_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ CORBA::ULong bound = stripped_tc->length (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (bound > 0 && length > bound)
+ {
+ ACE_THROW (DynamicAny::DynAny::InvalidValue ());
+ }
+
+ // CORBA 2.3.1 has several explicit rules about resetting the
+ // current position, depending on the current value of the
+ // current position, the current size, and the new length.
+ if (length == 0)
+ {
+ this->current_position_ = -1;
+ }
+ else if (length > this->component_count_)
+ {
+ if (this->current_position_ == -1)
+ {
+ // Set it to the first new slot.
+ this->current_position_ = static_cast<CORBA::Long> (this->component_count_);
+ }
+ }
+ else if (length < this->component_count_)
+ {
+ // If the current position will no longer exist..
+ if (this->current_position_ >= static_cast<CORBA::Long> (length))
+ {
+ this->current_position_ = -1;
+ }
+ }
+
+ if (length > this->component_count_)
+ {
+ // Grow array first, then initialize new members.
+ this->da_members_.size (length);
+
+ CORBA::TypeCode_var elemtype =
+ stripped_tc->content_type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ for (CORBA::ULong i = this->component_count_; i < length; ++i)
+ {
+ this->da_members_[i] =
+ TAO_DynAnyFactory::make_dyn_any (elemtype.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ }
+ else if (length < this->component_count_)
+ {
+ // Destroy any dangling members first, then shrink array.
+ for (CORBA::ULong j = length; j < this->component_count_; ++j)
+ {
+ this->da_members_[j]->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ this->da_members_.size (length);
+ }
+
+ // Now we can update component_count_.
+ this->component_count_ = length;
+}
+
+DynamicAny::AnySeq *
+TAO_DynSequence_i::get_elements (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (),
+ 0);
+ }
+
+ CORBA::ULong length = static_cast<CORBA::ULong> (this->da_members_.size ());
+
+ DynamicAny::AnySeq *elements;
+ ACE_NEW_THROW_EX (elements,
+ DynamicAny::AnySeq (length),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (0);
+
+ elements->length (length);
+ DynamicAny::AnySeq_var safe_retval = elements;
+
+ // Initialize each Any.
+ for (CORBA::ULong i = 0; i < length; ++i)
+ {
+ CORBA::Any_var tmp =
+ this->da_members_[i]->to_any (ACE_ENV_SINGLE_ARG_PARAMETER);
+
+ ACE_CHECK_RETURN (0);
+
+ safe_retval[i] = tmp.in ();
+ }
+
+ return safe_retval._retn ();
+}
+
+void
+TAO_DynSequence_i::set_elements (const DynamicAny::AnySeq & value
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW (CORBA::OBJECT_NOT_EXIST ());
+ }
+
+ CORBA::TypeCode_var stripped_tc =
+ TAO_DynAnyFactory::strip_alias (this->type_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ CORBA::ULong length = value.length ();
+ CORBA::ULong bound = stripped_tc->length (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (bound > 0 && length > bound)
+ {
+ ACE_THROW (DynamicAny::DynAny::InvalidValue ());
+ }
+
+ // CORBA 2.4.2.
+ if (length == 0)
+ {
+ this->current_position_ = -1;
+ }
+ else
+ {
+ this->current_position_ = 0;
+ }
+
+ // If the array grows, we must do it now.
+ if (length > this->component_count_)
+ {
+ this->da_members_.size (length);
+ }
+
+ CORBA::TypeCode_var element_type =
+ this->get_element_type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ CORBA::TypeCode_var value_tc;
+
+ for (CORBA::ULong i = 0; i < length; ++i)
+ {
+ // Check each arg element for type match.
+ value_tc = value[i].type ();
+ CORBA::Boolean equivalent =
+ value_tc->equivalent (element_type.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (equivalent)
+ {
+ // Destroy any existing members.
+ if (i < this->component_count_)
+ {
+ this->da_members_[i]->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ this->da_members_[i] =
+ TAO_DynAnyFactory::make_dyn_any (value[i]
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else
+ {
+ ACE_THROW (DynamicAny::DynAny::TypeMismatch ());
+ }
+ }
+
+ // Destroy any dangling members.
+ for (CORBA::ULong j = length; j < this->component_count_; ++j)
+ {
+ this->da_members_[j]->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ // If the array shrinks, we must wait until now to do it.
+ if (length < this->component_count_)
+ {
+ this->da_members_.size (length);
+ }
+
+ // Now we can update component_count_.
+ this->component_count_ = length;
+}
+
+DynamicAny::DynAnySeq *
+TAO_DynSequence_i::get_elements_as_dyn_any (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (),
+ 0);
+ }
+
+ DynamicAny::DynAnySeq *retval = 0;
+ ACE_NEW_THROW_EX (retval,
+ DynamicAny::DynAnySeq (this->component_count_),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (0);
+
+ retval->length (this->component_count_);
+ DynamicAny::DynAnySeq_var safe_retval (retval);
+
+ for (CORBA::ULong i = 0; i < this->component_count_; ++i)
+ {
+ // A deep copy is made only by copy() (CORBA 2.4.2 section 9.2.3.6).
+ // Set the flag so the caller can't destroy.
+ this->set_flag (this->da_members_[i].in (),
+ 0
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ safe_retval[i] =
+ DynamicAny::DynAny::_duplicate (this->da_members_[i].in ());
+ ACE_CHECK_RETURN (0);
+ }
+
+ return safe_retval._retn ();
+}
+
+void
+TAO_DynSequence_i::set_elements_as_dyn_any (
+ const DynamicAny::DynAnySeq & values
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW (CORBA::OBJECT_NOT_EXIST ());
+ }
+
+ CORBA::TypeCode_var stripped_tc =
+ TAO_DynAnyFactory::strip_alias (this->type_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ CORBA::ULong length = values.length ();
+ CORBA::ULong bound = stripped_tc->length (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (bound > 0 && length > bound)
+ {
+ ACE_THROW (DynamicAny::DynAny::InvalidValue ());
+ }
+
+ // If the array grows, we must do it now.
+ if (length > this->component_count_)
+ {
+ this->da_members_.size (length);
+ }
+
+ CORBA::TypeCode_var element_type =
+ this->get_element_type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ CORBA::TypeCode_var val_type;
+ CORBA::Boolean equivalent;
+
+ for (CORBA::ULong i = 0; i < length; ++i)
+ {
+ val_type = values[i]->type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ equivalent = val_type->equivalent (element_type.in ()
+ ACE_ENV_ARG_PARAMETER);
+
+ ACE_CHECK;
+
+ if (equivalent)
+ {
+ // Destroy any existing members.
+ if (i < this->component_count_)
+ {
+ this->da_members_[i]->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ this->da_members_[i] =
+ values[i]->copy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else
+ {
+ ACE_THROW (DynamicAny::DynAny::TypeMismatch ());
+ }
+ }
+
+ // Destroy any dangling members.
+ for (CORBA::ULong j = length; j < this->component_count_; ++j)
+ {
+ this->da_members_[j]->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ // If the array shrinks, we must wait until now to do it.
+ if (length < this->component_count_)
+ {
+ this->da_members_.size (length);
+ }
+
+ // Now we can update component_count_.
+ this->component_count_ = length;
+}
+
+// ****************************************************************
+
+void
+TAO_DynSequence_i::from_any (const CORBA::Any & any
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW (CORBA::OBJECT_NOT_EXIST ());
+ }
+
+ CORBA::TypeCode_var tc = any.type ();
+ CORBA::Boolean equivalent =
+ this->type_.in ()->equivalent (tc.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (equivalent)
+ {
+ // Get the CDR stream of the Any, if there isn't one, make one.
+ TAO::Any_Impl *impl = any.impl ();
+ TAO_OutputCDR out;
+ TAO_InputCDR cdr (static_cast<ACE_Message_Block *> (0));
+
+ if (impl->encoded ())
+ {
+ TAO::Unknown_IDL_Type *unk =
+ dynamic_cast<TAO::Unknown_IDL_Type *> (impl);
+
+ cdr = unk->_tao_get_cdr ();
+ }
+ else
+ {
+ impl->marshal_value (out);
+ TAO_InputCDR tmp_in (out);
+ cdr = tmp_in;
+ }
+
+
+ CORBA::ULong arg_length;
+
+ // If the any is a sequence, first 4 bytes of cdr hold the
+ // length.
+ cdr.read_ulong (arg_length);
+
+ // If the array grows, we must do it now.
+ if (arg_length > this->component_count_)
+ {
+ this->da_members_.size (arg_length);
+ }
+
+ CORBA::TypeCode_var field_tc =
+ this->get_element_type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ for (CORBA::ULong i = 0; i < arg_length; ++i)
+ {
+ CORBA::Any field_any;
+ TAO_InputCDR unk_in (cdr);
+ TAO::Unknown_IDL_Type *field_unk = 0;
+ ACE_NEW (field_unk,
+ TAO::Unknown_IDL_Type (field_tc.in (),
+ unk_in));
+ field_any.replace (field_unk);
+
+ if (i < this->component_count_)
+ {
+ this->da_members_[i]->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ this->da_members_[i] =
+ TAO_DynAnyFactory::make_dyn_any (field_any
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Move to the next field in the CDR stream.
+ (void) TAO_Marshal_Object::perform_skip (field_tc.in (),
+ &cdr
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ // Destroy any dangling members.
+ for (CORBA::ULong j = arg_length; j < this->component_count_; ++j)
+ {
+ this->da_members_[j]->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ // If the array shrinks, we must wait until now to do it.
+ if (arg_length < this->component_count_)
+ {
+ this->da_members_.size (arg_length);
+ }
+
+ // Now we can update component_count_.
+ this->component_count_ = arg_length;
+
+ this->current_position_ = arg_length ? 0 : -1;
+ }
+ else
+ {
+ ACE_THROW (DynamicAny::DynAny::TypeMismatch ());
+ }
+}
+
+CORBA::Any_ptr
+TAO_DynSequence_i::to_any (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (),
+ 0);
+ }
+
+ TAO_OutputCDR out_cdr;
+ out_cdr.write_ulong (this->component_count_);
+
+ CORBA::TypeCode_var field_tc =
+ this->get_element_type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ for (CORBA::ULong i = 0; i < this->component_count_; ++i)
+ {
+ // Recursive step
+ CORBA::Any_var field_any =
+ this->da_members_[i]->to_any (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ TAO::Any_Impl *field_impl = field_any->impl ();
+ TAO_OutputCDR field_out;
+ TAO_InputCDR field_cdr (static_cast<ACE_Message_Block *> (0));
+
+ if (field_impl->encoded ())
+ {
+ TAO::Unknown_IDL_Type *field_unk =
+ dynamic_cast<TAO::Unknown_IDL_Type *> (field_impl);
+
+ field_cdr = field_unk->_tao_get_cdr ();
+ }
+ else
+ {
+ field_impl->marshal_value (field_out);
+ TAO_InputCDR tmp_in (field_out);
+ field_cdr = tmp_in;
+ }
+
+ (void) TAO_Marshal_Object::perform_append (field_tc.in (),
+ &field_cdr,
+ &out_cdr
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+ }
+
+ TAO_InputCDR in_cdr (out_cdr);
+
+ CORBA::Any_ptr retval = 0;
+ ACE_NEW_THROW_EX (retval,
+ CORBA::Any,
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (0);
+
+ TAO::Unknown_IDL_Type *unk = 0;
+ ACE_NEW_THROW_EX (unk,
+ TAO::Unknown_IDL_Type (this->type_.in (),
+ in_cdr),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (0);
+
+ retval->replace (unk);
+ return retval;
+}
+
+CORBA::Boolean
+TAO_DynSequence_i::equal (DynamicAny::DynAny_ptr rhs
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (),
+ 0);
+ }
+
+ CORBA::TypeCode_var tc = rhs->type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ CORBA::Boolean equivalent = tc->equivalent (this->type_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ if (!equivalent)
+ {
+ return 0;
+ }
+
+ if (rhs->component_count () != this->component_count_)
+ {
+ return 0;
+ }
+
+ DynamicAny::DynAny_var tmp;
+ CORBA::Boolean member_equal;
+
+ for (CORBA::ULong i = 0; i < this->component_count_; ++i)
+ {
+ rhs->seek (static_cast<CORBA::Long> (i)
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ tmp = rhs->current_component (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ // Recursive step.
+ member_equal = tmp->equal (this->da_members_[i].in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ if (!member_equal)
+ {
+ return 0;
+ }
+ }
+
+ return 1;
+}
+
+void
+TAO_DynSequence_i::destroy (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW (CORBA::OBJECT_NOT_EXIST ());
+ }
+
+ if (!this->ref_to_component_ || this->container_is_destroying_)
+ {
+ // Do a deep destroy.
+ for (CORBA::ULong i = 0; i < this->component_count_; ++i)
+ {
+ this->set_flag (da_members_[i].in (),
+ 1
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->da_members_[i]->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ this->destroyed_ = 1;
+ }
+}
+
+DynamicAny::DynAny_ptr
+TAO_DynSequence_i::current_component (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (),
+ DynamicAny::DynAny::_nil ());
+ }
+
+ if (this->current_position_ == -1)
+ {
+ return DynamicAny::DynAny::_nil ();
+ }
+
+ CORBA::ULong index = static_cast<CORBA::ULong> (this->current_position_);
+
+ this->set_flag (this->da_members_[index].in (),
+ 0
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (DynamicAny::DynAny::_nil ());
+
+ return DynamicAny::DynAny::_duplicate (
+ this->da_members_[index].in ()
+ );
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/DynamicAny/DynSequence_i.h b/TAO/tao/DynamicAny/DynSequence_i.h
new file mode 100644
index 00000000000..e9763e95e5f
--- /dev/null
+++ b/TAO/tao/DynamicAny/DynSequence_i.h
@@ -0,0 +1,185 @@
+// -*- C++ -*-
+//
+// $Id$
+
+//=============================================================================
+/**
+ * @file DynSequence_i.h
+ *
+ * $Id$
+ *
+ * @author Jeff Parsons <parsons@cs.wustl.edu>
+ */
+//=============================================================================
+
+
+#ifndef TAO_DYNSEQUENCE_I_H
+#define TAO_DYNSEQUENCE_I_H
+#include /**/ "ace/pre.h"
+
+#include "tao/DynamicAny/DynamicAny.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/DynamicAny/DynCommon.h"
+#include "tao/LocalObject.h"
+#include "ace/Containers.h"
+
+#if defined (_MSC_VER)
+# pragma warning(push)
+# pragma warning (disable:4250)
+#endif /* _MSC_VER */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_DynSequence_i
+ *
+ * Implementation of Dynamic Any type for Sequences.
+ */
+class TAO_DynamicAny_Export TAO_DynSequence_i
+ : public virtual DynamicAny::DynSequence,
+ public virtual TAO_DynCommon,
+ public virtual TAO_Local_RefCounted_Object
+{
+public:
+ /// Constructor.
+ TAO_DynSequence_i (void);
+
+ /// Destructor.
+ ~TAO_DynSequence_i (void);
+
+ /// Initialize using just a TypeCode.
+ void init (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL);
+
+ /// Initialize using an Any.
+ void init (const CORBA::Any& any
+ ACE_ENV_ARG_DECL);
+
+ // = LocalObject methods.
+ static TAO_DynSequence_i *_narrow (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ // = Functions specific to DynSequence.
+
+ virtual CORBA::ULong get_length (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ virtual void set_length (
+ CORBA::ULong len
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::InvalidValue
+ ));
+
+ virtual DynamicAny::AnySeq * get_elements (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ virtual void set_elements (
+ const DynamicAny::AnySeq & value
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ));
+
+ virtual DynamicAny::DynAnySeq * get_elements_as_dyn_any (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ virtual void set_elements_as_dyn_any (
+ const DynamicAny::DynAnySeq & value
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ));
+
+
+ // = DynAny common functions not implemented in class TAO_DynCommon.
+
+ virtual void from_any (
+ const CORBA::Any & value
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ));
+
+ virtual CORBA::Any * to_any (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ virtual CORBA::Boolean equal (
+ DynamicAny::DynAny_ptr dyn_any
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ virtual void destroy (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ virtual DynamicAny::DynAny_ptr current_component (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch
+ ));
+
+private:
+ // Utility, turns the type of elements contained in the sequence.
+ CORBA::TypeCode_ptr get_element_type (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS);
+
+ // Called by both versions of init().
+ void init_common (void);
+
+ // = Use copy() or assign() instead of these
+ TAO_DynSequence_i (const TAO_DynSequence_i &src);
+ TAO_DynSequence_i &operator= (const TAO_DynSequence_i &src);
+
+private:
+ /// Each component is also a DynAny.
+ ACE_Array_Base<DynamicAny::DynAny_var> da_members_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined(_MSC_VER)
+# pragma warning(pop)
+#endif /* _MSC_VER */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_DYNSEQUENCE_I_H */
diff --git a/TAO/tao/DynamicAny/DynStruct_i.cpp b/TAO/tao/DynamicAny/DynStruct_i.cpp
new file mode 100644
index 00000000000..ec32782d851
--- /dev/null
+++ b/TAO/tao/DynamicAny/DynStruct_i.cpp
@@ -0,0 +1,825 @@
+// $Id$
+
+#include "tao/AnyTypeCode/Marshal.h"
+#include "tao/AnyTypeCode/Any_Unknown_IDL_Type.h"
+#include "tao/AnyTypeCode/AnyTypeCode_methods.h"
+#include "tao/DynamicAny/DynStruct_i.h"
+#include "tao/DynamicAny/DynAnyFactory.h"
+#include "tao/CDR.h"
+
+ACE_RCSID (DynamicAny,
+ DynStruct_i,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_DynStruct_i::TAO_DynStruct_i (void)
+{
+}
+
+TAO_DynStruct_i::~TAO_DynStruct_i (void)
+{
+}
+
+void
+TAO_DynStruct_i::check_typecode (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL)
+{
+ CORBA::TCKind kind = TAO_DynAnyFactory::unalias (tc
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (kind == CORBA::tk_struct || kind == CORBA::tk_except)
+ {
+ return;
+ }
+
+ ACE_THROW (DynamicAny::DynAnyFactory::InconsistentTypeCode ());
+}
+
+void
+TAO_DynStruct_i::init_common (void)
+{
+ this->ref_to_component_ = 0;
+ this->container_is_destroying_ = 0;
+ this->has_components_ = 1;
+ this->destroyed_ = 0;
+ this->component_count_ = static_cast <CORBA::ULong> (this->da_members_.size ());
+ this->current_position_ = this->component_count_ ? 0 : -1;
+}
+
+void
+TAO_DynStruct_i::init (const CORBA::Any& any
+ ACE_ENV_ARG_DECL)
+{
+ CORBA::TypeCode_ptr tc = any._tao_get_typecode ();
+ this->check_typecode (tc
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->type_ = CORBA::TypeCode::_duplicate (tc);
+
+ this->set_from_any (any
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+
+// This code is common to from_any() and the init() overload that takes
+// an Any argument.
+void
+TAO_DynStruct_i::set_from_any (const CORBA::Any & any
+ ACE_ENV_ARG_DECL)
+{
+ // member_type() does not work with aliased type codes.
+ CORBA::TypeCode_var unaliased_tc =
+ TAO_DynAnyFactory::strip_alias (any._tao_get_typecode ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ CORBA::ULong numfields =
+ unaliased_tc->member_count (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Resize the array.
+ this->da_members_.size (numfields);
+
+ this->init_common ();
+
+ // Get the CDR stream of the Any, if there isn't one, make one.
+ TAO::Any_Impl *impl = any.impl ();
+ TAO_OutputCDR out;
+ TAO_InputCDR in (static_cast<ACE_Message_Block *> (0));
+ TAO::Unknown_IDL_Type *unk = 0;
+
+ if (impl->encoded ())
+ {
+ unk = dynamic_cast<TAO::Unknown_IDL_Type *> (impl);
+
+ in = unk->_tao_get_cdr ();
+ }
+ else
+ {
+ impl->marshal_value (out);
+ TAO_InputCDR tmp_in (out);
+ in = tmp_in;
+ }
+
+ // If we have an exception type, unmarshal the repository ID.
+ CORBA::TCKind kind = TAO_DynAnyFactory::unalias (any._tao_get_typecode ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (kind == CORBA::tk_except)
+ {
+ CORBA::String_var str;
+ in >> str.out ();
+ }
+
+ for (CORBA::ULong i = 0; i < numfields; i++)
+ {
+ CORBA::TypeCode_var field_tc =
+ unaliased_tc->member_type (i
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ CORBA::Any field_any;
+ TAO_InputCDR unk_in (in);
+ ACE_NEW (unk,
+ TAO::Unknown_IDL_Type (field_tc.in (),
+ unk_in));
+ field_any.replace (unk);
+
+ // This recursive step will call the correct constructor
+ // based on the type of field_any.
+ this->da_members_[i] =
+ TAO_DynAnyFactory::make_dyn_any (field_any
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Move to the next field in the CDR stream.
+ (void) TAO_Marshal_Object::perform_skip (field_tc.in (),
+ &in
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+}
+
+void
+TAO_DynStruct_i::init (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL)
+{
+ this->check_typecode (tc
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->type_ = CORBA::TypeCode::_duplicate (tc);
+
+ // member_type() does not work with aliased type codes.
+ CORBA::TypeCode_var unaliased_tc =
+ TAO_DynAnyFactory::strip_alias (this->type_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->component_count_ =
+ unaliased_tc->member_count (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Resize the array.
+ this->da_members_.size (this->component_count_);
+
+ this->init_common ();
+
+ CORBA::TypeCode_var mtype;
+
+ for (CORBA::ULong i = 0; i < this->component_count_; ++i)
+ {
+ mtype = unaliased_tc->member_type (i
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Recursively initialize each member.
+ this->da_members_[i] =
+ TAO_DynAnyFactory::make_dyn_any (mtype.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+}
+
+// ****************************************************************
+
+TAO_DynStruct_i *
+TAO_DynStruct_i::_narrow (CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED)
+{
+ if (CORBA::is_nil (_tao_objref))
+ {
+ return 0;
+ }
+
+ return dynamic_cast<TAO_DynStruct_i *> (_tao_objref);
+}
+
+// ****************************************************************
+
+DynamicAny::FieldName
+TAO_DynStruct_i::current_member_name (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (),
+ 0);
+ }
+
+ // Is this an empty exception?
+ if (this->component_count_ == 0)
+ {
+ ACE_THROW_RETURN (DynamicAny::DynAny::TypeMismatch (),
+ 0);
+ }
+
+ if (this->current_position_ == -1)
+ {
+ ACE_THROW_RETURN (DynamicAny::DynAny::InvalidValue (),
+ 0);
+ }
+
+ // member_name() does not work with aliased type codes.
+ CORBA::TypeCode_var unaliased_tc =
+ TAO_DynAnyFactory::strip_alias (this->type_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+ const char *name =
+ unaliased_tc->member_name (this->current_position_
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ return CORBA::string_dup (name);
+}
+
+// Returns the unaliased TCKind.
+CORBA::TCKind
+TAO_DynStruct_i::current_member_kind (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (),
+ CORBA::tk_null);
+ }
+
+ // Is this an empty exception?
+ if (this->component_count_ == 0)
+ {
+ ACE_THROW_RETURN (DynamicAny::DynAny::TypeMismatch (),
+ CORBA::tk_null);
+ }
+
+ if (this->current_position_ == -1)
+ {
+ ACE_THROW_RETURN (DynamicAny::DynAny::InvalidValue (),
+ CORBA::tk_null);
+ }
+
+ // member_type() does not work with aliased type codes.
+ CORBA::TypeCode_var unaliased_tc =
+ TAO_DynAnyFactory::strip_alias (this->type_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::tk_null);
+ CORBA::TypeCode_var tc =
+ unaliased_tc->member_type (this->current_position_
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::tk_null);
+
+ CORBA::TCKind retval = TAO_DynAnyFactory::unalias (tc.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::tk_null);
+
+ return retval;
+}
+
+DynamicAny::NameValuePairSeq *
+TAO_DynStruct_i::get_members (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (),
+ 0);
+ }
+
+ DynamicAny::NameValuePairSeq* members;
+ ACE_NEW_THROW_EX (members,
+ DynamicAny::NameValuePairSeq (this->component_count_),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (0);
+
+ // We must do this explicitly.
+ members->length (this->component_count_);
+
+ DynamicAny::NameValuePairSeq_var safe_retval = members;
+ CORBA::Any_var temp;
+ CORBA::TypeCode_var unaliased_tc;
+
+ CORBA::TCKind const tc_kind =
+ this->type_->kind (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ if (tc_kind == CORBA::tk_alias)
+ {
+ unaliased_tc =
+ TAO_DynAnyFactory::strip_alias (this->type_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+ }
+ else
+ {
+ unaliased_tc = CORBA::TypeCode::_duplicate (this->type_.in ());
+ }
+
+ // Assign name and value to each pearl on the string.
+ for (CORBA::ULong i = 0; i < this->component_count_; ++i)
+ {
+ safe_retval[i].id =
+ CORBA::string_dup (unaliased_tc->member_name (i
+ ACE_ENV_ARG_PARAMETER));
+ ACE_CHECK_RETURN (0);
+
+ temp = this->da_members_[i]->to_any (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ safe_retval[i].value = temp.in ();
+ }
+
+ return safe_retval._retn ();
+}
+
+void
+TAO_DynStruct_i::set_members (const DynamicAny::NameValuePairSeq & values
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW (CORBA::OBJECT_NOT_EXIST ());
+ }
+
+ CORBA::ULong length = values.length ();
+
+ // Check for length match.
+ if (length != this->component_count_)
+ {
+ ACE_THROW (DynamicAny::DynAny::InvalidValue ());
+ }
+
+ CORBA::TypeCode_var value_tc;
+ CORBA::TypeCode_var my_tc;
+ CORBA::Boolean equivalent;
+
+ // member_type() does not work with aliased type codes.
+ CORBA::TypeCode_var unaliased_tc =
+ TAO_DynAnyFactory::strip_alias (this->type_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ for (CORBA::ULong i = 0; i < length; ++i)
+ {
+ // Check for type and name match.
+ my_tc = unaliased_tc->member_type (i
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ value_tc = values[i].value.type ();
+
+ equivalent = my_tc->equivalent (value_tc.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (!equivalent)
+ {
+ ACE_THROW (DynamicAny::DynAny::TypeMismatch ());
+ }
+
+ this->da_members_[i]->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->da_members_[i] =
+ TAO_DynAnyFactory::make_dyn_any (values[i].value
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ this->current_position_ = length ? 0 : -1;
+}
+
+DynamicAny::NameDynAnyPairSeq *
+TAO_DynStruct_i::get_members_as_dyn_any (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (),
+ 0);
+ }
+
+ DynamicAny::NameDynAnyPairSeq * members;
+ ACE_NEW_THROW_EX (members,
+ DynamicAny::NameDynAnyPairSeq (this->component_count_),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (0);
+
+ // We must do this explicitly.
+ members->length (this->component_count_);
+
+ DynamicAny::NameDynAnyPairSeq_var safe_retval = members;
+
+ // member_name() does not work with aliased type codes.
+ CORBA::TypeCode_var unaliased_tc =
+ TAO_DynAnyFactory::strip_alias (this->type_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ // Assign name and value to each pearl on the string.
+ for (CORBA::ULong i = 0; i < this->component_count_; ++i)
+ {
+ safe_retval[i].id =
+ CORBA::string_dup (unaliased_tc->member_name (i
+ ACE_ENV_ARG_PARAMETER));
+ ACE_CHECK_RETURN (0);
+
+ // A deep copy is made only by copy() (CORBA 2.4.2 section 9.2.3.6).
+ // Set the flag so the caller can't destroy.
+ this->set_flag (this->da_members_[i].in (),
+ 0
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ safe_retval[i].value =
+ DynamicAny::DynAny::_duplicate (this->da_members_[i].in ());
+ ACE_CHECK_RETURN (0);
+ }
+
+ return safe_retval._retn ();
+}
+
+void
+TAO_DynStruct_i::set_members_as_dyn_any (
+ const DynamicAny::NameDynAnyPairSeq & values
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW (CORBA::OBJECT_NOT_EXIST ());
+ }
+
+ CORBA::ULong length = values.length ();
+
+ // Check for length match.
+ if (length != this->component_count_)
+ {
+ ACE_THROW (DynamicAny::DynAny::InvalidValue ());
+ }
+
+ CORBA::TypeCode_var value_tc;
+ CORBA::TypeCode_var my_tc;
+ CORBA::Boolean equivalent;
+
+ // member_type() does not work with aliased type codes.
+ CORBA::TypeCode_var unaliased_tc =
+ TAO_DynAnyFactory::strip_alias (this->type_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ for (CORBA::ULong i = 0; i < length; ++i)
+ {
+ // Check for type and name match.
+ my_tc = unaliased_tc->member_type (i
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ value_tc = values[i].value->type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ equivalent = my_tc->equivalent (value_tc.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (!equivalent)
+ {
+ ACE_THROW (DynamicAny::DynAny::TypeMismatch ());
+ }
+
+ this->da_members_[i]->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->da_members_[i] =
+ values[i].value->copy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ this->current_position_ = length ? 0 : -1;
+}
+
+// ****************************************************************
+
+void
+TAO_DynStruct_i::from_any (const CORBA::Any & any
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW (CORBA::OBJECT_NOT_EXIST ());
+ }
+
+ CORBA::TypeCode_var tc = any.type ();
+ CORBA::Boolean equivalent =
+ this->type_->equivalent (tc.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (equivalent)
+ {
+ // Get the CDR stream of the Any, if there isn't one, make one.
+ TAO::Any_Impl *impl = any.impl ();
+ TAO_OutputCDR out;
+ TAO_InputCDR in (static_cast<ACE_Message_Block *> (0));
+ TAO::Unknown_IDL_Type *unk = 0;
+
+ if (impl->encoded ())
+ {
+ unk = dynamic_cast<TAO::Unknown_IDL_Type *> (impl);
+
+ in = unk->_tao_get_cdr ();
+ }
+ else
+ {
+ impl->marshal_value (out);
+ TAO_InputCDR tmp_in (out);
+ in = tmp_in;
+ }
+
+ // If we have an exception type, unmarshal the repository ID.
+ CORBA::TCKind kind =
+ TAO_DynAnyFactory::unalias (this->type_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (kind == CORBA::tk_except)
+ {
+ CORBA::String_var str;
+ in >> str.out ();
+ }
+
+ CORBA::TypeCode_var field_tc;
+ CORBA::TypeCode_var unaliased =
+ TAO::unaliased_typecode (this->type_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ for (CORBA::ULong i = 0; i < this->component_count_; ++i)
+ {
+ field_tc = unaliased->member_type (i
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ CORBA::Any field_any;
+ TAO_InputCDR unk_in (in);
+ TAO::Unknown_IDL_Type *unk = 0;
+ ACE_NEW (unk,
+ TAO::Unknown_IDL_Type (field_tc.in (),
+ unk_in));
+ field_any.replace (unk);
+
+ this->da_members_[i]->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->da_members_[i] =
+ TAO_DynAnyFactory::make_dyn_any (field_any
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Move to the next field in the CDR stream.
+ (void) TAO_Marshal_Object::perform_skip (field_tc.in (),
+ &in
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ this->current_position_ = this->component_count_ ? 0 : -1;
+ }
+ else
+ {
+ ACE_THROW (DynamicAny::DynAny::TypeMismatch ());
+ }
+}
+
+CORBA::Any_ptr
+TAO_DynStruct_i::to_any (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (),
+ 0);
+ }
+
+ TAO_OutputCDR out_cdr;
+
+ // If we have an exception type, marshal the repository ID.
+ CORBA::TCKind kind = TAO_DynAnyFactory::unalias (this->type_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ if (kind == CORBA::tk_except)
+ {
+ out_cdr << this->type_->id (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+ }
+
+ TAO::Any_Impl *field_impl = 0;
+ TAO::Unknown_IDL_Type *field_unk = 0;
+ TAO_InputCDR field_in_cdr (static_cast<ACE_Message_Block *> (0));
+
+ for (CORBA::ULong i = 0; i < this->component_count_; ++i)
+ {
+ CORBA::TypeCode_var field_tc =
+ this->da_members_[i]->type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ // Recursive step.
+ CORBA::Any_var field_any =
+ this->da_members_[i]->to_any (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ TAO_OutputCDR field_out_cdr;
+ field_impl = field_any->impl ();
+
+ if (field_impl->encoded ())
+ {
+ field_unk =
+ dynamic_cast<TAO::Unknown_IDL_Type *> (field_impl);
+
+ field_in_cdr = field_unk->_tao_get_cdr ();
+ }
+ else
+ {
+ field_impl->marshal_value (field_out_cdr);
+ TAO_InputCDR tmp (field_out_cdr);
+ field_in_cdr = tmp;
+ }
+
+ (void) TAO_Marshal_Object::perform_append (field_tc.in (),
+ &field_in_cdr,
+ &out_cdr
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+ }
+
+ TAO_InputCDR in_cdr (out_cdr);
+
+ CORBA::Any_ptr retval = 0;
+ ACE_NEW_THROW_EX (retval,
+ CORBA::Any,
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (0);
+
+ TAO::Unknown_IDL_Type *unk = 0;
+ ACE_NEW_THROW_EX (unk,
+ TAO::Unknown_IDL_Type (this->type_.in (),
+ in_cdr),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (0);
+
+ retval->replace (unk);
+ return retval;
+}
+
+CORBA::Boolean
+TAO_DynStruct_i::equal (DynamicAny::DynAny_ptr rhs
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (),
+ 0);
+ }
+
+ CORBA::TypeCode_var tc = rhs->type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ CORBA::Boolean equivalent = tc->equivalent (this->type_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ if (!equivalent)
+ {
+ return 0;
+ }
+
+ DynamicAny::DynAny_var tmp;
+ CORBA::Boolean member_equal;
+
+ for (CORBA::ULong i = 0; i < this->component_count_; ++i)
+ {
+ rhs->seek (static_cast <CORBA::Long> (i)
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ tmp = rhs->current_component (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ // Recursive step.
+ member_equal = tmp->equal (this->da_members_[i].in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ if (!member_equal)
+ {
+ return 0;
+ }
+ }
+
+ return 1;
+}
+
+void
+TAO_DynStruct_i::destroy (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW (CORBA::OBJECT_NOT_EXIST ());
+ }
+
+ if (!this->ref_to_component_ || this->container_is_destroying_)
+ {
+ // Do a deep destroy.
+ for (CORBA::ULong i = 0; i < this->component_count_; ++i)
+ {
+ this->set_flag (da_members_[i].in (),
+ 1
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->da_members_[i]->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ this->destroyed_ = 1;
+ }
+}
+
+DynamicAny::DynAny_ptr
+TAO_DynStruct_i::current_component (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (),
+ DynamicAny::DynAny::_nil ());
+ }
+
+ if (this->component_count_ == 0)
+ {
+ // Empty exception - no component.
+ ACE_THROW_RETURN (DynamicAny::DynAny::TypeMismatch (),
+ DynamicAny::DynAny::_nil ());
+ }
+
+ if (this->current_position_ == -1)
+ {
+ return DynamicAny::DynAny::_nil ();
+ }
+
+ CORBA::ULong index = static_cast <CORBA::ULong> (this->current_position_);
+
+ this->set_flag (this->da_members_[index].in (),
+ 0
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (DynamicAny::DynAny::_nil ());
+
+ return DynamicAny::DynAny::_duplicate (
+ this->da_members_[index].in ()
+ );
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/DynamicAny/DynStruct_i.h b/TAO/tao/DynamicAny/DynStruct_i.h
new file mode 100644
index 00000000000..62e9ecf7e1f
--- /dev/null
+++ b/TAO/tao/DynamicAny/DynStruct_i.h
@@ -0,0 +1,192 @@
+// -*- C++ -*-
+//
+// $Id$
+
+//=============================================================================
+/**
+ * @file DynStruct_i.h
+ *
+ * $Id$
+ *
+ * @author Jeff Parsons <parsons@cs.wustl.edu>
+ */
+//=============================================================================
+
+
+#ifndef TAO_DYNSTRUCT_I_H
+#define TAO_DYNSTRUCT_I_H
+#include /**/ "ace/pre.h"
+
+#include "tao/DynamicAny/DynamicAny.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/DynamicAny/DynCommon.h"
+#include "tao/LocalObject.h"
+#include "ace/Containers.h"
+
+#if defined (_MSC_VER)
+# pragma warning(push)
+# pragma warning (disable:4250)
+#endif /* _MSC_VER */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_DynStruct_i
+ *
+ * Implementation of Dynamic Any type for Structs
+ */
+class TAO_DynamicAny_Export TAO_DynStruct_i
+ : public virtual DynamicAny::DynStruct,
+ public virtual TAO_DynCommon,
+ public virtual TAO_Local_RefCounted_Object
+{
+public:
+ /// Constructor.
+ TAO_DynStruct_i (void);
+
+ /// Destructor.
+ ~TAO_DynStruct_i (void);
+
+ /// Initialize using just a TypeCode.
+ void init (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL);
+
+ /// Initialize using an Any.
+ void init (const CORBA::Any& any
+ ACE_ENV_ARG_DECL);
+
+ // = LocalObject methods.
+ static TAO_DynStruct_i *_narrow (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ // = Functions specific to DynStruct.
+
+ virtual DynamicAny::FieldName current_member_name (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ));
+
+ virtual CORBA::TCKind current_member_kind (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ));
+
+ virtual DynamicAny::NameValuePairSeq *get_members (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ virtual void set_members (
+ const DynamicAny::NameValuePairSeq& value
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ));
+
+ virtual DynamicAny::NameDynAnyPairSeq * get_members_as_dyn_any (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ virtual void set_members_as_dyn_any (
+ const DynamicAny::NameDynAnyPairSeq & value
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ));
+
+ // = DynAny common functions not implemented in class TAO_DynCommon.
+
+ virtual void from_any (
+ const CORBA::Any & value
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ));
+
+ virtual CORBA::Any * to_any (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ virtual CORBA::Boolean equal (
+ DynamicAny::DynAny_ptr dyn_any
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ virtual void destroy (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ virtual DynamicAny::DynAny_ptr current_component (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch
+ ));
+
+private:
+ /// Check if the typecode is acceptable.
+ void check_typecode (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL);
+
+ /// Code common to the constructor from an Any arg and the member
+ /// function from_any().
+ void set_from_any (const CORBA::Any &any
+ ACE_ENV_ARG_DECL);
+
+ /// Called by both versions of init().
+ void init_common (void);
+
+ // = Use copy() or assign() instead of these.
+ TAO_DynStruct_i (const TAO_DynStruct_i &src);
+ TAO_DynStruct_i &operator= (const TAO_DynStruct_i &src);
+
+private:
+ /// Each component is also a DynAny.
+ ACE_Array_Base<DynamicAny::DynAny_var> da_members_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined(_MSC_VER)
+# pragma warning(pop)
+#endif /* _MSC_VER */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_DYNSTRUCT_I_H */
diff --git a/TAO/tao/DynamicAny/DynUnion_i.cpp b/TAO/tao/DynamicAny/DynUnion_i.cpp
new file mode 100644
index 00000000000..b01187b8db1
--- /dev/null
+++ b/TAO/tao/DynamicAny/DynUnion_i.cpp
@@ -0,0 +1,1126 @@
+// $Id$
+
+#include "tao/AnyTypeCode/Marshal.h"
+#include "tao/AnyTypeCode/Any_Unknown_IDL_Type.h"
+#include "tao/AnyTypeCode/AnyTypeCode_methods.h"
+#include "tao/DynamicAny/DynUnion_i.h"
+#include "tao/DynamicAny/DynAnyFactory.h"
+#include "tao/CDR.h"
+
+ACE_RCSID (DynamicAny,
+ DynUnion_i,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_DynUnion_i::TAO_DynUnion_i (void)
+{
+}
+
+TAO_DynUnion_i::~TAO_DynUnion_i (void)
+{
+}
+
+void
+TAO_DynUnion_i::init_common (void)
+{
+ this->ref_to_component_ = 0;
+ this->container_is_destroying_ = 0;
+ this->has_components_ = 1;
+ this->destroyed_ = 0;
+ this->component_count_ = 2;
+ this->current_position_ = 0;
+ this->member_slot_ = 0;
+}
+
+void
+TAO_DynUnion_i::init (const CORBA::Any& any
+ ACE_ENV_ARG_DECL)
+{
+ CORBA::TypeCode_var tc = any.type ();
+
+ CORBA::TCKind kind = TAO_DynAnyFactory::unalias (tc.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (kind != CORBA::tk_union)
+ {
+ ACE_THROW (DynamicAny::DynAnyFactory::InconsistentTypeCode ());
+ }
+
+ // Initialize the typecode holder.
+ this->type_ = tc;
+
+ this->init_common ();
+
+ // Set the from_factory arg to TRUE, so any problems will throw
+ // InconsistentTypeCode.
+ this->set_from_any (any,
+ 1
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+void
+TAO_DynUnion_i::init (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL)
+{
+ CORBA::TCKind kind = TAO_DynAnyFactory::unalias (tc
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (kind != CORBA::tk_union)
+ {
+ ACE_THROW (DynamicAny::DynAnyFactory::InconsistentTypeCode ());
+ }
+
+ // Initialize the typecode holder and current index.
+ this->type_ = CORBA::TypeCode::_duplicate (tc);
+
+ this->init_common ();
+
+ // member_type()/member_label() do not work with aliased type codes.
+ CORBA::TypeCode_var unaliased_tc =
+ TAO_DynAnyFactory::strip_alias (this->type_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ CORBA::Any_var first_label =
+ unaliased_tc->member_label (this->current_position_
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Initialize the discriminator to the label value of the first member.
+ this->discriminator_ =
+ TAO_DynAnyFactory::make_dyn_any (first_label.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ CORBA::TypeCode_var first_type =
+ unaliased_tc->member_type (this->current_position_
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Recursively initialize the member to its default value.
+ this->member_ = TAO_DynAnyFactory::make_dyn_any (first_type.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+// ****************************************************************
+
+TAO_DynUnion_i *
+TAO_DynUnion_i::_narrow (CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED)
+{
+ if (CORBA::is_nil (_tao_objref))
+ {
+ return 0;
+ }
+
+ return dynamic_cast<TAO_DynUnion_i *> (_tao_objref);
+}
+
+// This code is common to from_any() and the init() overload that takes
+// an Any argument.
+void
+TAO_DynUnion_i::set_from_any (const CORBA::Any & any,
+ CORBA::Boolean /* from_factory */
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAnyFactory::InconsistentTypeCode
+ ))
+{
+ // discriminator_type () does not work with aliased type codes,
+ // only on unions, so strip the alias out of the type code
+ //
+ CORBA::TypeCode_var tc =
+ TAO_DynAnyFactory::strip_alias (any.type ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ CORBA::TypeCode_var disc_tc =
+ tc->discriminator_type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ CORBA::Any disc_any;
+ TAO::Unknown_IDL_Type *unk = 0;
+
+ // Get a CDR stream - if the Any doesn't have one, make one.
+ TAO::Any_Impl *impl = any.impl ();
+ TAO_OutputCDR out;
+ TAO_InputCDR in (static_cast<ACE_Message_Block *> (0));
+
+ if (impl->encoded ())
+ {
+ TAO::Unknown_IDL_Type *tmp =
+ dynamic_cast<TAO::Unknown_IDL_Type *> (impl);
+
+ in = tmp->_tao_get_cdr ();
+ }
+ else
+ {
+ impl->marshal_value (out);
+ TAO_InputCDR tmp_in (out);
+ in = tmp_in;
+ }
+
+ TAO_InputCDR unk_in (in);
+ ACE_NEW (unk,
+ TAO::Unknown_IDL_Type (disc_tc.in (),
+ unk_in));
+
+ disc_any.replace (unk);
+
+ // Need this here because we might have been called from init().
+ if (!CORBA::is_nil (this->discriminator_.in ()))
+ {
+ this->discriminator_->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ // Set the discriminator.
+ this->discriminator_ =
+ TAO_DynAnyFactory::make_dyn_any (disc_any
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Move to the next field in the CDR stream.
+ (void) TAO_Marshal_Object::perform_skip (disc_tc.in (),
+ &in
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ CORBA::TypeCode_var unaliased =
+ TAO_DynAnyFactory::strip_alias (tc.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ CORBA::ULong const count =
+ unaliased->member_count (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ CORBA::Boolean match = false;
+ CORBA::ULong i;
+
+ // Get the index.
+ for (i = 0; i < count; ++i)
+ {
+ CORBA::Any_var label_any = tc->member_label (i
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ match = this->label_match (label_any.in (),
+ disc_any
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (match)
+ {
+ break;
+ }
+ }
+
+ // Need this here because we might have been called from init().
+ if (!CORBA::is_nil (this->member_.in ()))
+ {
+ this->member_->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ if (match)
+ {
+ CORBA::TypeCode_var member_tc =
+ tc->member_type (i
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ CORBA::Any member_any;
+ TAO::Unknown_IDL_Type *unk = 0;
+ ACE_NEW (unk,
+ TAO::Unknown_IDL_Type (member_tc.in (),
+ in));
+ member_any.replace (unk);
+
+ this->member_ =
+ TAO_DynAnyFactory::make_dyn_any (member_any
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->member_slot_ = i;
+ }
+ else
+ {
+ // If no match, either the Any contains the default member or the
+ // type code was bad.
+
+ // default_index() does not work with aliased type codes.
+ CORBA::TypeCode_var unaliased_tc =
+ TAO_DynAnyFactory::strip_alias (this->type_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ CORBA::Long default_index =
+ unaliased_tc->default_index (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (default_index == -1)
+ {
+ set_to_no_active_member (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else
+ {
+ CORBA::ULong index = static_cast<CORBA::ULong> (default_index);
+
+ CORBA::TypeCode_var default_tc =
+ tc->member_type (index
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ CORBA::Any default_any;
+ TAO::Unknown_IDL_Type *unk = 0;
+ ACE_NEW (unk,
+ TAO::Unknown_IDL_Type (default_tc.in (),
+ in));
+ default_any.replace (unk);
+
+ this->member_ =
+ TAO_DynAnyFactory::make_dyn_any (default_any
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->member_slot_ = index;
+ }
+ }
+}
+
+// ****************************************************************
+
+DynamicAny::DynAny_ptr
+TAO_DynUnion_i::get_discriminator (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (),
+ DynamicAny::DynAny::_nil ());
+ }
+
+ // A deep copy is made only by copy() (CORBA 2.4.2 section 9.2.3.6).
+ // Set the flag so the caller can't destroy.
+ this->set_flag (this->discriminator_.in (),
+ 0
+ ACE_ENV_ARG_PARAMETER);
+
+ return DynamicAny::DynAny::_duplicate (this->discriminator_.in ());
+}
+
+void
+TAO_DynUnion_i::set_discriminator (DynamicAny::DynAny_ptr value
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW (CORBA::OBJECT_NOT_EXIST ());
+ }
+
+ CORBA::TypeCode_var tc = value->type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ CORBA::TypeCode_var disc_tc =
+ this->discriminator_->type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ CORBA::Boolean equivalent = disc_tc->equivalent (tc.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (!equivalent)
+ {
+ ACE_THROW (DynamicAny::DynAny::TypeMismatch ());
+ }
+
+ CORBA::Any_var value_any = value->to_any (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ CORBA::ULong length =
+ this->type_->member_count (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ CORBA::Any_var label_any;
+ CORBA::ULong i;
+
+ // member_label() does not work with aliased type codes.
+ CORBA::TypeCode_var unaliased_tc =
+ TAO_DynAnyFactory::strip_alias (this->type_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ CORBA::Boolean match = 0;
+
+ for (i = 0; i < length; ++i)
+ {
+ label_any = unaliased_tc->member_label (i
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ match = this->label_match (label_any.in (),
+ value_any.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (match)
+ {
+ break;
+ }
+ }
+
+ if (match)
+ {
+ // If the incoming label value matches the one we already
+ // have, we do nothing.
+ if (i == this->member_slot_)
+ {
+ return;
+ }
+
+ // If we got a match, a named member will be active.
+ this->discriminator_->from_any (label_any.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // member_type() does not work with aliased type codes.
+ CORBA::TypeCode_var member_tc =
+ unaliased_tc->member_type (i
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->member_->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Initialize member to default value.
+ this->member_ =
+ TAO_DynAnyFactory::make_dyn_any (member_tc.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Named active member (CORBA 2.3.1).
+ this->current_position_ = 1;
+ this->component_count_ = 2;
+
+ this->member_slot_ = i;
+ }
+ else
+ {
+ // default_index() does not work with aliased type codes.
+ CORBA::TypeCode_var unaliased_tc =
+ TAO_DynAnyFactory::strip_alias (this->type_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // If no match, either the default member or no member is active.
+ CORBA::Long default_index =
+ unaliased_tc->default_index (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (default_index == -1)
+ {
+ // This can't throw InvalidValue - if there's no default case
+ // and all possible labels are used, we'd have had a match above.
+ this->set_to_no_active_member (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else
+ {
+ this->set_to_default_member (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->member_slot_ = static_cast<CORBA::ULong> (default_index);
+ }
+ }
+
+ // If we get here, we update the discriminator no matter what.
+ // Any value will correspond to one of the three cases above.
+ this->discriminator_->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->discriminator_ = value->copy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+void
+TAO_DynUnion_i::set_to_default_member (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW (CORBA::OBJECT_NOT_EXIST ());
+ }
+
+ // default_index() does not work with aliased type codes.
+ CORBA::TypeCode_var unaliased_tc =
+ TAO_DynAnyFactory::strip_alias (this->type_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ CORBA::Long default_index =
+ unaliased_tc->default_index (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (default_index == -1)
+ {
+ // No explicit default case.
+ ACE_THROW (DynamicAny::DynAny::TypeMismatch ());
+ }
+ else
+ {
+ CORBA::ULong index = static_cast<CORBA::ULong> (default_index);
+
+ CORBA::TypeCode_var default_tc =
+ unaliased_tc->member_type (index
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->member_->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->member_ =
+ TAO_DynAnyFactory::make_dyn_any (default_tc.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Default member active (CORBA 2.3.1).
+ this->current_position_ = 0;
+ this->component_count_ = 2;
+
+ this->member_slot_ = index;
+ }
+}
+
+void
+TAO_DynUnion_i::set_to_no_active_member (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW (CORBA::OBJECT_NOT_EXIST ());
+ }
+
+ // default_index() does not work with aliased type codes.
+ CORBA::TypeCode_var unaliased_tc =
+ TAO_DynAnyFactory::strip_alias (this->type_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ CORBA::Long default_index =
+ unaliased_tc->default_index (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Throw an exception is there is an explicit default case or if all
+ // possible case label values are used.
+ if (default_index != -1)
+ {
+ ACE_THROW (DynamicAny::DynAny::TypeMismatch ());
+ }
+ else
+ {
+ CORBA::TypeCode_var disc_tc =
+ this->discriminator_->type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ CORBA::TCKind kind =
+ TAO_DynAnyFactory::unalias (disc_tc.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (kind == CORBA::tk_enum)
+ {
+ CORBA::ULong const member_count =
+ this->type_->member_count (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ CORBA::ULong const label_count =
+ disc_tc->member_count (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (member_count == label_count)
+ {
+ ACE_THROW (DynamicAny::DynAny::TypeMismatch ());
+ }
+ }
+ }
+
+ // No active member (CORBA 2.3.1).
+ this->current_position_ = 0;
+ this->component_count_ = 1;
+}
+
+CORBA::Boolean
+TAO_DynUnion_i::has_no_active_member (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (),
+ 0);
+ }
+
+ // No active member (CORBA 2.3.1).
+ return (this->current_position_ == 0
+ && this->component_count_ == 1);
+}
+
+CORBA::TCKind
+TAO_DynUnion_i::discriminator_kind (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (),
+ CORBA::tk_null);
+ }
+
+ CORBA::TypeCode_var tc =
+ this->discriminator_->type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::tk_null);
+
+ CORBA::TCKind retval = TAO_DynAnyFactory::unalias (tc.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::tk_null);
+
+ return retval;
+}
+
+DynamicAny::DynAny_ptr
+TAO_DynUnion_i::member (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::InvalidValue
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (),
+ DynamicAny::DynAny::_nil ());
+ }
+
+ CORBA::Boolean has_no_active_member =
+ this->has_no_active_member (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (DynamicAny::DynAny::_nil ());
+
+ if (has_no_active_member)
+ {
+ ACE_THROW_RETURN (DynamicAny::DynAny::InvalidValue (),
+ DynamicAny::DynAny::_nil ());
+ }
+
+ // A deep copy is made only by copy() (CORBA 2.4.2 section 9.2.3.6).
+ // Set the flag so the caller can't destroy.
+ this->set_flag (this->member_.in (),
+ 0
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (DynamicAny::DynAny::_nil ());
+
+ return DynamicAny::DynAny::_duplicate (this->member_.in ());
+}
+
+char *
+TAO_DynUnion_i::member_name (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::InvalidValue
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (),
+ 0);
+ }
+
+ CORBA::Boolean has_no_active_member =
+ this->has_no_active_member (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ if (has_no_active_member)
+ {
+ ACE_THROW_RETURN (DynamicAny::DynAny::InvalidValue (),
+ 0);
+ }
+
+ const char *retval = this->type_->member_name (this->member_slot_
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ return CORBA::string_dup (retval);
+}
+
+CORBA::TCKind
+TAO_DynUnion_i::member_kind (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::InvalidValue
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (),
+ CORBA::tk_null);
+ }
+
+ CORBA::Boolean has_no_active_member =
+ this->has_no_active_member (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::tk_null);
+
+ if (has_no_active_member)
+ {
+ ACE_THROW_RETURN (DynamicAny::DynAny::InvalidValue (),
+ CORBA::tk_null);
+ }
+
+ CORBA::TypeCode_var tc =
+ this->member_->type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::tk_null);
+
+ CORBA::TCKind retval = TAO_DynAnyFactory::unalias (tc.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::tk_null);
+
+ return retval;
+}
+
+// ****************************************************************
+
+void
+TAO_DynUnion_i::from_any (const CORBA::Any& any
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW (CORBA::OBJECT_NOT_EXIST ());
+ }
+
+ CORBA::TypeCode_var tc = any.type ();
+ CORBA::Boolean equivalent =
+ this->type_.in ()->equivalent (tc.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (equivalent)
+ {
+ // CORBA 2.3.1 section 9.2.3.3.
+ this->current_position_ = 0;
+
+ // May be changed in set_from_any().
+ this->component_count_ = 2;
+
+ // Set the from_factory arg to FALSE, so any problems will throw
+ // TypeMismatch.
+ this->set_from_any (any,
+ 0
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else
+ {
+ ACE_THROW (DynamicAny::DynAny::TypeMismatch ());
+ }
+}
+
+CORBA::Any_ptr
+TAO_DynUnion_i::to_any (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (),
+ 0);
+ }
+
+ TAO_OutputCDR out_cdr;
+
+ // Add the discriminator to the CDR stream.
+
+ CORBA::TypeCode_var disc_tc =
+ this->discriminator_->type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ CORBA::Any_var disc_any =
+ this->discriminator_->to_any (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ TAO::Any_Impl *disc_any_impl = disc_any->impl ();
+ TAO_OutputCDR disc_out_cdr;
+ TAO_InputCDR disc_in_cdr (static_cast<ACE_Message_Block *> (0));
+
+ if (disc_any_impl->encoded ())
+ {
+ TAO::Unknown_IDL_Type *disc_unk =
+ dynamic_cast<TAO::Unknown_IDL_Type *> (disc_any_impl);
+
+ disc_in_cdr = disc_unk->_tao_get_cdr ();
+ }
+ else
+ {
+ disc_any_impl->marshal_value (disc_out_cdr);
+ TAO_InputCDR disc_tmp_in_cdr (disc_out_cdr);
+ disc_in_cdr = disc_tmp_in_cdr;
+ }
+
+ (void) TAO_Marshal_Object::perform_append (disc_tc.in (),
+ &disc_in_cdr,
+ &out_cdr
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ // Add the member to the CDR stream unless it has no active member.
+ if (this->has_no_active_member () == 0)
+ {
+ CORBA::TypeCode_var member_tc =
+ this->member_->type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ CORBA::Any_var member_any =
+ this->member_->to_any (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ TAO::Any_Impl *member_any_impl = member_any->impl ();
+ TAO_OutputCDR member_out_cdr;
+ TAO_InputCDR member_in_cdr (static_cast<ACE_Message_Block *> (0));
+
+ if (member_any_impl->encoded ())
+ {
+ TAO::Unknown_IDL_Type *member_unk =
+ dynamic_cast<TAO::Unknown_IDL_Type *> (member_any_impl);
+
+ member_in_cdr = member_unk->_tao_get_cdr ();
+ }
+ else
+ {
+ member_any_impl->marshal_value (member_out_cdr);
+ TAO_InputCDR member_tmp_in_cdr (member_out_cdr);
+ member_in_cdr = member_tmp_in_cdr;
+ }
+
+ (void) TAO_Marshal_Object::perform_append (member_tc.in (),
+ &member_in_cdr,
+ &out_cdr
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+ }
+
+ // Make the Any.
+ TAO_InputCDR in_cdr (out_cdr);
+
+ CORBA::Any_ptr retval = 0;
+ ACE_NEW_THROW_EX (retval,
+ CORBA::Any,
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (0);
+
+ TAO::Unknown_IDL_Type *unk = 0;
+ ACE_NEW_THROW_EX (unk,
+ TAO::Unknown_IDL_Type (this->type_.in (),
+ in_cdr),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (0);
+
+ retval->replace (unk);
+ return retval;
+}
+
+CORBA::Boolean
+TAO_DynUnion_i::equal (DynamicAny::DynAny_ptr rhs
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (),
+ 0);
+ }
+
+ TAO_DynUnion_i *impl = TAO_DynUnion_i::_narrow (rhs
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ if (impl == 0)
+ {
+ return 0;
+ }
+
+ CORBA::Boolean equivalent =
+ this->type_->equivalent (impl->type_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ if (!equivalent)
+ {
+ return 0;
+ }
+
+ CORBA::Boolean member_equal =
+ this->member_->equal (impl->member_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ CORBA::Boolean disc_equal =
+ this->discriminator_->equal (impl->discriminator_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ impl->_remove_ref ();
+
+ return (member_equal && disc_equal);
+}
+
+void
+TAO_DynUnion_i::destroy (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW (CORBA::OBJECT_NOT_EXIST ());
+ }
+
+ if (!this->ref_to_component_ || this->container_is_destroying_)
+ {
+ // Free the two components.
+
+ this->set_flag (this->member_.in (),
+ 1
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->member_->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->set_flag (this->discriminator_.in (),
+ 1
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->discriminator_->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->destroyed_ = 1;
+ }
+}
+
+DynamicAny::DynAny_ptr
+TAO_DynUnion_i::current_component (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch
+ ))
+{
+ if (this->destroyed_)
+ {
+ ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (),
+ DynamicAny::DynAny::_nil ());
+ }
+
+ if (this->current_position_ == 1)
+ {
+ this->set_flag (this->member_.in (),
+ 0
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (DynamicAny::DynAny::_nil ());
+
+ return DynamicAny::DynAny::_duplicate (this->member_.in ());
+ }
+ else
+ {
+ this->set_flag (this->discriminator_.in (),
+ 0
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (DynamicAny::DynAny::_nil ());
+
+ return DynamicAny::DynAny::_duplicate (this->discriminator_.in ());
+ }
+}
+
+// ****************************************************************
+
+CORBA::Boolean
+TAO_DynUnion_i::label_match (const CORBA::Any &my_any,
+ const CORBA::Any &other_any
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ // Use my_any so we can detect a default case label,
+ // if we are iterating through the union type code's
+ // member_label() calls.
+ CORBA::TypeCode_var tc = my_any.type ();
+
+ CORBA::TCKind kind = TAO_DynAnyFactory::unalias (tc.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ // No need to do any type checking - it was done before this
+ // call was made.
+ switch (kind)
+ {
+ case CORBA::tk_octet:
+ // Default case label - just skip it.
+ return 0;
+ case CORBA::tk_short:
+ {
+ CORBA::Short my_val;
+ CORBA::Short other_val;
+ my_any >>= my_val;
+ other_any >>= other_val;
+ return my_val == other_val;
+ }
+ case CORBA::tk_long:
+ {
+ CORBA::Long my_val;
+ CORBA::Long other_val;
+ my_any >>= my_val;
+ other_any >>= other_val;
+ return my_val == other_val;
+ }
+ case CORBA::tk_ushort:
+ {
+ CORBA::UShort my_val;
+ CORBA::UShort other_val;
+ my_any >>= my_val;
+ other_any >>= other_val;
+ return my_val == other_val;
+ }
+ case CORBA::tk_ulong:
+ {
+ CORBA::ULong my_val;
+ CORBA::ULong other_val;
+ my_any >>= my_val;
+ other_any >>= other_val;
+ return my_val == other_val;
+ }
+ case CORBA::tk_boolean:
+ {
+ CORBA::Boolean my_val;
+ CORBA::Boolean other_val;
+ my_any >>= CORBA::Any::to_boolean (my_val);
+ other_any >>= CORBA::Any::to_boolean (other_val);
+ return my_val == other_val;
+ }
+ case CORBA::tk_char:
+ {
+ CORBA::Char my_val;
+ CORBA::Char other_val;
+ my_any >>= CORBA::Any::to_char (my_val);
+ other_any >>= CORBA::Any::to_char (other_val);
+ return my_val == other_val;
+ }
+// For platforms without native 64-bit ints.
+#if !defined (ACE_LACKS_LONGLONG_T)
+ case CORBA::tk_longlong:
+ {
+ CORBA::LongLong my_val;
+ CORBA::LongLong other_val;
+ my_any >>= my_val;
+ other_any >>= other_val;
+ return my_val == other_val;
+ }
+#endif /* ACE_LACKS_LONGLONG_T */
+ case CORBA::tk_ulonglong:
+ {
+ CORBA::ULongLong my_val;
+ CORBA::ULongLong other_val;
+ my_any >>= my_val;
+ other_any >>= other_val;
+ return my_val == other_val;
+ }
+ case CORBA::tk_wchar:
+ {
+ CORBA::WChar my_val;
+ CORBA::WChar other_val;
+ my_any >>= CORBA::Any::to_wchar (my_val);
+ other_any >>= CORBA::Any::to_wchar (other_val);
+ return my_val == other_val;
+ }
+ case CORBA::tk_enum:
+ {
+ CORBA::ULong my_val;
+ CORBA::ULong other_val;
+
+ TAO::Any_Impl *my_impl = my_any.impl ();
+
+ if (my_impl->encoded ())
+ {
+ TAO::Unknown_IDL_Type *my_unk =
+ dynamic_cast<TAO::Unknown_IDL_Type *> (my_impl);
+
+ // We don't want unk's rd_ptr to move, in case we are shared by
+ // another Any, so we use this to copy the state, not the buffer.
+ TAO_InputCDR for_reading (my_unk->_tao_get_cdr ());
+ for_reading.read_ulong (my_val);
+ }
+ else
+ {
+ TAO_OutputCDR my_out;
+ my_impl->marshal_value (my_out);
+ TAO_InputCDR my_in (my_out);
+ my_in.read_ulong (my_val);
+ }
+
+ TAO::Any_Impl *other_impl = other_any.impl ();
+
+ if (other_impl->encoded ())
+ {
+ TAO::Unknown_IDL_Type *other_unk =
+ dynamic_cast<TAO::Unknown_IDL_Type *> (other_impl);
+
+ // We don't want unk's rd_ptr to move, in case we are shared by
+ // another Any, so we use this to copy the state, not the buffer.
+ TAO_InputCDR for_reading (other_unk->_tao_get_cdr ());
+ for_reading.read_ulong (other_val);
+ }
+ else
+ {
+ TAO_OutputCDR other_out;
+ other_impl->marshal_value (other_out);
+ TAO_InputCDR other_in (other_out);
+ other_in.read_ulong (other_val);
+ }
+
+ return my_val == other_val;
+ }
+ // Cannot happen - we've covered all the legal discriminator types.
+ default:
+ return 0;
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/DynamicAny/DynUnion_i.h b/TAO/tao/DynamicAny/DynUnion_i.h
new file mode 100644
index 00000000000..c7aa9c1377e
--- /dev/null
+++ b/TAO/tao/DynamicAny/DynUnion_i.h
@@ -0,0 +1,221 @@
+// -*- C++ -*-
+//
+// $Id$
+
+//=============================================================================
+/**
+ * @file DynUnion_i.h
+ *
+ * $Id$
+ *
+ * @author Jeff Parsons <parsons@cs.wustl.edu>
+ */
+//=============================================================================
+
+
+#ifndef TAO_DYNUNION_I_H
+#define TAO_DYNUNION_I_H
+#include /**/ "ace/pre.h"
+
+#include "tao/DynamicAny/DynamicAny.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/DynamicAny/DynCommon.h"
+#include "tao/LocalObject.h"
+
+#if defined (_MSC_VER)
+# pragma warning(push)
+# pragma warning (disable:4250)
+#endif /* _MSC_VER */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_DynUnion_i
+ *
+ * Implementation of Dynamic Any type for Unions.
+ */
+class TAO_DynamicAny_Export TAO_DynUnion_i
+ : public virtual DynamicAny::DynUnion,
+ public virtual TAO_DynCommon,
+ public virtual TAO_Local_RefCounted_Object
+{
+public:
+ /// Constructor.
+ TAO_DynUnion_i (void);
+
+ /// Destructor.
+ ~TAO_DynUnion_i (void);
+
+ /// Constructor taking an Any argument.
+ void init (const CORBA::Any& any ACE_ENV_ARG_DECL);
+
+ /// Constructor taking a typecode argument.
+ void init (CORBA::TypeCode_ptr tc ACE_ENV_ARG_DECL);
+
+ // = LocalObject methods.
+ static TAO_DynUnion_i *_narrow (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ // = Functions specific to DynUnion.
+
+ virtual DynamicAny::DynAny_ptr get_discriminator (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ virtual void set_discriminator (
+ DynamicAny::DynAny_ptr d
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch
+ ));
+
+ virtual void set_to_default_member (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch
+ ));
+
+ virtual void set_to_no_active_member (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch
+ ));
+
+ virtual CORBA::Boolean has_no_active_member (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ virtual CORBA::TCKind discriminator_kind (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ virtual DynamicAny::DynAny_ptr member (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::InvalidValue
+ ));
+
+ virtual char * member_name (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::InvalidValue
+ ));
+
+ virtual CORBA::TCKind member_kind (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::InvalidValue
+ ));
+
+ // = DynAny common functions not implemented in class TAO_DynCommon.
+
+ virtual void from_any (
+ const CORBA::Any & value
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAny::InvalidValue
+ ));
+
+ virtual CORBA::Any * to_any (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ virtual CORBA::Boolean equal (
+ DynamicAny::DynAny_ptr dyn_any
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ virtual void destroy (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ virtual DynamicAny::DynAny_ptr current_component (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch
+ ));
+
+private:
+ /// Code common to the constructor from an Any arg and the member
+ /// function from_any().
+ void set_from_any (const CORBA::Any &any,
+ CORBA::Boolean from_factory
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DynamicAny::DynAny::TypeMismatch,
+ DynamicAny::DynAnyFactory::InconsistentTypeCode
+ ));
+
+ /// Called by both versions of init().
+ void init_common (void);
+
+ /// Iterative check for label value match.
+ CORBA::Boolean label_match (const CORBA::Any &my_any,
+ const CORBA::Any &other_any
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ /// Use copy() or assign() instead of these.
+ TAO_DynUnion_i (const TAO_DynUnion_i &src);
+ TAO_DynUnion_i &operator= (const TAO_DynUnion_i &src);
+
+private:
+ /// Just two components.
+ DynamicAny::DynAny_var member_;
+ DynamicAny::DynAny_var discriminator_;
+
+ /// The active member's slot in the union type code.
+ CORBA::ULong member_slot_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined(_MSC_VER)
+# pragma warning(pop)
+#endif /* _MSC_VER */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_DYNUNION_I_H */
diff --git a/TAO/tao/DynamicAny/DynamicAny.cpp b/TAO/tao/DynamicAny/DynamicAny.cpp
new file mode 100644
index 00000000000..2bf234a3a27
--- /dev/null
+++ b/TAO/tao/DynamicAny/DynamicAny.cpp
@@ -0,0 +1,51 @@
+//=============================================================================
+/**
+ * @file DynamicAny.cpp
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan <coryan@uci.edu>
+ */
+//=============================================================================
+
+
+#include "tao/DynamicAny/DynamicAny.h"
+#include "tao/DynamicAny/DynAnyFactory.h"
+
+ACE_RCSID(DynamicAny, DynamicAny, "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_DynamicAny_Loader::TAO_DynamicAny_Loader (void)
+{
+}
+
+CORBA::Object_ptr
+TAO_DynamicAny_Loader::create_object (CORBA::ORB_ptr,
+ int,
+ ACE_TCHAR *[]
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ CORBA::Object_ptr obj;
+ ACE_NEW_RETURN (obj,
+ TAO_DynAnyFactory,
+ CORBA::Object::_nil ());
+ return obj;
+}
+
+int
+TAO_DynamicAny_Loader::Initializer (void)
+{
+ return ACE_Service_Config::process_directive (ace_svc_desc_TAO_DynamicAny_Loader);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DEFINE (TAO_DynamicAny_Loader,
+ ACE_TEXT ("DynamicAny_Loader"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (TAO_DynamicAny_Loader),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0)
+ACE_FACTORY_DEFINE (TAO_DynamicAny, TAO_DynamicAny_Loader)
diff --git a/TAO/tao/DynamicAny/DynamicAny.h b/TAO/tao/DynamicAny/DynamicAny.h
new file mode 100644
index 00000000000..652f52939f9
--- /dev/null
+++ b/TAO/tao/DynamicAny/DynamicAny.h
@@ -0,0 +1,59 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file DynamicAny.h
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan <coryan@uci.edu>
+ */
+//=============================================================================
+
+
+#ifndef TAO_DYNAMICANY_H
+#define TAO_DYNAMICANY_H
+#include /**/ "ace/pre.h"
+
+#include "tao/DynamicAny/dynamicany_export.h"
+
+#define TAO_DYNAMICANY_SAFE_INCLUDE
+#include "tao/DynamicAny/DynamicAnyC.h"
+#undef TAO_DYNAMICANY_SAFE_INCLUDE
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Object_Loader.h"
+#include "ace/Service_Config.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_DynamicAny_Export TAO_DynamicAny_Loader : public TAO_Object_Loader
+{
+public:
+ /// Constructor
+ TAO_DynamicAny_Loader (void);
+
+ /// Creates a DynamicAny factory and returns it.
+ virtual CORBA::Object_ptr create_object (CORBA::ORB_ptr orb,
+ int argc,
+ ACE_TCHAR *argv []
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Used to force the initialization of the ORB code.
+ static int Initializer (void);
+};
+
+static int
+TAO_Requires_DynamicAny_Initializer = TAO_DynamicAny_Loader::Initializer ();
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE (TAO_DynamicAny_Loader)
+ACE_FACTORY_DECLARE (TAO_DynamicAny, TAO_DynamicAny_Loader)
+
+#include /**/ "ace/post.h"
+#endif /* TAO_DYNAMICANY_H */
diff --git a/TAO/tao/DynamicAny/DynamicAny.pidl b/TAO/tao/DynamicAny/DynamicAny.pidl
new file mode 100644
index 00000000000..345f25bad8c
--- /dev/null
+++ b/TAO/tao/DynamicAny/DynamicAny.pidl
@@ -0,0 +1,221 @@
+// -*- IDL -*-
+
+/**
+ * @file DynamicAny.pidl
+ *
+ * $Id$
+ *
+ * @brief Pre-compiled IDL source for the DynamicAny module.
+ *
+ * This file is used to generate the code in DynamicAnyC.{h,i,cpp}, it
+ * was obtained from the OMG website as part of the full CORBA IDL,
+ * the document reference number is: formal/00-04-01, or use the
+ * following URL:
+ * http://www.omg.org/technology/documents/formal/corba_omg_idl_text_file.htm
+ *
+ * We couldn't find a copyright notice in the document, but it is safe
+ * to assume that it is Copyright (C) 2000, OMG.
+ *
+ * We performed some modifications to the file, mainly to use local
+ * interfaces (part of what is coming in CORBA 3.0)
+ *
+ * The command used to generate code from this file is:
+ *
+ * tao_idl \
+ * -o orig -Gp -Sci -Gd -Ge 1 -Sa -St -I../.. \
+ * -Wb,export_macro=TAO_DynamicAny_Export \
+ * -Wb,export_include=dynamicany_export.h \
+ * -Wb,pre_include="ace/pre.h" \
+ * -Wb,post_include="ace/post.h" \
+ * -Wb,versioning_begin=TAO_BEGIN_VERSIONED_NAMESPACE_DECL \
+ * -Wb,versioning_end=TAO_END_VERSIONED_NAMESPACE_DECL \
+ * DynamicAny.pidl
+ *
+ * after the file is generated a patch must be applied. The patch
+ * fixes some problems with interceptors and local interfaces and
+ * disables parts of the code under certain configurations.
+ *
+ * Apply patches using:
+ *
+ * patch < diffs/DynamicAny.diff
+ *
+ * Note: The diffs are generated using:
+ *
+ * for i in DynamicAnyC.{h,cpp}; do
+ * diff -wbu orig/$i $i > diffs/DynamicAny.diff
+ * done
+ *
+ */
+
+#ifndef _DYNAMIC_ANY_IDL_
+#define _DYNAMIC_ANY_IDL_
+
+#pragma prefix "omg.org"
+
+#include "tao/Typecode_types.pidl"
+
+module DynamicAny {
+
+ local interface DynAny {
+ exception InvalidValue {};
+ exception TypeMismatch {};
+
+ CORBA::TypeCode type();
+
+ void assign( in DynAny dyn_any) raises(TypeMismatch);
+ void from_any( in any value) raises(TypeMismatch, InvalidValue);
+ any to_any();
+
+ boolean equal( in DynAny dyn_any);
+
+ void destroy();
+ DynAny copy();
+ void insert_boolean(in boolean value) raises(TypeMismatch, InvalidValue);
+ void insert_octet( in octet value) raises(TypeMismatch, InvalidValue);
+ void insert_char( in char value) raises(TypeMismatch, InvalidValue);
+ void insert_short( in short value) raises(TypeMismatch, InvalidValue);
+ void insert_ushort( in unsigned short
+ value) raises(TypeMismatch, InvalidValue);
+ void insert_long( in long value) raises(TypeMismatch, InvalidValue);
+ void insert_ulong( in unsigned long
+ value) raises(TypeMismatch, InvalidValue);
+ void insert_float( in float value) raises(TypeMismatch, InvalidValue);
+ void insert_double( in double value) raises(TypeMismatch, InvalidValue);
+ void insert_string( in string value) raises(TypeMismatch, InvalidValue);
+ void insert_reference(in Object value) raises(TypeMismatch, InvalidValue);
+ void insert_typecode(in CORBA::TypeCode
+ value) raises(TypeMismatch, InvalidValue);
+ void insert_longlong(in long long value) raises(TypeMismatch, InvalidValue);
+ void insert_ulonglong(in unsigned long long
+ value) raises(TypeMismatch, InvalidValue);
+ void insert_longdouble(in long double
+ value) raises(TypeMismatch, InvalidValue);
+ void insert_wchar( in wchar value) raises(TypeMismatch, InvalidValue);
+ void insert_wstring(in wstring value) raises(TypeMismatch, InvalidValue);
+ void insert_any( in any value) raises(TypeMismatch, InvalidValue);
+ void insert_dyn_any(in DynAny value) raises(TypeMismatch, InvalidValue);
+ void insert_val( in ValueBase value) raises(TypeMismatch, InvalidValue);
+
+ boolean get_boolean() raises(TypeMismatch, InvalidValue);
+ octet get_octet() raises(TypeMismatch, InvalidValue);
+ char get_char() raises(TypeMismatch, InvalidValue);
+ short get_short() raises(TypeMismatch, InvalidValue);
+ unsigned short get_ushort() raises(TypeMismatch, InvalidValue);
+ long get_long() raises(TypeMismatch, InvalidValue);
+ unsigned long get_ulong() raises(TypeMismatch, InvalidValue);
+ float get_float() raises(TypeMismatch, InvalidValue);
+ double get_double() raises(TypeMismatch, InvalidValue);
+ string get_string() raises(TypeMismatch, InvalidValue);
+ Object get_reference() raises(TypeMismatch, InvalidValue);
+ CORBA::TypeCode get_typecode() raises(TypeMismatch, InvalidValue);
+ long long get_longlong() raises(TypeMismatch, InvalidValue);
+ unsigned long long get_ulonglong() raises(TypeMismatch, InvalidValue);
+ long double get_longdouble() raises(TypeMismatch, InvalidValue);
+ wchar get_wchar() raises(TypeMismatch, InvalidValue);
+ wstring get_wstring() raises(TypeMismatch, InvalidValue);
+ any get_any() raises(TypeMismatch, InvalidValue);
+ DynAny get_dyn_any() raises(TypeMismatch, InvalidValue);
+ ValueBase get_val() raises(TypeMismatch, InvalidValue);
+
+ boolean seek(in long index);
+ void rewind();
+ boolean next();
+ unsigned long component_count();
+ DynAny current_component() raises(TypeMismatch);
+ };
+
+ local interface DynFixed : DynAny {
+ string get_value();
+ boolean set_value(in string val) raises(TypeMismatch, InvalidValue);
+ };
+
+ local interface DynEnum : DynAny {
+ string get_as_string();
+ void set_as_string(in string value)
+ raises(InvalidValue);
+ unsigned long get_as_ulong();
+ void set_as_ulong( in unsigned long value)
+ raises(InvalidValue);
+ };
+ typedef string FieldName;
+ struct NameValuePair {
+ FieldName id;
+ any value;
+ };
+
+ typedef sequence<NameValuePair> NameValuePairSeq;
+ struct NameDynAnyPair {
+ FieldName id;
+ DynAny value;
+ };
+
+ typedef sequence<NameDynAnyPair> NameDynAnyPairSeq;
+ local interface DynStruct : DynAny {
+ FieldName current_member_name() raises(TypeMismatch, InvalidValue);
+ CORBA::TCKind current_member_kind() raises(TypeMismatch, InvalidValue);
+ NameValuePairSeq get_members();
+ void set_members(in NameValuePairSeq value)
+ raises(TypeMismatch, InvalidValue);
+ NameDynAnyPairSeq get_members_as_dyn_any();
+ void set_members_as_dyn_any(in NameDynAnyPairSeq value)
+ raises(TypeMismatch, InvalidValue);
+ };
+
+ local interface DynUnion : DynAny {
+ DynAny get_discriminator();
+ void set_discriminator(in DynAny d)
+ raises(TypeMismatch);
+ void set_to_default_member() raises(TypeMismatch);
+ void set_to_no_active_member() raises(TypeMismatch);
+ boolean has_no_active_member();
+ CORBA::TCKind discriminator_kind();
+ DynAny member() raises(InvalidValue);
+ FieldName member_name() raises(InvalidValue);
+ CORBA::TCKind member_kind() raises(InvalidValue);
+ };
+
+ typedef sequence<any> AnySeq;
+ typedef sequence<DynAny> DynAnySeq;
+ local interface DynSequence : DynAny {
+ unsigned long get_length();
+ void set_length(in unsigned long len)
+ raises(InvalidValue);
+ AnySeq get_elements();
+ void set_elements(in AnySeq value)
+ raises(TypeMismatch, InvalidValue);
+ DynAnySeq get_elements_as_dyn_any();
+ void set_elements_as_dyn_any(in DynAnySeq value)
+ raises(TypeMismatch, InvalidValue);
+ };
+
+ local interface DynArray : DynAny {
+ AnySeq get_elements();
+ void set_elements(in AnySeq value)
+ raises(TypeMismatch, InvalidValue);
+ DynAnySeq get_elements_as_dyn_any();
+ void set_elements_as_dyn_any(in DynAnySeq value)
+ raises(TypeMismatch, InvalidValue);
+ };
+
+ local interface DynValue : DynAny {
+ FieldName current_member_name() raises(TypeMismatch, InvalidValue);
+ CORBA::TCKind current_member_kind() raises(TypeMismatch, InvalidValue);
+ NameValuePairSeq get_members();
+ void set_members(in NameValuePairSeq value)
+ raises(TypeMismatch, InvalidValue);
+ NameDynAnyPairSeq get_members_as_dyn_any();
+ void set_members_as_dyn_any(in NameDynAnyPairSeq value)
+ raises(TypeMismatch, InvalidValue);
+ };
+
+ local interface DynAnyFactory {
+ exception InconsistentTypeCode {};
+ DynAny create_dyn_any(in any value)
+ raises(InconsistentTypeCode);
+ DynAny create_dyn_any_from_type_code(in CORBA::TypeCode type)
+ raises(InconsistentTypeCode);
+ };
+
+}; // module DynamicAny
+
+#endif // _DYNAMIC_ANY_IDL_
diff --git a/TAO/tao/DynamicAny/TAO_DynamicAny.pc.in b/TAO/tao/DynamicAny/TAO_DynamicAny.pc.in
new file mode 100644
index 00000000000..2eb0b441b50
--- /dev/null
+++ b/TAO/tao/DynamicAny/TAO_DynamicAny.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: TAO_DynamicAny
+Description: TAO Dynamic Any Library
+Requires: TAO_AnyTypeCode, TAO
+Version: @VERSION@
+Libs: -L${libdir} -lTAO_DynamicAny
+Cflags: -I${includedir}
diff --git a/TAO/tao/DynamicAny/TAO_DynamicAny.rc b/TAO/tao/DynamicAny/TAO_DynamicAny.rc
new file mode 100644
index 00000000000..f8f1131c54d
--- /dev/null
+++ b/TAO/tao/DynamicAny/TAO_DynamicAny.rc
@@ -0,0 +1,30 @@
+#include "..\Version.h"
+
+1 VERSIONINFO
+ FILEVERSION TAO_MAJOR_VERSION,TAO_MINOR_VERSION,TAO_BETA_VERSION,0
+ PRODUCTVERSION TAO_MAJOR_VERSION,TAO_MINOR_VERSION,TAO_BETA_VERSION,0
+ FILEFLAGSMASK 0x3fL
+ FILEFLAGS 0x0L
+ FILEOS 0x4L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904B0"
+ BEGIN
+ VALUE "FileDescription", "DymanicAny\0"
+ VALUE "FileVersion", TAO_VERSION "\0"
+ VALUE "InternalName", "TAO_DynamicAnyDLL\0"
+ VALUE "LegalCopyright", "\0"
+ VALUE "LegalTrademarks", "\0"
+ VALUE "OriginalFilename", "TAO_DynamicAny.DLL\0"
+ VALUE "ProductName", "TAO\0"
+ VALUE "ProductVersion", TAO_VERSION "\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
diff --git a/TAO/tao/DynamicAny/diffs/DynamicAny.pidl.diff b/TAO/tao/DynamicAny/diffs/DynamicAny.pidl.diff
new file mode 100644
index 00000000000..9e23cae814c
--- /dev/null
+++ b/TAO/tao/DynamicAny/diffs/DynamicAny.pidl.diff
@@ -0,0 +1,158 @@
+--- orig/DynamicAny.pidl Fri Aug 25 09:46:46 2000
++++ DynamicAny.pidl Fri Aug 25 15:19:49 2000
+@@ -1,5 +1,57 @@
+-// File: DynamicAny.idl
+-// CORBA 2.3, Chapter 9
++//
++// $Id$
++//
++// ================================================================
++//
++// = LIBRARY
++// TAO
++//
++// = FILENAME
++// DynamicAny.pidl
++//
++// = DESCRIPTION
++// This file was used to generate the code in DynamicAnyC.{h,i,cpp}
++// The file was obtained from the OMG website as part of the full
++// CORBA IDL formal/00-04-01:
++// http://www.omg.org/technology/documents/formal/corba_omg_idl_text_file.htm
++// I couldn't find a copyright notice in the document, but I will
++// assume that it is Copyright (C) 2000, OMG.
++// We performed some modifications to the file, mainly to use local
++// interfaces (part of what is coming in CORBA 2.4 and CORBA 3.0).
++//
++// The command used to generate code from this file is:
++//
++// tao_idl.exe -o orig -Gp -Gd -Ge 1 -Gv \
++// -Wb,export_macro=TAO_DynamicAny_Export \
++// -Wb,export_include=dynamicany_export.h \
++// -Wb,pre_include="ace/pre.h" \
++// -Wb,post_include="ace/post.h" \
++// DynamicAny.pidl
++//
++// after the file is generated a patch must be applied. The patch
++// fixes some problems with interceptors and local interfaces and
++// disables parts of the code under certain configurations.
++//
++// Apply patches using the following commands:
++//
++// patch < diffs/DynamicAnyC.h.diff
++// patch < diffs/DynamicAnyC.i.diff
++// patch < diffs/DynamicAnyC.cpp.diff
++//
++// Those changes are required because the generated
++// code is part of the TAO library, it hardly makes any sense to
++// change the IDL compiler to support changes that are very
++// occasional.
++//
++// Note: The diffs were generated with these commands:
++//
++// diff -wbu orig/DynamicAny.pidl DynamicAny.pidl > diffs\DynamicAny.pidl.diff
++//
++// diff -wbu orig/DynamicAnyC.h DynamicAnyC.h > diffs/DynamicAnyC.h.diff
++// diff -wbu orig/DynamicAnyC.i DynamicAnyC.i > diffs/DynamicAnyC.i.diff
++// diff -wbu orig/DynamicAnyC.cpp DynamicAnyC.cpp > diffs/DynamicAnyC.cpp.diff
++//
++// ================================================================
+
+ #ifndef _DYNAMIC_ANY_IDL_
+ #define _DYNAMIC_ANY_IDL_
+@@ -8,7 +60,7 @@
+
+ module DynamicAny {
+
+- interface DynAny {
++ local interface DynAny {
+ exception InvalidValue {};
+ exception TypeMismatch {};
+
+@@ -46,7 +98,7 @@
+ void insert_wstring(in wstring value) raises(TypeMismatch, InvalidValue);
+ void insert_any( in any value) raises(TypeMismatch, InvalidValue);
+ void insert_dyn_any(in DynAny value) raises(TypeMismatch, InvalidValue);
+- void insert_val( in ValueBase value) raises(TypeMismatch, InvalidValue);
++ void insert_val( in CORBA::ValueBase value) raises(TypeMismatch, InvalidValue);
+
+ boolean get_boolean() raises(TypeMismatch, InvalidValue);
+ octet get_octet() raises(TypeMismatch, InvalidValue);
+@@ -67,7 +119,7 @@
+ wstring get_wstring() raises(TypeMismatch, InvalidValue);
+ any get_any() raises(TypeMismatch, InvalidValue);
+ DynAny get_dyn_any() raises(TypeMismatch, InvalidValue);
+- ValueBase get_val() raises(TypeMismatch, InvalidValue);
++ CORBA::ValueBase get_val() raises(TypeMismatch, InvalidValue);
+
+ boolean seek(in long index);
+ void rewind();
+@@ -76,12 +128,12 @@
+ DynAny current_component() raises(TypeMismatch);
+ };
+
+- interface DynFixed : DynAny {
++ local interface DynFixed : DynAny {
+ string get_value();
+ boolean set_value(in string val) raises(TypeMismatch, InvalidValue);
+ };
+
+- interface DynEnum : DynAny {
++ local interface DynEnum : DynAny {
+ string get_as_string();
+ void set_as_string(in string value)
+ raises(InvalidValue);
+@@ -102,7 +154,7 @@
+ };
+
+ typedef sequence<NameDynAnyPair> NameDynAnyPairSeq;
+- interface DynStruct : DynAny {
++ local interface DynStruct : DynAny {
+ FieldName current_member_name() raises(TypeMismatch, InvalidValue);
+ CORBA::TCKind current_member_kind() raises(TypeMismatch, InvalidValue);
+ NameValuePairSeq get_members();
+@@ -113,7 +165,7 @@
+ raises(TypeMismatch, InvalidValue);
+ };
+
+- interface DynUnion : DynAny {
++ local interface DynUnion : DynAny {
+ DynAny get_discriminator();
+ void set_discriminator(in DynAny d)
+ raises(TypeMismatch);
+@@ -128,7 +180,7 @@
+
+ typedef sequence<any> AnySeq;
+ typedef sequence<DynAny> DynAnySeq;
+- interface DynSequence : DynAny {
++ local interface DynSequence : DynAny {
+ unsigned long get_length();
+ void set_length(in unsigned long len)
+ raises(InvalidValue);
+@@ -140,7 +192,7 @@
+ raises(TypeMismatch, InvalidValue);
+ };
+
+- interface DynArray : DynAny {
++ local interface DynArray : DynAny {
+ AnySeq get_elements();
+ void set_elements(in AnySeq value)
+ raises(TypeMismatch, InvalidValue);
+@@ -149,7 +201,7 @@
+ raises(TypeMismatch, InvalidValue);
+ };
+
+- interface DynValue : DynAny {
++ local interface DynValue : DynAny {
+ FieldName current_member_name() raises(TypeMismatch, InvalidValue);
+ CORBA::TCKind current_member_kind() raises(TypeMismatch, InvalidValue);
+ NameValuePairSeq get_members();
+@@ -160,7 +212,7 @@
+ raises(TypeMismatch, InvalidValue);
+ };
+
+- interface DynAnyFactory {
++ local interface DynAnyFactory {
+ exception InconsistentTypeCode {};
+ DynAny create_dyn_any(in any value)
+ raises(InconsistentTypeCode);
diff --git a/TAO/tao/DynamicAny/dynamicany_export.h b/TAO/tao/DynamicAny/dynamicany_export.h
new file mode 100644
index 00000000000..83eed065565
--- /dev/null
+++ b/TAO/tao/DynamicAny/dynamicany_export.h
@@ -0,0 +1,40 @@
+
+// -*- C++ -*-
+// $Id$
+// Definition for Win32 Export directives.
+// This file is generated automatically by generate_export_file.pl
+// ------------------------------
+#ifndef TAO_DYNAMICANY_EXPORT_H
+#define TAO_DYNAMICANY_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if defined (TAO_AS_STATIC_LIBS)
+# if !defined (TAO_DYNAMICANY_HAS_DLL)
+# define TAO_DYNAMICANY_HAS_DLL 0
+# endif /* ! TAO_DYNAMICANY_HAS_DLL */
+#else
+# if !defined (TAO_DYNAMICANY_HAS_DLL)
+# define TAO_DYNAMICANY_HAS_DLL 1
+# endif /* ! TAO_DYNAMICANY_HAS_DLL */
+#endif
+
+#if defined (TAO_DYNAMICANY_HAS_DLL) && (TAO_DYNAMICANY_HAS_DLL == 1)
+# if defined (TAO_DYNAMICANY_BUILD_DLL)
+# define TAO_DynamicAny_Export ACE_Proper_Export_Flag
+# define TAO_DYNAMICANY_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# define TAO_DYNAMICANY_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# else /* TAO_DYNAMICANY_BUILD_DLL */
+# define TAO_DynamicAny_Export ACE_Proper_Import_Flag
+# define TAO_DYNAMICANY_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# define TAO_DYNAMICANY_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# endif /* TAO_DYNAMICANY_BUILD_DLL */
+#else /* TAO_DYNAMICANY_HAS_DLL == 1 */
+# define TAO_DynamicAny_Export
+# define TAO_DYNAMICANY_SINGLETON_DECLARATION(T)
+# define TAO_DYNAMICANY_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+#endif /* TAO_DYNAMICANY_HAS_DLL == 1 */
+
+#endif /* TAO_DYNAMICANY_EXPORT_H */
+
+// End of auto generated file.
diff --git a/TAO/tao/DynamicInterface.mpc b/TAO/tao/DynamicInterface.mpc
new file mode 100644
index 00000000000..7e01c656a18
--- /dev/null
+++ b/TAO/tao/DynamicInterface.mpc
@@ -0,0 +1,35 @@
+//$Id$
+project : taolib, core, messaging, core_minimum_corba {
+ sharedname = TAO_DynamicInterface
+ dynamicflags = TAO_DYNAMICINTERFACE_BUILD_DLL
+
+ Source_Files {
+ DynamicInterface
+ }
+
+ Header_Files {
+ DynamicInterface
+ }
+
+ Inline_Files {
+ DynamicInterface
+ }
+
+ Template_Files {
+ DynamicInterface
+ }
+
+ Resource_Files {
+ DynamicInterface
+ }
+
+ PIDL_Files {
+ }
+
+ IDL_Files {
+ }
+
+ Pkgconfig_Files {
+ DynamicInterface/TAO_DynamicInterface.pc.in
+ }
+}
diff --git a/TAO/tao/DynamicInterface/Context.cpp b/TAO/tao/DynamicInterface/Context.cpp
new file mode 100644
index 00000000000..3edab19588b
--- /dev/null
+++ b/TAO/tao/DynamicInterface/Context.cpp
@@ -0,0 +1,203 @@
+#include "tao/DynamicInterface/Context.h"
+
+ACE_RCSID (DynamicInterface,
+ Context,
+ "$Id$")
+
+#include "tao/AnyTypeCode/TypeCode.h"
+#include "tao/Environment.h"
+#include "tao/CORBA_String.h"
+#include "tao/SystemException.h"
+
+#include "ace/Guard_T.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/DynamicInterface/Context.inl"
+#endif /* ! __ACE_INLINE__ */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+CORBA::Context::Context (void)
+ : refcount_ (1)
+{
+}
+
+CORBA::Context::~Context (void)
+{
+}
+
+CORBA::ULong
+CORBA::Context::_incr_refcnt (void)
+{
+ return ++refcount_;
+}
+
+CORBA::ULong
+CORBA::Context::_decr_refcnt (void)
+{
+ const CORBA::ULong new_count = --this->refcount_;
+
+ if (new_count == 0)
+ delete this;
+
+ return new_count;
+}
+
+const char *
+CORBA::Context::context_name (ACE_ENV_SINGLE_ARG_DECL) const
+{
+ ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (TAO::VMCID,
+ CORBA::COMPLETED_NO),
+ 0);
+}
+
+CORBA::Context_ptr
+CORBA::Context::parent (ACE_ENV_SINGLE_ARG_DECL) const
+{
+ ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (TAO::VMCID,
+ CORBA::COMPLETED_NO),
+ 0);
+}
+
+void
+CORBA::Context::create_child (const char * /* child_ctx_name */,
+ CORBA::Context_out /* child_ctx */
+ ACE_ENV_ARG_DECL)
+{
+ ACE_THROW (CORBA::NO_IMPLEMENT (TAO::VMCID,
+ CORBA::COMPLETED_NO));
+}
+
+void
+CORBA::Context::set_one_value (const char * /* propname */,
+ const CORBA::Any & /* propvalue */
+ ACE_ENV_ARG_DECL)
+{
+ ACE_THROW (CORBA::NO_IMPLEMENT (TAO::VMCID,
+ CORBA::COMPLETED_NO));
+}
+
+void
+CORBA::Context::set_values (CORBA::NVList_ptr
+ ACE_ENV_ARG_DECL)
+{
+ ACE_THROW (CORBA::NO_IMPLEMENT (TAO::VMCID,
+ CORBA::COMPLETED_NO));
+}
+
+void
+CORBA::Context::delete_values (const char * /* propname */
+ ACE_ENV_ARG_DECL)
+{
+ ACE_THROW (CORBA::NO_IMPLEMENT (TAO::VMCID,
+ CORBA::COMPLETED_NO));
+}
+
+void
+CORBA::Context::get_values (const char * /* start_scope */,
+ CORBA::Flags /* op_flags */,
+ const char * /* pattern */,
+ CORBA::NVList_ptr & /* values */
+ ACE_ENV_ARG_DECL)
+{
+ ACE_THROW (CORBA::NO_IMPLEMENT (TAO::VMCID,
+ CORBA::COMPLETED_NO));
+}
+
+CORBA::ContextList::ContextList (CORBA::ULong len,
+ char* *ctx_list)
+ : ref_count_ (1)
+{
+ for (CORBA::ULong i=0; i < len; i++)
+ {
+ this->add (ctx_list [i]);
+ }
+}
+
+CORBA::ContextList::~ContextList (void)
+{
+ for (CORBA::ULong i = 0; i < this->count (); ++i)
+ {
+ char **ctx;
+
+ if (this->ctx_list_.get (ctx, i) == -1)
+ {
+ return;
+ }
+
+ CORBA::string_free (*ctx);
+ }
+}
+
+void
+CORBA::ContextList::add (char *ctx)
+{
+ this->ctx_list_.enqueue_tail (CORBA::string_dup (ctx));
+}
+
+void
+CORBA::ContextList::add_consume (char *ctx)
+{
+ this->ctx_list_.enqueue_tail (ctx);
+}
+
+char *
+CORBA::ContextList::item (CORBA::ULong slot
+ ACE_ENV_ARG_DECL)
+{
+ char **ctx = 0;
+
+ if (this->ctx_list_.get (ctx, slot) == -1)
+ {
+ ACE_THROW_RETURN (CORBA::TypeCode::Bounds (),
+ 0);
+ }
+ else
+ {
+ return CORBA::string_dup (*ctx);
+ }
+}
+
+void
+CORBA::ContextList::remove (CORBA::ULong
+ ACE_ENV_ARG_DECL)
+{
+ ACE_THROW (CORBA::NO_IMPLEMENT ());
+}
+
+CORBA::ContextList_ptr
+CORBA::ContextList::_duplicate (void)
+{
+ ++this->ref_count_;
+ return this;
+}
+
+void
+CORBA::ContextList::_destroy (void)
+{
+ CORBA::ULong current = --this->ref_count_;
+
+ if (current == 0)
+ {
+ delete this;
+ }
+}
+
+void
+CORBA::ContextList::_incr_refcnt (void)
+{
+ this->ref_count_++;
+}
+
+void
+CORBA::ContextList::_decr_refcnt (void)
+{
+ this->ref_count_--;
+
+ if (this->ref_count_ != 0)
+ {
+ delete this;
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/DynamicInterface/Context.h b/TAO/tao/DynamicInterface/Context.h
new file mode 100644
index 00000000000..7ad9c97795d
--- /dev/null
+++ b/TAO/tao/DynamicInterface/Context.h
@@ -0,0 +1,209 @@
+// -*- C++ -*-
+//
+// $Id$
+
+//=============================================================================
+/**
+ * @file Context.h
+ *
+ * $Id$
+ *
+ * Header file for CORBA Context class.
+ *
+ * @author Jeff Parsons <parsons@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_CONTEXT_H
+#define TAO_CONTEXT_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/DynamicInterface/dynamicinterface_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/DynamicInterface/DII_CORBA_methods.h"
+#include "tao/AnyTypeCode/AnyTypeCode_methods.h"
+
+#include "tao/Pseudo_VarOut_T.h"
+#include "tao/orbconf.h"
+#include "tao/Basic_Types.h"
+#include "tao/ORB_Constants.h"
+#include "tao/default_environment.h"
+
+#include "ace/Unbounded_Queue.h"
+#include "ace/Atomic_Op.h"
+#include "ace/CORBA_macros.h"
+#include "ace/Synch_Traits.h"
+
+#if defined (TAO_EXPORT_MACRO)
+#undef TAO_EXPORT_MACRO
+#endif
+#define TAO_EXPORT_MACRO TAO_DynamicInterface_Export
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace CORBA
+{
+ typedef ULong Flags;
+
+ class NVList;
+ typedef NVList *NVList_ptr;
+
+ class Environment;
+
+ typedef TAO_Pseudo_Var_T<Context> Context_var;
+ typedef TAO_Pseudo_Out_T<Context> Context_out;
+
+ typedef TAO_Pseudo_Var_T<ContextList> ContextList_var;
+ typedef TAO_Pseudo_Out_T<ContextList> ContextList_out;
+
+ /**
+ * @class Context
+ *
+ * @brief CORBA::Context
+ *
+ * TAO's minimal implementation of the Context interface. Since
+ * Contexts are inherently un-typesafe, there use is deprecated and
+ * the feature may eventaully disappear from CORBA. It is
+ * implemented only to make the arg list of
+ * CORBA::Object::_create_request() compliant. The only (pointer)
+ * value that should be passed is 0.
+ */
+ class TAO_DynamicInterface_Export Context
+ {
+ public:
+
+ Context (void);
+
+ ~Context (void);
+
+ // = Pseudo-object methods
+ static Context *_duplicate (Context*);
+ static Context *_nil (void);
+
+ // = Reference counting.
+ CORBA::ULong _incr_refcnt (void);
+ CORBA::ULong _decr_refcnt (void);
+
+ // = All the spec-required functions below will just throw a
+ // CORBA::NO_IMPLEMENT exception and do nothing else.
+
+ const char *context_name (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) const;
+
+ CORBA::Context_ptr parent (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) const;
+
+ void create_child (const char *child_ctx_name,
+ CORBA::Context_out child_ctx
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ void set_one_value (const char *propname,
+ const CORBA::Any &propvalue
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ void set_values (CORBA::NVList_ptr values
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ void delete_values (const char *propname
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ void get_values (const char *start_scope,
+ CORBA::Flags op_flags,
+ const char *pattern,
+ CORBA::NVList_ptr &values
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ // Useful for template programming.
+ typedef CORBA::Context_ptr _ptr_type;
+ typedef CORBA::Context_var _var_type;
+ typedef CORBA::Context_out _out_type;
+
+ private:
+ /// Reference counter.
+ ACE_Atomic_Op<TAO_SYNCH_MUTEX, CORBA::ULong> refcount_;
+ };
+
+ /**
+ * @class ContextList
+ *
+ * @brief ContextList definition taken from CORBA v2.3a Dec 1998
+ *
+ * Maintains a list of strings for Contexts.
+ */
+ class TAO_DynamicInterface_Export ContextList
+ {
+ public:
+ /// Constructor.
+ ContextList (void);
+
+ /// Constructor - initialize given a length and an array of
+ /// strings.
+ ContextList (CORBA::ULong len,
+ char **ctx_list);
+
+ /// Destructor.
+ ~ContextList (void);
+
+ /// Return the number of elements.
+ CORBA::ULong count (void);
+
+ /// Increment the reference count.
+ ContextList_ptr _duplicate (void);
+
+ /// Increment the reference count.
+ static ContextList_ptr _duplicate (ContextList *);
+
+ /// Decrement the reference count and delete if it is 0.
+ void _destroy (void);
+
+ /// Return null pointer of this type.
+ static ContextList_ptr _nil ();
+
+ /// Add a string to the list.
+ void add (char *ctx);
+
+ /// Add and consume a string to the list.
+ void add_consume (char *ctx);
+
+ /// Return the typecode at slot i. Raises the "Bounds" exception.
+ char *item (CORBA::ULong slot
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ /// Remove the typecode at slot i. Raises the "Bounds" exception.
+ void remove (CORBA::ULong slot
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ /// Increment and decrement ref counts.
+ void _incr_refcnt (void);
+ void _decr_refcnt (void);
+
+ // Useful for template programming.
+ typedef CORBA::ContextList_ptr _ptr_type;
+ typedef CORBA::ContextList_var _var_type;
+ typedef CORBA::ContextList_out _out_type;
+
+ private:
+ // Not allowed.
+ ContextList (const ContextList &);
+ ContextList &operator= (const ContextList &);
+
+ /// Reference counter.
+ ACE_Atomic_Op<TAO_SYNCH_MUTEX, CORBA::ULong> ref_count_;
+
+ /// Internal list of typecodes.
+ ACE_Unbounded_Queue<char *> ctx_list_;
+ };
+} // End CORBA namespace.
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/DynamicInterface/Context.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_CONTEXT_H */
diff --git a/TAO/tao/DynamicInterface/Context.inl b/TAO/tao/DynamicInterface/Context.inl
new file mode 100644
index 00000000000..87c338e31e0
--- /dev/null
+++ b/TAO/tao/DynamicInterface/Context.inl
@@ -0,0 +1,97 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+void
+CORBA::release (CORBA::Context_ptr x)
+{
+ if (x != 0)
+ {
+ x->_decr_refcnt ();
+ }
+}
+
+ACE_INLINE
+CORBA::Boolean
+CORBA::is_nil (CORBA::Context_ptr x)
+{
+ return (CORBA::Boolean) (x == 0);
+}
+
+ACE_INLINE
+void
+CORBA::release (CORBA::ContextList *x)
+{
+ if (x != 0)
+ {
+ x->_decr_refcnt ();
+ }
+}
+
+ACE_INLINE
+CORBA::Boolean
+CORBA::is_nil (CORBA::ContextList_ptr x)
+{
+ return (CORBA::Boolean) (x == 0);
+}
+
+// ===================================================================
+
+ACE_INLINE
+CORBA::Context_ptr
+CORBA::Context::_duplicate (CORBA::Context_ptr x)
+{
+ if (x != 0)
+ {
+ x->_incr_refcnt ();
+ }
+
+ return x;
+}
+
+ACE_INLINE
+CORBA::Context_ptr
+CORBA::Context::_nil (void)
+{
+ return (CORBA::Context_ptr)0;
+}
+
+// *************************************************************
+// Inline operations for class CORBA::ContextList
+// *************************************************************
+
+ACE_INLINE
+CORBA::ContextList::ContextList (void)
+{
+}
+
+ACE_INLINE
+CORBA::ULong
+CORBA::ContextList::count (void)
+{
+ return (CORBA::ULong) this->ctx_list_.size ();
+}
+
+ACE_INLINE
+CORBA::ContextList_ptr
+CORBA::ContextList::_nil (void)
+{
+ return (CORBA::ContextList_ptr)0;
+}
+
+ACE_INLINE
+CORBA::ContextList_ptr
+CORBA::ContextList::_duplicate (CORBA::ContextList_ptr x)
+{
+ if (x != 0)
+ {
+ x->_incr_refcnt ();
+ }
+
+ return x;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/DynamicInterface/DII_Arguments.cpp b/TAO/tao/DynamicInterface/DII_Arguments.cpp
new file mode 100644
index 00000000000..d72c4f43420
--- /dev/null
+++ b/TAO/tao/DynamicInterface/DII_Arguments.cpp
@@ -0,0 +1,146 @@
+// $Id$
+
+#include "tao/DynamicInterface/DII_Arguments.h"
+
+#include "tao/AnyTypeCode/NVList.h"
+#include "tao/AnyTypeCode/Any_Impl.h"
+#include "tao/AnyTypeCode/DynamicC.h"
+#include "tao/Exception.h"
+#include "tao/CDR.h"
+
+
+ACE_RCSID (DynamicInterface,
+ DII_Arguments,
+ "$Id$")
+
+#if !defined (__ACE_INLINE__)
+# include "tao/DynamicInterface/DII_Arguments.inl"
+#endif /* ! __ACE_INLINE__ */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ CORBA::Boolean
+ NamedValue_Argument::demarshal (TAO_InputCDR &cdr)
+ {
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ if (this->x_ !=0 && this->x_->value ()->impl ())
+ {
+ this->x_->value ()->impl ()->_tao_decode (cdr
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ }
+ ACE_CATCHANY
+ {
+ return 0;
+ }
+ ACE_ENDTRY;
+ ACE_CHECK_RETURN (false);
+
+ this->byte_order_ = cdr.byte_order ();
+
+ return 1;
+ }
+
+ void
+ NamedValue_Argument::interceptor_value (CORBA::Any *any) const
+ {
+ (*any) <<= *this->x_->value ();
+ }
+
+ // ========================================================================
+
+ CORBA::Boolean
+ NVList_Argument::marshal (TAO_OutputCDR &cdr)
+ {
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ this->x_->_tao_encode (cdr,
+ CORBA::ARG_IN | CORBA::ARG_INOUT
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ return 0;
+ }
+ ACE_ENDTRY;
+ ACE_CHECK_RETURN (false);
+
+ return 1;
+ }
+
+ CORBA::Boolean
+ NVList_Argument::demarshal (TAO_InputCDR &cdr)
+ {
+
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ // Now, get all the "return", "out", and "inout" parameters
+ // from the response message body ... return parameter is
+ // first, the rest are in the order defined in the IDL spec
+ // (which is also the order that DII users are required to
+ // use).
+
+ this->x_->_tao_incoming_cdr (
+ cdr,
+ CORBA::ARG_OUT | CORBA::ARG_INOUT,
+ this->lazy_evaluation_
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ return 0;
+ }
+ ACE_ENDTRY;
+ ACE_CHECK_RETURN (false);
+
+ return 1;
+ }
+
+ void
+ NVList_Argument::interceptor_paramlist (Dynamic::ParameterList *lst)
+ {
+ const CORBA::ULong len = this->x_->count ();
+ lst->length (len);
+
+ for (CORBA::ULong i = 0; i < len; ++i)
+ {
+ if (!this->x_->item (i)->value ())
+ return;
+
+ (*lst)[i].argument.replace (
+ this->x_->item (i)->value ()->impl ());
+
+ switch (this->x_->item (i)->flags ())
+ {
+ case CORBA::ARG_IN:
+ {
+ (*lst)[i].mode = CORBA::PARAM_IN;
+ break;
+ }
+ case CORBA::ARG_INOUT:
+ {
+ (*lst)[i].mode = CORBA::PARAM_INOUT;
+ break;
+ }
+ case CORBA::ARG_OUT:
+ {
+ (*lst)[i].mode = CORBA::PARAM_OUT;
+ break;
+ }
+ default:
+ break;
+ }
+ }
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/DynamicInterface/DII_Arguments.h b/TAO/tao/DynamicInterface/DII_Arguments.h
new file mode 100644
index 00000000000..6f362d7a099
--- /dev/null
+++ b/TAO/tao/DynamicInterface/DII_Arguments.h
@@ -0,0 +1,99 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file DII_Arguments.h
+ *
+ * $Id$
+ *
+ * @author Jeff Parsons <j.parsons@vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_DII_ARGUMENTS_H
+#define TAO_DII_ARGUMENTS_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Argument.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace CORBA
+{
+ class NamedValue;
+ typedef NamedValue *NamedValue_ptr;
+
+ class NVList;
+ typedef NVList *NVList_ptr;
+}
+
+namespace Dynamic
+{
+ class ParameterList;
+}
+
+namespace TAO
+{
+ /**
+ * @class NamedValue_Argument
+ *
+ * @brief Class for the return value of a CORBA::(Server)Request.
+ */
+ class NamedValue_Argument : public RetArgument
+ {
+ public:
+ NamedValue_Argument (CORBA::NamedValue_ptr);
+
+ virtual CORBA::Boolean demarshal (TAO_InputCDR &);
+
+ virtual void interceptor_value (CORBA::Any *any) const;
+
+ int byte_order (void) const;
+
+ private:
+ CORBA::NamedValue_ptr x_;
+
+ /// Byte order that the Request class will use
+ int byte_order_;
+ };
+
+ /**
+ * @class NVList_Argument
+ *
+ * @brief Class for the argument list of a CORBA::(Server)Request.
+ */
+ class NVList_Argument : public InArgument
+ {
+ public:
+ NVList_Argument (CORBA::NVList_ptr,
+ bool lazy_eval);
+
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+
+ virtual CORBA::Boolean demarshal (TAO_InputCDR &);
+
+ // Not an override of a base class method, but a new one that
+ // deals with the argument list as a whole.
+ void interceptor_paramlist (Dynamic::ParameterList *);
+
+ private:
+ CORBA::NVList_ptr x_;
+
+ bool lazy_evaluation_;
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/DynamicInterface/DII_Arguments.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_DII_ARGUMENTS_H */
diff --git a/TAO/tao/DynamicInterface/DII_Arguments.inl b/TAO/tao/DynamicInterface/DII_Arguments.inl
new file mode 100644
index 00000000000..265bffbf7de
--- /dev/null
+++ b/TAO/tao/DynamicInterface/DII_Arguments.inl
@@ -0,0 +1,33 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ ACE_INLINE
+ NamedValue_Argument::NamedValue_Argument (CORBA::NamedValue_ptr x)
+ : x_ (x)
+ , byte_order_ (0)
+ {
+ }
+
+ ACE_INLINE int
+ NamedValue_Argument::byte_order (void) const
+ {
+ return this->byte_order_;
+ }
+
+ // ===================================================================
+
+ ACE_INLINE
+ NVList_Argument::NVList_Argument (CORBA::NVList_ptr x,
+ bool lazy_eval)
+ : x_ (x)
+ , lazy_evaluation_ (lazy_eval)
+ {
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/DynamicInterface/DII_CORBA_methods.h b/TAO/tao/DynamicInterface/DII_CORBA_methods.h
new file mode 100644
index 00000000000..aea9e098cbb
--- /dev/null
+++ b/TAO/tao/DynamicInterface/DII_CORBA_methods.h
@@ -0,0 +1,68 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file DII_CORBA_methods.h
+ *
+ * $Id$
+ *
+ * Declarations of DII methods in the CORBA namespace.
+ *
+ * @author Ossama Othman <ossama@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_DII_CORBA_METHODS_H
+#define TAO_DII_CORBA_METHODS_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/DynamicInterface/dynamicinterface_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/CORBA_methods.h"
+
+#if defined (TAO_EXPORT_MACRO)
+#undef TAO_EXPORT_MACRO
+#endif
+
+#define TAO_EXPORT_MACRO TAO_DynamicInterface_Export
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace CORBA
+{
+ class ContextList;
+ typedef ContextList *ContextList_ptr;
+
+ class Context;
+ typedef Context *Context_ptr;
+
+ class ExceptionList;
+ typedef ExceptionList *ExceptionList_ptr;
+
+ class Request;
+ typedef Request *Request_ptr;
+
+ TAO_NAMESPACE_INLINE_FUNCTION void release (Context_ptr);
+ TAO_NAMESPACE_INLINE_FUNCTION Boolean is_nil (Context_ptr);
+
+ TAO_NAMESPACE_INLINE_FUNCTION void release (ContextList_ptr);
+ TAO_NAMESPACE_INLINE_FUNCTION Boolean is_nil (ContextList_ptr );
+
+ TAO_NAMESPACE_INLINE_FUNCTION void release (ExceptionList_ptr);
+ TAO_NAMESPACE_INLINE_FUNCTION Boolean is_nil (ExceptionList_ptr);
+
+ TAO_NAMESPACE_INLINE_FUNCTION void release (Request_ptr);
+ TAO_NAMESPACE_INLINE_FUNCTION Boolean is_nil (Request_ptr);
+
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_DII_CORBA_METHODS_H */
diff --git a/TAO/tao/DynamicInterface/DII_Invocation.cpp b/TAO/tao/DynamicInterface/DII_Invocation.cpp
new file mode 100644
index 00000000000..6a75d25ad6a
--- /dev/null
+++ b/TAO/tao/DynamicInterface/DII_Invocation.cpp
@@ -0,0 +1,234 @@
+// $Id$
+
+#include "tao/AnyTypeCode/DynamicC.h"
+#include "tao/AnyTypeCode/TypeCode.h"
+
+#include "tao/DynamicInterface/DII_Invocation.h"
+#include "tao/DynamicInterface/Unknown_User_Exception.h"
+#include "tao/DynamicInterface/DII_Arguments.h"
+#include "tao/DynamicInterface/ExceptionList.h"
+#include "tao/DynamicInterface/Request.h"
+#include "tao/DynamicInterface/DII_Reply_Dispatcher.h"
+
+#include "tao/operation_details.h"
+#include "tao/Invocation_Utils.h"
+#include "tao/debug.h"
+#include "tao/AnyTypeCode/Any_Unknown_IDL_Type.h"
+#include "tao/Profile_Transport_Resolver.h"
+#include "tao/ORB_Constants.h"
+
+#include "ace/OS_NS_string.h"
+
+#if TAO_HAS_INTERCEPTORS == 1
+# include "tao/PI/RequestInfo_Util.h"
+#endif
+
+ACE_RCSID (DynamicInterface,
+ DII_Invocation,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ DII_Invocation::DII_Invocation (CORBA::Object_ptr otarget,
+ Profile_Transport_Resolver &resolver,
+ TAO_Operation_Details &detail,
+ CORBA::ExceptionList *excp,
+ CORBA::Request_ptr req,
+ bool response_expected)
+ : Synch_Twoway_Invocation (otarget,
+ resolver,
+ detail,
+ response_expected)
+ , excp_list_ (excp)
+ , host_ (req)
+ {
+ }
+
+#if TAO_HAS_INTERCEPTORS == 1
+ Dynamic::ParameterList *
+ DII_Invocation::arguments (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ // Generate the argument list on demand.
+ Dynamic::ParameterList *parameter_list =
+ TAO_RequestInfo_Util::make_parameter_list (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ Dynamic::ParameterList_var safe_parameter_list = parameter_list;
+
+ TAO::Argument **args =
+ this->details_.args ();
+
+ if (this->details_.args_num () > 1)
+ {
+ // Take the second argument since the first is a return value.
+ TAO::NVList_Argument *tmp_arg =
+ dynamic_cast <TAO::NVList_Argument*> (args[1]);
+
+ tmp_arg->interceptor_paramlist (parameter_list);
+ }
+
+ return safe_parameter_list._retn ();
+ }
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+
+ Invocation_Status
+ DII_Invocation::remote_invocation (ACE_Time_Value *max_wait_time
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::Exception))
+ {
+ return Synch_Twoway_Invocation::remote_twoway (max_wait_time
+ ACE_ENV_ARG_PARAMETER);
+ }
+
+ Invocation_Status
+ DII_Invocation::handle_user_exception (TAO_InputCDR &cdr
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::Exception))
+ {
+ Reply_Guard mon (this,
+ TAO_INVOKE_FAILURE);
+
+ if (TAO_debug_level > 3)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - DII_Invocation::"
+ "handle_user_exception \n"));
+ }
+
+ // Match the exception interface repository id with the
+ // exception in the exception list.
+ // This is important to decode the exception.
+ CORBA::String_var buf;
+
+ TAO_InputCDR tmp_stream (cdr,
+ cdr.start ()->length (),
+ 0);
+
+ // Pull the exception ID out of the marshaling buffer.
+ if (tmp_stream.read_string (buf.inout ()) == 0)
+ {
+ ACE_THROW_RETURN (CORBA::MARSHAL (TAO::VMCID,
+ CORBA::COMPLETED_YES),
+ TAO_INVOKE_FAILURE);
+ }
+
+ for (CORBA::ULong i = 0;
+ this->excp_list_ != 0 && i < this->excp_list_->count ();
+ i++)
+ {
+ CORBA::TypeCode_var tc =
+ this->excp_list_->item (i
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO_INVOKE_FAILURE);
+
+ const char *xid = tc->id (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO_INVOKE_FAILURE);
+
+ if (ACE_OS::strcmp (buf.in (), xid) != 0)
+ {
+ continue;
+ }
+
+ CORBA::Any any;
+ TAO::Unknown_IDL_Type *unk = 0;
+ ACE_NEW_RETURN (unk,
+ TAO::Unknown_IDL_Type (
+ tc.in (),
+ cdr
+ ),
+ TAO_INVOKE_FAILURE);
+
+ any.replace (unk);
+
+ mon.set_status (TAO_INVOKE_USER_EXCEPTION);
+
+ ACE_THROW_RETURN (CORBA::UnknownUserException (any),
+ TAO_INVOKE_USER_EXCEPTION);
+ }
+
+ // If we couldn't find the right exception, report it as
+ // CORBA::UNKNOWN.
+
+ // But first, save the user exception in case we
+ // are being used in a TAO gateway.
+ this->host_->raw_user_exception (cdr);
+
+
+ mon.set_status (TAO_INVOKE_USER_EXCEPTION);
+
+ // @@ It would seem that if the remote exception is a
+ // UserException we can assume that the request was
+ // completed.
+ ACE_THROW_RETURN (CORBA::UNKNOWN (TAO::VMCID,
+ CORBA::COMPLETED_YES),
+ TAO_INVOKE_USER_EXCEPTION);
+
+ }
+
+
+//***************************************************************************
+ DII_Deferred_Invocation::DII_Deferred_Invocation (
+ CORBA::Object_ptr otarget,
+ Profile_Transport_Resolver &resolver,
+ TAO_Operation_Details &detail,
+ TAO_DII_Deferred_Reply_Dispatcher *rd,
+ CORBA::Request_ptr req,
+ bool response_expected)
+ : Asynch_Remote_Invocation (otarget,
+ resolver,
+ detail,
+ rd,
+ response_expected)
+ , host_ (req)
+ {
+
+ }
+
+#if TAO_HAS_INTERCEPTORS == 1
+ //@NOTE: Need to figure a way to share this code
+ Dynamic::ParameterList *
+ DII_Deferred_Invocation::arguments (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ // Generate the argument list on demand.
+ Dynamic::ParameterList *parameter_list =
+ TAO_RequestInfo_Util::make_parameter_list (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ Dynamic::ParameterList_var safe_parameter_list = parameter_list;
+
+ TAO::Argument **args =
+ this->details_.args ();
+
+ if (this->details_.args_num () > 1)
+ {
+ // Take the second argument since the first is a return value.
+ TAO::NVList_Argument *tmp_arg =
+ dynamic_cast <TAO::NVList_Argument*> (args[1]);
+
+ tmp_arg->interceptor_paramlist (parameter_list);
+ }
+
+ return safe_parameter_list._retn ();
+ }
+#endif /* TAO_HAS_INTERCEPTORS == 1*/
+
+ Invocation_Status
+ DII_Deferred_Invocation::remote_invocation (
+ ACE_Time_Value *max_wait_time
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::Exception))
+ {
+ this->safe_rd_->transport (this->resolver_.transport ());
+
+ return Asynch_Remote_Invocation::remote_invocation (
+ max_wait_time
+ ACE_ENV_ARG_PARAMETER);
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/DynamicInterface/DII_Invocation.h b/TAO/tao/DynamicInterface/DII_Invocation.h
new file mode 100644
index 00000000000..ba3a5a6be66
--- /dev/null
+++ b/TAO/tao/DynamicInterface/DII_Invocation.h
@@ -0,0 +1,122 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file DII_Invocation.h
+ *
+ * $Id$
+ *
+ * @brief The DII invocation classes.
+ *
+ * @author Carlos O'Ryan <coryan@cs.wustl.edu>
+ * @author Alexander Babu Arulanthu <alex@cs.wustl.edu>
+ * @author Jeff Parsons <parsons@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_DII_INVOCATION_H
+#define TAO_DII_INVOCATION_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/DynamicInterface/dynamicinterface_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Synch_Invocation.h"
+#include "tao/Messaging/Asynch_Invocation.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_DII_Deferred_Reply_Dispatcher;
+
+namespace Dynamic
+{
+ class ParameterList;
+}
+
+namespace TAO
+{
+ /**
+ */
+ class TAO_DynamicInterface_Export DII_Invocation:
+ public Synch_Twoway_Invocation
+ {
+ public:
+ friend class DII_Invocation_Adapter;
+
+ DII_Invocation (CORBA::Object_ptr otarget,
+ Profile_Transport_Resolver &resolver,
+ TAO_Operation_Details &detail,
+ CORBA::ExceptionList *excp,
+ CORBA::Request_ptr req,
+ bool response_expected = true);
+
+#if TAO_HAS_INTERCEPTORS ==1
+ virtual Dynamic::ParameterList *arguments (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+#endif /*TAO_HAS_INTERCEPTORS == 1*/
+
+ Invocation_Status remote_invocation (
+ ACE_Time_Value *max_wait_time
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::Exception));
+
+ virtual Invocation_Status handle_user_exception (
+ TAO_InputCDR &cdr
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::Exception));
+ private:
+
+ CORBA::ExceptionList *excp_list_;
+
+ /// Back pointer to the DII request that created us.
+ CORBA::Request_ptr host_;
+
+ };
+
+
+ /*
+ *
+ */
+ class TAO_DynamicInterface_Export DII_Deferred_Invocation
+ : public Asynch_Remote_Invocation
+ {
+ public:
+ friend class DII_Deferred_Invocation_Adapter;
+
+ DII_Deferred_Invocation (CORBA::Object_ptr otarget,
+ Profile_Transport_Resolver &resolver,
+ TAO_Operation_Details &detail,
+ TAO_DII_Deferred_Reply_Dispatcher *rd,
+ CORBA::Request_ptr req,
+ bool response_expected = true);
+
+#if TAO_HAS_INTERCEPTORS ==1
+ virtual Dynamic::ParameterList *arguments (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+#endif /*TAO_HAS_INTERCEPTORS == 1*/
+
+ Invocation_Status remote_invocation (
+ ACE_Time_Value *max_wait_time
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::Exception));
+
+ private:
+
+ /// Back pointer to the DII request that created us.
+ CORBA::Request_ptr host_;
+
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_DII_INVOCATION_H */
diff --git a/TAO/tao/DynamicInterface/DII_Invocation_Adapter.cpp b/TAO/tao/DynamicInterface/DII_Invocation_Adapter.cpp
new file mode 100644
index 00000000000..1cf3a172f6a
--- /dev/null
+++ b/TAO/tao/DynamicInterface/DII_Invocation_Adapter.cpp
@@ -0,0 +1,194 @@
+//$Id$
+#include "tao/DynamicInterface/DII_Invocation_Adapter.h"
+#include "tao/DynamicInterface/DII_Invocation.h"
+#include "tao/DynamicInterface/DII_Reply_Dispatcher.h"
+
+#include "tao/Exception.h"
+#include "tao/ORB_Constants.h"
+#include "tao/Profile_Transport_Resolver.h"
+#include "tao/Transport.h"
+#include "tao/Transport.h"
+#include "tao/Pluggable_Messaging.h"
+#include "tao/DynamicInterface/Request.h"
+
+#include "ace/os_include/os_errno.h"
+
+ACE_RCSID (tao,
+ Invocation_Adapter,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ DII_Invocation_Adapter::DII_Invocation_Adapter (CORBA::Object *target,
+ Argument **args,
+ int arg_number,
+ const char *operation,
+ size_t op_len,
+ CORBA::ExceptionList *excp,
+ CORBA::Request *r,
+ Invocation_Mode m)
+
+ : Invocation_Adapter (target,
+ args,
+ arg_number,
+ operation,
+ op_len,
+ 0, // Collocation Proxy broker pointer
+ TAO_TWOWAY_INVOCATION,
+ m)
+ , exception_list_ (excp)
+ , request_ (r)
+ {
+ }
+
+ Invocation_Status
+ DII_Invocation_Adapter::invoke_twoway (
+ TAO_Operation_Details &op,
+ CORBA::Object_var &effective_target,
+ Profile_Transport_Resolver &r,
+ ACE_Time_Value *&max_wait_time
+ ACE_ENV_ARG_DECL)
+ {
+ // Simple sanity check
+ if (this->mode_ != TAO_DII_INVOCATION ||
+ this->type_ != TAO_TWOWAY_INVOCATION)
+ {
+ ACE_THROW_RETURN (CORBA::INTERNAL (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ EINVAL),
+ CORBA::COMPLETED_NO),
+ TAO_INVOKE_FAILURE);
+ }
+
+ r.transport ()->messaging_object ()->out_stream ().reset_byte_order (request_->_tao_byte_order ());
+
+ TAO::DII_Invocation synch (this->target_,
+ r,
+ op,
+ this->exception_list_,
+ this->request_);
+
+
+ Invocation_Status status =
+ synch.remote_invocation (max_wait_time
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO_INVOKE_FAILURE);
+
+
+ if (status == TAO_INVOKE_RESTART &&
+ synch.is_forwarded ())
+ {
+ effective_target =
+ synch.steal_forwarded_reference ();
+
+#if TAO_HAS_INTERCEPTORS == 1
+ const CORBA::Boolean permanent_forward =
+ (synch.reply_status() == TAO_PLUGGABLE_MESSAGE_LOCATION_FORWARD_PERM);
+#else
+ const CORBA::Boolean permanent_forward = false;
+#endif
+ this->object_forwarded (effective_target,
+ r.stub (),
+ permanent_forward
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO_INVOKE_FAILURE);
+ }
+ return status;
+ }
+
+ //================================================================
+ DII_Deferred_Invocation_Adapter::DII_Deferred_Invocation_Adapter (
+ CORBA::Object *target,
+ Argument **args,
+ int arg_number,
+ const char *operation,
+ size_t op_len,
+ Collocation_Proxy_Broker *b,
+ TAO_ORB_Core *oc,
+ CORBA::Request *req,
+ Invocation_Mode mode)
+ : Invocation_Adapter (target,
+ args,
+ arg_number,
+ operation,
+ op_len,
+ b,
+ TAO_TWOWAY_INVOCATION,
+ mode)
+ , request_ (req)
+ , rd_ (0)
+ , orb_core_ (oc)
+ {
+ }
+
+ void
+ DII_Deferred_Invocation_Adapter::invoke (
+ TAO::Exception_Data *ex,
+ unsigned long ex_count
+ ACE_ENV_ARG_DECL)
+ {
+ // New reply dispatcher on the heap, because we will go out of
+ // scope and hand over the reply dispatcher to the ORB.
+ // So this->rd_ is 0, because we do not need to
+ // hold a pointer to it.
+ ACE_NEW_THROW_EX (this->rd_,
+ TAO_DII_Deferred_Reply_Dispatcher (this->request_,
+ this->orb_core_),
+ CORBA::NO_MEMORY ());
+
+ Invocation_Adapter::invoke (ex,
+ ex_count
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ Invocation_Status
+ DII_Deferred_Invocation_Adapter::invoke_twoway (
+ TAO_Operation_Details &op,
+ CORBA::Object_var &effective_target,
+ Profile_Transport_Resolver &r,
+ ACE_Time_Value *&max_wait_time
+ ACE_ENV_ARG_DECL)
+ {
+ // Simple sanity check
+ if (this->mode_ != TAO_DII_DEFERRED_INVOCATION ||
+ this->type_ != TAO_TWOWAY_INVOCATION)
+ {
+ ACE_THROW_RETURN (CORBA::INTERNAL (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ EINVAL),
+ CORBA::COMPLETED_NO),
+ TAO_INVOKE_FAILURE);
+ }
+
+ r.transport ()->messaging_object ()->out_stream ().reset_byte_order (request_->_tao_byte_order ());
+ TAO::DII_Deferred_Invocation synch (
+ this->target_,
+ r,
+ op,
+ this->rd_,
+ this->request_);
+
+ r.transport ()->messaging_object ()->out_stream ().reset_byte_order (request_->_tao_byte_order ());
+
+ Invocation_Status status =
+ synch.remote_invocation (max_wait_time
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO_INVOKE_FAILURE);
+
+ if (status == TAO_INVOKE_RESTART)
+ {
+ effective_target =
+ synch.steal_forwarded_reference ();
+ }
+
+ return status;
+ }
+} // End namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/DynamicInterface/DII_Invocation_Adapter.h b/TAO/tao/DynamicInterface/DII_Invocation_Adapter.h
new file mode 100644
index 00000000000..888601f9793
--- /dev/null
+++ b/TAO/tao/DynamicInterface/DII_Invocation_Adapter.h
@@ -0,0 +1,169 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file DII_Invocation_Adapter.h
+ *
+ * $Id$
+ *
+ * @author Balachandran Natarajan <bala@dre.vanderbilt.edu>
+ */
+//=============================================================================
+#ifndef TAO_DII_INVOCATION_ADAPTER_H
+#define TAO_DII_INVOCATION_ADAPTER_H
+#include /**/ "ace/pre.h"
+
+#include "tao/DynamicInterface/dynamicinterface_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+
+#include "tao/Invocation_Adapter.h"
+
+ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+class ACE_Time_Value;
+ACE_END_VERSIONED_NAMESPACE_DECL
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+class TAO_Operation_Details;
+class TAO_Stub;
+class TAO_ORB_Core;
+class TAO_DII_Deferred_Reply_Dispatcher;
+namespace CORBA
+{
+ class Object;
+ class Environment;
+ class SystemException;
+ class ExceptionList;
+ class Request;
+}
+
+namespace TAO
+{
+ class Argument;
+ class Collocation_Proxy_Broker;
+ struct Exception_Data;
+
+ /**
+ * @class DII_Invocation_Adapter
+ *
+ * @brief Generic interface for the DII invocation object visible
+ */
+ class TAO_DynamicInterface_Export DII_Invocation_Adapter :
+ public Invocation_Adapter
+ {
+ public:
+ /// The only constructor used by the IDL compiler and onlly way to
+ /// create this adapter.
+ /**
+ *
+ * @param target Points to the object on which this invocation is
+ * being invoked.
+ *
+ * @param args Array of pointers to the argument list in the
+ * operation declaration. this includes the return, inout and out
+ * arguments.
+ *
+ * @param arg_number Number of arguments in the above array. This
+ * is the number of elements in the above array.
+ *
+ * @param operation The name of the operation being invoked.
+ *
+ * @param ope_len Number of charecters in the operation name. This
+ * is an optimization which helps us to avoid calling strlen ()
+ * while creating a message format.
+ *
+ * @param cpb The collocation proxy broker for the target if one
+ * exists.
+ *
+ * @param type The operation type which could be a oneway or two
+ * way operation. this information is availbe in the IDL file.
+ *
+ * @param mode Invocation mode. This information is also available
+ * in the IDL file and in the generated code.
+ */
+ DII_Invocation_Adapter (CORBA::Object *target,
+ Argument **args,
+ int arg_number,
+ const char *operation,
+ size_t op_len,
+ CORBA::ExceptionList *exception,
+ CORBA::Request *r,
+ Invocation_Mode m = TAO_DII_INVOCATION);
+
+
+ virtual ~DII_Invocation_Adapter (void) {}
+
+ protected:
+
+ virtual Invocation_Status invoke_twoway (
+ TAO_Operation_Details &op,
+ CORBA::Object_var &effective_target,
+ Profile_Transport_Resolver &r,
+ ACE_Time_Value *&max_wait_time
+ ACE_ENV_ARG_DECL);
+
+ private:
+
+ CORBA::ExceptionList *exception_list_;
+
+ CORBA::Request *request_;
+ private:
+
+ /// Dont allow default initializations
+ DII_Invocation_Adapter (void);
+
+ DII_Invocation_Adapter (const DII_Invocation_Adapter &);
+ DII_Invocation_Adapter & operator= (const DII_Invocation_Adapter &);
+ };
+
+ /**
+ *
+ */
+ class TAO_DynamicInterface_Export DII_Deferred_Invocation_Adapter
+ : protected Invocation_Adapter
+ {
+ public:
+ DII_Deferred_Invocation_Adapter (
+ CORBA::Object *target,
+ Argument **args,
+ int arg_number,
+ const char *operation,
+ size_t op_len,
+ Collocation_Proxy_Broker *b,
+ TAO_ORB_Core *oc,
+ CORBA::Request *req,
+ TAO::Invocation_Mode mode = TAO_DII_DEFERRED_INVOCATION);
+
+ /// Invoke the target
+ virtual void invoke (TAO::Exception_Data *ex,
+ unsigned long ex_count
+ ACE_ENV_ARG_DECL);
+
+
+ protected:
+ virtual Invocation_Status invoke_twoway (
+ TAO_Operation_Details &op,
+ CORBA::Object_var &effective_target,
+ Profile_Transport_Resolver &r,
+ ACE_Time_Value *&max_wait_time
+ ACE_ENV_ARG_DECL);
+
+ private:
+ CORBA::Request *request_;
+
+ /// Reply dispatcher for the current Invocation.
+ TAO_DII_Deferred_Reply_Dispatcher *rd_;
+
+ /// Cache the orb_core
+ TAO_ORB_Core * const orb_core_;
+ };
+} // End namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /*TAO_INVOCATION_ADAPTER_H*/
diff --git a/TAO/tao/DynamicInterface/DII_Reply_Dispatcher.cpp b/TAO/tao/DynamicInterface/DII_Reply_Dispatcher.cpp
new file mode 100644
index 00000000000..877570d611a
--- /dev/null
+++ b/TAO/tao/DynamicInterface/DII_Reply_Dispatcher.cpp
@@ -0,0 +1,147 @@
+// $Id$
+
+#include "tao/DynamicInterface/DII_Reply_Dispatcher.h"
+#include "tao/DynamicInterface/Request.h"
+#include "tao/Environment.h"
+#include "tao/debug.h"
+#include "tao/ORB_Core.h"
+#include "tao/Pluggable_Messaging_Utils.h"
+
+
+ACE_RCSID(DynamicInterface,
+ DII_Reply_Dispatcher,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Constructor.
+TAO_DII_Deferred_Reply_Dispatcher::TAO_DII_Deferred_Reply_Dispatcher (
+ const CORBA::Request_ptr req,
+ TAO_ORB_Core *orb_core)
+ : TAO_Asynch_Reply_Dispatcher_Base (orb_core)
+ , req_ (req)
+{
+}
+
+// Destructor.
+TAO_DII_Deferred_Reply_Dispatcher::~TAO_DII_Deferred_Reply_Dispatcher (void)
+{
+}
+
+// Dispatch the reply.
+int
+TAO_DII_Deferred_Reply_Dispatcher::dispatch_reply (
+ TAO_Pluggable_Reply_Params &params
+ )
+{
+ if (params.input_cdr_ == 0)
+ return -1;
+
+ this->reply_status_ = params.reply_status_;
+
+ // Transfer the <params.input_cdr_>'s content to this->reply_cdr_
+ ACE_Data_Block *db =
+ this->reply_cdr_.clone_from (*params.input_cdr_);
+
+
+ if (db == 0)
+ {
+ if (TAO_debug_level > 2)
+ {
+ ACE_ERROR ((
+ LM_ERROR,
+ "TAO (%P|%t) - DII_Deferred_Reply_Dispatcher::dispatch_reply "
+ "clone_from failed \n"));
+ }
+ return -1;
+ }
+
+ // See whether we need to delete the data block by checking the
+ // flags. We cannot be happy that we initally allocated the
+ // datablocks of the stack. If this method is called twice, as is in
+ // some cases where the same invocation object is used to make two
+ // invocations like forwarding, the release becomes essential.
+ if (ACE_BIT_DISABLED (db->flags (),
+ ACE_Message_Block::DONT_DELETE))
+ db->release ();
+
+ // Steal the buffer, that way we don't do any unnecesary copies of
+ // this data.
+ CORBA::ULong max = params.svc_ctx_.maximum ();
+ CORBA::ULong len = params.svc_ctx_.length ();
+ IOP::ServiceContext* context_list = params.svc_ctx_.get_buffer (1);
+ this->reply_service_info_.replace (max, len, context_list, 1);
+
+ if (TAO_debug_level >= 4)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("(%P | %t):TAO_Asynch_Reply_Dispatcher::dispatch_reply:\n")));
+ }
+
+ ACE_TRY_NEW_ENV
+ {
+ // Call the Request back and send the reply data.
+ this->req_->handle_response (this->reply_cdr_,
+ this->reply_status_
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ if (TAO_debug_level >= 4)
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "Exception during reply handler");
+ }
+ }
+ ACE_ENDTRY;
+
+ // This was dynamically allocated. Now the job is done.
+ (void) this->decr_refcount ();
+
+ return 1;
+}
+
+void
+TAO_DII_Deferred_Reply_Dispatcher::connection_closed (void)
+{
+ ACE_DECLARE_NEW_CORBA_ENV;
+
+ ACE_TRY
+ {
+ // Generate a fake exception....
+ CORBA::COMM_FAILURE comm_failure (0,
+ CORBA::COMPLETED_MAYBE);
+
+ TAO_OutputCDR out_cdr;
+
+ comm_failure._tao_encode (out_cdr
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ // Turn into an output CDR
+ TAO_InputCDR cdr (out_cdr);
+
+ this->req_->handle_response (cdr,
+ TAO_PLUGGABLE_MESSAGE_SYSTEM_EXCEPTION
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ if (TAO_debug_level >= 4)
+ {
+ ACE_PRINT_EXCEPTION (
+ ACE_ANY_EXCEPTION,
+ "DII_Deferred_Reply_Dispacher::connection_closed"
+ );
+ }
+ }
+ ACE_ENDTRY;
+ ACE_CHECK;
+
+ (void) this->decr_refcount ();
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/DynamicInterface/DII_Reply_Dispatcher.h b/TAO/tao/DynamicInterface/DII_Reply_Dispatcher.h
new file mode 100644
index 00000000000..cb450106c5d
--- /dev/null
+++ b/TAO/tao/DynamicInterface/DII_Reply_Dispatcher.h
@@ -0,0 +1,80 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file DII_Reply_Dispatcher.h
+ *
+ * $Id$
+ *
+ * @brief Dispatch the reply appropriately.
+ *
+ * @author Alexander Babu Arulanthu <alex@cs.wustl.edu>
+ */
+
+#ifndef TAO_DII_REPLY_DISPATCHER_H
+#define TAO_DII_REPLY_DISPATCHER_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/DynamicInterface/dynamicinterface_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/orbconf.h"
+#include "tao/Asynch_Reply_Dispatcher_Base.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace CORBA
+{
+ class Request;
+ typedef Request *Request_ptr;
+}
+
+class TAO_ORB_Core;
+
+/**
+ * @class TAO_DII_Deferred_Reply_Dispatcher
+ *
+ * @brief Reply dispatcher for DII deferred requests.
+ */
+
+class TAO_DynamicInterface_Export TAO_DII_Deferred_Reply_Dispatcher
+ : public TAO_Asynch_Reply_Dispatcher_Base
+{
+public:
+ TAO_DII_Deferred_Reply_Dispatcher (const CORBA::Request_ptr req,
+ TAO_ORB_Core *orb_core);
+
+
+
+ // = The Reply_Dispatcher methods
+ virtual int dispatch_reply (TAO_Pluggable_Reply_Params &param);
+
+ virtual void connection_closed (void);
+
+ /// The following methods are not needed for this class..
+ virtual void reply_timed_out (void) {}
+ virtual long schedule_timer (CORBA::ULong ,
+ const ACE_Time_Value &
+ ACE_ENV_ARG_DECL_NOT_USED)
+ {
+ return 0;
+ }
+
+protected:
+ /// Destructor.
+ ~TAO_DII_Deferred_Reply_Dispatcher (void);
+
+private:
+ /// Where the reply needs to go.
+ const CORBA::Request_ptr req_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_REPLY_DISPATCHER_H */
diff --git a/TAO/tao/DynamicInterface/Dynamic_Adapter_Impl.cpp b/TAO/tao/DynamicInterface/Dynamic_Adapter_Impl.cpp
new file mode 100644
index 00000000000..a23c6c4e06e
--- /dev/null
+++ b/TAO/tao/DynamicInterface/Dynamic_Adapter_Impl.cpp
@@ -0,0 +1,157 @@
+// $Id$
+
+#include "tao/DynamicInterface/Dynamic_Adapter_Impl.h"
+
+ACE_RCSID(DynamicInterface, TAO_Dynamic_Adapter_Impl, "$Id$")
+
+#include "tao/DynamicInterface/Request.h"
+#include "tao/DynamicInterface/Server_Request.h"
+#include "tao/ORB_Core.h"
+#include "tao/Exception.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Dynamic_Adapter_Impl::TAO_Dynamic_Adapter_Impl (void)
+{
+}
+
+TAO_Dynamic_Adapter_Impl::~TAO_Dynamic_Adapter_Impl (void)
+{
+}
+
+void
+TAO_Dynamic_Adapter_Impl::create_request (
+ CORBA::Object_ptr obj,
+ CORBA::ORB_ptr orb,
+ const char *operation,
+ CORBA::NVList_ptr arg_list,
+ CORBA::NamedValue_ptr result,
+ CORBA::ExceptionList_ptr exceptions,
+ CORBA::Request_ptr &request,
+ CORBA::Flags req_flags
+ ACE_ENV_ARG_DECL
+ )
+{
+ ACE_NEW_THROW_EX (request,
+ CORBA::Request (obj,
+ orb,
+ operation,
+ arg_list,
+ result,
+ req_flags,
+ exceptions
+ ACE_ENV_ARG_PARAMETER),
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ ENOMEM
+ ),
+ CORBA::COMPLETED_MAYBE
+ ));
+}
+
+CORBA::Request_ptr
+TAO_Dynamic_Adapter_Impl::request (CORBA::Object_ptr obj,
+ CORBA::ORB_ptr orb,
+ const char *operation
+ ACE_ENV_ARG_DECL)
+{
+ CORBA::Request_ptr req = CORBA::Request::_nil ();
+ ACE_NEW_THROW_EX (req,
+ CORBA::Request (obj,
+ orb,
+ operation
+ ACE_ENV_ARG_PARAMETER),
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ ENOMEM
+ ),
+ CORBA::COMPLETED_MAYBE
+ ));
+ ACE_CHECK_RETURN (CORBA::Request::_nil ());
+
+ return req;
+}
+
+CORBA::Boolean
+TAO_Dynamic_Adapter_Impl::context_is_nil (CORBA::Context_ptr ctx)
+{
+ return ctx == 0;
+}
+
+void
+TAO_Dynamic_Adapter_Impl::context_release (CORBA::Context_ptr ctx)
+{
+ if (ctx != 0)
+ {
+ ctx->_decr_refcnt ();
+ }
+}
+
+CORBA::Boolean
+TAO_Dynamic_Adapter_Impl::request_is_nil (CORBA::Request_ptr req)
+{
+ return req == 0;
+}
+
+void
+TAO_Dynamic_Adapter_Impl::request_release (CORBA::Request_ptr req)
+{
+ if (req != 0)
+ {
+ req->_decr_refcnt ();
+ }
+}
+
+CORBA::Boolean
+TAO_Dynamic_Adapter_Impl::server_request_is_nil (CORBA::ServerRequest_ptr req)
+{
+ return req == 0;
+}
+
+void
+TAO_Dynamic_Adapter_Impl::server_request_release (CORBA::ServerRequest_ptr req)
+{
+ if (req != 0)
+ {
+ req->_decr_refcnt ();
+ }
+}
+
+void
+TAO_Dynamic_Adapter_Impl::create_exception_list (
+ CORBA::ExceptionList_ptr &list
+ ACE_ENV_ARG_DECL
+ )
+{
+ ACE_NEW_THROW_EX (list,
+ CORBA::ExceptionList,
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ ENOMEM
+ ),
+ CORBA::COMPLETED_NO
+ ));
+}
+
+int
+TAO_Dynamic_Adapter_Impl::Initializer (void)
+{
+ TAO_ORB_Core::dynamic_adapter_name ("Concrete_Dynamic_Adapter");
+ return ACE_Service_Config::process_directive (ace_svc_desc_TAO_Dynamic_Adapter_Impl);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DEFINE (
+ TAO_Dynamic_Adapter_Impl,
+ ACE_TEXT ("Concrete_Dynamic_Adapter"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (TAO_Dynamic_Adapter_Impl),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0
+ )
+
+ACE_FACTORY_DEFINE (TAO_DynamicInterface, TAO_Dynamic_Adapter_Impl)
diff --git a/TAO/tao/DynamicInterface/Dynamic_Adapter_Impl.h b/TAO/tao/DynamicInterface/Dynamic_Adapter_Impl.h
new file mode 100644
index 00000000000..9537488f66c
--- /dev/null
+++ b/TAO/tao/DynamicInterface/Dynamic_Adapter_Impl.h
@@ -0,0 +1,101 @@
+// -*- C++ -*-
+
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// DynamicInterface
+//
+// = FILENAME
+// Dynamic_Adapter_Impl.h
+//
+// = DESCRIPTION
+// Header file for class TAO_Dynamic_Adapter_Impl.
+//
+// = AUTHOR
+// Jeff Parsons <parsons@cs.wustl.edu>
+//
+// ============================================================================
+
+#ifndef TAO_DYNAMIC_ADAPTER_IMPL_H
+#define TAO_DYNAMIC_ADAPTER_IMPL_H
+#include /**/ "ace/pre.h"
+
+#include "tao/Dynamic_Adapter.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/DynamicInterface/dynamicinterface_export.h"
+#include "ace/Service_Config.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_Dynamic_Adapter_Impl
+ *
+ * Concrete subclass of TAO_Dynamic_Adapter
+ * in the TAO library. This class helps implement various
+ * functions in the CORBA namespace relating to DII/DSI
+ * invocations.
+ */
+class TAO_DynamicInterface_Export TAO_Dynamic_Adapter_Impl
+ : public TAO_Dynamic_Adapter
+{
+public:
+ TAO_Dynamic_Adapter_Impl (void);
+ virtual ~TAO_Dynamic_Adapter_Impl (void);
+
+ // CORBA::Object::_create_request and CORBA::Object::_request.
+
+ virtual void create_request (CORBA::Object_ptr obj,
+ CORBA::ORB_ptr orb,
+ const char *operation,
+ CORBA::NVList_ptr arg_list,
+ CORBA::NamedValue_ptr result,
+ CORBA::ExceptionList_ptr exceptions,
+ CORBA::Request_ptr &request,
+ CORBA::Flags req_flags
+ ACE_ENV_ARG_DECL);
+
+ virtual CORBA::Request_ptr request (CORBA::Object_ptr obj,
+ CORBA::ORB_ptr orb,
+ const char *op
+ ACE_ENV_ARG_DECL);
+
+ // CORBA::is_nil and CORBA::release for Context, Request, and ServerRequest.
+
+ virtual CORBA::Boolean context_is_nil (CORBA::Context_ptr ctx);
+
+ virtual CORBA::Boolean request_is_nil (CORBA::Request_ptr req);
+
+ virtual CORBA::Boolean server_request_is_nil (CORBA::ServerRequest_ptr req);
+
+ virtual void context_release (CORBA::Context_ptr ctx);
+
+ virtual void request_release (CORBA::Request_ptr req);
+
+ virtual void server_request_release (CORBA::ServerRequest_ptr req);
+
+ // CORBA::ORB::create_exception_list.
+
+ virtual void create_exception_list (CORBA::ExceptionList_ptr &list
+ ACE_ENV_ARG_DECL);
+
+ // Used to force the initialization of the ORB code.
+ static int Initializer (void);
+};
+
+static int
+TAO_Requires_Request_Factory_Initializer =
+ TAO_Dynamic_Adapter_Impl::Initializer ();
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE (TAO_Dynamic_Adapter_Impl)
+ACE_FACTORY_DECLARE (TAO_DynamicInterface, TAO_Dynamic_Adapter_Impl)
+
+#include /**/ "ace/post.h"
+#endif /* TAO_DYNAMIC_ADAPTER_IMPL_H */
diff --git a/TAO/tao/DynamicInterface/Dynamic_Implementation.cpp b/TAO/tao/DynamicInterface/Dynamic_Implementation.cpp
new file mode 100644
index 00000000000..6e09d9ff5fa
--- /dev/null
+++ b/TAO/tao/DynamicInterface/Dynamic_Implementation.cpp
@@ -0,0 +1,221 @@
+#include "tao/DynamicInterface/Dynamic_Implementation.h"
+
+ACE_RCSID (DynamicInterface,
+ Dynamic_Implementation,
+ "$Id$")
+
+
+#include "tao/DynamicInterface/Server_Request.h"
+#include "tao/ORB_Core.h"
+#include "tao/TSS_Resources.h"
+#include "tao/IFR_Client_Adapter.h"
+#include "tao/PortableServer/Root_POA.h"
+#include "tao/PortableServer/POA_Current_Impl.h"
+
+#include "ace/Dynamic_Service.h"
+#include "ace/OS_NS_string.h"
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+CORBA::Boolean
+TAO_DynamicImplementation::_is_a (const char *logical_type_id
+ ACE_ENV_ARG_DECL)
+{
+ CORBA::RepositoryId_var id =
+ this->get_id_from_primary_interface (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ return ACE_OS::strcmp (logical_type_id, id.in ()) == 0;
+}
+
+CORBA::Object_ptr
+TAO_DynamicImplementation::_this (ACE_ENV_SINGLE_ARG_DECL)
+{
+ // The _this() function returns a CORBA::Object_ptr for the target
+ // object. Unlike _this() for static skeletons, its return type is
+ // not interface-specific because a DSI servant may very well
+ // incarnate multiple CORBA objects of different types.
+ TAO_Stub *stub = this->_create_stub (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Object::_nil ());
+
+ // Create a object.
+ CORBA::Object_ptr retval = CORBA::Object::_nil ();
+ ACE_NEW_RETURN (retval,
+ CORBA::Object (stub,
+ 1,
+ this),
+ CORBA::Object::_nil ());
+
+ return retval;
+}
+
+CORBA::InterfaceDef_ptr
+TAO_DynamicImplementation::_get_interface (ACE_ENV_SINGLE_ARG_DECL)
+{
+ TAO_IFR_Client_Adapter *adapter =
+ ACE_Dynamic_Service<TAO_IFR_Client_Adapter>::instance (
+ TAO_ORB_Core::ifr_client_adapter_name ()
+ );
+
+ if (adapter == 0)
+ {
+ ACE_THROW_RETURN (CORBA::INTF_REPOS (),
+ 0);
+ }
+
+ CORBA::RepositoryId_var id =
+ this->get_id_from_primary_interface (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ // This doesn't take multiple ORBs into account, but it's being
+ // used only to resolve the IFR, so we should be ok.
+ return adapter->get_interface (TAO_ORB_Core_instance ()->orb (),
+ id.in ()
+ ACE_ENV_ARG_PARAMETER);
+}
+
+const char *
+TAO_DynamicImplementation::_interface_repository_id (void) const
+{
+ // This should never be called.
+ return 0;
+}
+
+void *
+TAO_DynamicImplementation::_downcast (const char *repository_id)
+{
+ ACE_UNUSED_ARG (repository_id);
+
+ // Don't know enough to do better.
+ return this;
+}
+
+TAO_Stub *
+TAO_DynamicImplementation::_create_stub (ACE_ENV_SINGLE_ARG_DECL)
+{
+ // If DynamicImplementation::_this() is invoked outside of the
+ // context of a request invocation on a target object being served
+ // by the DSI servant, it raises the PortableServer::WrongPolicy
+ // exception. See the CORBA C++ mapping, section 1.38.3.
+ TAO::Portable_Server::POA_Current_Impl *poa_current_impl =
+ static_cast <TAO::Portable_Server::POA_Current_Impl *>
+ (TAO_TSS_Resources::instance ()->poa_current_impl_);
+
+ if (poa_current_impl == 0
+ || this != poa_current_impl->servant ())
+ {
+ ACE_THROW_RETURN (PortableServer::POA::WrongPolicy (),
+ 0);
+ }
+
+ PortableServer::POA_var poa =
+ poa_current_impl->get_POA ();
+
+ CORBA::PolicyList_var client_exposed_policies =
+ poa_current_impl->poa ()->client_exposed_policies (
+ poa_current_impl->priority ()
+ ACE_ENV_ARG_PARAMETER
+ );
+ ACE_CHECK_RETURN (0);
+
+ CORBA::RepositoryId_var pinterface =
+ this->_primary_interface (poa_current_impl->object_id (),
+ poa.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ return
+ poa_current_impl->poa ()->key_to_stub (poa_current_impl->object_key (),
+ pinterface.in (),
+ poa_current_impl->priority ()
+ ACE_ENV_ARG_PARAMETER);
+}
+
+void
+TAO_DynamicImplementation::_dispatch (TAO_ServerRequest &request,
+ void * /* context */
+ ACE_ENV_ARG_DECL)
+{
+ // No need to do any of this if the client isn't waiting.
+ if (request.response_expected ())
+ {
+ if (!CORBA::is_nil (request.forward_location ()))
+ {
+ request.init_reply ();
+ request.tao_send_reply ();
+
+ // No need to invoke in this case.
+ return;
+ }
+ else if (request.sync_with_server ())
+ {
+ // The last line before the call to this function
+ // was an ACE_CHECK_RETURN, so if we're here, we
+ // know there is no exception so far, and that's all
+ // a SYNC_WITH_SERVER client request cares about.
+ request.send_no_exception_reply ();
+ }
+ }
+
+ // Create DSI request object.
+ CORBA::ServerRequest *dsi_request = 0;
+ ACE_NEW (dsi_request,
+ CORBA::ServerRequest (request));
+
+ ACE_TRY
+ {
+ // Delegate to user.
+ this->invoke (dsi_request
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ // Only if the client is waiting.
+ if (request.response_expected () && !request.sync_with_server ())
+ {
+ dsi_request->dsi_marshal (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ }
+ ACE_CATCH (CORBA::Exception, ex)
+ {
+ // Only if the client is waiting.
+ if (request.response_expected () && !request.sync_with_server ())
+ {
+ request.tao_send_reply_exception (ex);
+ }
+ }
+ ACE_ENDTRY;
+
+ ::CORBA::release (dsi_request);
+}
+
+CORBA::RepositoryId
+TAO_DynamicImplementation::get_id_from_primary_interface (
+ ACE_ENV_SINGLE_ARG_DECL
+ )
+{
+ // If this method is called outside of the
+ // context of a request invocation on a target object being served
+ // by the DSI servant, it raises the PortableServer::WrongPolicy
+ // exception. See the CORBA C++ mapping, section 1.38.3.
+ TAO::Portable_Server::POA_Current_Impl *poa_current_impl =
+ static_cast <TAO::Portable_Server::POA_Current_Impl *>
+ (TAO_TSS_Resources::instance ()->poa_current_impl_);
+
+ if (poa_current_impl == 0
+ || this != poa_current_impl->servant ())
+ {
+ ACE_THROW_RETURN (PortableServer::POA::WrongPolicy (),
+ 0);
+ }
+
+ PortableServer::POA_var poa =
+ poa_current_impl->get_POA ();
+
+ return this->_primary_interface (poa_current_impl->object_id (),
+ poa.in ()
+ ACE_ENV_ARG_PARAMETER);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/DynamicInterface/Dynamic_Implementation.h b/TAO/tao/DynamicInterface/Dynamic_Implementation.h
new file mode 100644
index 00000000000..b9c17c21ea2
--- /dev/null
+++ b/TAO/tao/DynamicInterface/Dynamic_Implementation.h
@@ -0,0 +1,113 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// DynamicInterface
+//
+// = FILENAME
+// Dynamic_Implementation.h
+//
+// = DESCRIPTION
+// Header file for class TAO_DynamicImplementation.
+//
+// = AUTHOR
+// Irfan Pyarali <irfan@cs.wustl.edu>
+//
+// ============================================================================
+
+#ifndef TAO_DYNAMIC_IMPLEMENTATION_H
+#define TAO_DYNAMIC_IMPLEMENTATION_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/DynamicInterface/dynamicinterface_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/Servant_Base.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace CORBA
+{
+ typedef char *RepositoryId;
+ typedef String_var RepositoryId_var;
+
+ class ServerRequest;
+ typedef ServerRequest *ServerRequest_ptr;
+}
+
+/**
+ * @class TAO_DynamicImplementation
+ *
+ * @brief Base class for DSI.
+ *
+ * It is expected that the <invoke> and <_primary_interface>
+ * methods will be only invoked by the POA in the context of
+ * serving a CORBA request. Invoking this method in other
+ * circumstances may lead to unpredictable results.
+ */
+class TAO_DynamicInterface_Export TAO_DynamicImplementation
+ : public virtual TAO_ServantBase
+{
+public:
+ /// The invoke() method receives requests issued to any CORBA object
+ /// incarnated by the DSI servant and performs the processing
+ /// necessary to execute the request.
+ virtual void invoke (CORBA::ServerRequest_ptr request
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS) = 0;
+
+ /// The _primary_interface() method receives an ObjectId value and a
+ /// POA_ptr as input parameters and returns a valid RepositoryId
+ /// representing the most-derived interface for that oid.
+ virtual CORBA::RepositoryId _primary_interface (
+ const PortableServer::ObjectId &oid,
+ PortableServer::POA_ptr poa
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ ) = 0;
+
+ /// Local implementation of the CORBA::Object::_is_a method.
+ virtual CORBA::Boolean _is_a (const char *logical_type_id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ /// Returns a CORBA::Object_ptr for the target object.
+ CORBA::Object_ptr _this (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS);
+
+ /// Query the Interface Repository for the interface definition.
+ virtual CORBA::InterfaceDef_ptr _get_interface (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ );
+
+protected:
+
+ /// Return 0. Should never be used.
+ virtual const char *_interface_repository_id (void) const;
+
+ /// Simply returns "this"
+ virtual void *_downcast (const char *repository_id);
+
+ /// This is an auxiliary method for _this() and _narrow().
+ virtual TAO_Stub *_create_stub (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS);
+
+ /// Turns around and calls invoke.
+ virtual void _dispatch (TAO_ServerRequest &request,
+ void *context
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+private:
+ /// Encapsulates code common to _is_a(), _get_interface() and _create_stub().
+ CORBA::RepositoryId get_id_from_primary_interface (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ );
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_DYNAMIC_IMPLEMENTATION_H */
diff --git a/TAO/tao/DynamicInterface/ExceptionList.cpp b/TAO/tao/DynamicInterface/ExceptionList.cpp
new file mode 100644
index 00000000000..18de9aee9d0
--- /dev/null
+++ b/TAO/tao/DynamicInterface/ExceptionList.cpp
@@ -0,0 +1,108 @@
+#include "tao/DynamicInterface/ExceptionList.h"
+
+ACE_RCSID (DynamicInterface,
+ ExceptionList,
+ "$Id$")
+
+#include "tao/AnyTypeCode/TypeCode.h"
+#include "tao/Environment.h"
+#include "tao/SystemException.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/DynamicInterface/ExceptionList.inl"
+#endif /* __ACE_INLINE__ */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+CORBA::ExceptionList::ExceptionList (CORBA::ULong len,
+ CORBA::TypeCode_ptr *tc_list)
+ : ref_count_ (1)
+{
+ for (CORBA::ULong i = 0; i < len; ++i)
+ {
+ this->add (tc_list [i]);
+ }
+}
+
+CORBA::ExceptionList::~ExceptionList (void)
+{
+ for (CORBA::ULong i = 0; i < this->count (); ++i)
+ {
+ CORBA::TypeCode_ptr *tc = 0;
+
+ if (this->tc_list_.get (tc, i) == -1)
+ {
+ return;
+ }
+
+ ::CORBA::release (*tc);
+ }
+}
+
+void
+CORBA::ExceptionList::add (CORBA::TypeCode_ptr tc)
+{
+ this->tc_list_.enqueue_tail (CORBA::TypeCode::_duplicate (tc));
+}
+
+void
+CORBA::ExceptionList::add_consume (CORBA::TypeCode_ptr tc)
+{
+ this->tc_list_.enqueue_tail (tc);
+}
+
+CORBA::TypeCode_ptr
+CORBA::ExceptionList::item (CORBA::ULong slot
+ ACE_ENV_ARG_DECL)
+{
+ CORBA::TypeCode_ptr *tc = 0;
+
+ if (this->tc_list_.get (tc, slot) == -1)
+ {
+ ACE_THROW_RETURN (CORBA::TypeCode::Bounds (),
+ CORBA::TypeCode::_nil ());
+ }
+ else
+ {
+ return CORBA::TypeCode::_duplicate (*tc);
+ }
+}
+
+void
+CORBA::ExceptionList::remove (CORBA::ULong
+ ACE_ENV_ARG_DECL)
+{
+ ACE_THROW (CORBA::NO_IMPLEMENT ());
+}
+
+CORBA::ExceptionList_ptr
+CORBA::ExceptionList::_duplicate (void)
+{
+ this->_incr_refcnt ();
+ return this;
+}
+
+void
+CORBA::ExceptionList::_destroy (void)
+{
+ this->_decr_refcnt ();
+}
+
+void
+CORBA::ExceptionList::_incr_refcnt (void)
+{
+ ++this->ref_count_;
+}
+
+void
+CORBA::ExceptionList::_decr_refcnt (void)
+{
+ CORBA::ULong refcount = --this->ref_count_;
+
+ if (refcount == 0)
+ {
+ delete this;
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/DynamicInterface/ExceptionList.h b/TAO/tao/DynamicInterface/ExceptionList.h
new file mode 100644
index 00000000000..f88c3eca2d8
--- /dev/null
+++ b/TAO/tao/DynamicInterface/ExceptionList.h
@@ -0,0 +1,137 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// DynamicInterface
+//
+// = FILENAME
+// ExceptionList.h
+//
+// = DESCRIPTION
+// This file defines the ExceptionList datatype used in
+// dynamic invocations.
+//
+// = AUTHOR
+// Copyright 1994-1995 by Sun Microsystems Inc.
+//
+// ============================================================================
+
+#ifndef TAO_CORBA_EXCEPTIONLIST_H
+#define TAO_CORBA_EXCEPTIONLIST_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/DynamicInterface/dynamicinterface_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/DynamicInterface/DII_CORBA_methods.h"
+#include "tao/AnyTypeCode/AnyTypeCode_methods.h"
+#include "tao/orbconf.h"
+#include "tao/Basic_Types.h"
+#include "tao/default_environment.h"
+#include "tao/Pseudo_VarOut_T.h"
+
+#include "ace/Unbounded_Queue.h"
+#include "ace/Atomic_Op.h"
+#include "ace/CORBA_macros.h"
+#include "ace/Synch_Traits.h"
+
+#if defined (TAO_EXPORT_MACRO)
+#undef TAO_EXPORT_MACRO
+#endif
+#define TAO_EXPORT_MACRO TAO_DynamicInterface_Export
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace CORBA
+{
+ typedef TAO_Pseudo_Var_T<ExceptionList> ExceptionList_var;
+ typedef TAO_Pseudo_Out_T<ExceptionList> ExceptionList_out;
+
+ /**
+ * @class ExceptionList
+ *
+ * @brief ExceptionList definition taken from CORBA v2.2 Feb 1998.
+ *
+ * Maintains a list of TypeCodes for Exceptions.
+ */
+ class TAO_DynamicInterface_Export ExceptionList
+ {
+ public:
+ // = Intialization and termination methods.
+
+ /// Constructor.
+ ExceptionList (void);
+
+ /// Constructor - initialize given a length and an array of
+ /// TypeCodes.
+ ExceptionList (CORBA::ULong len,
+ CORBA::TypeCode_ptr *tc_list);
+
+ /// Destructor.
+ ~ExceptionList (void);
+
+ /// Return the number of elements.
+ CORBA::ULong count (void);
+
+ /// Increase the reference count.
+ ExceptionList_ptr _duplicate (void);
+
+ /// Increase the reference count in the spec defined manner.
+ static ExceptionList_ptr _duplicate (ExceptionList *);
+
+ void _destroy (void);
+
+ static ExceptionList_ptr _nil (void);
+
+ /// Add a TypeCode to the list.
+ void add (CORBA::TypeCode_ptr tc);
+
+ /// Add and consume a TypeCode to the list.
+ void add_consume (CORBA::TypeCode_ptr tc);
+
+ /// Return the typecode at slot i. Raises the "Bounds" exception.
+ CORBA::TypeCode_ptr item (CORBA::ULong slot
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ /// Remove the typecode at slot i. Raises the "Bounds" exception.
+ void remove (CORBA::ULong slot
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ /// Increment and decrement ref counts.
+ void _incr_refcnt (void);
+ void _decr_refcnt (void);
+
+ /// Useful for template programming.
+ typedef CORBA::ExceptionList_ptr _ptr_type;
+ typedef CORBA::ExceptionList_var _var_type;
+ typedef CORBA::ExceptionList_out _out_type;
+
+ private:
+ // = Not allowed.
+ ExceptionList (const ExceptionList &);
+ ExceptionList &operator= (const ExceptionList &);
+
+ /// Reference counter.
+ ACE_Atomic_Op<TAO_SYNCH_MUTEX, CORBA::ULong> ref_count_;
+
+ /// Internal list of typecodes.
+ ACE_Unbounded_Queue<CORBA::TypeCode_ptr> tc_list_;
+ };
+} // End CORBA namespace
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/DynamicInterface/ExceptionList.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_CORBA_EXCEPTIONLIST_H */
diff --git a/TAO/tao/DynamicInterface/ExceptionList.inl b/TAO/tao/DynamicInterface/ExceptionList.inl
new file mode 100644
index 00000000000..d5fe85f4b65
--- /dev/null
+++ b/TAO/tao/DynamicInterface/ExceptionList.inl
@@ -0,0 +1,58 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+void
+CORBA::release (CORBA::ExceptionList_ptr x)
+{
+ if (x != 0)
+ {
+ x->_decr_refcnt ();
+ }
+}
+
+ACE_INLINE
+CORBA::Boolean
+CORBA::is_nil (CORBA::ExceptionList_ptr x)
+{
+ return (CORBA::Boolean) (x == 0);
+}
+
+// ===================================================================
+
+ACE_INLINE
+CORBA::ExceptionList::ExceptionList (void)
+ : ref_count_ (1)
+{
+}
+
+ACE_INLINE
+CORBA::ULong
+CORBA::ExceptionList::count (void)
+{
+ return (CORBA::ULong) this->tc_list_.size ();
+}
+
+ACE_INLINE
+CORBA::ExceptionList_ptr
+CORBA::ExceptionList::_nil (void)
+{
+ return (CORBA::ExceptionList_ptr)0;
+}
+
+ACE_INLINE
+CORBA::ExceptionList_ptr
+CORBA::ExceptionList::_duplicate (CORBA::ExceptionList_ptr x)
+{
+ if (x != 0)
+ {
+ x->_incr_refcnt ();
+ }
+
+ return x;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/DynamicInterface/Request.cpp b/TAO/tao/DynamicInterface/Request.cpp
new file mode 100644
index 00000000000..9027cecb530
--- /dev/null
+++ b/TAO/tao/DynamicInterface/Request.cpp
@@ -0,0 +1,359 @@
+// $Id$
+
+#include "tao/DynamicInterface/Request.h"
+
+ACE_RCSID (DynamicInterface,
+ Request,
+ "$Id$")
+
+#include "tao/DynamicInterface/DII_Invocation_Adapter.h"
+#include "tao/DynamicInterface/DII_Arguments.h"
+#include "tao/DynamicInterface/Context.h"
+
+#include "tao/AnyTypeCode/NVList.h"
+#include "tao/Object.h"
+#include "tao/Pluggable_Messaging_Utils.h"
+#include "tao/AnyTypeCode/Any_Unknown_IDL_Type.h"
+
+#include "ace/Log_Msg.h"
+#include "ace/OS_NS_string.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/DynamicInterface/Request.inl"
+#endif /* ! __ACE_INLINE__ */
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Reference counting for DII Request object.
+
+CORBA::ULong
+CORBA::Request::_incr_refcnt (void)
+{
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
+ ace_mon,
+ this->lock_,
+ 0);
+
+ return this->refcount_++;
+}
+
+CORBA::ULong
+CORBA::Request::_decr_refcnt (void)
+{
+ {
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
+ ace_mon,
+ this->lock_,
+ 0);
+
+ this->refcount_--;
+
+ if (this->refcount_ != 0)
+ {
+ return this->refcount_;
+ }
+ }
+
+ delete this;
+ return 0;
+}
+
+// DII Request class implementation
+
+CORBA::Request::Request (CORBA::Object_ptr obj,
+ CORBA::ORB_ptr orb,
+ const CORBA::Char *op,
+ CORBA::NVList_ptr args,
+ CORBA::NamedValue_ptr result,
+ CORBA::Flags flags,
+ CORBA::ExceptionList_ptr exceptions
+ ACE_ENV_ARG_DECL_NOT_USED)
+ : target_ (CORBA::Object::_duplicate (obj)),
+ orb_ (CORBA::ORB::_duplicate (orb)),
+ opname_ (CORBA::string_dup (op)),
+ args_ (CORBA::NVList::_duplicate (args)),
+ result_ (CORBA::NamedValue::_duplicate (result)),
+ flags_ (flags),
+ // env_ (env),
+ exceptions_ (CORBA::ExceptionList::_duplicate (exceptions)),
+ contexts_ (0),
+ ctx_ (CORBA::Context::_nil ()),
+ refcount_ (1),
+ lazy_evaluation_ (false),
+ response_received_ (0),
+ byte_order_ (TAO_ENCAP_BYTE_ORDER)
+{
+ if (this->exceptions_.in () == 0)
+ {
+ CORBA::ExceptionList *tmp = 0;
+ ACE_NEW (tmp,
+ CORBA::ExceptionList);
+
+ this->exceptions_ = tmp;
+ }
+}
+
+CORBA::Request::Request (CORBA::Object_ptr obj,
+ CORBA::ORB_ptr orb,
+ const CORBA::Char *op
+ ACE_ENV_ARG_DECL_NOT_USED)
+ : target_ (CORBA::Object::_duplicate (obj)),
+ orb_ (CORBA::ORB::_duplicate (orb)),
+ opname_ (CORBA::string_dup (op)),
+ flags_ (0),
+ // env_ (env),
+ contexts_ (0),
+ ctx_ (CORBA::Context::_nil ()),
+ refcount_ (1),
+ lazy_evaluation_ (false),
+ response_received_ (0),
+ byte_order_ (TAO_ENCAP_BYTE_ORDER)
+{
+ CORBA::ExceptionList *tmp = 0;
+ ACE_NEW (tmp,
+ CORBA::ExceptionList);
+
+ this->exceptions_ = tmp;
+
+ ACE_NEW (this->args_,
+ CORBA::NVList);
+
+ ACE_NEW (this->result_,
+ CORBA::NamedValue);
+}
+
+CORBA::Request::~Request (void)
+{
+ ACE_ASSERT (refcount_ == 0);
+
+ ::CORBA::release (this->target_);
+ CORBA::string_free ((char*) this->opname_);
+ this->opname_ = 0;
+ ::CORBA::release (this->args_);
+ ::CORBA::release (this->result_);
+}
+
+// The public DII interfaces: normal and oneway calls.
+//
+// NOTE that using DII, programmers can get the special behaviour of
+// discarding the response for normal calls. This doesn't change the
+// semantics of any OMG-IDL interface, it just streamlines control
+// flow in some exotic situations.
+
+void
+CORBA::Request::invoke (ACE_ENV_SINGLE_ARG_DECL)
+{
+ const CORBA::Boolean argument_flag =
+ this->args_->_lazy_has_arguments ();
+
+ TAO::NamedValue_Argument _tao_retval (this->result_);
+
+
+ TAO::NVList_Argument _tao_in_list (this->args_,
+ this->lazy_evaluation_);
+
+ TAO::Argument *_tao_arg_list [] = {
+ &_tao_retval,
+ &_tao_in_list
+ };
+
+ int number_args = 0;
+
+ if (argument_flag)
+ number_args = 2;
+ else
+ number_args = 1;
+
+ TAO::DII_Invocation_Adapter _tao_call (
+ this->target_,
+ _tao_arg_list,
+ number_args,
+ this->opname_,
+ static_cast<CORBA::ULong> (ACE_OS::strlen (this->opname_)),
+ this->exceptions_.in (),
+ this);
+
+ _tao_call.invoke (0,
+ 0
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // If this request was created by a gateway, then result_
+ // and/or args_ are shared by a CORBA::ServerRequest, whose
+ // reply must be in the same byte order as the reply we are
+ // handling here. So we set the member to be accessed later.
+ this->byte_order_ = _tao_retval.byte_order ();
+}
+
+void
+CORBA::Request::send_oneway (ACE_ENV_SINGLE_ARG_DECL)
+{
+ const CORBA::Boolean argument_flag =
+ this->args_->_lazy_has_arguments ();
+
+ TAO::NamedValue_Argument _tao_retval (this->result_);
+
+
+ TAO::NVList_Argument _tao_in_list (this->args_,
+ this->lazy_evaluation_);
+
+ TAO::Argument *_tao_arg_list [] = {
+ &_tao_retval,
+ &_tao_in_list
+ };
+
+ int number_args = 0;
+
+ if (argument_flag)
+ number_args = 2;
+ else
+ number_args = 1;
+
+ TAO::Invocation_Adapter _tao_call (
+ this->target_,
+ _tao_arg_list,
+ number_args,
+ this->opname_,
+ static_cast<CORBA::ULong> (ACE_OS::strlen (this->opname_)),
+ 0,
+ TAO::TAO_ONEWAY_INVOCATION);
+
+ _tao_call.invoke (0,
+ 0
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+void
+CORBA::Request::send_deferred (ACE_ENV_SINGLE_ARG_DECL)
+{
+ {
+ ACE_GUARD (TAO_SYNCH_MUTEX,
+ ace_mon,
+ this->lock_);
+
+ this->response_received_ = 0;
+ }
+
+ const CORBA::Boolean argument_flag = this->args_->count () ? 1 : 0;
+
+ TAO::NamedValue_Argument _tao_retval (this->result_);
+
+ TAO::NVList_Argument _tao_in_list (this->args_,
+ this->lazy_evaluation_);
+
+ TAO::Argument *_tao_arg_list [] = {
+ &_tao_retval,
+ &_tao_in_list
+ };
+
+ int number_args = 0;
+
+ if (argument_flag)
+ number_args = 2;
+ else
+ number_args = 1;
+
+ TAO::DII_Deferred_Invocation_Adapter _tao_call (
+ this->target_,
+ _tao_arg_list,
+ number_args,
+ this->opname_,
+ static_cast<CORBA::ULong> (ACE_OS::strlen (this->opname_)),
+ 0,
+ this->orb_->orb_core (),
+ this);
+
+ _tao_call.invoke (0,
+ 0
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+void
+CORBA::Request::get_response (ACE_ENV_SINGLE_ARG_DECL)
+{
+ while (!this->response_received_)
+ {
+ (void) this->orb_->perform_work (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ if (this->lazy_evaluation_)
+ {
+ this->args_->evaluate (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+}
+
+CORBA::Boolean
+CORBA::Request::poll_response (ACE_ENV_SINGLE_ARG_DECL)
+{
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
+ ace_mon,
+ this->lock_,
+ 0);
+
+ if (!this->response_received_)
+ {
+ // If we're single-threaded, the application could starve the ORB,
+ // and the response never gets received, so let the ORB do an
+ // atom of work, if necessary, each time we poll.
+ ACE_Time_Value tv (0, 0);
+ (void) this->orb_->perform_work (&tv ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+ }
+
+ return this->response_received_;
+}
+
+void
+CORBA::Request::handle_response (TAO_InputCDR &incoming,
+ CORBA::ULong reply_status
+ ACE_ENV_ARG_DECL)
+{
+ // If this request was created by a gateway, then result_
+ // and/or args_ are shared by a CORBA::ServerRequest, whose
+ // reply must be in the same byte order as the reply we are
+ // handling here. So we set the member to be accessed later.
+ this->byte_order_ = incoming.byte_order ();
+
+ switch (reply_status)
+ {
+ case TAO_PLUGGABLE_MESSAGE_NO_EXCEPTION:
+ if (this->result_ != 0)
+ {
+ // We can be sure that the impl is a TAO::Unknown_IDL_Type.
+ this->result_->value ()->impl ()->_tao_decode (incoming
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ this->args_->_tao_incoming_cdr (incoming,
+ CORBA::ARG_OUT | CORBA::ARG_INOUT,
+ this->lazy_evaluation_
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ {
+ ACE_GUARD (TAO_SYNCH_MUTEX,
+ ace_mon,
+ this->lock_);
+
+ this->response_received_ = 1;
+ }
+
+ break;
+ case TAO_PLUGGABLE_MESSAGE_USER_EXCEPTION:
+ case TAO_PLUGGABLE_MESSAGE_SYSTEM_EXCEPTION:
+ case TAO_PLUGGABLE_MESSAGE_LOCATION_FORWARD:
+ case TAO_PLUGGABLE_MESSAGE_LOCATION_FORWARD_PERM:
+ default:
+ // @@ (JP) Don't know what to do about any of these yet.
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) unhandled reply status\n")));
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/DynamicInterface/Request.h b/TAO/tao/DynamicInterface/Request.h
new file mode 100644
index 00000000000..f7c13f398ab
--- /dev/null
+++ b/TAO/tao/DynamicInterface/Request.h
@@ -0,0 +1,274 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Request.h
+ *
+ * $Id$
+ *
+ * Header file for CORBA's Dynamic Invocation Interface "Request"
+ * type.
+ *
+ * @author Copyright 1994-1995 by Sun Microsystems, Inc.
+ * @author Additions and RequestSeq by Jeff Parsons <parsons@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_REQUEST_H
+#define TAO_REQUEST_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+// To force execution of the static constructor
+// that registers the dynamic service object.
+#include "tao/DynamicInterface/Dynamic_Adapter_Impl.h"
+
+#include "tao/DynamicInterface/ExceptionList.h"
+
+#include "tao/ORB.h"
+#include "tao/Environment.h"
+#include "tao/CDR.h"
+#include "tao/AnyTypeCode/NVList.h"
+
+#include "ace/SString.h"
+
+#if defined (TAO_EXPORT_MACRO)
+#undef TAO_EXPORT_MACRO
+#endif
+#define TAO_EXPORT_MACRO TAO_DynamicInterface_Export
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace CORBA
+{
+ class NVList;
+ typedef NVList *NVList_ptr;
+
+ class Context;
+ typedef Context *Context_ptr;
+
+ class ContextList;
+ typedef ContextList *ContextList_ptr;
+
+ /**
+ * @class Request
+ *
+ * @brief CORBA::Request
+ *
+ * Provides a way to create requests and populate it with parameters
+ * for use in the Dynamic Invocation Interface.
+ */
+ class TAO_DynamicInterface_Export Request
+ {
+ public:
+
+ /// Return the target of this request.
+ CORBA::Object_ptr target (void) const;
+
+ /// Return the operation name for the request.
+ const CORBA::Char *operation (void) const;
+
+ /// Return the arguments for the request.
+ CORBA::NVList_ptr arguments (void);
+
+ /// Return the result for the request.
+ CORBA::NamedValue_ptr result (void);
+
+ /// Return the exceptions resulting from this request.
+ CORBA::ExceptionList_ptr exceptions (void);
+
+ /// Accessor for the Context member.
+ CORBA::Context_ptr ctx (void) const;
+
+ /// Mutator for the Context member.
+ void ctx (CORBA::Context_ptr);
+
+ /// Return a list of the request's result's contexts. Since TAO
+ /// does not implement Contexts, this will always be 0.
+ CORBA::ContextList_ptr contexts (void);
+
+ /**
+ * @name Argument manipulation helper functions.
+ *
+ * Arg adders, one for each type of parameter, with and without
+ * optional name. Returns reference to Any for insertion using
+ * <<=.
+ */
+ //@{
+ CORBA::Any &add_in_arg (void);
+ CORBA::Any &add_in_arg (const char* name);
+ CORBA::Any &add_inout_arg (void);
+ CORBA::Any &add_inout_arg (const char* name);
+ CORBA::Any &add_out_arg (void);
+ CORBA::Any &add_out_arg (const char* name);
+ //@}
+
+ /// Initialize the return type.
+ void set_return_type (CORBA::TypeCode_ptr tc);
+
+ /// Returns reference to Any for extraction using >>=.
+ CORBA::Any &return_value (void);
+
+ /// Perform method resolution and invoke an appropriate method.
+ /**
+ * If the method returns successfully, its result is placed in
+ * the result argument specified on @c create_request. The behavior
+ * is undefined if this @c Request has already been used with a
+ * previous call to @c invoke>, @c send>, or
+ * @send_multiple_requests.
+ *
+ * @note A default argument is set, but please note that this not
+ * recommended as the user may not be able to propagate the
+ * exceptions.
+ */
+ void invoke (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS);
+
+ /// Send a oneway request.
+ /**
+ * @note A default argument is set, but please note that this not
+ * recommended as the user may not be able to propagate the
+ * exceptions.
+ */
+ void send_oneway (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS);
+
+ /**
+ * @name The 'deferred synchronous' methods.
+ *
+ * The 'deferred synchronous' methods.
+ */
+ //@{
+ void send_deferred (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS);
+ void get_response (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS);
+ CORBA::Boolean poll_response (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS);
+ //@}
+
+ /// Callback method for deferred synchronous requests.
+ void handle_response (TAO_InputCDR &incoming,
+ CORBA::ULong reply_status
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ /// Pseudo object methods.
+ static CORBA::Request* _duplicate (CORBA::Request*);
+ static CORBA::Request* _nil (void);
+
+ // = Reference counting.
+ CORBA::ULong _incr_refcnt (void);
+ CORBA::ULong _decr_refcnt (void);
+
+ /// Set the lazy evaluation flag.
+ void _tao_lazy_evaluation (bool lazy_evaluation);
+
+ /// Get the byte order member.
+ int _tao_byte_order (void) const;
+
+ /// Set the byte order member.
+ void _tao_byte_order (int byte_order);
+
+ // Hold on to a user exception in case we are part of a TAO
+ // gateway.
+ void raw_user_exception (TAO_InputCDR &cdr);
+
+ /// Accessor for the input stream containing the exception.
+ ACE_CString &raw_user_exception (void);
+
+
+ /// Proprietary method to check whether a response has been
+ /// received.
+ CORBA::Boolean response_received (void);
+
+ // Useful for template programming.
+ typedef CORBA::Request_ptr _ptr_type;
+ typedef CORBA::Request_var _var_type;
+ typedef CORBA::Request_out _out_type;
+
+ private:
+ friend class ::TAO_Dynamic_Adapter_Impl;
+
+ // The following are not allowed except when called from the
+ // friend class.
+
+ Request (CORBA::Object_ptr obj,
+ CORBA::ORB_ptr orb,
+ const CORBA::Char *op,
+ CORBA::NVList_ptr args,
+ CORBA::NamedValue_ptr result,
+ CORBA::Flags flags,
+ CORBA::ExceptionList_ptr exceptions
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ Request (CORBA::Object_ptr obj,
+ CORBA::ORB_ptr orb,
+ const CORBA::Char *op
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ ~Request (void);
+
+ private:
+
+ /// Target object.
+ CORBA::Object_ptr target_;
+
+ /// Pointer to our ORB.
+ CORBA::ORB_var orb_;
+
+ /// Operation name.
+ const char * opname_;
+
+ /// Parameter list.
+ CORBA::NVList_ptr args_;
+
+ /// Result of the operation.
+ CORBA::NamedValue_ptr result_;
+
+ /// Invocation flags.
+ CORBA::Flags flags_;
+
+ /// @deprecated Holds exceptions.
+ // CORBA::Environment env_;
+
+ /// List of exceptions raised by the operation.
+ CORBA::ExceptionList_var exceptions_;
+
+ /// List of the request's result's contexts.
+ CORBA::ContextList_ptr contexts_;
+
+ /// Context associated with this request.
+ CORBA::Context_ptr ctx_;
+
+ /// Reference counting.
+ CORBA::ULong refcount_;
+
+ /// Protect the refcount_ and response_received_.
+ TAO_SYNCH_MUTEX lock_;
+
+ /// If not zero then the NVList is not evaluated by default.
+ bool lazy_evaluation_;
+
+ /// Set to TRUE upon completion of invoke() or handle_response().
+ CORBA::Boolean response_received_;
+
+ /// Can be reset by a gateway when passing along a request.
+ int byte_order_;
+
+ /// Stores user exception as a CDR stream when this request is
+ /// used in a TAO gateway.
+ ACE_CString raw_user_exception_;
+
+ };
+} // End CORBA namespace.
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/DynamicInterface/Request.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_REQUEST_H */
diff --git a/TAO/tao/DynamicInterface/Request.inl b/TAO/tao/DynamicInterface/Request.inl
new file mode 100644
index 00000000000..f540c8652d6
--- /dev/null
+++ b/TAO/tao/DynamicInterface/Request.inl
@@ -0,0 +1,202 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+void
+CORBA::release (CORBA::Request_ptr x)
+{
+ if (x != 0)
+ {
+ x->_decr_refcnt ();
+ }
+}
+
+ACE_INLINE
+CORBA::Boolean
+CORBA::is_nil (CORBA::Request_ptr x)
+{
+ return (CORBA::Boolean) (x == 0);
+}
+
+// ===================================================================
+
+ACE_INLINE CORBA::Request_ptr
+CORBA::Request::_duplicate (CORBA::Request_ptr x)
+{
+ if (x != 0)
+ {
+ x->_incr_refcnt ();
+ }
+
+ return x;
+}
+
+ACE_INLINE CORBA::Request_ptr
+CORBA::Request::_nil (void)
+{
+ return 0;
+}
+
+ACE_INLINE CORBA::Object_ptr
+CORBA::Request::target (void) const
+{
+ return this->target_;
+}
+
+// Return the operation name for the request.
+ACE_INLINE const CORBA::Char *
+CORBA::Request::operation (void) const
+{
+ return this->opname_;
+}
+
+// Return the arguments for the request.
+ACE_INLINE CORBA::NVList_ptr
+CORBA::Request::arguments (void)
+{
+ return this->args_;
+}
+
+// Return the result for the request.
+ACE_INLINE CORBA::NamedValue_ptr
+CORBA::Request::result (void)
+{
+ return this->result_;
+}
+
+// Return the exceptions resulting from this request.
+ACE_INLINE CORBA::ExceptionList_ptr
+CORBA::Request::exceptions (void)
+{
+ return this->exceptions_.in ();
+}
+
+// Return the request's contexts
+ACE_INLINE CORBA::ContextList_ptr
+CORBA::Request::contexts (void)
+{
+ return this->contexts_;
+}
+
+//// *** DEPRECATED *** Return the <Environment> for this request.
+// ACE_INLINE CORBA::Environment *
+// CORBA::Request::env (void)
+// {
+// return &this->env_;
+// }
+
+// The argument manipulation helper functions
+
+ACE_INLINE CORBA::Any &
+CORBA::Request::add_in_arg (void)
+{
+ ACE_DECLARE_NEW_CORBA_ENV;
+ return this->args_->add_element (CORBA::ARG_IN ACE_ENV_ARG_PARAMETER)->any_;
+}
+
+ACE_INLINE CORBA::Any &
+CORBA::Request::add_in_arg (const CORBA::Char *name)
+{
+ ACE_DECLARE_NEW_CORBA_ENV;
+ return this->args_->add_item (name, CORBA::ARG_IN ACE_ENV_ARG_PARAMETER)->any_;
+}
+
+ACE_INLINE CORBA::Any &
+CORBA::Request::add_inout_arg (void)
+{
+ ACE_DECLARE_NEW_CORBA_ENV;
+ return this->args_->add_element (CORBA::ARG_INOUT ACE_ENV_ARG_PARAMETER)->any_;
+}
+
+ACE_INLINE CORBA::Any &
+CORBA::Request::add_inout_arg (const CORBA::Char *name)
+{
+ ACE_DECLARE_NEW_CORBA_ENV;
+ return this->args_->add_item (name, CORBA::ARG_INOUT ACE_ENV_ARG_PARAMETER)->any_;
+}
+
+ACE_INLINE CORBA::Any &
+CORBA::Request::add_out_arg (void)
+{
+ ACE_DECLARE_NEW_CORBA_ENV;
+ return this->args_->add_element (CORBA::ARG_OUT ACE_ENV_ARG_PARAMETER)->any_;
+}
+
+ACE_INLINE CORBA::Any &
+CORBA::Request::add_out_arg (const CORBA::Char *name)
+{
+ ACE_DECLARE_NEW_CORBA_ENV;
+ return this->args_->add_item (name, CORBA::ARG_OUT ACE_ENV_ARG_PARAMETER)->any_;
+}
+
+ACE_INLINE void
+CORBA::Request::set_return_type (CORBA::TypeCode_ptr tc)
+{
+ this->result_->any_._tao_set_typecode (tc);
+}
+
+ACE_INLINE CORBA::Any &
+CORBA::Request::return_value (void )
+{
+ return this->result_->any_;
+}
+
+ACE_INLINE CORBA::Context_ptr
+CORBA::Request::ctx (void) const
+{
+ return this->ctx_;
+}
+
+ACE_INLINE void
+CORBA::Request::ctx (CORBA::Context_ptr ctx)
+{
+ this->ctx_ = ctx;
+}
+
+ACE_INLINE void
+CORBA::Request::_tao_lazy_evaluation (bool lazy_evaluation)
+{
+ this->lazy_evaluation_ = lazy_evaluation;
+}
+
+ACE_INLINE int
+CORBA::Request::_tao_byte_order (void) const
+{
+ return this->byte_order_;
+}
+
+ACE_INLINE void
+CORBA::Request::_tao_byte_order (int byte_order)
+{
+ this->byte_order_ = byte_order;
+}
+
+ACE_INLINE void
+CORBA::Request::raw_user_exception (TAO_InputCDR &cdr)
+{
+ this->raw_user_exception_.set (cdr.start ()->rd_ptr (),
+ cdr.start ()->length (),
+ 1);
+}
+
+ACE_INLINE ACE_CString &
+CORBA::Request::raw_user_exception (void)
+{
+ return this->raw_user_exception_;
+}
+
+ACE_INLINE CORBA::Boolean
+CORBA::Request::response_received (void)
+{
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
+ ace_mon,
+ this->lock_,
+ 0);
+
+ return this->response_received_;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/DynamicInterface/Server_Request.cpp b/TAO/tao/DynamicInterface/Server_Request.cpp
new file mode 100644
index 00000000000..5582886beee
--- /dev/null
+++ b/TAO/tao/DynamicInterface/Server_Request.cpp
@@ -0,0 +1,243 @@
+// $Id$
+
+// Implementation of the Dynamic Server Skeleton Interface.
+
+#include "tao/DynamicInterface/Server_Request.h"
+
+ACE_RCSID (DynamicInterface,
+ Server_Request,
+ "$Id$")
+
+#include "tao/AnyTypeCode/NVList.h"
+#include "tao/GIOP_Utils.h"
+#include "tao/AnyTypeCode/Marshal.h"
+#include "tao/AnyTypeCode/TypeCode.h"
+#include "tao/AnyTypeCode/Any_Impl.h"
+#include "tao/SystemException.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/DynamicInterface/Server_Request.inl"
+#endif /* ! __ACE_INLINE__ */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Reference counting for DSI ServerRequest object.
+
+CORBA::ULong
+CORBA::ServerRequest::_incr_refcnt (void)
+{
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
+ ace_mon,
+ this->lock_,
+ 0);
+
+ return ++this->refcount_;
+}
+
+CORBA::ULong
+CORBA::ServerRequest::_decr_refcnt (void)
+{
+ {
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
+ ace_mon,
+ this->lock_,
+ 0);
+
+ --this->refcount_;
+
+ if (this->refcount_ != 0)
+ {
+ return this->refcount_;
+ }
+ }
+
+ delete this;
+ return 0;
+}
+
+CORBA::ServerRequest::ServerRequest (TAO_ServerRequest &orb_server_request)
+ : lazy_evaluation_ (0),
+ ctx_ (CORBA::Context::_nil ()),
+ params_ (CORBA::NVList::_nil ()),
+ retval_ (0),
+ exception_ (0),
+ refcount_ (1),
+ orb_server_request_ (orb_server_request),
+ sent_gateway_exception_ (0)
+{
+ this->orb_server_request_.is_dsi ();
+}
+
+CORBA::ServerRequest::~ServerRequest (void)
+{
+ if (this->params_ != 0)
+ {
+ ::CORBA::release (this->params_);
+ }
+
+ delete this->retval_;
+ delete this->exception_;
+}
+
+// Unmarshal in/inout params, and set up to marshal the appropriate
+// inout/out/return values later on.
+void
+CORBA::ServerRequest::arguments (CORBA::NVList_ptr &list
+ ACE_ENV_ARG_DECL)
+{
+ // arguments() must be called before either of these.
+ if (this->params_ != 0 || this->exception_ != 0)
+ {
+ ACE_THROW (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 7, CORBA::COMPLETED_NO));
+ }
+
+ // Save params for later use when marshaling the reply.
+ this->params_ = list;
+
+ this->params_->_tao_incoming_cdr (*this->orb_server_request_.incoming (),
+ CORBA::ARG_IN | CORBA::ARG_INOUT,
+ this->lazy_evaluation_
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Pass this alignment back to the TAO_ServerRequest.
+ this->orb_server_request_.dsi_nvlist_align (
+ this->params_->_tao_target_alignment ()
+ );
+}
+
+// Store the result value. There's either an exception, or a result,
+// but not both of them. Results can be reported (at most once)
+// only after the parameter list has been provided (maybe empty).
+void
+CORBA::ServerRequest::set_result (const CORBA::Any &value
+ ACE_ENV_ARG_DECL)
+{
+ // Setting a result when another result already exists or if an exception
+ // exists or before the args have been processeed is an error.
+ if (this->retval_ != 0 || this->exception_ != 0 || this->params_ == 0)
+ {
+ ACE_THROW (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 8, CORBA::COMPLETED_NO));
+ }
+
+ ACE_NEW_THROW_EX (this->retval_,
+ CORBA::Any (value),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK;
+}
+
+ // NOTE: if "ACE_ENV_SINGLE_ARG_PARAMETER" is set, there has been a system exception,
+ // and it will take precedence over exceptions reported using the
+ // set_exception() mechanism of the ServerRequest, which we assume
+ // the application writer will use to report only user exceptions.
+ // If both types of exception happen on the same invocation, the user
+ // exception will be lost.
+
+// Store the exception value.
+void
+CORBA::ServerRequest::set_exception (const CORBA::Any &value
+ ACE_ENV_ARG_DECL)
+{
+ CORBA::TypeCode_var tc = value.type ();
+
+ CORBA::TCKind const kind = tc->kind (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // set_exception() can be called at any time, but the Any arg MUST
+ // contain an exception.
+ if (kind != CORBA::tk_except)
+ {
+ ACE_THROW (CORBA::BAD_PARAM (CORBA::OMGVMCID | 21,
+ CORBA::COMPLETED_MAYBE));
+ }
+
+ ACE_NEW_THROW_EX (this->exception_,
+ CORBA::Any (value),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK;
+
+ this->orb_server_request_.exception_type (TAO_GIOP_USER_EXCEPTION);
+}
+
+// This method will be utilized by the DSI servant to marshal outgoing
+// parameters.
+void
+CORBA::ServerRequest::dsi_marshal (ACE_ENV_SINGLE_ARG_DECL)
+{
+ // There was a user exception, no need to marshal any parameters.
+ if (this->sent_gateway_exception_)
+ {
+ return;
+ }
+
+ if (this->orb_server_request_.exception_type () == TAO_GIOP_NO_EXCEPTION)
+ {
+ // In DSI, we can't rely on the skeleton to do this.
+ if (this->retval_ == 0 && this->params_ == 0)
+ {
+ this->orb_server_request_.argument_flag (0);
+ }
+
+ this->orb_server_request_.init_reply ();
+
+ // Send the return value, if any.
+ if (this->retval_ != 0)
+ {
+ this->retval_->impl ()->marshal_value (
+ *this->orb_server_request_.outgoing ()
+ );
+ }
+
+ // Send the "inout" and "out" parameters.
+ if (this->params_ != 0)
+ {
+ this->params_->_tao_encode (
+ *this->orb_server_request_.outgoing (),
+ CORBA::ARG_INOUT | CORBA::ARG_OUT
+ ACE_ENV_ARG_PARAMETER
+ );
+ ACE_CHECK;
+ }
+ }
+ else
+ {
+ // This defaults to 1, but just to be safe...
+ this->orb_server_request_.argument_flag (1);
+
+ // Write the reply header to the ORB request's outgoing CDR stream.
+ this->orb_server_request_.init_reply ();
+
+ this->exception_->impl ()->marshal_value (
+ *this->orb_server_request_.outgoing ()
+ );
+ }
+
+ this->orb_server_request_.tao_send_reply ();
+}
+
+void
+CORBA::ServerRequest::gateway_exception_reply (ACE_CString &raw_exception)
+{
+ // This defaults to 1, but just to be safe...
+ this->orb_server_request_.argument_flag (1);
+
+ // This reply path handles only user exceptions.
+ this->orb_server_request_.exception_type (TAO_GIOP_USER_EXCEPTION);
+
+ this->orb_server_request_.init_reply ();
+
+ // We know nothing about this exception, so we marshal it as a block
+ // of bytes. The outgoing stream's byte order has already been matched
+ // to the original source of the reply.
+ this->orb_server_request_.outgoing ()->write_octet_array (
+ reinterpret_cast<const CORBA::Octet *> (raw_exception.fast_rep ()),
+ static_cast<CORBA::ULong> (raw_exception.length () + ACE_CDR::MAX_ALIGNMENT)
+ );
+
+ // This will prevent the marshaling of any parameters into this reply.
+ this->sent_gateway_exception_ = 1;
+
+ this->orb_server_request_.tao_send_reply ();
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/DynamicInterface/Server_Request.h b/TAO/tao/DynamicInterface/Server_Request.h
new file mode 100644
index 00000000000..39cae0c7b82
--- /dev/null
+++ b/TAO/tao/DynamicInterface/Server_Request.h
@@ -0,0 +1,187 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO
+//
+// = FILENAME
+// Server_Request.h
+//
+// = DESCRIPTION
+// Header file for CORBA's Dynamic Server Skeleton Interface's
+// "Server Request" type.
+//
+// = AUTHOR
+// Copyright 1994-1995 by Sun Microsystems, Inc. and Chris Cleeland.
+// Modifications by Aniruddha Gokhale based on CORBAv2.2 Feb 98
+// ============================================================================
+
+#ifndef TAO_CORBA_SERVER_REQUEST_H
+#define TAO_CORBA_SERVER_REQUEST_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/DynamicInterface/Context.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+// To force execution of the static constructor
+// that registers the dynamic service object.
+#include "tao/DynamicInterface/Dynamic_Adapter_Impl.h"
+
+#include "tao/TAO_Server_Request.h"
+#include "tao/CDR.h"
+
+#if defined (TAO_EXPORT_MACRO)
+#undef TAO_EXPORT_MACRO
+#endif
+#define TAO_EXPORT_MACRO TAO_DynamicInterface_Export
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace CORBA
+{
+ class ServerRequest;
+ typedef ServerRequest *ServerRequest_ptr;
+
+ TAO_NAMESPACE_INLINE_FUNCTION void release (ServerRequest_ptr);
+ TAO_NAMESPACE_INLINE_FUNCTION Boolean is_nil (ServerRequest_ptr);
+
+ typedef TAO_Pseudo_Var_T<ServerRequest> ServerRequest_var;
+ typedef TAO_Pseudo_Out_T<ServerRequest> ServerRequest_out;
+
+ /**
+ * @class ServerRequest
+ *
+ * @brief Class representing the CORBA ServerRequest pseudo-object.
+ *
+ * Instantiated by the POA for DSI requests and passed up
+ * to the application. Contains a reference to the instance
+ * of TAO_ServerRequest that is passed up to the POA from
+ * the ORB.
+ */
+ class TAO_DynamicInterface_Export ServerRequest
+ {
+ public:
+ /// Constructor.
+ ServerRequest (TAO_ServerRequest &orb_server_request);
+
+ /// Destructor.
+ ~ServerRequest (void);
+
+ /// Implementation uses this to provide the ORB with the operation's
+ /// parameter list ... on return, their values are available; the
+ /// list fed in has typecodes and (perhap) memory assigned.
+ void arguments (CORBA::NVList_ptr &list
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ /// Implementation uses this to provide the operation result
+ /// ... illegal if exception() was called or params() was not called.
+ ///
+ /// XXX Implementation should be able to assume response has been
+ /// sent when this returns, and reclaim memory it allocated.
+ void set_result (const CORBA::Any &value
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ /// Implementation uses this to provide the exception value which is
+ /// the only result of this particular invocation.
+ ///
+ /// XXX Implementation should be able to assume response has been
+ /// sent when this returns, and reclaim memory it allocated.
+ void set_exception (const CORBA::Any &value
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ // = Get various universal call attributes.
+
+ // e.g., who made the call, the target of the call, what ORB and OA
+ // that target object uses.
+ //
+ // NOTE: none of these report exceptions; unavailability of any of
+ // this stuff is a catastrophic error since this is all part of the
+ // basic CORBA Object Model.
+
+ /// Marshal outgoing parameters.
+ void dsi_marshal (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS);
+
+ /// Accessor for the Context member.
+ CORBA::Context_ptr ctx (void) const;
+
+ /// Mutator for the Context member.
+ void ctx (CORBA::Context_ptr);
+
+ /// Get the operation name.
+ const char *operation (void) const;
+
+ // Pseudo object methods.
+ static ServerRequest_ptr _duplicate (ServerRequest_ptr);
+ static ServerRequest_ptr _nil (void);
+
+ // = Reference counting.
+ CORBA::ULong _incr_refcnt (void);
+ CORBA::ULong _decr_refcnt (void);
+
+ /// Set the lazy evaluation flag.
+ void _tao_lazy_evaluation (bool lazy_evaluation);
+
+ /// Get the byte order of the incoming CDR stream.
+ int _tao_incoming_byte_order (void) const;
+
+ /// Set the byte order of the outgoing CDR stream.
+ void _tao_reply_byte_order (int byte_order);
+
+ /// Return a reference to the underlying TAO_ServerRequest object.
+ TAO_ServerRequest & _tao_server_request (void);
+
+ /// Returns a user exception through a TAO gateway without
+ /// knowing its type.
+ void gateway_exception_reply (ACE_CString &raw_exception);
+
+ /// Useful for template programming.
+ typedef CORBA::ServerRequest_ptr _ptr_type;
+ typedef CORBA::ServerRequest_var _var_type;
+ typedef CORBA::ServerRequest_out _out_type;
+
+ private:
+ /// If zero then the NVList is evaluated ASAP.
+ bool lazy_evaluation_;
+
+ /// Context associated with this request.
+ CORBA::Context_ptr ctx_;
+
+ /// Incoming parameters.
+ CORBA::NVList_ptr params_;
+
+ /// Return value.
+ CORBA::Any_ptr retval_;
+
+ /// Any exception which might be raised.
+ CORBA::Any_ptr exception_;
+
+ /// Reference counting.
+ CORBA::ULong refcount_;
+
+ /// Protect the refcount_ and response_received_.
+ TAO_SYNCH_MUTEX lock_;
+
+ /// Request from the ORB.
+ TAO_ServerRequest &orb_server_request_;
+
+ /// Have we sent a user exception obtained from a gateway?
+ int sent_gateway_exception_;
+ };
+} // End CORBA namespace
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/DynamicInterface/Server_Request.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_CORBA_SERVER_REQUEST_H */
diff --git a/TAO/tao/DynamicInterface/Server_Request.inl b/TAO/tao/DynamicInterface/Server_Request.inl
new file mode 100644
index 00000000000..b8e4bf6099f
--- /dev/null
+++ b/TAO/tao/DynamicInterface/Server_Request.inl
@@ -0,0 +1,86 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+void
+CORBA::release (CORBA::ServerRequest_ptr x)
+{
+ if (x != 0)
+ {
+ x->_decr_refcnt ();
+ }
+}
+
+ACE_INLINE
+CORBA::Boolean
+CORBA::is_nil (CORBA::ServerRequest_ptr x)
+{
+ return x == 0;
+}
+
+// ===================================================================
+
+ACE_INLINE CORBA::ServerRequest_ptr
+CORBA::ServerRequest::_duplicate (CORBA::ServerRequest_ptr x)
+{
+ if (x != 0)
+ {
+ x->_incr_refcnt ();
+ }
+
+ return x;
+}
+
+ACE_INLINE CORBA::ServerRequest_ptr
+CORBA::ServerRequest::_nil (void)
+{
+ return (CORBA::ServerRequest_ptr)0;
+}
+
+ACE_INLINE CORBA::Context_ptr
+CORBA::ServerRequest::ctx (void) const
+{
+ return this->ctx_;
+}
+
+ACE_INLINE void
+CORBA::ServerRequest::ctx (CORBA::Context_ptr ctx)
+{
+ this->ctx_ = ctx;
+}
+
+ACE_INLINE const char *
+CORBA::ServerRequest::operation (void) const
+{
+ return this->orb_server_request_.operation ();
+}
+
+ACE_INLINE void
+CORBA::ServerRequest::_tao_lazy_evaluation (bool lazy_evaluation)
+{
+ this->lazy_evaluation_ = lazy_evaluation;
+}
+
+ACE_INLINE int
+CORBA::ServerRequest::_tao_incoming_byte_order (void) const
+{
+ return this->orb_server_request_.incoming ()->byte_order ();
+}
+
+ACE_INLINE void
+CORBA::ServerRequest::_tao_reply_byte_order (int byte_order)
+{
+ this->orb_server_request_.outgoing ()->reset_byte_order (byte_order);
+}
+
+
+ACE_INLINE TAO_ServerRequest &
+CORBA::ServerRequest::_tao_server_request (void)
+{
+ return this->orb_server_request_;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/DynamicInterface/TAO_DynamicInterface.pc.in b/TAO/tao/DynamicInterface/TAO_DynamicInterface.pc.in
new file mode 100644
index 00000000000..744011abbe0
--- /dev/null
+++ b/TAO/tao/DynamicInterface/TAO_DynamicInterface.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: TAO_DynamicInterface
+Description: TAO Dynamic Interface Library
+Requires: TAO_Messaging, TAO_PI, TAO_CodecFactory, TAO_PortableServer, TAO_Valuetype, TAO_AnyTypeCode, TAO
+Version: @VERSION@
+Libs: -L${libdir} -lTAO_DynamicInterface
+Cflags: -I${includedir}
diff --git a/TAO/tao/DynamicInterface/TAO_DynamicInterface.rc b/TAO/tao/DynamicInterface/TAO_DynamicInterface.rc
new file mode 100644
index 00000000000..5cca9fe43d2
--- /dev/null
+++ b/TAO/tao/DynamicInterface/TAO_DynamicInterface.rc
@@ -0,0 +1,30 @@
+#include "..\Version.h"
+
+1 VERSIONINFO
+ FILEVERSION TAO_MAJOR_VERSION,TAO_MINOR_VERSION,TAO_BETA_VERSION,0
+ PRODUCTVERSION TAO_MAJOR_VERSION,TAO_MINOR_VERSION,TAO_BETA_VERSION,0
+ FILEFLAGSMASK 0x3fL
+ FILEFLAGS 0x0L
+ FILEOS 0x4L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904B0"
+ BEGIN
+ VALUE "FileDescription", "DynamicInterface\0"
+ VALUE "FileVersion", TAO_VERSION "\0"
+ VALUE "InternalName", "TAO_DynamicInterfaceDLL\0"
+ VALUE "LegalCopyright", "\0"
+ VALUE "LegalTrademarks", "\0"
+ VALUE "OriginalFilename", "TAO_DynamicInterface.DLL\0"
+ VALUE "ProductName", "TAO\0"
+ VALUE "ProductVersion", TAO_VERSION "\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
diff --git a/TAO/tao/DynamicInterface/Unknown_User_Exception.cpp b/TAO/tao/DynamicInterface/Unknown_User_Exception.cpp
new file mode 100644
index 00000000000..81d9935832f
--- /dev/null
+++ b/TAO/tao/DynamicInterface/Unknown_User_Exception.cpp
@@ -0,0 +1,139 @@
+// $Id$
+
+#include "tao/DynamicInterface/Unknown_User_Exception.h"
+
+#include "tao/AnyTypeCode/Any.h"
+#include "tao/Environment.h"
+#include "tao/AnyTypeCode/TypeCode_Constants.h"
+#include "tao/AnyTypeCode/Null_RefCount_Policy.h"
+#include "tao/AnyTypeCode/TypeCode_Struct_Field.h"
+#include "tao/AnyTypeCode/Struct_TypeCode_Static.h"
+#include "tao/SystemException.h"
+
+#include "ace/OS_NS_string.h"
+#include "ace/OS_Memory.h"
+
+
+ACE_RCSID (DynamicInterface,
+ Unknown_User_Exception,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+CORBA::UnknownUserException::UnknownUserException (void)
+ : CORBA::UserException ("IDL:omg.org/CORBA/UnknownUserException:1.0",
+ "UnknownUserException"),
+ exception_ (0)
+{
+}
+
+CORBA::UnknownUserException::UnknownUserException (CORBA::Any &ex)
+ : CORBA::UserException ("IDL:omg.org/CORBA/UnknownUserException:1.0",
+ "UnknownUserException")
+{
+ ACE_NEW (this->exception_,
+ CORBA::Any (ex));
+}
+
+CORBA::UnknownUserException::UnknownUserException (
+ const CORBA::UnknownUserException& e
+ )
+ : CORBA::UserException (e._rep_id (),
+ e._name ())
+{
+ ACE_NEW (this->exception_,
+ CORBA::Any (*e.exception_));
+}
+
+CORBA::UnknownUserException::~UnknownUserException (void)
+{
+ delete this->exception_;
+}
+
+CORBA::Any &
+CORBA::UnknownUserException::exception (void)
+{
+ return *this->exception_;
+}
+
+CORBA::UnknownUserException *
+CORBA::UnknownUserException::_downcast (CORBA::Exception *ex)
+{
+ return dynamic_cast<CORBA::UnknownUserException *> (ex);
+}
+
+CORBA::UnknownUserException const *
+CORBA::UnknownUserException::_downcast (CORBA::Exception const * ex)
+{
+ return dynamic_cast<CORBA::UnknownUserException const *> (ex);
+}
+
+void
+CORBA::UnknownUserException::_raise (void) const
+{
+ TAO_RAISE (*this);
+}
+
+CORBA::Exception *
+CORBA::UnknownUserException::_tao_duplicate (void) const
+{
+ CORBA::Exception *result;
+ ACE_NEW_RETURN (
+ result,
+ CORBA::UnknownUserException (*this),
+ 0
+ );
+ return result;
+}
+
+void
+CORBA::UnknownUserException::_tao_encode (
+ TAO_OutputCDR &
+ ACE_ENV_ARG_DECL
+ ) const
+{
+ ACE_THROW (CORBA::MARSHAL ());
+}
+
+void
+CORBA::UnknownUserException::_tao_decode (TAO_InputCDR &
+ ACE_ENV_ARG_DECL)
+{
+ ACE_THROW (CORBA::MARSHAL ());
+}
+
+CORBA::TypeCode_ptr
+CORBA::UnknownUserException::_tao_type (void) const
+{
+ return CORBA::_tc_UnknownUserException;
+}
+
+namespace TAO
+{
+ namespace TypeCode
+ {
+ Struct_Field<char const *, CORBA::TypeCode_ptr const *> const
+ fields_CORBA_UnknownUserException[] =
+ {
+ { "exception", &CORBA::_tc_any }
+ };
+
+ Struct<char const *,
+ CORBA::TypeCode_ptr const *,
+ Struct_Field<char const *, CORBA::TypeCode_ptr const *> const *,
+ TAO::Null_RefCount_Policy> tc_UnknownUserException (
+ CORBA::tk_except,
+ "IDL:omg.org/CORBA/UnknownUserException:1.0",
+ "UnknownUserException",
+ TAO::TypeCode::fields_CORBA_UnknownUserException,
+ 1 /* # of fields */);
+ }
+}
+
+namespace CORBA
+{
+ CORBA::TypeCode_ptr const _tc_UnknownUserException =
+ &TAO::TypeCode::tc_UnknownUserException;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/DynamicInterface/Unknown_User_Exception.h b/TAO/tao/DynamicInterface/Unknown_User_Exception.h
new file mode 100644
index 00000000000..ab618060852
--- /dev/null
+++ b/TAO/tao/DynamicInterface/Unknown_User_Exception.h
@@ -0,0 +1,112 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Unknown_User_Exception.h
+ *
+ * $Id$
+ *
+ * Defines the way an exception is reported by a DII request.
+ *
+ *
+ * @author Portions Copyright 1994-1995 by Sun Microsystems Inc.
+ * @author Portions Copyright 1997-2003 by Washington University
+ */
+//=============================================================================
+
+
+#ifndef TAO_UNKNOWN_USER_EXCEPTION_H
+#define TAO_UNKNOWN_USER_EXCEPTION_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/DynamicInterface/dynamicinterface_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/UserException.h"
+
+#if defined (TAO_EXPORT_MACRO)
+#undef TAO_EXPORT_MACRO
+#endif
+#define TAO_EXPORT_MACRO TAO_DynamicInterface_Export
+
+#if defined (TAO_EXPORT_NESTED_CLASSES)
+# if defined (TAO_EXPORT_NESTED_MACRO)
+# undef TAO_EXPORT_NESTED_MACRO
+# endif /* defined (TAO_EXPORT_NESTED_MACRO) */
+# define TAO_EXPORT_NESTED_MACRO TAO_DynamicInterface_Export
+#endif /* TAO_EXPORT_NESTED_CLASSES */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace CORBA
+{
+ /**
+ * @class UnknownUserException
+ *
+ * @brief UnknownUserException
+ *
+ * When user exceptions are received by a DII invocation the ORB
+ * is unable to create the exception with the right dynamic type;
+ * to workaround this problem it throws a
+ * @c CORBA::UnknownUserException that contains the exception inside
+ * an Any.
+ */
+ class TAO_DynamicInterface_Export UnknownUserException
+ : public CORBA::UserException
+ {
+ public:
+
+ /// Constructor.
+ UnknownUserException (void);
+
+ /// Constructor.
+ UnknownUserException (CORBA::Any& exception);
+
+ /// Copy constructor.
+ UnknownUserException (const UnknownUserException& e);
+
+ /// Destructor.
+ virtual ~UnknownUserException (void);
+
+ /// Return the any containing the user exception.
+ CORBA::Any& exception (void);
+
+ /// To throw an UnknownUserException of this type.
+ virtual void _raise (void) const;
+
+ virtual CORBA::Exception *_tao_duplicate (void) const;
+ virtual void _tao_encode (TAO_OutputCDR &cdr
+ ACE_ENV_ARG_DECL) const;
+ virtual void _tao_decode (TAO_InputCDR &cdr
+ ACE_ENV_ARG_DECL);
+
+ /// Narrow to an UnknowUserException.
+ static UnknownUserException * _downcast (CORBA::Exception *ex);
+ static UnknownUserException const * _downcast (
+ CORBA::Exception const * ex);
+
+ // = TAO specific extension.
+
+ /// This class has a specific typecode.
+ virtual CORBA::TypeCode_ptr _tao_type (void) const;
+
+ private:
+ /// Holder for the actual exception.
+ CORBA::Any *exception_;
+ };
+
+ // The CORBA::UnknownUserException TypeCode.
+ extern TAO_DynamicInterface_Export TypeCode_ptr const
+ _tc_UnknownUserException;
+
+} // End CORBA namespace.
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_UNKNOWN_USER_EXCEPTION_H */
diff --git a/TAO/tao/DynamicInterface/dynamicinterface_export.h b/TAO/tao/DynamicInterface/dynamicinterface_export.h
new file mode 100644
index 00000000000..f1e680434fc
--- /dev/null
+++ b/TAO/tao/DynamicInterface/dynamicinterface_export.h
@@ -0,0 +1,40 @@
+// -*- C++ -*-
+// $Id$
+// Definition for Win32 Export directives.
+// This file is generated automatically by
+// generate_export_file.pl
+// ------------------------------
+#ifndef TAO_DYNAMICINTERFACE_EXPORT_H
+#define TAO_DYNAMICINTERFACE_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if defined (TAO_AS_STATIC_LIBS)
+# if !defined (TAO_DYNAMICINTERFACE_HAS_DLL)
+# define TAO_DYNAMICINTERFACE_HAS_DLL 0
+# endif /* ! TAO_DYNAMICINTERFACE_HAS_DLL */
+#else
+# if !defined (TAO_DYNAMICINTERFACE_HAS_DLL)
+# define TAO_DYNAMICINTERFACE_HAS_DLL 1
+# endif /* ! TAO_DYNAMICINTERFACE_HAS_DLL */
+#endif
+
+#if defined (TAO_DYNAMICINTERFACE_HAS_DLL) && (TAO_DYNAMICINTERFACE_HAS_DLL == 1)
+# if defined (TAO_DYNAMICINTERFACE_BUILD_DLL)
+# define TAO_DynamicInterface_Export ACE_Proper_Export_Flag
+# define TAO_DYNAMICINTERFACE_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# define TAO_DYNAMICINTERFACE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# else
+# define TAO_DynamicInterface_Export ACE_Proper_Import_Flag
+# define TAO_DYNAMICINTERFACE_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# define TAO_DYNAMICINTERFACE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# endif /* TAO_DYNAMICINTERFACE_BUILD_DLL */
+#else
+# define TAO_DynamicInterface_Export
+# define TAO_DYNAMICINTERFACE_SINGLETON_DECLARATION(T)
+# define TAO_DYNAMICINTERFACE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+#endif /* TAO_DYNAMICINTERFACE_HAS_DLL */
+
+#endif /* TAO_DYNAMICINTERFACE_EXPORT_H */
+
+// End of auto generated file.
diff --git a/TAO/tao/Dynamic_Adapter.cpp b/TAO/tao/Dynamic_Adapter.cpp
new file mode 100644
index 00000000000..7e4a4ab96aa
--- /dev/null
+++ b/TAO/tao/Dynamic_Adapter.cpp
@@ -0,0 +1,15 @@
+// $Id$
+
+#include "tao/Dynamic_Adapter.h"
+
+ACE_RCSID (tao,
+ Dynamic_Adapter,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Dynamic_Adapter::~TAO_Dynamic_Adapter (void)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Dynamic_Adapter.h b/TAO/tao/Dynamic_Adapter.h
new file mode 100644
index 00000000000..af68465a486
--- /dev/null
+++ b/TAO/tao/Dynamic_Adapter.h
@@ -0,0 +1,116 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Dynamic_Adapter.h
+ *
+ * $Id$
+ *
+ * @author Jeff Parsons <parsons@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_DYNAMIC_ADAPTER_H
+#define TAO_DYNAMIC_ADAPTER_H
+
+#include /**/ "ace/pre.h"
+#include "ace/Service_Object.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/CORBA_macros.h"
+
+#include "tao/TAO_Export.h"
+#include "tao/Basic_Types.h"
+#include "ace/CORBA_macros.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace CORBA
+{
+ class Object;
+ typedef Object *Object_ptr;
+
+ class ORB;
+ typedef ORB *ORB_ptr;
+
+ class NVList;
+ typedef NVList *NVList_ptr;
+
+ class NamedValue;
+ typedef NamedValue *NamedValue_ptr;
+
+ class ExceptionList;
+ typedef ExceptionList *ExceptionList_ptr;
+
+ class Request;
+ typedef Request *Request_ptr;
+
+ class Context;
+ typedef Context *Context_ptr;
+
+ class ServerRequest;
+ typedef ServerRequest *ServerRequest_ptr;
+
+ typedef ULong Flags;
+
+ class Environment;
+}
+
+/**
+ * @class TAO_Dynamic_Adapter
+ *
+ * @brief TAO_Dynamic_Adapter.
+ *
+ * Class that adapts various functions in the CORBA namespace
+ * related to DII/DSI, which is no longer found in the TAO library.
+ * This is a base for the actual implementation in the DynamicInterface
+ * library.
+ */
+class TAO_Export TAO_Dynamic_Adapter : public ACE_Service_Object
+{
+public:
+ virtual ~TAO_Dynamic_Adapter (void);
+
+ // CORBA::Object::_create_request and CORBA::Object::_request.
+
+ virtual void create_request (CORBA::Object_ptr obj,
+ CORBA::ORB_ptr orb,
+ const char *operation,
+ CORBA::NVList_ptr arg_list,
+ CORBA::NamedValue_ptr result,
+ CORBA::ExceptionList_ptr exceptions,
+ CORBA::Request_ptr &request,
+ CORBA::Flags req_flags
+ ACE_ENV_ARG_DECL) = 0;
+
+ virtual CORBA::Request_ptr request (CORBA::Object_ptr obj,
+ CORBA::ORB_ptr orb,
+ const char *op
+ ACE_ENV_ARG_DECL) = 0;
+
+ // CORBA::is_nil and CORBA::release for Context, Request, and ServerRequest.
+
+ virtual CORBA::Boolean context_is_nil (CORBA::Context_ptr ctx) = 0;
+
+ virtual CORBA::Boolean request_is_nil (CORBA::Request_ptr req) = 0;
+
+ virtual CORBA::Boolean server_request_is_nil (CORBA::ServerRequest_ptr req) = 0;
+
+ virtual void context_release (CORBA::Context_ptr ctx) = 0;
+
+ virtual void request_release (CORBA::Request_ptr req) = 0;
+
+ virtual void server_request_release (CORBA::ServerRequest_ptr req) = 0;
+
+ // CORBA::ORB::create_exception_list.
+ virtual void create_exception_list (CORBA::ExceptionList_ptr &
+ ACE_ENV_ARG_DECL) = 0;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_DYNAMIC_ADAPTER_H */
diff --git a/TAO/tao/Endpoint.cpp b/TAO/tao/Endpoint.cpp
new file mode 100644
index 00000000000..6077a1b6b94
--- /dev/null
+++ b/TAO/tao/Endpoint.cpp
@@ -0,0 +1,30 @@
+// $Id$
+
+#include "tao/Endpoint.h"
+#include "tao/ORB_Core.h"
+
+#if !defined (__ACE_INLINE__)
+#include "tao/Endpoint.i"
+#endif /* __ACE_INLINE__ */
+
+ACE_RCSID (tao,
+ Endpoint,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Endpoint::~TAO_Endpoint (void)
+{
+}
+
+TAO_Endpoint *
+TAO_Endpoint::next_filtered (TAO_ORB_Core *, TAO_Endpoint *root)
+{
+ if (root == 0)
+ return this;
+ return this->next();
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+//@@ TAO_ENDPOINT_SPL_METHODS_ADD_HOOK
diff --git a/TAO/tao/Endpoint.h b/TAO/tao/Endpoint.h
new file mode 100644
index 00000000000..d89582e973e
--- /dev/null
+++ b/TAO/tao/Endpoint.h
@@ -0,0 +1,178 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Endpoint.h
+ *
+ * $Id$
+ *
+ * Endpoint interface, part of TAO pluggable protocol framework.
+ *
+ *
+ * @author Marina Spivak <marina@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_ENDPOINT_H
+#define TAO_ENDPOINT_H
+
+#include /**/ "ace/pre.h"
+#include "ace/Thread_Mutex.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/TAO_Export.h"
+#include "tao/Basic_Types.h"
+#include "tao/orbconf.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_ORB_Core;
+
+/*
+ * Includes and forward decls for specializing TAO's
+ * endpoint implementation.
+ */
+//@@ TAO_ENDPOINT_SPL_INCLUDE_FORWARD_DECL_ADD_HOOK
+
+/**
+ * @class TAO_Endpoint
+ *
+ * @brief Defines the Endpoint interface in the Pluggable Protocol
+ * framework.
+ *
+ * Lightweight encapsulation of addressing information for a
+ * single acceptor endpoint. In other words, Endpoint represents
+ * a single point of contact for the server, and is the smallest
+ * unit of addressing information necessary for a client to connect
+ * to a server.
+ * A Profile contains one or more Endpoints, i.e., knows of
+ * one or more ways to contact server(s).
+ */
+class TAO_Export TAO_Endpoint
+{
+public:
+ /// Constructor.
+ TAO_Endpoint (CORBA::ULong tag,
+ CORBA::Short priority = TAO_INVALID_PRIORITY);
+
+ /// Destructor.
+ virtual ~TAO_Endpoint (void);
+
+ /// IOP protocol tag accessor.
+ CORBA::ULong tag (void) const;
+
+ /// <priority_> attribute setter.
+ void priority (CORBA::Short priority);
+
+ /// <priority_> attribute getter.
+ CORBA::Short priority (void) const;
+
+ /**
+ * @name TAO_Endpoint Template Methods
+ *
+ * Abstract methods to be implemented by concrete subclasses.
+ */
+ //@{
+ /**
+ * @return true if this endpoint is equivalent to @a other_endpoint.
+ */
+ virtual CORBA::Boolean is_equivalent (const TAO_Endpoint *other_endpoint) = 0;
+
+ /// Endpoints can be linked in a list.
+ /**
+ * @return The next endpoint in the list, if any.
+ */
+ virtual TAO_Endpoint *next (void) = 0;
+
+ /**
+ * Return the next endpoint in the list, but use protocol-specific
+ * filtering to constrain the value. The orb core is needed to supply
+ * any sort of filter arguments, and the root endpoint is needed in case
+ * the algorithm needs to rewind. If the supplied root is 0, then this
+ * is assumed to be the candidate next endpoint.
+ *
+ * To use this, the caller starts off the change with root == 0. This
+ * is a bit of a violation in logic, a more correct implementation would
+ * accept this == 0 and a non-null root.
+ * To do iteration using next_filtered, do:
+ * for (TAO_Endpoint *ep = root_endpoint->next_filtered (orb_core, 0);
+ * ep != 0;
+ * ep = ep->next_filtered(orb_core, root_endpoint)) { }
+ */
+ virtual TAO_Endpoint *next_filtered (TAO_ORB_Core *, TAO_Endpoint *root);
+
+ /// Return a string representation for the address.
+ /**
+ * The purpose of this method is to provide a general interface to
+ * the underlying address object's @c addr_to_string method. This
+ * allows the protocol implementor to select the appropriate string
+ * format.
+ *
+ * @return -1 if buffer is too small.
+ */
+ virtual int addr_to_string (char *buffer, size_t length) = 0;
+
+ /// This method returns a deep copy of the corresponding endpoints by
+ /// allocating memory.
+ virtual TAO_Endpoint *duplicate (void) = 0;
+
+ /// Return a hash value for this object.
+ virtual CORBA::ULong hash (void) = 0;
+
+ /*
+ * Hook to add public methods from derived class onto base
+ * Endpoint class.
+ */
+ //@@ TAO_ENDPOINT_SPL_PUBLIC_METHODS_ADD_HOOK
+
+protected:
+
+ /// Lock for the address lookup.
+ /**
+ * @todo This lock should be strategized so that we dont lock in
+ * single threaded configurations. It is not possible to do
+ * this now as most of the information is available in the
+ * ORB_Core which is not available here.
+ */
+ mutable TAO_SYNCH_MUTEX addr_lookup_lock_;
+
+ /// Cache the hash value
+ CORBA::ULong hash_val_;
+
+ /// IOP tag, identifying the protocol for which this endpoint
+ /// contains addressing info.
+ CORBA::ULong const tag_;
+
+ /**
+ * CORBA priority of the acceptor this Endpoint is representing.
+ * This is part of TAO 'prioritized endpoints' architecture, and is
+ * currently used for RTCORBA only.
+ */
+ CORBA::Short priority_;
+
+private:
+
+ /// Endpoints should not be copied.
+ TAO_Endpoint (const TAO_Endpoint&);
+ void operator= (const TAO_Endpoint&);
+
+ /*
+ * Addition of private members from derived class.
+ */
+ //@@ TAO_ENDPOINT_SPL_PRIVATE_DATA_ADD_HOOK
+
+};
+
+//@@ TAO_ENDPOINT_SPL_EXTERN_ADD_HOOK
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/Endpoint.i"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_PROFILE_H */
diff --git a/TAO/tao/Endpoint.i b/TAO/tao/Endpoint.i
new file mode 100644
index 00000000000..ab570490899
--- /dev/null
+++ b/TAO/tao/Endpoint.i
@@ -0,0 +1,40 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO_Endpoint::TAO_Endpoint (CORBA::ULong tag,
+ CORBA::Short priority)
+ : addr_lookup_lock_ ()
+ // @@ Would be a tragedy if the hash value of this endpoint is 0, in
+ // which case this optimizaton wouldn't work. We can get around
+ // that using a bool. But we don't want to increase the runtime
+ // memory.
+ , hash_val_ (0)
+ , tag_ (tag)
+ , priority_ (priority)
+
+{
+}
+
+ACE_INLINE CORBA::ULong
+TAO_Endpoint::tag (void) const
+{
+ return this->tag_;
+}
+
+ACE_INLINE CORBA::Short
+TAO_Endpoint::priority (void) const
+{
+ return this->priority_;
+}
+
+ACE_INLINE void
+TAO_Endpoint::priority (CORBA::Short p)
+{
+ this->priority_ = p;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/EndpointPolicy.mpc b/TAO/tao/EndpointPolicy.mpc
new file mode 100644
index 00000000000..c55efd44c24
--- /dev/null
+++ b/TAO/tao/EndpointPolicy.mpc
@@ -0,0 +1,43 @@
+//$Id$
+project : taolib, core, portableserver, pi, tao_versioning_idl_defaults, tao_no_iiop {
+ sharedname = TAO_EndpointPolicy
+ dynamicflags = TAO_ENDPOINTPOLICY_BUILD_DLL
+
+ Source_Files {
+ EndpointPolicy
+ }
+
+ Header_Files {
+ EndpointPolicy
+ }
+
+ Inline_Files {
+ EndpointPolicy
+ }
+
+ Template_Files {
+ EndpointPolicy
+ }
+
+ Resource_Files {
+ EndpointPolicy
+ }
+
+ PIDL_Files {
+ EndpointPolicy/EndpointPolicyType.pidl
+ }
+
+ IDL_Files {
+ idlflags += -GA -SS -Sci -Ge 1 -Sorb \
+ -Wb,export_macro=TAO_EndpointPolicy_Export \
+ -Wb,export_include=tao/EndpointPolicy/EndpointPolicy_Export.h \
+ -o EndpointPolicy
+ idlflags -= -St
+ EndpointPolicy/EndpointPolicy.pidl
+ EndpointPolicy/IIOPEndpointValue.pidl
+ }
+
+ Pkgconfig_Files {
+ EndpointPolicy/TAO_EndpointPolicy.pc.in
+ }
+}
diff --git a/TAO/tao/EndpointPolicy/EndpointPolicy.cpp b/TAO/tao/EndpointPolicy/EndpointPolicy.cpp
new file mode 100644
index 00000000000..aff1b5bb0eb
--- /dev/null
+++ b/TAO/tao/EndpointPolicy/EndpointPolicy.cpp
@@ -0,0 +1,62 @@
+// @(#) $Id$
+
+#include "tao/EndpointPolicy/EndpointPolicy.h"
+#include "tao/EndpointPolicy/EndpointPolicy_ORBInitializer.h"
+#include "tao/EndpointPolicy/Endpoint_Acceptor_Filter_Factory.h"
+
+#include "tao/ORB_Core.h"
+#include "tao/ORBInitializer_Registry.h"
+
+#include "tao/PI/PI.h"
+
+ACE_RCSID (EndpointPolicy, EndpointPolicy, "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+int
+TAO_EndpointPolicy_Initializer::init (void)
+{
+ ACE_Service_Config::process_directive (ace_svc_desc_TAO_Endpoint_Acceptor_Filter_Factory);
+
+ PortableInterceptor::ORBInitializer_ptr temp_orb_initializer =
+ PortableInterceptor::ORBInitializer::_nil ();
+ PortableInterceptor::ORBInitializer_var orb_initializer;
+
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ /// Register the EndpointPolicy ORBInitializer.
+ ACE_NEW_THROW_EX (temp_orb_initializer,
+ TAO_EndpointPolicy_ORBInitializer,
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_TRY_CHECK;
+
+ orb_initializer = temp_orb_initializer;
+
+ PortableInterceptor::register_orb_initializer (orb_initializer.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "Caught exception:");
+ }
+ return -1;
+ }
+ ACE_ENDTRY;
+
+ ACE_Service_Config::process_directive
+ (ace_svc_desc_TAO_Endpoint_Acceptor_Filter_Factory,1); // force replacement
+
+
+ return 0;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/EndpointPolicy/EndpointPolicy.h b/TAO/tao/EndpointPolicy/EndpointPolicy.h
new file mode 100644
index 00000000000..007294e420d
--- /dev/null
+++ b/TAO/tao/EndpointPolicy/EndpointPolicy.h
@@ -0,0 +1,51 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file EndpointPolicy.h
+ *
+ * $Id$
+ *
+ * @author Yan Dai <dai_y@ociweb.com>
+ */
+//=============================================================================
+
+
+#ifndef TAO_ENDPOINTPOLICY_H
+#define TAO_ENDPOINTPOLICY_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/EndpointPolicy/EndpointPolicy_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PI/PI.h"
+#include "tao/Versioned_Namespace.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_EndpointPolicy_Export TAO_EndpointPolicy_Initializer
+{
+public:
+ /// Used to force the initialization of the ORB code.
+ static int init (void);
+};
+
+static int
+TAO_Requires_EndpointPolicy_Initializer = TAO_EndpointPolicy_Initializer::init ();
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#define TAO_ENDPOINTPOLICY_SAFE_INCLUDE
+#include "tao/EndpointPolicy/EndpointPolicyC.h"
+#include "tao/EndpointPolicy/EndpointPolicyA.h"
+#include "tao/IOP_IORC.h"
+#include "tao/AnyTypeCode/Any.h"
+#undef TAO_ENDPOINTPOLICY_SAFE_INCLUDE
+
+#endif /* TAO_ENDPOINTPOLICY_H */
diff --git a/TAO/tao/EndpointPolicy/EndpointPolicy.pidl b/TAO/tao/EndpointPolicy/EndpointPolicy.pidl
new file mode 100644
index 00000000000..50ac0290e03
--- /dev/null
+++ b/TAO/tao/EndpointPolicy/EndpointPolicy.pidl
@@ -0,0 +1,35 @@
+//
+// $Id$
+
+/**
+ * @file EndpointPolicy.pidl
+ *
+ * This file contains idl definition for Endpoint policy interface and
+ * the policy value. This TAO-specific policy is used to filter endpoints
+ * in the profiles for use in Object References.
+ */
+
+#ifndef _TAO_ENDPOINT_POLICY_IDL_
+#define _TAO_ENDPOINT_POLICY_IDL_
+
+///FUZZ: disable check_for_include/
+#include "tao/Policy.pidl"
+#include "tao/EndpointPolicy/EndpointPolicyType.pidl"
+
+module EndpointPolicy
+{
+ local interface EndpointValueBase
+ {
+ readonly attribute unsigned long protocol_tag;
+ };
+
+ typedef sequence<EndpointValueBase> EndpointList;
+
+ local interface Policy : CORBA::Policy
+ {
+ readonly attribute EndpointList value;
+ };
+};
+
+
+#endif /* _TAO_ENDPOINT_POLICY_IDL_ */
diff --git a/TAO/tao/EndpointPolicy/EndpointPolicyType.pidl b/TAO/tao/EndpointPolicy/EndpointPolicyType.pidl
new file mode 100644
index 00000000000..ea8498fc703
--- /dev/null
+++ b/TAO/tao/EndpointPolicy/EndpointPolicyType.pidl
@@ -0,0 +1,31 @@
+//
+// $Id$
+
+/**
+ * @file EndpointPolicyType.pidl
+ *
+ * This file contains idl definition for EndpointPolicy type.
+ *
+ * This file was used to generate the code in
+ * EndpointPolicyTypeC.* The command used to generate code is:
+ * tao_idl
+ * -o orig -Ge 1 -GA \
+ * -Wb,export_macro=TAO_EndpointPolicy_Export \
+ * -Wb,export_include="tao/EndpointPolicy/TAO_EndpointPolicy_Export.h" \
+ * -Wb,pre_include="ace/pre.h" \
+ * -Wb,post_include="ace/post.h" \
+ * EndpointPolicyType.pidl
+ */
+
+#ifndef _TAO_ENDPOINT_POLICY_TYPE_IDL_
+#define _TAO_ENDPOINT_POLICY_TYPE_IDL_
+
+#include "tao/Policy.pidl"
+
+module EndpointPolicy
+{
+ const CORBA::PolicyType ENDPOINT_POLICY_TYPE = 0x4f43000c;
+};
+
+
+#endif /* _TAO_ENDPOINT_POLICY_TYPE_IDL_ */
diff --git a/TAO/tao/EndpointPolicy/EndpointPolicyTypeA.cpp b/TAO/tao/EndpointPolicy/EndpointPolicyTypeA.cpp
new file mode 100644
index 00000000000..c4c90d969c0
--- /dev/null
+++ b/TAO/tao/EndpointPolicy/EndpointPolicyTypeA.cpp
@@ -0,0 +1,33 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+#include "tao/EndpointPolicy/EndpointPolicyTypeA.h"
+#include "tao/AnyTypeCode/Null_RefCount_Policy.h"
+#include "tao/AnyTypeCode/TypeCode_Constants.h"
+#include "tao/AnyTypeCode/Alias_TypeCode_Static.h"
+#include "tao/AnyTypeCode/Any.h"
+#include "tao/CDR.h"
diff --git a/TAO/tao/EndpointPolicy/EndpointPolicyTypeA.h b/TAO/tao/EndpointPolicy/EndpointPolicyTypeA.h
new file mode 100644
index 00000000000..a1702176991
--- /dev/null
+++ b/TAO/tao/EndpointPolicy/EndpointPolicyTypeA.h
@@ -0,0 +1,55 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// .\be\be_codegen.cpp:797
+
+#ifndef _TAO_IDL_ENDPOINTPOLICYTYPEA_H_
+#define _TAO_IDL_ENDPOINTPOLICYTYPEA_H_
+
+#include /**/ "ace/pre.h"
+
+#include "tao/EndpointPolicy/EndpointPolicy_Export.h"
+#include "tao/EndpointPolicy/EndpointPolicyTypeC.h"
+#include "tao/AnyTypeCode/PolicyA.h"
+
+
+// TAO_IDL - Generated from
+// c:\ticket\tao-1_4_8_merge\ace_wrappers\tao\tao_idl\be\be_visitor_module/module_ch.cpp:59
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+namespace EndpointPolicy
+{
+
+// TAO_IDL - Generated from
+// c:\ticket\tao-1_4_8_merge\ace_wrappers\tao\tao_idl\be\be_visitor_module/module_ch.cpp:86
+
+} // module EndpointPolicy
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* ifndef */
diff --git a/TAO/tao/EndpointPolicy/EndpointPolicyTypeC.cpp b/TAO/tao/EndpointPolicy/EndpointPolicyTypeC.cpp
new file mode 100644
index 00000000000..a3f9a0e196d
--- /dev/null
+++ b/TAO/tao/EndpointPolicy/EndpointPolicyTypeC.cpp
@@ -0,0 +1,49 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// .\be\be_codegen.cpp:283
+
+
+#include "tao/EndpointPolicy/EndpointPolicyTypeC.h"
+#include "tao/CDR.h"
+
+// TAO_IDL - Generated from
+// .\be\be_visitor_arg_traits.cpp:70
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+
+
+// Arg traits specializations.
+namespace TAO
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+
+
diff --git a/TAO/tao/EndpointPolicy/EndpointPolicyTypeC.h b/TAO/tao/EndpointPolicy/EndpointPolicyTypeC.h
new file mode 100644
index 00000000000..86a091687d1
--- /dev/null
+++ b/TAO/tao/EndpointPolicy/EndpointPolicyTypeC.h
@@ -0,0 +1,90 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// .\be\be_codegen.cpp:155
+
+#ifndef _TAO_IDL_ENDPOINTPOLICYTYPEC_H_
+#define _TAO_IDL_ENDPOINTPOLICYTYPEC_H_
+
+#include /**/ "ace/pre.h"
+
+
+#include "ace/config-all.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/EndpointPolicy/EndpointPolicy_Export.h"
+#include "tao/ORB.h"
+#include "tao/SystemException.h"
+#include "tao/Environment.h"
+#include "tao/Versioned_Namespace.h"
+
+#include "tao/PolicyC.h"
+
+#if defined (TAO_EXPORT_MACRO)
+#undef TAO_EXPORT_MACRO
+#endif
+#define TAO_EXPORT_MACRO TAO_EndpointPolicy_Export
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// TAO_IDL - Generated from
+// c:\ticket\tao-1_4_8_merge\ace_wrappers\tao\tao_idl\be\be_visitor_module/module_ch.cpp:49
+
+namespace EndpointPolicy
+{
+
+ // TAO_IDL - Generated from
+ // c:\ticket\tao-1_4_8_merge\ace_wrappers\tao\tao_idl\be\be_visitor_constant/constant_ch.cpp:52
+
+ const CORBA::PolicyType ENDPOINT_POLICY_TYPE = 1329790988U;
+
+// TAO_IDL - Generated from
+// c:\ticket\tao-1_4_8_merge\ace_wrappers\tao\tao_idl\be\be_visitor_module/module_ch.cpp:78
+
+} // module EndpointPolicy
+
+// TAO_IDL - Generated from
+// .\be\be_visitor_traits.cpp:62
+
+
+// Traits specializations.
+namespace TAO
+{
+}
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+
+
+#include /**/ "ace/post.h"
+
+#endif /* ifndef */
+
+
diff --git a/TAO/tao/EndpointPolicy/EndpointPolicy_Export.h b/TAO/tao/EndpointPolicy/EndpointPolicy_Export.h
new file mode 100644
index 00000000000..d9940484cfe
--- /dev/null
+++ b/TAO/tao/EndpointPolicy/EndpointPolicy_Export.h
@@ -0,0 +1,58 @@
+
+// -*- C++ -*-
+// $Id$
+// Definition for Win32 Export directives.
+// This file is generated automatically by generate_export_file.pl -s TAO_EndpointPolicy
+// ------------------------------
+#ifndef TAO_ENDPOINTPOLICY_EXPORT_H
+#define TAO_ENDPOINTPOLICY_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if defined (ACE_AS_STATIC_LIBS) && !defined (TAO_ENDPOINTPOLICY_HAS_DLL)
+# define TAO_ENDPOINTPOLICY_HAS_DLL 0
+#endif /* ACE_AS_STATIC_LIBS && TAO_ENDPOINTPOLICY_HAS_DLL */
+
+#if !defined (TAO_ENDPOINTPOLICY_HAS_DLL)
+# define TAO_ENDPOINTPOLICY_HAS_DLL 1
+#endif /* ! TAO_ENDPOINTPOLICY_HAS_DLL */
+
+#if defined (TAO_ENDPOINTPOLICY_HAS_DLL) && (TAO_ENDPOINTPOLICY_HAS_DLL == 1)
+# if defined (TAO_ENDPOINTPOLICY_BUILD_DLL)
+# define TAO_EndpointPolicy_Export ACE_Proper_Export_Flag
+# define TAO_ENDPOINTPOLICY_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# define TAO_ENDPOINTPOLICY_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# else /* TAO_ENDPOINTPOLICY_BUILD_DLL */
+# define TAO_EndpointPolicy_Export ACE_Proper_Import_Flag
+# define TAO_ENDPOINTPOLICY_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# define TAO_ENDPOINTPOLICY_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# endif /* TAO_ENDPOINTPOLICY_BUILD_DLL */
+#else /* TAO_ENDPOINTPOLICY_HAS_DLL == 1 */
+# define TAO_EndpointPolicy_Export
+# define TAO_ENDPOINTPOLICY_SINGLETON_DECLARATION(T)
+# define TAO_ENDPOINTPOLICY_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+#endif /* TAO_ENDPOINTPOLICY_HAS_DLL == 1 */
+
+// Set TAO_ENDPOINTPOLICY_NTRACE = 0 to turn on library specific tracing even if
+// tracing is turned off for ACE.
+#if !defined (TAO_ENDPOINTPOLICY_NTRACE)
+# if (ACE_NTRACE == 1)
+# define TAO_ENDPOINTPOLICY_NTRACE 1
+# else /* (ACE_NTRACE == 1) */
+# define TAO_ENDPOINTPOLICY_NTRACE 0
+# endif /* (ACE_NTRACE == 1) */
+#endif /* !TAO_ENDPOINTPOLICY_NTRACE */
+
+#if (TAO_ENDPOINTPOLICY_NTRACE == 1)
+# define TAO_ENDPOINTPOLICY_TRACE(X)
+#else /* (TAO_ENDPOINTPOLICY_NTRACE == 1) */
+# if !defined (ACE_HAS_TRACE)
+# define ACE_HAS_TRACE
+# endif /* ACE_HAS_TRACE */
+# define TAO_ENDPOINTPOLICY_TRACE(X) ACE_TRACE_IMPL(X)
+# include "ace/Trace.h"
+#endif /* (TAO_ENDPOINTPOLICY_NTRACE == 1) */
+
+#endif /* TAO_ENDPOINTPOLICY_EXPORT_H */
+
+// End of auto generated file.
diff --git a/TAO/tao/EndpointPolicy/EndpointPolicy_Factory.cpp b/TAO/tao/EndpointPolicy/EndpointPolicy_Factory.cpp
new file mode 100644
index 00000000000..11c4a887519
--- /dev/null
+++ b/TAO/tao/EndpointPolicy/EndpointPolicy_Factory.cpp
@@ -0,0 +1,94 @@
+// @(#) $Id$
+#include "tao/EndpointPolicy/EndpointPolicy_Factory.h"
+
+ACE_RCSID (EndpointPolicy,
+ EndpointPolicy_Factory,
+ "$Id$")
+
+#include "tao/EndpointPolicy/EndpointPolicy_i.h"
+#include "tao/EndpointPolicy/EndpointPolicyA.h"
+#include "tao/EndpointPolicy/Endpoint_Value_Impl.h"
+
+#include "tao/PolicyC.h"
+#include "tao/ORB_Constants.h"
+#include "tao/ORB_Core.h"
+#include "tao/Acceptor_Registry.h"
+#include "tao/AnyTypeCode/TAOA.h"
+#include "tao/AnyTypeCode/Any.h"
+#include "tao/Thread_Lane_Resources.h"
+#include "tao/Transport_Acceptor.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+
+TAO_EndpointPolicy_Factory::TAO_EndpointPolicy_Factory (TAO_ORB_Core * orb_core)
+: orb_core_ (orb_core)
+{
+}
+
+
+CORBA::Policy_ptr
+TAO_EndpointPolicy_Factory::create_policy (
+ CORBA::PolicyType type,
+ const CORBA::Any &value
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ CORBA::PolicyError))
+{
+ if (type == EndpointPolicy::ENDPOINT_POLICY_TYPE)
+ {
+ const EndpointPolicy::EndpointList* endpoint_list;
+ if ((value >>= endpoint_list) == 0)
+ ACE_THROW_RETURN (CORBA::PolicyError (CORBA::BAD_POLICY_VALUE),
+ CORBA::Policy::_nil ());
+
+ TAO_Acceptor_Registry & registry
+ = this->orb_core_->lane_resources ().acceptor_registry ();
+
+ TAO_Acceptor ** acceptors_begin = registry.begin ();
+ TAO_Acceptor ** acceptors_end = registry.end ();
+ CORBA::ULong num_eps = endpoint_list->length ();
+
+ // The endpoint list in the value is validated to ensure that
+ // at least one endpoint in the list matches an endpoint the
+ // ORB is listening on.
+
+ bool found_one = true;
+ for (CORBA::ULong idx = 0; !found_one && idx < num_eps; ++idx)
+ {
+ CORBA::ULong prot_tag = (*endpoint_list)[idx]->protocol_tag();
+
+ const TAO_Endpoint_Value_Impl *evi =
+ dynamic_cast <const TAO_Endpoint_Value_Impl*> ((*endpoint_list)[idx]);
+
+ for (TAO_Acceptor** acceptor = acceptors_begin;
+ !found_one && acceptor != acceptors_end;
+ ++acceptor)
+ {
+ if ((*acceptor)->tag() == prot_tag)
+ found_one = evi->validate_acceptor(*acceptor);
+ }
+ }
+ // There is no endpoint policy value matches an endpoint the ORB
+ // is listening on. A CORBA::PolicyError exception with a
+ // PolicyErrorCode of UNSUPPORTED_POLICY_VALUE is raised.
+ if (!found_one)
+ ACE_THROW_RETURN (CORBA::PolicyError (CORBA::UNSUPPORTED_POLICY_VALUE),
+ CORBA::Policy::_nil ());
+
+ TAO_EndpointPolicy_i *tmp;
+ ACE_NEW_THROW_EX (tmp,
+ TAO_EndpointPolicy_i (*endpoint_list),
+ CORBA::NO_MEMORY (TAO::VMCID,
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+
+ return tmp;
+ }
+ else
+ ACE_THROW_RETURN (CORBA::PolicyError (CORBA::BAD_POLICY_TYPE),
+ CORBA::Policy::_nil ());
+}
+
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/EndpointPolicy/EndpointPolicy_Factory.h b/TAO/tao/EndpointPolicy/EndpointPolicy_Factory.h
new file mode 100644
index 00000000000..667c7f2aa9a
--- /dev/null
+++ b/TAO/tao/EndpointPolicy/EndpointPolicy_Factory.h
@@ -0,0 +1,67 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file EndpointPolicy_Factory.h
+ *
+ * $Id$
+ *
+ * @author Yan Dai <dai_y@ociweb.com>
+ */
+//=============================================================================
+
+
+#ifndef TAO_ENDPOINTPOLICY_FACTORY_H
+#define TAO_ENDPOINTPOLICY_FACTORY_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/EndpointPolicy/EndpointPolicy_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PI/PI.h"
+#include "tao/LocalObject.h"
+
+// This is to remove "inherits via dominance" warnings from MSVC.
+// MSVC is being a little too paranoid.
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Forward declarations.
+class TAO_ORB_Core;
+
+/// Policy factory for the endpoint policies.
+class TAO_EndpointPolicy_Export TAO_EndpointPolicy_Factory
+ : public virtual PortableInterceptor::PolicyFactory,
+ public virtual TAO_Local_RefCounted_Object
+{
+public:
+
+ TAO_EndpointPolicy_Factory (TAO_ORB_Core * orb_core);
+
+ virtual CORBA::Policy_ptr create_policy (CORBA::PolicyType type,
+ const CORBA::Any & value
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ CORBA::PolicyError));
+private:
+
+ TAO_ORB_Core * orb_core_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_ENDPOINTPOLICY_FACTORY_H */
diff --git a/TAO/tao/EndpointPolicy/EndpointPolicy_ORBInitializer.cpp b/TAO/tao/EndpointPolicy/EndpointPolicy_ORBInitializer.cpp
new file mode 100644
index 00000000000..d457e78d389
--- /dev/null
+++ b/TAO/tao/EndpointPolicy/EndpointPolicy_ORBInitializer.cpp
@@ -0,0 +1,86 @@
+// $Id$
+
+#include "tao/EndpointPolicy/EndpointPolicy_ORBInitializer.h"
+
+#include "tao/EndpointPolicy/EndpointPolicyC.h"
+#include "tao/EndpointPolicy/EndpointPolicy_Factory.h"
+#include "tao/ORB_Core.h"
+#include "tao/PI/ORBInitInfo.h"
+
+ACE_RCSID (EndpointPolicy,
+ EndpointPolicy_ORBInitializer,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+void
+TAO_EndpointPolicy_ORBInitializer::pre_init (
+ PortableInterceptor::ORBInitInfo_ptr
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+}
+
+void
+TAO_EndpointPolicy_ORBInitializer::post_init (
+ PortableInterceptor::ORBInitInfo_ptr info
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->register_policy_factories (info
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+void
+TAO_EndpointPolicy_ORBInitializer::register_policy_factories (
+ PortableInterceptor::ORBInitInfo_ptr info
+ ACE_ENV_ARG_DECL)
+{
+ TAO_ORBInitInfo * local_info = dynamic_cast <TAO_ORBInitInfo *> (info);
+ TAO_ORB_Core * the_orb_core = local_info->orb_core ();
+
+ // Register the EndpointPolicy policy factories.
+ PortableInterceptor::PolicyFactory_ptr policy_factory_ptr;
+ ACE_NEW_THROW_EX (policy_factory_ptr,
+ TAO_EndpointPolicy_Factory(the_orb_core),
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_CHECK;
+
+
+ PortableInterceptor::PolicyFactory_var policy_factory =
+ policy_factory_ptr;
+
+ ACE_TRY
+ {
+ info->register_policy_factory (EndpointPolicy::ENDPOINT_POLICY_TYPE,
+ policy_factory.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCH (CORBA::BAD_INV_ORDER, ex)
+ {
+ if (ex.minor () == (CORBA::OMGVMCID | 16))
+ {
+ // The factory is already there, it happens because the
+ // magic initializer in Messaging.cpp registers with the
+ // ORB multiple times. This is an indication that we
+ // should do no more work in this ORBInitializer.
+ return;
+ }
+ ACE_RE_THROW;
+ }
+ ACE_CATCHANY
+ {
+ // Rethrow any other exceptions...
+ ACE_RE_THROW;
+ }
+ ACE_ENDTRY;
+ ACE_CHECK;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/EndpointPolicy/EndpointPolicy_ORBInitializer.h b/TAO/tao/EndpointPolicy/EndpointPolicy_ORBInitializer.h
new file mode 100644
index 00000000000..daeeff7f2c0
--- /dev/null
+++ b/TAO/tao/EndpointPolicy/EndpointPolicy_ORBInitializer.h
@@ -0,0 +1,79 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file EndpointPolicy_ORBInitializer.h
+ *
+ * $Id$
+ *
+ * @author Yan Dai <dai_y@ociweb.com>
+ */
+//=============================================================================
+
+
+#ifndef TAO_ENDPOINTPOLICY_ORB_INITIALIZER_H
+#define TAO_ENDPOINTPOLICY_ORB_INITIALIZER_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/EndpointPolicy/EndpointPolicy_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PI/PI.h"
+#include "tao/LocalObject.h"
+
+// This is to remove "inherits via dominance" warnings from MSVC.
+// MSVC is being a little too paranoid.
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/// EndpointPolicy ORB initializer.
+class TAO_EndpointPolicy_ORBInitializer
+ : public virtual PortableInterceptor::ORBInitializer,
+ public virtual TAO_Local_RefCounted_Object
+{
+public:
+
+ /**
+ * @name PortableInterceptor::ORBInitializer Methods
+ *
+ * The following methods are required by the
+ * PortableInterceptor::ORBInitializer interface.
+ */
+ //@{
+
+ virtual void pre_init (PortableInterceptor::ORBInitInfo_ptr info
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual void post_init (PortableInterceptor::ORBInitInfo_ptr info
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ //@}
+
+private:
+
+ /// Register Endpoint policy factories.
+ void register_policy_factories (
+ PortableInterceptor::ORBInitInfo_ptr info
+ ACE_ENV_ARG_DECL);
+
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_ENDPOINTPOLICY_ORB_INITIALIZER_H */
diff --git a/TAO/tao/EndpointPolicy/EndpointPolicy_i.cpp b/TAO/tao/EndpointPolicy/EndpointPolicy_i.cpp
new file mode 100644
index 00000000000..ea1ebb751e6
--- /dev/null
+++ b/TAO/tao/EndpointPolicy/EndpointPolicy_i.cpp
@@ -0,0 +1,84 @@
+// $Id$
+
+#include "tao/EndpointPolicy/EndpointPolicy_i.h"
+
+#include "tao/SystemException.h"
+
+ACE_RCSID (EndpointPolicy,
+ EndpointPolicy_i,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_EndpointPolicy_i::TAO_EndpointPolicy_i (const EndpointPolicy::EndpointList &value)
+: value_ (value)
+{
+}
+
+TAO_EndpointPolicy_i::TAO_EndpointPolicy_i (const TAO_EndpointPolicy_i &rhs)
+ : ::CORBA::Object ()
+ , ::CORBA::Policy ()
+ , ::EndpointPolicy::Policy ()
+ , ::CORBA::LocalObject ()
+ , TAO_Local_RefCounted_Object ()
+ , value_ (rhs.value_)
+{
+}
+
+CORBA::PolicyType
+TAO_EndpointPolicy_i::policy_type (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return EndpointPolicy::ENDPOINT_POLICY_TYPE;
+}
+
+TAO_EndpointPolicy_i *
+TAO_EndpointPolicy_i::clone (void) const
+{
+ TAO_EndpointPolicy_i *copy = 0;
+ ACE_NEW_RETURN (copy,
+ TAO_EndpointPolicy_i (*this),
+ 0);
+ return copy;
+}
+
+EndpointPolicy::EndpointList *
+TAO_EndpointPolicy_i::value (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ EndpointPolicy::EndpointList* list = 0;
+ ACE_NEW_RETURN (list,
+ EndpointPolicy::EndpointList (this->value_),
+ 0);
+
+ return list;
+}
+
+CORBA::Policy_ptr
+TAO_EndpointPolicy_i::copy (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ TAO_EndpointPolicy_i* servant = 0;
+ ACE_NEW_THROW_EX (servant,
+ TAO_EndpointPolicy_i (*this),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+
+ return servant;
+}
+
+void
+TAO_EndpointPolicy_i::destroy (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+}
+
+TAO_Cached_Policy_Type
+TAO_EndpointPolicy_i::_tao_cached_type (void) const
+{
+ return TAO_CACHED_POLICY_ENDPOINT;
+}
+
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/EndpointPolicy/EndpointPolicy_i.h b/TAO/tao/EndpointPolicy/EndpointPolicy_i.h
new file mode 100644
index 00000000000..c41626ba4d8
--- /dev/null
+++ b/TAO/tao/EndpointPolicy/EndpointPolicy_i.h
@@ -0,0 +1,93 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file EndpointPolicy_i.h
+ *
+ * $Id$
+ *
+ * @author Yan Dai <dai_y@ociweb.com>
+ */
+//=============================================================================
+
+
+#ifndef TAO_ENDPOINTPOLICY_I_H
+#define TAO_ENDPOINTPOLICY_I_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/TAOC.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/EndpointPolicy/EndpointPolicyC.h"
+#include "tao/LocalObject.h"
+
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+
+/**
+ * @class TAO_EndpointPolicy_i
+ *
+ * @brief Implementation class for TAO-specific Endpoint Policy.
+ *
+ * This policy is used to filter the endpoints in profiles during
+ * the creation of object references.
+ */
+class TAO_EndpointPolicy_Export TAO_EndpointPolicy_i
+ : public virtual EndpointPolicy::Policy,
+ public virtual TAO_Local_RefCounted_Object
+{
+public:
+ /// Constructor.
+ TAO_EndpointPolicy_i (const EndpointPolicy::EndpointList &value);
+
+ /// Copy constructor.
+ TAO_EndpointPolicy_i (const TAO_EndpointPolicy_i &rhs);
+
+ /// Returns a copy of <this>.
+ virtual TAO_EndpointPolicy_i *clone (void) const;
+
+ // = The EndpointPolicy::Policy methods
+
+ virtual CORBA::PolicyType policy_type (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual CORBA::Policy_ptr copy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual void destroy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ // Return the cached policy type for this policy.
+ virtual TAO_Cached_Policy_Type _tao_cached_type (void) const;
+
+ virtual EndpointPolicy::EndpointList * value (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ ::CORBA::SystemException
+ ));
+
+private:
+ /// The attribute
+ EndpointPolicy::EndpointList value_;
+};
+
+
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_ENDPOINTPOLICY_I_H */
diff --git a/TAO/tao/EndpointPolicy/Endpoint_Acceptor_Filter.cpp b/TAO/tao/EndpointPolicy/Endpoint_Acceptor_Filter.cpp
new file mode 100644
index 00000000000..bf44e0741e8
--- /dev/null
+++ b/TAO/tao/EndpointPolicy/Endpoint_Acceptor_Filter.cpp
@@ -0,0 +1,156 @@
+// @(#) $Id$
+
+#include "tao/EndpointPolicy/Endpoint_Acceptor_Filter.h"
+#include "tao/EndpointPolicy/EndpointPolicyC.h"
+#include "tao/EndpointPolicy/Endpoint_Value_Impl.h"
+
+#include "tao/Transport_Acceptor.h"
+#include "tao/MProfile.h"
+#include "tao/Profile.h"
+#include "tao/Endpoint.h"
+
+ACE_RCSID(EndpointPolicy,
+ Endpoint_Acceptor_Filter,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Endpoint_Acceptor_Filter::TAO_Endpoint_Acceptor_Filter (EndpointPolicy::Policy_ptr p)
+: endpoints_(p->value())
+{
+}
+
+int
+TAO_Endpoint_Acceptor_Filter::fill_profile (const TAO::ObjectKey &object_key,
+ TAO_MProfile &mprofile,
+ TAO_Acceptor **acceptors_begin,
+ TAO_Acceptor **acceptors_end,
+ CORBA::Short priority)
+{
+ CORBA::ULong const num_endpoints = endpoints_->length ();
+
+ for (TAO_Acceptor** acceptor = acceptors_begin;
+ acceptor != acceptors_end;
+ ++acceptor)
+ {
+ bool tagfound = false;
+ for (CORBA::ULong epx = 0; !tagfound && epx < num_endpoints; epx++)
+ {
+ tagfound = (*acceptor)->tag () == endpoints_[epx]->protocol_tag();
+ }
+ if (!tagfound)
+ continue;
+
+ if ((*acceptor)->create_profile (object_key,
+ mprofile,
+ priority) == -1)
+ return -1;
+ }
+
+ if (TAO_debug_level > 2)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT("(%P|%t) EndpointPolicy filtering acceptors")
+ ACE_TEXT(" - mprofile has %d profiles,")
+ ACE_TEXT(" endpoint list has %d entries\n"),
+ mprofile.profile_count(), num_endpoints));
+
+ for (TAO_PHandle pfile_ndx = 0;
+ pfile_ndx < mprofile.profile_count ();
+ ++pfile_ndx)
+ {
+ TAO_Profile * const pfile = mprofile.get_profile (pfile_ndx);
+ TAO_Endpoint * ep_in_pfile = pfile->endpoint ();
+
+ if (TAO_debug_level > 2)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT("(%P|%t) Testing profile %d - ")
+ ACE_TEXT("it contains %d endpoints\n"),
+ pfile_ndx, pfile->endpoint_count()));
+
+ bool first_endpoint = true;
+ // Iterate the endpoints in the profile.
+ while (ep_in_pfile != 0 && pfile->endpoint_count() > 0)
+ {
+ // Iterate the endpoints in the endpoint policy to see if the endpoint
+ // in the profile matches.
+ CORBA::ULong ep_ndx = 0;
+ bool epmatch = false;
+ for (ep_ndx = 0; !epmatch && ep_ndx < num_endpoints; ++ep_ndx)
+ {
+ if (endpoints_[ep_ndx]->protocol_tag() != pfile->tag())
+ continue;
+
+ const EndpointPolicy::EndpointValueBase_ptr evb =
+ endpoints_[ep_ndx];
+
+ const TAO_Endpoint_Value_Impl *evi =
+ dynamic_cast <const TAO_Endpoint_Value_Impl*>(evb);
+
+ epmatch = evi->is_equivalent(ep_in_pfile);
+ }
+
+ // The endpoint in profile does not match the endpoint specified in
+ // Endpoint policy, now remove the endpoint from the profile.
+ if (!epmatch)
+ {
+ //Get next endpoint before removing current one.
+ TAO_Endpoint * next = ep_in_pfile->next ();
+ if (TAO_debug_level > 2)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("(%P|%t) EndpointPolicy filter ")
+ ACE_TEXT ("removing endpoint\n")));
+ pfile->remove_generic_endpoint (ep_in_pfile);
+ ep_in_pfile = first_endpoint ? pfile->endpoint() : next;
+ }
+ else
+ {
+ if (TAO_debug_level > 2)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("(%P|%t) EndpointPolicy filter ")
+ ACE_TEXT ("Endpoint matched policy value\n")));
+ ep_in_pfile = ep_in_pfile->next();
+ first_endpoint = false;
+ }
+ }
+ // Remove the profiles that have no endpoints match the endpoints in
+ // endpoint policy.
+ if (pfile->endpoint_count () == 0)
+ {
+ if (TAO_debug_level > 2)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT("(%P|%t) EndpointPolicy filter ")
+ ACE_TEXT("removing profile\n")));
+ mprofile.remove_profile (pfile);
+ --pfile_ndx; // step back one, we've just shifted the profile list.
+ }
+ else
+ {
+ if (TAO_debug_level > 2)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT("(%P|%t) EndpointPolicy filter ")
+ ACE_TEXT("profile retained with %d endpoints\n"),
+ pfile->endpoint_count()));
+ }
+ }
+
+ if (mprofile.profile_count () == 0) {
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT("(%P|%t) EndpointPolicy filter ")
+ ACE_TEXT("eliminated all profiles\n")));
+
+ return -1;
+ }
+
+ if (TAO_debug_level > 2)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT("(%P|%t) EndpointPolicy filter returning mprofile ")
+ ACE_TEXT("with %d profiles\n"),
+ mprofile.profile_count()));
+
+ return 0;
+}
+
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/EndpointPolicy/Endpoint_Acceptor_Filter.h b/TAO/tao/EndpointPolicy/Endpoint_Acceptor_Filter.h
new file mode 100644
index 00000000000..818c3847455
--- /dev/null
+++ b/TAO/tao/EndpointPolicy/Endpoint_Acceptor_Filter.h
@@ -0,0 +1,70 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Endpoint_Acceptor_Filter.h
+ *
+ * $Id$
+ *
+ * Subclass of TAO_Default_Acceptor_Filter that populates mprofile and filters
+ * mprofile with the endpoint policy in TAO_POA_Manager.
+ *
+ * @author Yan Dai <dai_y@ociweb.com>
+ */
+//=============================================================================
+
+
+#ifndef TAO_ENDPOINT_ACCEPTOR_FILTER_H
+#define TAO_ENDPOINT_ACCEPTOR_FILTER_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/EndpointPolicy/EndpointPolicy_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/Default_Acceptor_Filter.h"
+#include "tao/EndpointPolicy/EndpointPolicyC.h"
+
+class TAO_POA_Manager;
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+//=============================================================================
+/**
+ * @class TAO_Endpoint_Acceptor_Filter
+ *
+ * @brief Subclass of default Acceptor_Filter.
+ *
+ * Endpoint strategy for populating mprofile: only the endpoints match
+ * the POAManager endpoint policy are included.
+ */
+//=============================================================================
+class TAO_EndpointPolicy_Export TAO_Endpoint_Acceptor_Filter
+ : public TAO_Default_Acceptor_Filter
+{
+public:
+ TAO_Endpoint_Acceptor_Filter (EndpointPolicy::Policy_ptr p);
+
+ /// Populate @a mprofile with endpoints match the POAManager endpoint
+ /// policy.
+ int fill_profile (const TAO::ObjectKey &object_key,
+ TAO_MProfile &mprofile,
+ TAO_Acceptor **acceptors_begin,
+ TAO_Acceptor **acceptors_end,
+ CORBA::Short priority = TAO_INVALID_PRIORITY);
+
+private:
+ // this is the list of endpoints as obtained from the policy value supplied
+ // to the constructor.
+ EndpointPolicy::EndpointList_var endpoints_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_ENDPOINT_ACCEPTOR_FILTER_H */
diff --git a/TAO/tao/EndpointPolicy/Endpoint_Acceptor_Filter_Factory.cpp b/TAO/tao/EndpointPolicy/Endpoint_Acceptor_Filter_Factory.cpp
new file mode 100644
index 00000000000..f574001df26
--- /dev/null
+++ b/TAO/tao/EndpointPolicy/Endpoint_Acceptor_Filter_Factory.cpp
@@ -0,0 +1,56 @@
+// @(#) $Id$
+
+#include "tao/EndpointPolicy/Endpoint_Acceptor_Filter_Factory.h"
+#include "tao/EndpointPolicy/Endpoint_Acceptor_Filter.h"
+#include "tao/PortableServer/Default_Acceptor_Filter.h"
+#include "tao/PortableServer/POAManager.h"
+#include "tao/EndpointPolicy/EndpointPolicyC.h"
+
+ACE_RCSID(EndpointPolicy,
+ Endpoint_Acceptor_Filter_Factory,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+
+TAO_Endpoint_Acceptor_Filter_Factory::~TAO_Endpoint_Acceptor_Filter_Factory(void)
+{
+}
+
+ TAO_Acceptor_Filter*
+ TAO_Endpoint_Acceptor_Filter_Factory::create_object (TAO_POA_Manager& poamanager)
+{
+ CORBA::PolicyList& policies = poamanager.get_policies ();
+ EndpointPolicy::Policy_var policy;
+ TAO_Acceptor_Filter* filter = 0;
+ for (CORBA::ULong i = 0; i < policies.length(); i++)
+ {
+ if (policies[i]->policy_type() == EndpointPolicy::ENDPOINT_POLICY_TYPE)
+ {
+ policy = EndpointPolicy::Policy::_narrow (policies[i]);
+ ACE_NEW_RETURN (filter,
+ TAO_Endpoint_Acceptor_Filter (policy.in()),
+ 0);
+ return filter;
+ }
+ }
+ // no policy was in force, just return a default filter
+ ACE_NEW_RETURN (filter,
+ TAO_Default_Acceptor_Filter (),
+ 0);
+
+ return filter;
+}
+
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_FACTORY_DEFINE (TAO_EndpointPolicy, TAO_Endpoint_Acceptor_Filter_Factory)
+ACE_STATIC_SVC_DEFINE (TAO_Endpoint_Acceptor_Filter_Factory,
+ ACE_TEXT ("TAO_Acceptor_Filter_Factory"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (TAO_Endpoint_Acceptor_Filter_Factory),
+ ACE_Service_Type::DELETE_THIS
+ | ACE_Service_Type::DELETE_OBJ,
+ 0)
diff --git a/TAO/tao/EndpointPolicy/Endpoint_Acceptor_Filter_Factory.h b/TAO/tao/EndpointPolicy/Endpoint_Acceptor_Filter_Factory.h
new file mode 100644
index 00000000000..54a61c45c93
--- /dev/null
+++ b/TAO/tao/EndpointPolicy/Endpoint_Acceptor_Filter_Factory.h
@@ -0,0 +1,56 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Endpoint_Acceptor_Filter_Factory.h
+ *
+ * $Id$
+ *
+ * The factory of the TAO_Endpoint_Acceptor_Filter objects.
+ *
+ * @author Yan Dai <dai_y@ociweb.com>
+ */
+//=============================================================================
+
+#ifndef TAO_ENDPOINT_ACCEPTOR_FILTER_FACTORY_H
+#define TAO_ENDPOINT_ACCEPTOR_FILTER_FACTORY_H
+
+#include /**/ "ace/pre.h"
+#include "ace/Service_Config.h"
+
+#include "tao/EndpointPolicy/EndpointPolicy_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/Acceptor_Filter_Factory.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_Endpoint_Acceptor_Filter_Factory
+ *
+ * @brief The factory of the TAO_Endpoint_Acceptor_Filter objects.
+ *
+ * Factory service object that creates the TAO_Endpoint_Acceptor_Filter objects.
+ */
+class TAO_EndpointPolicy_Export TAO_Endpoint_Acceptor_Filter_Factory
+ : public TAO_Acceptor_Filter_Factory
+{
+public:
+ virtual ~TAO_Endpoint_Acceptor_Filter_Factory(void);
+
+ /// Create a new TAO_Endpoint_Acceptor_Filter object.
+ TAO_Acceptor_Filter* create_object (TAO_POA_Manager& poamanager);
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE_EXPORT (TAO_EndpointPolicy, TAO_Endpoint_Acceptor_Filter_Factory)
+ACE_FACTORY_DECLARE (TAO_EndpointPolicy, TAO_Endpoint_Acceptor_Filter_Factory)
+
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_ENDPOINT_ACCEPTOR_FILTER_FACTORY_H */
diff --git a/TAO/tao/EndpointPolicy/Endpoint_Value_Impl.cpp b/TAO/tao/EndpointPolicy/Endpoint_Value_Impl.cpp
new file mode 100644
index 00000000000..2dc63baaa8e
--- /dev/null
+++ b/TAO/tao/EndpointPolicy/Endpoint_Value_Impl.cpp
@@ -0,0 +1,20 @@
+// -*- C++ -*-
+//=============================================================================
+/**
+ * @file Endpoint_Value_Impl.cpp
+ *
+ * $Id$
+ *
+ * @author Phil Mesnier <mesnier_p@ociweb.com>
+ */
+//=============================================================================
+
+#include "tao/EndpointPolicy/Endpoint_Value_Impl.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Endpoint_Value_Impl::~TAO_Endpoint_Value_Impl()
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/EndpointPolicy/Endpoint_Value_Impl.h b/TAO/tao/EndpointPolicy/Endpoint_Value_Impl.h
new file mode 100644
index 00000000000..36b642e1b68
--- /dev/null
+++ b/TAO/tao/EndpointPolicy/Endpoint_Value_Impl.h
@@ -0,0 +1,61 @@
+// -*- C++ -*-
+//=============================================================================
+/**
+ * @file Endpoint_Value_Impl.h
+ *
+ * $Id$
+ *
+ * Implementation of the IIOP-Specific endpoint policy value
+ *
+ * @author Phil Mesnier <mesnier_p@ociweb.com>
+ */
+//=============================================================================
+
+#ifndef _TAO_ENDPOINT_VALUE_IMPL_H_
+#define _TAO_ENDPOINT_VALUE_IMPL_H_
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Basic_Types.h"
+#include "tao/EndpointPolicy/EndpointPolicy_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Endpoint;
+class TAO_Acceptor;
+
+/**
+ * @class Endpoint_Value_Impl
+ *
+ * @brief Abstract base class to be mixed in to servants of protocol
+ * specific EndpointValues.
+ *
+ * This inteface defines the methods necessary for the
+ * protocol-specific endpoint value to be used with the endpoint
+ * policy
+ */
+
+class TAO_EndpointPolicy_Export TAO_Endpoint_Value_Impl
+{
+public:
+ virtual ~TAO_Endpoint_Value_Impl(void);
+
+ /// This method is used to compare a candidate IOR endpoint with the
+ /// endpoint defined by this policy value.
+ virtual CORBA::Boolean is_equivalent (const TAO_Endpoint * ) const = 0;
+
+ /// This method is used by the framework to validate that an
+ /// acceptor is available to produce an endpoint required by at
+ /// least one of the endpoint policies values.
+ virtual CORBA::Boolean validate_acceptor (TAO_Acceptor *) const = 0;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* _TAO_Endpoint_Value_Impl_H_ */
diff --git a/TAO/tao/EndpointPolicy/IIOPEndpointValue.pidl b/TAO/tao/EndpointPolicy/IIOPEndpointValue.pidl
new file mode 100644
index 00000000000..c80b5dd90cd
--- /dev/null
+++ b/TAO/tao/EndpointPolicy/IIOPEndpointValue.pidl
@@ -0,0 +1,33 @@
+//
+// $Id$
+
+/**
+ * @file IIOPEndpointValue.pidl
+ *
+ * This file contains idl definition for Endpoint policy interface and
+ * the policy value. This TAO-specific policy is used to filter endpoints
+ * in the profiles for use in Object References.
+ */
+
+#ifndef _TAO_IIOPENDPOINT_VALUE_IDL_
+#define _TAO_IIOPENDPOINT_VALUE_IDL_
+
+///FUZZ: disable check_for_include/
+#include "tao/EndpointPolicy/EndpointPolicy.pidl"
+
+#if !defined (TAO_LACKS_IIOP)
+
+module EndpointPolicy
+{
+ local interface IIOPEndpointValue : EndpointValueBase
+ {
+ // protocol_tag set to TAG_Internet_IOP;
+
+ attribute string host;
+ attribute unsigned short port;
+ };
+};
+
+#endif /* TAO_LACKS_IIOP */
+
+#endif /* _TAO_IIOPENDPOINT_VALUE_IDL_ */
diff --git a/TAO/tao/EndpointPolicy/IIOPEndpointValue_i.cpp b/TAO/tao/EndpointPolicy/IIOPEndpointValue_i.cpp
new file mode 100644
index 00000000000..0e56b7a05de
--- /dev/null
+++ b/TAO/tao/EndpointPolicy/IIOPEndpointValue_i.cpp
@@ -0,0 +1,122 @@
+// -*- C++ -*-
+
+#include "tao/EndpointPolicy/IIOPEndpointValue_i.h"
+
+#if defined (TAO_HAS_IIOP) && (TAO_HAS_IIOP != 0)
+
+#include "tao/IIOP_Endpoint.h"
+#include "tao/IIOP_Acceptor.h"
+#include "ace/OS_NS_strings.h"
+
+ACE_RCSID (IIOPEndpointValue,
+ IIOPEndpointValue_i,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+IIOPEndpointValue_i::IIOPEndpointValue_i ()
+ :host_(CORBA::string_dup("")),
+ port_(0)
+{
+}
+
+IIOPEndpointValue_i::IIOPEndpointValue_i (const char *host,
+ CORBA::UShort port)
+ :host_(host),
+ port_(port)
+{
+}
+
+IIOPEndpointValue_i::~IIOPEndpointValue_i (void)
+{
+}
+
+CORBA::Boolean
+IIOPEndpointValue_i::is_equivalent (const TAO_Endpoint * endpoint) const
+{
+ const TAO_IIOP_Endpoint *iep =
+ dynamic_cast<const TAO_IIOP_Endpoint *>(endpoint);
+ if (iep == 0)
+ return 0;
+ return this->is_equivalent_i(iep->port(), iep->host());
+}
+
+CORBA::Boolean
+IIOPEndpointValue_i::is_equivalent_i (CORBA::UShort port,
+ const char *host) const
+{
+ return
+ this->port_ == port && ACE_OS::strcasecmp(host, this->host_.in()) == 0;
+}
+
+CORBA::Boolean
+IIOPEndpointValue_i::validate_acceptor(TAO_Acceptor * acceptor) const
+{
+ TAO_IIOP_Acceptor *iacc = dynamic_cast<TAO_IIOP_Acceptor *>(acceptor);
+ if (iacc == 0)
+ return 0;
+
+#if 0
+ // @@@ mesnier_p@ociweb.com @@@
+ // This test was originally intended to validate that there is an
+ // acceptor available which supports the target endpoint. However,
+ // variablility in the definition of a "hostname" makes this hard
+ // to determine, without adding more overhead, probably to the
+ // IIOP_Acceptor class.
+ // I'm not sure this level of validation is really required, so
+ // for now I'm just leaving it out.
+
+ const ACE_INET_Addr * eps = iacc->endpoints ();
+ CORBA::ULong eps_count = iacc->endpoint_count ();
+ for (CORBA::ULong eps_idx = 0; eps_idx < eps_count; ++ eps_idx)
+ {
+ char hostname[513];
+ eps[eps_idx].get_host_name(hostname,512);
+ if (this->is_equivalent_i(eps[eps_idx].get_port_number(),hostname))
+ return 1;
+ }
+ return 0;
+#else
+ return 1;
+#endif /* 0 */
+}
+
+char *
+IIOPEndpointValue_i::host ( void )
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return CORBA::string_dup (this->host_.in());
+}
+
+void
+IIOPEndpointValue_i::host (const char *h)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->host_ = h;
+}
+
+CORBA::UShort
+IIOPEndpointValue_i::port (void)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return this->port_;
+}
+
+void
+IIOPEndpointValue_i::port (CORBA::UShort p )
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->port_ = p;
+}
+
+
+CORBA::ULong
+IIOPEndpointValue_i::protocol_tag (void)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return IOP::TAG_INTERNET_IOP;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_IIOP && TAO_HAS_IIOP != 0 */
diff --git a/TAO/tao/EndpointPolicy/IIOPEndpointValue_i.h b/TAO/tao/EndpointPolicy/IIOPEndpointValue_i.h
new file mode 100644
index 00000000000..3d03d1fdfe8
--- /dev/null
+++ b/TAO/tao/EndpointPolicy/IIOPEndpointValue_i.h
@@ -0,0 +1,120 @@
+// -*- C++ -*-
+//=============================================================================
+/**
+ * @file IIOPEndpointValue_i.h
+ *
+ * $Id$
+ *
+ * Implementation of the IIOP-Specific endpoint policy value
+ *
+ * @author Phil Mesnier <mesnier_p@ociweb.com>
+ */
+//=============================================================================
+
+#ifndef _TAO_IIOP_ENDPOINT_VALUE_I_H_
+#define _TAO_IIOP_ENDPOINT_VALUE_I_H_
+
+#include /**/ "ace/pre.h"
+
+#include "tao/EndpointPolicy/EndpointPolicy_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/orbconf.h"
+
+#if defined (TAO_HAS_IIOP) && (TAO_HAS_IIOP != 0)
+
+#include "tao/EndpointPolicy/IIOPEndpointValueC.h"
+#include "tao/EndpointPolicy/Endpoint_Value_Impl.h"
+#include "tao/LocalObject.h"
+
+// This is to remove "inherits via dominance" warnings from MSVC.
+// MSVC is being a little too paranoid.
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class IIOPEndpointValue_i
+ *
+ * @brief Implementation of the IIOP-Specific endpoint policy value
+ *
+ * This class is used by applications to create an instance of an
+ * endpoint value for constructing an EndpointPolicy. While the
+ * endpoint policy argument is of type
+ * EndpointPolicy::EndpointValueBase, always use instances of this
+ * type so that the endpoint policy framework is able to call the
+ * equivalency test method.
+ */
+
+class TAO_EndpointPolicy_Export IIOPEndpointValue_i :
+ public virtual EndpointPolicy::IIOPEndpointValue,
+ public virtual TAO_Endpoint_Value_Impl,
+ public virtual TAO_Local_RefCounted_Object
+{
+public:
+
+ /// Default Constructor. It is acceptable to create an empty value
+ /// and modify the state via the attributes.
+ IIOPEndpointValue_i ();
+
+ /// Value initializing constructor, this is typically for creation
+ /// of one-off values.
+ IIOPEndpointValue_i (const char *host,
+ CORBA::UShort port);
+
+ virtual ~IIOPEndpointValue_i (void);
+
+ /// The is_equivalent test is used by the endpoint policy framework
+ /// for testing if a target endpoint is the same as the endpoint
+ /// defined by this value.
+ CORBA::Boolean is_equivalent (const TAO_Endpoint * endpoint) const;
+
+ /// The validate_acceptor method is used during EndpointPolicy
+ /// creation to ensure there is an acceptor which provides this
+ /// endpoint. Currently the test is limited to only validating that
+ /// the acceptor's tag is consistent, as the interfaces do not yet
+ /// exist for examining the eventual TAO_Endpoint values the
+ /// acceptor would produce.
+ CORBA::Boolean validate_acceptor (TAO_Acceptor *) const;
+
+ /// Host attribute get/set operators.
+ char * host ( void )
+ ACE_THROW_SPEC ((CORBA::SystemException));
+ void host (const char *)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Port attribute get/set operators.
+ CORBA::UShort port (void)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+ void port (CORBA::UShort )
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ // Protocol tag get operator, inherited from EndpointValueBase
+ CORBA::ULong protocol_tag (void)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+private:
+ CORBA::Boolean is_equivalent_i (CORBA::UShort port, const char *host) const;
+
+ CORBA::String_var host_;
+ CORBA::UShort port_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#endif /* TAO_HAS_IIOP && TAO_HAS_IIOP != 0 */
+
+#include /**/ "ace/post.h"
+
+#endif /* _TAO_IIOP_ENDPOINT_VALUE_I_H_ */
diff --git a/TAO/tao/EndpointPolicy/TAO_EndpointPolicy.pc.in b/TAO/tao/EndpointPolicy/TAO_EndpointPolicy.pc.in
new file mode 100644
index 00000000000..aae5ef22117
--- /dev/null
+++ b/TAO/tao/EndpointPolicy/TAO_EndpointPolicy.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: TAO_EndpointPolicy
+Description: TAO EndpointPolicy Library
+Requires: TAO_PI, TAO_PortableServer, TAO
+Version: @VERSION@
+Libs: -L${libdir} -lTAO_EndpointPolicy
+Cflags: -I${includedir}
diff --git a/TAO/tao/Endpoint_Selector_Factory.cpp b/TAO/tao/Endpoint_Selector_Factory.cpp
new file mode 100644
index 00000000000..6fc44b4efcc
--- /dev/null
+++ b/TAO/tao/Endpoint_Selector_Factory.cpp
@@ -0,0 +1,15 @@
+// $Id$
+
+#include "tao/Endpoint_Selector_Factory.h"
+
+ACE_RCSID (tao,
+ Endpoint_Selector_Factory,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Endpoint_Selector_Factory::~TAO_Endpoint_Selector_Factory (void)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Endpoint_Selector_Factory.h b/TAO/tao/Endpoint_Selector_Factory.h
new file mode 100644
index 00000000000..c3364874813
--- /dev/null
+++ b/TAO/tao/Endpoint_Selector_Factory.h
@@ -0,0 +1,80 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Endpoint_Selector_Factory.h
+ *
+ * $Id$
+ *
+ * Strategies for selecting profile/endpoint from an IOR for making an
+ * invocation.
+ *
+ * @author Marina Spivak <marina@cs.wustl.edu>
+ * @author Frank Hunleth <fhunleth@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_ENDPOINT_SELECTOR_FACTORY_H
+#define TAO_ENDPOINT_SELECTOR_FACTORY_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/TAO_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Versioned_Namespace.h"
+#include "ace/Service_Object.h"
+#include "ace/CORBA_macros.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace CORBA
+{
+ class Environment;
+
+ class Exception;
+}
+
+class TAO_Invocation_Endpoint_Selector;
+
+
+// ****************************************************************
+
+/**
+ * @class TAO_Endpoint_Selector_Factory
+ *
+ * @brief Factory for initializing <Endpoint_Selection_State> and
+ * obtaining appropriate <Invocation_Endpoint_Selector>.
+ *
+ * Used by Invocation classes to intialize its endpoint selection
+ * strategy and state based on the effective policies.
+ * Endpoint selection strategies are stateless objects - all the
+ * state they need is contained by Invocation in
+ * <Endpoint_Selection_State>. Thus, rather than allocating an
+ * endpoint selection strategy object for each Invocation, the
+ * factory simply returns the appropriate one from the
+ * set preallocated in the ORB_Core. One endpoint selection
+ * strategy object can be used by many invocations concurrently.
+ */
+class TAO_Export TAO_Endpoint_Selector_Factory
+ : public ACE_Service_Object
+{
+public:
+ /// Destructor.
+ virtual ~TAO_Endpoint_Selector_Factory (void);
+
+ /// Get an Invocation's endpoint selection strategy and
+ /// initialize the endpoint selection state instance.
+ virtual TAO_Invocation_Endpoint_Selector *get_selector (
+ ACE_ENV_SINGLE_ARG_DECL) = 0;
+
+
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_ENDPOINT_SELECTOR_FACTORY_H */
diff --git a/TAO/tao/Environment.cpp b/TAO/tao/Environment.cpp
new file mode 100644
index 00000000000..62b2ef0b142
--- /dev/null
+++ b/TAO/tao/Environment.cpp
@@ -0,0 +1,212 @@
+#include "tao/Environment.h"
+#include "tao/ORB_Core.h"
+#include "tao/SystemException.h"
+#include "tao/default_environment.h"
+
+#include "ace/OS_NS_string.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/Environment.i"
+#endif /* __ACE_INLINE__ */
+
+
+ACE_RCSID (tao,
+ Environment,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+CORBA::Environment::Environment (void)
+ : exception_ (0)
+ , previous_ (0)
+{
+}
+
+CORBA::Environment::Environment (const CORBA::Environment& rhs)
+ : exception_ (0)
+ , previous_ (0)
+{
+ if (rhs.exception_)
+ this->exception_ = rhs.exception_->_tao_duplicate ();
+}
+
+CORBA::Environment::Environment (TAO_ORB_Core* orb_core)
+ : exception_ (0)
+ , previous_ (orb_core->default_environment ())
+{
+ orb_core->default_environment (this);
+}
+
+CORBA::Environment&
+CORBA::Environment::operator= (const CORBA::Environment& rhs)
+{
+ CORBA::Environment tmp (rhs);
+ {
+ CORBA::Exception *tmp_ex = this->exception_;
+ this->exception_ = tmp.exception_;
+ tmp.exception_ = tmp_ex;
+ }
+ {
+ CORBA::Environment *tmp_env = this->previous_;
+ this->previous_ = rhs.previous_;
+ tmp.previous_ = tmp_env;
+ }
+ return *this;
+}
+
+CORBA::Environment::~Environment (void)
+{
+ this->clear ();
+
+ // If previous is 0 then this is the first Environment, allocated
+ // with the ORB, it shouldn't try to pop because the ORB is beign
+ // destroyed also.
+ if (this->previous_ != 0)
+ TAO_ORB_Core_instance ()->default_environment (this->previous_);
+}
+
+void
+CORBA::Environment::exception (CORBA::Exception *ex)
+{
+ // @@ This does not look right, setting the exception to the
+ // contained exception is a bug, the application is only
+ // supposed to pass in a pointer to an exception that it (the
+ // application) owns, however, if we contain the exception then
+ // *WE* own it.
+ // Normally I (coryan) would remove code like this, but I feel
+ // that it is a typical example of defensive programming for the
+ // *BAD*, i.e. we are not helping the application to get better
+ // and only making the ORB bigger and slower.
+#if 0
+ if (ex != this->exception_)
+ {
+ this->clear ();
+ }
+#else
+ ACE_ASSERT (ex != this->exception_);
+ this->clear ();
+#endif /* 0 */
+
+ this->exception_ = ex;
+
+#if defined (TAO_HAS_EXCEPTIONS)
+ if (this->exception_ != 0)
+ this->exception_->_raise ();
+#endif /* TAO_HAS_EXCEPTIONS */
+}
+
+void
+CORBA::Environment::clear (void)
+{
+ delete this->exception_;
+ this->exception_ = 0;
+}
+
+CORBA::Environment&
+CORBA::Environment::default_environment ()
+{
+#if defined (TAO_HAS_EXCEPTIONS)
+ //
+ // If we are using native C++ exceptions the user is *not* supposed
+ // to clear the environment every time she calls into TAO. In fact
+ // the user is not supposed to use the environment at all!
+ //
+ // But TAO is using the default environment internally, thus
+ // somebody has to clear it. Since TAO passes the environment around
+ // this function should only be called when going from the user code
+ // into TAO's code.
+ //
+ // This is not an issue when using the alternative C++ mapping (with
+ // the Environment argument) because then the user is supposed to
+ // clear the environment before calling into the ORB.
+ //
+ TAO_ORB_Core_instance ()->default_environment ()->clear ();
+#endif /* TAO_HAS_EXCEPTIONS */
+
+ return TAO_default_environment ();;
+}
+
+// Convenience -- say if the exception is a system exception or not.
+
+int
+CORBA::Environment::exception_type (void) const
+{
+ // @@ Carlos, is this stuff that's properly "transformed" for EBCDIC
+ // platforms?!
+ // @@ Doug: Yes, they are used to compare against the _id() of the
+ // exception, which should have been mappend to the native
+ // codeset. Notice the "should" we haven't tried that stuff yet,
+ // and i find it hard to keep track of all the transformations
+ // going on, specially for the TypeCodes that are generated by
+ // the IDL compiler vs. the ones hard-coded in
+ // $TAO_ROOT/tao/Typecode_Constants.cpp
+
+ static char sysex_prefix [] = "IDL:omg.org/CORBA/";
+ static char typecode_extra [] = "TypeCode/";
+
+ if (!this->exception_)
+ {
+ return CORBA::NO_EXCEPTION;
+ }
+
+ // All exceptions currently (CORBA 2.0) defined in the CORBA scope
+ // are system exceptions ... except for a couple that are related to
+ // TypeCodes.
+
+ const char *id = this->exception_->_rep_id ();
+
+ if ((ACE_OS::strncmp (id,
+ sysex_prefix,
+ sizeof sysex_prefix - 1) == 0
+ && ACE_OS::strncmp (id + sizeof sysex_prefix - 1,
+ typecode_extra,
+ sizeof typecode_extra - 1) != 0))
+ return CORBA::SYSTEM_EXCEPTION;
+ else
+ return CORBA::USER_EXCEPTION;
+}
+
+const char*
+CORBA::Environment::exception_id (void) const
+{
+ if (this->exception_ == 0)
+ return 0;
+
+ return this->exception_->_rep_id ();
+}
+
+// Diagnostic utility routine: describe the exception onto the
+// standard I/O stream passed as a parameter.
+
+void
+CORBA::Environment::print_exception (const char *info,
+ FILE *) const
+{
+ if (this->exception_)
+ {
+ const char *id = this->exception_->_rep_id ();
+
+ ACE_DEBUG ((LM_ERROR,
+ ACE_TEXT ("TAO: (%P|%t) EXCEPTION, %s\n"),
+ ACE_TEXT_CHAR_TO_TCHAR (info)));
+
+ CORBA::SystemException *x2 =
+ CORBA::SystemException::_downcast (this->exception_);
+
+ if (x2 != 0)
+ x2->_tao_print_system_exception ();
+ else
+ // @@ we can use the exception's typecode to dump all the data
+ // held within it ...
+
+ ACE_DEBUG ((LM_ERROR,
+ ACE_TEXT ("TAO: (%P|%t) user exception, ID '%s'\n"),
+ ACE_TEXT_CHAR_TO_TCHAR (id)));
+ }
+ else
+ ACE_DEBUG ((LM_ERROR,
+ ACE_TEXT ("TAO: (%P|%t) no exception, %s\n"), ACE_TEXT_CHAR_TO_TCHAR (info)));
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Environment.h b/TAO/tao/Environment.h
new file mode 100644
index 00000000000..4f7b428daeb
--- /dev/null
+++ b/TAO/tao/Environment.h
@@ -0,0 +1,162 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Environment.h
+ *
+ * $Id$
+ *
+ * Declare the CORBA::Environment class. Note that this header file
+ * only requires a few forward declarations of CORBA classes, this
+ * is *very* important because even the ORB needs to know about it;
+ * make your changes with care. It is also a good idea trying to
+ * minimize cross dependencies between header files.
+ *
+ * @author Carlos O'Ryan <coryan@cs.wustl.edu>
+ */
+//=============================================================================
+#ifndef TAO_ENVIRONMENT_H
+#define TAO_ENVIRONMENT_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/TAO_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Basic_Types.h"
+#include "tao/CORBA_methods.h"
+#include "tao/orbconf.h"
+#include "tao/Pseudo_VarOut_T.h"
+#include "tao/default_environment.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_ORB_Core;
+
+namespace CORBA
+{
+ class Exception;
+
+ class Environment;
+ typedef Environment *Environment_ptr;
+ typedef TAO_Pseudo_Var_T<Environment> Environment_var;
+ typedef TAO_Pseudo_Out_T<Environment> Environment_out;
+
+ /**
+ * @class Environment
+ *
+ * @brief Environment
+ *
+ * A CORBA::Environment is a way to automagically ensure that
+ * exception data is freed -- the "var" class for Exceptions. It
+ * adds just a bit of convenience function support, helping
+ * classify exceptions as well as reducing memory leakage.
+ * The thread has a default environment to simplify porting
+ * between platforms that support native C++ exceptions and those
+ * that don't. This is a TSS resource (always), but with a twist:
+ * if the user creates a new environment the old one is "pushed"
+ * (actually the new one remembers it), eventually the new
+ * environment destructor pops itself from the stack and we
+ * recover the old environment. This means that if the user
+ * create a new environment and somebody calls a function using
+ * the default one the exception will still be received in the
+ * environment created by the user. The only drawback is that
+ * environments life time must nest properly, this shouldn't be a
+ * problem because environments are usually created on the stack,
+ * but, the spec allows their creation on the heap and/or as class
+ * members; we need to investigate the tradeoffs and take a
+ * decision.
+ */
+ class TAO_Export Environment
+ {
+ public:
+ /// The default constructor. The environment will hold no
+ /// exceptions.
+ Environment (void);
+
+ /// Copy constructor.
+ Environment (const Environment &ACE_TRY_ENV);
+
+ /// Assingment.
+ Environment &operator=(const Environment &ACE_TRY_ENV);
+
+ /// Destructor, release the exception.
+ ~Environment (void);
+
+ /// Some static methods that need to be defined in every pseudo object
+ static Environment * _duplicate (Environment *);
+ static Environment * _nil (void);
+
+ /// Return the contained CORBA::Exception.
+ /**
+ * CORBA::Environment retains ownership of the exception, this is
+ * contrary to the normal memory management rules in the C++
+ * mapping, but actually mandated by the specification:
+ *
+ * "C++ Language Mapping" (formal/00-01-02). Section 1.27
+ * Environment (page 1-113)
+ */
+ CORBA::Exception* exception (void) const;
+
+ /// Set the contained CORBA::Exception to <ex>
+ /**
+ * CORBA::Environment assumes ownership of the exception, this is
+ * contrary to the normal memory management rules in the C++
+ * mapping, but actually mandated by the specification:
+ *
+ * "C++ Language Mapping" (formal/00-01-02). Section 1.27
+ * Environment (page 1-113)
+ *
+ */
+ void exception (CORBA::Exception *ex);
+
+ /// Return if the exception is a user exception or a system
+ /// exception.
+ int exception_type (void) const;
+
+ /// return the repository ID for the exception.
+ const char *exception_id (void) const;
+
+ /// Clear the exception.
+ void clear (void);
+
+ /// Print the exception to output determined by f. This function
+ /// is not CORBA compliant.
+ void print_exception (const char *info,
+ FILE *f=stdout) const;
+
+ // = Obtain a default environment to use with TAO.
+ static CORBA::Environment &default_environment (void);
+
+ // Useful for template programming.
+ typedef CORBA::Environment_ptr _ptr_type;
+ typedef CORBA::Environment_var _var_type;
+ typedef CORBA::Environment_out _out_type;
+
+ private:
+
+ /// Initialize using a well known ORB Core; this is intended for
+ /// the bootstraping of the ORB_Core, not for general
+ /// consumption.
+ Environment (TAO_ORB_Core *orb_core);
+
+ /// Pointer to the exception object contained in the environment.
+ CORBA::Exception *exception_;
+
+ /// The previous environment on the "default environment stack".
+ Environment *previous_;
+ };
+} // End CORBA namespace
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+
+#if defined (__ACE_INLINE__)
+# include "tao/Environment.i"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_ENVIRONMENT_H */
diff --git a/TAO/tao/Environment.i b/TAO/tao/Environment.i
new file mode 100644
index 00000000000..a8547215d6d
--- /dev/null
+++ b/TAO/tao/Environment.i
@@ -0,0 +1,54 @@
+// -*- C++ -*-
+//
+// $Id$
+
+
+#include "ace/OS_Memory.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+CORBA::Boolean
+CORBA::is_nil (CORBA::Environment_ptr env)
+{
+ return env == 0;
+}
+
+ACE_INLINE
+void
+CORBA::release (CORBA::Environment_ptr env)
+{
+ delete env;
+}
+
+ACE_INLINE
+CORBA::Exception *
+CORBA::Environment::exception (void) const
+{
+ return this->exception_;
+}
+
+ACE_INLINE
+CORBA::Environment *
+CORBA::Environment::_duplicate (CORBA::Environment *x)
+{
+ if (x == 0)
+ {
+ return 0;
+ }
+
+ CORBA::Environment* ptr = 0;
+ ACE_NEW_RETURN (ptr,
+ CORBA::Environment (*x),
+ 0);
+ return ptr;
+}
+
+ACE_INLINE
+CORBA::Environment_ptr
+CORBA::Environment::_nil (void)
+{
+ return static_cast <CORBA::Environment_ptr> (0);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Exception.cpp b/TAO/tao/Exception.cpp
new file mode 100644
index 00000000000..16f65716ead
--- /dev/null
+++ b/TAO/tao/Exception.cpp
@@ -0,0 +1,143 @@
+// $Id$
+
+#include "tao/Exception.h"
+#include "tao/SystemException.h"
+#include "tao/Environment.h"
+#include "tao/ORB_Constants.h"
+#include "tao/CORBA_String.h"
+#include "tao/CDR.h"
+#include "tao/debug.h"
+
+#include "ace/Malloc.h"
+#include "ace/SString.h"
+#include "ace/OS_NS_string.h"
+
+
+#if !defined (ACE_LACKS_IOSTREAM_TOTALLY)
+// Needed for ostream& operator<< (ostream &os, const CORBA::Exception &e)
+// FUZZ: disable check_for_streams_include
+#include "ace/streams.h"
+#endif /* (ACE_LACKS_IOSTREAM_TOTALLY) */
+
+#if !defined (__ACE_INLINE__)
+# include "tao/Exception.i"
+#endif /* __ACE_INLINE__ */
+
+#include "ace/OS_NS_stdio.h"
+
+ACE_RCSID (tao,
+ Exception,
+ "$Id$")
+
+
+// ****************************************************************
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+CORBA::Exception::Exception (const char * repository_id,
+ const char * local_name)
+ : id_ (CORBA::string_dup (repository_id)),
+ name_ (CORBA::string_dup (local_name))
+{
+ ACE_ASSERT (this->id_.in () != 0 && this->name_.in () != 0);
+}
+
+CORBA::Exception::Exception (const CORBA::Exception &src)
+ : id_ (CORBA::string_dup (src.id_)),
+ name_ (CORBA::string_dup (src.name_))
+{
+ ACE_ASSERT (this->id_.in () != 0 && this->name_.in () != 0);
+}
+
+// NOTE: It's this code, not anything defined in a subclass, which is
+// responsible for releasing any storage owned by the exception. It
+// can do this because it's got the local name and the id.
+
+CORBA::Exception::Exception (void)
+ : id_ (),
+ name_ ()
+{
+}
+
+CORBA::Exception::~Exception (void)
+{
+}
+
+CORBA::Exception &
+CORBA::Exception::operator= (const CORBA::Exception &src)
+{
+ this->id_ = CORBA::string_dup (src.id_);
+ ACE_ASSERT (this->id_.in () != 0);
+
+ this->name_ = CORBA::string_dup (src.name_);
+ ACE_ASSERT (this->name_.in () != 0);
+
+ return *this;
+}
+
+const char *
+CORBA::Exception::_rep_id (void) const
+{
+ return this->id_.in ();
+}
+
+const char *
+CORBA::Exception::_name (void) const
+{
+ return this->name_.in ();
+}
+
+void
+CORBA::Exception::_tao_print_exception (const char *user_provided_info,
+ FILE *) const
+{
+ ACE_DEBUG ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) EXCEPTION, %s\n")
+ ACE_TEXT ("%s\n"),
+ ACE_TEXT_CHAR_TO_TCHAR (user_provided_info),
+ ACE_TEXT_CHAR_TO_TCHAR (this->_info ().c_str ())));
+}
+
+#if defined (ACE_USES_WCHAR)
+void
+CORBA::Exception::_tao_print_exception (const ACE_WCHAR_T *info,
+ FILE *f) const
+{
+ // Even though this call causes additional type conversions, this is
+ // better for the maintenance. Plus, this will occur only on
+ // exception anyway.
+ this->_tao_print_exception (ACE_TEXT_ALWAYS_CHAR (info), f);
+}
+#endif // ACE_USES_WCHAR
+
+void
+CORBA::Exception::_tao_any_destructor (void *x)
+{
+ CORBA::Exception *tmp = static_cast<CORBA::Exception *> (x);
+ delete tmp;
+}
+
+#if !defined (ACE_LACKS_IOSTREAM_TOTALLY)
+
+namespace CORBA
+{
+ ACE_OSTREAM_TYPE& operator<< (ACE_OSTREAM_TYPE &os,
+ const CORBA::Exception &e)
+ {
+ os << e._name () << " (" << e._rep_id () << ')';
+
+ return os;
+ }
+
+ ACE_OSTREAM_TYPE& operator<< (ACE_OSTREAM_TYPE &os,
+ const CORBA::Exception *e)
+ {
+ os << e->_name () << " (" << e->_rep_id () << ')';
+
+ return os;
+ }
+}
+
+#endif /* (ACE_LACKS_IOSTREAM_TOTALLY) */
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Exception.h b/TAO/tao/Exception.h
new file mode 100644
index 00000000000..08c631d3521
--- /dev/null
+++ b/TAO/tao/Exception.h
@@ -0,0 +1,238 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Exception.h
+ *
+ * $Id$
+ *
+ * This file defines way in which CORBA exceptions are reported.
+ *
+ * @author DOC Group at Vanderbilt U., Wash U, and UCI
+ */
+//=============================================================================
+
+#ifndef TAO_EXCEPTION_H
+#define TAO_EXCEPTION_H
+
+#include /**/ "ace/pre.h"
+
+// Do not try removing this. If you remove this for subsetting lots of
+// things go wrong in TAO.
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+// This is used in the implementation of the _raise methods
+#if defined (TAO_HAS_EXCEPTIONS)
+#define TAO_RAISE(EXCEPTION) throw EXCEPTION
+#else
+#define TAO_RAISE(EXCEPTION)
+#endif /* ACE_HAS_EXCEPTIONS */
+
+#include "tao/TAO_Export.h"
+#include "tao/Basic_Types.h"
+#include "tao/CORBA_String.h"
+#include "ace/SStringfwd.h"
+#include "ace/iosfwd.h"
+#include "ace/CORBA_macros.h"
+
+ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+class ACE_Allocator;
+ACE_END_VERSIONED_NAMESPACE_DECL
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_OutputCDR;
+class TAO_InputCDR;
+
+#if defined (THREAD_CANCELLED)
+#undef THREAD_CANCELLED
+#endif /* THREAD_CANCELLED */
+
+// This is already done in orbconf.h. But this file is totally
+// decoupled from its contents that we have to do this here. Including
+// orbconf.h is probably going to be a overhead.
+#if defined (minor)
+#undef minor
+#endif /* minor */
+
+namespace CORBA
+{
+ class TypeCode;
+ typedef TypeCode * TypeCode_ptr;
+
+ class Environment;
+
+ class Any;
+ typedef Any * Any_ptr;
+
+ class SystemException;
+
+ /**
+ * @enum exception_type
+ *
+ * @brief Enumeration used to identify the type of CORBA exception.
+ *
+ * CORBA exceptions generally fall into two categories, user
+ * exceptions and system exceptions. This enumeration is used when
+ * identifying the type of CORBA exception.
+ */
+ enum exception_type
+ {
+ NO_EXCEPTION,
+ USER_EXCEPTION,
+ SYSTEM_EXCEPTION
+ };
+
+ /**
+ * @class Exception
+ *
+ * @brief Exception
+ *
+ * CORBA2-specified exception hierarchy. All exceptions have a
+ * type (represented by a @c TypeCode) and a widely scoped type ID
+ * (in the @c TypeCode) that are generated by any OMG-IDL compiler
+ * and available through the Interface Repository. Think of it as a
+ * "globally scoped" name distinguishing each exception.
+ *
+ * @todo According to the OMG CORBA C++ Mapping version 1.1,
+ * the copy constructors
+ * should be moved to "protected" section in class
+ * declarations. Since the current MS Visual C++ 7.1 compiler
+ * will cause some problems to TAO's exception mechanism, we
+ * defer doing this until we drop support for MSVC++ 7.1. Maybe
+ * there is another solution, have to test that later.
+ */
+ class TAO_Export Exception
+ {
+ public:
+ /// Destructor.
+ virtual ~Exception (void);
+
+ /// Copy constructor.
+ Exception (const Exception &src);
+
+ // = To throw the exception (when using the standard mapping).
+ virtual void _raise (void) const = 0;
+
+ // = The static narrow operations.
+ static Exception * _downcast (Exception * x);
+ static Exception const * _downcast (Exception const * x);
+
+ /// Return the repository ID of the Exception.
+ virtual const char * _rep_id (void) const;
+
+ /// Return the name of the Exception.
+ virtual const char * _name (void) const;
+
+ // = These are TAO-specific extensions.
+
+ /// Will be overridden in the concrete derived classes.
+ virtual CORBA::TypeCode_ptr _tao_type (void) const = 0;
+
+ /// Print the exception to output determined by @a f.
+ /**
+ * @note This method is TAO-specific.
+ */
+ void _tao_print_exception (const char *info,
+ FILE *f = stdout) const;
+
+#if defined (ACE_USES_WCHAR)
+ /// ACE_WCHAR_T version of _tao_print_exception.
+ /**
+ * @note This method is TAO-specific.
+ */
+ void _tao_print_exception (const ACE_WCHAR_T *info,
+ FILE *f = stdout) const;
+#endif // ACE_USES_WCHAR
+
+ /// Returns a string containing information about the exception. This
+ /// function is not CORBA compliant.
+ virtual ACE_CString _info (void) const = 0;
+
+ virtual void _tao_encode (TAO_OutputCDR &cdr
+ ACE_ENV_ARG_DECL) const = 0;
+
+ virtual void _tao_decode (TAO_InputCDR &cdr
+ ACE_ENV_ARG_DECL) = 0;
+
+ /// Used in the non-copying Any insertion operator.
+ static void _tao_any_destructor (void *);
+
+ /// Deep copy
+ /**
+ * The following operation is used in the implementation of
+ * it performs a deep copy of the
+ * exception, normally it is implemented as:
+ *
+ * <PRE>
+ * class SomeException : public // Derives from CORBA::Exception
+ * {
+ * public:
+ * virtual CORBA::Exception *_tao_duplicate (void) const
+ * {
+ * CORBA::Exception *result = 0;
+ * ACE_NEW_RETURN (
+ * result,
+ * SomeException (*this),
+ * 0
+ * );
+ * return result;
+ * }
+ * };
+ * </PRE>
+ */
+ virtual CORBA::Exception *_tao_duplicate (void) const = 0;
+
+ protected:
+
+ /// Default constructor.
+ Exception (void);
+
+ /// Assignment operator.
+ Exception & operator = (const Exception & src);
+
+ /// Construct from a respository id.
+ Exception (const char *repository_id,
+ const char *local_name);
+
+ private:
+
+ /// Repository Id
+ CORBA::String_var id_;
+
+ /// Local name.
+ CORBA::String_var name_;
+
+ };
+
+#if !defined (ACE_LACKS_IOSTREAM_TOTALLY)
+
+ // Required by C++ mapping.
+ TAO_Export ACE_OSTREAM_TYPE& operator<< (ACE_OSTREAM_TYPE &os,
+ const CORBA::Exception &e);
+
+ TAO_Export ACE_OSTREAM_TYPE& operator<< (ACE_OSTREAM_TYPE &os,
+ const CORBA::Exception *e);
+
+#endif /* (ACE_LACKS_IOSTREAM_TOTALLY) */
+} // End CORBA namespace
+
+namespace TAO
+{
+ /// Create a CORBA::SystemException given the interface repository ID.
+ TAO_Export CORBA::SystemException *create_system_exception (const char *id);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/Exception.i"
+#endif /* __ACE_INLINE__ */
+
+#include /**/"ace/post.h"
+
+#endif /* TAO_EXCEPTION_H */
diff --git a/TAO/tao/Exception.i b/TAO/tao/Exception.i
new file mode 100644
index 00000000000..2a77bfab959
--- /dev/null
+++ b/TAO/tao/Exception.i
@@ -0,0 +1,19 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE CORBA::Exception *
+CORBA::Exception::_downcast (CORBA::Exception * x)
+{
+ return x;
+}
+
+ACE_INLINE CORBA::Exception const *
+CORBA::Exception::_downcast (CORBA::Exception const * x)
+{
+ return x;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Exception_Data.h b/TAO/tao/Exception_Data.h
new file mode 100644
index 00000000000..ff1794b49db
--- /dev/null
+++ b/TAO/tao/Exception_Data.h
@@ -0,0 +1,68 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Exception_Data.h
+ *
+ * $Id$
+ *
+ * @author balachandran Natarajan <bala@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_EXCEPTION_DATA_H
+#define TAO_EXCEPTION_DATA_H
+#include /**/ "ace/pre.h"
+
+#include "ace/config-all.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/orbconf.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace CORBA
+{
+ class TypeCode;
+ typedef TypeCode *TypeCode_ptr;
+}
+
+namespace TAO
+{
+ // Function pointer returning a pointer to CORBA::Exception. This is used to
+ // describe the allocator for user-defined exceptions that are used internally
+ // by the interpreter.
+ typedef CORBA::Exception* (*TAO_Exception_Alloc) (void);
+
+ /**
+ * @struct Exception_Data
+ *
+ * @brief Description of a single exception.
+ *
+ * The interpreter needs a way to allocate memory to hold the exception
+ * that was raised by the stub. This data structure provides the typecode
+ * for the exception as well as a static function pointer that
+ * does the job of memory allocation.
+ */
+ struct Exception_Data
+ {
+ /// Repository id of the exception.
+ const char *id;
+
+ /// The allocator for this exception.
+ TAO_Exception_Alloc alloc;
+
+#if TAO_HAS_INTERCEPTORS == 1
+ /// The typecode pointer for this exception.
+ CORBA::TypeCode_ptr tc_ptr;
+#endif /* TAO_HAS_INTERCEPTORS */
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /*TAO_EXCEPTION_DATA_H*/
diff --git a/TAO/tao/Exclusive_TMS.cpp b/TAO/tao/Exclusive_TMS.cpp
new file mode 100644
index 00000000000..47145cfff9b
--- /dev/null
+++ b/TAO/tao/Exclusive_TMS.cpp
@@ -0,0 +1,131 @@
+// $Id$
+
+#include "tao/Exclusive_TMS.h"
+#include "tao/Reply_Dispatcher.h"
+#include "tao/debug.h"
+#include "tao/Transport.h"
+
+ACE_RCSID (tao,
+ Exclusive_TMS,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Exclusive_TMS::TAO_Exclusive_TMS (TAO_Transport *transport)
+ : TAO_Transport_Mux_Strategy (transport),
+ request_id_generator_ (0),
+ has_request_ (0),
+ request_id_ (0),
+ rd_ (0)
+{
+}
+
+TAO_Exclusive_TMS::~TAO_Exclusive_TMS (void)
+{
+}
+
+// Generate and return an unique request id for the current
+// invocation. We can actually return a predecided ULong, since we
+// allow only one invocation over this connection at a time.
+CORBA::ULong
+TAO_Exclusive_TMS::request_id (void)
+{
+ ++this->request_id_generator_;
+
+ // if TAO_Transport::bidirectional_flag_
+ // == 1 --> originating side
+ // == 0 --> other side
+ // == -1 --> no bi-directional connection was negotiated
+ // The originating side must have an even request ID, and the other
+ // side must have an odd request ID. Make sure that is the case.
+ int bidir_flag =
+ this->transport_->bidirectional_flag ();
+
+ if ((bidir_flag == 1 && ACE_ODD (this->request_id_generator_))
+ || (bidir_flag == 0 && ACE_EVEN (this->request_id_generator_)))
+ ++this->request_id_generator_;
+
+ if (TAO_debug_level > 4)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - Exclusive_TMS::request_id - <%d>\n"),
+ this->request_id_generator_));
+
+ return this->request_id_generator_;
+}
+
+// Bind the handler with the request id.
+int
+TAO_Exclusive_TMS::bind_dispatcher (CORBA::ULong request_id,
+ TAO_Reply_Dispatcher *rd)
+{
+ this->has_request_ = 1;
+ this->request_id_ = request_id;
+ this->rd_ = rd;
+
+ return 0;
+}
+
+int
+TAO_Exclusive_TMS::unbind_dispatcher (CORBA::ULong request_id)
+{
+ if (!this->has_request_ || this->request_id_ != request_id)
+ return -1;
+ this->has_request_ = 0;
+ this->request_id_ = 0;
+ this->rd_ = 0;
+
+ return 0;
+}
+
+int
+TAO_Exclusive_TMS::dispatch_reply (TAO_Pluggable_Reply_Params &params)
+{
+ // Check the ids.
+ if (!this->has_request_ || this->request_id_ != params.request_id_)
+ {
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("(%P|%t) TAO_Exclusive_TMS::dispatch_reply - <%d != %d>\n"),
+ this->request_id_, params.request_id_));
+
+ // The return value 0 informs the transport that the mux strategy
+ // did not find the right reply handler.
+ return 0;
+ }
+
+ TAO_Reply_Dispatcher *rd = this->rd_;
+ this->has_request_ = 0;
+ this->request_id_ = 0; // @@ What is a good value???
+ this->rd_ = 0;
+
+ // Dispatch the reply.
+ // Returns 1 on success, -1 on failure.
+ return rd->dispatch_reply (params);
+}
+
+bool
+TAO_Exclusive_TMS::idle_after_send (void)
+{
+ return false;
+}
+
+bool
+TAO_Exclusive_TMS::idle_after_reply (void)
+{
+ // Irrespective of whether we are successful or not we need to
+ // return true. If *this* class is not successfull in idling the
+ // transport no one can.
+ if (this->transport_ != 0)
+ (void) this->transport_->make_idle ();
+
+ return true;
+}
+
+void
+TAO_Exclusive_TMS::connection_closed (void)
+{
+ if (this->rd_ != 0)
+ this->rd_->connection_closed ();
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Exclusive_TMS.h b/TAO/tao/Exclusive_TMS.h
new file mode 100644
index 00000000000..84f659bcc68
--- /dev/null
+++ b/TAO/tao/Exclusive_TMS.h
@@ -0,0 +1,97 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Exclusive_TMS.h
+ *
+ * $Id$
+ *
+ * @author Alexander Babu Arulanthu <alex@cs.wustl.edu>
+ */
+//=============================================================================
+
+
+#ifndef TAO_EXCLUSIVE_TMS_H
+#define TAO_EXCLUSIVE_TMS_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Transport_Mux_Strategy.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Pluggable_Reply_Params;
+
+/**
+ * @class TAO_Exclusive_TMS
+ *
+ * Using this strategy only one request can be pending at a time
+ * in a connection. This improves performance because the client
+ * does not have to demux the reply, and there is less need for
+ * synchronization.
+ * On the other hand, it does not scale well when you have
+ * multiple client threads or asynchronous messaging.
+ */
+class TAO_Export TAO_Exclusive_TMS : public TAO_Transport_Mux_Strategy
+{
+
+public:
+ /// Constructor.
+ TAO_Exclusive_TMS (TAO_Transport *transport);
+
+ /// Destructor.
+ virtual ~TAO_Exclusive_TMS (void);
+
+ /**
+ * @name The TAO_Transport_Mux_Strategy overrided methods
+ *
+ * Please read the documentation in the TAO_Transport_Mux_Strategy class
+ * for details.
+ */
+ //@{
+ virtual CORBA::ULong request_id (void);
+ virtual int bind_dispatcher (CORBA::ULong request_id,
+ TAO_Reply_Dispatcher *rh);
+ virtual int unbind_dispatcher (CORBA::ULong request_id);
+
+ virtual int dispatch_reply (TAO_Pluggable_Reply_Params &params);
+
+ virtual bool idle_after_send (void);
+ virtual bool idle_after_reply (void);
+ virtual void connection_closed (void);
+ //@}
+
+protected:
+ /// Used to generate a different request_id on each call to
+ /// request_id().
+ CORBA::ULong request_id_generator_;
+
+ /// If 0 then the request id and reply dispatcher below are
+ /// meaningless
+ int has_request_;
+
+ /// Request id for the current request.
+ CORBA::ULong request_id_;
+
+ /// Reply Dispatcher corresponding to the request.
+ TAO_Reply_Dispatcher *rd_;
+
+ // @@ Commented for the time being, let the commented line stay for
+ // sometime - Bala
+ // TAO_GIOP_Message_State message_state_;
+ // Message state to read the incoming message.
+
+ // @@ Having members of type TAO_GIOP* indicates that we
+ // (Transport_Mux_Strategy) are aware of the underlying messaging
+ // protocol. But for the present let us close our eyes till we are
+ // able to iterate on a use case - Bala.
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* EXCLUSIVE_TMS_H */
diff --git a/TAO/tao/FILE_Parser.cpp b/TAO/tao/FILE_Parser.cpp
new file mode 100644
index 00000000000..b092eea96be
--- /dev/null
+++ b/TAO/tao/FILE_Parser.cpp
@@ -0,0 +1,92 @@
+// $Id$
+
+#include "tao/FILE_Parser.h"
+#include "tao/ORB.h"
+#include "tao/Environment.h"
+#include "tao/Object.h"
+
+#include "ace/Read_Buffer.h"
+
+#include "ace/Malloc_Base.h"
+#include "ace/Log_Msg.h"
+#include "ace/OS_NS_stdio.h"
+#include "ace/OS_NS_string.h"
+
+
+ACE_RCSID (tao,
+ FILE_Parser,
+ "$Id$")
+
+
+static const char file_prefix[] = "file:";
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_FILE_Parser::~TAO_FILE_Parser (void)
+{
+}
+
+
+int
+TAO_FILE_Parser::match_prefix (const char *ior_string) const
+{
+ return (ACE_OS::strncmp (ior_string,
+ ::file_prefix,
+ sizeof (::file_prefix) - 1) == 0);
+}
+
+CORBA::Object_ptr
+TAO_FILE_Parser::parse_string (const char *ior,
+ CORBA::ORB_ptr orb
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ // Skip the prefix, we know it is there because this method in only
+ // called if <match_prefix> returns 1.
+ const char *filename =
+ ior + sizeof (::file_prefix)+1;
+
+ FILE* file = ACE_OS::fopen (ACE_TEXT_CHAR_TO_TCHAR (filename),
+ ACE_TEXT("r"));
+
+ if (file == 0)
+ return CORBA::Object::_nil ();
+
+ ACE_Read_Buffer reader (file, 1);
+
+ char* string = reader.read ();
+
+ if (string == 0)
+ return CORBA::Object::_nil ();
+
+ CORBA::Object_ptr object = CORBA::Object::_nil ();
+ ACE_TRY
+ {
+ object = orb->string_to_object (string ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ reader.alloc ()->free (string);
+ }
+ ACE_CATCHANY
+ {
+ reader.alloc ()->free (string);
+ ACE_RE_THROW;
+ }
+ ACE_ENDTRY;
+ ACE_CHECK_RETURN (CORBA::Object::_nil ());
+
+ return object;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DEFINE (TAO_FILE_Parser,
+ ACE_TEXT ("FILE_Parser"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (TAO_FILE_Parser),
+ ACE_Service_Type::DELETE_THIS |
+ ACE_Service_Type::DELETE_OBJ,
+ 0)
+
+ACE_FACTORY_DEFINE (TAO, TAO_FILE_Parser)
+
diff --git a/TAO/tao/FILE_Parser.h b/TAO/tao/FILE_Parser.h
new file mode 100644
index 00000000000..70ef8805d96
--- /dev/null
+++ b/TAO/tao/FILE_Parser.h
@@ -0,0 +1,60 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file FILE_Parser.h
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan (coryan@cs.wustl.edu)
+ */
+//=============================================================================
+
+
+#ifndef TAO_FILE_PARSER_H
+#define TAO_FILE_PARSER_H
+
+#include /**/ "ace/pre.h"
+#include "ace/Service_Config.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/IOR_Parser.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_FILE_Parser
+ *
+ * @brief Implements the <file:> IOR format
+ *
+ * This class implements the <file:> IOR format.
+ * It is dynamically loaded by the ORB and used to open a file,
+ * read its contents and then interepret the file as an IOR (that
+ * can be in any valid format).
+ */
+class TAO_FILE_Parser : public TAO_IOR_Parser
+{
+public:
+
+ /// The destructor
+ virtual ~TAO_FILE_Parser (void);
+
+ // = The IOR_Parser methods, please read the documentation in
+ // IOR_Parser.h
+ virtual int match_prefix (const char *ior_string) const;
+ virtual CORBA::Object_ptr parse_string (const char *ior,
+ CORBA::ORB_ptr orb
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE_EXPORT (TAO, TAO_FILE_Parser)
+ACE_FACTORY_DECLARE (TAO, TAO_FILE_Parser)
+
+#include /**/ "ace/post.h"
+#endif /* TAO_FILE_PARSER_H */
diff --git a/TAO/tao/Fault_Tolerance_Service.cpp b/TAO/tao/Fault_Tolerance_Service.cpp
new file mode 100644
index 00000000000..fedcae19465
--- /dev/null
+++ b/TAO/tao/Fault_Tolerance_Service.cpp
@@ -0,0 +1,66 @@
+#include "tao/Fault_Tolerance_Service.h"
+#include "tao/Services_Activate.h"
+#include "tao/ORB_Core.h"
+#include "tao/Client_Strategy_Factory.h"
+
+#include "ace/Dynamic_Service.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/Fault_Tolerance_Service.i"
+#endif /* __ACE_INLINE__ */
+
+ACE_RCSID (tao,
+ Fault_Tolerance_Service,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Fault_Tolerance_Service::~TAO_Fault_Tolerance_Service (void)
+{
+ delete this->ft_service_callback_;
+ delete this->ft_object_retention_id_lock_;
+}
+
+void
+TAO_Fault_Tolerance_Service::init (TAO_ORB_Core *orb_core)
+{
+ // Look in to the svc conf stuff to get an instance of the
+ // FT_Service.
+ if (this->ft_service_callback_ == 0)
+ {
+ TAO_Services_Activate *service =
+ ACE_Dynamic_Service <TAO_Services_Activate>::instance ("FT_ClientService_Activate");
+
+ // Activate the callback
+ if (service)
+ this->ft_service_callback_ = service->activate_services (orb_core);
+ }
+
+ // If we have a valid service then we instantiate our lock and the
+ // client id
+ if (this->ft_service_callback_)
+ {
+ // Initialize the lock
+ this->ft_object_retention_id_lock_ =
+ orb_core->client_factory ()
+ ->create_ft_service_retention_id_lock ();
+
+ // Initialize the client id
+ this->ft_object_id_ = "TAO_Client";
+ }
+
+ return;
+}
+
+CORBA::Long
+TAO_Fault_Tolerance_Service::retention_id (void)
+{
+ ACE_MT (ACE_GUARD_RETURN (ACE_Lock,
+ guard,
+ *this->ft_object_retention_id_lock_,
+ 0));
+
+ return ++this->ft_object_retention_id_;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Fault_Tolerance_Service.h b/TAO/tao/Fault_Tolerance_Service.h
new file mode 100644
index 00000000000..39e2799754f
--- /dev/null
+++ b/TAO/tao/Fault_Tolerance_Service.h
@@ -0,0 +1,109 @@
+//-*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Fault_Tolerance_Service.h
+ *
+ * $Id$
+ *
+ * A collection of the ORB and ORB core related properties that are
+ * specific to FT service. The TAO_ORB_Core holds an instance of this
+ * class.
+ *
+ *
+ * @author Bala Natarajan <bala@cs.wustl.edu>
+ */
+//=============================================================================
+#ifndef TAO_FAULT_TOLERANCE_SERVICE_H
+#define TAO_FAULT_TOLERANCE_SERVICE_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/TAO_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Basic_Types.h"
+#include "ace/SString.h"
+
+ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+class ACE_Lock;
+ACE_END_VERSIONED_NAMESPACE_DECL
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Service_Callbacks;
+class TAO_ORB_Core;
+
+/**
+ * @class TAO_Fault_Tolerance_Service
+ *
+ * @brief TAO_Fault_Tolerant_Service
+ *
+ * A collection of ORB & ORB_Core related stuff that is needed at
+ * the ORB level. The ORB Core would carry an instance of this
+ * class and invoke methods on this.
+ * Note: This collection would be really useful when we have
+ * logging in place. The contents of this class can be logged at
+ * regular check point intervals.
+ */
+class TAO_Export TAO_Fault_Tolerance_Service
+{
+
+public:
+ /// Ctor
+ TAO_Fault_Tolerance_Service (void);
+
+ /// Dtor
+ ~TAO_Fault_Tolerance_Service (void);
+
+ /// Initialise the internal data structures
+ void init (TAO_ORB_Core *orb_core);
+
+ /// Return the underlying callback object
+ TAO_Service_Callbacks *service_callback (void);
+
+ /// Return the underlying <ft_object_id>
+ const ACE_CString &client_id (void);
+
+ /// Set the client id
+ void client_id (const char *id);
+
+ /// Generate and return a new retention id
+ CORBA::Long retention_id (void);
+
+private:
+
+ /// hook to callback on to the service
+ TAO_Service_Callbacks *ft_service_callback_;
+
+ /// The object id that would be used if the ft service is loaded.
+ ACE_CString ft_object_id_;
+
+ /**
+ * This and the <ft_object_id_> act as unique identifiers for the
+ * request sent from the source Object. Modification of this value
+ * is done by the loaded FT
+ */
+ CORBA::Long ft_object_retention_id_;
+
+ /// Lock for the retention id
+ ACE_Lock *ft_object_retention_id_lock_;
+
+ // NOTE: At a glance this retention id can be easily mistaken for a
+ // request id in a GIOP request. But the purpose served are a lot
+ // more than what a RequestId does for GIOP. So, we have a unique
+ // generator with a lock to protect from different threads accessing
+ // this.
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/Fault_Tolerance_Service.i"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+#endif /*TAO_FAULT_TOLERANCE_SERVICE_H*/
diff --git a/TAO/tao/Fault_Tolerance_Service.i b/TAO/tao/Fault_Tolerance_Service.i
new file mode 100644
index 00000000000..6fb2c4ca1a1
--- /dev/null
+++ b/TAO/tao/Fault_Tolerance_Service.i
@@ -0,0 +1,34 @@
+// -*- C++ -*-
+//
+//$Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO_Fault_Tolerance_Service::TAO_Fault_Tolerance_Service (void)
+ : ft_service_callback_ (0),
+ ft_object_id_ (),
+ ft_object_retention_id_ (-1),
+ ft_object_retention_id_lock_ (0)
+{
+}
+
+ACE_INLINE TAO_Service_Callbacks *
+TAO_Fault_Tolerance_Service::service_callback (void)
+{
+ return this->ft_service_callback_;
+}
+
+ACE_INLINE const ACE_CString &
+TAO_Fault_Tolerance_Service::client_id (void)
+{
+ return this->ft_object_id_;
+}
+
+ACE_INLINE void
+TAO_Fault_Tolerance_Service::client_id (const char *id)
+{
+ this->ft_object_id_ = id;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Fixed_Array_Argument_T.cpp b/TAO/tao/Fixed_Array_Argument_T.cpp
new file mode 100644
index 00000000000..dc0dfe065d2
--- /dev/null
+++ b/TAO/tao/Fixed_Array_Argument_T.cpp
@@ -0,0 +1,131 @@
+// $Id$
+
+#ifndef TAO_FIXED_ARRAY_ARGUMENT_T_CPP
+#define TAO_FIXED_ARRAY_ARGUMENT_T_CPP
+
+#include "tao/Fixed_Array_Argument_T.h"
+
+#if !defined (__ACE_INLINE__)
+#include "tao/Fixed_Array_Argument_T.inl"
+#endif /* __ACE_INLINE__ */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template<typename S_forany,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::In_Fixed_Array_Argument_T<S_forany,Insert_Policy>::marshal (
+ TAO_OutputCDR & cdr
+ )
+{
+ return cdr << this->x_;
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S_forany,
+ class Insert_Policy>
+void
+TAO::In_Fixed_Array_Argument_T<S_forany,Insert_Policy>::
+ interceptor_value (CORBA::Any *any) const
+{
+ Insert_Policy::any_insert (any, this->x_);
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+// ===========================================================
+
+template<typename S_forany,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::Inout_Fixed_Array_Argument_T<S_forany,Insert_Policy>::marshal (
+ TAO_OutputCDR & cdr
+ )
+{
+ return cdr << this->x_;
+}
+
+template<typename S_forany,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::Inout_Fixed_Array_Argument_T<S_forany,Insert_Policy>::demarshal (
+ TAO_InputCDR & cdr
+ )
+{
+ return cdr >> this->x_;
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S_forany,
+ class Insert_Policy>
+void
+TAO::Inout_Fixed_Array_Argument_T<S_forany,Insert_Policy>::
+ interceptor_value (CORBA::Any *any) const
+{
+ Insert_Policy::any_insert (any, this->x_);
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+// ==============================================================
+
+template<typename S_forany,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::Out_Fixed_Array_Argument_T<S_forany,Insert_Policy>::demarshal (
+ TAO_InputCDR & cdr)
+{
+ return cdr >> this->x_;
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S_forany,
+ class Insert_Policy>
+void
+TAO::Out_Fixed_Array_Argument_T<S_forany,Insert_Policy>::
+ interceptor_value (CORBA::Any *any) const
+{
+ Insert_Policy::any_insert (any, this->x_);
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+// ============================================================
+
+template<typename S_var,
+ typename S_forany,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::Ret_Fixed_Array_Argument_T<S_var,S_forany,Insert_Policy>::
+ demarshal (TAO_InputCDR & cdr)
+{
+ typedef TAO::Array_Traits<S_forany> ARRAY_TRAITS;
+ typename S_forany::_slice_type * tmp_ptr = 0;
+ ACE_ALLOCATOR_RETURN (tmp_ptr,
+ ARRAY_TRAITS::alloc (),
+ false);
+ this->x_ = tmp_ptr;
+ S_forany tmp (this->x_.ptr ());
+ return cdr >> tmp;
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S_var,
+ typename S_forany,
+ class Insert_Policy>
+void
+TAO::Ret_Fixed_Array_Argument_T<S_var,S_forany,Insert_Policy>::
+interceptor_value (CORBA::Any *any) const
+{
+ Insert_Policy::any_insert (any, S_forany (this->x_.ptr ()));
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_FIXED_ARRAY_ARGUMENT_T_CPP */
diff --git a/TAO/tao/Fixed_Array_Argument_T.h b/TAO/tao/Fixed_Array_Argument_T.h
new file mode 100644
index 00000000000..83bfd63746e
--- /dev/null
+++ b/TAO/tao/Fixed_Array_Argument_T.h
@@ -0,0 +1,169 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Fixed_Array_Argument_T.h
+ *
+ * $Id$
+ *
+ * @authors Jeff Parsons and Carlos O'Ryan
+ */
+//=============================================================================
+
+
+#ifndef TAO_FIXED_ARRAY_ARGUMENT_T_H
+#define TAO_FIXED_ARRAY_ARGUMENT_T_H
+
+#include /**/ "ace/pre.h"
+#include "tao/Argument.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ /**
+ * @class In_Fixed_Array_Argument_T
+ *
+ * @brief IN stub argument of fixed size element array.
+ *
+ */
+ template<typename S_forany,
+ class Insert_Policy>
+ class In_Fixed_Array_Argument_T : public InArgument
+ {
+ public:
+ In_Fixed_Array_Argument_T (const typename S_forany::_slice_type * x);
+
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ typename S_forany::_slice_type const * arg (void) const;
+
+ private:
+ S_forany x_;
+ };
+
+ /**
+ * @class Inout_Fixed_Array_Argument_T
+ *
+ * @brief INOUT stub argument of fixed size element array.
+ *
+ */
+ template<typename S_forany,
+ class Insert_Policy>
+ class Inout_Fixed_Array_Argument_T : public InoutArgument
+ {
+ public:
+ Inout_Fixed_Array_Argument_T (typename S_forany::_slice_type *&x);
+
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+ virtual CORBA::Boolean demarshal (TAO_InputCDR &);
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ typename S_forany::_slice_type * arg (void);
+
+ private:
+ S_forany x_;
+ };
+
+ /**
+ * @class Out_Fixed_Array_Argument_T
+ *
+ * @brief OUT stub argument of fixed size element array.
+ *
+ */
+ template<typename S_forany,
+ class Insert_Policy>
+ class Out_Fixed_Array_Argument_T : public OutArgument
+ {
+ public:
+ Out_Fixed_Array_Argument_T (typename S_forany::_slice_type *& x);
+
+ virtual CORBA::Boolean demarshal (TAO_InputCDR &);
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ typename S_forany::_slice_type *& arg (void);
+
+ private:
+ S_forany x_;
+ };
+
+ /**
+ * @class Ret_Fixed_Array_Argument_T
+ *
+ * @brief Return stub value of fixed size element array.
+ *
+ */
+ template<typename S_var,
+ typename S_forany,
+ class Insert_Policy>
+ class Ret_Fixed_Array_Argument_T : public RetArgument
+ {
+ public:
+ Ret_Fixed_Array_Argument_T (void);
+
+ virtual CORBA::Boolean demarshal (TAO_InputCDR &);
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ typename S_forany::_slice_type *& arg (void);
+
+ typename S_forany::_slice_type * excp (void);
+ typename S_forany::_slice_type * retn (void);
+
+ private:
+ S_var x_;
+ };
+
+ /**
+ * @struct Fixed_Array_Arg_Traits_T
+ *
+ * @brief Argument traits of fixed size element array.
+ *
+ */
+ template<typename T_var,
+ typename T_forany,
+ class Insert_Policy>
+ struct Fixed_Array_Arg_Traits_T
+ {
+ typedef typename T_forany::_slice_type * ret_type;
+ typedef typename T_forany::_array_type const in_type;
+ typedef typename T_forany::_array_type inout_type;
+ typedef typename T_forany::_array_type out_type;
+
+ typedef In_Fixed_Array_Argument_T<T_forany,
+ Insert_Policy> in_arg_val;
+ typedef Inout_Fixed_Array_Argument_T<T_forany,
+ Insert_Policy> inout_arg_val;
+ typedef Out_Fixed_Array_Argument_T<T_forany,
+ Insert_Policy> out_arg_val;
+ typedef Ret_Fixed_Array_Argument_T<T_var,
+ T_forany,
+ Insert_Policy> ret_val;
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+#include "tao/Fixed_Array_Argument_T.inl"
+#endif /* __ACE_INLINE__ */
+
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+#include "tao/Fixed_Array_Argument_T.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
+#pragma implementation ("Fixed_Array_Argument_T.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_FIXED_ARRAY_ARGUMENT_T_H */
diff --git a/TAO/tao/Fixed_Array_Argument_T.inl b/TAO/tao/Fixed_Array_Argument_T.inl
new file mode 100644
index 00000000000..d33bae784cb
--- /dev/null
+++ b/TAO/tao/Fixed_Array_Argument_T.inl
@@ -0,0 +1,117 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template<typename S_forany,
+ class Insert_Policy>
+ACE_INLINE
+TAO::In_Fixed_Array_Argument_T<S_forany,Insert_Policy>::
+In_Fixed_Array_Argument_T (const typename S_forany::_slice_type * x)
+ : x_ (
+#if (defined (__IBMCPP__) && (__IBMCPP__ <= 600))
+ // @@ (OO) IMBCPP 6 can't handle the const_cast<> in the
+ // multi-dimensional array case so C-style
+ // "sledgehammer" cast instead (reinterpret_cast<>
+ // doesn't work either). It's not clear if this is
+ // really the right thing to do but the code won't
+ // compile without it.
+ (S_forany::slice_type *) x
+#else
+ const_cast<typename S_forany::_slice_type *> (x)
+#endif /* IBMCPP <= 600 */
+ )
+{
+}
+
+template<typename S_forany,
+ class Insert_Policy>
+ACE_INLINE
+const typename S_forany::_slice_type *
+TAO::In_Fixed_Array_Argument_T<S_forany,Insert_Policy>::arg (void) const
+{
+ return this->x_.in ();
+}
+
+// ===========================================================================
+
+template<typename S_forany,
+ class Insert_Policy>
+ACE_INLINE
+TAO::Inout_Fixed_Array_Argument_T<S_forany,Insert_Policy>::
+Inout_Fixed_Array_Argument_T (typename S_forany::_slice_type *& x)
+ : x_ (x)
+{}
+
+template<typename S_forany,
+ class Insert_Policy>
+ACE_INLINE
+typename S_forany::_slice_type *
+TAO::Inout_Fixed_Array_Argument_T<S_forany,Insert_Policy>::arg (void)
+{
+ return this->x_.inout ();
+}
+
+// ===========================================================================
+
+template<typename S_forany,
+ class Insert_Policy>
+ACE_INLINE
+TAO::Out_Fixed_Array_Argument_T<
+ S_forany,
+ Insert_Policy
+ >::Out_Fixed_Array_Argument_T (typename S_forany::_slice_type *&x)
+ : x_ (x)
+{}
+
+template<typename S_forany,
+ class Insert_Policy>
+ACE_INLINE
+typename S_forany::_slice_type *&
+TAO::Out_Fixed_Array_Argument_T<S_forany,Insert_Policy>::arg (void)
+{
+ return this->x_.out ();
+}
+
+// ===========================================================================
+
+template<typename S_var,
+ typename S_forany,
+ class Insert_Policy>
+ACE_INLINE
+TAO::Ret_Fixed_Array_Argument_T<S_var,S_forany,Insert_Policy>::
+Ret_Fixed_Array_Argument_T (void)
+{}
+
+template<typename S_var,
+ typename S_forany,
+ class Insert_Policy>
+ACE_INLINE
+typename S_forany::_slice_type *&
+TAO::Ret_Fixed_Array_Argument_T<S_var,S_forany,Insert_Policy>::arg (void)
+{
+ return this->x_._retn_arg ();
+}
+
+template<typename S_var,
+ typename S_forany,
+ class Insert_Policy>
+ACE_INLINE
+typename S_forany::_slice_type *
+TAO::Ret_Fixed_Array_Argument_T<S_var,S_forany,Insert_Policy>::excp (void)
+{
+ return this->x_.ptr ();
+}
+
+template<typename S_var,
+ typename S_forany,
+ class Insert_Policy>
+ACE_INLINE
+typename S_forany::_slice_type *
+TAO::Ret_Fixed_Array_Argument_T<S_var,S_forany,Insert_Policy>::retn (void)
+{
+ return this->x_._retn ();
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Fixed_Size_Argument_T.cpp b/TAO/tao/Fixed_Size_Argument_T.cpp
new file mode 100644
index 00000000000..676100c2403
--- /dev/null
+++ b/TAO/tao/Fixed_Size_Argument_T.cpp
@@ -0,0 +1,111 @@
+// $Id$
+
+#ifndef TAO_FIXED_SIZE_ARGUMENT_T_CPP
+#define TAO_FIXED_SIZE_ARGUMENT_T_CPP
+
+#include "tao/Fixed_Size_Argument_T.h"
+
+#if !defined (__ACE_INLINE__)
+#include "tao/Fixed_Size_Argument_T.inl"
+#endif /* __ACE_INLINE__ */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template<typename S,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::In_Fixed_Size_Argument_T<S,Insert_Policy>::marshal (TAO_OutputCDR &cdr)
+{
+ return cdr << *this->x_;
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S,
+ class Insert_Policy>
+void
+TAO::In_Fixed_Size_Argument_T<S,Insert_Policy>::interceptor_value (CORBA::Any *any) const
+{
+ Insert_Policy::any_insert (any, *this->x_);
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+// ===========================================================
+
+template<typename S,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::Inout_Fixed_Size_Argument_T<S,Insert_Policy>::marshal (TAO_OutputCDR &cdr)
+{
+ return cdr << *this->x_;
+}
+
+template<typename S,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::Inout_Fixed_Size_Argument_T<S,Insert_Policy>::demarshal (TAO_InputCDR & cdr)
+{
+ return cdr >> *this->x_;
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S,
+ class Insert_Policy>
+void
+TAO::Inout_Fixed_Size_Argument_T<S,Insert_Policy>::interceptor_value (CORBA::Any *any) const
+{
+ Insert_Policy::any_insert (any, *this->x_);
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+// ==============================================================
+
+template<typename S,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::Out_Fixed_Size_Argument_T<S,Insert_Policy>::demarshal (TAO_InputCDR & cdr)
+{
+ return cdr >> this->x_;
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S,
+ class Insert_Policy>
+void
+TAO::Out_Fixed_Size_Argument_T<S,Insert_Policy>::interceptor_value (CORBA::Any *any) const
+{
+ Insert_Policy::any_insert (any, this->x_);
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+// ============================================================
+
+template<typename S,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::Ret_Fixed_Size_Argument_T<S,Insert_Policy>::demarshal (TAO_InputCDR & cdr)
+{
+ return cdr >> this->x_;
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S,
+ class Insert_Policy>
+void
+TAO::Ret_Fixed_Size_Argument_T<S,Insert_Policy>::
+interceptor_value (CORBA::Any *any) const
+{
+ Insert_Policy::any_insert (any, this->x_);
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_FIXED_SIZE_ARGUMENT_T_CPP */
diff --git a/TAO/tao/Fixed_Size_Argument_T.h b/TAO/tao/Fixed_Size_Argument_T.h
new file mode 100644
index 00000000000..14ab15335e5
--- /dev/null
+++ b/TAO/tao/Fixed_Size_Argument_T.h
@@ -0,0 +1,162 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Fixed_Size_Argument_T.h
+ *
+ * $Id$
+ *
+ * @authors Jeff Parsons and Carlos O'Ryan
+ */
+//=============================================================================
+
+
+#ifndef TAO_FIXED_SIZE_ARGUMENT_T_H
+#define TAO_FIXED_SIZE_ARGUMENT_T_H
+
+#include /**/ "ace/pre.h"
+#include "tao/Argument.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ /**
+ * @class In_Fixed_Size_Argument_T
+ *
+ * @brief Template class for IN stub argument of fixed size IDL types.
+ *
+ */
+ template<typename S,
+ class Insert_Policy>
+ class In_Fixed_Size_Argument_T : public InArgument
+ {
+ public:
+ In_Fixed_Size_Argument_T (S const & x);
+
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ S const & arg (void) const;
+
+ private:
+ S const * x_;
+ };
+
+ /**
+ * @class Inout_Fixed_Size_Argument_T
+ *
+ * @brief Template class for INOUT stub argument of fixed size IDL types.
+ *
+ */
+ template<typename S,
+ class Insert_Policy>
+ class Inout_Fixed_Size_Argument_T : public InoutArgument
+ {
+ public:
+ Inout_Fixed_Size_Argument_T (S & x);
+
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+ virtual CORBA::Boolean demarshal (TAO_InputCDR &);
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ S & arg (void);
+
+ private:
+ S * x_;
+ };
+
+ /**
+ * @class Out_Fixed_Size_Argument_T
+ *
+ * @brief Template class for OUT stub argument of fixed size IDL types.
+ *
+ */
+ template<typename S,
+ class Insert_Policy>
+ class Out_Fixed_Size_Argument_T : public OutArgument
+ {
+ public:
+ Out_Fixed_Size_Argument_T (S & x);
+
+ virtual CORBA::Boolean demarshal (TAO_InputCDR &);
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ S & arg (void);
+
+ private:
+
+ S & x_;
+ };
+
+ /**
+ * @class Ret_Fixed_Size_Argument_T
+ *
+ * @brief Template class for return stub value of fixed size IDL types.
+ *
+ */
+ template<typename S,
+ class Insert_Policy>
+ class Ret_Fixed_Size_Argument_T : public RetArgument
+ {
+ public:
+ Ret_Fixed_Size_Argument_T (void);
+
+ virtual CORBA::Boolean demarshal (TAO_InputCDR &);
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ S & arg (void);
+ S excp (void);
+ S retn (void);
+
+ protected:
+ S x_;
+ };
+
+ /**
+ * @struct Fixed_Size_Arg_Traits_T
+ *
+ * @brief Template class for argument traits of fixed size IDL types.
+ *
+ */
+ template<typename T,
+ class Insert_Policy>
+ struct Fixed_Size_Arg_Traits_T
+ {
+ typedef T ret_type;
+ typedef T const & in_type;
+ typedef T & inout_type;
+ typedef T & out_type;
+
+ typedef In_Fixed_Size_Argument_T<T,Insert_Policy> in_arg_val;
+ typedef Inout_Fixed_Size_Argument_T<T,Insert_Policy> inout_arg_val;
+ typedef Out_Fixed_Size_Argument_T<T,Insert_Policy> out_arg_val;
+ typedef Ret_Fixed_Size_Argument_T<T,Insert_Policy> ret_val;
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+#include "tao/Fixed_Size_Argument_T.inl"
+#endif /* __ACE_INLINE__ */
+
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+#include "tao/Fixed_Size_Argument_T.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
+#pragma implementation ("Fixed_Size_Argument_T.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_FIXED_SIZE_ARGUMENT_T_H */
diff --git a/TAO/tao/Fixed_Size_Argument_T.inl b/TAO/tao/Fixed_Size_Argument_T.inl
new file mode 100644
index 00000000000..7103db01281
--- /dev/null
+++ b/TAO/tao/Fixed_Size_Argument_T.inl
@@ -0,0 +1,100 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template<typename S,
+ class Insert_Policy>
+ACE_INLINE
+TAO::In_Fixed_Size_Argument_T<S,Insert_Policy>::
+In_Fixed_Size_Argument_T (S const & x)
+ : x_ (&x)
+{}
+
+template<typename S,
+ class Insert_Policy>
+ACE_INLINE
+const S &
+TAO::In_Fixed_Size_Argument_T<S,Insert_Policy>::arg (void) const
+{
+ return *this->x_;
+}
+
+// ==========================================================================
+
+template<typename S,
+ class Insert_Policy>
+ACE_INLINE
+TAO::Inout_Fixed_Size_Argument_T<S,Insert_Policy>::
+Inout_Fixed_Size_Argument_T (S & x)
+ : x_ (&x)
+{}
+
+template<typename S,
+ class Insert_Policy>
+ACE_INLINE
+S &
+TAO::Inout_Fixed_Size_Argument_T<S,Insert_Policy>::arg (void)
+{
+ return *this->x_;
+}
+
+// ==========================================================================
+
+template<typename S,
+ class Insert_Policy>
+ACE_INLINE
+TAO::Out_Fixed_Size_Argument_T<S,Insert_Policy>::
+Out_Fixed_Size_Argument_T (S & x)
+ : x_ (x)
+{
+}
+
+template<typename S,
+ class Insert_Policy>
+ACE_INLINE
+S &
+TAO::Out_Fixed_Size_Argument_T<S,Insert_Policy>::arg (void)
+{
+ return this->x_;
+}
+
+// ==========================================================================
+
+template<typename S,
+ class Insert_Policy>
+ACE_INLINE
+TAO::Ret_Fixed_Size_Argument_T<S,Insert_Policy>::
+Ret_Fixed_Size_Argument_T (void)
+{
+}
+
+template<typename S,
+ class Insert_Policy>
+ACE_INLINE
+S &
+TAO::Ret_Fixed_Size_Argument_T<S,Insert_Policy>::arg (void)
+{
+ return this->x_;
+}
+
+template<typename S,
+ class Insert_Policy>
+ACE_INLINE
+S
+TAO::Ret_Fixed_Size_Argument_T<S,Insert_Policy>::excp (void)
+{
+ return this->x_;
+}
+
+template<typename S,
+ class Insert_Policy>
+ACE_INLINE
+S
+TAO::Ret_Fixed_Size_Argument_T<S,Insert_Policy>::retn (void)
+{
+ return this->x_;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/FlResource.mpc b/TAO/tao/FlResource.mpc
new file mode 100644
index 00000000000..0c0161c2d99
--- /dev/null
+++ b/TAO/tao/FlResource.mpc
@@ -0,0 +1,31 @@
+// -*- MPC -*- now wouldn't this be cool...
+// $Id$
+
+project(TAO_FlResource) : acelib, taolib, core, tao_output, taodefaults, ace_flreactor, tao_versioning_idl_defaults {
+
+ sharedname = TAO_FlResource
+ dynamicflags += TAO_FLRESOURCE_BUILD_DLL
+
+ Source_Files {
+ FlResource
+ }
+
+ Header_Files {
+ FlResource
+ }
+
+ Inline_Files {
+ }
+
+ Template_Files {
+ }
+
+ Resource_Files {
+ }
+
+ PIDL_Files {
+ }
+
+ IDL_Files {
+ }
+}
diff --git a/TAO/tao/FlResource/FlResource_Factory.cpp b/TAO/tao/FlResource/FlResource_Factory.cpp
new file mode 100644
index 00000000000..a280383b065
--- /dev/null
+++ b/TAO/tao/FlResource/FlResource_Factory.cpp
@@ -0,0 +1,39 @@
+//$Id$
+
+#include "tao/FlResource/FlResource_Factory.h"
+#include "tao/debug.h"
+#include "ace/FlReactor.h"
+
+ACE_RCSID( TAO_FlResource,
+ FlResource_Factory,
+ "$Id$");
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ FlResource_Factory::FlResource_Factory (void)
+ : reactor_impl_( 0 )
+ {
+ }
+
+ ACE_Reactor_Impl *
+ FlResource_Factory::reactor_impl (void)
+ {
+ // synchronized by external locks
+ if (!this->reactor_impl_)
+ {
+ ACE_NEW_RETURN (this->reactor_impl_,
+ ACE_FlReactor (),
+ 0);
+
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - ACE_FlReactor created \n"));
+ }
+
+ return this->reactor_impl_;
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/FlResource/FlResource_Factory.h b/TAO/tao/FlResource/FlResource_Factory.h
new file mode 100644
index 00000000000..28da6ab9341
--- /dev/null
+++ b/TAO/tao/FlResource/FlResource_Factory.h
@@ -0,0 +1,62 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file FlResource_Factory.h
+ *
+ * $Id$
+ *
+ * @author Balachandran Natarajan <bala@cs.wustl.edu>
+ * @author Marek Brudka <mbrudka@aster.pl>
+ */
+//=============================================================================
+#ifndef TAO_FLRESOURCE_FACTORY_H
+#define TAO_FLRESOURCE_FACTORY_H
+#include /**/ "ace/pre.h"
+
+#include "tao/FlResource/TAO_FlResource_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/FlReactor.h"
+#include "tao/GUIResource_Factory.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ /**
+ * @class FlResource_Factory
+ *
+ * @brief TAO_GUI_Resource_Factory for creating FlReactor.
+ *
+ * This factory is intended for creating FlReactor for ORB. This
+ * factory can be feed into ORB using
+ * TAO_ORB_Core::set_gui_resource_factory method which is usually
+ * done by TAO_FlResource_Loader.
+ */
+
+ class TAO_FlResource_Export FlResource_Factory : public GUIResource_Factory
+ {
+ public:
+
+ FlResource_Factory ();
+
+ protected:
+
+ /// Create or obtain current reactor implementation
+ virtual ACE_Reactor_Impl *reactor_impl (void);
+
+ private:
+
+ /// Reactor created by this factory.
+ ACE_FlReactor *reactor_impl_;
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_FLRESOURCE_FACTORY_H */
diff --git a/TAO/tao/FlResource/FlResource_Loader.cpp b/TAO/tao/FlResource/FlResource_Loader.cpp
new file mode 100644
index 00000000000..f004941bddb
--- /dev/null
+++ b/TAO/tao/FlResource/FlResource_Loader.cpp
@@ -0,0 +1,29 @@
+//$Id$
+#include "tao/FlResource/FlResource_Loader.h"
+#include "tao/ORB_Core.h"
+#include "tao/FlResource/FlResource_Factory.h"
+
+ACE_RCSID( TAO_FlResource,
+ FlResource_Loader,
+ "$Id$");
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ FlResource_Loader::FlResource_Loader (void)
+ {
+ FlResource_Factory *tmp = 0;
+
+ ACE_NEW (tmp,
+ FlResource_Factory ());
+
+ TAO_ORB_Core::set_gui_resource_factory (tmp);
+ }
+
+ FlResource_Loader::~FlResource_Loader (void)
+ {
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/FlResource/FlResource_Loader.h b/TAO/tao/FlResource/FlResource_Loader.h
new file mode 100644
index 00000000000..09b6ef2ce4d
--- /dev/null
+++ b/TAO/tao/FlResource/FlResource_Loader.h
@@ -0,0 +1,59 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file FlResource_Loader.h
+ *
+ * $Id$
+ *
+ * @author Balachandran Natarajan <bala@cs.wustl.edu>
+ * @author Marek Brudka <mbrudka@aster.pl>
+ */
+//=============================================================================
+
+#ifndef TAO_FLRESOURCE_LOADER_H
+#define TAO_FLRESOURCE_LOADER_H
+#include /**/ "ace/pre.h"
+
+#include "tao/FlResource/TAO_FlResource_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Versioned_Namespace.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+
+ /**
+ * @class FlResource_Loader
+ *
+ * @brief Loads TAO resources related with Fl.
+ *
+ * This class changes the default reactor implementation into
+ * ACE_FlReactor one by calling TAO_ORB_Core::set_gui_resource_factory.
+ * User should create an instance of this class before ORB_init
+ * when the TAO server has has to be integrated within Fl event loop.
+ *
+ * Please notice, this class has to be created in the main Fl thread,
+ * because set_gui_resource_factory creates a variable in TSS. This way
+ * FlReactor is instantiated only in Qt event loop thread.
+ */
+ class TAO_FlResource_Export FlResource_Loader
+ {
+
+ public:
+ FlResource_Loader (void);
+
+ virtual ~FlResource_Loader (void);
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_FLRESOURCE_LOADER_H */
diff --git a/TAO/tao/FlResource/TAO_FlResource_Export.h b/TAO/tao/FlResource/TAO_FlResource_Export.h
new file mode 100644
index 00000000000..e63890b54a6
--- /dev/null
+++ b/TAO/tao/FlResource/TAO_FlResource_Export.h
@@ -0,0 +1,58 @@
+
+// -*- C++ -*-
+// $Id$
+// Definition for Win32 Export directives.
+// This file is generated automatically by generate_export_file.pl -s TAO_FlResource
+// ------------------------------
+#ifndef TAO_FLRESOURCE_EXPORT_H
+#define TAO_FLRESOURCE_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if defined (ACE_AS_STATIC_LIBS) && !defined (TAO_FLRESOURCE_HAS_DLL)
+# define TAO_FLRESOURCE_HAS_DLL 0
+#endif /* ACE_AS_STATIC_LIBS && TAO_FLRESOURCE_HAS_DLL */
+
+#if !defined (TAO_FLRESOURCE_HAS_DLL)
+# define TAO_FLRESOURCE_HAS_DLL 1
+#endif /* ! TAO_FLRESOURCE_HAS_DLL */
+
+#if defined (TAO_FLRESOURCE_HAS_DLL) && (TAO_FLRESOURCE_HAS_DLL == 1)
+# if defined (TAO_FLRESOURCE_BUILD_DLL)
+# define TAO_FlResource_Export ACE_Proper_Export_Flag
+# define TAO_FLRESOURCE_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# define TAO_FLRESOURCE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# else /* TAO_FLRESOURCE_BUILD_DLL */
+# define TAO_FlResource_Export ACE_Proper_Import_Flag
+# define TAO_FLRESOURCE_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# define TAO_FLRESOURCE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# endif /* TAO_FLRESOURCE_BUILD_DLL */
+#else /* TAO_FLRESOURCE_HAS_DLL == 1 */
+# define TAO_FlResource_Export
+# define TAO_FLRESOURCE_SINGLETON_DECLARATION(T)
+# define TAO_FLRESOURCE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+#endif /* TAO_FLRESOURCE_HAS_DLL == 1 */
+
+// Set TAO_FLRESOURCE_NTRACE = 0 to turn on library specific tracing even if
+// tracing is turned off for ACE.
+#if !defined (TAO_FLRESOURCE_NTRACE)
+# if (ACE_NTRACE == 1)
+# define TAO_FLRESOURCE_NTRACE 1
+# else /* (ACE_NTRACE == 1) */
+# define TAO_FLRESOURCE_NTRACE 0
+# endif /* (ACE_NTRACE == 1) */
+#endif /* !TAO_FLRESOURCE_NTRACE */
+
+#if (TAO_FLRESOURCE_NTRACE == 1)
+# define TAO_FLRESOURCE_TRACE(X)
+#else /* (TAO_FLRESOURCE_NTRACE == 1) */
+# if !defined (ACE_HAS_TRACE)
+# define ACE_HAS_TRACE
+# endif /* ACE_HAS_TRACE */
+# define TAO_FLRESOURCE_TRACE(X) ACE_TRACE_IMPL(X)
+# include "ace/Trace.h"
+#endif /* (TAO_FLRESOURCE_NTRACE == 1) */
+
+#endif /* TAO_FLRESOURCE_EXPORT_H */
+
+// End of auto generated file.
diff --git a/TAO/tao/FloatSeq.pidl b/TAO/tao/FloatSeq.pidl
new file mode 100644
index 00000000000..40b02b8f887
--- /dev/null
+++ b/TAO/tao/FloatSeq.pidl
@@ -0,0 +1,34 @@
+// -*- IDL -*-
+//
+// $Id$
+
+/**
+ * This file was used to generate the code in FloatSeqC.*
+ * The command used to generate code is:
+ *
+ * tao_idl
+ * -oA AnyTypeCode
+ * -Ge 1 -GA -SS -Sci
+ * -Wb,pre_include=ace/pre.h
+ * -Wb,post_include=ace/post.h
+ * -Wb,export_macro=TAO_Export
+ * -Wb,export_include=tao/TAO_Export.h
+ * -Wb,anyop_export_macro=TAO_AnyTypeCode_Export
+ * -Wb,anyop_export_include=tao/AnyTypeCode/TAO_AnyTypeCode_Export.h
+ * -Wb,versioning_begin=TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+ * -Wb,versioning_end=TAO_END_VERSIONED_NAMESPACE_DECL
+ * FloatSeq.pidl
+ */
+
+
+#ifndef TAO_CORBA_FLOAT_SEQ_IDL
+#define TAO_CORBA_FLOAT_SEQ_IDL
+
+#pragma prefix "omg.org"
+
+module CORBA
+{
+ typedef sequence<float> FloatSeq;
+};
+
+#endif /* TAO_CORBA_FLOAT_SEQ_IDL */
diff --git a/TAO/tao/Flushing_Strategy.cpp b/TAO/tao/Flushing_Strategy.cpp
new file mode 100644
index 00000000000..6d66ee99975
--- /dev/null
+++ b/TAO/tao/Flushing_Strategy.cpp
@@ -0,0 +1,16 @@
+// $Id$
+
+#include "tao/Flushing_Strategy.h"
+
+ACE_RCSID (tao,
+ Flushing_Strategy,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Flushing_Strategy::~TAO_Flushing_Strategy (void)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Flushing_Strategy.h b/TAO/tao/Flushing_Strategy.h
new file mode 100644
index 00000000000..ead55aec8f2
--- /dev/null
+++ b/TAO/tao/Flushing_Strategy.h
@@ -0,0 +1,79 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Flushing_Strategy.h
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan <coryan@uci.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_FLUSHING_STRATEGY_H
+#define TAO_FLUSHING_STRATEGY_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+class ACE_Time_Value;
+ACE_END_VERSIONED_NAMESPACE_DECL
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Transport;
+class TAO_Queued_Message;
+
+/**
+ * @class TAO_Flushing_Strategy
+ *
+ * @brief Define the interface for the flushing strategy, i.e. the
+ * algorithm that controls how does the ORB flush outgoing
+ * data.
+ *
+ * Please read the documentation in the TAO_Transport class to find
+ * out more about the design of the outgoing data path.
+ *
+ * Some applications can block the current thread whenever they are
+ * sending out data. In those cases they can obtain better
+ * performance by blocking in calls to write() than by participating
+ * in the Leader/Followers protocol to shared the ORB Reactor.
+ *
+ * This strategy controls how does the ORB schedule and cancel
+ * reactive I/O, if there is no reactive I/O the strategy is just a
+ * no-op.
+ *
+ */
+class TAO_Flushing_Strategy
+{
+public:
+ /// Destructor
+ virtual ~TAO_Flushing_Strategy (void);
+
+ /// Schedule the transport argument to be flushed
+ virtual int schedule_output (TAO_Transport *transport) = 0;
+
+ /// Cancel all scheduled output for the transport argument
+ virtual int cancel_output (TAO_Transport *transport) = 0;
+
+ /// Wait until msg is sent out. Potentially other messages are
+ /// flushed too, for example, because there are ahead in the queue.
+ virtual int flush_message (TAO_Transport *transport,
+ TAO_Queued_Message *msg,
+ ACE_Time_Value *max_wait_time) = 0;
+
+ /// Wait until the transport has no messages queued.
+ virtual int flush_transport (TAO_Transport *transport) = 0;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_FLUSHING_STRATEGY_H */
diff --git a/TAO/tao/GIOP.pidl b/TAO/tao/GIOP.pidl
new file mode 100644
index 00000000000..eb6e86ca8c4
--- /dev/null
+++ b/TAO/tao/GIOP.pidl
@@ -0,0 +1,62 @@
+//$Id$
+// ================================================================
+//
+// = LIBRARY
+// TAO
+//
+// = FILENAME
+// GIOP1_2.pidl
+//
+// = DESCRIPTION
+// Some new data types included for GIOP 1.2
+// This file was used to generate the code in
+// GIOP*.* The command used to generate code
+// is:
+//
+// tao_idl
+// -o orig -Ge 1 -GA -I.. -SS -Sc
+// -Wb,export_macro=TAO_Export
+// -Wb,export_include="tao/TAO_Export.h"
+// -Wb,pre_include="ace/pre.h"
+// -Wb,post_include="ace/post.h"
+// -Wb,versioning_begin=TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+// -Wb,versioning_end=TAO_END_VERSIONED_NAMESPACE_DECL
+// GIOP.pidl
+//
+// ================================================================
+
+#ifndef TAO_GIOP_PIDL
+#define TAO_GIOP_PIDL
+
+#include "tao/IOP_IOR.pidl"
+
+#pragma prefix "omg.org"
+
+module GIOP
+{
+ typedef short AddressingDisposition;
+ const short KeyAddr = 0;
+ const short ProfileAddr = 1;
+ const short ReferenceAddr = 2;
+
+ struct Version
+ {
+ octet major;
+ octet minor;
+ };
+
+ struct IORAddressingInfo
+ {
+ unsigned long selected_profile_index;
+ IOP::IOR ior;
+ };
+
+ union TargetAddress switch (AddressingDisposition)
+ {
+ case KeyAddr: CORBA::OctetSeq object_key;
+ case ProfileAddr: IOP::TaggedProfile profile;
+ case ReferenceAddr: IORAddressingInfo ior;
+ };
+};
+
+#endif /* TAO_GIOP_PIDL */
diff --git a/TAO/tao/GIOP_Fragmentation_Strategy.cpp b/TAO/tao/GIOP_Fragmentation_Strategy.cpp
new file mode 100644
index 00000000000..d10348117a6
--- /dev/null
+++ b/TAO/tao/GIOP_Fragmentation_Strategy.cpp
@@ -0,0 +1,9 @@
+// $Id$
+
+
+#include "tao/GIOP_Fragmentation_Strategy.h"
+
+
+TAO_GIOP_Fragmentation_Strategy::~TAO_GIOP_Fragmentation_Strategy (void)
+{
+}
diff --git a/TAO/tao/GIOP_Fragmentation_Strategy.h b/TAO/tao/GIOP_Fragmentation_Strategy.h
new file mode 100644
index 00000000000..6ffc058cb6a
--- /dev/null
+++ b/TAO/tao/GIOP_Fragmentation_Strategy.h
@@ -0,0 +1,85 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file GIOP_Fragmentation_Strategy.h
+ *
+ * $Id$
+ *
+ * @author Ossama Othman <ossama@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_GIOP_FRAGMENTATION_STRATEGY_H
+#define TAO_GIOP_FRAGMENTATION_STRATEGY_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/TAO_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/orbconf.h"
+#include "ace/CDR_Base.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_OutputCDR;
+
+/**
+ * @class TAO_GIOP_Fragmenation_Strategy
+ *
+ * @brief Abstract base class that defines TAO fragmentation strategy
+ * interface.
+ *
+ * GIOP message fragmentation is deferred to a fragmentation strategy
+ */
+class TAO_Export TAO_GIOP_Fragmentation_Strategy
+{
+public:
+
+ /// Constructor
+ TAO_GIOP_Fragmentation_Strategy (void) {}
+
+ /// Destructor.
+ virtual ~TAO_GIOP_Fragmentation_Strategy (void);
+
+ /// Fragment the (potentially partially) encoded GIOP message.
+ /**
+ * Fragmentation the contents of the CDR output stream @a cdr into
+ * smaller chunks of data of size that fits within the configured
+ * ORB fragmentation threshold, and send each fragment "over the
+ * wire."
+ *
+ * @note Fragmentation will only occur if the CDR stream length will
+ * surpass the configured fragmentation threshold when
+ * marshaling the pending set of data.
+ *
+ * @param cdr Output CDR stream.
+ * @param pending_alignment Size of alignment boundary for next data
+ * to be marshaled (e.g. 4 for a
+ * CORBA::ULong).
+ * @param pending_length Size of next data to be marshaled (e.g. 2
+ * for a CORBA::UShort).
+ *
+ * @return Zero on success.
+ */
+ virtual int fragment (TAO_OutputCDR & cdr,
+ ACE_CDR::ULong pending_alignment,
+ ACE_CDR::ULong pending_length) = 0;
+
+private:
+
+ // Disallow copying and assignment.
+ TAO_GIOP_Fragmentation_Strategy (TAO_GIOP_Fragmentation_Strategy const &);
+ void operator= (TAO_GIOP_Fragmentation_Strategy const &);
+
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_GIOP_FRAGMENTATION_STRATEGY_H */
diff --git a/TAO/tao/GIOP_Message_Base.cpp b/TAO/tao/GIOP_Message_Base.cpp
new file mode 100644
index 00000000000..fdc07c0dd59
--- /dev/null
+++ b/TAO/tao/GIOP_Message_Base.cpp
@@ -0,0 +1,2107 @@
+// $Id$
+
+#include "tao/GIOP_Message_Base.h"
+#include "tao/operation_details.h"
+#include "tao/debug.h"
+#include "tao/ORB_Core.h"
+#include "tao/TAO_Server_Request.h"
+#include "tao/GIOP_Message_Locate_Header.h"
+#include "tao/Transport.h"
+#include "tao/Transport_Mux_Strategy.h"
+#include "tao/LF_Strategy.h"
+#include "tao/Request_Dispatcher.h"
+#include "tao/Codeset_Manager.h"
+#include "tao/SystemException.h"
+
+/*
+ * Hook to add additional include files during specializations.
+ */
+//@@ GIOP_MESSAGE_BASE_INCLUDE_ADD_HOOK
+
+ACE_RCSID (tao,
+ GIOP_Message_Base,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_GIOP_Message_Base::TAO_GIOP_Message_Base (TAO_ORB_Core * orb_core,
+ TAO_Transport * transport,
+ size_t input_cdr_size)
+ : orb_core_ (orb_core)
+ , message_state_ ()
+ , fragmentation_strategy_ (orb_core->fragmentation_strategy (transport))
+ , out_stream_ (0,
+ input_cdr_size,
+ TAO_ENCAP_BYTE_ORDER,
+ orb_core->output_cdr_buffer_allocator (),
+ orb_core->output_cdr_dblock_allocator (),
+ orb_core->output_cdr_msgblock_allocator (),
+ orb_core->orb_params ()->cdr_memcpy_tradeoff (),
+ fragmentation_strategy_.get (),
+ TAO_DEF_GIOP_MAJOR,
+ TAO_DEF_GIOP_MINOR)
+{
+}
+
+
+TAO_GIOP_Message_Base::~TAO_GIOP_Message_Base (void)
+{
+}
+
+
+void
+TAO_GIOP_Message_Base::init (CORBA::Octet major,
+ CORBA::Octet minor)
+{
+ // Set the giop version of the out stream
+ this->out_stream_.set_version (major,
+ minor);
+}
+
+TAO_OutputCDR &
+TAO_GIOP_Message_Base::out_stream (void)
+{
+ return this->out_stream_;
+}
+
+void
+TAO_GIOP_Message_Base::reset (void)
+{
+ // no-op
+}
+
+int
+TAO_GIOP_Message_Base::generate_request_header (
+ TAO_Operation_Details &op,
+ TAO_Target_Specification &spec,
+ TAO_OutputCDR &cdr
+ )
+{
+ // Get a parser for us
+ TAO_GIOP_Message_Generator_Parser *generator_parser = 0;
+
+ CORBA::Octet major, minor;
+
+ cdr.get_version (major, minor);
+
+ // Get the state information that we need to use
+ this->set_state (major,
+ minor,
+ generator_parser);
+
+ // Write the GIOP header first
+ if (!this->write_protocol_header (TAO_GIOP_REQUEST,
+ cdr))
+ {
+ if (TAO_debug_level)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) Error in writing GIOP header \n")));
+ }
+
+ return -1;
+ }
+
+ // Now call the implementation for the rest of the header
+ if (!generator_parser->write_request_header (op,
+ spec,
+ cdr))
+ {
+ if (TAO_debug_level)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) Error in writing request header \n")));
+
+ return -1;
+ }
+
+ return 0;
+}
+
+int
+TAO_GIOP_Message_Base::generate_locate_request_header (
+ TAO_Operation_Details &op,
+ TAO_Target_Specification &spec,
+ TAO_OutputCDR &cdr
+ )
+{
+ // Get a parser for us
+ TAO_GIOP_Message_Generator_Parser *generator_parser = 0;
+
+ CORBA::Octet major, minor;
+
+ cdr.get_version (major, minor);
+
+ // Get the state information that we need to use
+ this->set_state (major,
+ minor,
+ generator_parser);
+
+ // Write the GIOP header first
+ if (!this->write_protocol_header (TAO_GIOP_LOCATEREQUEST,
+ cdr))
+ {
+ if (TAO_debug_level)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) Error in writing GIOP header \n")));
+
+ return -1;
+ }
+
+ // Now call the implementation for the rest of the header
+ if (!generator_parser->write_locate_request_header
+ (op.request_id (),
+ spec,
+ cdr))
+ {
+ if (TAO_debug_level)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) Error in writing locate request header \n")));
+
+
+ return -1;
+
+ }
+
+ return 0;
+}
+
+int
+TAO_GIOP_Message_Base::generate_reply_header (
+ TAO_OutputCDR &cdr,
+ TAO_Pluggable_Reply_Params_Base &params
+ )
+{
+ // Get a parser for us
+ TAO_GIOP_Message_Generator_Parser *generator_parser = 0;
+
+ CORBA::Octet major, minor;
+
+ cdr.get_version (major, minor);
+
+ // Get the state information that we need to use
+ this->set_state (major,
+ minor,
+ generator_parser);
+
+ // Write the GIOP header first
+ if (!this->write_protocol_header (TAO_GIOP_REPLY,
+ cdr))
+ {
+ if (TAO_debug_level)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) Error in writing GIOP header \n")));
+
+ return -1;
+ }
+
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ // Now call the implementation for the rest of the header
+ int const result =
+ generator_parser->write_reply_header (cdr,
+ params
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (!result)
+ {
+ if (TAO_debug_level > 4)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) Error in writing reply ")
+ ACE_TEXT ("header\n")));
+
+ return -1;
+ }
+ }
+ ACE_CATCHANY
+ {
+ if (TAO_debug_level > 4)
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ ACE_TEXT ("TAO_GIOP_Message_Base::generate_reply_header"));
+
+ return -1;
+ }
+ ACE_ENDTRY;
+
+ return 0;
+}
+
+int
+TAO_GIOP_Message_Base::generate_fragment_header (TAO_OutputCDR & cdr,
+ CORBA::ULong request_id)
+{
+ // Get a parser for us
+ TAO_GIOP_Message_Generator_Parser *generator_parser = 0;
+
+ CORBA::Octet major, minor;
+
+ cdr.get_version (major, minor);
+
+ // GIOP fragments are supported in GIOP 1.1 and better, but TAO only
+ // supports them in 1.2 or better since GIOP 1.1 fragments do not
+ // have a fragment message header.
+ if (major == 1 && minor < 2)
+ return -1;
+
+ // Get the state information that we need to use
+ this->set_state (major,
+ minor,
+ generator_parser);
+
+ // Write the GIOP header first
+ if (!this->write_protocol_header (TAO_GIOP_FRAGMENT, cdr)
+ || !generator_parser->write_fragment_header (cdr, request_id))
+ {
+ if (TAO_debug_level)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) Error in writing GIOP header \n")));
+
+ return -1;
+ }
+
+ return 0;
+}
+
+int
+TAO_GIOP_Message_Base::format_message (TAO_OutputCDR &stream)
+{
+ // Ptr to first buffer.
+ char * buf = (char *) stream.buffer ();
+
+ this->set_giop_flags (stream);
+
+ // Length of all buffers.
+ size_t const total_len = stream.total_length ();
+
+ // NOTE: Here would also be a fine place to calculate a digital
+ // signature for the message and place it into a preallocated slot
+ // in the "ServiceContext". Similarly, this is a good spot to
+ // encrypt messages (or just the message bodies) if that's needed in
+ // this particular environment and that isn't handled by the
+ // networking infrastructure (e.g., IPSEC).
+
+ CORBA::ULong const bodylen = static_cast <CORBA::ULong>
+ (total_len - TAO_GIOP_MESSAGE_HEADER_LEN);
+
+#if !defined (ACE_ENABLE_SWAP_ON_WRITE)
+ *(reinterpret_cast <CORBA::ULong *> (buf +
+ TAO_GIOP_MESSAGE_SIZE_OFFSET)) = bodylen;
+#else
+ if (!stream.do_byte_swap ())
+ *(reinterpret_cast <CORBA::ULong *>
+ (buf + TAO_GIOP_MESSAGE_SIZE_OFFSET)) = bodylen;
+ else
+ ACE_CDR::swap_4 (reinterpret_cast <char *> (&bodylen),
+ buf + TAO_GIOP_MESSAGE_SIZE_OFFSET);
+#endif /* ACE_ENABLE_SWAP_ON_WRITE */
+
+ if (TAO_debug_level > 2)
+ {
+ // Check whether the output cdr stream is build up of multiple
+ // messageblocks. If so, consolidate them to one block that can be
+ // dumped
+ ACE_Message_Block* consolidated_block = 0;
+ if (stream.begin()->cont () != 0)
+ {
+ ACE_NEW_RETURN (consolidated_block,
+ ACE_Message_Block,
+ 0);
+ ACE_CDR::consolidate (consolidated_block, stream.begin ());
+ buf = (char *) (consolidated_block->rd_ptr ());
+ }
+ ///
+ this->dump_msg ("send",
+ reinterpret_cast <u_char *> (buf),
+ total_len);
+
+ //
+ delete consolidated_block;
+ consolidated_block = 0;
+ //
+ }
+
+ return 0;
+}
+
+TAO_Pluggable_Message_Type
+TAO_GIOP_Message_Base::message_type (
+ const TAO_GIOP_Message_State &msg_state) const
+{
+ // Convert to the right type of Pluggable Messaging message type.
+
+ switch (msg_state.message_type_)
+ {
+ case TAO_GIOP_REQUEST:
+ return TAO_PLUGGABLE_MESSAGE_REQUEST;
+ case TAO_GIOP_LOCATEREQUEST:
+ return TAO_PLUGGABLE_MESSAGE_LOCATEREQUEST;
+
+ case TAO_GIOP_LOCATEREPLY:
+ return TAO_PLUGGABLE_MESSAGE_LOCATEREPLY;
+
+ case TAO_GIOP_REPLY:
+ return TAO_PLUGGABLE_MESSAGE_REPLY;
+
+ case TAO_GIOP_CLOSECONNECTION:
+ return TAO_PLUGGABLE_MESSAGE_CLOSECONNECTION;
+
+ case TAO_GIOP_FRAGMENT:
+ return TAO_PLUGGABLE_MESSAGE_FRAGMENT;
+
+ case TAO_GIOP_MESSAGERROR:
+ return TAO_PLUGGABLE_MESSAGE_MESSAGERROR;
+
+ case TAO_GIOP_CANCELREQUEST:
+ return TAO_PLUGGABLE_MESSAGE_CANCELREQUEST;
+
+ default:
+ if (TAO_debug_level > 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) %N:%l message_type : ")
+ ACE_TEXT ("wrong message.\n")));
+ }
+ }
+
+ return TAO_PLUGGABLE_MESSAGE_MESSAGERROR;
+}
+
+int
+TAO_GIOP_Message_Base::parse_incoming_messages (ACE_Message_Block &incoming)
+{
+ this->message_state_.reset ();
+
+ return this->message_state_.parse_message_header (incoming);
+}
+
+int
+TAO_GIOP_Message_Base::parse_next_message (ACE_Message_Block &incoming,
+ TAO_Queued_Data &qd,
+ size_t &mesg_length)
+{
+ if (incoming.length () < TAO_GIOP_MESSAGE_HEADER_LEN)
+ {
+ qd.missing_data_ = TAO_MISSING_DATA_UNDEFINED;
+
+ return 0; /* incomplete header */
+ }
+ else
+ {
+ TAO_GIOP_Message_State state;
+
+ if (state.parse_message_header (incoming) == -1)
+ {
+ return -1;
+ }
+
+ const size_t message_size = state.message_size (); /* Header + Payload */
+
+ if (message_size > incoming.length ())
+ {
+ qd.missing_data_ = message_size - incoming.length ();
+ }
+ else
+ {
+ qd.missing_data_ = 0;
+ }
+
+ /* init out-parameters */
+ this->init_queued_data (&qd, state);
+ mesg_length = TAO_GIOP_MESSAGE_HEADER_LEN
+ + state.payload_size ();
+
+ return 1; /* complete header */
+ }
+}
+
+int
+TAO_GIOP_Message_Base::extract_next_message (ACE_Message_Block &incoming,
+ TAO_Queued_Data *&qd)
+{
+ if (incoming.length () < TAO_GIOP_MESSAGE_HEADER_LEN)
+ {
+ if (incoming.length () > 0)
+ {
+ // Optimize memory usage, we dont know actual message size
+ // so far, but allocate enough space to hold small GIOP
+ // messages. This way we avoid expensive "grow" operation
+ // for small messages.
+ size_t const default_buf_size = ACE_CDR::DEFAULT_BUFSIZE;
+
+ // Make a node which has at least message block of the size
+ // of MESSAGE_HEADER_LEN.
+ size_t const buf_size = ace_max (TAO_GIOP_MESSAGE_HEADER_LEN,
+ default_buf_size);
+
+ // POST: buf_size >= TAO_GIOP_MESSAGE_HEADER_LEN
+
+ qd = this->make_queued_data (buf_size);
+
+ if (qd == 0)
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_ERROR((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) - TAO_GIOP_Message_Base::extract_next_message, ")
+ ACE_TEXT ("out of memory\n")));
+ }
+ return -1;
+ }
+
+ qd->msg_block_->copy (incoming.rd_ptr (),
+ incoming.length ());
+
+ incoming.rd_ptr (incoming.length ()); // consume all available data
+
+ qd->missing_data_ = TAO_MISSING_DATA_UNDEFINED;
+ }
+ else
+ {
+ // handle not initialized variables
+ qd = 0; // reset
+ }
+
+ return 0;
+ }
+
+ TAO_GIOP_Message_State state;
+ if (state.parse_message_header (incoming) == -1)
+ {
+ return -1;
+ }
+
+ size_t copying_len = state.message_size ();
+
+ qd = this->make_queued_data (copying_len);
+
+ if (qd == 0)
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) - TAO_GIOP_Message_Base::extract_next_message, ")
+ ACE_TEXT ("out of memory\n")));
+ }
+ return -1;
+ }
+
+ if (copying_len > incoming.length ())
+ {
+ qd->missing_data_ = copying_len - incoming.length ();
+ copying_len = incoming.length ();
+ }
+ else
+ {
+ qd->missing_data_ = 0;
+ }
+
+ qd->msg_block_->copy (incoming.rd_ptr (),
+ copying_len);
+
+ incoming.rd_ptr (copying_len);
+ this->init_queued_data (qd, state);
+
+ return 1;
+}
+
+int
+TAO_GIOP_Message_Base::consolidate_node (TAO_Queued_Data *qd,
+ ACE_Message_Block &incoming)
+{
+ // Look to see whether we had atleast parsed the GIOP header ...
+ if (qd->missing_data_ == TAO_MISSING_DATA_UNDEFINED)
+ {
+ // The data length that has been stuck in there during the last
+ // read ....
+ size_t const len =
+ qd->msg_block_->length ();
+
+ // paranoid check
+ if (len >= TAO_GIOP_MESSAGE_HEADER_LEN)
+ {
+ // inconsistency - this code should have parsed the header
+ // so far
+ return -1;
+ }
+
+ // We know that we would have space for
+ // TAO_GIOP_MESSAGE_HEADER_LEN here. So copy that much of data
+ // from the <incoming> into the message block in <qd>
+ size_t const available = incoming.length ();
+ size_t const desired = TAO_GIOP_MESSAGE_HEADER_LEN - len;
+ size_t const n_copy = ace_min (available, desired);
+
+ // paranoid check, but would cause endless looping
+ if (n_copy == 0)
+ {
+ return -1;
+ }
+
+ if (qd->msg_block_->copy (incoming.rd_ptr (),
+ n_copy) == -1)
+ {
+ return -1;
+ }
+
+ // Move the rd_ptr () in the incoming message block..
+ incoming.rd_ptr (n_copy);
+
+ // verify sufficient data to parse GIOP header
+ if (qd->msg_block_->length () < TAO_GIOP_MESSAGE_HEADER_LEN)
+ {
+ return 0; /* continue */
+ }
+
+ TAO_GIOP_Message_State state;
+
+ // Parse the message header now...
+ if (state.parse_message_header (*qd->msg_block_) == -1)
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) - TAO_GIOP_Message_Base::consolidate_node, ")
+ ACE_TEXT ("error parsing header\n") ));
+ }
+ return -1;
+ }
+ // Now grow the message block so that we can copy the rest of
+ // the data, the message_block must be able to hold complete message
+ if (ACE_CDR::grow (qd->msg_block_,
+ state.message_size ()) == -1) /* GIOP_Header + Payload */
+ {
+ // on mem-error get rid of context silently, try to avoid
+ // system calls that might allocate additional memory
+ return -1;
+ }
+
+ // Copy the pay load..
+ // Calculate the bytes that needs to be copied in the queue...
+ size_t copy_len = state.payload_size ();
+
+ // If the data that needs to be copied is more than that is
+ // available to us ..
+ if (copy_len > incoming.length ())
+ {
+ // Calculate the missing data..
+ qd->missing_data_ = copy_len - incoming.length ();
+
+ // Set the actual possible copy_len that is available...
+ copy_len = incoming.length ();
+ }
+ else
+ {
+ qd->missing_data_ = 0;
+ }
+
+ // ..now we are set to copy the right amount of data to the
+ // node..
+ if (qd->msg_block_->copy (incoming.rd_ptr (),
+ copy_len) == -1)
+ {
+ return -1;
+ }
+
+ // Set the <rd_ptr> of the <incoming>..
+ incoming.rd_ptr (copy_len);
+
+ // Get the other details...
+ this->init_queued_data (qd, state);
+ }
+ else
+ {
+ // @@todo: Need to abstract this out to a seperate method...
+ size_t copy_len = qd->missing_data_;
+
+ if (copy_len > incoming.length ())
+ {
+ // Calculate the missing data..
+ qd->missing_data_ = copy_len - incoming.length ();
+
+ // Set the actual possible copy_len that is available...
+ copy_len = incoming.length ();
+ }
+
+ // paranoid check for endless-event-looping
+ if (copy_len == 0)
+ {
+ return -1;
+ }
+
+ // Copy the right amount of data in to the node...
+ // node..
+ if (qd->msg_block_->copy (incoming.rd_ptr (),
+ copy_len) == -1)
+ {
+ return -1;
+ }
+
+ // Set the <rd_ptr> of the <incoming>..
+ qd->msg_block_->rd_ptr (copy_len);
+
+ }
+
+ return 0;
+}
+
+int
+TAO_GIOP_Message_Base::process_request_message (TAO_Transport *transport,
+ TAO_Queued_Data *qd)
+{
+ // Set the upcall thread
+ this->orb_core_->lf_strategy ().set_upcall_thread (this->orb_core_->leader_follower ());
+
+ // Get a parser for us
+ TAO_GIOP_Message_Generator_Parser *generator_parser = 0;
+
+ // Get the state information that we need to use
+ this->set_state (qd->major_version_,
+ qd->minor_version_,
+ generator_parser);
+
+ // A buffer that we will use to initialise the CDR stream. Since we're
+ // allocating the buffer on the stack, we may as well allocate the data
+ // block on the stack too and avoid an allocation inside the message
+ // block of the CDR.
+#if defined (ACE_INITIALIZE_MEMORY_BEFORE_USE)
+ char repbuf[ACE_CDR::DEFAULT_BUFSIZE] = { 0 };
+#else
+ char repbuf[ACE_CDR::DEFAULT_BUFSIZE];
+#endif /* ACE_INITIALIZE_MEMORY_BEFORE_USE */
+ ACE_Data_Block out_db (sizeof (repbuf),
+ ACE_Message_Block::MB_DATA,
+ repbuf,
+ this->orb_core_->input_cdr_buffer_allocator (),
+ 0,
+ ACE_Message_Block::DONT_DELETE,
+ this->orb_core_->input_cdr_dblock_allocator ());
+
+ // Initialize an output CDR on the stack
+ // NOTE: Don't jump to a conclusion as to why we are using the
+ // input_cdr and hence the global pool here. These pools will move
+ // to the lanes anyway at some point of time. Further, it would have
+ // been awesome to have this in TSS. But for some reason the cloning
+ // that happens when the ORB gets flow controlled while writing a
+ // reply is messing things up. We crash horribly. Doing this adds a
+ // lock, we need to set things like this -- put stuff in TSS here
+ // and transfer to global memory when we get flow controlled. We
+ // need to work on the message block to get it right!
+ TAO_OutputCDR output (&out_db,
+ TAO_ENCAP_BYTE_ORDER,
+ this->orb_core_->input_cdr_msgblock_allocator (),
+ this->orb_core_->orb_params ()->cdr_memcpy_tradeoff (),
+ this->fragmentation_strategy_.get (),
+ qd->major_version_,
+ qd->minor_version_);
+
+ // Get the read and write positions before we steal data.
+ size_t rd_pos = qd->msg_block_->rd_ptr () - qd->msg_block_->base ();
+ size_t const wr_pos = qd->msg_block_->wr_ptr () - qd->msg_block_->base ();
+ rd_pos += TAO_GIOP_MESSAGE_HEADER_LEN;
+
+ if (TAO_debug_level > 0)
+ this->dump_msg ("recv",
+ reinterpret_cast <u_char *> (qd->msg_block_->rd_ptr ()),
+ qd->msg_block_->length ());
+
+
+ // Create a input CDR stream. We do the following
+ // 1 - If the incoming message block has a data block with a flag
+ // DONT_DELETE (for the data block) we create an input CDR
+ // stream the same way.
+ // 2 - If the incoming message block had a datablock from heap just
+ // use it by duplicating it and make the flag 0.
+ // NOTE: We use the same data block in which we read the message and
+ // we pass it on to the higher layers of the ORB. So we dont to any
+ // copies at all here. The same is also done in the higher layers.
+
+ ACE_Message_Block::Message_Flags flg = 0;
+ ACE_Data_Block *db = 0;
+
+ // Get the flag in the message block
+ flg = qd->msg_block_->self_flags ();
+
+ if (ACE_BIT_ENABLED (flg,
+ ACE_Message_Block::DONT_DELETE))
+ {
+ // Use the same datablock
+ db = qd->msg_block_->data_block ();
+ }
+ else
+ {
+ // Use a duplicated datablock as the datablock has come off the
+ // heap.
+ db = qd->msg_block_->data_block ()->duplicate ();
+ }
+
+
+ TAO_InputCDR input_cdr (db,
+ flg,
+ rd_pos,
+ wr_pos,
+ qd->byte_order_,
+ qd->major_version_,
+ qd->minor_version_,
+ this->orb_core_);
+
+ transport->assign_translators(&input_cdr,&output);
+
+ // We know we have some request message. Check whether it is a
+ // GIOP_REQUEST or GIOP_LOCATE_REQUEST to take action.
+
+ // Once we send the InputCDR stream we need to just forget about
+ // the stream and never touch that again for anything. We basically
+ // loose ownership of the data_block.
+
+ switch (qd->msg_type_)
+ {
+ case TAO_PLUGGABLE_MESSAGE_REQUEST:
+ // Should be taken care by the state specific invocations. They
+ // could raise an exception or write things in the output CDR
+ // stream
+ return this->process_request (transport,
+ input_cdr,
+ output,
+ generator_parser);
+
+ case TAO_PLUGGABLE_MESSAGE_LOCATEREQUEST:
+ return this->process_locate_request (transport,
+ input_cdr,
+ output,
+ generator_parser);
+ default:
+ return -1;
+ }
+}
+
+int
+TAO_GIOP_Message_Base::process_reply_message (
+ TAO_Pluggable_Reply_Params &params,
+ TAO_Queued_Data *qd)
+{
+ // Get a parser for us
+ TAO_GIOP_Message_Generator_Parser *generator_parser = 0;
+
+ // Get the state information that we need to use
+ this->set_state (qd->major_version_,
+ qd->minor_version_,
+ generator_parser);
+
+ // Get the read and write positions before we steal data.
+ size_t rd_pos = qd->msg_block_->rd_ptr () - qd->msg_block_->base ();
+ size_t const wr_pos = qd->msg_block_->wr_ptr () - qd->msg_block_->base ();
+ rd_pos += TAO_GIOP_MESSAGE_HEADER_LEN;
+
+ if (TAO_debug_level > 0)
+ this->dump_msg ("recv",
+ reinterpret_cast <u_char *> (qd->msg_block_->rd_ptr ()),
+ qd->msg_block_->length ());
+
+
+ // Create a empty buffer on stack
+ // NOTE: We use the same data block in which we read the message and
+ // we pass it on to the higher layers of the ORB. So we dont to any
+ // copies at all here.
+ TAO_InputCDR input_cdr (qd->msg_block_->data_block (),
+ ACE_Message_Block::DONT_DELETE,
+ rd_pos,
+ wr_pos,
+ qd->byte_order_,
+ qd->major_version_,
+ qd->minor_version_,
+ this->orb_core_);
+
+ // We know we have some reply message. Check whether it is a
+ // GIOP_REPLY or GIOP_LOCATE_REPLY to take action.
+
+ // Once we send the InputCDR stream we need to just forget about
+ // the stream and never touch that again for anything. We basically
+ // loose ownership of the data_block.
+ int retval = 0;
+
+ switch (qd->msg_type_)
+ {
+ case TAO_PLUGGABLE_MESSAGE_REPLY:
+ // Should be taken care by the state specific parsing
+ retval =
+ generator_parser->parse_reply (input_cdr,
+ params);
+
+ break;
+ case TAO_PLUGGABLE_MESSAGE_LOCATEREPLY:
+ retval =
+ generator_parser->parse_locate_reply (input_cdr,
+ params);
+ break;
+ default:
+ retval = -1;
+ }
+
+ if (retval == -1)
+ return retval;
+
+ params.input_cdr_ = &input_cdr;
+
+ retval =
+ params.transport_->tms ()->dispatch_reply (params);
+
+ if (retval == -1)
+ {
+ // Something really critical happened, we will forget about
+ // every reply on this connection.
+ if (TAO_debug_level > 0)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) - GIOP_Message_Base[%d]::process_parsed_messages, ")
+ ACE_TEXT ("dispatch reply failed\n"),
+ params.transport_->id ()));
+ }
+
+ return retval;
+}
+
+int
+TAO_GIOP_Message_Base::generate_exception_reply (
+ TAO_OutputCDR &cdr,
+ TAO_Pluggable_Reply_Params_Base &params,
+ CORBA::Exception &x
+ )
+{
+ // A new try/catch block, but if something goes wrong now we have no
+ // hope, just abort.
+ ACE_DECLARE_NEW_CORBA_ENV;
+
+ ACE_TRY
+ {
+ // Make the GIOP & reply header.
+ this->generate_reply_header (cdr,
+ params);
+ x._tao_encode (cdr
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCH (CORBA::Exception, ex)
+ {
+ // Now we know that while handling the error an other error
+ // happened -> no hope, close connection.
+
+ // Close the handle.
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("(%P|%t|%N|%l) cannot marshal exception, ")
+ ACE_TEXT ("generate_exception_reply ()\n")));
+ return -1;
+ }
+ ACE_ENDTRY;
+ ACE_CHECK_RETURN (-1);
+
+ return 0;
+}
+
+int
+TAO_GIOP_Message_Base::write_protocol_header (TAO_GIOP_Message_Type type,
+ TAO_OutputCDR &msg)
+{
+ // Reset the message type
+ msg.reset ();
+
+ CORBA::Octet header[12] =
+ {
+ // The following works on non-ASCII platforms, such as MVS (which
+ // uses EBCDIC).
+ 0x47, // 'G'
+ 0x49, // 'I'
+ 0x4f, // 'O'
+ 0x50 // 'P'
+ };
+
+ CORBA::Octet major, minor = 0;
+
+ (void) msg.get_version (major, minor);
+
+ header[4] = major;
+ header[5] = minor;
+
+ // "flags" octet, i.e. header[6] will be set up later when message
+ // is formatted by the transport.
+
+ header[7] = CORBA::Octet (type); // Message type
+
+ static ACE_CDR::ULong const header_size =
+ sizeof (header) / sizeof (header[0]);
+
+ // Fragmentation should not occur at this point since there are only
+ // 12 bytes in the stream, and fragmentation may only occur when
+ // the stream length >= 16.
+ msg.write_octet_array (header, header_size);
+
+ return msg.good_bit ();
+}
+
+int
+TAO_GIOP_Message_Base::process_request (
+ TAO_Transport * transport,
+ TAO_InputCDR & cdr,
+ TAO_OutputCDR & output,
+ TAO_GIOP_Message_Generator_Parser * parser)
+{
+ // This will extract the request header, set <response_required>
+ // and <sync_with_server> as appropriate.
+ TAO_ServerRequest request (this,
+ cdr,
+ output,
+ transport,
+ this->orb_core_);
+
+ CORBA::ULong request_id = 0;
+ CORBA::Boolean response_required = false;
+
+ int parse_error = 0;
+
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ parse_error =
+ parser->parse_request_header (request);
+
+ TAO_Codeset_Manager *csm = request.orb_core ()->codeset_manager ();
+ if (csm)
+ {
+ csm->process_service_context (request);
+ transport->assign_translators (&cdr, &output);
+ }
+
+ // Throw an exception if the
+ if (parse_error != 0)
+ ACE_TRY_THROW (CORBA::MARSHAL (0,
+ CORBA::COMPLETED_NO));
+ request_id = request.request_id ();
+
+ response_required = request.response_expected ();
+
+ CORBA::Object_var forward_to;
+
+ /*
+ * Hook to specialize request processing within TAO
+ * This hook will be replaced by specialized request
+ * processing implementation.
+ */
+//@@ TAO_DISPATCH_RESOLUTION_OPT_COMMENT_HOOK_START
+
+ // Do this before the reply is sent.
+ this->orb_core_->request_dispatcher ()->dispatch (
+ this->orb_core_,
+ request,
+ forward_to
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+//@@ TAO_DISPATCH_RESOLUTION_OPT_COMMENT_HOOK_END
+
+ if (!CORBA::is_nil (forward_to.in ()))
+ {
+ const CORBA::Boolean permanent_forward_condition =
+ this->orb_core_->is_permanent_forward_condition
+ (forward_to.in (),
+ request.request_service_context ());
+
+ // We should forward to another object...
+ TAO_Pluggable_Reply_Params_Base reply_params;
+ reply_params.request_id_ = request_id;
+ reply_params.reply_status_ =
+ permanent_forward_condition
+ ? TAO_GIOP_LOCATION_FORWARD_PERM
+ : TAO_GIOP_LOCATION_FORWARD;
+ reply_params.svc_ctx_.length (0);
+
+ // Send back the reply service context.
+ reply_params.service_context_notowned (
+ &request.reply_service_info ());
+
+ output.message_attributes (request_id,
+ 0,
+ TAO_Transport::TAO_REPLY,
+ 0);
+
+ // Make the GIOP header and Reply header
+ this->generate_reply_header (output, reply_params);
+
+ if (!(output << forward_to.in ()))
+ {
+ if (TAO_debug_level > 0)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) ERROR: Unable to marshal ")
+ ACE_TEXT ("forward reference.\n")));
+
+ return -1;
+ }
+
+ output.more_fragments (false);
+
+ int result = transport->send_message (output,
+ 0,
+ TAO_Transport::TAO_REPLY);
+ if (result == -1)
+ {
+ if (TAO_debug_level > 0)
+ {
+ // No exception but some kind of error, yet a
+ // response is required.
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO: (%P|%t|%N|%l) %p: ")
+ ACE_TEXT ("cannot send reply\n"),
+ ACE_TEXT ("TAO_GIOP_Message_Base::process_request")));
+ }
+ }
+ return result;
+ }
+ }
+ // Only CORBA exceptions are caught here.
+ ACE_CATCHANY
+ {
+ int result = 0;
+
+ if (response_required)
+ {
+ result = this->send_reply_exception (transport,
+ output,
+ request_id,
+ &request.reply_service_info (),
+ &ACE_ANY_EXCEPTION);
+ if (result == -1)
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO: (%P|%t|%N|%l) %p: ")
+ ACE_TEXT ("cannot send exception\n"),
+ ACE_TEXT ("process_connector_request ()")));
+
+ ACE_PRINT_EXCEPTION (
+ ACE_ANY_EXCEPTION,
+ "TAO_GIOP_Message_Base::process_request[1]");
+ }
+ }
+
+ }
+ else if (TAO_debug_level > 0)
+ {
+ // It is unfortunate that an exception (probably a system
+ // exception) was thrown by the upcall code (even by the
+ // user) when the client was not expecting a response.
+ // However, in this case, we cannot close the connection
+ // down, since it really isn't the client's fault.
+
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) exception thrown ")
+ ACE_TEXT ("but client is not waiting a response\n")));
+
+ ACE_PRINT_EXCEPTION (
+ ACE_ANY_EXCEPTION,
+ "TAO_GIOP_Message_Base::process_request[2]");
+ }
+
+ return result;
+ }
+#if defined (TAO_HAS_EXCEPTIONS)
+ ACE_CATCHALL
+ {
+ // @@ TODO some c++ exception or another, but what do we do with
+ // it?
+ // We are supposed to map it into a CORBA::UNKNOWN exception.
+ // BTW, this cannot be detected if using the <env> mapping. If
+ // we have native exceptions but no support for them in the ORB
+ // we should still be able to catch it. If we don't have native
+ // exceptions it couldn't have been raised in the first place!
+ int result = 0;
+
+ if (response_required)
+ {
+ CORBA::UNKNOWN exception (CORBA::SystemException::_tao_minor_code
+ (TAO_UNHANDLED_SERVER_CXX_EXCEPTION, 0),
+ CORBA::COMPLETED_MAYBE);
+
+ result = this->send_reply_exception (transport,
+ output,
+ request_id,
+ &request.reply_service_info (),
+ &exception);
+ if (result == -1)
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) - TAO_GIOP_Message_Base::process_request[3], ")
+ ACE_TEXT ("%p: ")
+ ACE_TEXT ("cannot send exception\n"),
+ ACE_TEXT ("process_request ()")));
+ ACE_PRINT_EXCEPTION (
+ exception,
+ "TAO_GIOP_Message_Base::process_request[3]");
+ }
+ }
+ }
+ else if (TAO_debug_level > 0)
+ {
+ // It is unfotunate that an exception (probably a system
+ // exception) was thrown by the upcall code (even by the
+ // user) when the client was not expecting a response.
+ // However, in this case, we cannot close the connection
+ // down, since it really isn't the client's fault.
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t|%N|%l) exception thrown ")
+ ACE_TEXT ("but client is not waiting a response\n")));
+ }
+
+ return result;
+ }
+#endif /* TAO_HAS_EXCEPTIONS */
+ ACE_ENDTRY;
+
+ return 0;
+}
+
+
+int
+TAO_GIOP_Message_Base::process_locate_request (TAO_Transport *transport,
+ TAO_InputCDR &input,
+ TAO_OutputCDR &output,
+ TAO_GIOP_Message_Generator_Parser *parser)
+{
+ // This will extract the request header, set <response_required> as
+ // appropriate.
+ TAO_GIOP_Locate_Request_Header locate_request (input,
+ this->orb_core_);
+
+ TAO_GIOP_Locate_Status_Msg status_info;
+
+ // Defaulting.
+ status_info.status = TAO_GIOP_UNKNOWN_OBJECT;
+
+ CORBA::Boolean response_required = 1;
+
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ int parse_error =
+ parser->parse_locate_header (locate_request);
+
+ if (parse_error != 0)
+ {
+ ACE_TRY_THROW (CORBA::MARSHAL (0,
+ CORBA::COMPLETED_NO));
+ }
+
+ TAO::ObjectKey tmp_key (locate_request.object_key ().length (),
+ locate_request.object_key ().length (),
+ locate_request.object_key ().get_buffer (),
+ 0);
+
+ // Set it to an error state
+ parse_error = 1;
+ CORBA::ULong req_id = locate_request.request_id ();
+
+ // We will send the reply. The ServerRequest class need not send
+ // the reply
+ CORBA::Boolean deferred_reply = true;
+ TAO_ServerRequest server_request (this,
+ req_id,
+ response_required,
+ deferred_reply,
+ tmp_key,
+ "_non_existent",
+ output,
+ transport,
+ this->orb_core_,
+ parse_error);
+
+ if (parse_error != 0)
+ {
+ ACE_TRY_THROW (CORBA::MARSHAL (0,
+ CORBA::COMPLETED_NO));
+ }
+
+ CORBA::Object_var forward_to;
+
+ this->orb_core_->request_dispatcher ()->dispatch (
+ this->orb_core_,
+ server_request,
+ forward_to
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (!CORBA::is_nil (forward_to.in ()))
+ {
+ status_info.status = TAO_GIOP_OBJECT_FORWARD;
+ status_info.forward_location_var = forward_to;
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - TAO_GIOP_Message_Base::process_locate_request, ")
+ ACE_TEXT ("called: forwarding\n")));
+ }
+ else if (server_request.exception_type () == TAO_GIOP_NO_EXCEPTION)
+ {
+ // We got no exception, so the object is here.
+ status_info.status = TAO_GIOP_OBJECT_HERE;
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - TAO_GIOP_Message_Base::process_locate_request, ")
+ ACE_TEXT ("found\n")));
+ }
+ else
+ {
+ status_info.forward_location_var = server_request.forward_location ();
+
+ if (!CORBA::is_nil (status_info.forward_location_var.in ()))
+ {
+ status_info.status = TAO_GIOP_OBJECT_FORWARD;
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - TAO_GIOP_Message_Base::process_locate_request, ")
+ ACE_TEXT ("forwarding\n")));
+ }
+ else
+ {
+ // Normal exception, so the object is not here
+ status_info.status = TAO_GIOP_UNKNOWN_OBJECT;
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - TAO_GIOP_Message_Base::process_locate_request, ")
+ ACE_TEXT ("not here\n")));
+ }
+ }
+ }
+
+ ACE_CATCHANY
+ {
+ // Normal exception, so the object is not here
+ status_info.status = TAO_GIOP_UNKNOWN_OBJECT;
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - TAO_GIOP_Message_Base::process_locate_request, ")
+ ACE_TEXT ("CORBA exception raised\n")));
+ }
+#if defined (TAO_HAS_EXCEPTIONS)
+ ACE_CATCHALL
+ {
+ // Normal exception, so the object is not here
+ status_info.status = TAO_GIOP_UNKNOWN_OBJECT;
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) TAO_GIOP_Message_Base::process_locate_request - ")
+ ACE_TEXT ("C++ exception raised\n")));
+ }
+#endif /* TAO_HAS_EXCEPTIONS */
+ ACE_ENDTRY;
+
+ return this->make_send_locate_reply (transport,
+ locate_request,
+ status_info,
+ output,
+ parser);
+}
+
+int
+TAO_GIOP_Message_Base::make_send_locate_reply (TAO_Transport *transport,
+ TAO_GIOP_Locate_Request_Header &request,
+ TAO_GIOP_Locate_Status_Msg &status_info,
+ TAO_OutputCDR &output,
+ TAO_GIOP_Message_Generator_Parser *parser)
+{
+ // Note here we are making the Locate reply header which is *QUITE*
+ // different from the reply header made by the make_reply () call..
+ // Make the GIOP message header
+ this->write_protocol_header (TAO_GIOP_LOCATEREPLY,
+ output);
+
+ // This writes the header & body
+ parser->write_locate_reply_mesg (output,
+ request.request_id (),
+ status_info);
+
+ output.more_fragments (false);
+
+ // Send the message
+ int result = transport->send_message (output,
+ 0,
+ TAO_Transport::TAO_REPLY);
+
+ // Print out message if there is an error
+ if (result == -1)
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO: (%P|%t) %p: cannot send reply\n"),
+ ACE_TEXT ("TAO_GIOP_Message_Base::make_send_locate_reply")));
+ }
+ }
+
+ return result;
+}
+
+// Send an "I can't understand you" message -- again, the message is
+// prefabricated for simplicity. This implies abortive disconnect (at
+// the application level, if not at the level of TCP).
+//
+// NOTE that IIOP will still benefit from TCP's orderly disconnect.
+int
+TAO_GIOP_Message_Base::send_error (TAO_Transport *transport)
+{
+ const char
+ error_message [TAO_GIOP_MESSAGE_HEADER_LEN] =
+ {
+ // The following works on non-ASCII platforms, such as MVS (which
+ // uses EBCDIC).
+ 0x47, // 'G'
+ 0x49, // 'I'
+ 0x4f, // 'O'
+ 0x50, // 'P'
+ (CORBA::Octet) 1, // Use the lowest GIOP version
+ (CORBA::Octet) 0,
+ TAO_ENCAP_BYTE_ORDER,
+ TAO_GIOP_MESSAGERROR,
+ 0, 0, 0, 0
+ };
+
+ // @@ Q: How does this works with GIOP lite?
+ // A: It doesn't
+
+ this->dump_msg ("send_error",
+ (const u_char *) error_message,
+ TAO_GIOP_MESSAGE_HEADER_LEN);
+
+ ACE_Data_Block data_block (TAO_GIOP_MESSAGE_HEADER_LEN,
+ ACE_Message_Block::MB_DATA,
+ error_message,
+ 0,
+ 0,
+ ACE_Message_Block::DONT_DELETE,
+ 0);
+ ACE_Message_Block message_block(&data_block,
+ ACE_Message_Block::DONT_DELETE);
+ message_block.wr_ptr (TAO_GIOP_MESSAGE_HEADER_LEN);
+
+ size_t bt;
+ int result = transport->send_message_block_chain (&message_block, bt);
+ if (result == -1)
+ {
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%N|%l|%P|%t) error sending error to transport %u\n"),
+ transport->id ()));
+ }
+
+ return result;
+}
+
+void
+TAO_GIOP_Message_Base::set_state (
+ CORBA::Octet def_major,
+ CORBA::Octet def_minor,
+ TAO_GIOP_Message_Generator_Parser *&gen_parser) const
+{
+ switch (def_major)
+ {
+ case 1:
+ switch (def_minor)
+ {
+ case 0:
+ gen_parser =
+ const_cast<TAO_GIOP_Message_Generator_Parser_10 *> (
+ &this->tao_giop_impl_.tao_giop_10);
+ break;
+ case 1:
+ gen_parser =
+ const_cast<TAO_GIOP_Message_Generator_Parser_11 *> (
+ &this->tao_giop_impl_.tao_giop_11);
+ break;
+ case 2:
+ gen_parser =
+ const_cast<TAO_GIOP_Message_Generator_Parser_12 *> (
+ &this->tao_giop_impl_.tao_giop_12);
+ break;
+ default:
+ break;
+ }
+ break;
+ default:
+ break;
+ }
+}
+
+
+// Server sends an "I'm shutting down now, any requests you've sent me
+// can be retried" message to the server. The message is prefab, for
+// simplicity.
+//
+// NOTE: this is IIOP-specific though it doesn't look like it is. It
+// relies on a TCP-ism: orderly disconnect, which doesn't exist in all
+// transport protocols. Versions of GIOP atop some transport that's
+// lacking orderly disconnect must define some transport-specific
+// handshaking (e.g. the XNS/SPP handshake convention) in order to
+// know that the same transport semantics are provided when shutdown
+// is begun with messages "in flight". (IIOP doesn't report false
+// errors in the case of "clean shutdown", because it relies on
+// orderly disconnect as provided by TCP. This quality of service is
+// required to write robust distributed systems.)
+
+void
+TAO_GIOP_Message_Base::
+ send_close_connection (const TAO_GIOP_Message_Version &version,
+ TAO_Transport *transport,
+ void *)
+{
+
+ // static CORBA::Octet
+ // I hate this in every method. Till the time I figure out a way
+ // around I will have them here hanging around.
+ const char close_message [TAO_GIOP_MESSAGE_HEADER_LEN] =
+ {
+ // The following works on non-ASCII platforms, such as MVS (which
+ // uses EBCDIC).
+ 0x47, // 'G'
+ 0x49, // 'I'
+ 0x4f, // 'O'
+ 0x50, // 'P'
+ version.major,
+ version.minor,
+ TAO_ENCAP_BYTE_ORDER,
+ TAO_GIOP_CLOSECONNECTION,
+ 0, 0, 0, 0
+ };
+
+ // It's important that we use a reliable shutdown after we send this
+ // message, so we know it's received.
+ //
+ // @@ should recv and discard queued data for portability; note
+ // that this won't block (long) since we never set SO_LINGER
+
+ this->dump_msg ("send_close_connection",
+ (const u_char *) close_message,
+ TAO_GIOP_MESSAGE_HEADER_LEN);
+
+#if 0
+ // @@CJC I don't think we need this check b/c the transport's send()
+ // will simply return -1. However, I guess we could create something
+ // like TAO_Tranport::is_closed() that returns whether the connection
+ // is already closed. The problem with that, however, is that it's
+ // entirely possible that is_closed() could return TRUE, and then the
+ // transport could get closed down btw. the time it gets called and the
+ // time that the send actually occurs.
+ ACE_HANDLE which = transport->handle ();
+ if (which == ACE_INVALID_HANDLE)
+ {
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) TAO_GIOP_Message_Base::send_close_connection -")
+ ACE_TEXT (" connection already closed\n")));
+ return;
+ }
+#endif
+
+ ACE_Data_Block data_block (TAO_GIOP_MESSAGE_HEADER_LEN,
+ ACE_Message_Block::MB_DATA,
+ close_message,
+ 0,
+ 0,
+ ACE_Message_Block::DONT_DELETE,
+ 0);
+ ACE_Message_Block message_block(&data_block);
+ message_block.wr_ptr (TAO_GIOP_MESSAGE_HEADER_LEN);
+
+ size_t bt;
+ int result = transport->send_message_block_chain (&message_block, bt);
+ if (result == -1)
+ {
+ if (TAO_debug_level > 0)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) error closing connection %u, errno = %d\n"),
+ transport->id (), errno));
+ }
+
+ transport->close_connection ();
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("(%P|%t) shut down transport, handle %d\n"),
+ transport-> id ()));
+
+}
+
+
+int
+TAO_GIOP_Message_Base::send_reply_exception (
+ TAO_Transport *transport,
+ TAO_OutputCDR &output,
+ CORBA::ULong request_id,
+ IOP::ServiceContextList *svc_info,
+ CORBA::Exception *x
+ )
+{
+ TAO_Pluggable_Reply_Params_Base reply_params;
+ reply_params.request_id_ = request_id;
+ reply_params.svc_ctx_.length (0);
+
+ // We are going to send some data
+ reply_params.argument_flag_ = 1;
+
+ // Send back the service context we received. (RTCORBA relies on
+ // this).
+ reply_params.service_context_notowned (svc_info);
+
+ reply_params.reply_status_ = TAO_GIOP_USER_EXCEPTION;
+
+ if (CORBA::SystemException::_downcast (x) != 0)
+ {
+ reply_params.reply_status_ = TAO_GIOP_SYSTEM_EXCEPTION;
+ }
+
+ if (this->generate_exception_reply (output,
+ reply_params,
+ *x) == -1)
+ return -1;
+
+ output.more_fragments (false);
+
+ return transport->send_message (output,
+ 0,
+ TAO_Transport::TAO_REPLY);
+}
+
+void
+TAO_GIOP_Message_Base::dump_msg (const char *label,
+ const u_char *ptr,
+ size_t len)
+{
+
+ if (TAO_debug_level >= 5)
+ {
+ static const char digits[] = "0123456789ABCD";
+ static const char *names[] =
+ {
+ "Request",
+ "Reply",
+ "CancelRequest",
+ "LocateRequest",
+ "LocateReply",
+ "CloseConnection",
+ "MessageError",
+ "Fragment"
+ };
+
+ // Message name.
+ const char *message_name = "UNKNOWN MESSAGE";
+ u_long slot = ptr[TAO_GIOP_MESSAGE_TYPE_OFFSET];
+ if (slot < sizeof (names) / sizeof (names[0]))
+ message_name = names[slot];
+
+ // Byte order.
+ int byte_order = ptr[TAO_GIOP_MESSAGE_FLAGS_OFFSET] & 0x01;
+
+ // Get the version info
+ CORBA::Octet major = ptr[TAO_GIOP_VERSION_MAJOR_OFFSET];
+ CORBA::Octet minor = ptr[TAO_GIOP_VERSION_MINOR_OFFSET];
+
+ // request/reply id.
+ CORBA::ULong tmp = 0;
+ CORBA::ULong *id = &tmp;
+ char *tmp_id = 0;
+
+ if (ptr[TAO_GIOP_MESSAGE_TYPE_OFFSET] == TAO_GIOP_REQUEST ||
+ ptr[TAO_GIOP_MESSAGE_TYPE_OFFSET] == TAO_GIOP_REPLY ||
+ ptr[TAO_GIOP_MESSAGE_TYPE_OFFSET] == TAO_GIOP_FRAGMENT)
+ {
+ if (major == 1 && minor < 2)
+ {
+ // @@ Only works if ServiceContextList is empty....
+ tmp_id = (char * ) (ptr + TAO_GIOP_MESSAGE_HEADER_LEN + 4);
+ }
+ else
+ {
+ tmp_id = (char * ) (ptr + TAO_GIOP_MESSAGE_HEADER_LEN);
+ }
+#if !defined (ACE_DISABLE_SWAP_ON_READ)
+ if (byte_order == TAO_ENCAP_BYTE_ORDER)
+ {
+ id = reinterpret_cast <ACE_CDR::ULong*> (tmp_id);
+ }
+ else
+ {
+ ACE_CDR::swap_4 (tmp_id, reinterpret_cast <char*> (id));
+ }
+#else
+ id = reinterpret_cast <ACE_CDR::ULong*> (tmp_id);
+#endif /* ACE_DISABLE_SWAP_ON_READ */
+
+ }
+
+ // Print.
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - GIOP_Message_Base::dump_msg, "
+ "%s GIOP v%c.%c msg, %d data bytes, %s endian, "
+ "Type %s[%u]\n",
+ ACE_TEXT_CHAR_TO_TCHAR (label),
+ digits[ptr[TAO_GIOP_VERSION_MAJOR_OFFSET]],
+ digits[ptr[TAO_GIOP_VERSION_MINOR_OFFSET]],
+ len - TAO_GIOP_MESSAGE_HEADER_LEN ,
+ (byte_order == TAO_ENCAP_BYTE_ORDER) ? ACE_TEXT("my") : ACE_TEXT("other"),
+ ACE_TEXT_CHAR_TO_TCHAR(message_name),
+ *id));
+
+ if (TAO_debug_level >= 10)
+ ACE_HEX_DUMP ((LM_DEBUG,
+ (const char *) ptr,
+ len,
+ ACE_TEXT ("GIOP message")));
+ }
+}
+
+int
+TAO_GIOP_Message_Base::generate_locate_reply_header (
+ TAO_OutputCDR & /*cdr*/,
+ TAO_Pluggable_Reply_Params_Base & /*params*/)
+{
+ return 0;
+}
+
+int
+TAO_GIOP_Message_Base::is_ready_for_bidirectional (TAO_OutputCDR &msg)
+{
+ // Get a parser for us
+ TAO_GIOP_Message_Generator_Parser *parser = 0;
+
+ CORBA::Octet major, minor = 0;
+
+ msg.get_version (major, minor);
+
+ // Get the state information that we need to use
+ this->set_state (major,
+ minor,
+ parser);
+
+ // We dont really know.. So ask the generator and parser objects that
+ // we know.
+ // @@ TODO: Need to make this faster, instead of making virtual
+ // call, try todo the check within this class
+ return parser->is_ready_for_bidirectional ();
+}
+
+
+TAO_Queued_Data *
+TAO_GIOP_Message_Base::make_queued_data (size_t sz)
+{
+ // Make a datablock for the size requested + something. The
+ // "something" is required because we are going to align the data
+ // block in the message block. During alignment we could loose some
+ // bytes. As we may not know how many bytes will be lost, we will
+ // allocate ACE_CDR::MAX_ALIGNMENT extra.
+ ACE_Data_Block *db =
+ this->orb_core_->create_input_cdr_data_block (sz +
+ ACE_CDR::MAX_ALIGNMENT);
+
+ TAO_Queued_Data *qd =
+ TAO_Queued_Data::make_queued_data (
+ this->orb_core_->transport_message_buffer_allocator (),
+ this->orb_core_->input_cdr_msgblock_allocator (),
+ db);
+
+ if (qd == 0)
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) - TAO_GIOP_Message_Base::make_queued_data, ")
+ ACE_TEXT ("out of memory, failed to allocate queued data object\n")));
+ }
+ db->release ();
+ return 0; // NULL pointer
+ }
+
+ return qd;
+}
+
+size_t
+TAO_GIOP_Message_Base::header_length (void) const
+{
+ return TAO_GIOP_MESSAGE_HEADER_LEN;
+}
+
+size_t
+TAO_GIOP_Message_Base::fragment_header_length (CORBA::Octet major,
+ CORBA::Octet minor) const
+{
+ TAO_GIOP_Message_Generator_Parser *generator_parser = 0;
+
+ // Get the state information that we need to use
+ this->set_state (major,
+ minor,
+ generator_parser);
+
+ return generator_parser->fragment_header_length ();
+}
+
+void
+TAO_GIOP_Message_Base::init_queued_data (
+ TAO_Queued_Data* qd,
+ const TAO_GIOP_Message_State& state) const
+{
+ qd->byte_order_ = state.byte_order_;
+ qd->major_version_ = state.giop_version_.major;
+ qd->minor_version_ = state.giop_version_.minor;
+ qd->more_fragments_ = state.more_fragments_;
+ qd->msg_type_ = this->message_type (state);
+}
+
+int
+TAO_GIOP_Message_Base::parse_request_id (const TAO_Queued_Data *qd, CORBA::ULong &request_id) const
+{
+ // Get a parser for us
+ TAO_GIOP_Message_Generator_Parser *generator_parser = 0;
+
+ // Get the state information that we need to use
+ this->set_state (qd->major_version_,
+ qd->minor_version_,
+ generator_parser);
+
+ // Get the read and write positions before we steal data.
+ size_t rd_pos = qd->msg_block_->rd_ptr () - qd->msg_block_->base ();
+ size_t wr_pos = qd->msg_block_->wr_ptr () - qd->msg_block_->base ();
+ rd_pos += TAO_GIOP_MESSAGE_HEADER_LEN;
+
+ // Create a input CDR stream. We do the following
+ // 1 - If the incoming message block has a data block with a flag
+ // DONT_DELETE (for the data block) we create an input CDR
+ // stream the same way.
+ // 2 - If the incoming message block had a datablock from heap just
+ // use it by duplicating it and make the flag 0.
+ // NOTE: We use the same data block in which we read the message and
+ // we pass it on to the higher layers of the ORB. So we dont to any
+ // copies at all here. The same is also done in the higher layers.
+
+ ACE_Message_Block::Message_Flags flg = 0;
+ ACE_Data_Block *db = 0;
+
+ // Get the flag in the message block
+ flg = qd->msg_block_->self_flags ();
+
+ if (ACE_BIT_ENABLED (flg,
+ ACE_Message_Block::DONT_DELETE))
+ {
+ // Use the same datablock
+ db = qd->msg_block_->data_block ();
+ }
+ else
+ {
+ // Use a duplicated datablock as the datablock has come off the
+ // heap.
+ db = qd->msg_block_->data_block ()->duplicate ();
+ }
+
+
+ TAO_InputCDR input_cdr (db,
+ flg,
+ rd_pos,
+ wr_pos,
+ qd->byte_order_,
+ qd->major_version_,
+ qd->minor_version_,
+ this->orb_core_);
+
+ if (qd->major_version_ >= 1 &&
+ (qd->minor_version_ == 0 || qd->minor_version_ == 1))
+ {
+ if (qd->msg_type_ == TAO_PLUGGABLE_MESSAGE_REQUEST ||
+ qd->msg_type_ == TAO_PLUGGABLE_MESSAGE_REPLY)
+ {
+ IOP::ServiceContextList service_context;
+
+ if ( ! (input_cdr >> service_context &&
+ input_cdr >> request_id) )
+ {
+ return -1;
+ }
+
+ return 0;
+ }
+ else if (qd->msg_type_ == TAO_PLUGGABLE_MESSAGE_CANCELREQUEST ||
+ qd->msg_type_ == TAO_PLUGGABLE_MESSAGE_LOCATEREQUEST ||
+ qd->msg_type_ == TAO_PLUGGABLE_MESSAGE_LOCATEREPLY)
+ {
+ if ( ! (input_cdr >> request_id) )
+ {
+ return -1;
+ }
+
+ return 0;
+ }
+ else
+ {
+ return -1;
+ }
+ }
+ else
+ {
+ if (qd->msg_type_ == TAO_PLUGGABLE_MESSAGE_REQUEST ||
+ qd->msg_type_ == TAO_PLUGGABLE_MESSAGE_REPLY ||
+ qd->msg_type_ == TAO_PLUGGABLE_MESSAGE_FRAGMENT ||
+ qd->msg_type_ == TAO_PLUGGABLE_MESSAGE_CANCELREQUEST ||
+ qd->msg_type_ == TAO_PLUGGABLE_MESSAGE_LOCATEREQUEST ||
+ qd->msg_type_ == TAO_PLUGGABLE_MESSAGE_LOCATEREPLY)
+ {
+ // Dealing with GIOP-1.2, the request-id is located directly behind the GIOP-Header.
+ // This is true for all message types that might be sent in form of fragments or cancel-requests.
+ if ( ! (input_cdr >> request_id) )
+ {
+ return -1;
+ }
+
+ return 0;
+ }
+ else
+ {
+ return -1;
+ }
+ }
+
+ return -1;
+}
+
+/* @return -1 error, 0 ok, +1 outstanding fragments */
+int
+TAO_GIOP_Message_Base::consolidate_fragmented_message (TAO_Queued_Data *qd, TAO_Queued_Data *&msg)
+{
+ TAO::Incoming_Message_Stack reverse_stack;
+
+ TAO_Queued_Data *tail = 0;
+ TAO_Queued_Data *head = 0;
+
+ //
+ // CONSOLIDATE FRAGMENTED MESSAGE
+ //
+
+ // check for error-condition
+ if (qd == 0)
+ {
+ return -1;
+ }
+
+ if (qd->major_version_ == 1 && qd->minor_version_ == 0)
+ {
+ TAO_Queued_Data::release (qd);
+ return -1; // error: GIOP-1.0 does not support fragments
+ }
+
+ // If this is not the last fragment, push it onto stack for later processing
+ if (qd->more_fragments_)
+ {
+ this->fragment_stack_.push (qd);
+
+ msg = 0; // no consolidated message available yet
+ return 1; // status: more messages expected.
+ }
+
+ tail = qd; // init
+
+ // Add the current message block to the end of the chain
+ // after adjusting the read pointer to skip the header(s)
+ const size_t header_adjustment =
+ this->header_length () +
+ this->fragment_header_length (tail->major_version_,
+ tail->minor_version_);
+
+ if (tail->msg_block_->length () < header_adjustment)
+ {
+ // buffer length not sufficient
+ TAO_Queued_Data::release (qd);
+ return -1;
+ }
+
+ // duplicate code to speed up both processes, for GIOP-1.1 and GIOP-1.2
+ if (tail->major_version_ == 1 && tail->minor_version_ == 1)
+ {
+ // GIOP-1.1
+
+ while (this->fragment_stack_.pop (head) != -1)
+ {
+ if (head->more_fragments_ &&
+ head->major_version_ == 1 &&
+ head->minor_version_ == 1 &&
+ head->msg_block_->length () >= header_adjustment)
+ {
+ // adjust the read-pointer, skip the fragment header
+ tail->msg_block_->rd_ptr(header_adjustment);
+
+ head->msg_block_->cont (tail->msg_block_);
+
+ tail->msg_block_ = 0;
+
+ TAO_Queued_Data::release (tail);
+
+ tail = head;
+ }
+ else
+ {
+ reverse_stack.push (head);
+ }
+ }
+ }
+ else
+ {
+ // > GIOP-1.2
+
+ CORBA::ULong tmp_request_id = 0;
+ if (this->parse_request_id (tail, tmp_request_id) == -1)
+ {
+ return -1;
+ }
+
+ const CORBA::ULong request_id = tmp_request_id;
+
+ while (this->fragment_stack_.pop (head) != -1)
+ {
+ CORBA::ULong head_request_id = 0;
+ int parse_status = 0;
+
+ if (head->more_fragments_ &&
+ head->major_version_ >= 1 &&
+ head->minor_version_ >= 2 &&
+ head->msg_block_->length () >= header_adjustment &&
+ (parse_status = this->parse_request_id (head, head_request_id)) != -1 &&
+ request_id == head_request_id)
+ {
+ // adjust the read-pointer, skip the fragment header
+ tail->msg_block_->rd_ptr(header_adjustment);
+
+ head->msg_block_->cont (tail->msg_block_);
+
+ tail->msg_block_ = 0;
+
+ TAO_Queued_Data::release (tail);
+
+ tail = head;
+ }
+ else
+ {
+ if (parse_status == -1)
+ {
+ TAO_Queued_Data::release (head);
+ return -1;
+ }
+
+ reverse_stack.push (head);
+ }
+ }
+ }
+
+ // restore stack
+ while (reverse_stack.pop (head) != -1)
+ {
+ this->fragment_stack_.push (head);
+ }
+
+ if (tail->consolidate () == -1)
+ {
+ // memory allocation failed
+ TAO_Queued_Data::release (tail);
+ return -1;
+ }
+
+ // set out value
+ msg = tail;
+
+ return 0;
+}
+
+
+int
+TAO_GIOP_Message_Base::discard_fragmented_message (const TAO_Queued_Data *cancel_request)
+{
+ // We must extract the specific request-id from message-buffer
+ // and remove all fragments from stack that match this request-id.
+
+ TAO::Incoming_Message_Stack reverse_stack;
+
+ CORBA::ULong cancel_request_id;
+
+ if (this->parse_request_id (cancel_request, cancel_request_id) == -1)
+ {
+ return -1;
+ }
+
+ TAO_Queued_Data *head = 0;
+
+ // Revert stack
+ while (this->fragment_stack_.pop (head) != -1)
+ {
+ reverse_stack.push (head);
+ }
+
+ bool discard_all_GIOP11_messages = false;
+
+ // Now we are able to process message in order they have arrived.
+ // If the cancel_request_id matches to GIOP-1.1 message, all succeeding
+ // fragments belong to this message and must be discarded.
+ // Note: GIOP-1.1 fragment header dont have any request-id encoded. If the
+ // cancel_request_id matches GIOP-1.2 messages, all GIOP-1.2 fragments
+ // having encoded the request id will be discarded.
+ while (reverse_stack.pop (head) != -1)
+ {
+ CORBA::ULong head_request_id;
+
+ if (head->major_version_ == 1 &&
+ head->minor_version_ <= 1 &&
+ head->msg_type_ != TAO_PLUGGABLE_MESSAGE_FRAGMENT && // GIOP11 fragment does not provide request id
+ this->parse_request_id (head, head_request_id) >= 0 &&
+ cancel_request_id == head_request_id)
+ {
+ TAO_Queued_Data::release (head);
+ discard_all_GIOP11_messages = true;
+ }
+ else if (head->major_version_ == 1 &&
+ head->minor_version_ <= 1 &&
+ discard_all_GIOP11_messages)
+ {
+ TAO_Queued_Data::release (head);
+ }
+ else if (head->major_version_ >= 1 &&
+ head->minor_version_ >= 2 &&
+ this->parse_request_id (head, head_request_id) >= 0 &&
+ cancel_request_id == head_request_id)
+ {
+ TAO_Queued_Data::release (head);
+ }
+ else
+ {
+ this->fragment_stack_.push (head);
+ }
+ }
+
+ return 0;
+}
+
+TAO_GIOP_Fragmentation_Strategy *
+TAO_GIOP_Message_Base::fragmentation_strategy (void)
+{
+ return this->fragmentation_strategy_.get ();
+}
+
+void
+TAO_GIOP_Message_Base::set_giop_flags (TAO_OutputCDR & msg) const
+{
+ CORBA::Octet * const buf =
+ reinterpret_cast<CORBA::Octet *> (const_cast<char *> (msg.buffer ()));
+
+ CORBA::Octet const & major = buf[TAO_GIOP_VERSION_MAJOR_OFFSET];
+ CORBA::Octet const & minor = buf[TAO_GIOP_VERSION_MINOR_OFFSET];
+
+ // Flags for the GIOP protocol header "flags" field.
+ CORBA::Octet & flags = buf[TAO_GIOP_MESSAGE_FLAGS_OFFSET];
+
+ // Least significant bit: Byte order
+ ACE_SET_BITS (flags, TAO_ENCAP_BYTE_ORDER ^ msg.do_byte_swap ());
+
+ // Second least significant bit: More fragments
+ //
+ // Only supported in GIOP 1.1 or better.
+ if (!(major <= 1 && minor == 0))
+ ACE_SET_BITS (flags, msg.more_fragments () << 1);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/GIOP_Message_Base.h b/TAO/tao/GIOP_Message_Base.h
new file mode 100644
index 00000000000..e3b329daae0
--- /dev/null
+++ b/TAO/tao/GIOP_Message_Base.h
@@ -0,0 +1,320 @@
+// -*- C++ -*-
+
+// ===================================================================
+/**
+ * @file GIOP_Message_Base.h
+ *
+ * $Id$
+ *
+ * @author Initially Copyrighted by Sun Microsystems Inc., 1994-1995,
+ * @author modified by Balachandran Natarajan <bala@cs.wustl.edu>
+ */
+// ===================================================================
+
+#ifndef TAO_GIOP_MESSAGE_BASE_H
+#define TAO_GIOP_MESSAGE_BASE_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/TAO_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Pluggable_Messaging.h"
+#include "tao/Pluggable_Messaging_Utils.h"
+#include "tao/GIOP_Message_Generator_Parser_Impl.h"
+#include "tao/GIOP_Utils.h"
+#include "tao/GIOP_Message_State.h"
+#include "tao/GIOP_Fragmentation_Strategy.h"
+#include "tao/CDR.h"
+#include "tao/Incoming_Message_Stack.h"
+
+#include "ace/Auto_Ptr.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Pluggable_Reply_Params;
+class TAO_Queued_Data;
+
+/**
+ * @class TAO_GIOP_Message_Base
+ *
+ * @brief Definitions of the GIOP specific stuff.
+ *
+ * This class will hold the specific details common to all the GIOP
+ * versions. Some of them which are here may be shifted if things
+ * start changing between versions.
+ */
+
+class TAO_Export TAO_GIOP_Message_Base : public TAO_Pluggable_Messaging
+{
+public:
+ /// Constructor
+ TAO_GIOP_Message_Base (TAO_ORB_Core *orb_core,
+ TAO_Transport * transport,
+ size_t input_cdr_size = ACE_CDR::DEFAULT_BUFSIZE);
+
+ /// Dtor
+ virtual ~TAO_GIOP_Message_Base (void);
+
+ /// Initialize the underlying state object based on the @a major and
+ /// @a minor revision numbers
+ virtual void init (CORBA::Octet major,
+ CORBA::Octet minor);
+
+ /// Reset the messaging the object
+ virtual void reset (void);
+
+ /// Write the RequestHeader in to the @a cdr stream. The underlying
+ /// implementation of the mesaging should do the right thing.
+ virtual int generate_request_header (TAO_Operation_Details &op,
+ TAO_Target_Specification &spec,
+ TAO_OutputCDR &cdr);
+
+ /// Write the RequestHeader in to the @a cdr stream.
+ virtual int generate_locate_request_header (
+ TAO_Operation_Details &op,
+ TAO_Target_Specification &spec,
+ TAO_OutputCDR &cdr
+ );
+
+ /// Write the reply header
+ virtual int generate_reply_header (
+ TAO_OutputCDR &cdr,
+ TAO_Pluggable_Reply_Params_Base &params
+ );
+
+ virtual int generate_fragment_header (TAO_OutputCDR & cdr,
+ CORBA::ULong request_id);
+
+ /// Format the message. As we have not written the message length in
+ /// the header, we make use of this oppurtunity to insert and format
+ /// the message.
+ virtual int format_message (TAO_OutputCDR &cdr);
+
+ /**
+ * Parse the details of the next message from the @a incoming
+ * and initializes attributes of @a qd.
+ * @retval 0 If the message header could not be parsed completely,
+ * @retval 1 If the message header could be parsed completely
+ * @retval -1 On error.
+ */
+ virtual int parse_next_message (ACE_Message_Block &incoming,
+ TAO_Queued_Data &qd, /* out */
+ size_t &mesg_length); /* out */
+
+ /// Extract the details of the next message from the @a incoming
+ /// through @a qd. Returns 0 if the message header could not be
+ /// parsed completely, returns a 1 if the message header could be
+ /// parsed completely and returns -1 on error.
+ virtual int extract_next_message (ACE_Message_Block &incoming,
+ TAO_Queued_Data *&qd);
+
+ /// Check whether the node @a qd needs consolidation from @a incoming.
+ virtual int consolidate_node (TAO_Queued_Data *qd,
+ ACE_Message_Block &incoming);
+
+ /// Process the request message that we have received on the
+ /// connection
+ virtual int process_request_message (TAO_Transport *transport,
+ TAO_Queued_Data *qd);
+
+
+ /// Parse the reply message that we received and return the reply
+ /// information through @a reply_info
+ virtual int process_reply_message (
+ TAO_Pluggable_Reply_Params &reply_info,
+ TAO_Queued_Data *qd);
+
+ /// Generate a reply message with the exception @a ex.
+ virtual int generate_exception_reply (
+ TAO_OutputCDR &cdr,
+ TAO_Pluggable_Reply_Params_Base &params,
+ CORBA::Exception &x
+ );
+
+ /// Header length
+ virtual size_t header_length (void) const;
+
+ /// The header length of a fragment
+ virtual size_t fragment_header_length (CORBA::Octet major,
+ CORBA::Octet minor) const;
+
+ virtual TAO_OutputCDR &out_stream (void);
+
+ /// Consolidate fragmented message with associated fragments, being
+ /// stored withi this class. If reliable transport is used (like
+ /// TCP) fragments are partialy ordered on stack, last fragment on
+ /// top. Otherwise If un-reliable transport is used (like UDP)
+ /// fragments may be dis-ordered, and must be ordered before
+ /// consolidation. @return 0 on success and @a msg points to
+ /// consolidated message, 1 if there are still fragmens outstanding,
+ /// in case of error -1 is being returned. In any case @a qd must be
+ /// released by method implementation.
+ virtual int consolidate_fragmented_message (TAO_Queued_Data *qd,
+ TAO_Queued_Data *&msg);
+
+ /// Discard all fragments associated to request-id encoded in
+ /// cancel_request. This operation will never be called
+ /// concurrently by multiplpe threads nor concurrently to
+ /// consolidate_fragmented_message @return -1 on failure, 0 on
+ /// success, 1 no fragment on stack relating to CancelRequest.
+ virtual int discard_fragmented_message (const TAO_Queued_Data *cancel_request);
+
+ /// Outgoing GIOP message fragmentation strategy.
+ virtual TAO_GIOP_Fragmentation_Strategy * fragmentation_strategy (void);
+
+protected:
+
+ /// Processes the GIOP_REQUEST messages
+ virtual int process_request (TAO_Transport *transport,
+ TAO_InputCDR &input,
+ TAO_OutputCDR &output,
+ TAO_GIOP_Message_Generator_Parser *);
+
+ /// Processes the GIOP_LOCATE_REQUEST messages
+ virtual int process_locate_request (TAO_Transport *transport,
+ TAO_InputCDR &input,
+ TAO_OutputCDR &output,
+ TAO_GIOP_Message_Generator_Parser *);
+
+ /// Set the state
+ void set_state (CORBA::Octet major,
+ CORBA::Octet minor,
+ TAO_GIOP_Message_Generator_Parser *&) const;
+
+ /// Print out a debug messages..
+ void dump_msg (const char *label,
+ const u_char *ptr,
+ size_t len);
+
+ /// Get the message type. The return value would be one of the
+ /// following:
+ /// TAO_PLUGGABLE_MESSAGE_REQUEST,
+ /// TAO_PLUGGABLE_MESSAGE_REPLY,
+ /// TAO_PLUGGABLE_MESSAGE_CLOSECONNECTION,
+ /// TAO_PLUGGABLE_MESSAGE_MESSAGE_ERROR.
+ TAO_Pluggable_Message_Type message_type (
+ const TAO_GIOP_Message_State &state) const;
+
+ /// Writes the GIOP header in to @a msg
+ /// @note If the GIOP header happens to change in the future, we can
+ /// push this method in to the generator_parser classes.
+ int write_protocol_header (TAO_GIOP_Message_Type t,
+ TAO_OutputCDR &msg);
+
+ /// Make a GIOP_LOCATEREPLY and hand that over to the transport so
+ /// that it can be sent over the connection.
+ /// @note As on date 1.1 & 1.2 seem to have similar headers. Till an
+ /// unmanageable difference comes let them be implemented here.
+ int make_send_locate_reply (TAO_Transport *transport,
+ TAO_GIOP_Locate_Request_Header &request,
+ TAO_GIOP_Locate_Status_Msg &status,
+ TAO_OutputCDR &output,
+ TAO_GIOP_Message_Generator_Parser *);
+
+ /// Send error messages
+ int send_error (TAO_Transport *transport);
+
+ /// Close a connection, first sending GIOP::CloseConnection.
+ void send_close_connection (const TAO_GIOP_Message_Version &version,
+ TAO_Transport *transport,
+ void *ctx);
+
+ /// We must send a LocateReply through @a transport, this request
+ /// resulted in some kind of exception.
+ int send_reply_exception (TAO_Transport *transport,
+ TAO_OutputCDR &cdr,
+ CORBA::ULong request_id,
+ IOP::ServiceContextList *svc_info,
+ CORBA::Exception *x);
+
+
+ /// Write the locate reply header
+ virtual int generate_locate_reply_header (
+ TAO_OutputCDR & /*cdr*/,
+ TAO_Pluggable_Reply_Params_Base & /*params*/);
+
+ /// Is the messaging object ready for processing BiDirectional
+ /// request/response?
+ virtual int is_ready_for_bidirectional (TAO_OutputCDR &msg);
+
+ /// Creates a new node for the queue with a message block in the
+ /// node of size @a sz.
+ TAO_Queued_Data *make_queued_data (size_t sz);
+
+ /// Initialize the TAO_Queued_Data from the relevant portions of
+ /// a GIOP_Message_State.
+ void init_queued_data (TAO_Queued_Data* qd,
+ const TAO_GIOP_Message_State& state) const;
+
+private:
+ int parse_incoming_messages (ACE_Message_Block &incoming);
+
+ /// Parse GIOP request-id of TAO_Queued_Data @a qd
+ /// @return 0 on success, otherwise -1
+ int parse_request_id (const TAO_Queued_Data *qd, CORBA::ULong &request_id) const;
+
+ /// Parse GIOP request-id of TAO_InputCDR @a cdr.
+ /// @return 0 on success, otherwise -1
+ int parse_request_id (const TAO_InputCDR &cdr, CORBA::ULong &request_id) const;
+
+ /// Set GIOP message flags in message that has been marshaled into
+ /// the output CDR stream @a msg.
+ /**
+ * @note It is assumed that the GIOP message header is the first
+ * thing marshaled into the output CDR stream @a msg.
+ */
+ void set_giop_flags (TAO_OutputCDR & msg) const;
+
+private:
+ /// Cached ORB_Core pointer...
+ TAO_ORB_Core *orb_core_;
+
+ /// The message handler object that does reading and parsing of the
+ /// incoming messages
+ TAO_GIOP_Message_State message_state_;
+
+ /// All the implementations of GIOP message generator and parsers
+ TAO_GIOP_Message_Generator_Parser_Impl tao_giop_impl_;
+
+ /// All Fragments being received are stored on stack in reverse
+ /// order, last top
+ TAO::Incoming_Message_Stack fragment_stack_;
+
+protected:
+ /**
+ * @name Outgoing GIOP Fragment Related Attributes
+ *
+ * These attributes are only used when fragmenting outgoing GIOP
+ * requests and replies.
+ */
+ //@{
+ /// Strategy that sends data currently marshaled into this
+ /// TAO_OutputCDR stream if necessary.
+ auto_ptr<TAO_GIOP_Fragmentation_Strategy> fragmentation_strategy_;
+
+ /// Buffer where the request is placed.
+ TAO_OutputCDR out_stream_;
+
+ /*
+ * Hook in the GIOP_Message class to add data member. This hook is
+ * used in speeding up the dispatch within TAO.
+ */
+//@@ GIOP_MESSAGE_BASE_DATA_MEMBER_ADD_HOOK
+
+};
+
+/*
+ * Hook to specialize the Messaging implementation in TAO with either
+ * GIOP or GIOP_Lite protocol.
+ */
+//@@ MESSAGING_SPL_EXTERN_ADD_HOOK
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_GIOP_MESSAGE_BASE_H */
diff --git a/TAO/tao/GIOP_Message_Generator_Parser.cpp b/TAO/tao/GIOP_Message_Generator_Parser.cpp
new file mode 100644
index 00000000000..abd302b491e
--- /dev/null
+++ b/TAO/tao/GIOP_Message_Generator_Parser.cpp
@@ -0,0 +1,171 @@
+// $Id$
+
+#include "tao/GIOP_Message_Generator_Parser.h"
+#include "tao/Pluggable_Messaging_Utils.h"
+#include "tao/GIOP_Utils.h"
+#include "tao/debug.h"
+#include "tao/CDR.h"
+#include "ace/Log_Msg.h"
+
+
+ACE_RCSID (tao,
+ GIOP_Message_Gen_Parser,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_GIOP_Message_Generator_Parser::~TAO_GIOP_Message_Generator_Parser (void)
+{
+}
+
+int
+TAO_GIOP_Message_Generator_Parser::parse_reply (
+ TAO_InputCDR &stream,
+ TAO_Pluggable_Reply_Params &params)
+{
+
+ // Read the request id
+ if (!stream.read_ulong (params.request_id_))
+ {
+ if (TAO_debug_level)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) : TAO_GIOP_Message_Generator_Parser::parse_reply :")
+ ACE_TEXT ("extracting request id\n")));
+ }
+ }
+
+ // and the reply status type. status can be NO_EXCEPTION,
+ // SYSTEM_EXCEPTION, USER_EXCEPTION, LOCATION_FORWARD,
+ // LOCATION_FORWARD_PERM
+ CORBA::ULong rep_stat = 0;
+ if (!stream.read_ulong (rep_stat))
+ {
+ if (TAO_debug_level > 0)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) : TAO_GIOP_Message_Generator_Parser::parse_reply, ")
+ ACE_TEXT ("extracting reply status\n")));
+ return -1;
+ }
+
+
+ // Pass the right Pluggable interface code to the transport layer
+ switch (rep_stat)
+ {
+ // Request completed successfully
+ case TAO_GIOP_NO_EXCEPTION:
+ params.reply_status_ =
+ TAO_PLUGGABLE_MESSAGE_NO_EXCEPTION;
+ break;
+
+ // Request terminated with user exception
+ case TAO_GIOP_USER_EXCEPTION:
+ params.reply_status_ =
+ TAO_PLUGGABLE_MESSAGE_USER_EXCEPTION;
+ break;
+ // Request terminated with system exception
+ case TAO_GIOP_SYSTEM_EXCEPTION:
+ params.reply_status_ =
+ TAO_PLUGGABLE_MESSAGE_SYSTEM_EXCEPTION;
+ break;
+ // Reply is a location forward type
+ case TAO_GIOP_LOCATION_FORWARD:
+ params.reply_status_ =
+ TAO_PLUGGABLE_MESSAGE_LOCATION_FORWARD;
+ break;
+ // Reply is a location forward perm type
+ // LOCATION_FORWARD_PERM is only allowed in context of
+ // FaultTolerant featured requests and requires PortableGroup
+ // features in forwarded object and service context
+ case TAO_GIOP_LOCATION_FORWARD_PERM:
+ params.reply_status_ =
+ TAO_PLUGGABLE_MESSAGE_LOCATION_FORWARD_PERM;
+ break;
+ // Reply is a location forward type
+ case TAO_GIOP_NEEDS_ADDRESSING_MODE:
+ params.reply_status_ =
+ TAO_PLUGGABLE_MESSAGE_NEEDS_ADDRESSING_MODE;
+ break;
+ default:
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("(%N|%l) Unknown reply status \n")));
+ }
+
+ return 0;
+}
+
+
+int
+TAO_GIOP_Message_Generator_Parser::parse_locate_reply (
+ TAO_InputCDR &cdr,
+ TAO_Pluggable_Reply_Params &params)
+{
+ // Read the request id
+ if (!cdr.read_ulong (params.request_id_))
+ {
+ if (TAO_debug_level > 0)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t|%N|%l):parse_locate_reply, ")
+ ACE_TEXT ("extracting request id\n")));
+
+ return -1;
+ }
+
+ // and the reply status type. status can be NO_EXCEPTION,
+ // SYSTEM_EXCEPTION, USER_EXCEPTION, LOCATION_FORWARD
+ // LOCATION_FORWARD_PERM
+
+ // Please note here that we are NOT converting to the Pluggable
+ // messaging layer exception as this is GIOP specific. Not many
+ // messaging protocols have the locate_* messages.
+ if (!cdr.read_ulong (params.reply_status_))
+ {
+ if (TAO_debug_level > 0)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO N|(%P|%t|l) parse_locate_reply, ")
+ ACE_TEXT ("extracting reply status\n")));
+
+ return -1;
+ }
+
+ return 0;
+
+}
+
+
+int
+TAO_GIOP_Message_Generator_Parser::is_ready_for_bidirectional (void)
+{
+ return 0;
+}
+
+void
+TAO_GIOP_Message_Generator_Parser::marshal_reply_status (
+ TAO_OutputCDR &output,
+ TAO_Pluggable_Reply_Params_Base &reply
+ )
+{
+ switch (reply.reply_status_)
+ {
+ case TAO_PLUGGABLE_MESSAGE_NO_EXCEPTION:
+ output.write_ulong (TAO_GIOP_NO_EXCEPTION);
+ break;
+ case TAO_PLUGGABLE_MESSAGE_LOCATION_FORWARD:
+ output.write_ulong (TAO_GIOP_LOCATION_FORWARD);
+ break;
+ case TAO_PLUGGABLE_MESSAGE_SYSTEM_EXCEPTION:
+ output.write_ulong (TAO_GIOP_SYSTEM_EXCEPTION);
+ break;
+ case TAO_PLUGGABLE_MESSAGE_USER_EXCEPTION:
+ output.write_ulong (TAO_GIOP_USER_EXCEPTION);
+ break;
+ default:
+ // Some other specific exception
+ output.write_ulong (reply.reply_status_);
+ break;
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/GIOP_Message_Generator_Parser.h b/TAO/tao/GIOP_Message_Generator_Parser.h
new file mode 100644
index 00000000000..db0c6acb11e
--- /dev/null
+++ b/TAO/tao/GIOP_Message_Generator_Parser.h
@@ -0,0 +1,123 @@
+// -*- C++ -*-
+
+// ===================================================================
+/**
+ * @file GIOP_Message_Generator_Parser.h
+ *
+ * $Id$
+ *
+ * @author Balachandran Natarajan <bala@cs.wustl.edu>
+ */
+// ===================================================================
+
+#ifndef TAO_GIOP_MESSAGE_GENERATOR_PARSER_H
+#define TAO_GIOP_MESSAGE_GENERATOR_PARSER_H
+
+#include /**/ "ace/pre.h"
+#include "ace/Global_Macros.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/SystemException.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Operation_Details;
+class TAO_Target_Specification;
+class TAO_OutputCDR;
+class TAO_InputCDR;
+class TAO_Pluggable_Reply_Params;
+class TAO_Pluggable_Reply_Params_Base;
+class TAO_GIOP_Locate_Status_Msg;
+class TAO_GIOP_Locate_Request_Header;
+class TAO_ServerRequest;
+
+/**
+ * @class TAO_GIOP_Message_Generator_Parser
+ *
+ * @brief Base class for the GIOP Message generator and parser
+ *
+ * Version specific classes would inherit from this class. Strategy to
+ * determine which version of the GIOP request have we received and
+ * which version do we need to use to send messages.
+ */
+
+class TAO_Export TAO_GIOP_Message_Generator_Parser
+{
+public:
+
+ virtual ~TAO_GIOP_Message_Generator_Parser (void);
+
+ /// Write the request header in to @a msg
+ virtual int write_request_header (
+ const TAO_Operation_Details &opdetails,
+ TAO_Target_Specification &spec,
+ TAO_OutputCDR &msg) = 0;
+
+ /// Write the LocateRequest header
+ virtual int write_locate_request_header (
+ CORBA::ULong request_id,
+ TAO_Target_Specification &spec,
+ TAO_OutputCDR &msg) = 0;
+
+ /// Write the reply header in to @a output
+ virtual int write_reply_header (
+ TAO_OutputCDR &output,
+ TAO_Pluggable_Reply_Params_Base &reply
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException)) = 0;
+
+ /// Writes the locate _reply message in to the @a output
+ virtual int write_locate_reply_mesg (
+ TAO_OutputCDR &output,
+ CORBA::ULong request_id,
+ TAO_GIOP_Locate_Status_Msg &status) = 0;
+
+ /// Write the GIOP fragment message header to the output CDR stream
+ /// @a cdr.
+ virtual bool write_fragment_header (TAO_OutputCDR & cdr,
+ CORBA::ULong request_id) = 0;
+
+ /// Parse the Request Header from the incoming stream. This will do a
+ /// version specific parsing of the incoming Request header
+ virtual int parse_request_header (TAO_ServerRequest &) = 0;
+
+ /// Parse the Loacte Request Header from the incoming stream. This will do a
+ /// version specific parsing of the incoming Request header
+ virtual int parse_locate_header (
+ TAO_GIOP_Locate_Request_Header &) = 0;
+
+ /// Parse the reply message
+ virtual int parse_reply (TAO_InputCDR &input,
+ TAO_Pluggable_Reply_Params &params);
+
+ /// Parse the locate reply message from the server
+ virtual int parse_locate_reply (TAO_InputCDR &input,
+ TAO_Pluggable_Reply_Params &params);
+
+ /// Our versions
+ virtual CORBA::Octet major_version (void) = 0;
+ virtual CORBA::Octet minor_version (void) = 0;
+
+ /// Is the messaging object ready for processing BiDirectional
+ /// request/response?
+ virtual int is_ready_for_bidirectional (void);
+
+ /// The header length of a fragment
+ virtual size_t fragment_header_length (void) const = 0;
+
+protected:
+
+ /// Marshall the reply status
+ void marshal_reply_status (TAO_OutputCDR &output,
+ TAO_Pluggable_Reply_Params_Base &reply);
+
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /*TAO_GIOP_MESSAGE_GENERATOR_PARSER_H*/
diff --git a/TAO/tao/GIOP_Message_Generator_Parser_10.cpp b/TAO/tao/GIOP_Message_Generator_Parser_10.cpp
new file mode 100644
index 00000000000..831b4e1b419
--- /dev/null
+++ b/TAO/tao/GIOP_Message_Generator_Parser_10.cpp
@@ -0,0 +1,498 @@
+// -*- C++ -*-
+
+#include "tao/GIOP_Message_Generator_Parser_10.h"
+#include "tao/GIOP_Utils.h"
+#include "tao/GIOP_Message_Locate_Header.h"
+#include "tao/operation_details.h"
+#include "tao/debug.h"
+#include "tao/Pluggable_Messaging_Utils.h"
+#include "tao/TAO_Server_Request.h"
+#include "tao/ORB_Constants.h"
+#include "tao/CDR.h"
+#include "tao/SystemException.h"
+
+#include "ace/Log_Msg.h"
+
+ACE_RCSID (tao,
+ GIOP_Message_Generator_Parser_10,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+int
+TAO_GIOP_Message_Generator_Parser_10::write_request_header (
+ const TAO_Operation_Details &opdetails,
+ TAO_Target_Specification &spec,
+ TAO_OutputCDR &msg)
+{
+ // Write the service context list
+ msg << opdetails.request_service_info ();
+
+ // The request ID
+ msg << opdetails.request_id ();
+
+ CORBA::Octet const response_flags = opdetails.response_flags ();
+
+ // Write the response flags
+ if (response_flags == TAO_TWOWAY_RESPONSE_FLAG)
+ {
+ msg << ACE_OutputCDR::from_octet (1);
+ }
+ else
+ {
+ msg << ACE_OutputCDR::from_octet (0);
+ }
+
+ // In this case we cannot recognise anything other than the Object
+ // key as the address disposition variable. But we do a sanity check
+ // anyway.
+ const TAO::ObjectKey *key = spec.object_key ();
+
+ if (key)
+ {
+ // Put in the object key
+ msg << *key;
+ }
+ else
+ {
+ if (TAO_debug_level)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("(%N |%l) Unable to handle this request \n")));
+ }
+ return 0;
+ }
+
+ msg.write_string (opdetails.opname_len (),
+ opdetails.opname ());
+
+ // Last element of request header is the principal; no portable way
+ // to get it, we just pass empty principal (convention: indicates
+ // "anybody"). Steps upward in security include passing an
+ // unverified user ID, and then verifying the message (i.e. a dummy
+ // service context entry is set up to hold a digital signature for
+ // this message, then patched shortly before it's sent).
+
+ /***** This has been deprecated in the 2.4 spec ******/
+
+#if defined (TAO_PEER_REQUIRES_PRINCIPAL)
+
+ char username[BUFSIZ];
+ char *result =
+ ACE_OS::cuserid (username,
+ BUFSIZ);
+
+ if (result != 0)
+ {
+ const CORBA::ULong username_size =
+ static_cast<CORBA::ULong> (ACE_OS::strlen (username));
+
+ CORBA::Octet *buffer =
+ CORBA::OctetSeq::allocbuf (username_size + 1);
+
+ ACE_OS::memcpy (buffer,
+ username,
+ username_size + 1);
+
+ req_principal.replace (username_size + 1,
+ username_size + 1,
+ buffer,
+ 1);
+ }
+
+#else
+
+ CORBA::OctetSeq req_principal (0);
+ req_principal.length (0);
+
+#endif /* TAO_PEER_REQUIRES_PRINCIPAL */
+
+ msg << req_principal;
+
+ return 1;
+}
+
+
+
+
+int
+TAO_GIOP_Message_Generator_Parser_10::write_locate_request_header (
+ CORBA::ULong request_id,
+ TAO_Target_Specification &spec,
+ TAO_OutputCDR &msg)
+{
+ msg << request_id;
+
+ // In this case we cannot recognise anything other than the Object
+ // key as the address disposition variable. But we do a sanity check
+ // anyway.
+ const TAO::ObjectKey *key = spec.object_key ();
+
+ if (key)
+ {
+ // Everything is fine
+ msg << *key;
+ }
+ else
+ {
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("(%N | %l) Unable to handle this request \n")));
+ return 0;
+ }
+
+ return 1;
+}
+
+
+int
+TAO_GIOP_Message_Generator_Parser_10::write_reply_header (
+ TAO_OutputCDR &output,
+ TAO_Pluggable_Reply_Params_Base &reply
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ // Write the service context list.
+#if (TAO_HAS_MINIMUM_CORBA == 1)
+ output << reply.service_context_notowned ();
+ ACE_ENV_ARG_NOT_USED; // FUZZ: ignore check_for_ace_check
+#else
+ if (reply.is_dsi_ == 0)
+ {
+ output << reply.service_context_notowned ();
+ }
+ else
+ {
+ // If lazy evaluation is enabled then we are going to insert an
+ // extra node at the end of the service context list, just to
+ // force the appropriate padding.
+ // But first we take it out any of them..
+ CORBA::ULong count = 0;
+ IOP::ServiceContextList &svc_ctx =
+ reply.service_context_notowned ();
+ CORBA::ULong l = svc_ctx.length ();
+ CORBA::ULong i;
+
+ for (i = 0; i != l; ++i)
+ {
+ if (svc_ctx[i].context_id == TAO_SVC_CONTEXT_ALIGN)
+ {
+ continue;
+ }
+
+ count++;
+ }
+
+ // Now increment it to account for the last dummy one...
+ count++;
+
+ // Now marshal the rest of the service context objects
+ output << count;
+ for (i = 0; i != l; ++i)
+ {
+ if (svc_ctx[i].context_id == TAO_SVC_CONTEXT_ALIGN)
+ {
+ continue;
+ }
+
+ output << svc_ctx[i];
+ }
+
+ }
+
+ if (reply.is_dsi_ == 1)
+ {
+ // @@ Much of this code is GIOP 1.1 specific and should be
+ ptrdiff_t target = reply.dsi_nvlist_align_;
+
+ ptrdiff_t const current =
+ ptrdiff_t (output.current_alignment ()) % ACE_CDR::MAX_ALIGNMENT;
+
+ CORBA::ULong pad = 0;
+
+ if (target == 0)
+ {
+ // We want to generate adequate padding to start the request
+ // id on a 8 byte boundary, two cases:
+ // - If the dummy tag starts on a 4 byte boundary and the
+ // dummy sequence has 0 elements then we have:
+ // 4:tag 8:sequence_length 4:sequence_body 4:request_id
+ // 8:payload
+ // - If the dummy tag starts on an 8 byte boundary, with 4
+ // elements we get:
+ // 8:tag 4:sequence_length 8:sequence_body 4:request_id
+ // 8:payload
+ if (current != 0 && current <= ACE_CDR::LONG_ALIGN)
+ {
+ pad = 4;
+ }
+ }
+ else if (target != ACE_CDR::LONG_ALIGN)
+ {
+ // The situation reverses, we want to generate adequate
+ // padding to start the request id on a 4 byte boundary, two
+ // cases:
+ // - If the dummy tag starts on a 4 byte boundary and the
+ // dummy sequence has 4 elements then we have:
+ // 4:tag 8:sequence_length 4:sequence_body 8:request_id
+ // 4:payload
+ // - If the dummy tag starts on an 8 byte boundary, with 0
+ // elements we get:
+ // 8:tag 4:sequence_length 8:sequence_body 8:request_id
+ // 4:payload
+ if (current > ACE_CDR::LONG_ALIGN)
+ {
+ pad = 4;
+ }
+ }
+ else if (target == ACE_CDR::MAX_ALIGNMENT)
+ {
+ pad = 0;
+ }
+ else
+ {
+ // <target> can only have the values above
+ ACE_THROW_RETURN (CORBA::MARSHAL (),
+ 0);
+ }
+
+ output << CORBA::ULong (TAO_SVC_CONTEXT_ALIGN);
+ output << pad;
+
+ for (CORBA::ULong j = 0; j != pad; ++j)
+ {
+ output << ACE_OutputCDR::from_octet(0);
+ }
+ }
+#endif /* TAO_HAS_MINIMUM_CORBA */
+
+ // Write the request ID
+ output.write_ulong (reply.request_id_);
+
+ // Write the reply status
+ this->marshal_reply_status (output,
+ reply);
+
+ return 1;
+}
+
+
+int
+TAO_GIOP_Message_Generator_Parser_10::write_locate_reply_mesg (
+ TAO_OutputCDR &output,
+ CORBA::ULong request_id,
+ TAO_GIOP_Locate_Status_Msg &status_info
+ )
+{
+ // Make the header for the locate request
+ output.write_ulong (request_id);
+ output.write_ulong (status_info.status);
+
+ if (status_info.status == TAO_GIOP_OBJECT_FORWARD)
+ {
+ CORBA::Object_ptr object_ptr =
+ status_info.forward_location_var.in ();
+
+ if ((output << object_ptr) == 0)
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t|%N|%l) write_locate_reply_mesg-")
+ ACE_TEXT (" cannot marshal object reference\n")
+ ));
+ }
+ }
+ }
+
+ return 1;
+}
+
+bool
+TAO_GIOP_Message_Generator_Parser_10::write_fragment_header (
+ TAO_OutputCDR & /* cdr */,
+ CORBA::ULong /* request_id */)
+{
+ // GIOP fragments are not supported in GIOP 1.0.
+ return false;
+}
+
+
+int
+TAO_GIOP_Message_Generator_Parser_10::parse_request_header (
+ TAO_ServerRequest &request)
+{
+ // Tear out the service context ... we currently ignore it, but it
+ // should probably be passed to each ORB service as appropriate
+ // (e.g. transactions, security).
+ //
+ // NOTE: As security support kicks in, this is a good place to
+ // verify a digital signature, if that is required in this security
+ // environment. It may be required even when using IPSEC security
+ // infrastructure.
+
+ // Get the input CDR in the request class
+ TAO_InputCDR & input = *request.incoming ();
+
+ IOP::ServiceContextList &service_info =
+ request.request_service_info ();
+
+ input >> service_info;
+
+ CORBA::Boolean hdr_status =
+ (CORBA::Boolean) input.good_bit ();
+
+ CORBA::ULong req_id = 0;
+
+ // Get the rest of the request header ...
+ hdr_status = hdr_status && input.read_ulong (req_id);
+
+ request.request_id (req_id);
+
+ CORBA::Octet response_flags = CORBA::Octet();
+ hdr_status = hdr_status && input.read_octet (response_flags);
+ request.response_expected ((response_flags != 0));
+
+ // This is not supported now in GIOP 1.1
+ request.sync_with_server (0);
+
+ // We use ad-hoc demarshalling here: there is no need to increase
+ // the reference count on the CDR message block, because this key
+ // will not outlive the request (or the message block).
+
+ hdr_status =
+ hdr_status && request.profile ().unmarshall_object_key (input);
+
+ // According to the CORBA 2.6.1 (and older) specification, the operation
+ // name is an IDL Identifier. Identifiers must be composed of ASCII letters,
+ // numbers, and underscores, starting with a letter. Based on this, and
+ // the fact that I could find no text explicitly requiring operation name
+ // translation, nor could others in the CORBA community, the operation name
+ // will not be translated regardless of the translation of other strings.
+ //
+ CORBA::ULong length = 0;
+ hdr_status = hdr_status && input.read_ulong (length);
+
+ if (hdr_status)
+ {
+ // Do not include NULL character at the end.
+ // @@ This is not getting demarshaled using the codeset
+ // translators!
+
+ // Notice that there are no memory allocations involved
+ // here!
+ request.operation (input.rd_ptr (),
+ length - 1,
+ 0 /* TAO_ServerRequest does NOT own string */);
+ hdr_status = input.skip_bytes (length);
+ }
+
+ if (hdr_status)
+ {
+ /**** This has been deprecated in 2.4 ****/
+ /*CORBA::Principal_var principal;
+
+ input >> principal.out ();
+
+ request.requesting_principal (principal.in ()); */
+
+ CORBA::OctetSeq oct_seq;
+ input >> oct_seq;
+ request.requesting_principal (oct_seq);
+ hdr_status = (CORBA::Boolean) input.good_bit ();
+ }
+
+
+ return hdr_status ? 0 : -1;
+}
+
+
+
+int
+TAO_GIOP_Message_Generator_Parser_10::parse_locate_header (
+ TAO_GIOP_Locate_Request_Header &request
+ )
+{
+ // Get the stream
+ TAO_InputCDR &msg = request.incoming_stream ();
+
+ CORBA::Boolean hdr_status = true;
+
+ // Get the request id
+ CORBA::ULong req_id = 0;
+ hdr_status = msg.read_ulong (req_id);
+
+ // Store it in the Locate request classes
+ request.request_id (req_id);
+
+ // Get the object key
+ hdr_status =
+ hdr_status && request.profile ().unmarshall_object_key (msg);
+
+ return hdr_status ? 0 : -1;
+}
+
+
+
+int
+TAO_GIOP_Message_Generator_Parser_10::parse_reply (
+ TAO_InputCDR &cdr,
+ TAO_Pluggable_Reply_Params &params)
+
+{
+ // Read the service context list first
+ if ((cdr >> params.svc_ctx_) == 0)
+ {
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) parse_reply, ")
+ ACE_TEXT ("extracting context\n")));
+ return -1;
+ }
+
+ // Call the base class for further processing
+ if (TAO_GIOP_Message_Generator_Parser::parse_reply (cdr,
+ params) == -1)
+ return -1;
+
+ return 0;
+}
+
+
+int
+TAO_GIOP_Message_Generator_Parser_10::parse_locate_reply (
+ TAO_InputCDR &cdr,
+ TAO_Pluggable_Reply_Params &params
+ )
+{
+ if (TAO_GIOP_Message_Generator_Parser::parse_locate_reply (cdr,
+ params) == -1)
+
+ return -1;
+
+ return 0;
+}
+
+CORBA::Octet
+TAO_GIOP_Message_Generator_Parser_10::major_version (void)
+{
+ // Any harm in hardcoding??
+ return static_cast<CORBA::Octet> (1);
+}
+
+CORBA::Octet
+TAO_GIOP_Message_Generator_Parser_10::minor_version (void)
+{
+ // Any harm in hardcoding??
+ return 0;
+}
+
+size_t
+TAO_GIOP_Message_Generator_Parser_10::fragment_header_length (void) const
+{
+ return 0;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/GIOP_Message_Generator_Parser_10.h b/TAO/tao/GIOP_Message_Generator_Parser_10.h
new file mode 100644
index 00000000000..a8829c281ea
--- /dev/null
+++ b/TAO/tao/GIOP_Message_Generator_Parser_10.h
@@ -0,0 +1,102 @@
+// -*- C++ -*-
+
+// ===================================================================
+/**
+ * @file GIOP_Message_Generator_Parser_10.h
+ *
+ * $Id$
+ *
+ * @author Balachandran Natarajan <bala@cs.wustl.edu>
+ */
+// ===================================================================
+
+#ifndef TAO_GIOP_MESSAGE_GENERATOR_PARSER_10_H
+#define TAO_GIOP_MESSAGE_GENERATOR_PARSER_10_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/GIOP_Message_Generator_Parser.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_GIOP_Message_State;
+
+/**
+ * @class TAO_GIOP_Message_Generator_Parser_10
+ *
+ * @brief Implementation for GIOP v1.0
+ *
+ */
+
+class TAO_Export TAO_GIOP_Message_Generator_Parser_10:
+ public TAO_GIOP_Message_Generator_Parser
+{
+public:
+
+ /// Write the request header in to @a msg
+ virtual int write_request_header (
+ const TAO_Operation_Details &opdetails,
+ TAO_Target_Specification &spec,
+ TAO_OutputCDR &msg
+ );
+
+ /// Write the LocateRequest header
+ virtual int write_locate_request_header (
+ CORBA::ULong request_id,
+ TAO_Target_Specification &spec,
+ TAO_OutputCDR &msg
+ );
+
+ /// Write the reply header in to @a output
+ virtual int write_reply_header (
+ TAO_OutputCDR &output,
+ TAO_Pluggable_Reply_Params_Base &reply
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Writes the locate _reply message in to the @a output
+ virtual int write_locate_reply_mesg (
+ TAO_OutputCDR &output,
+ CORBA::ULong request_id,
+ TAO_GIOP_Locate_Status_Msg &status
+ );
+
+ virtual bool write_fragment_header (TAO_OutputCDR & cdr,
+ CORBA::ULong request_id);
+
+ /// Parse the Request Header from the incoming stream. This will do a
+ /// version specific parsing of the incoming Request header
+ virtual int parse_request_header (TAO_ServerRequest &);
+
+ /// Parse the LocateRequest Header from the incoming stream. This will do a
+ /// version specific parsing of the incoming Request header
+ virtual int parse_locate_header (
+ TAO_GIOP_Locate_Request_Header &
+ );
+
+ /// Parse the reply message from the server
+ virtual int parse_reply (TAO_InputCDR &input,
+ TAO_Pluggable_Reply_Params &params);
+
+ /// Parse the reply message from the server
+ virtual int parse_locate_reply (TAO_InputCDR &input,
+ TAO_Pluggable_Reply_Params &params);
+
+ /// Our versions
+ virtual CORBA::Octet major_version (void);
+ virtual CORBA::Octet minor_version (void);
+
+ /// The header length of a fragment
+ virtual size_t fragment_header_length (void) const;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /*TAO_GIOP_MESSAGE_GENERATOR_PARSER_10_H*/
diff --git a/TAO/tao/GIOP_Message_Generator_Parser_11.cpp b/TAO/tao/GIOP_Message_Generator_Parser_11.cpp
new file mode 100644
index 00000000000..88bdbe641af
--- /dev/null
+++ b/TAO/tao/GIOP_Message_Generator_Parser_11.cpp
@@ -0,0 +1,15 @@
+#include "tao/GIOP_Message_Generator_Parser_11.h"
+
+ACE_RCSID (tao,
+ GIOP_Message_Generator_Parser_11,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+CORBA::Octet
+TAO_GIOP_Message_Generator_Parser_11::minor_version (void)
+{
+ return static_cast<CORBA::Octet> (1);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/GIOP_Message_Generator_Parser_11.h b/TAO/tao/GIOP_Message_Generator_Parser_11.h
new file mode 100644
index 00000000000..cc88a7082ec
--- /dev/null
+++ b/TAO/tao/GIOP_Message_Generator_Parser_11.h
@@ -0,0 +1,49 @@
+// -*- C++ -*-
+
+// ===================================================================
+/**
+ * @file GIOP_Message_Generator_Parser_11.h
+ *
+ * $Id$
+ *
+ * @author Balachandran Natarajan <bala@cs.wustl.edu>
+ */
+// ===================================================================
+
+#ifndef TAO_GIOP_MESSAGE_GENERATOR_PARSER_11_H
+#define TAO_GIOP_MESSAGE_GENERATOR_PARSER_11_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/GIOP_Message_Generator_Parser_10.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_GIOP_Message_Generator_Parser_11
+ *
+ * @brief Implementation for GIOP v1.1
+ *
+ * This just derives from v1.0 class. It uses most of the methods in
+ * the 1.0 class.
+ *
+ */
+class TAO_Export TAO_GIOP_Message_Generator_Parser_11
+ : public TAO_GIOP_Message_Generator_Parser_10
+{
+public:
+
+ /// Our minor version
+ virtual CORBA::Octet minor_version (void);
+
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_GIOP_MESSAGE_GENERATOR_PARSER_11_H */
diff --git a/TAO/tao/GIOP_Message_Generator_Parser_12.cpp b/TAO/tao/GIOP_Message_Generator_Parser_12.cpp
new file mode 100644
index 00000000000..086081e78d6
--- /dev/null
+++ b/TAO/tao/GIOP_Message_Generator_Parser_12.cpp
@@ -0,0 +1,583 @@
+#include "tao/GIOP_Message_Generator_Parser_12.h"
+#include "tao/GIOPC.h"
+#include "tao/GIOP_Utils.h"
+#include "tao/GIOP_Message_Locate_Header.h"
+#include "tao/operation_details.h"
+#include "tao/debug.h"
+#include "tao/Pluggable_Messaging_Utils.h"
+#include "tao/GIOP_Message_State.h"
+#include "tao/TAO_Server_Request.h"
+#include "tao/TAOC.h"
+#include "tao/ORB_Core.h"
+#include "tao/Transport.h"
+#include "tao/CDR.h"
+
+ACE_RCSID (tao,
+ GIOP_Message_Gen_Parser_12,
+ "$Id$")
+
+// This is used by GIOP1.2. This is to align the message body on a
+// 8-octet boundary. This is declared static so that it is in file
+// scope.
+static const size_t TAO_GIOP_MESSAGE_ALIGN_PTR = 8;
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+int
+TAO_GIOP_Message_Generator_Parser_12::write_request_header (
+ const TAO_Operation_Details &opdetails,
+ TAO_Target_Specification &spec,
+ TAO_OutputCDR &msg
+ )
+{
+ // First the request id
+ msg << opdetails.request_id ();
+
+ const CORBA::Octet response_flags = opdetails.response_flags ();
+
+
+ // Here are the Octet values for different policies
+ // '00000000' for SYNC_NONE
+ // '00000000' for SYNC_WITH_TRANSPORT
+ // '00000010' for SYNC_WITH_SERVER
+ // '00000011' for SYNC_WITH_TARGET
+ // '00000011' for regular two ways, but if they are invoked via a
+ // DII with INV_NO_RESPONSE flag set then we need to send '00000001'
+ //
+ // We have not implemented the policy INV_NO_RESPONSE for DII.
+ if (response_flags == TAO_TWOWAY_RESPONSE_FLAG)
+ msg << ACE_OutputCDR::from_octet (3);
+ // Second the response flags
+ // Sync scope - ignored by server if request is not oneway.
+ else if (response_flags == CORBA::Octet (Messaging::SYNC_NONE)
+ || response_flags == CORBA::Octet (Messaging::SYNC_WITH_TRANSPORT)
+ || response_flags == CORBA::Octet (TAO::SYNC_EAGER_BUFFERING)
+ || response_flags == CORBA::Octet (TAO::SYNC_DELAYED_BUFFERING))
+ // No response required.
+ msg << ACE_OutputCDR::from_octet (0);
+
+ else if (response_flags == CORBA::Octet (Messaging::SYNC_WITH_SERVER))
+ // Return before dispatching to the servant
+ msg << ACE_OutputCDR::from_octet (1);
+
+ else if (response_flags == CORBA::Octet (Messaging::SYNC_WITH_TARGET))
+ // Return after dispatching servant.
+ msg << ACE_OutputCDR::from_octet (3);
+ else
+ // Until more flags are defined by the OMG.
+ return 0;
+
+ // The reserved field
+ CORBA::Octet reserved[3] = {0, 0, 0};
+
+ msg.write_octet_array (reserved, 3);
+
+ if (this->marshall_target_spec (spec,
+ msg) == 0)
+ return 0;
+
+ // Write the operation name
+ msg.write_string (opdetails.opname_len (),
+ opdetails.opname ());
+
+ // Write the service context list
+ msg << opdetails.request_service_info ();
+
+ // We align the pointer only if the operation has arguments.
+ if (opdetails.argument_flag ()
+ && msg.align_write_ptr (TAO_GIOP_MESSAGE_ALIGN_PTR) == -1)
+ {
+ return 0;
+ }
+
+ return 1;
+}
+
+
+int
+TAO_GIOP_Message_Generator_Parser_12::write_locate_request_header (
+ CORBA::ULong request_id,
+ TAO_Target_Specification &spec,
+ TAO_OutputCDR &msg
+ )
+{
+ // Write the request id
+ msg << request_id;
+
+ // Write the target address
+ if (this->marshall_target_spec (spec,
+ msg) == 0)
+ return 0;
+
+ // I dont think we need to align the pointer to an 8 byte boundary
+ // here.
+ // We need to align the pointer
+ // if (msg.align_write_ptr (TAO_GIOP_MESSAGE_ALIGN_PTR) == -1)
+ // return 0;
+
+ // Return success
+ return 1;
+}
+
+int
+TAO_GIOP_Message_Generator_Parser_12::write_reply_header (
+ TAO_OutputCDR & output,
+ TAO_Pluggable_Reply_Params_Base &reply
+ ACE_ENV_ARG_DECL_NOT_USED /* ACE_ENV_SINGLE_ARG_PARAMETER */
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ // Write the request ID
+ output.write_ulong (reply.request_id_);
+
+ // Write the reply status
+ if (reply.reply_status_ ==
+ TAO_PLUGGABLE_MESSAGE_LOCATION_FORWARD_PERM)
+ {
+ // Not sure when we will use this.
+ output.write_ulong (TAO_GIOP_LOCATION_FORWARD_PERM);
+ }
+ else if (reply.reply_status_ ==
+ TAO_PLUGGABLE_MESSAGE_NEEDS_ADDRESSING_MODE)
+ {
+ // Not sure when we will use this.
+ output.write_ulong (TAO_GIOP_LOC_NEEDS_ADDRESSING_MODE);
+ }
+ else
+ {
+ this->marshal_reply_status (output,
+ reply);
+ }
+
+#if (TAO_HAS_MINIMUM_CORBA == 1)
+ output << reply.service_context_notowned ();
+#else
+ if (reply.is_dsi_ == 0)
+ {
+ output << reply.service_context_notowned ();
+ }
+ else
+ {
+ IOP::ServiceContextList &svc_ctx =
+ reply.service_context_notowned ();
+ CORBA::ULong l = svc_ctx.length ();
+
+ // Now marshal the rest of the service context objects
+ output << l;
+
+ for (CORBA::ULong i = 0; i != l; ++i)
+ {
+ output << svc_ctx[i];
+ }
+
+ }
+#endif /*TAO_HAS_MINIMUM_CORBA */
+
+ if (reply.argument_flag_)
+ {
+ // If we have some data to be marshalled, then we align the
+ // pointer to a 8 byte boundary. Else, we just leave it throu
+ if (output.align_write_ptr (TAO_GIOP_MESSAGE_ALIGN_PTR) == -1)
+ {
+ return 0;
+ }
+ }
+ return 1;
+}
+
+
+int
+TAO_GIOP_Message_Generator_Parser_12::write_locate_reply_mesg (
+ TAO_OutputCDR & output,
+ CORBA::ULong request_id,
+ TAO_GIOP_Locate_Status_Msg &status_info
+ )
+{
+ output.write_ulong (request_id);
+
+ // Make the header for the locate request
+ output.write_ulong (status_info.status);
+
+ // Note: We dont align the pointer to an 8 byte boundary for a
+ // locate reply body. This is due to an urgent issue raised by Michi
+ // in the OMG. I discussed this with Michi today (09/07/2001) and I
+ // learn that this has been passed. Hence the change..
+ /*
+ if (status_info.status == TAO_GIOP_OBJECT_FORWARD ||
+ status_info.status == TAO_GIOP_OBJECT_FORWARD_PERM)
+ {
+ // We have to send some data, so align the pointer
+ if (output.align_write_ptr (TAO_GIOP_MESSAGE_ALIGN_PTR) == -1)
+ {
+ return 0;
+ }
+ }
+ */
+ switch (status_info.status)
+ {
+ case TAO_GIOP_OBJECT_FORWARD:
+
+ // More likely than not we will not have this in TAO
+ case TAO_GIOP_OBJECT_FORWARD_PERM:
+ {
+ CORBA::Object_ptr object_ptr =
+ status_info.forward_location_var.in ();
+
+ if ((output << object_ptr) == 0)
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t|%N|%l) write_locate_reply_mesg-")
+ ACE_TEXT (" cannot marshal object reference\n")
+ ));
+ }
+ }
+ }
+ break;
+ case TAO_GIOP_LOC_SYSTEM_EXCEPTION:
+ case TAO_GIOP_LOC_NEEDS_ADDRESSING_MODE:
+ // Do we do these in TAO??
+ // What to do here???? I dont really know. I have to do a survey
+ // of the specifications that uses this.
+ break;
+ default:
+ break;
+ }
+
+ return 1;
+}
+
+bool
+TAO_GIOP_Message_Generator_Parser_12::write_fragment_header (
+ TAO_OutputCDR & cdr,
+ CORBA::ULong request_id)
+{
+ return (cdr << request_id);
+
+ // No need to align write pointer to an 8 byte boundary since it
+ // should already be aligned (12 for GIOP messager + 4 for fragment
+ // header = 16 -- a multiple of 8)
+}
+
+int
+TAO_GIOP_Message_Generator_Parser_12::parse_request_header (
+ TAO_ServerRequest &request
+ )
+{
+ // Get the input CDR in the request class
+ TAO_InputCDR & input = *request.incoming ();
+
+ CORBA::Boolean hdr_status = (CORBA::Boolean) input.good_bit ();
+
+ CORBA::ULong req_id = 0;
+ // Get the rest of the request header ...
+ hdr_status = hdr_status && input.read_ulong (req_id);
+
+ request.request_id (req_id);
+
+ CORBA::Octet response_flags = CORBA::Octet();
+ hdr_status = hdr_status && input.read_octet (response_flags);
+
+ request.response_expected ((response_flags > 0));
+
+ // The high bit of the octet has been set if the SyncScope policy
+ // value is SYNC_WITH_SERVER.
+ request.sync_with_server ((response_flags == 1));
+
+ // Reserved field
+ input.skip_bytes (3);
+
+ // Unmarshal the target address field.
+ hdr_status =
+ hdr_status && request.profile ().unmarshall_target_address(input);
+
+ CORBA::ULong length = 0;
+ hdr_status = hdr_status && input.read_ulong (length);
+
+ if (hdr_status)
+ {
+ // Do not include NULL character at the end.
+ // @@ This is not getting demarshaled using the codeset
+ // translators!
+
+ // Notice that there are no memory allocations involved
+ // here!
+
+ request.operation (input.rd_ptr (),
+ length - 1,
+ 0 /* TAO_ServerRequest does NOT own string */);
+ hdr_status = input.skip_bytes (length);
+ }
+
+ // Tear out the service context ... we currently ignore it, but it
+ // should probably be passed to each ORB service as appropriate
+ // (e.g. transactions, security).
+ //
+ // NOTE: As security support kicks in, this is a good place to
+ // verify a digital signature, if that is required in this security
+ // environment. It may be required even when using IPSEC security
+ // infrastructure.
+ IOP::ServiceContextList &req_service_info =
+ request.request_service_info ();
+
+ input >> req_service_info;
+
+ // Check an process if BiDir contexts are available
+ if (request.orb_core ()->bidir_giop_policy ())
+ this->check_bidirectional_context (request);
+
+ if (input.length () > 0)
+ {
+ // Reset the read_ptr to an 8-byte boundary.
+ input.align_read_ptr (TAO_GIOP_MESSAGE_ALIGN_PTR);
+ }
+
+ return hdr_status ? 0 : -1;
+}
+
+
+int
+TAO_GIOP_Message_Generator_Parser_12::parse_locate_header (
+ TAO_GIOP_Locate_Request_Header &request
+ )
+{
+ // Get the stream .
+ TAO_InputCDR &msg = request.incoming_stream ();
+
+ CORBA::Boolean hdr_status = 1;
+
+ // Get the request id.
+ CORBA::ULong req_id = 0;
+ hdr_status = msg.read_ulong (req_id);
+
+ // Store it in the Locate request classes
+ request.request_id (req_id);
+
+ // Unmarshal the target address field.
+ hdr_status =
+ hdr_status && request.profile ().unmarshall_target_address(msg);
+
+ // Reset the pointer to an 8-byte bouns]dary
+ msg.align_read_ptr (TAO_GIOP_MESSAGE_ALIGN_PTR);
+
+ return hdr_status ? 0 : -1;
+}
+
+int
+TAO_GIOP_Message_Generator_Parser_12::parse_reply (
+ TAO_InputCDR &cdr,
+ TAO_Pluggable_Reply_Params &params
+ )
+{
+ if (TAO_GIOP_Message_Generator_Parser::parse_reply (cdr,
+ params) == -1)
+
+ return -1;
+
+ if ((cdr >> params.svc_ctx_) == 0)
+ {
+ // if (TAO_debug_level > 0)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) parse_reply, ")
+ ACE_TEXT ("extracting context\n")));
+
+ return -1;
+ }
+
+ if (cdr.length () > 0)
+ {
+ // Align the read pointer on an 8-byte boundary
+ cdr.align_read_ptr (TAO_GIOP_MESSAGE_ALIGN_PTR);
+ }
+
+ return 0;
+}
+
+int
+TAO_GIOP_Message_Generator_Parser_12::parse_locate_reply (
+ TAO_InputCDR &cdr,
+ TAO_Pluggable_Reply_Params &params
+ )
+{
+ if (TAO_GIOP_Message_Generator_Parser::parse_locate_reply (cdr,
+ params) == -1)
+
+ return -1;
+
+ // Note: We dont align the pointer to an 8 byte boundary for a
+ // locate reply body. This is due to an urgent issue raised by Michi
+ // in the OMG. I discussed this with Michi today (09/07/2001) and I
+ // learn that this has been passed. Hence the change..
+ /*if (cdr.length () > 0)
+ {
+ // Align the read pointer on an 8-byte boundary
+ cdr.align_read_ptr (TAO_GIOP_MESSAGE_ALIGN_PTR);
+ }*/
+
+ return 0;
+}
+
+
+CORBA::Octet
+TAO_GIOP_Message_Generator_Parser_12::major_version (void)
+{
+ return (CORBA::Octet) 1;
+}
+
+
+CORBA::Octet
+TAO_GIOP_Message_Generator_Parser_12::minor_version (void)
+{
+ return (CORBA::Octet) 2;
+}
+
+int
+TAO_GIOP_Message_Generator_Parser_12::is_ready_for_bidirectional (void)
+{
+ // We do support bidirectional
+ return 1;
+}
+
+
+
+int
+TAO_GIOP_Message_Generator_Parser_12::marshall_target_spec (
+ TAO_Target_Specification &spec,
+ TAO_OutputCDR &msg
+ )
+{
+ switch (spec.specifier ())
+ {
+ case TAO_Target_Specification::Key_Addr:
+ {
+ // As this is a union send in the discriminant first
+ msg << GIOP::KeyAddr;
+
+ // Get the object key
+ const TAO::ObjectKey *key = spec.object_key ();
+
+ if (key)
+ {
+ // Marshall in the object key
+ msg << *key;
+ }
+ else
+ {
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("(%N |%l) Unable to handle this request \n")));
+ return 0;
+ }
+ break;
+ }
+ case TAO_Target_Specification::Profile_Addr:
+ {
+ // As this is a union send in the discriminant first
+ msg << GIOP::ProfileAddr;
+
+ // Get the profile
+ const IOP::TaggedProfile *pfile = spec.profile ();
+
+ if (pfile)
+ {
+ // Marshall in the object key
+ msg << *pfile;
+ }
+ else
+ {
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("(%N |%l) Unable to handle this request \n")));
+ return 0;
+ }
+ break;
+ }
+ case TAO_Target_Specification::Reference_Addr:
+ {
+ // As this is a union send in the discriminant first
+ msg << GIOP::ReferenceAddr;
+
+ // Get the IOR
+ IOP::IOR *ior;
+ CORBA::ULong index = spec.iop_ior (ior);
+
+ if (ior)
+ {
+ // This is a struct IORAddressingInfo. So, marshall each
+ // member of the struct one after another in the order
+ // defined.
+ msg << index;
+ msg << *ior;
+ }
+ else
+ {
+ if (TAO_debug_level)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("(%N |%l) Unable to handle this request \n")));
+ }
+ return 0;
+ }
+ break;
+ }
+ default:
+ if (TAO_debug_level)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("(%N |%l) Unable to handle this request \n")));
+ }
+ return 0;
+ }
+
+ return 1;
+}
+
+
+int
+TAO_GIOP_Message_Generator_Parser_12::check_bidirectional_context (
+ TAO_ServerRequest &request)
+{
+ TAO_Service_Context &service_context = request.request_service_context ();
+
+ // Check whether we have the BiDir service context info available in
+ // the ServiceContextList
+ if (service_context.is_service_id (IOP::BI_DIR_IIOP)
+ == 1)
+ {
+ return this->process_bidir_context (service_context,
+ request.transport ());
+ }
+
+ return 0;
+}
+
+int
+TAO_GIOP_Message_Generator_Parser_12::process_bidir_context (
+ TAO_Service_Context &service_context,
+ TAO_Transport *transport)
+{
+ // Get the context info
+ IOP::ServiceContext context;
+ context.context_id = IOP::BI_DIR_IIOP;
+
+ if (service_context.get_context (context) != 1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) Context info not found \n")),
+ -1);
+
+ TAO_InputCDR cdr (reinterpret_cast<const char*> (
+ context.context_data.get_buffer ()),
+ context.context_data.length ());
+
+ return transport->tear_listen_point_list (cdr);
+}
+
+size_t
+TAO_GIOP_Message_Generator_Parser_12::fragment_header_length (void) const
+{
+ return TAO_GIOP_MESSAGE_FRAGMENT_HEADER;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/GIOP_Message_Generator_Parser_12.h b/TAO/tao/GIOP_Message_Generator_Parser_12.h
new file mode 100644
index 00000000000..6fd84af43a6
--- /dev/null
+++ b/TAO/tao/GIOP_Message_Generator_Parser_12.h
@@ -0,0 +1,128 @@
+// -*- C++ -*-
+
+// ===================================================================
+/**
+ * @file GIOP_Message_Generator_Parser_12.h
+ *
+ * $Id$
+ *
+ * @author Balachandran Natarajan <bala@cs.wustl.edu>
+ */
+// ===================================================================
+
+#ifndef TAO_GIOP_MESSAGE_GENERATOR_PARSER_12_H
+#define TAO_GIOP_MESSAGE_GENERATOR_PARSER_12_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/GIOP_Message_Generator_Parser.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_GIOP_Message_State;
+class TAO_Service_Context;
+class TAO_Transport;
+
+/**
+ * @class TAO_GIOP_Message_Generator_Parser_12
+ *
+ * @brief Implementation for GIOP v1.2
+ *
+ */
+
+class TAO_Export TAO_GIOP_Message_Generator_Parser_12:
+ public TAO_GIOP_Message_Generator_Parser
+{
+public:
+
+ /// Write the request header in to @a msg
+ virtual int write_request_header (
+ const TAO_Operation_Details &opdetails,
+ TAO_Target_Specification &spec,
+ TAO_OutputCDR &msg
+ );
+
+ /// Write the LocateRequest header
+ virtual int write_locate_request_header (
+ CORBA::ULong request_id,
+ TAO_Target_Specification &spec,
+ TAO_OutputCDR &msg
+ );
+
+ /// Write the reply header in to @a output
+ virtual int write_reply_header (
+ TAO_OutputCDR &output,
+ TAO_Pluggable_Reply_Params_Base &reply
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Writes the locate _reply message in to the @a output
+ virtual int write_locate_reply_mesg (
+ TAO_OutputCDR &output,
+ CORBA::ULong request_id,
+ TAO_GIOP_Locate_Status_Msg &status
+ );
+
+ virtual bool write_fragment_header (TAO_OutputCDR & cdr,
+ CORBA::ULong request_id);
+
+ /// Parse the Request Header from the incoming stream. This will do a
+ /// version specific parsing of the incoming Request header
+ virtual int parse_request_header (TAO_ServerRequest &);
+
+ /// Parse the LocateRequest Header from the incoming stream. This will do a
+ /// version specific parsing of the incoming Request header
+ virtual int parse_locate_header (
+ TAO_GIOP_Locate_Request_Header &
+ );
+
+ /// Parse the reply message
+ virtual int parse_reply (TAO_InputCDR &input,
+ TAO_Pluggable_Reply_Params &params);
+
+ /// Parse the locate reply message
+ virtual int parse_locate_reply (TAO_InputCDR &input,
+ TAO_Pluggable_Reply_Params &params);
+
+ /// Our versions
+ virtual CORBA::Octet major_version (void);
+ virtual CORBA::Octet minor_version (void);
+
+ /// Is the messaging object ready for processing BiDirectional
+ /// request/response?
+ virtual int is_ready_for_bidirectional (void);
+
+ /// The header length of a fragment
+ virtual size_t fragment_header_length (void) const;
+
+private:
+
+ /// Marshall the TargetSpecification
+
+ /// This method may be required for other GIOP versiona coming out
+ /// later than 1.2. We need to share this method
+ int marshall_target_spec (TAO_Target_Specification &spec,
+ TAO_OutputCDR &msg);
+
+ /// Check whether we have BiDirContext info available. If available
+ /// delegate the responsibility on to the TAO_Transport classes to
+ /// initiate action.
+ /// @note At somepoint this may be needed for future versions of
+ /// GIOP and we may have to share this
+ int check_bidirectional_context (TAO_ServerRequest &);
+
+ /// Process the BiDirContext info that we have received.
+ int process_bidir_context (TAO_Service_Context &,
+ TAO_Transport *transport);
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_GIOP_MESSAGE_GENERATOR_PARSER_12_H */
diff --git a/TAO/tao/GIOP_Message_Generator_Parser_Impl.cpp b/TAO/tao/GIOP_Message_Generator_Parser_Impl.cpp
new file mode 100644
index 00000000000..37842a51970
--- /dev/null
+++ b/TAO/tao/GIOP_Message_Generator_Parser_Impl.cpp
@@ -0,0 +1,9 @@
+#include "tao/GIOP_Message_Generator_Parser_Impl.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/GIOP_Message_Generator_Parser_Impl.inl"
+#endif /* __ACE_INLINE__ */
+
+ACE_RCSID (tao,
+ GIOP_Message_Generator_Parser_Impl,
+ "$Id$")
diff --git a/TAO/tao/GIOP_Message_Generator_Parser_Impl.h b/TAO/tao/GIOP_Message_Generator_Parser_Impl.h
new file mode 100644
index 00000000000..9dad728f19b
--- /dev/null
+++ b/TAO/tao/GIOP_Message_Generator_Parser_Impl.h
@@ -0,0 +1,67 @@
+// -*- C++ -*-
+
+// ===================================================================
+/**
+ * @file GIOP_Message_Generator_Parser_Impl.h
+ *
+ * $Id$
+ *
+ * @author Balachandran Natarajan <bala@cs.wustl.edu>
+ */
+// ===================================================================
+
+#ifndef TAO_GIOP_MESSAGE_GENERATOR_PARSER_IMPL_H
+#define TAO_GIOP_MESSAGE_GENERATOR_PARSER_IMPL_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/GIOP_Message_Generator_Parser_11.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/GIOP_Message_Generator_Parser_12.h"
+#include "tao/orbconf.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_GIOP_Message_Generator_Parser_Impl
+ *
+ * @brief This class holds all the different GIOP message generators
+ * and parsers.
+ *
+ * This class can be done away with if we want to use the svc.conf
+ * file to load the right GIOP protocol. But that would require some
+ * work as we need to make sure that we have the behaviours of lower
+ * versions in the higher versions.
+ */
+
+class TAO_Export TAO_GIOP_Message_Generator_Parser_Impl
+{
+public:
+
+ /// Performs a check of the revision numbers
+ static CORBA::Boolean check_revision (CORBA::Octet incoming_major,
+ CORBA::Octet incoming_minor);
+
+ /// Version 1.0 of GIOP
+ TAO_GIOP_Message_Generator_Parser_10 tao_giop_10;
+
+ /// Version 1.1 of GIOP
+ TAO_GIOP_Message_Generator_Parser_11 tao_giop_11;
+
+ /// Version 1.2 of GIOP
+ TAO_GIOP_Message_Generator_Parser_12 tao_giop_12;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+
+#if defined (__ACE_INLINE__)
+# include "tao/GIOP_Message_Generator_Parser_Impl.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+#endif /*TAO_GIOP_MESSAGE_GENERATOR_PARSER_IMPL_H*/
diff --git a/TAO/tao/GIOP_Message_Generator_Parser_Impl.inl b/TAO/tao/GIOP_Message_Generator_Parser_Impl.inl
new file mode 100644
index 00000000000..5415e22f081
--- /dev/null
+++ b/TAO/tao/GIOP_Message_Generator_Parser_Impl.inl
@@ -0,0 +1,35 @@
+// -*- C++ -*-
+//
+//$Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE CORBA::Boolean
+TAO_GIOP_Message_Generator_Parser_Impl::check_revision (
+ CORBA::Octet incoming_major,
+ CORBA::Octet incoming_minor)
+{
+ CORBA::UShort const version_as_whole_num =
+ incoming_major << 8 | incoming_minor;
+
+ CORBA::UShort const max_allowable_version =
+ TAO_DEF_GIOP_MAJOR << 8 | TAO_DEF_GIOP_MINOR;
+
+ // If it's greater than the max, we know it's not allowed.
+ if (version_as_whole_num > max_allowable_version)
+ return 0;
+
+ // If it's less than the max, though, we still have to check for
+ // each explicit version and only allow the ones we know work.
+ switch (version_as_whole_num)
+ {
+ case 0x0100:
+ case 0x0101:
+ case 0x0102:
+ return 1;
+ }
+
+ return 0;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/GIOP_Message_Lite.cpp b/TAO/tao/GIOP_Message_Lite.cpp
new file mode 100644
index 00000000000..f980ee907af
--- /dev/null
+++ b/TAO/tao/GIOP_Message_Lite.cpp
@@ -0,0 +1,1769 @@
+//$Id$
+
+#include "tao/GIOP_Message_Lite.h"
+#include "tao/debug.h"
+#include "tao/TAOC.h"
+#include "tao/ORB_Core.h"
+#include "tao/operation_details.h"
+#include "tao/TAO_Server_Request.h"
+#include "tao/GIOP_Message_Locate_Header.h"
+#include "tao/LF_Strategy.h"
+#include "tao/Transport.h"
+#include "tao/Transport_Mux_Strategy.h"
+#include "tao/Codeset_Manager.h"
+#include "tao/SystemException.h"
+
+ACE_RCSID (tao,
+ GIOP_Message_Lite,
+ "$Id$")
+
+
+static const size_t TAO_GIOP_LITE_HEADER_LEN = 5;
+static const size_t TAO_GIOP_LITE_MESSAGE_SIZE_OFFSET = 0;
+static const size_t TAO_GIOP_LITE_MESSAGE_TYPE_OFFSET = 4;
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_GIOP_Message_Lite::TAO_GIOP_Message_Lite (TAO_ORB_Core *orb_core,
+ size_t /*input_cdr_size*/)
+ : orb_core_ (orb_core),
+ message_type_ (0),
+ message_size_ (0),
+ byte_order_ (TAO_ENCAP_BYTE_ORDER)
+{
+}
+
+
+TAO_GIOP_Message_Lite::~TAO_GIOP_Message_Lite (void)
+{
+}
+
+
+void
+TAO_GIOP_Message_Lite::init (CORBA::Octet,
+ CORBA::Octet)
+{
+ return;
+}
+
+TAO_OutputCDR &
+TAO_GIOP_Message_Lite::out_stream (void)
+{
+ return this->cdr_;
+}
+
+void
+TAO_GIOP_Message_Lite::reset (void)
+{
+ this->message_type_ = 0;
+ this->message_size_ = 0;
+}
+
+
+int
+TAO_GIOP_Message_Lite::generate_request_header (
+ TAO_Operation_Details &op,
+ TAO_Target_Specification &spec,
+ TAO_OutputCDR &cdr
+ )
+{
+ // Write the GIOPLite header first
+ if (!this->write_protocol_header (TAO_GIOP_REQUEST,
+ cdr))
+ {
+ if (TAO_debug_level)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) Error in writing GIOP header \n")));
+
+
+ return -1;
+ }
+
+ // Now call the implementation for the rest of the header
+ if (!this->write_request_header (op,
+ spec,
+ cdr))
+ {
+ if (TAO_debug_level)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) Error in writing request header \n")));
+
+ return -1;
+ }
+
+ return 0;
+
+}
+
+
+int
+TAO_GIOP_Message_Lite::generate_locate_request_header (
+ TAO_Operation_Details &op,
+ TAO_Target_Specification &spec,
+ TAO_OutputCDR &cdr
+ )
+{
+ // Write the GIOPLite header first
+ if (!this->write_protocol_header (TAO_GIOP_LOCATEREQUEST,
+ cdr))
+ {
+ if (TAO_debug_level)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) Error in writing GIOPLite header \n")));
+ }
+
+ return -1;
+ }
+
+ // Now call the implementation for the rest of the header
+ if (!this->write_locate_request_header (op.request_id (),
+ spec,
+ cdr))
+ {
+ if (TAO_debug_level)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) Error in writing locate request header \n")));
+
+ return -1;
+ }
+
+ return 0;
+}
+
+
+int
+TAO_GIOP_Message_Lite::generate_reply_header (
+ TAO_OutputCDR &cdr,
+ TAO_Pluggable_Reply_Params_Base &params
+ )
+{
+ // Write the GIOPLite header first
+ if (!this->write_protocol_header (TAO_GIOP_REPLY,
+ cdr))
+ {
+ if (TAO_debug_level)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) Error in writing GIOPLite header \n")));
+ }
+
+ return -1;
+ }
+
+ // Now call the implementation for the rest of the header
+ if (!this->write_reply_header (cdr,
+ params))
+ {
+ if (TAO_debug_level > 4)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) Error in writing reply header \n")));
+
+ return -1;
+ }
+
+ return 0;
+}
+
+int
+TAO_GIOP_Message_Lite::generate_fragment_header (TAO_OutputCDR & /* cdr */,
+ CORBA::ULong /* request_id */)
+{
+ // GIOP fragmentation is not supported in GIOP lite.
+ return 0;
+}
+
+int
+TAO_GIOP_Message_Lite::format_message (TAO_OutputCDR &stream)
+{
+ // Get the header length
+ const size_t header_len = TAO_GIOP_LITE_HEADER_LEN;
+
+ // Get the message size offset
+ const size_t offset = TAO_GIOP_LITE_MESSAGE_SIZE_OFFSET;
+
+ // Ptr to first buffer.
+ char *buf = (char *) stream.buffer ();
+
+ // Length of all buffers.
+ size_t total_len =
+ stream.total_length ();
+
+ // NOTE: Here would also be a fine place to calculate a digital
+ // signature for the message and place it into a preallocated slot
+ // in the "ServiceContext". Similarly, this is a good spot to
+ // encrypt messages (or just the message bodies) if that's needed in
+ // this particular environment and that isn't handled by the
+ // networking infrastructure (e.g., IPSEC).
+
+ CORBA::ULong bodylen = static_cast <CORBA::ULong> (total_len - header_len);
+
+#if !defined (ACE_ENABLE_SWAP_ON_WRITE)
+ *(reinterpret_cast <CORBA::ULong *> (buf + offset)) = bodylen;
+#else
+ if (!stream.do_byte_swap ())
+ *(reinterpret_cast <CORBA::ULong *>
+ (buf + offset)) = bodylen;
+ else
+ ACE_CDR::swap_4 (reinterpret_cast <char *> (&bodylen),
+ buf + offset);
+#endif /* ACE_ENABLE_SWAP_ON_WRITE */
+
+ // Strictly speaking, should not need to loop here because the
+ // socket never gets set to a nonblocking mode ... some Linux
+ // versions seem to need it though. Leaving it costs little.
+ if (TAO_debug_level > 2)
+ {
+ // Check whether the output cdr stream is build up of multiple
+ // messageblocks. If so, consolidate them to one block that can be
+ // dumped
+ ACE_Message_Block* consolidated_block = 0;
+ if (stream.begin()->cont() != 0)
+ {
+ ACE_NEW_RETURN (consolidated_block,
+ ACE_Message_Block,
+ 0);
+ ACE_CDR::consolidate(consolidated_block, stream.begin());
+ buf = (char *) (consolidated_block->rd_ptr ());
+ }
+ ///
+
+ this->dump_msg ("send",
+ reinterpret_cast <u_char *> (buf),
+ stream.length ());
+
+ //
+ delete consolidated_block;
+ consolidated_block = 0;
+ //
+ }
+
+ return 0;
+}
+
+
+int
+TAO_GIOP_Message_Lite::parse_incoming_messages (ACE_Message_Block &block)
+{
+ this->reset ();
+
+ // Make sure we have enough bytes in the header to read all
+ // of the information.
+ if (block.length () < TAO_GIOP_LITE_HEADER_LEN)
+ {
+ return 1;
+ }
+
+ // Get the read pointer
+ char *rd_ptr = block.rd_ptr ();
+
+ // We don't need to do this sort of copy. But some compilers (read it
+ // as SunCC) have a problem in deferencing from the
+ // reinterpret_cast pointer of the <rd_ptr>, as the <rd_ptr> can be
+ // on stack. So let us go ahead with this copying...
+ char buf [4];
+ buf[0] = *rd_ptr;
+ buf[1] = *(rd_ptr + 1);
+ buf[2] = *(rd_ptr + 2);
+ buf[3] = *(rd_ptr + 3);
+
+ CORBA::ULong x = 0;
+#if !defined (ACE_DISABLE_SWAP_ON_READ)
+ if (!(this->byte_order_ != TAO_ENCAP_BYTE_ORDER))
+ {
+ x = *(reinterpret_cast <ACE_CDR::ULong*> (buf));
+ }
+ else
+ {
+ ACE_CDR::swap_4 (buf, reinterpret_cast <char*> (&x));
+ }
+#else
+ x = *(reinterpret_cast <ACE_CDR::ULong*> (buf));
+#endif /* ACE_DISABLE_SWAP_ON_READ */
+
+ this->message_size_ = x;
+
+ // Get the message type.
+ this->message_type_ = rd_ptr[TAO_GIOP_LITE_MESSAGE_TYPE_OFFSET];
+
+ return 0;
+}
+
+TAO_Pluggable_Message_Type
+TAO_GIOP_Message_Lite::message_type (void) const
+{
+ switch (this->message_type_)
+ {
+ case TAO_GIOP_REQUEST:
+ return TAO_PLUGGABLE_MESSAGE_REQUEST;
+ case TAO_GIOP_LOCATEREQUEST:
+ return TAO_PLUGGABLE_MESSAGE_LOCATEREQUEST;
+
+ case TAO_GIOP_LOCATEREPLY:
+ return TAO_PLUGGABLE_MESSAGE_LOCATEREPLY;
+ case TAO_GIOP_REPLY:
+ return TAO_PLUGGABLE_MESSAGE_REPLY;
+
+ case TAO_GIOP_CLOSECONNECTION:
+ return TAO_PLUGGABLE_MESSAGE_CLOSECONNECTION;
+
+ case TAO_GIOP_CANCELREQUEST:
+ return TAO_PLUGGABLE_MESSAGE_CANCELREQUEST;
+
+ case TAO_GIOP_MESSAGERROR:
+ case TAO_GIOP_FRAGMENT:
+ // Never happens: why??
+ default:
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) %N:%l message_type : ")
+ ACE_TEXT ("wrong message.\n")));
+ }
+
+ // In case of some errors
+ return TAO_PLUGGABLE_MESSAGE_MESSAGERROR;
+}
+
+int
+TAO_GIOP_Message_Lite::parse_next_message (ACE_Message_Block &incoming,
+ TAO_Queued_Data &qd,
+ size_t &mesg_length)
+{
+ if (incoming.length () < TAO_GIOP_LITE_HEADER_LEN)
+ {
+ qd.missing_data_ = TAO_MISSING_DATA_UNDEFINED;
+
+ return 0; /* incomplete header */
+ }
+ else
+ {
+ if (this->parse_incoming_messages (incoming) == -1)
+ {
+ return -1;
+ }
+
+ const size_t total_len =
+ this->message_size_ + TAO_GIOP_LITE_HEADER_LEN;
+
+ if (total_len > incoming.length ())
+ {
+ qd.missing_data_ = total_len - incoming.length ();
+ }
+ else
+ {
+ qd.missing_data_ = 0;
+ }
+
+ this->init_queued_data (&qd);
+
+ mesg_length = TAO_GIOP_LITE_HEADER_LEN + this->message_size_;
+
+ return 1; /* parsed header successfully */
+ }
+}
+
+int
+TAO_GIOP_Message_Lite::extract_next_message (ACE_Message_Block &incoming,
+ TAO_Queued_Data *&qd)
+{
+ if (incoming.length () < TAO_GIOP_LITE_HEADER_LEN)
+ {
+ if (incoming.length () > 0)
+ {
+ // Make a node which has a message block of the size of
+ // MESSAGE_HEADER_LEN.
+ qd =
+ this->make_queued_data (TAO_GIOP_LITE_HEADER_LEN);
+
+ if (qd == 0)
+ {
+ return -1; /* out of memory */
+ }
+
+ qd->msg_block_->copy (incoming.rd_ptr (),
+ incoming.length ());
+ qd->missing_data_ = TAO_MISSING_DATA_UNDEFINED;
+ }
+ return 0;
+ }
+
+ if (this->parse_incoming_messages (incoming) == -1)
+ {
+ return -1;
+ }
+
+ size_t copying_len =
+ this->message_size_ + TAO_GIOP_LITE_HEADER_LEN;
+
+ qd = this->make_queued_data (copying_len);
+
+ if (qd == 0)
+ {
+ return -1; /* out of memory */
+ }
+
+ if (copying_len > incoming.length ())
+ {
+ qd->missing_data_ = copying_len - incoming.length ();
+
+ copying_len = incoming.length ();
+ }
+ else
+ {
+ qd->missing_data_ = 0;
+ }
+
+ qd->msg_block_->copy (incoming.rd_ptr (),
+ copying_len);
+
+ incoming.rd_ptr (copying_len);
+ this->init_queued_data (qd);
+
+ return 1;
+}
+
+int
+TAO_GIOP_Message_Lite::consolidate_node (TAO_Queued_Data *qd,
+ ACE_Message_Block &incoming)
+{
+ // Look to see whether we had atleast parsed the GIOP header ...
+ if (qd->missing_data_ == TAO_MISSING_DATA_UNDEFINED)
+ {
+ // The data length that has been stuck in there during the last
+ // read ....
+ size_t len =
+ qd->msg_block_->length ();
+
+ // We know that we would have space for
+ // TAO_GIOP_MESSAGE_HEADER_LEN here. So copy that much of data
+ // from the <incoming> into the message block in <qd>
+ const size_t available = incoming.length ();
+ const size_t desired = TAO_GIOP_LITE_HEADER_LEN - len;
+ const size_t n_copy = ace_min (available, desired);
+
+ // paranoid check, but would cause endless loop
+ if (n_copy == 0)
+ {
+ return -1;
+ }
+
+ qd->msg_block_->copy (incoming.rd_ptr (), n_copy);
+
+ // Move the rd_ptr () in the incoming message block..
+ incoming.rd_ptr (n_copy);
+
+ // verify there is now enough data to parse the header
+ if (qd->msg_block_->length () < TAO_GIOP_LITE_HEADER_LEN)
+ {
+ return 0;
+ }
+
+ // Parse the message header now...
+ if (this->parse_incoming_messages (*qd->msg_block_) == -1)
+ return -1;
+
+ // Now grow the message block so that we can copy the rest of
+ // the data...
+ if (ACE_CDR::grow (qd->msg_block_,
+ this->message_size_ + TAO_GIOP_LITE_HEADER_LEN) == -1)
+ {
+ /* memory allocation failed */
+ return -1;
+ }
+
+ // Copy the pay load..
+
+ // Calculate the bytes that needs to be copied in the queue...
+ size_t copy_len = this->message_size_;
+
+ // If the data that needs to be copied is more than that is
+ // available to us ..
+ if (copy_len > incoming.length ())
+ {
+ // Calculate the missing data..
+ qd->missing_data_ = copy_len - incoming.length ();
+
+ // Set the actual possible copy_len that is available...
+ copy_len = incoming.length ();
+ }
+ else
+ {
+ qd->missing_data_ = 0;
+ }
+
+ // paranoid check
+ if (copy_len == 0)
+ {
+ return -1;
+ }
+
+ // ..now we are set to copy the right amount of data to the
+ // node..
+ qd->msg_block_->copy (incoming.rd_ptr (),
+ copy_len);
+
+ // Set the <rd_ptr> of the <incoming>..
+ incoming.rd_ptr (copy_len);
+
+ // Get the other details...
+ this->init_queued_data (qd);
+ }
+ else
+ {
+ // @@todo: Need to abstract this out to a seperate method...
+ size_t copy_len = qd->missing_data_;
+
+ if (copy_len > incoming.length ())
+ {
+ // Calculate the missing data..
+ qd->missing_data_ = copy_len - incoming.length ();
+
+ // Set the actual possible copy_len that is available...
+ copy_len = incoming.length ();
+ }
+
+ // Copy the right amount of data in to the node...
+ // node..
+ qd->msg_block_->copy (incoming.rd_ptr (),
+ copy_len);
+
+ // Set the <rd_ptr> of the <incoming>..
+ qd->msg_block_->rd_ptr (copy_len);
+
+ }
+
+ return 0;
+}
+
+int
+TAO_GIOP_Message_Lite::process_request_message (TAO_Transport *transport,
+ TAO_Queued_Data *qd)
+{
+ // Set the upcall thread
+ this->orb_core_->lf_strategy ().set_upcall_thread (
+ this->orb_core_->leader_follower ());
+
+ // A buffer that we will use to initialise the CDR stream
+ char repbuf[ACE_CDR::DEFAULT_BUFSIZE];
+
+#if defined(ACE_INITIALIZE_MEMORY_BEFORE_USE)
+ (void) ACE_OS::memset (repbuf,
+ '\0',
+ sizeof repbuf);
+#endif /* ACE_INITIALIZE_MEMORY_BEFORE_USE */
+
+ // Initialze an output CDR on the stack
+ TAO_OutputCDR output (repbuf,
+ sizeof repbuf,
+ TAO_ENCAP_BYTE_ORDER,
+ this->orb_core_->output_cdr_buffer_allocator (),
+ this->orb_core_->output_cdr_dblock_allocator (),
+ this->orb_core_->output_cdr_msgblock_allocator (),
+ this->orb_core_->orb_params ()->cdr_memcpy_tradeoff (),
+ qd->major_version_,
+ qd->minor_version_);
+
+ transport->assign_translators(0,&output);
+
+ // Get the read and write positions before we steal data.
+ size_t rd_pos = qd->msg_block_->rd_ptr () - qd->msg_block_->base ();
+ size_t wr_pos = qd->msg_block_->wr_ptr () - qd->msg_block_->base ();
+ rd_pos += TAO_GIOP_LITE_HEADER_LEN;
+
+ if (TAO_debug_level > 0)
+ this->dump_msg ("recv",
+ reinterpret_cast <u_char *> (qd->msg_block_->rd_ptr ()),
+ qd->msg_block_->length ());
+
+
+ // Create a input CDR stream.
+ // NOTE: We use the same data block in which we read the message and
+ // we pass it on to the higher layers of the ORB. So we dont to any
+ // copies at all here. The same is also done in the higher layers.
+
+ TAO_InputCDR input_cdr (qd->msg_block_->data_block (),
+ ACE_Message_Block::DONT_DELETE,
+ rd_pos,
+ wr_pos,
+ qd->byte_order_,
+ qd->major_version_,
+ qd->minor_version_,
+ this->orb_core_);
+
+
+ // We know we have some request message. Check whether it is a
+ // GIOP_REQUEST or GIOP_LOCATE_REQUEST to take action.
+ switch (qd->msg_type_)
+ {
+ case TAO_PLUGGABLE_MESSAGE_REQUEST:
+ // Should be taken care by the state specific invocations. They
+ // could raise an exception or write things in the output CDR
+ // stream
+ return this->process_request (transport,
+ input_cdr,
+ output);
+ case TAO_PLUGGABLE_MESSAGE_LOCATEREQUEST:
+ return this->process_locate_request (transport,
+ input_cdr,
+ output);
+ default:
+ return -1;
+ }
+}
+
+int
+TAO_GIOP_Message_Lite::process_reply_message (
+ TAO_Pluggable_Reply_Params &params,
+ TAO_Queued_Data *qd
+ )
+{
+
+
+ // Get the read and write positions before we steal data.
+ size_t rd_pos = qd->msg_block_->rd_ptr () - qd->msg_block_->base ();
+ size_t wr_pos = qd->msg_block_->wr_ptr () - qd->msg_block_->base ();
+ rd_pos += TAO_GIOP_LITE_HEADER_LEN;
+
+ if (TAO_debug_level > 0)
+ this->dump_msg ("recv",
+ reinterpret_cast <u_char *> (qd->msg_block_->rd_ptr ()),
+ qd->msg_block_->length ());
+
+
+ // Create a empty buffer on stack
+ // NOTE: We use the same data block in which we read the message and
+ // we pass it on to the higher layers of the ORB. So we dont to any
+ // copies at all here. The same is also done in the higher layers.
+ TAO_InputCDR input_cdr (qd->msg_block_->data_block (),
+ ACE_Message_Block::DONT_DELETE,
+ rd_pos,
+ wr_pos,
+ qd->byte_order_,
+ qd->major_version_,
+ qd->minor_version_,
+ this->orb_core_);
+
+ // Reset the message state. Now, we are ready for the next nested
+ // upcall if any.
+ // this->message_handler_.reset (0);
+
+ // We know we have some reply message. Check whether it is a
+ // GIOP_REPLY or GIOP_LOCATE_REPLY to take action.
+
+ // Once we send the InputCDR stream we need to just forget about
+ // the stream and never touch that again for anything. We basically
+ // loose ownership of the data_block.
+
+ // We know we have some reply message. Check whether it is a
+ // GIOP_REPLY or GIOP_LOCATE_REPLY to take action.
+ switch (qd->msg_type_)
+ {
+ case TAO_PLUGGABLE_MESSAGE_REPLY:
+ // Should be taken care by the state specific parsing
+ return this->parse_reply (input_cdr,
+ params);
+ case TAO_PLUGGABLE_MESSAGE_LOCATEREPLY:
+ // We call parse_reply () here because, the message format for
+ // the LOCATEREPLY & REPLY are same.
+ return this->parse_reply (input_cdr,
+ params);
+ default:
+ return -1;
+ }
+}
+
+int
+TAO_GIOP_Message_Lite::generate_exception_reply (
+ TAO_OutputCDR &cdr,
+ TAO_Pluggable_Reply_Params_Base &params,
+ CORBA::Exception &x
+ )
+{
+ // A new try/catch block, but if something goes wrong now we have no
+ // hope, just abort.
+ ACE_DECLARE_NEW_CORBA_ENV;
+
+ ACE_TRY
+ {
+ // Make the GIOP & reply header. They are version specific.
+ this->write_reply_header (cdr,
+ params);
+ x._tao_encode (cdr ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCH (CORBA::Exception, ex)
+ {
+ // Now we know that while handling the error an other error
+ // happened -> no hope, close connection.
+
+ // Close the handle.
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("(%P|%t|%N|%l) cannot marshal exception, ")
+ ACE_TEXT ("generate_exception_reply ()\n")));
+ return -1;
+ }
+ ACE_ENDTRY;
+ ACE_CHECK_RETURN (-1);
+
+ return 0;
+}
+
+
+int
+TAO_GIOP_Message_Lite::write_protocol_header (
+ TAO_GIOP_Message_Type type,
+ TAO_OutputCDR &msg)
+{
+ // Reset the message type
+ msg.reset ();
+
+ // @@ Bala: this is something to think harder about: right now we
+ // leave the space to store the length, and later we set it, but the
+ // way we do it is CDR specific... Maybe the XXXStream classes
+ // should support a 'save your current position' method that returns
+ // a 'Mememto' (check the GoF book), later the CDR stream could be
+ // restored to that state, and the size written to it.
+ // @@ Then again, i don't know how would that work with fragments
+ // (eventually we may want TAO to generate fragments), or protocols
+ // based on chunking....
+ //
+ // Write a dummy <size> later it is set to the right value... @@
+ CORBA::ULong size = 0;
+ msg.write_ulong (size);
+
+ msg.write_octet ((CORBA::Octet) type);
+
+ return 1;
+}
+
+
+int
+TAO_GIOP_Message_Lite::process_request (TAO_Transport *transport,
+ TAO_InputCDR &cdr,
+ TAO_OutputCDR &output)
+{
+ // This will extract the request header, set <response_required>
+ // and <sync_with_server> as appropriate.
+ TAO_ServerRequest request (this,
+ cdr,
+ output,
+ transport,
+ this->orb_core_);
+
+ CORBA::ULong request_id = 0;
+ CORBA::Boolean response_required = 0;
+
+ int parse_error = 0;
+
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ parse_error =
+ this->parse_request_header (request);
+
+ TAO_Codeset_Manager *csm = request.orb_core()->codeset_manager();
+ if (csm)
+ {
+ csm->process_service_context(request);
+ transport->assign_translators(&cdr,&output);
+ }
+
+ // Throw an exception if the
+ if (parse_error != 0)
+ ACE_TRY_THROW (CORBA::MARSHAL (0,
+ CORBA::COMPLETED_NO));
+ request_id = request.request_id ();
+
+ response_required = request.response_expected ();
+
+ CORBA::Object_var forward_to;
+
+ // Do this before the reply is sent.
+ this->orb_core_->adapter_registry ()->dispatch (request.object_key (),
+ request,
+ forward_to
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (!CORBA::is_nil (forward_to.in ()))
+ {
+ // We should forward to another object...
+ TAO_Pluggable_Reply_Params reply_params (transport);
+ reply_params.request_id_ = request_id;
+ reply_params.reply_status_ = TAO_GIOP_LOCATION_FORWARD;
+ reply_params.svc_ctx_.length (0);
+
+ // Send back the reply service context list.
+ reply_params.service_context_notowned (&request.reply_service_info ());
+
+ // Make the GIOP header and Reply header
+ this->generate_reply_header (output,
+ reply_params);
+
+ if (!(output << forward_to.in ()))
+ {
+ if (TAO_debug_level > 0)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) ERROR: Unable to marshal ")
+ ACE_TEXT ("forward reference.\n")));
+
+ return -1;
+ }
+
+ int result = transport->send_message (output);
+ if (result == -1)
+ {
+ if (TAO_debug_level > 0)
+ {
+ // No exception but some kind of error, yet a
+ // response is required.
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO: (%P|%t|%N|%l) %p: ")
+ ACE_TEXT ("cannot send reply\n"),
+ ACE_TEXT ("TAO_GIOP_Message_Lite::process_request")));
+ }
+ }
+ return result;
+ }
+ }
+ // Only CORBA exceptions are caught here.
+ ACE_CATCHANY
+ {
+ int result = 0;
+
+ if (response_required)
+ {
+ result = this->send_reply_exception (transport,
+ this->orb_core_,
+ request_id,
+ &request.reply_service_info (),
+ &ACE_ANY_EXCEPTION);
+ if (result == -1)
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO: (%P|%t|%N|%l) %p: ")
+ ACE_TEXT ("cannot send exception\n"),
+ ACE_TEXT ("process_request ()")));
+ ACE_PRINT_EXCEPTION (
+ ACE_ANY_EXCEPTION,
+ "TAO_GIOP_Message_Lite::process_request[2]");
+ }
+ }
+
+ }
+ else if (TAO_debug_level > 0)
+ {
+ // It is unfortunate that an exception (probably a system
+ // exception) was thrown by the upcall code (even by the
+ // user) when the client was not expecting a response.
+ // However, in this case, we cannot close the connection
+ // down, since it really isn't the client's fault.
+
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) exception thrown ")
+ ACE_TEXT ("but client is not waiting a response\n")));
+
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "TAO: ");
+ }
+
+ return result;
+ }
+#if defined (TAO_HAS_EXCEPTIONS)
+ ACE_CATCHALL
+ {
+ // @@ TODO some c++ exception or another, but what do we do with
+ // it?
+ // We are supposed to map it into a CORBA::UNKNOWN exception.
+ // BTW, this cannot be detected if using the <env> mapping. If
+ // we have native exceptions but no support for them in the ORB
+ // we should still be able to catch it. If we don't have native
+ // exceptions it couldn't have been raised in the first place!
+ int result = 0;
+
+ if (response_required)
+ {
+ CORBA::UNKNOWN exception (
+ CORBA::SystemException::_tao_minor_code (
+ TAO_UNHANDLED_SERVER_CXX_EXCEPTION,
+ 0
+ ),
+ CORBA::COMPLETED_MAYBE
+ );
+
+ result = this->send_reply_exception (transport,
+ this->orb_core_,
+ request_id,
+ &request.reply_service_info (),
+ &exception);
+ if (result == -1)
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) - TAO_GIOP_Message_Lite::process_request[3], ")
+ ACE_TEXT ("%p: ")
+ ACE_TEXT ("cannot send exception\n"),
+ ACE_TEXT ("process_request ()")));
+ ACE_PRINT_EXCEPTION (
+ exception,
+ "TAO_GIOP_Message_Lite::process_request[3]");
+ }
+ }
+ }
+ else if (TAO_debug_level > 0)
+ {
+ // It is unfotunate that an exception (probably a system
+ // exception) was thrown by the upcall code (even by the
+ // user) when the client was not expecting a response.
+ // However, in this case, we cannot close the connection
+ // down, since it really isn't the client's fault.
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t|%N|%l) exception thrown ")
+ ACE_TEXT ("but client is not waiting a response\n")));
+ }
+
+ return result;
+ }
+#endif /* TAO_HAS_EXCEPTIONS */
+ ACE_ENDTRY;
+
+ return 0;
+}
+
+
+int
+TAO_GIOP_Message_Lite::process_locate_request (TAO_Transport *transport,
+ TAO_InputCDR &input,
+ TAO_OutputCDR &output)
+{
+ // This will extract the request header, set <response_required> as
+ // appropriate.
+ TAO_GIOP_Locate_Request_Header locate_request (input,
+ this->orb_core_);
+
+ TAO_GIOP_Locate_Status_Msg status_info;
+
+ // Defaulting.
+ status_info.status = TAO_GIOP_UNKNOWN_OBJECT;
+
+ CORBA::Boolean response_required = 1;
+
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ int parse_error =
+ this->parse_locate_header (locate_request);
+
+ if (parse_error != 0)
+ {
+ ACE_TRY_THROW (CORBA::MARSHAL (0,
+ CORBA::COMPLETED_NO));
+ }
+
+ // Execute a fake request to find out if the object is there or
+ // if the POA can activate it on demand...
+ char repbuf[ACE_CDR::DEFAULT_BUFSIZE];
+ TAO_OutputCDR dummy_output (repbuf,
+ sizeof repbuf);
+ // This output CDR is not used!
+
+ TAO::ObjectKey tmp_key (locate_request.object_key ().length (),
+ locate_request.object_key ().length (),
+ locate_request.object_key ().get_buffer (),
+ 0);
+
+ // Set it to an error state
+ parse_error = 1;
+ CORBA::ULong req_id = locate_request.request_id ();
+
+ // We will send the reply. The ServerRequest class need not send
+ // the reply
+ CORBA::Boolean deferred_reply = 1;
+ TAO_ServerRequest server_request (this,
+ req_id,
+ response_required,
+ deferred_reply,
+ tmp_key,
+ "_non_existent",
+ dummy_output,
+ transport,
+ this->orb_core_,
+ parse_error);
+
+ if (parse_error != 0)
+ {
+ ACE_TRY_THROW (CORBA::MARSHAL (0,
+ CORBA::COMPLETED_NO));
+ }
+
+ CORBA::Object_var forward_to;
+
+ this->orb_core_->adapter_registry ()->dispatch (server_request.object_key (),
+ server_request,
+ forward_to
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (!CORBA::is_nil (forward_to.in ()))
+ {
+ status_info.status = TAO_GIOP_OBJECT_FORWARD;
+ status_info.forward_location_var = forward_to;
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - TAO_GIOP_Message_Lite::process_locate_request, ")
+ ACE_TEXT ("called: forwarding\n")));
+ }
+ else if (server_request.exception_type () == TAO_GIOP_NO_EXCEPTION)
+ {
+ // We got no exception, so the object is here.
+ status_info.status = TAO_GIOP_OBJECT_HERE;
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - TAO_GIOP_Message_Lite::process_locate_request, ")
+ ACE_TEXT ("found\n")));
+ }
+ else
+ {
+ status_info.forward_location_var = server_request.forward_location ();
+
+ if (!CORBA::is_nil (status_info.forward_location_var.in ()))
+ {
+ status_info.status = TAO_GIOP_OBJECT_FORWARD;
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - TAO_GIOP_Message_Lite::process_locate_request, ")
+ ACE_TEXT ("forwarding\n")));
+ }
+ else
+ {
+ // Normal exception, so the object is not here
+ status_info.status = TAO_GIOP_UNKNOWN_OBJECT;
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - TAO_GIOP_Message_Lite::process_locate_request, ")
+ ACE_TEXT ("not here\n")));
+ }
+ }
+ }
+
+ ACE_CATCHANY
+ {
+ // Normal exception, so the object is not here
+ status_info.status = TAO_GIOP_UNKNOWN_OBJECT;
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) TAO_GIOP_Message_Lite::process_locate_request - ")
+ ACE_TEXT ("CORBA exception raised\n")));
+ }
+#if defined (TAO_HAS_EXCEPTIONS)
+ ACE_CATCHALL
+ {
+ // Normal exception, so the object is not here
+ status_info.status = TAO_GIOP_UNKNOWN_OBJECT;
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) TAO_GIOP_Message_Lite::process_locate_request - ")
+ ACE_TEXT ("C++ exception raised\n")));
+ }
+#endif /* TAO_HAS_EXCEPTIONS */
+ ACE_ENDTRY;
+
+ return this->make_send_locate_reply (transport,
+ output,
+ locate_request,
+ status_info);
+}
+
+
+int
+TAO_GIOP_Message_Lite::make_send_locate_reply (
+ TAO_Transport *transport,
+ TAO_OutputCDR &output,
+ TAO_GIOP_Locate_Request_Header &request,
+ TAO_GIOP_Locate_Status_Msg &status_info
+ )
+{
+ // Note here we are making the Locate reply header which is *QUITE*
+ // different from the reply header made by the make_reply () call..
+ // Make the GIOP message header
+ this->write_protocol_header (TAO_GIOP_LOCATEREPLY,
+ output);
+
+ // This writes the header & body
+ this->write_locate_reply_mesg (output,
+ request.request_id (),
+ status_info);
+
+ // Send the message
+ int result = transport->send_message (output);
+
+ // Print out message if there is an error
+ if (result == -1)
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO: (%P|%t) %p: cannot send reply\n"),
+ ACE_TEXT ("TAO_GIOP_Message_Lite::make_send_locate_reply")));
+ }
+ }
+
+ return result;
+}
+
+int
+TAO_GIOP_Message_Lite::parse_reply (TAO_InputCDR &cdr,
+ TAO_Pluggable_Reply_Params &params)
+{
+
+ // Read the request id
+ if (!cdr.read_ulong (params.request_id_))
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t|%N|%l) : ")
+ ACE_TEXT ("TAO_GIOP_Message_Lite::parse_reply, ")
+ ACE_TEXT ("extracting request id\n")));
+ }
+
+ return -1;
+ }
+
+ CORBA::ULong rep_stat = 0;
+
+ // and the reply status type. status can be NO_EXCEPTION,
+ // SYSTEM_EXCEPTION, USER_EXCEPTION, LOCATION_FORWARD
+ // CAnnot handle LOCATION_FORWARD_PERM here
+ if (!cdr.read_ulong (rep_stat))
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t|%N|%l) : ")
+ ACE_TEXT ("TAO_GIOP_Message_Lite::parse_reply, ")
+ ACE_TEXT ("extracting reply status\n")));
+ }
+
+ return -1;
+ }
+
+ // Pass the right Pluggable interface code to the transport layer
+ switch (rep_stat)
+ {
+ // Request completed successfully
+ case TAO_GIOP_NO_EXCEPTION:
+ params.reply_status_ = TAO_PLUGGABLE_MESSAGE_NO_EXCEPTION;
+ break;
+
+ // Request terminated with user exception
+ case TAO_GIOP_USER_EXCEPTION:
+ params.reply_status_ = TAO_PLUGGABLE_MESSAGE_USER_EXCEPTION;
+ break;
+ // Request terminated with system exception
+ case TAO_GIOP_SYSTEM_EXCEPTION:
+ params.reply_status_ = TAO_PLUGGABLE_MESSAGE_SYSTEM_EXCEPTION;
+ break;
+ // Reply is a location forward type
+ case TAO_GIOP_LOCATION_FORWARD:
+ params.reply_status_ = TAO_PLUGGABLE_MESSAGE_LOCATION_FORWARD;
+ break;
+ default:
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("(%N|%l) Unknown reply status \n")));
+ }
+ }
+
+ params.input_cdr_= &cdr;
+
+ if ( params.transport_->tms ()->dispatch_reply (params) == -1)
+ {
+ // Something really critical happened, we will forget about
+ // every reply on this connection.
+ if (TAO_debug_level > 0)
+ ACE_ERROR ((LM_ERROR,
+ "TAO (%P|%t) - GIOP_Message_Lite[%d]::process_parsed_messages, "
+ "dispatch reply failed\n",
+ params.transport_->id ()));
+
+ return -1;
+ }
+
+ return 0;
+}
+
+
+
+int
+TAO_GIOP_Message_Lite::write_reply_header (
+ TAO_OutputCDR &output,
+ TAO_Pluggable_Reply_Params_Base &reply
+ ACE_ENV_ARG_DECL_NOT_USED /* ACE_ENV_SINGLE_ARG_PARAMETER */
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ // Write the GIOP Lite header first
+ this->write_protocol_header (TAO_GIOP_REPLY,
+ output);
+
+ // Write the request ID
+ output.write_ulong (reply.request_id_);
+
+ // Write the reply status
+ switch (reply.reply_status_)
+ {
+ case TAO_PLUGGABLE_MESSAGE_NO_EXCEPTION:
+ output.write_ulong (TAO_GIOP_NO_EXCEPTION);
+ break;
+ case TAO_PLUGGABLE_MESSAGE_LOCATION_FORWARD:
+ output.write_ulong (TAO_GIOP_LOCATION_FORWARD);
+ break;
+ case TAO_PLUGGABLE_MESSAGE_SYSTEM_EXCEPTION:
+ output.write_ulong (TAO_GIOP_SYSTEM_EXCEPTION);
+ break;
+ case TAO_PLUGGABLE_MESSAGE_USER_EXCEPTION:
+ output.write_ulong (TAO_GIOP_USER_EXCEPTION);
+ break;
+ default:
+ // Some other specifc exception
+ output.write_ulong (reply.reply_status_);
+ break;
+ }
+
+ return 1;
+}
+
+int
+TAO_GIOP_Message_Lite::write_request_header (
+ const TAO_Operation_Details &opdetails,
+ TAO_Target_Specification &spec,
+ TAO_OutputCDR &out_stream
+ )
+{
+ out_stream << opdetails.request_id ();
+
+ const CORBA::Octet response_flags = opdetails.response_flags ();
+
+ // @@ (JP) Temporary hack until all of GIOP 1.2 is implemented.
+ if (response_flags == TAO_TWOWAY_RESPONSE_FLAG)
+ {
+ out_stream << ACE_OutputCDR::from_octet (1);
+ }
+ // Sync scope - ignored by server if request is not oneway.
+ else if (response_flags == CORBA::Octet (Messaging::SYNC_WITH_TRANSPORT)
+ || response_flags == CORBA::Octet (Messaging::SYNC_NONE)
+ || response_flags == CORBA::Octet (TAO::SYNC_EAGER_BUFFERING)
+ || response_flags == CORBA::Octet (TAO::SYNC_DELAYED_BUFFERING))
+ {
+ // No response required.
+ out_stream << ACE_OutputCDR::from_octet (0);
+ }
+ else if (response_flags == CORBA::Octet (Messaging::SYNC_WITH_SERVER))
+ {
+ // Return before dispatching servant. We're also setting the high
+ // bit here. This is a temporary fix until the rest of GIOP 1.2 is
+ // implemented in TAO.
+ out_stream << ACE_OutputCDR::from_octet (129);
+ }
+ else if (response_flags == CORBA::Octet (Messaging::SYNC_WITH_TARGET))
+ {
+ // Return after dispatching servant.
+ out_stream << ACE_OutputCDR::from_octet (3);
+ }
+ else
+ {
+ // Until more flags are defined by the OMG.
+ return 0;
+ }
+
+ // In this case we cannot recognise anything other than the Object
+ // key as the address disposition variable. But we do a sanity check
+ // anyway.
+ const TAO::ObjectKey *key = spec.object_key ();
+
+ if (key != 0)
+ {
+ // Put in the object key
+ out_stream << *key;
+ }
+ else
+ {
+ if (TAO_debug_level)
+ {
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT ("(%N |%l) Unable to handle this request \n")
+ ));
+ }
+
+ return 0;
+ }
+
+ out_stream.write_string (opdetails.opname_len (),
+ opdetails.opname ());
+
+ return 1;
+}
+
+int
+TAO_GIOP_Message_Lite::write_locate_request_header (
+ CORBA::ULong request_id,
+ TAO_Target_Specification &spec,
+ TAO_OutputCDR &msg
+ )
+{
+ msg << request_id;
+
+ // In this case we cannot recognise anything other than the Object
+ // key as the address disposition variable. But we do a sanity check
+ // anyway.
+ const TAO::ObjectKey *key = spec.object_key ();
+
+ if (key)
+ {
+ // Put in the object key
+ msg << *key;
+ }
+ else
+ {
+ if (TAO_debug_level)
+ {
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT ("(%N |%l) Unable to handle this request \n")
+ ));
+ }
+
+ return 0;
+ }
+
+ return 1;
+}
+
+
+int
+TAO_GIOP_Message_Lite::parse_request_header (TAO_ServerRequest &request)
+{
+ // Get the input CDR in the request class
+ TAO_InputCDR & input = *request.incoming ();
+
+ CORBA::Boolean hdr_status = (CORBA::Boolean) input.good_bit ();
+
+ CORBA::ULong req_id = 0;
+
+ // Get the rest of the request header ...
+ hdr_status = hdr_status && input.read_ulong (req_id);
+
+ request.request_id (req_id);
+
+ CORBA::Octet response_flags = CORBA::Octet();
+ hdr_status = hdr_status && input.read_octet (response_flags);
+ request.response_expected ((response_flags != 0));
+
+ // The high bit of the octet has been set if the SyncScope policy
+ // value is SYNC_WITH_SERVER. This is a temporary hack until all
+ // of GIOP 1.2 is in place. Then we can check the version in the
+ // message header instead.
+ request.sync_with_server ((response_flags == 129));
+
+ // We use ad-hoc demarshalling here: there is no need to increase
+ // the reference count on the CDR message block, because this key
+ // will not outlive the request (or the message block).
+ CORBA::Long key_length = 0;
+ hdr_status = hdr_status && input.read_long (key_length);
+
+ if (hdr_status)
+ {
+ request.object_key ().replace (key_length, key_length,
+ (CORBA::Octet*)input.rd_ptr (),
+ 0);
+ input.skip_bytes (key_length);
+ }
+
+ if (input.char_translator () == 0)
+ {
+ CORBA::ULong length = 0;
+ hdr_status = hdr_status && input.read_ulong (length);
+
+ if (hdr_status)
+ {
+ // Do not include NULL character at the end.
+ // @@ This is not getting demarshaled using the codeset
+ // translators!
+
+ // Notice that there are no memory allocations involved
+ // here!
+
+ request.operation (input.rd_ptr (),
+ length - 1,
+ 0 /* TAO_ServerRequest does NOT own string */);
+
+ hdr_status = input.skip_bytes (length);
+ }
+ }
+ else
+ {
+ // @@ We could optimize for this case too, i.e. do in-place
+ // demarshaling of the string... But there is an issue
+ // pending on the OMG as to whether the operation should be
+ // sent in the connection negotiated codeset or always in
+ // ISO8859-1.
+ CORBA::String_var tmp;
+ hdr_status = hdr_status && input.read_string (tmp.inout ());
+
+ request.operation (tmp._retn (),
+ 0,
+ 1 /* TAO_ServerRequest owns string */);
+ }
+
+ return hdr_status ? 0 : -1;
+}
+
+int
+TAO_GIOP_Message_Lite::parse_locate_header (
+ TAO_GIOP_Locate_Request_Header &request
+ )
+{
+ // Get the stream.
+ TAO_InputCDR &msg = request.incoming_stream ();
+
+ CORBA::Boolean hdr_status = 1;
+
+ // Get the request id.
+ CORBA::ULong req_id = 0;
+ hdr_status = msg.read_ulong (req_id);
+
+ // Store it in the Locate request classes.
+ request.request_id (req_id);
+
+ TAO::ObjectKey &object_key =
+ request.object_key ();
+
+ // Note that here there are no unions and so no problems.
+ hdr_status = hdr_status && (msg >> object_key);
+
+ return hdr_status ? 0 : -1;
+}
+
+int
+TAO_GIOP_Message_Lite::send_reply_exception (
+ TAO_Transport *transport,
+ TAO_ORB_Core* orb_core,
+ CORBA::ULong request_id,
+ IOP::ServiceContextList *svc_info,
+ CORBA::Exception *x
+ )
+{
+ // Create a new output CDR stream
+ char repbuf[ACE_CDR::DEFAULT_BUFSIZE];
+
+#if defined(ACE_INITIALIZE_MEMORY_BEFORE_USE)
+ (void) ACE_OS::memset (repbuf,
+ '\0',
+ sizeof repbuf);
+#endif /* ACE_INITIALIZE_MEMORY_BEFORE_USE */
+ TAO_OutputCDR output (repbuf,
+ sizeof repbuf,
+ TAO_ENCAP_BYTE_ORDER,
+ orb_core->output_cdr_buffer_allocator (),
+ orb_core->output_cdr_dblock_allocator (),
+ orb_core->output_cdr_msgblock_allocator (),
+ orb_core->orb_params ()->cdr_memcpy_tradeoff (),
+ TAO_DEF_GIOP_MAJOR,
+ TAO_DEF_GIOP_MINOR);
+
+ transport->assign_translators(0,&output);
+
+ // Make the GIOP & reply header. They are version specific.
+ TAO_Pluggable_Reply_Params reply_params (transport);
+ reply_params.request_id_ = request_id;
+ reply_params.svc_ctx_.length (0);
+
+ // Send back the service context we received. (RTCORBA relies on
+ // this).
+ reply_params.service_context_notowned (svc_info);
+
+ // A new try/catch block, but if something goes wrong now we have no
+ // hope, just abort.
+ ACE_DECLARE_NEW_CORBA_ENV;
+
+ ACE_TRY
+ {
+ // Write the exception.
+ reply_params.reply_status_ = TAO_GIOP_USER_EXCEPTION;
+
+ if (CORBA::SystemException::_downcast (x) != 0)
+ {
+ reply_params.reply_status_ = TAO_GIOP_SYSTEM_EXCEPTION;
+ }
+
+ // Make the GIOP & reply header. They are version specific.
+ this->write_reply_header (output,
+ reply_params);
+
+
+ x->_tao_encode (output ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCH (CORBA::Exception, ex)
+ {
+ // Now we know that while handling the error an other error
+ // happened -> no hope, close connection.
+
+ // Close the handle.
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("(%P|%t|%N|%l) cannot marshal exception on transport %u: %p\n"),
+ transport->id (),
+ ACE_TEXT ("send_reply_exception ()")));
+ return -1;
+ }
+ ACE_ENDTRY;
+
+ return transport->send_message (output);
+}
+
+
+int
+TAO_GIOP_Message_Lite::write_locate_reply_mesg (
+ TAO_OutputCDR & output,
+ CORBA::ULong request_id,
+ TAO_GIOP_Locate_Status_Msg &status_info
+ )
+{
+ // Note here we are making the Locate reply header which is *QUITE*
+ // different from the reply header made by the make_reply () call..
+
+ // Make the GIOP message header
+ this->write_protocol_header (TAO_GIOP_LOCATEREPLY,
+ output);
+
+ // Make the header for the locate request
+ output.write_ulong (request_id);
+ output.write_ulong (status_info.status);
+
+ if (status_info.status == TAO_GIOP_OBJECT_FORWARD)
+ {
+ CORBA::Object_ptr object_ptr = status_info.forward_location_var.in ();
+
+ if ((output << object_ptr) == 0)
+ {
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t|%N|%l) make_locate_reply-")
+ ACE_TEXT ("cannot marshal object reference\n")));
+ }
+ }
+
+ return 1;
+}
+
+// Send an "I can't understand you" message -- again, the message is
+// prefabricated for simplicity. This implies abortive disconnect (at
+// the application level, if not at the level of TCP).
+//
+// NOTE that IIOPLite will still benefit from TCP's orderly disconnect.
+int
+TAO_GIOP_Message_Lite::send_error (TAO_Transport *transport)
+{
+ const char error_message [TAO_GIOP_LITE_HEADER_LEN] =
+ {
+ // The following works on non-ASCII platforms, such as MVS (which
+ // uses EBCDIC).
+ TAO_GIOP_MESSAGERROR,
+ 0, 0, 0, 0
+ };
+
+ this->dump_msg ("send_error",
+ (const u_char *) error_message,
+ TAO_GIOP_LITE_HEADER_LEN);
+
+ ACE_Data_Block data_block (TAO_GIOP_LITE_HEADER_LEN,
+ ACE_Message_Block::MB_DATA,
+ error_message,
+ 0,
+ 0,
+ ACE_Message_Block::DONT_DELETE,
+ 0);
+ ACE_Message_Block message_block(&data_block);
+ message_block.wr_ptr (TAO_GIOP_LITE_HEADER_LEN);
+
+ size_t bt;
+ int result = transport->send_message_block_chain (&message_block,
+ bt);
+ if (result == -1)
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((
+ LM_DEBUG,
+ ACE_TEXT ("TAO (%N|%l|%P|%t) error sending error to transport %u, errno = %d\n"),
+ transport->id (), errno
+ ));
+ }
+ }
+
+ return result;
+}
+
+void
+TAO_GIOP_Message_Lite::dump_msg (const char *label,
+ const u_char *ptr,
+ size_t len)
+{
+ if (TAO_debug_level >= 5)
+ {
+ static const char *names [] =
+ {
+ "Request",
+ "Reply",
+ "CancelRequest",
+ "LocateRequest",
+ "LocateReply",
+ "CloseConnection",
+ "MessageError",
+ "Fragment"
+ };
+
+ // Message name.
+ const char *message_name = "UNKNOWN MESSAGE";
+ u_long slot = ptr[TAO_GIOP_LITE_MESSAGE_TYPE_OFFSET];
+
+ if (slot < sizeof (names)/sizeof(names[0]))
+ {
+ message_name = names [slot];
+ }
+
+ // Byte order.
+ int byte_order = TAO_ENCAP_BYTE_ORDER;
+
+ // request/reply id.
+ CORBA::ULong tmp = 0;
+ CORBA::ULong *id = &tmp;
+
+ if (ptr[TAO_GIOP_LITE_MESSAGE_TYPE_OFFSET] == TAO_GIOP_REQUEST ||
+ ptr[TAO_GIOP_LITE_MESSAGE_TYPE_OFFSET] == TAO_GIOP_REPLY)
+ {
+ // We are not sure where the read pointer is pointing
+ // to. So, try to align teh pointer to a 4 byte boundary.
+ char *buf = ACE_ptr_align_binary (ptr + TAO_GIOP_LITE_HEADER_LEN, 4);
+
+ id = reinterpret_cast <CORBA::ULong *> (buf);
+ }
+
+ // Print.
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("(%P | %t):%s GIOP lite msg, ")
+ ACE_TEXT ("%d data bytes, %s endian, <%s = %d> \n"),
+ ACE_TEXT_CHAR_TO_TCHAR(label),
+ len - TAO_GIOP_LITE_HEADER_LEN,
+ (byte_order == TAO_ENCAP_BYTE_ORDER) ? ACE_TEXT("my") : ACE_TEXT("other"),
+ ACE_TEXT_CHAR_TO_TCHAR (message_name),
+ *id));
+
+ if (TAO_debug_level >= 10)
+ ACE_HEX_DUMP ((LM_DEBUG,
+ (const char *) ptr,
+ len,
+ ACE_TEXT ("GIOP lite message")));
+ }
+}
+
+TAO_Queued_Data *
+TAO_GIOP_Message_Lite::make_queued_data (size_t sz)
+{
+ // Make a datablock for the size requested + something. The
+ // "something" is required because we are going to align the data
+ // block in the message block. During alignment we could loose some
+ // bytes. As we may not know how many bytes will be lost, we will
+ // allocate ACE_CDR::MAX_ALIGNMENT extra.
+ ACE_Data_Block *db =
+ this->orb_core_->create_input_cdr_data_block (sz +
+ ACE_CDR::MAX_ALIGNMENT);
+
+ TAO_Queued_Data *qd =
+ TAO_Queued_Data::make_queued_data (
+ this->orb_core_->transport_message_buffer_allocator (),
+ this->orb_core_->input_cdr_msgblock_allocator (),
+ db);
+
+ if (qd == 0)
+ {
+ db->release ();
+ return 0;
+ }
+
+ return qd;
+}
+
+int
+TAO_GIOP_Message_Lite::generate_locate_reply_header (
+ TAO_OutputCDR & /*cdr*/,
+ TAO_Pluggable_Reply_Params_Base & /*params*/)
+{
+ return 0;
+}
+
+
+int
+TAO_GIOP_Message_Lite::is_ready_for_bidirectional (TAO_OutputCDR & )
+{
+ // No we dont support..
+ return 0;
+}
+
+size_t
+TAO_GIOP_Message_Lite::header_length (void) const
+{
+ return TAO_GIOP_LITE_HEADER_LEN;
+}
+
+size_t
+TAO_GIOP_Message_Lite::fragment_header_length (CORBA::Octet,
+ CORBA::Octet) const
+{
+ return 0;
+}
+
+void
+TAO_GIOP_Message_Lite::init_queued_data (TAO_Queued_Data* qd) const
+{
+ qd->byte_order_ = TAO_ENCAP_BYTE_ORDER;
+ qd->major_version_ = TAO_DEF_GIOP_MAJOR;
+ qd->minor_version_ = TAO_DEF_GIOP_MINOR;
+ qd->msg_type_ = this->message_type ();
+}
+
+/* @return -1 error, 0 ok */
+int
+TAO_GIOP_Message_Lite::consolidate_fragmented_message (TAO_Queued_Data* /* qd */,
+ TAO_Queued_Data *& /* msg */)
+{
+ if (TAO_debug_level > 3)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P | %t):%s GIOP lite msg, ")
+ ACE_TEXT ("Error, fragmented messages not supported\n")));
+ }
+ return -1; // not implemented, not supported
+}
+
+
+
+/// Remove all fragments from stack corelating to CancelRequest @a qd.
+/// @return -1 on failure, 0 on success, 1 no fragment on stack
+/// relating to CancelRequest.
+int
+TAO_GIOP_Message_Lite::discard_fragmented_message (const TAO_Queued_Data *)
+{
+ return 1; // no fragment on stack relating to cancel-request
+}
+
+TAO_GIOP_Fragmentation_Strategy *
+TAO_GIOP_Message_Lite::fragmentation_strategy (void)
+{
+ return 0; // Fragmentation is unsupported in GIOP lite.
+}
+
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/GIOP_Message_Lite.h b/TAO/tao/GIOP_Message_Lite.h
new file mode 100644
index 00000000000..7b8e35d512a
--- /dev/null
+++ b/TAO/tao/GIOP_Message_Lite.h
@@ -0,0 +1,305 @@
+// -*- C++ -*-
+//
+// ===================================================================
+/**
+ * @file GIOP_Message_Lite.h
+ *
+ * $Id$
+ *
+ * @author Balachandran Natarajan <bala@cs.wustl.edu>
+ * @author Carlos O'Ryan <coryan@uci.edu>
+ */
+// ===================================================================
+
+#ifndef TAO_GIOP_MESSAGE_LITE_H
+#define TAO_GIOP_MESSAGE_LITE_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Pluggable_Messaging.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Pluggable_Messaging_Utils.h"
+#include "tao/GIOP_Utils.h"
+#include "tao/SystemException.h"
+#include "tao/CDR.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Operation_Details;
+class TAO_Pluggable_Reply_Params;
+class TAO_GIOP_Locate_Request_Header;
+class TAO_Queued_Data;
+class TAO_ServerRequest;
+class TAO_GIOP_Message_Version;
+
+/**
+ * @class TAO_GIOP_Message_Lite
+ *
+ * @brief Definitions of GIOPLite specific stuff
+ *
+ * This protocol is a modified version of GIOP. This is more suited
+ * for homogenous platforms.
+ */
+class TAO_Export TAO_GIOP_Message_Lite : public TAO_Pluggable_Messaging
+{
+public:
+
+ /// Constructor
+ TAO_GIOP_Message_Lite (TAO_ORB_Core *orb_core,
+ size_t input_cdr_size = ACE_CDR::DEFAULT_BUFSIZE);
+
+ /// Dtor
+ virtual ~TAO_GIOP_Message_Lite (void);
+
+ /// Initialize the object -- this is a dummy for GIOPlite
+ virtual void init (CORBA::Octet, CORBA::Octet);
+
+ /// Reset the messaging the object
+ virtual void reset (void);
+
+ /// Write the RequestHeader in to the @a cdr stream. The underlying
+ /// implementation of the mesaging should do the right thing.
+ virtual int generate_request_header (TAO_Operation_Details &op,
+ TAO_Target_Specification &spec,
+ TAO_OutputCDR &cdr);
+
+ /// Write the RequestHeader in to the @a cdr stream.
+ virtual int generate_locate_request_header (
+ TAO_Operation_Details &op,
+ TAO_Target_Specification &spec,
+ TAO_OutputCDR &cdr);
+
+ /// Write the reply header
+ virtual int generate_reply_header (
+ TAO_OutputCDR &cdr,
+ TAO_Pluggable_Reply_Params_Base &params
+ );
+
+ virtual int generate_fragment_header (TAO_OutputCDR & cdr,
+ CORBA::ULong request_id);
+
+ /// Format the message. As we have not written the message length in
+ /// the header, we make use of this oppurtunity to insert and format
+ /// the message.
+ virtual int format_message (TAO_OutputCDR &cdr);
+
+private:
+ /// Parse the incoming messages..
+ ///
+ /// \retval -1 There was some error parsing the GIOP header
+ /// \retval 0 The GIOP header was parsed correctly
+ /// \retval 1 There was not enough data in the message block to
+ /// parse the header
+ int parse_incoming_messages (ACE_Message_Block &message_block);
+
+ /// Get the message type. The return value would be one of the
+ /// following:
+ /// TAO_PLUGGABLE_MESSAGE_REQUEST,
+ /// TAO_PLUGGABLE_MESSAGE_REPLY,
+ /// TAO_PLUGGABLE_MESSAGE_CLOSECONNECTION,
+ /// TAO_PLUGGABLE_MESSAGE_MESSAGE_ERROR.
+ /// TAO_PLUGGABLE_MESSAGE_MESSAGE_CANCELREQUEST.
+ TAO_Pluggable_Message_Type message_type (void) const;
+
+public:
+ /// Parse the details of the next message from the @a incoming
+ /// and initializes attributes of @a qd. Returns 0 if the message
+ /// header could not be parsed completely, returns a 1 if the message
+ /// header could be parsed completely and returns -1 on error.
+ virtual int parse_next_message (ACE_Message_Block &incoming,
+ TAO_Queued_Data &qd, /* out */
+ size_t &mesg_length); /* out */
+
+
+ /// Extract the details of the next message from the @a incoming
+ /// through @a qd. Returns 0 if the message header could not be
+ /// parsed completely, returns a 1 if the message header could be
+ /// parsed completely and returns -1 on error.
+ virtual int extract_next_message (ACE_Message_Block &incoming,
+ TAO_Queued_Data *&qd);
+
+ /// Check whether the node @a qd needs consolidation from @a incoming
+ virtual int consolidate_node (TAO_Queued_Data *qd,
+ ACE_Message_Block &incoming);
+
+ /// Process the request message that we have received on the
+ /// connection
+ virtual int process_request_message (TAO_Transport *transport,
+ TAO_Queued_Data *qd);
+
+ /// Parse the reply message that we received and return the reply
+ /// information through @a reply_info
+ virtual int process_reply_message (
+ TAO_Pluggable_Reply_Params &reply_info,
+ TAO_Queued_Data *qd);
+
+ /// Generate a reply message with the exception @a ex.
+ virtual int generate_exception_reply (
+ TAO_OutputCDR &cdr,
+ TAO_Pluggable_Reply_Params_Base &params,
+ CORBA::Exception &x
+ );
+
+ /// Consolidate fragmented message with associated fragments, being
+ /// stored withi this class. If reliable transport is used (like
+ /// TCP) fragments are partialy ordered on stack, last fragment on
+ /// top. Otherwise If un-reliable transport is used (like UDP)
+ /// fragments may be dis-ordered, and must be ordered before
+ /// consolidation. @return 0 on success and @a msg points to
+ /// consolidated message, 1 if there are still fragmens outstanding,
+ /// in case of error -1 is being returned. In any case @a qd must be
+ /// released by method implementation.
+ virtual int consolidate_fragmented_message (TAO_Queued_Data *qd,
+ TAO_Queued_Data *&msg);
+
+ /// Discard all fragments associated to request-id encoded in
+ /// cancel_request. This operation will never be called
+ /// concurrently by multiplpe threads nor concurrently to
+ /// consolidate_fragmented_message @r 0 on success, 1 if no matching
+ /// fragment chain exists, -1 on error
+ virtual int discard_fragmented_message (const TAO_Queued_Data *cancel_request);
+
+ /// Outgoing GIOP message fragmentation strategy.
+ virtual TAO_GIOP_Fragmentation_Strategy * fragmentation_strategy (void);
+
+private:
+
+ /// Writes the GIOP header in to @a msg
+ /// @note If the GIOP header happens to change in the future, we can
+ /// push this method in to the generator_parser classes.
+ int write_protocol_header (TAO_GIOP_Message_Type t,
+ TAO_OutputCDR &msg);
+
+ /// Processes the GIOP_REQUEST messages
+ int process_request (TAO_Transport *transport,
+ TAO_InputCDR &input,
+ TAO_OutputCDR &output);
+
+ /// Processes the GIOP_LOCATE_REQUEST messages
+ int process_locate_request (TAO_Transport *transport,
+ TAO_InputCDR &input,
+ TAO_OutputCDR &output);
+
+ /// Make a GIOP_LOCATEREPLY and hand that over to the transport so
+ /// that it can be sent over the connection.
+ /// @note As on date 1.1 & 1.2 seem to have similar headers. Till an
+ /// unmanageable difference comes let them be implemented here.
+ int make_send_locate_reply (TAO_Transport *transport,
+ TAO_OutputCDR &output,
+ TAO_GIOP_Locate_Request_Header &request,
+ TAO_GIOP_Locate_Status_Msg &status);
+
+ /// Send error messages
+ int send_error (TAO_Transport *transport);
+
+ /// Close a connection, first sending GIOP::CloseConnection.
+ void send_close_connection (const TAO_GIOP_Message_Version &version,
+ TAO_Transport *transport,
+ void *ctx);
+
+ /// We must send a LocateReply through @a transport, this request
+ /// resulted in some kind of exception.
+ int send_reply_exception (TAO_Transport *transport,
+ TAO_ORB_Core* orb_core,
+ CORBA::ULong request_id,
+ IOP::ServiceContextList *svc_info,
+ CORBA::Exception *x);
+
+ /// Print out a debug messages..
+ void dump_msg (const char *label,
+ const u_char *ptr,
+ size_t len);
+
+ TAO_Queued_Data *make_queued_data (size_t sz);
+
+ /// Write the locate reply header
+ virtual int generate_locate_reply_header (
+ TAO_OutputCDR & /*cdr*/,
+ TAO_Pluggable_Reply_Params_Base & /*params*/);
+
+ /// Is the messaging object ready for processing BiDirectional
+ /// request/response?
+ virtual int is_ready_for_bidirectional (TAO_OutputCDR &msg);
+
+ /// Header length
+ virtual size_t header_length (void) const;
+
+ /// Fragment header length
+ virtual size_t fragment_header_length (CORBA::Octet major,
+ CORBA::Octet minor) const;
+
+ virtual TAO_OutputCDR &out_stream (void);
+
+private:
+
+ /// Write the request header in to <msg>
+ int write_request_header (
+ const TAO_Operation_Details &opdetails,
+ TAO_Target_Specification &spec,
+ TAO_OutputCDR &msg);
+
+ /// Write the LocateRequest header
+ int write_locate_request_header (
+ CORBA::ULong request_id,
+ TAO_Target_Specification &spec,
+ TAO_OutputCDR &msg);
+
+ /// Write the reply header in to <output>
+ int write_reply_header (
+ TAO_OutputCDR &output,
+ TAO_Pluggable_Reply_Params_Base &reply
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Writes the locate _reply message in to the <output>
+ int write_locate_reply_mesg (
+ TAO_OutputCDR &output,
+ CORBA::ULong request_id,
+ TAO_GIOP_Locate_Status_Msg &status);
+
+ /// Parse the Request Header from the incoming stream. This will do a
+ /// version specific parsing of the incoming Request header
+ int parse_request_header (TAO_ServerRequest &);
+
+ /// Parse the Loacte Request Header from the incoming stream. This will do a
+ /// version specific parsing of the incoming Request header
+ int parse_locate_header (
+ TAO_GIOP_Locate_Request_Header &);
+
+ /// Parse the reply message
+ int parse_reply (TAO_InputCDR &input,
+ TAO_Pluggable_Reply_Params &params);
+
+ /// Parse the locate reply message from the server
+ int parse_locate_reply (TAO_InputCDR &input,
+ TAO_Pluggable_Reply_Params &params);
+
+ /// Initialize the relevant portions of a TAO_Queued_Data
+ void init_queued_data (TAO_Queued_Data* qd) const;
+
+private:
+
+ /// Our copy of the ORB core...
+ TAO_ORB_Core *orb_core_;
+
+ /// The message type that we are going to process..
+ CORBA::Octet message_type_;
+
+ /// The pay load size
+ CORBA::ULong message_size_;
+
+ /// The byte order..
+ /// @note GIOP lite cannot work between heterogenous platforms..
+ CORBA::Octet byte_order_;
+
+ TAO_OutputCDR cdr_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /*TAO_GIOP_MESSAGE_LITE_H*/
diff --git a/TAO/tao/GIOP_Message_Locate_Header.cpp b/TAO/tao/GIOP_Message_Locate_Header.cpp
new file mode 100644
index 00000000000..b4889f39b7c
--- /dev/null
+++ b/TAO/tao/GIOP_Message_Locate_Header.cpp
@@ -0,0 +1,11 @@
+//$Id$
+
+#include "tao/GIOP_Message_Locate_Header.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/GIOP_Message_Locate_Header.i"
+#endif /* __ACE_INLINE__ */
+
+ACE_RCSID (tao,
+ GIOP_Message_Locate_Header,
+ "$Id$")
diff --git a/TAO/tao/GIOP_Message_Locate_Header.h b/TAO/tao/GIOP_Message_Locate_Header.h
new file mode 100644
index 00000000000..8604a1239a8
--- /dev/null
+++ b/TAO/tao/GIOP_Message_Locate_Header.h
@@ -0,0 +1,82 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file GIOP_Message_Locate_Header.h
+ *
+ * $Id$
+ *
+ * Some assorted GIOP structure mappings
+ *
+ *
+ * @author Balachandran Natarajan <bala@cs.wustl.edu>
+ */
+//=============================================================================
+
+
+#ifndef TAO_GIOP_MESSAGE_LOCATE_HEADER_H
+#define TAO_GIOP_MESSAGE_LOCATE_HEADER_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Tagged_Profile.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_GIOP_Locate_Request_Header
+ *
+ * @brief Location service support
+ */
+class TAO_Export TAO_GIOP_Locate_Request_Header
+{
+public:
+
+ /// Constructor
+ TAO_GIOP_Locate_Request_Header (TAO_InputCDR &msg,
+ TAO_ORB_Core *core);
+
+ /// Set the id
+ void request_id (CORBA::ULong id);
+
+ /// Get the request id
+ CORBA::ULong request_id (void);
+
+ /// Get the object_key in read mode..
+ const TAO::ObjectKey &object_key (void) const;
+
+ /// Get the object_key in read/write mode..
+ TAO::ObjectKey &object_key (void);
+
+ /// Get the reference to the underlying profile
+ TAO_Tagged_Profile &profile (void);
+
+ /// Get the CDR stream for read/write
+ TAO_InputCDR &incoming_stream (void);
+
+private:
+ /// Request id
+ CORBA::ULong request_id_;
+
+ /// Profile info.
+ TAO_Tagged_Profile profile_;
+
+ /// Object Key
+ TAO::ObjectKey object_key_;
+
+ /// Incoming CDR stream
+ TAO_InputCDR *incoming_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/GIOP_Message_Locate_Header.i"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+#endif /*TAO_GIOP_MESSAGE_LOCATE_HEADER_H*/
diff --git a/TAO/tao/GIOP_Message_Locate_Header.i b/TAO/tao/GIOP_Message_Locate_Header.i
new file mode 100644
index 00000000000..d59598e5919
--- /dev/null
+++ b/TAO/tao/GIOP_Message_Locate_Header.i
@@ -0,0 +1,53 @@
+// -*- C++ -*-
+//
+//$Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO_GIOP_Locate_Request_Header::TAO_GIOP_Locate_Request_Header (
+ TAO_InputCDR &msg,
+ TAO_ORB_Core *orb)
+ : request_id_ (0),
+ profile_ (orb),
+ incoming_ (&msg)
+{
+}
+
+ACE_INLINE void
+TAO_GIOP_Locate_Request_Header::request_id (CORBA::ULong id)
+{
+ this->request_id_ = id;
+}
+
+ACE_INLINE CORBA::ULong
+TAO_GIOP_Locate_Request_Header::request_id (void)
+{
+ return this->request_id_;
+}
+
+ACE_INLINE const TAO::ObjectKey &
+TAO_GIOP_Locate_Request_Header::object_key (void) const
+{
+ return this->profile_.object_key ();
+}
+
+ACE_INLINE TAO::ObjectKey &
+TAO_GIOP_Locate_Request_Header::object_key (void)
+{
+ return this->profile_.object_key ();
+}
+
+ACE_INLINE TAO_Tagged_Profile &
+TAO_GIOP_Locate_Request_Header::profile (void)
+{
+ return this->profile_;
+}
+
+ACE_INLINE TAO_InputCDR &
+TAO_GIOP_Locate_Request_Header::incoming_stream (void)
+{
+ return *this->incoming_;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/GIOP_Message_State.cpp b/TAO/tao/GIOP_Message_State.cpp
new file mode 100644
index 00000000000..19f591b623c
--- /dev/null
+++ b/TAO/tao/GIOP_Message_State.cpp
@@ -0,0 +1,267 @@
+// $Id$
+
+#include "tao/GIOP_Message_State.h"
+#include "tao/debug.h"
+#include "tao/GIOP_Message_Base.h"
+
+#include "ace/Log_Msg.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/GIOP_Message_State.inl"
+#endif /* __ACE_INLINE__ */
+
+ACE_RCSID (tao,
+ GIOP_Message_State,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_GIOP_Message_State::TAO_GIOP_Message_State (void)
+ : giop_version_ (TAO_DEF_GIOP_MAJOR,
+ TAO_DEF_GIOP_MINOR),
+ byte_order_ (0),
+ message_type_ (0),
+ message_size_ (0),
+ more_fragments_ (0),
+ missing_data_ (0)
+{
+}
+
+
+int
+TAO_GIOP_Message_State::parse_message_header (ACE_Message_Block &incoming)
+{
+ if (incoming.length () >= TAO_GIOP_MESSAGE_HEADER_LEN)
+ {
+ // Parse the GIOP header
+ return this->parse_message_header_i (incoming);
+ }
+
+ // One indicates that we didn't have enough data in the message to
+ // parse the header
+ return 1;
+}
+
+int
+TAO_GIOP_Message_State::parse_message_header_i (ACE_Message_Block &incoming)
+{
+ if (TAO_debug_level > 8)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - GIOP_Message_State::parse_message_header_i\n"
+ ));
+ }
+
+ // Grab the rd_ptr_ from the message block..
+ char *buf = incoming.rd_ptr ();
+
+ // Parse the magic bytes first
+ if (this->parse_magic_bytes (buf) == -1)
+ {
+ return -1;
+ }
+
+ // Get the version information
+ if (this->get_version_info (buf) == -1)
+ return -1;
+
+ // Get the byte order information...
+ if (this->get_byte_order_info (buf) == -1)
+ return -1;
+
+ // Get the message type
+ this->message_type_ = buf[TAO_GIOP_MESSAGE_TYPE_OFFSET];
+
+ // Get the size of the message..
+ this->get_payload_size (buf);
+
+ if (this->message_size_ == 0)
+ {
+ if (this->message_type_ == TAO_GIOP_MESSAGERROR)
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) -"
+ "GIOP_MESSAGE_ERROR received \n"));
+ }
+ return 0;
+ }
+ else
+ {
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - "
+ "Message of size zero recd. \n"));
+ return -1;
+ }
+ }
+
+ return 0; // success
+}
+
+
+
+
+int
+TAO_GIOP_Message_State::parse_magic_bytes (char *buf)
+{
+ // The values are hard-coded to support non-ASCII platforms.
+ if (!(buf [0] == 0x47 // 'G'
+ && buf [1] == 0x49 // 'I'
+ && buf [2] == 0x4f // 'O'
+ && buf [3] == 0x50)) // 'P'
+ {
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - ")
+ ACE_TEXT ("TAO_GIOP_Message_State::parse_magic_bytes, ")
+ ACE_TEXT ("bad header: ")
+ ACE_TEXT ("magic word [%02x,%02x,%02x,%02x]\n"),
+ buf[0],
+ buf[1],
+ buf[2],
+ buf[3]));
+ return -1;
+ }
+
+ return 0;
+}
+
+int
+TAO_GIOP_Message_State::get_version_info (char *buf)
+{
+ if (TAO_debug_level > 8)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - GIOP_Message_State::get_version_info\n"));
+ }
+
+ // We have a GIOP message on hand. Get its revision numbers
+ CORBA::Octet incoming_major =
+ buf[TAO_GIOP_VERSION_MAJOR_OFFSET];
+ CORBA::Octet incoming_minor =
+ buf[TAO_GIOP_VERSION_MINOR_OFFSET];
+
+ // Check the revision information
+ if (TAO_GIOP_Message_Generator_Parser_Impl::check_revision (
+ incoming_major,
+ incoming_minor) == 0)
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - bad version <%d.%d>\n"),
+ incoming_major, incoming_minor));
+ }
+
+ return -1;
+ }
+
+ // Set the version
+ this->giop_version_.minor = incoming_minor;
+ this->giop_version_.major = incoming_major;
+
+ return 0;
+}
+
+int
+TAO_GIOP_Message_State::get_byte_order_info (char *buf)
+{
+ if (TAO_debug_level > 8)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - GIOP_Message_State::get_byte_order_info\n") ));
+ }
+
+ // Let us be specific that this is for 1.0
+ if (this->giop_version_.minor == 0 &&
+ this->giop_version_.major == 1)
+ {
+ this->byte_order_ =
+ buf[TAO_GIOP_MESSAGE_FLAGS_OFFSET];
+
+ if (this->byte_order_ != 0 &&
+ this->byte_order_ != 1)
+ {
+ if (TAO_debug_level > 2)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - GIOP_Message_State::get_byte_order_info, ")
+ ACE_TEXT ("invalid byte order <%d> for version <1.0>\n"),
+ this->byte_order_));
+ }
+ return -1;
+ }
+ }
+ else
+ {
+ // Read the byte ORDER
+ this->byte_order_ =
+ (CORBA::Octet) (buf[TAO_GIOP_MESSAGE_FLAGS_OFFSET]& 0x01);
+
+ // Read the fragment bit
+ this->more_fragments_ =
+ (CORBA::Octet) (buf[TAO_GIOP_MESSAGE_FLAGS_OFFSET]& 0x02);
+
+ if ((buf[TAO_GIOP_MESSAGE_FLAGS_OFFSET] & ~0x3) != 0)
+ {
+ if (TAO_debug_level > 2)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - invalid flags for <%d> ")
+ ACE_TEXT ("for version <%d %d> \n"),
+ buf[TAO_GIOP_MESSAGE_FLAGS_OFFSET],
+ this->giop_version_.major,
+ this->giop_version_.minor));
+ }
+ return -1;
+ }
+ }
+
+ return 0;
+}
+
+void
+TAO_GIOP_Message_State::get_payload_size (char *rd_ptr)
+{
+ // Move the read pointer
+ rd_ptr += TAO_GIOP_MESSAGE_SIZE_OFFSET;
+
+ this->message_size_ = this->read_ulong (rd_ptr);
+}
+
+CORBA::ULong
+TAO_GIOP_Message_State::read_ulong (const char *rd_ptr) const
+{
+ CORBA::ULong x = 0;
+
+ // We don't need to do this sort of copy. But some compilers (read it
+ // as SunCC) have a problem in deferencing from the
+ // reinterpret_cast pointer of the <rd_ptr>, as the <rd_ptr> can be
+ // on stack. So let us go ahead with this copying...
+ char buf[] =
+ {
+ *rd_ptr,
+ *(rd_ptr + 1),
+ *(rd_ptr + 2),
+ *(rd_ptr + 3)
+ };
+
+#if !defined (ACE_DISABLE_SWAP_ON_READ)
+ if (!(this->byte_order_ != ACE_CDR_BYTE_ORDER))
+ {
+ x = *reinterpret_cast<ACE_CDR::ULong*> (buf);
+ }
+ else
+ {
+ ACE_CDR::swap_4 (buf, reinterpret_cast<char*> (&x));
+ }
+#else
+ x = *reinterpret_cast<ACE_CDR::ULong*> (buf);
+#endif /* ACE_DISABLE_SWAP_ON_READ */
+
+ return x;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/GIOP_Message_State.h b/TAO/tao/GIOP_Message_State.h
new file mode 100644
index 00000000000..9de7eee5b7e
--- /dev/null
+++ b/TAO/tao/GIOP_Message_State.h
@@ -0,0 +1,136 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file GIOP_Message_State.h
+ *
+ * $Id$
+ *
+ * GIOP utility definitions
+ *
+ *
+ * @author Chris Cleeland <cleeland@cs.wustl.edu>
+ * @author Carlos O' Ryan <coryan@uci.edu>
+ * @author Balachandran Natarajan <bala@cs.wustl.edu>
+ */
+//=============================================================================
+#ifndef TAO_GIOP_MESSAGE_STATE_H
+#define TAO_GIOP_MESSAGE_STATE_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/GIOP_Message_Version.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_ORB_Core;
+class TAO_GIOP_Message_Base;
+
+
+/**
+ * @class TAO_GIOP_Message_State
+ *
+ * @brief Generic definitions for Message States.
+ *
+ * This helps to establish the state of the incoming messages.
+ */
+
+class TAO_Export TAO_GIOP_Message_State
+{
+public:
+
+ /// Ctor
+ TAO_GIOP_Message_State (void);
+
+ /// Parse the message header.
+ ///
+ /// \return -1 There was some error parsing the GIOP header
+ /// \return 0 The GIOP header was parsed correctly
+ /// \return 1 There was not enough data in the message block to
+ /// parse the header
+ int parse_message_header (ACE_Message_Block &incoming);
+
+ /// Return the message size
+ CORBA::ULong message_size (void) const;
+
+ /// Return the message size
+ CORBA::ULong payload_size (void) const;
+
+ /// Return the byte order information
+ CORBA::Octet byte_order (void) const;
+
+ /// Reset the state..
+ void reset (void);
+
+private:
+
+ friend class TAO_GIOP_Message_Base;
+
+ /// Parse the message header.
+ int parse_message_header_i (ACE_Message_Block &incoming);
+
+ /// Checks for the magic word 'GIOP' in the start of the incoing
+ /// stream
+ int parse_magic_bytes (char *buf);
+
+ /// Extracts the version information from the incoming
+ /// stream. Performs a check for whether the version information is
+ /// right and sets the information in the <state>
+ int get_version_info (char *buf);
+
+ /// Extracts the byte order information from the incoming
+ /// stream. Performs a check for whether the byte order information
+ /// right and sets the information in the <state>
+ int get_byte_order_info (char *buf);
+
+ /// Gets the size of the payload and set the size in the <state>
+ void get_payload_size (char *buf);
+
+ /// Read the unsigned long from the buffer. The <buf> should just
+ /// point to the next 4 bytes data that represent the ULong
+ CORBA::ULong read_ulong (const char *buf) const;
+
+private:
+ // GIOP version information..
+ TAO_GIOP_Message_Version giop_version_;
+
+ /// 0 = big, 1 = little
+ CORBA::Octet byte_order_;
+
+ /// MsgType above
+ CORBA::Octet message_type_;
+
+ /// in byte_order!
+ CORBA::ULong message_size_;
+
+ /// (Requests and Replys)
+ /// A value of zero indicates that this message does not have any
+ /// fragments. A value of non-zero indicates that it does have
+ /// fragments.
+ CORBA::Octet more_fragments_;
+
+ /// Missing data
+ CORBA::ULong missing_data_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+static const size_t TAO_GIOP_MESSAGE_HEADER_LEN = 12;
+static const size_t TAO_GIOP_MESSAGE_SIZE_OFFSET = 8;
+static const size_t TAO_GIOP_MESSAGE_FLAGS_OFFSET = 6;
+static const size_t TAO_GIOP_MESSAGE_TYPE_OFFSET = 7;
+static const size_t TAO_GIOP_VERSION_MINOR_OFFSET = 5;
+static const size_t TAO_GIOP_VERSION_MAJOR_OFFSET = 4;
+static const size_t TAO_GIOP_MESSAGE_FRAGMENT_HEADER = 4;
+
+#if defined (__ACE_INLINE__)
+# include "tao/GIOP_Message_State.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+#endif /*TAO_GIOP_MESSAGE_STATE_H*/
diff --git a/TAO/tao/GIOP_Message_State.inl b/TAO/tao/GIOP_Message_State.inl
new file mode 100644
index 00000000000..2de1bbb2b03
--- /dev/null
+++ b/TAO/tao/GIOP_Message_State.inl
@@ -0,0 +1,57 @@
+// -*- C++ -*-
+
+//$Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE CORBA::ULong
+TAO_GIOP_Message_State::message_size (void) const
+{
+ CORBA::ULong len =
+ this->message_size_ + TAO_GIOP_MESSAGE_HEADER_LEN;
+
+ return len;
+}
+
+ACE_INLINE CORBA::ULong
+TAO_GIOP_Message_State::payload_size (void) const
+{
+ return this->message_size_;
+}
+
+ACE_INLINE CORBA::Octet
+TAO_GIOP_Message_State::byte_order (void) const
+{
+ return this->byte_order_;
+}
+
+ACE_INLINE void
+TAO_GIOP_Message_State::reset (void)
+{
+ this->message_type_ = 0;
+ this->message_size_ = 0;
+ this->more_fragments_ = 0;
+ this->missing_data_ = 0;
+}
+
+#if 0
+ACE_INLINE int
+TAO_GIOP_Message_State::message_fragmented (void)
+{
+ if (this->more_fragments)
+ return 1;
+
+ return 0;
+}
+
+
+
+ACE_INLINE CORBA::Boolean
+TAO_GIOP_Message_State::header_received (void) const
+{
+ return this->message_size != 0;
+}
+
+#endif
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/GIOP_Message_Version.cpp b/TAO/tao/GIOP_Message_Version.cpp
new file mode 100644
index 00000000000..b7935f7ac71
--- /dev/null
+++ b/TAO/tao/GIOP_Message_Version.cpp
@@ -0,0 +1,10 @@
+//$Id$
+# include "tao/GIOP_Message_Version.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/GIOP_Message_Version.inl"
+#endif /* __ACE_INLINE__ */
+
+ACE_RCSID (tao,
+ GIOP_Message_Version,
+ "$Id$")
diff --git a/TAO/tao/GIOP_Message_Version.h b/TAO/tao/GIOP_Message_Version.h
new file mode 100644
index 00000000000..f563af8004d
--- /dev/null
+++ b/TAO/tao/GIOP_Message_Version.h
@@ -0,0 +1,75 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file GIOP_Message_Version.h
+ *
+ * $Id$
+ *
+ * GIOP Version utility class definition
+ *
+ *
+ * @author Chris Cleeland <cleeland@cs.wustl.edu>
+ * @author Carlos O' Ryan <coryan@uci.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_GIOP_MESSAGE_VERSION_H
+#define TAO_GIOP_MESSAGE_VERSION_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/TAO_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Basic_Types.h"
+#include "tao/orbconf.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_ORB_Core;
+
+/**
+ * @class TAO_GIOP_Message_Version
+ *
+ * @brief Major and Minor version number of the Inter-ORB Protocol.
+ */
+class TAO_Export TAO_GIOP_Message_Version
+{
+public:
+
+ /// Major version number
+ CORBA::Octet major;
+
+ /// Minor version number
+ CORBA::Octet minor;
+
+ /// Copy constructor
+ TAO_GIOP_Message_Version (const TAO_GIOP_Message_Version &src);
+
+ /// Default constructor.
+ TAO_GIOP_Message_Version (CORBA::Octet maj = TAO_DEF_GIOP_MAJOR,
+ CORBA::Octet min = TAO_DEF_GIOP_MINOR);
+
+ /// Explicitly set the major and minor version.
+ void set_version (CORBA::Octet maj, CORBA::Octet min);
+
+ /// Copy operator.
+ TAO_GIOP_Message_Version &operator= (const TAO_GIOP_Message_Version &src);
+
+ /// Equality operator
+ bool operator== (const TAO_GIOP_Message_Version &src);
+ bool operator!= (const TAO_GIOP_Message_Version &src);
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/GIOP_Message_Version.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+#endif /*TAO_GIOP_VERSION_H */
diff --git a/TAO/tao/GIOP_Message_Version.inl b/TAO/tao/GIOP_Message_Version.inl
new file mode 100644
index 00000000000..6328534b3fc
--- /dev/null
+++ b/TAO/tao/GIOP_Message_Version.inl
@@ -0,0 +1,59 @@
+// -*- C++ -*-
+//
+//$Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO_GIOP_Message_Version::TAO_GIOP_Message_Version (
+ const TAO_GIOP_Message_Version &src)
+ : major (src.major),
+ minor (src.minor)
+{
+}
+
+ACE_INLINE
+TAO_GIOP_Message_Version::TAO_GIOP_Message_Version (CORBA::Octet maj,
+ CORBA::Octet min)
+ : major (maj),
+ minor (min)
+{
+}
+
+ACE_INLINE TAO_GIOP_Message_Version &
+TAO_GIOP_Message_Version::operator= (
+ const TAO_GIOP_Message_Version &src)
+{
+ if (this != &src)
+ {
+ this->major = src.major;
+ this->minor = src.minor;
+ }
+
+ return *this;
+}
+
+
+ACE_INLINE void
+TAO_GIOP_Message_Version::set_version (CORBA::Octet maj,
+ CORBA::Octet min)
+{
+ this->major = maj;
+ this->minor = min;
+}
+
+ACE_INLINE bool
+TAO_GIOP_Message_Version::operator== (
+ const TAO_GIOP_Message_Version &src)
+{
+ return this->major == src.major && this->minor == src.minor;
+}
+
+ACE_INLINE bool
+TAO_GIOP_Message_Version::operator!= (
+ const TAO_GIOP_Message_Version &src)
+{
+ return !(*this == src);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/GIOP_Utils.cpp b/TAO/tao/GIOP_Utils.cpp
new file mode 100644
index 00000000000..595a6f85936
--- /dev/null
+++ b/TAO/tao/GIOP_Utils.cpp
@@ -0,0 +1,81 @@
+// $Id$
+
+#include "tao/GIOP_Utils.h"
+#include "tao/debug.h"
+#include "tao/Transport.h"
+#include "tao/CDR.h"
+
+ACE_RCSID (tao,
+ GIOP_Utils,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+int
+TAO_GIOP_Utils::read_bytes_input (TAO_Transport *transport,
+ TAO_InputCDR &input,
+ CORBA::ULong read_size,
+ ACE_Time_Value *value)
+{
+ // Grow the size of CDR stream
+ if (input.grow (read_size) == -1)
+ return -1;
+
+ // Read until all the header is received. There should be no
+ // problems with locking, the header is only a few bytes so they
+ // should all be available on the socket, otherwise there is a
+ // problem with the underlying transport, in which case we have more
+ // problems than just this small loop.
+ char *buf = input.rd_ptr ();
+ ssize_t n = 0;
+
+ for (CORBA::ULong t = read_size;
+ t != 0;
+ t -= n)
+ {
+ n = transport->recv (buf, t, value);
+ if (n == -1)
+ return -1;
+ else if (n == 0) // @@ TODO && errno != EWOULDBLOCK)
+ return -1;
+ buf += n;
+ }
+
+ return 1;
+}
+
+
+ssize_t
+TAO_GIOP_Utils::read_buffer (TAO_Transport *transport,
+ char *buf,
+ size_t len,
+ ACE_Time_Value *max_wait_time)
+{
+ ssize_t bytes_read = transport->recv (buf, len, max_wait_time);
+
+ if (bytes_read <= 0 && TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t|%N|%l) - %p,\n")
+ ACE_TEXT (" transport = %d, ")
+ ACE_TEXT ("bytes = %d, len = %d\n"),
+ ACE_TEXT ("read_buffer"),
+ transport->id (),
+ bytes_read,
+ len));
+
+ if (bytes_read == -1 && errno == ECONNRESET)
+ {
+ // @@ Is this OK??
+
+ // We got a connection reset (TCP RSET) from the other side,
+ // i.e., they didn't initiate a proper shutdown.
+ //
+ // Make it look like things are OK to the upper layer.
+ bytes_read = 0;
+ errno = 0;
+ }
+
+ return bytes_read;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/GIOP_Utils.h b/TAO/tao/GIOP_Utils.h
new file mode 100644
index 00000000000..392e73aafe8
--- /dev/null
+++ b/TAO/tao/GIOP_Utils.h
@@ -0,0 +1,155 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file GIOP_Utils.h
+ *
+ * $Id$
+ *
+ * GIOP utility definitions
+ *
+ *
+ * @author Chris Cleeland <cleeland@cs.wustl.edu>
+ * @author Carlos O' Ryan <coryan@uci.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_GIOP_UTILS_H
+#define TAO_GIOP_UTILS_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Object.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/IOP_IORC.h"
+
+ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+class ACE_Time_Value;
+ACE_END_VERSIONED_NAMESPACE_DECL
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Transport;
+
+/**
+ * All GIOP messages include a header and message type. Not
+ * really a message type, but needed to bring that information
+ * back somehow.
+ */
+typedef enum GIOP_Messages
+{
+ // = GIOP message types.
+ TAO_GIOP_REQUEST = 0, // sent by client.
+ TAO_GIOP_REPLY = 1, // by server.
+ TAO_GIOP_CANCELREQUEST = 2, // by client.
+ TAO_GIOP_LOCATEREQUEST = 3, // by client.
+ TAO_GIOP_LOCATEREPLY = 4,
+ TAO_GIOP_CLOSECONNECTION = 5,
+ TAO_GIOP_MESSAGERROR = 6, // by both.
+ TAO_GIOP_FRAGMENT = 7 // by both.
+} TAO_GIOP_Message_Type;
+
+
+typedef enum GIOP_LocateStatusType
+{
+ TAO_GIOP_UNKNOWN_OBJECT,
+ TAO_GIOP_OBJECT_HERE,
+ TAO_GIOP_OBJECT_FORWARD,
+ TAO_GIOP_OBJECT_FORWARD_PERM, //GIOP1.2
+ TAO_GIOP_LOC_SYSTEM_EXCEPTION, // GIOP1.2
+ TAO_GIOP_LOC_NEEDS_ADDRESSING_MODE //GIOP 1.2
+}TAO_GIOP_Locate_Status_Type;
+
+/**
+ * @class TAO_GIOP_Locate_Status_Msg
+ *
+ * @brief Hold the relevant information for every type of Locate mesg.
+ *
+ * This class is there to hold the relevant info for different
+ * types of locate status messages. As on date we dont know much
+ * about other mesg types other than OBJECT_FORWARD. This clss can
+ * be clearly defined as time progresses.
+ */
+class TAO_Export TAO_GIOP_Locate_Status_Msg
+{
+public:
+ /// The value will need to be used when the Message type is
+ /// TAO_GIOP_OBJECT_FORWARD
+ CORBA::Object_var forward_location_var;
+
+ /// Stype of Locate status message
+ ///@@ Other mesg types.
+ TAO_GIOP_Locate_Status_Type status;
+};
+
+
+typedef enum GIOP_ReplyStatusType
+{
+ /// Request completed successfully
+ TAO_GIOP_NO_EXCEPTION,
+
+ /// Request terminated with user exception
+ TAO_GIOP_USER_EXCEPTION,
+
+ /// Request terminated with system exception
+ TAO_GIOP_SYSTEM_EXCEPTION,
+
+ /// Reply is a location forward type
+ TAO_GIOP_LOCATION_FORWARD,
+
+ /// GIOP 1.2, Reply is a location forward perm type..
+ TAO_GIOP_LOCATION_FORWARD_PERM,
+
+ /// GIOP1.2,
+ TAO_GIOP_NEEDS_ADDRESSING_MODE
+
+} TAO_GIOP_Reply_Status_Type;
+
+
+/**
+ * @class TAO_GIOP_ReplyHeader
+ *
+ * @brief This class embodies the header of a GIOP reply.
+ * @@Not used. Could be used in future
+ */
+class TAO_Export TAO_GIOP_ReplyHeader
+{
+public:
+ /// Information
+ IOP::ServiceContextList service_info;
+
+ /// Unique identifier of the request for which this is a reply.
+ CORBA::ULong request_id;
+
+ /// Status of the reply (see above enum).
+ TAO_GIOP_Reply_Status_Type reply_status;
+};
+
+/**
+ * @class TAO_GIOP_Utils
+ *
+ * @brief Utility class that has some commonly used methods for both GIOP
+ * Base & GIOP lite
+ */
+class TAO_Export TAO_GIOP_Utils
+{
+public:
+ static int read_bytes_input (TAO_Transport *transport,
+ TAO_InputCDR &cdr,
+ CORBA::ULong buf_size,
+ ACE_Time_Value *value = 0);
+
+ static ssize_t read_buffer (TAO_Transport *transport,
+ char *buf,
+ size_t len,
+ ACE_Time_Value *max_wait_time = 0);
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /*TAO_GIOP_UTILS_H */
diff --git a/TAO/tao/GUIResource_Factory.cpp b/TAO/tao/GUIResource_Factory.cpp
new file mode 100644
index 00000000000..a94f2e97302
--- /dev/null
+++ b/TAO/tao/GUIResource_Factory.cpp
@@ -0,0 +1,59 @@
+//$Id$
+#include "tao/GUIResource_Factory.h"
+#include "ace/Reactor.h"
+#include "tao/debug.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ GUIResource_Factory::GUIResource_Factory (void)
+ : dynamically_allocated_reactor_ (0)
+ {
+ }
+
+ GUIResource_Factory::~GUIResource_Factory (void)
+ {
+ }
+
+ ACE_Reactor *
+ GUIResource_Factory::get_reactor (void)
+ {
+ // @@Marek, do we need a lock here??
+ // @Bala, I suppose we don't need locking for any
+ // reasonable use case as this
+ // factory is intended to be a variable in TSS.
+ // I can imagine that someone may try to use it in distinct
+ // threads, though I do not know
+ // what for. Nevertheless, just for a case I sync the creation of reactor.
+ // I think, that double checked locking is
+ // not necessary, because the performance is not an issue here.
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->lock_, 0);
+
+ ACE_Reactor *reactor = 0;
+ ACE_NEW_RETURN (reactor,
+ ACE_Reactor (this->reactor_impl (), 1),
+ 0);
+
+ if (reactor->initialized () == 0)
+ {
+ delete reactor;
+ reactor = 0;
+ }
+ else
+ this->dynamically_allocated_reactor_ = 1;
+
+ return reactor;
+ }
+
+ void
+ GUIResource_Factory::reclaim_reactor (ACE_Reactor *reactor)
+ {
+ ACE_GUARD ( TAO_SYNCH_MUTEX, ace_mon, this->lock_ );
+
+ if (this->dynamically_allocated_reactor_ == 1)
+ delete reactor;
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/GUIResource_Factory.h b/TAO/tao/GUIResource_Factory.h
new file mode 100644
index 00000000000..134f8bfa88a
--- /dev/null
+++ b/TAO/tao/GUIResource_Factory.h
@@ -0,0 +1,100 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file GUIResource_Factory.h
+ *
+ * $Id$
+ *
+ * @author Balachandran Natarajan <bala@cs.wustl.edu>
+ * @author Marek Brudka <mbrudka@aster.pl>
+ */
+//=============================================================================
+
+#ifndef TAO_GUI_RESOURCE_FACTORY_H
+#define TAO_GUI_RESOURCE_FACTORY_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/TAO_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/orbconf.h"
+
+#include "ace/Thread_Mutex.h"
+
+ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+class ACE_Reactor_Impl;
+class ACE_Reactor;
+ACE_END_VERSIONED_NAMESPACE_DECL
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ /** Abstract base class for the GUI resource factory.
+ *
+ * This base class for resource factories which provide
+ * GUIReactors integrated with specific GUI
+ * event loop. In general, children of this class reimplement
+ * reactor_impl method where specific
+ * GUIReactor is created. GUIResource_Factory are usually
+ * created by GUIResource_Loader subclasses.
+ * Children of this class will be held in TSS by the ORB Core.
+ */
+ class TAO_Export GUIResource_Factory
+ {
+ public:
+
+ GUIResource_Factory ();
+
+ virtual ~GUIResource_Factory ();
+
+ /** Create ACE_Reactor using allocate_reactor_impl.
+ * Please note that this call is NOT synchronized. Left to the
+ * higher level versions to synchronize access.
+ */
+ virtual ACE_Reactor *get_reactor (void) ;
+
+ /** Reclaim the reactor if allocated by this factory.
+ * Please note that this call is NOT synchronized. Left to the
+ * higher level versions to synchronize access.
+ */
+ virtual void reclaim_reactor (ACE_Reactor *);
+
+ protected:
+
+ /** Create or return current reactor instance.
+ * Please note that this call is NOT synchronized. Left to the
+ * get_reactor to synchronize access.
+ */
+ virtual ACE_Reactor_Impl *reactor_impl (void) = 0;
+
+ private:
+
+ /**
+ * Flag that is set to 1 if the reactor obtained from the
+ * get_reactor() method is dynamically allocated. If this flag is
+ * set to 1, then the reclaim_reactor() method with call the delete
+ * operator on the given reactor. This flag is necessary to make
+ * sure that a reactor not allocated by the default resource factory
+ * is not reclaimed by the default resource factory. Such a
+ * situation can occur when a resource factory derived from the
+ * default one overrides the get_reactor() method but does not
+ * override the reclaim_reactor() method.
+ */
+ int dynamically_allocated_reactor_;
+
+ /// for internal locking.
+ TAO_SYNCH_MUTEX lock_;
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_GUI_RESOURCE_FACTORY_H */
diff --git a/TAO/tao/Generic_Sequence_T.h b/TAO/tao/Generic_Sequence_T.h
new file mode 100644
index 00000000000..96fa3abc2da
--- /dev/null
+++ b/TAO/tao/Generic_Sequence_T.h
@@ -0,0 +1,320 @@
+#ifndef guard_generic_sequence_hpp
+#define guard_generic_sequence_hpp
+/**
+ * @file
+ *
+ * @brief Implement the generic version of CORBA sequences.
+ *
+ * All CORBA sequences are based on this class template. The behavior
+ * of this class is controlled by two sets of traits. First, the
+ * ALLOCATION_TRAITS control how buffers are allocated and
+ * initialized. Since this is where most of the variation between
+ * unbounded and bounded sequences is found, the ALLOCATION_TRAITS can
+ * be thought as the bounded aspect of the sequence.
+ *
+ * Second, the element traits control how are elements copied,
+ * initialized and released. Value-like types, such as integers and
+ * structures, have trivial initialization and release requirements
+ * (their constructor/destructors do the job!) But reference-like
+ * types, such as strings and object references, have more complicated
+ * requirements. This is yet another aspect of the sequences, we can
+ * call it the "element copy semantics" or something.
+ *
+ * Oh, and let us not forget the type that the sequences encapsulates.
+ *
+ * The intent is not for sequences to simply derive or instantiate this
+ * type. Instead, different each sequence type is written using
+ * composition. They instantiate a generic sequence with the correct
+ * traits, and implement the adapt the generic sequence interface to
+ * whatever requirements the spec may impose. For example, replace()
+ * has different number of arguments in bounded vs. unbounded
+ * sequences, and operator[] returns different types depending on the
+ * underlying type of the sequence.
+ *
+ * This class offers the strong exception-safety guarantee, as long as
+ * destructors and release operations do not throw.
+ *
+ * This class is not thread-safe. Thread-safe collections are mostly
+ * useless anyways.
+ *
+ * In general the performance characteristics of the class depends on
+ * the traits. Obviously, they can only be expressed on the number of
+ * element constructor and destructor calls. If the constructor takes
+ * O(K) time that is not the sequence fault!
+ *
+ * All accessors are O(1), single-element modifiers are O(1), multiple
+ * element modifiers are O(n + m) where n is the number of elements
+ * originally in the sequence, and m is the number of elements left in
+ * the sequence afterwards.
+ *
+ * Beware:
+ * - get_buffer(true) may modify multiple elements
+ * - length(CORBA::ULong) may modify multiple elements!
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan
+ */
+
+#include "tao/Range_Checking_T.h"
+
+#include <algorithm>
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+namespace details
+{
+
+template<typename T,
+ class ALLOCATION_TRAITS,
+ class ELEMENT_TRAITS>
+class generic_sequence
+{
+public:
+ typedef T value_type;
+ typedef ALLOCATION_TRAITS allocation_traits;
+ typedef ELEMENT_TRAITS element_traits;
+ typedef range_checking<value_type,true> range;
+
+ /// Default constructor.
+ generic_sequence()
+ : maximum_(allocation_traits::default_maximum())
+ , length_(0)
+ , buffer_(allocation_traits::default_buffer_allocation())
+ , release_(true)
+ {
+ }
+
+ /// Constructor with control of ownership.
+ explicit generic_sequence(CORBA::ULong maximum)
+ : maximum_(maximum)
+ , length_(0)
+ , buffer_(allocbuf(maximum_))
+ , release_(true)
+ {
+ }
+
+ generic_sequence(
+ CORBA::ULong maximum,
+ CORBA::ULong length,
+ value_type * data,
+ CORBA::Boolean release)
+ : maximum_(maximum)
+ , length_(length)
+ , buffer_(data)
+ , release_(release)
+ {
+ }
+
+ /// Copy constructor
+ generic_sequence(generic_sequence const & rhs)
+ : maximum_(0)
+ , length_(0)
+ , buffer_(0)
+ , release_(false)
+ {
+ generic_sequence tmp(rhs.maximum_);
+ tmp.length_ = rhs.length_;
+ element_traits::copy_range(
+ rhs.buffer_, rhs.buffer_ + rhs.length_, tmp.buffer_);
+ swap(tmp);
+ }
+
+ /// Assignment operator
+ generic_sequence & operator=(generic_sequence const & rhs)
+ {
+ generic_sequence tmp(rhs);
+ swap(tmp);
+ return * this;
+ }
+
+ /// Destructor.
+ ~generic_sequence()
+ {
+ if (release_)
+ {
+ freebuf(buffer_);
+ }
+ }
+
+ /// Return the maximum length of the sequence
+ inline CORBA::ULong maximum() const
+ {
+ return maximum_;
+ }
+
+ /// Returns the state of the sequence release flag.
+ inline CORBA::Boolean release() const
+ {
+ return release_;
+ }
+
+ /// Returns the length of the sequence
+ inline CORBA::ULong length() const
+ {
+ return length_;
+ }
+
+ /// Set a new length for the sequence
+ void length(CORBA::ULong length)
+ {
+ if (length <= maximum_ || length <= length_)
+ {
+ if (length_ < length)
+ {
+ // TODO This code does not provide the strong-exception
+ // guarantee, but it does provide the weak-exception
+ // guarantee. The problem would appear when
+ // initialize_range() raises an exception after several
+ // elements have been modified. One could argue that
+ // this problem is irrelevant, as the elements already
+ // modified are unreachable to conforming applications.
+ element_traits::initialize_range(
+ buffer_ + length_, buffer_ + length);
+ }
+ length_ = length;
+ return;
+ }
+
+ generic_sequence tmp(length);
+ tmp.length_ = length;
+ element_traits::copy_range(
+ buffer_, buffer_ + length_, tmp.buffer_);
+ element_traits::initialize_range(
+ tmp.buffer_ + length_, tmp.buffer_ + length);
+
+ swap(tmp);
+ }
+
+ /// Get a const element from the sequence
+ value_type const & operator[](CORBA::ULong i) const
+ {
+ range::check(i, length_, maximum_, "operator[]() const");
+ return buffer_[i];
+ }
+
+ /// Get an element from the sequence
+ value_type & operator[](CORBA::ULong i)
+ {
+ range::check(i, length_, maximum_, "operator[]() non-const");
+ return buffer_[i];
+ }
+
+ /**
+ * Allows the buffer underlying a sequence to be replaced. The
+ * parameters to replace() are identical in type, order, and purpose
+ * to those for the <T *data> constructor for the sequence.
+ */
+ void replace(
+ CORBA::ULong maximum,
+ CORBA::ULong length,
+ value_type * data,
+ CORBA::Boolean release)
+ {
+ generic_sequence tmp(maximum, length, data, release);
+ swap(tmp);
+ }
+
+ /**
+ * This function allows read-only access to the sequence buffer.
+ * The sequence returns its buffer, allocating one of one has not
+ * yet been allocated. No direct modification of the returned
+ * buffer by the caller is permitted.
+ */
+ value_type const * get_buffer() const
+ {
+ if (buffer_ == 0)
+ {
+ buffer_ = allocbuf(maximum_);
+ }
+ return buffer_;
+ }
+
+ /// Allows read-write access to the underlying buffer.
+ /**
+ * If @a orphan is FALSE the sequence returns a pointer to its buffer,
+ * allocating one if it has not yet done so. The number of elements in the
+ * buffer can be determined from the sequence length() accessor.
+ *
+ * If the @a orphan argument to get_buffer() is FALSE, the sequence
+ * maintains ownership of the underlying buffer. Elements in the
+ * returned buffer may be directly replaced by the caller. For
+ * sequences of strings, wide strings, and object references, the
+ * caller must use the sequence <release> accessor to determine
+ * whether elements should be freed (using <string_free>,
+ * <wstring_free>, or <CORBA::release> for strings, wide strings,
+ * and object references, respective) before being directly assigned
+ * to.
+ *
+ * If the @a orphan argument to @a get_buffer is TRUE, the sequence
+ * yields ownership of the buffer to the caller. If @a orphan is
+ * TRUE and the sequence does not own its buffer (i.e., its
+ * release_ flag is FALSE), the return value is a null pointer. If
+ * the buffer is taken from the sequence using this form of
+ * get_buffer(), the sequence reverts to the same state it would
+ * have if constructed using its default constructor. The caller
+ * becomes responsible for eventually freeing each element of the
+ * returned buffer (for strings, wide string, and object
+ * references), and then freeing the returned buffer itself using
+ * freebuf().
+ */
+ value_type * get_buffer(CORBA::Boolean orphan)
+ {
+ if (orphan && !release_)
+ {
+ return 0;
+ }
+ if (buffer_ == 0)
+ {
+ buffer_ = allocbuf(maximum_);
+ }
+ if (!orphan)
+ {
+ return buffer_;
+ }
+
+ generic_sequence tmp;
+ swap(tmp);
+ tmp.release_ = false;
+
+ return tmp.buffer_;
+ }
+
+ void swap(generic_sequence & rhs) throw()
+ {
+ std::swap(maximum_, rhs.maximum_);
+ std::swap(length_, rhs.length_);
+ std::swap(buffer_, rhs.buffer_);
+ std::swap(release_, rhs.release_);
+ }
+
+ static value_type * allocbuf(CORBA::ULong maximum)
+ {
+ return allocation_traits::allocbuf(maximum);
+ }
+
+ static void freebuf(value_type * buffer)
+ {
+ allocation_traits::freebuf(buffer);
+ }
+
+private:
+ /// The maximum number of elements the buffer can contain.
+ CORBA::ULong maximum_;
+ /// The current number of elements in the buffer.
+ CORBA::ULong length_;
+ /// The buffer with all the elements
+ mutable value_type * buffer_;
+ /// If true then the sequence should release the buffer when it is
+ /// destroyed.
+ CORBA::Boolean release_;
+};
+
+} // namespace details
+} // namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif // guard_generic_sequence_hpp
diff --git a/TAO/tao/IFR_Client.mpc b/TAO/tao/IFR_Client.mpc
new file mode 100644
index 00000000000..073a6a286cf
--- /dev/null
+++ b/TAO/tao/IFR_Client.mpc
@@ -0,0 +1,45 @@
+//$Id$
+project : taolib, core, core_anytypecode, tao_versioning_idl_defaults {
+ sharedname = TAO_IFR_Client
+ dynamicflags = TAO_IFR_CLIENT_BUILD_DLL
+
+ Source_Files {
+ IFR_Client
+ }
+
+ Header_Files {
+ IFR_Client
+ }
+
+ Inline_Files {
+ IFR_Client
+ }
+
+ Template_Files {
+ IFR_Client
+ }
+
+ Resource_Files {
+ IFR_Client
+ }
+
+ PIDL_Files {
+ IFR_Client
+ }
+
+ IDL_Files {
+ idlflags += -SS -Ge 1 \
+ -Wb,stub_export_macro=TAO_IFR_Client_Export \
+ -Wb,stub_export_include=tao/IFR_Client/ifr_client_export.h \
+ -o IFR_Client
+ idlflags -= -Sa -St
+ IFR_Client/IFR_Base.pidl
+ IFR_Client/IFR_Basic.pidl
+ IFR_Client/IFR_Components.pidl
+ IFR_Client/IFR_Extended.pidl
+ }
+
+ Pkgconfig_Files {
+ IFR_Client/TAO_IFR_Client.pc.in
+ }
+}
diff --git a/TAO/tao/IFR_Client/IFR_Base.pidl b/TAO/tao/IFR_Client/IFR_Base.pidl
new file mode 100644
index 00000000000..754dadb1a90
--- /dev/null
+++ b/TAO/tao/IFR_Client/IFR_Base.pidl
@@ -0,0 +1,400 @@
+// -*- IDL -*-
+
+/**
+ * @file IFR_Base.pidl
+ *
+ * $Id$
+ *
+ * This file was used to generate the code in IFR_BaseC.{h,i,cpp}.
+ * The original file Interface.idl was split into four pieces, to
+ * keep the generated files to a manageable size and reduce build
+ * time. This IDL file contains the abstract base interfaces of
+ * the IFR as well as many of the non-interface data types used
+ * by all other IFR interfaces.
+ *
+ * The command used to generate code from this IDL file is:
+ *
+ * tao_idl -Ge 1 -GT -I../.. \
+ * -Wb,export_macro=TAO_IFR_Client_Export \
+ * -Wb,export_include=ifr_client_export.h \
+ * -Wb,pre_include="ace/pre.h" \
+ * -Wb,post_include="ace/post.h" \
+ * -Wb,versioning_begin=TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+ * -Wb,versioning_end=TAO_END_VERSIONED_NAMESPACE_DECL
+ * IFR_Base.pidl
+ *
+ * Only the stub files are used in the TAO_IFR_Client library. The
+ * skeleton files can be deleted from this directory.
+ *
+ * No patching of the generated stub files is necessary.
+ *
+ * To generate the skeleton files for the IFR Service, the command is:
+ *
+ * tao_idl -o ../../orbsvcs/orbsvcs/IFRService -Ge 1 \
+ * -Wb,pre_include="ace/pre.h" \
+ * -Wb,post_include="ace/post.h" \
+ * IFR_Base.pidl
+ *
+ * The only modification necessary to the skelton files is to
+ * change
+ *
+ * #include "IFR_BaseC.h"
+ *
+ * to
+ *
+ * #include "tao/IFR_Client/IFR_BaseC.h"
+ *
+ * in IFR_BaseS.h. The stub files may be deleted from the IFRService
+ * directory.
+ *
+ */
+
+#ifndef _IFR_BASE_IDL_
+#define _IFR_BASE_IDL_
+
+#include "tao/orb_types.pidl"
+#include "tao/Typecode_types.pidl"
+
+module CORBA
+{
+ typeprefix CORBA "omg.org";
+
+ typedef string ScopedName;
+
+ enum DefinitionKind
+ {
+ dk_none,
+ dk_all,
+ dk_Attribute,
+ dk_Constant,
+ dk_Exception,
+ dk_Interface,
+ dk_Module,
+ dk_Operation,
+ dk_Typedef,
+ dk_Alias,
+ dk_Struct,
+ dk_Union,
+ dk_Enum,
+ dk_Primitive,
+ dk_String,
+ dk_Sequence,
+ dk_Array,
+ dk_Repository,
+ dk_Wstring,
+ dk_Fixed,
+ dk_Value,
+ dk_ValueBox,
+ dk_ValueMember,
+ dk_Native,
+ dk_AbstractInterface,
+ dk_LocalInterface,
+ dk_Component,
+ dk_Home,
+ dk_Factory,
+ dk_Finder,
+ dk_Emits,
+ dk_Publishes,
+ dk_Consumes,
+ dk_Provides,
+ dk_Uses,
+ dk_Event
+ };
+
+ interface IRObject
+ {
+ // read interface
+ readonly attribute DefinitionKind def_kind;
+
+ // write interface
+ void destroy ();
+ };
+
+ typedef string VersionSpec;
+
+ interface Contained;
+ interface Repository;
+ interface Container;
+
+ interface Contained : IRObject
+ {
+ // read/write interface
+ attribute RepositoryId id;
+ attribute Identifier name;
+ attribute VersionSpec version;
+
+ // read interface
+ readonly attribute Container defined_in;
+ readonly attribute ScopedName absolute_name;
+ readonly attribute Repository containing_repository;
+
+ struct Description
+ {
+ DefinitionKind kind;
+ any value;
+ };
+
+ Description describe ();
+
+ // write interface
+ void move (
+ in Container new_container,
+ in Identifier new_name,
+ in VersionSpec new_version
+ );
+ };
+
+ interface ModuleDef;
+ interface ConstantDef;
+ interface IDLType;
+ interface StructDef;
+ interface UnionDef;
+ interface EnumDef;
+ interface AliasDef;
+
+ interface InterfaceDef;
+ typedef sequence<InterfaceDef> InterfaceDefSeq;
+
+ interface ExceptionDef;
+ interface NativeDef;
+
+ interface ValueDef;
+ typedef sequence<ValueDef> ValueDefSeq;
+
+ interface ValueBoxDef;
+
+ interface AbstractInterfaceDef;
+ typedef sequence<AbstractInterfaceDef> AbstractInterfaceDefSeq;
+
+ interface LocalInterfaceDef;
+ typedef sequence<LocalInterfaceDef> LocalInterfaceDefSeq;
+
+ interface ExtInterfaceDef;
+ typedef sequence <ExtInterfaceDef> ExtInterfaceDefSeq;
+
+ interface ExtValueDef;
+ typedef sequence <ExtValueDef> ExtValueDefSeq;
+
+ interface ExtAbstractInterfaceDef;
+ typedef sequence <ExtAbstractInterfaceDef>
+
+ ExtAbstractInterfaceDefSeq;
+ interface ExtLocalInterfaceDef;
+
+ typedef sequence <ExtLocalInterfaceDef>
+ ExtLocalInterfaceDefSeq;
+
+ typedef sequence <Contained> ContainedSeq;
+
+ struct StructMember
+ {
+ Identifier name;
+ TypeCode type;
+ IDLType type_def;
+ };
+
+ typedef sequence <StructMember> StructMemberSeq;
+
+ struct Initializer
+ {
+ StructMemberSeq members;
+ Identifier name;
+ };
+
+ typedef sequence <Initializer> InitializerSeq;
+
+ struct ExceptionDescription
+ {
+ Identifier name;
+ RepositoryId id;
+ RepositoryId defined_in;
+ VersionSpec version;
+ TypeCode type;
+ };
+
+ typedef sequence <ExceptionDescription> ExcDescriptionSeq;
+
+ struct ExtInitializer
+ {
+ StructMemberSeq members;
+ ExcDescriptionSeq exceptions;
+ Identifier name;
+ };
+
+ typedef sequence <ExtInitializer> ExtInitializerSeq;
+
+ struct UnionMember
+ {
+ Identifier name;
+ any label;
+ TypeCode type;
+ IDLType type_def;
+ };
+
+ typedef sequence <UnionMember> UnionMemberSeq;
+ typedef sequence <Identifier> EnumMemberSeq;
+
+ interface Container : IRObject
+ {
+ // read interface
+ Contained lookup (
+ in ScopedName search_name
+ );
+ ContainedSeq contents (
+ in DefinitionKind limit_type,
+ in boolean exclude_inherited
+ );
+ ContainedSeq lookup_name (
+ in Identifier search_name,
+ in long levels_to_search,
+ in DefinitionKind limit_type,
+ in boolean exclude_inherited
+ );
+ struct Description
+ {
+ Contained contained_object;
+ DefinitionKind kind;
+ any value;
+ };
+
+ typedef sequence<Description> DescriptionSeq;
+
+ DescriptionSeq describe_contents (
+ in DefinitionKind limit_type,
+ in boolean exclude_inherited,
+ in long max_returned_objs
+ );
+
+ // write interface
+
+ ModuleDef create_module (
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version
+ );
+
+ ConstantDef create_constant (
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in IDLType type,
+ in any value
+ );
+
+ StructDef create_struct (
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in StructMemberSeq members
+ );
+
+ UnionDef create_union (
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in IDLType discriminator_type,
+ in UnionMemberSeq members
+ );
+
+ EnumDef create_enum (
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in EnumMemberSeq members
+ );
+
+ AliasDef create_alias (
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in IDLType original_type
+ );
+
+ InterfaceDef create_interface (
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in InterfaceDefSeq base_interfaces
+ );
+
+ ValueDef create_value (
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in boolean is_custom,
+ in boolean is_abstract,
+ in ValueDef base_value,
+ in boolean is_truncatable,
+ in ValueDefSeq abstract_base_values,
+ in InterfaceDefSeq supported_interfaces,
+ in InitializerSeq initializers
+ );
+
+ ValueBoxDef create_value_box(
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in IDLType original_type_def
+ );
+
+ ExceptionDef create_exception(
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in StructMemberSeq members
+ );
+
+ NativeDef create_native(
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version
+ );
+
+ AbstractInterfaceDef create_abstract_interface (
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in AbstractInterfaceDefSeq base_interfaces
+ );
+
+ LocalInterfaceDef create_local_interface (
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in InterfaceDefSeq base_interfaces
+ );
+
+ ExtValueDef create_ext_value (
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in boolean is_custom,
+ in boolean is_abstract,
+ in ValueDef base_value,
+ in boolean is_truncatable,
+ in ValueDefSeq abstract_base_values,
+ in InterfaceDefSeq supported_interfaces,
+ in ExtInitializerSeq initializers
+ );
+ };
+
+ interface IDLType : IRObject
+ {
+ readonly attribute TypeCode type;
+ };
+
+ interface TypedefDef : Contained, IDLType
+ {
+ };
+
+ struct TypeDescription
+ {
+ Identifier name;
+ RepositoryId id;
+ RepositoryId defined_in;
+ VersionSpec version;
+ TypeCode type;
+ };
+};
+
+#endif /* _IFR_BASE_IDL_ */
diff --git a/TAO/tao/IFR_Client/IFR_BaseA.h b/TAO/tao/IFR_Client/IFR_BaseA.h
new file mode 100644
index 00000000000..96586934203
--- /dev/null
+++ b/TAO/tao/IFR_Client/IFR_BaseA.h
@@ -0,0 +1,44 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:390
+
+#ifndef _TAO_IDL_ORIG_IFR_BASEA_H
+#define _TAO_IDL_ORIG_IFR_BASEA_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/IFR_Client/IFR_BaseC.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include /**/ "ace/post.h"
+#endif /* ifndef */
+
diff --git a/TAO/tao/IFR_Client/IFR_Basic.pidl b/TAO/tao/IFR_Client/IFR_Basic.pidl
new file mode 100644
index 00000000000..82f7063c51f
--- /dev/null
+++ b/TAO/tao/IFR_Client/IFR_Basic.pidl
@@ -0,0 +1,424 @@
+ // -*- IDL -*-
+
+/**
+ * @file IFR_Basic.pidl
+ *
+ * $Id$
+ *
+ * This file was used to generate the code in IFR_BasicC.{h,inl,cpp}.
+ * The original file Interface.idl was split into four pieces, to
+ * keep the generated files to a manageable size and reduce build
+ * time. This IDL file contains the concrete base interfaces of
+ * the IFR, except for fixed types, valuetypes and CORBA components.
+ *
+ * The command used to generate code from this IDL file is:
+ *
+ * tao_idl -Ge 1 -GT -I../.. \
+ * -Wb,export_macro=TAO_IFR_Client_Export \
+ * -Wb,export_include=ifr_client_export.h \
+ * -Wb,pre_include="ace/pre.h" \
+ * -Wb,post_include="ace/post.h" \
+ * -Wb,versioning_begin=TAO_BEGIN_VERSIONED_NAMESPACE_DECL \
+ * -Wb,versioning_end=TAO_END_VERSIONED_NAMESPACE_DECL \
+ * IFR_Basic.pidl
+ *
+ * Only the stub files are used in the TAO_IFR_Client library. The
+ * skeleton files can be deleted from this directory.
+ *
+ * No patching of the generated stub files is necessary.
+ *
+ * To generate the skeleton files for the IFR Service, the command is:
+ *
+ * tao_idl -o ../../orbsvcs/orbsvcs/IFRService -Ge 1 \
+ * -Wb,pre_include="ace/pre.h" \
+ * -Wb,post_include="ace/post.h" \
+ * IFR_Basic.pidl
+ *
+ * The only modification necessary to the skeleton files is to
+ * change
+ *
+ * #include "IFR_BasicC.h"
+ *
+ * to
+ *
+ * #include "tao/IFR_Client/IFR_BasicC.h"
+ *
+ * in IFR_BasicS.h. The stub files may be deleted from the IFRService
+ * directory.
+ */
+
+#ifndef _IFR_BASIC_IDL_
+#define _IFR_BASIC_IDL_
+
+#include "tao/IFR_Client/IFR_Base.pidl"
+#include "tao/ParameterMode.pidl"
+
+module CORBA
+{
+ typeprefix CORBA "omg.org";
+
+ interface PrimitiveDef;
+ interface StringDef;
+ interface SequenceDef;
+ interface ArrayDef;
+ interface WstringDef;
+ interface FixedDef;
+
+ enum PrimitiveKind
+ {
+ pk_null,
+ pk_void,
+ pk_short,
+ pk_long,
+ pk_ushort,
+ pk_ulong,
+ pk_float,
+ pk_double,
+ pk_boolean,
+ pk_char,
+ pk_octet,
+ pk_any,
+ pk_TypeCode,
+ pk_Principal,
+ pk_string,
+ pk_objref,
+ pk_longlong,
+ pk_ulonglong,
+ pk_longdouble,
+ pk_wchar,
+ pk_wstring,
+ pk_value_base
+ };
+
+ interface Repository : Container
+ {
+ // read interface
+ Contained lookup_id (
+ in RepositoryId search_id
+ );
+ TypeCode get_canonical_typecode (
+ in TypeCode tc
+ );
+ PrimitiveDef get_primitive (
+ in PrimitiveKind kind
+ );
+ // write interface
+ StringDef create_string (
+ in unsigned long bound
+ );
+ WstringDef create_wstring (
+ in unsigned long bound
+ );
+ SequenceDef create_sequence (
+ in unsigned long bound,
+ in IDLType element_type
+ );
+ ArrayDef create_array (
+ in unsigned long length,
+ in IDLType element_type
+ );
+ FixedDef create_fixed (
+ in unsigned short digits,
+ in short scale
+ );
+ };
+
+ interface ModuleDef : Container, Contained
+ {
+ };
+
+ struct ModuleDescription
+ {
+ Identifier name;
+ RepositoryId id;
+ RepositoryId defined_in;
+ VersionSpec version;
+ };
+
+ interface ConstantDef : Contained
+ {
+ readonly attribute TypeCode type;
+ attribute IDLType type_def;
+ attribute any value;
+ };
+
+ struct ConstantDescription
+ {
+ Identifier name;
+ RepositoryId id;
+ RepositoryId defined_in;
+ VersionSpec version;
+ TypeCode type;
+ any value;
+ };
+
+ interface StructDef : TypedefDef, Container
+ {
+ attribute StructMemberSeq members;
+ };
+
+ interface UnionDef : TypedefDef, Container
+ {
+ readonly attribute TypeCode discriminator_type;
+ attribute IDLType discriminator_type_def;
+ attribute UnionMemberSeq members;
+ };
+
+ interface EnumDef : TypedefDef
+ {
+ attribute EnumMemberSeq members;
+ };
+
+ interface AliasDef : TypedefDef
+ {
+ attribute IDLType original_type_def;
+ };
+
+ interface NativeDef : TypedefDef
+ {
+ };
+
+ interface PrimitiveDef: IDLType
+ {
+ readonly attribute PrimitiveKind kind;
+ };
+
+ interface StringDef : IDLType
+ {
+ attribute unsigned long bound;
+ };
+
+ interface WstringDef : IDLType
+ {
+ attribute unsigned long bound;
+ };
+
+ interface SequenceDef : IDLType
+ {
+ attribute unsigned long bound;
+ readonly attribute TypeCode element_type;
+ attribute IDLType element_type_def;
+ };
+
+ interface ArrayDef : IDLType
+ {
+ attribute unsigned long length;
+ readonly attribute TypeCode element_type;
+ attribute IDLType element_type_def;
+ };
+
+ interface ExceptionDef : Contained, Container
+ {
+ readonly attribute TypeCode type;
+ attribute StructMemberSeq members;
+ };
+
+ typedef sequence <ExceptionDef> ExceptionDefSeq;
+
+ enum AttributeMode
+ {
+ ATTR_NORMAL,
+ ATTR_READONLY
+ };
+
+ interface AttributeDef : Contained
+ {
+ readonly attribute TypeCode type;
+ attribute IDLType type_def;
+ attribute AttributeMode mode;
+ };
+
+ struct AttributeDescription
+ {
+ Identifier name;
+ RepositoryId id;
+ RepositoryId defined_in;
+ VersionSpec version;
+ TypeCode type;
+ AttributeMode mode;
+ };
+
+ struct ExtAttributeDescription
+ {
+ Identifier name;
+ RepositoryId id;
+ RepositoryId defined_in;
+ VersionSpec version;
+ TypeCode type;
+ AttributeMode mode;
+ ExcDescriptionSeq get_exceptions;
+ ExcDescriptionSeq put_exceptions;
+ };
+
+ interface ExtAttributeDef : AttributeDef
+ {
+ // read/write interface
+ attribute ExcDescriptionSeq get_exceptions;
+ attribute ExcDescriptionSeq set_exceptions;
+ // read interface
+ ExtAttributeDescription describe_attribute ();
+ };
+
+ enum OperationMode
+ {
+ OP_NORMAL,
+ OP_ONEWAY
+ };
+
+// Already defined in corbafwd.h, included from orb.idl
+/*
+ enum ParameterMode
+ {
+ PARAM_IN,
+ PARAM_OUT,
+ PARAM_INOUT
+ };
+*/
+ struct ParameterDescription
+ {
+ Identifier name;
+ TypeCode type;
+ IDLType type_def;
+ ParameterMode mode;
+ };
+
+ typedef sequence <ParameterDescription> ParDescriptionSeq;
+ typedef Identifier ContextIdentifier;
+ typedef sequence <ContextIdentifier> ContextIdSeq;
+
+ interface OperationDef : Contained
+ {
+ readonly attribute TypeCode result;
+ attribute IDLType result_def;
+ attribute ParDescriptionSeq params;
+ attribute OperationMode mode;
+ attribute ContextIdSeq contexts;
+ attribute ExceptionDefSeq exceptions;
+ };
+
+ struct OperationDescription
+ {
+ Identifier name;
+ RepositoryId id;
+ RepositoryId defined_in;
+ VersionSpec version;
+ TypeCode result;
+ OperationMode mode;
+ ContextIdSeq contexts;
+ ParDescriptionSeq parameters;
+ ExcDescriptionSeq exceptions;
+ };
+
+ typedef sequence <RepositoryId> RepositoryIdSeq;
+ typedef sequence <OperationDescription> OpDescriptionSeq;
+ typedef sequence <AttributeDescription> AttrDescriptionSeq;
+ typedef sequence <ExtAttributeDescription> ExtAttrDescriptionSeq;
+
+ interface InterfaceDef : Container,
+ Contained,
+ IDLType
+ {
+ // read/write interface
+ attribute InterfaceDefSeq base_interfaces;
+ // read interface
+ boolean is_a (
+ in RepositoryId interface_id
+ );
+
+ struct FullInterfaceDescription
+ {
+ Identifier name;
+ RepositoryId id;
+ RepositoryId defined_in;
+ VersionSpec version;
+ OpDescriptionSeq operations;
+ AttrDescriptionSeq attributes;
+ RepositoryIdSeq base_interfaces;
+ TypeCode type;
+ };
+
+ FullInterfaceDescription describe_interface ();
+
+ // write interface
+ AttributeDef create_attribute (
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in IDLType type,
+ in AttributeMode mode
+ );
+ OperationDef create_operation (
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in IDLType result,
+ in OperationMode mode,
+ in ParDescriptionSeq params,
+ in ExceptionDefSeq exceptions,
+ in ContextIdSeq contexts
+ );
+ };
+
+ struct InterfaceDescription
+ {
+ Identifier name;
+ RepositoryId id;
+ RepositoryId defined_in;
+ VersionSpec version;
+ RepositoryIdSeq base_interfaces;
+ };
+
+ interface InterfaceAttrExtension
+ {
+ // read interface
+ struct ExtFullInterfaceDescription
+ {
+ Identifier name;
+ RepositoryId id;
+ RepositoryId defined_in;
+ VersionSpec version;
+ OpDescriptionSeq operations;
+ ExtAttrDescriptionSeq attributes;
+ RepositoryIdSeq base_interfaces;
+ TypeCode type;
+ };
+
+ ExtFullInterfaceDescription describe_ext_interface ();
+
+ // write interface
+ ExtAttributeDef create_ext_attribute (
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in IDLType type,
+ in AttributeMode mode,
+ in ExceptionDefSeq get_exceptions,
+ in ExceptionDefSeq set_exceptions
+ );
+ };
+
+ interface ExtInterfaceDef : InterfaceDef,
+ InterfaceAttrExtension
+ {
+ };
+
+ interface AbstractInterfaceDef : InterfaceDef
+ {
+ };
+
+ interface ExtAbstractInterfaceDef : AbstractInterfaceDef,
+ InterfaceAttrExtension
+ {
+ };
+
+ interface LocalInterfaceDef : InterfaceDef
+ {
+ };
+
+ interface ExtLocalInterfaceDef : LocalInterfaceDef,
+ InterfaceAttrExtension
+ {
+ };
+};
+
+#endif /* _IFR_BASIC_IDL_ */
diff --git a/TAO/tao/IFR_Client/IFR_BasicA.h b/TAO/tao/IFR_Client/IFR_BasicA.h
new file mode 100644
index 00000000000..f79b2d40fc4
--- /dev/null
+++ b/TAO/tao/IFR_Client/IFR_BasicA.h
@@ -0,0 +1,44 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:390
+
+#ifndef _TAO_IDL_ORIG_IFR_BASICA_H_
+#define _TAO_IDL_ORIG_IFR_BASICA_H_
+
+#include /**/ "ace/pre.h"
+
+#include "tao/IFR_Client/IFR_BasicC.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include /**/ "ace/post.h"
+#endif /* ifndef */
+
diff --git a/TAO/tao/IFR_Client/IFR_Client_Adapter_Impl.cpp b/TAO/tao/IFR_Client/IFR_Client_Adapter_Impl.cpp
new file mode 100644
index 00000000000..636c1adecd0
--- /dev/null
+++ b/TAO/tao/IFR_Client/IFR_Client_Adapter_Impl.cpp
@@ -0,0 +1,230 @@
+// $Id$
+
+#include "tao/IFR_Client/IFR_Client_Adapter_Impl.h"
+#include "tao/IFR_Client/IFR_BasicC.h"
+
+#include "tao/AnyTypeCode/NVList.h"
+#include "tao/AnyTypeCode/Any_Unknown_IDL_Type.h"
+
+#include "tao/ORB_Core.h"
+#include "tao/ORB.h"
+#include "tao/Invocation_Adapter.h"
+#include "tao/Stub.h"
+
+ACE_RCSID (IFR_Client,
+ IFR_Client_Adapter_Impl,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ template<>
+ class TAO_IFR_Client_Export Arg_Traits<CORBA::InterfaceDef>
+ : public
+ Object_Arg_Traits_T<
+ CORBA::InterfaceDef_ptr,
+ CORBA::InterfaceDef_var,
+ CORBA::InterfaceDef_out,
+ TAO::Objref_Traits<CORBA::InterfaceDef>,
+ TAO::Any_Insert_Policy_Stream <CORBA::InterfaceDef_ptr>
+ >
+ {
+ };
+}
+
+TAO_IFR_Client_Adapter_Impl::~TAO_IFR_Client_Adapter_Impl (void)
+{
+}
+
+CORBA::Boolean
+TAO_IFR_Client_Adapter_Impl::interfacedef_cdr_insert (
+ TAO_OutputCDR &cdr,
+ CORBA::InterfaceDef_ptr object_type
+ )
+{
+ return cdr << object_type;
+}
+
+void
+TAO_IFR_Client_Adapter_Impl::interfacedef_any_insert (
+ CORBA::Any *any,
+ CORBA::InterfaceDef_ptr object_type
+ )
+{
+ (*any) <<= object_type;
+}
+
+void
+TAO_IFR_Client_Adapter_Impl::dispose (
+ CORBA::InterfaceDef_ptr orphan
+ )
+{
+ ::CORBA::release (orphan);
+}
+
+CORBA::InterfaceDef_ptr
+TAO_IFR_Client_Adapter_Impl::get_interface (
+ CORBA::ORB_ptr orb,
+ const char *repo_id
+ ACE_ENV_ARG_DECL
+ )
+{
+ CORBA::Object_var obj =
+ orb->resolve_initial_references ("InterfaceRepository"
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::InterfaceDef::_nil ());
+
+ if (CORBA::is_nil (obj.in ()))
+ {
+ ACE_THROW_RETURN (CORBA::INTF_REPOS (),
+ CORBA::InterfaceDef::_nil ());
+ }
+
+ CORBA::Repository_var repo =
+ CORBA::Repository::_narrow (obj.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::InterfaceDef::_nil ());
+
+ if (CORBA::is_nil (repo.in ()))
+ {
+ ACE_THROW_RETURN (CORBA::INTF_REPOS (),
+ CORBA::InterfaceDef::_nil ());
+ }
+
+ CORBA::Contained_var result = repo->lookup_id (repo_id
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::InterfaceDef::_nil ());
+
+ if (CORBA::is_nil (result.in ()))
+ {
+ return CORBA::InterfaceDef::_nil ();
+ }
+ else
+ {
+ return CORBA::InterfaceDef::_narrow (result.in ()
+ ACE_ENV_ARG_PARAMETER);
+ }
+}
+
+CORBA::InterfaceDef_ptr
+TAO_IFR_Client_Adapter_Impl::get_interface_remote (
+ CORBA::Object_ptr target
+ ACE_ENV_ARG_DECL
+ )
+{
+ TAO::Arg_Traits<CORBA::InterfaceDef>::ret_val _tao_retval;
+
+ TAO::Argument *_tao_signature [] =
+ {
+ &_tao_retval
+ };
+
+ TAO::Invocation_Adapter _tao_call (
+ target,
+ _tao_signature,
+ 1,
+ "_interface",
+ 10,
+ 0
+ );
+
+ ACE_TRY
+ {
+ _tao_call.invoke (0, 0 ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK (_tao_retval.excp ());
+ }
+ ACE_CATCH (CORBA::OBJECT_NOT_EXIST, ex)
+ {
+ return CORBA::InterfaceDef::_nil ();
+ }
+ ACE_CATCHANY
+ {
+ ACE_RE_THROW;
+ }
+ ACE_ENDTRY;
+
+ return _tao_retval.retn ();
+}
+
+#if (TAO_HAS_MINIMUM_CORBA == 0)
+void
+TAO_IFR_Client_Adapter_Impl::create_operation_list (
+ CORBA::ORB_ptr orb,
+ CORBA::OperationDef_ptr opDef,
+ CORBA::NVList_ptr &result
+ ACE_ENV_ARG_DECL
+ )
+{
+ // Create an empty NVList.
+ orb->create_list (0,
+ result
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Get the parameters (if any) from the OperationDef, and for each
+ // parameter add a corresponding entry to the result.
+ CORBA::ParDescriptionSeq_var params =
+ opDef->params (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ CORBA::ULong paramCount = params->length ();
+
+ for (CORBA::ULong i = 0; i < paramCount; ++i)
+ {
+ CORBA::Any value;
+ TAO::Unknown_IDL_Type *unk = 0;
+ ACE_NEW (unk,
+ TAO::Unknown_IDL_Type (params[i].type.in ()));
+ value.replace (unk);
+
+ // Convert the parameter mode to an arg mode
+ CORBA::Flags flags = 0;
+ switch(params[i].mode)
+ {
+ case CORBA::PARAM_IN:
+ flags = CORBA::ARG_IN;
+ break;
+ case CORBA::PARAM_OUT:
+ flags = CORBA::ARG_OUT;
+ break;
+ case CORBA::PARAM_INOUT:
+ flags = CORBA::ARG_INOUT;
+ break;
+ default:
+ // Shouldn't happen
+ ACE_THROW (CORBA::INTERNAL());
+ }
+
+ // Add an argument to the NVList.
+ result->add_value (params[i].name.in (),
+ value,
+ flags);
+ }
+}
+
+#endif /*TAO_HAS_MINIMUM_CORBA*/
+// *********************************************************************
+
+// Initialization and registration of dynamic service object.
+
+int
+TAO_IFR_Client_Adapter_Impl::Initializer (void)
+{
+ TAO_ORB_Core::ifr_client_adapter_name ("Concrete_IFR_Client_Adapter");
+
+ return ACE_Service_Config::process_directive (ace_svc_desc_TAO_IFR_Client_Adapter_Impl);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DEFINE (
+ TAO_IFR_Client_Adapter_Impl,
+ ACE_TEXT ("Concrete_IFR_Client_Adapter"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (TAO_IFR_Client_Adapter_Impl),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0
+ )
+
+ACE_FACTORY_DEFINE (TAO_IFR_Client, TAO_IFR_Client_Adapter_Impl)
diff --git a/TAO/tao/IFR_Client/IFR_Client_Adapter_Impl.h b/TAO/tao/IFR_Client/IFR_Client_Adapter_Impl.h
new file mode 100644
index 00000000000..e3cfcd6b22d
--- /dev/null
+++ b/TAO/tao/IFR_Client/IFR_Client_Adapter_Impl.h
@@ -0,0 +1,96 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file IFR_Client_Adapter_Impl.h
+ *
+ * $Id$
+ *
+ * @author Jeff Parsons <parsons@cs.wustl.edu>
+ */
+//=============================================================================
+
+
+#ifndef TAO_IFR_CLIENT_ADAPTER_IMPL_H
+#define TAO_IFR_CLIENT_ADAPTER_IMPL_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/IFR_Client/ifr_client_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/IFR_Client_Adapter.h"
+
+#include "ace/Service_Config.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_IFR_Client_Adapter_Impl
+ *
+ * @brief TAO_IFR_Client_Adapter_Impl.
+ *
+ * Class that adapts various functions in the CORBA namespace
+ * which use the Interface Repository. This is the derived class
+ * that contains the actual implementations.
+ */
+class TAO_IFR_Client_Export TAO_IFR_Client_Adapter_Impl
+ : public TAO_IFR_Client_Adapter
+{
+public:
+ virtual ~TAO_IFR_Client_Adapter_Impl (void);
+
+ virtual CORBA::Boolean interfacedef_cdr_insert (
+ TAO_OutputCDR &cdr,
+ CORBA::InterfaceDef_ptr object_type
+ );
+
+ virtual void interfacedef_any_insert (
+ CORBA::Any *any,
+ CORBA::InterfaceDef_ptr object_type
+ );
+
+ virtual void dispose (
+ CORBA::InterfaceDef_ptr orphan
+ );
+
+ virtual CORBA::InterfaceDef_ptr get_interface (
+ CORBA::ORB_ptr orb,
+ const char *repo_id
+ ACE_ENV_ARG_DECL
+ );
+
+ virtual CORBA::InterfaceDef_ptr get_interface_remote (
+ CORBA::Object_ptr target
+ ACE_ENV_ARG_DECL
+ );
+
+#if (TAO_HAS_MINIMUM_CORBA == 0)
+ virtual void create_operation_list (
+ CORBA::ORB_ptr orb,
+ CORBA::OperationDef_ptr,
+ CORBA::NVList_ptr&
+ ACE_ENV_ARG_DECL
+ );
+#endif /*TAO_HAS_MINIMUM_CORBA*/
+
+ // Used to force the initialization of the ORB code.
+ static int Initializer (void);
+};
+
+static int
+TAO_Requires_IFR_Client_Initializer =
+ TAO_IFR_Client_Adapter_Impl::Initializer ();
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE (TAO_IFR_Client_Adapter_Impl)
+ACE_FACTORY_DECLARE (TAO_IFR_Client, TAO_IFR_Client_Adapter_Impl)
+
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_IFR_CLIENT_ADAPTER_IMPL_H */
diff --git a/TAO/tao/IFR_Client/IFR_Components.pidl b/TAO/tao/IFR_Client/IFR_Components.pidl
new file mode 100644
index 00000000000..bad6a63dbf7
--- /dev/null
+++ b/TAO/tao/IFR_Client/IFR_Components.pidl
@@ -0,0 +1,289 @@
+// -*- IDL -*-
+
+/**
+ * @file IFR_Components.pidl
+ *
+ * $Id$
+ *
+ * This file was used to generate the code in IFR_ComponentsC.{h,inl,cpp}.
+ * The original file Interface.idl was split into four pieces, to
+ * keep the generated files to a manageable size and reduce build
+ * time. This IDL file contains all the interfaces and other data
+ * types related to CORBA components.
+ *
+ * The command used to generate code from this IDL file is:
+ *
+ * tao_idl -Ge 1 -GT -I../.. \
+ * -Wb,export_macro=TAO_IFR_Client_Export \
+ * -Wb,export_include=ifr_client_export.h \
+ * -Wb,pre_include="ace/pre.h" \
+ * -Wb,post_include="ace/post.h" \
+ * -Wb,versioning_begin=TAO_BEGIN_VERSIONED_NAMESPACE_DECL \
+ * -Wb,versioning_end=TAO_END_VERSIONED_NAMESPACE_DECL \
+ * IFR_Components.pidl
+ *
+ * Only the stub files are used in the TAO_IFR_Client library. The
+ * skeleton files can be deleted from this directory.
+ *
+ * No patching of the generated stub files is necessary.
+ *
+ * To generate the skeleton files for the IFR Service, the command is:
+ *
+ * tao_idl -o ../../orbsvcs/orbsvcs/IFRService -Ge 1 \
+ * -Wb,pre_include="ace/pre.h" \
+ * -Wb,post_include="ace/post.h" \
+ * IFR_Components.pidl
+ *
+ * The only modification necessary to the skeleton files is to
+ * change
+ *
+ * #include "IFR_ComponentsC.h"
+ *
+ * to
+ *
+ * #include "tao/IFR_Client/IFR_ComponentsC.h"
+ *
+ * in IFR_ComponentsS.h. The stub files may be deleted from the IFRService
+ * directory.
+ *
+ */
+
+#ifndef _IFR_COMPONENTS_IDL_
+#define _IFR_COMPONENTS_IDL_
+
+#include "tao/IFR_Client/IFR_Extended.pidl"
+
+module CORBA
+{
+ typeprefix CORBA "omg.org";
+
+ module ComponentIR
+ {
+ interface ComponentDef;
+ interface HomeDef;
+
+ interface EventDef : ExtValueDef
+ {
+ };
+
+ interface Container : CORBA::Container
+ {
+ ComponentDef create_component (
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in ComponentDef base_component,
+ in InterfaceDefSeq supports_interfaces
+ );
+
+ HomeDef create_home (
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in HomeDef base_home,
+ in ComponentDef managed_component,
+ in InterfaceDefSeq supports_interfaces,
+ in ValueDef primary_key
+ );
+
+ EventDef create_event (
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in boolean is_custom,
+ in boolean is_abstract,
+ in ValueDef base_value,
+ in boolean is_truncatable,
+ in ValueDefSeq abstract_base_values,
+ in InterfaceDefSeq supported_interfaces,
+ in ExtInitializerSeq initializers
+ );
+ };
+
+ interface ModuleDef : CORBA::ModuleDef,
+ Container
+ {
+ };
+
+ interface Repository : CORBA::Repository,
+ Container
+ {
+ };
+
+ interface ProvidesDef : Contained
+ {
+ attribute InterfaceDef interface_type;
+ };
+
+ struct ProvidesDescription
+ {
+ Identifier name;
+ RepositoryId id;
+ RepositoryId defined_in;
+ VersionSpec version;
+ RepositoryId interface_type;
+ };
+
+ interface UsesDef : Contained
+ {
+ attribute InterfaceDef interface_type;
+ attribute boolean is_multiple;
+ };
+
+ struct UsesDescription
+ {
+ Identifier name;
+ RepositoryId id;
+ RepositoryId defined_in;
+ VersionSpec version;
+ RepositoryId interface_type;
+ boolean is_multiple;
+ };
+
+ interface EventPortDef : Contained
+ {
+ // read/write interface
+ attribute EventDef event;
+ // read interface
+ boolean is_a (in RepositoryId event_id);
+ };
+
+ struct EventPortDescription
+ {
+ Identifier name;
+ RepositoryId id;
+ RepositoryId defined_in;
+ VersionSpec version;
+ RepositoryId event;
+ };
+
+ interface EmitsDef : EventPortDef
+ {
+ };
+
+ interface PublishesDef : EventPortDef
+ {
+ };
+
+ interface ConsumesDef : EventPortDef
+ {
+ };
+
+ interface ComponentDef : ExtInterfaceDef
+ {
+ // read/write interface
+ attribute ComponentDef base_component;
+ attribute InterfaceDefSeq supported_interfaces;
+
+ // write interface
+ ProvidesDef create_provides (
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in InterfaceDef interface_type
+ );
+
+ UsesDef create_uses (
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in InterfaceDef interface_type,
+ in boolean is_multiple
+ );
+
+ EmitsDef create_emits (
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in EventDef event
+ );
+
+ PublishesDef create_publishes (
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in EventDef event
+ );
+
+ ConsumesDef create_consumes (
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in EventDef event
+ );
+ };
+
+ typedef sequence<ProvidesDescription> ProvidesDescriptionSeq;
+ typedef sequence<UsesDescription> UsesDescriptionSeq;
+ typedef sequence<EventPortDescription> EventPortDescriptionSeq;
+
+ struct ComponentDescription
+ {
+ Identifier name;
+ RepositoryId id;
+ RepositoryId defined_in;
+ VersionSpec version;
+ RepositoryId base_component;
+ RepositoryIdSeq supported_interfaces;
+ ProvidesDescriptionSeq provided_interfaces;
+ UsesDescriptionSeq used_interfaces;
+ EventPortDescriptionSeq emits_events;
+ EventPortDescriptionSeq publishes_events;
+ EventPortDescriptionSeq consumes_events;
+ ExtAttrDescriptionSeq attributes;
+ TypeCode type;
+ };
+
+ interface FactoryDef : OperationDef
+ {
+ };
+
+ interface FinderDef : OperationDef
+ {
+ };
+
+ interface HomeDef : ExtInterfaceDef
+ {
+ // read/write interface
+ attribute HomeDef base_home;
+ attribute InterfaceDefSeq supported_interfaces;
+ attribute ComponentDef managed_component;
+ attribute ValueDef primary_key;
+
+ // write interface
+ FactoryDef create_factory (
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in ParDescriptionSeq params,
+ in ExceptionDefSeq exceptions
+ );
+
+ FinderDef create_finder (
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in ParDescriptionSeq params,
+ in ExceptionDefSeq exceptions
+ );
+ };
+
+ struct HomeDescription
+ {
+ Identifier name;
+ RepositoryId id;
+ RepositoryId defined_in;
+ VersionSpec version;
+ RepositoryId base_home;
+ RepositoryId managed_component;
+ ValueDescription primary_key;
+ OpDescriptionSeq factories;
+ OpDescriptionSeq finders;
+ OpDescriptionSeq operations;
+ ExtAttrDescriptionSeq attributes;
+ TypeCode type;
+ };
+ };
+};
+
+#endif /* _IFR_COMPONENTS_IDL_ */
diff --git a/TAO/tao/IFR_Client/IFR_ComponentsA.h b/TAO/tao/IFR_Client/IFR_ComponentsA.h
new file mode 100644
index 00000000000..85f87f8d00d
--- /dev/null
+++ b/TAO/tao/IFR_Client/IFR_ComponentsA.h
@@ -0,0 +1,44 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:390
+
+#ifndef _TAO_IDL_ORIG_IFR_COMPONENTS_A_H
+#define _TAO_IDL_ORIG_IFR_COMPONENTS_A_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/IFR_Client/IFR_ComponentsC.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include /**/ "ace/post.h"
+#endif /* ifndef */
+
diff --git a/TAO/tao/IFR_Client/IFR_Extended.pidl b/TAO/tao/IFR_Client/IFR_Extended.pidl
new file mode 100644
index 00000000000..be97275f02e
--- /dev/null
+++ b/TAO/tao/IFR_Client/IFR_Extended.pidl
@@ -0,0 +1,223 @@
+// -*- IDL -*-
+
+/**
+ * @file IFR_Extended.pidl
+ *
+ * $Id$
+ *
+ * This file was used to generate the code in IFR_ExtendedC.{h,i,cpp}.
+ * The original file Interface.idl was split into four pieces, to
+ * keep the generated files to a manageable size and reduce build
+ * time. This IDL file contains all the interfaces and other data
+ * types related to fixed types and valuetypes.
+ *
+ * The command used to generate code from this IDL file is:
+ *
+ * tao_idl -Ge 1 -GT -I../.. \
+ * -Wb,export_macro=TAO_IFR_Client_Export \
+ * -Wb,export_include=ifr_client_export.h \
+ * -Wb,pre_include="ace/pre.h" \
+ * -Wb,post_include="ace/post.h" \
+ * -Wb,versioning_begin=TAO_BEGIN_VERSIONED_NAMESPACE_DECL \
+ * -Wb,versioning_end=TAO_END_VERSIONED_NAMESPACE_DECL \
+ * IFR_Extended.pidl
+ *
+ * Only the stub files are used in the TAO_IFR_Client library. The
+ * skeleton files can be deleted from this directory.
+ *
+ * No patching of the generated stub files is necessary.
+ *
+ * To generate the skeleton files for the IFR Service, the command is:
+ *
+ * tao_idl -o ../../orbsvcs/orbsvcs/IFRService -Ge 1 \
+ * -Wb,pre_include="ace/pre.h" \
+ * -Wb,post_include="ace/post.h" \
+ * IFR_Extended.pidl
+ *
+ * The only modification necessary to the skelton files is to
+ * change
+ *
+ * #include "IFR_ExtendedC.h"
+ *
+ * to
+ *
+ * #include "tao/IFR_Client/IFR_ExtendedC.h"
+ *
+ * in IFR_ExtendedS.h. The stub files may be deleted from the IFRService
+ * directory.
+ *
+ */
+
+#ifndef _IFR_EXTENDED_IDL_
+#define _IFR_EXTENDED_IDL_
+
+#include "tao/IFR_Client/IFR_Basic.pidl"
+#include "tao/AnyTypeCode/Visibility.pidl"
+#include "tao/AnyTypeCode/ValueModifier.pidl"
+
+module CORBA
+{
+ typeprefix CORBA "omg.org";
+
+// Already defined in other files, included above
+/*
+ typedef short ValueModifier;
+ const ValueModifier VM_NONE = 0;
+ const ValueModifier VM_CUSTOM = 1;
+ const ValueModifier VM_ABSTRACT = 2;
+ const ValueModifier VM_TRUNCATABLE = 3;
+
+ typedef short Visibility;
+ const Visibility PRIVATE_MEMBER = 0;
+ const Visibility PUBLIC_MEMBER = 1;
+*/
+ interface FixedDef : IDLType
+ {
+ attribute unsigned short digits;
+ attribute short scale;
+ };
+
+ struct ValueMember
+ {
+ Identifier name;
+ RepositoryId id;
+ RepositoryId defined_in;
+ VersionSpec version;
+ TypeCode type;
+ IDLType type_def;
+ Visibility access;
+ };
+
+ typedef sequence <ValueMember> ValueMemberSeq;
+
+ interface ValueMemberDef : Contained
+ {
+ readonly attribute TypeCode type;
+ attribute IDLType type_def;
+ attribute Visibility access;
+ };
+
+ interface ValueDef : Container,
+ Contained,
+ IDLType
+ {
+ // read/write interface
+ attribute InterfaceDefSeq supported_interfaces;
+ attribute InitializerSeq initializers;
+ attribute ValueDef base_value;
+ attribute ValueDefSeq abstract_base_values;
+ // read interface
+ attribute boolean is_abstract;
+ attribute boolean is_custom;
+ attribute boolean is_truncatable;
+ boolean is_a (
+ in RepositoryId id
+ );
+
+ struct FullValueDescription
+ {
+ Identifier name;
+ RepositoryId id;
+ boolean is_abstract;
+ boolean is_custom;
+ RepositoryId defined_in;
+ VersionSpec version;
+ OpDescriptionSeq operations;
+ AttrDescriptionSeq attributes;
+ ValueMemberSeq members;
+ InitializerSeq initializers;
+ RepositoryIdSeq supported_interfaces;
+ RepositoryIdSeq abstract_base_values;
+ boolean is_truncatable;
+ RepositoryId base_value;
+ TypeCode type;
+ };
+
+ FullValueDescription describe_value ();
+
+ ValueMemberDef create_value_member (
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in IDLType type,
+ in Visibility access
+ );
+ AttributeDef create_attribute (
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in IDLType type,
+ in AttributeMode mode
+ );
+ OperationDef create_operation (
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in IDLType result,
+ in OperationMode mode,
+ in ParDescriptionSeq params,
+ in ExceptionDefSeq exceptions,
+ in ContextIdSeq contexts
+ );
+ };
+
+ struct ValueDescription
+ {
+ Identifier name;
+ RepositoryId id;
+ boolean is_abstract;
+ boolean is_custom;
+ RepositoryId defined_in;
+ VersionSpec version;
+ RepositoryIdSeq supported_interfaces;
+ RepositoryIdSeq abstract_base_values;
+ boolean is_truncatable;
+ RepositoryId base_value;
+ };
+
+ interface ExtValueDef : ValueDef
+ {
+ // read/write interface
+ attribute ExtInitializerSeq ext_initializers;
+
+ // read interface
+ struct ExtFullValueDescription
+ {
+ Identifier name;
+ RepositoryId id;
+ boolean is_abstract;
+ boolean is_custom;
+ RepositoryId defined_in;
+ VersionSpec version;
+ OpDescriptionSeq operations;
+ ExtAttrDescriptionSeq attributes;
+ ValueMemberSeq members;
+ ExtInitializerSeq initializers;
+ RepositoryIdSeq supported_interfaces;
+ RepositoryIdSeq abstract_base_values;
+ boolean is_truncatable;
+ RepositoryId base_value;
+ TypeCode type;
+ };
+
+ ExtFullValueDescription describe_ext_value ();
+
+ // write interface
+ ExtAttributeDef create_ext_attribute (
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in IDLType type,
+ in AttributeMode mode,
+ in ExceptionDefSeq get_exceptions,
+ in ExceptionDefSeq set_exceptions
+ );
+ };
+
+ interface ValueBoxDef : TypedefDef
+ {
+ attribute IDLType original_type_def;
+ };
+};
+
+#endif /* _IFR_EXTENDED_IDL_ */
diff --git a/TAO/tao/IFR_Client/IFR_ExtendedA.h b/TAO/tao/IFR_Client/IFR_ExtendedA.h
new file mode 100644
index 00000000000..818268f0507
--- /dev/null
+++ b/TAO/tao/IFR_Client/IFR_ExtendedA.h
@@ -0,0 +1,44 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:390
+
+#ifndef _TAO_IDL_ORIG_IFR_EXTENDEDA_H_
+#define _TAO_IDL_ORIG_IFR_EXTENDEDA_H_
+
+#include /**/ "ace/pre.h"
+
+#include "tao/IFR_Client/IFR_ExtendedC.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include /**/ "ace/post.h"
+#endif /* ifndef */
+
diff --git a/TAO/tao/IFR_Client/TAO_IFR_Client.pc.in b/TAO/tao/IFR_Client/TAO_IFR_Client.pc.in
new file mode 100644
index 00000000000..2d1bfc345f0
--- /dev/null
+++ b/TAO/tao/IFR_Client/TAO_IFR_Client.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: TAO_IFR_Client
+Description: TAO Interface Repository Client Library
+Requires: TAO_AnyTypeCode, TAO
+Version: @VERSION@
+Libs: -L${libdir} -lTAO_IFR_Client
+Cflags: -I${includedir}
diff --git a/TAO/tao/IFR_Client/TAO_IFR_Client.rc b/TAO/tao/IFR_Client/TAO_IFR_Client.rc
new file mode 100644
index 00000000000..c981fee5b26
--- /dev/null
+++ b/TAO/tao/IFR_Client/TAO_IFR_Client.rc
@@ -0,0 +1,30 @@
+#include "..\Version.h"
+
+1 VERSIONINFO
+ FILEVERSION TAO_MAJOR_VERSION,TAO_MINOR_VERSION,TAO_BETA_VERSION,0
+ PRODUCTVERSION TAO_MAJOR_VERSION,TAO_MINOR_VERSION,TAO_BETA_VERSION,0
+ FILEFLAGSMASK 0x3fL
+ FILEFLAGS 0x0L
+ FILEOS 0x4L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904B0"
+ BEGIN
+ VALUE "FileDescription", "IFR_Client\0"
+ VALUE "FileVersion", TAO_VERSION "\0"
+ VALUE "InternalName", "TAO_IFR_ClientDLL\0"
+ VALUE "LegalCopyright", "\0"
+ VALUE "LegalTrademarks", "\0"
+ VALUE "OriginalFilename", "TAO_IFR_Client.DLL\0"
+ VALUE "ProductName", "TAO\0"
+ VALUE "ProductVersion", TAO_VERSION "\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
diff --git a/TAO/tao/IFR_Client/ifr_client_export.h b/TAO/tao/IFR_Client/ifr_client_export.h
new file mode 100644
index 00000000000..9285f2823ea
--- /dev/null
+++ b/TAO/tao/IFR_Client/ifr_client_export.h
@@ -0,0 +1,39 @@
+// -*- C++ -*-
+// $Id$
+// Definition for Win32 Export directives.
+// This file is generated automatically by generate_export_file.pl
+// ------------------------------
+#ifndef TAO_IFR_CLIENT_EXPORT_H
+#define TAO_IFR_CLIENT_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if defined (TAO_AS_STATIC_LIBS)
+# if !defined (TAO_IFR_CLIENT_HAS_DLL)
+# define TAO_IFR_CLIENT_HAS_DLL 0
+# endif /* ! TAO_IFR_CLIENT_HAS_DLL */
+#else
+# if !defined (TAO_IFR_CLIENT_HAS_DLL)
+# define TAO_IFR_CLIENT_HAS_DLL 1
+# endif /* ! TAO_IFR_CLIENT_HAS_DLL */
+#endif
+
+#if defined (TAO_IFR_CLIENT_HAS_DLL) && (TAO_IFR_CLIENT_HAS_DLL == 1)
+# if defined (TAO_IFR_CLIENT_BUILD_DLL)
+# define TAO_IFR_Client_Export ACE_Proper_Export_Flag
+# define TAO_IFR_CLIENT_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# define TAO_IFR_CLIENT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# else /* TAO_IFR_CLIENT_BUILD_DLL */
+# define TAO_IFR_Client_Export ACE_Proper_Import_Flag
+# define TAO_IFR_CLIENT_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# define TAO_IFR_CLIENT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# endif /* TAO_IFR_CLIENT_BUILD_DLL */
+#else /* TAO_IFR_CLIENT_HAS_DLL == 1 */
+# define TAO_IFR_Client_Export
+# define TAO_IFR_CLIENT_SINGLETON_DECLARATION(T)
+# define TAO_IFR_CLIENT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+#endif /* TAO_IFR_CLIENT_HAS_DLL == 1 */
+
+#endif /* TAO_IFR_CLIENT_EXPORT_H */
+
+// End of auto generated file.
diff --git a/TAO/tao/IFR_Client_Adapter.cpp b/TAO/tao/IFR_Client_Adapter.cpp
new file mode 100644
index 00000000000..77fcadefc4c
--- /dev/null
+++ b/TAO/tao/IFR_Client_Adapter.cpp
@@ -0,0 +1,8 @@
+// $Id$
+
+#include "tao/IFR_Client_Adapter.h"
+
+ACE_RCSID (tao,
+ IFR_Client_Adapter,
+ "$Id$")
+
diff --git a/TAO/tao/IFR_Client_Adapter.h b/TAO/tao/IFR_Client_Adapter.h
new file mode 100644
index 00000000000..6bd15379c82
--- /dev/null
+++ b/TAO/tao/IFR_Client_Adapter.h
@@ -0,0 +1,104 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file IFR_Client_Adapter.h
+ *
+ * $Id$
+ *
+ * @author Jeff Parsons <parsons@cs.wustl.edu>
+ */
+//=============================================================================
+
+
+#ifndef TAO_IFR_CLIENT_ADAPTER_H
+#define TAO_IFR_CLIENT_ADAPTER_H
+
+#include /**/ "ace/pre.h"
+#include "ace/CORBA_macros.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/Service_Object.h"
+
+#include "tao/TAO_Export.h"
+#include "tao/Basic_Types.h"
+#include "tao/orbconf.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_OutputCDR;
+
+namespace CORBA
+{
+ class InterfaceDef;
+ typedef InterfaceDef *InterfaceDef_ptr;
+
+ class ORB;
+ typedef ORB *ORB_ptr;
+
+ class Object;
+ typedef Object *Object_ptr;
+
+ class OperationDef;
+ typedef OperationDef *OperationDef_ptr;
+
+ class NVList;
+ typedef NVList *NVList_ptr;
+
+ class Environment;
+}
+
+/**
+ * @class TAO_IFR_Client_Adapter
+ *
+ * @brief TAO_IFR_Client_Adapter.
+ *
+ * Class that adapts various functions in the CORBA namespace
+ * which use the Interface Repository. This is a base class for
+ * the actual implementation in the TAO_IFR_Client library.
+ */
+class TAO_Export TAO_IFR_Client_Adapter : public ACE_Service_Object
+{
+public:
+ virtual CORBA::Boolean interfacedef_cdr_insert (
+ TAO_OutputCDR &cdr,
+ CORBA::InterfaceDef_ptr object_type
+ ) = 0;
+
+ virtual void interfacedef_any_insert (
+ CORBA::Any *any,
+ CORBA::InterfaceDef_ptr object_type
+ ) = 0;
+
+ virtual void dispose (
+ CORBA::InterfaceDef_ptr orphan
+ ) = 0;
+
+ virtual CORBA::InterfaceDef_ptr get_interface (
+ CORBA::ORB_ptr orb,
+ const char *repo_id
+ ACE_ENV_ARG_DECL
+ ) = 0;
+
+ virtual CORBA::InterfaceDef_ptr get_interface_remote (
+ CORBA::Object_ptr target
+ ACE_ENV_ARG_DECL
+ ) = 0;
+
+#if (TAO_HAS_MINIMUM_CORBA == 0)
+ virtual void create_operation_list (
+ CORBA::ORB_ptr orb,
+ CORBA::OperationDef_ptr,
+ CORBA::NVList_ptr&
+ ACE_ENV_ARG_DECL
+ ) = 0;
+#endif /*TAO_HAS_MINIMUM_CORBA*/
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_IFR_CLIENT_ADAPTER_H */
diff --git a/TAO/tao/IIOP.pidl b/TAO/tao/IIOP.pidl
new file mode 100644
index 00000000000..9a6762f5228
--- /dev/null
+++ b/TAO/tao/IIOP.pidl
@@ -0,0 +1,52 @@
+// -*- IDL -*-
+//
+// $Id$
+
+/**
+ *
+ * This file was used to generate the code in
+ * IIOP*.* The command used to generate code
+ * is:
+ *
+ * tao_idl \
+ * -o orig -Gp -Gd -Ge 1 -GA -Sci
+ * -Wb,export_macro=TAO_Export \
+ * -Wb,export_include="tao/TAO_Export.h" \
+ * -Wb,pre_include="ace/pre.h" \
+ * -Wb,post_include="ace/post.h" \
+ * -Wb,versioning_begin=TAO_BEGIN_VERSIONED_NAMESPACE_DECL \
+ * -Wb,versioning_end=TAO_END_VERSIONED_NAMESPACE_DECL \
+ * IIOP.pidl
+ *
+ * Remember to patch the generated files using diff/IIOP.diff
+ * This is from the GIOP 1.2 spec for Bi Dir IIOP.
+ */
+
+#ifndef TAO_IIOP_PIDL
+#define TAO_IIOP_PIDL
+
+// This is a OMG specified IDL. When IIOP modules start getting
+// complicated we may want to have them here.
+#pragma prefix "omg.org"
+
+#if !defined (TAO_LACKS_IIOP)
+
+module IIOP
+{
+ struct ListenPoint
+ {
+ string host;
+ unsigned short port;
+ };
+
+ typedef sequence<ListenPoint> ListenPointList;
+
+ struct BiDirIIOPServiceContext
+ {
+ ListenPointList listen_points;
+ };
+};
+
+#endif /* TAO_LACKS_IIOP */
+
+#endif /* TAO_IIOP_PIDL */
diff --git a/TAO/tao/IIOP_Acceptor.cpp b/TAO/tao/IIOP_Acceptor.cpp
new file mode 100644
index 00000000000..508aa5158af
--- /dev/null
+++ b/TAO/tao/IIOP_Acceptor.cpp
@@ -0,0 +1,1219 @@
+/*
+ * Hook to copy all include and forward declarations.
+ */
+//@@ TAO_ACCEPTOR_SPL_COPY_HOOK_START
+#include "tao/IIOP_Acceptor.h"
+
+#if defined (TAO_HAS_IIOP) && (TAO_HAS_IIOP != 0)
+
+#include "tao/IIOP_Profile.h"
+#include "tao/MProfile.h"
+#include "tao/debug.h"
+#include "tao/Protocols_Hooks.h"
+#include "tao/Codeset_Manager.h"
+#include "tao/Transport.h"
+#include "tao/ORB_Core.h"
+#include "tao/CDR.h"
+
+#if !defined(__ACE_INLINE__)
+#include "tao/IIOP_Acceptor.i"
+#endif /* __ACE_INLINE__ */
+
+#include "ace/Auto_Ptr.h"
+#include "ace/OS_NS_string.h"
+#include "ace/os_include/os_netdb.h"
+
+ACE_RCSID (tao,
+ IIOP_Acceptor,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_IIOP_Acceptor::TAO_IIOP_Acceptor (CORBA::Boolean flag)
+ : TAO_Acceptor (IOP::TAG_INTERNET_IOP),
+ addrs_ (0),
+ port_span_ (1),
+ hosts_ (0),
+ hostname_in_ior_ (0),
+ endpoint_count_ (0),
+ version_ (TAO_DEF_GIOP_MAJOR, TAO_DEF_GIOP_MINOR),
+ orb_core_ (0),
+ lite_flag_ (flag),
+ reuse_addr_ (1),
+#if defined (ACE_HAS_IPV6)
+ default_address_ (static_cast<unsigned short> (0), ACE_IPV6_ANY, AF_INET6),
+#else
+ default_address_ (static_cast<unsigned short> (0), static_cast<ACE_UINT32> (INADDR_ANY)),
+#endif /* ACE_HAS_IPV6 */
+ base_acceptor_ (),
+ creation_strategy_ (0),
+ concurrency_strategy_ (0),
+ accept_strategy_ (0)
+{
+}
+
+//@@ TAO_ACCEPTOR_SPL_COPY_HOOK_END
+
+TAO_IIOP_Acceptor::~TAO_IIOP_Acceptor (void)
+{
+ // Make sure we are closed before we start destroying the
+ // strategies.
+ this->close ();
+
+ delete this->creation_strategy_;
+ delete this->concurrency_strategy_;
+ delete this->accept_strategy_;
+
+ delete [] this->addrs_;
+
+ for (CORBA::ULong i = 0; i < this->endpoint_count_; ++i)
+ CORBA::string_free (this->hosts_[i]);
+
+ delete [] this->hosts_;
+
+ delete [] this->hostname_in_ior_;
+}
+
+//@@ TAO_ACCEPTOR_SPL_COPY_HOOK_START
+
+// TODO =
+// 2) For V1.[1,2] there are tagged components
+int
+TAO_IIOP_Acceptor::create_profile (const TAO::ObjectKey &object_key,
+ TAO_MProfile &mprofile,
+ CORBA::Short priority)
+{
+ // Sanity check.
+ if (this->endpoint_count_ == 0)
+ return -1;
+
+ // Check if multiple endpoints should be put in one profile or
+ // if they should be spread across multiple profiles.
+ if (priority == TAO_INVALID_PRIORITY &&
+ this->orb_core_->orb_params ()->shared_profile () == 0)
+ return this->create_new_profile (object_key,
+ mprofile,
+ priority);
+ else
+ return this->create_shared_profile (object_key,
+ mprofile,
+ priority);
+}
+
+int
+TAO_IIOP_Acceptor::create_new_profile (const TAO::ObjectKey &object_key,
+ TAO_MProfile &mprofile,
+ CORBA::Short priority)
+{
+ // Adding this->endpoint_count_ to the TAO_MProfile.
+ const int count = mprofile.profile_count ();
+ if ((mprofile.size () - count) < this->endpoint_count_
+ && mprofile.grow (count + this->endpoint_count_) == -1)
+ return -1;
+
+ // Create a profile for each acceptor endpoint.
+ for (CORBA::ULong i = 0; i < this->endpoint_count_; ++i)
+ {
+ // Skip if the host name
+ if (i > 0
+ && (this->addrs_[i].get_port_number() == this->addrs_[0].get_port_number())
+ && ACE_OS::strcmp(this->hosts_[i], this->hosts_[0]) == 0)
+ continue;
+
+ TAO_IIOP_Profile *pfile = 0;
+ ACE_NEW_RETURN (pfile,
+ TAO_IIOP_Profile (this->hosts_[i],
+ this->addrs_[i].get_port_number (),
+ object_key,
+ this->addrs_[i],
+ this->version_,
+ this->orb_core_),
+ -1);
+ pfile->endpoint ()->priority (priority);
+
+ if (mprofile.give_profile (pfile) == -1)
+ {
+ pfile->_decr_refcnt ();
+ pfile = 0;
+ return -1;
+ }
+
+ // Do not add any tagged components to the profile if configured
+ // by the user not to do so, or if an IIOP 1.0 endpoint is being
+ // created (IIOP 1.0 did not support tagged components).
+ if (this->orb_core_->orb_params ()->std_profile_components () == 0
+ || (this->version_.major == 1 && this->version_.minor == 0))
+ continue;
+
+ pfile->tagged_components ().set_orb_type (TAO_ORB_TYPE);
+
+ TAO_Codeset_Manager *csm = this->orb_core_->codeset_manager();
+ if (csm)
+ csm->set_codeset(pfile->tagged_components());
+ }
+
+ return 0;
+}
+
+int
+TAO_IIOP_Acceptor::create_shared_profile (const TAO::ObjectKey &object_key,
+ TAO_MProfile &mprofile,
+ CORBA::Short priority)
+{
+ CORBA::ULong index = 0;
+ TAO_Profile *pfile = 0;
+ TAO_IIOP_Profile *iiop_profile = 0;
+
+ // First see if <mprofile> already contains a IIOP profile.
+ for (TAO_PHandle i = 0; i != mprofile.profile_count (); ++i)
+ {
+ pfile = mprofile.get_profile (i);
+ if (pfile->tag () == IOP::TAG_INTERNET_IOP)
+ {
+ iiop_profile = dynamic_cast<TAO_IIOP_Profile *> (pfile);
+ break;
+ }
+ }
+
+ // If <mprofile> doesn't contain a IIOP_Profile, we need to create
+ // one.
+ if (iiop_profile == 0)
+ {
+ ACE_NEW_RETURN (iiop_profile,
+ TAO_IIOP_Profile (this->hosts_[0],
+ this->addrs_[0].get_port_number (),
+ object_key,
+ this->addrs_[0],
+ this->version_,
+ this->orb_core_),
+ -1);
+
+ iiop_profile->endpoint ()->priority (priority);
+
+ if (mprofile.give_profile (iiop_profile) == -1)
+ {
+ iiop_profile->_decr_refcnt ();
+ iiop_profile = 0;
+ return -1;
+ }
+
+ // Do not add any tagged components to the profile if configured
+ // by the user not to do so, or if an IIOP 1.0 endpoint is being
+ // created (IIOP 1.0 did not support tagged components).
+ if (this->orb_core_->orb_params ()->std_profile_components () != 0
+ && (this->version_.major >= 1 && this->version_.minor >= 1))
+ {
+ iiop_profile->tagged_components ().set_orb_type (TAO_ORB_TYPE);
+ TAO_Codeset_Manager *csm = this->orb_core_->codeset_manager();
+ if (csm)
+ csm->set_codeset(iiop_profile->tagged_components());
+ }
+
+ index = 1;
+ }
+
+ // Add any remaining acceptor endpoints to the IIOP_Profile.
+ for (;
+ index < this->endpoint_count_;
+ ++index)
+ {
+ if (index > 0 &&
+ this->addrs_[index].get_port_number() == this->addrs_[0].get_port_number() &&
+ ACE_OS::strcmp(this->hosts_[index], this->hosts_[0]) == 0)
+ continue;
+
+ TAO_IIOP_Endpoint *endpoint = 0;
+ ACE_NEW_RETURN (endpoint,
+ TAO_IIOP_Endpoint (this->hosts_[index],
+ this->addrs_[index].get_port_number (),
+ this->addrs_[index]),
+ -1);
+ endpoint->priority (priority);
+ iiop_profile->add_endpoint (endpoint);
+ }
+
+ return 0;
+}
+
+int
+TAO_IIOP_Acceptor::is_collocated (const TAO_Endpoint *endpoint)
+{
+ const TAO_IIOP_Endpoint *endp =
+ dynamic_cast<const TAO_IIOP_Endpoint *> (endpoint);
+
+ // Make sure the dynamically cast pointer is valid.
+ if (endp == 0)
+ return 0;
+
+ for (CORBA::ULong i = 0; i < this->endpoint_count_; ++i)
+ {
+ // compare the port and host name. Please do *NOT* optimize
+ // this code by comparing the IP address instead. That would
+ // trigger the following bug:
+ //
+ // http://deuce.doc.wustl.edu/bugzilla/show_bug.cgi?id=1220
+ //
+ if (endp->port() == this->addrs_[i].get_port_number()
+ && ACE_OS::strcmp(endp->host(), this->hosts_[i]) == 0)
+ return 1;
+ }
+
+ return 0;
+}
+
+int
+TAO_IIOP_Acceptor::close (void)
+{
+ return this->base_acceptor_.close ();
+}
+
+int
+TAO_IIOP_Acceptor::open (TAO_ORB_Core *orb_core,
+ ACE_Reactor *reactor,
+ int major,
+ int minor,
+ const char *address,
+ const char *options)
+{
+ if (TAO_debug_level > 2)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - ")
+ ACE_TEXT ("IIOP_Acceptor::open, address==%s, options=%s\n"),
+ address, options));
+ }
+
+ this->orb_core_ = orb_core;
+
+ if (this->hosts_ != 0)
+ {
+ // The hostname cache has already been set!
+ // This is bad mojo, i.e. an internal TAO error.
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) - ")
+ ACE_TEXT ("IIOP_Acceptor::open, ")
+ ACE_TEXT ("hostname already set\n\n")),
+ -1);
+ }
+
+ if (address == 0)
+ return -1;
+
+ if (major >=0 && minor >= 0)
+ this->version_.set_version (static_cast<CORBA::Octet> (major),
+ static_cast<CORBA::Octet> (minor));
+ // Parse options
+ if (this->parse_options (options) == -1)
+ return -1;
+
+ ACE_CString specified_hostname;
+ ACE_INET_Addr addr;
+
+ if (this->parse_address (address, addr, specified_hostname) == -1)
+ return -1;
+
+ if (specified_hostname.length() == 0)
+ {
+ // The address is a port number or port name. No hostname was
+ // specified. The hostname for each network interface and the
+ // fully qualified domain name must be obtained.
+
+ // Check for multiple network interfaces.
+ if (this->probe_interfaces (orb_core) == -1)
+ return -1;
+
+ return this->open_i (addr, reactor);
+ }
+
+#if defined (ACE_HAS_IPV6)
+ // Check for violation of ORBConnectIPV6Only option
+ if (this->orb_core_->orb_params ()->connect_ipv6_only () &&
+ (addr.get_type () != AF_INET6 ||
+ addr.is_ipv4_mapped_ipv6 ()))
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) - ")
+ ACE_TEXT ("IIOP_Acceptor::open, ")
+ ACE_TEXT ("non-IPv6 endpoints not allowed when ")
+ ACE_TEXT ("connect_ipv6_only is set\n\n")),
+ -1);
+ }
+#endif /* ACE_HAS_IPV6 */
+
+ if (TAO_debug_level > 2)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - ")
+ ACE_TEXT ("IIOP_Acceptor::open, specified host=%s:%d\n"),
+ (specified_hostname.length() == 0 ? "<null>" : specified_hostname.c_str()),
+ addr.get_port_number ()));
+ }
+
+ this->endpoint_count_ = 1; // Only one hostname to store
+
+ ACE_NEW_RETURN (this->addrs_,
+ ACE_INET_Addr[this->endpoint_count_],
+ -1);
+
+ ACE_NEW_RETURN (this->hosts_,
+ char *[this->endpoint_count_],
+ -1);
+
+ this->hosts_[0] = 0;
+
+ if (this->hostname_in_ior_ != 0)
+ {
+ if (TAO_debug_level > 2)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - ")
+ ACE_TEXT ("IIOP_Acceptor::open, ")
+ ACE_TEXT ("Overriding address in IOR with %s\n"),
+ ACE_TEXT_CHAR_TO_TCHAR (this->hostname_in_ior_)));
+ }
+ specified_hostname = this->hostname_in_ior_;
+ }
+
+ if (this->hostname (orb_core,
+ addr,
+ this->hosts_[0],
+ specified_hostname.c_str()) != 0)
+ return -1;
+
+ // Copy the addr. The port is (re)set in
+ // TAO_IIOP_Acceptor::open_i().
+ if (this->addrs_[0].set (addr) != 0)
+ return -1;
+
+ return this->open_i (addr,
+ reactor);
+}
+
+int
+TAO_IIOP_Acceptor::open_default (TAO_ORB_Core *orb_core,
+ ACE_Reactor *reactor,
+ int major,
+ int minor,
+ const char *options)
+{
+ this->orb_core_ = orb_core;
+
+ if (this->hosts_ != 0)
+ {
+ // The hostname cache has already been set!
+ // This is bad mojo, i.e. an internal TAO error.
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) - ")
+ ACE_TEXT ("IIOP_Acceptor::open_default, ")
+ ACE_TEXT ("hostname already set\n\n")),
+ -1);
+ }
+
+ if (major >= 0 && minor >= 0)
+ this->version_.set_version (static_cast<CORBA::Octet> (major),
+ static_cast<CORBA::Octet> (minor));
+
+ // Parse options
+ if (this->parse_options (options) == -1)
+ return -1;
+
+ // Check for multiple network interfaces.
+ if (this->probe_interfaces (orb_core) == -1)
+ return -1;
+
+ // Now that each network interface's hostname has been cached, open
+ // an endpoint on each network interface using the INADDR_ANY
+ // address.
+ ACE_INET_Addr addr;
+
+ if (addr.set (this->default_address_) != 0)
+ return -1;
+
+ return this->open_i (addr,
+ reactor);
+}
+
+int
+TAO_IIOP_Acceptor::open_i (const ACE_INET_Addr& addr,
+ ACE_Reactor *reactor)
+{
+ ACE_NEW_RETURN (this->creation_strategy_,
+ CREATION_STRATEGY (this->orb_core_,
+ this->lite_flag_),
+ -1);
+
+ ACE_NEW_RETURN (this->concurrency_strategy_,
+ CONCURRENCY_STRATEGY (this->orb_core_),
+ -1);
+
+ ACE_NEW_RETURN (this->accept_strategy_,
+ ACCEPT_STRATEGY (this->orb_core_),
+ -1);
+
+ unsigned short requested_port = addr.get_port_number ();
+ if (requested_port == 0)
+ {
+ // don't care, i.e., let the OS choose an ephemeral port
+ if (this->base_acceptor_.open (addr,
+ reactor,
+ this->creation_strategy_,
+ this->accept_strategy_,
+ this->concurrency_strategy_,
+ 0, 0, 0, 1,
+ this->reuse_addr_) == -1)
+ {
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - IIOP_Acceptor::open_i, ")
+ ACE_TEXT ("%p, "),
+ ACE_TEXT ("cannot open acceptor\n")));
+ return -1;
+ }
+ }
+ else
+ {
+ ACE_INET_Addr a(addr);
+
+ bool found_a_port = false;
+ ACE_UINT32 last_port = requested_port + this->port_span_ - 1;
+ if (last_port > ACE_MAX_DEFAULT_PORT)
+ {
+ last_port = ACE_MAX_DEFAULT_PORT;
+ }
+
+ for (ACE_UINT32 p = requested_port; p <= last_port; p++)
+ {
+ if (TAO_debug_level > 5)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - IIOP_Acceptor::open_i, ")
+ ACE_TEXT ("trying to listen on port %d\n"), p));
+
+ // Now try to actually open on that port
+ a.set_port_number ((u_short)p);
+ if (this->base_acceptor_.open (a,
+ reactor,
+ this->creation_strategy_,
+ this->accept_strategy_,
+ this->concurrency_strategy_,
+ 0, 0, 0, 1,
+ this->reuse_addr_) != -1)
+ {
+ found_a_port = true;
+ break;
+ }
+ }
+
+ // Now, if we couldn't locate a port, we punt
+ if (! found_a_port)
+ {
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - IIOP_Acceptor::open_i, ")
+ ACE_TEXT ("cannot open acceptor in port range (%d,%d)")
+ ACE_TEXT ("- %p\n"),
+ requested_port, last_port, ACE_TEXT("")));
+ return -1;
+ }
+ }
+
+#if defined (ACE_HAS_IPV6) && defined (ACE_HAS_IPV6_V6ONLY)
+ // Check if need to prevent this acceptor from accepting connections
+ // from IPv4 mapped IPv6 addresses
+ if (this->orb_core_->orb_params ()->connect_ipv6_only () &&
+ addr.is_any ())
+ {
+ if (TAO_debug_level > 5)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT("TAO (%P|%t) - IIOP_Acceptor::open_i, ")
+ ACE_TEXT("setting IPV6_V6ONLY\n")));
+
+ // Prevent server from accepting connections from IPv4-mapped addresses.
+ int on = 1;
+ if (this->base_acceptor_.acceptor ().set_option (IPPROTO_IPV6,
+ IPV6_V6ONLY,
+ (void *) &on,
+ sizeof (on)) == -1)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) - IIOP_Acceptor::open_i, ")
+ ACE_TEXT ("%p\n"),
+ ACE_TEXT ("cannot set IPV6_V6ONLY")));
+ }
+ }
+#endif /* ACE_HAS_IPV6 && ACE_HAS_IPV6_V6ONLY */
+
+ ACE_INET_Addr address;
+
+ // We do this make sure the port number the endpoint is listening on
+ // gets set in the addr.
+ if (this->base_acceptor_.acceptor ().get_local_addr (address) != 0)
+ {
+ if (TAO_debug_level > 0)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) - IIOP_Acceptor::open_i, ")
+ ACE_TEXT ("%p"),
+ ACE_TEXT ("cannot get local addr\n")));
+ return -1;
+ }
+
+ // Set the port for each addr. If there is more than one network
+ // interface then the endpoint created on each interface will be on
+ // the same port. This is how a wildcard socket bind() is supposed
+ // to work.
+ unsigned short port = address.get_port_number ();
+ for (CORBA::ULong j = 0; j < this->endpoint_count_; ++j)
+ this->addrs_[j].set_port_number (port, 1);
+
+ this->default_address_.set_port_number (port);
+
+ (void) this->base_acceptor_.acceptor().enable (ACE_CLOEXEC);
+ // This avoids having child processes acquire the listen socket thereby
+ // denying the server the opportunity to restart on a well-known endpoint.
+ // This does not affect the aberrent behavior on Win32 platforms.
+
+ if (TAO_debug_level > 5)
+ {
+ for (CORBA::ULong i = 0; i < this->endpoint_count_; ++i)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - IIOP_Acceptor::open_i, ")
+ ACE_TEXT ("listening on: <%s:%u>\n"),
+ ACE_TEXT_CHAR_TO_TCHAR(this->hosts_[i]),
+ this->addrs_[i].get_port_number ()));
+ }
+ }
+
+ return 0;
+}
+
+int
+TAO_IIOP_Acceptor::hostname (TAO_ORB_Core *orb_core,
+ ACE_INET_Addr &addr,
+ char *&host,
+ const char *specified_hostname)
+{
+ if (this->hostname_in_ior_ != 0)
+ {
+ if (TAO_debug_level >= 5)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) IIOP_Acceptor - ")
+ ACE_TEXT ("Overriding the hostname with <%s>\n"),
+ this->hostname_in_ior_));
+
+ host = CORBA::string_dup (this->hostname_in_ior_);
+ }
+ else if (orb_core->orb_params ()->use_dotted_decimal_addresses ())
+ {
+ // If dotted decimal addresses are enabled,
+ // just return ours.
+ return this->dotted_decimal_address (addr, host);
+ }
+ else if (specified_hostname != 0)
+ {
+ // If the user specified a hostname, pass it back
+ // blindly as it overrides our choice of hostname.
+ host = CORBA::string_dup (specified_hostname);
+ }
+ else
+ {
+ char tmp_host[MAXHOSTNAMELEN + 1];
+
+ // Get the hostname associated with our address
+#if defined (ACE_HAS_IPV6)
+ // If we have a IPv4-compatible IPv6 address don't do hostname lookup
+ // because that gets us into trouble. Most likely we get the same hostname
+ // returned as for the actual IPv4 address but resolving that into an IPv6
+ // address at the client will fail.
+ if (addr.is_ipv4_compat_ipv6 () ||
+ addr.get_host_name (tmp_host, sizeof (tmp_host)) != 0)
+#else /* ACE_HAS_IPV6 */
+ if (addr.get_host_name (tmp_host, sizeof (tmp_host)) != 0)
+#endif /* !ACE_HAS_IPV6 */
+ {
+ // On failure, just return the decimal address.
+ return this->dotted_decimal_address (addr, host);
+ }
+ else
+ {
+ host = CORBA::string_dup (tmp_host);
+ }
+ }
+
+ return 0;
+}
+
+
+int
+TAO_IIOP_Acceptor::parse_address (const char *address,
+ ACE_INET_Addr &addr,
+ ACE_CString &specified_hostname)
+{
+ {
+ ACE_INET_Addr tmp;
+ addr.set (tmp);
+ specified_hostname.clear();
+ }
+
+ const char *port_separator_loc = ACE_OS::strchr (address, ':');
+ char tmp_host[MAXHOSTNAMELEN + 1];
+
+#if defined (ACE_HAS_IPV6)
+ // IPv6 numeric address in host string?
+ bool ipv6_in_host = false;
+
+ // Check if this is a (possibly) IPv6 supporting profile containing a
+ // numeric IPv6 address representation.
+ if ((this->version_.major > TAO_MIN_IPV6_IIOP_MAJOR ||
+ this->version_.minor >= TAO_MIN_IPV6_IIOP_MINOR) &&
+ address[0] == '[')
+ {
+ // In this case we have to find the end of the numeric address and
+ // start looking for the port separator from there.
+ const char *cp_pos = ACE_OS::strchr(address, ']');
+ if (cp_pos == 0)
+ {
+ // No valid IPv6 address specified.
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) - ")
+ ACE_TEXT ("IIOP_Acceptor::open, ")
+ ACE_TEXT ("Invalid IPv6 decimal address specified\n\n")),
+ -1);
+ }
+ else
+ {
+ if (cp_pos[1] == ':') // Look for a port
+ port_separator_loc = cp_pos + 1;
+ else
+ port_separator_loc = 0;
+ // Extract out just the host part of the address.
+ size_t const len = cp_pos - (address + 1);
+ ACE_OS::memcpy (tmp_host, address + 1, len);
+ tmp_host[len] = '\0';
+ ipv6_in_host = true; // host string contains full IPv6 numeric address
+ }
+ }
+#endif /* ACE_HAS_IPV6 */
+
+ if (port_separator_loc == address)
+ {
+ // First convert the port into a usable form.
+ if (addr.set (address + sizeof (':')) != 0)
+ return -1;
+
+ this->default_address_.set_port_number (addr.get_port_number ());
+
+ // Now reset the port and set the host.
+ if (addr.set (this->default_address_) != 0)
+ return -1;
+ }
+ else if (port_separator_loc == 0)
+ {
+ // The address is a hostname. No port was specified, so assume
+ // port zero (port will be chosen for us).
+#if defined (ACE_HAS_IPV6)
+ if (ipv6_in_host)
+ {
+ if (addr.set ((unsigned short) 0, tmp_host) != 0)
+ return -1;
+
+ specified_hostname = tmp_host;
+ }
+ else
+ {
+#endif /* ACE_HAS_IPV6 */
+ if (addr.set ((unsigned short) 0, address) != 0)
+ return -1;
+
+ specified_hostname = address;
+#if defined (ACE_HAS_IPV6)
+ }
+#endif /* ACE_HAS_IPV6 */
+ }
+ else
+ {
+ // Host and port were specified.
+#if defined (ACE_HAS_IPV6)
+ if (ipv6_in_host)
+ {
+ u_short port =
+ static_cast<u_short> (ACE_OS::atoi (port_separator_loc + sizeof (':')));
+
+ if (addr.set (port, tmp_host) != 0)
+ return -1;
+ }
+ else
+ {
+#endif /* ACE_HAS_IPV6 */
+ if (addr.set (address) != 0)
+ return -1;
+
+ // Extract out just the host part of the address.
+ const size_t len = port_separator_loc - address;
+ ACE_OS::memcpy (tmp_host, address, len);
+ tmp_host[len] = '\0';
+#if defined (ACE_HAS_IPV6)
+ }
+#endif /* ACE_HAS_IPV6 */
+ specified_hostname = tmp_host;
+ }
+
+ return 1;
+}
+
+
+int
+TAO_IIOP_Acceptor::dotted_decimal_address (ACE_INET_Addr &addr,
+ char *&host)
+{
+ int result = 0;
+ const char *tmp = 0;
+
+ // If the IP address in the INET_Addr is the IN(6)ADDR_ANY address,
+ // then force the actual IP address to be used by initializing a new
+ // INET_Addr with the hostname from the original one. If that fails
+ // then something is seriously wrong with the systems networking
+ // setup.
+ if (addr.is_any ())
+ {
+ ACE_INET_Addr new_addr;
+#if defined (ACE_HAS_IPV6)
+ result = new_addr.set (addr.get_port_number (),
+ addr.get_host_name (),
+ 1, /* encode */
+ addr.get_type ());
+#else /* ACE_HAS_IPV6 */
+ result = new_addr.set (addr.get_port_number (),
+ addr.get_host_name ());
+#endif /* !ACE_HAS_IPV6 */
+ tmp = new_addr.get_host_addr ();
+ }
+ else
+ tmp = addr.get_host_addr ();
+
+ if (tmp == 0 || result != 0)
+ {
+ if (TAO_debug_level > 0)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) - ")
+ ACE_TEXT ("IIOP_Acceptor::dotted_decimal_address, ")
+ ACE_TEXT ("- %p, "),
+ ACE_TEXT ("cannot determine hostname\n")));
+ return -1;
+ }
+
+ host = CORBA::string_dup (tmp);
+ return 0;
+}
+
+int
+TAO_IIOP_Acceptor::probe_interfaces (TAO_ORB_Core *orb_core)
+{
+ // Extract the hostname for each network interface, and then cache
+ // it. The hostnames will then be used when creating a
+ // TAO_IIOP_Profile for each endpoint setup on the probed
+ // network interfaces.
+ ACE_INET_Addr *if_addrs = 0;
+ size_t if_cnt = 0;
+
+ if (ACE::get_ip_interfaces (if_cnt, if_addrs) != 0
+ && errno != ENOTSUP)
+ {
+ // In the case where errno == ENOTSUP, if_cnt and if_addrs will
+ // not be modified, and will each remain equal to zero. This
+ // causes the default interface to be used.
+ return -1;
+ }
+
+ if (if_cnt == 0 || if_addrs == 0)
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_WARNING,
+ ACE_TEXT ("TAO (%P|%t) - Unable to probe network ")
+ ACE_TEXT ("interfaces. Using default.\n")));
+ }
+
+ if_cnt = 1; // Force the network interface count to be one.
+ delete [] if_addrs;
+ ACE_NEW_RETURN (if_addrs,
+ ACE_INET_Addr[if_cnt],
+ -1);
+ }
+
+ // Scan for the loopback interface since it shouldn't be included in
+ // the list of cached hostnames unless it is the only interface.
+ size_t lo_cnt = 0; // Loopback interface count
+ for (size_t j = 0; j < if_cnt; ++j)
+ if (if_addrs[j].is_loopback ())
+ ++lo_cnt;
+
+#if defined (ACE_HAS_IPV6)
+ size_t ipv4_cnt = 0;
+ size_t ipv4_lo_cnt = 0;
+ bool ipv6_non_ll = false;
+ // Scan for IPv4 interfaces since these should not be included
+ // when IPv6-only is selected.
+ for (size_t j = 0; j < if_cnt; ++j)
+ if (if_addrs[j].get_type () != AF_INET6 ||
+ if_addrs[j].is_ipv4_mapped_ipv6 ())
+ {
+ ++ipv4_cnt;
+ if (if_addrs[j].is_loopback ())
+ ++ipv4_lo_cnt; // keep track of IPv4 loopback ifs
+ }
+ else if (!if_addrs[j].is_linklocal () &&
+ !if_addrs[j].is_loopback())
+ {
+ ipv6_non_ll = true; // we have at least 1 non-local IPv6 if
+ }
+#endif /* ACE_HAS_IPV6 */
+
+ // The instantiation for this template is in
+ // tao/IIOP_Connector.cpp.
+ ACE_Auto_Basic_Array_Ptr<ACE_INET_Addr> safe_if_addrs (if_addrs);
+
+#if defined (ACE_HAS_IPV6)
+#if defined (ACE_WIN32)
+ bool ipv4_only = this->default_address_.get_type () == AF_INET;
+ bool ipv6_only =
+ this->default_address_.get_type () == AF_INET6 || orb_core->orb_params ()->connect_ipv6_only ();
+#else
+ bool ipv4_only = false;
+ bool ipv6_only = orb_core->orb_params ()->connect_ipv6_only ();
+#endif
+ // If the loopback interface is the only interface then include it
+ // in the list of interfaces to query for a hostname, otherwise
+ // exclude it from the list.
+ bool ignore_lo;
+ if (ipv6_only)
+ // only exclude loopback if non-local if exists
+ ignore_lo = ipv6_non_ll;
+ else if (ipv4_only)
+ ignore_lo = ipv4_cnt != ipv4_lo_cnt;
+ else
+ ignore_lo = if_cnt != lo_cnt;
+
+ // Adjust counts for IPv6 only if required
+ size_t if_ok_cnt = if_cnt;
+ if (ipv6_only)
+ {
+ if_ok_cnt -= ipv4_cnt;
+ lo_cnt -= ipv4_lo_cnt;
+ ipv4_lo_cnt = 0;
+ }
+ else if (ipv4_only)
+ {
+ if_ok_cnt = ipv4_cnt;
+ lo_cnt = ipv4_lo_cnt;
+ }
+
+ // In case there are no non-local IPv6 ifs in the list only exclude
+ // IPv4 loopback.
+ // IPv6 loopback will be needed to successfully connect IPv6 clients
+ // in a localhost environment.
+ if (!ipv4_only && !ipv6_non_ll)
+ lo_cnt = ipv4_lo_cnt;
+
+ if (!ignore_lo)
+ this->endpoint_count_ = static_cast<CORBA::ULong> (if_ok_cnt);
+ else
+ this->endpoint_count_ = static_cast<CORBA::ULong> (if_ok_cnt - lo_cnt);
+#else /* ACE_HAS_IPV6 */
+ // If the loopback interface is the only interface then include it
+ // in the list of interfaces to query for a hostname, otherwise
+ // exclude it from the list.
+ bool ignore_lo;
+ ignore_lo = if_cnt != lo_cnt;
+ if (!ignore_lo)
+ this->endpoint_count_ = static_cast<CORBA::ULong> (if_cnt);
+ else
+ this->endpoint_count_ = static_cast<CORBA::ULong> (if_cnt - lo_cnt);
+#endif /* !ACE_HAS_IPV6 */
+
+ ACE_NEW_RETURN (this->addrs_,
+ ACE_INET_Addr[this->endpoint_count_],
+ -1);
+
+ ACE_NEW_RETURN (this->hosts_,
+ char *[this->endpoint_count_],
+ -1);
+
+ ACE_OS::memset (this->hosts_, 0, sizeof (char*) * this->endpoint_count_);
+
+ // The number of hosts/interfaces we want to cache may not be the
+ // same as the number of detected interfaces so keep a separate
+ // count.
+ size_t host_cnt = 0;
+
+ for (size_t i = 0; i < if_cnt; ++i)
+ {
+#if defined (ACE_HAS_IPV6)
+ // Ignore any loopback interface if there are other
+ // non-loopback interfaces.
+ if (ignore_lo &&
+ if_addrs[i].is_loopback () &&
+ (ipv4_only ||
+ ipv6_non_ll ||
+ if_addrs[i].get_type () != AF_INET6))
+ continue;
+
+ // Ignore any non-IPv4 interfaces when so required.
+ if (ipv4_only &&
+ (if_addrs[i].get_type () != AF_INET))
+ continue;
+
+ // Ignore any non-IPv6 interfaces when so required.
+ if (ipv6_only &&
+ (if_addrs[i].get_type () != AF_INET6 ||
+ if_addrs[i].is_ipv4_mapped_ipv6 ()))
+ continue;
+#else /* ACE_HAS_IPV6 */
+ // Ignore any loopback interface if there are other
+ // non-loopback interfaces.
+ if (ignore_lo &&
+ if_addrs[i].is_loopback ())
+ continue;
+#endif /* !ACE_HAS_IPV6 */
+
+ if (this->hostname (orb_core,
+ if_addrs[i],
+ this->hosts_[host_cnt]) != 0)
+ return -1;
+
+ // Copy the addr. The port is (re)set in
+ // TAO_IIOP_Acceptor::open_i().
+ if (this->addrs_[host_cnt].set (if_addrs[i]) != 0)
+ return -1;
+
+ ++host_cnt;
+ }
+
+ return 0;
+}
+
+CORBA::ULong
+TAO_IIOP_Acceptor::endpoint_count (void)
+{
+ return this->endpoint_count_;
+}
+
+int
+TAO_IIOP_Acceptor::object_key (IOP::TaggedProfile &profile,
+ TAO::ObjectKey &object_key)
+{
+ // Create the decoding stream from the encapsulation in the buffer,
+#if (TAO_NO_COPY_OCTET_SEQUENCES == 1)
+ TAO_InputCDR cdr (profile.profile_data.mb ());
+#else
+ TAO_InputCDR cdr (reinterpret_cast<char*> (profile.profile_data.get_buffer ()),
+ profile.profile_data.length ());
+#endif /* TAO_NO_COPY_OCTET_SEQUENCES == 1 */
+
+ CORBA::Octet major;
+ CORBA::Octet minor = CORBA::Octet();
+
+ // Read the version. We just read it here. We don't*do any*
+ // processing.
+ if (!(cdr.read_octet (major)
+ && cdr.read_octet (minor)))
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - TAO_IIOP_Acceptor::object_key, v%d.%d\n"),
+ major,
+ minor));
+ }
+ return -1;
+ }
+
+ CORBA::String_var host;
+ CORBA::UShort port = 0;
+
+ // Get host and port. No processing here too..
+ if (cdr.read_string (host.out ()) == 0
+ || cdr.read_ushort (port) == 0)
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - TAO_IIOP_Acceptor::object_key, ")
+ ACE_TEXT ("error while decoding host/port\n")));
+ }
+ return -1;
+ }
+
+ // ... and object key.
+ if ((cdr >> object_key) == 0)
+ return -1;
+
+ // We are NOT bothered about the rest.
+
+ return 1;
+}
+
+int
+TAO_IIOP_Acceptor::parse_options (const char *str)
+{
+ if (str == 0)
+ return 0; // No options to parse. Not a problem.
+
+ // Use an option format similar to the one used for CGI scripts in
+ // HTTP URLs.
+ // e.g.: option1=foo&option2=bar
+
+ const ACE_CString options (str);
+
+ const size_t len = options.length ();
+
+ static const char option_delimiter = '&';
+
+ // Count the number of options.
+ int argc = 1;
+
+ for (size_t i = 0; i < len; ++i)
+ if (options[i] == option_delimiter)
+ argc++;
+
+ // The idea behind the following loop is to split the options into
+ // (option, name) pairs.
+ // For example,
+ // `option1=foo&option2=bar'
+ // will be parsed into:
+ // `option1=foo'
+ // `option2=bar'
+
+ ACE_CString *argv_base = 0;
+ ACE_NEW_RETURN (argv_base, ACE_CString[argc],-1);
+ ACE_CString **argv = 0;
+ ACE_NEW_RETURN (argv, ACE_CString*[argc],-1);
+
+ ACE_CString::size_type begin = 0;
+ ACE_CString::size_type end = 0;
+ int result = 0;
+ for (int j = 0; j < argc; ++j)
+ {
+ if (j < argc - 1)
+ end = options.find (option_delimiter, begin);
+ else
+ end = len;
+
+ if (end == begin)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) - Zero length IIOP option.\n")));
+ result = -1;
+ break;
+ }
+ else if (end != options.npos)
+ {
+ argv_base[j] = options.substring (begin, end - begin);
+ argv[j] = &argv_base[j];
+ begin = end + 1;
+ }
+ else
+ {
+ break; // No other options.
+ }
+ }
+
+ if (result == 0)
+ result = this->parse_options_i (argc,argv);
+
+ if (argc > 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) - IIOP")
+ ACE_TEXT (" endpoint has %d unknown options:\n"),
+ argc));
+ for (int i = 0; i < argc; i++)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT("\t%s\n"),
+ argv[i]->c_str()));
+ result = -1;
+ }
+ delete [] argv;
+ delete [] argv_base;
+ return result;
+}
+
+int
+TAO_IIOP_Acceptor::parse_options_i (int &argc,
+ ACE_CString **argv)
+{
+ int i = 0;
+ while (i < argc)
+ {
+ ACE_CString::size_type const len = argv[i]->length ();
+ ACE_CString::size_type const slot = argv[i]->find ('=');
+
+ if (slot == len - 1
+ || slot == ACE_CString::npos)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) - IIOP option <%s> is ")
+ ACE_TEXT ("missing a value.\n"),
+ ACE_TEXT_CHAR_TO_TCHAR(argv[i]->c_str ())),
+ -1);
+
+ ACE_CString name = argv[i]->substring (0, slot);
+ ACE_CString value = argv[i]->substring (slot + 1);
+
+ if (name.length () == 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) Zero length IIOP ")
+ ACE_TEXT ("option name.\n")),
+ -1);
+ if (name == "priority")
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) Invalid IIOP endpoint format: ")
+ ACE_TEXT ("endpoint priorities no longer supported. \n"),
+ value.c_str ()),
+ -1);
+ }
+ else if (name == "portspan")
+ {
+ int range = static_cast <int> (ACE_OS::atoi (value.c_str ()));
+ // @@ What's the lower bound on the range? zero, or one?
+ if (range < 1 || range > ACE_MAX_DEFAULT_PORT)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) Invalid IIOP endpoint ")
+ ACE_TEXT ("portspan: <%s>\n")
+ ACE_TEXT ("Valid range 1 -- %d\n"),
+ value.c_str (), ACE_MAX_DEFAULT_PORT),
+ -1);
+
+ this->port_span_ = static_cast <u_short> (range);
+ }
+ else if (name == "hostname_in_ior")
+ {
+ this->hostname_in_ior_ = value.rep ();
+ }
+ else if (name == "reuse_addr")
+ {
+ this->reuse_addr_ = ACE_OS::atoi (value.c_str ());
+ }
+ else
+ {
+ // the name is not known, skip to the next option
+ ++i;
+ continue;
+ }
+ // at the end, we've consumed this argument. Shift the list and
+ // put this one on the end. This technique has the effect of
+ // putting them in reverse order, but that doesn't matter, since
+ // these arguments are only whole strings.
+ --argc;
+ ACE_CString *temp = argv[i];
+ for (int j = i; j <= argc-1; ++j)
+ argv[j] = argv[j+1];
+ argv[argc] = temp;
+ }
+ return 0;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_IIOP && TAO_HAS_IIOP != 0 */
+
+//@@ TAO_ACCEPTOR_SPL_COPY_HOOK_END
diff --git a/TAO/tao/IIOP_Acceptor.h b/TAO/tao/IIOP_Acceptor.h
new file mode 100644
index 00000000000..72f4e3ebc1b
--- /dev/null
+++ b/TAO/tao/IIOP_Acceptor.h
@@ -0,0 +1,279 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file IIOP_Acceptor.h
+ *
+ * $Id$
+ *
+ * IIOP specific acceptor processing
+ *
+ *
+ * @author Fred Kuhns <fredk@cs.wustl.edu>
+ * @author Ossama Othman <ossama@uci.edu>
+ */
+//=============================================================================
+
+
+#ifndef TAO_IIOP_ACCEPTOR_H
+#define TAO_IIOP_ACCEPTOR_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if defined (TAO_HAS_IIOP) && (TAO_HAS_IIOP != 0)
+
+#include "tao/Transport_Acceptor.h"
+#include "tao/IIOP_Connection_Handler.h"
+#include "tao/Acceptor_Impl.h"
+#include "tao/GIOP_Message_Version.h"
+
+#include "ace/SOCK_Acceptor.h"
+#include "ace/Acceptor.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_IIOP_Acceptor
+ *
+ * @brief TAO_IIOP_Acceptor
+ *
+ * The IIOP-specific bridge class for the concrete acceptor.
+ */
+class TAO_Export TAO_IIOP_Acceptor : public TAO_Acceptor
+{
+public:
+
+ /*
+ * Hook that marks begining of all concrete i.e. non virtual
+ * methods implemented in IIOP_Acceptor class.
+ */
+ //@@ TAO_ACCEPTOR_SPL_CONCRETE_METHODS_COPY_HOOK_START
+
+ /// Constructor.
+ TAO_IIOP_Acceptor (CORBA::Boolean flag = false);
+
+ /// Destructor.
+ ~TAO_IIOP_Acceptor (void);
+
+ /// @@ Helper method for the implementation repository, should go
+ /// away
+ const ACE_INET_Addr& address (void) const;
+
+ /// Returns the array of endpoints in this acceptor
+ const ACE_INET_Addr *endpoints (void);
+
+ /// Returns address for default endpoint
+ const ACE_INET_Addr& default_address (void) const;
+
+ /// Set address for default endpoint
+ void set_default_address (const ACE_INET_Addr& addr);
+
+ typedef ACE_Strategy_Acceptor<TAO_IIOP_Connection_Handler, ACE_SOCK_ACCEPTOR> BASE_ACCEPTOR;
+ typedef TAO_Creation_Strategy<TAO_IIOP_Connection_Handler> CREATION_STRATEGY;
+ typedef TAO_Concurrency_Strategy<TAO_IIOP_Connection_Handler> CONCURRENCY_STRATEGY;
+ typedef TAO_Accept_Strategy<TAO_IIOP_Connection_Handler, ACE_SOCK_ACCEPTOR> ACCEPT_STRATEGY;
+
+ //@@ TAO_ACCEPTOR_SPL_CONCRETE_METHODS_COPY_HOOK_END
+
+ /**
+ * The TAO_Acceptor methods, check the documentation in
+ * Transport_Acceptor.h for details.
+ */
+ virtual int open (TAO_ORB_Core *orb_core,
+ ACE_Reactor *reactor,
+ int version_major,
+ int version_minor,
+ const char *address,
+ const char *options = 0);
+ virtual int open_default (TAO_ORB_Core *orb_core,
+ ACE_Reactor *reactor,
+ int version_major,
+ int version_minor,
+ const char *options = 0);
+ virtual int close (void);
+ virtual int create_profile (const TAO::ObjectKey &object_key,
+ TAO_MProfile &mprofile,
+ CORBA::Short priority);
+ virtual int is_collocated (const TAO_Endpoint *endpoint);
+ virtual CORBA::ULong endpoint_count (void);
+
+ virtual int object_key (IOP::TaggedProfile &profile,
+ TAO::ObjectKey &key);
+
+ //@@ TAO_ACCEPTOR_SPL_CONCRETE_METHODS_COPY_HOOK_START
+ /**
+ * Set the host name for the given addr.
+ * A hostname may be forced by using specified_hostname. This
+ * is useful if the given address corresponds to more than one
+ * hostname and the desired one cannot be determined in any
+ * other way.
+ * This method is used both when constructing IOR endpoints and LPL
+ * (listen point lists).
+ *
+ * The algorithm used is:
+ * - If hostname_in_ior_ has been set, it is used "as is";
+ * - else if use_dotted_decimal_addresses_ is set, the text representaion
+ * of the IP is used;
+ * - else if specified_hostname is given, it used "as is";
+ * - else a reverse (address to name) lookup is used to obtain the
+ * hostname or the IP if no reverse mapping exists.
+ */
+ virtual int hostname (TAO_ORB_Core *orb_core,
+ ACE_INET_Addr &addr,
+ char *&host,
+ const char *specified_hostname = 0);
+
+protected:
+
+ /**
+ * Helper method
+ * Clear out 'addr' & 'specified_hostname' and initialize them
+ * based upon 'address'.
+ */
+ int
+ parse_address (const char *address,
+ ACE_INET_Addr &addr,
+ ACE_CString &specified_hostname);
+
+ /**
+ * Set the host name for the given address using the dotted decimal
+ * format.
+ */
+ int dotted_decimal_address (ACE_INET_Addr &addr,
+ char *&host);
+
+ /**
+ * Implement the common part of the open*() methods. This method is
+ * virtual to allow a derived class implementation to be invoked
+ * instead.
+ */
+ virtual int open_i (const ACE_INET_Addr &addr,
+ ACE_Reactor *reactor);
+
+ /**
+ * Probe the system for available network interfaces, and initialize
+ * the <addrs_> array with an ACE_INET_Addr for each network
+ * interface. The port for each initialized ACE_INET_Addr will be
+ * set in the open_i() method. This method only gets invoked when
+ * no explicit hostname is provided in the specified endpoint.
+ */
+ int probe_interfaces (TAO_ORB_Core *orb_core);
+
+ /**
+ * Parse protocol specific options.
+ *
+ * Currently supported:
+ * portspan -- specifies the range of ports over which the acceptor
+ * should scan looking for a free port (this is convenient
+ * for situations where you might normally use an ephemeral
+ * port but can't because you're behind a firewall and don't
+ * want to permit passage on all ephemeral ports)
+ */
+ int parse_options (const char *options);
+
+ /**
+ * Parse options splits the options list in to an argv array. This
+ * allows manipulation of the list in a manner similar to
+ * orb_init. By moving the consumed args to the tail of the list and
+ * reducing the argc count, the base parse_options_i can be called
+ * by derived parse_options_i. Method returns -1 if an ill-formed or
+ * otherwise bogus arg is encountered. The only strictly bogus arg
+ * was priority, which was a holdover from the early RT IIOP
+ * implementations. an ill-formed option is one which is missing an
+ * equal sign or something to the left of it.
+ */
+ virtual int parse_options_i (int &argc, ACE_CString ** argv);
+
+ /// Helper method to add a new profile to the mprofile for
+ /// each endpoint.
+ int create_new_profile (const TAO::ObjectKey &object_key,
+ TAO_MProfile &mprofile,
+ CORBA::Short priority);
+
+ /// Helper method to create a profile that contains all of
+ /// our endpoints.
+ int create_shared_profile (const TAO::ObjectKey &object_key,
+ TAO_MProfile &mprofile,
+ CORBA::Short priority);
+ //@@ TAO_ACCEPTOR_SPL_CONCRETE_METHODS_COPY_HOOK_END
+
+ //@@ TAO_ACCEPTOR_SPL_DATA_MEMBERS_COPY_HOOK_START
+protected:
+
+ /// Array of ACE_INET_Addr instances, each one corresponding to a
+ /// given network interface.
+ ACE_INET_Addr *addrs_;
+
+ /**
+ * The number of ports over which the acceptor should search (starting
+ * at the port specified in each element of addrs_) for an available
+ * port. This is specified via the "portspan=" option to the endpoint.
+ */
+ unsigned short port_span_;
+
+ /**
+ * Cache the information about the endpoints serviced by this
+ * acceptor.
+ * There may in fact be multiple hostnames for this endpoint. For
+ * example, if the IP address is INADDR_ANY (0.0.0.0) then there
+ * will be possibly a different hostname for each interface.
+ */
+ char **hosts_;
+
+ /**
+ * Override the hostname used in the ORBEndPoint.
+ */
+ char *hostname_in_ior_;
+
+ /// The number of host names cached in the hosts_ array (equivalent
+ /// to the number of endpoints opened by this Acceptor).
+ CORBA::ULong endpoint_count_;
+
+ /**
+ * The GIOP version for this endpoint
+ * @@ Theoretically they shouldn't be here!! We need to look at a
+ * way to move this out
+ */
+ TAO_GIOP_Message_Version version_;
+
+ /// ORB Core.
+ TAO_ORB_Core *orb_core_;
+
+ /// Should we use GIOP lite??
+ const bool lite_flag_;
+
+ /// Enable socket option SO_REUSEADDR to be set
+ int reuse_addr_;
+
+ /// Address for default endpoint
+ ACE_INET_Addr default_address_;
+
+private:
+
+ /// The concrete acceptor, as a pointer to it's base class.
+ BASE_ACCEPTOR base_acceptor_;
+
+ /// Acceptor strategies.
+ CREATION_STRATEGY *creation_strategy_;
+ CONCURRENCY_STRATEGY *concurrency_strategy_;
+ ACCEPT_STRATEGY *accept_strategy_;
+
+ //@@ TAO_ACCEPTOR_SPL_DATA_MEMBERS_COPY_HOOK_END
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined(__ACE_INLINE__)
+#include "tao/IIOP_Acceptor.i"
+#endif /* __ACE_INLINE__ */
+
+#endif /* TAO_HAS_IIOP && TAO_HAS_IIOP != 0 */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_IIOP_ACCEPTOR_H */
diff --git a/TAO/tao/IIOP_Acceptor.i b/TAO/tao/IIOP_Acceptor.i
new file mode 100644
index 00000000000..949d67653be
--- /dev/null
+++ b/TAO/tao/IIOP_Acceptor.i
@@ -0,0 +1,45 @@
+// -*- C++ -*-
+//
+// $Id$
+
+#if defined (TAO_HAS_IIOP) && (TAO_HAS_IIOP != 0)
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE const ACE_INET_Addr&
+TAO_IIOP_Acceptor::address (void) const
+{
+ ACE_ASSERT (this->addrs_ != 0);
+
+ // @@ This is busted.
+ // The Implementation Repository will have to start supporting
+ // IORs with multiple profiles. For now, we just return the
+ // first addr.
+ // -Ossama
+ return this->addrs_[0];
+}
+
+ACE_INLINE const ACE_INET_Addr *
+TAO_IIOP_Acceptor::endpoints (void)
+{
+ ACE_ASSERT (this->addrs_ != 0);
+
+ return this->addrs_;
+}
+
+ACE_INLINE const ACE_INET_Addr&
+TAO_IIOP_Acceptor::default_address (void) const
+{
+ return this->default_address_;
+}
+
+ACE_INLINE void
+TAO_IIOP_Acceptor::set_default_address (const ACE_INET_Addr& addr)
+{
+ this->default_address_.set (addr);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_IIOP && TAO_HAS_IIOP != 0 */
+
diff --git a/TAO/tao/IIOP_Connection_Handler.cpp b/TAO/tao/IIOP_Connection_Handler.cpp
new file mode 100644
index 00000000000..0f59383abe5
--- /dev/null
+++ b/TAO/tao/IIOP_Connection_Handler.cpp
@@ -0,0 +1,531 @@
+#include "tao/IIOP_Connection_Handler.h"
+
+#if defined (TAO_HAS_IIOP) && (TAO_HAS_IIOP != 0)
+
+#include "tao/debug.h"
+#include "tao/ORB_Core.h"
+#include "tao/IIOP_Transport.h"
+#include "tao/IIOP_Endpoint.h"
+#include "tao/IIOPC.h"
+#include "tao/Thread_Lane_Resources.h"
+#include "tao/Base_Transport_Property.h"
+#include "tao/Protocols_Hooks.h"
+#include "tao/Wait_Strategy.h"
+
+#include "ace/os_include/netinet/os_tcp.h"
+#include "ace/os_include/os_netdb.h"
+
+ACE_RCSID (tao,
+ IIOP_Connection_Handler,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_IIOP_Connection_Handler::TAO_IIOP_Connection_Handler (ACE_Thread_Manager *t)
+ : TAO_IIOP_SVC_HANDLER (t, 0 , 0),
+ TAO_Connection_Handler (0),
+ dscp_codepoint_ (IPDSFIELD_DSCP_DEFAULT << 2)
+{
+ // This constructor should *never* get called, it is just here to
+ // make the compiler happy: the default implementation of the
+ // Creation_Strategy requires a constructor with that signature, we
+ // don't use that implementation, but some (most?) compilers
+ // instantiate it anyway.
+ ACE_ASSERT (0);
+}
+
+
+TAO_IIOP_Connection_Handler::TAO_IIOP_Connection_Handler (
+ TAO_ORB_Core *orb_core,
+ CORBA::Boolean flag)
+ : TAO_IIOP_SVC_HANDLER (orb_core->thr_mgr (), 0, 0),
+ TAO_Connection_Handler (orb_core),
+ dscp_codepoint_ (IPDSFIELD_DSCP_DEFAULT << 2)
+{
+ TAO_IIOP_Transport* specific_transport = 0;
+ ACE_NEW (specific_transport,
+ TAO_IIOP_Transport (this, orb_core, flag));
+
+ // store this pointer (indirectly increment ref count)
+ this->transport (specific_transport);
+}
+
+TAO_IIOP_Connection_Handler::TAO_IIOP_Connection_Handler (TAO_ORB_Core *orb_core)
+ : TAO_IIOP_SVC_HANDLER (orb_core->thr_mgr (), 0, 0),
+ TAO_Connection_Handler (orb_core),
+ dscp_codepoint_ (IPDSFIELD_DSCP_DEFAULT << 2)
+{
+}
+
+TAO_IIOP_Connection_Handler::~TAO_IIOP_Connection_Handler (void)
+{
+ delete this->transport ();
+}
+
+/* Copy hook that copies over the concrete methods from this class
+ * to the base Connection_Handler class as a part of the specialization
+ * process. Add all concrete and virtual
+ * methods implemented in this class within this hook.
+ */
+//@@ CONNECTION_HANDLER_SPL_COPY_HOOK_START
+
+int
+TAO_IIOP_Connection_Handler::open_handler (void *v)
+{
+ return this->open (v);
+}
+
+int
+TAO_IIOP_Connection_Handler::open (void*)
+{
+ TAO_IIOP_Protocol_Properties protocol_properties;
+
+ // Initialize values from ORB params.
+ protocol_properties.send_buffer_size_ =
+ this->orb_core ()->orb_params ()->sock_sndbuf_size ();
+ protocol_properties.recv_buffer_size_ =
+ this->orb_core ()->orb_params ()->sock_rcvbuf_size ();
+ protocol_properties.no_delay_ =
+ this->orb_core ()->orb_params ()->nodelay ();
+ protocol_properties.keep_alive_ =
+ this->orb_core ()->orb_params ()->sock_keepalive ();
+ protocol_properties.dont_route_ =
+ this->orb_core ()->orb_params ()->sock_dontroute ();
+
+ TAO_Protocols_Hooks *tph =
+ this->orb_core ()->get_protocols_hooks ();
+
+ bool const client =
+ this->transport ()->opened_as () == TAO::TAO_CLIENT_ROLE;
+
+ ACE_DECLARE_NEW_CORBA_ENV;
+
+ ACE_TRY
+ {
+ if (client)
+ {
+ tph->client_protocol_properties_at_orb_level (
+ protocol_properties
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ else
+ {
+ tph->server_protocol_properties_at_orb_level (
+ protocol_properties
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ }
+ ACE_CATCHANY
+ {
+ return -1;
+ }
+ ACE_ENDTRY;
+ ACE_CHECK_RETURN (-1);
+
+ if (this->set_socket_option (this->peer (),
+ protocol_properties.send_buffer_size_,
+ protocol_properties.recv_buffer_size_) == -1)
+ return -1;
+
+#if !defined (ACE_LACKS_TCP_NODELAY)
+ if (this->peer ().set_option (ACE_IPPROTO_TCP,
+ TCP_NODELAY,
+ (void *) &protocol_properties.no_delay_,
+ sizeof (protocol_properties.no_delay_)) == -1)
+ return -1;
+#endif /* ! ACE_LACKS_TCP_NODELAY */
+
+ if (protocol_properties.keep_alive_)
+ {
+ if (this->peer ().
+ set_option (SOL_SOCKET,
+ SO_KEEPALIVE,
+ (void *) &protocol_properties.keep_alive_,
+ sizeof (protocol_properties.keep_alive_)) == -1
+ && errno != ENOTSUP)
+ {
+ return -1;
+ }
+ }
+
+#if !defined (ACE_LACKS_SO_DONTROUTE)
+ if (protocol_properties.dont_route_)
+ {
+ if (this->peer ().
+ set_option (SOL_SOCKET,
+ SO_DONTROUTE,
+ (void *) &protocol_properties.dont_route_,
+ sizeof (protocol_properties.dont_route_)) == -1
+ && errno != ENOTSUP)
+ {
+ return -1;
+ }
+ }
+#endif /* ! ACE_LACKS_SO_DONTROUTE */
+
+ if (this->transport ()->wait_strategy ()->non_blocking ()
+ || this->transport ()->opened_as () == TAO::TAO_SERVER_ROLE)
+ {
+ if (this->peer ().enable (ACE_NONBLOCK) == -1)
+ return -1;
+ }
+
+ // Called by the <Strategy_Acceptor> when the handler is
+ // completely connected.
+
+ ACE_INET_Addr remote_addr;
+ if (this->peer ().get_remote_addr (remote_addr) == -1)
+ return -1;
+
+ ACE_INET_Addr local_addr;
+ if (this->peer ().get_local_addr (local_addr) == -1)
+ return -1;
+
+ if (TAO_debug_level > 2)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT("TAO (%P|%t) - IIOP_Connection_Handler::open, ")
+ ACE_TEXT("The local addr is <%s:%d> \n"),
+ local_addr.get_host_addr (),
+ local_addr.get_port_number()));
+
+ if (local_addr == remote_addr)
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_TCHAR remote_as_string[MAXHOSTNAMELEN + 16];
+ ACE_TCHAR local_as_string[MAXHOSTNAMELEN + 16];
+
+ (void) remote_addr.addr_to_string (remote_as_string,
+ sizeof(remote_as_string));
+ (void) local_addr.addr_to_string (local_as_string,
+ sizeof(local_as_string));
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT("TAO(%P|%t) - IIOP_Connection_Handler::open, ")
+ ACE_TEXT("Holy Cow! The remote addr and ")
+ ACE_TEXT("local addr are identical (%s == %s)\n"),
+ remote_as_string, local_as_string));
+ }
+ return -1;
+ }
+
+#if defined (ACE_HAS_IPV6) && !defined (ACE_HAS_IPV6_V6ONLY)
+ // Check if we need to invalidate accepted connections
+ // from IPv4 mapped IPv6 addresses
+ if (this->orb_core ()->orb_params ()->connect_ipv6_only () &&
+ remote_addr.is_ipv4_mapped_ipv6 ())
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_TCHAR remote_as_string[MAXHOSTNAMELEN + 16];
+
+ (void) remote_addr.addr_to_string (remote_as_string,
+ sizeof(remote_as_string));
+
+ ACE_ERROR ((LM_WARNING,
+ ACE_TEXT("TAO (%P|%t) - IIOP_Connection_Handler::open, ")
+ ACE_TEXT("invalid connection from IPv4 mapped IPv6 interface <%s>!\n"),
+ remote_as_string));
+ }
+ return -1;
+ }
+#endif /* ACE_HAS_IPV6 && ACE_HAS_IPV6_V6ONLY */
+
+ if (TAO_debug_level > 0)
+ {
+ ACE_TCHAR client_addr[MAXHOSTNAMELEN + 16];
+
+ // Verify that we can resolve the peer hostname.
+ if (remote_addr.addr_to_string (client_addr, sizeof (client_addr)) == -1)
+ return -1;
+
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - IIOP_Connection_Handler::open, IIOP ")
+ ACE_TEXT ("connection to peer <%s> on %d\n"),
+ client_addr, this->peer ().get_handle ()));
+ }
+
+ // Set that the transport is now connected, if fails we return -1
+ // Use C-style cast b/c otherwise we get warnings on lots of
+ // compilers
+ if (!this->transport ()->post_open ((size_t) this->get_handle ()))
+ return -1;
+
+ this->state_changed (TAO_LF_Event::LFS_SUCCESS,
+ this->orb_core ()->leader_follower ());
+
+ return 0;
+}
+
+int
+TAO_IIOP_Connection_Handler::resume_handler (void)
+{
+ return ACE_Event_Handler::ACE_APPLICATION_RESUMES_HANDLER;
+}
+
+int
+TAO_IIOP_Connection_Handler::close_connection (void)
+{
+ // To maintain maximum compatibility, we only set this socket option
+ // if the user has provided a linger timeout.
+ int linger = this->orb_core()->orb_params()->linger ();
+ if (linger != -1)
+ {
+ struct linger lval;
+ lval.l_onoff = 1;
+ lval.l_linger = (u_short)linger;
+
+ if (this->peer ().set_option(SOL_SOCKET,
+ SO_LINGER,
+ (void*) &lval,
+ sizeof (lval)) == -1)
+ {
+ if (TAO_debug_level)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) Unable to set ")
+ ACE_TEXT ("SO_LINGER on %d\n"),
+ this->peer ().get_handle ()));
+ }
+ }
+ }
+
+ return this->close_connection_eh (this);
+}
+
+int
+TAO_IIOP_Connection_Handler::handle_input (ACE_HANDLE h)
+{
+ return this->handle_input_eh (h, this);
+}
+
+int
+TAO_IIOP_Connection_Handler::handle_output (ACE_HANDLE handle)
+{
+ const int result =
+ this->handle_output_eh (handle, this);
+
+ if (result == -1)
+ {
+ this->close_connection ();
+ return 0;
+ }
+
+ return result;
+}
+
+int
+TAO_IIOP_Connection_Handler::handle_timeout (const ACE_Time_Value &,
+ const void *)
+{
+ // We don't use this upcall for I/O. This is only used by the
+ // Connector to indicate that the connection timedout. Therefore,
+ // we should call close().
+ return this->close ();
+}
+
+int
+TAO_IIOP_Connection_Handler::handle_close (ACE_HANDLE,
+ ACE_Reactor_Mask)
+{
+ ACE_ASSERT (0);
+ return 0;
+}
+
+int
+TAO_IIOP_Connection_Handler::close (u_long)
+{
+ return this->close_handler ();
+}
+
+int
+TAO_IIOP_Connection_Handler::release_os_resources (void)
+{
+ return this->peer ().close ();
+}
+
+int
+TAO_IIOP_Connection_Handler::add_transport_to_cache (void)
+{
+ ACE_INET_Addr addr;
+
+ // Get the peername.
+ if (this->peer ().get_remote_addr (addr) == -1)
+ return -1;
+
+ // Construct an IIOP_Endpoint object
+ TAO_IIOP_Endpoint endpoint (
+ addr,
+ this->orb_core()->orb_params()->cache_incoming_by_dotted_decimal_address ());
+
+ // Construct a property object
+ TAO_Base_Transport_Property prop (&endpoint);
+
+ TAO::Transport_Cache_Manager &cache =
+ this->orb_core ()->lane_resources ().transport_cache ();
+
+ // Idle the transport..
+ return cache.cache_idle_transport (&prop,
+ this->transport ());
+}
+
+int
+TAO_IIOP_Connection_Handler::process_listen_point_list (
+ IIOP::ListenPointList &listen_list)
+{
+ // Get the size of the list
+ const CORBA::ULong len = listen_list.length ();
+
+ if (TAO_debug_level > 0 && len == 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT("TAO (%P|%t) - IIOP_Connection_Handler::")
+ ACE_TEXT("process_listen_point_list, ")
+ ACE_TEXT("Received list of size 0, check client config.\n")));
+ }
+
+ for (CORBA::ULong i = 0; i < len; ++i)
+ {
+ IIOP::ListenPoint listen_point = listen_list[i];
+ ACE_INET_Addr addr (listen_point.port,
+ listen_point.host.in ());
+
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT("TAO (%P|%t) - IIOP_Connection_Handler::")
+ ACE_TEXT("process_listen_point_list, ")
+ ACE_TEXT("Listening port [%d] on [%s]\n"),
+ listen_point.port,
+ ACE_TEXT_CHAR_TO_TCHAR(listen_point.host.in ())));
+ }
+
+ // Construct an IIOP_Endpoint object using the host as provided
+ // in the listen point list. We must use host in that form because
+ // that's also how the ORB on the other side will advertise the host
+ // in an IOR.
+ TAO_IIOP_Endpoint endpoint (listen_point.host.in (),
+ listen_point.port, addr);
+
+ // Construct a property object
+ TAO_Base_Transport_Property prop (&endpoint);
+
+ // Mark the connection as bidirectional
+ prop.set_bidir_flag (1);
+
+ // The property for this handler has changed. Recache the
+ // handler with this property
+ int retval =
+ this->transport ()->recache_transport (&prop);
+
+ if (retval == -1)
+ return retval;
+
+ // Make the handler idle and ready for use
+ this->transport ()->make_idle ();
+ }
+
+ return 0;
+}
+
+int
+TAO_IIOP_Connection_Handler::set_dscp_codepoint (CORBA::Boolean set_network_priority)
+{
+ int tos = IPDSFIELD_DSCP_DEFAULT << 2;
+
+ if (set_network_priority)
+ {
+ TAO_Protocols_Hooks *tph =
+ this->orb_core ()->get_protocols_hooks ();
+
+ CORBA::Long codepoint =
+ tph->get_dscp_codepoint ();
+
+ tos = static_cast<int> (codepoint) << 2;
+ }
+
+ if (tos != this->dscp_codepoint_)
+ {
+ int result = 0;
+#if defined (ACE_HAS_IPV6)
+ ACE_INET_Addr local_addr;
+ if (this->peer ().get_local_addr (local_addr) == -1)
+ return -1;
+ else if (local_addr.get_type () == AF_INET6)
+# if !defined (IPV6_TCLASS)
+ // IPv6 defines option IPV6_TCLASS for specifying traffic class/priority
+ // but not many implementations yet (very new;-).
+ {
+ if (TAO_debug_level)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - IIOP_Connection_Handler::"
+ "set_dscp_codepoint -> IPV6_TCLASS not supported yet\n"));
+ }
+ return 0;
+ }
+# else /* !IPV6_TCLASS */
+ result = this->peer ().set_option (IPPROTO_IPV6,
+ IPV6_TCLASS,
+ (int *) &tos ,
+ (int) sizeof (tos));
+ else
+# endif /* IPV6_TCLASS */
+#endif /* ACE_HAS_IPV6 */
+ result = this->peer ().set_option (IPPROTO_IP,
+ IP_TOS,
+ (int *) &tos ,
+ (int) sizeof (tos));
+
+ if (TAO_debug_level)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - IIOP_Connection_Handler::"
+ "set_dscp_codepoint -> dscp: %x; result: %d; %s\n",
+ tos,
+ result,
+ result == -1 ? "try running as superuser" : ""));
+ }
+
+ // On successful setting of TOS field.
+ if (result == 0)
+ this->dscp_codepoint_ = tos;
+
+ }
+
+ return 0;
+}
+
+void
+TAO_IIOP_Connection_Handler::abort (void)
+{
+ struct linger lval;
+ lval.l_onoff = 1;
+ lval.l_linger = 0;
+
+ if (this->peer ().set_option(SOL_SOCKET,
+ SO_LINGER,
+ (void*) &lval,
+ sizeof (lval)) == -1)
+ {
+ if (TAO_debug_level)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) Unable to set ")
+ ACE_TEXT ("SO_LINGER on %d\n"),
+ this->peer ().get_handle ()));
+ }
+ }
+}
+
+
+
+//@@ CONNECTION_HANDLER_SPL_COPY_HOOK_END
+/*
+ * End copy hook
+ */
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_IIOP && TAO_HAS_IIOP != 0 */
diff --git a/TAO/tao/IIOP_Connection_Handler.h b/TAO/tao/IIOP_Connection_Handler.h
new file mode 100644
index 00000000000..d00a736d5a4
--- /dev/null
+++ b/TAO/tao/IIOP_Connection_Handler.h
@@ -0,0 +1,145 @@
+// -*- C++ -*-
+
+// ===================================================================
+/**
+ * @file IIOP_Connection_Handler.h
+ *
+ * $Id$
+ *
+ * @author Originally by Chris Cleeland as IIOP_Connect.h
+ * @author Balachandran Natarajan <bala@cs.wustl.edu>
+ */
+// ===================================================================
+
+#ifndef TAO_IIOP_CONNECTION_HANDLER_H
+#define TAO_IIOP_CONNECTION_HANDLER_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+#pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if defined (TAO_HAS_IIOP) && (TAO_HAS_IIOP != 0)
+
+#include "tao/Connection_Handler.h"
+#include "tao/Basic_Types.h"
+
+#include "ace/SOCK_Stream.h"
+#include "ace/Svc_Handler.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/// Service Handler for this transport
+typedef ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH>
+ TAO_IIOP_SVC_HANDLER;
+
+#if defined ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT
+template class TAO_Export ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH>;
+#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT */
+
+namespace IIOP
+{
+ class ListenPointList;
+}
+
+// Forward Decls
+class TAO_Pluggable_Messaging;
+
+// ****************************************************************
+
+/**
+ * @class TAO_IIOP_Connection_Handler
+ *
+ * @brief Handles requests on a single connection.
+ *
+ * The Connection handler which is common for the Acceptor and
+ * the Connector
+ */
+class TAO_Export TAO_IIOP_Connection_Handler : public TAO_IIOP_SVC_HANDLER,
+ public TAO_Connection_Handler
+{
+
+public:
+
+ TAO_IIOP_Connection_Handler (ACE_Thread_Manager * = 0);
+
+ /// Constructor.
+ TAO_IIOP_Connection_Handler (TAO_ORB_Core *orb_core,
+ CORBA::Boolean flag);
+
+ /// Destructor.
+ ~TAO_IIOP_Connection_Handler (void);
+
+ /// Called by the @c Strategy_Acceptor when the handler is completely
+ /// connected. Argument is unused.
+ virtual int open (void *);
+
+ /// Close called by the Acceptor or Connector when connection
+ /// establishment fails.
+ int close (u_long = 0);
+
+ //@{
+ /** @name Event Handler overloads
+ */
+ virtual int resume_handler (void);
+ virtual int close_connection (void);
+ virtual int handle_input (ACE_HANDLE);
+ virtual int handle_output (ACE_HANDLE);
+ virtual int handle_close (ACE_HANDLE, ACE_Reactor_Mask);
+ virtual int handle_timeout (const ACE_Time_Value &current_time,
+ const void *act = 0);
+ //@}
+
+ /// Add ourselves to Cache.
+ int add_transport_to_cache (void);
+
+ /// Process the @a listen_list
+ int process_listen_point_list (IIOP::ListenPointList &listen_list);
+
+ /// Check if network priority needs to be enabled
+ int enable_network_priority (void);
+
+ /// Set Diff-Serv codepoint on outgoing packets.
+ int set_dscp_codepoint (CORBA::Boolean set_network_priority);
+
+ virtual int open_handler (void *);
+
+ /// This is used during a canceled connection attempt. Force the
+ /// SO_LINGER timeout to 0 so that when the peer is closed, it won't
+ /// hang around.
+ void abort (void);
+
+protected:
+
+ /// Constructor that could be used by the derived classes.
+ /**
+ * Sometimes new pluggable protocols which have similarities with
+ * IIOP may be tempted to this class for their use. Classical
+ * example being that of IIOP_SSL_Connection_Handler. This
+ * constructor just initializes its base class and sets all of its
+ * contents to the default value, if any
+ */
+ TAO_IIOP_Connection_Handler (TAO_ORB_Core *orb_core);
+
+ //@{
+ /**
+ * @name TAO_Connection Handler overloads
+ */
+ virtual int release_os_resources (void);
+ //@}
+
+private:
+
+ /// Stores the type of service value.
+ int dscp_codepoint_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_IIOP && TAO_HAS_IIOP != 0 */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_IIOP_CONNECTION_HANDLER_H */
diff --git a/TAO/tao/IIOP_Connector.cpp b/TAO/tao/IIOP_Connector.cpp
new file mode 100644
index 00000000000..ec2165a07e4
--- /dev/null
+++ b/TAO/tao/IIOP_Connector.cpp
@@ -0,0 +1,650 @@
+#include "tao/IIOP_Connector.h"
+
+#if defined (TAO_HAS_IIOP) && (TAO_HAS_IIOP != 0)
+
+#include "tao/IIOP_Profile.h"
+#include "tao/debug.h"
+#include "tao/ORB_Core.h"
+#include "tao/Environment.h"
+#include "tao/Protocols_Hooks.h"
+#include "tao/Connect_Strategy.h"
+#include "tao/Thread_Lane_Resources.h"
+#include "tao/Profile_Transport_Resolver.h"
+#include "tao/Base_Transport_Property.h"
+#include "tao/Transport.h"
+#include "tao/Wait_Strategy.h"
+#include "tao/SystemException.h"
+#include "tao/LF_Multi_Event.h"
+#include "ace/OS_NS_strings.h"
+#include "ace/OS_NS_string.h"
+#include "ace/OS_NS_time.h"
+
+ACE_RCSID (tao,
+ IIOP_Connector,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+
+
+//-----------------------------------------------------------------------------
+
+/**
+ * @class TAO_Event_Handler_Array_var
+ *
+ * @brief Auto pointer like class for an array of Event Handlers.
+ *
+ * Used to manage lifecycle of handlers. This class calls
+ * ACE_Event_Handler::remove_reference() on each handler in its destructor
+ * This class started out life as a replacement for the ACE_Event_Handle_var
+ * but is now pared down to be very specific in its role..
+ */
+class TAO_IIOP_Connection_Handler_Array_Guard
+{
+public:
+ TAO_IIOP_Connection_Handler_Array_Guard (TAO_IIOP_Connection_Handler **p, unsigned count);
+ ~TAO_IIOP_Connection_Handler_Array_Guard (void);
+
+private:
+ /// Handler.
+ TAO_IIOP_Connection_Handler **ptr_;
+ unsigned count_;
+};
+
+TAO_IIOP_Connection_Handler_Array_Guard::TAO_IIOP_Connection_Handler_Array_Guard (TAO_IIOP_Connection_Handler **p,
+ unsigned count)
+ : ptr_ (p),
+ count_ (count)
+{
+}
+
+TAO_IIOP_Connection_Handler_Array_Guard::~TAO_IIOP_Connection_Handler_Array_Guard (void)
+{
+ if (this->ptr_ != 0)
+ {
+ for (unsigned i = 0; i < this->count_; i++)
+ this->ptr_[i]->remove_reference ();
+ }
+}
+
+//---------------------------------------------------------------------------
+
+
+TAO_IIOP_Connector::~TAO_IIOP_Connector (void)
+{
+}
+
+//@@ TAO_CONNECTOR_SPL_COPY_HOOK_START
+TAO_IIOP_Connector::TAO_IIOP_Connector (CORBA::Boolean flag)
+ : TAO_Connector (IOP::TAG_INTERNET_IOP)
+ , lite_flag_ (flag)
+ , connect_strategy_ ()
+ , base_connector_ ()
+{
+}
+
+int
+TAO_IIOP_Connector::open (TAO_ORB_Core *orb_core)
+{
+ // @@todo: The functionality of the following two statements could
+ // be done in the constructor, but that involves changing the
+ // interface of the pluggable transport factory.
+
+ // Set the ORB Core
+ this->orb_core (orb_core);
+
+ // Create our connect strategy
+ if (this->create_connect_strategy () == -1)
+ return -1;
+
+ /// Our connect creation strategy
+ TAO_IIOP_CONNECT_CREATION_STRATEGY *connect_creation_strategy = 0;
+
+ ACE_NEW_RETURN (connect_creation_strategy,
+ TAO_IIOP_CONNECT_CREATION_STRATEGY
+ (orb_core->thr_mgr (),
+ orb_core,
+ this->lite_flag_),
+ -1);
+
+ /// Our activation strategy
+ TAO_IIOP_CONNECT_CONCURRENCY_STRATEGY *concurrency_strategy = 0;
+
+ ACE_NEW_RETURN (concurrency_strategy,
+ TAO_IIOP_CONNECT_CONCURRENCY_STRATEGY (orb_core),
+ -1);
+
+ return this->base_connector_.open (this->orb_core ()->reactor (),
+ connect_creation_strategy,
+ &this->connect_strategy_,
+ concurrency_strategy);
+}
+
+int
+TAO_IIOP_Connector::close (void)
+{
+ delete this->base_connector_.concurrency_strategy ();
+ delete this->base_connector_.creation_strategy ();
+ return this->base_connector_.close ();
+}
+
+int
+TAO_IIOP_Connector::supports_parallel_connects(void) const
+{
+ return 1;
+}
+
+int
+TAO_IIOP_Connector::set_validate_endpoint (TAO_Endpoint *endpoint)
+{
+ TAO_IIOP_Endpoint *iiop_endpoint =
+ this->remote_endpoint (endpoint);
+
+ if (iiop_endpoint == 0)
+ return -1;
+
+ const ACE_INET_Addr &remote_address =
+ iiop_endpoint->object_addr ();
+
+ // Verify that the remote ACE_INET_Addr was initialized properly.
+ // Failure can occur if hostname lookup failed when initializing the
+ // remote ACE_INET_Addr.
+#if defined (ACE_HAS_IPV6)
+ if (remote_address.get_type () != AF_INET &&
+ remote_address.get_type () != AF_INET6)
+#else /* ACE_HAS_IPV6 */
+ if (remote_address.get_type () != AF_INET)
+#endif /* !ACE_HAS_IPV6 */
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("(%P|%t) IIOP connection failed.\n")
+ ACE_TEXT (" This is most likely ")
+ ACE_TEXT ("due to a hostname lookup ")
+ ACE_TEXT ("failure.\n")));
+ }
+
+ return -1;
+ }
+
+ return 0;
+}
+
+TAO_Transport *
+TAO_IIOP_Connector::make_connection (TAO::Profile_Transport_Resolver *r,
+ TAO_Transport_Descriptor_Interface &desc,
+ ACE_Time_Value *timeout)
+{
+ TAO_IIOP_Connection_Handler *svc_handler = 0;
+ TAO_IIOP_Endpoint *iiop_endpoint =
+ this->remote_endpoint (desc.endpoint());
+ int result = -1;
+ if (iiop_endpoint == 0)
+ return 0;
+
+ result = this->begin_connection (svc_handler, r, iiop_endpoint, timeout);
+
+ if (result == -1 && errno != EWOULDBLOCK)
+ {
+ // connect completed unsuccessfully
+ svc_handler->remove_reference();
+ // Give users a clue to the problem.
+ if (TAO_debug_level > 1)
+ {
+ ACE_DEBUG ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) IIOP_Connector::make_connection, ")
+ ACE_TEXT("connection to <%s:%d> failed (%p)\n"),
+ ACE_TEXT_CHAR_TO_TCHAR (iiop_endpoint->host ()),
+ iiop_endpoint->port (),
+ ACE_TEXT("errno")));
+ }
+ return 0;
+ }
+ TAO_IIOP_Connection_Handler **sh_ptr = &svc_handler;
+ TAO_IIOP_Endpoint **ep_ptr = &iiop_endpoint;
+ TAO_LF_Multi_Event mev;
+ mev.add_event(svc_handler);
+ return this->complete_connection (result, desc,
+ sh_ptr, ep_ptr,
+ 1U, r, &mev, timeout);
+}
+
+TAO_Transport *
+TAO_IIOP_Connector::make_parallel_connection (TAO::Profile_Transport_Resolver *r,
+ TAO_Transport_Descriptor_Interface &desc,
+ ACE_Time_Value *timeout)
+{
+ TAO_Endpoint *root_ep = desc.endpoint();
+ unsigned max_count = 1;
+ unsigned long ns_stagger =
+ this->orb_core()->orb_params()->parallel_connect_delay();
+ unsigned long sec_stagger = ns_stagger/1000;
+ ns_stagger = (ns_stagger % 1000) * 1000000;
+ for (TAO_Endpoint *ep = root_ep->next_filtered (this->orb_core(),0);
+ ep != 0;
+ ep = ep->next_filtered(this->orb_core(),root_ep))
+ max_count++;
+
+ if (TAO_debug_level > 2)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - IIOP_Connector::")
+ ACE_TEXT ("make_parallel_connection, ")
+ ACE_TEXT ("to %d endpoints\n"), max_count));
+ TAO_IIOP_Endpoint **eplist = 0;
+ TAO_IIOP_Connection_Handler **shlist = 0;
+ ACE_NEW_RETURN (shlist, TAO_IIOP_Connection_Handler *[max_count], 0);
+ ACE_NEW_RETURN (eplist, TAO_IIOP_Endpoint *[max_count], 0);
+
+ TAO_LF_Multi_Event mev;
+ int result = 0;
+ unsigned count = 0;
+ for (TAO_Endpoint *ep = root_ep->next_filtered (this->orb_core(),0);
+ ep != 0;
+ ep = ep->next_filtered(this->orb_core(),root_ep))
+ {
+ eplist[count] = this->remote_endpoint (ep);
+ shlist[count] = 0;
+ result = this->begin_connection (shlist[count],
+ r,
+ eplist[count],
+ timeout);
+
+ // The connection may fail because it is slow, or for other reasons.
+ // If it was an incomplete non-blocking connection, add it to the list
+ // to be waited on, otherwise remove the reference to the handler and
+ // move on to the next endpoint.
+ if (result == -1)
+ {
+ if (errno == EWOULDBLOCK)
+ {
+ mev.add_event(shlist[count++]);
+ if (ep->next() != 0)
+ {
+ struct timespec nsleep = {sec_stagger, ns_stagger};
+ ACE_OS::nanosleep (&nsleep);
+ result = this->active_connect_strategy_->poll (&mev);
+ if (result != -1)
+ break;
+ }
+ }
+ else
+ {
+ shlist[count]->remove_reference(); // done bump the list count
+ }
+ continue;
+ }
+
+ if (result != -1) // we have a winner!
+ {
+ count++;
+ break; // no waiting involved since a connection is completed
+ }
+ }
+
+ TAO_Transport *winner = 0;
+ if (count > 0) // only complete if at least one pending or success
+ winner = this->complete_connection (result,desc,
+ shlist,eplist,count,r,&mev,timeout);
+ delete [] shlist; // reference reductions should have been done already
+ delete [] eplist;
+ return winner;
+}
+
+int
+TAO_IIOP_Connector::begin_connection (TAO_IIOP_Connection_Handler *&svc_handler,
+ TAO::Profile_Transport_Resolver *r,
+ TAO_IIOP_Endpoint *iiop_endpoint,
+ ACE_Time_Value *timeout)
+{
+ const ACE_INET_Addr &remote_address =
+ iiop_endpoint->object_addr ();
+
+ u_short port = 0;
+ const ACE_UINT32 ia_any = INADDR_ANY;
+ ACE_INET_Addr local_addr(port, ia_any);
+
+ if (iiop_endpoint->is_preferred_network ())
+ local_addr.set (port,
+ iiop_endpoint->preferred_network ());
+#if defined (ACE_HAS_IPV6)
+ else if (remote_address.get_type () == AF_INET6)
+ local_addr.set (port,
+ ACE_IPV6_ANY);
+#endif /* ACE_HAS_IPV6 */
+
+ if (TAO_debug_level > 2)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - IIOP_Connector::begin_connection, ")
+ ACE_TEXT ("to <%s:%d> which should %s\n"),
+ ACE_TEXT_CHAR_TO_TCHAR(iiop_endpoint->host()),
+ iiop_endpoint->port(),
+ r->blocked_connect () ? ACE_TEXT("block") : ACE_TEXT("nonblock")));
+
+ // Get the right synch options
+ ACE_Synch_Options synch_options;
+
+ this->active_connect_strategy_->synch_options (timeout,
+ synch_options);
+
+ // If we don't need to block for a transport just set the timeout to
+ // be zero.
+ ACE_Time_Value tmp_zero (ACE_Time_Value::zero);
+ if (!r->blocked_connect ())
+ {
+ synch_options.timeout (ACE_Time_Value::zero);
+ timeout = &tmp_zero;
+ }
+
+ svc_handler = 0;
+
+ int result =
+ this->base_connector_.connect (svc_handler,
+ remote_address,
+ synch_options,
+ local_addr);
+
+ // The connect() method creates the service handler and bumps the
+ // #REFCOUNT# up one extra. There are four possibilities from
+ // calling connect(): (a) connection succeeds immediately - in this
+ // case, the #REFCOUNT# on the handler is two; (b) connection
+ // completion is pending - in this case, the #REFCOUNT# on the
+ // handler is also two; (c) connection fails immediately - in this
+ // case, the #REFCOUNT# on the handler is one since close() gets
+ // called on the handler; (d) the connect immediately returns when we
+ // have specified that it shouldn't block.
+ //
+ // The extra reference count in
+ // TAO_Connect_Creation_Strategy::make_svc_handler() is needed in
+ // the case when connection completion is pending and we are going
+ // to wait on a variable in the handler to changes, signifying
+ // success or failure. Note, that this increment cannot be done
+ // once the connect() returns since this might be too late if
+ // another thread pick up the completion and potentially deletes the
+ // handler before we get a chance to increment the reference count.
+ return result;
+}
+
+TAO_Transport *
+TAO_IIOP_Connector::complete_connection (int result,
+ TAO_Transport_Descriptor_Interface &desc,
+ TAO_IIOP_Connection_Handler **&sh_list,
+ TAO_IIOP_Endpoint **ep_list,
+ unsigned count,
+ TAO::Profile_Transport_Resolver *r,
+ TAO_LF_Multi_Event *mev,
+ ACE_Time_Value *timeout)
+{
+ // Make sure that we always do a remove_reference for every member
+ // of the list
+ TAO_IIOP_Connection_Handler_Array_Guard svc_handler_auto_ptr (sh_list,count);
+ TAO_Transport *transport = 0;
+ TAO_Transport **tlist = 0;
+ ACE_NEW_RETURN (tlist,TAO_Transport*[count],0);
+
+ // populate the transport list
+ for (unsigned i = 0; i < count; i++)
+ tlist[i] = sh_list[i]->transport();
+
+ if (result != -1)
+ {
+ // We received a compeleted connection and 0 or more pending.
+ // the winner is the last member of the list, because the
+ // iterator stopped on a successful connect.
+ transport = tlist[count-1];
+ }
+ else
+ {
+ if (count == 1)
+ {
+ transport = tlist[0];
+ if (!this->wait_for_connection_completion (r,
+ transport,
+ timeout))
+ {
+ if (TAO_debug_level > 2)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) - IIOP_Connector::")
+ ACE_TEXT ("complete_connection, wait for completion ")
+ ACE_TEXT ("failed for 1 pending connect\n")));
+ }
+ }
+ else
+ {
+ if (!this->wait_for_connection_completion (r,
+ transport,
+ tlist,
+ count,
+ mev,
+ timeout))
+ {
+ if (TAO_debug_level > 2)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) - IIOP_Connector::")
+ ACE_TEXT ("complete_connection, wait for completion ")
+ ACE_TEXT ("failed for %d pending connects\n"),
+ count));
+ }
+ }
+ }
+ // At this point, the connection has be successfully created
+ // connected or not connected, but we have a connection.
+ TAO_IIOP_Connection_Handler *svc_handler = 0;
+ TAO_IIOP_Endpoint *iiop_endpoint = 0;
+
+ if (transport != 0)
+ {
+ for (unsigned i = 0; i < count; i++)
+ {
+ if (transport == tlist[i])
+ {
+ svc_handler = sh_list[i];
+ if (transport->connection_handler()->keep_waiting())
+ {
+ svc_handler->add_reference();
+ }
+ iiop_endpoint = ep_list[i];
+ break;
+ }
+ }
+ }
+
+
+ // Done with the transport list. It was a temporary that did not
+ // affect the reference count.
+ delete [] tlist;
+
+ // In case of errors transport is zero
+ if (transport == 0)
+ {
+ // Give users a clue to the problem.
+ if (TAO_debug_level > 3)
+ {
+ for (unsigned i = 0; i < count; i++)
+ ACE_DEBUG ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) IIOP_Connector::make_connection, ")
+ ACE_TEXT("connection to <%s:%d> failed (%p)\n"),
+ ACE_TEXT_CHAR_TO_TCHAR (ep_list[i]->host ()),
+ ep_list[i]->port (),
+ ACE_TEXT("errno")));
+ }
+
+ return 0;
+ }
+
+
+ if (TAO_debug_level > 2)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - IIOP_Connector::make_connection, ")
+ ACE_TEXT ("new %s connection to <%s:%d> on Transport[%d]\n"),
+ transport->is_connected() ?
+ ACE_TEXT("connected") : ACE_TEXT("not connected"),
+ ACE_TEXT_CHAR_TO_TCHAR (iiop_endpoint->host ()),
+ iiop_endpoint->port (),
+ svc_handler->peer ().get_handle ()));
+ }
+
+ // Add the handler to Cache
+ int retval = -1;
+ if (count == 1U || desc.reset_endpoint(iiop_endpoint))
+ {
+ retval = this->orb_core ()->
+ lane_resources ().transport_cache ().cache_transport (&desc,
+ transport);
+ }
+
+ // Failure in adding to cache.
+ if (retval != 0)
+ {
+ // Close the handler.
+ svc_handler->close ();
+
+ if (TAO_debug_level > 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) IIOP_Connector::make_connection, ")
+ ACE_TEXT ("could not add new connection to cache\n")));
+ }
+
+ return 0;
+ }
+
+ if (transport->is_connected () &&
+ transport->wait_strategy ()->register_handler () != 0)
+ {
+ // Registration failures.
+
+ // Purge from the connection cache, if we are not in the cache, this
+ // just does nothing.
+ (void) transport->purge_entry ();
+
+ // Close the handler.
+ (void) transport->close_connection ();
+
+ if (TAO_debug_level > 0)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) IIOP_Connector [%d]::make_connection, ")
+ ACE_TEXT ("could not register the transport ")
+ ACE_TEXT ("in the reactor.\n"),
+ transport->id ()));
+
+ return 0;
+ }
+
+ return transport;
+}
+
+TAO_Profile *
+TAO_IIOP_Connector::create_profile (TAO_InputCDR& cdr)
+{
+ TAO_Profile *pfile = 0;
+ ACE_NEW_RETURN (pfile,
+ TAO_IIOP_Profile (this->orb_core ()),
+ 0);
+
+ const int r = pfile->decode (cdr);
+ if (r == -1)
+ {
+ pfile->_decr_refcnt ();
+ pfile = 0;
+ }
+
+ return pfile;
+}
+
+TAO_Profile *
+TAO_IIOP_Connector::make_profile (ACE_ENV_SINGLE_ARG_DECL)
+{
+ // The endpoint should be of the form:
+ // N.n@host:port/object_key
+ // or:
+ // host:port/object_key
+
+ TAO_Profile *profile = 0;
+ ACE_NEW_THROW_EX (profile,
+ TAO_IIOP_Profile (this->orb_core ()),
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ 0,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (0);
+
+ return profile;
+}
+
+int
+TAO_IIOP_Connector::check_prefix (const char *endpoint)
+{
+ // Check for a valid string
+ if (!endpoint || !*endpoint)
+ return -1; // Failure
+
+ static const char *protocol[] = { "iiop", "iioploc" };
+
+ const size_t slot = ACE_OS::strchr (endpoint, ':') - endpoint;
+ if (slot == 0) // an empty string is valid for corbaloc.
+ return 0;
+
+ const size_t len0 = ACE_OS::strlen (protocol[0]);
+ const size_t len1 = ACE_OS::strlen (protocol[1]);
+
+ // Check for the proper prefix in the IOR. If the proper prefix
+ // isn't in the IOR then it is not an IOR we can use.
+ if (slot == len0
+ && ACE_OS::strncasecmp (endpoint, protocol[0], len0) == 0)
+ return 0;
+ else if (slot == len1
+ && ACE_OS::strncasecmp (endpoint, protocol[1], len1) == 0)
+ return 0;
+
+ return -1;
+ // Failure: not an IIOP IOR
+ // DO NOT throw an exception here.
+}
+
+char
+TAO_IIOP_Connector::object_key_delimiter (void) const
+{
+ return TAO_IIOP_Profile::object_key_delimiter_;
+}
+
+TAO_IIOP_Endpoint *
+TAO_IIOP_Connector::remote_endpoint (TAO_Endpoint *endpoint)
+{
+ if (endpoint->tag () != IOP::TAG_INTERNET_IOP)
+ return 0;
+
+ TAO_IIOP_Endpoint *iiop_endpoint =
+ dynamic_cast<TAO_IIOP_Endpoint *> (endpoint );
+
+ if (iiop_endpoint == 0)
+ return 0;
+
+ return iiop_endpoint;
+}
+
+int
+TAO_IIOP_Connector::cancel_svc_handler (
+ TAO_Connection_Handler * svc_handler)
+{
+ TAO_IIOP_Connection_Handler* handler=
+ dynamic_cast<TAO_IIOP_Connection_Handler*>(svc_handler);
+
+ // Cancel from the connector
+ if (handler)
+ {
+ handler->abort();
+ return this->base_connector_.cancel (handler);
+ }
+
+ return -1;
+}
+
+
+//@@ TAO_CONNECTOR_SPL_COPY_HOOK_END
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_IIOP && TAO_HAS_IIOP != 0 */
diff --git a/TAO/tao/IIOP_Connector.h b/TAO/tao/IIOP_Connector.h
new file mode 100644
index 00000000000..7f234d39342
--- /dev/null
+++ b/TAO/tao/IIOP_Connector.h
@@ -0,0 +1,174 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file IIOP_Connector.h
+ *
+ * $Id$
+ *
+ * IIOP specific connector processing
+ *
+ *
+ * @author Fred Kuhns <fredk@cs.wustl.edu>
+ * @author Ossama Othman <ossama@uci.edu>
+ * @author Balachandran Natarajan <bala@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_IIOP_CONNECTOR_H
+#define TAO_IIOP_CONNECTOR_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if defined (TAO_HAS_IIOP) && (TAO_HAS_IIOP != 0)
+
+#include "tao/Transport_Connector.h"
+#include "tao/Connector_Impl.h"
+#include "tao/IIOP_Connection_Handler.h"
+
+#include "ace/SOCK_Connector.h"
+#include "ace/Connector.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_IIOP_Endpoint;
+
+// ****************************************************************
+
+/**
+ * @class TAO_IIOP_Connector
+ *
+ * @brief IIOP-specific Connector bridge for pluggable protocols.
+ *
+ * Concrete instance of the TAO_Connector class. Responsible
+ * for establishing a connection with a server and is called from the
+ * Connector_Registory.
+ */
+class TAO_Export TAO_IIOP_Connector : public TAO_Connector
+{
+public:
+ // = Initialization and termination methods.
+ /// Constructor.
+ TAO_IIOP_Connector (CORBA::Boolean flag = false);
+
+ /// Destructor.
+ ~TAO_IIOP_Connector (void);
+
+ // = The TAO_Connector methods, please check the documentation on
+ // Transport_Connector.h
+ int open (TAO_ORB_Core *orb_core);
+ int close (void);
+ TAO_Profile *create_profile (TAO_InputCDR& cdr);
+
+ virtual int check_prefix (const char *endpoint);
+
+ virtual char object_key_delimiter (void) const;
+
+public:
+
+ //@@ TAO_CONNECTOR_SPL_PUBLIC_METHODS_COPY_HOOK_START
+
+ typedef TAO_Connect_Concurrency_Strategy<TAO_IIOP_Connection_Handler>
+ TAO_IIOP_CONNECT_CONCURRENCY_STRATEGY;
+
+ typedef TAO_Connect_Creation_Strategy<TAO_IIOP_Connection_Handler>
+ TAO_IIOP_CONNECT_CREATION_STRATEGY;
+
+ typedef ACE_Connect_Strategy<TAO_IIOP_Connection_Handler,
+ ACE_SOCK_CONNECTOR>
+ TAO_IIOP_CONNECT_STRATEGY ;
+
+ typedef ACE_Strategy_Connector<TAO_IIOP_Connection_Handler,
+ ACE_SOCK_CONNECTOR>
+ TAO_IIOP_BASE_CONNECTOR;
+ //@@ TAO_CONNECTOR_SPL_PUBLIC_METHODS_COPY_HOOK_END
+
+protected:
+ /// A flag indicating the actual connector supports parallel
+ /// connection attempts. The base implementation always returns
+ /// 0. Override to return non-zero if parallel connection attempts
+ /// may be tried.
+ virtual int supports_parallel_connects (void) const;
+
+ // = The TAO_Connector methods, please check the documentation on
+ // Transport_Connector.h
+ int set_validate_endpoint (TAO_Endpoint *ep);
+
+ virtual TAO_Transport *make_connection (
+ TAO::Profile_Transport_Resolver *r,
+ TAO_Transport_Descriptor_Interface &desc,
+ ACE_Time_Value *timeout = 0);
+
+ virtual TAO_Transport *make_parallel_connection (
+ TAO::Profile_Transport_Resolver *r,
+ TAO_Transport_Descriptor_Interface &desc,
+ ACE_Time_Value *timeout = 0);
+
+ /// More TAO_Connector methods, please check the documentation on
+ /// Transport_Connector.h
+ virtual TAO_Profile *make_profile (ACE_ENV_SINGLE_ARG_DECL);
+
+ /// Cancel the passed cvs handler from the connector
+ virtual int cancel_svc_handler (TAO_Connection_Handler * svc_handler);
+
+/*
+ * Hook to copy over the protected and private data from this class to
+ * base Connector class.
+ */
+//@@ TAO_CONNECTOR_SPL_COPY_HOOK_START
+
+protected:
+
+ /// Do we need to use a GIOP_Lite for sending messages?
+ const bool lite_flag_;
+
+private:
+ /// This is the first half of making a connection. Both make_connection
+ /// and make_parallel_connection will start out using begin_connection.
+ int begin_connection (TAO_IIOP_Connection_Handler *&svc_handler,
+ TAO::Profile_Transport_Resolver *r,
+ TAO_IIOP_Endpoint *endpoint,
+ ACE_Time_Value *timeout = 0);
+
+ /// This is the second half of making a connection when several endpoints
+ /// are involved. This works with modified wait strategies to wait for one
+ /// of many transports, and when once completes it will cancel the rest.
+ /// The winning transport is returned.
+ TAO_Transport *complete_connection (int result,
+ TAO_Transport_Descriptor_Interface &desc,
+ TAO_IIOP_Connection_Handler **&sh_list,
+ TAO_IIOP_Endpoint **ep_list,
+ unsigned count,
+ TAO::Profile_Transport_Resolver *r,
+ TAO_LF_Multi_Event *mev,
+ ACE_Time_Value *timeout = 0);
+
+
+
+ /// Return the remote endpoint, a helper function
+ TAO_IIOP_Endpoint *remote_endpoint (TAO_Endpoint *ep);
+
+private:
+
+ /// Our connect strategy
+ TAO_IIOP_CONNECT_STRATEGY connect_strategy_;
+
+ /// The connector initiating connection requests for IIOP.
+ TAO_IIOP_BASE_CONNECTOR base_connector_;
+
+//@@ TAO_CONNECTOR_SPL_COPY_HOOK_END
+
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_IIOP && TAO_HAS_IIOP != 0 */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_IIOP_CONNECTOR_H */
diff --git a/TAO/tao/IIOP_Endpoint.cpp b/TAO/tao/IIOP_Endpoint.cpp
new file mode 100644
index 00000000000..4538689ce28
--- /dev/null
+++ b/TAO/tao/IIOP_Endpoint.cpp
@@ -0,0 +1,608 @@
+/*
+ * Add all include files within the following
+ * two markers.
+ */
+//@@ TAO_ENDPOINT_SPL_COPY_HOOK_START
+
+#include "tao/IIOP_Endpoint.h"
+
+#if defined (TAO_HAS_IIOP) && (TAO_HAS_IIOP != 0)
+
+#include "tao/IOP_IORC.h"
+#include "tao/debug.h"
+#include "tao/ORB_Core.h"
+
+#include "ace/Log_Msg.h"
+#include "ace/Guard_T.h"
+#include "ace/OS_NS_string.h"
+#include "ace/OS_NS_strings.h"
+
+ACE_RCSID (tao,
+ IIOP_Endpoint,
+ "$Id$")
+
+#if !defined (__ACE_INLINE__)
+# include "tao/IIOP_Endpoint.i"
+#endif /* __ACE_INLINE__ */
+
+#include "ace/OS_NS_stdio.h"
+#include "ace/os_include/os_netdb.h"
+
+#include "ace/Vector_T.h"
+#include "ace/ACE.h"
+#include "ace/INET_Addr.h"
+#include "ace/Sock_Connect.h"
+
+//@@ TAO_ENDPOINT_SPL_COPY_HOOK_END
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+//@@ TAO_ENDPOINT_SPL_COPY_HOOK_START
+TAO_IIOP_Endpoint::TAO_IIOP_Endpoint (const ACE_INET_Addr &addr,
+ int use_dotted_decimal_addresses)
+ : TAO_Endpoint (IOP::TAG_INTERNET_IOP)
+ , host_ ()
+ , port_ (683) // default port (IANA assigned)
+#if defined (ACE_HAS_IPV6)
+ , is_ipv6_decimal_ (false)
+#endif /* ACE_HAS_IPV6 */
+ , is_encodable_ (true)
+ , object_addr_set_ (false)
+ , object_addr_ (addr)
+ , preferred_path_ ()
+ , next_ (0)
+{
+ this->set (addr, use_dotted_decimal_addresses);
+}
+
+TAO_IIOP_Endpoint::TAO_IIOP_Endpoint (const char *host,
+ CORBA::UShort port,
+ const ACE_INET_Addr &addr,
+ CORBA::Short priority)
+ : TAO_Endpoint (IOP::TAG_INTERNET_IOP, priority)
+ , host_ ()
+ , port_ (port)
+#if defined (ACE_HAS_IPV6)
+ , is_ipv6_decimal_ (false)
+#endif /* ACE_HAS_IPV6 */
+ , is_encodable_ (true)
+ , object_addr_set_ (false)
+ , object_addr_ (addr)
+ , preferred_path_ ()
+ , next_ (0)
+{
+ this->host(host); // With IPv6 performs check for decimal address
+}
+
+TAO_IIOP_Endpoint::TAO_IIOP_Endpoint (void)
+ : TAO_Endpoint (IOP::TAG_INTERNET_IOP)
+ , host_ ()
+ , port_ (683) // default port (IANA assigned)
+#if defined (ACE_HAS_IPV6)
+ , is_ipv6_decimal_ (false)
+#endif /* ACE_HAS_IPV6 */
+ , is_encodable_ (true)
+ , object_addr_set_ (false)
+ , object_addr_ ()
+ , preferred_path_ ()
+ , next_ (0)
+{
+}
+
+TAO_IIOP_Endpoint::TAO_IIOP_Endpoint (const char *host,
+ CORBA::UShort port,
+ CORBA::Short priority)
+ : TAO_Endpoint (IOP::TAG_INTERNET_IOP, priority)
+ , host_ ()
+ , port_ (port)
+#if defined (ACE_HAS_IPV6)
+ , is_ipv6_decimal_ (false)
+#endif /* ACE_HAS_IPV6 */
+ , is_encodable_ (true)
+ , object_addr_set_ (false)
+ , object_addr_ ()
+ , preferred_path_ ()
+ , next_ (0)
+{
+ this->host(host); // With IPv6 performs check for decimal address
+}
+//@@ TAO_ENDPOINT_SPL_COPY_HOOK_END
+
+
+TAO_IIOP_Endpoint &
+TAO_IIOP_Endpoint::operator= (const TAO_IIOP_Endpoint &other)
+{
+ this->host_ = other.host_;
+ this->port_ = other.port_;
+#if defined (ACE_HAS_IPV6)
+ this->is_ipv6_decimal_ = other.is_ipv6_decimal_;
+#endif /* ACE_HAS_IPV6 */
+ this->is_encodable_ = other.is_encodable_;
+ this->object_addr_set_ = other.object_addr_set_;
+ this->object_addr_ = other.object_addr_;
+ this->preferred_path_ = other.preferred_path_;
+ this->next_ = 0; // do not copy list membership, since we are only cloning the values
+ return *this;
+}
+
+TAO_IIOP_Endpoint::~TAO_IIOP_Endpoint (void)
+{
+}
+
+//@@ TAO_ENDPOINT_SPL_COPY_HOOK_START
+
+TAO_IIOP_Endpoint::TAO_IIOP_Endpoint (const TAO_IIOP_Endpoint &rhs)
+ : TAO_Endpoint (rhs.tag_, rhs.priority_)
+ , host_ (rhs.host_)
+ , port_ (rhs.port_)
+#if defined (ACE_HAS_IPV6)
+ , is_ipv6_decimal_ (rhs.is_ipv6_decimal_)
+#endif /* ACE_HAS_IPV6 */
+ , is_encodable_ (rhs.is_encodable_)
+ , object_addr_set_ (rhs.object_addr_set_)
+ , object_addr_ (rhs.object_addr_)
+ , preferred_path_ (rhs.preferred_path_)
+ , next_ (0)
+{
+}
+
+int
+TAO_IIOP_Endpoint::set (const ACE_INET_Addr &addr,
+ int use_dotted_decimal_addresses)
+{
+ char tmp_host[MAXHOSTNAMELEN + 1];
+
+#if defined (ACE_HAS_IPV6)
+ this->is_ipv6_decimal_ = false; // Reset
+#endif /* ACE_HAS_IPV6 */
+
+ if (use_dotted_decimal_addresses
+ || addr.get_host_name (tmp_host, sizeof (tmp_host)) != 0)
+ {
+ if (use_dotted_decimal_addresses == 0 && TAO_debug_level > 5)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - IIOP_Endpoint::set, ")
+ ACE_TEXT ("%p\n"),
+ ACE_TEXT ("cannot determine hostname")));
+ }
+
+ const char *tmp = addr.get_host_addr ();
+ if (tmp == 0)
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) - IIOP_Endpoint::set, ")
+ ACE_TEXT ("%p\n"),
+ ACE_TEXT ("cannot determine hostname and hostaddr")));
+ }
+ return -1;
+ }
+ else
+ {
+ this->host_ = tmp;
+#if defined (ACE_HAS_IPV6)
+ if (addr.get_type () == PF_INET6)
+ this->is_ipv6_decimal_ = true;
+#endif /* ACE_HAS_IPV6 */
+ }
+ }
+ else
+ this->host_ = CORBA::string_dup (tmp_host);
+
+ this->port_ = addr.get_port_number();
+
+ return 0;
+}
+
+int
+TAO_IIOP_Endpoint::addr_to_string (char *buffer, size_t length)
+{
+ size_t actual_len =
+ ACE_OS::strlen (this->host_.in ()) // chars in host name
+ + sizeof (':') // delimiter
+ + ACE_OS::strlen ("65536") // max port
+ + sizeof ('\0');
+
+#if defined (ACE_HAS_IPV6)
+ if (this->is_ipv6_decimal_)
+ actual_len += 2; // '[' + ']'
+#endif /* ACE_HAS_IPV6 */
+
+ if (length < actual_len)
+ return -1;
+
+#if defined (ACE_HAS_IPV6)
+ if (this->is_ipv6_decimal_)
+ ACE_OS::sprintf (buffer, "[%s]:%d",
+ this->host_.in (), this->port_);
+ else
+#endif /* ACE_HAS_IPV6 */
+ ACE_OS::sprintf (buffer, "%s:%d",
+ this->host_.in (), this->port_);
+
+ return 0;
+}
+
+const char *
+TAO_IIOP_Endpoint::host (const char *h)
+{
+ this->host_ = h;
+#if defined (ACE_HAS_IPV6)
+ if (ACE_OS::strchr (h, ':') != 0)
+ this->is_ipv6_decimal_ = true;
+#endif /* ACE_HAS_IPV6 */
+
+ return this->host_.in ();
+}
+
+TAO_Endpoint *
+TAO_IIOP_Endpoint::next (void)
+{
+ return this->next_;
+}
+
+TAO_Endpoint *
+TAO_IIOP_Endpoint::next_filtered (TAO_ORB_Core * orb_core, TAO_Endpoint *root)
+{
+ bool want_ipv6 = false;
+ bool ipv6_only = false;
+ bool prefer_ipv6 = false;
+#if defined (ACE_HAS_IPV6)
+ want_ipv6 = true;
+ ipv6_only = orb_core->orb_params()->connect_ipv6_only();
+ prefer_ipv6 = orb_core->orb_params()->prefer_ipv6_interfaces();
+#else
+ ACE_UNUSED_ARG (orb_core);
+#endif /* ACE_HAS_IPV6 */
+ return
+ this->next_filtered_i (static_cast<TAO_IIOP_Endpoint *>(root),
+ ipv6_only,
+ prefer_ipv6,
+ want_ipv6);
+}
+
+TAO_IIOP_Endpoint*
+TAO_IIOP_Endpoint::next_filtered_i (TAO_IIOP_Endpoint *root,
+ bool ipv6_only,
+ bool prefer_ipv6,
+ bool want_ipv6)
+{
+ // the candidate is nominally the next entry in the list, but since
+ // the list may loop back on itself, the root of the list needs to be
+ // initialized.
+ TAO_IIOP_Endpoint *candidate = (root == 0) ? this : next_;
+ if (root == 0)
+ root = this;
+
+#if defined (ACE_HAS_IPV6)
+ if (ipv6_only)
+ {
+ if (candidate == 0 || candidate->is_ipv6_decimal())
+ return candidate;
+ const ACE_INET_Addr &addr = candidate->object_addr ();
+ bool allowed = addr.get_type () == AF_INET6 &&
+ !addr.is_ipv4_mapped_ipv6();
+
+ return allowed ? candidate :
+ candidate->next_filtered_i(root, ipv6_only, prefer_ipv6, true);
+ }
+ if (prefer_ipv6)
+ {
+ if (candidate == 0)
+ return !want_ipv6 ? candidate :
+ root->next_filtered_i(root, ipv6_only, prefer_ipv6, false);
+
+ if (want_ipv6 == candidate->is_ipv6_decimal())
+ return candidate;
+
+ const ACE_INET_Addr &addr = candidate->object_addr ();
+ bool really_ipv6 = addr.get_type () == AF_INET6 &&
+ !addr.is_ipv4_mapped_ipv6();
+ return (want_ipv6 == really_ipv6) ? candidate :
+ candidate->next_filtered_i(root, ipv6_only, prefer_ipv6, want_ipv6);
+ }
+#else
+ ACE_UNUSED_ARG (want_ipv6);
+ ACE_UNUSED_ARG (ipv6_only);
+ ACE_UNUSED_ARG (prefer_ipv6);
+#endif
+
+ return candidate;
+}
+
+TAO_Endpoint *
+TAO_IIOP_Endpoint::duplicate (void)
+{
+ TAO_IIOP_Endpoint *endpoint = 0;
+
+ // @@ NOTE: Not exception safe..
+ ACE_NEW_RETURN (endpoint, TAO_IIOP_Endpoint (*this), 0);
+
+ return endpoint;
+}
+
+const ACE_INET_Addr &
+TAO_IIOP_Endpoint::object_addr (void) const
+{
+ // The object_addr_ is initialized here, rather than at IOR decode
+ // time for several reasons:
+ // 1. A request on the object may never be invoked.
+ // 2. The DNS setup may have changed dynamically.
+ // ...etc..
+
+ // Double checked locking optimization.
+ if (!this->object_addr_set_)
+ {
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
+ guard,
+ this->addr_lookup_lock_,
+ this->object_addr_);
+
+ if (!this->object_addr_set_)
+ {
+ (void) this->object_addr_i ();
+ }
+ }
+
+ return this->object_addr_;
+}
+
+void
+TAO_IIOP_Endpoint::object_addr_i (void) const
+{
+ // We should have already held the lock
+
+#if defined (ACE_HAS_IPV6)
+ bool is_ipv4_decimal_ = false;
+ if (!this->is_ipv6_decimal_)
+ is_ipv4_decimal_ =
+ ACE_OS::strspn (this->host_.in (), ".0123456789") ==
+ ACE_OS::strlen (this->host_.in ());
+
+ // If this is *not* an IPv4 decimal address at first try to
+ // resolve the address as an IPv6 address; if that fails
+ // (or it's an IPv4 address) and the address is *not* an IPv6
+ // decimal address try to resolve it as an IPv4 address.
+ if ((is_ipv4_decimal_ ||
+ this->object_addr_.set (this->port_,
+ this->host_.in (),
+ 1,
+ AF_INET6) == -1) &&
+ (this->is_ipv6_decimal_ ||
+ this->object_addr_.set (this->port_,
+ this->host_.in (),
+ 1,
+ AF_INET) == -1))
+#else
+ if (this->object_addr_.set (this->port_,
+ this->host_.in ()) == -1)
+#endif
+ {
+ // If this call fails, it most likely due a hostname
+ // lookup failure caused by a DNS misconfiguration. If
+ // a request is made to the object at the given host and
+ // port, then a CORBA::TRANSIENT() exception should be
+ // thrown.
+
+ // Invalidate the ACE_INET_Addr. This is used as a flag
+ // to denote that ACE_INET_Addr initialization failed.
+ this->object_addr_.set_type (-1);
+ }
+ else
+ {
+ this->object_addr_set_ = true;
+ }
+}
+
+static ACE_CString find_local(const ACE_Vector<ACE_CString>& local_ips,
+ const ACE_CString& pattern)
+{
+ for (size_t i = 0; i < local_ips.size(); ++i)
+ {
+ ACE_CString ret = local_ips[i];
+ if (ACE::wild_match(ret.c_str(), pattern.c_str()))
+ return ret;
+ }
+ return "";
+}
+
+TAO_IIOP_Endpoint*
+TAO_IIOP_Endpoint::add_local_endpoint(TAO_IIOP_Endpoint* ep, const char* local)
+{
+ TAO_Endpoint* tmp = ep->duplicate();
+ ep->next_ = static_cast<TAO_IIOP_Endpoint*>(tmp);
+ ep->next_->is_encodable_ = true;
+ ep->next_->preferred_path_.host = CORBA::string_dup(local);
+ return ep->next_;
+}
+
+static void
+get_ip_interfaces(ACE_Vector<ACE_CString>& local_ips)
+{
+ ACE_INET_Addr* tmp = 0;
+ size_t cnt = 0;
+ int err = ACE::get_ip_interfaces (cnt, tmp);
+ if (err != 0)
+ return;
+#if defined (ACE_HAS_IPV6)
+ char buf[64];
+#else /* ACE_HAS_IPV6 */
+ char buf[32];
+#endif /* !ACE_HAS_IPV6 */
+ for (size_t i = 0; i < cnt; ++i)
+ {
+ const char *s_if = tmp[i].get_host_addr(buf, sizeof (buf));
+ ACE_ASSERT(s_if != 0);
+ ACE_CString tmp(s_if);
+ //ssize_t pos = tmp.find(':');
+ //if (pos != ACE_CString::npos)
+ // tmp = tmp.substr(0, pos);
+ local_ips.push_back(tmp);
+ }
+ delete[] tmp;
+}
+
+// Given a comma separated list of preferred interface directives, which
+// are of the form <wild_remote>=<wild_local>, this function will retrieve
+// the list of preferred local ip addresses by matching wild_local against
+// the list of all local ip interfaces, for any directive where wild_remote
+// matches the host from our endpoint.
+static void find_preferred_interfaces (const ACE_CString& host,
+ const ACE_CString& csvPreferred,
+ ACE_Vector<ACE_CString>& preferred)
+{
+ ACE_Vector<ACE_CString> local_ips;
+ get_ip_interfaces(local_ips);
+ if (local_ips.size() == 0)
+ return;
+
+ // The outer loop steps through each preferred interface directive
+ // and chains a new endpoint if the remote interface matches the
+ // current endpoint.
+ ACE_CString::size_type index = 0;
+ while (index < csvPreferred.length())
+ {
+ ACE_CString::size_type comma = csvPreferred.find(',', index);
+ ACE_CString::size_type assign = csvPreferred.find('=', index);
+
+ if (assign == ACE_CString::npos)
+ {
+ assign = csvPreferred.find(':', index);
+ if (assign == ACE_CString::npos)
+ {
+ ACE_ASSERT(assign != ACE_CString::npos);
+ return;
+ }
+ }
+
+ ACE_CString wild_local;
+ if (comma == ACE_CString::npos)
+ wild_local = csvPreferred.substr(assign + 1);
+ else
+ wild_local = csvPreferred.substr(assign + 1, comma - assign - 1);
+ ACE_CString wild_remote = csvPreferred.substr(index, assign - index);
+
+ index = comma + 1;
+
+ // For now, we just try to match against the host literally. In
+ // the future it might be worthwhile to resolve some aliases for
+ // this->host_ using DNS (and possibly reverse DNS) lookups. Then we
+ // could try matching against those too.
+ if (ACE::wild_match(host.c_str(), wild_remote.c_str(), false))
+ {
+ // If it's a match, then it means we need to use a
+ // local interface that matches wild_local.
+ ACE_CString local = find_local(local_ips, wild_local);
+ if (local.length() > 0)
+ {
+ preferred.push_back(local);
+ }
+ else
+ {
+ // There is no matching local interface, so we can skip
+ // to the next preferred interface directive.
+ }
+ }
+ else
+ {
+ // The preferred interface directive is for a different
+ // remote endpoint.
+ }
+ if (comma == ACE_CString::npos)
+ break;
+ }
+}
+
+CORBA::ULong
+TAO_IIOP_Endpoint::preferred_interfaces (const char* csv, bool enforce)
+{
+ ACE_Vector<ACE_CString> preferred;
+ find_preferred_interfaces(this->host_.in(), csv, preferred);
+ CORBA::ULong count = preferred.size();
+ if (count > 0)
+ {
+ this->is_encodable_ = true;
+ this->preferred_path_.host = CORBA::string_dup(preferred[0].c_str());
+ TAO_IIOP_Endpoint* ep = this;
+ for (size_t i = 1; i < count; ++i)
+ {
+ ep = add_local_endpoint(ep, preferred[i].c_str());
+ }
+
+ // If we're not enforcing the preferred interfaces, then we can just add
+ // a new non-preferred endpoint to the end with a default local addr.
+ if (! enforce)
+ {
+ ep = add_local_endpoint(ep, "");
+ }
+ else
+ {
+ --count;
+ }
+ }
+ return count;
+}
+
+CORBA::Boolean
+TAO_IIOP_Endpoint::is_equivalent (const TAO_Endpoint *other_endpoint)
+{
+ const TAO_IIOP_Endpoint *endpoint =
+ dynamic_cast<const TAO_IIOP_Endpoint *> (other_endpoint);
+
+ if (endpoint == 0)
+ return 0;
+
+ return (this->port_ == endpoint->port_
+ && (ACE_OS::strcmp (this->host (), endpoint->host ()) == 0));
+}
+
+CORBA::ULong
+TAO_IIOP_Endpoint::hash (void)
+{
+ if (this->hash_val_ != 0)
+ return this->hash_val_;
+
+ {
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
+ guard,
+ this->addr_lookup_lock_,
+ this->hash_val_);
+ // .. DCL
+ if (this->hash_val_ != 0)
+ return this->hash_val_;
+
+ // A few comments about this optimization. The call below will
+ // deadlock if the object_addr_set is false. If you don't belive
+
+ if (!this->object_addr_set_)
+ {
+ // Set the object_addr first
+ (void) this->object_addr_i ();
+ }
+
+ this->hash_val_ = this->object_addr_.hash ();
+ }
+
+ return this->hash_val_;
+}
+
+bool
+TAO_IIOP_Endpoint::is_preferred_network (void) const
+{
+ return (this->preferred_path_.host.in () != 0 &&
+ this->preferred_path_.host.in ()[0] != 0);
+}
+
+const char *
+TAO_IIOP_Endpoint::preferred_network (void) const
+{
+ return this->preferred_path_.host.in ();
+}
+
+//@@ TAO_ENDPOINT_SPL_COPY_HOOK_END
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_IIOP && TAO_HAS_IIOP != 0 */
diff --git a/TAO/tao/IIOP_Endpoint.h b/TAO/tao/IIOP_Endpoint.h
new file mode 100644
index 00000000000..fff92575b94
--- /dev/null
+++ b/TAO/tao/IIOP_Endpoint.h
@@ -0,0 +1,234 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file IIOP_Endpoint.h
+ *
+ * $Id$
+ *
+ IIOP implementation of PP Framework Endpoint interface.
+ *
+ * @author Marina Spivak <marina@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_IIOP_ENDPOINT_H
+#define TAO_IIOP_ENDPOINT_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if defined (TAO_HAS_IIOP) && (TAO_HAS_IIOP != 0)
+
+#include "tao/CORBA_String.h"
+#include "tao/IIOP_EndpointsC.h"
+#include "tao/Endpoint.h"
+
+#include "ace/INET_Addr.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_IIOP_Connection_Handler;
+
+/**
+ * @class TAO_IIOP_Endpoint
+ *
+ * @brief TAO_IIOP_Endpoint
+ *
+ * IIOP-specific implementation of PP Framework Endpoint interface.
+ */
+class TAO_Export TAO_IIOP_Endpoint : public TAO_Endpoint
+{
+public:
+
+ //@@ TAO_ENDPOINT_SPL_PUBLIC_METHODS_COPY_HOOK_START
+
+ // @todo Lose these friends!
+ friend class TAO_IIOP_Profile;
+ friend class TAO_SSLIOP_Profile;
+
+ // = Initialization and termination methods.
+
+ /// Default constructor.
+ TAO_IIOP_Endpoint (void);
+
+ /// Constructor. This is the most efficient constructor since it
+ /// does not require any address resolution processing.
+ TAO_IIOP_Endpoint (const char *host,
+ CORBA::UShort port,
+ const ACE_INET_Addr &addr,
+ CORBA::Short priority = TAO_INVALID_PRIORITY);
+
+ /// Constructor.
+ TAO_IIOP_Endpoint (const ACE_INET_Addr &addr,
+ int use_dotted_decimal_addresses);
+
+ /// Constructor. This constructor is used when decoding endpoints.
+ TAO_IIOP_Endpoint (const char *host,
+ CORBA::UShort port,
+ CORBA::Short priority);
+
+
+ //@@ TAO_ENDPOINT_SPL_PUBLIC_METHODS_COPY_HOOK_END
+
+ /// Destructor.
+ ~TAO_IIOP_Endpoint (void);
+
+
+ // = Implementation of abstract TAO_Endpoint methods. See
+ // Endpoint.h for their documentation.
+
+ virtual TAO_Endpoint *next (void);
+
+ /**
+ * Return the next endpoint in the list, but use protocol-specific
+ * filtering to constrain the value. The orb core is needed to supply
+ * any sort of filter arguments, and the root endpoint is needed in case
+ * the algorithm needs to rewind. If the supplied root is 0, then this
+ * is assumed to be the candidate next endpoint.
+ *
+ * To use this, the caller starts off the change with root == 0. This
+ * is a bit of a violation in logic, a more correct implementation would
+ * accept this == 0 and a non-null root.
+ * To do iteration using next_filtered, do:
+ * for (TAO_Endpoint *ep = root_endpoint->next_filtered (orb_core, 0);
+ * ep != 0;
+ * ep = ep->next_filtered(orb_core, root_endpoint)) { }
+ */
+ virtual TAO_Endpoint *next_filtered (TAO_ORB_Core *, TAO_Endpoint *root);
+
+ virtual int addr_to_string (char *buffer, size_t length);
+
+ /// Makes a copy of @c this
+ virtual TAO_Endpoint *duplicate (void);
+
+ /// Return true if this endpoint is equivalent to @a other_endpoint. Two
+ /// endpoints are equivalent if their port and host are the same.
+ virtual CORBA::Boolean is_equivalent (const TAO_Endpoint *other_endpoint);
+
+ /// Return a hash value for this object.
+ virtual CORBA::ULong hash (void);
+
+ // = IIOP_Endpoint-specific methods.
+
+ /*
+ * Hook to copy only the non virtual concrete methods implemented
+ * in this class to the derived class in the specialization.
+ */
+ //@@ TAO_ENDPOINT_SPL_PUBLIC_METHODS_COPY_HOOK_START
+
+ /// Return a reference to the <object_addr>.
+ const ACE_INET_Addr &object_addr (void) const;
+
+ /// Return a pointer to the host string. This object maintains
+ /// ownership of this string.
+ const char *host (void) const;
+
+ /// Copy the string <h> into <host_> and return the resulting pointer.
+ /// This object maintains ownership of this string.
+ const char *host (const char *h);
+
+ /// Return the port number.
+ CORBA::UShort port (void) const;
+
+ /// Set the port number.
+ CORBA::UShort port (CORBA::UShort p);
+
+ /// Do we have a preferred local network for the target?
+ bool is_preferred_network (void) const;
+
+ /// Return the preferred network if any.
+ const char *preferred_network (void) const;
+
+#if defined (ACE_HAS_IPV6)
+ /// Does the host string represent an IPv6 decimal address.
+ bool is_ipv6_decimal (void) const;
+#endif /* ACE_HAS_IPV6 */
+
+ //@@ TAO_ENDPOINT_SPL_PUBLIC_METHODS_COPY_HOOK_END
+
+
+ /// Need to have an assignment operator since the IIOP_Profile class may
+ /// have to reorder its list of endpoints based on filtering by the EndpointPolicy.
+ TAO_IIOP_Endpoint & operator= (const TAO_IIOP_Endpoint& other);
+
+private:
+ TAO_IIOP_Endpoint *next_filtered_i (TAO_IIOP_Endpoint *root,
+ bool ipv6_only,
+ bool prefer_ipv6,
+ bool want_ipv6);
+
+
+ //@@ TAO_ENDPOINT_SPL_PRIVATE_DATA_COPY_HOOK_START
+
+ /// Helper method for setting INET_Addr.
+ int set (const ACE_INET_Addr &addr,
+ int use_dotted_decimal_addresses);
+
+ /// Helper method for object_addr () call.
+ void object_addr_i (void) const;
+
+ /// Generate preferred interfaces from the options passed in by the
+ /// user.
+ CORBA::ULong preferred_interfaces (const char* csvPreferred, bool enforce);
+
+ /// Chain a new duplicate of ourself with the specified
+ /// local preferred interface.
+ TAO_IIOP_Endpoint* add_local_endpoint(TAO_IIOP_Endpoint* ep, const char* local);
+
+ /// Canonical copy constructor
+ /**
+ * In private section to prevent clients from invoking this
+ * accidentally. Clients should only use duplicate () to make a depp
+ * copy
+ */
+ TAO_IIOP_Endpoint (const TAO_IIOP_Endpoint &);
+
+private:
+
+ /// String representing the host name.
+ CORBA::String_var host_;
+
+ /// TCP port number.
+ CORBA::UShort port_;
+
+#if defined (ACE_HAS_IPV6)
+ /// Does the host string represent an IPv6 decimal address.
+ bool is_ipv6_decimal_;
+#endif /* ACE_HAS_IPV6 */
+
+ /// Is this endpoint created encodable as part of the IOR?
+ bool is_encodable_;
+
+ /// Flag to indicate if the address has been resolved and set.
+ mutable bool object_addr_set_;
+
+ /// Cached instance of ACE_INET_Addr for use in making
+ /// invocations, etc.
+ mutable ACE_INET_Addr object_addr_;
+
+ /// Preferred path for this endpoint.
+ TAO::IIOP_Endpoint_Info preferred_path_;
+
+ /// IIOP Endpoints can be stringed into a list. Return the next
+ /// endpoint in the list, if any.
+ TAO_IIOP_Endpoint *next_;
+
+ //@@ TAO_ENDPOINT_SPL_PRIVATE_DATA_COPY_HOOK_END
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/IIOP_Endpoint.i"
+#endif /* __ACE_INLINE__ */
+
+#endif /* TAO_HAS_IIOP && TAO_HAS_IIOP != 0 */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_IIOP_PROFILE_H */
diff --git a/TAO/tao/IIOP_Endpoint.i b/TAO/tao/IIOP_Endpoint.i
new file mode 100644
index 00000000000..c98e79c652c
--- /dev/null
+++ b/TAO/tao/IIOP_Endpoint.i
@@ -0,0 +1,37 @@
+// -*- C++ -*-
+//
+// $Id$
+
+#if defined (TAO_HAS_IIOP) && (TAO_HAS_IIOP != 0)
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE const char *
+TAO_IIOP_Endpoint::host (void) const
+{
+ return this->host_.in ();
+}
+
+ACE_INLINE CORBA::UShort
+TAO_IIOP_Endpoint::port (void) const
+{
+ return this->port_;
+}
+
+ACE_INLINE CORBA::UShort
+TAO_IIOP_Endpoint::port (CORBA::UShort p)
+{
+ return this->port_ = p;
+}
+
+#if defined (ACE_HAS_IPV6)
+ACE_INLINE bool
+TAO_IIOP_Endpoint::is_ipv6_decimal (void) const
+{
+ return this->is_ipv6_decimal_;
+}
+#endif /* ACE_HAS_IPV6 */
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_IIOP && TAO_HAS_IIOP != 0 */
diff --git a/TAO/tao/IIOP_Endpoints.pidl b/TAO/tao/IIOP_Endpoints.pidl
new file mode 100644
index 00000000000..192000d8536
--- /dev/null
+++ b/TAO/tao/IIOP_Endpoints.pidl
@@ -0,0 +1,42 @@
+//
+// $Id$
+
+/**
+ * This file contains idl definition for data structures used to
+ * encapsulate data in TAO_TAG_ENDPOINTS tagged component. This
+ * TAO-specific component is used for transmission of multiple
+ * endpoints per single profile. Data structures defined here are
+ * used for transmission of IIOP endpoints. See IIOP_Profile.*
+ * for more details.
+ *
+ * This file was used to generate the code in
+ * IIOP_EndpointsC.* The command used to generate code
+ * is:
+ *
+ * tao_idl
+ * -o orig -Ge 1 -GA -Sci \
+ * -Wb,export_macro=TAO_Export \
+ * -Wb,export_include="tao/TAO_Export.h" \
+ * -Wb,pre_include="ace/pre.h" \
+ * -Wb,post_include="ace/post.h" \
+ * IIOP_Endpoints.pidl
+ */
+
+#ifndef _TAO_IIOP_ENDPOINTS_IDL_
+#define _TAO_IIOP_ENDPOINTS_IDL_
+
+module TAO
+{
+ /// Stores information for a single IIOP endpoint.
+ struct IIOP_Endpoint_Info
+ {
+ string host;
+ short port;
+ short priority;
+ };
+
+ /// Stores information for a collection of IIOP endpoints.
+ typedef sequence <IIOP_Endpoint_Info> IIOPEndpointSequence;
+};
+
+#endif /* _TAO_IIOP_ENDPOINTS_IDL_ */
diff --git a/TAO/tao/IIOP_Factory.cpp b/TAO/tao/IIOP_Factory.cpp
new file mode 100644
index 00000000000..3ba32da5e0a
--- /dev/null
+++ b/TAO/tao/IIOP_Factory.cpp
@@ -0,0 +1,97 @@
+#include "tao/IIOP_Factory.h"
+
+#if defined (TAO_HAS_IIOP) && (TAO_HAS_IIOP != 0)
+
+#include "tao/IIOP_Acceptor.h"
+#include "tao/IIOP_Connector.h"
+#include "tao/IOP_IORC.h"
+#include "ace/OS_NS_strings.h"
+
+ACE_RCSID (tao,
+ IIOP_Factory,
+ "$Id$")
+
+
+static const char the_prefix[] = "iiop";
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_IIOP_Protocol_Factory::TAO_IIOP_Protocol_Factory (void)
+ : TAO_Protocol_Factory (IOP::TAG_INTERNET_IOP),
+ major_ (TAO_DEF_GIOP_MAJOR),
+ minor_ (TAO_DEF_GIOP_MINOR)
+{
+}
+
+TAO_IIOP_Protocol_Factory::~TAO_IIOP_Protocol_Factory (void)
+{
+}
+
+int
+TAO_IIOP_Protocol_Factory::match_prefix (const ACE_CString &prefix)
+{
+ // Check for the proper prefix for this protocol.
+ return (ACE_OS::strcasecmp (prefix.c_str (), ::the_prefix) == 0);
+}
+
+const char *
+TAO_IIOP_Protocol_Factory::prefix (void) const
+{
+ return ::the_prefix;
+}
+
+char
+TAO_IIOP_Protocol_Factory::options_delimiter (void) const
+{
+ return '/';
+}
+
+TAO_Acceptor *
+TAO_IIOP_Protocol_Factory::make_acceptor (void)
+{
+ TAO_Acceptor *acceptor = 0;
+
+ ACE_NEW_RETURN (acceptor,
+ TAO_IIOP_Acceptor,
+ 0);
+
+ return acceptor;
+}
+
+int
+TAO_IIOP_Protocol_Factory::init (int /* argc */,
+ ACE_TCHAR* /* argv */ [])
+{
+ return 0;
+}
+
+TAO_Connector *
+TAO_IIOP_Protocol_Factory::make_connector (void)
+{
+ TAO_Connector *connector = 0;
+
+ ACE_NEW_RETURN (connector,
+ TAO_IIOP_Connector,
+ 0);
+ return connector;
+}
+
+int
+TAO_IIOP_Protocol_Factory::requires_explicit_endpoint (void) const
+{
+ return 0;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DEFINE (TAO_IIOP_Protocol_Factory,
+ ACE_TEXT ("IIOP_Factory"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (TAO_IIOP_Protocol_Factory),
+ ACE_Service_Type::DELETE_THIS |
+ ACE_Service_Type::DELETE_OBJ,
+ 0)
+
+ACE_FACTORY_DEFINE (TAO, TAO_IIOP_Protocol_Factory)
+
+#endif /* TAO_HAS_IIOP && TAO_HAS_IIOP != 0 */
diff --git a/TAO/tao/IIOP_Factory.h b/TAO/tao/IIOP_Factory.h
new file mode 100644
index 00000000000..01acb9ea572
--- /dev/null
+++ b/TAO/tao/IIOP_Factory.h
@@ -0,0 +1,75 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file IIOP_Factory.h
+ *
+ * $Id$
+ *
+ * @author Fred Kuhns <fredk@cs.wustl.edu>
+ */
+//=============================================================================
+
+
+#ifndef TAO_IIOP_FACTORY_H
+#define TAO_IIOP_FACTORY_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if defined (TAO_HAS_IIOP) && (TAO_HAS_IIOP != 0)
+
+#include "tao/Protocol_Factory.h"
+#include "ace/Service_Config.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Acceptor;
+class TAO_Connector;
+
+class TAO_Export TAO_IIOP_Protocol_Factory : public TAO_Protocol_Factory
+{
+public:
+ TAO_IIOP_Protocol_Factory (void);
+ virtual ~TAO_IIOP_Protocol_Factory (void);
+
+ // = Service Configurator hooks.
+ /// Dynamic linking hook
+ virtual int init (int argc, ACE_TCHAR* argv[]);
+
+ /// Verify prefix is a match
+ virtual int match_prefix (const ACE_CString &prefix);
+
+ /// Returns the prefix used by the protocol.
+ virtual const char *prefix (void) const;
+
+ /// Return the character used to mark where an endpoint ends and
+ /// where its options begin.
+ virtual char options_delimiter (void) const;
+
+ // = Check Protocol_Factory.h for a description of these methods.
+ virtual TAO_Acceptor *make_acceptor (void);
+ virtual TAO_Connector *make_connector (void);
+ virtual int requires_explicit_endpoint (void) const;
+
+private:
+ /// Changing the version number can be used to provide backwards
+ /// compatibility with old clients.
+ int const major_;
+ int const minor_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE_EXPORT (TAO, TAO_IIOP_Protocol_Factory)
+ACE_FACTORY_DECLARE (TAO, TAO_IIOP_Protocol_Factory)
+
+#endif /* TAO_HAS_IIOP && TAO_HAS_IIOP != 0 */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_IIOP_FACTORY_H */
diff --git a/TAO/tao/IIOP_Lite_Factory.cpp b/TAO/tao/IIOP_Lite_Factory.cpp
new file mode 100644
index 00000000000..57ddb594910
--- /dev/null
+++ b/TAO/tao/IIOP_Lite_Factory.cpp
@@ -0,0 +1,103 @@
+#include "tao/IIOP_Lite_Factory.h"
+
+#if defined (TAO_HAS_IIOP) && (TAO_HAS_IIOP != 0)
+
+#include "tao/IIOP_Acceptor.h"
+#include "tao/IIOP_Connector.h"
+#include "tao/IOP_IORC.h"
+#include "ace/OS_NS_strings.h"
+
+ACE_RCSID (tao,
+ IIOP_Factory,
+ "$Id$")
+
+
+static const char the_prefix[] = "iiop";
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_IIOP_Lite_Protocol_Factory::TAO_IIOP_Lite_Protocol_Factory (void)
+ : TAO_Protocol_Factory (IOP::TAG_INTERNET_IOP),
+ major_ (TAO_DEF_GIOP_MAJOR),
+ minor_ (TAO_DEF_GIOP_MINOR)
+{
+}
+
+TAO_IIOP_Lite_Protocol_Factory::~TAO_IIOP_Lite_Protocol_Factory (void)
+{
+
+}
+
+int
+TAO_IIOP_Lite_Protocol_Factory::match_prefix (const ACE_CString &prefix)
+{
+ // Check for the proper prefix for this protocol.
+ return (ACE_OS::strcasecmp (prefix.c_str (), ::the_prefix) == 0);
+}
+
+const char *
+TAO_IIOP_Lite_Protocol_Factory::prefix (void) const
+{
+ return ::the_prefix;
+}
+
+char
+TAO_IIOP_Lite_Protocol_Factory::options_delimiter (void) const
+{
+ return '/';
+}
+
+TAO_Acceptor *
+TAO_IIOP_Lite_Protocol_Factory::make_acceptor (void)
+{
+ TAO_Acceptor *acceptor = 0;
+
+ // We are a Lite factory
+ CORBA::Boolean lite_flag = true;
+ ACE_NEW_RETURN (acceptor,
+ TAO_IIOP_Acceptor (lite_flag),
+ 0);
+
+ return acceptor;
+}
+
+int
+TAO_IIOP_Lite_Protocol_Factory::init (int /*argc*/,
+ ACE_TCHAR* /*argv*/ [])
+{
+ return 0;
+}
+
+TAO_Connector *
+TAO_IIOP_Lite_Protocol_Factory::make_connector (void)
+{
+ TAO_Connector *connector = 0;
+
+ // We are a Lite factory
+ CORBA::Boolean lite_flag = true;
+
+ ACE_NEW_RETURN (connector,
+ TAO_IIOP_Connector (lite_flag),
+ 0);
+ return connector;
+}
+
+int
+TAO_IIOP_Lite_Protocol_Factory::requires_explicit_endpoint (void) const
+{
+ return 0;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DEFINE (TAO_IIOP_Lite_Protocol_Factory,
+ ACE_TEXT ("IIOP_Lite_Factory"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (TAO_IIOP_Lite_Protocol_Factory),
+ ACE_Service_Type::DELETE_THIS |
+ ACE_Service_Type::DELETE_OBJ,
+ 0)
+
+ACE_FACTORY_DEFINE (TAO, TAO_IIOP_Lite_Protocol_Factory)
+
+#endif /* TAO_HAS_IIOP && TAO_HAS_IIOP != 0 */
diff --git a/TAO/tao/IIOP_Lite_Factory.h b/TAO/tao/IIOP_Lite_Factory.h
new file mode 100644
index 00000000000..2b0141b4d55
--- /dev/null
+++ b/TAO/tao/IIOP_Lite_Factory.h
@@ -0,0 +1,77 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file IIOP_Lite_Factory.h
+ *
+ * $Id$
+ *
+ * @author Fred Kuhns <fredk@cs.wustl.edu>
+ */
+//=============================================================================
+
+
+#ifndef TAO_IIOP_LITE_FACTORY_H
+#define TAO_IIOP_LITE_FACTORY_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if defined (TAO_HAS_IIOP) && (TAO_HAS_IIOP != 0)
+
+#include "tao/Protocol_Factory.h"
+#include "ace/Service_Config.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Acceptor;
+class TAO_Connector;
+
+class TAO_Export TAO_IIOP_Lite_Protocol_Factory :
+ public TAO_Protocol_Factory
+{
+public:
+ TAO_IIOP_Lite_Protocol_Factory (void);
+
+ virtual ~TAO_IIOP_Lite_Protocol_Factory (void);
+
+ // = Service Configurator hooks.
+ /// Dynamic linking hook
+ virtual int init (int argc, ACE_TCHAR* argv[]);
+
+ /// Verify prefix is a match
+ virtual int match_prefix (const ACE_CString &prefix);
+
+ /// Returns the prefix used by the protocol.
+ virtual const char *prefix (void) const;
+
+ /// Return the character used to mark where an endpoint ends and
+ /// where its options begin.
+ virtual char options_delimiter (void) const;
+
+ // = Check Protocol_Factory.h for a description of these methods.
+ virtual TAO_Acceptor *make_acceptor (void);
+ virtual TAO_Connector *make_connector (void);
+ virtual int requires_explicit_endpoint (void) const;
+
+private:
+ /// Changing the version number can be used to provide backwards
+ /// compatibility with old clients.
+ int const major_;
+ int const minor_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE_EXPORT (TAO, TAO_IIOP_Lite_Protocol_Factory)
+ACE_FACTORY_DECLARE (TAO, TAO_IIOP_Lite_Protocol_Factory)
+
+#endif /* TAO_HAS_IIOP && TAO_HAS_IIOP != 0 */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_IIOP_Lite_factory_H */
diff --git a/TAO/tao/IIOP_Profile.cpp b/TAO/tao/IIOP_Profile.cpp
new file mode 100644
index 00000000000..bd86fd5ffc3
--- /dev/null
+++ b/TAO/tao/IIOP_Profile.cpp
@@ -0,0 +1,825 @@
+#include "tao/IIOP_Profile.h"
+
+#if defined (TAO_HAS_IIOP) && (TAO_HAS_IIOP != 0)
+
+#include "tao/Environment.h"
+#include "tao/ORB_Core.h"
+#include "tao/debug.h"
+#include "tao/IIOP_EndpointsC.h"
+#include "tao/CDR.h"
+#include "tao/SystemException.h"
+
+#include "ace/OS_NS_string.h"
+#include "ace/OS_NS_stdio.h"
+
+ACE_RCSID (tao,
+ IIOP_Profile,
+ "$Id$")
+
+#include "ace/os_include/os_netdb.h"
+
+static const char the_prefix[] = "iiop";
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_IIOP_Profile::~TAO_IIOP_Profile (void)
+{
+ // Clean up the list of endpoints since we own it.
+ // Skip the head, since it is not dynamically allocated.
+ TAO_Endpoint *tmp = 0;
+
+ for (TAO_Endpoint *next = this->endpoint ()->next ();
+ next != 0;
+ next = tmp)
+ {
+ tmp = next->next ();
+ delete next;
+ }
+}
+
+//@@ TAO_PROFILE_SPL_COPY_HOOK_START
+
+const char TAO_IIOP_Profile::object_key_delimiter_ = '/';
+
+char
+TAO_IIOP_Profile::object_key_delimiter (void) const
+{
+ return TAO_IIOP_Profile::object_key_delimiter_;
+}
+
+//@@ TAO_PROFILE_SPL_COPY_HOOK_END
+
+TAO_IIOP_Profile::TAO_IIOP_Profile (const ACE_INET_Addr &addr,
+ const TAO::ObjectKey &object_key,
+ const TAO_GIOP_Message_Version &version,
+ TAO_ORB_Core *orb_core)
+ : TAO_Profile (IOP::TAG_INTERNET_IOP,
+ orb_core,
+ object_key,
+ version),
+ endpoint_ (addr,
+ orb_core->orb_params ()->use_dotted_decimal_addresses ()),
+ count_ (1)
+{
+}
+
+TAO_IIOP_Profile::TAO_IIOP_Profile (const char* host,
+ CORBA::UShort port,
+ const TAO::ObjectKey &object_key,
+ const ACE_INET_Addr &addr,
+ const TAO_GIOP_Message_Version &version,
+ TAO_ORB_Core *orb_core)
+ : TAO_Profile (IOP::TAG_INTERNET_IOP,
+ orb_core,
+ object_key,
+ version),
+ endpoint_ (host, port, addr),
+ count_ (1)
+{
+}
+
+TAO_IIOP_Profile::TAO_IIOP_Profile (TAO_ORB_Core *orb_core)
+ : TAO_Profile (IOP::TAG_INTERNET_IOP,
+ orb_core,
+ TAO_GIOP_Message_Version (TAO_DEF_GIOP_MAJOR,
+ TAO_DEF_GIOP_MINOR)),
+ endpoint_ (),
+ count_ (1)
+{
+}
+
+//@@ TAO_PROFILE_SPL_COPY_HOOK_START
+int
+TAO_IIOP_Profile::decode_profile (TAO_InputCDR& cdr)
+{
+ // Decode host and port into the <endpoint_>.
+ if (cdr.read_string (this->endpoint_.host_.out ()) == 0
+ || cdr.read_ushort (this->endpoint_.port_) == 0)
+ {
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) IIOP_Profile::decode - ")
+ ACE_TEXT ("error while decoding host/port\n")));
+ return -1;
+ }
+
+ if (cdr.good_bit ())
+ {
+ // Invalidate the object_addr_ until first access.
+ this->endpoint_.object_addr_.set_type (-1);
+
+ const char* csv = this->orb_core()->orb_params()->preferred_interfaces();
+ bool const enforce =
+ this->orb_core()->orb_params()->enforce_pref_interfaces();
+ this->count_ += this->endpoint_.preferred_interfaces(csv, enforce);
+
+ return 1;
+ }
+
+ return -1;
+}
+
+void
+TAO_IIOP_Profile::parse_string_i (const char *ior
+ ACE_ENV_ARG_DECL)
+{
+ // Pull off the "hostname:port/" part of the objref
+ // Copy the string because we are going to modify it...
+
+ const char *okd = ACE_OS::strchr (ior, this->object_key_delimiter_);
+
+ if (okd == 0 || okd == ior)
+ {
+ // No object key delimiter or no hostname specified.
+ ACE_THROW (CORBA::INV_OBJREF (
+ CORBA::SystemException::_tao_minor_code (
+ 0,
+ EINVAL),
+ CORBA::COMPLETED_NO));
+ }
+
+ // Length of host string.
+ CORBA::ULong length_host = 0;
+
+ const char *cp_pos = ACE_OS::strchr (ior, ':'); // Look for a port
+#if defined (ACE_HAS_IPV6)
+ // IPv6 numeric address in host string?
+ bool ipv6_in_host = false;
+
+ // Check if this is a (possibly) IPv6 supporting profile containing a
+ // decimal IPv6 address representation.
+ if ((this->version().major > TAO_MIN_IPV6_IIOP_MAJOR ||
+ this->version().minor >= TAO_MIN_IPV6_IIOP_MINOR) &&
+ ior[0] == '[')
+ {
+ // In this case we have to find the end of the numeric address and
+ // start looking for the port separator from there.
+ const char *cp_pos_a = ACE_OS::strchr(ior, ']');
+ if (cp_pos_a == 0)
+ {
+ // No valid IPv6 address specified.
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_ERROR,
+ ACE_TEXT ("\nTAO (%P|%t) IIOP_Profile: ")
+ ACE_TEXT ("Invalid IPv6 decimal address specified.\n")));
+ }
+
+ ACE_THROW (CORBA::INV_OBJREF (
+ CORBA::SystemException::_tao_minor_code (
+ 0,
+ EINVAL),
+ CORBA::COMPLETED_NO));
+ }
+ else
+ {
+ if (cp_pos_a[1] == ':') // Look for a port
+ cp_pos = cp_pos_a + 1;
+ else
+ cp_pos = 0;
+ ipv6_in_host = true; // host string contains full IPv6 numeric address
+ }
+ }
+#endif /* ACE_HAS_IPV6 */
+
+ if (cp_pos == ior)
+ {
+ // No hostname, however one is required by the spec when specifying a port.
+ // See formal-04-03-01, section 13.6.10.3
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_ERROR,
+ ACE_TEXT ("\nTAO (%P|%t) IIOP_Profile: ")
+ ACE_TEXT ("Host address may be omited only when no port has been specified.\n")));
+ }
+
+ ACE_THROW (CORBA::INV_OBJREF (
+ CORBA::SystemException::_tao_minor_code (
+ 0,
+ EINVAL),
+ CORBA::COMPLETED_NO));
+ }
+ else if (cp_pos != 0)
+ {
+ // A port number or port name was specified.
+ CORBA::ULong length_port = okd - cp_pos - 1;
+ CORBA::String_var tmp = CORBA::string_alloc (length_port);
+
+ ACE_OS::strncpy (tmp.inout (), cp_pos + 1, length_port);
+ tmp[length_port] = '\0';
+ if (length_port == 0)
+ {
+ this->endpoint_.port_ = 2809; // default IIOP port for
+ // parsing corbaloc strings
+ }
+ else if (ACE_OS::strspn (tmp.in (), "1234567890") == length_port)
+ {
+ this->endpoint_.port_ =
+ static_cast<CORBA::UShort> (ACE_OS::atoi (tmp.in ()));
+ }
+ else
+ {
+ ACE_INET_Addr ia;
+ if (ia.string_to_addr (tmp.in ()) == -1)
+ {
+ ACE_THROW (CORBA::INV_OBJREF (
+ CORBA::SystemException::_tao_minor_code (
+ 0,
+ EINVAL),
+ CORBA::COMPLETED_NO));
+ }
+ else
+ {
+ this->endpoint_.port_ = ia.get_port_number ();
+ }
+ }
+ length_host = cp_pos - ior;
+ }
+ else
+ length_host = okd - ior;
+
+#if defined (ACE_HAS_IPV6)
+ if (ipv6_in_host)
+ length_host -= 2; // don't store '[' and ']'
+#endif /* ACE_HAS_IPV6 */
+
+ CORBA::String_var tmp = CORBA::string_alloc (length_host);
+
+#if defined (ACE_HAS_IPV6)
+ if (ipv6_in_host)
+ ACE_OS::strncpy (tmp.inout (), ior + 1, length_host);
+ else
+#endif /* ACE_HAS_IPV6 */
+ // Skip the trailing '/'
+ ACE_OS::strncpy (tmp.inout (), ior, length_host);
+ tmp[length_host] = '\0';
+
+ this->endpoint_.host_ = tmp._retn ();
+#if defined (ACE_HAS_IPV6)
+ this->endpoint_.is_ipv6_decimal_ = ipv6_in_host;
+#endif /* ACE_HAS_IPV6 */
+
+ if (ACE_OS::strcmp (this->endpoint_.host_.in (), "") == 0)
+ {
+ ACE_INET_Addr host_addr;
+
+ char tmp_host [MAXHOSTNAMELEN + 1];
+
+ // If no host is specified: assign the default host, i.e. the
+ // local host.
+ if (host_addr.get_host_name (tmp_host,
+ sizeof (tmp_host)) != 0)
+ {
+ // Can't get the IP address since the INET_Addr wasn't
+ // initialized. Just throw an exception.
+
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("\n\nTAO (%P|%t) ")
+ ACE_TEXT ("IIOP_Profile::parse_string ")
+ ACE_TEXT ("- %p\n\n"),
+ ACE_TEXT ("cannot determine hostname")));
+
+ // @@ What's the right exception to throw here?
+ ACE_THROW (CORBA::INV_OBJREF (
+ CORBA::SystemException::_tao_minor_code (
+ 0,
+ EINVAL),
+ CORBA::COMPLETED_NO));
+ }
+ else
+ this->endpoint_.host_ = CORBA::string_dup (tmp_host);
+ }
+
+ TAO::ObjectKey ok;
+
+ TAO::ObjectKey::decode_string_to_sequence (ok,
+ okd + 1);
+
+ (void) this->orb_core ()->object_key_table ().bind (ok,
+ this->ref_object_key_);
+}
+
+CORBA::Boolean
+TAO_IIOP_Profile::do_is_equivalent (const TAO_Profile *other_profile)
+{
+ if (other_profile == this)
+ return true;
+
+ const TAO_IIOP_Profile *op =
+ dynamic_cast<const TAO_IIOP_Profile *> (other_profile);
+
+ // Make sure we have a TAO_IIOP_Profile.
+ if (op == 0)
+ return false;
+
+ if (this->count_ == 0 && op->count_ == 0)
+ return true;
+ if (this->count_ != op->count_)
+ return false;
+ // Check endpoints equivalence.
+ const TAO_IIOP_Endpoint *other_endp = &op->endpoint_;
+ for (TAO_IIOP_Endpoint *endp = &this->endpoint_;
+ endp != 0;
+ endp = endp->next_)
+ {
+ if (endp->is_equivalent (other_endp))
+ other_endp = other_endp->next_;
+ else
+ return false;
+ }
+
+ return true;
+}
+
+CORBA::ULong
+TAO_IIOP_Profile::hash (CORBA::ULong max
+ ACE_ENV_ARG_DECL_NOT_USED)
+{
+ // Get the hash value for all endpoints.
+ CORBA::ULong hashval = 0;
+ for (TAO_IIOP_Endpoint *endp = &this->endpoint_;
+ endp != 0;
+ endp = endp->next_)
+ {
+ hashval += endp->hash ();
+ }
+
+ hashval += this->version_.minor;
+ hashval += this->tag ();
+
+ const TAO::ObjectKey &ok =
+ this->ref_object_key_->object_key ();
+
+ if (ok.length () >= 4)
+ {
+ hashval += ok[1];
+ hashval += ok[3];
+ }
+
+ hashval += TAO_Profile::hash_service_i (max);
+
+ return hashval % max;
+}
+
+TAO_Endpoint*
+TAO_IIOP_Profile::endpoint (void)
+{
+ return &this->endpoint_;
+}
+
+CORBA::ULong
+TAO_IIOP_Profile::endpoint_count (void) const
+{
+ return this->count_;
+}
+
+void
+TAO_IIOP_Profile::add_endpoint (TAO_IIOP_Endpoint *endp)
+{
+ endp->next_ = this->endpoint_.next_;
+ this->endpoint_.next_ = endp;
+
+ ++this->count_;
+}
+
+void
+TAO_IIOP_Profile::remove_endpoint (TAO_IIOP_Endpoint *endp)
+{
+ if (endp == 0)
+ return;
+
+ // special handling for the target matching the base endpoint
+ if (endp == &this->endpoint_)
+ {
+ if (--this->count_ > 0)
+ {
+ TAO_IIOP_Endpoint* n = this->endpoint_.next_;
+ this->endpoint_ = *n;
+ // since the assignment operator does not copy the next_
+ // pointer, we must do it by hand
+ this->endpoint_.next_ = n->next_;
+ delete n;
+ }
+ return;
+ }
+
+ TAO_IIOP_Endpoint* last = &this->endpoint_;
+ TAO_IIOP_Endpoint* cur = this->endpoint_.next_;
+
+ while (cur != 0)
+ {
+ if (cur == endp)
+ break;
+ last = cur;
+ cur = cur->next_;
+ }
+
+ if (cur != 0)
+ {
+ last->next_ = cur->next_;
+ cur->next_ = 0;
+ --this->count_;
+ delete cur;
+ }
+}
+
+void
+TAO_IIOP_Profile::remove_generic_endpoint (TAO_Endpoint *ep)
+{
+ this->remove_endpoint(dynamic_cast<TAO_IIOP_Endpoint *>(ep));
+}
+
+void
+TAO_IIOP_Profile::add_generic_endpoint (TAO_Endpoint *endp)
+{
+ TAO_IIOP_Endpoint *iep = dynamic_cast<TAO_IIOP_Endpoint *>(endp);
+ if (iep != 0)
+ {
+ TAO_IIOP_Endpoint *clone;
+ ACE_NEW (clone, TAO_IIOP_Endpoint(*iep));
+ this->add_endpoint(clone);
+ }
+}
+
+char *
+TAO_IIOP_Profile::to_string (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+{
+ // corbaloc:iiop:1.2@host:port,iiop:1.2@host:port,.../key
+
+ CORBA::String_var key;
+ TAO::ObjectKey::encode_sequence_to_string (key.inout(),
+ this->ref_object_key_->object_key ());
+
+ size_t buflen = (
+ 8 /* "corbaloc" */ +
+ 1 /* colon separator */ +
+ 1 /* object key separator */ +
+ ACE_OS::strlen (key.in ()));
+ size_t pfx_len = (
+ ACE_OS::strlen (::the_prefix) /* "iiop" */ +
+ 1 /* colon separator */);
+
+ const TAO_IIOP_Endpoint *endp = 0;
+ for (endp = &this->endpoint_; endp != 0; endp = endp->next_)
+ {
+ buflen += (
+ pfx_len +
+ 1 /* major version */ +
+ 1 /* decimal point */ +
+ 1 /* minor version */ +
+ 1 /* `@' character */ +
+ ACE_OS::strlen (endp->host ()) +
+ 1 /* colon separator */ +
+ 5 /* port number */ +
+ 1 /* comma */);
+#if defined (ACE_HAS_IPV6)
+ if (endp->is_ipv6_decimal_)
+ buflen += 2; // room for '[' and ']'
+#endif /* ACE_HAS_IPV6 */
+ }
+
+ static const char digits [] = "0123456789";
+
+ char * buf = CORBA::string_alloc (static_cast<CORBA::ULong> (buflen));
+
+ ACE_OS::strcpy(buf, "corbaloc:");
+
+ for (endp = &this->endpoint_; endp != 0; endp = endp->next_)
+ {
+ if(&this->endpoint_ != endp)
+ ACE_OS::strcat(buf, ",");
+
+#if defined (ACE_HAS_IPV6)
+ if (endp->is_ipv6_decimal_)
+ {
+ // Don't publish scopeid if included.
+ ACE_CString tmp(endp->host ());
+ ACE_CString::size_type pos = tmp.find('%');
+ if (pos != ACE_CString::npos)
+ {
+ tmp = tmp.substr(0, pos + 1);
+ tmp[pos] = '\0';
+ }
+ ACE_OS::sprintf (buf + ACE_OS::strlen(buf),
+ "%s:%c.%c@[%s]:%d",
+ ::the_prefix,
+ digits [this->version_.major],
+ digits [this->version_.minor],
+ tmp.c_str (),
+ endp->port () );
+ }
+ else
+#endif
+ ACE_OS::sprintf (buf + ACE_OS::strlen(buf),
+ "%s:%c.%c@%s:%d",
+ ::the_prefix,
+ digits [this->version_.major],
+ digits [this->version_.minor],
+ endp->host (),
+ endp->port () );
+
+ }
+ ACE_OS::sprintf (buf + ACE_OS::strlen(buf),
+ "%c%s",
+ this->object_key_delimiter_,
+ key.in ());
+
+ return buf;
+}
+
+const char *
+TAO_IIOP_Profile::prefix (void)
+{
+ return ::the_prefix;
+}
+
+void
+TAO_IIOP_Profile::create_profile_body (TAO_OutputCDR &encap) const
+{
+ encap.write_octet (TAO_ENCAP_BYTE_ORDER);
+
+ // The GIOP version
+ encap.write_octet (this->version_.major);
+ encap.write_octet (this->version_.minor);
+
+ // STRING hostname from profile
+#if defined (ACE_HAS_IPV6)
+ // For IPv6 decimal addresses make sure the possibly included scopeid
+ // is not published as this has only local meaning.
+ const char* host;
+ const char* pos;
+ if (this->endpoint_.is_ipv6_decimal_ &&
+ (pos = ACE_OS::strchr (host = this->endpoint_.host (), '%')) != 0)
+ {
+ ACE_CString tmp;
+ size_t len = pos - host;
+ tmp.set (this->endpoint_.host (), len, 1);
+ encap.write_string (tmp.c_str ());
+ }
+ else
+#endif /* ACE_HAS_IPV6 */
+ encap.write_string (this->endpoint_.host ());
+
+
+ // UNSIGNED SHORT port number
+ encap.write_ushort (this->endpoint_.port ());
+
+ // OCTET SEQUENCE for object key
+ if (this->ref_object_key_)
+ encap << this->ref_object_key_->object_key ();
+ else
+ {
+ ACE_ERROR ((LM_ERROR,
+ "(%P|%t) TAO - IIOP_Profile::create_profile_body "
+ "no object key marshalled \n"));
+ }
+
+ if (this->version_.major > 1
+ || this->version_.minor > 0)
+ this->tagged_components ().encode (encap);
+}
+
+int
+TAO_IIOP_Profile::encode_alternate_endpoints (void)
+{
+ // encode IOP::TAG_ALTERNATE_IIOP_ADDRESS tags if there are more
+ // than one endpoints to listen to.
+ const TAO_IIOP_Endpoint *endpoint = &this->endpoint_;
+ for (CORBA::ULong i = 1;
+ i < this->count_;
+ ++i)
+ {
+ // The first endpoint is the actual endpoint. The rest of the
+ // endpoints are the alternate endpoints. So, neglect the first
+ // endpoint for TAG_ALTERNATE_IIOP_ADDRESS
+ endpoint = endpoint->next_;
+
+ if (!endpoint->is_encodable_)
+ continue;
+
+ // Encode the data structure. - The CORBA specification does not
+ // mandate a particular container for the endpoints, only that
+ // it is encoded as host first, then port.
+ TAO_OutputCDR out_cdr;
+
+#if defined (ACE_HAS_IPV6)
+ // For IPv6 decimal addresses make sure the possibly included scopeid
+ // is not published as this has only local meaning.
+ const char* host;
+ const char* pos;
+ if (endpoint->is_ipv6_decimal_ &&
+ (pos = ACE_OS::strchr (host = endpoint->host (), '%')) != 0)
+ {
+ ACE_CString tmp;
+ size_t len = pos - host;
+ tmp.set (endpoint->host (), len, 1);
+ if ((out_cdr << ACE_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER) == 0)
+ || (out_cdr << tmp.c_str () == 0)
+ || (out_cdr << endpoint->port () == 0))
+ return -1;
+ out_cdr.write_string (len, endpoint->host ());
+ }
+ else
+#endif /* ACE_HAS_IPV6 */
+ if ((out_cdr << ACE_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER) == 0)
+ || (out_cdr << endpoint->host () == 0)
+ || (out_cdr << endpoint->port () == 0))
+ return -1;
+
+ IOP::TaggedComponent tagged_component;
+ tagged_component.tag = IOP::TAG_ALTERNATE_IIOP_ADDRESS;
+
+ size_t length = out_cdr.total_length ();
+ tagged_component.component_data.length
+ (static_cast<CORBA::ULong>(length));
+ CORBA::Octet *buf =
+ tagged_component.component_data.get_buffer ();
+
+ for (const ACE_Message_Block *iterator = out_cdr.begin ();
+ iterator != 0;
+ iterator = iterator->cont ())
+ {
+ size_t i_length = iterator->length ();
+ ACE_OS::memcpy (buf, iterator->rd_ptr (), i_length);
+
+ buf += i_length;
+ }
+
+ // Add component with encoded endpoint data to this profile's
+ // TaggedComponents.
+ tagged_components_.set_component (tagged_component);
+ }
+ return 0;
+}
+
+int
+TAO_IIOP_Profile::encode_endpoints (void)
+{
+ CORBA::ULong actual_count = 0;
+
+ const TAO_IIOP_Endpoint *endpoint = &this->endpoint_;
+
+ // Count the number of endpoints that needs to be encoded
+ for (CORBA::ULong c = 0;
+ c != this->count_;
+ ++c)
+ {
+ if (endpoint->is_encodable_)
+ ++actual_count;
+
+ endpoint = endpoint->next_;
+ }
+
+ // Create a data structure and fill it with endpoint info for wire
+ // transfer.
+ // We include information for the head of the list
+ // together with other endpoints because even though its addressing
+ // info is transmitted using standard ProfileBody components, its
+ // priority is not!
+
+ TAO::IIOPEndpointSequence endpoints;
+ endpoints.length (actual_count);
+
+ endpoint = &this->endpoint_;
+
+ for (CORBA::ULong i = 0;
+ i < actual_count;
+ ++i)
+ {
+ if (endpoint->is_encodable_)
+ {
+#if defined (ACE_HAS_IPV6)
+ if (endpoint->is_ipv6_decimal_)
+ {
+ // Don't publish scopeid if included.
+ ACE_CString tmp(endpoint->host ());
+ ACE_CString::size_type pos = tmp.find('%');
+ if (pos != ACE_CString::npos)
+ {
+ tmp = tmp.substr (0, pos + 1);
+ tmp[pos] = '\0';
+ endpoints[i].host = tmp.c_str();
+ }
+ else
+ endpoints[i].host = tmp.c_str();
+ }
+ else
+#endif /* ACE_HAS_IPV6 */
+ endpoints[i].host = endpoint->host ();
+ endpoints[i].port = endpoint->port ();
+ endpoints[i].priority = endpoint->priority ();
+ }
+ endpoint = endpoint->next_;
+ }
+
+ // Encode the data structure.
+ TAO_OutputCDR out_cdr;
+ if ((out_cdr << ACE_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER)
+ == 0)
+ || (out_cdr << endpoints) == 0)
+ return -1;
+
+ this->set_tagged_components (out_cdr);
+
+ return 0;
+}
+
+
+int
+TAO_IIOP_Profile::decode_endpoints (void)
+{
+ IOP::TaggedComponent tagged_component;
+ tagged_component.tag = TAO_TAG_ENDPOINTS;
+
+ if (this->tagged_components_.get_component (tagged_component))
+ {
+ const CORBA::Octet *buf =
+ tagged_component.component_data.get_buffer ();
+
+ TAO_InputCDR in_cdr (reinterpret_cast<const char *> (buf),
+ tagged_component.component_data.length ());
+
+ // Extract the Byte Order.
+ CORBA::Boolean byte_order;
+ if ((in_cdr >> ACE_InputCDR::to_boolean (byte_order)) == 0)
+ return -1;
+ in_cdr.reset_byte_order (static_cast<int> (byte_order));
+
+ // Extract endpoints sequence.
+ TAO::IIOPEndpointSequence endpoints;
+
+ if ((in_cdr >> endpoints) == 0)
+ return -1;
+
+ // Get the priority of the first endpoint (head of the list.
+ // It's other data is extracted as part of the standard profile
+ // decoding.
+ this->endpoint_.priority (endpoints[0].priority);
+
+ // Use information extracted from the tagged component to
+ // populate the profile. Skip the first endpoint, since it is
+ // always extracted through standard profile body. Also, begin
+ // from the end of the sequence to preserve endpoint order,
+ // since <add_endpoint> method reverses the order of endpoints
+ // in the list.
+ for (CORBA::ULong i = endpoints.length () - 1;
+ i > 0;
+ --i)
+ {
+ TAO_IIOP_Endpoint *endpoint = 0;
+ ACE_NEW_RETURN (endpoint,
+ TAO_IIOP_Endpoint (endpoints[i].host,
+ endpoints[i].port,
+ endpoints[i].priority),
+ -1);
+
+ this->add_endpoint (endpoint);
+ }
+ }
+
+ // Now decode if there are any TAG_ALTERNATE_IIOP_ADDRESS
+ // components.
+
+ IOP::MultipleComponentProfile& tc = this->tagged_components_.components();
+ for (CORBA::ULong index = 0; index < tc.length(); index++)
+ {
+ if (tc[index].tag != IOP::TAG_ALTERNATE_IIOP_ADDRESS)
+ continue;
+ const CORBA::Octet *buf =
+ tc[index].component_data.get_buffer ();
+
+ TAO_InputCDR in_cdr (reinterpret_cast<const char*>(buf),
+ tc[index].component_data.length ());
+
+ // Extract the Byte Order.
+ CORBA::Boolean byte_order;
+ if ((in_cdr >> ACE_InputCDR::to_boolean (byte_order)) == 0)
+ return -1;
+
+ in_cdr.reset_byte_order (static_cast<int>(byte_order));
+
+ CORBA::String_var host;
+ CORBA::Short port;
+
+ if ((in_cdr >> host.out()) == 0 ||
+ (in_cdr >> port) == 0)
+ return -1;
+
+ TAO_IIOP_Endpoint *endpoint = 0;
+ ACE_NEW_RETURN (endpoint,
+ TAO_IIOP_Endpoint (host.in(),
+ port,
+ TAO_INVALID_PRIORITY),
+ -1);
+
+ this->add_endpoint (endpoint);
+ }
+
+ return 0;
+}
+//@@ TAO_PROFILE_SPL_COPY_HOOK_END
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_IIOP && TAO_HAS_IIOP != 0 */
diff --git a/TAO/tao/IIOP_Profile.h b/TAO/tao/IIOP_Profile.h
new file mode 100644
index 00000000000..03cf95694bd
--- /dev/null
+++ b/TAO/tao/IIOP_Profile.h
@@ -0,0 +1,193 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file IIOP_Profile.h
+ *
+ * $Id$
+ *
+ * IIOP profile specific processing.
+ *
+ * @author Fred Kuhns <fredk@cs.wustl.edu>
+ */
+//=============================================================================
+
+
+#ifndef TAO_IIOP_PROFILE_H
+#define TAO_IIOP_PROFILE_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if defined (TAO_HAS_IIOP) && (TAO_HAS_IIOP != 0)
+
+#include "tao/Profile.h"
+#include "tao/IIOP_Endpoint.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// TAO IIOP_Profile concrete Profile definitions
+/**
+ * @class TAO_IIOP_Profile
+ *
+ * @brief This class defines the protocol specific attributes required
+ * for locating ORBs over a TCP/IP network.
+ *
+ * This class defines the IIOP profile as specified in the CORBA
+ * specification.
+ */
+class TAO_Export TAO_IIOP_Profile : public TAO_Profile
+{
+public:
+
+ //@@ TAO_PROFILE_SPL_PUBLIC_METHODS_COPY_HOOK_START
+ static const char object_key_delimiter_;
+
+ /// Return the char string prefix.
+ static const char *prefix (void);
+
+ /// Profile constructor, same as above except the object_key has
+ /// already been marshaled.
+ TAO_IIOP_Profile (const ACE_INET_Addr &addr,
+ const TAO::ObjectKey &object_key,
+ const TAO_GIOP_Message_Version &version,
+ TAO_ORB_Core *orb_core);
+
+ /// Profile constructor, this is the most efficient since it
+ /// doesn't require any address resolution processing.
+ TAO_IIOP_Profile (const char *host,
+ CORBA::UShort port,
+ const TAO::ObjectKey &object_key,
+ const ACE_INET_Addr &addr,
+ const TAO_GIOP_Message_Version &version,
+ TAO_ORB_Core *orb_core);
+
+ /// Profile constructor, default.
+ TAO_IIOP_Profile (TAO_ORB_Core *orb_core);
+
+ /**
+ * Add @a endp to this profile's list of endpoints (it is inserted
+ * next to the head of the list). This profiles takes ownership of
+ * @a endp.
+ */
+ void add_endpoint (TAO_IIOP_Endpoint *endp);
+
+ /**
+ * Remove @a endp from this profile's list of endpoints and free the
+ * @a endp memory.
+ * This method assumes @a endp is in this profile's endpoint list.
+ */
+ void remove_endpoint (TAO_IIOP_Endpoint *endp);
+
+ virtual void remove_generic_endpoint (TAO_Endpoint *ep);
+
+ /// Add an endpoint when the specific endpoint type is unknown
+ virtual void add_generic_endpoint (TAO_Endpoint *ep);
+
+ //@@ TAO_PROFILE_SPL_PUBLIC_METHODS_COPY_HOOK_END
+
+ /// The object key delimiter that IIOP uses or expects.
+ virtual char object_key_delimiter (void) const;
+
+ /// Template methods. Please see Profile.h for documentation.
+ virtual char * to_string (ACE_ENV_SINGLE_ARG_DECL);
+
+ /// Encode endpoints for RT profiles, using a single TAO_TAG_ENDPOINT
+ /// component.
+ virtual int encode_endpoints (void);
+
+ /// Encode alternate endpoints for non-RT profiles, using multiple
+ /// TAG_ALTERNATE_IIOP_ADDRESS components, one endpoint per component
+ virtual int encode_alternate_endpoints (void);
+ virtual TAO_Endpoint *endpoint (void);
+ virtual CORBA::ULong endpoint_count (void) const;
+ virtual CORBA::ULong hash (CORBA::ULong max
+ ACE_ENV_ARG_DECL);
+
+protected:
+ /// Destructor is to be called only through <_decr_refcnt>.
+ ~TAO_IIOP_Profile (void);
+
+ /**
+ * Helper method for encode_endpoints to deal with RT requests.
+ *
+ * Encodes this profile's endpoints into a tagged component.
+ * This is done only if RTCORBA is enabled, since currently this is
+ * the only case when we have more than one endpoint per profile.
+ * Returns 0 on success and -1 on failure.
+ *
+ * Endpoints are transmitted using TAO-proprietory tagged component.
+ * Component tag is TAO_TAG_ENDPOINTS and component data is an
+ * encapsulation of a sequence of structs, each representing a
+ * single endpoint. Data format is specified in iiop_endpoins.pidl.
+ */
+
+ //@@ TAO_PROFILE_SPL_PROTECTED_METHODS_COPY_HOOK_START
+
+ int encode_endpoints_for_rt (void);
+
+ //@@ TAO_PROFILE_SPL_PROTECTED_METHODS_COPY_HOOK_END
+
+ /// Template methods. Please see Profile.h for the documentation.
+ virtual int decode_profile (TAO_InputCDR &cdr);
+ virtual int decode_endpoints (void);
+ virtual void parse_string_i (const char *string
+ ACE_ENV_ARG_DECL);
+ virtual void create_profile_body (TAO_OutputCDR &cdr) const;
+ virtual CORBA::Boolean do_is_equivalent (const TAO_Profile *other_profile);
+
+protected:
+
+ /**
+ * Head of this profile's list of endpoints. This endpoint is not
+ * dynamically allocated because a profile always contains at least
+ * one endpoint.
+ *
+ * Currently, a profile contains more than one endpoint, i.e.,
+ * list contains more than just the head, only for two cases
+ * (1) when RTCORBA is enabled and
+ * (2) the ORB is initialized with -ORBPreferredInterfaces option.
+ * However, in the near future, this will be used in for mode as
+ * well, e.g., to support TAG_ALTERNATE_IIOP_ADDRESS feature.
+ *
+ * This is probably as good a place to discuss how the list of
+ * endpoints is used for #2. If the ORB is configured to use
+ * preferred interfaces for invocation, TAO creates an endpoint per
+ * preferred interface. To be clear, every tuple
+ * <destination:target> will have an endpoint. What TAO essentially
+ * does is that creates it multiple endpoints so that the invocation
+ * code path can use existing iterating techniques to try one
+ * preferred interface after another (if the first did not work). If
+ * the ORB is configured with -ORBEnforcePreferredInterface set to
+ * false in addition to the ORBPreferredInterfaces option , TAO
+ * creates another endpoint with the preferred bit set to null, so
+ * that the invocation code can fall back to a TCP stack returned
+ * local address.
+ * Addressing info of the default endpoint, i.e., head of the list,
+ * is transmitted using standard IIOP ProfileBody components. See
+ * <encode_endpoints> method documentation above for how the rest of
+ * the endpoint list is transmitted.
+ */
+
+ //@@ TAO_PROFILE_SPL_PRIVATE_DATA_COPY_HOOK_START
+
+ TAO_IIOP_Endpoint endpoint_;
+
+ /// Number of endpoints in the list headed by <endpoint_>.
+ CORBA::ULong count_;
+
+ //@@ TAO_PROFILE_SPL_PRIVATE_DATA_COPY_HOOK_END
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_IIOP && TAO_HAS_IIOP != 0 */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_IIOP_PROFILE_H */
diff --git a/TAO/tao/IIOP_Transport.cpp b/TAO/tao/IIOP_Transport.cpp
new file mode 100644
index 00000000000..e40e21738c5
--- /dev/null
+++ b/TAO/tao/IIOP_Transport.cpp
@@ -0,0 +1,519 @@
+#include "tao/IIOP_Transport.h"
+
+#if defined (TAO_HAS_IIOP) && (TAO_HAS_IIOP != 0)
+
+#include "tao/IIOP_Acceptor.h"
+#include "tao/IIOPC.h"
+#include "tao/Acceptor_Registry.h"
+#include "tao/operation_details.h"
+#include "tao/Wait_Strategy.h"
+#include "tao/debug.h"
+#include "tao/GIOP_Message_Base.h"
+#include "tao/Protocols_Hooks.h"
+#include "tao/ORB_Core.h"
+#include "tao/Thread_Lane_Resources.h"
+#include "tao/Transport_Mux_Strategy.h"
+#include "tao/MMAP_Allocator.h"
+
+#include "ace/OS_NS_sys_sendfile.h"
+
+ACE_RCSID (tao,
+ IIOP_Transport,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_IIOP_Transport::TAO_IIOP_Transport (TAO_IIOP_Connection_Handler *handler,
+ TAO_ORB_Core *orb_core,
+ CORBA::Boolean )
+ : TAO_Transport (IOP::TAG_INTERNET_IOP,
+ orb_core)
+ , connection_handler_ (handler)
+ , messaging_object_ (0)
+{
+ // Use the normal GIOP object
+ ACE_NEW (this->messaging_object_,
+ TAO_GIOP_Message_Base (orb_core, this));
+}
+
+TAO_IIOP_Transport::~TAO_IIOP_Transport (void)
+{
+ delete this->messaging_object_;
+}
+
+/*
+ * Hook to copy over all concrete implementations
+ * of Transport class from this class to the base
+ * class as a part of the specialization.
+ * All enhancements to the IIOP_Transport
+ * class, i.e., addition of new concrete non virtual
+ * methods should be added within this hook.
+ */
+
+//@@ TAO_TRANSPORT_SPL_COPY_HOOK_START
+ACE_Event_Handler *
+TAO_IIOP_Transport::event_handler_i (void)
+{
+ return this->connection_handler_;
+}
+
+TAO_Connection_Handler *
+TAO_IIOP_Transport::connection_handler_i (void)
+{
+ return this->connection_handler_;
+}
+
+TAO_Pluggable_Messaging *
+TAO_IIOP_Transport::messaging_object (void)
+{
+ return this->messaging_object_;
+}
+
+ssize_t
+TAO_IIOP_Transport::send (iovec *iov, int iovcnt,
+ size_t &bytes_transferred,
+ const ACE_Time_Value *max_wait_time)
+{
+ ssize_t const retval =
+ this->connection_handler_->peer ().sendv (iov,
+ iovcnt,
+ max_wait_time);
+
+ if (retval > 0)
+ bytes_transferred = retval;
+ else
+ {
+ if (TAO_debug_level > 4)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - IIOP_Transport[%d]::send, ")
+ ACE_TEXT ("send failure - %m (errno: %d)\n"),
+ this->id (), errno));
+ }
+ }
+
+ return retval;
+}
+
+#ifdef ACE_HAS_SENDFILE
+ssize_t
+TAO_IIOP_Transport::sendfile (TAO_MMAP_Allocator * allocator,
+ iovec * iov,
+ int iovcnt,
+ size_t &bytes_transferred,
+ ACE_Time_Value const * timeout)
+{
+ // @@ We should probably set the TCP_CORK socket option to minimize
+ // network operations. It may also be useful to adjust the
+ // socket send buffer size accordingly.
+
+ // If we don't have an allocator, fallback to the regular way of sending
+ // data
+ if (allocator == 0)
+ return this->send (iov, iovcnt, bytes_transferred, timeout);
+
+ // We can only use sendfile when all data is coming from the mmap allocator,
+ // if not, we just fallback to to the regular way of sending data
+ iovec * const off_check_begin = iov;
+ iovec * const off_check_end = iov + iovcnt;
+ for (iovec * index = off_check_begin; index != off_check_end; ++index)
+ {
+ if (-1 == allocator->offset (index->iov_base))
+ return this->send (iov, iovcnt, bytes_transferred, timeout);
+ }
+
+ ssize_t retval = -1;
+
+ ACE_HANDLE const in_fd = allocator->handle ();
+
+ if (in_fd == ACE_INVALID_HANDLE)
+ return retval;
+
+ ACE_HANDLE const out_fd =
+ this->connection_handler_->peer ().get_handle ();
+
+ iovec * const begin = iov;
+ iovec * const end = iov + iovcnt;
+ for (iovec * i = begin; i != end; ++i)
+ {
+ off_t offset = allocator->offset (i->iov_base);
+
+ if (timeout)
+ {
+ int val = 0;
+ if (ACE::enter_send_timedwait (out_fd, timeout, val) == -1)
+ return retval;
+ else
+ {
+ retval =
+ ACE_OS::sendfile (out_fd, in_fd, &offset, i->iov_len);
+ ACE::restore_non_blocking_mode (out_fd, val);
+
+ }
+ }
+ else
+ {
+ retval = ACE_OS::sendfile (out_fd, in_fd, &offset, i->iov_len);
+ }
+
+ if (retval <= 0) // Report errors below.
+ break;
+
+ bytes_transferred += static_cast<size_t> (retval);
+ }
+
+ if (retval <= 0 && TAO_debug_level > 4)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - IIOP_Transport[%d]::sendfile, ")
+ ACE_TEXT ("sendfile failure - %m (errno: %d)\n"),
+ this->id (),
+ errno));
+ }
+
+ return retval;
+}
+#endif /* ACE_HAS_SENDFILE */
+
+ssize_t
+TAO_IIOP_Transport::recv (char *buf,
+ size_t len,
+ const ACE_Time_Value *max_wait_time)
+{
+ ssize_t const n = this->connection_handler_->peer ().recv (buf,
+ len,
+ max_wait_time);
+
+ // Do not print the error message if it is a timeout, which could
+ // occur in thread-per-connection.
+ if (n == -1 &&
+ TAO_debug_level > 4 &&
+ errno != ETIME)
+ {
+
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - IIOP_Transport[%d]::recv, ")
+ ACE_TEXT ("read failure - %m\n"),
+ this->id ()));
+ }
+
+ // Error handling
+ if (n == -1)
+ {
+ if (errno == EWOULDBLOCK)
+ return 0;
+
+ return -1;
+ }
+
+ // Most of the errors handling is common for
+ // Now the message has been read
+
+ // @@ What are the other error handling here??
+ else if (n == 0)
+ {
+ return -1;
+ }
+
+ return n;
+}
+
+int
+TAO_IIOP_Transport::send_request (TAO_Stub *stub,
+ TAO_ORB_Core *orb_core,
+ TAO_OutputCDR &stream,
+ int message_semantics,
+ ACE_Time_Value *max_wait_time)
+{
+ if (this->ws_->sending_request (orb_core,
+ message_semantics) == -1)
+
+ return -1;
+
+ if (this->send_message (stream,
+ stub,
+ message_semantics,
+ max_wait_time) == -1)
+ return -1;
+
+ this->first_request_sent();
+
+ return 0;
+}
+
+int
+TAO_IIOP_Transport::send_message (TAO_OutputCDR &stream,
+ TAO_Stub *stub,
+ int message_semantics,
+ ACE_Time_Value *max_wait_time)
+{
+ // Format the message in the stream first
+ if (this->messaging_object_->format_message (stream) != 0)
+ return -1;
+
+ // This guarantees to send all data (bytes) or return an error.
+ ssize_t const n = this->send_message_shared (stub,
+ message_semantics,
+ stream.begin (),
+ max_wait_time);
+
+ if (n == -1)
+ {
+ // Dont try to be smart and request for %p in the debug
+ // statement. If the event handler is destroyed the transport
+ // would return -1 with errno set to ENOENT. %p then would dump
+ // a core. %m would then be softer on this.
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - IIOP_Transport[%d]::send_message, ")
+ ACE_TEXT ("write failure - %m\n"),
+ this->id ()));
+ return -1;
+ }
+
+ return 1;
+}
+
+int
+TAO_IIOP_Transport::send_message_shared (
+ TAO_Stub *stub,
+ int message_semantics,
+ const ACE_Message_Block *message_block,
+ ACE_Time_Value *max_wait_time)
+{
+ int r;
+
+ {
+ ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->handler_lock_, -1);
+
+ r = this->send_message_shared_i (stub, message_semantics,
+ message_block, max_wait_time);
+ }
+
+ if (r == -1)
+ {
+ this->close_connection ();
+ }
+
+ return r;
+}
+
+int
+TAO_IIOP_Transport::generate_request_header (TAO_Operation_Details &opdetails,
+ TAO_Target_Specification &spec,
+ TAO_OutputCDR &msg)
+{
+ // Check whether we have a Bi Dir IIOP policy set, whether the
+ // messaging objects are ready to handle bidirectional connections
+ // and also make sure that we have not recd. or sent any information
+ // regarding this before...
+ if (this->orb_core ()->bidir_giop_policy () &&
+ this->messaging_object_->is_ready_for_bidirectional (msg) &&
+ this->bidirectional_flag () < 0)
+ {
+ this->set_bidir_context_info (opdetails);
+
+ // Set the flag to 1 (i.e., originating side)
+ this->bidirectional_flag (1);
+
+ // At the moment we enable BiDIR giop we have to get a new
+ // request id to make sure that we follow the even/odd rule
+ // for request id's. We only need to do this when enabled
+ // it, after that the Transport Mux Strategy will make sure
+ // that the rule is followed
+ opdetails.request_id (this->tms ()->request_id ());
+ }
+
+ return TAO_Transport::generate_request_header (opdetails,
+ spec,
+ msg);
+}
+
+int
+TAO_IIOP_Transport::messaging_init (CORBA::Octet major,
+ CORBA::Octet minor)
+{
+ this->messaging_object_->init (major, minor);
+
+ return 1;
+}
+
+int
+TAO_IIOP_Transport::tear_listen_point_list (TAO_InputCDR &cdr)
+{
+ CORBA::Boolean byte_order;
+ if ((cdr >> ACE_InputCDR::to_boolean (byte_order)) == 0)
+ return -1;
+
+ cdr.reset_byte_order (static_cast<int> (byte_order));
+
+ IIOP::ListenPointList listen_list;
+ if ((cdr >> listen_list) == 0)
+ return -1;
+
+ // As we have received a bidirectional information, set the flag to
+ // 0 (i.e., non-originating side)
+ this->bidirectional_flag (0);
+
+ return this->connection_handler_->process_listen_point_list (listen_list);
+}
+
+void
+TAO_IIOP_Transport::set_bidir_context_info (TAO_Operation_Details &opdetails)
+{
+ // Get a handle to the acceptor registry
+ TAO_Acceptor_Registry &ar =
+ this->orb_core ()->lane_resources ().acceptor_registry ();
+
+ IIOP::ListenPointList listen_point_list;
+
+ const TAO_AcceptorSetIterator end = ar.end ();
+
+ for (TAO_AcceptorSetIterator acceptor = ar.begin ();
+ acceptor != end;
+ ++acceptor)
+ {
+ // Check whether it is an IIOP acceptor
+ if ((*acceptor)->tag () == IOP::TAG_INTERNET_IOP)
+ {
+ if (this->get_listen_point (listen_point_list, *acceptor) == -1)
+ {
+ if (TAO_debug_level > 0)
+ ACE_ERROR ((LM_ERROR,
+ "TAO (%P|%t) - IIOP_Transport::set_bidir_context_info, "
+ "error getting listen_point\n"));
+
+ return;
+ }
+ }
+ }
+
+ if (listen_point_list.length () == 0)
+ {
+ if (TAO_debug_level > 0)
+ ACE_ERROR ((LM_ERROR,
+ "TAO (%P|%t) - IIOP_Transport::set_bidir_context_info, "
+ "listen_point list is empty, client should send a list "
+ "with at least one point\n"));
+
+ return;
+ }
+
+ // We have the ListenPointList at this point. Create a output CDR
+ // stream at this point
+ TAO_OutputCDR cdr;
+
+ // Marshal the information into the stream
+ if ((cdr << ACE_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER) == 0)
+ || (cdr << listen_point_list) == 0)
+ return;
+
+ // Add this info in to the svc_list
+ opdetails.request_service_context ().set_context (IOP::BI_DIR_IIOP,
+ cdr);
+
+ return;
+}
+
+int
+TAO_IIOP_Transport::get_listen_point (
+ IIOP::ListenPointList &listen_point_list,
+ TAO_Acceptor *acceptor)
+{
+ TAO_IIOP_Acceptor *iiop_acceptor =
+ dynamic_cast<TAO_IIOP_Acceptor *> (acceptor);
+
+ if (iiop_acceptor == 0)
+ return -1;
+
+ // Get the array of endpoints serviced by TAO_IIOP_Acceptor
+ const ACE_INET_Addr *endpoint_addr =
+ iiop_acceptor->endpoints ();
+
+ // Get the endpoint count
+ size_t const count =
+ iiop_acceptor->endpoint_count ();
+
+ // Get the local address of the connection
+ ACE_INET_Addr local_addr;
+
+ if (this->connection_handler_->peer ().get_local_addr (local_addr)
+ == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) - IIOP_Transport::get_listen_point, ")
+ ACE_TEXT ("could not resolve local host address\n")),
+ -1);
+ }
+
+ // Note: Looks like there is no point in sending the list of
+ // endpoints on interfaces on which this connection has not
+ // been established. If this is wrong, please correct me.
+ CORBA::String_var local_interface;
+
+ // Get the hostname for the local address
+ if (iiop_acceptor->hostname (this->orb_core_,
+ local_addr,
+ local_interface.out ()) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) - IIOP_Transport::get_listen_point, ")
+ ACE_TEXT ("could not resolve local host name\n")),
+ -1);
+ }
+#if defined (ACE_HAS_IPV6)
+ // If this is an IPv6 decimal linklocal address containing a scopeid than
+ // remove the scopeid from the information being sent.
+ const char *cp_scope = 0;
+ if (local_addr.get_type () == PF_INET6 &&
+ (cp_scope = ACE_OS::strchr (local_interface.in (), '%')) != 0)
+ {
+ CORBA::ULong len = cp_scope - local_interface.in ();
+ local_interface[len] = '\0';
+ }
+#endif /* ACE_HAS_IPV6 */
+
+ for (size_t index = 0;
+ index < count;
+ ++index)
+ {
+ // Make sure port numbers are equal so the following comparison
+ // only concerns the IP(v4/v6) address.
+ local_addr.set_port_number (endpoint_addr[index].get_port_number ());
+
+ if (local_addr == endpoint_addr[index])
+ {
+ // Get the count of the number of elements
+ const CORBA::ULong len = listen_point_list.length ();
+
+ // Increase the length by 1
+ listen_point_list.length (len + 1);
+
+ // We have the connection and the acceptor endpoint on the
+ // same interface
+ IIOP::ListenPoint & point = listen_point_list[len];
+ point.host = CORBA::string_dup (local_interface.in ());
+ point.port = endpoint_addr[index].get_port_number ();
+
+ if (TAO_debug_level >= 5)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT("TAO (%P|%t) - Listen_Point_List[%d] = <%s:%d>\n"),
+ len,
+ point.host.in (),
+ point.port));
+ }
+
+ }
+ }
+
+ return 1;
+}
+//@@ TAO_TRANSPORT_SPL_COPY_HOOK_END
+/*
+ * End of copy hook.
+ */
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_IIOP && TAO_HAS_IIOP != 0 */
diff --git a/TAO/tao/IIOP_Transport.h b/TAO/tao/IIOP_Transport.h
new file mode 100644
index 00000000000..70c99088a0a
--- /dev/null
+++ b/TAO/tao/IIOP_Transport.h
@@ -0,0 +1,166 @@
+// -*- C++ -*-
+
+// ===================================================================
+/**
+ * @file IIOP_Transport.h
+ *
+ * $Id$
+ *
+ * @author Originally by Fred Kuhns <fredk@cs.wustl.edu>
+ * @author Modified by Balachandran Natarajan <bala@cs.wustl.edu>
+ */
+// ===================================================================
+
+#ifndef TAO_IIOP_TRANSPORT_H
+#define TAO_IIOP_TRANSPORT_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if defined (TAO_HAS_IIOP) && (TAO_HAS_IIOP != 0)
+
+#include "tao/Transport.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace IIOP
+{
+ class ListenPointList;
+}
+
+// Forward decls.
+class TAO_IIOP_Connection_Handler;
+class TAO_ORB_Core;
+class TAO_Operation_Details;
+class TAO_Pluggable_Messaging;
+class TAO_Acceptor;
+class TAO_Adapter;
+
+/**
+ * @class TAO_IIOP_Transport
+ *
+ * @brief Specialization of the base TAO_Transport class to handle the
+ * IIOP protocol.
+ *
+ * Specialization of the base TAO_Transport class to handle the IIOP
+ * protocol.
+ */
+class TAO_Export TAO_IIOP_Transport : public TAO_Transport
+{
+public:
+
+ /// Constructor.
+ TAO_IIOP_Transport (TAO_IIOP_Connection_Handler *handler,
+ TAO_ORB_Core *orb_core,
+ CORBA::Boolean flag);
+
+protected:
+
+ /// Destructor
+ /**
+ * Protected destructor to enforce proper memory management through
+ * the reference counting mechanism.
+ */
+ virtual ~TAO_IIOP_Transport (void);
+
+ /** @name Overridden Template Methods
+ *
+ * Please check the documentation in "tao/Transport.h" for more
+ * details.
+ */
+ //@{
+
+ virtual ACE_Event_Handler * event_handler_i (void);
+
+ /// Access the underlying messaging object
+ virtual TAO_Pluggable_Messaging *messaging_object (void);
+
+ virtual ssize_t send (iovec *iov, int iovcnt,
+ size_t &bytes_transferred,
+ const ACE_Time_Value *timeout = 0);
+
+#ifdef ACE_HAS_SENDFILE
+ virtual ssize_t sendfile (TAO_MMAP_Allocator * allocator,
+ iovec * iov,
+ int iovcnt,
+ size_t &bytes_transferred,
+ ACE_Time_Value const * timeout = 0);
+#endif /* ACE_HAS_SENDFILE */
+
+
+ virtual ssize_t recv (char *buf,
+ size_t len,
+ const ACE_Time_Value *s = 0);
+
+ virtual int send_message_shared (TAO_Stub *stub,
+ int message_semantics,
+ const ACE_Message_Block *message_block,
+ ACE_Time_Value *max_wait_time);
+
+
+public:
+
+ /// Bridge method to call a similar method on the connection handler
+ void update_protocol_properties (int send_buffer_size,
+ int recv_buffer_size,
+ int no_delay,
+ int enable_network_priority);
+
+ /// @todo These methods IMHO should have more meaningful
+ /// names. The names seem to indicate nothing.
+ virtual int send_request (TAO_Stub *stub,
+ TAO_ORB_Core *orb_core,
+ TAO_OutputCDR &stream,
+ int message_semantics,
+ ACE_Time_Value *max_wait_time);
+
+ virtual int send_message (TAO_OutputCDR &stream,
+ TAO_Stub *stub = 0,
+ int message_semantics = TAO_Transport::TAO_TWOWAY_REQUEST,
+ ACE_Time_Value *max_time_wait = 0);
+
+ virtual int generate_request_header (TAO_Operation_Details &opdetails,
+ TAO_Target_Specification &spec,
+ TAO_OutputCDR &msg);
+
+ virtual int messaging_init (CORBA::Octet major,
+ CORBA::Octet minor);
+
+ virtual int tear_listen_point_list (TAO_InputCDR &cdr);
+
+ virtual TAO_Connection_Handler * connection_handler_i (void);
+
+ //@}
+
+private:
+
+ /// Set the Bidirectional context info in the service context list
+ void set_bidir_context_info (TAO_Operation_Details &opdetails);
+
+ /// Add the listen points in @a acceptor to the @a listen_point_list
+ /// if this connection is in the same interface as that of the
+ /// endpoints in the @a acceptor
+ int get_listen_point (IIOP::ListenPointList &listen_point_list,
+ TAO_Acceptor *acceptor);
+private:
+
+ /// The connection service handler used for accessing lower layer
+ /// communication protocols.
+ TAO_IIOP_Connection_Handler *connection_handler_;
+
+ /// Our messaging object.
+ TAO_Pluggable_Messaging *messaging_object_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_IIOP && TAO_HAS_IIOP != 0 */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_IIOP_TRANSPORT_H */
diff --git a/TAO/tao/IOP.pidl b/TAO/tao/IOP.pidl
new file mode 100644
index 00000000000..90ed9c8b7f4
--- /dev/null
+++ b/TAO/tao/IOP.pidl
@@ -0,0 +1,33 @@
+// -*- IDL -*-
+/**
+ * @file IOP.pidl
+ *
+ * $Id$
+ *
+ * @brief Pre-compiled IDL source for the IOP module.
+ *
+ * This file is used to generate IOPC.{h,cpp}, using the following
+ * command:
+ *
+ * tao_idl.exe
+ * -o orig -St -Sp -Ge 1 -SS -Sci
+ * -Wb,export_macro=TAO_Export
+ * -Wb,export_include="tao/TAO_Export.h"
+ * -Wb,pre_include="ace/pre.h"
+ * -Wb,post_include="ace/post.h"
+ * IOP.pidl
+ *
+ * and then:
+ *
+ * patch < diffs/IOP.diff
+ *
+ * The code left in IOPC.{h,inl,cpp} is ready for use.
+ *
+ */
+
+#ifndef TAO_IOP_PIDL
+#define TAO_IOP_PIDL
+
+#include "tao/IOP_IOR.pidl"
+
+#endif /* TAO_IOP_PIDL */
diff --git a/TAO/tao/IOP_IOR.pidl b/TAO/tao/IOP_IOR.pidl
new file mode 100644
index 00000000000..896ef455302
--- /dev/null
+++ b/TAO/tao/IOP_IOR.pidl
@@ -0,0 +1,114 @@
+// -*- IDL -*-
+/**
+ * @file IOP_IOR.pidl
+ *
+ * $Id$
+ *
+ * @brief Pre-compiled IDL source for the IOP module.
+ *
+ * This file is used to generate IOPC.{h,cpp}, using the following
+ * command:
+ *
+ * tao_idl.exe
+ * -o orig -Gp -Gd -Ge 1 -GA -SS -Sci
+ * -Wb,export_macro=TAO_Export
+ * -Wb,export_include=tao/TAO_Export.h
+ * -Wb,pre_include="ace/pre.h"
+ * -Wb,post_include="ace/post.h"
+ * IOP_IOR.pidl
+ *
+ * and then:
+ *
+ * cp orig/IOP_IORC.{h,inl,cpp} .
+ * cp orig/IOP_IORA.cpp .
+ */
+
+#ifndef TAO_IOP_IOR_PIDL
+#define TAO_IOP_IOR_PIDL
+
+#include "tao/OctetSeq.pidl"
+
+#pragma prefix "omg.org"
+
+module IOP
+{
+ typedef unsigned long ProfileId;
+ const ProfileId TAG_INTERNET_IOP = 0;
+ const ProfileId TAG_MULTIPLE_COMPONENTS = 1;
+
+ struct TaggedProfile {
+ ProfileId tag;
+ CORBA::OctetSeq profile_data;
+ };
+
+ typedef sequence<TaggedProfile> TaggedProfileSeq;
+
+ struct IOR {
+ string type_id;
+ TaggedProfileSeq profiles;
+ };
+
+ typedef unsigned long ComponentId;
+ struct TaggedComponent {
+ ComponentId tag;
+ CORBA::OctetSeq component_data;
+ };
+ typedef sequence<TaggedComponent> MultipleComponentProfile;
+ typedef sequence<TaggedComponent> TaggedComponentList;
+ typedef sequence<TaggedComponent> TaggedComponentSeq;
+
+ // @@ All security related tags are located in the Security Service
+ // @@ related IDL files, in accordance with the Security Service 1.8
+ // @@ specification.
+
+ const ComponentId TAG_ORB_TYPE = 0;
+ const ComponentId TAG_CODE_SETS = 1;
+ const ComponentId TAG_POLICIES = 2;
+ const ComponentId TAG_ALTERNATE_IIOP_ADDRESS = 3;
+
+ const ComponentId TAG_COMPLETE_OBJECT_KEY = 5;
+ const ComponentId TAG_ENDPOINT_ID_POSITION = 6;
+ const ComponentId TAG_LOCATION_POLICY = 12;
+ const ComponentId TAG_DCE_STRING_BINDING = 100;
+ const ComponentId TAG_DCE_BINDING_NAME = 101;
+ const ComponentId TAG_DCE_NO_PIPES = 102;
+
+ typedef unsigned long ServiceId;
+ struct ServiceContext {
+ ServiceId context_id;
+ CORBA::OctetSeq context_data;
+ };
+ typedef sequence <ServiceContext> ServiceContextList;
+
+ const ServiceId TransactionService = 0;
+ const ServiceId CodeSets = 1;
+ const ServiceId ChainBypassCheck = 2;
+ const ServiceId ChainBypassInfo = 3;
+ const ServiceId LogicalThreadId = 4;
+ const ServiceId BI_DIR_IIOP = 5;
+ const ServiceId SendingContextRunTime = 6;
+ const ServiceId INVOCATION_POLICIES = 7;
+ // const ServiceId FORWARDED_IDENTITY = 8;
+ const ServiceId UnknownExceptionInfo = 9;
+
+ // The following are defined in CORBA v2.4.2 Chapter 24 (February, 2001):
+ const ServiceId RTCorbaPriority = 10;
+ const ServiceId RTCorbaPriorityRange = 11;
+
+ // The following are defined in the ptc/2000-04-04:
+ // Fault Tolerant CORBA Specification, V1.0
+ const ComponentId TAG_FT_GROUP = 27;
+ const ComponentId TAG_FT_PRIMARY = 28;
+ const ComponentId TAG_FT_HEARTBEAT_ENABLED = 29;
+ const ServiceId FT_GROUP_VERSION = 12;
+ const ServiceId FT_REQUEST = 13;
+
+ // The following are defined in 03-01-11
+ const ProfileId TAG_UIPMC = 3;
+ const ComponentId TAG_GROUP = 39;
+ const ComponentId TAG_GROUP_IIOP = 40;
+};
+
+#pragma prefix ""
+
+#endif /* TAO_IOP_PIDL */
diff --git a/TAO/tao/IORInterceptor.mpc b/TAO/tao/IORInterceptor.mpc
new file mode 100644
index 00000000000..df213daacdd
--- /dev/null
+++ b/TAO/tao/IORInterceptor.mpc
@@ -0,0 +1,51 @@
+//$Id$
+project : taolib, portableserver, objreftemplate, pi, core, tao_versioning_idl_defaults {
+ sharedname = TAO_IORInterceptor
+ dynamicflags = TAO_IORINTERCEPTOR_BUILD_DLL
+
+ Source_Files {
+ IORInterceptor
+ }
+
+ Header_Files {
+ IORInterceptor
+ }
+
+ Inline_Files {
+ IORInterceptor
+ }
+
+ Template_Files {
+ IORInterceptor
+ }
+
+ Resource_Files {
+ IORInterceptor
+ }
+
+ PIDL_Files {
+ IORInterceptor
+ }
+
+ IDL_Files {
+ idlflags += -Gp -Gd -Ge 1 -Sci -SS -Sorb -Sa -St \
+ -Wb,export_macro=TAO_IORInterceptor_Export \
+ -Wb,export_include=tao/IORInterceptor/iorinterceptor_export.h \
+ -Wb,include_guard=TAO_IORINTERCEPTOR_SAFE_INCLUDE \
+ -Wb,safe_include=tao/IORInterceptor/IORInterceptor.h \
+ -o IORInterceptor
+ IORInterceptor/IORInterceptor.pidl
+ }
+
+ IDL_Files {
+ idlflags += -Gp -Gd -Ge 1 -Sci -SS -Sorb -Sa -St \
+ -Wb,export_macro=TAO_IORInterceptor_Export \
+ -Wb,export_include=tao/IORInterceptor/iorinterceptor_export.h \
+ -o IORInterceptor
+ IORInterceptor/IORInfo.pidl
+ }
+
+ Pkgconfig_Files {
+ IORInterceptor/TAO_IORInterceptor.pc.in
+ }
+}
diff --git a/TAO/tao/IORInterceptor/IORInfo.cpp b/TAO/tao/IORInterceptor/IORInfo.cpp
new file mode 100644
index 00000000000..de6dd91494d
--- /dev/null
+++ b/TAO/tao/IORInterceptor/IORInfo.cpp
@@ -0,0 +1,197 @@
+#include "tao/IORInterceptor/IORInfo.h"
+#include "tao/PortableServer/Root_POA.h"
+
+#include "tao/PolicyC.h"
+#include "tao/IOPC.h"
+#include "tao/ORB_Constants.h"
+
+
+ACE_RCSID (IORInterceptor,
+ IORInfo,
+ "$Id$")
+
+#if !defined (__ACE_INLINE__)
+# include "tao/IORInterceptor/IORInfo.inl"
+#endif /* __ACE_INLINE__ */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_IORInfo::TAO_IORInfo (TAO_Root_POA *poa)
+ : poa_ (poa),
+ components_established_ (false)
+{
+}
+
+TAO_IORInfo::~TAO_IORInfo (void)
+{
+}
+
+CORBA::Policy_ptr
+TAO_IORInfo::get_effective_policy (CORBA::PolicyType type
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+
+ CORBA::Policy_var policy =
+ this->poa_->get_policy (type ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+
+ if (!CORBA::is_nil (policy.in ()))
+ {
+ return policy._retn ();
+ }
+
+ // TODO: Now check the global ORB policies.
+ // ........
+
+ // No policy matching the given PolicyType was found.
+ ACE_THROW_RETURN (CORBA::INV_POLICY (CORBA::OMGVMCID | 3,
+ CORBA::COMPLETED_NO),
+ CORBA::Policy::_nil ());
+}
+
+void
+TAO_IORInfo::add_ior_component (const IOP::TaggedComponent &component
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (this->components_established_)
+ ACE_THROW (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14,
+ CORBA::COMPLETED_NO));
+
+ // Add the given tagged component to all profiles.
+ this->poa_->save_ior_component (component
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+void
+TAO_IORInfo::add_ior_component_to_profile (
+ const IOP::TaggedComponent &component,
+ IOP::ProfileId profile_id
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (this->components_established_)
+ ACE_THROW (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14,
+ CORBA::COMPLETED_NO));
+
+ this->poa_->save_ior_component_and_profile_id (component,
+ profile_id
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+char *
+TAO_IORInfo::manager_id (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ PortableServer::POAManager_var poa_manager = this->poa_->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+ return poa_manager->get_id (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+PortableInterceptor::AdapterState
+TAO_IORInfo::state (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (PortableInterceptor::NON_EXISTENT);
+
+ return this->poa_->get_adapter_state (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+PortableInterceptor::ObjectReferenceTemplate *
+TAO_IORInfo::adapter_template (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ // Return the Object Reference Template whenever an IOR Interceptor
+ // is invoked. Its value is the template created for the adapter
+ // policies and the IOR Interceptor calls to add_ior_component and
+ // add_ior_component_to_profile. It's a const value and its value
+ // never changes.
+ PortableInterceptor::ObjectReferenceTemplate *adapter_template =
+ this->poa_->get_adapter_template (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ if (adapter_template == 0)
+ {
+ ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14,
+ CORBA::COMPLETED_NO),
+ 0);
+ }
+
+ return adapter_template;
+}
+
+PortableInterceptor::ObjectReferenceFactory *
+TAO_IORInfo::current_factory (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ // Return the current_factory that is used to create the object
+ // references by the adapter. Though initially, its value is the
+ // same as the adapter_template, unlike adapter_template, its value
+ // can be changed. The value of the current_factory can be changed
+ // only during the call to components_established method.
+ PortableInterceptor::ObjectReferenceFactory *adapter_factory =
+ this->poa_->get_obj_ref_factory (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ if (adapter_factory == 0)
+ {
+ ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14,
+ CORBA::COMPLETED_NO),
+ 0);
+ }
+
+ return adapter_factory;
+}
+
+void
+TAO_IORInfo::current_factory (
+ PortableInterceptor::ObjectReferenceFactory * current_factory
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->poa_->set_obj_ref_factory (current_factory
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+void
+TAO_IORInfo::check_validity (ACE_ENV_SINGLE_ARG_DECL)
+{
+ if (this->poa_ == 0)
+ {
+ // Although not defined by the spec, duplicate the behavior used
+ // by the ORBInitInfo object once CORBA::ORB_init() has been
+ // called. Specifically, the IORInfo object is no longer valid
+ // once the POA has invoked all IORInterceptor interception
+ // points. This also prevents memory access violations from
+ // occuring if the POA is destroyed before this IORInfo object.
+ ACE_THROW (CORBA::OBJECT_NOT_EXIST (TAO::VMCID,
+ CORBA::COMPLETED_NO));
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/IORInterceptor/IORInfo.h b/TAO/tao/IORInterceptor/IORInfo.h
new file mode 100644
index 00000000000..3d4803a6792
--- /dev/null
+++ b/TAO/tao/IORInterceptor/IORInfo.h
@@ -0,0 +1,173 @@
+// -*- C++ -*-
+
+// ===================================================================
+/**
+ * @file IORInfo.h
+ *
+ * $Id$
+ *
+ * @author Ossama Othman <ossama@uci.edu>
+ */
+// ===================================================================
+
+#ifndef TAO_IOR_INFO_H
+#define TAO_IOR_INFO_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/IORInterceptor/IORInfoC.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/LocalObject.h"
+
+// This is to remove "inherits via dominance" warnings from MSVC.
+// MSVC is being a little too paranoid.
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/// Forward declarations.
+class TAO_Root_POA;
+
+/**
+ * @class TAO_IORInfo
+ *
+ * @brief This class exposes an interface that allows IORInterceptors add
+ * tagged components to IORs.
+ */
+class TAO_IORInfo
+ : public virtual PortableInterceptor::IORInfo,
+ public virtual TAO_Local_RefCounted_Object
+{
+public:
+
+ /// Constructor.
+ TAO_IORInfo (TAO_Root_POA *poa);
+
+ /**
+ * @name PortableInterceptor::IORInfo Methods
+ *
+ * Methods exposed by the PortableInterceptor::IORInfo interface.
+ */
+ //@{
+
+ /// Return the policy matching the given policy type that is in
+ /// effect for the object whose IOR is being created.
+ virtual CORBA::Policy_ptr get_effective_policy (
+ CORBA::PolicyType type
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Add the given tagged component to all profiles.
+ virtual void add_ior_component (
+ const IOP::TaggedComponent & component
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Add the given tagged component to all profiles matching the given
+ /// ProfileId.
+ virtual void add_ior_component_to_profile (
+ const IOP::TaggedComponent & component,
+ IOP::ProfileId profile_id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual char * manager_id (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual PortableInterceptor::AdapterState state (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual PortableInterceptor::ObjectReferenceTemplate * adapter_template (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual PortableInterceptor::ObjectReferenceFactory * current_factory (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual void current_factory (
+ PortableInterceptor::ObjectReferenceFactory * current_factory
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ //@}
+
+ /// Invalidate this IORInfo instance.
+ /**
+ * Once the IOR interception points have been invoked, this IORInfo
+ * instance is no longer valid.
+ */
+ void invalidate (void);
+
+ /// Inform the this IORInfo object that the
+ /// IORInterceptor::components_established() interception point has
+ /// been called.
+ /**
+ * This method is used to inform the IORInfo object when the
+ * add_ior_component() and add_ior_component_to_profile() methods
+ * are invalid. They are only valid in the
+ * IORInterceptor::establish_components() interception point.
+ */
+ void components_established (void);
+
+protected:
+
+ /// Protected destructor to enforce proper memory managment through
+ /// the reference counting mechanism.
+ ~TAO_IORInfo (void);
+
+ /// Check if this IORInfo instance is valid.
+ /**
+ * Once all IORInterceptor interception points have been called,
+ * this IORInfo object is no longer valid. Throw an exception in
+ * that case.
+ */
+ void check_validity (ACE_ENV_SINGLE_ARG_DECL);
+
+private:
+
+ /// Prevent copying through the copy constructor and the assignment
+ /// operator.
+ TAO_IORInfo (const TAO_IORInfo &);
+ void operator= (const TAO_IORInfo &);
+
+private:
+
+ /// Pointer to POA
+ TAO_Root_POA * poa_;
+
+ /// True if the IORInterceptor::components_established()
+ /// interception point was called. False otherwise.
+ /**
+ * This flag is used to prevent the add_ior_component() and
+ * add_ior_component_to_profile() methods from being incorrectly
+ * called after the IORInterceptor::establish_components()
+ * interception point has been called.
+ */
+ CORBA::Boolean components_established_;
+
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/IORInterceptor/IORInfo.inl"
+#endif /* __ACE_INLINE__ */
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_IOR_INFO_H */
diff --git a/TAO/tao/IORInterceptor/IORInfo.inl b/TAO/tao/IORInterceptor/IORInfo.inl
new file mode 100644
index 00000000000..dfb66194baf
--- /dev/null
+++ b/TAO/tao/IORInterceptor/IORInfo.inl
@@ -0,0 +1,20 @@
+// -*- C++ -*-
+//
+// $Id$
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE void
+TAO_IORInfo::invalidate (void)
+{
+ this->poa_ = 0;
+}
+
+ACE_INLINE void
+TAO_IORInfo::components_established (void)
+{
+ this->components_established_ = true;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/IORInterceptor/IORInfo.pidl b/TAO/tao/IORInterceptor/IORInfo.pidl
new file mode 100644
index 00000000000..86b21230a74
--- /dev/null
+++ b/TAO/tao/IORInterceptor/IORInfo.pidl
@@ -0,0 +1,66 @@
+// -*- IDL -*-
+
+/**
+ * @file IORInfo.pidl
+ *
+ * $Id$
+ *
+ * @brief Pre-compiled IDL source for the IORInfo
+ * components in the ORB.
+ *
+ * The following is from orbos/99-12-02 Portable Interceptors spec,
+ * the full IDL is downloadable from orbos/99-12-02. This file contains
+ * interfaces from PortableInterceptor.idl that depend on
+ * ObjectReferenceFactory and ObjectReferenceTemplate, which inherit
+ * directly or indirectly from CORBA::ValueBase. This separate file
+ * has been created to remove the dependency from the rest of module
+ * PortableInterceptor.
+ *
+ * This file was used to generate the code in IORInfoC.*
+ * The command used to generate code is:
+ *
+ * tao_idl
+ * -o orig -Gp -SS -Gd -Ge 1 -Sa -St -Sci
+ * -I$(TAO_ROOT)
+ * -Wb,export_macro=TAO_IORInterceptor_Export
+ * -Wb,export_include="iorinterceptor_export.h"
+ * -Wb,pre_include="ace/pre.h"
+ * -Wb,post_include="ace/post.h"
+ * IORInfo.pidl
+ */
+
+// File: IORInfo.idl
+#ifndef _IORINFO_IDL_
+#define _IORINFO_IDL_
+
+#include "tao/PortableInterceptor.pidl"
+#include "tao/Policy_Forward.pidl"
+#include "tao/IOP_IOR.pidl"
+#include "tao/ObjRefTemplate/ObjectReferenceTemplate_include.pidl"
+
+module PortableInterceptor
+{
+ typeprefix PortableInterceptor "omg.org";
+
+ local interface IORInfo
+ {
+ CORBA::Policy get_effective_policy (in CORBA::PolicyType type);
+
+ void add_ior_component (in IOP::TaggedComponent a_component);
+
+ void add_ior_component_to_profile (
+ in IOP::TaggedComponent a_component,
+ in IOP::ProfileId profile_id
+ );
+
+ readonly attribute AdapterManagerId manager_id;
+
+ readonly attribute AdapterState state;
+
+ readonly attribute ObjectReferenceTemplate adapter_template;
+
+ attribute ObjectReferenceFactory current_factory;
+ };
+};
+
+#endif /* _IORINFO_IDL_ */
diff --git a/TAO/tao/IORInterceptor/IORInterceptor.h b/TAO/tao/IORInterceptor/IORInterceptor.h
new file mode 100644
index 00000000000..802055759e9
--- /dev/null
+++ b/TAO/tao/IORInterceptor/IORInterceptor.h
@@ -0,0 +1,23 @@
+/* -*- C++ -*- */
+
+//=============================================================================
+/**
+ * @file IORInterceptor.h
+ *
+ * $Id$
+ *
+ * @author Bala Natarajan <bala@dre.vanderbilt.edu>
+ */
+//=============================================================================
+#ifndef TAO_IORINTERCEPTOR_IORINTERCEPTOR_H
+#define TAO_IORINTERCEPTOR_IORINTERCEPTOR_H
+#include /**/ "ace/pre.h"
+
+#include "tao/IORInterceptor/IORInterceptor_Adapter_Factory_Impl.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include /**/ "ace/post.h"
+#endif /*TAO_IORINTERCEPTOR_IORINTERCEPTOR_H*/
diff --git a/TAO/tao/IORInterceptor/IORInterceptor.pidl b/TAO/tao/IORInterceptor/IORInterceptor.pidl
new file mode 100644
index 00000000000..40568168fd8
--- /dev/null
+++ b/TAO/tao/IORInterceptor/IORInterceptor.pidl
@@ -0,0 +1,67 @@
+// -*- IDL -*-
+
+/**
+ * @file IORInterceptor.pidl
+ *
+ * $Id$
+ *
+ * @brief Pre-compiled IDL source for the IOR Interceptor
+ * components in the ORB.
+ *
+ * The following is from orbos/99-12-02 Portable Interceptors spec,
+ * the full IDL is downloadable from orbos/99-12-02. This file contains
+ * interfaces from PortableInterceptor.idl that depend on
+ * ObjectReferenceFactory and ObjectReferenceTemplate, which inherit
+ * directly or indirectly from CORBA::ValueBase. This separate file
+ * has been created to remove the dependency from the rest of module
+ * PortableInterceptor.
+ *
+ * This file was used to generate the code in IORInterceptorC.*
+ * The command used to generate code is:
+ *
+ * tao_idl
+ * -o orig -Gp -Gd -Ge 1 -Sa -St -Sci -SS
+ * -I$(TAO_ROOT)
+ * -Wb,export_macro=TAO_IORInterceptor_Export
+ * -Wb,export_include="iorinterceptor_export.h"
+ * -Wb,pre_include="ace/pre.h"
+ * -Wb,post_include="ace/post.h"
+ * IORInterceptor.pidl
+ *
+ * Please apply the patch in IORInterceptor.diff to the generated stubs and
+ * skeletons.
+ */
+
+// File: IORInterceptor.idl
+#ifndef _IOR_INTERCEPTOR_IDL_
+#define _IOR_INTERCEPTOR_IDL_
+
+#include "tao/PI/Interceptor.pidl"
+#include "tao/IORInterceptor/IORInfo.pidl"
+#include "tao/ObjRefTemplate/ObjectReferenceTemplate.pidl"
+
+module PortableInterceptor
+{
+ typeprefix PortableInterceptor "omg.org";
+
+ local interface IORInterceptor : Interceptor
+ {
+ void establish_components (in IORInfo info);
+ };
+
+ local interface IORInterceptor_3_0 : IORInterceptor
+ {
+ void components_established (in IORInfo info);
+
+ void adapter_manager_state_changed (
+ in AdapterManagerId id,
+ in AdapterState state
+ );
+ void adapter_state_changed (
+ in ObjectReferenceTemplateSeq templates,
+ in AdapterState state
+ );
+ };
+};
+
+#endif /* _IOR_INTERCEPTOR_IDL_ */
diff --git a/TAO/tao/IORInterceptor/IORInterceptor_Adapter_Factory_Impl.cpp b/TAO/tao/IORInterceptor/IORInterceptor_Adapter_Factory_Impl.cpp
new file mode 100644
index 00000000000..a917dc798d4
--- /dev/null
+++ b/TAO/tao/IORInterceptor/IORInterceptor_Adapter_Factory_Impl.cpp
@@ -0,0 +1,60 @@
+// $Id$
+
+#include "tao/IORInterceptor/IORInterceptor_Adapter_Impl.h"
+#include "tao/IORInterceptor/IORInterceptor_Adapter_Factory_Impl.h"
+
+#include "tao/ORB_Core.h"
+
+ACE_RCSID (IORInterceptor,
+ IORInterceptor_Adapter_Factory_Impl,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_IORInterceptor_Adapter_Factory_Impl::~TAO_IORInterceptor_Adapter_Factory_Impl (void)
+{
+}
+
+TAO_IORInterceptor_Adapter *
+TAO_IORInterceptor_Adapter_Factory_Impl::create (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ TAO_IORInterceptor_Adapter_Impl *nia = 0;
+ ACE_NEW_THROW_EX (nia,
+ TAO_IORInterceptor_Adapter_Impl (),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (nia);
+
+ return nia;
+}
+
+
+// *********************************************************************
+
+// Initialization and registration of dynamic service object.
+
+int
+TAO_IORInterceptor_Adapter_Factory_Impl::Initializer (void)
+{
+ TAO_ORB_Core::iorinterceptor_adapter_factory_name (
+ "Concrete_IORInterceptor_Adapter_Factory"
+ );
+
+ return
+ ACE_Service_Config::process_directive (
+ ace_svc_desc_TAO_IORInterceptor_Adapter_Factory_Impl
+ );
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DEFINE (
+ TAO_IORInterceptor_Adapter_Factory_Impl,
+ ACE_TEXT ("Concrete_IORInterceptor_Adapter_Factory"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (TAO_IORInterceptor_Adapter_Factory_Impl),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0
+ )
+
+ACE_FACTORY_DEFINE (TAO_IORInterceptor, TAO_IORInterceptor_Adapter_Factory_Impl)
diff --git a/TAO/tao/IORInterceptor/IORInterceptor_Adapter_Factory_Impl.h b/TAO/tao/IORInterceptor/IORInterceptor_Adapter_Factory_Impl.h
new file mode 100644
index 00000000000..a08507cd6a6
--- /dev/null
+++ b/TAO/tao/IORInterceptor/IORInterceptor_Adapter_Factory_Impl.h
@@ -0,0 +1,70 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file IORInterceptor_Adapter_Factory_Impl.h
+ *
+ * $Id$
+ *
+ * @author George Edwards <g.edwards@vanderbilt.edu>
+ */
+//=============================================================================
+
+
+#ifndef TAO_IORINTERCEPTOR_ADAPTER_FACTORY_IMPL_H
+#define TAO_IORINTERCEPTOR_ADAPTER_FACTORY_IMPL_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/IORInterceptor/iorinterceptor_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/IORInterceptor_Adapter_Factory.h"
+#include "ace/Service_Config.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_IORInterceptor_Adapter;
+
+/**
+ * @class TAO_IORInterceptor_Adapter_Factory_Impl
+ *
+ * @brief TAO_IORInterceptor_Adapter_Factory_Impl.
+ *
+ * Class that creates instances of TAO_IORInterceptor_Adapter (one per ORB).
+ * This is the derived class that contains the actual implementations.
+ */
+class TAO_IORInterceptor_Export TAO_IORInterceptor_Adapter_Factory_Impl
+ : public TAO_IORInterceptor_Adapter_Factory
+{
+public:
+ virtual ~TAO_IORInterceptor_Adapter_Factory_Impl (void);
+
+ virtual TAO_IORInterceptor_Adapter * create (
+ ACE_ENV_SINGLE_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ // Used to force the initialization of the ORB code.
+ static int Initializer (void);
+};
+
+static int
+TAO_Requires_IORInterceptor_Initializer =
+ TAO_IORInterceptor_Adapter_Factory_Impl::Initializer ();
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE (TAO_IORInterceptor_Adapter_Factory_Impl)
+ACE_FACTORY_DECLARE (TAO_IORInterceptor, TAO_IORInterceptor_Adapter_Factory_Impl)
+
+#define TAO_IORINTERCEPTOR_SAFE_INCLUDE
+#include "tao/IORInterceptor/IORInterceptorC.h"
+#undef TAO_IORINTERCEPTOR_SAFE_INCLUDE
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_IORINTERCEPTOR_ADAPTER_FACTORY_IMPL_H */
diff --git a/TAO/tao/IORInterceptor/IORInterceptor_Adapter_Impl.cpp b/TAO/tao/IORInterceptor/IORInterceptor_Adapter_Impl.cpp
new file mode 100644
index 00000000000..4b9bc703257
--- /dev/null
+++ b/TAO/tao/IORInterceptor/IORInterceptor_Adapter_Impl.cpp
@@ -0,0 +1,254 @@
+// $Id$
+
+#include "tao/IORInterceptor/IORInterceptor_Adapter_Impl.h"
+#include "tao/IORInterceptor/IORInfo.h"
+#include "tao/debug.h"
+#include "tao/ORB_Constants.h"
+#include "tao/PI/PI.h"
+#include "tao/PortableServer/Root_POA.h"
+#include "tao/PortableServer/Non_Servant_Upcall.h"
+
+ACE_RCSID (IORInterceptor,
+ IORInterceptor_Adapter_Impl,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_IORInterceptor_Adapter_Impl::~TAO_IORInterceptor_Adapter_Impl (void)
+{
+}
+
+void
+TAO_IORInterceptor_Adapter_Impl::add_interceptor (
+ PortableInterceptor::IORInterceptor_ptr i
+ ACE_ENV_ARG_DECL
+ )
+{
+ this->ior_interceptor_list_.add_interceptor (i
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+void
+TAO_IORInterceptor_Adapter_Impl::add_interceptor (
+ PortableInterceptor::IORInterceptor_ptr i,
+ const CORBA::PolicyList& policies
+ ACE_ENV_ARG_DECL
+ )
+{
+ this->ior_interceptor_list_.add_interceptor (i,
+ policies
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+void
+TAO_IORInterceptor_Adapter_Impl::destroy_interceptors (ACE_ENV_SINGLE_ARG_DECL)
+{
+ this->ior_interceptor_list_.destroy_interceptors (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ delete this;
+}
+
+void
+TAO_IORInterceptor_Adapter_Impl::establish_components (
+ TAO_Root_POA* poa
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ const size_t interceptor_count = this->ior_interceptor_list_.size ();
+
+ if (interceptor_count == 0)
+ return;
+
+ TAO_IORInfo *tao_info = 0;
+ ACE_NEW_THROW_EX (tao_info,
+ TAO_IORInfo (poa),
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_CHECK;
+
+ PortableInterceptor::IORInfo_var info = tao_info;
+
+ // Release the POA during IORInterceptor calls to avoid potential
+ // deadlocks.
+ TAO::Portable_Server::Non_Servant_Upcall non_servant_upcall (*poa);
+ ACE_UNUSED_ARG (non_servant_upcall);
+
+ for (size_t i = 0; i < interceptor_count; ++i)
+ {
+ ACE_TRY
+ {
+ this->ior_interceptor_list_.interceptor (i)->establish_components (
+ info.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ // According to the Portable Interceptors specification,
+ // IORInterceptor::establish_components() must not throw an
+ // exception. If it does, then the ORB is supposed to
+ // ignore it and continue processing the remaining
+ // IORInterceptors.
+ if (TAO_debug_level > 1)
+ {
+ CORBA::String_var name =
+ this->ior_interceptor_list_.interceptor (i)->name (
+ ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ // @@ What do we do if we get an exception here?
+
+ if (name.in () != 0)
+ {
+ ACE_DEBUG ((LM_WARNING,
+ "(%P|%t) Exception thrown while processing "
+ "IORInterceptor \"%s\">\n",
+ ACE_TEXT_CHAR_TO_TCHAR (name.in ())));
+ }
+
+ ACE_PRINT_TAO_EXCEPTION (ACE_ANY_EXCEPTION,
+ "Ignoring exception in "
+ "IORInterceptor::establish_components");
+ }
+ }
+ ACE_ENDTRY;
+ ACE_CHECK;
+ }
+
+ tao_info->components_established ();
+
+ this->components_established (info.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // The IORInfo instance is no longer valid. Invalidate it to
+ // prevent the user from peforming "illegal" operations.
+ tao_info->invalidate ();
+}
+
+void
+TAO_IORInterceptor_Adapter_Impl::components_established (
+ PortableInterceptor::IORInfo_ptr info
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ // Iterate over the registered IOR interceptors so that they may be
+ // given the opportunity to add tagged components to the profiles
+ // for this servant.
+ const size_t interceptor_count = this->ior_interceptor_list_.size ();
+
+ // All the establish_components() interception points have been
+ // invoked. Now call the components_established() interception point
+ // on all the IORInterceptors.
+ for (size_t j = 0; j < interceptor_count; ++j)
+ {
+ ACE_TRY
+ {
+ PortableInterceptor::IORInterceptor_ptr ior_interceptor =
+ this->ior_interceptor_list_.interceptor (j);
+
+ PortableInterceptor::IORInterceptor_3_0_var ior_3_interceptor =
+ PortableInterceptor::IORInterceptor_3_0::_narrow (ior_interceptor);
+ if (!CORBA::is_nil (ior_3_interceptor.in ()))
+ {
+ ior_3_interceptor->components_established (
+ info
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ }
+ ACE_CATCHANY
+ {
+ ACE_THROW (CORBA::OBJ_ADAPTER (CORBA::OMGVMCID | 6,
+ CORBA::COMPLETED_NO));
+ }
+ ACE_ENDTRY;
+ ACE_CHECK;
+ }
+}
+
+void
+TAO_IORInterceptor_Adapter_Impl::adapter_state_changed (
+ const TAO::ObjectReferenceTemplate_Array &array_obj_ref_template,
+ PortableInterceptor::AdapterState state
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ const size_t interceptor_count = this->ior_interceptor_list_.size ();
+
+ if (interceptor_count == 0)
+ return;
+
+ PortableInterceptor::ObjectReferenceTemplateSeq seq_obj_ref_template;
+
+ seq_obj_ref_template.length (
+ static_cast <CORBA::ULong> (array_obj_ref_template.size()));
+
+ for (size_t counter = 0; counter < array_obj_ref_template.size(); ++counter)
+ {
+ PortableInterceptor::ObjectReferenceTemplate *member =
+ array_obj_ref_template[counter];
+
+ CORBA::add_ref (member);
+
+ seq_obj_ref_template[counter] = member;
+ }
+
+ for (size_t i = 0; i < interceptor_count; ++i)
+ {
+ PortableInterceptor::IORInterceptor_ptr ior_interceptor =
+ this->ior_interceptor_list_.interceptor (i);
+
+ PortableInterceptor::IORInterceptor_3_0_var ior_3_interceptor =
+ PortableInterceptor::IORInterceptor_3_0::_narrow (ior_interceptor);
+ if (!CORBA::is_nil (ior_3_interceptor.in ()))
+ {
+ ior_3_interceptor->adapter_state_changed (
+ seq_obj_ref_template,
+ state
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ }
+}
+
+void
+TAO_IORInterceptor_Adapter_Impl::adapter_manager_state_changed (
+ const char * id,
+ PortableInterceptor::AdapterState state
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ /// Whenever the POAManager state is changed, the
+ /// adapter_manager_state_changed method is to be invoked on all the IOR
+ /// Interceptors.
+ const size_t interceptor_count = this->ior_interceptor_list_.size ();
+
+ if (interceptor_count == 0)
+ return;
+
+ for (size_t i = 0; i < interceptor_count; ++i)
+ {
+ PortableInterceptor::IORInterceptor_ptr ior_interceptor =
+ this->ior_interceptor_list_.interceptor (i);
+
+ PortableInterceptor::IORInterceptor_3_0_var ior_3_interceptor =
+ PortableInterceptor::IORInterceptor_3_0::_narrow (ior_interceptor);
+ if (!CORBA::is_nil (ior_3_interceptor.in ()))
+ {
+ ior_3_interceptor->adapter_manager_state_changed (
+ id,
+ state
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/IORInterceptor/IORInterceptor_Adapter_Impl.h b/TAO/tao/IORInterceptor/IORInterceptor_Adapter_Impl.h
new file mode 100644
index 00000000000..5dc289f77d8
--- /dev/null
+++ b/TAO/tao/IORInterceptor/IORInterceptor_Adapter_Impl.h
@@ -0,0 +1,97 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file IORInterceptor_Adapter_Impl.h
+ *
+ * $Id$
+ *
+ * @author Jeff Parsons <parsons@cs.wustl.edu>
+ */
+//=============================================================================
+
+
+#ifndef TAO_IORINTERCEPTOR_ADAPTER_IMPL_H
+#define TAO_IORINTERCEPTOR_ADAPTER_IMPL_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/IORInterceptor/iorinterceptor_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/IORInterceptor/IORInterceptor.h"
+#include "tao/IORInterceptor_Adapter.h"
+#include "tao/PI/Interceptor_List_T.h"
+#include "tao/IORInterceptor/IORInterceptor_Details.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ typedef Interceptor_List< ::PortableInterceptor::IORInterceptor,
+ IORInterceptor_Details>
+ IORInterceptor_List;
+}
+
+class TAO_Root_POA;
+
+/**
+ * @class TAO_IORInterceptor_Adapter_Impl
+ *
+ * @brief TAO_IORInterceptor_Adapter_Impl.
+ *
+ * Class that adapts various functions involving the PortableInterceptor
+ * interfaces IORInfo and IORInterceptor. This is the derived class
+ * that contains the actual implementations.
+ */
+class TAO_IORInterceptor_Adapter_Impl
+ : public TAO_IORInterceptor_Adapter
+{
+public:
+ virtual ~TAO_IORInterceptor_Adapter_Impl (void);
+
+ virtual void add_interceptor (
+ PortableInterceptor::IORInterceptor_ptr interceptor
+ ACE_ENV_ARG_DECL);
+
+ virtual void add_interceptor (
+ PortableInterceptor::IORInterceptor_ptr interceptor,
+ const CORBA::PolicyList& policies
+ ACE_ENV_ARG_DECL);
+
+ virtual void destroy_interceptors (ACE_ENV_SINGLE_ARG_DECL);
+
+ virtual void establish_components (TAO_Root_POA *poa ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Call the IORInterceptor::components_established() method on all
+ /// registered IORInterceptors.
+ virtual void components_established (PortableInterceptor::IORInfo_ptr info
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual void adapter_state_changed (
+ const TAO::ObjectReferenceTemplate_Array &array_obj_ref_template,
+ PortableInterceptor::AdapterState state
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual void adapter_manager_state_changed (
+ const char * id,
+ PortableInterceptor::AdapterState state
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+private:
+ /// List of IOR interceptors maintained
+ TAO::IORInterceptor_List ior_interceptor_list_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_IORINTERCEPTOR_ADAPTER_IMPL_H */
diff --git a/TAO/tao/IORInterceptor/IORInterceptor_Details.cpp b/TAO/tao/IORInterceptor/IORInterceptor_Details.cpp
new file mode 100644
index 00000000000..77835d4cfd0
--- /dev/null
+++ b/TAO/tao/IORInterceptor/IORInterceptor_Details.cpp
@@ -0,0 +1,23 @@
+#include "tao/IORInterceptor/IORInterceptor_Details.h"
+
+ACE_RCSID (IORInterceptor,
+ IORInterceptor_Details,
+ "$Id$")
+
+#include "tao/SystemException.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ void
+ IORInterceptor_Details::apply_policies (
+ const CORBA::PolicyList &/*policies*/
+ ACE_ENV_ARG_DECL)
+ {
+ // There are currently no policies that apply to IOR Interceptors.
+ ACE_THROW (CORBA::INV_POLICY ());
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/IORInterceptor/IORInterceptor_Details.h b/TAO/tao/IORInterceptor/IORInterceptor_Details.h
new file mode 100644
index 00000000000..bb2ce8b0fa8
--- /dev/null
+++ b/TAO/tao/IORInterceptor/IORInterceptor_Details.h
@@ -0,0 +1,63 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file IORInterceptor_Details.h
+ *
+ * $Id$
+ *
+ * This file declares a class that manages the details
+ * about a registered client request interceptor. Policies can be
+ * used when interceptors are registered, and the policy values
+ * will be processed and used to modify the values of the
+ * IORInterceptor_Details object associated with the registered
+ * client request interceptor.
+ *
+ * @author Tim Bradley <bradley_t@ociweb.com>
+ */
+//=============================================================================
+
+#ifndef TAO_IOR_INTERCEPTOR_DETAILS_H
+#define TAO_IOR_INTERCEPTOR_DETAILS_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Policy_ForwardC.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ /**
+ * @class IORInterceptor_Details
+ *
+ * @brief The policy-driven details for a registered IOR interceptor
+ *
+ * Each time an IOR interceptor is registered with an ORB, an
+ * IORInterceptor_Details object will be created and associated with
+ * the registered IOR interceptor. If the interceptor is
+ * registered with policies, the policies will be used to adjust the
+ * values in the IORInterceptor_Details appropriately.
+ *
+ * Currently, there are no policies that are applicable to
+ * IOR Interceptors.
+ */
+ class IORInterceptor_Details
+ {
+ public:
+ void apply_policies (const CORBA::PolicyList& policies
+ ACE_ENV_ARG_DECL);
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_IOR_INTERCEPTOR_DETAILS_H */
diff --git a/TAO/tao/IORInterceptor/TAO_IORInterceptor.pc.in b/TAO/tao/IORInterceptor/TAO_IORInterceptor.pc.in
new file mode 100644
index 00000000000..95d2ae883cb
--- /dev/null
+++ b/TAO/tao/IORInterceptor/TAO_IORInterceptor.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: TAO_IORInterceptor
+Description: TAO IOR Interceptor Library
+Requires: TAO_PI, TAO_CodecFactory, TAO_ObjRefTemplate, TAO_Valuetype, TAO_PortableServer, TAO_AnyTypeCode, TAO
+Version: @VERSION@
+Libs: -L${libdir} -lTAO_IORInterceptor
+Cflags: -I${includedir}
diff --git a/TAO/tao/IORInterceptor/TAO_IORInterceptor.rc b/TAO/tao/IORInterceptor/TAO_IORInterceptor.rc
new file mode 100644
index 00000000000..6ce65995cb2
--- /dev/null
+++ b/TAO/tao/IORInterceptor/TAO_IORInterceptor.rc
@@ -0,0 +1,30 @@
+#include "..\Version.h"
+
+1 VERSIONINFO
+ FILEVERSION TAO_MAJOR_VERSION,TAO_MINOR_VERSION,TAO_BETA_VERSION,0
+ PRODUCTVERSION TAO_MAJOR_VERSION,TAO_MINOR_VERSION,TAO_BETA_VERSION,0
+ FILEFLAGSMASK 0x3fL
+ FILEFLAGS 0x0L
+ FILEOS 0x4L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904B0"
+ BEGIN
+ VALUE "FileDescription", "IORInterceptor\0"
+ VALUE "FileVersion", TAO_VERSION "\0"
+ VALUE "InternalName", "TAO_IORInterceptorDLL\0"
+ VALUE "LegalCopyright", "\0"
+ VALUE "LegalTrademarks", "\0"
+ VALUE "OriginalFilename", "TAO_IORInterceptor.DLL\0"
+ VALUE "ProductName", "TAO\0"
+ VALUE "ProductVersion", TAO_VERSION "\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
diff --git a/TAO/tao/IORInterceptor/iorinterceptor_export.h b/TAO/tao/IORInterceptor/iorinterceptor_export.h
new file mode 100644
index 00000000000..4c6180c412a
--- /dev/null
+++ b/TAO/tao/IORInterceptor/iorinterceptor_export.h
@@ -0,0 +1,40 @@
+
+// -*- C++ -*-
+// $Id$
+// Definition for Win32 Export directives.
+// This file is generated automatically by generate_export_file.pl
+// ------------------------------
+#ifndef TAO_IORINTERCEPTOR_EXPORT_H
+#define TAO_IORINTERCEPTOR_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if defined (TAO_AS_STATIC_LIBS)
+# if !defined (TAO_IORINTERCEPTOR_HAS_DLL)
+# define TAO_IORINTERCEPTOR_HAS_DLL 0
+# endif /* ! TAO_IORINTERCEPTOR_HAS_DLL */
+#else
+# if !defined (TAO_IORINTERCEPTOR_HAS_DLL)
+# define TAO_IORINTERCEPTOR_HAS_DLL 1
+# endif /* ! TAO_IORINTERCEPTOR_HAS_DLL */
+#endif
+
+#if defined (TAO_IORINTERCEPTOR_HAS_DLL) && (TAO_IORINTERCEPTOR_HAS_DLL == 1)
+# if defined (TAO_IORINTERCEPTOR_BUILD_DLL)
+# define TAO_IORInterceptor_Export ACE_Proper_Export_Flag
+# define TAO_IORINTERCEPTOR_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# define TAO_IORINTERCEPTOR_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# else /* TAO_IORINTERCEPTOR_BUILD_DLL */
+# define TAO_IORInterceptor_Export ACE_Proper_Import_Flag
+# define TAO_IORINTERCEPTOR_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# define TAO_IORINTERCEPTOR_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# endif /* TAO_IORINTERCEPTOR_BUILD_DLL */
+#else /* TAO_IORINTERCEPTOR_HAS_DLL == 1 */
+# define TAO_IORInterceptor_Export
+# define TAO_IORINTERCEPTOR_SINGLETON_DECLARATION(T)
+# define TAO_IORINTERCEPTOR_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+#endif /* TAO_IORINTERCEPTOR_HAS_DLL == 1 */
+
+#endif /* TAO_IORINTERCEPTOR_EXPORT_H */
+
+// End of auto generated file.
diff --git a/TAO/tao/IORInterceptor_Adapter.cpp b/TAO/tao/IORInterceptor_Adapter.cpp
new file mode 100644
index 00000000000..7759e6793f3
--- /dev/null
+++ b/TAO/tao/IORInterceptor_Adapter.cpp
@@ -0,0 +1,15 @@
+// $Id$
+
+#include "tao/IORInterceptor_Adapter.h"
+
+ACE_RCSID (tao,
+ IORInterceptor_Adapter,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_IORInterceptor_Adapter::~TAO_IORInterceptor_Adapter (void)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/IORInterceptor_Adapter.h b/TAO/tao/IORInterceptor_Adapter.h
new file mode 100644
index 00000000000..d62550f6fbb
--- /dev/null
+++ b/TAO/tao/IORInterceptor_Adapter.h
@@ -0,0 +1,114 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file IORInterceptor_Adapter.h
+ *
+ * $Id$
+ *
+ * @author Jeff Parsons <parsons@cs.wustl.edu>
+ */
+//=============================================================================
+
+
+#ifndef TAO_IORINTERCEPTOR_ADAPTER_H
+#define TAO_IORINTERCEPTOR_ADAPTER_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/TAO_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/SystemException.h"
+#include "tao/PI_ForwardC.h"
+#include "tao/Policy_ForwardC.h"
+
+ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+template <class T> class ACE_Array_Base;
+ACE_END_VERSIONED_NAMESPACE_DECL
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace PortableInterceptor
+{
+ class IORInterceptor;
+ typedef IORInterceptor *IORInterceptor_ptr;
+ class IORInfo;
+ typedef IORInfo *IORInfo_ptr;
+ class ObjectReferenceTemplate;
+}
+
+namespace TAO
+{
+ typedef ACE_Array_Base< ::PortableInterceptor::ObjectReferenceTemplate*>
+ ObjectReferenceTemplate_Array;
+}
+
+class TAO_Root_POA;
+
+/**
+ * @class TAO_IORInterceptor_Adapter
+ *
+ * @brief TAO_IORInterceptor_Adapter.
+ *
+ * Class that adapts various functions involving the PortableInterceptor
+ * interfaces IORInfo and IORInterceptor. This is a base class for
+ * the actual implementation in the TAO_IORInterceptor library.
+ */
+class TAO_Export TAO_IORInterceptor_Adapter
+{
+public:
+ virtual ~TAO_IORInterceptor_Adapter (void);
+
+ virtual void add_interceptor (
+ PortableInterceptor::IORInterceptor_ptr interceptor
+ ACE_ENV_ARG_DECL
+ ) = 0;
+
+ virtual void add_interceptor (
+ PortableInterceptor::IORInterceptor_ptr interceptor,
+ const CORBA::PolicyList& policies
+ ACE_ENV_ARG_DECL
+ ) = 0;
+
+ virtual void destroy_interceptors (
+ ACE_ENV_SINGLE_ARG_DECL
+ ) = 0;
+
+ /// Call the IORInterceptor::establish_components() method on all
+ /// registered IORInterceptors.
+ /**
+ * This method calls IORInterceptor::establish_components() method
+ * on all registered IORInterceptors, and
+ * IORInterceptor::components_established() once the former is
+ * completed.
+ */
+ virtual void establish_components (TAO_Root_POA *poa ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException)) = 0;
+
+ /// Call the IORInterceptor::components_established() method on all
+ /// registered IORInterceptors.
+ virtual void components_established (PortableInterceptor::IORInfo_ptr info
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException)) = 0;
+
+ virtual void adapter_state_changed (
+ const TAO::ObjectReferenceTemplate_Array &array_obj_ref_template,
+ PortableInterceptor::AdapterState state
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException)) = 0;
+
+ virtual void adapter_manager_state_changed (
+ const char * id,
+ PortableInterceptor::AdapterState state
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException)) = 0;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_IORINTERCEPTOR_ADAPTER_H */
diff --git a/TAO/tao/IORInterceptor_Adapter_Factory.cpp b/TAO/tao/IORInterceptor_Adapter_Factory.cpp
new file mode 100644
index 00000000000..083299eeb96
--- /dev/null
+++ b/TAO/tao/IORInterceptor_Adapter_Factory.cpp
@@ -0,0 +1,14 @@
+// $Id$
+#include "tao/IORInterceptor_Adapter_Factory.h"
+
+ACE_RCSID (tao,
+ IORInterceptor_Adapter_Factory,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_IORInterceptor_Adapter_Factory::~TAO_IORInterceptor_Adapter_Factory (void)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/IORInterceptor_Adapter_Factory.h b/TAO/tao/IORInterceptor_Adapter_Factory.h
new file mode 100644
index 00000000000..ebb5561ee76
--- /dev/null
+++ b/TAO/tao/IORInterceptor_Adapter_Factory.h
@@ -0,0 +1,55 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file IORInterceptor_Adapter_Factory.h
+ *
+ * $Id$
+ *
+ * @author George Edwards <g.edwards@vanderbilt.edu>
+ */
+//=============================================================================
+
+
+#ifndef TAO_IORINTERCEPTOR_ADAPTER_FACTORY_H
+#define TAO_IORINTERCEPTOR_ADAPTER_FACTORY_H
+
+#include /**/ "ace/pre.h"
+#include "ace/Service_Object.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/SystemException.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_IORInterceptor_Adapter;
+
+/**
+ * @class TAO_IORInterceptor_Adapter_Factory
+ *
+ * @brief TAO_IORInterceptor_Adapter_Factory.
+ *
+ * Class that creates one instance of TAO_IOR_Interceptor_Adapter per
+ * ORB on the ORB's first usage of its ior_interceptor_adapter_. This is a base
+ * class for the actual implementation in the TAO_IORInterceptor library.
+ */
+class TAO_Export TAO_IORInterceptor_Adapter_Factory
+ : public ACE_Service_Object
+{
+public:
+ virtual ~TAO_IORInterceptor_Adapter_Factory (void);
+
+ virtual TAO_IORInterceptor_Adapter * create (
+ ACE_ENV_SINGLE_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException)) = 0;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_IORINTERCEPTOR_ADAPTER_FACTORY_H */
diff --git a/TAO/tao/IORManipulation.mpc b/TAO/tao/IORManipulation.mpc
new file mode 100644
index 00000000000..407732dca57
--- /dev/null
+++ b/TAO/tao/IORManipulation.mpc
@@ -0,0 +1,45 @@
+//$Id$
+
+project : taolib, core, core_anytypecode, tao_versioning_idl_defaults {
+ sharedname = TAO_IORManip
+ dynamicflags = TAO_IORMANIP_BUILD_DLL
+
+ Source_Files {
+ IORManipulation
+ }
+
+ Header_Files {
+ IORManipulation
+ }
+
+ Inline_Files {
+ IORManipulation
+ }
+
+ Template_Files {
+ IORManipulation
+ }
+
+ Resource_Files {
+ IORManipulation
+ }
+
+ PIDL_Files {
+ IORManipulation
+ }
+
+ IDL_Files {
+ idlflags += -Gp -Gd -Ge 1 -Sci -SS -Sorb \
+ -Wb,export_macro=TAO_IORManip_Export \
+ -Wb,export_include=tao/IORManipulation/ior_manip_export.h \
+ -Wb,include_guard=TAO_IORMANIP_SAFE_INCLUDE \
+ -Wb,safe_include=tao/IORManipulation/IORManip_Loader.h \
+ -o IORManipulation
+ idlflags -= -Sa -St
+ IORManipulation/IOR.pidl
+ }
+
+ Pkgconfig_Files {
+ IORManipulation/TAO_IORManip.pc.in
+ }
+}
diff --git a/TAO/tao/IORManipulation/IOR.pidl b/TAO/tao/IORManipulation/IOR.pidl
new file mode 100644
index 00000000000..20b010c8406
--- /dev/null
+++ b/TAO/tao/IORManipulation/IOR.pidl
@@ -0,0 +1,201 @@
+/**
+ * @file IOR.pidl
+ *
+ * $Id$
+ *
+ * @brief Pre-compiled IDL source for the TAO_IOP namespace.
+ *
+ * This file was used to generate the code in IORC.{h,cpp}.
+ *
+ * To regenerate the code use:
+ *
+ * tao_idl \
+ * -o orig -Gp -Gd -Ge 1 -GA -Sci \
+ * -Wb,export_macro=TAO_IORManip_Export \
+ * -Wb,export_include="ior_manip_export.h" \
+ * -Wb,pre_include="ace/pre.h" \
+ * -Wb,post_include="ace/post.h" \
+ * IOR.pidl
+ *
+ */
+
+#ifndef TAO_IOR_PIDL
+#define TAO_IOR_PIDL
+
+module TAO_IOP
+{
+ /**
+ * @exception EmptyProfileList
+ *
+ * @brief @@ Bala, please describe this exception
+ */
+ exception EmptyProfileList {};
+
+ /**
+ * @exception NotFound
+ *
+ * @brief @@ Bala, please describe this exception
+ */
+ exception NotFound {};
+
+ /**
+ * @exception Duplicate
+ *
+ * @brief @@ Bala, please describe this exception
+ */
+ exception Duplicate {};
+
+ /**
+ * @exception Invalid_IOR
+ *
+ * @brief @@ Bala, please describe this exception
+ */
+ exception Invalid_IOR {};
+
+ /**
+ * @exception MultiProfileList
+ *
+ * @brief @@ Bala, please describe this exception
+ */
+ exception MultiProfileList {};
+
+ /**
+ * @interface TAO_IOR_Property
+ *
+ * Allows setting properties by the different services in the
+ * IOR. The implementations of this interface would reside in the
+ * services. This interface essentially performs a role of a
+ * callback object.
+ *
+ * @todo This interface seems redundant in the face of the
+ * PortableInterceptor::IORInterceptor and the
+ * ObjectReferenceTemplate. If that is the case we should deprecate
+ * it and remove it.
+ */
+ local interface TAO_IOR_Property
+ {
+ /// Operation that would set the required properties in the <ior>
+ /// as needed by the service.
+ boolean set_property (inout Object ior)
+ raises (Invalid_IOR);
+
+ /// Sets the profile ior1, in the profile ior2 to be a
+ /// primary.
+ boolean set_primary (inout Object ior1,
+ in Object ior2)
+ raises (Duplicate, NotFound);
+
+ /// Returns the ior of the primary from <ior> if it has been
+ /// set. Else returns a NotFound exception
+ Object get_primary (in Object ior)
+ raises (NotFound);
+
+ /// Returns a true or false depending on whether a primary member
+ /// has been set in <ior>
+ boolean is_primary_set (in Object ior);
+
+ /// If any of the IOR's within the IOGR has a primary tag, just
+ /// remove it. Returns zero if no primary was found.
+ boolean remove_primary_tag (inout Object iogr)
+ raises (NotFound);
+ };
+
+ /**
+ * @interface TAO_IOR_Manipulation
+ *
+ * @brief Allows applications to manipulate object references.
+ *
+ * Manipulating Object References. While this interface does not
+ * assume the use of CORBA complient IOPs, the IOP termonology is
+ * used throughout.
+ * Object references (Object) are used since they encapsulate the
+ * notion of object references and IORs.
+ * Note, an IOR contains one or more profiles and a profile can be
+ * considered to represent the location or route to a specific instance
+ * of an object.
+ * A profile may also contain supplimentary information useful for
+ * differrent services such as security.
+ * All Object references may have multiple profiles
+ */
+ local interface TAO_IOR_Manipulation
+ {
+ typedef sequence <Object> IORList;
+
+ Object merge_iors (in IORList iors)
+ raises (EmptyProfileList,Duplicate,Invalid_IOR);
+ // Create a new object reference by merging the profiles lists in the
+ // supplied list of one or more object references.
+
+ Object add_profiles (in Object ior1,
+ in Object ior2)
+ raises (EmptyProfileList, Duplicate, Invalid_IOR);
+ // copy the profile list from "ior2" to "ior1".
+ // Note on ordering, while the current implementation will place
+ // the profiles from ior2 (which are not already in ior1) on the
+ // end of the profile list in ior1, there is no guarantee this ordering
+ // will be maintained. For example, string_to_object or object_to_string
+ // may reorder the profile lists. So, if it is important to use one
+ // profile before another then policies should be used along with tagged
+ // components/tagged profiles.
+
+ Object remove_profiles (in Object ior1,
+ in Object ior2)
+ raises (Invalid_IOR, EmptyProfileList, NotFound);
+ // Any profile in ior1 which matches at least one profile in ior2
+ // will be removed. Returns a new object reference
+
+
+ boolean set_property (in TAO_IOR_Property prop,
+ in Object ior)
+ raises (Invalid_IOR, Duplicate);
+ // Allows setting of properties as defined by the <prop> object
+ // in the <ior> list
+
+ // @@ Primary is specific to FT.. But let us have these
+ // @@ operations around. Further, as we pass the property object
+ // @@ around the implementation will not be tied with the FT
+ // @@ service. Any service can use their own ways of defining a
+ // @@ primary. For example FT service uses IOP::TAG_FT_PRIMARY
+ // @@ to identify a primary and some other service could use
+ // @@ something else. But the actual implementation of the
+ // @@ property object would take care of that.
+ boolean set_primary (in TAO_IOR_Property prop,
+ in Object ior1,
+ in Object ior2)
+ raises (Invalid_IOR, Duplicate, MultiProfileList, NotFound);
+ // Sets the profile ior1, in the profile ior2 to be a
+ // primary. If ior1 is a multi-profile IOR then the operation
+ // raises the MultiProfileList exception. If ior1 is not found
+ // in ior2, it raises an Invalid_IOR exception. If ior2 has a
+ // primary already defined then it raises a Duplicate
+ // exception.
+
+ /// If any of the IOR's within the IOGR has a primary tag, just remove
+ /// it. Return zero if no primary found.
+ boolean remove_primary_tag (in TAO_IOR_Property prop,
+ in Object ior);
+
+
+ Object get_primary (in TAO_IOR_Property prop,
+ in Object ior)
+ raises (NotFound);
+ // Returns the ior of the primary from <ior> if it has been
+ // set. Else returns a NotFound exception
+
+ boolean is_primary_set (in TAO_IOR_Property prop,
+ in Object ior);
+ // Returns a true or false depending on whether a primary member
+ // has been set in <ior>
+
+ unsigned long is_in_ior(in Object ior1, in Object ior2)
+ raises (NotFound);
+ // returns number of profiles which are in both ior1 and ior2.
+
+ unsigned long get_profile_count (in Object ior)
+ raises (EmptyProfileList);
+ // This will return the number of profiles contained in the
+ // corresponding object reference for this object.
+ };
+};
+
+#endif /* TAO_IOR_PIDL */
diff --git a/TAO/tao/IORManipulation/IORA.h b/TAO/tao/IORManipulation/IORA.h
new file mode 100644
index 00000000000..c944d806c1f
--- /dev/null
+++ b/TAO/tao/IORManipulation/IORA.h
@@ -0,0 +1,27 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
diff --git a/TAO/tao/IORManipulation/IORManip_Loader.cpp b/TAO/tao/IORManipulation/IORManip_Loader.cpp
new file mode 100644
index 00000000000..eceb6b0b06b
--- /dev/null
+++ b/TAO/tao/IORManipulation/IORManip_Loader.cpp
@@ -0,0 +1,46 @@
+#include "tao/IORManipulation/IORManip_Loader.h"
+#include "tao/IORManipulation/IORManipulation.h"
+
+#include "ace/Log_Msg.h"
+
+
+ACE_RCSID (IORManipulation,
+ IORManip_Loader,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_IORManip_Loader::TAO_IORManip_Loader (void)
+{
+}
+
+CORBA::Object_ptr
+TAO_IORManip_Loader::create_object (CORBA::ORB_ptr,
+ int,
+ ACE_TCHAR *[]
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ CORBA::Object_ptr obj;
+ ACE_NEW_RETURN (obj,
+ TAO_IOR_Manipulation_impl,
+ CORBA::Object::_nil ());
+ return obj;
+}
+
+int
+TAO_IORManip_Loader::Initializer (void)
+{
+ return ACE_Service_Config::process_directive (ace_svc_desc_TAO_IORManip_Loader);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DEFINE (TAO_IORManip_Loader,
+ ACE_TEXT ("IORManip_Loader"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (TAO_IORManip_Loader),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0)
+ACE_FACTORY_DEFINE (TAO_IORManip, TAO_IORManip_Loader)
diff --git a/TAO/tao/IORManipulation/IORManip_Loader.h b/TAO/tao/IORManipulation/IORManip_Loader.h
new file mode 100644
index 00000000000..fc45a394fae
--- /dev/null
+++ b/TAO/tao/IORManipulation/IORManip_Loader.h
@@ -0,0 +1,62 @@
+// -*- C++ -*-
+
+// $Id$
+
+// =========================================================================
+//
+// = LIBRARY
+// TAO
+//
+// = FILENAME
+// DynamicAny.h
+//
+// = AUTHOR
+// Carlos O'Ryan <coryan@uci.edu>
+//
+// =========================================================================
+
+#ifndef TAO_IORMANIP_LOADER_H
+#define TAO_IORMANIP_LOADER_H
+#include /**/ "ace/pre.h"
+
+#include "tao/IORManipulation/ior_manip_export.h"
+#include "tao/Object_Loader.h"
+#include "ace/Service_Config.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_IORManip_Export TAO_IORManip_Loader : public TAO_Object_Loader
+{
+public:
+ /// Constructor
+ TAO_IORManip_Loader (void);
+
+ /// Creates a IORManip factory and returns it.
+ virtual CORBA::Object_ptr create_object (CORBA::ORB_ptr orb,
+ int argc,
+ ACE_TCHAR *argv []
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Used to force the initialization of the ORB code.
+ static int Initializer (void);
+};
+
+static int
+TAO_Requires_IORManip_Initializer = TAO_IORManip_Loader::Initializer ();
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE (TAO_IORManip_Loader)
+ACE_FACTORY_DECLARE (TAO_IORManip, TAO_IORManip_Loader)
+
+#define TAO_IORMANIP_SAFE_INCLUDE
+#include "tao/IORManipulation/IORC.h"
+#undef TAO_IORMANIP_SAFE_INCLUDE
+
+#include /**/ "ace/post.h"
+#endif /* TAO_IORManip_H */
diff --git a/TAO/tao/IORManipulation/IORManipulation.cpp b/TAO/tao/IORManipulation/IORManipulation.cpp
new file mode 100644
index 00000000000..dcc9217a1fb
--- /dev/null
+++ b/TAO/tao/IORManipulation/IORManipulation.cpp
@@ -0,0 +1,382 @@
+#include "tao/IORManipulation/IORManipulation.h"
+
+#include "tao/MProfile.h"
+#include "tao/Profile.h"
+#include "tao/Stub.h"
+#include "tao/ORB_Core.h"
+
+#include "ace/Auto_Ptr.h"
+#include "ace/OS_NS_string.h"
+
+
+ACE_RCSID (IORManipulation,
+ IORManipulation,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_IOR_Manipulation_impl::TAO_IOR_Manipulation_impl (void)
+{
+}
+
+TAO_IOR_Manipulation_impl::~TAO_IOR_Manipulation_impl (void)
+{
+}
+
+CORBA::Object_ptr
+TAO_IOR_Manipulation_impl::merge_iors (
+ const TAO_IOP::TAO_IOR_Manipulation::IORList & iors
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ TAO_IOP::EmptyProfileList,
+ TAO_IOP::Duplicate,
+ TAO_IOP::Invalid_IOR))
+{
+ // we need to create a new CORBA::Object which has the union of the
+ // two profile lists. However, if any profiles are duplicates (i.e. in
+ // bott lisis) then an exception is raised.
+
+ // Deterinine how many profiles we have
+ // Get an estimate of the size - pfile count could change since we
+ // neither lock nor get a copy in this loop.
+ CORBA::ULong i, count=0;
+ for (i = 0; i < iors.length (); i++)
+ {
+ count += iors[i]->_stubobj ()->base_profiles ().profile_count ();
+ }
+
+ // make sure we have some profiles
+ if (count == 0)
+ ACE_THROW_RETURN (TAO_IOP::EmptyProfileList (),
+ CORBA::Object::_nil ());
+
+ // initialize with estimated pfile count.
+ TAO_MProfile Merged_Profiles (count);
+
+ // get the profile lists, start by initialize the composite reference
+ // by using the first Object. Then for each subsequent Object verify
+ // they are the same type and they do not have duplicate profiles.
+ auto_ptr<TAO_MProfile> tmp_pfiles (iors[0]->_stubobj ()->make_profiles ());
+ if (Merged_Profiles.add_profiles (tmp_pfiles.get ())< 0)
+ ACE_THROW_RETURN (TAO_IOP::Invalid_IOR (),
+ CORBA::Object::_nil ());
+ CORBA::String_var id =
+ CORBA::string_dup (iors[0]->_stubobj ()->type_id.in ());
+
+ for (i = 1; i < iors.length () ; i++)
+ {
+ // this gets a copy of the MProfile, hense the auto_ptr;
+
+ ACE_AUTO_PTR_RESET (tmp_pfiles,
+ iors[i]->_stubobj ()->make_profiles (),
+ TAO_MProfile);
+
+ // check to see if any of the profile in tmp_pfiles are already
+ // in Merged_Profiles. If so raise exception.
+ if (Merged_Profiles.is_equivalent (tmp_pfiles.get ()))
+ ACE_THROW_RETURN (TAO_IOP::Duplicate (),
+ CORBA::Object::_nil ());
+
+ // If the object type_id's differ then raise an exception.
+ if (id.in () && iors[i]->_stubobj ()->type_id.in () &&
+ ACE_OS::strcmp (id.in (), iors[i]->_stubobj ()->type_id.in ()))
+ ACE_THROW_RETURN (TAO_IOP::Invalid_IOR (),
+ CORBA::Object::_nil ());
+
+ // append profiles
+ if (Merged_Profiles.add_profiles (tmp_pfiles.get ()) < 0)
+ ACE_THROW_RETURN (TAO_IOP::Invalid_IOR (),
+ CORBA::Object::_nil ());
+
+ }
+
+ // MS C++ knows nothing about reset!
+ // tmp_pfiles.reset (0); // get rid of last MProfile
+
+ TAO_ORB_Core *orb_core = TAO_ORB_Core_instance ();
+
+ TAO_Stub *stub = orb_core->create_stub (id.in (), // give the id string
+ Merged_Profiles
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Object::_nil ());
+
+ // Make the stub memory allocation exception safe for the duration
+ // of this method.
+ TAO_Stub_Auto_Ptr safe_stub (stub);
+
+ // Create the CORBA level proxy
+ CORBA::Object_ptr temp_obj = CORBA::Object::_nil ();
+ ACE_NEW_THROW_EX (temp_obj,
+ CORBA::Object (safe_stub.get ()),
+ CORBA::NO_MEMORY ());
+
+ CORBA::Object_var new_obj = temp_obj;
+
+ ACE_CHECK_RETURN (CORBA::Object::_nil ());
+
+ // Clean up in case of errors.
+ if (CORBA::is_nil (new_obj.in ()))
+ {
+ ACE_THROW_RETURN (TAO_IOP::Invalid_IOR (),
+ CORBA::Object::_nil ());
+ }
+
+ // Release ownership of the pointers protected by the auto_ptrs since they
+ // no longer need to be protected by this point.
+ stub = safe_stub.release ();
+
+ return new_obj._retn ();
+}
+
+CORBA::Object_ptr
+TAO_IOR_Manipulation_impl::add_profiles (
+ CORBA::Object_ptr ior1,
+ CORBA::Object_ptr ior2
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ TAO_IOP::EmptyProfileList,
+ TAO_IOP::Duplicate,
+ TAO_IOP::Invalid_IOR))
+{
+
+ // Get an estimate of the number of profiles
+ CORBA::Object_ptr buffer [2];
+ buffer [0] = ior1;
+ buffer [1] = ior2;
+ TAO_IOP::TAO_IOR_Manipulation::IORList iors (2, 2, buffer, 0);
+ return this->merge_iors (iors ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::Object_ptr
+TAO_IOR_Manipulation_impl::remove_profiles (
+ CORBA::Object_ptr group,
+ CORBA::Object_ptr ior2
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ TAO_IOP::Invalid_IOR,
+ TAO_IOP::EmptyProfileList,
+ TAO_IOP::NotFound
+ ))
+{
+ // First verify they are the same type!
+ CORBA::String_var id =
+ CORBA::string_dup (group->_stubobj ()->type_id.in ());
+ if (id.in () && ior2->_stubobj ()->type_id.in () &&
+ ACE_OS::strcmp (id.in (), ior2->_stubobj ()->type_id.in ()))
+ ACE_THROW_RETURN (TAO_IOP::Invalid_IOR (),
+ CORBA::Object::_nil ());
+
+ // Since we are removing from group ...
+ CORBA::ULong count = group->_stubobj ()->base_profiles ().profile_count ();
+
+ // make sure we have some profiles
+ if (count == 0 ||
+ ior2->_stubobj ()->base_profiles ().profile_count () == 0)
+ ACE_THROW_RETURN (TAO_IOP::EmptyProfileList (),
+ CORBA::Object::_nil ());
+
+ // initialize with estimated pfile count.
+ TAO_MProfile Diff_Profiles (count);
+
+ auto_ptr<TAO_MProfile> tmp_pfiles (group->_stubobj ()->make_profiles ());
+ if (Diff_Profiles.add_profiles (tmp_pfiles.get ()) < 0)
+ ACE_THROW_RETURN (TAO_IOP::Invalid_IOR (),
+ CORBA::Object::_nil ());
+
+ // We are done with add_profiles.
+ // At this point, we don't do remove_profiles()
+ // immediately like before,
+ // because it could result in an
+ // Object Reference with 0 profile. And it would not pass
+ // the ::CORBA::is_nil() evaluation.
+ // Instead, we create the Object Reference right here, which is
+ // earlier than before.(Actually, I just moved some code
+ // from below up to here).
+ TAO_ORB_Core *orb_core = TAO_ORB_Core_instance ();
+
+ TAO_Stub *stub = orb_core->create_stub (id.in (), // give the id string
+ Diff_Profiles
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Object::_nil ());
+
+ // Make the stub memory allocation exception safe for the duration
+ // of this method.
+ TAO_Stub_Auto_Ptr safe_stub (stub);
+
+ // Create the CORBA level proxy
+ CORBA::Object_ptr temp_obj = CORBA::Object::_nil ();
+ ACE_NEW_THROW_EX (temp_obj,
+ CORBA::Object (safe_stub.get ()),
+ CORBA::NO_MEMORY ());
+
+ CORBA::Object_var new_obj = temp_obj;
+
+ // Exception safety is no longer an issue by this point so release
+ // the TAO_Stub from the TAO_Stub_Auto_Ptr.
+ stub = safe_stub.release ();
+
+ // Clean up in case of errors.
+ if (CORBA::is_nil (new_obj.in ()))
+ {
+ ACE_THROW_RETURN (TAO_IOP::Invalid_IOR (),
+ CORBA::Object::_nil ());
+ }
+
+ // Now we can remove the profiles which we want to elimitate from
+ // the Object.
+ ACE_AUTO_PTR_RESET (tmp_pfiles,
+ ior2->_stubobj ()->make_profiles (),
+ TAO_MProfile);
+
+ TAO_MProfile& mp = stub -> base_profiles();
+ if (mp.remove_profiles (tmp_pfiles.get ()) < 0)
+ ACE_THROW_RETURN (TAO_IOP::NotFound (),
+ CORBA::Object::_nil ());
+
+ // MS C++ knows nothing about reset!
+ // tmp_pfiles.reset (0); // get rid of last MProfile
+
+ return new_obj._retn ();
+}
+
+CORBA::Boolean
+TAO_IOR_Manipulation_impl::set_property (
+ TAO_IOP::TAO_IOR_Property_ptr prop,
+ CORBA::Object_ptr group
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ TAO_IOP::Invalid_IOR,
+ TAO_IOP::Duplicate))
+{
+ // make sure we have some profiles
+ if (group->_stubobj ()->base_profiles ().profile_count () == 0)
+ ACE_THROW_RETURN (TAO_IOP::Invalid_IOR (),
+ 0);
+
+ // Call the implementation object to
+ return prop->set_property (group
+ ACE_ENV_ARG_PARAMETER);
+}
+
+//@@ note awkward argument order
+CORBA::Boolean
+TAO_IOR_Manipulation_impl::set_primary (
+ TAO_IOP::TAO_IOR_Property_ptr prop,
+ CORBA::Object_ptr new_primary,
+ CORBA::Object_ptr group
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ TAO_IOP::Invalid_IOR,
+ TAO_IOP::Duplicate,
+ TAO_IOP::MultiProfileList))
+{
+ // make sure we have some profiles in GROUP
+ if (group->_stubobj ()->base_profiles ().profile_count () == 0)
+ ACE_THROW_RETURN (TAO_IOP::Invalid_IOR (),
+ 0);
+
+ // Make sure we have only one profile in new_primary
+ // @@ Will fail if the object has been
+ /*if (new_primary->_stubobj ()->base_profiles ().profile_count () > 1)
+ ACE_THROW_RETURN (TAO_IOP::MultiProfileList (),
+ 0);*/
+
+ // Call the callback object to do the rest of the processing.
+ return prop->set_primary (new_primary,
+ group
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::Object_ptr
+TAO_IOR_Manipulation_impl::get_primary (
+ TAO_IOP::TAO_IOR_Property_ptr prop,
+ CORBA::Object_ptr group
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ TAO_IOP::NotFound
+ ))
+{
+ // make sure we have some profiles in IOR
+ if (group->_stubobj ()->base_profiles ().profile_count () == 0)
+ ACE_THROW_RETURN (TAO_IOP::NotFound (), 0);
+ // @@ Bala: this was throwing TAO_IOP::Invalid_IOR, but it was not
+ // in the throw spec, that will result in a CORBA::UNKNOWN at
+ // run-time (if it does not crash). Any idea about what is going on
+ // here?
+
+ return prop->get_primary (group
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::Boolean
+TAO_IOR_Manipulation_impl::is_primary_set (
+ TAO_IOP::TAO_IOR_Property_ptr prop,
+ CORBA::Object_ptr group
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return prop->is_primary_set (group ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::Boolean
+TAO_IOR_Manipulation_impl:: remove_primary_tag (
+ TAO_IOP::TAO_IOR_Property_ptr prop,
+ CORBA::Object_ptr group
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return prop->remove_primary_tag (group ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::ULong
+TAO_IOR_Manipulation_impl::is_in_ior (
+ CORBA::Object_ptr ior1,
+ CORBA::Object_ptr ior2
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ TAO_IOP::NotFound))
+{
+ CORBA::ULong count = 0;
+ TAO_Profile *pfile1, *pfile2;
+ auto_ptr<TAO_MProfile> tmp_pfiles1 (ior1->_stubobj ()->make_profiles ());
+ auto_ptr<TAO_MProfile> tmp_pfiles2 (ior2->_stubobj ()->make_profiles ());
+
+ tmp_pfiles1->rewind ();
+ while ((pfile1 = tmp_pfiles1->get_next ()) > 0)
+ {
+ tmp_pfiles2->rewind ();
+ while ((pfile2 = tmp_pfiles2->get_next ()) > 0)
+ {
+ if (pfile1->is_equivalent (pfile2))
+ count++;
+ }
+ }
+
+ if (count == 0)
+ ACE_THROW_RETURN (TAO_IOP::NotFound (),
+ 0);
+
+ return count;
+}
+
+CORBA::ULong
+TAO_IOR_Manipulation_impl::get_profile_count (
+ CORBA::Object_ptr group
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ TAO_IOP::EmptyProfileList))
+{
+ CORBA::ULong count;
+ count = group->_stubobj ()->base_profiles ().profile_count ();
+
+ if (count == 0)
+ ACE_THROW_RETURN (TAO_IOP::EmptyProfileList (),
+ 0);
+
+ return count;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/IORManipulation/IORManipulation.h b/TAO/tao/IORManipulation/IORManipulation.h
new file mode 100644
index 00000000000..9ad320bc8d0
--- /dev/null
+++ b/TAO/tao/IORManipulation/IORManipulation.h
@@ -0,0 +1,172 @@
+// -*- C++ -*-
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO
+//
+// = FILENAME
+// IORManipulation.h
+//
+// = DESCRIPTION
+// This class implements IOR interface to the ORB
+//
+// = AUTHOR
+// Fred Kuhns <fredk@cs.wustl.edu>
+//
+// ============================================================================
+
+#ifndef TAO_IOR_MANIPULATION_H
+#define TAO_IOR_MANIPULATION_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/LocalObject.h"
+#include "tao/IORManipulation/IORManip_Loader.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/IORManipulation/IORC.h"
+
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_IOR_Manipulation_impl
+ : public TAO_IOP::TAO_IOR_Manipulation,
+ public TAO_Local_RefCounted_Object
+{
+ // = TITLE
+ // IOR Manipulation class
+ //
+ // = DESCRIPTION
+ //
+ //
+public:
+
+ TAO_IOR_Manipulation_impl (void);
+ // constructor
+
+ virtual CORBA::Object_ptr merge_iors (
+ const TAO_IOP::TAO_IOR_Manipulation::IORList & iors
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ TAO_IOP::EmptyProfileList,
+ TAO_IOP::Duplicate,
+ TAO_IOP::Invalid_IOR
+ ));
+
+ virtual CORBA::Object_ptr add_profiles (
+ CORBA::Object_ptr ior1,
+ CORBA::Object_ptr ior2
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ TAO_IOP::EmptyProfileList,
+ TAO_IOP::Duplicate,
+ TAO_IOP::Invalid_IOR
+ ));
+
+ virtual CORBA::Object_ptr remove_profiles (
+ CORBA::Object_ptr group,
+ CORBA::Object_ptr ior2
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ TAO_IOP::Invalid_IOR,
+ TAO_IOP::EmptyProfileList,
+ TAO_IOP::NotFound
+ ));
+
+ virtual CORBA::Boolean set_property (
+ TAO_IOP::TAO_IOR_Property_ptr prop,
+ CORBA::Object_ptr group
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ TAO_IOP::Invalid_IOR,
+ TAO_IOP::Duplicate
+ ));
+
+ // @@ note awkward argument order
+ virtual CORBA::Boolean set_primary (
+ TAO_IOP::TAO_IOR_Property_ptr prop,
+ CORBA::Object_ptr new_primary,
+ CORBA::Object_ptr group
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ TAO_IOP::Invalid_IOR,
+ TAO_IOP::Duplicate,
+ TAO_IOP::MultiProfileList
+ ));
+
+ virtual CORBA::Object_ptr get_primary (
+ TAO_IOP::TAO_IOR_Property_ptr prop,
+ CORBA::Object_ptr group
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ TAO_IOP::NotFound
+ ));
+
+ virtual CORBA::Boolean is_primary_set (
+ TAO_IOP::TAO_IOR_Property_ptr prop,
+ CORBA::Object_ptr group
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ virtual CORBA::Boolean remove_primary_tag (
+ TAO_IOP::TAO_IOR_Property_ptr prop,
+ CORBA::Object_ptr iogr
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ virtual CORBA::ULong is_in_ior (
+ CORBA::Object_ptr ior1,
+ CORBA::Object_ptr ior2
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ TAO_IOP::NotFound
+ ));
+
+ virtual CORBA::ULong get_profile_count (
+ CORBA::Object_ptr group
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ TAO_IOP::EmptyProfileList
+ ));
+
+protected:
+
+ ~TAO_IOR_Manipulation_impl (void);
+ // destructor
+
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_IOR_MANIPULATION_H */
diff --git a/TAO/tao/IORManipulation/TAO_IORManip.pc.in b/TAO/tao/IORManipulation/TAO_IORManip.pc.in
new file mode 100644
index 00000000000..a68bb9caad4
--- /dev/null
+++ b/TAO/tao/IORManipulation/TAO_IORManip.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: TAO_IORManip
+Description: TAO IOR Manipulation Library
+Requires: TAO_AnyTypeCode, TAO
+Version: @VERSION@
+Libs: -L${libdir} -lTAO_IORManip
+Cflags: -I${includedir}
diff --git a/TAO/tao/IORManipulation/TAO_IORManip.rc b/TAO/tao/IORManipulation/TAO_IORManip.rc
new file mode 100644
index 00000000000..9874dd6f19e
--- /dev/null
+++ b/TAO/tao/IORManipulation/TAO_IORManip.rc
@@ -0,0 +1,30 @@
+#include "..\Version.h"
+
+1 VERSIONINFO
+ FILEVERSION TAO_MAJOR_VERSION,TAO_MINOR_VERSION,TAO_BETA_VERSION,0
+ PRODUCTVERSION TAO_MAJOR_VERSION,TAO_MINOR_VERSION,TAO_BETA_VERSION,0
+ FILEFLAGSMASK 0x3fL
+ FILEFLAGS 0x0L
+ FILEOS 0x4L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904B0"
+ BEGIN
+ VALUE "FileDescription", "IORManip\0"
+ VALUE "FileVersion", TAO_VERSION "\0"
+ VALUE "InternalName", "TAO_IORManipDLL\0"
+ VALUE "LegalCopyright", "\0"
+ VALUE "LegalTrademarks", "\0"
+ VALUE "OriginalFilename", "TAO_IORManip.DLL\0"
+ VALUE "ProductName", "TAO\0"
+ VALUE "ProductVersion", TAO_VERSION "\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
diff --git a/TAO/tao/IORManipulation/ior_manip_export.h b/TAO/tao/IORManipulation/ior_manip_export.h
new file mode 100644
index 00000000000..0173c23bb58
--- /dev/null
+++ b/TAO/tao/IORManipulation/ior_manip_export.h
@@ -0,0 +1,40 @@
+
+// -*- C++ -*-
+// $Id$
+// Definition for Win32 Export directives.
+// This file is generated automatically by generate_export_file.pl
+// ------------------------------
+#ifndef TAO_IORMANIP_EXPORT_H
+#define TAO_IORMANIP_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if defined (TAO_AS_STATIC_LIBS)
+# if !defined (TAO_IORMANIP_HAS_DLL)
+# define TAO_IORMANIP_HAS_DLL 0
+# endif /* ! TAO_IORMANIP_HAS_DLL */
+#else
+# if !defined (TAO_IORMANIP_HAS_DLL)
+# define TAO_IORMANIP_HAS_DLL 1
+# endif /* ! TAO_IORMANIP_HAS_DLL */
+#endif
+
+#if defined (TAO_IORMANIP_HAS_DLL) && (TAO_IORMANIP_HAS_DLL == 1)
+# if defined (TAO_IORMANIP_BUILD_DLL)
+# define TAO_IORManip_Export ACE_Proper_Export_Flag
+# define TAO_IORMANIP_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# define TAO_IORMANIP_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# else /* TAO_IORMANIP_BUILD_DLL */
+# define TAO_IORManip_Export ACE_Proper_Import_Flag
+# define TAO_IORMANIP_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# define TAO_IORMANIP_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# endif /* TAO_IORMANIP_BUILD_DLL */
+#else /* TAO_IORMANIP_HAS_DLL == 1 */
+# define TAO_IORManip_Export
+# define TAO_IORMANIP_SINGLETON_DECLARATION(T)
+# define TAO_IORMANIP_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+#endif /* TAO_IORMANIP_HAS_DLL == 1 */
+
+#endif /* TAO_IORMANIP_EXPORT_H */
+
+// End of auto generated file.
diff --git a/TAO/tao/IORTable.mpc b/TAO/tao/IORTable.mpc
new file mode 100644
index 00000000000..2f9e8106a19
--- /dev/null
+++ b/TAO/tao/IORTable.mpc
@@ -0,0 +1,44 @@
+//$Id$
+
+project : taolib, core, tao_versioning_idl_defaults {
+ sharedname = TAO_IORTable
+ dynamicflags = TAO_IORTABLE_BUILD_DLL
+
+ Source_Files {
+ IORTable
+ }
+
+ Header_Files {
+ IORTable
+ }
+
+ Inline_Files {
+ IORTable
+ }
+
+ Template_Files {
+ IORTable
+ }
+
+ Resource_Files {
+ IORTable
+ }
+
+ PIDL_Files {
+ IORTable
+ }
+
+ IDL_Files {
+ idlflags += -Gp -Gd -Ge 1 -Sci -SS -Sorb \
+ -Wb,export_macro=TAO_IORTable_Export \
+ -Wb,export_include=tao/IORTable/iortable_export.h \
+ -Wb,include_guard=TAO_IORTABLE_SAFE_INCLUDE \
+ -Wb,safe_include=tao/IORTable/IORTable.h \
+ -o IORTable
+ IORTable/IORTable.pidl
+ }
+
+ Pkgconfig_Files {
+ IORTable/TAO_IORTable.pc.in
+ }
+}
diff --git a/TAO/tao/IORTable/IORTable.cpp b/TAO/tao/IORTable/IORTable.cpp
new file mode 100644
index 00000000000..e43ccf18b34
--- /dev/null
+++ b/TAO/tao/IORTable/IORTable.cpp
@@ -0,0 +1,28 @@
+/* -*- C++ -*- */
+
+// =================================================================
+/**
+ * @file IORTable.cpp
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan <coryan@uci.edu>
+ *
+ */
+// =================================================================
+
+#include "tao/IORTable/IORTable.h"
+#include "tao/IORTable/Table_Adapter.h"
+
+ACE_RCSID (IORTable, IORTable, "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+int
+TAO_IORTable_Initializer::init (void)
+{
+ return ACE_Service_Config::process_directive (ace_svc_desc_TAO_Table_Adapter_Factory);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/IORTable/IORTable.h b/TAO/tao/IORTable/IORTable.h
new file mode 100644
index 00000000000..7bae99afdb1
--- /dev/null
+++ b/TAO/tao/IORTable/IORTable.h
@@ -0,0 +1,48 @@
+// -*- C++ -*-
+
+
+//=============================================================================
+/**
+ * @file IORTable.h
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan <coryan@uci.edu>
+ */
+//=============================================================================
+
+
+#ifndef TAO_IORTABLE_H
+#define TAO_IORTABLE_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/IORTable/iortable_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Versioned_Namespace.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_IORTable_Export TAO_IORTable_Initializer
+{
+public:
+ /// Used to force the initialization of the ORB code.
+ static int init (void);
+};
+
+static int
+TAO_Requires_IORTable_Initializer = TAO_IORTable_Initializer::init ();
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#define TAO_IORTABLE_SAFE_INCLUDE
+#include "tao/IORTable/IORTableC.h"
+#undef TAO_IORTABLE_SAFE_INCLUDE
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_IORTABLE_H */
diff --git a/TAO/tao/IORTable/IORTable.pidl b/TAO/tao/IORTable/IORTable.pidl
new file mode 100644
index 00000000000..f68bd177e2a
--- /dev/null
+++ b/TAO/tao/IORTable/IORTable.pidl
@@ -0,0 +1,79 @@
+// ================================================================
+/**
+ * @file IORTable.pidl
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan <coryan@uci.edu>
+ *
+ * @brief Pre-compiled IDL source for the IORTable module.
+ *
+ * This file was used to generate the code in
+ * IORTable{C}.{h,cpp}
+ *
+ * The command used to generate code from this file is:
+ *
+ * tao_idl -o orig -Ge 1 -Sa -St -Sci \
+ * -Wb,export_macro=TAO_IORTable_Export \
+ * -Wb,export_include=iortable_export.h \
+ * -Wb,pre_include="ace/pre.h" \
+ * -Wb,post_include="ace/post.h" \
+ * IORTable.pidl
+ *
+ */
+// ================================================================
+
+/// Define a module to avoid namespace pollution
+module IORTable
+{
+ local interface Locator;
+
+ /// The object key is already in the IORTable
+ exception AlreadyBound {};
+
+ /// Cannot find the object key in the IORTable
+ exception NotFound {};
+
+ /// Define the IORTable interface
+ /**
+ *
+ * Any TAO server can be configured as an corbaloc agent.
+ * Such agents forward requests generated using a simple
+ * ObjectKey in a corbaloc specifcation to the real location
+ * of the object.
+ * In TAO we implement this feature by dynamically (or
+ * statically) adding a new Object Adapter to the ORB, that
+ * handles any sort of request.
+ */
+ local interface Table
+ {
+ /// Bind <object_key> to the <IOR>
+ void bind (in string object_key,
+ in string IOR)
+ raises (AlreadyBound);
+
+ /// Bind <object_key> to the <IOR>
+ void rebind (in string object_key,
+ in string IOR);
+
+ /// Remove the binding for <object_key>
+ void unbind (in string object_key)
+ raises (NotFound);
+
+ /// Set the locator, if no binding is set for an object_key we try
+ /// to use the locator to resolve it
+ void set_locator (in Locator the_locator);
+ };
+
+ /// Callback interface to locate object keys dynamically
+ /**
+ * The application can provide a callback interface to locate object
+ * keys dynamically.
+ */
+ local interface Locator
+ {
+ /// Returns an IOR to use for <object_key>
+ string locate (in string object_key)
+ raises (NotFound);
+ };
+};
diff --git a/TAO/tao/IORTable/IOR_Table_Impl.cpp b/TAO/tao/IORTable/IOR_Table_Impl.cpp
new file mode 100644
index 00000000000..bb3b678e397
--- /dev/null
+++ b/TAO/tao/IORTable/IOR_Table_Impl.cpp
@@ -0,0 +1,108 @@
+/**
+ * @file IOR_Table_Impl.cpp
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan <coryan@uci.edu>
+ *
+ */
+
+#include "tao/IORTable/IOR_Table_Impl.h"
+#include "ace/Guard_T.h"
+
+ACE_RCSID (IORTable,
+ IOR_Table_Impl,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_IOR_Table_Impl::TAO_IOR_Table_Impl (void)
+{
+}
+
+char *
+TAO_IOR_Table_Impl::find (const char *object_key
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ IORTable::NotFound
+ ))
+{
+ // We don't want the lock held during locate, so make it go out
+ // of scope before then.
+ {
+ ACE_CString key (object_key);
+ ACE_CString ior;
+
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->lock_, 0);
+ if (this->map_.find (key, ior) == 0)
+ {
+ return CORBA::string_dup (ior.c_str ());
+ }
+ if (CORBA::is_nil (this->locator_.in ()))
+ ACE_THROW_RETURN (IORTable::NotFound (), 0);
+ }
+
+ return this->locator_->locate (object_key ACE_ENV_ARG_PARAMETER);
+}
+
+void
+TAO_IOR_Table_Impl::bind (
+ const char * object_key,
+ const char * IOR
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ IORTable::AlreadyBound
+ ))
+{
+ ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->lock_);
+ if (this->map_.bind (object_key, IOR) != 0)
+ ACE_THROW (IORTable::AlreadyBound ());
+}
+
+void
+TAO_IOR_Table_Impl::rebind (
+ const char * object_key,
+ const char * IOR
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->lock_);
+ this->map_.rebind (object_key, IOR);
+}
+
+void
+TAO_IOR_Table_Impl::unbind (
+ const char * object_key
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ IORTable::NotFound
+ ))
+{
+ ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->lock_);
+ if (this->map_.unbind (object_key) != 0)
+ ACE_THROW (IORTable::NotFound ());
+}
+
+void
+TAO_IOR_Table_Impl::set_locator (
+ IORTable::Locator_ptr locator
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->lock_);
+ this->locator_ = IORTable::Locator::_duplicate (locator);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/IORTable/IOR_Table_Impl.h b/TAO/tao/IORTable/IOR_Table_Impl.h
new file mode 100644
index 00000000000..15ca6d6cc3f
--- /dev/null
+++ b/TAO/tao/IORTable/IOR_Table_Impl.h
@@ -0,0 +1,119 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file IOR_Table_Impl.h
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan (coryan@uci.edu)
+ */
+//=============================================================================
+
+
+#ifndef TAO_IOR_TABLE_IMPL_H
+#define TAO_IOR_TABLE_IMPL_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/IORTable/IORTable.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/Hash_Map_Manager_T.h"
+#include "ace/Null_Mutex.h"
+#include "tao/LocalObject.h"
+#include "ace/SString.h"
+
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_IOR_Table_Impl
+ : public virtual IORTable::Table,
+ public virtual TAO_Local_RefCounted_Object
+{
+public:
+ /// Constructor
+ TAO_IOR_Table_Impl (void);
+
+ /// Find the object, using the locator if it is not on the table.
+ char *find (
+ const char *object_key
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ IORTable::NotFound
+ ));
+
+ /**
+ * @name The IORTable::Table methods
+ *
+ * Please check the IORTable.pidl file for details.
+ */
+ //@{
+ virtual void bind (
+ const char * object_key,
+ const char * IOR
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ IORTable::AlreadyBound
+ ));
+
+ virtual void rebind (
+ const char * object_key,
+ const char * IOR
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ virtual void unbind (
+ const char * object_key
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ IORTable::NotFound
+ ));
+
+ virtual void set_locator (
+ IORTable::Locator_ptr the_locator
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+ //@}
+
+private:
+ typedef ACE_Hash_Map_Manager_Ex<ACE_CString, ACE_CString, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex> Map;
+
+ /// The map
+ Map map_;
+
+ /// The locator
+ IORTable::Locator_var locator_;
+
+ /// Synchronization
+ TAO_SYNCH_MUTEX lock_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_IOR_TABLE_IMPL */
diff --git a/TAO/tao/IORTable/TAO_IORTable.pc.in b/TAO/tao/IORTable/TAO_IORTable.pc.in
new file mode 100644
index 00000000000..9c5ffcf6d73
--- /dev/null
+++ b/TAO/tao/IORTable/TAO_IORTable.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: TAO_IORTable
+Description: TAO IOR Table Library
+Requires: TAO
+Version: @VERSION@
+Libs: -L${libdir} -lTAO_IORTable
+Cflags: -I${includedir}
diff --git a/TAO/tao/IORTable/TAO_IORTable.rc b/TAO/tao/IORTable/TAO_IORTable.rc
new file mode 100644
index 00000000000..eb75c022a62
--- /dev/null
+++ b/TAO/tao/IORTable/TAO_IORTable.rc
@@ -0,0 +1,30 @@
+#include "..\Version.h"
+
+1 VERSIONINFO
+ FILEVERSION TAO_MAJOR_VERSION,TAO_MINOR_VERSION,TAO_BETA_VERSION,0
+ PRODUCTVERSION TAO_MAJOR_VERSION,TAO_MINOR_VERSION,TAO_BETA_VERSION,0
+ FILEFLAGSMASK 0x3fL
+ FILEFLAGS 0x0L
+ FILEOS 0x4L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904B0"
+ BEGIN
+ VALUE "FileDescription", "IORTable\0"
+ VALUE "FileVersion", TAO_VERSION "\0"
+ VALUE "InternalName", "TAO_IORTableDLL\0"
+ VALUE "LegalCopyright", "\0"
+ VALUE "LegalTrademarks", "\0"
+ VALUE "OriginalFilename", "TAO_IORTable.DLL\0"
+ VALUE "ProductName", "TAO\0"
+ VALUE "ProductVersion", TAO_VERSION "\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
diff --git a/TAO/tao/IORTable/Table_Adapter.cpp b/TAO/tao/IORTable/Table_Adapter.cpp
new file mode 100644
index 00000000000..bf31f486a7b
--- /dev/null
+++ b/TAO/tao/IORTable/Table_Adapter.cpp
@@ -0,0 +1,195 @@
+/**
+ * @file Table_Adapter.cpp
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan <coryan@uci.edu>
+ *
+ */
+
+#include "tao/IORTable/Table_Adapter.h"
+#include "tao/IORTable/IOR_Table_Impl.h"
+#include "tao/ORB_Core.h"
+#include "tao/Object.h"
+#include "tao/Stub.h"
+#include "tao/ORB.h"
+#include "tao/Profile.h"
+
+ACE_RCSID (IORTable,
+ Table_Adapter,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Table_Adapter::TAO_Table_Adapter (TAO_ORB_Core *orb_core)
+ : orb_core_ (orb_core)
+ , root_ (0)
+{
+}
+
+TAO_Table_Adapter::~TAO_Table_Adapter (void)
+{
+ ::CORBA::release (this->root_);
+}
+
+void
+TAO_Table_Adapter::open (ACE_ENV_SINGLE_ARG_DECL)
+{
+ ACE_NEW_THROW_EX (this->root_,
+ TAO_IOR_Table_Impl (),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK;
+}
+
+void
+TAO_Table_Adapter::close (int ACE_ENV_ARG_DECL_NOT_USED)
+{
+ ::CORBA::release (this->root_);
+ this->root_ = 0;
+}
+
+void
+TAO_Table_Adapter::check_close (int ACE_ENV_ARG_DECL_NOT_USED)
+{
+}
+
+int
+TAO_Table_Adapter::priority (void) const
+{
+ return 16; // @@
+}
+
+int
+TAO_Table_Adapter::dispatch (TAO::ObjectKey &key,
+ TAO_ServerRequest &,
+ CORBA::Object_out forward_to
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return this->find_object (key, forward_to) ? TAO_Adapter::DS_FORWARD
+ : TAO_Adapter::DS_MISMATCHED_KEY;
+}
+
+const char *
+TAO_Table_Adapter::name (void) const
+{
+ return "IORTable";
+}
+
+CORBA::Object_ptr
+TAO_Table_Adapter::root (void)
+{
+ return CORBA::Object::_duplicate (this->root_);
+}
+
+CORBA::Object_ptr
+TAO_Table_Adapter::create_collocated_object (TAO_Stub *stub,
+ const TAO_MProfile &)
+{
+ CORBA::Object_ptr result = CORBA::Object::_nil ();
+
+ if (! this->initialize_collocated_object (stub)) // 0 == success
+ {
+ // A reference was found in the table. The stub has been forwarded
+ // to this. The collocation indicators are now correct on the stub
+ // (although they may well now indicate that the stub is not in fact
+ // collocated at all).
+ ACE_NEW_RETURN (result,
+ CORBA::Object (stub,
+ stub->is_collocated (),
+ stub->collocated_servant ()),
+ CORBA::Object::_nil ());
+
+ }
+
+ return result;
+}
+
+CORBA::Long
+TAO_Table_Adapter::initialize_collocated_object (TAO_Stub * stub)
+{
+ // Get the effective profile set.
+ const TAO_MProfile &mp = stub->forward_profiles () ? *(stub->forward_profiles ())
+ : stub->base_profiles ();
+ TAO_PHandle j = 0;
+ // We only look at the key from the 0th profile but we only really care about
+ // corbaloc's here where all profiles share a single object key
+ TAO::ObjectKey_var key = mp.get_profile (j)->_key ();
+
+ CORBA::Object_var forward_to = CORBA::Object::_nil ();
+ CORBA::Boolean found = false;
+
+ ACE_TRY_NEW_ENV
+ {
+ found = this->find_object (key, forward_to.out ());
+ }
+ ACE_CATCHANY
+ {
+ }
+ ACE_ENDTRY;
+
+ if (found)
+ {
+ // This call will set the appropriate collocation values
+ // to correspond to the reference we found in the table.
+ stub->add_forward_profiles (forward_to->_stubobj ()->base_profiles ());
+ stub->next_profile ();
+ }
+
+ // 0 for success
+ return ! found;
+}
+
+CORBA::Long
+TAO_Table_Adapter::find_object (TAO::ObjectKey &key,
+ CORBA::Object_out forward_to
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ CORBA::String_var object_key;
+ TAO::ObjectKey::encode_sequence_to_string (object_key.out (),
+ key);
+ ACE_TRY
+ {
+ CORBA::String_var ior =
+ this->root_->find (object_key.in () ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ forward_to =
+ this->orb_core_->orb ()->string_to_object (ior.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCH (IORTable::NotFound, nf_ex)
+ {
+ return 0;
+ }
+ ACE_ENDTRY;
+ return 1;
+}
+
+// ****************************************************************
+
+TAO_Table_Adapter_Factory::TAO_Table_Adapter_Factory (void)
+{
+}
+
+TAO_Adapter*
+TAO_Table_Adapter_Factory::create (TAO_ORB_Core *oc)
+{
+ TAO_Adapter* ptr = 0;
+ ACE_NEW_RETURN (ptr,
+ TAO_Table_Adapter (oc),
+ 0);
+ return ptr;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_FACTORY_DEFINE (TAO_IORTable, TAO_Table_Adapter_Factory)
+ACE_STATIC_SVC_DEFINE (TAO_Table_Adapter_Factory,
+ ACE_TEXT ("TAO_IORTable"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (TAO_Table_Adapter_Factory),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0)
diff --git a/TAO/tao/IORTable/Table_Adapter.h b/TAO/tao/IORTable/Table_Adapter.h
new file mode 100644
index 00000000000..9f6ad395279
--- /dev/null
+++ b/TAO/tao/IORTable/Table_Adapter.h
@@ -0,0 +1,94 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Table_Adapter.h
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan (coryan@uci.edu)
+ */
+//=============================================================================
+
+
+#ifndef TAO_TABLE_ADAPTER_H
+#define TAO_TABLE_ADAPTER_H
+#include /**/ "ace/pre.h"
+
+#include "tao/IORTable/iortable_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Adapter.h"
+#include "tao/Adapter_Factory.h"
+#include "ace/Service_Config.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_IOR_Table_Impl;
+
+class TAO_IORTable_Export TAO_Table_Adapter : public TAO_Adapter
+{
+public:
+ /// Constructor
+ TAO_Table_Adapter (TAO_ORB_Core *orb_core);
+
+ /// Destructor
+ virtual ~TAO_Table_Adapter (void);
+
+ // = The TAO_Adapter methods, please check tao/Adapter.h for the
+ // documentation
+ virtual void open (ACE_ENV_SINGLE_ARG_DECL);
+ virtual void close (int wait_for_completion
+ ACE_ENV_ARG_DECL);
+ virtual void check_close (int wait_for_completion
+ ACE_ENV_ARG_DECL);
+ virtual int priority (void) const;
+ virtual int dispatch (TAO::ObjectKey &key,
+ TAO_ServerRequest &request,
+ CORBA::Object_out foward_to
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+ virtual const char *name (void) const;
+ virtual CORBA::Object_ptr root (void);
+ virtual CORBA::Object_ptr create_collocated_object (TAO_Stub *,
+ const TAO_MProfile &);
+
+ virtual CORBA::Long initialize_collocated_object (TAO_Stub *);
+private:
+ /// Helper method to find an object bound in the table.
+ /// @return 1 if found, 0 otherwise.
+ CORBA::Long find_object (TAO::ObjectKey &key,
+ CORBA::Object_out forward_to
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// The ORB Core we belong to
+ TAO_ORB_Core * const orb_core_;
+
+ /// The table implementation
+ TAO_IOR_Table_Impl *root_;
+};
+
+// ****************************************************************
+
+class TAO_IORTable_Export TAO_Table_Adapter_Factory : public TAO_Adapter_Factory
+{
+public:
+ /// Constructor
+ TAO_Table_Adapter_Factory (void);
+
+ // = The TAO_Adapter_Factory methods, please read tao/Adapter.h for
+ // details.
+ virtual TAO_Adapter *create (TAO_ORB_Core *orb_core);
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE (TAO_Table_Adapter_Factory)
+ACE_FACTORY_DECLARE (TAO_IORTable, TAO_Table_Adapter_Factory)
+
+#include /**/ "ace/post.h"
+#endif /* TAO_TABLE_ADAPTER_H */
diff --git a/TAO/tao/IORTable/iortable_export.h b/TAO/tao/IORTable/iortable_export.h
new file mode 100644
index 00000000000..ba6833bea98
--- /dev/null
+++ b/TAO/tao/IORTable/iortable_export.h
@@ -0,0 +1,40 @@
+
+// -*- C++ -*-
+// $Id$
+// Definition for Win32 Export directives.
+// This file is generated automatically by generate_export_file.pl
+// ------------------------------
+#ifndef TAO_IORTABLE_EXPORT_H
+#define TAO_IORTABLE_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if defined (TAO_AS_STATIC_LIBS)
+# if !defined (TAO_IORTABLE_HAS_DLL)
+# define TAO_IORTABLE_HAS_DLL 0
+# endif /* ! TAO_IORTABLE_HAS_DLL */
+#else
+# if !defined (TAO_IORTABLE_HAS_DLL)
+# define TAO_IORTABLE_HAS_DLL 1
+# endif /* ! TAO_IORTABLE_HAS_DLL */
+#endif
+
+#if defined (TAO_IORTABLE_HAS_DLL) && (TAO_IORTABLE_HAS_DLL == 1)
+# if defined (TAO_IORTABLE_BUILD_DLL)
+# define TAO_IORTable_Export ACE_Proper_Export_Flag
+# define TAO_IORTABLE_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# define TAO_IORTABLE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# else /* TAO_IORTABLE_BUILD_DLL */
+# define TAO_IORTable_Export ACE_Proper_Import_Flag
+# define TAO_IORTABLE_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# define TAO_IORTABLE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# endif /* TAO_IORTABLE_BUILD_DLL */
+#else /* TAO_IORTABLE_HAS_DLL == 1 */
+# define TAO_IORTable_Export
+# define TAO_IORTABLE_SINGLETON_DECLARATION(T)
+# define TAO_IORTABLE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+#endif /* TAO_IORTABLE_HAS_DLL == 1 */
+
+#endif /* TAO_IORTABLE_EXPORT_H */
+
+// End of auto generated file.
diff --git a/TAO/tao/IOR_Parser.cpp b/TAO/tao/IOR_Parser.cpp
new file mode 100644
index 00000000000..abc812d7f58
--- /dev/null
+++ b/TAO/tao/IOR_Parser.cpp
@@ -0,0 +1,14 @@
+// $Id$
+
+#include "tao/IOR_Parser.h"
+
+ACE_RCSID(tao, IOR_Parser, "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_IOR_Parser::~TAO_IOR_Parser (void)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/IOR_Parser.h b/TAO/tao/IOR_Parser.h
new file mode 100644
index 00000000000..0058a743a0e
--- /dev/null
+++ b/TAO/tao/IOR_Parser.h
@@ -0,0 +1,71 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file IOR_Parser.h
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan (coryan@cs.wustl.edu)
+ */
+//=============================================================================
+
+
+#ifndef TAO_IOR_PARSER_H
+#define TAO_IOR_PARSER_H
+
+#include /**/ "ace/pre.h"
+#include "ace/Service_Object.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/SystemException.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace CORBA
+{
+ class Object;
+ typedef Object *Object_ptr;
+
+ class ORB;
+ typedef ORB *ORB_ptr;
+}
+
+/**
+ * @class TAO_IOR_Parser
+ *
+ * @brief Defines the interface for the pluggable IOR parser components
+ *
+ * The ORB is able to dynamically load the list of IOR formats it
+ * understands. That allow us to integrate formats such as
+ * corbaname:, http: or ftp: only when required.
+ * This class provides a uniform interface for all the IOR parsers
+ */
+class TAO_Export TAO_IOR_Parser : public ACE_Service_Object
+{
+public:
+ /// The destructor
+ virtual ~TAO_IOR_Parser (void);
+
+ /// Return 1 if @a ior_string starts with a prefix known to this IOR
+ /// parser
+ virtual int match_prefix (const char *ior_string) const = 0;
+
+ /**
+ * Parse the @a ior argument and return an object reference.
+ * The call may raise the standard system exceptions (NO_MEMORY,
+ * INV_OBJREF, etc.)
+ */
+ virtual CORBA::Object_ptr parse_string (const char *ior,
+ CORBA::ORB_ptr orb
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException)) = 0;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_IOR_PARSER_H */
diff --git a/TAO/tao/ImR_Client.mpc b/TAO/tao/ImR_Client.mpc
new file mode 100644
index 00000000000..fc0403fff08
--- /dev/null
+++ b/TAO/tao/ImR_Client.mpc
@@ -0,0 +1,51 @@
+//$Id$
+project : taolib, core, portableserver, tao_versioning_idl_defaults {
+ sharedname = TAO_ImR_Client
+ dynamicflags = TAO_IMR_CLIENT_BUILD_DLL
+
+ Source_Files {
+ ImR_Client
+ }
+
+ Header_Files {
+ ImR_Client
+ }
+
+ Inline_Files {
+ ImR_Client
+ }
+
+ Template_Files {
+ ImR_Client
+ }
+
+ Resource_Files {
+ ImR_Client
+ }
+
+ PIDL_Files {
+ ImR_Client
+ }
+
+ IDL_Files {
+ idlflags += -Gp -Ssi -Sc -Gd -Ge 1 -Sorb -GA \
+ -Wb,export_macro=TAO_IMR_Client_Export \
+ -Wb,export_include=tao/ImR_Client/imr_client_export.h \
+ -o ImR_Client
+ idlflags -= -Sa -St
+ ImR_Client/ServerObject.pidl
+ }
+
+ IDL_Files {
+ idlflags += -Gp -Ssi -Sc -Gd -Ge 1 -Sorb \
+ -Wb,export_macro=TAO_IMR_Client_Export \
+ -Wb,export_include=tao/ImR_Client/imr_client_export.h \
+ -o ImR_Client
+ idlflags -= -Sa -St
+ ImR_Client/ImplRepo.pidl
+ }
+
+ Pkgconfig_Files {
+ ImR_Client/TAO_ImR_Client.pc.in
+ }
+}
diff --git a/TAO/tao/ImR_Client/ImR_Client.cpp b/TAO/tao/ImR_Client/ImR_Client.cpp
new file mode 100644
index 00000000000..47fc9c960fe
--- /dev/null
+++ b/TAO/tao/ImR_Client/ImR_Client.cpp
@@ -0,0 +1,268 @@
+// $Id$
+
+#include "tao/ImR_Client/ImR_Client.h"
+
+#include "tao/debug.h"
+#include "tao/ORB_Core.h"
+#include "tao/Stub.h"
+#include "tao/Profile.h"
+#include "tao/PortableServer/Root_POA.h"
+#include "tao/PortableServer/Non_Servant_Upcall.h"
+#include "tao/ImR_Client/ServerObject_i.h"
+#include "tao/ImR_Client/ImplRepoC.h"
+
+ACE_RCSID (ImR_Client,
+ ImR_Client,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace ImR_Client
+ {
+ ImR_Client_Adapter_Impl::ImR_Client_Adapter_Impl (void)
+ : server_object_ (0)
+ {
+ }
+
+ void
+ ImR_Client_Adapter_Impl::imr_notify_startup (
+ TAO_Root_POA* poa ACE_ENV_ARG_DECL)
+ {
+ CORBA::Object_var imr = poa->orb_core ().implrepo_service ();
+
+ if (CORBA::is_nil (imr.in ()))
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) ERROR: No usable IMR initial reference ")
+ ACE_TEXT ("available but use IMR has been specified.\n")));
+ ACE_THROW (CORBA::TRANSIENT (
+ CORBA::SystemException::_tao_minor_code (TAO_IMPLREPO_MINOR_CODE, 0),
+ CORBA::COMPLETED_NO));
+ }
+
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG, "Notifying ImR of startup\n"));
+
+ ImplementationRepository::Administration_var imr_locator;
+
+ {
+ // ATTENTION: Trick locking here, see class header for details
+ TAO::Portable_Server::Non_Servant_Upcall non_servant_upcall (*poa);
+ ACE_UNUSED_ARG (non_servant_upcall);
+
+ imr_locator =
+ ImplementationRepository::Administration::_narrow (imr.in () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ if (CORBA::is_nil(imr_locator.in ()))
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) ERROR: Narrowed IMR initial reference ")
+ ACE_TEXT ("is nil but use IMR has been specified.\n")));
+
+ ACE_THROW (CORBA::TRANSIENT (
+ CORBA::SystemException::_tao_minor_code (TAO_IMPLREPO_MINOR_CODE, 0),
+ CORBA::COMPLETED_NO));
+ }
+
+ TAO_Root_POA *root_poa = poa->object_adapter ().root_poa ();
+ ACE_NEW_THROW_EX (this->server_object_,
+ ServerObject_i (poa->orb_core ().orb (),
+ root_poa),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK;
+
+ PortableServer::ServantBase_var safe_servant (this->server_object_);
+ ACE_UNUSED_ARG (safe_servant);
+
+ // Since this method is called from the POA constructor, there
+ // shouldn't be any waiting required. Therefore,
+ // <wait_occurred_restart_call_ignored> can be ignored.
+ int wait_occurred_restart_call_ignored = 0;
+
+ // Activate the servant in the root poa.
+ PortableServer::ObjectId_var id =
+ root_poa->activate_object_i (this->server_object_,
+ poa->server_priority (),
+ wait_occurred_restart_call_ignored
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ CORBA::Object_var obj = root_poa->id_to_reference_i (id.in (), false
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ ImplementationRepository::ServerObject_var svr
+ = ImplementationRepository::ServerObject::_narrow (obj.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (!svr->_stubobj () || !svr->_stubobj ()->profile_in_use ())
+ {
+ ACE_ERROR ((LM_ERROR, "Invalid ImR ServerObject, bailing out.\n"));
+ return;
+ }
+
+ CORBA::String_var ior =
+ svr->_stubobj ()->profile_in_use ()->to_string (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Search for "corbaloc:" alone, without the protocol. This code
+ // should be protocol neutral.
+ const char corbaloc[] = "corbaloc:";
+ char *pos = ACE_OS::strstr (ior.inout (), corbaloc);
+ pos = ACE_OS::strchr (pos + sizeof (corbaloc), ':');
+
+ pos = ACE_OS::strchr (pos + 1,
+ svr->_stubobj ()->profile_in_use ()->object_key_delimiter ());
+
+ ACE_CString partial_ior(ior.in (), (pos - ior.in()) + 1);
+
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ "Informing IMR that we are running at: %s\n",
+ ACE_TEXT_CHAR_TO_TCHAR (partial_ior.c_str())));
+
+ ACE_TRY
+ {
+ // ATTENTION: Trick locking here, see class header for details
+ TAO::Portable_Server::Non_Servant_Upcall non_servant_upcall (*poa);
+ ACE_UNUSED_ARG (non_servant_upcall);
+
+ imr_locator->server_is_running (poa->name().c_str (),
+ partial_ior.c_str(),
+ svr.in()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCH (CORBA::SystemException, sysex)
+ {
+ // Avoid warnings on platforms with native C++ exceptions
+ ACE_UNUSED_ARG (sysex);
+ ACE_RE_THROW;
+ }
+ ACE_CATCHANY
+ {
+ ACE_TRY_THROW (CORBA::TRANSIENT (
+ CORBA::SystemException::_tao_minor_code (TAO_IMPLREPO_MINOR_CODE, 0),
+ CORBA::COMPLETED_NO));
+ }
+ ACE_ENDTRY;
+ ACE_CHECK;
+
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG, "Successfully notified ImR of Startup\n"));
+ }
+
+ void
+ ImR_Client_Adapter_Impl::imr_notify_shutdown (
+ TAO_Root_POA* poa ACE_ENV_ARG_DECL)
+ {
+ // Notify the Implementation Repository about shutting down.
+ CORBA::Object_var imr = poa->orb_core ().implrepo_service ();
+
+ // Check to see if there was an imr returned.
+ // If none, return ourselves.
+ if (CORBA::is_nil (imr.in ()))
+ return;
+
+ ACE_TRY_NEW_ENV
+ {
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ "Notifying IMR of Shutdown server:%s\n",
+ poa->the_name()));
+
+ // ATTENTION: Trick locking here, see class header for details
+ TAO::Portable_Server::Non_Servant_Upcall non_servant_upcall (*poa);
+ ACE_UNUSED_ARG (non_servant_upcall);
+
+ // Get the IMR's administrative object and call shutting_down on it
+ ImplementationRepository::Administration_var imr_locator =
+ ImplementationRepository::Administration::_narrow (imr.in () ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ imr_locator->server_is_shutting_down (poa->name().c_str ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCH(CORBA::COMM_FAILURE, ex)
+ {
+ // At the moment we call this during ORB shutdown and the ORB is
+ // configured to drop replies during shutdown (it does by default in
+ // the LF model) we get a COMM_FAILURE exception which we ignore
+ if (TAO_debug_level > 0)
+ ACE_DEBUG((LM_DEBUG, "Ignoring COMM_FAILURE while unregistering from ImR.\n"));
+ ACE_UNUSED_ARG (ex);
+ }
+ ACE_CATCH(CORBA::TRANSIENT, ex)
+ {
+ // Similarly, there are cases where we could get a TRANSIENT.
+ if (TAO_debug_level > 0)
+ ACE_DEBUG((LM_DEBUG, "Ignoring TRANSIENT while unregistering from ImR.\n"));
+ ACE_UNUSED_ARG (ex);
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "ImR_Client_Adapter_Impl::imr_notify_shutdown()");
+ // Ignore exceptions
+ }
+ ACE_ENDTRY;
+
+ if (this->server_object_)
+ {
+ PortableServer::POA_var poa =
+ this->server_object_->_default_POA (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ TAO_Root_POA *root_poa = dynamic_cast <TAO_Root_POA*> (poa.in ());
+
+ if (!root_poa)
+ {
+ ACE_THROW (CORBA::OBJ_ADAPTER ());
+ }
+
+ PortableServer::ObjectId_var id =
+ root_poa->servant_to_id_i (this->server_object_
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ root_poa->deactivate_object_i (id.in() ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ server_object_ = 0;
+ }
+ }
+
+ // *********************************************************************
+
+ // Initialization and registration of dynamic service object.
+
+ int
+ ImR_Client_Adapter_Impl::Initializer (void)
+ {
+ TAO_Root_POA::imr_client_adapter_name ("Concrete_ImR_Client_Adapter");
+
+ return ACE_Service_Config::process_directive (ace_svc_desc_ImR_Client_Adapter_Impl);
+ }
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DEFINE (
+ ImR_Client_Adapter_Impl,
+ ACE_TEXT ("Concrete_ImR_Client_Adapter"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (ImR_Client_Adapter_Impl),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0)
+
+ACE_FACTORY_NAMESPACE_DEFINE (
+ TAO_IMR_Client,
+ ImR_Client_Adapter_Impl,
+ TAO::ImR_Client::ImR_Client_Adapter_Impl)
diff --git a/TAO/tao/ImR_Client/ImR_Client.h b/TAO/tao/ImR_Client/ImR_Client.h
new file mode 100644
index 00000000000..cf1e19b7f92
--- /dev/null
+++ b/TAO/tao/ImR_Client/ImR_Client.h
@@ -0,0 +1,80 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file ImR_Client.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+
+#ifndef TAO_IMR_CLIENT_ADAPTER_IMPL_H
+#define TAO_IMR_CLIENT_ADAPTER_IMPL_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/ImR_Client/imr_client_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/ImR_Client_Adapter.h"
+
+#include "ace/Service_Config.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class ServerObject_i;
+
+namespace TAO
+{
+ namespace ImR_Client
+ {
+ /**
+ * @class IFR_Client_Adapter_Impl
+ *
+ * @brief IFR_Client_Adapter_Impl.
+ *
+ * Class that adapts various functions in the PortableServer library
+ * which use the Implementation Repository. This is the derived class
+ * that contains the actual implementations.
+ */
+ class TAO_IMR_Client_Export ImR_Client_Adapter_Impl
+ : public ::TAO::Portable_Server::ImR_Client_Adapter
+ {
+ public:
+ /// Constructor.
+ ImR_Client_Adapter_Impl (void);
+
+ /// Used to force the initialization of the PortableServer code.
+ static int Initializer (void);
+
+ /// ImplRepo helper method, notify the ImplRepo on startup
+ virtual void imr_notify_startup (TAO_Root_POA* poa ACE_ENV_ARG_DECL);
+
+ /// ImplRepo helper method, notify the ImplRepo on shutdown
+ virtual void imr_notify_shutdown (TAO_Root_POA* poa ACE_ENV_ARG_DECL);
+
+ private:
+ /// Implementation Repository Server Object
+ ServerObject_i *server_object_;
+ };
+
+ static int
+ TAO_Requires_ImR_Client_Initializer =
+ TAO::ImR_Client::ImR_Client_Adapter_Impl::Initializer ();
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE (ImR_Client_Adapter_Impl)
+ACE_FACTORY_DECLARE (TAO_IMR_Client, ImR_Client_Adapter_Impl)
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_IMR_CLIENT_ADAPTER_IMPL_H */
diff --git a/TAO/tao/ImR_Client/ImplRepo.pidl b/TAO/tao/ImR_Client/ImplRepo.pidl
new file mode 100644
index 00000000000..9806d3ada1e
--- /dev/null
+++ b/TAO/tao/ImR_Client/ImplRepo.pidl
@@ -0,0 +1,176 @@
+// -*- IDL -*-
+
+//=============================================================================
+/**
+ * @file ImplRepo.pidl
+ *
+ * $Id$
+ *
+ * This file was used to generate the code in ImplRepo{A,C,S}.{h,inl,cpp}
+ *
+ * The command used to generate code from this file is:
+ *
+ * tao_idl -Ssi -Gp -Gd -Ge 1 -I$(TAO_ROOT) -Wb,export_macro=TAO_IMR_Client_Export -Wb,export_include=imr_client_export.h -Wb,pre_include="ace/pre.h" -Wb,post_include="ace/post.h" ImplRepo.pidl
+ *
+ */
+//=============================================================================
+
+#include "tao/ImR_Client/ServerObject.pidl"
+
+module ImplementationRepository
+{
+ // = Exceptions
+
+ /// Object already bound in the Implementation Repository
+ exception AlreadyRegistered {};
+
+ /// The server could not be restarted.
+ exception CannotActivate
+ {
+ string reason;
+ };
+
+ /// Object not found in the Implementation Repository
+ exception NotFound {};
+
+ /// One environment variable/value pair.
+ struct EnvironmentVariable
+ {
+ string name;
+ string value;
+ };
+
+ /// Complete Environment.
+ typedef sequence<EnvironmentVariable> EnvironmentList;
+
+ /// The type of Activation
+ enum ActivationMode {NORMAL, MANUAL, PER_CLIENT, AUTO_START};
+
+ /// Options used to start up the server.
+ struct StartupOptions
+ {
+ /// Startup command (program name and arguments).
+ string command_line;
+
+ /// Environment Variables.
+ EnvironmentList environment;
+
+ /// Working directory.
+ string working_directory;
+
+ /// Activation Mode
+ ActivationMode activation;
+
+ /// Name of the activator
+ string activator;
+
+ /// Number of retries allowed
+ long start_limit;
+ };
+
+ struct ServerInformation
+ {
+ /// Server name.
+ string server;
+
+ /// How to start up the server.
+ StartupOptions startup;
+
+ /// This is used in places that require a partial IOR with
+ /// just the ObjectKey missing.
+ string partial_ior;
+ };
+
+ typedef sequence <ServerInformation> ServerInformationList;
+
+ /**
+ * @brief The Server Information Iterator Interface
+ *
+ * Interface for iterating over servers returned with
+ * Administration::list ().
+ */
+ interface ServerInformationIterator
+ {
+ /// This operation returns at most the requested number of
+ /// servers.
+ /// If how_many == 0, then returns all servers
+ boolean next_n (in unsigned long how_many,
+ out ServerInformationList servers);
+
+ /// This operation destroys the iterator.
+ void destroy ();
+ };
+
+ /**
+ * @brief The Implementation Repository Administration Interface
+ *
+ * This interface exports all the administration functionality of
+ * the Implementation Repository.
+ */
+ interface Administration
+ {
+ /// Activate server that is named <server>.
+ ///
+ /// The <NotFound> exception is raised when <server> is not found
+ /// in the Implementation Repository. The <CannotActivate> exception
+ /// is raised when <server> is found in the Repository but could not be
+ /// activated.
+ void activate_server (in string server)
+ raises (NotFound, CannotActivate);
+
+ /// Add/Update the the <server>
+ /// The <NotFound> exception is raised when the activator specified
+ /// in the options is not registered.
+ void add_or_update_server (in string server, in StartupOptions options)
+ raises(NotFound);
+
+ /// Remove <server> from the Implementation Repository.
+ ///
+ /// The <NotFound> exception is raised when <server> is not found
+ /// in the Implementation Repository.
+ void remove_server (in string server)
+ raises (NotFound);
+
+ /// Tries to shutdown the server, first gracefully, then ungracefully.
+ ///
+ /// The <NotFound> exception is raised when <server> is not found
+ /// in the Implementation Repository.
+ void shutdown_server (in string server)
+ raises (NotFound);
+
+ /// Used to notify the Implementation Repository that <server> is alive
+ /// and well at <partial_ior>.
+ ///
+ /// The <NotFound> exception is raised when <server> is not found
+ /// in the Implementation Repository.
+ void server_is_running (in string server,
+ in string partial_ior,
+ in ServerObject server_object)
+ raises (NotFound);
+
+ /// Used to tell the Implementation Repository that <server> is shutting
+ /// down.
+ ///
+ /// The <NotFound> exception is raised when <server> is not found
+ /// in the Implementation Repository.
+
+ void server_is_shutting_down (in string server)
+ raises (NotFound);
+
+ /// Returns the startup information for a given <server>.
+ void find (in string server, out ServerInformation info);
+
+ /// Returns at most <how_many> servers in <server_list>. If there
+ /// are additional servers, they can be received through the
+ /// <server_iterator>. If there are no more servers, then
+ /// <server_iterator> is null.
+ /// If how_many == 0, then returns all servers.
+ void list (in unsigned long how_many,
+ out ServerInformationList server_list,
+ out ServerInformationIterator server_iterator);
+
+ /// Shutdown the ImR, optionally shutting down registered
+ /// activators and servers first.
+ oneway void shutdown(in boolean activators, in boolean servers);
+ };
+};
diff --git a/TAO/tao/ImR_Client/ImplRepoA.h b/TAO/tao/ImR_Client/ImplRepoA.h
new file mode 100644
index 00000000000..cf0e7e40863
--- /dev/null
+++ b/TAO/tao/ImR_Client/ImplRepoA.h
@@ -0,0 +1,44 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:390
+
+#ifndef _TAO_IDL_ORIG_IMPLREPOA_H_
+#define _TAO_IDL_ORIG_IMPLREPOA_H_
+
+#include /**/ "ace/pre.h"
+
+#include "tao/ImR_Client/ImplRepoC.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include /**/ "ace/post.h"
+#endif /* ifndef */
+
diff --git a/TAO/tao/ImR_Client/ServerObject.pidl b/TAO/tao/ImR_Client/ServerObject.pidl
new file mode 100644
index 00000000000..f74d1be86a9
--- /dev/null
+++ b/TAO/tao/ImR_Client/ServerObject.pidl
@@ -0,0 +1,36 @@
+// -*- IDL -*-
+
+//=============================================================================
+/**
+ * @file ServerObject.pidl
+ *
+ * $Id$
+ *
+ * This file was used to generate the code in ServerObject{A,C,S}.{h,inl,cpp}
+ *
+ * The command used to generate code from this file is:
+ *
+ * tao_idl -Ssi -Gp -Gd -Ge 1 -I$(TAO_ROOT) -Wb,export_macro=TAO_IMR_Client_Export -Wb,export_include=imr_client_export.h -Wb,pre_include="ace/pre.h" -Wb,post_include="ace/post.h" ServerObject.pidl
+ *
+ */
+//=============================================================================
+
+module ImplementationRepository
+{
+ /**
+ * @brief Server Side IR Object
+ *
+ * This object, which exists on the servers that use the
+ * Implementation Repository (IR), is used to control or check the
+ * status of the server by the IR.
+ */
+
+ interface ServerObject
+ {
+ /// Check the liveness of a server.
+ void ping ();
+
+ /// Try to shutdown the server gracefully.
+ oneway void shutdown ();
+ };
+};
diff --git a/TAO/tao/ImR_Client/ServerObject_i.cpp b/TAO/tao/ImR_Client/ServerObject_i.cpp
new file mode 100644
index 00000000000..8e777df8a31
--- /dev/null
+++ b/TAO/tao/ImR_Client/ServerObject_i.cpp
@@ -0,0 +1,41 @@
+// $Id$
+
+#include "tao/ImR_Client/ServerObject_i.h"
+#include "tao/PortableServer/Root_POA.h"
+#include "tao/orbconf.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ServerObject_i::ServerObject_i (CORBA::ORB_ptr orb,
+ PortableServer::POA_ptr poa)
+ : orb_ (CORBA::ORB::_duplicate (orb)),
+ poa_ (PortableServer::POA::_duplicate (poa))
+{
+}
+
+void
+ServerObject_i::ping (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+}
+
+void
+ServerObject_i::shutdown (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ // Note : We want our child POAs to be able to unregister themselves from
+ // the ImR, so we must destroy them before shutting down the orb.
+ poa_->destroy(1, 0 ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ this->orb_->shutdown (0 ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+PortableServer::POA_ptr
+ServerObject_i::_default_POA (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+{
+ return PortableServer::POA::_duplicate (this->poa_.in ());
+}
+
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/ImR_Client/ServerObject_i.h b/TAO/tao/ImR_Client/ServerObject_i.h
new file mode 100644
index 00000000000..a397952aab6
--- /dev/null
+++ b/TAO/tao/ImR_Client/ServerObject_i.h
@@ -0,0 +1,71 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file ServerObject_i.h
+ *
+ * $Id$
+ *
+ * @author Darrell Brunsch
+ * @author Irfan Pyarali
+ */
+// ===================================================================
+
+#ifndef TAO_SERVEROBJECT_I_H
+#define TAO_SERVEROBJECT_I_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/ORB.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/ImR_Client/ServerObjectS.h"
+#include "tao/ImR_Client/imr_client_export.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class ServerObject_i
+ *
+ * @brief Class for pinging a server. Implementation Repository uses
+ * this to communicate with the IMR registered servers.
+ *
+ * \nosubgrouping
+ *
+ **/
+class TAO_IMR_Client_Export ServerObject_i
+ : public POA_ImplementationRepository::ServerObject
+{
+public:
+ /// Constructor.
+ ServerObject_i (CORBA::ORB_ptr orb,
+ PortableServer::POA_ptr poa);
+
+ /// Ping method.
+ void ping (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Shutdown the server.
+ void shutdown (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Returns the default POA for this servant.
+ PortableServer::POA_ptr _default_POA (ACE_ENV_SINGLE_ARG_DECL);
+
+protected:
+ /// Our ORB. We need this member in case we need to shutdown the
+ /// server.
+ CORBA::ORB_var orb_;
+
+ /// POA that we are registered with.
+ PortableServer::POA_var poa_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_SERVEROBJECT_I_H */
diff --git a/TAO/tao/ImR_Client/TAO_IMR_Client.rc b/TAO/tao/ImR_Client/TAO_IMR_Client.rc
new file mode 100644
index 00000000000..64272160de5
--- /dev/null
+++ b/TAO/tao/ImR_Client/TAO_IMR_Client.rc
@@ -0,0 +1,30 @@
+#include "..\Version.h"
+
+1 VERSIONINFO
+ FILEVERSION TAO_MAJOR_VERSION,TAO_MINOR_VERSION,TAO_BETA_VERSION,0
+ PRODUCTVERSION TAO_MAJOR_VERSION,TAO_MINOR_VERSION,TAO_BETA_VERSION,0
+ FILEFLAGSMASK 0x3fL
+ FILEFLAGS 0x0L
+ FILEOS 0x4L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904B0"
+ BEGIN
+ VALUE "FileDescription", "IMR_Client\0"
+ VALUE "FileVersion", TAO_VERSION "\0"
+ VALUE "InternalName", "TAO_IMR_ClientDLL\0"
+ VALUE "LegalCopyright", "\0"
+ VALUE "LegalTrademarks", "\0"
+ VALUE "OriginalFilename", "TAO_IMR_Client.DLL\0"
+ VALUE "ProductName", "TAO\0"
+ VALUE "ProductVersion", TAO_VERSION "\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
diff --git a/TAO/tao/ImR_Client/TAO_ImR_Client.pc.in b/TAO/tao/ImR_Client/TAO_ImR_Client.pc.in
new file mode 100644
index 00000000000..d66d942c22c
--- /dev/null
+++ b/TAO/tao/ImR_Client/TAO_ImR_Client.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: TAO_ImR_Client
+Description: TAO Implementation Repository Client Library
+Requires: TAO_PortableServer, TAO_AnyTypeCode, TAO
+Version: @VERSION@
+Libs: -L${libdir} -lTAO_ImR_Client
+Cflags: -I${includedir}
diff --git a/TAO/tao/ImR_Client/imr_client_export.h b/TAO/tao/ImR_Client/imr_client_export.h
new file mode 100644
index 00000000000..be4ed299190
--- /dev/null
+++ b/TAO/tao/ImR_Client/imr_client_export.h
@@ -0,0 +1,39 @@
+// -*- C++ -*-
+// $Id$
+// Definition for Win32 Export directives.
+// This file is generated automatically by generate_export_file.pl
+// ------------------------------
+#ifndef TAO_IMR_CLIENT_EXPORT_H
+#define TAO_IMR_CLIENT_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if defined (TAO_AS_STATIC_LIBS)
+# if !defined (TAO_IMR_CLIENT_HAS_DLL)
+# define TAO_IMR_CLIENT_HAS_DLL 0
+# endif /* ! TAO_IMR_CLIENT_HAS_DLL */
+#else
+# if !defined (TAO_IMR_CLIENT_HAS_DLL)
+# define TAO_IMR_CLIENT_HAS_DLL 1
+# endif /* ! TAO_IMR_CLIENT_HAS_DLL */
+#endif
+
+#if defined (TAO_IMR_CLIENT_HAS_DLL) && (TAO_IMR_CLIENT_HAS_DLL == 1)
+# if defined (TAO_IMR_CLIENT_BUILD_DLL)
+# define TAO_IMR_Client_Export ACE_Proper_Export_Flag
+# define TAO_IMR_CLIENT_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# define TAO_IMR_CLIENT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# else /* TAO_IMR_CLIENT_BUILD_DLL */
+# define TAO_IMR_Client_Export ACE_Proper_Import_Flag
+# define TAO_IMR_CLIENT_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# define TAO_IMR_CLIENT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# endif /* TAO_IMR_CLIENT_BUILD_DLL */
+#else /* TAO_IMR_CLIENT_HAS_DLL == 1 */
+# define TAO_IMR_Client_Export
+# define TAO_IMR_CLIENT_SINGLETON_DECLARATION(T)
+# define TAO_IMR_CLIENT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+#endif /* TAO_IMR_CLIENT_HAS_DLL == 1 */
+
+#endif /* TAO_IMR_CLIENT_EXPORT_H */
+
+// End of auto generated file.
diff --git a/TAO/tao/Incoming_Message_Queue.cpp b/TAO/tao/Incoming_Message_Queue.cpp
new file mode 100644
index 00000000000..155b87b4c82
--- /dev/null
+++ b/TAO/tao/Incoming_Message_Queue.cpp
@@ -0,0 +1,379 @@
+#include "tao/Incoming_Message_Queue.h"
+#include "tao/debug.h"
+
+#include "ace/Log_Msg.h"
+#include "ace/Malloc_Base.h"
+
+
+#if !defined (__ACE_INLINE__)
+# include "tao/Incoming_Message_Queue.inl"
+#endif /* __ACE_INLINE__ */
+
+
+ACE_RCSID (tao,
+ Incoming_Message_Queue,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Incoming_Message_Queue::TAO_Incoming_Message_Queue (TAO_ORB_Core *orb_core)
+ : last_added_ (0),
+ size_ (0),
+ orb_core_ (orb_core)
+{
+}
+
+TAO_Incoming_Message_Queue::~TAO_Incoming_Message_Queue (void)
+{
+ const CORBA::ULong sz = this->size_;
+
+ // Delete all the nodes left behind
+ for (CORBA::ULong i = 0;
+ i < sz;
+ ++i)
+ {
+ TAO_Queued_Data *qd = this->dequeue_head ();
+ TAO_Queued_Data::release (qd);
+ }
+}
+
+
+TAO_Queued_Data *
+TAO_Incoming_Message_Queue::dequeue_head (void)
+{
+ if (this->size_ == 0)
+ return 0;
+
+ // Get the node on the head of the queue...
+ TAO_Queued_Data * const head = this->last_added_->next_;
+
+ // Reset the head node..
+ this->last_added_->next_ = head->next_;
+
+ // Decrease the size and reset last_added_ if empty
+ if (--this->size_ == 0)
+ this->last_added_ = 0;
+
+ return head;
+}
+
+TAO_Queued_Data *
+TAO_Incoming_Message_Queue::dequeue_tail (void)
+{
+ // This is a bit painful stuff...
+ if (this->size_ == 0)
+ return 0;
+
+ // Get the node on the head of the queue...
+ TAO_Queued_Data *head =
+ this->last_added_->next_;
+
+ while (head->next_ != this->last_added_)
+ {
+ head = head->next_;
+ }
+
+ // Put the head in tmp.
+ head->next_ = this->last_added_->next_;
+
+ TAO_Queued_Data *ret_qd = this->last_added_;
+
+ this->last_added_ = head;
+
+ // Decrease the size
+ if (--this->size_ == 0)
+ this->last_added_ = 0;
+
+ return ret_qd;
+}
+
+int
+TAO_Incoming_Message_Queue::enqueue_tail (TAO_Queued_Data *nd)
+{
+ if (this->size_ == 0)
+ {
+ this->last_added_ = nd;
+ this->last_added_->next_ = this->last_added_;
+ }
+ else
+ {
+ nd->next_ = this->last_added_->next_;
+ this->last_added_->next_ = nd;
+ this->last_added_ = nd;
+ }
+
+ ++ this->size_;
+ return 0;
+}
+
+
+/************************************************************************/
+// Methods for TAO_Queued_Data
+/************************************************************************/
+
+/*!
+ * @brief Allocate and return a new empty message block of size \a span_size
+ * mimicking parameters of \a mb.
+ *
+ * This function allocates a new aligned message block using the same
+ * allocators and flags as found in \a mb. The size of the new message
+ * block is at least \a span_size; the size may be adjusted up in order
+ * to accomodate alignment requirements and still fit \a span_size bytes
+ * into the aligned buffer.
+ *
+ * @param mb message block whose parameters should be mimicked
+ * @param span_size size of the new message block (will be adjusted for proper
+ * alignment)
+ * @return an aligned message block with rd_ptr sitting at correct
+ * alignment spot, 0 on failure
+ */
+static ACE_Message_Block*
+clone_mb_nocopy_size (ACE_Message_Block *mb, size_t span_size)
+{
+ // Calculate the required size of the cloned block with alignment
+ size_t const aligned_size = ACE_CDR::first_size (span_size + ACE_CDR::MAX_ALIGNMENT);
+
+ // Get the allocators
+ ACE_Allocator *data_allocator = 0;
+ ACE_Allocator *data_block_allocator = 0;
+ ACE_Allocator *message_block_allocator = 0;
+ mb->access_allocators (data_allocator,
+ data_block_allocator,
+ message_block_allocator);
+
+ // Create a new Message Block
+ ACE_Message_Block *nb = 0;
+ ACE_NEW_MALLOC_RETURN (nb,
+ static_cast<ACE_Message_Block*> (
+ message_block_allocator->malloc (
+ sizeof (ACE_Message_Block))),
+ ACE_Message_Block(aligned_size,
+ mb->msg_type(),
+ mb->cont(),
+ 0, //we want the data block created
+ data_allocator,
+ mb->locking_strategy(),
+ mb->msg_priority(),
+ mb->msg_execution_time (),
+ mb->msg_deadline_time (),
+ data_block_allocator,
+ message_block_allocator),
+ 0);
+
+ ACE_CDR::mb_align (nb);
+
+ // Copy the flags over, but be SURE to clear the DONT_DELETE flag, since
+ // we just dynamically allocated the two things.
+ nb->set_flags (mb->flags());
+ nb->clr_flags (ACE_Message_Block::DONT_DELETE);
+
+ return nb;
+}
+
+TAO_Queued_Data::TAO_Queued_Data (ACE_Allocator *alloc)
+ : msg_block_ (0),
+ missing_data_ (0),
+ major_version_ (0),
+ minor_version_ (0),
+ byte_order_ (0),
+ more_fragments_ (0),
+ msg_type_ (TAO_PLUGGABLE_MESSAGE_MESSAGERROR),
+ next_ (0),
+ allocator_ (alloc)
+{
+}
+
+TAO_Queued_Data::TAO_Queued_Data (ACE_Message_Block *mb,
+ ACE_Allocator *alloc)
+ : msg_block_ (mb),
+ missing_data_ (0),
+ major_version_ (0),
+ minor_version_ (0),
+ byte_order_ (0),
+ more_fragments_ (0),
+ msg_type_ (TAO_PLUGGABLE_MESSAGE_MESSAGERROR),
+ next_ (0),
+ allocator_ (alloc)
+{
+}
+
+TAO_Queued_Data::TAO_Queued_Data (const TAO_Queued_Data &qd)
+ : msg_block_ (qd.msg_block_->duplicate ()),
+ missing_data_ (qd.missing_data_),
+ major_version_ (qd.major_version_),
+ minor_version_ (qd.minor_version_),
+ byte_order_ (qd.byte_order_),
+ more_fragments_ (qd.more_fragments_),
+ msg_type_ (qd.msg_type_),
+ next_ (0),
+ allocator_ (qd.allocator_)
+{
+}
+
+/*static*/
+TAO_Queued_Data *
+TAO_Queued_Data::make_queued_data (ACE_Allocator *message_buffer_alloc,
+ ACE_Allocator *input_cdr_alloc,
+ ACE_Data_Block *db)
+{
+ // Get a node for the queue..
+ TAO_Queued_Data *qd = 0;
+
+ if (message_buffer_alloc)
+ {
+ ACE_NEW_MALLOC_RETURN (qd,
+ static_cast<TAO_Queued_Data *> (
+ message_buffer_alloc->malloc (sizeof (TAO_Queued_Data))),
+ TAO_Queued_Data (message_buffer_alloc),
+ 0);
+
+ }
+ else
+ {
+ // No allocator, so use the global pool!
+ ACE_NEW_RETURN (qd,
+ TAO_Queued_Data,
+ 0);
+ }
+
+ // Providing an ACE_Data_Block indicates that the caller wants
+ // an aligned ACE_Message_Block added to the TAO_Queued_Data.
+ if (db != 0)
+ {
+ // If this allocation fails, the TAO_Queued_Data will be leaked.
+ if (input_cdr_alloc == 0)
+ ACE_NEW_RETURN (qd->msg_block_,
+ ACE_Message_Block (db,
+ 0,
+ input_cdr_alloc),
+ 0);
+ else
+ ACE_NEW_MALLOC_RETURN (qd->msg_block_,
+ static_cast<ACE_Message_Block*> (
+ input_cdr_alloc->malloc (sizeof (ACE_Message_Block))),
+ ACE_Message_Block (db,
+ 0,
+ input_cdr_alloc),
+ 0);
+
+ ACE_CDR::mb_align (qd->msg_block_);
+ }
+
+ return qd;
+}
+
+/*static*/
+void
+TAO_Queued_Data::release (TAO_Queued_Data *qd)
+{
+ //// TODO
+ ACE_Message_Block::release (qd->msg_block_);
+
+ if (qd->allocator_)
+ {
+ ACE_DES_FREE (qd,
+ qd->allocator_->free,
+ TAO_Queued_Data);
+
+ return;
+ }
+
+ // @@todo: Need to be removed at some point of time!
+ if (TAO_debug_level == 4)
+ {
+ // This debug is for testing purposes!
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - Queued_Data[%d]::release\n",
+ "Using global pool for releasing \n"));
+ }
+ delete qd;
+
+}
+
+
+TAO_Queued_Data *
+TAO_Queued_Data::duplicate (TAO_Queued_Data &sqd)
+{
+ // Check to see if the underlying block is on the stack. If not it
+ // is fine. If the datablock is on stack, try to make a copy of that
+ // before doing a duplicate.
+ // @@ todo: Theoretically this should be within the Message Block,
+ // but we dont have much scope to do this in that mess. Probably in
+ // the next stage of MB rewrite we should be okay
+ ACE_Message_Block::Message_Flags fl =
+ sqd.msg_block_->self_flags ();
+
+ if (ACE_BIT_ENABLED (fl,
+ ACE_Message_Block::DONT_DELETE))
+ (void) TAO_Queued_Data::replace_data_block (*sqd.msg_block_);
+
+
+ TAO_Queued_Data *qd = 0;
+
+ if (sqd.allocator_)
+ {
+ ACE_NEW_MALLOC_RETURN (qd,
+ static_cast<TAO_Queued_Data *> (
+ sqd.allocator_->malloc (sizeof (TAO_Queued_Data))),
+ TAO_Queued_Data (sqd),
+ 0);
+
+ return qd;
+ }
+
+ // No allocator, so use the global pool!
+ // @@ TODO: We should be removing this at some point of time!
+ if (TAO_debug_level == 4)
+ {
+ // This debug is for testing purposes!
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - Queued_Data[%d]::duplicate\n",
+ "Using global pool for allocation \n"));
+ }
+
+ ACE_NEW_RETURN (qd,
+ TAO_Queued_Data (sqd),
+ 0);
+
+ return qd;
+}
+
+int
+TAO_Queued_Data::consolidate (void)
+{
+ // Is this a chain of fragments?
+ if (this->more_fragments_ && this->msg_block_->cont () != 0)
+ {
+ // Create a message block big enough to hold the entire chain
+ ACE_Message_Block *dest = clone_mb_nocopy_size (
+ this->msg_block_,
+ this->msg_block_->total_length ());
+
+ if (0 == dest)
+ {
+ // out of memory
+ return -1;
+ }
+ // Memory allocation succeeded, the new message block can hold the consolidated
+ // message. The following code just copies all the data into this new message block.
+ // No further memory allocation will take place.
+
+ // Reset the cont() parameter. We have cloned the message
+ // block but not the chain as we will no longer have chain.
+ dest->cont (0);
+
+ // Use ACE_CDR to consolidate the chain for us
+ ACE_CDR::consolidate (dest, this->msg_block_);
+
+ // free the original message block chain
+ this->msg_block_->release ();
+
+ // Set the message block to the new consolidated message block
+ this->msg_block_ = dest;
+ this->more_fragments_ = 0;
+ }
+
+ return 0;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Incoming_Message_Queue.h b/TAO/tao/Incoming_Message_Queue.h
new file mode 100644
index 00000000000..a70bfcbbcda
--- /dev/null
+++ b/TAO/tao/Incoming_Message_Queue.h
@@ -0,0 +1,205 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Incoming_Message_Queue.h
+ *
+ * $Id$
+ *
+ * @author Balachandran Natarajan <bala@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_INCOMING_MESSAGE_QUEUE_H
+#define TAO_INCOMING_MESSAGE_QUEUE_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Pluggable_Messaging_Utils.h"
+#include "ace/Message_Block.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+class ACE_Allocator;
+ACE_END_VERSIONED_NAMESPACE_DECL
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_ORB_Core;
+class TAO_Queued_Data;
+class TAO_Transport;
+
+/**
+ * @class TAO_Incoming_Message_Queue
+ *
+ * @brief A queue of the messages in the incoming data path.
+ *
+ * Please read the documentation in the TAO_Transport class to find
+ * out more about the design of the incoming data path.
+ *
+ * Under certain conditions TAO may have to maintain a queue
+ * per-connection. This queue is drained by the pluggable
+ * protocols framework, normally under control of the ACE_Reactor, but
+ * other configurations are conceivable.
+ *
+ * The memory that is allocated for holding the messages comes from
+ * the global pool for the following reasons
+ *
+ * - the thread that reads a part of the message would not be the same
+ * thread that reads and fills the rest of the message
+ * - the thread that actually processes the message can be totally
+ * different.
+ *
+ */
+
+class TAO_Export TAO_Incoming_Message_Queue
+{
+public:
+
+ /// Constructor.
+ TAO_Incoming_Message_Queue (TAO_ORB_Core *orb_core);
+
+ /// Destructor.
+ ~TAO_Incoming_Message_Queue (void);
+
+ /// Adding and deleting a node from the queue.
+ TAO_Queued_Data *dequeue_head (void);
+ TAO_Queued_Data *dequeue_tail (void);
+ int enqueue_tail (TAO_Queued_Data *nd);
+
+ /// Return the length of the queue..
+ CORBA::ULong queue_length (void) const;
+
+private:
+
+ friend class TAO_Transport;
+
+private:
+ /*!
+ \brief A circular linked list of messages awaiting processing.
+
+ \a last_message_added_ points to the most recent message added to
+ the list. The earliest addition can be easily accessed via
+ \a last_message_added_->next_.
+ */
+ TAO_Queued_Data *last_added_;
+
+ /// The size of the queue
+ CORBA::ULong size_;
+
+ /// Copy of our ORB Core
+ TAO_ORB_Core *orb_core_;
+};
+
+/// Constant value indicating that the correct value is unknown yet,
+/// probably parsing the header failed due to insufficient data in buffer.
+const size_t TAO_MISSING_DATA_UNDEFINED = ~((size_t) 0); // MAX_SIZE_T
+
+/************************************************************************/
+
+/**
+ * @class TAO_Queued_Data
+ *
+ * @brief Represents a node in the queue of incoming messages.
+ *
+ * This class contains necessary information about a message that is
+ * stored in the queue. Such a node can be used by the incoming thread
+ * from the reactor to dequeue and process the message by sending it
+ * to the higher layers of the ORB.
+ *
+ * The ACE_Message_Block contained within this class may contain a chain
+ * of message blocks (usually when GIOP fragments are involved). In that
+ * case consolidate () needs to be called prior to being sent to higher
+ * layers of the ORB when the GIOP fragment chain is complete.
+ */
+
+class TAO_Export TAO_Queued_Data
+{
+public:
+ /// Default Constructor
+ TAO_Queued_Data (ACE_Allocator *alloc = 0);
+
+ /// Constructor.
+ TAO_Queued_Data (ACE_Message_Block *mb, ACE_Allocator *alloc = 0);
+
+ /// Copy constructor.
+ TAO_Queued_Data (const TAO_Queued_Data &qd);
+
+ /// Creation of a node in the queue.
+ static TAO_Queued_Data* make_queued_data (
+ ACE_Allocator *message_buffer_alloc = 0,
+ ACE_Allocator *input_cdr_alloc = 0,
+ ACE_Data_Block *db = 0);
+
+ /// Deletion of a node from the queue.
+ static void release (TAO_Queued_Data *qd);
+
+ /// Duplicate ourselves. This creates a copy of ourselves on the
+ /// heap and returns a pointer to the duplicated node.
+ static TAO_Queued_Data* duplicate (TAO_Queued_Data &qd);
+
+ /// Consolidate this fragments chained message blocks into one.
+ /// @return -1 if consolidation failed, eg out or memory, otherwise 0
+ int consolidate (void);
+
+public:
+
+ /// The message block that contains the message.
+ ACE_Message_Block *msg_block_;
+
+ /*!
+ @name Missing Data details
+
+ The \a missing_data_ member contains the number of bytes of
+ data missing from \a msg_block_.
+ */
+ //@{
+ /*! Data missing in the above message that hasn't been read or processed yet,
+ the value TAO_MISSING_DATA_UNDEFINED indicates it hasn't been processed yet,
+ otherwise greater or equal zero. */
+ size_t missing_data_;
+ //@}
+
+ /// Many protocols like GIOP have a major and minor version
+ /// information that would be needed to read and decipher the
+ /// message.
+ CORBA::Octet major_version_;
+ CORBA::Octet minor_version_;
+
+ /// The byte order of the message that is stored in the node.
+ CORBA::Octet byte_order_;
+
+ /// Some messages can be fragmented by the protocol (this is an ORB
+ /// level fragmentation on top of the TCP/IP fragmentation. This
+ /// member indicates whether the message that we have recd. and
+ /// queue already has more fragments that is missing..
+ CORBA::Octet more_fragments_;
+
+ /// The message type of the message
+ TAO_Pluggable_Message_Type msg_type_;
+
+ /// Pounter to the next element in the queue.
+ TAO_Queued_Data *next_;
+
+private:
+ /// Replace the datablock with a one allocated on the heap or
+ /// allocator
+ static void replace_data_block (ACE_Message_Block &mb);
+
+private:
+
+ /// The allocator used to allocate this class.
+ ACE_Allocator *allocator_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/Incoming_Message_Queue.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+#endif /*TAO_INCOMING_MESSAGE_QUEUE_H*/
diff --git a/TAO/tao/Incoming_Message_Queue.inl b/TAO/tao/Incoming_Message_Queue.inl
new file mode 100644
index 00000000000..76235e843e9
--- /dev/null
+++ b/TAO/tao/Incoming_Message_Queue.inl
@@ -0,0 +1,46 @@
+// -*- C++ -*-
+//
+//$Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/************************************************************************/
+// Methods for TAO_Incoming_Message_Queue
+/************************************************************************/
+ACE_INLINE CORBA::ULong
+TAO_Incoming_Message_Queue::queue_length (void) const
+{
+ return this->size_;
+}
+
+/************************************************************************/
+// Methods for TAO_Queued_Data
+/************************************************************************/
+
+/*static*/
+ACE_INLINE void
+TAO_Queued_Data::replace_data_block (ACE_Message_Block &mb)
+{
+ size_t const newsize =
+ ACE_CDR::total_length (&mb, 0) + ACE_CDR::MAX_ALIGNMENT;
+
+ ACE_Data_Block *db =
+ mb.data_block ()->clone_nocopy ();
+
+ if (db->size (newsize) == -1)
+ return;
+
+ ACE_Message_Block tmp (db);
+ ACE_CDR::mb_align (&tmp);
+
+ tmp.copy (mb.rd_ptr (), mb.length());
+ mb.data_block (tmp.data_block ()->duplicate ());
+
+ mb.rd_ptr (tmp.rd_ptr ());
+ mb.wr_ptr (tmp.wr_ptr ());
+
+ // Remove the DONT_DELETE flags from mb
+ mb.clr_self_flags (ACE_Message_Block::DONT_DELETE);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Incoming_Message_Stack.cpp b/TAO/tao/Incoming_Message_Stack.cpp
new file mode 100644
index 00000000000..2d5627fd3d5
--- /dev/null
+++ b/TAO/tao/Incoming_Message_Stack.cpp
@@ -0,0 +1,11 @@
+
+# include "tao/Incoming_Message_Stack.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/Incoming_Message_Stack.inl"
+#endif /* __ACE_INLINE__ */
+
+ACE_RCSID (tao,
+ Incoming_Message_Stack,
+ "$Id$")
+
diff --git a/TAO/tao/Incoming_Message_Stack.h b/TAO/tao/Incoming_Message_Stack.h
new file mode 100755
index 00000000000..81f268aa2cb
--- /dev/null
+++ b/TAO/tao/Incoming_Message_Stack.h
@@ -0,0 +1,89 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Incoming_Message_Stack.h
+ *
+ * $Id$
+ *
+ * @author Frank Rehberger <frehberg@prismtech.com>
+ */
+//=============================================================================
+
+#ifndef TAO_INCOMING_MESSAGE_STACK_H
+#define TAO_INCOMING_MESSAGE_STACK_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Incoming_Message_Queue.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if defined (__BORLANDC__) && (__BORLANDC__ <= 0x582)
+#include "tao/TAO_Export.h"
+#endif
+
+ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+class ACE_Allocator;
+ACE_END_VERSIONED_NAMESPACE_DECL
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+/**
+ * @class Incoming_Message_Stack
+ *
+ * @brief Implements stack for TAO_Queued_Data.
+ *
+ * Internal class, providing stack functionality for TAO_Queued_Data
+ * objects. Stack operations don't require memory allocation.
+*/
+#if defined (__BORLANDC__) && (__BORLANDC__ <= 0x582)
+class TAO_Export Incoming_Message_Stack
+#else
+class Incoming_Message_Stack
+#endif
+{
+public:
+ /// default constructor, intiliazes empty stack.
+ Incoming_Message_Stack();
+
+ /// destructor, releases all elements on stack
+ ~Incoming_Message_Stack() ;
+
+ /// pushing a new element onto stack,
+ /// @a data must be a valid pointer, not NULL
+ void push(TAO_Queued_Data *data);
+
+ /// removing top element of stack,
+ /// @return 0 for Ok and @a data is defined, -1 for error
+ int pop (TAO_Queued_Data* &data);
+
+ /// peeking top element of stack
+ /// @return 0 for Ok, -1 for error
+ int top (TAO_Queued_Data* &data);
+
+private:
+ /// top element of stack
+ TAO_Queued_Data *top_;
+
+private:
+ /// Default Copy-Constructor - not for public usage.
+ Incoming_Message_Stack (const Incoming_Message_Stack&);
+
+ /// Assignment operator - not for public usage
+ Incoming_Message_Stack& operator= (Incoming_Message_Stack& other);
+};
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/Incoming_Message_Stack.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+#endif /*TAO_INCOMING_MESSAGE_STACK_H*/
diff --git a/TAO/tao/Incoming_Message_Stack.inl b/TAO/tao/Incoming_Message_Stack.inl
new file mode 100755
index 00000000000..fd13e03a54e
--- /dev/null
+++ b/TAO/tao/Incoming_Message_Stack.inl
@@ -0,0 +1,63 @@
+// -*- C++ -*-
+//
+//$Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/************************************************************************/
+// Methods for TAO_Incoming_Message_Stack
+/************************************************************************/
+namespace TAO
+{
+ACE_INLINE
+Incoming_Message_Stack::Incoming_Message_Stack()
+: top_(0)
+{
+}
+
+ACE_INLINE
+Incoming_Message_Stack::~Incoming_Message_Stack()
+{
+ // Delete all the nodes left behind
+ TAO_Queued_Data *del = 0;
+
+ while (this->pop (del) != -1)
+ {
+ TAO_Queued_Data::release (del);
+ }
+}
+
+ACE_INLINE void
+Incoming_Message_Stack::push(TAO_Queued_Data *data)
+{
+ data->next_ = this->top_;
+ this->top_ = data;
+}
+
+
+ /* @return 0 for Ok, -1 for error */
+ACE_INLINE int
+Incoming_Message_Stack::pop (TAO_Queued_Data* &data)
+{
+ if (this->top_ == 0)
+ return -1;
+
+ data = this->top_;
+ this->top_ = data->next_;
+
+ return 0;
+}
+
+ACE_INLINE int
+Incoming_Message_Stack::top (TAO_Queued_Data* &data)
+{
+ if (this->top_ == 0)
+ return -1;
+
+ data = this->top_;
+
+ return 0;
+}
+
+} /* namespace TAO */
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/InterfaceDef.pidl b/TAO/tao/InterfaceDef.pidl
new file mode 100644
index 00000000000..63eb842b319
--- /dev/null
+++ b/TAO/tao/InterfaceDef.pidl
@@ -0,0 +1,26 @@
+/**
+ * @file InterfaceDef.pidl
+ *
+ * $Id$
+ *
+ * @brief Define the CORBA::InterfaceDef type.
+ *
+ * This file is used to provide a definition for the CORBA::InterfaceDef
+ * type, it is *NOT* pre-compiled, but included from other
+ * pre-compiled files.
+ *
+ */
+
+#ifndef TAO_CORBA_INTERFACEDEF_PIDL
+#define TAO_CORBA_INTERFACEDEF_PIDL
+
+#pragma prefix "omg.org"
+
+module CORBA
+{
+ interface InterfaceDef;
+};
+
+#pragma prefix ""
+
+#endif /* TAO_CORBA_INTERFACEDEF_PIDL */
diff --git a/TAO/tao/Intrusive_Ref_Count_Base_T.cpp b/TAO/tao/Intrusive_Ref_Count_Base_T.cpp
new file mode 100644
index 00000000000..2e25bad2b53
--- /dev/null
+++ b/TAO/tao/Intrusive_Ref_Count_Base_T.cpp
@@ -0,0 +1,21 @@
+// $Id$
+
+#ifndef TAO_INTRUSIVE_REF_COUNT_BASE_T_CPP
+#define TAO_INTRUSIVE_REF_COUNT_BASE_T_CPP
+
+#include "tao/Intrusive_Ref_Count_Base_T.h"
+
+#if !defined (__ACE_INLINE__)
+#include "tao/Intrusive_Ref_Count_Base_T.inl"
+#endif /* __ACE_INLINE__ */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template <typename T>
+TAO_Intrusive_Ref_Count_Base<T>::~TAO_Intrusive_Ref_Count_Base()
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_INTRUSIVE_REF_COUNT_BASE_T_CPP */
diff --git a/TAO/tao/Intrusive_Ref_Count_Base_T.h b/TAO/tao/Intrusive_Ref_Count_Base_T.h
new file mode 100644
index 00000000000..6c596d8f0f8
--- /dev/null
+++ b/TAO/tao/Intrusive_Ref_Count_Base_T.h
@@ -0,0 +1,80 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Intrusive_Ref_Count_Base_T.h
+ *
+ * $Id$
+ *
+ * @authors Tim Bradley <bradley_t@ociweb.com>
+ */
+//=============================================================================
+
+#ifndef TAO_INTRUSIVE_REF_COUNT_BASE_T_H
+#define TAO_INTRUSIVE_REF_COUNT_BASE_T_H
+
+#include /**/ "ace/pre.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Versioned_Namespace.h"
+
+#include "ace/Atomic_Op.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_Intrusive_Ref_Count_Base<ACE_LOCK>
+ *
+ * @brief Template base class to provide intrusive reference-counting
+ * to subclasses. This makes the subclass capable of using a
+ * TAO_Intrusive_Ref_Count_Handle<X> class as a smart-pointer
+ * to an X object. In this case, X is a sub-class of this class,
+ * TAO_Intrusive_Ref_Count_Base<ACE_LOCK>. The ACE_LOCK type is
+ * used to protect the atomic reference count data member.
+ *
+ */
+template <class ACE_LOCK>
+class TAO_Intrusive_Ref_Count_Base
+{
+public:
+
+ virtual ~TAO_Intrusive_Ref_Count_Base (void);
+
+ void _add_ref (void);
+ void _remove_ref (void);
+
+
+protected:
+
+ TAO_Intrusive_Ref_Count_Base (void);
+
+
+private:
+
+ ACE_Atomic_Op<ACE_LOCK, long> ref_count_;
+
+ // Prevent copying/assignment.
+ TAO_Intrusive_Ref_Count_Base (const TAO_Intrusive_Ref_Count_Base&);
+ TAO_Intrusive_Ref_Count_Base& operator= (const TAO_Intrusive_Ref_Count_Base&);
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+#include "tao/Intrusive_Ref_Count_Base_T.inl"
+#endif /* __ACE_INLINE__ */
+
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+#include "tao/Intrusive_Ref_Count_Base_T.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
+#pragma implementation ("Intrusive_Ref_Count_Base_T.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_INTRUSIVE_REF_COUNT_BASE_T_H */
diff --git a/TAO/tao/Intrusive_Ref_Count_Base_T.inl b/TAO/tao/Intrusive_Ref_Count_Base_T.inl
new file mode 100644
index 00000000000..26e5026c413
--- /dev/null
+++ b/TAO/tao/Intrusive_Ref_Count_Base_T.inl
@@ -0,0 +1,38 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template <typename T>
+ACE_INLINE
+TAO_Intrusive_Ref_Count_Base<T>::TAO_Intrusive_Ref_Count_Base (void)
+ : ref_count_(1)
+{}
+
+
+template <typename T>
+ACE_INLINE
+void
+TAO_Intrusive_Ref_Count_Base<T>::_add_ref (void)
+{
+ ++this->ref_count_;
+}
+
+
+template <typename T>
+ACE_INLINE
+void
+TAO_Intrusive_Ref_Count_Base<T>::_remove_ref (void)
+{
+ long const new_count = --this->ref_count_;
+
+ if (new_count != 0)
+ {
+ return;
+ }
+
+ delete this;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Intrusive_Ref_Count_Handle_T.cpp b/TAO/tao/Intrusive_Ref_Count_Handle_T.cpp
new file mode 100644
index 00000000000..5c8d02b76ba
--- /dev/null
+++ b/TAO/tao/Intrusive_Ref_Count_Handle_T.cpp
@@ -0,0 +1,12 @@
+// $Id$
+
+#ifndef TAO_INTRUSIVE_REF_COUNT_HANDLE_T_CPP
+#define TAO_INTRUSIVE_REF_COUNT_HANDLE_T_CPP
+
+#include "tao/Intrusive_Ref_Count_Handle_T.h"
+
+#if !defined (__ACE_INLINE__)
+#include "tao/Intrusive_Ref_Count_Handle_T.inl"
+#endif /* __ACE_INLINE__ */
+
+#endif /* TAO_INTRUSIVE_REF_COUNT_HANDLE_T_CPP */
diff --git a/TAO/tao/Intrusive_Ref_Count_Handle_T.h b/TAO/tao/Intrusive_Ref_Count_Handle_T.h
new file mode 100644
index 00000000000..5138d3ad281
--- /dev/null
+++ b/TAO/tao/Intrusive_Ref_Count_Handle_T.h
@@ -0,0 +1,159 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Intrusive_Ref_Count_Handle_T.h
+ *
+ * $Id$
+ *
+ * @authors Tim Bradley <bradley_t@ociweb.com>
+ */
+//=============================================================================
+
+#ifndef TAO_INTRUSIVE_REF_COUNT_HANDLE_T_H
+#define TAO_INTRUSIVE_REF_COUNT_HANDLE_T_H
+
+#include /**/ "ace/pre.h"
+
+#include "ace/config-all.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Versioned_Namespace.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_Intrusive_Ref_Count_Handle<T>
+ *
+ * @brief Template class for smart-pointer to (intrusively) ref-counted object.
+ *
+ * This class behaves just like a xxx_var type behaves. The only significant
+ * difference is that this class provides a "bool is_nil() const" method,
+ * and xxx_var types don't (they use the "bool CORBA::is_nil(xxx_ptr ptr)"
+ * method instead). For example,
+ *
+ * typedef TAO_Intrusive_Ref_Count_Handle<PortableServer::ServantBase>
+ * MyServantBase_var;
+ *
+ * The MyServantBase_var and the PortableServer::ServantBase_var are
+ * nearly idenitical. The only difference is that the MyServantBase_var
+ * has a "isNil()" method that indicates whether or not the smart pointer
+ * is in the 'nil' state or not.
+ *
+ * This class can be used to "safely" deal with an instance of a servant.
+ * For example, we can use a single variable
+ * TAO_Intrusive_Ref_Count_Handle<Foo_i>
+ *
+ * typedef TAO_Intrusive_Ref_Count_Handle<Foo_i> Foo_i_var;
+ * Foo_i_var servant_;
+ *
+ * instead of using two variables
+ *
+ * PortableServer::ServantBase_var servant_holder_;
+ * Foo_i* servant_;
+
+ * to deal with the servant memory.
+ *
+ * The Foo_i_var type does everything that the PortableServer::ServantBase_var
+ * type does. In addition, the Foo_i_var type can provide access to the servant
+ * as derived class via the arrow operator.
+ */
+template <typename T>
+class TAO_Intrusive_Ref_Count_Handle
+{
+public:
+
+ /// Default Constructor - enters the "nil" state.
+ TAO_Intrusive_Ref_Count_Handle (void);
+
+ /// Ctor - By default, takes ownership of passed-in "copy" of reference
+ /// to T. But the second argument (bool) can be changed from
+ /// the default value of 'true' to the non-default value of 'false'.
+ /// The second argument dictates whether or not this handle object
+ /// should take ownership of the passed-in pointer to the T object.
+ /// By default, it takes ownership, leaving the reference counter
+ /// of the T object unchanged. When it is instructed to not take
+ /// ownership (false value for second arg), then the reference
+ /// counter of the T object will be incremented so that this
+ /// handle object has its own "copy".
+ TAO_Intrusive_Ref_Count_Handle (T* p, bool take_ownership = true);
+
+ /// Copy Constructor - claims a "copy" of rhs object's reference to T.
+ TAO_Intrusive_Ref_Count_Handle (const TAO_Intrusive_Ref_Count_Handle& b);
+
+ /// Destructor
+ ~TAO_Intrusive_Ref_Count_Handle (void);
+
+ /// Assignment Operator with T* argument.
+ /// Takes ownership of passed-in "copy" of reference to T.
+ TAO_Intrusive_Ref_Count_Handle& operator= (T* p);
+
+ /// Assignment Operator with const TAO_Smart_Ptr<T>& argument.
+ /// Claims a "copy" of rhs object's reference to T.
+ TAO_Intrusive_Ref_Count_Handle& operator=
+ (const TAO_Intrusive_Ref_Count_Handle& b);
+
+ /// Const Accessor to underlying pointer (T*) using arrow (->) operator.
+ T* operator->() const;
+
+ /// Returns true if underlying pointer is NULL (0).
+ /// Returns false otherwise.
+ bool is_nil (void) const;
+
+ /// Used to pass the underlying pointer as an "IN" argument to a method.
+ T* in (void) const;
+
+ /// Used to pass the underlying pointer as an "IN/OUT" argument to a method.
+ T*& inout (void);
+
+ /// Used to pass the underlying pointer as an "OUT" argument to a method.
+ T*& out (void);
+
+ /// Used to take-away the underlying pointer from this smart pointer object.
+ /// Caller becomes responsibe for the returned "copy" to the reference.
+ /// Always leaves the smart pointer in the "nil" state upon return.
+ T* _retn (void);
+
+
+private:
+
+ /// Claim a "copy" of the reference-counted object by adding
+ /// one to its reference counter. Do nothing if this smart pointer
+ /// object is currently in the "nil" state.
+ void claim (void);
+
+ /// Drop our "copy" of the reference-counted object by removing
+ /// one from its reference counter. Do nothing if this smart pointer
+ /// object is currently in the "nil" state.
+ /// Note that this method will always leave this smart pointer
+ /// in the "nil" state upon its return.
+ void drop (void);
+
+
+ /// The underlying pointer to the (intrusively) reference-counted object.
+ /// Set to 0 when this smart pointer is in the "nil" state. Otherwise,
+ /// this smart pointer always owns a (reference-counted) "copy" of the
+ /// object pointed to by the ptr_ data member.
+ T* ptr_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+#include "tao/Intrusive_Ref_Count_Handle_T.inl"
+#endif /* __ACE_INLINE__ */
+
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+#include "tao/Intrusive_Ref_Count_Handle_T.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
+#pragma implementation ("Intrusive_Ref_Count_Handle_T.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_INTRUSIVE_REF_COUNT_HANDLE_T_H */
diff --git a/TAO/tao/Intrusive_Ref_Count_Handle_T.inl b/TAO/tao/Intrusive_Ref_Count_Handle_T.inl
new file mode 100644
index 00000000000..a1ff0e5c12c
--- /dev/null
+++ b/TAO/tao/Intrusive_Ref_Count_Handle_T.inl
@@ -0,0 +1,157 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template <typename T>
+ACE_INLINE
+TAO_Intrusive_Ref_Count_Handle<T>::TAO_Intrusive_Ref_Count_Handle (void)
+ : ptr_(0)
+{
+}
+
+
+template <typename T>
+ACE_INLINE
+TAO_Intrusive_Ref_Count_Handle<T>::TAO_Intrusive_Ref_Count_Handle (
+ T* p,
+ bool take_ownership)
+ : ptr_(p)
+{
+ if (!take_ownership)
+ {
+ this->claim ();
+ }
+}
+
+
+template <typename T>
+ACE_INLINE
+TAO_Intrusive_Ref_Count_Handle<T>::TAO_Intrusive_Ref_Count_Handle (
+ const TAO_Intrusive_Ref_Count_Handle<T>& b)
+ : ptr_(b.ptr_)
+{
+ this->claim();
+}
+
+
+template <typename T>
+ACE_INLINE
+TAO_Intrusive_Ref_Count_Handle<T>::~TAO_Intrusive_Ref_Count_Handle()
+{
+ this->drop();
+}
+
+
+template <typename T>
+ACE_INLINE
+TAO_Intrusive_Ref_Count_Handle<T>&
+TAO_Intrusive_Ref_Count_Handle<T>::operator=(T* p)
+{
+ TAO_Intrusive_Ref_Count_Handle<T> tmp (p);
+ return this->operator= (tmp);
+}
+
+
+template <typename T>
+ACE_INLINE
+TAO_Intrusive_Ref_Count_Handle<T>&
+TAO_Intrusive_Ref_Count_Handle<T>::operator=
+ (const TAO_Intrusive_Ref_Count_Handle<T>& b)
+{
+ // Strongly exception-safe assignment through the usual copy and
+ // swap technique.
+
+ TAO_Intrusive_Ref_Count_Handle<T> tmp (b);
+
+ T * old_ptr = this->ptr_;
+ this->ptr_ = tmp.ptr_;
+ tmp.ptr_ = old_ptr;
+
+ return *this;
+}
+
+
+template <typename T>
+ACE_INLINE
+T*
+TAO_Intrusive_Ref_Count_Handle<T>::operator->() const
+{
+ return this->ptr_;
+}
+
+
+template <typename T>
+ACE_INLINE
+bool
+TAO_Intrusive_Ref_Count_Handle<T>::is_nil() const
+{
+ return this->ptr_ == 0;
+}
+
+
+template <typename T>
+ACE_INLINE
+T*
+TAO_Intrusive_Ref_Count_Handle<T>::in() const
+{
+ return this->ptr_;
+}
+
+
+template <typename T>
+ACE_INLINE
+T*&
+TAO_Intrusive_Ref_Count_Handle<T>::inout()
+{
+ return this->ptr_;
+}
+
+
+template <typename T>
+ACE_INLINE
+T*&
+TAO_Intrusive_Ref_Count_Handle<T>::out()
+{
+ this->drop();
+ return this->ptr_;
+}
+
+
+template <typename T>
+ACE_INLINE
+T*
+TAO_Intrusive_Ref_Count_Handle<T>::_retn()
+{
+ T* retval = this->ptr_;
+ this->ptr_ = 0;
+ return retval;
+}
+
+
+template <typename T>
+ACE_INLINE
+void
+TAO_Intrusive_Ref_Count_Handle<T>::claim()
+{
+ if (this->ptr_ != 0)
+ {
+ this->ptr_->_add_ref();
+ }
+}
+
+
+template <typename T>
+ACE_INLINE
+void
+TAO_Intrusive_Ref_Count_Handle<T>::drop()
+{
+ if (this->ptr_ != 0)
+ {
+ this->ptr_->_remove_ref();
+ this->ptr_ = 0;
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/InvalidName.pidl b/TAO/tao/InvalidName.pidl
new file mode 100644
index 00000000000..67546d33943
--- /dev/null
+++ b/TAO/tao/InvalidName.pidl
@@ -0,0 +1,55 @@
+/**
+ * @file InvalidName.pidl
+ *
+ * $Id$
+ *
+ * @brief Pre-compiled IDL source for the CORBA::InvalidName
+ * exception.
+ *
+ * This file is used to generate parts of the code in ORB.{h,i,cpp},
+ * using the following command:
+ *
+ * tao_idl
+ * -o orig -Gp -Gd -Ge 1 -Gv -DCORBA3
+ * -Wb,export_macro=TAO_Export
+ * -Wb,export_include=TAO_Export.h
+ * -Wb,pre_include="ace/pre.h"
+ * -Wb,post_include="ace/post.h"
+ * InvalidName.pidl
+ *
+ * and then:
+ *
+ * patch < diffs/InvalidName.diff
+ *
+ * The code left in InvalidNameC.{h,i,cpp} must then be inserted into
+ * the ORB.{h,i,cpp} files. This sucks, but it is a direct result of
+ * the way the spec is defined, the ORB 'pseudo-interface' cannot be
+ * automatically generated, but it is better to automatically generate
+ * the exception, otherwise they are always out of date when compared
+ * to the rest of ACE+TAO.
+ *
+ */
+#ifndef TAO_CORBA_INVALIDNAME_PIDL
+#define TAO_CORBA_INVALIDNAME_PIDL
+
+#pragma prefix "omg.org"
+
+module CORBA
+{
+ local interface ORB
+ {
+ /**
+ * @exception InvalidName
+ *
+ * @brief UserException for resolve_initial_references()
+ *
+ * This exception is thrown if an 'invalid name' is passed to
+ * the CORBA::ORB::resolve_initial_references() operation.
+ */
+ exception InvalidName {};
+ };
+};
+
+#pragma prefix ""
+
+#endif /* TAO_CORBA_INVALIDNAME_PIDL */
diff --git a/TAO/tao/Invocation_Adapter.cpp b/TAO/tao/Invocation_Adapter.cpp
new file mode 100644
index 00000000000..39ac727b340
--- /dev/null
+++ b/TAO/tao/Invocation_Adapter.cpp
@@ -0,0 +1,421 @@
+//$Id$
+
+#include "tao/Invocation_Adapter.h"
+#include "tao/Profile_Transport_Resolver.h"
+#include "tao/operation_details.h"
+#include "tao/Stub.h"
+#include "tao/ORB_Core.h"
+#include "tao/Synch_Invocation.h"
+#include "tao/debug.h"
+#include "tao/Collocated_Invocation.h"
+#include "tao/Transport.h"
+#include "tao/Transport_Mux_Strategy.h"
+#include "tao/Collocation_Proxy_Broker.h"
+#include "tao/GIOP_Utils.h"
+#if !defined (__ACE_INLINE__)
+# include "tao/Invocation_Adapter.inl"
+#endif /* __ACE_INLINE__ */
+
+
+ACE_RCSID (tao,
+ Invocation_Adapter,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ Invocation_Adapter::~Invocation_Adapter (void)
+ {
+ }
+
+ void
+ Invocation_Adapter::invoke (TAO::Exception_Data *ex_data,
+ unsigned long ex_count
+ ACE_ENV_ARG_DECL)
+ {
+ // Should stub object be refcounted here?
+ TAO_Stub *stub =
+ this->get_stub (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ TAO_Operation_Details op_details (this->operation_,
+ this->op_len_,
+ this->number_args_ > 1,
+ this->args_,
+ this->number_args_,
+ ex_data,
+ ex_count);
+
+ this->invoke_i (stub,
+ op_details
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ void
+ Invocation_Adapter::invoke_i (TAO_Stub *stub,
+ TAO_Operation_Details &details
+ ACE_ENV_ARG_DECL)
+ {
+ // Cache the target to a local variable.
+ CORBA::Object_var effective_target =
+ CORBA::Object::_duplicate (this->target_);
+
+ // Initial state
+ TAO::Invocation_Status status = TAO_INVOKE_START;
+
+ ACE_Time_Value *max_wait_time = 0;
+
+ while (status == TAO_INVOKE_START ||
+ status == TAO_INVOKE_RESTART)
+ {
+ // Default we go to remote
+ Collocation_Strategy strat = TAO_CS_REMOTE_STRATEGY;
+
+ // If we have a collocated proxy broker we look if we maybe
+ // can use a collocated invocation. Similarly, if the
+ // target object reference contains a pointer to a servant,
+ // the object reference also refers to a collocated object.
+ if (cpb_ != 0 || effective_target->_servant () != 0)
+ {
+ strat =
+ TAO_ORB_Core::collocation_strategy (effective_target.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ if (strat == TAO_CS_REMOTE_STRATEGY ||
+ strat == TAO_CS_LAST)
+ {
+ status =
+ this->invoke_remote_i (stub,
+ details,
+ effective_target,
+ max_wait_time
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else
+ {
+ if (strat == TAO_CS_THRU_POA_STRATEGY)
+ {
+ (void) this->set_response_flags (stub,
+ details);
+ }
+
+ status =
+ this->invoke_collocated_i (stub,
+ details,
+ effective_target,
+ strat
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ if (status == TAO_INVOKE_RESTART)
+ {
+ details.reset_request_service_info ();
+ details.reset_reply_service_info ();
+
+ if (TAO_debug_level > 2)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - Invocation_Adapter::invoke_i, "
+ "handling forwarded locations \n"));
+ }
+ }
+ }
+ }
+
+ bool
+ Invocation_Adapter::get_timeout (TAO_Stub *stub,
+ ACE_Time_Value &timeout)
+ {
+ bool has_timeout = false;
+ this->target_->orb_core ()->call_timeout_hook (stub,
+ has_timeout,
+ timeout);
+
+ return has_timeout;
+ }
+
+ TAO_Stub *
+ Invocation_Adapter::get_stub (ACE_ENV_SINGLE_ARG_DECL) const
+ {
+ TAO_Stub * const stub =
+ this->target_->_stubobj ();
+
+ if (stub == 0)
+ ACE_THROW_RETURN (CORBA::INTERNAL (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ EINVAL),
+ CORBA::COMPLETED_NO),
+ stub);
+
+ return stub;
+ }
+
+ Invocation_Status
+ Invocation_Adapter::invoke_collocated_i (TAO_Stub *stub,
+ TAO_Operation_Details &details,
+ CORBA::Object_var &effective_target,
+ Collocation_Strategy strat
+ ACE_ENV_ARG_DECL)
+ {
+ // To make a collocated call we must have a collocated proxy broker, the
+ // invoke_i() will make sure that we only come here when we have one
+ ACE_ASSERT (cpb_ != 0
+ || (strat == TAO_CS_THRU_POA_STRATEGY
+ && effective_target->_servant () != 0));
+
+ // Initial state
+ TAO::Invocation_Status status = TAO_INVOKE_START;
+
+ Collocated_Invocation coll_inv (this->target_,
+ effective_target.in (),
+ stub,
+ details,
+ this->type_ == TAO_TWOWAY_INVOCATION);
+
+ status =
+ coll_inv.invoke (this->cpb_,
+ strat
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO_INVOKE_FAILURE);
+
+ if (status == TAO_INVOKE_RESTART &&
+ coll_inv.is_forwarded ())
+ {
+ effective_target =
+ coll_inv.steal_forwarded_reference ();
+
+#if TAO_HAS_INTERCEPTORS == 1
+ const bool is_permanent_forward =
+ (coll_inv.reply_status() == TAO_GIOP_LOCATION_FORWARD_PERM);
+#else
+ const bool is_permanent_forward = false;
+#endif
+
+ (void) this->object_forwarded (effective_target,
+ stub,
+ is_permanent_forward
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO_INVOKE_FAILURE);
+ }
+
+ return status;
+ }
+
+ void
+ Invocation_Adapter::set_response_flags (
+ TAO_Stub *stub,
+ TAO_Operation_Details &details)
+ {
+ switch (this->type_)
+ {
+ case TAO_ONEWAY_INVOCATION:
+ {
+ // Grab the syncscope policy from the ORB.
+ Messaging::SyncScope sync_scope;
+
+ bool has_synchronization = false;
+
+ stub->orb_core ()->call_sync_scope_hook (stub,
+ has_synchronization,
+ sync_scope);
+ if (has_synchronization)
+ details.response_flags (CORBA::Octet (sync_scope));
+ else
+ details.response_flags (
+ CORBA::Octet (Messaging::SYNC_WITH_TRANSPORT));
+ break;
+ }
+ case TAO_TWOWAY_INVOCATION:
+ {
+ // @@note: Need to change this to something better. Too many
+ // hash defines meaning the same things.
+ details.response_flags (TAO_TWOWAY_RESPONSE_FLAG);
+ break;
+ }
+ }
+
+ return;
+ }
+
+ Invocation_Status
+ Invocation_Adapter::invoke_remote_i (TAO_Stub *stub,
+ TAO_Operation_Details &details,
+ CORBA::Object_var &effective_target,
+ ACE_Time_Value *&max_wait_time
+ ACE_ENV_ARG_DECL)
+ {
+ ACE_Time_Value tmp_wait_time;
+ bool is_timeout =
+ this->get_timeout (stub,
+ tmp_wait_time);
+
+ if (is_timeout)
+ max_wait_time = &tmp_wait_time;
+
+ (void) this->set_response_flags (stub,
+ details);
+
+ // Create the resolver which will pick (or create) for us a
+ // transport and a profile from the effective_target.
+ Profile_Transport_Resolver resolver (
+ effective_target.in (),
+ stub,
+ (details.response_flags () != Messaging::SYNC_NONE));
+
+ resolver.resolve (max_wait_time
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO_INVOKE_FAILURE);
+
+ // Update the request id now that we have a transport
+ details.request_id (resolver.transport ()->tms ()->request_id ());
+
+ if (this->type_ == TAO_ONEWAY_INVOCATION)
+ {
+ return this->invoke_oneway (details,
+ effective_target,
+ resolver,
+ max_wait_time
+ ACE_ENV_ARG_PARAMETER);
+ }
+ else if (this->type_ == TAO_TWOWAY_INVOCATION)
+ {
+ return this->invoke_twoway (details,
+ effective_target,
+ resolver,
+ max_wait_time
+ ACE_ENV_ARG_PARAMETER);
+ }
+
+ return TAO_INVOKE_FAILURE;
+ }
+
+ Invocation_Status
+ Invocation_Adapter::invoke_twoway (TAO_Operation_Details &details,
+ CORBA::Object_var &effective_target,
+ Profile_Transport_Resolver &r,
+ ACE_Time_Value *&max_wait_time
+ ACE_ENV_ARG_DECL)
+ {
+ // Simple sanity check
+ if (this->mode_ != TAO_SYNCHRONOUS_INVOCATION ||
+ this->type_ != TAO_TWOWAY_INVOCATION)
+ {
+ ACE_THROW_RETURN (CORBA::INTERNAL (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ EINVAL),
+ CORBA::COMPLETED_NO),
+ TAO_INVOKE_FAILURE);
+ }
+
+ TAO::Synch_Twoway_Invocation synch (this->target_,
+ r,
+ details);
+
+ Invocation_Status status =
+ synch.remote_twoway (max_wait_time
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO_INVOKE_FAILURE);
+
+ if (status == TAO_INVOKE_RESTART &&
+ synch.is_forwarded ())
+ {
+ effective_target =
+ synch.steal_forwarded_reference ();
+
+#if TAO_HAS_INTERCEPTORS == 1
+ const bool is_permanent_forward =
+ (synch.reply_status() == TAO_GIOP_LOCATION_FORWARD_PERM);
+#else
+ const bool is_permanent_forward = false;
+#endif
+
+ this->object_forwarded (effective_target,
+ r.stub (),
+ is_permanent_forward
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO_INVOKE_FAILURE);
+ }
+
+ return status;
+ }
+
+ Invocation_Status
+ Invocation_Adapter::invoke_oneway (TAO_Operation_Details &details,
+ CORBA::Object_var &effective_target,
+ Profile_Transport_Resolver &r,
+ ACE_Time_Value *&max_wait_time
+ ACE_ENV_ARG_DECL)
+ {
+ TAO::Synch_Oneway_Invocation synch (this->target_,
+ r,
+ details);
+
+ Invocation_Status s =
+ synch.remote_oneway (max_wait_time
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO_INVOKE_FAILURE);
+
+ if (s == TAO_INVOKE_RESTART &&
+ synch.is_forwarded ())
+ {
+ effective_target =
+ synch.steal_forwarded_reference ();
+
+#if TAO_HAS_INTERCEPTORS == 1
+ const bool is_permanent_forward =
+ (synch.reply_status() == TAO_GIOP_LOCATION_FORWARD_PERM);
+#else
+ const bool is_permanent_forward = false;
+#endif
+ this->object_forwarded (effective_target,
+ r.stub (),
+ is_permanent_forward
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO_INVOKE_FAILURE);
+ }
+
+ return s;
+ }
+
+ void
+ Invocation_Adapter::object_forwarded (CORBA::Object_var &effective_target,
+ TAO_Stub *stub,
+ CORBA::Boolean permanent_forward
+ ACE_ENV_ARG_DECL)
+ {
+ // The object pointer has to be changed to a TAO_Stub pointer
+ // in order to obtain the profiles.
+ TAO_Stub *stubobj =
+ effective_target->_stubobj ();
+
+ if (stubobj == 0)
+ ACE_THROW (CORBA::INTERNAL (
+ CORBA::SystemException::_tao_minor_code (
+ TAO_INVOCATION_LOCATION_FORWARD_MINOR_CODE,
+ errno),
+ CORBA::COMPLETED_NO));
+
+
+ // Reset the profile in the stubs
+ stub->add_forward_profiles (stubobj->base_profiles (), permanent_forward);
+
+ if (stub->next_profile () == 0)
+ ACE_THROW (CORBA::TRANSIENT (
+ CORBA::SystemException::_tao_minor_code (
+ TAO_INVOCATION_LOCATION_FORWARD_MINOR_CODE,
+ errno),
+ CORBA::COMPLETED_NO));
+
+ return;
+ }
+} // End namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Invocation_Adapter.h b/TAO/tao/Invocation_Adapter.h
new file mode 100644
index 00000000000..445652460b4
--- /dev/null
+++ b/TAO/tao/Invocation_Adapter.h
@@ -0,0 +1,294 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Invocation_Adapter.h
+ *
+ * $Id$
+ *
+ * @author Balachandran Natarajan <bala@dre.vanderbilt.edu>
+ */
+//=============================================================================
+#ifndef TAO_INVOCATION_ADAPTER_H
+#define TAO_INVOCATION_ADAPTER_H
+
+#include /**/ "ace/pre.h"
+
+#include "ace/Global_Macros.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+// @NOTE: Do not include any headers unessarily here.
+#include "ace/CORBA_macros.h"
+
+#include "tao/TAO_Export.h"
+#include "tao/Invocation_Utils.h"
+#include "tao/Collocation_Strategy.h"
+#include "tao/CORBA_methods.h"
+#include "tao/Pseudo_VarOut_T.h"
+
+ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+class ACE_Time_Value;
+ACE_END_VERSIONED_NAMESPACE_DECL
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Operation_Details;
+class TAO_Stub;
+
+namespace CORBA
+{
+ class Object;
+ typedef Object *Object_ptr;
+ typedef TAO_Pseudo_Var_T<Object> Object_var;
+
+ class Environment;
+}
+
+namespace TAO
+{
+ class Argument;
+ struct Exception_Data;
+ class Collocation_Proxy_Broker;
+ class Profile_Transport_Resolver;
+
+ /**
+ * @class Invocation_Adapter
+ *
+ * @brief Generic interface for the invocation object visible to the
+ * IDL compiler.
+ *
+ * The main objective of this class is to adapt the type and
+ * invocation specific information declared in the IDL by the
+ * application and convert them as CORBA invocations to the target
+ * object. Implementation of this class knows how to make
+ * invocations on a collocated or a remote object.
+ *
+ * This adapter class serves as the base class for various types of
+ * invocations like AMI, DII, DSI etc. Adapter classes for AMI, DII,
+ * DSI inherit from this class and their local behavioural
+ * information before kicking off an invocation.
+ *
+ * @@ More info..
+ * Wafer thin inclusions
+ * All stuff created on stack
+ * Only handles starts and restarts
+ *
+ */
+ class TAO_Export Invocation_Adapter
+ {
+ public:
+ /// The only constructor used by the IDL compiler, and only way to
+ /// create this adapter.
+ /**
+ * @param target Points to the object on which this invocation is
+ * being invoked.
+ *
+ * @param args Array of pointers to the argument list in the
+ * operation declaration. This includes the return, inout and out
+ * arguments.
+ *
+ * @param arg_number Number of arguments in the above array. This
+ * is the number of elements in the above array.
+ *
+ * @param operation The name of the operation being invoked.
+ *
+ * @param op_len Number of charecters in the operation name. This
+ * is an optimization which helps us to avoid calling strlen ()
+ * while creating a message format.
+ *
+ * @param cpb The collocation proxy broker for the target if one
+ * exists. This is useful especially to route the call to the
+ * collocated target.
+ *
+ * @param type The operation type which could be a oneway or two
+ * way operation. This information is available in the IDL file.
+ *
+ * @param mode Invocation mode. This information is also available
+ * in the IDL file and in the generated code.
+ */
+ Invocation_Adapter (CORBA::Object_ptr target,
+ Argument **args,
+ int arg_number,
+ const char *operation,
+ size_t op_len,
+ Collocation_Proxy_Broker *cpb,
+ TAO::Invocation_Type type = TAO_TWOWAY_INVOCATION,
+ TAO::Invocation_Mode mode = TAO_SYNCHRONOUS_INVOCATION);
+
+ virtual ~Invocation_Adapter (void);
+
+ /// Invoke the target, and used by the generated code.
+ /**
+ * The implementation decides whether the target is remote or
+ * collocated and takes the right decision.
+ *
+ * @param ex Array of exception data declared by the application
+ * in their IDL.
+ *
+ * @param ex_count Number of elements in the array.
+ */
+ virtual void invoke (TAO::Exception_Data *ex,
+ unsigned long ex_count
+ ACE_ENV_ARG_DECL);
+ protected:
+ /**
+ * The stub pointer passed to this call has all the details about
+ * the object to which the invocation needs to be routed to. The
+ * implementation of this method looks if we are collocated or not
+ * and takes care of reinvoking the target if it receives
+ * forwarding information or if the first invocation fails
+ * for some reason, like a loss of connection during send () etc.
+ */
+ virtual void invoke_i (TAO_Stub *stub,
+ TAO_Operation_Details &details
+ ACE_ENV_ARG_DECL);
+
+ /**
+ * @name Helper methods for making different types of invocations.
+ *
+ * These methods useful for various types of invocations like
+ * SII, AMI, DII and DSI. All the subclasses implement these
+ * methods to get the right behaviour at their level.
+ */
+ //@{
+
+ /// Helper method that prepares the necessary stuff for a remote
+ /// invocation.
+
+ /*
+ * This method does the following essential activities needed for
+ * a remote invocation.
+ *
+ * - Extracts the roundtrip timeout policies set in the ORB or
+ * Object or at the thread level
+ * - Uses the target information to pick a profile and a transport
+ * object on which the invocation needs to be sent
+ *
+ * - Checks whether the operation is a oneway or twoway and
+ * delegates the call.
+ */
+ virtual Invocation_Status invoke_remote_i (
+ TAO_Stub *stub,
+ TAO_Operation_Details &details,
+ CORBA::Object_var &effective_target,
+ ACE_Time_Value *&max_wait_time
+ ACE_ENV_ARG_DECL);
+
+ /// Make a collocated call.
+ /**
+ * This method creates an object that takes care of making collocated
+ * invocations and calls invoke () on it. If the invoke ()
+ * returns with a location forwarded reply we return a restart
+ *
+ * @param stub The stub object on which the invocation is made.
+ *
+ * @param details The operations details of the operation that is being
+ * invoked.
+ */
+ virtual Invocation_Status invoke_collocated_i (
+ TAO_Stub *stub,
+ TAO_Operation_Details &details,
+ CORBA::Object_var &effective_target,
+ Collocation_Strategy strat
+ ACE_ENV_ARG_DECL);
+
+ /// Helper method to make a two way invocation.
+ /**
+ * This method creates a synchronous twoway invocation object to
+ * which the actual task of request handling is delegated. Once
+ * the invocation returns this method checks whether the request
+ * is forwarded to a new location.
+ */
+ virtual Invocation_Status invoke_twoway (
+ TAO_Operation_Details &details,
+ CORBA::Object_var &effective_target,
+ Profile_Transport_Resolver &r,
+ ACE_Time_Value *&max_wait_time
+ ACE_ENV_ARG_DECL);
+
+ /// Helper method to make a one way invocation.
+ /**
+ * This method creates a synchronous oneway invocation object to
+ * which the actual task of request handling is delegated. Once
+ * the invocation returns this method checks whether the request
+ * is forwarded to a new location to take appropriate action.
+ */
+ virtual Invocation_Status invoke_oneway (
+ TAO_Operation_Details &details,
+ CORBA::Object_var &effective_target,
+ Profile_Transport_Resolver &r,
+ ACE_Time_Value *&max_wait_time
+ ACE_ENV_ARG_DECL);
+ //@}
+
+ /// Helper function that extracts the roundtrip timeout policies
+ /// set in the ORB.
+ bool get_timeout (TAO_Stub *stub,
+ ACE_Time_Value &val);
+
+ /// Helper method that extracts TAO_Stub from the target object.
+ TAO_Stub *get_stub (ACE_ENV_SINGLE_ARG_DECL) const;
+
+ /// Helper method that takes care of setting the profiles within
+ /// the stub object if the target gets forwarded
+ void object_forwarded (CORBA::Object_var &effective_target,
+ TAO_Stub *stub,
+ CORBA::Boolean permanent_forward
+ ACE_ENV_ARG_DECL);
+
+ /// Helper method to set the response flags within @a details
+ void set_response_flags (TAO_Stub *stub,
+ TAO_Operation_Details &details);
+
+ private:
+ /// Dont allow default initializations
+ Invocation_Adapter (void);
+
+ // Prevent copying
+ Invocation_Adapter (Invocation_Adapter const &);
+ Invocation_Adapter & operator= (const Invocation_Adapter &);
+
+ protected:
+
+ /// The target object on which this invocation is carried out.
+ CORBA::Object_ptr target_;
+
+ /// Array of arguments for this operation
+ Argument ** const args_;
+
+ /// Number of arguments for this operation.
+ /**
+ * This includes the return values too
+ */
+ int const number_args_;
+
+ /// Name of the operation.
+ char const * operation_;
+
+ /// String length of the operation name.
+ size_t const op_len_;
+
+ /// Collocation proxy broker for this operation.
+ Collocation_Proxy_Broker * const cpb_;
+
+ /// The invocation type
+ Invocation_Type const type_;
+
+ /// The invocation mode
+ Invocation_Mode const mode_;
+
+ };
+} // End namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/Invocation_Adapter.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /*TAO_INVOCATION_ADAPTER_H*/
diff --git a/TAO/tao/Invocation_Adapter.inl b/TAO/tao/Invocation_Adapter.inl
new file mode 100644
index 00000000000..3ee1410310c
--- /dev/null
+++ b/TAO/tao/Invocation_Adapter.inl
@@ -0,0 +1,31 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ ACE_INLINE
+ Invocation_Adapter::Invocation_Adapter (
+ CORBA::Object *target,
+ Argument **args,
+ int arg_number,
+ const char *operation,
+ size_t op_len,
+ Collocation_Proxy_Broker *p,
+ Invocation_Type type,
+ Invocation_Mode mode)
+ : target_ (target)
+ , args_ (args)
+ , number_args_ (arg_number)
+ , operation_ (operation)
+ , op_len_ (op_len)
+ , cpb_ (p)
+ , type_ (type)
+ , mode_ (mode)
+ {
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Invocation_Base.cpp b/TAO/tao/Invocation_Base.cpp
new file mode 100644
index 00000000000..dd2ab25d2cf
--- /dev/null
+++ b/TAO/tao/Invocation_Base.cpp
@@ -0,0 +1,280 @@
+#include "tao/Invocation_Base.h"
+#include "tao/Stub.h"
+#include "tao/operation_details.h"
+#include "tao/ORB_Core.h"
+#include "tao/SystemException.h"
+#include "tao/PortableInterceptor.h" /* Must always be visible. */
+
+#include "ace/Dynamic_Service.h"
+
+#if TAO_HAS_INTERCEPTORS == 1
+# include "tao/PortableInterceptorC.h"
+# include "tao/ClientRequestInterceptor_Adapter_Factory.h"
+#endif /* TAO_HAS_INTERCEPTORS == 1*/
+
+#if !defined (__ACE_INLINE__)
+# include "tao/Invocation_Base.inl"
+#endif /* __ACE_INLINE__ */
+
+
+ACE_RCSID (tao,
+ Invocation_Base,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ Invocation_Base::Invocation_Base (CORBA::Object_ptr ot,
+ CORBA::Object_ptr t,
+ TAO_Stub *stub,
+ TAO_Operation_Details &details,
+ bool response_expected,
+ bool request_is_remote)
+ : details_ (details)
+ , forwarded_to_ (0)
+ , response_expected_ (response_expected)
+ , otarget_ (ot)
+ , target_ (t)
+ , orb_core_ (stub->orb_core ())
+ , stub_ (stub)
+#if TAO_HAS_INTERCEPTORS == 1
+ , adapter_ (orb_core_->clientrequestinterceptor_adapter ())
+ , stack_size_ (0)
+ , invoke_status_ (TAO_INVOKE_START)
+ , caught_exception_ (0)
+ , is_remote_request_ (request_is_remote)
+#endif /*TAO_HAS_INTERCEPTORS == 1*/
+ {
+#if TAO_HAS_INTERCEPTORS == 0
+ ACE_UNUSED_ARG (request_is_remote);
+#endif /*TAO_HAS_INTERCEPTORS == 0*/
+ }
+
+ Invocation_Base::~Invocation_Base (void)
+ {
+#if TAO_HAS_INTERCEPTORS == 1
+ adapter_ = 0;
+#endif /*TAO_HAS_INTERCEPTORS == 1*/
+ }
+
+ void
+ Invocation_Base::reply_received (Invocation_Status TAO_INTERCEPTOR (s))
+ {
+ TAO_INTERCEPTOR (invoke_status_ = s);
+ }
+
+ TAO_Service_Context &
+ Invocation_Base::request_service_context (void)
+ {
+ return this->details_.request_service_context ();
+ }
+
+ TAO_Service_Context &
+ Invocation_Base::reply_service_context (void)
+ {
+ return this->details_.reply_service_context ();
+ }
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+ Invocation_Status
+ Invocation_Base::send_request_interception (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ if (adapter_ != 0)
+ {
+ ACE_TRY
+ {
+ this->adapter_->send_request (*this
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ (void) this->handle_any_exception (&ACE_ANY_EXCEPTION
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ // This is a begin interception point
+ ACE_RE_THROW;
+ }
+ # if defined (ACE_HAS_EXCEPTIONS) \
+ && defined (ACE_HAS_BROKEN_UNEXPECTED_EXCEPTIONS)
+ ACE_CATCHALL
+ {
+ (void) this->handle_all_exception (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ // This is a begin interception point
+ ACE_RE_THROW;
+ }
+ # endif /* ACE_HAS_EXCEPTIONS && ACE_HAS_BROKEN_UNEXPECTED_EXCEPTIONS */
+ ACE_ENDTRY;
+ ACE_CHECK_RETURN (TAO_INVOKE_FAILURE);
+
+ if (this->forwarded_to_.in ())
+ return TAO_INVOKE_RESTART;
+ }
+
+ // What are the other cases??
+ return TAO_INVOKE_SUCCESS;
+ }
+
+ Invocation_Status
+ Invocation_Base::receive_reply_interception (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ if (adapter_ != 0)
+ {
+ ACE_TRY
+ {
+ this->adapter_->receive_reply (*this
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ (void) this->handle_any_exception (&ACE_ANY_EXCEPTION
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ ACE_RE_THROW;
+ }
+ # if defined (ACE_HAS_EXCEPTIONS) \
+ && defined (ACE_HAS_BROKEN_UNEXPECTED_EXCEPTIONS)
+ ACE_CATCHALL
+ {
+ (void) this->handle_all_exception (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ ACE_RE_THROW;
+ }
+ # endif /* ACE_HAS_EXCEPTIONS && ACE_HAS_BROKEN_UNEXPECTED_EXCEPTIONS */
+ ACE_ENDTRY;
+ ACE_CHECK_RETURN (TAO_INVOKE_FAILURE);
+
+ const PortableInterceptor::ReplyStatus status =
+ this->adapter_->reply_status (*this);
+
+ if (status == PortableInterceptor::LOCATION_FORWARD ||
+ status == PortableInterceptor::TRANSPORT_RETRY)
+ return TAO_INVOKE_RESTART;
+ }
+
+ return TAO_INVOKE_SUCCESS;
+ }
+
+
+ Invocation_Status
+ Invocation_Base::receive_other_interception (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ if (adapter_ != 0)
+ {
+ ACE_TRY
+ {
+ this->adapter_->receive_other (*this
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ (void) this->handle_any_exception (&ACE_ANY_EXCEPTION
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ ACE_RE_THROW;
+ }
+ # if defined (ACE_HAS_EXCEPTIONS) \
+ && defined (ACE_HAS_BROKEN_UNEXPECTED_EXCEPTIONS)
+ ACE_CATCHALL
+ {
+ (void) this->handle_all_exception (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ ACE_RE_THROW;
+ }
+ # endif /* ACE_HAS_EXCEPTIONS && ACE_HAS_BROKEN_UNEXPECTED_EXCEPTIONS */
+ ACE_ENDTRY;
+ ACE_CHECK_RETURN (TAO_INVOKE_FAILURE);
+
+ if (this->forwarded_to_.in ())
+ return TAO_INVOKE_RESTART;
+ }
+
+ return TAO_INVOKE_SUCCESS;
+ }
+
+ PortableInterceptor::ReplyStatus
+ Invocation_Base::handle_any_exception (CORBA::Exception *ex
+ ACE_ENV_ARG_DECL)
+ {
+ this->exception (ex);
+
+ PortableInterceptor::ReplyStatus status =
+ PortableInterceptor::SYSTEM_EXCEPTION;
+
+ if (adapter_ != 0)
+ {
+ this->adapter_->receive_exception (*this
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (PortableInterceptor::UNKNOWN);
+
+ status =
+ this->adapter_->reply_status (*this);
+ }
+
+ return status;
+ }
+
+ PortableInterceptor::ReplyStatus
+ Invocation_Base::handle_all_exception (ACE_ENV_SINGLE_ARG_DECL)
+ {
+ CORBA::UNKNOWN ex;
+ this->exception (&ex);
+
+ PortableInterceptor::ReplyStatus status =
+ PortableInterceptor::SYSTEM_EXCEPTION;
+
+ if (adapter_ != 0)
+ {
+ this->adapter_->receive_exception (*this
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (PortableInterceptor::UNKNOWN);
+
+ status =
+ this->adapter_->reply_status (*this);
+ }
+
+ return status;
+ }
+
+ void
+ Invocation_Base::exception (CORBA::Exception *exception)
+ {
+ if (CORBA::SystemException::_downcast (exception) != 0)
+ this->invoke_status_ = TAO::TAO_INVOKE_SYSTEM_EXCEPTION;
+ else if (CORBA::UserException::_downcast (exception) != 0)
+ this->invoke_status_ = TAO::TAO_INVOKE_USER_EXCEPTION;
+
+ this->caught_exception_ = exception;
+ }
+
+ PortableInterceptor::ReplyStatus
+ Invocation_Base::reply_status (void) const
+ {
+ if (adapter_ != 0)
+ {
+ return this->adapter_->reply_status (*this);
+ }
+ else
+ {
+ return -1;
+ }
+ }
+#endif /*TAO_HAS_INTERCEPTORS == 1*/
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Invocation_Base.h b/TAO/tao/Invocation_Base.h
new file mode 100644
index 00000000000..328127e9dc0
--- /dev/null
+++ b/TAO/tao/Invocation_Base.h
@@ -0,0 +1,251 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Invocation_Base.h
+ *
+ * $Id$
+ *
+ *
+ * @author Balachandran Natarajan <bala@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_INVOCATION_BASE_H
+#define TAO_INVOCATION_BASE_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Object.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Invocation_Utils.h"
+
+#if TAO_HAS_INTERCEPTORS == 1
+#include "tao/PI_ForwardC.h"
+#include "tao/ClientRequestInterceptor_Adapter.h"
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Service_Context;
+class TAO_Operation_Details;
+class TAO_Stub;
+
+namespace TAO
+{
+ class Invocation_Adapter;
+
+ /**
+ * @class Invocation_Base
+ *
+ * @brief The base class for the invocation object
+ *
+ * This class is the base of the invocation object hiererachy. This
+ * hierarchy is classified based on the type of invocation and the
+ * mode of invocation. One of the objects from the hierarchy is
+ * created on the stack for every invocation.
+ *
+ * In addition this class encapsulates the essential details that
+ * are required for PortableInterceptors to function
+ * correctly. Further this class also provides some helper and
+ * accessor methods that are used by clients.
+ *
+ */
+ class TAO_Export Invocation_Base
+ {
+ public:
+ virtual ~Invocation_Base (void);
+
+ /// Accessor and mutator methods
+ //@{
+ TAO_ORB_Core *orb_core (void) const;
+
+ TAO_Stub *stub (void) const;
+
+ /// Accessor and mutator methods for forwarded object
+ /// locations.
+ /**
+ * These access methods have to be public so that the
+ * PortableInterceptor can use them
+ */
+ CORBA::Object_ptr forwarded_reference (void);
+ void forwarded_reference (CORBA::Object_ptr o);
+
+ /// Accessors for the service context list.
+ /**
+ * The service context lists are actually cached
+ * elsewhere. Providing this accessor helps the PI to access this
+ * list in both remote and collocated mode.
+ */
+ TAO_Service_Context &request_service_context (void);
+ TAO_Service_Context &reply_service_context (void);
+
+ /// Return the forwarded object location by loosing ownership.
+ CORBA::Object_ptr steal_forwarded_reference (void);
+
+ /// Did the invocation got forwarded to a new location?
+ bool is_forwarded (void) const;
+
+ /// Mutator to set the reply status of the invocation.
+ void reply_received (Invocation_Status s);
+
+ /// Return the effective target of the invocation.
+ /**
+ * Please see the PortableInterceptor specification in the CORBA
+ * spec to understand what effective target means.
+ */
+ CORBA::Object_ptr effective_target (void) const;
+
+ /// Return the target object
+ CORBA::Object_ptr target (void) const;
+
+ /// Does this invocation return a response?
+ CORBA::Boolean response_expected (void) const;
+
+ /// The operaton details of the invocation
+ TAO_Operation_Details &operation_details (void);
+ //@}
+
+ protected:
+ /**
+ * @param otarget The original target on which this invocation
+ * was started.
+ *
+ * @param target the target on which this invocation is flowing
+ * ie. the effective target
+ *
+ * @param op operation details of the invocation on @a target
+ *
+ * @param response_expected flag to indicate whether the
+ * operation encapsulated by @a op returns a response or not.
+ */
+ Invocation_Base (CORBA::Object_ptr otarget,
+ CORBA::Object_ptr target,
+ TAO_Stub *stub,
+ TAO_Operation_Details &op,
+ bool response_expected,
+ bool request_is_remote);
+
+ protected:
+ /// The operation details on which we are operating on.
+ TAO_Operation_Details &details_;
+
+ /// Forwarded object reference.
+ CORBA::Object_var forwarded_to_;
+
+ /// Is response expected?
+ bool response_expected_;
+
+ private:
+
+ Invocation_Base (const Invocation_Base&);
+ Invocation_Base & operator= (const Invocation_Base &);
+
+ private:
+ //@{
+ /**
+ * The following object reference pointers are *not*
+ * duplicated. They are cached for portable interceptors, and they
+ * just live for the lifetime of the request. Hence there is no
+ * point in duplicating the pointers.
+ */
+ /// The original target on which the invocation was started.
+ CORBA::Object_ptr otarget_;
+
+ /// The effective target on which the invocation is on.
+ CORBA::Object_ptr target_;
+
+ /// Cache the ORB_Core
+ TAO_ORB_Core *orb_core_;
+
+ TAO_Stub *stub_;
+ //@}
+
+ /// Operations invoked by the
+ /// PortableInterceptor::ClientRequestInfo object to get details
+ /// about the operation and related stuff.
+ //@{
+#if TAO_HAS_INTERCEPTORS == 1
+ public:
+ /// Return a reference to the number of interceptors pushed on to
+ /// the current interceptor flow stack.
+ /**
+ * @note It is a reference since the Portable Interceptor flow stack
+ * code must be able to modify this value and use that value
+ * at a later time without being forced to use TSS.
+ */
+ size_t &stack_size (void);
+
+ CORBA::Exception *caught_exception (void);
+
+ /// Change the exception status.
+ void exception (CORBA::Exception *exception);
+
+ /// Invoke status
+ TAO::Invocation_Status invoke_status (void) const;
+
+ PortableInterceptor::ReplyStatus reply_status (void) const;
+
+ /// Accessor used to determine if the current invocation is part
+ /// of a remote request, and if not, it will be considered to be
+ /// part of a collocated request.
+ bool is_remote_request() const;
+
+ protected:
+ /// Helper method to invoke send_request interception call to all
+ /// the registered interceptors.
+ Invocation_Status send_request_interception (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Helper method to invoke receive_reply interception call to all
+ /// the registered interceptors.
+ Invocation_Status receive_reply_interception (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Helper method to invoke receive_other interception call to all
+ /// the registered interceptors.
+ Invocation_Status receive_other_interception (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Helper methods to handle interception calls when exceptions
+ /// are thrown by the PortableInterceptor.
+ PortableInterceptor::ReplyStatus
+ handle_any_exception (CORBA::Exception *e
+ ACE_ENV_ARG_DECL);
+
+ PortableInterceptor::ReplyStatus
+ handle_all_exception (ACE_ENV_SINGLE_ARG_DECL);
+
+ protected:
+ /// The client requestor adapter
+ ClientRequestInterceptor_Adapter *adapter_;
+
+ size_t stack_size_;
+
+ TAO::Invocation_Status invoke_status_;
+
+ private:
+ /// Pointer to the caught exception.
+ CORBA::Exception *caught_exception_;
+
+ /// Flag used to distinguish a remote invocation versus a collocated
+ /// (thru-poa) invocation.
+ bool is_remote_request_;
+#endif /*TAO_HAS_INTERCEPTORS*/
+ //@}
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/Invocation_Base.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /*TAO_INVOCATION_BASE_H*/
diff --git a/TAO/tao/Invocation_Base.inl b/TAO/tao/Invocation_Base.inl
new file mode 100644
index 00000000000..c6a27ca28ab
--- /dev/null
+++ b/TAO/tao/Invocation_Base.inl
@@ -0,0 +1,96 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ ACE_INLINE TAO_ORB_Core *
+ Invocation_Base::orb_core (void) const
+ {
+ return this->orb_core_;
+ }
+
+ ACE_INLINE TAO_Stub *
+ Invocation_Base::stub (void) const
+ {
+ return this->stub_;
+ }
+
+ ACE_INLINE void
+ Invocation_Base::forwarded_reference (CORBA::Object_ptr o)
+ {
+ this->forwarded_to_ = CORBA::Object::_duplicate (o);
+ }
+
+ ACE_INLINE CORBA::Object_ptr
+ Invocation_Base::forwarded_reference (void)
+ {
+ return CORBA::Object::_duplicate (this->forwarded_to_.in ());
+ }
+
+ ACE_INLINE CORBA::Object_ptr
+ Invocation_Base::steal_forwarded_reference (void)
+ {
+ return this->forwarded_to_._retn ();
+ }
+
+ ACE_INLINE bool
+ Invocation_Base::is_forwarded (void) const
+ {
+ return (this->forwarded_to_.in () != 0);
+ }
+
+ ACE_INLINE CORBA::Boolean
+ Invocation_Base::response_expected (void) const
+ {
+ return this->response_expected_;
+ }
+
+ ACE_INLINE CORBA::Object_ptr
+ Invocation_Base::target (void) const
+ {
+ return this->otarget_;
+ }
+
+ ACE_INLINE CORBA::Object_ptr
+ Invocation_Base::effective_target (void) const
+ {
+ return this->target_;
+ }
+
+ ACE_INLINE TAO_Operation_Details &
+ Invocation_Base::operation_details (void)
+ {
+ return this->details_;
+ }
+
+#if TAO_HAS_INTERCEPTORS == 1
+ ACE_INLINE size_t &
+ Invocation_Base::stack_size (void)
+ {
+ return this->stack_size_;
+ }
+
+ ACE_INLINE CORBA::Exception *
+ Invocation_Base::caught_exception (void)
+ {
+ return this->caught_exception_;
+ }
+
+ ACE_INLINE TAO::Invocation_Status
+ Invocation_Base::invoke_status (void) const
+ {
+ return this->invoke_status_;
+ }
+
+ ACE_INLINE bool
+ Invocation_Base::is_remote_request (void) const
+ {
+ return this->is_remote_request_;
+ }
+#endif /* TAO_HAS_INTERCEPTORS */
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Invocation_Endpoint_Selectors.cpp b/TAO/tao/Invocation_Endpoint_Selectors.cpp
new file mode 100644
index 00000000000..5221ee8d9c5
--- /dev/null
+++ b/TAO/tao/Invocation_Endpoint_Selectors.cpp
@@ -0,0 +1,98 @@
+//$Id$
+#include "tao/Invocation_Endpoint_Selectors.h"
+#include "tao/Stub.h"
+#include "tao/Profile.h"
+#include "tao/ORB_Core.h"
+#include "tao/IIOP_Endpoint.h"
+#include "tao/Base_Transport_Property.h"
+#include "tao/Profile_Transport_Resolver.h"
+#include "tao/ORB_Constants.h"
+#include "tao/SystemException.h"
+
+ACE_RCSID (tao,
+ Invocation_Endpoint_Selectors,
+ "$Id$")
+
+
+ TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Invocation_Endpoint_Selector::~TAO_Invocation_Endpoint_Selector (void)
+{
+}
+
+// ****************************************************************
+
+TAO_Default_Endpoint_Selector::~TAO_Default_Endpoint_Selector (void)
+{
+}
+
+void
+TAO_Default_Endpoint_Selector::select_endpoint (TAO::Profile_Transport_Resolver *r,
+ ACE_Time_Value *max_wait_time
+ ACE_ENV_ARG_DECL)
+{
+ do
+ {
+ r->profile (r->stub ()->profile_in_use ());
+
+ // Check whether we need to do a blocked wait or we have a
+ // non-blocked wait and we support that. If this is not the
+ // case we can't use this profile so try the next.
+ if (r->blocked_connect () ||
+ (!r->blocked_connect () &&
+ r->profile ()->supports_non_blocking_oneways ()))
+ {
+ if (r->profile ()->endpoint_count () > 1 &&
+ r->use_parallel_connect())
+ {
+
+ TAO_Endpoint *ep =
+ r->profile ()->endpoint ();
+
+ TAO_Base_Transport_Property desc (ep);
+ bool success =
+ r->try_parallel_connect (&desc,
+ max_wait_time
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Check if the connect has completed.
+ if (success)
+ return;
+ // The default implementation of try_parallel_connect returns
+ // a not supported errno. In this case, allow the ordinary
+ // connection mechanism to be tried. OTOH, if the connection
+ // attempt failed for some other reason, then abandon this
+ // profile and try the next one in the list.
+ else if (errno != ENOTSUP)
+ continue;
+ }
+
+ for (TAO_Endpoint *ep = r->profile ()->first_filtered_endpoint ();
+ ep != 0;
+ ep = r->profile ()->next_filtered_endpoint (ep))
+ {
+ TAO_Base_Transport_Property desc (ep);
+ bool retval =
+ r->try_connect (&desc,
+ max_wait_time
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Check if the connect has completed.
+ if (retval)
+ return;
+ }
+
+ }
+ }
+ while (r->stub ()->next_profile_retry () != 0);
+
+
+ // If we get here, we completely failed to find an endpoint selector
+ // that we know how to use, so throw an exception.
+ ACE_THROW (CORBA::TRANSIENT (CORBA::OMGVMCID | 2,
+ CORBA::COMPLETED_NO));
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Invocation_Endpoint_Selectors.h b/TAO/tao/Invocation_Endpoint_Selectors.h
new file mode 100644
index 00000000000..bd2c5101889
--- /dev/null
+++ b/TAO/tao/Invocation_Endpoint_Selectors.h
@@ -0,0 +1,109 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Invocation_Endpoint_Selectors.h
+ *
+ * $Id$
+ *
+ * Strategies for selecting profile/endpoint from an IOR for making an
+ * invocation.
+ *
+ * @author Marina Spivak <marina@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_INVOCATION_ENDPOINT_SELECTOR_H
+#define TAO_INVOCATION_ENDPOINT_SELECTOR_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/TAO_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Versioned_Namespace.h"
+
+#include "ace/CORBA_macros.h"
+
+ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+class ACE_Time_Value;
+ACE_END_VERSIONED_NAMESPACE_DECL
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_MProfile;
+
+namespace TAO
+{
+ class Profile_Transport_Resolver;
+}
+
+namespace CORBA
+{
+ class Exception;
+ class Environment;
+}
+/**
+ * @class TAO_Invocation_Endpoint_Selector
+ *
+ * @brief Defines the interface for policy-based endpoint selection
+ * strategies.
+ *
+ * Selects/reselects server endpoint for an Invocation. Different
+ * concrete strategies perform selection based on different
+ * policies.
+ * @par
+ * All endpoint selection strategies are stateless objects - any
+ * necessary state is stored in Invocation's
+ * @c endpoint_selection_state_.
+ */
+class TAO_Export TAO_Invocation_Endpoint_Selector
+{
+public:
+
+ /// Destructor.
+ virtual ~TAO_Invocation_Endpoint_Selector (void);
+
+ /// Select the endpoint and set @a r's @c profile_
+ virtual void select_endpoint (TAO::Profile_Transport_Resolver *r,
+ ACE_Time_Value *val
+ ACE_ENV_ARG_DECL) = 0;
+
+};
+
+// ****************************************************************
+
+/**
+ * @class TAO_Default_Endpoint_Selector
+ *
+ * @brief Default strategy for endpoint selection.
+ *
+ * This strategy is used when there are no policies set or when
+ * the only policy set is RTCORBA::PriorityModelPolicy and its
+ * value is RTCORBA::SERVER_DECLARED.
+ * The strategy is to try the first endpoint from the first
+ * profile in the IOR. If that doesn't work, try the next
+ * profile, and so on.
+ */
+class TAO_Export TAO_Default_Endpoint_Selector
+ : public TAO_Invocation_Endpoint_Selector
+{
+public:
+
+ /// Destructor.
+ virtual ~TAO_Default_Endpoint_Selector (void);
+
+ virtual void select_endpoint (TAO::Profile_Transport_Resolver *r,
+ ACE_Time_Value *val
+ ACE_ENV_ARG_DECL);
+
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_INVOCATION_ENDPOINT_SELECTOR_H */
diff --git a/TAO/tao/Invocation_Utils.h b/TAO/tao/Invocation_Utils.h
new file mode 100644
index 00000000000..9b8804ea690
--- /dev/null
+++ b/TAO/tao/Invocation_Utils.h
@@ -0,0 +1,77 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Invocation_Utils.h
+ *
+ * $Id$
+ *
+ *
+ * @author Balachandran Natarajan <bala@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_INVOCATION_UTILS_H
+#define TAO_INVOCATION_UTILS_H
+#include /**/ "ace/pre.h"
+
+#include "ace/config-all.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Versioned_Namespace.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ enum Invocation_Status
+ {
+ /// Initial state of the FSM in the invocation class.
+ TAO_INVOKE_START = 0,
+ /// The request must be restarted, a temporary failure has
+ /// occured.
+ TAO_INVOKE_RESTART,
+ /// invoke() call successful. Final state of the FSM.
+ TAO_INVOKE_SUCCESS,
+ /// Received a user exception from the remote object, and this
+ /// is one of the final states.
+ TAO_INVOKE_USER_EXCEPTION,
+ /// Received a system exception from the remote object or the
+ /// PI and it is one of the final states
+ TAO_INVOKE_SYSTEM_EXCEPTION,
+ /// Invocation failed. It is a final state.
+ TAO_INVOKE_FAILURE
+ };
+
+ /// Enums for invocation types
+ enum Invocation_Type {
+ /// A simple oneway invocation
+ TAO_ONEWAY_INVOCATION,
+ /// A simple twoway invocation
+ TAO_TWOWAY_INVOCATION
+ };
+
+ /// Enum for invocation modes
+ enum Invocation_Mode {
+ /// Standard synchronous twoway
+ TAO_SYNCHRONOUS_INVOCATION,
+ /// Asynchronous twoway with callback model for collecting the
+ /// replies.
+ TAO_ASYNCHRONOUS_CALLBACK_INVOCATION,
+ /// Asynchronous twoway with poller model for collecting the
+ /// replies.
+ /// @note This is not supported in TAO now
+ TAO_ASYNCHRONOUS_POLLER_INVOCATION,
+ /// Types of DII
+ TAO_DII_INVOCATION,
+ TAO_DII_DEFERRED_INVOCATION
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_INVOCATION_UTILS_H */
diff --git a/TAO/tao/LF_CH_Event.cpp b/TAO/tao/LF_CH_Event.cpp
new file mode 100644
index 00000000000..41304c082bc
--- /dev/null
+++ b/TAO/tao/LF_CH_Event.cpp
@@ -0,0 +1,105 @@
+#include "tao/LF_CH_Event.h"
+
+ACE_RCSID(tao,
+ LF_Invocation_Event,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_LF_CH_Event::TAO_LF_CH_Event (void)
+ : TAO_LF_Event (),
+ prev_state_ (TAO_LF_Event::LFS_IDLE)
+
+{
+}
+
+TAO_LF_CH_Event::~TAO_LF_CH_Event (void)
+{
+}
+
+void
+TAO_LF_CH_Event::state_changed_i (int new_state)
+{
+ if (this->state_ == new_state)
+ return;
+
+ // Validate the state change
+ if (this->state_ == TAO_LF_Event::LFS_IDLE)
+ {
+ // From the LFS_IDLE state we can only become active.
+ if (new_state == TAO_LF_Event::LFS_CONNECTION_WAIT)
+ {
+ this->prev_state_ = this->state_;
+ this->state_ = new_state;
+ }
+ return;
+ }
+ else if (this->state_ == TAO_LF_Event::LFS_CONNECTION_WAIT)
+ {
+ // Only a few states are possible from CONNECTION_WAIT states
+ if (new_state == TAO_LF_Event::LFS_CONNECTION_CLOSED
+ || new_state == TAO_LF_Event::LFS_SUCCESS)
+ {
+ this->prev_state_ = this->state_;
+ this->state_ = new_state;
+ }
+
+ return;
+ }
+ else if (this->state_ == TAO_LF_Event::LFS_SUCCESS)
+ {
+ if (new_state == TAO_LF_Event::LFS_CONNECTION_CLOSED)
+ {
+ this->prev_state_ = this->state_;
+ this->state_ = new_state;
+ }
+ return;
+ }
+ else if (this->state_ == TAO_LF_Event::LFS_TIMEOUT)
+ {
+ if (new_state == TAO_LF_Event::LFS_CONNECTION_CLOSED)
+ {
+ // Dont reset the previous state
+ this->state_ = new_state;
+ }
+ }
+ return;
+}
+
+
+int
+TAO_LF_CH_Event::successful (void) const
+{
+ if (this->prev_state_ == TAO_LF_Event::LFS_CONNECTION_WAIT)
+ return this->state_ == TAO_LF_Event::LFS_SUCCESS;
+
+ return this->state_ == TAO_LF_Event::LFS_CONNECTION_CLOSED;
+}
+
+int
+TAO_LF_CH_Event::error_detected (void) const
+{
+ if (this->prev_state_ == TAO_LF_Event::LFS_CONNECTION_WAIT)
+ return this->state_ == TAO_LF_Event::LFS_CONNECTION_CLOSED;
+
+ return this->state_ == TAO_LF_Event::LFS_TIMEOUT;
+}
+
+void
+TAO_LF_CH_Event::set_state (int new_state)
+{
+ // @@ NOTE: Is this still required?
+ if (this->is_state_final () == 0
+ && new_state == TAO_LF_Event::LFS_TIMEOUT)
+ {
+ this->state_ = new_state;
+ }
+}
+
+int
+TAO_LF_CH_Event::is_state_final (void)
+{
+ return this->state_ == TAO_LF_Event::LFS_CONNECTION_CLOSED;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/LF_CH_Event.h b/TAO/tao/LF_CH_Event.h
new file mode 100644
index 00000000000..edf12c72049
--- /dev/null
+++ b/TAO/tao/LF_CH_Event.h
@@ -0,0 +1,121 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file LF_CH_Event.h
+ *
+ * $Id$
+ *
+ * @author Balachandran Natarajan <bala@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_LF_CH_EVENT_H
+#define TAO_LF_CH_EVENT_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/LF_Event.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_LF_Multi_Event;
+
+/**
+ * @class TAO_LF_CH_Event
+ *
+ * @brief Use the Leader/Follower loop to wait for one specific event
+ * in the invocation path.
+ *
+ * Concrete event types and manipulation class which is used for
+ * connection handling purposes.
+ */
+class TAO_Export TAO_LF_CH_Event: public TAO_LF_Event
+{
+public:
+ /**
+ * The TAO_LF_Multi_Event class is another specialization of
+ * TAO_LF_Event, used for aggregating many connection handlers into
+ * a single event object.. It requires friendship so that it can
+ * check the is_state_final() flag on each of its contained
+ * connection handlers.
+ */
+ friend class TAO_LF_Multi_Event;
+
+ /// Constructor
+ TAO_LF_CH_Event (void);
+
+ /// Destructor
+ virtual ~TAO_LF_CH_Event (void);
+
+ //@{
+ /// Return 1 if the condition was satisfied successfully, 0 if it
+ /// has not
+ int successful (void) const;
+
+ /// Return 1 if an error was detected while waiting for the
+ /// event
+ int error_detected (void) const;
+
+protected:
+
+ /// Check whether we have reached the final state..
+ virtual int is_state_final (void);
+
+ //@}
+private:
+ /// Validate and change the state
+ /*
+ * This concrete class uses the following states declared in the
+ * class TAO_LF_Event to transition states
+ *
+ * LFS_IDLE - The event is created, and is in
+ * initial state.
+ *
+ * LFS_CONNECTION_WAIT - The event is waiting for connection
+ * completion and it can transition to
+ * any of the following states, all the
+ * states are final.
+ *
+ * LFS_SUCCESS - The event, connection establishment, has
+ * completed successfully.
+ *
+ * LFS_TIMEOUT - The event has timed out.
+ *
+ * LFS_CONNECTION_CLOSED - The connection was closed since
+ * an error occured while trying to
+ * establish connection
+ *
+ * Event State Diagram
+ * -------------------
+ * |----> CLOSED
+ * | ^
+ * | |
+ * IDLE ---> CONNECTION_WAIT--| |
+ * | |
+ * | |
+ * |----> SUCESS
+ *
+ * Timeouts can occur while waiting for connections.
+ *
+ */
+ virtual void state_changed_i (int new_state);
+
+ /// Set the state irrespective of anything.
+ virtual void set_state (int new_state);
+
+private:
+
+ /// The previous state that the LF_CH_Event was in
+ int prev_state_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_LF_CH_EVENT_H */
diff --git a/TAO/tao/LF_Connect_Strategy.cpp b/TAO/tao/LF_Connect_Strategy.cpp
new file mode 100644
index 00000000000..bc401286334
--- /dev/null
+++ b/TAO/tao/LF_Connect_Strategy.cpp
@@ -0,0 +1,67 @@
+#include "tao/LF_Connect_Strategy.h"
+#include "tao/LF_Multi_Event.h"
+#include "tao/Connection_Handler.h"
+#include "tao/LF_Follower.h"
+#include "tao/Leader_Follower.h"
+#include "tao/Transport.h"
+#include "tao/ORB_Core.h"
+#include "ace/Synch_Options.h"
+
+ACE_RCSID(tao,
+ LF_Connect_Strategy,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_LF_Connect_Strategy::TAO_LF_Connect_Strategy (
+ TAO_ORB_Core *orb_core)
+ : TAO_Connect_Strategy (orb_core)
+{
+}
+
+TAO_LF_Connect_Strategy::~TAO_LF_Connect_Strategy (void)
+{
+}
+
+void
+TAO_LF_Connect_Strategy::synch_options (ACE_Time_Value *timeout,
+ ACE_Synch_Options &options)
+{
+ if (timeout != 0)
+ {
+ options.set (ACE_Synch_Options::USE_REACTOR,
+ *timeout);
+ }
+ else
+ {
+ // Making it sure it is blocking.
+ options.set (ACE_Synch_Options::USE_REACTOR,
+ ACE_Time_Value::zero);
+ }
+}
+
+int
+TAO_LF_Connect_Strategy::wait_i (TAO_LF_Event *ev,
+ TAO_Transport *transport,
+ ACE_Time_Value *max_wait_time)
+{
+ if (transport == 0)
+ return -1;
+
+ TAO_Leader_Follower &leader_follower =
+ this->orb_core_->leader_follower ();
+
+ int result =
+ leader_follower.wait_for_event (ev,
+ transport,
+ max_wait_time);
+
+ if (ev->error_detected () && result != -1)
+ result = -1;
+
+ return result;
+}
+
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/LF_Connect_Strategy.h b/TAO/tao/LF_Connect_Strategy.h
new file mode 100644
index 00000000000..35e6e514046
--- /dev/null
+++ b/TAO/tao/LF_Connect_Strategy.h
@@ -0,0 +1,67 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file LF_Connect_Strategy.h
+ *
+ * $Id$
+ *
+ * @author Balachandran Natarajan <bala@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_LF_CONNECT_STRATEGY_H
+#define TAO_LF_CONNECT_STRATEGY_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Connect_Strategy.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+class ACE_Time_Value;
+class ACE_Synch_Options;
+ACE_END_VERSIONED_NAMESPACE_DECL
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_LF_Event;
+
+/**
+ * @class TAO_LF_Connect_Strategy
+ *
+ * @brief Concrete implementation of a connect strategy that waits on
+ * the leader-follower during asynch connects
+ */
+
+class TAO_Export TAO_LF_Connect_Strategy : public TAO_Connect_Strategy
+{
+public:
+ /// Constructor
+ TAO_LF_Connect_Strategy (TAO_ORB_Core *orb);
+
+ /// Destructor
+ ~TAO_LF_Connect_Strategy (void);
+
+ /*
+ * Concrete implementation for this class. Please see
+ * Connect_Strategy.h for details
+ */
+ virtual void synch_options (ACE_Time_Value *val,
+ ACE_Synch_Options &opt);
+
+protected:
+ virtual int wait_i (TAO_LF_Event *ev,
+ TAO_Transport *t,
+ ACE_Time_Value *val);
+
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /*TAO_LF_CONNECT_STRATEGY_H*/
diff --git a/TAO/tao/LF_Event.cpp b/TAO/tao/LF_Event.cpp
new file mode 100644
index 00000000000..cc69d6fcea3
--- /dev/null
+++ b/TAO/tao/LF_Event.cpp
@@ -0,0 +1,50 @@
+// $Id$
+
+#include "tao/LF_Event.h"
+#include "tao/LF_Follower.h"
+#include "tao/Leader_Follower.h"
+#include "ace/Guard_T.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/LF_Event.inl"
+#endif /* __ACE_INLINE__ */
+
+ACE_RCSID (tao,
+ LF_Event,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_LF_Event::TAO_LF_Event (void)
+ : state_ (TAO_LF_Event::LFS_IDLE)
+ , follower_ (0)
+{
+}
+
+TAO_LF_Event::~TAO_LF_Event (void)
+{
+}
+
+void
+TAO_LF_Event::state_changed (int new_state,
+ TAO_Leader_Follower &lf)
+{
+ ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, lf.lock ());
+
+ if (this->is_state_final () == 0)
+ {
+ this->state_changed_i (new_state);
+
+ /// Sort of double-checked optimization..
+ if (this->follower_ != 0)
+ this->follower_->signal ();
+ }
+}
+
+void
+TAO_LF_Event::set_state (int new_state)
+{
+ this->state_ = new_state;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/LF_Event.h b/TAO/tao/LF_Event.h
new file mode 100644
index 00000000000..473fc8a4868
--- /dev/null
+++ b/TAO/tao/LF_Event.h
@@ -0,0 +1,157 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file LF_Event.h
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan <coryan@uci.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_LF_EVENT_H
+#define TAO_LF_EVENT_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/TAO_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Versioned_Namespace.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_LF_Follower;
+class TAO_Leader_Follower;
+
+/**
+ * @class TAO_LF_Event
+ *
+ * @brief Use the Leader/Follower loop to wait for one specific event.
+ *
+ * The Leader/Follower event loop is used to wait for incoming
+ * responses, as well as to wait for all the data to be flushed.
+ * This class encapsulates this event loop. It uses Template Method to
+ * parametrize the 'waited for' predicate (i.e. reply received or
+ * message sent or connection establishment etc.)
+ *
+ * @todo Implementing the Leader/Followers loop in this class, as
+ * well as the callbacks to communicate that an event has completed
+ * leads to excessive coupling. A better design would use a separate
+ * class to signal the events, that would allow us to remove the
+ * Leader/Followers logic from the ORB. However, that requires other
+ * major changes and it somewhat complicates the design.
+ *
+ */
+class TAO_Export TAO_LF_Event
+{
+public:
+
+ friend class TAO_Leader_Follower;
+
+ /// Constructor
+ TAO_LF_Event (void);
+
+ /// Destructor
+ virtual ~TAO_LF_Event (void);
+
+ /// Bind a follower
+ /**
+ * An event can be waited on by at most one follower thread, this
+ * method is used to bind the waiting thread to the event, in order
+ * to let the event signal any important state changes.
+ *
+ * This is virtual to allow the LF_Multi_Event derived type share
+ * the follower with all the subordinate LF_CH_Events.
+ *
+ * @return -1 if the LF_Event is already bound, 0 otherwise
+ */
+ virtual int bind (TAO_LF_Follower *follower);
+
+ /// Unbind the follower
+ virtual int unbind (void);
+
+ //@{
+ /** @name State management
+ *
+ * A Leader/Followers event goes through several states during its
+ * lifetime. We use an enum to represent those states and state
+ * changes are validated according to the rules defined in the
+ * concrete classes. We treat the states as finite states in a
+ * FSM. The possible sequence of states through which the FSM
+ * migrates is defined in the concrete classes.
+ */
+ enum {
+ /// The event is created, and is in initial state
+ LFS_IDLE = 0,
+ /// The event is active
+ LFS_ACTIVE,
+ /// The event is waiting for connection completion.
+ LFS_CONNECTION_WAIT,
+ /// The event has completed successfully
+ LFS_SUCCESS,
+ /// A failure has been detected while the event was active
+ LFS_FAILURE,
+ /// The event has timed out
+ LFS_TIMEOUT,
+ /// The connection was closed.
+ LFS_CONNECTION_CLOSED
+ };
+
+ /**
+ * Virtual methods for this class hierarchy..
+ */
+ /// Accessor to change the state. The state isnt changed unless
+ /// certain conditions are satisfied.
+ void state_changed (int new_state,
+ TAO_Leader_Follower &lf);
+
+ /// Return 1 if the condition was satisfied successfully, 0 if it
+ /// has not
+ virtual int successful (void) const = 0 ;
+
+ /// Return 1 if an error was detected while waiting for the
+ /// event
+ virtual int error_detected (void) const = 0;
+
+ /// Check if we should keep waiting.
+ int keep_waiting (void);
+ //@}
+
+ /// Reset the state, irrespective of the previous states
+ void reset_state (int new_state);
+
+protected:
+
+ /// Validate the state change
+ virtual void state_changed_i (int new_state) = 0;
+
+ /// Check whether we have reached the final state..
+ virtual int is_state_final (void) = 0;
+
+private:
+
+ /// Set the state irrespective of anything.
+ virtual void set_state (int new_state);
+
+protected:
+ /// The current state
+ int state_;
+
+ /// The bounded follower
+ TAO_LF_Follower *follower_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/LF_Event.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_LF_EVENT_H */
diff --git a/TAO/tao/LF_Event.inl b/TAO/tao/LF_Event.inl
new file mode 100644
index 00000000000..236c8ea69ac
--- /dev/null
+++ b/TAO/tao/LF_Event.inl
@@ -0,0 +1,37 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE int
+TAO_LF_Event::bind (TAO_LF_Follower *follower)
+{
+ if (this->follower_ != 0)
+ return -1;
+ this->follower_ = follower;
+ return 0;
+}
+
+ACE_INLINE int
+TAO_LF_Event::unbind (void)
+{
+ if (this->follower_ == 0)
+ return -1;
+ this->follower_ = 0;
+ return 0;
+}
+
+ACE_INLINE void
+TAO_LF_Event::reset_state (int new_state)
+{
+ this->state_ = new_state;
+}
+
+ACE_INLINE int
+TAO_LF_Event::keep_waiting (void)
+{
+ return (this->successful () == 0) && (this->error_detected () == 0);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/LF_Event_Binder.cpp b/TAO/tao/LF_Event_Binder.cpp
new file mode 100644
index 00000000000..27fc93c2c5e
--- /dev/null
+++ b/TAO/tao/LF_Event_Binder.cpp
@@ -0,0 +1,20 @@
+// $Id$
+
+#include "tao/LF_Event_Binder.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/LF_Event_Binder.inl"
+#endif /* __ACE_INLINE__ */
+
+ACE_RCSID (tao,
+ LF_Event_Binder,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_LF_Event_Binder::~TAO_LF_Event_Binder (void)
+{
+ this->event_->unbind ();
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/LF_Event_Binder.h b/TAO/tao/LF_Event_Binder.h
new file mode 100644
index 00000000000..f6dcac517ef
--- /dev/null
+++ b/TAO/tao/LF_Event_Binder.h
@@ -0,0 +1,57 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file LF_Event_Binder.h
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan <coryan@uci.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_LF_EVENT_BINDER_H
+#define TAO_LF_EVENT_BINDER_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/LF_Event.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_LF_Follower;
+
+/**
+ * @brief Implement an auto_ptr-like class for the TAO_LF_Followers
+ * allocated via a TAO_Leader_Follower set.
+ *
+ * The Leader/Follower set is a factory for TAO_LF_Follower objects
+ */
+class TAO_Export TAO_LF_Event_Binder
+{
+public:
+ /// Constructor
+ TAO_LF_Event_Binder (TAO_LF_Event *event,
+ TAO_LF_Follower *folloer);
+
+ /// Destructor
+ ~TAO_LF_Event_Binder (void);
+
+private:
+ /// Keep a reference to the leader follower
+ TAO_LF_Event * const event_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/LF_Event_Binder.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_LF_EVENT_BINDER_H */
diff --git a/TAO/tao/LF_Event_Binder.inl b/TAO/tao/LF_Event_Binder.inl
new file mode 100644
index 00000000000..14027194f35
--- /dev/null
+++ b/TAO/tao/LF_Event_Binder.inl
@@ -0,0 +1,15 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO_LF_Event_Binder::TAO_LF_Event_Binder (TAO_LF_Event *event,
+ TAO_LF_Follower *follower)
+ : event_ (event)
+{
+ this->event_->bind (follower);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/LF_Event_Loop_Thread_Helper.cpp b/TAO/tao/LF_Event_Loop_Thread_Helper.cpp
new file mode 100644
index 00000000000..7fa8bc352b6
--- /dev/null
+++ b/TAO/tao/LF_Event_Loop_Thread_Helper.cpp
@@ -0,0 +1,11 @@
+// $Id$
+
+#include "tao/LF_Event_Loop_Thread_Helper.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/LF_Event_Loop_Thread_Helper.inl"
+#endif /* __ACE_INLINE__ */
+
+ACE_RCSID (tao,
+ LF_Event_Loop_Thread_Helper,
+ "$Id$")
diff --git a/TAO/tao/LF_Event_Loop_Thread_Helper.h b/TAO/tao/LF_Event_Loop_Thread_Helper.h
new file mode 100644
index 00000000000..3d5dfd95581
--- /dev/null
+++ b/TAO/tao/LF_Event_Loop_Thread_Helper.h
@@ -0,0 +1,67 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file LF_Event_Loop_Thread_Helper.h
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan <coryan@uci.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_LF_EVENT_LOOP_THREAD_HELPER_H
+#define TAO_LF_EVENT_LOOP_THREAD_HELPER_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/LF_Strategy.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @brief Helper class to enter and exit the Leader/Followers event
+ * loop.
+ *
+ * Uses the Guard idiom to enter and exit the Leader/Followers event
+ * loop.
+ */
+class TAO_Export TAO_LF_Event_Loop_Thread_Helper
+{
+public:
+ /// Constructor
+ TAO_LF_Event_Loop_Thread_Helper (TAO_Leader_Follower &leader_follower,
+ TAO_LF_Strategy &lf_strategy,
+ ACE_Time_Value *max_wait_time);
+
+ /// Destructor
+ ~TAO_LF_Event_Loop_Thread_Helper (void);
+
+ /// Calls <set_event_loop_thread> on the leader/followers object.
+ int event_loop_return (void) const;
+
+private:
+ /// Reference to leader/followers object.
+ TAO_Leader_Follower &leader_follower_;
+
+ /// The Leader/Follower Strategy used by this ORB.
+ TAO_LF_Strategy &lf_strategy_;
+
+ /// Remembers the status returned while trying to enter the event
+ /// loop.
+ int event_loop_return_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/LF_Event_Loop_Thread_Helper.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_LF_EVENT_LOOP_THREAD_HELPER_H */
diff --git a/TAO/tao/LF_Event_Loop_Thread_Helper.inl b/TAO/tao/LF_Event_Loop_Thread_Helper.inl
new file mode 100644
index 00000000000..2fd8c6d98e7
--- /dev/null
+++ b/TAO/tao/LF_Event_Loop_Thread_Helper.inl
@@ -0,0 +1,33 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO_LF_Event_Loop_Thread_Helper::TAO_LF_Event_Loop_Thread_Helper (
+ TAO_Leader_Follower &leader_follower,
+ TAO_LF_Strategy &lf_strategy,
+ ACE_Time_Value *max_wait_time)
+ : leader_follower_ (leader_follower)
+ , lf_strategy_ (lf_strategy)
+{
+ this->event_loop_return_ =
+ this->lf_strategy_.set_event_loop_thread (max_wait_time, leader_follower_);
+}
+
+ACE_INLINE
+TAO_LF_Event_Loop_Thread_Helper::~TAO_LF_Event_Loop_Thread_Helper (void)
+{
+ int call_reset = (this->event_loop_return_ == 0);
+ this->lf_strategy_.reset_event_loop_thread (call_reset,
+ this->leader_follower_);
+}
+
+ACE_INLINE int
+TAO_LF_Event_Loop_Thread_Helper::event_loop_return (void) const
+{
+ return this->event_loop_return_;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/LF_Follower.cpp b/TAO/tao/LF_Follower.cpp
new file mode 100644
index 00000000000..9e9cba91522
--- /dev/null
+++ b/TAO/tao/LF_Follower.cpp
@@ -0,0 +1,41 @@
+// $Id$
+
+#include "tao/LF_Follower.h"
+#include "tao/Leader_Follower.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/LF_Follower.inl"
+#endif /* __ACE_INLINE__ */
+
+ACE_RCSID (tao,
+ LF_Follower,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_LF_Follower::TAO_LF_Follower (TAO_Leader_Follower &leader_follower)
+ : leader_follower_ (leader_follower)
+ , condition_ (leader_follower.lock ())
+{
+}
+
+TAO_LF_Follower::~TAO_LF_Follower (void)
+{
+}
+
+int
+TAO_LF_Follower::signal (void)
+{
+ // We *must* remove ourselves from the list of followers, otherwise
+ // we could get signalled twice: to wake up as a follower and as the
+ // next leader.
+ // The follower may not be there if the reply is received while
+ // the consumer is not yet waiting for it (i.e. it send the
+ // request but has not blocked to receive the reply yet).
+ // Ignore errors.
+ (void) this->leader_follower_.remove_follower (this);
+
+ return this->condition_.signal ();
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/LF_Follower.h b/TAO/tao/LF_Follower.h
new file mode 100644
index 00000000000..b6dc6583cba
--- /dev/null
+++ b/TAO/tao/LF_Follower.h
@@ -0,0 +1,80 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file LF_Follower.h
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan <coryan@uci.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_LF_FOLLOWER_H
+#define TAO_LF_FOLLOWER_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/TAO_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Versioned_Namespace.h"
+
+#include "ace/Condition_Thread_Mutex.h"
+#include "ace/Synch_Traits.h"
+#include "ace/Intrusive_List_Node.h"
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Leader_Follower;
+
+/**
+ * @class TAO_LF_Follower
+ *
+ * @brief Represent a thread blocked, as a follower, in the
+ * Leader/Followers set.
+ *
+ * @todo Currently this class offers little abstraction, the follower
+ * loop should be implemented by this class.
+ *
+ */
+class TAO_Export TAO_LF_Follower
+ : public ACE_Intrusive_List_Node<TAO_LF_Follower>
+{
+public:
+ /// Constructor
+ TAO_LF_Follower (TAO_Leader_Follower &leader_follower);
+
+ /// Destructor
+ ~TAO_LF_Follower (void);
+
+ /// Access the leader follower that owns this follower
+ TAO_Leader_Follower &leader_follower (void);
+
+ /// Wait until on the underlying condition variable
+ int wait (ACE_Time_Value *tv);
+
+ /// Signal the underlying condition variable
+ int signal (void);
+
+private:
+ /// The Leader/Follower set this Follower belongs to
+ TAO_Leader_Follower &leader_follower_;
+
+ /// Condition variable used to
+ ACE_SYNCH_CONDITION condition_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/LF_Follower.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_LF_FOLLOWER_H */
diff --git a/TAO/tao/LF_Follower.inl b/TAO/tao/LF_Follower.inl
new file mode 100644
index 00000000000..8e88e259759
--- /dev/null
+++ b/TAO/tao/LF_Follower.inl
@@ -0,0 +1,19 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE TAO_Leader_Follower &
+TAO_LF_Follower::leader_follower (void)
+{
+ return this->leader_follower_;
+}
+
+ACE_INLINE int
+TAO_LF_Follower::wait (ACE_Time_Value *tv)
+{
+ return this->condition_.wait (tv);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/LF_Follower_Auto_Adder.cpp b/TAO/tao/LF_Follower_Auto_Adder.cpp
new file mode 100644
index 00000000000..4798d5c34c7
--- /dev/null
+++ b/TAO/tao/LF_Follower_Auto_Adder.cpp
@@ -0,0 +1,20 @@
+// $Id$
+
+#include "tao/LF_Follower_Auto_Adder.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/LF_Follower_Auto_Adder.inl"
+#endif /* __ACE_INLINE__ */
+
+ACE_RCSID (tao,
+ LF_Follower_Auto_Adder,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_LF_Follower_Auto_Adder::~TAO_LF_Follower_Auto_Adder (void)
+{
+ this->leader_follower_.remove_follower (this->follower_);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/LF_Follower_Auto_Adder.h b/TAO/tao/LF_Follower_Auto_Adder.h
new file mode 100644
index 00000000000..f1161f6b14f
--- /dev/null
+++ b/TAO/tao/LF_Follower_Auto_Adder.h
@@ -0,0 +1,60 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file LF_Follower_Auto_Adder.h
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan <coryan@uci.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_LF_FOLLOWER_AUTO_ADDER_H
+#define TAO_LF_FOLLOWER_AUTO_ADDER_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/LF_Follower.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Leader_Follower.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @brief Implement an auto_adder-like class for the TAO_LF_Followers
+ * allocated via a TAO_Leader_Follower set.
+ *
+ * The Leader/Follower set is a factory for TAO_LF_Follower objects
+ */
+class TAO_Export TAO_LF_Follower_Auto_Adder
+{
+public:
+ /// Constructor
+ TAO_LF_Follower_Auto_Adder (TAO_Leader_Follower &,
+ TAO_LF_Follower *follower);
+
+ /// Destructor
+ ~TAO_LF_Follower_Auto_Adder (void);
+
+private:
+ /// Keep a reference to the leader follower
+ TAO_Leader_Follower &leader_follower_;
+
+ /// The follower
+ TAO_LF_Follower *follower_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/LF_Follower_Auto_Adder.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_LF_FOLLOWER_AUTO_ADDER_H */
diff --git a/TAO/tao/LF_Follower_Auto_Adder.inl b/TAO/tao/LF_Follower_Auto_Adder.inl
new file mode 100644
index 00000000000..0fa419366d0
--- /dev/null
+++ b/TAO/tao/LF_Follower_Auto_Adder.inl
@@ -0,0 +1,17 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO_LF_Follower_Auto_Adder::
+ TAO_LF_Follower_Auto_Adder (TAO_Leader_Follower &lf,
+ TAO_LF_Follower *follower)
+ : leader_follower_ (lf)
+ , follower_ (follower)
+{
+ (void) this->leader_follower_.add_follower (this->follower_);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/LF_Follower_Auto_Ptr.cpp b/TAO/tao/LF_Follower_Auto_Ptr.cpp
new file mode 100644
index 00000000000..7152175eb48
--- /dev/null
+++ b/TAO/tao/LF_Follower_Auto_Ptr.cpp
@@ -0,0 +1,20 @@
+// $Id$
+
+#include "tao/LF_Follower_Auto_Ptr.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/LF_Follower_Auto_Ptr.inl"
+#endif /* __ACE_INLINE__ */
+
+ACE_RCSID (tao,
+ LF_Follower_Auto_Ptr,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_LF_Follower_Auto_Ptr::~TAO_LF_Follower_Auto_Ptr (void)
+{
+ this->leader_follower_.release_follower (this->follower_);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/LF_Follower_Auto_Ptr.h b/TAO/tao/LF_Follower_Auto_Ptr.h
new file mode 100644
index 00000000000..52c2aae3411
--- /dev/null
+++ b/TAO/tao/LF_Follower_Auto_Ptr.h
@@ -0,0 +1,64 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file LF_Follower_Auto_Ptr.h
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan <coryan@uci.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_LF_FOLLOWER_AUTO_PTR_H
+#define TAO_LF_FOLLOWER_AUTO_PTR_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/LF_Follower.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Leader_Follower.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @brief Implement an auto_ptr-like class for the TAO_LF_Followers
+ * allocated via a TAO_Leader_Follower set.
+ *
+ * The Leader/Follower set is a factory for TAO_LF_Follower objects
+ */
+class TAO_Export TAO_LF_Follower_Auto_Ptr
+{
+public:
+ /// Constructor
+ TAO_LF_Follower_Auto_Ptr (TAO_Leader_Follower &);
+
+ /// Destructor
+ ~TAO_LF_Follower_Auto_Ptr (void);
+
+ /// Implement the smart pointer methods
+ TAO_LF_Follower *get (void);
+ TAO_LF_Follower *operator->(void);
+ operator TAO_LF_Follower *(void);
+
+private:
+ /// Keep a reference to the leader follower
+ TAO_Leader_Follower &leader_follower_;
+
+ /// The follower
+ TAO_LF_Follower *follower_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/LF_Follower_Auto_Ptr.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_LF_FOLLOWER_AUTO_PTR_H */
diff --git a/TAO/tao/LF_Follower_Auto_Ptr.inl b/TAO/tao/LF_Follower_Auto_Ptr.inl
new file mode 100644
index 00000000000..8d933799401
--- /dev/null
+++ b/TAO/tao/LF_Follower_Auto_Ptr.inl
@@ -0,0 +1,32 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO_LF_Follower_Auto_Ptr::TAO_LF_Follower_Auto_Ptr (TAO_Leader_Follower &lf)
+ : leader_follower_ (lf)
+ , follower_ (leader_follower_.allocate_follower ())
+{
+}
+
+ACE_INLINE TAO_LF_Follower *
+TAO_LF_Follower_Auto_Ptr::get (void)
+{
+ return this->follower_;
+}
+
+ACE_INLINE TAO_LF_Follower *
+TAO_LF_Follower_Auto_Ptr::operator-> (void)
+{
+ return this->follower_;
+}
+
+ACE_INLINE
+TAO_LF_Follower_Auto_Ptr::operator TAO_LF_Follower * (void)
+{
+ return this->follower_;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/LF_Invocation_Event.cpp b/TAO/tao/LF_Invocation_Event.cpp
new file mode 100644
index 00000000000..fc42ec084fc
--- /dev/null
+++ b/TAO/tao/LF_Invocation_Event.cpp
@@ -0,0 +1,92 @@
+// -*- C++ -*-
+#include "tao/LF_Invocation_Event.h"
+
+ACE_RCSID(tao,
+ LF_Invocation_Event,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_LF_Invocation_Event::TAO_LF_Invocation_Event (void)
+ : TAO_LF_Event ()
+{
+}
+
+TAO_LF_Invocation_Event::~TAO_LF_Invocation_Event (void)
+{
+}
+
+void
+TAO_LF_Invocation_Event::state_changed_i (int new_state)
+{
+ if (this->state_ == new_state)
+ return;
+
+ // Validate the state change
+ if (this->state_ == TAO_LF_Event::LFS_IDLE)
+ {
+ // From the LFS_IDLE state we can only become active.
+ if (new_state == TAO_LF_Event::LFS_ACTIVE
+ || new_state == TAO_LF_Event::LFS_CONNECTION_CLOSED)
+ this->state_ = new_state;
+ return;
+ }
+ else if (this->state_ == TAO_LF_Event::LFS_ACTIVE)
+ {
+ // From LFS_ACTIVE we can only move to a few states
+ if (new_state != TAO_LF_Event::LFS_IDLE)
+ {
+ if (new_state == TAO_LF_Event::LFS_CONNECTION_CLOSED)
+ {
+ this->state_ = TAO_LF_Event::LFS_FAILURE;
+ }
+ else
+ {
+ this->state_ = new_state;
+ }
+ }
+ return;
+ }
+ else if (this->state_ == TAO_LF_Event::LFS_SUCCESS
+ || this->state_ == TAO_LF_Event::LFS_CONNECTION_CLOSED)
+ {
+ // From the two states above we can go back to ACTIVE, as when a
+ // request is restarted.
+ if (new_state == TAO_LF_Event::LFS_ACTIVE)
+ {
+ this->state_ = new_state;
+ }
+ return;
+ }
+ else/* if (this->state_ == TAO_LF_Event::LFS_TIMEOUT || FAILURE */
+ {
+ // Other states are final..
+ }
+
+}
+
+int
+TAO_LF_Invocation_Event::successful (void) const
+{
+ return this->state_ == TAO_LF_Event::LFS_SUCCESS;
+}
+
+int
+TAO_LF_Invocation_Event::error_detected (void) const
+{
+ return (this->state_ == TAO_LF_Event::LFS_FAILURE
+ || this->state_ == TAO_LF_Event::LFS_TIMEOUT
+ || this->state_ == TAO_LF_Event::LFS_CONNECTION_CLOSED);
+}
+
+int
+TAO_LF_Invocation_Event::is_state_final (void)
+{
+ if (this->state_ == TAO_LF_Event::LFS_TIMEOUT ||
+ this->state_ == TAO_LF_Event::LFS_FAILURE)
+ return 1;
+
+ return 0;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/LF_Invocation_Event.h b/TAO/tao/LF_Invocation_Event.h
new file mode 100644
index 00000000000..a3db772d40d
--- /dev/null
+++ b/TAO/tao/LF_Invocation_Event.h
@@ -0,0 +1,86 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file LF_Invocation_Event.h
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan <coryan@uci.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_LF_INVOCATION_EVENT_H
+#define TAO_LF_INVOCATION_EVENT_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/LF_Event.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_LF_Invocation_Event
+ *
+ * @brief Use the Leader/Follower loop to wait for one specific event
+ * in the invocation path.
+ *
+ * Concrete event types and manipulation class through which the
+ * invocation data path would flow. Typically state changes of
+ * interest include whether a message has arrived, or timedout waiting
+ * for a message or if the cionnection is closed waiting for a
+ * message. Details of the states are documented within the class.
+ *
+ */
+class TAO_Export TAO_LF_Invocation_Event: public TAO_LF_Event
+{
+public:
+ /// Constructor
+ TAO_LF_Invocation_Event (void);
+
+ /// Destructor
+ virtual ~TAO_LF_Invocation_Event (void);
+
+ /// Return 1 if the condition was satisfied successfully, 0 if it
+ /// has not
+ int successful (void) const;
+
+ /// Return 1 if an error was detected while waiting for the
+ /// event
+ int error_detected (void) const;
+ //@}
+
+protected:
+
+ /// Validate and perform the state change
+ /*
+ * This concrete class uses the following states declared in the
+ * class TAO_LF_Event
+ *
+ * LFS_IDLE - The event is created, and is in initial state.
+ * LFS_ACTIVE - The event is active and it can transition to any of
+ * the following states, all the states are final.
+ * LFS_SUCCESS - The event has completed successfully.
+ * LFS_FAILURE - A failure has been detected while the event was
+ * active.
+ * LFS_TIMEOUT - The event has timed out.
+ * LFS_CONNECTION_CLOSED - The connection was closed when the state
+ * was active.
+ *
+ */
+ virtual void state_changed_i (int new_state);
+
+private:
+ /// Check whether we have reached the final state..
+ int is_state_final (void);
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_LF_INVOCATION_EVENT_H */
diff --git a/TAO/tao/LF_Multi_Event.cpp b/TAO/tao/LF_Multi_Event.cpp
new file mode 100644
index 00000000000..bd1e5e2e88f
--- /dev/null
+++ b/TAO/tao/LF_Multi_Event.cpp
@@ -0,0 +1,123 @@
+#include "tao/LF_Multi_Event.h"
+#include "tao/Connection_Handler.h"
+#include "ace/OS_Memory.h"
+
+ACE_RCSID(tao,
+ LF_Multi_Event,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+
+TAO_LF_Multi_Event::TAO_LF_Multi_Event (void)
+ : TAO_LF_Event (),
+ events_ (0),
+ winner_ (0)
+{
+}
+
+TAO_LF_Multi_Event::~TAO_LF_Multi_Event (void)
+{
+ while (this->events_ != 0)
+ {
+ Event_Node *n = this->events_->next_;
+ delete this->events_;
+ this->events_ = n;
+ }
+}
+
+int
+TAO_LF_Multi_Event::bind (TAO_LF_Follower *follower)
+{
+ if (this->TAO_LF_Event::bind(follower) == -1)
+ {
+ return -1;
+ }
+
+ for (Event_Node *n = this->events_; n != 0; n = n->next_)
+ if (n->ptr_->bind(follower) == -1)
+ {
+ return -1;
+ }
+ return 0;
+}
+
+int
+TAO_LF_Multi_Event::unbind (void)
+{
+ if (this->TAO_LF_Event::unbind() == -1)
+ {
+ return -1;
+ }
+
+ for (Event_Node *n = this->events_; n != 0; n = n->next_)
+ if (n->ptr_->unbind() == -1)
+ {
+ return -1;
+ }
+ return 0;
+}
+
+
+void
+TAO_LF_Multi_Event::add_event (TAO_Connection_Handler *ev)
+{
+ Event_Node *node = 0;
+ ACE_NEW (node, Event_Node);
+ node->next_ = this->events_;
+ node->ptr_ = ev;
+
+ this->events_ = node;
+}
+
+TAO_Connection_Handler*
+TAO_LF_Multi_Event::winner (void)
+{
+ return this->winner_;
+}
+
+TAO_Transport *
+TAO_LF_Multi_Event::base_transport (void)
+{
+ return (this->events_ == 0) ? 0 : this->events_->ptr_->transport();
+}
+
+int
+TAO_LF_Multi_Event::successful (void) const
+{
+ for (Event_Node *n = this->events_; n != 0; n = n->next_)
+ if (n->ptr_->successful() == 1)
+ {
+ this->winner_ = n->ptr_;
+ return 1;
+ }
+ return 0;
+}
+
+int
+TAO_LF_Multi_Event::error_detected (void) const
+{
+ int result = 1;
+ for (Event_Node *n = this->events_; n != 0; n = n->next_)
+ if (n->ptr_->error_detected () == 0)
+ result = 0;
+ return result;
+}
+
+void
+TAO_LF_Multi_Event::state_changed_i (int )
+{
+ // no-op
+}
+
+int
+TAO_LF_Multi_Event::is_state_final (void)
+{
+ int result = 1;
+ for (Event_Node *n = this->events_; n != 0; n = n->next_)
+ if (!n->ptr_->is_state_final () == 0)
+ result = 0;
+ return result;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/LF_Multi_Event.h b/TAO/tao/LF_Multi_Event.h
new file mode 100644
index 00000000000..5d2167db55b
--- /dev/null
+++ b/TAO/tao/LF_Multi_Event.h
@@ -0,0 +1,101 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file LF_Multi_Event.h
+ *
+ * $Id$
+ *
+ * @author Phil Mesnier <mesnier_p@ociweb.com>
+ */
+//=============================================================================
+
+#ifndef TAO_LF_MULTI_EVENT_H
+#define TAO_LF_MULTI_EVENT_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/LF_Event.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Forward decls
+class TAO_Connection_Handler;
+class TAO_Transport;
+
+/**
+ * @class TAO_LF_Multi_Event
+ *
+ * @brief Use the Leader/Follower loop to wait for one specific event
+ * in the invocation path.
+ *
+ * Used by the parallel connection strategy for waiting on one of many
+ * connections.
+ */
+class TAO_Export TAO_LF_Multi_Event: public TAO_LF_Event
+{
+public:
+ /// Constructor
+ TAO_LF_Multi_Event (void);
+
+ /// Destructor
+ virtual ~TAO_LF_Multi_Event (void);
+
+ /// propogate the follower to all the events in the collection.
+ virtual int bind (TAO_LF_Follower *follower);
+
+ /// Unbind the follower from all the collected events.
+ virtual int unbind (void);
+
+ /// Adds a handler to the collection
+ void add_event (TAO_Connection_Handler *ch);
+
+ /// Returns the connection handler that caused the successful status
+ /// to be returned.
+ TAO_Connection_Handler *winner(void);
+
+ /// Returns the transport associated with the first entry in the collection.
+ TAO_Transport *base_transport(void);
+
+ //@{
+ /// Return 1 if the condition was satisfied successfully, 0 if it
+ /// has not - This iterates over the list of attached events and
+ /// returns 1 if any of them return 1 from successful.
+ int successful (void) const;
+
+ /// Return 1 if an error was detected while waiting for the
+ /// event - This iterates over the list of events and returns
+ /// 1 only if all of them return 1 from error_detected.
+ int error_detected (void) const;
+
+ //@}
+protected:
+
+ /// Validate the state change
+ virtual void state_changed_i (int new_state);
+
+ /// Check whether we have reached the final state..
+ virtual int is_state_final (void);
+
+private:
+
+ struct Event_Node {
+ TAO_Connection_Handler * ptr_;
+ Event_Node *next_;
+ };
+
+ struct Event_Node *events_;
+
+ mutable TAO_Connection_Handler * winner_;
+
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_LF_Multi_EVENT_H */
diff --git a/TAO/tao/LF_Strategy.cpp b/TAO/tao/LF_Strategy.cpp
new file mode 100644
index 00000000000..8c30e4b4e96
--- /dev/null
+++ b/TAO/tao/LF_Strategy.cpp
@@ -0,0 +1,15 @@
+// $Id$
+
+#include "tao/LF_Strategy.h"
+
+ACE_RCSID (tao,
+ LF_Strategy,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_LF_Strategy::~TAO_LF_Strategy (void)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/LF_Strategy.h b/TAO/tao/LF_Strategy.h
new file mode 100644
index 00000000000..782821a2542
--- /dev/null
+++ b/TAO/tao/LF_Strategy.h
@@ -0,0 +1,82 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file LF_Strategy.h
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan <coryan@uci.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_LF_STRATEGY_H
+#define TAO_LF_STRATEGY_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/TAO_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Versioned_Namespace.h"
+
+ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+class ACE_Time_Value;
+ACE_END_VERSIONED_NAMESPACE_DECL
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Leader_Follower;
+
+/**
+ * @brief Strategize Leader/Follower manipulations in the ORB event
+ * loop.
+ *
+ * The ORB event loop must participate in the Leader/Followers
+ * protocol, but only if that concurrency model is configured,
+ * otherwise performance suffers.
+ *
+ * This class strategizes the ORB behavior in this respect.
+ */
+class TAO_Export TAO_LF_Strategy
+{
+public:
+ /// Destructor
+ virtual ~TAO_LF_Strategy (void);
+
+ /// The current thread will handle an upcall
+ /**
+ * Threads that handle requests can block for long periods of time,
+ * causing deadlocks if they don't elect a new leader before
+ * starting the upcall the system can become non-responsive or
+ * dead-lock.
+ */
+ virtual void set_upcall_thread (TAO_Leader_Follower &) = 0;
+
+ /// The current thread is entering the reactor event loop
+ /**
+ * Threads that block in the reactor event loop become "server"
+ * threads for the Leader/Follower set. They must be flagged
+ * specially because they do not wait for one specific event, but
+ * for any event whatsoever.
+ */
+ virtual int set_event_loop_thread (ACE_Time_Value *max_wait_time,
+ TAO_Leader_Follower &) = 0;
+
+ /// The current thread is leaving the event loop
+ /**
+ * When the thread leaves the event loop a new leader must be
+ * elected.
+ */
+ virtual void reset_event_loop_thread (int call_reset,
+ TAO_Leader_Follower &) = 0;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_LF_STRATEGY_H */
diff --git a/TAO/tao/LF_Strategy_Complete.cpp b/TAO/tao/LF_Strategy_Complete.cpp
new file mode 100644
index 00000000000..92b29445e18
--- /dev/null
+++ b/TAO/tao/LF_Strategy_Complete.cpp
@@ -0,0 +1,51 @@
+// $Id$
+
+#include "tao/LF_Strategy_Complete.h"
+#include "tao/LF_Follower.h"
+#include "tao/Leader_Follower.h"
+#include "ace/Guard_T.h"
+#include "ace/Log_Msg.h"
+
+ACE_RCSID (tao,
+ LF_Strategy_Complete,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_LF_Strategy_Complete::~TAO_LF_Strategy_Complete (void)
+{
+}
+
+void
+TAO_LF_Strategy_Complete::set_upcall_thread (TAO_Leader_Follower &lf)
+{
+ lf.set_upcall_thread ();
+}
+
+int
+TAO_LF_Strategy_Complete::set_event_loop_thread (ACE_Time_Value *tv,
+ TAO_Leader_Follower &lf)
+{
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, lf.lock (), -1);
+
+ return lf.set_event_loop_thread (tv);
+}
+
+void
+TAO_LF_Strategy_Complete::reset_event_loop_thread (int call_reset,
+ TAO_Leader_Follower &lf)
+{
+ ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, lf.lock ());
+
+ if (call_reset)
+ lf.reset_event_loop_thread ();
+
+ int const result = lf.elect_new_leader ();
+
+ if (result == -1)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) Failed to wake up ")
+ ACE_TEXT ("a follower thread\n")));
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/LF_Strategy_Complete.h b/TAO/tao/LF_Strategy_Complete.h
new file mode 100644
index 00000000000..a3dfb19996e
--- /dev/null
+++ b/TAO/tao/LF_Strategy_Complete.h
@@ -0,0 +1,55 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file LF_Strategy_Complete.h
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan <coryan@uci.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_LF_STRATEGY_COMPLETE_H
+#define TAO_LF_STRATEGY_COMPLETE_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/LF_Strategy.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+
+
+
+/**
+ * @brief A concrete TAO_LF_Strategy for ORB configurations that use
+ * the Leader/Followers event loop.
+ */
+class TAO_Export TAO_LF_Strategy_Complete : public TAO_LF_Strategy
+{
+public:
+ //@{
+ /** @name Virtual Methods
+ *
+ * Please check the documentation in TAO_LF_Strategy
+ */
+ virtual ~TAO_LF_Strategy_Complete (void);
+
+ virtual void set_upcall_thread (TAO_Leader_Follower &);
+ virtual int set_event_loop_thread (ACE_Time_Value *max_wait_time,
+ TAO_Leader_Follower &);
+ virtual void reset_event_loop_thread (int call_reset,
+ TAO_Leader_Follower &);
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_LF_STRATEGY_COMPLETE_H */
diff --git a/TAO/tao/LRU_Connection_Purging_Strategy.cpp b/TAO/tao/LRU_Connection_Purging_Strategy.cpp
new file mode 100644
index 00000000000..2b2b1f9472a
--- /dev/null
+++ b/TAO/tao/LRU_Connection_Purging_Strategy.cpp
@@ -0,0 +1,31 @@
+// $Id$
+
+#include "tao/LRU_Connection_Purging_Strategy.h"
+#include "tao/Transport.h"
+
+ACE_RCSID (tao,
+ LRU_Connection_Purging_Strategy,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_LRU_Connection_Purging_Strategy::TAO_LRU_Connection_Purging_Strategy (
+ int cache_maximum)
+ : TAO_Connection_Purging_Strategy (cache_maximum),
+ order_ (0)
+{
+}
+
+
+TAO_LRU_Connection_Purging_Strategy::~TAO_LRU_Connection_Purging_Strategy (void)
+{
+}
+
+
+void
+TAO_LRU_Connection_Purging_Strategy::update_item (TAO_Transport* transport)
+{
+ transport->purging_order (++this->order_);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/LRU_Connection_Purging_Strategy.h b/TAO/tao/LRU_Connection_Purging_Strategy.h
new file mode 100644
index 00000000000..8ea7319d723
--- /dev/null
+++ b/TAO/tao/LRU_Connection_Purging_Strategy.h
@@ -0,0 +1,61 @@
+// -*- C++ -*-
+
+// ================================================================
+/**
+ * @file LRU_Connection_Purging_Strategy.h
+ *
+ * $Id$
+ *
+ * @author Chad Elliott (elliott_c@ociweb.com)
+ */
+// ================================================================
+
+#ifndef TAO_LRU_PURGING_STRATEGY_H
+#define TAO_LRU_PURGING_STRATEGY_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Connection_Purging_Strategy.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+// ****************************************************************
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_LRU_Connection_Purging_Strategy
+ *
+ * @brief The Least Recently Used connection purging strategy
+ *
+ * This class maintains it's own count which is applied to the
+ * item passed in. This way, the least recently used transport
+ * has the smallest ordering number and will therefore be purged
+ * first.
+ */
+
+class TAO_Export TAO_LRU_Connection_Purging_Strategy
+ : public TAO_Connection_Purging_Strategy
+{
+public:
+ /// The constructor
+ TAO_LRU_Connection_Purging_Strategy (int cache_maximum);
+
+ /// The destructor
+ virtual ~TAO_LRU_Connection_Purging_Strategy (void);
+
+ /// Called when accessing an item from the cache
+ virtual void update_item (TAO_Transport* transport);
+
+private:
+ /// The ordering information for each transport in the cache
+ unsigned long order_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_LRU_PURGING_STRATEGY_H */
diff --git a/TAO/tao/Leader_Follower.cpp b/TAO/tao/Leader_Follower.cpp
new file mode 100644
index 00000000000..5a49b4ec456
--- /dev/null
+++ b/TAO/tao/Leader_Follower.cpp
@@ -0,0 +1,495 @@
+// $Id$
+
+#include "ace/Countdown_Time.h"
+#include "ace/OS_NS_sys_time.h"
+#include "ace/Reactor.h"
+
+#include "tao/Leader_Follower.h"
+#include "tao/LF_Follower_Auto_Ptr.h"
+#include "tao/LF_Follower_Auto_Adder.h"
+#include "tao/LF_Event_Binder.h"
+#include "tao/debug.h"
+#include "tao/Transport.h"
+#include "tao/GUIResource_Factory.h"
+#include "tao/ORB_Core.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/Leader_Follower.i"
+#endif /* ! __ACE_INLINE__ */
+
+ACE_RCSID (tao,
+ Leader_Follower,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Leader_Follower::~TAO_Leader_Follower (void)
+{
+ while (!this->follower_free_list_.empty ())
+ {
+ TAO_LF_Follower *follower =
+ this->follower_free_list_.pop_front ();
+ delete follower;
+ }
+ // Hand the reactor back to the resource factory.
+ // use GUI reactor factory if available
+ if ( this->orb_core_->gui_resource_factory () )
+ this->orb_core_->gui_resource_factory ()->reclaim_reactor (this->reactor_);
+ else
+ this->orb_core_->resource_factory ()->reclaim_reactor (this->reactor_);
+
+ this->reactor_ = 0;
+}
+
+TAO_LF_Follower *
+TAO_Leader_Follower::allocate_follower (void)
+{
+ if (!this->follower_free_list_.empty ())
+ return this->follower_free_list_.pop_front ();
+
+ TAO_LF_Follower* ptr = 0;
+ ACE_NEW_RETURN (ptr,
+ TAO_LF_Follower (*this),
+ 0);
+ return ptr;
+}
+
+void
+TAO_Leader_Follower::release_follower (TAO_LF_Follower *follower)
+{
+ this->follower_free_list_.push_front (follower);
+}
+
+int
+TAO_Leader_Follower::elect_new_leader_i (void)
+{
+ TAO_LF_Follower* const follower =
+ this->follower_set_.head ();
+
+#if defined (TAO_DEBUG_LEADER_FOLLOWER)
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) LF::elect_new_leader_i - "
+ "follower is %x\n",
+ follower));
+#endif /* TAO_DEBUG_LEADER_FOLLOWER */
+
+ return follower->signal ();
+}
+
+int
+TAO_Leader_Follower::wait_for_client_leader_to_complete (ACE_Time_Value *max_wait_time)
+{
+ int result = 0;
+ ACE_Countdown_Time countdown (max_wait_time);
+
+ // Note that we are waiting.
+ ++this->event_loop_threads_waiting_;
+
+ while (this->client_thread_is_leader_ &&
+ result != -1)
+ {
+ if (max_wait_time == 0)
+ {
+ if (this->event_loop_threads_condition_.wait () == -1)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t): TAO_Leader_Follower::wait_for_client_leader_to_complete - ")
+ ACE_TEXT ("Condition variable wait failed\n")));
+
+ result = -1;
+ }
+ }
+ else
+ {
+ countdown.update ();
+ ACE_Time_Value tv = ACE_OS::gettimeofday ();
+ tv += *max_wait_time;
+ if (this->event_loop_threads_condition_.wait (&tv) == -1)
+ {
+ if (errno != ETIME)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t): TAO_Leader_Follower::wait_for_client_leader_to_complete - ")
+ ACE_TEXT ("Condition variable wait failed\n")));
+
+ result = -1;
+ }
+ }
+ }
+
+ // Reset waiting state.
+ --this->event_loop_threads_waiting_;
+
+ return result;
+}
+
+ACE_Reactor *
+TAO_Leader_Follower::reactor (void)
+{
+ if (this->reactor_ == 0)
+ {
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->lock (), 0);
+ if (this->reactor_ == 0)
+ {
+ // use GUI reactor factory if available
+ if ( this->orb_core_->gui_resource_factory () )
+ this->reactor_ =
+ this->orb_core_->gui_resource_factory ()->get_reactor ();
+ else
+ this->reactor_ =
+ this->orb_core_->resource_factory ()->get_reactor ();
+ }
+ }
+ return this->reactor_;
+}
+
+void
+TAO_Leader_Follower::set_client_thread (void)
+{
+ // If we were a leader thread or an event loop thread, give up
+ // leadership.
+ TAO_ORB_Core_TSS_Resources *tss = this->get_tss_resources ();
+ if (tss->event_loop_thread_ ||
+ tss->client_leader_thread_)
+ {
+ --this->leaders_;
+ }
+
+ if (this->clients_ == 0 &&
+ this->orb_core_->has_shutdown () &&
+ !this->orb_core_->resource_factory ()->drop_replies_during_shutdown ())
+ {
+ // The ORB has shutdown and we are the first client after
+ // that. This means that the reactor is disabled, we must
+ // re-enable it if we want to receive any replys...
+ this->orb_core_->reactor ()->reset_reactor_event_loop ();
+ }
+ ++this->clients_;
+}
+
+void
+TAO_Leader_Follower::reset_client_thread (void)
+{
+ // If we were a leader thread or an event loop thread, take back
+ // leadership.
+ TAO_ORB_Core_TSS_Resources *tss = this->get_tss_resources ();
+ if (tss->event_loop_thread_ ||
+ tss->client_leader_thread_)
+ {
+ ++this->leaders_;
+ }
+
+ --this->clients_;
+ if (this->clients_ == 0 &&
+ this->orb_core_->has_shutdown ())
+ {
+ // The ORB has shutdown and we are the last client thread, we
+ // must stop the reactor to ensure that any server threads go
+ // away.
+ this->orb_core_->reactor ()->end_reactor_event_loop ();
+ }
+}
+
+int
+TAO_Leader_Follower::wait_for_event (TAO_LF_Event *event,
+ TAO_Transport *transport,
+ ACE_Time_Value *max_wait_time)
+{
+ // Obtain the lock.
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->lock (), -1);
+
+ ACE_Countdown_Time countdown (max_wait_time);
+
+ // Optmize the first iteration [no access to errno]
+ int result = 1;
+
+ // For some cases the transport may dissappear like when waiting for
+ // connection to be initiated or closed. So cache the id.
+ // @@ NOTE: This is not completely safe either. We will be fine for
+ // cases that dont access the id ie. when debug level is off but
+ // with debugging level on we are on a sticky wicket. Hopefully none
+ // of our users should run TAO with debugging enabled like they did
+ // in PathFinder
+ size_t t_id = 0;
+
+ if (TAO_debug_level)
+ {
+ t_id = transport->id ();
+ }
+
+ {
+ // Calls this->set_client_thread () on construction and
+ // this->reset_client_thread () on destruction.
+ TAO_LF_Client_Thread_Helper client_thread_helper (*this);
+ ACE_UNUSED_ARG (client_thread_helper);
+
+ // Check if there is a leader. Note that it cannot be us since we
+ // gave up our leadership when we became a client.
+ if (this->leader_available ())
+ {
+ // = Wait as a follower.
+
+ // Grab a follower:
+ TAO_LF_Follower_Auto_Ptr follower (*this);
+ if (follower.get () == 0)
+ return -1;
+
+ if (TAO_debug_level >= 5)
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - Leader_Follower[%d]::wait_for_event,"
+ " (follower), cond <%x>\n",
+ t_id, follower.get ()));
+
+ // Bound the follower and the LF_Event, this is important to
+ // get a signal when the event terminates
+ TAO_LF_Event_Binder event_binder (event, follower.get ());
+
+ while (event->keep_waiting () &&
+ this->leader_available ())
+ {
+ // Add ourselves to the list, do it everytime we wake up
+ // from the CV loop. Because:
+ //
+ // - The leader thread could have elected us as the new
+ // leader.
+ // - Before we can assume the role another thread becomes
+ // the leader
+ // - But our condition variable could have been removed
+ // already, if we don't add it again we will never wake
+ // up.
+ //
+ // Notice that we can have spurious wake ups, in that case
+ // adding the leader results in an error, that must be
+ // ignored.
+ // You may be thinking of not removing the condition
+ // variable in the code that sends the signal, but
+ // removing it here, that does not work either, in that
+ // case the condition variable may be used twice:
+ //
+ // - Wake up because its reply arrived
+ // - Wake up because it must become the leader
+ //
+ // but only the first one has any effect, so the leader is
+ // lost.
+ //
+
+ TAO_LF_Follower_Auto_Adder auto_adder (*this, follower);
+
+ if (max_wait_time == 0)
+ {
+ if (follower->wait (max_wait_time) == -1)
+ {
+ if (TAO_debug_level >= 5)
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - Leader_Follower[%d]::wait_for_event, "
+ " (follower) [no timer, cond failed]\n",
+ t_id));
+
+ // @@ Michael: What is our error handling in this case?
+ // We could be elected as leader and
+ // no leader would come in?
+ return -1;
+ }
+ }
+ else
+ {
+ countdown.update ();
+ ACE_Time_Value tv = ACE_OS::gettimeofday ();
+ tv += *max_wait_time;
+ if (follower->wait (&tv) == -1)
+ {
+ if (TAO_debug_level >= 5)
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - Leader_Follower[%d]::wait, "
+ "(follower) [has timer, follower failed]\n",
+ t_id ));
+
+ // If we have timedout set the state in the
+ // LF_Event. We call the non-locking,
+ // no-signalling method on LF_Event.
+ if (errno == ETIME)
+ // We have timedout
+ event->set_state (TAO_LF_Event::LFS_TIMEOUT);
+
+ if (!event->successful ())
+ {
+ // Remove follower can fail because either
+ // 1) the condition was satisfied (i.e. reply
+ // received or queue drained), or
+ // 2) somebody elected us as leader, or
+ // 3) the connection got closed.
+ //
+ // Therefore:
+ // If remove_follower fails and the condition
+ // was not satisfied, we know that we got
+ // elected as a leader.
+ // But we got a timeout, so we cannot become
+ // the leader, therefore, we have to select a
+ // new leader.
+ //
+
+ if (this->elect_new_leader () == -1
+ && TAO_debug_level > 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "TAO (%P|%t) - Leader_Follower[%d]::wait_for_event, "
+ "elect_new_leader failed\n",
+ t_id ));
+ }
+ }
+
+
+ return -1;
+ }
+ }
+ }
+
+ countdown.update ();
+
+ // @@ Michael: This is an old comment why we do not want to
+ // remove the follower here.
+ // We should not remove the follower here, we *must* remove it when
+ // we signal it so the same condition is not signalled for
+ // both wake up as a follower and as the next leader.
+
+ if (TAO_debug_level >= 5)
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - Leader_Follower[%d]::wait_for_event,"
+ " done (follower), successful %d\n",
+ t_id,
+ event->successful ()));
+
+ // Now somebody woke us up to become a leader or to handle our
+ // input. We are already removed from the follower queue.
+
+ if (event->successful ())
+ return 0;
+
+ if (event->error_detected ())
+ return -1;
+
+ // FALLTHROUGH
+ // We only get here if we woke up but the reply is not
+ // complete yet, time to assume the leader role....
+ // i.e. ACE_ASSERT (event->successful () == 0);
+ }
+
+ // = Leader Code.
+
+ // The only way to reach this point is if we must become the
+ // leader, because there is no leader or we have to update to a
+ // leader or we are doing nested upcalls in this case we do
+ // increase the refcount on the leader in TAO_ORB_Core.
+
+ // Calls this->set_client_leader_thread () on
+ // construction and this->reset_client_leader_thread ()
+ // on destruction. Note that this may increase the refcount of
+ // the leader.
+ TAO_LF_Client_Leader_Thread_Helper client_leader_thread_helper (*this);
+ ACE_UNUSED_ARG (client_leader_thread_helper);
+
+ {
+ ACE_GUARD_RETURN (ACE_Reverse_Lock<TAO_SYNCH_MUTEX>, rev_mon,
+ this->reverse_lock (), -1);
+
+ // Become owner of the reactor.
+ ACE_Reactor *reactor = this->reactor_;
+ reactor->owner (ACE_Thread::self ());
+
+ // Run the reactor event loop.
+
+ if (TAO_debug_level >= 5)
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - Leader_Follower[%d]::wait_for_event,"
+ " (leader) enter reactor event loop\n",
+ t_id));
+
+ // If we got our event, no need to run the event loop any
+ // further.
+ while (event->keep_waiting ())
+ {
+ // Run the event loop.
+ result = reactor->handle_events (max_wait_time);
+
+ // Did we timeout? If so, stop running the loop.
+ if (result == 0 &&
+ max_wait_time != 0 &&
+ *max_wait_time == ACE_Time_Value::zero)
+ break;
+
+ // Other errors? If so, stop running the loop.
+ if (result == -1)
+ break;
+
+ // Otherwise, keep going...
+ }
+
+ if (TAO_debug_level >= 5)
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - Leader_Follower[%d]::wait_for_event,"
+ " (leader) exit reactor event loop\n",
+ t_id));
+ }
+ }
+ //
+ // End artificial scope for auto_ptr like helpers calling:
+ // this->reset_client_thread () and (maybe)
+ // this->reset_client_leader_thread ().
+ //
+
+ // Wake up the next leader, we cannot do that in handle_input,
+ // because the woken up thread would try to get into handle_events,
+ // which is at the time in handle_input still occupied. But do it
+ // before checking the error in <result>, even if there is an error
+ // in our input we should continue running the loop in another
+ // thread.
+
+ if (this->elect_new_leader () == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "TAO (%P|%t) - Leader_Follower[%d]::wait_for_event,"
+ " failed to elect new leader\n",
+ t_id),
+ -1);
+
+ if (result == -1 && !this->reactor_->reactor_event_loop_done ())
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "TAO (%P|%t) - Leader_Follower[%d]::wait_for_event,"
+ " handle_events failed\n",
+ t_id),
+ -1);
+
+ // Return an error if there was a problem receiving the reply...
+ if (max_wait_time != 0)
+ {
+ if (!event->successful ()
+ && *max_wait_time == ACE_Time_Value::zero)
+ {
+ result = -1;
+ errno = ETIME;
+ }
+ else if (event->error_detected ())
+ {
+ // If the time did not expire yet, but we get a failure,
+ // e.g. the connections closed, we should still return an error.
+ result = -1;
+ }
+ }
+ else
+ {
+ /**
+ * There should be no reason to reset the value of result
+ * here. If there was an error in handle_events () that the
+ * leader saw, I (Bala) beleave it should be propogated to the
+ * clients.
+ * result = 0;
+ */
+ if (event->error_detected ())
+ {
+ result = -1;
+ }
+ }
+
+ return result;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Leader_Follower.h b/TAO/tao/Leader_Follower.h
new file mode 100644
index 00000000000..46fa3c312a7
--- /dev/null
+++ b/TAO/tao/Leader_Follower.h
@@ -0,0 +1,299 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Leader_Follower.h
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan (coryan@cs.wustl.edu)
+ */
+//=============================================================================
+
+
+#ifndef TAO_LEADER_FOLLOWER_H
+#define TAO_LEADER_FOLLOWER_H
+
+#include /**/ "ace/pre.h"
+#include "ace/os_include/os_errno.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/New_Leader_Generator.h"
+#include "tao/LF_Follower.h"
+#include "ace/Reverse_Lock_T.h"
+#include "ace/Intrusive_List.h"
+#include "ace/Intrusive_List_Node.h"
+#include "ace/OS_NS_Thread.h"
+
+ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+class ACE_Reactor;
+ACE_END_VERSIONED_NAMESPACE_DECL
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_LF_Event;
+class TAO_Transport;
+class TAO_ORB_Core;
+class TAO_ORB_Core_TSS_Resources;
+
+/**
+ * @class TAO_Leader_Follower
+ *
+ * @brief TAO_Leader_Follower
+ *
+ * TAO_Leader_Follower
+ */
+class TAO_Export TAO_Leader_Follower
+{
+public:
+ /// Constructor
+ TAO_Leader_Follower (TAO_ORB_Core *orb_core,
+ TAO_New_Leader_Generator *new_leader_generator = 0);
+
+ /// Destructor
+ ~TAO_Leader_Follower (void);
+
+ /// The current thread has become a server thread (i.e. called
+ /// ORB::run), update any flags and counters.
+ int set_event_loop_thread (ACE_Time_Value *max_wait_time);
+
+ /// The current thread is not a server thread anymore, reset any
+ /// flags and counters.
+ void reset_event_loop_thread (void);
+
+ /// This thread is going to perform an upcall, it will no longer be
+ /// an event loop thread.
+ void set_upcall_thread (void);
+
+ /// Is there any thread running as a leader?
+ int leader_available (void) const;
+
+ /// A server thread is making a request.
+ void set_client_thread (void);
+
+ /// A server thread has finished is making a request.
+ void reset_client_thread (void);
+
+ /// Wait on the Leader/Followers loop until one event happens.
+ /**
+ * @param event The event we wait for, the loop iterates until the
+ * event is sucessful, or it fails due to timeout, and error or a
+ * connection closed.
+ * @param transport The transport attached to the event
+ * @param max_wait_time Limit the time spent on the loop
+ * @param return Returns -1 on error, 0 or non-zero value
+ * otherwise.
+ *
+ * @todo Document this better, split the Follower code to the
+ * TAO_LF_Follower class, we probably don't need the transport
+ * object.
+ */
+ int wait_for_event (TAO_LF_Event *event,
+ TAO_Transport *transport,
+ ACE_Time_Value *max_wait_time);
+
+ /// The current thread has become the leader thread in the
+ /// client side leader-follower set.
+ void set_client_leader_thread (void) ;
+
+ /// The current thread is no longer the leader thread in the client
+ /// side leader-follower set.
+ void reset_client_leader_thread (void) ;
+
+ /// sets the thread ID of the leader thread in the leader-follower
+ /// model
+ void set_client_leader_thread (ACE_thread_t thread_ID);
+
+ /// checks if we are a leader thread
+ int is_client_leader_thread (void) const;
+
+ /**
+ * A leader thread is relinquishing its role, unless there are more
+ * leader threads running pick up a follower (if there is any) to
+ * play the leader role.
+ */
+ int elect_new_leader (void);
+
+ /** @name Follower creation/destructions
+ *
+ * The Leader/Followers set acts as a factory for the Follower
+ * objects. Followers are used to represent a thread blocked
+ * waiting in the Follower set.
+ *
+ * The Leader/Followers abstraction keeps a list of the waiting
+ * followers, so it can wake up one when the leader thread stops
+ * handling events.
+ *
+ * For performance reasons the Leader/Followers set uses a pool (or
+ * free-list) to keep Follower objects unattached to any thread. It
+ * could be tempting to use TSS to keep such followers, after all a
+ * thread can only need one such Follower object, however, that does
+ * not work with multiple Leader/Followers sets, consult this bug
+ * report for more details:
+ *
+ * http://ace.cs.wustl.edu/bugzilla/show_bug.cgi?id=296
+ *
+ */
+ //@{
+ /// Allocate a new follower to the caller.
+ TAO_LF_Follower *allocate_follower (void);
+
+ /// The caller has finished using a follower.
+ void release_follower (TAO_LF_Follower *);
+ //@}
+
+ /** @name Follower Set Operations
+ *
+ */
+ //@{
+ /// Add a new follower to the set
+ void add_follower (TAO_LF_Follower *follower);
+
+ /// Removes a follower from the leader-follower set
+ void remove_follower (TAO_LF_Follower *follower);
+
+ /// Checks if there are any followers available
+ /**
+ * @return 1 if there follower set is not empty
+ */
+ int follower_available (void) const;
+
+ //@}
+
+ /// Get a reference to the underlying mutex
+ TAO_SYNCH_MUTEX &lock (void);
+
+ /// Provide a pre-initialized reverse lock for the Leader/Followers
+ /// set.
+ /**
+ * The Leader/Followers set mutex must be release during some long
+ * running operations. This helper class simplifies the process of
+ * releasing and reacquiring said mutex.
+ */
+ ACE_Reverse_Lock<TAO_SYNCH_MUTEX> &reverse_lock (void);
+
+ /// Check if there are any client threads running
+ int has_clients (void) const;
+
+ /// Accesor to the reactor
+ ACE_Reactor *reactor (void);
+
+ /// Called when we are out of leaders.
+ void no_leaders_available (void);
+
+private:
+ /// Shortcut to obtain the TSS resources of the orb core.
+ TAO_ORB_Core_TSS_Resources *get_tss_resources (void) const;
+
+ /// Wait for the client leader to complete.
+ int wait_for_client_leader_to_complete (ACE_Time_Value *max_wait_time);
+
+ /**
+ * Implement the reset_event_loop_thread() method, once the TSS
+ * resources have been acquired.
+ * Also used in the set_upcall_thread.
+ */
+ void reset_event_loop_thread_i (TAO_ORB_Core_TSS_Resources *tss);
+
+ /** @name Follower Set Operations
+ *
+ */
+ //@{
+ /// Remote a follower from the Followers set and promote it to the
+ /// leader role.
+ /**
+ * This is a helper routine for elect_new_leader(), after verifying
+ * that all the pre-conditions are satisfied the Follower set is
+ * changed and the promoted Follower is signaled.
+ */
+ int elect_new_leader_i (void);
+
+ //@}
+
+private:
+ /// The orb core
+ TAO_ORB_Core *orb_core_;
+
+ /// To synchronize access to the members.
+ TAO_SYNCH_MUTEX lock_;
+
+ /// do protect the access to the following three members
+ ACE_Reverse_Lock<TAO_SYNCH_MUTEX> reverse_lock_;
+
+ /// Implement the Leader/Followers set using an intrusive list
+ typedef ACE_Intrusive_List<TAO_LF_Follower> Follower_Set;
+ Follower_Set follower_set_;
+
+ /// Use a free list to allocate and release Follower objects
+ Follower_Set follower_free_list_;
+
+ /**
+ * Count the number of active leaders.
+ * There could be many leaders in the thread pool (i.e. calling
+ * ORB::run), and the same leader could show up multiple times as it
+ * receives nested upcalls and sends more requests.
+ */
+ int leaders_;
+
+ /// Count the number of active clients, this is useful to know when
+ /// to deactivate the reactor
+ int clients_;
+
+ /// The reactor
+ ACE_Reactor *reactor_;
+
+ /// Is a client thread the current leader?
+ int client_thread_is_leader_;
+
+ /// Are server threads waiting for the client leader to complete?
+ int event_loop_threads_waiting_;
+
+ /// Condition variable for server threads waiting for the client
+ /// leader to complete.
+ TAO_SYNCH_CONDITION event_loop_threads_condition_;
+
+ /// Leader/Follower class uses this method to notify the system that
+ /// we are out of leaders.
+ TAO_New_Leader_Generator *new_leader_generator_;
+};
+
+class TAO_Export TAO_LF_Client_Thread_Helper
+{
+public:
+ /// Constructor
+ TAO_LF_Client_Thread_Helper (TAO_Leader_Follower &leader_follower);
+
+ /// Destructor
+ ~TAO_LF_Client_Thread_Helper (void);
+
+private:
+ /// Reference to leader/followers object.
+ TAO_Leader_Follower &leader_follower_;
+};
+
+class TAO_Export TAO_LF_Client_Leader_Thread_Helper
+{
+public:
+ /// Constructor
+ TAO_LF_Client_Leader_Thread_Helper (TAO_Leader_Follower &leader_follower);
+
+ /// Destructor
+ ~TAO_LF_Client_Leader_Thread_Helper (void);
+
+private:
+ /// Reference to leader/followers object.
+ TAO_Leader_Follower &leader_follower_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/Leader_Follower.i"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_LEADER_FOLLOWER_H */
diff --git a/TAO/tao/Leader_Follower.i b/TAO/tao/Leader_Follower.i
new file mode 100644
index 00000000000..60293532455
--- /dev/null
+++ b/TAO/tao/Leader_Follower.i
@@ -0,0 +1,227 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// ****************************************************************
+
+#include "tao/ORB_Core_TSS_Resources.h"
+#include "tao/ORB_Core.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO_Leader_Follower::TAO_Leader_Follower (TAO_ORB_Core* orb_core,
+ TAO_New_Leader_Generator *new_leader_generator)
+ : orb_core_ (orb_core),
+ reverse_lock_ (lock_),
+ leaders_ (0),
+ clients_ (0),
+ reactor_ (0),
+ client_thread_is_leader_ (0),
+ event_loop_threads_waiting_ (0),
+ event_loop_threads_condition_ (lock_),
+ new_leader_generator_ (new_leader_generator)
+{
+}
+
+ACE_INLINE TAO_ORB_Core_TSS_Resources *
+TAO_Leader_Follower::get_tss_resources (void) const
+{
+ return this->orb_core_->get_tss_resources ();
+}
+
+ACE_INLINE int
+TAO_Leader_Follower::follower_available (void) const
+{
+ return !this->follower_set_.empty ();
+}
+
+ACE_INLINE void
+TAO_Leader_Follower::no_leaders_available (void)
+{
+ if (this->new_leader_generator_)
+ this->new_leader_generator_->no_leaders_available ();
+}
+
+ACE_INLINE int
+TAO_Leader_Follower::elect_new_leader (void)
+{
+ if (this->leaders_ == 0)
+ {
+ if (this->event_loop_threads_waiting_)
+ {
+ return this->event_loop_threads_condition_.broadcast ();
+ }
+ else if (this->follower_available ())
+ {
+ return this->elect_new_leader_i ();
+ }
+ else
+ {
+ this->no_leaders_available ();
+ }
+ }
+ return 0;
+}
+
+ACE_INLINE int
+TAO_Leader_Follower::set_event_loop_thread (ACE_Time_Value *max_wait_time)
+{
+ TAO_ORB_Core_TSS_Resources *tss = this->get_tss_resources ();
+
+ // Make sure that there is no other client thread run the show. If
+ // we are the client thread running the show, then it is ok.
+ if (this->client_thread_is_leader_ &&
+ tss->client_leader_thread_ == 0)
+ {
+ int result =
+ this->wait_for_client_leader_to_complete (max_wait_time);
+
+ if (result != 0)
+ return result;
+ }
+
+ // If <event_loop_thread_> == 0 and <client_leader_thread_> == 0, we
+ // are running the event loop for the first time. Therefore,
+ // increment the leaders. Otherwise, simply increment
+ // <event_loop_thread_> since either (a) if <event_loop_thread_> !=
+ // 0 this is a nested call to the event loop, or (b)
+ // <client_leader_thread_> != 0 this is a call to the event loop
+ // while we are a client leader.
+ if (tss->event_loop_thread_ == 0 &&
+ tss->client_leader_thread_ == 0)
+ ++this->leaders_;
+
+ ++tss->event_loop_thread_;
+
+ return 0;
+}
+
+ACE_INLINE void
+TAO_Leader_Follower::reset_event_loop_thread_i (TAO_ORB_Core_TSS_Resources *tss)
+{
+ // Always decrement <event_loop_thread_>. If <event_loop_thread_>
+ // reaches 0 and we are not a client leader, we are done with our
+ // duties of running the event loop. Therefore, decrement the
+ // leaders. Otherwise, we just got done with a nested call to the
+ // event loop or a call to the event loop when we were the client
+ // leader.
+ --tss->event_loop_thread_;
+
+ if (tss->event_loop_thread_ == 0 &&
+ tss->client_leader_thread_ == 0)
+ --this->leaders_;
+}
+
+ACE_INLINE void
+TAO_Leader_Follower::reset_event_loop_thread (void)
+{
+ TAO_ORB_Core_TSS_Resources *tss = this->get_tss_resources ();
+ if (tss->event_loop_thread_ > 0)
+ this->reset_event_loop_thread_i (tss);
+}
+
+ACE_INLINE TAO_SYNCH_MUTEX &
+TAO_Leader_Follower::lock (void)
+{
+ return this->lock_;
+}
+
+ACE_INLINE void
+TAO_Leader_Follower::set_upcall_thread (void)
+{
+ TAO_ORB_Core_TSS_Resources *tss = this->get_tss_resources ();
+
+ if (tss->event_loop_thread_ > 0)
+ {
+ ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->lock ());
+ this->reset_event_loop_thread_i (tss);
+
+ this->elect_new_leader ();
+ }
+}
+
+ACE_INLINE int
+TAO_Leader_Follower::leader_available (void) const
+{
+ return this->leaders_ != 0;
+}
+
+ACE_INLINE void
+TAO_Leader_Follower::set_client_leader_thread (void)
+{
+ TAO_ORB_Core_TSS_Resources *tss = this->get_tss_resources ();
+ ++this->leaders_;
+ ++this->client_thread_is_leader_;
+ ++tss->client_leader_thread_;
+}
+
+ACE_INLINE void
+TAO_Leader_Follower::reset_client_leader_thread (void)
+{
+ TAO_ORB_Core_TSS_Resources *tss = this->get_tss_resources ();
+ --tss->client_leader_thread_;
+ --this->leaders_;
+ --this->client_thread_is_leader_;
+}
+
+ACE_INLINE int
+TAO_Leader_Follower::is_client_leader_thread (void) const
+{
+ TAO_ORB_Core_TSS_Resources *tss = this->get_tss_resources ();
+ return tss->client_leader_thread_ != 0;
+}
+
+ACE_INLINE void
+TAO_Leader_Follower::add_follower (TAO_LF_Follower *follower)
+{
+ this->follower_set_.push_back (follower);
+}
+
+ACE_INLINE void
+TAO_Leader_Follower::remove_follower (TAO_LF_Follower *follower)
+{
+ this->follower_set_.remove (follower);
+}
+
+ACE_INLINE ACE_Reverse_Lock<TAO_SYNCH_MUTEX> &
+TAO_Leader_Follower::reverse_lock (void)
+{
+ return this->reverse_lock_;
+}
+
+ACE_INLINE int
+TAO_Leader_Follower::has_clients (void) const
+{
+ return this->clients_;
+}
+
+// ****************************************************************
+
+ACE_INLINE
+TAO_LF_Client_Thread_Helper::TAO_LF_Client_Thread_Helper (TAO_Leader_Follower &leader_follower)
+ : leader_follower_ (leader_follower)
+{
+ this->leader_follower_.set_client_thread ();
+}
+
+ACE_INLINE
+TAO_LF_Client_Thread_Helper::~TAO_LF_Client_Thread_Helper (void)
+{
+ this->leader_follower_.reset_client_thread ();
+}
+
+ACE_INLINE
+TAO_LF_Client_Leader_Thread_Helper::TAO_LF_Client_Leader_Thread_Helper (TAO_Leader_Follower &leader_follower)
+ : leader_follower_ (leader_follower)
+{
+ this->leader_follower_.set_client_leader_thread ();
+}
+
+ACE_INLINE
+TAO_LF_Client_Leader_Thread_Helper::~TAO_LF_Client_Leader_Thread_Helper (void)
+{
+ this->leader_follower_.reset_client_leader_thread ();
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Leader_Follower_Flushing_Strategy.cpp b/TAO/tao/Leader_Follower_Flushing_Strategy.cpp
new file mode 100644
index 00000000000..694bf8190b9
--- /dev/null
+++ b/TAO/tao/Leader_Follower_Flushing_Strategy.cpp
@@ -0,0 +1,73 @@
+// $Id$
+
+#include "tao/Leader_Follower_Flushing_Strategy.h"
+#include "tao/LF_Follower.h"
+#include "tao/Leader_Follower.h"
+#include "tao/Transport.h"
+#include "tao/Queued_Message.h"
+#include "tao/ORB_Core.h"
+
+ACE_RCSID (tao,
+ Leader_Follower_Flushing_Strategy,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+int
+TAO_Leader_Follower_Flushing_Strategy::schedule_output (TAO_Transport *transport)
+{
+ return transport->schedule_output_i ();
+}
+
+int
+TAO_Leader_Follower_Flushing_Strategy::cancel_output (
+ TAO_Transport *transport
+ )
+{
+ return transport->cancel_output_i ();
+}
+
+int
+TAO_Leader_Follower_Flushing_Strategy::flush_message (
+ TAO_Transport *transport,
+ TAO_Queued_Message *msg,
+ ACE_Time_Value *max_wait_time
+ )
+{
+ TAO_Leader_Follower &leader_follower =
+ transport->orb_core ()->leader_follower ();
+ return leader_follower.wait_for_event (msg, transport, max_wait_time);
+}
+
+int
+TAO_Leader_Follower_Flushing_Strategy::flush_transport (
+ TAO_Transport *transport
+ )
+{
+ // @todo This is not the right way to do this....
+
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ TAO_ORB_Core *orb_core = transport->orb_core ();
+
+ while (!transport->queue_is_empty ())
+ {
+ int result = orb_core->run (0, 1 ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (result == -1)
+ return -1;
+ }
+ }
+ ACE_CATCHANY
+ {
+ return -1;
+ }
+ ACE_ENDTRY;
+
+ return 0;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Leader_Follower_Flushing_Strategy.h b/TAO/tao/Leader_Follower_Flushing_Strategy.h
new file mode 100644
index 00000000000..421ec7a591f
--- /dev/null
+++ b/TAO/tao/Leader_Follower_Flushing_Strategy.h
@@ -0,0 +1,48 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Leader_Follower_Flushing_Strategy.h
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan <coryan@uci.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_LEADER_FOLLOWER_FLUSHING_STRATEGY_H
+#define TAO_LEADER_FOLLOWER_FLUSHING_STRATEGY_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Flushing_Strategy.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_Leader_Follower_Flushing_Strategy
+ *
+ * @brief Implement a flushing strategy that uses the Leader/Follower
+ * set.
+ */
+class TAO_Leader_Follower_Flushing_Strategy
+ : public TAO_Flushing_Strategy
+{
+public:
+ virtual int schedule_output (TAO_Transport *transport);
+ virtual int cancel_output (TAO_Transport *transport);
+ virtual int flush_message (TAO_Transport *transport,
+ TAO_Queued_Message *msg,
+ ACE_Time_Value *max_wait_time);
+ virtual int flush_transport (TAO_Transport *transport);
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_LEADER_FOLLOWER_FLUSHING_STRATEGY_H */
diff --git a/TAO/tao/Load_Protocol_Factory_T.h b/TAO/tao/Load_Protocol_Factory_T.h
new file mode 100644
index 00000000000..2d29d77d377
--- /dev/null
+++ b/TAO/tao/Load_Protocol_Factory_T.h
@@ -0,0 +1,116 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Load_Protocol_Factory_T.h
+ *
+ * $Id$
+ *
+ * Function templates to load a protocol factory.
+ *
+ * @author Johnny Willemsen
+ */
+//=============================================================================
+
+#ifndef TAO_LOAD_PROTOCOL_FACTORY_T_H
+#define TAO_LOAD_PROTOCOL_FACTORY_T_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Protocol_Factory.h"
+#include "ace/Auto_Ptr.h"
+#include "ace/Dynamic_Service.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace details
+ {
+ template<typename T>
+ int
+ load_protocol_factory (TAO_ProtocolFactorySet &protocol_set,
+ const ACE_TCHAR *name)
+ {
+ TAO_Protocol_Factory *protocol_factory = 0;
+ auto_ptr<TAO_Protocol_Factory> safe_protocol_factory;
+
+ TAO_Protocol_Item *item = 0;
+
+ // If a protocol factory is obtained from the Service
+ // Configurator then do not transfer ownership to the
+ // TAO_Protocol_Item.
+ bool transfer_ownership = false;
+
+ protocol_factory =
+ ACE_Dynamic_Service<TAO_Protocol_Factory>::instance (name);
+
+ if (protocol_factory == 0)
+ {
+ if (TAO_debug_level > 0)
+ ACE_ERROR ((LM_WARNING,
+ ACE_TEXT("(%P|%t) WARNING - No <%s> found in Service")
+ ACE_TEXT(" Repository. Using default instance.\n"),
+ name));
+
+ ACE_NEW_RETURN (protocol_factory,
+ T,
+ -1);
+
+ ACE_AUTO_PTR_RESET (safe_protocol_factory,
+ protocol_factory,
+ TAO_Protocol_Factory);
+
+ transfer_ownership = true;
+ }
+ else
+ {
+ transfer_ownership = false;
+ }
+
+ ACE_NEW_RETURN (item, TAO_Protocol_Item (name), -1);
+ // If the TAO_Protocol_Item retains ownership of the
+ // TAO_Protocol_Factory then we used an auto_ptr<> above, so
+ // release the TAO_Protocol_Factory from it. Otherwise, we
+ // obtained the TAO_Protocol_Factory from the Service
+ // Configurator so an auto_ptr<> wasn't used since the Service
+ // Configurator retains ownership, hence there was no need to
+ // use an auto_ptr<> in this method.
+ item->factory ((transfer_ownership ?
+ safe_protocol_factory.release () :
+ protocol_factory),
+ transfer_ownership);
+
+ if (protocol_set.insert (item) == -1)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT("TAO (%P|%t) Unable to add ")
+ ACE_TEXT("<%s> to protocol factory set.\n"),
+ ACE_TEXT_CHAR_TO_TCHAR(item->protocol_name ().c_str ())));
+
+ delete item;
+
+ if (transfer_ownership == false)
+ delete protocol_factory;
+
+ return -1;
+ }
+
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT("TAO (%P|%t) Loaded default ")
+ ACE_TEXT("protocol <%s>\n"),
+ name));
+ }
+
+ return 0;
+ }
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_LOAD_PROTOCOL_FACTORY_T_H*/
diff --git a/TAO/tao/LocalObject.cpp b/TAO/tao/LocalObject.cpp
new file mode 100644
index 00000000000..610cb5cfb97
--- /dev/null
+++ b/TAO/tao/LocalObject.cpp
@@ -0,0 +1,240 @@
+// $Id$
+
+#include "tao/LocalObject.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/LocalObject.i"
+#endif /* ! __ACE_INLINE__ */
+
+#include "tao/SystemException.h"
+#include "tao/debug.h"
+#include "tao/ORB_Constants.h"
+
+#include "ace/Log_Msg.h"
+#include "ace/Guard_T.h"
+
+ACE_RCSID (tao,
+ LocalObject,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+CORBA::LocalObject::~LocalObject (void)
+{
+}
+
+void
+CORBA::LocalObject::_add_ref (void)
+{
+ // Do nothing as per CCM spec.
+}
+
+void
+CORBA::LocalObject::_remove_ref (void)
+{
+ // Do nothing as per CCM spec.
+}
+
+// Quickly hash an object reference's representation data. Used to
+// create hash tables.
+
+CORBA::ULong
+CORBA::LocalObject::_hash (CORBA::ULong maximum
+ ACE_ENV_ARG_DECL_NOT_USED)
+{
+ // Note that we reinterpret_cast to an "ptrdiff_t" instead of
+ // CORBA::ULong since we need to first cast to an integer large
+ // enough to hold an address to avoid compile-time warnings on some
+ // 64-bit platforms.
+
+ CORBA::ULong const hash =
+ static_cast<CORBA::ULong> (reinterpret_cast<ptrdiff_t> (this));
+
+ return hash % maximum;
+}
+
+// Compare two object references to see if they point to the same
+// object. Used in linear searches, as in hash buckets.
+//
+// XXX would be useful to also have a trivalued comparison predicate,
+// such as strcmp(), to allow more comparison algorithms.
+
+CORBA::Boolean
+CORBA::LocalObject::_is_equivalent (CORBA::Object_ptr other_obj
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC (())
+{
+ return (other_obj == this) ? true : false;
+}
+
+// TAO's extensions
+
+
+TAO::ObjectKey *
+CORBA::LocalObject::_key (ACE_ENV_SINGLE_ARG_DECL)
+{
+ if (TAO_debug_level > 0)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) Cannot get _key from a LocalObject!\n")));
+
+ ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0);
+}
+
+#if (TAO_HAS_MINIMUM_CORBA == 0)
+
+// NON_EXISTENT ... send a simple call to the object, which will
+// either elicit a FALSE response or a OBJECT_NOT_EXIST exception. In
+// the latter case, return FALSE.
+
+CORBA::Boolean
+CORBA::LocalObject::_non_existent (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+{
+ // Always return false.
+ return false;
+}
+
+void
+CORBA::LocalObject::_create_request (CORBA::Context_ptr,
+ const char *,
+ CORBA::NVList_ptr,
+ CORBA::NamedValue_ptr,
+ CORBA::Request_ptr &,
+ CORBA::Flags
+ ACE_ENV_ARG_DECL)
+{
+ ACE_THROW (CORBA::NO_IMPLEMENT (CORBA::OMGVMCID | 4,
+ CORBA::COMPLETED_NO));
+}
+
+void
+CORBA::LocalObject::_create_request (CORBA::Context_ptr,
+ const char *,
+ CORBA::NVList_ptr,
+ CORBA::NamedValue_ptr,
+ CORBA::ExceptionList_ptr,
+ CORBA::ContextList_ptr,
+ CORBA::Request_ptr &,
+ CORBA::Flags
+ ACE_ENV_ARG_DECL)
+{
+ ACE_THROW (CORBA::NO_IMPLEMENT (CORBA::OMGVMCID | 4,
+ CORBA::COMPLETED_NO));
+}
+
+CORBA::Request_ptr
+CORBA::LocalObject::_request (const char *
+ ACE_ENV_ARG_DECL)
+{
+ ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (CORBA::OMGVMCID | 4,
+ CORBA::COMPLETED_NO),
+ 0);
+}
+
+CORBA::Object_ptr
+CORBA::LocalObject::_get_component (ACE_ENV_SINGLE_ARG_DECL)
+{
+ ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (CORBA::OMGVMCID | 8,
+ CORBA::COMPLETED_NO),
+ 0);
+}
+
+char *
+CORBA::LocalObject::_repository_id (ACE_ENV_SINGLE_ARG_DECL)
+{
+ ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (CORBA::OMGVMCID | 8,
+ CORBA::COMPLETED_NO),
+ 0);
+}
+
+CORBA::InterfaceDef_ptr
+CORBA::LocalObject::_get_interface (ACE_ENV_SINGLE_ARG_DECL)
+{
+ ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (CORBA::OMGVMCID | 8,
+ CORBA::COMPLETED_NO),
+ 0);
+}
+
+CORBA::ImplementationDef_ptr
+CORBA::LocalObject::_get_implementation (ACE_ENV_SINGLE_ARG_DECL)
+{
+ ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0);
+}
+
+#endif /* TAO_HAS_MINIMUM_CORBA */
+
+#if (TAO_HAS_CORBA_MESSAGING == 1)
+
+CORBA::Policy_ptr
+CORBA::LocalObject::_get_policy (CORBA::PolicyType
+ ACE_ENV_ARG_DECL)
+{
+ ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (CORBA::OMGVMCID | 8,
+ CORBA::COMPLETED_NO),
+ 0);
+}
+
+CORBA::Policy_ptr
+CORBA::LocalObject::_get_cached_policy (TAO_Cached_Policy_Type
+ ACE_ENV_ARG_DECL)
+{
+ ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0);
+}
+
+CORBA::Object_ptr
+CORBA::LocalObject::_set_policy_overrides (const CORBA::PolicyList &,
+ CORBA::SetOverrideType
+ ACE_ENV_ARG_DECL)
+{
+ ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (CORBA::OMGVMCID | 8,
+ CORBA::COMPLETED_NO),
+ 0);
+}
+
+CORBA::PolicyList *
+CORBA::LocalObject::_get_policy_overrides (const CORBA::PolicyTypeSeq &
+ ACE_ENV_ARG_DECL)
+{
+ ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (CORBA::OMGVMCID | 8,
+ CORBA::COMPLETED_NO),
+ 0);
+}
+
+CORBA::Boolean
+CORBA::LocalObject::_validate_connection (CORBA::PolicyList_out
+ ACE_ENV_ARG_DECL)
+{
+ ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (CORBA::OMGVMCID | 8,
+ CORBA::COMPLETED_NO),
+ false);
+}
+
+#endif /* TAO_HAS_CORBA_MESSAGING == 1 */
+
+CORBA::ORB_ptr
+CORBA::LocalObject::_get_orb (ACE_ENV_SINGLE_ARG_DECL)
+{
+ ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (CORBA::OMGVMCID | 8,
+ CORBA::COMPLETED_NO),
+ 0);
+}
+
+// ****************************************************************
+
+TAO_Local_RefCounted_Object::~TAO_Local_RefCounted_Object (void)
+{
+}
+
+void
+TAO_Local_RefCounted_Object::_add_ref (void)
+{
+ ++this->refcount_;
+}
+
+void
+TAO_Local_RefCounted_Object::_remove_ref (void)
+{
+ if (--this->refcount_ == 0)
+ delete this;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/LocalObject.h b/TAO/tao/LocalObject.h
new file mode 100644
index 00000000000..d60a0be6a27
--- /dev/null
+++ b/TAO/tao/LocalObject.h
@@ -0,0 +1,268 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file LocalObject.h
+ *
+ * $Id$
+ *
+ * Header file for CORBA's base "LocalObject" type.
+ *
+ * A "LocalObject" is an entity that can be the target of a local
+ * invocation. See the CORBA Component Model specification for
+ * details.
+ *
+ * @author Nanbor Wang <nanbor@cs.wustl.edu>
+ */
+//=============================================================================
+
+
+#ifndef TAO_CORBA_LOCALOBJECT_H
+#define TAO_CORBA_LOCALOBJECT_H
+
+#include /**/ "ace/pre.h"
+
+#include "ace/Thread_Mutex.h"
+#include "ace/Atomic_Op.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Object.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace CORBA
+{
+ class LocalObject;
+ typedef LocalObject *LocalObject_ptr;
+ typedef TAO_Pseudo_Var_T<LocalObject> LocalObject_var;
+ typedef TAO_Pseudo_Out_T<LocalObject> LocalObject_out;
+
+ /**
+ * @class LocalObject
+ */
+ class TAO_Export LocalObject : public virtual CORBA::Object
+ {
+ public:
+
+ /// Destructor
+ virtual ~LocalObject (void);
+
+ /// Increment the ref count
+ static LocalObject_ptr _duplicate (LocalObject_ptr obj);
+
+ /// Return a NIL object
+ static LocalObject_ptr _nil (void);
+
+ /**
+ * @todo Narrowing a LocalObject to a CORBA::Object is broken
+ * right now. The solution seems to be making CORBA::Object an
+ * abstract base class and create a CORBA::RemoteObject for
+ * regular object. Or, even easier, add a @c is_local member into
+ * CORBA::Object. I'll take the easier route for now.
+ */
+ static LocalObject_ptr _narrow (CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+#if (TAO_HAS_MINIMUM_CORBA == 0)
+
+ /// Always returns false.
+ virtual CORBA::Boolean _non_existent (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ );
+
+ /// Throws CORBA::NO_IMPLEMENT.
+ virtual CORBA::ImplementationDef_ptr _get_implementation (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ );
+
+ /// Gets info about object from the Interface Repository.
+ virtual CORBA::InterfaceDef_ptr _get_interface (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ );
+
+ /// Throws NO_IMPLEMENT.
+ virtual CORBA::Object_ptr _get_component (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ );
+
+ /// Get the repository id.
+ virtual char * _repository_id (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ );
+
+ virtual void _create_request (CORBA::Context_ptr ctx,
+ const char * operation,
+ CORBA::NVList_ptr arg_list,
+ CORBA::NamedValue_ptr result,
+ CORBA::Request_ptr & request,
+ CORBA::Flags req_flags
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ virtual void _create_request (CORBA::Context_ptr ctx,
+ const char * operation,
+ CORBA::NVList_ptr arg_list,
+ CORBA::NamedValue_ptr result,
+ CORBA::ExceptionList_ptr exclist,
+ CORBA::ContextList_ptr ctxtlist,
+ CORBA::Request_ptr & request,
+ CORBA::Flags req_flags
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ /// Throws NO_IMPLEMENT.
+ virtual CORBA::Request_ptr _request (const char * operation
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+#endif /* TAO_HAS_MINIMUM_CORBA */
+
+#if (TAO_HAS_CORBA_MESSAGING == 1)
+
+ /// Throws CORBA::NO_IMPLEMENT.
+ CORBA::Policy_ptr _get_policy (CORBA::PolicyType type
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ /// Throws CORBA::NO_IMPLEMENT.
+ CORBA::Policy_ptr _get_cached_policy (TAO_Cached_Policy_Type type
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ /// Throws CORBA::NO_IMPLEMENT.
+ CORBA::Object_ptr _set_policy_overrides (
+ const CORBA::PolicyList & policies,
+ CORBA::SetOverrideType set_add
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ /// Throws CORBA::NO_IMPLEMENT.
+ CORBA::PolicyList * _get_policy_overrides (
+ const CORBA::PolicyTypeSeq & types
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ /// Throws CORBA::NO_IMPLEMENT.
+ CORBA::Boolean _validate_connection (
+ CORBA::PolicyList_out inconsistent_policies
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+#endif /* TAO_HAS_CORBA_MESSAGING == 1 */
+
+ /**
+ * Return a hash value for this object. The hash is based on the
+ * address of the object. On non-32 bit platforms, the hash may
+ * be non-unique.
+ */
+ virtual CORBA::ULong _hash (CORBA::ULong maximum
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ /**
+ * Try to determine if this object is the same as @c other_obj.
+ * This method relies on the representation of the object
+ * reference's private state. Since that changes easily (when
+ * different ORB protocols are in use) there is no default
+ * implementation.
+ */
+ virtual CORBA::Boolean _is_equivalent (CORBA::Object_ptr other_obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC (());
+
+ // = Reference count managment.
+ /// Increment the reference count.
+ virtual void _add_ref (void);
+
+ /// Decrement the reference count.
+ virtual void _remove_ref (void);
+
+ virtual CORBA::ORB_ptr _get_orb (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ );
+
+ // = TAO extensions
+
+ /// Throws CORBA::NO_IMPLEMENT.
+ virtual TAO::ObjectKey * _key (ACE_ENV_SINGLE_ARG_DECL);
+
+ /// Useful for template programming.
+ typedef LocalObject_ptr _ptr_type;
+ typedef LocalObject_var _var_type;
+ typedef LocalObject_out _out_type;
+
+ protected:
+
+ /// Default constructor.
+ /**
+ * Make it protected to prevent instantiation of this class.
+ */
+ LocalObject (void);
+
+ private:
+
+ /**
+ * @name Unimplemented methods
+ */
+ //@{
+ LocalObject (const LocalObject &);
+ LocalObject & operator = (const LocalObject &);
+ //@}
+
+ };
+} // End CORBA namespace
+
+/**
+ * @class TAO_Local_RefCounted_Object
+ *
+ * @brief This class adds default reference counting to local
+ * objects.
+ *
+ * This is proprietary convenience class that implements reference
+ * counting in locality constrained objects.
+ */
+class TAO_Export TAO_Local_RefCounted_Object
+ : public virtual CORBA::LocalObject
+{
+public:
+
+ /// Destructor.
+ virtual ~TAO_Local_RefCounted_Object (void);
+
+ /// Increment reference count.
+ virtual void _add_ref (void);
+
+ /// Decrement reference count.
+ virtual void _remove_ref (void);
+
+protected:
+
+ // Default constructor.
+ /**
+ * Make it protected to prevent instantiation of this class.
+ */
+ TAO_Local_RefCounted_Object (void);
+
+private:
+
+ /**
+ * @name Unimplemented methods
+ */
+ //@{
+ TAO_Local_RefCounted_Object (const TAO_Local_RefCounted_Object &);
+ TAO_Local_RefCounted_Object & operator = (
+ const TAO_Local_RefCounted_Object &
+ );
+ //@}
+
+protected:
+ /// Reference counter.
+ ACE_Atomic_Op<TAO_SYNCH_MUTEX, unsigned long> refcount_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/LocalObject.i"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_CORBA_LOCALOBJECT_H */
diff --git a/TAO/tao/LocalObject.i b/TAO/tao/LocalObject.i
new file mode 100644
index 00000000000..3b84db89160
--- /dev/null
+++ b/TAO/tao/LocalObject.i
@@ -0,0 +1,55 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+CORBA::LocalObject_ptr
+CORBA::LocalObject::_duplicate (CORBA::LocalObject_ptr obj)
+{
+ if (obj)
+ {
+ obj->_add_ref ();
+ }
+
+ return obj;
+}
+
+ACE_INLINE
+CORBA::LocalObject_ptr
+CORBA::LocalObject::_nil (void)
+{
+ return 0;
+}
+
+ACE_INLINE
+CORBA::LocalObject_ptr
+CORBA::LocalObject::_narrow (CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_NOT_USED)
+{
+ if (obj->_is_local () != 0)
+ {
+ return CORBA::LocalObject::_duplicate (
+ dynamic_cast<CORBA::LocalObject_ptr> (obj)
+ );
+ }
+
+ return 0;
+}
+
+ACE_INLINE
+CORBA::LocalObject::LocalObject (void)
+ : Object (0)
+{
+}
+
+// =================================================================
+
+ACE_INLINE
+TAO_Local_RefCounted_Object::TAO_Local_RefCounted_Object (void)
+ : refcount_ (1)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/LocateRequest_Invocation.cpp b/TAO/tao/LocateRequest_Invocation.cpp
new file mode 100644
index 00000000000..203bcd5f605
--- /dev/null
+++ b/TAO/tao/LocateRequest_Invocation.cpp
@@ -0,0 +1,192 @@
+#include "tao/LocateRequest_Invocation.h"
+#include "tao/Profile_Transport_Resolver.h"
+#include "tao/operation_details.h"
+#include "tao/Stub.h"
+#include "tao/Bind_Dispatcher_Guard.h"
+#include "tao/Transport.h"
+#include "tao/Synch_Reply_Dispatcher.h"
+#include "tao/GIOP_Utils.h"
+#include "tao/Profile.h"
+#include "tao/ORB_Constants.h"
+
+#include "ace/Countdown_Time.h"
+
+ACE_RCSID (tao,
+ LocateRequest_Invocation,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ LocateRequest_Invocation::LocateRequest_Invocation (
+ CORBA::Object_ptr otarget,
+ Profile_Transport_Resolver &resolver,
+ TAO_Operation_Details &detail
+ )
+ : Synch_Twoway_Invocation (otarget,
+ resolver,
+ detail)
+ {
+ }
+
+ Invocation_Status
+ LocateRequest_Invocation::invoke (ACE_Time_Value *max_wait_time
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::Exception))
+ {
+ ACE_Countdown_Time countdown (max_wait_time);
+
+ TAO_Synch_Reply_Dispatcher rd (this->resolver_.stub ()->orb_core (),
+ this->details_.reply_service_info ());
+
+ // Register a reply dispatcher for this invocation. Use the
+ // preallocated reply dispatcher.
+ TAO_Bind_Dispatcher_Guard dispatch_guard (this->details_.request_id (),
+ &rd,
+ this->resolver_.transport ()->tms ());
+
+ if (dispatch_guard.status () != 0)
+ {
+ // @@ What is the right way to handle this error? Do we need
+ // to call the interceptors in this case?
+ this->resolver_.transport ()->close_connection ();
+
+ ACE_THROW_RETURN (CORBA::INTERNAL (TAO::VMCID,
+ CORBA::COMPLETED_NO),
+ TAO_INVOKE_FAILURE);
+ }
+
+ TAO_Target_Specification tspec;
+ this->init_target_spec (tspec ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO_INVOKE_FAILURE);
+
+ TAO_Transport *transport =
+ this->resolver_.transport ();
+
+ TAO_OutputCDR &cdr = transport->out_stream ();
+
+ int const retval =
+ transport->generate_locate_request (tspec,
+ this->details_,
+ cdr);
+ ACE_CHECK_RETURN (TAO_INVOKE_FAILURE);
+
+ if (retval == -1)
+ return TAO_INVOKE_FAILURE;
+
+ countdown.update ();
+
+ Invocation_Status s =
+ this->send_message (cdr,
+ TAO_Transport::TAO_TWOWAY_REQUEST,
+ max_wait_time
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO_INVOKE_FAILURE);
+
+ if (s != TAO_INVOKE_SUCCESS)
+ return s;
+
+ countdown.update ();
+
+ // For some strategies one may want to release the transport
+ // back to cache. If the idling is successfull let the
+ // resolver about that.
+ if (this->resolver_.transport ()->idle_after_send ())
+ this->resolver_.transport_released ();
+
+ s =
+ this->wait_for_reply (max_wait_time,
+ rd,
+ dispatch_guard
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO_INVOKE_FAILURE);
+
+ s = this->check_reply (rd
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO_INVOKE_FAILURE);
+
+ // For some strategies one may want to release the transport
+ // back to cache after receiving the reply. If the idling is
+ // successfull let the resolver about that.
+ if (this->resolver_.transport ()->idle_after_reply ())
+ this->resolver_.transport_released ();
+
+ return s;
+ }
+
+ Invocation_Status
+ LocateRequest_Invocation::check_reply (TAO_Synch_Reply_Dispatcher &rd
+ ACE_ENV_ARG_DECL)
+ {
+ TAO_InputCDR &cdr =
+ rd.reply_cdr ();
+
+ // Set the translators
+ this->resolver_.transport ()->assign_translators (&cdr, 0);
+
+ switch (rd.reply_status ())
+ {
+ case TAO_GIOP_OBJECT_HERE:
+ break;
+ case TAO_GIOP_UNKNOWN_OBJECT:
+ ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (TAO::VMCID,
+ CORBA::COMPLETED_YES),
+ TAO_INVOKE_FAILURE);
+ case TAO_GIOP_OBJECT_FORWARD:
+ case TAO_GIOP_OBJECT_FORWARD_PERM:
+ return this->location_forward (cdr
+ ACE_ENV_ARG_PARAMETER);
+
+ case TAO_GIOP_LOC_SYSTEM_EXCEPTION:
+ {
+ // Pull the exception from the stream.
+ CORBA::String_var buf;
+
+ if ((cdr >> buf.inout ()) == 0)
+ {
+ // Could not demarshal the exception id, raise a local
+ // CORBA::MARSHAL exception.
+ ACE_THROW_RETURN (CORBA::MARSHAL (TAO::VMCID,
+ CORBA::COMPLETED_MAYBE),
+ TAO_INVOKE_SYSTEM_EXCEPTION);
+ }
+
+ // This kind of exception shouldn't happen with locate requests,
+ // but if it does, we turn it into a CORBA::UNKNOWN exception.
+ ACE_THROW_RETURN (CORBA::UNKNOWN (TAO::VMCID,
+ CORBA::COMPLETED_YES),
+ TAO_INVOKE_SYSTEM_EXCEPTION);
+ }
+ case TAO_GIOP_LOC_NEEDS_ADDRESSING_MODE:
+ {
+ // We have received an exception with a request to change the
+ // addressing mode. First let us read the mode that the
+ // server/agent asks for.
+ CORBA::Short addr_mode = 0;
+
+ if (cdr.read_short (addr_mode) == 0)
+ {
+ // Could not demarshal the addressing disposition, raise a local
+ // CORBA::MARSHAL exception.
+ ACE_THROW_RETURN (CORBA::MARSHAL (TAO::VMCID,
+ CORBA::COMPLETED_MAYBE),
+ TAO_INVOKE_SUCCESS);
+ }
+
+ // Now set this addressing mode in the profile, so that
+ // the next invocation need not go through this.
+ this->resolver_.profile ()->addressing_mode (addr_mode
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO_INVOKE_SUCCESS);
+
+ // Restart the invocation.
+ return TAO_INVOKE_RESTART;
+ }
+ }
+
+ return TAO_INVOKE_SUCCESS;
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/LocateRequest_Invocation.h b/TAO/tao/LocateRequest_Invocation.h
new file mode 100644
index 00000000000..40b213eef37
--- /dev/null
+++ b/TAO/tao/LocateRequest_Invocation.h
@@ -0,0 +1,84 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file LocateRequest_Invocation.h
+ *
+ * $Id$
+ *
+ *
+ * @author Balachandran Natarajan <bala@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_LOCATEREQUEST_INVOCATION_H
+#define TAO_LOCATEREQUEST_INVOCATION_H
+
+#include /**/ "ace/pre.h"
+#include "ace/Global_Macros.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Synch_Invocation.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Synch_Reply_Dispatcher;
+
+namespace CORBA
+{
+ class SystemException;
+}
+
+namespace TAO
+{
+ class Profile_Transport_Resolver;
+
+ /**
+ * @class LocateRequest_Invocation
+ *
+ * @brief Object created by TAO::LocateRequest_Invocation_Adapter to
+ * create and send LocateRequest invocation.
+ *
+ */
+ class TAO_Export LocateRequest_Invocation
+ : protected Synch_Twoway_Invocation
+ {
+ public:
+ /**
+ * @param otarget The target on which this invocation was
+ * started.
+ *
+ * @param resolver Container of the profile and transport on
+ * which this invocation is on
+ *
+ * @param detail Operation details of the invocation on @a
+ * target. This is of no practical importance since it is not used
+ * in this class. This is just to keep our base class happy.
+ *
+ */
+ LocateRequest_Invocation (
+ CORBA::Object_ptr otarget,
+ Profile_Transport_Resolver &resolver,
+ TAO_Operation_Details &detail);
+
+ /// Start the invocation.
+ Invocation_Status invoke (ACE_Time_Value *max_wait_time
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::Exception));
+
+ private:
+ /// Helper to check the reply status
+ Invocation_Status check_reply (TAO_Synch_Reply_Dispatcher &rd
+ ACE_ENV_ARG_DECL);
+
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /*TAO_LOCATEREQUEST_INVOCATION_H*/
diff --git a/TAO/tao/LocateRequest_Invocation_Adapter.cpp b/TAO/tao/LocateRequest_Invocation_Adapter.cpp
new file mode 100644
index 00000000000..c51b4e483f0
--- /dev/null
+++ b/TAO/tao/LocateRequest_Invocation_Adapter.cpp
@@ -0,0 +1,117 @@
+#include "tao/LocateRequest_Invocation_Adapter.h"
+#include "tao/Profile_Transport_Resolver.h"
+#include "tao/operation_details.h"
+#include "tao/LocateRequest_Invocation.h"
+#include "tao/Transport.h"
+#include "tao/Transport_Mux_Strategy.h"
+#include "tao/ORB_Core.h"
+
+ACE_RCSID (tao,
+ LocateRequest_Invocation_Adapter,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ LocateRequest_Invocation_Adapter::LocateRequest_Invocation_Adapter (
+ CORBA::Object *target)
+ : target_ (target)
+ , list_ (0)
+ {
+ }
+
+ void
+ LocateRequest_Invocation_Adapter::invoke (ACE_ENV_SINGLE_ARG_DECL)
+ {
+ CORBA::Object * const effective_target = this->target_;
+
+ TAO_Stub * const stub =
+ this->target_->_stubobj ();
+
+ if (stub == 0)
+ ACE_THROW (CORBA::INTERNAL (
+ CORBA::SystemException::_tao_minor_code (
+ 0,
+ EINVAL),
+ CORBA::COMPLETED_NO));
+
+ ACE_Time_Value tmp_wait_time;
+ ACE_Time_Value *max_wait_time = 0;
+
+ bool const is_timeout =
+ this->get_timeout (tmp_wait_time);
+
+ if (is_timeout)
+ max_wait_time = &tmp_wait_time;
+
+ Invocation_Status s = TAO_INVOKE_START;
+
+ while (s == TAO_INVOKE_START ||
+ s == TAO_INVOKE_RESTART)
+ {
+ Profile_Transport_Resolver resolver (effective_target,
+ stub,
+ true);
+
+ ACE_TRY
+ {
+ resolver.init_inconsistent_policies (
+ ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ resolver.resolve (max_wait_time
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ // Dummy operation details that is used to instantiate the
+ // LocateRequest class.
+ TAO_Operation_Details op (0,
+ 0,
+ false);
+
+ op.request_id (resolver.transport ()->tms ()->request_id ());
+ TAO::LocateRequest_Invocation synch (this->target_,
+ resolver,
+ op);
+
+ s = synch.invoke (max_wait_time
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCH (CORBA::INV_POLICY, ex)
+ {
+ this->list_ =
+ resolver.steal_inconsistent_policies ();
+ ACE_RE_THROW;
+ }
+ ACE_CATCHANY
+ {
+ ACE_RE_THROW;
+ }
+ ACE_ENDTRY;
+ ACE_CHECK;
+ }
+
+ return;
+ }
+
+ CORBA::PolicyList *
+ LocateRequest_Invocation_Adapter::get_inconsistent_policies (void)
+ {
+ return this->list_._retn ();
+ }
+
+ bool
+ LocateRequest_Invocation_Adapter::get_timeout (ACE_Time_Value &timeout)
+ {
+ bool has_timeout = false;
+ this->target_->orb_core ()->call_timeout_hook (this->target_->_stubobj (),
+ has_timeout,
+ timeout);
+
+ return has_timeout;
+ }
+} // End namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/LocateRequest_Invocation_Adapter.h b/TAO/tao/LocateRequest_Invocation_Adapter.h
new file mode 100644
index 00000000000..cfed80c24fc
--- /dev/null
+++ b/TAO/tao/LocateRequest_Invocation_Adapter.h
@@ -0,0 +1,79 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file LocateRequest_Invocation_Adapter.h
+ *
+ * $Id$
+ *
+ * @author Balachandran Natarajan <bala@dre.vanderbilt.edu>
+ */
+//=============================================================================
+#ifndef TAO_LOCATEREQUEST_INVOCATION_ADAPTER_H
+#define TAO_LOCATEREQUEST_INVOCATION_ADAPTER_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Policy_ForwardC.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+class ACE_Time_Value;
+ACE_END_VERSIONED_NAMESPACE_DECL
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace CORBA
+{
+ class Object;
+ typedef Object *Object_ptr;
+}
+
+namespace TAO
+{
+ /**
+ * @class LocateRequest_Invocation_Adapter
+ *
+ * @brief Adapter class for locate request invocations.
+ *
+ * This class provides a look and feel similar to the
+ * TAO::Invocation_Adapter though the functionalities are
+ * different. For the record, IDL compiler doesn't know the
+ * existence of this class. This class is concerned with the
+ * creation and invocation of locate request invocations to the
+ * target object
+ *
+ * @todo Need to think what happens if the target is
+ * collocated. Looks like there are no ways to utilize the
+ * opportunity that may have been presented.
+ */
+ class TAO_Export LocateRequest_Invocation_Adapter
+ {
+ public:
+ LocateRequest_Invocation_Adapter (
+ CORBA::Object_ptr target);
+
+ /// Start the invocation on the target
+ void invoke (ACE_ENV_SINGLE_ARG_DECL);
+
+ /// Accessor to the inconsistent policy list
+ CORBA::PolicyList *get_inconsistent_policies (void);
+
+ private:
+
+ bool get_timeout (ACE_Time_Value &val);
+
+ private:
+ CORBA::Object_ptr target_;
+ CORBA::PolicyList_var list_;
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /*TAO_LOCATEREQUEST_INVOCATION_ADAPTER_H*/
diff --git a/TAO/tao/LongDoubleSeq.pidl b/TAO/tao/LongDoubleSeq.pidl
new file mode 100644
index 00000000000..80594c356b1
--- /dev/null
+++ b/TAO/tao/LongDoubleSeq.pidl
@@ -0,0 +1,31 @@
+// -*- IDL -*-
+//
+// $Id$
+
+// ================================================================
+/**
+ * This file was used to generate the code in LongDoubleSeq*.*
+ * The command used to generate code is:
+ *
+ * tao_idl
+ * -o orig -Ge 1 -GA -SS -Sci
+ * -Wb,export_macro=TAO_Export
+ * -Wb,export_include="tao/TAO_Export.h"
+ * -Wb,pre_include="ace/pre.h"
+ * -Wb,post_include="ace/post.h"
+ * LongDoubleSeq.pidl
+ *
+ */
+// ================================================================
+
+#ifndef TAO_CORBA_LONG_DOUBLE_SEQ_IDL
+#define TAO_CORBA_LONG_DOUBLE_SEQ_IDL
+
+#pragma prefix "omg.org"
+
+module CORBA
+{
+ typedef sequence<long double> LongDoubleSeq;
+};
+
+#endif /* TAO_CORBA_LONG_DOUBLE_SEQ_IDL */
diff --git a/TAO/tao/LongLongSeq.pidl b/TAO/tao/LongLongSeq.pidl
new file mode 100644
index 00000000000..5cd57874ef9
--- /dev/null
+++ b/TAO/tao/LongLongSeq.pidl
@@ -0,0 +1,31 @@
+// -*- IDL -*-
+//
+// $Id$
+
+// ================================================================
+/**
+ * This file was used to generate the code in LongLongSeq*.*
+ * The command used to generate code is:
+ *
+ * tao_idl
+ * -o orig -Ge 1 -GA -SS -Sci
+ * -Wb,export_macro=TAO_Export
+ * -Wb,export_include="tao/TAO_Export.h"
+ * -Wb,pre_include="ace/pre.h"
+ * -Wb,post_include="ace/post.h"
+ * LongLongSeq.pidl
+ *
+ */
+// ================================================================
+
+#ifndef TAO_CORBA_LONGLONG_SEQ_IDL
+#define TAO_CORBA_LONGLONG_SEQ_IDL
+
+#pragma prefix "omg.org"
+
+module CORBA
+{
+ typedef sequence<long long> LongLongSeq;
+};
+
+#endif /* TAO_CORBA_LONGLONG_SEQ_IDL */
diff --git a/TAO/tao/LongSeq.pidl b/TAO/tao/LongSeq.pidl
new file mode 100644
index 00000000000..823f7790ab2
--- /dev/null
+++ b/TAO/tao/LongSeq.pidl
@@ -0,0 +1,31 @@
+// -*- IDL -*-
+//
+// $Id$
+
+// ================================================================
+/**
+ * This file was used to generate the code in LongSeq*.*
+ * The command used to generate code is:
+ *
+ * tao_idl
+ * -o orig -Ge 1 -GA -SS -Sci
+ * -Wb,export_macro=TAO_Export
+ * -Wb,export_include=TAO_Export.h
+ * -Wb,pre_include="ace/pre.h"
+ * -Wb,post_include="ace/post.h"
+ * LongSeq.pidl
+ *
+ */
+// ================================================================
+
+#ifndef TAO_CORBA_LONG_SEQ_IDL
+#define TAO_CORBA_LONG_SEQ_IDL
+
+#pragma prefix "omg.org"
+
+module CORBA
+{
+ typedef sequence<long> LongSeq;
+};
+
+#endif /* TAO_CORBA_LONG_SEQ_IDL */
diff --git a/TAO/tao/MCAST_Parser.cpp b/TAO/tao/MCAST_Parser.cpp
new file mode 100644
index 00000000000..6d182f8846b
--- /dev/null
+++ b/TAO/tao/MCAST_Parser.cpp
@@ -0,0 +1,524 @@
+#include "tao/MCAST_Parser.h"
+#include "tao/default_ports.h"
+#include "tao/ORB_Core.h"
+#include "tao/ORB.h"
+#include "tao/Environment.h"
+#include "tao/debug.h"
+
+#include "ace/SOCK_Acceptor.h"
+#include "ace/SOCK_Dgram.h"
+#include "ace/OS_NS_strings.h"
+#include "ace/OS_NS_string.h"
+
+#if !defined(__ACE_INLINE__)
+#include "tao/MCAST_Parser.i"
+#endif /* __ACE_INLINE__ */
+
+
+ACE_RCSID (tao,
+ MCAST_Parser,
+ "$Id$")
+
+
+static const char mcast_prefix[] = "mcast:";
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_MCAST_Parser::~TAO_MCAST_Parser (void)
+{
+}
+
+int
+TAO_MCAST_Parser::match_prefix (const char *ior_string) const
+{
+ return (ACE_OS::strncmp (ior_string,
+ ::mcast_prefix,
+ sizeof (::mcast_prefix) - 1) == 0);
+}
+
+CORBA::Object_ptr
+TAO_MCAST_Parser::parse_string (const char *ior,
+ CORBA::ORB_ptr orb
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ const char *mcast_name =
+ ior + sizeof (::mcast_prefix) + 1;
+
+ assign_to_variables (mcast_name);
+
+ /*
+ * Now that we got the global variables.
+ * we can invoke multicast_to_service and multicast_query
+ */
+ CORBA::Object_ptr object = CORBA::Object::_nil ();
+
+ CORBA::UShort const port =
+ (CORBA::UShort) ACE_OS::atoi (this->mcast_port_.in ());
+
+ ACE_Time_Value *timeout = orb->get_timeout ();
+
+ object = multicast_to_service (service_name_.in (),
+ port,
+ this->mcast_address_.in (),
+ this->mcast_ttl_.in (),
+ this->mcast_nic_.in (),
+ orb,
+ timeout
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Object::_nil ());
+
+ return object;
+}
+
+CORBA::Object_ptr
+TAO_MCAST_Parser::multicast_to_service (const char *service_name,
+ u_short port,
+ const char *mcast_address,
+ const char *mcast_ttl,
+ const char *mcast_nic,
+ CORBA::ORB_ptr orb,
+ ACE_Time_Value *timeout
+ ACE_ENV_ARG_DECL)
+{
+ char buf[2048];
+ char *ior = buf;
+
+ CORBA::String_var cleaner;
+
+ CORBA::Object_var return_value =
+ CORBA::Object::_nil ();
+
+ // Use UDP multicast to locate the service.
+ int const result = this->multicast_query (ior,
+ service_name,
+ port,
+ mcast_address,
+ mcast_ttl,
+ mcast_nic,
+ timeout,
+ orb);
+
+ // If the IOR didn't fit into <buf>, memory for it was dynamically
+ // allocated - make sure it gets deallocated.
+ if (ior != buf)
+ cleaner = ior;
+
+ if (result == 0)
+ {
+ // Convert IOR to an object reference.
+ return_value =
+ orb->string_to_object (ior
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Object::_nil ());
+ }
+
+ // Return object reference.
+ return return_value._retn ();
+}
+
+int
+TAO_MCAST_Parser::multicast_query (char *&buf,
+ const char *service_name,
+ u_short port,
+ const char *mcast_address,
+ const char *mcast_ttl,
+ const char *mcast_nic,
+ ACE_Time_Value *timeout,
+ CORBA::ORB_ptr orb)
+{
+ ACE_INET_Addr my_addr;
+ ACE_SOCK_Acceptor acceptor;
+ ACE_SOCK_Stream stream;
+ ACE_SOCK_Dgram dgram;
+
+ ssize_t result = 0;
+
+ // Bind listener to any port and then find out what the port was.
+#if defined (ACE_HAS_IPV6)
+ if (acceptor.open (ACE_Addr::sap_any, 0, AF_INET6) == -1
+#else /* ACE_HAS_IPV6 */
+ if (acceptor.open (ACE_Addr::sap_any) == -1
+#endif /* !ACE_HAS_IPV6 */
+ || acceptor.get_local_addr (my_addr) == -1)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("acceptor.open () || ")
+ ACE_TEXT ("acceptor.get_local_addr () failed\n")));
+ result = -1;
+ }
+ else
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_TCHAR addr[64];
+ my_addr.addr_to_string (addr, sizeof(addr));
+ ACE_DEBUG ((LM_DEBUG,
+ "(%P|%t) TAO_MCAST_Parser: acceptor local address %s.\n",
+ addr));
+ }
+
+ ACE_INET_Addr multicast_addr (port,
+ mcast_address);
+
+ // Set the address if multicast_discovery_endpoint option
+ // is specified for the Naming Service.
+ ACE_CString mde (orb->orb_core ()->orb_params ()
+ ->mcast_discovery_endpoint ());
+
+ if (ACE_OS::strcasecmp (service_name,
+ "NameService") == 0
+ && mde.length () != 0)
+ if (multicast_addr.set (mde.c_str()) == -1)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT("ORB.cpp: Multicast address setting failed\n")));
+ stream.close ();
+ dgram.close ();
+ acceptor.close ();
+ return -1;
+ }
+
+ // Open the datagram.
+ if (dgram.open (ACE_Addr::sap_any) == -1)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("Unable to open the Datagram!\n")));
+ result = -1;
+ }
+ else
+ {
+ // Set NIC
+ dgram.set_nic (ACE_TEXT_CHAR_TO_TCHAR (mcast_nic),
+ multicast_addr.get_type ());
+
+ // Set TTL
+ int mcast_ttl_optval = ACE_OS::atoi (mcast_ttl);
+
+#if defined (ACE_HAS_IPV6)
+ if (multicast_addr.get_type () == AF_INET6)
+ {
+ if (dgram.set_option (
+ IPPROTO_IPV6,
+ IPV6_MULTICAST_HOPS,
+ &mcast_ttl_optval,
+ sizeof (mcast_ttl_optval)) != 0)
+ return -1;
+ }
+ else
+#endif /* ACE_HAS_IPV6 */
+ if (dgram.set_option (
+ IPPROTO_IP,
+ IP_MULTICAST_TTL,
+ &mcast_ttl_optval,
+ sizeof (mcast_ttl_optval)) != 0)
+ result = -1;
+
+ // Convert the acceptor port into network byte order.
+ ACE_UINT16 response_port =
+ (ACE_UINT16) ACE_HTONS (my_addr.get_port_number ());
+
+ // Length of service name we will send.
+ CORBA::Short data_len =
+ (CORBA::Short) ACE_HTONS (ACE_OS::strlen (service_name) + 1);
+
+ // Vector we will send. It contains: 1) length of service
+ // name string, 2)port on which we are listening for
+ // replies, and 3) name of service we are looking for.
+ const int iovcnt = 3;
+ iovec iovp[iovcnt];
+
+ // The length of service name string.
+ iovp[0].iov_base = (char *) &data_len;
+ iovp[0].iov_len = sizeof (CORBA::Short);
+
+ // The port at which we are listening.
+ iovp[1].iov_base = (char *) &response_port;
+ iovp[1].iov_len = sizeof (ACE_UINT16);
+
+ // The service name string.
+ iovp[2].iov_base = (char *) service_name;
+ iovp[2].iov_len =
+ static_cast<u_long> (ACE_OS::strlen (service_name) + 1);
+
+ // Send the multicast.
+ result = dgram.send (iovp,
+ iovcnt,
+ multicast_addr);
+
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("\nsent multicast request.")));
+
+ // Check for errors.
+ if (result == -1)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("%p\n"),
+ ACE_TEXT ("error sending IIOP multicast")));
+ else
+ {
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("\n%N; Sent multicast.")
+ ACE_TEXT ("# of bytes sent is %d.\n"),
+ result));
+ // Wait for response until timeout.
+ ACE_Time_Value tv (
+ timeout == 0
+ ? ACE_Time_Value (TAO_DEFAULT_SERVICE_RESOLUTION_TIMEOUT)
+ : *timeout);
+
+ // Accept reply connection from server.
+ if (acceptor.accept (stream,
+ 0,
+ &tv) == -1)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("%p\n"),
+ ACE_TEXT ("multicast_query: unable to accept")));
+ result = -1;
+ }
+ else
+ {
+ // Receive the IOR.
+
+ // IOR length.
+ CORBA::Short ior_len;
+ result = stream.recv_n (&ior_len,
+ sizeof ior_len,
+ 0,
+ &tv);
+ if (result != sizeof (ior_len))
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("%p\n"),
+ ACE_TEXT ("multicast_query: unable to receive ")
+ ACE_TEXT ("ior length")));
+ result = -1;
+ }
+ else
+ {
+ // Allocate more space for the ior if we don't
+ // have enough.
+ ior_len = (CORBA::Short) ACE_NTOHS (ior_len);
+ if (ior_len > TAO_DEFAULT_IOR_SIZE)
+ {
+ buf = CORBA::string_alloc (ior_len);
+ if (buf == 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("%p\n"),
+ ACE_TEXT ("multicast_query: unable to ")
+ ACE_TEXT ("allocate memory")));
+ result = -1;
+ }
+ }
+
+ if (result != -1)
+ {
+ // Receive the ior.
+ result = stream.recv_n (buf,
+ ior_len,
+ 0,
+ &tv);
+ if (result == -1)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ( "%p\n"),
+ ACE_TEXT ("error reading ior")));
+ else if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("%N: service resolved to IOR <%s>\n"),
+ ACE_TEXT_CHAR_TO_TCHAR (buf)));
+ }
+ }
+ }
+ }
+ }
+ if (result == -1)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT("\nmulticast discovery of %s failed.\n"),
+ ACE_TEXT_CHAR_TO_TCHAR (service_name)));
+
+ if (ACE_OS::strcasecmp (service_name,
+ "NameService") == 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT("Specify -m 1 when starting Naming_Service,\n")
+ ACE_TEXT("or see http://www.theaceorb.com/faq/#115\n")
+ ACE_TEXT("for using NameService without multicast.\n\n")));
+ }
+ }
+ }
+
+ // Clean up.
+ stream.close ();
+ dgram.close ();
+ acceptor.close ();
+
+ return result == -1 ? -1 : 0;
+}
+
+void
+TAO_MCAST_Parser::assign_to_variables (const char * &mcast_name)
+{
+ /*
+ * The format now is "multicast_address:port:nicaddress:ttl/object_key"
+ */
+ ACE_CString mcast_name_cstring (mcast_name);
+
+ ssize_t pos_colon1 = mcast_name_cstring.find (':', 0);
+#if defined (ACE_HAS_IPV6)
+ // IPv6 numeric address in host string?
+ bool ipv6_in_host = false;
+
+ // Check if this is an mcast address containing a
+ // decimal IPv6 address representation.
+ if (mcast_name_cstring[0] == '[')
+ {
+ // In this case we have to find the end of the numeric address and
+ // start looking for the port separator from there.
+ int cp_pos = mcast_name_cstring.find (']', 0);
+ if (cp_pos == 0)
+ {
+ // No valid IPv6 address specified.
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_ERROR,
+ ACE_TEXT ("\nTAO (%P|%t) MCAST_Parser: ")
+ ACE_TEXT ("Invalid IPv6 decimal address specified.\n")));
+ }
+
+ return;
+ }
+ else
+ {
+ if (mcast_name_cstring[cp_pos + 1] == ':') // Look for a port
+ pos_colon1 = cp_pos + 1;
+ else
+ pos_colon1 = cp_pos;
+ ipv6_in_host = true; // host string contains full IPv6 numeric address
+ }
+ }
+#endif /* ACE_HAS_IPV6 */
+
+ if (pos_colon1 == 0)
+ {
+#if defined (ACE_HAS_IPV6)
+ const char *default_addr = ACE_DEFAULT_MULTICASTV6_ADDR;
+#else /* ACE_HAS_IPV6 */
+ const char *default_addr = ACE_DEFAULT_MULTICAST_ADDR;
+#endif /* !ACE_HAS_IPV6 */
+ this->mcast_address_ = default_addr;
+ }
+ else
+ {
+#if defined (ACE_HAS_IPV6)
+ if (ipv6_in_host)
+ this->mcast_address_ =
+ mcast_name_cstring.substring (1,
+ pos_colon1 - 2).c_str ();
+ else
+#endif /* ACE_HAS_IPV6 */
+ this->mcast_address_ =
+ mcast_name_cstring.substring (0,
+ pos_colon1).c_str ();
+ }
+ mcast_name_cstring =
+ mcast_name_cstring.substring (pos_colon1 + 1,
+ mcast_name_cstring.length() -
+ pos_colon1);
+
+ ssize_t pos_colon2 = mcast_name_cstring.find (':', 0);
+
+ if (pos_colon2 == 0)
+ {
+ /*
+ * If the port is not specified, use the default.
+ * The default multicast port is the same as the default port
+ * no. for Naming_Service, for now. But for other services,
+ * check and modify the default values as needed.
+ */
+ char default_port[33];
+
+ int trial_port = TAO_DEFAULT_NAME_SERVER_REQUEST_PORT;
+
+ if (mcast_name_cstring.find ("InterfaceRepository") !=
+ ACE_CString::npos)
+ {
+ trial_port = TAO_DEFAULT_INTERFACEREPO_SERVER_REQUEST_PORT;
+ }
+ else if (mcast_name_cstring.find ("ImplRepoService") !=
+ ACE_CString::npos)
+ {
+ trial_port = TAO_DEFAULT_IMPLREPO_SERVER_REQUEST_PORT;
+ }
+ else if (mcast_name_cstring.find ("TradingService") !=
+ ACE_CString::npos)
+ {
+ trial_port = TAO_DEFAULT_TRADING_SERVER_REQUEST_PORT;
+ }
+
+
+ ACE_OS::itoa (trial_port, default_port, 10);
+
+ this->mcast_port_ = (const char *) default_port;
+ }
+ else
+ {
+ this->mcast_port_ = mcast_name_cstring.substring (0,
+ pos_colon2).c_str ();
+ }
+
+ mcast_name_cstring =
+ mcast_name_cstring.substring (pos_colon2 + 1,
+ mcast_name_cstring.length() - pos_colon2);
+
+
+ ssize_t pos_colon3 = mcast_name_cstring.find (':', 0);
+
+ this->mcast_nic_ =
+ mcast_name_cstring.substring (0,
+ pos_colon3).c_str ();
+
+ mcast_name_cstring =
+ mcast_name_cstring.substring (pos_colon3 + 1,
+ mcast_name_cstring.length() - pos_colon3);
+
+ ssize_t pos_colon4 = mcast_name_cstring.find ('/', 0);
+
+ if (pos_colon4 == 0)
+ {
+ // And, the default TTL to be 1
+ const char *default_ttl = "1";
+ this->mcast_ttl_ = default_ttl;
+ }
+ else
+ {
+ this->mcast_ttl_ =
+ mcast_name_cstring.substring (0,
+ pos_colon4).c_str ();
+ }
+ mcast_name_cstring =
+ mcast_name_cstring.substring (pos_colon4,
+ mcast_name_cstring.length() - pos_colon4);
+
+ this->service_name_ =
+ mcast_name_cstring.substring (1,
+ mcast_name_cstring.length()
+ -1).c_str ();
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DEFINE (TAO_MCAST_Parser,
+ ACE_TEXT ("MCAST_Parser"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (TAO_MCAST_Parser),
+ ACE_Service_Type::DELETE_THIS |
+ ACE_Service_Type::DELETE_OBJ,
+ 0)
+
+ACE_FACTORY_DEFINE (TAO, TAO_MCAST_Parser)
+
diff --git a/TAO/tao/MCAST_Parser.h b/TAO/tao/MCAST_Parser.h
new file mode 100644
index 00000000000..5b1c0cd58ee
--- /dev/null
+++ b/TAO/tao/MCAST_Parser.h
@@ -0,0 +1,100 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file MCAST_Parser.h
+ *
+ * $Id$
+ *
+ * @author Priyanka Gontla (gontla_p@ociweb.com)
+ */
+//=============================================================================
+
+
+#ifndef TAO_MCAST_PARSER_H
+#define TAO_MCAST_PARSER_H
+
+#include /**/ "ace/pre.h"
+#include "ace/Service_Config.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/CORBA_String.h"
+#include "tao/IOR_Parser.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_MCAST_Parser
+ *
+ * @brief Implements the @c mcast: IOR format
+ *
+ * This class implements the @c mcast: IOR format.
+ * It is dynamically loaded by the ORB and used to parse the
+ * string to separate the individual <obj_addr> from the list of object
+ * addresses <obj_addr_list>.
+ */
+class TAO_Export TAO_MCAST_Parser : public TAO_IOR_Parser
+{
+public:
+ /// Constructor
+ TAO_MCAST_Parser (void);
+
+ /// The destructor
+ virtual ~TAO_MCAST_Parser (void);
+
+ /// = The IOR_Parser methods, please read the documentation in
+ /// IOR_Parser.h
+ virtual int match_prefix (const char *ior_string) const;
+
+ /// Parse the ior-string that is passed.
+ virtual CORBA::Object_ptr parse_string (const char *ior,
+ CORBA::ORB_ptr orb
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+private:
+
+ CORBA::Object_ptr multicast_to_service (const char *service_name,
+ CORBA::UShort port,
+ const char *mcast_address,
+ const char *mcast_ttl,
+ const char *mcast_nic,
+ CORBA::ORB_ptr orb,
+ ACE_Time_Value *timeout
+ ACE_ENV_ARG_DECL_NOT_USED);
+
+ int multicast_query (char *&buf,
+ const char *service_name,
+ u_short port,
+ const char *mcast_address,
+ const char *mcast_ttl,
+ const char *mcast_nic,
+ ACE_Time_Value *timeout,
+ CORBA::ORB_ptr orb);
+
+ /* Simple method to assign values to the global members:
+ mcast_address_, mcast_port_, mcast_nic_, mcast_ttl_ */
+ void assign_to_variables (const char * &mcast_name_ptr);
+
+ // Global private variables
+ CORBA::String_var mcast_address_;
+ CORBA::String_var mcast_port_;
+ CORBA::String_var mcast_nic_;
+ CORBA::String_var mcast_ttl_;
+ CORBA::String_var service_name_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/MCAST_Parser.i"
+#endif /* __ACE_INLINE__ */
+
+ACE_STATIC_SVC_DECLARE_EXPORT (TAO, TAO_MCAST_Parser)
+ACE_FACTORY_DECLARE (TAO, TAO_MCAST_Parser)
+
+#include /**/ "ace/post.h"
+#endif /* TAO_MCAST_PARSER_H */
diff --git a/TAO/tao/MCAST_Parser.i b/TAO/tao/MCAST_Parser.i
new file mode 100644
index 00000000000..fc19f658c44
--- /dev/null
+++ b/TAO/tao/MCAST_Parser.i
@@ -0,0 +1,12 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO_MCAST_Parser::TAO_MCAST_Parser (void)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/MMAP_Allocator.cpp b/TAO/tao/MMAP_Allocator.cpp
new file mode 100644
index 00000000000..cdb740fb347
--- /dev/null
+++ b/TAO/tao/MMAP_Allocator.cpp
@@ -0,0 +1,99 @@
+// $Id$
+
+#include "tao/MMAP_Allocator.h"
+
+
+#ifdef ACE_HAS_SENDFILE
+
+#include "ace/Mem_Map.h"
+#include "ace/Default_Constants.h"
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace
+{
+ // Default size mmap()ed memory pool will be the sum of the control
+ // block size and the default CDR buffer chosen by the user. The
+ // final size may be rounded up by the allocator to be aligned on
+ // the appropriate boundary/page.
+ //
+ // @@ This type really should be ACE_LOFF_T but ACE's mmap()-based
+ // classes currently do not handle large file offsets.
+ // -Ossama
+ off_t const the_default_buf_size =
+ sizeof (ACE_Control_Block) + ACE_DEFAULT_CDR_BUFSIZE;
+
+ ACE_MMAP_Memory_Pool_Options const the_pool_options (
+ ACE_DEFAULT_BASE_ADDR,
+ ACE_MMAP_Memory_Pool_Options::ALWAYS_FIXED,
+ 0, // No need to sync
+ the_default_buf_size,
+ MAP_SHARED, // Written data must be reflected in the backing store
+ // file in order for sendfile() to be able to read it.
+ 1,
+ 0,
+ /* 0 */ ACE_DEFAULT_FILE_PERMS,
+ true); // Generate for each mmap an unqiue pool
+}
+
+
+// Ideally we should open the backing store with shm_open() so that we
+// can avoid creating an on-disk backing store. An on-disk backing
+// store could potentially cause sendfile() to block on disk I/O,
+// which is undesirable. Unfortunately, ACE_Mem_Map currently
+// provides no way to configure which "open" function to use,
+// i.e. open(2) or shm_open(3). Alternatively we could shm_open() the
+// backing store file beforehand. Unfortunately,
+// ACE_{Lite_}MMAP_Memory_Pool currently doesn't provide a means to
+// pass the file descriptor for the desired backing store to the
+// underlying ACE_Mem_Map object.
+//
+// It may be tempting to mmap() /dev/zero. That would certainly
+// provide the desired transient "scratch space" memory that we can
+// write and read to and from, respectively. Unfortunately, the data
+// in /dev/zero-based memory mapped buffer can only be read through
+// the buffer itself, not through the file descriptor (e.g. using
+// read(2)) for the open()ed /dev/zero device. Reading through the
+// /dev/zero file descriptor simply returns zero, as /dev/zero was
+// designed to do. So unfortunate. :)
+TAO_MMAP_Allocator::TAO_MMAP_Allocator (void)
+ : TAO_MMAP_Allocator_Base ((char const *) 0 /* pool name */,
+ 0, // No need to explicitly name the lock.
+ &the_pool_options)
+{
+}
+
+TAO_MMAP_Allocator::~TAO_MMAP_Allocator (void)
+{
+}
+
+// @@ Should be const but underlying allocator methods are not!
+ACE_HANDLE
+TAO_MMAP_Allocator::handle (void)
+{
+ return this->alloc ().memory_pool ().mmap ().handle ();
+}
+
+// @@ Should be const but underlying allocator methods are not!
+off_t
+TAO_MMAP_Allocator::offset (void * p)
+{
+ ACE_Mem_Map const & m = this->alloc ().memory_pool ().mmap ();
+
+ ptrdiff_t const off = reinterpret_cast<ptrdiff_t> (p);
+ ptrdiff_t const base = reinterpret_cast<ptrdiff_t> (m.addr ());
+ ptrdiff_t const end = base + m.size ();
+
+ // Check if p is in the range of the mmap pool, if not we return -1
+ if (off < base || off > end)
+ return -1;
+
+ off_t const the_offset = static_cast<off_t> (off - base);
+
+ return (the_offset < 0 ? static_cast<off_t> (-1) : the_offset);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* ACE_HAS_SENDFILE */
diff --git a/TAO/tao/MMAP_Allocator.h b/TAO/tao/MMAP_Allocator.h
new file mode 100644
index 00000000000..ebf78a68b8c
--- /dev/null
+++ b/TAO/tao/MMAP_Allocator.h
@@ -0,0 +1,77 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file MMAP_Allocator.h
+ *
+ * $Id$
+ *
+ * @author Ossama Othman <ossama@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_MMAP_ALLOCATOR_H
+#define TAO_MMAP_ALLOCATOR_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#ifdef ACE_HAS_SENDFILE
+
+#include "ace/Malloc_T.h"
+#include "ace/MMAP_Memory_Pool.h"
+#include "ace/Thread_Mutex.h"
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// An ACE_Lite_MMAP_Memory_Pool is used since sync()ing is not
+// needed. All memory allocated by the TAO_MMAP_Allocator is meant
+// for strictly transient data, not persistent.
+typedef ACE_Allocator_Adapter <ACE_Malloc<ACE_LITE_MMAP_MEMORY_POOL, ACE_SYNCH_MUTEX> > TAO_MMAP_Allocator_Base;
+
+/**
+ * @class TAO_MMAP_Allocator
+ *
+ * @brief mmap-based allocator.
+ *
+ * This class utilizes and
+ */
+class TAO_MMAP_Allocator
+ : public TAO_MMAP_Allocator_Base
+{
+public:
+
+ /// Constructor
+ TAO_MMAP_Allocator (void);
+
+ /// Destructor.
+ virtual ~TAO_MMAP_Allocator (void);
+
+ /// Return backing store handle.
+ ACE_HANDLE handle (void);
+
+ /// Return offset in backing store file for memory address @a p. If @a p
+ /// is not coming from this allocator -1 is returned.
+ off_t offset (void * p);
+
+private:
+
+ // Disallow copying.
+ TAO_MMAP_Allocator (TAO_MMAP_Allocator const &);
+ void operator= (TAO_MMAP_Allocator const &);
+
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* ACE_HAS_SENDFILE */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_MMAP_ALLOCATOR_H */
diff --git a/TAO/tao/MProfile.cpp b/TAO/tao/MProfile.cpp
new file mode 100644
index 00000000000..94fb9e4dbf0
--- /dev/null
+++ b/TAO/tao/MProfile.cpp
@@ -0,0 +1,382 @@
+// -*- C++ -*-
+//
+// $Id$
+#include "tao/MProfile.h"
+#include "tao/Environment.h"
+#include "tao/Profile.h"
+#include "tao/PolicyC.h"
+#include "tao/ORB_Constants.h"
+#include "tao/SystemException.h"
+
+#include "ace/Log_Msg.h"
+#include "ace/Guard_T.h"
+
+ACE_RCSID (tao,
+ MProfile,
+ "$Id$")
+
+#if !defined (__ACE_INLINE__)
+# include "tao/MProfile.i"
+#endif /* __ACE_INLINE__ */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_MProfile::~TAO_MProfile (void)
+{
+ if (this->policy_list_ != 0)
+ {
+ ACE_DECLARE_NEW_CORBA_ENV;
+ const CORBA::ULong len = this->policy_list_->length ();
+ for (CORBA::ULong i = 0; i < len; ++i)
+ {
+ ACE_TRY
+ {
+ CORBA::Policy_ptr policy = (*this->policy_list_)[i];
+ policy->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ // Ignore all exceptions to allow other policies to be
+ // destroyed.
+ }
+ ACE_ENDTRY;
+ }
+
+ delete this->policy_list_;
+ }
+
+ this->cleanup ();
+}
+
+void
+TAO_MProfile::cleanup (void)
+{
+ if (this->pfiles_ != 0)
+ {
+ for (TAO_PHandle i = 0; i < this->last_; ++i)
+ if (this->pfiles_[i])
+ this->pfiles_[i]->_decr_refcnt ();
+ delete [] this->pfiles_;
+ this->pfiles_ = 0;
+ }
+
+ this->current_ = 0;
+ this->size_ = 0;
+ this->last_ = 0;
+}
+
+int
+TAO_MProfile::set (CORBA::ULong sz)
+{
+ if (sz == 0)
+ {
+ this->cleanup ();
+ return 0;
+ }
+
+ // See if we already have an existing profile list or if we need to
+ // get ridof what we have.
+ if (this->size_ != 0)
+ {
+ // Release all of our profiles.
+
+ for (TAO_PHandle h = 0;
+ h < this->size_;
+ ++h)
+ if (this->pfiles_[h])
+ {
+ this->pfiles_[h]->_decr_refcnt ();
+ this->pfiles_[h] = 0;
+ }
+
+ // Next see if we can reuse our profile list memory
+ if (this->size_ < sz)
+ {
+ // we cant reuse memory since the current array is too small!
+ delete [] this->pfiles_;
+
+ ACE_NEW_RETURN (this->pfiles_,
+ TAO_Profile *[sz],
+ -1);
+ this->size_ = sz;
+ }
+ // else , leave this->size and this->pfiles alone!
+ }
+ else
+ {
+ // first time, initialize!
+ ACE_NEW_RETURN (this->pfiles_,
+ TAO_Profile *[sz],
+ -1);
+ this->size_ = sz;
+ }
+
+ this->last_ = 0;
+ this->current_ = 0;
+
+ for (TAO_PHandle i = 0; i != this->size_; ++i)
+ this->pfiles_[i] = 0;
+
+ return this->size_;
+}
+
+int
+TAO_MProfile::set (const TAO_MProfile &mprofile)
+{
+ // NOTE: We use mprofile->last_ instead of mprofile->size_ to set
+ // this->size_. This is so we can use set () to trim a profile
+ // list!!
+
+ this->set (mprofile.last_);
+
+ // set indexes ...
+ this->last_ = mprofile.last_;
+
+ // These are set in set (ULong);
+ // this->current_ = 0;
+ // this->forward_from_ = 0;
+
+ // Now reference all profiles.
+ for (TAO_PHandle h = 0; h < this->last_; ++h)
+ {
+ this->pfiles_[h] = mprofile.pfiles_[h];
+ if (this->pfiles_[h] != 0)
+ this->pfiles_[h]->_incr_refcnt ();
+ }
+
+ return 1;
+}
+
+// Not thread safe!
+int
+TAO_MProfile::grow (CORBA::ULong sz)
+{
+ if (sz <= this->size_)
+ return 0;
+
+ // get the additional space
+ TAO_Profile **new_pfiles = 0;
+ TAO_Profile **old_pfiles = 0;
+ ACE_NEW_RETURN (new_pfiles,
+ TAO_Profile *[sz],
+ -1);
+
+ old_pfiles = this->pfiles_;
+
+ // got it, now copy profiles
+ for (TAO_PHandle h = 0; h < this->size_; ++h)
+ {
+ new_pfiles[h] = old_pfiles[h];
+ old_pfiles[h] = 0;
+ }
+
+ this->pfiles_ = new_pfiles;
+ this->size_ = sz;
+ delete [] old_pfiles;
+
+ return 0;
+}
+
+int
+TAO_MProfile::add_profile (TAO_Profile *pfile)
+{
+ // skip by the used slots
+ if (last_ == size_) // full!
+ {
+ if (this->grow (this->size_ + 1) < 0)
+ return -1;
+ }
+
+ pfiles_[last_++] = pfile;
+
+ if (pfile && pfile->_incr_refcnt () == 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) Unable to increment reference ")
+ ACE_TEXT ("count in add_profile!\n")),
+ -1);
+
+ return last_ - 1;
+}
+
+int
+TAO_MProfile::add_profiles (TAO_MProfile *pfiles)
+{
+ // this->size_ == total number of profiles we can hold
+ // this->last_ == the index of the last profile
+ CORBA::ULong space = this->size_ - this->last_;
+
+ if (space < pfiles->last_)
+ {
+ // we need to grow!
+ if (this->grow (this->last_ + pfiles->last_) < 0)
+ return -1;
+ }
+
+ // copy over profiles
+ for (TAO_PHandle h = 0; h < pfiles->last_; ++h)
+ {
+ if (this->add_profile (pfiles->pfiles_[h]) < 0)
+ return -1;
+ }
+ return 0;
+}
+
+
+// the layout for a full list of 7 Profiles.
+//
+// last_ == one past the last valid entry, so if the list has 2
+// profiles then last_ equals 2.
+// current_ == index of the next profile to be returned (or one past
+// the last returned.
+//
+// this->size_ = 7; current_ = 3; last_ = 7
+// 0, 1, 2, 3, 4, 5, 6}
+// { _, _, _, _, ..., _}
+//
+int
+TAO_MProfile::remove_profile (const TAO_Profile *pfile)
+{
+ TAO_PHandle h;
+ int found = 0;
+ for (h = 0; h < this->last_; ++h)
+ {
+ if (this->pfiles_[h]->is_equivalent (pfile))
+ { // remove it!
+ TAO_Profile *old = this->pfiles_[h];
+ this->pfiles_[h] = 0;
+ old->_decr_refcnt ();
+ // shift other profiles up one
+ // note, if h == last_ - 1 then do nothing.
+ for (TAO_PHandle inner = h; inner < this->last_ - 1; ++inner)
+ {
+ this->pfiles_[inner] = this->pfiles_[inner + 1];
+ }
+ // subtract 1 from last_ to indicate we have one fewer profiles
+ this->last_--;
+ found = 1;
+ break;
+ }
+ }
+ if ( found == 0)
+ return -1; // profile not found.
+ return 0;
+}
+
+int
+TAO_MProfile::remove_profiles (const TAO_MProfile *pfiles)
+{
+ for (TAO_PHandle h = 0; h < pfiles->last_; ++h)
+ {
+ if (this->remove_profile (pfiles->pfiles_[h]) < 0)
+ return -1;
+ }
+ return 0;
+}
+
+CORBA::Boolean
+TAO_MProfile::is_equivalent (const TAO_MProfile *rhs)
+{
+ // Two profile lists are equivalent iff at least one of the profiles
+ // from the first list is_equivalent to at least one of the profiles
+ // from the second list!!
+ for (TAO_PHandle h1 = 0; h1 < this->last_; ++h1)
+ for (TAO_PHandle h2 = 0; h2 < rhs->last_; ++h2)
+ if (this->pfiles_[h1]->is_equivalent (rhs->pfiles_[h2]))
+ return 1;
+
+ return 0;
+}
+
+CORBA::ULong
+TAO_MProfile::hash (CORBA::ULong max
+ ACE_ENV_ARG_DECL)
+{
+ CORBA::ULong hashval = 0;
+
+ if (this->last_ == 0)
+ return 0;
+
+ for (TAO_PHandle h = 0; h < this->last_ ; ++h)
+ {
+ hashval += pfiles_[h]->hash (max
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+ }
+
+ // The above hash function return an ULong between 0 and max here we
+ // simply take the average value and round.
+ //return hashval / this->last_;
+ // Changed to a mod value instead of an average.
+ return hashval % max;
+}
+
+void
+TAO_MProfile::create_policy_list (ACE_ENV_SINGLE_ARG_DECL)
+{
+ ACE_NEW_THROW_EX (this->policy_list_,
+ CORBA::PolicyList,
+ CORBA::NO_MEMORY (0,
+ CORBA::COMPLETED_NO)
+ );
+}
+
+void
+TAO_MProfile::init_policy_list (ACE_ENV_SINGLE_ARG_DECL)
+{
+ // The first time this method is called
+ // it causes the initialization of the policies
+ // for the current profile.
+
+ this->get_current_profile ()->get_policies (*this->policy_list_
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->is_policy_list_initialized_ = 1;
+}
+
+CORBA::PolicyList *
+TAO_MProfile::policy_list (ACE_ENV_SINGLE_ARG_DECL)
+{
+ if (!this->is_policy_list_initialized_)
+ {
+ ACE_GUARD_RETURN (TAO_SYNCH_RECURSIVE_MUTEX,
+ guard,
+ this->mutex_,
+ 0);
+
+ if (this->policy_list_ == 0)
+ {
+ this->create_policy_list (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ this->init_policy_list (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+ }
+ }
+ CORBA::PolicyList *ret_val = 0;
+ ACE_NEW_THROW_EX (ret_val,
+ CORBA::PolicyList (*this->policy_list_),
+ CORBA::NO_MEMORY (0,
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (0);
+
+ return ret_val;
+}
+
+int
+TAO_MProfile::give_shared_profile (TAO_Profile *pfile)
+{
+ for (unsigned i = 0; i < this->last_; i++)
+ if (pfile->tag() == this->pfiles_[i]->tag() &&
+ pfile->compare_key(this->pfiles_[i]))
+ {
+ this->pfiles_[i]->add_generic_endpoint(pfile->endpoint());
+ pfile->_decr_refcnt();
+ return i;
+ }
+ return this->give_profile(pfile,0);
+}
+
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/MProfile.h b/TAO/tao/MProfile.h
new file mode 100644
index 00000000000..7fef351e37c
--- /dev/null
+++ b/TAO/tao/MProfile.h
@@ -0,0 +1,259 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file MProfile.h
+ *
+ * $Id$
+ *
+ * Keep track of profile lists
+ *
+ * @author Fred Kuhns <fredk@cs.wustl.edu>
+ */
+//=============================================================================
+
+
+#ifndef TAO_MPROFILE_H
+#define TAO_MPROFILE_H
+
+#include /**/ "ace/pre.h"
+#include "ace/CORBA_macros.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/Recursive_Thread_Mutex.h"
+
+#include "tao/TAO_Export.h"
+#include "tao/Basic_Types.h"
+#include "tao/orbconf.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Forward declarations
+class TAO_Profile;
+namespace CORBA
+{
+ class PolicyList;
+
+ class Environment;
+}
+
+typedef CORBA::ULong TAO_PHandle;
+
+/**
+ * @class TAO_MProfile
+ *
+ * @brief This class implements the basic interface for supporting
+ * multiple profiles.
+ *
+ * Multiple profiles can be treated either as a circular queue or
+ * a linear array of profiles.
+ * It is assumed that locking will only be required when a profile
+ * list is associated with a TAO_Stub. Thus when the
+ * TAO_Stub accepts ownership of an MProfile it also assumes
+ * responsibility for controling access (i.e. locking).
+ */
+class TAO_Export TAO_MProfile
+{
+public:
+ // = Initialization and termination methods.
+ TAO_MProfile (CORBA::ULong sz = 0);
+
+ /**
+ * **NOTE: IF mprofiles->last_ > 0, THEN this->size_ will be set to
+ * mprofiles->last_. Otherwise this->size_ - mprofiles->size_.
+ * Furthermore, current_ is set back to 0! i.e. rewound.
+ * The reference count on any profiles in mprofiles is increment
+ * when their references (i.e. pointers) are copied.
+ */
+ TAO_MProfile (const TAO_MProfile &mprofiles);
+
+ /// Assigment operator.
+ TAO_MProfile& operator= (const TAO_MProfile& mprofiles);
+
+ /// Destructor: decrements reference count on all references
+ /// profiles!
+ ~TAO_MProfile (void);
+
+ /// Inits MProfile to hold sz TAO_Profiles.
+ /// NOT THREAD SAFE
+ int set (CORBA::ULong sz);
+
+ /**
+ * Inits this to the values of mprofile. NOTE: We use
+ * mprofile->last_ instead of mprofile->size_ to set this->size_.
+ * This is so we can use set () to trim a profile list!!
+ * NOT THREAD SAFE
+ */
+ int set (const TAO_MProfile &mprofile);
+
+ /// increase the number of profiles this object can hold.
+ /// NOT THREAD SAFE
+ int grow (CORBA::ULong sz);
+
+ /// Treat as a circular list.
+ TAO_Profile *get_cnext (void);
+
+ /// Get next profile in list, return 0 at end of list.
+ TAO_Profile *get_next (void);
+
+ /// Assume a circular list of profiles.
+ TAO_Profile *get_cprev (void);
+
+ /// Get previous profile, stop at beginning of list and return 0.
+ TAO_Profile *get_prev (void);
+
+ /// Return a pointer to the current profile, will not increment
+ /// reference pointer.
+ TAO_Profile *get_current_profile (void);
+
+ /// Return a pointer to the profile referenced by handle void.
+ TAO_Profile *get_profile (TAO_PHandle handle);
+
+ // rem_profile (TAO_PHandle handle); let's wait.
+
+ /// Returns the index for the current profile.
+ TAO_PHandle get_current_handle (void);
+
+ /// Returns the index for the current profile.
+ TAO_PHandle get_current_handle (void) const;
+
+ /// Returns the number of profiles stored in the list (last_+1).
+ CORBA::ULong profile_count (void) const;
+
+ /// return the maximum number of profiles that can be stored in this
+ /// container, (size_+1)
+ CORBA::ULong size (void) const;
+
+ /// Return the profile at position <slot>. If <slot> is out of range
+ /// it returns 0.
+ const TAO_Profile* get_profile (CORBA::ULong slot) const;
+
+ /// Sets the current slot back to 0.
+ void rewind (void);
+
+ /// Return the index of this entry or -1 if it can not be added.
+ /// reference count on profile in incremented!
+ int add_profile (TAO_Profile *pfile);
+
+ /// Return the index of this entry or -1 if it can not be added.
+ /// this object assumes ownership of this profile!!
+ int give_profile (TAO_Profile *pfile, int share = 0);
+
+ /// append the profiles in pfiles to this object. The count
+ /// will be incremented on the individual profile objects.
+ int add_profiles (TAO_MProfile *pfiles);
+
+ /// remove from this MProfile any profiles which also appear in pfiles.
+ int remove_profile (const TAO_Profile *pfile);
+
+ /// remove from this MProfile any profiles which also appear in pfiles.
+ int remove_profiles (const TAO_MProfile *pfiles);
+
+ /// Set a pointer to the MProfile whose 'current' TAO_Profile was
+ /// forwarded This object is the set of forwarding profiles.
+ void forward_from (TAO_MProfile *mprofiles);
+
+ /// Returns a pointer to the profile which was forwarded.
+ TAO_MProfile *forward_from (void);
+
+ /**
+ * Returns true of there is at least one profile in first which
+ * is_equivalent with at least one profile in second.
+ * NON-THREAD SAFE, relies on some other entity to guarentee
+ * the profiles will not change during the call.
+ */
+ CORBA::Boolean is_equivalent (const TAO_MProfile *rhs);
+
+ /**
+ * use all registered profiles. The hash() method is called on each
+ * profile and the results are averaged together.
+ * NON-THREAD SAFE.
+ */
+ CORBA::ULong hash (CORBA::ULong max
+ ACE_ENV_ARG_DECL);
+
+protected:
+
+ /// This method handle the dynamic allocation of the data member
+ /// <policy_list_>.
+ void create_policy_list (ACE_ENV_SINGLE_ARG_DECL);
+
+public:
+
+ /// Sets the policies list associated with the profiles
+ /// owned by the TAO_MProfile.
+ void policy_list (CORBA::PolicyList *policy_list);
+
+ /// Gets the policies list associated with the profiles
+ /// owned by the TAO_MProfile.
+ CORBA::PolicyList *policy_list (ACE_ENV_SINGLE_ARG_DECL);
+
+protected:
+
+ /// Initialize the policy list, demarsharling the policy.
+ void init_policy_list (ACE_ENV_SINGLE_ARG_DECL);
+
+protected:
+ /// Stores the policy list for the profile of this MProfile.
+ friend class TAO_Profile;
+ CORBA::PolicyList *policy_list_;
+
+ CORBA::Boolean is_policy_list_initialized_;
+
+ /// Mutex used to make sure that only one policy list
+ /// is created.
+ TAO_SYNCH_RECURSIVE_MUTEX mutex_;
+
+protected:
+ /// Return the complete list of profiles, this object retains
+ /// ownership!
+ TAO_Profile **pfiles (void) const;
+
+
+private:
+ /// Helper method to implement the destructor
+ void cleanup (void);
+
+ /// A helper to give_profile to be used when share is true. This
+ /// method is used primarily to help the corbaloc parser create a
+ /// single profile with multiple endpoints rather than constructing
+ /// multiple profiles with 1 endpoint per.
+ int give_shared_profile (TAO_Profile *pfile);
+
+private:
+
+ /**
+ * Used for chaning references when the current profile is
+ * forwarded. Note, this will only be valid for an MProfile which
+ * contains a list of forward_profiles for some initial or base
+ * profile. This is a backward reference to the profile list which
+ * received the relocate message. The actual profile what was
+ * forwarded will be forward_from_->get_current_profile ()
+ */
+ TAO_MProfile *forward_from_;
+
+ /// Actual list of profiles.
+ TAO_Profile **pfiles_;
+
+ /// Points to the next profile to be used. 0 ... size_
+ TAO_PHandle current_;
+
+ /// Max size of array
+ TAO_PHandle size_;
+
+ /// Index plus 1 of last valid entry! May be < size_.
+ TAO_PHandle last_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/MProfile.i"
+#endif /*__ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_MPROFILE_H */
diff --git a/TAO/tao/MProfile.i b/TAO/tao/MProfile.i
new file mode 100644
index 00000000000..2cf4d05d274
--- /dev/null
+++ b/TAO/tao/MProfile.i
@@ -0,0 +1,204 @@
+// -*- C++ -*-
+//
+// $Id$
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO_MProfile::TAO_MProfile (CORBA::ULong sz)
+ : policy_list_ (0),
+ is_policy_list_initialized_ (0),
+ forward_from_(0),
+ pfiles_ (0),
+ current_ (0),
+ size_ (0),
+ last_ (0)
+{
+ this->set (sz);
+}
+
+ACE_INLINE
+TAO_MProfile::TAO_MProfile (const TAO_MProfile &mprofiles)
+ : policy_list_ (0),
+ is_policy_list_initialized_ (0),
+ forward_from_(0),
+ pfiles_ (0),
+ current_ (0),
+ size_ (0),
+ last_ (0)
+{
+ this->set (mprofiles);
+}
+
+ACE_INLINE TAO_MProfile&
+TAO_MProfile::operator= (const TAO_MProfile& rhs)
+{
+ if (this == &rhs)
+ return *this;
+
+ this->set (rhs);
+ return *this;
+}
+
+// Cyclic get next. It will simply cycle through the complete list.
+
+ACE_INLINE TAO_Profile *
+TAO_MProfile::get_cnext (void)
+{
+ if (last_ == 0)
+ return 0;
+
+ if (current_ == last_)
+ current_ = 0;
+
+ return pfiles_[current_++];
+}
+
+// This will return the next element until either null is found or the
+// end of list. It then continues to return NULL until rewind.
+
+ACE_INLINE TAO_Profile *
+TAO_MProfile::get_next (void)
+{
+ // Nolist or EndOfList
+ if (last_ == 0 || current_ == last_)
+ return 0;
+ else
+ return pfiles_[current_++];
+}
+
+ACE_INLINE TAO_Profile *
+TAO_MProfile::get_cprev (void)
+{
+ if (last_ == 0)
+ return 0;
+ else if (last_ == 1)
+ current_=1;
+ else if (current_ > 1)
+ --current_;
+ else // current_ == 0 or 1, 0 => list never read before and == 1
+ current_ = last_;
+
+ return pfiles_[current_ - 1];
+}
+
+ACE_INLINE TAO_Profile *
+TAO_MProfile::get_prev (void)
+{
+ if (last_ == 0 || current_ <= 1)
+ // No List of BeginningOfList
+ return 0;
+ if (current_ > 1)
+ --current_;
+
+ return pfiles_[current_ - 1];
+}
+
+// does not affect the current_ setting!
+
+ACE_INLINE TAO_Profile *
+TAO_MProfile::get_profile (TAO_PHandle handle)
+{
+ if (handle < last_)
+ return pfiles_[handle];
+ else
+ return 0;
+}
+
+ACE_INLINE TAO_Profile *
+TAO_MProfile::get_current_profile (void)
+{
+ if (last_ == 0)
+ return 0;
+ if (current_ == 0)
+ // means list has not been read before.
+ current_ = 1;
+
+ return pfiles_[current_ - 1];
+}
+
+ACE_INLINE TAO_PHandle
+TAO_MProfile::get_current_handle (void)
+{
+ if (current_ > 0)
+ return current_ - 1;
+ else
+ return 0;
+}
+
+ACE_INLINE TAO_PHandle
+TAO_MProfile::get_current_handle (void) const
+{
+ if (current_ > 0)
+ return current_ - 1;
+ else
+ return 0;
+}
+
+ACE_INLINE void
+TAO_MProfile::rewind (void)
+{
+ current_ = 0;
+}
+ACE_INLINE int
+TAO_MProfile::give_profile (TAO_Profile *pfile, int share)
+{
+ if (share)
+ return this->give_shared_profile(pfile);
+ // skip by the used slots
+ if (last_ == size_) // full!
+ return -1;
+
+ pfiles_[last_++] = pfile;
+
+ return last_ - 1;
+}
+
+ACE_INLINE
+void
+TAO_MProfile::forward_from (TAO_MProfile *from)
+{
+ this->forward_from_ = from;
+}
+
+ACE_INLINE
+TAO_MProfile *
+TAO_MProfile::forward_from (void)
+{
+ return this->forward_from_;
+}
+
+ACE_INLINE CORBA::ULong
+TAO_MProfile::profile_count (void) const
+{
+ return this->last_;
+}
+
+ACE_INLINE CORBA::ULong
+TAO_MProfile::size (void) const
+{
+ return this->size_;
+}
+
+ACE_INLINE const TAO_Profile*
+TAO_MProfile::get_profile (CORBA::ULong slot) const
+{
+ if (slot >= this->last_)
+ return 0;
+ return this->pfiles_[slot];
+}
+
+ACE_INLINE TAO_Profile **
+TAO_MProfile::pfiles (void) const
+{
+ return this->pfiles_;
+}
+
+ACE_INLINE void
+TAO_MProfile::policy_list (CORBA::PolicyList *policy_list)
+{
+ this->policy_list_ = policy_list;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Makefile.am b/TAO/tao/Makefile.am
new file mode 100644
index 00000000000..7580b7f377a
--- /dev/null
+++ b/TAO/tao/Makefile.am
@@ -0,0 +1,4222 @@
+## Process this file with automake to create Makefile.in
+##
+## $Id$
+##
+## This file was generated by MPC. Any changes made directly to
+## this file will be lost the next time it is generated.
+##
+## MPC Command:
+## ../bin/mwc.pl -type automake -noreldefs TAO.mwc
+
+includedir = @includedir@/tao
+pkgconfigdir = @libdir@/pkgconfig
+
+ACE_BUILDDIR = $(top_builddir)/..
+ACE_ROOT = $(top_srcdir)/..
+TAO_BUILDDIR = $(top_builddir)
+TAO_IDL = ACE_ROOT=$(ACE_ROOT) TAO_ROOT=$(TAO_ROOT) $(TAO_BUILDDIR)/TAO_IDL/tao_idl
+TAO_IDL_DEP = $(TAO_BUILDDIR)/TAO_IDL/tao_idl
+TAO_IDLFLAGS = -Ge 1 -Wb,pre_include=ace/pre.h -Wb,post_include=ace/post.h -I$(TAO_ROOT) -I$(srcdir) -g $(ACE_BUILDDIR)/apps/gperf/src/gperf
+TAO_ROOT = $(top_srcdir)
+
+
+## Makefile.TAO.am
+
+lib_LTLIBRARIES = libTAO.la
+
+libTAO_la_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR) \
+ -I$(TAO_ROOT) \
+ -I$(TAO_BUILDDIR) \
+ -DTAO_BUILD_DLL
+
+libTAO_la_SOURCES = \
+ Abstract_Servant_Base.cpp \
+ Acceptor_Filter.cpp \
+ Acceptor_Registry.cpp \
+ Adapter.cpp \
+ Adapter_Factory.cpp \
+ Adapter_Registry.cpp \
+ AnyTypeCode_Adapter.cpp \
+ Argument.cpp \
+ Asynch_Queued_Message.cpp \
+ Asynch_Reply_Dispatcher_Base.cpp \
+ Base_Transport_Property.cpp \
+ BiDir_Adapter.cpp \
+ Bind_Dispatcher_Guard.cpp \
+ Block_Flushing_Strategy.cpp \
+ Blocked_Connect_Strategy.cpp \
+ BooleanSeqC.cpp \
+ Buffering_Constraint_Policy.cpp \
+ CDR.cpp \
+ CONV_FRAMEC.cpp \
+ CORBALOC_Parser.cpp \
+ CORBANAME_Parser.cpp \
+ CORBA_String.cpp \
+ Cache_Entries.cpp \
+ CharSeqC.cpp \
+ Cleanup_Func_Registry.cpp \
+ ClientRequestInterceptor_Adapter.cpp \
+ ClientRequestInterceptor_Adapter_Factory.cpp \
+ Client_Strategy_Factory.cpp \
+ Codeset_Manager.cpp \
+ Codeset_Manager_Factory_Base.cpp \
+ Codeset_Translator_Base.cpp \
+ Collocated_Invocation.cpp \
+ Collocation_Proxy_Broker.cpp \
+ Collocation_Resolver.cpp \
+ Connect_Strategy.cpp \
+ Connection_Handler.cpp \
+ Connection_Purging_Strategy.cpp \
+ Connector_Registry.cpp \
+ CurrentC.cpp \
+ DLL_Parser.cpp \
+ Default_Collocation_Resolver.cpp \
+ Default_Endpoint_Selector_Factory.cpp \
+ Default_Protocols_Hooks.cpp \
+ Default_Stub_Factory.cpp \
+ Default_Thread_Lane_Resources_Manager.cpp \
+ DomainC.cpp \
+ DoubleSeqC.cpp \
+ Dynamic_Adapter.cpp \
+ Endpoint.cpp \
+ Endpoint_Selector_Factory.cpp \
+ Environment.cpp \
+ Exception.cpp \
+ Exclusive_TMS.cpp \
+ FILE_Parser.cpp \
+ Fault_Tolerance_Service.cpp \
+ FloatSeqC.cpp \
+ Flushing_Strategy.cpp \
+ GIOPC.cpp \
+ GIOP_Fragmentation_Strategy.cpp \
+ GIOP_Message_Base.cpp \
+ GIOP_Message_Generator_Parser.cpp \
+ GIOP_Message_Generator_Parser_10.cpp \
+ GIOP_Message_Generator_Parser_11.cpp \
+ GIOP_Message_Generator_Parser_12.cpp \
+ GIOP_Message_Generator_Parser_Impl.cpp \
+ GIOP_Message_Lite.cpp \
+ GIOP_Message_Locate_Header.cpp \
+ GIOP_Message_State.cpp \
+ GIOP_Message_Version.cpp \
+ GIOP_Utils.cpp \
+ GUIResource_Factory.cpp \
+ IFR_Client_Adapter.cpp \
+ IIOPC.cpp \
+ IIOP_Acceptor.cpp \
+ IIOP_Connection_Handler.cpp \
+ IIOP_Connector.cpp \
+ IIOP_Endpoint.cpp \
+ IIOP_EndpointsC.cpp \
+ IIOP_Factory.cpp \
+ IIOP_Lite_Factory.cpp \
+ IIOP_Profile.cpp \
+ IIOP_Transport.cpp \
+ IOPC.cpp \
+ IOP_IORC.cpp \
+ IORInterceptor_Adapter.cpp \
+ IORInterceptor_Adapter_Factory.cpp \
+ IOR_Parser.cpp \
+ Incoming_Message_Queue.cpp \
+ Incoming_Message_Stack.cpp \
+ Invocation_Adapter.cpp \
+ Invocation_Base.cpp \
+ Invocation_Endpoint_Selectors.cpp \
+ LF_CH_Event.cpp \
+ LF_Connect_Strategy.cpp \
+ LF_Event.cpp \
+ LF_Event_Binder.cpp \
+ LF_Event_Loop_Thread_Helper.cpp \
+ LF_Follower.cpp \
+ LF_Follower_Auto_Adder.cpp \
+ LF_Follower_Auto_Ptr.cpp \
+ LF_Invocation_Event.cpp \
+ LF_Multi_Event.cpp \
+ LF_Strategy.cpp \
+ LF_Strategy_Complete.cpp \
+ LRU_Connection_Purging_Strategy.cpp \
+ Leader_Follower.cpp \
+ Leader_Follower_Flushing_Strategy.cpp \
+ LocalObject.cpp \
+ LocateRequest_Invocation.cpp \
+ LocateRequest_Invocation_Adapter.cpp \
+ LongDoubleSeqC.cpp \
+ LongLongSeqC.cpp \
+ LongSeqC.cpp \
+ MCAST_Parser.cpp \
+ MMAP_Allocator.cpp \
+ MProfile.cpp \
+ Messaging_PolicyValueC.cpp \
+ Messaging_SyncScopeC.cpp \
+ Muxed_TMS.cpp \
+ NVList_Adapter.cpp \
+ New_Leader_Generator.cpp \
+ Null_Fragmentation_Strategy.cpp \
+ ORB.cpp \
+ ORBInitializer_Registry.cpp \
+ ORBInitializer_Registry_Adapter.cpp \
+ ORB_Core.cpp \
+ ORB_Core_Auto_Ptr.cpp \
+ ORB_Core_TSS_Resources.cpp \
+ ORB_Table.cpp \
+ Object.cpp \
+ ObjectIdListC.cpp \
+ ObjectKey_Table.cpp \
+ Object_KeyC.cpp \
+ Object_Loader.cpp \
+ Object_Proxy_Broker.cpp \
+ Object_Ref_Table.cpp \
+ OctetSeqC.cpp \
+ On_Demand_Fragmentation_Strategy.cpp \
+ PI_ForwardC.cpp \
+ ParameterModeC.cpp \
+ Parser_Registry.cpp \
+ Pluggable_Messaging.cpp \
+ Pluggable_Messaging_Utils.cpp \
+ PolicyC.cpp \
+ PolicyFactory_Registry_Adapter.cpp \
+ PolicyFactory_Registry_Factory.cpp \
+ Policy_Current.cpp \
+ Policy_Current_Impl.cpp \
+ Policy_ForwardC.cpp \
+ Policy_Manager.cpp \
+ Policy_Set.cpp \
+ Policy_Validator.cpp \
+ PortableInterceptorC.cpp \
+ Principal.cpp \
+ Profile.cpp \
+ Profile_Transport_Resolver.cpp \
+ Protocol_Factory.cpp \
+ Protocols_Hooks.cpp \
+ Queued_Message.cpp \
+ Reactive_Connect_Strategy.cpp \
+ Reactive_Flushing_Strategy.cpp \
+ Refcounted_ObjectKey.cpp \
+ Remote_Invocation.cpp \
+ Remote_Object_Proxy_Broker.cpp \
+ Reply_Dispatcher.cpp \
+ Request_Dispatcher.cpp \
+ Resource_Factory.cpp \
+ Resume_Handle.cpp \
+ ServerRequestInterceptor_Adapter.cpp \
+ ServerRequestInterceptor_Adapter_Factory.cpp \
+ Server_Strategy_Factory.cpp \
+ Service_Callbacks.cpp \
+ Service_Context.cpp \
+ ServicesC.cpp \
+ Services_Activate.cpp \
+ ShortSeqC.cpp \
+ StringSeqC.cpp \
+ String_Alloc.cpp \
+ Stub.cpp \
+ Stub_Factory.cpp \
+ Synch_Invocation.cpp \
+ Synch_Queued_Message.cpp \
+ Synch_Reply_Dispatcher.cpp \
+ SystemException.cpp \
+ TAOC.cpp \
+ TAO_Internal.cpp \
+ TAO_Server_Request.cpp \
+ TAO_Singleton_Manager.cpp \
+ TSS_Resources.cpp \
+ Tagged_Components.cpp \
+ Tagged_Profile.cpp \
+ Thread_Lane_Resources.cpp \
+ Thread_Lane_Resources_Manager.cpp \
+ Thread_Per_Connection_Handler.cpp \
+ TimeBaseC.cpp \
+ Transport.cpp \
+ Transport_Acceptor.cpp \
+ Transport_Cache_Manager.cpp \
+ Transport_Connector.cpp \
+ Transport_Descriptor_Interface.cpp \
+ Transport_Mux_Strategy.cpp \
+ Transport_Queueing_Strategies.cpp \
+ Transport_Timer.cpp \
+ TypeCodeFactory_Adapter.cpp \
+ Typecode_typesC.cpp \
+ ULongLongSeqC.cpp \
+ ULongSeqC.cpp \
+ UShortSeqC.cpp \
+ UserException.cpp \
+ Valuetype_Adapter.cpp \
+ Valuetype_Adapter_Factory.cpp \
+ WCharSeqC.cpp \
+ WStringSeqC.cpp \
+ Wait_On_LF_No_Upcall.cpp \
+ Wait_On_Leader_Follower.cpp \
+ Wait_On_Reactor.cpp \
+ Wait_On_Read.cpp \
+ Wait_Strategy.cpp \
+ WrongTransactionC.cpp \
+ debug.cpp \
+ default_client.cpp \
+ default_resource.cpp \
+ default_server.cpp \
+ operation_details.cpp \
+ orb_typesC.cpp \
+ params.cpp \
+ target_specification.cpp
+
+libTAO_la_LDFLAGS = \
+ -version-number @TAO_MAJOR@:@TAO_MINOR@:@TAO_BETA@
+
+libTAO_la_LIBADD = \
+ $(ACE_BUILDDIR)/ace/libACE.la
+
+nobase_include_HEADERS = \
+ Abstract_Servant_Base.h \
+ Acceptor_Filter.h \
+ Acceptor_Impl.cpp \
+ Acceptor_Impl.h \
+ Acceptor_Registry.h \
+ Acceptor_Registry.i \
+ Adapter.h \
+ Adapter_Factory.h \
+ Adapter_Registry.h \
+ Allocator.h \
+ AnyTypeCode_Adapter.h \
+ Any_Insert_Policy_T.h \
+ Arg_Traits_T.h \
+ Argument.h \
+ Array_Traits_T.h \
+ Array_VarOut_T.cpp \
+ Array_VarOut_T.h \
+ Array_VarOut_T.inl \
+ Asynch_Queued_Message.h \
+ Asynch_Reply_Dispatcher_Base.h \
+ Asynch_Reply_Dispatcher_Base.i \
+ Auto_Functor.h \
+ BD_String_Argument_T.cpp \
+ BD_String_Argument_T.h \
+ BD_String_Argument_T.inl \
+ Base_Transport_Property.h \
+ Base_Transport_Property.inl \
+ Basic_Argument_T.cpp \
+ Basic_Argument_T.h \
+ Basic_Argument_T.inl \
+ Basic_Arguments.h \
+ Basic_Types.h \
+ BiDir_Adapter.h \
+ Bind_Dispatcher_Guard.h \
+ Bind_Dispatcher_Guard.i \
+ Block_Flushing_Strategy.h \
+ Blocked_Connect_Strategy.h \
+ BooleanSeq.pidl \
+ BooleanSeqC.h \
+ BooleanSeqS.h \
+ Bounded_Array_Allocation_Traits_T.h \
+ Bounded_Array_Sequence_T.h \
+ Bounded_Basic_String_Sequence_T.h \
+ Bounded_Object_Reference_Sequence_T.h \
+ Bounded_Reference_Allocation_Traits_T.h \
+ Bounded_Sequence_CDR_T.h \
+ Bounded_String_Sequence_T.h \
+ Bounded_Value_Allocation_Traits_T.h \
+ Bounded_Value_Sequence_T.h \
+ Bounded_Wstring_Sequence_T.h \
+ Buffer_Allocator_T.cpp \
+ Buffer_Allocator_T.h \
+ Buffering_Constraint_Policy.h \
+ Buffering_Constraint_Policy.i \
+ CDR.h \
+ CDR.i \
+ CONV_FRAME.pidl \
+ CONV_FRAMEC.h \
+ CONV_FRAMES.h \
+ CORBALOC_Parser.h \
+ CORBALOC_Parser.i \
+ CORBANAME_Parser.h \
+ CORBA_String.h \
+ CORBA_String.inl \
+ CORBA_methods.h \
+ Cache_Entries.h \
+ Cache_Entries.inl \
+ CharSeq.pidl \
+ CharSeqC.h \
+ CharSeqS.h \
+ Cleanup_Func_Registry.h \
+ Cleanup_Func_Registry.inl \
+ ClientRequestInterceptor_Adapter.h \
+ ClientRequestInterceptor_Adapter_Factory.h \
+ Client_Strategy_Factory.h \
+ Codeset_Descriptor_Base.h \
+ Codeset_Manager.h \
+ Codeset_Manager_Factory_Base.h \
+ Codeset_Translator_Base.h \
+ Collocated_Invocation.h \
+ Collocation_Proxy_Broker.h \
+ Collocation_Resolver.h \
+ Collocation_Strategy.h \
+ Condition.cpp \
+ Condition.h \
+ Condition.inl \
+ Connect_Strategy.h \
+ Connection_Handler.h \
+ Connection_Handler.inl \
+ Connection_Purging_Strategy.h \
+ Connection_Purging_Strategy.inl \
+ Connector_Impl.cpp \
+ Connector_Impl.h \
+ Connector_Registry.h \
+ Connector_Registry.i \
+ Current.pidl \
+ CurrentC.h \
+ CurrentS.h \
+ DLL_Parser.h \
+ Default_Collocation_Resolver.h \
+ Default_Endpoint_Selector_Factory.h \
+ Default_Protocols_Hooks.h \
+ Default_Stub_Factory.h \
+ Default_Thread_Lane_Resources_Manager.h \
+ Domain.pidl \
+ DomainC.h \
+ DomainC.inl \
+ DoubleSeq.pidl \
+ DoubleSeqC.h \
+ DoubleSeqS.h \
+ Dynamic_Adapter.h \
+ Endpoint.h \
+ Endpoint.i \
+ Endpoint_Selector_Factory.h \
+ Environment.h \
+ Environment.i \
+ Exception.h \
+ Exception.i \
+ Exception_Data.h \
+ Exclusive_TMS.h \
+ FILE_Parser.h \
+ Fault_Tolerance_Service.h \
+ Fault_Tolerance_Service.i \
+ Fixed_Array_Argument_T.cpp \
+ Fixed_Array_Argument_T.h \
+ Fixed_Array_Argument_T.inl \
+ Fixed_Size_Argument_T.cpp \
+ Fixed_Size_Argument_T.h \
+ Fixed_Size_Argument_T.inl \
+ FloatSeq.pidl \
+ FloatSeqC.h \
+ FloatSeqS.h \
+ Flushing_Strategy.h \
+ GIOP.pidl \
+ GIOPC.h \
+ GIOPC.inl \
+ GIOPS.h \
+ GIOP_Fragmentation_Strategy.h \
+ GIOP_Message_Base.h \
+ GIOP_Message_Generator_Parser.h \
+ GIOP_Message_Generator_Parser_10.h \
+ GIOP_Message_Generator_Parser_11.h \
+ GIOP_Message_Generator_Parser_12.h \
+ GIOP_Message_Generator_Parser_Impl.h \
+ GIOP_Message_Generator_Parser_Impl.inl \
+ GIOP_Message_Lite.h \
+ GIOP_Message_Locate_Header.h \
+ GIOP_Message_Locate_Header.i \
+ GIOP_Message_State.h \
+ GIOP_Message_State.inl \
+ GIOP_Message_Version.h \
+ GIOP_Message_Version.inl \
+ GIOP_Utils.h \
+ GUIResource_Factory.h \
+ Generic_Sequence_T.h \
+ IFR_Client_Adapter.h \
+ IIOP.pidl \
+ IIOPC.h \
+ IIOP_Acceptor.h \
+ IIOP_Acceptor.i \
+ IIOP_Connection_Handler.h \
+ IIOP_Connector.h \
+ IIOP_Endpoint.h \
+ IIOP_Endpoint.i \
+ IIOP_Endpoints.pidl \
+ IIOP_EndpointsC.h \
+ IIOP_Factory.h \
+ IIOP_Lite_Factory.h \
+ IIOP_Profile.h \
+ IIOP_Transport.h \
+ IOP.pidl \
+ IOPC.h \
+ IOPS.h \
+ IOP_IOR.pidl \
+ IOP_IORC.h \
+ IORInterceptor_Adapter.h \
+ IORInterceptor_Adapter_Factory.h \
+ IOR_Parser.h \
+ Incoming_Message_Queue.h \
+ Incoming_Message_Queue.inl \
+ Incoming_Message_Stack.h \
+ Incoming_Message_Stack.inl \
+ InterfaceDef.pidl \
+ Intrusive_Ref_Count_Base_T.cpp \
+ Intrusive_Ref_Count_Base_T.h \
+ Intrusive_Ref_Count_Base_T.inl \
+ Intrusive_Ref_Count_Handle_T.cpp \
+ Intrusive_Ref_Count_Handle_T.h \
+ Intrusive_Ref_Count_Handle_T.inl \
+ InvalidName.pidl \
+ Invocation_Adapter.h \
+ Invocation_Adapter.inl \
+ Invocation_Base.h \
+ Invocation_Base.inl \
+ Invocation_Endpoint_Selectors.h \
+ Invocation_Utils.h \
+ LF_CH_Event.h \
+ LF_Connect_Strategy.h \
+ LF_Event.h \
+ LF_Event.inl \
+ LF_Event_Binder.h \
+ LF_Event_Binder.inl \
+ LF_Event_Loop_Thread_Helper.h \
+ LF_Event_Loop_Thread_Helper.inl \
+ LF_Follower.h \
+ LF_Follower.inl \
+ LF_Follower_Auto_Adder.h \
+ LF_Follower_Auto_Adder.inl \
+ LF_Follower_Auto_Ptr.h \
+ LF_Follower_Auto_Ptr.inl \
+ LF_Invocation_Event.h \
+ LF_Multi_Event.h \
+ LF_Strategy.h \
+ LF_Strategy_Complete.h \
+ LRU_Connection_Purging_Strategy.h \
+ Leader_Follower.h \
+ Leader_Follower.i \
+ Leader_Follower_Flushing_Strategy.h \
+ LocalObject.h \
+ LocalObject.i \
+ LocateRequest_Invocation.h \
+ LocateRequest_Invocation_Adapter.h \
+ LongDoubleSeq.pidl \
+ LongDoubleSeqC.h \
+ LongDoubleSeqS.h \
+ LongLongSeq.pidl \
+ LongLongSeqC.h \
+ LongLongSeqS.h \
+ LongSeq.pidl \
+ LongSeqC.h \
+ LongSeqS.h \
+ MCAST_Parser.h \
+ MCAST_Parser.i \
+ MMAP_Allocator.h \
+ MProfile.h \
+ MProfile.i \
+ Messaging_PolicyValue.pidl \
+ Messaging_PolicyValueC.h \
+ Messaging_SyncScope.pidl \
+ Messaging_SyncScopeC.h \
+ Muxed_TMS.h \
+ NVList_Adapter.h \
+ New_Leader_Generator.h \
+ Null_Fragmentation_Strategy.h \
+ ORB.h \
+ ORB.i \
+ ORBInitializer_Registry.h \
+ ORBInitializer_Registry_Adapter.h \
+ ORB_Constants.h \
+ ORB_Core.h \
+ ORB_Core.i \
+ ORB_Core_Auto_Ptr.h \
+ ORB_Core_Auto_Ptr.inl \
+ ORB_Core_TSS_Resources.h \
+ ORB_Table.h \
+ ORB_Table.inl \
+ Object.h \
+ Object.i \
+ ObjectIdList.pidl \
+ ObjectIdListC.h \
+ ObjectKey_Table.h \
+ Object_Argument_T.cpp \
+ Object_Argument_T.h \
+ Object_Argument_T.inl \
+ Object_Key.pidl \
+ Object_KeyC.h \
+ Object_Loader.h \
+ Object_Proxy_Broker.h \
+ Object_Ref_Table.h \
+ Object_Ref_Table.inl \
+ Object_Reference_Sequence_Element_T.h \
+ Object_Reference_Traits_Base_T.h \
+ Object_Reference_Traits_T.h \
+ Object_T.cpp \
+ Object_T.h \
+ Objref_VarOut_T.cpp \
+ Objref_VarOut_T.h \
+ OctetSeq.pidl \
+ OctetSeqC.h \
+ OctetSeqS.h \
+ On_Demand_Fragmentation_Strategy.h \
+ PI_Forward.pidl \
+ PI_ForwardC.h \
+ ParameterMode.pidl \
+ ParameterModeC.h \
+ ParameterModeS.h \
+ Parser_Registry.h \
+ Parser_Registry.i \
+ Pluggable_Messaging.h \
+ Pluggable_Messaging_Utils.h \
+ Pluggable_Messaging_Utils.i \
+ Policy.pidl \
+ PolicyC.h \
+ PolicyC.inl \
+ PolicyFactory_Registry_Adapter.h \
+ PolicyFactory_Registry_Factory.h \
+ PolicyS.h \
+ Policy_Current.h \
+ Policy_Current.inl \
+ Policy_Current_Impl.h \
+ Policy_Current_Impl.inl \
+ Policy_Forward.pidl \
+ Policy_ForwardC.h \
+ Policy_ForwardS.h \
+ Policy_Manager.h \
+ Policy_Manager.i \
+ Policy_Set.h \
+ Policy_Set.i \
+ Policy_Validator.h \
+ PortableInterceptor.h \
+ PortableInterceptor.pidl \
+ PortableInterceptorC.h \
+ PortableInterceptorS.h \
+ Principal.h \
+ Principal.i \
+ Profile.h \
+ Profile.i \
+ Profile_Transport_Resolver.h \
+ Profile_Transport_Resolver.inl \
+ Protocol_Factory.h \
+ Protocols_Hooks.h \
+ Pseudo_VarOut_T.cpp \
+ Pseudo_VarOut_T.h \
+ Pseudo_VarOut_T.inl \
+ Queued_Message.h \
+ Range_Checking_T.h \
+ Reactive_Connect_Strategy.h \
+ Reactive_Flushing_Strategy.h \
+ Refcounted_ObjectKey.h \
+ Refcounted_ObjectKey.inl \
+ Remote_Invocation.h \
+ Remote_Object_Proxy_Broker.h \
+ Reply_Dispatcher.h \
+ Reply_Dispatcher.i \
+ Request_Dispatcher.h \
+ Resource_Factory.h \
+ Resume_Handle.h \
+ Resume_Handle.inl \
+ Seq_Out_T.cpp \
+ Seq_Out_T.h \
+ Seq_Out_T.inl \
+ Seq_Var_T.cpp \
+ Seq_Var_T.h \
+ Seq_Var_T.inl \
+ Sequence_T.h \
+ ServerRequestInterceptor_Adapter.h \
+ ServerRequestInterceptor_Adapter_Factory.h \
+ Server_Strategy_Factory.h \
+ Service_Callbacks.h \
+ Service_Context.h \
+ Service_Context.inl \
+ Services.pidl \
+ ServicesC.h \
+ ServicesS.h \
+ Services_Activate.h \
+ ShortSeq.pidl \
+ ShortSeqC.h \
+ ShortSeqS.h \
+ Special_Basic_Argument_T.cpp \
+ Special_Basic_Argument_T.h \
+ Special_Basic_Argument_T.inl \
+ Special_Basic_Arguments.h \
+ StringSeq.pidl \
+ StringSeqC.h \
+ StringSeqS.h \
+ String_Alloc.h \
+ String_Manager_T.h \
+ String_Sequence_Element_T.h \
+ String_Traits_Base_T.h \
+ String_Traits_T.h \
+ Stub.h \
+ Stub.i \
+ Stub_Factory.h \
+ Synch_Invocation.h \
+ Synch_Invocation.inl \
+ Synch_Queued_Message.h \
+ Synch_Reply_Dispatcher.h \
+ SystemException.h \
+ SystemException.inl \
+ TAO.pidl \
+ TAOC.h \
+ TAOS.h \
+ TAO_Export.h \
+ TAO_Internal.h \
+ TAO_Server_Request.h \
+ TAO_Server_Request.i \
+ TAO_Singleton.cpp \
+ TAO_Singleton.h \
+ TAO_Singleton.inl \
+ TAO_Singleton_Manager.h \
+ TAO_Singleton_Manager.inl \
+ TSS_Resources.h \
+ Tagged_Components.h \
+ Tagged_Components.i \
+ Tagged_Profile.h \
+ Tagged_Profile.i \
+ Thread_Lane_Resources.h \
+ Thread_Lane_Resources_Manager.h \
+ Thread_Per_Connection_Handler.h \
+ TimeBase.pidl \
+ TimeBaseC.h \
+ TimeBaseS.h \
+ Timeprobe.h \
+ Transport.h \
+ Transport.inl \
+ Transport_Acceptor.h \
+ Transport_Acceptor.inl \
+ Transport_Cache_Manager.h \
+ Transport_Cache_Manager.inl \
+ Transport_Connector.h \
+ Transport_Connector.inl \
+ Transport_Descriptor_Interface.h \
+ Transport_Descriptor_Interface.inl \
+ Transport_Mux_Strategy.h \
+ Transport_Queueing_Strategies.h \
+ Transport_Timer.h \
+ TypeCodeFactory_Adapter.h \
+ Typecode_types.pidl \
+ Typecode_typesC.h \
+ Typecode_typesS.h \
+ UB_String_Argument_T.cpp \
+ UB_String_Argument_T.h \
+ UB_String_Argument_T.inl \
+ UB_String_Arguments.h \
+ ULongLongSeq.pidl \
+ ULongLongSeqC.h \
+ ULongLongSeqS.h \
+ ULongSeq.pidl \
+ ULongSeqC.h \
+ ULongSeqS.h \
+ UShortSeq.pidl \
+ UShortSeqC.h \
+ UShortSeqS.h \
+ Unbounded_Array_Allocation_Traits_T.h \
+ Unbounded_Array_Sequence_T.h \
+ Unbounded_Basic_String_Sequence_T.h \
+ Unbounded_Object_Reference_Sequence_T.h \
+ Unbounded_Octet_Sequence_T.h \
+ Unbounded_Reference_Allocation_Traits_T.h \
+ Unbounded_Sequence_CDR_T.h \
+ Unbounded_String_Sequence_T.h \
+ Unbounded_Value_Allocation_Traits_T.h \
+ Unbounded_Value_Sequence_T.h \
+ Unbounded_Wstring_Sequence_T.h \
+ UserException.h \
+ UserException.inl \
+ Value_Traits_T.h \
+ Valuetype_Adapter.h \
+ Valuetype_Adapter_Factory.h \
+ VarOut_T.cpp \
+ VarOut_T.h \
+ VarOut_T.inl \
+ Var_Array_Argument_T.cpp \
+ Var_Array_Argument_T.h \
+ Var_Array_Argument_T.inl \
+ Var_Size_Argument_T.cpp \
+ Var_Size_Argument_T.h \
+ Var_Size_Argument_T.inl \
+ Version.h \
+ Versioned_Namespace.h \
+ WCharSeq.pidl \
+ WCharSeqC.h \
+ WCharSeqS.h \
+ WStringSeq.pidl \
+ WStringSeqC.h \
+ WStringSeqS.h \
+ Wait_On_LF_No_Upcall.h \
+ Wait_On_Leader_Follower.h \
+ Wait_On_Reactor.h \
+ Wait_On_Read.h \
+ Wait_Strategy.h \
+ Wait_Strategy.inl \
+ WrongTransaction.pidl \
+ WrongTransactionC.h \
+ WrongTransactionS.h \
+ corba.h \
+ corbafwd.h \
+ debug.h \
+ default_client.h \
+ default_environment.h \
+ default_ports.h \
+ default_resource.h \
+ default_server.h \
+ objectid.h \
+ operation_details.h \
+ operation_details.i \
+ orb.idl \
+ orb_types.pidl \
+ orb_typesC.h \
+ orb_typesS.h \
+ orbconf.h \
+ params.h \
+ params.i \
+ target_specification.h \
+ target_specification.i \
+ varbase.h
+
+pkgconfig_DATA = \
+ TAO.pc
+
+CLEANFILES = \
+ TAO.pc
+
+TAO.pc: ${top_builddir}/config.status ${srcdir}/TAO.pc.in
+ ${top_builddir}/config.status --file $@:${srcdir}/TAO.pc.in
+
+EXTRA_DIST = \
+ TAO.pc.in \
+ tao.rc
+
+
+## Makefile.Codeset.am
+
+lib_LTLIBRARIES += libTAO_Codeset.la
+
+libTAO_Codeset_la_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR) \
+ -I$(TAO_ROOT) \
+ -I$(TAO_BUILDDIR) \
+ -DTAO_CODESET_BUILD_DLL
+
+libTAO_Codeset_la_SOURCES = \
+ Codeset/Codeset.cpp \
+ Codeset/Codeset_Descriptor.cpp \
+ Codeset/Codeset_Manager_Factory.cpp \
+ Codeset/Codeset_Manager_i.cpp \
+ Codeset/Codeset_Translator_Factory.cpp \
+ Codeset/UTF16_BOM_Factory.cpp \
+ Codeset/UTF16_BOM_Translator.cpp \
+ Codeset/UTF8_Latin1_Factory.cpp \
+ Codeset/UTF8_Latin1_Translator.cpp
+
+libTAO_Codeset_la_LDFLAGS = \
+ -version-number @TAO_MAJOR@:@TAO_MINOR@:@TAO_BETA@
+
+libTAO_Codeset_la_LIBADD = \
+ libTAO.la \
+ $(ACE_BUILDDIR)/ace/libACE.la
+
+nobase_include_HEADERS += \
+ Codeset/Codeset.h \
+ Codeset/Codeset_Descriptor.h \
+ Codeset/Codeset_Manager_Factory.h \
+ Codeset/Codeset_Manager_i.h \
+ Codeset/Codeset_Translator_Factory.h \
+ Codeset/Codeset_Translator_Factory_T.cpp \
+ Codeset/Codeset_Translator_Factory_T.h \
+ Codeset/UTF16_BOM_Factory.h \
+ Codeset/UTF16_BOM_Translator.h \
+ Codeset/UTF8_Latin1_Factory.h \
+ Codeset/UTF8_Latin1_Translator.h \
+ Codeset/codeset_export.h
+
+## Makefile.AnyTypeCode.am
+
+lib_LTLIBRARIES += libTAO_AnyTypeCode.la
+
+libTAO_AnyTypeCode_la_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR) \
+ -I$(TAO_ROOT) \
+ -I$(TAO_BUILDDIR) \
+ -DTAO_ANYTYPECODE_BUILD_DLL
+
+libTAO_AnyTypeCode_la_SOURCES = \
+ AnyTypeCode/Alias_TypeCode_Static.cpp \
+ AnyTypeCode/Any.cpp \
+ AnyTypeCode/AnySeqA.cpp \
+ AnyTypeCode/AnySeqC.cpp \
+ AnyTypeCode/AnyTypeCode_Adapter_Impl.cpp \
+ AnyTypeCode/Any_Basic_Impl.cpp \
+ AnyTypeCode/Any_Impl.cpp \
+ AnyTypeCode/Any_SystemException.cpp \
+ AnyTypeCode/Any_Unknown_IDL_Type.cpp \
+ AnyTypeCode/BooleanSeqA.cpp \
+ AnyTypeCode/BoundsA.cpp \
+ AnyTypeCode/BoundsC.cpp \
+ AnyTypeCode/CONV_FRAMEA.cpp \
+ AnyTypeCode/CharSeqA.cpp \
+ AnyTypeCode/CurrentA.cpp \
+ AnyTypeCode/DoubleSeqA.cpp \
+ AnyTypeCode/DynamicA.cpp \
+ AnyTypeCode/DynamicC.cpp \
+ AnyTypeCode/Dynamic_ParameterA.cpp \
+ AnyTypeCode/Dynamic_ParameterC.cpp \
+ AnyTypeCode/Empty_Param_TypeCode.cpp \
+ AnyTypeCode/Enum_TypeCode_Static.cpp \
+ AnyTypeCode/ExceptionA.cpp \
+ AnyTypeCode/FloatSeqA.cpp \
+ AnyTypeCode/GIOPA.cpp \
+ AnyTypeCode/IIOPA.cpp \
+ AnyTypeCode/IIOP_EndpointsA.cpp \
+ AnyTypeCode/IOP_IORA.cpp \
+ AnyTypeCode/LongDoubleSeqA.cpp \
+ AnyTypeCode/LongLongSeqA.cpp \
+ AnyTypeCode/LongSeqA.cpp \
+ AnyTypeCode/Marshal.cpp \
+ AnyTypeCode/Messaging_PolicyValueA.cpp \
+ AnyTypeCode/NVList.cpp \
+ AnyTypeCode/NVList_Adapter_Impl.cpp \
+ AnyTypeCode/ObjectIdListA.cpp \
+ AnyTypeCode/Objref_TypeCode_Static.cpp \
+ AnyTypeCode/OctetSeqA.cpp \
+ AnyTypeCode/PI_ForwardA.cpp \
+ AnyTypeCode/ParameterModeA.cpp \
+ AnyTypeCode/PolicyA.cpp \
+ AnyTypeCode/Policy_ForwardA.cpp \
+ AnyTypeCode/PortableInterceptorA.cpp \
+ AnyTypeCode/Sequence_TypeCode_Static.cpp \
+ AnyTypeCode/ServicesA.cpp \
+ AnyTypeCode/ShortSeqA.cpp \
+ AnyTypeCode/StringSeqA.cpp \
+ AnyTypeCode/String_TypeCode_Static.cpp \
+ AnyTypeCode/Struct_TypeCode_Static.cpp \
+ AnyTypeCode/SystemExceptionA.cpp \
+ AnyTypeCode/TAOA.cpp \
+ AnyTypeCode/TimeBaseA.cpp \
+ AnyTypeCode/True_RefCount_Policy.cpp \
+ AnyTypeCode/TypeCode.cpp \
+ AnyTypeCode/TypeCodeA.cpp \
+ AnyTypeCode/TypeCode_CDR_Extraction.cpp \
+ AnyTypeCode/TypeCode_Constants.cpp \
+ AnyTypeCode/ULongLongSeqA.cpp \
+ AnyTypeCode/ULongSeqA.cpp \
+ AnyTypeCode/UShortSeqA.cpp \
+ AnyTypeCode/Union_TypeCode_Static.cpp \
+ AnyTypeCode/ValueModifierA.cpp \
+ AnyTypeCode/ValueModifierC.cpp \
+ AnyTypeCode/Value_TypeCode_Static.cpp \
+ AnyTypeCode/VisibilityA.cpp \
+ AnyTypeCode/VisibilityC.cpp \
+ AnyTypeCode/WCharSeqA.cpp \
+ AnyTypeCode/WStringSeqA.cpp \
+ AnyTypeCode/WrongTransactionA.cpp \
+ AnyTypeCode/append.cpp \
+ AnyTypeCode/orb_typesA.cpp \
+ AnyTypeCode/skip.cpp
+
+libTAO_AnyTypeCode_la_LDFLAGS = \
+ -version-number @TAO_MAJOR@:@TAO_MINOR@:@TAO_BETA@
+
+libTAO_AnyTypeCode_la_LIBADD = \
+ libTAO.la \
+ $(ACE_BUILDDIR)/ace/libACE.la
+
+nobase_include_HEADERS += \
+ AnyTypeCode/Alias_TypeCode.cpp \
+ AnyTypeCode/Alias_TypeCode.h \
+ AnyTypeCode/Alias_TypeCode.inl \
+ AnyTypeCode/Alias_TypeCode_Static.h \
+ AnyTypeCode/Alias_TypeCode_Static.inl \
+ AnyTypeCode/Any.h \
+ AnyTypeCode/Any.inl \
+ AnyTypeCode/AnySeqA.h \
+ AnyTypeCode/AnySeqC.h \
+ AnyTypeCode/AnySeqS.h \
+ AnyTypeCode/AnyTypeCode_Adapter_Impl.h \
+ AnyTypeCode/AnyTypeCode_methods.h \
+ AnyTypeCode/Any_Arg_Traits.h \
+ AnyTypeCode/Any_Array_Impl_T.cpp \
+ AnyTypeCode/Any_Array_Impl_T.h \
+ AnyTypeCode/Any_Array_Impl_T.inl \
+ AnyTypeCode/Any_Basic_Impl.h \
+ AnyTypeCode/Any_Basic_Impl_T.cpp \
+ AnyTypeCode/Any_Basic_Impl_T.h \
+ AnyTypeCode/Any_Basic_Impl_T.inl \
+ AnyTypeCode/Any_Dual_Impl_T.cpp \
+ AnyTypeCode/Any_Dual_Impl_T.h \
+ AnyTypeCode/Any_Dual_Impl_T.inl \
+ AnyTypeCode/Any_Impl.h \
+ AnyTypeCode/Any_Impl_T.cpp \
+ AnyTypeCode/Any_Impl_T.h \
+ AnyTypeCode/Any_Impl_T.inl \
+ AnyTypeCode/Any_Special_Impl_T.cpp \
+ AnyTypeCode/Any_Special_Impl_T.h \
+ AnyTypeCode/Any_Special_Impl_T.inl \
+ AnyTypeCode/Any_SystemException.h \
+ AnyTypeCode/Any_Unknown_IDL_Type.h \
+ AnyTypeCode/BooleanSeqA.h \
+ AnyTypeCode/BoundsA.h \
+ AnyTypeCode/BoundsC.h \
+ AnyTypeCode/CONV_FRAMEA.h \
+ AnyTypeCode/CharSeqA.h \
+ AnyTypeCode/CurrentA.h \
+ AnyTypeCode/DomainA.h \
+ AnyTypeCode/DoubleSeqA.h \
+ AnyTypeCode/DynamicA.h \
+ AnyTypeCode/DynamicC.h \
+ AnyTypeCode/DynamicS.h \
+ AnyTypeCode/Dynamic_ParameterA.h \
+ AnyTypeCode/Dynamic_ParameterC.h \
+ AnyTypeCode/Empty_Param_TypeCode.h \
+ AnyTypeCode/Empty_Param_TypeCode.inl \
+ AnyTypeCode/Enum_TypeCode.cpp \
+ AnyTypeCode/Enum_TypeCode.h \
+ AnyTypeCode/Enum_TypeCode.inl \
+ AnyTypeCode/Enum_TypeCode_Static.h \
+ AnyTypeCode/Enum_TypeCode_Static.inl \
+ AnyTypeCode/ExceptionA.h \
+ AnyTypeCode/Fixed_TypeCode.cpp \
+ AnyTypeCode/Fixed_TypeCode.h \
+ AnyTypeCode/Fixed_TypeCode.inl \
+ AnyTypeCode/FloatSeqA.h \
+ AnyTypeCode/GIOPA.h \
+ AnyTypeCode/IIOPA.h \
+ AnyTypeCode/IIOP_EndpointsA.h \
+ AnyTypeCode/IOPA.h \
+ AnyTypeCode/IOP_IORA.h \
+ AnyTypeCode/LongDoubleSeqA.h \
+ AnyTypeCode/LongLongSeqA.h \
+ AnyTypeCode/LongSeqA.h \
+ AnyTypeCode/Marshal.h \
+ AnyTypeCode/Marshal.inl \
+ AnyTypeCode/Messaging_PolicyValueA.h \
+ AnyTypeCode/Messaging_SyncScopeA.h \
+ AnyTypeCode/NVList.h \
+ AnyTypeCode/NVList.inl \
+ AnyTypeCode/NVList_Adapter_Impl.h \
+ AnyTypeCode/Null_RefCount_Policy.h \
+ AnyTypeCode/ObjectIdListA.h \
+ AnyTypeCode/Objref_TypeCode.cpp \
+ AnyTypeCode/Objref_TypeCode.h \
+ AnyTypeCode/Objref_TypeCode.inl \
+ AnyTypeCode/Objref_TypeCode_Static.h \
+ AnyTypeCode/Objref_TypeCode_Static.inl \
+ AnyTypeCode/OctetSeqA.h \
+ AnyTypeCode/PI_ForwardA.h \
+ AnyTypeCode/ParameterModeA.h \
+ AnyTypeCode/PolicyA.h \
+ AnyTypeCode/Policy_ForwardA.h \
+ AnyTypeCode/PortableInterceptorA.h \
+ AnyTypeCode/Recursive_Type_TypeCode.cpp \
+ AnyTypeCode/Recursive_Type_TypeCode.h \
+ AnyTypeCode/Recursive_Type_TypeCode.inl \
+ AnyTypeCode/RefCount_Policy_Traits.h \
+ AnyTypeCode/Sequence_TypeCode.cpp \
+ AnyTypeCode/Sequence_TypeCode.h \
+ AnyTypeCode/Sequence_TypeCode.inl \
+ AnyTypeCode/Sequence_TypeCode_Static.h \
+ AnyTypeCode/Sequence_TypeCode_Static.inl \
+ AnyTypeCode/ServicesA.h \
+ AnyTypeCode/ShortSeqA.h \
+ AnyTypeCode/StringSeqA.h \
+ AnyTypeCode/String_TypeCode.cpp \
+ AnyTypeCode/String_TypeCode.h \
+ AnyTypeCode/String_TypeCode.inl \
+ AnyTypeCode/String_TypeCode_Static.h \
+ AnyTypeCode/String_TypeCode_Static.inl \
+ AnyTypeCode/String_TypeCode_Traits.h \
+ AnyTypeCode/Struct_TypeCode.cpp \
+ AnyTypeCode/Struct_TypeCode.h \
+ AnyTypeCode/Struct_TypeCode.inl \
+ AnyTypeCode/Struct_TypeCode_Static.h \
+ AnyTypeCode/Struct_TypeCode_Static.inl \
+ AnyTypeCode/SystemExceptionA.h \
+ AnyTypeCode/TAOA.h \
+ AnyTypeCode/TAO_AnyTypeCode_Export.h \
+ AnyTypeCode/TC_Constants_Forward.h \
+ AnyTypeCode/TimeBaseA.h \
+ AnyTypeCode/True_RefCount_Policy.h \
+ AnyTypeCode/True_RefCount_Policy.inl \
+ AnyTypeCode/TypeCode.h \
+ AnyTypeCode/TypeCode.inl \
+ AnyTypeCode/TypeCode_Base_Attributes.cpp \
+ AnyTypeCode/TypeCode_Base_Attributes.h \
+ AnyTypeCode/TypeCode_Base_Attributes.inl \
+ AnyTypeCode/TypeCode_CDR_Extraction.h \
+ AnyTypeCode/TypeCode_Case_Base_T.cpp \
+ AnyTypeCode/TypeCode_Case_Base_T.h \
+ AnyTypeCode/TypeCode_Case_Base_T.inl \
+ AnyTypeCode/TypeCode_Case_T.cpp \
+ AnyTypeCode/TypeCode_Case_T.h \
+ AnyTypeCode/TypeCode_Case_T.inl \
+ AnyTypeCode/TypeCode_Constants.h \
+ AnyTypeCode/TypeCode_Struct_Field.h \
+ AnyTypeCode/TypeCode_Traits.h \
+ AnyTypeCode/TypeCode_Value_Field.h \
+ AnyTypeCode/Typecode_typesA.h \
+ AnyTypeCode/ULongLongSeqA.h \
+ AnyTypeCode/ULongSeqA.h \
+ AnyTypeCode/UShortSeqA.h \
+ AnyTypeCode/Union_TypeCode.cpp \
+ AnyTypeCode/Union_TypeCode.h \
+ AnyTypeCode/Union_TypeCode.inl \
+ AnyTypeCode/Union_TypeCode_Static.h \
+ AnyTypeCode/Union_TypeCode_Static.inl \
+ AnyTypeCode/ValueModifierA.h \
+ AnyTypeCode/ValueModifierC.h \
+ AnyTypeCode/ValueModifierS.h \
+ AnyTypeCode/Value_TypeCode.cpp \
+ AnyTypeCode/Value_TypeCode.h \
+ AnyTypeCode/Value_TypeCode.inl \
+ AnyTypeCode/Value_TypeCode_Static.h \
+ AnyTypeCode/Value_TypeCode_Static.inl \
+ AnyTypeCode/VisibilityA.h \
+ AnyTypeCode/VisibilityC.h \
+ AnyTypeCode/VisibilityS.h \
+ AnyTypeCode/WCharSeqA.h \
+ AnyTypeCode/WStringSeqA.h \
+ AnyTypeCode/WrongTransactionA.h \
+ AnyTypeCode/orb_typesA.h
+
+pkgconfig_DATA += \
+ TAO_AnyTypeCode.pc
+
+CLEANFILES += \
+ TAO_AnyTypeCode.pc
+
+TAO_AnyTypeCode.pc: ${top_builddir}/config.status ${srcdir}/AnyTypeCode/TAO_AnyTypeCode.pc.in
+ ${top_builddir}/config.status --file $@:${srcdir}/AnyTypeCode/TAO_AnyTypeCode.pc.in
+
+EXTRA_DIST += \
+ AnyTypeCode/TAO_AnyTypeCode.pc.in
+
+
+## Makefile.CodecFactory.am
+
+lib_LTLIBRARIES += libTAO_CodecFactory.la
+
+libTAO_CodecFactory_la_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR) \
+ -I$(TAO_ROOT) \
+ -I$(TAO_BUILDDIR) \
+ -DTAO_CODECFACTORY_BUILD_DLL
+
+libTAO_CodecFactory_la_SOURCES = \
+ CodecFactory/CDR_Encaps_Codec.cpp \
+ CodecFactory/CodecFactory.cpp \
+ CodecFactory/CodecFactory_impl.cpp \
+ CodecFactory/IOP_CodecC.cpp
+
+libTAO_CodecFactory_la_LDFLAGS = \
+ -version-number @TAO_MAJOR@:@TAO_MINOR@:@TAO_BETA@
+
+libTAO_CodecFactory_la_LIBADD = \
+ libTAO_AnyTypeCode.la \
+ libTAO.la \
+ $(ACE_BUILDDIR)/ace/libACE.la
+
+nobase_include_HEADERS += \
+ CodecFactory/CDR_Encaps_Codec.h \
+ CodecFactory/CodecFactory.h \
+ CodecFactory/CodecFactory_impl.h \
+ CodecFactory/IOP_Codec.pidl \
+ CodecFactory/IOP_CodecC.h \
+ CodecFactory/IOP_CodecS.h \
+ CodecFactory/IOP_Codec_include.pidl \
+ CodecFactory/IOP_Codec_includeA.h \
+ CodecFactory/IOP_Codec_includeC.h \
+ CodecFactory/IOP_Codec_includeS.h \
+ CodecFactory/codecfactory_export.h
+
+pkgconfig_DATA += \
+ TAO_CodecFactory.pc
+
+CLEANFILES += \
+ TAO_CodecFactory.pc
+
+TAO_CodecFactory.pc: ${top_builddir}/config.status ${srcdir}/CodecFactory/TAO_CodecFactory.pc.in
+ ${top_builddir}/config.status --file $@:${srcdir}/CodecFactory/TAO_CodecFactory.pc.in
+
+EXTRA_DIST += \
+ CodecFactory/TAO_CodecFactory.pc.in \
+ CodecFactory/TAO_CodecFactory.rc
+
+
+## Makefile.PI.am
+
+BUILT_SOURCES = \
+ PI/ORBInitInfoC.cpp \
+ PI/ORBInitInfoC.h
+
+CLEANFILES += \
+ PI/ORBInitInfo-stamp \
+ PI/ORBInitInfoC.cpp \
+ PI/ORBInitInfoC.h
+
+PI/ORBInitInfoC.cpp PI/ORBInitInfoC.h: PI/ORBInitInfo-stamp
+
+PI/ORBInitInfo-stamp: $(srcdir)/PI/ORBInitInfo.pidl $(TAO_IDL_DEP)
+ $(TAO_IDL) $(TAO_IDLFLAGS) -Wb,versioning_begin=TAO_BEGIN_VERSIONED_NAMESPACE_DECL -Wb,versioning_end=TAO_END_VERSIONED_NAMESPACE_DECL -Sci -SS -Gp -Gd -Ge 1 -Sc -Sorb -Sal -Wb,export_macro=TAO_PI_Export -Wb,export_include=tao/PI/pi_export.h -o PI $(srcdir)/PI/ORBInitInfo.pidl
+ @touch $@
+
+BUILT_SOURCES += \
+ PI/ORBInitializerA.cpp \
+ PI/ORBInitializerA.h \
+ PI/ORBInitializerC.cpp \
+ PI/ORBInitializerC.h
+
+CLEANFILES += \
+ PI/ORBInitializer-stamp \
+ PI/ORBInitializerA.cpp \
+ PI/ORBInitializerA.h \
+ PI/ORBInitializerC.cpp \
+ PI/ORBInitializerC.h
+
+PI/ORBInitializerA.cpp PI/ORBInitializerA.h PI/ORBInitializerC.cpp PI/ORBInitializerC.h: PI/ORBInitializer-stamp
+
+PI/ORBInitializer-stamp: $(srcdir)/PI/ORBInitializer.pidl $(TAO_IDL_DEP)
+ $(TAO_IDL) $(TAO_IDLFLAGS) -Wb,versioning_begin=TAO_BEGIN_VERSIONED_NAMESPACE_DECL -Wb,versioning_end=TAO_END_VERSIONED_NAMESPACE_DECL -Sci -SS -GA -Gp -Gd -Ge 1 -Sc -Sorb -Sal -Wb,export_macro=TAO_PI_Export -Wb,export_include=tao/PI/pi_export.h -o PI $(srcdir)/PI/ORBInitializer.pidl
+ @touch $@
+
+BUILT_SOURCES += \
+ PI/ClientRequestInterceptorA.cpp \
+ PI/ClientRequestInterceptorA.h \
+ PI/ClientRequestInterceptorC.cpp \
+ PI/ClientRequestInterceptorC.h
+
+CLEANFILES += \
+ PI/ClientRequestInterceptor-stamp \
+ PI/ClientRequestInterceptorA.cpp \
+ PI/ClientRequestInterceptorA.h \
+ PI/ClientRequestInterceptorC.cpp \
+ PI/ClientRequestInterceptorC.h
+
+PI/ClientRequestInterceptorA.cpp PI/ClientRequestInterceptorA.h PI/ClientRequestInterceptorC.cpp PI/ClientRequestInterceptorC.h: PI/ClientRequestInterceptor-stamp
+
+PI/ClientRequestInterceptor-stamp: $(srcdir)/PI/ClientRequestInterceptor.pidl $(TAO_IDL_DEP)
+ $(TAO_IDL) $(TAO_IDLFLAGS) -Wb,versioning_begin=TAO_BEGIN_VERSIONED_NAMESPACE_DECL -Wb,versioning_end=TAO_END_VERSIONED_NAMESPACE_DECL -Sci -SS -GA -Gp -Gd -Ge 1 -Sc -Sorb -Sal -Wb,export_macro=TAO_PI_Export -Wb,export_include=tao/PI/pi_export.h -o PI $(srcdir)/PI/ClientRequestInterceptor.pidl
+ @touch $@
+
+BUILT_SOURCES += \
+ PI/InterceptorA.cpp \
+ PI/InterceptorA.h \
+ PI/InterceptorC.cpp \
+ PI/InterceptorC.h
+
+CLEANFILES += \
+ PI/Interceptor-stamp \
+ PI/InterceptorA.cpp \
+ PI/InterceptorA.h \
+ PI/InterceptorC.cpp \
+ PI/InterceptorC.h
+
+PI/InterceptorA.cpp PI/InterceptorA.h PI/InterceptorC.cpp PI/InterceptorC.h: PI/Interceptor-stamp
+
+PI/Interceptor-stamp: $(srcdir)/PI/Interceptor.pidl $(TAO_IDL_DEP)
+ $(TAO_IDL) $(TAO_IDLFLAGS) -Wb,versioning_begin=TAO_BEGIN_VERSIONED_NAMESPACE_DECL -Wb,versioning_end=TAO_END_VERSIONED_NAMESPACE_DECL -Sci -SS -GA -Gp -Gd -Ge 1 -Sc -Sorb -Sal -Wb,export_macro=TAO_PI_Export -Wb,export_include=tao/PI/pi_export.h -o PI $(srcdir)/PI/Interceptor.pidl
+ @touch $@
+
+BUILT_SOURCES += \
+ PI/ClientRequestInfoA.cpp \
+ PI/ClientRequestInfoA.h \
+ PI/ClientRequestInfoC.cpp \
+ PI/ClientRequestInfoC.h
+
+CLEANFILES += \
+ PI/ClientRequestInfo-stamp \
+ PI/ClientRequestInfoA.cpp \
+ PI/ClientRequestInfoA.h \
+ PI/ClientRequestInfoC.cpp \
+ PI/ClientRequestInfoC.h
+
+PI/ClientRequestInfoA.cpp PI/ClientRequestInfoA.h PI/ClientRequestInfoC.cpp PI/ClientRequestInfoC.h: PI/ClientRequestInfo-stamp
+
+PI/ClientRequestInfo-stamp: $(srcdir)/PI/ClientRequestInfo.pidl $(TAO_IDL_DEP)
+ $(TAO_IDL) $(TAO_IDLFLAGS) -Wb,versioning_begin=TAO_BEGIN_VERSIONED_NAMESPACE_DECL -Wb,versioning_end=TAO_END_VERSIONED_NAMESPACE_DECL -Sci -SS -GA -Gp -Gd -Ge 1 -Sc -Sorb -Sal -Wb,export_macro=TAO_PI_Export -Wb,export_include=tao/PI/pi_export.h -o PI $(srcdir)/PI/ClientRequestInfo.pidl
+ @touch $@
+
+BUILT_SOURCES += \
+ PI/RequestInfoA.cpp \
+ PI/RequestInfoA.h \
+ PI/RequestInfoC.cpp \
+ PI/RequestInfoC.h
+
+CLEANFILES += \
+ PI/RequestInfo-stamp \
+ PI/RequestInfoA.cpp \
+ PI/RequestInfoA.h \
+ PI/RequestInfoC.cpp \
+ PI/RequestInfoC.h
+
+PI/RequestInfoA.cpp PI/RequestInfoA.h PI/RequestInfoC.cpp PI/RequestInfoC.h: PI/RequestInfo-stamp
+
+PI/RequestInfo-stamp: $(srcdir)/PI/RequestInfo.pidl $(TAO_IDL_DEP)
+ $(TAO_IDL) $(TAO_IDLFLAGS) -Wb,versioning_begin=TAO_BEGIN_VERSIONED_NAMESPACE_DECL -Wb,versioning_end=TAO_END_VERSIONED_NAMESPACE_DECL -Sci -SS -GA -Gp -Gd -Ge 1 -Sc -Sorb -Sal -Wb,export_macro=TAO_PI_Export -Wb,export_include=tao/PI/pi_export.h -o PI $(srcdir)/PI/RequestInfo.pidl
+ @touch $@
+
+BUILT_SOURCES += \
+ PI/PIForwardRequestA.cpp \
+ PI/PIForwardRequestA.h \
+ PI/PIForwardRequestC.cpp \
+ PI/PIForwardRequestC.h
+
+CLEANFILES += \
+ PI/PIForwardRequest-stamp \
+ PI/PIForwardRequestA.cpp \
+ PI/PIForwardRequestA.h \
+ PI/PIForwardRequestC.cpp \
+ PI/PIForwardRequestC.h
+
+PI/PIForwardRequestA.cpp PI/PIForwardRequestA.h PI/PIForwardRequestC.cpp PI/PIForwardRequestC.h: PI/PIForwardRequest-stamp
+
+PI/PIForwardRequest-stamp: $(srcdir)/PI/PIForwardRequest.pidl $(TAO_IDL_DEP)
+ $(TAO_IDL) $(TAO_IDLFLAGS) -Wb,versioning_begin=TAO_BEGIN_VERSIONED_NAMESPACE_DECL -Wb,versioning_end=TAO_END_VERSIONED_NAMESPACE_DECL -Sci -SS -GA -Gp -Gd -Ge 1 -Sc -Sorb -Sal -Wb,export_macro=TAO_PI_Export -Wb,export_include=tao/PI/pi_export.h -o PI $(srcdir)/PI/PIForwardRequest.pidl
+ @touch $@
+
+BUILT_SOURCES += \
+ PI/PICurrentA.cpp \
+ PI/PICurrentA.h \
+ PI/PICurrentC.cpp \
+ PI/PICurrentC.h
+
+CLEANFILES += \
+ PI/PICurrent-stamp \
+ PI/PICurrentA.cpp \
+ PI/PICurrentA.h \
+ PI/PICurrentC.cpp \
+ PI/PICurrentC.h
+
+PI/PICurrentA.cpp PI/PICurrentA.h PI/PICurrentC.cpp PI/PICurrentC.h: PI/PICurrent-stamp
+
+PI/PICurrent-stamp: $(srcdir)/PI/PICurrent.pidl $(TAO_IDL_DEP)
+ $(TAO_IDL) $(TAO_IDLFLAGS) -Wb,versioning_begin=TAO_BEGIN_VERSIONED_NAMESPACE_DECL -Wb,versioning_end=TAO_END_VERSIONED_NAMESPACE_DECL -Sci -SS -GA -Gp -Gd -Ge 1 -Sc -Sorb -Sal -Wb,export_macro=TAO_PI_Export -Wb,export_include=tao/PI/pi_export.h -o PI $(srcdir)/PI/PICurrent.pidl
+ @touch $@
+
+BUILT_SOURCES += \
+ PI/ProcessingModePolicyA.cpp \
+ PI/ProcessingModePolicyA.h \
+ PI/ProcessingModePolicyC.cpp \
+ PI/ProcessingModePolicyC.h
+
+CLEANFILES += \
+ PI/ProcessingModePolicy-stamp \
+ PI/ProcessingModePolicyA.cpp \
+ PI/ProcessingModePolicyA.h \
+ PI/ProcessingModePolicyC.cpp \
+ PI/ProcessingModePolicyC.h
+
+PI/ProcessingModePolicyA.cpp PI/ProcessingModePolicyA.h PI/ProcessingModePolicyC.cpp PI/ProcessingModePolicyC.h: PI/ProcessingModePolicy-stamp
+
+PI/ProcessingModePolicy-stamp: $(srcdir)/PI/ProcessingModePolicy.pidl $(TAO_IDL_DEP)
+ $(TAO_IDL) $(TAO_IDLFLAGS) -Wb,versioning_begin=TAO_BEGIN_VERSIONED_NAMESPACE_DECL -Wb,versioning_end=TAO_END_VERSIONED_NAMESPACE_DECL -Sci -SS -GA -Gp -Gd -Ge 1 -Sc -Sorb -Sal -Wb,export_macro=TAO_PI_Export -Wb,export_include=tao/PI/pi_export.h -o PI $(srcdir)/PI/ProcessingModePolicy.pidl
+ @touch $@
+
+BUILT_SOURCES += \
+ PI/InvalidSlotA.cpp \
+ PI/InvalidSlotA.h \
+ PI/InvalidSlotC.cpp \
+ PI/InvalidSlotC.h
+
+CLEANFILES += \
+ PI/InvalidSlot-stamp \
+ PI/InvalidSlotA.cpp \
+ PI/InvalidSlotA.h \
+ PI/InvalidSlotC.cpp \
+ PI/InvalidSlotC.h
+
+PI/InvalidSlotA.cpp PI/InvalidSlotA.h PI/InvalidSlotC.cpp PI/InvalidSlotC.h: PI/InvalidSlot-stamp
+
+PI/InvalidSlot-stamp: $(srcdir)/PI/InvalidSlot.pidl $(TAO_IDL_DEP)
+ $(TAO_IDL) $(TAO_IDLFLAGS) -Wb,versioning_begin=TAO_BEGIN_VERSIONED_NAMESPACE_DECL -Wb,versioning_end=TAO_END_VERSIONED_NAMESPACE_DECL -Sci -SS -GA -Gp -Gd -Ge 1 -Sc -Sal -Wb,export_macro=TAO_PI_Export -Wb,export_include=tao/PI/pi_export.h -o PI $(srcdir)/PI/InvalidSlot.pidl
+ @touch $@
+
+lib_LTLIBRARIES += libTAO_PI.la
+
+libTAO_PI_la_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR) \
+ -I$(TAO_ROOT) \
+ -I$(TAO_BUILDDIR) \
+ -DTAO_PI_BUILD_DLL
+
+libTAO_PI_la_SOURCES = \
+ PI/ClientRequestDetails.cpp \
+ PI/ClientRequestInfo.cpp \
+ PI/ClientRequestInfoA.cpp \
+ PI/ClientRequestInfoC.cpp \
+ PI/ClientRequestInterceptorA.cpp \
+ PI/ClientRequestInterceptorC.cpp \
+ PI/ClientRequestInterceptor_Adapter_Impl.cpp \
+ PI/ClientRequestInterceptor_Factory_Impl.cpp \
+ PI/InterceptorA.cpp \
+ PI/InterceptorC.cpp \
+ PI/InvalidSlotA.cpp \
+ PI/InvalidSlotC.cpp \
+ PI/ORBInitInfo.cpp \
+ PI/ORBInitInfoC.cpp \
+ PI/ORBInitializerA.cpp \
+ PI/ORBInitializerC.cpp \
+ PI/ORBInitializer_Registry_Impl.cpp \
+ PI/PI.cpp \
+ PI/PICurrent.cpp \
+ PI/PICurrentA.cpp \
+ PI/PICurrentC.cpp \
+ PI/PICurrent_Impl.cpp \
+ PI/PICurrent_Loader.cpp \
+ PI/PIForwardRequestA.cpp \
+ PI/PIForwardRequestC.cpp \
+ PI/PI_ORBInitializer.cpp \
+ PI/PI_PolicyFactory.cpp \
+ PI/PolicyFactoryA.cpp \
+ PI/PolicyFactoryC.cpp \
+ PI/PolicyFactory_Loader.cpp \
+ PI/PolicyFactory_Registry.cpp \
+ PI/ProcessingModePolicy.cpp \
+ PI/ProcessingModePolicyA.cpp \
+ PI/ProcessingModePolicyC.cpp \
+ PI/RequestInfoA.cpp \
+ PI/RequestInfoC.cpp \
+ PI/RequestInfo_Util.cpp
+
+libTAO_PI_la_LDFLAGS = \
+ -version-number @TAO_MAJOR@:@TAO_MINOR@:@TAO_BETA@
+
+libTAO_PI_la_LIBADD = \
+ libTAO_CodecFactory.la \
+ libTAO_AnyTypeCode.la \
+ libTAO.la \
+ $(ACE_BUILDDIR)/ace/libACE.la
+
+nobase_include_HEADERS += \
+ PI/ClientRequestDetails.h \
+ PI/ClientRequestDetails.inl \
+ PI/ClientRequestInfo.h \
+ PI/ClientRequestInfo.pidl \
+ PI/ClientRequestInfo.pidl \
+ PI/ClientRequestInfoA.h \
+ PI/ClientRequestInfoC.h \
+ PI/ClientRequestInterceptor.pidl \
+ PI/ClientRequestInterceptor.pidl \
+ PI/ClientRequestInterceptorA.h \
+ PI/ClientRequestInterceptorC.h \
+ PI/ClientRequestInterceptor_Adapter_Impl.h \
+ PI/ClientRequestInterceptor_Adapter_Impl.inl \
+ PI/ClientRequestInterceptor_Factory_Impl.h \
+ PI/Interceptor.pidl \
+ PI/Interceptor.pidl \
+ PI/InterceptorA.h \
+ PI/InterceptorC.h \
+ PI/Interceptor_List_T.cpp \
+ PI/Interceptor_List_T.h \
+ PI/InvalidSlot.pidl \
+ PI/InvalidSlot.pidl \
+ PI/InvalidSlotA.h \
+ PI/InvalidSlotC.h \
+ PI/ORBInitInfo.h \
+ PI/ORBInitInfo.inl \
+ PI/ORBInitInfo.pidl \
+ PI/ORBInitInfo.pidl \
+ PI/ORBInitInfoC.h \
+ PI/ORBInitializer.pidl \
+ PI/ORBInitializer.pidl \
+ PI/ORBInitializerA.h \
+ PI/ORBInitializerC.h \
+ PI/ORBInitializer_Registry_Impl.h \
+ PI/PI.h \
+ PI/PICurrent.h \
+ PI/PICurrent.inl \
+ PI/PICurrent.pidl \
+ PI/PICurrent.pidl \
+ PI/PICurrentA.h \
+ PI/PICurrentC.h \
+ PI/PICurrent_Impl.h \
+ PI/PICurrent_Impl.inl \
+ PI/PICurrent_Loader.h \
+ PI/PIForwardRequest.pidl \
+ PI/PIForwardRequest.pidl \
+ PI/PIForwardRequestA.h \
+ PI/PIForwardRequestC.h \
+ PI/PI_ORBInitializer.h \
+ PI/PI_PolicyFactory.h \
+ PI/PolicyFactory.pidl \
+ PI/PolicyFactoryA.h \
+ PI/PolicyFactoryC.h \
+ PI/PolicyFactoryS.h \
+ PI/PolicyFactory_Loader.h \
+ PI/PolicyFactory_Registry.h \
+ PI/ProcessingModePolicy.h \
+ PI/ProcessingModePolicy.pidl \
+ PI/ProcessingModePolicy.pidl \
+ PI/ProcessingModePolicyA.h \
+ PI/ProcessingModePolicyC.h \
+ PI/RequestInfo.pidl \
+ PI/RequestInfo.pidl \
+ PI/RequestInfoA.h \
+ PI/RequestInfoC.h \
+ PI/RequestInfo_Util.h \
+ PI/pi_export.h
+
+pkgconfig_DATA += \
+ TAO_PI.pc
+
+CLEANFILES += \
+ TAO_PI.pc
+
+TAO_PI.pc: ${top_builddir}/config.status ${srcdir}/PI/TAO_PI.pc.in
+ ${top_builddir}/config.status --file $@:${srcdir}/PI/TAO_PI.pc.in
+
+EXTRA_DIST += \
+ PI/TAO_PI.pc.in
+
+
+## Makefile.BiDir_GIOP.am
+
+lib_LTLIBRARIES += libTAO_BiDirGIOP.la
+
+libTAO_BiDirGIOP_la_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR) \
+ -I$(TAO_ROOT) \
+ -I$(TAO_BUILDDIR) \
+ -DTAO_BIDIRGIOP_BUILD_DLL
+
+libTAO_BiDirGIOP_la_SOURCES = \
+ BiDir_GIOP/BiDirGIOP.cpp \
+ BiDir_GIOP/BiDirPolicyC.cpp \
+ BiDir_GIOP/BiDirPolicy_Validator.cpp \
+ BiDir_GIOP/BiDir_ORBInitializer.cpp \
+ BiDir_GIOP/BiDir_PolicyFactory.cpp \
+ BiDir_GIOP/BiDir_Policy_i.cpp
+
+libTAO_BiDirGIOP_la_LDFLAGS = \
+ -version-number @TAO_MAJOR@:@TAO_MINOR@:@TAO_BETA@
+
+libTAO_BiDirGIOP_la_LIBADD = \
+ libTAO_PI.la \
+ libTAO_CodecFactory.la \
+ libTAO_AnyTypeCode.la \
+ libTAO.la \
+ $(ACE_BUILDDIR)/ace/libACE.la
+
+nobase_include_HEADERS += \
+ BiDir_GIOP/BiDirGIOP.h \
+ BiDir_GIOP/BiDirPolicy.pidl \
+ BiDir_GIOP/BiDirPolicyC.h \
+ BiDir_GIOP/BiDirPolicy_Validator.h \
+ BiDir_GIOP/BiDir_ORBInitializer.h \
+ BiDir_GIOP/BiDir_PolicyFactory.h \
+ BiDir_GIOP/BiDir_Policy_i.h \
+ BiDir_GIOP/bidirgiop_export.h
+
+pkgconfig_DATA += \
+ TAO_BiDirGIOP.pc
+
+CLEANFILES += \
+ TAO_BiDirGIOP.pc
+
+TAO_BiDirGIOP.pc: ${top_builddir}/config.status ${srcdir}/BiDir_GIOP/TAO_BiDirGIOP.pc.in
+ ${top_builddir}/config.status --file $@:${srcdir}/BiDir_GIOP/TAO_BiDirGIOP.pc.in
+
+EXTRA_DIST += \
+ BiDir_GIOP/TAO_BiDirGIOP.pc.in \
+ BiDir_GIOP/TAO_BiDir_GIOP.rc
+
+
+## Makefile.PortableServer.am
+
+BUILT_SOURCES += \
+ PortableServer/ForwardRequestA.cpp \
+ PortableServer/ForwardRequestA.h \
+ PortableServer/ForwardRequestC.cpp \
+ PortableServer/ForwardRequestC.h
+
+CLEANFILES += \
+ PortableServer/ForwardRequest-stamp \
+ PortableServer/ForwardRequestA.cpp \
+ PortableServer/ForwardRequestA.h \
+ PortableServer/ForwardRequestC.cpp \
+ PortableServer/ForwardRequestC.h
+
+PortableServer/ForwardRequestA.cpp PortableServer/ForwardRequestA.h PortableServer/ForwardRequestC.cpp PortableServer/ForwardRequestC.h: PortableServer/ForwardRequest-stamp
+
+PortableServer/ForwardRequest-stamp: $(srcdir)/PortableServer/ForwardRequest.pidl $(TAO_IDL_DEP)
+ $(TAO_IDL) $(TAO_IDLFLAGS) -Wb,versioning_begin=TAO_BEGIN_VERSIONED_NAMESPACE_DECL -Wb,versioning_end=TAO_END_VERSIONED_NAMESPACE_DECL -Gp -Gd -Sci -SS -Sorb -GA -Ge 1 -Wb,export_macro=TAO_PortableServer_Export -Wb,export_include=tao/PortableServer/portableserver_export.h -o PortableServer $(srcdir)/PortableServer/ForwardRequest.pidl
+ @touch $@
+
+BUILT_SOURCES += \
+ PortableServer/AdapterActivatorA.cpp \
+ PortableServer/AdapterActivatorA.h \
+ PortableServer/AdapterActivatorC.cpp \
+ PortableServer/AdapterActivatorC.h
+
+CLEANFILES += \
+ PortableServer/AdapterActivator-stamp \
+ PortableServer/AdapterActivatorA.cpp \
+ PortableServer/AdapterActivatorA.h \
+ PortableServer/AdapterActivatorC.cpp \
+ PortableServer/AdapterActivatorC.h
+
+PortableServer/AdapterActivatorA.cpp PortableServer/AdapterActivatorA.h PortableServer/AdapterActivatorC.cpp PortableServer/AdapterActivatorC.h: PortableServer/AdapterActivator-stamp
+
+PortableServer/AdapterActivator-stamp: $(srcdir)/PortableServer/AdapterActivator.pidl $(TAO_IDL_DEP)
+ $(TAO_IDL) $(TAO_IDLFLAGS) -Wb,versioning_begin=TAO_BEGIN_VERSIONED_NAMESPACE_DECL -Wb,versioning_end=TAO_END_VERSIONED_NAMESPACE_DECL -Gp -Gd -Ge 1 -Sci -SS -Sorb -GA -Sal -Wb,export_macro=TAO_PortableServer_Export -Wb,export_include=tao/PortableServer/portableserver_export.h -o PortableServer $(srcdir)/PortableServer/AdapterActivator.pidl
+ @touch $@
+
+BUILT_SOURCES += \
+ PortableServer/IdAssignmentPolicyA.cpp \
+ PortableServer/IdAssignmentPolicyA.h \
+ PortableServer/IdAssignmentPolicyC.cpp \
+ PortableServer/IdAssignmentPolicyC.h
+
+CLEANFILES += \
+ PortableServer/IdAssignmentPolicy-stamp \
+ PortableServer/IdAssignmentPolicyA.cpp \
+ PortableServer/IdAssignmentPolicyA.h \
+ PortableServer/IdAssignmentPolicyC.cpp \
+ PortableServer/IdAssignmentPolicyC.h
+
+PortableServer/IdAssignmentPolicyA.cpp PortableServer/IdAssignmentPolicyA.h PortableServer/IdAssignmentPolicyC.cpp PortableServer/IdAssignmentPolicyC.h: PortableServer/IdAssignmentPolicy-stamp
+
+PortableServer/IdAssignmentPolicy-stamp: $(srcdir)/PortableServer/IdAssignmentPolicy.pidl $(TAO_IDL_DEP)
+ $(TAO_IDL) $(TAO_IDLFLAGS) -Wb,versioning_begin=TAO_BEGIN_VERSIONED_NAMESPACE_DECL -Wb,versioning_end=TAO_END_VERSIONED_NAMESPACE_DECL -Gp -Gd -Ge 1 -Sci -SS -Sorb -GA -Sal -Wb,export_macro=TAO_PortableServer_Export -Wb,export_include=tao/PortableServer/portableserver_export.h -o PortableServer $(srcdir)/PortableServer/IdAssignmentPolicy.pidl
+ @touch $@
+
+BUILT_SOURCES += \
+ PortableServer/IdUniquenessPolicyA.cpp \
+ PortableServer/IdUniquenessPolicyA.h \
+ PortableServer/IdUniquenessPolicyC.cpp \
+ PortableServer/IdUniquenessPolicyC.h
+
+CLEANFILES += \
+ PortableServer/IdUniquenessPolicy-stamp \
+ PortableServer/IdUniquenessPolicyA.cpp \
+ PortableServer/IdUniquenessPolicyA.h \
+ PortableServer/IdUniquenessPolicyC.cpp \
+ PortableServer/IdUniquenessPolicyC.h
+
+PortableServer/IdUniquenessPolicyA.cpp PortableServer/IdUniquenessPolicyA.h PortableServer/IdUniquenessPolicyC.cpp PortableServer/IdUniquenessPolicyC.h: PortableServer/IdUniquenessPolicy-stamp
+
+PortableServer/IdUniquenessPolicy-stamp: $(srcdir)/PortableServer/IdUniquenessPolicy.pidl $(TAO_IDL_DEP)
+ $(TAO_IDL) $(TAO_IDLFLAGS) -Wb,versioning_begin=TAO_BEGIN_VERSIONED_NAMESPACE_DECL -Wb,versioning_end=TAO_END_VERSIONED_NAMESPACE_DECL -Gp -Gd -Ge 1 -Sci -SS -Sorb -GA -Sal -Wb,export_macro=TAO_PortableServer_Export -Wb,export_include=tao/PortableServer/portableserver_export.h -o PortableServer $(srcdir)/PortableServer/IdUniquenessPolicy.pidl
+ @touch $@
+
+BUILT_SOURCES += \
+ PortableServer/ImplicitActivationPolicyA.cpp \
+ PortableServer/ImplicitActivationPolicyA.h \
+ PortableServer/ImplicitActivationPolicyC.cpp \
+ PortableServer/ImplicitActivationPolicyC.h
+
+CLEANFILES += \
+ PortableServer/ImplicitActivationPolicy-stamp \
+ PortableServer/ImplicitActivationPolicyA.cpp \
+ PortableServer/ImplicitActivationPolicyA.h \
+ PortableServer/ImplicitActivationPolicyC.cpp \
+ PortableServer/ImplicitActivationPolicyC.h
+
+PortableServer/ImplicitActivationPolicyA.cpp PortableServer/ImplicitActivationPolicyA.h PortableServer/ImplicitActivationPolicyC.cpp PortableServer/ImplicitActivationPolicyC.h: PortableServer/ImplicitActivationPolicy-stamp
+
+PortableServer/ImplicitActivationPolicy-stamp: $(srcdir)/PortableServer/ImplicitActivationPolicy.pidl $(TAO_IDL_DEP)
+ $(TAO_IDL) $(TAO_IDLFLAGS) -Wb,versioning_begin=TAO_BEGIN_VERSIONED_NAMESPACE_DECL -Wb,versioning_end=TAO_END_VERSIONED_NAMESPACE_DECL -Gp -Gd -Ge 1 -Sci -SS -Sorb -GA -Sal -Wb,export_macro=TAO_PortableServer_Export -Wb,export_include=tao/PortableServer/portableserver_export.h -o PortableServer $(srcdir)/PortableServer/ImplicitActivationPolicy.pidl
+ @touch $@
+
+BUILT_SOURCES += \
+ PortableServer/LifespanPolicyA.cpp \
+ PortableServer/LifespanPolicyA.h \
+ PortableServer/LifespanPolicyC.cpp \
+ PortableServer/LifespanPolicyC.h
+
+CLEANFILES += \
+ PortableServer/LifespanPolicy-stamp \
+ PortableServer/LifespanPolicyA.cpp \
+ PortableServer/LifespanPolicyA.h \
+ PortableServer/LifespanPolicyC.cpp \
+ PortableServer/LifespanPolicyC.h
+
+PortableServer/LifespanPolicyA.cpp PortableServer/LifespanPolicyA.h PortableServer/LifespanPolicyC.cpp PortableServer/LifespanPolicyC.h: PortableServer/LifespanPolicy-stamp
+
+PortableServer/LifespanPolicy-stamp: $(srcdir)/PortableServer/LifespanPolicy.pidl $(TAO_IDL_DEP)
+ $(TAO_IDL) $(TAO_IDLFLAGS) -Wb,versioning_begin=TAO_BEGIN_VERSIONED_NAMESPACE_DECL -Wb,versioning_end=TAO_END_VERSIONED_NAMESPACE_DECL -Gp -Gd -Ge 1 -Sci -SS -Sorb -GA -Sal -Wb,export_macro=TAO_PortableServer_Export -Wb,export_include=tao/PortableServer/portableserver_export.h -o PortableServer $(srcdir)/PortableServer/LifespanPolicy.pidl
+ @touch $@
+
+BUILT_SOURCES += \
+ PortableServer/RequestProcessingPolicyA.cpp \
+ PortableServer/RequestProcessingPolicyA.h \
+ PortableServer/RequestProcessingPolicyC.cpp \
+ PortableServer/RequestProcessingPolicyC.h
+
+CLEANFILES += \
+ PortableServer/RequestProcessingPolicy-stamp \
+ PortableServer/RequestProcessingPolicyA.cpp \
+ PortableServer/RequestProcessingPolicyA.h \
+ PortableServer/RequestProcessingPolicyC.cpp \
+ PortableServer/RequestProcessingPolicyC.h
+
+PortableServer/RequestProcessingPolicyA.cpp PortableServer/RequestProcessingPolicyA.h PortableServer/RequestProcessingPolicyC.cpp PortableServer/RequestProcessingPolicyC.h: PortableServer/RequestProcessingPolicy-stamp
+
+PortableServer/RequestProcessingPolicy-stamp: $(srcdir)/PortableServer/RequestProcessingPolicy.pidl $(TAO_IDL_DEP)
+ $(TAO_IDL) $(TAO_IDLFLAGS) -Wb,versioning_begin=TAO_BEGIN_VERSIONED_NAMESPACE_DECL -Wb,versioning_end=TAO_END_VERSIONED_NAMESPACE_DECL -Gp -Gd -Ge 1 -Sci -SS -Sorb -GA -Sal -Wb,export_macro=TAO_PortableServer_Export -Wb,export_include=tao/PortableServer/portableserver_export.h -o PortableServer $(srcdir)/PortableServer/RequestProcessingPolicy.pidl
+ @touch $@
+
+BUILT_SOURCES += \
+ PortableServer/ServantActivatorA.cpp \
+ PortableServer/ServantActivatorA.h \
+ PortableServer/ServantActivatorC.cpp \
+ PortableServer/ServantActivatorC.h
+
+CLEANFILES += \
+ PortableServer/ServantActivator-stamp \
+ PortableServer/ServantActivatorA.cpp \
+ PortableServer/ServantActivatorA.h \
+ PortableServer/ServantActivatorC.cpp \
+ PortableServer/ServantActivatorC.h
+
+PortableServer/ServantActivatorA.cpp PortableServer/ServantActivatorA.h PortableServer/ServantActivatorC.cpp PortableServer/ServantActivatorC.h: PortableServer/ServantActivator-stamp
+
+PortableServer/ServantActivator-stamp: $(srcdir)/PortableServer/ServantActivator.pidl $(TAO_IDL_DEP)
+ $(TAO_IDL) $(TAO_IDLFLAGS) -Wb,versioning_begin=TAO_BEGIN_VERSIONED_NAMESPACE_DECL -Wb,versioning_end=TAO_END_VERSIONED_NAMESPACE_DECL -Gp -Gd -Ge 1 -Sci -SS -Sorb -GA -Sal -Wb,export_macro=TAO_PortableServer_Export -Wb,export_include=tao/PortableServer/portableserver_export.h -o PortableServer $(srcdir)/PortableServer/ServantActivator.pidl
+ @touch $@
+
+BUILT_SOURCES += \
+ PortableServer/ServantLocatorA.cpp \
+ PortableServer/ServantLocatorA.h \
+ PortableServer/ServantLocatorC.cpp \
+ PortableServer/ServantLocatorC.h
+
+CLEANFILES += \
+ PortableServer/ServantLocator-stamp \
+ PortableServer/ServantLocatorA.cpp \
+ PortableServer/ServantLocatorA.h \
+ PortableServer/ServantLocatorC.cpp \
+ PortableServer/ServantLocatorC.h
+
+PortableServer/ServantLocatorA.cpp PortableServer/ServantLocatorA.h PortableServer/ServantLocatorC.cpp PortableServer/ServantLocatorC.h: PortableServer/ServantLocator-stamp
+
+PortableServer/ServantLocator-stamp: $(srcdir)/PortableServer/ServantLocator.pidl $(TAO_IDL_DEP)
+ $(TAO_IDL) $(TAO_IDLFLAGS) -Wb,versioning_begin=TAO_BEGIN_VERSIONED_NAMESPACE_DECL -Wb,versioning_end=TAO_END_VERSIONED_NAMESPACE_DECL -Gp -Gd -Ge 1 -Sci -SS -Sorb -GA -Sal -Wb,export_macro=TAO_PortableServer_Export -Wb,export_include=tao/PortableServer/portableserver_export.h -o PortableServer $(srcdir)/PortableServer/ServantLocator.pidl
+ @touch $@
+
+BUILT_SOURCES += \
+ PortableServer/ServantManagerA.cpp \
+ PortableServer/ServantManagerA.h \
+ PortableServer/ServantManagerC.cpp \
+ PortableServer/ServantManagerC.h
+
+CLEANFILES += \
+ PortableServer/ServantManager-stamp \
+ PortableServer/ServantManagerA.cpp \
+ PortableServer/ServantManagerA.h \
+ PortableServer/ServantManagerC.cpp \
+ PortableServer/ServantManagerC.h
+
+PortableServer/ServantManagerA.cpp PortableServer/ServantManagerA.h PortableServer/ServantManagerC.cpp PortableServer/ServantManagerC.h: PortableServer/ServantManager-stamp
+
+PortableServer/ServantManager-stamp: $(srcdir)/PortableServer/ServantManager.pidl $(TAO_IDL_DEP)
+ $(TAO_IDL) $(TAO_IDLFLAGS) -Wb,versioning_begin=TAO_BEGIN_VERSIONED_NAMESPACE_DECL -Wb,versioning_end=TAO_END_VERSIONED_NAMESPACE_DECL -Gp -Gd -Ge 1 -Sci -SS -Sorb -GA -Sal -Wb,export_macro=TAO_PortableServer_Export -Wb,export_include=tao/PortableServer/portableserver_export.h -o PortableServer $(srcdir)/PortableServer/ServantManager.pidl
+ @touch $@
+
+BUILT_SOURCES += \
+ PortableServer/ServantRetentionPolicyA.cpp \
+ PortableServer/ServantRetentionPolicyA.h \
+ PortableServer/ServantRetentionPolicyC.cpp \
+ PortableServer/ServantRetentionPolicyC.h
+
+CLEANFILES += \
+ PortableServer/ServantRetentionPolicy-stamp \
+ PortableServer/ServantRetentionPolicyA.cpp \
+ PortableServer/ServantRetentionPolicyA.h \
+ PortableServer/ServantRetentionPolicyC.cpp \
+ PortableServer/ServantRetentionPolicyC.h
+
+PortableServer/ServantRetentionPolicyA.cpp PortableServer/ServantRetentionPolicyA.h PortableServer/ServantRetentionPolicyC.cpp PortableServer/ServantRetentionPolicyC.h: PortableServer/ServantRetentionPolicy-stamp
+
+PortableServer/ServantRetentionPolicy-stamp: $(srcdir)/PortableServer/ServantRetentionPolicy.pidl $(TAO_IDL_DEP)
+ $(TAO_IDL) $(TAO_IDLFLAGS) -Wb,versioning_begin=TAO_BEGIN_VERSIONED_NAMESPACE_DECL -Wb,versioning_end=TAO_END_VERSIONED_NAMESPACE_DECL -Gp -Gd -Ge 1 -Sci -SS -Sorb -GA -Sal -Wb,export_macro=TAO_PortableServer_Export -Wb,export_include=tao/PortableServer/portableserver_export.h -o PortableServer $(srcdir)/PortableServer/ServantRetentionPolicy.pidl
+ @touch $@
+
+BUILT_SOURCES += \
+ PortableServer/ThreadPolicyA.cpp \
+ PortableServer/ThreadPolicyA.h \
+ PortableServer/ThreadPolicyC.cpp \
+ PortableServer/ThreadPolicyC.h
+
+CLEANFILES += \
+ PortableServer/ThreadPolicy-stamp \
+ PortableServer/ThreadPolicyA.cpp \
+ PortableServer/ThreadPolicyA.h \
+ PortableServer/ThreadPolicyC.cpp \
+ PortableServer/ThreadPolicyC.h
+
+PortableServer/ThreadPolicyA.cpp PortableServer/ThreadPolicyA.h PortableServer/ThreadPolicyC.cpp PortableServer/ThreadPolicyC.h: PortableServer/ThreadPolicy-stamp
+
+PortableServer/ThreadPolicy-stamp: $(srcdir)/PortableServer/ThreadPolicy.pidl $(TAO_IDL_DEP)
+ $(TAO_IDL) $(TAO_IDLFLAGS) -Wb,versioning_begin=TAO_BEGIN_VERSIONED_NAMESPACE_DECL -Wb,versioning_end=TAO_END_VERSIONED_NAMESPACE_DECL -Gp -Gd -Ge 1 -Sci -SS -Sorb -GA -Sal -Wb,export_macro=TAO_PortableServer_Export -Wb,export_include=tao/PortableServer/portableserver_export.h -o PortableServer $(srcdir)/PortableServer/ThreadPolicy.pidl
+ @touch $@
+
+BUILT_SOURCES += \
+ PortableServer/POAManagerC.cpp \
+ PortableServer/POAManagerC.h
+
+CLEANFILES += \
+ PortableServer/POAManager-stamp \
+ PortableServer/POAManagerC.cpp \
+ PortableServer/POAManagerC.h
+
+PortableServer/POAManagerC.cpp PortableServer/POAManagerC.h: PortableServer/POAManager-stamp
+
+PortableServer/POAManager-stamp: $(srcdir)/PortableServer/POAManager.pidl $(TAO_IDL_DEP)
+ $(TAO_IDL) $(TAO_IDLFLAGS) -Wb,versioning_begin=TAO_BEGIN_VERSIONED_NAMESPACE_DECL -Wb,versioning_end=TAO_END_VERSIONED_NAMESPACE_DECL -Gp -Gd -Ge 1 -Sci -SS -Sorb -Wb,export_macro=TAO_PortableServer_Export -Wb,export_include=tao/PortableServer/portableserver_export.h -o PortableServer $(srcdir)/PortableServer/POAManager.pidl
+ @touch $@
+
+BUILT_SOURCES += \
+ PortableServer/POAManagerFactoryC.cpp \
+ PortableServer/POAManagerFactoryC.h
+
+CLEANFILES += \
+ PortableServer/POAManagerFactory-stamp \
+ PortableServer/POAManagerFactoryC.cpp \
+ PortableServer/POAManagerFactoryC.h
+
+PortableServer/POAManagerFactoryC.cpp PortableServer/POAManagerFactoryC.h: PortableServer/POAManagerFactory-stamp
+
+PortableServer/POAManagerFactory-stamp: $(srcdir)/PortableServer/POAManagerFactory.pidl $(TAO_IDL_DEP)
+ $(TAO_IDL) $(TAO_IDLFLAGS) -Wb,versioning_begin=TAO_BEGIN_VERSIONED_NAMESPACE_DECL -Wb,versioning_end=TAO_END_VERSIONED_NAMESPACE_DECL -Gp -Gd -Ge 1 -Sci -SS -Sorb -Wb,export_macro=TAO_PortableServer_Export -Wb,export_include=tao/PortableServer/portableserver_export.h -o PortableServer $(srcdir)/PortableServer/POAManagerFactory.pidl
+ @touch $@
+
+BUILT_SOURCES += \
+ PortableServer/POAC.cpp \
+ PortableServer/POAC.h
+
+CLEANFILES += \
+ PortableServer/POA-stamp \
+ PortableServer/POAC.cpp \
+ PortableServer/POAC.h
+
+PortableServer/POAC.cpp PortableServer/POAC.h: PortableServer/POA-stamp
+
+PortableServer/POA-stamp: $(srcdir)/PortableServer/POA.pidl $(TAO_IDL_DEP)
+ $(TAO_IDL) $(TAO_IDLFLAGS) -Wb,versioning_begin=TAO_BEGIN_VERSIONED_NAMESPACE_DECL -Wb,versioning_end=TAO_END_VERSIONED_NAMESPACE_DECL -Gp -Gd -Ge 1 -Sci -SS -Sorb -Wb,export_macro=TAO_PortableServer_Export -Wb,export_include=tao/PortableServer/portableserver_export.h -o PortableServer $(srcdir)/PortableServer/POA.pidl
+ @touch $@
+
+BUILT_SOURCES += \
+ PortableServer/PS_CurrentC.cpp \
+ PortableServer/PS_CurrentC.h
+
+CLEANFILES += \
+ PortableServer/PS_Current-stamp \
+ PortableServer/PS_CurrentC.cpp \
+ PortableServer/PS_CurrentC.h
+
+PortableServer/PS_CurrentC.cpp PortableServer/PS_CurrentC.h: PortableServer/PS_Current-stamp
+
+PortableServer/PS_Current-stamp: $(srcdir)/PortableServer/PS_Current.pidl $(TAO_IDL_DEP)
+ $(TAO_IDL) $(TAO_IDLFLAGS) -Wb,versioning_begin=TAO_BEGIN_VERSIONED_NAMESPACE_DECL -Wb,versioning_end=TAO_END_VERSIONED_NAMESPACE_DECL -Gp -Gd -Ge 1 -Sci -SS -Sorb -Wb,export_macro=TAO_PortableServer_Export -Wb,export_include=tao/PortableServer/portableserver_export.h -o PortableServer $(srcdir)/PortableServer/PS_Current.pidl
+ @touch $@
+
+lib_LTLIBRARIES += libTAO_PortableServer.la
+
+libTAO_PortableServer_la_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR) \
+ -I$(TAO_ROOT) \
+ -I$(TAO_BUILDDIR) \
+ -DTAO_PORTABLESERVER_BUILD_DLL
+
+libTAO_PortableServer_la_SOURCES = \
+ PortableServer/Acceptor_Filter_Factory.cpp \
+ PortableServer/Active_Object_Map.cpp \
+ PortableServer/Active_Object_Map_Entry.cpp \
+ PortableServer/Active_Policy_Strategies.cpp \
+ PortableServer/AdapterActivatorA.cpp \
+ PortableServer/AdapterActivatorC.cpp \
+ PortableServer/Adapter_Activator.cpp \
+ PortableServer/Collocated_Object_Proxy_Broker.cpp \
+ PortableServer/Creation_Time.cpp \
+ PortableServer/Default_Acceptor_Filter.cpp \
+ PortableServer/Default_Policy_Validator.cpp \
+ PortableServer/Default_Servant_Dispatcher.cpp \
+ PortableServer/Direct_Collocation_Upcall_Wrapper.cpp \
+ PortableServer/ForwardRequestA.cpp \
+ PortableServer/ForwardRequestC.cpp \
+ PortableServer/IdAssignmentPolicy.cpp \
+ PortableServer/IdAssignmentPolicyA.cpp \
+ PortableServer/IdAssignmentPolicyC.cpp \
+ PortableServer/IdAssignmentStrategy.cpp \
+ PortableServer/IdAssignmentStrategyFactoryImpl.cpp \
+ PortableServer/IdAssignmentStrategySystem.cpp \
+ PortableServer/IdAssignmentStrategyUser.cpp \
+ PortableServer/IdUniquenessPolicy.cpp \
+ PortableServer/IdUniquenessPolicyA.cpp \
+ PortableServer/IdUniquenessPolicyC.cpp \
+ PortableServer/IdUniquenessStrategyFactoryImpl.cpp \
+ PortableServer/IdUniquenessStrategyMultiple.cpp \
+ PortableServer/IdUniquenessStrategyUnique.cpp \
+ PortableServer/IdUniquenessStrategyUniqueFactoryImpl.cpp \
+ PortableServer/ImR_Client_Adapter.cpp \
+ PortableServer/ImplicitActivationPolicy.cpp \
+ PortableServer/ImplicitActivationPolicyA.cpp \
+ PortableServer/ImplicitActivationPolicyC.cpp \
+ PortableServer/ImplicitActivationStrategy.cpp \
+ PortableServer/ImplicitActivationStrategyExplicit.cpp \
+ PortableServer/ImplicitActivationStrategyFactoryImpl.cpp \
+ PortableServer/ImplicitActivationStrategyImplicit.cpp \
+ PortableServer/Key_Adapters.cpp \
+ PortableServer/LifespanPolicy.cpp \
+ PortableServer/LifespanPolicyA.cpp \
+ PortableServer/LifespanPolicyC.cpp \
+ PortableServer/LifespanStrategy.cpp \
+ PortableServer/LifespanStrategyFactoryImpl.cpp \
+ PortableServer/LifespanStrategyPersistent.cpp \
+ PortableServer/LifespanStrategyPersistentFactoryImpl.cpp \
+ PortableServer/LifespanStrategyTransient.cpp \
+ PortableServer/LifespanStrategyTransientFactoryImpl.cpp \
+ PortableServer/Local_Servant_Base.cpp \
+ PortableServer/Non_Servant_Upcall.cpp \
+ PortableServer/ORT_Adapter_Factory.cpp \
+ PortableServer/Object_Adapter.cpp \
+ PortableServer/Object_Adapter_Factory.cpp \
+ PortableServer/Operation_Table.cpp \
+ PortableServer/Operation_Table_Binary_Search.cpp \
+ PortableServer/Operation_Table_Dynamic_Hash.cpp \
+ PortableServer/Operation_Table_Linear_Search.cpp \
+ PortableServer/Operation_Table_Perfect_Hash.cpp \
+ PortableServer/POAC.cpp \
+ PortableServer/POAManager.cpp \
+ PortableServer/POAManagerC.cpp \
+ PortableServer/POAManagerFactory.cpp \
+ PortableServer/POAManagerFactoryC.cpp \
+ PortableServer/POA_Cached_Policies.cpp \
+ PortableServer/POA_Current.cpp \
+ PortableServer/POA_Current_Factory.cpp \
+ PortableServer/POA_Current_Impl.cpp \
+ PortableServer/POA_Guard.cpp \
+ PortableServer/POA_Policy_Set.cpp \
+ PortableServer/PS_CurrentC.cpp \
+ PortableServer/PS_ForwardA.cpp \
+ PortableServer/PS_ForwardC.cpp \
+ PortableServer/PolicyS.cpp \
+ PortableServer/PortableServer.cpp \
+ PortableServer/PortableServerC.cpp \
+ PortableServer/PortableServer_Functions.cpp \
+ PortableServer/PortableServer_WFunctions.cpp \
+ PortableServer/Regular_POA.cpp \
+ PortableServer/RequestProcessingPolicy.cpp \
+ PortableServer/RequestProcessingPolicyA.cpp \
+ PortableServer/RequestProcessingPolicyC.cpp \
+ PortableServer/RequestProcessingStrategy.cpp \
+ PortableServer/RequestProcessingStrategyAOMOnly.cpp \
+ PortableServer/RequestProcessingStrategyAOMOnlyFactoryImpl.cpp \
+ PortableServer/RequestProcessingStrategyDefaultServant.cpp \
+ PortableServer/RequestProcessingStrategyDefaultServantFI.cpp \
+ PortableServer/RequestProcessingStrategyFactoryImpl.cpp \
+ PortableServer/RequestProcessingStrategyServantActivator.cpp \
+ PortableServer/RequestProcessingStrategyServantActivatorFI.cpp \
+ PortableServer/RequestProcessingStrategyServantLocator.cpp \
+ PortableServer/RequestProcessingStrategyServantLocatorFI.cpp \
+ PortableServer/RequestProcessingStrategyServantManager.cpp \
+ PortableServer/Root_POA.cpp \
+ PortableServer/ServantActivatorA.cpp \
+ PortableServer/ServantActivatorC.cpp \
+ PortableServer/ServantLocatorA.cpp \
+ PortableServer/ServantLocatorC.cpp \
+ PortableServer/ServantManagerA.cpp \
+ PortableServer/ServantManagerC.cpp \
+ PortableServer/ServantRetentionPolicy.cpp \
+ PortableServer/ServantRetentionPolicyA.cpp \
+ PortableServer/ServantRetentionPolicyC.cpp \
+ PortableServer/ServantRetentionStrategyFactoryImpl.cpp \
+ PortableServer/ServantRetentionStrategyNonRetain.cpp \
+ PortableServer/ServantRetentionStrategyNonRetainFactoryImpl.cpp \
+ PortableServer/ServantRetentionStrategyRetain.cpp \
+ PortableServer/ServantRetentionStrategyRetainFactoryImpl.cpp \
+ PortableServer/Servant_Base.cpp \
+ PortableServer/Servant_Dispatcher.cpp \
+ PortableServer/Servant_Upcall.cpp \
+ PortableServer/StrategyFactory.cpp \
+ PortableServer/ThreadPolicy.cpp \
+ PortableServer/ThreadPolicyA.cpp \
+ PortableServer/ThreadPolicyC.cpp \
+ PortableServer/ThreadStrategy.cpp \
+ PortableServer/ThreadStrategyFactoryImpl.cpp \
+ PortableServer/ThreadStrategyORBControl.cpp \
+ PortableServer/ThreadStrategySingle.cpp \
+ PortableServer/ThreadStrategySingleFactoryImpl.cpp \
+ PortableServer/Upcall_Command.cpp \
+ PortableServer/Upcall_Wrapper.cpp
+
+libTAO_PortableServer_la_LDFLAGS = \
+ -version-number @TAO_MAJOR@:@TAO_MINOR@:@TAO_BETA@
+
+libTAO_PortableServer_la_LIBADD = \
+ libTAO_AnyTypeCode.la \
+ libTAO.la \
+ $(ACE_BUILDDIR)/ace/libACE.la
+
+nobase_include_HEADERS += \
+ PortableServer/Acceptor_Filter_Factory.h \
+ PortableServer/Active_Object_Map.h \
+ PortableServer/Active_Object_Map.i \
+ PortableServer/Active_Object_Map_Entry.h \
+ PortableServer/Active_Policy_Strategies.h \
+ PortableServer/Active_Policy_Strategies.inl \
+ PortableServer/AdapterActivator.pidl \
+ PortableServer/AdapterActivator.pidl \
+ PortableServer/AdapterActivatorA.h \
+ PortableServer/AdapterActivatorC.h \
+ PortableServer/Adapter_Activator.h \
+ PortableServer/Any_SArg_Traits.h \
+ PortableServer/BD_String_SArgument_T.cpp \
+ PortableServer/BD_String_SArgument_T.h \
+ PortableServer/BD_String_SArgument_T.inl \
+ PortableServer/Basic_SArgument_T.cpp \
+ PortableServer/Basic_SArgument_T.h \
+ PortableServer/Basic_SArgument_T.inl \
+ PortableServer/Basic_SArguments.h \
+ PortableServer/Collocated_Object_Proxy_Broker.h \
+ PortableServer/Creation_Time.h \
+ PortableServer/Creation_Time.inl \
+ PortableServer/Default_Acceptor_Filter.h \
+ PortableServer/Default_Policy_Validator.h \
+ PortableServer/Default_Servant_Dispatcher.h \
+ PortableServer/Direct_Collocation_Upcall_Wrapper.h \
+ PortableServer/Fixed_Array_SArgument_T.cpp \
+ PortableServer/Fixed_Array_SArgument_T.h \
+ PortableServer/Fixed_Array_SArgument_T.inl \
+ PortableServer/Fixed_Size_SArgument_T.cpp \
+ PortableServer/Fixed_Size_SArgument_T.h \
+ PortableServer/Fixed_Size_SArgument_T.inl \
+ PortableServer/ForwardRequest.pidl \
+ PortableServer/ForwardRequest.pidl \
+ PortableServer/ForwardRequestA.h \
+ PortableServer/ForwardRequestC.h \
+ PortableServer/IdAssignmentPolicy.h \
+ PortableServer/IdAssignmentPolicy.pidl \
+ PortableServer/IdAssignmentPolicy.pidl \
+ PortableServer/IdAssignmentPolicyA.h \
+ PortableServer/IdAssignmentPolicyC.h \
+ PortableServer/IdAssignmentStrategy.h \
+ PortableServer/IdAssignmentStrategyFactory.h \
+ PortableServer/IdAssignmentStrategyFactoryImpl.h \
+ PortableServer/IdAssignmentStrategySystem.h \
+ PortableServer/IdAssignmentStrategyUser.h \
+ PortableServer/IdUniquenessPolicy.h \
+ PortableServer/IdUniquenessPolicy.pidl \
+ PortableServer/IdUniquenessPolicy.pidl \
+ PortableServer/IdUniquenessPolicyA.h \
+ PortableServer/IdUniquenessPolicyC.h \
+ PortableServer/IdUniquenessStrategy.h \
+ PortableServer/IdUniquenessStrategyFactory.h \
+ PortableServer/IdUniquenessStrategyFactoryImpl.h \
+ PortableServer/IdUniquenessStrategyMultiple.h \
+ PortableServer/IdUniquenessStrategyUnique.h \
+ PortableServer/IdUniquenessStrategyUniqueFactoryImpl.h \
+ PortableServer/ImR_Client_Adapter.h \
+ PortableServer/ImplicitActivationPolicy.h \
+ PortableServer/ImplicitActivationPolicy.pidl \
+ PortableServer/ImplicitActivationPolicy.pidl \
+ PortableServer/ImplicitActivationPolicyA.h \
+ PortableServer/ImplicitActivationPolicyC.h \
+ PortableServer/ImplicitActivationStrategy.h \
+ PortableServer/ImplicitActivationStrategyExplicit.h \
+ PortableServer/ImplicitActivationStrategyFactory.h \
+ PortableServer/ImplicitActivationStrategyFactoryImpl.h \
+ PortableServer/ImplicitActivationStrategyImplicit.h \
+ PortableServer/Key_Adapters.h \
+ PortableServer/LifespanPolicy.h \
+ PortableServer/LifespanPolicy.pidl \
+ PortableServer/LifespanPolicy.pidl \
+ PortableServer/LifespanPolicyA.h \
+ PortableServer/LifespanPolicyC.h \
+ PortableServer/LifespanStrategy.h \
+ PortableServer/LifespanStrategyFactory.h \
+ PortableServer/LifespanStrategyFactoryImpl.h \
+ PortableServer/LifespanStrategyPersistent.h \
+ PortableServer/LifespanStrategyPersistentFactoryImpl.h \
+ PortableServer/LifespanStrategyTransient.h \
+ PortableServer/LifespanStrategyTransientFactoryImpl.h \
+ PortableServer/Local_Servant_Base.h \
+ PortableServer/Local_Servant_Base.inl \
+ PortableServer/Non_Servant_Upcall.h \
+ PortableServer/Non_Servant_Upcall.inl \
+ PortableServer/ORT_Adapter.h \
+ PortableServer/ORT_Adapter_Factory.h \
+ PortableServer/Object_Adapter.h \
+ PortableServer/Object_Adapter.i \
+ PortableServer/Object_Adapter_Factory.h \
+ PortableServer/Object_SArg_Traits.h \
+ PortableServer/Object_SArgument_T.cpp \
+ PortableServer/Object_SArgument_T.h \
+ PortableServer/Object_SArgument_T.inl \
+ PortableServer/Operation_Table.h \
+ PortableServer/Operation_Table_Binary_Search.h \
+ PortableServer/Operation_Table_Dynamic_Hash.h \
+ PortableServer/Operation_Table_Linear_Search.h \
+ PortableServer/Operation_Table_Perfect_Hash.h \
+ PortableServer/POA.pidl \
+ PortableServer/POA.pidl \
+ PortableServer/POAC.h \
+ PortableServer/POAManager.h \
+ PortableServer/POAManager.i \
+ PortableServer/POAManager.pidl \
+ PortableServer/POAManager.pidl \
+ PortableServer/POAManagerC.h \
+ PortableServer/POAManagerFactory.h \
+ PortableServer/POAManagerFactory.pidl \
+ PortableServer/POAManagerFactory.pidl \
+ PortableServer/POAManagerFactoryC.h \
+ PortableServer/POA_Cached_Policies.h \
+ PortableServer/POA_Cached_Policies.i \
+ PortableServer/POA_Current.h \
+ PortableServer/POA_Current_Factory.h \
+ PortableServer/POA_Current_Impl.h \
+ PortableServer/POA_Current_Impl.inl \
+ PortableServer/POA_Guard.h \
+ PortableServer/POA_Policy_Set.h \
+ PortableServer/POA_Policy_Set.i \
+ PortableServer/PS_Current.pidl \
+ PortableServer/PS_Current.pidl \
+ PortableServer/PS_CurrentC.h \
+ PortableServer/PS_Forward.pidl \
+ PortableServer/PS_ForwardA.h \
+ PortableServer/PS_ForwardC.h \
+ PortableServer/PolicyS.h \
+ PortableServer/PolicyS_T.cpp \
+ PortableServer/PolicyS_T.h \
+ PortableServer/PolicyS_T.inl \
+ PortableServer/Policy_Strategy.h \
+ PortableServer/PortableServer.h \
+ PortableServer/PortableServer.pidl \
+ PortableServer/PortableServerC.h \
+ PortableServer/PortableServerS.h \
+ PortableServer/PortableServer_Functions.h \
+ PortableServer/PortableServer_WFunctions.h \
+ PortableServer/PortableServer_include.pidl \
+ PortableServer/PortableServer_includeA.h \
+ PortableServer/PortableServer_includeC.h \
+ PortableServer/PortableServer_includeS.h \
+ PortableServer/Regular_POA.h \
+ PortableServer/Regular_POA.inl \
+ PortableServer/RequestProcessingPolicy.h \
+ PortableServer/RequestProcessingPolicy.pidl \
+ PortableServer/RequestProcessingPolicy.pidl \
+ PortableServer/RequestProcessingPolicyA.h \
+ PortableServer/RequestProcessingPolicyC.h \
+ PortableServer/RequestProcessingStrategy.h \
+ PortableServer/RequestProcessingStrategyAOMOnly.h \
+ PortableServer/RequestProcessingStrategyAOMOnlyFactoryImpl.h \
+ PortableServer/RequestProcessingStrategyDefaultServant.h \
+ PortableServer/RequestProcessingStrategyDefaultServantFI.h \
+ PortableServer/RequestProcessingStrategyFactory.h \
+ PortableServer/RequestProcessingStrategyFactoryImpl.h \
+ PortableServer/RequestProcessingStrategyServantActivator.h \
+ PortableServer/RequestProcessingStrategyServantActivatorFI.h \
+ PortableServer/RequestProcessingStrategyServantLocator.h \
+ PortableServer/RequestProcessingStrategyServantLocatorFI.h \
+ PortableServer/RequestProcessingStrategyServantManager.h \
+ PortableServer/Root_POA.h \
+ PortableServer/Root_POA.inl \
+ PortableServer/SArg_Traits_T.h \
+ PortableServer/ServantActivator.pidl \
+ PortableServer/ServantActivator.pidl \
+ PortableServer/ServantActivatorA.h \
+ PortableServer/ServantActivatorC.h \
+ PortableServer/ServantLocator.pidl \
+ PortableServer/ServantLocator.pidl \
+ PortableServer/ServantLocatorA.h \
+ PortableServer/ServantLocatorC.h \
+ PortableServer/ServantManager.pidl \
+ PortableServer/ServantManager.pidl \
+ PortableServer/ServantManagerA.h \
+ PortableServer/ServantManagerC.h \
+ PortableServer/ServantRetentionPolicy.h \
+ PortableServer/ServantRetentionPolicy.pidl \
+ PortableServer/ServantRetentionPolicy.pidl \
+ PortableServer/ServantRetentionPolicyA.h \
+ PortableServer/ServantRetentionPolicyC.h \
+ PortableServer/ServantRetentionStrategy.h \
+ PortableServer/ServantRetentionStrategyFactory.h \
+ PortableServer/ServantRetentionStrategyFactoryImpl.h \
+ PortableServer/ServantRetentionStrategyNonRetain.h \
+ PortableServer/ServantRetentionStrategyNonRetainFactoryImpl.h \
+ PortableServer/ServantRetentionStrategyRetain.h \
+ PortableServer/ServantRetentionStrategyRetainFactoryImpl.h \
+ PortableServer/Servant_Base.h \
+ PortableServer/Servant_Base.i \
+ PortableServer/Servant_Dispatcher.h \
+ PortableServer/Servant_Location.h \
+ PortableServer/Servant_Upcall.h \
+ PortableServer/Servant_Upcall.inl \
+ PortableServer/Special_Basic_SArgument_T.cpp \
+ PortableServer/Special_Basic_SArgument_T.h \
+ PortableServer/Special_Basic_SArgument_T.inl \
+ PortableServer/Special_Basic_SArguments.h \
+ PortableServer/StrategyFactory.h \
+ PortableServer/ThreadPolicy.h \
+ PortableServer/ThreadPolicy.pidl \
+ PortableServer/ThreadPolicy.pidl \
+ PortableServer/ThreadPolicyA.h \
+ PortableServer/ThreadPolicyC.h \
+ PortableServer/ThreadStrategy.h \
+ PortableServer/ThreadStrategyFactory.h \
+ PortableServer/ThreadStrategyFactoryImpl.h \
+ PortableServer/ThreadStrategyORBControl.h \
+ PortableServer/ThreadStrategySingle.h \
+ PortableServer/ThreadStrategySingleFactoryImpl.h \
+ PortableServer/TypeCode_SArg_Traits.h \
+ PortableServer/UB_String_SArgument_T.cpp \
+ PortableServer/UB_String_SArgument_T.h \
+ PortableServer/UB_String_SArgument_T.inl \
+ PortableServer/UB_String_SArguments.h \
+ PortableServer/Upcall_Command.h \
+ PortableServer/Upcall_Wrapper.h \
+ PortableServer/Var_Array_SArgument_T.cpp \
+ PortableServer/Var_Array_SArgument_T.h \
+ PortableServer/Var_Array_SArgument_T.inl \
+ PortableServer/Var_Size_SArgument_T.cpp \
+ PortableServer/Var_Size_SArgument_T.h \
+ PortableServer/Var_Size_SArgument_T.inl \
+ PortableServer/get_arg.h \
+ PortableServer/poa_macros.h \
+ PortableServer/portableserver_export.h
+
+pkgconfig_DATA += \
+ TAO_PortableServer.pc
+
+CLEANFILES += \
+ TAO_PortableServer.pc
+
+TAO_PortableServer.pc: ${top_builddir}/config.status ${srcdir}/PortableServer/TAO_PortableServer.pc.in
+ ${top_builddir}/config.status --file $@:${srcdir}/PortableServer/TAO_PortableServer.pc.in
+
+EXTRA_DIST += \
+ PortableServer/TAO_PortableServer.pc.in \
+ PortableServer/TAO_PortableServer.rc
+
+
+## Makefile.CSD_Framework.am
+
+BUILT_SOURCES += \
+ CSD_Framework/CSD_FrameworkA.cpp \
+ CSD_Framework/CSD_FrameworkA.h \
+ CSD_Framework/CSD_FrameworkC.cpp \
+ CSD_Framework/CSD_FrameworkC.h
+
+CLEANFILES += \
+ CSD_Framework/CSD_Framework-stamp \
+ CSD_Framework/CSD_FrameworkA.cpp \
+ CSD_Framework/CSD_FrameworkA.h \
+ CSD_Framework/CSD_FrameworkC.cpp \
+ CSD_Framework/CSD_FrameworkC.h
+
+CSD_Framework/CSD_FrameworkA.cpp CSD_Framework/CSD_FrameworkA.h CSD_Framework/CSD_FrameworkC.cpp CSD_Framework/CSD_FrameworkC.h: CSD_Framework/CSD_Framework-stamp
+
+CSD_Framework/CSD_Framework-stamp: $(srcdir)/CSD_Framework/CSD_Framework.pidl $(TAO_IDL_DEP)
+ $(TAO_IDL) $(TAO_IDLFLAGS) -Wb,versioning_begin=TAO_BEGIN_VERSIONED_NAMESPACE_DECL -Wb,versioning_end=TAO_END_VERSIONED_NAMESPACE_DECL -Sci -SS -Gp -Gd -Ge 1 -Sorb -GA -Sal -Wb,export_macro=TAO_CSD_FW_Export -Wb,export_include=tao/CSD_Framework/CSD_FW_Export.h -o CSD_Framework $(srcdir)/CSD_Framework/CSD_Framework.pidl
+ @touch $@
+
+lib_LTLIBRARIES += libTAO_CSD_Framework.la
+
+libTAO_CSD_Framework_la_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR) \
+ -I$(TAO_ROOT) \
+ -I$(TAO_BUILDDIR) \
+ -I$(TAO_ROOT)/tao \
+ -DTAO_CSD_FW_BUILD_DLL
+
+libTAO_CSD_Framework_la_SOURCES = \
+ CSD_Framework/CSD_Default_Servant_Dispatcher.cpp \
+ CSD_Framework/CSD_FW_Server_Request_Wrapper.cpp \
+ CSD_Framework/CSD_FrameworkA.cpp \
+ CSD_Framework/CSD_FrameworkC.cpp \
+ CSD_Framework/CSD_Framework_Loader.cpp \
+ CSD_Framework/CSD_ORBInitializer.cpp \
+ CSD_Framework/CSD_Object_Adapter.cpp \
+ CSD_Framework/CSD_Object_Adapter_Factory.cpp \
+ CSD_Framework/CSD_POA.cpp \
+ CSD_Framework/CSD_Strategy_Base.cpp \
+ CSD_Framework/CSD_Strategy_Proxy.cpp \
+ CSD_Framework/CSD_Strategy_Repository.cpp
+
+libTAO_CSD_Framework_la_LDFLAGS = \
+ -version-number @TAO_MAJOR@:@TAO_MINOR@:@TAO_BETA@
+
+libTAO_CSD_Framework_la_LIBADD = \
+ libTAO_PI.la \
+ libTAO_CodecFactory.la \
+ libTAO_PortableServer.la \
+ libTAO_AnyTypeCode.la \
+ libTAO.la \
+ $(ACE_BUILDDIR)/ace/libACE.la
+
+nobase_include_HEADERS += \
+ CSD_Framework/CSD_Default_Servant_Dispatcher.h \
+ CSD_Framework/CSD_FW_Export.h \
+ CSD_Framework/CSD_FW_Server_Request_Wrapper.h \
+ CSD_Framework/CSD_FW_Server_Request_Wrapper.inl \
+ CSD_Framework/CSD_Framework.pidl \
+ CSD_Framework/CSD_Framework.pidl \
+ CSD_Framework/CSD_FrameworkA.h \
+ CSD_Framework/CSD_FrameworkC.h \
+ CSD_Framework/CSD_Framework_Loader.h \
+ CSD_Framework/CSD_ORBInitializer.h \
+ CSD_Framework/CSD_Object_Adapter.h \
+ CSD_Framework/CSD_Object_Adapter_Factory.h \
+ CSD_Framework/CSD_POA.h \
+ CSD_Framework/CSD_POA.inl \
+ CSD_Framework/CSD_Strategy_Base.h \
+ CSD_Framework/CSD_Strategy_Base.inl \
+ CSD_Framework/CSD_Strategy_Proxy.h \
+ CSD_Framework/CSD_Strategy_Proxy.inl \
+ CSD_Framework/CSD_Strategy_Repository.h
+
+pkgconfig_DATA += \
+ TAO_CSD_Framework.pc
+
+CLEANFILES += \
+ TAO_CSD_Framework.pc
+
+TAO_CSD_Framework.pc: ${top_builddir}/config.status ${srcdir}/CSD_Framework/TAO_CSD_Framework.pc.in
+ ${top_builddir}/config.status --file $@:${srcdir}/CSD_Framework/TAO_CSD_Framework.pc.in
+
+EXTRA_DIST += \
+ CSD_Framework/TAO_CSD_Framework.pc.in
+
+
+## Makefile.CSD_ThreadPool.am
+
+lib_LTLIBRARIES += libTAO_CSD_ThreadPool.la
+
+libTAO_CSD_ThreadPool_la_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR) \
+ -I$(TAO_ROOT) \
+ -I$(TAO_BUILDDIR) \
+ -I$(TAO_ROOT)/tao \
+ -DTAO_CSD_TP_BUILD_DLL
+
+libTAO_CSD_ThreadPool_la_SOURCES = \
+ CSD_ThreadPool/CSD_TP_Cancel_Visitor.cpp \
+ CSD_ThreadPool/CSD_TP_Collocated_Asynch_Request.cpp \
+ CSD_ThreadPool/CSD_TP_Collocated_Synch_Request.cpp \
+ CSD_ThreadPool/CSD_TP_Collocated_Synch_With_Server_Request.cpp \
+ CSD_ThreadPool/CSD_TP_Corba_Request.cpp \
+ CSD_ThreadPool/CSD_TP_Custom_Asynch_Request.cpp \
+ CSD_ThreadPool/CSD_TP_Custom_Request.cpp \
+ CSD_ThreadPool/CSD_TP_Custom_Request_Operation.cpp \
+ CSD_ThreadPool/CSD_TP_Custom_Synch_Request.cpp \
+ CSD_ThreadPool/CSD_TP_Dispatchable_Visitor.cpp \
+ CSD_ThreadPool/CSD_TP_Queue.cpp \
+ CSD_ThreadPool/CSD_TP_Queue_Visitor.cpp \
+ CSD_ThreadPool/CSD_TP_Remote_Request.cpp \
+ CSD_ThreadPool/CSD_TP_Request.cpp \
+ CSD_ThreadPool/CSD_TP_Servant_State.cpp \
+ CSD_ThreadPool/CSD_TP_Servant_State_Map.cpp \
+ CSD_ThreadPool/CSD_TP_Strategy.cpp \
+ CSD_ThreadPool/CSD_TP_Strategy_Factory.cpp \
+ CSD_ThreadPool/CSD_TP_Synch_Helper.cpp \
+ CSD_ThreadPool/CSD_TP_Task.cpp \
+ CSD_ThreadPool/CSD_ThreadPool.cpp
+
+libTAO_CSD_ThreadPool_la_LDFLAGS = \
+ -version-number @TAO_MAJOR@:@TAO_MINOR@:@TAO_BETA@
+
+libTAO_CSD_ThreadPool_la_LIBADD = \
+ libTAO_CSD_Framework.la \
+ libTAO_PI.la \
+ libTAO_CodecFactory.la \
+ libTAO_PortableServer.la \
+ libTAO_AnyTypeCode.la \
+ libTAO.la \
+ $(ACE_BUILDDIR)/ace/libACE.la
+
+nobase_include_HEADERS += \
+ CSD_ThreadPool/CSD_TP_Cancel_Visitor.h \
+ CSD_ThreadPool/CSD_TP_Cancel_Visitor.inl \
+ CSD_ThreadPool/CSD_TP_Collocated_Asynch_Request.h \
+ CSD_ThreadPool/CSD_TP_Collocated_Asynch_Request.inl \
+ CSD_ThreadPool/CSD_TP_Collocated_Synch_Request.h \
+ CSD_ThreadPool/CSD_TP_Collocated_Synch_Request.inl \
+ CSD_ThreadPool/CSD_TP_Collocated_Synch_With_Server_Request.h \
+ CSD_ThreadPool/CSD_TP_Collocated_Synch_With_Server_Request.inl \
+ CSD_ThreadPool/CSD_TP_Corba_Request.h \
+ CSD_ThreadPool/CSD_TP_Corba_Request.inl \
+ CSD_ThreadPool/CSD_TP_Custom_Asynch_Request.h \
+ CSD_ThreadPool/CSD_TP_Custom_Asynch_Request.inl \
+ CSD_ThreadPool/CSD_TP_Custom_Request.h \
+ CSD_ThreadPool/CSD_TP_Custom_Request.inl \
+ CSD_ThreadPool/CSD_TP_Custom_Request_Operation.h \
+ CSD_ThreadPool/CSD_TP_Custom_Request_Operation.inl \
+ CSD_ThreadPool/CSD_TP_Custom_Synch_Request.h \
+ CSD_ThreadPool/CSD_TP_Custom_Synch_Request.inl \
+ CSD_ThreadPool/CSD_TP_Dispatchable_Visitor.h \
+ CSD_ThreadPool/CSD_TP_Dispatchable_Visitor.inl \
+ CSD_ThreadPool/CSD_TP_Export.h \
+ CSD_ThreadPool/CSD_TP_Queue.h \
+ CSD_ThreadPool/CSD_TP_Queue.inl \
+ CSD_ThreadPool/CSD_TP_Queue_Visitor.h \
+ CSD_ThreadPool/CSD_TP_Queue_Visitor.inl \
+ CSD_ThreadPool/CSD_TP_Remote_Request.h \
+ CSD_ThreadPool/CSD_TP_Remote_Request.inl \
+ CSD_ThreadPool/CSD_TP_Request.h \
+ CSD_ThreadPool/CSD_TP_Request.inl \
+ CSD_ThreadPool/CSD_TP_Servant_State.h \
+ CSD_ThreadPool/CSD_TP_Servant_State.inl \
+ CSD_ThreadPool/CSD_TP_Servant_State_Map.h \
+ CSD_ThreadPool/CSD_TP_Servant_State_Map.inl \
+ CSD_ThreadPool/CSD_TP_Strategy.h \
+ CSD_ThreadPool/CSD_TP_Strategy.inl \
+ CSD_ThreadPool/CSD_TP_Strategy_Factory.h \
+ CSD_ThreadPool/CSD_TP_Synch_Helper.h \
+ CSD_ThreadPool/CSD_TP_Synch_Helper.inl \
+ CSD_ThreadPool/CSD_TP_Task.h \
+ CSD_ThreadPool/CSD_TP_Task.inl \
+ CSD_ThreadPool/CSD_ThreadPool.h
+
+pkgconfig_DATA += \
+ TAO_CSD_ThreadPool.pc
+
+CLEANFILES += \
+ TAO_CSD_ThreadPool.pc
+
+TAO_CSD_ThreadPool.pc: ${top_builddir}/config.status ${srcdir}/CSD_ThreadPool/TAO_CSD_ThreadPool.pc.in
+ ${top_builddir}/config.status --file $@:${srcdir}/CSD_ThreadPool/TAO_CSD_ThreadPool.pc.in
+
+EXTRA_DIST += \
+ CSD_ThreadPool/TAO_CSD_ThreadPool.pc.in
+
+
+## Makefile.IFR_Client.am
+
+BUILT_SOURCES += \
+ IFR_Client/IFR_BaseC.cpp \
+ IFR_Client/IFR_BaseC.h \
+ IFR_Client/IFR_BaseC.inl
+
+CLEANFILES += \
+ IFR_Client/IFR_Base-stamp \
+ IFR_Client/IFR_BaseC.cpp \
+ IFR_Client/IFR_BaseC.h \
+ IFR_Client/IFR_BaseC.inl
+
+IFR_Client/IFR_BaseC.cpp IFR_Client/IFR_BaseC.h IFR_Client/IFR_BaseC.inl: IFR_Client/IFR_Base-stamp
+
+IFR_Client/IFR_Base-stamp: $(srcdir)/IFR_Client/IFR_Base.pidl $(TAO_IDL_DEP)
+ $(TAO_IDL) $(TAO_IDLFLAGS) -Wb,versioning_begin=TAO_BEGIN_VERSIONED_NAMESPACE_DECL -Wb,versioning_end=TAO_END_VERSIONED_NAMESPACE_DECL -SS -Ge 1 -Sorb -Wb,export_macro=TAO_IFR_Client_Export -Wb,export_include=tao/IFR_Client/ifr_client_export.h -o IFR_Client $(srcdir)/IFR_Client/IFR_Base.pidl
+ @touch $@
+
+BUILT_SOURCES += \
+ IFR_Client/IFR_BasicC.cpp \
+ IFR_Client/IFR_BasicC.h \
+ IFR_Client/IFR_BasicC.inl
+
+CLEANFILES += \
+ IFR_Client/IFR_Basic-stamp \
+ IFR_Client/IFR_BasicC.cpp \
+ IFR_Client/IFR_BasicC.h \
+ IFR_Client/IFR_BasicC.inl
+
+IFR_Client/IFR_BasicC.cpp IFR_Client/IFR_BasicC.h IFR_Client/IFR_BasicC.inl: IFR_Client/IFR_Basic-stamp
+
+IFR_Client/IFR_Basic-stamp: $(srcdir)/IFR_Client/IFR_Basic.pidl $(TAO_IDL_DEP)
+ $(TAO_IDL) $(TAO_IDLFLAGS) -Wb,versioning_begin=TAO_BEGIN_VERSIONED_NAMESPACE_DECL -Wb,versioning_end=TAO_END_VERSIONED_NAMESPACE_DECL -SS -Ge 1 -Sorb -Wb,export_macro=TAO_IFR_Client_Export -Wb,export_include=tao/IFR_Client/ifr_client_export.h -o IFR_Client $(srcdir)/IFR_Client/IFR_Basic.pidl
+ @touch $@
+
+BUILT_SOURCES += \
+ IFR_Client/IFR_ComponentsC.cpp \
+ IFR_Client/IFR_ComponentsC.h \
+ IFR_Client/IFR_ComponentsC.inl
+
+CLEANFILES += \
+ IFR_Client/IFR_Components-stamp \
+ IFR_Client/IFR_ComponentsC.cpp \
+ IFR_Client/IFR_ComponentsC.h \
+ IFR_Client/IFR_ComponentsC.inl
+
+IFR_Client/IFR_ComponentsC.cpp IFR_Client/IFR_ComponentsC.h IFR_Client/IFR_ComponentsC.inl: IFR_Client/IFR_Components-stamp
+
+IFR_Client/IFR_Components-stamp: $(srcdir)/IFR_Client/IFR_Components.pidl $(TAO_IDL_DEP)
+ $(TAO_IDL) $(TAO_IDLFLAGS) -Wb,versioning_begin=TAO_BEGIN_VERSIONED_NAMESPACE_DECL -Wb,versioning_end=TAO_END_VERSIONED_NAMESPACE_DECL -SS -Ge 1 -Sorb -Wb,export_macro=TAO_IFR_Client_Export -Wb,export_include=tao/IFR_Client/ifr_client_export.h -o IFR_Client $(srcdir)/IFR_Client/IFR_Components.pidl
+ @touch $@
+
+BUILT_SOURCES += \
+ IFR_Client/IFR_ExtendedC.cpp \
+ IFR_Client/IFR_ExtendedC.h \
+ IFR_Client/IFR_ExtendedC.inl
+
+CLEANFILES += \
+ IFR_Client/IFR_Extended-stamp \
+ IFR_Client/IFR_ExtendedC.cpp \
+ IFR_Client/IFR_ExtendedC.h \
+ IFR_Client/IFR_ExtendedC.inl
+
+IFR_Client/IFR_ExtendedC.cpp IFR_Client/IFR_ExtendedC.h IFR_Client/IFR_ExtendedC.inl: IFR_Client/IFR_Extended-stamp
+
+IFR_Client/IFR_Extended-stamp: $(srcdir)/IFR_Client/IFR_Extended.pidl $(TAO_IDL_DEP)
+ $(TAO_IDL) $(TAO_IDLFLAGS) -Wb,versioning_begin=TAO_BEGIN_VERSIONED_NAMESPACE_DECL -Wb,versioning_end=TAO_END_VERSIONED_NAMESPACE_DECL -SS -Ge 1 -Sorb -Wb,export_macro=TAO_IFR_Client_Export -Wb,export_include=tao/IFR_Client/ifr_client_export.h -o IFR_Client $(srcdir)/IFR_Client/IFR_Extended.pidl
+ @touch $@
+
+lib_LTLIBRARIES += libTAO_IFR_Client.la
+
+libTAO_IFR_Client_la_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR) \
+ -I$(TAO_ROOT) \
+ -I$(TAO_BUILDDIR) \
+ -DTAO_IFR_CLIENT_BUILD_DLL
+
+libTAO_IFR_Client_la_SOURCES = \
+ IFR_Client/IFR_BaseC.cpp \
+ IFR_Client/IFR_BasicC.cpp \
+ IFR_Client/IFR_Client_Adapter_Impl.cpp \
+ IFR_Client/IFR_ComponentsC.cpp \
+ IFR_Client/IFR_ExtendedC.cpp
+
+libTAO_IFR_Client_la_LDFLAGS = \
+ -version-number @TAO_MAJOR@:@TAO_MINOR@:@TAO_BETA@
+
+libTAO_IFR_Client_la_LIBADD = \
+ libTAO_AnyTypeCode.la \
+ libTAO.la \
+ $(ACE_BUILDDIR)/ace/libACE.la
+
+nobase_include_HEADERS += \
+ IFR_Client/IFR_Base.pidl \
+ IFR_Client/IFR_Base.pidl \
+ IFR_Client/IFR_BaseA.h \
+ IFR_Client/IFR_BaseC.h \
+ IFR_Client/IFR_BaseC.inl \
+ IFR_Client/IFR_Basic.pidl \
+ IFR_Client/IFR_Basic.pidl \
+ IFR_Client/IFR_BasicA.h \
+ IFR_Client/IFR_BasicC.h \
+ IFR_Client/IFR_BasicC.inl \
+ IFR_Client/IFR_Client_Adapter_Impl.h \
+ IFR_Client/IFR_Components.pidl \
+ IFR_Client/IFR_Components.pidl \
+ IFR_Client/IFR_ComponentsA.h \
+ IFR_Client/IFR_ComponentsC.h \
+ IFR_Client/IFR_ComponentsC.inl \
+ IFR_Client/IFR_Extended.pidl \
+ IFR_Client/IFR_Extended.pidl \
+ IFR_Client/IFR_ExtendedA.h \
+ IFR_Client/IFR_ExtendedC.h \
+ IFR_Client/IFR_ExtendedC.inl \
+ IFR_Client/ifr_client_export.h
+
+pkgconfig_DATA += \
+ TAO_IFR_Client.pc
+
+CLEANFILES += \
+ TAO_IFR_Client.pc
+
+TAO_IFR_Client.pc: ${top_builddir}/config.status ${srcdir}/IFR_Client/TAO_IFR_Client.pc.in
+ ${top_builddir}/config.status --file $@:${srcdir}/IFR_Client/TAO_IFR_Client.pc.in
+
+EXTRA_DIST += \
+ IFR_Client/TAO_IFR_Client.pc.in \
+ IFR_Client/TAO_IFR_Client.rc
+
+
+## Makefile.Domain.am
+
+lib_LTLIBRARIES += libTAO_Domain.la
+
+libTAO_Domain_la_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR) \
+ -I$(TAO_ROOT) \
+ -I$(TAO_BUILDDIR) \
+ -DTAO_DOMAIN_BUILD_DLL
+
+libTAO_Domain_la_SOURCES = \
+ Domain/DomainS.cpp
+
+libTAO_Domain_la_LDFLAGS = \
+ -version-number @TAO_MAJOR@:@TAO_MINOR@:@TAO_BETA@
+
+libTAO_Domain_la_LIBADD = \
+ libTAO_PortableServer.la \
+ libTAO_IFR_Client.la \
+ libTAO_AnyTypeCode.la \
+ libTAO.la \
+ $(ACE_BUILDDIR)/ace/libACE.la
+
+nobase_include_HEADERS += \
+ Domain/DomainS.h \
+ Domain/DomainS.inl \
+ Domain/DomainS_T.cpp \
+ Domain/DomainS_T.h \
+ Domain/DomainS_T.inl \
+ Domain/domain_export.h
+
+pkgconfig_DATA += \
+ TAO_Domain.pc
+
+CLEANFILES += \
+ TAO_Domain.pc
+
+TAO_Domain.pc: ${top_builddir}/config.status ${srcdir}/Domain/TAO_Domain.pc.in
+ ${top_builddir}/config.status --file $@:${srcdir}/Domain/TAO_Domain.pc.in
+
+EXTRA_DIST += \
+ Domain/TAO_Domain.pc.in \
+ Domain/TAO_Domain.rc
+
+
+## Makefile.DynamicAny.am
+
+lib_LTLIBRARIES += libTAO_DynamicAny.la
+
+libTAO_DynamicAny_la_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR) \
+ -I$(TAO_ROOT) \
+ -I$(TAO_BUILDDIR) \
+ -DTAO_DYNAMICANY_BUILD_DLL
+
+libTAO_DynamicAny_la_SOURCES = \
+ DynamicAny/DynAnyFactory.cpp \
+ DynamicAny/DynAny_i.cpp \
+ DynamicAny/DynArray_i.cpp \
+ DynamicAny/DynCommon.cpp \
+ DynamicAny/DynEnum_i.cpp \
+ DynamicAny/DynSequence_i.cpp \
+ DynamicAny/DynStruct_i.cpp \
+ DynamicAny/DynUnion_i.cpp \
+ DynamicAny/DynamicAny.cpp \
+ DynamicAny/DynamicAnyC.cpp
+
+libTAO_DynamicAny_la_LDFLAGS = \
+ -version-number @TAO_MAJOR@:@TAO_MINOR@:@TAO_BETA@
+
+libTAO_DynamicAny_la_LIBADD = \
+ libTAO_AnyTypeCode.la \
+ libTAO.la \
+ $(ACE_BUILDDIR)/ace/libACE.la
+
+nobase_include_HEADERS += \
+ DynamicAny/DynAnyFactory.h \
+ DynamicAny/DynAny_i.h \
+ DynamicAny/DynArray_i.h \
+ DynamicAny/DynCommon.h \
+ DynamicAny/DynEnum_i.h \
+ DynamicAny/DynSequence_i.h \
+ DynamicAny/DynStruct_i.h \
+ DynamicAny/DynUnion_i.h \
+ DynamicAny/DynamicAny.h \
+ DynamicAny/DynamicAny.pidl \
+ DynamicAny/DynamicAnyC.h \
+ DynamicAny/dynamicany_export.h
+
+pkgconfig_DATA += \
+ TAO_DynamicAny.pc
+
+CLEANFILES += \
+ TAO_DynamicAny.pc
+
+TAO_DynamicAny.pc: ${top_builddir}/config.status ${srcdir}/DynamicAny/TAO_DynamicAny.pc.in
+ ${top_builddir}/config.status --file $@:${srcdir}/DynamicAny/TAO_DynamicAny.pc.in
+
+EXTRA_DIST += \
+ DynamicAny/TAO_DynamicAny.pc.in \
+ DynamicAny/TAO_DynamicAny.rc
+
+
+## Makefile.Valuetype.am
+
+BUILT_SOURCES += \
+ Valuetype/StringValueC.cpp \
+ Valuetype/StringValueC.h \
+ Valuetype/StringValueC.inl
+
+CLEANFILES += \
+ Valuetype/StringValue-stamp \
+ Valuetype/StringValueC.cpp \
+ Valuetype/StringValueC.h \
+ Valuetype/StringValueC.inl
+
+Valuetype/StringValueC.cpp Valuetype/StringValueC.h Valuetype/StringValueC.inl: Valuetype/StringValue-stamp
+
+Valuetype/StringValue-stamp: $(srcdir)/Valuetype/StringValue.pidl $(TAO_IDL_DEP)
+ $(TAO_IDL) $(TAO_IDLFLAGS) -Sa -Wb,versioning_begin=TAO_BEGIN_VERSIONED_NAMESPACE_DECL -Wb,versioning_end=TAO_END_VERSIONED_NAMESPACE_DECL -SS -Ge 1 -Sorb -Wb,export_macro=TAO_Valuetype_Export -Wb,export_include=tao/Valuetype/valuetype_export.h -o Valuetype $(srcdir)/Valuetype/StringValue.pidl
+ @touch $@
+
+lib_LTLIBRARIES += libTAO_Valuetype.la
+
+libTAO_Valuetype_la_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR) \
+ -I$(TAO_ROOT) \
+ -I$(TAO_BUILDDIR) \
+ -DTAO_VALUETYPE_BUILD_DLL
+
+libTAO_Valuetype_la_SOURCES = \
+ Valuetype/AbstractBase.cpp \
+ Valuetype/AbstractBase_Invocation_Adapter.cpp \
+ Valuetype/StringValueC.cpp \
+ Valuetype/ValueBase.cpp \
+ Valuetype/ValueFactory.cpp \
+ Valuetype/ValueFactory_Map.cpp \
+ Valuetype/Valuetype_Adapter_Factory_Impl.cpp \
+ Valuetype/Valuetype_Adapter_Impl.cpp
+
+libTAO_Valuetype_la_LDFLAGS = \
+ -version-number @TAO_MAJOR@:@TAO_MINOR@:@TAO_BETA@
+
+libTAO_Valuetype_la_LIBADD = \
+ libTAO_AnyTypeCode.la \
+ libTAO.la \
+ $(ACE_BUILDDIR)/ace/libACE.la
+
+nobase_include_HEADERS += \
+ Valuetype/AbstractBase.h \
+ Valuetype/AbstractBase.inl \
+ Valuetype/AbstractBase_Invocation_Adapter.h \
+ Valuetype/AbstractBase_T.cpp \
+ Valuetype/AbstractBase_T.h \
+ Valuetype/Bounded_Valuetype_Allocation_Traits_T.h \
+ Valuetype/Bounded_Valuetype_Sequence_T.h \
+ Valuetype/Sequence_T.h \
+ Valuetype/StringValue.pidl \
+ Valuetype/StringValueC.h \
+ Valuetype/StringValueC.inl \
+ Valuetype/Unbounded_Valuetype_Allocation_Traits_T.h \
+ Valuetype/Unbounded_Valuetype_Sequence_T.h \
+ Valuetype/ValueBase.h \
+ Valuetype/ValueBase.inl \
+ Valuetype/ValueFactory.h \
+ Valuetype/ValueFactory_Map.h \
+ Valuetype/Value_CORBA_methods.h \
+ Valuetype/Value_VarOut_T.cpp \
+ Valuetype/Value_VarOut_T.h \
+ Valuetype/Valuetype_Adapter_Factory_Impl.h \
+ Valuetype/Valuetype_Adapter_Impl.h \
+ Valuetype/Valuetype_Sequence_Element_T.h \
+ Valuetype/Valuetype_Traits_Base_T.h \
+ Valuetype/Valuetype_Traits_T.h \
+ Valuetype/valuetype_export.h
+
+pkgconfig_DATA += \
+ TAO_Valuetype.pc
+
+CLEANFILES += \
+ TAO_Valuetype.pc
+
+TAO_Valuetype.pc: ${top_builddir}/config.status ${srcdir}/Valuetype/TAO_Valuetype.pc.in
+ ${top_builddir}/config.status --file $@:${srcdir}/Valuetype/TAO_Valuetype.pc.in
+
+EXTRA_DIST += \
+ Valuetype/TAO_Valuetype.pc.in \
+ Valuetype/TAO_Valuetype.rc
+
+
+## Makefile.Messaging.am
+
+BUILT_SOURCES += \
+ Messaging/ExceptionHolderA.cpp \
+ Messaging/ExceptionHolderA.h \
+ Messaging/ExceptionHolderC.cpp \
+ Messaging/ExceptionHolderC.h \
+ Messaging/ExceptionHolderC.inl
+
+CLEANFILES += \
+ Messaging/ExceptionHolder-stamp \
+ Messaging/ExceptionHolderA.cpp \
+ Messaging/ExceptionHolderA.h \
+ Messaging/ExceptionHolderC.cpp \
+ Messaging/ExceptionHolderC.h \
+ Messaging/ExceptionHolderC.inl
+
+Messaging/ExceptionHolderA.cpp Messaging/ExceptionHolderA.h Messaging/ExceptionHolderC.cpp Messaging/ExceptionHolderC.h Messaging/ExceptionHolderC.inl: Messaging/ExceptionHolder-stamp
+
+Messaging/ExceptionHolder-stamp: $(srcdir)/Messaging/ExceptionHolder.pidl $(TAO_IDL_DEP)
+ $(TAO_IDL) $(TAO_IDLFLAGS) -Wb,versioning_begin=TAO_BEGIN_VERSIONED_NAMESPACE_DECL -Wb,versioning_end=TAO_END_VERSIONED_NAMESPACE_DECL -SS -GA -Gp -Gd -Ge 1 -Sc -Sorb -Sal -Wb,export_macro=TAO_Messaging_Export -Wb,export_include=tao/Messaging/messaging_export.h -o Messaging $(srcdir)/Messaging/ExceptionHolder.pidl
+ @touch $@
+
+BUILT_SOURCES += \
+ Messaging/PollableC.cpp \
+ Messaging/PollableC.h
+
+CLEANFILES += \
+ Messaging/Pollable-stamp \
+ Messaging/PollableC.cpp \
+ Messaging/PollableC.h
+
+Messaging/PollableC.cpp Messaging/PollableC.h: Messaging/Pollable-stamp
+
+Messaging/Pollable-stamp: $(srcdir)/Messaging/Pollable.pidl $(TAO_IDL_DEP)
+ $(TAO_IDL) $(TAO_IDLFLAGS) -Wb,versioning_begin=TAO_BEGIN_VERSIONED_NAMESPACE_DECL -Wb,versioning_end=TAO_END_VERSIONED_NAMESPACE_DECL -Sci -SS -Gp -Gd -Ge 1 -Sc -Sorb -Sal -Wb,export_macro=TAO_Messaging_Export -Wb,export_include=tao/Messaging/messaging_export.h -o Messaging $(srcdir)/Messaging/Pollable.pidl
+ @touch $@
+
+BUILT_SOURCES += \
+ Messaging/TAO_ExtA.cpp \
+ Messaging/TAO_ExtA.h \
+ Messaging/TAO_ExtC.cpp \
+ Messaging/TAO_ExtC.h
+
+CLEANFILES += \
+ Messaging/TAO_Ext-stamp \
+ Messaging/TAO_ExtA.cpp \
+ Messaging/TAO_ExtA.h \
+ Messaging/TAO_ExtC.cpp \
+ Messaging/TAO_ExtC.h
+
+Messaging/TAO_ExtA.cpp Messaging/TAO_ExtA.h Messaging/TAO_ExtC.cpp Messaging/TAO_ExtC.h: Messaging/TAO_Ext-stamp
+
+Messaging/TAO_Ext-stamp: $(srcdir)/Messaging/TAO_Ext.pidl $(TAO_IDL_DEP)
+ $(TAO_IDL) $(TAO_IDLFLAGS) -Wb,versioning_begin=TAO_BEGIN_VERSIONED_NAMESPACE_DECL -Wb,versioning_end=TAO_END_VERSIONED_NAMESPACE_DECL -Sci -SS -GA -Gp -Gd -Ge 1 -Sc -Sorb -Sal -Wb,export_macro=TAO_Messaging_Export -Wb,export_include=tao/Messaging/messaging_export.h -o Messaging $(srcdir)/Messaging/TAO_Ext.pidl
+ @touch $@
+
+BUILT_SOURCES += \
+ Messaging/Messaging_RT_PolicyA.cpp \
+ Messaging/Messaging_RT_PolicyA.h \
+ Messaging/Messaging_RT_PolicyC.cpp \
+ Messaging/Messaging_RT_PolicyC.h
+
+CLEANFILES += \
+ Messaging/Messaging_RT_Policy-stamp \
+ Messaging/Messaging_RT_PolicyA.cpp \
+ Messaging/Messaging_RT_PolicyA.h \
+ Messaging/Messaging_RT_PolicyC.cpp \
+ Messaging/Messaging_RT_PolicyC.h
+
+Messaging/Messaging_RT_PolicyA.cpp Messaging/Messaging_RT_PolicyA.h Messaging/Messaging_RT_PolicyC.cpp Messaging/Messaging_RT_PolicyC.h: Messaging/Messaging_RT_Policy-stamp
+
+Messaging/Messaging_RT_Policy-stamp: $(srcdir)/Messaging/Messaging_RT_Policy.pidl $(TAO_IDL_DEP)
+ $(TAO_IDL) $(TAO_IDLFLAGS) -Wb,versioning_begin=TAO_BEGIN_VERSIONED_NAMESPACE_DECL -Wb,versioning_end=TAO_END_VERSIONED_NAMESPACE_DECL -Sci -SS -GA -Gp -Gd -Ge 1 -Sc -Sorb -Sal -Wb,export_macro=TAO_Messaging_Export -Wb,export_include=tao/Messaging/messaging_export.h -o Messaging $(srcdir)/Messaging/Messaging_RT_Policy.pidl
+ @touch $@
+
+BUILT_SOURCES += \
+ Messaging/Messaging_SyncScope_PolicyA.cpp \
+ Messaging/Messaging_SyncScope_PolicyA.h \
+ Messaging/Messaging_SyncScope_PolicyC.cpp \
+ Messaging/Messaging_SyncScope_PolicyC.h
+
+CLEANFILES += \
+ Messaging/Messaging_SyncScope_Policy-stamp \
+ Messaging/Messaging_SyncScope_PolicyA.cpp \
+ Messaging/Messaging_SyncScope_PolicyA.h \
+ Messaging/Messaging_SyncScope_PolicyC.cpp \
+ Messaging/Messaging_SyncScope_PolicyC.h
+
+Messaging/Messaging_SyncScope_PolicyA.cpp Messaging/Messaging_SyncScope_PolicyA.h Messaging/Messaging_SyncScope_PolicyC.cpp Messaging/Messaging_SyncScope_PolicyC.h: Messaging/Messaging_SyncScope_Policy-stamp
+
+Messaging/Messaging_SyncScope_Policy-stamp: $(srcdir)/Messaging/Messaging_SyncScope_Policy.pidl $(TAO_IDL_DEP)
+ $(TAO_IDL) $(TAO_IDLFLAGS) -Wb,versioning_begin=TAO_BEGIN_VERSIONED_NAMESPACE_DECL -Wb,versioning_end=TAO_END_VERSIONED_NAMESPACE_DECL -Sci -SS -GA -Gp -Gd -Ge 1 -Sc -Sorb -Sal -Wb,export_macro=TAO_Messaging_Export -Wb,export_include=tao/Messaging/messaging_export.h -o Messaging $(srcdir)/Messaging/Messaging_SyncScope_Policy.pidl
+ @touch $@
+
+lib_LTLIBRARIES += libTAO_Messaging.la
+
+libTAO_Messaging_la_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR) \
+ -I$(TAO_ROOT) \
+ -I$(TAO_BUILDDIR) \
+ -DTAO_MESSAGING_BUILD_DLL
+
+libTAO_Messaging_la_SOURCES = \
+ Messaging/AMH_Response_Handler.cpp \
+ Messaging/Asynch_Invocation.cpp \
+ Messaging/Asynch_Invocation_Adapter.cpp \
+ Messaging/Asynch_Reply_Dispatcher.cpp \
+ Messaging/Asynch_Timeout_Handler.cpp \
+ Messaging/Connection_Timeout_Policy_i.cpp \
+ Messaging/ExceptionHolderA.cpp \
+ Messaging/ExceptionHolderC.cpp \
+ Messaging/ExceptionHolder_i.cpp \
+ Messaging/Messaging.cpp \
+ Messaging/MessagingA.cpp \
+ Messaging/MessagingC.cpp \
+ Messaging/MessagingS.cpp \
+ Messaging/Messaging_Loader.cpp \
+ Messaging/Messaging_No_ImplA.cpp \
+ Messaging/Messaging_No_ImplC.cpp \
+ Messaging/Messaging_ORBInitializer.cpp \
+ Messaging/Messaging_PolicyFactory.cpp \
+ Messaging/Messaging_Policy_i.cpp \
+ Messaging/Messaging_RT_PolicyA.cpp \
+ Messaging/Messaging_RT_PolicyC.cpp \
+ Messaging/Messaging_SyncScope_PolicyA.cpp \
+ Messaging/Messaging_SyncScope_PolicyC.cpp \
+ Messaging/PollableC.cpp \
+ Messaging/TAO_ExtA.cpp \
+ Messaging/TAO_ExtC.cpp
+
+libTAO_Messaging_la_LDFLAGS = \
+ -version-number @TAO_MAJOR@:@TAO_MINOR@:@TAO_BETA@
+
+libTAO_Messaging_la_LIBADD = \
+ libTAO_Valuetype.la \
+ libTAO_PI.la \
+ libTAO_CodecFactory.la \
+ libTAO_PortableServer.la \
+ libTAO_AnyTypeCode.la \
+ libTAO.la \
+ $(ACE_BUILDDIR)/ace/libACE.la
+
+nobase_include_HEADERS += \
+ Messaging/AMH_Response_Handler.h \
+ Messaging/Asynch_Invocation.h \
+ Messaging/Asynch_Invocation_Adapter.h \
+ Messaging/Asynch_Reply_Dispatcher.h \
+ Messaging/Asynch_Timeout_Handler.h \
+ Messaging/Connection_Timeout_Policy_i.h \
+ Messaging/ExceptionHolder.pidl \
+ Messaging/ExceptionHolder.pidl \
+ Messaging/ExceptionHolderA.h \
+ Messaging/ExceptionHolderC.h \
+ Messaging/ExceptionHolderC.inl \
+ Messaging/ExceptionHolder_i.h \
+ Messaging/Messaging.h \
+ Messaging/Messaging.pidl \
+ Messaging/MessagingA.h \
+ Messaging/MessagingC.h \
+ Messaging/MessagingC.inl \
+ Messaging/MessagingS.h \
+ Messaging/MessagingS_T.cpp \
+ Messaging/MessagingS_T.h \
+ Messaging/MessagingS_T.inl \
+ Messaging/Messaging_Loader.h \
+ Messaging/Messaging_No_Impl.pidl \
+ Messaging/Messaging_No_ImplA.h \
+ Messaging/Messaging_No_ImplC.h \
+ Messaging/Messaging_ORBInitializer.h \
+ Messaging/Messaging_PolicyFactory.h \
+ Messaging/Messaging_Policy_i.h \
+ Messaging/Messaging_Policy_i.i \
+ Messaging/Messaging_RT_Policy.pidl \
+ Messaging/Messaging_RT_Policy.pidl \
+ Messaging/Messaging_RT_PolicyA.h \
+ Messaging/Messaging_RT_PolicyC.h \
+ Messaging/Messaging_SyncScope_Policy.pidl \
+ Messaging/Messaging_SyncScope_Policy.pidl \
+ Messaging/Messaging_SyncScope_PolicyA.h \
+ Messaging/Messaging_SyncScope_PolicyC.h \
+ Messaging/Pollable.pidl \
+ Messaging/Pollable.pidl \
+ Messaging/PollableC.h \
+ Messaging/TAO_Ext.pidl \
+ Messaging/TAO_Ext.pidl \
+ Messaging/TAO_ExtA.h \
+ Messaging/TAO_ExtC.h \
+ Messaging/messaging_export.h
+
+pkgconfig_DATA += \
+ TAO_Messaging.pc
+
+CLEANFILES += \
+ TAO_Messaging.pc
+
+TAO_Messaging.pc: ${top_builddir}/config.status ${srcdir}/Messaging/TAO_Messaging.pc.in
+ ${top_builddir}/config.status --file $@:${srcdir}/Messaging/TAO_Messaging.pc.in
+
+EXTRA_DIST += \
+ Messaging/TAO_Messaging.pc.in \
+ Messaging/TAO_Messaging.rc
+
+
+## Makefile.DynamicInterface.am
+
+if BUILD_CORBA_MESSAGING
+
+lib_LTLIBRARIES += libTAO_DynamicInterface.la
+
+libTAO_DynamicInterface_la_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR) \
+ -I$(TAO_ROOT) \
+ -I$(TAO_BUILDDIR) \
+ -DTAO_DYNAMICINTERFACE_BUILD_DLL
+
+libTAO_DynamicInterface_la_SOURCES = \
+ DynamicInterface/Context.cpp \
+ DynamicInterface/DII_Arguments.cpp \
+ DynamicInterface/DII_Invocation.cpp \
+ DynamicInterface/DII_Invocation_Adapter.cpp \
+ DynamicInterface/DII_Reply_Dispatcher.cpp \
+ DynamicInterface/Dynamic_Adapter_Impl.cpp \
+ DynamicInterface/Dynamic_Implementation.cpp \
+ DynamicInterface/ExceptionList.cpp \
+ DynamicInterface/Request.cpp \
+ DynamicInterface/Server_Request.cpp \
+ DynamicInterface/Unknown_User_Exception.cpp
+
+libTAO_DynamicInterface_la_LDFLAGS = \
+ -version-number @TAO_MAJOR@:@TAO_MINOR@:@TAO_BETA@
+
+libTAO_DynamicInterface_la_LIBADD = \
+ libTAO_Messaging.la \
+ libTAO_PI.la \
+ libTAO_CodecFactory.la \
+ libTAO_PortableServer.la \
+ libTAO_Valuetype.la \
+ libTAO_AnyTypeCode.la \
+ libTAO.la \
+ $(ACE_BUILDDIR)/ace/libACE.la
+
+nobase_include_HEADERS += \
+ DynamicInterface/Context.h \
+ DynamicInterface/Context.inl \
+ DynamicInterface/DII_Arguments.h \
+ DynamicInterface/DII_Arguments.inl \
+ DynamicInterface/DII_CORBA_methods.h \
+ DynamicInterface/DII_Invocation.h \
+ DynamicInterface/DII_Invocation_Adapter.h \
+ DynamicInterface/DII_Reply_Dispatcher.h \
+ DynamicInterface/Dynamic_Adapter_Impl.h \
+ DynamicInterface/Dynamic_Implementation.h \
+ DynamicInterface/ExceptionList.h \
+ DynamicInterface/ExceptionList.inl \
+ DynamicInterface/Request.h \
+ DynamicInterface/Request.inl \
+ DynamicInterface/Server_Request.h \
+ DynamicInterface/Server_Request.inl \
+ DynamicInterface/Unknown_User_Exception.h \
+ DynamicInterface/dynamicinterface_export.h
+
+pkgconfig_DATA += \
+ TAO_DynamicInterface.pc
+
+CLEANFILES += \
+ TAO_DynamicInterface.pc
+
+TAO_DynamicInterface.pc: ${top_builddir}/config.status ${srcdir}/DynamicInterface/TAO_DynamicInterface.pc.in
+ ${top_builddir}/config.status --file $@:${srcdir}/DynamicInterface/TAO_DynamicInterface.pc.in
+
+endif BUILD_CORBA_MESSAGING
+
+EXTRA_DIST += \
+ DynamicInterface/TAO_DynamicInterface.pc.in \
+ DynamicInterface/TAO_DynamicInterface.rc
+
+
+## Makefile.EndpointPolicy.am
+
+BUILT_SOURCES += \
+ EndpointPolicy/EndpointPolicyA.cpp \
+ EndpointPolicy/EndpointPolicyA.h \
+ EndpointPolicy/EndpointPolicyC.cpp \
+ EndpointPolicy/EndpointPolicyC.h
+
+CLEANFILES += \
+ EndpointPolicy/EndpointPolicy-stamp \
+ EndpointPolicy/EndpointPolicyA.cpp \
+ EndpointPolicy/EndpointPolicyA.h \
+ EndpointPolicy/EndpointPolicyC.cpp \
+ EndpointPolicy/EndpointPolicyC.h
+
+EndpointPolicy/EndpointPolicyA.cpp EndpointPolicy/EndpointPolicyA.h EndpointPolicy/EndpointPolicyC.cpp EndpointPolicy/EndpointPolicyC.h: EndpointPolicy/EndpointPolicy-stamp
+
+EndpointPolicy/EndpointPolicy-stamp: $(srcdir)/EndpointPolicy/EndpointPolicy.pidl $(TAO_IDL_DEP)
+ $(TAO_IDL) $(TAO_IDLFLAGS) -Wb,versioning_begin=TAO_BEGIN_VERSIONED_NAMESPACE_DECL -Wb,versioning_end=TAO_END_VERSIONED_NAMESPACE_DECL -GA -SS -Sci -Ge 1 -Sorb -Wb,export_macro=TAO_EndpointPolicy_Export -Wb,export_include=tao/EndpointPolicy/EndpointPolicy_Export.h -o EndpointPolicy $(srcdir)/EndpointPolicy/EndpointPolicy.pidl
+ @touch $@
+
+BUILT_SOURCES += \
+ EndpointPolicy/IIOPEndpointValueA.cpp \
+ EndpointPolicy/IIOPEndpointValueA.h \
+ EndpointPolicy/IIOPEndpointValueC.cpp \
+ EndpointPolicy/IIOPEndpointValueC.h
+
+CLEANFILES += \
+ EndpointPolicy/IIOPEndpointValue-stamp \
+ EndpointPolicy/IIOPEndpointValueA.cpp \
+ EndpointPolicy/IIOPEndpointValueA.h \
+ EndpointPolicy/IIOPEndpointValueC.cpp \
+ EndpointPolicy/IIOPEndpointValueC.h
+
+EndpointPolicy/IIOPEndpointValueA.cpp EndpointPolicy/IIOPEndpointValueA.h EndpointPolicy/IIOPEndpointValueC.cpp EndpointPolicy/IIOPEndpointValueC.h: EndpointPolicy/IIOPEndpointValue-stamp
+
+EndpointPolicy/IIOPEndpointValue-stamp: $(srcdir)/EndpointPolicy/IIOPEndpointValue.pidl $(TAO_IDL_DEP)
+ $(TAO_IDL) $(TAO_IDLFLAGS) -Wb,versioning_begin=TAO_BEGIN_VERSIONED_NAMESPACE_DECL -Wb,versioning_end=TAO_END_VERSIONED_NAMESPACE_DECL -GA -SS -Sci -Ge 1 -Sorb -Wb,export_macro=TAO_EndpointPolicy_Export -Wb,export_include=tao/EndpointPolicy/EndpointPolicy_Export.h -o EndpointPolicy $(srcdir)/EndpointPolicy/IIOPEndpointValue.pidl
+ @touch $@
+
+lib_LTLIBRARIES += libTAO_EndpointPolicy.la
+
+libTAO_EndpointPolicy_la_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR) \
+ -I$(TAO_ROOT) \
+ -I$(TAO_BUILDDIR) \
+ -DTAO_ENDPOINTPOLICY_BUILD_DLL
+
+libTAO_EndpointPolicy_la_SOURCES = \
+ EndpointPolicy/EndpointPolicy.cpp \
+ EndpointPolicy/EndpointPolicyA.cpp \
+ EndpointPolicy/EndpointPolicyC.cpp \
+ EndpointPolicy/EndpointPolicyTypeA.cpp \
+ EndpointPolicy/EndpointPolicyTypeC.cpp \
+ EndpointPolicy/EndpointPolicy_Factory.cpp \
+ EndpointPolicy/EndpointPolicy_ORBInitializer.cpp \
+ EndpointPolicy/EndpointPolicy_i.cpp \
+ EndpointPolicy/Endpoint_Acceptor_Filter.cpp \
+ EndpointPolicy/Endpoint_Acceptor_Filter_Factory.cpp \
+ EndpointPolicy/Endpoint_Value_Impl.cpp \
+ EndpointPolicy/IIOPEndpointValueA.cpp \
+ EndpointPolicy/IIOPEndpointValueC.cpp \
+ EndpointPolicy/IIOPEndpointValue_i.cpp
+
+libTAO_EndpointPolicy_la_LDFLAGS = \
+ -version-number @TAO_MAJOR@:@TAO_MINOR@:@TAO_BETA@
+
+libTAO_EndpointPolicy_la_LIBADD = \
+ libTAO_PI.la \
+ libTAO_CodecFactory.la \
+ libTAO_PortableServer.la \
+ libTAO_AnyTypeCode.la \
+ libTAO.la \
+ $(ACE_BUILDDIR)/ace/libACE.la
+
+nobase_include_HEADERS += \
+ EndpointPolicy/EndpointPolicy.h \
+ EndpointPolicy/EndpointPolicy.pidl \
+ EndpointPolicy/EndpointPolicyA.h \
+ EndpointPolicy/EndpointPolicyC.h \
+ EndpointPolicy/EndpointPolicyType.pidl \
+ EndpointPolicy/EndpointPolicyTypeA.h \
+ EndpointPolicy/EndpointPolicyTypeC.h \
+ EndpointPolicy/EndpointPolicy_Export.h \
+ EndpointPolicy/EndpointPolicy_Factory.h \
+ EndpointPolicy/EndpointPolicy_ORBInitializer.h \
+ EndpointPolicy/EndpointPolicy_i.h \
+ EndpointPolicy/Endpoint_Acceptor_Filter.h \
+ EndpointPolicy/Endpoint_Acceptor_Filter_Factory.h \
+ EndpointPolicy/Endpoint_Value_Impl.h \
+ EndpointPolicy/IIOPEndpointValue.pidl \
+ EndpointPolicy/IIOPEndpointValueA.h \
+ EndpointPolicy/IIOPEndpointValueC.h \
+ EndpointPolicy/IIOPEndpointValue_i.h
+
+pkgconfig_DATA += \
+ TAO_EndpointPolicy.pc
+
+CLEANFILES += \
+ TAO_EndpointPolicy.pc
+
+TAO_EndpointPolicy.pc: ${top_builddir}/config.status ${srcdir}/EndpointPolicy/TAO_EndpointPolicy.pc.in
+ ${top_builddir}/config.status --file $@:${srcdir}/EndpointPolicy/TAO_EndpointPolicy.pc.in
+
+EXTRA_DIST += \
+ EndpointPolicy/TAO_EndpointPolicy.pc.in
+
+
+## Makefile.ObjRefTemplate.am
+
+lib_LTLIBRARIES += libTAO_ObjRefTemplate.la
+
+libTAO_ObjRefTemplate_la_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR) \
+ -I$(TAO_ROOT) \
+ -I$(TAO_BUILDDIR) \
+ -DTAO_ORT_BUILD_DLL
+
+libTAO_ObjRefTemplate_la_SOURCES = \
+ ObjRefTemplate/Default_ORTA.cpp \
+ ObjRefTemplate/Default_ORTC.cpp \
+ ObjRefTemplate/ORT_Adapter_Factory_Impl.cpp \
+ ObjRefTemplate/ORT_Adapter_Impl.cpp \
+ ObjRefTemplate/ObjectReferenceTemplateA.cpp \
+ ObjRefTemplate/ObjectReferenceTemplateC.cpp \
+ ObjRefTemplate/ObjectReferenceTemplate_i.cpp
+
+libTAO_ObjRefTemplate_la_LDFLAGS = \
+ -version-number @TAO_MAJOR@:@TAO_MINOR@:@TAO_BETA@
+
+libTAO_ObjRefTemplate_la_LIBADD = \
+ libTAO_PortableServer.la \
+ libTAO_Valuetype.la \
+ libTAO_AnyTypeCode.la \
+ libTAO.la \
+ $(ACE_BUILDDIR)/ace/libACE.la
+
+nobase_include_HEADERS += \
+ ObjRefTemplate/Default_ORT.pidl \
+ ObjRefTemplate/Default_ORTC.h \
+ ObjRefTemplate/Default_ORTC.inl \
+ ObjRefTemplate/ORT_Adapter_Factory_Impl.h \
+ ObjRefTemplate/ORT_Adapter_Impl.h \
+ ObjRefTemplate/ObjectReferenceTemplate.h \
+ ObjRefTemplate/ObjectReferenceTemplate.pidl \
+ ObjRefTemplate/ObjectReferenceTemplateC.h \
+ ObjRefTemplate/ObjectReferenceTemplateC.inl \
+ ObjRefTemplate/ObjectReferenceTemplate_i.h \
+ ObjRefTemplate/ObjectReferenceTemplate_include.pidl \
+ ObjRefTemplate/ObjectReferenceTemplate_includeA.h \
+ ObjRefTemplate/ObjectReferenceTemplate_includeC.h \
+ ObjRefTemplate/ObjectReferenceTemplate_includeS.h \
+ ObjRefTemplate/ort_export.h
+
+pkgconfig_DATA += \
+ TAO_ObjRefTemplate.pc
+
+CLEANFILES += \
+ TAO_ObjRefTemplate.pc
+
+TAO_ObjRefTemplate.pc: ${top_builddir}/config.status ${srcdir}/ObjRefTemplate/TAO_ObjRefTemplate.pc.in
+ ${top_builddir}/config.status --file $@:${srcdir}/ObjRefTemplate/TAO_ObjRefTemplate.pc.in
+
+EXTRA_DIST += \
+ ObjRefTemplate/TAO_ObjRefTemplate.pc.in \
+ ObjRefTemplate/TAO_ObjRefTemplate.rc
+
+
+## Makefile.IORInterceptor.am
+
+lib_LTLIBRARIES += libTAO_IORInterceptor.la
+
+libTAO_IORInterceptor_la_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR) \
+ -I$(TAO_ROOT) \
+ -I$(TAO_BUILDDIR) \
+ -DTAO_IORINTERCEPTOR_BUILD_DLL
+
+libTAO_IORInterceptor_la_SOURCES = \
+ IORInterceptor/IORInfo.cpp \
+ IORInterceptor/IORInfoC.cpp \
+ IORInterceptor/IORInterceptorC.cpp \
+ IORInterceptor/IORInterceptor_Adapter_Factory_Impl.cpp \
+ IORInterceptor/IORInterceptor_Adapter_Impl.cpp \
+ IORInterceptor/IORInterceptor_Details.cpp
+
+libTAO_IORInterceptor_la_LDFLAGS = \
+ -version-number @TAO_MAJOR@:@TAO_MINOR@:@TAO_BETA@
+
+libTAO_IORInterceptor_la_LIBADD = \
+ libTAO_PI.la \
+ libTAO_CodecFactory.la \
+ libTAO_ObjRefTemplate.la \
+ libTAO_Valuetype.la \
+ libTAO_PortableServer.la \
+ libTAO_AnyTypeCode.la \
+ libTAO.la \
+ $(ACE_BUILDDIR)/ace/libACE.la
+
+nobase_include_HEADERS += \
+ IORInterceptor/IORInfo.h \
+ IORInterceptor/IORInfo.inl \
+ IORInterceptor/IORInfo.pidl \
+ IORInterceptor/IORInfoC.h \
+ IORInterceptor/IORInterceptor.h \
+ IORInterceptor/IORInterceptor.pidl \
+ IORInterceptor/IORInterceptorC.h \
+ IORInterceptor/IORInterceptor_Adapter_Factory_Impl.h \
+ IORInterceptor/IORInterceptor_Adapter_Impl.h \
+ IORInterceptor/IORInterceptor_Details.h \
+ IORInterceptor/iorinterceptor_export.h
+
+pkgconfig_DATA += \
+ TAO_IORInterceptor.pc
+
+CLEANFILES += \
+ TAO_IORInterceptor.pc
+
+TAO_IORInterceptor.pc: ${top_builddir}/config.status ${srcdir}/IORInterceptor/TAO_IORInterceptor.pc.in
+ ${top_builddir}/config.status --file $@:${srcdir}/IORInterceptor/TAO_IORInterceptor.pc.in
+
+EXTRA_DIST += \
+ IORInterceptor/TAO_IORInterceptor.pc.in \
+ IORInterceptor/TAO_IORInterceptor.rc
+
+
+## Makefile.IORManipulation.am
+
+lib_LTLIBRARIES += libTAO_IORManip.la
+
+libTAO_IORManip_la_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR) \
+ -I$(TAO_ROOT) \
+ -I$(TAO_BUILDDIR) \
+ -DTAO_IORMANIP_BUILD_DLL
+
+libTAO_IORManip_la_SOURCES = \
+ IORManipulation/IORA.cpp \
+ IORManipulation/IORC.cpp \
+ IORManipulation/IORManip_Loader.cpp \
+ IORManipulation/IORManipulation.cpp
+
+libTAO_IORManip_la_LDFLAGS = \
+ -version-number @TAO_MAJOR@:@TAO_MINOR@:@TAO_BETA@
+
+libTAO_IORManip_la_LIBADD = \
+ libTAO_AnyTypeCode.la \
+ libTAO.la \
+ $(ACE_BUILDDIR)/ace/libACE.la
+
+nobase_include_HEADERS += \
+ IORManipulation/IOR.pidl \
+ IORManipulation/IORC.h \
+ IORManipulation/IORManip_Loader.h \
+ IORManipulation/IORManipulation.h \
+ IORManipulation/ior_manip_export.h
+
+pkgconfig_DATA += \
+ TAO_IORManip.pc
+
+CLEANFILES += \
+ TAO_IORManip.pc
+
+TAO_IORManip.pc: ${top_builddir}/config.status ${srcdir}/IORManipulation/TAO_IORManip.pc.in
+ ${top_builddir}/config.status --file $@:${srcdir}/IORManipulation/TAO_IORManip.pc.in
+
+EXTRA_DIST += \
+ IORManipulation/TAO_IORManip.pc.in \
+ IORManipulation/TAO_IORManip.rc
+
+
+## Makefile.IORTable.am
+
+lib_LTLIBRARIES += libTAO_IORTable.la
+
+libTAO_IORTable_la_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR) \
+ -I$(TAO_ROOT) \
+ -I$(TAO_BUILDDIR) \
+ -DTAO_IORTABLE_BUILD_DLL
+
+libTAO_IORTable_la_SOURCES = \
+ IORTable/IORTable.cpp \
+ IORTable/IORTableC.cpp \
+ IORTable/IOR_Table_Impl.cpp \
+ IORTable/Table_Adapter.cpp
+
+libTAO_IORTable_la_LDFLAGS = \
+ -version-number @TAO_MAJOR@:@TAO_MINOR@:@TAO_BETA@
+
+libTAO_IORTable_la_LIBADD = \
+ libTAO.la \
+ $(ACE_BUILDDIR)/ace/libACE.la
+
+nobase_include_HEADERS += \
+ IORTable/IORTable.h \
+ IORTable/IORTable.pidl \
+ IORTable/IORTableC.h \
+ IORTable/IOR_Table_Impl.h \
+ IORTable/Table_Adapter.h \
+ IORTable/iortable_export.h
+
+pkgconfig_DATA += \
+ TAO_IORTable.pc
+
+CLEANFILES += \
+ TAO_IORTable.pc
+
+TAO_IORTable.pc: ${top_builddir}/config.status ${srcdir}/IORTable/TAO_IORTable.pc.in
+ ${top_builddir}/config.status --file $@:${srcdir}/IORTable/TAO_IORTable.pc.in
+
+EXTRA_DIST += \
+ IORTable/TAO_IORTable.pc.in \
+ IORTable/TAO_IORTable.rc
+
+
+## Makefile.ImR_Client.am
+
+BUILT_SOURCES += \
+ ImR_Client/ServerObjectA.cpp \
+ ImR_Client/ServerObjectA.h \
+ ImR_Client/ServerObjectC.cpp \
+ ImR_Client/ServerObjectC.h \
+ ImR_Client/ServerObjectC.inl \
+ ImR_Client/ServerObjectS.cpp \
+ ImR_Client/ServerObjectS.h
+
+CLEANFILES += \
+ ImR_Client/ServerObject-stamp \
+ ImR_Client/ServerObjectA.cpp \
+ ImR_Client/ServerObjectA.h \
+ ImR_Client/ServerObjectC.cpp \
+ ImR_Client/ServerObjectC.h \
+ ImR_Client/ServerObjectC.inl \
+ ImR_Client/ServerObjectS.cpp \
+ ImR_Client/ServerObjectS.h
+
+ImR_Client/ServerObjectA.cpp ImR_Client/ServerObjectA.h ImR_Client/ServerObjectC.cpp ImR_Client/ServerObjectC.h ImR_Client/ServerObjectC.inl ImR_Client/ServerObjectS.cpp ImR_Client/ServerObjectS.h: ImR_Client/ServerObject-stamp
+
+ImR_Client/ServerObject-stamp: $(srcdir)/ImR_Client/ServerObject.pidl $(TAO_IDL_DEP)
+ $(TAO_IDL) $(TAO_IDLFLAGS) -Wb,versioning_begin=TAO_BEGIN_VERSIONED_NAMESPACE_DECL -Wb,versioning_end=TAO_END_VERSIONED_NAMESPACE_DECL -Gp -Ssi -Sc -Gd -Ge 1 -Sorb -GA -Wb,export_macro=TAO_IMR_Client_Export -Wb,export_include=tao/ImR_Client/imr_client_export.h -o ImR_Client $(srcdir)/ImR_Client/ServerObject.pidl
+ @touch $@
+
+BUILT_SOURCES += \
+ ImR_Client/ImplRepoC.cpp \
+ ImR_Client/ImplRepoC.h \
+ ImR_Client/ImplRepoC.inl \
+ ImR_Client/ImplRepoS.cpp \
+ ImR_Client/ImplRepoS.h
+
+CLEANFILES += \
+ ImR_Client/ImplRepo-stamp \
+ ImR_Client/ImplRepoC.cpp \
+ ImR_Client/ImplRepoC.h \
+ ImR_Client/ImplRepoC.inl \
+ ImR_Client/ImplRepoS.cpp \
+ ImR_Client/ImplRepoS.h
+
+ImR_Client/ImplRepoC.cpp ImR_Client/ImplRepoC.h ImR_Client/ImplRepoC.inl ImR_Client/ImplRepoS.cpp ImR_Client/ImplRepoS.h: ImR_Client/ImplRepo-stamp
+
+ImR_Client/ImplRepo-stamp: $(srcdir)/ImR_Client/ImplRepo.pidl $(TAO_IDL_DEP)
+ $(TAO_IDL) $(TAO_IDLFLAGS) -Wb,versioning_begin=TAO_BEGIN_VERSIONED_NAMESPACE_DECL -Wb,versioning_end=TAO_END_VERSIONED_NAMESPACE_DECL -Gp -Ssi -Sc -Gd -Ge 1 -Sorb -Wb,export_macro=TAO_IMR_Client_Export -Wb,export_include=tao/ImR_Client/imr_client_export.h -o ImR_Client $(srcdir)/ImR_Client/ImplRepo.pidl
+ @touch $@
+
+lib_LTLIBRARIES += libTAO_ImR_Client.la
+
+libTAO_ImR_Client_la_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR) \
+ -I$(TAO_ROOT) \
+ -I$(TAO_BUILDDIR) \
+ -DTAO_IMR_CLIENT_BUILD_DLL
+
+libTAO_ImR_Client_la_SOURCES = \
+ ImR_Client/ImR_Client.cpp \
+ ImR_Client/ImplRepoC.cpp \
+ ImR_Client/ImplRepoS.cpp \
+ ImR_Client/ServerObjectA.cpp \
+ ImR_Client/ServerObjectC.cpp \
+ ImR_Client/ServerObjectS.cpp \
+ ImR_Client/ServerObject_i.cpp
+
+libTAO_ImR_Client_la_LDFLAGS = \
+ -version-number @TAO_MAJOR@:@TAO_MINOR@:@TAO_BETA@
+
+libTAO_ImR_Client_la_LIBADD = \
+ libTAO_PortableServer.la \
+ libTAO_AnyTypeCode.la \
+ libTAO.la \
+ $(ACE_BUILDDIR)/ace/libACE.la
+
+nobase_include_HEADERS += \
+ ImR_Client/ImR_Client.h \
+ ImR_Client/ImplRepo.pidl \
+ ImR_Client/ImplRepo.pidl \
+ ImR_Client/ImplRepoA.h \
+ ImR_Client/ImplRepoC.h \
+ ImR_Client/ImplRepoC.inl \
+ ImR_Client/ImplRepoS.h \
+ ImR_Client/ServerObject.pidl \
+ ImR_Client/ServerObject.pidl \
+ ImR_Client/ServerObjectA.h \
+ ImR_Client/ServerObjectC.h \
+ ImR_Client/ServerObjectC.inl \
+ ImR_Client/ServerObjectS.h \
+ ImR_Client/ServerObject_i.h \
+ ImR_Client/imr_client_export.h
+
+pkgconfig_DATA += \
+ TAO_ImR_Client.pc
+
+CLEANFILES += \
+ TAO_ImR_Client.pc
+
+TAO_ImR_Client.pc: ${top_builddir}/config.status ${srcdir}/ImR_Client/TAO_ImR_Client.pc.in
+ ${top_builddir}/config.status --file $@:${srcdir}/ImR_Client/TAO_ImR_Client.pc.in
+
+EXTRA_DIST += \
+ ImR_Client/TAO_IMR_Client.rc \
+ ImR_Client/TAO_ImR_Client.pc.in
+
+
+## Makefile.PI_Server.am
+
+BUILT_SOURCES += \
+ PI_Server/ServerRequestInfoA.cpp \
+ PI_Server/ServerRequestInfoA.h \
+ PI_Server/ServerRequestInfoC.cpp \
+ PI_Server/ServerRequestInfoC.h
+
+CLEANFILES += \
+ PI_Server/ServerRequestInfo-stamp \
+ PI_Server/ServerRequestInfoA.cpp \
+ PI_Server/ServerRequestInfoA.h \
+ PI_Server/ServerRequestInfoC.cpp \
+ PI_Server/ServerRequestInfoC.h
+
+PI_Server/ServerRequestInfoA.cpp PI_Server/ServerRequestInfoA.h PI_Server/ServerRequestInfoC.cpp PI_Server/ServerRequestInfoC.h: PI_Server/ServerRequestInfo-stamp
+
+PI_Server/ServerRequestInfo-stamp: $(srcdir)/PI_Server/ServerRequestInfo.pidl $(TAO_IDL_DEP)
+ $(TAO_IDL) $(TAO_IDLFLAGS) -Wb,versioning_begin=TAO_BEGIN_VERSIONED_NAMESPACE_DECL -Wb,versioning_end=TAO_END_VERSIONED_NAMESPACE_DECL -Sci -SS -GA -Gp -Gd -Ge 1 -Sc -Sorb -Sal -Wb,export_macro=TAO_PI_Server_Export -Wb,export_include=tao/PI_Server/pi_server_export.h -o PI_Server $(srcdir)/PI_Server/ServerRequestInfo.pidl
+ @touch $@
+
+lib_LTLIBRARIES += libTAO_PI_Server.la
+
+libTAO_PI_Server_la_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR) \
+ -I$(TAO_ROOT) \
+ -I$(TAO_BUILDDIR) \
+ -DTAO_PI_SERVER_BUILD_DLL
+
+libTAO_PI_Server_la_SOURCES = \
+ PI_Server/PICurrent_Guard.cpp \
+ PI_Server/PI_Server.cpp \
+ PI_Server/PI_Server_Loader.cpp \
+ PI_Server/PortableServer_ORBInitializer.cpp \
+ PI_Server/PortableServer_PolicyFactory.cpp \
+ PI_Server/ServerInterceptorAdapter.cpp \
+ PI_Server/ServerRequestDetails.cpp \
+ PI_Server/ServerRequestInfo.cpp \
+ PI_Server/ServerRequestInfoA.cpp \
+ PI_Server/ServerRequestInfoC.cpp \
+ PI_Server/ServerRequestInterceptorA.cpp \
+ PI_Server/ServerRequestInterceptorC.cpp \
+ PI_Server/ServerRequestInterceptor_Factory_Impl.cpp
+
+libTAO_PI_Server_la_LDFLAGS = \
+ -version-number @TAO_MAJOR@:@TAO_MINOR@:@TAO_BETA@
+
+libTAO_PI_Server_la_LIBADD = \
+ libTAO_PortableServer.la \
+ libTAO_PI.la \
+ libTAO_CodecFactory.la \
+ libTAO_AnyTypeCode.la \
+ libTAO.la \
+ $(ACE_BUILDDIR)/ace/libACE.la
+
+nobase_include_HEADERS += \
+ PI_Server/PICurrent_Guard.h \
+ PI_Server/PI_Server.h \
+ PI_Server/PI_Server_Loader.h \
+ PI_Server/PI_Server_include.pidl \
+ PI_Server/PI_Server_includeA.h \
+ PI_Server/PI_Server_includeC.h \
+ PI_Server/PI_Server_includeS.h \
+ PI_Server/Policy_Creator_T.h \
+ PI_Server/PortableServer_ORBInitializer.h \
+ PI_Server/PortableServer_PolicyFactory.h \
+ PI_Server/ServerInterceptorAdapter.h \
+ PI_Server/ServerRequestDetails.h \
+ PI_Server/ServerRequestDetails.inl \
+ PI_Server/ServerRequestInfo.h \
+ PI_Server/ServerRequestInfo.inl \
+ PI_Server/ServerRequestInfo.pidl \
+ PI_Server/ServerRequestInfo.pidl \
+ PI_Server/ServerRequestInfoA.h \
+ PI_Server/ServerRequestInfoC.h \
+ PI_Server/ServerRequestInterceptor.pidl \
+ PI_Server/ServerRequestInterceptorA.h \
+ PI_Server/ServerRequestInterceptorC.h \
+ PI_Server/ServerRequestInterceptorS.h \
+ PI_Server/ServerRequestInterceptor_Factory_Impl.h \
+ PI_Server/pi_server_export.h
+
+pkgconfig_DATA += \
+ TAO_PI_Server.pc
+
+CLEANFILES += \
+ TAO_PI_Server.pc
+
+TAO_PI_Server.pc: ${top_builddir}/config.status ${srcdir}/PI_Server/TAO_PI_Server.pc.in
+ ${top_builddir}/config.status --file $@:${srcdir}/PI_Server/TAO_PI_Server.pc.in
+
+EXTRA_DIST += \
+ PI_Server/TAO_PI_Server.pc.in
+
+
+## Makefile.RTCORBA.am
+
+if BUILD_RT_CORBA
+
+lib_LTLIBRARIES += libTAO_RTCORBA.la
+
+libTAO_RTCORBA_la_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR) \
+ -I$(TAO_ROOT) \
+ -I$(TAO_BUILDDIR) \
+ -DTAO_RTCORBA_BUILD_DLL
+
+libTAO_RTCORBA_la_SOURCES = \
+ RTCORBA/Continuous_Priority_Mapping.cpp \
+ RTCORBA/Direct_Priority_Mapping.cpp \
+ RTCORBA/Linear_Network_Priority_Mapping.cpp \
+ RTCORBA/Linear_Priority_Mapping.cpp \
+ RTCORBA/Multi_Priority_Mapping.cpp \
+ RTCORBA/Network_Priority_Mapping.cpp \
+ RTCORBA/Network_Priority_Mapping_Manager.cpp \
+ RTCORBA/Priority_Mapping.cpp \
+ RTCORBA/Priority_Mapping_Manager.cpp \
+ RTCORBA/RTCORBA.cpp \
+ RTCORBA/RTCORBAA.cpp \
+ RTCORBA/RTCORBAC.cpp \
+ RTCORBA/RT_Current.cpp \
+ RTCORBA/RT_Endpoint_Selector_Factory.cpp \
+ RTCORBA/RT_Endpoint_Utils.cpp \
+ RTCORBA/RT_Invocation_Endpoint_Selectors.cpp \
+ RTCORBA/RT_Mutex.cpp \
+ RTCORBA/RT_ORB.cpp \
+ RTCORBA/RT_ORBInitializer.cpp \
+ RTCORBA/RT_ORB_Loader.cpp \
+ RTCORBA/RT_PolicyFactory.cpp \
+ RTCORBA/RT_Policy_i.cpp \
+ RTCORBA/RT_Protocols_Hooks.cpp \
+ RTCORBA/RT_Stub.cpp \
+ RTCORBA/RT_Stub_Factory.cpp \
+ RTCORBA/RT_Thread_Lane_Resources_Manager.cpp \
+ RTCORBA/RT_Transport_Descriptor.cpp \
+ RTCORBA/RT_Transport_Descriptor_Property.cpp \
+ RTCORBA/Thread_Pool.cpp
+
+libTAO_RTCORBA_la_LDFLAGS = \
+ -version-number @TAO_MAJOR@:@TAO_MINOR@:@TAO_BETA@
+
+libTAO_RTCORBA_la_LIBADD = \
+ libTAO_PI.la \
+ libTAO_CodecFactory.la \
+ libTAO_AnyTypeCode.la \
+ libTAO.la \
+ $(ACE_BUILDDIR)/ace/libACE.la
+
+nobase_include_HEADERS += \
+ RTCORBA/Continuous_Priority_Mapping.h \
+ RTCORBA/Direct_Priority_Mapping.h \
+ RTCORBA/Linear_Network_Priority_Mapping.h \
+ RTCORBA/Linear_Priority_Mapping.h \
+ RTCORBA/Multi_Priority_Mapping.h \
+ RTCORBA/Network_Priority_Mapping.h \
+ RTCORBA/Network_Priority_Mapping_Manager.h \
+ RTCORBA/Network_Priority_Mapping_Manager.i \
+ RTCORBA/Priority_Mapping.h \
+ RTCORBA/Priority_Mapping_Manager.h \
+ RTCORBA/Priority_Mapping_Manager.i \
+ RTCORBA/RTCORBA.h \
+ RTCORBA/RTCORBA.pidl \
+ RTCORBA/RTCORBAC.h \
+ RTCORBA/RTCORBA_include.pidl \
+ RTCORBA/RTCORBA_includeA.h \
+ RTCORBA/RTCORBA_includeC.h \
+ RTCORBA/RTCORBA_includeS.h \
+ RTCORBA/RT_Current.h \
+ RTCORBA/RT_Endpoint_Selector_Factory.h \
+ RTCORBA/RT_Endpoint_Utils.h \
+ RTCORBA/RT_Invocation_Endpoint_Selectors.h \
+ RTCORBA/RT_Mutex.h \
+ RTCORBA/RT_ORB.h \
+ RTCORBA/RT_ORBInitializer.h \
+ RTCORBA/RT_ORB_Loader.h \
+ RTCORBA/RT_PolicyFactory.h \
+ RTCORBA/RT_Policy_i.h \
+ RTCORBA/RT_Protocols_Hooks.h \
+ RTCORBA/RT_Stub.h \
+ RTCORBA/RT_Stub_Factory.h \
+ RTCORBA/RT_Thread_Lane_Resources_Manager.h \
+ RTCORBA/RT_Transport_Descriptor.h \
+ RTCORBA/RT_Transport_Descriptor.inl \
+ RTCORBA/RT_Transport_Descriptor_Property.h \
+ RTCORBA/RT_Transport_Descriptor_Property.inl \
+ RTCORBA/Thread_Pool.h \
+ RTCORBA/Thread_Pool.inl \
+ RTCORBA/rtcorba_export.h \
+ RTCORBA/rtcorba_typedefs.h
+
+pkgconfig_DATA += \
+ TAO_RTCORBA.pc
+
+CLEANFILES += \
+ TAO_RTCORBA.pc
+
+TAO_RTCORBA.pc: ${top_builddir}/config.status ${srcdir}/RTCORBA/TAO_RTCORBA.pc.in
+ ${top_builddir}/config.status --file $@:${srcdir}/RTCORBA/TAO_RTCORBA.pc.in
+
+endif BUILD_RT_CORBA
+
+EXTRA_DIST += \
+ RTCORBA/TAO_RTCORBA.pc.in \
+ RTCORBA/TAO_RTCORBA.rc
+
+
+## Makefile.RTPortableServer.am
+
+if BUILD_RT_CORBA
+
+lib_LTLIBRARIES += libTAO_RTPortableServer.la
+
+libTAO_RTPortableServer_la_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR) \
+ -I$(TAO_ROOT) \
+ -I$(TAO_BUILDDIR) \
+ -DTAO_RTPORTABLESERVER_BUILD_DLL
+
+libTAO_RTPortableServer_la_SOURCES = \
+ RTPortableServer/RTPortableServer.cpp \
+ RTPortableServer/RTPortableServerA.cpp \
+ RTPortableServer/RTPortableServerC.cpp \
+ RTPortableServer/RT_Acceptor_Filters.cpp \
+ RTPortableServer/RT_Collocation_Resolver.cpp \
+ RTPortableServer/RT_Object_Adapter_Factory.cpp \
+ RTPortableServer/RT_POA.cpp \
+ RTPortableServer/RT_Policy_Validator.cpp \
+ RTPortableServer/RT_Servant_Dispatcher.cpp
+
+libTAO_RTPortableServer_la_LDFLAGS = \
+ -version-number @TAO_MAJOR@:@TAO_MINOR@:@TAO_BETA@
+
+libTAO_RTPortableServer_la_LIBADD = \
+ libTAO_PortableServer.la \
+ libTAO_RTCORBA.la \
+ libTAO_PI.la \
+ libTAO_CodecFactory.la \
+ libTAO_AnyTypeCode.la \
+ libTAO.la \
+ $(ACE_BUILDDIR)/ace/libACE.la
+
+nobase_include_HEADERS += \
+ RTPortableServer/RTPortableServer.h \
+ RTPortableServer/RTPortableServer.pidl \
+ RTPortableServer/RTPortableServerC.h \
+ RTPortableServer/RTPortableServerS.h \
+ RTPortableServer/RTPortableServer_include.pidl \
+ RTPortableServer/RTPortableServer_includeC.h \
+ RTPortableServer/RTPortableServer_includeS.h \
+ RTPortableServer/RT_Acceptor_Filters.h \
+ RTPortableServer/RT_Collocation_Resolver.h \
+ RTPortableServer/RT_Object_Adapter_Factory.h \
+ RTPortableServer/RT_POA.h \
+ RTPortableServer/RT_POA.i \
+ RTPortableServer/RT_Policy_Validator.h \
+ RTPortableServer/RT_Servant_Dispatcher.h \
+ RTPortableServer/rtportableserver_export.h
+
+pkgconfig_DATA += \
+ TAO_RTPortableServer.pc
+
+CLEANFILES += \
+ TAO_RTPortableServer.pc
+
+TAO_RTPortableServer.pc: ${top_builddir}/config.status ${srcdir}/RTPortableServer/TAO_RTPortableServer.pc.in
+ ${top_builddir}/config.status --file $@:${srcdir}/RTPortableServer/TAO_RTPortableServer.pc.in
+
+endif BUILD_RT_CORBA
+
+EXTRA_DIST += \
+ RTPortableServer/TAO_RTPortableServer.pc.in \
+ RTPortableServer/TAO_RTPortableServer.rc
+
+
+## Makefile.RTScheduler.am
+
+if BUILD_CORBA_MESSAGING
+if BUILD_RT_CORBA
+
+lib_LTLIBRARIES += libTAO_RTScheduler.la
+
+libTAO_RTScheduler_la_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR) \
+ -I$(TAO_ROOT) \
+ -I$(TAO_BUILDDIR) \
+ -DTAO_RTSCHEDULER_BUILD_DLL
+
+libTAO_RTScheduler_la_SOURCES = \
+ RTScheduling/Current.cpp \
+ RTScheduling/Distributable_Thread.cpp \
+ RTScheduling/RTScheduler.cpp \
+ RTScheduling/RTSchedulerA.cpp \
+ RTScheduling/RTSchedulerC.cpp \
+ RTScheduling/RTScheduler_Initializer.cpp \
+ RTScheduling/RTScheduler_Loader.cpp \
+ RTScheduling/RTScheduler_Manager.cpp \
+ RTScheduling/Request_Interceptor.cpp
+
+libTAO_RTScheduler_la_LDFLAGS = \
+ -version-number @TAO_MAJOR@:@TAO_MINOR@:@TAO_BETA@
+
+libTAO_RTScheduler_la_LIBADD = \
+ libTAO_PI_Server.la \
+ libTAO_PortableServer.la \
+ libTAO_RTCORBA.la \
+ libTAO_PI.la \
+ libTAO_CodecFactory.la \
+ libTAO_AnyTypeCode.la \
+ libTAO.la \
+ $(ACE_BUILDDIR)/ace/libACE.la
+
+nobase_include_HEADERS += \
+ RTScheduling/Current.h \
+ RTScheduling/Distributable_Thread.h \
+ RTScheduling/RTScheduler.h \
+ RTScheduling/RTScheduler.pidl \
+ RTScheduling/RTSchedulerC.h \
+ RTScheduling/RTScheduler_Initializer.h \
+ RTScheduling/RTScheduler_Loader.h \
+ RTScheduling/RTScheduler_Manager.h \
+ RTScheduling/RTScheduler_Manager.i \
+ RTScheduling/RTScheduler_include.pidl \
+ RTScheduling/RTScheduler_includeA.h \
+ RTScheduling/RTScheduler_includeC.h \
+ RTScheduling/RTScheduler_includeS.h \
+ RTScheduling/Request_Interceptor.h \
+ RTScheduling/ThreadAction.h \
+ RTScheduling/rtscheduler_export.h
+
+pkgconfig_DATA += \
+ TAO_RTScheduler.pc
+
+CLEANFILES += \
+ TAO_RTScheduler.pc
+
+TAO_RTScheduler.pc: ${top_builddir}/config.status ${srcdir}/RTScheduling/TAO_RTScheduler.pc.in
+ ${top_builddir}/config.status --file $@:${srcdir}/RTScheduling/TAO_RTScheduler.pc.in
+
+endif BUILD_RT_CORBA
+endif BUILD_CORBA_MESSAGING
+
+EXTRA_DIST += \
+ RTScheduling/TAO_RTScheduler.pc.in \
+ RTScheduling/TAO_RTScheduler.rc
+
+
+## Makefile.SmartProxies.am
+
+lib_LTLIBRARIES += libTAO_SmartProxies.la
+
+libTAO_SmartProxies_la_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR) \
+ -I$(TAO_ROOT) \
+ -I$(TAO_BUILDDIR) \
+ -DTAO_SMARTPROXIES_BUILD_DLL
+
+libTAO_SmartProxies_la_SOURCES = \
+ SmartProxies/Smart_Proxies.cpp
+
+libTAO_SmartProxies_la_LDFLAGS = \
+ -version-number @TAO_MAJOR@:@TAO_MINOR@:@TAO_BETA@
+
+libTAO_SmartProxies_la_LIBADD = \
+ libTAO.la \
+ $(ACE_BUILDDIR)/ace/libACE.la
+
+nobase_include_HEADERS += \
+ SmartProxies/Smart_Proxies.h \
+ SmartProxies/Smart_Proxies.inl \
+ SmartProxies/smartproxies_export.h
+
+pkgconfig_DATA += \
+ TAO_SmartProxies.pc
+
+CLEANFILES += \
+ TAO_SmartProxies.pc
+
+TAO_SmartProxies.pc: ${top_builddir}/config.status ${srcdir}/SmartProxies/TAO_SmartProxies.pc.in
+ ${top_builddir}/config.status --file $@:${srcdir}/SmartProxies/TAO_SmartProxies.pc.in
+
+EXTRA_DIST += \
+ SmartProxies/SmartProxies.rc \
+ SmartProxies/TAO_SmartProxies.pc.in
+
+
+## Makefile.Strategies.am
+
+if !BUILD_ACE_FOR_TAO
+
+lib_LTLIBRARIES += libTAO_Strategies.la
+
+libTAO_Strategies_la_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR) \
+ -I$(TAO_ROOT) \
+ -I$(TAO_BUILDDIR) \
+ -DTAO_STRATEGIES_BUILD_DLL
+
+libTAO_Strategies_la_SOURCES = \
+ Strategies/DIOP_Acceptor.cpp \
+ Strategies/DIOP_Connection_Handler.cpp \
+ Strategies/DIOP_Connector.cpp \
+ Strategies/DIOP_Endpoint.cpp \
+ Strategies/DIOP_Factory.cpp \
+ Strategies/DIOP_Profile.cpp \
+ Strategies/DIOP_Transport.cpp \
+ Strategies/FIFO_Connection_Purging_Strategy.cpp \
+ Strategies/LFU_Connection_Purging_Strategy.cpp \
+ Strategies/LF_Strategy_Null.cpp \
+ Strategies/NULL_Connection_Purging_Strategy.cpp \
+ Strategies/OC_Endpoint_Selector_Factory.cpp \
+ Strategies/OC_Endpoint_Selector_Loader.cpp \
+ Strategies/Optimized_Connection_Endpoint_Selector.cpp \
+ Strategies/SCIOP_Acceptor.cpp \
+ Strategies/SCIOP_Connection_Handler.cpp \
+ Strategies/SCIOP_Connector.cpp \
+ Strategies/SCIOP_Endpoint.cpp \
+ Strategies/SCIOP_Factory.cpp \
+ Strategies/SCIOP_Lite_Factory.cpp \
+ Strategies/SCIOP_Profile.cpp \
+ Strategies/SCIOP_Transport.cpp \
+ Strategies/SHMIOP_Acceptor.cpp \
+ Strategies/SHMIOP_Connection_Handler.cpp \
+ Strategies/SHMIOP_Connector.cpp \
+ Strategies/SHMIOP_Endpoint.cpp \
+ Strategies/SHMIOP_Factory.cpp \
+ Strategies/SHMIOP_Profile.cpp \
+ Strategies/SHMIOP_Transport.cpp \
+ Strategies/UIOP_Acceptor.cpp \
+ Strategies/UIOP_Connection_Handler.cpp \
+ Strategies/UIOP_Connector.cpp \
+ Strategies/UIOP_Endpoint.cpp \
+ Strategies/UIOP_Factory.cpp \
+ Strategies/UIOP_Lite_Factory.cpp \
+ Strategies/UIOP_Profile.cpp \
+ Strategies/UIOP_Transport.cpp \
+ Strategies/advanced_resource.cpp \
+ Strategies/sciop_endpointsC.cpp \
+ Strategies/uiop_endpointsC.cpp
+
+libTAO_Strategies_la_LDFLAGS = \
+ -version-number @TAO_MAJOR@:@TAO_MINOR@:@TAO_BETA@
+
+libTAO_Strategies_la_LIBADD = \
+ libTAO_AnyTypeCode.la \
+ libTAO.la \
+ $(ACE_BUILDDIR)/ace/libACE.la
+
+nobase_include_HEADERS += \
+ Strategies/DIOP_Acceptor.h \
+ Strategies/DIOP_Acceptor.i \
+ Strategies/DIOP_Connection_Handler.h \
+ Strategies/DIOP_Connector.h \
+ Strategies/DIOP_Endpoint.h \
+ Strategies/DIOP_Endpoint.i \
+ Strategies/DIOP_Factory.h \
+ Strategies/DIOP_Profile.h \
+ Strategies/DIOP_Transport.h \
+ Strategies/FIFO_Connection_Purging_Strategy.h \
+ Strategies/LFU_Connection_Purging_Strategy.h \
+ Strategies/LF_Strategy_Null.h \
+ Strategies/LF_Strategy_Null.inl \
+ Strategies/NULL_Connection_Purging_Strategy.h \
+ Strategies/OC_Endpoint_Selector_Factory.h \
+ Strategies/OC_Endpoint_Selector_Loader.h \
+ Strategies/Optimized_Connection_Endpoint_Selector.h \
+ Strategies/SCIOP_Acceptor.h \
+ Strategies/SCIOP_Acceptor.i \
+ Strategies/SCIOP_Connection_Handler.h \
+ Strategies/SCIOP_Connector.h \
+ Strategies/SCIOP_Endpoint.h \
+ Strategies/SCIOP_Endpoint.i \
+ Strategies/SCIOP_Factory.h \
+ Strategies/SCIOP_Lite_Factory.h \
+ Strategies/SCIOP_Profile.h \
+ Strategies/SCIOP_Transport.h \
+ Strategies/SHMIOP_Acceptor.h \
+ Strategies/SHMIOP_Connection_Handler.h \
+ Strategies/SHMIOP_Connector.h \
+ Strategies/SHMIOP_Endpoint.h \
+ Strategies/SHMIOP_Endpoint.i \
+ Strategies/SHMIOP_Factory.h \
+ Strategies/SHMIOP_Profile.h \
+ Strategies/SHMIOP_Transport.h \
+ Strategies/UIOP_Acceptor.h \
+ Strategies/UIOP_Connection_Handler.h \
+ Strategies/UIOP_Connector.h \
+ Strategies/UIOP_Endpoint.h \
+ Strategies/UIOP_Endpoint.i \
+ Strategies/UIOP_Factory.h \
+ Strategies/UIOP_Lite_Factory.h \
+ Strategies/UIOP_Profile.h \
+ Strategies/UIOP_Transport.h \
+ Strategies/advanced_resource.h \
+ Strategies/sciop_endpoints.pidl \
+ Strategies/sciop_endpointsC.h \
+ Strategies/strategies_export.h \
+ Strategies/uiop_endpoints.pidl \
+ Strategies/uiop_endpointsC.h
+
+pkgconfig_DATA += \
+ TAO_Strategies.pc
+
+CLEANFILES += \
+ TAO_Strategies.pc
+
+TAO_Strategies.pc: ${top_builddir}/config.status ${srcdir}/Strategies/TAO_Strategies.pc.in
+ ${top_builddir}/config.status --file $@:${srcdir}/Strategies/TAO_Strategies.pc.in
+
+endif !BUILD_ACE_FOR_TAO
+
+EXTRA_DIST += \
+ Strategies/TAO_Strategies.pc.in \
+ Strategies/TAO_Strategies.rc
+
+
+## Makefile.TAO_FlResource.am
+
+if BUILD_ACE_FLREACTOR
+if BUILD_FL
+if BUILD_GL
+if BUILD_X11
+
+lib_LTLIBRARIES += libTAO_FlResource.la
+
+libTAO_FlResource_la_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR) \
+ -I$(TAO_ROOT) \
+ -I$(TAO_BUILDDIR) \
+ $(ACE_FLTK_CPPFLAGS) \
+ -DTAO_FLRESOURCE_BUILD_DLL
+
+libTAO_FlResource_la_SOURCES = \
+ FlResource_Factory.cpp \
+ FlResource_Loader.cpp
+
+libTAO_FlResource_la_LDFLAGS = \
+ -version-number @TAO_MAJOR@:@TAO_MINOR@:@TAO_BETA@ $(ACE_FLTK_LDFLAGS)
+
+libTAO_FlResource_la_LIBADD = \
+ $(ACE_BUILDDIR)/ace/libACE_FlReactor.la \
+ libTAO.la \
+ $(ACE_BUILDDIR)/ace/libACE.la \
+ $(ACE_FLTK_LIBS)
+
+nobase_include_HEADERS += \
+ FlResource_Factory.h \
+ FlResource_Loader.h \
+ TAO_FlResource_Export.h
+
+endif BUILD_X11
+endif BUILD_GL
+endif BUILD_FL
+endif BUILD_ACE_FLREACTOR
+
+## Makefile.TAO_QtResource.am
+
+if BUILD_ACE_QTREACTOR
+if BUILD_QT
+
+lib_LTLIBRARIES += libTAO_QtResource.la
+
+libTAO_QtResource_la_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR) \
+ -I$(TAO_ROOT) \
+ -I$(TAO_BUILDDIR) \
+ $(ACE_QT_CPPFLAGS) \
+ -DTAO_QTRESOURCE_BUILD_DLL
+
+libTAO_QtResource_la_SOURCES = \
+ QtResource_Factory.cpp \
+ QtResource_Loader.cpp
+
+libTAO_QtResource_la_LDFLAGS = \
+ -version-number @TAO_MAJOR@:@TAO_MINOR@:@TAO_BETA@ $(ACE_QT_LDFLAGS)
+
+libTAO_QtResource_la_LIBADD = \
+ $(ACE_BUILDDIR)/ace/libACE_QtReactor.la \
+ libTAO.la \
+ $(ACE_BUILDDIR)/ace/libACE.la \
+ $(ACE_QT_LIBS)
+
+nobase_include_HEADERS += \
+ QtResource_Factory.h \
+ QtResource_Loader.h \
+ TAO_QtResource_Export.h
+
+endif BUILD_QT
+endif BUILD_ACE_QTREACTOR
+
+## Makefile.TAO_TkResource.am
+
+if BUILD_ACE_TKREACTOR
+if BUILD_TK
+
+lib_LTLIBRARIES += libTAO_TkResource.la
+
+libTAO_TkResource_la_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR) \
+ -I$(TAO_ROOT) \
+ -I$(TAO_BUILDDIR) \
+ $(ACE_TK_CPPFLAGS) \
+ $(ACE_TCL_CPPFLAGS) \
+ -DTAO_TKRESOURCE_BUILD_DLL
+
+libTAO_TkResource_la_SOURCES = \
+ TkResource_Factory.cpp \
+ TkResource_Loader.cpp
+
+libTAO_TkResource_la_LDFLAGS = \
+ -version-number @TAO_MAJOR@:@TAO_MINOR@:@TAO_BETA@ $(ACE_TK_LDFLAGS) $(ACE_TCL_LDFLAGS)
+
+libTAO_TkResource_la_LIBADD = \
+ $(ACE_BUILDDIR)/ace/libACE_TkReactor.la \
+ libTAO.la \
+ $(ACE_BUILDDIR)/ace/libACE.la \
+ $(ACE_TK_LIBS) \
+ $(ACE_TCL_LIBS)
+
+nobase_include_HEADERS += \
+ TAO_TkResource_Export.h \
+ TkResource_Factory.h \
+ TkResource_Loader.h
+
+endif BUILD_TK
+endif BUILD_ACE_TKREACTOR
+
+## Makefile.TAO_XtResource.am
+
+if BUILD_ACE_XTREACTOR
+if BUILD_X11
+if BUILD_XT
+
+lib_LTLIBRARIES += libTAO_XtResource.la
+
+libTAO_XtResource_la_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR) \
+ -I$(TAO_ROOT) \
+ -I$(TAO_BUILDDIR) \
+ $(ACE_X11_CPPFLAGS) \
+ $(ACE_XT_CPPFLAGS) \
+ -DTAO_XTRESOURCE_BUILD_DLL
+
+libTAO_XtResource_la_SOURCES = \
+ XtResource_Factory.cpp \
+ XtResource_Loader.cpp
+
+libTAO_XtResource_la_LDFLAGS = \
+ -version-number @TAO_MAJOR@:@TAO_MINOR@:@TAO_BETA@ $(ACE_X11_LDFLAGS) $(ACE_XT_LDFLAGS)
+
+libTAO_XtResource_la_LIBADD = \
+ $(ACE_BUILDDIR)/ace/libACE_XtReactor.la \
+ libTAO.la \
+ $(ACE_BUILDDIR)/ace/libACE.la \
+ $(ACE_XT_LIBS) \
+ $(ACE_X11_LIBS)
+
+nobase_include_HEADERS += \
+ TAO_XtResource_Export.h \
+ XtResource_Factory.h \
+ XtResource_Loader.h
+
+endif BUILD_XT
+endif BUILD_X11
+endif BUILD_ACE_XTREACTOR
+
+## Makefile.TypeCodeFactory.am
+
+BUILT_SOURCES += \
+ TypeCodeFactory/TypeCodeFactoryC.cpp \
+ TypeCodeFactory/TypeCodeFactoryC.h
+
+CLEANFILES += \
+ TypeCodeFactory/TypeCodeFactory-stamp \
+ TypeCodeFactory/TypeCodeFactoryC.cpp \
+ TypeCodeFactory/TypeCodeFactoryC.h
+
+TypeCodeFactory/TypeCodeFactoryC.cpp TypeCodeFactory/TypeCodeFactoryC.h: TypeCodeFactory/TypeCodeFactory-stamp
+
+TypeCodeFactory/TypeCodeFactory-stamp: $(srcdir)/TypeCodeFactory/TypeCodeFactory.pidl $(TAO_IDL_DEP)
+ $(TAO_IDL) $(TAO_IDLFLAGS) -Wb,versioning_begin=TAO_BEGIN_VERSIONED_NAMESPACE_DECL -Wb,versioning_end=TAO_END_VERSIONED_NAMESPACE_DECL -SS -Sci -Ge 1 -Sorb -Wb,export_macro=TAO_TypeCodeFactory_Export -Wb,export_include=tao/TypeCodeFactory/typecodefactory_export.h -o TypeCodeFactory $(srcdir)/TypeCodeFactory/TypeCodeFactory.pidl
+ @touch $@
+
+lib_LTLIBRARIES += libTAO_TypeCodeFactory.la
+
+libTAO_TypeCodeFactory_la_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR) \
+ -I$(TAO_ROOT) \
+ -I$(TAO_BUILDDIR) \
+ -DTAO_TYPECODEFACTORY_BUILD_DLL
+
+libTAO_TypeCodeFactory_la_SOURCES = \
+ TypeCodeFactory/Recursive_TypeCode.cpp \
+ TypeCodeFactory/TypeCodeFactoryC.cpp \
+ TypeCodeFactory/TypeCodeFactory_Adapter_Impl.cpp \
+ TypeCodeFactory/TypeCodeFactory_Loader.cpp \
+ TypeCodeFactory/TypeCodeFactory_i.cpp
+
+libTAO_TypeCodeFactory_la_LDFLAGS = \
+ -version-number @TAO_MAJOR@:@TAO_MINOR@:@TAO_BETA@
+
+libTAO_TypeCodeFactory_la_LIBADD = \
+ libTAO_IFR_Client.la \
+ libTAO_AnyTypeCode.la \
+ libTAO.la \
+ $(ACE_BUILDDIR)/ace/libACE.la
+
+nobase_include_HEADERS += \
+ TypeCodeFactory/Recursive_TypeCode.h \
+ TypeCodeFactory/Recursive_TypeCode.inl \
+ TypeCodeFactory/TypeCodeFactory.pidl \
+ TypeCodeFactory/TypeCodeFactoryC.h \
+ TypeCodeFactory/TypeCodeFactory_Adapter_Impl.h \
+ TypeCodeFactory/TypeCodeFactory_Loader.h \
+ TypeCodeFactory/TypeCodeFactory_i.h \
+ TypeCodeFactory/typecodefactory_export.h
+
+pkgconfig_DATA += \
+ TAO_TypeCodeFactory.pc
+
+CLEANFILES += \
+ TAO_TypeCodeFactory.pc
+
+TAO_TypeCodeFactory.pc: ${top_builddir}/config.status ${srcdir}/TypeCodeFactory/TAO_TypeCodeFactory.pc.in
+ ${top_builddir}/config.status --file $@:${srcdir}/TypeCodeFactory/TAO_TypeCodeFactory.pc.in
+
+EXTRA_DIST += \
+ TypeCodeFactory/TAO_TypeCodeFactory.pc.in \
+ TypeCodeFactory/TypeCodeFactory.rc
+
+
+## Makefile.Utils.am
+
+lib_LTLIBRARIES += libTAO_Utils.la
+
+libTAO_Utils_la_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR) \
+ -I$(TAO_ROOT) \
+ -I$(TAO_BUILDDIR) \
+ -DTAO_UTILS_BUILD_DLL
+
+libTAO_Utils_la_SOURCES = \
+ Utils/Encodable.cpp \
+ Utils/Implicit_Deactivator.cpp \
+ Utils/ORB_Destroyer.cpp \
+ Utils/ORB_Manager.cpp \
+ Utils/PolicyList_Destroyer.cpp \
+ Utils/RIR_Narrow.cpp \
+ Utils/Servant_Var.cpp \
+ Utils/Server_Main.cpp \
+ Utils/Synch_Refcountable.cpp
+
+libTAO_Utils_la_LDFLAGS = \
+ -version-number @TAO_MAJOR@:@TAO_MINOR@:@TAO_BETA@
+
+libTAO_Utils_la_LIBADD = \
+ libTAO_PI.la \
+ libTAO_CodecFactory.la \
+ libTAO_PortableServer.la \
+ libTAO_AnyTypeCode.la \
+ libTAO.la \
+ $(ACE_BUILDDIR)/ace/libACE.la
+
+nobase_include_HEADERS += \
+ Utils/Auto_Functor.h \
+ Utils/Encodable.h \
+ Utils/Implicit_Deactivator.h \
+ Utils/ORB_Destroyer.h \
+ Utils/ORB_Manager.h \
+ Utils/PolicyList_Destroyer.h \
+ Utils/PolicyList_Destroyer.inl \
+ Utils/RIR_Narrow.h \
+ Utils/Servant_Var.h \
+ Utils/Servant_Var.inl \
+ Utils/Server_Main.h \
+ Utils/Synch_Refcountable.h \
+ Utils/Synch_Refcountable.inl \
+ Utils/utils_export.h
+
+pkgconfig_DATA += \
+ TAO_Utils.pc
+
+CLEANFILES += \
+ TAO_Utils.pc
+
+TAO_Utils.pc: ${top_builddir}/config.status ${srcdir}/TAO_Utils.pc.in
+ ${top_builddir}/config.status --file $@:${srcdir}/TAO_Utils.pc.in
+
+EXTRA_DIST += \
+ TAO_Utils.pc.in
+
+
+## Clean up template repositories, etc.
+clean-local:
+ -rm -f *~ *.bak *.rpo *.sym lib*.*_pure_* core core.*
+ -rm -f gcctemp.c gcctemp so_locations *.ics
+ -rm -rf cxx_repository ptrepository ti_files
+ -rm -rf templateregistry ir.out
+ -rm -rf ptrepository SunWS_cache Templates.DB
diff --git a/TAO/tao/Messaging.mpc b/TAO/tao/Messaging.mpc
new file mode 100644
index 00000000000..0f5d25ac721
--- /dev/null
+++ b/TAO/tao/Messaging.mpc
@@ -0,0 +1,62 @@
+//$Id$
+project : taolib, core, portableserver, pi, valuetype, tao_versioning_idl_defaults {
+ sharedname = TAO_Messaging
+ dynamicflags = TAO_MESSAGING_BUILD_DLL
+
+ Source_Files {
+ Messaging
+ }
+
+ Header_Files {
+ Messaging
+ }
+
+ Inline_Files {
+ Messaging
+ }
+
+ Template_Files {
+ Messaging
+ }
+
+ Resource_Files {
+ Messaging
+ }
+
+ PIDL_Files {
+ Messaging
+ }
+
+ IDL_Files {
+ idlflags += -SS -GA -Gp -Gd -Ge 1 -Sc -Sorb -Sal \
+ -Wb,export_macro=TAO_Messaging_Export \
+ -Wb,export_include=tao/Messaging/messaging_export.h \
+ -o Messaging
+ idlflags -= -Sa -St
+ Messaging/ExceptionHolder.pidl
+ }
+
+ IDL_Files {
+ idlflags += -Sci -SS -Gp -Gd -Ge 1 -Sc -Sorb -Sal \
+ -Wb,export_macro=TAO_Messaging_Export \
+ -Wb,export_include=tao/Messaging/messaging_export.h \
+ -o Messaging
+ idlflags -= -Sa -St
+ Messaging/Pollable.pidl
+ }
+
+ IDL_Files {
+ idlflags += -Sci -SS -GA -Gp -Gd -Ge 1 -Sc -Sorb -Sal \
+ -Wb,export_macro=TAO_Messaging_Export \
+ -Wb,export_include=tao/Messaging/messaging_export.h \
+ -o Messaging
+ idlflags -= -Sa -St
+ Messaging/TAO_Ext.pidl
+ Messaging/Messaging_RT_Policy.pidl
+ Messaging/Messaging_SyncScope_Policy.pidl
+ }
+
+ Pkgconfig_Files {
+ Messaging/TAO_Messaging.pc.in
+ }
+}
diff --git a/TAO/tao/Messaging/AMH_Response_Handler.cpp b/TAO/tao/Messaging/AMH_Response_Handler.cpp
new file mode 100644
index 00000000000..0a1f3912dc9
--- /dev/null
+++ b/TAO/tao/Messaging/AMH_Response_Handler.cpp
@@ -0,0 +1,263 @@
+// $Id$
+
+#include "tao/Messaging/AMH_Response_Handler.h"
+#include "tao/TAO_Server_Request.h"
+#include "tao/Transport.h"
+#include "tao/CDR.h"
+#include "tao/ORB_Core.h"
+#include "tao/ORB.h"
+#include "tao/Pluggable_Messaging.h"
+#include "tao/Pluggable_Messaging_Utils.h"
+#include "tao/GIOP_Utils.h"
+#include "tao/debug.h"
+#include "tao/Buffer_Allocator_T.h"
+#include "tao/SystemException.h"
+
+#include "ace/Copy_Disabled.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_AMH_Response_Handler::TAO_AMH_Response_Handler ()
+ : mesg_base_ (0)
+ , request_id_ (0)
+ , transport_ (0)
+ , orb_core_ (0)
+ , argument_flag_ (1)
+ , exception_type_ (TAO_GIOP_NO_EXCEPTION)
+ , reply_status_ (TAO_RS_UNINITIALIZED)
+ , allocator_ (0)
+{
+}
+
+TAO_AMH_Response_Handler::~TAO_AMH_Response_Handler (void)
+{
+ this->transport_->remove_reference ();
+
+ // Since we are destroying the object we put a huge lock around the
+ // whole destruction process (just paranoid).
+ {
+ ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->mutex_);
+
+ if (this->response_expected_ == 0) //oneway ?
+ {
+ return;
+ }
+
+ // If the ResponseHandler is being destroyed before a reply has
+ // been sent to the client, we send a system exception
+ // CORBA::NO_RESPONSE, with minor code to indicate the problem.
+ if (this->reply_status_ == TAO_RS_SENT)
+ {
+ return;
+ }
+ }
+
+ // If sending the exception to the client fails, then we just give
+ // up, release the transport and return.
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ CORBA::NO_RESPONSE ex (CORBA::SystemException::_tao_minor_code
+ (TAO_AMH_REPLY_LOCATION_CODE,
+ EFAULT),
+ CORBA::COMPLETED_NO);
+ this->_tao_rh_send_exception (ex ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHALL
+ {
+ }
+ ACE_ENDTRY;
+ ACE_CHECK;
+}
+
+void
+TAO_AMH_Response_Handler::init(TAO_ServerRequest &server_request,
+ TAO_AMH_BUFFER_ALLOCATOR* allocator)
+{
+ mesg_base_ = server_request.mesg_base_;
+ request_id_ = server_request.request_id_;
+ response_expected_ = server_request.response_expected_;
+ transport_ = server_request.transport ();
+ orb_core_ = server_request.orb_core ();
+ allocator_ = allocator;
+
+ this->transport_->add_reference ();
+}
+
+void
+TAO_AMH_Response_Handler::_tao_rh_init_reply (ACE_ENV_SINGLE_ARG_DECL)
+{
+ {
+ ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->mutex_);
+ if (this->reply_status_ != TAO_RS_UNINITIALIZED)
+ {
+ // Looks like someone is trying to call an AMH method
+ // more than once
+ //
+ // We assume that the servant has already processed the
+ // request and is now trying to send back the reply. Hence we
+ // say that the operation has completed but let the server
+ // anyway that it is not doing something right.
+ ACE_THROW (CORBA::BAD_INV_ORDER
+ (CORBA::SystemException::_tao_minor_code
+ (TAO_AMH_REPLY_LOCATION_CODE,
+ EEXIST),
+ CORBA::COMPLETED_YES));
+ }
+ }
+
+ // Construct our reply generator.
+ TAO_Pluggable_Reply_Params_Base reply_params;
+ reply_params.request_id_ = this->request_id_;
+ reply_params.service_context_notowned (&(this->reply_service_context_.service_info ()));
+ reply_params.argument_flag_ = this->argument_flag_;
+
+ if (this->exception_type_ == TAO_GIOP_NO_EXCEPTION)
+ {
+ reply_params.reply_status_ = TAO_PLUGGABLE_MESSAGE_NO_EXCEPTION;
+ }
+ else
+ {
+ reply_params.reply_status_ = this->exception_type_;
+ }
+
+ {
+ ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->mutex_);
+
+ this->mesg_base_->generate_reply_header (this->_tao_out,
+ reply_params);
+
+ // We are done initialising the reply
+ this->reply_status_ = TAO_RS_INITIALIZED;
+ }
+
+}
+
+void
+TAO_AMH_Response_Handler::_tao_rh_send_reply (ACE_ENV_SINGLE_ARG_DECL)
+{
+
+ {
+ ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->mutex_);
+
+ // If the reply has not been initialised, raise an exception to the
+ // server-app saying it is not doing something right.
+ if (this->reply_status_ != TAO_RS_INITIALIZED)
+ {
+ ACE_THROW (CORBA::BAD_INV_ORDER (
+ CORBA::SystemException::_tao_minor_code (
+ TAO_AMH_REPLY_LOCATION_CODE,
+ ENOTSUP),
+ CORBA::COMPLETED_YES));
+ }
+ this->reply_status_ = TAO_RS_SENDING;
+ }
+
+ // Send the message.
+ int result = this->transport_->send_message (this->_tao_out,
+ 0,
+ TAO_Transport::TAO_REPLY);
+
+ if (result == -1)
+ {
+ if (TAO_debug_level > 0)
+ {
+ // No exception but some kind of error, yet a response
+ // is required.
+ ACE_ERROR ((
+ LM_ERROR,
+ ACE_TEXT ("TAO: (%P|%t) %p: cannot send NO_EXCEPTION reply\n"),
+ ACE_TEXT ("TAO_AMH_Response_Handler::_tao_rh_send_reply")
+ ));
+ }
+ }
+
+ {
+ ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->mutex_);
+ this->reply_status_ = TAO_RS_SENT;
+ }
+}
+
+void
+TAO_AMH_Response_Handler::_tao_rh_send_exception (CORBA::Exception &ex
+ ACE_ENV_ARG_DECL)
+{
+ {
+ ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->mutex_);
+ if (this->reply_status_ != TAO_RS_UNINITIALIZED)
+ {
+ ACE_THROW (CORBA::BAD_INV_ORDER (
+ CORBA::SystemException::_tao_minor_code (
+ TAO_AMH_REPLY_LOCATION_CODE,
+ ENOTSUP),
+ CORBA::COMPLETED_YES));
+ }
+ this->reply_status_ = TAO_RS_SENDING;
+ }
+
+ TAO_Pluggable_Reply_Params_Base reply_params;
+ reply_params.request_id_ = this->request_id_;
+ reply_params.svc_ctx_.length (0);
+ reply_params.service_context_notowned (&this->reply_service_context_.service_info ());
+ reply_params.argument_flag_ = 1;
+ reply_params.reply_status_ = TAO_GIOP_USER_EXCEPTION;
+ // @@ It appears as if there should be a more efficient way to do
+ // this: the caller already knows this because it is part of the
+ // ExceptionHolder information.
+ if (CORBA::SystemException::_downcast (&ex))
+ reply_params.reply_status_ = TAO_GIOP_SYSTEM_EXCEPTION;
+
+ if (this->mesg_base_->generate_exception_reply (this->_tao_out,
+ reply_params,
+ ex) == -1)
+ {
+ ACE_THROW (CORBA::INTERNAL ());
+ }
+
+ // Send the Exception
+ if (this->transport_->send_message (this->_tao_out,
+ 0,
+ TAO_Transport::TAO_REPLY) == -1)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO: (%P|%t|%N|%l): ")
+ ACE_TEXT ("TAO_AMH_Response_Handler: could not send exception reply\n")));
+ }
+
+ {
+ ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->mutex_);
+ this->reply_status_ = TAO_RS_SENT;
+ }
+}
+
+void
+TAO_AMH_Response_Handler::_remove_ref (void)
+{
+ if (--this->refcount_ > 0)
+ return;
+
+ if (this->allocator_)
+ {
+ TAO::TAO_Buffer_Allocator<TAO_AMH_Response_Handler, TAO_AMH_BUFFER_ALLOCATOR> allocator (this->allocator_);
+
+ allocator.release (this);
+ }
+ else
+ {
+ delete this;
+ }
+}
+
+namespace TAO
+{
+ void
+ ARH_Refcount_Functor::operator () (
+ TAO_AMH_Response_Handler *arh)
+ ACE_THROW_SPEC (())
+ {
+ (void) arh->_remove_ref ();
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Messaging/AMH_Response_Handler.h b/TAO/tao/Messaging/AMH_Response_Handler.h
new file mode 100644
index 00000000000..585ed1defea
--- /dev/null
+++ b/TAO/tao/Messaging/AMH_Response_Handler.h
@@ -0,0 +1,222 @@
+// -*- C++ -*-
+
+// =========================================================================
+/**
+ * @file AMH_Response_Handler.h
+ *
+ * $Id$
+ *
+ * @author Mayur Deshpande <mayur@ics.uci.edu>
+ */
+// =========================================================================
+
+#ifndef TAO_AMH_RESPONSE_HANDLER_H
+#define TAO_AMH_RESPONSE_HANDLER_H
+
+#include "tao/Messaging/messaging_export.h"
+
+#include "tao/Allocator.h"
+#include "tao/Service_Context.h"
+#include "tao/CDR.h"
+#include "tao/LocalObject.h"
+#include "tao/Buffer_Allocator_T.h"
+#include "ace/Synch_Traits.h"
+#include "ace/Thread_Mutex.h"
+#include "ace/Null_Mutex.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+class ACE_Allocator;
+ACE_END_VERSIONED_NAMESPACE_DECL
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Transport;
+class TAO_Pluggable_Messaging;
+class TAO_Output_CDR;
+class TAO_ORB_Core;
+class TAO_ServerRequest;
+
+typedef ACE_Allocator TAO_AMH_BUFFER_ALLOCATOR;
+
+/**
+ * @class TAO_AMH_Response_Handler
+ *
+ * @brief Class representing an Asynchronous-Method-Handling (AMH)
+ * ResponseHandler (RH) object.
+ *
+ * Class encapsulates state required to send a response back to the
+ * client independent of the thread that originally created the state
+ * on the activation-record. Thus the required state (copied from
+ * TAO_Server_Request) is 'stored' on the heap.
+ *
+ * One RH is created for every client request and the RH can be used
+ * only once i.e., the asynchronous method can be called only once.
+ * This class also encapsulates various initialisation and
+ * response-sending functionality that is common to all RHs (generated
+ * by the IDL compiler). Thus the IDL-compiler has to generate less
+ * code which in turn reduces the overall code size for an
+ * application.
+ */
+class TAO_Messaging_Export TAO_AMH_Response_Handler
+// @@ Mayur, this is not the correct way to use
+// TAO_LocalRefCounted_Object. Application code is supposed to use
+// it when necessary. You're forcing applications to use a
+// reference counted version of their AMH_Response_Handler. This
+// isn't consistent with the specified semantics detailed in the
+// CCM spec. Please remove this and place it where appropriate in
+// your AMH tests and examples.
+ : public TAO_Local_RefCounted_Object
+{
+public:
+
+ /// Constructor
+ TAO_AMH_Response_Handler ();
+
+ /// Destructor
+ /**
+ * Releases the transport and in case of an error, sends the appropriate
+ * exception back to the client
+ */
+ virtual ~TAO_AMH_Response_Handler (void);
+
+ /**
+ * Stores necessary information from a TAO_Server_Request onto the heap
+ */
+ virtual void init (TAO_ServerRequest &server_request,
+ TAO_AMH_BUFFER_ALLOCATOR* allocator);
+
+ /// @name Mutators for refcount
+ //@{
+ virtual void _remove_ref (void);
+ //@}
+
+protected:
+
+ /// Sets up the various parameters in anticipation of returning a reply
+ /// to the client. return/OUT/INOUT arguments are marshalled into the
+ /// Output stream after this method has been called.
+ void _tao_rh_init_reply (ACE_ENV_SINGLE_ARG_DECL);
+
+ /// Sends the marshalled reply back to the client.
+ void _tao_rh_send_reply (ACE_ENV_SINGLE_ARG_DECL);
+
+ /// Send back an exception to the client.
+ void _tao_rh_send_exception (CORBA::Exception &ex
+ ACE_ENV_ARG_DECL);
+
+protected:
+
+ /// The outgoing CDR stream
+ /**
+ * The IDL-generated ResponseHandler implementations used this field
+ * to marshal the response.
+ * Making it a field instead of a public accessor makes the code in
+ * the generated ResponseHandler implementation a lot more readable.
+ */
+ TAO_OutputCDR _tao_out;
+
+private:
+
+ // Private and undefined, standard C++ idiom to prohibit copying.
+ TAO_AMH_Response_Handler (const TAO_AMH_Response_Handler&);
+ TAO_AMH_Response_Handler& operator= (const TAO_AMH_Response_Handler&);
+
+private:
+ /// Pointer to the original message-base
+ TAO_Pluggable_Messaging *mesg_base_;
+
+ /// Copy of the request-id of the original Server-Request
+ CORBA::ULong request_id_;
+
+ CORBA::Boolean response_expected_;
+
+ /// Handle to transport through which the reply will be sent
+ /// Copy of transport in original Server_Request
+ TAO_Transport *transport_;
+
+ /// A pointer to the ORB Core for the context where the request was
+ /// created.
+ TAO_ORB_Core * orb_core_;
+
+ /// The reply service context
+ TAO_Service_Context reply_service_context_;
+
+ /// Alwyas set to true (we always have something to return to the
+ /// client
+ // @@ Mayur: I think not! This is used to generate padding in GIOP
+ // 1.2 messages (where the payload must start on an 8-byte
+ // boundary. But some replys have no payload (only header), in
+ // those cases you cannot insert the padding. We need the
+ // ResponseHandler to set this field correctly!
+ CORBA::Boolean argument_flag_;
+
+ // TAO_GIOP_ReplyStatusType exception_type_;
+ /// Exception type (will be NO_EXCEPTION in the majority of the
+ /// cases).
+ // @@ Mayur: I do not think we need this one, we can deduce the type
+ // of reply depending on the _tao_rh_*() method called.
+ CORBA::ULong exception_type_;
+
+ /**
+ * Various states the ResponseHandler can be in.
+ *
+ * These states represent various states the RH can be in and
+ * the states are used not only in implementing the 'once-only semantics of
+ * RHs, but in making sure well the call thread-safe as well.
+ */
+ enum Reply_Status
+ {
+ TAO_RS_UNINITIALIZED,
+ TAO_RS_INITIALIZED,
+ TAO_RS_SENDING,
+ TAO_RS_SENT
+ };
+ Reply_Status reply_status_;
+ // I would use the "state pattern"..
+ // Carlos, Isn't that an overkill?
+ // @@ Mayur: it depends on what form of the "State Pattern" you
+ // use. The more generic form, as described in GoF, uses a class
+ // for each state, super-elegant but indeed a bit heavy handed.
+ // The lighter-weight form (using a state variable
+
+ /// Mutex to ensure the AMH-RH method call is thread-safe.
+ ACE_SYNCH_MUTEX mutex_;
+
+ /// Allocator used to allocate this object. If zero then we are allocated
+ /// from the heap
+ TAO_AMH_BUFFER_ALLOCATOR* allocator_;
+};
+
+namespace TAO
+{
+ /**
+ * @class ARH_Refcount_Functor
+ *
+ * @brief Functor for refcounting of TAO_AMH_Response_Handler
+ *
+ * This is used to safely handle the destruction of
+ * TAO_AMH_Response_Handler objects which are created on the
+ * heap. We cannot use auto_ptr <> since it calls delete on the
+ * pointer, and calling delete on TAO_AMH_Response_Handler *
+ * will not work. Hence this functor will be used with Auto_Functor
+ * class to handle the memory safely.
+ *
+ * @todo Ideally, this class can be a generic class. But that
+ * requires quite a bit of cleanup within TAO to be more useful.
+ */
+ class TAO_Messaging_Export ARH_Refcount_Functor
+ {
+ public:
+ void operator() (TAO_AMH_Response_Handler *arh)
+ ACE_THROW_SPEC (());
+ };
+
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_AMH_RESPONSE_HANDLER_H */
diff --git a/TAO/tao/Messaging/Asynch_Invocation.cpp b/TAO/tao/Messaging/Asynch_Invocation.cpp
new file mode 100644
index 00000000000..619de3ed97b
--- /dev/null
+++ b/TAO/tao/Messaging/Asynch_Invocation.cpp
@@ -0,0 +1,196 @@
+//$Id$
+
+#include "tao/Messaging/Asynch_Invocation.h"
+#include "tao/Messaging/Asynch_Reply_Dispatcher.h"
+
+#include "tao/Profile_Transport_Resolver.h"
+#include "tao/Invocation_Utils.h"
+#include "tao/operation_details.h"
+#include "tao/Bind_Dispatcher_Guard.h"
+#include "tao/Transport.h"
+#include "tao/Muxed_TMS.h"
+#include "tao/Pluggable_Messaging.h"
+#include "tao/ORB_Constants.h"
+
+#if TAO_HAS_INTERCEPTORS == 1
+# include "tao/PortableInterceptorC.h"
+#endif /*TAO_HAS_INTERCEPTORS */
+
+ACE_RCSID (Messaging,
+ Asynch_Invocation,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ Asynch_Remote_Invocation::Asynch_Remote_Invocation (
+ CORBA::Object_ptr otarget,
+ Profile_Transport_Resolver &resolver,
+ TAO_Operation_Details &detail,
+ TAO_Asynch_Reply_Dispatcher_Base *rd,
+ bool response_expected)
+ : Synch_Twoway_Invocation (otarget,
+ resolver,
+ detail,
+ response_expected)
+ , safe_rd_ (rd)
+ {
+ }
+
+ Invocation_Status
+ Asynch_Remote_Invocation::remote_invocation (ACE_Time_Value *max_wait_time
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::Exception))
+ {
+ TAO_Target_Specification tspec;
+ this->init_target_spec (tspec ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO_INVOKE_FAILURE);
+
+ TAO_OutputCDR &cdr =
+ this->resolver_.transport ()->messaging_object ()->out_stream ();
+
+ Invocation_Status s = TAO_INVOKE_FAILURE;
+
+#if TAO_HAS_INTERCEPTORS == 1
+ s =
+ this->send_request_interception (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO_INVOKE_FAILURE);
+
+ if (s != TAO_INVOKE_SUCCESS)
+ return s;
+#endif /*TAO_HAS_INTERCEPTORS */
+
+ // We have started the interception flow. We need to call the
+ // ending interception flow if things go wrong. The purpose of the
+ // try block is to take care of the cases when things go wrong.
+ ACE_TRY
+ {
+ // Oneway semantics. See comments for below send_message()
+ // call.
+ cdr.message_attributes (this->details_.request_id (),
+ this->resolver_.stub (),
+ TAO_Transport::TAO_ONEWAY_REQUEST,
+ max_wait_time);
+
+ this->write_header (tspec,
+ cdr
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ this->marshal_data (cdr
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ // Register a reply dispatcher for this invocation. Use the
+ // preallocated reply dispatcher.
+ TAO_Bind_Dispatcher_Guard dispatch_guard (
+ this->details_.request_id (),
+ this->safe_rd_.get (),
+ this->resolver_.transport ()->tms ());
+
+ // Now that we have bound the reply dispatcher to the map, just
+ // loose ownership of the reply dispatcher.
+ this->safe_rd_.release ();
+
+ if (dispatch_guard.status () != 0)
+ {
+ // @@ What is the right way to handle this error? Do we need
+ // to call the interceptors in this case?
+ ACE_THROW_RETURN (CORBA::INTERNAL (TAO::VMCID,
+ CORBA::COMPLETED_NO),
+ TAO_INVOKE_FAILURE);
+ }
+
+ // Do not unbind during destruction. We need the entry to be
+ // there in the map since the reply dispatcher depends on
+ // that. This is also a trigger to loose the ownership of the
+ // reply dispatcher.
+ dispatch_guard.status (TAO_Bind_Dispatcher_Guard::NO_UNBIND);
+
+ // Send it as a oneway request. It will make all the required
+ // paraphernalia within the ORB to fire, like buffering if
+ // send blocks etc.
+ s =
+ this->send_message (cdr,
+ TAO_Transport::TAO_ONEWAY_REQUEST,
+ max_wait_time
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+#if TAO_HAS_INTERCEPTORS == 1
+ // NOTE: We don't need to do the auto_ptr <> trick. We got here
+ // in the first place since the message was sent properly,
+ // which implies a reply would be available. Therefore the
+ // reply dispatcher should be available for another thread to
+ // collect and dispatch the reply. In MT cases, things are
+ // more hairy. Just imagine what happens when another thread
+ // is collecting the reply when we are happily invoking
+ // interceptors?
+
+ // Nothing great on here. If we get a restart during send or a
+ // proper send, we are supposed to call receiver_other ()
+ // interception point. So we do that here
+ Invocation_Status tmp =
+ this->receive_other_interception (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ // We got an error during the interception.
+ if (s == TAO_INVOKE_SUCCESS && tmp != TAO_INVOKE_SUCCESS)
+ s = tmp;
+#endif /*TAO_HAS_INTERCEPTORS */
+
+ // If an error occurred just return. At this point all the
+ // endpoint interception would have been invoked. The callee
+ // would take care of the rest.
+ if (s != TAO_INVOKE_SUCCESS)
+ return s;
+
+ // NOTE: Not sure how things are handles with exclusive muxed
+ // strategy.
+ if (this->resolver_.transport ()->idle_after_send ())
+ (void) this->resolver_.transport_released ();
+
+ }
+ ACE_CATCHANY
+ {
+#if TAO_HAS_INTERCEPTORS == 1
+ PortableInterceptor::ReplyStatus status =
+ this->handle_any_exception (&ACE_ANY_EXCEPTION
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (status == PortableInterceptor::LOCATION_FORWARD ||
+ status == PortableInterceptor::TRANSPORT_RETRY)
+ s = TAO_INVOKE_RESTART;
+ else if (status == PortableInterceptor::SYSTEM_EXCEPTION
+ || status == PortableInterceptor::USER_EXCEPTION)
+#endif /*TAO_HAS_INTERCEPTORS*/
+ ACE_RE_THROW;
+ }
+# if defined (ACE_HAS_EXCEPTIONS) \
+ && defined (ACE_HAS_BROKEN_UNEXPECTED_EXCEPTIONS)
+ ACE_CATCHALL
+ {
+#if TAO_HAS_INTERCEPTORS == 1
+ PortableInterceptor::ReplyStatus st =
+ this->handle_all_exception (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (st == PortableInterceptor::LOCATION_FORWARD ||
+ st == PortableInterceptor::TRANSPORT_RETRY)
+ s = TAO_INVOKE_RESTART;
+ else
+#endif /*TAO_HAS_INTERCEPTORS == 1*/
+ ACE_RE_THROW;
+ }
+# endif /* ACE_HAS_EXCEPTIONS &&
+ ACE_HAS_BROKEN_UNEXPECTED_EXCEPTION*/
+ ACE_ENDTRY;
+ ACE_CHECK_RETURN (TAO_INVOKE_FAILURE);
+
+ return s;
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Messaging/Asynch_Invocation.h b/TAO/tao/Messaging/Asynch_Invocation.h
new file mode 100644
index 00000000000..930d223bd3c
--- /dev/null
+++ b/TAO/tao/Messaging/Asynch_Invocation.h
@@ -0,0 +1,74 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Asynch_Invocation.h
+ *
+ * $Id$
+ *
+ * @author Balachandran Natarajan <bala@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_MESSAGING_ASYNCH_INVOCATION_H
+#define TAO_MESSAGING_ASYNCH_INVOCATION_H
+#include /**/ "ace/pre.h"
+
+#include "tao/Messaging/messaging_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Synch_Invocation.h"
+#include "tao/Asynch_Reply_Dispatcher_Base.h"
+#include "ace/Global_Macros.h"
+#include "ace/Auto_Functor.h"
+
+
+ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+class ACE_Time_Value;
+ACE_END_VERSIONED_NAMESPACE_DECL
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Operation_Details;
+class TAO_InputCDR;
+class TAO_Asynch_Reply_Dispatcher_Base;
+
+namespace CORBA
+{
+ class SystemException;
+}
+
+namespace TAO
+{
+ class Profile_Transport_Resolver;
+
+ class TAO_Messaging_Export Asynch_Remote_Invocation
+ : public Synch_Twoway_Invocation
+ {
+ public:
+ Asynch_Remote_Invocation (CORBA::Object_ptr otarget,
+ Profile_Transport_Resolver &resolver,
+ TAO_Operation_Details &detail,
+ TAO_Asynch_Reply_Dispatcher_Base *rd,
+ bool response_expected = true);
+
+ Invocation_Status remote_invocation (ACE_Time_Value *value
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::Exception));
+
+ protected:
+ // To prevent leaking memory from the reply dispatcher that we
+ // are given
+ ACE_Utils::Auto_Functor <TAO_Asynch_Reply_Dispatcher_Base,
+ ARDB_Refcount_Functor> safe_rd_;
+
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /*TAO_MESSAGING_ASYNCH_INVOCATION_H*/
diff --git a/TAO/tao/Messaging/Asynch_Invocation_Adapter.cpp b/TAO/tao/Messaging/Asynch_Invocation_Adapter.cpp
new file mode 100644
index 00000000000..b88ff2855ae
--- /dev/null
+++ b/TAO/tao/Messaging/Asynch_Invocation_Adapter.cpp
@@ -0,0 +1,197 @@
+//$Id$
+#include "tao/Messaging/Asynch_Invocation_Adapter.h"
+#include "tao/Messaging/Asynch_Reply_Dispatcher.h"
+#include "tao/Messaging/Asynch_Invocation.h"
+
+#include "tao/Profile_Transport_Resolver.h"
+#include "tao/operation_details.h"
+#include "tao/Stub.h"
+#include "tao/Transport.h"
+#include "tao/Muxed_TMS.h"
+#include "tao/ORB_Constants.h"
+#include "tao/debug.h"
+#include "tao/ORB_Core.h"
+#include "tao/Thread_Lane_Resources.h"
+#include "tao/GIOP_Utils.h"
+
+
+ACE_RCSID (Messaging,
+ Asynch_Invocation_Adapter,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ Asynch_Invocation_Adapter::Asynch_Invocation_Adapter (
+ CORBA::Object *target,
+ Argument **args,
+ int arg_number,
+ const char *operation,
+ size_t op_len,
+ Collocation_Proxy_Broker *p,
+ Invocation_Mode m)
+ : Invocation_Adapter (target,
+ args,
+ arg_number,
+ operation,
+ op_len,
+ p,
+ TAO_TWOWAY_INVOCATION,
+ m)
+ , safe_rd_ ()
+ {
+ }
+
+ void
+ Asynch_Invocation_Adapter::invoke (
+ Messaging::ReplyHandler_ptr reply_handler_ptr,
+ const TAO_Reply_Handler_Skeleton &reply_handler_skel
+ ACE_ENV_ARG_DECL)
+ {
+ TAO_Stub * stub =
+ this->get_stub (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (TAO_debug_level >= 4)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO_Messaging (%P|%t) - Asynch_Invocation_Adapter::"
+ "invoke\n"));
+ }
+
+ // If the reply handler is nil, we do not create a reply dispatcher.
+ // The ORB will drop replies to which it cannot associate a reply
+ // dispatcher.
+ if (!CORBA::is_nil (reply_handler_ptr))
+ {
+ // New reply dispatcher on the heap or allocator, because
+ // we will go out of scope and hand over the reply dispatcher
+ // to the ORB.
+
+ TAO_Asynch_Reply_Dispatcher *rd = 0;
+
+ // Get the allocator we could use.
+ ACE_Allocator* ami_allocator =
+ stub->orb_core ()->lane_resources().ami_response_handler_allocator();
+
+ // If we have an allocator, use it, else use the heap.
+ if (ami_allocator)
+ {
+ ACE_NEW_MALLOC (
+ rd,
+ static_cast<TAO_Asynch_Reply_Dispatcher *> (
+ ami_allocator->malloc (sizeof (TAO_Asynch_Reply_Dispatcher))),
+ TAO_Asynch_Reply_Dispatcher (reply_handler_skel,
+ reply_handler_ptr,
+ stub->orb_core (),
+ ami_allocator));
+ }
+ else
+ {
+ ACE_NEW (rd,
+ TAO_Asynch_Reply_Dispatcher (reply_handler_skel,
+ reply_handler_ptr,
+ stub->orb_core (),
+ 0));
+ }
+
+ if (rd == 0)
+ {
+ ACE_THROW (CORBA::NO_MEMORY ());
+ }
+
+ this->safe_rd_.reset (rd);
+ }
+
+ Invocation_Adapter::invoke (0, 0 ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ void
+ Asynch_Invocation_Adapter::invoke (
+ TAO::Exception_Data *ex,
+ unsigned long ex_count
+ ACE_ENV_ARG_DECL)
+ {
+ Invocation_Adapter::invoke (ex, ex_count ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ Invocation_Status
+ Asynch_Invocation_Adapter::invoke_twoway (
+ TAO_Operation_Details &op,
+ CORBA::Object_var &effective_target,
+ Profile_Transport_Resolver &r,
+ ACE_Time_Value *&max_wait_time
+ ACE_ENV_ARG_DECL)
+ {
+ // Simple sanity check
+ if (this->mode_ != TAO_ASYNCHRONOUS_CALLBACK_INVOCATION
+ || this->type_ != TAO_TWOWAY_INVOCATION)
+ {
+ ACE_THROW_RETURN (CORBA::INTERNAL (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ EINVAL),
+ CORBA::COMPLETED_NO),
+ TAO_INVOKE_FAILURE);
+ }
+
+ if (this->safe_rd_.get ())
+ {
+ // Cache the transport in the reply dispatcher
+ this->safe_rd_->transport (r.transport ());
+
+ // AMI Timeout Handling Begin
+ ACE_Time_Value tmp;
+
+ if (this->get_timeout (r.stub (),
+ tmp))
+ {
+ this->safe_rd_->schedule_timer (
+ op.request_id (),
+ *max_wait_time
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO_INVOKE_FAILURE);
+ }
+ }
+
+ // Loose ownership of the reply dispatcher
+ TAO::Asynch_Remote_Invocation asynch (
+ effective_target.in (),
+ r,
+ op,
+ this->safe_rd_.release ());
+
+ Invocation_Status s =
+ asynch.remote_invocation (max_wait_time
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO_INVOKE_FAILURE);
+
+ if (s == TAO_INVOKE_RESTART &&
+ asynch.is_forwarded ())
+ {
+ effective_target = asynch.steal_forwarded_reference ();
+
+#if TAO_HAS_INTERCEPTORS == 1
+ const CORBA::Boolean permanent_forward =
+ (asynch.reply_status() == TAO_GIOP_LOCATION_FORWARD_PERM);
+#else
+ const CORBA::Boolean permanent_forward = false;
+#endif
+
+ this->object_forwarded (effective_target,
+ r.stub (),
+ permanent_forward
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO_INVOKE_FAILURE);
+ }
+
+ return s;
+ }
+
+} // End namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Messaging/Asynch_Invocation_Adapter.h b/TAO/tao/Messaging/Asynch_Invocation_Adapter.h
new file mode 100644
index 00000000000..97cc214a71d
--- /dev/null
+++ b/TAO/tao/Messaging/Asynch_Invocation_Adapter.h
@@ -0,0 +1,111 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Asynch_Invocation_Adapter.h
+ *
+ * $Id$
+ *
+ *
+ * @author Balachandran Natarajan <bala@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_MESSAGING_ASYNCH_INVOCATION_ADAPTER_H
+#define TAO_MESSAGING_ASYNCH_INVOCATION_ADAPTER_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Messaging/messaging_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Messaging/Messaging.h"
+#include "tao/Asynch_Reply_Dispatcher_Base.h"
+#include "tao/Invocation_Adapter.h"
+#include "ace/CORBA_macros.h"
+#include "ace/Global_Macros.h"
+#include "ace/Auto_Functor.h"
+
+ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+class ACE_Time_Value;
+ACE_END_VERSIONED_NAMESPACE_DECL
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Operation_Details;
+class TAO_Stub;
+class TAO_Asynch_Reply_Dispatcher;
+class TAO_Asynch_Reply_Dispatcher_Base;
+
+namespace CORBA
+{
+ class Object;
+ class Environment;
+ class SystemException;
+}
+
+namespace TAO
+{
+ class Argument;
+
+ class Collocation_Proxy_Broker;
+
+ /**
+ * @class Asynch_Invocation_Adapter
+ *
+ * @brief Generic interface for the invocation object visible to the
+ * IDL compiler.
+ *
+ */
+ class TAO_Messaging_Export Asynch_Invocation_Adapter
+ : public Invocation_Adapter
+ {
+ public:
+ Asynch_Invocation_Adapter (
+ CORBA::Object *target,
+ Argument **args,
+ int arg_number,
+ const char *operation,
+ size_t op_len,
+ Collocation_Proxy_Broker *b,
+ TAO::Invocation_Mode mode = TAO_ASYNCHRONOUS_CALLBACK_INVOCATION);
+
+ void invoke (Messaging::ReplyHandler_ptr reply_handler_ptr,
+ const TAO_Reply_Handler_Skeleton &reply_handler_skel
+ ACE_ENV_ARG_DECL);
+
+ virtual void invoke (TAO::Exception_Data *ex,
+ unsigned long ex_count
+ ACE_ENV_ARG_DECL);
+ protected:
+
+ virtual Invocation_Status invoke_twoway (
+ TAO_Operation_Details &op,
+ CORBA::Object_var &effective_target,
+ Profile_Transport_Resolver &r,
+ ACE_Time_Value *&max_wait_time
+ ACE_ENV_ARG_DECL);
+
+ private:
+ /// Autofunctor to manage the reply dispatcher
+ ACE_Utils::Auto_Functor<TAO_Asynch_Reply_Dispatcher_Base,
+ ARDB_Refcount_Functor> safe_rd_;
+
+ private:
+ /// Don't allow default initializations
+ Asynch_Invocation_Adapter (void);
+
+ Asynch_Invocation_Adapter (const Asynch_Invocation_Adapter &);
+ Asynch_Invocation_Adapter & operator= (const Asynch_Invocation_Adapter &);
+
+ };
+} // End namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_MESSAGING_ASYNCH_INVOCATION_ADAPTER_H */
diff --git a/TAO/tao/Messaging/Asynch_Reply_Dispatcher.cpp b/TAO/tao/Messaging/Asynch_Reply_Dispatcher.cpp
new file mode 100644
index 00000000000..a0a4d13cf08
--- /dev/null
+++ b/TAO/tao/Messaging/Asynch_Reply_Dispatcher.cpp
@@ -0,0 +1,283 @@
+// $Id$
+
+#include "tao/Messaging/Asynch_Reply_Dispatcher.h"
+
+#include "tao/Pluggable_Messaging_Utils.h"
+#include "tao/ORB_Core.h"
+#include "tao/debug.h"
+#include "tao/ORB_Core.h"
+#include "tao/Transport.h"
+
+#include "ace/CORBA_macros.h"
+
+ACE_RCSID(Messaging, Asynch_Reply_Dispatcher, "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Constructor.
+TAO_Asynch_Reply_Dispatcher::TAO_Asynch_Reply_Dispatcher (
+ const TAO_Reply_Handler_Skeleton &reply_handler_skel,
+ Messaging::ReplyHandler_ptr reply_handler,
+ TAO_ORB_Core *orb_core,
+ ACE_Allocator *allocator
+ )
+ :TAO_Asynch_Reply_Dispatcher_Base (orb_core, allocator)
+ , reply_handler_skel_ (reply_handler_skel)
+ , reply_handler_ (Messaging::ReplyHandler::_duplicate (reply_handler))
+ , timeout_handler_ (0)
+{
+}
+
+// Destructor.
+TAO_Asynch_Reply_Dispatcher::~TAO_Asynch_Reply_Dispatcher (void)
+{
+}
+
+// Dispatch the reply.
+int
+TAO_Asynch_Reply_Dispatcher::dispatch_reply (
+ TAO_Pluggable_Reply_Params &params
+ )
+{
+ if (params.input_cdr_ == 0)
+ return -1;
+
+ if (!this->try_dispatch_reply ())
+ return 0;
+
+ if (this->timeout_handler_)
+ {
+ // If we had registered timeout handlers just cancel them and
+ // loose ownership of the handlers
+ this->timeout_handler_->cancel ();
+ this->timeout_handler_->remove_reference ();
+ this->timeout_handler_ = 0;
+ // AMI Timeout Handling End
+ }
+
+ this->reply_status_ = params.reply_status_;
+
+ // Transfer the <params.input_cdr_>'s content to this->reply_cdr_
+ ACE_Data_Block *db =
+ this->reply_cdr_.clone_from (*params.input_cdr_);
+
+ if (db == 0)
+ {
+ if (TAO_debug_level > 2)
+ {
+ ACE_ERROR ((
+ LM_ERROR,
+ "TAO_Messaging (%P|%t) - Asynch_Reply_Dispatcher::dispatch_reply "
+ "clone_from failed \n"));
+ }
+ return -1;
+ }
+
+ // See whether we need to delete the data block by checking the
+ // flags. We cannot be happy that we initally allocated the
+ // datablocks of the stack. If this method is called twice, as is in
+ // some cases where the same invocation object is used to make two
+ // invocations like forwarding, the release becomes essential.
+ if (ACE_BIT_DISABLED (db->flags (),
+ ACE_Message_Block::DONT_DELETE))
+ db->release ();
+
+ // Steal the buffer, that way we don't do any unnecesary copies of
+ // this data.
+ CORBA::ULong const max = params.svc_ctx_.maximum ();
+ CORBA::ULong const len = params.svc_ctx_.length ();
+ IOP::ServiceContext *context_list = params.svc_ctx_.get_buffer (1);
+ this->reply_service_info_.replace (max, len, context_list, 1);
+
+ if (TAO_debug_level >= 4)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO_Messaging (%P|%t) - Asynch_Reply_Dispatcher::")
+ ACE_TEXT ("dispatch_reply\n")));
+ }
+
+ CORBA::ULong reply_error = TAO_AMI_REPLY_NOT_OK;
+ switch (this->reply_status_)
+ {
+ case TAO_PLUGGABLE_MESSAGE_NO_EXCEPTION:
+ reply_error = TAO_AMI_REPLY_OK;
+ break;
+ case TAO_PLUGGABLE_MESSAGE_USER_EXCEPTION:
+ reply_error = TAO_AMI_REPLY_USER_EXCEPTION;
+ break;
+ case TAO_PLUGGABLE_MESSAGE_SYSTEM_EXCEPTION:
+ reply_error = TAO_AMI_REPLY_SYSTEM_EXCEPTION;
+ break;
+ default:
+ case TAO_PLUGGABLE_MESSAGE_LOCATION_FORWARD:
+ case TAO_PLUGGABLE_MESSAGE_LOCATION_FORWARD_PERM:
+ // @@ Michael: Not even the spec mentions this case.
+ // We have to think about this case.
+ // Handle the forwarding and return so the stub restarts the
+ // request!
+ reply_error = TAO_AMI_REPLY_NOT_OK;
+ break;
+ }
+
+ if (!CORBA::is_nil (this->reply_handler_.in ()))
+ {
+ ACE_TRY_NEW_ENV
+ {
+ // Call the Reply Handler's skeleton.
+ reply_handler_skel_ (this->reply_cdr_,
+ this->reply_handler_.in (),
+ reply_error
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ if (TAO_debug_level >= 4)
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "Exception during reply handler");
+ }
+ ACE_ENDTRY;
+ }
+
+ this->decr_refcount ();
+
+ return 1;
+}
+
+void
+TAO_Asynch_Reply_Dispatcher::connection_closed (void)
+{
+ ACE_TRY_NEW_ENV
+ {
+ if (!this->try_dispatch_reply ())
+ return;
+
+ if (this->timeout_handler_)
+ {
+ // If we had registered timeout handlers just cancel them and
+ // loose ownership of the handlers
+ this->timeout_handler_->cancel ();
+ this->timeout_handler_->remove_reference ();
+ this->timeout_handler_ = 0;
+ }
+
+ // Generate a fake exception....
+ CORBA::COMM_FAILURE comm_failure (0, CORBA::COMPLETED_MAYBE);
+
+ TAO_OutputCDR out_cdr;
+
+ comm_failure._tao_encode (out_cdr ACE_ENV_ARG_PARAMETER);
+
+ ACE_TRY_CHECK;
+
+ // Turn into an output CDR
+ TAO_InputCDR cdr (out_cdr);
+
+ if (!CORBA::is_nil (this->reply_handler_.in ()))
+ {
+ this->reply_handler_skel_ (cdr,
+ this->reply_handler_.in (),
+ TAO_AMI_REPLY_SYSTEM_EXCEPTION
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ }
+ ACE_CATCHANY
+ {
+ if (TAO_debug_level >= 4)
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "Asynch_Reply_Dispacher::connection_closed");
+ }
+
+ }
+ ACE_ENDTRY;
+
+ (void) this->decr_refcount ();
+}
+
+// AMI Timeout Handling Begin
+
+void
+TAO_Asynch_Reply_Dispatcher::reply_timed_out (void)
+{
+ ACE_DECLARE_NEW_CORBA_ENV;
+
+ ACE_TRY
+ {
+ // Generate a fake exception....
+ CORBA::TIMEOUT timeout_failure (
+ CORBA::SystemException::_tao_minor_code (
+ TAO_TIMEOUT_RECV_MINOR_CODE,
+ errno),
+ CORBA::COMPLETED_MAYBE);
+
+ TAO_OutputCDR out_cdr;
+
+ timeout_failure._tao_encode (out_cdr ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ // This is okay here... Everything relies on our refcount being
+ // held by the timeout handler, whose refcount in turn is held
+ // by the reactor.
+ if (!this->try_dispatch_reply ())
+ return;
+
+ // @@ This check probably is unnecessary..
+ if (this->timeout_handler_)
+ {
+ // If we had registered timeout handlers just cancel them and
+ // loose ownership of the handlers
+ this->timeout_handler_->remove_reference ();
+ this->timeout_handler_ = 0;
+ }
+
+ // Turn into an output CDR
+ TAO_InputCDR cdr (out_cdr);
+
+ if (!CORBA::is_nil (this->reply_handler_.in ()))
+ {
+ this->reply_handler_skel_ (cdr,
+ this->reply_handler_.in (),
+ TAO_AMI_REPLY_SYSTEM_EXCEPTION
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ }
+ ACE_CATCHANY
+ {
+ if (TAO_debug_level >= 4)
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "Asynch_Reply_Dispacher::reply_timed_out");
+ }
+
+ }
+ ACE_ENDTRY;
+ ACE_CHECK;
+
+ (void) this->decr_refcount ();
+}
+
+long
+TAO_Asynch_Reply_Dispatcher::schedule_timer (CORBA::ULong request_id,
+ const ACE_Time_Value &max_wait_time
+ ACE_ENV_ARG_DECL)
+{
+ if (this->timeout_handler_ == 0)
+ {
+ // @@ Need to use the pool for this..
+ ACE_NEW_THROW_EX (this->timeout_handler_,
+ TAO_Asynch_Timeout_Handler (
+ this,
+ this->transport_->orb_core ()->reactor ()),
+ CORBA::NO_MEMORY ());
+ }
+
+ return this->timeout_handler_->schedule_timer (
+ this->transport_->tms (),
+ request_id,
+ max_wait_time);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Messaging/Asynch_Reply_Dispatcher.h b/TAO/tao/Messaging/Asynch_Reply_Dispatcher.h
new file mode 100644
index 00000000000..5b315547813
--- /dev/null
+++ b/TAO/tao/Messaging/Asynch_Reply_Dispatcher.h
@@ -0,0 +1,79 @@
+// This may look like C, but it's really -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Asynch_Reply_Dispatcher.h
+ *
+ * $Id$
+ *
+ * @author Alexander Babu Arulanthu <alex@cs.wustl.edu>
+ * @author Jeff Parsons <parsons@cs.wustl.edu>
+ */
+//=============================================================================
+
+
+#ifndef TAO_ASYNCH_REPLY_DISPATCHER_H
+#define TAO_ASYNCH_REPLY_DISPATCHER_H
+#include /**/ "ace/pre.h"
+
+#include "tao/Messaging/Messaging.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Messaging/Asynch_Timeout_Handler.h"
+#include "tao/Asynch_Reply_Dispatcher_Base.h"
+
+ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+class ACE_Allocator;
+ACE_END_VERSIONED_NAMESPACE_DECL
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/// Reply dispatcher for Asynchoronous Method Invocation (AMI)s.
+class TAO_Asynch_Reply_Dispatcher
+ : public TAO_Asynch_Reply_Dispatcher_Base
+{
+public:
+ /// Constructor.
+ TAO_Asynch_Reply_Dispatcher (
+ const TAO_Reply_Handler_Skeleton &reply_handler_skel,
+ Messaging::ReplyHandler_ptr reply_handler_ptr,
+ TAO_ORB_Core *orb_core,
+ ACE_Allocator *allocator
+ );
+
+ /// Destructor.
+ virtual ~TAO_Asynch_Reply_Dispatcher (void);
+
+ /// @name The Reply Dispatcher methods
+ //@{
+ virtual int dispatch_reply (TAO_Pluggable_Reply_Params &params);
+
+ virtual void connection_closed (void);
+ //@}
+
+ /// Inform that the reply timed out
+ virtual void reply_timed_out (void);
+
+ /// Install the timeout handler
+ long schedule_timer (CORBA::ULong request_id,
+ const ACE_Time_Value &max_wait_time
+ ACE_ENV_ARG_DECL);
+
+private:
+ /// Skeleton for the call back method in the Reply Handler.
+ const TAO_Reply_Handler_Skeleton reply_handler_skel_;
+
+ /// Reply Handler passed in the Asynchronous Invocation.
+ Messaging::ReplyHandler_var reply_handler_;
+
+ /// Timeout Handler in case of AMI timeouts
+ TAO_Asynch_Timeout_Handler *timeout_handler_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_ASYNCH_REPLY_DISPATCHER_H */
diff --git a/TAO/tao/Messaging/Asynch_Timeout_Handler.cpp b/TAO/tao/Messaging/Asynch_Timeout_Handler.cpp
new file mode 100644
index 00000000000..f72a1d46d85
--- /dev/null
+++ b/TAO/tao/Messaging/Asynch_Timeout_Handler.cpp
@@ -0,0 +1,78 @@
+// $Id$
+
+
+#include "tao/Messaging/Asynch_Timeout_Handler.h"
+
+#include "tao/Messaging/Asynch_Reply_Dispatcher.h"
+#include "tao/Transport_Mux_Strategy.h"
+#include "ace/Reactor.h"
+
+ACE_RCSID (Messaging,
+ Asynch_Timeout_Handler,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Asynch_Timeout_Handler::TAO_Asynch_Timeout_Handler (
+ TAO_Asynch_Reply_Dispatcher_Base *rd,
+ ACE_Reactor *reactor)
+ : rd_ (rd),
+ tms_ (0),
+ request_id_ (0),
+ reactor_ (reactor)
+{
+ // Enable reference counting on the event handler.
+ this->reference_counting_policy ().value (
+ ACE_Event_Handler::Reference_Counting_Policy::ENABLED);
+
+ // We own a reference
+ (void) this->rd_->incr_refcount ();
+}
+
+TAO_Asynch_Timeout_Handler::~TAO_Asynch_Timeout_Handler ()
+{
+ // Forget rd's reference
+ (void) this->rd_->decr_refcount ();
+}
+
+
+long
+TAO_Asynch_Timeout_Handler::schedule_timer (TAO_Transport_Mux_Strategy *tms,
+ CORBA::ULong request_id,
+ const ACE_Time_Value &max_wait_time)
+{
+ // Remember them for later.
+ this->tms_ = tms;
+ this->request_id_ = request_id;
+
+ return this->reactor_->schedule_timer (this, // handler
+ 0, // arg
+ max_wait_time);
+}
+
+int
+TAO_Asynch_Timeout_Handler::handle_timeout (const ACE_Time_Value &,
+ const void *)
+{
+ this->tms_->unbind_dispatcher (request_id_);
+
+ this->rd_->reply_timed_out ();
+
+ // reset any possible timeout errno
+ errno = 0;
+
+ // we are unregistered anyway
+ return 0;
+}
+
+void
+TAO_Asynch_Timeout_Handler::cancel ()
+{
+ // The tms_ is only set if we got scheduled.
+ if (this->tms_)
+ {
+ this->reactor_->cancel_timer (this);
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Messaging/Asynch_Timeout_Handler.h b/TAO/tao/Messaging/Asynch_Timeout_Handler.h
new file mode 100644
index 00000000000..9b8a55eb8c2
--- /dev/null
+++ b/TAO/tao/Messaging/Asynch_Timeout_Handler.h
@@ -0,0 +1,82 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Asynch_Timeout_Handler.h
+ *
+ * $Id$
+ *
+ * Timeout Handler for AMI timeouts
+ *
+ *
+ * @author Michael Kircher <Michael.Kircher@mchp.siemens.de>
+ */
+//=============================================================================
+
+
+#ifndef TAO_ASYNCH_TIMEOUT_HANDLER_H
+#define TAO_ASYNCH_TIMEOUT_HANDLER_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Messaging/messaging_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/orbconf.h"
+#include "tao/Basic_Types.h"
+
+#include "ace/Event_Handler.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Asynch_Reply_Dispatcher_Base;
+class TAO_Transport_Mux_Strategy;
+
+/**
+ * @class TAO_Asynch_Timeout_Handler
+ *
+ * @brief Handler registered with the reactor in case of AMI timeouts.
+ */
+class TAO_Asynch_Timeout_Handler
+ : public ACE_Event_Handler
+{
+public:
+ TAO_Asynch_Timeout_Handler (TAO_Asynch_Reply_Dispatcher_Base *rd,
+ ACE_Reactor *reactor);
+
+ ~TAO_Asynch_Timeout_Handler ();
+
+ /// Schedule a timer
+ long schedule_timer (TAO_Transport_Mux_Strategy *tms,
+ CORBA::ULong request_id,
+ const ACE_Time_Value &max_wait_time);
+
+ /// Invoked by the reactor on timeout
+ virtual int handle_timeout (const ACE_Time_Value &current_time,
+ const void *act);
+
+ /// Cancel this timer, remove it from the reactor
+ virtual void cancel ();
+
+public:
+ /// The reply dispatcher expecting the reply
+ TAO_Asynch_Reply_Dispatcher_Base *rd_;
+
+ /// The transport mux strategy dispatching the reply
+ TAO_Transport_Mux_Strategy *tms_;
+
+ /// Remember the ID of the request.
+ CORBA::ULong request_id_;
+
+ /// Our reactor
+ ACE_Reactor *reactor_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_ASYNCH_TIMEOUT_HANDLER_H */
diff --git a/TAO/tao/Messaging/Connection_Timeout_Policy_i.cpp b/TAO/tao/Messaging/Connection_Timeout_Policy_i.cpp
new file mode 100644
index 00000000000..d17338aae9c
--- /dev/null
+++ b/TAO/tao/Messaging/Connection_Timeout_Policy_i.cpp
@@ -0,0 +1,200 @@
+//$Id$
+#include "tao/Messaging/Connection_Timeout_Policy_i.h"
+#include "tao/ORB_Core.h"
+#include "tao/Stub.h"
+#include "tao/debug.h"
+#include "tao/AnyTypeCode/Any.h"
+
+ACE_RCSID (Messaging,
+ Connection_Timeout_Policy_i,
+ "$Id$")
+
+
+#if (TAO_HAS_CONNECTION_TIMEOUT_POLICY == 1)
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_ConnectionTimeoutPolicy::TAO_ConnectionTimeoutPolicy (
+ const TimeBase::TimeT& relative_expiry)
+ : ::CORBA::Object ()
+ , ::CORBA::Policy ()
+ , ::CORBA::LocalObject ()
+ , TAO::ConnectionTimeoutPolicy ()
+ , TAO_Local_RefCounted_Object ()
+ , relative_expiry_ (relative_expiry)
+{
+}
+
+TAO_ConnectionTimeoutPolicy::TAO_ConnectionTimeoutPolicy (
+ const TAO_ConnectionTimeoutPolicy &rhs)
+ : ::CORBA::Object ()
+ , ::CORBA::Policy ()
+ , ::CORBA::LocalObject ()
+ , TAO::ConnectionTimeoutPolicy ()
+ , TAO_Local_RefCounted_Object ()
+ , relative_expiry_ (rhs.relative_expiry_)
+{
+}
+
+TimeBase::TimeT
+TAO_ConnectionTimeoutPolicy::relative_expiry (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return this->relative_expiry_;
+}
+
+CORBA::PolicyType
+TAO_ConnectionTimeoutPolicy::policy_type (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return TAO::CONNECTION_TIMEOUT_POLICY_TYPE;
+}
+
+void
+TAO_ConnectionTimeoutPolicy::hook (TAO_ORB_Core *orb_core,
+ TAO_Stub *stub,
+ bool &has_timeout,
+ ACE_Time_Value &time_value)
+{
+ ACE_TRY_NEW_ENV
+ {
+ CORBA::Policy_var policy = 0;
+
+ if (stub == 0)
+ {
+ policy =
+ orb_core->get_cached_policy_including_current (
+ TAO_CACHED_POLICY_CONNECTION_TIMEOUT
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ else
+ {
+ policy =
+ stub->get_cached_policy (
+ TAO_CACHED_POLICY_CONNECTION_TIMEOUT
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+
+ if (CORBA::is_nil (policy.in ()))
+ {
+ has_timeout = 0;
+ return;
+ }
+
+ TAO::ConnectionTimeoutPolicy_var p =
+ TAO::ConnectionTimeoutPolicy::_narrow (
+ policy.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ TimeBase::TimeT t = p->relative_expiry (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ TimeBase::TimeT seconds = t / 10000000u;
+ TimeBase::TimeT microseconds = (t % 10000000u) / 10;
+ time_value.set (ACE_U64_TO_U32 (seconds),
+ ACE_U64_TO_U32 (microseconds));
+
+ // Set the flag once all operations complete successfully
+ has_timeout = 1;
+
+ if (TAO_debug_level > 0)
+ {
+ CORBA::ULong msecs =
+ static_cast<CORBA::ULong> (microseconds / 1000);
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - Timeout is <%u>\n"),
+ msecs));
+ }
+ }
+ ACE_CATCHANY
+ {
+ // Ignore all exceptions...
+ }
+ ACE_ENDTRY;
+}
+
+CORBA::Policy_ptr
+TAO_ConnectionTimeoutPolicy::create (const CORBA::Any& val
+ ACE_ENV_ARG_DECL)
+{
+ // Future policy implementors: notice how the following code is
+ // exception safe!
+
+ TimeBase::TimeT value;
+ if ((val >>= value) == 0)
+ ACE_THROW_RETURN (CORBA::PolicyError (CORBA::BAD_POLICY_VALUE),
+ CORBA::Policy::_nil ());
+
+ TAO_ConnectionTimeoutPolicy *tmp;
+ ACE_NEW_THROW_EX (tmp,
+ TAO_ConnectionTimeoutPolicy (value),
+ CORBA::NO_MEMORY (TAO::VMCID,
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+
+ return tmp;
+}
+
+TAO_ConnectionTimeoutPolicy *
+TAO_ConnectionTimeoutPolicy::clone (void) const
+{
+ TAO_ConnectionTimeoutPolicy *copy = 0;
+ ACE_NEW_RETURN (copy,
+ TAO_ConnectionTimeoutPolicy (*this),
+ 0);
+ return copy;
+}
+
+CORBA::Policy_ptr
+TAO_ConnectionTimeoutPolicy::copy (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ // Future policy implementors: notice how the following code is
+ // exception safe!
+ TAO_ConnectionTimeoutPolicy* tmp = 0;
+ ACE_NEW_THROW_EX (tmp,
+ TAO_ConnectionTimeoutPolicy (*this),
+ CORBA::NO_MEMORY (TAO::VMCID,
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+
+ return tmp;
+}
+
+void
+TAO_ConnectionTimeoutPolicy::destroy (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+}
+
+TAO_Cached_Policy_Type
+TAO_ConnectionTimeoutPolicy::_tao_cached_type (void) const
+{
+ return TAO_CACHED_POLICY_CONNECTION_TIMEOUT;
+}
+
+void
+TAO_ConnectionTimeoutPolicy::set_time_value (ACE_Time_Value &time_value)
+{
+ TimeBase::TimeT t = this->relative_expiry_;
+ TimeBase::TimeT seconds = t / 10000000u;
+ TimeBase::TimeT microseconds = (t % 10000000u) / 10;
+ time_value.set (ACE_U64_TO_U32 (seconds),
+ ACE_U64_TO_U32 (microseconds));
+
+ if (TAO_debug_level > 0)
+ {
+ CORBA::ULong const msecs = time_value.msec ();
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - Timeout is <%u>\n"),
+ msecs));
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_RELATIVE_ROUNDTRIP_TIMEOUT_POLICY == 1 */
diff --git a/TAO/tao/Messaging/Connection_Timeout_Policy_i.h b/TAO/tao/Messaging/Connection_Timeout_Policy_i.h
new file mode 100644
index 00000000000..9e334a307a7
--- /dev/null
+++ b/TAO/tao/Messaging/Connection_Timeout_Policy_i.h
@@ -0,0 +1,106 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Connection_Timeout_Policy_i.h
+ *
+ * $Id$
+ *
+ * @author Balachandran Natarajan (bala@cs.wustl.edu)
+ */
+//=============================================================================
+
+#ifndef TAO_CONNECTION_TIMEOUT_POLICY_I_H
+#define TAO_CONNECTION_TIMEOUT_POLICY_I_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Messaging/TAO_ExtC.h"
+#include "tao/LocalObject.h"
+
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+
+#if (TAO_HAS_CONNECTION_TIMEOUT_POLICY == 1)
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/*
+ * @class TAO_ConnectionTimeoutPolicy
+ *
+ * @brief TAO::ConnectionTimeoutPolicy implementation
+ *
+ * This policy controls the connection timeout time while
+ * establishing connections. This policy is proprietary to TAO.
+ */
+class TAO_ConnectionTimeoutPolicy
+ : public TAO::ConnectionTimeoutPolicy,
+ public TAO_Local_RefCounted_Object
+{
+
+public:
+ /// Constructor.
+ TAO_ConnectionTimeoutPolicy (const TimeBase::TimeT& relative_expiry);
+
+ /// Copy constructor.
+ TAO_ConnectionTimeoutPolicy (const TAO_ConnectionTimeoutPolicy &rhs);
+
+ /// Implement the timeout hook, this is set in the ORB_Core at
+ /// initialization time.
+ static void hook (TAO_ORB_Core *orb_core,
+ TAO_Stub *stub,
+ bool &has_timeout,
+ ACE_Time_Value &time_value);
+
+ /// Helper method for the implementation of
+ /// CORBA::ORB::create_policy.
+ static CORBA::Policy_ptr create (const CORBA::Any& val
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ /// Returns a copy of <this>.
+ virtual TAO_ConnectionTimeoutPolicy *clone (void) const;
+
+ // = The TAO::ConnectionTinoutPolicy methods
+ virtual TimeBase::TimeT relative_expiry (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual CORBA::PolicyType policy_type (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual CORBA::Policy_ptr copy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual void destroy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Change the CORBA representation to the ACE representation.
+ void set_time_value (ACE_Time_Value &time_value);
+
+ /// Return the cached policy type for this policy.
+ virtual TAO_Cached_Policy_Type _tao_cached_type (void) const;
+
+private:
+ /// The attribute
+ TimeBase::TimeT relative_expiry_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_RELATIVE_ROUNDTRIP_TIMEOUT_POLICY == 1 */
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_CONNECTION_TIMEOUT_POLICY_I_H */
diff --git a/TAO/tao/Messaging/ExceptionHolder.pidl b/TAO/tao/Messaging/ExceptionHolder.pidl
new file mode 100644
index 00000000000..a00643e9368
--- /dev/null
+++ b/TAO/tao/Messaging/ExceptionHolder.pidl
@@ -0,0 +1,43 @@
+// -*- IDL -*-
+
+//=============================================================================
+/**
+ * @file ExceptionHolder.pidl
+ *
+ * $Id$
+ *
+ * tao_idl
+ * -o orig -Gp -Gd -Ge 1 -GA -SS
+ * -Wb,export_macro=TAO_Messaging_Export
+ * -Wb,export_include=messaging_export.h
+ * -Wb,pre_include="ace/pre.h"
+ * -Wb,post_include="ace/post.h" -I$(TAO_ROOT)
+ * ExceptionHolder.pidl
+ *
+ */
+//=============================================================================
+
+#ifndef TAO_MESSAGING_EXCEPTIONHOLDER_PIDL
+#define TAO_MESSAGING_EXCEPTIONHOLDER_PIDL
+
+#include "tao/OctetSeq.pidl"
+#include "tao/AnyTypeCode/Dynamic.pidl"
+
+#pragma prefix "omg.org"
+
+module Messaging
+{
+ /// Exception Delivery in the Callback Model
+ native UserExceptionBase;
+ valuetype ExceptionHolder {
+ void raise_exception() raises (UserExceptionBase);
+ void raise_exception_with_list(
+ in Dynamic::ExceptionList exc_list)
+ raises (UserExceptionBase);
+ private boolean is_system_exception;
+ private boolean byte_order;
+ private CORBA::OctetSeq marshaled_exception;
+ };
+};
+
+#endif /* TAO_MESSAGING_EXCEPTIONHOLDER_PIDL */
diff --git a/TAO/tao/Messaging/ExceptionHolder_i.cpp b/TAO/tao/Messaging/ExceptionHolder_i.cpp
new file mode 100644
index 00000000000..47ef03212b3
--- /dev/null
+++ b/TAO/tao/Messaging/ExceptionHolder_i.cpp
@@ -0,0 +1,95 @@
+// -*- C++ -*-
+// $Id$
+
+#include "tao/Messaging/ExceptionHolder_i.h"
+
+ACE_RCSID (Messaging,
+ ExceptionHolder_i,
+ "$Id$")
+
+#include "tao/Messaging/Messaging.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ ExceptionHolder::ExceptionHolder (void) :
+ data_ (0),
+ count_ (0)
+ {
+ }
+
+ ExceptionHolder::ExceptionHolder (
+ ::CORBA::Boolean is_system_exception,
+ ::CORBA::Boolean byte_order,
+ const ::CORBA::OctetSeq &marshaled_exception,
+ ::TAO::Exception_Data* data,
+ ::CORBA::ULong exceptions_count) :
+ ::OBV_Messaging::ExceptionHolder (is_system_exception, byte_order, marshaled_exception),
+ data_ (data),
+ count_ (exceptions_count)
+ {
+ }
+
+ ExceptionHolder::~ExceptionHolder ()
+ {
+ }
+
+ void ExceptionHolder::raise_exception (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ {
+ TAO_Messaging_Helper::exception_holder_raise (
+ this->data_,
+ this->count_,
+ this->marshaled_exception ().get_buffer (),
+ this->marshaled_exception ().length (),
+ this->byte_order (),
+ this->is_system_exception ()
+ ACE_ENV_ARG_PARAMETER);
+ }
+
+ void ExceptionHolder::raise_exception_with_list (
+ const ::Dynamic::ExceptionList & ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ {
+ // todo convert exceptionlist to something we can really use.
+ this->raise_exception (ACE_ENV_SINGLE_ARG_PARAMETER);
+ }
+
+ CORBA::ValueBase*
+ ExceptionHolder::_copy_value (void)
+ {
+ TAO::ExceptionHolder* ret_val = 0;
+ ACE_NEW_THROW_EX (ret_val,
+ ExceptionHolder,
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (0);
+
+ // @todo According to the latest corba spec we should be able to
+ // pass this to the ExceptionHolder constructor but the TAO_IDL
+ // compiler doesn't seem to generate this.
+ ret_val->is_system_exception (this->is_system_exception ());
+ ret_val->byte_order (this->byte_order ());
+ ret_val->marshaled_exception (this->marshaled_exception ());
+
+ return ret_val;
+ }
+
+ CORBA::ValueBase *
+ ExceptionHolderFactory::create_for_unmarshal (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ {
+ TAO::ExceptionHolder* ret_val = 0;
+ ACE_NEW_THROW_EX (ret_val,
+ ExceptionHolder,
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (0);
+
+ return ret_val;
+ }
+
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
diff --git a/TAO/tao/Messaging/ExceptionHolder_i.h b/TAO/tao/Messaging/ExceptionHolder_i.h
new file mode 100644
index 00000000000..c77d78e1e28
--- /dev/null
+++ b/TAO/tao/Messaging/ExceptionHolder_i.h
@@ -0,0 +1,100 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file ExceptionHolder_i.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_MESSAGING_EXCEPTIONHOLDER_I_H
+#define TAO_MESSAGING_EXCEPTIONHOLDER_I_H
+#include /**/ "ace/pre.h"
+
+#include "tao/Messaging/messaging_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/orbconf.h"
+
+#include "tao/Messaging/ExceptionHolderA.h"
+#include "tao/Messaging/ExceptionHolderC.h"
+#include "tao/Valuetype/ValueFactory.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace Dynamic
+{
+ class ExceptionList;
+}
+
+namespace Messaging
+{
+ class ReplyHandler;
+}
+
+namespace TAO
+{
+ struct Exception_Data;
+
+ class TAO_Messaging_Export ExceptionHolder
+ : public virtual ::OBV_Messaging::ExceptionHolder,
+ public virtual ::CORBA::DefaultValueRefCountBase
+ {
+ public:
+ ExceptionHolder (void);
+
+ ExceptionHolder (
+ ::CORBA::Boolean is_system_exception,
+ ::CORBA::Boolean byte_order,
+ const ::CORBA::OctetSeq &marshaled_exception,
+ ::TAO::Exception_Data* data_,
+ ::CORBA::ULong exceptions_count
+ );
+
+ virtual void raise_exception (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS);
+
+ virtual void raise_exception_with_list (
+ const ::Dynamic::ExceptionList & exc_list ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ virtual CORBA::ValueBase* _copy_value (void);
+
+ protected:
+
+ virtual ~ExceptionHolder (void);
+
+ private:
+
+ TAO::Exception_Data* const data_;
+ CORBA::ULong const count_;
+
+ };
+
+ /**
+ * @class ExceptionHolderFactory
+ *
+ * @brief OBV factory implementation.
+ *
+ * Factory for ExceptionHolder
+ */
+ class TAO_Messaging_Export ExceptionHolderFactory :
+ public virtual CORBA::ValueFactoryBase
+ {
+ public:
+ virtual CORBA::ValueBase * create_for_unmarshal (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS);
+ };
+
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_MESSAGING_EXCEPTIONHOLDER_I_H */
+
diff --git a/TAO/tao/Messaging/Messaging.cpp b/TAO/tao/Messaging/Messaging.cpp
new file mode 100644
index 00000000000..9f0c1f164cf
--- /dev/null
+++ b/TAO/tao/Messaging/Messaging.cpp
@@ -0,0 +1,118 @@
+// -*- C++ -*-
+// $Id$
+
+#include "tao/Messaging/Messaging.h"
+#include "tao/Messaging/Messaging_Loader.h"
+
+#include "tao/Exception_Data.h"
+#include "tao/debug.h"
+#include "tao/ORB_Constants.h"
+#include "tao/CDR.h"
+
+#include "ace/Auto_Ptr.h"
+#include "ace/OS_NS_string.h"
+
+
+ACE_RCSID (Messaging,
+ Messaging,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+int
+TAO_Messaging_Initializer::init (void)
+{
+ return ACE_Service_Config::process_directive (ace_svc_desc_TAO_Messaging_Loader);
+}
+
+void TAO_Messaging_Helper::
+exception_holder_raise (TAO::Exception_Data *exception_data,
+ CORBA::ULong exception_count,
+ CORBA::Octet *marshaled_data,
+ CORBA::ULong marshaled_data_length,
+ CORBA::Boolean byte_order,
+ CORBA::Boolean is_system_exception
+ ACE_ENV_ARG_DECL)
+{
+ TAO_InputCDR _tao_in ((const char*) marshaled_data,
+ marshaled_data_length,
+ byte_order);
+
+ CORBA::String_var type_id;
+
+ if ((_tao_in >> type_id.inout ()) == 0)
+ {
+ // Could not demarshal the exception id, raise a local
+ // CORBA::MARSHAL
+ ACE_THROW (CORBA::MARSHAL (TAO::VMCID,
+ CORBA::COMPLETED_YES));
+ }
+
+ if (is_system_exception)
+ {
+ CORBA::ULong minor = 0;
+ CORBA::ULong completion = 0;
+ if ((_tao_in >> minor) == 0 ||
+ (_tao_in >> completion) == 0)
+ ACE_THROW (CORBA::MARSHAL (TAO::VMCID,
+ CORBA::COMPLETED_MAYBE));
+
+ CORBA::SystemException* exception =
+ TAO::create_system_exception (type_id.in ());
+
+ if (exception == 0)
+ {
+ // @@ We should raise a CORBA::NO_MEMORY, but we ran out
+ // of memory already. We need a pre-allocated, TSS,
+ // CORBA::NO_MEMORY instance
+ ACE_NEW (exception, CORBA::UNKNOWN);
+ }
+ exception->minor (minor);
+ exception->completed (CORBA::CompletionStatus (completion));
+
+ // Raise the exception.
+#if defined (TAO_HAS_EXCEPTIONS)
+ ACE_Auto_Basic_Ptr<CORBA::SystemException> e_ptr(exception);
+#endif
+ ACE_ENV_RAISE (exception);
+
+ return;
+ }
+
+ // Match the exception interface repository id with the
+ // exception in the exception list.
+ // This is important to decode the exception.
+ for (CORBA::ULong i = 0; i != exception_count; ++i)
+ {
+ if (ACE_OS::strcmp (type_id.in (), exception_data[i].id) != 0)
+ continue;
+
+ CORBA::Exception * const exception = exception_data[i].alloc ();
+
+ if (exception == 0)
+ ACE_THROW (CORBA::NO_MEMORY (TAO::VMCID,
+ CORBA::COMPLETED_YES));
+ exception->_tao_decode (_tao_in ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Raise the exception.
+#if defined (TAO_HAS_EXCEPTIONS)
+ ACE_Auto_Basic_Ptr<CORBA::Exception> e_ptr (exception);
+#endif
+ ACE_ENV_RAISE (exception);
+
+ return;
+ }
+
+ // If we couldn't find the right exception, report it as
+ // CORBA::UNKNOWN.
+
+ // @@ It would seem like if the remote exception is a
+ // UserException we can assume that the request was
+ // completed.
+ ACE_THROW (CORBA::UNKNOWN (TAO::VMCID,
+ CORBA::COMPLETED_YES));
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Messaging/Messaging.h b/TAO/tao/Messaging/Messaging.h
new file mode 100644
index 00000000000..4c4647e5432
--- /dev/null
+++ b/TAO/tao/Messaging/Messaging.h
@@ -0,0 +1,98 @@
+// -*- C++ -*-
+
+// ================================================================
+/**
+ * @file Messaging.h
+ *
+ * $Id$
+ *
+ * Include all the required headers to use CORBA Messaging easily.
+ *
+ * @author Carlos O'Ryan <coryan@uci.edu>
+ */
+// ================================================================
+
+#ifndef TAO_MESSAGING_H
+#define TAO_MESSAGING_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Messaging/messaging_export.h"
+
+#define TAO_MESSAGING_SAFE_INCLUDE
+#include "tao/Messaging/MessagingC.h"
+#undef TAO_MESSAGING_SAFE_INCLUDE
+
+#include "tao/Messaging/MessagingA.h"
+#include "tao/Messaging/TAO_ExtC.h"
+#include "tao/TAOC.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Messaging_Export TAO_Messaging_Initializer
+{
+public:
+ /// Used to force the initialisation of the ORB code.
+ static int init (void);
+};
+
+static int
+TAO_Requires_Messaging_Initializer = TAO_Messaging_Initializer::init ();
+
+// Typedef for the Reply Handler Skeleton.
+// This is handcrafted not generated by the IDL compiler.
+
+class TAO_InputCDR;
+
+enum TAO_AMI_Reply_Status
+{
+ /// Reply is normal.
+ TAO_AMI_REPLY_OK,
+
+ /// Reply is not normal and no exceptions
+ TAO_AMI_REPLY_NOT_OK,
+
+ /// An user exception was raised.
+ TAO_AMI_REPLY_USER_EXCEPTION,
+
+ /// An system exception was raised.
+ TAO_AMI_REPLY_SYSTEM_EXCEPTION
+};
+
+
+typedef void (*TAO_Reply_Handler_Skeleton)(
+ TAO_InputCDR &,
+ Messaging::ReplyHandler_ptr,
+ CORBA::ULong reply_status
+ ACE_ENV_ARG_DECL_NOT_USED
+ );
+
+namespace TAO
+{
+ struct Exception_Data;
+}
+
+/**
+ * @namespace TAO_Messaging_Helper
+ *
+ * @brief Define helper functions for the CORBA Messaging
+ * implementation in TAO.
+ */
+namespace TAO_Messaging_Helper
+{
+ /// Implement the code shared by all the ExceptionHolder::raise_*()
+ /// operations
+ void TAO_Messaging_Export exception_holder_raise (
+ TAO::Exception_Data *exception_data,
+ CORBA::ULong exception_count,
+ CORBA::Octet *marshaled_data,
+ CORBA::ULong marshaled_data_length,
+ CORBA::Boolean byte_order,
+ CORBA::Boolean is_system_exception
+ ACE_ENV_ARG_DECL);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_MESSAGING_H */
diff --git a/TAO/tao/Messaging/Messaging.pidl b/TAO/tao/Messaging/Messaging.pidl
new file mode 100644
index 00000000000..08e6b4c13ae
--- /dev/null
+++ b/TAO/tao/Messaging/Messaging.pidl
@@ -0,0 +1,53 @@
+// -*- IDL -*-
+
+//=============================================================================
+/**
+ * @file Messaging.pidl
+ *
+ * $Id$
+ *
+ * This file was used to generate the code in Messaging{C,S,S_T}.{h,i,cpp}
+ *
+ * The command used to generate code from this file is:
+ *
+ * tao_idl
+ * -o orig -Gp -Gd -Ge 1 -GA -Ssi
+ * -Wb,export_macro=TAO_Messaging_Export
+ * -Wb,export_include=messaging_export.h
+ * -Wb,pre_include="ace/pre.h"
+ * -Wb,post_include="ace/post.h" -I$(TAO_ROOT)
+ * Messaging.pidl
+ *
+ * after the file is generated a patch must be applied:
+ *
+ * cp orig/Messaging{A,C,S,S_T}.{h,inl,cpp} .
+ * patch < diffs/Messaging.diff
+ *
+ * The patch eliminates cycles in the include dependencies.
+ *
+ * Note: to update the patch file after re-generating the code use:
+ *
+ * for i in Messaging{A,C,S,S_T}.{h,inl,cpp}; do
+ * diff -uBbw orig/$i $i;
+ * done > diffs/Messaging.diff
+ */
+//=============================================================================
+
+#ifndef TAO_MESSAGING_PIDL
+#define TAO_MESSAGING_PIDL
+
+#include "tao/Messaging/Messaging_SyncScope_Policy.pidl"
+#include "tao/Messaging/Messaging_RT_Policy.pidl"
+#include "tao/Messaging/Messaging_No_Impl.pidl"
+#include "tao/Messaging/Pollable.pidl"
+#include "tao/Messaging/OldExceptionHolder.pidl"
+
+#pragma prefix "omg.org"
+
+module Messaging
+{
+ /// Base interface for the Callback model
+ interface ReplyHandler { };
+};
+
+#endif /* TAO_MESSAGING_PIDL */
diff --git a/TAO/tao/Messaging/MessagingA.cpp b/TAO/tao/Messaging/MessagingA.cpp
new file mode 100644
index 00000000000..d54d9ed1a34
--- /dev/null
+++ b/TAO/tao/Messaging/MessagingA.cpp
@@ -0,0 +1,170 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+#include "tao/Messaging/Messaging.h"
+#include "tao/AnyTypeCode/Null_RefCount_Policy.h"
+#include "tao/AnyTypeCode/TypeCode_Constants.h"
+#include "tao/AnyTypeCode/Alias_TypeCode_Static.h"
+#include "tao/AnyTypeCode/Objref_TypeCode_Static.h"
+#include "tao/AnyTypeCode/Any.h"
+#include "tao/CDR.h"
+#include "tao/AnyTypeCode/Any.h"
+#include "tao/AnyTypeCode/Any_Impl_T.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/objref_typecode.cpp:76
+
+static TAO::TypeCode::Objref<char const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_Messaging_ReplyHandler (
+ ::CORBA::tk_objref,
+ "IDL:omg.org/Messaging/ReplyHandler:1.0",
+ "ReplyHandler");
+
+namespace Messaging
+{
+ ::CORBA::TypeCode_ptr const _tc_ReplyHandler =
+ &_tao_tc_Messaging_ReplyHandler;
+}
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/any_op_cs.cpp:51
+
+namespace TAO
+{
+ template<>
+ ::CORBA::Boolean
+ Any_Impl_T<Messaging::ReplyHandler>::to_object (
+ ::CORBA::Object_ptr &_tao_elem
+ ) const
+ {
+ _tao_elem = ::CORBA::Object::_duplicate (this->value_);
+ return true;
+ }
+}
+
+#if defined (ACE_ANY_OPS_USE_NAMESPACE)
+
+namespace Messaging
+{
+
+
+ // Copying insertion.
+ void
+ operator<<= (
+ ::CORBA::Any &_tao_any,
+ ReplyHandler_ptr _tao_elem
+ )
+ {
+ ReplyHandler_ptr _tao_objptr =
+ ReplyHandler::_duplicate (_tao_elem);
+ _tao_any <<= &_tao_objptr;
+ }
+
+ // Non-copying insertion.
+ void
+ operator<<= (
+ ::CORBA::Any &_tao_any,
+ ReplyHandler_ptr *_tao_elem
+ )
+ {
+ TAO::Any_Impl_T<ReplyHandler>::insert (
+ _tao_any,
+ ReplyHandler::_tao_any_destructor,
+ _tc_ReplyHandler,
+ *_tao_elem
+ );
+ }
+
+ ::CORBA::Boolean
+ operator>>= (
+ const ::CORBA::Any &_tao_any,
+ ReplyHandler_ptr &_tao_elem
+ )
+ {
+ return
+ TAO::Any_Impl_T<ReplyHandler>::extract (
+ _tao_any,
+ ReplyHandler::_tao_any_destructor,
+ _tc_ReplyHandler,
+ _tao_elem
+ );
+ }
+}
+
+#else
+
+
+// Copying insertion.
+void
+operator<<= (
+ ::CORBA::Any &_tao_any,
+ Messaging::ReplyHandler_ptr _tao_elem
+ )
+{
+ Messaging::ReplyHandler_ptr _tao_objptr =
+ Messaging::ReplyHandler::_duplicate (_tao_elem);
+ _tao_any <<= &_tao_objptr;
+}
+
+// Non-copying insertion.
+void
+operator<<= (
+ ::CORBA::Any &_tao_any,
+ Messaging::ReplyHandler_ptr *_tao_elem
+ )
+{
+ TAO::Any_Impl_T<Messaging::ReplyHandler>::insert (
+ _tao_any,
+ Messaging::ReplyHandler::_tao_any_destructor,
+ Messaging::_tc_ReplyHandler,
+ *_tao_elem
+ );
+}
+
+::CORBA::Boolean
+operator>>= (
+ const ::CORBA::Any &_tao_any,
+ Messaging::ReplyHandler_ptr &_tao_elem
+ )
+{
+ return
+ TAO::Any_Impl_T<Messaging::ReplyHandler>::extract (
+ _tao_any,
+ Messaging::ReplyHandler::_tao_any_destructor,
+ Messaging::_tc_ReplyHandler,
+ _tao_elem
+ );
+}
+
+#endif
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Messaging/MessagingA.h b/TAO/tao/Messaging/MessagingA.h
new file mode 100644
index 00000000000..9d9ddfbdaea
--- /dev/null
+++ b/TAO/tao/Messaging/MessagingA.h
@@ -0,0 +1,87 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:754
+
+#ifndef _TAO_IDL_MESSAGINGA_H_
+#define _TAO_IDL_MESSAGINGA_H_
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Messaging/messaging_export.h"
+#include "tao/Messaging/MessagingC.h"
+#include "tao/Messaging/Messaging_SyncScope_PolicyA.h"
+#include "tao/Messaging/Messaging_RT_PolicyA.h"
+#include "tao/Messaging/Messaging_No_ImplA.h"
+#include "tao/Messaging/ExceptionHolderA.h"
+
+// TAO_IDL - Generated from
+// be\be_visitor_module/module_ch.cpp:59
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace Messaging
+{
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:49
+
+ extern TAO_Messaging_Export ::CORBA::TypeCode_ptr const _tc_ReplyHandler;
+
+// TAO_IDL - Generated from
+// be\be_visitor_module/module_ch.cpp:86
+
+} // module Messaging
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/any_op_ch.cpp:54
+
+
+
+#if defined (ACE_ANY_OPS_USE_NAMESPACE)
+
+namespace Messaging
+{
+ TAO_Messaging_Export void operator<<= ( ::CORBA::Any &, ReplyHandler_ptr); // copying
+ TAO_Messaging_Export void operator<<= ( ::CORBA::Any &, ReplyHandler_ptr *); // non-copying
+ TAO_Messaging_Export ::CORBA::Boolean operator>>= (const ::CORBA::Any &, ReplyHandler_ptr &);
+}
+
+#else
+
+TAO_Messaging_Export void operator<<= (::CORBA::Any &, Messaging::ReplyHandler_ptr); // copying
+TAO_Messaging_Export void operator<<= (::CORBA::Any &, Messaging::ReplyHandler_ptr *); // non-copying
+TAO_Messaging_Export ::CORBA::Boolean operator>>= (const ::CORBA::Any &, Messaging::ReplyHandler_ptr &);
+
+#endif
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* ifndef */
diff --git a/TAO/tao/Messaging/MessagingC.cpp b/TAO/tao/Messaging/MessagingC.cpp
new file mode 100644
index 00000000000..a6db499d6e0
--- /dev/null
+++ b/TAO/tao/Messaging/MessagingC.cpp
@@ -0,0 +1,243 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:277
+
+
+#include "tao/Messaging/Messaging.h"
+#include "tao/CDR.h"
+#include "tao/Object_T.h"
+#include "ace/OS_NS_string.h"
+
+#if !defined (__ACE_INLINE__)
+#include "tao/Messaging/MessagingC.inl"
+#endif /* !defined INLINE */
+
+// TAO_IDL - Generated from
+// be\be_visitor_arg_traits.cpp:70
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Arg traits specializations.
+namespace TAO
+{
+}
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/interface_cs.cpp:60
+
+// Traits specializations for Messaging::ReplyHandler.
+
+Messaging::ReplyHandler_ptr
+TAO::Objref_Traits<Messaging::ReplyHandler>::duplicate (
+ Messaging::ReplyHandler_ptr p
+ )
+{
+ return Messaging::ReplyHandler::_duplicate (p);
+}
+
+void
+TAO::Objref_Traits<Messaging::ReplyHandler>::release (
+ Messaging::ReplyHandler_ptr p
+ )
+{
+ ::CORBA::release (p);
+}
+
+Messaging::ReplyHandler_ptr
+TAO::Objref_Traits<Messaging::ReplyHandler>::nil (void)
+{
+ return Messaging::ReplyHandler::_nil ();
+}
+
+::CORBA::Boolean
+TAO::Objref_Traits<Messaging::ReplyHandler>::marshal (
+ Messaging::ReplyHandler_ptr p,
+ TAO_OutputCDR & cdr
+ )
+{
+ return ::CORBA::Object::marshal (p, cdr);
+}
+
+// Function pointer for collocation factory initialization.
+TAO::Collocation_Proxy_Broker *
+(*Messaging__TAO_ReplyHandler_Proxy_Broker_Factory_function_pointer) (
+ ::CORBA::Object_ptr obj
+ ) = 0;
+
+Messaging::ReplyHandler::ReplyHandler (void)
+ : the_TAO_ReplyHandler_Proxy_Broker_ (0)
+{
+ this->Messaging_ReplyHandler_setup_collocation ();
+}
+
+void
+Messaging::ReplyHandler::Messaging_ReplyHandler_setup_collocation ()
+{
+ if (::Messaging__TAO_ReplyHandler_Proxy_Broker_Factory_function_pointer)
+ {
+ this->the_TAO_ReplyHandler_Proxy_Broker_ =
+ ::Messaging__TAO_ReplyHandler_Proxy_Broker_Factory_function_pointer (this);
+ }
+}
+
+Messaging::ReplyHandler::~ReplyHandler (void)
+{}
+
+void
+Messaging::ReplyHandler::_tao_any_destructor (void *_tao_void_pointer)
+{
+ ReplyHandler *_tao_tmp_pointer =
+ static_cast<ReplyHandler *> (_tao_void_pointer);
+ ::CORBA::release (_tao_tmp_pointer);
+}
+
+Messaging::ReplyHandler_ptr
+Messaging::ReplyHandler::_narrow (
+ ::CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL
+ )
+{
+ return
+ TAO::Narrow_Utils<ReplyHandler>::narrow (
+ _tao_objref,
+ "IDL:omg.org/Messaging/ReplyHandler:1.0",
+ Messaging__TAO_ReplyHandler_Proxy_Broker_Factory_function_pointer
+ ACE_ENV_ARG_PARAMETER
+ );
+}
+
+Messaging::ReplyHandler_ptr
+Messaging::ReplyHandler::_unchecked_narrow (
+ ::CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL
+ )
+{
+ return
+ TAO::Narrow_Utils<ReplyHandler>::unchecked_narrow (
+ _tao_objref,
+ "IDL:omg.org/Messaging/ReplyHandler:1.0",
+ Messaging__TAO_ReplyHandler_Proxy_Broker_Factory_function_pointer
+ ACE_ENV_ARG_PARAMETER
+ );
+}
+
+Messaging::ReplyHandler_ptr
+Messaging::ReplyHandler::_duplicate (ReplyHandler_ptr obj)
+{
+ if (! ::CORBA::is_nil (obj))
+ {
+ obj->_add_ref ();
+ }
+
+ return obj;
+}
+
+void
+Messaging::ReplyHandler::_tao_release (ReplyHandler_ptr obj)
+{
+ ::CORBA::release (obj);
+}
+
+::CORBA::Boolean
+Messaging::ReplyHandler::_is_a (
+ const char *value
+ ACE_ENV_ARG_DECL
+ )
+{
+ if (
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/Messaging/ReplyHandler:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/Object:1.0"
+ )
+ )
+ {
+ return true; // success using local knowledge
+ }
+ else
+ {
+ return this->::CORBA::Object::_is_a (
+ value
+ ACE_ENV_ARG_PARAMETER
+ );
+ }
+}
+
+const char* Messaging::ReplyHandler::_interface_repository_id (void) const
+{
+ return "IDL:omg.org/Messaging/ReplyHandler:1.0";
+}
+
+::CORBA::Boolean
+Messaging::ReplyHandler::marshal (TAO_OutputCDR &cdr)
+{
+ return (cdr << this);
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/cdr_op_cs.cpp:63
+
+::CORBA::Boolean operator<< (
+ TAO_OutputCDR &strm,
+ const Messaging::ReplyHandler_ptr _tao_objref
+ )
+{
+ ::CORBA::Object_ptr _tao_corba_obj = _tao_objref;
+ return (strm << _tao_corba_obj);
+}
+
+::CORBA::Boolean operator>> (
+ TAO_InputCDR &strm,
+ Messaging::ReplyHandler_ptr &_tao_objref
+ )
+{
+ ::CORBA::Object_var obj;
+
+ if (!(strm >> obj.inout ()))
+ {
+ return false;
+ }
+
+ typedef ::Messaging::ReplyHandler RHS_SCOPED_NAME;
+
+ // Narrow to the right type.
+ _tao_objref =
+ TAO::Narrow_Utils<RHS_SCOPED_NAME>::unchecked_narrow (
+ obj.in (),
+ Messaging__TAO_ReplyHandler_Proxy_Broker_Factory_function_pointer
+ );
+
+ return 1;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Messaging/MessagingC.h b/TAO/tao/Messaging/MessagingC.h
new file mode 100644
index 00000000000..d9ca0057868
--- /dev/null
+++ b/TAO/tao/Messaging/MessagingC.h
@@ -0,0 +1,251 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:154
+
+#ifndef _TAO_IDL_MESSAGINGC_H_
+#define _TAO_IDL_MESSAGINGC_H_
+
+#include /**/ "ace/pre.h"
+
+
+#include "ace/config-all.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#ifndef TAO_MESSAGING_SAFE_INCLUDE
+#error "You should not include MessagingC.h directly, use Messaging.h"
+#endif /* !TAO_MESSAGING_SAFE_INCLUDE */
+
+#include "tao/Messaging/messaging_export.h"
+#include "tao/ORB.h"
+#include "tao/SystemException.h"
+#include "tao/Environment.h"
+#include "tao/Object.h"
+#include "tao/Objref_VarOut_T.h"
+
+#include "tao/Messaging/Messaging_SyncScope_PolicyC.h"
+#include "tao/Messaging/Messaging_RT_PolicyC.h"
+#include "tao/Messaging/Messaging_No_ImplC.h"
+#include "tao/Messaging/PollableC.h"
+#include "tao/Messaging/ExceptionHolderC.h"
+
+#if defined (TAO_EXPORT_MACRO)
+#undef TAO_EXPORT_MACRO
+#endif
+#define TAO_EXPORT_MACRO TAO_Messaging_Export
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// TAO_IDL - Generated from
+// be\be_visitor_root/root_ch.cpp:62
+
+namespace TAO
+{
+ class Collocation_Proxy_Broker;
+ template<typename T> class Narrow_Utils;
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_module/module_ch.cpp:49
+
+namespace Messaging
+{
+
+ // TAO_IDL - Generated from
+ // be\be_interface.cpp:646
+
+#if !defined (_MESSAGING_REPLYHANDLER__VAR_OUT_CH_)
+#define _MESSAGING_REPLYHANDLER__VAR_OUT_CH_
+
+ class ReplyHandler;
+ typedef ReplyHandler *ReplyHandler_ptr;
+
+ typedef
+ TAO_Objref_Var_T<
+ ReplyHandler
+ >
+ ReplyHandler_var;
+
+ typedef
+ TAO_Objref_Out_T<
+ ReplyHandler
+ >
+ ReplyHandler_out;
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:54
+
+#if !defined (_MESSAGING_REPLYHANDLER_CH_)
+#define _MESSAGING_REPLYHANDLER_CH_
+
+ class TAO_Messaging_Export ReplyHandler
+ : public virtual ::CORBA::Object
+ {
+ public:
+ friend class TAO::Narrow_Utils<ReplyHandler>;
+ typedef ReplyHandler_ptr _ptr_type;
+ typedef ReplyHandler_var _var_type;
+
+ // The static operations.
+ static ReplyHandler_ptr _duplicate (ReplyHandler_ptr obj);
+
+ static void _tao_release (ReplyHandler_ptr obj);
+
+ static ReplyHandler_ptr _narrow (
+ ::CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static ReplyHandler_ptr _unchecked_narrow (
+ ::CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static ReplyHandler_ptr _nil (void)
+ {
+ return static_cast<ReplyHandler_ptr> (0);
+ }
+
+ static void _tao_any_destructor (void *);
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:210
+
+ virtual ::CORBA::Boolean _is_a (
+ const char *type_id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ virtual const char* _interface_repository_id (void) const;
+ virtual ::CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+ private:
+ TAO::Collocation_Proxy_Broker *the_TAO_ReplyHandler_Proxy_Broker_;
+
+ protected:
+ // Concrete interface only.
+ ReplyHandler (void);
+
+ // These methods travese the inheritance tree and set the
+ // parents piece of the given class in the right mode.
+ virtual void Messaging_ReplyHandler_setup_collocation (void);
+
+ // Concrete non-local interface only.
+ ReplyHandler (
+ IOP::IOR *ior,
+ TAO_ORB_Core *orb_core = 0
+ );
+
+ // Non-local interface only.
+ ReplyHandler (
+ TAO_Stub *objref,
+ ::CORBA::Boolean _tao_collocated = 0,
+ TAO_Abstract_ServantBase *servant = 0,
+ TAO_ORB_Core *orb_core = 0
+ );
+
+ virtual ~ReplyHandler (void);
+
+ private:
+ // Private and unimplemented for concrete interfaces.
+ ReplyHandler (const ReplyHandler &);
+
+ void operator= (const ReplyHandler &);
+ };
+
+#endif /* end #if !defined */
+
+// TAO_IDL - Generated from
+// be\be_visitor_module/module_ch.cpp:78
+
+} // module Messaging
+
+// Proxy Broker Factory function pointer declarations.
+
+// TAO_IDL - Generated from
+// be\be_visitor_root/root.cpp:139
+
+extern TAO_Messaging_Export
+TAO::Collocation_Proxy_Broker *
+(*Messaging__TAO_ReplyHandler_Proxy_Broker_Factory_function_pointer) (
+ ::CORBA::Object_ptr obj
+ );
+
+// TAO_IDL - Generated from
+// be\be_visitor_traits.cpp:61
+
+// Traits specializations.
+namespace TAO
+{
+
+#if !defined (_MESSAGING_REPLYHANDLER__TRAITS_)
+#define _MESSAGING_REPLYHANDLER__TRAITS_
+
+ template<>
+ struct TAO_Messaging_Export Objref_Traits< ::Messaging::ReplyHandler>
+ {
+ static ::Messaging::ReplyHandler_ptr duplicate (
+ ::Messaging::ReplyHandler_ptr
+ );
+ static void release (
+ ::Messaging::ReplyHandler_ptr
+ );
+ static ::Messaging::ReplyHandler_ptr nil (void);
+ static ::CORBA::Boolean marshal (
+ ::Messaging::ReplyHandler_ptr p,
+ TAO_OutputCDR & cdr
+ );
+ };
+
+#endif /* end #if !defined */
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/cdr_op_ch.cpp:55
+
+TAO_Messaging_Export ::CORBA::Boolean operator<< (TAO_OutputCDR &, const Messaging::ReplyHandler_ptr );
+TAO_Messaging_Export ::CORBA::Boolean operator>> (TAO_InputCDR &, Messaging::ReplyHandler_ptr &);
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:1040
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+#include "tao/Messaging/MessagingC.inl"
+#endif /* defined INLINE */
+
+#include /**/ "ace/post.h"
+
+#endif /* ifndef */
+
+
diff --git a/TAO/tao/Messaging/MessagingC.inl b/TAO/tao/Messaging/MessagingC.inl
new file mode 100644
index 00000000000..8ecf720126a
--- /dev/null
+++ b/TAO/tao/Messaging/MessagingC.inl
@@ -0,0 +1,66 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/interface_ci.cpp:70
+
+#if !defined (_MESSAGING_REPLYHANDLER___CI_)
+#define _MESSAGING_REPLYHANDLER___CI_
+
+ACE_INLINE
+Messaging::ReplyHandler::ReplyHandler (
+ TAO_Stub *objref,
+ ::CORBA::Boolean _tao_collocated,
+ TAO_Abstract_ServantBase *servant,
+ TAO_ORB_Core *oc
+ )
+ : ::CORBA::Object (
+ objref,
+ _tao_collocated,
+ servant,
+ oc
+ ),
+ the_TAO_ReplyHandler_Proxy_Broker_ (0)
+{
+ this->Messaging_ReplyHandler_setup_collocation ();
+}
+
+ACE_INLINE
+Messaging::ReplyHandler::ReplyHandler (
+ IOP::IOR *ior,
+ TAO_ORB_Core *oc
+ )
+ : ::CORBA::Object (ior, oc),
+ the_TAO_ReplyHandler_Proxy_Broker_ (0)
+{
+}
+
+#endif /* end #if !defined */
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Messaging/MessagingS.cpp b/TAO/tao/Messaging/MessagingS.cpp
new file mode 100644
index 00000000000..d22ec5b96ff
--- /dev/null
+++ b/TAO/tao/Messaging/MessagingS.cpp
@@ -0,0 +1,803 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:553
+
+#ifndef _TAO_IDL_MESSAGINGS_CPP_
+#define _TAO_IDL_MESSAGINGS_CPP_
+
+
+#include "tao/Messaging/MessagingS.h"
+#include "tao/PortableServer/Operation_Table_Perfect_Hash.h"
+#include "tao/PortableServer/Direct_Collocation_Upcall_Wrapper.h"
+#include "tao/PortableServer/Upcall_Command.h"
+#include "tao/PortableServer/Upcall_Wrapper.h"
+#include "tao/PortableServer/Object_SArgument_T.h"
+#include "tao/PortableServer/Special_Basic_SArguments.h"
+#include "tao/PortableServer/UB_String_SArguments.h"
+#include "tao/PortableServer/TypeCode_SArg_Traits.h"
+#include "tao/PortableServer/Object_SArg_Traits.h"
+#include "tao/PortableServer/get_arg.h"
+#include "tao/Special_Basic_Arguments.h"
+#include "tao/UB_String_Arguments.h"
+#include "tao/TAO_Server_Request.h"
+#include "tao/ORB_Core.h"
+#include "tao/Profile.h"
+#include "tao/Stub.h"
+#include "tao/IFR_Client_Adapter.h"
+#include "tao/Object_T.h"
+#include "tao/AnyTypeCode/TypeCode.h"
+#include "tao/AnyTypeCode/DynamicC.h"
+#include "tao/CDR.h"
+#include "tao/operation_details.h"
+#include "tao/PortableInterceptor.h"
+#include "ace/Dynamic_Service.h"
+#include "ace/Malloc_Allocator.h"
+
+// TAO_IDL - Generated from
+// be\be_visitor_arg_traits.cpp:70
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Arg traits specializations.
+namespace TAO
+{
+}
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_arg_traits.cpp:70
+
+// Arg traits specializations.
+namespace TAO
+{
+}
+
+
+// TAO_IDL - Generated from
+// be\be_interface.cpp:1513
+
+class TAO_Messaging_ReplyHandler_Perfect_Hash_OpTable
+ : public TAO_Perfect_Hash_OpTable
+{
+private:
+ unsigned int hash (const char *str, unsigned int len);
+
+public:
+ const TAO_operation_db_entry * lookup (const char *str, unsigned int len);
+};
+
+/* C++ code produced by gperf version 2.8 (ACE version) */
+/* Command-line: c:\ACE\latest\ACE_wrappers\bin\gperf.exe -m -M -J -c -C -D -E -T -f 0 -F 0,0 -a -o -t -p -K opname -L C++ -Z TAO_Messaging_ReplyHandler_Perfect_Hash_OpTable -N lookup */
+unsigned int
+TAO_Messaging_ReplyHandler_Perfect_Hash_OpTable::hash (const char *str, unsigned int len)
+{
+ static const unsigned char asso_values[] =
+ {
+#if defined (ACE_MVS)
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 0,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 0,
+ 16, 16, 0, 5, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 0, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16,
+#else
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 0, 16, 0, 16, 16,
+ 0, 5, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 0, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16,
+#endif /* ACE_MVS */
+ };
+ return len + asso_values[(int) str[len - 1]] + asso_values[(int) str[0]];
+}
+
+const TAO_operation_db_entry *
+TAO_Messaging_ReplyHandler_Perfect_Hash_OpTable::lookup (const char *str, unsigned int len)
+{
+ enum
+ {
+ TOTAL_KEYWORDS = 5,
+ MIN_WORD_LENGTH = 5,
+ MAX_WORD_LENGTH = 14,
+ MIN_HASH_VALUE = 5,
+ MAX_HASH_VALUE = 15,
+ HASH_VALUE_RANGE = 11,
+ DUPLICATES = 0,
+ WORDLIST_SIZE = 10
+ };
+
+ static const TAO_operation_db_entry wordlist[] =
+ {
+ {"",0,0},{"",0,0},{"",0,0},{"",0,0},{"",0,0},
+ {"_is_a", &POA_Messaging::ReplyHandler::_is_a_skel, 0},
+ {"",0,0},{"",0,0},{"",0,0},{"",0,0},
+ {"_component", &POA_Messaging::ReplyHandler::_component_skel, 0},
+ {"",0,0},{"",0,0},
+ {"_non_existent", &POA_Messaging::ReplyHandler::_non_existent_skel, 0},
+ {"_repository_id", &POA_Messaging::ReplyHandler::_repository_id_skel, 0},
+ {"_interface", &POA_Messaging::ReplyHandler::_interface_skel, 0},
+ };
+
+ if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
+ {
+ unsigned int key = hash (str, len);
+
+ if (key <= MAX_HASH_VALUE && key >= MIN_HASH_VALUE)
+ {
+ const char *s = wordlist[key].opname;
+
+ if (*str == *s && !strncmp (str + 1, s + 1, len - 1))
+ return &wordlist[key];
+ }
+ }
+ return 0;
+}
+
+static TAO_Messaging_ReplyHandler_Perfect_Hash_OpTable tao_Messaging_ReplyHandler_optable;
+///////////////////////////////////////////////////////////////////////
+// Strategized Proxy Broker Implementation
+//
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/strategized_proxy_broker_ss.cpp:40
+
+// Factory function Implementation.
+POA_Messaging::_TAO_ReplyHandler_Strategized_Proxy_Broker *
+POA_Messaging::_TAO_ReplyHandler_Strategized_Proxy_Broker::the_TAO_ReplyHandler_Strategized_Proxy_Broker (void)
+{
+ static POA_Messaging::_TAO_ReplyHandler_Strategized_Proxy_Broker
+ strategized_proxy_broker;
+
+ return &strategized_proxy_broker;
+}
+
+POA_Messaging::_TAO_ReplyHandler_Strategized_Proxy_Broker::_TAO_ReplyHandler_Strategized_Proxy_Broker (void)
+{
+}
+
+POA_Messaging::_TAO_ReplyHandler_Strategized_Proxy_Broker::~_TAO_ReplyHandler_Strategized_Proxy_Broker (void)
+{
+}
+
+TAO::Collocation_Strategy
+POA_Messaging::_TAO_ReplyHandler_Strategized_Proxy_Broker::get_strategy (
+ ::CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC (( ::CORBA::SystemException))
+{
+ TAO::Collocation_Strategy strategy =
+ TAO_ORB_Core::collocation_strategy (obj ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO::TAO_CS_REMOTE_STRATEGY);
+
+ return strategy;
+}
+
+void
+POA_Messaging::_TAO_ReplyHandler_Strategized_Proxy_Broker::dispatch (
+ ::CORBA::Object_ptr obj,
+ ::CORBA::Object_out forward_obj,
+ TAO::Argument ** args,
+ int num_args,
+ const char * op,
+ size_t op_len,
+ TAO::Collocation_Strategy strategy
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC (( ::CORBA::Exception))
+{
+ TAO::Direct_Collocation_Upcall_Wrapper collocation_upcall_wrapper;
+ collocation_upcall_wrapper.upcall (
+ obj,
+ forward_obj,
+ args,
+ num_args,
+ op,
+ op_len,
+ strategy
+ ACE_ENV_ARG_PARAMETER);
+}
+
+//
+// End Strategized Proxy Broker Implementation
+///////////////////////////////////////////////////////////////////////
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/interface_ss.cpp:924
+
+TAO::Collocation_Proxy_Broker *
+Messaging__TAO_ReplyHandler_Proxy_Broker_Factory_function ( ::CORBA::Object_ptr)
+{
+ return
+ ::POA_Messaging::_TAO_ReplyHandler_Strategized_Proxy_Broker::the_TAO_ReplyHandler_Strategized_Proxy_Broker ();
+}
+
+int
+Messaging__TAO_ReplyHandler_Proxy_Broker_Factory_Initializer (size_t)
+{
+ Messaging__TAO_ReplyHandler_Proxy_Broker_Factory_function_pointer =
+ Messaging__TAO_ReplyHandler_Proxy_Broker_Factory_function;
+
+ return 0;
+}
+
+static int
+Messaging__TAO_ReplyHandler_Proxy_Broker_Stub_Factory_Initializer_Scarecrow =
+ Messaging__TAO_ReplyHandler_Proxy_Broker_Factory_Initializer (
+ reinterpret_cast<size_t> (Messaging__TAO_ReplyHandler_Proxy_Broker_Factory_Initializer)
+ );
+
+
+
+///////////////////////////////////////////////////////////////////////
+// Direct Proxy Implementation
+//
+
+POA_Messaging::_TAO_ReplyHandler_Direct_Proxy_Impl::_TAO_ReplyHandler_Direct_Proxy_Impl (void)
+{}
+
+POA_Messaging::_TAO_ReplyHandler_Direct_Proxy_Impl::~_TAO_ReplyHandler_Direct_Proxy_Impl (void)
+{}
+
+
+
+//
+// End Direct Proxy Implementation
+///////////////////////////////////////////////////////////////////////
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/interface_ss.cpp:103
+
+POA_Messaging::ReplyHandler::ReplyHandler (void)
+ : TAO_ServantBase ()
+{
+ this->optable_ = &tao_Messaging_ReplyHandler_optable;
+}
+
+POA_Messaging::ReplyHandler::ReplyHandler (const ReplyHandler& rhs)
+ : TAO_Abstract_ServantBase (rhs),
+ TAO_ServantBase (rhs)
+{
+}
+
+POA_Messaging::ReplyHandler::~ReplyHandler (void)
+{
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/interface_ss.cpp:169
+
+namespace POA_Messaging
+{
+
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/upcall_command_ss.cpp:127
+
+ class _is_a_ReplyHandler_Upcall_Command
+ : public TAO::Upcall_Command
+ {
+ public:
+ inline _is_a_ReplyHandler_Upcall_Command (
+ POA_Messaging::ReplyHandler * servant,
+ TAO_Operation_Details const * operation_details,
+ TAO::Argument * const args[])
+ : servant_ (servant)
+ , operation_details_ (operation_details)
+ , args_ (args)
+ {
+ }
+
+ virtual void execute (ACE_ENV_SINGLE_ARG_DECL)
+ {
+ TAO::SArg_Traits< ::ACE_InputCDR::to_boolean>::ret_arg_type retval =
+ TAO::Portable_Server::get_ret_arg< ::ACE_InputCDR::to_boolean> (
+ this->operation_details_,
+ this->args_);
+
+ TAO::SArg_Traits< ::CORBA::Char *>::in_arg_type arg_1 =
+ TAO::Portable_Server::get_in_arg< ::CORBA::Char *> (
+ this->operation_details_,
+ this->args_,
+ 1);
+
+ retval =
+ this->servant_-> _is_a (
+ arg_1
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ private:
+ POA_Messaging::ReplyHandler * const servant_;
+ TAO_Operation_Details const * const operation_details_;
+ TAO::Argument * const * const args_;
+ };
+
+}
+void POA_Messaging::ReplyHandler::_is_a_skel (
+ TAO_ServerRequest & server_request,
+ void * TAO_INTERCEPTOR (servant_upcall),
+ void * servant
+ ACE_ENV_ARG_DECL
+ )
+{
+
+
+#if TAO_HAS_INTERCEPTORS == 1
+ static ::CORBA::TypeCode_ptr const * const exceptions = 0;
+ static ::CORBA::ULong const nexceptions = 0;
+#endif /* TAO_HAS_INTERCEPTORS */
+
+ TAO::SArg_Traits< ::ACE_InputCDR::to_boolean>::ret_val retval;
+ TAO::SArg_Traits< ::CORBA::Char *>::in_arg_val _tao_repository_id;
+
+ TAO::Argument * const args[] =
+ {
+ &retval,
+ &_tao_repository_id
+ };
+
+ static size_t const nargs = 2;
+
+ POA_Messaging::ReplyHandler * const impl =
+ static_cast<POA_Messaging::ReplyHandler *> (servant);
+
+ _is_a_ReplyHandler_Upcall_Command command (
+ impl,
+ server_request.operation_details (),
+ args);
+
+ TAO::Upcall_Wrapper upcall_wrapper;
+ upcall_wrapper.upcall (server_request
+ , args
+ , nargs
+ , command
+#if TAO_HAS_INTERCEPTORS == 1
+ , servant_upcall
+ , exceptions
+ , nexceptions
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+}
+
+namespace POA_Messaging
+{
+
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/upcall_command_ss.cpp:127
+
+ class _non_existent_ReplyHandler_Upcall_Command
+ : public TAO::Upcall_Command
+ {
+ public:
+ inline _non_existent_ReplyHandler_Upcall_Command (
+ POA_Messaging::ReplyHandler * servant,
+ TAO_Operation_Details const * operation_details,
+ TAO::Argument * const args[])
+ : servant_ (servant)
+ , operation_details_ (operation_details)
+ , args_ (args)
+ {
+ }
+
+ virtual void execute (ACE_ENV_SINGLE_ARG_DECL)
+ {
+ TAO::SArg_Traits< ::ACE_InputCDR::to_boolean>::ret_arg_type retval =
+ TAO::Portable_Server::get_ret_arg< ::ACE_InputCDR::to_boolean> (
+ this->operation_details_,
+ this->args_);
+
+ retval =
+ this->servant_-> _non_existent (
+ ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ private:
+ POA_Messaging::ReplyHandler * const servant_;
+ TAO_Operation_Details const * const operation_details_;
+ TAO::Argument * const * const args_;
+ };
+
+}
+void POA_Messaging::ReplyHandler::_non_existent_skel (
+ TAO_ServerRequest & server_request,
+ void * TAO_INTERCEPTOR (servant_upcall),
+ void * servant
+ ACE_ENV_ARG_DECL
+ )
+{
+
+
+#if TAO_HAS_INTERCEPTORS == 1
+ static ::CORBA::TypeCode_ptr const * const exceptions = 0;
+ static ::CORBA::ULong const nexceptions = 0;
+#endif /* TAO_HAS_INTERCEPTORS */
+
+ TAO::SArg_Traits< ::ACE_InputCDR::to_boolean>::ret_val retval;
+
+ TAO::Argument * const args[] =
+ {
+ &retval
+ };
+
+ static size_t const nargs = 1;
+
+ POA_Messaging::ReplyHandler * const impl =
+ static_cast<POA_Messaging::ReplyHandler *> (servant);
+
+ _non_existent_ReplyHandler_Upcall_Command command (
+ impl,
+ server_request.operation_details (),
+ args);
+
+ TAO::Upcall_Wrapper upcall_wrapper;
+ upcall_wrapper.upcall (server_request
+ , args
+ , nargs
+ , command
+#if TAO_HAS_INTERCEPTORS == 1
+ , servant_upcall
+ , exceptions
+ , nexceptions
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+}
+
+namespace POA_Messaging
+{
+
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/upcall_command_ss.cpp:127
+
+ class _repository_id_ReplyHandler_Upcall_Command
+ : public TAO::Upcall_Command
+ {
+ public:
+ inline _repository_id_ReplyHandler_Upcall_Command (
+ POA_Messaging::ReplyHandler * servant,
+ TAO_Operation_Details const * operation_details,
+ TAO::Argument * const args[])
+ : servant_ (servant)
+ , operation_details_ (operation_details)
+ , args_ (args)
+ {
+ }
+
+ virtual void execute (ACE_ENV_SINGLE_ARG_DECL)
+ {
+ TAO::SArg_Traits< ::CORBA::Char *>::ret_arg_type retval =
+ TAO::Portable_Server::get_ret_arg< ::CORBA::Char *> (
+ this->operation_details_,
+ this->args_);
+
+ retval =
+ this->servant_-> _repository_id (
+ ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ private:
+ POA_Messaging::ReplyHandler * const servant_;
+ TAO_Operation_Details const * const operation_details_;
+ TAO::Argument * const * const args_;
+ };
+
+}
+void POA_Messaging::ReplyHandler::_repository_id_skel (
+ TAO_ServerRequest & server_request,
+ void * TAO_INTERCEPTOR (servant_upcall),
+ void * servant
+ ACE_ENV_ARG_DECL
+ )
+{
+
+
+#if TAO_HAS_INTERCEPTORS == 1
+ static ::CORBA::TypeCode_ptr const * const exceptions = 0;
+ static ::CORBA::ULong const nexceptions = 0;
+#endif /* TAO_HAS_INTERCEPTORS */
+
+ TAO::SArg_Traits< ::CORBA::Char *>::ret_val retval;
+
+ TAO::Argument * const args[] =
+ {
+ &retval
+ };
+
+ static size_t const nargs = 1;
+
+ POA_Messaging::ReplyHandler * const impl =
+ static_cast<POA_Messaging::ReplyHandler *> (servant);
+
+ _repository_id_ReplyHandler_Upcall_Command command (
+ impl,
+ server_request.operation_details (),
+ args);
+
+ TAO::Upcall_Wrapper upcall_wrapper;
+ upcall_wrapper.upcall (server_request
+ , args
+ , nargs
+ , command
+#if TAO_HAS_INTERCEPTORS == 1
+ , servant_upcall
+ , exceptions
+ , nexceptions
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+}
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/interface_ss.cpp:501
+
+
+
+void POA_Messaging::ReplyHandler::_interface_skel (
+ TAO_ServerRequest & server_request,
+ void * /* servant_upcall */,
+ void * servant
+ ACE_ENV_ARG_DECL
+ )
+{
+ TAO_IFR_Client_Adapter *_tao_adapter =
+ ACE_Dynamic_Service<TAO_IFR_Client_Adapter>::instance (
+ TAO_ORB_Core::ifr_client_adapter_name ()
+ );
+
+ if (_tao_adapter == 0)
+ {
+ ACE_THROW ( ::CORBA::INTF_REPOS ( ::CORBA::OMGVMCID | 1,
+ ::CORBA::COMPLETED_NO));
+ }
+
+ POA_Messaging::ReplyHandler * const impl =
+ static_cast<POA_Messaging::ReplyHandler *> (servant);
+ ::CORBA::InterfaceDef_ptr _tao_retval =
+ impl->_get_interface (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ server_request.init_reply ();
+ TAO_OutputCDR &_tao_out = *server_request.outgoing ();
+
+ ::CORBA::Boolean const _tao_result =
+ _tao_adapter->interfacedef_cdr_insert (
+ _tao_out,
+ _tao_retval
+ );
+
+ _tao_adapter->dispose (_tao_retval);
+
+ if (_tao_result == 0)
+ {
+ ACE_THROW ( ::CORBA::MARSHAL ());
+ }
+}
+
+namespace POA_Messaging
+{
+
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/upcall_command_ss.cpp:127
+
+ class _get_component_ReplyHandler_Upcall_Command
+ : public TAO::Upcall_Command
+ {
+ public:
+ inline _get_component_ReplyHandler_Upcall_Command (
+ POA_Messaging::ReplyHandler * servant,
+ TAO_Operation_Details const * operation_details,
+ TAO::Argument * const args[])
+ : servant_ (servant)
+ , operation_details_ (operation_details)
+ , args_ (args)
+ {
+ }
+
+ virtual void execute (ACE_ENV_SINGLE_ARG_DECL)
+ {
+ TAO::SArg_Traits< ::CORBA::Object>::ret_arg_type retval =
+ TAO::Portable_Server::get_ret_arg< ::CORBA::Object> (
+ this->operation_details_,
+ this->args_);
+
+ retval =
+ this->servant_-> _get_component (
+ ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ private:
+ POA_Messaging::ReplyHandler * const servant_;
+ TAO_Operation_Details const * const operation_details_;
+ TAO::Argument * const * const args_;
+ };
+
+}
+void POA_Messaging::ReplyHandler::_component_skel (
+ TAO_ServerRequest & server_request,
+ void * TAO_INTERCEPTOR (servant_upcall),
+ void * servant
+ ACE_ENV_ARG_DECL
+ )
+{
+
+
+#if TAO_HAS_INTERCEPTORS == 1
+ static ::CORBA::TypeCode_ptr const * const exceptions = 0;
+ static ::CORBA::ULong const nexceptions = 0;
+#endif /* TAO_HAS_INTERCEPTORS */
+
+ TAO::SArg_Traits< ::CORBA::Object>::ret_val retval;
+
+ TAO::Argument * const args[] =
+ {
+ &retval
+ };
+
+ static size_t const nargs = 1;
+
+ POA_Messaging::ReplyHandler * const impl =
+ static_cast<POA_Messaging::ReplyHandler *> (servant);
+
+ _get_component_ReplyHandler_Upcall_Command command (
+ impl,
+ server_request.operation_details (),
+ args);
+
+ TAO::Upcall_Wrapper upcall_wrapper;
+ upcall_wrapper.upcall (server_request
+ , args
+ , nargs
+ , command
+#if TAO_HAS_INTERCEPTORS == 1
+ , servant_upcall
+ , exceptions
+ , nexceptions
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+}
+
+::CORBA::Boolean POA_Messaging::ReplyHandler::_is_a (
+ const char* value
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return
+ (
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/Messaging/ReplyHandler:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/Object:1.0"
+ )
+ );
+}
+
+const char* POA_Messaging::ReplyHandler::_interface_repository_id (void) const
+{
+ return "IDL:omg.org/Messaging/ReplyHandler:1.0";
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/interface_ss.cpp:862
+
+void POA_Messaging::ReplyHandler::_dispatch (
+ TAO_ServerRequest & req,
+ void * servant_upcall
+ ACE_ENV_ARG_DECL
+ )
+{
+ this->synchronous_upcall_dispatch (req,
+ servant_upcall,
+ this
+ ACE_ENV_ARG_PARAMETER);
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/interface_ss.cpp:813
+
+Messaging::ReplyHandler *
+POA_Messaging::ReplyHandler::_this (ACE_ENV_SINGLE_ARG_DECL)
+{
+ TAO_Stub *stub = this->_create_stub (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ TAO_Stub_Auto_Ptr safe_stub (stub);
+ ::CORBA::Object_ptr tmp = CORBA::Object::_nil ();
+
+ ::CORBA::Boolean _tao_opt_colloc =
+ stub->servant_orb_var ()->orb_core ()->optimize_collocation_objects ();
+
+ ACE_NEW_RETURN (
+ tmp,
+ ::CORBA::Object (stub, _tao_opt_colloc, this),
+ 0
+ );
+
+ ::CORBA::Object_var obj = tmp;
+ (void) safe_stub.release ();
+
+ typedef ::Messaging::ReplyHandler STUB_SCOPED_NAME;
+ return
+ TAO::Narrow_Utils<STUB_SCOPED_NAME>::unchecked_narrow (
+ obj.in (),
+ Messaging__TAO_ReplyHandler_Proxy_Broker_Factory_function_pointer
+ );
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* ifndef */
+
diff --git a/TAO/tao/Messaging/MessagingS.h b/TAO/tao/Messaging/MessagingS.h
new file mode 100644
index 00000000000..7c5f68e5eee
--- /dev/null
+++ b/TAO/tao/Messaging/MessagingS.h
@@ -0,0 +1,213 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:373
+
+#ifndef _TAO_IDL_MESSAGINGS_H_
+#define _TAO_IDL_MESSAGINGS_H_
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Messaging/Messaging.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Collocation_Proxy_Broker.h"
+#include "tao/PortableServer/PortableServer.h"
+#include "tao/PortableServer/Servant_Base.h"
+
+// TAO_IDL - Generated from
+// be\be_visitor_module/module_sh.cpp:49
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace POA_Messaging
+{
+
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_sh.cpp:87
+
+ class ReplyHandler;
+ typedef ReplyHandler *ReplyHandler_ptr;
+
+ class _TAO_ReplyHandler_Direct_Proxy_Impl;
+ class _TAO_ReplyHandler_Strategized_Proxy_Broker;
+
+ class TAO_Messaging_Export ReplyHandler
+ : public virtual PortableServer::ServantBase
+ {
+ protected:
+ ReplyHandler (void);
+
+ public:
+ // Useful for template programming.
+ typedef ::Messaging::ReplyHandler _stub_type;
+ typedef ::Messaging::ReplyHandler_ptr _stub_ptr_type;
+ typedef ::Messaging::ReplyHandler_var _stub_var_type;
+
+ ReplyHandler (const ReplyHandler& rhs);
+ virtual ~ReplyHandler (void);
+
+ virtual ::CORBA::Boolean _is_a (
+ const char* logical_type_id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static void _is_a_skel (
+ TAO_ServerRequest & req,
+ void * servant_upcall,
+ void * servant
+ ACE_ENV_ARG_DECL
+ );
+
+ static void _non_existent_skel (
+ TAO_ServerRequest & req,
+ void * servant_upcall,
+ void * servant
+ ACE_ENV_ARG_DECL
+ );
+
+ static void _interface_skel (
+ TAO_ServerRequest & req,
+ void * servant_upcall,
+ void * servant
+ ACE_ENV_ARG_DECL
+ );
+
+ static void _component_skel (
+ TAO_ServerRequest & req,
+ void * servant_upcall,
+ void * servant
+ ACE_ENV_ARG_DECL
+ );
+
+ static void _repository_id_skel (
+ TAO_ServerRequest & req,
+ void * servant_upcall,
+ void * servant
+ ACE_ENV_ARG_DECL
+ );
+
+ virtual void _dispatch (
+ TAO_ServerRequest & req,
+ void * servant_upcall
+ ACE_ENV_ARG_DECL
+ );
+
+ ::Messaging::ReplyHandler *_this (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ );
+
+ virtual const char* _interface_repository_id (void) const;
+ };
+
+ ///////////////////////////////////////////////////////////////////////
+ // Strategized Proxy Broker Declaration
+ //
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/strategized_proxy_broker_sh.cpp:36
+
+ class TAO_Messaging_Export _TAO_ReplyHandler_Strategized_Proxy_Broker
+ : public virtual TAO::Collocation_Proxy_Broker
+ {
+ public:
+ _TAO_ReplyHandler_Strategized_Proxy_Broker (void);
+
+ virtual ~_TAO_ReplyHandler_Strategized_Proxy_Broker (void);
+
+ TAO::Collocation_Strategy
+ get_strategy (
+ ::CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC (( ::CORBA::SystemException));
+
+ void
+ dispatch (
+ ::CORBA::Object_ptr obj,
+ ::CORBA::Object_out forward_obj,
+ TAO::Argument ** args,
+ int num_args,
+ const char * op,
+ size_t op_len,
+ TAO::Collocation_Strategy strategy
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC (( ::CORBA::Exception));
+
+ static _TAO_ReplyHandler_Strategized_Proxy_Broker *
+ the_TAO_ReplyHandler_Strategized_Proxy_Broker (void);
+ };
+
+ //
+ // End Strategized Proxy Broker Declaration
+ ///////////////////////////////////////////////////////////////////////
+
+
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/direct_proxy_impl_sh.cpp:31
+
+ ///////////////////////////////////////////////////////////////////////
+ // Direct Impl. Declaration
+ //
+
+ class TAO_Messaging_Export _TAO_ReplyHandler_Direct_Proxy_Impl
+ {
+ public:
+ _TAO_ReplyHandler_Direct_Proxy_Impl (void);
+
+ virtual ~_TAO_ReplyHandler_Direct_Proxy_Impl (void);
+ };
+
+ //
+ // Direct Proxy Impl. Declaration
+ ///////////////////////////////////////////////////////////////////////
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_module/module_sh.cpp:80
+
+} // module Messaging
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:1072
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include "tao/Messaging/MessagingS_T.h"
+
+
+#include /**/ "ace/post.h"
+#endif /* ifndef */
+
diff --git a/TAO/tao/Messaging/MessagingS_T.cpp b/TAO/tao/Messaging/MessagingS_T.cpp
new file mode 100644
index 00000000000..c7390c0ad31
--- /dev/null
+++ b/TAO/tao/Messaging/MessagingS_T.cpp
@@ -0,0 +1,41 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:627
+
+#ifndef _TAO_IDL_MESSAGINGS_T_CPP_
+#define _TAO_IDL_MESSAGINGS_T_CPP_
+
+#include "tao/Messaging/MessagingS_T.h"
+
+#if !defined (__ACE_INLINE__)
+#include "tao/Messaging/MessagingS_T.inl"
+#endif /* !defined INLINE */
+
+
+#endif /* ifndef */
diff --git a/TAO/tao/Messaging/MessagingS_T.h b/TAO/tao/Messaging/MessagingS_T.h
new file mode 100644
index 00000000000..6c0a6279ac8
--- /dev/null
+++ b/TAO/tao/Messaging/MessagingS_T.h
@@ -0,0 +1,114 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:501
+
+#ifndef _TAO_IDL_MESSAGINGS_T_H_
+#define _TAO_IDL_MESSAGINGS_T_H_
+
+#include /**/ "ace/pre.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// TAO_IDL - Generated from
+// be\be_visitor_root/root_sth.cpp:116
+
+namespace POA_Messaging
+{
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/tie_sh.cpp:87
+
+ // TIE class: Refer to CORBA v2.2, Section 20.34.4
+ template <class T>
+ class ReplyHandler_tie : public ReplyHandler
+ {
+ public:
+ ReplyHandler_tie (T &t);
+ // the T& ctor
+ ReplyHandler_tie (T &t, PortableServer::POA_ptr poa);
+ // ctor taking a POA
+ ReplyHandler_tie (T *tp, ::CORBA::Boolean release = 1);
+ // ctor taking pointer and an ownership flag
+ ReplyHandler_tie (
+ T *tp,
+ PortableServer::POA_ptr poa,
+ ::CORBA::Boolean release = true
+ );
+ // ctor with T*, ownership flag and a POA
+ ~ReplyHandler_tie (void);
+ // dtor
+
+ // TIE specific functions
+ T *_tied_object (void);
+ // return the underlying object
+ void _tied_object (T &obj);
+ // set the underlying object
+ void _tied_object (T *obj, ::CORBA::Boolean release = true);
+ // set the underlying object and the ownership flag
+ ::CORBA::Boolean _is_owner (void);
+ // do we own it
+ void _is_owner ( ::CORBA::Boolean b);
+ // set the ownership
+
+ // overridden ServantBase operations
+ PortableServer::POA_ptr _default_POA (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ );
+
+ private:
+ T *ptr_;
+ PortableServer::POA_var poa_;
+ ::CORBA::Boolean rel_;
+
+ // copy and assignment are not allowed
+ ReplyHandler_tie (const ReplyHandler_tie &);
+ void operator= (const ReplyHandler_tie &);
+ };
+} // module Messaging
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:1165
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+#include "tao/Messaging/MessagingS_T.inl"
+#endif /* defined INLINE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+#include "tao/Messaging/MessagingS_T.cpp"
+#endif /* defined REQUIRED SOURCE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
+#pragma implementation ("MessagingS_T.cpp")
+#endif /* defined REQUIRED PRAGMA */
+
+#include /**/ "ace/post.h"
+#endif /* ifndef */
+
diff --git a/TAO/tao/Messaging/MessagingS_T.inl b/TAO/tao/Messaging/MessagingS_T.inl
new file mode 100644
index 00000000000..45319a7c078
--- /dev/null
+++ b/TAO/tao/Messaging/MessagingS_T.inl
@@ -0,0 +1,123 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/tie_si.cpp:96
+
+template <class T> ACE_INLINE
+POA_Messaging::ReplyHandler_tie<T>::ReplyHandler_tie (T &t)
+ : ptr_ (&t),
+ poa_ (PortableServer::POA::_nil ()),
+ rel_ (0)
+{}
+
+template <class T> ACE_INLINE
+POA_Messaging::ReplyHandler_tie<T>::ReplyHandler_tie (T &t, PortableServer::POA_ptr poa)
+ : ptr_ (&t),
+ poa_ (PortableServer::POA::_duplicate (poa)),
+ rel_ (0)
+{}
+
+template <class T> ACE_INLINE
+POA_Messaging::ReplyHandler_tie<T>::ReplyHandler_tie (T *tp, CORBA::Boolean release)
+ : ptr_ (tp),
+ poa_ (PortableServer::POA::_nil ()),
+ rel_ (release)
+{}
+
+template <class T> ACE_INLINE
+POA_Messaging::ReplyHandler_tie<T>::ReplyHandler_tie (T *tp, PortableServer::POA_ptr poa, CORBA::Boolean release)
+ : ptr_ (tp),
+ poa_ (PortableServer::POA::_duplicate (poa)),
+ rel_ (release)
+{}
+
+template <class T> ACE_INLINE
+POA_Messaging::ReplyHandler_tie<T>::~ReplyHandler_tie (void)
+{
+ if (this->rel_)
+ {
+ delete this->ptr_;
+ }
+}
+
+template <class T> ACE_INLINE T *
+POA_Messaging::ReplyHandler_tie<T>::_tied_object (void)
+{
+ return this->ptr_;
+}
+
+template <class T> ACE_INLINE void
+POA_Messaging::ReplyHandler_tie<T>::_tied_object (T &obj)
+{
+ if (this->rel_)
+ {
+ delete this->ptr_;
+ }
+
+ this->ptr_ = &obj;
+ this->rel_ = 0;
+}
+
+template <class T> ACE_INLINE void
+POA_Messaging::ReplyHandler_tie<T>::_tied_object (T *obj, CORBA::Boolean release)
+{
+ if (this->rel_)
+ {
+ delete this->ptr_;
+ }
+
+ this->ptr_ = obj;
+ this->rel_ = release;
+}
+
+template <class T> ACE_INLINE CORBA::Boolean
+POA_Messaging::ReplyHandler_tie<T>::_is_owner (void)
+{
+ return this->rel_;
+}
+
+template <class T> ACE_INLINE void
+POA_Messaging::ReplyHandler_tie<T>::_is_owner (CORBA::Boolean b)
+{
+ this->rel_ = b;
+}
+
+template <class T> ACE_INLINE PortableServer::POA_ptr
+POA_Messaging::ReplyHandler_tie<T>::_default_POA (ACE_ENV_SINGLE_ARG_DECL)
+{
+ if (!CORBA::is_nil (this->poa_.in ()))
+ {
+ return PortableServer::POA::_duplicate (this->poa_.in ());
+ }
+
+ return this->ReplyHandler::_default_POA (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Messaging/Messaging_Loader.cpp b/TAO/tao/Messaging/Messaging_Loader.cpp
new file mode 100644
index 00000000000..81555edbf4a
--- /dev/null
+++ b/TAO/tao/Messaging/Messaging_Loader.cpp
@@ -0,0 +1,85 @@
+
+// $Id$
+
+#include "tao/Messaging/Messaging_Loader.h"
+#include "tao/Messaging/Messaging_ORBInitializer.h"
+
+#include "tao/debug.h"
+#include "tao/ORB_Core.h"
+#include "tao/ORBInitializer_Registry.h"
+
+ACE_RCSID (Messaging, Messaging_Loader, "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Messaging_Loader::TAO_Messaging_Loader (void)
+{
+}
+
+TAO_Messaging_Loader::~TAO_Messaging_Loader (void)
+{
+}
+
+int
+TAO_Messaging_Loader::init (int,
+ ACE_TCHAR* [])
+{
+ ACE_TRACE ("TAO_Messaging_Loader::init");
+
+ static int called_once = 0;
+
+ if (called_once != 0)
+ return 0;
+ called_once = 1;
+
+ PortableInterceptor::ORBInitializer_ptr temp_orb_initializer =
+ PortableInterceptor::ORBInitializer::_nil ();
+ PortableInterceptor::ORBInitializer_var orb_initializer;
+
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ /// Register the Messaging ORBInitializer.
+
+ ACE_NEW_THROW_EX (temp_orb_initializer,
+ TAO_Messaging_ORBInitializer,
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_TRY_CHECK;
+
+ orb_initializer = temp_orb_initializer;
+
+ PortableInterceptor::register_orb_initializer (orb_initializer.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "Caught exception:");
+ }
+ return -1;
+ }
+ ACE_ENDTRY;
+
+ return 0;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+/////////////////////////////////////////////////////////////////////
+
+ACE_FACTORY_DEFINE (TAO_Messaging, TAO_Messaging_Loader)
+ACE_STATIC_SVC_DEFINE (TAO_Messaging_Loader,
+ ACE_TEXT ("Messaging_Loader"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (TAO_Messaging_Loader),
+ ACE_Service_Type::DELETE_THIS
+ | ACE_Service_Type::DELETE_OBJ,
+ 0)
diff --git a/TAO/tao/Messaging/Messaging_Loader.h b/TAO/tao/Messaging/Messaging_Loader.h
new file mode 100644
index 00000000000..0a046f44675
--- /dev/null
+++ b/TAO/tao/Messaging/Messaging_Loader.h
@@ -0,0 +1,50 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Messaging_Loader.h
+ *
+ * $Id$
+ */
+//=============================================================================
+
+#ifndef TAO_MESSAGING_LOADER_H
+#define TAO_MESSAGING_LOADER_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Messaging/messaging_export.h"
+
+#include "ace/Service_Object.h"
+#include "ace/Service_Config.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PI/PI.h"
+#include "tao/Versioned_Namespace.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Messaging_Export TAO_Messaging_Loader : public ACE_Service_Object
+{
+public:
+ /// Constructor.
+ TAO_Messaging_Loader (void);
+
+ /// Destructor.
+ virtual ~TAO_Messaging_Loader (void);
+
+ /// Initialize the Messaging loader hooks.
+ virtual int init (int argc,
+ ACE_TCHAR* []);
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE_EXPORT (TAO_Messaging, TAO_Messaging_Loader)
+ACE_FACTORY_DECLARE (TAO_Messaging, TAO_Messaging_Loader)
+
+#include /**/ "ace/post.h"
+#endif /* TAO_MESSAGING_LOADER_H */
diff --git a/TAO/tao/Messaging/Messaging_No_Impl.pidl b/TAO/tao/Messaging/Messaging_No_Impl.pidl
new file mode 100644
index 00000000000..6f2320e0517
--- /dev/null
+++ b/TAO/tao/Messaging/Messaging_No_Impl.pidl
@@ -0,0 +1,140 @@
+// -*- IDL -*-
+
+//=============================================================================
+/**
+ * @file Messaging_No_Impl.pidl
+ *
+ * $Id$
+ *
+ * This file was used to generate the code in
+ * Messaging_No_Impl{C}.{h,cpp} and as the name implies is not
+ * implemented in TAO, yet.
+ *
+ * The command used to generate code from this file is:
+ *
+ * tao_idl
+ * -o orig -Gp -Gd -Ge 1 -GA -Sci -SS
+ * -Wb,export_macro=TAO_Messaging_Export
+ * -Wb,export_include=messaging_export.h
+ * -Wb,pre_include="ace/pre.h"
+ * -Wb,post_include="ace/post.h" -I$(TAO_ROOT)
+ * Messaging_No_Impl.pidl
+ *
+ * after the file is generated a patch must be applied:
+ *
+ * cp orig/Messaging_No_Impl{C}.{h,cpp} .
+ * patch < diffs/Messaging_No_Impl.diff
+ *
+ * The patch eliminates cycles in the include dependencies.
+ *
+ * Note: to update the patch file after re-generating the code use:
+ *
+ * for i in Messaging_No_Impl{C}.{h,cpp}; do
+ * diff -uBbw orig/$i $i;
+ * done > diffs/Messaging_No_Impl.diff
+ */
+//=============================================================================
+
+#ifndef TAO_MESSAGING_NO_IMPL_PIDL
+#define TAO_MESSAGING_NO_IMPL_PIDL
+
+#include "tao/TimeBase.pidl"
+#include "tao/Policy.pidl"
+
+#pragma prefix "omg.org"
+
+module Messaging
+{
+ //
+ // Messaging Quality of Service
+ //
+
+ typedef short Priority;
+
+ typedef short RebindMode;
+ const RebindMode TRANSPARENT = 0;
+ const RebindMode NO_REBIND = 1;
+ const RebindMode NO_RECONNECT = 2;
+
+ typedef short RoutingType;
+ const RoutingType ROUTE_NONE = 0;
+ const RoutingType ROUTE_FORWARD = 1;
+ const RoutingType ROUTE_STORE_AND_FORWARD = 2;
+
+ typedef unsigned short Ordering;
+ const Ordering ORDER_ANY = 0x01;
+ const Ordering ORDER_TEMPORAL = 0x02;
+ const Ordering ORDER_PRIORITY = 0x04;
+ const Ordering ORDER_DEADLINE = 0x08;
+
+ //
+ // Locally-Constrained Policy Objects
+ //
+
+ // Rebind Policy (default = TRANSPARENT)
+ const CORBA::PolicyType REBIND_POLICY_TYPE = 23;
+ local interface RebindPolicy : CORBA::Policy {
+ readonly attribute RebindMode rebind_mode;
+ };
+
+ // Priority Policies
+ const CORBA::PolicyType REQUEST_PRIORITY_POLICY_TYPE = 25;
+ struct PriorityRange {
+ Priority min;
+ Priority max;
+ };
+ local interface RequestPriorityPolicy : CORBA::Policy {
+ readonly attribute PriorityRange priority_range;
+ };
+ const CORBA::PolicyType REPLY_PRIORITY_POLICY_TYPE = 26;
+ local interface ReplyPriorityPolicy : CORBA::Policy {
+ readonly attribute PriorityRange priority_range;
+ };
+
+ // Timeout Policies
+ const CORBA::PolicyType REQUEST_START_TIME_POLICY_TYPE = 27;
+ local interface RequestStartTimePolicy : CORBA::Policy {
+ readonly attribute TimeBase::UtcT start_time;
+ };
+ const CORBA::PolicyType REQUEST_END_TIME_POLICY_TYPE = 28;
+ local interface RequestEndTimePolicy : CORBA::Policy {
+ readonly attribute TimeBase::UtcT end_time;
+ };
+
+ const CORBA::PolicyType REPLY_START_TIME_POLICY_TYPE = 29;
+ local interface ReplyStartTimePolicy : CORBA::Policy {
+ readonly attribute TimeBase::UtcT start_time;
+ };
+ const CORBA::PolicyType REPLY_END_TIME_POLICY_TYPE = 30;
+ local interface ReplyEndTimePolicy : CORBA::Policy {
+ readonly attribute TimeBase::UtcT end_time;
+ };
+
+ const CORBA::PolicyType RELATIVE_REQ_TIMEOUT_POLICY_TYPE = 31;
+ local interface RelativeRequestTimeoutPolicy : CORBA::Policy {
+ readonly attribute TimeBase::TimeT relative_expiry;
+ };
+
+
+ const CORBA::PolicyType ROUTING_POLICY_TYPE = 33;
+ struct RoutingTypeRange {
+ RoutingType min;
+ RoutingType max;
+ };
+ local interface RoutingPolicy : CORBA::Policy {
+ readonly attribute RoutingTypeRange routing_range;
+ };
+
+ const CORBA::PolicyType MAX_HOPS_POLICY_TYPE = 34;
+ local interface MaxHopsPolicy : CORBA::Policy {
+ readonly attribute unsigned short max_hops;
+ };
+
+ // Router Delivery-ordering Policy (default = ORDER_TEMPORAL)
+ const CORBA::PolicyType QUEUE_ORDER_POLICY_TYPE = 35;
+ local interface QueueOrderPolicy : CORBA::Policy {
+ readonly attribute Ordering allowed_orders;
+ };
+};
+
+#endif /*TAO_MESSAGING_NO_IMPL_PIDL*/
diff --git a/TAO/tao/Messaging/Messaging_No_ImplA.cpp b/TAO/tao/Messaging/Messaging_No_ImplA.cpp
new file mode 100644
index 00000000000..bd636c617ee
--- /dev/null
+++ b/TAO/tao/Messaging/Messaging_No_ImplA.cpp
@@ -0,0 +1,499 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+#include "tao/Messaging/Messaging_No_ImplA.h"
+#include "tao/AnyTypeCode/Null_RefCount_Policy.h"
+#include "tao/AnyTypeCode/TypeCode_Constants.h"
+#include "tao/AnyTypeCode/Alias_TypeCode_Static.h"
+#include "tao/AnyTypeCode/Objref_TypeCode_Static.h"
+#include "tao/AnyTypeCode/Struct_TypeCode_Static.h"
+#include "tao/AnyTypeCode/TypeCode_Struct_Field.h"
+#include "tao/AnyTypeCode/Any.h"
+#include "tao/CDR.h"
+#include "tao/AnyTypeCode/Any.h"
+#include "tao/AnyTypeCode/Any_Impl_T.h"
+#include "tao/AnyTypeCode/Any_Dual_Impl_T.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/alias_typecode.cpp:50
+
+static TAO::TypeCode::Alias<char const *,
+ ::CORBA::TypeCode_ptr const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_Messaging_Priority (
+ ::CORBA::tk_alias,
+ "IDL:omg.org/Messaging/Priority:1.0",
+ "Priority",
+ &CORBA::_tc_short);
+
+namespace Messaging
+{
+ ::CORBA::TypeCode_ptr const _tc_Priority =
+ &_tao_tc_Messaging_Priority;
+}
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/alias_typecode.cpp:50
+
+static TAO::TypeCode::Alias<char const *,
+ ::CORBA::TypeCode_ptr const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_Messaging_RebindMode (
+ ::CORBA::tk_alias,
+ "IDL:omg.org/Messaging/RebindMode:1.0",
+ "RebindMode",
+ &CORBA::_tc_short);
+
+namespace Messaging
+{
+ ::CORBA::TypeCode_ptr const _tc_RebindMode =
+ &_tao_tc_Messaging_RebindMode;
+}
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/alias_typecode.cpp:50
+
+static TAO::TypeCode::Alias<char const *,
+ ::CORBA::TypeCode_ptr const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_Messaging_RoutingType (
+ ::CORBA::tk_alias,
+ "IDL:omg.org/Messaging/RoutingType:1.0",
+ "RoutingType",
+ &CORBA::_tc_short);
+
+namespace Messaging
+{
+ ::CORBA::TypeCode_ptr const _tc_RoutingType =
+ &_tao_tc_Messaging_RoutingType;
+}
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/alias_typecode.cpp:50
+
+static TAO::TypeCode::Alias<char const *,
+ ::CORBA::TypeCode_ptr const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_Messaging_Ordering (
+ ::CORBA::tk_alias,
+ "IDL:omg.org/Messaging/Ordering:1.0",
+ "Ordering",
+ &CORBA::_tc_ushort);
+
+namespace Messaging
+{
+ ::CORBA::TypeCode_ptr const _tc_Ordering =
+ &_tao_tc_Messaging_Ordering;
+}
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/objref_typecode.cpp:76
+
+static TAO::TypeCode::Objref<char const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_Messaging_RebindPolicy (
+ ::CORBA::tk_local_interface,
+ "IDL:omg.org/Messaging/RebindPolicy:1.0",
+ "RebindPolicy");
+
+namespace Messaging
+{
+ ::CORBA::TypeCode_ptr const _tc_RebindPolicy =
+ &_tao_tc_Messaging_RebindPolicy;
+}
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/struct_typecode.cpp:89
+
+static TAO::TypeCode::Struct_Field<char const *, ::CORBA::TypeCode_ptr const *> const _tao_fields_Messaging_PriorityRange[] =
+ {
+ { "min", &Messaging::_tc_Priority },
+ { "max", &Messaging::_tc_Priority }
+
+ };
+static TAO::TypeCode::Struct<char const *,
+ ::CORBA::TypeCode_ptr const *,
+ TAO::TypeCode::Struct_Field<char const *, ::CORBA::TypeCode_ptr const *> const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_Messaging_PriorityRange (
+ ::CORBA::tk_struct,
+ "IDL:omg.org/Messaging/PriorityRange:1.0",
+ "PriorityRange",
+ _tao_fields_Messaging_PriorityRange,
+ 2);
+
+namespace Messaging
+{
+ ::CORBA::TypeCode_ptr const _tc_PriorityRange =
+ &_tao_tc_Messaging_PriorityRange;
+}
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/objref_typecode.cpp:76
+
+static TAO::TypeCode::Objref<char const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_Messaging_RequestPriorityPolicy (
+ ::CORBA::tk_local_interface,
+ "IDL:omg.org/Messaging/RequestPriorityPolicy:1.0",
+ "RequestPriorityPolicy");
+
+namespace Messaging
+{
+ ::CORBA::TypeCode_ptr const _tc_RequestPriorityPolicy =
+ &_tao_tc_Messaging_RequestPriorityPolicy;
+}
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/objref_typecode.cpp:76
+
+static TAO::TypeCode::Objref<char const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_Messaging_ReplyPriorityPolicy (
+ ::CORBA::tk_local_interface,
+ "IDL:omg.org/Messaging/ReplyPriorityPolicy:1.0",
+ "ReplyPriorityPolicy");
+
+namespace Messaging
+{
+ ::CORBA::TypeCode_ptr const _tc_ReplyPriorityPolicy =
+ &_tao_tc_Messaging_ReplyPriorityPolicy;
+}
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/objref_typecode.cpp:76
+
+static TAO::TypeCode::Objref<char const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_Messaging_RequestStartTimePolicy (
+ ::CORBA::tk_local_interface,
+ "IDL:omg.org/Messaging/RequestStartTimePolicy:1.0",
+ "RequestStartTimePolicy");
+
+namespace Messaging
+{
+ ::CORBA::TypeCode_ptr const _tc_RequestStartTimePolicy =
+ &_tao_tc_Messaging_RequestStartTimePolicy;
+}
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/objref_typecode.cpp:76
+
+static TAO::TypeCode::Objref<char const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_Messaging_RequestEndTimePolicy (
+ ::CORBA::tk_local_interface,
+ "IDL:omg.org/Messaging/RequestEndTimePolicy:1.0",
+ "RequestEndTimePolicy");
+
+namespace Messaging
+{
+ ::CORBA::TypeCode_ptr const _tc_RequestEndTimePolicy =
+ &_tao_tc_Messaging_RequestEndTimePolicy;
+}
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/objref_typecode.cpp:76
+
+static TAO::TypeCode::Objref<char const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_Messaging_ReplyStartTimePolicy (
+ ::CORBA::tk_local_interface,
+ "IDL:omg.org/Messaging/ReplyStartTimePolicy:1.0",
+ "ReplyStartTimePolicy");
+
+namespace Messaging
+{
+ ::CORBA::TypeCode_ptr const _tc_ReplyStartTimePolicy =
+ &_tao_tc_Messaging_ReplyStartTimePolicy;
+}
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/objref_typecode.cpp:76
+
+static TAO::TypeCode::Objref<char const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_Messaging_ReplyEndTimePolicy (
+ ::CORBA::tk_local_interface,
+ "IDL:omg.org/Messaging/ReplyEndTimePolicy:1.0",
+ "ReplyEndTimePolicy");
+
+namespace Messaging
+{
+ ::CORBA::TypeCode_ptr const _tc_ReplyEndTimePolicy =
+ &_tao_tc_Messaging_ReplyEndTimePolicy;
+}
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/objref_typecode.cpp:76
+
+static TAO::TypeCode::Objref<char const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_Messaging_RelativeRequestTimeoutPolicy (
+ ::CORBA::tk_local_interface,
+ "IDL:omg.org/Messaging/RelativeRequestTimeoutPolicy:1.0",
+ "RelativeRequestTimeoutPolicy");
+
+namespace Messaging
+{
+ ::CORBA::TypeCode_ptr const _tc_RelativeRequestTimeoutPolicy =
+ &_tao_tc_Messaging_RelativeRequestTimeoutPolicy;
+}
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/struct_typecode.cpp:89
+
+static TAO::TypeCode::Struct_Field<char const *, ::CORBA::TypeCode_ptr const *> const _tao_fields_Messaging_RoutingTypeRange[] =
+ {
+ { "min", &Messaging::_tc_RoutingType },
+ { "max", &Messaging::_tc_RoutingType }
+
+ };
+static TAO::TypeCode::Struct<char const *,
+ ::CORBA::TypeCode_ptr const *,
+ TAO::TypeCode::Struct_Field<char const *, ::CORBA::TypeCode_ptr const *> const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_Messaging_RoutingTypeRange (
+ ::CORBA::tk_struct,
+ "IDL:omg.org/Messaging/RoutingTypeRange:1.0",
+ "RoutingTypeRange",
+ _tao_fields_Messaging_RoutingTypeRange,
+ 2);
+
+namespace Messaging
+{
+ ::CORBA::TypeCode_ptr const _tc_RoutingTypeRange =
+ &_tao_tc_Messaging_RoutingTypeRange;
+}
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/objref_typecode.cpp:76
+
+static TAO::TypeCode::Objref<char const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_Messaging_RoutingPolicy (
+ ::CORBA::tk_local_interface,
+ "IDL:omg.org/Messaging/RoutingPolicy:1.0",
+ "RoutingPolicy");
+
+namespace Messaging
+{
+ ::CORBA::TypeCode_ptr const _tc_RoutingPolicy =
+ &_tao_tc_Messaging_RoutingPolicy;
+}
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/objref_typecode.cpp:76
+
+static TAO::TypeCode::Objref<char const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_Messaging_MaxHopsPolicy (
+ ::CORBA::tk_local_interface,
+ "IDL:omg.org/Messaging/MaxHopsPolicy:1.0",
+ "MaxHopsPolicy");
+
+namespace Messaging
+{
+ ::CORBA::TypeCode_ptr const _tc_MaxHopsPolicy =
+ &_tao_tc_Messaging_MaxHopsPolicy;
+}
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/objref_typecode.cpp:76
+
+static TAO::TypeCode::Objref<char const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_Messaging_QueueOrderPolicy (
+ ::CORBA::tk_local_interface,
+ "IDL:omg.org/Messaging/QueueOrderPolicy:1.0",
+ "QueueOrderPolicy");
+
+namespace Messaging
+{
+ ::CORBA::TypeCode_ptr const _tc_QueueOrderPolicy =
+ &_tao_tc_Messaging_QueueOrderPolicy;
+}
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_structure/any_op_cs.cpp:54
+
+// Copying insertion.
+void operator<<= (
+ ::CORBA::Any &_tao_any,
+ const Messaging::PriorityRange &_tao_elem
+ )
+{
+ if (0 == &_tao_elem) // Trying to de-reference NULL object
+ _tao_any <<= static_cast<Messaging::PriorityRange *>( 0 ); // Use non-copying insertion of a NULL
+ else
+ TAO::Any_Dual_Impl_T<Messaging::PriorityRange>::insert_copy (
+ _tao_any,
+ Messaging::PriorityRange::_tao_any_destructor,
+ Messaging::_tc_PriorityRange,
+ _tao_elem
+ );
+}
+
+// Non-copying insertion.
+void operator<<= (
+ ::CORBA::Any &_tao_any,
+ Messaging::PriorityRange *_tao_elem
+ )
+{
+ TAO::Any_Dual_Impl_T<Messaging::PriorityRange>::insert (
+ _tao_any,
+ Messaging::PriorityRange::_tao_any_destructor,
+ Messaging::_tc_PriorityRange,
+ _tao_elem
+ );
+}
+
+// Extraction to non-const pointer (deprecated).
+::CORBA::Boolean operator>>= (
+ const ::CORBA::Any &_tao_any,
+ Messaging::PriorityRange *&_tao_elem
+ )
+{
+ return _tao_any >>= const_cast<
+ const Messaging::PriorityRange *&> (
+ _tao_elem
+ );
+}
+
+// Extraction to const pointer.
+::CORBA::Boolean operator>>= (
+ const ::CORBA::Any &_tao_any,
+ const Messaging::PriorityRange *&_tao_elem
+ )
+{
+ return
+ TAO::Any_Dual_Impl_T<Messaging::PriorityRange>::extract (
+ _tao_any,
+ Messaging::PriorityRange::_tao_any_destructor,
+ Messaging::_tc_PriorityRange,
+ _tao_elem
+ );
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_structure/any_op_cs.cpp:54
+
+// Copying insertion.
+void operator<<= (
+ ::CORBA::Any &_tao_any,
+ const Messaging::RoutingTypeRange &_tao_elem
+ )
+{
+ if (0 == &_tao_elem) // Trying to de-reference NULL object
+ _tao_any <<= static_cast<Messaging::RoutingTypeRange *>( 0 ); // Use non-copying insertion of a NULL
+ else
+ TAO::Any_Dual_Impl_T<Messaging::RoutingTypeRange>::insert_copy (
+ _tao_any,
+ Messaging::RoutingTypeRange::_tao_any_destructor,
+ Messaging::_tc_RoutingTypeRange,
+ _tao_elem
+ );
+}
+
+// Non-copying insertion.
+void operator<<= (
+ ::CORBA::Any &_tao_any,
+ Messaging::RoutingTypeRange *_tao_elem
+ )
+{
+ TAO::Any_Dual_Impl_T<Messaging::RoutingTypeRange>::insert (
+ _tao_any,
+ Messaging::RoutingTypeRange::_tao_any_destructor,
+ Messaging::_tc_RoutingTypeRange,
+ _tao_elem
+ );
+}
+
+// Extraction to non-const pointer (deprecated).
+::CORBA::Boolean operator>>= (
+ const ::CORBA::Any &_tao_any,
+ Messaging::RoutingTypeRange *&_tao_elem
+ )
+{
+ return _tao_any >>= const_cast<
+ const Messaging::RoutingTypeRange *&> (
+ _tao_elem
+ );
+}
+
+// Extraction to const pointer.
+::CORBA::Boolean operator>>= (
+ const ::CORBA::Any &_tao_any,
+ const Messaging::RoutingTypeRange *&_tao_elem
+ )
+{
+ return
+ TAO::Any_Dual_Impl_T<Messaging::RoutingTypeRange>::extract (
+ _tao_any,
+ Messaging::RoutingTypeRange::_tao_any_destructor,
+ Messaging::_tc_RoutingTypeRange,
+ _tao_elem
+ );
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Messaging/Messaging_No_ImplA.h b/TAO/tao/Messaging/Messaging_No_ImplA.h
new file mode 100644
index 00000000000..e11e3273d6c
--- /dev/null
+++ b/TAO/tao/Messaging/Messaging_No_ImplA.h
@@ -0,0 +1,160 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:754
+
+#ifndef _TAO_IDL_MESSAGING_NO_IMPLA_H_
+#define _TAO_IDL_MESSAGING_NO_IMPLA_H_
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Messaging/messaging_export.h"
+#include "tao/Messaging/Messaging_No_ImplC.h"
+#include "tao/AnyTypeCode/TimeBaseA.h"
+#include "tao/AnyTypeCode/PolicyA.h"
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_module/module_ch.cpp:59
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace Messaging
+{
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:49
+
+ extern TAO_Messaging_Export ::CORBA::TypeCode_ptr const _tc_Priority;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:49
+
+ extern TAO_Messaging_Export ::CORBA::TypeCode_ptr const _tc_RebindMode;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:49
+
+ extern TAO_Messaging_Export ::CORBA::TypeCode_ptr const _tc_RoutingType;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:49
+
+ extern TAO_Messaging_Export ::CORBA::TypeCode_ptr const _tc_Ordering;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:49
+
+ extern TAO_Messaging_Export ::CORBA::TypeCode_ptr const _tc_RebindPolicy;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:49
+
+ extern TAO_Messaging_Export ::CORBA::TypeCode_ptr const _tc_PriorityRange;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:49
+
+ extern TAO_Messaging_Export ::CORBA::TypeCode_ptr const _tc_RequestPriorityPolicy;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:49
+
+ extern TAO_Messaging_Export ::CORBA::TypeCode_ptr const _tc_ReplyPriorityPolicy;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:49
+
+ extern TAO_Messaging_Export ::CORBA::TypeCode_ptr const _tc_RequestStartTimePolicy;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:49
+
+ extern TAO_Messaging_Export ::CORBA::TypeCode_ptr const _tc_RequestEndTimePolicy;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:49
+
+ extern TAO_Messaging_Export ::CORBA::TypeCode_ptr const _tc_ReplyStartTimePolicy;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:49
+
+ extern TAO_Messaging_Export ::CORBA::TypeCode_ptr const _tc_ReplyEndTimePolicy;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:49
+
+ extern TAO_Messaging_Export ::CORBA::TypeCode_ptr const _tc_RelativeRequestTimeoutPolicy;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:49
+
+ extern TAO_Messaging_Export ::CORBA::TypeCode_ptr const _tc_RoutingTypeRange;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:49
+
+ extern TAO_Messaging_Export ::CORBA::TypeCode_ptr const _tc_RoutingPolicy;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:49
+
+ extern TAO_Messaging_Export ::CORBA::TypeCode_ptr const _tc_MaxHopsPolicy;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:49
+
+ extern TAO_Messaging_Export ::CORBA::TypeCode_ptr const _tc_QueueOrderPolicy;
+
+// TAO_IDL - Generated from
+// be\be_visitor_module/module_ch.cpp:86
+
+} // module Messaging
+
+// TAO_IDL - Generated from
+// be\be_visitor_structure/any_op_ch.cpp:53
+
+TAO_Messaging_Export void operator<<= (::CORBA::Any &, const Messaging::PriorityRange &); // copying version
+TAO_Messaging_Export void operator<<= (::CORBA::Any &, Messaging::PriorityRange*); // noncopying version
+TAO_Messaging_Export ::CORBA::Boolean operator>>= (const ::CORBA::Any &, Messaging::PriorityRange *&); // deprecated
+TAO_Messaging_Export ::CORBA::Boolean operator>>= (const ::CORBA::Any &, const Messaging::PriorityRange *&);
+
+// TAO_IDL - Generated from
+// be\be_visitor_structure/any_op_ch.cpp:53
+
+TAO_Messaging_Export void operator<<= (::CORBA::Any &, const Messaging::RoutingTypeRange &); // copying version
+TAO_Messaging_Export void operator<<= (::CORBA::Any &, Messaging::RoutingTypeRange*); // noncopying version
+TAO_Messaging_Export ::CORBA::Boolean operator>>= (const ::CORBA::Any &, Messaging::RoutingTypeRange *&); // deprecated
+TAO_Messaging_Export ::CORBA::Boolean operator>>= (const ::CORBA::Any &, const Messaging::RoutingTypeRange *&);
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* ifndef */
diff --git a/TAO/tao/Messaging/Messaging_No_ImplC.cpp b/TAO/tao/Messaging/Messaging_No_ImplC.cpp
new file mode 100644
index 00000000000..456e69837f8
--- /dev/null
+++ b/TAO/tao/Messaging/Messaging_No_ImplC.cpp
@@ -0,0 +1,1494 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:277
+
+
+#include "tao/Messaging/Messaging_No_ImplC.h"
+#include "tao/CDR.h"
+#include "ace/OS_NS_string.h"
+
+// TAO_IDL - Generated from
+// be\be_visitor_arg_traits.cpp:70
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Arg traits specializations.
+namespace TAO
+{
+}
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/interface_cs.cpp:60
+
+// Traits specializations for Messaging::RebindPolicy.
+
+Messaging::RebindPolicy_ptr
+TAO::Objref_Traits<Messaging::RebindPolicy>::duplicate (
+ Messaging::RebindPolicy_ptr p
+ )
+{
+ return Messaging::RebindPolicy::_duplicate (p);
+}
+
+void
+TAO::Objref_Traits<Messaging::RebindPolicy>::release (
+ Messaging::RebindPolicy_ptr p
+ )
+{
+ ::CORBA::release (p);
+}
+
+Messaging::RebindPolicy_ptr
+TAO::Objref_Traits<Messaging::RebindPolicy>::nil (void)
+{
+ return Messaging::RebindPolicy::_nil ();
+}
+
+::CORBA::Boolean
+TAO::Objref_Traits<Messaging::RebindPolicy>::marshal (
+ Messaging::RebindPolicy_ptr p,
+ TAO_OutputCDR & cdr
+ )
+{
+ return ::CORBA::Object::marshal (p, cdr);
+}
+
+Messaging::RebindPolicy::RebindPolicy (void)
+{}
+
+Messaging::RebindPolicy::~RebindPolicy (void)
+{}
+
+Messaging::RebindPolicy_ptr
+Messaging::RebindPolicy::_narrow (
+ ::CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return RebindPolicy::_duplicate (
+ dynamic_cast<RebindPolicy_ptr> (_tao_objref)
+ );
+}
+
+Messaging::RebindPolicy_ptr
+Messaging::RebindPolicy::_unchecked_narrow (
+ ::CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return RebindPolicy::_duplicate (
+ dynamic_cast<RebindPolicy_ptr> (_tao_objref)
+ );
+}
+
+Messaging::RebindPolicy_ptr
+Messaging::RebindPolicy::_duplicate (RebindPolicy_ptr obj)
+{
+ if (! ::CORBA::is_nil (obj))
+ {
+ obj->_add_ref ();
+ }
+
+ return obj;
+}
+
+void
+Messaging::RebindPolicy::_tao_release (RebindPolicy_ptr obj)
+{
+ ::CORBA::release (obj);
+}
+
+::CORBA::Boolean
+Messaging::RebindPolicy::_is_a (
+ const char *value
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ if (
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/Policy:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/Messaging/RebindPolicy:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/LocalObject:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/Object:1.0"
+ )
+ )
+ {
+ return true; // success using local knowledge
+ }
+ else
+ {
+ return false;
+ }
+}
+
+const char* Messaging::RebindPolicy::_interface_repository_id (void) const
+{
+ return "IDL:omg.org/Messaging/RebindPolicy:1.0";
+}
+
+::CORBA::Boolean
+Messaging::RebindPolicy::marshal (TAO_OutputCDR &)
+{
+ return false;
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_structure/structure_cs.cpp:66
+
+void
+Messaging::PriorityRange::_tao_any_destructor (
+ void *_tao_void_pointer
+ )
+{
+ PriorityRange *_tao_tmp_pointer =
+ static_cast<PriorityRange *> (_tao_void_pointer);
+ delete _tao_tmp_pointer;
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/interface_cs.cpp:60
+
+// Traits specializations for Messaging::RequestPriorityPolicy.
+
+Messaging::RequestPriorityPolicy_ptr
+TAO::Objref_Traits<Messaging::RequestPriorityPolicy>::duplicate (
+ Messaging::RequestPriorityPolicy_ptr p
+ )
+{
+ return Messaging::RequestPriorityPolicy::_duplicate (p);
+}
+
+void
+TAO::Objref_Traits<Messaging::RequestPriorityPolicy>::release (
+ Messaging::RequestPriorityPolicy_ptr p
+ )
+{
+ ::CORBA::release (p);
+}
+
+Messaging::RequestPriorityPolicy_ptr
+TAO::Objref_Traits<Messaging::RequestPriorityPolicy>::nil (void)
+{
+ return Messaging::RequestPriorityPolicy::_nil ();
+}
+
+::CORBA::Boolean
+TAO::Objref_Traits<Messaging::RequestPriorityPolicy>::marshal (
+ Messaging::RequestPriorityPolicy_ptr p,
+ TAO_OutputCDR & cdr
+ )
+{
+ return ::CORBA::Object::marshal (p, cdr);
+}
+
+Messaging::RequestPriorityPolicy::RequestPriorityPolicy (void)
+{}
+
+Messaging::RequestPriorityPolicy::~RequestPriorityPolicy (void)
+{}
+
+Messaging::RequestPriorityPolicy_ptr
+Messaging::RequestPriorityPolicy::_narrow (
+ ::CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return RequestPriorityPolicy::_duplicate (
+ dynamic_cast<RequestPriorityPolicy_ptr> (_tao_objref)
+ );
+}
+
+Messaging::RequestPriorityPolicy_ptr
+Messaging::RequestPriorityPolicy::_unchecked_narrow (
+ ::CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return RequestPriorityPolicy::_duplicate (
+ dynamic_cast<RequestPriorityPolicy_ptr> (_tao_objref)
+ );
+}
+
+Messaging::RequestPriorityPolicy_ptr
+Messaging::RequestPriorityPolicy::_duplicate (RequestPriorityPolicy_ptr obj)
+{
+ if (! ::CORBA::is_nil (obj))
+ {
+ obj->_add_ref ();
+ }
+
+ return obj;
+}
+
+void
+Messaging::RequestPriorityPolicy::_tao_release (RequestPriorityPolicy_ptr obj)
+{
+ ::CORBA::release (obj);
+}
+
+::CORBA::Boolean
+Messaging::RequestPriorityPolicy::_is_a (
+ const char *value
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ if (
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/Policy:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/Messaging/RequestPriorityPolicy:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/LocalObject:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/Object:1.0"
+ )
+ )
+ {
+ return true; // success using local knowledge
+ }
+ else
+ {
+ return false;
+ }
+}
+
+const char* Messaging::RequestPriorityPolicy::_interface_repository_id (void) const
+{
+ return "IDL:omg.org/Messaging/RequestPriorityPolicy:1.0";
+}
+
+::CORBA::Boolean
+Messaging::RequestPriorityPolicy::marshal (TAO_OutputCDR &)
+{
+ return false;
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/interface_cs.cpp:60
+
+// Traits specializations for Messaging::ReplyPriorityPolicy.
+
+Messaging::ReplyPriorityPolicy_ptr
+TAO::Objref_Traits<Messaging::ReplyPriorityPolicy>::duplicate (
+ Messaging::ReplyPriorityPolicy_ptr p
+ )
+{
+ return Messaging::ReplyPriorityPolicy::_duplicate (p);
+}
+
+void
+TAO::Objref_Traits<Messaging::ReplyPriorityPolicy>::release (
+ Messaging::ReplyPriorityPolicy_ptr p
+ )
+{
+ ::CORBA::release (p);
+}
+
+Messaging::ReplyPriorityPolicy_ptr
+TAO::Objref_Traits<Messaging::ReplyPriorityPolicy>::nil (void)
+{
+ return Messaging::ReplyPriorityPolicy::_nil ();
+}
+
+::CORBA::Boolean
+TAO::Objref_Traits<Messaging::ReplyPriorityPolicy>::marshal (
+ Messaging::ReplyPriorityPolicy_ptr p,
+ TAO_OutputCDR & cdr
+ )
+{
+ return ::CORBA::Object::marshal (p, cdr);
+}
+
+Messaging::ReplyPriorityPolicy::ReplyPriorityPolicy (void)
+{}
+
+Messaging::ReplyPriorityPolicy::~ReplyPriorityPolicy (void)
+{}
+
+Messaging::ReplyPriorityPolicy_ptr
+Messaging::ReplyPriorityPolicy::_narrow (
+ ::CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return ReplyPriorityPolicy::_duplicate (
+ dynamic_cast<ReplyPriorityPolicy_ptr> (_tao_objref)
+ );
+}
+
+Messaging::ReplyPriorityPolicy_ptr
+Messaging::ReplyPriorityPolicy::_unchecked_narrow (
+ ::CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return ReplyPriorityPolicy::_duplicate (
+ dynamic_cast<ReplyPriorityPolicy_ptr> (_tao_objref)
+ );
+}
+
+Messaging::ReplyPriorityPolicy_ptr
+Messaging::ReplyPriorityPolicy::_duplicate (ReplyPriorityPolicy_ptr obj)
+{
+ if (! ::CORBA::is_nil (obj))
+ {
+ obj->_add_ref ();
+ }
+
+ return obj;
+}
+
+void
+Messaging::ReplyPriorityPolicy::_tao_release (ReplyPriorityPolicy_ptr obj)
+{
+ ::CORBA::release (obj);
+}
+
+::CORBA::Boolean
+Messaging::ReplyPriorityPolicy::_is_a (
+ const char *value
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ if (
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/Policy:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/Messaging/ReplyPriorityPolicy:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/LocalObject:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/Object:1.0"
+ )
+ )
+ {
+ return true; // success using local knowledge
+ }
+ else
+ {
+ return false;
+ }
+}
+
+const char* Messaging::ReplyPriorityPolicy::_interface_repository_id (void) const
+{
+ return "IDL:omg.org/Messaging/ReplyPriorityPolicy:1.0";
+}
+
+::CORBA::Boolean
+Messaging::ReplyPriorityPolicy::marshal (TAO_OutputCDR &)
+{
+ return false;
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/interface_cs.cpp:60
+
+// Traits specializations for Messaging::RequestStartTimePolicy.
+
+Messaging::RequestStartTimePolicy_ptr
+TAO::Objref_Traits<Messaging::RequestStartTimePolicy>::duplicate (
+ Messaging::RequestStartTimePolicy_ptr p
+ )
+{
+ return Messaging::RequestStartTimePolicy::_duplicate (p);
+}
+
+void
+TAO::Objref_Traits<Messaging::RequestStartTimePolicy>::release (
+ Messaging::RequestStartTimePolicy_ptr p
+ )
+{
+ ::CORBA::release (p);
+}
+
+Messaging::RequestStartTimePolicy_ptr
+TAO::Objref_Traits<Messaging::RequestStartTimePolicy>::nil (void)
+{
+ return Messaging::RequestStartTimePolicy::_nil ();
+}
+
+::CORBA::Boolean
+TAO::Objref_Traits<Messaging::RequestStartTimePolicy>::marshal (
+ Messaging::RequestStartTimePolicy_ptr p,
+ TAO_OutputCDR & cdr
+ )
+{
+ return ::CORBA::Object::marshal (p, cdr);
+}
+
+Messaging::RequestStartTimePolicy::RequestStartTimePolicy (void)
+{}
+
+Messaging::RequestStartTimePolicy::~RequestStartTimePolicy (void)
+{}
+
+Messaging::RequestStartTimePolicy_ptr
+Messaging::RequestStartTimePolicy::_narrow (
+ ::CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return RequestStartTimePolicy::_duplicate (
+ dynamic_cast<RequestStartTimePolicy_ptr> (_tao_objref)
+ );
+}
+
+Messaging::RequestStartTimePolicy_ptr
+Messaging::RequestStartTimePolicy::_unchecked_narrow (
+ ::CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return RequestStartTimePolicy::_duplicate (
+ dynamic_cast<RequestStartTimePolicy_ptr> (_tao_objref)
+ );
+}
+
+Messaging::RequestStartTimePolicy_ptr
+Messaging::RequestStartTimePolicy::_duplicate (RequestStartTimePolicy_ptr obj)
+{
+ if (! ::CORBA::is_nil (obj))
+ {
+ obj->_add_ref ();
+ }
+
+ return obj;
+}
+
+void
+Messaging::RequestStartTimePolicy::_tao_release (RequestStartTimePolicy_ptr obj)
+{
+ ::CORBA::release (obj);
+}
+
+::CORBA::Boolean
+Messaging::RequestStartTimePolicy::_is_a (
+ const char *value
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ if (
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/Policy:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/Messaging/RequestStartTimePolicy:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/LocalObject:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/Object:1.0"
+ )
+ )
+ {
+ return true; // success using local knowledge
+ }
+ else
+ {
+ return false;
+ }
+}
+
+const char* Messaging::RequestStartTimePolicy::_interface_repository_id (void) const
+{
+ return "IDL:omg.org/Messaging/RequestStartTimePolicy:1.0";
+}
+
+::CORBA::Boolean
+Messaging::RequestStartTimePolicy::marshal (TAO_OutputCDR &)
+{
+ return false;
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/interface_cs.cpp:60
+
+// Traits specializations for Messaging::RequestEndTimePolicy.
+
+Messaging::RequestEndTimePolicy_ptr
+TAO::Objref_Traits<Messaging::RequestEndTimePolicy>::duplicate (
+ Messaging::RequestEndTimePolicy_ptr p
+ )
+{
+ return Messaging::RequestEndTimePolicy::_duplicate (p);
+}
+
+void
+TAO::Objref_Traits<Messaging::RequestEndTimePolicy>::release (
+ Messaging::RequestEndTimePolicy_ptr p
+ )
+{
+ ::CORBA::release (p);
+}
+
+Messaging::RequestEndTimePolicy_ptr
+TAO::Objref_Traits<Messaging::RequestEndTimePolicy>::nil (void)
+{
+ return Messaging::RequestEndTimePolicy::_nil ();
+}
+
+::CORBA::Boolean
+TAO::Objref_Traits<Messaging::RequestEndTimePolicy>::marshal (
+ Messaging::RequestEndTimePolicy_ptr p,
+ TAO_OutputCDR & cdr
+ )
+{
+ return ::CORBA::Object::marshal (p, cdr);
+}
+
+Messaging::RequestEndTimePolicy::RequestEndTimePolicy (void)
+{}
+
+Messaging::RequestEndTimePolicy::~RequestEndTimePolicy (void)
+{}
+
+Messaging::RequestEndTimePolicy_ptr
+Messaging::RequestEndTimePolicy::_narrow (
+ ::CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return RequestEndTimePolicy::_duplicate (
+ dynamic_cast<RequestEndTimePolicy_ptr> (_tao_objref)
+ );
+}
+
+Messaging::RequestEndTimePolicy_ptr
+Messaging::RequestEndTimePolicy::_unchecked_narrow (
+ ::CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return RequestEndTimePolicy::_duplicate (
+ dynamic_cast<RequestEndTimePolicy_ptr> (_tao_objref)
+ );
+}
+
+Messaging::RequestEndTimePolicy_ptr
+Messaging::RequestEndTimePolicy::_duplicate (RequestEndTimePolicy_ptr obj)
+{
+ if (! ::CORBA::is_nil (obj))
+ {
+ obj->_add_ref ();
+ }
+
+ return obj;
+}
+
+void
+Messaging::RequestEndTimePolicy::_tao_release (RequestEndTimePolicy_ptr obj)
+{
+ ::CORBA::release (obj);
+}
+
+::CORBA::Boolean
+Messaging::RequestEndTimePolicy::_is_a (
+ const char *value
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ if (
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/Policy:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/Messaging/RequestEndTimePolicy:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/LocalObject:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/Object:1.0"
+ )
+ )
+ {
+ return true; // success using local knowledge
+ }
+ else
+ {
+ return false;
+ }
+}
+
+const char* Messaging::RequestEndTimePolicy::_interface_repository_id (void) const
+{
+ return "IDL:omg.org/Messaging/RequestEndTimePolicy:1.0";
+}
+
+::CORBA::Boolean
+Messaging::RequestEndTimePolicy::marshal (TAO_OutputCDR &)
+{
+ return false;
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/interface_cs.cpp:60
+
+// Traits specializations for Messaging::ReplyStartTimePolicy.
+
+Messaging::ReplyStartTimePolicy_ptr
+TAO::Objref_Traits<Messaging::ReplyStartTimePolicy>::duplicate (
+ Messaging::ReplyStartTimePolicy_ptr p
+ )
+{
+ return Messaging::ReplyStartTimePolicy::_duplicate (p);
+}
+
+void
+TAO::Objref_Traits<Messaging::ReplyStartTimePolicy>::release (
+ Messaging::ReplyStartTimePolicy_ptr p
+ )
+{
+ ::CORBA::release (p);
+}
+
+Messaging::ReplyStartTimePolicy_ptr
+TAO::Objref_Traits<Messaging::ReplyStartTimePolicy>::nil (void)
+{
+ return Messaging::ReplyStartTimePolicy::_nil ();
+}
+
+::CORBA::Boolean
+TAO::Objref_Traits<Messaging::ReplyStartTimePolicy>::marshal (
+ Messaging::ReplyStartTimePolicy_ptr p,
+ TAO_OutputCDR & cdr
+ )
+{
+ return ::CORBA::Object::marshal (p, cdr);
+}
+
+Messaging::ReplyStartTimePolicy::ReplyStartTimePolicy (void)
+{}
+
+Messaging::ReplyStartTimePolicy::~ReplyStartTimePolicy (void)
+{}
+
+Messaging::ReplyStartTimePolicy_ptr
+Messaging::ReplyStartTimePolicy::_narrow (
+ ::CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return ReplyStartTimePolicy::_duplicate (
+ dynamic_cast<ReplyStartTimePolicy_ptr> (_tao_objref)
+ );
+}
+
+Messaging::ReplyStartTimePolicy_ptr
+Messaging::ReplyStartTimePolicy::_unchecked_narrow (
+ ::CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return ReplyStartTimePolicy::_duplicate (
+ dynamic_cast<ReplyStartTimePolicy_ptr> (_tao_objref)
+ );
+}
+
+Messaging::ReplyStartTimePolicy_ptr
+Messaging::ReplyStartTimePolicy::_duplicate (ReplyStartTimePolicy_ptr obj)
+{
+ if (! ::CORBA::is_nil (obj))
+ {
+ obj->_add_ref ();
+ }
+
+ return obj;
+}
+
+void
+Messaging::ReplyStartTimePolicy::_tao_release (ReplyStartTimePolicy_ptr obj)
+{
+ ::CORBA::release (obj);
+}
+
+::CORBA::Boolean
+Messaging::ReplyStartTimePolicy::_is_a (
+ const char *value
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ if (
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/Policy:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/Messaging/ReplyStartTimePolicy:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/LocalObject:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/Object:1.0"
+ )
+ )
+ {
+ return true; // success using local knowledge
+ }
+ else
+ {
+ return false;
+ }
+}
+
+const char* Messaging::ReplyStartTimePolicy::_interface_repository_id (void) const
+{
+ return "IDL:omg.org/Messaging/ReplyStartTimePolicy:1.0";
+}
+
+::CORBA::Boolean
+Messaging::ReplyStartTimePolicy::marshal (TAO_OutputCDR &)
+{
+ return false;
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/interface_cs.cpp:60
+
+// Traits specializations for Messaging::ReplyEndTimePolicy.
+
+Messaging::ReplyEndTimePolicy_ptr
+TAO::Objref_Traits<Messaging::ReplyEndTimePolicy>::duplicate (
+ Messaging::ReplyEndTimePolicy_ptr p
+ )
+{
+ return Messaging::ReplyEndTimePolicy::_duplicate (p);
+}
+
+void
+TAO::Objref_Traits<Messaging::ReplyEndTimePolicy>::release (
+ Messaging::ReplyEndTimePolicy_ptr p
+ )
+{
+ ::CORBA::release (p);
+}
+
+Messaging::ReplyEndTimePolicy_ptr
+TAO::Objref_Traits<Messaging::ReplyEndTimePolicy>::nil (void)
+{
+ return Messaging::ReplyEndTimePolicy::_nil ();
+}
+
+::CORBA::Boolean
+TAO::Objref_Traits<Messaging::ReplyEndTimePolicy>::marshal (
+ Messaging::ReplyEndTimePolicy_ptr p,
+ TAO_OutputCDR & cdr
+ )
+{
+ return ::CORBA::Object::marshal (p, cdr);
+}
+
+Messaging::ReplyEndTimePolicy::ReplyEndTimePolicy (void)
+{}
+
+Messaging::ReplyEndTimePolicy::~ReplyEndTimePolicy (void)
+{}
+
+Messaging::ReplyEndTimePolicy_ptr
+Messaging::ReplyEndTimePolicy::_narrow (
+ ::CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return ReplyEndTimePolicy::_duplicate (
+ dynamic_cast<ReplyEndTimePolicy_ptr> (_tao_objref)
+ );
+}
+
+Messaging::ReplyEndTimePolicy_ptr
+Messaging::ReplyEndTimePolicy::_unchecked_narrow (
+ ::CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return ReplyEndTimePolicy::_duplicate (
+ dynamic_cast<ReplyEndTimePolicy_ptr> (_tao_objref)
+ );
+}
+
+Messaging::ReplyEndTimePolicy_ptr
+Messaging::ReplyEndTimePolicy::_duplicate (ReplyEndTimePolicy_ptr obj)
+{
+ if (! ::CORBA::is_nil (obj))
+ {
+ obj->_add_ref ();
+ }
+
+ return obj;
+}
+
+void
+Messaging::ReplyEndTimePolicy::_tao_release (ReplyEndTimePolicy_ptr obj)
+{
+ ::CORBA::release (obj);
+}
+
+::CORBA::Boolean
+Messaging::ReplyEndTimePolicy::_is_a (
+ const char *value
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ if (
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/Policy:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/Messaging/ReplyEndTimePolicy:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/LocalObject:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/Object:1.0"
+ )
+ )
+ {
+ return true; // success using local knowledge
+ }
+ else
+ {
+ return false;
+ }
+}
+
+const char* Messaging::ReplyEndTimePolicy::_interface_repository_id (void) const
+{
+ return "IDL:omg.org/Messaging/ReplyEndTimePolicy:1.0";
+}
+
+::CORBA::Boolean
+Messaging::ReplyEndTimePolicy::marshal (TAO_OutputCDR &)
+{
+ return false;
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/interface_cs.cpp:60
+
+// Traits specializations for Messaging::RelativeRequestTimeoutPolicy.
+
+Messaging::RelativeRequestTimeoutPolicy_ptr
+TAO::Objref_Traits<Messaging::RelativeRequestTimeoutPolicy>::duplicate (
+ Messaging::RelativeRequestTimeoutPolicy_ptr p
+ )
+{
+ return Messaging::RelativeRequestTimeoutPolicy::_duplicate (p);
+}
+
+void
+TAO::Objref_Traits<Messaging::RelativeRequestTimeoutPolicy>::release (
+ Messaging::RelativeRequestTimeoutPolicy_ptr p
+ )
+{
+ ::CORBA::release (p);
+}
+
+Messaging::RelativeRequestTimeoutPolicy_ptr
+TAO::Objref_Traits<Messaging::RelativeRequestTimeoutPolicy>::nil (void)
+{
+ return Messaging::RelativeRequestTimeoutPolicy::_nil ();
+}
+
+::CORBA::Boolean
+TAO::Objref_Traits<Messaging::RelativeRequestTimeoutPolicy>::marshal (
+ Messaging::RelativeRequestTimeoutPolicy_ptr p,
+ TAO_OutputCDR & cdr
+ )
+{
+ return ::CORBA::Object::marshal (p, cdr);
+}
+
+Messaging::RelativeRequestTimeoutPolicy::RelativeRequestTimeoutPolicy (void)
+{}
+
+Messaging::RelativeRequestTimeoutPolicy::~RelativeRequestTimeoutPolicy (void)
+{}
+
+Messaging::RelativeRequestTimeoutPolicy_ptr
+Messaging::RelativeRequestTimeoutPolicy::_narrow (
+ ::CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return RelativeRequestTimeoutPolicy::_duplicate (
+ dynamic_cast<RelativeRequestTimeoutPolicy_ptr> (_tao_objref)
+ );
+}
+
+Messaging::RelativeRequestTimeoutPolicy_ptr
+Messaging::RelativeRequestTimeoutPolicy::_unchecked_narrow (
+ ::CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return RelativeRequestTimeoutPolicy::_duplicate (
+ dynamic_cast<RelativeRequestTimeoutPolicy_ptr> (_tao_objref)
+ );
+}
+
+Messaging::RelativeRequestTimeoutPolicy_ptr
+Messaging::RelativeRequestTimeoutPolicy::_duplicate (RelativeRequestTimeoutPolicy_ptr obj)
+{
+ if (! ::CORBA::is_nil (obj))
+ {
+ obj->_add_ref ();
+ }
+
+ return obj;
+}
+
+void
+Messaging::RelativeRequestTimeoutPolicy::_tao_release (RelativeRequestTimeoutPolicy_ptr obj)
+{
+ ::CORBA::release (obj);
+}
+
+::CORBA::Boolean
+Messaging::RelativeRequestTimeoutPolicy::_is_a (
+ const char *value
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ if (
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/Policy:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/Messaging/RelativeRequestTimeoutPolicy:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/LocalObject:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/Object:1.0"
+ )
+ )
+ {
+ return true; // success using local knowledge
+ }
+ else
+ {
+ return false;
+ }
+}
+
+const char* Messaging::RelativeRequestTimeoutPolicy::_interface_repository_id (void) const
+{
+ return "IDL:omg.org/Messaging/RelativeRequestTimeoutPolicy:1.0";
+}
+
+::CORBA::Boolean
+Messaging::RelativeRequestTimeoutPolicy::marshal (TAO_OutputCDR &)
+{
+ return false;
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_structure/structure_cs.cpp:66
+
+void
+Messaging::RoutingTypeRange::_tao_any_destructor (
+ void *_tao_void_pointer
+ )
+{
+ RoutingTypeRange *_tao_tmp_pointer =
+ static_cast<RoutingTypeRange *> (_tao_void_pointer);
+ delete _tao_tmp_pointer;
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/interface_cs.cpp:60
+
+// Traits specializations for Messaging::RoutingPolicy.
+
+Messaging::RoutingPolicy_ptr
+TAO::Objref_Traits<Messaging::RoutingPolicy>::duplicate (
+ Messaging::RoutingPolicy_ptr p
+ )
+{
+ return Messaging::RoutingPolicy::_duplicate (p);
+}
+
+void
+TAO::Objref_Traits<Messaging::RoutingPolicy>::release (
+ Messaging::RoutingPolicy_ptr p
+ )
+{
+ ::CORBA::release (p);
+}
+
+Messaging::RoutingPolicy_ptr
+TAO::Objref_Traits<Messaging::RoutingPolicy>::nil (void)
+{
+ return Messaging::RoutingPolicy::_nil ();
+}
+
+::CORBA::Boolean
+TAO::Objref_Traits<Messaging::RoutingPolicy>::marshal (
+ Messaging::RoutingPolicy_ptr p,
+ TAO_OutputCDR & cdr
+ )
+{
+ return ::CORBA::Object::marshal (p, cdr);
+}
+
+Messaging::RoutingPolicy::RoutingPolicy (void)
+{}
+
+Messaging::RoutingPolicy::~RoutingPolicy (void)
+{}
+
+Messaging::RoutingPolicy_ptr
+Messaging::RoutingPolicy::_narrow (
+ ::CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return RoutingPolicy::_duplicate (
+ dynamic_cast<RoutingPolicy_ptr> (_tao_objref)
+ );
+}
+
+Messaging::RoutingPolicy_ptr
+Messaging::RoutingPolicy::_unchecked_narrow (
+ ::CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return RoutingPolicy::_duplicate (
+ dynamic_cast<RoutingPolicy_ptr> (_tao_objref)
+ );
+}
+
+Messaging::RoutingPolicy_ptr
+Messaging::RoutingPolicy::_duplicate (RoutingPolicy_ptr obj)
+{
+ if (! ::CORBA::is_nil (obj))
+ {
+ obj->_add_ref ();
+ }
+
+ return obj;
+}
+
+void
+Messaging::RoutingPolicy::_tao_release (RoutingPolicy_ptr obj)
+{
+ ::CORBA::release (obj);
+}
+
+::CORBA::Boolean
+Messaging::RoutingPolicy::_is_a (
+ const char *value
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ if (
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/Policy:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/Messaging/RoutingPolicy:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/LocalObject:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/Object:1.0"
+ )
+ )
+ {
+ return true; // success using local knowledge
+ }
+ else
+ {
+ return false;
+ }
+}
+
+const char* Messaging::RoutingPolicy::_interface_repository_id (void) const
+{
+ return "IDL:omg.org/Messaging/RoutingPolicy:1.0";
+}
+
+::CORBA::Boolean
+Messaging::RoutingPolicy::marshal (TAO_OutputCDR &)
+{
+ return false;
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/interface_cs.cpp:60
+
+// Traits specializations for Messaging::MaxHopsPolicy.
+
+Messaging::MaxHopsPolicy_ptr
+TAO::Objref_Traits<Messaging::MaxHopsPolicy>::duplicate (
+ Messaging::MaxHopsPolicy_ptr p
+ )
+{
+ return Messaging::MaxHopsPolicy::_duplicate (p);
+}
+
+void
+TAO::Objref_Traits<Messaging::MaxHopsPolicy>::release (
+ Messaging::MaxHopsPolicy_ptr p
+ )
+{
+ ::CORBA::release (p);
+}
+
+Messaging::MaxHopsPolicy_ptr
+TAO::Objref_Traits<Messaging::MaxHopsPolicy>::nil (void)
+{
+ return Messaging::MaxHopsPolicy::_nil ();
+}
+
+::CORBA::Boolean
+TAO::Objref_Traits<Messaging::MaxHopsPolicy>::marshal (
+ Messaging::MaxHopsPolicy_ptr p,
+ TAO_OutputCDR & cdr
+ )
+{
+ return ::CORBA::Object::marshal (p, cdr);
+}
+
+Messaging::MaxHopsPolicy::MaxHopsPolicy (void)
+{}
+
+Messaging::MaxHopsPolicy::~MaxHopsPolicy (void)
+{}
+
+Messaging::MaxHopsPolicy_ptr
+Messaging::MaxHopsPolicy::_narrow (
+ ::CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return MaxHopsPolicy::_duplicate (
+ dynamic_cast<MaxHopsPolicy_ptr> (_tao_objref)
+ );
+}
+
+Messaging::MaxHopsPolicy_ptr
+Messaging::MaxHopsPolicy::_unchecked_narrow (
+ ::CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return MaxHopsPolicy::_duplicate (
+ dynamic_cast<MaxHopsPolicy_ptr> (_tao_objref)
+ );
+}
+
+Messaging::MaxHopsPolicy_ptr
+Messaging::MaxHopsPolicy::_duplicate (MaxHopsPolicy_ptr obj)
+{
+ if (! ::CORBA::is_nil (obj))
+ {
+ obj->_add_ref ();
+ }
+
+ return obj;
+}
+
+void
+Messaging::MaxHopsPolicy::_tao_release (MaxHopsPolicy_ptr obj)
+{
+ ::CORBA::release (obj);
+}
+
+::CORBA::Boolean
+Messaging::MaxHopsPolicy::_is_a (
+ const char *value
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ if (
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/Policy:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/Messaging/MaxHopsPolicy:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/LocalObject:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/Object:1.0"
+ )
+ )
+ {
+ return true; // success using local knowledge
+ }
+ else
+ {
+ return false;
+ }
+}
+
+const char* Messaging::MaxHopsPolicy::_interface_repository_id (void) const
+{
+ return "IDL:omg.org/Messaging/MaxHopsPolicy:1.0";
+}
+
+::CORBA::Boolean
+Messaging::MaxHopsPolicy::marshal (TAO_OutputCDR &)
+{
+ return false;
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/interface_cs.cpp:60
+
+// Traits specializations for Messaging::QueueOrderPolicy.
+
+Messaging::QueueOrderPolicy_ptr
+TAO::Objref_Traits<Messaging::QueueOrderPolicy>::duplicate (
+ Messaging::QueueOrderPolicy_ptr p
+ )
+{
+ return Messaging::QueueOrderPolicy::_duplicate (p);
+}
+
+void
+TAO::Objref_Traits<Messaging::QueueOrderPolicy>::release (
+ Messaging::QueueOrderPolicy_ptr p
+ )
+{
+ ::CORBA::release (p);
+}
+
+Messaging::QueueOrderPolicy_ptr
+TAO::Objref_Traits<Messaging::QueueOrderPolicy>::nil (void)
+{
+ return Messaging::QueueOrderPolicy::_nil ();
+}
+
+::CORBA::Boolean
+TAO::Objref_Traits<Messaging::QueueOrderPolicy>::marshal (
+ Messaging::QueueOrderPolicy_ptr p,
+ TAO_OutputCDR & cdr
+ )
+{
+ return ::CORBA::Object::marshal (p, cdr);
+}
+
+Messaging::QueueOrderPolicy::QueueOrderPolicy (void)
+{}
+
+Messaging::QueueOrderPolicy::~QueueOrderPolicy (void)
+{}
+
+Messaging::QueueOrderPolicy_ptr
+Messaging::QueueOrderPolicy::_narrow (
+ ::CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return QueueOrderPolicy::_duplicate (
+ dynamic_cast<QueueOrderPolicy_ptr> (_tao_objref)
+ );
+}
+
+Messaging::QueueOrderPolicy_ptr
+Messaging::QueueOrderPolicy::_unchecked_narrow (
+ ::CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return QueueOrderPolicy::_duplicate (
+ dynamic_cast<QueueOrderPolicy_ptr> (_tao_objref)
+ );
+}
+
+Messaging::QueueOrderPolicy_ptr
+Messaging::QueueOrderPolicy::_duplicate (QueueOrderPolicy_ptr obj)
+{
+ if (! ::CORBA::is_nil (obj))
+ {
+ obj->_add_ref ();
+ }
+
+ return obj;
+}
+
+void
+Messaging::QueueOrderPolicy::_tao_release (QueueOrderPolicy_ptr obj)
+{
+ ::CORBA::release (obj);
+}
+
+::CORBA::Boolean
+Messaging::QueueOrderPolicy::_is_a (
+ const char *value
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ if (
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/Policy:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/Messaging/QueueOrderPolicy:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/LocalObject:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/Object:1.0"
+ )
+ )
+ {
+ return true; // success using local knowledge
+ }
+ else
+ {
+ return false;
+ }
+}
+
+const char* Messaging::QueueOrderPolicy::_interface_repository_id (void) const
+{
+ return "IDL:omg.org/Messaging/QueueOrderPolicy:1.0";
+}
+
+::CORBA::Boolean
+Messaging::QueueOrderPolicy::marshal (TAO_OutputCDR &)
+{
+ return false;
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_structure/cdr_op_cs.cpp:61
+
+::CORBA::Boolean operator<< (
+ TAO_OutputCDR &strm,
+ const Messaging::PriorityRange &_tao_aggregate
+ )
+{
+ return
+ (strm << _tao_aggregate.min) &&
+ (strm << _tao_aggregate.max);
+}
+
+::CORBA::Boolean operator>> (
+ TAO_InputCDR &strm,
+ Messaging::PriorityRange &_tao_aggregate
+ )
+{
+ return
+ (strm >> _tao_aggregate.min) &&
+ (strm >> _tao_aggregate.max);
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_structure/cdr_op_cs.cpp:61
+
+::CORBA::Boolean operator<< (
+ TAO_OutputCDR &strm,
+ const Messaging::RoutingTypeRange &_tao_aggregate
+ )
+{
+ return
+ (strm << _tao_aggregate.min) &&
+ (strm << _tao_aggregate.max);
+}
+
+::CORBA::Boolean operator>> (
+ TAO_InputCDR &strm,
+ Messaging::RoutingTypeRange &_tao_aggregate
+ )
+{
+ return
+ (strm >> _tao_aggregate.min) &&
+ (strm >> _tao_aggregate.max);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Messaging/Messaging_No_ImplC.h b/TAO/tao/Messaging/Messaging_No_ImplC.h
new file mode 100644
index 00000000000..ba97ba1885e
--- /dev/null
+++ b/TAO/tao/Messaging/Messaging_No_ImplC.h
@@ -0,0 +1,1774 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:154
+
+#ifndef _TAO_IDL_MESSAGING_NO_IMPLC_H_
+#define _TAO_IDL_MESSAGING_NO_IMPLC_H_
+
+#include /**/ "ace/pre.h"
+
+
+#include "ace/config-all.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Messaging/messaging_export.h"
+#include "tao/ORB.h"
+#include "tao/SystemException.h"
+#include "tao/Environment.h"
+#include "tao/Object.h"
+#include "tao/Objref_VarOut_T.h"
+#include "tao/VarOut_T.h"
+
+#include "tao/TimeBaseC.h"
+#include "tao/PolicyC.h"
+
+#if defined(TRANSPARENT)
+// Some platforms define this macro for ioctl()
+#undef TRANSPARENT
+#endif
+
+#if defined (TAO_EXPORT_MACRO)
+#undef TAO_EXPORT_MACRO
+#endif
+#define TAO_EXPORT_MACRO TAO_Messaging_Export
+
+// TAO_IDL - Generated from
+// be\be_visitor_module/module_ch.cpp:49
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace Messaging
+{
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typedef/typedef_ch.cpp:379
+
+ typedef CORBA::Short Priority;
+ typedef CORBA::Short_out Priority_out;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typedef/typedef_ch.cpp:379
+
+ typedef CORBA::Short RebindMode;
+ typedef CORBA::Short_out RebindMode_out;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_constant/constant_ch.cpp:52
+
+ const Messaging::RebindMode TRANSPARENT = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_constant/constant_ch.cpp:52
+
+ const Messaging::RebindMode NO_REBIND = 1;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_constant/constant_ch.cpp:52
+
+ const Messaging::RebindMode NO_RECONNECT = 2;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typedef/typedef_ch.cpp:379
+
+ typedef CORBA::Short RoutingType;
+ typedef CORBA::Short_out RoutingType_out;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_constant/constant_ch.cpp:52
+
+ const Messaging::RoutingType ROUTE_NONE = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_constant/constant_ch.cpp:52
+
+ const Messaging::RoutingType ROUTE_FORWARD = 1;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_constant/constant_ch.cpp:52
+
+ const Messaging::RoutingType ROUTE_STORE_AND_FORWARD = 2;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typedef/typedef_ch.cpp:379
+
+ typedef CORBA::UShort Ordering;
+ typedef CORBA::UShort_out Ordering_out;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_constant/constant_ch.cpp:52
+
+ const Messaging::Ordering ORDER_ANY = 1U;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_constant/constant_ch.cpp:52
+
+ const Messaging::Ordering ORDER_TEMPORAL = 2U;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_constant/constant_ch.cpp:52
+
+ const Messaging::Ordering ORDER_PRIORITY = 4U;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_constant/constant_ch.cpp:52
+
+ const Messaging::Ordering ORDER_DEADLINE = 8U;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_constant/constant_ch.cpp:52
+
+ const CORBA::PolicyType REBIND_POLICY_TYPE = 23U;
+
+ // TAO_IDL - Generated from
+ // be\be_interface.cpp:646
+
+#if !defined (_MESSAGING_REBINDPOLICY__VAR_OUT_CH_)
+#define _MESSAGING_REBINDPOLICY__VAR_OUT_CH_
+
+ class RebindPolicy;
+ typedef RebindPolicy *RebindPolicy_ptr;
+
+ typedef
+ TAO_Objref_Var_T<
+ RebindPolicy
+ >
+ RebindPolicy_var;
+
+ typedef
+ TAO_Objref_Out_T<
+ RebindPolicy
+ >
+ RebindPolicy_out;
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:54
+
+#if !defined (_MESSAGING_REBINDPOLICY_CH_)
+#define _MESSAGING_REBINDPOLICY_CH_
+
+ class TAO_Messaging_Export RebindPolicy
+ : public virtual ::CORBA::Policy
+ {
+ public:
+ typedef RebindPolicy_ptr _ptr_type;
+ typedef RebindPolicy_var _var_type;
+
+ // The static operations.
+ static RebindPolicy_ptr _duplicate (RebindPolicy_ptr obj);
+
+ static void _tao_release (RebindPolicy_ptr obj);
+
+ static RebindPolicy_ptr _narrow (
+ ::CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static RebindPolicy_ptr _unchecked_narrow (
+ ::CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static RebindPolicy_ptr _nil (void)
+ {
+ return static_cast<RebindPolicy_ptr> (0);
+ }
+
+
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual ::Messaging::RebindMode rebind_mode (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ ::CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual ::CORBA::Policy_ptr copy (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ ::CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void destroy (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ ::CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:210
+
+ virtual ::CORBA::Boolean _is_a (
+ const char *type_id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ virtual const char* _interface_repository_id (void) const;
+ virtual ::CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+
+ protected:
+ // Abstract or local interface only.
+ RebindPolicy (void);
+
+ virtual ~RebindPolicy (void);
+
+ private:
+ // Private and unimplemented for concrete interfaces.
+ RebindPolicy (const RebindPolicy &);
+
+ void operator= (const RebindPolicy &);
+ };
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_constant/constant_ch.cpp:52
+
+ const CORBA::PolicyType REQUEST_PRIORITY_POLICY_TYPE = 25U;
+
+ // TAO_IDL - Generated from
+ // be\be_type.cpp:258
+
+ struct PriorityRange;
+
+ typedef
+ TAO_Fixed_Var_T<
+ PriorityRange
+ >
+ PriorityRange_var;
+
+ typedef
+ PriorityRange &
+ PriorityRange_out;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_structure/structure_ch.cpp:57
+
+ struct TAO_Messaging_Export PriorityRange
+ {
+ typedef PriorityRange_var _var_type;
+
+ static void _tao_any_destructor (void *);
+ Messaging::Priority min;
+ Messaging::Priority max;
+ };
+
+ // TAO_IDL - Generated from
+ // be\be_interface.cpp:646
+
+#if !defined (_MESSAGING_REQUESTPRIORITYPOLICY__VAR_OUT_CH_)
+#define _MESSAGING_REQUESTPRIORITYPOLICY__VAR_OUT_CH_
+
+ class RequestPriorityPolicy;
+ typedef RequestPriorityPolicy *RequestPriorityPolicy_ptr;
+
+ typedef
+ TAO_Objref_Var_T<
+ RequestPriorityPolicy
+ >
+ RequestPriorityPolicy_var;
+
+ typedef
+ TAO_Objref_Out_T<
+ RequestPriorityPolicy
+ >
+ RequestPriorityPolicy_out;
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:54
+
+#if !defined (_MESSAGING_REQUESTPRIORITYPOLICY_CH_)
+#define _MESSAGING_REQUESTPRIORITYPOLICY_CH_
+
+ class TAO_Messaging_Export RequestPriorityPolicy
+ : public virtual ::CORBA::Policy
+ {
+ public:
+ typedef RequestPriorityPolicy_ptr _ptr_type;
+ typedef RequestPriorityPolicy_var _var_type;
+
+ // The static operations.
+ static RequestPriorityPolicy_ptr _duplicate (RequestPriorityPolicy_ptr obj);
+
+ static void _tao_release (RequestPriorityPolicy_ptr obj);
+
+ static RequestPriorityPolicy_ptr _narrow (
+ ::CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static RequestPriorityPolicy_ptr _unchecked_narrow (
+ ::CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static RequestPriorityPolicy_ptr _nil (void)
+ {
+ return static_cast<RequestPriorityPolicy_ptr> (0);
+ }
+
+
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual ::Messaging::PriorityRange priority_range (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ ::CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual ::CORBA::Policy_ptr copy (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ ::CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void destroy (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ ::CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:210
+
+ virtual ::CORBA::Boolean _is_a (
+ const char *type_id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ virtual const char* _interface_repository_id (void) const;
+ virtual ::CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+
+ protected:
+ // Abstract or local interface only.
+ RequestPriorityPolicy (void);
+
+ virtual ~RequestPriorityPolicy (void);
+
+ private:
+ // Private and unimplemented for concrete interfaces.
+ RequestPriorityPolicy (const RequestPriorityPolicy &);
+
+ void operator= (const RequestPriorityPolicy &);
+ };
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_constant/constant_ch.cpp:52
+
+ const CORBA::PolicyType REPLY_PRIORITY_POLICY_TYPE = 26U;
+
+ // TAO_IDL - Generated from
+ // be\be_interface.cpp:646
+
+#if !defined (_MESSAGING_REPLYPRIORITYPOLICY__VAR_OUT_CH_)
+#define _MESSAGING_REPLYPRIORITYPOLICY__VAR_OUT_CH_
+
+ class ReplyPriorityPolicy;
+ typedef ReplyPriorityPolicy *ReplyPriorityPolicy_ptr;
+
+ typedef
+ TAO_Objref_Var_T<
+ ReplyPriorityPolicy
+ >
+ ReplyPriorityPolicy_var;
+
+ typedef
+ TAO_Objref_Out_T<
+ ReplyPriorityPolicy
+ >
+ ReplyPriorityPolicy_out;
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:54
+
+#if !defined (_MESSAGING_REPLYPRIORITYPOLICY_CH_)
+#define _MESSAGING_REPLYPRIORITYPOLICY_CH_
+
+ class TAO_Messaging_Export ReplyPriorityPolicy
+ : public virtual ::CORBA::Policy
+ {
+ public:
+ typedef ReplyPriorityPolicy_ptr _ptr_type;
+ typedef ReplyPriorityPolicy_var _var_type;
+
+ // The static operations.
+ static ReplyPriorityPolicy_ptr _duplicate (ReplyPriorityPolicy_ptr obj);
+
+ static void _tao_release (ReplyPriorityPolicy_ptr obj);
+
+ static ReplyPriorityPolicy_ptr _narrow (
+ ::CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static ReplyPriorityPolicy_ptr _unchecked_narrow (
+ ::CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static ReplyPriorityPolicy_ptr _nil (void)
+ {
+ return static_cast<ReplyPriorityPolicy_ptr> (0);
+ }
+
+
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual ::Messaging::PriorityRange priority_range (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ ::CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual ::CORBA::Policy_ptr copy (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ ::CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void destroy (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ ::CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:210
+
+ virtual ::CORBA::Boolean _is_a (
+ const char *type_id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ virtual const char* _interface_repository_id (void) const;
+ virtual ::CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+
+ protected:
+ // Abstract or local interface only.
+ ReplyPriorityPolicy (void);
+
+ virtual ~ReplyPriorityPolicy (void);
+
+ private:
+ // Private and unimplemented for concrete interfaces.
+ ReplyPriorityPolicy (const ReplyPriorityPolicy &);
+
+ void operator= (const ReplyPriorityPolicy &);
+ };
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_constant/constant_ch.cpp:52
+
+ const CORBA::PolicyType REQUEST_START_TIME_POLICY_TYPE = 27U;
+
+ // TAO_IDL - Generated from
+ // be\be_interface.cpp:646
+
+#if !defined (_MESSAGING_REQUESTSTARTTIMEPOLICY__VAR_OUT_CH_)
+#define _MESSAGING_REQUESTSTARTTIMEPOLICY__VAR_OUT_CH_
+
+ class RequestStartTimePolicy;
+ typedef RequestStartTimePolicy *RequestStartTimePolicy_ptr;
+
+ typedef
+ TAO_Objref_Var_T<
+ RequestStartTimePolicy
+ >
+ RequestStartTimePolicy_var;
+
+ typedef
+ TAO_Objref_Out_T<
+ RequestStartTimePolicy
+ >
+ RequestStartTimePolicy_out;
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:54
+
+#if !defined (_MESSAGING_REQUESTSTARTTIMEPOLICY_CH_)
+#define _MESSAGING_REQUESTSTARTTIMEPOLICY_CH_
+
+ class TAO_Messaging_Export RequestStartTimePolicy
+ : public virtual ::CORBA::Policy
+ {
+ public:
+ typedef RequestStartTimePolicy_ptr _ptr_type;
+ typedef RequestStartTimePolicy_var _var_type;
+
+ // The static operations.
+ static RequestStartTimePolicy_ptr _duplicate (RequestStartTimePolicy_ptr obj);
+
+ static void _tao_release (RequestStartTimePolicy_ptr obj);
+
+ static RequestStartTimePolicy_ptr _narrow (
+ ::CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static RequestStartTimePolicy_ptr _unchecked_narrow (
+ ::CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static RequestStartTimePolicy_ptr _nil (void)
+ {
+ return static_cast<RequestStartTimePolicy_ptr> (0);
+ }
+
+
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual ::TimeBase::UtcT start_time (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ ::CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual ::CORBA::Policy_ptr copy (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ ::CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void destroy (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ ::CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:210
+
+ virtual ::CORBA::Boolean _is_a (
+ const char *type_id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ virtual const char* _interface_repository_id (void) const;
+ virtual ::CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+
+ protected:
+ // Abstract or local interface only.
+ RequestStartTimePolicy (void);
+
+ virtual ~RequestStartTimePolicy (void);
+
+ private:
+ // Private and unimplemented for concrete interfaces.
+ RequestStartTimePolicy (const RequestStartTimePolicy &);
+
+ void operator= (const RequestStartTimePolicy &);
+ };
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_constant/constant_ch.cpp:52
+
+ const CORBA::PolicyType REQUEST_END_TIME_POLICY_TYPE = 28U;
+
+ // TAO_IDL - Generated from
+ // be\be_interface.cpp:646
+
+#if !defined (_MESSAGING_REQUESTENDTIMEPOLICY__VAR_OUT_CH_)
+#define _MESSAGING_REQUESTENDTIMEPOLICY__VAR_OUT_CH_
+
+ class RequestEndTimePolicy;
+ typedef RequestEndTimePolicy *RequestEndTimePolicy_ptr;
+
+ typedef
+ TAO_Objref_Var_T<
+ RequestEndTimePolicy
+ >
+ RequestEndTimePolicy_var;
+
+ typedef
+ TAO_Objref_Out_T<
+ RequestEndTimePolicy
+ >
+ RequestEndTimePolicy_out;
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:54
+
+#if !defined (_MESSAGING_REQUESTENDTIMEPOLICY_CH_)
+#define _MESSAGING_REQUESTENDTIMEPOLICY_CH_
+
+ class TAO_Messaging_Export RequestEndTimePolicy
+ : public virtual ::CORBA::Policy
+ {
+ public:
+ typedef RequestEndTimePolicy_ptr _ptr_type;
+ typedef RequestEndTimePolicy_var _var_type;
+
+ // The static operations.
+ static RequestEndTimePolicy_ptr _duplicate (RequestEndTimePolicy_ptr obj);
+
+ static void _tao_release (RequestEndTimePolicy_ptr obj);
+
+ static RequestEndTimePolicy_ptr _narrow (
+ ::CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static RequestEndTimePolicy_ptr _unchecked_narrow (
+ ::CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static RequestEndTimePolicy_ptr _nil (void)
+ {
+ return static_cast<RequestEndTimePolicy_ptr> (0);
+ }
+
+
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual ::TimeBase::UtcT end_time (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ ::CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual ::CORBA::Policy_ptr copy (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ ::CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void destroy (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ ::CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:210
+
+ virtual ::CORBA::Boolean _is_a (
+ const char *type_id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ virtual const char* _interface_repository_id (void) const;
+ virtual ::CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+
+ protected:
+ // Abstract or local interface only.
+ RequestEndTimePolicy (void);
+
+ virtual ~RequestEndTimePolicy (void);
+
+ private:
+ // Private and unimplemented for concrete interfaces.
+ RequestEndTimePolicy (const RequestEndTimePolicy &);
+
+ void operator= (const RequestEndTimePolicy &);
+ };
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_constant/constant_ch.cpp:52
+
+ const CORBA::PolicyType REPLY_START_TIME_POLICY_TYPE = 29U;
+
+ // TAO_IDL - Generated from
+ // be\be_interface.cpp:646
+
+#if !defined (_MESSAGING_REPLYSTARTTIMEPOLICY__VAR_OUT_CH_)
+#define _MESSAGING_REPLYSTARTTIMEPOLICY__VAR_OUT_CH_
+
+ class ReplyStartTimePolicy;
+ typedef ReplyStartTimePolicy *ReplyStartTimePolicy_ptr;
+
+ typedef
+ TAO_Objref_Var_T<
+ ReplyStartTimePolicy
+ >
+ ReplyStartTimePolicy_var;
+
+ typedef
+ TAO_Objref_Out_T<
+ ReplyStartTimePolicy
+ >
+ ReplyStartTimePolicy_out;
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:54
+
+#if !defined (_MESSAGING_REPLYSTARTTIMEPOLICY_CH_)
+#define _MESSAGING_REPLYSTARTTIMEPOLICY_CH_
+
+ class TAO_Messaging_Export ReplyStartTimePolicy
+ : public virtual ::CORBA::Policy
+ {
+ public:
+ typedef ReplyStartTimePolicy_ptr _ptr_type;
+ typedef ReplyStartTimePolicy_var _var_type;
+
+ // The static operations.
+ static ReplyStartTimePolicy_ptr _duplicate (ReplyStartTimePolicy_ptr obj);
+
+ static void _tao_release (ReplyStartTimePolicy_ptr obj);
+
+ static ReplyStartTimePolicy_ptr _narrow (
+ ::CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static ReplyStartTimePolicy_ptr _unchecked_narrow (
+ ::CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static ReplyStartTimePolicy_ptr _nil (void)
+ {
+ return static_cast<ReplyStartTimePolicy_ptr> (0);
+ }
+
+
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual ::TimeBase::UtcT start_time (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ ::CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual ::CORBA::Policy_ptr copy (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ ::CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void destroy (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ ::CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:210
+
+ virtual ::CORBA::Boolean _is_a (
+ const char *type_id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ virtual const char* _interface_repository_id (void) const;
+ virtual ::CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+
+ protected:
+ // Abstract or local interface only.
+ ReplyStartTimePolicy (void);
+
+ virtual ~ReplyStartTimePolicy (void);
+
+ private:
+ // Private and unimplemented for concrete interfaces.
+ ReplyStartTimePolicy (const ReplyStartTimePolicy &);
+
+ void operator= (const ReplyStartTimePolicy &);
+ };
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_constant/constant_ch.cpp:52
+
+ const CORBA::PolicyType REPLY_END_TIME_POLICY_TYPE = 30U;
+
+ // TAO_IDL - Generated from
+ // be\be_interface.cpp:646
+
+#if !defined (_MESSAGING_REPLYENDTIMEPOLICY__VAR_OUT_CH_)
+#define _MESSAGING_REPLYENDTIMEPOLICY__VAR_OUT_CH_
+
+ class ReplyEndTimePolicy;
+ typedef ReplyEndTimePolicy *ReplyEndTimePolicy_ptr;
+
+ typedef
+ TAO_Objref_Var_T<
+ ReplyEndTimePolicy
+ >
+ ReplyEndTimePolicy_var;
+
+ typedef
+ TAO_Objref_Out_T<
+ ReplyEndTimePolicy
+ >
+ ReplyEndTimePolicy_out;
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:54
+
+#if !defined (_MESSAGING_REPLYENDTIMEPOLICY_CH_)
+#define _MESSAGING_REPLYENDTIMEPOLICY_CH_
+
+ class TAO_Messaging_Export ReplyEndTimePolicy
+ : public virtual ::CORBA::Policy
+ {
+ public:
+ typedef ReplyEndTimePolicy_ptr _ptr_type;
+ typedef ReplyEndTimePolicy_var _var_type;
+
+ // The static operations.
+ static ReplyEndTimePolicy_ptr _duplicate (ReplyEndTimePolicy_ptr obj);
+
+ static void _tao_release (ReplyEndTimePolicy_ptr obj);
+
+ static ReplyEndTimePolicy_ptr _narrow (
+ ::CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static ReplyEndTimePolicy_ptr _unchecked_narrow (
+ ::CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static ReplyEndTimePolicy_ptr _nil (void)
+ {
+ return static_cast<ReplyEndTimePolicy_ptr> (0);
+ }
+
+
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual ::TimeBase::UtcT end_time (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ ::CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual ::CORBA::Policy_ptr copy (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ ::CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void destroy (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ ::CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:210
+
+ virtual ::CORBA::Boolean _is_a (
+ const char *type_id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ virtual const char* _interface_repository_id (void) const;
+ virtual ::CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+
+ protected:
+ // Abstract or local interface only.
+ ReplyEndTimePolicy (void);
+
+ virtual ~ReplyEndTimePolicy (void);
+
+ private:
+ // Private and unimplemented for concrete interfaces.
+ ReplyEndTimePolicy (const ReplyEndTimePolicy &);
+
+ void operator= (const ReplyEndTimePolicy &);
+ };
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_constant/constant_ch.cpp:52
+
+ const CORBA::PolicyType RELATIVE_REQ_TIMEOUT_POLICY_TYPE = 31U;
+
+ // TAO_IDL - Generated from
+ // be\be_interface.cpp:646
+
+#if !defined (_MESSAGING_RELATIVEREQUESTTIMEOUTPOLICY__VAR_OUT_CH_)
+#define _MESSAGING_RELATIVEREQUESTTIMEOUTPOLICY__VAR_OUT_CH_
+
+ class RelativeRequestTimeoutPolicy;
+ typedef RelativeRequestTimeoutPolicy *RelativeRequestTimeoutPolicy_ptr;
+
+ typedef
+ TAO_Objref_Var_T<
+ RelativeRequestTimeoutPolicy
+ >
+ RelativeRequestTimeoutPolicy_var;
+
+ typedef
+ TAO_Objref_Out_T<
+ RelativeRequestTimeoutPolicy
+ >
+ RelativeRequestTimeoutPolicy_out;
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:54
+
+#if !defined (_MESSAGING_RELATIVEREQUESTTIMEOUTPOLICY_CH_)
+#define _MESSAGING_RELATIVEREQUESTTIMEOUTPOLICY_CH_
+
+ class TAO_Messaging_Export RelativeRequestTimeoutPolicy
+ : public virtual ::CORBA::Policy
+ {
+ public:
+ typedef RelativeRequestTimeoutPolicy_ptr _ptr_type;
+ typedef RelativeRequestTimeoutPolicy_var _var_type;
+
+ // The static operations.
+ static RelativeRequestTimeoutPolicy_ptr _duplicate (RelativeRequestTimeoutPolicy_ptr obj);
+
+ static void _tao_release (RelativeRequestTimeoutPolicy_ptr obj);
+
+ static RelativeRequestTimeoutPolicy_ptr _narrow (
+ ::CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static RelativeRequestTimeoutPolicy_ptr _unchecked_narrow (
+ ::CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static RelativeRequestTimeoutPolicy_ptr _nil (void)
+ {
+ return static_cast<RelativeRequestTimeoutPolicy_ptr> (0);
+ }
+
+
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual ::TimeBase::TimeT relative_expiry (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ ::CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual ::CORBA::Policy_ptr copy (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ ::CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void destroy (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ ::CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:210
+
+ virtual ::CORBA::Boolean _is_a (
+ const char *type_id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ virtual const char* _interface_repository_id (void) const;
+ virtual ::CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+
+ protected:
+ // Abstract or local interface only.
+ RelativeRequestTimeoutPolicy (void);
+
+ virtual ~RelativeRequestTimeoutPolicy (void);
+
+ private:
+ // Private and unimplemented for concrete interfaces.
+ RelativeRequestTimeoutPolicy (const RelativeRequestTimeoutPolicy &);
+
+ void operator= (const RelativeRequestTimeoutPolicy &);
+ };
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_constant/constant_ch.cpp:52
+
+ const CORBA::PolicyType ROUTING_POLICY_TYPE = 33U;
+
+ // TAO_IDL - Generated from
+ // be\be_type.cpp:258
+
+ struct RoutingTypeRange;
+
+ typedef
+ TAO_Fixed_Var_T<
+ RoutingTypeRange
+ >
+ RoutingTypeRange_var;
+
+ typedef
+ RoutingTypeRange &
+ RoutingTypeRange_out;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_structure/structure_ch.cpp:57
+
+ struct TAO_Messaging_Export RoutingTypeRange
+ {
+ typedef RoutingTypeRange_var _var_type;
+
+ static void _tao_any_destructor (void *);
+ Messaging::RoutingType min;
+ Messaging::RoutingType max;
+ };
+
+ // TAO_IDL - Generated from
+ // be\be_interface.cpp:646
+
+#if !defined (_MESSAGING_ROUTINGPOLICY__VAR_OUT_CH_)
+#define _MESSAGING_ROUTINGPOLICY__VAR_OUT_CH_
+
+ class RoutingPolicy;
+ typedef RoutingPolicy *RoutingPolicy_ptr;
+
+ typedef
+ TAO_Objref_Var_T<
+ RoutingPolicy
+ >
+ RoutingPolicy_var;
+
+ typedef
+ TAO_Objref_Out_T<
+ RoutingPolicy
+ >
+ RoutingPolicy_out;
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:54
+
+#if !defined (_MESSAGING_ROUTINGPOLICY_CH_)
+#define _MESSAGING_ROUTINGPOLICY_CH_
+
+ class TAO_Messaging_Export RoutingPolicy
+ : public virtual ::CORBA::Policy
+ {
+ public:
+ typedef RoutingPolicy_ptr _ptr_type;
+ typedef RoutingPolicy_var _var_type;
+
+ // The static operations.
+ static RoutingPolicy_ptr _duplicate (RoutingPolicy_ptr obj);
+
+ static void _tao_release (RoutingPolicy_ptr obj);
+
+ static RoutingPolicy_ptr _narrow (
+ ::CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static RoutingPolicy_ptr _unchecked_narrow (
+ ::CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static RoutingPolicy_ptr _nil (void)
+ {
+ return static_cast<RoutingPolicy_ptr> (0);
+ }
+
+
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual ::Messaging::RoutingTypeRange routing_range (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ ::CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual ::CORBA::Policy_ptr copy (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ ::CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void destroy (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ ::CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:210
+
+ virtual ::CORBA::Boolean _is_a (
+ const char *type_id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ virtual const char* _interface_repository_id (void) const;
+ virtual ::CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+
+ protected:
+ // Abstract or local interface only.
+ RoutingPolicy (void);
+
+ virtual ~RoutingPolicy (void);
+
+ private:
+ // Private and unimplemented for concrete interfaces.
+ RoutingPolicy (const RoutingPolicy &);
+
+ void operator= (const RoutingPolicy &);
+ };
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_constant/constant_ch.cpp:52
+
+ const CORBA::PolicyType MAX_HOPS_POLICY_TYPE = 34U;
+
+ // TAO_IDL - Generated from
+ // be\be_interface.cpp:646
+
+#if !defined (_MESSAGING_MAXHOPSPOLICY__VAR_OUT_CH_)
+#define _MESSAGING_MAXHOPSPOLICY__VAR_OUT_CH_
+
+ class MaxHopsPolicy;
+ typedef MaxHopsPolicy *MaxHopsPolicy_ptr;
+
+ typedef
+ TAO_Objref_Var_T<
+ MaxHopsPolicy
+ >
+ MaxHopsPolicy_var;
+
+ typedef
+ TAO_Objref_Out_T<
+ MaxHopsPolicy
+ >
+ MaxHopsPolicy_out;
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:54
+
+#if !defined (_MESSAGING_MAXHOPSPOLICY_CH_)
+#define _MESSAGING_MAXHOPSPOLICY_CH_
+
+ class TAO_Messaging_Export MaxHopsPolicy
+ : public virtual ::CORBA::Policy
+ {
+ public:
+ typedef MaxHopsPolicy_ptr _ptr_type;
+ typedef MaxHopsPolicy_var _var_type;
+
+ // The static operations.
+ static MaxHopsPolicy_ptr _duplicate (MaxHopsPolicy_ptr obj);
+
+ static void _tao_release (MaxHopsPolicy_ptr obj);
+
+ static MaxHopsPolicy_ptr _narrow (
+ ::CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static MaxHopsPolicy_ptr _unchecked_narrow (
+ ::CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static MaxHopsPolicy_ptr _nil (void)
+ {
+ return static_cast<MaxHopsPolicy_ptr> (0);
+ }
+
+
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual ::CORBA::UShort max_hops (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ ::CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual ::CORBA::Policy_ptr copy (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ ::CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void destroy (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ ::CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:210
+
+ virtual ::CORBA::Boolean _is_a (
+ const char *type_id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ virtual const char* _interface_repository_id (void) const;
+ virtual ::CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+
+ protected:
+ // Abstract or local interface only.
+ MaxHopsPolicy (void);
+
+ virtual ~MaxHopsPolicy (void);
+
+ private:
+ // Private and unimplemented for concrete interfaces.
+ MaxHopsPolicy (const MaxHopsPolicy &);
+
+ void operator= (const MaxHopsPolicy &);
+ };
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_constant/constant_ch.cpp:52
+
+ const CORBA::PolicyType QUEUE_ORDER_POLICY_TYPE = 35U;
+
+ // TAO_IDL - Generated from
+ // be\be_interface.cpp:646
+
+#if !defined (_MESSAGING_QUEUEORDERPOLICY__VAR_OUT_CH_)
+#define _MESSAGING_QUEUEORDERPOLICY__VAR_OUT_CH_
+
+ class QueueOrderPolicy;
+ typedef QueueOrderPolicy *QueueOrderPolicy_ptr;
+
+ typedef
+ TAO_Objref_Var_T<
+ QueueOrderPolicy
+ >
+ QueueOrderPolicy_var;
+
+ typedef
+ TAO_Objref_Out_T<
+ QueueOrderPolicy
+ >
+ QueueOrderPolicy_out;
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:54
+
+#if !defined (_MESSAGING_QUEUEORDERPOLICY_CH_)
+#define _MESSAGING_QUEUEORDERPOLICY_CH_
+
+ class TAO_Messaging_Export QueueOrderPolicy
+ : public virtual ::CORBA::Policy
+ {
+ public:
+ typedef QueueOrderPolicy_ptr _ptr_type;
+ typedef QueueOrderPolicy_var _var_type;
+
+ // The static operations.
+ static QueueOrderPolicy_ptr _duplicate (QueueOrderPolicy_ptr obj);
+
+ static void _tao_release (QueueOrderPolicy_ptr obj);
+
+ static QueueOrderPolicy_ptr _narrow (
+ ::CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static QueueOrderPolicy_ptr _unchecked_narrow (
+ ::CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static QueueOrderPolicy_ptr _nil (void)
+ {
+ return static_cast<QueueOrderPolicy_ptr> (0);
+ }
+
+
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual ::Messaging::Ordering allowed_orders (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ ::CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual ::CORBA::Policy_ptr copy (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ ::CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void destroy (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ ::CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:210
+
+ virtual ::CORBA::Boolean _is_a (
+ const char *type_id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ virtual const char* _interface_repository_id (void) const;
+ virtual ::CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+
+ protected:
+ // Abstract or local interface only.
+ QueueOrderPolicy (void);
+
+ virtual ~QueueOrderPolicy (void);
+
+ private:
+ // Private and unimplemented for concrete interfaces.
+ QueueOrderPolicy (const QueueOrderPolicy &);
+
+ void operator= (const QueueOrderPolicy &);
+ };
+
+#endif /* end #if !defined */
+
+// TAO_IDL - Generated from
+// be\be_visitor_module/module_ch.cpp:78
+
+} // module Messaging
+
+// TAO_IDL - Generated from
+// be\be_visitor_traits.cpp:61
+
+// Traits specializations.
+namespace TAO
+{
+
+#if !defined (_MESSAGING_REBINDPOLICY__TRAITS_)
+#define _MESSAGING_REBINDPOLICY__TRAITS_
+
+ template<>
+ struct TAO_Messaging_Export Objref_Traits< ::Messaging::RebindPolicy>
+ {
+ static ::Messaging::RebindPolicy_ptr duplicate (
+ ::Messaging::RebindPolicy_ptr
+ );
+ static void release (
+ ::Messaging::RebindPolicy_ptr
+ );
+ static ::Messaging::RebindPolicy_ptr nil (void);
+ static ::CORBA::Boolean marshal (
+ ::Messaging::RebindPolicy_ptr p,
+ TAO_OutputCDR & cdr
+ );
+ };
+
+#endif /* end #if !defined */
+
+#if !defined (_MESSAGING_REQUESTPRIORITYPOLICY__TRAITS_)
+#define _MESSAGING_REQUESTPRIORITYPOLICY__TRAITS_
+
+ template<>
+ struct TAO_Messaging_Export Objref_Traits< ::Messaging::RequestPriorityPolicy>
+ {
+ static ::Messaging::RequestPriorityPolicy_ptr duplicate (
+ ::Messaging::RequestPriorityPolicy_ptr
+ );
+ static void release (
+ ::Messaging::RequestPriorityPolicy_ptr
+ );
+ static ::Messaging::RequestPriorityPolicy_ptr nil (void);
+ static ::CORBA::Boolean marshal (
+ ::Messaging::RequestPriorityPolicy_ptr p,
+ TAO_OutputCDR & cdr
+ );
+ };
+
+#endif /* end #if !defined */
+
+#if !defined (_MESSAGING_REPLYPRIORITYPOLICY__TRAITS_)
+#define _MESSAGING_REPLYPRIORITYPOLICY__TRAITS_
+
+ template<>
+ struct TAO_Messaging_Export Objref_Traits< ::Messaging::ReplyPriorityPolicy>
+ {
+ static ::Messaging::ReplyPriorityPolicy_ptr duplicate (
+ ::Messaging::ReplyPriorityPolicy_ptr
+ );
+ static void release (
+ ::Messaging::ReplyPriorityPolicy_ptr
+ );
+ static ::Messaging::ReplyPriorityPolicy_ptr nil (void);
+ static ::CORBA::Boolean marshal (
+ ::Messaging::ReplyPriorityPolicy_ptr p,
+ TAO_OutputCDR & cdr
+ );
+ };
+
+#endif /* end #if !defined */
+
+#if !defined (_MESSAGING_REQUESTSTARTTIMEPOLICY__TRAITS_)
+#define _MESSAGING_REQUESTSTARTTIMEPOLICY__TRAITS_
+
+ template<>
+ struct TAO_Messaging_Export Objref_Traits< ::Messaging::RequestStartTimePolicy>
+ {
+ static ::Messaging::RequestStartTimePolicy_ptr duplicate (
+ ::Messaging::RequestStartTimePolicy_ptr
+ );
+ static void release (
+ ::Messaging::RequestStartTimePolicy_ptr
+ );
+ static ::Messaging::RequestStartTimePolicy_ptr nil (void);
+ static ::CORBA::Boolean marshal (
+ ::Messaging::RequestStartTimePolicy_ptr p,
+ TAO_OutputCDR & cdr
+ );
+ };
+
+#endif /* end #if !defined */
+
+#if !defined (_MESSAGING_REQUESTENDTIMEPOLICY__TRAITS_)
+#define _MESSAGING_REQUESTENDTIMEPOLICY__TRAITS_
+
+ template<>
+ struct TAO_Messaging_Export Objref_Traits< ::Messaging::RequestEndTimePolicy>
+ {
+ static ::Messaging::RequestEndTimePolicy_ptr duplicate (
+ ::Messaging::RequestEndTimePolicy_ptr
+ );
+ static void release (
+ ::Messaging::RequestEndTimePolicy_ptr
+ );
+ static ::Messaging::RequestEndTimePolicy_ptr nil (void);
+ static ::CORBA::Boolean marshal (
+ ::Messaging::RequestEndTimePolicy_ptr p,
+ TAO_OutputCDR & cdr
+ );
+ };
+
+#endif /* end #if !defined */
+
+#if !defined (_MESSAGING_REPLYSTARTTIMEPOLICY__TRAITS_)
+#define _MESSAGING_REPLYSTARTTIMEPOLICY__TRAITS_
+
+ template<>
+ struct TAO_Messaging_Export Objref_Traits< ::Messaging::ReplyStartTimePolicy>
+ {
+ static ::Messaging::ReplyStartTimePolicy_ptr duplicate (
+ ::Messaging::ReplyStartTimePolicy_ptr
+ );
+ static void release (
+ ::Messaging::ReplyStartTimePolicy_ptr
+ );
+ static ::Messaging::ReplyStartTimePolicy_ptr nil (void);
+ static ::CORBA::Boolean marshal (
+ ::Messaging::ReplyStartTimePolicy_ptr p,
+ TAO_OutputCDR & cdr
+ );
+ };
+
+#endif /* end #if !defined */
+
+#if !defined (_MESSAGING_REPLYENDTIMEPOLICY__TRAITS_)
+#define _MESSAGING_REPLYENDTIMEPOLICY__TRAITS_
+
+ template<>
+ struct TAO_Messaging_Export Objref_Traits< ::Messaging::ReplyEndTimePolicy>
+ {
+ static ::Messaging::ReplyEndTimePolicy_ptr duplicate (
+ ::Messaging::ReplyEndTimePolicy_ptr
+ );
+ static void release (
+ ::Messaging::ReplyEndTimePolicy_ptr
+ );
+ static ::Messaging::ReplyEndTimePolicy_ptr nil (void);
+ static ::CORBA::Boolean marshal (
+ ::Messaging::ReplyEndTimePolicy_ptr p,
+ TAO_OutputCDR & cdr
+ );
+ };
+
+#endif /* end #if !defined */
+
+#if !defined (_MESSAGING_RELATIVEREQUESTTIMEOUTPOLICY__TRAITS_)
+#define _MESSAGING_RELATIVEREQUESTTIMEOUTPOLICY__TRAITS_
+
+ template<>
+ struct TAO_Messaging_Export Objref_Traits< ::Messaging::RelativeRequestTimeoutPolicy>
+ {
+ static ::Messaging::RelativeRequestTimeoutPolicy_ptr duplicate (
+ ::Messaging::RelativeRequestTimeoutPolicy_ptr
+ );
+ static void release (
+ ::Messaging::RelativeRequestTimeoutPolicy_ptr
+ );
+ static ::Messaging::RelativeRequestTimeoutPolicy_ptr nil (void);
+ static ::CORBA::Boolean marshal (
+ ::Messaging::RelativeRequestTimeoutPolicy_ptr p,
+ TAO_OutputCDR & cdr
+ );
+ };
+
+#endif /* end #if !defined */
+
+#if !defined (_MESSAGING_ROUTINGPOLICY__TRAITS_)
+#define _MESSAGING_ROUTINGPOLICY__TRAITS_
+
+ template<>
+ struct TAO_Messaging_Export Objref_Traits< ::Messaging::RoutingPolicy>
+ {
+ static ::Messaging::RoutingPolicy_ptr duplicate (
+ ::Messaging::RoutingPolicy_ptr
+ );
+ static void release (
+ ::Messaging::RoutingPolicy_ptr
+ );
+ static ::Messaging::RoutingPolicy_ptr nil (void);
+ static ::CORBA::Boolean marshal (
+ ::Messaging::RoutingPolicy_ptr p,
+ TAO_OutputCDR & cdr
+ );
+ };
+
+#endif /* end #if !defined */
+
+#if !defined (_MESSAGING_MAXHOPSPOLICY__TRAITS_)
+#define _MESSAGING_MAXHOPSPOLICY__TRAITS_
+
+ template<>
+ struct TAO_Messaging_Export Objref_Traits< ::Messaging::MaxHopsPolicy>
+ {
+ static ::Messaging::MaxHopsPolicy_ptr duplicate (
+ ::Messaging::MaxHopsPolicy_ptr
+ );
+ static void release (
+ ::Messaging::MaxHopsPolicy_ptr
+ );
+ static ::Messaging::MaxHopsPolicy_ptr nil (void);
+ static ::CORBA::Boolean marshal (
+ ::Messaging::MaxHopsPolicy_ptr p,
+ TAO_OutputCDR & cdr
+ );
+ };
+
+#endif /* end #if !defined */
+
+#if !defined (_MESSAGING_QUEUEORDERPOLICY__TRAITS_)
+#define _MESSAGING_QUEUEORDERPOLICY__TRAITS_
+
+ template<>
+ struct TAO_Messaging_Export Objref_Traits< ::Messaging::QueueOrderPolicy>
+ {
+ static ::Messaging::QueueOrderPolicy_ptr duplicate (
+ ::Messaging::QueueOrderPolicy_ptr
+ );
+ static void release (
+ ::Messaging::QueueOrderPolicy_ptr
+ );
+ static ::Messaging::QueueOrderPolicy_ptr nil (void);
+ static ::CORBA::Boolean marshal (
+ ::Messaging::QueueOrderPolicy_ptr p,
+ TAO_OutputCDR & cdr
+ );
+ };
+
+#endif /* end #if !defined */
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_structure/cdr_op_ch.cpp:54
+
+TAO_Messaging_Export ::CORBA::Boolean operator<< (TAO_OutputCDR &, const Messaging::PriorityRange &);
+TAO_Messaging_Export ::CORBA::Boolean operator>> (TAO_InputCDR &, Messaging::PriorityRange &);
+
+// TAO_IDL - Generated from
+// be\be_visitor_structure/cdr_op_ch.cpp:54
+
+TAO_Messaging_Export ::CORBA::Boolean operator<< (TAO_OutputCDR &, const Messaging::RoutingTypeRange &);
+TAO_Messaging_Export ::CORBA::Boolean operator>> (TAO_InputCDR &, Messaging::RoutingTypeRange &);
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:1040
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* ifndef */
+
+
diff --git a/TAO/tao/Messaging/Messaging_ORBInitializer.cpp b/TAO/tao/Messaging/Messaging_ORBInitializer.cpp
new file mode 100644
index 00000000000..82a57e50c9e
--- /dev/null
+++ b/TAO/tao/Messaging/Messaging_ORBInitializer.cpp
@@ -0,0 +1,192 @@
+// -*- C++ -*-
+
+#include "tao/Messaging/Messaging_ORBInitializer.h"
+
+#include "tao/Messaging/Messaging_Policy_i.h"
+#include "tao/Messaging/Connection_Timeout_Policy_i.h"
+#include "tao/Messaging/Messaging_PolicyFactory.h"
+#include "tao/Messaging/ExceptionHolder_i.h"
+#include "tao/ORB_Core.h"
+#include "tao/PI/ORBInitInfo.h"
+#include "tao/Valuetype/ValueFactory.h"
+
+ACE_RCSID (Messaging,
+ Messaging_ORBInitializer,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+void
+TAO_Messaging_ORBInitializer::pre_init (
+ PortableInterceptor::ORBInitInfo_ptr
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+#if (TAO_HAS_RELATIVE_ROUNDTRIP_TIMEOUT_POLICY == 1)
+ TAO_ORB_Core::set_timeout_hook
+ (TAO_RelativeRoundtripTimeoutPolicy::hook);
+#endif /* TAO_HAS_RELATIVE_ROUNDTRIP_TIMEOUT_POLICY == 1 */
+
+#if (TAO_HAS_SYNC_SCOPE_POLICY == 1)
+ TAO_ORB_Core::set_sync_scope_hook (TAO_Sync_Scope_Policy::hook);
+#endif /* TAO_HAS_SYNC_SCOPE_POLICY == 1 */
+
+#if (TAO_HAS_CONNECTION_TIMEOUT_POLICY == 1)
+ TAO_ORB_Core::connection_timeout_hook
+ (TAO_ConnectionTimeoutPolicy::hook);
+#endif /* TAO_HAS_CONNECTION_TIMEOUT_POLICY == 1 */
+
+}
+
+void
+TAO_Messaging_ORBInitializer::post_init (
+ PortableInterceptor::ORBInitInfo_ptr info
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->register_policy_factories (info
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->register_value_factory (info
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+void
+TAO_Messaging_ORBInitializer::register_value_factory (
+ PortableInterceptor::ORBInitInfo_ptr info
+ ACE_ENV_ARG_DECL)
+{
+ // Narrow to a TAO_ORBInitInfo object to get access to the
+ // orb_core() TAO extension.
+ TAO_ORBInitInfo_var tao_info =
+ TAO_ORBInitInfo::_narrow (info
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (CORBA::is_nil (tao_info.in ()))
+ {
+ if (TAO_debug_level > 0)
+ ACE_ERROR ((LM_ERROR,
+ "(%P|%t) TAO_Messaging_ORBInitializer::register_value_factory:\n"
+ "(%P|%t) Unable to narrow "
+ "\"PortableInterceptor::ORBInitInfo_ptr\" to\n"
+ "(%P|%t) \"TAO_ORBInitInfo *.\"\n"));
+
+ ACE_THROW (CORBA::INTERNAL ());
+ }
+
+ TAO::ExceptionHolderFactory *base_factory = 0;
+ ACE_NEW (base_factory,
+ TAO::ExceptionHolderFactory);
+ CORBA::ValueFactory_var factory = base_factory;
+
+ tao_info->orb_core()->orb ()->register_value_factory (
+ Messaging::ExceptionHolder::_tao_obv_static_repository_id (),
+ base_factory
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+}
+void
+TAO_Messaging_ORBInitializer::register_policy_factories (
+ PortableInterceptor::ORBInitInfo_ptr info
+ ACE_ENV_ARG_DECL)
+{
+ // Register the Messaging policy factories.
+
+ PortableInterceptor::PolicyFactory_ptr policy_factory_ptr;
+ ACE_NEW_THROW_EX (policy_factory_ptr,
+ TAO_Messaging_PolicyFactory,
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_CHECK;
+
+
+ PortableInterceptor::PolicyFactory_var policy_factory =
+ policy_factory_ptr;
+
+ // Bind the same policy factory to all Messaging related policy
+ // types since a single policy factory is used to create each of
+ // the different types of Messaging policies.
+
+ CORBA::PolicyType type[] = {
+#if (TAO_HAS_RELATIVE_REQUEST_TIMEOUT_POLICY == 1)
+ Messaging::RELATIVE_RT_TIMEOUT_POLICY_TYPE,
+#endif /* TAO_HAS_RELATIVE_REQUEST_TIMEOUT_POLICY == 1 */
+#if (TAO_HAS_SYNC_SCOPE_POLICY == 1)
+ Messaging::SYNC_SCOPE_POLICY_TYPE,
+#endif /* TAO_HAS_SYNC_SCOPE_POLICY == 1 */
+#if (TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1)
+ TAO::BUFFERING_CONSTRAINT_POLICY_TYPE,
+#endif /* TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1 */
+#if (TAO_HAS_REBIND_POLICY == 1)
+ Messaging::REBIND_POLICY_TYPE,
+#endif /* TAO_HAS_REBIND_POLICY == 1 */
+#if (TAO_HAS_PRIORITY_POLICIES == 1)
+ Messaging::REQUEST_PRIORITY_POLICY_TYPE,
+ Messaging::REPLY_PRIORITY_POLICY_TYPE,
+#endif /* TAO_HAS_PRIORITY_POLICIES == 1 */
+#if (TAO_HAS_REQUEST_START_TIME_POLICY == 1)
+ Messaging::REQUEST_START_TIME_POLICY_TYPE,
+#endif /* TAO_HAS_REQUEST_START_TIME_POLICY == 1 */
+#if (TAO_HAS_REQUEST_END_TIME_POLICY == 1)
+ Messaging::REQUEST_END_TIME_POLICY_TYPE,
+#endif /*TAO_HAS_REQUEST_END_TIME_POLICY == 1 */
+#if (TAO_HAS_REPLY_START_TIME_POLICY == 1)
+ Messaging::REPLY_START_TIME_POLICY_TYPE,
+#endif /* TAO_HAS_REPLY_START_TIME_POLICY == 1 */
+#if (TAO_HAS_REPLY_END_TIME_POLICY == 1)
+ Messaging::REPLY_END_TIME_POLICY_TYPE,
+#endif /* TAO_HAS_REPLY_END_TIME_POLICY == 1 */
+#if (TAO_HAS_RELATIVE_REQUEST_TIMEOUT_POLICY == 1)
+ Messaging::RELATIVE_REQ_TIMEOUT_POLICY_TYPE,
+#endif /* TAO_HAS_RELATIVE_REQUEST_TIMEOUT_POLICY == 1 */
+#if (TAO_HAS_ROUTING_POLICY == 1)
+ Messaging::ROUTING_POLICY_TYPE,
+#endif /* TAO_HAS_ROUTING_POLICY == 1 */
+#if (TAO_HAS_MAX_HOPS_POLICY == 1)
+ Messaging::MAX_HOPS_POLICY_TYPE,
+#endif /* TAO_HAS_MAX_HOPS_POLICY == 1 */
+ Messaging::QUEUE_ORDER_POLICY_TYPE,
+#if (TAO_HAS_CONNECTION_TIMEOUT_POLICY == 1)
+ TAO::CONNECTION_TIMEOUT_POLICY_TYPE
+#endif /* TAO_HAS_CONNECTION_TIMEOUT_POLICY == 1 */
+ };
+
+ const CORBA::PolicyType *end = type + sizeof (type) / sizeof (type[0]);
+ for (CORBA::PolicyType *i = type; i != end; ++i)
+ {
+ ACE_TRY
+ {
+ info->register_policy_factory (*i,
+ policy_factory.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCH (CORBA::BAD_INV_ORDER, ex)
+ {
+ if (ex.minor () == (CORBA::OMGVMCID | 16))
+ {
+ // The factory is already there, it happens because the
+ // magic initializer in Messaging.cpp registers with the
+ // ORB multiple times. This is an indication that we
+ // should do no more work in this ORBInitializer.
+ return;
+ }
+ ACE_RE_THROW;
+ }
+ ACE_CATCHANY
+ {
+ // Rethrow any other exceptions...
+ ACE_RE_THROW;
+ }
+ ACE_ENDTRY;
+ ACE_CHECK;
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Messaging/Messaging_ORBInitializer.h b/TAO/tao/Messaging/Messaging_ORBInitializer.h
new file mode 100644
index 00000000000..e5d57c2a72d
--- /dev/null
+++ b/TAO/tao/Messaging/Messaging_ORBInitializer.h
@@ -0,0 +1,83 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Messaging_ORBInitializer.h
+ *
+ * $Id$
+ *
+ * @author Ossama Othman <ossama@uci.edu>
+ */
+//=============================================================================
+
+
+#ifndef TAO_MESSAGING_ORB_INITIALIZER_H
+#define TAO_MESSAGING_ORB_INITIALIZER_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Messaging/messaging_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PI/PI.h"
+#include "tao/LocalObject.h"
+
+// This is to remove "inherits via dominance" warnings from MSVC.
+// MSVC is being a little too paranoid.
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/// Messaging ORB initializer.
+class TAO_Messaging_ORBInitializer
+ : public virtual PortableInterceptor::ORBInitializer,
+ public virtual TAO_Local_RefCounted_Object
+{
+public:
+
+ /**
+ * @name PortableInterceptor::ORBInitializer Methods
+ *
+ * The following methods are required by the
+ * PortableInterceptor::ORBInitializer interface.
+ */
+ //@{
+
+ virtual void pre_init (PortableInterceptor::ORBInitInfo_ptr info
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual void post_init (PortableInterceptor::ORBInitInfo_ptr info
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ //@}
+
+private:
+
+ /// Register Messaging policy factories.
+ void register_policy_factories (
+ PortableInterceptor::ORBInitInfo_ptr info
+ ACE_ENV_ARG_DECL);
+
+ /// Register ExceptionHolder value factory
+ void register_value_factory (
+ PortableInterceptor::ORBInitInfo_ptr info
+ ACE_ENV_ARG_DECL);
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_MESSAGING_ORB_INITIALIZER_H */
diff --git a/TAO/tao/Messaging/Messaging_PolicyFactory.cpp b/TAO/tao/Messaging/Messaging_PolicyFactory.cpp
new file mode 100644
index 00000000000..7fcda386a8b
--- /dev/null
+++ b/TAO/tao/Messaging/Messaging_PolicyFactory.cpp
@@ -0,0 +1,111 @@
+#include "tao/Messaging/Messaging_PolicyFactory.h"
+
+ACE_RCSID (Messaging,
+ Messaging_PolicyFactory,
+ "$Id$")
+
+#include "tao/Messaging/Messaging_Policy_i.h"
+#include "tao/Messaging/Connection_Timeout_Policy_i.h"
+
+#include "tao/PolicyC.h"
+#include "tao/Buffering_Constraint_Policy.h"
+#include "tao/AnyTypeCode/TAOA.h"
+#include "tao/AnyTypeCode/Any.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+#if (TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1)
+
+CORBA::Policy_ptr
+TAO_Messaging_PolicyFactory::create_buffering_constraint_policy (
+ const CORBA::Any& val
+ ACE_ENV_ARG_DECL)
+{
+ TAO::BufferingConstraint *buffering_constraint = 0;
+ if ((val >>= buffering_constraint) == 0)
+ ACE_THROW_RETURN (CORBA::PolicyError (CORBA::BAD_POLICY_VALUE),
+ CORBA::Policy::_nil ());
+
+ TAO_Buffering_Constraint_Policy *servant = 0;
+ ACE_NEW_THROW_EX (servant,
+ TAO_Buffering_Constraint_Policy (*buffering_constraint),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+
+ return servant;
+}
+
+#endif /* TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1 */
+
+CORBA::Policy_ptr
+TAO_Messaging_PolicyFactory::create_policy (
+ CORBA::PolicyType type,
+ const CORBA::Any &value
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ CORBA::PolicyError))
+{
+#if (TAO_HAS_RELATIVE_ROUNDTRIP_TIMEOUT_POLICY == 1)
+ if (type == Messaging::RELATIVE_RT_TIMEOUT_POLICY_TYPE)
+ return TAO_RelativeRoundtripTimeoutPolicy::create (value
+ ACE_ENV_ARG_PARAMETER);
+#endif /* TAO_HAS_RELATIVE_ROUNDTRIP_TIMEOUT_POLICY == 1 */
+
+#if (TAO_HAS_CONNECTION_TIMEOUT_POLICY == 1)
+ if (type == TAO::CONNECTION_TIMEOUT_POLICY_TYPE)
+ return TAO_ConnectionTimeoutPolicy::create (value
+ ACE_ENV_ARG_PARAMETER);
+#endif /* TAO_HAS_RELATIVE_ROUNDTRIP_TIMEOUT_POLICY == 1 */
+
+#if (TAO_HAS_SYNC_SCOPE_POLICY == 1)
+ if (type == Messaging::SYNC_SCOPE_POLICY_TYPE)
+ return TAO_Sync_Scope_Policy::create (value
+ ACE_ENV_ARG_PARAMETER);
+#endif /* TAO_HAS_SYNC_SCOPE_POLICY == 1 */
+
+#if (TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1)
+ if (type == TAO::BUFFERING_CONSTRAINT_POLICY_TYPE)
+ return this->create_buffering_constraint_policy (value
+ ACE_ENV_ARG_PARAMETER);
+#endif /* TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1 */
+
+ if (
+#if (TAO_HAS_REBIND_POLICY == 1)
+ type == Messaging::REBIND_POLICY_TYPE ||
+#endif /* TAO_HAS_REBIND_POLICY == 1 */
+#if (TAO_HAS_PRIORITY_POLICIES == 1)
+ type == Messaging::REQUEST_PRIORITY_POLICY_TYPE ||
+ type == Messaging::REPLY_PRIORITY_POLICY_TYPE ||
+#endif /* TAO_HAS_PRIORITY_POLICIES == 1 */
+#if (TAO_HAS_REQUEST_START_TIME_POLICY == 1)
+ type == Messaging::REQUEST_START_TIME_POLICY_TYPE ||
+#endif /* TAO_HAS_REQUEST_START_TIME_POLICY == 1 */
+#if (TAO_HAS_REQUEST_END_TIME_POLICY == 1)
+ type == Messaging::REQUEST_END_TIME_POLICY_TYPE ||
+#endif /* TAO_HAS_REQUEST_END_TIME_POLICY == 1 */
+#if (TAO_HAS_REPLY_START_TIME_POLICY == 1)
+ type == Messaging::REPLY_START_TIME_POLICY_TYPE ||
+#endif /* TAO_HAS_REPLY_START_TIME_POLICY == 1 */
+#if (TAO_HAS_REPLY_END_TIME_POLICY == 1)
+ type == Messaging::REPLY_END_TIME_POLICY_TYPE ||
+#endif /* TAO_HAS_REPLY_END_TIME_POLICY == 1 */
+#if (TAO_HAS_RELATIVE_REQUEST_TIMEOUT_POLICY == 1)
+ type == Messaging::RELATIVE_REQ_TIMEOUT_POLICY_TYPE ||
+#endif /* TAO_HAS_RELATIVE_REQUEST_TIMEOUT_POLICY == 1 */
+#if (TAO_HAS_ROUTING_POLICY == 1)
+ type == Messaging::ROUTING_POLICY_TYPE ||
+#endif /* TAO_HAS_ROUTING_POLICY == 1 */
+#if (TAO_HAS_MAX_HOPS_POLICY == 1)
+ type == Messaging::MAX_HOPS_POLICY_TYPE ||
+#endif /* TAO_HAS_MAX_HOPS_POLICY == 1 */
+ type == Messaging::QUEUE_ORDER_POLICY_TYPE)
+ ACE_THROW_RETURN (CORBA::PolicyError (CORBA::UNSUPPORTED_POLICY),
+ CORBA::Policy::_nil ());
+
+ ACE_UNUSED_ARG (value);
+
+ ACE_THROW_RETURN (CORBA::PolicyError (CORBA::BAD_POLICY_TYPE),
+ CORBA::Policy::_nil ());
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Messaging/Messaging_PolicyFactory.h b/TAO/tao/Messaging/Messaging_PolicyFactory.h
new file mode 100644
index 00000000000..c2b36ed1a43
--- /dev/null
+++ b/TAO/tao/Messaging/Messaging_PolicyFactory.h
@@ -0,0 +1,66 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Messaging_PolicyFactory.h
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan <coryan@uci.edu>
+ * @author Ossama Othman <ossama@uci.edu>
+ */
+//=============================================================================
+
+
+#ifndef TAO_MESSAGING_POLICY_FACTORY_H
+#define TAO_MESSAGING_POLICY_FACTORY_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Messaging/messaging_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PI/PI.h"
+#include "tao/LocalObject.h"
+
+// This is to remove "inherits via dominance" warnings from MSVC.
+// MSVC is being a little too paranoid.
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/// Policy factory for all Messaging related policies.
+class TAO_Messaging_PolicyFactory
+ : public virtual PortableInterceptor::PolicyFactory,
+ public virtual TAO_Local_RefCounted_Object
+{
+public:
+
+ virtual CORBA::Policy_ptr create_policy (CORBA::PolicyType type,
+ const CORBA::Any & value
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ CORBA::PolicyError));
+private:
+#if (TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1)
+ CORBA::Policy_ptr
+ create_buffering_constraint_policy (const CORBA::Any& val
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+#endif /* TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1 */
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_MESSAGING_POLICY_FACTORY_H */
diff --git a/TAO/tao/Messaging/Messaging_Policy_i.cpp b/TAO/tao/Messaging/Messaging_Policy_i.cpp
new file mode 100644
index 00000000000..dc98c862747
--- /dev/null
+++ b/TAO/tao/Messaging/Messaging_Policy_i.cpp
@@ -0,0 +1,346 @@
+// $Id$
+
+#include "tao/Messaging/Messaging_Policy_i.h"
+#include "tao/Stub.h"
+#include "tao/ORB_Core.h"
+#include "tao/debug.h"
+#include "tao/AnyTypeCode/Any.h"
+
+#if ! defined (__ACE_INLINE__)
+#include "tao/Messaging/Messaging_Policy_i.i"
+#endif /* __ACE_INLINE__ */
+
+ACE_RCSID (Messaging,
+ Messaging_Policy_i,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+#if (TAO_HAS_RELATIVE_ROUNDTRIP_TIMEOUT_POLICY == 1)
+
+TAO_RelativeRoundtripTimeoutPolicy::TAO_RelativeRoundtripTimeoutPolicy (
+ const TimeBase::TimeT& relative_expiry)
+ : ::CORBA::Object ()
+ , ::CORBA::Policy ()
+ , ::CORBA::LocalObject ()
+ , Messaging::RelativeRoundtripTimeoutPolicy ()
+ , TAO_Local_RefCounted_Object ()
+ , relative_expiry_ (relative_expiry)
+{
+}
+
+TAO_RelativeRoundtripTimeoutPolicy::TAO_RelativeRoundtripTimeoutPolicy (
+ const TAO_RelativeRoundtripTimeoutPolicy &rhs)
+ : ::CORBA::Object ()
+ , ::CORBA::Policy ()
+ , ::CORBA::LocalObject ()
+ , Messaging::RelativeRoundtripTimeoutPolicy ()
+ , TAO_Local_RefCounted_Object ()
+ , relative_expiry_ (rhs.relative_expiry_)
+{
+}
+
+TimeBase::TimeT
+TAO_RelativeRoundtripTimeoutPolicy::relative_expiry (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return this->relative_expiry_;
+}
+
+CORBA::PolicyType
+TAO_RelativeRoundtripTimeoutPolicy::policy_type (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return Messaging::RELATIVE_RT_TIMEOUT_POLICY_TYPE;
+}
+
+void
+TAO_RelativeRoundtripTimeoutPolicy::hook (TAO_ORB_Core *orb_core,
+ TAO_Stub *stub,
+ bool &has_timeout,
+ ACE_Time_Value &time_value)
+{
+ ACE_TRY_NEW_ENV
+ {
+ CORBA::Policy_var policy = 0;
+
+ if (stub == 0)
+ {
+ policy =
+ orb_core->get_cached_policy_including_current (
+ TAO_CACHED_POLICY_RELATIVE_ROUNDTRIP_TIMEOUT
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ else
+ {
+ policy =
+ stub->get_cached_policy (TAO_CACHED_POLICY_RELATIVE_ROUNDTRIP_TIMEOUT
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+
+ if (CORBA::is_nil (policy.in ()))
+ {
+ has_timeout = false;
+ return;
+ }
+
+ Messaging::RelativeRoundtripTimeoutPolicy_var p =
+ Messaging::RelativeRoundtripTimeoutPolicy::_narrow (
+ policy.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ TimeBase::TimeT t = p->relative_expiry (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ TimeBase::TimeT seconds = t / 10000000u;
+ TimeBase::TimeT microseconds = (t % 10000000u) / 10;
+ time_value.set (ACE_U64_TO_U32 (seconds),
+ ACE_U64_TO_U32 (microseconds));
+
+ // Set the flag once all operations complete successfully
+ has_timeout = true;
+
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - Timeout is <%u>\n"),
+ time_value.msec ()));
+ }
+ }
+ ACE_CATCHANY
+ {
+ // Ignore all exceptions...
+ }
+ ACE_ENDTRY;
+}
+
+CORBA::Policy_ptr
+TAO_RelativeRoundtripTimeoutPolicy::create (const CORBA::Any& val
+ ACE_ENV_ARG_DECL)
+{
+ // Future policy implementors: notice how the following code is
+ // exception safe!
+
+ TimeBase::TimeT value;
+ if ((val >>= value) == 0)
+ ACE_THROW_RETURN (CORBA::PolicyError (CORBA::BAD_POLICY_VALUE),
+ CORBA::Policy::_nil ());
+
+ TAO_RelativeRoundtripTimeoutPolicy *tmp = 0;
+ ACE_NEW_THROW_EX (tmp,
+ TAO_RelativeRoundtripTimeoutPolicy (value),
+ CORBA::NO_MEMORY (TAO::VMCID,
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+
+ return tmp;
+}
+
+TAO_RelativeRoundtripTimeoutPolicy *
+TAO_RelativeRoundtripTimeoutPolicy::clone (void) const
+{
+ TAO_RelativeRoundtripTimeoutPolicy *copy = 0;
+ ACE_NEW_RETURN (copy,
+ TAO_RelativeRoundtripTimeoutPolicy (*this),
+ 0);
+ return copy;
+}
+
+CORBA::Policy_ptr
+TAO_RelativeRoundtripTimeoutPolicy::copy (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ // Future policy implementors: notice how the following code is
+ // exception safe!
+
+ TAO_RelativeRoundtripTimeoutPolicy* tmp;
+ ACE_NEW_THROW_EX (tmp, TAO_RelativeRoundtripTimeoutPolicy (*this),
+ CORBA::NO_MEMORY (TAO::VMCID,
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+
+ return tmp;
+}
+
+void
+TAO_RelativeRoundtripTimeoutPolicy::destroy (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+}
+
+TAO_Cached_Policy_Type
+TAO_RelativeRoundtripTimeoutPolicy::_tao_cached_type (void) const
+{
+ return TAO_CACHED_POLICY_RELATIVE_ROUNDTRIP_TIMEOUT;
+}
+
+void
+TAO_RelativeRoundtripTimeoutPolicy::set_time_value (ACE_Time_Value &time_value)
+{
+ TimeBase::TimeT t = this->relative_expiry_;
+ TimeBase::TimeT seconds = t / 10000000u;
+ TimeBase::TimeT microseconds = (t % 10000000u) / 10;
+ time_value.set (ACE_U64_TO_U32 (seconds),
+ ACE_U64_TO_U32 (microseconds));
+
+ if (TAO_debug_level > 0)
+ {
+ CORBA::ULong msecs = time_value.msec ();
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - Timeout is <%u>\n"),
+ msecs));
+ }
+}
+
+#endif /* TAO_HAS_RELATIVE_ROUNDTRIP_TIMEOUT_POLICY == 1 */
+
+// ****************************************************************
+
+#if (TAO_HAS_SYNC_SCOPE_POLICY == 1)
+
+TAO_Sync_Scope_Policy::TAO_Sync_Scope_Policy (Messaging::SyncScope synchronization)
+ : ::CORBA::Object ()
+ , ::CORBA::Policy ()
+ , ::CORBA::LocalObject ()
+ , Messaging::SyncScopePolicy ()
+ , TAO_Local_RefCounted_Object ()
+ , synchronization_ (synchronization)
+{
+}
+
+TAO_Sync_Scope_Policy::TAO_Sync_Scope_Policy (const TAO_Sync_Scope_Policy &rhs)
+ : ::CORBA::Object ()
+ , ::CORBA::Policy ()
+ , ::CORBA::LocalObject ()
+ , Messaging::SyncScopePolicy ()
+ , TAO_Local_RefCounted_Object ()
+ , synchronization_ (rhs.synchronization_)
+{
+}
+
+CORBA::PolicyType
+TAO_Sync_Scope_Policy::policy_type (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return Messaging::SYNC_SCOPE_POLICY_TYPE;
+}
+
+void
+TAO_Sync_Scope_Policy::hook (TAO_ORB_Core *orb_core,
+ TAO_Stub *stub,
+ bool &has_synchronization,
+ Messaging::SyncScope &scope)
+{
+ ACE_TRY_NEW_ENV
+ {
+ CORBA::Policy_var policy = 0;
+
+ if (stub == 0)
+ {
+ policy =
+ orb_core->get_cached_policy_including_current (
+ TAO_CACHED_POLICY_SYNC_SCOPE
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ else
+ {
+ policy =
+ stub->get_cached_policy (TAO_CACHED_POLICY_SYNC_SCOPE
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+
+ if (CORBA::is_nil (policy.in ()))
+ {
+ has_synchronization = 0;
+ return;
+ }
+ Messaging::SyncScopePolicy_var p =
+ Messaging::SyncScopePolicy::_narrow (policy.in ());
+ ACE_TRY_CHECK;
+
+ if (CORBA::is_nil (p.in ()))
+ ACE_THROW (CORBA::INTERNAL (
+ CORBA::SystemException::_tao_minor_code (
+ TAO_POLICY_NARROW_CODE,
+ 0),
+ CORBA::COMPLETED_NO));
+
+ has_synchronization = true;
+ scope = p->synchronization (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ // Ignore all exceptions...
+ }
+ ACE_ENDTRY;
+}
+
+CORBA::Policy_ptr
+TAO_Sync_Scope_Policy::create (const CORBA::Any& val
+ ACE_ENV_ARG_DECL)
+{
+ Messaging::SyncScope synchronization;
+ if ((val >>= synchronization) == 0)
+ ACE_THROW_RETURN (CORBA::PolicyError (CORBA::BAD_POLICY_VALUE),
+ CORBA::Policy::_nil ());
+
+ TAO_Sync_Scope_Policy *servant = 0;
+ ACE_NEW_THROW_EX (servant,
+ TAO_Sync_Scope_Policy (synchronization),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+
+ return servant;
+}
+
+TAO_Sync_Scope_Policy *
+TAO_Sync_Scope_Policy::clone (void) const
+{
+ TAO_Sync_Scope_Policy *copy = 0;
+ ACE_NEW_RETURN (copy,
+ TAO_Sync_Scope_Policy (*this),
+ 0);
+ return copy;
+}
+
+Messaging::SyncScope
+TAO_Sync_Scope_Policy::synchronization (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return this->synchronization_;
+}
+
+CORBA::Policy_ptr
+TAO_Sync_Scope_Policy::copy (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ TAO_Sync_Scope_Policy *servant = 0;
+ ACE_NEW_THROW_EX (servant,
+ TAO_Sync_Scope_Policy (*this),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+
+ return servant;
+}
+
+void
+TAO_Sync_Scope_Policy::destroy (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+}
+TAO_Cached_Policy_Type
+TAO_Sync_Scope_Policy::_tao_cached_type (void) const
+{
+ return TAO_CACHED_POLICY_SYNC_SCOPE;
+}
+
+#endif /* TAO_HAS_SYNC_SCOPE_POLICY == 1 */
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Messaging/Messaging_Policy_i.h b/TAO/tao/Messaging/Messaging_Policy_i.h
new file mode 100644
index 00000000000..588ea35d89b
--- /dev/null
+++ b/TAO/tao/Messaging/Messaging_Policy_i.h
@@ -0,0 +1,167 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Messaging_Policy_i.h
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan (coryan@cs.wustl.edu)
+ */
+//=============================================================================
+
+#ifndef TAO_MESSAGING_POLICY_I_H
+#define TAO_MESSAGING_POLICY_I_H
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+#include "tao/Messaging/Messaging.h"
+#include "tao/LocalObject.h"
+
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+#if (TAO_HAS_RELATIVE_ROUNDTRIP_TIMEOUT_POLICY == 1)
+
+/*
+ * @class TAO_RelativeRoundtripTimeoutPolicy
+ *
+ * @brief Messaging::RelativeRoundtripTimeoutPolicy implementation
+ *
+ * This policy controls the total (round-trip) timeout time for a
+ * request.
+ */
+class TAO_RelativeRoundtripTimeoutPolicy
+ : public Messaging::RelativeRoundtripTimeoutPolicy,
+ public TAO_Local_RefCounted_Object
+{
+
+public:
+ /// Constructor.
+ TAO_RelativeRoundtripTimeoutPolicy (const TimeBase::TimeT& relative_expiry);
+
+ /// Copy constructor.
+ TAO_RelativeRoundtripTimeoutPolicy (const TAO_RelativeRoundtripTimeoutPolicy &rhs);
+
+ /// Implement the timeout hook, this is set in the ORB_Core at
+ /// initialization time.
+ static void hook (TAO_ORB_Core *orb_core,
+ TAO_Stub *stub,
+ bool &has_timeout,
+ ACE_Time_Value &time_value);
+
+ /// Helper method for the implementation of
+ /// CORBA::ORB::create_policy.
+ static CORBA::Policy_ptr create (const CORBA::Any& val
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ /// Returns a copy of <this>.
+ virtual TAO_RelativeRoundtripTimeoutPolicy *clone (void) const;
+
+ // = The Messaging::RelativeRoundtripTimeoutPolicy methods
+ virtual TimeBase::TimeT relative_expiry (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual CORBA::PolicyType policy_type (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual CORBA::Policy_ptr copy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual void destroy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Change the CORBA representation to the ACE representation.
+ void set_time_value (ACE_Time_Value &time_value);
+
+ // Return the cached policy type for this policy.
+ virtual TAO_Cached_Policy_Type _tao_cached_type (void) const;
+
+private:
+ /// The attribute
+ TimeBase::TimeT relative_expiry_;
+};
+
+#endif /* TAO_HAS_RELATIVE_ROUNDTRIP_TIMEOUT_POLICY == 1 */
+
+////////////////////////////////////////////////////////////////////////////////
+
+#if (TAO_HAS_SYNC_SCOPE_POLICY == 1)
+
+/*
+ * @class TAO_Sync_Scope_Policy
+ *
+ * @brief Messaging::SyncScopePolicy implementation.
+ *
+ * This policy controls the sync strategy used by the ORB to transport
+ * requests.
+ */
+class TAO_Messaging_Export TAO_Sync_Scope_Policy
+ : public Messaging::SyncScopePolicy,
+ public TAO_Local_RefCounted_Object
+{
+
+public:
+ /// Constructor.
+ TAO_Sync_Scope_Policy (Messaging::SyncScope synchronization);
+
+ /// Copy constructor.
+ TAO_Sync_Scope_Policy (const TAO_Sync_Scope_Policy &rhs);
+
+ /// Implement the Sync_Scope hook, this is set in the ORB_Core at
+ /// initialization time.
+ static void hook (TAO_ORB_Core *orb_core,
+ TAO_Stub *stub,
+ bool &has_synchronization,
+ Messaging::SyncScope &scope);
+
+ /// Helper method for the implementation of
+ /// CORBA::ORB::create_policy.
+ static CORBA::Policy_ptr create (const CORBA::Any& val
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ /// Returns a copy of <this>.
+ virtual TAO_Sync_Scope_Policy *clone (void) const;
+
+ // = The Messaging::SyncScopePolicy methods.
+
+ virtual Messaging::SyncScope synchronization (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ void get_synchronization (Messaging::SyncScope &synchronization) const;
+
+ virtual CORBA::PolicyType policy_type (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual CORBA::Policy_ptr copy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual void destroy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ // Return the cached policy type for this policy.
+ virtual TAO_Cached_Policy_Type _tao_cached_type (void) const;
+private:
+
+ /// The attribute
+ Messaging::SyncScope synchronization_;
+};
+
+#endif /* TAO_HAS_SYNC_SCOPE_POLICY == 1 */
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+#include "tao/Messaging/Messaging_Policy_i.i"
+#endif /* __ACE_INLINE__ */
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_MESSAGING_POLICY_I_H */
diff --git a/TAO/tao/Messaging/Messaging_Policy_i.i b/TAO/tao/Messaging/Messaging_Policy_i.i
new file mode 100644
index 00000000000..f33ea289267
--- /dev/null
+++ b/TAO/tao/Messaging/Messaging_Policy_i.i
@@ -0,0 +1,17 @@
+// -*- C++ -*-
+//
+// $Id$
+
+#if (TAO_HAS_SYNC_SCOPE_POLICY == 1)
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE void
+TAO_Sync_Scope_Policy::get_synchronization (Messaging::SyncScope &s) const
+{
+ s = this->synchronization_;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_SYNC_SCOPE_POLICY == 1 */
diff --git a/TAO/tao/Messaging/Messaging_RT_Policy.pidl b/TAO/tao/Messaging/Messaging_RT_Policy.pidl
new file mode 100644
index 00000000000..130f6bb6d0b
--- /dev/null
+++ b/TAO/tao/Messaging/Messaging_RT_Policy.pidl
@@ -0,0 +1,49 @@
+// -*- IDL -*-
+
+//=============================================================================
+/**
+ * @file Messaging_RT_Policy.pidl
+ *
+ * $Id$
+ *
+ * This file was used to generate the code in
+ * Messaging_RT_Policy{C}.{h,cpp}
+ *
+ * The command used to generate code from this file is:
+ *
+ * tao_idl
+ * -o orig -Gp -Gd -Ge 1 -GA -Sci -SS
+ * -Wb,export_macro=TAO_Messaging_Export
+ * -Wb,export_include=messaging_export.h
+ * -Wb,pre_include="ace/pre.h"
+ * -Wb,post_include="ace/post.h"
+ * Messaging_RT_Policy.pidl
+ *
+ * The generated files are ready to use
+ */
+//=============================================================================
+
+#ifndef TAO_MESSAGING_RT_POLICY_PIDL
+#define TAO_MESSAGING_RT_POLICY_PIDL
+
+#include "tao/TimeBase.pidl"
+#include "tao/Policy.pidl"
+
+#pragma prefix "omg.org"
+
+module Messaging
+{
+ // Synchronization Policy (default = WITH_TRANSPORT)
+ typedef TimeBase::TimeT Timeout;
+
+ //
+ // Locally-Constrained Policy Objects
+ //
+ const CORBA::PolicyType RELATIVE_RT_TIMEOUT_POLICY_TYPE = 32;
+ local interface RelativeRoundtripTimeoutPolicy : CORBA::Policy {
+ readonly attribute TimeBase::TimeT relative_expiry;
+ };
+
+};
+
+#endif /*TAO_MESSAGING_RT_POLICY_PIDL*/
diff --git a/TAO/tao/Messaging/Messaging_SyncScope_Policy.pidl b/TAO/tao/Messaging/Messaging_SyncScope_Policy.pidl
new file mode 100644
index 00000000000..bc2f4501514
--- /dev/null
+++ b/TAO/tao/Messaging/Messaging_SyncScope_Policy.pidl
@@ -0,0 +1,47 @@
+// -*- IDL -*-
+
+//=============================================================================
+/**
+ * @file Messaging_SyncScope_Policy.pidl
+ *
+ * $Id$
+ *
+ * This file was used to generate the code in
+ * Messaging_SyncScope_Policy{C}.{h,cpp}
+ *
+ * The command used to generate code from this file is:
+ *
+ * tao_idl
+ * -o orig -Gp -Gd -Ge 1 -GA -Sci
+ * -Wb,export_macro=TAO_Messaging_Export
+ * -Wb,export_include=messaging_export.h
+ * -Wb,pre_include="ace/pre.h"
+ * -Wb,post_include="ace/post.h" -I$(TAO_ROOT)
+ * Messaging_SyncScope_Policy.pidl
+ *
+ * The generated files are ready to use
+ */
+//=============================================================================
+
+#ifndef TAO_MESSAGING_SYNCSCOPE_POLICY_PIDL
+#define TAO_MESSAGING_SYNCSCOPE_POLICY_PIDL
+
+#include "tao/Policy.pidl"
+#include "tao/Messaging_SyncScope.pidl"
+
+#pragma prefix "omg.org"
+
+module Messaging
+{
+ // Synchronization Policy (default = WITH_TRANSPORT)
+
+ //
+ // Locally-Constrained Policy Objects
+ //
+ const CORBA::PolicyType SYNC_SCOPE_POLICY_TYPE = 24;
+ local interface SyncScopePolicy : CORBA::Policy {
+ readonly attribute SyncScope synchronization;
+ };
+};
+
+#endif /*TAO_MESSAGING_SYNCSCOPE_POLICY_PIDL*/
diff --git a/TAO/tao/Messaging/Pollable.pidl b/TAO/tao/Messaging/Pollable.pidl
new file mode 100644
index 00000000000..80c14f7ebc2
--- /dev/null
+++ b/TAO/tao/Messaging/Pollable.pidl
@@ -0,0 +1,61 @@
+// -*- IDL -*-
+
+//=============================================================================
+/**
+ * @file Pollable.pidl
+ *
+ * $Id$
+ *
+ * This file was used to generate the code in Pollable{C,S,S_T}.{h,inl,cpp}
+ *
+ * The command used to generate code from this file is:
+ *
+ * tao_idl
+ * -o orig -St -Sa -Gp -Gd -Ge 1 -SS -Sci
+ * -Wb,export_macro=TAO_Export
+ * -Wb,pre_include="ace/pre.h"
+ * -Wb,post_include="ace/post.h"
+ * Pollable.pidl
+ *
+ */
+//=============================================================================
+
+#ifndef TAO_POLLABLE_PIDL
+#define TAO_POLLABLE_PIDL
+
+#pragma prefix "omg.org"
+
+module CORBA
+{
+ local interface PollableSet;
+
+ local interface Pollable
+ {
+ boolean is_ready (in unsigned long timeout);
+ PollableSet create_pollable_set ();
+ };
+
+ local interface DIIPollable : Pollable
+ {
+ };
+
+ local interface PollableSet
+ {
+ exception NoPossiblePollable {};
+ exception UnknownPollable {};
+
+ DIIPollable create_dii_pollable ();
+
+ void add_pollable (in Pollable potential);
+
+ Pollable get_ready_pollable (in unsigned long timeout)
+ raises (NoPossiblePollable);
+
+ void remove (in Pollable potential)
+ raises (UnknownPollable);
+
+ unsigned short number_left ();
+ };
+};
+
+#endif /* TAO_POLLABLE_PIDL */
diff --git a/TAO/tao/Messaging/TAO_Ext.pidl b/TAO/tao/Messaging/TAO_Ext.pidl
new file mode 100644
index 00000000000..55eb98af6ec
--- /dev/null
+++ b/TAO/tao/Messaging/TAO_Ext.pidl
@@ -0,0 +1,46 @@
+// -*- IDL -*-
+
+// ================================================================
+/**
+ * @file TAO_Ext.pidl
+ *
+ * $Id$
+ *
+ * This file contains extensions to the TAO-specific idl interfaces
+ * (not part of CORBA 2.6) defined in $TAO_ROOT/tao
+ *
+ * The steps to regenerate the code are as follows:
+ *
+ * 1. Run the tao_idl compiler on the pidl file. The command used for
+ * this is:
+ *
+ * tao_idl
+ * -o orig -Gp -Gd -Ge 1 -GA -Sci -SS
+ * -Wb,export_macro=TAO_Messaging_Export
+ * -Wb,export_include=messaging_export.h
+ * -Wb,pre_include="ace/pre.h"
+ * -Wb,post_include="ace/post.h"
+ * -I$(TAO_ROOT) TAO_Ext.pidl
+ *
+ * The generated files are ready to use
+ */
+// ================================================================
+
+#ifndef TAO_TAO_EXT_IDL
+#define TAO_TAO_EXT_IDL
+
+#include "tao/Policy.pidl"
+#include "tao/TimeBase.pidl"
+
+#pragma prefix "tao"
+
+module TAO
+{
+ const CORBA::PolicyType CONNECTION_TIMEOUT_POLICY_TYPE = 0x54410008;
+
+ local interface ConnectionTimeoutPolicy : CORBA::Policy {
+ readonly attribute TimeBase::TimeT relative_expiry;
+ };
+};
+
+#endif /* TAO_TAO_EXT_IDL */
diff --git a/TAO/tao/Messaging/TAO_Messaging.pc.in b/TAO/tao/Messaging/TAO_Messaging.pc.in
new file mode 100644
index 00000000000..515d554773f
--- /dev/null
+++ b/TAO/tao/Messaging/TAO_Messaging.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: TAO_Messaging
+Description: TAO Messaging Library
+Requires: TAO_Valuetype, TAO_PI, TAO_CodecFactory, TAO_PortableServer, TAO_AnyTypeCode, TAO
+Version: @VERSION@
+Libs: -L${libdir} -lTAO_Messaging
+Cflags: -I${includedir}
diff --git a/TAO/tao/Messaging/TAO_Messaging.rc b/TAO/tao/Messaging/TAO_Messaging.rc
new file mode 100644
index 00000000000..033271a4631
--- /dev/null
+++ b/TAO/tao/Messaging/TAO_Messaging.rc
@@ -0,0 +1,30 @@
+#include "..\Version.h"
+
+1 VERSIONINFO
+ FILEVERSION TAO_MAJOR_VERSION,TAO_MINOR_VERSION,TAO_BETA_VERSION,0
+ PRODUCTVERSION TAO_MAJOR_VERSION,TAO_MINOR_VERSION,TAO_BETA_VERSION,0
+ FILEFLAGSMASK 0x3fL
+ FILEFLAGS 0x0L
+ FILEOS 0x4L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904B0"
+ BEGIN
+ VALUE "FileDescription", "Messaging\0"
+ VALUE "FileVersion", TAO_VERSION "\0"
+ VALUE "InternalName", "TAO_MessagingDLL\0"
+ VALUE "LegalCopyright", "\0"
+ VALUE "LegalTrademarks", "\0"
+ VALUE "OriginalFilename", "TAO_Messaging.DLL\0"
+ VALUE "ProductName", "TAO\0"
+ VALUE "ProductVersion", TAO_VERSION "\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
diff --git a/TAO/tao/Messaging/diffs/Messaging.diff b/TAO/tao/Messaging/diffs/Messaging.diff
new file mode 100644
index 00000000000..e7cb962f5a9
--- /dev/null
+++ b/TAO/tao/Messaging/diffs/Messaging.diff
@@ -0,0 +1,50 @@
+--- orig/MessagingC.h 2005-07-13 20:07:51.586041600 +0200
++++ MessagingC.h 2005-07-13 20:07:52.988057600 +0200
+@@ -40,6 +40,10 @@
+ # pragma once
+ #endif /* ACE_LACKS_PRAGMA_ONCE */
+
++#ifndef TAO_MESSAGING_SAFE_INCLUDE
++#error "You should not include MessagingC.h directly, use Messaging.h"
++#endif /* !TAO_MESSAGING_SAFE_INCLUDE */
++
+ #include "messaging_export.h"
+ #include "tao/Valuetype/ValueBase.h"
+ #include "tao/Valuetype/Valuetype_Adapter_Impl.h"
+--- orig/MessagingC.cpp 2005-07-13 20:07:51.586041600 +0200
++++ MessagingC.cpp 2005-07-13 20:07:52.998072000 +0200
+@@ -29,7 +29,7 @@
+ // be\be_codegen.cpp:291
+
+
+-#include "MessagingC.h"
++#include "Messaging.h"
+ #include "tao/CDR.h"
+ #include "tao/Object_T.h"
+ #include "tao/ORB_Core.h"
+--- orig/MessagingA.cpp 2005-07-13 20:07:51.586041600 +0200
++++ MessagingA.cpp 2005-07-13 20:07:53.028115200 +0200
+@@ -25,7 +25,7 @@
+ // Information about TAO is available at:
+ // http://www.cs.wustl.edu/~schmidt/TAO.html
+
+-#include "MessagingC.h"
++#include "Messaging.h"
+ #include "tao/Null_RefCount_Policy.h"
+ #include "tao/TypeCode_Constants.h"
+ #include "tao/Alias_TypeCode_Static.h"
+--- orig/MessagingS.h 2005-07-13 20:07:51.586041600 +0200
++++ MessagingS.h 2005-07-13 20:08:42.519280000 +0200
+@@ -33,11 +33,7 @@
+
+ #include /**/ "ace/pre.h"
+
+-#include "MessagingC.h"
+-#include "tao/Messaging/Messaging_SyncScope_PolicyS.h"
+-#include "tao/Messaging/Messaging_RT_PolicyS.h"
+-#include "tao/Messaging/Messaging_No_ImplS.h"
+-#include "tao/Messaging/PollableS.h"
+-#include "tao/Messaging/OldExceptionHolderS.h"
++#include "Messaging.h"
+
+ #if !defined (ACE_LACKS_PRAGMA_ONCE)
diff --git a/TAO/tao/Messaging/diffs/Messaging_No_Impl.diff b/TAO/tao/Messaging/diffs/Messaging_No_Impl.diff
new file mode 100644
index 00000000000..1f8dc881981
--- /dev/null
+++ b/TAO/tao/Messaging/diffs/Messaging_No_Impl.diff
@@ -0,0 +1,14 @@
+--- orig/Messaging_No_ImplC.h 2005-07-13 20:07:50.083881600 +0200
++++ Messaging_No_ImplC.h 2005-07-13 20:07:53.158302400 +0200
+@@ -51,6 +51,11 @@
+ #include "tao/TimeBaseC.h"
+ #include "tao/PolicyC.h"
+
++#if defined(TRANSPARENT)
++// Some platforms define this macro for ioctl()
++#undef TRANSPARENT
++#endif
++
+ #if defined (TAO_EXPORT_MACRO)
+ #undef TAO_EXPORT_MACRO
+ #endif
diff --git a/TAO/tao/Messaging/messaging_export.h b/TAO/tao/Messaging/messaging_export.h
new file mode 100644
index 00000000000..c71eb5c5eed
--- /dev/null
+++ b/TAO/tao/Messaging/messaging_export.h
@@ -0,0 +1,40 @@
+
+// -*- C++ -*-
+// $Id$
+// Definition for Win32 Export directives.
+// This file is generated automatically by generate_export_file.pl
+// ------------------------------
+#ifndef TAO_MESSAGING_EXPORT_H
+#define TAO_MESSAGING_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if defined (TAO_AS_STATIC_LIBS)
+# if !defined (TAO_MESSAGING_HAS_DLL)
+# define TAO_MESSAGING_HAS_DLL 0
+# endif /* ! TAO_MESSAGING_HAS_DLL */
+#else
+# if !defined (TAO_MESSAGING_HAS_DLL)
+# define TAO_MESSAGING_HAS_DLL 1
+# endif /* ! TAO_MESSAGING_HAS_DLL */
+#endif
+
+#if defined (TAO_MESSAGING_HAS_DLL) && (TAO_MESSAGING_HAS_DLL == 1)
+# if defined (TAO_MESSAGING_BUILD_DLL)
+# define TAO_Messaging_Export ACE_Proper_Export_Flag
+# define TAO_MESSAGING_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# define TAO_MESSAGING_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# else /* TAO_MESSAGING_BUILD_DLL */
+# define TAO_Messaging_Export ACE_Proper_Import_Flag
+# define TAO_MESSAGING_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# define TAO_MESSAGING_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# endif /* TAO_MESSAGING_BUILD_DLL */
+#else /* TAO_MESSAGING_HAS_DLL == 1 */
+# define TAO_Messaging_Export
+# define TAO_MESSAGING_SINGLETON_DECLARATION(T)
+# define TAO_MESSAGING_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+#endif /* TAO_MESSAGING_HAS_DLL == 1 */
+
+#endif /* TAO_MESSAGING_EXPORT_H */
+
+// End of auto generated file.
diff --git a/TAO/tao/Messaging_PolicyValue.pidl b/TAO/tao/Messaging_PolicyValue.pidl
new file mode 100644
index 00000000000..e52ea2a59e2
--- /dev/null
+++ b/TAO/tao/Messaging_PolicyValue.pidl
@@ -0,0 +1,45 @@
+// -*- IDL -*-
+/**
+ * @file Messaging_PolicyValue.pidl
+ *
+ * $Id$
+ *
+ * This file was used to generate the code in Messaging_PolicyValueC.{h,cpp}
+ *
+ * The command used to generate code from this file is:
+ *
+ * tao_idl
+ * -oA AnyTypeCode
+ * -Ge 1 -GA -SS -Sci
+ * -Wb,pre_include=ace/pre.h
+ * -Wb,post_include=ace/post.h
+ * -Wb,export_macro=TAO_Export
+ * -Wb,export_include=tao/TAO_Export.h
+ * -Wb,anyop_export_macro=TAO_AnyTypeCode_Export
+ * -Wb,anyop_export_include=tao/AnyTypeCode/TAO_AnyTypeCode_Export.h
+ * Messaging_PolicyValue.pidl
+ *
+ */
+#ifndef TAO_MESSAGING_POLICYVALUE_PIDL
+#define TAO_MESSAGING_POLICYVALUE_PIDL
+
+#include "tao/IOP_IOR.pidl"
+#include "tao/Policy_Forward.pidl"
+
+#pragma prefix "omg.org"
+
+module Messaging
+{
+ struct PolicyValue
+ {
+ CORBA::PolicyType ptype;
+ CORBA::OctetSeq pvalue;
+ };
+
+ typedef sequence<PolicyValue> PolicyValueSeq;
+
+ const IOP::ComponentId TAG_POLICIES = 2;
+ const IOP::ServiceId INVOCATION_POLICIES = 7;
+};
+
+#endif /* TAO_MESSAGING_POLICYVALUE_PIDL */
diff --git a/TAO/tao/Messaging_SyncScope.pidl b/TAO/tao/Messaging_SyncScope.pidl
new file mode 100644
index 00000000000..af498458ab4
--- /dev/null
+++ b/TAO/tao/Messaging_SyncScope.pidl
@@ -0,0 +1,34 @@
+// -*- IDL -*-
+/**
+ * @file Messaging_SyncScope.pidl
+ *
+ * $Id$
+ *
+ * This file was used to generate the code in Messaging_SyncScopeC.{h,inl,cpp}
+ *
+ * The command used to generate code from this file is:
+ *
+ * tao_idl.exe
+ * -o orig -St -Sci
+ * -Wb,export_macro=TAO_Export
+ * -Wb,export_include=tao/TAO_Export.h
+ * -Wb,pre_include="ace/pre.h"
+ * -Wb,post_include="ace/post.h"
+ * Messaging_SyncScope.pidl
+ *
+ */
+#ifndef TAO_MESSAGING_SYNCSCOPE_PIDL
+#define TAO_MESSAGING_SYNCSCOPE_PIDL
+
+#pragma prefix "omg.org"
+
+module Messaging
+{
+ typedef short SyncScope;
+ const SyncScope SYNC_NONE = 0;
+ const SyncScope SYNC_WITH_TRANSPORT = 1;
+ const SyncScope SYNC_WITH_SERVER = 2;
+ const SyncScope SYNC_WITH_TARGET = 3;
+};
+
+#endif /* TAO_MESSAGING_SYNCSCOPE_PIDL */
diff --git a/TAO/tao/Muxed_TMS.cpp b/TAO/tao/Muxed_TMS.cpp
new file mode 100644
index 00000000000..68df7c44eb5
--- /dev/null
+++ b/TAO/tao/Muxed_TMS.cpp
@@ -0,0 +1,232 @@
+// $Id$
+
+#include "tao/Muxed_TMS.h"
+#include "tao/Reply_Dispatcher.h"
+#include "tao/debug.h"
+#include "tao/Transport.h"
+#include "tao/ORB_Core.h"
+#include "tao/Client_Strategy_Factory.h"
+
+ACE_RCSID (tao,
+ Muxed_TMS,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Muxed_TMS::TAO_Muxed_TMS (TAO_Transport *transport)
+ : TAO_Transport_Mux_Strategy (transport)
+ , request_id_generator_ (0)
+ , orb_core_ (transport->orb_core ())
+ , dispatcher_table_ (this->orb_core_->client_factory ()->reply_dispatcher_table_size ())
+{
+ this->lock_ =
+ this->orb_core_->client_factory ()->create_transport_mux_strategy_lock ();
+}
+
+TAO_Muxed_TMS::~TAO_Muxed_TMS (void)
+{
+ delete this->lock_;
+}
+
+// Generate and return an unique request id for the current
+// invocation.
+CORBA::ULong
+TAO_Muxed_TMS::request_id (void)
+{
+ // @@ What is a good error return value?
+ ACE_GUARD_RETURN (ACE_Lock,
+ ace_mon,
+ *this->lock_,
+ 0);
+
+ ++this->request_id_generator_;
+
+ // if TAO_Transport::bidirectional_flag_
+ // == 1 --> originating side
+ // == 0 --> other side
+ // == -1 --> no bi-directional connection was negotiated
+ // The originating side must have an even request ID, and the other
+ // side must have an odd request ID. Make sure that is the case.
+ int bidir_flag =
+ this->transport_->bidirectional_flag ();
+
+ if ((bidir_flag == 1 && ACE_ODD (this->request_id_generator_))
+ || (bidir_flag == 0 && ACE_EVEN (this->request_id_generator_)))
+ ++this->request_id_generator_;
+
+ if (TAO_debug_level > 4)
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - Muxed_TMS[%d]::request_id, <%d>\n",
+ this->transport_->id (),
+ this->request_id_generator_));
+
+ return this->request_id_generator_;
+}
+
+// Bind the dispatcher with the request id.
+int
+TAO_Muxed_TMS::bind_dispatcher (CORBA::ULong request_id,
+ TAO_Reply_Dispatcher *rd)
+{
+ ACE_GUARD_RETURN (ACE_Lock,
+ ace_mon,
+ *this->lock_,
+ -1);
+
+ if (TAO_debug_level > 0 && rd == 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - TAO_Muxed_TMS::bind_dispatcher, ")
+ ACE_TEXT ("null reply dispatcher\n")));
+
+ if (rd == 0)
+ return 0;
+
+ int result =
+ this->dispatcher_table_.bind (request_id, rd);
+
+
+ if (result != 0)
+ {
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - TAO_Muxed_TMS::bind_dispatcher, ")
+ ACE_TEXT ("bind dispatcher failed: result = %d, request id = %d \n"),
+ result, request_id));
+
+ return -1;
+ }
+
+ return 0;
+}
+
+int
+TAO_Muxed_TMS::unbind_dispatcher (CORBA::ULong request_id)
+{
+ ACE_GUARD_RETURN (ACE_Lock,
+ ace_mon,
+ *this->lock_,
+ -1);
+ TAO_Reply_Dispatcher *rd = 0;
+
+ // @@TODO: WTH are we sending the rd in? We can just unbind using
+ // the request_id
+ return this->dispatcher_table_.unbind (request_id, rd);
+}
+
+int
+TAO_Muxed_TMS::dispatch_reply (TAO_Pluggable_Reply_Params &params)
+{
+ int result = 0;
+ TAO_Reply_Dispatcher *rd = 0;
+
+ // Grab the reply dispatcher for this id.
+ {
+ ACE_GUARD_RETURN (ACE_Lock,
+ ace_mon,
+ *this->lock_,
+ -1);
+
+ result =
+ this->dispatcher_table_.unbind (params.request_id_, rd);
+
+ if (TAO_debug_level > 8)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - TAO_Muxed_TMS::dispatch_reply, ")
+ ACE_TEXT ("id = %d\n"),
+ params.request_id_));
+
+ if (result != 0)
+ {
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - TAO_Muxed_TMS::dispatch_reply, ")
+ ACE_TEXT ("unbind dispatcher failed: result = %d\n"),
+ result));
+
+ // This return value means that the mux strategy was not able
+ // to find a registered reply handler, either because the reply
+ // was not our reply - just forget about it - or it was ours, but
+ // the reply timed out - just forget about the reply.
+ return 0;
+ }
+
+ // Do not move it outside the scope of the lock. A follower thread
+ // could have timedout unwinding the stack and the reply
+ // dispatcher, and that would mean the present thread could be left
+ // with a dangling pointer and may crash. To safeguard againt such
+ // cases we dispatch with the lock held.
+ // Dispatch the reply.
+ // They return 1 on success, and -1 on failure.
+ result = rd->dispatch_reply (params);
+ }
+
+ return result;
+}
+
+bool
+TAO_Muxed_TMS::idle_after_send (void)
+{
+ // Irrespective of whether we are successful or not we need to
+ // return true. If *this* class is not successfull in idling the
+ // transport no one can.
+ if (this->transport_ != 0)
+ (void) this->transport_->make_idle ();
+
+ return true;
+}
+
+bool
+TAO_Muxed_TMS::idle_after_reply (void)
+{
+ return false;
+}
+
+void
+TAO_Muxed_TMS::connection_closed (void)
+{
+ ACE_GUARD (ACE_Lock,
+ ace_mon,
+ *this->lock_);
+
+ int retval = 0;
+ do
+ {
+ retval = this->clear_cache ();
+ }
+ while (retval != -1);
+
+}
+
+int
+TAO_Muxed_TMS::clear_cache (void)
+{
+ if (this->dispatcher_table_.current_size () == 0)
+ return -1;
+
+ REQUEST_DISPATCHER_TABLE::ITERATOR const end =
+ this->dispatcher_table_.end ();
+
+ ACE_Unbounded_Stack <TAO_Reply_Dispatcher *> ubs;
+
+ for (REQUEST_DISPATCHER_TABLE::ITERATOR i =
+ this->dispatcher_table_.begin ();
+ i != end;
+ ++i)
+ ubs.push ((*i).int_id_);
+
+ this->dispatcher_table_.unbind_all ();
+ size_t const sz = ubs.size ();
+
+ for (size_t k = 0 ; k != sz ; ++k)
+ {
+ TAO_Reply_Dispatcher *rd = 0;
+
+ ubs.pop (rd);
+
+ rd->connection_closed ();
+ }
+
+ return 0;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Muxed_TMS.h b/TAO/tao/Muxed_TMS.h
new file mode 100644
index 00000000000..974fa62ae99
--- /dev/null
+++ b/TAO/tao/Muxed_TMS.h
@@ -0,0 +1,98 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Muxed_TMS.h
+ *
+ * $Id$
+ *
+ * @author Alexander Babu Arulanthu <alex@cs.wustl.edu>
+ */
+//=============================================================================
+
+
+#ifndef TAO_MUXED_TMS_H
+#define TAO_MUXED_TMS_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Transport_Mux_Strategy.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/Hash_Map_Manager_T.h"
+#include "ace/Null_Mutex.h"
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_ORB_Core;
+class TAO_Pluggable_Reply_Params;
+
+/**
+ * @class TAO_Muxed_TMS
+ *
+ * Using this strategy a single connection can have multiple
+ * outstanding requests.
+ * @@ Can the performance of the demuxer be made more predictable,
+ * for example, using the request id as an active demux key?
+ * @note Check the OMG resolutions about bidirectional
+ * connections, it is possible that the request ids can only
+ * assume even or odd values.
+ */
+class TAO_Export TAO_Muxed_TMS : public TAO_Transport_Mux_Strategy
+{
+
+public:
+ /// Constructor.
+ TAO_Muxed_TMS (TAO_Transport *transport);
+
+ /// Destructor.
+ virtual ~TAO_Muxed_TMS (void);
+
+ /// Generate and return an unique request id for the current
+ /// invocation.
+ virtual CORBA::ULong request_id (void);
+
+ // = Please read the documentation in the TAO_Transport_Mux_Strategy
+ // class.
+ virtual int bind_dispatcher (CORBA::ULong request_id,
+ TAO_Reply_Dispatcher *rh);
+ virtual int unbind_dispatcher (CORBA::ULong request_id);
+
+ virtual int dispatch_reply (TAO_Pluggable_Reply_Params &params);
+
+ virtual bool idle_after_send (void);
+ virtual bool idle_after_reply (void);
+ virtual void connection_closed (void);
+
+protected:
+ /// Used to generate a different request_id on each call to
+ /// request_id().
+ CORBA::ULong request_id_generator_;
+
+ /// Keep track of the orb core pointer. We need to this to create the
+ /// Reply Dispatchers.
+ TAO_ORB_Core * const orb_core_;
+
+ typedef ACE_Hash_Map_Manager_Ex <CORBA::ULong,
+ TAO_Reply_Dispatcher *,
+ ACE_Hash <CORBA::ULong>,
+ ACE_Equal_To <CORBA::ULong>,
+ ACE_Null_Mutex>
+ REQUEST_DISPATCHER_TABLE;
+
+ /// Table of <Request ID, Reply Dispatcher> pairs.
+ REQUEST_DISPATCHER_TABLE dispatcher_table_;
+
+protected:
+ int clear_cache (void);
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* MUXED_TMS_H */
diff --git a/TAO/tao/NVList_Adapter.cpp b/TAO/tao/NVList_Adapter.cpp
new file mode 100644
index 00000000000..063f473ac6d
--- /dev/null
+++ b/TAO/tao/NVList_Adapter.cpp
@@ -0,0 +1,15 @@
+// $Id$
+
+#include "tao/NVList_Adapter.h"
+
+ACE_RCSID (tao,
+ NVList_Adapter,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_NVList_Adapter::~TAO_NVList_Adapter (void)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/NVList_Adapter.h b/TAO/tao/NVList_Adapter.h
new file mode 100644
index 00000000000..e9bc13af0ec
--- /dev/null
+++ b/TAO/tao/NVList_Adapter.h
@@ -0,0 +1,64 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file NVList_Adapter.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_NVLIST_ADAPTER_H
+#define TAO_NVLIST_ADAPTER_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/TAO_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Basic_Types.h"
+
+#include "ace/Service_Object.h"
+#include "ace/CORBA_macros.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace CORBA
+{
+ class NVList;
+ typedef NVList *NVList_ptr;
+
+ class NamedValue;
+ typedef NamedValue *NamedValue_ptr;
+
+ class Environment;
+}
+
+/**
+ * @class TAO_NVList_Adapter
+ */
+class TAO_Export TAO_NVList_Adapter : public ACE_Service_Object
+{
+public:
+ virtual ~TAO_NVList_Adapter (void);
+
+ virtual void create_list (
+ CORBA::Long count,
+ CORBA::NVList_ptr &new_list
+ ACE_ENV_ARG_DECL) = 0;
+
+ virtual void create_named_value (
+ CORBA::NamedValue_ptr &nv
+ ACE_ENV_ARG_DECL) = 0;
+
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_NVLIST_ADAPTER_H */
diff --git a/TAO/tao/New_Leader_Generator.cpp b/TAO/tao/New_Leader_Generator.cpp
new file mode 100644
index 00000000000..5edd8e55e60
--- /dev/null
+++ b/TAO/tao/New_Leader_Generator.cpp
@@ -0,0 +1,17 @@
+// $Id$
+
+#include "tao/New_Leader_Generator.h"
+
+
+ACE_RCSID (tao,
+ New_Leader_Generator,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_New_Leader_Generator::~TAO_New_Leader_Generator (void)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/New_Leader_Generator.h b/TAO/tao/New_Leader_Generator.h
new file mode 100644
index 00000000000..fdb96209dea
--- /dev/null
+++ b/TAO/tao/New_Leader_Generator.h
@@ -0,0 +1,51 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file New_Leader_Generator.h
+ *
+ * $Id$
+ *
+ * @author Irfan Pyarali
+ */
+// ===================================================================
+
+#ifndef TAO_NEW_LEADER_GENERATOR_H
+#define TAO_NEW_LEADER_GENERATOR_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/TAO_Export.h"
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_New_Leader_Generator
+ *
+ * @brief Class for creating dynamic threads.
+ *
+ * \nosubgrouping
+ *
+ **/
+class TAO_Export TAO_New_Leader_Generator
+{
+public:
+
+ /// Destructor.
+ virtual ~TAO_New_Leader_Generator (void);
+
+ /// Leader/Follower class uses this method to notify the system that
+ /// we are out of leaders.
+ virtual void no_leaders_available (void) = 0;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_NEW_LEADER_GENERATOR_H */
diff --git a/TAO/tao/Null_Fragmentation_Strategy.cpp b/TAO/tao/Null_Fragmentation_Strategy.cpp
new file mode 100644
index 00000000000..79ddde5c290
--- /dev/null
+++ b/TAO/tao/Null_Fragmentation_Strategy.cpp
@@ -0,0 +1,17 @@
+// $Id$
+
+
+#include "tao/Null_Fragmentation_Strategy.h"
+
+
+TAO_Null_Fragmentation_Strategy::~TAO_Null_Fragmentation_Strategy (void)
+{
+}
+
+int
+TAO_Null_Fragmentation_Strategy::fragment (TAO_OutputCDR &,
+ ACE_CDR::ULong,
+ ACE_CDR::ULong)
+{
+ return 0;
+}
diff --git a/TAO/tao/Null_Fragmentation_Strategy.h b/TAO/tao/Null_Fragmentation_Strategy.h
new file mode 100644
index 00000000000..ace58815d2d
--- /dev/null
+++ b/TAO/tao/Null_Fragmentation_Strategy.h
@@ -0,0 +1,64 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Null_Fragmentation_Strategy.h
+ *
+ * $Id$
+ *
+ * @author Ossama Othman <ossama@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_NULL_FRAGMENTATION_STRATEGY_H
+#define TAO_NULL_FRAGMENTATION_STRATEGY_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/GIOP_Fragmentation_Strategy.h"
+#include "ace/CDR_Base.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_OutputCDR;
+
+
+/**
+ * @class TAO_Null_Fragmenation_Strategy
+ *
+ * @brief Null GIOP message fragmentation strategy.
+ *
+ * No-op GIOP message fragmentation strategy. This strategy performs
+ * no GIOP fragmentation.
+ *
+ * @see TAO_GIOP_Fragmentation_Strategy
+ */
+class TAO_Null_Fragmentation_Strategy
+ : public TAO_GIOP_Fragmentation_Strategy
+{
+public:
+
+ TAO_Null_Fragmentation_Strategy (void) {}
+ virtual ~TAO_Null_Fragmentation_Strategy (void);
+ virtual int fragment (TAO_OutputCDR &,
+ ACE_CDR::ULong,
+ ACE_CDR::ULong);
+
+private:
+
+ // Disallow copying and assignment.
+ TAO_Null_Fragmentation_Strategy (TAO_Null_Fragmentation_Strategy const &);
+ void operator= (TAO_Null_Fragmentation_Strategy const &);
+
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_NULL_FRAGMENTATION_STRATEGY_H */
diff --git a/TAO/tao/ORB.cpp b/TAO/tao/ORB.cpp
new file mode 100644
index 00000000000..055fde725e6
--- /dev/null
+++ b/TAO/tao/ORB.cpp
@@ -0,0 +1,2009 @@
+// "$Id$"
+
+#include "tao/ORB.h"
+
+ACE_RCSID (tao,
+ ORB,
+ "$Id$")
+
+#include "tao/ORB_Table.h"
+#include "tao/Connector_Registry.h"
+#include "tao/IOR_Parser.h"
+#include "tao/Stub.h"
+#include "tao/ORB_Core.h"
+#include "tao/ORB_Core_TSS_Resources.h"
+#include "tao/TAO_Internal.h"
+#include "tao/Dynamic_Adapter.h"
+#include "tao/Profile.h"
+#include "tao/default_ports.h"
+#include "tao/ORBInitializer_Registry_Adapter.h"
+#include "tao/PolicyFactory_Registry_Adapter.h"
+#include "tao/NVList_Adapter.h"
+#include "tao/TAO_Singleton_Manager.h"
+#include "tao/Policy_Current.h"
+#include "tao/Policy_Manager.h"
+#include "tao/Valuetype_Adapter.h"
+#include "tao/IFR_Client_Adapter.h"
+#include "tao/TypeCodeFactory_Adapter.h"
+#include "tao/debug.h"
+#include "tao/CDR.h"
+#include "tao/SystemException.h"
+#include "tao/default_environment.h"
+#include "tao/ObjectIdListC.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/ORB.i"
+#endif /* ! __ACE_INLINE__ */
+
+#include "ace/Dynamic_Service.h"
+#include "ace/Service_Config.h"
+#include "ace/Arg_Shifter.h"
+#include "ace/Reactor.h"
+#include "ace/Argv_Type_Converter.h"
+#include "ace/ACE.h"
+#include "ace/Static_Object_Lock.h"
+#include "ace/OS_NS_strings.h"
+#include "ace/OS_NS_string.h"
+#include "ace/os_include/os_ctype.h"
+
+#if defined (ACE_HAS_EXCEPTIONS)
+void TAO_unexpected_exception_handler (void)
+{
+ throw CORBA::UNKNOWN ();
+}
+#endif /* ACE_HAS_EXCEPTIONS */
+
+static const char ior_prefix[] = "IOR:";
+
+// = Static initialization.
+
+namespace
+{
+ // Count of the number of ORBs.
+ int orb_init_count = 0;
+}
+
+// ****************************************************************
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+CORBA::ORB::InvalidName::InvalidName (void)
+ : CORBA::UserException ("IDL:omg.org/CORBA/ORB/InvalidName:1.0",
+ "InvalidName")
+{
+}
+
+// Destructor - all members are of self managing types.
+CORBA::ORB::InvalidName::~InvalidName (void)
+{
+}
+
+// Copy constructor.
+CORBA::ORB::InvalidName::InvalidName (const CORBA::ORB::InvalidName &exc)
+ : CORBA::UserException (exc._rep_id (),
+ exc._name ())
+{
+}
+
+// Assignment operator.
+CORBA::ORB::InvalidName&
+CORBA::ORB::InvalidName::operator= (const ::CORBA::ORB::InvalidName &_tao_excp)
+{
+ this->UserException::operator= (_tao_excp);
+ return *this;
+}
+
+CORBA::ORB::InvalidName *
+CORBA::ORB::InvalidName::_downcast (CORBA::Exception *exc)
+{
+ return dynamic_cast<InvalidName *> (exc);
+}
+
+CORBA::Exception *CORBA::ORB::InvalidName::_alloc (void)
+{
+ CORBA::Exception *retval = 0;
+ ACE_NEW_RETURN (retval, ::CORBA::ORB::InvalidName, 0);
+ return retval;
+}
+
+CORBA::Exception *
+CORBA::ORB::InvalidName::_tao_duplicate (void) const
+{
+ CORBA::Exception *result = 0;
+ ACE_NEW_RETURN (
+ result,
+ ::CORBA::ORB::InvalidName (*this),
+ 0
+ );
+ return result;
+}
+
+void CORBA::ORB::InvalidName::_raise (void) const
+{
+ TAO_RAISE (*this);
+}
+
+void CORBA::ORB::InvalidName::_tao_encode (
+ TAO_OutputCDR &
+ ACE_ENV_ARG_DECL
+ ) const
+{
+ ACE_THROW (CORBA::MARSHAL ());
+}
+
+void CORBA::ORB::InvalidName::_tao_decode (
+ TAO_InputCDR &
+ ACE_ENV_ARG_DECL
+ )
+{
+ ACE_THROW (CORBA::MARSHAL ());
+}
+
+// ****************************************************************
+
+CORBA::ORB::ORB (TAO_ORB_Core *orb_core)
+ : refcount_ (1)
+ , orb_core_ (orb_core)
+ , use_omg_ior_format_ (1)
+ , timeout_ (0)
+{
+}
+
+CORBA::ORB::~ORB (void)
+{
+ // This destructor is only invoked when the last ORB reference (not
+ // instance) is being destroyed.
+}
+
+void
+CORBA::ORB::shutdown (CORBA::Boolean wait_for_completion
+ ACE_ENV_ARG_DECL)
+{
+ // We cannot lock the exceptions here. We need to propogate
+ // BAD_INV_ORDER exceptions if needed to the caller. Locking
+ // exceptions down would render us non-compliant with the spec.
+ this->check_shutdown (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->orb_core ()->shutdown (wait_for_completion
+ ACE_ENV_ARG_PARAMETER);
+}
+
+void
+CORBA::ORB::destroy (ACE_ENV_SINGLE_ARG_DECL)
+{
+ if (this->orb_core () == 0)
+ {
+ // If the ORB_Core pointer is zero, assume that the ORB_Core has
+ // been destroyed.
+
+ // As defined by the CORBA 2.3 specification, throw a
+ // CORBA::OBJECT_NOT_EXIST exception if the ORB has been
+ // destroyed by the time an ORB function is called.
+
+ ACE_THROW (CORBA::OBJECT_NOT_EXIST (0,
+ CORBA::COMPLETED_NO));
+ }
+
+ if (TAO_debug_level > 2)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("CORBA::ORB::destroy() called on ORB <%s>.\n"),
+ ACE_TEXT_CHAR_TO_TCHAR (this->orb_core ()->orbid ())));
+ }
+
+ this->orb_core ()->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Now invalidate the pointer to the ORB_Core that created this
+ // ORB.
+ this->orb_core_ = 0;
+}
+
+void
+CORBA::ORB::run (ACE_ENV_SINGLE_ARG_DECL)
+{
+ this->run (0 ACE_ENV_ARG_PARAMETER);
+}
+
+void
+CORBA::ORB::run (ACE_Time_Value &tv ACE_ENV_ARG_DECL)
+{
+ this->run (&tv ACE_ENV_ARG_PARAMETER);
+}
+
+void
+CORBA::ORB::run (ACE_Time_Value *tv
+ ACE_ENV_ARG_DECL)
+{
+ this->check_shutdown (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->orb_core ()->run (tv, 0 ACE_ENV_ARG_PARAMETER);
+}
+
+void
+CORBA::ORB::perform_work (ACE_ENV_SINGLE_ARG_DECL)
+{
+ this->perform_work (0 ACE_ENV_ARG_PARAMETER);
+}
+
+void
+CORBA::ORB::perform_work (ACE_Time_Value &tv ACE_ENV_ARG_DECL)
+{
+ this->perform_work (&tv ACE_ENV_ARG_PARAMETER);
+}
+
+void
+CORBA::ORB::perform_work (ACE_Time_Value *tv
+ ACE_ENV_ARG_DECL)
+{
+ // This method should not be called if the ORB has been shutdown.
+ this->check_shutdown (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->orb_core ()->run (tv, 1 ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::Boolean
+CORBA::ORB::work_pending (ACE_Time_Value &tv ACE_ENV_ARG_DECL)
+{
+ // This method should not be called if the ORB has been shutdown.
+ this->check_shutdown (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ int const result = this->orb_core_->reactor ()->work_pending (tv);
+ if (result == 0 || (result == -1 && errno == ETIME))
+ return 0;
+
+ if (result == -1)
+ ACE_THROW_RETURN (CORBA::INTERNAL (), 0);
+
+ return 1;
+}
+
+CORBA::Boolean
+CORBA::ORB::work_pending (ACE_ENV_SINGLE_ARG_DECL)
+{
+ // This method should not be called if the ORB has been shutdown.
+ this->check_shutdown (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ const int result = this->orb_core_->reactor ()->work_pending ();
+ if (result == 0)
+ return 0;
+
+ if (result == -1)
+ ACE_THROW_RETURN (CORBA::INTERNAL (), 0);
+
+ return 1;
+}
+
+#if (TAO_HAS_MINIMUM_CORBA == 0)
+
+void
+CORBA::ORB::create_list (CORBA::Long count,
+ CORBA::NVList_ptr &new_list
+ ACE_ENV_ARG_DECL)
+{
+ TAO_NVList_Adapter *adapter =
+ ACE_Dynamic_Service<TAO_NVList_Adapter>::instance (
+ "TAO_NVList_Adapter"
+ );
+
+ if (adapter == 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) %p\n"),
+ ACE_TEXT ("ORB unable to find the ")
+ ACE_TEXT ("NVList Adapter instance")));
+ ACE_THROW (CORBA::INTERNAL ());
+ }
+
+ adapter->create_list (count, new_list ACE_ENV_ARG_PARAMETER);
+}
+
+void
+CORBA::ORB::create_exception_list (CORBA::ExceptionList_ptr &list
+ ACE_ENV_ARG_DECL)
+{
+ TAO_Dynamic_Adapter *dynamic_adapter =
+ ACE_Dynamic_Service<TAO_Dynamic_Adapter>::instance (
+ TAO_ORB_Core::dynamic_adapter_name ()
+ );
+
+ dynamic_adapter->create_exception_list (list
+ ACE_ENV_ARG_PARAMETER);
+}
+
+void
+CORBA::ORB::create_operation_list (CORBA::OperationDef_ptr opDef,
+ CORBA::NVList_ptr &result
+ ACE_ENV_ARG_DECL)
+{
+ TAO_IFR_Client_Adapter *adapter =
+ ACE_Dynamic_Service<TAO_IFR_Client_Adapter>::instance (
+ TAO_ORB_Core::ifr_client_adapter_name ()
+ );
+
+ if (adapter == 0)
+ {
+ ACE_THROW (CORBA::INTF_REPOS ());
+ }
+
+ adapter->create_operation_list (this,
+ opDef,
+ result
+ ACE_ENV_ARG_PARAMETER);
+}
+
+
+void
+CORBA::ORB::create_environment (CORBA::Environment_ptr &environment
+ ACE_ENV_ARG_DECL)
+{
+ ACE_NEW_THROW_EX (environment,
+ CORBA::Environment (),
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ 0,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+}
+
+void
+CORBA::ORB::create_named_value (CORBA::NamedValue_ptr &nv
+ ACE_ENV_ARG_DECL)
+{
+ TAO_NVList_Adapter *adapter =
+ ACE_Dynamic_Service<TAO_NVList_Adapter>::instance (
+ "TAO_NVList_Adapter"
+ );
+
+ if (adapter == 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) %p\n"),
+ ACE_TEXT ("ORB unable to find the ")
+ ACE_TEXT ("NVList Adapter instance")));
+
+ ACE_THROW (CORBA::INTERNAL ());
+ }
+
+ adapter->create_named_value (nv ACE_ENV_ARG_PARAMETER);
+}
+
+// The following functions are not implemented - they just throw
+// CORBA::NO_IMPLEMENT.
+
+CORBA::Boolean
+CORBA::ORB::get_service_information (
+ CORBA::ServiceType /* service_type */,
+ CORBA::ServiceInformation_out /* service_information */
+ ACE_ENV_ARG_DECL)
+{
+ ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (
+ CORBA::SystemException::_tao_minor_code (
+ 0,
+ ENOTSUP),
+ CORBA::COMPLETED_NO),
+ 0);
+}
+
+void
+CORBA::ORB::create_context_list (CORBA::ContextList_ptr &
+ ACE_ENV_ARG_DECL)
+{
+ ACE_THROW (CORBA::NO_IMPLEMENT (
+ CORBA::SystemException::_tao_minor_code (
+ 0,
+ ENOTSUP),
+ CORBA::COMPLETED_NO));
+}
+
+void
+CORBA::ORB::get_default_context (CORBA::Context_ptr &
+ ACE_ENV_ARG_DECL)
+{
+ ACE_THROW (CORBA::NO_IMPLEMENT (
+ CORBA::SystemException::_tao_minor_code (
+ 0,
+ ENOTSUP),
+ CORBA::COMPLETED_NO));
+}
+
+void
+CORBA::ORB::send_multiple_requests_oneway (const CORBA::RequestSeq &
+ ACE_ENV_ARG_DECL)
+{
+ ACE_THROW (CORBA::NO_IMPLEMENT (
+ CORBA::SystemException::_tao_minor_code (
+ 0,
+ ENOTSUP),
+ CORBA::COMPLETED_NO));
+}
+
+void
+CORBA::ORB::send_multiple_requests_deferred (const CORBA::RequestSeq &
+ ACE_ENV_ARG_DECL)
+{
+ ACE_THROW (CORBA::NO_IMPLEMENT (
+ CORBA::SystemException::_tao_minor_code (
+ 0,
+ ENOTSUP),
+ CORBA::COMPLETED_NO));
+}
+
+void
+CORBA::ORB::get_next_response (CORBA::Request_ptr &
+ ACE_ENV_ARG_DECL)
+{
+ ACE_THROW (CORBA::NO_IMPLEMENT (
+ CORBA::SystemException::_tao_minor_code (
+ 0,
+ ENOTSUP),
+ CORBA::COMPLETED_NO));
+}
+
+CORBA::Boolean
+CORBA::ORB::poll_next_response (ACE_ENV_SINGLE_ARG_DECL)
+{
+ ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (
+ CORBA::SystemException::_tao_minor_code (
+ 0,
+ ENOTSUP),
+ CORBA::COMPLETED_NO),
+ 0);
+}
+
+// ****************************************************************
+
+CORBA::TypeCode_ptr
+CORBA::ORB::create_struct_tc (
+ const char *id,
+ const char *name,
+ const CORBA::StructMemberSeq & members
+ ACE_ENV_ARG_DECL
+ )
+{
+ TAO_TypeCodeFactory_Adapter *adapter =
+ ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance (
+ TAO_ORB_Core::typecodefactory_adapter_name ()
+ );
+
+ if (adapter == 0)
+ {
+ ACE_THROW_RETURN (CORBA::INTERNAL (),
+ 0);
+ }
+
+ return adapter->create_struct_tc (id,
+ name,
+ members
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::TypeCode_ptr
+CORBA::ORB::create_union_tc (
+ const char *id,
+ const char *name,
+ CORBA::TypeCode_ptr discriminator_type,
+ const CORBA::UnionMemberSeq & members
+ ACE_ENV_ARG_DECL
+ )
+{
+ TAO_TypeCodeFactory_Adapter *adapter =
+ ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance (
+ TAO_ORB_Core::typecodefactory_adapter_name ()
+ );
+
+ if (adapter == 0)
+ {
+ ACE_THROW_RETURN (CORBA::INTERNAL (),
+ 0);
+ }
+
+ return adapter->create_union_tc (id,
+ name,
+ discriminator_type,
+ members
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::TypeCode_ptr
+CORBA::ORB::create_enum_tc (
+ const char *id,
+ const char *name,
+ const CORBA::EnumMemberSeq & members
+ ACE_ENV_ARG_DECL
+ )
+{
+ TAO_TypeCodeFactory_Adapter *adapter =
+ ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance (
+ TAO_ORB_Core::typecodefactory_adapter_name ()
+ );
+
+ if (adapter == 0)
+ {
+ ACE_THROW_RETURN (CORBA::INTERNAL (),
+ 0);
+ }
+
+ return adapter->create_enum_tc (id,
+ name,
+ members
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::TypeCode_ptr
+CORBA::ORB::create_alias_tc (
+ const char *id,
+ const char *name,
+ CORBA::TypeCode_ptr original_type
+ ACE_ENV_ARG_DECL
+ )
+{
+ TAO_TypeCodeFactory_Adapter *adapter =
+ ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance (
+ TAO_ORB_Core::typecodefactory_adapter_name ()
+ );
+
+ if (adapter == 0)
+ {
+ ACE_THROW_RETURN (CORBA::INTERNAL (),
+ 0);
+ }
+
+ return adapter->create_alias_tc (id,
+ name,
+ original_type
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::TypeCode_ptr
+CORBA::ORB::create_exception_tc (
+ const char *id,
+ const char *name,
+ const CORBA::StructMemberSeq & members
+ ACE_ENV_ARG_DECL
+ )
+{
+ TAO_TypeCodeFactory_Adapter *adapter =
+ ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance (
+ TAO_ORB_Core::typecodefactory_adapter_name ()
+ );
+
+ if (adapter == 0)
+ {
+ ACE_THROW_RETURN (CORBA::INTERNAL (),
+ 0);
+ }
+
+ return adapter->create_exception_tc (id,
+ name,
+ members
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::TypeCode_ptr
+CORBA::ORB::create_interface_tc (
+ const char *id,
+ const char *name
+ ACE_ENV_ARG_DECL
+ )
+{
+ TAO_TypeCodeFactory_Adapter *adapter =
+ ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance (
+ TAO_ORB_Core::typecodefactory_adapter_name ()
+ );
+
+ if (adapter == 0)
+ {
+ ACE_THROW_RETURN (CORBA::INTERNAL (),
+ 0);
+ }
+
+ return adapter->create_interface_tc (id,
+ name
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::TypeCode_ptr
+CORBA::ORB::create_string_tc (
+ CORBA::ULong bound
+ ACE_ENV_ARG_DECL
+ )
+{
+ TAO_TypeCodeFactory_Adapter *adapter =
+ ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance (
+ TAO_ORB_Core::typecodefactory_adapter_name ()
+ );
+
+ if (adapter == 0)
+ {
+ ACE_THROW_RETURN (CORBA::INTERNAL (),
+ 0);
+ }
+
+ return adapter->create_string_tc (bound
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::TypeCode_ptr
+CORBA::ORB::create_wstring_tc (
+ CORBA::ULong bound
+ ACE_ENV_ARG_DECL
+ )
+{
+ TAO_TypeCodeFactory_Adapter *adapter =
+ ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance (
+ TAO_ORB_Core::typecodefactory_adapter_name ()
+ );
+
+ if (adapter == 0)
+ {
+ ACE_THROW_RETURN (CORBA::INTERNAL (),
+ 0);
+ }
+
+ return adapter->create_wstring_tc (bound
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::TypeCode_ptr
+CORBA::ORB::create_fixed_tc (
+ CORBA::UShort digits,
+ CORBA::UShort scale
+ ACE_ENV_ARG_DECL
+ )
+{
+ TAO_TypeCodeFactory_Adapter *adapter =
+ ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance (
+ TAO_ORB_Core::typecodefactory_adapter_name ()
+ );
+
+ if (adapter == 0)
+ {
+ ACE_THROW_RETURN (CORBA::INTERNAL (),
+ 0);
+ }
+
+ return adapter->create_fixed_tc (digits,
+ scale
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::TypeCode_ptr
+CORBA::ORB::create_sequence_tc (
+ CORBA::ULong bound,
+ CORBA::TypeCode_ptr element_type
+ ACE_ENV_ARG_DECL
+ )
+{
+ TAO_TypeCodeFactory_Adapter *adapter =
+ ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance (
+ TAO_ORB_Core::typecodefactory_adapter_name ()
+ );
+
+ if (adapter == 0)
+ {
+ ACE_THROW_RETURN (CORBA::INTERNAL (),
+ 0);
+ }
+
+ return adapter->create_sequence_tc (bound,
+ element_type
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::TypeCode_ptr
+CORBA::ORB::create_array_tc (
+ CORBA::ULong length,
+ CORBA::TypeCode_ptr element_type
+ ACE_ENV_ARG_DECL
+ )
+{
+ TAO_TypeCodeFactory_Adapter *adapter =
+ ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance (
+ TAO_ORB_Core::typecodefactory_adapter_name ()
+ );
+
+ if (adapter == 0)
+ {
+ ACE_THROW_RETURN (CORBA::INTERNAL (),
+ 0);
+ }
+
+ return adapter->create_array_tc (length,
+ element_type
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::TypeCode_ptr
+CORBA::ORB::create_value_tc (
+ const char *id,
+ const char *name,
+ CORBA::ValueModifier type_modifier,
+ CORBA::TypeCode_ptr concrete_base,
+ const CORBA::ValueMemberSeq & members
+ ACE_ENV_ARG_DECL
+ )
+{
+ TAO_TypeCodeFactory_Adapter *adapter =
+ ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance (
+ TAO_ORB_Core::typecodefactory_adapter_name ()
+ );
+
+ if (adapter == 0)
+ {
+ ACE_THROW_RETURN (CORBA::INTERNAL (),
+ 0);
+ }
+
+ return adapter->create_value_tc (id,
+ name,
+ type_modifier,
+ concrete_base,
+ members
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::TypeCode_ptr
+CORBA::ORB::create_value_box_tc (
+ const char *id,
+ const char *name,
+ CORBA::TypeCode_ptr boxed_type
+ ACE_ENV_ARG_DECL
+ )
+{
+ TAO_TypeCodeFactory_Adapter *adapter =
+ ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance (
+ TAO_ORB_Core::typecodefactory_adapter_name ()
+ );
+
+ if (adapter == 0)
+ {
+ ACE_THROW_RETURN (CORBA::INTERNAL (),
+ 0);
+ }
+
+ return adapter->create_value_box_tc (id,
+ name,
+ boxed_type
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::TypeCode_ptr
+CORBA::ORB::create_native_tc (
+ const char *id,
+ const char *name
+ ACE_ENV_ARG_DECL
+ )
+{
+ TAO_TypeCodeFactory_Adapter *adapter =
+ ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance (
+ TAO_ORB_Core::typecodefactory_adapter_name ()
+ );
+
+ if (adapter == 0)
+ {
+ ACE_THROW_RETURN (CORBA::INTERNAL (),
+ 0);
+ }
+
+ return adapter->create_native_tc (id,
+ name
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::TypeCode_ptr
+CORBA::ORB::create_recursive_tc (
+ const char *id
+ ACE_ENV_ARG_DECL
+ )
+{
+ TAO_TypeCodeFactory_Adapter *adapter =
+ ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance (
+ TAO_ORB_Core::typecodefactory_adapter_name ()
+ );
+
+ if (adapter == 0)
+ {
+ ACE_THROW_RETURN (CORBA::INTERNAL (),
+ 0);
+ }
+
+ return adapter->create_recursive_tc (id
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::TypeCode_ptr
+CORBA::ORB::create_abstract_interface_tc (
+ const char *id,
+ const char *name
+ ACE_ENV_ARG_DECL
+ )
+{
+ TAO_TypeCodeFactory_Adapter *adapter =
+ ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance (
+ TAO_ORB_Core::typecodefactory_adapter_name ()
+ );
+
+ if (adapter == 0)
+ {
+ ACE_THROW_RETURN (CORBA::INTERNAL (),
+ 0);
+ }
+
+ return adapter->create_abstract_interface_tc (id,
+ name
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::TypeCode_ptr
+CORBA::ORB::create_local_interface_tc (
+ const char *id,
+ const char *name
+ ACE_ENV_ARG_DECL
+ )
+{
+ TAO_TypeCodeFactory_Adapter *adapter =
+ ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance (
+ TAO_ORB_Core::typecodefactory_adapter_name ()
+ );
+
+ if (adapter == 0)
+ {
+ ACE_THROW_RETURN (CORBA::INTERNAL (),
+ 0);
+ }
+
+ return adapter->create_local_interface_tc (id,
+ name
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::TypeCode_ptr
+CORBA::ORB::create_component_tc (
+ const char *id,
+ const char *name
+ ACE_ENV_ARG_DECL
+ )
+{
+ TAO_TypeCodeFactory_Adapter *adapter =
+ ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance (
+ TAO_ORB_Core::typecodefactory_adapter_name ()
+ );
+
+ if (adapter == 0)
+ {
+ ACE_THROW_RETURN (CORBA::INTERNAL (),
+ 0);
+ }
+
+ return adapter->create_component_tc (id,
+ name
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::TypeCode_ptr
+CORBA::ORB::create_home_tc (
+ const char *id,
+ const char *name
+ ACE_ENV_ARG_DECL
+ )
+{
+ TAO_TypeCodeFactory_Adapter *adapter =
+ ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance (
+ TAO_ORB_Core::typecodefactory_adapter_name ()
+ );
+
+ if (adapter == 0)
+ {
+ ACE_THROW_RETURN (CORBA::INTERNAL (),
+ 0);
+ }
+
+ return adapter->create_home_tc (id,
+ name
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::TypeCode_ptr
+CORBA::ORB::create_event_tc (
+ const char *id,
+ const char *name,
+ CORBA::ValueModifier type_modifier,
+ CORBA::TypeCode_ptr concrete_base,
+ const CORBA::ValueMemberSeq &members
+ ACE_ENV_ARG_DECL
+ )
+{
+ TAO_TypeCodeFactory_Adapter *adapter =
+ ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance (
+ TAO_ORB_Core::typecodefactory_adapter_name ()
+ );
+
+ if (adapter == 0)
+ {
+ ACE_THROW_RETURN (CORBA::INTERNAL (),
+ 0);
+ }
+
+ return adapter->create_event_tc (id,
+ name,
+ type_modifier,
+ concrete_base,
+ members
+ ACE_ENV_ARG_PARAMETER);
+}
+
+// ****************************************************************
+
+#endif /* TAO_HAS_MINIMUM_CORBA */
+
+CORBA::Object_ptr
+CORBA::ORB::resolve_policy_manager (void)
+{
+#if (TAO_HAS_CORBA_MESSAGING == 1)
+
+ TAO_Policy_Manager *policy_manager =
+ this->orb_core_->policy_manager ();
+
+ if (policy_manager == 0)
+ {
+ return CORBA::Object::_nil ();
+ }
+
+ return CORBA::Object::_duplicate (policy_manager);
+
+#else
+
+ return CORBA::Object::_nil ();
+
+#endif /* TAO_HAS_CORBA_MESSAGING == 1 */
+}
+
+CORBA::Object_ptr
+CORBA::ORB::resolve_policy_current (void)
+{
+
+#if (TAO_HAS_CORBA_MESSAGING == 1)
+
+ TAO_Policy_Current &policy_current = this->orb_core_->policy_current ();
+ return CORBA::Object::_duplicate (&policy_current);
+
+#else
+
+ return CORBA::Object::_nil ();
+
+#endif /* TAO_HAS_CORBA_MESSAGING == 1 */
+}
+
+void
+CORBA::ORB::resolve_service (TAO::MCAST_SERVICEID mcast_service_id)
+{
+ static char const * const env_service_port[] =
+ {
+ "NameServicePort",
+ "TradingServicePort",
+ "ImplRepoServicePort",
+ "InterfaceRepoServicePort"
+ };
+
+ static unsigned short const default_service_port[] =
+ {
+ TAO_DEFAULT_NAME_SERVER_REQUEST_PORT,
+ TAO_DEFAULT_TRADING_SERVER_REQUEST_PORT,
+ TAO_DEFAULT_IMPLREPO_SERVER_REQUEST_PORT,
+ TAO_DEFAULT_INTERFACEREPO_SERVER_REQUEST_PORT
+ };
+
+ // By now, the table filled in with -ORBInitRef arguments has been
+ // checked. We only get here if the table didn't contain an initial
+ // reference for the requested Service.
+
+ CORBA::String_var default_init_ref =
+ this->orb_core_->orb_params ()->default_init_ref ();
+
+ static char const mcast_prefix[] = "mcast://:::";
+
+ if ((ACE_OS::strncmp (default_init_ref.in (),
+ mcast_prefix,
+ sizeof (mcast_prefix) - 1) == 0))
+ {
+ // First, determine if the port was supplied on the command line
+ unsigned short port =
+ this->orb_core_->orb_params ()->service_port (mcast_service_id);
+
+ if (port == 0)
+ {
+ // Look for the port among our environment variables.
+ char const * const port_number =
+ ACE_OS::getenv (env_service_port[mcast_service_id]);
+
+ if (port_number != 0)
+ port = static_cast<unsigned short> (ACE_OS::atoi (port_number));
+ else
+ port = default_service_port[mcast_service_id];
+ }
+
+ // Set the port value in ORB_Params: modify the default mcast
+ // value.
+ static char const mcast_fmt[] = "mcast://:%d::";
+ static size_t const PORT_BUF_SIZE = 256;
+
+ char def_init_ref[PORT_BUF_SIZE] = { 0 }; // snprintf() doesn't
+ // null terminate.
+ // Make sure we do.
+
+ ACE_OS::snprintf (def_init_ref,
+ PORT_BUF_SIZE - 1, // Account for null
+ // terminator.
+ mcast_fmt,
+ port);
+
+ this->orb_core_->orb_params ()->default_init_ref (def_init_ref);
+ }
+}
+
+CORBA::Object_ptr
+CORBA::ORB::resolve_initial_references (const char *name
+ ACE_ENV_ARG_DECL)
+{
+ return this->resolve_initial_references (name,
+ 0
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::Object_ptr
+CORBA::ORB::resolve_initial_references (const char *name,
+ ACE_Time_Value *timeout
+ ACE_ENV_ARG_DECL)
+{
+ // This method should not be called if the ORB has been shutdown.
+ this->check_shutdown (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Object::_nil ());
+
+ CORBA::Object_var result;
+
+ if (ACE_OS::strcmp (name, TAO_OBJID_ROOTPOA) == 0)
+ {
+ result = this->orb_core ()->root_poa (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Object::_nil ());
+ }
+ else if (ACE_OS::strcmp (name, TAO_OBJID_POACURRENT) == 0)
+ {
+ result = this->orb_core ()->resolve_poa_current
+ (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Object::_nil ());
+ }
+ else if (ACE_OS::strcmp (name, TAO_OBJID_POLICYMANAGER) == 0)
+ {
+ result = this->resolve_policy_manager ();
+ }
+ else if (ACE_OS::strcmp (name, TAO_OBJID_POLICYCURRENT) == 0)
+ {
+ result = this->resolve_policy_current ();
+ }
+ else if (ACE_OS::strcmp (name, TAO_OBJID_IORMANIPULATION) == 0)
+ {
+ result = this->orb_core ()->resolve_ior_manipulation
+ (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Object::_nil ());
+ }
+ else if (ACE_OS::strcmp (name, TAO_OBJID_IORTABLE) == 0)
+ {
+ result = this->orb_core ()->resolve_ior_table
+ (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Object::_nil ());
+ }
+ else if (ACE_OS::strcmp (name, TAO_OBJID_DYNANYFACTORY) == 0)
+ {
+ result = this->orb_core ()->resolve_dynanyfactory
+ (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Object::_nil ());
+ }
+ else if (ACE_OS::strcmp (name, TAO_OBJID_TYPECODEFACTORY) == 0)
+ {
+ result = this->orb_core ()->resolve_typecodefactory
+ (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Object::_nil ());
+ }
+ else if (ACE_OS::strcmp (name, TAO_OBJID_CODECFACTORY) == 0)
+ {
+ result = this->orb_core ()->resolve_codecfactory
+ (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Object::_nil ());
+ }
+#if TAO_HAS_INTERCEPTORS == 1
+ else if (ACE_OS::strcmp (name, TAO_OBJID_PICurrent) == 0)
+ {
+ result = this->orb_core ()->resolve_picurrent
+ (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Object::_nil ());
+ }
+#endif
+
+ // -----------------------------------------------------------------
+
+ if (CORBA::is_nil (result.in ()))
+ {
+ // Search the object reference table. This search must occur before
+ // the InitRef table search, since it may contain local objects.
+ result =
+ this->orb_core ()->object_ref_table ().resolve_initial_reference (
+ name);
+ }
+
+ if (!CORBA::is_nil (result.in ()))
+ return result._retn ();
+
+ // -----------------------------------------------------------------
+
+ // Check ORBInitRef options.
+
+ // @@ There appears to be long standing (i.e. back when the map was
+ // an ACE_Hash_Map_Manager) race condition here since the map
+ // access is not synchronized.
+
+ // Is the service name in the IOR Table.
+ TAO_ORB_Core::InitRefMap::iterator ior =
+ this->orb_core_->init_ref_map ()->find (ACE_CString (name));
+
+ if (ior != this->orb_core_->init_ref_map ()->end ())
+ return this->string_to_object ((*ior).second.c_str ()
+ ACE_ENV_ARG_PARAMETER);
+
+ // Look for an environment variable called "<name>IOR".
+ //
+ CORBA::String_var ior_env_var_name =
+ CORBA::string_alloc (static_cast<CORBA::ULong> (ACE_OS::strlen (name) + 3));
+
+ ACE_OS::strcpy (ior_env_var_name.inout (),
+ name);
+
+ ACE_OS::strcat (ior_env_var_name.inout (),
+ "IOR");
+
+ ACE_CString service_ior = ACE_OS::getenv (ior_env_var_name.in ());
+
+ if (ACE_OS::strcmp (service_ior.c_str (), "") != 0 )
+ {
+ result =
+ this->string_to_object (service_ior.c_str()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Object::_nil ());
+
+ return result._retn ();
+ }
+
+ // May be trying the explicitly specified services and the well
+ // known services should be tried first before falling on to default
+ // services.
+
+ // Set the timeout value.
+ this->set_timeout (timeout);
+
+ if (ACE_OS::strcmp (name, TAO_OBJID_NAMESERVICE) == 0)
+ {
+ this->resolve_service (TAO::MCAST_NAMESERVICE);
+ }
+ else if (ACE_OS::strcmp (name, TAO_OBJID_TRADINGSERVICE) == 0)
+ {
+ this->resolve_service (TAO::MCAST_TRADINGSERVICE);
+ }
+ else if (ACE_OS::strcmp (name, TAO_OBJID_IMPLREPOSERVICE) == 0)
+ {
+ this->resolve_service (TAO::MCAST_IMPLREPOSERVICE);
+ }
+ else if (ACE_OS::strcmp (name, TAO_OBJID_INTERFACEREP) == 0)
+ {
+ this->resolve_service (TAO::MCAST_INTERFACEREPOSERVICE);
+ }
+
+ // Is not one of the well known services, try to find it in the
+ // InitRef table....check the defaultinitref values also.
+
+ result = this->orb_core ()->resolve_rir (name ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Object::_nil ());
+
+ if (!CORBA::is_nil (result.in ()))
+ return result._retn ();
+ // -----------------------------------------------------------------
+
+ ACE_THROW_RETURN (CORBA::ORB::InvalidName (), CORBA::Object::_nil ());
+}
+
+#if !defined(CORBA_E_MICRO)
+void
+CORBA::ORB::register_initial_reference (const char * id,
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL)
+{
+ if (id == 0 || ACE_OS::strlen (id) == 0)
+ ACE_THROW (CORBA::ORB::InvalidName ());
+ ACE_CHECK;
+
+ if (CORBA::is_nil (obj))
+ ACE_THROW (CORBA::BAD_PARAM (CORBA::OMGVMCID | 27,
+ CORBA::COMPLETED_NO));
+ ACE_CHECK;
+
+ TAO_Object_Ref_Table &table = this->orb_core_->object_ref_table ();
+
+ if (table.register_initial_reference (id, obj) == -1)
+ ACE_THROW (CORBA::ORB::InvalidName ());
+}
+#endif
+
+CORBA::ORB::ObjectIdList_ptr
+CORBA::ORB::list_initial_services (ACE_ENV_SINGLE_ARG_DECL)
+{
+ this->check_shutdown (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ return
+ this->orb_core ()->list_initial_references (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+void
+CORBA::ORB::check_shutdown (ACE_ENV_SINGLE_ARG_DECL)
+{
+ if (this->orb_core () != 0)
+ {
+ this->orb_core ()->check_shutdown (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else
+ {
+ // If the ORB_Core pointer is zero, assume that the ORB_Core has
+ // been destroyed.
+
+ // As defined by the CORBA 2.3 specification, throw a
+ // CORBA::OBJECT_NOT_EXIST exception if the ORB has been
+ // destroyed by the time an ORB function is called.
+
+ ACE_THROW (CORBA::OBJECT_NOT_EXIST (0,
+ CORBA::COMPLETED_NO));
+ }
+}
+
+// ****************************************************************
+
+void
+TAO::ORB::init_orb_globals (ACE_ENV_SINGLE_ARG_DECL)
+{
+ // This method should be invoked atomically. It is the caller's
+ // responsibility to ensure that this condition is satisfied.
+
+ // Prevent multiple initializations.
+ if (orb_init_count != 0)
+ {
+ return;
+ }
+ else
+ {
+ ++orb_init_count;
+ }
+
+ // This must be done after the system TypeCodes and Exceptions have
+ // been initialized. An unexpected exception will cause TAO's
+ // unexpected exception handler to be called. That handler
+ // transforms all unexpected exceptions to CORBA::UNKNOWN, which of
+ // course requires the TypeCode constants and system exceptions to
+ // have been initialized.
+ /**
+ * @note The new TypeCode implementation obviates the above
+ * comment. Standard CORBA exception TypeCodes are now
+ * available before CORBA::ORB_init() is ever called.
+ */
+ TAO_Singleton_Manager::instance ()->_set_unexpected (
+ ::TAO_unexpected_exception_handler);
+}
+
+const ACE_CString &
+CORBA::ORB::_tao_ft_client_id (void)
+{
+ return this->orb_core ()->fault_tolerance_service ().client_id ();
+}
+
+void
+CORBA::ORB::_tao_ft_client_id (const char *id)
+{
+ this->orb_core ()->fault_tolerance_service ().client_id (id);
+}
+
+CORBA::ORB_ptr
+CORBA::ORB::_tao_make_ORB (TAO_ORB_Core * orb_core)
+{
+ CORBA::ORB_ptr orb = CORBA::ORB::_nil ();
+
+ ACE_NEW_RETURN (orb,
+ CORBA::ORB (orb_core),
+ CORBA::ORB::_nil ());
+
+ return orb;
+}
+
+// ****************************************************************
+
+// ORB initialization, per OMG document 98-12-01.
+
+CORBA::ORB_ptr
+CORBA::ORB_init (int &argc,
+ char *argv[],
+ const char *orb_name)
+{
+ return CORBA::ORB_init (argc,
+ argv,
+ orb_name,
+ TAO_default_environment ());
+}
+
+CORBA::ORB_ptr
+CORBA::ORB_init (int &argc,
+ char *argv[],
+ const char *orbid,
+ CORBA::Environment &ACE_TRY_ENV)
+{
+ // This ugly macro will go away once we've merged the two ORB_init's.
+ ACE_UNUSED_ARG(ACE_TRY_ENV); // FUZZ: ignore check_for_ace_check
+
+ // Use this string variable to hold the orbid
+ ACE_CString orbid_string (orbid);
+
+ // Copy command line parameter not to use original.
+ ACE_Argv_Type_Converter command_line(argc, argv);
+
+ {
+ // Using ACE_Static_Object_Lock::instance() precludes ORB_init()
+ // from being called within a static object CTOR.
+ ACE_MT (ACE_GUARD_RETURN (TAO_SYNCH_RECURSIVE_MUTEX,
+ guard,
+ *ACE_Static_Object_Lock::instance (),
+ CORBA::ORB::_nil ()));
+
+ // Make sure TAO's singleton manager is initialized.
+ // We need to initialize before TAO_default_environment() is called
+ // since that call instantiates a TAO_TSS_Singleton.
+ if (TAO_Singleton_Manager::instance ()->init () == -1)
+ {
+ return CORBA::ORB::_nil ();
+ }
+
+ TAO::ORB::init_orb_globals (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::ORB::_nil ());
+ }
+
+ // Make sure the following is done after the global ORB
+ // initialization since we need to have exceptions initialized.
+
+ // It doesn't make sense for argc to be zero and argv to be
+ // non-empty/zero, or for argc to be greater than zero and argv be
+ // zero.
+ const size_t argv0_len =
+ (command_line.get_TCHAR_argv ()
+ ? (*command_line.get_TCHAR_argv ()
+ ? ACE_OS::strlen (*command_line.get_TCHAR_argv ())
+ : 0)
+ : 0);
+
+ if ((command_line.get_argc () == 0 && argv0_len != 0)
+ || (command_line.get_argc () != 0
+ && (command_line.get_TCHAR_argv () == 0
+ || command_line.get_TCHAR_argv ()[0] == 0)))
+ {
+ ACE_THROW_RETURN (CORBA::BAD_PARAM (
+ CORBA::SystemException::_tao_minor_code (
+ 0,
+ EINVAL),
+ CORBA::COMPLETED_NO),
+ CORBA::ORB::_nil ());
+ }
+
+
+
+ if (orbid_string.length () == 0)
+ {
+ ACE_Arg_Shifter arg_shifter (command_line.get_argc (),
+ command_line.get_TCHAR_argv ());
+
+ while (arg_shifter.is_anything_left ())
+ {
+ const ACE_TCHAR *current_arg = arg_shifter.get_current ();
+
+ static const ACE_TCHAR orbid_opt[] = ACE_TEXT ("-ORBid");
+ size_t orbid_len = ACE_OS::strlen (orbid_opt);
+ if (ACE_OS::strcasecmp (current_arg,
+ orbid_opt) == 0)
+ {
+ arg_shifter.consume_arg ();
+ if (arg_shifter.is_parameter_next ())
+ {
+ orbid_string =
+ ACE_TEXT_ALWAYS_CHAR (arg_shifter.get_current ());
+ arg_shifter.consume_arg ();
+ }
+ }
+ else if (ACE_OS::strncasecmp (current_arg, orbid_opt,
+ orbid_len) == 0)
+ {
+ arg_shifter.consume_arg ();
+ // The rest of the argument is the ORB id...
+ // but we should skip an optional space...
+ if (current_arg[orbid_len] == ' ')
+ orbid_string =
+ ACE_TEXT_ALWAYS_CHAR (current_arg + orbid_len + 1);
+ else
+ orbid_string = ACE_TEXT_ALWAYS_CHAR (current_arg + orbid_len);
+ }
+ else
+ arg_shifter.ignore_arg ();
+ }
+ }
+
+ // Get ORB Core
+ TAO_ORB_Core_Auto_Ptr oc (
+ TAO::ORB_Table::instance ()->find (orbid_string.c_str ()));
+
+ // The ORB was already initialized. Just return that one.
+ if (oc.get () != 0)
+ {
+ return CORBA::ORB::_duplicate (oc->orb ());
+ }
+ else
+ {
+ // An ORB corresponding to the desired ORBid doesn't exist so create
+ // a new one.
+ TAO_ORB_Core * tmp = 0;
+ ACE_NEW_THROW_EX (tmp,
+ TAO_ORB_Core (orbid_string.c_str ()),
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (0,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (CORBA::ORB::_nil ());
+
+ // The ORB table increases the reference count on the ORB Core
+ // so do not release it here. Allow the TAO_ORB_Core_Auto_Ptr
+ // to decrease the reference count on the ORB Core when it goes
+ // out of scope.
+ oc.reset (tmp);
+ }
+
+
+ // Having the ORB's default static services be shared among all ORBs
+ // is tempting from the point of view of reducing the dynamic
+ // footprint. However, if the ORB in a DLL and the rest of that
+ // application most likely neither cares, nor wishes to know about
+ // them. Furthermore, if the ORB DLL gets unloaded, the static
+ // services it had registered globaly will no longer be accesible,
+ // which will have disastrous consequences at the process
+ // shutdown. Hence, the ACE_Service_Config_Guard ensures that for
+ // the current thread, any references to the global
+ // ACE_Service_Config will be forwarded to the ORB's.
+
+ // Making sure the initialization process in the current thread uses
+ // the correct service repository (ours), instead of the global one.
+ ACE_Service_Config_Guard scg (oc->configuration ());
+
+ /*
+ * Currently I choose to make the ORB an owner of its configuration,
+ * which in general is not quite correct because it is very common ORBs to
+ * need to share the same configuration.
+ */
+
+ // Initialize the Service Configurator. This must occur before the
+ // ORBInitializer::pre_init() method is invoked on each registered
+ // ORB initializer.
+ int result = TAO::ORB::open_services (oc->configuration (),
+ command_line.get_argc (),
+ command_line.get_TCHAR_argv ());
+
+ // Check for errors returned from <TAO_Internal::open_services>.
+ if (result != 0 && errno != ENOENT)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) %p\n"),
+ ACE_TEXT ("Unable to initialize the ")
+ ACE_TEXT ("Service Configurator")));
+ ACE_THROW_RETURN (CORBA::INITIALIZE (
+ CORBA::SystemException::_tao_minor_code (
+ TAO_ORB_CORE_INIT_LOCATION_CODE,
+ 0),
+ CORBA::COMPLETED_NO),
+ CORBA::ORB::_nil ());
+ }
+
+ TAO::ORBInitializer_Registry_Adapter * orbinitializer_registry =
+ oc.get ()->orbinitializer_registry ();
+
+ PortableInterceptor::SlotId slotid = 0;
+ size_t pre_init_count = 0;
+
+ if (orbinitializer_registry != 0)
+ {
+ pre_init_count =
+ orbinitializer_registry->pre_init (oc.get (),
+ command_line.get_argc(),
+ command_line.get_ASCII_argv(),
+ slotid
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::ORB::_nil ());
+ }
+
+ // Initialize the ORB Core instance.
+ result = oc->init (command_line.get_argc(),
+ command_line.get_ASCII_argv()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::ORB::_nil ());
+
+ if (orbinitializer_registry != 0)
+ {
+
+ orbinitializer_registry->post_init (pre_init_count,
+ oc.get (),
+ command_line.get_argc(),
+ command_line.get_ASCII_argv(),
+ slotid
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::ORB::_nil ());
+ }
+
+ if (TAO_debug_level > 2)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT("TAO (%P|%t) created new ORB <%s>\n"),
+ ACE_TEXT_CHAR_TO_TCHAR (orbid_string.c_str ())));
+ }
+
+ // Before returning remember to store the ORB into the table...
+ if (TAO::ORB_Table::instance ()->bind (orbid_string.c_str (),
+ oc.get ()) != 0)
+ ACE_THROW_RETURN (CORBA::INTERNAL (0,
+ CORBA::COMPLETED_NO),
+ CORBA::ORB::_nil ());
+
+ // Return a duplicate since the ORB_Core should release the last
+ // reference to the ORB.
+ return CORBA::ORB::_duplicate (oc->orb ());
+}
+
+// ****************************************************************
+
+// Object reference stringification.
+char *
+CORBA::ORB::object_to_string (CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL)
+{
+ // This method should not be called if the ORB has been shutdown.
+ this->check_shutdown (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ if (!CORBA::is_nil (obj) && obj->_is_local ())
+ ACE_THROW_RETURN (CORBA::MARSHAL (CORBA::OMGVMCID | 4,
+ CORBA::COMPLETED_NO),
+ 0);
+
+
+ // Application writer controls what kind of objref strings they get,
+ // maybe along with other things, by how they initialize the ORB.
+
+ if (use_omg_ior_format_)
+ {
+ // By default, orbs use IOR strings; these are ugly (and error
+ // prone) but specified by CORBA.
+ //
+ // XXX there should be a simple way to reuse this code in other
+ // ORB implementations ...
+
+#if defined (ACE_INITIALIZE_MEMORY_BEFORE_USE)
+ char buf [ACE_CDR::DEFAULT_BUFSIZE] = { 0 };
+#else
+ // Avoid the initialization overhead if not compiling with
+ // support for a memory profiler. There is no need to actually perform
+ // initialization otherwise.
+ char buf [ACE_CDR::DEFAULT_BUFSIZE];
+#endif /* ACE_INITIALIZE_MEMORY_BEFORE_USE */
+
+ TAO_OutputCDR cdr (buf, sizeof buf,
+ TAO_ENCAP_BYTE_ORDER,
+ this->orb_core_->output_cdr_buffer_allocator (),
+ this->orb_core_->output_cdr_dblock_allocator (),
+ this->orb_core_->output_cdr_msgblock_allocator (),
+ this->orb_core_->orb_params ()->cdr_memcpy_tradeoff (),
+ TAO_DEF_GIOP_MAJOR,
+ TAO_DEF_GIOP_MINOR);
+
+ // There is no translator currently available for stringifying an object
+ // reference, since there is no transport with which to choose an NCS/TCS
+ // pair.
+
+ // support limited oref ACE_OS::strcmp.
+ (void) ACE_OS::memset (buf, 0, sizeof (buf));
+
+ // Marshal the objref into an encapsulation bytestream.
+ (void) cdr.write_octet (TAO_ENCAP_BYTE_ORDER);
+ if ((cdr << obj) == 0)
+ ACE_THROW_RETURN (CORBA::MARSHAL (), 0);
+
+ // Now hexify the encapsulated CDR data into a string, and
+ // return that string.
+
+ const size_t total_len = cdr.total_length ();
+
+ char *cp = 0;
+ ACE_ALLOCATOR_RETURN (cp,
+ CORBA::string_alloc (
+ sizeof ior_prefix
+ + 2
+ * static_cast<CORBA::ULong> (total_len)),
+ 0);
+
+ CORBA::String_var string = cp;
+
+ ACE_OS::strcpy (cp, ior_prefix);
+ cp += sizeof (ior_prefix) - 1;
+
+ for (const ACE_Message_Block *i = cdr.begin ();
+ i != 0;
+ i = i->cont ())
+ {
+ const char *bytes = i->rd_ptr ();
+ size_t len = i->length ();
+
+ while (len--)
+ {
+ *cp++ = ACE::nibble2hex ((*bytes) >> 4);
+ *cp++ = ACE::nibble2hex (*bytes);
+ ++bytes;
+ }
+ }
+ // Null terminate the string..
+ *cp = 0;
+
+ return string._retn ();
+ }
+ else
+ {
+ // It is perfectly valid to marshal a nil object reference.
+ // However, it is not possible to convert a nil object reference
+ // to a URL IOR, so throw an exception.
+ if (CORBA::is_nil (obj) || obj->_stubobj () == 0)
+ {
+ if (TAO_debug_level > 0)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("Nil object reference or TAO_Stub ")
+ ACE_TEXT ("pointer is zero when converting\n")
+ ACE_TEXT ("object reference to URL IOR.\n")));
+
+ ACE_THROW_RETURN (CORBA::MARSHAL (
+ CORBA::SystemException::_tao_minor_code (
+ 0,
+ EINVAL),
+ CORBA::COMPLETED_NO),
+ 0);
+ }
+
+ TAO_MProfile &mp = obj->_stubobj ()->base_profiles ();
+
+ if (mp.profile_count () == 0)
+ {
+ if (TAO_debug_level > 0)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) Cannot stringify given ")
+ ACE_TEXT ("object. No profiles.\n")));
+
+
+ ACE_THROW_RETURN (CORBA::MARSHAL (
+ CORBA::SystemException::_tao_minor_code (
+ 0,
+ EINVAL),
+ CORBA::COMPLETED_NO),
+ 0);
+ }
+
+ // For now we just use the first profile.
+ TAO_Profile *profile = mp.get_profile (0);
+
+ return profile->to_string (ACE_ENV_SINGLE_ARG_PARAMETER);
+ }
+}
+
+// Destringify arbitrary objrefs. This method is called from
+// <resolve_name_service> with an IOR <multicast_to_service>.
+
+CORBA::Object_ptr
+CORBA::ORB::string_to_object (const char *str
+ ACE_ENV_ARG_DECL)
+{
+ // This method should not be called if the ORB has been shutdown.
+ this->check_shutdown (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Object::_nil ());
+
+ // Check for NULL pointer
+ if (str == 0)
+ ACE_THROW_RETURN (CORBA::INV_OBJREF (
+ CORBA::SystemException::_tao_minor_code (
+ 0,
+ EINVAL),
+ CORBA::COMPLETED_NO),
+ CORBA::Object::_nil ());
+
+ TAO_IOR_Parser *ior_parser =
+ this->orb_core_->parser_registry ()->match_parser (str);
+
+ if (ior_parser != 0)
+ {
+ return ior_parser->parse_string (str,
+ this
+ ACE_ENV_ARG_PARAMETER);
+ }
+
+
+ if (ACE_OS::strncmp (str,
+ ior_prefix,
+ sizeof ior_prefix - 1) == 0)
+ return this->ior_string_to_object (str + sizeof ior_prefix - 1
+ ACE_ENV_ARG_PARAMETER);
+ else
+ return this->url_ior_string_to_object (str
+ ACE_ENV_ARG_PARAMETER);
+}
+
+// ****************************************************************
+
+char *
+CORBA::ORB::id (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+{
+ return CORBA::string_dup (this->orb_core_->orbid ());
+}
+
+// ****************************************************************
+
+#if !defined(CORBA_E_MICRO)
+CORBA::Policy_ptr
+CORBA::ORB::create_policy (CORBA::PolicyType type,
+ const CORBA::Any& val
+ ACE_ENV_ARG_DECL)
+{
+ this->check_shutdown (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+
+ TAO::PolicyFactory_Registry_Adapter *adapter =
+ this->orb_core_->policy_factory_registry ();
+
+ if (adapter == 0)
+ {
+ ACE_THROW_RETURN (CORBA::INTERNAL (),
+ CORBA::Policy::_nil ());
+ }
+
+ // Attempt to obtain the policy from the policy factory registry.
+ return adapter->create_policy (
+ type,
+ val
+ ACE_ENV_ARG_PARAMETER);
+}
+#endif
+
+#if !defined(CORBA_E_MICRO)
+CORBA::Policy_ptr
+CORBA::ORB::_create_policy (CORBA::PolicyType type
+ ACE_ENV_ARG_DECL)
+{
+ this->check_shutdown (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+
+ TAO::PolicyFactory_Registry_Adapter *adapter =
+ this->orb_core_->policy_factory_registry ();
+
+ if (adapter == 0)
+ {
+ ACE_THROW_RETURN (CORBA::INTERNAL (),
+ CORBA::Policy::_nil ());
+ }
+
+ // Attempt to obtain the policy from the policy factory registry.
+ return adapter->_create_policy (
+ type
+ ACE_ENV_ARG_PARAMETER);
+}
+#endif
+
+// Destringify OMG-specified "IOR" string.
+//
+// XXX there should be a simple way to reuse this code in other ORB
+// implementations ...
+
+CORBA::Object_ptr
+CORBA::ORB::ior_string_to_object (const char *str
+ ACE_ENV_ARG_DECL)
+{
+ // Unhex the bytes, and make a CDR deencapsulation stream from the
+ // resulting data.
+ ACE_Message_Block mb (ACE_OS::strlen (str) / 2 + 1
+ + ACE_CDR::MAX_ALIGNMENT + 1);
+
+ ACE_CDR::mb_align (&mb);
+
+ char *buffer = mb.rd_ptr ();
+ const char *tmp = str;
+ size_t len = 0;
+
+ while (tmp [0] && tmp [1])
+ {
+ // Some platforms define 'byte' as a macro, solve the problem
+ // here.
+#undef byte
+ unsigned char byte;
+
+ if (!(isxdigit (tmp [0]) && isxdigit (tmp [1])))
+ break;
+
+ byte = (u_char) (ACE::hex2byte (tmp [0]) << 4);
+ byte |= ACE::hex2byte (tmp [1]);
+
+ buffer [len++] = byte;
+ tmp += 2;
+ }
+
+ if (tmp [0] && !isspace (tmp [0]))
+ {
+ ACE_THROW_RETURN (CORBA::BAD_PARAM (),
+ CORBA::Object::_nil ());
+ }
+
+ // Create deencapsulation stream ... then unmarshal objref from that
+ // stream.
+
+ int byte_order = *(mb.rd_ptr ());
+ mb.rd_ptr (1);
+ mb.wr_ptr (len);
+ TAO_InputCDR stream (&mb,
+ byte_order,
+ TAO_DEF_GIOP_MAJOR,
+ TAO_DEF_GIOP_MINOR,
+ this->orb_core_);
+
+ CORBA::Object_ptr objref = CORBA::Object::_nil ();
+ stream >> objref;
+ return objref;
+}
+
+// ****************************************************************
+
+// Convert an URL style IOR in an object
+
+CORBA::Object_ptr
+CORBA::ORB::url_ior_string_to_object (const char* str
+ ACE_ENV_ARG_DECL)
+{
+ TAO_MProfile mprofile;
+ // It is safe to declare this on the stack since the contents of
+ // mprofile get copied. No memory is allocated for profile storage
+ // here. The Connector Registry will determine the exact number
+ // of profiles and tell the MProfile object to allocate enough memory
+ // to hold them all.
+
+ TAO_Connector_Registry *conn_reg =
+ this->orb_core_->connector_registry (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ int const retv =
+ conn_reg->make_mprofile (str,
+ mprofile
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Object::_nil ()); // Return nil.
+
+ if (retv != 0)
+ {
+ ACE_THROW_RETURN (CORBA::INV_OBJREF (
+ CORBA::SystemException::_tao_minor_code (
+ 0,
+ EINVAL),
+ CORBA::COMPLETED_NO),
+ CORBA::Object::_nil ());
+ }
+
+ // Now make the TAO_Stub.
+ TAO_Stub *data = this->orb_core_->create_stub ((char *) 0,
+ mprofile
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Object::_nil ());
+
+ TAO_Stub_Auto_Ptr safe_objdata (data);
+
+ // Figure out if the servant is collocated.
+ CORBA::Object_ptr obj =
+ this->orb_core_->create_object (safe_objdata.get ());
+ if (CORBA::is_nil (obj))
+ return CORBA::Object::_nil ();
+
+ // Transfer ownership to the CORBA::Object
+ (void) safe_objdata.release ();
+
+ return obj;
+}
+
+// ****************************************************************
+
+ACE_Time_Value *
+CORBA::ORB::get_timeout (void)
+{
+ return this->timeout_;
+}
+
+void
+CORBA::ORB::set_timeout (ACE_Time_Value *timeout)
+{
+ this->timeout_ = timeout;
+}
+
+// *************************************************************
+// Valuetype factory operations
+// *************************************************************
+
+#if !defined(CORBA_E_MICRO)
+CORBA::ValueFactory
+CORBA::ORB::register_value_factory (const char *repository_id,
+ CORBA::ValueFactory factory
+ ACE_ENV_ARG_DECL)
+{
+ TAO_Valuetype_Adapter *vta = this->orb_core ()->valuetype_adapter ();
+
+ if (vta)
+ {
+ int const result = vta->vf_map_rebind (repository_id,
+ factory);
+
+ if (result == 0) // No previous factory found
+ {
+ return 0;
+ }
+
+ if (result == -1)
+ {
+ // Error on bind.
+ ACE_THROW_RETURN (CORBA::MARSHAL (),
+ 0);
+ }
+ }
+
+ return factory; // previous factory was found
+}
+#endif
+
+#if !defined(CORBA_E_MICRO)
+void
+CORBA::ORB::unregister_value_factory (const char *repository_id
+ ACE_ENV_ARG_DECL_NOT_USED)
+{
+ TAO_Valuetype_Adapter *vta = this->orb_core ()->valuetype_adapter ();
+
+ if (vta)
+ {
+ // Dont care whther it was successful or not!
+ (void) vta->vf_map_unbind (repository_id);
+ }
+}
+#endif
+
+#if !defined(CORBA_E_MICRO)
+CORBA::ValueFactory
+CORBA::ORB::lookup_value_factory (const char *repository_id
+ ACE_ENV_ARG_DECL)
+{
+ TAO_Valuetype_Adapter *vta = this->orb_core ()->valuetype_adapter ();
+
+ if (vta)
+ {
+ return vta->vf_map_find (repository_id);
+ }
+
+ return 0;
+}
+#endif
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/ORB.h b/TAO/tao/ORB.h
new file mode 100644
index 00000000000..8501413f64d
--- /dev/null
+++ b/TAO/tao/ORB.h
@@ -0,0 +1,674 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file ORB.h
+ *
+ * $Id$
+ *
+ * Header file for CORBA's ORB type.
+ *
+ * @author DOC Center - Washington University at St. Louis
+ * @author DOC Group - Vanderbilt University
+ * @author DOC Laboratory - University of California at Irvine
+ */
+//=============================================================================
+
+#ifndef TAO_ORB_H
+#define TAO_ORB_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/UserException.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/orb_typesC.h"
+#include "tao/objectid.h"
+#include "tao/CORBA_methods.h"
+#include "tao/VarOut_T.h"
+#include "tao/Seq_Var_T.h"
+#include "tao/Seq_Out_T.h"
+#include "tao/Sequence_T.h"
+#include "tao/Policy_ForwardC.h"
+#include "tao/ServicesC.h"
+
+#include "ace/Thread_Mutex.h"
+#include "ace/Guard_T.h"
+#include "ace/Atomic_Op.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+typedef enum
+{
+ TAO_SERVICEID_NAMESERVICE,
+ TAO_SERVICEID_TRADINGSERVICE,
+ TAO_SERVICEID_IMPLREPOSERVICE,
+ TAO_SERVICEID_INTERFACEREPOSERVICE,
+ TAO_SERVICEID_MCASTSERVER
+} TAO_Service_ID;
+
+/// Forward declarations.
+class TAO_MProfile;
+class TAO_Client_Strategy_Factory;
+class TAO_Server_Strategy_Factory;
+class TAO_InputCDR;
+class TAO_OutputCDR;
+class TAO_Stub;
+class TAO_Valuetype_Adapter;
+class TAO_Acceptor_Filter;
+
+// ****************************************************************
+
+namespace CORBA
+{
+ class EnumMemberSeq;
+ class StructMemberSeq;
+ class UnionMemberSeq;
+ class ValueMemberSeq;
+ class ORB_ObjectIdList;
+
+ class ExceptionList;
+ typedef ExceptionList * ExceptionList_ptr;
+
+ class ContextList;
+ typedef ContextList * ContextList_ptr;
+
+ class Context;
+ typedef Context * Context_ptr;
+
+ class NVList;
+ typedef NVList *NVList_ptr;
+
+ class NamedValue;
+ typedef NamedValue *NamedValue_ptr;
+
+ class Policy;
+ typedef Policy *Policy_ptr;
+
+ typedef CORBA::ULong PolicyType;
+
+ // TODO - implement OMG's 'ORBid CORBA::ORB::id (void)'.
+
+ typedef
+ TAO_VarSeq_Var_T<
+ ORB_ObjectIdList
+ >
+ ORB_ObjectIdList_var;
+
+ typedef
+ TAO_Seq_Out_T<
+ ORB_ObjectIdList
+ >
+ ORB_ObjectIdList_out;
+
+ class ValueFactoryBase;
+ typedef ValueFactoryBase *ValueFactory;
+
+ typedef UShort ServiceType;
+
+ class Request;
+ typedef Request * Request_ptr;
+ typedef TAO_Pseudo_Var_T<Request> Request_var;
+ typedef TAO_Pseudo_Out_T<Request> Request_out;
+
+ class ORB;
+ typedef ORB * ORB_ptr;
+ typedef TAO_Pseudo_Var_T<ORB> ORB_var;
+ typedef TAO_Pseudo_Out_T<ORB> ORB_out;
+
+ typedef CORBA::Short ValueModifier;
+
+#if (TAO_HAS_MINIMUM_CORBA == 0)
+
+ // Typedefs for CORBA::RequestSeq, which is an argument of
+ // send_multiple_requests_*().
+
+ typedef
+ TAO::unbounded_object_reference_sequence<
+ CORBA::Request, CORBA::Request_var
+ >
+ RequestSeq;
+
+ typedef
+ TAO_VarSeq_Var_T<
+ RequestSeq
+ >
+ RequestSeq_var;
+
+ typedef
+ TAO_Seq_Out_T<
+ RequestSeq
+ >
+ RequestSeq_out;
+#endif
+
+ /**
+ * @class ORB
+ *
+ * @brief ORB pseudo-object.
+ *
+ * The "ORB" pseudo-object is used in bootstrapping, such as to
+ * create object references from strings. This class is intended
+ * to be inherited by others, which will provide some more of the
+ * CORBA support. Implementations of this "CORBA::ORB" class must
+ * know how to create stringify/destringify their objrefs, as well
+ * as how to marshal and unmarshal them.
+ */
+ class TAO_Export ORB
+ {
+ public:
+
+ class TAO_Export InvalidName : public CORBA::UserException
+ {
+ public:
+ InvalidName (void);
+ InvalidName (const InvalidName &);
+ ~InvalidName (void);
+
+ InvalidName &operator= (const InvalidName &);
+
+ static InvalidName *_downcast (CORBA::Exception *);
+ static CORBA::Exception *_alloc (void);
+
+ virtual CORBA::Exception *_tao_duplicate (void) const;
+
+ virtual void _raise (void) const;
+
+ virtual void _tao_encode (TAO_OutputCDR &
+ ACE_ENV_ARG_DECL) const;
+
+ virtual void _tao_decode (TAO_InputCDR &
+ ACE_ENV_ARG_DECL);
+ };
+
+ typedef char *ObjectId;
+ typedef CORBA::String_var ObjectId_var;
+ typedef CORBA::String_out ObjectId_out;
+ static CORBA::TypeCode_ptr const _tc_ObjectId;
+
+ typedef CORBA::ORB_ObjectIdList ObjectIdList;
+ typedef CORBA::ORB_ObjectIdList_var ObjectIdList_var;
+ typedef CORBA::ORB_ObjectIdList_out ObjectIdList_out;
+ typedef CORBA::ORB_ObjectIdList *ObjectIdList_ptr;
+ static CORBA::TypeCode_ptr const _tc_ObjectIdList;
+
+ /// Return a duplicate of @c orb.
+ /**
+ * When work with this duplicate is complete, it should be freed
+ * up using CORBA::release().
+ */
+ static CORBA::ORB_ptr _duplicate (CORBA::ORB_ptr orb);
+
+ /// Returns a pointer to a nil ORB, i.e., an non-existent ORB. This
+ /// can be used for initialization or in comparisons.
+ static CORBA::ORB_ptr _nil (void);
+
+ /// Return this ORB's ORBid.
+ char * id (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS);
+
+ /**
+ * Turn a string-ified object reference back into an object
+ * pointer. Typically these strings are created using
+ * object_to_string(), but not necessarily locally.
+ */
+ CORBA::Object_ptr string_to_object (const char *str
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ /**
+ * Turn an object reference into a string. Each type of ORB,
+ * e.g. an IIOP ORB, must implement this. This can be used by
+ * servers to publish their whereabouts to clients. The output of
+ * this is typically eventually given to @c string_to_object() as
+ * an argument.
+ */
+ char * object_to_string (CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+#if !defined(CORBA_E_MICRO)
+ // Value factory operations (CORBA 2.3 ptc/98-10-05 Ch. 4.2 p.4-7)
+ CORBA::ValueFactory register_value_factory (
+ const char *repository_id,
+ CORBA::ValueFactory factory
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+#endif
+
+#if !defined(CORBA_E_MICRO)
+ void unregister_value_factory (const char * repository_id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+#endif
+
+#if !defined(CORBA_E_MICRO)
+ CORBA::ValueFactory lookup_value_factory (
+ const char *repository_id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+#endif
+
+#if (TAO_HAS_MINIMUM_CORBA == 0)
+
+ void create_list (CORBA::Long count,
+ CORBA::NVList_ptr &new_list
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ void create_operation_list(CORBA::OperationDef_ptr opDef,
+ CORBA::NVList_ptr& result
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ void create_named_value (CORBA::NamedValue_ptr &nmval
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ void create_exception_list (CORBA::ExceptionList_ptr &exclist
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ void create_environment (CORBA::Environment_ptr &new_env
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ // The following are not implemented and just throw
+ // CORBA::NO_IMPLEMENT.
+
+ void create_context_list (CORBA::ContextList_ptr &ctxtlist
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ void get_default_context (CORBA::Context_ptr &ctx
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ CORBA::Boolean get_service_information (
+ CORBA::ServiceType service_type,
+ CORBA::ServiceInformation_out service_information
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ void send_multiple_requests_oneway (const CORBA::RequestSeq &req
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ void send_multiple_requests_deferred (const CORBA::RequestSeq &req
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ void get_next_response (CORBA::Request_ptr &req
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ CORBA::Boolean poll_next_response (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS);
+
+ /// The ORB TypeCode creation functions.
+
+ CORBA::TypeCode_ptr create_struct_tc (
+ const char *id,
+ const char *name,
+ const CORBA::StructMemberSeq &members
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ CORBA::TypeCode_ptr create_union_tc (
+ const char *id,
+ const char *name,
+ CORBA::TypeCode_ptr discriminator_type,
+ const CORBA::UnionMemberSeq &members
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ CORBA::TypeCode_ptr create_enum_tc (
+ const char *id,
+ const char *name,
+ const CORBA::EnumMemberSeq &members
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ CORBA::TypeCode_ptr create_alias_tc (
+ const char *id,
+ const char *name,
+ CORBA::TypeCode_ptr original_type
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ CORBA::TypeCode_ptr create_exception_tc (
+ const char *id,
+ const char *name,
+ const CORBA::StructMemberSeq &members
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ CORBA::TypeCode_ptr create_interface_tc (
+ const char *id,
+ const char *name
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ CORBA::TypeCode_ptr create_string_tc (
+ CORBA::ULong bound
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ CORBA::TypeCode_ptr create_wstring_tc (
+ CORBA::ULong bound
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ CORBA::TypeCode_ptr create_fixed_tc (
+ CORBA::UShort digits,
+ CORBA::UShort scale
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ CORBA::TypeCode_ptr create_sequence_tc (
+ CORBA::ULong bound,
+ CORBA::TypeCode_ptr element_type
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ CORBA::TypeCode_ptr create_array_tc (
+ CORBA::ULong length,
+ CORBA::TypeCode_ptr element_type
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ CORBA::TypeCode_ptr create_value_tc (
+ const char *id,
+ const char *name,
+ CORBA::ValueModifier type_modifier,
+ CORBA::TypeCode_ptr concrete_base,
+ const CORBA::ValueMemberSeq &members
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ CORBA::TypeCode_ptr create_value_box_tc (
+ const char *id,
+ const char *name,
+ CORBA::TypeCode_ptr boxed_type
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ CORBA::TypeCode_ptr create_native_tc (
+ const char *id,
+ const char *name
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ CORBA::TypeCode_ptr create_recursive_tc (
+ const char *id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ CORBA::TypeCode_ptr create_abstract_interface_tc (
+ const char *id,
+ const char *name
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ CORBA::TypeCode_ptr create_local_interface_tc (
+ const char *id,
+ const char *name
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ CORBA::TypeCode_ptr create_component_tc (
+ const char *id,
+ const char *name
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ CORBA::TypeCode_ptr create_home_tc (
+ const char *id,
+ const char *name
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ CORBA::TypeCode_ptr create_event_tc (
+ const char *id,
+ const char *name,
+ CORBA::ValueModifier type_modifier,
+ CORBA::TypeCode_ptr concrete_base,
+ const CORBA::ValueMemberSeq &members
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+#endif /* TAO_HAS_MINIMUM_CORBA */
+
+ // = ORB event loop methods.
+
+ /**
+ * Instructs the ORB to initialize itself and run its event loop in
+ * the current thread, not returning until the ORB has shut down.
+ * If an error occurs during initialization or at runtime, a CORBA
+ * system exception will be thrown.
+ */
+ void run (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS);
+
+ /**
+ * Instructs the ORB to initialize itself and run its event loop in
+ * the current thread, not returning until the ORB has shut down or
+ * the time value specified through @a tv has expired. If an
+ * error occurs during initialization or at runtime, a CORBA
+ * system exception will be thrown. @a tv is reduced by the
+ * amount of time spent in this call.
+ *
+ * If this function is called with a @ tv value, client threads
+ * making invocations will continue their operations. When the
+ * operation timesout and returns, any invocations showing up on
+ * the server will be buffered by TCP.
+ **/
+ void run (ACE_Time_Value &tv
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ /**
+ * Instructs the ORB to initialize itself and run its event loop in
+ * the current thread, not returning until the ORB has shut down or
+ * the time value specified through @a tv has expired. If an error
+ * occurs during initialization or at runtime, a CORBA system
+ * exception will be thrown. @a tv is reduced by the amount of time
+ * spent in this call. If @a tv is 0, it means that the timeout
+ * is infinite. If @a tv is @c ACE_Time_Value::zero, it specifies
+ * to poll and does not block.
+ *
+ * If this function is called with @a tv value, client threads
+ * making invocations will continue their operations. When the
+ * operation timesout and returns, any invocations showing up on
+ * the server will be buffered by TCP.
+ **/
+ void run (ACE_Time_Value *tv
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ /// Returns an indication of whether the ORB needs to perform some
+ /// work.
+ CORBA::Boolean work_pending (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS);
+
+ /// Returns an indication of whether the ORB needs to perform some
+ /// work but will look for work pending for no more than the
+ /// specified time.
+ /**
+ * @note This is useful for implementing an event loop with an
+ * idle timeout.
+ */
+ CORBA::Boolean work_pending (ACE_Time_Value &tv
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ /**
+ * This operation performs an implementation-defined unit of work.
+ * Note that the default behavior is to block if the unit of work
+ * is not present; this behavior can be modified by passing an
+ * appropriate @c ACE_Time_Value as described in run().
+ **/
+ void perform_work (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS);
+ void perform_work (ACE_Time_Value &tv
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+ void perform_work (ACE_Time_Value *tv
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ /**
+ * This operation instructs the ORB to shut down. Shutting down the
+ * ORB causes all Object Adapters to be shut down. If
+ * @c wait_for_completion parameter is TRUE, this operation blocks
+ * until all ORB processing (including request processing and object
+ * deactivation or other operations associated with object adapters)
+ * has completed.
+ */
+ void shutdown (CORBA::Boolean wait_for_completion = false
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ /**
+ * Explicitly destroy the ORB, releasing any resources. Note that
+ * TAO *cannot* implicitly release the resources even if you have
+ * destroyed all the references to a particular ORB since
+ * CORBA::ORB_init() is required to return the same pointer if
+ * called with the same ORBid, only after ORB::destroy() is called
+ * it may return a new one.
+ *
+ * The results of multi-threaded applications, trying to destroy ()
+ * the ORB in one thread and trying to service a request in another
+ * thread are not well defined. TAO does not support such cases.
+ */
+ void destroy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS);
+
+ CORBA::Object_ptr resolve_initial_references (
+ const char *name
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ /**
+ * This method acts as a mini-bootstrapping Naming Service, which is
+ * provided by the ORB for certain well-known object references. TAO
+ * supports the "NameService", "TradingService", "RootPOA",
+ * "ImplRepo", and "POACurrent" via this method. The @c timeout
+ * value bounds the amount of time the ORB blocks waiting to
+ * resolve the service. This is most useful for bootstrapping
+ * remote services, such as the "NameService" or "TradingService",
+ * that are commonly resolved via multicast. By default, the
+ * value is 0, which means "use the @c
+ * TAO_DEFAULT_SERVICE_RESOLUTION_TIMEOUT timeout period".
+ *
+ * @note By using a default value for the @c timeout parameter,
+ * TAO will remains compliant with the CORBA
+ * resolve_initial_references() specification.
+ */
+ CORBA::Object_ptr resolve_initial_references (
+ const char *name,
+ ACE_Time_Value *timeout
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+#if !defined(CORBA_E_MICRO)
+ /// Register an object reference with the ORB.
+ void register_initial_reference (const char * id,
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+#endif
+
+ /// Returns a sequence of ObjectIds that lists which objects have
+ /// references available via the initial references mechanism.
+ CORBA::ORB::ObjectIdList_ptr list_initial_services (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS);
+
+#if !defined(CORBA_E_MICRO)
+ CORBA::Policy_ptr create_policy (CORBA::PolicyType type,
+ const CORBA::Any& val
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+#endif
+
+ // ----------------------------------------------------------------
+ // = TAO-specific extensions to the CORBA specification.
+ // ----------------------------------------------------------------
+
+#if !defined(CORBA_E_MICRO)
+ /// Create an empty policy, usually to be filled in later by
+ /// demarshaling.
+ CORBA::Policy_ptr _create_policy (CORBA::PolicyType type
+ ACE_ENV_ARG_DECL);
+#endif
+
+ // Reference counting...
+ unsigned long _incr_refcnt (void);
+ unsigned long _decr_refcnt (void);
+
+ /// Set the IOR flag.
+ void _use_omg_ior_format (CORBA::Boolean ior);
+
+ /// Get the IOR flag.
+ CORBA::Boolean _use_omg_ior_format (void);
+
+ /// Get the ORB core.
+ TAO_ORB_Core *orb_core (void) const;
+
+ /**
+ * TAO specific extension to get and set the client ID. The client
+ * id can be set by the application which would be used by the FT
+ * service. As there are no specific interfaces defined in the
+ * spec, we have this proprietary extension.
+ */
+ const ACE_CString &_tao_ft_client_id (void);
+ void _tao_ft_client_id (const char *id);
+
+ /// Factory method that creates an ORB.
+ static CORBA::ORB_ptr _tao_make_ORB (TAO_ORB_Core * orb_core);
+
+ // Useful for template programming.
+ typedef ORB_ptr _ptr_type;
+ typedef ORB_var _var_type;
+ typedef ORB_out _out_type;
+
+ /// Get the Timeout value
+ ACE_Time_Value *get_timeout (void);
+
+ protected:
+
+ // We must be created via the @c CORBA::ORB_init() function.
+ ORB (TAO_ORB_Core *orb_core);
+
+ /// Destructor
+ /**
+ * Protected destructor to enforce proper memory management
+ * through the reference counting mechanism.
+ */
+ ~ORB (void);
+
+ /// Resolve the Policy Manager for this ORB.
+ CORBA::Object_ptr resolve_policy_manager (void);
+
+ /// Resolve the Policy Current for this thread.
+ CORBA::Object_ptr resolve_policy_current (void);
+
+ private:
+
+ /// Resolve the given service based on the service ID.
+ /**
+ * "@c resolve_service" is a legacy name. This method now simply
+ * sets up a default initial reference that will be subsequently
+ * used in resolve_initial_references().
+ */
+ void resolve_service (TAO::MCAST_SERVICEID service_id);
+
+ /// Convert an OMG IOR into an object reference.
+ CORBA::Object_ptr ior_string_to_object (const char* ior
+ ACE_ENV_ARG_DECL);
+
+ /// Convert an URL style IOR into an object reference.
+ CORBA::Object_ptr url_ior_string_to_object (const char* ior
+ ACE_ENV_ARG_DECL);
+
+ /// Check if ORB has shutdown. If it has, throw the appropriate
+ /// exception.
+ void check_shutdown (ACE_ENV_SINGLE_ARG_DECL);
+
+ /// Set the timeout value
+ void set_timeout (ACE_Time_Value * timeout);
+
+ private:
+
+ /// Maintains a reference count of number of instantiations of the
+ /// ORB.
+ ACE_Atomic_Op<TAO_SYNCH_MUTEX, unsigned long> refcount_;
+
+ /// The ORB_Core that created us....
+ TAO_ORB_Core * orb_core_;
+
+ /// Decides whether to use the URL notation or to use IOR notation.
+ CORBA::Boolean use_omg_ior_format_;
+
+ // Prevent copying and assignment.
+ ORB (const ORB &);
+ ORB &operator= (const ORB &);
+
+ /// Timeout value
+ ACE_Time_Value * timeout_;
+
+ };
+} // End namespace CORBA
+
+namespace TAO
+{
+ namespace ORB
+ {
+ /// Initialize the ORB globals correctly, i.e., only when they
+ /// haven't been initialized yet.
+ void init_orb_globals (ACE_ENV_SINGLE_ARG_DECL);
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/ORB.i"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_ORB_H */
diff --git a/TAO/tao/ORB.i b/TAO/tao/ORB.i
new file mode 100644
index 00000000000..e4543a30593
--- /dev/null
+++ b/TAO/tao/ORB.i
@@ -0,0 +1,85 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// ---------------------------------------------------------------------------
+// ORB specific
+// ---------------------------------------------------------------------------
+
+ACE_INLINE unsigned long
+CORBA::ORB::_incr_refcnt (void)
+{
+ return ++this->refcount_;
+}
+
+ACE_INLINE unsigned long
+CORBA::ORB::_decr_refcnt (void)
+{
+ unsigned long count = --this->refcount_;
+
+ if (count != 0)
+ {
+ return count;
+ }
+
+ delete this;
+ return 0;
+}
+
+ACE_INLINE CORBA::ORB_ptr
+CORBA::ORB::_duplicate (CORBA::ORB_ptr obj)
+{
+ if (obj)
+ {
+ obj->_incr_refcnt ();
+ }
+
+ return obj;
+}
+
+// Null pointers represent nil objects.
+
+ACE_INLINE CORBA::ORB_ptr
+CORBA::ORB::_nil (void)
+{
+ return 0;
+}
+
+ACE_INLINE void
+CORBA::ORB::_use_omg_ior_format (CORBA::Boolean ior)
+{
+ this->use_omg_ior_format_ = ior;
+}
+
+ACE_INLINE CORBA::Boolean
+CORBA::ORB::_use_omg_ior_format (void)
+{
+ return this->use_omg_ior_format_;
+}
+
+ACE_INLINE TAO_ORB_Core *
+CORBA::ORB::orb_core (void) const
+{
+ return this->orb_core_;
+}
+
+// ************************************************************
+// These are in CORBA namespace
+// ************************************************************
+
+ACE_INLINE CORBA::Boolean
+CORBA::is_nil (CORBA::ORB_ptr obj)
+{
+ return obj == CORBA::ORB::_nil ();
+}
+
+ACE_INLINE void
+CORBA::release (CORBA::ORB_ptr obj)
+{
+ if (!CORBA::is_nil (obj))
+ obj->_decr_refcnt ();
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/ORBInitializer_Registry.cpp b/TAO/tao/ORBInitializer_Registry.cpp
new file mode 100644
index 00000000000..947a8408c26
--- /dev/null
+++ b/TAO/tao/ORBInitializer_Registry.cpp
@@ -0,0 +1,90 @@
+#include "tao/ORBInitializer_Registry.h"
+#include "tao/ORBInitializer_Registry_Adapter.h"
+#include "tao/PortableInterceptorC.h"
+#include "tao/ORB.h"
+#include "tao/ORB_Constants.h"
+#include "tao/TAO_Singleton_Manager.h"
+#include "tao/SystemException.h"
+
+#include "ace/Service_Config.h"
+#include "ace/Dynamic_Service.h"
+#include "ace/Static_Object_Lock.h"
+#include "ace/Recursive_Thread_Mutex.h"
+#include "ace/Log_Msg.h"
+
+ACE_RCSID (tao,
+ ORBInitializer_Registry,
+ "$Id$")
+
+
+// ****************************************************************
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace PortableInterceptor
+{
+ void
+ register_orb_initializer (
+ ORBInitializer_ptr init
+ ACE_ENV_ARG_DECL)
+ {
+ {
+ // Using ACE_Static_Object_Lock::instance() precludes
+ // register_orb_initializer() from being called within a static
+ // object CTOR.
+ ACE_MT (ACE_GUARD (TAO_SYNCH_RECURSIVE_MUTEX,
+ guard,
+ *ACE_Static_Object_Lock::instance ()));
+
+ // Make sure TAO's singleton manager is initialized.
+ if (TAO_Singleton_Manager::instance ()->init () == -1)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) register_orb_initializer: ")
+ ACE_TEXT ("Unable to pre-initialize TAO\n")));
+ }
+
+ TAO::ORB::init_orb_globals (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ // If not, lookup it up.
+ TAO::ORBInitializer_Registry_Adapter *orbinitializer_registry_ =
+ ACE_Dynamic_Service<TAO::ORBInitializer_Registry_Adapter>::instance
+ ("ORBInitializer_Registry", true); // only look in the local repo
+
+ #if !defined (TAO_AS_STATIC_LIBS)
+ if (orbinitializer_registry_ == 0)
+ {
+ ACE_Service_Config::process_directive (
+ ACE_DYNAMIC_SERVICE_DIRECTIVE("ORBInitializer_Registry",
+ "TAO_PI",
+ "_make_ORBInitializer_Registry",
+ ""));
+ orbinitializer_registry_ =
+ ACE_Dynamic_Service<TAO::ORBInitializer_Registry_Adapter>::instance
+ ("ORBInitializer_Registry");
+ }
+
+ #endif /* !TAO_AS_STATIC_LIBS */
+
+ if (orbinitializer_registry_ != 0)
+ {
+ orbinitializer_registry_->register_orb_initializer (
+ init
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) %p\n"),
+ ACE_TEXT ("ERROR: ORBInitializer Registry unable to find the ")
+ ACE_TEXT ("ORBInitializer Registry instance")));
+
+ ACE_THROW (CORBA::INTERNAL ());
+ }
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/ORBInitializer_Registry.h b/TAO/tao/ORBInitializer_Registry.h
new file mode 100644
index 00000000000..677e4c50436
--- /dev/null
+++ b/TAO/tao/ORBInitializer_Registry.h
@@ -0,0 +1,48 @@
+// -*- C++ -*-
+
+// ===================================================================
+/**
+ * @file ORBInitializer_Registry.h
+ *
+ * $Id$
+ *
+ * @author Ossama Othman <ossama@uci.edu>
+ */
+// ===================================================================
+
+#ifndef TAO_ORB_INITIALIZER_REGISTRY_H
+#define TAO_ORB_INITIALIZER_REGISTRY_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/TAO_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Environment.h"
+#include "tao/default_environment.h"
+
+#include "ace/CORBA_macros.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace PortableInterceptor
+{
+ class ORBInitializer;
+ typedef ORBInitializer *ORBInitializer_ptr;
+
+ /// Register an ORBInitializer with the global ORBInitializer
+ /// table.
+ TAO_Export void register_orb_initializer (
+ ORBInitializer_ptr init
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_ORB_INITIALIZER_REGISTRY_H */
diff --git a/TAO/tao/ORBInitializer_Registry_Adapter.cpp b/TAO/tao/ORBInitializer_Registry_Adapter.cpp
new file mode 100644
index 00000000000..1798764e211
--- /dev/null
+++ b/TAO/tao/ORBInitializer_Registry_Adapter.cpp
@@ -0,0 +1,18 @@
+// $Id$
+
+#include "tao/ORBInitializer_Registry_Adapter.h"
+
+ACE_RCSID (tao,
+ ORBInitializer_Registry_Adapter,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ ORBInitializer_Registry_Adapter::~ORBInitializer_Registry_Adapter (void)
+ {
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/ORBInitializer_Registry_Adapter.h b/TAO/tao/ORBInitializer_Registry_Adapter.h
new file mode 100644
index 00000000000..4515f10ec11
--- /dev/null
+++ b/TAO/tao/ORBInitializer_Registry_Adapter.h
@@ -0,0 +1,104 @@
+// -*- C++ -*-
+
+// ===================================================================
+/**
+ * @file ORBInitializer_Registry_Adapter.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+// ===================================================================
+
+#ifndef TAO_ORB_INITIALIZER_REGISTRY_ADAPTER_H
+#define TAO_ORB_INITIALIZER_REGISTRY_ADAPTER_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/TAO_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Basic_Types.h"
+#include "tao/SystemException.h"
+#include "ace/Service_Object.h"
+#include "ace/CORBA_macros.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_ORB_Core;
+
+namespace PortableInterceptor
+{
+ class ORBInitializer;
+ typedef ORBInitializer *ORBInitializer_ptr;
+
+ typedef CORBA::ULong SlotId;
+}
+
+namespace TAO
+{
+ /**
+ * @class ORBInitializer_Registry_Adapter
+ *
+ * Class that offers an interface to the ORB to load and manipulate
+ * ORBInitializer_Registry
+ */
+ class TAO_Export ORBInitializer_Registry_Adapter
+ : public ACE_Service_Object
+ {
+ public:
+ virtual ~ORBInitializer_Registry_Adapter (void);
+
+ /// Register an ORBInitializer with the underlying ORBInitializer
+ /// array.
+ virtual void register_orb_initializer (
+ PortableInterceptor::ORBInitializer_ptr init
+ ACE_ENV_ARG_DECL) = 0;
+
+ /**
+ * Begin initialization of all registered ORBInitializers before
+ * the ORB itself is initialized.
+ * @return Returns the number of initializers called by pre_init, exactly
+ * the same number must be called by post_init. During pre_init new
+ * initializers can be registered, these must not be called during
+ * post_init
+ */
+ virtual size_t pre_init (
+ TAO_ORB_Core *orb_core,
+ int argc,
+ char *argv[],
+ PortableInterceptor::SlotId &slotid
+ ACE_ENV_ARG_DECL) = 0;
+
+ /**
+ * Complete initialization of all registered ORBInitializers after
+ * the ORB has been initialized. Returns the number of slots
+ * allocated.
+ * @param pre_init_count The number of ORBInitializers we must
+ * call post_init on. There can be more in the registry when during
+ * pre_init new interceptors are regisered
+ * @param orb_core The ORB Core
+ * @param argc Number of arguments
+ * @param argv Argv array
+ * @param slotid The slot id
+ * @param picurrent PI Current, if this is not null, the concrete
+ * implementation will update the slot id
+ */
+ virtual void post_init (
+ size_t pre_init_count,
+ TAO_ORB_Core *orb_core,
+ int argc,
+ char *argv[],
+ PortableInterceptor::SlotId slotid
+ ACE_ENV_ARG_DECL) = 0;
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_ORB_INITIALIZER_REGISTRY_ADAPTER_H */
diff --git a/TAO/tao/ORB_Constants.h b/TAO/tao/ORB_Constants.h
new file mode 100644
index 00000000000..31449c5ee40
--- /dev/null
+++ b/TAO/tao/ORB_Constants.h
@@ -0,0 +1,240 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file ORB_Constants.h
+ *
+ * $Id$
+ *
+ * Constants needed by various files.
+ *
+ * @author Jeff Parsons
+ * @author Ossama Othman
+ */
+//=============================================================================
+
+#ifndef TAO_ORB_CONSTANTS_H
+#define TAO_ORB_CONSTANTS_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Basic_Types.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// A hash define for the regular two way operation.
+#define TAO_TWOWAY_RESPONSE_FLAG 255
+
+namespace CORBA
+{
+ /// The OMG Vendor Minor Codeset ID (VMCID).
+ /**
+ * This number is reserved by the OMG as a prefix to all the
+ * standard system exception minor codes. Check the CORBA/IIOP
+ * specification for details.
+ *
+ * OMG defined system exception minor codes should be logically
+ * OR-ed with this constant when passing such minor codes to a
+ * @c CORBA::SystemException constructor. For example, throwing a
+ * @c CORBA::BAD_PARAM exception with an OMG defined minor code of
+ * @c 2 is done as follows:
+ *
+ * @verbatim
+ * throw (CORBA::BAD_PARAM (CORBA::OMGVMCID | 2, CORBA::COMPLETED_NO);
+ * @endverbatim
+ *
+ * *NOT* as:
+ *
+ * @verbatim
+ * throw (CORBA::BAD_PARAM (2, CORBA::COMPLETED_NO);
+ * @endverbatim
+ */
+ const ULong OMGVMCID = 0x4f4d0000U;
+}
+
+namespace TAO
+{
+ /// TAO Vendor Minor Codeset ID (VMCID).
+ /**
+ * TAO Vendor Minor Codeset ID (VMCID) assigned by the OMG. Do
+ * *NOT* change at random. The TAO VMCID is an ASCII representation
+ * of @c TA0xxxx (close enough since a VMCID only consists of the
+ * higher order 20 bits of a 32 bit unsigned long integer). The
+ * first 16 bits are @c TA, and the remaining 4 are @c 0.
+ *
+ * @note Remember that we can only play with the lower order 12
+ * bits. @c MAX_MINOR_CODE is there to remind us of that.
+ *
+ * @see @c MAX_MINOR_CODE
+ */
+ const CORBA::ULong VMCID = 0x54410000U;
+
+ /// Maximum allowed TAO system exception minor code.
+ /**
+ * Vendors are only allowed to use the lower order 12 bits of their
+ * when defining vendor-specific exception minor codes.
+ * @c MAX_MINOR_CODE is the maximum minor code value available to
+ * TAO. Do not exceed it when defining TAO system exception minor
+ * codes.
+ *
+ * @see @c VMCID
+ */
+ const CORBA::ULong MAX_MINOR_CODE = VMCID | 0xfffU;
+
+ /// TAO Vendor @c PolicyType Valueset ID (VPVID)
+ /**
+ * TAO Vendor @c PolicyType Valueset ID (VPVID) assigned by the
+ * OMG. This value was automatically assigned when TAO's VMCID was
+ * assigned. Its value is always the same as the VMCID.
+ *
+ * As with TAO-specific system exception minor codes, the
+ * TAO-specific @c PolicyType space occupies the lower order 12 bits
+ * of the TAO VPVID, i.e.
+ *
+ * @verbatim
+ * TAO::VPVID <= TAO PolicyType <= TAO::VPVID | 0xfffU.
+ * @endverbatim
+ *
+ * For example, TAO-specific @c PolicyTypes should be defined by
+ * logically "OR-ing" a 12 bit or less (i.e. 0x0U <= value <=
+ * 0xfffU) value with @c TAO::VPVID.
+ *
+ * @see VMCID
+ */
+ const CORBA::ULong VPVID = VMCID;
+}
+
+/**
+ * @name TAO-Specific System Exception Minor Code Values
+ *
+ * These system exception minor code values are specific to TAO.
+ */
+//@{
+/// TAO VMCID assigned by the OMG.
+#if !defined (ACE_LACKS_DEPRECATED_MACROS)
+ /**
+ * @note This constant has historically been used in the wrong way.
+ * It was often used as the @a location argument to the @c
+ * CORBA::SystemException::_tao_minor_code() static method. A
+ * more appropriate default @a location argument/value would
+ * have been zero since the location code resides in portion of
+ * the lower order 12 bits, not the higher order 20 bits which
+ * is where the VMCID resides, and what this value happens to
+ * be.
+ *
+ * @deprecated Please use @c TAO::VMCID instead, or zero if being used
+ * as default TAO exception location code argument.
+ *
+ * @see @c TAO::VMCID
+ */
+ const CORBA::ULong TAO_DEFAULT_MINOR_CODE = TAO::VMCID;
+#endif /* !ACE_LACKS_DEPRECATED_MACROS */
+
+#if !defined (ACE_LACKS_DEPRECATED_MACROS)
+ /// Maximum allowed system exception minor code.
+ /**
+ * @deprecated Please use @c TAO::MAX_MINOR_CODE instead.
+ *
+ * @see @c TAO::MAX_MINOR_CODE
+ */
+ const CORBA::ULong TAO_MAX_MINOR_CODE = TAO::MAX_MINOR_CODE;
+#endif /* !ACE_LACKS_DEPRECATED_MACROS */
+//@}
+
+/// A dummy service context that is inserted in the service context
+/// list to preserve the alignment in DSI based gateways, so no
+/// marshaling/demarshaling is required.
+/**
+ * @note This is *extremely* brittle but works.
+ */
+const CORBA::ULong TAO_SVC_CONTEXT_ALIGN = 0x54414f00U;
+
+/**
+ * @name TAO-Specific Profile IDs
+ *
+ * The TAO @c IOP::ProfileId range @c 0x54414f00 - @c 0x54414f0f has
+ * been reserved with the OMG.
+ *
+ * @note It is *NOT* necessary to list your own protocols here.
+ *
+ * @note The values below are subject to change at any point.
+ */
+//@{
+/// Local IPC (Unix Domain)
+const CORBA::ULong TAO_TAG_UIOP_PROFILE = 0x54414f00U;
+
+/// ATM/AAL5
+// const CORBA::ULong TAO_TAG_AIOP_PROFILE = 0x54414f01U;
+
+/// Shared memory
+const CORBA::ULong TAO_TAG_SHMEM_PROFILE = 0x54414f02U;
+
+/// Message Queue
+// const CORBA::ULong TAO_TAG_MSGQ_PROFILE = 0x54414f03U;
+
+/// UDP
+const CORBA::ULong TAO_TAG_DIOP_PROFILE = 0x54414f04U;
+
+/// SCIOP
+const CORBA::ULong TAO_TAG_SCIOP_PROFILE = 0x54414f0EU;
+
+/// Tandem (HP) File System Protocol
+const CORBA::ULong TAO_TAG_NSKFS_PROFILE = 0x00003039U;
+
+/// Tandem (HP) Pathsend Protocol
+const CORBA::ULong TAO_TAG_NSKPW_PROFILE = 0x0000303AU;
+
+// Default DiffServ CodePoint.
+const int IPDSFIELD_DSCP_DEFAULT = 0x00;
+
+/**
+ * @name Minor Code Encoding
+ *
+ * Encode the location in 5 bits, and the errno in 7 bits:
+ *
+ * @verbatim
+ * 0x 0101 0100 0100 0001 0000 ____ _ ___ ____
+ * T A 0 location errno
+ * @endverbatim
+ **/
+//@{
+/**
+ * @name Location Encoding
+ *
+ * The location encoding is the 5 bits, after the @ errno encoding.
+ */
+//@{
+const CORBA::ULong TAO_INVOCATION_LOCATION_FORWARD_MINOR_CODE = (0x01U << 7);
+const CORBA::ULong TAO_INVOCATION_SEND_REQUEST_MINOR_CODE = (0x02U << 7);
+const CORBA::ULong TAO_POA_DISCARDING = (0x03U << 7);
+const CORBA::ULong TAO_POA_HOLDING = (0x04U << 7);
+const CORBA::ULong TAO_UNHANDLED_SERVER_CXX_EXCEPTION = (0x05U << 7);
+const CORBA::ULong TAO_INVOCATION_RECV_REQUEST_MINOR_CODE = (0x06U << 7);
+const CORBA::ULong TAO_CONNECTOR_REGISTRY_NO_USABLE_PROTOCOL = (0x07U << 7);
+const CORBA::ULong TAO_MPROFILE_CREATION_ERROR = (0x08U << 7);
+const CORBA::ULong TAO_TIMEOUT_CONNECT_MINOR_CODE = (0x09U << 7);
+const CORBA::ULong TAO_TIMEOUT_SEND_MINOR_CODE = (0x0AU << 7);
+const CORBA::ULong TAO_TIMEOUT_RECV_MINOR_CODE = (0x0BU << 7);
+const CORBA::ULong TAO_IMPLREPO_MINOR_CODE = (0x0CU << 7);
+const CORBA::ULong TAO_ACCEPTOR_REGISTRY_OPEN_LOCATION_CODE = (0x0DU << 7);
+const CORBA::ULong TAO_ORB_CORE_INIT_LOCATION_CODE = (0x0EU << 7);
+const CORBA::ULong TAO_POLICY_NARROW_CODE = (0x0FU << 7);
+const CORBA::ULong TAO_GUARD_FAILURE = (0x10U << 7);
+const CORBA::ULong TAO_POA_BEING_DESTROYED = (0x11U << 7);
+const CORBA::ULong TAO_POA_INACTIVE = (0x12U << 7);
+const CORBA::ULong TAO_CONNECTOR_REGISTRY_INIT_LOCATION_CODE = (0x13U << 7);
+const CORBA::ULong TAO_AMH_REPLY_LOCATION_CODE = (0x14U << 7);
+const CORBA::ULong TAO_RTCORBA_THREAD_CREATION_LOCATION_CODE = (0x15U << 7);
+// *Don't* use TAO_<location>_MINOR_CODE greater than 0x1FU!
+//@}
+//@}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_ORB_CONSTANTS_H */
diff --git a/TAO/tao/ORB_Core.cpp b/TAO/tao/ORB_Core.cpp
new file mode 100644
index 00000000000..758ff292d7d
--- /dev/null
+++ b/TAO/tao/ORB_Core.cpp
@@ -0,0 +1,3580 @@
+// $Id$
+
+#include "tao/ORB_Core.h"
+#include "tao/ORB_Core_TSS_Resources.h"
+#include "tao/ORB_Table.h"
+#include "tao/TAO_Internal.h"
+#include "tao/default_server.h"
+#include "tao/Profile.h"
+#include "tao/Stub.h"
+#include "tao/LF_Follower.h"
+#include "tao/Leader_Follower.h"
+#include "tao/LF_Event_Loop_Thread_Helper.h"
+#include "tao/Connector_Registry.h"
+#include "tao/Transport_Queueing_Strategies.h"
+#include "tao/Object_Loader.h"
+#include "tao/ObjectIdListC.h"
+#include "tao/BiDir_Adapter.h"
+#include "tao/Collocation_Resolver.h"
+#include "tao/Flushing_Strategy.h"
+#include "tao/Request_Dispatcher.h"
+#include "tao/Stub_Factory.h"
+#include "tao/Thread_Lane_Resources.h"
+#include "tao/Thread_Lane_Resources_Manager.h"
+#include "tao/TSS_Resources.h"
+#include "tao/Protocols_Hooks.h"
+#include "tao/IORInterceptor_Adapter.h"
+#include "tao/IORInterceptor_Adapter_Factory.h"
+#include "tao/debug.h"
+#include "tao/TAOC.h"
+#include "tao/Endpoint_Selector_Factory.h"
+#include "tao/Client_Strategy_Factory.h"
+#include "tao/Adapter_Factory.h"
+#include "tao/Adapter.h"
+#include "tao/GUIResource_Factory.h"
+#include "tao/PolicyFactory_Registry_Adapter.h"
+#include "tao/PolicyFactory_Registry_Factory.h"
+#include "tao/ORBInitializer_Registry_Adapter.h"
+#include "tao/Codeset_Manager.h"
+#include "tao/GIOP_Fragmentation_Strategy.h"
+
+#include "tao/Valuetype_Adapter.h"
+#include "tao/Valuetype_Adapter_Factory.h"
+
+#if (TAO_HAS_CORBA_MESSAGING == 1)
+#include "tao/Policy_Manager.h"
+#include "tao/Policy_Current.h"
+#endif /* TAO_HAS_CORBA_MESSAGING == 1 */
+
+#include "ace/Reactor.h"
+#include "ace/Dynamic_Service.h"
+#include "ace/Arg_Shifter.h"
+#include "ace/Argv_Type_Converter.h"
+#include "ace/Static_Object_Lock.h"
+
+
+#if !defined (ACE_LACKS_IOSTREAM_TOTALLY)
+// Needed to set ACE_LOG_MSG::msg_ostream()
+// FUZZ: disable check_for_streams_include
+# include "ace/streams.h"
+#endif /* !ACE_LACKS_IOSTREAM_TOTALLY */
+
+#include "ace/OS_NS_strings.h"
+#include "ace/OS_NS_string.h"
+#include "ace/Message_Block.h"
+
+#if TAO_HAS_INTERCEPTORS == 1
+# include "tao/ClientRequestInterceptor_Adapter.h"
+# include "tao/ClientRequestInterceptor_Adapter_Factory.h"
+# include "tao/ServerRequestInterceptor_Adapter.h"
+# include "tao/ServerRequestInterceptor_Adapter_Factory.h"
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+
+
+#if !defined (__ACE_INLINE__)
+# include "tao/ORB_Core.i"
+#endif /* ! __ACE_INLINE__ */
+
+ACE_RCSID (tao,
+ ORB_Core,
+ "$Id$")
+
+ACE_STATIC_SVC_DEFINE(TAO_ORB_Core_Static_Resources,
+ ACE_TEXT ("TAO_ORB_Core_Static_Resources"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (TAO_ORB_Core_Static_Resources),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0)
+ACE_FACTORY_DEFINE (TAO, TAO_ORB_Core_Static_Resources)
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// ****************************************************************
+
+CORBA::Environment&
+TAO_default_environment (void)
+{
+ return *TAO_TSS_Resources::instance ()->default_environment_;
+}
+
+// ****************************************************************
+
+// Initialize instance_ to 0, since this is what we test for in the call
+// to instance (). Note that this does not require a constructor call, so
+// it is always initialized by the time that instance () can be called.
+//TAO_ORB_Core_Static_Resources* TAO_ORB_Core_Static_Resources::instance_ = 0;
+
+// Force an instance to be created at module initialization time,
+// since we do not want to worry about double checked locking and
+// the race condition to initialize the lock.
+TAO_ORB_Core_Static_Resources*
+TAO_ORB_Core_Static_Resources::initialization_reference_ =
+ TAO_ORB_Core_Static_Resources::instance ();
+
+TAO_ORB_Core_Static_Resources*
+TAO_ORB_Core_Static_Resources::instance (void)
+{
+ ACE_Service_Gestalt *current = ACE_Service_Config::current();
+ TAO_ORB_Core_Static_Resources* tocsr =
+ ACE_Dynamic_Service<TAO_ORB_Core_Static_Resources>::instance
+ (current,"TAO_ORB_Core_Static_Resources",true);
+
+ if (tocsr == 0)
+ {
+ // This new is never freed on purpose. The data specified by
+ // it needs to be around for the last shared library that references
+ // this class. This could occur in a destructor in a shared library
+ // that is unloaded after this one. One solution to avoid this
+ // harmless memory leak would be to use reference counting.
+ current->process_directive(ace_svc_desc_TAO_ORB_Core_Static_Resources);
+ tocsr = ACE_Dynamic_Service<TAO_ORB_Core_Static_Resources>::instance
+ (current,"TAO_ORB_Core_Static_Resources",true);
+
+ ACE_Service_Gestalt *global = ACE_Service_Config::global();
+ if (current != global)
+ {
+ TAO_ORB_Core_Static_Resources* global_tocsr =
+ ACE_Dynamic_Service<TAO_ORB_Core_Static_Resources>::instance
+ (global,"TAO_ORB_Core_Static_Resources");
+ *tocsr = *global_tocsr;
+ }
+ }
+
+ // return TAO_ORB_Core_Static_Resources::instance_;
+ return tocsr;
+}
+
+TAO_ORB_Core_Static_Resources::TAO_ORB_Core_Static_Resources (void)
+ : sync_scope_hook_ (0),
+ protocols_hooks_name_ ("Protocols_Hooks"),
+ timeout_hook_ (0),
+ connection_timeout_hook_ (0),
+ endpoint_selector_factory_name_ ("Default_Endpoint_Selector_Factory"),
+ thread_lane_resources_manager_factory_name_
+ ("Default_Thread_Lane_Resources_Manager_Factory"),
+
+ collocation_resolver_name_ ("Default_Collocation_Resolver"),
+ stub_factory_name_ ("Default_Stub_Factory"),
+ resource_factory_name_ ("Resource_Factory"),
+ dynamic_adapter_name_ ("Dynamic_Adapter"),
+ ifr_client_adapter_name_ ("IFR_Client_Adapter"),
+ typecodefactory_adapter_name_ ("TypeCodeFactory_Adapter"),
+ iorinterceptor_adapter_factory_name_ ("IORInterceptor_Adapter_Factory"),
+ valuetype_adapter_factory_name_ ("Valuetype_Adapter_Factory"),
+ poa_factory_name_ ("TAO_Object_Adapter_Factory"),
+ poa_factory_directive_
+ (ACE_TEXT_ALWAYS_CHAR
+ (ACE_DYNAMIC_SERVICE_DIRECTIVE("TAO_Object_Adapter_Factory",
+ "TAO_PortableServer",
+ "_make_TAO_Object_Adapter_Factory",
+ ""))),
+ alt_connection_timeout_hook_ (0)
+{
+}
+
+TAO_ORB_Core_Static_Resources&
+TAO_ORB_Core_Static_Resources::operator=(const TAO_ORB_Core_Static_Resources& other)
+{
+ this->sync_scope_hook_ = other.sync_scope_hook_;
+ this->protocols_hooks_name_ = other.protocols_hooks_name_;
+ this->timeout_hook_ = other.timeout_hook_;
+ this->connection_timeout_hook_ = other.connection_timeout_hook_;
+ this->endpoint_selector_factory_name_ =
+ other.endpoint_selector_factory_name_;
+ this->thread_lane_resources_manager_factory_name_ =
+ other.thread_lane_resources_manager_factory_name_;
+ this->collocation_resolver_name_ = other.collocation_resolver_name_;
+ this->stub_factory_name_ = other.stub_factory_name_;
+ this->resource_factory_name_ = other.resource_factory_name_;
+ this->dynamic_adapter_name_ = other.dynamic_adapter_name_;
+ this->ifr_client_adapter_name_ = other.ifr_client_adapter_name_;
+ this->typecodefactory_adapter_name_ = other.typecodefactory_adapter_name_;
+ this->iorinterceptor_adapter_factory_name_ =
+ other.iorinterceptor_adapter_factory_name_;
+ this->valuetype_adapter_factory_name_ =
+ other.valuetype_adapter_factory_name_;
+ this->poa_factory_name_ = other.poa_factory_name_;
+ this->poa_factory_directive_ = other.poa_factory_directive_;
+ this->alt_connection_timeout_hook_ = other.alt_connection_timeout_hook_;
+ return *this;
+}
+
+// ****************************************************************
+
+TAO_ORB_Core::TAO_ORB_Core (const char *orbid)
+ : protocols_hooks_ (0),
+#if TAO_USE_LOCAL_MEMORY_POOL == 1
+ use_local_memory_pool_ (true),
+#else
+ use_local_memory_pool_ (false),
+#endif
+ lock_ (),
+ thread_lane_resources_manager_ (0),
+ collocation_resolver_ (0),
+ stub_factory_ (0),
+ protocol_factories_ (0),
+ implrepo_service_ (CORBA::Object::_nil ()),
+ use_implrepo_ (0),
+ imr_endpoints_in_ior_ (1),
+ typecode_factory_ (CORBA::Object::_nil ()),
+ codec_factory_ (CORBA::Object::_nil ()),
+ dynany_factory_ (CORBA::Object::_nil ()),
+ ior_manip_factory_ (CORBA::Object::_nil ()),
+ ior_table_ (CORBA::Object::_nil ()),
+ orb_ (CORBA::ORB::_nil ()),
+ root_poa_ (),
+ orb_params_ (),
+ init_ref_map_ (TAO_DEFAULT_OBJECT_REF_TABLE_SIZE),
+ object_ref_table_ (),
+ object_key_table_ (),
+ orbid_ (ACE_OS::strdup (orbid ? orbid : "")),
+ resource_factory_ (0),
+ client_factory_ (0),
+ server_factory_ (0),
+ opt_for_collocation_ (1),
+ use_global_collocation_ (1),
+ collocation_strategy_ (THRU_POA),
+
+#if (TAO_HAS_CORBA_MESSAGING == 1)
+
+ policy_manager_ (0),
+ default_policies_ (0),
+ policy_current_ (0),
+
+#endif /* TAO_HAS_CORBA_MESSAGING == 1 */
+
+ poa_current_ (),
+ adapter_registry_ (this),
+ poa_adapter_ (0),
+ tm_ (),
+ tss_cleanup_funcs_ (),
+ tss_resources_ (),
+ has_shutdown_ (1), // Start the ORB in a "shutdown" state. Only
+ // after CORBA::ORB_init() is called will the
+ // ORB no longer be shutdown. This does not
+ // mean that the ORB can be reinitialized. It
+ // can only be initialized once.
+ thread_per_connection_use_timeout_ (1),
+ open_lock_ (),
+ endpoint_selector_factory_ (0),
+#if (TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1)
+ eager_transport_queueing_strategy_ (0),
+ delayed_transport_queueing_strategy_ (0),
+ flush_transport_queueing_strategy_ (0),
+#endif /* TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1 */
+ default_transport_queueing_strategy_ (0),
+ refcount_ (1),
+ policy_factory_registry_ (0),
+ orbinitializer_registry_ (0),
+#if (TAO_HAS_INTERCEPTORS == 1)
+ pi_current_ (CORBA::Object::_nil ()),
+ client_request_interceptor_adapter_ (0),
+ server_request_interceptor_adapter_ (0),
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ ior_interceptor_adapter_ (0),
+ valuetype_adapter_ (0),
+ parser_registry_ (),
+ bidir_adapter_ (0),
+ bidir_giop_policy_ (0),
+ flushing_strategy_ (0),
+ codeset_manager_ (0)
+{
+#if (TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1)
+
+ ACE_NEW (this->eager_transport_queueing_strategy_,
+ TAO::Eager_Transport_Queueing_Strategy);
+
+ ACE_NEW (this->delayed_transport_queueing_strategy_,
+ TAO::Delayed_Transport_Queueing_Strategy);
+
+ ACE_NEW (this->flush_transport_queueing_strategy_,
+ TAO::Flush_Transport_Queueing_Strategy);
+
+#endif /* TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1 */
+
+#if (TAO_HAS_CORBA_MESSAGING == 1)
+
+ ACE_NEW (this->policy_manager_,
+ TAO_Policy_Manager);
+
+ ACE_NEW (this->default_policies_,
+ TAO_Policy_Set (TAO_POLICY_ORB_SCOPE));
+
+ ACE_NEW (this->policy_current_,
+ TAO_Policy_Current);
+
+#endif /* TAO_HAS_CORBA_MESSAGING == 1 */
+
+ ACE_NEW (this->default_transport_queueing_strategy_,
+ TAO::Default_Transport_Queueing_Strategy);
+
+ // Initialize the default request dispatcher.
+ ACE_NEW (this->request_dispatcher_,
+ TAO_Request_Dispatcher);
+
+ // @TODO: Can this be dynamic container instead?
+ if (ACE_OS::strnlen (this->orbid_, 1) == 0)
+ {
+ ACE_NEW (this->config_,
+ ACE_Service_Gestalt (ACE_Service_Gestalt::MAX_SERVICES,
+ false)); // (Re)use the process-global repository
+ }
+ else
+ {
+ ACE_NEW (this->config_,
+ ACE_Service_Gestalt (ACE_Service_Gestalt::MAX_SERVICES / 4,
+ true)); // Use our own service repository
+ }
+}
+
+TAO_ORB_Core::~TAO_ORB_Core (void)
+{
+ delete this->thread_lane_resources_manager_;
+
+ delete this->flushing_strategy_;
+
+ ACE_OS::free (this->orbid_);
+
+#if (TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1)
+
+ delete this->eager_transport_queueing_strategy_;
+ delete this->delayed_transport_queueing_strategy_;
+ delete this->flush_transport_queueing_strategy_;
+
+#endif /* TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1 */
+
+#if (TAO_HAS_CORBA_MESSAGING == 1)
+
+ ::CORBA::release (this->policy_manager_);
+ delete this->default_policies_;
+ ::CORBA::release (this->policy_current_);
+
+#endif /* TAO_HAS_CORBA_MESSAGING == 1 */
+
+ delete this->default_transport_queueing_strategy_;
+
+ delete this->request_dispatcher_;
+
+ delete this->policy_factory_registry_;
+
+ // Don't delete, is a process wide singleton shared by all orbs
+ orbinitializer_registry_ = 0;
+
+ ::CORBA::release (this->orb_);
+
+ delete this->config_;
+ this->config_ = 0;
+}
+
+int
+TAO_ORB_Core::init (int &argc, char *argv[] ACE_ENV_ARG_DECL)
+{
+ // Right now, this code expects to begin parsing in argv[1] rather
+ // than argv[0]. I don't think that's wise. I think we need to
+ // change that convention to argv[0] and let the initializing code
+ // make any necessary shifts.
+ //
+ // Parse arguments to the ORB. Typically the ORB is passed
+ // arguments straight from the command line, so we will simply pass
+ // through them and respond to the ones we understand and ignore
+ // those we don't.
+ //
+ // In some instances, we may actually build another vector of
+ // arguments and stash it for use initializing other components such
+ // as the RootPOA.
+
+ // @@ GIOPLite should be an alternative ORB Messaging protocols, fredk
+ // int giop_lite = 0;
+
+ bool use_ior = true;
+ int cdr_tradeoff = ACE_DEFAULT_CDR_MEMCPY_TRADEOFF;
+
+ // The following things should be changed to use the ACE_Env_Value<>
+ // template sometime.
+
+ // Name Service port use for Multicast
+ unsigned short ns_port = 0;
+
+ // Trading Service port used for Multicast
+ unsigned short ts_port = 0;
+
+ // Implementation Repository Service port #.
+ unsigned short ir_port = 0;
+
+ // Buffer sizes for kernel socket buffers
+ // @@ should be a default defined for each protocol implementation?
+ // since we may have protocols loaded which use shared memory of
+ // some form, fredk
+ int rcv_sock_size = -1;
+ int snd_sock_size = -1;
+
+ // Use TCP_NODELAY.
+ int nodelay = 1;
+
+ // Use SO_KEEPALIVE (default 0).
+ int so_keepalive = 0;
+
+ // Use SO_DONTROUTE (default 0)
+ int so_dontroute = 0;
+
+ // Use dotted decimal addresses
+ // @@ This option will be treated as a suggestion to each loaded
+ // protocol to use a character representation for the numeric
+ // address, otherwise use a logical name. fredk
+#if (TAO_USE_DOTTED_DECIMAL_ADDRESSES == 1)
+ int dotted_decimal_addresses = 1;
+#else
+ int dotted_decimal_addresses = 0;
+#endif /* TAO_USE_DOTTED_DECIMAL_ADDRESSES */
+
+ // Disable looking up the host name for incoming connections.
+ int no_server_side_name_lookups = 0;
+
+#if defined (TAO_STD_PROFILE_COMPONENTS)
+ int std_profile_components = 1;
+#else
+ int std_profile_components = 0;
+#endif /* TAO_STD_PROFILE_COMPONENTS */
+
+ int linger = -1;
+
+ int use_parallel_connects = 0;
+
+ // Copy command line parameter not to use original.
+ ACE_Argv_Type_Converter command_line (argc, argv);
+
+ ACE_Arg_Shifter arg_shifter (command_line.get_argc (),
+ command_line.get_TCHAR_argv ());
+
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
+ monitor,
+ this->lock_,
+ -1);
+
+#if (TAO_NEGOTIATE_CODESETS == 1)
+ int negotiate_codesets = 1;
+#else
+ int negotiate_codesets = 0;
+#endif /* TAO_NEGOTIATE_CODESETS */
+
+ // Pick up the value of the use_implrepo_ flag from an environment variable
+ // called "TAO_USE_IMR". Do it here so that it can be overridden by
+ // the "-ORBUseIMR" command line argument.
+ //
+ char* const use_IMR_env_var_value = ACE_OS::getenv ("TAO_USE_IMR") ;
+ if (use_IMR_env_var_value != 0)
+ {
+ this->use_implrepo_ = ACE_OS::atoi (use_IMR_env_var_value) ;
+ }
+
+
+ while (arg_shifter.is_anything_left ())
+ {
+ const ACE_TCHAR *current_arg = 0;
+
+ ////////////////////////////////////////////////////////////////
+ // begin with the 'parameterless' flags //
+ ////////////////////////////////////////////////////////////////
+ if (0 != (current_arg = arg_shifter.get_the_parameter
+ (ACE_TEXT("-ORBDottedDecimalAddresses"))))
+ {
+ // Use dotted decimal addresses
+ // @@ this should be renamed. See above comment. fredk
+ dotted_decimal_addresses =
+ ACE_OS::atoi (current_arg);
+
+ arg_shifter.consume_arg ();
+ }
+ else if (0 != (current_arg = arg_shifter.get_the_parameter
+ (ACE_TEXT("-ORBNoServerSideNameLookups"))))
+ {
+ // Don't look up the host name for incoming connections
+ no_server_side_name_lookups =
+ ACE_OS::atoi (current_arg);
+
+ arg_shifter.consume_arg ();
+ }
+ else if (0 != (current_arg = arg_shifter.get_the_parameter
+ (ACE_TEXT("-ORBNameServicePort"))))
+ {
+ // Specify the port number for the NameService.
+ // Unrelated to ORB Protocols, this is used for multicast.
+
+ ns_port = static_cast <CORBA::UShort> (ACE_OS::atoi (current_arg));
+
+ arg_shifter.consume_arg ();
+ }
+ else if (0 != (current_arg = arg_shifter.get_the_parameter
+ (ACE_TEXT("-ORBMulticastDiscoveryEndpoint"))))
+ {
+ // Specify mcast address:port@network_interface for the
+ // Naming Service Multicast Discovery Protocol.
+ // If there is no colon, its only the port no.
+ // If there is a '@' also, it means that the network
+ // interface name is specified.
+ this->orb_params ()->mcast_discovery_endpoint (
+ ACE_TEXT_ALWAYS_CHAR(current_arg));
+
+ arg_shifter.consume_arg ();
+ }
+ else if (0 != (current_arg = arg_shifter.get_the_parameter
+ (ACE_TEXT("-ORBNodelay"))))
+ {
+ // Use TCP_NODELAY or not.
+ nodelay =
+ ACE_OS::atoi (current_arg);
+
+ arg_shifter.consume_arg ();
+ }
+ else if (0 != (current_arg = arg_shifter.get_the_parameter
+ (ACE_LIB_TEXT("-ORBKeepalive"))))
+ {
+ // Use SO_KEEPALIVE or not.
+ so_keepalive =
+ ACE_OS::atoi (current_arg);
+
+ arg_shifter.consume_arg ();
+ }
+ else if (0 != (current_arg = arg_shifter.get_the_parameter
+ (ACE_LIB_TEXT("-ORBDontRoute"))))
+ {
+ // Use SO_DONTROUTE or not.
+ so_dontroute =
+ ACE_OS::atoi (current_arg);
+
+ arg_shifter.consume_arg ();
+ }
+ else if (0 != (current_arg = arg_shifter.get_the_parameter
+ (ACE_TEXT("-ORBTradingServicePort"))))
+ {
+ // Specify the port number for the TradingService.
+
+ ts_port = static_cast <CORBA::UShort> (ACE_OS::atoi (current_arg));
+
+ arg_shifter.consume_arg ();
+ }
+ else if (0 != (current_arg = arg_shifter.get_the_parameter
+ (ACE_TEXT("-ORBImplRepoServicePort"))))
+ {
+ // Specify the multicast port number for the Implementation
+ // Repository.
+ ir_port = static_cast <CORBA::UShort> (ACE_OS::atoi (current_arg));
+
+ arg_shifter.consume_arg ();
+ }
+ else if (0 != (current_arg = arg_shifter.get_the_parameter
+ (ACE_TEXT("-ORBRcvSock"))))
+ {
+ // @@ All protocol implementation may not use sockets, so
+ // this can either be a generic I/O Buffer size or
+ // Buffer info can be a per protocol specification, fredk
+
+ // Specify the size of the socket's receive buffer
+
+ rcv_sock_size = ACE_OS::atoi (current_arg);
+
+ arg_shifter.consume_arg ();
+ }
+ else if (0 != (current_arg = arg_shifter.get_the_parameter
+ (ACE_TEXT("-ORBSndSock"))))
+ {
+ // @@ All protocol implementation may not use sockets, so
+ // this can either be a generic I/O Buffer size or
+ // Buffer info can be a per protocol specification, fredk
+
+ // Specify the size of the socket's send buffer
+ snd_sock_size = ACE_OS::atoi (current_arg);
+
+ arg_shifter.consume_arg ();
+ }
+ else if (0 != (current_arg = arg_shifter.get_the_parameter
+ (ACE_TEXT("-ORBObjRefStyle"))))
+ {
+ // Specifies the style of printed objrefs: URL or IOR
+ //
+ // BEGIN COMMENTS FROM IIOP-1.4 On Win32, we should be
+ // collecting information from the Registry such as what
+ // ORBs are configured, specific configuration details like
+ // whether they generate IOR or URL style stringified
+ // objrefs and which addresses they listen to (e.g. allowing
+ // multihomed hosts to implement firewalls), user-meaningful
+ // orb names (they will normally indicate domains), and
+ // more.
+ //
+ // On UNIX, we should collect that from some private config
+ // file.
+ //
+ // Instead, this just treats the "internet" ORB name
+ // specially and makes it always use URL-style stringified
+ // objrefs, where the hostname and TCP port number are
+ // explicit (and the whole objref is readable by mortals).
+ // BEGIN COMMENTS FROM IIOP-1.4
+ const ACE_TCHAR *opt = current_arg;
+ if (ACE_OS::strcasecmp (opt, ACE_TEXT("URL")) == 0)
+ use_ior = false;
+ else if (ACE_OS::strcasecmp (opt, ACE_TEXT("IOR")) == 0)
+ use_ior = true;
+
+ arg_shifter.consume_arg ();
+ }
+ else if (0 != (current_arg = arg_shifter.get_the_parameter
+ (ACE_TEXT("-ORBCollocationStrategy"))))
+ {
+ // Specify which collocation policy we want to use.
+ const ACE_TCHAR *opt = current_arg;
+ if (ACE_OS::strcasecmp (opt, ACE_TEXT("thru_poa")) == 0)
+ this->collocation_strategy_ = THRU_POA;
+ else if (ACE_OS::strcasecmp (opt, ACE_TEXT("direct")) == 0)
+ this->collocation_strategy_ = DIRECT;
+
+ arg_shifter.consume_arg ();
+ }
+ else if (0 != (current_arg = arg_shifter.get_the_parameter
+ (ACE_TEXT("-ORBCollocation"))))
+ {
+ // Specify whether we want to optimize against collocation
+ // objects. Valid arguments are: "global", "no", and "per-orb".
+ // Default is global.
+
+ const ACE_TCHAR *opt = current_arg;
+ if (ACE_OS::strcasecmp (opt, ACE_TEXT("global")) == 0)
+ {
+ this->opt_for_collocation_ = 1;
+ this->use_global_collocation_ = 1;
+ }
+ else if (ACE_OS::strcasecmp (opt, ACE_TEXT("NO")) == 0)
+ {
+ this->opt_for_collocation_ = 0;
+ this->use_global_collocation_ = 0;
+ }
+ else if (ACE_OS::strcasecmp (opt, ACE_TEXT("per-orb")) == 0)
+ {
+ this->opt_for_collocation_ = 1;
+ this->use_global_collocation_ = 0;
+ }
+ else
+ {
+ ACE_DEBUG ((LM_WARNING,
+ ACE_TEXT ("WARNING: Unknown option to ")
+ ACE_TEXT ("'-ORBCollocation': %s\n"), opt));
+ }
+
+ arg_shifter.consume_arg ();
+ }
+ else if (0 != (current_arg = arg_shifter.get_the_parameter
+ (ACE_TEXT("-ORBPreferredInterfaces"))))
+ {
+ if (this->orb_params ()->preferred_interfaces (
+ ACE_TEXT_ALWAYS_CHAR (current_arg)) == false)
+ ACE_THROW_RETURN (CORBA::INTERNAL (
+ CORBA::SystemException::_tao_minor_code (
+ TAO_ORB_CORE_INIT_LOCATION_CODE,
+ 0),
+ CORBA::COMPLETED_NO),
+ -1);
+
+ arg_shifter.consume_arg ();
+ }
+ else if (0 != (current_arg = arg_shifter.get_the_parameter
+ (ACE_TEXT("-ORBEnforcePreferredInterfaces"))))
+ {
+ int enforce_pref_interfaces = ACE_OS::atoi (current_arg);
+ if (enforce_pref_interfaces)
+ this->orb_params ()->enforce_pref_interfaces (false);
+ else
+ this->orb_params ()->enforce_pref_interfaces (true);
+
+ arg_shifter.consume_arg ();
+ }
+#if defined (ACE_HAS_IPV6)
+ else if ((current_arg = arg_shifter.get_the_parameter
+ (ACE_TEXT("-ORBPreferIPV6Interfaces"))))
+ {
+ int prefer_ipv6_interfaces = ACE_OS::atoi (current_arg);
+ if (prefer_ipv6_interfaces)
+ this->orb_params ()->prefer_ipv6_interfaces (true);
+ else
+ this->orb_params ()->prefer_ipv6_interfaces (false);
+
+ arg_shifter.consume_arg ();
+ }
+ else if ((current_arg = arg_shifter.get_the_parameter
+ (ACE_TEXT("-ORBConnectIPV6Only"))))
+ {
+ int connect_ipv6_only = ACE_OS::atoi (current_arg);
+ if (connect_ipv6_only)
+ this->orb_params ()->connect_ipv6_only (true);
+ else
+ this->orb_params ()->connect_ipv6_only (false);
+
+ arg_shifter.consume_arg ();
+ }
+#endif /* ACE_HAS_IPV6 */
+ else if (0 != (current_arg = arg_shifter.get_the_parameter
+ (ACE_TEXT("-ORBCDRTradeoff"))))
+ {
+ cdr_tradeoff = ACE_OS::atoi (current_arg);
+
+ arg_shifter.consume_arg ();
+ }
+
+ // A new <ObjectID>:<IOR> mapping has been specified. This will be
+ // used by the resolve_initial_references ().
+
+ else if (0 != (current_arg = arg_shifter.get_the_parameter
+ (ACE_TEXT("-ORBInitRef"))))
+ {
+ const ACE_TCHAR *pos = ACE_OS::strchr (current_arg, '=');
+ if (pos == 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("Invalid ORBInitRef argument '%s'")
+ ACE_TEXT ("format is ObjectID=IOR\n"),
+ current_arg));
+ ACE_THROW_RETURN (CORBA::INTERNAL (
+ CORBA::SystemException::_tao_minor_code (
+ TAO_ORB_CORE_INIT_LOCATION_CODE,
+ 0),
+ CORBA::COMPLETED_NO),
+ -1);
+ }
+ ACE_CString object_id (ACE_TEXT_ALWAYS_CHAR(current_arg),
+ pos - current_arg);
+ ACE_CString IOR (ACE_TEXT_ALWAYS_CHAR(pos + 1));
+ if (!this->init_ref_map_.insert (
+ std::make_pair (InitRefMap::key_type (object_id),
+ InitRefMap::data_type (IOR))).second)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("Duplicate -ORBInitRef ")
+ ACE_TEXT ("argument '%s'\n"),
+ current_arg));
+ ACE_THROW_RETURN (CORBA::INTERNAL (
+ CORBA::SystemException::_tao_minor_code (
+ TAO_ORB_CORE_INIT_LOCATION_CODE,
+ 0),
+ CORBA::COMPLETED_NO),
+ -1);
+ }
+ arg_shifter.consume_arg ();
+ }
+ else if (0 != (current_arg = arg_shifter.get_the_parameter
+ (ACE_TEXT("-ORBDefaultInitRef"))))
+ {
+ // Set the list of prefixes from -ORBDefaultInitRef.
+ this->orb_params ()->default_init_ref
+ (ACE_TEXT_ALWAYS_CHAR(current_arg));
+
+ arg_shifter.consume_arg ();
+ }
+ else if (0 != (current_arg = arg_shifter.get_the_parameter
+ (ACE_TEXT("-ORBStdProfileComponents"))))
+ {
+ std_profile_components =
+ ACE_OS::atoi (current_arg);
+ arg_shifter.consume_arg ();
+ }
+ else if (0 != (current_arg = arg_shifter.get_the_parameter
+ (ACE_TEXT("-ORBResources"))))
+ {
+ ACE_DEBUG ((LM_WARNING,
+ ACE_TEXT ("\"-ORBResources\" has been ")
+ ACE_TEXT ("deprecated.\n")));
+
+ arg_shifter.consume_arg ();
+ }
+ else if (0 != (current_arg = arg_shifter.get_the_parameter
+ (ACE_TEXT("-ORBLogFile"))))
+ {
+ // redirect all ACE_DEBUG and ACE_ERROR output to a file
+ // USAGE: -ORBLogFile <file>
+ // default: if <file> is present = append
+ // if <file> is not present = create
+
+ const ACE_TCHAR *file_name = current_arg;
+ arg_shifter.consume_arg ();
+
+ // would rather use ACE_OSTREAM_TYPE out here..
+ // but need ACE_FSTREAM_TYPE to call ->open(...)
+ // and haven't found such a macro to rep FILE* and/or fstream*
+
+#if defined (ACE_LACKS_IOSTREAM_TOTALLY)
+
+ FILE* output_stream = ACE_OS::fopen (file_name, ACE_TEXT ("a"));
+
+ ACE_LOG_MSG->msg_ostream (output_stream, 1);
+
+#else /* ! ACE_LACKS_IOSTREAM_TOTALLY */
+
+ ofstream* output_stream = 0;
+
+ //
+ // note: we are allocating dynamic memory here....but
+ // I assume it will persist for the life of the program
+ //
+
+ ACE_NEW_THROW_EX (output_stream,
+ ofstream (),
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ TAO_ORB_CORE_INIT_LOCATION_CODE,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (-1);
+
+ output_stream->open (ACE_TEXT_ALWAYS_CHAR (file_name),
+ ios::out | ios::app);
+
+ if (!output_stream->bad ())
+ {
+ ACE_LOG_MSG->msg_ostream (output_stream, 1);
+ }
+
+#endif /* ACE_LACKS_IOSTREAM_TOTALLY */
+
+ ACE_LOG_MSG->clr_flags (ACE_Log_Msg::STDERR | ACE_Log_Msg::LOGGER);
+ ACE_LOG_MSG->set_flags (ACE_Log_Msg::OSTREAM);
+
+ }
+ else if (0 != (current_arg = arg_shifter.get_the_parameter
+ (ACE_TEXT("-ORBVerboseLogging"))))
+ {
+ unsigned long verbose_logging = ACE_OS::atoi (current_arg);
+
+ arg_shifter.consume_arg ();
+
+ typedef void (ACE_Log_Msg::*PTMF)(u_long);
+ PTMF flagop = &ACE_Log_Msg::set_flags;
+ u_long value;
+
+ switch (verbose_logging)
+ {
+ case 0:
+ flagop = &ACE_Log_Msg::clr_flags;
+ value = ACE_Log_Msg::VERBOSE | ACE_Log_Msg::VERBOSE_LITE;
+ break;
+ case 1:
+ value = ACE_Log_Msg::VERBOSE_LITE; break;
+ default:
+ value = ACE_Log_Msg::VERBOSE; break;
+ }
+
+ (ACE_LOG_MSG->*flagop)(value);
+ }
+ else if (0 != (current_arg = arg_shifter.get_the_parameter
+ (ACE_TEXT("-ORBUseIMR"))))
+ {
+ // Use IR or not.
+ this->use_implrepo_ = ACE_OS::atoi (current_arg);
+
+ arg_shifter.consume_arg ();
+ }
+ else if (0 != (current_arg = arg_shifter.get_the_parameter
+ (ACE_TEXT("-ORBIMREndpointsInIOR"))))
+ {
+ this->imr_endpoints_in_ior_ = ACE_OS::atoi (current_arg);
+
+ arg_shifter.consume_arg ();
+ }
+ else if (0 != (current_arg = arg_shifter.get_the_parameter
+ (ACE_TEXT("-ORBid"))))
+ {
+ // The ORBid is actually set in ORB_init(), and then passed
+ // to the TAO_ORB_Core() constructor. However, in the case
+ // where the ORBid third argument to ORB_init() is not zero,
+ // any "-ORBid" arguments in the argv argument list are
+ // supposed to be ignored, according to the CORBA spec. As
+ // such, "-ORBid" must be removed from the argument list
+ // since ORB_init() must remove all "-ORB" option
+ // arguments.
+
+ // We obtain a lock on the ORB table when setting the
+ // ORBid. For this reason we should *not* set the ORBid
+ // here. CORBA::ORB_init() does all of the proper locking
+ // and setting.
+
+ arg_shifter.consume_arg ();
+ }
+ else if (0 != (current_arg = arg_shifter.get_the_parameter
+ (ACE_TEXT("-ORBServerId"))))
+ {
+ // The this->server_id_ is to uniquely identify a server to
+ // an IMR.
+ // Fill in later.
+ this->server_id_.set(ACE_TEXT_ALWAYS_CHAR(current_arg));
+
+ arg_shifter.consume_arg ();
+ }
+ else if (0 != (current_arg = arg_shifter.get_the_parameter
+ (ACE_TEXT("-ORBLingerTimeout"))))
+ {
+ linger = ACE_OS::atoi (current_arg);
+
+ arg_shifter.consume_arg ();
+ }
+ else if (0 != (current_arg = arg_shifter.get_the_parameter
+ (ACE_TEXT("-ORBEndpoint"))))
+ {
+ // Each "endpoint" is of the form:
+ //
+ // protocol://V.v@addr1,addr2,...,addrN
+ //
+ // or:
+ //
+ // protocol://addr1,addr2,...,addrN
+ //
+ // where "V.v" is an optional protocol version for each
+ // addr. All endpoint strings should be of the above
+ // form(s).
+ //
+ // Multiple sets of endpoint may be seperated by a semi-colon `;'.
+ // For example:
+ //
+ // corbaloc:space:2001,1.2@odyssey:2010;uiop://foo,bar
+ //
+ // All endpoint strings should be of the above form(s).
+
+ this->set_endpoint_helper (TAO_DEFAULT_LANE,
+ ACE_TEXT_ALWAYS_CHAR (current_arg)
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ arg_shifter.consume_arg ();
+ }
+ else if (0 != (current_arg = arg_shifter.get_the_parameter
+ (ACE_TEXT("-ORBListenEndpoints"))))
+ {
+ // This option is similar to the -ORBEndPoint option. May be
+ // ORBEndpoint option will be deprecated in future. But, for
+ // now, I (Priyanka) am leaving so that both options can be
+ // used.
+
+ this->set_endpoint_helper (TAO_DEFAULT_LANE,
+ ACE_TEXT_ALWAYS_CHAR (current_arg)
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ arg_shifter.consume_arg ();
+ }
+ else if ((0 != (current_arg = arg_shifter.get_the_parameter
+ (ACE_TEXT("-ORBLaneEndpoint")))) ||
+ (0 != (current_arg = arg_shifter.get_the_parameter
+ (ACE_TEXT("-ORBLaneListenEndpoints")))))
+ {
+ // This option is similar to the -ORBEndPoint option but
+ // specifies endpoints for each lane.
+
+ if (arg_shifter.is_option_next ())
+ return -1;
+
+ ACE_CString lane (ACE_TEXT_ALWAYS_CHAR (current_arg));
+ arg_shifter.consume_arg ();
+
+ if (arg_shifter.is_option_next ())
+ return -1;
+
+ ACE_CString endpoints (ACE_TEXT_ALWAYS_CHAR
+ (arg_shifter.get_current ()));
+ arg_shifter.consume_arg ();
+
+ this->set_endpoint_helper (lane,
+ endpoints
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+ }
+ else if (0 != (current_arg = arg_shifter.get_the_parameter
+ (ACE_TEXT("-ORBNoProprietaryActivation"))))
+ {
+ // This option can be used to set to not use any proprietary
+ // activation framework. The only TAO proprietary activation
+ // framework is IMR. So, by setting this option in TAO, the
+ // IMR shouldnt be used .. even if the ORBUseIMR option is
+ // set.
+ // Fill in later
+ // @@ To do later: Priyanka.
+
+ ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), -1);
+ }
+ else if (0 != (current_arg = arg_shifter.get_the_parameter
+ (ACE_TEXT("-ORBUseSharedProfile"))))
+ {
+ this->orb_params ()->shared_profile
+ (ACE_OS::atoi (current_arg));
+
+ arg_shifter.consume_arg ();
+ }
+ else if (0 != (current_arg = arg_shifter.get_the_parameter
+ (ACE_TEXT("-ORBNegotiateCodesets"))))
+ {
+ negotiate_codesets =
+ (ACE_OS::atoi (current_arg));
+
+ arg_shifter.consume_arg ();
+ }
+ else if ((current_arg = arg_shifter.get_the_parameter
+ (ACE_LIB_TEXT("-ORBUseParallelConnects"))))
+ {
+ use_parallel_connects = ACE_OS::atoi (current_arg);
+ arg_shifter.consume_arg ();
+ }
+ else if ((current_arg = arg_shifter.get_the_parameter
+ (ACE_LIB_TEXT("-ORBParallelConnectDelay"))))
+ {
+ this->orb_params ()->parallel_connect_delay
+ (ACE_OS::atoi (current_arg));
+ arg_shifter.consume_arg ();
+ }
+ else if (0 != (current_arg = arg_shifter.get_the_parameter
+ (ACE_TEXT("-ORBSingleReadOptimization"))))
+ {
+ this->orb_params ()->single_read_optimization
+ (ACE_OS::atoi (current_arg));
+
+ arg_shifter.consume_arg ();
+ }
+ else if (0 != (current_arg = arg_shifter.get_the_parameter
+ (ACE_TEXT("-ORBDisableRTCollocation"))))
+ {
+ int disable_rt_collocation = ACE_OS::atoi (current_arg);
+ if (disable_rt_collocation)
+ this->orb_params ()->disable_rt_collocation_resolver (true);
+ else
+ this->orb_params ()->disable_rt_collocation_resolver (false);
+
+ arg_shifter.consume_arg ();
+ }
+ else if (0 != (current_arg = arg_shifter.get_the_parameter
+ (ACE_LIB_TEXT("-ORBUseLocalMemoryPool"))))
+ {
+ this->use_local_memory_pool_ = (0 != ACE_OS::atoi (current_arg));
+
+ arg_shifter.consume_arg ();
+ }
+ else if (0 != (current_arg = arg_shifter.get_the_parameter
+ (ACE_LIB_TEXT("-ORBMaxMessageSize"))))
+ {
+ this->orb_params_.max_message_size (ACE_OS::atoi (current_arg));
+
+ arg_shifter.consume_arg ();
+ }
+
+ ////////////////////////////////////////////////////////////////
+ // catch any unknown -ORB args //
+ ////////////////////////////////////////////////////////////////
+ else if (arg_shifter.cur_arg_strncasecmp (ACE_TEXT("-ORB")) != -1)
+ {
+ if (TAO_debug_level > 0)
+ {
+ current_arg = arg_shifter.get_current ();
+ ACE_DEBUG ((LM_ERROR,
+ ACE_TEXT ("ERROR: Unknown \"-ORB\" option ")
+ ACE_TEXT ("<%s>.\n"),
+ ((current_arg == 0) ? ACE_TEXT("<NULL>")
+ : current_arg)));
+ }
+
+ ACE_THROW_RETURN (CORBA::BAD_PARAM (
+ CORBA::SystemException::_tao_minor_code (
+ TAO_ORB_CORE_INIT_LOCATION_CODE,
+ EINVAL),
+ CORBA::COMPLETED_NO),
+ -1);
+ }
+
+ ////////////////////////////////////////////////////////////////
+ // ok, we can't interpret this argument, move to next argument//
+ ////////////////////////////////////////////////////////////////
+ else
+ // Any arguments that don't match are ignored so that the
+ // caller can still use them.
+ arg_shifter.ignore_arg ();
+ }
+
+ const char *env_endpoint =
+ ACE_OS::getenv ("TAO_ORBENDPOINT");
+
+ if (env_endpoint != 0)
+ {
+ int result =
+ this->orb_params ()->add_endpoints (TAO_DEFAULT_LANE,
+ env_endpoint);
+
+ if (result != 0)
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("ERROR: Environment variable ")
+ ACE_TEXT ("TAO_ORBENDPOINT set to invalid value ")
+ ACE_TEXT ("<%s>.\n"),
+ env_endpoint));
+ }
+
+ ACE_THROW_RETURN (CORBA::BAD_PARAM (
+ CORBA::SystemException::_tao_minor_code (
+ TAO_ORB_CORE_INIT_LOCATION_CODE,
+ EINVAL),
+ CORBA::COMPLETED_NO),
+ -1);
+ }
+ }
+
+#if defined (SIGPIPE) && !defined (ACE_LACKS_UNIX_SIGNALS)
+ // There's really no way to deal with this in a portable manner, so
+ // we just have to suck it up and get preprocessor conditional and
+ // ugly.
+ //
+ // Impractical to have each call to the ORB protect against the
+ // implementation artifact of potential writes to dead connections,
+ // as it'd be way expensive. Do it here; who cares about SIGPIPE in
+ // these kinds of applications, anyway?
+ (void) ACE_OS::signal (SIGPIPE, (ACE_SignalHandler) SIG_IGN);
+#endif /* SIGPIPE */
+
+
+ // Calling the open method here so that the svc.conf file is
+ // opened and TAO_default_resource_factory::init () is called by the
+ // time this method is called.
+ this->parser_registry_.open (this);
+
+ // Initialize the pointers to resources in the ORB Core instance,
+ // e.g., reactor, connector, etc. Must do this after we open
+ // services because we'll load the factory from there.
+ TAO_Resource_Factory *trf = this->resource_factory ();
+
+ if (trf == 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) %p\n"),
+ ACE_TEXT ("ORB Core unable to find a ")
+ ACE_TEXT ("Resource Factory instance")));
+ ACE_THROW_RETURN (CORBA::INTERNAL (
+ CORBA::SystemException::_tao_minor_code (
+ TAO_ORB_CORE_INIT_LOCATION_CODE,
+ 0),
+ CORBA::COMPLETED_NO),
+ -1);
+ }
+
+ // Set whether or not to use the local memory pool for the cdr allocators.
+
+ trf->use_local_memory_pool (this->use_local_memory_pool_);
+
+ // @@ ????
+ // Make sure the reactor is initialized...
+ ACE_Reactor *reactor = this->reactor ();
+ if (reactor == 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) %p\n"),
+ ACE_TEXT ("ORB Core unable to initialize reactor")));
+ ACE_THROW_RETURN (CORBA::INITIALIZE (
+ CORBA::SystemException::_tao_minor_code (
+ TAO_ORB_CORE_INIT_LOCATION_CODE,
+ 0),
+ CORBA::COMPLETED_NO),
+ -1);
+ }
+
+ TAO_Server_Strategy_Factory *ssf = this->server_factory ();
+
+ if (ssf == 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) %p\n"),
+ ACE_TEXT ("ORB Core unable to find a ")
+ ACE_TEXT ("Server Strategy Factory instance")));
+ ACE_THROW_RETURN (CORBA::INTERNAL (
+ CORBA::SystemException::_tao_minor_code (
+ TAO_ORB_CORE_INIT_LOCATION_CODE,
+ 0),
+ CORBA::COMPLETED_NO),
+ -1);
+ }
+
+ ssf->open (this);
+
+ // Open the ObjectKey_Table
+ (void) this->object_key_table_.init (this);
+
+ // Obtain the timeout value for the thread-per-connection model
+ this->thread_per_connection_use_timeout_ =
+ ssf->thread_per_connection_timeout (this->thread_per_connection_timeout_);
+
+ if (thread_per_connection_use_timeout_ == -1)
+ {
+ if (ACE_OS::strcasecmp (TAO_DEFAULT_THREAD_PER_CONNECTION_TIMEOUT,
+ "INFINITE") == 0)
+ {
+ this->thread_per_connection_use_timeout_ = 0;
+ }
+ else
+ {
+ this->thread_per_connection_use_timeout_ = 1;
+ int milliseconds =
+ ACE_OS::atoi (TAO_DEFAULT_THREAD_PER_CONNECTION_TIMEOUT);
+ // Use a temporary to obtain automatic normalization.
+ this->thread_per_connection_timeout_ =
+ ACE_Time_Value (0, 1000 * milliseconds);
+ }
+ }
+ if (this->thread_per_connection_use_timeout_ == 0)
+ {
+ // Do not wait for the server threads because they may block
+ // forever.
+ this->tm_.wait_on_exit (0);
+ }
+
+ // Initialize the "ORB" pseudo-object now.
+ this->orb_ = CORBA::ORB::_tao_make_ORB (this);
+
+ // This should probably move into the ORB Core someday rather then
+ // being done at this level.
+ this->orb_->_use_omg_ior_format (use_ior);
+
+ // Set all kinds of orb parameters whose setting needed to be
+ // deferred until after the service config entries had been
+ // determined.
+
+ this->orb_params ()->service_port (TAO::MCAST_NAMESERVICE, ns_port);
+
+ if (ns_port != 0)
+ {
+ static char const mcast_fmt[] = "mcast://:%d::";
+ static size_t const PORT_BUF_SIZE = 256;
+
+ char def_init_ref[PORT_BUF_SIZE] = { 0 }; // snprintf() doesn't
+ // null terminate.
+ // Make sure we do.
+
+ ACE_OS::snprintf (def_init_ref,
+ PORT_BUF_SIZE - 1, // Account for null
+ // terminator.
+ mcast_fmt,
+ ns_port);
+
+ this->orb_params ()->default_init_ref (def_init_ref);
+ }
+
+ this->orb_params ()->service_port (TAO::MCAST_TRADINGSERVICE, ts_port);
+ this->orb_params ()->service_port (TAO::MCAST_IMPLREPOSERVICE, ir_port);
+
+ this->orb_params ()->use_dotted_decimal_addresses (dotted_decimal_addresses);
+ // When caching incoming transports don't use the host name if
+ // -ORBDottedDecimalAddresses or -ORBNoServerSideNameLookups is true.
+ this->orb_params ()->cache_incoming_by_dotted_decimal_address
+ (no_server_side_name_lookups
+ || dotted_decimal_addresses);
+
+ this->orb_params ()->use_parallel_connects
+ (use_parallel_connects != 0);
+
+ this->orb_params ()->linger (linger);
+ this->orb_params ()->nodelay (nodelay);
+ this->orb_params ()->sock_keepalive (so_keepalive);
+ this->orb_params ()->sock_dontroute (so_dontroute);
+ if (rcv_sock_size >= 0)
+ this->orb_params ()->sock_rcvbuf_size (rcv_sock_size);
+ if (snd_sock_size >= 0)
+ this->orb_params ()->sock_sndbuf_size (snd_sock_size);
+ if (cdr_tradeoff >= 0)
+ this->orb_params ()->cdr_memcpy_tradeoff (cdr_tradeoff);
+
+ this->orb_params ()->std_profile_components (std_profile_components);
+
+ this->orb_params ()->negotiate_codesets (negotiate_codesets);
+
+ if (this->codeset_manager())
+ this->codeset_manager_->open();
+ else
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT("TAO (%P|%t) ORB_Core: ")
+ ACE_TEXT("Codeset Manager not available\n")));
+
+ // Set up the pluggable protocol infrastructure. First get a
+ // pointer to the protocol factories set, then obtain pointers to
+ // all factories loaded by the service configurator.
+ // Load all protocol factories!
+ if (trf->init_protocol_factories () == -1)
+ ACE_THROW_RETURN (CORBA::INITIALIZE (
+ CORBA::SystemException::_tao_minor_code (
+ TAO_ORB_CORE_INIT_LOCATION_CODE,
+ 0),
+ CORBA::COMPLETED_NO),
+ -1);
+
+ // init the ORB core's pointer
+ this->protocol_factories_ = trf->get_protocol_factories ();
+
+ // Initialize the flushing strategy
+ this->flushing_strategy_ = trf->create_flushing_strategy ();
+
+ // Look in the service repository for an instance of the Protocol Hooks.
+ const ACE_CString &protocols_hooks_name =
+ TAO_ORB_Core_Static_Resources::instance ()->protocols_hooks_name_;
+
+ this->protocols_hooks_ =
+ ACE_Dynamic_Service<TAO_Protocols_Hooks>::instance
+ (this->configuration (),
+ ACE_TEXT_CHAR_TO_TCHAR (protocols_hooks_name.c_str()));
+
+ // Must have valid protocol hooks.
+ if (this->protocols_hooks_ == 0)
+ ACE_THROW_RETURN (CORBA::INITIALIZE (
+ CORBA::SystemException::_tao_minor_code (
+ TAO_ORB_CORE_INIT_LOCATION_CODE,
+ 0),
+ CORBA::COMPLETED_NO),
+ -1);
+
+ // Initialize the protocols hooks instance.
+ this->protocols_hooks_->init_hooks (this
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ // As a last step perform initializations of the service callbacks
+ this->services_callbacks_init ();
+
+ // The ORB has been initialized, meaning that the ORB is no longer
+ // in the shutdown state.
+ this->has_shutdown_ = 0;
+
+ return 0;
+}
+
+
+int
+TAO_ORB_Core::fini (void)
+{
+ ACE_TRY_NEW_ENV
+ {
+ // Shutdown the ORB and block until the shutdown is complete.
+ this->shutdown (1
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ ACE_CString message =
+ "Exception caught in trying to shutdown ";
+ message += this->orbid_;
+ message += "\n";
+
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ message.c_str ());
+ }
+ ACE_ENDTRY;
+
+ // Wait for any server threads, ignoring any failures.
+ (void) this->thr_mgr ()->wait ();
+
+ ::CORBA::release (this->implrepo_service_);
+
+ ::CORBA::release (this->typecode_factory_);
+
+ ::CORBA::release (this->codec_factory_);
+
+ ::CORBA::release (this->dynany_factory_);
+
+ ::CORBA::release (this->ior_manip_factory_);
+
+ ::CORBA::release (this->ior_table_);
+
+ if (TAO_debug_level > 2)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("Destroying ORB <%s>\n"),
+ ACE_TEXT_CHAR_TO_TCHAR (this->orbid_)));
+ }
+
+ // Finalize lane resources.
+ //
+ // @@ Do not call this->thread_lane_resources_manager().finalize().
+ // this->thread_lane_manager_resources() can seg fault if the
+ // factory method it invokes returns a zero pointer, which can
+ // easily occur if the ORB is partially initialized due to a Service
+ // Configurator initialization failure. Instead check if the
+ // cached pointer is non-zero and then finalize.
+ //
+ // @todo Fix potential seg fault in
+ // TAO_ORB_Core::thread_lane_resources_manager().
+ if (this->thread_lane_resources_manager_ != 0)
+ this->thread_lane_resources_manager_->finalize ();
+
+ (void) TAO::ORB::close_services (this->configuration ());
+
+ // Destroy the object_key table
+ this->object_key_table_.destroy ();
+
+ delete this;
+
+ return 0;
+}
+
+void
+TAO_ORB_Core::set_thread_lane_resources_manager_factory (const char *thread_lane_resources_manager_factory_name)
+{
+ TAO_ORB_Core_Static_Resources::instance ()->thread_lane_resources_manager_factory_name_ =
+ thread_lane_resources_manager_factory_name;
+}
+
+void
+TAO_ORB_Core::set_collocation_resolver (const char *collocation_resolver_name)
+{
+ TAO_ORB_Core_Static_Resources::instance ()->collocation_resolver_name_ =
+ collocation_resolver_name;
+}
+
+void
+TAO_ORB_Core::set_stub_factory (const char *stub_factory_name)
+{
+ TAO_ORB_Core_Static_Resources::instance ()->stub_factory_name_ =
+ stub_factory_name;
+}
+
+void
+TAO_ORB_Core::set_resource_factory (const char *resource_factory_name)
+{
+ TAO_ORB_Core_Static_Resources::instance ()->resource_factory_name_ =
+ resource_factory_name;
+}
+
+void
+TAO_ORB_Core::set_gui_resource_factory (TAO::GUIResource_Factory *gui_resource_factory)
+{
+ if (TAO_TSS_Resources::instance ()->gui_resource_factory_ != 0)
+ {
+
+ ACE_DEBUG ((LM_WARNING,
+ "TAO (%P|%t) - Deleting old gui_resource_factory.\n"));
+ delete TAO_TSS_Resources::instance ()->gui_resource_factory_;
+ }
+
+ TAO_TSS_Resources::instance ()->gui_resource_factory_ = gui_resource_factory;
+}
+
+void
+TAO_ORB_Core::dynamic_adapter_name (const char *name)
+{
+ TAO_ORB_Core_Static_Resources::instance ()->dynamic_adapter_name_ = name;
+}
+
+const char *
+TAO_ORB_Core::dynamic_adapter_name (void)
+{
+ return TAO_ORB_Core_Static_Resources::instance ()->dynamic_adapter_name_.c_str();
+}
+
+void
+TAO_ORB_Core::ifr_client_adapter_name (const char *name)
+{
+ TAO_ORB_Core_Static_Resources::instance ()->ifr_client_adapter_name_ = name;
+}
+
+const char *
+TAO_ORB_Core::ifr_client_adapter_name (void)
+{
+ return TAO_ORB_Core_Static_Resources::instance ()->ifr_client_adapter_name_.c_str();
+}
+
+void
+TAO_ORB_Core::typecodefactory_adapter_name (const char *name)
+{
+ TAO_ORB_Core_Static_Resources::instance ()->typecodefactory_adapter_name_ = name;
+}
+
+const char *
+TAO_ORB_Core::typecodefactory_adapter_name (void)
+{
+ return TAO_ORB_Core_Static_Resources::instance ()->typecodefactory_adapter_name_.c_str();
+}
+
+void
+TAO_ORB_Core::iorinterceptor_adapter_factory_name (const char *name)
+{
+ TAO_ORB_Core_Static_Resources::instance ()->iorinterceptor_adapter_factory_name_ = name;
+}
+
+const char *
+TAO_ORB_Core::iorinterceptor_adapter_factory_name (void)
+{
+ return TAO_ORB_Core_Static_Resources::instance ()->iorinterceptor_adapter_factory_name_.c_str();
+}
+
+void
+TAO_ORB_Core::valuetype_adapter_factory_name (const char *name)
+{
+ TAO_ORB_Core_Static_Resources::instance ()->valuetype_adapter_factory_name_ = name;
+}
+
+const char *
+TAO_ORB_Core::valuetype_adapter_factory_name (void)
+{
+ return TAO_ORB_Core_Static_Resources::instance ()->valuetype_adapter_factory_name_.c_str();
+}
+
+TAO_Resource_Factory *
+TAO_ORB_Core::resource_factory (void)
+{
+ // Check if there is a cached reference.
+ if (this->resource_factory_ != 0)
+ {
+ return this->resource_factory_;
+ }
+
+ // Look in the service repository for an instance.
+ ACE_CString &resource_factory_name =
+ TAO_ORB_Core_Static_Resources::instance ()->resource_factory_name_;
+
+ this->resource_factory_ =
+ ACE_Dynamic_Service<TAO_Resource_Factory>::instance
+ (this->configuration (),
+ ACE_TEXT_CHAR_TO_TCHAR (resource_factory_name.c_str()));
+
+ return this->resource_factory_;
+}
+
+TAO::GUIResource_Factory *
+TAO_ORB_Core::gui_resource_factory (void)
+{
+ return TAO_TSS_Resources::instance ()->gui_resource_factory_;
+}
+
+
+TAO_Thread_Lane_Resources_Manager &
+TAO_ORB_Core::thread_lane_resources_manager (void)
+{
+ // Check if there is a cached reference.
+ if (this->thread_lane_resources_manager_ != 0)
+ return *this->thread_lane_resources_manager_;
+
+ // If not, lookup the corresponding factory and ask it to make one.
+ const ACE_CString &thread_lane_resources_manager_factory_name =
+ TAO_ORB_Core_Static_Resources::instance ()->thread_lane_resources_manager_factory_name_;
+
+ TAO_Thread_Lane_Resources_Manager_Factory *factory =
+ ACE_Dynamic_Service<TAO_Thread_Lane_Resources_Manager_Factory>::instance
+ (this->configuration (),
+ ACE_TEXT_CHAR_TO_TCHAR (thread_lane_resources_manager_factory_name.c_str()));
+
+ this->thread_lane_resources_manager_ =
+ factory->create_thread_lane_resources_manager (*this);
+
+ return *this->thread_lane_resources_manager_;
+}
+
+TAO_Collocation_Resolver &
+TAO_ORB_Core::collocation_resolver (void)
+{
+ // Check if there is a cached reference.
+ if (this->collocation_resolver_ != 0)
+ return *this->collocation_resolver_;
+
+ // If not, lookup it up.
+ const ACE_CString &collocation_resolver_name =
+ TAO_ORB_Core_Static_Resources::instance ()->collocation_resolver_name_;
+
+ this->collocation_resolver_ =
+ ACE_Dynamic_Service<TAO_Collocation_Resolver>::instance
+ (this->configuration (),
+ ACE_TEXT_CHAR_TO_TCHAR (collocation_resolver_name.c_str()));
+
+ return *this->collocation_resolver_;
+}
+
+TAO::PolicyFactory_Registry_Adapter *
+TAO_ORB_Core::policy_factory_registry_i (void)
+{
+
+ TAO_PolicyFactory_Registry_Factory *loader =
+ ACE_Dynamic_Service<TAO_PolicyFactory_Registry_Factory>::instance
+ (this->configuration (),
+ ACE_TEXT ("PolicyFactory_Loader"));
+
+ if (loader == 0)
+ {
+ this->configuration ()->process_directive (
+ ACE_DYNAMIC_SERVICE_DIRECTIVE("PolicyFactory_Loader",
+ "TAO_PI",
+ "_make_TAO_PolicyFactory_Loader",
+ ""));
+ loader =
+ ACE_Dynamic_Service<TAO_PolicyFactory_Registry_Factory>::instance
+ (this->configuration (),
+ ACE_TEXT ("PolicyFactory_Loader"));
+ }
+
+ if (loader != 0)
+ {
+ this->policy_factory_registry_ =
+ loader->create ();
+ }
+
+ return this->policy_factory_registry_;
+}
+
+TAO::ORBInitializer_Registry_Adapter *
+TAO_ORB_Core::orbinitializer_registry_i (void)
+{
+ // If not, lookup it up.
+ this->orbinitializer_registry_ =
+ ACE_Dynamic_Service<TAO::ORBInitializer_Registry_Adapter>::instance
+ (this->configuration (),
+ ACE_TEXT ("ORBInitializer_Registry"));
+
+#if !defined (TAO_AS_STATIC_LIBS)
+ // In case we build shared, try to load the PI Client library, in a
+ // static build we just can't do this, so don't try it, lower layers
+ // output an error then.
+ if (orbinitializer_registry_ == 0)
+ {
+ this->configuration ()->process_directive (
+ ACE_DYNAMIC_SERVICE_DIRECTIVE("ORBInitializer_Registry",
+ "TAO_PI",
+ "_make_ORBInitializer_Registry",
+ ""));
+ orbinitializer_registry_ =
+ ACE_Dynamic_Service<TAO::ORBInitializer_Registry_Adapter>::instance
+ (this->configuration (),
+ ACE_TEXT ("ORBInitializer_Registry"));
+ }
+#endif /* !TAO_AS_STATIC_LIBS */
+
+ return this->orbinitializer_registry_;
+}
+
+TAO_Stub_Factory *
+TAO_ORB_Core::stub_factory (void)
+{
+ // Check if there is a cached reference.
+ if (this->stub_factory_ != 0)
+ return this->stub_factory_;
+
+ // If not, look in the service repository for an instance.
+ const ACE_CString &stub_factory_name =
+ TAO_ORB_Core_Static_Resources::instance ()->stub_factory_name_;
+
+ this->stub_factory_ =
+ ACE_Dynamic_Service<TAO_Stub_Factory>::instance
+ (this->configuration (),
+ ACE_TEXT_CHAR_TO_TCHAR (stub_factory_name.c_str()));
+
+ return this->stub_factory_;
+}
+
+void
+TAO_ORB_Core::set_poa_factory (const char *poa_factory_name,
+ const char *poa_factory_directive)
+{
+ TAO_ORB_Core_Static_Resources::instance ()->poa_factory_name_ =
+ poa_factory_name;
+ TAO_ORB_Core_Static_Resources::instance ()->poa_factory_directive_ =
+ poa_factory_directive;
+}
+
+const ACE_CString &
+TAO_ORB_Core::poa_factory_name (void)
+{
+ return TAO_ORB_Core_Static_Resources::instance ()->poa_factory_name_;
+}
+
+void
+TAO_ORB_Core::set_endpoint_selector_factory (const char *endpoint_selector_factory_name)
+{
+ TAO_ORB_Core_Static_Resources::instance ()->endpoint_selector_factory_name_ =
+ endpoint_selector_factory_name;
+}
+
+TAO_Endpoint_Selector_Factory *
+TAO_ORB_Core::endpoint_selector_factory (void)
+{
+ // Check if there is a cached reference.
+ if (this->endpoint_selector_factory_ != 0)
+ return this->endpoint_selector_factory_;
+
+ // If not, look in the service repository for an instance.
+ const ACE_CString &endpoint_selector_factory_name =
+ TAO_ORB_Core_Static_Resources::instance ()->endpoint_selector_factory_name_;
+
+ this->endpoint_selector_factory_ =
+ ACE_Dynamic_Service<TAO_Endpoint_Selector_Factory>::instance
+ (this->configuration (),
+ ACE_TEXT_CHAR_TO_TCHAR (endpoint_selector_factory_name.c_str()));
+
+ return this->endpoint_selector_factory_;
+}
+
+void
+TAO_ORB_Core::set_protocols_hooks (const char *protocols_hooks_name)
+{
+ // Is synchronization necessary?
+ TAO_ORB_Core_Static_Resources::instance ()->protocols_hooks_name_ =
+ protocols_hooks_name;
+}
+
+void
+TAO_ORB_Core::services_callbacks_init (void)
+{
+ // We (should) know what are the services that would need
+ // callbacks. So, what we do is go through the Service Configurator
+ // list for looking at the services that we want to load.
+ this->ft_service_.init (this);
+
+ // @@ Other service callbacks can be added here
+}
+
+TAO::Invocation_Status
+TAO_ORB_Core::service_raise_comm_failure (
+ IOP::ServiceContextList &clist,
+ TAO_Profile *profile
+ ACE_ENV_ARG_DECL)
+{
+ if (this->ft_service_.service_callback ())
+ {
+ return this->ft_service_.service_callback ()->
+ raise_comm_failure (clist,
+ profile
+ ACE_ENV_ARG_PARAMETER);
+ }
+
+ ACE_THROW_RETURN (CORBA::COMM_FAILURE (
+ CORBA::SystemException::_tao_minor_code (
+ TAO_INVOCATION_RECV_REQUEST_MINOR_CODE,
+ errno),
+ CORBA::COMPLETED_MAYBE),
+ TAO::TAO_INVOKE_SYSTEM_EXCEPTION);
+}
+
+
+TAO::Invocation_Status
+TAO_ORB_Core::service_raise_transient_failure (
+ IOP::ServiceContextList &clist,
+ TAO_Profile *profile
+ ACE_ENV_ARG_DECL)
+{
+ if (this->ft_service_.service_callback ())
+ {
+ return
+ this->ft_service_.service_callback ()->raise_transient_failure (clist,
+ profile
+ ACE_ENV_ARG_PARAMETER);
+ }
+
+ return TAO::TAO_INVOKE_FAILURE;
+}
+
+void
+TAO_ORB_Core::service_context_list (
+ TAO_Stub *stub,
+ TAO_Service_Context &service_context,
+ CORBA::Boolean restart
+ ACE_ENV_ARG_DECL)
+{
+ // @NOTE: Can use Interceptors instead..
+ this->protocols_hooks_->rt_service_context (stub,
+ service_context,
+ restart
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+TAO_Client_Strategy_Factory *
+TAO_ORB_Core::client_factory (void)
+{
+ if (this->client_factory_ == 0)
+ {
+ // Look in the service repository for an instance.
+ this->client_factory_ =
+ ACE_Dynamic_Service<TAO_Client_Strategy_Factory>::instance
+ (this->configuration (),
+ ACE_TEXT ("Client_Strategy_Factory"));
+ }
+
+ return this->client_factory_;
+}
+
+TAO_Server_Strategy_Factory *
+TAO_ORB_Core::server_factory (void)
+{
+ if (this->server_factory_ == 0)
+ {
+ // Look in the service repository for an instance.
+ this->server_factory_ =
+ ACE_Dynamic_Service<TAO_Server_Strategy_Factory>::instance
+ (this->configuration (),
+ ACE_TEXT ("Server_Strategy_Factory"));
+ }
+
+ return this->server_factory_;
+}
+
+CORBA::Object_ptr
+TAO_ORB_Core::root_poa (ACE_ENV_SINGLE_ARG_DECL)
+{
+ // DCL ..
+ if (CORBA::is_nil (this->root_poa_.in ()))
+ {
+
+ // Making sure the initialization process in the current thread uses
+ // the correct service repository (ours), instead of the global one.
+ ACE_Service_Config_Guard scg (this->configuration ());
+
+
+ TAO_ORB_Core_Static_Resources* static_resources =
+ TAO_ORB_Core_Static_Resources::instance ();
+
+ TAO_Adapter_Factory *factory =
+ ACE_Dynamic_Service<TAO_Adapter_Factory>::instance
+ (this->configuration (),
+ static_resources->poa_factory_name_.c_str());
+
+ if (factory == 0)
+ {
+ this->configuration()->process_directive (
+ ACE_TEXT_CHAR_TO_TCHAR (
+ static_resources->poa_factory_directive_.c_str()));
+
+ factory =
+ ACE_Dynamic_Service<TAO_Adapter_Factory>::instance
+ (this->configuration (),
+ static_resources->poa_factory_name_.c_str());
+ }
+
+ if (factory == 0)
+ {
+ return CORBA::Object::_nil ();
+ }
+
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
+ monitor,
+ this->open_lock_,
+ 0);
+
+ if (CORBA::is_nil (this->root_poa_.in ()))
+ {
+ // @@ Not exception safe
+ TAO_Adapter *poa_adapter =
+ factory->create (this);
+
+ poa_adapter->open (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Object::_nil ());
+
+ // @@ Not exception safe
+ this->root_poa_ =
+ poa_adapter->root ();
+
+ this->adapter_registry_.insert (poa_adapter
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Object::_nil ());
+ }
+ }
+
+ return CORBA::Object::_duplicate (this->root_poa_.in ());
+}
+
+TAO_Adapter *
+TAO_ORB_Core::poa_adapter (void)
+{
+ if (this->poa_adapter_ == 0)
+ {
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->lock_, 0);
+ if (this->poa_adapter_ == 0)
+ {
+ this->poa_adapter_ =
+ this->adapter_registry_.find_adapter ("RootPOA");
+ }
+ }
+ return this->poa_adapter_;
+}
+
+TAO_Stub *
+TAO_ORB_Core::create_stub (const char *repository_id,
+ const TAO_MProfile &profiles
+ ACE_ENV_ARG_DECL)
+{
+ TAO_Stub *retval =
+ this->stub_factory ()->create_stub (repository_id,
+ profiles,
+ this
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN(0);
+ return retval;
+}
+
+void
+TAO_ORB_Core::request_dispatcher (TAO_Request_Dispatcher *request_dispatcher)
+{
+ // Assume ownership of the request dispatcher.
+ TAO_Request_Dispatcher *tmp = this->request_dispatcher_;
+ this->request_dispatcher_ = request_dispatcher;
+ delete tmp;
+}
+
+TAO_Stub *
+TAO_ORB_Core::create_stub_object (TAO_MProfile &mprofile,
+ const char *type_id,
+ CORBA::PolicyList *policy_list
+ ACE_ENV_ARG_DECL)
+{
+ // Add the Polices contained in "policy_list" to each profile so
+ // that those policies will be exposed to the client in the IOR. In
+ // particular each CORBA::Policy has to be converted in to
+ // Messaging::PolicyValue, and then all the Messaging::PolicyValue
+ // should be embedded inside a Messaging::PolicyValueSeq which
+ // became in turns the "body" of the IOP::TaggedComponent. This
+ // conversion is a responsability of the CORBA::Profile class. (See
+ // orbos\98-05-05.pdf Section 5.4)
+ if (policy_list->length () != 0)
+ {
+ TAO_Profile * profile;
+
+ const CORBA::ULong count = mprofile.profile_count ();
+ for (CORBA::ULong i = 0; i < count; ++i)
+ {
+ // Get the ith profile
+ profile = mprofile.get_profile (i);
+ profile->policies (policy_list ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+ }
+ }
+
+ /// Initialize a TAO_Stub object with the mprofile thats passed.
+ TAO_Stub *stub =
+ this->create_stub (type_id, mprofile ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (stub);
+
+ stub->base_profiles ().policy_list (policy_list);
+
+ return stub;
+}
+
+void
+TAO_ORB_Core::load_policy_validators (TAO_Policy_Validator &validator
+ ACE_ENV_ARG_DECL)
+{
+ if (this->bidir_adapter_ == 0)
+ {
+ this->bidir_adapter_ =
+ ACE_Dynamic_Service<TAO_BiDir_Adapter>::instance
+ (this->configuration (), ACE_TEXT ("BiDirGIOP_Loader"));
+ }
+
+ // Call the BiDir library if it has been loaded
+ if (this->bidir_adapter_)
+ this->bidir_adapter_->load_policy_validators (validator ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::Object_ptr
+TAO_ORB_Core::create_object (TAO_Stub *stub)
+{
+ // @@ What about forwarding. With this approach we are never forwarded
+ // when we use collocation!
+ const TAO_MProfile &mprofile = stub->base_profiles ();
+
+ // @@ We should thow CORBA::NO_MEMORY in platforms with exceptions,
+ // but we are stuck in platforms without exceptions!
+ TAO_ORB_Core_Auto_Ptr collocated_orb_core;
+ CORBA::Object_ptr x = 0;
+
+ {
+ // Lock the ORB_Table against concurrent modification while we
+ // iterate through the ORBs.
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
+ guard,
+ TAO::ORB_Table::instance()->lock (),
+ CORBA::Object::_nil ());
+
+ TAO::ORB_Table * const table = TAO::ORB_Table::instance ();
+ TAO::ORB_Table::iterator const end = table->end ();
+ for (TAO::ORB_Table::iterator i = table->begin (); i != end; ++i)
+ {
+ ::TAO_ORB_Core * const other_core = (*i).second.core ();
+
+ if (this->is_collocation_enabled (other_core,
+ mprofile))
+ {
+ other_core->_incr_refcnt();
+ TAO_ORB_Core_Auto_Ptr tmp_auto_ptr (other_core);
+ collocated_orb_core = tmp_auto_ptr;
+ break;
+ }
+ }
+ }
+
+ if (collocated_orb_core.get ())
+ {
+ TAO_Adapter_Registry *ar =
+ collocated_orb_core.get ()->adapter_registry ();
+
+ x = ar->create_collocated_object (stub,
+ mprofile);
+ }
+
+
+ if (!x)
+ {
+ // The constructor sets the proxy broker as the
+ // Remote one.
+ ACE_NEW_RETURN (x,
+ CORBA::Object (stub, 0),
+ 0);
+ }
+
+ return x;
+}
+
+CORBA::Long
+TAO_ORB_Core::initialize_object (TAO_Stub *stub,
+ CORBA::Object_ptr)
+{
+ // @@ What about forwarding. With this approach we are never forwarded
+ // when we use collocation!
+ const TAO_MProfile &mprofile =
+ stub->base_profiles ();
+
+ return initialize_object_i (stub,
+ mprofile);
+}
+
+CORBA::Long
+TAO_ORB_Core::reinitialize_object (TAO_Stub *stub)
+{
+ return initialize_object_i (stub, stub->forward_profiles ()
+ ? *(stub->forward_profiles ())
+ : stub->base_profiles ());
+}
+
+CORBA::Long
+TAO_ORB_Core::initialize_object_i (TAO_Stub *stub,
+ const TAO_MProfile &mprofile)
+
+{
+ CORBA::Long retval = 0;
+ TAO_ORB_Core_Auto_Ptr collocated_orb_core;
+
+ {
+ // Lock the ORB_Table against concurrent modification while we
+ // iterate through the ORBs.
+ ACE_MT (ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
+ guard,
+ TAO::ORB_Table::instance()->lock (),
+ 0));
+
+ TAO::ORB_Table * const table = TAO::ORB_Table::instance ();
+ TAO::ORB_Table::iterator const end = table->end ();
+ for (TAO::ORB_Table::iterator i = table->begin (); i != end; ++i)
+ {
+ TAO_ORB_Core * const other_core = (*i).second.core ();
+
+ if (this->is_collocation_enabled (other_core,
+ mprofile))
+ {
+ other_core->_incr_refcnt ();
+ TAO_ORB_Core_Auto_Ptr tmp_auto_ptr (other_core);
+ collocated_orb_core = tmp_auto_ptr;
+ break;
+ }
+ }
+ }
+
+ if (collocated_orb_core.get ())
+ {
+ TAO_Adapter_Registry *ar =
+ collocated_orb_core.get ()->adapter_registry ();
+
+ retval = ar->initialize_collocated_object (stub);
+ }
+
+ return retval;
+}
+
+CORBA::Boolean
+TAO_ORB_Core::is_collocation_enabled (TAO_ORB_Core *orb_core,
+ const TAO_MProfile &mp)
+{
+ if (!orb_core->optimize_collocation_objects ())
+ return 0;
+
+ if (!orb_core->use_global_collocation () && orb_core != this)
+ return 0;
+
+ if (!orb_core->is_collocated (mp))
+ return 0;
+
+ return 1;
+}
+
+int
+TAO_ORB_Core::is_collocated (const TAO_MProfile& mprofile)
+{
+ // @@ Lots of issues arise when dealing with collocation. What about
+ // forwarding or what if this is a multi-profile IOR where the order is
+ // significant and only one of the profiles is collocated. For example
+ // when using a multiple servers for fault tolerance. For now, we just
+ // look through all profiles and if any are colocated then we assume
+ // the object is collocated.
+ // @@ Note, if collocated we can not be forwarded!
+ // Also, acceptor_registry_->is_collocated (...) will check the
+ // address (ORB Host) but not the object_key. This should be checked
+ // also.
+
+ return this->thread_lane_resources_manager ().is_collocated (mprofile);
+}
+
+// ****************************************************************
+
+TAO_Leader_Follower &
+TAO_ORB_Core::leader_follower (void)
+{
+ return this->lane_resources ().leader_follower ();
+}
+
+TAO_LF_Strategy &
+TAO_ORB_Core::lf_strategy (void)
+{
+ return this->thread_lane_resources_manager ().lf_strategy ();
+}
+
+int
+TAO_ORB_Core::run (ACE_Time_Value *tv,
+ int perform_work
+ ACE_ENV_ARG_DECL_NOT_USED)
+{
+ // ORB::run may be called from a thread, different from the one that
+ // did the ORB_init, consequently we must establish the Service
+ // Gestalt, this thread will consider "global"
+
+ ACE_Service_Config_Guard use_orbs (this->configuration());
+
+ if (TAO_debug_level > 2)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - ORB_Core::run, ")
+ ACE_TEXT ("start [%s]\n"),
+ perform_work?ACE_TEXT("perform_work"):ACE_TEXT("run")));
+ }
+
+ // Fetch the Reactor
+ ACE_Reactor *r = this->reactor ();
+
+ int result = 1;
+ // 1 to detect that nothing went wrong
+
+ // Loop handling client requests until the ORB is shutdown.
+
+ // We could use the leader-follower lock to check for the state
+ // if this variable or use the lock <create_event_loop_lock> in
+ // the server strategy factory.
+ // We don't need to do this because we use the Reactor
+ // mechanisms to shutdown in a thread-safe way.
+
+ while (this->has_shutdown () == 0)
+ {
+ // Every time we perform an interation we have to become the
+ // leader again, because it is possible that a client has
+ // acquired the leader role...
+ TAO_Leader_Follower &leader_follower =
+ this->leader_follower ();
+
+ TAO_LF_Strategy &lf_strategy =
+ this->lf_strategy ();
+
+ TAO_LF_Event_Loop_Thread_Helper helper (leader_follower,
+ lf_strategy,
+ tv);
+ result = helper.event_loop_return ();
+ if (result != 0)
+ {
+ if (errno == ETIME)
+ return 0;
+ else
+ return result;
+ }
+
+ // Set the owning thread of the Reactor to the one which we're
+ // currently in. This is necessary b/c it's possible that the
+ // application is calling us from a thread other than that in which
+ // the Reactor's CTOR (which sets the owner) was called.
+ //
+ // We need to do this on every iteration because the reactor may be
+ // acquired by one of the client threads in the LF waiting
+ // strategy
+ r->owner (ACE_Thread::self ());
+
+ if (TAO_debug_level > 2)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - ORB_Core::run, ")
+ ACE_TEXT ( "calling handle_events()\n")));
+ }
+
+ result = r->handle_events (tv);
+
+ if (TAO_debug_level > 2)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - ORB_Core::run, ")
+ ACE_TEXT ("handle_events() returns %d\n"),
+ result));
+ }
+
+ if (result == -1)
+ {
+ // An error, terminate the loop
+ break;
+ }
+ if (result == 0
+ && tv != 0
+ && *tv == ACE_Time_Value::zero)
+ {
+ // A timeout, terminate the loop...
+ break;
+ }
+
+ if (perform_work)
+ {
+ // This is running on behalf of a perform_work() call,
+ // The loop should run only once.
+ break;
+ }
+ // Otherwise just continue..
+ }
+
+ if (this->has_shutdown () == 1 &&
+ this->server_factory_->activate_server_connections ())
+ this->tm_.wait ();
+
+ if (TAO_debug_level > 2)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - ORB_Core::run, ")
+ ACE_TEXT ("ends with result = %d\n"),
+ result));
+ }
+
+ return result;
+}
+
+
+void
+TAO_ORB_Core::shutdown (CORBA::Boolean wait_for_completion
+ ACE_ENV_ARG_DECL)
+{
+ {
+ ACE_GUARD (TAO_SYNCH_MUTEX, monitor, this->lock_);
+
+ if (this->has_shutdown () != 0)
+ return;
+
+ // Check if we are on the right state, i.e. do not accept
+ // shutdowns with the 'wait_for_completion' flag set in the middle
+ // of an upcall (because those deadlock).
+ this->adapter_registry_.check_close (wait_for_completion
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Set the 'has_shutdown' flag, so any further attempt to shutdown
+ // becomes a noop.
+ this->has_shutdown_ = 1;
+
+ // need to release the mutex, because some of the shutdown
+ // operations invoke application code, that could (and in practice
+ // does!) callback into ORB Core code.
+ }
+
+ this->adapter_registry_.close (wait_for_completion
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Shutdown reactor.
+ this->thread_lane_resources_manager ().shutdown_reactor ();
+
+ // Cleanup transports that use the RW strategies
+ this->thread_lane_resources_manager ().cleanup_rw_transports ();
+
+ // Grab the thread manager
+ ACE_Thread_Manager *tm = this->thr_mgr ();
+
+ // Try to cancel all the threads in the ORB.
+ tm->cancel_all ();
+
+ // If <wait_for_completion> is set, wait for all threads to exit.
+ if (wait_for_completion != 0)
+ tm->wait ();
+
+ // Explicitly destroy the valuetype adapter
+ delete this->valuetype_adapter_;
+ this->valuetype_adapter_ = 0;
+
+ // Explicitly destroy the object reference table since it
+ // contains references to objects, which themselves may contain
+ // reference to this ORB.
+ this->object_ref_table_.destroy ();
+
+#if (TAO_HAS_INTERCEPTORS == 1)
+ CORBA::release (this->pi_current_);
+ this->pi_current_ = CORBA::Object::_nil ();
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+}
+
+void
+TAO_ORB_Core::destroy (ACE_ENV_SINGLE_ARG_DECL)
+{
+ //
+ // All destroy() should do is (a) call shutdown() and (b) unbind()
+ // from the ORB table. Nothing else should really be added to this
+ // method. Everything else should go to the shutdown() method.
+ // Remember when the ORB Core is finally removed from the ORB table,
+ // the reference count goes to zero and fini() is called. fini()
+ // calls shutdown() and does not call destroy() since destroy() will
+ // try to unbind from the ORB table again. Additional code should
+ // not be added to destroy() since there is no guarantee that
+ // orb->destroy() will ever be called by the user. Since TAO
+ // guarantees that shutdown() will be called, all cleanup code
+ // should go there.
+ //
+
+ // Shutdown the ORB and block until the shutdown is complete.
+ this->shutdown (1 ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Invoke Interceptor::destroy() on all registered interceptors.
+ this->destroy_interceptors (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Now remove it from the ORB table so that it's ORBid may be
+ // reused.
+ TAO::ORB_Table::instance ()->unbind (this->orbid_);
+}
+
+void
+TAO_ORB_Core::check_shutdown (ACE_ENV_SINGLE_ARG_DECL)
+{
+ if (this->has_shutdown ())
+ {
+ // As defined by the CORBA 2.3 specification, throw a
+ // CORBA::BAD_INV_ORDER exception with minor code 4 if the ORB
+ // has shutdown by the time an ORB function is called.
+
+ ACE_THROW (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 4,
+ CORBA::COMPLETED_NO));
+ }
+}
+
+void
+TAO_ORB_Core::destroy_interceptors (ACE_ENV_SINGLE_ARG_DECL)
+{
+ ACE_TRY
+ {
+ ACE_GUARD (TAO_SYNCH_MUTEX, monitor, this->lock_);
+
+#if TAO_HAS_INTERCEPTORS == 1
+ if (this->client_request_interceptor_adapter_ != 0)
+ {
+ this->client_request_interceptor_adapter_->destroy_interceptors (
+ ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ delete this->client_request_interceptor_adapter_;
+ this->client_request_interceptor_adapter_ = 0;
+ }
+
+ if (this->server_request_interceptor_adapter_ != 0)
+ {
+ this->server_request_interceptor_adapter_->destroy_interceptors (
+ ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ delete this->server_request_interceptor_adapter_;
+ this->server_request_interceptor_adapter_ = 0;
+ }
+
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+
+ if (this->ior_interceptor_adapter_ != 0)
+ {
+ this->ior_interceptor_adapter_->destroy_interceptors (
+ ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ this->ior_interceptor_adapter_ = 0;
+ }
+
+ }
+ ACE_CATCHALL
+ {
+ // .. catch all the exceptions..
+ if (TAO_debug_level > 3)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - Exception in TAO_ORB_Core")
+ ACE_TEXT ("::destroy_interceptors () \n")));
+ }
+ }
+ ACE_ENDTRY;
+
+ return;
+}
+
+TAO_Thread_Lane_Resources &
+TAO_ORB_Core::lane_resources (void)
+{
+ return this->thread_lane_resources_manager ().lane_resources ();
+}
+
+void
+TAO_ORB_Core::resolve_typecodefactory_i (ACE_ENV_SINGLE_ARG_DECL)
+{
+ TAO_Object_Loader *loader =
+ ACE_Dynamic_Service<TAO_Object_Loader>::instance
+ (this->configuration (),
+ ACE_TEXT ("TypeCodeFactory_Loader"));
+
+ if (loader == 0)
+ {
+ this->configuration ()->process_directive
+ (ACE_DYNAMIC_SERVICE_DIRECTIVE("TypeCodeFactory",
+ "TAO_TypeCodeFactory",
+ "_make_TAO_TypeCodeFactory_Loader",
+ ""));
+ loader =
+ ACE_Dynamic_Service<TAO_Object_Loader>::instance
+ (this->configuration (),
+ ACE_TEXT ("TypeCodeFactory_Loader"));
+
+ if (loader == 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) Unable to instantiate ")
+ ACE_TEXT ("a TypeCodeFactory_Loader\n")));
+ ACE_THROW (CORBA::ORB::InvalidName ());
+ }
+ }
+
+ this->typecode_factory_ =
+ loader->create_object (this->orb_, 0, 0 ACE_ENV_ARG_PARAMETER);
+}
+
+void
+TAO_ORB_Core::resolve_codecfactory_i (ACE_ENV_SINGLE_ARG_DECL)
+{
+ TAO_Object_Loader *loader =
+ ACE_Dynamic_Service<TAO_Object_Loader>::instance
+ (this->configuration (),
+ ACE_TEXT ("CodecFactory_Loader"));
+
+ if (loader == 0)
+ {
+ this->configuration()->process_directive
+ (ACE_DYNAMIC_SERVICE_DIRECTIVE("CodecFactory",
+ "TAO_CodecFactory",
+ "_make_TAO_CodecFactory_Loader",
+ ""));
+ loader =
+ ACE_Dynamic_Service<TAO_Object_Loader>::instance
+ (this->configuration (), ACE_TEXT ("CodecFactory_Loader"));
+ }
+
+ if (loader != 0)
+ {
+ this->codec_factory_ =
+ loader->create_object (this->orb_, 0, 0 ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+}
+
+void
+TAO_ORB_Core::resolve_poa_current_i (ACE_ENV_SINGLE_ARG_DECL)
+{
+ TAO_Object_Loader *loader =
+ ACE_Dynamic_Service<TAO_Object_Loader>::instance
+ (this->configuration(),
+ ACE_TEXT ("TAO_POA_Current_Factory"));
+
+ if (loader == 0)
+ {
+ this->configuration()->process_directive
+ (ACE_DYNAMIC_SERVICE_DIRECTIVE("TAO_POA_Current_Factory",
+ "TAO_PortableServer",
+ "_make_TAO_POA_Current_Factory",
+ ""));
+ loader =
+ ACE_Dynamic_Service<TAO_Object_Loader>::instance
+ (this->configuration(), ACE_TEXT ("TAO_POA_Current_Factory"));
+ }
+
+ if (loader != 0)
+ {
+ this->poa_current_ =
+ loader->create_object (this->orb_, 0, 0 ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+}
+
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+void
+TAO_ORB_Core::resolve_picurrent_i (ACE_ENV_SINGLE_ARG_DECL)
+{
+ TAO_Object_Loader *loader =
+ ACE_Dynamic_Service<TAO_Object_Loader>::instance
+ (this->configuration (),
+ ACE_TEXT ("PICurrent_Loader"));
+
+ if (loader == 0)
+ {
+ this->configuration ()->process_directive
+ (ACE_DYNAMIC_SERVICE_DIRECTIVE("PICurrent_Loader",
+ "TAO_PI",
+ "_make_TAO_PICurrent_Loader",
+ ""));
+ loader =
+ ACE_Dynamic_Service<TAO_Object_Loader>::instance
+ (this->configuration (), ACE_TEXT ("PICurrent_Loader"));
+ }
+
+ if (loader != 0)
+ {
+ CORBA::Object_ptr pi =
+ loader->create_object (this->orb_, 0, 0 ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->pi_current_ = pi;
+ }
+}
+
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+
+
+void
+TAO_ORB_Core::resolve_dynanyfactory_i (ACE_ENV_SINGLE_ARG_DECL)
+{
+ TAO_Object_Loader *loader =
+ ACE_Dynamic_Service<TAO_Object_Loader>::instance
+ (this->configuration (),
+ ACE_TEXT ("DynamicAny_Loader"));
+
+ if (loader == 0)
+ {
+ this->configuration ()->process_directive
+ (ACE_DYNAMIC_SERVICE_DIRECTIVE("DynamicAny_Loader",
+ "TAO_DynamicAny",
+ "_make_TAO_DynamicAny_Loader",
+ ""));
+ loader =
+ ACE_Dynamic_Service<TAO_Object_Loader>::instance
+ (this->configuration (),
+ ACE_TEXT ("DynamicAny_Loader"));
+ }
+
+ if (loader != 0)
+ {
+ this->dynany_factory_ =
+ loader->create_object (this->orb_, 0, 0 ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+}
+
+void
+TAO_ORB_Core::resolve_iormanipulation_i (ACE_ENV_SINGLE_ARG_DECL)
+{
+ TAO_Object_Loader *loader =
+ ACE_Dynamic_Service<TAO_Object_Loader>::instance
+ (this->configuration (),
+ ACE_TEXT ("IORManip_Loader"));
+
+ if (loader == 0)
+ {
+ this->configuration()->process_directive
+ (ACE_DYNAMIC_SERVICE_DIRECTIVE("IORManip_Loader",
+ "TAO_IORManip",
+ "_make_TAO_IORManip_Loader",
+ ""));
+ loader =
+ ACE_Dynamic_Service<TAO_Object_Loader>::instance
+ (this->configuration (), ACE_TEXT ("IORManip_Loader"));
+ }
+
+ if (loader != 0)
+ {
+ this->ior_manip_factory_ =
+ loader->create_object (this->orb_, 0, 0 ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+}
+
+void
+TAO_ORB_Core::resolve_ior_table_i (ACE_ENV_SINGLE_ARG_DECL)
+{
+ TAO_Adapter_Factory *factory =
+ ACE_Dynamic_Service<TAO_Adapter_Factory>::instance
+ (this->configuration (),
+ ACE_TEXT ("TAO_IORTable"));
+
+ if (factory == 0)
+ {
+ this->configuration ()->process_directive
+ (ACE_DYNAMIC_SERVICE_DIRECTIVE("TAO_IORTable",
+ "TAO_IORTable",
+ "_make_TAO_Table_Adapter_Factory",
+ ""));
+ factory =
+ ACE_Dynamic_Service<TAO_Adapter_Factory>::instance
+ (this->configuration (), ACE_TEXT ("TAO_IORTable"));
+ }
+
+ if (factory != 0)
+ {
+ ACE_Auto_Ptr <TAO_Adapter> iortable_adapter (factory->create (this));
+ iortable_adapter->open (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ CORBA::Object_var tmp_root = iortable_adapter->root ();
+
+ this->adapter_registry_.insert (iortable_adapter.get () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // It is now (exception) safe to release ownership from the auto pointers
+ this->ior_table_= tmp_root._retn ();
+ iortable_adapter.release ();
+ }
+}
+
+int
+TAO_ORB_Core::set_endpoint_helper (const ACE_CString &lane,
+ const ACE_CString &endpoints
+ ACE_ENV_ARG_DECL)
+{
+ if (this->orb_params ()->add_endpoints (lane,
+ endpoints) != 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t)\n")
+ ACE_TEXT ("Invalid endpoint(s) specified:\n%s\n"),
+ ACE_TEXT_CHAR_TO_TCHAR(endpoints.c_str ())));
+ ACE_THROW_RETURN (CORBA::BAD_PARAM (
+ CORBA::SystemException::_tao_minor_code (
+ TAO_ORB_CORE_INIT_LOCATION_CODE,
+ EINVAL),
+ CORBA::COMPLETED_NO),
+ -1);
+ }
+
+ return 0;
+}
+
+CORBA::Object_ptr
+TAO_ORB_Core::resolve_rir (const char *name
+ ACE_ENV_ARG_DECL)
+{
+ // Get the table of initial references specified through
+ // -ORBInitRef.
+ ACE_CString ior;
+ ACE_CString object_id ((const char *) name);
+
+ // Get the list of initial reference prefixes specified through
+ // -ORBDefaultInitRef.
+ CORBA::String_var default_init_ref =
+ this->orb_params ()->default_init_ref ();
+
+ // Check if a DefaultInitRef was specified.
+ if (ACE_OS::strlen (default_init_ref.in ()) != 0)
+ {
+ static const char corbaloc_prefix[] = "corbaloc:";
+ static const char mcast_prefix[] = "mcast:";
+ char object_key_delimiter = 0;
+
+ ACE_CString list_of_profiles (default_init_ref.in ());
+
+ // Check if the protocol is corbaloc: or mcast:.
+ // If it is, set the object_key_delimiter.
+ if ((ACE_OS::strncmp (default_init_ref.in (),
+ corbaloc_prefix,
+ sizeof corbaloc_prefix -1) == 0) ||
+ (ACE_OS::strncmp (default_init_ref.in (),
+ mcast_prefix,
+ sizeof mcast_prefix -1) == 0))
+ {
+ object_key_delimiter = '/';
+ }
+ else
+ {
+ TAO_Connector_Registry *conn_reg =
+ this->connector_registry (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ // Obtain the appropriate object key delimiter for the
+ // specified protocol.
+ object_key_delimiter =
+ conn_reg->object_key_delimiter (list_of_profiles.c_str ());
+ }
+
+ // Make sure that the default initial reference doesn't end
+ // with the object key delimiter character.
+ if (list_of_profiles[list_of_profiles.length() - 1] !=
+ object_key_delimiter)
+ list_of_profiles += ACE_CString (object_key_delimiter);
+
+ list_of_profiles += object_id;
+
+ return this->orb ()->string_to_object (list_of_profiles.c_str ()
+ ACE_ENV_ARG_PARAMETER);
+ }
+
+ return CORBA::Object::_nil ();
+}
+
+CORBA::ORB::ObjectIdList *
+TAO_ORB_Core::list_initial_references (ACE_ENV_SINGLE_ARG_DECL)
+{
+ // Unsupported initial services should NOT be included in the below list!
+ static const char *initial_services[] = { TAO_LIST_OF_INITIAL_SERVICES };
+ // Make sure the "terminating" zero is the last array element so
+ // that there is a stop condition when iterating through the list.
+
+ static const size_t initial_services_size =
+ sizeof (initial_services) / sizeof (initial_services[0]);
+
+ const size_t total_size =
+ initial_services_size
+ + this->init_ref_map_.size ()
+ + this->object_ref_table_.current_size ();
+
+ CORBA::ORB::ObjectIdList *tmp = 0;
+
+ ACE_NEW_THROW_EX (tmp,
+ CORBA::ORB::ObjectIdList (
+ static_cast<CORBA::ULong> (total_size)),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (0);
+
+ CORBA::ORB::ObjectIdList_var list (tmp);
+ list->length (static_cast<CORBA::ULong> (total_size));
+
+ CORBA::ULong index = 0;
+ // Index for ObjectIdList members.
+
+ // Iterate over the registered initial references.
+ for (index = 0; index < initial_services_size; ++index)
+ list[index] = initial_services[index];
+
+ // Now iterate over the initial references created by the user and
+ // add them to the sequence.
+
+ // References registered via
+ // ORBInitInfo::register_initial_reference().
+ TAO_Object_Ref_Table::iterator const obj_ref_end =
+ this->object_ref_table_.end ();
+
+ for (TAO_Object_Ref_Table::iterator i = this->object_ref_table_.begin ();
+ i != obj_ref_end;
+ ++i, ++index)
+ list[index] = CORBA::string_dup ((*i).first.in ());
+
+ // References registered via INS.
+ InitRefMap::iterator const end = this->init_ref_map_.end ();
+
+ for (InitRefMap::iterator j = this-> init_ref_map_.begin ();
+ j != end;
+ ++j, ++index)
+ list[index] = (*j).second.c_str ();
+
+ return list._retn ();
+}
+
+// ****************************************************************
+ACE_Allocator*
+TAO_ORB_Core::input_cdr_dblock_allocator (void)
+{
+ return this->lane_resources ().input_cdr_dblock_allocator ();
+}
+
+ACE_Allocator*
+TAO_ORB_Core::input_cdr_buffer_allocator (void)
+{
+ return this->lane_resources ().input_cdr_buffer_allocator ();
+}
+
+ACE_Allocator*
+TAO_ORB_Core::input_cdr_msgblock_allocator (void)
+{
+ return this->lane_resources ().input_cdr_msgblock_allocator ();
+}
+
+ACE_Allocator*
+TAO_ORB_Core::output_cdr_dblock_allocator (void)
+{
+
+ return this->lane_resources ().output_cdr_dblock_allocator ();
+}
+
+ACE_Allocator*
+TAO_ORB_Core::output_cdr_buffer_allocator (void)
+{
+ return this->lane_resources ().output_cdr_buffer_allocator ();
+}
+
+
+ACE_Allocator*
+TAO_ORB_Core::output_cdr_msgblock_allocator (void)
+{
+ return this->lane_resources ().output_cdr_msgblock_allocator ();
+}
+
+
+ACE_Allocator *
+TAO_ORB_Core::transport_message_buffer_allocator (void)
+{
+ return this->lane_resources ().transport_message_buffer_allocator ();
+}
+
+
+ACE_Data_Block*
+TAO_ORB_Core::create_input_cdr_data_block (size_t size)
+{
+
+ ACE_Allocator *dblock_allocator = 0;
+ ACE_Allocator *buffer_allocator = 0;
+
+ dblock_allocator =
+ this->input_cdr_dblock_allocator ();
+ buffer_allocator =
+ this->input_cdr_buffer_allocator ();
+
+ ACE_Lock* lock_strategy = 0;
+ if (this->resource_factory ()->use_locked_data_blocks ())
+ {
+ lock_strategy = &this->data_block_lock_;
+ }
+
+ return this->create_data_block_i (size,
+ buffer_allocator,
+ dblock_allocator,
+ lock_strategy);
+}
+
+ACE_Data_Block *
+TAO_ORB_Core::create_data_block_i (size_t size,
+ ACE_Allocator *buffer_allocator,
+ ACE_Allocator *dblock_allocator,
+ ACE_Lock *lock_strategy)
+{
+ ACE_Data_Block *nb = 0;
+
+ ACE_NEW_MALLOC_RETURN (
+ nb,
+ static_cast<ACE_Data_Block*> (
+ dblock_allocator->malloc (sizeof (ACE_Data_Block))),
+ ACE_Data_Block (size,
+ ACE_Message_Block::MB_DATA,
+ 0,
+ buffer_allocator,
+ lock_strategy,
+ 0,
+ dblock_allocator),
+ 0);
+
+ return nb;
+}
+
+TAO_Connector_Registry *
+TAO_ORB_Core::connector_registry (ACE_ENV_SINGLE_ARG_DECL)
+{
+ TAO_Connector_Registry *conn =
+ this->lane_resources ().connector_registry (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ return conn;
+}
+
+auto_ptr<TAO_GIOP_Fragmentation_Strategy>
+TAO_ORB_Core::fragmentation_strategy (TAO_Transport * transport)
+{
+ return
+ this->resource_factory ()->create_fragmentation_strategy (
+ transport,
+ this->orb_params_.max_message_size ());
+}
+
+ACE_Reactor *
+TAO_ORB_Core::reactor (void)
+{
+ return this->leader_follower ().reactor ();
+}
+
+CORBA::Object_ptr
+TAO_ORB_Core::implrepo_service (void)
+{
+ if (!this->use_implrepo_)
+ return CORBA::Object::_nil ();
+
+ if (CORBA::is_nil (this->implrepo_service_))
+ {
+
+ ACE_TRY_NEW_ENV
+ {
+ CORBA::Object_var temp =
+ this->orb_->resolve_initial_references ("ImplRepoService" ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->lock_, CORBA::Object::_nil ());
+
+ // @@ Worry about assigning a different IOR? (brunsch)
+ this->implrepo_service_ = temp._retn ();
+ }
+ ACE_CATCHANY
+ {
+ // Just make sure that we have a null pointer. Ignore the exception
+ // anyway.
+ this->implrepo_service_ = CORBA::Object::_nil ();
+ }
+ ACE_ENDTRY;
+ }
+
+ return CORBA::Object::_duplicate (this->implrepo_service_);
+}
+
+void
+TAO_ORB_Core::call_sync_scope_hook (TAO_Stub *stub,
+ bool &has_synchronization,
+ Messaging::SyncScope &scope)
+{
+ Sync_Scope_Hook sync_scope_hook =
+ TAO_ORB_Core_Static_Resources::instance ()->sync_scope_hook_;
+
+ if (sync_scope_hook == 0)
+ {
+ has_synchronization = false;
+ return;
+ }
+
+ (*sync_scope_hook) (this, stub, has_synchronization, scope);
+}
+
+#if (TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1)
+
+TAO::Transport_Queueing_Strategy &
+TAO_ORB_Core::get_transport_queueing_strategy (TAO_Stub *,
+ Messaging::SyncScope &scope)
+{
+
+ if (scope == Messaging::SYNC_WITH_TRANSPORT
+ || scope == Messaging::SYNC_WITH_SERVER
+ || scope == Messaging::SYNC_WITH_TARGET)
+ {
+ return this->flush_transport_queueing_strategy ();
+ }
+
+ if (scope == Messaging::SYNC_NONE
+ || scope == TAO::SYNC_EAGER_BUFFERING)
+ {
+ return this->eager_transport_queueing_strategy ();
+ }
+
+ if (scope == TAO::SYNC_DELAYED_BUFFERING)
+ {
+ return this->delayed_transport_queueing_strategy ();
+ }
+
+ return this->default_transport_queueing_strategy ();
+}
+
+#endif /* TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1 */
+
+void
+TAO_ORB_Core::set_sync_scope_hook (Sync_Scope_Hook hook)
+{
+ TAO_ORB_Core_Static_Resources::instance ()-> sync_scope_hook_ = hook;
+}
+
+int
+TAO_ORB_Core::add_tss_cleanup_func (ACE_CLEANUP_FUNC cleanup,
+ size_t &slot_id)
+{
+ return this->tss_cleanup_funcs_.register_cleanup_function (cleanup,
+ slot_id);
+}
+
+void
+TAO_ORB_Core::call_timeout_hook (TAO_Stub *stub,
+ bool &has_timeout,
+ ACE_Time_Value &time_value)
+{
+ Timeout_Hook timeout_hook =
+ TAO_ORB_Core_Static_Resources::instance ()->timeout_hook_;
+
+ if (timeout_hook == 0)
+ {
+ has_timeout = false;
+ return;
+ }
+ (*timeout_hook) (this, stub, has_timeout, time_value);
+}
+
+void
+TAO_ORB_Core::set_timeout_hook (Timeout_Hook hook)
+{
+ // Saving the hook pointer so that we can use it later when needed.
+ TAO_ORB_Core_Static_Resources::instance ()->timeout_hook_ = hook;
+}
+
+void
+TAO_ORB_Core::connection_timeout (TAO_Stub *stub,
+ bool &has_timeout,
+ ACE_Time_Value &time_value)
+{
+ Timeout_Hook connection_timeout_hook =
+ TAO_ORB_Core_Static_Resources::instance ()->connection_timeout_hook_;
+
+ if (connection_timeout_hook == 0)
+ {
+ has_timeout = false;
+ return;
+ }
+
+ (*connection_timeout_hook) (this, stub, has_timeout, time_value);
+
+ Timeout_Hook alt_connection_timeout_hook =
+ TAO_ORB_Core_Static_Resources::instance ()->alt_connection_timeout_hook_;
+
+ if (alt_connection_timeout_hook == 0)
+ return;
+
+ if (!has_timeout || time_value == ACE_Time_Value::zero )
+ {
+ (*alt_connection_timeout_hook) (this, stub, has_timeout,time_value);
+ return;
+ }
+
+ // At this point, both the primary and alternate hooks are defined, and
+ // the primary did indeed set a value
+ ACE_Time_Value tv1;
+ bool ht1;
+ (*alt_connection_timeout_hook) (this, stub, ht1,tv1);
+ if (ht1 && tv1 > ACE_Time_Value::zero && tv1 < time_value)
+ time_value = tv1;
+}
+
+void
+TAO_ORB_Core::connection_timeout_hook (Timeout_Hook hook)
+{
+ // Saving the hook pointer so that we can use it later when needed.
+ // For now there are only two entry points that may supply a connection
+ // timeout hook. But there might be future entry points, so this should
+ // probably be addressed by a more sophisticated mechanism.
+
+#define TOCSRi TAO_ORB_Core_Static_Resources::instance ()
+
+ // A consern was raised that since this function is called by two
+ // different initializers there may be a race condition that might
+ // require a lock. We are not using a lock at this time because of
+ // two callers, one happens only during service directive processing
+ // and the other only during ORB Initialization time. The former
+ // happens when the OC_Endpoint_Selector_Factory is loaded, the
+ // latter is part of the messaging library. The messaging library
+ // calls this function as part of pre_init processing, and this call
+ // happes for every ORB instance. This was the case before these The
+ // latter call occurs when the messaging library is loaded. The
+ // redundant calls occured then as well. Second, it isn't clear how
+ // a lock in this static method would react in the face of windows
+ // dlls, shared memory segments, etc. Therefore we are continuing to
+ // keep this code lockless as it always was, assuming no
+ // simultanious overwrite will occur.
+
+ if (TOCSRi->connection_timeout_hook_ == 0)
+ {
+ if (TAO_debug_level > 2)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT("TAO (%P|%t) setting primary hook\n")));
+ TOCSRi->connection_timeout_hook_ = hook;
+ }
+ else if (TOCSRi->connection_timeout_hook_ != hook &&
+ TOCSRi->alt_connection_timeout_hook_ == 0)
+ {
+ if (TAO_debug_level > 2)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT("TAO (%P|%t) setting alternate hook\n")));
+ TOCSRi->alt_connection_timeout_hook_ = hook;
+ }
+ else
+ if (TAO_debug_level > 2)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) not overwriting alternate hook.")
+ ACE_TEXT (" Is it still null? %d\n"),
+ TOCSRi->alt_connection_timeout_hook_ == 0));
+
+#undef TOCSRi
+}
+
+#if (TAO_HAS_CORBA_MESSAGING == 1)
+
+CORBA::Policy_ptr
+TAO_ORB_Core::get_policy (CORBA::PolicyType type
+ ACE_ENV_ARG_DECL)
+{
+ CORBA::Policy_var result;
+
+ TAO_Policy_Manager *policy_manager =
+ this->policy_manager ();
+ if (policy_manager != 0)
+ {
+ result = policy_manager->get_policy (type
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+ }
+
+ if (CORBA::is_nil (result.in ()))
+ {
+ result =
+ this->get_default_policies ()->get_policy (type
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+ }
+
+ return result._retn ();
+}
+
+CORBA::Policy_ptr
+TAO_ORB_Core::get_policy_including_current (CORBA::PolicyType type
+ ACE_ENV_ARG_DECL)
+{
+ TAO_Policy_Current &policy_current =
+ this->policy_current ();
+
+ CORBA::Policy_var result =
+ policy_current.get_policy (type
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+
+ if (CORBA::is_nil (result.in ()))
+ {
+ result = this->get_policy (type
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+ }
+
+ return result._retn ();
+}
+
+CORBA::Policy_ptr
+TAO_ORB_Core::get_cached_policy (TAO_Cached_Policy_Type type
+ ACE_ENV_ARG_DECL)
+{
+ CORBA::Policy_var result;
+
+ TAO_Policy_Manager *policy_manager =
+ this->policy_manager ();
+ if (policy_manager != 0)
+ {
+ result =
+ policy_manager->get_cached_policy (type
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+ }
+
+ if (CORBA::is_nil (result.in ()))
+ {
+ result =
+ this->get_default_policies ()->get_cached_policy (type
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+ }
+
+ return result._retn ();
+}
+
+CORBA::Policy_ptr
+TAO_ORB_Core::get_cached_policy_including_current (
+ TAO_Cached_Policy_Type type
+ ACE_ENV_ARG_DECL)
+{
+ TAO_Policy_Current &policy_current =
+ this->policy_current ();
+
+ CORBA::Policy_var result =
+ policy_current.get_cached_policy (type
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK (CORBA::Policy::_nil ());
+
+ if (CORBA::is_nil (result.in ()))
+ {
+ result =
+ this->get_cached_policy (type
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+ }
+
+ return result._retn ();
+}
+
+#endif /* (TAO_HAS_CORBA_MESSAGING == 1) */
+
+CORBA::Environment *
+TAO_ORB_Core::default_environment (void) const
+{
+ return TAO_TSS_Resources::instance ()->default_environment_;
+}
+
+void
+TAO_ORB_Core::default_environment (CORBA::Environment *env)
+{
+ TAO_TSS_Resources::instance ()->default_environment_ = env;
+}
+
+void
+TAO_ORB_Core::add_interceptor (
+ PortableInterceptor::IORInterceptor_ptr interceptor
+ ACE_ENV_ARG_DECL)
+{
+ if (this->ior_interceptor_adapter ())
+ {
+ this->ior_interceptor_adapter_->add_interceptor (interceptor
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) %p\n"),
+ ACE_TEXT ("ERROR: ORB Core unable to find the ")
+ ACE_TEXT ("IORInterceptor Adapter Factory instance")));
+
+ ACE_THROW (CORBA::INTERNAL ());
+ }
+}
+
+TAO_IORInterceptor_Adapter *
+TAO_ORB_Core::ior_interceptor_adapter (void)
+{
+ if (this->ior_interceptor_adapter_ == 0)
+ {
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
+ ace_mon,
+ this->lock_,
+ 0);
+
+ if (this->ior_interceptor_adapter_ == 0)
+ {
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ TAO_IORInterceptor_Adapter_Factory * ior_ap_factory =
+ ACE_Dynamic_Service<TAO_IORInterceptor_Adapter_Factory>::instance
+ (this->configuration (),
+ ACE_TEXT_CHAR_TO_TCHAR (TAO_ORB_Core::iorinterceptor_adapter_factory_name ()));
+
+ if (ior_ap_factory)
+ {
+ this->ior_interceptor_adapter_ =
+ ior_ap_factory->create (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "Cannot initialize the "
+ "ior_interceptor_adapter \n");
+ }
+ ACE_ENDTRY;
+ ACE_CHECK_RETURN(0);
+ }
+ }
+
+ return this->ior_interceptor_adapter_;
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+void
+TAO_ORB_Core::add_interceptor (
+ PortableInterceptor::ClientRequestInterceptor_ptr interceptor
+ ACE_ENV_ARG_DECL)
+{
+ if (this->clientrequestinterceptor_adapter_i ())
+ {
+ this->client_request_interceptor_adapter_->add_interceptor (interceptor
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) %p\n"),
+ ACE_TEXT ("ERROR: ORB Core unable to find the ")
+ ACE_TEXT ("Client Request Interceptor Adapter Factory ")
+ ACE_TEXT ("instance")));
+
+ ACE_THROW (CORBA::INTERNAL ());
+ }
+}
+
+TAO::ClientRequestInterceptor_Adapter *
+TAO_ORB_Core::clientrequestinterceptor_adapter_i (void)
+{
+ if (this->client_request_interceptor_adapter_ == 0)
+ {
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
+ ace_mon,
+ this->lock_,
+ 0);
+
+ if (this->client_request_interceptor_adapter_ == 0)
+ {
+ TAO_ClientRequestInterceptor_Adapter_Factory *factory =
+ ACE_Dynamic_Service<TAO_ClientRequestInterceptor_Adapter_Factory>::instance
+ (this->configuration (),
+ ACE_TEXT ("ClientRequestInterceptor_Adapter_Factory"));
+
+ if (factory)
+ {
+ this->client_request_interceptor_adapter_ =
+ factory->create ();
+ }
+ }
+ }
+
+ return this->client_request_interceptor_adapter_;
+}
+
+void
+TAO_ORB_Core::add_interceptor (
+ PortableInterceptor::ServerRequestInterceptor_ptr interceptor
+ ACE_ENV_ARG_DECL)
+{
+ if (this->serverrequestinterceptor_adapter_i ())
+ {
+ this->server_request_interceptor_adapter_->add_interceptor (interceptor
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) %p\n"),
+ ACE_TEXT ("ERROR: ORB Core unable to find the ")
+ ACE_TEXT ("Server Request Interceptor Adapter Factory ")
+ ACE_TEXT ("instance")));
+
+ ACE_THROW (CORBA::INTERNAL ());
+ }
+}
+
+void
+TAO_ORB_Core::add_interceptor (
+ PortableInterceptor::ClientRequestInterceptor_ptr interceptor,
+ const CORBA::PolicyList& policies
+ ACE_ENV_ARG_DECL)
+{
+ if (this->clientrequestinterceptor_adapter_i ())
+ {
+ this->client_request_interceptor_adapter_->add_interceptor (
+ interceptor,
+ policies
+ ACE_ENV_ARG_PARAMETER);
+
+ ACE_CHECK;
+ }
+ else
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) %p\n"),
+ ACE_TEXT ("ERROR: ORB Core unable to find the ")
+ ACE_TEXT ("Client Request Interceptor Adapter Factory ")
+ ACE_TEXT ("instance")));
+
+ ACE_THROW (CORBA::INTERNAL ());
+ }
+}
+
+void
+TAO_ORB_Core::add_interceptor (
+ PortableInterceptor::ServerRequestInterceptor_ptr interceptor,
+ const CORBA::PolicyList& policies
+ ACE_ENV_ARG_DECL)
+{
+ if (this->serverrequestinterceptor_adapter_i ())
+ {
+ this->server_request_interceptor_adapter_->add_interceptor (
+ interceptor,
+ policies
+ ACE_ENV_ARG_PARAMETER);
+
+ ACE_CHECK;
+ }
+ else
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) %p\n"),
+ ACE_TEXT ("ERROR: ORB Core unable to find the ")
+ ACE_TEXT ("Server Request Interceptor Adapter Factory ")
+ ACE_TEXT ("instance")));
+
+ ACE_THROW (CORBA::INTERNAL ());
+ }
+}
+
+TAO::ServerRequestInterceptor_Adapter *
+TAO_ORB_Core::serverrequestinterceptor_adapter_i (void)
+{
+ if (this->server_request_interceptor_adapter_ == 0)
+ {
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
+ ace_mon,
+ this->lock_,
+ 0);
+
+ if (this->server_request_interceptor_adapter_ == 0)
+ {
+ TAO_ServerRequestInterceptor_Adapter_Factory *factory =
+ ACE_Dynamic_Service<TAO_ServerRequestInterceptor_Adapter_Factory>::instance
+ (this->configuration (),
+ ACE_TEXT ("ServerRequestInterceptor_Adapter_Factory"));
+
+ if (factory)
+ {
+ this->server_request_interceptor_adapter_ =
+ factory->create ();
+ }
+ }
+ }
+
+ return this->server_request_interceptor_adapter_;
+}
+
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+
+TAO_Valuetype_Adapter *
+TAO_ORB_Core::valuetype_adapter (void)
+{
+ if (this->valuetype_adapter_ == 0)
+ {
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
+ ace_mon,
+ this->lock_,
+ 0);
+
+ if (this->valuetype_adapter_ == 0)
+ {
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ TAO_Valuetype_Adapter_Factory * vt_ap_factory =
+ ACE_Dynamic_Service<TAO_Valuetype_Adapter_Factory>::instance (
+ TAO_ORB_Core::valuetype_adapter_factory_name ()
+ );
+
+ if (vt_ap_factory)
+ {
+ this->valuetype_adapter_ =
+ vt_ap_factory->create (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "Cannot initialize the "
+ "valuetype_adapter \n");
+ }
+ ACE_ENDTRY;
+ ACE_CHECK_RETURN(0);
+ }
+
+ if (this->valuetype_adapter_ == 0)
+ {
+ ACE_THROW_RETURN (CORBA::INTERNAL (),
+ 0);
+ }
+ }
+
+ return this->valuetype_adapter_;
+}
+
+// ****************************************************************
+
+TAO_Export TAO_ORB_Core *
+TAO_ORB_Core_instance (void)
+{
+ // @@ This is a slight violation of layering, we should use
+ // TAO_ORB_Core_instance(), but that breaks during startup.
+ TAO::ORB_Table * const orb_table = TAO::ORB_Table::instance ();
+ if (orb_table->first_orb () == 0)
+ {
+ ACE_MT (ACE_GUARD_RETURN (TAO_SYNCH_RECURSIVE_MUTEX, guard,
+ *ACE_Static_Object_Lock::instance (), 0));
+
+ if (orb_table->first_orb () == 0)
+ {
+ // Calling CORBA::ORB_init() returns a duplicated ORB
+ // reference, so make sure that reference is stored in an
+ // ORB_var so that no leak occurs. The duplicate ORB
+ // reference isn't needed outside the scope of this function
+ // since the corresponding ORB Core instance will still
+ // exist in the ORB table after the ORB reference is
+ // destroyed.
+
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ int argc = 0;
+ CORBA::ORB_var orb =
+ CORBA::ORB_init (argc, 0, 0 ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ // @@ What should we do here?
+ }
+ ACE_ENDTRY;
+ }
+ }
+
+ return orb_table->first_orb ();
+}
+
+
+TAO::Collocation_Strategy
+TAO_ORB_Core::collocation_strategy (CORBA::Object_ptr object
+ ACE_ENV_ARG_DECL)
+{
+ TAO_Stub *stub = object->_stubobj ();
+ if (!CORBA::is_nil (stub->servant_orb_var ().in ()) &&
+ stub->servant_orb_var ()->orb_core () != 0)
+ {
+ TAO_ORB_Core *orb_core =
+ stub->servant_orb_var ()->orb_core ();
+
+ const int collocated =
+ orb_core->collocation_resolver ().is_collocated (object
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO::TAO_CS_REMOTE_STRATEGY);
+
+ if (collocated)
+ {
+ switch (stub->servant_orb_var ()->orb_core ()->get_collocation_strategy ())
+ {
+ case THRU_POA:
+ return TAO::TAO_CS_THRU_POA_STRATEGY;
+
+ case DIRECT:
+ {
+ /////////////////////////////////////////////////////////////
+ // If the servant is null and you are collocated this means
+ // that the POA policy NON-RETAIN is set, and with that policy
+ // using the DIRECT collocation strategy is just insane.
+ /////////////////////////////////////////////////////////////
+ ACE_ASSERT (object->_servant () != 0);
+ return TAO::TAO_CS_DIRECT_STRATEGY;
+ }
+ }
+ }
+ }
+
+ // In this case the Object is a client.
+ return TAO::TAO_CS_REMOTE_STRATEGY;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/ORB_Core.h b/TAO/tao/ORB_Core.h
new file mode 100644
index 00000000000..8c021b5a973
--- /dev/null
+++ b/TAO/tao/ORB_Core.h
@@ -0,0 +1,1452 @@
+// -*- C++ -*-
+
+// ===================================================================
+/**
+ * @file ORB_Core.h
+ *
+ * $Id$
+ *
+ * @author DOC Center - Washington University at St. Louis
+ * @author DOC Laboratory - University of California at Irvine
+ */
+// ===================================================================
+
+#ifndef TAO_ORB_CORE_H
+#define TAO_ORB_CORE_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Resource_Factory.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Collocation_Strategy.h"
+#include "tao/params.h"
+#include "tao/ORB_Constants.h"
+#include "tao/Parser_Registry.h"
+#include "tao/Service_Callbacks.h"
+#include "tao/Fault_Tolerance_Service.h"
+#include "tao/Cleanup_Func_Registry.h"
+#include "tao/Object_Ref_Table.h"
+#include "tao/ObjectKey_Table.h"
+#include "tao/Messaging_SyncScopeC.h"
+#include "tao/Object.h"
+#include "tao/Invocation_Utils.h"
+#include "tao/Adapter_Registry.h"
+#include "tao/ORB_Core_TSS_Resources.h"
+#include "ace/Array_Map.h"
+
+#include "ace/Thread_Manager.h"
+#include "ace/Lock_Adapter_T.h"
+#include "ace/TSS_T.h"
+
+#include "ace/Service_Object.h"
+
+ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+class ACE_Data_Block;
+ACE_END_VERSIONED_NAMESPACE_DECL
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+namespace TAO
+{
+ class ClientRequestInterceptor_Adapter;
+ class ServerRequestInterceptor_Adapter;
+}
+
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+
+class TAO_Adapter;
+class TAO_Acceptor;
+class TAO_Connector;
+class TAO_Connector_Registry;
+
+class TAO_Resource_Factory;
+class TAO_Client_Strategy_Factory;
+class TAO_Server_Strategy_Factory;
+
+class TAO_TSS_Resources;
+class TAO_Leader_Follower;
+class TAO_LF_Strategy;
+class TAO_RT_ORB;
+class TAO_RT_Current;
+class TAO_MProfile;
+class TAO_Profile;
+
+class TAO_Endpoint_Selector_Factory;
+class TAO_Message_State_Factory;
+class TAO_Protocols_Hooks;
+class TAO_BiDir_Adapter;
+
+class TAO_Flushing_Strategy;
+
+class TAO_Thread_Lane_Resources_Manager;
+class TAO_Collocation_Resolver;
+class TAO_Thread_Lane_Resources;
+class TAO_Stub_Factory;
+class TAO_Endpoint_Selector_Factory;
+class TAO_Service_Context;
+class TAO_Request_Dispatcher;
+class TAO_Policy_Set;
+class TAO_Policy_Manager;
+class TAO_Policy_Current;
+
+class TAO_Codeset_Manager;
+class TAO_IORInterceptor_Adapter;
+class TAO_Valuetype_Adapter;
+
+class TAO_Policy_Validator;
+
+namespace TAO
+{
+ class GUIResource_Factory;
+ class PolicyFactory_Registry_Adapter;
+ class ORBInitializer_Registry_Adapter;
+ class Transport_Queueing_Strategy;
+}
+
+namespace CORBA
+{
+ class ORB_ObjectIdList; // CORBA::ORB::ObjectIdList
+ class ORB;
+ typedef ORB *ORB_ptr;
+
+ class PolicyList;
+}
+
+namespace IOP
+{
+ class ServiceContextList;
+}
+
+namespace PortableInterceptor
+{
+ class IORInterceptor;
+ typedef IORInterceptor *IORInterceptor_ptr;
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+ class ClientRequestInterceptor;
+ typedef ClientRequestInterceptor *ClientRequestInterceptor_ptr;
+
+ class ServerRequestInterceptor;
+ typedef ServerRequestInterceptor *ServerRequestInterceptor_ptr;
+
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+}
+
+// ****************************************************************
+/**
+ * @class TAO_ORB_Core
+ *
+ * @brief Encapsulates the state of an ORB.
+ *
+ * This is the implementation class for the CORBA::ORB interface. The
+ * class also encapsulates the access to the ORB resources and its
+ * state.
+ * @par
+ * Some resources can be TSS or global, those resources are always
+ * accessed through a TSS interface, but are allocated using the
+ * Resource_Factory. If the resource is really global the
+ * Resource_Factory will simply return a pointer to the global
+ * instance.
+ */
+class TAO_Export TAO_ORB_Core
+{
+ friend class TAO_ORB_Core_Auto_Ptr;
+ friend CORBA::ORB_ptr CORBA::ORB_init (int &,
+ char *argv[],
+ const char *,
+ CORBA::Environment &);
+public:
+
+ /// Constructor.
+ TAO_ORB_Core (const char* id);
+
+ /// Accessor for the ORB parameters.
+ TAO_ORB_Parameters *orb_params (void);
+
+ /**
+ * @todo
+ * In the future this hook should change, instead of hardcoding the
+ * object we should add a "Resolver" to the ORB, so the "POACurrent"
+ * object returns a per-ORB object.
+ * @par
+ * Similarly, each ORB should implement the TSS pattern to put the
+ * POA_Current_Impl in a void* slot. The current approach *does*
+ * decouple the POA from the ORB, but it cannot add new adapters or
+ * other components transparently.
+ */
+ /// Accessor to the POA current.
+ //@{
+ CORBA::Object_ptr poa_current(void);
+ //@}
+
+ /// Get the connector registry
+ TAO_Connector_Registry *connector_registry (ACE_ENV_SINGLE_ARG_DECL);
+
+ /// Get the IOR parser registry
+ TAO_Parser_Registry *parser_registry (void);
+
+ /// Return pointer to the policy factory registry associated with
+ /// this ORB core.
+ TAO::PolicyFactory_Registry_Adapter *policy_factory_registry (void);
+
+ /// Return pointer to the orb initializer registry associated with
+ /// this ORB core. Tries to load the PI library if it is not loaded
+ /// yet
+ TAO::ORBInitializer_Registry_Adapter *orbinitializer_registry (void);
+
+ /// Get the protocol factories
+ TAO_ProtocolFactorySet *protocol_factories (void);
+
+ /// Get pointer to the ORB.
+ CORBA::ORB_ptr orb (void);
+
+ /// Wrappers that forward the request to the concurrency strategy.
+ ACE_Reactor *reactor (void);
+
+ /// Get the ACE_Thread_Manager
+ ACE_Thread_Manager *thr_mgr (void);
+
+ /// Return the RootPOA, or try to load it if not initialized already.
+ CORBA::Object_ptr root_poa (ACE_ENV_SINGLE_ARG_DECL);
+
+ /// Get the adapter registry
+ TAO_Adapter_Registry *adapter_registry (void);
+
+ /// @name Collocation Strategies
+ //@{
+ enum
+ {
+ /// Indicate object should refer to ORB for either one of the
+ /// following strategies.
+ ORB_CONTROL,
+
+ /// Collocated calls will go thru POA.
+ THRU_POA,
+
+ /// Collocated calls invoke operation on Servant directly.
+ DIRECT
+ };
+
+ /**
+ * This method returns the right collocation strategy, if any,
+ * to be used to perform a method invocation on the given object.
+ *
+ * @note
+ * No-Collocation is a special case of collocation.
+ */
+ static
+ TAO::Collocation_Strategy collocation_strategy (CORBA::Object_ptr object
+ ACE_ENV_ARG_DECL);
+ //@}
+
+ /// Set/get the collocation flags
+ //@{
+ void optimize_collocation_objects (CORBA::Boolean opt);
+ CORBA::Boolean optimize_collocation_objects (void) const;
+
+ void use_global_collocation (CORBA::Boolean opt);
+ CORBA::Boolean use_global_collocation (void) const;
+
+ CORBA::ULong get_collocation_strategy (void) const;
+ //@}
+
+ /// Get the adapter named "RootPOA" and cache the result, this is an
+ /// optimization for the POA.
+ TAO_Adapter *poa_adapter (void);
+
+ /**
+ * @name Access to Factories
+ *
+ * These factories are not thread-specific, and are presented here
+ * in order to have one place to get useful information. Often, the
+ * instances to which the return pointers are stored in the Service
+ * Repository.
+ */
+ //@{
+ /// Returns pointer to the resource factory.
+ TAO_Resource_Factory *resource_factory (void);
+
+ /// Returns pointer to the factory for creating gui resources
+ TAO::GUIResource_Factory *gui_resource_factory (void);
+
+ /// Returns pointer to the client factory.
+ TAO_Client_Strategy_Factory *client_factory (void);
+
+ /// Returns pointer to the server factory.
+ TAO_Server_Strategy_Factory *server_factory (void);
+
+ /// Returns pointer to the Protocols_Hooks.
+ TAO_Protocols_Hooks *protocols_hooks (void);
+
+ /// Returns a pointer to the Thread Lane Resources Manager.
+ TAO_Thread_Lane_Resources_Manager &thread_lane_resources_manager (void);
+
+ /// Returns a pointer to the Collocation Resolver.
+ TAO_Collocation_Resolver &collocation_resolver (void);
+
+ /// Returns a pointer to the Stub factory.
+ TAO_Stub_Factory *stub_factory (void);
+
+ /// Returns a pointer to the endpoint selector factory.
+ TAO_Endpoint_Selector_Factory *endpoint_selector_factory (void);
+
+ //@}
+
+ /// Sets the value of
+ /// TAO_ORB_Core::thread_lane_resources_manager_factory_name_
+ static void set_thread_lane_resources_manager_factory (const char *
+ thread_lane_resources_manager_factory_name);
+
+ /// Sets the value of TAO_ORB_Core::collocation_resolver_name_
+ static void set_collocation_resolver (const char *collocation_resolver_name);
+
+ /// Sets the value of TAO_ORB_Core::stub_factory_name_
+ static void set_stub_factory (const char *stub_factory_name);
+
+ /// Sets the value of TAO_ORB_Core::resource_factory_
+ static void set_resource_factory (const char *resource_factory_name);
+
+ /** Sets the value of TAO_ORB_Core::gui_resource_factory_.
+ *
+ * Sets the value of gui_resource_factory in TSS. ORB_Core is responsible
+ * for releasing this factory if needed.
+ */
+ static void set_gui_resource_factory (TAO::GUIResource_Factory *gui_factory);
+
+ /// Sets the value of TAO_ORB_Core::protocols_hooks_
+ static void set_protocols_hooks (const char *protocols_hooks_name);
+
+ /// Sets the value of TAO_ORB_Core::endpoint_selector_factory_
+ static void set_endpoint_selector_factory (
+ const char *endpoint_selector_factory_name);
+
+ /// Sets the name of the POA factory and the dynamic service
+ /// configurator directive to load it if needed.
+ static void set_poa_factory (const char *poa_factory_name,
+ const char *poa_factory_directive);
+
+ /// Access the POA factory name.
+ static const ACE_CString &poa_factory_name (void);
+
+ /// Gets the value of TAO_ORB_Core::protocols_hooks__
+ TAO_Protocols_Hooks * get_protocols_hooks (void);
+
+ /// Sets the value of TAO_ORB_Core::dynamic_adapter_name_.
+ static void dynamic_adapter_name (const char *name);
+
+ /// Gets the value of TAO_ORB_Core::dynamic_adapter_name_.
+ static const char *dynamic_adapter_name (void);
+
+ /// Sets the value of TAO_ORB_Core::ifr_client_adapter_name_.
+ static void ifr_client_adapter_name (const char *name);
+
+ /// Gets the value of TAO_ORB_Core::ifr_client_adapter_name_.
+ static const char *ifr_client_adapter_name (void);
+
+ /// Sets the value of TAO_ORB_Core::typecodefactory_adapter_name_.
+ static void typecodefactory_adapter_name (const char *name);
+
+ /// Gets the value of TAO_ORB_Core::typecodefactory_adapter_name_.
+ static const char *typecodefactory_adapter_name (void);
+
+ /// Sets the value of TAO_ORB_Core::iorinterceptor_adapter_factory_name_.
+ static void iorinterceptor_adapter_factory_name (const char *name);
+
+ /// Gets the value of TAO_ORB_Core::iorinterceptor_adapter_factory_name_.
+ static const char *iorinterceptor_adapter_factory_name (void);
+
+ /// Sets the value of TAO_ORB_Core::valuetype_adapter_factory_name.
+ static void valuetype_adapter_factory_name (const char *name);
+
+ /// Gets the value of TAO_ORB_Core::valuetype_adapter_factory_name.
+ static const char *valuetype_adapter_factory_name (void);
+
+
+ /// See if we have a collocated address, if yes, return the POA
+ /// associated with the address.
+ int is_collocated (const TAO_MProfile& mprofile);
+
+ /// This allocator is always TSS and has no locks. It is intended
+ /// for allocating the ACE_Data_Blocks used in *outgoing* CDR
+ /// streams.
+ ACE_Allocator *output_cdr_dblock_allocator (void);
+
+ /// This allocator is always TSS and has no locks. It is intended
+ /// for allocating the buffers used in *outgoing* CDR streams.
+ ACE_Allocator *output_cdr_buffer_allocator (void);
+
+ /// This allocator is always TSS and has no locks. It is intended
+ /// for allocating the ACE_Data_Blocks used in *outgoing* CDR
+ /// streams.
+ ACE_Allocator *output_cdr_msgblock_allocator (void);
+
+ /// This allocator is global, may or may not have locks. It is
+ /// intended for allocating the ACE_Data_Blocks used in *incoming*
+ /// CDR streams.
+ ACE_Allocator *input_cdr_dblock_allocator (void);
+
+ /// This allocator is always global and has no locks. It is intended
+ /// for allocating the buffers used in *incoming* CDR streams.
+ ACE_Allocator *input_cdr_buffer_allocator (void);
+
+ /// This allocator is always global and has no locks. It is intended
+ /// for allocating the buffers used in *incoming* CDR streams.
+ ACE_Allocator *input_cdr_msgblock_allocator (void);
+
+ /// This allocator is always global and has no locks. It is intended
+ /// for allocating the buffers used to queue messages in
+ /// transports.
+ ACE_Allocator *transport_message_buffer_allocator (void);
+
+ /// The Message Blocks used for input CDRs must have appropiate
+ /// locking strategies.
+ ACE_Data_Block *create_input_cdr_data_block (size_t size);
+
+ /// Return the locking strategy used for the data blocks.
+ ACE_Lock *locking_strategy (void);
+
+#if (TAO_HAS_CORBA_MESSAGING == 1)
+
+ /// Accessor method for the default_policies_
+ TAO_Policy_Set *get_default_policies (void);
+
+ /// Get a policy. First, check the ORB-level Policy Manager, then
+ /// check the ORB defaults.
+ CORBA::Policy_ptr get_policy (CORBA::PolicyType type
+ ACE_ENV_ARG_DECL);
+
+ /// Get a policy. First, check the thread current, then check the
+ /// ORB-level Policy Manager, then check the ORB defaults.
+ CORBA::Policy_ptr get_policy_including_current (CORBA::PolicyType type
+ ACE_ENV_ARG_DECL);
+
+ /// Get a cached policy. First, check the ORB-level Policy Manager,
+ /// then check the ORB defaults.
+ CORBA::Policy_ptr get_cached_policy (TAO_Cached_Policy_Type type
+ ACE_ENV_ARG_DECL);
+
+ /// Get a cached policy. First, check the thread current, then
+ /// check the ORB-level Policy Manager, then check the ORB defaults.
+ CORBA::Policy_ptr get_cached_policy_including_current (
+ TAO_Cached_Policy_Type type
+ ACE_ENV_ARG_DECL);
+
+#endif /* TAO_HAS_CORBA_MESSAGING == 1 */
+
+ /**
+ * The thread has a default environment to simplify porting between
+ * platforms that support native C++ exceptions and those that
+ * don't. This is a TSS resource (always), but with a twist: if the
+ * user creates a new environment the old one is "pushed" (actually
+ * the new one remembers it), eventually the new environment
+ * destructor pops itself from the stack and we recover the old
+ * environment.
+ * @par
+ * This means that if the user create a new environment and somebody
+ * calls a function using the default one the exception will still
+ * be received in the environment created by the user.
+ * The only drawback is that environments life time must nest
+ * properly, this shouldn't be a problem because environments are
+ * usually created on the stack, but, the spec allows their creation
+ * on the heap and/or as class members; we need to investigate the
+ * tradeoffs and take a decision.
+ */
+ //@{
+ CORBA::Environment *default_environment (void) const;
+ void default_environment (CORBA::Environment*);
+ //@}
+
+#if (TAO_HAS_CORBA_MESSAGING == 1)
+
+ /// Return the Policy_Manager for this ORB.
+ TAO_Policy_Manager *policy_manager (void);
+
+ /// Accesors to the policy current, this object should be kept in
+ /// TSS storage. The POA has to reset the policy current object on
+ /// every upcall.
+ TAO_Policy_Current &policy_current (void);
+
+#endif /* TAO_HAS_CORBA_MESSAGING == 1 */
+
+ /// Invoke the timeout hook if present.
+ /**
+ * The timeout hook is used to determine if the timeout policy is
+ * set and with what value. If the ORB is compiled without support
+ * for Messaging this feature does not take effect
+ * \param has_timeout returns 0 if there is no timeout policy set.
+ * \param time_value returns the timeout value in effect for the object,
+ * thread and current ORB.
+ */
+ void call_timeout_hook (TAO_Stub *stub,
+ bool &has_timeout,
+ ACE_Time_Value &time_value);
+
+ /// Define the Timeout_Hook signature
+ typedef void (*Timeout_Hook) (TAO_ORB_Core *,
+ TAO_Stub *,
+ bool&,
+ ACE_Time_Value&);
+
+ static void set_timeout_hook (Timeout_Hook hook);
+
+ /// Invoke the timeout hook if present.
+ /**
+ * The timeout hook is used to determine if the timeout policy is
+ * set and with what value. If the ORB is compiled without support
+ * for Messaging this feature does not take effect
+ * \param has_timeout returns 0 if there is no timeout policy set.
+ * \param time_value returns the timeout value in effect for the object,
+ * thread and current ORB.
+ */
+ void connection_timeout (TAO_Stub *stub,
+ bool &has_timeout,
+ ACE_Time_Value &time_value);
+
+ /// Define the Timeout_Hook signature
+ /**
+ * The connection timeout hook was originally defined to allow the
+ * TAO Messaging code to be factored out of the core TAO library and
+ * placed in to an optional library. Since then, a new invocation
+ * endpoint selector, the optimised connection endpoint selector
+ * (see Strategies/OC_Endpoint_Selector.h) reused this connection
+ * timeout hook. However, this set up a problem when both the
+ * Messaging library and OCES are being used in the same
+ * application.
+ *
+ * The solution was to add a new connection timeout hook attribute
+ * (see alt_connection_timeout_hook_ below). This method now checks
+ * to see if the connection timeout hook is already set, and if so
+ * assigns the supplied hook value to the alternate connection
+ * timeout hook. This functionality has a side-effect of assuming
+ * that hooks are NEVER unloaded or actively replaced. IOW, no one
+ * will call this method with a 0 or some other pointer value to
+ * replace an existing hook.
+ *
+ * If such functionality as unloading a hook pointer is required,
+ * then this method must be extended to give some kind of identity
+ * for the hook. Additional changes to the definition of the hook
+ * will also be necessary to support such identity and manipulation.
+ */
+ static void connection_timeout_hook (Timeout_Hook hook);
+
+ void call_sync_scope_hook (TAO_Stub *stub,
+ bool &has_synchronization,
+ Messaging::SyncScope &scope);
+
+#if (TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1)
+
+ TAO::Transport_Queueing_Strategy &get_transport_queueing_strategy (
+ TAO_Stub *stub,
+ Messaging::SyncScope &scope);
+
+#endif /* TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1 */
+
+ typedef void (*Sync_Scope_Hook) (TAO_ORB_Core *,
+ TAO_Stub *,
+ bool &,
+ Messaging::SyncScope &);
+
+ static void set_sync_scope_hook (Sync_Scope_Hook hook);
+
+ /// Handle to the factory for protocols_hooks_..
+ TAO_Protocols_Hooks *protocols_hooks_;
+
+ /// Obtain the TSS resources of this orb.
+ TAO_ORB_Core_TSS_Resources* get_tss_resources (void);
+
+ /// Obtain the TSS resource in the given slot.
+ void* get_tss_resource (size_t slot_id);
+
+ /// Set the TSS resource at the given slot.
+ /// Returns 0 on success, and -1 on failure.
+ int set_tss_resource (size_t slot_id, void *);
+
+ /// Register a TSS cleanup function. The slot ID for the
+ /// corresponding ORB core TSS resource is returned by the reference
+ /// argument. This method return 0 on success, and -1 on failure.
+ int add_tss_cleanup_func (ACE_CLEANUP_FUNC cleanup,
+ size_t &slot_id);
+
+ /// Return the underlying TSS cleanup function registry.
+ TAO_Cleanup_Func_Registry *tss_cleanup_funcs (void);
+
+ /// Get access to the leader_follower class.
+ TAO_Leader_Follower &leader_follower (void);
+
+ /// Get access to the leader follower strategy.
+ TAO_LF_Strategy &lf_strategy (void);
+
+ /// Get access to the thread lane resources.
+ TAO_Thread_Lane_Resources &lane_resources (void);
+
+ /// Run the event loop.
+ int run (ACE_Time_Value *tv,
+ int perform_work
+ ACE_ENV_ARG_DECL);
+
+ /// End the event loop
+ void shutdown (CORBA::Boolean wait_for_completion
+ ACE_ENV_ARG_DECL);
+
+ /// Get the shutdown flag value
+ int has_shutdown (void);
+
+ /// Shutdown the ORB and free resources
+ void destroy (ACE_ENV_SINGLE_ARG_DECL);
+
+ /// Check if ORB has shutdown. If it has, throw an exception.
+ void check_shutdown (ACE_ENV_SINGLE_ARG_DECL);
+
+ /// Returns the <timeout> value used by the server threads to poll
+ /// the shutdown flag. If the return value is zero then the server
+ /// threads block forever.
+ int thread_per_connection_timeout (ACE_Time_Value &timeout) const;
+
+ /// Makes sure that the ORB is open and then creates a TAO_Stub
+ /// based on the endpoint.
+ TAO_Stub *create_stub_object (TAO_MProfile &mprofile,
+ const char *type_id,
+ CORBA::PolicyList *policy_list
+ ACE_ENV_ARG_DECL);
+
+ /// Factory method that create the "right" Stub depending on
+ /// wheather RTCORBA is loaded or not. The factory used to create
+ /// the stub, is loaded at ORB initialization, and its type depends
+ /// on the fact that RTCORBA is being used or not.
+ TAO_Stub *create_stub (const char *repository_id,
+ const TAO_MProfile &profiles
+ ACE_ENV_ARG_DECL);
+
+ /// Create a new object, use the adapter registry to create a
+ /// collocated object, if not possible then create a regular
+ /// object.
+ CORBA::Object_ptr create_object (TAO_Stub *the_stub);
+
+ /// Initialize a new object, use the adapter registry to initialize a
+ /// collocated object, if not possible then initialize a regular
+ /// object.
+ /// NOTE: Why would this method be required? The answer is if the
+ /// user decides to use lazy initialization of CORBA object, then
+ /// this is the route that we have to take to do the
+ /// initialization.
+ CORBA::Long initialize_object (TAO_Stub *the_stub,
+ CORBA::Object_ptr obj);
+
+ /// Reinitialise a stub after the effective profile has changed.
+ /// This will happen after a location forward has been received
+ /// or if a location forward supplied new target subsequently fails.
+ CORBA::Long reinitialize_object (TAO_Stub *stub);
+
+ /// Return ORBid string.
+ const char *orbid (void) const;
+
+ /// Set/Get the IOR of the Implementation Repository service.
+ //@{
+ CORBA::Object_ptr implrepo_service (void);
+ void implrepo_service (const CORBA::Object_ptr ir);
+ //@}
+
+ /// Do we attempt to register with the Implementation Repository
+ CORBA::Boolean use_implrepo (void);
+
+ /// Do we put the ImR's endpoints into persistent object references we create
+ CORBA::Boolean imr_endpoints_in_ior (void);
+
+ /// Resolve the TypeCodeFactory DLL.
+ CORBA::Object_ptr resolve_typecodefactory (ACE_ENV_SINGLE_ARG_DECL);
+
+#if TAO_HAS_INTERCEPTORS == 1
+ /// Resolve the PICurrent.
+ CORBA::Object_ptr resolve_picurrent (ACE_ENV_SINGLE_ARG_DECL);
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+
+ /// Resolve POA Current.
+ CORBA::Object_ptr resolve_poa_current (ACE_ENV_SINGLE_ARG_DECL);
+
+ /// Resolve the CodecFactory DLL.
+ CORBA::Object_ptr resolve_codecfactory (ACE_ENV_SINGLE_ARG_DECL);
+
+ /// Resolve the Dynamic Any Factory
+ CORBA::Object_ptr resolve_dynanyfactory (ACE_ENV_SINGLE_ARG_DECL);
+
+ /// Resolve the IOR Manipulation reference for this ORB.
+ CORBA::Object_ptr resolve_ior_manipulation (ACE_ENV_SINGLE_ARG_DECL);
+
+ /// Resolve the IOR Table reference for this ORB.
+ CORBA::Object_ptr resolve_ior_table (ACE_ENV_SINGLE_ARG_DECL);
+
+ /// Resolve an initial reference via the -ORBInitRef and
+ // -ORBDefaultInitRef options.
+ CORBA::Object_ptr resolve_rir (const char *name
+ ACE_ENV_ARG_DECL);
+
+ /// Resolve the RT ORB reference for this ORB.
+ CORBA::Object_ptr resolve_rt_orb (void);
+
+ /// Resolve the RT Current flyweight for this ORB.
+ /// Return server_id string.
+ const char *server_id (void) const;
+
+ /// List all the service known by the ORB
+ CORBA::ORB_ObjectIdList *list_initial_references (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED
+ );
+
+ /// Reference counting...
+ unsigned long _incr_refcnt (void);
+ unsigned long _decr_refcnt (void);
+
+ /// Register the handle of an open connection with the ORB Core
+ /// handle set. This handle set will be used to explicitly remove
+ /// corresponding event handlers from the reactor.
+ int register_handle (ACE_HANDLE handle);
+
+ /// Remove <handle> from the ORB Core's handle set so that it
+ /// isn't included in the set that is passed to the reactor upon ORB
+ /// destruction.
+ int remove_handle (ACE_HANDLE handle);
+
+ /**
+ * @name ORB Core Service Hooks
+ *
+ * These methods would represent the hooks in the ORB Core. These
+ * hooks would be used to call back on the services or other
+ * features that are dynamically loaded.
+ */
+ //@{
+ /**
+ * The loaded service in the ORB_Core would determine if the profile
+ * selection is going to be made by the services or not. If the
+ * services do make the selection they would return the selected
+ * profile through <profile>.
+ */
+ CORBA::Boolean service_profile_selection (TAO_MProfile &mprofile,
+ TAO_Profile *&profile);
+
+ /**
+ * The loaded service in the ORB_Core would determine if the profile
+ * reselection is going to be made by the services or not. If the
+ * services do make the reselection they would return the selected
+ * profile through <profile>. The reselction is for the
+ * multi-profile IORS.
+ */
+ CORBA::Boolean service_profile_reselection (TAO_Stub *stub,
+ TAO_Profile *&profile);
+
+ /// Reset the flags in the loaded services.
+ void reset_service_profile_flags (void);
+
+ /**
+ * The loaded service would determine if the CORBA::Object_ptr is
+ * actually nil or not. This would be useful to accomodate new
+ * enhanced definitions as defined by the service specification.
+ */
+ CORBA::Boolean object_is_nil (CORBA::Object_ptr object);
+
+ /// Hook for the services to determine whether the profiles are
+ /// equivalent or not.
+ /**
+ * For details on how this is used please see the FT service
+ */
+ TAO_Service_Callbacks::Profile_Equivalence is_profile_equivalent (
+ const TAO_Profile *this_p,
+ const TAO_Profile *that_p);
+
+ /// Hook for the services to determine the <hash> value of a
+ /// profile.
+ /**
+ * For details on how this is used please see the FT service
+ */
+ CORBA::ULong hash_service (TAO_Profile *this_p,
+ CORBA::ULong max);
+
+ /// Call the service layers with the Service Context to check
+ /// whether they would like to add something to the list.
+ void service_context_list (TAO_Stub *stub,
+ TAO_Service_Context &service_context,
+ CORBA::Boolean retstart
+ ACE_ENV_ARG_DECL);
+
+ /// Return a reference to the Fault Tolerant service object.
+ TAO_Fault_Tolerance_Service &fault_tolerance_service (void);
+
+ /// Raise a comm failure exception if a service is not loaded, else
+ /// delegate to the service to see what the service has to do for
+ /// this case.
+ TAO::Invocation_Status service_raise_comm_failure (
+ IOP::ServiceContextList &clist,
+ TAO_Profile *profile
+ ACE_ENV_ARG_DECL);
+
+ /// Raise a transient failure exception if a service is not loaded,
+ /// else delegate to the service to see what the service has to do
+ /// for this case.
+ TAO::Invocation_Status service_raise_transient_failure (
+ IOP::ServiceContextList &clist,
+ TAO_Profile *profile
+ ACE_ENV_ARG_DECL);
+
+ //@}
+
+ /**
+ * @name Portable Interceptor Related Methods
+ *
+ * These are support methods for interceptor registration and
+ * interceptor set (an array) access, in addition to PICurrent
+ * access.
+ */
+ //@{
+#if TAO_HAS_INTERCEPTORS == 1
+
+ /// Return a pointer to the cached TAO::PICurrent object.
+ CORBA::Object_ptr pi_current (void);
+
+ /// Set the pointer to the cached TAO::PICurrent object.
+ void pi_current (CORBA::Object_ptr current);
+
+ /// Register a client request interceptor.
+ void add_interceptor (
+ PortableInterceptor::ClientRequestInterceptor_ptr interceptor
+ ACE_ENV_ARG_DECL);
+
+ /// Register a server request interceptor.
+ void add_interceptor (
+ PortableInterceptor::ServerRequestInterceptor_ptr interceptor
+ ACE_ENV_ARG_DECL);
+
+ /// Register a client request interceptor with policies.
+ void add_interceptor (
+ PortableInterceptor::ClientRequestInterceptor_ptr interceptor,
+ const CORBA::PolicyList& policies
+ ACE_ENV_ARG_DECL);
+
+ /// Register a server request interceptor with policies.
+ void add_interceptor (
+ PortableInterceptor::ServerRequestInterceptor_ptr interceptor,
+ const CORBA::PolicyList& policies
+ ACE_ENV_ARG_DECL);
+
+ /// Get the Client Request Interceptor adapter.
+ /// Will not create a new one if not available yet.
+ TAO::ClientRequestInterceptor_Adapter *clientrequestinterceptor_adapter (void);
+
+ /// Get the Server Request Interceptor adapter.
+ /// Will not create a new one if not available yet.
+ TAO::ServerRequestInterceptor_Adapter *serverrequestinterceptor_adapter (void);
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+ /// Register an IOR interceptor.
+ void add_interceptor (
+ PortableInterceptor::IORInterceptor_ptr interceptor
+ ACE_ENV_ARG_DECL);
+ //@}
+
+ /// Return the valuetype adapter
+ TAO_Valuetype_Adapter *valuetype_adapter (void);
+
+ /// Get the IOR Interceptor adapter. If not created, this method will try
+ /// to create one.
+ TAO_IORInterceptor_Adapter *ior_interceptor_adapter (void);
+
+ /// Set and Get methods to indicate whether a BiDir IIOP policy has
+ /// been set in the POA.
+ /// @note At present, the value will be true even if one of the POA's
+ /// is set with the Bi Dir GIOP policy.
+ CORBA::Boolean bidir_giop_policy (void);
+ void bidir_giop_policy (CORBA::Boolean);
+
+ /// Return the table that maps object key/name to de-stringified
+ /// object reference. It is needed for supporting local objects in
+ /// the resolve_initial_references() mechanism.
+ TAO_Object_Ref_Table &object_ref_table (void);
+
+ /// Acceessor to the table that stores the object_keys.
+ TAO::ObjectKey_Table &object_key_table (void);
+
+ /// Return the current request dispatcher strategy.
+ TAO_Request_Dispatcher *request_dispatcher (void);
+
+ /// Set a new request dispatcher. The ORB Core retains ownership
+ /// of the request dispatcher once it gets it. Currently, this only
+ /// gets called at initialization.
+ void request_dispatcher (TAO_Request_Dispatcher *rd);
+
+ /// Call the libraries to handover the validators if they havent
+ /// registered yet with the list of validators.
+ void load_policy_validators (TAO_Policy_Validator &validator
+ ACE_ENV_ARG_DECL);
+
+ /// Return the flushing strategy
+ /**
+ * The flushing strategy is created by the resource factory, and it
+ * is used by the ORB to control the mechanism used to flush the
+ * outgoing data queues.
+ * The flushing strategies are stateless, therefore, there is only
+ * one per ORB.
+ */
+ TAO_Flushing_Strategy *flushing_strategy (void);
+
+ /// Get Code Set Manager
+ TAO_Codeset_Manager *codeset_manager (void);
+
+ typedef ACE_Array_Map<ACE_CString, ACE_CString> InitRefMap;
+
+ /// Return a pointer to the -ORBInitRef map.
+ InitRefMap * init_ref_map (void);
+
+ /// Set the ORB related to the orb_id as the default ORB and not the
+ /// ORB that is first binded in the ORB Table
+ void set_default (const char * orb_id);
+
+ /// Choose to be not a default ORB when there is more than one ORB.
+ void not_default (const char * orb_id);
+
+ /// This strategy is the default, no explicit queueing and no explicit
+ /// flush
+ TAO::Transport_Queueing_Strategy &default_transport_queueing_strategy (void);
+
+ /// Verify condition for permanent forward is given,
+ /// both parameters must provide group attributes.
+ CORBA::Boolean is_permanent_forward_condition
+ (const CORBA::Object_ptr obj,
+ const TAO_Service_Context &service_context);
+
+ /// Configuration accessor method
+ ACE_Service_Gestalt* configuration () const;
+
+ /// Get outgoing fragmentation strategy.
+ auto_ptr<TAO_GIOP_Fragmentation_Strategy>
+ fragmentation_strategy (TAO_Transport * transport);
+
+protected:
+
+ /// Destructor is protected since the ORB Core is a reference
+ /// counted object.
+ ~TAO_ORB_Core (void);
+
+ /// Initialize the guts of the ORB Core. It is intended that this be
+ /// called by <CORBA::ORB_init>.
+ int init (int &argc, char **argv ACE_ENV_ARG_DECL);
+
+ /// Final termination hook, typically called by CORBA::ORB's
+ /// destructor.
+ int fini (void);
+
+ /// Routine that creates a ACE_Data_Block given the lock and allocators.
+ ACE_Data_Block *create_data_block_i (size_t size,
+ ACE_Allocator *buffer_allocator,
+ ACE_Allocator *dblock_allocator,
+ ACE_Lock *lock);
+
+ /// Obtain and cache the typecode factory object reference.
+ void resolve_typecodefactory_i (ACE_ENV_SINGLE_ARG_DECL);
+
+ /// Obtain and cache the poa current.
+ void resolve_poa_current_i (ACE_ENV_SINGLE_ARG_DECL);
+
+#if TAO_HAS_INTERCEPTORS == 1
+ /// Obtain and cache the picurrent factory object reference.
+ void resolve_picurrent_i (ACE_ENV_SINGLE_ARG_DECL);
+
+ /// Get the Client Request Interceptor adapter.
+ /// If not created, this method will try to create one if needed.
+ TAO::ClientRequestInterceptor_Adapter *clientrequestinterceptor_adapter_i (void);
+
+ /// Get the Server Request Interceptor adapter.
+ /// If not created, this method will try to create one if needed.
+ TAO::ServerRequestInterceptor_Adapter *serverrequestinterceptor_adapter_i (void);
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+ /// Obtain and cache the codec factory object reference.
+ void resolve_codecfactory_i (ACE_ENV_SINGLE_ARG_DECL);
+
+ /// Obtain and cache the dynamic any factory object reference.
+ void resolve_dynanyfactory_i (ACE_ENV_SINGLE_ARG_DECL);
+
+ /// Obtain and cache the IORManipulation factory object reference.
+ void resolve_iormanipulation_i (ACE_ENV_SINGLE_ARG_DECL);
+
+ /// Search the Dynamic service list for well known services that has
+ /// callbacks which can be dynamically loaded.
+ void services_callbacks_init (void);
+
+ /// Helper method that invokes Interceptor::destroy() on all
+ /// registered interceptors when ORB::destroy() is called. Prevents
+ /// exceptions from propagating up the call chain.
+ void destroy_interceptors (ACE_ENV_SINGLE_ARG_DECL);
+
+ /// Pointer to the list of protocol loaded into this ORB instance.
+ /// Helper method to hold the common code part for -ORBEndpoint and
+ /// -ORBListenEndpoint options.
+ int set_endpoint_helper (const ACE_CString &lane,
+ const ACE_CString &endpoints
+ ACE_ENV_ARG_DECL);
+
+ /// Return pointer to the policy factory registry associated with
+ /// this ORB core.
+ TAO::PolicyFactory_Registry_Adapter *policy_factory_registry_i (void);
+
+ /// Return pointer to the orb initializer registry associated with
+ /// this ORB core.
+ TAO::ORBInitializer_Registry_Adapter *orbinitializer_registry_i (void);
+
+ /// Common code from ::initialize_object and ::reinitialize_object
+ CORBA::Long initialize_object_i (TAO_Stub *the_stub,
+ const TAO_MProfile& mprofile);
+
+private:
+
+ /// The ORB Core should not be copied.
+ //@{
+ TAO_ORB_Core(const TAO_ORB_Core&);
+ void operator=(const TAO_ORB_Core&);
+ //@}
+
+ /// Obtain and cache the dynamic any factory object reference.
+ void resolve_ior_table_i (ACE_ENV_SINGLE_ARG_DECL);
+
+ /// Checks to see whether collocation optimizations have to be
+ /// applied on objects in the @a other_orb
+ CORBA::Boolean is_collocation_enabled (TAO_ORB_Core *other_orb,
+ const TAO_MProfile &mp);
+
+#if (TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1)
+
+ /// This strategy will buffer messages.
+ //@{
+ TAO::Transport_Queueing_Strategy &eager_transport_queueing_strategy (void);
+ TAO::Transport_Queueing_Strategy &delayed_transport_queueing_strategy (void);
+ TAO::Transport_Queueing_Strategy &flush_transport_queueing_strategy (void);
+ //@}
+
+#endif /* TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1 */
+
+ bool use_local_memory_pool_;
+
+protected:
+
+ /// Synchronize internal state...
+ TAO_SYNCH_MUTEX lock_;
+
+ TAO_Thread_Lane_Resources_Manager *thread_lane_resources_manager_;
+
+ TAO_Collocation_Resolver *collocation_resolver_;
+
+ TAO_Stub_Factory *stub_factory_;
+
+ TAO_ProtocolFactorySet *protocol_factories_;
+
+ /// The cached IOR for the Implementation Repository.
+ // @@ If this is a _var, where should it get deleted? (brunsch)
+ CORBA::Object_ptr implrepo_service_;
+
+ /// Flag for whether the implrepo support is enabled or not.
+ int use_implrepo_;
+
+ /// Flag for whether to put the ImR endpoints into our object refs.
+ int imr_endpoints_in_ior_;
+
+ /// The cached IOR for the TypeCodeFactory DLL.
+ CORBA::Object_ptr typecode_factory_;
+
+ /// The cached IOR for the CodecFactory DLL.
+ CORBA::Object_ptr codec_factory_;
+
+ /// The cached object reference for the DynAnyFactory.
+ CORBA::Object_ptr dynany_factory_;
+
+ /// The cached object reference for the IORManipulataion.
+ CORBA::Object_ptr ior_manip_factory_;
+
+ /// The cached object reference for the IORTable.
+ CORBA::Object_ptr ior_table_;
+
+ /// The cached object reference for the RTCORBA::RTORB.
+ CORBA::Object_var rt_orb_;
+
+ /// The cached object reference for the RTCORBA::Current interface.
+ CORBA::Object_var rt_current_;
+
+ /**
+ * @note
+ * Should we keep a single ORB pointer? This is good because
+ * multiple calls to ORB_init() with the same ORBid can use the same
+ * object, but maybe don't want so much coupling.
+ *
+ * Pointer to the ORB.
+ */
+ CORBA::ORB_ptr orb_;
+
+ /// Object reference to the root POA. It will eventually be the
+ /// object reference returned by calls to
+ /// CORBA::ORB::resolve_initial_references ("RootPOA").
+ CORBA::Object_var root_poa_;
+
+ /// Parameters used by the ORB.
+ TAO_ORB_Parameters orb_params_;
+
+ /// Return InitRefMap to find if a particular object id is present.
+ InitRefMap init_ref_map_;
+
+ /// Table that maps object key/name to (de-stringified) object
+ /// reference. It is needed for supporting local objects in the
+ /// resolve_initial_references() mechanism.
+ TAO_Object_Ref_Table object_ref_table_;
+
+ /// Table that stores the object key instead of caching one per-profile.
+ TAO::ObjectKey_Table object_key_table_;
+
+ /// The ORBid for this ORB.
+ char *orbid_;
+
+ /// Handle to the factory for resource information..
+ TAO_Resource_Factory *resource_factory_;
+
+ /// The server_id_ that was passed via -ORBServerId option
+ ACE_CString server_id_;
+
+ /// Handle to the factory for Client-side strategies.
+ TAO_Client_Strategy_Factory *client_factory_;
+
+ /// Handle to the factory for Server-side strategies.
+ TAO_Server_Strategy_Factory *server_factory_;
+
+ /**
+ * @name Service Level Hooks
+ */
+ //@{
+
+ /// Fault Tolerant service hook.
+ TAO_Fault_Tolerance_Service ft_service_;
+
+ //@}
+
+ /// TRUE if we want to take advantage of collocation optimization in
+ /// this ORB.
+ CORBA::Boolean opt_for_collocation_;
+
+ /// TRUE if we want to consider all ORBs in this address space
+ /// collocated.
+ CORBA::Boolean use_global_collocation_;
+
+ /// Default collocation policy. This should never be ORB_CONTROL.
+ CORBA::ULong collocation_strategy_;
+
+
+#if (TAO_HAS_CORBA_MESSAGING == 1)
+
+ /// The Policy_Manager for this ORB.
+ TAO_Policy_Manager *policy_manager_;
+
+ /// The default policies.
+ TAO_Policy_Set *default_policies_;
+
+ /// Policy current.
+ TAO_Policy_Current *policy_current_;
+
+#endif /* TAO_HAS_CORBA_MESSAGING == 1 */
+
+ /// The request dispatching strategy.
+ TAO_Request_Dispatcher *request_dispatcher_;
+
+ /**
+ * POA current.
+ */
+ CORBA::Object_var poa_current_;
+
+ /// The list of Adapters used in this ORB.
+ TAO_Adapter_Registry adapter_registry_;
+
+ /// An optimization for the POA.
+ TAO_Adapter *poa_adapter_;
+
+ /// The Thread Manager
+ ACE_Thread_Manager tm_;
+
+ /// The data block reference counts are locked using this mutex
+ ACE_Lock_Adapter<TAO_SYNCH_MUTEX> data_block_lock_;
+
+ /// TSS Object cleanup functions. These correspond to the TSS
+ /// objects stored in TAO's TSS resources.
+ TAO_Cleanup_Func_Registry tss_cleanup_funcs_;
+
+ /// This is where the tss resources for this ORB are stored.
+ ACE_TSS_TYPE (TAO_ORB_Core_TSS_Resources) tss_resources_;
+
+ /// Flag which denotes that the ORB has been shutdown.
+ int has_shutdown_;
+
+ /// The value of the timeout if the flag above is not zero.
+ //@{
+ int thread_per_connection_use_timeout_;
+ ACE_Time_Value thread_per_connection_timeout_;
+ //@}
+
+ /// Mutual exclusion for calling open.
+ TAO_SYNCH_MUTEX open_lock_;
+
+ /// Flag which denotes that the open method was called.
+ int open_called_;
+
+ TAO_Endpoint_Selector_Factory *endpoint_selector_factory_;
+
+#if (TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1)
+
+ /// This strategy will buffer messages.
+ TAO::Transport_Queueing_Strategy *eager_transport_queueing_strategy_;
+
+ /// This strategy will buffer messages.
+ TAO::Transport_Queueing_Strategy *delayed_transport_queueing_strategy_;
+
+ /// This strategy will not queue by default, but will flush the queue
+ /// each time
+ TAO::Transport_Queueing_Strategy *flush_transport_queueing_strategy_;
+
+#endif /* TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1 */
+
+ /// This strategy will not queue by default and not flush
+ TAO::Transport_Queueing_Strategy *default_transport_queueing_strategy_;
+
+ /// Number of outstanding references to this object.
+ ACE_Atomic_Op<TAO_SYNCH_MUTEX, unsigned long> refcount_;
+
+ /// Registry containing all registered policy factories.
+ TAO::PolicyFactory_Registry_Adapter *policy_factory_registry_;
+
+ /// Registry containing all orb initializers
+ TAO::ORBInitializer_Registry_Adapter *orbinitializer_registry_;
+
+#if (TAO_HAS_INTERCEPTORS == 1)
+ /// Cached pointer/reference to the PICurrent object.
+ /**
+ * A pointer/reference to the PICurrent object is cached in the ORB
+ * Core since it is accessed in the critical path (i.e. the request
+ * invocation path). Caching it prevents additional overhead to due
+ * object resolution from occurring.
+ */
+ CORBA::Object_ptr pi_current_;
+
+ /// The adapter for handling client request interceptors
+ TAO::ClientRequestInterceptor_Adapter *client_request_interceptor_adapter_;
+
+ /// The adapter for handling server request interceptors
+ TAO::ServerRequestInterceptor_Adapter *server_request_interceptor_adapter_;
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+ /// IORInterceptor adapter.
+ TAO_IORInterceptor_Adapter *ior_interceptor_adapter_;
+
+ /// Pointer to the valuetype adapter.
+ TAO_Valuetype_Adapter *valuetype_adapter_;
+
+ /// The IOR parser registry.
+ TAO_Parser_Registry parser_registry_;
+
+ /// BiDirectional GIOP factory
+ TAO_BiDir_Adapter *bidir_adapter_;
+
+ /// Bir Dir GIOP policy value
+ CORBA::Boolean bidir_giop_policy_;
+
+ /// Hold the flushing strategy
+ TAO_Flushing_Strategy *flushing_strategy_;
+
+ /// Code Set Manager - points to service object in the service repo
+ TAO_Codeset_Manager *codeset_manager_;
+
+ /// ORB's service configuration
+ ACE_Service_Gestalt *config_;
+};
+
+// ****************************************************************
+
+/**
+ * @class TAO_ORB_Core_Static_Resources
+ *
+ * @brief The static (global) resoures of all ORB cores.
+ *
+ * This class is used by the ORB_Core to store the resources global to
+ * all ORB_Cores. All instance variables that would have been
+ * declared "static" in TAO_ORB_Core, should be declared in this class
+ * to avoid the "static initialization order fiasco" as described in
+ * http://www.parashift.com/c++-faq-lite/ctors.html#faq-10.11.
+ * Briefly, this is the problem that occurs if any static initializers
+ * in any other code call into set static members of TAO_ORB_Core.
+ * Since the order in which these initializers execute is unspecified,
+ * uninitialized members can be accessed.
+ */
+class TAO_Export TAO_ORB_Core_Static_Resources : public ACE_Service_Object
+{
+public:
+
+ /// Return the context-specific singleton instance.
+ static TAO_ORB_Core_Static_Resources* instance (void);
+
+public:
+ // The hook to be set for the SyncScopePolicy
+ TAO_ORB_Core::Sync_Scope_Hook sync_scope_hook_;
+
+ /**
+ * Name of the protocols_hooks that needs to be instantiated.
+ * The default value is "Protocols_Hooks". If RTCORBA option is
+ * set, its value will be set to be "RT_Protocols_Hooks".
+ */
+ ACE_CString protocols_hooks_name_;
+
+ /// The hook to be set for the RelativeRoundtripTimeoutPolicy.
+ TAO_ORB_Core::Timeout_Hook timeout_hook_;
+
+ /// The hook to be set for the ConnectionTimeoutPolicy
+ TAO_ORB_Core::Timeout_Hook connection_timeout_hook_;
+
+ /**
+ * Name of the endpoint selector factory that needs to be instantiated.
+ * The default value is "Default_Endpoint_Selector_Factory". If
+ * TAO_RTCORBA is linked, the set_endpoint_selector_factory will be
+ * called to set the value to be "RT_Endpoint_Selector_Factory".
+ */
+ ACE_CString endpoint_selector_factory_name_;
+
+ /**
+ * Name of the thread lane resources manager that needs to be
+ * instantiated. The default value is
+ * "Default_Thread_Lane_Resources_Manager_Factory". If TAO_RTCORBA
+ * is linked, the set_thread_lane_resources_manager will be called
+ * to set the value to be
+ * "RT_Thread_Lane_Resources_Manager_Factory".
+ */
+ ACE_CString thread_lane_resources_manager_factory_name_;
+
+ /**
+ * Name of the collocation resolver that needs to be instantiated.
+ * The default value is "Default_Collocation_Resolver". If
+ * TAO_RTCORBA is linked, the set_collocation_resolver will be
+ * called to set the value to be "RT_Collocation_Resolver".
+ */
+ ACE_CString collocation_resolver_name_;
+
+ /**
+ * Name of the stub factory that needs to be instantiated.
+ * The default value is "Default_Stub_Factory". If TAO_RTCORBA is
+ * linked, the set_stub_factory will be called to set the value
+ * to be "RT_Stub_Factory".
+ */
+ ACE_CString stub_factory_name_;
+
+ /**
+ * Name of the resource factory that needs to be instantiated.
+ * The default value is "Resource_Factory". If TAO_Strategies is
+ * linked, the set_resource_factory will be called to set the value
+ * to be "Advanced_Resource_Factory".
+ */
+ ACE_CString resource_factory_name_;
+
+ /**
+ * Name of the service object for DII request creation that needs
+ * to be instantiated. The default value is "Dynamic_Adaper". If
+ * TAO_DynamicInterface is linked, dynamic_adapter_name() will be
+ * called to set the value to "Concrete_Dynamic_Adapter".
+ */
+ ACE_CString dynamic_adapter_name_;
+
+ /**
+ * Name of the service object for functions that make calls on
+ * the Interface Repository. The default value is "IFR_Client_Adaper".
+ * If TAO_IFR_CLient is linked, ifr_client_adapter_name() will be
+ * called to set the value to "Concrete_IFR_Client_Adapter".
+ */
+ ACE_CString ifr_client_adapter_name_;
+
+ /**
+ * Name of the service object used by the ORB create_*_tc functions.
+ * The default value is "TypeCodeFactory_Adapter". If the
+ * TypeCodeFactory library is linked, the corresponding accessor
+ * function typecodefactory_adapter_name() will be called to set
+ * the value to "Concrete_TypeCodeFactory_Adapter".
+ */
+ ACE_CString typecodefactory_adapter_name_;
+
+ /**
+ * Name of the factory object used to adapt function calls on
+ * the PortableInterceptor interfaces IORInfo and IORInterceptor.
+ * The default value is "IORInterceptor_Adapter_Factory". If the
+ * IORInterceptor library is linked, the corresponding accessor
+ * function iorinterceptor_adapter_factory_name() will be called to set
+ * the value to "Concrete_IORInterceptor_Adapter_Factory".
+ */
+ ACE_CString iorinterceptor_adapter_factory_name_;
+
+ /**
+ * Name of the factory object used to adapt function calls on
+ * the valuetype-related interfaces.
+ * The default value is "Valuetype_Adapter_Factory". If the
+ * Valuetype library is linked, the corresponding accessor
+ * function valuetype_adapter_factory_name() will be called to set
+ * the value to "Concrete_Valuetype_Adapter_Factory".
+ */
+ ACE_CString valuetype_adapter_factory_name_;
+
+ /**
+ * Name of the service object used to create the RootPOA. The
+ * default value is "TAO_POA". If TAO_RTCORBA is loaded, this
+ * will be changed to TAO_RT_POA so that a POA equipped with
+ * realtime extensions will be returned.
+ */
+ ACE_CString poa_factory_name_;
+
+ /**
+ * The service configurator directive used to load
+ * poa_factory_name_ dynamically.
+ */
+ ACE_CString poa_factory_directive_;
+
+ /// An alternative hook to be set for the ConnectionTimeoutPolicy
+ TAO_ORB_Core::Timeout_Hook alt_connection_timeout_hook_;
+
+ //private:
+
+ /// Constructor.
+ TAO_ORB_Core_Static_Resources (void);
+ TAO_ORB_Core_Static_Resources& operator=
+ (const TAO_ORB_Core_Static_Resources&);
+
+private:
+
+ /// The singleton instance.
+// static TAO_ORB_Core_Static_Resources* instance_;
+
+ /// Mostly unused variable whose sole purpose is to enforce
+ /// the instantiation of a TAO_ORB_Core_Static_Resources instance
+ /// at initialization time.
+ static TAO_ORB_Core_Static_Resources* initialization_reference_;
+};
+
+// ****************************************************************
+
+/// Obtain an instance of the first ORB core registered in the ORB
+/// table.
+TAO_Export TAO_ORB_Core * TAO_ORB_Core_instance (void);
+
+// ****************************************************************
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE_EXPORT (TAO, TAO_ORB_Core_Static_Resources)
+ACE_FACTORY_DECLARE (TAO, TAO_ORB_Core_Static_Resources)
+
+#if defined (__ACE_INLINE__)
+# include "tao/ORB_Core.i"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_ORB_CORE_H */
diff --git a/TAO/tao/ORB_Core.i b/TAO/tao/ORB_Core.i
new file mode 100644
index 00000000000..ca3defce178
--- /dev/null
+++ b/TAO/tao/ORB_Core.i
@@ -0,0 +1,648 @@
+// -*- C++ -*-
+//
+// $Id$
+
+#include "tao/ORB_Core_TSS_Resources.h"
+#include "tao/ORB_Table.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE ACE_Service_Gestalt*
+TAO_ORB_Core::configuration (void) const
+{
+ return this->config_;
+}
+
+ACE_INLINE unsigned long
+TAO_ORB_Core::_incr_refcnt (void)
+{
+ return this->refcount_++;
+}
+
+ACE_INLINE unsigned long
+TAO_ORB_Core::_decr_refcnt (void)
+{
+ unsigned long count = --this->refcount_;
+ if (count != 0)
+ return count;
+
+ this->fini ();
+ return 0;
+}
+
+ACE_INLINE ACE_Lock *
+TAO_ORB_Core::locking_strategy (void)
+{
+ if (this->resource_factory ()->use_locked_data_blocks ())
+ return &this->data_block_lock_;
+
+ return 0;
+}
+
+ACE_INLINE CORBA::Boolean
+TAO_ORB_Core::bidir_giop_policy (void)
+{
+ return this->bidir_giop_policy_;
+}
+
+ACE_INLINE void
+TAO_ORB_Core::bidir_giop_policy (CORBA::Boolean val)
+{
+ this->bidir_giop_policy_ = val;
+}
+
+ACE_INLINE TAO_Object_Ref_Table &
+TAO_ORB_Core::object_ref_table (void)
+{
+ return this->object_ref_table_;
+}
+
+ACE_INLINE TAO::ObjectKey_Table &
+TAO_ORB_Core::object_key_table (void)
+{
+ return this->object_key_table_;
+}
+
+ACE_INLINE TAO_Flushing_Strategy *
+TAO_ORB_Core::flushing_strategy (void)
+{
+ return this->flushing_strategy_;
+}
+
+ACE_INLINE TAO_Protocols_Hooks *
+TAO_ORB_Core::get_protocols_hooks (void)
+{
+ return this->protocols_hooks_;
+}
+
+ACE_INLINE CORBA::Boolean
+TAO_ORB_Core::service_profile_selection (TAO_MProfile &mprofile,
+ TAO_Profile *&profile)
+{
+ CORBA::Boolean retval = 0;
+ // @@ If different services have the same feature we may want to
+ // prioritise them here. We need to decide here whose selection of
+ // profile is more important.
+ if (this->ft_service_.service_callback ())
+ {
+ retval =
+ this->ft_service_.service_callback ()->select_profile (&mprofile,
+ profile);
+ }
+ return retval;
+}
+
+ACE_INLINE CORBA::Boolean
+TAO_ORB_Core::service_profile_reselection (TAO_Stub *stub,
+ TAO_Profile *&profile)
+{
+ CORBA::Boolean retval = 0;
+ // @@ If different services have the same feature we may want to
+ // prioritise them here. We need to decide here whose selection of
+ // profile is more important.
+ if (this->ft_service_.service_callback ())
+ {
+ retval =
+ this->ft_service_.service_callback ()->reselect_profile (stub,
+ profile);
+ }
+ return retval;
+}
+
+ACE_INLINE void
+TAO_ORB_Core::reset_service_profile_flags (void)
+{
+ // @@ If different services have the same feature we may want to
+ // prioritise them here. We need to decide here whose selection of
+ // profile is more important.
+
+ if (this->ft_service_.service_callback ())
+ {
+ this->ft_service_.service_callback ()->reset_profile_flags ();
+ }
+ return;
+}
+
+
+ACE_INLINE CORBA::Boolean
+TAO_ORB_Core::object_is_nil (CORBA::Object_ptr obj)
+{
+ CORBA::Boolean retval = 0;
+ if (this->ft_service_.service_callback ())
+ {
+ retval =
+ this->ft_service_.service_callback ()->object_is_nil (obj);
+ }
+ return retval;
+}
+
+
+ACE_INLINE TAO_Service_Callbacks::Profile_Equivalence
+TAO_ORB_Core::is_profile_equivalent (const TAO_Profile *this_p,
+ const TAO_Profile *that_p)
+{
+ TAO_Service_Callbacks::Profile_Equivalence retval
+ = TAO_Service_Callbacks::DONT_KNOW;
+
+ if (this->ft_service_.service_callback ())
+ {
+ retval =
+ this->ft_service_.service_callback ()->is_profile_equivalent (this_p,
+ that_p);
+ }
+
+ return retval;
+}
+
+ACE_INLINE CORBA::ULong
+TAO_ORB_Core::hash_service (TAO_Profile *p,
+ CORBA::ULong m)
+{
+ if (this->ft_service_.service_callback ())
+ {
+ return this->ft_service_.service_callback ()->hash_ft (p, m);
+ }
+
+ return 0;
+}
+
+ACE_INLINE TAO_Fault_Tolerance_Service &
+TAO_ORB_Core::fault_tolerance_service (void)
+{
+ return this->ft_service_;
+}
+
+ACE_INLINE ACE_Thread_Manager *
+TAO_ORB_Core::thr_mgr (void)
+{
+ return &this->tm_;
+}
+
+ACE_INLINE CORBA::ORB_ptr
+TAO_ORB_Core::orb (void)
+{
+ return this->orb_;
+}
+
+ACE_INLINE TAO_Adapter_Registry *
+TAO_ORB_Core::adapter_registry (void)
+{
+ return &this->adapter_registry_;
+}
+
+ACE_INLINE TAO_Request_Dispatcher *
+TAO_ORB_Core::request_dispatcher (void)
+{
+ return this->request_dispatcher_;
+}
+
+ACE_INLINE TAO_ORB_Core::InitRefMap *
+TAO_ORB_Core::init_ref_map (void)
+{
+ return &this->init_ref_map_;
+}
+
+ACE_INLINE void
+TAO_ORB_Core::set_default (const char * orb_id)
+{
+ TAO::ORB_Table * const table = TAO::ORB_Table::instance ();
+ table->set_default (orb_id);
+}
+
+ACE_INLINE void
+TAO_ORB_Core::not_default (const char * orb_id)
+{
+ TAO::ORB_Table * const table = TAO::ORB_Table::instance ();
+ table->not_default (orb_id);
+}
+
+ACE_INLINE void
+TAO_ORB_Core::optimize_collocation_objects (CORBA::Boolean opt)
+{
+ this->opt_for_collocation_ = opt;
+}
+
+ACE_INLINE CORBA::Boolean
+TAO_ORB_Core::optimize_collocation_objects (void) const
+{
+ return this->opt_for_collocation_;
+}
+
+ACE_INLINE void
+TAO_ORB_Core::use_global_collocation (CORBA::Boolean opt)
+{
+ this->use_global_collocation_ = opt;
+}
+
+ACE_INLINE CORBA::Boolean
+TAO_ORB_Core::use_global_collocation (void) const
+{
+ return this->use_global_collocation_;
+}
+
+ACE_INLINE CORBA::ULong
+TAO_ORB_Core::get_collocation_strategy (void) const
+{
+ return this->collocation_strategy_;
+}
+
+ACE_INLINE TAO_ORB_Parameters *
+TAO_ORB_Core::orb_params(void)
+{
+ return &(this->orb_params_);
+}
+
+#define TAO_OC_RETRIEVE(member) \
+((this->member##_ == 0) \
+ ? (this->member##_ = this->resource_factory ()->get_##member ()) \
+ : (this->member##_))
+
+ACE_INLINE TAO_ProtocolFactorySet *
+TAO_ORB_Core::protocol_factories (void)
+{
+ return TAO_OC_RETRIEVE (protocol_factories);
+}
+
+ACE_INLINE TAO_Parser_Registry *
+TAO_ORB_Core::parser_registry (void)
+{
+ return &this->parser_registry_;
+}
+
+#undef TAO_OC_RETRIEVE
+
+#if (TAO_HAS_CORBA_MESSAGING == 1)
+
+ACE_INLINE TAO_Policy_Manager *
+TAO_ORB_Core::policy_manager (void)
+{
+ return this->policy_manager_;
+}
+
+#endif /* TAO_HAS_CORBA_MESSAGING == 1 */
+
+ACE_INLINE TAO_ORB_Core_TSS_Resources*
+TAO_ORB_Core::get_tss_resources (void)
+{
+ return ACE_TSS_GET (&this->tss_resources_,TAO_ORB_Core_TSS_Resources);
+}
+
+ACE_INLINE void *
+TAO_ORB_Core::get_tss_resource (size_t slot_id)
+{
+ TAO_ORB_Core_TSS_Resources *tss_resources =
+ this->get_tss_resources ();
+
+ if (slot_id >= tss_resources->ts_objects_.size ())
+ return 0;
+
+ return tss_resources->ts_objects_[slot_id];
+}
+
+ACE_INLINE int
+TAO_ORB_Core::set_tss_resource (size_t slot_id, void *ts_object)
+{
+ TAO_ORB_Core_TSS_Resources *tss_resources =
+ this->get_tss_resources ();
+
+ // The number of allocated slots is equal to the number of
+ // registered TSS cleanup functions, *not* the size of the array in
+ // the ORB core TSS resources.
+ if (slot_id >= this->tss_cleanup_funcs_.size ())
+ {
+ errno = EINVAL;
+ return -1;
+ }
+
+ // If the TSS array isn't large enough, then increase its size.
+ // We're guaranteed not to exceed the number of allocated slots by
+ // the above check.
+ const size_t old_size = tss_resources->ts_objects_.size ();
+ const size_t new_size = slot_id + 1;
+ if (slot_id >= old_size
+ && tss_resources->ts_objects_.size (new_size) != 0)
+ return -1;
+
+ // Initialize intermediate array elements to zero, since they
+ // haven't been initialized yet. This ensures that garbage is not
+ // returned when accessing any of those elements at a later point in
+ // time.
+ for (size_t i = old_size; i < slot_id; ++i)
+ tss_resources->ts_objects_[i] = 0;
+
+ tss_resources->ts_objects_[slot_id] = ts_object;
+
+ // Make sure the ORB core pointer is set in the ORB core's TSS
+ // resources so that the TSS cleanup functions stored in the ORB
+ // core can be invoked.
+ tss_resources->orb_core_ = this;
+
+ return 0;
+}
+
+ACE_INLINE TAO_Cleanup_Func_Registry *
+TAO_ORB_Core::tss_cleanup_funcs (void)
+{
+ return &(this->tss_cleanup_funcs_);
+}
+
+ACE_INLINE int
+TAO_ORB_Core::has_shutdown (void)
+{
+ return this->has_shutdown_;
+}
+
+ACE_INLINE int
+TAO_ORB_Core::thread_per_connection_timeout (ACE_Time_Value &timeout) const
+{
+ timeout = this->thread_per_connection_timeout_;
+ return this->thread_per_connection_use_timeout_;
+}
+
+ACE_INLINE const char *
+TAO_ORB_Core::orbid (void) const
+{
+ return this->orbid_;
+}
+
+ACE_INLINE void
+TAO_ORB_Core::implrepo_service (const CORBA::Object_ptr ir)
+{
+ this->implrepo_service_ = ir;
+}
+
+ACE_INLINE CORBA::Boolean
+TAO_ORB_Core::use_implrepo (void)
+{
+ return use_implrepo_;
+}
+
+ACE_INLINE CORBA::Boolean
+TAO_ORB_Core::imr_endpoints_in_ior (void)
+{
+ return imr_endpoints_in_ior_;
+}
+
+ACE_INLINE CORBA::Object_ptr
+TAO_ORB_Core::resolve_typecodefactory (ACE_ENV_SINGLE_ARG_DECL)
+{
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, mon, this->lock_,
+ CORBA::Object::_nil ());
+ if (CORBA::is_nil (this->typecode_factory_))
+ {
+ this->resolve_typecodefactory_i (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Object::_nil ());
+ }
+ return CORBA::Object::_duplicate (this->typecode_factory_);
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+ACE_INLINE CORBA::Object_ptr
+TAO_ORB_Core::resolve_picurrent (ACE_ENV_SINGLE_ARG_DECL)
+{
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, mon, this->lock_,
+ CORBA::Object::_nil ());
+ if (CORBA::is_nil (this->pi_current_))
+ {
+ this->resolve_picurrent_i (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Object::_nil ());
+ }
+ return CORBA::Object::_duplicate (this->pi_current_);
+}
+
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+
+ACE_INLINE CORBA::Object_ptr
+TAO_ORB_Core::resolve_codecfactory (ACE_ENV_SINGLE_ARG_DECL)
+{
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, mon, this->lock_,
+ CORBA::Object::_nil ());
+ if (CORBA::is_nil (this->codec_factory_))
+ {
+ this->resolve_codecfactory_i (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Object::_nil ());
+ }
+ return CORBA::Object::_duplicate (this->codec_factory_);
+}
+
+ACE_INLINE const char *
+TAO_ORB_Core::server_id (void) const
+{
+ return this->server_id_.c_str();
+}
+
+ACE_INLINE TAO_Codeset_Manager *
+TAO_ORB_Core::codeset_manager()
+{
+ if (this->orb_params()->negotiate_codesets() == 0)
+ return 0;
+ if (this->codeset_manager_ == 0)
+ {
+ // This causes a factory to be loaded which will call
+ // the codeset_manager setter in this thread.
+ this->codeset_manager_ =
+ this->resource_factory()->codeset_manager();
+ if (this->codeset_manager_ == 0)
+ this->orb_params()->negotiate_codesets(false);
+ }
+ return this->codeset_manager_;
+}
+
+ACE_INLINE TAO::ORBInitializer_Registry_Adapter *
+TAO_ORB_Core::orbinitializer_registry ()
+{
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, mon, this->lock_,
+ 0);
+ if (orbinitializer_registry_ == 0)
+ {
+ return this->orbinitializer_registry_i ();
+ }
+ return this->orbinitializer_registry_;
+}
+
+ACE_INLINE TAO::PolicyFactory_Registry_Adapter *
+TAO_ORB_Core::policy_factory_registry ()
+{
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, mon, this->lock_,
+ 0);
+ if (policy_factory_registry_ == 0)
+ {
+ return this->policy_factory_registry_i ();
+ }
+ return this->policy_factory_registry_;
+}
+
+ACE_INLINE CORBA::Object_ptr
+TAO_ORB_Core::resolve_dynanyfactory (ACE_ENV_SINGLE_ARG_DECL)
+{
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, mon, this->lock_,
+ CORBA::Object::_nil ());
+ if (CORBA::is_nil (this->dynany_factory_))
+ {
+ this->resolve_dynanyfactory_i (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Object::_nil ());
+ }
+ return CORBA::Object::_duplicate (this->dynany_factory_);
+}
+
+ACE_INLINE CORBA::Object_ptr
+TAO_ORB_Core::resolve_ior_manipulation (ACE_ENV_SINGLE_ARG_DECL)
+{
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, mon, this->lock_,
+ CORBA::Object::_nil ());
+ if (CORBA::is_nil (this->ior_manip_factory_))
+ {
+ this->resolve_iormanipulation_i (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Object::_nil ());
+ }
+ return CORBA::Object::_duplicate (this->ior_manip_factory_);
+}
+
+ACE_INLINE CORBA::Object_ptr
+TAO_ORB_Core::resolve_ior_table (ACE_ENV_SINGLE_ARG_DECL)
+{
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, mon, this->lock_,
+ CORBA::Object::_nil ());
+ if (CORBA::is_nil (this->ior_table_))
+ {
+ this->resolve_ior_table_i (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Object::_nil ());
+ }
+ return CORBA::Object::_duplicate (this->ior_table_);
+}
+
+// ****************************************************************
+
+#if (TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1)
+
+ACE_INLINE TAO::Transport_Queueing_Strategy &
+TAO_ORB_Core::eager_transport_queueing_strategy (void)
+{
+ return *this->eager_transport_queueing_strategy_;
+}
+
+ACE_INLINE TAO::Transport_Queueing_Strategy &
+TAO_ORB_Core::delayed_transport_queueing_strategy (void)
+{
+ return *this->delayed_transport_queueing_strategy_;
+}
+
+ACE_INLINE TAO::Transport_Queueing_Strategy &
+TAO_ORB_Core::flush_transport_queueing_strategy (void)
+{
+ return *this->flush_transport_queueing_strategy_;
+}
+
+#endif /* TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1 */
+
+ACE_INLINE TAO::Transport_Queueing_Strategy &
+TAO_ORB_Core::default_transport_queueing_strategy (void)
+{
+ return *this->default_transport_queueing_strategy_;
+}
+
+#if (TAO_HAS_CORBA_MESSAGING == 1)
+
+ACE_INLINE TAO_Policy_Current &
+TAO_ORB_Core::policy_current (void)
+{
+ return *this->policy_current_;
+}
+
+#endif /* TAO_HAS_CORBA_MESSAGING == 1 */
+
+ACE_INLINE CORBA::Object_ptr
+TAO_ORB_Core::resolve_poa_current (ACE_ENV_SINGLE_ARG_DECL)
+{
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, mon, this->lock_,
+ CORBA::Object::_nil ());
+ if (CORBA::is_nil (this->poa_current_.in ()))
+ {
+ this->resolve_poa_current_i (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Object::_nil ());
+ }
+ return CORBA::Object::_duplicate (this->poa_current_.in ());
+}
+
+#if (TAO_HAS_CORBA_MESSAGING == 1)
+
+ACE_INLINE TAO_Policy_Set *
+TAO_ORB_Core::get_default_policies (void)
+{
+ return this->default_policies_;
+}
+
+#endif /* TAO_HAS_CORBA_MESSAGING == 1 */
+
+ACE_INLINE CORBA::Object_ptr
+TAO_ORB_Core::resolve_rt_orb (void)
+{
+ if (CORBA::is_nil (this->rt_orb_.in ()))
+ {
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, mon, this->lock_,
+ CORBA::Object::_nil ());
+ if (CORBA::is_nil (this->rt_orb_.in ()))
+ {
+ // Save a reference to the priority mapping manager.
+ this->rt_orb_ =
+ this->object_ref_table ().resolve_initial_reference (
+ TAO_OBJID_RTORB);
+ }
+ }
+
+ return CORBA::Object::_duplicate (this->rt_orb_.in ());
+}
+
+#if (TAO_HAS_INTERCEPTORS == 1)
+ACE_INLINE CORBA::Object_ptr
+TAO_ORB_Core::pi_current (void)
+{
+ // A pointer/reference to PICurrent is cached in the ORB Core since
+ // it is accessed in the critical path (i.e. the request invocation
+ // path). Caching it prevents additional overhead to due object
+ // resolution from occurring.
+ return this->pi_current_;
+}
+
+ACE_INLINE void
+TAO_ORB_Core::pi_current (CORBA::Object_ptr current)
+{
+ // Not duplicated since the ORB Core's "object_ref_table" already
+ // contains a duplicate of the PICurrent object.
+ this->pi_current_ = current;
+}
+
+ACE_INLINE TAO::ClientRequestInterceptor_Adapter *
+TAO_ORB_Core::clientrequestinterceptor_adapter (void)
+{
+ return this->client_request_interceptor_adapter_;
+}
+
+ACE_INLINE TAO::ServerRequestInterceptor_Adapter *
+TAO_ORB_Core::serverrequestinterceptor_adapter (void)
+{
+ return this->server_request_interceptor_adapter_;
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+/// Verify condition for permanent forward is given,
+/// both parameters must provide group attributes.
+ACE_INLINE CORBA::Boolean
+TAO_ORB_Core::is_permanent_forward_condition
+(const CORBA::Object_ptr obj,
+ const TAO_Service_Context &service_context)
+{
+ const TAO_Service_Callbacks *service_callback =
+ this->fault_tolerance_service ().service_callback ();
+
+ const CORBA::Boolean permanent_forward_condition =
+ service_callback &&
+ service_callback->is_permanent_forward_condition (obj,
+ service_context);
+
+ return permanent_forward_condition;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/ORB_Core_Auto_Ptr.cpp b/TAO/tao/ORB_Core_Auto_Ptr.cpp
new file mode 100644
index 00000000000..068897c2c38
--- /dev/null
+++ b/TAO/tao/ORB_Core_Auto_Ptr.cpp
@@ -0,0 +1,33 @@
+#include "tao/ORB_Core_Auto_Ptr.h"
+#include "tao/ORB_Core.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/ORB_Core_Auto_Ptr.inl"
+#endif /* !__ACE_INLINE */
+
+ACE_RCSID (tao,
+ ORB_Core_Auto_Ptr,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_ORB_Core_Auto_Ptr::~TAO_ORB_Core_Auto_Ptr (void)
+{
+ if (this->get () != 0)
+ {
+ this->get ()->_decr_refcnt ();
+ }
+}
+
+void
+TAO_ORB_Core_Auto_Ptr::reset (TAO_ORB_Core *p)
+{
+ if (this->get () != p && this->get () != 0)
+ {
+ this->get ()->_decr_refcnt ();
+ }
+
+ this->p_ = p;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/ORB_Core_Auto_Ptr.h b/TAO/tao/ORB_Core_Auto_Ptr.h
new file mode 100644
index 00000000000..19de5c918f1
--- /dev/null
+++ b/TAO/tao/ORB_Core_Auto_Ptr.h
@@ -0,0 +1,79 @@
+// -*- C++ -*-
+
+// ===================================================================
+/**
+ * @file ORB_Core_Auto_Ptr.h
+ *
+ * $Id$
+ *
+ * @author DOC Center - Washington University at St. Louis
+ * @author DOC Laboratory - University of California at Irvine
+ */
+// ===================================================================
+
+#ifndef TAO_ORB_CORE_AUTO_PTR_H
+#define TAO_ORB_CORE_AUTO_PTR_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/TAO_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Versioned_Namespace.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_ORB_Core;
+
+/**
+ * @class TAO_ORB_Core_Auto_Ptr
+ *
+ * @brief Define a TAO_ORB_Core auto_ptr class.
+ *
+ * This class is used as an aid to make ORB initialization exception
+ * safe. It ensures that the ORB core is deallocated through its
+ * reference counting mechanism if an exception is thrown.
+ */
+class TAO_Export TAO_ORB_Core_Auto_Ptr
+{
+public:
+
+ /**
+ * @name Initialization and termination methods
+ */
+ //@{
+ explicit TAO_ORB_Core_Auto_Ptr (TAO_ORB_Core *p = 0);
+ TAO_ORB_Core_Auto_Ptr (TAO_ORB_Core_Auto_Ptr &ap);
+ TAO_ORB_Core_Auto_Ptr &operator= (TAO_ORB_Core_Auto_Ptr &rhs);
+ ~TAO_ORB_Core_Auto_Ptr (void);
+ //@}
+
+ /**
+ * @name Accessor methods.
+ */
+ //@{
+ TAO_ORB_Core &operator *() const;
+ TAO_ORB_Core *get (void) const;
+ TAO_ORB_Core *release (void);
+ void reset (TAO_ORB_Core *p = 0);
+ TAO_ORB_Core *operator-> () const;
+ //@}
+
+protected:
+
+ TAO_ORB_Core *p_;
+
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/ORB_Core_Auto_Ptr.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_ORB_CORE_AUTO_PTR_H */
diff --git a/TAO/tao/ORB_Core_Auto_Ptr.inl b/TAO/tao/ORB_Core_Auto_Ptr.inl
new file mode 100644
index 00000000000..d9bd041e77c
--- /dev/null
+++ b/TAO/tao/ORB_Core_Auto_Ptr.inl
@@ -0,0 +1,59 @@
+// -*- C++ -*-
+//
+// $Id$
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO_ORB_Core_Auto_Ptr::TAO_ORB_Core_Auto_Ptr (TAO_ORB_Core *p)
+ : p_ (p)
+{
+}
+
+ACE_INLINE TAO_ORB_Core *
+TAO_ORB_Core_Auto_Ptr::get (void) const
+{
+ return this->p_;
+}
+
+ACE_INLINE TAO_ORB_Core *
+TAO_ORB_Core_Auto_Ptr::release (void)
+{
+ TAO_ORB_Core *old = this->p_;
+ this->p_ = 0;
+ return old;
+}
+
+ACE_INLINE TAO_ORB_Core *
+TAO_ORB_Core_Auto_Ptr::operator-> () const
+{
+ return this->get ();
+}
+
+ACE_INLINE
+TAO_ORB_Core_Auto_Ptr::TAO_ORB_Core_Auto_Ptr (TAO_ORB_Core_Auto_Ptr &rhs)
+ : p_ (rhs.release ())
+{
+}
+
+ACE_INLINE TAO_ORB_Core_Auto_Ptr &
+TAO_ORB_Core_Auto_Ptr::operator= (TAO_ORB_Core_Auto_Ptr &rhs)
+{
+ if (this != &rhs)
+ {
+ this->reset (rhs.release ());
+ }
+ return *this;
+}
+
+// Accessor methods to the underlying ORB_Core Object
+
+ACE_INLINE TAO_ORB_Core &
+TAO_ORB_Core_Auto_Ptr::operator *() const
+{
+ // @@ Potential problem if this->p_ is zero!
+ return *this->get ();
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/ORB_Core_TSS_Resources.cpp b/TAO/tao/ORB_Core_TSS_Resources.cpp
new file mode 100644
index 00000000000..64d57768dba
--- /dev/null
+++ b/TAO/tao/ORB_Core_TSS_Resources.cpp
@@ -0,0 +1,32 @@
+// $Id$
+
+#include "tao/ORB_Core_TSS_Resources.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_ORB_Core_TSS_Resources::TAO_ORB_Core_TSS_Resources (void)
+ : event_loop_thread_ (0)
+ , client_leader_thread_ (0)
+ , lane_ (0)
+ , ts_objects_ ()
+ , upcalls_temporarily_suspended_on_this_thread_ (false)
+ , orb_core_ (0)
+{
+}
+
+TAO_ORB_Core_TSS_Resources::~TAO_ORB_Core_TSS_Resources (void)
+{
+ //@@ This is broken on platforms that use TSS emulation since this
+ // destructor is invoked after the ORB. Since we're under
+ // pressure to release a beta, we'll have to leak the TSS objects
+ // stores in the <ts_objects_> array. However, the only service
+ // known to currently use this array is the SSLIOP pluggable
+ // protocol. Fortunately, it registeres a null cleanup function
+ // so we're not leaking anything yet. We *do* need to fix this
+ // before other services start to use this array.
+ // -Ossama
+ // if (this->orb_core_ != 0)
+ // this->orb_core_->tss_cleanup_funcs ()->cleanup (this->ts_objects_);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/ORB_Core_TSS_Resources.h b/TAO/tao/ORB_Core_TSS_Resources.h
new file mode 100644
index 00000000000..8f5e0c3abb8
--- /dev/null
+++ b/TAO/tao/ORB_Core_TSS_Resources.h
@@ -0,0 +1,91 @@
+// -*- C++ -*-
+
+// ===================================================================
+/**
+ * @file ORB_Core_TSS_Resources.h
+ *
+ * $Id$
+ *
+ * @author DOC Center - Washington University at St. Louis
+ * @author DOC Laboratory - University of California at Irvine
+ */
+// ===================================================================
+
+#ifndef TAO_ORB_CORE_TSS_RESOURCES_H
+#define TAO_ORB_CORE_TSS_RESOURCES_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/TAO_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/orbconf.h"
+#include "ace/Array_Base.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_ORB_Core;
+
+/**
+ * @class TAO_ORB_Core_TSS_Resources
+ *
+ * @brief The TSS resoures of an ORB core.
+ *
+ * This class is used by the ORB_Core to store the resources
+ * potentially bound to a thread in TSS storage. The members are public
+ * because only the ORB Core is expected to access them.
+ */
+class TAO_Export TAO_ORB_Core_TSS_Resources
+{
+public:
+
+ /// Constructor
+ TAO_ORB_Core_TSS_Resources (void);
+
+ /// destructor
+ ~TAO_ORB_Core_TSS_Resources (void);
+
+private:
+
+ /// The ORB Core TSS resources should not be copied
+ TAO_ORB_Core_TSS_Resources (const TAO_ORB_Core_TSS_Resources&);
+ void operator= (const TAO_ORB_Core_TSS_Resources&);
+
+public:
+
+ /**
+ * @todo
+ * The rest of the resources are not currently in use, just a plan
+ * for the future...
+ */
+ /// Counter for how (nested) calls this thread has made to run the
+ /// event loop.
+ int event_loop_thread_;
+
+ /// Counter for how many times this thread has become a client
+ /// leader.
+ int client_leader_thread_;
+
+ /// Lane for this thread.
+ void *lane_;
+
+ /// Generic container for thread-specific objects.
+ ACE_Array_Base<void *> ts_objects_;
+
+ // Set to true by the wait_on_lf_no_nested_upcall wait strategy
+ // @CJC@ maybe we should use allocate_tss_slot_id() instead?
+ bool upcalls_temporarily_suspended_on_this_thread_;
+
+ /// Pointer to the ORB core. Needed to get access to the TSS
+ /// cleanup functions for the TSS objects stored in the TSS object
+ /// array in this class.
+ TAO_ORB_Core *orb_core_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_ORB_CORE_H */
diff --git a/TAO/tao/ORB_Table.cpp b/TAO/tao/ORB_Table.cpp
new file mode 100644
index 00000000000..8624370348c
--- /dev/null
+++ b/TAO/tao/ORB_Table.cpp
@@ -0,0 +1,186 @@
+#include "tao/ORB_Table.h"
+#include "tao/ORB_Core.h"
+#include "tao/TAO_Singleton.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/ORB_Table.inl"
+#endif /* ! __ACE_INLINE__ */
+
+#include "ace/SString.h"
+#include "ace/OS_NS_string.h"
+
+
+ACE_RCSID (tao,
+ ORB_Table,
+ "$Id$")
+
+
+// ****************************************************************
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO::ORB_Table::ORB_Table (void)
+ : lock_ (),
+ first_orb_not_default_ (false),
+ table_ (TAO_DEFAULT_ORB_TABLE_SIZE),
+ first_orb_ (0),
+ orbs_ (0),
+ num_orbs_ (0)
+{
+}
+
+int
+TAO::ORB_Table::bind (char const * orb_id,
+ TAO_ORB_Core * orb_core)
+{
+ // Make sure that the supplied ORB core pointer is valid,
+ // i.e. non-zero.
+ if (orb_id == 0 || orb_core == 0)
+ {
+ errno = EINVAL;
+ return -1;
+ };
+
+ value_type const value =
+ std::make_pair (key_type (orb_id), data_type (orb_core));
+
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
+ guard,
+ this->lock_,
+ -1);
+
+ std::pair<iterator, bool> result = this->table_.insert (value);
+
+ if (result.second)
+ {
+ // This is not the first ORB, but if the current default ORB
+ // decided not to be the default and there is more than one ORB
+ // then set this ORB to be the default.
+ if (this->first_orb_ != 0
+ && this->first_orb_not_default_)
+ {
+ this->first_orb_ = orb_core;
+ this->first_orb_not_default_ = false;
+ }
+
+ // Set the "first_orb_" member for the first given ORB Core
+ // that was successfully added to the ORB table.
+ if (this->first_orb_ == 0)
+ {
+ this->first_orb_ = orb_core;
+ }
+ }
+
+ return (result.second ? 0 : 1);
+}
+
+TAO_ORB_Core *
+TAO::ORB_Table::find (char const * orb_id)
+{
+ TAO_ORB_Core * orb_core = 0;
+
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
+ guard,
+ this->lock_,
+ 0);
+
+ iterator const i = this->table_.find (Table::key_type (orb_id));
+
+ // Maintain ownership of the ORB_Core.
+ if (i != this->end ())
+ {
+ orb_core = (*i).second.core ();
+ (void) orb_core->_incr_refcnt ();
+ }
+
+ return orb_core;
+}
+
+int
+TAO::ORB_Table::unbind (const char *orb_id)
+{
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
+ guard,
+ this->lock_,
+ -1);
+
+ iterator const result = this->table_.find (key_type (orb_id));
+
+ if (result != this->end ())
+ {
+ TAO::ORB_Core_Ref_Counter oc ((*result).second);
+
+ this->table_.erase (result);
+
+ if (oc.core () == this->first_orb_)
+ {
+ if (!this->table_.empty ())
+ {
+ this->first_orb_ = (*this->begin ()).second.core ();
+ }
+ else
+ {
+ this->first_orb_ = 0;
+ }
+ }
+ }
+
+ return 0;
+}
+
+void
+TAO::ORB_Table::set_default (char const * orb_id)
+{
+ ACE_GUARD (TAO_SYNCH_MUTEX,
+ guard,
+ this->lock_);
+
+ iterator const i = this->table_.find (key_type (orb_id));
+
+ if (i != this->end ())
+ this->first_orb_ = (*i).second.core ();
+}
+
+void
+TAO::ORB_Table::not_default (char const * orb_id)
+{
+ // @@ This method now works for restricted cases. Should work on
+ // generalizing it. It works if the first ORB that is registered
+ // decides to not want be the default ORB. Should generalize it
+ // to handle all cases.
+
+
+ ACE_GUARD (TAO_SYNCH_MUTEX,
+ guard,
+ this->lock_);
+
+ // Check if there is a default ORB already and if it is *not* the
+ // same as the orb_id thats passed in. We don't have to do
+ // anything.
+ if (this->first_orb_ != 0)
+ {
+ if (ACE_OS::strcmp (this->first_orb_->orbid (), orb_id) != 0)
+ {
+ // There is another default ORB. No need to change anything
+ return;
+ }
+ else
+ {
+ // The ORB with orbid 'orb_id' is the default now. We need
+ // to change it.
+ this->first_orb_not_default_ = true;
+ }
+ }
+}
+
+TAO::ORB_Table *
+TAO::ORB_Table::instance (void)
+{
+ return TAO_Singleton<TAO::ORB_Table, TAO_SYNCH_MUTEX>::instance ();
+}
+
+#if defined (ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION)
+template TAO_Singleton<TAO::ORB_Table,TAO_SYNCH_MUTEX> * TAO_Singleton<TAO::ORB_Table,TAO_SYNCH_MUTEX>::singleton_;
+#endif /* ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION */
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/ORB_Table.h b/TAO/tao/ORB_Table.h
new file mode 100644
index 00000000000..4525c5157d9
--- /dev/null
+++ b/TAO/tao/ORB_Table.h
@@ -0,0 +1,208 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file ORB_Table.h
+ *
+ * $Id$
+ *
+ * @author Ossama Othman
+ * @author Carlos O'Ryan
+ */
+//=============================================================================
+
+
+#ifndef TAO_ORB_TABLE_H
+#define TAO_ORB_TABLE_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/TAO_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/orbconf.h"
+#include "tao/CORBA_String.h"
+
+#include "ace/Array_Map.h"
+#include "ace/Thread_Mutex.h"
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Forward declarations.
+class TAO_ORB_Core;
+
+namespace TAO
+{
+ class ORB_Core_Ref_Counter;
+
+ /**
+ * @class ORB_Table
+ *
+ * @brief Keep a table with all the ORBs in the system.
+ *
+ * CORBA::ORB_init() is supposed to return the same ORB if the
+ * user specifies the same ORBid, either in the ORB_init()
+ * parameter or in the -ORBid option.
+ * This class is used to implement that feature.
+ * It is also useful when trying to determine if an object
+ * reference is collocated or not.
+ *
+ * @note This class should be instantiated via its instance()
+ * method. Normally this would be enforced by making the
+ * constructor protected but that forces a friend declaration
+ * containing a template type (TAO_Singleton) with a static
+ * member to be introduced. In turn, this potentially
+ * introduces problems in MS Windows DLL environments due to
+ * the occurance of multiple singleton instances. There
+ * should only be one!
+ */
+ class TAO_Export ORB_Table
+ {
+ public:
+
+ /// Constructor
+ /**
+ * @note See the note in the class description for an explanation
+ * of why this constructor is not protected.
+ */
+ ORB_Table (void);
+
+ typedef ACE_Array_Map<CORBA::String_var,
+ ORB_Core_Ref_Counter,
+ TAO::String_Var_Equal_To> Table;
+ typedef Table::key_type key_type;
+ typedef Table::data_type data_type;
+ typedef Table::value_type value_type;
+ typedef Table::size_type size_type;
+ typedef Table::iterator iterator;
+
+ /**
+ * @name The canonical ACE_Map methods.
+ */
+ //@{
+ iterator begin (void);
+ iterator end (void);
+ int bind (const char *orb_id, ::TAO_ORB_Core *orb_core);
+
+ /// Return @c TAO_ORB_Core corresponding to ORB with given @a
+ /// orb_id.
+ /**
+ * @note The caller must decrease the reference count on the
+ * returned ORB_Core, i.e. the callers "owns" it.
+ */
+ ::TAO_ORB_Core* find (const char *orb_id);
+
+ int unbind (const char *orb_id);
+ //@}
+
+ ::TAO_ORB_Core * const * get_orbs (size_t& num_orbs);
+
+ /// Obtain the first ORB for the @c ORB_Core_instance()
+ /// implementation.
+ ::TAO_ORB_Core * first_orb (void);
+
+ /// Return a unique instance
+ static ORB_Table * instance (void);
+
+ /// Set the ORB related to the orb_id as the default ORB and not the
+ /// ORB that is first binded.
+ void set_default (char const * orb_id);
+
+ /// Method the ORB invokes to specify that it doesnt want to be the
+ /// default ORB if there are more than one ORB registered.
+ void not_default (char const * orb_id);
+
+ /// Accessor to the underlying table_
+ Table * table (void);
+
+ /// Return reference to underlying lock.
+ TAO_SYNCH_MUTEX & lock (void);
+
+ private:
+
+ // Prevent copying
+ ORB_Table (const ORB_Table &);
+ void operator= (const ORB_Table &);
+
+ /// Return @c TAO_ORB_Core corresponding to ORB with given @a
+ /// orb_id. (underlying unlocked implementation).
+ ::TAO_ORB_Core * find_i (char const * orb_id);
+
+ private:
+
+ /// Lock used to synchronize access to the internal state.
+ ::TAO_SYNCH_MUTEX lock_;
+
+ /// Variable to check if the first ORB decides not to be the
+ /// default.
+ bool first_orb_not_default_;
+
+ /// The underlying table.
+ Table table_;
+
+ /// The first ORB created by the user
+ ::TAO_ORB_Core * first_orb_;
+
+ /// List of orbs for get_orbs call
+ /**
+ * @todo ORB_Table::orbs_ appears to be unused. Remove it?
+ */
+ ::TAO_ORB_Core ** orbs_;
+
+ /// Number of ORBs in the table.
+ size_t num_orbs_;
+
+ };
+
+ // -----------------------------------------------
+
+ /**
+ * @class ORB_Table_Ref_Counter
+ *
+ * @brief Class contained by ORB_Table's Unbounded_Set.
+ *
+ * Class contained by ORB_Table's Unbounded_Set.
+ */
+ class ORB_Core_Ref_Counter
+ {
+ public:
+
+ /// Constructor.
+ ORB_Core_Ref_Counter (void);
+
+ /// Constructor.
+ ORB_Core_Ref_Counter (::TAO_ORB_Core * core);
+
+ /// Destructor.
+ ~ORB_Core_Ref_Counter (void);
+
+ /// Copy constructor.
+ ORB_Core_Ref_Counter (ORB_Core_Ref_Counter const & rhs);
+
+ /// Assignment operator.
+ void operator= (ORB_Core_Ref_Counter const & rhs);
+
+ /// ORB_Core pointer accessor.
+ ::TAO_ORB_Core * core (void) const { return this->core_; }
+
+ private:
+
+ ::TAO_ORB_Core * core_;
+
+ };
+
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/ORB_Table.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_ORB_TABLE_H */
diff --git a/TAO/tao/ORB_Table.inl b/TAO/tao/ORB_Table.inl
new file mode 100644
index 00000000000..40cb80e4d70
--- /dev/null
+++ b/TAO/tao/ORB_Table.inl
@@ -0,0 +1,96 @@
+// -*- C++ -*-
+//
+// $Id$
+
+#include "tao/ORB_Core.h"
+
+#include <algorithm>
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE ::TAO_ORB_Core *
+TAO::ORB_Table::first_orb (void)
+{
+ return this->first_orb_;
+}
+
+ACE_INLINE TAO::ORB_Table::iterator
+TAO::ORB_Table::begin (void)
+{
+ return this->table_.begin ();
+}
+
+ACE_INLINE TAO::ORB_Table::iterator
+TAO::ORB_Table::end (void)
+{
+ return this->table_.end ();
+}
+
+ACE_INLINE ::TAO_ORB_Core* const *
+TAO::ORB_Table::get_orbs (size_t& num_orbs)
+{
+ num_orbs = this->num_orbs_;
+ return this->orbs_;
+}
+
+/// Accessor to the underlying table_
+ACE_INLINE TAO::ORB_Table::Table *
+TAO::ORB_Table::table (void)
+{
+ return &this->table_;
+}
+
+ACE_INLINE TAO_SYNCH_MUTEX &
+TAO::ORB_Table::lock (void)
+{
+ return this->lock_;
+}
+
+// ****************************************************************
+
+ACE_INLINE
+TAO::ORB_Core_Ref_Counter::ORB_Core_Ref_Counter (void)
+ : core_ (0)
+{
+}
+
+ACE_INLINE
+TAO::ORB_Core_Ref_Counter::ORB_Core_Ref_Counter (::TAO_ORB_Core * core)
+ : core_ (core)
+{
+// ACE_ASSERT (core != 0);
+
+ // Note that the TAO_ORB_Core pointer should always be valid in this
+ // constructor.
+
+ // Claim ownership.
+ (void) this->core_->_incr_refcnt ();
+}
+
+ACE_INLINE
+TAO::ORB_Core_Ref_Counter::~ORB_Core_Ref_Counter (void)
+{
+ if (this->core_)
+ (void) this->core_->_decr_refcnt (); // Should never throw.
+}
+
+ACE_INLINE
+TAO::ORB_Core_Ref_Counter::ORB_Core_Ref_Counter (
+ TAO::ORB_Core_Ref_Counter const & rhs)
+ : core_ (rhs.core_)
+{
+ // Claim ownership.
+ if (this->core_)
+ (void) this->core_->_incr_refcnt ();
+}
+
+ACE_INLINE void
+TAO::ORB_Core_Ref_Counter::operator= (TAO::ORB_Core_Ref_Counter const & rhs)
+{
+ // Strongly exception safe. May not be strictly necessary, but
+ // let's do things the right way, regardless.
+ TAO::ORB_Core_Ref_Counter tmp (rhs);
+ std::swap (this->core_, tmp.core_);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/ObjRefTemplate.mpc b/TAO/tao/ObjRefTemplate.mpc
new file mode 100644
index 00000000000..87eb21be80d
--- /dev/null
+++ b/TAO/tao/ObjRefTemplate.mpc
@@ -0,0 +1,53 @@
+//$Id$
+project : valuetype, portableserver, core, tao_versioning_idl_defaults {
+ sharedname = TAO_ObjRefTemplate
+ dynamicflags = TAO_ORT_BUILD_DLL
+
+ Source_Files {
+ ObjRefTemplate
+ }
+
+ Header_Files {
+ ObjRefTemplate
+ }
+
+ Inline_Files {
+ ObjRefTemplate
+ }
+
+ Template_Files {
+ ObjRefTemplate
+ }
+
+ Resource_Files {
+ ObjRefTemplate
+ }
+
+ PIDL_Files {
+ ObjRefTemplate
+ }
+
+ IDL_Files {
+ idlflags += -Gp -Gd -Ge 1 -SS -Sorb \
+ -Wb,export_macro=TAO_ORT_Export \
+ -Wb,export_include=tao/ObjRefTemplate/ort_export.h \
+ -Wb,include_guard=TAO_OBJREF_TEMPLATE_SAFE_INCLUDE \
+ -Wb,safe_include=tao/ObjRefTemplate/ObjectReferenceTemplate.h \
+ -o ObjRefTemplate
+ idlflags -= -Sa -St
+ ObjRefTemplate/ObjectReferenceTemplate.pidl
+ }
+
+ IDL_Files {
+ idlflags += -Gp -Gd -Ge 1 -SS -GA -Sorb \
+ -Wb,export_macro=TAO_ORT_Export \
+ -Wb,export_include=tao/ObjRefTemplate/ort_export.h \
+ -o ObjRefTemplate
+ idlflags -= -Sa -St
+ ObjRefTemplate/Default_ORT.pidl
+ }
+
+ Pkgconfig_Files {
+ ObjRefTemplate/TAO_ObjRefTemplate.pc.in
+ }
+}
diff --git a/TAO/tao/ObjRefTemplate/Default_ORT.pidl b/TAO/tao/ObjRefTemplate/Default_ORT.pidl
new file mode 100644
index 00000000000..31b9596fe9e
--- /dev/null
+++ b/TAO/tao/ObjRefTemplate/Default_ORT.pidl
@@ -0,0 +1,36 @@
+// -*- IDL -*-
+/**
+ * @file Default_ORT.pidl
+ *
+ * $Id$
+ *
+ * @brief Pre-compiled IDL source for the TAO_Default_ORT module.
+ *
+ * This file is used to generate Default_ORTC.{h,i,cpp}, using the following
+ * command:
+ *
+ * tao_idl.exe
+ * -o orig -Ge 1 -GA
+ * -I../..
+ * -Wb,export_macro=TAO_ORT_Export \
+ * -Wb,export_include="ort_export.h" \
+ * -Wb,pre_include="ace/pre.h"
+ * -Wb,post_include="ace/post.h"
+ * Default_ORT.pidl
+ *
+ */
+
+#ifndef TAO_DEFAULT_ORT_PIDL
+#define TAO_DEFAULT_ORT_PIDL
+
+#include "tao/ObjRefTemplate/ObjectReferenceTemplate_include.pidl"
+
+module TAO_Default_ORT
+{
+ valuetype ObjectReferenceTemplate
+ : PortableInterceptor::ObjectReferenceTemplate
+ {
+ };
+};
+
+#endif /* TAO_DEFAULT_ORT_PIDL */
diff --git a/TAO/tao/ObjRefTemplate/ORT_Adapter_Factory_Impl.cpp b/TAO/tao/ObjRefTemplate/ORT_Adapter_Factory_Impl.cpp
new file mode 100644
index 00000000000..d670c3ab051
--- /dev/null
+++ b/TAO/tao/ObjRefTemplate/ORT_Adapter_Factory_Impl.cpp
@@ -0,0 +1,58 @@
+// $Id$
+
+#include "tao/ObjRefTemplate/ORT_Adapter_Factory_Impl.h"
+#include "tao/ObjRefTemplate/ORT_Adapter_Impl.h"
+#include "tao/PortableServer/Root_POA.h"
+
+ACE_RCSID (ORT,
+ ORT_Adapter_Factory_Impl,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ ORT_Adapter *
+ ORT_Adapter_Factory_Impl::create ()
+ {
+ ORT_Adapter_Impl * new_ort_adapter = 0;
+
+ ACE_NEW_RETURN (new_ort_adapter,
+ TAO::ORT_Adapter_Impl,
+ 0);
+
+ return new_ort_adapter;
+ }
+
+ void
+ ORT_Adapter_Factory_Impl::destroy (ORT_Adapter * adapter)
+ {
+ delete adapter;
+ }
+
+ int
+ ORT_Adapter_Factory_Impl::Initializer (void)
+ {
+ TAO_Root_POA::ort_adapter_factory_name ("Concrete_ORT_Adapter_Factory"
+ );
+
+ return ACE_Service_Config::process_directive (
+ ace_svc_desc_ORT_Adapter_Factory_Impl
+ );
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DEFINE (
+ ORT_Adapter_Factory_Impl,
+ ACE_TEXT ("Concrete_ORT_Adapter_Factory"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (ORT_Adapter_Factory_Impl),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0)
+
+ACE_FACTORY_NAMESPACE_DEFINE (
+ TAO_ORT,
+ ORT_Adapter_Factory_Impl,
+ TAO::ORT_Adapter_Factory_Impl)
diff --git a/TAO/tao/ObjRefTemplate/ORT_Adapter_Factory_Impl.h b/TAO/tao/ObjRefTemplate/ORT_Adapter_Factory_Impl.h
new file mode 100644
index 00000000000..397addb069c
--- /dev/null
+++ b/TAO/tao/ObjRefTemplate/ORT_Adapter_Factory_Impl.h
@@ -0,0 +1,70 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file ORT_Adapter_Factory_Impl.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_ORT_ADAPTER_FACTORY_IMPL_H
+#define TAO_ORT_ADAPTER_FACTORY_IMPL_H
+
+#include /**/ "ace/pre.h"
+
+#include "ace/Service_Config.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/ObjRefTemplate/ort_export.h"
+#include "tao/PortableServer/ORT_Adapter_Factory.h"
+#include "tao/Versioned_Namespace.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ /**
+ * @class ORT_Adapter_Factory_Impl
+ *
+ * @brief ORT_Adapter_Factory_Impl
+ *
+ * Class that creates instances of TAO::ORT_Adapter
+ * (one per POA). This is the derived class that contains the actual
+ * implementation.
+ */
+ class TAO_ORT_Export ORT_Adapter_Factory_Impl
+ : public ORT_Adapter_Factory
+ {
+ public:
+ /// Create an adapter
+ virtual TAO::ORT_Adapter * create ();
+
+ /// Destroy an adapter that is created by this factory
+ virtual void destroy (TAO::ORT_Adapter * adapter);
+
+ // Used to force the initialization of the code.
+ static int Initializer (void);
+ };
+}
+
+static int TAO_Requires_ORTFactory_Initializer =
+ TAO::ORT_Adapter_Factory_Impl::Initializer ();
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE (ORT_Adapter_Factory_Impl)
+ACE_FACTORY_DECLARE (TAO_ORT, ORT_Adapter_Factory_Impl)
+
+
+#define TAO_OBJREF_TEMPLATE_SAFE_INCLUDE
+#include "tao/ObjRefTemplate/ObjectReferenceTemplateC.h"
+#undef TAO_OBJREF_TEMPLATE_SAFE_INCLUDE
+#include /**/ "ace/post.h"
+
+#endif /* TAO_ORT_ADAPTER_FACTORY_IMPL_H */
diff --git a/TAO/tao/ObjRefTemplate/ORT_Adapter_Impl.cpp b/TAO/tao/ObjRefTemplate/ORT_Adapter_Impl.cpp
new file mode 100644
index 00000000000..1e697edc9cc
--- /dev/null
+++ b/TAO/tao/ObjRefTemplate/ORT_Adapter_Impl.cpp
@@ -0,0 +1,117 @@
+// $Id$
+
+#include "tao/ObjRefTemplate/ORT_Adapter_Impl.h"
+#include "tao/PortableServer/Root_POA.h"
+#include "tao/CORBA_String.h"
+#include "tao/ORB_Constants.h"
+#include "tao/CORBA_methods.h"
+
+
+ACE_RCSID (ObjRefTemplate,
+ ORT_Adapter_Impl,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+char *
+TAO::ORT_Adapter_Impl::tao_server_id (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ // No need to duplicate, the ort_template_ method has to do the duplicate
+ return this->ort_template_->server_id (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+char *
+TAO::ORT_Adapter_Impl::tao_orb_id (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ // No need to duplicate, the ort_template_ method has to do the duplicate
+ return this->ort_template_->orb_id (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+PortableInterceptor::AdapterName *
+TAO::ORT_Adapter_Impl::tao_adapter_name (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ // No need to duplicate, the ort_template_ method has to do the duplicate
+ return this->ort_template_->adapter_name (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+CORBA::Object_ptr
+TAO::ORT_Adapter_Impl::make_object (const char *repo_id,
+ const PortableInterceptor::ObjectId &id
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return this->ort_factory_->make_object (repo_id,
+ id
+ ACE_ENV_ARG_PARAMETER);
+}
+
+PortableInterceptor::ObjectReferenceTemplate *
+TAO::ORT_Adapter_Impl::get_adapter_template (void)
+{
+ CORBA::add_ref (this->ort_template_.in ());
+
+ return this->ort_template_;
+}
+
+PortableInterceptor::ObjectReferenceFactory *
+TAO::ORT_Adapter_Impl::get_obj_ref_factory (void)
+{
+ CORBA::add_ref (this->ort_factory_.in ());
+
+ return this->ort_factory_;
+}
+
+int
+TAO::ORT_Adapter_Impl::set_obj_ref_factory (
+ PortableInterceptor::ObjectReferenceFactory *cf
+ ACE_ENV_ARG_DECL_NOT_USED)
+{
+ this->ort_factory_ = cf;
+
+ CORBA::add_ref (this->ort_factory_.in ());
+
+ return 0;
+}
+
+void
+TAO::ORT_Adapter_Impl::release (
+ PortableInterceptor::ObjectReferenceTemplate * t)
+{
+ CORBA::remove_ref (t);
+}
+
+int
+TAO::ORT_Adapter_Impl::activate (
+ const char *server_id,
+ const char *orb_id,
+ PortableInterceptor::AdapterName *adapter_name,
+ PortableServer::POA_ptr poa
+ ACE_ENV_ARG_DECL)
+{
+ // No need to lock here, there is one instance for each POA and
+ // when the POA creates and actives an ORT_Adapter it will lock
+ // itself. Create an ObjectReferenceTemplate for this POA.
+
+ ObjectReferenceTemplate * t = 0;
+ ACE_NEW_THROW_EX (t,
+ ObjectReferenceTemplate (server_id,
+ orb_id,
+ adapter_name,
+ poa),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (-1);
+
+ this->ort_template_ = t;
+
+ // Must increase ref count since this->ort_factory_ will
+ // decrease it upon destruction.
+ CORBA::add_ref (t);
+ this->ort_factory_ = t;
+
+ return 0;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/ObjRefTemplate/ORT_Adapter_Impl.h b/TAO/tao/ObjRefTemplate/ORT_Adapter_Impl.h
new file mode 100644
index 00000000000..ff30c49bbdf
--- /dev/null
+++ b/TAO/tao/ObjRefTemplate/ORT_Adapter_Impl.h
@@ -0,0 +1,120 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file ORT_Adapter_Impl.h
+ *
+ * $Id$
+ *
+ * This is the implementation of the TAO::ORT_Adapter
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_ORT_ADAPTER_IMPL_H
+#define TAO_ORT_ADAPTER_IMPL_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/ObjRefTemplate/ort_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/ORT_Adapter.h"
+#include "tao/ObjRefTemplate/ObjectReferenceTemplate_i.h"
+
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ /**
+ * @class ObjectReferenceTemplate_Adapter_Impl
+ *
+ * @brief Implementation of the TAO::ORT_Adapter
+ */
+ class ORT_Adapter_Impl
+ : public ORT_Adapter
+ {
+ public:
+ /// Activate this adapter
+ virtual int activate (const char *server_id,
+ const char *orb_id,
+ PortableInterceptor::AdapterName *adapter_name,
+ PortableServer::POA_ptr poa
+ ACE_ENV_ARG_DECL);
+
+ /// Accessor methods to ObjectReferenceTemplate template
+ virtual PortableInterceptor::ObjectReferenceTemplate *get_adapter_template (void);
+
+ /// Accessor methods to PortableInterceptor::ObjectReferenceFactory
+ virtual PortableInterceptor::ObjectReferenceFactory * get_obj_ref_factory (void);
+
+ /// Set a different ort_factory to be used.
+ virtual int set_obj_ref_factory (
+ PortableInterceptor::ObjectReferenceFactory * current_factory
+ ACE_ENV_ARG_DECL);
+
+ /**
+ * @see @c TAO::ORT_Adapter for details.
+ */
+ virtual void release (PortableInterceptor::ObjectReferenceTemplate * ort);
+
+ /**
+ * @name Adapter methods for PortableInterceptor::ObjectReferenceTemplate
+ * Methods
+ */
+ //@{
+ virtual char * tao_server_id (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual char * tao_orb_id (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual PortableInterceptor::AdapterName * tao_adapter_name (
+ ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+ //@}
+
+ /**
+ * @name PortableInterceptor::ObjectReferenceFactory Methods
+ *
+ * Methods required by the
+ * PortableInterceptor::ObjectReferenceFactory ValueType.
+ */
+ //@{
+ virtual CORBA::Object_ptr make_object (
+ const char * repository_id,
+ const PortableInterceptor::ObjectId & id
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+ //@}
+
+ private:
+
+ /// The ORT Template, this is the factory and its identity.
+ PortableInterceptor::ObjectReferenceTemplate_var ort_template_;
+
+ /// The ORT Factory.
+ PortableInterceptor::ObjectReferenceFactory_var ort_factory_;
+
+ };
+
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined(_MSC_VER)
+# pragma warning(pop)
+#endif /* _MSC_VER */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_ORT_ADAPTER_IMPL_H */
diff --git a/TAO/tao/ObjRefTemplate/ObjectReferenceTemplate.h b/TAO/tao/ObjRefTemplate/ObjectReferenceTemplate.h
new file mode 100644
index 00000000000..f1a112b9d3f
--- /dev/null
+++ b/TAO/tao/ObjRefTemplate/ObjectReferenceTemplate.h
@@ -0,0 +1,26 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file ObjectReferenceTemplate.h
+ *
+ * $Id$
+ *
+ * This is the implementation of the TAO::ORT_Adapter
+ *
+ * @author Bala Natarajan <bala@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_OBJECT_REFERENCE_TEMPLATE_H
+#define TAO_OBJECT_REFERENCE_TEMPLATE_H
+#include /**/ "ace/pre.h"
+
+#include "tao/ObjRefTemplate/ORT_Adapter_Factory_Impl.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include /**/ "ace/post.h"
+#endif /*TAO_OBJECT_REFERENCE_TEMPLATE_H*/
diff --git a/TAO/tao/ObjRefTemplate/ObjectReferenceTemplate.pidl b/TAO/tao/ObjRefTemplate/ObjectReferenceTemplate.pidl
new file mode 100644
index 00000000000..8ec779c75cf
--- /dev/null
+++ b/TAO/tao/ObjRefTemplate/ObjectReferenceTemplate.pidl
@@ -0,0 +1,56 @@
+// -*- IDL -*-
+
+/**
+ * @file ObjectReferenceTemplate.pidl
+ *
+ * $Id$
+ *
+ * @brief Pre-compiled IDL source for the ObjectReferenceTemplate module.
+ *
+ * This file is used to generate ObjectReferenceTemplateC.{h,i,cpp},
+ * using the following command:
+ *
+ * tao_idl.exe
+ * -o orig -Gp -Gd -Ge 1 -GA
+ * -I$(TAO_ROOT)
+ * -Wb,export_macro=TAO_ORT_Export
+ * -Wb,export_include=ort_export.h
+ * -Wb,pre_include="ace/pre.h"
+ * -Wb,post_include="ace/post.h"
+ * ObjectReferenceTemplate.pidl
+ *
+ * and then:
+ *
+ * cp orig/ObjectReferenceTemplateC.{h,i,cpp} .
+ * patch < diffs/ObjectReferenceTemplate.diff
+ *
+ * The code left in ObjectReferenceTemplateC.{h,i,cpp} is ready for use.
+ *
+ */
+
+// File: ObjectReferenceTemplate.idl
+
+#ifndef _OBJECT_REFERENCE_TEMPLATE_IDL_
+#define _OBJECT_REFERENCE_TEMPLATE_IDL_
+
+#include "tao/PI_Forward.pidl"
+
+module PortableInterceptor
+{
+ typeprefix PortableInterceptor "omg.org";
+
+ abstract valuetype ObjectReferenceFactory {
+ Object make_object (in string repository_id,
+ in ObjectId id);
+ };
+
+ abstract valuetype ObjectReferenceTemplate : ObjectReferenceFactory {
+ readonly attribute ServerId server_id;
+ readonly attribute ORBId orb_id;
+ readonly attribute AdapterName adapter_name;
+ };
+
+ typedef sequence<ObjectReferenceTemplate> ObjectReferenceTemplateSeq;
+};
+
+#endif /* _OBJECT_REFERENCE_TEMPLATE_IDL_ */
diff --git a/TAO/tao/ObjRefTemplate/ObjectReferenceTemplateA.h b/TAO/tao/ObjRefTemplate/ObjectReferenceTemplateA.h
new file mode 100644
index 00000000000..e543e41332e
--- /dev/null
+++ b/TAO/tao/ObjRefTemplate/ObjectReferenceTemplateA.h
@@ -0,0 +1,3 @@
+// $Id$
+// This file deliberately empty. See bugzilla #2549.
+
diff --git a/TAO/tao/ObjRefTemplate/ObjectReferenceTemplate_i.cpp b/TAO/tao/ObjRefTemplate/ObjectReferenceTemplate_i.cpp
new file mode 100644
index 00000000000..5aade26a354
--- /dev/null
+++ b/TAO/tao/ObjRefTemplate/ObjectReferenceTemplate_i.cpp
@@ -0,0 +1,80 @@
+#include "tao/ObjRefTemplate/ObjectReferenceTemplate_i.h"
+#include "tao/PortableServer/Root_POA.h"
+
+#include "tao/CORBA_String.h"
+#include "tao/ORB_Constants.h"
+
+ACE_RCSID (ORT,
+ ObjectReferenceTemplate_i,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ ObjectReferenceTemplate::ObjectReferenceTemplate (
+ const char *server_id,
+ const char *orb_id,
+ PortableInterceptor::AdapterName *adapter_name,
+ PortableServer::POA_ptr poa)
+ : server_id_ (server_id),
+ orb_id_ (orb_id),
+ adapter_name_ (adapter_name),
+ poa_ (PortableServer::POA::_duplicate (poa))
+ {
+ }
+
+ ObjectReferenceTemplate::~ObjectReferenceTemplate (void)
+ {
+ }
+
+ char *
+ ObjectReferenceTemplate::server_id (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ return CORBA::string_dup (this->server_id_);
+ }
+
+ char *
+ ObjectReferenceTemplate::orb_id (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ return CORBA::string_dup (this->orb_id_);
+ }
+
+ PortableInterceptor::AdapterName *
+ ObjectReferenceTemplate::adapter_name (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ PortableInterceptor::AdapterName *adapter_name = 0;
+
+ ACE_NEW_THROW_EX (adapter_name,
+ PortableInterceptor::AdapterName (
+ *(this->adapter_name_)),
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (0);
+
+ return adapter_name;
+ }
+
+ CORBA::Object_ptr
+ ObjectReferenceTemplate::make_object (
+ const char *,
+ const PortableInterceptor::ObjectId &
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ if (CORBA::is_nil(poa_.in()))
+ ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (), CORBA::Object::_nil ());
+
+ TAO_Root_POA* tao_poa = dynamic_cast<TAO_Root_POA*>(poa_.in());
+
+ return tao_poa->invoke_key_to_object (ACE_ENV_SINGLE_ARG_PARAMETER);
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/ObjRefTemplate/ObjectReferenceTemplate_i.h b/TAO/tao/ObjRefTemplate/ObjectReferenceTemplate_i.h
new file mode 100644
index 00000000000..cb19700492a
--- /dev/null
+++ b/TAO/tao/ObjRefTemplate/ObjectReferenceTemplate_i.h
@@ -0,0 +1,124 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file ObjectReferenceTemplate_i.h
+ *
+ * $Id$
+ *
+ * This is the implementation of the
+ * PortableInterceptor::ObjectReferenceTemplate ValueType.
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_OBJECT_REFERENCE_TEMPLATE_I_H
+#define TAO_OBJECT_REFERENCE_TEMPLATE_I_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/ObjRefTemplate/ort_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/ObjRefTemplate/Default_ORTC.h"
+#include "tao/SystemException.h"
+
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace PortableServer
+{
+ class POA;
+
+ typedef POA *POA_ptr;
+ typedef TAO_Objref_Var_T<POA> POA_var;
+}
+
+namespace TAO
+{
+ /**
+ * @class ObjectReferenceTemplate
+ *
+ * @brief Implementation of the PortableInterceptor::ObjectReferenceTemplate
+ * interface. This is a default implementation created to be returned
+ * by the IORInfo when the user requests the ORT or ORF.
+ */
+ class ObjectReferenceTemplate
+ : public virtual OBV_TAO_Default_ORT::ObjectReferenceTemplate,
+ public virtual CORBA::DefaultValueRefCountBase
+ {
+ public:
+ /// Constructor
+ ObjectReferenceTemplate (const char *server_id,
+ const char *orb_id,
+ PortableInterceptor::AdapterName *adapter_name,
+ PortableServer::POA_ptr poa);
+
+ /**
+ * @name PortableInterceptor::ObjectReferenceTemplate Methods
+ *
+ * Methods required by the
+ * PortableInterceptor::ObjectReferenceTemplate ValueType.
+ */
+ //@{
+ virtual char * server_id (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual char * orb_id (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual PortableInterceptor::AdapterName * adapter_name (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+ //@}
+
+ /**
+ * @name PortableInterceptor::ObjectReferenceFactory Methods
+ *
+ * Methods required by the
+ * PortableInterceptor::ObjectReferenceFactory ValueType.
+ */
+ //@{
+ virtual CORBA::Object_ptr make_object (
+ const char * repository_id,
+ const PortableInterceptor::ObjectId & id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+ //@}
+
+ protected:
+
+ /// Destructor
+ /**
+ * Protected destructor to enforce proper memory management via
+ * reference counting.
+ */
+ ~ObjectReferenceTemplate (void);
+
+ private:
+ const char *server_id_;
+ const char *orb_id_;
+ PortableInterceptor::AdapterName_var adapter_name_;
+ PortableServer::POA_var poa_;
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_OBJECT_REFERENCE_TEMPLATE_I_H */
diff --git a/TAO/tao/ObjRefTemplate/ObjectReferenceTemplate_include.pidl b/TAO/tao/ObjRefTemplate/ObjectReferenceTemplate_include.pidl
new file mode 100644
index 00000000000..9e937f9251c
--- /dev/null
+++ b/TAO/tao/ObjRefTemplate/ObjectReferenceTemplate_include.pidl
@@ -0,0 +1,37 @@
+/**
+ * @file ObjectReferenceTemplate_include.pidl
+ *
+ * $Id$
+ *
+ * @brief Include file for use in applications that need ObjectReferenceTemplate.pidl.
+ *
+ * This file just includes ObjectReferenceTemplate.pidl. The *C.h file generated from
+ * this is hand-crafted to itself include ObjectReferenceTemplate.h instead of
+ * ObjectReferenceTemplateC.h (which will produce a compiler error message if
+ * included directly). The ObjectReferenceTemplate_includeC.h file can then be
+ * included directly and automatically by the IDL compiler when
+ * building the application.
+ *
+ * 1. Run the tao_idl compiler on the pidl file. The command used for
+ * this is:
+ *
+ * tao_idl -o orig -St -Sp
+ * -Wb,pre_include="ace/pre.h"
+ * -Wb,post_include="ace/post.h"
+ * ObjectReferenceTemplate_include.pidl
+ *
+ * 2. Then change this line in ObjectReferenceTemplate_includeC.h:
+ *
+ * #include "ObjectReferenceTemplateC.h"
+ *
+ * to
+ *
+ * #include "ObjectReferenceTemplate.h"
+ */
+
+#ifndef _OBJECTREFERENCETEMPLATE_INCLUDE_IDL_
+#define _OBJECTREFERENCETEMPLATE_INCLUDE_IDL_
+
+#include "tao/ObjRefTemplate/ObjectReferenceTemplate.pidl"
+
+#endif /* _OBJECTREFERENCETEMPLATE_INCLUDE_IDL_ */
diff --git a/TAO/tao/ObjRefTemplate/ObjectReferenceTemplate_includeA.h b/TAO/tao/ObjRefTemplate/ObjectReferenceTemplate_includeA.h
new file mode 100644
index 00000000000..fbf583b4fef
--- /dev/null
+++ b/TAO/tao/ObjRefTemplate/ObjectReferenceTemplate_includeA.h
@@ -0,0 +1,66 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:390
+
+#ifndef _TAO_IDL_ORIG_OBJECTREFERENCETEMPLATE_INCLUDEA_H_
+#define _TAO_IDL_ORIG_OBJECTREFERENCETEMPLATE_INCLUDES_H_
+
+#include /**/ "ace/pre.h"
+
+#include "tao/ObjRefTemplate/ObjectReferenceTemplate_includeC.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+#if defined (__BORLANDC__)
+#pragma option push -w-rvl -w-rch -w-ccc -w-inl
+#endif /* __BORLANDC__ */
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:999
+
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#if defined (__BORLANDC__)
+#pragma option pop
+#endif /* __BORLANDC__ */
+
+#include /**/ "ace/post.h"
+#endif /* ifndef */
+
diff --git a/TAO/tao/ObjRefTemplate/ObjectReferenceTemplate_includeC.h b/TAO/tao/ObjRefTemplate/ObjectReferenceTemplate_includeC.h
new file mode 100644
index 00000000000..bef52c5826e
--- /dev/null
+++ b/TAO/tao/ObjRefTemplate/ObjectReferenceTemplate_includeC.h
@@ -0,0 +1,98 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:153
+
+#ifndef _TAO_IDL_ORIG_OBJECTREFERENCETEMPLATE_INCLUDEC_H_
+#define _TAO_IDL_ORIG_OBJECTREFERENCETEMPLATE_INCLUDEC_H_
+
+#include /**/ "ace/pre.h"
+
+
+#include "ace/config-all.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/ObjRefTemplate/ort_export.h"
+#include "tao/ORB.h"
+#include "tao/SystemException.h"
+#include "tao/Environment.h"
+
+#include "tao/ObjRefTemplate/ObjectReferenceTemplate.h"
+
+#if defined (TAO_EXPORT_MACRO)
+#undef TAO_EXPORT_MACRO
+#endif
+#define TAO_EXPORT_MACRO TAO_ORT_Export
+
+#if defined (TAO_EXPORT_NESTED_CLASSES)
+# if defined (TAO_EXPORT_NESTED_MACRO)
+# undef TAO_EXPORT_NESTED_MACRO
+# endif /* defined (TAO_EXPORT_NESTED_MACRO) */
+# define TAO_EXPORT_NESTED_MACRO TAO_ORT_Export
+#endif /* TAO_EXPORT_NESTED_CLASSES */
+
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+#if defined (__BORLANDC__)
+#pragma option push -w-rvl -w-rch -w-ccc -w-inl
+#endif /* __BORLANDC__ */
+
+// TAO_IDL - Generated from
+// be\be_visitor_traits.cpp:59
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Traits specializations.
+namespace TAO
+{
+}
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:963
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#if defined (__BORLANDC__)
+#pragma option pop
+#endif /* __BORLANDC__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* ifndef */
+
+
diff --git a/TAO/tao/ObjRefTemplate/ObjectReferenceTemplate_includeS.h b/TAO/tao/ObjRefTemplate/ObjectReferenceTemplate_includeS.h
new file mode 100644
index 00000000000..65f2ae33b8a
--- /dev/null
+++ b/TAO/tao/ObjRefTemplate/ObjectReferenceTemplate_includeS.h
@@ -0,0 +1,67 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:390
+
+#ifndef _TAO_IDL_ORIG_OBJECTREFERENCETEMPLATE_INCLUDES_H_
+#define _TAO_IDL_ORIG_OBJECTREFERENCETEMPLATE_INCLUDES_H_
+
+#include /**/ "ace/pre.h"
+
+#include "tao/ObjRefTemplate/ObjectReferenceTemplateS.h"
+#include "tao/ObjRefTemplate/ObjectReferenceTemplate_includeC.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+#if defined (__BORLANDC__)
+#pragma option push -w-rvl -w-rch -w-ccc -w-inl
+#endif /* __BORLANDC__ */
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:999
+
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#if defined (__BORLANDC__)
+#pragma option pop
+#endif /* __BORLANDC__ */
+
+#include /**/ "ace/post.h"
+#endif /* ifndef */
+
diff --git a/TAO/tao/ObjRefTemplate/TAO_ObjRefTemplate.pc.in b/TAO/tao/ObjRefTemplate/TAO_ObjRefTemplate.pc.in
new file mode 100644
index 00000000000..0d9b434e777
--- /dev/null
+++ b/TAO/tao/ObjRefTemplate/TAO_ObjRefTemplate.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: TAO_ObjRefTemplate
+Description: TAO ObjRefTemplate Library
+Requires: TAO_PortableServer, TAO_Valuetype, TAO_AnyTypeCode, TAO
+Version: @VERSION@
+Libs: -L${libdir} -lTAO_ObjRefTemplate
+Cflags: -I${includedir}
diff --git a/TAO/tao/ObjRefTemplate/TAO_ObjRefTemplate.rc b/TAO/tao/ObjRefTemplate/TAO_ObjRefTemplate.rc
new file mode 100644
index 00000000000..7a2e46e5c0c
--- /dev/null
+++ b/TAO/tao/ObjRefTemplate/TAO_ObjRefTemplate.rc
@@ -0,0 +1,30 @@
+#include "..\Version.h"
+
+1 VERSIONINFO
+ FILEVERSION TAO_MAJOR_VERSION,TAO_MINOR_VERSION,TAO_BETA_VERSION,0
+ PRODUCTVERSION TAO_MAJOR_VERSION,TAO_MINOR_VERSION,TAO_BETA_VERSION,0
+ FILEFLAGSMASK 0x3fL
+ FILEFLAGS 0x0L
+ FILEOS 0x4L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904B0"
+ BEGIN
+ VALUE "FileDescription", "ObjRefTemplate\0"
+ VALUE "FileVersion", TAO_VERSION "\0"
+ VALUE "InternalName", "TAO_ObjRefTemplateDLL\0"
+ VALUE "LegalCopyright", "\0"
+ VALUE "LegalTrademarks", "\0"
+ VALUE "OriginalFilename", "TAO_ObjRefTemplate.DLL\0"
+ VALUE "ProductName", "TAO\0"
+ VALUE "ProductVersion", TAO_VERSION "\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
diff --git a/TAO/tao/ObjRefTemplate/ort_export.h b/TAO/tao/ObjRefTemplate/ort_export.h
new file mode 100644
index 00000000000..3da9ca420ee
--- /dev/null
+++ b/TAO/tao/ObjRefTemplate/ort_export.h
@@ -0,0 +1,40 @@
+
+// -*- C++ -*-
+// $Id$
+// Definition for Win32 Export directives.
+// This file is generated automatically by generate_export_file.pl
+// ------------------------------
+#ifndef TAO_ORT_EXPORT_H
+#define TAO_ORT_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if defined (TAO_AS_STATIC_LIBS)
+# if !defined (TAO_ORT_HAS_DLL)
+# define TAO_ORT_HAS_DLL 0
+# endif /* ! TAO_ORT_HAS_DLL */
+#else
+# if !defined (TAO_ORT_HAS_DLL)
+# define TAO_ORT_HAS_DLL 1
+# endif /* ! TAO_ORT_HAS_DLL */
+#endif
+
+#if defined (TAO_ORT_HAS_DLL) && (TAO_ORT_HAS_DLL == 1)
+# if defined (TAO_ORT_BUILD_DLL)
+# define TAO_ORT_Export ACE_Proper_Export_Flag
+# define TAO_ORT_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# define TAO_ORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# else /* TAO_ORT_BUILD_DLL */
+# define TAO_ORT_Export ACE_Proper_Import_Flag
+# define TAO_ORT_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# define TAO_ORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# endif /* TAO_ORT_BUILD_DLL */
+#else /* TAO_ORT_HAS_DLL == 1 */
+# define TAO_ORT_Export
+# define TAO_ORT_SINGLETON_DECLARATION(T)
+# define TAO_ORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+#endif /* TAO_ORT_HAS_DLL == 1 */
+
+#endif /* TAO_ORT_EXPORT_H */
+
+// End of auto generated file.
diff --git a/TAO/tao/Object.cpp b/TAO/tao/Object.cpp
new file mode 100644
index 00000000000..deefa4cbf6c
--- /dev/null
+++ b/TAO/tao/Object.cpp
@@ -0,0 +1,1010 @@
+// @(#) $Id$
+//
+// Copyright 1994-1995 by Sun Microsystems Inc.
+// Copyright 1997-2002 by Washington University
+// All Rights Reserved
+//
+// ORB: CORBA::Object operations
+
+#include "tao/Object.h"
+#include "tao/Stub.h"
+#include "tao/Profile.h"
+#include "tao/ORB_Core.h"
+#include "tao/Connector_Registry.h"
+#include "tao/LocateRequest_Invocation_Adapter.h"
+#include "tao/debug.h"
+#include "tao/Dynamic_Adapter.h"
+#include "tao/IFR_Client_Adapter.h"
+#include "tao/Remote_Object_Proxy_Broker.h"
+#include "tao/CDR.h"
+#include "tao/SystemException.h"
+#include "tao/PolicyC.h"
+
+#include "ace/Dynamic_Service.h"
+#include "ace/OS_NS_string.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/Object.i"
+#endif /* ! __ACE_INLINE__ */
+
+
+ACE_RCSID (tao,
+ Object,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+CORBA::Object::~Object (void)
+{
+ if (this->protocol_proxy_)
+ (void) this->protocol_proxy_->_decr_refcnt ();
+
+ delete this->object_init_lock_;
+}
+
+CORBA::Object::Object (TAO_Stub * protocol_proxy,
+ CORBA::Boolean collocated,
+ TAO_Abstract_ServantBase * servant,
+ TAO_ORB_Core *orb_core)
+ : is_local_ (false)
+ , is_evaluated_ (true)
+ , ior_ (0)
+ , orb_core_ (orb_core)
+ , protocol_proxy_ (protocol_proxy)
+ , refcount_ ()
+ , object_init_lock_ (0)
+{
+ /// This constructor should not be called when the protocol proxy is
+ /// null ie. when the object is a LocalObject. Assert that
+ /// requirement.
+ ACE_ASSERT (this->protocol_proxy_ != 0);
+
+ if (this->orb_core_ == 0)
+ this->orb_core_ = this->protocol_proxy_->orb_core ();
+
+ this->object_init_lock_ =
+ this->orb_core_->resource_factory ()->create_corba_object_lock ();
+
+ this->refcount_ =
+ this->orb_core_->resource_factory ()->create_corba_object_refcount ();
+
+ // Set the collocation marker on the stub. This may not be news to it.
+ // This may also change the stub's object proxy broker.
+ this->protocol_proxy_->is_collocated (collocated);
+
+ // Set the collocated servant pointer (null if not collocated) on the stub.
+ this->protocol_proxy_->collocated_servant (servant);
+}
+
+CORBA::Object::Object (IOP::IOR *ior,
+ TAO_ORB_Core *orb_core)
+ : is_local_ (false)
+ , is_evaluated_ (false)
+ , ior_ (ior)
+ , orb_core_ (orb_core)
+ , protocol_proxy_ (0)
+ , refcount_ ()
+ , object_init_lock_ (0)
+{
+ this->object_init_lock_ =
+ this->orb_core_->resource_factory ()->create_corba_object_lock ();
+
+ this->refcount_ =
+ this->orb_core_->resource_factory ()->create_corba_object_refcount ();
+}
+
+// Too lazy to do this check in every method properly! This is useful
+// only for lazily evaluated IOR's
+#define TAO_OBJECT_IOR_EVALUATE \
+if (!this->is_evaluated_) \
+ { \
+ ACE_GUARD (ACE_Lock , mon, *this->object_init_lock_); \
+ if (!this->is_evaluated_) \
+ CORBA::Object::tao_object_initialize (this); \
+ }
+
+#define TAO_OBJECT_IOR_EVALUATE_RETURN \
+if (!this->is_evaluated_) \
+ { \
+ ACE_GUARD_RETURN (ACE_Lock , mon, *this->object_init_lock_, 0); \
+ if (!this->is_evaluated_) \
+ CORBA::Object::tao_object_initialize (this); \
+ }
+
+void
+CORBA::Object::_add_ref (void)
+{
+ if (this->is_local_)
+ return;
+
+ this->refcount_.increment ();
+}
+
+void
+CORBA::Object::_remove_ref (void)
+{
+ if (this->is_local_)
+ return;
+
+ if (this->refcount_.decrement () != 0)
+ return;
+
+ delete this;
+}
+
+void
+CORBA::Object::_tao_any_destructor (void *x)
+{
+ CORBA::Object_ptr tmp = static_cast<CORBA::Object_ptr> (x);
+ ::CORBA::release (tmp);
+}
+
+// virtual -- do not inline
+CORBA::Boolean
+CORBA::Object::marshal (TAO_OutputCDR &cdr)
+{
+ return (cdr << this);
+}
+
+/*static*/ CORBA::Boolean
+CORBA::Object::marshal (const CORBA::Object_ptr x,
+ TAO_OutputCDR &cdr)
+{
+ if (x == 0)
+ {
+ // NIL objrefs ... marshal as empty type hint, no elements.
+ cdr.write_ulong (1);
+ cdr.write_char ('\0');
+ cdr.write_ulong (0);
+ return (CORBA::Boolean) cdr.good_bit ();
+ }
+
+ return x->marshal (cdr);
+}
+
+
+TAO_Abstract_ServantBase*
+CORBA::Object::_servant (void) const
+{
+ if (this->protocol_proxy_ == 0)
+ {
+ // No stub set. Should not happen.
+ return 0;
+ }
+
+ return this->protocol_proxy_->collocated_servant ();
+}
+
+// IS_A ... ask the object if it's an instance of the type whose
+// logical type ID is passed as a parameter.
+
+CORBA::Boolean
+CORBA::Object::_is_a (const char *type_id
+ ACE_ENV_ARG_DECL)
+{
+ TAO_OBJECT_IOR_EVALUATE_RETURN;
+
+ // NOTE: if istub->type_id is nonzero and we have local knowledge of
+ // it, we can answer this question without a costly remote call.
+ //
+ // That "local knowledge" could come from stubs or skeletons linked
+ // into this process in the best case, or a "near" repository in a
+ // slightly worse case. Or in a trivial case, if the ID being asked
+ // about is the ID we have recorded, we don't need to ask about the
+ // inheritance relationships at all!
+ //
+ // In real systems having local knowledge will be common, though as
+ // the systems built atop ORBs become richer it'll also become
+ // common to have the "real type ID" not be directly understood
+ // because it's more deeply derived than any locally known types.
+ //
+ // XXX if type_id is that of CORBA::Object, "yes, we comply" :-)
+
+ if (this->protocol_proxy_ == 0)
+ ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), false);
+
+ if (this->_stubobj ()->type_id.in () != 0
+ && ACE_OS::strcmp (type_id,
+ this->_stubobj ()->type_id.in ()) == 0)
+ return true;
+
+ return this->proxy_broker ()->_is_a (this,
+ type_id
+ ACE_ENV_ARG_PARAMETER);
+}
+
+const char*
+CORBA::Object::_interface_repository_id (void) const
+{
+ return "IDL:omg.org/CORBA/Object:1.0";
+}
+
+CORBA::Boolean
+CORBA::Object::_is_collocated (void) const
+{
+ if (this->protocol_proxy_)
+ {
+ return this->protocol_proxy_->is_collocated ();
+ }
+
+ return false;
+}
+
+void
+CORBA::Object::set_collocated_servant (TAO_Abstract_ServantBase *b)
+{
+ this->protocol_proxy_->collocated_servant (b);
+ this->protocol_proxy_->is_collocated (true);
+}
+
+CORBA::Boolean
+CORBA::Object::_is_local (void) const
+{
+ return this->is_local_;
+}
+
+TAO_Stub *
+CORBA::Object::_stubobj (void) const
+{
+ return this->protocol_proxy_;
+}
+
+TAO_Stub *
+CORBA::Object::_stubobj (void)
+{
+ TAO_OBJECT_IOR_EVALUATE_RETURN;
+ return this->protocol_proxy_;
+}
+
+CORBA::ULong
+CORBA::Object::_hash (CORBA::ULong maximum
+ ACE_ENV_ARG_DECL)
+{
+ TAO_OBJECT_IOR_EVALUATE_RETURN;
+
+ if (this->protocol_proxy_ != 0)
+ return this->protocol_proxy_->hash (maximum ACE_ENV_ARG_PARAMETER);
+ else
+ {
+ // Locality-constrained object.
+
+ // Note that we reinterpret_cast to an "unsigned long" instead
+ // of CORBA::ULong since we need to first cast to an integer
+ // large enough to hold an address to avoid compile-time
+ // warnings on some 64-bit platforms.
+ const CORBA::ULong hash =
+ static_cast<CORBA::ULong> (reinterpret_cast<ptrdiff_t> (this));
+
+ return hash % maximum;
+ }
+}
+
+CORBA::Boolean
+CORBA::Object::_is_equivalent (CORBA::Object_ptr other_obj
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC (())
+{
+ if (other_obj == this)
+ {
+ return true;
+ }
+
+ TAO_OBJECT_IOR_EVALUATE_RETURN;
+
+ if (this->protocol_proxy_ != 0)
+ return this->protocol_proxy_->is_equivalent (other_obj);
+
+ return false;
+}
+
+// TAO's extensions
+
+TAO::ObjectKey *
+CORBA::Object::_key (ACE_ENV_SINGLE_ARG_DECL)
+{
+ TAO_OBJECT_IOR_EVALUATE_RETURN;
+
+ if (this->_stubobj () && this->_stubobj ()->profile_in_use ())
+ return this->_stubobj ()->profile_in_use ()->_key ();
+
+ if (TAO_debug_level > 2)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) Null object key return from ")
+ ACE_TEXT ("profile in use\n")));
+ }
+
+ ACE_THROW_RETURN (CORBA::INTERNAL (
+ CORBA::SystemException::_tao_minor_code (
+ 0,
+ EINVAL),
+ CORBA::COMPLETED_NO),
+ 0);
+}
+
+void
+CORBA::Object::_proxy_broker (TAO::Object_Proxy_Broker *proxy_broker)
+{
+ this->protocol_proxy_->object_proxy_broker (proxy_broker);
+}
+
+CORBA::Boolean
+CORBA::Object::is_nil_i (CORBA::Object_ptr obj)
+{
+ // If the profile length is zero for a non-evaluted IOR it is a
+ // null-object.
+ if ((!obj->is_evaluated ()) &&
+ obj->ior ().profiles.length () == 0)
+ return true;
+
+ // To accomodate new definitions.
+ if (obj->orb_core_)
+ {
+ return obj->orb_core_->object_is_nil (obj);
+ }
+
+ return false;
+}
+
+
+
+#if (TAO_HAS_MINIMUM_CORBA == 0)
+
+#if !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
+void
+CORBA::Object::_create_request (CORBA::Context_ptr ctx,
+ const char *operation,
+ CORBA::NVList_ptr arg_list,
+ CORBA::NamedValue_ptr result,
+ CORBA::Request_ptr &request,
+ CORBA::Flags req_flags
+ ACE_ENV_ARG_DECL)
+{
+ TAO_OBJECT_IOR_EVALUATE;
+
+ // Since we don't really support Context, anything but a null pointer
+ // is a no-no.
+ // Neither can we create a request object from locality constrained
+ // object references.
+ if (ctx != 0 || this->protocol_proxy_ == 0)
+ {
+ ACE_THROW (CORBA::NO_IMPLEMENT ());
+ }
+
+ TAO_Dynamic_Adapter *dynamic_adapter =
+ ACE_Dynamic_Service<TAO_Dynamic_Adapter>::instance (
+ TAO_ORB_Core::dynamic_adapter_name ()
+ );
+
+ dynamic_adapter->create_request (
+ this,
+ this->protocol_proxy_->orb_core ()-> orb (),
+ operation,
+ arg_list,
+ result,
+ 0,
+ request,
+ req_flags
+ ACE_ENV_ARG_PARAMETER
+ );
+}
+#endif
+
+#if !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
+void
+CORBA::Object::_create_request (CORBA::Context_ptr ctx,
+ const char *operation,
+ CORBA::NVList_ptr arg_list,
+ CORBA::NamedValue_ptr result,
+ CORBA::ExceptionList_ptr exceptions,
+ CORBA::ContextList_ptr,
+ CORBA::Request_ptr &request,
+ CORBA::Flags req_flags
+ ACE_ENV_ARG_DECL)
+{
+ TAO_OBJECT_IOR_EVALUATE;
+
+ // Since we don't really support Context, anything but a null pointer
+ // is a no-no.
+ // Neither can we create a request object from locality constrained
+ // object references.
+ if (ctx != 0 || this->protocol_proxy_ == 0)
+ {
+ ACE_THROW (CORBA::NO_IMPLEMENT ());
+ }
+
+ TAO_Dynamic_Adapter *dynamic_adapter =
+ ACE_Dynamic_Service<TAO_Dynamic_Adapter>::instance (
+ TAO_ORB_Core::dynamic_adapter_name ()
+ );
+
+ dynamic_adapter->create_request (
+ this,
+ this->protocol_proxy_->orb_core ()-> orb (),
+ operation,
+ arg_list,
+ result,
+ exceptions,
+ request,
+ req_flags
+ ACE_ENV_ARG_PARAMETER
+ );
+}
+#endif
+
+CORBA::Request_ptr
+CORBA::Object::_request (const char *operation
+ ACE_ENV_ARG_DECL)
+{
+ TAO_OBJECT_IOR_EVALUATE_RETURN;
+ if (this->protocol_proxy_)
+ {
+ TAO_Dynamic_Adapter *dynamic_adapter =
+ ACE_Dynamic_Service<TAO_Dynamic_Adapter>::instance (
+ TAO_ORB_Core::dynamic_adapter_name ()
+ );
+
+ return dynamic_adapter->request (
+ this,
+ this->protocol_proxy_->orb_core ()->orb (),
+ operation
+ ACE_ENV_ARG_PARAMETER
+ );
+ }
+ else
+ {
+ ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (),
+ 0);
+ }
+}
+
+// NON_EXISTENT ... send a simple call to the object, which will
+// either elicit a false response or a OBJECT_NOT_EXIST exception. In
+// the latter case, return true.
+
+CORBA::Boolean
+CORBA::Object::_non_existent (ACE_ENV_SINGLE_ARG_DECL)
+{
+ TAO_OBJECT_IOR_EVALUATE_RETURN;
+
+ CORBA::Boolean retval = false;
+
+ ACE_TRY
+ {
+ retval = this->proxy_broker ()->_non_existent (this
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCH (CORBA::OBJECT_NOT_EXIST, ex)
+ {
+ retval = true;
+ }
+ ACE_CATCHANY
+ {
+ ACE_RE_THROW;
+ }
+ ACE_ENDTRY;
+ ACE_CHECK_RETURN (retval);
+
+ return retval;
+}
+
+
+CORBA::InterfaceDef_ptr
+CORBA::Object::_get_interface (ACE_ENV_SINGLE_ARG_DECL)
+{
+ TAO_OBJECT_IOR_EVALUATE_RETURN;
+ return this->proxy_broker ()->_get_interface (this
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::ImplementationDef_ptr
+CORBA::Object::_get_implementation (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+{
+ return 0;
+}
+
+CORBA::Object_ptr
+CORBA::Object::_get_component (ACE_ENV_SINGLE_ARG_DECL)
+{
+ TAO_OBJECT_IOR_EVALUATE_RETURN;
+ return this->proxy_broker ()->_get_component (this
+ ACE_ENV_ARG_PARAMETER);
+}
+
+char*
+CORBA::Object::_repository_id (ACE_ENV_SINGLE_ARG_DECL)
+{
+ TAO_OBJECT_IOR_EVALUATE_RETURN;
+ return this->proxy_broker ()->_repository_id (this
+ ACE_ENV_ARG_PARAMETER);
+}
+
+#endif /* TAO_HAS_MINIMUM_CORBA */
+
+// ****************************************************************
+
+// @@ Does it make sense to support policy stuff for locality constrained
+// objects? Also, does it make sense to bind policies with stub object?
+// - nw.
+
+#if (TAO_HAS_CORBA_MESSAGING == 1)
+
+CORBA::Policy_ptr
+CORBA::Object::_get_policy (
+ CORBA::PolicyType type
+ ACE_ENV_ARG_DECL)
+{
+ TAO_OBJECT_IOR_EVALUATE_RETURN;
+
+ if (this->protocol_proxy_)
+ return this->protocol_proxy_->get_policy (type
+ ACE_ENV_ARG_PARAMETER);
+ else
+ ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), CORBA::Policy::_nil ());
+}
+
+CORBA::Policy_ptr
+CORBA::Object::_get_cached_policy (
+ TAO_Cached_Policy_Type type
+ ACE_ENV_ARG_DECL)
+{
+ TAO_OBJECT_IOR_EVALUATE_RETURN;
+
+ if (this->protocol_proxy_)
+ return this->protocol_proxy_->get_cached_policy (type
+ ACE_ENV_ARG_PARAMETER);
+ else
+ ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), CORBA::Policy::_nil ());
+}
+
+CORBA::Object_ptr
+CORBA::Object::_set_policy_overrides (
+ const CORBA::PolicyList & policies,
+ CORBA::SetOverrideType set_add
+ ACE_ENV_ARG_DECL)
+{
+ TAO_OBJECT_IOR_EVALUATE_RETURN;
+
+ if (!this->protocol_proxy_)
+ ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), CORBA::Policy::_nil ());
+
+ TAO_Stub* stub =
+ this->protocol_proxy_->set_policy_overrides (policies,
+ set_add
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Object::_nil ());
+
+ TAO_Stub_Auto_Ptr safe_stub (stub);
+
+ CORBA::Object_ptr obj = CORBA::Object::_nil ();
+
+ ACE_NEW_THROW_EX (obj,
+ CORBA::Object (stub,
+ this->_is_collocated ()),
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ 0,
+ ENOMEM),
+ CORBA::COMPLETED_MAYBE));
+ ACE_CHECK_RETURN (CORBA::Object::_nil ());
+
+ (void) safe_stub.release ();
+
+ return obj;
+}
+
+CORBA::PolicyList *
+CORBA::Object::_get_policy_overrides (const CORBA::PolicyTypeSeq & types
+ ACE_ENV_ARG_DECL)
+{
+ TAO_OBJECT_IOR_EVALUATE_RETURN;
+ if (this->protocol_proxy_)
+ return this->protocol_proxy_->get_policy_overrides (types
+ ACE_ENV_ARG_PARAMETER);
+ else
+ ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0);
+}
+
+CORBA::Boolean
+CORBA::Object::_validate_connection (
+ CORBA::PolicyList_out inconsistent_policies
+ ACE_ENV_ARG_DECL)
+{
+ TAO_OBJECT_IOR_EVALUATE_RETURN;
+
+ inconsistent_policies = 0;
+
+ CORBA::Boolean retval = 0;
+
+#if (TAO_HAS_MINIMUM_CORBA == 1)
+
+ ACE_ENV_ARG_NOT_USED; // FUZZ: ignore check_for_ace_check
+
+ retval = false;
+#else
+
+ // If the object is collocated then use non_existent to see whether
+ // it's there.
+ if (this->_is_collocated ())
+ return !(this->_non_existent (ACE_ENV_SINGLE_ARG_PARAMETER));
+
+ TAO::LocateRequest_Invocation_Adapter tao_call (this);
+ ACE_TRY
+ {
+ tao_call.invoke (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCH (CORBA::INV_POLICY, ex)
+ {
+ inconsistent_policies =
+ tao_call.get_inconsistent_policies ();
+ retval = false;
+ }
+ ACE_CATCHANY
+ {
+ ACE_RE_THROW;
+ }
+ ACE_ENDTRY;
+ ACE_CHECK_RETURN (false);
+
+ retval = true;
+#endif /* TAO_HAS_MINIMUM_CORBA */
+
+ return retval;
+}
+
+#endif /* TAO_HAS_CORBA_MESSAGING == 1 */
+
+
+CORBA::ORB_ptr
+CORBA::Object::_get_orb (ACE_ENV_SINGLE_ARG_DECL)
+{
+ if (this->orb_core_ != 0)
+ {
+ return CORBA::ORB::_duplicate (this->orb_core_->orb ());
+ }
+ else
+ {
+ TAO_OBJECT_IOR_EVALUATE_RETURN;
+ if (this->protocol_proxy_)
+ return CORBA::ORB::_duplicate (this->protocol_proxy_->orb_core ()->orb ());
+ else
+ ACE_THROW_RETURN (CORBA::INTERNAL (), CORBA::ORB::_nil());
+ }
+}
+
+TAO::Object_Proxy_Broker *
+CORBA::Object::proxy_broker (void) const
+{
+ // Paranoid check. We *should* never access the proxy_broker
+ // when the object has not been initialised so there *should*
+ // alway be a stub, but just in case...
+
+ if (this->protocol_proxy_)
+ {
+ return this->protocol_proxy_->object_proxy_broker ();
+ }
+
+ // We have no stub. We cannot be collocated.
+ return the_tao_remote_object_proxy_broker ();
+}
+
+/*****************************************************************
+ * Global Functions
+ ****************************************************************/
+
+CORBA::Boolean
+operator<< (TAO_OutputCDR& cdr, const CORBA::Object* x)
+{
+ if (x == 0)
+ {
+ // NIL objrefs ... marshal as empty type hint, no elements.
+ cdr.write_ulong (1);
+ cdr.write_char ('\0');
+ cdr.write_ulong (0);
+ return (CORBA::Boolean) cdr.good_bit ();
+ }
+
+ if (!x->is_evaluated ())
+ {
+ // @@ This is too inefficient. Need to speed this up if this is
+ // a bottle neck.
+ cdr << const_cast<IOP::IOR &> (x->ior ());
+ return cdr.good_bit ();
+ }
+
+ TAO_Stub *stubobj = x->_stubobj ();
+
+ if (stubobj == 0)
+ return false;
+
+ return (stubobj->marshal (cdr));
+}
+
+/*static*/ void
+CORBA::Object::tao_object_initialize (CORBA::Object *obj)
+{
+ CORBA::ULong const profile_count =
+ obj->ior_->profiles.length ();
+
+ // Assumption is that after calling this method, folks should test
+ // for protocol_proxy_ or whatever to make sure that things have
+ // been initialized!
+ if (profile_count == 0)
+ return;
+
+ // get a profile container to store all profiles in the IOR.
+ TAO_MProfile mp (profile_count);
+
+ TAO_ORB_Core *&orb_core = obj->orb_core_;
+ if (orb_core == 0)
+ {
+ orb_core = TAO_ORB_Core_instance ();
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_WARNING,
+ ACE_TEXT ("TAO (%P|%t) - Object::tao_object_initialize ")
+ ACE_TEXT ("WARNING: extracting object from ")
+ ACE_TEXT ("default ORB_Core\n")));
+ }
+ }
+
+ TAO_Stub *objdata = 0;
+
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ TAO_Connector_Registry *connector_registry =
+ orb_core->connector_registry (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ for (CORBA::ULong i = 0; i != profile_count; ++i)
+ {
+ IOP::TaggedProfile &tpfile =
+ obj->ior_->profiles[i];
+
+ // NOTE: This is a place for optimizations. Here we have an
+ // 2 allocations and 2 copies. Future optimizations should
+ // target this place.
+ TAO_OutputCDR o_cdr;
+
+ o_cdr << tpfile;
+
+ TAO_InputCDR cdr (o_cdr,
+ orb_core->input_cdr_buffer_allocator (),
+ orb_core->input_cdr_dblock_allocator (),
+ orb_core->input_cdr_msgblock_allocator (),
+ orb_core);
+
+ TAO_Profile *pfile =
+ connector_registry->create_profile (cdr);
+
+ if (pfile != 0)
+ mp.give_profile (pfile);
+ }
+
+ // Make sure we got some profiles!
+ if (mp.profile_count () != profile_count)
+ {
+ // @@ This occurs when profile creation fails when decoding the
+ // profile from the IOR.
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) ERROR: XXXXX Could not create all ")
+ ACE_TEXT ("profiles while extracting object\n")
+ ACE_TEXT ("TAO (%P|%t) ERROR: reference from the ")
+ ACE_TEXT ("CDR stream.\n")));
+ }
+
+
+ objdata =
+ orb_core->create_stub (obj->ior_->type_id.in (),
+ mp
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ if (TAO_debug_level > 0)
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ ACE_TEXT ("TAO - ERROR creating stub ")
+ ACE_TEXT ("object when demarshaling object ")
+ ACE_TEXT ("reference."));
+
+ return;
+ }
+ ACE_ENDTRY;
+ ACE_CHECK;
+
+ TAO_Stub_Auto_Ptr safe_objdata (objdata);
+
+ // This call will set the stub proxy broker if necessary
+ if (orb_core->initialize_object (safe_objdata.get (),
+ obj) == -1)
+ return;
+
+ obj->protocol_proxy_ = objdata;
+
+ obj->is_evaluated_ = true;
+
+ // Release the contents of the ior to keep memory consumption down.
+ obj->ior_ = 0;
+
+ // Transfer ownership to the CORBA::Object
+ (void) safe_objdata.release ();
+ return;
+}
+
+CORBA::Boolean
+operator>> (TAO_InputCDR& cdr, CORBA::Object*& x)
+{
+ bool lazy_strategy = false;
+ TAO_ORB_Core *orb_core = cdr.orb_core ();
+
+ if (orb_core == 0)
+ {
+ orb_core = TAO_ORB_Core_instance ();
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_WARNING,
+ ACE_TEXT ("TAO (%P|%t) WARNING: extracting object from ")
+ ACE_TEXT ("default ORB_Core\n")));
+ }
+ }
+ else
+ {
+ if (orb_core->resource_factory ()->resource_usage_strategy () ==
+ TAO_Resource_Factory::TAO_LAZY)
+ lazy_strategy = true;
+ }
+
+ if (!lazy_strategy)
+ {
+ // If the user has set up a eager strategy..
+ CORBA::String_var type_hint;
+
+ if ((cdr >> type_hint.inout ()) == 0)
+ return 0;
+
+ CORBA::ULong profile_count;
+ if ((cdr >> profile_count) == 0)
+ return 0;
+
+ if (profile_count == 0)
+ {
+ x = CORBA::Object::_nil ();
+ return (CORBA::Boolean) cdr.good_bit ();
+ }
+
+ // get a profile container to store all profiles in the IOR.
+ TAO_MProfile mp (profile_count);
+
+ TAO_ORB_Core *orb_core = cdr.orb_core ();
+ if (orb_core == 0)
+ {
+ orb_core = TAO_ORB_Core_instance ();
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_WARNING,
+ ACE_TEXT ("TAO (%P|%t) - Object::tao_object_initialize ")
+ ACE_TEXT ("WARNING: extracting object from ")
+ ACE_TEXT ("default ORB_Core\n")));
+ }
+ }
+
+ // Ownership of type_hint is given to TAO_Stub
+ // TAO_Stub will make a copy of mp!
+
+ TAO_Stub *objdata = 0;
+
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ TAO_Connector_Registry *connector_registry =
+ orb_core->connector_registry (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ for (CORBA::ULong i = 0; i != profile_count && cdr.good_bit (); ++i)
+ {
+ TAO_Profile *pfile =
+ connector_registry->create_profile (cdr);
+ if (pfile != 0)
+ mp.give_profile (pfile);
+ }
+
+ // Make sure we got some profiles!
+ if (mp.profile_count () != profile_count)
+ {
+ // @@ This occurs when profile creation fails when decoding the
+ // profile from the IOR.
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) ERROR: Could not create all ")
+ ACE_TEXT ("profiles while extracting object\n")
+ ACE_TEXT ("TAO (%P|%t) ERROR: reference from the ")
+ ACE_TEXT ("CDR stream.\n")),
+ 0);
+ }
+
+
+ objdata = orb_core->create_stub (type_hint.in (),
+ mp
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ if (TAO_debug_level > 0)
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ ACE_TEXT ("TAO - ERROR creating stub ")
+ ACE_TEXT ("object when demarshaling object ")
+ ACE_TEXT ("reference.\n"));
+
+ return 0;
+ }
+ ACE_ENDTRY;
+ ACE_CHECK_RETURN (0);
+
+ TAO_Stub_Auto_Ptr safe_objdata (objdata);
+
+ x = orb_core->create_object (safe_objdata.get ());
+ if (x == 0)
+ return 0;
+
+ // Transfer ownership to the CORBA::Object
+ (void) safe_objdata.release ();
+ }
+ else
+ {
+ // Lazy strategy!
+ IOP::IOR *ior = 0;
+
+ ACE_NEW_RETURN (ior,
+ IOP::IOR (),
+ 0);
+
+ cdr >> *ior;
+ ACE_NEW_RETURN (x,
+ CORBA::Object (ior,
+ orb_core),
+ 0);
+ }
+
+ return (CORBA::Boolean) cdr.good_bit ();
+}
+
+
+// =========================================================
+// Traits specializations for CORBA::Object.
+namespace TAO
+{
+ CORBA::Object_ptr
+ Objref_Traits<CORBA::Object>::duplicate (CORBA::Object_ptr p)
+ {
+ return CORBA::Object::_duplicate (p);
+ }
+
+ void
+ Objref_Traits<CORBA::Object>::release (CORBA::Object_ptr p)
+ {
+ ::CORBA::release (p);
+ }
+
+ CORBA::Object_ptr
+ Objref_Traits<CORBA::Object>::nil (void)
+ {
+ return CORBA::Object::_nil ();
+ }
+
+ CORBA::Boolean
+ Objref_Traits<CORBA::Object>::marshal (const CORBA::Object_ptr p,
+ TAO_OutputCDR & cdr)
+ {
+ return p->marshal (cdr);
+ }
+} // close TAO namespace
+
+
+TAO::Object_Proxy_Broker * (*_TAO_Object_Proxy_Broker_Factory_function_pointer) (void) = 0;
+
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Object.h b/TAO/tao/Object.h
new file mode 100644
index 00000000000..a10bdb679de
--- /dev/null
+++ b/TAO/tao/Object.h
@@ -0,0 +1,465 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Object.h
+ *
+ * $Id$
+ *
+ * A "Object" is an entity that can be the target of an invocation
+ * using an ORB. All CORBA objects provide this functionality.
+ * See the CORBA 3.x specification for details.
+ *
+ * @author Portions Copyright 1994-1995 by Sun Microsystems Inc.
+ * @author Portions Copyright 1997-2002 by Washington University
+ */
+//=============================================================================
+
+#ifndef TAO_CORBA_OBJECT_H
+#define TAO_CORBA_OBJECT_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/IOP_IORC.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/CORBA_methods.h"
+#include "tao/Policy_ForwardC.h"
+#include "tao/Pseudo_VarOut_T.h"
+#include "tao/Object_Argument_T.h"
+#include "tao/Arg_Traits_T.h"
+#include "tao/Any_Insert_Policy_T.h"
+#include "tao/Configurable_Refcount.h"
+
+#if defined (HPUX) && defined (IOR)
+ /* HP-UX 11.11 defines IOR in /usr/include/pa/inline.h
+ and we don't want that definition. See IOP_IORC.h. */
+# undef IOR
+#endif /* HPUX && IOR */
+
+ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+class ACE_Lock;
+ACE_END_VERSIONED_NAMESPACE_DECL
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Stub;
+class TAO_Abstract_ServantBase;
+class TAO_ORB_Core;
+
+namespace TAO
+{
+ class ObjectKey;
+ class Object_Proxy_Broker;
+}
+
+namespace CORBA
+{
+ class InterfaceDef;
+ typedef InterfaceDef *InterfaceDef_ptr;
+
+ class ImplementationDef;
+ typedef ImplementationDef *ImplementationDef_ptr;
+
+ class Context;
+ typedef Context *Context_ptr;
+
+ class Request;
+ typedef Request *Request_ptr;
+
+ class NVList;
+ typedef NVList *NVList_ptr;
+
+ class NamedValue;
+ typedef NamedValue * NamedValue_ptr;
+
+ typedef ULong Flags;
+
+ class ExceptionList;
+ typedef ExceptionList *ExceptionList_ptr;
+
+ class ContextList;
+ typedef ContextList *ContextList_ptr;
+
+ class Object;
+ typedef Object *Object_ptr;
+ typedef TAO_Pseudo_Var_T<Object> Object_var;
+ typedef TAO_Pseudo_Out_T<Object> Object_out;
+
+ /**
+ * @class Object
+ *
+ * @brief Implementation of a CORBA object reference.
+ *
+ * All CORBA objects, both unconstrained and locality-constrained,
+ * inherit from this class. The interface is defined in the CORBA
+ * specification and the C++ mapping.
+ */
+ class TAO_Export Object
+ {
+ public:
+
+ /// Destructor.
+ virtual ~Object (void);
+
+ /**
+ * @name Spec defined methods
+ *
+ * These methods are defined here since they are required by the
+ * CORBA spec in a form specified by the C++ mapping.
+ */
+ //@{
+ /// Increment the ref count.
+ static CORBA::Object_ptr _duplicate (CORBA::Object_ptr obj);
+
+ /// Return a NULL object.
+ static CORBA::Object_ptr _nil (void);
+
+ /// No-op it is just here to simplify some templates.
+ static CORBA::Object_ptr _narrow (CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ // These calls correspond to over-the-wire operations, or at least
+ // do so in many common cases. The normal implementation assumes a
+ // particular simple, efficient, protocol-neutral interface for
+ // making such calls, but may be overridden when it appears
+ // appropriate.
+
+ /// Determine if we are of the type specified by the "logical_type_id"
+ virtual CORBA::Boolean _is_a (const char *logical_type_id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ /// The repository ID for the most derived class, this is an
+ /// implementation method and does no remote invocations!
+ virtual const char* _interface_repository_id (void) const;
+
+
+ /**
+ * Return a (potentially non-unique) hash value for this object.
+ * This method relies on the representation of the object
+ * reference's private state. Since that changes easily (when
+ * different ORB protocols are in use) there is no default
+ * implementation.
+ */
+ virtual CORBA::ULong _hash (CORBA::ULong maximum
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ /**
+ * Try to determine if this object is the same as other_obj. This
+ * method relies on the representation of the object reference's
+ * private state. Since that changes easily (when different ORB
+ * protocols are in use) there is no default implementation.
+ */
+ virtual CORBA::Boolean _is_equivalent (CORBA::Object_ptr other_obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC (());
+
+#if (TAO_HAS_MINIMUM_CORBA == 0)
+
+ virtual CORBA::Boolean _non_existent (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ );
+
+ /// This method is deprecated in the CORBA 2.2 spec, we just return 0
+ /// every time.
+ virtual CORBA::ImplementationDef_ptr _get_implementation (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ );
+
+ /// Get info about the object from the Interface Repository.
+ virtual InterfaceDef_ptr _get_interface (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ );
+
+ /// Get info about the object from the Interface Repository.
+ virtual CORBA::Object_ptr _get_component (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ );
+
+ /// Get the repository id.
+ virtual char * _repository_id (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ );
+
+#if ! defined (CORBA_E_COMPACT) && ! defined (CORBA_E_MICRO)
+ // DII operations to create a request.
+ //
+ // The mapping for create_request is split into two forms,
+ // corresponding to the two usage styles described in CORBA
+ // section 6.2.1.
+
+ virtual void _create_request (CORBA::Context_ptr ctx,
+ const char *operation,
+ CORBA::NVList_ptr arg_list,
+ CORBA::NamedValue_ptr result,
+ CORBA::Request_ptr &request,
+ CORBA::Flags req_flags
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ virtual void _create_request (CORBA::Context_ptr ctx,
+ const char *operation,
+ CORBA::NVList_ptr arg_list,
+ CORBA::NamedValue_ptr result,
+ CORBA::ExceptionList_ptr exclist,
+ CORBA::ContextList_ptr ctxtlist,
+ CORBA::Request_ptr &request,
+ CORBA::Flags req_flags
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+#endif
+
+ // The default implementation of this method uses the same simple,
+ // multi-protocol remote invocation interface as is assumed by the
+ // calls above ... that's how it can have a default
+ // implementation.
+
+ /// DII operation to create a request.
+ virtual CORBA::Request_ptr _request (const char *operation
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+#endif /* TAO_HAS_MINIMUM_CORBA */
+
+#if (TAO_HAS_CORBA_MESSAGING == 1)
+
+ CORBA::Policy_ptr _get_policy (CORBA::PolicyType type
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ CORBA::Policy_ptr _get_cached_policy (TAO_Cached_Policy_Type type
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ CORBA::Object_ptr _set_policy_overrides (
+ const CORBA::PolicyList & policies,
+ CORBA::SetOverrideType set_add
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ CORBA::PolicyList * _get_policy_overrides (
+ const CORBA::PolicyTypeSeq & types
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ CORBA::Boolean _validate_connection (
+ CORBA::PolicyList_out inconsistent_policies
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+#endif /* TAO_HAS_CORBA_MESSAGING == 1 */
+
+ virtual CORBA::ORB_ptr _get_orb (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ );
+
+ /**
+ * @name Reference Count Managment
+ *
+ * These are the standard CORBA object reference count manipulations
+ * methods.
+ */
+ //@{
+ /// Increment the reference count.
+ virtual void _add_ref (void);
+
+ /// Decrement the reference count.
+ virtual void _remove_ref (void);
+ //@}
+
+ // Useful for template programming.
+ typedef Object_ptr _ptr_type;
+ typedef Object_var _var_type;
+ typedef Object_out _out_type;
+
+ //@} End of CORBA specific methods
+
+
+ /**
+ * @name Methods that are TAO specific.
+ *
+ * These methods are defined here as helper functions to be used
+ * by other parts of TAO. Theoretically they shold all start with
+ * tao_. But we have deviated from that principle.
+ */
+
+ /// Marshalling operator used by the stub code. A long story why
+ /// the stub code uses this, let us keep it short here.
+ static CORBA::Boolean marshal (const Object_ptr x,
+ TAO_OutputCDR &cdr);
+
+ /// Accessor for the cached servant reference held on the stub
+ /// if this object is collocated
+ virtual TAO_Abstract_ServantBase *_servant (void) const;
+
+ /// Is this object collocated with the servant?
+ /// Note this does not return this->is_collocated_ but will instead
+ /// query the underlying stub for its collocation status
+ virtual CORBA::Boolean _is_collocated (void) const;
+
+ /// Is this a local object?
+ virtual CORBA::Boolean _is_local (void) const;
+
+ /// Used in the implementation of CORBA::Any
+ static void _tao_any_destructor (void*);
+
+ /// Uninlined part of the now-inlined CORBA::is_nil().
+ static CORBA::Boolean is_nil_i (CORBA::Object_ptr obj);
+
+ /// Helper function for reading contents of an IOR
+ static void tao_object_initialize (Object *);
+
+ /// Return the object key as an out parameter. Caller should release
+ /// return value when finished with it.
+ virtual TAO::ObjectKey *_key (ACE_ENV_SINGLE_ARG_DECL);
+
+ /// Constructor
+ Object (TAO_Stub *p,
+ CORBA::Boolean collocated = 0,
+ TAO_Abstract_ServantBase *servant = 0,
+ TAO_ORB_Core *orb_core = 0);
+
+ Object (IOP::IOR *ior,
+ TAO_ORB_Core *orb_core = 0);
+
+ /// Get the underlying stub object.
+ virtual TAO_Stub *_stubobj (void) const;
+ virtual TAO_Stub *_stubobj (void);
+
+ /// Set the proxy broker.
+ virtual void _proxy_broker (TAO::Object_Proxy_Broker *proxy_broker);
+
+ public:
+
+ /// Allows us to forbid marshaling of local interfaces.
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+
+ /// Accessor to the flag..
+ CORBA::Boolean is_evaluated (void) const;
+
+ /// Mutator for setting the servant in collocated cases.
+ /**
+ * This is used by the Object_Adapter to set the servant for
+ * collocated cases and only when the object is initialized. The
+ * object initialization takes place when IOR's are lazily
+ * evaluated.
+ */
+ void set_collocated_servant (TAO_Abstract_ServantBase *);
+
+ /// Accessor for the ORB_Core..
+ TAO_ORB_Core *orb_core (void) const;
+
+ /// Accessors for the underlying IOP::IOR's.
+ /**
+ * The steal_ior () call basically relinquishes the ownership of
+ * the IOR. This is useful for cases when one wants to initialize
+ * a new CORBA Object
+ */
+ IOP::IOR *steal_ior (void);
+
+ const IOP::IOR &ior (void) const;
+
+ //@} End of TAO-specific methods..
+
+ protected:
+
+ /// Initializing a local object.
+ Object (int dummy = 0);
+
+ /// Convenience accessor for the object proxy broker of the
+ /// underlying stub.
+ TAO::Object_Proxy_Broker *proxy_broker () const;
+
+ private:
+
+ // = Unimplemented methods
+ Object (const Object &);
+ Object &operator = (const Object &);
+
+ private:
+
+ /// Specify whether this is a local object or not.
+ CORBA::Boolean is_local_;
+
+ /// Flag to indicate whether the IOP::IOR has been evaluated fully.
+ CORBA::Boolean is_evaluated_;
+
+ /// If the IOR hasnt been evaluated fully, then the contents of
+ /// the IOR that we received should be in here!
+ IOP::IOR_var ior_;
+
+ /// Cached pointer of our ORB_Core
+ /**
+ * Be aware that this pointer can be zero or not. In fact there are two
+ * ways to get this pointer filled:
+ * - If CORBA::Object is constructed through one of the constructors with a
+ * stub and null ORB_Core, we use the orb_core from the stub to fill
+ * this pointer
+ * - If the other constructor, which uses IOP::IOR is used, a stub
+ * needs to be created first (i.e., the IOR needs to be evaluated first),
+ * in which case the ORB_Core would be null. The orb_core pointer then
+ * needs to be accessed from the stub and passed back as part of
+ * _get_orb().
+ */
+ TAO_ORB_Core * orb_core_;
+
+ /**
+ * Pointer to the protocol-specific "object" containing important
+ * profiling information regarding this proxy.
+ * The protocol proxy is (potentially) shared among several
+ * Objects
+ */
+ TAO_Stub * protocol_proxy_;
+
+ /// Number of outstanding references to this object.
+ TAO_Configurable_Refcount refcount_;
+
+ /// Protect reference count manipulation from race conditions.
+ /**
+ * This lock is only instantiated for unconstrained objects. The
+ * reason for this is that locality-constrained objects that do
+ * not require reference counting (the default) may be
+ * instantiated in the critical path.
+ */
+ ACE_Lock * object_init_lock_;
+ };
+} // End CORBA namespace.
+
+namespace TAO
+{
+ template<>
+ class TAO_Export Arg_Traits<CORBA::Object>
+ : public Object_Arg_Traits_T<CORBA::Object_ptr,
+ CORBA::Object_var,
+ CORBA::Object_out,
+ TAO::Objref_Traits<CORBA::Object>,
+ TAO::Any_Insert_Policy_CORBA_Object <CORBA::Object_ptr> >
+ {
+ };
+
+ template<>
+ struct TAO_Export Objref_Traits<CORBA::Object>
+ {
+ static CORBA::Object_ptr duplicate (CORBA::Object_ptr);
+ static void release (CORBA::Object_ptr);
+ static CORBA::Object_ptr nil (void);
+ static CORBA::Boolean marshal (const CORBA::Object_ptr p,
+ TAO_OutputCDR & cdr);
+ };
+}
+
+/// This function pointer is set only when the Portable server
+/// library is present.
+extern
+ TAO_Export TAO::Object_Proxy_Broker *
+ (*_TAO_Object_Proxy_Broker_Factory_function_pointer) (void);
+
+TAO_Export CORBA::Boolean
+operator<< (TAO_OutputCDR&, const CORBA::Object*);
+
+TAO_Export CORBA::Boolean
+operator>> (TAO_InputCDR&, CORBA::Object *&);
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/Object.i"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_CORBA_OBJECT_H */
diff --git a/TAO/tao/Object.i b/TAO/tao/Object.i
new file mode 100644
index 00000000000..e8c1606bb73
--- /dev/null
+++ b/TAO/tao/Object.i
@@ -0,0 +1,100 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// ****************************************************************
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+CORBA::Object::Object (int)
+ : is_local_ (true),
+ is_evaluated_ (true),
+ ior_ (),
+ orb_core_ (0),
+ protocol_proxy_ (0),
+ refcount_ (),
+ object_init_lock_ (0)
+{
+}
+
+ACE_INLINE CORBA::Object_ptr
+CORBA::Object::_duplicate (CORBA::Object_ptr obj)
+{
+ if (obj)
+ {
+ obj->_add_ref ();
+ }
+
+ return obj;
+}
+
+// ************************************************************
+// These are in CORBA namespace
+
+ACE_INLINE
+void
+CORBA::release (CORBA::Object_ptr obj)
+{
+ if (obj)
+ {
+ obj->_remove_ref ();
+ }
+}
+
+ACE_INLINE
+CORBA::Boolean
+CORBA::is_nil (CORBA::Object_ptr obj)
+{
+ if (obj == 0)
+ {
+ return true;
+ }
+
+ return CORBA::Object::is_nil_i (obj);
+}
+
+// ************************************************************
+
+// Null pointers represent nil objects.
+
+ACE_INLINE
+CORBA::Object_ptr
+CORBA::Object::_nil (void)
+{
+ return 0;
+}
+
+ACE_INLINE
+CORBA::Object_ptr
+CORBA::Object::_narrow (CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_NOT_USED)
+{
+ return CORBA::Object::_duplicate (obj);
+}
+
+ACE_INLINE CORBA::Boolean
+CORBA::Object::is_evaluated (void) const
+{
+ return this->is_evaluated_;
+}
+
+ACE_INLINE TAO_ORB_Core *
+CORBA::Object::orb_core (void) const
+{
+ return this->orb_core_;
+}
+
+ACE_INLINE IOP::IOR *
+CORBA::Object::steal_ior (void)
+{
+ return this->ior_._retn ();
+}
+
+ACE_INLINE const IOP::IOR &
+CORBA::Object::ior (void) const
+{
+ return this->ior_.in ();
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/ObjectIdList.pidl b/TAO/tao/ObjectIdList.pidl
new file mode 100644
index 00000000000..05309585742
--- /dev/null
+++ b/TAO/tao/ObjectIdList.pidl
@@ -0,0 +1,45 @@
+/**
+ * @file ObjectIdList.pidl
+ *
+ * $Id$
+ *
+ * @brief Pre-compiled IDL source for the CORBA::ORB::ObjectIdList related
+ * types.
+ *
+ * This file is used to generate the code in ObjectIdListC.{h,inl,cpp}.
+ *
+ * The steps to regenerate the code are as follows:
+ *
+ * 1. Run the tao_idl compiler on the patched pidl file. The
+ * command used for this is:
+ *
+ * tao_idl.exe
+ * -o orig -Sa -Ge 1 -GA -Sci
+ * -Wb,export_macro=TAO_Export
+ * -Wb,export_include="tao/TAO_Export.h"
+ * -Wb,pre_include="ace/pre.h"
+ * -Wb,post_include="ace/post.h"
+ * ObjectIdList.pidl
+ *
+ * and then:
+ *
+ * cp orig/ObjectIdListC.{h,inl,cpp} .
+ * cp orig/ObjectIdListA.cpp .
+ *
+ * The code is ready for use.
+ */
+
+#ifndef TAO_CORBA_ORB_OBJECTIDLIST_PIDL
+#define TAO_CORBA_ORB_OBJECTIDLIST_PIDL
+
+#pragma prefix "omg.org"
+
+module CORBA
+{
+ typedef string ORB_ObjectId;
+ typedef sequence<ORB_ObjectId> ORB_ObjectIdList;
+};
+
+#endif /* TAO_CORBA_ORB_OBJECTIDLIST_PIDL */
+
+
diff --git a/TAO/tao/ObjectKey_Table.cpp b/TAO/tao/ObjectKey_Table.cpp
new file mode 100644
index 00000000000..e3e52089e4a
--- /dev/null
+++ b/TAO/tao/ObjectKey_Table.cpp
@@ -0,0 +1,186 @@
+// $Id$
+
+#include "tao/ObjectKey_Table.h"
+#include "tao/ORB_Core.h"
+#include "tao/Refcounted_ObjectKey.h"
+
+ACE_RCSID(tao,
+ ObjectKey_Table,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+int
+TAO::Less_Than_ObjectKey::operator () (const TAO::ObjectKey &lhs,
+ const TAO::ObjectKey &rhs) const
+{
+ if (lhs.length () < rhs.length ())
+ {
+ return 1;
+ }
+ else if (lhs.length () > rhs.length ())
+ {
+ return 0;
+ }
+
+ for (CORBA::ULong i = 0; i < rhs.length (); ++i)
+ {
+ if (lhs[i] < rhs[i])
+ {
+ return 1;
+ }
+ else if (lhs[i] > rhs[i])
+ {
+ return 0;
+ }
+ }
+
+ return 0;
+}
+
+/********************************************************/
+TAO::ObjectKey_Table::ObjectKey_Table (void)
+ : lock_ (0)
+ , table_ ()
+{
+
+}
+
+TAO::ObjectKey_Table::~ObjectKey_Table (void)
+{
+ this->table_.close ();
+ delete this->lock_;
+}
+
+int
+TAO::ObjectKey_Table::init (TAO_ORB_Core *oc)
+{
+ /// Create the lock that is needed for internal usage.
+ this->lock_ =
+ oc->resource_factory ()->create_object_key_table_lock ();
+
+ return 0;
+}
+
+int
+TAO::ObjectKey_Table::bind (const TAO::ObjectKey &key,
+ TAO::Refcounted_ObjectKey *&key_new)
+
+{
+ key_new = 0;
+
+ int retval = 0;
+
+ {
+ ACE_GUARD_RETURN (ACE_Lock,
+ ace_mon,
+ *this->lock_,
+ 0);
+
+ // This is a tradeoff.. We could avoid this two stage process of
+ // using a find () and then a bind () , which would make things
+ // efficient. BUT we may have to do allocation upfront and delete if
+ // bind () returns with an entry. We take one of the routes that
+ // avoids allocation.
+ retval = this->table_.find (key,
+ key_new);
+
+ if (retval == -1)
+ {
+ return this->bind_i (key,
+ key_new);
+ }
+
+ key_new->incr_refcount ();
+ }
+
+ return retval;
+}
+
+int
+TAO::ObjectKey_Table::unbind (TAO::Refcounted_ObjectKey *&key_new)
+
+{
+ ACE_GUARD_RETURN (ACE_Lock,
+ ace_mon,
+ *this->lock_,
+ 0);
+
+ // If the refcount has dropped to 1, just go ahead and unbind it
+ // from the table.
+ if (key_new && key_new->decr_refcount () == 1)
+ {
+ return this->unbind_i (key_new);
+ }
+
+ return 0;
+}
+
+int
+TAO::ObjectKey_Table::destroy (void)
+{
+ if (this->table_.current_size ())
+ {
+ ACE_GUARD_RETURN (ACE_Lock,
+ ace_mon,
+ *this->lock_,
+ 0);
+
+ TABLE::ITERATOR end_iter = this->table_.end ();
+ TABLE::ITERATOR start;
+
+ while ((start = this->table_.begin ()) != end_iter)
+ {
+ TABLE::ENTRY &ent = (*start);
+
+ ent.item ()->decr_refcount ();
+ this->table_.unbind (&ent);
+ }
+ }
+
+ return 0;
+}
+
+int
+TAO::ObjectKey_Table::bind_i (const TAO::ObjectKey &key,
+ TAO::Refcounted_ObjectKey *&key_new)
+{
+ ACE_NEW_RETURN (key_new,
+ TAO::Refcounted_ObjectKey (key),
+ -1);
+
+
+
+ int retval = this->table_.bind (key,
+ key_new);
+
+ if (retval != -1)
+ {
+ key_new->incr_refcount ();
+ }
+ else
+ {
+ key_new->decr_refcount ();
+ }
+
+ return retval;
+}
+
+int
+TAO::ObjectKey_Table::unbind_i (TAO::Refcounted_ObjectKey *&key_new)
+{
+ TAO::Refcounted_ObjectKey *tmp = 0;
+
+ if (this->table_.unbind (key_new->object_key (),
+ tmp) != -1)
+ {
+ // @@ Cant do much if the unbind fails.
+ // Remove our refcount on the ObjectKey
+ (void) tmp->decr_refcount ();
+ }
+
+ return 0;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/ObjectKey_Table.h b/TAO/tao/ObjectKey_Table.h
new file mode 100644
index 00000000000..ef55ed9facd
--- /dev/null
+++ b/TAO/tao/ObjectKey_Table.h
@@ -0,0 +1,146 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file ObjectKey_Table.h
+ *
+ * $Id$
+ *
+ * @author Balachandran Natarajan <bala@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_OBJECTKEY_TABLE_H
+#define TAO_OBJECTKEY_TABLE_H
+
+#include /**/ "ace/pre.h"
+#include "ace/RB_Tree.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/Null_Mutex.h"
+
+#include "tao/Object_KeyC.h"
+#include "tao/Versioned_Namespace.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Forward declarations
+class TAO_ORB_Core;
+
+namespace TAO
+{
+
+ // Forward declarations within the namespace..
+ class Refcounted_ObjectKey;
+ class ObjectKey;
+
+ /**
+ * @class Less_Than_ObjectKey
+ *
+ * @brief Compares the length and then the contents of ObjectKeys.
+ *
+ * Should have been a specialization of the functor
+ * ACE_Less_Than<sequence<CORBA::Octet>>. But that will not work
+ * so easily across bunch of stuff. Hence let us put up with this
+ * for the time being.
+ */
+ class TAO_Export Less_Than_ObjectKey
+ {
+ public:
+ int operator () (const TAO::ObjectKey &lhs,
+ const TAO::ObjectKey &rhs) const;
+ };
+
+ /**
+ * @class ObjectKey_Table
+ *
+ * @brief Table that maintains the set of ObjectKey's seen by the
+ * ORB.
+ *
+ * The ORB maintains one table for the whole ORB. ObjectKeys
+ * generated by the ORB or the ones seen by the ORB from remote
+ * ORB's are stored here. The ObjectKeys are stored through a
+ * wrapper which encapsulates the refcount on them. This class
+ * actually provides the synchronization mechanism for manipulating
+ * the reference counts on the object keys provided by the wrapper
+ * class.
+ *
+ * This class does not offer a find () call with a reason. The call
+ * to bind () will return a pointer which is expected to be cached
+ * by the client/caller and use the pointer in every invocation.
+ *
+ * @note This class uses the ACE_RB_Tree to maintain the table of
+ * ObjectKeys. The RB_Tree has good insertion and lookup
+ * properties. Its Iteration properties are not that good, but we
+ * dont need to do much iteration unless we are closing down the
+ * table.
+ *
+ * @note The reasons to use RB_Tree are its good dynamic
+ * properties. We should try to strategize the class to use either a
+ * Hash_Map or a RB_Tree based on some runtime option. For that we
+ * need an adapter class in ACE, like an ACE_Lock_Adapter class. We
+ * will do that if our instrumentation shows the need for it.
+ *
+ */
+ class TAO_Export ObjectKey_Table
+ {
+ public:
+ /// Default Constructor and destructor..
+ ObjectKey_Table (void);
+
+ ~ObjectKey_Table (void);
+
+ /// Initialize method that sets up the underlying lock and other
+ /// related stuff.
+ int init (TAO_ORB_Core *orb);
+
+ /// Iterates and unbinds the contents of the table.
+ int destroy (void);
+
+ /// Bind the ObjectKey in the table.
+ /**
+ * Bind an ObjectKey in the table and return a pointer to the
+ * Refcounted_ObjectKey which the client can use. If the ObjectKey
+ * is already available in the table, this operation just
+ * increments the refcount on the ObjectKey. If the ObjectKey is
+ * new it is bounded to the table. Returns a 0 on success and a -1
+ * on failure.
+ */
+ int bind (const ObjectKey &key,
+ Refcounted_ObjectKey *&key_new);
+
+ /// Unbind an ObjectKey from the table.
+ int unbind (TAO::Refcounted_ObjectKey *&key);
+
+ protected:
+ /// Implementation for bind ().
+ int bind_i (const ObjectKey &key,
+ Refcounted_ObjectKey *&key_new);
+
+ /// Implementation for unbind ().
+ int unbind_i (Refcounted_ObjectKey *&key);
+
+ private:
+
+ // Some useful typedefs.
+ typedef ACE_RB_Tree<TAO::ObjectKey,
+ TAO::Refcounted_ObjectKey *,
+ TAO::Less_Than_ObjectKey,
+ ACE_Null_Mutex> TABLE;
+
+ /// Lock for the table.
+ ACE_Lock *lock_;
+
+ /// Table that contains the data
+ TABLE table_;
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /*TAO_OBJECT_KEY_TABLE_H*/
diff --git a/TAO/tao/Object_Argument_T.cpp b/TAO/tao/Object_Argument_T.cpp
new file mode 100644
index 00000000000..3a61ac7e672
--- /dev/null
+++ b/TAO/tao/Object_Argument_T.cpp
@@ -0,0 +1,121 @@
+// $Id$
+
+#ifndef TAO_OBJECT_ARGUMENT_T_CPP
+#define TAO_OBJECT_ARGUMENT_T_CPP
+
+#include "tao/Object_Argument_T.h"
+
+#if !defined (__ACE_INLINE__)
+#include "tao/Object_Argument_T.inl"
+#endif /* __ACE_INLINE__ */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template<typename S_ptr,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::In_Object_Argument_T<S_ptr,Insert_Policy>::marshal (TAO_OutputCDR &cdr)
+{
+ return cdr << this->x_;
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S_ptr,
+ class Insert_Policy>
+void
+TAO::In_Object_Argument_T<S_ptr,Insert_Policy>::interceptor_value (CORBA::Any *any) const
+{
+ Insert_Policy::any_insert (any, this->x_);
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+// ===========================================================
+
+template<typename S_ptr,
+ typename S_traits,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::Inout_Object_Argument_T<S_ptr,S_traits,Insert_Policy>::marshal (TAO_OutputCDR &cdr)
+{
+ return cdr << this->x_;
+}
+
+template<typename S_ptr,
+ typename S_traits,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::Inout_Object_Argument_T<S_ptr,S_traits,Insert_Policy>::demarshal (TAO_InputCDR & cdr)
+{
+ S_traits::release (this->x_);
+ return cdr >> this->x_;
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S_ptr,
+ typename S_traits,
+ class Insert_Policy>
+void
+TAO::Inout_Object_Argument_T<S_ptr,S_traits,Insert_Policy>::interceptor_value (
+ CORBA::Any *any) const
+{
+ Insert_Policy::any_insert (any, this->x_);
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+// ==============================================================
+
+template<typename S_ptr,
+ typename S_out,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::Out_Object_Argument_T<S_ptr,S_out,Insert_Policy>::demarshal (TAO_InputCDR & cdr)
+{
+ return cdr >> this->x_;
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S_ptr,
+ typename S_out,
+ class Insert_Policy>
+void
+TAO::Out_Object_Argument_T<S_ptr,S_out,Insert_Policy>::interceptor_value (
+ CORBA::Any *any) const
+{
+ Insert_Policy::any_insert (any, this->x_);
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+// ============================================================
+
+template<typename S_ptr,
+ typename S_var,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::Ret_Object_Argument_T<S_ptr,S_var,Insert_Policy>::demarshal (TAO_InputCDR & cdr)
+{
+ return cdr >> this->x_.out ();
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S_ptr,
+ typename S_var,
+ class Insert_Policy>
+void
+TAO::Ret_Object_Argument_T<S_ptr,S_var,Insert_Policy>::interceptor_value (
+ CORBA::Any *any) const
+{
+ Insert_Policy::any_insert (any, this->x_.in ());
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_OBJECT_ARGUMENT_T_CPP */
diff --git a/TAO/tao/Object_Argument_T.h b/TAO/tao/Object_Argument_T.h
new file mode 100644
index 00000000000..495d5842264
--- /dev/null
+++ b/TAO/tao/Object_Argument_T.h
@@ -0,0 +1,176 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Object_Argument_T.h
+ *
+ * $Id$
+ *
+ * @authors Jeff Parsons and Carlos O'Ryan
+ */
+//=============================================================================
+
+
+#ifndef TAO_OBJECT_ARGUMENT_T_H
+#define TAO_OBJECT_ARGUMENT_T_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Argument.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ /**
+ * @class In_Object_Argument_T
+ *
+ * @brief Template class for IN object argument.
+ *
+ */
+ template<typename S_ptr,
+ class Insert_Policy>
+ class In_Object_Argument_T : public InArgument
+ {
+ public:
+ In_Object_Argument_T (S_ptr x);
+
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ S_ptr arg (void) const;
+
+ private:
+ S_ptr x_;
+ };
+
+ /**
+ * @class Inout_Object_Argument_T
+ *
+ * @brief Template class for INOUT object argument.
+ *
+ */
+ template<typename S_ptr,
+ typename S_traits,
+ class Insert_Policy>
+ class Inout_Object_Argument_T : public InoutArgument
+ {
+ public:
+ Inout_Object_Argument_T (S_ptr & x);
+
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+ virtual CORBA::Boolean demarshal (TAO_InputCDR &cdr);
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ S_ptr & arg (void);
+
+ private:
+ S_ptr & x_;
+ };
+
+ /**
+ * @class Out_Object_Argument_T
+ *
+ * @brief Template class for OUT object argument.
+ *
+ */
+ template<typename S_ptr,
+ typename S_out,
+ class Insert_Policy>
+ class Out_Object_Argument_T : public OutArgument
+ {
+ public:
+ Out_Object_Argument_T (S_out & x);
+
+ virtual CORBA::Boolean demarshal (TAO_InputCDR &cdr);
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ S_out arg (void);
+
+ private:
+ S_ptr & x_;
+ };
+
+ /**
+ * @class Ret_Object_Argument_T
+ *
+ * @brief Template class for return stub value of object argument.
+ *
+ */
+ template<typename S_ptr,
+ typename S_var,
+ class Insert_Policy>
+ class Ret_Object_Argument_T : public RetArgument
+ {
+ public:
+
+ Ret_Object_Argument_T (void);
+
+ virtual CORBA::Boolean demarshal (TAO_InputCDR &);
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ S_ptr & arg (void);
+
+ S_ptr excp (void);
+ S_ptr retn (void);
+
+ private:
+ S_var x_;
+ };
+
+ /**
+ * @struct Object_Arg_Traits_T
+ *
+ * @brief Template class for stub argument traits of objects.
+ */
+ template<typename T_ptr,
+ typename T_var,
+ typename T_out,
+ typename T_traits,
+ class Insert_Policy>
+ struct Object_Arg_Traits_T
+ {
+ typedef T_ptr ret_type;
+ typedef T_ptr in_type;
+ typedef T_ptr & inout_type;
+ typedef T_out out_type;
+
+ typedef In_Object_Argument_T<T_ptr,
+ Insert_Policy> in_arg_val;
+ typedef Inout_Object_Argument_T<T_ptr,
+ T_traits,
+ Insert_Policy> inout_arg_val;
+ typedef Out_Object_Argument_T<T_ptr,
+ T_out,
+ Insert_Policy> out_arg_val;
+ typedef Ret_Object_Argument_T<T_ptr,
+ T_var,
+ Insert_Policy> ret_val;
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+#include "tao/Object_Argument_T.inl"
+#endif /* __ACE_INLINE__ */
+
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+#include "tao/Object_Argument_T.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
+#pragma implementation ("Object_Argument_T.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_OBJECT_ARGUMENT_T_H */
diff --git a/TAO/tao/Object_Argument_T.inl b/TAO/tao/Object_Argument_T.inl
new file mode 100644
index 00000000000..15fc275f033
--- /dev/null
+++ b/TAO/tao/Object_Argument_T.inl
@@ -0,0 +1,104 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template<typename S_ptr,
+ class Insert_Policy>
+ACE_INLINE
+TAO::In_Object_Argument_T<S_ptr,Insert_Policy>::In_Object_Argument_T (S_ptr x)
+ : x_ (x)
+{}
+
+template<typename S_ptr,
+ class Insert_Policy>
+ACE_INLINE
+S_ptr
+TAO::In_Object_Argument_T<S_ptr,Insert_Policy>::arg (void) const
+{
+ return this->x_;
+}
+
+// ==========================================================================
+
+template<typename S_ptr,
+ typename S_traits,
+ class Insert_Policy>
+ACE_INLINE
+TAO::Inout_Object_Argument_T<S_ptr,S_traits,Insert_Policy>::Inout_Object_Argument_T (
+ S_ptr & x
+ )
+ : x_ (x)
+{}
+
+template<typename S_ptr,
+ typename S_traits,
+ class Insert_Policy>
+ACE_INLINE
+S_ptr &
+TAO::Inout_Object_Argument_T<S_ptr,S_traits,Insert_Policy>::arg (void)
+{
+ return this->x_;
+}
+
+// ==========================================================================
+
+template<typename S_ptr,
+ typename S_out,
+ class Insert_Policy>
+ACE_INLINE
+TAO::Out_Object_Argument_T<S_ptr,S_out,Insert_Policy>::Out_Object_Argument_T (S_out & x)
+ : x_ (x.ptr ())
+{}
+
+template<typename S_ptr,
+ typename S_out,
+ class Insert_Policy>
+ACE_INLINE
+S_out
+TAO::Out_Object_Argument_T<S_ptr,S_out,Insert_Policy>::arg (void)
+{
+ return this->x_;
+}
+
+// ==========================================================================
+
+template<typename S_ptr,
+ typename S_var,
+ class Insert_Policy>
+ACE_INLINE
+TAO::Ret_Object_Argument_T<S_ptr,S_var,Insert_Policy>::Ret_Object_Argument_T (void)
+{}
+
+template<typename S_ptr,
+ typename S_var,
+ class Insert_Policy>
+ACE_INLINE
+S_ptr &
+TAO::Ret_Object_Argument_T<S_ptr,S_var,Insert_Policy>::arg (void)
+{
+ return this->x_.out ();
+}
+
+template<typename S_ptr,
+ typename S_var,
+ class Insert_Policy>
+ACE_INLINE
+S_ptr
+TAO::Ret_Object_Argument_T<S_ptr,S_var,Insert_Policy>::excp (void)
+{
+ return this->x_.ptr ();
+}
+
+template<typename S_ptr,
+ typename S_var,
+ class Insert_Policy>
+ACE_INLINE
+S_ptr
+TAO::Ret_Object_Argument_T<S_ptr,S_var,Insert_Policy>::retn (void)
+{
+ return this->x_._retn ();
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Object_Key.pidl b/TAO/tao/Object_Key.pidl
new file mode 100644
index 00000000000..ef451a7c595
--- /dev/null
+++ b/TAO/tao/Object_Key.pidl
@@ -0,0 +1,22 @@
+// $Id$
+
+// TAO specific IDL definition of an octet sequence that we use to represent
+// Object keys inside the POA.
+// This file was used to generate the code in Object_KeyC.*
+// The command used to generate code is:
+//
+// tao_idl
+// -o orig -Ge 1 -St -Gp -Gd -Sci
+// -Wb,export_macro=TAO_Export
+// -Wb,export_macro="tao/TAO_Export"
+// -Wb,pre_include="ace/pre.h"
+// -Wb,post_include="ace/post.h"
+// Object_Key.pidl
+//
+// After generation the file diffs/Object_Key.diff must be used to manually
+// patch this file
+
+module TAO
+{
+ typedef sequence<octet> ObjectKey;
+};
diff --git a/TAO/tao/Object_KeyC.cpp b/TAO/tao/Object_KeyC.cpp
new file mode 100644
index 00000000000..abd6d5ded9a
--- /dev/null
+++ b/TAO/tao/Object_KeyC.cpp
@@ -0,0 +1,265 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:291
+
+
+#include "tao/Object_KeyC.h"
+#include "tao/CDR.h"
+#include "tao/ORB_Core.h"
+
+#if defined (__BORLANDC__)
+#pragma option -w-rvl -w-rch -w-ccc -w-aus -w-sig
+#endif /* __BORLANDC__ */
+
+#include "ace/ACE.h"
+#include "ace/OS_NS_string.h"
+#include "ace/os_include/os_ctype.h"
+
+// TAO_IDL - Generated from
+// be\be_visitor_arg_traits.cpp:70
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Arg traits specializations.
+namespace TAO
+{
+}
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_sequence/sequence_cs.cpp:65
+
+#if !defined (_TAO_OBJECTKEY_CS_)
+#define _TAO_OBJECTKEY_CS_
+
+TAO::ObjectKey::ObjectKey (void)
+{}
+
+TAO::ObjectKey::ObjectKey (
+ CORBA::ULong max
+ )
+ : TAO::unbounded_value_sequence<
+ CORBA::Octet
+ >
+ (max)
+{}
+
+TAO::ObjectKey::ObjectKey (
+ CORBA::ULong max,
+ CORBA::ULong length,
+ CORBA::Octet * buffer,
+ CORBA::Boolean release
+ )
+ : TAO::unbounded_value_sequence<
+ CORBA::Octet
+ >
+ (max, length, buffer, release)
+{}
+
+TAO::ObjectKey::ObjectKey (
+ const ObjectKey &seq
+ )
+ : TAO::unbounded_value_sequence<
+ CORBA::Octet
+ >
+ (seq)
+{}
+
+TAO::ObjectKey::~ObjectKey (void)
+{}
+
+// Hand crafted.
+
+void
+TAO::ObjectKey::encode_sequence_to_string (char * &str,
+ const TAO::unbounded_value_sequence<CORBA::Octet> &seq)
+{
+ // We must allocate a buffer which is (gag) 3 times the length
+ // of the sequence, which is the length required in the worst-case
+ // scenario of all non-printable characters.
+ //
+ // There are two strategies here...we could allocate all that space here,
+ // fill it up, then copy-allocate new space of just the right length.
+ // OR, we could just return this space. The classic time-space tradeoff,
+ // and for now we'll let time win out, which means that we only do the
+ // allocation once.
+ u_int len = 3 * seq.length (); /* space for zero termination not needed */;
+ str = CORBA::string_alloc (len);
+
+ char *cp = str;
+
+ for (u_int i = 0;
+ cp < (str + len) && i < seq.length();
+ ++i)
+ {
+ u_char bt = seq[i];
+ if (is_legal (bt))
+ {
+ *cp++ = (char) bt;
+ continue;
+ }
+
+ *cp++ = '%';
+ *cp++ = ACE::nibble2hex ((bt >> 4) & 0x0f);
+ *cp++ = ACE::nibble2hex (bt & 0x0f);
+ }
+ // Zero terminate
+ *cp = '\0';
+}
+
+int TAO::ObjectKey::is_legal (u_char & c)
+{
+ if (isalnum(c))
+ {
+ return 1;
+ }
+ else
+ {
+ return ( c == ';' || c == '/' ||c == ':' || c == '?' ||
+ c == '@' || c == '&' ||c == '=' || c == '+' ||
+ c == '$' || c == ',' ||c == '_' || c == '.' ||
+ c == '!' || c == '~' ||c == '*' || c == '\'' ||
+ c == '-' || c == '(' || c == ')' );
+ }
+}
+
+void
+TAO::ObjectKey::decode_string_to_sequence (TAO::unbounded_value_sequence<CORBA::Octet> &seq,
+ const char *str)
+{
+ if (str == 0)
+ {
+ seq.length (0);
+ return;
+ }
+
+ size_t length = ACE_OS::strlen (str);
+ const char *eos = str + length;
+ const char *cp = str;
+
+ // Set the length of the sequence to be as long as
+ // we'll possibly need...we'll reset it to the actual
+ // length later.
+ seq.length (length);
+
+ u_int i = 0;
+ for (;
+ cp < eos && i < seq.length ();
+ ++i)
+ {
+ if (*cp == '%' || *cp == '\\')
+ {
+ // This is an escaped non-printable,
+ // so we decode the hex values into
+ // the sequence's octet
+ seq[i] = (u_char) (ACE::hex2byte (cp[1]) << 4);
+ seq[i] |= (u_char) ACE::hex2byte (cp[2]);
+ cp += 3;
+ }
+ else
+ // Copy it in
+ seq[i] = *cp++;
+ }
+
+ // Set the length appropriately
+ seq.length (i);
+}
+
+/*static*/ CORBA::Boolean
+TAO::ObjectKey::demarshal_key (TAO::ObjectKey &key,
+ TAO_InputCDR &strm)
+{
+ CORBA::ULong _tao_seq_len;
+
+ if (strm >> _tao_seq_len)
+ {
+ // Add a check to the length of the sequence
+ // to make sure it does not exceed the length
+ // of the stream. (See bug 58.)
+ if (_tao_seq_len > strm.length ())
+ {
+ return 0;
+ }
+
+ // Set the length of the sequence.
+ key.length (_tao_seq_len);
+
+ // If length is 0 we return true.
+ if (0 >= _tao_seq_len)
+ {
+ return 1;
+ }
+
+ // Retrieve all the elements.
+#if (TAO_NO_COPY_OCTET_SEQUENCES == 1)
+ if (ACE_BIT_DISABLED (strm.start ()->flags (),
+ ACE_Message_Block::DONT_DELETE))
+ {
+ key.replace (_tao_seq_len, strm.start ());
+ key.mb ()->wr_ptr (key.mb()->rd_ptr () + _tao_seq_len);
+ strm.skip_bytes (_tao_seq_len);
+ return 1;
+ }
+ return strm.read_octet_array (key.get_buffer (),
+ _tao_seq_len);
+#else /* TAO_NO_COPY_OCTET_SEQUENCES == 0 */
+ return strm.read_octet_array (key.get_buffer (), key.length ());
+#endif /* TAO_NO_COPY_OCTET_SEQUENCES == 0 */
+
+ }
+ return 0;
+}
+
+#endif /* end #if !defined */
+
+// TAO_IDL - Generated from
+// be\be_visitor_sequence/cdr_op_cs.cpp:96
+
+#if !defined _TAO_CDR_OP_TAO_ObjectKey_CPP_
+#define _TAO_CDR_OP_TAO_ObjectKey_CPP_
+
+CORBA::Boolean operator<< (
+ TAO_OutputCDR &strm,
+ const TAO::ObjectKey &_tao_sequence
+ )
+{
+ return TAO::marshal_sequence(strm, _tao_sequence);
+}
+
+CORBA::Boolean operator>> (
+ TAO_InputCDR &strm,
+ TAO::ObjectKey &_tao_sequence
+ )
+{
+ return TAO::demarshal_sequence(strm, _tao_sequence);
+}
+
+#endif /* _TAO_CDR_OP_TAO_ObjectKey_CPP_ */
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Object_KeyC.h b/TAO/tao/Object_KeyC.h
new file mode 100644
index 00000000000..8377b60bef7
--- /dev/null
+++ b/TAO/tao/Object_KeyC.h
@@ -0,0 +1,189 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:153
+
+#ifndef _TAO_IDL_ORIG_OBJECT_KEYC_H_
+#define _TAO_IDL_ORIG_OBJECT_KEYC_H_
+
+#include /**/ "ace/pre.h"
+
+
+#include "ace/config-all.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/TAO_Export.h"
+#include "tao/ORB.h"
+#include "tao/Environment.h"
+#include "tao/Sequence_T.h"
+#include "tao/Seq_Var_T.h"
+#include "tao/Seq_Out_T.h"
+
+#if defined (TAO_EXPORT_MACRO)
+#undef TAO_EXPORT_MACRO
+#endif
+#define TAO_EXPORT_MACRO TAO_Export
+
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+#if defined (__BORLANDC__)
+#pragma option push -w-rvl -w-rch -w-ccc -w-inl
+#endif /* __BORLANDC__ */
+
+// TAO_IDL - Generated from
+// be\be_visitor_module/module_ch.cpp:48
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_sequence/sequence_ch.cpp:101
+
+#if !defined (_TAO_OBJECTKEY_CH_)
+#define _TAO_OBJECTKEY_CH_
+
+ class ObjectKey;
+
+ typedef
+ TAO_FixedSeq_Var_T<
+ ObjectKey
+ >
+ ObjectKey_var;
+
+ typedef
+ TAO_Seq_Out_T<
+ ObjectKey
+ >
+ ObjectKey_out;
+
+ class TAO_Export ObjectKey
+ : public
+ TAO::unbounded_value_sequence<
+ CORBA::Octet
+ >
+ {
+ public:
+ ObjectKey (void);
+ ObjectKey (CORBA::ULong max);
+ ObjectKey (
+ CORBA::ULong max,
+ CORBA::ULong length,
+ CORBA::Octet* buffer,
+ CORBA::Boolean release = false
+ );
+ ObjectKey (const ObjectKey &);
+ ~ObjectKey (void);
+
+ typedef ObjectKey_var _var_type;
+
+#if (TAO_NO_COPY_OCTET_SEQUENCES == 1)
+ ObjectKey (
+ CORBA::ULong length,
+ const ACE_Message_Block* mb
+ )
+ : TAO::unbounded_value_sequence<CORBA::Octet> (length, mb) {}
+#endif /* TAO_NO_COPY_OCTET_SEQUENCE == 1 */
+
+ // Hand crafted.
+
+ static void encode_sequence_to_string (
+ char * &str,
+ const TAO::unbounded_value_sequence<CORBA::Octet> &seq
+ );
+ static void decode_string_to_sequence (
+ TAO::unbounded_value_sequence<CORBA::Octet> &seq,
+ const char *str
+ );
+ static int is_legal (u_char & c);
+
+ /// A special method that gives no regard to how the ORB has
+ /// configured the resource factory. This will be used only
+ /// during Profile decoding and should be safe. This is a solution
+ /// for the bug report [BUG 1616]
+ static CORBA::Boolean demarshal_key (ObjectKey &key,
+ TAO_InputCDR &cdr);
+ };
+
+#endif /* end #if !defined */
+
+// TAO_IDL - Generated from
+// be\be_visitor_module/module_ch.cpp:66
+
+} // module TAO
+
+// TAO_IDL - Generated from
+// be\be_visitor_traits.cpp:61
+
+// Traits specializations.
+namespace TAO
+{
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_sequence/cdr_op_ch.cpp:71
+
+#if !defined _TAO_CDR_OP_TAO_ObjectKey_H_
+#define _TAO_CDR_OP_TAO_ObjectKey_H_
+
+TAO_Export CORBA::Boolean operator<< (
+ TAO_OutputCDR &,
+ const TAO::ObjectKey &
+ );
+TAO_Export CORBA::Boolean operator>> (
+ TAO_InputCDR &,
+ TAO::ObjectKey &
+ );
+
+#endif /* _TAO_CDR_OP_TAO_ObjectKey_H_ */
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:955
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#if defined (__BORLANDC__)
+#pragma option pop
+#endif /* __BORLANDC__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* ifndef */
+
+
diff --git a/TAO/tao/Object_Loader.cpp b/TAO/tao/Object_Loader.cpp
new file mode 100644
index 00000000000..5379fa97148
--- /dev/null
+++ b/TAO/tao/Object_Loader.cpp
@@ -0,0 +1,16 @@
+// $Id$
+
+#include "tao/Object_Loader.h"
+
+ACE_RCSID (tao,
+ Object_Loader,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Object_Loader::~TAO_Object_Loader (void)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Object_Loader.h b/TAO/tao/Object_Loader.h
new file mode 100644
index 00000000000..69b1a7559bc
--- /dev/null
+++ b/TAO/tao/Object_Loader.h
@@ -0,0 +1,71 @@
+// -*- C++ -*-
+
+// ================================================================
+/**
+ * @file Object_Loader.h
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan (coryan@cs.wustl.edu)
+ */
+// ================================================================
+
+#ifndef TAO_OBJECT_LOADER_H
+#define TAO_OBJECT_LOADER_H
+
+#include /**/ "ace/pre.h"
+#include "ace/Service_Object.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/SystemException.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace CORBA
+{
+ class Object;
+ typedef Object *Object_ptr;
+
+ class ORB;
+ typedef ORB *ORB_ptr;
+}
+
+/**
+ * @class TAO_Object_Loader
+ *
+ * @brief A class to dynamically load object implementations into an
+ * ORB.
+ *
+ * Many services and components of the ORB can be dynamically
+ * loaded, often these components are returned to the application via
+ * an object reference (CORBA::Object_ptr). This class is used to
+ * dynamically load such components, and encapsulate the creation of
+ * the object reference.
+ *
+ */
+class TAO_Export TAO_Object_Loader : public ACE_Service_Object
+{
+public:
+ /// The destructor
+ virtual ~TAO_Object_Loader (void);
+
+ /**
+ * Create and activate a new object into the orb.
+ * This method cannot throw any exception, but it can return a nil
+ * object to indicate an error condition.
+ */
+ virtual CORBA::Object_ptr create_object (CORBA::ORB_ptr orb,
+ int argc,
+ ACE_TCHAR* argv []
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException)) = 0;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_OBJECT_LOADER_H */
diff --git a/TAO/tao/Object_Proxy_Broker.cpp b/TAO/tao/Object_Proxy_Broker.cpp
new file mode 100644
index 00000000000..8a8a1d6ee09
--- /dev/null
+++ b/TAO/tao/Object_Proxy_Broker.cpp
@@ -0,0 +1,15 @@
+// $Id$
+
+#include "tao/Object_Proxy_Broker.h"
+
+ACE_RCSID (tao,
+ Object_Proxy_Broker,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO::Object_Proxy_Broker::~Object_Proxy_Broker (void)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Object_Proxy_Broker.h b/TAO/tao/Object_Proxy_Broker.h
new file mode 100644
index 00000000000..0c1b7dc2102
--- /dev/null
+++ b/TAO/tao/Object_Proxy_Broker.h
@@ -0,0 +1,88 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Object_Proxy_Broker.h
+ *
+ * $Id$
+ *
+ * This files contains the abstract class for the CORBA Object
+ * proxy brokers.
+ *
+ * @author Angelo Corsaro <corsaro@cs.wustl.edu>
+ * Modified by
+ * @author Balachandran Natarajan <bala@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+
+#ifndef TAO_OBJECT_PROXY_BROKER_H
+#define TAO_OBJECT_PROXY_BROKER_H
+
+#include /**/ "ace/pre.h"
+#include "ace/CORBA_macros.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/TAO_Export.h"
+#include "tao/Basic_Types.h"
+#include "tao/orbconf.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace CORBA
+{
+ class InterfaceDef;
+
+ class Object;
+ typedef Object *Object_ptr;
+
+ class Environment;
+}
+
+namespace TAO
+{
+ /**
+ * @class Object_Proxy_Broker
+ *
+ * @brief Object_Proxy_Broker
+ *
+ */
+ class TAO_Export Object_Proxy_Broker
+ {
+ public:
+
+ /// Destructor
+ virtual ~Object_Proxy_Broker (void);
+
+ virtual CORBA::Boolean _is_a (CORBA::Object_ptr target,
+ const char *logical_type_id
+ ACE_ENV_ARG_DECL) = 0;
+
+#if (TAO_HAS_MINIMUM_CORBA == 0)
+
+ virtual CORBA::Boolean _non_existent (CORBA::Object_ptr target
+ ACE_ENV_ARG_DECL) = 0;
+
+ virtual CORBA::InterfaceDef *_get_interface (
+ CORBA::Object_ptr target
+ ACE_ENV_ARG_DECL
+ ) = 0;
+
+ virtual CORBA::Object_ptr _get_component (CORBA::Object_ptr target
+ ACE_ENV_ARG_DECL) = 0;
+
+ virtual char * _repository_id (CORBA::Object_ptr target
+ ACE_ENV_ARG_DECL) = 0;
+
+#endif /* TAO_HAS_MINIMUM_CORBA == 0 */
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_OBJECT_PROXY_BROKER_H_ */
diff --git a/TAO/tao/Object_Ref_Table.cpp b/TAO/tao/Object_Ref_Table.cpp
new file mode 100644
index 00000000000..f5071ad0466
--- /dev/null
+++ b/TAO/tao/Object_Ref_Table.cpp
@@ -0,0 +1,86 @@
+// $Id$
+
+#include "tao/Object_Ref_Table.h"
+#include "tao/ORB.h"
+#include "tao/Environment.h"
+#include "tao/debug.h"
+#include "tao/ORB_Constants.h"
+#include "tao/SystemException.h"
+#include "ace/OS_NS_string.h"
+#include "ace/Log_Msg.h"
+
+
+ACE_RCSID (tao,
+ Object_Ref_Table,
+ "$Id$")
+
+#ifndef __ACE_INLINE__
+# include "tao/Object_Ref_Table.inl"
+#endif /* __ACE_INLINE__ */
+
+
+// ****************************************************************
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+int
+TAO_Object_Ref_Table::bind (const char *id,
+ CORBA::Object_ptr obj)
+{
+ // Make sure that the supplied Object reference is valid,
+ // i.e. not nil.
+ if (id == 0
+ || ACE_OS::strlen (id) == 0
+ || ::CORBA::is_nil (obj))
+ {
+ errno = EINVAL;
+ return -1;
+ };
+
+ Table::value_type const value =
+ std::make_pair (CORBA::String_var (id),
+ CORBA::Object_var (CORBA::Object::_duplicate (obj)));
+
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
+ guard,
+ this->lock_,
+ -1);
+
+ std::pair<iterator, bool> const result = this->table_.insert (value);
+
+ if (!result.second)
+ {
+ if (TAO_debug_level > 1)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) Object_Ref_Table::")
+ ACE_TEXT ("bind:")
+ ACE_TEXT (" Could not register duplicate object <%s> ")
+ ACE_TEXT ("with the ORB\n"),
+ ACE_TEXT_CHAR_TO_TCHAR (id)));
+ }
+
+ return -1;
+ }
+
+ return 0;
+}
+
+CORBA::Object_ptr
+TAO_Object_Ref_Table::find (const char *id)
+{
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
+ guard,
+ this->lock_,
+ CORBA::Object::_nil ());
+
+ iterator const found =
+ this->table_.find (CORBA::String_var (id));
+
+ if (found == this->table_.end ())
+ return CORBA::Object::_nil ();
+
+ return CORBA::Object::_duplicate ((*found).second.in ());
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Object_Ref_Table.h b/TAO/tao/Object_Ref_Table.h
new file mode 100644
index 00000000000..ac4d6adcda8
--- /dev/null
+++ b/TAO/tao/Object_Ref_Table.h
@@ -0,0 +1,132 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Object_Ref_Table.h
+ *
+ * $Id$
+ *
+ * @author Ossama Othman <ossama@uci.edu>
+ */
+//=============================================================================
+
+
+#ifndef TAO_OBJECT_REF_TABLE_H
+#define TAO_OBJECT_REF_TABLE_H
+
+#include /**/ "ace/pre.h"
+#include "ace/CORBA_macros.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/CORBA_String.h"
+#include "tao/Object.h"
+#include "tao/TAO_Export.h"
+#include "tao/orbconf.h"
+
+#include "ace/Array_Map.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace CORBA
+{
+ class Environment;
+}
+
+/**
+ * @class TAO_Object_Ref_Table
+ *
+ * @brief Keep a table de-stringified object references registered
+ * with the ORB.
+ *
+ * The class is necessary to allow local objects to be accessible via
+ * the resolve_initial_references() mechanism. Since local object
+ * references cannot be stringified, they cannot be placed into the
+ * initial reference map that maps object key/name to stringified
+ * object reference. Hence, another table is needed.
+ *
+ * @note
+ * The stringified reference table is still needed since it is
+ * sometimes necessary to delay de-stringification of an IOR until it
+ * is needed. For example, "corbaname" may return different results
+ * on each use.
+ */
+class TAO_Export TAO_Object_Ref_Table
+{
+public:
+
+ typedef ACE_Array_Map<CORBA::String_var,
+ CORBA::Object_var,
+ TAO::String_Var_Equal_To> Table;
+
+ typedef Table::iterator iterator;
+
+ /// Constructor
+ TAO_Object_Ref_Table (void);
+
+ /**
+ * Register an object reference with the table, and map the given
+ * ID to it.
+ * @retval 0 Success
+ * @retval -1 Duplicate id if @c rebind is false
+ */
+ int register_initial_reference (const char * id,
+ CORBA::Object_ptr obj,
+ bool rebind = false);
+
+ /// Return the object reference associated with the given ID.
+ /// A duplicate is returned.
+ CORBA::Object_ptr resolve_initial_reference (const char * id);
+
+ /// Explicitly destroy the contents of the object reference table.
+ void destroy (void);
+
+ /**
+ * @name Forward Iterators
+ */
+ //@{
+ iterator begin (void);
+ iterator end (void);
+ //@}
+
+ /// Return the current size of the underlying table.
+ size_t current_size (void) const;
+
+private:
+
+ /**
+ * @name The canonical ACE_Map methods
+ */
+ //@{
+ int bind (const char *orb_id, CORBA::Object_ptr obj);
+ CORBA::Object_ptr find (const char *orb_id); // Returns a duplicate.
+ int unbind (const char *orb_id);
+ //@}
+
+private:
+
+ // Disallow copying and assignment.
+ TAO_Object_Ref_Table (const TAO_Object_Ref_Table &);
+ void operator= (const TAO_Object_Ref_Table &);
+
+private:
+
+ /// The implementation.
+ Table table_;
+
+ /// Table synchronization lock.
+ TAO_SYNCH_MUTEX lock_;
+
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#ifdef __ACE_INLINE__
+# include "tao/Object_Ref_Table.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_OBJECT_REF_TABLE_H */
diff --git a/TAO/tao/Object_Ref_Table.inl b/TAO/tao/Object_Ref_Table.inl
new file mode 100644
index 00000000000..e9abc371750
--- /dev/null
+++ b/TAO/tao/Object_Ref_Table.inl
@@ -0,0 +1,75 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO_Object_Ref_Table::TAO_Object_Ref_Table (void)
+ : table_ (TAO_DEFAULT_OBJECT_REF_TABLE_SIZE)
+ , lock_ ()
+{
+}
+
+ACE_INLINE int
+TAO_Object_Ref_Table::register_initial_reference (
+ const char *id,
+ CORBA::Object_ptr obj,
+ bool rebind)
+{
+ if (rebind)
+ {
+ if (this->unbind (id) == -1)
+ return -1;
+ else
+ return this->bind (id, obj);
+ }
+ else
+ return this->bind (id, obj);
+}
+
+ACE_INLINE CORBA::Object_ptr
+TAO_Object_Ref_Table::resolve_initial_reference (
+ const char * id)
+{
+ return this->find (id); // Returns a duplicate.
+}
+
+ACE_INLINE void
+TAO_Object_Ref_Table::destroy (void)
+{
+ Table tmp;
+
+ ACE_GUARD (TAO_SYNCH_MUTEX,
+ guard,
+ this->lock_);
+
+ this->table_.swap (tmp); // Force release of memory held by our table.
+}
+
+ACE_INLINE TAO_Object_Ref_Table::iterator
+TAO_Object_Ref_Table::begin (void)
+{
+ return this->table_.begin ();
+}
+
+ACE_INLINE TAO_Object_Ref_Table::iterator
+TAO_Object_Ref_Table::end (void)
+{
+ return this->table_.end ();
+}
+
+ACE_INLINE size_t
+TAO_Object_Ref_Table::current_size (void) const
+{
+ return this->table_.size ();
+}
+
+ACE_INLINE int
+TAO_Object_Ref_Table::unbind (const char *id)
+{
+ return
+ (this->table_.erase (CORBA::String_var (id)) == 0 ? -1 : 0);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Object_Reference_Sequence_Element_T.h b/TAO/tao/Object_Reference_Sequence_Element_T.h
new file mode 100644
index 00000000000..5c7f1f6f4ce
--- /dev/null
+++ b/TAO/tao/Object_Reference_Sequence_Element_T.h
@@ -0,0 +1,131 @@
+#ifndef guard_object_reference_sequence_element_hpp
+#define guard_object_reference_sequence_element_hpp
+/**
+ * @file
+ *
+ * @brief Implement the type returned by operator[] in object_reference
+ * sequences.
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan
+ */
+#include "tao/Basic_Types.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+namespace details
+{
+
+template<typename obj_ref_traits>
+class object_reference_sequence_element
+{
+public:
+ typedef typename obj_ref_traits::object_type object_reference_type;
+ typedef object_reference_type * value_type;
+ typedef object_reference_type const * const_value_type;
+ typedef typename obj_ref_traits::object_type_var object_reference_var;
+
+private:
+ inline object_reference_sequence_element<obj_ref_traits> & pseudo_copy_swap(
+ object_reference_var & rhs)
+ {
+ if (release())
+ {
+ obj_ref_traits::release(*element_);
+ }
+ *element_ = rhs._retn();
+ return *this;
+ }
+
+public:
+ object_reference_sequence_element(
+ value_type & e, CORBA::Boolean release)
+ : element_(&e)
+ , release_(release)
+ {
+ }
+
+ object_reference_sequence_element(
+ object_reference_sequence_element const & rhs)
+ : element_(rhs.element_)
+ , release_(rhs.release_)
+ {
+ }
+
+ ~object_reference_sequence_element()
+ {
+ }
+
+ object_reference_sequence_element & operator=(
+ object_reference_var const & rhs)
+ {
+ object_reference_var tmp(rhs);
+ return pseudo_copy_swap(tmp);
+ }
+
+ object_reference_sequence_element & operator=(
+ object_reference_sequence_element const & rhs)
+ {
+ object_reference_var tmp(obj_ref_traits::duplicate(*rhs.element_));
+ return pseudo_copy_swap(tmp);
+ }
+
+ object_reference_sequence_element & operator=(value_type rhs)
+ {
+ object_reference_var tmp(rhs);
+ return pseudo_copy_swap(tmp);
+ }
+
+ inline operator value_type()
+ {
+ return *element_;
+ }
+
+ inline operator const_value_type() const
+ {
+ return *element_;
+ }
+
+ inline object_reference_type *in (void) const {
+ return *this->element_;
+ }
+
+ inline value_type operator->()
+ {
+ return *this->element_;
+ }
+
+ inline value_type operator->() const
+ {
+ return *this->element_;
+ }
+
+ void swap(object_reference_sequence_element & rhs)
+ {
+ std::swap(this->element_, rhs.element_);
+ std::swap(this->release_, rhs.release_);
+ }
+
+ inline CORBA::Boolean release() const
+ {
+ return this->release_;
+ }
+
+private:
+ // This function is not implemented
+ object_reference_sequence_element();
+
+private:
+ value_type * element_;
+ CORBA::Boolean release_;
+};
+
+} // namespace details
+} // namespace CORBA
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif // guard_object_reference_sequence_element_hpp
diff --git a/TAO/tao/Object_Reference_Traits_Base_T.h b/TAO/tao/Object_Reference_Traits_Base_T.h
new file mode 100644
index 00000000000..91eb1d44a18
--- /dev/null
+++ b/TAO/tao/Object_Reference_Traits_Base_T.h
@@ -0,0 +1,56 @@
+#ifndef object_reference_traits_base_hpp
+#define object_reference_traits_base_hpp
+/**
+ * @file
+ *
+ * @brief Base class for the object reference traits.
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan
+ */
+
+#include "tao/Objref_VarOut_T.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+namespace details
+{
+
+template<typename object_t, typename object_t_var>
+struct object_reference_traits_base
+{
+ typedef object_t object_type;
+ typedef object_type * value_type;
+ typedef object_type const * const_value_type;
+ typedef object_t_var object_type_var;
+
+ inline static void release(object_type * object)
+ {
+ TAO::Objref_Traits<object_type>::release(object);
+ }
+
+ inline static object_type * duplicate(object_type * object)
+ {
+ return TAO::Objref_Traits<object_type>::duplicate(object);
+ }
+
+ inline static object_type * nil()
+ {
+ return TAO::Objref_Traits<object_type>::nil();
+ }
+
+ inline static object_type * default_initializer()
+ {
+ return nil();
+ }
+};
+
+} // namespace details
+} // namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif // object_reference_traits_base_hpp
diff --git a/TAO/tao/Object_Reference_Traits_T.h b/TAO/tao/Object_Reference_Traits_T.h
new file mode 100644
index 00000000000..004c191fe28
--- /dev/null
+++ b/TAO/tao/Object_Reference_Traits_T.h
@@ -0,0 +1,83 @@
+#ifndef guard_object_reference_traits_hpp
+#define guard_object_reference_traits_hpp
+/**
+ * @file
+ *
+ * @brief Implement the element manipulation traits for object
+ * reference types.
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan
+ */
+#include "Object_Reference_Traits_Base_T.h"
+
+#include <algorithm>
+#include <functional>
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+namespace details
+{
+
+template<class object_t, class object_t_var, class derived>
+struct object_reference_traits_decorator
+{
+ typedef object_t object_type;
+ typedef object_type * value_type;
+ typedef object_type const * const_value_type;
+ typedef object_t_var object_type_var;
+
+ inline static void zero_range(
+ object_type ** begin, object_type ** end)
+ {
+ std::fill(begin, end, derived::nil());
+ }
+
+ inline static void initialize_range(
+ object_type ** begin, object_type ** end)
+ {
+ std::generate(begin, end, &derived::default_initializer);
+ }
+
+ inline static void copy_range(
+ object_type ** begin, object_type ** end, object_type ** dst)
+ {
+ std::transform(begin, end, dst, &derived::duplicate);
+ }
+
+ inline static void release_range(
+ object_type ** begin, object_type ** end)
+ {
+ std::for_each(begin, end, &derived::release);
+ }
+
+ inline static object_type const * initialize_if_zero(object_type * & element)
+ {
+ if (element == 0)
+ {
+ element = derived::nil();
+ }
+ return element;
+ }
+};
+
+template<typename object_t, typename object_t_var, bool dummy>
+struct object_reference_traits
+ : public object_reference_traits_base<object_t, object_t_var>
+ , public object_reference_traits_decorator<object_t, object_t_var, object_reference_traits<object_t,object_t_var,dummy> >
+{
+ typedef object_t object_type;
+ typedef object_type * value_type;
+ typedef object_type const * const_value_type;
+ typedef object_t_var object_type_var;
+};
+
+} // namespace details
+} // namespace CORBA
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif // guard_object_reference_traits_hpp
diff --git a/TAO/tao/Object_T.cpp b/TAO/tao/Object_T.cpp
new file mode 100644
index 00000000000..6a6808b2738
--- /dev/null
+++ b/TAO/tao/Object_T.cpp
@@ -0,0 +1,136 @@
+// $Id$
+
+#ifndef TAO_OBJECT_T_CPP
+#define TAO_OBJECT_T_CPP
+
+#include "tao/Object_T.h"
+#include "tao/Stub.h"
+#include "tao/SystemException.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ template<typename T>
+ T *
+ Narrow_Utils<T>::narrow (CORBA::Object_ptr obj,
+ const char *repo_id,
+ Proxy_Broker_Factory pbf
+ ACE_ENV_ARG_DECL)
+ {
+ if (CORBA::is_nil (obj))
+ {
+ return T::_nil ();
+ }
+
+ CORBA::Boolean const is_it = obj->_is_a (repo_id
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (T::_nil ());
+
+ if (is_it == false)
+ {
+ return T::_nil ();
+ }
+
+ return TAO::Narrow_Utils<T>::unchecked_narrow (obj,
+ repo_id,
+ pbf
+ ACE_ENV_ARG_PARAMETER);
+ }
+
+ template<typename T> T *
+ Narrow_Utils<T>::unchecked_narrow (CORBA::Object_ptr obj,
+ Proxy_Broker_Factory pbf)
+ {
+ ACE_DECLARE_NEW_CORBA_ENV;
+
+ T *proxy = 0;
+ ACE_TRY
+ {
+ proxy =
+ TAO::Narrow_Utils<T>::unchecked_narrow (obj,
+ 0,
+ pbf
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ // Swallow the exception
+ return T::_nil ();
+ }
+ ACE_ENDTRY;
+ ACE_CHECK_RETURN (proxy);
+
+ return proxy;
+ }
+
+ template<typename T> T *
+ Narrow_Utils<T>::unchecked_narrow (CORBA::Object_ptr obj,
+ const char *,
+ Proxy_Broker_Factory pbf
+ ACE_ENV_ARG_DECL)
+ {
+ if (CORBA::is_nil (obj))
+ {
+ return T::_nil ();
+ }
+
+ if (obj->_is_local ())
+ {
+ return T::_duplicate (dynamic_cast<T *> (obj));
+ }
+
+ T_ptr proxy = Narrow_Utils<T>::lazy_evaluation (obj);
+
+ if (!CORBA::is_nil (proxy))
+ {
+ return proxy;
+ }
+
+ TAO_Stub* stub = obj->_stubobj ();
+
+ if (stub == 0)
+ {
+ // If we're here, we have been passed a bogus objref.
+ ACE_THROW_RETURN (CORBA::BAD_PARAM (), T::_nil ());
+ }
+
+ stub->_incr_refcnt ();
+
+ bool const collocated =
+ !CORBA::is_nil (stub->servant_orb_var ().in ())
+ && stub->optimize_collocation_objects ()
+ && obj->_is_collocated ()
+ && pbf != 0;
+
+ ACE_NEW_THROW_EX (proxy,
+ T (stub,
+ collocated,
+ obj->_servant ()),
+ CORBA::NO_MEMORY ());
+ return proxy;
+ }
+
+ template<typename T>
+ T *
+ Narrow_Utils<T>::lazy_evaluation (CORBA::Object_ptr obj)
+ {
+ T_ptr default_proxy = T::_nil ();
+
+ // Code for lazily evaluated IORs.
+ if (!obj->is_evaluated ())
+ {
+ ACE_NEW_RETURN (default_proxy,
+ T (obj->steal_ior (),
+ obj->orb_core ()),
+ T::_nil ());
+ }
+
+ return default_proxy;
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_OBJECT_T_CPP */
diff --git a/TAO/tao/Object_T.h b/TAO/tao/Object_T.h
new file mode 100644
index 00000000000..c4cfd88230c
--- /dev/null
+++ b/TAO/tao/Object_T.h
@@ -0,0 +1,82 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Object_T.h
+ *
+ * $Id$
+ *
+ * Templatized utilities common to all IDL interfaces.
+ *
+ * @author Jeff Parsons <j.parsons@vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_CORBA_OBJECT_T_H
+#define TAO_CORBA_OBJECT_T_H
+
+#include /**/ "ace/pre.h"
+
+#include "ace/config-all.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Versioned_Namespace.h"
+#include "ace/CORBA_macros.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace CORBA
+{
+ class Object;
+ typedef Object *Object_ptr;
+}
+
+namespace TAO
+{
+ class Collocation_Proxy_Broker;
+
+ typedef
+ Collocation_Proxy_Broker * (* Proxy_Broker_Factory)(CORBA::Object_ptr);
+
+ template<typename T>
+ class Narrow_Utils
+ {
+ public:
+ typedef T *T_ptr;
+
+ static T_ptr narrow (CORBA::Object_ptr,
+ const char *repo_id,
+ Proxy_Broker_Factory
+ ACE_ENV_ARG_DECL);
+
+ // Version used the operators.
+ static T_ptr unchecked_narrow (CORBA::Object_ptr,
+ Proxy_Broker_Factory);
+
+ static T_ptr unchecked_narrow (CORBA::Object_ptr,
+ const char *repo_id,
+ Proxy_Broker_Factory
+ ACE_ENV_ARG_DECL);
+
+ private:
+ // Code for lazily evaluated IORs.
+ static T_ptr lazy_evaluation (CORBA::Object_ptr);
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+#include "tao/Object_T.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
+#pragma implementation ("Object_T.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_CORBA_OBJECT_T_H */
diff --git a/TAO/tao/Objref_VarOut_T.cpp b/TAO/tao/Objref_VarOut_T.cpp
new file mode 100644
index 00000000000..c8b86b6e406
--- /dev/null
+++ b/TAO/tao/Objref_VarOut_T.cpp
@@ -0,0 +1,195 @@
+// $Id$
+#ifndef TAO_OBJREF_VAROUT_T_CPP
+#define TAO_OBJREF_VAROUT_T_CPP
+
+#include "tao/Objref_VarOut_T.h"
+#include "tao/Environment.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template <typename T>
+TAO_Objref_Var_T<T>::TAO_Objref_Var_T (void)
+ : ptr_ (TAO::Objref_Traits<T>::nil ())
+{
+}
+
+template <typename T>
+TAO_Objref_Var_T<T>::TAO_Objref_Var_T (
+ const TAO_Objref_Var_T<T> & p
+ )
+ : TAO_Base_var (),
+ ptr_ (TAO::Objref_Traits<T>::duplicate (p.ptr ()))
+{
+}
+
+template <typename T>
+TAO_Objref_Var_T<T>::~TAO_Objref_Var_T (void)
+{
+ TAO::Objref_Traits<T>::release (this->ptr_);
+}
+
+template <typename T>
+TAO_Objref_Var_T<T> &
+TAO_Objref_Var_T<T>::operator= (T * p)
+{
+ TAO::Objref_Traits<T>::release (this->ptr_);
+ this->ptr_ = p;
+ return *this;
+}
+
+template <typename T>
+TAO_Objref_Var_T<T> &
+TAO_Objref_Var_T<T>::operator= (
+ const TAO_Objref_Var_T<T> & p
+ )
+{
+ if (this != &p)
+ {
+ TAO::Objref_Traits<T>::release (this->ptr_);
+ this->ptr_ = TAO::Objref_Traits<T>::duplicate (p.ptr ());
+ }
+
+ return *this;
+}
+
+template <typename T>
+T *
+TAO_Objref_Var_T<T>::operator-> (void) const
+{
+ return this->ptr_;
+}
+
+template <typename T>
+TAO_Objref_Var_T<T>::operator T * const & () const
+{
+ return this->ptr_;
+}
+
+template <typename T>
+TAO_Objref_Var_T<T>::operator T *& ()
+{
+ return this->ptr_;
+}
+
+template <typename T>
+T *
+TAO_Objref_Var_T<T>::in (void) const
+{
+ return this->ptr_;
+}
+
+template <typename T>
+T *&
+TAO_Objref_Var_T<T>::inout (void)
+{
+ return this->ptr_;
+}
+
+template <typename T>
+T *&
+TAO_Objref_Var_T<T>::out (void)
+{
+ TAO::Objref_Traits<T>::release (this->ptr_);
+ this->ptr_ = TAO::Objref_Traits<T>::nil ();
+ return this->ptr_;
+}
+
+template <typename T>
+T *
+TAO_Objref_Var_T<T>::_retn (void)
+{
+ T * val = this->ptr_;
+ this->ptr_ = TAO::Objref_Traits<T>::nil ();
+ return val;
+}
+
+template <typename T>
+T *
+TAO_Objref_Var_T<T>::ptr (void) const
+{
+ return this->ptr_;
+}
+
+template <typename T>
+void
+TAO_Objref_Var_T<T>::free (void)
+{
+ TAO::Objref_Traits<T>::release (this->ptr_);
+}
+
+template <typename T>
+void
+TAO_Objref_Var_T<T>::reset (T * p)
+{
+ TAO::Objref_Traits<T>::release (this->ptr_);
+ this->ptr_ = p;
+}
+
+// ******************************************************
+
+template <typename T>
+TAO_Objref_Out_T<T>::TAO_Objref_Out_T (T *& p)
+ : ptr_ (p)
+{
+ this->ptr_ = TAO::Objref_Traits<T>::nil ();
+}
+
+template <typename T>
+TAO_Objref_Out_T<T>::TAO_Objref_Out_T (
+ TAO_Objref_Var_T<T> & p
+ )
+ : ptr_ (p.out ())
+{
+ TAO::Objref_Traits<T>::release (this->ptr_);
+ this->ptr_ = TAO::Objref_Traits<T>::nil ();
+}
+
+template <typename T>
+TAO_Objref_Out_T<T>::TAO_Objref_Out_T (
+ const TAO_Objref_Out_T<T> & p
+ )
+ : ptr_ (p.ptr_)
+{
+}
+
+template <typename T>
+TAO_Objref_Out_T<T> &
+TAO_Objref_Out_T<T>::operator= (
+ const TAO_Objref_Out_T<T> & p
+ )
+{
+ this->ptr_ = p.ptr_;
+ return *this;
+}
+
+template <typename T>
+TAO_Objref_Out_T<T> &
+TAO_Objref_Out_T<T>::operator= (T * p)
+{
+ this->ptr_ = p;
+ return *this;
+}
+
+template <typename T>
+T *&
+TAO_Objref_Out_T<T>::ptr (void)
+{
+ return this->ptr_;
+}
+
+template <typename T>
+TAO_Objref_Out_T<T>::operator T *& ()
+{
+ return this->ptr_;
+}
+
+template <typename T>
+T *
+TAO_Objref_Out_T<T>::operator-> (void)
+{
+ return this->ptr_;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_OBJREF_VAROUT_T_CPP */
diff --git a/TAO/tao/Objref_VarOut_T.h b/TAO/tao/Objref_VarOut_T.h
new file mode 100644
index 00000000000..2ecfcd75efc
--- /dev/null
+++ b/TAO/tao/Objref_VarOut_T.h
@@ -0,0 +1,136 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Objref_VarOut_T.h
+ *
+ * $Id$
+ *
+ * @author Jeff Parsons
+ */
+//=============================================================================
+
+#ifndef TAO_OBJREF_VAROUT_T_H
+#define TAO_OBJREF_VAROUT_T_H
+
+#include /**/ "ace/pre.h"
+
+#include "ace/CORBA_macros.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Basic_Types.h"
+#include "tao/varbase.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_OutputCDR;
+
+namespace TAO
+{
+ /**
+ * struct Objref_Traits
+ *
+ * @brief Specialized for each interface in generated code. Just forward
+ * declare, a specialization must always be there, if not, we get a
+ * compile error.
+ */
+ template<typename T> struct Objref_Traits;
+}
+
+/**
+ * @class TAO_Objref_Var_T
+ *
+ * @brief Parameterized implementation of @c _var class for object
+ * references.
+ *
+ */
+template <typename T>
+class TAO_Objref_Var_T : private TAO_Base_var
+{
+public:
+ TAO_Objref_Var_T (void);
+ TAO_Objref_Var_T (T * p) : ptr_ (p) {}
+ TAO_Objref_Var_T (const TAO_Objref_Var_T<T> &);
+ ~TAO_Objref_Var_T (void);
+
+ TAO_Objref_Var_T<T> & operator= (T *);
+ TAO_Objref_Var_T<T> & operator= (
+ const TAO_Objref_Var_T<T> &
+ );
+ T * operator-> (void) const;
+
+ // Cast operators.
+ operator T * const & () const;
+ operator T *& ();
+
+ typedef T _obj_type;
+ typedef T * _in_type;
+ typedef T *& _inout_type;
+ typedef T *& _out_type;
+ typedef T * _retn_type;
+
+ _in_type in (void) const;
+ _inout_type inout (void);
+ _out_type out (void);
+ _retn_type _retn (void);
+
+ // TAO extension.
+ _retn_type ptr (void) const;
+
+protected:
+ T * ptr_;
+ void free (void);
+ void reset (T *);
+
+private:
+ // Unimplemented - prevents widening assignment.
+ TAO_Objref_Var_T (const TAO_Base_var &);
+ void operator= (const TAO_Base_var &);
+};
+
+/**
+ * @class TAO_Objref_Out_T
+ *
+ * @brief Parametrized implementation of _out class for object references.
+ *
+ */
+template <typename T>
+class TAO_Objref_Out_T
+{
+public:
+ TAO_Objref_Out_T (T *&);
+ TAO_Objref_Out_T (TAO_Objref_Var_T<T> &);
+ TAO_Objref_Out_T (const TAO_Objref_Out_T<T> &);
+
+ TAO_Objref_Out_T &operator= (const TAO_Objref_Out_T<T> &);
+ TAO_Objref_Out_T &operator= (T *);
+
+ // Cast operator.
+ operator T *& ();
+
+ T *& ptr (void);
+ T * operator-> (void);
+
+private:
+ T *& ptr_;
+
+ /// Assignment from _var not allowed.
+ TAO_Objref_Out_T &operator= (const TAO_Objref_Var_T<T> &);
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+#include "tao/Objref_VarOut_T.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
+#pragma implementation ("Objref_VarOut_T.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_OBJREF_VAROUT_T_H */
diff --git a/TAO/tao/OctetSeq.pidl b/TAO/tao/OctetSeq.pidl
new file mode 100644
index 00000000000..19ad732f38c
--- /dev/null
+++ b/TAO/tao/OctetSeq.pidl
@@ -0,0 +1,36 @@
+// -*- IDL -*-
+//
+// $Id$
+
+/**
+ *
+ * This file was used to generate the code in OctetSeqC.*
+ * The command used to generate code is:
+ *
+ * tao_idl
+ * -oA AnyTypeCode
+ * -Ge 1 -GA -SS -Sci -Sorb
+ * -Wb,pre_include=ace/pre.h
+ * -Wb,post_include=ace/post.h
+ * -Wb,export_macro=TAO_Export
+ * -Wb,export_include=tao/TAO_Export.h
+ * -Wb,anyop_export_macro=TAO_AnyTypeCode_Export
+ * -Wb,anyop_export_include=tao/AnyTypeCode/TAO_AnyTypeCode_Export.h
+ * OctetSeq.pidl
+ *
+ * Patches for changes to the generated code are available in the
+ * `diffs' directory.
+ */
+
+
+#ifndef TAO_CORBA_OCTET_SEQ_IDL
+#define TAO_CORBA_OCTET_SEQ_IDL
+
+#pragma prefix "omg.org"
+
+module CORBA
+{
+ typedef sequence<octet> OctetSeq;
+};
+
+#endif /* TAO_CORBA_OCTET_SEQ_IDL */
diff --git a/TAO/tao/OctetSeqC.cpp b/TAO/tao/OctetSeqC.cpp
new file mode 100644
index 00000000000..93c712762cb
--- /dev/null
+++ b/TAO/tao/OctetSeqC.cpp
@@ -0,0 +1,124 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:288
+
+
+#include "tao/OctetSeqC.h"
+#include "tao/CDR.h"
+#include "tao/ORB_Core.h"
+
+// TAO_IDL - Generated from
+// be\be_visitor_arg_traits.cpp:70
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Arg traits specializations.
+namespace TAO
+{
+}
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_sequence/sequence_cs.cpp:65
+
+#if !defined (_CORBA_OCTETSEQ_CS_)
+#define _CORBA_OCTETSEQ_CS_
+
+CORBA::OctetSeq::OctetSeq (void)
+{}
+
+CORBA::OctetSeq::OctetSeq (
+ CORBA::ULong max
+ )
+ : TAO::unbounded_value_sequence<
+ CORBA::Octet
+ >
+ (max)
+{}
+
+CORBA::OctetSeq::OctetSeq (
+ CORBA::ULong max,
+ CORBA::ULong length,
+ CORBA::Octet * buffer,
+ CORBA::Boolean release
+ )
+ : TAO::unbounded_value_sequence<
+ CORBA::Octet
+ >
+ (max, length, buffer, release)
+{}
+
+CORBA::OctetSeq::OctetSeq (
+ const OctetSeq &seq
+ )
+ : TAO::unbounded_value_sequence<
+ CORBA::Octet
+ >
+ (seq)
+{}
+
+CORBA::OctetSeq::~OctetSeq (void)
+{}
+
+void CORBA::OctetSeq::_tao_any_destructor (
+ void * _tao_void_pointer
+ )
+{
+ OctetSeq * _tao_tmp_pointer =
+ static_cast<OctetSeq *> (_tao_void_pointer);
+ delete _tao_tmp_pointer;
+}
+
+#endif /* end #if !defined */
+
+// TAO_IDL - Generated from
+// be\be_visitor_sequence/cdr_op_cs.cpp:96
+
+#if !defined _TAO_CDR_OP_CORBA_OctetSeq_CPP_
+#define _TAO_CDR_OP_CORBA_OctetSeq_CPP_
+
+CORBA::Boolean operator<< (
+ TAO_OutputCDR &strm,
+ const CORBA::OctetSeq &_tao_sequence
+ )
+{
+ return TAO::marshal_sequence(strm, _tao_sequence);
+}
+
+CORBA::Boolean operator>> (
+ TAO_InputCDR &strm,
+ CORBA::OctetSeq &_tao_sequence
+ )
+{
+ return TAO::demarshal_sequence(strm, _tao_sequence);
+}
+
+#endif /* _TAO_CDR_OP_CORBA_OctetSeq_CPP_ */
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/OctetSeqC.h b/TAO/tao/OctetSeqC.h
new file mode 100644
index 00000000000..adf0c683d25
--- /dev/null
+++ b/TAO/tao/OctetSeqC.h
@@ -0,0 +1,175 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:154
+
+#ifndef _TAO_IDL_OCTETSEQC_H_
+#define _TAO_IDL_OCTETSEQC_H_
+
+#include /**/ "ace/pre.h"
+
+
+#include "ace/config-all.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/TAO_Export.h"
+#include "tao/Environment.h"
+#include "tao/Sequence_T.h"
+#include "tao/Seq_Var_T.h"
+#include "tao/Seq_Out_T.h"
+
+#if defined (TAO_EXPORT_MACRO)
+#undef TAO_EXPORT_MACRO
+#endif
+#define TAO_EXPORT_MACRO TAO_Export
+
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// TAO_IDL - Generated from
+// be\be_visitor_module/module_ch.cpp:49
+
+namespace CORBA
+{
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_sequence/sequence_ch.cpp:101
+
+#if !defined (_CORBA_OCTETSEQ_CH_)
+#define _CORBA_OCTETSEQ_CH_
+
+ class OctetSeq;
+
+ typedef
+ TAO_FixedSeq_Var_T<
+ OctetSeq
+ >
+ OctetSeq_var;
+
+ typedef
+ TAO_Seq_Out_T<
+ OctetSeq
+ >
+ OctetSeq_out;
+
+ class TAO_Export OctetSeq
+ : public
+ TAO::unbounded_value_sequence<
+ CORBA::Octet
+ >
+ {
+ public:
+ OctetSeq (void);
+ OctetSeq (CORBA::ULong max);
+ OctetSeq (
+ CORBA::ULong max,
+ CORBA::ULong length,
+ CORBA::Octet* buffer,
+ CORBA::Boolean release = false
+ );
+ OctetSeq (const OctetSeq &);
+ ~OctetSeq (void);
+
+ static void _tao_any_destructor (void *);
+
+ typedef OctetSeq_var _var_type;
+ typedef OctetSeq_out _out_type;
+
+#if (TAO_NO_COPY_OCTET_SEQUENCES == 1)
+ OctetSeq (
+ CORBA::ULong length,
+ const ACE_Message_Block* mb
+ )
+ : TAO::unbounded_value_sequence<CORBA::Octet> (length, mb) {}
+#endif /* TAO_NO_COPY_OCTET_SEQUENCE == 1 */
+ };
+
+#endif /* end #if !defined */
+
+// TAO_IDL - Generated from
+// be\be_visitor_module/module_ch.cpp:78
+
+} // module CORBA
+
+// TAO_IDL - Generated from
+// be\be_visitor_traits.cpp:61
+
+// Traits specializations.
+namespace TAO
+{
+}
+
+// Workaround for a Visual Studio .NET bug where this class is not
+// properly imported by an application if typedef'd or subclassed,
+// resulting in 'multiply defined' link errors. The export macro
+// here forces an explicit import by the application. Please see
+// http://support.microsoft.com/default.aspx?scid=kb;en-us;309801
+// The problem stems from use of the type below in PortableServer,
+// but we put the instantiation here because the application will
+// need to see it in *C.h to avoid the error.
+#if defined ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT
+ template class TAO_Export TAO::unbounded_value_sequence<CORBA::OctetSeq>;
+#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT */
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_sequence/cdr_op_ch.cpp:71
+
+#if !defined _TAO_CDR_OP_CORBA_OctetSeq_H_
+#define _TAO_CDR_OP_CORBA_OctetSeq_H_
+
+TAO_Export CORBA::Boolean operator<< (
+ TAO_OutputCDR &,
+ const CORBA::OctetSeq &
+ );
+TAO_Export CORBA::Boolean operator>> (
+ TAO_InputCDR &,
+ CORBA::OctetSeq &
+ );
+
+#endif /* _TAO_CDR_OP_CORBA_OctetSeq_H_ */
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:1062
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#include /**/ "ace/post.h"
+
+#endif /* ifndef */
diff --git a/TAO/tao/OctetSeqS.h b/TAO/tao/OctetSeqS.h
new file mode 100644
index 00000000000..17b1360599e
--- /dev/null
+++ b/TAO/tao/OctetSeqS.h
@@ -0,0 +1,28 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// Skeleton file generation suppressed with command line option -SS
diff --git a/TAO/tao/On_Demand_Fragmentation_Strategy.cpp b/TAO/tao/On_Demand_Fragmentation_Strategy.cpp
new file mode 100644
index 00000000000..329b6940b80
--- /dev/null
+++ b/TAO/tao/On_Demand_Fragmentation_Strategy.cpp
@@ -0,0 +1,93 @@
+// $Id$
+
+
+#include "tao/On_Demand_Fragmentation_Strategy.h"
+
+#include "tao/Transport.h"
+#include "tao/CDR.h"
+#include "tao/Pluggable_Messaging.h"
+#include "tao/debug.h"
+
+TAO_On_Demand_Fragmentation_Strategy::TAO_On_Demand_Fragmentation_Strategy (
+ TAO_Transport * transport,
+ CORBA::ULong max_message_size)
+ : transport_ (transport)
+ , max_message_size_ (max_message_size)
+{
+}
+
+TAO_On_Demand_Fragmentation_Strategy::~TAO_On_Demand_Fragmentation_Strategy (
+ void)
+{
+}
+
+int
+TAO_On_Demand_Fragmentation_Strategy::fragment (
+ TAO_OutputCDR & cdr,
+ ACE_CDR::ULong pending_alignment,
+ ACE_CDR::ULong pending_length)
+{
+ if (this->transport_ == 0)
+ return 0; // No transport. Can't fragment.
+
+ CORBA::Octet major = 0;
+ CORBA::Octet minor = 0;
+
+ (void) cdr.get_version (major, minor);
+
+ // GIOP fragments are supported in GIOP 1.1 and better, but TAO only
+ // supports them in 1.2 or better since GIOP 1.1 fragments do not
+ // have a fragment message header.
+ if (major == 1 && minor < 2)
+ return -1;
+
+ // Determine increase in CDR stream length if pending data is
+ // marshaled, taking into account the alignment for the given data
+ // type.
+ ACE_CDR::ULong const total_pending_length =
+ ACE_align_binary (cdr.total_length (), pending_alignment)
+ + pending_length;
+
+ // Except for the last fragment, fragmented GIOP messages must
+ // always be aligned on an 8-byte boundary. Padding will be added
+ // if necessary.
+ ACE_CDR::ULong const aligned_length =
+ ACE_align_binary (total_pending_length, ACE_CDR::MAX_ALIGNMENT);
+
+ // this->max_message_size_ must be >= 24 bytes, i.e.:
+ // 12 for GIOP protocol header
+ // + 4 for GIOP fragment header
+ // + 8 for payload (including padding)
+ // since fragments must be aligned on an 8 byte boundary.
+ if (aligned_length > this->max_message_size_)
+ {
+ // Pad the outgoing fragment if necessary.
+ if (cdr.align_write_ptr (ACE_CDR::MAX_ALIGNMENT) != 0)
+ return -1;
+
+ // More fragments to come.
+ cdr.more_fragments (true);
+
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - On_Demand_Fragmentation_Strategy::fragment, "
+ "sending fragment of size %d\n",
+ cdr.total_length ()));
+
+ // Send the current CDR stream contents through the transport,
+ // making sure to switch on the the GIOP flags "more fragments"
+ // bit.
+ if (this->transport_->send_message (cdr,
+ cdr.stub (),
+ cdr.message_semantics (),
+ cdr.timeout ()) == -1
+
+ // Now generate a fragment header.
+ || this->transport_->messaging_object ()->generate_fragment_header (
+ cdr,
+ cdr.request_id ()) != 0)
+ return -1;
+ }
+
+ return 0;
+}
diff --git a/TAO/tao/On_Demand_Fragmentation_Strategy.h b/TAO/tao/On_Demand_Fragmentation_Strategy.h
new file mode 100644
index 00000000000..8ac103f5bc7
--- /dev/null
+++ b/TAO/tao/On_Demand_Fragmentation_Strategy.h
@@ -0,0 +1,77 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file On_Demand_Fragmentation_Strategy.h
+ *
+ * $Id$
+ *
+ * @author Ossama Othman <ossama@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_ONDEMAND_FRAGMENTATION_STRATEGY_H
+#define TAO_ONDEMAND_FRAGMENTATION_STRATEGY_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/GIOP_Fragmentation_Strategy.h"
+#include "ace/CDR_Base.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_OutputCDR;
+class TAO_Transport;
+
+
+/**
+ * @class TAO_On_Demand_Fragmenation_Strategy
+ *
+ * @brief On Demand GIOP message fragmentation strategy.
+ *
+ * GIOP message fragmentation strategy that performs fragmentation
+ * when the size of the CDR stream will exceed the user configured
+ * threshold when marshaling the next/pending set of data.
+ *
+ * @see TAO_GIOP_Fragmentation_Strategy
+ */
+class TAO_On_Demand_Fragmentation_Strategy
+ : public TAO_GIOP_Fragmentation_Strategy
+{
+public:
+
+ /// Constructor.
+ TAO_On_Demand_Fragmentation_Strategy (TAO_Transport * transport,
+ ACE_CDR::ULong max_message_size);
+
+ virtual ~TAO_On_Demand_Fragmentation_Strategy (void);
+ virtual int fragment (TAO_OutputCDR & cdr,
+ ACE_CDR::ULong pending_alignment,
+ ACE_CDR::ULong pending_length);
+
+private:
+
+ // Disallow copying and assignment.
+ TAO_On_Demand_Fragmentation_Strategy (TAO_On_Demand_Fragmentation_Strategy const &);
+ void operator= (TAO_On_Demand_Fragmentation_Strategy const &);
+
+private:
+
+ /// Pointer to the underlying transport object.
+ TAO_Transport * const transport_;
+
+ /// Size of GIOP message at which fragmentation will occur.
+ ACE_CDR::ULong const max_message_size_;
+
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_ONDEMAND_FRAGMENTATION_STRATEGY_H */
diff --git a/TAO/tao/PI.mpc b/TAO/tao/PI.mpc
new file mode 100644
index 00000000000..f80f2a4cbf0
--- /dev/null
+++ b/TAO/tao/PI.mpc
@@ -0,0 +1,67 @@
+//$Id$
+project : taolib, codecfactory, core, tao_versioning_idl_defaults {
+ sharedname = TAO_PI
+ dynamicflags = TAO_PI_BUILD_DLL
+
+ Source_Files {
+ PI
+ }
+
+ Header_Files {
+ PI
+ }
+
+ Inline_Files {
+ PI
+ }
+
+ Template_Files {
+ PI
+ }
+
+ Resource_Files {
+ PI
+ }
+
+ PIDL_Files {
+ PI
+ }
+
+ IDL_Files {
+ idlflags += -Sci -SS -Gp -Gd -Ge 1 -Sc -Sorb -Sal \
+ -Wb,export_macro=TAO_PI_Export \
+ -Wb,export_include=tao/PI/pi_export.h \
+ -o PI
+ idlflags -= -Sa -St
+ PI/ORBInitInfo.pidl
+ }
+
+ IDL_Files {
+ idlflags += -Sci -SS -GA -Gp -Gd -Ge 1 -Sc -Sorb -Sal \
+ -Wb,export_macro=TAO_PI_Export \
+ -Wb,export_include=tao/PI/pi_export.h \
+ -o PI
+ idlflags -= -Sa -St
+ PI/ORBInitializer.pidl
+ PI/ClientRequestInterceptor.pidl
+ PI/Interceptor.pidl
+ PI/ClientRequestInfo.pidl
+ PI/RequestInfo.pidl
+ PI/PIForwardRequest.pidl
+ PI/PICurrent.pidl
+ PI/ProcessingModePolicy.pidl
+ }
+
+ IDL_Files {
+ idlflags += -Sci -SS -GA -Gp -Gd -Ge 1 -Sc -Sal \
+ -Wb,export_macro=TAO_PI_Export \
+ -Wb,export_include=tao/PI/pi_export.h \
+ -o PI
+ idlflags -= -Sa -St
+ PI/InvalidSlot.pidl
+ }
+
+ Pkgconfig_Files {
+ PI/TAO_PI.pc.in
+ }
+}
diff --git a/TAO/tao/PI/ClientRequestDetails.cpp b/TAO/tao/PI/ClientRequestDetails.cpp
new file mode 100644
index 00000000000..969f8adfde2
--- /dev/null
+++ b/TAO/tao/PI/ClientRequestDetails.cpp
@@ -0,0 +1,77 @@
+#include "tao/PI/ClientRequestDetails.h"
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+#if !defined (__ACE_INLINE__)
+#include "tao/PI/ClientRequestDetails.inl"
+#endif /* defined INLINE */
+
+ACE_RCSID (PI,
+ ClientRequestDetails,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ void
+ ClientRequestDetails::apply_policies (
+ const CORBA::PolicyList &policies
+ ACE_ENV_ARG_DECL)
+ {
+ // Flag to check for duplicate ProcessingModePolicy objects in the list.
+ bool processing_mode_applied = false;
+
+ const CORBA::ULong plen = policies.length ();
+
+ for (CORBA::ULong i = 0; i < plen; ++i)
+ {
+ CORBA::Policy_var policy = CORBA::Policy::_duplicate (policies[i]);
+
+ if (CORBA::is_nil (policy.in ()))
+ {
+ // Just ignore nil policies...
+ continue;
+ }
+
+ // Obtain the PolicyType from the current Policy object.
+ const CORBA::PolicyType policy_type =
+ policy->policy_type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (policy_type == PortableInterceptor::PROCESSING_MODE_POLICY_TYPE)
+ {
+ if (processing_mode_applied)
+ {
+ // This is the second time we have run into this policy type,
+ // and that is not allowed.
+ ACE_THROW (CORBA::INV_POLICY ());
+ }
+
+ // Flip the flag to true in order to trap any dupes.
+ processing_mode_applied = true;
+
+ // Narrow the Policy to the ProcessingModePolicy interface.
+ PortableInterceptor::ProcessingModePolicy_var pm_policy =
+ PortableInterceptor::ProcessingModePolicy::_narrow (
+ policy.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Save the value of the ProcessingModePolicy in our data member.
+ this->processing_mode_ =
+ pm_policy->processing_mode (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else
+ {
+ // We don't support the current policy type.
+ ACE_THROW (CORBA::INV_POLICY ());
+ }
+ }
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
diff --git a/TAO/tao/PI/ClientRequestDetails.h b/TAO/tao/PI/ClientRequestDetails.h
new file mode 100644
index 00000000000..ec4666ae047
--- /dev/null
+++ b/TAO/tao/PI/ClientRequestDetails.h
@@ -0,0 +1,84 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file ClientRequestDetails.h
+ *
+ * $Id$
+ *
+ * This file declares a class that manages the details
+ * about a registered client request interceptor. Policies can be
+ * used when interceptors are registered, and the policy values
+ * will be processed and used to modify the values of the
+ * ClientRequestDetails object associated with the registered
+ * client request interceptor.
+ *
+ * @author Tim Bradley <bradley_t@ociweb.com>
+ */
+//=============================================================================
+
+#ifndef TAO_CLIENT_REQUEST_DETAILS_H
+#define TAO_CLIENT_REQUEST_DETAILS_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+#include "tao/PI/ProcessingModePolicyC.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ /**
+ * @class ClientRequestDetails
+ *
+ * @brief The policy-driven details for a registered client request
+ * interceptor
+ *
+ * Each time a client request interceptor is registered with an ORB,
+ * a ClientRequestDetails object will be created and associated with
+ * the registered client request interceptor. If the interceptor is
+ * registered with policies, the policies will be used to adjust the
+ * values in the ClientRequestDetails appropriately.
+ */
+ class ClientRequestDetails
+ {
+ public:
+
+ ClientRequestDetails (void);
+
+ void apply_policies (const CORBA::PolicyList& policies
+ ACE_ENV_ARG_DECL);
+
+ /// Returns true if the ProcessingMode setting permits the "firing"
+ /// of the associated client request interceptor based upon the
+ /// remote vs. collocated nature of the current servant request
+ /// that is being dispatched.
+ bool should_be_processed (bool is_remote_request) const;
+
+ private:
+
+ /// The ProcessingMode setting that can be adjusted via the
+ /// PortableInterceptor::ProcessingModePolicy.
+ PortableInterceptor::ProcessingMode processing_mode_;
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+#include "tao/PI/ClientRequestDetails.inl"
+#endif /* __ACE_INLINE__ */
+
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_CLIENT_REQUEST_DETAILS_H */
diff --git a/TAO/tao/PI/ClientRequestDetails.inl b/TAO/tao/PI/ClientRequestDetails.inl
new file mode 100644
index 00000000000..f568bb9fafb
--- /dev/null
+++ b/TAO/tao/PI/ClientRequestDetails.inl
@@ -0,0 +1,27 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ ACE_INLINE
+ ClientRequestDetails::ClientRequestDetails (void)
+ : processing_mode_(PortableInterceptor::LOCAL_AND_REMOTE)
+ {
+ }
+
+ ACE_INLINE
+ bool
+ ClientRequestDetails::should_be_processed (bool is_remote_request) const
+ {
+ return ((this->processing_mode_ == PortableInterceptor::LOCAL_AND_REMOTE) ||
+ ((this->processing_mode_ == PortableInterceptor::REMOTE_ONLY) &&
+ (is_remote_request)) ||
+ ((this->processing_mode_ == PortableInterceptor::LOCAL_ONLY) &&
+ (!is_remote_request)));
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PI/ClientRequestInfo.cpp b/TAO/tao/PI/ClientRequestInfo.cpp
new file mode 100644
index 00000000000..f3df9f77449
--- /dev/null
+++ b/TAO/tao/PI/ClientRequestInfo.cpp
@@ -0,0 +1,745 @@
+// $Id$
+
+#include "tao/PI/ClientRequestInfo.h"
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+ACE_RCSID (PI,
+ ClientRequestInfo,
+ "$Id$")
+
+#include "tao/AnyTypeCode/Any.h"
+#include "tao/AnyTypeCode/ExceptionA.h"
+
+#include "tao/PI/PICurrent.h"
+#include "tao/PI/RequestInfo_Util.h"
+
+#include "tao/PolicyC.h"
+#include "tao/PortableInterceptorC.h"
+#include "tao/Invocation_Base.h"
+#include "tao/operation_details.h"
+#include "tao/Stub.h"
+#include "tao/ORB_Core.h"
+#include "tao/Profile.h"
+#include "tao/debug.h"
+#include "tao/Service_Context.h"
+#include "tao/Exception_Data.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_ClientRequestInfo::TAO_ClientRequestInfo (TAO::Invocation_Base *inv)
+ : invocation_ (inv),
+ rs_pi_current_ ()
+{
+ this->setup_picurrent ();
+}
+
+void
+TAO_ClientRequestInfo::setup_picurrent (void)
+{
+ // Retrieve the thread scope current (no TSS access incurred yet).
+ CORBA::Object_ptr pi_current_obj =
+ this->invocation_->orb_core ()->pi_current ();
+
+ TAO::PICurrent *pi_current =
+ dynamic_cast <TAO::PICurrent*> (pi_current_obj);
+
+ // If the slot count is zero, then there is nothing to copy.
+ // Prevent any copying (and hence TSS accesses) from occurring.
+ if (pi_current != 0 && pi_current->slot_count () != 0)
+ {
+ // Retrieve the thread scope current.
+ TAO::PICurrent_Impl *tsc = pi_current->tsc ();
+
+ if (tsc != 0)
+ {
+ // Logically copy the TSC's slot table to the RSC.
+ this->rs_pi_current_.take_lazy_copy (tsc);
+ }
+ }
+}
+
+IOP::ServiceContext *
+TAO_ClientRequestInfo::get_service_context_i (
+ TAO_Service_Context &service_context_list,
+ IOP::ServiceId id
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ IOP::ServiceContext_var service_context;
+
+ if (service_context_list.get_context (id, service_context.out ()) != 0)
+ {
+ // Found.
+ return service_context._retn ();
+ }
+ else
+ {
+ // Not found.
+ ACE_THROW_RETURN (CORBA::BAD_PARAM (CORBA::OMGVMCID | 26,
+ CORBA::COMPLETED_NO),
+ 0);
+ }
+}
+
+CORBA::Object_ptr
+TAO_ClientRequestInfo::target (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Object::_nil ());
+
+ return CORBA::Object::_duplicate (this->invocation_->target ());
+}
+
+CORBA::Object_ptr
+TAO_ClientRequestInfo::effective_target (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Object::_nil ());
+
+ return CORBA::Object::_duplicate (this->invocation_->effective_target ());
+}
+
+IOP::TaggedProfile *
+TAO_ClientRequestInfo::effective_profile (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ IOP::TaggedProfile *tagged_profile = 0;
+ ACE_NEW_THROW_EX (tagged_profile,
+ IOP::TaggedProfile,
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (0);
+
+ IOP::TaggedProfile_var safe_tagged_profile = tagged_profile;
+
+ TAO_Stub *stub =
+ this->invocation_->effective_target ()->_stubobj ();
+
+ IOP::TaggedProfile *ep =
+ stub->profile_in_use ()->create_tagged_profile ();
+
+ if (ep == 0)
+ {
+ ACE_THROW_RETURN (CORBA::BAD_PARAM (CORBA::OMGVMCID | 28,
+ CORBA::COMPLETED_NO),
+ 0);
+ }
+
+ // @@BAD_PARAM exception
+ tagged_profile->tag = ep->tag;
+ tagged_profile->profile_data = ep->profile_data; // Deep copy
+
+ return safe_tagged_profile._retn ();
+}
+
+// Use at own risk. There is no way currently of extracting an
+// exception from an Any. This method is in place just to be compliant
+// with the spec.
+CORBA::Any *
+TAO_ClientRequestInfo::received_exception (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ if (this->invocation_->reply_status () != PortableInterceptor::SYSTEM_EXCEPTION
+ && this->invocation_->reply_status () != PortableInterceptor::USER_EXCEPTION)
+ {
+ ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14,
+ CORBA::COMPLETED_NO), 0);
+ }
+
+ // The spec says that if it is a user exception which can't be
+ // inserted then the UNKNOWN exception needs to be thrown with minor
+ // code 1.
+
+ CORBA::Any * temp = 0;
+
+ ACE_NEW_THROW_EX (temp,
+ CORBA::Any,
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (0);
+
+ CORBA::Any_var caught_exception_var = temp;
+
+ CORBA::Exception *caught_exception =
+ invocation_->caught_exception ();
+
+ if (caught_exception != 0)
+ *temp <<= *(caught_exception);
+
+ return caught_exception_var._retn ();
+}
+
+char *
+TAO_ClientRequestInfo::received_exception_id (
+ ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ CORBA::Exception *caught_exception =
+ invocation_->caught_exception ();
+
+ if (caught_exception == 0)
+ {
+ ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14,
+ CORBA::COMPLETED_NO),
+ 0);
+ }
+
+ return CORBA::string_dup (caught_exception->_rep_id ());
+}
+
+IOP::TaggedComponent *
+TAO_ClientRequestInfo::get_effective_component (
+ IOP::ComponentId id
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ TAO_Stub *stub =
+ this->invocation_->effective_target ()->_stubobj ();
+
+ TAO_Tagged_Components &ecs =
+ stub->profile_in_use ()->tagged_components ();
+
+ IOP::MultipleComponentProfile &components = ecs.components ();
+
+ const CORBA::ULong len = components.length ();
+ for (CORBA::ULong i = 0; i < len; ++i)
+ {
+ if (components[i].tag == id)
+ {
+ IOP::TaggedComponent *tagged_component = 0;
+
+ // Only allocate a sequence if we have a tagged component
+ // that matches the given IOP::ComponentId.
+ ACE_NEW_THROW_EX (tagged_component,
+ IOP::TaggedComponent,
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (0);
+
+ IOP::TaggedComponent_var safe_tagged_component =
+ tagged_component;
+
+ (*tagged_component) = components[i]; // Deep copy
+
+ return safe_tagged_component._retn ();
+ }
+ }
+
+ // No tagged component was found that matched the given
+ // IOP::ComponentId.
+ ACE_THROW_RETURN (CORBA::BAD_PARAM (CORBA::OMGVMCID | 28,
+ CORBA::COMPLETED_NO),
+ 0);
+}
+
+IOP::TaggedComponentSeq *
+TAO_ClientRequestInfo::get_effective_components (
+ IOP::ComponentId id
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ TAO_Stub *stub =
+ this->invocation_->target ()->_stubobj ();
+
+ TAO_Tagged_Components &ecs =
+ stub->profile_in_use ()->tagged_components ();
+
+ IOP::MultipleComponentProfile &components = ecs.components ();
+
+ IOP::TaggedComponentSeq *tagged_components = 0;
+ IOP::TaggedComponentSeq_var safe_tagged_components;
+
+ const CORBA::ULong len = components.length ();
+ for (CORBA::ULong i = 0; i < len; ++i)
+ {
+ if (components[i].tag == id)
+ {
+ if (tagged_components == 0)
+ {
+ // Only allocate a sequence if we have tagged components
+ // to place into the sequence.
+ ACE_NEW_THROW_EX (tagged_components,
+ IOP::TaggedComponentSeq,
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (0);
+
+ safe_tagged_components = tagged_components;
+ }
+
+ const CORBA::ULong old_len = safe_tagged_components->length ();
+ safe_tagged_components->length (old_len + 1);
+
+ safe_tagged_components[old_len] = components[i]; // Deep copy
+ }
+ }
+
+ if (tagged_components == 0)
+ {
+ // No tagged component sequence was allocated, meaning no tagged
+ // components were found that matched the given
+ // IOP::ComponentId.
+ ACE_THROW_RETURN (CORBA::BAD_PARAM (CORBA::OMGVMCID | 28,
+ CORBA::COMPLETED_NO),
+ 0);
+ }
+
+ return safe_tagged_components._retn ();
+}
+
+CORBA::Policy_ptr
+TAO_ClientRequestInfo::get_request_policy (CORBA::PolicyType type
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+
+ // @@ Do we need to look anywhere else for the request policies?
+
+#if TAO_HAS_CORBA_MESSAGING == 1
+ return this->invocation_->target ()->_get_policy (type
+ ACE_ENV_ARG_PARAMETER);
+#else
+ ACE_UNUSED_ARG (type);
+
+ ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ ENOTSUP),
+ CORBA::COMPLETED_NO),
+ 0);
+#endif /* TAO_HAS_CORBA_MESSAGING == 1 */
+}
+
+void
+TAO_ClientRequestInfo::add_request_service_context (
+ const IOP::ServiceContext & service_context,
+ CORBA::Boolean replace
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Get the service context from the list
+ TAO_Service_Context &service_context_list =
+ this->invocation_->request_service_context ();
+
+ if (service_context_list.set_context (service_context, replace) == 0)
+ {
+ ACE_THROW (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 15,
+ CORBA::COMPLETED_NO));
+ }
+}
+
+CORBA::ULong
+TAO_ClientRequestInfo::request_id (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ // @todo We may have to worry about AMI once we support interceptors
+ // in AMI requests since the Invocation object no longer
+ // exists once an AMI request has been made. In that case,
+ // the reply dispatcher address should be used.
+
+ // The request ID must be unique across all outstanding requests.
+ // To avoid synchronization overhead, the address of this Invocation
+ // object is used as the request ID. This guarantees that the
+ // request ID is unique without being forced to acquire a lock.
+ //
+ // For 64-bit platforms, we right shift 8 bits and then use the
+ // lower 32 bits of that shifted value. Rather than losing the
+ // upper 32 bits of significant digits by taking the lower 32 bits,
+ // we only lose the upper 24 by doing the shift. Basically, the
+ // resulting request ID will comprised of bits 8 through 39. This is
+ // made possible by the fact that this Invocation object is large
+ // enough to increase the likelihood that those bits (0 through 39)
+ // are unique. In particular, this->buffer_ is 512 bytes
+ // (ACE_CDR::DEFAULT_BUFSIZE) long by default; implying that
+ // dropping the lower 8 bits of the this Invocation object's 64 bit
+ // address (i.e. 256 bytes) is not a problem.
+
+ CORBA::ULong id = 0;
+
+ // Note that we reinterpret_cast to an "unsigned long" instead of
+ // CORBA::ULong since we need to first cast to an integer large
+ // enough to hold an address to avoid compile-time warnings on some
+ // 64-bit platforms.
+
+ // 32 bit address
+ if (sizeof (this) == 4)
+ id =
+ static_cast<CORBA::ULong> (
+ reinterpret_cast<ptrdiff_t> (this->invocation_));
+
+ // 64 bit address -- bits 8 through 39 (see notes above!)
+ // In this case, we make sure this object is large enough to safely
+ // do the right shift. This is necessary since the size of the
+ // buffer that makes this object is configurable.
+ else if (sizeof (this) == 8
+ && sizeof (*(this->invocation_)) > 256 /* 2 << 8 */)
+ id =
+ (static_cast<CORBA::ULong> (
+ reinterpret_cast<ptrdiff_t> (this->invocation_)) >> 8) & 0xFFFFFFFFu;
+
+ // 64 bit address -- lower 32 bits
+ else if (sizeof (this) == 8)
+ id =
+ static_cast<CORBA::ULong> (
+ reinterpret_cast<ptrdiff_t> (this->invocation_)) & 0xFFFFFFFFu;
+
+ // @@ The following request ID generator prevents the
+ // PortableInterceptor::ClientRequestInterceptor::send_request()
+ // interception point from occuring before the call to connect,
+ // thus preventing us from adding an optimization that itself
+ // prevents a connection from being unnecessarily performed.
+ // Thus, the ClientRequestInfo object is forced to have its own
+ // request ID generator in order to make it possible to implement
+ // the above optimization.
+ //
+ // Ideally, this request ID generator should go away, especially
+ // since it adds a lock to the critical path.
+ // else // Fallback
+ // id = this->invocation_->request_id ();
+
+ else
+ {
+ if (TAO_debug_level > 0)
+ ACE_ERROR ((LM_ERROR,
+ "(%P|%t) ClientRequestInfo::request_id() failed\n"
+ "(%P|%t) since its request ID generator is not\n"
+ "(%P|%t) supported on this platform.\n"));
+
+ ACE_THROW_RETURN (CORBA::INTERNAL (), 0);
+ }
+
+ return id;
+}
+
+char *
+TAO_ClientRequestInfo::operation (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ return CORBA::string_dup (
+ this->invocation_->operation_details ().opname ());
+}
+
+Dynamic::ParameterList *
+TAO_ClientRequestInfo::arguments (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ // Generate the argument list on demand.
+ Dynamic::ParameterList *parameter_list =
+ TAO_RequestInfo_Util::make_parameter_list (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ Dynamic::ParameterList_var safe_parameter_list = parameter_list;
+
+ if (this->parameter_list (*parameter_list) == false)
+ ACE_THROW_RETURN (CORBA::MARSHAL (),
+ 0);
+
+ return safe_parameter_list._retn ();
+
+ //return this->invocation_->arguments (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+bool
+TAO_ClientRequestInfo::parameter_list (Dynamic::ParameterList &param_list)
+{
+ // Account for the return type that could be in the argument list.
+ param_list.length (this->invocation_->operation_details ().args_num () - 1);
+
+ for (CORBA::ULong i = 1; i != this->invocation_->operation_details ().args_num (); ++i)
+ {
+ TAO::Argument *argument =
+ this->invocation_->operation_details ().args ()[i];
+ Dynamic::Parameter &p = param_list[i - 1];
+ p.mode = argument->mode ();
+ argument->interceptor_value (&p.argument);
+ }
+
+ return true;
+}
+
+Dynamic::ExceptionList *
+TAO_ClientRequestInfo::exceptions (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ Dynamic::ExceptionList *exception_list =
+ TAO_RequestInfo_Util::make_exception_list (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ Dynamic::ExceptionList_var safe_exception_list = exception_list;
+
+ if (this->exception_list (*exception_list) == false)
+ ACE_THROW_RETURN (CORBA::MARSHAL (),
+ 0);
+
+ return safe_exception_list._retn ();
+}
+
+bool
+TAO_ClientRequestInfo::exception_list (Dynamic::ExceptionList &exception_list)
+{
+
+ if (this->invocation_->operation_details ().ex_count ())
+ {
+ exception_list.length (this->invocation_->operation_details ().ex_count ());
+
+ for (CORBA::ULong i = 0;
+ i != this->invocation_->operation_details ().ex_count ();
+ ++i)
+ {
+ CORBA::TypeCode_ptr tcp =
+ this->invocation_->operation_details ().ex_data ()[i].tc_ptr;
+ if (!CORBA::is_nil (tcp))
+ {
+ exception_list[i] = tcp;
+ }
+ }
+ }
+ return true;
+}
+
+Dynamic::ContextList *
+TAO_ClientRequestInfo::contexts (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14,
+ CORBA::COMPLETED_NO),
+ 0);
+}
+
+Dynamic::RequestContext *
+TAO_ClientRequestInfo::operation_context (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14,
+ CORBA::COMPLETED_NO),
+ 0);
+}
+
+CORBA::Any *
+TAO_ClientRequestInfo::result (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ // Generate the result on demand.
+ static const CORBA::Boolean tk_void_any = 0;
+ CORBA::Any *result_any =
+ TAO_RequestInfo_Util::make_any (tk_void_any ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ CORBA::Any_var safe_result_any = result_any;
+
+ if (this->result (result_any) == false)
+ ACE_THROW_RETURN (CORBA::MARSHAL (),
+ 0);
+
+ return safe_result_any._retn ();
+}
+
+bool
+TAO_ClientRequestInfo::result (CORBA::Any *any)
+{
+ // Result is always first element in TAO::Argument array.
+ TAO::Argument * const r = this->invocation_->operation_details ().args ()[0];
+
+ r->interceptor_value (any);
+
+ return true;
+}
+
+CORBA::Boolean
+TAO_ClientRequestInfo::response_expected (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ return this->invocation_->response_expected ();
+}
+
+Messaging::SyncScope
+TAO_ClientRequestInfo::sync_scope (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ return this->invocation_->operation_details ().response_flags ();
+}
+
+PortableInterceptor::ReplyStatus
+TAO_ClientRequestInfo::reply_status (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (PortableInterceptor::SYSTEM_EXCEPTION);
+
+ if (this->invocation_->reply_status() == -1)
+ {
+ // A reply hasn't been received yet.
+ ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14,
+ CORBA::COMPLETED_NO),
+ -1);
+ }
+
+ return this->invocation_->reply_status();
+}
+
+CORBA::Object_ptr
+TAO_ClientRequestInfo::forward_reference (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Object::_nil ());
+
+ if (this->invocation_->reply_status() != PortableInterceptor::LOCATION_FORWARD)
+ {
+ ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14,
+ CORBA::COMPLETED_NO),
+ CORBA::Object::_nil ());
+ }
+
+ // TAO::Invocation_Base::forward_reference() already duplicates the
+ // reference before returning it so there is no need to duplicate it
+ // here.
+ return this->invocation_->forwarded_reference ();
+}
+
+CORBA::Any *
+TAO_ClientRequestInfo::get_slot (PortableInterceptor::SlotId id
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableInterceptor::InvalidSlot))
+{
+ this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ return this->rs_pi_current_.get_slot (id
+ ACE_ENV_ARG_PARAMETER);
+}
+
+IOP::ServiceContext *
+TAO_ClientRequestInfo::get_request_service_context (
+ IOP::ServiceId id
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ // Get the service context from the list
+ TAO_Service_Context &service_context_list =
+ this->invocation_->request_service_context ();
+
+ return this->get_service_context_i (service_context_list,
+ id
+ ACE_ENV_ARG_PARAMETER);
+}
+
+IOP::ServiceContext *
+TAO_ClientRequestInfo::get_reply_service_context (
+ IOP::ServiceId id
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ // Get the service context from the list
+ TAO_Service_Context &service_context_list =
+ this->invocation_->reply_service_context ();
+
+ return this->get_service_context_i (service_context_list,
+ id
+ ACE_ENV_ARG_PARAMETER);
+}
+
+void
+TAO_ClientRequestInfo::check_validity (ACE_ENV_SINGLE_ARG_DECL)
+{
+ if (this->invocation_ == 0)
+ ACE_THROW (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14,
+ CORBA::COMPLETED_NO));
+}
+
+void
+TAO_ClientRequestInfo::tao_ft_expiration_time (TimeBase::TimeT time)
+{
+ this->invocation_->operation_details ().ft_expiration_time (time);
+}
+
+TimeBase::TimeT
+TAO_ClientRequestInfo::tao_ft_expiration_time (void) const
+{
+ return this->invocation_->operation_details ().ft_expiration_time ();
+}
+
+void
+TAO_ClientRequestInfo::tao_ft_retention_id (CORBA::Long request_id)
+{
+ this->invocation_->operation_details ().ft_retention_id (request_id) ;
+}
+
+CORBA::Long
+TAO_ClientRequestInfo::tao_ft_retention_id (void) const
+{
+ return this->invocation_->operation_details ().ft_retention_id ();
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
diff --git a/TAO/tao/PI/ClientRequestInfo.h b/TAO/tao/PI/ClientRequestInfo.h
new file mode 100644
index 00000000000..4671889f2b1
--- /dev/null
+++ b/TAO/tao/PI/ClientRequestInfo.h
@@ -0,0 +1,288 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file ClientRequestInfo.h
+ *
+ * $Id$
+ *
+ * This is the implementation of the
+ * PortableInterceptor::ClientRequestInfo interface.
+ *
+ * @author Ossama Othman <ossama@uci.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_CLIENT_REQUEST_INFO_H
+#define TAO_CLIENT_REQUEST_INFO_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if (TAO_HAS_INTERCEPTORS == 1)
+
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+#include "tao/AnyTypeCode/AnyTypeCode_methods.h"
+#include "tao/PI/ClientRequestInfoC.h"
+#include "tao/PI/PIForwardRequestC.h"
+#include "tao/PI/PICurrent_Impl.h"
+#include "tao/CORBA_methods.h"
+#include "tao/ORB_Constants.h"
+#include "tao/LocalObject.h"
+#include "tao/Invocation_Utils.h"
+#include "tao/TimeBaseC.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Service_Context;
+
+namespace TAO
+{
+ class Invocation_Base;
+}
+
+namespace Dynamic
+{
+ class ParameterList;
+ class ExceptionList;
+ typedef CORBA::StringSeq RequestContext;
+ typedef CORBA::StringSeq ContextList;
+}
+
+namespace Messaging
+{
+ typedef CORBA::Short SyncScope;
+}
+
+/**
+ * @class TAO_ClientRequestInfo
+ *
+ * @brief Implementation of the PortableInterceptor::ClientRequestInfo
+ * interface.
+ */
+class TAO_PI_Export TAO_ClientRequestInfo
+ : public virtual PortableInterceptor::ClientRequestInfo,
+ public virtual TAO_Local_RefCounted_Object
+{
+public:
+ TAO_ClientRequestInfo (TAO::Invocation_Base *invocation);
+
+ /// Return an ID unique to the current request. This request ID may
+ /// or may not be the same as the GIOP request ID.
+ virtual CORBA::ULong request_id (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Return the operation name for the current request.
+ virtual char * operation (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Return the list of arguments passed to the current operation.
+ virtual Dynamic::ParameterList * arguments (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Return the list of exceptions the current operation is capable
+ /// of throwing.
+ virtual Dynamic::ExceptionList * exceptions (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual Dynamic::ContextList * contexts (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual Dynamic::RequestContext * operation_context (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Return the result of the current request. If there is no return
+ /// value then an Any with tk_void TypeCode is returned. This is
+ /// method is not valid for oneway operations.
+ virtual CORBA::Any * result (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Returns true for a two-way operation, and false otherwise.
+ virtual CORBA::Boolean response_expected (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException)) ;
+
+ /// Return the sync_scope policy value for the current one-way
+ /// operation. If the operation is not a one-way, a
+ /// CORBA::BAD_INV_ORDER exception is thrown.
+ virtual Messaging::SyncScope sync_scope (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Return the reply status for the current request.
+ /**
+ * Statuses can be PortableInterceptor::SUCCESSFUL,
+ * SYSTEM_EXCEPTION, USER_EXCEPTION, LOCATION_FORWARD,
+ * TRANSPORT_RETRY, UNKNOWN.
+ */
+ virtual PortableInterceptor::ReplyStatus reply_status (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// If the reply status is PortableInterceptor::LOCATION_FORWARD or
+ /// return the object reference to which the request was forwarded.
+ virtual CORBA::Object_ptr forward_reference (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException)) ;
+
+ virtual CORBA::Any * get_slot (
+ PortableInterceptor::SlotId id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableInterceptor::InvalidSlot));
+
+ /// Return the IOP::ServiceContext with the given IOP::ServiceId
+ /// from the request service context list.
+ virtual IOP::ServiceContext * get_request_service_context (
+ IOP::ServiceId id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Return the IOP::ServiceContext with the given IOP::ServiceId
+ /// from the reply service context list.
+ virtual IOP::ServiceContext * get_reply_service_context (
+ IOP::ServiceId id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Return the (initial, non-forwarded, or permanently forwarded)
+ /// object reference of the target.
+ virtual CORBA::Object_ptr target (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Return the object reference for the current target. The target
+ /// may change in the even of a location forward.
+ virtual CORBA::Object_ptr effective_target (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual IOP::TaggedProfile * effective_profile (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Return an Any containing the received exception, if any.
+ /// Otherwise, throw a CORBA::BAD_INV_ORDER exception.
+ /**
+ * @note There is no trivial way to extract the exception from an Any.
+ */
+ virtual CORBA::Any * received_exception (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Return the repository ID for the received exception.
+ virtual char * received_exception_id (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Return the first IOP::TaggedComponent that matches the given
+ /// IOP::ComponentId in the object reference for the current
+ /// target.
+ virtual IOP::TaggedComponent * get_effective_component (
+ IOP::ComponentId id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Return all IOP::TaggedComponent(s) that match the given
+ /// IOP::ComponentId in the object reference for the current
+ /// target.
+ virtual IOP::TaggedComponentSeq * get_effective_components (
+ IOP::ComponentId id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Return the policy of the given type in effect for the current
+ /// request.
+ virtual CORBA::Policy_ptr get_request_policy (
+ CORBA::PolicyType type
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Add the IOP::ServiceContext to the request (outgoing)
+ /// IOP::ServiceContextList.
+ virtual void add_request_service_context (
+ const IOP::ServiceContext & service_context,
+ CORBA::Boolean replace
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /*
+ * Proprietary accessor methods for the FT retention ID and
+ * request expiration time.
+ */
+
+ /// Set the absolute FT expiration time for this request.
+ void tao_ft_expiration_time (TimeBase::TimeT time);
+
+ /// Get the absolute FT expiration time for this request
+ TimeBase::TimeT tao_ft_expiration_time (void) const;
+
+ /// Set the FT request retention ID for this request.
+ void tao_ft_retention_id (CORBA::Long request_id);
+
+ /// Get the FT request retention ID for this request.
+ CORBA::Long tao_ft_retention_id (void) const;
+
+ /*
+ * End proprietary FT methods.
+ */
+
+private:
+
+ bool parameter_list (Dynamic::ParameterList &param_list);
+
+ bool exception_list (Dynamic::ExceptionList &exception_list);
+
+ bool result (CORBA::Any *any);
+
+ /// Check if this ClientRequestInfo object is called within the
+ /// context of a request.
+ void check_validity (ACE_ENV_SINGLE_ARG_DECL);
+
+ /// Setup thread scope and request scope
+ /// PortableInterceptor::Current objects.
+ void setup_picurrent (void);
+
+ /// Helper method to get the request and response service contexts.
+ IOP::ServiceContext *get_service_context_i (
+ TAO_Service_Context &service_context_list,
+ IOP::ServiceId id
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+private:
+ /// Pointer to the invocation object.
+ TAO::Invocation_Base *invocation_;
+
+ /// The "Request Scope Current" (RSC) object, as required by
+ /// Portable Interceptors.
+ TAO::PICurrent_Impl rs_pi_current_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_CLIENT_REQUEST_INFO_H */
diff --git a/TAO/tao/PI/ClientRequestInfo.pidl b/TAO/tao/PI/ClientRequestInfo.pidl
new file mode 100644
index 00000000000..f649b1d130b
--- /dev/null
+++ b/TAO/tao/PI/ClientRequestInfo.pidl
@@ -0,0 +1,49 @@
+// -*- IDL -*-
+
+/**
+ * @file ClientRequestInfo.pidl
+ *
+ * $Id$
+ *
+ * @brief Pre-compiled ClientRequestInfo
+ *
+ * This file was used to generate the code in ClientRequestInfoC.*
+ * The command used to generate code is:
+ *
+ * tao_idl
+ * -o orig -Gp -Gd -Ge 1 -GA -SS -Sci
+ * -Wb,export_include="tao/TAO_Export.h"
+ * -Wb,export_macro=TAO_Export
+ * -Wb,pre_include="ace/pre.h"
+ * -Wb,post_include="ace/post.h"
+ * ClientRequestInfo.pidl
+ */
+
+#ifndef _CLIENT_REQUESTINFO_PIDL_
+#define _CLIENT_REQUESTINFO_PIDL_
+
+#include "tao/PI/RequestInfo.pidl"
+#include "tao/orb_types.pidl"
+#include "tao/Policy_Forward.pidl"
+
+module PortableInterceptor {
+
+ typeprefix PortableInterceptor "omg.org";
+
+ local interface ClientRequestInfo : RequestInfo
+ {
+ readonly attribute Object target;
+ readonly attribute Object effective_target;
+ readonly attribute IOP::TaggedProfile effective_profile;
+ readonly attribute any received_exception;
+ readonly attribute CORBA::RepositoryId received_exception_id;
+ IOP::TaggedComponent get_effective_component (in IOP::ComponentId id);
+ IOP::TaggedComponentSeq get_effective_components (in IOP::ComponentId id);
+ CORBA::Policy get_request_policy (in CORBA::PolicyType type);
+ void add_request_service_context (
+ in IOP::ServiceContext service_context,
+ in boolean replace);
+ };
+};
+
+#endif /* _CLIENT_REQUESTINFO_PIDL_ */
diff --git a/TAO/tao/PI/ClientRequestInterceptor.pidl b/TAO/tao/PI/ClientRequestInterceptor.pidl
new file mode 100644
index 00000000000..e45311359d9
--- /dev/null
+++ b/TAO/tao/PI/ClientRequestInterceptor.pidl
@@ -0,0 +1,50 @@
+// -*- IDL -*-
+
+/**
+ * @file ClientRequestInterceptor.pidl
+ *
+ * $Id$
+ *
+ * @brief Pre-compiled IDL source for the PortableInterceptor
+ * components in the ORB.
+ *
+ * This file contains the interface definitions for "Portable"
+ * Interceptor support.
+ * The following is from orbos/99-12-02 Portable Interceptors spec,
+ * the full IDL is downloadable from orbos/99-12-02.
+ *
+ * This file was used to generate the code in ClientRequestInterceptorC.*
+ * The command used to generate code is:
+ *
+ * tao_idl
+ * -o orig -Gp -Gd -Ge 1 -GA -SS -Sci
+ * -Wb,export_include="tao/PI_Client/pi_client_export.h.h"
+ * -Wb,export_macro=TAO_PI_CLIENT_Export
+ * -Wb,pre_include="ace/pre.h"
+ * -Wb,post_include="ace/post.h"
+ * ClientRequestInterceptor.pidl
+ */
+
+#ifndef _CLIENT_REQUEST_INTERCEPTOR_IDL_
+#define _CLIENT_REQUEST_INTERCEPTOR_IDL_
+
+#include "tao/PI/Interceptor.pidl"
+#include "tao/PI/PIForwardRequest.pidl"
+
+module PortableInterceptor {
+
+ typeprefix PortableInterceptor "omg.org";
+
+ local interface ClientRequestInfo;
+
+ local interface ClientRequestInterceptor : Interceptor
+ {
+ void send_request (in ClientRequestInfo ri) raises (ForwardRequest);
+ void send_poll (in ClientRequestInfo ri);
+ void receive_reply (in ClientRequestInfo ri);
+ void receive_exception (in ClientRequestInfo ri) raises (ForwardRequest);
+ void receive_other (in ClientRequestInfo ri) raises (ForwardRequest);
+ };
+};
+
+#endif /* _CLIENT_REQUEST_INTERCEPTOR_IDL_ */
diff --git a/TAO/tao/PI/ClientRequestInterceptor_Adapter_Impl.cpp b/TAO/tao/PI/ClientRequestInterceptor_Adapter_Impl.cpp
new file mode 100644
index 00000000000..741d185e2b9
--- /dev/null
+++ b/TAO/tao/PI/ClientRequestInterceptor_Adapter_Impl.cpp
@@ -0,0 +1,321 @@
+#include "tao/PI/ClientRequestInterceptor_Adapter_Impl.h"
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+#if !defined (__ACE_INLINE__)
+#include "tao/PI/ClientRequestInterceptor_Adapter_Impl.inl"
+#endif /* defined INLINE */
+
+#include "tao/PI/ClientRequestInfo.h"
+
+#include "tao/Invocation_Base.h"
+#include "tao/ORB_Core.h"
+#include "tao/ORB_Core_TSS_Resources.h"
+#include "tao/PortableInterceptorC.h"
+
+ACE_RCSID (PI,
+ ClientRequestInterceptorAdapter_Impl,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ void
+ ClientRequestInterceptor_Adapter_Impl::send_request (
+ Invocation_Base &invocation
+ ACE_ENV_ARG_DECL)
+ {
+ // This method implements one of the "starting" client side
+ // interception point.
+
+ bool is_remote_request = invocation.is_remote_request();
+
+ ACE_TRY
+ {
+ TAO_ClientRequestInfo ri (&invocation);
+
+ for (size_t i = 0 ; i < this->interceptor_list_.size (); ++i)
+ {
+ ClientRequestInterceptor_List::RegisteredInterceptor& registered =
+ this->interceptor_list_.registered_interceptor (i);
+
+ if (registered.details_.should_be_processed (is_remote_request))
+ {
+ registered.interceptor_->
+ send_request (&ri
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+
+ // The starting interception point completed successfully.
+ // Push the interceptor on to the flow stack.
+ ++invocation.stack_size ();
+ }
+ }
+ ACE_CATCH (PortableInterceptor::ForwardRequest, exc)
+ {
+ this->process_forward_request (invocation,
+ exc
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_ENDTRY;
+ ACE_CHECK;
+ }
+
+ void
+ ClientRequestInterceptor_Adapter_Impl::receive_reply (
+ Invocation_Base &invocation
+ ACE_ENV_ARG_DECL)
+ {
+ // This is an "ending" interception point so we only process the
+ // interceptors pushed on to the flow stack.
+
+ bool is_remote_request = invocation.is_remote_request();
+
+ // Notice that the interceptors are processed in the opposite order
+ // they were pushed onto the stack since this is an "ending"
+ // interception point.
+
+ TAO_ClientRequestInfo ri (&invocation);
+
+ // Unwind the stack.
+ const size_t len = invocation.stack_size ();
+ for (size_t i = 0; i < len; ++i)
+ {
+ // Pop the interceptor off of the flow stack before it is
+ // invoked. This is necessary to prevent an interceptor already
+ // invoked in this "ending" interception point from being
+ // invoked in another "ending" interception point.
+ --invocation.stack_size ();
+
+ ClientRequestInterceptor_List::RegisteredInterceptor& registered =
+ this->interceptor_list_.registered_interceptor (
+ invocation.stack_size ());
+
+ if (registered.details_.should_be_processed (is_remote_request))
+ {
+ registered.interceptor_->
+ receive_reply (
+ &ri
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ }
+
+ // The receive_reply() interception point does not raise a
+ // PortableInterceptor::ForwardRequest exception so there is no need
+ // to attempt to catch it here.
+ }
+
+ void
+ ClientRequestInterceptor_Adapter_Impl::receive_exception (
+ Invocation_Base &invocation
+ ACE_ENV_ARG_DECL)
+ {
+ // This is an "ending" interception point so we only process the
+ // interceptors pushed on to the flow stack.
+
+ bool is_remote_request = invocation.is_remote_request();
+
+ // Notice that the interceptors are processed in the opposite order
+ // they were pushed onto the stack since this is an "ending"
+ // interception point.
+ ACE_TRY
+ {
+ TAO_ClientRequestInfo ri (&invocation);
+
+ // Unwind the flow stack.
+ const size_t len = invocation.stack_size ();
+ for (size_t i = 0; i < len; ++i)
+ {
+ // Pop the interceptor off of the flow stack before it is
+ // invoked. This is necessary to prevent an interceptor
+ // already invoked in this "ending" interception point from
+ // being invoked in another "ending" interception point.
+ --invocation.stack_size ();
+
+ ClientRequestInterceptor_List::RegisteredInterceptor& registered =
+ this->interceptor_list_.registered_interceptor (
+ invocation.stack_size ());
+
+ if (registered.details_.should_be_processed (is_remote_request))
+ {
+ registered.interceptor_->
+ receive_exception (
+ &ri
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ }
+ }
+ ACE_CATCH (PortableInterceptor::ForwardRequest, exc)
+ {
+ this->process_forward_request (invocation,
+ exc
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ // The receive_exception() interception point in the remaining
+ // interceptors must be called so call this method (not the
+ // interceptor's corresponding method) recursively. The call is
+ // made recursively since the caught exception must survive
+ // until the remaining interceptors have been called.
+
+ // Note that the recursion will stop once the flow stack size
+ // drops to zero, i.e., once each interceptor has been invoked.
+ // This prevents infinite recursion from occuring.
+
+ invocation.exception (&ACE_ANY_EXCEPTION);
+
+ this->receive_exception (invocation ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ PortableInterceptor::ReplyStatus status =
+ this->reply_status (invocation);
+
+ // Only re-throw the exception if it hasn't been transformed by
+ // the receive_exception() interception point (e.g. to a
+ // LOCATION_FORWARD).
+ if (status == PortableInterceptor::SYSTEM_EXCEPTION
+ || status == PortableInterceptor::USER_EXCEPTION)
+ ACE_RE_THROW;
+ }
+ ACE_ENDTRY;
+ ACE_CHECK;
+ }
+
+ void
+ ClientRequestInterceptor_Adapter_Impl::receive_other (
+ Invocation_Base &invocation
+ ACE_ENV_ARG_DECL)
+ {
+ // This is an "ending" interception point so we only process the
+ // interceptors pushed on to the flow stack.
+
+ bool is_remote_request = invocation.is_remote_request();
+
+ // Notice that the interceptors are processed in the opposite order
+ // they were pushed onto the stack since this is an "ending"
+ // interception point.
+
+ ACE_TRY
+ {
+ TAO_ClientRequestInfo ri (&invocation);
+
+ // Unwind the stack.
+ const size_t len = invocation.stack_size ();
+ for (size_t i = 0; i < len; ++i)
+ {
+ // Pop the interceptor off of the flow stack before it is
+ // invoked. This is necessary to prevent an interceptor
+ // already invoked in this "ending" interception point from
+ // being invoked in another "ending" interception point.
+ --invocation.stack_size ();
+
+ ClientRequestInterceptor_List::RegisteredInterceptor& registered =
+ this->interceptor_list_.registered_interceptor (
+ invocation.stack_size ());
+
+ if (registered.details_.should_be_processed (is_remote_request))
+ {
+ registered.interceptor_->
+ receive_other (
+ &ri
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ }
+ }
+ ACE_CATCH (PortableInterceptor::ForwardRequest, exc)
+ {
+ this->process_forward_request (invocation,
+ exc
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_ENDTRY;
+ ACE_CHECK;
+ }
+
+ void
+ ClientRequestInterceptor_Adapter_Impl::process_forward_request (
+ Invocation_Base &invocation,
+ PortableInterceptor::ForwardRequest &exc
+ ACE_ENV_ARG_DECL)
+ {
+ invocation.forwarded_reference (exc.forward.in ());
+
+ // receive_other() is potentially invoked recursively.
+ this->receive_other (invocation
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ void
+ ClientRequestInterceptor_Adapter_Impl::add_interceptor (
+ PortableInterceptor::ClientRequestInterceptor_ptr interceptor
+ ACE_ENV_ARG_DECL)
+ {
+ this->interceptor_list_.add_interceptor (interceptor ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ void
+ ClientRequestInterceptor_Adapter_Impl::add_interceptor (
+ PortableInterceptor::ClientRequestInterceptor_ptr interceptor,
+ const CORBA::PolicyList& policies
+ ACE_ENV_ARG_DECL)
+ {
+ this->interceptor_list_.add_interceptor (interceptor,
+ policies
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ void
+ ClientRequestInterceptor_Adapter_Impl::destroy_interceptors (
+ ACE_ENV_SINGLE_ARG_DECL)
+ {
+ this->interceptor_list_.destroy_interceptors (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ PortableInterceptor::ReplyStatus
+ ClientRequestInterceptor_Adapter_Impl::reply_status (
+ TAO::Invocation_Base const &invocation_base)
+ {
+ PortableInterceptor::ReplyStatus reply_status;
+
+ switch (invocation_base.invoke_status ())
+ {
+ case TAO::TAO_INVOKE_SUCCESS:
+ reply_status = PortableInterceptor::SUCCESSFUL;
+ break;
+ case TAO::TAO_INVOKE_RESTART:
+ if (invocation_base.is_forwarded ())
+ reply_status = PortableInterceptor::LOCATION_FORWARD;
+ else
+ reply_status = PortableInterceptor::TRANSPORT_RETRY;
+ break;
+ case TAO::TAO_INVOKE_USER_EXCEPTION:
+ reply_status = PortableInterceptor::USER_EXCEPTION;
+ break;
+ case TAO::TAO_INVOKE_SYSTEM_EXCEPTION:
+ reply_status = PortableInterceptor::SYSTEM_EXCEPTION;
+ break;
+ default:
+ reply_status = PortableInterceptor::UNKNOWN;
+ break;
+ }
+
+ return reply_status;
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
diff --git a/TAO/tao/PI/ClientRequestInterceptor_Adapter_Impl.h b/TAO/tao/PI/ClientRequestInterceptor_Adapter_Impl.h
new file mode 100644
index 00000000000..4b1a7ebc70c
--- /dev/null
+++ b/TAO/tao/PI/ClientRequestInterceptor_Adapter_Impl.h
@@ -0,0 +1,142 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file ClientRequestInterceptor_Adapter_Impl.h
+ *
+ * $Id$
+ *
+ * This file an adapter class to simplify the support of
+ * interceptors.
+ *
+ * @author Nanbor Wang <nanbor@cs.wustl.edu>
+ * @author Ossama Othman <ossama@uci.edu>
+ * @author Kirthika Parameswaran <kirthika@cs.wustl.edu>
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_CLIENT_REQUEST_INTERCEPTOR_ADAPTER_IMPL_H
+#define TAO_CLIENT_REQUEST_INTERCEPTOR_ADAPTER_IMPL_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+#include "tao/PI/Interceptor_List_T.h"
+#include "tao/PI/ClientRequestInterceptorC.h"
+#include "tao/PI/ClientRequestDetails.h"
+#include "tao/ClientRequestInterceptor_Adapter.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ typedef Interceptor_List< ::PortableInterceptor::ClientRequestInterceptor,
+ ClientRequestDetails>
+ ClientRequestInterceptor_List;
+}
+
+class TAO_ClientRequestInfo;
+
+namespace TAO
+{
+ class Invocation_Base;
+
+ /**
+ * @class ClientRequestInterceptor_Adapter
+ *
+ * @brief A convenient helper class to invoke registered client request
+ * interceptors
+ *
+ * This class invokes all registered interceptors at interception
+ * point, and enforces flow rules dictated by the Portable Interceptor
+ * specification/chapter.
+ */
+ class ClientRequestInterceptor_Adapter_Impl
+ : public ClientRequestInterceptor_Adapter
+ {
+ public:
+
+ ClientRequestInterceptor_Adapter_Impl (void);
+
+ /**
+ * @name PortableInterceptor Client Side Interception Points
+ *
+ * Each of these methods corresponds to a client side interception
+ * point. There are no "intermediate" interception points on the
+ * client side, only "starting" and "ending" interception points.
+ *
+ */
+ //@{
+ /// This method implements one of the "starting" client side
+ /// interception points.
+ virtual void send_request (Invocation_Base &invocation
+ ACE_ENV_ARG_DECL);
+
+ /// This method implements one of the "ending" client side
+ /// interception point.
+ virtual void receive_reply (Invocation_Base &invocation
+ ACE_ENV_ARG_DECL);
+
+ /// This method implements one of the "ending" client side
+ /// interception point.
+ virtual void receive_exception (Invocation_Base &invocation
+ ACE_ENV_ARG_DECL);
+
+ /// This method implements one of the "ending" client side
+ /// interception point.
+ virtual void receive_other (Invocation_Base &invocation
+ ACE_ENV_ARG_DECL);
+ //@}
+
+ /// Register an interceptor.
+ virtual void add_interceptor (
+ PortableInterceptor::ClientRequestInterceptor_ptr interceptor
+ ACE_ENV_ARG_DECL);
+
+ /// Register an interceptor with policies.
+ virtual void add_interceptor (
+ PortableInterceptor::ClientRequestInterceptor_ptr interceptor,
+ const CORBA::PolicyList& policies
+ ACE_ENV_ARG_DECL);
+
+ virtual void destroy_interceptors (ACE_ENV_SINGLE_ARG_DECL);
+
+ virtual PortableInterceptor::ReplyStatus reply_status (
+ TAO::Invocation_Base const &invocation_base);
+
+ protected:
+
+ /// Process the given PortableInterceptor::ForwardRequest exception,
+ /// i.e. invoke the receive_other() interception point, in addition
+ /// to notifying the Invocation object of the LOCATION_FORWARD.
+ void process_forward_request (Invocation_Base &invocation,
+ PortableInterceptor::ForwardRequest &exc
+ ACE_ENV_ARG_DECL);
+
+ private:
+
+ /// List of registered interceptors.
+ ClientRequestInterceptor_List interceptor_list_;
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+#include "tao/PI/ClientRequestInterceptor_Adapter_Impl.inl"
+#endif /* __ACE_INLINE__ */
+
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_CLIENT_REQUEST_INTERCEPTOR_ADAPTER_IMPL_H */
diff --git a/TAO/tao/PI/ClientRequestInterceptor_Adapter_Impl.inl b/TAO/tao/PI/ClientRequestInterceptor_Adapter_Impl.inl
new file mode 100644
index 00000000000..c1c7835148d
--- /dev/null
+++ b/TAO/tao/PI/ClientRequestInterceptor_Adapter_Impl.inl
@@ -0,0 +1,15 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ ACE_INLINE
+ ClientRequestInterceptor_Adapter_Impl::ClientRequestInterceptor_Adapter_Impl (void)
+ {
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PI/ClientRequestInterceptor_Factory_Impl.cpp b/TAO/tao/PI/ClientRequestInterceptor_Factory_Impl.cpp
new file mode 100644
index 00000000000..e4ff27b2c9b
--- /dev/null
+++ b/TAO/tao/PI/ClientRequestInterceptor_Factory_Impl.cpp
@@ -0,0 +1,49 @@
+// -*- C++ -*-
+
+// =================================================================
+/**
+ * @file ClientRequestInterceptor_Factory_Impl.cpp
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ *
+ */
+// =================================================================
+
+#include "tao/PI/ClientRequestInterceptor_Factory_Impl.h"
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+#include "tao/PI/ClientRequestInterceptor_Adapter_Impl.h"
+
+#include "tao/ORB.h"
+#include "tao/debug.h"
+
+ACE_RCSID (PI,
+ ClientRequestInterceptor_Factory_Impl,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO::ClientRequestInterceptor_Adapter*
+TAO_ClientRequestInterceptor_Adapter_Factory_Impl::create (void)
+{
+ TAO::ClientRequestInterceptor_Adapter_Impl* obj = 0;
+ ACE_NEW_RETURN (obj,
+ TAO::ClientRequestInterceptor_Adapter_Impl ,//(interceptors, invocation),
+ 0);
+ return obj;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DEFINE (TAO_ClientRequestInterceptor_Adapter_Factory_Impl,
+ ACE_TEXT ("ClientRequestInterceptor_Adapter_Factory"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (TAO_ClientRequestInterceptor_Adapter_Factory_Impl),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0)
+ACE_FACTORY_DEFINE (TAO_PI, TAO_ClientRequestInterceptor_Adapter_Factory_Impl)
+
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
diff --git a/TAO/tao/PI/ClientRequestInterceptor_Factory_Impl.h b/TAO/tao/PI/ClientRequestInterceptor_Factory_Impl.h
new file mode 100644
index 00000000000..f63b6ca3407
--- /dev/null
+++ b/TAO/tao/PI/ClientRequestInterceptor_Factory_Impl.h
@@ -0,0 +1,55 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file ClientRequestInterceptor_Factory_Impl.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+
+#ifndef TAO_CLIENTREQUESTINTERCEPTOR_ADAPTER_FACTORY_IMPL_H
+#define TAO_CLIENTREQUESTINTERCEPTOR_ADAPTER_FACTORY_IMPL_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/PI/pi_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/orbconf.h"
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+#include "tao/ClientRequestInterceptor_Adapter_Factory.h"
+#include "ace/Service_Config.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ class ClientRequestInterceptor_Adapter;
+}
+
+class TAO_PI_Export TAO_ClientRequestInterceptor_Adapter_Factory_Impl
+ : public TAO_ClientRequestInterceptor_Adapter_Factory
+{
+public:
+ virtual TAO::ClientRequestInterceptor_Adapter *create (void);
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE (TAO_ClientRequestInterceptor_Adapter_Factory_Impl)
+ACE_FACTORY_DECLARE (TAO_PI, TAO_ClientRequestInterceptor_Adapter_Factory_Impl)
+
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_CLIENTREQUESTINTERCEPTOR_ADAPTER_FACTORY_IMPL_H */
diff --git a/TAO/tao/PI/Interceptor.pidl b/TAO/tao/PI/Interceptor.pidl
new file mode 100644
index 00000000000..ed9ec855a56
--- /dev/null
+++ b/TAO/tao/PI/Interceptor.pidl
@@ -0,0 +1,38 @@
+// -*- IDL -*-
+
+/**
+ * @file Interceptor.pidl
+ *
+ * $Id$
+ *
+ * @brief Pre-compiled IDL source for the Interceptor
+ * components in the ORB.
+ *
+ * This file was used to generate the code in InterceptorC.*
+ * The command used to generate code is:
+ *
+ * tao_idl
+ * -o orig -Gp -Gd -Ge 1 -GA -SS -Sci
+ * -Wb,export_include="tao/TAO_Export.h"
+ * -Wb,export_macro=TAO_Export
+ * -Wb,pre_include="ace/pre.h"
+ * -Wb,post_include="ace/post.h"
+ * Interceptor.pidl
+ *
+ */
+
+#ifndef _INTERCEPTOR_IDL_
+#define _INTERCEPTOR_IDL_
+
+module PortableInterceptor {
+
+ typeprefix PortableInterceptor "omg.org";
+
+ local interface Interceptor
+ {
+ readonly attribute string name;
+ void destroy ();
+ };
+};
+
+#endif /* _INTERCEPTOR_IDL_ */
diff --git a/TAO/tao/PI/Interceptor_List_T.cpp b/TAO/tao/PI/Interceptor_List_T.cpp
new file mode 100644
index 00000000000..657f69213ad
--- /dev/null
+++ b/TAO/tao/PI/Interceptor_List_T.cpp
@@ -0,0 +1,245 @@
+// $Id$
+
+#include "tao/PI/ORBInitInfoC.h"
+#include "tao/PI/InterceptorC.h"
+#include "tao/SystemException.h"
+#include "tao/ORB_Constants.h"
+#include "tao/debug.h"
+
+#include "ace/os_include/os_stddef.h"
+#include "ace/OS_NS_string.h"
+#include "ace/Log_Msg.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ template <typename InterceptorType, typename DetailsType>
+ Interceptor_List<InterceptorType,DetailsType>::Interceptor_List (void)
+ {
+ }
+
+ template <typename InterceptorType, typename DetailsType>
+ typename Interceptor_List<InterceptorType,DetailsType>::RegisteredInterceptor&
+ Interceptor_List<InterceptorType,DetailsType>::registered_interceptor (
+ size_t index)
+ {
+ return this->interceptors_[index];
+ }
+
+ template <typename InterceptorType, typename DetailsType>
+ typename Interceptor_List<InterceptorType,DetailsType>::InterceptorType_ptr_type
+ Interceptor_List<InterceptorType,DetailsType>::interceptor (size_t index)
+ {
+ return this->interceptors_[index].interceptor_.in ();
+ }
+
+ template <typename InterceptorType, typename DetailsType>
+ size_t
+ Interceptor_List<InterceptorType,DetailsType>::size (void)
+ {
+ return this->interceptors_.size ();
+ }
+
+ template <typename InterceptorType, typename DetailsType>
+ void
+ Interceptor_List<InterceptorType,DetailsType>::add_interceptor (
+ InterceptorType_ptr_type interceptor
+ ACE_ENV_ARG_DECL)
+ {
+ if (!CORBA::is_nil (interceptor))
+ {
+ const size_t old_len = this->interceptors_.size ();
+
+ // Don't bother checking the name for duplicates if no
+ // interceptors have been registered. This saves an
+ // allocation.
+ if (old_len > 0)
+ {
+ /// If the Interceptor is not anonymous, make sure an
+ /// Interceptor with the same isn't already registered.
+ CORBA::String_var name =
+ interceptor->name (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (ACE_OS::strlen (name.in ()) != 0)
+ {
+ // @@ This simple search algorithm isn't the greatest
+ // thing in the world, but since we only register
+ // interceptors when bootstrapping an ORB, there will
+ // be no runtime penalty.
+ //
+ // Another source of inefficiency is that
+ // Interceptors duplicate their name each time the
+ // name() accessor is called! This can slow down
+ // bootstrap time noticeably when registering a huge
+ // number of interceptors. We could cache the names
+ // somewhere, but since this is only a bootstrapping
+ // issue there's no rush to implement such a scheme.
+
+ // Prevent interceptors with the same name from being
+ // registered. Anonymous interceptors are okay.
+ for (size_t i = 0; i < old_len; ++i)
+ {
+ CORBA::String_var existing_name =
+ this->interceptor (i)->name ();
+
+ if (ACE_OS::strcmp (existing_name.in (),
+ name.in ()) == 0)
+ {
+ ACE_THROW (PortableInterceptor::ORBInitInfo::DuplicateName ());
+ }
+ }
+ }
+ }
+
+ /// Increase the length of the Interceptor sequence by one.
+ const size_t new_len = old_len + 1;
+ this->interceptors_.size (new_len);
+
+ // Add the interceptor
+ this->interceptors_[old_len].interceptor_ =
+ InterceptorType::_duplicate (interceptor);
+ }
+ else
+ {
+ ACE_THROW (
+ CORBA::INV_OBJREF (
+ CORBA::SystemException::_tao_minor_code (
+ 0,
+ EINVAL
+ ),
+ CORBA::COMPLETED_NO
+ )
+ );
+ }
+ }
+
+ template <typename InterceptorType, typename DetailsType>
+ void
+ Interceptor_List<InterceptorType,DetailsType>::add_interceptor (
+ InterceptorType_ptr_type interceptor,
+ const CORBA::PolicyList& policies
+ ACE_ENV_ARG_DECL)
+ {
+ if (!CORBA::is_nil (interceptor))
+ {
+ const size_t old_len = this->interceptors_.size ();
+
+ // Don't bother checking the name for duplicates if no
+ // interceptors have been registered. This saves an
+ // allocation.
+ if (old_len > 0)
+ {
+ /// If the Interceptor is not anonymous, make sure an
+ /// Interceptor with the same isn't already registered.
+ CORBA::String_var name =
+ interceptor->name (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (ACE_OS::strlen (name.in ()) != 0)
+ {
+ // @@ This simple search algorithm isn't the greatest
+ // thing in the world, but since we only register
+ // interceptors when bootstrapping an ORB, there will
+ // be no runtime penalty.
+ //
+ // Another source of inefficiency is that
+ // Interceptors duplicate their name each time the
+ // name() accessor is called! This can slow down
+ // bootstrap time noticeably when registering a huge
+ // number of interceptors. We could cache the names
+ // somewhere, but since this is only a bootstrapping
+ // issue there's no rush to implement such a scheme.
+
+ // Prevent interceptors with the same name from being
+ // registered. Anonymous interceptors are okay.
+ for (size_t i = 0; i < old_len; ++i)
+ {
+ CORBA::String_var existing_name =
+ this->interceptor (i)->name ();
+
+ if (ACE_OS::strcmp (existing_name.in (),
+ name.in ()) == 0)
+ {
+ ACE_THROW (PortableInterceptor::ORBInitInfo::DuplicateName ());
+ }
+ }
+ }
+ }
+
+ // Create a DetailsType object, and attempt to apply the policies.
+ DetailsType details;
+ details.apply_policies(policies ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ /// Increase the length of the Interceptor sequence by one.
+ const size_t new_len = old_len + 1;
+ this->interceptors_.size (new_len);
+
+ // Add the interceptor
+ this->interceptors_[old_len].interceptor_ =
+ InterceptorType::_duplicate (interceptor);
+
+ // Set the details
+ this->interceptors_[old_len].details_ = details;
+ }
+ else
+ {
+ ACE_THROW (
+ CORBA::INV_OBJREF (
+ CORBA::SystemException::_tao_minor_code (
+ 0,
+ EINVAL
+ ),
+ CORBA::COMPLETED_NO
+ )
+ );
+ }
+ }
+
+ template <typename InterceptorType, typename DetailsType>
+ void
+ Interceptor_List<InterceptorType,DetailsType>::destroy_interceptors (
+ ACE_ENV_SINGLE_ARG_DECL)
+ {
+ const size_t len = this->interceptors_.size ();
+ size_t ilen = len;
+
+ ACE_TRY
+ {
+ for (size_t k = 0; k < len; ++k)
+ {
+ // Destroy the interceptors in reverse order in case the
+ // array list is only partially destroyed and another
+ // invocation occurs afterwards.
+ --ilen;
+
+ this->interceptor (k)->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ // Since Interceptor::destroy() can throw an exception,
+ // decrease the size of the interceptor array incrementally
+ // since some interceptors may not have been destroyed yet.
+ // Note that this size reduction is fast since no memory is
+ // actually deallocated.
+ this->interceptors_.size (ilen);
+ }
+ }
+ ACE_CATCHALL
+ {
+ // Exceptions should not be propagated beyond this call.
+ if (TAO_debug_level > 3)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - Exception in ")
+ ACE_TEXT ("Interceptor_List")
+ ACE_TEXT ("::destroy_interceptors () \n")));
+ }
+ }
+ ACE_ENDTRY;
+ ACE_CHECK;
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PI/Interceptor_List_T.h b/TAO/tao/PI/Interceptor_List_T.h
new file mode 100644
index 00000000000..5160ec03377
--- /dev/null
+++ b/TAO/tao/PI/Interceptor_List_T.h
@@ -0,0 +1,108 @@
+// -*- C++ -*-
+
+// ===================================================================
+/**
+ * @file Interceptor_List_T.h
+ *
+ * $Id$
+ *
+ * @author Ossama Othman <ossama@uci.edu>
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+// ===================================================================
+
+#ifndef TAO_INTERCEPTOR_LIST_H
+#define TAO_INTERCEPTOR_LIST_H
+
+#include /**/ "ace/pre.h"
+
+#include "ace/Array_Base.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/SystemException.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace PortableInterceptor
+{
+ class Interceptor;
+ typedef Interceptor *Interceptor_ptr;
+}
+
+namespace CORBA
+{
+ class PolicyList;
+}
+
+namespace TAO
+{
+ /**
+ * @class Interceptor_List
+ *
+ * @brief Template for portable interceptor lists.
+ *
+ * Template for the various portable interceptor lists used
+ * internally by TAO.
+ */
+ template <typename InterceptorType, typename DetailsType>
+ class Interceptor_List
+ {
+ public:
+ /// Define the traits for the underlying portable interceptor array.
+ typedef typename InterceptorType::_var_type InterceptorType_var_type;
+ typedef typename InterceptorType::_ptr_type InterceptorType_ptr_type;
+
+ struct RegisteredInterceptor
+ {
+ InterceptorType_var_type interceptor_;
+ DetailsType details_;
+ };
+
+ /// Constructor.
+ Interceptor_List (void);
+
+ void add_interceptor (
+ InterceptorType_ptr_type i
+ ACE_ENV_ARG_DECL);
+
+ /// Register an interceptor with policies.
+ void add_interceptor (InterceptorType_ptr_type i,
+ const CORBA::PolicyList& policies
+ ACE_ENV_ARG_DECL);
+
+ void destroy_interceptors (ACE_ENV_SINGLE_ARG_DECL);
+
+ /// Return the registered interceptor in sequence element @a index.
+ RegisteredInterceptor& registered_interceptor (
+ size_t index);
+
+ /// Return the interceptor in sequence element @a index.
+ InterceptorType_ptr_type interceptor (size_t index);
+
+ size_t size (void);
+
+ private:
+
+ typedef ACE_Array_Base<RegisteredInterceptor > RegisteredArray;
+
+ /// Dynamic array of registered interceptors.
+ RegisteredArray interceptors_;
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+#include "tao/PI/Interceptor_List_T.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
+#pragma implementation ("Interceptor_List_T.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_INTERCEPTOR_LIST_H */
diff --git a/TAO/tao/PI/InvalidSlot.pidl b/TAO/tao/PI/InvalidSlot.pidl
new file mode 100644
index 00000000000..bc5b26c72a9
--- /dev/null
+++ b/TAO/tao/PI/InvalidSlot.pidl
@@ -0,0 +1,32 @@
+// -*- IDL -*-
+
+/**
+ * @file InvalidSlot.pidl
+ *
+ * $Id$
+ *
+ * @brief Pre-compiled InvalidSlot
+ *
+ * This file was used to generate the code in InvalidSlotC.*
+ * The command used to generate code is:
+ *
+ * tao_idl
+ * -o orig -Gp -Gd -Ge 1 -GA -SS -Sci
+ * -Wb,export_include="tao/TAO_Export.h"
+ * -Wb,export_macro=TAO_Export
+ * -Wb,pre_include="ace/pre.h"
+ * -Wb,post_include="ace/post.h"
+ * InvalidSlot.pidl
+ */
+
+#ifndef _INVALID_SLOT_PIDL_
+#define _INVALID_SLOT_PIDL_
+
+module PortableInterceptor {
+
+ typeprefix PortableInterceptor "omg.org";
+
+ exception InvalidSlot {};
+};
+
+#endif /* _INVALID_SLOT_PIDL_ */
diff --git a/TAO/tao/PI/ORBInitInfo.cpp b/TAO/tao/PI/ORBInitInfo.cpp
new file mode 100644
index 00000000000..23ec50a3dae
--- /dev/null
+++ b/TAO/tao/PI/ORBInitInfo.cpp
@@ -0,0 +1,468 @@
+// $Id$
+
+#include "tao/PI/ORBInitInfo.h"
+#include "tao/ORB_Core.h"
+#include "tao/ORB.h"
+#include "tao/SystemException.h"
+#include "tao/Object_Loader.h"
+#include "tao/PolicyFactory_Registry_Adapter.h"
+
+#include "ace/Dynamic_Service.h"
+#include "ace/Service_Config.h"
+
+#if TAO_HAS_INTERCEPTORS == 1
+#include "tao/PI/PICurrent.h"
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+
+ACE_RCSID (TAO,
+ ORBInitInfo,
+ "$Id$")
+
+#if !defined (__ACE_INLINE__)
+#include "tao/PI/ORBInitInfo.inl"
+#endif /* defined INLINE */
+
+#include "ace/OS_NS_string.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Traits specializations for TAO_ORBInitInfo.
+
+TAO_ORBInitInfo_ptr
+TAO::Objref_Traits<TAO_ORBInitInfo>::duplicate (
+ TAO_ORBInitInfo_ptr p
+ )
+{
+ return TAO_ORBInitInfo::_duplicate (p);
+}
+
+void
+TAO::Objref_Traits<TAO_ORBInitInfo>::release (
+ TAO_ORBInitInfo_ptr p
+ )
+{
+ ::CORBA::release (p);
+}
+
+TAO_ORBInitInfo_ptr
+TAO::Objref_Traits<TAO_ORBInitInfo>::nil (void)
+{
+ return TAO_ORBInitInfo::_nil ();
+}
+
+CORBA::Boolean
+TAO::Objref_Traits<TAO_ORBInitInfo>::marshal (
+ TAO_ORBInitInfo_ptr p,
+ TAO_OutputCDR & cdr
+ )
+{
+ return p->marshal (cdr);
+}
+
+TAO_ORBInitInfo::TAO_ORBInitInfo (TAO_ORB_Core *orb_core,
+ int argc,
+ char *argv[],
+ PortableInterceptor::SlotId slotid)
+ : orb_core_ (orb_core),
+ argc_ (argc),
+ argv_ (argv),
+ codec_factory_ (),
+ slot_count_ (slotid)
+{
+}
+
+TAO_ORBInitInfo::~TAO_ORBInitInfo (void)
+{
+}
+
+CORBA::StringSeq *
+TAO_ORBInitInfo::arguments (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ // In accordance with the C++ mapping for sequences, it is up to the
+ // caller to deallocate storage for returned sequences.
+
+ CORBA::StringSeq *args = 0;
+ ACE_NEW_THROW_EX (args,
+ CORBA::StringSeq,
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ 0,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (0);
+
+ CORBA::StringSeq_var safe_args (args);
+
+ // Copy the argument vector to the string sequence.
+
+ args->length (this->argc_); // Not a problem if argc is zero.
+ for (int i = 0; i < this->argc_; ++i)
+ (*args)[i] = CORBA::string_dup (this->argv_[i]);
+
+ return safe_args._retn ();
+}
+
+char *
+TAO_ORBInitInfo::orb_id (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ // In accordance with the C++ mapping for strings, return a copy.
+
+ return CORBA::string_dup (this->orb_core_->orbid ());
+}
+
+IOP::CodecFactory_ptr
+TAO_ORBInitInfo::codec_factory (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ if (CORBA::is_nil (this->codec_factory_.in ()))
+ {
+ TAO_Object_Loader *loader =
+ ACE_Dynamic_Service<TAO_Object_Loader>::instance ("CodecFactory_Loader");
+
+ if (loader == 0)
+ {
+ ACE_Service_Config::process_directive (
+ ACE_DYNAMIC_SERVICE_DIRECTIVE("CodecFactory",
+ "TAO_CodecFactory",
+ "_make_TAO_CodecFactory_Loader",
+ ""));
+ loader =
+ ACE_Dynamic_Service<TAO_Object_Loader>::instance ("CodecFactory_Loader");
+ }
+
+ if (loader != 0)
+ {
+ CORBA::Object_var cf =
+ loader->create_object (this->orb_core_->orb (), 0, 0 ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (IOP::CodecFactory::_nil ());
+
+ this->codec_factory_ = IOP::CodecFactory::_narrow (cf.in ());
+ }
+ }
+
+ return IOP::CodecFactory::_duplicate (this->codec_factory_.in ());
+}
+
+void
+TAO_ORBInitInfo::register_initial_reference (
+ const char * id,
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableInterceptor::ORBInitInfo::InvalidName))
+{
+ this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (id == 0 || ACE_OS::strlen (id) == 0)
+ ACE_THROW (PortableInterceptor::ORBInitInfo::InvalidName ());
+ ACE_CHECK;
+
+ if (CORBA::is_nil (obj))
+ ACE_THROW (CORBA::BAD_PARAM (CORBA::OMGVMCID | 27,
+ CORBA::COMPLETED_NO));
+ ACE_CHECK;
+
+ TAO_Object_Ref_Table &table = this->orb_core_->object_ref_table ();
+
+ if (table.register_initial_reference (id, obj) == -1)
+ ACE_THROW (PortableInterceptor::ORBInitInfo::InvalidName ());
+}
+
+CORBA::Object_ptr
+TAO_ORBInitInfo::resolve_initial_references (
+ const char * id
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableInterceptor::ORBInitInfo::InvalidName))
+{
+ this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Object::_nil ());
+
+ if (id == 0 || ACE_OS::strlen (id) == 0)
+ ACE_THROW_RETURN (PortableInterceptor::ORBInitInfo::InvalidName (),
+ CORBA::Object::_nil ());
+
+ // The ORB is practically fully initialized by the time this point
+ // is reached so just use the ORB's resolve_initial_references()
+ // mechanism.
+ return
+ this->orb_core_->orb ()->resolve_initial_references (id
+ ACE_ENV_ARG_PARAMETER);
+}
+
+void
+TAO_ORBInitInfo::add_client_request_interceptor (
+ PortableInterceptor::ClientRequestInterceptor_ptr interceptor
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableInterceptor::ORBInitInfo::DuplicateName))
+{
+# if TAO_HAS_INTERCEPTORS == 1
+ this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->orb_core_->add_interceptor (interceptor ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+#else
+ ACE_UNUSED_ARG (interceptor);
+ ACE_THROW (CORBA::NO_IMPLEMENT (
+ CORBA::SystemException::_tao_minor_code (
+ 0,
+ ENOTSUP),
+ CORBA::COMPLETED_NO));
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+}
+
+void
+TAO_ORBInitInfo::add_server_request_interceptor (
+ PortableInterceptor::ServerRequestInterceptor_ptr interceptor
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableInterceptor::ORBInitInfo::DuplicateName))
+{
+# if TAO_HAS_INTERCEPTORS == 1
+ this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->orb_core_->add_interceptor (interceptor ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+#else
+ ACE_UNUSED_ARG (interceptor);
+ ACE_THROW (CORBA::NO_IMPLEMENT (
+ CORBA::SystemException::_tao_minor_code (
+ 0,
+ ENOTSUP),
+ CORBA::COMPLETED_NO));
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+}
+
+void
+TAO_ORBInitInfo::add_ior_interceptor (
+ PortableInterceptor::IORInterceptor_ptr interceptor
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableInterceptor::ORBInitInfo::DuplicateName))
+{
+ this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->orb_core_->add_interceptor (interceptor
+ ACE_ENV_ARG_PARAMETER);
+}
+
+void
+TAO_ORBInitInfo::add_client_request_interceptor_with_policy (
+ PortableInterceptor::ClientRequestInterceptor_ptr interceptor,
+ const CORBA::PolicyList& policies
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableInterceptor::ORBInitInfo::DuplicateName,
+ CORBA::PolicyError))
+{
+# if TAO_HAS_INTERCEPTORS == 1
+ this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->orb_core_->add_interceptor (interceptor,
+ policies
+ ACE_ENV_ARG_PARAMETER);
+#else
+ ACE_UNUSED_ARG (interceptor);
+ ACE_UNUSED_ARG (policies);
+ ACE_THROW (CORBA::NO_IMPLEMENT (
+ CORBA::SystemException::_tao_minor_code (
+ 0,
+ ENOTSUP),
+ CORBA::COMPLETED_NO));
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+}
+
+void
+TAO_ORBInitInfo::add_server_request_interceptor_with_policy (
+ PortableInterceptor::ServerRequestInterceptor_ptr interceptor,
+ const CORBA::PolicyList& policies
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableInterceptor::ORBInitInfo::DuplicateName,
+ CORBA::PolicyError))
+{
+# if TAO_HAS_INTERCEPTORS == 1
+ this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->orb_core_->add_interceptor (interceptor,
+ policies
+ ACE_ENV_ARG_PARAMETER);
+
+#else
+ ACE_UNUSED_ARG (interceptor);
+ ACE_UNUSED_ARG (policies);
+ ACE_THROW (CORBA::NO_IMPLEMENT (
+ CORBA::SystemException::_tao_minor_code (
+ 0,
+ ENOTSUP),
+ CORBA::COMPLETED_NO));
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+}
+
+void
+TAO_ORBInitInfo::add_ior_interceptor_with_policy (
+ PortableInterceptor::IORInterceptor_ptr interceptor,
+ const CORBA::PolicyList& policies
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableInterceptor::ORBInitInfo::DuplicateName,
+ CORBA::PolicyError))
+{
+ this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Since there are currently no PI Policies that pertain to
+ // IOR Interceptors, we will always raise the NO_IMPLEMENT
+ // CORBA System Exception here to indicate that this method
+ // is currently not implemented/supported.
+ ACE_UNUSED_ARG (interceptor);
+ ACE_UNUSED_ARG (policies);
+ ACE_THROW (CORBA::NO_IMPLEMENT (
+ CORBA::SystemException::_tao_minor_code (
+ 0,
+ ENOTSUP),
+ CORBA::COMPLETED_NO));
+}
+
+PortableInterceptor::SlotId
+TAO_ORBInitInfo::allocate_slot_id (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+#if TAO_HAS_INTERCEPTORS == 1
+ // No need to acquire a lock. This only gets called during ORB
+ // initialization. ORB initialization is already atomic.
+ return this->slot_count_++;
+#else
+ ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (
+ CORBA::SystemException::_tao_minor_code (
+ 0,
+ ENOTSUP),
+ CORBA::COMPLETED_NO),
+ 0);
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+}
+
+void
+TAO_ORBInitInfo::register_policy_factory (
+ CORBA::PolicyType type,
+ PortableInterceptor::PolicyFactory_ptr policy_factory
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ TAO::PolicyFactory_Registry_Adapter *registry =
+ this->orb_core_->policy_factory_registry ();
+
+ if (registry == 0)
+ {
+ ACE_THROW (CORBA::INTERNAL ());
+ }
+
+ registry->register_policy_factory (type,
+ policy_factory
+ ACE_ENV_ARG_PARAMETER);
+}
+
+size_t
+TAO_ORBInitInfo::allocate_tss_slot_id (ACE_CLEANUP_FUNC cleanup
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ size_t slot_id = 0;
+
+ const int result = this->orb_core_->add_tss_cleanup_func (cleanup,
+ slot_id);
+
+ if (result != 0)
+ ACE_THROW_RETURN (CORBA::INTERNAL (
+ CORBA::SystemException::_tao_minor_code (
+ 0,
+ errno),
+ CORBA::COMPLETED_NO),
+ 0);
+
+ return slot_id;
+}
+
+void
+TAO_ORBInitInfo::check_validity (ACE_ENV_SINGLE_ARG_DECL)
+{
+ if (this->orb_core_ == 0)
+ {
+ // As defined by the Portable Interceptor specification, throw a
+ // CORBA::OBJECT_NOT_EXIST exception after CORBA::ORB_init() has
+ // completed. CORBA::ORB_init() sets the ORB core pointer in
+ // this instance to zero when it is done initializing the ORB,
+ // which is why we base "existence" on the validity of the ORB
+ // core pointer.
+ ACE_THROW (CORBA::OBJECT_NOT_EXIST (0,
+ CORBA::COMPLETED_NO));
+ }
+}
+
+CORBA::ORB_ptr
+TAO_ORBInitInfo::_get_orb (ACE_ENV_SINGLE_ARG_DECL)
+{
+ this->check_validity (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::ORB::_nil ());
+
+ return CORBA::ORB::_duplicate (this->orb_core_->orb ());
+}
+
+TAO_ORBInitInfo_ptr TAO_ORBInitInfo::_narrow (
+ CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ if (CORBA::is_nil (_tao_objref))
+ {
+ return TAO_ORBInitInfo::_nil ();
+ }
+
+ TAO_ORBInitInfo_ptr proxy =
+ dynamic_cast<TAO_ORBInitInfo_ptr> (_tao_objref);
+
+ return TAO_ORBInitInfo::_duplicate (proxy);
+}
+
+TAO_ORBInitInfo_ptr
+TAO_ORBInitInfo::_duplicate (TAO_ORBInitInfo_ptr obj)
+{
+ if (!CORBA::is_nil (obj))
+ {
+ obj->_add_ref ();
+ }
+
+ return obj;
+}
+
+const char* TAO_ORBInitInfo::_interface_repository_id (void) const
+{
+ return "IDL:TAO_ORBInitInfo:1.0";
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PI/ORBInitInfo.h b/TAO/tao/PI/ORBInitInfo.h
new file mode 100644
index 00000000000..63c78095104
--- /dev/null
+++ b/TAO/tao/PI/ORBInitInfo.h
@@ -0,0 +1,344 @@
+// -*- C++ -*-
+
+// ===================================================================
+/**
+ * @file ORBInitInfo.h
+ *
+ * $Id$
+ *
+ * @author Ossama Othman <ossama@dre.vanderbilt.edu>
+ */
+// ===================================================================
+
+#ifndef TAO_ORB_INIT_INFO_H
+#define TAO_ORB_INIT_INFO_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/PI/pi_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PI/ORBInitInfoC.h"
+#include "tao/LocalObject.h"
+
+// This is to remove "inherits via dominance" warnings from MSVC.
+// MSVC is being a little too paranoid.
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+#if defined (__BORLANDC__)
+#pragma option push -w-rvl -w-rch -w-ccc -w-inl
+#endif /* __BORLANDC__ */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_ORB_Core;
+class TAO_ORBInitInfo;
+typedef TAO_ORBInitInfo *TAO_ORBInitInfo_ptr;
+
+typedef TAO_Objref_Var_T<TAO_ORBInitInfo>
+ TAO_ORBInitInfo_var;
+
+typedef TAO_Objref_Out_T<TAO_ORBInitInfo>
+ TAO_ORBInitInfo_out;
+
+/**
+ * @class TAO_ORBInitInfo
+ *
+ * @brief An implementation of the PortableInterceptor::ORBInitInfo_3_1
+ * interface.
+ *
+ * This class encapsulates the data passed to ORBInitializers during
+ * ORB initialization.
+ */
+class TAO_PI_Export TAO_ORBInitInfo
+ : public virtual PortableInterceptor::ORBInitInfo_3_1,
+ public virtual TAO_Local_RefCounted_Object
+{
+public:
+
+ /// Constructor.
+ TAO_ORBInitInfo (TAO_ORB_Core *orb_core,
+ int argc,
+ char *argv[],
+ PortableInterceptor::SlotId slotid);
+
+ /**
+ * @name PortableInterceptor::ORBInitInfo Methods
+ *
+ * These methods are exported by the
+ * PortableInterceptor::ORBInitInfo interface.
+ */
+ //@{
+ /// Return the argument vector for the ORB currently being
+ /// initialized as a string sequence.
+ virtual CORBA::StringSeq * arguments (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Return the ORBid for the ORB currently being initialized.
+ virtual char * orb_id (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Return the CodecFactory for the ORB currently being
+ /// initialized.
+ virtual IOP::CodecFactory_ptr codec_factory (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Register a mapping between a string and a corresponding object
+ /// reference with the ORB being initialized.
+ /**
+ * This method is particularly useful for registering references to
+ * local (locality constrained) objects. Note that this method
+ * should be called in ORBInitializer::pre_init() so that the
+ * registered reference will be available to the
+ * resolve_initial_references() that may be called in the
+ * ORBInitializer::post_init() call.
+ */
+ virtual void register_initial_reference (
+ const char * id,
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableInterceptor::ORBInitInfo::InvalidName));
+
+ /// Obtain a reference to an object that may not yet be available
+ /// via the usual CORBA::ORB::resolve_initial_references() mechanism
+ /// since the ORB may not be fully initialized yet.
+ virtual CORBA::Object_ptr resolve_initial_references (
+ const char * id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableInterceptor::ORBInitInfo::InvalidName));
+
+ /// Register a client request interceptor with the ORB currently
+ /// being initialized.
+ virtual void add_client_request_interceptor (
+ PortableInterceptor::ClientRequestInterceptor_ptr interceptor
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableInterceptor::ORBInitInfo::DuplicateName));
+
+ /// Register a server request interceptor with the ORB currently
+ /// being initialized.
+ virtual void add_server_request_interceptor (
+ PortableInterceptor::ServerRequestInterceptor_ptr interceptor
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableInterceptor::ORBInitInfo::DuplicateName));
+
+ /// Register an IOR interceptor with the ORB currently being
+ /// initialized.
+ virtual void add_ior_interceptor (
+ PortableInterceptor::IORInterceptor_ptr interceptor
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableInterceptor::ORBInitInfo::DuplicateName));
+
+ /// Register a client request interceptor with the ORB currently
+ /// being initialized, along with a list of policies.
+ virtual void add_client_request_interceptor_with_policy (
+ PortableInterceptor::ClientRequestInterceptor_ptr interceptor,
+ const CORBA::PolicyList& policies
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableInterceptor::ORBInitInfo::DuplicateName,
+ CORBA::PolicyError));
+
+ /// Register a server request interceptor with the ORB currently
+ /// being initialized, along with a list of policies.
+ virtual void add_server_request_interceptor_with_policy (
+ PortableInterceptor::ServerRequestInterceptor_ptr interceptor,
+ const CORBA::PolicyList& policies
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableInterceptor::ORBInitInfo::DuplicateName,
+ CORBA::PolicyError));
+
+ /// Register an IOR interceptor with the ORB currently being
+ /// initialized, along with a list of policies.
+ virtual void add_ior_interceptor_with_policy (
+ PortableInterceptor::IORInterceptor_ptr interceptor,
+ const CORBA::PolicyList& policies
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableInterceptor::ORBInitInfo::DuplicateName,
+ CORBA::PolicyError));
+
+ /// Reserve a slot in table found within the
+ /// PortableInterceptor::Current object.
+ virtual PortableInterceptor::SlotId allocate_slot_id (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Register a policy factory of the given policy type with the ORB
+ /// currently being initialized.
+ virtual void register_policy_factory (
+ CORBA::PolicyType type,
+ PortableInterceptor::PolicyFactory_ptr policy_factory
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual CORBA::ORB_ptr _get_orb (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ );
+ //@}
+
+ /**
+ * @name TAO Extensions
+ *
+ * These methods are not part of the PortableInterceptor
+ * specification, and are TAO-specific extensions.
+ */
+ //@{
+ /// Allocate a slot in the ORB's TSS resources.
+ /**
+ * TAO uses a single TSS key for these resources, so it is useful to
+ * place TSS objects in TAO's TSS resources on platforms where the
+ * number of TSS keys is low. The returned SlotId can be used to
+ * index into the array stored in ORB's TSS resources structure.
+ * @par
+ * An accompanying cleanup function (e.g. a TSS destructor) can also
+ * be registered.
+ */
+ size_t allocate_tss_slot_id (
+ ACE_CLEANUP_FUNC cleanup
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Return a pointer to the ORB Core associated with the ORB being
+ /// initialized.
+ /**
+ * The ORB Core is essentialy fully initialized by the time
+ * ORBInitializer::post_init() is invoked. As such, it is generally
+ * best if this method is used in that method.
+ *
+ * @note Only use this method if you know what you are doing.
+ */
+ TAO_ORB_Core *orb_core (void) const;
+
+ /// Invalidate this ORBInitInfo instance.
+ /**
+ * @note This method is only meant to be called by the
+ * CORBA::ORB_init() function.
+ */
+ void invalidate (void);
+
+ /// Return the number of allocated slots in for the PICurrent
+ /// object.
+ PortableInterceptor::SlotId slot_count (void) const;
+ //@}
+
+ /**
+ * @name Reference Related Methods
+ *
+ * TAO_ORBInitInfo-specific methods and types.
+ */
+ //@{
+ typedef TAO_ORBInitInfo_ptr _ptr_type;
+ typedef TAO_ORBInitInfo_var _var_type;
+
+ static TAO_ORBInitInfo_ptr _duplicate (TAO_ORBInitInfo_ptr obj);
+
+ static TAO_ORBInitInfo_ptr _narrow (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+
+ static TAO_ORBInitInfo_ptr _unchecked_narrow (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+
+ static TAO_ORBInitInfo_ptr _nil (void)
+ {
+ return (TAO_ORBInitInfo_ptr)0;
+ }
+ //@}
+
+ virtual const char* _interface_repository_id (void) const;
+
+protected:
+
+ /// Destructor is protected to enforce proper memory management
+ /// through the reference counting mechanism.
+ ~TAO_ORBInitInfo (void);
+
+ /// Check if this ORBInitInfo instance is valid. Once post_init()
+ /// has been called on each of the ORBInitializers, this ORBInitInfo
+ /// is no longer valid. Throw an exception in that case.
+ void check_validity (ACE_ENV_SINGLE_ARG_DECL);
+
+private:
+
+ /// Prevent copying through the copy constructor and the assignment
+ /// operator.
+ TAO_ORBInitInfo (const TAO_ORBInitInfo &);
+ void operator= (const TAO_ORBInitInfo &);
+
+private:
+
+ /// Reference to the ORB Core.
+ TAO_ORB_Core *orb_core_;
+
+ /// The number of arguments in the argument vector passed to
+ /// CORBA::ORB_init().
+ int argc_;
+
+ /// The argument vector passed to CORBA::ORB_init().
+ char **argv_;
+
+ /// Reference to the CodecFactory returned by
+ /// ORBInitInfo::codec_factory().
+ IOP::CodecFactory_var codec_factory_;
+
+ /// The number of allocated slots.
+ PortableInterceptor::SlotId slot_count_;
+
+};
+
+// Traits specializations.
+namespace TAO
+{
+ // Hand crafted. Not forward declared, but used by PortableServer.
+ template<>
+ struct TAO_PI_Export Objref_Traits<TAO_ORBInitInfo>
+ {
+ static TAO_ORBInitInfo_ptr duplicate (
+ TAO_ORBInitInfo_ptr
+ );
+ static void release (
+ TAO_ORBInitInfo_ptr
+ );
+ static TAO_ORBInitInfo_ptr nil (void);
+ static CORBA::Boolean marshal (
+ TAO_ORBInitInfo_ptr p,
+ TAO_OutputCDR & cdr
+ );
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+#include "tao/PI/ORBInitInfo.inl"
+#endif /* __ACE_INLINE__ */
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#if defined (__BORLANDC__)
+#pragma option pop
+#endif /* __BORLANDC__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_ORB_INIT_INFO_H */
diff --git a/TAO/tao/PI/ORBInitInfo.inl b/TAO/tao/PI/ORBInitInfo.inl
new file mode 100644
index 00000000000..f151fd2711d
--- /dev/null
+++ b/TAO/tao/PI/ORBInitInfo.inl
@@ -0,0 +1,26 @@
+// -*- C++ -*-
+//
+// $Id$
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE TAO_ORB_Core *
+TAO_ORBInitInfo::orb_core (void) const
+{
+ return this->orb_core_;
+}
+
+ACE_INLINE void
+TAO_ORBInitInfo::invalidate (void)
+{
+ this->orb_core_ = 0;
+}
+
+ACE_INLINE PortableInterceptor::SlotId
+TAO_ORBInitInfo::slot_count (void) const
+{
+ return this->slot_count_;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PI/ORBInitInfo.pidl b/TAO/tao/PI/ORBInitInfo.pidl
new file mode 100644
index 00000000000..780d6783da7
--- /dev/null
+++ b/TAO/tao/PI/ORBInitInfo.pidl
@@ -0,0 +1,90 @@
+// -*- IDL -*-
+
+/**
+ * @file ORBInitInfo.pidl
+ *
+ * $Id$
+ *
+ * @brief Pre-compiled IDL source for the ORBInitInfo
+ *
+ * This file was used to generate the code in ORBInitInfoC.*
+ * The command used to generate code is:
+ *
+ * tao_idl
+ * -o orig -Gp -Gd -Ge 1 -SS -Sci
+ * -Wb,export_include="tao/TAO_Export.h"
+ * -Wb,export_macro=TAO_Export
+ * -Wb,pre_include="ace/pre.h"
+ * -Wb,post_include="ace/post.h"
+ * ORBInitInfo.pidl
+ */
+
+#ifndef _ORBINITINFO_PIDL_
+#define _ORBINITINFO_PIDL_
+
+#include "tao/StringSeq.pidl"
+#include "tao/CodecFactory/IOP_Codec_include.pidl"
+#include "tao/PI_Forward.pidl"
+#include "tao/Policy.pidl"
+
+module PortableInterceptor {
+
+ typeprefix PortableInterceptor "omg.org";
+
+ local interface ClientRequestInterceptor;
+ local interface ServerRequestInterceptor;
+ local interface IORInterceptor;
+ local interface PolicyFactory;
+
+ local interface ORBInitInfo
+ {
+ typedef string ObjectId;
+
+ exception DuplicateName
+ {
+ string name;
+ };
+
+ exception InvalidName {};
+
+ readonly attribute CORBA::StringSeq arguments;
+ readonly attribute string orb_id;
+ readonly attribute IOP::CodecFactory codec_factory;
+
+ void register_initial_reference (in ObjectId id, in Object obj)
+ raises (InvalidName);
+ Object resolve_initial_references (in ObjectId id)
+ raises (InvalidName);
+ void add_client_request_interceptor (
+ in ClientRequestInterceptor interceptor)
+ raises (DuplicateName);
+ void add_server_request_interceptor (
+ in ServerRequestInterceptor interceptor)
+ raises (DuplicateName);
+ void add_ior_interceptor (in IORInterceptor interceptor)
+ raises (DuplicateName);
+ SlotId allocate_slot_id ();
+ void register_policy_factory (
+ in CORBA::PolicyType type,
+ in PolicyFactory policy_factory);
+ };
+
+ local interface ORBInitInfo_3_1 : ORBInitInfo
+ {
+ void add_client_request_interceptor_with_policy(
+ in ClientRequestInterceptor interceptor,
+ in CORBA::PolicyList policies)
+ raises (DuplicateName, CORBA::PolicyError);
+ void add_server_request_interceptor_with_policy(
+ in ServerRequestInterceptor interceptor,
+ in CORBA::PolicyList policies)
+ raises (DuplicateName, CORBA::PolicyError);
+ void add_ior_interceptor_with_policy(
+ in IORInterceptor interceptor,
+ in CORBA::PolicyList policies)
+ raises (DuplicateName, CORBA::PolicyError);
+ };
+
+};
+
+#endif /* _ORBINITINFO_PIDL_ */
diff --git a/TAO/tao/PI/ORBInitInfoA.h b/TAO/tao/PI/ORBInitInfoA.h
new file mode 100644
index 00000000000..b496d68a703
--- /dev/null
+++ b/TAO/tao/PI/ORBInitInfoA.h
@@ -0,0 +1,40 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+#ifndef _TAO_IDL_PI_ORBINITINFOA_H_
+#define _TAO_IDL_PI_ORBINITINFOA_H_
+
+#include /**/ "ace/pre.h"
+
+#include "tao/PI/ORBInitInfoC.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include /**/ "ace/post.h"
+#endif /* ifndef */
diff --git a/TAO/tao/PI/ORBInitializer.pidl b/TAO/tao/PI/ORBInitializer.pidl
new file mode 100644
index 00000000000..f8f871449a6
--- /dev/null
+++ b/TAO/tao/PI/ORBInitializer.pidl
@@ -0,0 +1,43 @@
+// -*- IDL -*-
+
+/**
+ * @file ORBInitializer.pidl
+ *
+ * $Id$
+ *
+ * @brief ORBInitializer part of the PortableInterceptor part of the CORBA
+ * spec
+ *
+ * This file was used to generate the code in ORBInitializerC.*
+ * The command used to generate code is:
+ *
+ * tao_idl
+ * -o orig -Gp -Gd -Ge 1 -GA -SS -Sci
+ * -Wb,export_include="tao/PI_Client/pi_client_export.h.h"
+ * -Wb,export_macro=TAO_PI_CLIENT_Export
+ * -Wb,pre_include="ace/pre.h"
+ * -Wb,post_include="ace/post.h"
+ * ORBInitializer.pidl
+ *
+ */
+
+#ifndef _ORB_INITIALIZER_PIDL
+#define _ORB_INITIALIZER_PIDL
+
+#include "tao/PI/ORBInitInfo.pidl"
+
+module PortableInterceptor {
+
+ typeprefix PortableInterceptor "omg.org";
+
+// local interface ORBInitInfo;
+
+ local interface ORBInitializer
+ {
+ void pre_init (in ORBInitInfo info);
+ void post_init (in ORBInitInfo info);
+ };
+
+};
+
+#endif /* _ORB_INITIALIZER_PIDL */
diff --git a/TAO/tao/PI/ORBInitializer_Registry_Impl.cpp b/TAO/tao/PI/ORBInitializer_Registry_Impl.cpp
new file mode 100644
index 00000000000..1b20c74dcdb
--- /dev/null
+++ b/TAO/tao/PI/ORBInitializer_Registry_Impl.cpp
@@ -0,0 +1,255 @@
+#include "tao/PI/ORBInitializer_Registry_Impl.h"
+#include "tao/PI/ORBInitInfo.h"
+#include "tao/PI/PICurrent.h"
+#include "tao/PI/PI_ORBInitializer.h"
+#include "tao/PI/ClientRequestInterceptor_Factory_Impl.h"
+#include "tao/PI/PICurrent_Loader.h"
+#include "tao/PI/PolicyFactory_Loader.h"
+
+#include "tao/ORB_Core.h"
+#include "tao/ORB_Constants.h"
+#include "tao/SystemException.h"
+
+#include "ace/Static_Object_Lock.h"
+#include "ace/Recursive_Thread_Mutex.h"
+#include "ace/Log_Msg.h"
+
+ACE_RCSID (PI,
+ ORBInitializer_Registry,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO::ORBInitializer_Registry::ORBInitializer_Registry (void)
+ : lock_ (),
+ initializers_ ()
+{
+}
+
+int
+TAO::ORBInitializer_Registry::init (int, ACE_TCHAR *[])
+{
+#if !defined (TAO_AS_STATIC_LIBS) && (TAO_HAS_INTERCEPTORS == 1)
+ ACE_Service_Config::process_directive
+ (ace_svc_desc_TAO_ClientRequestInterceptor_Adapter_Factory_Impl);
+
+ ACE_Service_Config::process_directive
+ (ace_svc_desc_TAO_PICurrent_Loader);
+
+ PortableInterceptor::ORBInitializer_ptr temp_orb_initializer =
+ PortableInterceptor::ORBInitializer::_nil ();
+
+ PortableInterceptor::ORBInitializer_var orb_initializer;
+
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ /// Register the PI ORBInitializer.
+
+ ACE_NEW_THROW_EX (temp_orb_initializer,
+ TAO_PI_ORBInitializer,
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_TRY_CHECK;
+
+ orb_initializer = temp_orb_initializer;
+
+ this->register_orb_initializer (orb_initializer.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "(%P|%t) Caught exception:");
+ }
+ return -1;
+ }
+ ACE_ENDTRY;
+#endif /* !TAO_AS_STATIC_LIBS && TAO_HAS_INTERCEPTORS == 1 */
+ return 0;
+}
+
+int
+TAO::ORBInitializer_Registry::fini (void)
+{
+ ACE_GUARD_RETURN (TAO_SYNCH_RECURSIVE_MUTEX,
+ guard,
+ this->lock_,
+ -1);
+
+ // Release all initializers in the array
+ size_t const initializer_count (this->initializers_.size ());
+ for (size_t i = 0; i < initializer_count; ++i)
+ {
+ this->initializers_[i] = PortableInterceptor::ORBInitializer::_nil();
+ }
+
+ return 0;
+}
+
+void
+TAO::ORBInitializer_Registry::register_orb_initializer (
+ PortableInterceptor::ORBInitializer_ptr init
+ ACE_ENV_ARG_DECL)
+{
+ if (!CORBA::is_nil (init))
+ {
+ ACE_GUARD (TAO_SYNCH_RECURSIVE_MUTEX,
+ guard,
+ this->lock_);
+
+ // Increase the length of the ORBInitializer array by one.
+ size_t const cur_len = this->initializers_.size ();
+ size_t const new_len = cur_len + 1;
+ if (this->initializers_.size (new_len) != 0)
+ ACE_THROW (CORBA::INTERNAL ());
+
+ // Add the given ORBInitializer to the sequence.
+ this->initializers_[cur_len] =
+ PortableInterceptor::ORBInitializer::_duplicate (init);
+ }
+ else
+ ACE_THROW (CORBA::INV_OBJREF (
+ CORBA::SystemException::_tao_minor_code (
+ 0,
+ EINVAL),
+ CORBA::COMPLETED_NO));
+}
+
+size_t
+TAO::ORBInitializer_Registry::pre_init (
+ TAO_ORB_Core *orb_core,
+ int argc,
+ char *argv[],
+ PortableInterceptor::SlotId &slotid
+ ACE_ENV_ARG_DECL)
+{
+ ACE_GUARD_RETURN (TAO_SYNCH_RECURSIVE_MUTEX,
+ guard,
+ this->lock_,
+ 0);
+
+ size_t const initializer_count (this->initializers_.size ());
+
+ if (initializer_count > 0)
+ {
+ TAO_ORBInitInfo * orb_init_info_temp = 0;
+
+ ACE_NEW_THROW_EX (orb_init_info_temp,
+ TAO_ORBInitInfo (orb_core,
+ argc,
+ argv,
+ slotid),
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ 0,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (0);
+
+ TAO_ORBInitInfo_var orb_init_info_ = orb_init_info_temp;
+
+ for (size_t i = 0; i < initializer_count; ++i)
+ {
+ this->initializers_[i]->pre_init (orb_init_info_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+ }
+
+ slotid = orb_init_info_temp->slot_count ();
+
+ // Invalidate the ORBInitInfo instance to prevent future
+ // modifications to the ORB. This behavior complies with the
+ // PortableInterceptor specification.
+ orb_init_info_temp->invalidate ();
+ }
+
+ return initializer_count;
+}
+
+void
+TAO::ORBInitializer_Registry::post_init (
+ size_t pre_init_count,
+ TAO_ORB_Core *orb_core,
+ int argc,
+ char *argv[],
+ PortableInterceptor::SlotId slotid
+ ACE_ENV_ARG_DECL)
+{
+ if (pre_init_count > 0)
+ {
+ ACE_GUARD (TAO_SYNCH_RECURSIVE_MUTEX,
+ guard,
+ this->lock_);
+
+ TAO_ORBInitInfo * orb_init_info_temp = 0;
+
+ ACE_NEW_THROW_EX (orb_init_info_temp,
+ TAO_ORBInitInfo (orb_core,
+ argc,
+ argv,
+ slotid),
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ 0,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_CHECK;
+
+ TAO_ORBInitInfo_var orb_init_info_ = orb_init_info_temp;
+
+ for (size_t i = 0; i < pre_init_count; ++i)
+ {
+ this->initializers_[i]->post_init (orb_init_info_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+#if TAO_HAS_INTERCEPTORS == 1
+ CORBA::Object_ptr picurrent_ptr = orb_core->pi_current ();
+ PortableInterceptor::SlotId slot_count = orb_init_info_->slot_count ();
+
+ if (CORBA::is_nil (picurrent_ptr) && slot_count != 0)
+ {
+ // Force instantiation of the PICurrent object. If we do not do it
+ // now, the slot count will be lost.
+ CORBA::Object_var tmp = orb_core->resolve_picurrent ();
+ picurrent_ptr = orb_core->pi_current ();
+ }
+
+ if (!CORBA::is_nil (picurrent_ptr))
+ {
+ TAO::PICurrent *pi = dynamic_cast <TAO::PICurrent*> (picurrent_ptr);
+
+ if (pi)
+ {
+ pi->initialize (slot_count ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ }
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+
+ // Invalidate the ORBInitInfo instance to prevent future
+ // modifications to the ORB. This behavior complies with the
+ // PortableInterceptor specification.
+ orb_init_info_temp->invalidate ();
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DEFINE (ORBInitializer_Registry,
+ ACE_TEXT ("ORBInitializer_Registry"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (ORBInitializer_Registry),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0)
+
+ACE_FACTORY_NAMESPACE_DEFINE (TAO_PI, ORBInitializer_Registry, TAO::ORBInitializer_Registry)
diff --git a/TAO/tao/PI/ORBInitializer_Registry_Impl.h b/TAO/tao/PI/ORBInitializer_Registry_Impl.h
new file mode 100644
index 00000000000..cac58a1d4e0
--- /dev/null
+++ b/TAO/tao/PI/ORBInitializer_Registry_Impl.h
@@ -0,0 +1,109 @@
+// -*- C++ -*-
+
+// ===================================================================
+/**
+ * @file ORBInitializer_Registry_Impl.h
+ *
+ * $Id$
+ *
+ * @author Ossama Othman <ossama@uci.edu>
+ */
+// ===================================================================
+
+#ifndef TAO_PI_ORB_INITIALIZER_REGISTRY_IMPL_H
+#define TAO_PI_ORB_INITIALIZER_REGISTRY_IMPL_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/PI/pi_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PI/PI.h"
+
+#include "tao/CORBA_methods.h"
+#include "tao/Objref_VarOut_T.h"
+#include "tao/ORBInitializer_Registry_Adapter.h"
+
+#include "ace/Array_Base.h"
+#include "ace/Service_Config.h"
+#include "ace/Recursive_Thread_Mutex.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ /**
+ * @class ORBInitializer_Registry
+ *
+ * @brief Global list that contains all portable interceptor ORB
+ * initializers.
+ */
+ class ORBInitializer_Registry
+ : public ORBInitializer_Registry_Adapter
+ {
+ public:
+ ORBInitializer_Registry (void);
+
+ /// Added to provide registration for the several static service
+ /// objects, brought in with this ORBInitializer_Registry
+ /// implementation. Note that this is more reliable than using
+ /// static initializers, since multiple copies of the dynamic
+ /// service object will require their own (multiple) copies of the
+ /// dependent static service objects. That is just impossible
+ /// without registering those static services in the same repo, the
+ /// dynamic SO is registered with.
+ virtual int init (int, ACE_TCHAR *[]);
+
+ /// Service config fini method, release all ORBInitializers at this
+ /// moment
+ virtual int fini (void);
+
+ /// Register an ORBInitializer with the underlying ORBInitializer
+ /// array.
+ virtual void register_orb_initializer (
+ PortableInterceptor::ORBInitializer_ptr init
+ ACE_ENV_ARG_DECL);
+
+ /// Begin initialization of all registered ORBInitializers before
+ /// the ORB itself is initialized.
+ virtual size_t pre_init (
+ TAO_ORB_Core *orb_core,
+ int argc,
+ char *argv[],
+ PortableInterceptor::SlotId &slotid
+ ACE_ENV_ARG_DECL);
+
+ /// Complete initialization of all registered ORBInitializers after
+ /// the ORB has been initialized.
+ virtual void post_init (
+ size_t pre_init_count,
+ TAO_ORB_Core *orb_core,
+ int argc,
+ char *argv[],
+ PortableInterceptor::SlotId slotid
+ ACE_ENV_ARG_DECL);
+
+ private:
+ // Prevent copying
+ ORBInitializer_Registry (const ORBInitializer_Registry &);
+ void operator= (const ORBInitializer_Registry &);
+
+ private:
+ TAO_SYNCH_RECURSIVE_MUTEX lock_;
+
+ /// Dynamic array containing registered ORBInitializers.
+ ACE_Array_Base<PortableInterceptor::ORBInitializer_var> initializers_;
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE (ORBInitializer_Registry)
+ACE_FACTORY_DECLARE (TAO_PI, ORBInitializer_Registry)
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_PI_ORB_INITIALIZER_REGISTRY_IMPL_H */
diff --git a/TAO/tao/PI/PI.cpp b/TAO/tao/PI/PI.cpp
new file mode 100644
index 00000000000..61a039a52ed
--- /dev/null
+++ b/TAO/tao/PI/PI.cpp
@@ -0,0 +1,72 @@
+#include "tao/PI/PI.h"
+#include "tao/PI/ORBInitializer_Registry_Impl.h"
+#include "tao/PI/PolicyFactory_Loader.h"
+#include "tao/PI/ClientRequestInterceptor_Factory_Impl.h"
+#include "tao/PI/PICurrent_Loader.h"
+#include "tao/PI/PI_ORBInitializer.h"
+#include "tao/ORBInitializer_Registry.h"
+#include "tao/ORB_Constants.h"
+
+ACE_RCSID (PI,
+ PI,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+
+// This initializer is very similar to the ORBInitializer_Registry::init.
+// This one is used during static initialization while the other is used
+// when PI is a shared library.
+int
+TAO_PI_Init::Initializer (void)
+{
+#if TAO_HAS_INTERCEPTORS == 1
+ ACE_Service_Config::process_directive (ace_svc_desc_TAO_ClientRequestInterceptor_Adapter_Factory_Impl);
+
+ ACE_Service_Config::process_directive (ace_svc_desc_TAO_PICurrent_Loader);
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+
+ int const status = ACE_Service_Config::process_directive (
+ ace_svc_desc_ORBInitializer_Registry);
+
+#if TAO_HAS_INTERCEPTORS == 1
+ PortableInterceptor::ORBInitializer_ptr temp_orb_initializer =
+ PortableInterceptor::ORBInitializer::_nil ();
+
+ PortableInterceptor::ORBInitializer_var orb_initializer;
+
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ /// Register the PI ORBInitializer.
+
+ ACE_NEW_THROW_EX (temp_orb_initializer,
+ TAO_PI_ORBInitializer,
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_TRY_CHECK;
+
+ orb_initializer = temp_orb_initializer;
+
+ PortableInterceptor::register_orb_initializer (orb_initializer.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "(%P | %t) Caught exception:");
+ }
+ return -1;
+ }
+ ACE_ENDTRY;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ return status;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PI/PI.h b/TAO/tao/PI/PI.h
new file mode 100644
index 00000000000..077cc2bc9a1
--- /dev/null
+++ b/TAO/tao/PI/PI.h
@@ -0,0 +1,62 @@
+// -*- C++ -*-
+
+// ===================================================================
+/**
+ * @file PI.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+// ===================================================================
+
+#ifndef TAO_PI_H
+#define TAO_PI_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/PI/pi_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Versioned_Namespace.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_PI_Init
+ *
+ */
+class TAO_PI_Export TAO_PI_Init
+{
+public:
+
+ /// Used to force the initialization of the ORB code.
+ static int Initializer (void);
+};
+
+#if defined (TAO_AS_STATIC_LIBS)
+// only do this for static builds, it causes a circular
+// dependency for dynamic builds.
+static int
+TAO_Requires_PI_Initializer =
+ TAO_PI_Init::Initializer ();
+#endif /* TAO_AS_STATIC_LIBS */
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#define TAO_PI_SAFE_INCLUDE
+#include "tao/PI/ORBInitInfoC.h"
+#include "tao/PI/PolicyFactoryC.h"
+#include "tao/PI/ORBInitializerC.h"
+#include "tao/PI/InterceptorC.h"
+#include "tao/PI/ClientRequestInfoC.h"
+#include "tao/PI/ClientRequestInterceptorC.h"
+#include "tao/PI/PICurrentC.h"
+#undef TAO_PI_SAFE_INCLUDE
+
+#endif /* TAO_PI_H */
diff --git a/TAO/tao/PI/PICurrent.cpp b/TAO/tao/PI/PICurrent.cpp
new file mode 100644
index 00000000000..1212598ae47
--- /dev/null
+++ b/TAO/tao/PI/PICurrent.cpp
@@ -0,0 +1,126 @@
+#include "tao/PI/PICurrent.h"
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+ACE_RCSID (tao,
+ PICurrent,
+ "$Id$")
+
+
+#if !defined (__ACE_INLINE__)
+# include "tao/PI/PICurrent.inl"
+#endif /* __ACE_INLINE__ */
+
+#include "tao/PI/PICurrent_Impl.h"
+
+#include "tao/ORB_Core.h"
+#include "tao/ORB_Core_TSS_Resources.h"
+#include "tao/TAO_Server_Request.h"
+#include "tao/SystemException.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO::PICurrent::PICurrent (TAO_ORB_Core &orb_core)
+ : orb_core_ (orb_core),
+ tss_slot_ (0),
+ slot_count_ (0)
+{
+}
+
+TAO::PICurrent::~PICurrent (void)
+{
+}
+
+CORBA::Any *
+TAO::PICurrent::get_slot (PortableInterceptor::SlotId identifier
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableInterceptor::InvalidSlot))
+{
+ this->check_validity (identifier ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ PICurrent_Impl *impl = this->tsc ();
+
+ if (impl == 0)
+ ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14,
+ CORBA::COMPLETED_NO),
+ 0);
+
+ return impl->get_slot (identifier ACE_ENV_ARG_PARAMETER);
+}
+
+void
+TAO::PICurrent::set_slot (PortableInterceptor::SlotId identifier,
+ const CORBA::Any &data
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableInterceptor::InvalidSlot))
+{
+ this->check_validity (identifier ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ PICurrent_Impl *impl = this->tsc ();
+
+ if (impl == 0)
+ ACE_THROW (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14,
+ CORBA::COMPLETED_NO));
+
+ impl->set_slot (identifier, data ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+TAO::PICurrent_Impl *
+TAO::PICurrent::tsc (void)
+{
+ TAO::PICurrent_Impl *impl =
+ static_cast<TAO::PICurrent_Impl *> (
+ this->orb_core_.get_tss_resource (this->tss_slot_));
+
+ return impl;
+}
+
+void
+TAO::PICurrent::check_validity (const PortableInterceptor::SlotId &identifier
+ ACE_ENV_ARG_DECL)
+{
+ // No need to acquire a lock for this check. At this point, these
+ // attributes are read only.
+ if (identifier >= this->slot_count_)
+ ACE_THROW (PortableInterceptor::InvalidSlot ());
+}
+
+CORBA::ORB_ptr
+TAO::PICurrent::_get_orb (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+{
+ return CORBA::ORB::_duplicate (this->orb_core_.orb ());
+}
+
+int
+TAO::PICurrent::initialize (PortableInterceptor::SlotId sc
+ ACE_ENV_ARG_DECL_NOT_USED)
+{
+ this->slot_count_ = sc;
+
+ if (this->tsc () == 0 && tss_slot_ == 0)
+ {
+ TAO::PICurrent_Impl *impl = 0;
+ ACE_NEW_RETURN (impl,
+ TAO::PICurrent_Impl,
+ 0);
+
+ const int result = this->orb_core_.add_tss_cleanup_func (0,
+ tss_slot_);
+
+ if (result != 0)
+ return result;
+
+ this->orb_core_.set_tss_resource (tss_slot_, impl);
+ }
+
+ return 0;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
diff --git a/TAO/tao/PI/PICurrent.h b/TAO/tao/PI/PICurrent.h
new file mode 100644
index 00000000000..6f50a5d93da
--- /dev/null
+++ b/TAO/tao/PI/PICurrent.h
@@ -0,0 +1,152 @@
+// -*- C++ -*-
+
+// ===================================================================
+/**
+ * @file PICurrent.h
+ *
+ * $Id$
+ *
+ * @author Ossama Othman <ossama@dre.vanderbilt.edu>
+ */
+// ===================================================================
+
+#ifndef TAO_PI_CURRENT_H
+#define TAO_PI_CURRENT_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/PI/pi_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/orbconf.h"
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+#include "tao/PI/PICurrentC.h"
+
+#include "tao/LocalObject.h"
+#include "ace/Array_Base.h"
+
+#if defined(_MSC_VER)
+# pragma warning(push)
+# pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/// Forward declarations.
+class TAO_ORB_Core;
+
+namespace TAO
+{
+ class PICurrent_Impl;
+
+ /**
+ * @class PICurrent
+ *
+ * @brief Implementation of the PortableInterceptor::Current
+ * interface.
+ *
+ * PortableInterceptor::Current is useful for passing data between
+ * request interceptors, in addition to passing data from an
+ * interceptor to the calling thread.
+ */
+ class TAO_PI_Export PICurrent
+ : public virtual PortableInterceptor::Current,
+ public virtual TAO_Local_RefCounted_Object
+ {
+ public:
+
+ /// Constructor.
+ PICurrent (TAO_ORB_Core &orb_core);
+
+ /**
+ * @name PortableInterceptor::Current Methods
+ *
+ * These are methods exposed by the PortableInterceptor::Current
+ * interface.
+ */
+ //@{
+ /// Retrieve information stored in the slot table at the given
+ /// SlotId.
+ virtual CORBA::Any *get_slot (PortableInterceptor::SlotId id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableInterceptor::InvalidSlot));
+
+ /// Set information in the slot table at the given SlotId.
+ virtual void set_slot (PortableInterceptor::SlotId identifier,
+ const CORBA::Any & data
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableInterceptor::InvalidSlot));
+ //@}
+
+ virtual CORBA::ORB_ptr _get_orb (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ );
+
+ /// Number of slots allocated in the slot table.
+ PortableInterceptor::SlotId slot_count (void) const;
+
+ /// Retrieve the PICurrent implementation from TSS, i.e. the thread
+ /// scope current (TSC).
+ PICurrent_Impl * tsc (void);
+
+ /// Verify the validity of the given SlotId.
+ void check_validity (const PortableInterceptor::SlotId &identifier
+ ACE_ENV_ARG_DECL);
+
+ /// Initialize the PICurrent object.
+ int initialize (PortableInterceptor::SlotId sc ACE_ENV_ARG_DECL);
+
+ protected:
+
+ /// Destructor
+ /**
+ * Protected destructor to enforce the fact this class is reference
+ * counted, and should not be destroyed using delete() by anything
+ * other than the reference counting mechanism.
+ */
+ virtual ~PICurrent (void);
+
+ private:
+
+ /// Prevent copying through the copy constructor and the assignment
+ /// operator.
+ //@{
+ PICurrent (const PICurrent &);
+ void operator= (const PICurrent &);
+ //@}
+
+ private:
+ /// Reference to the orb core.
+ TAO_ORB_Core &orb_core_;
+
+ /// TSS slot assigned to this object.
+ size_t tss_slot_;
+
+ /// The number of allocated slots.
+ PortableInterceptor::SlotId slot_count_;
+
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/PI/PICurrent.inl"
+#endif /* __ACE_INLINE__ */
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_PI_CURRENT_H */
diff --git a/TAO/tao/PI/PICurrent.inl b/TAO/tao/PI/PICurrent.inl
new file mode 100644
index 00000000000..aca42f2786c
--- /dev/null
+++ b/TAO/tao/PI/PICurrent.inl
@@ -0,0 +1,13 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE PortableInterceptor::SlotId
+TAO::PICurrent::slot_count (void) const
+{
+ return this->slot_count_;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PI/PICurrent.pidl b/TAO/tao/PI/PICurrent.pidl
new file mode 100644
index 00000000000..3cfc5cfb8cb
--- /dev/null
+++ b/TAO/tao/PI/PICurrent.pidl
@@ -0,0 +1,38 @@
+// -*- IDL -*-
+
+/**
+ * @file PICurrent.pidl
+ *
+ * $Id$
+ *
+ * @brief Pre-compiled IDL source for the PortableInterceptor
+ * components in the ORB.
+ *
+ * tao_idl
+ * -o orig -Gp -Gd -Ge 1 -GA -SS -Sci
+ * -Wb,export_include="tao/TAO_Export.h"
+ * -Wb,export_macro=TAO_Export
+ * -Wb,pre_include="ace/pre.h"
+ * -Wb,post_include="ace/post.h"
+ * PICurrent.pidl
+ */
+
+#ifndef _PI_CURRENT_IDL_
+#define _PI_CURRENT_IDL_
+
+#include "tao/PI/InvalidSlot.pidl"
+#include "tao/PI_Forward.pidl"
+#include "tao/Current.pidl"
+
+module PortableInterceptor {
+
+ typeprefix PortableInterceptor "omg.org";
+
+ local interface Current : CORBA::Current
+ {
+ any get_slot (in SlotId id) raises (InvalidSlot);
+ void set_slot (in SlotId id, in any data) raises (InvalidSlot);
+ };
+};
+
+#endif /* _PI_CURRENT_IDL_ */
diff --git a/TAO/tao/PI/PICurrent_Impl.cpp b/TAO/tao/PI/PICurrent_Impl.cpp
new file mode 100644
index 00000000000..7cb54b6df2c
--- /dev/null
+++ b/TAO/tao/PI/PICurrent_Impl.cpp
@@ -0,0 +1,141 @@
+#include "tao/PI/PICurrent_Impl.h"
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+ACE_RCSID (tao,
+ PICurrent,
+ "$Id$")
+
+
+#if !defined (__ACE_INLINE__)
+# include "tao/PI/PICurrent_Impl.inl"
+#endif /* __ACE_INLINE__ */
+
+#include "tao/TAO_Server_Request.h"
+#include "tao/SystemException.h"
+#include "ace/Log_Msg.h"
+#include "tao/debug.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+CORBA::Any *
+TAO::PICurrent_Impl::get_slot (PortableInterceptor::SlotId identifier
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableInterceptor::InvalidSlot))
+{
+ // No need to check validity of SlotId. It is validated before this
+ // method is invoked.
+
+ // The active slot table should never be a lazy copy of itself!
+ if ( (0 != this->lazy_copy_)
+ && (&this->lazy_copy_->current_slot_table () == &this->slot_table_))
+ {
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("TAO (%P|%t) Lazy copy of self detected at %N,%l\n")));
+ ACE_THROW (CORBA::INTERNAL ());
+ }
+
+ // Get the slot table that is currently active
+ PICurrent_Impl::Table & table = this->current_slot_table ();
+ CORBA::Any * any = 0;
+
+ if (identifier < table.size ())
+ {
+ ACE_NEW_THROW_EX (any,
+ CORBA::Any (table[identifier]), // Make a copy.
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ 0,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (any);
+ }
+ else
+ {
+ // In accordance with the Portable Interceptor specification,
+ // return an Any with a TCKind of tk_null. A default
+ // constructed Any has that TCKind.
+ ACE_NEW_THROW_EX (any,
+ CORBA::Any,
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ 0,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (any);
+ }
+
+ return any;
+}
+
+void
+TAO::PICurrent_Impl::set_slot (PortableInterceptor::SlotId identifier,
+ const CORBA::Any & data
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableInterceptor::InvalidSlot))
+{
+ // No need to check validity of SlotId. It is validated before this
+ // method is invoked.
+
+ // Break any existing ties that another PICurrent has with our table
+ // since our table is changing.
+ if (0 != this->impending_change_callback_)
+ this->impending_change_callback_->convert_from_lazy_to_real_copy ();
+
+ // Ensure that we have a real physical copy of the table before
+ // making any changes to it.
+ this->convert_from_lazy_to_real_copy ();
+
+ // If the slot table array isn't large enough, then increase its
+ // size. We're guaranteed not to exceed the number of allocated
+ // slots for the reason stated above.
+ if (identifier >= this->slot_table_.size ()
+ && this->slot_table_.size (identifier + 1) != 0)
+ ACE_THROW (CORBA::INTERNAL ());
+
+ this->slot_table_[identifier] = CORBA::Any (data);
+}
+
+void
+TAO::PICurrent_Impl::take_lazy_copy (
+ TAO::PICurrent_Impl * p)
+{
+ // Check that we are being told to actually change which table we are
+ // copying from. (If it is the same as before OR it would ultimately be
+ // the same table, we are already correctly setup and we do nothing.)
+ if ( (p != this->lazy_copy_)
+ && ((0 == p) || (&p->current_slot_table () != &this->current_slot_table ()))
+ )
+ {
+ // Break any existing ties that another PICurrent has with our table
+ // since our table is changing.
+ if (0 != this->impending_change_callback_)
+ this->impending_change_callback_->convert_from_lazy_to_real_copy ();
+
+ // If we have previously logically copied another table, ensure it is
+ // told that we are no longer interested in it so that it will not
+ // call our conver_from_lazy_to_real_copy() when it changes/destructs.
+ if (0 != this->lazy_copy_)
+ this->lazy_copy_->set_callback_for_impending_change (0);
+
+ // Are we being asked to copy ourself (or nothing)
+ if ((0 == p) || (this == p))
+ {
+ this->lazy_copy_ = 0; // Use our own physical slot_table_
+ }
+ else
+ {
+ this->lazy_copy_ = p;
+
+ // Must tell the newly copied PICurrent_Impl that we want to
+ // be told when/if it is going to be changed or destroyed.
+ this->lazy_copy_->set_callback_for_impending_change (this);
+ }
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
diff --git a/TAO/tao/PI/PICurrent_Impl.h b/TAO/tao/PI/PICurrent_Impl.h
new file mode 100644
index 00000000000..11876b31acb
--- /dev/null
+++ b/TAO/tao/PI/PICurrent_Impl.h
@@ -0,0 +1,133 @@
+// -*- C++ -*-
+
+// ===================================================================
+/**
+ * @file PICurrent_Impl.h
+ *
+ * $Id$
+ *
+ * @author Ossama Othman <ossama@dre.vanderbilt.edu>
+ */
+// ===================================================================
+
+#ifndef TAO_PI_CURRENT_IMPL_H
+#define TAO_PI_CURRENT_IMPL_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/PI/pi_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/orbconf.h"
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+#include "tao/PI/PICurrentC.h"
+#include "tao/AnyTypeCode/Any.h"
+#include "ace/Array_Base.h"
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/// Forward declarations.
+class TAO_ORB_Core;
+
+namespace TAO
+{
+ /**
+ * @class PICurrent_Impl
+ *
+ * @brief Implementation of the PortableInterceptor::Current
+ * interface.
+ *
+ * This class implements both the "request scope current" and the
+ * "thread scope current" objects as required by Portable
+ * Interceptors.
+ */
+ class TAO_PI_Export PICurrent_Impl
+ {
+ public:
+ /// Constructor.
+ PICurrent_Impl (void);
+
+ /// Destructor.
+ ~PICurrent_Impl (void);
+
+ /// Retrieve information stored in the slot table at the given
+ /// SlotId.
+ CORBA::Any *get_slot (PortableInterceptor::SlotId identifier
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableInterceptor::InvalidSlot));
+
+ /// Set information in the slot table at the given SlotId.
+ void set_slot (PortableInterceptor::SlotId identifier,
+ const CORBA::Any & data
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableInterceptor::InvalidSlot));
+
+ /// Logically/Lazy (shallow) copy the given object's slot table.
+ void take_lazy_copy (PICurrent_Impl *p);
+
+ private:
+ /// Force this object to convert from a logical (referenced)
+ /// copy, to a physical (or deep, actual) copy.
+ void convert_from_lazy_to_real_copy ();
+
+ /// Set the callback PICurrent_Impl object that will be notified
+ /// of this object's impending destruction or change.
+ /// Set to 0 to clear. (NOTE Only handles a SINGLE object at
+ /// at time, does NOT warn previous callback that this has
+ /// been changed.)
+ void set_callback_for_impending_change (PICurrent_Impl *p);
+
+ /// Typedef for the underyling "slot table."
+ typedef ACE_Array_Base<CORBA::Any> Table;
+
+ /// Return a reference to the slot table currently associated
+ /// with this PICurrent_Impl object.
+ /**
+ * @return Logically copied slot table if available, otherwise
+ * underlying slot table.
+ */
+ Table & current_slot_table ();
+
+ /// Prevent copying through the copy constructor and the assignment
+ /// operator.
+ //@{
+ PICurrent_Impl (const PICurrent_Impl &);
+ void operator= (const PICurrent_Impl &);
+ //@}
+
+ private:
+ /// Array of CORBA::Anys that is the underlying "slot table."
+ Table slot_table_;
+
+ /// Access to logical copy from a PICurrent_Impl in another
+ /// scope, i.e. either the request scope or the thread scope.
+ PICurrent_Impl *lazy_copy_;
+
+ /// PICurrent_Impl object that will be notified of this object's
+ /// impending destruction or change to its slot_table_. This is
+ /// the PICurrent_Impl that has access to our slot_table_ via its
+ /// lazy_copy_ pointer. As necessary this allows that object's
+ /// convert_from_lazy_to_real_copy() to be called.
+ PICurrent_Impl *impending_change_callback_;
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/PI/PICurrent_Impl.inl"
+#endif /* __ACE_INLINE__ */
+
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_PI_CURRENT_IMPL_H */
diff --git a/TAO/tao/PI/PICurrent_Impl.inl b/TAO/tao/PI/PICurrent_Impl.inl
new file mode 100644
index 00000000000..eaedb899d20
--- /dev/null
+++ b/TAO/tao/PI/PICurrent_Impl.inl
@@ -0,0 +1,61 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO::PICurrent_Impl::PICurrent_Impl ()
+ : slot_table_ (),
+ lazy_copy_ (0),
+ impending_change_callback_ (0)
+{
+}
+
+ACE_INLINE
+TAO::PICurrent_Impl::~PICurrent_Impl ()
+{
+ // Break any existing ties that another PICurrent has with our table
+ // since our table will no longer exist once this destructor completes.
+ if (0 != this->impending_change_callback_)
+ this->impending_change_callback_->convert_from_lazy_to_real_copy ();
+
+ // If we have logically copied another table, ensure it is told about our
+ // demise so that it will not call our non-existant
+ // convert_from_lazy_to_real_copy() when it changes/destructs.
+ if (0 != this->lazy_copy_)
+ this->lazy_copy_->set_callback_for_impending_change (0);
+}
+
+ACE_INLINE void
+TAO::PICurrent_Impl::convert_from_lazy_to_real_copy ()
+{
+ // Make sure we take a physical copy of the existing logical
+ // copy of the table before it disappears/changes.
+ if (0 != this->lazy_copy_)
+ {
+ this->slot_table_ = this->lazy_copy_->current_slot_table ();
+
+ // Must tell the old copied PICurrent_Impl that we no
+ // longer want to be told when/if it is going to be
+ // changed or destroyed.
+ this->lazy_copy_->set_callback_for_impending_change (0);
+ this->lazy_copy_ = 0;
+ }
+}
+
+ACE_INLINE void
+TAO::PICurrent_Impl::set_callback_for_impending_change (TAO::PICurrent_Impl *p)
+{
+ this->impending_change_callback_ = (this == p) ? 0 : p;
+}
+
+ACE_INLINE TAO::PICurrent_Impl::Table &
+TAO::PICurrent_Impl::current_slot_table ()
+{
+ return (0 == this->lazy_copy_) ?
+ this->slot_table_ :
+ this->lazy_copy_->current_slot_table ();
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PI/PICurrent_Loader.cpp b/TAO/tao/PI/PICurrent_Loader.cpp
new file mode 100644
index 00000000000..639ad627d58
--- /dev/null
+++ b/TAO/tao/PI/PICurrent_Loader.cpp
@@ -0,0 +1,55 @@
+/* -*- C++ -*- */
+
+// =================================================================
+/**
+ * @file PICurrent_Loader.cpp
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ *
+ */
+// =================================================================
+
+#include "tao/PI/PICurrent_Loader.h"
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+#include "tao/PI/PICurrent.h"
+
+#include "tao/ORB.h"
+#include "tao/ORB_Core.h"
+#include "tao/debug.h"
+
+ACE_RCSID (PI,
+ PICurrent_Loader,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+CORBA::Object_ptr
+TAO_PICurrent_Loader::create_object (
+ CORBA::ORB_ptr orb,
+ int,
+ ACE_TCHAR *[]
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ CORBA::Object_ptr obj = CORBA::Object::_nil ();
+ ACE_NEW_RETURN (obj,
+ TAO::PICurrent (*orb->orb_core ()),
+ CORBA::Object::_nil ());
+ return obj;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DEFINE (TAO_PICurrent_Loader,
+ ACE_TEXT ("PICurrent_Loader"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (TAO_PICurrent_Loader),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0)
+ACE_FACTORY_DEFINE (TAO_PI, TAO_PICurrent_Loader)
+
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
diff --git a/TAO/tao/PI/PICurrent_Loader.h b/TAO/tao/PI/PICurrent_Loader.h
new file mode 100644
index 00000000000..a1b4e48cfa9
--- /dev/null
+++ b/TAO/tao/PI/PICurrent_Loader.h
@@ -0,0 +1,57 @@
+/* -*- C++ -*- */
+
+
+//=============================================================================
+/**
+ * @file PICurrent_Loader.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+
+#ifndef TAO_PICURRENT_LOADER_H
+#define TAO_PICURRENT_LOADER_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/PI/pi_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/orbconf.h"
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+#include "tao/Object_Loader.h"
+
+#include "ace/Service_Config.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_PI_Export TAO_PICurrent_Loader
+ : public TAO_Object_Loader
+{
+public:
+ /// Creates a PICurrent and returns it.
+ virtual CORBA::Object_ptr create_object (CORBA::ORB_ptr orb,
+ int argc,
+ ACE_TCHAR *argv []
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE (TAO_PICurrent_Loader)
+ACE_FACTORY_DECLARE (TAO_PI, TAO_PICurrent_Loader)
+
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_PICURRENT_LOADER_H */
diff --git a/TAO/tao/PI/PIForwardRequest.pidl b/TAO/tao/PI/PIForwardRequest.pidl
new file mode 100644
index 00000000000..d30720eb633
--- /dev/null
+++ b/TAO/tao/PI/PIForwardRequest.pidl
@@ -0,0 +1,37 @@
+// -*- IDL -*-
+
+/**
+ * @file PIForwardRequest.pidl
+ *
+ * $Id$
+ *
+ * @brief Pre-compiled IDL source for the PortableInterceptor
+ * components in the ORB.
+ *
+ * This file was used to generate the code in PIForwardRequestC.*
+ * The command used to generate code is:
+ *
+ * tao_idl
+ * -o orig -Gp -Gd -Ge 1 -GA -SS -Sci
+ * -Wb,export_include="tao/TAO_Export.h"
+ * -Wb,export_macro=TAO_Export
+ * -Wb,pre_include="ace/pre.h"
+ * -Wb,post_include="ace/post.h"
+ * PIForwardRequest.pidl
+ *
+ */
+
+#ifndef _PIFORWARD_REQUEST_IDL_
+#define _PIFORWARD_REQUEST_IDL_
+
+module PortableInterceptor {
+
+ typeprefix PortableInterceptor "omg.org";
+
+ exception ForwardRequest
+ {
+ Object forward;
+ };
+};
+
+#endif /* _PIFORWARD_REQUEST_IDL_ */
diff --git a/TAO/tao/PI/PI_ORBInitializer.cpp b/TAO/tao/PI/PI_ORBInitializer.cpp
new file mode 100644
index 00000000000..c138481d1ee
--- /dev/null
+++ b/TAO/tao/PI/PI_ORBInitializer.cpp
@@ -0,0 +1,107 @@
+// -*- C++ -*-
+
+#include "tao/PI/PI_ORBInitializer.h"
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+#include "tao/PI/PI_PolicyFactory.h"
+#include "tao/PI/ProcessingModePolicyC.h"
+#include "tao/ORB_Core.h"
+#include "tao/PI/ORBInitInfoC.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_RCSID (tao,
+ PI_ORBInitializer,
+ "$Id$")
+
+void
+TAO_PI_ORBInitializer::pre_init (PortableInterceptor::ORBInitInfo_ptr info
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ ACE_UNUSED_ARG (info);
+}
+
+
+void
+TAO_PI_ORBInitializer::post_init (
+ PortableInterceptor::ORBInitInfo_ptr info
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ // The PI policy factory is stateless and reentrant, so share a
+ // single instance between all ORBs.
+ if (CORBA::is_nil (this->policy_factory_.in ()))
+ {
+ PortableInterceptor::PolicyFactory_ptr policy_factory;
+ ACE_NEW_THROW_EX (policy_factory,
+ TAO_PI_PolicyFactory,
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_CHECK;
+
+ this->policy_factory_ = policy_factory;
+ }
+
+
+ this->register_policy_factories (info
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+
+void
+TAO_PI_ORBInitializer::register_policy_factories (
+ PortableInterceptor::ORBInitInfo_ptr info
+ ACE_ENV_ARG_DECL)
+{
+ // Register the PI policy factory.
+
+ // Bind the same policy factory to all PortableInterceptor related policy
+ // types since a single policy factory is used to create each of the
+ // different types of PortableInterceptor policies.
+ CORBA::PolicyType type[] = {
+ PortableInterceptor::PROCESSING_MODE_POLICY_TYPE
+ };
+
+ const CORBA::PolicyType *end = type + sizeof (type) / sizeof (type[0]);
+
+ for (CORBA::PolicyType *i = type; i != end; ++i)
+ {
+ ACE_TRY
+ {
+ info->register_policy_factory (*i,
+ this->policy_factory_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCH (CORBA::BAD_INV_ORDER, ex)
+ {
+ if (ex.minor () == (CORBA::OMGVMCID | 16))
+ {
+ // The factory is already there, it happens because the
+ // magic initializer in PI_Initializer.cpp registers
+ // with the ORB multiple times. This is an indication
+ // that we should do no more work in this
+ // ORBInitializer.
+ return;
+ }
+ ACE_RE_THROW;
+ }
+ ACE_CATCHANY
+ {
+ // Rethrow any other exceptions...
+ ACE_RE_THROW;
+ }
+ ACE_ENDTRY;
+ ACE_CHECK;
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
diff --git a/TAO/tao/PI/PI_ORBInitializer.h b/TAO/tao/PI/PI_ORBInitializer.h
new file mode 100644
index 00000000000..92d62abfef6
--- /dev/null
+++ b/TAO/tao/PI/PI_ORBInitializer.h
@@ -0,0 +1,84 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file PI_ORBInitializer.h
+ *
+ * $Id$
+ *
+ * @author Tim Bradley <bradley_t@ociweb.com>
+ */
+//=============================================================================
+
+#ifndef TAO_PI_ORB_INITIALIZER_H
+#define TAO_PI_ORB_INITIALIZER_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+#include "tao/PI/pi_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/LocalObject.h"
+#include "tao/PI/ORBInitializerC.h"
+#include "tao/PI/PolicyFactoryC.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/// Forward Declarations
+class TAO_PI_PolicyFactory;
+
+/// PortableServer ORB initializer.
+class TAO_PI_Export TAO_PI_ORBInitializer
+ : public virtual PortableInterceptor::ORBInitializer,
+ public virtual TAO_Local_RefCounted_Object
+{
+public:
+
+ /**
+ * @name PortableInterceptor::ORBInitializer methods
+ *
+ * The following methods are required by the
+ * PortableInterceptor::ORBInitializer interface.
+ */
+ //@{
+
+ void pre_init (PortableInterceptor::ORBInitInfo_ptr info
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ void post_init (PortableInterceptor::ORBInitInfo_ptr info
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ //@}
+
+
+private:
+
+ /// Register PortableInterceptor policy factories.
+ void register_policy_factories (PortableInterceptor::ORBInitInfo_ptr info
+ ACE_ENV_ARG_DECL);
+
+
+ /// Instance of the PI policy factory.
+ /**
+ * The PI policy factory is stateless and reentrant, so share
+ * a single instance between all ORBs.
+ */
+ PortableInterceptor::PolicyFactory_var policy_factory_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_PI_ORB_INITIALIZER_H */
diff --git a/TAO/tao/PI/PI_PolicyFactory.cpp b/TAO/tao/PI/PI_PolicyFactory.cpp
new file mode 100644
index 00000000000..3f82ffff341
--- /dev/null
+++ b/TAO/tao/PI/PI_PolicyFactory.cpp
@@ -0,0 +1,48 @@
+#include "tao/PI/PI_PolicyFactory.h"
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+#include "tao/PI/ProcessingModePolicy.h"
+#include "tao/ORB_Constants.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_RCSID (tao,
+ PI_PolicyFactory,
+ "$Id$")
+
+CORBA::Policy_ptr
+TAO_PI_PolicyFactory::create_policy (
+ CORBA::PolicyType type,
+ const CORBA::Any &value
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ CORBA::PolicyError))
+{
+ if (type == PortableInterceptor::PROCESSING_MODE_POLICY_TYPE)
+ {
+ TAO_ProcessingModePolicy *processing_mode_policy = 0;
+ PortableInterceptor::ProcessingMode policy_value;
+
+ if ((value >>= policy_value) == 0)
+ {
+ ACE_THROW_RETURN (CORBA::PolicyError (CORBA::BAD_POLICY_VALUE),
+ CORBA::Policy::_nil ());
+ }
+
+ ACE_NEW_THROW_EX (processing_mode_policy,
+ TAO_ProcessingModePolicy (policy_value),
+ CORBA::NO_MEMORY (TAO::VMCID,
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+
+ return processing_mode_policy;
+ }
+
+ ACE_THROW_RETURN (CORBA::PolicyError (CORBA::BAD_POLICY_TYPE),
+ CORBA::Policy::_nil ());
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
diff --git a/TAO/tao/PI/PI_PolicyFactory.h b/TAO/tao/PI/PI_PolicyFactory.h
new file mode 100644
index 00000000000..eb7e4968015
--- /dev/null
+++ b/TAO/tao/PI/PI_PolicyFactory.h
@@ -0,0 +1,52 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file PI_PolicyFactory.h
+ *
+ * $Id$
+ *
+ * @author Tim Bradley <bradley_t@ociweb.com>
+ */
+//=============================================================================
+
+#ifndef TAO_PI_POLICY_FACTORY_H
+#define TAO_PI_POLICY_FACTORY_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+#include "tao/PI/pi_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/LocalObject.h"
+#include "tao/PI/PolicyFactoryC.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/// Policy factory for all PortableInterceptor related policies.
+class TAO_PI_Export TAO_PI_PolicyFactory
+ : public virtual PortableInterceptor::PolicyFactory,
+ public virtual TAO_Local_RefCounted_Object
+{
+public:
+ CORBA::Policy_ptr create_policy (CORBA::PolicyType type,
+ const CORBA::Any & value
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ CORBA::PolicyError));
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_PI_POLICY_FACTORY_H */
diff --git a/TAO/tao/PI/PolicyFactory.pidl b/TAO/tao/PI/PolicyFactory.pidl
new file mode 100644
index 00000000000..761eea60052
--- /dev/null
+++ b/TAO/tao/PI/PolicyFactory.pidl
@@ -0,0 +1,36 @@
+// -*- IDL -*-
+
+/**
+ * @file PolicyFactory.pidl
+ *
+ * $Id$
+ *
+ * @brief Pre-compiled IDL source for the PolicyFactory
+ *
+ * tao_idl
+ * -o orig -Gp -Gd -Ge 1 -GA -SS -Sci
+ * -Wb,export_include="tao/TAO_Export.h"
+ * -Wb,export_macro=TAO_Export
+ * -Wb,pre_include="ace/pre.h"
+ * -Wb,post_include="ace/post.h"
+ * PolicyFactory.pidl
+ */
+
+// File: PortableInterceptor.idl
+#ifndef _POLICYFACTORY_PIDL_
+#define _POLICYFACTORY_PIDL_
+
+#include "tao/Policy.pidl"
+
+module PortableInterceptor {
+
+ typeprefix PortableInterceptor "omg.org";
+
+ local interface PolicyFactory
+ {
+ CORBA::Policy create_policy (in CORBA::PolicyType type, in any value)
+ raises (CORBA::PolicyError);
+ };
+};
+
+#endif /* _PORTABLE_INTERCEPTOR_IDL_ */
diff --git a/TAO/tao/PI/PolicyFactoryA.cpp b/TAO/tao/PI/PolicyFactoryA.cpp
new file mode 100644
index 00000000000..ba611cec358
--- /dev/null
+++ b/TAO/tao/PI/PolicyFactoryA.cpp
@@ -0,0 +1,56 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+#include "tao/PI/PolicyFactoryA.h"
+#include "tao/AnyTypeCode/Null_RefCount_Policy.h"
+#include "tao/AnyTypeCode/TypeCode_Constants.h"
+#include "tao/AnyTypeCode/Alias_TypeCode_Static.h"
+#include "tao/AnyTypeCode/Objref_TypeCode_Static.h"
+#include "tao/AnyTypeCode/Any.h"
+#include "tao/CDR.h"
+#include "tao/AnyTypeCode/Any.h"
+#include "tao/AnyTypeCode/Any_Impl_T.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/objref_typecode.cpp:76
+
+static TAO::TypeCode::Objref<char const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_PortableInterceptor_PolicyFactory (
+ ::CORBA::tk_local_interface,
+ "IDL:omg.org/PortableInterceptor/PolicyFactory:1.0",
+ "PolicyFactory");
+
+namespace PortableInterceptor
+{
+ ::CORBA::TypeCode_ptr const _tc_PolicyFactory =
+ &_tao_tc_PortableInterceptor_PolicyFactory;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PI/PolicyFactoryA.h b/TAO/tao/PI/PolicyFactoryA.h
new file mode 100644
index 00000000000..2bbd578a36e
--- /dev/null
+++ b/TAO/tao/PI/PolicyFactoryA.h
@@ -0,0 +1,62 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:754
+
+#ifndef _TAO_IDL_POLICYFACTORYA_H_
+#define _TAO_IDL_POLICYFACTORYA_H_
+
+#include /**/ "ace/pre.h"
+
+#include "tao/PI/pi_export.h"
+#include "tao/PI/PolicyFactoryC.h"
+#include "tao/AnyTypeCode/PolicyA.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// TAO_IDL - Generated from
+// be\be_visitor_module/module_ch.cpp:59
+
+namespace PortableInterceptor
+{
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:49
+
+ extern TAO_PI_Export ::CORBA::TypeCode_ptr const _tc_PolicyFactory;
+
+// TAO_IDL - Generated from
+// be\be_visitor_module/module_ch.cpp:86
+
+} // module PortableInterceptor
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* ifndef */
diff --git a/TAO/tao/PI/PolicyFactoryC.cpp b/TAO/tao/PI/PolicyFactoryC.cpp
new file mode 100644
index 00000000000..9c4ed43e4af
--- /dev/null
+++ b/TAO/tao/PI/PolicyFactoryC.cpp
@@ -0,0 +1,180 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:277
+
+
+#include "tao/PI/PolicyFactoryC.h"
+#include "tao/CDR.h"
+#include "ace/OS_NS_string.h"
+
+// TAO_IDL - Generated from
+// be\be_visitor_arg_traits.cpp:70
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Arg traits specializations.
+namespace TAO
+{
+}
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/interface_cs.cpp:60
+
+// Traits specializations for PortableInterceptor::PolicyFactory.
+
+PortableInterceptor::PolicyFactory_ptr
+TAO::Objref_Traits<PortableInterceptor::PolicyFactory>::duplicate (
+ PortableInterceptor::PolicyFactory_ptr p
+ )
+{
+ return PortableInterceptor::PolicyFactory::_duplicate (p);
+}
+
+void
+TAO::Objref_Traits<PortableInterceptor::PolicyFactory>::release (
+ PortableInterceptor::PolicyFactory_ptr p
+ )
+{
+ ::CORBA::release (p);
+}
+
+PortableInterceptor::PolicyFactory_ptr
+TAO::Objref_Traits<PortableInterceptor::PolicyFactory>::nil (void)
+{
+ return PortableInterceptor::PolicyFactory::_nil ();
+}
+
+::CORBA::Boolean
+TAO::Objref_Traits<PortableInterceptor::PolicyFactory>::marshal (
+ PortableInterceptor::PolicyFactory_ptr p,
+ TAO_OutputCDR & cdr
+ )
+{
+ return ::CORBA::Object::marshal (p, cdr);
+}
+
+PortableInterceptor::PolicyFactory::PolicyFactory (void)
+{}
+
+PortableInterceptor::PolicyFactory::~PolicyFactory (void)
+{}
+
+PortableInterceptor::PolicyFactory_ptr
+PortableInterceptor::PolicyFactory::_narrow (
+ ::CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return PolicyFactory::_duplicate (
+ dynamic_cast<PolicyFactory_ptr> (_tao_objref)
+ );
+}
+
+PortableInterceptor::PolicyFactory_ptr
+PortableInterceptor::PolicyFactory::_unchecked_narrow (
+ ::CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return PolicyFactory::_duplicate (
+ dynamic_cast<PolicyFactory_ptr> (_tao_objref)
+ );
+}
+
+PortableInterceptor::PolicyFactory_ptr
+PortableInterceptor::PolicyFactory::_duplicate (PolicyFactory_ptr obj)
+{
+ if (! ::CORBA::is_nil (obj))
+ {
+ obj->_add_ref ();
+ }
+
+ return obj;
+}
+
+void
+PortableInterceptor::PolicyFactory::_tao_release (PolicyFactory_ptr obj)
+{
+ ::CORBA::release (obj);
+}
+
+::CORBA::Boolean
+PortableInterceptor::PolicyFactory::_is_a (
+ const char *value
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ if (
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/PortableInterceptor/PolicyFactory:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/LocalObject:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/Object:1.0"
+ )
+ )
+ {
+ return true; // success using local knowledge
+ }
+ else
+ {
+ return false;
+ }
+}
+
+const char* PortableInterceptor::PolicyFactory::_interface_repository_id (void) const
+{
+ return "IDL:omg.org/PortableInterceptor/PolicyFactory:1.0";
+}
+
+::CORBA::Boolean
+PortableInterceptor::PolicyFactory::marshal (TAO_OutputCDR &)
+{
+ return false;
+}
+
+// Hand-crafted.
+::CORBA::Policy_ptr
+PortableInterceptor::PolicyFactory::_create_policy (CORBA::PolicyType
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ CORBA::PolicyError))
+{
+ ACE_THROW_RETURN (CORBA::PolicyError (CORBA::BAD_POLICY_TYPE),
+ CORBA::Policy::_nil ());
+}
+
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PI/PolicyFactoryC.h b/TAO/tao/PI/PolicyFactoryC.h
new file mode 100644
index 00000000000..9737af6be89
--- /dev/null
+++ b/TAO/tao/PI/PolicyFactoryC.h
@@ -0,0 +1,218 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:154
+
+#ifndef _TAO_IDL_POLICYFACTORYC_H_
+#define _TAO_IDL_POLICYFACTORYC_H_
+
+#include /**/ "ace/pre.h"
+
+
+#include "ace/config-all.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PI/pi_export.h"
+#include "tao/ORB.h"
+#include "tao/SystemException.h"
+#include "tao/Environment.h"
+#include "tao/Object.h"
+#include "tao/AnyTypeCode/TypeCode.h"
+#include "tao/AnyTypeCode/TypeCode_Constants.h"
+#include "tao/AnyTypeCode/Any.h"
+#include "tao/Objref_VarOut_T.h"
+
+#include "tao/PolicyC.h"
+
+#if defined (TAO_EXPORT_MACRO)
+#undef TAO_EXPORT_MACRO
+#endif
+#define TAO_EXPORT_MACRO TAO_PI_Export
+
+// TAO_IDL - Generated from
+// be\be_visitor_module/module_ch.cpp:49
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace PortableInterceptor
+{
+
+ // TAO_IDL - Generated from
+ // be\be_interface.cpp:646
+
+#if !defined (_PORTABLEINTERCEPTOR_POLICYFACTORY__VAR_OUT_CH_)
+#define _PORTABLEINTERCEPTOR_POLICYFACTORY__VAR_OUT_CH_
+
+ class PolicyFactory;
+ typedef PolicyFactory *PolicyFactory_ptr;
+
+ typedef
+ TAO_Objref_Var_T<
+ PolicyFactory
+ >
+ PolicyFactory_var;
+
+ typedef
+ TAO_Objref_Out_T<
+ PolicyFactory
+ >
+ PolicyFactory_out;
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:54
+
+#if !defined (_PORTABLEINTERCEPTOR_POLICYFACTORY_CH_)
+#define _PORTABLEINTERCEPTOR_POLICYFACTORY_CH_
+
+ class TAO_PI_Export PolicyFactory
+ : public virtual ::CORBA::Object
+ {
+ public:
+ typedef PolicyFactory_ptr _ptr_type;
+ typedef PolicyFactory_var _var_type;
+
+ // The static operations.
+ static PolicyFactory_ptr _duplicate (PolicyFactory_ptr obj);
+
+ static void _tao_release (PolicyFactory_ptr obj);
+
+ static PolicyFactory_ptr _narrow (
+ ::CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static PolicyFactory_ptr _unchecked_narrow (
+ ::CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static PolicyFactory_ptr _nil (void)
+ {
+ return static_cast<PolicyFactory_ptr> (0);
+ }
+
+
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual ::CORBA::Policy_ptr create_policy (
+ ::CORBA::PolicyType type,
+ const ::CORBA::Any & value
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ ::CORBA::SystemException,
+ ::CORBA::PolicyError
+ )) = 0;
+
+ // Hand-crafted addition.
+ virtual ::CORBA::Policy_ptr _create_policy (
+ CORBA::PolicyType type
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ , CORBA::PolicyError
+ ));
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:210
+
+ virtual ::CORBA::Boolean _is_a (
+ const char *type_id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ virtual const char* _interface_repository_id (void) const;
+ virtual ::CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+
+ protected:
+ // Abstract or local interface only.
+ PolicyFactory (void);
+
+ virtual ~PolicyFactory (void);
+
+ private:
+ // Private and unimplemented for concrete interfaces.
+ PolicyFactory (const PolicyFactory &);
+
+ void operator= (const PolicyFactory &);
+ };
+
+#endif /* end #if !defined */
+
+// TAO_IDL - Generated from
+// be\be_visitor_module/module_ch.cpp:78
+
+} // module PortableInterceptor
+
+// TAO_IDL - Generated from
+// be\be_visitor_traits.cpp:61
+
+// Traits specializations.
+namespace TAO
+{
+
+#if !defined (_PORTABLEINTERCEPTOR_POLICYFACTORY__TRAITS_)
+#define _PORTABLEINTERCEPTOR_POLICYFACTORY__TRAITS_
+
+ template<>
+ struct TAO_PI_Export Objref_Traits< ::PortableInterceptor::PolicyFactory>
+ {
+ static ::PortableInterceptor::PolicyFactory_ptr duplicate (
+ ::PortableInterceptor::PolicyFactory_ptr
+ );
+ static void release (
+ ::PortableInterceptor::PolicyFactory_ptr
+ );
+ static ::PortableInterceptor::PolicyFactory_ptr nil (void);
+ static ::CORBA::Boolean marshal (
+ ::PortableInterceptor::PolicyFactory_ptr p,
+ TAO_OutputCDR & cdr
+ );
+ };
+
+#endif /* end #if !defined */
+}
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:1040
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* ifndef */
+
+
diff --git a/TAO/tao/PI/PolicyFactoryS.h b/TAO/tao/PI/PolicyFactoryS.h
new file mode 100644
index 00000000000..17b1360599e
--- /dev/null
+++ b/TAO/tao/PI/PolicyFactoryS.h
@@ -0,0 +1,28 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// Skeleton file generation suppressed with command line option -SS
diff --git a/TAO/tao/PI/PolicyFactory_Loader.cpp b/TAO/tao/PI/PolicyFactory_Loader.cpp
new file mode 100644
index 00000000000..3b8e49f062c
--- /dev/null
+++ b/TAO/tao/PI/PolicyFactory_Loader.cpp
@@ -0,0 +1,50 @@
+/* -*- C++ -*- */
+
+// =================================================================
+/**
+ * @file PolicyFactory_Loader.cpp
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ *
+ */
+// =================================================================
+
+#include "tao/PI/PolicyFactory_Loader.h"
+#include "tao/PI/PolicyFactory_Registry.h"
+
+#include "tao/ORB.h"
+#include "tao/debug.h"
+
+ACE_RCSID (PI,
+ PolicyFactory_Loader,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO::PolicyFactory_Registry_Adapter*
+TAO_PolicyFactory_Loader::create (void)
+{
+ TAO::PolicyFactory_Registry_Adapter* obj = 0;
+ ACE_NEW_RETURN (obj,
+ TAO_PolicyFactory_Registry,
+ 0);
+ return obj;
+}
+
+int
+TAO_PolicyFactory_Loader::Initializer (void)
+{
+ return ACE_Service_Config::process_directive (ace_svc_desc_TAO_PolicyFactory_Loader);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DEFINE (TAO_PolicyFactory_Loader,
+ ACE_TEXT ("PolicyFactory_Loader"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (TAO_PolicyFactory_Loader),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0)
+ACE_FACTORY_DEFINE (TAO_PI, TAO_PolicyFactory_Loader)
diff --git a/TAO/tao/PI/PolicyFactory_Loader.h b/TAO/tao/PI/PolicyFactory_Loader.h
new file mode 100644
index 00000000000..a25c378676e
--- /dev/null
+++ b/TAO/tao/PI/PolicyFactory_Loader.h
@@ -0,0 +1,52 @@
+// -*- C++ -*-
+
+
+//=============================================================================
+/**
+ * @file PolicyFactory_Loader.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+
+#ifndef TAO_POLICYFACTORY_LOADER_H
+#define TAO_POLICYFACTORY_LOADER_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/PI/pi_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PolicyFactory_Registry_Factory.h"
+#include "ace/Service_Config.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_PI_Export TAO_PolicyFactory_Loader
+ : public TAO_PolicyFactory_Registry_Factory
+{
+public:
+ /// Creates a Codec factory and returns it.
+ virtual TAO::PolicyFactory_Registry_Adapter* create (void);
+
+ /// Used to force the initialization of the ORB code.
+ static int Initializer (void);
+};
+
+static int
+TAO_Requires_PolicyFactory_Initializer = TAO_PolicyFactory_Loader::Initializer ();
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE (TAO_PolicyFactory_Loader)
+ACE_FACTORY_DECLARE (TAO_PI, TAO_PolicyFactory_Loader)
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_POLICYFACTORY_LOADER_H */
diff --git a/TAO/tao/PI/PolicyFactory_Registry.cpp b/TAO/tao/PI/PolicyFactory_Registry.cpp
new file mode 100644
index 00000000000..f91af3df5da
--- /dev/null
+++ b/TAO/tao/PI/PolicyFactory_Registry.cpp
@@ -0,0 +1,123 @@
+#include "tao/PI/PolicyFactory_Registry.h"
+#include "tao/PI/PolicyFactoryC.h"
+#include "tao/ORB_Constants.h"
+#include "tao/SystemException.h"
+#include "tao/PolicyC.h"
+
+ACE_RCSID (PI,
+ PolicyFactory_Registry,
+ "$Id$")
+
+
+// ****************************************************************
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_PolicyFactory_Registry::TAO_PolicyFactory_Registry (void)
+ : factories_ (TAO_DEFAULT_POLICY_FACTORY_REGISTRY_SIZE)
+{
+}
+
+TAO_PolicyFactory_Registry::~TAO_PolicyFactory_Registry (void)
+{
+ const TABLE::iterator end (this->factories_.end ());
+
+ for (TABLE::iterator i = this->factories_.begin (); i != end; ++i)
+ {
+ ::CORBA::release ((*i).int_id_);
+ }
+
+ this->factories_.close ();
+}
+
+void
+TAO_PolicyFactory_Registry::register_policy_factory (
+ CORBA::PolicyType type,
+ PortableInterceptor::PolicyFactory_ptr policy_factory
+ ACE_ENV_ARG_DECL)
+{
+ if (CORBA::is_nil (policy_factory))
+ {
+ ACE_THROW (CORBA::BAD_PARAM (
+ CORBA::SystemException::_tao_minor_code (
+ 0,
+ EINVAL),
+ CORBA::COMPLETED_NO));
+ }
+
+ PortableInterceptor::PolicyFactory_ptr factory =
+ PortableInterceptor::PolicyFactory::_duplicate (policy_factory);
+
+ const int result = this->factories_.bind (type,
+ factory);
+
+ if (result != 0)
+ {
+ // Release the duplicated factory to prevent a memory leak
+ ::CORBA::release (factory);
+
+ if (result == 1)
+ {
+ // PolicyFactory of given type already exists.
+ ACE_THROW (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 16,
+ CORBA::COMPLETED_NO));
+ }
+ else
+ {
+ // Could not add PolicyFactory due to internal bind failures.
+ ACE_THROW (CORBA::INTERNAL ());
+ }
+ }
+}
+
+CORBA::Policy_ptr
+TAO_PolicyFactory_Registry::create_policy (CORBA::PolicyType type,
+ const CORBA::Any &value
+ ACE_ENV_ARG_DECL)
+{
+ PortableInterceptor::PolicyFactory_ptr policy_factory =
+ PortableInterceptor::PolicyFactory::_nil ();
+
+ if (this->factories_.find (type, policy_factory) == -1)
+ {
+ // Policy factory corresponding to given policy type does not
+ // exist in policy factory map.
+ ACE_THROW_RETURN (
+ CORBA::PolicyError (CORBA::BAD_POLICY_TYPE), // @@ Right exception?
+ CORBA::Policy::_nil ());
+ }
+
+ return policy_factory->create_policy (type,
+ value
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::Policy_ptr
+TAO_PolicyFactory_Registry::_create_policy (CORBA::PolicyType type
+ ACE_ENV_ARG_DECL)
+{
+ PortableInterceptor::PolicyFactory_ptr policy_factory =
+ PortableInterceptor::PolicyFactory::_nil ();
+
+ if (this->factories_.find (type,
+ policy_factory) == -1)
+ {
+ // Policy factory corresponding to given policy type does not
+ // exist in policy factory map.
+ ACE_THROW_RETURN (
+ CORBA::PolicyError (CORBA::BAD_POLICY_TYPE), // @@ Right exception?
+ CORBA::Policy::_nil ());
+ }
+
+ return policy_factory->_create_policy (type
+ ACE_ENV_ARG_PARAMETER);
+}
+
+bool
+TAO_PolicyFactory_Registry::factory_exists (CORBA::PolicyType & type) const
+{
+ return (this->factories_.find (type) == 0);
+}
+
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PI/PolicyFactory_Registry.h b/TAO/tao/PI/PolicyFactory_Registry.h
new file mode 100644
index 00000000000..882f386c70c
--- /dev/null
+++ b/TAO/tao/PI/PolicyFactory_Registry.h
@@ -0,0 +1,102 @@
+// -*- C++ -*-
+
+// ===================================================================
+/**
+ * @file PolicyFactory_Registry.h
+ *
+ * $Id$
+ *
+ * @author Ossama Othman <ossama@dre.vanderbilt.edu>
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+// ===================================================================
+
+#ifndef TAO_POLICY_FACTORY_REGISTRY_H
+#define TAO_POLICY_FACTORY_REGISTRY_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Basic_Types.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Basic_Types.h"
+#include "tao/PolicyFactory_Registry_Adapter.h"
+#include "ace/Map_Manager.h"
+#include "ace/Null_Mutex.h"
+#include "ace/CORBA_macros.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_PolicyFactory_Registry
+ *
+ * @brief ORB-specific PortableInterceptor::PolicyFactory registry.
+ *
+ * ORB-specific registry that contains all portable interceptor
+ * policy factories.
+ */
+class TAO_PolicyFactory_Registry
+ : public TAO::PolicyFactory_Registry_Adapter
+{
+public:
+
+ /**
+ * The type of table that maps policy type to policy factory.
+ *
+ * @note
+ * An ACE_Null_Mutex is used for this type since policy factories
+ * are only registered when CORBA::ORB_init() is called, at which a
+ * point a lock has already been acquired. In short, the table is
+ * only modified during ORB bootstrap-time.
+ */
+ typedef ACE_Map_Manager<CORBA::PolicyType,
+ PortableInterceptor::PolicyFactory_ptr,
+ ACE_Null_Mutex>
+ TABLE;
+
+public:
+
+ /// Constructor
+ TAO_PolicyFactory_Registry (void);
+
+ /// Destructor. Releases duplicated PolicyFactory references.
+ ~TAO_PolicyFactory_Registry (void);
+
+ /// Register a PolicyFactory with the underlying PolicyFactory
+ /// sequence. This method should only be called during ORB
+ /// initialization.
+ void register_policy_factory (
+ CORBA::PolicyType type,
+ PortableInterceptor::PolicyFactory_ptr policy_factory
+ ACE_ENV_ARG_DECL);
+
+ /// Construct a policy of the given type with the information
+ /// contained in the CORBA::Any @a value.
+ CORBA::Policy_ptr create_policy (CORBA::PolicyType type,
+ const CORBA::Any &value
+ ACE_ENV_ARG_DECL);
+
+ /// Create an empty policy, usually to be filled in later by
+ /// demarshaling.
+ CORBA::Policy_ptr _create_policy (CORBA::PolicyType type
+ ACE_ENV_ARG_DECL);
+
+ /// Check if a @c PolicyFactory corresponding to the given type,
+ /// exists.
+ bool factory_exists (CORBA::PolicyType & type) const;
+
+private:
+
+ /// The table that maps policy type to policy factory.
+ TABLE factories_;
+
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_POLICY_FACTORY_REGISTRY_H */
diff --git a/TAO/tao/PI/ProcessingModePolicy.cpp b/TAO/tao/PI/ProcessingModePolicy.cpp
new file mode 100644
index 00000000000..9f2feccfe82
--- /dev/null
+++ b/TAO/tao/PI/ProcessingModePolicy.cpp
@@ -0,0 +1,59 @@
+// $Id$
+
+#include "tao/PI/ProcessingModePolicy.h"
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+#include "tao/PortableInterceptorC.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_RCSID (tao,
+ ProcessingModePolicy,
+ "$Id$")
+
+// Should this all be wrapped in #if (TAO_HAS_MINIMUM_POA == 0)?
+
+TAO_ProcessingModePolicy::TAO_ProcessingModePolicy
+ (PortableInterceptor::ProcessingMode mode)
+ : processing_mode_ (mode)
+{
+}
+
+CORBA::Policy_ptr
+TAO_ProcessingModePolicy::copy (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ TAO_ProcessingModePolicy *copy = 0;
+ ACE_NEW_THROW_EX (copy,
+ TAO_ProcessingModePolicy (this->processing_mode_),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+
+ return copy;
+}
+
+void
+TAO_ProcessingModePolicy::destroy (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+}
+
+PortableInterceptor::ProcessingMode
+TAO_ProcessingModePolicy::processing_mode (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return processing_mode_;
+}
+
+CORBA::PolicyType
+TAO_ProcessingModePolicy::policy_type (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return PortableInterceptor::PROCESSING_MODE_POLICY_TYPE;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+
diff --git a/TAO/tao/PI/ProcessingModePolicy.h b/TAO/tao/PI/ProcessingModePolicy.h
new file mode 100644
index 00000000000..fe2c82462bf
--- /dev/null
+++ b/TAO/tao/PI/ProcessingModePolicy.h
@@ -0,0 +1,72 @@
+/* -*- C++ -*- */
+//=============================================================================
+/**
+ * @file ProcessingModePolicy.h
+ *
+ * $Id$
+ *
+ * @author Tim Bradley (bradley_t@ociweb.com)
+ */
+//=============================================================================
+
+#ifndef TAO_PROCESSING_MODE_POLICY_H
+#define TAO_PROCESSING_MODE_POLICY_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+#include "tao/PI/pi_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/LocalObject.h"
+#include "tao/PI/ProcessingModePolicyC.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_ProcessingModePolicy
+ *
+ * @brief Implementation class for Portable Interceptor ProcessingModePolicy.
+ *
+ * This policy is used to specify which kinds of requests (collocated vs.
+ * remote) should (or should not) cause a Portable Interceptor to be used.
+ */
+
+class TAO_PI_Export TAO_ProcessingModePolicy
+ : public PortableInterceptor::ProcessingModePolicy,
+ public TAO_Local_RefCounted_Object
+{
+public:
+ /// Constructor.
+ TAO_ProcessingModePolicy (PortableInterceptor::ProcessingMode mode);
+
+ virtual PortableInterceptor::ProcessingMode processing_mode
+ (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual CORBA::PolicyType policy_type (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual CORBA::Policy_ptr copy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual void destroy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+private:
+ /// The attribute
+ PortableInterceptor::ProcessingMode processing_mode_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_PROCESSING_MODE_POLICY_H */
diff --git a/TAO/tao/PI/ProcessingModePolicy.pidl b/TAO/tao/PI/ProcessingModePolicy.pidl
new file mode 100644
index 00000000000..aa1f2d9b71e
--- /dev/null
+++ b/TAO/tao/PI/ProcessingModePolicy.pidl
@@ -0,0 +1,42 @@
+/**
+ * @file ProcessingModePolicy.pidl
+ *
+ * $Id$
+ *
+ * @brief Pre-compiled IDL source for the ProcessingModePolicy within
+ * the PortableInterceptor module.
+ *
+ * tao_idl \
+ * -o orig -Gp -Gd -Ge 1 -GT -GA \
+ * -Wb,export_include="tao/TAO_Export.h" \
+ * -Wb,export_macro=TAO_Export \
+ * -Wb,pre_include="ace/pre.h" \
+ * -Wb,post_include="ace/post.h" \
+ * ProcessingModePolicy.pidl
+ */
+
+#ifndef _PROCESSING_MODE_POLICY_PIDL_
+#define _PROCESSING_MODE_POLICY_PIDL_
+
+#include "tao/Policy.pidl"
+
+module PortableInterceptor
+{
+
+ // ProcessingMode Policy (default = LOCAL_AND_REMOTE)
+ typedef short ProcessingMode;
+ const ProcessingMode LOCAL_AND_REMOTE = 0;
+ const ProcessingMode REMOTE_ONLY = 1;
+ const ProcessingMode LOCAL_ONLY = 2;
+
+ /// @todo - Need to get the proper Policy Type code from OMG
+ const CORBA::PolicyType PROCESSING_MODE_POLICY_TYPE = 100;
+
+ local interface ProcessingModePolicy : CORBA::Policy
+ {
+ readonly attribute ProcessingMode processing_mode;
+ };
+
+};
+
+#endif /* _PROCESSING_MODE_POLICY_PIDL_ */
diff --git a/TAO/tao/PI/RequestInfo.pidl b/TAO/tao/PI/RequestInfo.pidl
new file mode 100644
index 00000000000..b26d17b1ca5
--- /dev/null
+++ b/TAO/tao/PI/RequestInfo.pidl
@@ -0,0 +1,54 @@
+// -*- IDL -*-
+
+/**
+ * @file RequestInfo.pidl
+ *
+ * $Id$
+ *
+ * @brief Pre-compiled RequestInfo
+ *
+ * This file was used to generate the code in RequestInfoC.*
+ * The command used to generate code is:
+ *
+ * tao_idl
+ * -o orig -Gp -Gd -Ge 1 -GA -SS -Sci
+ * -Wb,export_include="tao/TAO_Export.h"
+ * -Wb,export_macro=TAO_Export
+ * -Wb,pre_include="ace/pre.h"
+ * -Wb,post_include="ace/post.h"
+ * RequestInfo.pidl
+ */
+
+#ifndef _REQUESTINFO_PIDL_
+#define _REQUESTINFO_PIDL_
+
+#include "tao/PI_Forward.pidl"
+#include "tao/AnyTypeCode/Dynamic.pidl"
+#include "tao/Messaging_SyncScope.pidl"
+#include "tao/PI/InvalidSlot.pidl"
+#include "tao/IOP_IOR.pidl"
+
+module PortableInterceptor {
+
+ typeprefix PortableInterceptor "omg.org";
+
+ local interface RequestInfo
+ {
+ readonly attribute unsigned long request_id;
+ readonly attribute string operation;
+ readonly attribute Dynamic::ParameterList arguments;
+ readonly attribute Dynamic::ExceptionList exceptions;
+ readonly attribute Dynamic::ContextList contexts;
+ readonly attribute Dynamic::RequestContext operation_context;
+ readonly attribute any result;
+ readonly attribute boolean response_expected;
+ readonly attribute Messaging::SyncScope sync_scope;
+ readonly attribute ReplyStatus reply_status;
+ readonly attribute Object forward_reference;
+ any get_slot (in SlotId id) raises (InvalidSlot);
+ IOP::ServiceContext get_request_service_context (in IOP::ServiceId id);
+ IOP::ServiceContext get_reply_service_context (in IOP::ServiceId id);
+ };
+};
+
+#endif /* _REQUESTINFO_PIDL_ */
diff --git a/TAO/tao/PI/RequestInfo_Util.cpp b/TAO/tao/PI/RequestInfo_Util.cpp
new file mode 100644
index 00000000000..65d42175dd2
--- /dev/null
+++ b/TAO/tao/PI/RequestInfo_Util.cpp
@@ -0,0 +1,113 @@
+// -*- C++ -*-
+//
+// $Id$
+
+#include "tao/PI/RequestInfo_Util.h"
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+#include "tao/AnyTypeCode/TypeCode.h"
+#include "tao/AnyTypeCode/DynamicC.h"
+#include "tao/ORB_Constants.h"
+#include "tao/StringSeqC.h"
+#include "tao/SystemException.h"
+
+ACE_RCSID (tao,
+ RequestInfo_Util,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+Dynamic::ParameterList *
+TAO_RequestInfo_Util::make_parameter_list (ACE_ENV_SINGLE_ARG_DECL)
+{
+ Dynamic::ParameterList *parameter_list = 0;
+ ACE_NEW_THROW_EX (parameter_list,
+ Dynamic::ParameterList,
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ 0,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+
+ // No need to do an ACE_CHECK_RETURN. The caller should do that.
+
+ return parameter_list;
+}
+
+Dynamic::ExceptionList *
+TAO_RequestInfo_Util::make_exception_list (ACE_ENV_SINGLE_ARG_DECL)
+{
+ Dynamic::ExceptionList *exception_list = 0;
+ ACE_NEW_THROW_EX (exception_list,
+ Dynamic::ExceptionList,
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ 0,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+
+ // No need to do an ACE_CHECK_RETURN. The caller should do that.
+
+ return exception_list;
+}
+
+Dynamic::ContextList *
+TAO_RequestInfo_Util::make_context_list (ACE_ENV_SINGLE_ARG_DECL)
+{
+ Dynamic::ContextList *context_list = 0;
+ ACE_NEW_THROW_EX (context_list,
+ Dynamic::ContextList,
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ 0,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+
+ // No need to do an ACE_CHECK_RETURN. The caller should do that.
+
+ return context_list;
+}
+
+Dynamic::RequestContext *
+TAO_RequestInfo_Util::make_request_context (ACE_ENV_SINGLE_ARG_DECL)
+{
+ Dynamic::RequestContext *request_context = 0;
+ ACE_NEW_THROW_EX (request_context,
+ Dynamic::RequestContext,
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ 0,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+
+ // No need to do an ACE_CHECK_RETURN. The caller should do that.
+
+ return request_context;
+}
+
+CORBA::Any *
+TAO_RequestInfo_Util::make_any (CORBA::Boolean tk_void_any
+ ACE_ENV_ARG_DECL)
+{
+ CORBA::Any *any = 0;
+ ACE_NEW_THROW_EX (any,
+ CORBA::Any,
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ 0,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (any);
+
+ if (tk_void_any)
+ {
+ any->_tao_set_typecode (CORBA::_tc_void);
+ }
+
+ return any;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif
diff --git a/TAO/tao/PI/RequestInfo_Util.h b/TAO/tao/PI/RequestInfo_Util.h
new file mode 100644
index 00000000000..4d18f4d2309
--- /dev/null
+++ b/TAO/tao/PI/RequestInfo_Util.h
@@ -0,0 +1,91 @@
+// -*- C++ -*-
+
+// ===================================================================
+/**
+ * @file RequestInfo_Util.h
+ *
+ * $Id$
+ *
+ * @author Ossama Othman <ossama@uci.edu>
+ */
+// ===================================================================
+
+#ifndef TAO_REQUEST_INFO_UTIL_H
+#define TAO_REQUEST_INFO_UTIL_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Basic_Types.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/orbconf.h"
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+#include "ace/CORBA_macros.h"
+#include "tao/PI/pi_export.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace CORBA
+{
+ class StringSeq;
+ class Any;
+ class Environment;
+}
+
+namespace Dynamic
+{
+ class ParameterList;
+ class ExceptionList;
+ typedef CORBA::StringSeq ContextList;
+ typedef CORBA::StringSeq RequestContext;
+}
+
+/**
+ * @class TAO_RequestInfo_Util
+ *
+ * @brief Helper class that provides methods useful for both
+ * PortableInterceptor::ClientRequestInfo and
+ * PortableInterceptor::ServerRequestInfo objects.
+ */
+class TAO_PI_Export TAO_RequestInfo_Util
+{
+public:
+
+ /**
+ * @name Factory Methods
+ *
+ * These are methods called by TAO_{Client,Server}RequestInfo and
+ * their subclasses. Rather than having the same factory code in
+ * each subclass, we factor the common code in to this utility
+ * class.
+ */
+ //@{
+ static Dynamic::ParameterList * make_parameter_list (
+ ACE_ENV_SINGLE_ARG_DECL);
+
+ static Dynamic::ExceptionList * make_exception_list (
+ ACE_ENV_SINGLE_ARG_DECL);
+
+ static Dynamic::ContextList * make_context_list (
+ ACE_ENV_SINGLE_ARG_DECL);
+
+ static Dynamic::RequestContext * make_request_context (
+ ACE_ENV_SINGLE_ARG_DECL);
+
+ static CORBA::Any * make_any (CORBA::Boolean tk_void_any
+ ACE_ENV_ARG_DECL);
+ //@}
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_REQUEST_INFO_UTIL_H */
diff --git a/TAO/tao/PI/TAO_PI.pc.in b/TAO/tao/PI/TAO_PI.pc.in
new file mode 100644
index 00000000000..57cea13585c
--- /dev/null
+++ b/TAO/tao/PI/TAO_PI.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: TAO_PI
+Description: TAO PI Library
+Requires: TAO_CodecFactory, TAO_AnyTypeCode, TAO
+Version: @VERSION@
+Libs: -L${libdir} -lTAO_PI
+Cflags: -I${includedir}
diff --git a/TAO/tao/PI/diff/PolicyFactory.diff b/TAO/tao/PI/diff/PolicyFactory.diff
new file mode 100644
index 00000000000..dd03c58c39b
--- /dev/null
+++ b/TAO/tao/PI/diff/PolicyFactory.diff
@@ -0,0 +1,164 @@
+--- orig/PolicyFactoryC.h 2005-04-23 21:12:35.022166400 +0200
++++ PolicyFactoryC.h 2005-04-15 13:04:39.000000000 +0200
+@@ -1,6 +1,6 @@
+ // -*- C++ -*-
+ //
+-// $Id$
++// $Id$
+
+ // **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+ // TAO and the TAO IDL Compiler have been developed by:
+@@ -26,7 +26,7 @@
+ // http://www.cs.wustl.edu/~schmidt/TAO.html
+
+ // TAO_IDL - Generated from
+-// be\be_codegen.cpp:153
++// .\be\be_codegen.cpp:153
+
+ #ifndef _TAO_IDL_ORIG_POLICYFACTORYC_H_
+ #define _TAO_IDL_ORIG_POLICYFACTORYC_H_
+@@ -66,13 +66,13 @@
+ #endif /* __BORLANDC__ */
+
+ // TAO_IDL - Generated from
+-// be\be_visitor_module/module_ch.cpp:48
++// c:\ace\latest\ace_wrappers\tao\tao_idl\be\be_visitor_module/module_ch.cpp:48
+
+ namespace PortableInterceptor
+ {
+
+ // TAO_IDL - Generated from
+- // be\be_interface.cpp:598
++ // .\be\be_interface.cpp:598
+
+ #if !defined (_PORTABLEINTERCEPTOR_POLICYFACTORY__VAR_OUT_CH_)
+ #define _PORTABLEINTERCEPTOR_POLICYFACTORY__VAR_OUT_CH_
+@@ -95,7 +95,7 @@
+ #endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+- // be\be_visitor_interface/interface_ch.cpp:54
++ // c:\ace\latest\ace_wrappers\tao\tao_idl\be\be_visitor_interface/interface_ch.cpp:54
+
+ #if !defined (_PORTABLEINTERCEPTOR_POLICYFACTORY_CH_)
+ #define _PORTABLEINTERCEPTOR_POLICYFACTORY_CH_
+@@ -130,7 +130,7 @@
+ static void _tao_any_destructor (void *);
+
+ // TAO_IDL - Generated from
+- // be\be_visitor_operation/operation_ch.cpp:46
++ // c:\ace\latest\ace_wrappers\tao\tao_idl\be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual ::CORBA::Policy_ptr create_policy (
+ ::CORBA::PolicyType type,
+@@ -142,8 +142,18 @@
+ ::CORBA::PolicyError
+ )) = 0;
+
++ // Hand-crafted addition.
++ virtual ::CORBA::Policy_ptr _create_policy (
++ CORBA::PolicyType type
++ ACE_ENV_ARG_DECL_WITH_DEFAULTS
++ )
++ ACE_THROW_SPEC ((
++ CORBA::SystemException
++ , CORBA::PolicyError
++ ));
++
+ // TAO_IDL - Generated from
+- // be\be_visitor_interface/interface_ch.cpp:210
++ // c:\ace\latest\ace_wrappers\tao\tao_idl\be\be_visitor_interface/interface_ch.cpp:210
+
+ virtual CORBA::Boolean _is_a (
+ const char *type_id
+@@ -169,17 +179,17 @@
+ #endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+- // be\be_visitor_typecode/typecode_decl.cpp:44
++ // c:\ace\latest\ace_wrappers\tao\tao_idl\be\be_visitor_typecode/typecode_decl.cpp:44
+
+ extern TAO_Export ::CORBA::TypeCode_ptr const _tc_PolicyFactory;
+
+ // TAO_IDL - Generated from
+-// be\be_visitor_module/module_ch.cpp:66
++// c:\ace\latest\ace_wrappers\tao\tao_idl\be\be_visitor_module/module_ch.cpp:66
+
+ } // module PortableInterceptor
+
+ // TAO_IDL - Generated from
+-// be\be_visitor_traits.cpp:61
++// .\be\be_visitor_traits.cpp:61
+
+ // Traits specializations.
+ namespace TAO
+@@ -208,14 +218,14 @@
+ }
+
+ // TAO_IDL - Generated from
+-// be\be_visitor_interface/any_op_ch.cpp:52
++// c:\ace\latest\ace_wrappers\tao\tao_idl\be\be_visitor_interface/any_op_ch.cpp:52
+
+ TAO_Export void operator<<= (CORBA::Any &, PortableInterceptor::PolicyFactory_ptr); // copying
+ TAO_Export void operator<<= (CORBA::Any &, PortableInterceptor::PolicyFactory_ptr *); // non-copying
+ TAO_Export CORBA::Boolean operator>>= (const CORBA::Any &, PortableInterceptor::PolicyFactory_ptr &);
+
+ // TAO_IDL - Generated from
+-// be\be_codegen.cpp:955
++// .\be\be_codegen.cpp:955
+
+ #if defined(_MSC_VER)
+ #pragma warning(pop)
+--- orig/PolicyFactoryC.cpp 2005-04-23 21:12:35.022166400 +0200
++++ PolicyFactoryC.cpp 2005-04-15 13:04:39.000000000 +0200
+@@ -1,6 +1,6 @@
+ // -*- C++ -*-
+ //
+-// $Id$
++// $Id$
+
+ // **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+ // TAO and the TAO IDL Compiler have been developed by:
+@@ -26,7 +26,7 @@
+ // http://www.cs.wustl.edu/~schmidt/TAO.html
+
+ // TAO_IDL - Generated from
+-// be\be_codegen.cpp:291
++// .\be\be_codegen.cpp:291
+
+
+ #include "PolicyFactoryC.h"
+@@ -38,7 +38,7 @@
+ #endif /* __BORLANDC__ */
+
+ // TAO_IDL - Generated from
+-// be\be_visitor_arg_traits.cpp:69
++// .\be\be_visitor_arg_traits.cpp:69
+
+ // Arg traits specializations.
+ namespace TAO
+@@ -47,7 +47,7 @@
+
+
+ // TAO_IDL - Generated from
+-// be\be_visitor_interface/interface_cs.cpp:60
++// c:\ace\latest\ace_wrappers\tao\tao_idl\be\be_visitor_interface/interface_cs.cpp:60
+
+ // Traits specializations for PortableInterceptor::PolicyFactory.
+
+@@ -186,3 +186,15 @@
+ {
+ return false;
+ }
++
++// Hand-crafted.
++::CORBA::Policy_ptr
++PortableInterceptor::PolicyFactory::_create_policy (CORBA::PolicyType
++ ACE_ENV_ARG_DECL)
++ ACE_THROW_SPEC ((CORBA::SystemException,
++ CORBA::PolicyError))
++{
++ ACE_THROW_RETURN (CORBA::PolicyError (CORBA::BAD_POLICY_TYPE),
++ CORBA::Policy::_nil ());
++}
++
diff --git a/TAO/tao/PI/pi_export.h b/TAO/tao/PI/pi_export.h
new file mode 100644
index 00000000000..73f09e95644
--- /dev/null
+++ b/TAO/tao/PI/pi_export.h
@@ -0,0 +1,40 @@
+
+// -*- C++ -*-
+// $Id$
+// Definition for Win32 Export directives.
+// This file is generated automatically by generate_export_file.pl
+// ------------------------------
+#ifndef TAO_PI_EXPORT_H
+#define TAO_PI_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if defined (TAO_AS_STATIC_LIBS)
+# if !defined (TAO_PI_HAS_DLL)
+# define TAO_PI_HAS_DLL 0
+# endif /* ! TAO_PI_HAS_DLL */
+#else
+# if !defined (TAO_PI_HAS_DLL)
+# define TAO_PI_HAS_DLL 1
+# endif /* ! TAO_PI_HAS_DLL */
+#endif
+
+#if defined (TAO_PI_HAS_DLL) && (TAO_PI_HAS_DLL == 1)
+# if defined (TAO_PI_BUILD_DLL)
+# define TAO_PI_Export ACE_Proper_Export_Flag
+# define TAO_PI_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# define TAO_PI_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# else /* TAO_PI_BUILD_DLL */
+# define TAO_PI_Export ACE_Proper_Import_Flag
+# define TAO_PI_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# define TAO_PI_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# endif /* TAO_PI_BUILD_DLL */
+#else /* TAO_PI_HAS_DLL == 1 */
+# define TAO_PI_Export
+# define TAO_PI_SINGLETON_DECLARATION(T)
+# define TAO_PI_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+#endif /* TAO_PI_HAS_DLL == 1 */
+
+#endif /* TAO_PI_EXPORT_H */
+
+// End of auto generated file.
diff --git a/TAO/tao/PI_Forward.pidl b/TAO/tao/PI_Forward.pidl
new file mode 100644
index 00000000000..556d23a7a4c
--- /dev/null
+++ b/TAO/tao/PI_Forward.pidl
@@ -0,0 +1,53 @@
+// -*- IDL -*-
+
+/**
+ * @file PI_Forward.pidl
+ *
+ * $Id$
+ *
+ * @brief Pre-compiled IDL source for typedefs in the
+ * PortableInterceptor module.
+ *
+ * This file is used to generate PI_Forward.{h,cpp},
+ * using the following command:
+ *
+ * tao_idl.exe
+ * -o orig -Gp -Gd -Ge 1 -Sci
+ * -Wb,export_macro=TAO_Export
+ * -Wb,export_include=tao/TAO_Export.h
+ * -Wb,pre_include="ace/pre.h"
+ * -Wb,post_include="ace/post.h"
+ * PI_Forward.pidl
+ *
+ * and then:
+ *
+ * cp orig/PI_ForwardC.{h,cpp} .
+ *
+ * The code left in PI_ForwardC.{h,cpp}
+ *
+ */
+
+// File: PI_Forward.pidl
+
+#ifndef _PI_FORWARD_IDL_
+#define _PI_FORWARD_IDL_
+
+#include "tao/OctetSeq.pidl"
+#include "tao/StringSeq.pidl"
+
+module PortableInterceptor
+{
+ typeprefix PortableInterceptor "omg.org";
+
+ typedef string ServerId;
+ typedef string ORBId;
+ typedef CORBA::StringSeq AdapterName;
+ typedef CORBA::OctetSeq ObjectId;
+ typedef string AdapterManagerId;
+ typedef short AdapterState;
+ typedef unsigned long SlotId;
+ typedef short ReplyStatus;
+
+};
+
+#endif /* _PI_FORWARD_IDL_ */
diff --git a/TAO/tao/PI_Server.mpc b/TAO/tao/PI_Server.mpc
new file mode 100644
index 00000000000..849624af7a8
--- /dev/null
+++ b/TAO/tao/PI_Server.mpc
@@ -0,0 +1,42 @@
+//$Id$
+project : taolib, pi, portableserver, core, tao_versioning_idl_defaults {
+ sharedname = TAO_PI_Server
+ dynamicflags = TAO_PI_SERVER_BUILD_DLL
+
+ Source_Files {
+ PI_Server
+ }
+
+ Header_Files {
+ PI_Server
+ }
+
+ Inline_Files {
+ PI_Server
+ }
+
+ Template_Files {
+ PI_Server
+ }
+
+ Resource_Files {
+ PI_Server
+ }
+
+ PIDL_Files {
+ PI_Server
+ }
+
+ IDL_Files {
+ idlflags += -Sci -SS -GA -Gp -Gd -Ge 1 -Sc -Sorb -Sal \
+ -Wb,export_macro=TAO_PI_Server_Export \
+ -Wb,export_include=tao/PI_Server/pi_server_export.h \
+ -o PI_Server
+ idlflags -= -Sa -St
+ PI_Server/ServerRequestInfo.pidl
+ }
+
+ Pkgconfig_Files {
+ PI_Server/TAO_PI_Server.pc.in
+ }
+}
diff --git a/TAO/tao/PI_Server/PICurrent_Guard.cpp b/TAO/tao/PI_Server/PICurrent_Guard.cpp
new file mode 100644
index 00000000000..fd5fb2862b9
--- /dev/null
+++ b/TAO/tao/PI_Server/PICurrent_Guard.cpp
@@ -0,0 +1,72 @@
+#include "tao/PI_Server/PICurrent_Guard.h"
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+
+ACE_RCSID (PortableServer,
+ PICurrent_Guard,
+ "$Id$")
+
+
+#include "tao/ORB_Core.h"
+#include "tao/TAO_Server_Request.h"
+#include "tao/PI/PICurrent.h"
+#include "tao/PI/PICurrent_Impl.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO::PICurrent_Guard::PICurrent_Guard (TAO_ServerRequest &server_request,
+ bool tsc_to_rsc)
+ : src_ (0),
+ dest_ (0)
+{
+ // This constructor is used on the server side.
+
+ // Retrieve the thread scope current (no TSS access incurred yet).
+ CORBA::Object_ptr pi_current_obj =
+ server_request.orb_core ()->pi_current ();
+
+ TAO::PICurrent *pi_current =
+ dynamic_cast <TAO::PICurrent*> (pi_current_obj);
+
+ // If the slot count is zero, there is nothing to copy. Prevent any
+ // copying (and hence TSS accesses) from occurring.
+ if (pi_current != 0 && pi_current->slot_count () != 0)
+ {
+ // Retrieve the request scope current.
+ PICurrent_Impl * rsc = server_request.rs_pi_current ();
+
+ // Retrieve the thread scope current.
+ PICurrent_Impl * tsc = pi_current->tsc ();
+
+ if (tsc_to_rsc)
+ {
+ // TSC to RSC copy.
+ // Occurs after receive_request() interception point and
+ // upcall.
+ this->src_ = tsc;
+ this->dest_ = rsc;
+ }
+ else
+ {
+ // RSC to TSC copy.
+ // Occurs after receive_request_service_contexts()
+ // interception point.
+ this->src_ = rsc;
+ this->dest_ = tsc;
+ }
+ }
+}
+
+TAO::PICurrent_Guard::~PICurrent_Guard (void)
+{
+ if (this->src_ != 0 && this->dest_ != 0
+ && this->src_ != this->dest_)
+ {
+ this->dest_->take_lazy_copy (this->src_);
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
diff --git a/TAO/tao/PI_Server/PICurrent_Guard.h b/TAO/tao/PI_Server/PICurrent_Guard.h
new file mode 100644
index 00000000000..741163ebba1
--- /dev/null
+++ b/TAO/tao/PI_Server/PICurrent_Guard.h
@@ -0,0 +1,96 @@
+// -*- C++ -*-
+
+// ===================================================================
+/**
+ * @file PICurrent_Guard.h
+ *
+ * $Id$
+ *
+ * @author Ossama Othman <ossama@dre.vanderbilt.edu>
+ */
+// ===================================================================
+
+#ifndef TAO_PI_CURRENT_GUARD_H
+#define TAO_PI_CURRENT_GUARD_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/PI_Server/pi_server_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/orbconf.h"
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/// Forward declarations.
+class TAO_ServerRequest;
+
+namespace TAO
+{
+ class PICurrent_Impl;
+
+ /**
+ * @class PICurrent_Guard
+ *
+ * @brief Class used to make copying between request scope current
+ * and thread scope current exception-safe.
+ *
+ * Since copies between the request scope current and thread scope
+ * current must also occur if an exception is thrown, e.g. made
+ * available to the send_exception() interception points, the
+ * "guard" idiom is used to make this action exception-safe.
+ *
+ * @note This Guard class is only used on the server side.
+ */
+ class PICurrent_Guard
+ {
+ public:
+
+ /// Constructor
+ /**
+ * This constructor sets up this guard to copy the data held in a
+ * given PICurrent when transitioning from that PICurrent's scope
+ * to another scope (e.g. request scope to thread scope transition
+ * immediately following receive_request_service_contexts() on
+ * server side).
+ *
+ * @param tsc_to_rsc true when copying TSC slot table to RSC slot
+ * table, i.e. after target operation
+ * completes.
+ */
+ PICurrent_Guard (TAO_ServerRequest &server_request,
+ bool tsc_to_rsc);
+
+ /// Destructor
+ /**
+ * The destructor copies (a logical copy whenever possible) data
+ * held in a given PICurrent when transitioning from one PICurrent
+ * scope to another immediately before any ending interception
+ * points are invoked, and after the starting and intermediate (if
+ * any) interception points are invoked.
+ */
+ ~PICurrent_Guard (void);
+
+ private:
+
+ /// The PICurrent implementation whose slot table will be copied.
+ PICurrent_Impl *src_;
+
+ /// The PICurrent implementation whose slot table will be filled
+ /// with the contents of another PICurrent's slot table.
+ PICurrent_Impl *dest_;
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_PI_CURRENT_GUARD_H */
diff --git a/TAO/tao/PI_Server/PI_Server.cpp b/TAO/tao/PI_Server/PI_Server.cpp
new file mode 100644
index 00000000000..1511cfb1472
--- /dev/null
+++ b/TAO/tao/PI_Server/PI_Server.cpp
@@ -0,0 +1,22 @@
+#include "tao/PI_Server/PI_Server.h"
+#include "tao/PI_Server/PI_Server_Loader.h"
+#include "tao/PI_Server/ServerRequestInterceptor_Factory_Impl.h"
+
+ACE_RCSID (PI_Server,
+ PI_Server,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+int
+TAO_PI_Server_Init::Initializer (void)
+{
+#if TAO_HAS_INTERCEPTORS == 1
+ ACE_Service_Config::process_directive (ace_svc_desc_TAO_ServerRequestInterceptor_Adapter_Factory_Impl);
+#endif /* TAO_HAS_INTERCEPTORS */
+
+ return ACE_Service_Config::process_directive (ace_svc_desc_TAO_PI_Server_Loader);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PI_Server/PI_Server.h b/TAO/tao/PI_Server/PI_Server.h
new file mode 100644
index 00000000000..eed7d6cc8eb
--- /dev/null
+++ b/TAO/tao/PI_Server/PI_Server.h
@@ -0,0 +1,53 @@
+// -*- C++ -*-
+
+// ===================================================================
+/**
+ * @file PI_Server.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+// ===================================================================
+
+#ifndef TAO_PI_SERVER_H
+#define TAO_PI_SERVER_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/PI_Server/pi_server_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Versioned_Namespace.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_PI_Server_Init
+ *
+ */
+class TAO_PI_Server_Export TAO_PI_Server_Init
+{
+public:
+
+ /// Used to force the initialization of the ORB code.
+ static int Initializer (void);
+};
+
+static int
+TAO_Requires_PI_Server_Initializer =
+ TAO_PI_Server_Init::Initializer ();
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#define TAO_PI_SERVER_SAFE_INCLUDE
+#include "tao/PI_Server/ServerRequestInterceptorC.h"
+#include "tao/PI_Server/ServerRequestInfoC.h"
+#undef TAO_PI_SERVER_SAFE_INCLUDE
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_PI_SERVER_H */
diff --git a/TAO/tao/PI_Server/PI_Server_Loader.cpp b/TAO/tao/PI_Server/PI_Server_Loader.cpp
new file mode 100644
index 00000000000..abc2da4613c
--- /dev/null
+++ b/TAO/tao/PI_Server/PI_Server_Loader.cpp
@@ -0,0 +1,87 @@
+
+// $Id$
+
+#include "tao/PI_Server/PI_Server_Loader.h"
+#include "tao/PI_Server/PortableServer_ORBInitializer.h"
+
+#include "tao/debug.h"
+#include "tao/ORB_Core.h"
+#include "tao/ORBInitializer_Registry.h"
+
+ACE_RCSID (PI_Server,
+ PI_Server_Loader,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_PI_Server_Loader::TAO_PI_Server_Loader (void)
+{
+}
+
+TAO_PI_Server_Loader::~TAO_PI_Server_Loader (void)
+{
+
+}
+
+int
+TAO_PI_Server_Loader::init (int,
+ ACE_TCHAR* [])
+{
+ ACE_TRACE ("TAO_PI_Server_Loader::init");
+
+ static bool initialized = false;
+
+ // Only allow initialization once.
+ if (initialized)
+ return 0;
+
+ initialized = true;
+
+ // Register the ORB initializer.
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ /// Register the Messaging ORBInitializer.
+ PortableInterceptor::ORBInitializer_ptr temp_orb_initializer =
+ PortableInterceptor::ORBInitializer::_nil ();
+
+ ACE_NEW_THROW_EX (temp_orb_initializer,
+ TAO_PortableServer_ORBInitializer,
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_TRY_CHECK;
+
+ PortableInterceptor::ORBInitializer_var orb_initializer =
+ temp_orb_initializer;
+
+ PortableInterceptor::register_orb_initializer (orb_initializer.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "Caught exception:");
+ return -1;
+ }
+ ACE_ENDTRY;
+ ACE_CHECK_RETURN (-1);
+
+ return 0;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+/////////////////////////////////////////////////////////////////////
+
+ACE_FACTORY_DEFINE (TAO_PI_Server, TAO_PI_Server_Loader)
+ACE_STATIC_SVC_DEFINE (TAO_PI_Server_Loader,
+ ACE_TEXT ("PI_Server_Loader"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (TAO_PI_Server_Loader),
+ ACE_Service_Type::DELETE_THIS
+ | ACE_Service_Type::DELETE_OBJ,
+ 0)
diff --git a/TAO/tao/PI_Server/PI_Server_Loader.h b/TAO/tao/PI_Server/PI_Server_Loader.h
new file mode 100644
index 00000000000..fb86088ae71
--- /dev/null
+++ b/TAO/tao/PI_Server/PI_Server_Loader.h
@@ -0,0 +1,48 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file PI_Server_Loader.h
+ *
+ * $Id$
+ */
+//=============================================================================
+
+#ifndef TAO_PI_SERVER_LOADER_H
+#define TAO_PI_SERVER_LOADER_H
+#include /**/ "ace/pre.h"
+
+#include "tao/PI_Server/pi_server_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PI/PI.h"
+#include "tao/Versioned_Namespace.h"
+#include "ace/Service_Object.h"
+#include "ace/Service_Config.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_PI_Server_Export TAO_PI_Server_Loader : public ACE_Service_Object
+{
+public:
+ /// Constructor.
+ TAO_PI_Server_Loader (void);
+
+ /// Destructor.
+ virtual ~TAO_PI_Server_Loader (void);
+
+ /// Initialize the PI_Server loader hooks.
+ virtual int init (int argc,
+ ACE_TCHAR* []);
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE_EXPORT (TAO_PI_Server, TAO_PI_Server_Loader)
+ACE_FACTORY_DECLARE (TAO_PI_Server, TAO_PI_Server_Loader)
+
+#include /**/ "ace/post.h"
+#endif /* TAO_PI_SERVER_LOADER_H */
diff --git a/TAO/tao/PI_Server/PI_Server_include.pidl b/TAO/tao/PI_Server/PI_Server_include.pidl
new file mode 100644
index 00000000000..ad7b82138bf
--- /dev/null
+++ b/TAO/tao/PI_Server/PI_Server_include.pidl
@@ -0,0 +1,15 @@
+/**
+ * @file PI_Server_include.pidl
+ *
+ * $Id$
+ *
+ * @brief Include file for use in applications that need PI_Server.pidl.
+ */
+
+#ifndef _PORTABLESERVER_INCLUDE_IDL_
+#define _PORTABLESERVER_INCLUDE_IDL_
+
+///FUZZ: disable check_for_include/
+#include "tao/PI_Server/ServerRequestInterceptor.pidl"
+
+#endif /* _PORTABLESERVER_INCLUDE_IDL_ */
diff --git a/TAO/tao/PI_Server/PI_Server_includeA.h b/TAO/tao/PI_Server/PI_Server_includeA.h
new file mode 100644
index 00000000000..44c20559645
--- /dev/null
+++ b/TAO/tao/PI_Server/PI_Server_includeA.h
@@ -0,0 +1,44 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:390
+
+#ifndef _TAO_IDL_ORIG_PI_SERVER_INCLUDEA_H_
+#define _TAO_IDL_ORIG_PI_SERVER_INCLUDEA_H_
+
+#include /**/ "ace/pre.h"
+
+#include "tao/PI_Server/PI_Server_includeC.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include /**/ "ace/post.h"
+#endif /* ifndef */
+
diff --git a/TAO/tao/PI_Server/PI_Server_includeC.h b/TAO/tao/PI_Server/PI_Server_includeC.h
new file mode 100644
index 00000000000..cca4fe783bd
--- /dev/null
+++ b/TAO/tao/PI_Server/PI_Server_includeC.h
@@ -0,0 +1,56 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:153
+
+#ifndef _TAO_IDL_ORIG_PI_SERVER_INCLUDEC_H_
+#define _TAO_IDL_ORIG_PI_SERVER_INCLUDEC_H_
+
+#include /**/ "ace/pre.h"
+
+
+#include "ace/config-all.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PI_Server/pi_server_export.h"
+
+#include "tao/PI_Server/ServerRequestInterceptorC.h"
+
+// TAO_IDL - Generated from
+// be\be_visitor_traits.cpp:61
+
+// Traits specializations.
+
+#include /**/ "ace/post.h"
+
+#endif /* ifndef */
+
+
diff --git a/TAO/tao/PI_Server/PI_Server_includeS.h b/TAO/tao/PI_Server/PI_Server_includeS.h
new file mode 100644
index 00000000000..dc5cdcf7c2b
--- /dev/null
+++ b/TAO/tao/PI_Server/PI_Server_includeS.h
@@ -0,0 +1,41 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:390
+
+#ifndef _TAO_IDL_ORIG_PORTABLESERVER_INCLUDES_H_
+#define _TAO_IDL_ORIG_PORTABLESERVER_INCLUDES_H_
+
+#include /**/ "ace/pre.h"
+
+#include "tao/PI_Server/ServerRequestInterceptorS.h"
+#include "tao/PI_Server/PI_Server_includeC.h"
+
+#include /**/ "ace/post.h"
+#endif /* ifndef */
+
diff --git a/TAO/tao/PI_Server/Policy_Creator_T.h b/TAO/tao/PI_Server/Policy_Creator_T.h
new file mode 100644
index 00000000000..6b4784fb607
--- /dev/null
+++ b/TAO/tao/PI_Server/Policy_Creator_T.h
@@ -0,0 +1,53 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Policy_Creator_T.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_PORTABLESERVER_POLICY_CREATOR_T_H
+#define TAO_PORTABLESERVER_POLICY_CREATOR_T_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/ORB_Constants.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ template <class POLICYTYPE, typename POLICYVALUE>
+ void create_policy (
+ POLICYTYPE *& policy,
+ POLICYVALUE &value,
+ const CORBA::Any& val
+ ACE_ENV_ARG_DECL)
+ {
+ if ((val >>= value) == 0)
+ ACE_THROW (CORBA::PolicyError (CORBA::BAD_POLICY_VALUE));
+
+ ACE_NEW_THROW_EX (policy,
+ POLICYTYPE (value),
+ CORBA::NO_MEMORY (TAO::VMCID,
+ CORBA::COMPLETED_NO));
+ ACE_CHECK;
+ }
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_PORTABLESERVER_POLICY_CREATOR_T_H */
diff --git a/TAO/tao/PI_Server/PortableServer_ORBInitializer.cpp b/TAO/tao/PI_Server/PortableServer_ORBInitializer.cpp
new file mode 100644
index 00000000000..8534d3cbd23
--- /dev/null
+++ b/TAO/tao/PI_Server/PortableServer_ORBInitializer.cpp
@@ -0,0 +1,111 @@
+// -*- C++ -*-
+
+#include "tao/PI_Server/PortableServer_ORBInitializer.h"
+#include "tao/PI_Server/PortableServer_PolicyFactory.h"
+#include "tao/debug.h"
+#include "tao/ORB_Constants.h"
+#include "tao/PortableServer/PortableServer.h"
+#include "tao/PI/ORBInitInfo.h"
+#include "tao/ORB_Core.h"
+
+ACE_RCSID (PI_Server,
+ PortableServer_ORBInitializer,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+void
+TAO_PortableServer_ORBInitializer::pre_init (
+ PortableInterceptor::ORBInitInfo_ptr
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+}
+
+void
+TAO_PortableServer_ORBInitializer::post_init (
+ PortableInterceptor::ORBInitInfo_ptr info
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->register_policy_factories (info
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+void
+TAO_PortableServer_ORBInitializer::register_policy_factories (
+ PortableInterceptor::ORBInitInfo_ptr info
+ ACE_ENV_ARG_DECL)
+{
+#if !defined (CORBA_E_MICRO)
+ // Register the PortableServer policy factories.
+ PortableInterceptor::PolicyFactory_ptr tmp;
+ ACE_NEW_THROW_EX (tmp,
+ TAO_PortableServer_PolicyFactory,
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_CHECK;
+
+ PortableInterceptor::PolicyFactory_var policy_factory = tmp;
+
+ // Bind the same policy factory to all PortableServer related policy
+ // types since a single policy factory is used to create each of the
+ // different types of PortableServer policies.
+ static CORBA::PolicyType const type[] = {
+#if (TAO_HAS_MINIMUM_POA == 0)
+ PortableServer::THREAD_POLICY_ID,
+ PortableServer::IMPLICIT_ACTIVATION_POLICY_ID,
+ PortableServer::SERVANT_RETENTION_POLICY_ID,
+ PortableServer::REQUEST_PROCESSING_POLICY_ID,
+#endif /* TAO_HAS_MINIMUM_POA == 0 */
+ PortableServer::LIFESPAN_POLICY_ID,
+ PortableServer::ID_UNIQUENESS_POLICY_ID,
+ PortableServer::ID_ASSIGNMENT_POLICY_ID
+ };
+
+ CORBA::PolicyType const * end =
+ type + sizeof (type) / sizeof (type[0]);
+
+ for (CORBA::PolicyType const *i = type;
+ i != end;
+ ++i)
+ {
+ ACE_TRY
+ {
+ info->register_policy_factory (*i,
+ policy_factory.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCH (CORBA::BAD_INV_ORDER, ex)
+ {
+ if (ex.minor () == (CORBA::OMGVMCID | 16))
+ {
+ // The factory is already there, it happens because the
+ // magic initializer in PortableServer.cpp registers
+ // with the ORB multiple times. This is an indication
+ // that we should do no more work in this
+ // ORBInitializer.
+ return;
+ }
+ ACE_RE_THROW;
+ }
+ ACE_CATCHANY
+ {
+ // Rethrow any other exceptions...
+ ACE_RE_THROW;
+ }
+ ACE_ENDTRY;
+ ACE_CHECK;
+ }
+#else
+ ACE_UNUSED_ARG (info);
+#endif
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PI_Server/PortableServer_ORBInitializer.h b/TAO/tao/PI_Server/PortableServer_ORBInitializer.h
new file mode 100644
index 00000000000..8aba0600ea2
--- /dev/null
+++ b/TAO/tao/PI_Server/PortableServer_ORBInitializer.h
@@ -0,0 +1,65 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file PortableServer_ORBInitializer.h
+ *
+ * $Id$
+ *
+ * @author Irfan Pyarali <irfan@oomworks.com>
+ */
+//=============================================================================
+
+#ifndef TAO_PORTABLESERVER_ORB_INITIALIZER_H
+#define TAO_PORTABLESERVER_ORB_INITIALIZER_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/PI/PI.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/LocalObject.h"
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/// PortableServer ORB initializer.
+class TAO_PortableServer_ORBInitializer
+ : public virtual PortableInterceptor::ORBInitializer,
+ public virtual TAO_Local_RefCounted_Object
+{
+public:
+
+ /**
+ * @name PortableInterceptor::ORBInitializer methods
+ *
+ * The following methods are required by the
+ * PortableInterceptor::ORBInitializer interface.
+ */
+ //@{
+
+ void pre_init (PortableInterceptor::ORBInitInfo_ptr info
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ void post_init (PortableInterceptor::ORBInitInfo_ptr info
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ //@}
+
+private:
+
+ /// Register PortableServer policy factories.
+ void register_policy_factories (PortableInterceptor::ORBInitInfo_ptr info
+ ACE_ENV_ARG_DECL);
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_PORTABLESERVER_ORB_INITIALIZER_H */
diff --git a/TAO/tao/PI_Server/PortableServer_PolicyFactory.cpp b/TAO/tao/PI_Server/PortableServer_PolicyFactory.cpp
new file mode 100644
index 00000000000..cf31c2d03f4
--- /dev/null
+++ b/TAO/tao/PI_Server/PortableServer_PolicyFactory.cpp
@@ -0,0 +1,125 @@
+
+#include "tao/PI_Server/PortableServer_PolicyFactory.h"
+
+#include "tao/PortableServer/ThreadPolicy.h"
+#include "tao/PortableServer/LifespanPolicy.h"
+#include "tao/PortableServer/IdAssignmentPolicy.h"
+#include "tao/PortableServer/IdUniquenessPolicy.h"
+#include "tao/PortableServer/ImplicitActivationPolicy.h"
+#include "tao/PortableServer/RequestProcessingPolicy.h"
+#include "tao/PortableServer/ServantRetentionPolicy.h"
+#include "tao/PortableServer/PortableServer.h"
+#include "tao/PI_Server/Policy_Creator_T.h"
+
+ACE_RCSID (PI_Server,
+ PortableServer_PolicyFactory,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+CORBA::Policy_ptr
+TAO_PortableServer_PolicyFactory::create_policy (
+ CORBA::PolicyType type,
+ const CORBA::Any &value
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ CORBA::PolicyError))
+{
+#if !defined (CORBA_E_MICRO)
+#if (TAO_HAS_MINIMUM_POA == 0)
+
+
+ if (type == ::PortableServer::THREAD_POLICY_ID)
+ {
+ TAO::Portable_Server::ThreadPolicy *thread_policy = 0;
+ PortableServer::ThreadPolicyValue thr_value;
+
+ TAO::Portable_Server::create_policy (thread_policy, thr_value, value ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+
+ return thread_policy;
+ }
+
+#endif /* TAO_HAS_MINIMUM_POA == 0 */
+ if (type == PortableServer::LIFESPAN_POLICY_ID)
+ {
+ TAO::Portable_Server::LifespanPolicy *lifespan_policy = 0;
+ PortableServer::LifespanPolicyValue lifespan_value;
+
+ TAO::Portable_Server::create_policy (lifespan_policy, lifespan_value, value ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+
+ return lifespan_policy;
+ }
+
+ if (type == PortableServer::ID_UNIQUENESS_POLICY_ID)
+ {
+ TAO::Portable_Server::IdUniquenessPolicy *id_uniqueness_policy = 0;
+ PortableServer::IdUniquenessPolicyValue id_uniqueness_value;
+
+ TAO::Portable_Server::create_policy (id_uniqueness_policy, id_uniqueness_value, value ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+
+ return id_uniqueness_policy;
+ }
+
+ if (type == PortableServer::ID_ASSIGNMENT_POLICY_ID)
+ {
+ TAO::Portable_Server::IdAssignmentPolicy *id_assignment_policy = 0;
+ PortableServer::IdAssignmentPolicyValue id_assignment_value;
+
+ TAO::Portable_Server::create_policy (id_assignment_policy, id_assignment_value, value ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+
+ return id_assignment_policy;
+ }
+
+#if (TAO_HAS_MINIMUM_POA == 0)
+
+ if (type == PortableServer::IMPLICIT_ACTIVATION_POLICY_ID)
+ {
+ TAO::Portable_Server::ImplicitActivationPolicy *implicit_activatation_policy = 0;
+ PortableServer::ImplicitActivationPolicyValue implicit_activation_value;
+
+ TAO::Portable_Server::create_policy (implicit_activatation_policy, implicit_activation_value, value ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+
+ return implicit_activatation_policy;
+ }
+
+ if (type == PortableServer::SERVANT_RETENTION_POLICY_ID)
+ {
+ TAO::Portable_Server::ServantRetentionPolicy *servant_retention_policy = 0;
+ PortableServer::ServantRetentionPolicyValue servant_retention_value;
+
+ TAO::Portable_Server::create_policy (servant_retention_policy, servant_retention_value, value ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+
+ return servant_retention_policy;
+ }
+
+ if (type == PortableServer::REQUEST_PROCESSING_POLICY_ID)
+ {
+ TAO::Portable_Server::RequestProcessingPolicy *request_processing_policy = 0;
+ PortableServer::RequestProcessingPolicyValue request_processing_value;
+
+ TAO::Portable_Server::create_policy (request_processing_policy, request_processing_value, value ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+
+ return request_processing_policy;
+ }
+
+#endif /* TAO_HAS_MINIMUM_POA == 0 */
+
+ ACE_THROW_RETURN (CORBA::PolicyError (CORBA::BAD_POLICY_TYPE),
+ CORBA::Policy::_nil ());
+#else
+ ACE_UNUSED_ARG (value);
+ ACE_UNUSED_ARG (type);
+
+ ACE_THROW_RETURN (CORBA::PolicyError (CORBA::BAD_POLICY_TYPE),
+ CORBA::Policy::_nil ());
+#endif
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PI_Server/PortableServer_PolicyFactory.h b/TAO/tao/PI_Server/PortableServer_PolicyFactory.h
new file mode 100644
index 00000000000..1a0c06ff21a
--- /dev/null
+++ b/TAO/tao/PI_Server/PortableServer_PolicyFactory.h
@@ -0,0 +1,45 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file PortableServer_PolicyFactory.h
+ *
+ * $Id$
+ *
+ * @author Irfan Pyarali <irfan@oomworks.com>
+ */
+//=============================================================================
+
+#ifndef TAO_PORTABLESERVER_POLICY_FACTORY_H
+#define TAO_PORTABLESERVER_POLICY_FACTORY_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/PI/PI.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/LocalObject.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/// Policy factory for all PortableServer related policies.
+class TAO_PortableServer_PolicyFactory
+ : public virtual PortableInterceptor::PolicyFactory,
+ public virtual TAO_Local_RefCounted_Object
+{
+public:
+ CORBA::Policy_ptr create_policy (CORBA::PolicyType type,
+ const CORBA::Any & value
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ CORBA::PolicyError));
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_PORTABLESERVER_POLICY_FACTORY_H */
diff --git a/TAO/tao/PI_Server/ServerInterceptorAdapter.cpp b/TAO/tao/PI_Server/ServerInterceptorAdapter.cpp
new file mode 100644
index 00000000000..7a7714e00c7
--- /dev/null
+++ b/TAO/tao/PI_Server/ServerInterceptorAdapter.cpp
@@ -0,0 +1,607 @@
+// $Id$
+
+#include "tao/PI_Server/ServerInterceptorAdapter.h"
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+ACE_RCSID (PI_Server,
+ ServerInterceptorAdapter,
+ "$Id$")
+
+#include "tao/PI_Server/ServerRequestInfo.h"
+#include "tao/PI_Server/PICurrent_Guard.h"
+
+#include "tao/ServerRequestInterceptor_Adapter.h"
+#include "tao/TAO_Server_Request.h"
+#include "tao/ORB_Core.h"
+#include "tao/PI/PICurrent_Impl.h"
+#include "tao/PortableServer/Upcall_Command.h"
+#include "tao/PortableInterceptor.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO::ServerRequestInterceptor_Adapter_Impl::ServerRequestInterceptor_Adapter_Impl (void)
+{
+}
+
+#if TAO_HAS_EXTENDED_FT_INTERCEPTORS == 1
+void
+TAO::ServerRequestInterceptor_Adapter_Impl::tao_ft_interception_point (
+ TAO_ServerRequest &server_request,
+ TAO::Argument * const args[],
+ size_t nargs,
+ void * servant_upcall,
+ CORBA::TypeCode_ptr const * exceptions,
+ CORBA::ULong nexceptions,
+ CORBA::OctetSeq_out oc
+ ACE_ENV_ARG_DECL)
+{
+ // This method implements one of the "starting" server side
+ // interception point.
+
+ ACE_TRY
+ {
+ oc = 0;
+
+ bool is_remote_request = !server_request.collocated ();
+ TAO::ServerRequestInfo request_info (server_request,
+ args,
+ nargs,
+ servant_upcall,
+ exceptions,
+ nexceptions);
+
+ for (size_t i = 0 ; i < this->interceptor_list_.size(); ++i)
+ {
+ ServerRequestInterceptor_List::RegisteredInterceptor& registered =
+ this->interceptor_list_.registered_interceptor (i);
+
+ if (registered.details_.should_be_processed (is_remote_request))
+ {
+ registered.interceptor_->
+ tao_ft_interception_point (&request_info,
+ oc
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+
+ if (oc != 0)
+ {
+ (void) this->send_other (server_request,
+ args,
+ nargs,
+ servant_upcall,
+ exceptions,
+ nexceptions
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ return;
+ }
+
+ // The starting interception point completed successfully.
+ // Push the interceptor on to the flow stack.
+ ++server_request.interceptor_count ();
+ }
+ }
+ ACE_CATCH (PortableInterceptor::ForwardRequest, exc)
+ {
+ server_request.forward_location (exc.forward.in ());
+ server_request.reply_status (PortableInterceptor::LOCATION_FORWARD);
+ (void) this->send_other (server_request,
+ args,
+ nargs,
+ servant_upcall,
+ exceptions,
+ nexceptions
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_ENDTRY;
+ ACE_CHECK;
+}
+
+void
+TAO::ServerRequestInterceptor_Adapter_Impl::receive_request_service_contexts (
+ TAO_ServerRequest &server_request,
+ TAO::Argument * const args[],
+ size_t nargs,
+ void * servant_upcall,
+ CORBA::TypeCode_ptr const * exceptions,
+ CORBA::ULong nexceptions
+ ACE_ENV_ARG_DECL)
+{
+ // This method implements one of the "intermediate" server side
+ // interception point.
+
+ if (this->interceptor_list_.size() != server_request.interceptor_count ())
+ {
+ // This method (i.e. the receive_request() interception point)
+ // should only be invoked if all of the interceptors registered
+ // with the ORB were pushed on to the flow stack by one of the
+ // starting endpoints (such as
+ // tao_ft_interception_point()). If the above condition
+ // evaluates to "true," then it is likely that a starting
+ // interception point was never invoked. This is of course, an
+ // internal error that must be corrected.
+ ACE_THROW (CORBA::INTERNAL ());
+ }
+
+ ACE_TRY
+ {
+ // Copy the request scope current (RSC) to the thread scope
+ // current (TSC) upon leaving this scope, i.e. just after the
+ // receive_request_service_contexts() completes. A "guard" is
+ // used to make the copy also occur if an exception is thrown.
+ TAO::PICurrent_Guard const pi_guard (server_request,
+ false /* Copy RSC to TSC */);
+
+ bool is_remote_request = !server_request.collocated ();
+ TAO::ServerRequestInfo request_info (server_request,
+ args,
+ nargs,
+ servant_upcall,
+ exceptions,
+ nexceptions);
+
+ for (size_t i = 0 ; i < server_request.interceptor_count (); ++i)
+ {
+ ServerRequestInterceptor_List::RegisteredInterceptor& registered =
+ this->interceptor_list_.registered_interceptor (i);
+
+ if (registered.details_.should_be_processed (is_remote_request))
+ {
+ registered.interceptor_->
+ receive_request_service_contexts (&request_info
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ }
+ }
+ ACE_CATCH (PortableInterceptor::ForwardRequest, exc)
+ {
+ server_request.forward_location (exc.forward.in ());
+ server_request.reply_status (PortableInterceptor::LOCATION_FORWARD);
+ (void) this->send_other (server_request,
+ args,
+ nargs,
+ servant_upcall,
+ exceptions,
+ nexceptions
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_ENDTRY;
+ ACE_CHECK;
+}
+
+#elif TAO_HAS_EXTENDED_FT_INTERCEPTORS == 0
+
+/// NOTE: Yes, we have two versions of this. This is easier than
+/// messing around things in the same function, which is harder to
+/// read and could make the code buggier.
+void
+TAO::ServerRequestInterceptor_Adapter_Impl::receive_request_service_contexts (
+ TAO_ServerRequest &server_request,
+ TAO::Argument * const args[],
+ size_t nargs,
+ void * servant_upcall,
+ CORBA::TypeCode_ptr const * exceptions,
+ CORBA::ULong nexceptions
+ ACE_ENV_ARG_DECL)
+{
+ // This method implements one of the "starting" server side
+ // interception point if extended interceptors are not in place.
+
+ ACE_TRY
+ {
+ // Copy the request scope current (RSC) to the thread scope
+ // current (TSC) upon leaving this scope, i.e. just after the
+ // receive_request_service_contexts() completes. A "guard" is
+ // used to make the copy also occur if an exception is thrown.
+ TAO::PICurrent_Guard const pi_guard (server_request,
+ false /* Copy RSC to TSC */);
+
+ bool is_remote_request = !server_request.collocated ();
+
+ TAO::ServerRequestInfo request_info (server_request,
+ args,
+ nargs,
+ servant_upcall,
+ exceptions,
+ nexceptions);
+
+ for (size_t i = 0 ; i < this->interceptor_list_.size(); ++i)
+ {
+ ServerRequestInterceptor_List::RegisteredInterceptor& registered =
+ this->interceptor_list_.registered_interceptor (i);
+
+ if (registered.details_.should_be_processed (is_remote_request))
+ {
+ registered.interceptor_->
+ receive_request_service_contexts (&request_info
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+
+ // The starting interception point completed successfully.
+ // Push the interceptor on to the flow stack.
+ ++server_request.interceptor_count ();
+ }
+ }
+ ACE_CATCH (PortableInterceptor::ForwardRequest, exc)
+ {
+ server_request.forward_location (exc.forward.in ());
+ server_request.reply_status (PortableInterceptor::LOCATION_FORWARD);
+ (void) this->send_other (server_request,
+ args,
+ nargs,
+ servant_upcall,
+ exceptions,
+ nexceptions
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_ENDTRY;
+ ACE_CHECK;
+}
+
+#endif /*TAO_HAS_EXTENDED_FT_INTERCEPTORS*/
+
+void
+TAO::ServerRequestInterceptor_Adapter_Impl::receive_request (
+ TAO_ServerRequest &server_request,
+ TAO::Argument * const args[],
+ size_t nargs,
+ void * servant_upcall,
+ CORBA::TypeCode_ptr const * exceptions,
+ CORBA::ULong nexceptions
+ ACE_ENV_ARG_DECL)
+{
+ // This method implements an "intermediate" server side interception
+ // point. Interceptors are invoked in the same order they were
+ // pushed on to the flow stack.
+
+ if (this->interceptor_list_.size() != server_request.interceptor_count ())
+ {
+ // This method (i.e. the receive_request() interception point)
+ // should only be invoked if all of the interceptors registered
+ // with the ORB were pushed on to the flow stack by one of the
+ // starting endpoints (such as
+ // receive_request_service_contexts()). If the above condition
+ // evaluates to "true," then it is likely that a starting
+ // interception point was never invoked. This is of course, an
+ // internal error that must be corrected.
+ ACE_THROW (CORBA::INTERNAL ());
+ }
+
+ TAO::ServerRequestInfo request_info (server_request,
+ args,
+ nargs,
+ servant_upcall,
+ exceptions,
+ nexceptions);
+
+ ACE_TRY
+ {
+ bool is_remote_request = !server_request.collocated ();
+
+ for (size_t i = 0; i < server_request.interceptor_count (); ++i)
+ {
+ ServerRequestInterceptor_List::RegisteredInterceptor& registered =
+ this->interceptor_list_.registered_interceptor (i);
+
+ if (registered.details_.should_be_processed (is_remote_request))
+ {
+ registered.interceptor_->
+ receive_request (&request_info
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+
+ // Note that no interceptors are pushed on to or popped off
+ // of the flow stack in this interception point since it is
+ // an intermediate interception point.
+ }
+ }
+ ACE_CATCH (PortableInterceptor::ForwardRequest, exc)
+ {
+ server_request.forward_location (exc.forward.in ());
+ server_request.reply_status (PortableInterceptor::LOCATION_FORWARD);
+ this->send_other (server_request,
+ args,
+ nargs,
+ servant_upcall,
+ exceptions,
+ nexceptions
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_ENDTRY;
+ ACE_CHECK;
+
+}
+
+void
+TAO::ServerRequestInterceptor_Adapter_Impl::send_reply (
+ TAO_ServerRequest &server_request,
+ TAO::Argument * const args[],
+ size_t nargs,
+ void * servant_upcall,
+ CORBA::TypeCode_ptr const * exceptions,
+ CORBA::ULong nexceptions
+ ACE_ENV_ARG_DECL)
+{
+ // This is an "ending" interception point so we only process the
+ // interceptors pushed on to the flow stack.
+
+ bool is_remote_request = !server_request.collocated ();
+
+ // Notice that the interceptors are processed in the opposite order
+ // they were pushed onto the stack since this is an "ending"
+ // interception point.
+
+ TAO::ServerRequestInfo request_info (server_request,
+ args,
+ nargs,
+ servant_upcall,
+ exceptions,
+ nexceptions);
+
+ // Unwind the stack.
+ size_t const len = server_request.interceptor_count ();
+ for (size_t i = 0; i < len; ++i)
+ {
+ // Pop the interceptor off of the flow stack before it is
+ // invoked. This is necessary to prevent an interceptor already
+ // invoked in this "ending" interception point from being
+ // invoked in another "ending" interception point.
+ --server_request.interceptor_count ();
+
+ ServerRequestInterceptor_List::RegisteredInterceptor& registered =
+ this->interceptor_list_.registered_interceptor (
+ server_request.interceptor_count ());
+
+ if (registered.details_.should_be_processed (is_remote_request))
+ {
+ registered.interceptor_->
+ send_reply (&request_info
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ }
+
+ // The send_reply() interception point does not raise a
+ // PortableInterceptor::ForwardRequest exception so there is no need
+ // to attempt to catch it here.
+}
+
+void
+TAO::ServerRequestInterceptor_Adapter_Impl::send_exception (
+ TAO_ServerRequest &server_request,
+ TAO::Argument * const args[],
+ size_t nargs,
+ void * servant_upcall,
+ CORBA::TypeCode_ptr const * exceptions,
+ CORBA::ULong nexceptions
+ ACE_ENV_ARG_DECL)
+{
+ // This is an "ending" server side interception point so we only
+ // process the interceptors pushed on to the flow stack.
+
+ bool is_remote_request = !server_request.collocated ();
+
+ // Notice that the interceptors are processed in the opposite order
+ // they were pushed onto the stack since this is an "ending" server
+ // side interception point.
+
+ TAO::ServerRequestInfo request_info (server_request,
+ args,
+ nargs,
+ servant_upcall,
+ exceptions,
+ nexceptions);
+
+ ACE_TRY
+ {
+ // Unwind the flow stack.
+ size_t const len = server_request.interceptor_count ();
+ for (size_t i = 0; i < len; ++i)
+ {
+ // Pop the interceptor off of the flow stack before it is
+ // invoked. This is necessary to prevent an interceptor
+ // already invoked in this "ending" interception point from
+ // being invoked in another "ending" interception point.
+ --server_request.interceptor_count ();
+
+ ServerRequestInterceptor_List::RegisteredInterceptor& registered =
+ this->interceptor_list_.registered_interceptor (
+ server_request.interceptor_count ());
+
+ if (registered.details_.should_be_processed (is_remote_request))
+ {
+ registered.interceptor_->
+ send_exception (&request_info
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ }
+ }
+ ACE_CATCH (PortableInterceptor::ForwardRequest, exc)
+ {
+ server_request.forward_location (exc.forward.in ());
+ server_request.reply_status (PortableInterceptor::LOCATION_FORWARD);
+ this->send_other (server_request,
+ args,
+ nargs,
+ servant_upcall,
+ exceptions,
+ nexceptions
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ // The send_exception() interception point in the remaining
+ // interceptors must be called so call this method (not the
+ // interceptor's corresponding method) recursively. The call is
+ // made recursively since the caught exception must survive
+ // until the remaining interceptors have been called.
+ //
+ // Note that the recursion will stop once the flow stack size
+ // drops to zero, i.e., once each interceptor has been invoked.
+ // This prevents infinite recursion from occuring.
+
+ server_request.caught_exception (&ACE_ANY_EXCEPTION);
+
+ this->send_exception (server_request,
+ args,
+ nargs,
+ servant_upcall,
+ exceptions,
+ nexceptions
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ PortableInterceptor::ReplyStatus status =
+ server_request.reply_status ();
+
+ // Only re-throw the exception if it hasn't been transformed by
+ // the send_exception() interception point (e.g. to a
+ // LOCATION_FORWARD).
+ if (status == PortableInterceptor::SYSTEM_EXCEPTION
+ || status == PortableInterceptor::USER_EXCEPTION)
+ ACE_RE_THROW;
+ }
+ ACE_ENDTRY;
+ ACE_CHECK;
+}
+
+void
+TAO::ServerRequestInterceptor_Adapter_Impl::send_other (
+ TAO_ServerRequest &server_request,
+ TAO::Argument * const args[],
+ size_t nargs,
+ void * servant_upcall,
+ CORBA::TypeCode_ptr const * exceptions,
+ CORBA::ULong nexceptions
+ ACE_ENV_ARG_DECL)
+{
+ // This is an "ending" server side interception point so we only
+ // process the interceptors pushed on to the flow stack.
+
+ bool is_remote_request = !server_request.collocated ();
+
+ TAO::ServerRequestInfo request_info (server_request,
+ args,
+ nargs,
+ servant_upcall,
+ exceptions,
+ nexceptions);
+
+ // Notice that the interceptors are processed in the opposite order
+ // they were pushed onto the stack since this is an "ending" server
+ // side interception point.
+
+ ACE_TRY
+ {
+ // Unwind the flow stack.
+ size_t const len = server_request.interceptor_count ();
+ for (size_t i = 0; i < len; ++i)
+ {
+ // Pop the interceptor off of the flow stack before it is
+ // invoked. This is necessary to prevent an interceptor
+ // already invoked in this "ending" interception point from
+ // being invoked in another "ending" interception point.
+ --server_request.interceptor_count ();
+
+ ServerRequestInterceptor_List::RegisteredInterceptor& registered =
+ this->interceptor_list_.registered_interceptor (
+ server_request.interceptor_count ());
+
+ if (registered.details_.should_be_processed (is_remote_request))
+ {
+ registered.interceptor_->
+ send_other (&request_info
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ }
+ }
+ ACE_CATCH (PortableInterceptor::ForwardRequest, exc)
+ {
+ server_request.forward_location (exc.forward.in ());
+ server_request.reply_status (PortableInterceptor::LOCATION_FORWARD);
+ this->send_other (server_request,
+ args,
+ nargs,
+ servant_upcall,
+ exceptions,
+ nexceptions
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_ENDTRY;
+ ACE_CHECK;
+}
+
+void
+TAO::ServerRequestInterceptor_Adapter_Impl::add_interceptor (
+ PortableInterceptor::ServerRequestInterceptor_ptr interceptor
+ ACE_ENV_ARG_DECL)
+{
+ this->interceptor_list_.add_interceptor (interceptor ACE_ENV_ARG_PARAMETER);
+}
+
+void
+TAO::ServerRequestInterceptor_Adapter_Impl::add_interceptor (
+ PortableInterceptor::ServerRequestInterceptor_ptr interceptor,
+ const CORBA::PolicyList& policies
+ ACE_ENV_ARG_DECL)
+{
+ this->interceptor_list_.add_interceptor (interceptor,
+ policies
+ ACE_ENV_ARG_PARAMETER);
+}
+
+void
+TAO::ServerRequestInterceptor_Adapter_Impl::destroy_interceptors (
+ ACE_ENV_SINGLE_ARG_DECL)
+{
+ this->interceptor_list_.destroy_interceptors (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+TAO::PICurrent_Impl *
+TAO::ServerRequestInterceptor_Adapter_Impl::allocate_pi_current (void)
+{
+ TAO::PICurrent_Impl *pi = 0;
+ ACE_NEW_RETURN (pi,
+ TAO::PICurrent_Impl,
+ pi);
+ return pi;
+}
+
+void
+TAO::ServerRequestInterceptor_Adapter_Impl::deallocate_pi_current (
+ TAO::PICurrent_Impl *picurrent)
+{
+ delete picurrent;
+}
+
+void
+TAO::ServerRequestInterceptor_Adapter_Impl::execute_command (
+ TAO_ServerRequest & server_request,
+ TAO::Upcall_Command & command
+ ACE_ENV_ARG_DECL)
+{
+ TAO::PICurrent_Guard const pi_guard (server_request,
+ true /* Copy TSC to RSC */);
+
+ // The actual upcall.
+ command.execute (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
diff --git a/TAO/tao/PI_Server/ServerInterceptorAdapter.h b/TAO/tao/PI_Server/ServerInterceptorAdapter.h
new file mode 100644
index 00000000000..cd2930965f1
--- /dev/null
+++ b/TAO/tao/PI_Server/ServerInterceptorAdapter.h
@@ -0,0 +1,195 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file ServerInterceptorAdapter.h
+ *
+ * $Id$
+ *
+ * This file contains a helper class to simplify the support of
+ * interceptors in TAO_IDL generated skeletons.
+ *
+ * @author Nanbor Wang <nanbor@cs.wustl.edu>
+ * @author Ossama Othman <ossama@uci.edu>
+ * @author Kirthika Parameswaran <kirthika@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_SERVER_INTERCEPTOR_ADAPTER_H
+#define TAO_SERVER_INTERCEPTOR_ADAPTER_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+#include "tao/PI_Server/ServerRequestInterceptorC.h"
+
+#include "tao/PI/Interceptor_List_T.h"
+#include "tao/ServerRequestInterceptor_Adapter.h"
+#include "tao/Basic_Types.h"
+#include "tao/PI_Server/ServerRequestDetails.h"
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ typedef Interceptor_List< ::PortableInterceptor::ServerRequestInterceptor,
+ ServerRequestDetails>
+ ServerRequestInterceptor_List;
+}
+
+namespace CORBA
+{
+ class PolicyList;
+}
+
+class TAO_ServerRequest;
+
+namespace TAO
+{
+ class ServerRequestInfo;
+
+ /**
+ * @class ServerRequestInterceptor_Adapter_Impl
+ *
+ * @brief ServerRequestInterceptor_Adapter_Impl
+ *
+ * A convenient helper class to invoke registered server request
+ * interceptor(s).
+ */
+ class ServerRequestInterceptor_Adapter_Impl
+ : public ServerRequestInterceptor_Adapter
+ {
+ public:
+
+ /// Constructor.
+ ServerRequestInterceptor_Adapter_Impl (void);
+
+ /**
+ * @name PortableInterceptor Server Side Interception Points
+ *
+ * Each of these methods corresponds to a server side interception
+ * point.
+ */
+ //@{
+#if TAO_HAS_EXTENDED_FT_INTERCEPTORS == 1
+ /// This method implements the "starting" server side interception
+ /// point. It will be used as the first interception point and it is
+ /// proprietary to TAO.
+ /// @@ Will go away once Bug 1369 is fixed
+ void tao_ft_interception_point (
+ TAO_ServerRequest &server_request,
+ TAO::Argument * const args[],
+ size_t nargs,
+ void * servant_upcall,
+ CORBA::TypeCode_ptr const * exceptions,
+ CORBA::ULong nexceptions,
+ CORBA::OctetSeq_out oc
+ ACE_ENV_ARG_DECL);
+#endif /*TAO_HAS_EXTENDED_FT_INTERCEPTORS*/
+
+ /// This method implements the "intermediate" server side
+ /// interception point if the above #ifdef is set to 1 and a
+ /// starting intercetion point if it is not set to 1.
+ ///
+ /// @note This method should have been the "starting" interception
+ /// point according to the interceptor spec. This will be
+ /// fixed once Bug 1369 is completely done.
+ void receive_request_service_contexts (
+ TAO_ServerRequest &server_request,
+ TAO::Argument * const args[],
+ size_t nargs,
+ void * servant_upcall,
+ CORBA::TypeCode_ptr const * exceptions,
+ CORBA::ULong nexceptions
+ ACE_ENV_ARG_DECL);
+
+ /// This method an "intermediate" server side interception point.
+ void receive_request (
+ TAO_ServerRequest &server_request,
+ TAO::Argument * const args[],
+ size_t nargs,
+ void * servant_upcall,
+ CORBA::TypeCode_ptr const * exceptions,
+ CORBA::ULong nexceptions
+ ACE_ENV_ARG_DECL);
+
+ /// This method implements one of the "ending" server side
+ /// interception points.
+ void send_reply (
+ TAO_ServerRequest &server_request,
+ TAO::Argument * const args[],
+ size_t nargs,
+ void * servant_upcall,
+ CORBA::TypeCode_ptr const * exceptions,
+ CORBA::ULong nexceptions
+ ACE_ENV_ARG_DECL);
+
+ /// This method implements one of the "ending" server side
+ /// interception points.
+ void send_exception (
+ TAO_ServerRequest &server_request,
+ TAO::Argument * const args[],
+ size_t nargs,
+ void * servant_upcall,
+ CORBA::TypeCode_ptr const * exceptions,
+ CORBA::ULong nexceptions
+ ACE_ENV_ARG_DECL);
+
+ /// This method implements one of the "ending" server side
+ /// interception points.
+ void send_other (
+ TAO_ServerRequest &server_request,
+ TAO::Argument * const args[],
+ size_t nargs,
+ void * servant_upcall,
+ CORBA::TypeCode_ptr const * exceptions,
+ CORBA::ULong nexceptions
+ ACE_ENV_ARG_DECL);
+ //@}
+
+ /// Register an interceptor.
+ virtual void add_interceptor (
+ PortableInterceptor::ServerRequestInterceptor_ptr interceptor
+ ACE_ENV_ARG_DECL);
+
+ virtual void add_interceptor (
+ PortableInterceptor::ServerRequestInterceptor_ptr interceptor,
+ const CORBA::PolicyList& policies
+ ACE_ENV_ARG_DECL);
+
+ virtual void destroy_interceptors (ACE_ENV_SINGLE_ARG_DECL);
+
+ virtual TAO::PICurrent_Impl *allocate_pi_current (void);
+
+ virtual void deallocate_pi_current (
+ TAO::PICurrent_Impl *picurrent);
+
+ virtual void execute_command (
+ TAO_ServerRequest &server_request,
+ TAO::Upcall_Command &command
+ ACE_ENV_ARG_DECL);
+
+ private:
+
+ /// List of registered interceptors.
+ ServerRequestInterceptor_List interceptor_list_;
+ };
+
+} // End namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_SERVER_INTERCEPTOR_ADAPTER_H */
diff --git a/TAO/tao/PI_Server/ServerRequestDetails.cpp b/TAO/tao/PI_Server/ServerRequestDetails.cpp
new file mode 100644
index 00000000000..c06a9429d1d
--- /dev/null
+++ b/TAO/tao/PI_Server/ServerRequestDetails.cpp
@@ -0,0 +1,77 @@
+#include "tao/PI_Server/ServerRequestDetails.h"
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+#if !defined (__ACE_INLINE__)
+#include "tao/PI_Server/ServerRequestDetails.inl"
+#endif /* defined INLINE */
+
+ACE_RCSID (PI_Server,
+ ServerRequestDetails,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ void
+ ServerRequestDetails::apply_policies (
+ const CORBA::PolicyList &policies
+ ACE_ENV_ARG_DECL)
+ {
+ // Flag to check for duplicate ProcessingModePolicy objects in the list.
+ bool processing_mode_applied = false;
+
+ const CORBA::ULong plen = policies.length ();
+
+ for (CORBA::ULong i = 0; i < plen; ++i)
+ {
+ CORBA::Policy_var policy = CORBA::Policy::_duplicate (policies[i]);
+
+ if (CORBA::is_nil (policy.in ()))
+ {
+ // Just ignore nil policies...
+ continue;
+ }
+
+ // Obtain the PolicyType from the current Policy object.
+ const CORBA::PolicyType policy_type =
+ policy->policy_type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (policy_type == PortableInterceptor::PROCESSING_MODE_POLICY_TYPE)
+ {
+ if (processing_mode_applied)
+ {
+ // This is the second time we have run into this policy type,
+ // and that is not allowed.
+ ACE_THROW (CORBA::INV_POLICY ());
+ }
+
+ // Flip the flag to true in order to trap any dupes.
+ processing_mode_applied = true;
+
+ // Narrow the Policy to the ProcessingModePolicy interface.
+ PortableInterceptor::ProcessingModePolicy_var pm_policy =
+ PortableInterceptor::ProcessingModePolicy::_narrow (
+ policy.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Save the value of the ProcessingModePolicy in our data member.
+ this->processing_mode_ =
+ pm_policy->processing_mode (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else
+ {
+ // We don't support the current policy type.
+ ACE_THROW (CORBA::INV_POLICY ());
+ }
+ }
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
diff --git a/TAO/tao/PI_Server/ServerRequestDetails.h b/TAO/tao/PI_Server/ServerRequestDetails.h
new file mode 100644
index 00000000000..fc34a6a66f5
--- /dev/null
+++ b/TAO/tao/PI_Server/ServerRequestDetails.h
@@ -0,0 +1,83 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file ServerRequestDetails.h
+ *
+ * $Id$
+ *
+ * This file declares a class that manages the details
+ * about a registered server request interceptor. Policies can be
+ * used when interceptors are registered, and the policy values
+ * will be processed and used to modify the values of the
+ * ServerRequestDetails object associated with the registered
+ * server request interceptor.
+ *
+ * @author Tim Bradley <bradley_t@ociweb.com>
+ */
+//=============================================================================
+
+#ifndef TAO_SERVER_REQUEST_DETAILS_H
+#define TAO_SERVER_REQUEST_DETAILS_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+#include "tao/PI/ProcessingModePolicyC.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ /**
+ * @class ServerRequestDetails
+ *
+ * @brief The policy-driven details for a registered server request
+ * interceptor
+ *
+ * Each time a server request interceptor is registered with an ORB,
+ * a ServerRequestDetails object will be created and associated with
+ * the registered server request interceptor. If the interceptor is
+ * registered with policies, the policies will be used to adjust the
+ * values in the ServerRequestDetails appropriately.
+ */
+ class ServerRequestDetails
+ {
+ public:
+ ServerRequestDetails (void);
+
+ void apply_policies (const CORBA::PolicyList& policies
+ ACE_ENV_ARG_DECL);
+
+ /// Returns true if the ProcessingMode setting permits the "firing"
+ /// of the associated server request interceptor based upon the
+ /// remote vs. collocated nature of the current servant request
+ /// that is being dispatched.
+ bool should_be_processed (bool is_remote_request) const;
+
+ private:
+
+ /// The ProcessingMode setting that can be adjusted via the
+ /// PortableInterceptor::ProcessingModePolicy.
+ PortableInterceptor::ProcessingMode processing_mode_;
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+#include "tao/PI_Server/ServerRequestDetails.inl"
+#endif /* __ACE_INLINE__ */
+
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_SERVER_REQUEST_DETAILS_H */
diff --git a/TAO/tao/PI_Server/ServerRequestDetails.inl b/TAO/tao/PI_Server/ServerRequestDetails.inl
new file mode 100644
index 00000000000..f653264bdac
--- /dev/null
+++ b/TAO/tao/PI_Server/ServerRequestDetails.inl
@@ -0,0 +1,27 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ ACE_INLINE
+ ServerRequestDetails::ServerRequestDetails (void)
+ : processing_mode_(PortableInterceptor::LOCAL_AND_REMOTE)
+ {
+ }
+
+ ACE_INLINE
+ bool
+ ServerRequestDetails::should_be_processed (bool is_remote_request) const
+ {
+ return ((this->processing_mode_ == PortableInterceptor::LOCAL_AND_REMOTE) ||
+ ((this->processing_mode_ == PortableInterceptor::REMOTE_ONLY) &&
+ (is_remote_request)) ||
+ ((this->processing_mode_ == PortableInterceptor::LOCAL_ONLY) &&
+ (!is_remote_request)));
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PI_Server/ServerRequestInfo.cpp b/TAO/tao/PI_Server/ServerRequestInfo.cpp
new file mode 100644
index 00000000000..65695dc5317
--- /dev/null
+++ b/TAO/tao/PI_Server/ServerRequestInfo.cpp
@@ -0,0 +1,591 @@
+// $Id$
+
+#include "tao/PI_Server/ServerRequestInfo.h"
+
+#if (TAO_HAS_INTERCEPTORS == 1)
+
+ACE_RCSID (PI_Server,
+ ServerRequestInfo,
+ "$Id$")
+
+#include "tao/PortableServer/Root_POA.h"
+#include "tao/PortableServer/Servant_Upcall.h"
+#include "tao/PortableServer/Servant_Base.h"
+
+#include "tao/TAO_Server_Request.h"
+#include "tao/ORB_Core.h"
+#include "tao/PolicyC.h"
+#include "tao/AnyTypeCode/DynamicC.h"
+#include "tao/ORB_Core.h"
+#include "tao/Service_Context.h"
+#include "tao/PI/RequestInfo_Util.h"
+#include "tao/PI/PICurrent.h"
+#include "tao/PI/PICurrent_Impl.h"
+#include "tao/AnyTypeCode/ExceptionA.h"
+
+#include "ace/OS_NS_string.h"
+
+# if !defined (__ACE_INLINE__)
+# include "tao/PI_Server/ServerRequestInfo.inl"
+# endif /* !__ACE_INLINE__ */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+CORBA::ULong
+TAO::ServerRequestInfo::request_id (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ // The request ID returned by this method need not correspond to the
+ // GIOP request ID sent with the client request. The request ID
+ // must be unique across all outstanding requests. To avoid locking
+ // overhead, the address of the TAO_ServerRequest object is used as
+ // the request ID. This guarantees that the request ID is unique.
+ //
+ // For 64-bit platforms, only the lower 32 bits are used. Hopefully
+ // that will be enough to ensure uniqueness.
+
+ CORBA::ULong id = 0;
+
+ // Note that we reinterpret_cast to an "unsigned long" instead of
+ // CORBA::ULong since we need to first cast to an integer large
+ // enough to hold an address to avoid compile-time warnings on some
+ // 64-bit platforms.
+
+ if (sizeof (this) == 4) // 32 bit address
+ id = static_cast <CORBA::ULong> (
+ reinterpret_cast <ptrdiff_t>
+ (&(this->server_request_)));
+
+ else if (sizeof (this) == 8) // 64 bit address -- use lower 32 bits
+ id = static_cast <CORBA::ULong> (
+ reinterpret_cast <ptrdiff_t>
+ (&(this->server_request_)) & 0xFFFFFFFFu);
+
+ else
+ // @@ Rather than fallback on the GIOP request ID, we should use
+ // an atomically incremented variable specific to the ORB, or
+ // perhaps specific to the process.
+ id = this->server_request_.request_id (); // Fallback
+
+ return id;
+}
+
+char *
+TAO::ServerRequestInfo::operation (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return CORBA::string_dup (this->server_request_.operation ());
+}
+
+Dynamic::ParameterList *
+TAO::ServerRequestInfo::arguments (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ if (this->args_ == 0)
+ {
+ ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14,
+ CORBA::COMPLETED_NO),
+ 0);
+ }
+
+ // Generate the argument list on demand.
+ Dynamic::ParameterList * const parameter_list =
+ TAO_RequestInfo_Util::make_parameter_list (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ Dynamic::ParameterList_var safe_parameter_list = parameter_list;
+
+ // Return value is always generated as first TAO::Argument in
+ // skeleton. It shouldn't be included in the parameter list.
+ // Skip it.
+
+ TAO::Argument * const * const begin = this->args_ + 1;
+ TAO::Argument * const * const end = this->args_ + this->nargs_;
+
+ ACE_ASSERT (end - begin >= 0);
+
+ parameter_list->length (static_cast<CORBA::ULong> (end - begin));
+
+ CORBA::ULong p = 0;
+ for (TAO::Argument * const * i = begin; i != end; ++i, ++p)
+ {
+ // Insert the operation parameters into the
+ // Dynamic::ParameterList.
+ Dynamic::Parameter& parameter = (*parameter_list)[p];
+ parameter.mode = (*i)->mode ();
+ (*i)->interceptor_value (&parameter.argument);
+ }
+
+ return safe_parameter_list._retn ();
+}
+
+Dynamic::ExceptionList *
+TAO::ServerRequestInfo::exceptions (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ if (this->args_ == 0)
+ {
+ ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14,
+ CORBA::COMPLETED_NO),
+ 0);
+ }
+
+ // Generate the exception list on demand.
+ Dynamic::ExceptionList * const exception_list =
+ TAO_RequestInfo_Util::make_exception_list (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ Dynamic::ExceptionList_var safe_exception_list = exception_list;
+
+ exception_list->length (this->nexceptions_);
+
+ CORBA::TypeCode_ptr const * const begin = this->exceptions_;
+ CORBA::TypeCode_ptr const * const end =
+ this->exceptions_ + this->nexceptions_;
+
+ CORBA::ULong e = 0;
+ for (CORBA::TypeCode_ptr const * i = begin; i != end; ++i, ++e)
+ {
+ CORBA::TypeCode_ptr tcp_object = *i;
+ (*exception_list)[e] = tcp_object;
+ }
+
+ return safe_exception_list._retn ();
+}
+
+Dynamic::ContextList *
+TAO::ServerRequestInfo::contexts (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14,
+ CORBA::COMPLETED_NO),
+ 0);
+}
+
+Dynamic::RequestContext *
+TAO::ServerRequestInfo::operation_context (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14,
+ CORBA::COMPLETED_NO),
+ 0);
+}
+
+CORBA::Any *
+TAO::ServerRequestInfo::result (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ if (this->args_ == 0)
+ {
+ ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14,
+ CORBA::COMPLETED_NO),
+ 0);
+ }
+
+ // Generate the result on demand.
+
+ static CORBA::Boolean const tk_void_any = 1;
+
+ CORBA::Any * result_any =
+ TAO_RequestInfo_Util::make_any (tk_void_any
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ CORBA::Any_var safe_result_any = result_any;
+
+ // Result is always first element in TAO::Argument array.
+ TAO::Argument * const r = this->args_[0];
+
+ r->interceptor_value (result_any);
+
+ return safe_result_any._retn ();
+}
+
+CORBA::Boolean
+TAO::ServerRequestInfo::response_expected (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return this->server_request_.response_expected ();
+}
+
+Messaging::SyncScope
+TAO::ServerRequestInfo::sync_scope (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ if (this->server_request_.sync_with_server ())
+ return Messaging::SYNC_WITH_SERVER;
+
+ ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14,
+ CORBA::COMPLETED_NO),
+ -1);
+}
+
+PortableInterceptor::ReplyStatus
+TAO::ServerRequestInfo::reply_status (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ if (this->server_request_.reply_status () == -1)
+ // A reply hasn't been received yet.
+ ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14,
+ CORBA::COMPLETED_NO),
+ -1);
+
+ return this->server_request_.reply_status ();
+}
+
+CORBA::Object_ptr
+TAO::ServerRequestInfo::forward_reference (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ if (this->server_request_.reply_status () != PortableInterceptor::LOCATION_FORWARD)
+ ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14,
+ CORBA::COMPLETED_NO),
+ CORBA::Object::_nil ());
+
+ // TAO_ServerRequest::forward_location() already duplicates the
+ // object reference. There is no need to duplicate it here.
+ return this->server_request_.forward_location ();
+}
+
+CORBA::Any *
+TAO::ServerRequestInfo::get_slot (PortableInterceptor::SlotId id
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableInterceptor::InvalidSlot))
+{
+ // Retrieve the total number of assigned slots from the PICurrent.
+ // No TSS access is incurred.
+ CORBA::Object_ptr pi_current_obj =
+ this->server_request_.orb_core ()->pi_current ();
+
+ TAO::PICurrent *pi_current =
+ dynamic_cast <TAO::PICurrent*> (pi_current_obj);
+
+ if (pi_current == 0)
+ ACE_THROW_RETURN (CORBA::INTERNAL (), 0);
+
+ pi_current->check_validity (id ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ // Retrieve the request scope PICurrent object.
+ TAO::PICurrent_Impl *rsc = this->server_request_.rs_pi_current ();
+
+ return rsc->get_slot (id ACE_ENV_ARG_PARAMETER);
+
+}
+
+IOP::ServiceContext *
+TAO::ServerRequestInfo::get_request_service_context (
+ IOP::ServiceId id
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ TAO_Service_Context &service_context_list =
+ this->server_request_.request_service_context ();
+
+ return this->get_service_context_i (service_context_list,
+ id
+ ACE_ENV_ARG_PARAMETER);
+}
+
+IOP::ServiceContext *
+TAO::ServerRequestInfo::get_reply_service_context (
+ IOP::ServiceId id
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ TAO_Service_Context & service_context_list =
+ this->server_request_.reply_service_context ();
+
+ return this->get_service_context_i (service_context_list,
+ id
+ ACE_ENV_ARG_PARAMETER);
+}
+
+IOP::ServiceContext *
+TAO::ServerRequestInfo::get_service_context_i (
+ TAO_Service_Context & service_context_list,
+ IOP::ServiceId id
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ IOP::ServiceContext_var service_context;
+
+ if (service_context_list.get_context (id, service_context.out ()) != 0)
+ {
+ // Found.
+ return service_context._retn ();
+ }
+ else
+ {
+ // Not found.
+ ACE_THROW_RETURN (CORBA::BAD_PARAM (CORBA::OMGVMCID | 26,
+ CORBA::COMPLETED_NO),
+ 0);
+ }
+}
+
+// Use at own risk. There is no way currently of extracting an
+// exception from an Any. This method is in place just to be compliant
+// with the spec.
+CORBA::Any *
+TAO::ServerRequestInfo::sending_exception (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ if (this->server_request_.reply_status () != PortableInterceptor::SYSTEM_EXCEPTION
+ && this->server_request_.reply_status () != PortableInterceptor::USER_EXCEPTION)
+ {
+ ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14,
+ CORBA::COMPLETED_NO),
+ 0);
+ }
+
+ // The spec says that if it is a user exception which cannot be
+ // inserted then the UNKNOWN exception should be thrown with minor
+ // code 1.
+
+ CORBA::Any * temp = 0;
+
+ ACE_NEW_THROW_EX (temp,
+ CORBA::Any,
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (0);
+
+ CORBA::Any_var caught_exception_var = temp;
+
+ if (this->server_request_.caught_exception () != 0)
+ (*temp) <<= *(this->server_request_.caught_exception ());
+
+ return caught_exception_var._retn ();
+}
+
+char *
+TAO::ServerRequestInfo::server_id (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ if (this->servant_upcall_ != 0)
+ return
+ CORBA::string_dup (this->server_request_.orb_core ()->server_id ());
+
+
+ ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14,
+ CORBA::COMPLETED_NO),
+ 0);
+}
+
+char *
+TAO::ServerRequestInfo::orb_id (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ if (this->servant_upcall_ != 0)
+ return
+ CORBA::string_dup (this->server_request_.orb_core ()->orbid ());
+
+ ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14,
+ CORBA::COMPLETED_NO),
+ 0);
+}
+
+PortableInterceptor::AdapterName *
+TAO::ServerRequestInfo::adapter_name (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ // The adapter_name attribute defines a name for the object adapter
+ // that services requests for the invoked object. In the case of the
+ // POA, the adapter_name is the sequence of names from the root POA
+ // to the POA that services the request. The root POA is not named
+ // in this sequence.
+ if (this->servant_upcall_ != 0)
+ return
+ this->servant_upcall_->poa ().adapter_name (
+ ACE_ENV_SINGLE_ARG_PARAMETER);
+
+ ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14,
+ CORBA::COMPLETED_NO),
+ 0);
+}
+
+PortableInterceptor::ObjectId *
+TAO::ServerRequestInfo::object_id (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ if (this->servant_upcall_ != 0)
+ {
+ const PortableServer::ObjectId &id =
+ this->servant_upcall_->user_id ();
+
+ PortableInterceptor::ObjectId *tmp = 0;
+
+ ACE_NEW_THROW_EX (tmp,
+ PortableInterceptor::ObjectId,
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (0);
+
+ PortableInterceptor::ObjectId_var obj_id = tmp;
+
+ // @@ It would be nice to avoid this copy. However, we can't be
+ // sure if the octet sequence will out live the POA from
+ // which the object ID is ultimately obtained. In the event
+ // the octet sequence does out live the POA, a copy is indeed
+ // necessary. Do a copy to be on the safe side. In any
+ // case, this is still faster than the
+ // PortableServer::Current::object_id() method since no TSS
+ // access is involved.
+ const CORBA::ULong len = id.length ();
+ obj_id->length (len);
+ CORBA::Octet *buffer = obj_id->get_buffer ();
+ ACE_OS::memcpy (buffer, id.get_buffer (), len);
+
+ return obj_id._retn ();
+ }
+
+ ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14,
+ CORBA::COMPLETED_NO),
+ 0);
+}
+
+CORBA::OctetSeq *
+TAO::ServerRequestInfo::adapter_id (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ if (this->servant_upcall_ != 0)
+ return this->servant_upcall_->poa ().id (ACE_ENV_SINGLE_ARG_PARAMETER);
+
+ ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14,
+ CORBA::COMPLETED_NO),
+ 0);
+}
+
+char *
+TAO::ServerRequestInfo::target_most_derived_interface (
+ ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ PortableServer::Servant const servant =
+ (this->servant_upcall_ == 0
+ ? 0
+ : this->servant_upcall_->servant ());
+
+ if (servant == 0)
+ {
+ ACE_THROW_RETURN (CORBA::NO_RESOURCES (CORBA::OMGVMCID | 1,
+ CORBA::COMPLETED_NO),
+ 0);
+ }
+
+ return CORBA::string_dup (servant->_interface_repository_id ());
+}
+
+CORBA::Policy_ptr
+TAO::ServerRequestInfo::get_server_policy (CORBA::PolicyType type
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ if (this->servant_upcall_ != 0)
+ {
+ CORBA::Policy_var policy =
+ this->servant_upcall_->poa ().get_policy (type ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+
+ if (!CORBA::is_nil (policy.in ()))
+ {
+ return policy._retn ();
+ }
+ else
+ {
+ // No policy matching the given PolicyType was found.
+ ACE_THROW_RETURN (CORBA::INV_POLICY (CORBA::OMGVMCID | 3,
+ CORBA::COMPLETED_NO),
+ CORBA::Policy::_nil ());
+ }
+ }
+
+ // @@ Technically, we shouldn't be throwing this exception since
+ // this method should be valid in all server side request
+ // interception points.
+ ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14,
+ CORBA::COMPLETED_NO),
+ CORBA::Policy::_nil ());
+}
+
+void
+TAO::ServerRequestInfo::set_slot (PortableInterceptor::SlotId id,
+ const CORBA::Any &data
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableInterceptor::InvalidSlot))
+{
+ // Retrieve the total number of assigned slots from the PICurrent
+ // object. No TSS access is incurred.
+ CORBA::Object_ptr pi_current_obj =
+ this->server_request_.orb_core ()->pi_current ();
+
+ TAO::PICurrent *pi_current =
+ dynamic_cast <TAO::PICurrent*> (pi_current_obj);
+
+ if (pi_current == 0)
+ ACE_THROW (CORBA::INTERNAL ());
+
+ pi_current->check_validity (id ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Retrieve the "request scope current" (RSC).
+ TAO::PICurrent_Impl * rsc = this->server_request_.rs_pi_current ();
+
+ rsc->set_slot (id, data ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+CORBA::Boolean
+TAO::ServerRequestInfo::target_is_a (const char * id
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ // Implemented in the generated skeleton.
+
+ PortableServer::Servant const servant =
+ (this->servant_upcall_ == 0
+ ? 0
+ : this->servant_upcall_->servant ());
+
+
+ if (servant == 0)
+ {
+ ACE_THROW_RETURN (CORBA::NO_RESOURCES (CORBA::OMGVMCID | 1,
+ CORBA::COMPLETED_NO),
+ 0);
+ }
+
+ return servant->_is_a (id
+ ACE_ENV_ARG_PARAMETER);
+}
+
+void
+TAO::ServerRequestInfo::add_reply_service_context (
+ const IOP::ServiceContext & service_context,
+ CORBA::Boolean replace
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ // Get the service context from the list
+ TAO_Service_Context &service_context_list =
+ this->server_request_.reply_service_context ();
+
+ if (service_context_list.set_context (service_context, replace) == 0)
+ {
+ ACE_THROW (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 15,
+ CORBA::COMPLETED_NO));
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
diff --git a/TAO/tao/PI_Server/ServerRequestInfo.h b/TAO/tao/PI_Server/ServerRequestInfo.h
new file mode 100644
index 00000000000..1ba2e9c0026
--- /dev/null
+++ b/TAO/tao/PI_Server/ServerRequestInfo.h
@@ -0,0 +1,317 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file ServerRequestInfo.h
+ *
+ * $Id$
+ *
+ * This is the implementation of the
+ * @c PortableInterceptor::ServerRequestInfo interface.
+ *
+ * @author Kirthika Parameswaran <kirthika@cs.wustl.edu>
+ * @author Ossama Othman
+ */
+//=============================================================================
+
+#ifndef TAO_SERVER_REQUEST_INFO_H
+#define TAO_SERVER_REQUEST_INFO_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if (TAO_HAS_INTERCEPTORS == 1)
+
+#include "tao/AnyTypeCode/AnyTypeCode_methods.h"
+#include "tao/PI_Server/ServerRequestInfoC.h"
+#include "tao/PI/PIForwardRequestC.h"
+#include "tao/LocalObject.h"
+#include "tao/OctetSeqC.h"
+#include "tao/TAO_Server_Request.h"
+#include "tao/PortableInterceptorC.h"
+
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_ServerRequest;
+class TAO_Service_Context;
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ class Servant_Upcall;
+ }
+}
+
+namespace TAO
+{
+ /**
+ * @class ServerRequestInfo
+ *
+ * @brief Implementation of the
+ * @c PortableInterceptor::ServerRequestInfo IDL interface.
+ *
+ * Implementation of the @c PortableInterceptor::ServerRequestInfo
+ * IDL interface.
+ *
+ * @note This class is currently not meant to be reference counted
+ * since it is instantiated on the stack.
+ */
+ class ServerRequestInfo
+ : public virtual PortableInterceptor::ServerRequestInfo
+ , public virtual CORBA::LocalObject
+ {
+ public:
+
+ /// Constructor.
+ ServerRequestInfo (TAO_ServerRequest & server_request,
+ TAO::Argument * const * args,
+ size_t nargs,
+ void * servant_upcall,
+ CORBA::TypeCode_ptr const * exceptions,
+ CORBA::ULong nexceptions);
+
+ /// Return an ID unique to the current request. This request ID may
+ /// or may not be the same as the GIOP request ID.
+ virtual CORBA::ULong request_id (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Return the operation name for the current request.
+ virtual char * operation (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Return the list of arguments passed to the current operation.
+ virtual Dynamic::ParameterList * arguments (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Return the list of exceptions the current operation is capable
+ /// of throwing.
+ virtual Dynamic::ExceptionList * exceptions (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual Dynamic::ContextList * contexts (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual Dynamic::RequestContext * operation_context (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Return the result of the current request. If there is no
+ /// return value then an @c Any with @c tk_void @c TypeCode is
+ /// returned. This method is not valid for oneway operations.
+ virtual CORBA::Any * result (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Returns @c true for a two-way operation, and @c false otherwise.
+ virtual CORBA::Boolean response_expected (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Return the @c sync_scope policy value for the current one-way
+ /// operation. If the operation is not a one-way, a
+ /// @c CORBA::BAD_INV_ORDER exception is thrown.
+ virtual Messaging::SyncScope sync_scope (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Return the reply status for the current request.
+ /**
+ * Statuses can be @c PortableInterceptor::SUCCESSFUL,
+ * @c SYSTEM_EXCEPTION, @c USER_EXCEPTION, @c LOCATION_FORWARD,
+ * @c TRANSPORT_RETRY, @c UNKNOWN..
+ */
+ virtual PortableInterceptor::ReplyStatus reply_status (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// If the reply status is
+ /// @c PortableInterceptor::LOCATION_FORWARD return the
+ /// object reference to which the request was forwarded.
+ virtual CORBA::Object_ptr forward_reference (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException)) ;
+
+ /// Retrieve data from the "request scope" @c PICurrent object.
+ virtual CORBA::Any * get_slot (
+ PortableInterceptor::SlotId id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableInterceptor::InvalidSlot));
+
+ /// Return the @c IOP::ServiceContext with the given
+ /// @c IOP::ServiceId from the request service context list.
+ virtual IOP::ServiceContext * get_request_service_context (
+ IOP::ServiceId id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Return the @c IOP::ServiceContext with the given
+ /// @c IOP::ServiceId from the reply service context list.
+ virtual IOP::ServiceContext * get_reply_service_context (
+ IOP::ServiceId id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Return an @c Any containing the exception being sent, if any.
+ /// Otherwise, throw a @c CORBA::BAD_INV_ORDER exception.
+ /**
+ * @note There is no trivial way to extract the exception from an
+ * @c Any.
+ */
+ virtual CORBA::Any * sending_exception (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Return the @c ObjectId for the target object.
+ virtual PortableInterceptor::ObjectId * object_id (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Return the @c AdapterId for the POA handling the current
+ /// request.
+ virtual CORBA::OctetSeq * adapter_id (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Return the server_id of the server. The value is passed to
+ /// the ORB via @c -ORBServerId parameter.
+ virtual char * server_id (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Return the ORBId value that is passed to the @c ORB_init
+ /// call.
+ virtual char * orb_id (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Return the name of the object adapter that services requests
+ /// for the invoked object.
+ virtual PortableInterceptor::AdapterName * adapter_name (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Return the most derived interface of the target object.
+ virtual char * target_most_derived_interface (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Return the policy of the given type in effect for the current
+ /// request.
+ virtual CORBA::Policy_ptr get_server_policy (
+ CORBA::PolicyType type
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Insert data into the "request scope" @c PICurrent object.
+ virtual void set_slot (PortableInterceptor::SlotId id,
+ const CORBA::Any & data
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableInterceptor::InvalidSlot));
+
+ /// Returns true if the target's type corresponds to the given
+ /// @c RepositoryId.
+ virtual CORBA::Boolean target_is_a (const char * id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Add the @c IOP::ServiceContext to the reply (outgoing)
+ /// @c IOP::ServiceContextList.
+ virtual void add_reply_service_context (
+ const IOP::ServiceContext & service_context,
+ CORBA::Boolean replace
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ public:
+
+ /**
+ * @name Helper methods specific to TAO.
+ */
+ //@{
+
+ /// Extract the forward object reference from the
+ /// @c PortableInterceptor::ForwardRequest exception, and set the
+ /// reply status flag accordingly.
+ void forward_reference (PortableInterceptor::ForwardRequest &exc);
+
+ /// Set the forward reference associated with the current
+ /// LOCATION_FORWARD reply.
+ /**
+ * @note This method is only invoked when a
+ * @c PortableServer::ForwardRequest exception is thrown by a
+ * servant manager.
+ */
+ void forward_reference (CORBA::Object_ptr obj);
+
+ //@}
+
+ /// Return a reference to the underlying @c TAO_ServerRequest
+ /// object.
+ TAO_ServerRequest &server_request (void);
+
+ protected:
+
+ /// Helper method to get the request and response service
+ /// contexts.
+ IOP::ServiceContext * get_service_context_i (
+ TAO_Service_Context & service_context_list,
+ IOP::ServiceId id
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ protected:
+
+ /// Underlying request object that contains much of the
+ /// information encapsulated by this @c ServerRequestInfo
+ /// implementation.
+ TAO_ServerRequest & server_request_;
+
+ /// Operation argument list.
+ TAO::Argument * const * const args_;
+
+ /// Number of element in the operation argument list.
+ size_t const nargs_;
+
+ /// Pointer to the @c Servant_Upcall object that contains the
+ /// object ID, among other things.
+ TAO::Portable_Server::Servant_Upcall * const servant_upcall_;
+
+ /// Array of @c TypeCodes for user exceptions the operation is
+ /// capable of raising.
+ CORBA::TypeCode_ptr const * const exceptions_;
+
+ /// The number of elements in the @c exceptions_ array.
+ CORBA::ULong const nexceptions_;
+ };
+
+} // End namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+# if defined (__ACE_INLINE__)
+# include "tao/PI_Server/ServerRequestInfo.inl"
+# endif /* __ACE_INLINE__ */
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_SERVER_REQUEST_INFO_H */
diff --git a/TAO/tao/PI_Server/ServerRequestInfo.inl b/TAO/tao/PI_Server/ServerRequestInfo.inl
new file mode 100644
index 00000000000..09985532ba8
--- /dev/null
+++ b/TAO/tao/PI_Server/ServerRequestInfo.inl
@@ -0,0 +1,60 @@
+// -*- C++ -*-
+//
+// $Id$
+
+#include "tao/PortableServer/Servant_Upcall.h"
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO::ServerRequestInfo::ServerRequestInfo (
+ TAO_ServerRequest & server_request,
+ TAO::Argument * const * args,
+ size_t nargs,
+ void * servant_upcall,
+ CORBA::TypeCode_ptr const * exceptions,
+ CORBA::ULong nexceptions)
+ : server_request_ (server_request)
+ , args_ (args)
+ , nargs_ (nargs)
+ , servant_upcall_ (
+ static_cast<TAO::Portable_Server::Servant_Upcall *> (servant_upcall))
+ , exceptions_ (exceptions)
+ , nexceptions_ (nexceptions)
+{
+}
+
+ACE_INLINE void
+TAO::ServerRequestInfo::forward_reference (
+ PortableInterceptor::ForwardRequest &exc)
+{
+ // Note that we're converting the ForwardRequest exception in to a
+ // LOCATION_FORWARD reply, so we do not set the exception status.
+
+ this->server_request_.reply_status (PortableInterceptor::LOCATION_FORWARD);
+
+ // Store the forward reference in the TAO_ServerRequest object.
+ this->server_request_.forward_location (exc.forward.in ());
+}
+
+ACE_INLINE void
+TAO::ServerRequestInfo::forward_reference (CORBA::Object_ptr obj)
+{
+ // We only get here if a servant manager threw a
+ // PortableServer::ForwardRequest exception.
+
+ this->server_request_.reply_status (PortableInterceptor::LOCATION_FORWARD);
+
+ // Store the forward reference in the TAO_ServerRequest object.
+ this->server_request_.forward_location (obj);
+}
+
+ACE_INLINE TAO_ServerRequest &
+TAO::ServerRequestInfo::server_request (void)
+{
+ return this->server_request_;
+}
+
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PI_Server/ServerRequestInfo.pidl b/TAO/tao/PI_Server/ServerRequestInfo.pidl
new file mode 100644
index 00000000000..9679b29c2e8
--- /dev/null
+++ b/TAO/tao/PI_Server/ServerRequestInfo.pidl
@@ -0,0 +1,51 @@
+// -*- IDL -*-
+
+/**
+ * @file ServerRequestInfo.pidl
+ *
+ * $Id$
+ *
+ * @brief Pre-compiled RequestInfo
+ *
+ * This file was used to generate the code in ServerRequestInfoC.*
+ * The command used to generate code is:
+ *
+ * tao_idl
+ * -o orig -Gp -Gd -Ge 1 -GA -SS -Sci
+ * -Wb,export_include="tao/TAO_Export.h"
+ * -Wb,export_macro=TAO_Export
+ * -Wb,pre_include="ace/pre.h"
+ * -Wb,post_include="ace/post.h"
+ * ServerRequestInfo.pidl
+ */
+
+#ifndef _SERVER_REQUESTINFO_PIDL_
+#define _SERVER_REQUESTINFO_PIDL_
+
+#include "tao/PI/RequestInfo.pidl"
+#include "tao/orb_types.pidl"
+#include "tao/Policy_Forward.pidl"
+
+module PortableInterceptor {
+
+ typeprefix PortableInterceptor "omg.org";
+
+ local interface ServerRequestInfo : RequestInfo
+ {
+ readonly attribute any sending_exception;
+ readonly attribute ServerId server_id;
+ readonly attribute ORBId orb_id;
+ readonly attribute AdapterName adapter_name;
+ readonly attribute ObjectId object_id;
+ readonly attribute CORBA::OctetSeq adapter_id;
+ readonly attribute CORBA::RepositoryId target_most_derived_interface;
+ CORBA::Policy get_server_policy (in CORBA::PolicyType type);
+ void set_slot (in SlotId id, in any data) raises (InvalidSlot);
+ boolean target_is_a (in CORBA::RepositoryId id);
+ void add_reply_service_context (
+ in IOP::ServiceContext service_context,
+ in boolean replace);
+ };
+};
+
+#endif /* _SERVER_REQUESTINFO_PIDL_ */
diff --git a/TAO/tao/PI_Server/ServerRequestInterceptor.pidl b/TAO/tao/PI_Server/ServerRequestInterceptor.pidl
new file mode 100644
index 00000000000..40d2e9d53e2
--- /dev/null
+++ b/TAO/tao/PI_Server/ServerRequestInterceptor.pidl
@@ -0,0 +1,51 @@
+// -*- IDL -*-
+
+/**
+ * @file ServerRequestInterceptor.pidl
+ *
+ * $Id$
+ *
+ * @brief Pre-compiled IDL source for the PortableInterceptor
+ * components in the ORB.
+ *
+ * This file was used to generate the code in ServerRequestInterceptorC.*
+ * The command used to generate code is:
+ *
+ * tao_idl
+ * -o orig -Gp -Gd -Ge 1 -GA -SS -Sci
+ * -Wb,export_include="tao/PI_Server/pi_server_export.h"
+ * -Wb,export_macro=TAO_PI_Server_Export
+ * -Wb,pre_include="ace/pre.h"
+ * -Wb,post_include="ace/post.h"
+ * ServerRequestInterceptor.pidl
+ *
+ * Patches for changes to the generated code are available in the
+ * `diffs' directory.
+ */
+
+#ifndef _SERVER_REQUEST_INTERCEPTOR_IDL_
+#define _SERVER_REQUEST_INTERCEPTOR_IDL_
+
+#include "tao/PI/Interceptor.pidl"
+#include "tao/PI/PIForwardRequest.pidl"
+#include "tao/OctetSeq.pidl"
+
+module PortableInterceptor {
+
+ typeprefix PortableInterceptor "omg.org";
+
+ local interface ServerRequestInfo;
+
+ local interface ServerRequestInterceptor : Interceptor
+ {
+ /// Proprietary method in TAO for fault tolerance
+ void tao_ft_interception_point (in ServerRequestInfo ri, out CORBA::OctetSeq os) raises (ForwardRequest);
+ void receive_request_service_contexts (in ServerRequestInfo ri) raises (ForwardRequest);
+ void receive_request (in ServerRequestInfo ri) raises (ForwardRequest);
+ void send_reply (in ServerRequestInfo ri);
+ void send_exception (in ServerRequestInfo ri) raises (ForwardRequest);
+ void send_other (in ServerRequestInfo ri) raises (ForwardRequest);
+ };
+};
+
+#endif /* _SERVER_REQUEST_INTERCEPTOR_IDL_ */
diff --git a/TAO/tao/PI_Server/ServerRequestInterceptorA.cpp b/TAO/tao/PI_Server/ServerRequestInterceptorA.cpp
new file mode 100644
index 00000000000..8f5dfb63340
--- /dev/null
+++ b/TAO/tao/PI_Server/ServerRequestInterceptorA.cpp
@@ -0,0 +1,58 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+#include "tao/PI_Server/ServerRequestInterceptorA.h"
+#include "tao/AnyTypeCode/Null_RefCount_Policy.h"
+#include "tao/AnyTypeCode/TypeCode_Constants.h"
+#include "tao/AnyTypeCode/Alias_TypeCode_Static.h"
+#include "tao/AnyTypeCode/Objref_TypeCode_Static.h"
+#include "tao/AnyTypeCode/String_TypeCode_Static.h"
+#include "tao/AnyTypeCode/Any.h"
+#include "tao/CDR.h"
+#include "tao/AnyTypeCode/Any.h"
+#include "tao/AnyTypeCode/Any_Impl_T.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/objref_typecode.cpp:76
+
+static TAO::TypeCode::Objref<char const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_PortableInterceptor_ServerRequestInterceptor (
+ ::CORBA::tk_local_interface,
+ "IDL:omg.org/PortableInterceptor/ServerRequestInterceptor:1.0",
+ "ServerRequestInterceptor");
+
+namespace PortableInterceptor
+{
+ ::CORBA::TypeCode_ptr const _tc_ServerRequestInterceptor =
+ &_tao_tc_PortableInterceptor_ServerRequestInterceptor;
+}
+
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PI_Server/ServerRequestInterceptorA.h b/TAO/tao/PI_Server/ServerRequestInterceptorA.h
new file mode 100644
index 00000000000..6ed94797f14
--- /dev/null
+++ b/TAO/tao/PI_Server/ServerRequestInterceptorA.h
@@ -0,0 +1,65 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:754
+
+#ifndef _TAO_IDL_SERVERREQUESTINTERCEPTORA_H_
+#define _TAO_IDL_SERVERREQUESTINTERCEPTORA_H_
+
+#include /**/ "ace/pre.h"
+
+#include "tao/PI_Server/pi_server_export.h"
+#include "tao/PI_Server/ServerRequestInterceptorC.h"
+#include "tao/PI/InterceptorA.h"
+#include "tao/PI/PIForwardRequestA.h"
+#include "tao/AnyTypeCode/OctetSeqA.h"
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_module/module_ch.cpp:59
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace PortableInterceptor
+{
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:49
+
+ extern TAO_PI_Server_Export ::CORBA::TypeCode_ptr const _tc_ServerRequestInterceptor;
+
+// TAO_IDL - Generated from
+// be\be_visitor_module/module_ch.cpp:86
+
+} // module PortableInterceptor
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* ifndef */
diff --git a/TAO/tao/PI_Server/ServerRequestInterceptorC.cpp b/TAO/tao/PI_Server/ServerRequestInterceptorC.cpp
new file mode 100644
index 00000000000..6b2190b9629
--- /dev/null
+++ b/TAO/tao/PI_Server/ServerRequestInterceptorC.cpp
@@ -0,0 +1,173 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:277
+
+
+#include "tao/PI_Server/ServerRequestInterceptorC.h"
+#include "tao/CDR.h"
+#include "tao/ORB_Core.h"
+#include "ace/OS_NS_string.h"
+
+// TAO_IDL - Generated from
+// be\be_visitor_arg_traits.cpp:70
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Arg traits specializations.
+namespace TAO
+{
+}
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/interface_cs.cpp:60
+
+// Traits specializations for PortableInterceptor::ServerRequestInterceptor.
+
+PortableInterceptor::ServerRequestInterceptor_ptr
+TAO::Objref_Traits<PortableInterceptor::ServerRequestInterceptor>::duplicate (
+ PortableInterceptor::ServerRequestInterceptor_ptr p
+ )
+{
+ return PortableInterceptor::ServerRequestInterceptor::_duplicate (p);
+}
+
+void
+TAO::Objref_Traits<PortableInterceptor::ServerRequestInterceptor>::release (
+ PortableInterceptor::ServerRequestInterceptor_ptr p
+ )
+{
+ ::CORBA::release (p);
+}
+
+PortableInterceptor::ServerRequestInterceptor_ptr
+TAO::Objref_Traits<PortableInterceptor::ServerRequestInterceptor>::nil (void)
+{
+ return PortableInterceptor::ServerRequestInterceptor::_nil ();
+}
+
+::CORBA::Boolean
+TAO::Objref_Traits<PortableInterceptor::ServerRequestInterceptor>::marshal (
+ PortableInterceptor::ServerRequestInterceptor_ptr p,
+ TAO_OutputCDR & cdr
+ )
+{
+ return ::CORBA::Object::marshal (p, cdr);
+}
+
+PortableInterceptor::ServerRequestInterceptor::ServerRequestInterceptor (void)
+{}
+
+PortableInterceptor::ServerRequestInterceptor::~ServerRequestInterceptor (void)
+{}
+
+PortableInterceptor::ServerRequestInterceptor_ptr
+PortableInterceptor::ServerRequestInterceptor::_narrow (
+ ::CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return ServerRequestInterceptor::_duplicate (
+ dynamic_cast<ServerRequestInterceptor_ptr> (_tao_objref)
+ );
+}
+
+PortableInterceptor::ServerRequestInterceptor_ptr
+PortableInterceptor::ServerRequestInterceptor::_unchecked_narrow (
+ ::CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return ServerRequestInterceptor::_duplicate (
+ dynamic_cast<ServerRequestInterceptor_ptr> (_tao_objref)
+ );
+}
+
+PortableInterceptor::ServerRequestInterceptor_ptr
+PortableInterceptor::ServerRequestInterceptor::_duplicate (ServerRequestInterceptor_ptr obj)
+{
+ if (! ::CORBA::is_nil (obj))
+ {
+ obj->_add_ref ();
+ }
+
+ return obj;
+}
+
+void
+PortableInterceptor::ServerRequestInterceptor::_tao_release (ServerRequestInterceptor_ptr obj)
+{
+ ::CORBA::release (obj);
+}
+
+::CORBA::Boolean
+PortableInterceptor::ServerRequestInterceptor::_is_a (
+ const char *value
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ if (
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/PortableInterceptor/Interceptor:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/PortableInterceptor/ServerRequestInterceptor:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/LocalObject:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/Object:1.0"
+ )
+ )
+ {
+ return true; // success using local knowledge
+ }
+ else
+ {
+ return false;
+ }
+}
+
+const char* PortableInterceptor::ServerRequestInterceptor::_interface_repository_id (void) const
+{
+ return "IDL:omg.org/PortableInterceptor/ServerRequestInterceptor:1.0";
+}
+
+::CORBA::Boolean
+PortableInterceptor::ServerRequestInterceptor::marshal (TAO_OutputCDR &)
+{
+ return false;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PI_Server/ServerRequestInterceptorC.h b/TAO/tao/PI_Server/ServerRequestInterceptorC.h
new file mode 100644
index 00000000000..ec784b9d706
--- /dev/null
+++ b/TAO/tao/PI_Server/ServerRequestInterceptorC.h
@@ -0,0 +1,314 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:154
+
+#ifndef _TAO_IDL_SERVERREQUESTINTERCEPTORC_H_
+#define _TAO_IDL_SERVERREQUESTINTERCEPTORC_H_
+
+#include /**/ "ace/pre.h"
+
+
+#include "ace/config-all.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PI_Server/pi_server_export.h"
+#include "tao/ORB.h"
+#include "tao/SystemException.h"
+#include "tao/Environment.h"
+#include "tao/Object.h"
+#include "tao/Objref_VarOut_T.h"
+
+#include "tao/PI/InterceptorC.h"
+#include "tao/PI/PIForwardRequestC.h"
+#include "tao/OctetSeqC.h"
+
+#if defined (TAO_EXPORT_MACRO)
+#undef TAO_EXPORT_MACRO
+#endif
+#define TAO_EXPORT_MACRO TAO_PI_Server_Export
+
+// TAO_IDL - Generated from
+// be\be_visitor_module/module_ch.cpp:49
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace PortableInterceptor
+{
+
+ // TAO_IDL - Generated from
+ // be\be_interface.cpp:646
+
+#if !defined (_PORTABLEINTERCEPTOR_SERVERREQUESTINFO__VAR_OUT_CH_)
+#define _PORTABLEINTERCEPTOR_SERVERREQUESTINFO__VAR_OUT_CH_
+
+ class ServerRequestInfo;
+ typedef ServerRequestInfo *ServerRequestInfo_ptr;
+
+ typedef
+ TAO_Objref_Var_T<
+ ServerRequestInfo
+ >
+ ServerRequestInfo_var;
+
+ typedef
+ TAO_Objref_Out_T<
+ ServerRequestInfo
+ >
+ ServerRequestInfo_out;
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_interface.cpp:646
+
+#if !defined (_PORTABLEINTERCEPTOR_SERVERREQUESTINTERCEPTOR__VAR_OUT_CH_)
+#define _PORTABLEINTERCEPTOR_SERVERREQUESTINTERCEPTOR__VAR_OUT_CH_
+
+ class ServerRequestInterceptor;
+ typedef ServerRequestInterceptor *ServerRequestInterceptor_ptr;
+
+ typedef
+ TAO_Objref_Var_T<
+ ServerRequestInterceptor
+ >
+ ServerRequestInterceptor_var;
+
+ typedef
+ TAO_Objref_Out_T<
+ ServerRequestInterceptor
+ >
+ ServerRequestInterceptor_out;
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:54
+
+#if !defined (_PORTABLEINTERCEPTOR_SERVERREQUESTINTERCEPTOR_CH_)
+#define _PORTABLEINTERCEPTOR_SERVERREQUESTINTERCEPTOR_CH_
+
+ class TAO_PI_Server_Export ServerRequestInterceptor
+ : public virtual ::PortableInterceptor::Interceptor
+ {
+ public:
+ typedef ServerRequestInterceptor_ptr _ptr_type;
+ typedef ServerRequestInterceptor_var _var_type;
+
+ // The static operations.
+ static ServerRequestInterceptor_ptr _duplicate (ServerRequestInterceptor_ptr obj);
+
+ static void _tao_release (ServerRequestInterceptor_ptr obj);
+
+ static ServerRequestInterceptor_ptr _narrow (
+ ::CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static ServerRequestInterceptor_ptr _unchecked_narrow (
+ ::CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static ServerRequestInterceptor_ptr _nil (void)
+ {
+ return static_cast<ServerRequestInterceptor_ptr> (0);
+ }
+
+
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+#if TAO_HAS_EXTENDED_FT_INTERCEPTORS == 1
+
+ virtual void tao_ft_interception_point (
+ ::PortableInterceptor::ServerRequestInfo_ptr ri,
+ ::CORBA::OctetSeq_out os
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+ ACE_THROW_SPEC ((
+ ::CORBA::SystemException,
+ ::PortableInterceptor::ForwardRequest
+ )) {}
+
+#endif /* TAO_HAS_EXTENDED_FT_INTERCEPTORS */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void receive_request_service_contexts (
+ ::PortableInterceptor::ServerRequestInfo_ptr ri
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ ::CORBA::SystemException,
+ ::PortableInterceptor::ForwardRequest
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void receive_request (
+ ::PortableInterceptor::ServerRequestInfo_ptr ri
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ ::CORBA::SystemException,
+ ::PortableInterceptor::ForwardRequest
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void send_reply (
+ ::PortableInterceptor::ServerRequestInfo_ptr ri
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ ::CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void send_exception (
+ ::PortableInterceptor::ServerRequestInfo_ptr ri
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ ::CORBA::SystemException,
+ ::PortableInterceptor::ForwardRequest
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void send_other (
+ ::PortableInterceptor::ServerRequestInfo_ptr ri
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ ::CORBA::SystemException,
+ ::PortableInterceptor::ForwardRequest
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:210
+
+ virtual ::CORBA::Boolean _is_a (
+ const char *type_id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ virtual const char* _interface_repository_id (void) const;
+ virtual ::CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+
+ protected:
+ // Abstract or local interface only.
+ ServerRequestInterceptor (void);
+
+ virtual ~ServerRequestInterceptor (void);
+
+ private:
+ // Private and unimplemented for concrete interfaces.
+ ServerRequestInterceptor (const ServerRequestInterceptor &);
+
+ void operator= (const ServerRequestInterceptor &);
+ };
+
+#endif /* end #if !defined */
+
+// TAO_IDL - Generated from
+// be\be_visitor_module/module_ch.cpp:78
+
+} // module PortableInterceptor
+
+// TAO_IDL - Generated from
+// be\be_visitor_traits.cpp:61
+
+// Traits specializations.
+namespace TAO
+{
+
+#if !defined (_PORTABLEINTERCEPTOR_SERVERREQUESTINFO__TRAITS_)
+#define _PORTABLEINTERCEPTOR_SERVERREQUESTINFO__TRAITS_
+
+ template<>
+ struct TAO_PI_Server_Export Objref_Traits< ::PortableInterceptor::ServerRequestInfo>
+ {
+ static ::PortableInterceptor::ServerRequestInfo_ptr duplicate (
+ ::PortableInterceptor::ServerRequestInfo_ptr
+ );
+ static void release (
+ ::PortableInterceptor::ServerRequestInfo_ptr
+ );
+ static ::PortableInterceptor::ServerRequestInfo_ptr nil (void);
+ static ::CORBA::Boolean marshal (
+ ::PortableInterceptor::ServerRequestInfo_ptr p,
+ TAO_OutputCDR & cdr
+ );
+ };
+
+#endif /* end #if !defined */
+
+#if !defined (_PORTABLEINTERCEPTOR_SERVERREQUESTINTERCEPTOR__TRAITS_)
+#define _PORTABLEINTERCEPTOR_SERVERREQUESTINTERCEPTOR__TRAITS_
+
+ template<>
+ struct TAO_PI_Server_Export Objref_Traits< ::PortableInterceptor::ServerRequestInterceptor>
+ {
+ static ::PortableInterceptor::ServerRequestInterceptor_ptr duplicate (
+ ::PortableInterceptor::ServerRequestInterceptor_ptr
+ );
+ static void release (
+ ::PortableInterceptor::ServerRequestInterceptor_ptr
+ );
+ static ::PortableInterceptor::ServerRequestInterceptor_ptr nil (void);
+ static ::CORBA::Boolean marshal (
+ ::PortableInterceptor::ServerRequestInterceptor_ptr p,
+ TAO_OutputCDR & cdr
+ );
+ };
+
+#endif /* end #if !defined */
+}
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:1040
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* ifndef */
+
+
diff --git a/TAO/tao/PI_Server/ServerRequestInterceptorS.h b/TAO/tao/PI_Server/ServerRequestInterceptorS.h
new file mode 100644
index 00000000000..17b1360599e
--- /dev/null
+++ b/TAO/tao/PI_Server/ServerRequestInterceptorS.h
@@ -0,0 +1,28 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// Skeleton file generation suppressed with command line option -SS
diff --git a/TAO/tao/PI_Server/ServerRequestInterceptor_Factory_Impl.cpp b/TAO/tao/PI_Server/ServerRequestInterceptor_Factory_Impl.cpp
new file mode 100644
index 00000000000..37b51488606
--- /dev/null
+++ b/TAO/tao/PI_Server/ServerRequestInterceptor_Factory_Impl.cpp
@@ -0,0 +1,50 @@
+/* -*- C++ -*- */
+
+// =================================================================
+/**
+ * @file ServerRequestInterceptor_Factory_Impl.cpp
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ *
+ */
+// =================================================================
+
+#include "tao/PI_Server/ServerRequestInterceptor_Factory_Impl.h"
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+#include "tao/PI_Server/ServerInterceptorAdapter.h"
+
+#include "tao/ORB.h"
+#include "tao/debug.h"
+
+ACE_RCSID (PI_Server,
+ PolicyFactory_Loader,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO::ServerRequestInterceptor_Adapter*
+TAO_ServerRequestInterceptor_Adapter_Factory_Impl::create (void)
+{
+ TAO::ServerRequestInterceptor_Adapter_Impl* obj = 0;
+ ACE_NEW_RETURN (obj,
+ TAO::ServerRequestInterceptor_Adapter_Impl ,
+ 0);
+ return obj;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DEFINE (TAO_ServerRequestInterceptor_Adapter_Factory_Impl,
+ ACE_TEXT ("ServerRequestInterceptor_Adapter_Factory"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (TAO_ServerRequestInterceptor_Adapter_Factory_Impl),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0)
+ACE_FACTORY_DEFINE (TAO_PI_Server, TAO_ServerRequestInterceptor_Adapter_Factory_Impl)
+
+#endif /* TAO_HAS_INTERCEPTORS */
diff --git a/TAO/tao/PI_Server/ServerRequestInterceptor_Factory_Impl.h b/TAO/tao/PI_Server/ServerRequestInterceptor_Factory_Impl.h
new file mode 100644
index 00000000000..9cd5e06128f
--- /dev/null
+++ b/TAO/tao/PI_Server/ServerRequestInterceptor_Factory_Impl.h
@@ -0,0 +1,55 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file ServerRequestInterceptor_Factory_Impl.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+
+#ifndef TAO_SERVERREQUESTINTERCEPTOR_ADAPTER_FACTORY_IMPL_H
+#define TAO_SERVERREQUESTINTERCEPTOR_ADAPTER_FACTORY_IMPL_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/PI_Server/pi_server_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/orbconf.h"
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+#include "ace/Service_Config.h"
+#include "tao/ServerRequestInterceptor_Adapter_Factory.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ class ServerRequestInterceptor_Adapter;
+}
+
+class TAO_PI_Server_Export TAO_ServerRequestInterceptor_Adapter_Factory_Impl
+ : public TAO_ServerRequestInterceptor_Adapter_Factory
+{
+public:
+ virtual TAO::ServerRequestInterceptor_Adapter *create (void);
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE (TAO_ServerRequestInterceptor_Adapter_Factory_Impl)
+ACE_FACTORY_DECLARE (TAO_PI_Server, TAO_ServerRequestInterceptor_Adapter_Factory_Impl)
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_SERVERREQUESTINTERCEPTOR_ADAPTER_FACTORY_IMPL_H */
diff --git a/TAO/tao/PI_Server/TAO_PI_Server.pc.in b/TAO/tao/PI_Server/TAO_PI_Server.pc.in
new file mode 100644
index 00000000000..531f32938de
--- /dev/null
+++ b/TAO/tao/PI_Server/TAO_PI_Server.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: TAO_PI_Server
+Description: TAO PI Server Library
+Requires: TAO_PortableServer, TAO_PI, TAO_CodecFactory, TAO_AnyTypeCode, TAO
+Version: @VERSION@
+Libs: -L${libdir} -lTAO_PI_Server
+Cflags: -I${includedir}
diff --git a/TAO/tao/PI_Server/diffs/ServerRequestInterceptor.diff b/TAO/tao/PI_Server/diffs/ServerRequestInterceptor.diff
new file mode 100644
index 00000000000..f3fc423c81a
--- /dev/null
+++ b/TAO/tao/PI_Server/diffs/ServerRequestInterceptor.diff
@@ -0,0 +1,24 @@
+--- orig/ServerRequestInterceptorC.h 2005-05-17 13:50:41.646918400 +0200
++++ ServerRequestInterceptorC.h 2005-05-17 14:00:40.237649600 +0200
+@@ -155,15 +155,19 @@
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
++#if TAO_HAS_EXTENDED_FT_INTERCEPTORS == 1
++
+ virtual void tao_ft_interception_point (
+ ::PortableInterceptor::ServerRequestInfo_ptr ri,
+ ::CORBA::OctetSeq_out os
+- ACE_ENV_ARG_DECL_WITH_DEFAULTS
++ ACE_ENV_ARG_DECL_NOT_USED
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ ::PortableInterceptor::ForwardRequest
+- )) = 0;
++ )) {}
++
++#endif /* TAO_HAS_EXTENDED_FT_INTERCEPTORS */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
diff --git a/TAO/tao/PI_Server/pi_server_export.h b/TAO/tao/PI_Server/pi_server_export.h
new file mode 100644
index 00000000000..01a9c75af1c
--- /dev/null
+++ b/TAO/tao/PI_Server/pi_server_export.h
@@ -0,0 +1,40 @@
+
+// -*- C++ -*-
+// $Id$
+// Definition for Win32 Export directives.
+// This file is generated automatically by generate_export_file.pl
+// ------------------------------
+#ifndef TAO_PI_SERVER_EXPORT_H
+#define TAO_PI_SERVER_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if defined (TAO_AS_STATIC_LIBS)
+# if !defined (TAO_PI_SERVER_HAS_DLL)
+# define TAO_PI_SERVER_HAS_DLL 0
+# endif /* ! TAO_PI_SERVER_HAS_DLL */
+#else
+# if !defined (TAO_PI_SERVER_HAS_DLL)
+# define TAO_PI_SERVER_HAS_DLL 1
+# endif /* ! TAO_PI_SERVER_HAS_DLL */
+#endif
+
+#if defined (TAO_PI_SERVER_HAS_DLL) && (TAO_PI_SERVER_HAS_DLL == 1)
+# if defined (TAO_PI_SERVER_BUILD_DLL)
+# define TAO_PI_Server_Export ACE_Proper_Export_Flag
+# define TAO_PI_SERVER_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# define TAO_PI_SERVER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# else /* TAO_PI_SERVER_BUILD_DLL */
+# define TAO_PI_Server_Export ACE_Proper_Import_Flag
+# define TAO_PI_SERVER_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# define TAO_PI_SERVER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# endif /* TAO_PI_SERVER_BUILD_DLL */
+#else /* TAO_PI_SERVER_HAS_DLL == 1 */
+# define TAO_PI_Server_Export
+# define TAO_PI_SERVER_SINGLETON_DECLARATION(T)
+# define TAO_PI_SERVER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+#endif /* TAO_PI_SERVER_HAS_DLL == 1 */
+
+#endif /* TAO_PI_SERVER_EXPORT_H */
+
+// End of auto generated file.
diff --git a/TAO/tao/PP_Memory_Management.txt b/TAO/tao/PP_Memory_Management.txt
new file mode 100644
index 00000000000..f9516139582
--- /dev/null
+++ b/TAO/tao/PP_Memory_Management.txt
@@ -0,0 +1,136 @@
+/**
+
+@page PP_Memory_Management Memory Management Rules for TAO's Pluggable Protocol Framework
+
+@section background Background
+
+ This document proposes a clearer set of memory management rules
+ for the pluggable protocols framework.
+ To understand this proposal some basic background on how does the
+ pluggable protocol framework works, and how each abstraction
+ relates to the other components in the ORB.
+
+ The pluggable protocol framework uses the Acceptor and Connector
+ patterns, unlike ACE, however, it must treat all of them
+ homogenously.
+ The basic abstraction in TAO's pluggable protocol framework is the
+ <CODE>TAO_Transport</CODE>,
+ an instance of this class represents a single connection, for
+ example, the IIOP plugin uses one instance of TAO_Transport for
+ each socket.
+ To integrate this abstraction with the ACE_Reactor framework,
+ all the protocols implemented so far use
+ specializations of the ACE_Svc_Handler class.
+ However, the original design considered the possibility of using
+ protocols without any ACE abstractions, though in practice this
+ hasn't happenned so far,
+ all changes to the framework should keep this possibility open.
+
+ This is the main source of memory management problems in the
+ pluggable protocol framework:
+ a single entity (a connection) is represented by two instances of
+ two separate classes. On one side the ORB uses an instance of the
+ TAO_Transport abstraction, on the other the Reactor uses an
+ instance of an ACE_Svc_Handler.
+
+ To complicate matters even further the ORB caches both passively
+ accepted and actively established connections.
+ The actively established connections are cached by the client-side
+ to minimize or amortize the cost of connection establishment.
+ The passively accepted connections are kept in the same cache
+ mainly to support bi-directional GIOP, however, they also allow us
+ to close both accepted and established idle connections using a
+ single component, this is useful when the ORB shutdowns, but it is
+ crucial in the implementation of connection recycling strategies,
+ where the total number of connections kept by the ORB must be
+ known.
+
+ The design must also support multithreaded clients and servers, in
+ both cases multiple threads may be using a connection
+ simultaneously, for example, multiple client threads can be
+ waiting for replys over the same connection, or multiple server
+ threads can be servicing requests received on the same connection,
+ or, if bi-dir GIOP is enabled, maybe a mix of both.
+
+ Some aspects of the GIOP protocol require special treatment of
+ connections with pending requests, both on the server and client
+ side.
+ On the server side connections that have pending requests cannot
+ be closed (section 15.5.1.1 in the CORBA/IIOP 2.4 specification),
+ therefore, the ORB needs to know how many requests are pending, at
+ all times.
+ Despite this, it is possible that the underlying connection is
+ broken, for example, because the client crashed. In such cases,
+ the ORB should be able to reclaim the OS resources, but the
+ TAO_Transport must remain valid until the upcall threads finish.
+ Similarly, the client side should be able to distinguish between
+ orderly and abortive disconnects, essentially the ORB needs to
+ know if a <CODE>CloseConnection</CODE> message has been received.
+
+ Finally we must never forget that the ORB can be used in
+ thread-per-connection mode. In this concurrency model there is no
+ reactor used to detect when the connection can accept more input,
+ though normally this is a global setting, it is possible for a
+ pluggable protocol to *always* work in thread-per-connection and
+ no other architecture.
+ Similarly, the ORB can be configured to wait for replys using
+ read() operations, instead of the more generic wait-on-reactor or
+ wait-on-leader-follower strategies.
+ Therefore, we cannot always rely on the Reactor framework to
+ perform all the memory management for us.
+
+@section requirements Requirements
+
+ To summarize, the TAO_Transport class should:
+
+ - Not be deleted until all threads using it is released by all the
+ threads using it.
+ - As many OS and ORB resources must be released when the ORB
+ detects that the connection has been terminated. For example,
+ the socket should be closed and the ACE_Svc_Handler, if any,
+ should be destroyed.
+ - Not be deleted until it is removed from the connection cache.
+ - Support a mechanism to proactively close the connection.
+ - Keep track of the number of pending requests in a connection.
+
+@section rules Memory Management Rules
+
+ Instances of TAO_Transport are reference counted,
+ this is a simple way to share it among the threads using it to
+ send or receive invocations, the cache, and the potential
+ connection handler using it.
+ However, the service handler should follow the standard rules for
+ the Reactor, i.e. the Reactor owns it, and is destroyed as soon as
+ the connection is closed.
+
+ The underlying connection can be closed by the remote peer,
+ in this case, either the Reactor or the thread blocked on
+ <CODE>read()</CODE> will detect the problem.
+ Following the normal conventions, the ACE_Svc_Handler would be
+ closed as soon as this is detected.
+ The corresponding TAO_Transport must be informed, otherwise it
+ could attempt to use a connection already closed.
+
+ Finally if the connection is proactively closed, the TAO_Transport
+ informs the ACE_Svc_Handler, at this point the ACE_Svc_Handler
+ commits suicide by removing itself from the reactor.
+ Notice that it must still callback the TAO_Transport in this
+ case.
+
+@section data Processing Incoming and Outgoing Data
+
+ The final aspect to consider is the processing of incoming and
+ outgoing data. We are still working on this problem, but the
+ current approach is more complex than it has to be.
+ The usual path is as follows: the Reactor signals (via
+ handle_input) that there is some data available in the socket.
+ The message is forwarded from the ACE_Svc_Handler to the
+ TAO_Transport, then to several helper classes in the pluggable
+ protocol framework. Eventually a method is invoked on the
+ TAO_Tranport to read the actual data, this forwards on the
+ ACE_Svc_Handler (again), and eventually returns.
+
+ A much simpler approach would be to read the data on the
+ handle_input() method itself, and forward the data up the stream.
+
+*/
diff --git a/TAO/tao/ParameterMode.pidl b/TAO/tao/ParameterMode.pidl
new file mode 100644
index 00000000000..2fb02fa70f4
--- /dev/null
+++ b/TAO/tao/ParameterMode.pidl
@@ -0,0 +1,37 @@
+// -*- IDL -*-
+
+// ================================================================
+/**
+ * @file ParameterMode.pidl
+ *
+ * $Id$
+ *
+ * This file was used to generate the code in ParameterModeC.* The command
+ * used to generate code is:
+ *
+ * tao_idl
+ * -o orig -Ge 1 -GA -SS -Sci
+ * -Wb,export_macro=TAO_Export
+ * -Wb,export_include="tao/TAO_Export.h"
+ * -Wb,pre_include="ace/pre.h"
+ * -Wb,post_include="ace/post.h"
+ * ParameterMode.pidl
+ */
+// ================================================================
+
+#ifndef TAO_PARAMETERMODE_IDL
+#define TAO_PARAMETERMODE_IDL
+
+#pragma prefix "omg.org"
+
+module CORBA
+{
+ enum ParameterMode
+ {
+ PARAM_IN,
+ PARAM_OUT,
+ PARAM_INOUT
+ };
+};
+
+#endif /* TAO_PARAMETERMODE_IDL */
diff --git a/TAO/tao/Parser_Registry.cpp b/TAO/tao/Parser_Registry.cpp
new file mode 100644
index 00000000000..7b21273679e
--- /dev/null
+++ b/TAO/tao/Parser_Registry.cpp
@@ -0,0 +1,78 @@
+// $Id$
+
+#include "tao/Parser_Registry.h"
+#include "tao/IOR_Parser.h"
+#include "tao/ORB_Core.h"
+
+#include "ace/Dynamic_Service.h"
+
+#if !defined(__ACE_INLINE__)
+#include "tao/Parser_Registry.i"
+#endif /* __ACE_INLINE__ */
+
+ACE_RCSID (tao,
+ Parser_Registry,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Parser_Registry::TAO_Parser_Registry (void)
+ : parsers_ (0),
+ size_ (0)
+{
+}
+
+TAO_Parser_Registry::~TAO_Parser_Registry (void)
+{
+ delete [] this->parsers_;
+}
+
+int
+TAO_Parser_Registry::open (TAO_ORB_Core *orb_core)
+{
+ char **names;
+ int number_of_names = 0;
+
+ orb_core->resource_factory ()->get_parser_names (names,
+ number_of_names);
+
+ if (number_of_names == 0)
+ {
+ return -1;
+ }
+
+ this->size_ = number_of_names;
+ ACE_NEW_RETURN (this->parsers_,
+ TAO_IOR_Parser*[this->size_],
+ -1);
+
+ for (size_t i = 0; i != this->size_; ++i)
+ {
+ this->parsers_[i] =
+ ACE_Dynamic_Service<TAO_IOR_Parser>::instance (orb_core->configuration (),
+ names [i]);
+
+ if (this->parsers_[i] == 0)
+ {
+ return -1;
+ }
+ }
+
+ return 0;
+}
+
+TAO_IOR_Parser *
+TAO_Parser_Registry::match_parser (const char *ior_string)
+{
+ for (Parser_Iterator i = this->begin (); i != this->end (); ++i)
+ {
+ if ((*i)->match_prefix (ior_string))
+ {
+ return *i;
+ }
+ }
+
+ return 0;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Parser_Registry.h b/TAO/tao/Parser_Registry.h
new file mode 100644
index 00000000000..ce997817d8c
--- /dev/null
+++ b/TAO/tao/Parser_Registry.h
@@ -0,0 +1,93 @@
+// This may look like C, but it's really -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Parser_Registry.h
+ *
+ * $Id$
+ *
+ * @author Priyanka Gontla <pgontla@uci.edu>
+ * @author Carlos O'Ryan <coryan@uci.edu>
+ */
+//=============================================================================
+
+
+#ifndef TAO_PARSER_REGISTRY_H
+#define TAO_PARSER_REGISTRY_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/TAO_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Versioned_Namespace.h"
+
+#include "ace/os_include/os_stddef.h"
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Forward declarations.
+class TAO_ORB_Core;
+class TAO_IOR_Parser;
+
+/**
+ * @class TAO_Parser_Registry
+ *
+ * @brief Maintain the collection of known IOR format parsers
+ *
+ * The ORB dynamically loads a collection of IOR parsers (check
+ * the IOR_Parser class). The collection is kept in this class
+ * for easy lookup and use.
+ */
+class TAO_Export TAO_Parser_Registry
+{
+public:
+ // = Initialization and termination methods.
+ /// Default constructor.
+ TAO_Parser_Registry (void);
+
+ /// Dstructor.
+ ~TAO_Parser_Registry (void);
+
+ /// Initialize the parser registry with the list of known protocols.
+ /// Invoked by the ORB during startup.
+ int open (TAO_ORB_Core *orb_core);
+
+ /// Find the parser that can parse @a ior_string
+ /// The lookup is based on the prefix in the string
+ TAO_IOR_Parser *match_parser (const char *ior_string);
+
+ // = Iterator.
+ typedef TAO_IOR_Parser** Parser_Iterator;
+ Parser_Iterator begin (void) const;
+ Parser_Iterator end (void) const;
+
+private:
+
+ // The parser registry should not be copied.
+ TAO_Parser_Registry (const TAO_Parser_Registry&);
+ void operator= (const TAO_Parser_Registry&);
+
+private:
+
+ /// List of parsers
+ TAO_IOR_Parser **parsers_;
+
+ /// Number of parsers
+ size_t size_;
+
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined(__ACE_INLINE__)
+#include "tao/Parser_Registry.i"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_PARSER_REGISTRY_H */
diff --git a/TAO/tao/Parser_Registry.i b/TAO/tao/Parser_Registry.i
new file mode 100644
index 00000000000..5545cece0df
--- /dev/null
+++ b/TAO/tao/Parser_Registry.i
@@ -0,0 +1,19 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE TAO_Parser_Registry::Parser_Iterator
+TAO_Parser_Registry::begin (void) const
+{
+ return this->parsers_;
+}
+
+ACE_INLINE TAO_Parser_Registry::Parser_Iterator
+TAO_Parser_Registry::end (void) const
+{
+ return this->parsers_ + this->size_;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Pluggable_Messaging.cpp b/TAO/tao/Pluggable_Messaging.cpp
new file mode 100644
index 00000000000..5839334ca9f
--- /dev/null
+++ b/TAO/tao/Pluggable_Messaging.cpp
@@ -0,0 +1,16 @@
+// $Id$
+
+#include "tao/Pluggable_Messaging.h"
+
+ACE_RCSID (tao,
+ Pluggable_Messaging,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Pluggable_Messaging::~TAO_Pluggable_Messaging (void)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Pluggable_Messaging.h b/TAO/tao/Pluggable_Messaging.h
new file mode 100644
index 00000000000..c6e2e4d734f
--- /dev/null
+++ b/TAO/tao/Pluggable_Messaging.h
@@ -0,0 +1,210 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Pluggable_Messaging.h
+ *
+ * $Id$
+ *
+ * Interface for the TAO pluggable messaging framework.
+ *
+ *
+ * @author Balachandran Natarajan <bala@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_PLUGGABLE_MESSAGING_H
+#define TAO_PLUGGABLE_MESSAGING_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/TAO_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Basic_Types.h"
+
+ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+class ACE_Time_Value;
+ACE_END_VERSIONED_NAMESPACE_DECL
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace CORBA
+{
+ class Exception;
+}
+
+class TAO_Target_Specification;
+class TAO_Pluggable_Reply_Params;
+class TAO_Pluggable_Reply_Params_Base;
+class TAO_Transport;
+class TAO_Operation_Details;
+class TAO_Target_Specification;
+class TAO_OutputCDR;
+class TAO_Queued_Data;
+class TAO_GIOP_Fragmentation_Strategy;
+
+// @@ The more I think I about this class, I feel that this class need
+// not be a ABC as it is now. Instead we have these options
+// (1) Parametrize this class with the "Messaging Object". Then the
+// implementations can just redirect the request to the class
+// that it has been specialised with
+// (2) Use a bridge pattern here ie. the interface exposed by this
+// class will redirect the request to the implementation which
+// would be "right messaging" object.
+// Both of them feasible. If we are not going like templates much, (2)
+// is seems to be a better option.
+// I am going to take a closer look on this after my MS defense -
+// Bala
+
+/**
+ * @class TAO_Pluggable_Messaging
+ *
+ * @brief Generic definitions Messaging class.
+ *
+ * This interface tries to define generic methods that could be
+ * different messaging protocols
+ */
+class TAO_Export TAO_Pluggable_Messaging
+{
+public:
+ /// Dtor
+ virtual ~TAO_Pluggable_Messaging (void);
+
+ /// Write the RequestHeader in to the @a cdr stream. The underlying
+ /// implementation of the mesaging should do the right thing.
+ virtual int generate_request_header (
+ TAO_Operation_Details &op,
+ TAO_Target_Specification &spec,
+ TAO_OutputCDR &cdr) = 0;
+
+ /// Write the RequestHeader in to the @a cdr stream.
+ virtual int generate_locate_request_header (
+ TAO_Operation_Details &op,
+ TAO_Target_Specification &spec,
+ TAO_OutputCDR &cdr) = 0;
+
+ /**
+ * Write the reply header
+ * The reply header is a part of any messaging protocol. The
+ * messaging protocol implementation would implement the way the
+ * reply header is written.
+ */
+ virtual int generate_reply_header (
+ TAO_OutputCDR &cdr,
+ TAO_Pluggable_Reply_Params_Base &params) = 0;
+
+ /**
+ * Write the locate reply header
+ * The locate reply header is a part of any messaging protocol. The
+ * messaging protocol implementation would implement the way the
+ * locate reply header is written.
+ */
+ virtual int generate_locate_reply_header (
+ TAO_OutputCDR &cdr,
+ TAO_Pluggable_Reply_Params_Base &params) = 0;
+
+ virtual int generate_fragment_header (TAO_OutputCDR & cdr,
+ CORBA::ULong request_id) = 0;
+
+ /// Format the message in the @a cdr. May not be needed in
+ /// general.
+ virtual int format_message (TAO_OutputCDR &cdr) = 0;
+
+ /// Do any initialisations that may be needed.
+ virtual void init (CORBA::Octet major,
+ CORBA::Octet minor) = 0;
+
+ /// Parse the details of the next message from the @a incoming
+ /// and initializes attributes of @a qd. Returns 0 if the message
+ /// header could not be parsed completely, returns a 1 if the message
+ /// header could be parsed completely and returns -1 on error. As the
+ /// parsed data is stored directly in @a qd, no state must be stored
+ /// in instance of implementation.
+ virtual int parse_next_message (ACE_Message_Block &incoming,
+ TAO_Queued_Data &qd, /* out */
+ size_t &mesg_length) = 0; /* out */
+
+ /// Extract the details of the next message from the @a incoming
+ /// through @a qd. Returns 0 if the message header could not be
+ /// parsed completely, returns a 1 if the message header could be
+ /// parsed completely and returns -1 on error.
+ virtual int extract_next_message (ACE_Message_Block &incoming,
+ TAO_Queued_Data *&qd) = 0;
+
+ /// Check whether the node @a qd needs consolidation from @a incoming,
+ /// @r 0 on success, -1 on error
+ virtual int consolidate_node (TAO_Queued_Data *qd,
+ ACE_Message_Block &incoming) = 0;
+
+ /// Parse the request message, make an upcall and send the reply back
+ /// to the "request initiator"
+ virtual int process_request_message (TAO_Transport *transport,
+ TAO_Queued_Data *qd) = 0;
+
+
+ /// Parse the reply message that we received and return the reply
+ /// information through @a reply_info
+ virtual int process_reply_message (
+ TAO_Pluggable_Reply_Params &reply_info,
+ TAO_Queued_Data *qd) = 0;
+
+
+ /// Generate a reply message with the exception @a ex.
+ virtual int generate_exception_reply (
+ TAO_OutputCDR &cdr,
+ TAO_Pluggable_Reply_Params_Base &params,
+ CORBA::Exception &ex) = 0;
+
+ /// Is the messaging object ready for processing BiDirectional
+ /// request/response?
+ virtual int is_ready_for_bidirectional (TAO_OutputCDR &msg) = 0;
+
+ /// Reset the messaging the object
+ virtual void reset (void) = 0;
+
+ /// Header length
+ virtual size_t header_length (void) const = 0;
+
+ /// Fragment header length
+ virtual size_t fragment_header_length (CORBA::Octet major,
+ CORBA::Octet minor) const = 0;
+
+ /// Accessor for the output CDR stream
+ virtual TAO_OutputCDR &out_stream (void) = 0;
+
+ /// Consolidate newly received fragment with previously arrived
+ /// associated fragments to achieve consolidated message. All
+ /// fragments having been received previously are being managed
+ /// within implementation. If reliable transport is used (like TCP)
+ /// this operation will be invoked with fragments being received
+ /// partially ordered, last fragment being received last. Otherwise
+ /// If un-reliable transport is used (like UDP) fragments may be
+ /// received dis-ordered, and must be ordered before consolidation
+ /// within implementation. @return 0 on success and @a con_msg
+ /// points to consolidated message, 1 if there are still fragmens
+ /// outstanding, in case of error -1 is being returned. The
+ /// implementation is responsible to release @a qd.
+ virtual int consolidate_fragmented_message (TAO_Queued_Data *qd,
+ TAO_Queued_Data *&con_msg) = 0;
+
+ /// Discard all fragments associated to request-id encoded in
+ /// cancel_request. Transport implementaion guarantees that this
+ /// operation will never be invoked // concurrently by multiplpe
+ /// threads nor concurrently to consolidate_fragmented_message
+ /// @return -1 on failure, 0 on success, 1 no fragment on stack
+ /// relating to CancelRequest.
+ virtual int discard_fragmented_message (const TAO_Queued_Data *cancel_request) = 0;
+
+ /// Outgoing GIOP message fragmentation strategy.
+ virtual TAO_GIOP_Fragmentation_Strategy * fragmentation_strategy (void) = 0;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /*TAO_PLUGGABLE_MESSAGING_H*/
diff --git a/TAO/tao/Pluggable_Messaging_Utils.cpp b/TAO/tao/Pluggable_Messaging_Utils.cpp
new file mode 100644
index 00000000000..9e7956bd5a8
--- /dev/null
+++ b/TAO/tao/Pluggable_Messaging_Utils.cpp
@@ -0,0 +1,23 @@
+//$Id$
+
+#include "tao/Pluggable_Messaging_Utils.h"
+#include "tao/ORB_Core.h"
+
+#if !defined (__ACE_INLINE__)
+#include "tao/Pluggable_Messaging_Utils.i"
+#endif /* __ACE_INLINE__ */
+
+ACE_RCSID (tao,
+ Pluggable_Messaging_Utils,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Pluggable_Reply_Params::TAO_Pluggable_Reply_Params (TAO_Transport *t)
+ : input_cdr_ (0)
+ , transport_ (t)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Pluggable_Messaging_Utils.h b/TAO/tao/Pluggable_Messaging_Utils.h
new file mode 100644
index 00000000000..ea31e8cd8ca
--- /dev/null
+++ b/TAO/tao/Pluggable_Messaging_Utils.h
@@ -0,0 +1,193 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Pluggable_Messaging_Utils.h
+ *
+ * $Id$
+ *
+ * Utility classes for the TAO pluggable messaging framework.
+ *
+ * @author Balachandran Natarajan <bala@cs.wustl.edu>
+ */
+//=============================================================================
+
+
+#ifndef TAO_PLUGGABLE_MESSAGING_UTILS_H
+#define TAO_PLUGGABLE_MESSAGING_UTILS_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/IOP_IORC.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Transport;
+
+/**
+ * @class TAO_Pluggable_Reply_Params_Base
+ *
+ * @brief TAO_Pluggable_Acceptor_Params
+ *
+ * This represents a set of data that would be assembled by the
+ * acceptor to pass to the connector. This base class is used by
+ * TAO_ServerRequest. The child class TAO_Pluggable_Reply_Params
+ * is used on the client side, and contains an additional
+ * TAO_InputCDR member, not needed on the server side.
+ */
+class TAO_Export TAO_Pluggable_Reply_Params_Base
+{
+public:
+ /// Constructor.
+ TAO_Pluggable_Reply_Params_Base (void);
+
+ /// The IOP service context list.
+ IOP::ServiceContextList svc_ctx_;
+
+ /// The request id for which the reply we (connector) has received.
+ CORBA::ULong request_id_;
+
+ // @@ Bala: this is (again) an GIOPism (to coin a word). Other
+ // protocol may choose to send different *messages* instead.
+ // @@ Carlos: I agree. Please see above.
+ /// The reply status.
+ CORBA::ULong reply_status_;
+
+ /**
+ * Since this class no longer contains an NVList, this is the
+ * way to determine if the request was DSI, so we can use Carlos'
+ * service context list no-deep-copy optimization.
+ */
+ CORBA::Boolean is_dsi_;
+
+ /// Info required for DSI optimization that pads the outgoing
+ /// CDR stream according to the alignment of the NVList.
+ ptrdiff_t dsi_nvlist_align_;
+
+ /**
+ * Get and Set methods for the service context list that we dont
+ * own. This is useful for cases where the application objects own
+ * a service context list and would like to pass on their contents
+ * without a copy.
+ */
+ IOP::ServiceContextList &service_context_notowned (void);
+ void service_context_notowned (IOP::ServiceContextList *svc);
+
+ /// A flag that indicates if there is any data is going to get
+ /// marshalled in the reply
+ CORBA::Boolean argument_flag_;
+
+protected:
+ /// The service context list that we don't own.
+ IOP::ServiceContextList *service_context_;
+};
+
+/**
+ * @class TAO_Pluggable_Reply_Params
+ *
+ * @brief TAO_Pluggable_Connector_Params
+ *
+ */
+class TAO_Export TAO_Pluggable_Reply_Params
+ : public TAO_Pluggable_Reply_Params_Base
+{
+public:
+ /// Constructor.
+ TAO_Pluggable_Reply_Params (TAO_Transport *t);
+
+ /// The stream with the non-demarshaled reply. This stream will be
+ /// passed up to the stubs to demarshal the parameter values.
+ TAO_InputCDR *input_cdr_;
+
+ TAO_Transport *transport_;
+};
+
+// @@ Bala: this is a GIOPism too, there is no such thing as locate
+// request in HTTP (the basis for SOAP and XIOP), i don't know about
+// HTTP-NG, but i wouldn't be surprised if it had. Furthermore, some
+// very influential people (Michi) is arguing against it in the OMG.
+//
+// @@Carlos: Yes, I also saw some of Michi's ideas. Even if OMG
+// decides to remove this, can I point that we may have to support that
+// for the existsing GIOP1.0,1.1 & GIOP 1.2. Above all, the enum type
+// contains things that I know of today. I can go ahead and add HTTP-NG
+// stuff. They all seem to be in Working Draft stage. So, I am just
+// keeping off. I dont want to add something for the kick of it :-)
+enum TAO_Pluggable_Header_Type
+{
+ TAO_PLUGGABLE_MESSAGE_REQUEST_HEADER = 0,
+ TAO_PLUGGABLE_MESSAGE_LOCATE_REQUEST_HEADER
+};
+
+
+/**
+ * Provide an external interface for the users of this pluggable
+ * messaging framework to denote existing message types. This has
+ * an inspiration from GIOP. So if anybody wants to add more message
+ * types you are welcome but please do not change the numbering
+ * scheme as this would affect GIOP.
+ *
+ * @note
+ * We may not need everything here. It would be good if we
+ * have only the following messages TAO_PLUGGABLE_MESSAGE_REQUEST,
+ * TAO_PLUGGABLE_MESSAGE_REPLY,
+ * TAO_PLUGGABLE_MESSAGE_CLOSECONNECTION,
+ * TAO_PLUGGABLE_MESSAGE_MESSAGE_ERROR. Changes will be made once
+ * the rest of the stuff gets ready to roll
+ */
+enum TAO_Pluggable_Message_Type
+{
+ TAO_PLUGGABLE_MESSAGE_REQUEST = 0, // sent by client.
+ TAO_PLUGGABLE_MESSAGE_REPLY = 1, // by server.
+ TAO_PLUGGABLE_MESSAGE_CANCELREQUEST = 2, // by client.
+ TAO_PLUGGABLE_MESSAGE_LOCATEREQUEST = 3, // by client.
+ TAO_PLUGGABLE_MESSAGE_LOCATEREPLY = 4,
+ TAO_PLUGGABLE_MESSAGE_CLOSECONNECTION = 5,
+ TAO_PLUGGABLE_MESSAGE_MESSAGERROR = 6,
+ TAO_PLUGGABLE_MESSAGE_FRAGMENT = 7
+};
+
+// @@ Bala: This is a hopeless GIOPism.
+// @@ Carlos: Agreed.
+
+/**
+ * Provide an external interface for the users of this pluggable
+ * messaging framework to denote existing Exception types. This has
+ * an inspiration from GIOP. So if anybody wants to add more message
+ * types you are welcome but please do not change the numbering
+ * scheme as this would affect GIOP.
+ */
+enum TAO_Pluggable_Message_Exception_Type
+{
+ /// Request completed successfully
+ TAO_PLUGGABLE_MESSAGE_NO_EXCEPTION = 0,
+
+ /// Request terminated with user exception
+ TAO_PLUGGABLE_MESSAGE_USER_EXCEPTION,
+
+ /// Request terminated with system exception
+ TAO_PLUGGABLE_MESSAGE_SYSTEM_EXCEPTION,
+
+ /// Reply is a location forward type
+ TAO_PLUGGABLE_MESSAGE_LOCATION_FORWARD,
+
+ /// PLUGGABLE_MESSAGE 1.2, Reply is a location forward perm type..
+ TAO_PLUGGABLE_MESSAGE_LOCATION_FORWARD_PERM,
+
+ /// GIOP1.2,
+ TAO_PLUGGABLE_MESSAGE_NEEDS_ADDRESSING_MODE
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+#include "tao/Pluggable_Messaging_Utils.i"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_PLUGGABLE_MESSAGING_UTILS_H */
diff --git a/TAO/tao/Pluggable_Messaging_Utils.i b/TAO/tao/Pluggable_Messaging_Utils.i
new file mode 100644
index 00000000000..7a10993036e
--- /dev/null
+++ b/TAO/tao/Pluggable_Messaging_Utils.i
@@ -0,0 +1,33 @@
+// -*- C++ -*-
+
+//$Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO_Pluggable_Reply_Params_Base::TAO_Pluggable_Reply_Params_Base (void)
+ : svc_ctx_ (),
+ request_id_ (0),
+ reply_status_ (0),
+ is_dsi_ (0),
+ dsi_nvlist_align_ (0),
+ argument_flag_ (0),
+ service_context_ (0)
+{
+}
+
+ACE_INLINE void
+TAO_Pluggable_Reply_Params_Base::service_context_notowned (
+ IOP::ServiceContextList *svc
+ )
+{
+ this->service_context_ = svc;
+}
+
+ACE_INLINE IOP::ServiceContextList &
+TAO_Pluggable_Reply_Params_Base::service_context_notowned (void)
+{
+ return *this->service_context_;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Policy.pidl b/TAO/tao/Policy.pidl
new file mode 100644
index 00000000000..62dfc3e50bc
--- /dev/null
+++ b/TAO/tao/Policy.pidl
@@ -0,0 +1,96 @@
+/**
+ * @file Policy.pidl
+ *
+ * $Id$
+ *
+ * @brief Pre-compiled IDL source for the CORBA::Policy related
+ * classes.
+ *
+ * This file is used to generate the code in PolicyC.{h,inl,cpp}.
+ * Also, skeleton code for the only non local Policy interface is
+ * generated from this pidl file and then the declaration code is
+ * moved to tao/PortableServer/PolicyS.{h,inl,cpp}
+ *
+ * The steps to regenerate the code are as follows:
+ *
+ * 1. Run the tao_idl compiler on the patched pidl file. The
+ * command used for this is:
+ *
+ * tao_idl.exe
+ * -o orig -Gp -Gd -Ge 1 -GA -Ssi
+ * -Wb,stub_export_macro=TAO_Export
+ * -Wb,stub_export_include="tao/TAO_Export.h"
+ * -Wb,skel_export_macro=TAO_PortableServer_Export
+ * -Wb,skel_export_include=portableserver_export.h
+ * -Wb,pre_include="ace/pre.h"
+ * -Wb,post_include="ace/post.h"
+ * Policy.pidl
+ *
+ * 2. Then patch the generated code using patches in
+ * diff/Policy.diff. To patch the generated code in
+ * PortableServer look for diffs in PortableServer/diffs
+ * directory.
+ *
+ * Note: The diffs were generated with these commands:
+ *
+ * for i in PolicyC.{h,i,cpp}; do
+ * diff -wBbu orig/$i $i;
+ * done > diffs/Policy.diff
+ * for i in Policy{S,S_T}.{h,i,cpp}; do
+ * diff -wBbu orig/$i PortableServer/$i;
+ * done >> diffs/Policy.diff
+ */
+
+#ifndef TAO_CORBA_POLICY_PIDL
+#define TAO_CORBA_POLICY_PIDL
+
+#include "tao/UShortSeq.pidl"
+#include "tao/Current.pidl"
+#include "tao/Policy_Forward.pidl"
+
+#pragma prefix "omg.org"
+
+module CORBA
+{
+ typedef short PolicyErrorCode;
+ const PolicyErrorCode BAD_POLICY = 0;
+ const PolicyErrorCode UNSUPPORTED_POLICY = 1;
+ const PolicyErrorCode BAD_POLICY_TYPE = 2;
+ const PolicyErrorCode BAD_POLICY_VALUE = 3;
+ const PolicyErrorCode UNSUPPORTED_POLICY_VALUE = 4;
+
+ exception PolicyError
+ {
+ PolicyErrorCode reason;
+ };
+
+ exception InvalidPolicies
+ {
+ UShortSeq indices;
+ };
+
+ interface Policy
+ {
+ readonly attribute PolicyType policy_type;
+ Policy copy ();
+ void destroy ();
+ };
+
+ local interface PolicyManager
+ {
+ PolicyList get_policy_overrides (in PolicyTypeSeq ts);
+ void set_policy_overrides (
+ in PolicyList policies,
+ in SetOverrideType set_add)
+ raises (InvalidPolicies);
+ };
+
+ local interface PolicyCurrent : PolicyManager, Current
+ {
+ };
+
+};
+
+#pragma prefix ""
+
+#endif /* TAO_CORBA_POLICY_PIDL */
diff --git a/TAO/tao/PolicyC.cpp b/TAO/tao/PolicyC.cpp
new file mode 100644
index 00000000000..d0530021af4
--- /dev/null
+++ b/TAO/tao/PolicyC.cpp
@@ -0,0 +1,1044 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:291
+
+
+#include "tao/PolicyC.h"
+#include "tao/CDR.h"
+#include "tao/Invocation_Adapter.h"
+#include "tao/Object_T.h"
+#include "tao/Basic_Arguments.h"
+#include "tao/Object_Argument_T.h"
+#include "ace/OS_NS_string.h"
+#include "tao/AnyTypeCode_Adapter.h"
+#include "ace/Dynamic_Service.h"
+
+#if defined (__BORLANDC__)
+#pragma option -w-rvl -w-rch -w-ccc -w-aus -w-sig
+#endif /* __BORLANDC__ */
+
+#if !defined (__ACE_INLINE__)
+#include "tao/PolicyC.inl"
+#endif /* !defined INLINE */
+
+// TAO_IDL - Generated from
+// be\be_visitor_arg_traits.cpp:70
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// TAO specific stuff.
+namespace CORBA
+{
+ class Policy;
+ typedef Policy *Policy_ptr;
+ typedef TAO_Objref_Var_T<Policy> Policy_var;
+ typedef TAO_Objref_Out_T<Policy> Policy_out;
+}
+
+namespace TAO
+{
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+}
+
+// Arg traits specializations.
+namespace TAO
+{
+
+#if !defined (_CORBA_POLICY__ARG_TRAITS_CS_)
+#define _CORBA_POLICY__ARG_TRAITS_CS_
+
+ template<>
+ class Arg_Traits<CORBA::Policy>
+ : public
+ Object_Arg_Traits_T<
+ CORBA::Policy_ptr,
+ CORBA::Policy_var,
+ CORBA::Policy_out,
+ TAO::Objref_Traits<CORBA::Policy>,
+ TAO::Any_Insert_Policy_AnyTypeCode_Adapter <CORBA::Policy_ptr>
+ >
+ {
+ };
+
+#endif /* end #if !defined */
+}
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_exception/exception_cs.cpp:63
+
+CORBA::PolicyError::PolicyError (void)
+ : CORBA::UserException (
+ "IDL:omg.org/CORBA/PolicyError:1.0",
+ "PolicyError"
+ )
+{
+}
+
+CORBA::PolicyError::~PolicyError (void)
+{
+}
+
+CORBA::PolicyError::PolicyError (const ::CORBA::PolicyError &_tao_excp)
+ : CORBA::UserException (
+ _tao_excp._rep_id (),
+ _tao_excp._name ()
+ )
+{
+ this->reason = _tao_excp.reason;
+}
+
+CORBA::PolicyError&
+CORBA::PolicyError::operator= (const ::CORBA::PolicyError &_tao_excp)
+{
+ this->::CORBA::UserException::operator= (_tao_excp);
+ this->reason = _tao_excp.reason;
+ return *this;
+}
+
+void CORBA::PolicyError::_tao_any_destructor (void *_tao_void_pointer)
+{
+ PolicyError *_tao_tmp_pointer =
+ static_cast<PolicyError *> (_tao_void_pointer);
+ delete _tao_tmp_pointer;
+}
+
+CORBA::PolicyError *
+CORBA::PolicyError::_downcast (CORBA::Exception *_tao_excp)
+{
+ return dynamic_cast<PolicyError *> (_tao_excp);
+}
+
+const CORBA::PolicyError *
+CORBA::PolicyError::_downcast (CORBA::Exception const *_tao_excp)
+{
+ return dynamic_cast<const PolicyError *> (_tao_excp);
+}
+
+CORBA::Exception *CORBA::PolicyError::_alloc (void)
+{
+ CORBA::Exception *retval = 0;
+ ACE_NEW_RETURN (retval, ::CORBA::PolicyError, 0);
+ return retval;
+}
+
+CORBA::Exception *
+CORBA::PolicyError::_tao_duplicate (void) const
+{
+ CORBA::Exception *result = 0;
+ ACE_NEW_RETURN (
+ result,
+ ::CORBA::PolicyError (*this),
+ 0
+ );
+ return result;
+}
+
+void CORBA::PolicyError::_raise (void) const
+{
+ TAO_RAISE (*this);
+}
+
+void CORBA::PolicyError::_tao_encode (
+ TAO_OutputCDR &cdr
+ ACE_ENV_ARG_DECL
+ ) const
+{
+ if (cdr << *this)
+ {
+ return;
+ }
+
+ ACE_THROW (CORBA::MARSHAL ());
+}
+
+void CORBA::PolicyError::_tao_decode (
+ TAO_InputCDR &cdr
+ ACE_ENV_ARG_DECL
+ )
+{
+ if (cdr >> *this)
+ {
+ return;
+ }
+
+ ACE_THROW (CORBA::MARSHAL ());
+}
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_exception/exception_ctor.cpp:66
+
+CORBA::PolicyError::PolicyError (
+ CORBA::PolicyErrorCode _tao_reason
+ )
+ : CORBA::UserException (
+ "IDL:omg.org/CORBA/PolicyError:1.0",
+ "PolicyError"
+ )
+{
+ this->reason = _tao_reason;
+}
+
+// TAO extension - the virtual _type method.
+CORBA::TypeCode_ptr CORBA::PolicyError::_tao_type (void) const
+{
+ TAO_AnyTypeCode_Adapter *adapter =
+ ACE_Dynamic_Service<TAO_AnyTypeCode_Adapter>::instance (
+ "AnyTypeCode_Adapter"
+ );
+ if (adapter != 0)
+ return adapter->_tao_type_PolicyError ();
+ else
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) %p\n"),
+ ACE_TEXT ("Unable to find the ")
+ ACE_TEXT ("AnyTypeCode Adapter instance")));
+ return 0;
+ }
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_exception/exception_cs.cpp:63
+
+CORBA::InvalidPolicies::InvalidPolicies (void)
+ : CORBA::UserException (
+ "IDL:omg.org/CORBA/InvalidPolicies:1.0",
+ "InvalidPolicies"
+ )
+{
+}
+
+CORBA::InvalidPolicies::~InvalidPolicies (void)
+{
+}
+
+CORBA::InvalidPolicies::InvalidPolicies (const ::CORBA::InvalidPolicies &_tao_excp)
+ : CORBA::UserException (
+ _tao_excp._rep_id (),
+ _tao_excp._name ()
+ )
+{
+ this->indices = _tao_excp.indices;
+}
+
+CORBA::InvalidPolicies&
+CORBA::InvalidPolicies::operator= (const ::CORBA::InvalidPolicies &_tao_excp)
+{
+ this->::CORBA::UserException::operator= (_tao_excp);
+ this->indices = _tao_excp.indices;
+ return *this;
+}
+
+void CORBA::InvalidPolicies::_tao_any_destructor (void *_tao_void_pointer)
+{
+ InvalidPolicies *_tao_tmp_pointer =
+ static_cast<InvalidPolicies *> (_tao_void_pointer);
+ delete _tao_tmp_pointer;
+}
+
+CORBA::InvalidPolicies *
+CORBA::InvalidPolicies::_downcast (CORBA::Exception *_tao_excp)
+{
+ return dynamic_cast<InvalidPolicies *> (_tao_excp);
+}
+
+const CORBA::InvalidPolicies *
+CORBA::InvalidPolicies::_downcast (CORBA::Exception const *_tao_excp)
+{
+ return dynamic_cast<const InvalidPolicies *> (_tao_excp);
+}
+
+CORBA::Exception *CORBA::InvalidPolicies::_alloc (void)
+{
+ CORBA::Exception *retval = 0;
+ ACE_NEW_RETURN (retval, ::CORBA::InvalidPolicies, 0);
+ return retval;
+}
+
+CORBA::Exception *
+CORBA::InvalidPolicies::_tao_duplicate (void) const
+{
+ CORBA::Exception *result = 0;
+ ACE_NEW_RETURN (
+ result,
+ ::CORBA::InvalidPolicies (*this),
+ 0
+ );
+ return result;
+}
+
+void CORBA::InvalidPolicies::_raise (void) const
+{
+ TAO_RAISE (*this);
+}
+
+void CORBA::InvalidPolicies::_tao_encode (
+ TAO_OutputCDR &cdr
+ ACE_ENV_ARG_DECL
+ ) const
+{
+ if (cdr << *this)
+ {
+ return;
+ }
+
+ ACE_THROW (CORBA::MARSHAL ());
+}
+
+void CORBA::InvalidPolicies::_tao_decode (
+ TAO_InputCDR &cdr
+ ACE_ENV_ARG_DECL
+ )
+{
+ if (cdr >> *this)
+ {
+ return;
+ }
+
+ ACE_THROW (CORBA::MARSHAL ());
+}
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_exception/exception_ctor.cpp:66
+
+CORBA::InvalidPolicies::InvalidPolicies (
+ const CORBA::UShortSeq & _tao_indices
+ )
+ : CORBA::UserException (
+ "IDL:omg.org/CORBA/InvalidPolicies:1.0",
+ "InvalidPolicies"
+ )
+{
+ this->indices = _tao_indices;
+}
+
+// TAO extension - the virtual _type method.
+CORBA::TypeCode_ptr CORBA::InvalidPolicies::_tao_type (void) const
+{
+ TAO_AnyTypeCode_Adapter *adapter =
+ ACE_Dynamic_Service<TAO_AnyTypeCode_Adapter>::instance (
+ "AnyTypeCode_Adapter"
+ );
+ if (adapter != 0)
+ return adapter->_tao_type_InvalidPolicies ();
+ else
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) %p\n"),
+ ACE_TEXT ("Unable to find the ")
+ ACE_TEXT ("AnyTypeCode Adapter instance")));
+ return 0;
+ }
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/interface_cs.cpp:60
+
+// Traits specializations for CORBA::Policy.
+
+CORBA::Policy_ptr
+TAO::Objref_Traits<CORBA::Policy>::duplicate (
+ CORBA::Policy_ptr p
+ )
+{
+ return CORBA::Policy::_duplicate (p);
+}
+
+void
+TAO::Objref_Traits<CORBA::Policy>::release (
+ CORBA::Policy_ptr p
+ )
+{
+ ::CORBA::release (p);
+}
+
+CORBA::Policy_ptr
+TAO::Objref_Traits<CORBA::Policy>::nil (void)
+{
+ return CORBA::Policy::_nil ();
+}
+
+CORBA::Boolean
+TAO::Objref_Traits<CORBA::Policy>::marshal (
+ const CORBA::Policy_ptr p,
+ TAO_OutputCDR & cdr
+ )
+{
+ return CORBA::Object::marshal (p, cdr);
+}
+
+// Function pointer for collocation factory initialization.
+TAO::Collocation_Proxy_Broker *
+(*CORBA__TAO_Policy_Proxy_Broker_Factory_function_pointer) (
+ CORBA::Object_ptr obj
+ ) = 0;
+
+// TAO_IDL - Generated from
+// be\be_visitor_operation/operation_cs.cpp:78
+
+CORBA::PolicyType CORBA::Policy::policy_type (
+ ACE_ENV_SINGLE_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ if (!this->is_evaluated ())
+ {
+ ::CORBA::Object::tao_object_initialize (this);
+ }
+
+ if (this->the_TAO_Policy_Proxy_Broker_ == 0)
+ {
+ CORBA_Policy_setup_collocation ();
+ }
+
+ TAO::Arg_Traits< ::CORBA::PolicyType>::ret_val _tao_retval;
+
+ TAO::Argument *_the_tao_operation_signature [] =
+ {
+ &_tao_retval
+ };
+
+ TAO::Invocation_Adapter _tao_call (
+ this,
+ _the_tao_operation_signature,
+ 1,
+ "_get_policy_type",
+ 16,
+ this->the_TAO_Policy_Proxy_Broker_
+ );
+
+ _tao_call.invoke (0, 0 ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (_tao_retval.excp ());
+
+ return _tao_retval.retn ();
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_operation/operation_cs.cpp:78
+
+::CORBA::Policy_ptr CORBA::Policy::copy (
+ ACE_ENV_SINGLE_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ if (!this->is_evaluated ())
+ {
+ ::CORBA::Object::tao_object_initialize (this);
+ }
+
+ if (this->the_TAO_Policy_Proxy_Broker_ == 0)
+ {
+ CORBA_Policy_setup_collocation ();
+ }
+
+ TAO::Arg_Traits< ::CORBA::Policy>::ret_val _tao_retval;
+
+ TAO::Argument *_the_tao_operation_signature [] =
+ {
+ &_tao_retval
+ };
+
+ TAO::Invocation_Adapter _tao_call (
+ this,
+ _the_tao_operation_signature,
+ 1,
+ "copy",
+ 4,
+ this->the_TAO_Policy_Proxy_Broker_
+ );
+
+ _tao_call.invoke (0, 0 ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (_tao_retval.excp ());
+
+ return _tao_retval.retn ();
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_operation/operation_cs.cpp:78
+
+void CORBA::Policy::destroy (
+ ACE_ENV_SINGLE_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ if (!this->is_evaluated ())
+ {
+ ::CORBA::Object::tao_object_initialize (this);
+ }
+
+ if (this->the_TAO_Policy_Proxy_Broker_ == 0)
+ {
+ CORBA_Policy_setup_collocation ();
+ }
+
+ TAO::Arg_Traits< void>::ret_val _tao_retval;
+
+ TAO::Argument *_the_tao_operation_signature [] =
+ {
+ &_tao_retval
+ };
+
+ TAO::Invocation_Adapter _tao_call (
+ this,
+ _the_tao_operation_signature,
+ 1,
+ "destroy",
+ 7,
+ this->the_TAO_Policy_Proxy_Broker_
+ );
+
+ _tao_call.invoke (0, 0 ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+CORBA::Policy::Policy (void)
+ : the_TAO_Policy_Proxy_Broker_ (0)
+{
+ this->CORBA_Policy_setup_collocation ();
+}
+
+void
+CORBA::Policy::CORBA_Policy_setup_collocation ()
+{
+ if (::CORBA__TAO_Policy_Proxy_Broker_Factory_function_pointer)
+ {
+ this->the_TAO_Policy_Proxy_Broker_ =
+ ::CORBA__TAO_Policy_Proxy_Broker_Factory_function_pointer (this);
+ }
+}
+
+CORBA::Policy::~Policy (void)
+{}
+
+void
+CORBA::Policy::_tao_any_destructor (void *_tao_void_pointer)
+{
+ Policy *_tao_tmp_pointer =
+ static_cast<Policy *> (_tao_void_pointer);
+ ::CORBA::release (_tao_tmp_pointer);
+}
+
+CORBA::Policy_ptr
+CORBA::Policy::_narrow (
+ CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL
+ )
+{
+ return
+ TAO::Narrow_Utils<Policy>::narrow (
+ _tao_objref,
+ "IDL:omg.org/CORBA/Policy:1.0",
+ CORBA__TAO_Policy_Proxy_Broker_Factory_function_pointer
+ ACE_ENV_ARG_PARAMETER
+ );
+}
+
+CORBA::Policy_ptr
+CORBA::Policy::_unchecked_narrow (
+ CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL
+ )
+{
+ return
+ TAO::Narrow_Utils<Policy>::unchecked_narrow (
+ _tao_objref,
+ "IDL:omg.org/CORBA/Policy:1.0",
+ CORBA__TAO_Policy_Proxy_Broker_Factory_function_pointer
+ ACE_ENV_ARG_PARAMETER
+ );
+}
+
+CORBA::Policy_ptr
+CORBA::Policy::_duplicate (Policy_ptr obj)
+{
+ if (! ::CORBA::is_nil (obj))
+ {
+ obj->_add_ref ();
+ }
+
+ return obj;
+}
+
+void
+CORBA::Policy::_tao_release (Policy_ptr obj)
+{
+ ::CORBA::release (obj);
+}
+
+CORBA::Boolean
+CORBA::Policy::_is_a (
+ const char *value
+ ACE_ENV_ARG_DECL
+ )
+{
+ if (
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/Policy:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/Object:1.0"
+ )
+ )
+ {
+ return true; // success using local knowledge
+ }
+ else
+ {
+ return this->::CORBA::Object::_is_a (
+ value
+ ACE_ENV_ARG_PARAMETER
+ );
+ }
+}
+
+const char* CORBA::Policy::_interface_repository_id (void) const
+{
+ return "IDL:omg.org/CORBA/Policy:1.0";
+}
+
+CORBA::Boolean
+CORBA::Policy::marshal (TAO_OutputCDR &cdr)
+{
+ return (cdr << this);
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/interface_cs.cpp:60
+
+// Traits specializations for CORBA::PolicyManager.
+
+CORBA::PolicyManager_ptr
+TAO::Objref_Traits<CORBA::PolicyManager>::duplicate (
+ CORBA::PolicyManager_ptr p
+ )
+{
+ return CORBA::PolicyManager::_duplicate (p);
+}
+
+void
+TAO::Objref_Traits<CORBA::PolicyManager>::release (
+ CORBA::PolicyManager_ptr p
+ )
+{
+ ::CORBA::release (p);
+}
+
+CORBA::PolicyManager_ptr
+TAO::Objref_Traits<CORBA::PolicyManager>::nil (void)
+{
+ return CORBA::PolicyManager::_nil ();
+}
+
+CORBA::Boolean
+TAO::Objref_Traits<CORBA::PolicyManager>::marshal (
+ const CORBA::PolicyManager_ptr p,
+ TAO_OutputCDR & cdr
+ )
+{
+ return CORBA::Object::marshal (p, cdr);
+}
+
+CORBA::PolicyManager::PolicyManager (void)
+{}
+
+CORBA::PolicyManager::~PolicyManager (void)
+{}
+
+void
+CORBA::PolicyManager::_tao_any_destructor (void *_tao_void_pointer)
+{
+ PolicyManager *_tao_tmp_pointer =
+ static_cast<PolicyManager *> (_tao_void_pointer);
+ ::CORBA::release (_tao_tmp_pointer);
+}
+
+CORBA::PolicyManager_ptr
+CORBA::PolicyManager::_narrow (
+ CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return PolicyManager::_duplicate (
+ dynamic_cast<PolicyManager_ptr> (_tao_objref)
+ );
+}
+
+CORBA::PolicyManager_ptr
+CORBA::PolicyManager::_unchecked_narrow (
+ CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return PolicyManager::_duplicate (
+ dynamic_cast<PolicyManager_ptr> (_tao_objref)
+ );
+}
+
+CORBA::PolicyManager_ptr
+CORBA::PolicyManager::_duplicate (PolicyManager_ptr obj)
+{
+ if (! ::CORBA::is_nil (obj))
+ {
+ obj->_add_ref ();
+ }
+
+ return obj;
+}
+
+void
+CORBA::PolicyManager::_tao_release (PolicyManager_ptr obj)
+{
+ ::CORBA::release (obj);
+}
+
+CORBA::Boolean
+CORBA::PolicyManager::_is_a (
+ const char *value
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ if (
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/PolicyManager:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/LocalObject:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/Object:1.0"
+ )
+ )
+ {
+ return true; // success using local knowledge
+ }
+ else
+ {
+ return false;
+ }
+}
+
+const char* CORBA::PolicyManager::_interface_repository_id (void) const
+{
+ return "IDL:omg.org/CORBA/PolicyManager:1.0";
+}
+
+CORBA::Boolean
+CORBA::PolicyManager::marshal (TAO_OutputCDR &)
+{
+ return false;
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/interface_cs.cpp:60
+
+// Traits specializations for CORBA::PolicyCurrent.
+
+CORBA::PolicyCurrent_ptr
+TAO::Objref_Traits<CORBA::PolicyCurrent>::duplicate (
+ CORBA::PolicyCurrent_ptr p
+ )
+{
+ return CORBA::PolicyCurrent::_duplicate (p);
+}
+
+void
+TAO::Objref_Traits<CORBA::PolicyCurrent>::release (
+ CORBA::PolicyCurrent_ptr p
+ )
+{
+ ::CORBA::release (p);
+}
+
+CORBA::PolicyCurrent_ptr
+TAO::Objref_Traits<CORBA::PolicyCurrent>::nil (void)
+{
+ return CORBA::PolicyCurrent::_nil ();
+}
+
+CORBA::Boolean
+TAO::Objref_Traits<CORBA::PolicyCurrent>::marshal (
+ const CORBA::PolicyCurrent_ptr p,
+ TAO_OutputCDR & cdr
+ )
+{
+ return CORBA::Object::marshal (p, cdr);
+}
+
+CORBA::PolicyCurrent::PolicyCurrent (void)
+{}
+
+CORBA::PolicyCurrent::~PolicyCurrent (void)
+{}
+
+void
+CORBA::PolicyCurrent::_tao_any_destructor (void *_tao_void_pointer)
+{
+ PolicyCurrent *_tao_tmp_pointer =
+ static_cast<PolicyCurrent *> (_tao_void_pointer);
+ ::CORBA::release (_tao_tmp_pointer);
+}
+
+CORBA::PolicyCurrent_ptr
+CORBA::PolicyCurrent::_narrow (
+ CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return PolicyCurrent::_duplicate (
+ dynamic_cast<PolicyCurrent_ptr> (_tao_objref)
+ );
+}
+
+CORBA::PolicyCurrent_ptr
+CORBA::PolicyCurrent::_unchecked_narrow (
+ CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return PolicyCurrent::_duplicate (
+ dynamic_cast<PolicyCurrent_ptr> (_tao_objref)
+ );
+}
+
+CORBA::PolicyCurrent_ptr
+CORBA::PolicyCurrent::_duplicate (PolicyCurrent_ptr obj)
+{
+ if (! ::CORBA::is_nil (obj))
+ {
+ obj->_add_ref ();
+ }
+
+ return obj;
+}
+
+void
+CORBA::PolicyCurrent::_tao_release (PolicyCurrent_ptr obj)
+{
+ ::CORBA::release (obj);
+}
+
+CORBA::Boolean
+CORBA::PolicyCurrent::_is_a (
+ const char *value
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ if (
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/PolicyManager:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/Current:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/PolicyCurrent:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/LocalObject:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/Object:1.0"
+ )
+ )
+ {
+ return true; // success using local knowledge
+ }
+ else
+ {
+ return false;
+ }
+}
+
+const char* CORBA::PolicyCurrent::_interface_repository_id (void) const
+{
+ return "IDL:omg.org/CORBA/PolicyCurrent:1.0";
+}
+
+CORBA::Boolean
+CORBA::PolicyCurrent::marshal (TAO_OutputCDR &)
+{
+ return false;
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_exception/cdr_op_cs.cpp:60
+
+CORBA::Boolean operator<< (
+ TAO_OutputCDR &strm,
+ const CORBA::PolicyError &_tao_aggregate
+ )
+{
+ // First marshal the repository ID.
+ if (strm << _tao_aggregate._rep_id ())
+ {
+ // Now marshal the members (if any).
+ return (
+ (strm << _tao_aggregate.reason)
+ );
+ }
+ else
+ {
+ return false;
+ }
+}
+
+CORBA::Boolean operator>> (
+ TAO_InputCDR &strm,
+ CORBA::PolicyError &_tao_aggregate
+ )
+{
+ // Demarshal the members.
+ return (
+ (strm >> _tao_aggregate.reason)
+ );
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_exception/cdr_op_cs.cpp:60
+
+CORBA::Boolean operator<< (
+ TAO_OutputCDR &strm,
+ const CORBA::InvalidPolicies &_tao_aggregate
+ )
+{
+ // First marshal the repository ID.
+ if (strm << _tao_aggregate._rep_id ())
+ {
+ // Now marshal the members (if any).
+ return (
+ (strm << _tao_aggregate.indices)
+ );
+ }
+ else
+ {
+ return false;
+ }
+}
+
+CORBA::Boolean operator>> (
+ TAO_InputCDR &strm,
+ CORBA::InvalidPolicies &_tao_aggregate
+ )
+{
+ // Demarshal the members.
+ return (
+ (strm >> _tao_aggregate.indices)
+ );
+}
+
+// Hand crafted.
+//
+// ****************************************************************
+CORBA::Boolean
+CORBA::Policy::_tao_encode (TAO_OutputCDR &)
+{
+ return false;
+}
+
+CORBA::Boolean
+CORBA::Policy::_tao_decode (TAO_InputCDR &)
+{
+ return false;
+}
+
+TAO_Cached_Policy_Type
+CORBA::Policy::_tao_cached_type (void) const
+{
+ return TAO_CACHED_POLICY_UNCACHED;
+}
+
+TAO_Policy_Scope
+CORBA::Policy::_tao_scope (void) const
+{
+ return TAO_POLICY_DEFAULT_SCOPE;
+}
+// ****************************************************************
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/cdr_op_cs.cpp:63
+
+CORBA::Boolean operator<< (
+ TAO_OutputCDR &strm,
+ const CORBA::Policy_ptr _tao_objref
+ )
+{
+ CORBA::Object_ptr _tao_corba_obj = _tao_objref;
+ return (strm << _tao_corba_obj);
+}
+
+CORBA::Boolean operator>> (
+ TAO_InputCDR &strm,
+ CORBA::Policy_ptr &_tao_objref
+ )
+{
+ CORBA::Object_var obj;
+
+ if (!(strm >> obj.inout ()))
+ {
+ return false;
+ }
+
+ typedef ::CORBA::Policy RHS_SCOPED_NAME;
+
+ // Narrow to the right type.
+ _tao_objref =
+ TAO::Narrow_Utils<RHS_SCOPED_NAME>::unchecked_narrow (
+ obj.in (),
+ CORBA__TAO_Policy_Proxy_Broker_Factory_function_pointer
+ );
+
+ return 1;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PolicyC.h b/TAO/tao/PolicyC.h
new file mode 100644
index 00000000000..2f02bd40e75
--- /dev/null
+++ b/TAO/tao/PolicyC.h
@@ -0,0 +1,686 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:153
+
+#ifndef _TAO_IDL_ORIG_POLICYC_H_
+#define _TAO_IDL_ORIG_POLICYC_H_
+
+#include /**/ "ace/pre.h"
+
+
+#include "ace/config-all.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/TAO_Export.h"
+#include "tao/ORB.h"
+#include "tao/SystemException.h"
+#include "tao/Environment.h"
+#include "tao/Object.h"
+#include "tao/Objref_VarOut_T.h"
+
+#include "tao/UShortSeqC.h"
+#include "tao/CurrentC.h"
+#include "tao/Policy_ForwardC.h"
+
+#if defined (TAO_EXPORT_MACRO)
+#undef TAO_EXPORT_MACRO
+#endif
+#define TAO_EXPORT_MACRO TAO_Export
+
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+#if defined (__BORLANDC__)
+#pragma option push -w-rvl -w-rch -w-ccc -w-inl
+#endif /* __BORLANDC__ */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// TAO_IDL - Generated from
+// be\be_visitor_root/root_ch.cpp:62
+
+namespace TAO
+{
+ class Collocation_Proxy_Broker;
+ template<typename T> class Narrow_Utils;
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_module/module_ch.cpp:48
+
+namespace CORBA
+{
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typedef/typedef_ch.cpp:379
+
+ typedef CORBA::Short PolicyErrorCode;
+ typedef CORBA::Short_out PolicyErrorCode_out;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_constant/constant_ch.cpp:52
+
+ const CORBA::PolicyErrorCode BAD_POLICY = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_constant/constant_ch.cpp:52
+
+ const CORBA::PolicyErrorCode UNSUPPORTED_POLICY = 1;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_constant/constant_ch.cpp:52
+
+ const CORBA::PolicyErrorCode BAD_POLICY_TYPE = 2;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_constant/constant_ch.cpp:52
+
+ const CORBA::PolicyErrorCode BAD_POLICY_VALUE = 3;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_constant/constant_ch.cpp:52
+
+ const CORBA::PolicyErrorCode UNSUPPORTED_POLICY_VALUE = 4;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_exception/exception_ch.cpp:53
+
+#if !defined (_CORBA_POLICYERROR_CH_)
+#define _CORBA_POLICYERROR_CH_
+
+ class TAO_Export PolicyError : public CORBA::UserException
+ {
+ public:
+
+ CORBA::PolicyErrorCode reason;
+ PolicyError (void);
+ PolicyError (const PolicyError &);
+ ~PolicyError (void);
+
+ PolicyError &operator= (const PolicyError &);
+
+ static void _tao_any_destructor (void *);
+
+ static PolicyError *_downcast (CORBA::Exception *);
+ static const PolicyError *_downcast (CORBA::Exception const *);
+
+ static CORBA::Exception *_alloc (void);
+
+ virtual CORBA::Exception *_tao_duplicate (void) const;
+
+ virtual void _raise (void) const;
+
+ virtual void _tao_encode (
+ TAO_OutputCDR &
+ ACE_ENV_ARG_DECL
+ ) const;
+
+ virtual void _tao_decode (
+ TAO_InputCDR &
+ ACE_ENV_ARG_DECL
+ );
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_exception/exception_ctor.cpp:66
+
+ PolicyError (
+ ::CORBA::PolicyErrorCode _tao_reason
+ );
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_exception/exception_ch.cpp:129
+
+ virtual CORBA::TypeCode_ptr _tao_type (void) const;
+ };
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_exception/exception_ch.cpp:53
+
+#if !defined (_CORBA_INVALIDPOLICIES_CH_)
+#define _CORBA_INVALIDPOLICIES_CH_
+
+ class TAO_Export InvalidPolicies : public CORBA::UserException
+ {
+ public:
+
+ CORBA::UShortSeq indices;
+ InvalidPolicies (void);
+ InvalidPolicies (const InvalidPolicies &);
+ ~InvalidPolicies (void);
+
+ InvalidPolicies &operator= (const InvalidPolicies &);
+
+ static void _tao_any_destructor (void *);
+
+ static InvalidPolicies *_downcast (CORBA::Exception *);
+ static const InvalidPolicies *_downcast (CORBA::Exception const *);
+
+ static CORBA::Exception *_alloc (void);
+
+ virtual CORBA::Exception *_tao_duplicate (void) const;
+
+ virtual void _raise (void) const;
+
+ virtual void _tao_encode (
+ TAO_OutputCDR &
+ ACE_ENV_ARG_DECL
+ ) const;
+
+ virtual void _tao_decode (
+ TAO_InputCDR &
+ ACE_ENV_ARG_DECL
+ );
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_exception/exception_ctor.cpp:66
+
+ InvalidPolicies (
+ const ::CORBA::UShortSeq & _tao_indices
+ );
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_exception/exception_ch.cpp:129
+
+ virtual CORBA::TypeCode_ptr _tao_type (void) const;
+ };
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_interface.cpp:598
+
+#if !defined (_CORBA_POLICY__VAR_OUT_CH_)
+#define _CORBA_POLICY__VAR_OUT_CH_
+
+ class Policy;
+ typedef Policy *Policy_ptr;
+
+ typedef
+ TAO_Objref_Var_T<
+ Policy
+ >
+ Policy_var;
+
+ typedef
+ TAO_Objref_Out_T<
+ Policy
+ >
+ Policy_out;
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:54
+
+#if !defined (_CORBA_POLICY_CH_)
+#define _CORBA_POLICY_CH_
+
+ class TAO_Export Policy
+ : public virtual CORBA::Object
+ {
+ public:
+ friend class TAO::Narrow_Utils<Policy>;
+ typedef Policy_ptr _ptr_type;
+ typedef Policy_var _var_type;
+ typedef Policy_out _out_type;
+
+ // The static operations.
+ static Policy_ptr _duplicate (Policy_ptr obj);
+
+ static void _tao_release (Policy_ptr obj);
+
+ static Policy_ptr _narrow (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static Policy_ptr _unchecked_narrow (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static Policy_ptr _nil (void)
+ {
+ return static_cast<Policy_ptr> (0);
+ }
+
+ static void _tao_any_destructor (void *);
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual CORBA::PolicyType policy_type (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual ::CORBA::Policy_ptr copy (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void destroy (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:210
+
+ virtual CORBA::Boolean _is_a (
+ const char *type_id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ virtual const char* _interface_repository_id (void) const;
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+
+ // Handcrafted
+ // ****************************************************************
+ virtual CORBA::Boolean _tao_encode (TAO_OutputCDR &);
+ virtual CORBA::Boolean _tao_decode (TAO_InputCDR &);
+ virtual TAO_Cached_Policy_Type _tao_cached_type (void) const;
+ virtual TAO_Policy_Scope _tao_scope (void) const;
+ // ****************************************************************
+
+ private:
+ TAO::Collocation_Proxy_Broker *the_TAO_Policy_Proxy_Broker_;
+
+ protected:
+ // Concrete interface only.
+ Policy (void);
+
+ // These methods travese the inheritance tree and set the
+ // parents piece of the given class in the right mode.
+ virtual void CORBA_Policy_setup_collocation (void);
+
+ // Concrete non-local interface only.
+ Policy (
+ IOP::IOR *ior,
+ TAO_ORB_Core *orb_core = 0
+ );
+
+ // Non-local interface only.
+ Policy (
+ TAO_Stub *objref,
+ CORBA::Boolean _tao_collocated = 0,
+ TAO_Abstract_ServantBase *servant = 0,
+ TAO_ORB_Core *orb_core = 0
+ );
+
+ virtual ~Policy (void);
+
+ private:
+ // Private and unimplemented for concrete interfaces.
+ Policy (const Policy &);
+
+ void operator= (const Policy &);
+ };
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_interface.cpp:598
+
+#if !defined (_CORBA_POLICYMANAGER__VAR_OUT_CH_)
+#define _CORBA_POLICYMANAGER__VAR_OUT_CH_
+
+ class PolicyManager;
+ typedef PolicyManager *PolicyManager_ptr;
+
+ typedef
+ TAO_Objref_Var_T<
+ PolicyManager
+ >
+ PolicyManager_var;
+
+ typedef
+ TAO_Objref_Out_T<
+ PolicyManager
+ >
+ PolicyManager_out;
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:54
+
+#if !defined (_CORBA_POLICYMANAGER_CH_)
+#define _CORBA_POLICYMANAGER_CH_
+
+ class TAO_Export PolicyManager
+ : public virtual CORBA::Object
+ {
+ public:
+ typedef PolicyManager_ptr _ptr_type;
+ typedef PolicyManager_var _var_type;
+
+ // The static operations.
+ static PolicyManager_ptr _duplicate (PolicyManager_ptr obj);
+
+ static void _tao_release (PolicyManager_ptr obj);
+
+ static PolicyManager_ptr _narrow (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static PolicyManager_ptr _unchecked_narrow (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static PolicyManager_ptr _nil (void)
+ {
+ return static_cast<PolicyManager_ptr> (0);
+ }
+
+ static void _tao_any_destructor (void *);
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual ::CORBA::PolicyList * get_policy_overrides (
+ const ::CORBA::PolicyTypeSeq & ts
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void set_policy_overrides (
+ const ::CORBA::PolicyList & policies,
+ ::CORBA::SetOverrideType set_add
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ ::CORBA::InvalidPolicies
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:210
+
+ virtual CORBA::Boolean _is_a (
+ const char *type_id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ virtual const char* _interface_repository_id (void) const;
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+
+ protected:
+ // Abstract or local interface only.
+ PolicyManager (void);
+
+ virtual ~PolicyManager (void);
+
+ private:
+ // Private and unimplemented for concrete interfaces.
+ PolicyManager (const PolicyManager &);
+
+ void operator= (const PolicyManager &);
+ };
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_interface.cpp:598
+
+#if !defined (_CORBA_POLICYCURRENT__VAR_OUT_CH_)
+#define _CORBA_POLICYCURRENT__VAR_OUT_CH_
+
+ class PolicyCurrent;
+ typedef PolicyCurrent *PolicyCurrent_ptr;
+
+ typedef
+ TAO_Objref_Var_T<
+ PolicyCurrent
+ >
+ PolicyCurrent_var;
+
+ typedef
+ TAO_Objref_Out_T<
+ PolicyCurrent
+ >
+ PolicyCurrent_out;
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:54
+
+#if !defined (_CORBA_POLICYCURRENT_CH_)
+#define _CORBA_POLICYCURRENT_CH_
+
+ class TAO_Export PolicyCurrent
+ : public virtual ::CORBA::PolicyManager,
+ public virtual ::CORBA::Current
+ {
+ public:
+ typedef PolicyCurrent_ptr _ptr_type;
+ typedef PolicyCurrent_var _var_type;
+
+ // The static operations.
+ static PolicyCurrent_ptr _duplicate (PolicyCurrent_ptr obj);
+
+ static void _tao_release (PolicyCurrent_ptr obj);
+
+ static PolicyCurrent_ptr _narrow (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static PolicyCurrent_ptr _unchecked_narrow (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static PolicyCurrent_ptr _nil (void)
+ {
+ return static_cast<PolicyCurrent_ptr> (0);
+ }
+
+ static void _tao_any_destructor (void *);
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:210
+
+ virtual CORBA::Boolean _is_a (
+ const char *type_id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ virtual const char* _interface_repository_id (void) const;
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+
+ protected:
+ // Abstract or local interface only.
+ PolicyCurrent (void);
+
+ virtual ~PolicyCurrent (void);
+
+ private:
+ // Private and unimplemented for concrete interfaces.
+ PolicyCurrent (const PolicyCurrent &);
+
+ void operator= (const PolicyCurrent &);
+ };
+
+#endif /* end #if !defined */
+
+// TAO_IDL - Generated from
+// be\be_visitor_module/module_ch.cpp:66
+
+} // module CORBA
+
+// Proxy Broker Factory function pointer declarations.
+
+// TAO_IDL - Generated from
+// be\be_visitor_root/root.cpp:139
+
+extern TAO_Export
+TAO::Collocation_Proxy_Broker *
+(*CORBA__TAO_Policy_Proxy_Broker_Factory_function_pointer) (
+ CORBA::Object_ptr obj
+ );
+
+// TAO_IDL - Generated from
+// be\be_visitor_traits.cpp:61
+
+// Traits specializations.
+namespace TAO
+{
+
+#if !defined (_CORBA_POLICY__TRAITS_)
+#define _CORBA_POLICY__TRAITS_
+
+ template<>
+ struct TAO_Export Objref_Traits< ::CORBA::Policy>
+ {
+ static ::CORBA::Policy_ptr duplicate (
+ ::CORBA::Policy_ptr
+ );
+ static void release (
+ ::CORBA::Policy_ptr
+ );
+ static ::CORBA::Policy_ptr nil (void);
+ static CORBA::Boolean marshal (
+ const ::CORBA::Policy_ptr p,
+ TAO_OutputCDR & cdr
+ );
+ };
+
+#endif /* end #if !defined */
+
+#if !defined (_CORBA_POLICYMANAGER__TRAITS_CH_)
+#define _CORBA_POLICYMANAGER__TRAITS_CH_
+
+ template<>
+ struct TAO_Export Objref_Traits< ::CORBA::PolicyManager>
+ {
+ static ::CORBA::PolicyManager_ptr duplicate (
+ ::CORBA::PolicyManager_ptr
+ );
+ static void release (
+ ::CORBA::PolicyManager_ptr
+ );
+ static ::CORBA::PolicyManager_ptr nil (void);
+ static CORBA::Boolean marshal (
+ const ::CORBA::PolicyManager_ptr p,
+ TAO_OutputCDR & cdr
+ );
+ };
+
+#endif /* end #if !defined */
+
+#if !defined (_CORBA_POLICYCURRENT__TRAITS_)
+#define _CORBA_POLICYCURRENT__TRAITS_
+
+ template<>
+ struct TAO_Export Objref_Traits< ::CORBA::PolicyCurrent>
+ {
+ static ::CORBA::PolicyCurrent_ptr duplicate (
+ ::CORBA::PolicyCurrent_ptr
+ );
+ static void release (
+ ::CORBA::PolicyCurrent_ptr
+ );
+ static ::CORBA::PolicyCurrent_ptr nil (void);
+ static CORBA::Boolean marshal (
+ const ::CORBA::PolicyCurrent_ptr p,
+ TAO_OutputCDR & cdr
+ );
+ };
+
+#endif /* end #if !defined */
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_exception/cdr_op_ch.cpp:52
+
+TAO_Export CORBA::Boolean operator<< (TAO_OutputCDR &, const CORBA::PolicyError &);
+TAO_Export CORBA::Boolean operator>> (TAO_InputCDR &, CORBA::PolicyError &);
+
+// TAO_IDL - Generated from
+// be\be_visitor_exception/cdr_op_ch.cpp:52
+
+TAO_Export CORBA::Boolean operator<< (TAO_OutputCDR &, const CORBA::InvalidPolicies &);
+TAO_Export CORBA::Boolean operator>> (TAO_InputCDR &, CORBA::InvalidPolicies &);
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/cdr_op_ch.cpp:55
+
+TAO_Export CORBA::Boolean operator<< (TAO_OutputCDR &, const CORBA::Policy_ptr );
+TAO_Export CORBA::Boolean operator>> (TAO_InputCDR &, CORBA::Policy_ptr &);
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:955
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+#include "tao/PolicyC.inl"
+#endif /* defined INLINE */
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#if defined (__BORLANDC__)
+#pragma option pop
+#endif /* __BORLANDC__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* ifndef */
+
+
diff --git a/TAO/tao/PolicyC.inl b/TAO/tao/PolicyC.inl
new file mode 100644
index 00000000000..f9aac3d9fae
--- /dev/null
+++ b/TAO/tao/PolicyC.inl
@@ -0,0 +1,62 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/interface_ci.cpp:70
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+#if !defined (_CORBA_POLICY___CI_)
+#define _CORBA_POLICY___CI_
+
+ACE_INLINE
+CORBA::Policy::Policy (
+ TAO_Stub *objref,
+ CORBA::Boolean _tao_collocated,
+ TAO_Abstract_ServantBase *servant,
+ TAO_ORB_Core *oc
+ )
+ : ::CORBA::Object (objref, _tao_collocated, servant, oc),
+ the_TAO_Policy_Proxy_Broker_ (0)
+{
+ this->CORBA_Policy_setup_collocation ();
+}
+
+ACE_INLINE
+CORBA::Policy::Policy (
+ IOP::IOR *ior,
+ TAO_ORB_Core *oc
+ )
+ : ::CORBA::Object (ior, oc),
+ the_TAO_Policy_Proxy_Broker_ (0)
+{
+}
+
+#endif /* end #if !defined */
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PolicyFactory_Registry_Adapter.cpp b/TAO/tao/PolicyFactory_Registry_Adapter.cpp
new file mode 100644
index 00000000000..c33f3a2710e
--- /dev/null
+++ b/TAO/tao/PolicyFactory_Registry_Adapter.cpp
@@ -0,0 +1,17 @@
+// $Id$
+
+#include "tao/PolicyFactory_Registry_Adapter.h"
+
+
+ACE_RCSID (tao,
+ PolicyFactory_Registry_Adapter,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO::PolicyFactory_Registry_Adapter::~PolicyFactory_Registry_Adapter (void)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PolicyFactory_Registry_Adapter.h b/TAO/tao/PolicyFactory_Registry_Adapter.h
new file mode 100644
index 00000000000..586555523c0
--- /dev/null
+++ b/TAO/tao/PolicyFactory_Registry_Adapter.h
@@ -0,0 +1,94 @@
+// -*- C++ -*-
+
+// ===================================================================
+/**
+ * @file PolicyFactory_Registry_Adapter.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+// ===================================================================
+
+#ifndef TAO_POLICY_FACTORY_REGISTRY_ADAPTER_H
+#define TAO_POLICY_FACTORY_REGISTRY_ADAPTER_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/TAO_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Basic_Types.h"
+
+#include "ace/CORBA_macros.h"
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+//-- Forward Declarations--
+namespace CORBA
+{
+ typedef ULong PolicyType;
+
+ class Policy;
+ typedef Policy *Policy_ptr;
+
+ class Any;
+
+ class Environment;
+}
+
+namespace PortableInterceptor
+{
+ class PolicyFactory;
+ typedef PolicyFactory *PolicyFactory_ptr;
+}
+
+namespace TAO
+{
+ /**
+ * @class PolicyFactory_Registry_Adapter
+ *
+ * @brief ORB-specific PortableInterceptor::PolicyFactory registry.
+ *
+ * Class that offers an interface to the ORB to load and manipulate
+ * PolicyFactory_Registry
+ */
+ class TAO_Export PolicyFactory_Registry_Adapter
+ {
+ public:
+ virtual ~PolicyFactory_Registry_Adapter (void);
+
+ /// Register a PolicyFactory with the underlying PolicyFactory
+ /// sequence. This method should only be called during ORB
+ /// initialization.
+ virtual void register_policy_factory (
+ CORBA::PolicyType type,
+ PortableInterceptor::PolicyFactory_ptr policy_factory
+ ACE_ENV_ARG_DECL) = 0;
+
+ /// Construct a policy of the given type with the information
+ /// contained in the CORBA::Any @a value.
+ virtual CORBA::Policy_ptr create_policy (CORBA::PolicyType type,
+ const CORBA::Any &value
+ ACE_ENV_ARG_DECL) = 0;
+
+ /// Create an empty policy, usually to be filled in later by
+ /// demarshaling.
+ virtual CORBA::Policy_ptr _create_policy (CORBA::PolicyType type
+ ACE_ENV_ARG_DECL) = 0;
+
+ /// Check if a @c PolicyFactory corresponding to the given type,
+ /// exists.
+ virtual bool factory_exists (CORBA::PolicyType & type) const = 0;
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_POLICY_FACTORY_REGISTRY_ADAPTER_H */
diff --git a/TAO/tao/PolicyFactory_Registry_Factory.cpp b/TAO/tao/PolicyFactory_Registry_Factory.cpp
new file mode 100644
index 00000000000..76a51641ae7
--- /dev/null
+++ b/TAO/tao/PolicyFactory_Registry_Factory.cpp
@@ -0,0 +1,15 @@
+//$Id$
+
+#include "tao/PolicyFactory_Registry_Factory.h"
+
+ACE_RCSID (tao,
+ PolicyFactory_Registry_Factory,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_PolicyFactory_Registry_Factory::~TAO_PolicyFactory_Registry_Factory (void)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PolicyFactory_Registry_Factory.h b/TAO/tao/PolicyFactory_Registry_Factory.h
new file mode 100644
index 00000000000..6da8fdda14a
--- /dev/null
+++ b/TAO/tao/PolicyFactory_Registry_Factory.h
@@ -0,0 +1,47 @@
+// ================================================================
+/**
+ * @file PolicyFactory_Registry_Factory.h
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan (coryan@cs.wustl.edu)
+ */
+// ================================================================
+
+#ifndef TAO_POLICYFACTORY_REGISTRY_FACTORY_H
+#define TAO_POLICYFACTORY_REGISTRY_FACTORY_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/TAO_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Versioned_Namespace.h"
+#include "ace/Service_Object.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ class PolicyFactory_Registry_Adapter;
+}
+
+/**
+ * @class TAO_PolicyFactory_Registry_Factory
+ */
+class TAO_Export TAO_PolicyFactory_Registry_Factory :
+ public ACE_Service_Object
+{
+public:
+ virtual ~TAO_PolicyFactory_Registry_Factory (void);
+
+ virtual TAO::PolicyFactory_Registry_Adapter* create (void) = 0;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_POLICYFACTORY_REGISTRY_FACTORY_H */
diff --git a/TAO/tao/PolicyS.h b/TAO/tao/PolicyS.h
new file mode 100644
index 00000000000..70b87da46b6
--- /dev/null
+++ b/TAO/tao/PolicyS.h
@@ -0,0 +1,23 @@
+/* -*- C++ -*- $Id$ */
+//=============================================================================
+/**
+ * @file PolicyS.h
+ *
+ * $Id$
+ *
+ * The file is almost empty and only present to keep other IDL files
+ * that include Policy.pidl happy.
+ *
+ */
+//=============================================================================
+
+#ifndef TAO_PIDL_POLICY_S_H
+#define TAO_PIDL_POLICY_S_H
+#include "tao/PolicyC.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+
+#endif /* TAO_PIDL_POLICY_S_H*/
diff --git a/TAO/tao/Policy_Current.cpp b/TAO/tao/Policy_Current.cpp
new file mode 100644
index 00000000000..14cb7c89456
--- /dev/null
+++ b/TAO/tao/Policy_Current.cpp
@@ -0,0 +1,83 @@
+// $Id$
+
+#include "tao/Policy_Current.h"
+
+#if (TAO_HAS_CORBA_MESSAGING == 1)
+
+#include "tao/TSS_Resources.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/Policy_Current.inl"
+#endif /* ! __ACE_INLINE__ */
+
+ACE_RCSID (tao,
+ Policy_Current,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Policy_Current_Impl &
+TAO_Policy_Current::implementation (TAO_Policy_Current_Impl &current)
+{
+ TAO_TSS_Resources * const tss =
+ TAO_TSS_Resources::instance ();
+
+ TAO_Policy_Current_Impl *old = tss->policy_current_;
+ tss->policy_current_ = &current;
+ return *old;
+}
+
+TAO_Policy_Current_Impl &
+TAO_Policy_Current::implementation (void) const
+{
+ return *TAO_TSS_Resources::instance ()->policy_current_;
+}
+
+CORBA::Policy_ptr
+TAO_Policy_Current::get_policy (
+ CORBA::PolicyType policy
+ ACE_ENV_ARG_DECL)
+{
+ TAO_Policy_Current_Impl &impl = this->implementation ();
+
+ return impl.get_policy (policy ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::PolicyList *
+TAO_Policy_Current::get_policy_overrides (
+ const CORBA::PolicyTypeSeq & ts
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+
+{
+ TAO_Policy_Current_Impl &impl = this->implementation ();
+
+ return impl.get_policy_overrides (ts ACE_ENV_ARG_PARAMETER);
+}
+
+void
+TAO_Policy_Current::set_policy_overrides (const CORBA::PolicyList & policies,
+ CORBA::SetOverrideType set_add
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ CORBA::InvalidPolicies))
+{
+ TAO_Policy_Current_Impl &impl = this->implementation ();
+
+ impl.set_policy_overrides (policies, set_add ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::Policy_ptr
+TAO_Policy_Current::get_cached_policy (TAO_Cached_Policy_Type type
+ ACE_ENV_ARG_DECL)
+{
+ TAO_Policy_Current_Impl &impl = this->implementation ();
+
+ return impl.get_cached_policy (type
+ ACE_ENV_ARG_PARAMETER);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_CORBA_MESSAGING == 1 */
diff --git a/TAO/tao/Policy_Current.h b/TAO/tao/Policy_Current.h
new file mode 100644
index 00000000000..889c1971d24
--- /dev/null
+++ b/TAO/tao/Policy_Current.h
@@ -0,0 +1,94 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Policy_Current.h
+ *
+ * $Id$
+ *
+ * An implementation for the CORBA::PolicyManager interface.
+ *
+ *
+ * @author Carlos O'Ryan (coryan@cs.wustl.edu)
+ */
+//=============================================================================
+
+
+#ifndef TAO_POLICY_CURRENT_H
+#define TAO_POLICY_CURRENT_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if (TAO_HAS_CORBA_MESSAGING == 1)
+
+#include "tao/PolicyC.h"
+#include "tao/LocalObject.h"
+
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Policy_Current_Impl;
+
+class TAO_Policy_Current
+ : public CORBA::PolicyCurrent
+ , public TAO_Local_RefCounted_Object
+{
+public:
+ /// Constructor
+ TAO_Policy_Current (void);
+
+ /// Obtain a single policy.
+ CORBA::Policy_ptr get_policy (
+ CORBA::PolicyType policy
+ ACE_ENV_ARG_DECL);
+
+ /// Obtain a single cached policy.
+ CORBA::Policy_ptr get_cached_policy (TAO_Cached_Policy_Type type
+ ACE_ENV_ARG_DECL);
+
+ // = The CORBA::PolicyManager operations
+
+ virtual CORBA::PolicyList * get_policy_overrides (
+ const CORBA::PolicyTypeSeq & ts
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual void set_policy_overrides (
+ const CORBA::PolicyList & policies,
+ CORBA::SetOverrideType set_add
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ CORBA::InvalidPolicies));
+
+ // = Set and get the implementation.
+ TAO_Policy_Current_Impl &implementation (void) const;
+ TAO_Policy_Current_Impl &implementation (TAO_Policy_Current_Impl &);
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#if defined (__ACE_INLINE__)
+# include "tao/Policy_Current.inl"
+#endif /* __ACE_INLINE__ */
+
+#endif /* TAO_HAS_CORBA_MESSAGING == 1 */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_POLICY_CURRENT_H */
diff --git a/TAO/tao/Policy_Current.inl b/TAO/tao/Policy_Current.inl
new file mode 100644
index 00000000000..3605ebd5b7e
--- /dev/null
+++ b/TAO/tao/Policy_Current.inl
@@ -0,0 +1,12 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO_Policy_Current::TAO_Policy_Current (void)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Policy_Current_Impl.cpp b/TAO/tao/Policy_Current_Impl.cpp
new file mode 100644
index 00000000000..9600341a74f
--- /dev/null
+++ b/TAO/tao/Policy_Current_Impl.cpp
@@ -0,0 +1,42 @@
+// $Id$
+
+#include "tao/Policy_Current_Impl.h"
+
+#if (TAO_HAS_CORBA_MESSAGING == 1)
+
+#if !defined (__ACE_INLINE__)
+# include "tao/Policy_Current_Impl.inl"
+#endif /* ! __ACE_INLINE__ */
+
+
+ACE_RCSID (tao,
+ Policy_Manager,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+void
+TAO_Policy_Current_Impl::set_policy_overrides (
+ const CORBA::PolicyList & policies,
+ CORBA::SetOverrideType set_add
+ ACE_ENV_ARG_DECL
+ )
+{
+ this->manager_impl_.set_policy_overrides (policies,
+ set_add
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::PolicyList *
+TAO_Policy_Current_Impl::get_policy_overrides (
+ const CORBA::PolicyTypeSeq & ts
+ ACE_ENV_ARG_DECL
+ )
+{
+ return this->manager_impl_.get_policy_overrides (ts
+ ACE_ENV_ARG_PARAMETER);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_CORBA_MESSAGING == 1 */
diff --git a/TAO/tao/Policy_Current_Impl.h b/TAO/tao/Policy_Current_Impl.h
new file mode 100644
index 00000000000..270342fe234
--- /dev/null
+++ b/TAO/tao/Policy_Current_Impl.h
@@ -0,0 +1,86 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Policy_Current_Impl.h
+ *
+ * $Id$
+ *
+ * An implementation for the CORBA::PolicyManager interface.
+ *
+ *
+ * @author Carlos O'Ryan (coryan@cs.wustl.edu)
+ */
+//=============================================================================
+
+
+#ifndef TAO_POLICY_CURRENT_IMPL_H
+#define TAO_POLICY_CURRENT_IMPL_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/TAO_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/orbconf.h"
+
+#if (TAO_HAS_CORBA_MESSAGING == 1)
+
+#include "tao/PolicyC.h"
+#include "tao/LocalObject.h"
+#include "tao/Policy_Set.h"
+
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Policy_Current_Impl
+{
+public:
+
+ TAO_Policy_Current_Impl (void);
+
+ /// Obtain a single policy.
+ CORBA::Policy_ptr get_policy (CORBA::PolicyType policy
+ ACE_ENV_ARG_DECL);
+
+ /// Obtain a single cached policy.
+ CORBA::Policy_ptr get_cached_policy (TAO_Cached_Policy_Type type
+ ACE_ENV_ARG_DECL);
+
+ // = The CORBA::PolicyManager operations
+
+ CORBA::PolicyList * get_policy_overrides (
+ const CORBA::PolicyTypeSeq & ts
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+ void set_policy_overrides (const CORBA::PolicyList & policies,
+ CORBA::SetOverrideType set_add
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+private:
+ /// The implementation.
+ TAO_Policy_Set manager_impl_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#if defined (__ACE_INLINE__)
+# include "tao/Policy_Current_Impl.inl"
+#endif /* __ACE_INLINE__ */
+
+#endif /* TAO_HAS_CORBA_MESSAGING == 1 */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_POLICY_CURRENT_IMPL_H */
diff --git a/TAO/tao/Policy_Current_Impl.inl b/TAO/tao/Policy_Current_Impl.inl
new file mode 100644
index 00000000000..c7cc06d9743
--- /dev/null
+++ b/TAO/tao/Policy_Current_Impl.inl
@@ -0,0 +1,29 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO_Policy_Current_Impl::TAO_Policy_Current_Impl (void)
+ : manager_impl_ (TAO_POLICY_THREAD_SCOPE)
+{
+}
+
+ACE_INLINE CORBA::Policy_ptr
+TAO_Policy_Current_Impl::get_policy (
+ CORBA::PolicyType policy
+ ACE_ENV_ARG_DECL)
+{
+ return this->manager_impl_.get_policy (policy ACE_ENV_ARG_PARAMETER);
+}
+
+ACE_INLINE CORBA::Policy_ptr
+TAO_Policy_Current_Impl::get_cached_policy (TAO_Cached_Policy_Type type
+ ACE_ENV_ARG_DECL)
+{
+ return this->manager_impl_.get_cached_policy (type
+ ACE_ENV_ARG_PARAMETER);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Policy_Forward.pidl b/TAO/tao/Policy_Forward.pidl
new file mode 100644
index 00000000000..ed07e168ce3
--- /dev/null
+++ b/TAO/tao/Policy_Forward.pidl
@@ -0,0 +1,51 @@
+// -*- IDL -*-
+
+/**
+ * @file Policy_Forward.pidl
+ *
+ * $Id$
+ *
+ * @brief Pre-compiled IDL source to forward declare some critical
+ * Policy-related types.
+ *
+ * This file is used to generate the code in
+ * Policy_ForwardC.{h,cpp}.
+ *
+ * The steps to regenerate the code are as follows:
+ *
+ * 1. Run the tao_idl compiler on the patched pidl file. The
+ * command used for this is:
+ *
+ * tao_idl.exe
+ * -o orig -Ge 1 -GA -SS -Sci -Sorb
+ * -Wb,export_macro="tao/TAO_Export"
+ * -Wb,pre_include="ace/pre.h"
+ * -Wb,post_include="ace/post.h"
+ * Policy_Forward.pidl
+ */
+
+#ifndef TAO_CORBA_POLICY_FORWARD_PIDL
+#define TAO_CORBA_POLICY_FORWARD_PIDL
+
+#pragma prefix "omg.org"
+
+module CORBA
+{
+ typedef unsigned long PolicyType;
+
+ interface Policy;
+
+ typedef sequence<Policy> PolicyList;
+
+ typedef sequence<PolicyType> PolicyTypeSeq;
+
+ local interface PolicyCurrent;
+
+ enum SetOverrideType
+ {
+ SET_OVERRIDE,
+ ADD_OVERRIDE
+ };
+};
+
+#endif /* TAO_CORBA_POLICY_FORWARD_PIDL */
diff --git a/TAO/tao/Policy_Manager.cpp b/TAO/tao/Policy_Manager.cpp
new file mode 100644
index 00000000000..5e7383c4cc8
--- /dev/null
+++ b/TAO/tao/Policy_Manager.cpp
@@ -0,0 +1,40 @@
+// $Id$
+
+#include "tao/Policy_Manager.h"
+
+#if (TAO_HAS_CORBA_MESSAGING == 1)
+
+#if !defined (__ACE_INLINE__)
+# include "tao/Policy_Manager.i"
+#endif /* ! __ACE_INLINE__ */
+
+
+ACE_RCSID (tao,
+ Policy_Manager,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+CORBA::PolicyList *
+TAO_Policy_Manager::get_policy_overrides (const CORBA::PolicyTypeSeq & ts
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->mutex_, 0);
+ return this->impl_.get_policy_overrides (ts ACE_ENV_ARG_PARAMETER);
+}
+
+void
+TAO_Policy_Manager::set_policy_overrides (const CORBA::PolicyList & policies,
+ CORBA::SetOverrideType set_add
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ CORBA::InvalidPolicies))
+{
+ ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->mutex_);
+ this->impl_.set_policy_overrides (policies, set_add ACE_ENV_ARG_PARAMETER);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_CORBA_MESSAGING == 1 */
diff --git a/TAO/tao/Policy_Manager.h b/TAO/tao/Policy_Manager.h
new file mode 100644
index 00000000000..39158187253
--- /dev/null
+++ b/TAO/tao/Policy_Manager.h
@@ -0,0 +1,99 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Policy_Manager.h
+ *
+ * $Id$
+ *
+ * An implementation for the CORBA::PolicyManager interface.
+ *
+ * @author Carlos O'Ryan (coryan@cs.wustl.edu)
+ */
+//=============================================================================
+
+
+#ifndef TAO_POLICY_MANAGER_H
+#define TAO_POLICY_MANAGER_H
+
+#include /**/ "ace/pre.h"
+#include "ace/Guard_T.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/orbconf.h"
+
+#if (TAO_HAS_CORBA_MESSAGING == 1)
+
+#include "tao/PolicyC.h"
+#include "tao/LocalObject.h"
+#include "tao/Policy_Set.h"
+
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Policy_Manager
+ : public CORBA::PolicyManager
+ , public TAO_Local_RefCounted_Object
+{
+public:
+ /// constructor
+ TAO_Policy_Manager (void);
+
+ /// Obtain a single policy.
+ CORBA::Policy_ptr get_policy (CORBA::PolicyType policy
+ ACE_ENV_ARG_DECL);
+
+ /// Obtain a single cached policy.
+ CORBA::Policy_ptr get_cached_policy (TAO_Cached_Policy_Type type
+ ACE_ENV_ARG_DECL);
+
+ // = The CORBA::PolicyManager operations
+
+ virtual CORBA::PolicyList * get_policy_overrides (
+ const CORBA::PolicyTypeSeq & ts
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual void set_policy_overrides (const CORBA::PolicyList & policies,
+ CORBA::SetOverrideType set_add
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ CORBA::InvalidPolicies));
+
+private:
+
+ // Disallow copying.
+ TAO_Policy_Manager (TAO_Policy_Manager const &);
+ TAO_Policy_Manager & operator= (TAO_Policy_Manager const &);
+
+private:
+ /// Protect access
+ TAO_SYNCH_MUTEX mutex_;
+
+ /// The implementation.
+ TAO_Policy_Set impl_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#if defined (__ACE_INLINE__)
+# include "tao/Policy_Manager.i"
+#endif /* __ACE_INLINE__ */
+
+#endif /* TAO_HAS_CORBA_MESSAGING == 1 */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_POLICY_MANAGER_H */
diff --git a/TAO/tao/Policy_Manager.i b/TAO/tao/Policy_Manager.i
new file mode 100644
index 00000000000..b982fad4f14
--- /dev/null
+++ b/TAO/tao/Policy_Manager.i
@@ -0,0 +1,38 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO_Policy_Manager::TAO_Policy_Manager (void)
+ : impl_ (TAO_POLICY_ORB_SCOPE)
+{
+}
+
+ACE_INLINE CORBA::Policy_ptr
+TAO_Policy_Manager::get_policy (
+ CORBA::PolicyType policy
+ ACE_ENV_ARG_DECL)
+{
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->mutex_, 0);
+ return this->impl_.get_policy (policy ACE_ENV_ARG_PARAMETER);
+}
+
+ACE_INLINE CORBA::Policy_ptr
+TAO_Policy_Manager::get_cached_policy (TAO_Cached_Policy_Type type
+ ACE_ENV_ARG_DECL)
+{
+
+ // @@ Previous code used a "double-checked locking hack" to check
+ // if the policy was set before grabbing the lock to actually get
+ // it, so that could save a lock operation. This was removed, as
+ // it is not as easy to do this anymore.
+
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->mutex_, 0);
+
+ return this->impl_.get_cached_policy (type
+ ACE_ENV_ARG_PARAMETER);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Policy_Set.cpp b/TAO/tao/Policy_Set.cpp
new file mode 100644
index 00000000000..b5f791c5be8
--- /dev/null
+++ b/TAO/tao/Policy_Set.cpp
@@ -0,0 +1,373 @@
+// $Id$
+
+#include "tao/Policy_Set.h"
+#include "tao/Environment.h"
+#include "tao/SystemException.h"
+#include "tao/debug.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/Policy_Set.i"
+#endif /* ! __ACE_INLINE__ */
+
+
+ACE_RCSID (tao,
+ Policy_Set,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Policy_Set::TAO_Policy_Set (TAO_Policy_Scope scope)
+ : scope_ (scope)
+{
+ for (unsigned int i = 0; i < TAO_CACHED_POLICY_MAX_CACHED; ++i)
+ this->cached_policies_[i] = 0;
+}
+
+TAO_Policy_Set::~TAO_Policy_Set (void)
+{
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ this->cleanup_i (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ // Ignore exceptions...
+ }
+ ACE_ENDTRY;
+}
+
+TAO_Policy_Set::TAO_Policy_Set (const TAO_Policy_Set &rhs)
+ : scope_ (rhs.scope_)
+{
+ // Initialize the cache.
+ for (int i = 0; i < TAO_CACHED_POLICY_MAX_CACHED; ++i)
+ {
+ this->cached_policies_[i] = 0;
+ }
+
+ // Copy over the policy list.
+ this->policy_list_.length (rhs.policy_list_.length ());
+
+ ACE_TRY_NEW_ENV
+ {
+ for (CORBA::ULong i = 0; i < rhs.policy_list_.length (); ++i)
+ {
+ CORBA::Policy_ptr policy = rhs.policy_list_[i];
+
+ if (CORBA::is_nil (policy))
+ {
+ continue;
+ }
+
+ CORBA::Policy_var copy =
+ policy->copy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Add the "cacheable" policies into the cache.
+ if (copy->_tao_cached_type () != TAO_CACHED_POLICY_UNCACHED)
+ {
+ this->cached_policies_[copy->_tao_cached_type ()] =
+ copy.ptr ();
+ }
+
+ this->policy_list_[i] = copy._retn ();
+ }
+
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ if (TAO_debug_level > 4)
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "TAO_Policy_Set::TAO_Policy_Set");
+
+ // "Try" to make this recoverable as we must have run out of memory.
+ this->policy_list_.length (0);
+ }
+ ACE_ENDTRY;
+}
+
+void
+TAO_Policy_Set::copy_from (TAO_Policy_Set *source
+ ACE_ENV_ARG_DECL)
+{
+ if (source == 0)
+ {
+ return;
+ }
+
+ this->cleanup_i (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ for (CORBA::ULong i = 0; i < source->policy_list_.length (); ++i)
+ {
+ CORBA::Policy_ptr policy = source->policy_list_[i];
+
+ if (CORBA::is_nil (policy))
+ {
+ continue;
+ }
+
+ if (! this->compatible_scope (policy->_tao_scope()))
+ {
+ ACE_THROW (CORBA::NO_PERMISSION ());
+ }
+
+ CORBA::Policy_var copy =
+ policy->copy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ CORBA::ULong const length = this->policy_list_.length ();
+ this->policy_list_.length (length + 1);
+
+ // Add the "cacheable" policies into the cache.
+ if (copy->_tao_cached_type () != TAO_CACHED_POLICY_UNCACHED)
+ {
+ this->cached_policies_[copy->_tao_cached_type ()] = copy.ptr ();
+ }
+
+ this->policy_list_[length] = copy._retn ();
+ }
+}
+
+void
+TAO_Policy_Set::cleanup_i (ACE_ENV_SINGLE_ARG_DECL)
+{
+ const CORBA::ULong len = this->policy_list_.length ();
+ // Cleanup the policy list.
+ for (CORBA::ULong i = 0; i < len; ++i)
+ {
+ this->policy_list_[i]->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ this->policy_list_[i] = CORBA::Policy::_nil ();
+ }
+
+ this->policy_list_.length (0);
+
+ // Cleanup the cache.
+ for (CORBA::ULong j = 0; j < TAO_CACHED_POLICY_MAX_CACHED; ++j)
+ {
+ this->cached_policies_[j] = 0;
+ }
+}
+
+ // @@ !!! Add comments regarding Policy lifetimes, etc.
+void
+TAO_Policy_Set::set_policy_overrides (const CORBA::PolicyList &policies,
+ CORBA::SetOverrideType set_add
+ ACE_ENV_ARG_DECL)
+{
+ // @@ The spec does not say what to do on this case.
+ if (set_add != CORBA::SET_OVERRIDE && set_add != CORBA::ADD_OVERRIDE)
+ {
+ ACE_THROW (CORBA::BAD_PARAM ());
+ }
+
+ if (set_add == CORBA::SET_OVERRIDE)
+ {
+ this->cleanup_i (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ // Flag, indicating whether we have already overridden
+ // RTCORBA::ServerProtocolPolicy during this call.
+ bool server_protocol_set = false;
+
+ const CORBA::ULong plen = policies.length ();
+
+ for (CORBA::ULong i = 0; i < plen; ++i)
+ {
+ CORBA::Policy_ptr policy = policies[i];
+
+ if (CORBA::is_nil (policy))
+ {
+ continue;
+ }
+
+ const CORBA::PolicyType policy_type =
+ policy->policy_type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (policy_type == TAO_RT_SERVER_PROTOCOL_POLICY_TYPE)
+ {
+ // Only one ServerProtocolPolicy should be included in a
+ // given PolicyList (section 4.15.2 of RTCORBA 1.0, i.e.,
+ // ptc/99-05-03).
+ // User-caused exceptional conditions can leave the Policy
+ // Manager in an inconsistent state. It is the
+ // responsibility of the user to return it to consistent state.
+ if (server_protocol_set)
+ {
+ ACE_THROW (CORBA::INV_POLICY ());
+ }
+
+ server_protocol_set = true;
+ }
+
+ this->set_policy (policy ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+}
+
+void
+TAO_Policy_Set::set_policy (const CORBA::Policy_ptr policy
+ ACE_ENV_ARG_DECL)
+{
+ if (! this->compatible_scope (policy->_tao_scope()))
+ {
+ ACE_THROW (CORBA::NO_PERMISSION ());
+ }
+
+ const CORBA::PolicyType policy_type =
+ policy->policy_type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ CORBA::Policy_var copy = policy->copy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ CORBA::ULong j = 0;
+ const CORBA::ULong length = this->policy_list_.length ();
+
+ while (j != length)
+ {
+ CORBA::ULong current =
+ this->policy_list_[j]->policy_type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (current == policy_type)
+ {
+ this->policy_list_[j]->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->policy_list_[j] = copy.ptr ();
+ break;
+ }
+
+ ++j;
+ }
+
+ if (j == length)
+ {
+ this->policy_list_.length (length + 1);
+ this->policy_list_[j] = copy.ptr ();
+ }
+
+ // If this is a policy that gets accessed on the critical path,
+ // save a pointer to it in the cache.
+ TAO_Cached_Policy_Type cached_policy_type = policy->_tao_cached_type ();
+
+ if (cached_policy_type != TAO_CACHED_POLICY_UNCACHED)
+ {
+ this->cached_policies_[cached_policy_type] = copy.ptr ();
+ }
+
+ // Transfer ownership to the policy list.
+ (void) copy._retn ();
+}
+
+CORBA::PolicyList *
+TAO_Policy_Set::get_policy_overrides (const CORBA::PolicyTypeSeq &types
+ ACE_ENV_ARG_DECL)
+{
+ const CORBA::ULong slots = types.length ();
+ CORBA::PolicyList *policy_list_ptr;
+
+ if (slots == 0)
+ {
+ // Copy our own policy list.
+ ACE_NEW_THROW_EX (policy_list_ptr,
+ CORBA::PolicyList (this->policy_list_),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (0);
+
+ return policy_list_ptr;
+ }
+
+ ACE_NEW_THROW_EX (policy_list_ptr,
+ CORBA::PolicyList (slots),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (0);
+
+ CORBA::PolicyList_var policy_list (policy_list_ptr);
+ policy_list->length (slots);
+ CORBA::ULong n = 0;
+
+ for (CORBA::ULong j = 0; j < slots; ++j)
+ {
+ const CORBA::ULong slot = types[j];
+ const CORBA::ULong length = this->policy_list_.length ();
+
+ for (CORBA::ULong i = 0; i < length; ++i)
+ {
+ const CORBA::ULong current =
+ this->policy_list_[i]->policy_type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ if (current != slot)
+ {
+ continue;
+ }
+
+ policy_list[n++] =
+ CORBA::Policy::_duplicate (this->policy_list_[i]);
+ break;
+ }
+ }
+
+ policy_list->length (n); // Truncate buffer if necessary.
+
+ return policy_list._retn ();
+}
+
+CORBA::Policy_ptr
+TAO_Policy_Set::get_policy (CORBA::PolicyType type
+ ACE_ENV_ARG_DECL)
+{
+ const CORBA::ULong length = this->policy_list_.length ();
+
+ for (CORBA::ULong i = 0; i < length; ++i)
+ {
+ const CORBA::ULong current =
+ this->policy_list_[i]->policy_type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ if (current != type)
+ {
+ continue;
+ }
+
+ return CORBA::Policy::_duplicate (this->policy_list_[i]);
+ }
+
+ return CORBA::Policy::_nil ();
+}
+
+CORBA::Policy_ptr
+TAO_Policy_Set::get_cached_const_policy (TAO_Cached_Policy_Type type) const
+{
+ if (type != TAO_CACHED_POLICY_UNCACHED
+ && type < TAO_CACHED_POLICY_MAX_CACHED)
+ {
+ return this->cached_policies_[type];
+ }
+
+ return CORBA::Policy::_nil ();
+}
+
+CORBA::Policy_ptr
+TAO_Policy_Set::get_cached_policy (TAO_Cached_Policy_Type type
+ ACE_ENV_ARG_DECL_NOT_USED)
+{
+ if (type != TAO_CACHED_POLICY_UNCACHED
+ && type < TAO_CACHED_POLICY_MAX_CACHED)
+ {
+ return CORBA::Policy::_duplicate (this->cached_policies_[type]);
+ }
+
+ return CORBA::Policy::_nil ();
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Policy_Set.h b/TAO/tao/Policy_Set.h
new file mode 100644
index 00000000000..d5176c720b7
--- /dev/null
+++ b/TAO/tao/Policy_Set.h
@@ -0,0 +1,136 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Policy_Set.h
+ *
+ * $Id$
+ *
+ * A Policy Container that provides O(1) time access for policy that
+ * support caching (see orbconf.h).
+ *
+ * @author Angelo Cosaro (corsaro@cs.wustl.edu)
+ * @author Frank Hunleth (fhunleth@cs.wustl.edu)
+ * @author Carlos O'Ryan (coryan@cs.wustl.edu)
+ */
+//=============================================================================
+
+#ifndef TAO_POLICY_SET_H
+#define TAO_POLICY_SET_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/PolicyC.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_Policy_Set
+ *
+ * @brief The policy manager implementation.
+ *
+ * This class is used to implement both the CORBA::PolicyManager
+ * and the CORBA::PolicyCurrent interfaces.
+ */
+class TAO_Export TAO_Policy_Set
+{
+public:
+
+ /** Creates a TAO_Policy_Set that has a given scope. The
+ * scope is used to determinate whether or not a given policy can
+ * be set for the given Policy Manager Implementation.
+ */
+ TAO_Policy_Set (TAO_Policy_Scope scope);
+
+ /// Copy constructor.
+ TAO_Policy_Set (const TAO_Policy_Set &rhs);
+
+ /// Destructor
+ ~TAO_Policy_Set (void);
+
+ /// Copy the state from @a source, it uses the copy() operator to
+ /// obtain independent copies of all the policies.
+ void copy_from (TAO_Policy_Set* source
+ ACE_ENV_ARG_DECL);
+
+ /**
+ * Modify the list of policies to include @a policies.
+ * If @a set_add is @c CORBA::SET_OVERRIDE then we replace all the
+ * old policies. If it is @c CORBA::ADD_OVERRIDE we simply add the
+ * policies in @a policies.
+ * No attempt is made to validate the policies for consistency.
+ */
+ void set_policy_overrides (const CORBA::PolicyList & policies,
+ CORBA::SetOverrideType set_add
+ ACE_ENV_ARG_DECL);
+
+ /// Get the values (if any) for the policies in @a types, if @a
+ /// types is an empty list the method returns *all* the current
+ /// policies.
+ CORBA::PolicyList * get_policy_overrides (const CORBA::PolicyTypeSeq & types
+ ACE_ENV_ARG_DECL);
+
+ /// Obtain a single policy.
+ CORBA::Policy_ptr get_policy (CORBA::PolicyType policy
+ ACE_ENV_ARG_DECL);
+
+ /// Obtain a cached policy for speedy lookups.
+ /**
+ * This method just returns a const reference to the policy to avoid
+ * obtaining a lock to increment the reference count. As such, it
+ * can only be used for single threaded cases or cases where the
+ * policies cannot be removed such as at the object and thread level
+ * scopes. This method is most likely not appropriate for accessing
+ * policies at the ORB level scope in any situation.
+ */
+ CORBA::Policy_ptr get_cached_const_policy (TAO_Cached_Policy_Type type) const;
+
+ /// Obtain a single cached policy.
+ CORBA::Policy_ptr get_cached_policy (TAO_Cached_Policy_Type type
+ ACE_ENV_ARG_DECL);
+
+ /// Utility method to set a single policy.
+ void set_policy (const CORBA::Policy_ptr policy
+ ACE_ENV_ARG_DECL);
+
+ /// Returns the policy at the specified index.
+ /// @c CORBA::Policy::_nil () is returned if the policy doesn't
+ /// exist.
+ CORBA::Policy *get_policy_by_index (CORBA::ULong index) const;
+ CORBA::ULong num_policies (void) const;
+
+private:
+ TAO_Policy_Set & operator= (const TAO_Policy_Set&);
+
+ /// Remove and destroy all the policy objects owned by this policy
+ /// manager.
+ void cleanup_i (ACE_ENV_SINGLE_ARG_DECL);
+
+ /// Utility method to determine if a policy's scope is compatible with ours.
+ CORBA::Boolean compatible_scope (TAO_Policy_Scope policy_scope) const;
+
+private:
+
+ /// Policies set for this Policy_Manager
+ CORBA::PolicyList policy_list_;
+
+ /// List of caches.
+ CORBA::Policy *cached_policies_[TAO_CACHED_POLICY_MAX_CACHED];
+
+ /// Scope associated to the Policy Manager Impl
+ TAO_Policy_Scope scope_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/Policy_Set.i"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_POLICY_SET_H */
diff --git a/TAO/tao/Policy_Set.i b/TAO/tao/Policy_Set.i
new file mode 100644
index 00000000000..2263ccd4fad
--- /dev/null
+++ b/TAO/tao/Policy_Set.i
@@ -0,0 +1,27 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE CORBA::Boolean
+TAO_Policy_Set::compatible_scope (TAO_Policy_Scope policy_scope) const
+{
+ return
+ ((static_cast<unsigned int> (policy_scope)
+ & static_cast<unsigned int> (this->scope_)) > 0);
+}
+
+ACE_INLINE CORBA::Policy *
+TAO_Policy_Set::get_policy_by_index (CORBA::ULong index) const
+{
+ return CORBA::Policy::_duplicate (this->policy_list_[index]);
+}
+
+ACE_INLINE CORBA::ULong
+TAO_Policy_Set::num_policies (void) const
+{
+ return this->policy_list_.length();
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Policy_Validator.cpp b/TAO/tao/Policy_Validator.cpp
new file mode 100644
index 00000000000..b9753bd0fc2
--- /dev/null
+++ b/TAO/tao/Policy_Validator.cpp
@@ -0,0 +1,104 @@
+// $Id$
+
+#include "tao/Policy_Validator.h"
+#include "tao/Environment.h"
+#include "tao/debug.h"
+
+#include "ace/Log_Msg.h"
+
+ACE_RCSID (tao,
+ Policy_Validator,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Policy_Validator::TAO_Policy_Validator (TAO_ORB_Core &orb_core)
+ : orb_core_ (orb_core),
+ next_ (0)
+{
+}
+
+TAO_Policy_Validator::~TAO_Policy_Validator (void)
+{
+ delete this->next_;
+}
+
+TAO_ORB_Core &
+TAO_Policy_Validator::orb_core() const
+{
+ return this->orb_core_;
+}
+
+void
+TAO_Policy_Validator::add_validator (TAO_Policy_Validator *validator)
+{
+ // The validator we're adding can't be part of another list
+ ACE_ASSERT (validator->next_ == 0);
+
+ // Why would we want to add ourself to our list
+ if (this != validator)
+ {
+ // Get to the end of the list and make sure that the
+ // new validator isn't already part of our list
+ TAO_Policy_Validator* current = this;
+ while (current->next_ != 0)
+ {
+ if (current->next_ == validator)
+ {
+ if (TAO_debug_level > 3)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("(%P|%t) Skipping validator [0x%x] ")
+ ACE_TEXT ("since it would create a circular list\n"),
+ validator));
+ }
+
+ return;
+ }
+ current = current->next_;
+ }
+
+ // Add the new validator to the end of the list
+ current->next_ = validator;
+ }
+}
+
+
+void
+TAO_Policy_Validator::validate (TAO_Policy_Set &policies
+ ACE_ENV_ARG_DECL)
+{
+ this->validate_impl (policies ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (this->next_ != 0)
+ {
+ this->next_->validate (policies ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+}
+
+void
+TAO_Policy_Validator::merge_policies (TAO_Policy_Set &policies
+ ACE_ENV_ARG_DECL)
+{
+ this->merge_policies_impl (policies ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (this->next_)
+ {
+ this->next_->merge_policies (policies ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+}
+
+CORBA::Boolean
+TAO_Policy_Validator::legal_policy (CORBA::PolicyType type)
+{
+ return (this->legal_policy_impl (type)
+ || ((this->next_ != 0)
+ && this->next_->legal_policy_impl (type)));
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Policy_Validator.h b/TAO/tao/Policy_Validator.h
new file mode 100644
index 00000000000..69d680d9e61
--- /dev/null
+++ b/TAO/tao/Policy_Validator.h
@@ -0,0 +1,120 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Policy_Validator.h
+ *
+ * $Id$
+ *
+ * This file contains the declaration for the POA policy validator
+ * interface.
+ *
+ * @author Angelo Corsaro <corsaro@cs.wustl.edu>
+ * @author Frank Hunleth <fhuntleth@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_POLICY_VALIDATOR_H
+#define TAO_POLICY_VALIDATOR_H
+
+#include /**/ "ace/pre.h"
+#include "ace/CORBA_macros.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/TAO_Export.h"
+#include "tao/Basic_Types.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Forward declarations.
+class TAO_Policy_Set;
+class TAO_ORB_Core;
+
+namespace CORBA
+{
+ typedef ULong PolicyType;
+
+ class Environment;
+}
+
+/**
+ * @class TAO_Policy_Validator
+ *
+ * @brief An abstract class for plugging in different Policy Validator
+ * mechanisms.
+ *
+ * This class was moved from the PortableServer library. The Portable
+ * Serever library used this abstraction to add policy validators to
+ * for the policies in the POA. This class seems so much useful for
+ * passing policy information between different loaded libraries.
+ */
+
+class TAO_Export TAO_Policy_Validator
+{
+public:
+ /// Constructor.
+ TAO_Policy_Validator (TAO_ORB_Core &orb_core);
+
+ /// Destructor.
+ virtual ~TAO_Policy_Validator (void);
+
+ /**
+ * Validate that the policies in the specified set
+ * are consistent and legal. Throw an appropriate exception
+ * if that is not the case.
+ */
+ void validate (TAO_Policy_Set &policies
+ ACE_ENV_ARG_DECL);
+
+ /**
+ * Add/merge policies.
+ **/
+ void merge_policies (TAO_Policy_Set &policies
+ ACE_ENV_ARG_DECL);
+
+ /**
+ * Return whether the specified policy type is legal for the
+ * current configuration. This is needed since the user can
+ * potentially specify policies that are unknown to an
+ * validate () routine, and these need to be caught.
+ */
+ CORBA::Boolean legal_policy (CORBA::PolicyType type);
+
+ /**
+ * Adds a validator to the "chain of validators". The <code>
+ * TAO_POA_Policy_Validator </code> implements something that looks
+ * like a chain of responsability in which different member of the
+ * chain have the responsability of validating a given set of
+ * policies.
+ */
+ void add_validator (TAO_Policy_Validator *validator);
+
+
+ /**
+ * Accessor for the stored ORB core reference
+ */
+ TAO_ORB_Core & orb_core() const;
+
+protected:
+ virtual void validate_impl (TAO_Policy_Set &policies
+ ACE_ENV_ARG_DECL) = 0;
+
+ virtual void merge_policies_impl (TAO_Policy_Set &policies
+ ACE_ENV_ARG_DECL) = 0;
+
+ virtual CORBA::Boolean legal_policy_impl (CORBA::PolicyType type) = 0;
+
+ TAO_ORB_Core &orb_core_;
+
+private:
+ TAO_Policy_Validator *next_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_POLICY_VALIDATOR_H */
diff --git a/TAO/tao/PortableInterceptor.h b/TAO/tao/PortableInterceptor.h
new file mode 100644
index 00000000000..380ae32530e
--- /dev/null
+++ b/TAO/tao/PortableInterceptor.h
@@ -0,0 +1,47 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file PortableInterceptor.h
+ *
+ * $Id$
+ *
+ * A series of TAO_INTERCEPTOR* macros are defined in this file.
+ * These macros allows us to disable/enable support of interceptors
+ * easily.
+ *
+ * @author Nanbor Wang <nanbor@cs.wustl.edu>
+ * @author Kirthika Parameswaran <kirthika@cs.wustl.edu>
+ * @author Ossama Othman <ossama@uci.edu>
+ */
+//=============================================================================
+
+
+#ifndef TAO_PORTABLE_INTERCEPTOR_H
+#define TAO_PORTABLE_INTERCEPTOR_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if (TAO_HAS_INTERCEPTORS == 1)
+# define TAO_INTERCEPTOR(X) X
+# define TAO_INTERCEPTOR_CHECK ACE_TRY_CHECK
+# define TAO_INTERCEPTOR_CHECK_RETURN(X) ACE_TRY_CHECK
+# define TAO_INTERCEPTOR_THROW(X) ACE_TRY_THROW(X)
+# define TAO_INTERCEPTOR_THROW_RETURN(X,Y) ACE_TRY_THROW(X)
+#else
+# define TAO_INTERCEPTOR(X)
+# define TAO_INTERCEPTOR_CHECK ACE_CHECK
+# define TAO_INTERCEPTOR_CHECK_RETURN(X) ACE_CHECK_RETURN (X)
+# define TAO_INTERCEPTOR_THROW(X) ACE_THROW(X)
+# define TAO_INTERCEPTOR_THROW_RETURN(X,Y) ACE_THROW_RETURN(X,Y)
+#endif /* TAO_HAS_INTERCEPTORS */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_PORTABLE_INTERCEPTOR_H */
diff --git a/TAO/tao/PortableInterceptor.pidl b/TAO/tao/PortableInterceptor.pidl
new file mode 100644
index 00000000000..cec2a5046f1
--- /dev/null
+++ b/TAO/tao/PortableInterceptor.pidl
@@ -0,0 +1,59 @@
+// -*- IDL -*-
+
+/**
+ * @file PortableInterceptor.pidl
+ *
+ * $Id$
+ *
+ * @brief Pre-compiled IDL source for the PortableInterceptor
+ * components in the ORB.
+ *
+ * This file contains the interface definitions for "Portable"
+ * Interceptor support.
+ * The following is from orbos/99-12-02 Portable Interceptors spec,
+ * the full IDL is downloadable from orbos/99-12-02.
+ *
+ * Additional updates from ptc/00-08-05 are also included. Changes
+ * include:
+ * - addition of the Interceptor::destroy() method
+ * - move of CodecFactory and Codec interfaces to the IOP module
+ *
+ * This file was used to generate the code in PortableInterceptorC.*
+ * The command used to generate code is:
+ *
+ * tao_idl
+ * -o orig -Gp -Gd -Ge 1 -SS -Sci
+ * -Wb,export_include="tao/TAO_Export.h"
+ * -Wb,export_macro=TAO_Export
+ * -Wb,pre_include="ace/pre.h"
+ * -Wb,post_include="ace/post.h"
+ * PortableInterceptor.pidl
+ */
+
+// File: PortableInterceptor.idl
+#ifndef _PORTABLE_INTERCEPTOR_IDL_
+#define _PORTABLE_INTERCEPTOR_IDL_
+
+#include "tao/PI_Forward.pidl"
+#include "tao/Messaging_SyncScope.pidl"
+
+module PortableInterceptor {
+
+ typeprefix PortableInterceptor "omg.org";
+
+ const AdapterState HOLDING = 0;
+ const AdapterState ACTIVE = 1;
+ const AdapterState DISCARDING = 2;
+ const AdapterState INACTIVE = 3;
+ const AdapterState NON_EXISTENT = 4;
+
+ // Valid reply_status values:
+ const ReplyStatus SUCCESSFUL = 0;
+ const ReplyStatus SYSTEM_EXCEPTION = 1;
+ const ReplyStatus USER_EXCEPTION = 2;
+ const ReplyStatus LOCATION_FORWARD = 3;
+ const ReplyStatus TRANSPORT_RETRY = 4;
+ const ReplyStatus UNKNOWN = 5;
+};
+
+#endif /* _PORTABLE_INTERCEPTOR_IDL_ */
diff --git a/TAO/tao/PortableServer.mpc b/TAO/tao/PortableServer.mpc
new file mode 100644
index 00000000000..d484db6aa62
--- /dev/null
+++ b/TAO/tao/PortableServer.mpc
@@ -0,0 +1,74 @@
+//$Id$
+project : taolib, core, core_anytypecode, tao_versioning_idl_defaults {
+ sharedname = TAO_PortableServer
+ dynamicflags = TAO_PORTABLESERVER_BUILD_DLL
+
+ Source_Files {
+ PortableServer
+ }
+
+ Header_Files {
+ PortableServer
+ }
+
+ Inline_Files {
+ PortableServer
+ }
+
+ Template_Files {
+ PortableServer/Servant_var.cpp
+ PortableServer/*_T.cpp
+ }
+
+ Resource_Files {
+ PortableServer
+ }
+
+ IDL_Files {
+ idlflags += -Gp -Gd -Sci -SS -Sorb -GA -Ge 1 \
+ -Wb,export_macro=TAO_PortableServer_Export \
+ -Wb,export_include=tao/PortableServer/portableserver_export.h \
+ -o PortableServer
+ idlflags -= -Sa -St
+ PortableServer/ForwardRequest.pidl
+ }
+
+ IDL_Files {
+ idlflags += -Gp -Gd -Ge 1 -Sci -SS -Sorb -GA -Sal \
+ -Wb,export_macro=TAO_PortableServer_Export \
+ -Wb,export_include=tao/PortableServer/portableserver_export.h \
+ -o PortableServer
+ idlflags -= -Sa -St
+ PortableServer/AdapterActivator.pidl
+ PortableServer/IdAssignmentPolicy.pidl
+ PortableServer/IdUniquenessPolicy.pidl
+ PortableServer/ImplicitActivationPolicy.pidl
+ PortableServer/LifespanPolicy.pidl
+ PortableServer/RequestProcessingPolicy.pidl
+ PortableServer/ServantActivator.pidl
+ PortableServer/ServantLocator.pidl
+ PortableServer/ServantManager.pidl
+ PortableServer/ServantRetentionPolicy.pidl
+ PortableServer/ThreadPolicy.pidl
+ }
+
+ IDL_Files {
+ idlflags += -Gp -Gd -Ge 1 -Sci -SS -Sorb \
+ -Wb,export_macro=TAO_PortableServer_Export \
+ -Wb,export_include=tao/PortableServer/portableserver_export.h \
+ -o PortableServer
+ idlflags -= -Sa -St
+ PortableServer/POAManager.pidl
+ PortableServer/POAManagerFactory.pidl
+ PortableServer/POA.pidl
+ PortableServer/PS_Current.pidl
+ }
+
+ PIDL_Files {
+ PortableServer
+ }
+
+ Pkgconfig_Files {
+ PortableServer/TAO_PortableServer.pc.in
+ }
+}
diff --git a/TAO/tao/PortableServer/Acceptor_Filter_Factory.cpp b/TAO/tao/PortableServer/Acceptor_Filter_Factory.cpp
new file mode 100644
index 00000000000..06c7b2c22b2
--- /dev/null
+++ b/TAO/tao/PortableServer/Acceptor_Filter_Factory.cpp
@@ -0,0 +1,46 @@
+// @(#) $Id$
+
+#include "tao/PortableServer/Acceptor_Filter_Factory.h"
+#include "tao/PortableServer/Default_Acceptor_Filter.h"
+
+ACE_RCSID(PortableServer,
+ Acceptor_Filter_Factory,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Acceptor_Filter_Factory::~TAO_Acceptor_Filter_Factory(void)
+{
+}
+
+TAO_Acceptor_Filter*
+TAO_Acceptor_Filter_Factory::create_object (TAO_POA_Manager& )
+{
+ TAO_Acceptor_Filter *filter;
+
+ ACE_NEW_RETURN (filter,
+ TAO_Default_Acceptor_Filter (),
+ 0);
+
+ return filter;
+}
+
+
+int
+TAO_Acceptor_Filter_Factory::initialize (void)
+{
+ return ACE_Service_Config::process_directive
+ (ace_svc_desc_TAO_Acceptor_Filter_Factory);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_FACTORY_DEFINE (TAO_PortableServer, TAO_Acceptor_Filter_Factory)
+ACE_STATIC_SVC_DEFINE (TAO_Acceptor_Filter_Factory,
+ ACE_TEXT ("TAO_Acceptor_Filter_Factory"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (TAO_Acceptor_Filter_Factory),
+ ACE_Service_Type::DELETE_THIS
+ | ACE_Service_Type::DELETE_OBJ,
+ 0)
diff --git a/TAO/tao/PortableServer/Acceptor_Filter_Factory.h b/TAO/tao/PortableServer/Acceptor_Filter_Factory.h
new file mode 100644
index 00000000000..ae855be04da
--- /dev/null
+++ b/TAO/tao/PortableServer/Acceptor_Filter_Factory.h
@@ -0,0 +1,73 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Acceptor_Filter_Factory.h
+ *
+ * $Id$
+ *
+ * Provides default acceptor filters for use by the POA.
+ *
+ * @author Yan Dai <dai_y@ociweb.com>
+ * @author Phil Mesnier <mesnier_p@ociweb.com>
+ */
+//=============================================================================
+
+
+#ifndef TAO_ACCEPTOR_FILTER_FACTORY_H
+#define TAO_ACCEPTOR_FILTER_FACTORY_H
+
+#include /**/ "ace/pre.h"
+
+#include "portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Versioned_Namespace.h"
+
+#include "ace/Service_Object.h"
+#include "ace/Service_Config.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_POA_Manager;
+class TAO_Acceptor_Filter;
+
+/**
+ * @class TAO_Acceptor_Filter_Factory
+ *
+ * @brief Default class for factories providing the endpoint acceptor
+ * filter objects.
+ *
+ * The TAO_Acceptor_Filter_Factory is a loadable service object. It exists
+ * to allow external application of filters used to control the assembly of
+ * object references and how endpoints are assigned.
+ */
+class TAO_PortableServer_Export TAO_Acceptor_Filter_Factory
+ : public ACE_Service_Object
+{
+public:
+ virtual ~TAO_Acceptor_Filter_Factory(void);
+
+ virtual TAO_Acceptor_Filter* create_object (TAO_POA_Manager& poamanager);
+
+ /// Static initializer ensures the factory is loaded
+ static int initialize (void);
+
+};
+
+
+static int
+TAO_Requires_Acceptor_Filter_Factory =
+TAO_Acceptor_Filter_Factory::initialize ();
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE (TAO_Acceptor_Filter_Factory)
+ACE_FACTORY_DECLARE (TAO_PortableServer, TAO_Acceptor_Filter_Factory)
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_ACCEPTOR_FILTER_FACTORY_H */
diff --git a/TAO/tao/PortableServer/Active_Object_Map.cpp b/TAO/tao/PortableServer/Active_Object_Map.cpp
new file mode 100644
index 00000000000..5699755a01b
--- /dev/null
+++ b/TAO/tao/PortableServer/Active_Object_Map.cpp
@@ -0,0 +1,938 @@
+// $Id$
+
+#include "tao/PortableServer/Active_Object_Map.h"
+#include "tao/PortableServer/Active_Object_Map_Entry.h"
+#include "tao/SystemException.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/PortableServer/Active_Object_Map.i"
+#endif /* __ACE_INLINE__ */
+
+#include "ace/Auto_Ptr.h"
+
+ACE_RCSID(PortableServer,
+ Active_Object_Map,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/* static */
+size_t TAO_Active_Object_Map::system_id_size_ = 0;
+
+void
+TAO_Active_Object_Map::set_system_id_size
+ (const TAO_Server_Strategy_Factory::Active_Object_Map_Creation_Parameters &creation_parameters)
+{
+ if (TAO_Active_Object_Map::system_id_size_ == 0)
+ {
+ if (creation_parameters.allow_reactivation_of_system_ids_)
+ {
+ switch (creation_parameters.object_lookup_strategy_for_system_id_policy_)
+ {
+#if (TAO_HAS_MINIMUM_POA_MAPS == 0)
+ case TAO_LINEAR:
+ TAO_Active_Object_Map::system_id_size_ =
+ sizeof (CORBA::ULong);
+ break;
+#endif /* TAO_HAS_MINIMUM_POA_MAPS == 0 */
+
+ case TAO_DYNAMIC_HASH:
+ default:
+ TAO_Active_Object_Map::system_id_size_ = sizeof (CORBA::ULong);
+ break;
+ }
+
+ size_t hint_size = 0;
+
+ if (creation_parameters.use_active_hint_in_ids_)
+ hint_size = ACE_Active_Map_Manager_Key::size ();
+
+ TAO_Active_Object_Map::system_id_size_ += hint_size;
+ }
+ else
+ {
+ switch (creation_parameters.object_lookup_strategy_for_system_id_policy_)
+ {
+#if (TAO_HAS_MINIMUM_POA_MAPS == 0)
+ case TAO_LINEAR:
+ TAO_Active_Object_Map::system_id_size_ =
+ sizeof (CORBA::ULong);
+ break;
+
+ case TAO_DYNAMIC_HASH:
+ TAO_Active_Object_Map::system_id_size_ =
+ sizeof (CORBA::ULong);
+ break;
+#endif /* TAO_HAS_MINIMUM_POA_MAPS == 0 */
+
+ case TAO_ACTIVE_DEMUX:
+ default:
+ TAO_Active_Object_Map::system_id_size_ =
+ ACE_Active_Map_Manager_Key::size ();
+ break;
+ }
+ }
+ }
+}
+
+TAO_Active_Object_Map::TAO_Active_Object_Map (int user_id_policy,
+ int unique_id_policy,
+ int persistent_id_policy,
+ const TAO_Server_Strategy_Factory::Active_Object_Map_Creation_Parameters &creation_parameters
+ ACE_ENV_ARG_DECL)
+ : user_id_map_ (0),
+ servant_map_ (0),
+ id_uniqueness_strategy_ (0),
+ lifespan_strategy_ (0),
+ id_assignment_strategy_ (0),
+ id_hint_strategy_ (0),
+ using_active_maps_ (0)
+{
+ TAO_Active_Object_Map::set_system_id_size (creation_parameters);
+
+ TAO_Id_Uniqueness_Strategy *id_uniqueness_strategy = 0;
+
+ if (unique_id_policy)
+ {
+ ACE_NEW_THROW_EX (id_uniqueness_strategy,
+ TAO_Unique_Id_Strategy,
+ CORBA::NO_MEMORY ());
+ ACE_CHECK;
+ }
+ else
+ {
+ ACE_NEW_THROW_EX (id_uniqueness_strategy,
+ TAO_Multiple_Id_Strategy,
+ CORBA::NO_MEMORY ());
+ ACE_CHECK;
+ }
+
+ // Give ownership to the auto pointer.
+ auto_ptr<TAO_Id_Uniqueness_Strategy> new_id_uniqueness_strategy (id_uniqueness_strategy);
+
+ TAO_Lifespan_Strategy *lifespan_strategy = 0;
+
+ if (persistent_id_policy)
+ {
+ ACE_NEW_THROW_EX (lifespan_strategy,
+ TAO_Persistent_Strategy,
+ CORBA::NO_MEMORY ());
+ ACE_CHECK;
+ }
+ else
+ {
+ ACE_NEW_THROW_EX (lifespan_strategy,
+ TAO_Transient_Strategy,
+ CORBA::NO_MEMORY ());
+ ACE_CHECK;
+ }
+
+ // Give ownership to the auto pointer.
+ auto_ptr<TAO_Lifespan_Strategy> new_lifespan_strategy (lifespan_strategy);
+
+ TAO_Id_Assignment_Strategy *id_assignment_strategy = 0;
+
+ if (user_id_policy)
+ {
+ ACE_NEW_THROW_EX (id_assignment_strategy,
+ TAO_User_Id_Strategy,
+ CORBA::NO_MEMORY ());
+ ACE_CHECK;
+ }
+ else if (unique_id_policy)
+ {
+ ACE_NEW_THROW_EX (id_assignment_strategy,
+ TAO_System_Id_With_Unique_Id_Strategy,
+ CORBA::NO_MEMORY ());
+ ACE_CHECK;
+ }
+ else
+ {
+ ACE_NEW_THROW_EX (id_assignment_strategy,
+ TAO_System_Id_With_Multiple_Id_Strategy,
+ CORBA::NO_MEMORY ());
+ ACE_CHECK;
+ }
+
+ // Give ownership to the auto pointer.
+ auto_ptr<TAO_Id_Assignment_Strategy> new_id_assignment_strategy (id_assignment_strategy);
+
+ TAO_Id_Hint_Strategy *id_hint_strategy = 0;
+ if ((user_id_policy
+ || creation_parameters.allow_reactivation_of_system_ids_)
+ && creation_parameters.use_active_hint_in_ids_)
+ {
+ this->using_active_maps_ = 1;
+
+ ACE_NEW_THROW_EX (id_hint_strategy,
+ TAO_Active_Hint_Strategy (creation_parameters.active_object_map_size_),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK;
+ }
+ else
+ {
+ ACE_NEW_THROW_EX (id_hint_strategy,
+ TAO_No_Hint_Strategy,
+ CORBA::NO_MEMORY ());
+ ACE_CHECK;
+ }
+
+ // Give ownership to the auto pointer.
+ auto_ptr<TAO_Id_Hint_Strategy> new_id_hint_strategy (id_hint_strategy);
+
+ servant_map *sm = 0;
+ if (unique_id_policy)
+ {
+ switch (creation_parameters.reverse_object_lookup_strategy_for_unique_id_policy_)
+ {
+ case TAO_LINEAR:
+#if (TAO_HAS_MINIMUM_POA_MAPS == 0)
+ ACE_NEW_THROW_EX (sm,
+ servant_linear_map (creation_parameters.active_object_map_size_),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK;
+ break;
+#else
+ ACE_ERROR ((LM_ERROR,
+ "linear option for -ORBUniqueidPolicyReverseDemuxStrategy "
+ "not supported with minimum POA maps. "
+ "Ingoring option to use default... \n"));
+ /* FALL THROUGH */
+#endif /* TAO_HAS_MINIMUM_POA_MAPS == 0 */
+
+ case TAO_DYNAMIC_HASH:
+ default:
+ ACE_NEW_THROW_EX (sm,
+ servant_hash_map (creation_parameters.active_object_map_size_),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK;
+ break;
+ }
+ }
+
+ // Give ownership to the auto pointer.
+ auto_ptr<servant_map> new_servant_map (sm);
+
+ user_id_map *uim = 0;
+ if (user_id_policy
+ || creation_parameters.allow_reactivation_of_system_ids_)
+ {
+ switch (creation_parameters.object_lookup_strategy_for_user_id_policy_)
+ {
+ case TAO_LINEAR:
+#if (TAO_HAS_MINIMUM_POA_MAPS == 0)
+ ACE_NEW_THROW_EX (uim,
+ user_id_linear_map (creation_parameters.active_object_map_size_),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK;
+ break;
+#else
+ ACE_ERROR ((LM_ERROR,
+ "linear option for -ORBUseridPolicyDemuxStrategy "
+ "not supported with minimum POA maps. "
+ "Ingoring option to use default... \n"));
+ /* FALL THROUGH */
+#endif /* TAO_HAS_MINIMUM_POA_MAPS == 0 */
+
+ case TAO_DYNAMIC_HASH:
+ default:
+ ACE_NEW_THROW_EX (uim,
+ user_id_hash_map (creation_parameters.active_object_map_size_),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK;
+ break;
+ }
+ }
+ else
+ {
+ switch (creation_parameters.object_lookup_strategy_for_system_id_policy_)
+ {
+#if (TAO_HAS_MINIMUM_POA_MAPS == 0)
+ case TAO_LINEAR:
+ ACE_NEW_THROW_EX (uim,
+ user_id_linear_map (creation_parameters.active_object_map_size_),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK;
+ break;
+
+ case TAO_DYNAMIC_HASH:
+ ACE_NEW_THROW_EX (uim,
+ user_id_hash_map (creation_parameters.active_object_map_size_),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK;
+ break;
+#else
+ case TAO_LINEAR:
+ case TAO_DYNAMIC_HASH:
+ ACE_ERROR ((LM_ERROR,
+ "linear and dynamic options for -ORBSystemidPolicyDemuxStrategy "
+ "are not supported with minimum POA maps. "
+ "Ingoring option to use default... \n"));
+ /* FALL THROUGH */
+#endif /* TAO_HAS_MINIMUM_POA_MAPS == 0 */
+
+ case TAO_ACTIVE_DEMUX:
+ default:
+
+ this->using_active_maps_ = 1;
+
+ ACE_NEW_THROW_EX (uim,
+ user_id_active_map (creation_parameters.active_object_map_size_),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK;
+ break;
+ }
+ }
+
+ // Give ownership to the auto pointer.
+ auto_ptr<user_id_map> new_user_id_map (uim);
+
+ id_uniqueness_strategy->set_active_object_map (this);
+ lifespan_strategy->set_active_object_map (this);
+ id_assignment_strategy->set_active_object_map (this);
+
+ // Finally everything is fine. Make sure to take ownership away
+ // from the auto pointer.
+ this->id_uniqueness_strategy_ = new_id_uniqueness_strategy.release ();
+ this->lifespan_strategy_ = new_lifespan_strategy.release ();
+ this->id_assignment_strategy_ = new_id_assignment_strategy.release ();
+ this->id_hint_strategy_ = new_id_hint_strategy.release ();
+ this->servant_map_ = new_servant_map.release ();
+ this->user_id_map_ = new_user_id_map.release ();
+}
+
+TAO_Active_Object_Map::~TAO_Active_Object_Map (void)
+{
+ user_id_map::iterator iterator = this->user_id_map_->begin ();
+ user_id_map::iterator end = this->user_id_map_->end ();
+
+ for (;
+ iterator != end;
+ ++iterator)
+ {
+ user_id_map::value_type map_entry = *iterator;
+ delete map_entry.second ();
+ }
+
+ delete this->id_uniqueness_strategy_;
+ delete this->lifespan_strategy_;
+ delete this->id_assignment_strategy_;
+ delete this->id_hint_strategy_;
+ delete this->servant_map_;
+ delete this->user_id_map_;
+}
+
+int
+TAO_Active_Object_Map::is_user_id_in_map (const PortableServer::ObjectId &user_id,
+ CORBA::Short priority,
+ int &priorities_match,
+ int &deactivated)
+{
+ TAO_Active_Object_Map_Entry *entry = 0;
+ int result = this->user_id_map_->find (user_id,
+ entry);
+ if (result == 0)
+ {
+ if (entry->servant_ == 0)
+ {
+ result = 0;
+
+ if (entry->priority_ != priority)
+ priorities_match = 0;
+ }
+ else
+ {
+ result = 1;
+ if (entry->deactivated_)
+ {
+ deactivated = 1;
+ }
+ }
+ }
+ else
+ {
+ result = 0;
+ }
+
+ return result;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+
+TAO_Id_Uniqueness_Strategy::~TAO_Id_Uniqueness_Strategy (void)
+{
+}
+
+void
+TAO_Id_Uniqueness_Strategy::set_active_object_map (TAO_Active_Object_Map *active_object_map)
+{
+ this->active_object_map_ = active_object_map;
+}
+
+int
+TAO_Unique_Id_Strategy::is_servant_in_map (PortableServer::Servant servant,
+ int &deactivated)
+{
+ TAO_Active_Object_Map_Entry *entry = 0;
+ int result = this->active_object_map_->servant_map_->find (servant,
+ entry);
+ if (result == 0)
+ {
+ result = 1;
+ if (entry->deactivated_)
+ {
+ deactivated = 1;
+ }
+ }
+ else
+ {
+ result = 0;
+ }
+
+ return result;
+}
+
+int
+TAO_Unique_Id_Strategy::bind_using_user_id (PortableServer::Servant servant,
+ const PortableServer::ObjectId &user_id,
+ CORBA::Short priority,
+ TAO_Active_Object_Map_Entry *&entry)
+{
+ int result = this->active_object_map_->user_id_map_->find (user_id,
+ entry);
+ if (result == 0)
+ {
+ if (servant != 0)
+ {
+ entry->servant_ = servant;
+
+ result = this->active_object_map_->servant_map_->bind (entry->servant_,
+ entry);
+ }
+ }
+ else
+ {
+ ACE_NEW_RETURN (entry,
+ TAO_Active_Object_Map_Entry,
+ -1);
+ entry->user_id_ = user_id;
+ entry->servant_ = servant;
+ entry->priority_ = priority;
+
+ result = this->active_object_map_->id_hint_strategy_->bind (*entry);
+
+ if (result == 0)
+ {
+ result = this->active_object_map_->user_id_map_->bind (entry->user_id_,
+ entry);
+ if (result == 0)
+ {
+ if (servant != 0)
+ result = this->active_object_map_->servant_map_->bind (entry->servant_,
+ entry);
+ if (result != 0)
+ {
+ this->active_object_map_->user_id_map_->unbind (entry->user_id_);
+ this->active_object_map_->id_hint_strategy_->unbind (*entry);
+ delete entry;
+ }
+ }
+ else
+ {
+ this->active_object_map_->id_hint_strategy_->unbind (*entry);
+ delete entry;
+ }
+ }
+ else
+ delete entry;
+ }
+
+ return result;
+}
+
+int
+TAO_Unique_Id_Strategy::unbind_using_user_id (const PortableServer::ObjectId &user_id)
+{
+ TAO_Active_Object_Map_Entry *entry = 0;
+ int result = this->active_object_map_->user_id_map_->unbind (user_id,
+ entry);
+ if (result == 0)
+ {
+ if (entry->servant_ != 0)
+ result = this->active_object_map_->servant_map_->unbind (entry->servant_);
+
+ if (result == 0)
+ result =
+ this->active_object_map_->id_hint_strategy_->unbind (*entry);
+
+ if (result == 0)
+ delete entry;
+ }
+ return result;
+}
+
+int
+TAO_Unique_Id_Strategy::find_user_id_using_servant (PortableServer::Servant servant,
+ PortableServer::ObjectId_out user_id)
+{
+ TAO_Active_Object_Map_Entry *entry = 0;
+ int result = this->active_object_map_->servant_map_->find (servant,
+ entry);
+ if (result == 0)
+ {
+ if (entry->deactivated_)
+ result = -1;
+ else
+ ACE_NEW_RETURN (user_id,
+ PortableServer::ObjectId (entry->user_id_),
+ -1);
+ }
+
+ return result;
+}
+
+int
+TAO_Unique_Id_Strategy::find_system_id_using_servant (PortableServer::Servant servant,
+ PortableServer::ObjectId_out system_id,
+ CORBA::Short &priority)
+{
+ TAO_Active_Object_Map_Entry *entry = 0;
+ int result = this->active_object_map_->servant_map_->find (servant,
+ entry);
+ if (result == 0)
+ {
+ if (entry->deactivated_)
+ result = -1;
+ else
+ {
+ result = this->active_object_map_->id_hint_strategy_->system_id (system_id,
+ *entry);
+ if (result == 0)
+ priority = entry->priority_;
+ }
+ }
+
+ return result;
+}
+
+CORBA::Boolean
+TAO_Unique_Id_Strategy::remaining_activations (PortableServer::Servant servant)
+{
+ ACE_UNUSED_ARG (servant);
+
+ // Since servant are always unique here, return false.
+ return 0;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+
+int
+TAO_Multiple_Id_Strategy::is_servant_in_map (PortableServer::Servant,
+ int &)
+{
+ return -1;
+}
+
+int
+TAO_Multiple_Id_Strategy::bind_using_user_id (PortableServer::Servant servant,
+ const PortableServer::ObjectId &user_id,
+ CORBA::Short priority,
+ TAO_Active_Object_Map_Entry *&entry)
+{
+ int result = this->active_object_map_->user_id_map_->find (user_id,
+ entry);
+ if (result == 0)
+ {
+ if (servant != 0)
+ entry->servant_ = servant;
+ }
+ else
+ {
+ ACE_NEW_RETURN (entry,
+ TAO_Active_Object_Map_Entry,
+ -1);
+ entry->user_id_ = user_id;
+ entry->servant_ = servant;
+ entry->priority_ = priority;
+
+ result =
+ this->active_object_map_->id_hint_strategy_->bind (*entry);
+
+ if (result == 0)
+ {
+ result = this->active_object_map_->user_id_map_->bind (entry->user_id_,
+ entry);
+ if (result != 0)
+ {
+ this->active_object_map_->id_hint_strategy_->unbind (*entry);
+ delete entry;
+ }
+ }
+ else
+ delete entry;
+ }
+
+ return result;
+}
+
+int
+TAO_Multiple_Id_Strategy::unbind_using_user_id (const PortableServer::ObjectId &user_id)
+{
+ TAO_Active_Object_Map_Entry *entry = 0;
+ int result = this->active_object_map_->user_id_map_->unbind (user_id,
+ entry);
+ if (result == 0)
+ {
+ result = this->active_object_map_->id_hint_strategy_->unbind (*entry);
+
+ if (result == 0)
+ delete entry;
+ }
+
+ return result;
+}
+
+int
+TAO_Multiple_Id_Strategy::find_user_id_using_servant (PortableServer::Servant servant,
+ PortableServer::ObjectId_out user_id)
+{
+ ACE_UNUSED_ARG (servant);
+ ACE_UNUSED_ARG (user_id);
+
+ return -1;
+}
+
+int
+TAO_Multiple_Id_Strategy::find_system_id_using_servant (PortableServer::Servant,
+ PortableServer::ObjectId_out,
+ CORBA::Short &)
+{
+ return -1;
+}
+
+CORBA::Boolean
+TAO_Multiple_Id_Strategy::remaining_activations (PortableServer::Servant servant)
+{
+ TAO_Active_Object_Map::user_id_map::iterator end
+ = this->active_object_map_->user_id_map_->end ();
+
+ for (TAO_Active_Object_Map::user_id_map::iterator iter
+ = this->active_object_map_->user_id_map_->begin ();
+ iter != end;
+ ++iter)
+ {
+ TAO_Active_Object_Map::user_id_map::value_type map_pair = *iter;
+ TAO_Active_Object_Map_Entry *entry = map_pair.second ();
+
+ if (entry->servant_ == servant)
+ return 1;
+ }
+
+ return 0;
+}
+
+TAO_Lifespan_Strategy::~TAO_Lifespan_Strategy (void)
+{
+}
+
+void
+TAO_Lifespan_Strategy::set_active_object_map (TAO_Active_Object_Map *active_object_map)
+{
+ this->active_object_map_ = active_object_map;
+}
+
+int
+TAO_Transient_Strategy::find_servant_using_system_id_and_user_id (const PortableServer::ObjectId &system_id,
+ const PortableServer::ObjectId &user_id,
+ PortableServer::Servant &servant,
+ TAO_Active_Object_Map_Entry *&entry)
+{
+ int result = this->active_object_map_->id_hint_strategy_->find (system_id,
+ entry);
+ if (result == 0)
+ {
+ if (entry->deactivated_)
+ result = -1;
+ else if (entry->servant_ == 0)
+ result = -1;
+ else
+ servant = entry->servant_;
+ }
+ else
+ {
+ result = this->active_object_map_->user_id_map_->find (user_id,
+ entry);
+ if (result == 0)
+ {
+ if (entry->deactivated_)
+ result = -1;
+ else if (entry->servant_ == 0)
+ result = -1;
+ else
+ servant = entry->servant_;
+ }
+ }
+
+ if (result == -1)
+ entry = 0;
+
+ return result;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+
+int
+TAO_Persistent_Strategy::find_servant_using_system_id_and_user_id (const PortableServer::ObjectId &system_id,
+ const PortableServer::ObjectId &user_id,
+ PortableServer::Servant &servant,
+ TAO_Active_Object_Map_Entry *&entry)
+{
+ int result = this->active_object_map_->id_hint_strategy_->find (system_id,
+ entry);
+ if (result == 0 &&
+ user_id == entry->user_id_)
+ {
+ if (entry->deactivated_)
+ result = -1;
+ else if (entry->servant_ == 0)
+ result = -1;
+ else
+ servant = entry->servant_;
+ }
+ else
+ {
+ result = this->active_object_map_->user_id_map_->find (user_id,
+ entry);
+ if (result == 0)
+ {
+ if (entry->deactivated_)
+ result = -1;
+ else if (entry->servant_ == 0)
+ result = -1;
+ else
+ servant = entry->servant_;
+ }
+ }
+
+ if (result == -1)
+ entry = 0;
+
+ return result;
+}
+
+TAO_Id_Assignment_Strategy::~TAO_Id_Assignment_Strategy (void)
+{
+}
+
+void
+TAO_Id_Assignment_Strategy::set_active_object_map (TAO_Active_Object_Map *active_object_map)
+{
+ this->active_object_map_ = active_object_map;
+}
+
+int
+TAO_User_Id_Strategy::bind_using_system_id (PortableServer::Servant,
+ CORBA::Short,
+ TAO_Active_Object_Map_Entry *&)
+{
+ return -1;
+}
+
+int
+TAO_System_Id_With_Unique_Id_Strategy::bind_using_system_id (PortableServer::Servant servant,
+ CORBA::Short priority,
+ TAO_Active_Object_Map_Entry *&entry)
+{
+ ACE_NEW_RETURN (entry,
+ TAO_Active_Object_Map_Entry,
+ -1);
+
+ int result = this->active_object_map_->user_id_map_->bind_create_key (entry,
+ entry->user_id_);
+ if (result == 0)
+ {
+ entry->servant_ = servant;
+ entry->priority_ = priority;
+
+ result = this->active_object_map_->id_hint_strategy_->bind (*entry);
+
+ if (result == 0)
+ {
+ if (servant != 0)
+ result = this->active_object_map_->servant_map_->bind (entry->servant_,
+ entry);
+
+ if (result != 0)
+ {
+ this->active_object_map_->user_id_map_->unbind (entry->user_id_);
+ this->active_object_map_->id_hint_strategy_->unbind (*entry);
+ delete entry;
+ }
+ }
+ else
+ {
+ this->active_object_map_->user_id_map_->unbind (entry->user_id_);
+ delete entry;
+ }
+ }
+ else
+ delete entry;
+
+ return result;
+}
+
+int
+TAO_System_Id_With_Multiple_Id_Strategy::bind_using_system_id (PortableServer::Servant servant,
+ CORBA::Short priority,
+ TAO_Active_Object_Map_Entry *&entry)
+{
+ ACE_NEW_RETURN (entry,
+ TAO_Active_Object_Map_Entry,
+ -1);
+ int result = this->active_object_map_->user_id_map_->bind_create_key (entry,
+ entry->user_id_);
+ if (result == 0)
+ {
+ entry->servant_ = servant;
+ entry->priority_ = priority;
+
+ result = this->active_object_map_->id_hint_strategy_->bind (*entry);
+
+ if (result != 0)
+ {
+ this->active_object_map_->user_id_map_->unbind (entry->user_id_);
+ delete entry;
+ }
+ }
+ else
+ delete entry;
+
+ return result;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+
+TAO_Id_Hint_Strategy::~TAO_Id_Hint_Strategy (void)
+{
+}
+
+////////////////////////////////////////////////////////////////////////////////
+
+TAO_Active_Hint_Strategy::TAO_Active_Hint_Strategy (CORBA::ULong map_size)
+ : system_id_map_ (map_size)
+{
+}
+
+TAO_Active_Hint_Strategy::~TAO_Active_Hint_Strategy (void)
+{
+}
+
+int
+TAO_Active_Hint_Strategy::recover_key (const PortableServer::ObjectId &system_id,
+ PortableServer::ObjectId &user_id)
+{
+ return this->system_id_map_.recover_key (system_id,
+ user_id);
+}
+
+int
+TAO_Active_Hint_Strategy::bind (TAO_Active_Object_Map_Entry &entry)
+{
+ entry.system_id_ = entry.user_id_;
+
+ return this->system_id_map_.bind_modify_key (&entry,
+ entry.system_id_);
+}
+
+int
+TAO_Active_Hint_Strategy::unbind (TAO_Active_Object_Map_Entry &entry)
+{
+ return this->system_id_map_.unbind (entry.system_id_);
+}
+
+int
+TAO_Active_Hint_Strategy::find (const PortableServer::ObjectId &system_id,
+ TAO_Active_Object_Map_Entry *&entry)
+{
+ return this->system_id_map_.find (system_id,
+ entry);
+}
+
+size_t
+TAO_Active_Hint_Strategy::hint_size (void)
+{
+ return ACE_Active_Map_Manager_Key::size ();
+}
+
+int
+TAO_Active_Hint_Strategy::system_id (PortableServer::ObjectId_out system_id,
+ TAO_Active_Object_Map_Entry &entry)
+{
+ ACE_NEW_RETURN (system_id,
+ PortableServer::ObjectId (entry.system_id_),
+ -1);
+ return 0;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+
+TAO_No_Hint_Strategy::~TAO_No_Hint_Strategy (void)
+{
+}
+
+int
+TAO_No_Hint_Strategy::recover_key (const PortableServer::ObjectId &system_id,
+ PortableServer::ObjectId &user_id)
+{
+ // Smartly copy all the data; <user_id does not own the data>.
+ user_id.replace (system_id.maximum (),
+ system_id.length (),
+ const_cast<CORBA::Octet *> (system_id.get_buffer ()),
+ 0);
+
+ return 0;
+}
+
+int
+TAO_No_Hint_Strategy::bind (TAO_Active_Object_Map_Entry &entry)
+{
+ ACE_UNUSED_ARG (entry);
+
+ return 0;
+}
+
+int
+TAO_No_Hint_Strategy::unbind (TAO_Active_Object_Map_Entry &entry)
+{
+ ACE_UNUSED_ARG (entry);
+
+ return 0;
+}
+
+int
+TAO_No_Hint_Strategy::find (const PortableServer::ObjectId &system_id,
+ TAO_Active_Object_Map_Entry *&entry)
+{
+ ACE_UNUSED_ARG (system_id);
+ ACE_UNUSED_ARG (entry);
+
+ return -1;
+}
+
+size_t
+TAO_No_Hint_Strategy::hint_size (void)
+{
+ return 0;
+}
+
+int
+TAO_No_Hint_Strategy::system_id (PortableServer::ObjectId_out system_id,
+ TAO_Active_Object_Map_Entry &entry)
+{
+ ACE_NEW_RETURN (system_id,
+ PortableServer::ObjectId (entry.user_id_),
+ -1);
+ return 0;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/Active_Object_Map.h b/TAO/tao/PortableServer/Active_Object_Map.h
new file mode 100644
index 00000000000..65c614de389
--- /dev/null
+++ b/TAO/tao/PortableServer/Active_Object_Map.h
@@ -0,0 +1,626 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Active_Object_Map.h
+ *
+ * $Id$
+ *
+ * @author Irfan Pyarali
+ */
+//=============================================================================
+
+
+#ifndef TAO_ACTIVE_OBJECT_MAP_H
+#define TAO_ACTIVE_OBJECT_MAP_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/Key_Adapters.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/Servant_Base.h"
+#include "tao/Server_Strategy_Factory.h"
+#include "ace/Map_T.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Forward declarations.
+class TAO_Id_Uniqueness_Strategy;
+class TAO_Lifespan_Strategy;
+class TAO_Id_Assignment_Strategy;
+class TAO_Id_Hint_Strategy;
+struct TAO_Active_Object_Map_Entry;
+
+/**
+ * @class TAO_Active_Object_Map
+ *
+ * @brief Map of object ids to servants.
+ *
+ * Implementation to be used by the POA.
+ */
+class TAO_Active_Object_Map
+{
+public:
+
+ /// Constructor.
+ TAO_Active_Object_Map (int user_id_policy,
+ int unique_id_policy,
+ int persistent_id_policy,
+ const TAO_Server_Strategy_Factory::Active_Object_Map_Creation_Parameters &creation_parameters
+ ACE_ENV_ARG_DECL);
+
+ /// Destructor.
+ ~TAO_Active_Object_Map (void);
+
+ /// Must be used with UNIQUE_ID policy.
+ int is_servant_in_map (PortableServer::Servant servant,
+ int &deactivated);
+
+ /// Can be used with any policy. With the SYSTEM_ID policy,
+ /// user_id is actually system_id.
+ int is_user_id_in_map (const PortableServer::ObjectId &user_id,
+ CORBA::Short priority,
+ int &priorities_match,
+ int &deactivated);
+
+ /// Must be used with SYSTEM_ID policy.
+ int bind_using_system_id_returning_system_id (PortableServer::Servant servant,
+ CORBA::Short priority,
+ PortableServer::ObjectId_out system_id);
+
+ /// Must be used with SYSTEM_ID policy.
+ int bind_using_system_id_returning_user_id (PortableServer::Servant servant,
+ CORBA::Short priority,
+ PortableServer::ObjectId_out user_id);
+
+ /// Can be used with any policy. With the SYSTEM_ID policy,
+ /// user_id is actually system_id.
+ int bind_using_user_id (PortableServer::Servant servant,
+ const PortableServer::ObjectId &user_id,
+ CORBA::Short priority);
+
+ /// Can be used with any policy. With the SYSTEM_ID policy,
+ /// user_id is actually system_id.
+ int find_system_id_using_user_id (const PortableServer::ObjectId &user_id,
+ CORBA::Short priority,
+ PortableServer::ObjectId_out system_id);
+
+ /// Can be used with any policy.
+ int rebind_using_user_id_and_system_id (PortableServer::Servant servant,
+ const PortableServer::ObjectId &user_id,
+ const PortableServer::ObjectId &system_id,
+ TAO_Active_Object_Map_Entry *&entry);
+
+ /// Can be used with any policy. With the SYSTEM_ID policy,
+ /// user_id is actually system_id.
+ int unbind_using_user_id (const PortableServer::ObjectId &user_id);
+
+ /// Must be used with UNIQUE_ID policy. With the SYSTEM_ID policy,
+ /// user_id is actually system_id.
+ int find_user_id_using_servant (PortableServer::Servant servant,
+ PortableServer::ObjectId_out user_id);
+
+ /// Must be used with UNIQUE_ID policy. With the SYSTEM_ID policy,
+ /// user_id is actually system_id.
+ int find_system_id_using_servant (PortableServer::Servant servant,
+ PortableServer::ObjectId_out system_id,
+ CORBA::Short &priority);
+
+ /// Can be used with any policy. With the SYSTEM_ID policy,
+ /// user_id is actually system_id.
+ int find_servant_using_user_id (const PortableServer::ObjectId &user_id,
+ PortableServer::Servant &servant);
+
+ /// Can be used with any policy.
+ int find_servant_using_system_id_and_user_id (const PortableServer::ObjectId &system_id,
+ const PortableServer::ObjectId &user_id,
+ PortableServer::Servant &servant,
+ TAO_Active_Object_Map_Entry *&entry);
+
+ /// Can be used with any policy. With the SYSTEM_ID policy,
+ /// @a user_id is identical to @a system_id.
+ int find_servant_and_system_id_using_user_id (const PortableServer::ObjectId &user_id,
+ PortableServer::Servant &servant,
+ PortableServer::ObjectId_out system_id,
+ CORBA::Short &priority);
+
+ /// Can be used with any policy. With the SYSTEM_ID policy,
+ /// <user_id> is identical to <system_id>.
+ /**
+ * @retval -1 Entry is not found or is deactivated.
+ * @retval 0 Entry is found.
+ */
+ int find_entry_using_user_id (const PortableServer::ObjectId &user_id,
+ TAO_Active_Object_Map_Entry *&entry);
+
+ /// Can be used with any policy. When the SYSTEM_ID policy is used,
+ /// the <system_id> is identical to <user_id>.
+ int find_user_id_using_system_id (const PortableServer::ObjectId &system_id,
+ PortableServer::ObjectId_out user_id);
+
+ /// Can be used with any policy. When the SYSTEM_ID policy is used,
+ /// the <system_id> is identical to <user_id>.
+ int find_user_id_using_system_id (const PortableServer::ObjectId &system_id,
+ PortableServer::ObjectId &user_id);
+
+ /// Are there any remaining activations of @a servant in the active
+ /// object map? Can be used with any policy.
+ CORBA::Boolean remaining_activations (PortableServer::Servant servant);
+
+ /// Size of the map.
+ size_t current_size (void);
+
+ /// Can be used with any policy.
+ static size_t system_id_size (void);
+
+ /// Set the system id size.
+ static void set_system_id_size (const TAO_Server_Strategy_Factory::Active_Object_Map_Creation_Parameters &creation_parameters);
+
+ /// Base class of the id map.
+ typedef ACE_Map<
+ PortableServer::ObjectId,
+ TAO_Active_Object_Map_Entry *> user_id_map;
+
+ /// Id hash map.
+ typedef ACE_Hash_Map_Manager_Ex_Adapter<
+ PortableServer::ObjectId,
+ TAO_Active_Object_Map_Entry *,
+ TAO_ObjectId_Hash,
+ ACE_Equal_To<PortableServer::ObjectId>,
+ TAO_Incremental_Key_Generator> user_id_hash_map;
+
+#if (TAO_HAS_MINIMUM_POA_MAPS == 0)
+ /// Id linear map.
+ typedef ACE_Map_Manager_Adapter<
+ PortableServer::ObjectId,
+ TAO_Active_Object_Map_Entry *,
+ TAO_Incremental_Key_Generator> user_id_linear_map;
+#endif /* TAO_HAS_MINIMUM_POA_MAPS == 0 */
+
+ /// Id active map.
+ typedef ACE_Active_Map_Manager_Adapter<
+ PortableServer::ObjectId,
+ TAO_Active_Object_Map_Entry *,
+ TAO_Ignore_Original_Key_Adapter> user_id_active_map;
+
+ /// Base class of the servant map.
+ typedef ACE_Map<
+ PortableServer::Servant,
+ TAO_Active_Object_Map_Entry *> servant_map;
+
+ /// Servant hash map.
+ typedef ACE_Hash_Map_Manager_Ex_Adapter<
+ PortableServer::Servant,
+ TAO_Active_Object_Map_Entry *,
+ TAO_Servant_Hash,
+ ACE_Equal_To<PortableServer::Servant>,
+ ACE_Noop_Key_Generator<PortableServer::Servant> > servant_hash_map;
+
+#if (TAO_HAS_MINIMUM_POA_MAPS == 0)
+ /// Servant linear map.
+ typedef ACE_Map_Manager_Adapter<
+ PortableServer::Servant,
+ TAO_Active_Object_Map_Entry *,
+ ACE_Noop_Key_Generator<PortableServer::Servant> > servant_linear_map;
+#endif /* TAO_HAS_MINIMUM_POA_MAPS == 0 */
+
+ /// Id map.
+ user_id_map *user_id_map_;
+
+ /// Servant map.
+ servant_map *servant_map_;
+
+ /// Id uniqueness strategy.
+ TAO_Id_Uniqueness_Strategy *id_uniqueness_strategy_;
+
+ /// Lifespan strategy.
+ TAO_Lifespan_Strategy *lifespan_strategy_;
+
+ /// Id assignment strategy.
+ TAO_Id_Assignment_Strategy *id_assignment_strategy_;
+
+ /// Id hint strategy.
+ TAO_Id_Hint_Strategy *id_hint_strategy_;
+
+ /// Flag to see if we are using active maps in this active object
+ /// map.
+ int using_active_maps_;
+
+ /// Size of the system id produced by the map.
+ static size_t system_id_size_;
+};
+
+/**
+ * @class TAO_Id_Uniqueness_Strategy
+ *
+ * @brief Id uniqueness strategy.
+ *
+ * Strategy for implementing points of variation between the
+ * UNIQUE_ID and the MULTIPLE_ID policies.
+ */
+class TAO_Id_Uniqueness_Strategy
+{
+public:
+ /// Virtual destructor.
+ virtual ~TAO_Id_Uniqueness_Strategy (void);
+
+ /// Must be used with UNIQUE_ID policy.
+ virtual int is_servant_in_map (PortableServer::Servant servant,
+ int &deactivated) = 0;
+
+ /// Can be used with any policy. With the SYSTEM_ID policy,
+ /// <user_id> is actually <system_id>.
+ virtual int unbind_using_user_id (const PortableServer::ObjectId &user_id) = 0;
+
+ /// Must be used with UNIQUE_ID policy. With the SYSTEM_ID policy,
+ /// <user_id> is actually <system_id>.
+ virtual int find_user_id_using_servant (PortableServer::Servant servant,
+ PortableServer::ObjectId_out user_id) = 0;
+
+ /// Must be used with UNIQUE_ID policy. With the SYSTEM_ID policy,
+ /// <user_id> is actually <system_id>.
+ virtual int find_system_id_using_servant (PortableServer::Servant servant,
+ PortableServer::ObjectId_out system_id,
+ CORBA::Short &priority) = 0;
+
+ /// Can be used with any policy. With the SYSTEM_ID policy,
+ /// <user_id> is actually <system_id>.
+ virtual int bind_using_user_id (PortableServer::Servant servant,
+ const PortableServer::ObjectId &user_id,
+ CORBA::Short priority,
+ TAO_Active_Object_Map_Entry *&entry) = 0;
+
+ /// Are there any remaining activations of <servant> in the active
+ /// object map? Can be used with any policy.
+ virtual CORBA::Boolean remaining_activations (PortableServer::Servant servant) = 0;
+
+ /// Set the active map.
+ void set_active_object_map (TAO_Active_Object_Map *active_object_map);
+
+protected:
+
+ /// Pointer to the active map.
+ TAO_Active_Object_Map *active_object_map_;
+};
+
+/**
+ * @class TAO_Unique_Id_Strategy
+ *
+ * @brief Unique id strategy.
+ *
+ * Strategy for the UNIQUE_ID policy.
+ */
+class TAO_Unique_Id_Strategy : public TAO_Id_Uniqueness_Strategy
+{
+public:
+
+ /// Must be used with UNIQUE_ID policy.
+ virtual int is_servant_in_map (PortableServer::Servant servant,
+ int &deactivated);
+
+ /// Can be used with any policy. With the SYSTEM_ID policy,
+ /// <user_id> is actually <system_id>.
+ virtual int unbind_using_user_id (const PortableServer::ObjectId &user_id);
+
+ /// Must be used with UNIQUE_ID policy. With the SYSTEM_ID policy,
+ /// <user_id> is actually <system_id>.
+ virtual int find_user_id_using_servant (PortableServer::Servant servant,
+ PortableServer::ObjectId_out user_id);
+
+ /// Must be used with UNIQUE_ID policy. With the SYSTEM_ID policy,
+ /// <user_id> is actually <system_id>.
+ virtual int find_system_id_using_servant (PortableServer::Servant servant,
+ PortableServer::ObjectId_out system_id,
+ CORBA::Short &priority);
+
+ /// Can be used with any policy. With the SYSTEM_ID policy,
+ /// <user_id> is actually <system_id>.
+ virtual int bind_using_user_id (PortableServer::Servant servant,
+ const PortableServer::ObjectId &user_id,
+ CORBA::Short priority,
+ TAO_Active_Object_Map_Entry *&entry);
+
+ /// Are there any remaining activations of <servant> in the active
+ /// object map? Can be used with any policy.
+ virtual CORBA::Boolean remaining_activations (PortableServer::Servant servant);
+};
+
+/**
+ * @class TAO_Multiple_Id_Strategy
+ *
+ * @brief Multiple id strategy.
+ *
+ * Strategy for the MULTIPLE_ID policy.
+ */
+class TAO_Multiple_Id_Strategy : public TAO_Id_Uniqueness_Strategy
+{
+public:
+
+ /// Must be used with UNIQUE_ID policy.
+ virtual int is_servant_in_map (PortableServer::Servant servant,
+ int &deactivated);
+
+ /// Can be used with any policy. With the SYSTEM_ID policy,
+ /// <user_id> is actually <system_id>.
+ virtual int unbind_using_user_id (const PortableServer::ObjectId &user_id);
+
+ /// Must be used with UNIQUE_ID policy. With the SYSTEM_ID policy,
+ /// <user_id> is actually <system_id>.
+ virtual int find_user_id_using_servant (PortableServer::Servant servant,
+ PortableServer::ObjectId_out user_id);
+
+ /// Must be used with UNIQUE_ID policy. With the SYSTEM_ID policy,
+ /// <user_id> is actually <system_id>.
+ virtual int find_system_id_using_servant (PortableServer::Servant servant,
+ PortableServer::ObjectId_out system_id,
+ CORBA::Short &priority);
+
+ /// Can be used with any policy. With the SYSTEM_ID policy,
+ /// <user_id> is actually <system_id>.
+ virtual int bind_using_user_id (PortableServer::Servant servant,
+ const PortableServer::ObjectId &user_id,
+ CORBA::Short priority,
+ TAO_Active_Object_Map_Entry *&entry);
+
+ /// Are there any remaining activations of <servant> in the active
+ /// object map? Can be used with any policy.
+ virtual CORBA::Boolean remaining_activations (PortableServer::Servant servant);
+};
+
+/**
+ * @class TAO_Lifespan_Strategy
+ *
+ * @brief Lifespan strategy.
+ *
+ * Strategy for implementing points of variation between the
+ * TRANSIENT and the PERSISTENT policies.
+ */
+class TAO_Lifespan_Strategy
+{
+public:
+
+ /// Virtual destructor.
+ virtual ~TAO_Lifespan_Strategy (void);
+
+ /// Can be used with any policy.
+ virtual int find_servant_using_system_id_and_user_id (const PortableServer::ObjectId &system_id,
+ const PortableServer::ObjectId &user_id,
+ PortableServer::Servant &servant,
+ TAO_Active_Object_Map_Entry *&entry) = 0;
+
+ /// Set the active map.
+ void set_active_object_map (TAO_Active_Object_Map *active_object_map);
+
+protected:
+
+ /// Pointer to the active map.
+ TAO_Active_Object_Map *active_object_map_;
+};
+
+/**
+ * @class TAO_Transient_Strategy
+ *
+ * @brief Transient strategy.
+ *
+ * Strategy for the TRANSIENT policy.
+ */
+class TAO_Transient_Strategy : public TAO_Lifespan_Strategy
+{
+public:
+ /// Can be used with any policy.
+ virtual int find_servant_using_system_id_and_user_id (const PortableServer::ObjectId &system_id,
+ const PortableServer::ObjectId &user_id,
+ PortableServer::Servant &servant,
+ TAO_Active_Object_Map_Entry *&entry);
+};
+
+/**
+ * @class TAO_Persistent_Strategy
+ *
+ * @brief Persistent strategy.
+ *
+ * Strategy for the PERSISTENT policy.
+ */
+class TAO_Persistent_Strategy : public TAO_Lifespan_Strategy
+{
+public:
+ /// Can be used with any policy.
+ virtual int find_servant_using_system_id_and_user_id (const PortableServer::ObjectId &system_id,
+ const PortableServer::ObjectId &user_id,
+ PortableServer::Servant &servant,
+ TAO_Active_Object_Map_Entry *&entry);
+
+};
+
+/**
+ * @class TAO_Id_Assignment_Strategy
+ *
+ * @brief Id uniqueness strategy.
+ *
+ * Strategy for implementing points of variation between the
+ * USER_ID and the SYSTEM_ID policies.
+ */
+class TAO_Id_Assignment_Strategy
+{
+public:
+ /// Virtual destructor.
+ virtual ~TAO_Id_Assignment_Strategy (void);
+
+ /// Must be used with SYSTEM_ID policy.
+ virtual int bind_using_system_id (PortableServer::Servant servant,
+ CORBA::Short priority,
+ TAO_Active_Object_Map_Entry *&entry) = 0;
+
+ /// Set the active map.
+ void set_active_object_map (TAO_Active_Object_Map *active_object_map);
+
+protected:
+
+ /// Pointer to the active map.
+ TAO_Active_Object_Map *active_object_map_;
+};
+
+/**
+ * @class TAO_User_Id_Strategy
+ *
+ * @brief User id strategy.
+ *
+ * Strategy for the USER_ID policy.
+ */
+class TAO_User_Id_Strategy : public TAO_Id_Assignment_Strategy
+{
+public:
+ /// Must be used with SYSTEM_ID policy.
+ virtual int bind_using_system_id (PortableServer::Servant servant,
+ CORBA::Short priority,
+ TAO_Active_Object_Map_Entry *&entry);
+};
+
+/**
+ * @class TAO_System_Id_With_Unique_Id_Strategy
+ *
+ * @brief System id strategy.
+ *
+ * Strategy for the SYSTEM_ID policy (with UNIQUE_ID policy).
+ */
+class TAO_System_Id_With_Unique_Id_Strategy : public TAO_Id_Assignment_Strategy
+{
+public:
+ /// Must be used with SYSTEM_ID policy.
+ virtual int bind_using_system_id (PortableServer::Servant servant,
+ CORBA::Short priority,
+ TAO_Active_Object_Map_Entry *&entry);
+};
+
+/**
+ * @class TAO_System_Id_With_Multiple_Id_Strategy
+ *
+ * @brief System id strategy.
+ *
+ * Strategy for the SYSTEM_ID policy (with MULTIPLE_ID policy).
+ */
+class TAO_System_Id_With_Multiple_Id_Strategy : public TAO_Id_Assignment_Strategy
+{
+public:
+ /// Must be used with SYSTEM_ID policy.
+ virtual int bind_using_system_id (PortableServer::Servant servant,
+ CORBA::Short priority,
+ TAO_Active_Object_Map_Entry *&entry);
+};
+
+/**
+ * @class TAO_Id_Hint_Strategy
+ *
+ * @brief Id uniqueness strategy.
+ *
+ * Strategy for implementing points of variation between the
+ * active hint and the no hint policies.
+ */
+class TAO_Id_Hint_Strategy
+{
+public:
+ /// Virtual destructor.
+ virtual ~TAO_Id_Hint_Strategy (void);
+
+ /// Find the user id from the system id.
+ virtual int recover_key (const PortableServer::ObjectId &system_id,
+ PortableServer::ObjectId &user_id) = 0;
+
+ /// Add to map.
+ virtual int bind (TAO_Active_Object_Map_Entry &entry) = 0;
+
+ /// Remove from map.
+ virtual int unbind (TAO_Active_Object_Map_Entry &entry) = 0;
+
+ /// Find system id.
+ virtual int find (const PortableServer::ObjectId &system_id,
+ TAO_Active_Object_Map_Entry *&entry) = 0;
+
+ /// How big is the hint generated by this strategy?
+ virtual size_t hint_size (void) = 0;
+
+ /// Get the system id associated with this entry.
+ virtual int system_id (PortableServer::ObjectId_out system_id,
+ TAO_Active_Object_Map_Entry &entry) = 0;
+};
+
+/**
+ * @class TAO_Active_Hint_Strategy
+ *
+ * @brief Active hint strategy.
+ *
+ * Strategy for adding active hints to ids.
+ */
+class TAO_Active_Hint_Strategy : public TAO_Id_Hint_Strategy
+{
+public:
+ TAO_Active_Hint_Strategy (CORBA::ULong map_size);
+
+ /// Virtual destructor.
+ virtual ~TAO_Active_Hint_Strategy (void);
+
+ virtual int recover_key (const PortableServer::ObjectId &system_id,
+ PortableServer::ObjectId &user_id);
+
+ virtual int bind (TAO_Active_Object_Map_Entry &entry);
+
+ virtual int unbind (TAO_Active_Object_Map_Entry &entry);
+
+ virtual int find (const PortableServer::ObjectId &system_id,
+ TAO_Active_Object_Map_Entry *&entry);
+
+ virtual size_t hint_size (void);
+
+ virtual int system_id (PortableServer::ObjectId_out system_id,
+ TAO_Active_Object_Map_Entry &entry);
+
+ typedef ACE_Active_Map_Manager_Adapter<
+ PortableServer::ObjectId,
+ TAO_Active_Object_Map_Entry *,
+ TAO_Preserve_Original_Key_Adapter> system_id_map;
+
+ system_id_map system_id_map_;
+};
+
+/**
+ * @class TAO_No_Hint_Strategy
+ *
+ * @brief No hint strategy.
+ *
+ * Strategy for not adding active hints to ids.
+ */
+class TAO_No_Hint_Strategy : public TAO_Id_Hint_Strategy
+{
+public:
+ /// Virtual destructor.
+ virtual ~TAO_No_Hint_Strategy (void);
+
+ virtual int recover_key (const PortableServer::ObjectId &system_id,
+ PortableServer::ObjectId &user_id);
+
+ virtual int bind (TAO_Active_Object_Map_Entry &entry);
+
+ virtual int unbind (TAO_Active_Object_Map_Entry &entry);
+
+ virtual int find (const PortableServer::ObjectId &system_id,
+ TAO_Active_Object_Map_Entry *&entry);
+
+ virtual size_t hint_size (void);
+
+ virtual int system_id (PortableServer::ObjectId_out system_id,
+ TAO_Active_Object_Map_Entry &entry);
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/PortableServer/Active_Object_Map.i"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_ACTIVE_OBJECT_MAP_H */
diff --git a/TAO/tao/PortableServer/Active_Object_Map.i b/TAO/tao/PortableServer/Active_Object_Map.i
new file mode 100644
index 00000000000..31b3326b811
--- /dev/null
+++ b/TAO/tao/PortableServer/Active_Object_Map.i
@@ -0,0 +1,264 @@
+// -*- C++ -*-
+//
+// $Id$
+
+#include "tao/PortableServer/Active_Object_Map_Entry.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE int
+TAO_Active_Object_Map::is_servant_in_map (PortableServer::Servant servant,
+ int &deactivated)
+{
+ return this->id_uniqueness_strategy_->is_servant_in_map (servant,
+ deactivated);
+}
+
+ACE_INLINE int
+TAO_Active_Object_Map::bind_using_system_id_returning_system_id (PortableServer::Servant servant,
+ CORBA::Short priority,
+ PortableServer::ObjectId_out system_id)
+{
+ if (servant == 0 &&
+ !this->using_active_maps_)
+ {
+ PortableServer::ObjectId id;
+
+ int result =
+ this->user_id_map_->create_key (id);
+
+ if (result == 0)
+ {
+ ACE_NEW_RETURN (system_id,
+ PortableServer::ObjectId (id),
+ -1);
+ }
+
+ return result;
+ }
+
+ TAO_Active_Object_Map_Entry *entry = 0;
+
+ int result = this->id_assignment_strategy_->bind_using_system_id (servant,
+ priority,
+ entry);
+
+ if (result == 0)
+ result = this->id_hint_strategy_->system_id (system_id,
+ *entry);
+ return result;
+}
+
+ACE_INLINE int
+TAO_Active_Object_Map::bind_using_system_id_returning_user_id (PortableServer::Servant servant,
+ CORBA::Short priority,
+ PortableServer::ObjectId_out user_id)
+{
+ TAO_Active_Object_Map_Entry *entry = 0;
+
+ int result = this->id_assignment_strategy_->bind_using_system_id (servant,
+ priority,
+ entry);
+ if (result == 0)
+ ACE_NEW_RETURN (user_id,
+ PortableServer::ObjectId (entry->user_id_),
+ -1);
+ return result;
+}
+
+ACE_INLINE int
+TAO_Active_Object_Map::bind_using_user_id (PortableServer::Servant servant,
+ const PortableServer::ObjectId &user_id,
+ CORBA::Short priority)
+{
+ TAO_Active_Object_Map_Entry *entry = 0;
+ return this->id_uniqueness_strategy_->bind_using_user_id (servant,
+ user_id,
+ priority,
+ entry);
+}
+
+ACE_INLINE int
+TAO_Active_Object_Map::find_system_id_using_user_id (const PortableServer::ObjectId &user_id,
+ CORBA::Short priority,
+ PortableServer::ObjectId_out system_id)
+{
+ if (!this->using_active_maps_)
+ {
+ ACE_NEW_RETURN (system_id,
+ PortableServer::ObjectId (user_id),
+ -1);
+
+ return 0;
+ }
+
+ TAO_Active_Object_Map_Entry *entry = 0;
+ int result = this->id_uniqueness_strategy_->bind_using_user_id (0,
+ user_id,
+ priority,
+ entry);
+ if (result == 0)
+ result = this->id_hint_strategy_->system_id (system_id,
+ *entry);
+ return result;
+}
+
+ACE_INLINE int
+TAO_Active_Object_Map::rebind_using_user_id_and_system_id (PortableServer::Servant servant,
+ const PortableServer::ObjectId &user_id,
+ const PortableServer::ObjectId &system_id,
+ TAO_Active_Object_Map_Entry *&entry)
+{
+ ACE_UNUSED_ARG (system_id);
+
+ return this->id_uniqueness_strategy_->bind_using_user_id (servant,
+ user_id,
+ -1,
+ entry);
+}
+
+ACE_INLINE int
+TAO_Active_Object_Map::unbind_using_user_id (const PortableServer::ObjectId &user_id)
+{
+ return this->id_uniqueness_strategy_->unbind_using_user_id (user_id);
+}
+
+ACE_INLINE int
+TAO_Active_Object_Map::find_user_id_using_servant (PortableServer::Servant servant,
+ PortableServer::ObjectId_out user_id)
+{
+ return this->id_uniqueness_strategy_->find_user_id_using_servant (servant,
+ user_id);
+}
+
+ACE_INLINE int
+TAO_Active_Object_Map::find_system_id_using_servant (PortableServer::Servant servant,
+ PortableServer::ObjectId_out system_id,
+ CORBA::Short &priority)
+{
+ return this->id_uniqueness_strategy_->find_system_id_using_servant (servant,
+ system_id,
+ priority);
+}
+
+ACE_INLINE int
+TAO_Active_Object_Map::find_servant_using_user_id (const PortableServer::ObjectId &user_id,
+ PortableServer::Servant &servant)
+{
+ TAO_Active_Object_Map_Entry *entry = 0;
+ int result = this->user_id_map_->find (user_id,
+ entry);
+ if (result == 0)
+ {
+ if (entry->deactivated_)
+ result = -1;
+ else if (entry->servant_ == 0)
+ result = -1;
+ else
+ servant = entry->servant_;
+ }
+
+ return result;
+}
+
+ACE_INLINE int
+TAO_Active_Object_Map::find_servant_using_system_id_and_user_id (const PortableServer::ObjectId &system_id,
+ const PortableServer::ObjectId &user_id,
+ PortableServer::Servant &servant,
+ TAO_Active_Object_Map_Entry *&entry)
+{
+ return this->lifespan_strategy_->find_servant_using_system_id_and_user_id (system_id,
+ user_id,
+ servant,
+ entry);
+}
+
+ACE_INLINE int
+TAO_Active_Object_Map::find_entry_using_user_id (const PortableServer::ObjectId &user_id,
+ TAO_Active_Object_Map_Entry *&entry)
+{
+ int result = this->user_id_map_->find (user_id,
+ entry);
+
+ if (result == 0)
+ {
+ if (entry->deactivated_)
+ result = -1;
+ }
+
+ return result;
+}
+
+ACE_INLINE int
+TAO_Active_Object_Map::find_servant_and_system_id_using_user_id (const PortableServer::ObjectId &user_id,
+ PortableServer::Servant &servant,
+ PortableServer::ObjectId_out system_id,
+ CORBA::Short &priority)
+{
+ TAO_Active_Object_Map_Entry *entry = 0;
+ int result = this->find_entry_using_user_id (user_id,
+ entry);
+
+ if (result == 0)
+ {
+ if (entry->servant_ == 0)
+ {
+ result = -1;
+ }
+ else
+ {
+ result = this->id_hint_strategy_->system_id (system_id,
+ *entry);
+ if (result == 0)
+ {
+ servant = entry->servant_;
+ priority = entry->priority_;
+ }
+ }
+ }
+
+ return result;
+}
+
+ACE_INLINE int
+TAO_Active_Object_Map::find_user_id_using_system_id (const PortableServer::ObjectId &system_id,
+ PortableServer::ObjectId_out user_id)
+{
+ PortableServer::ObjectId id;
+ int result = this->id_hint_strategy_->recover_key (system_id,
+ id);
+ if (result == 0)
+ ACE_NEW_RETURN (user_id,
+ PortableServer::ObjectId (id),
+ -1);
+ return 0;
+}
+
+ACE_INLINE int
+TAO_Active_Object_Map::find_user_id_using_system_id (const PortableServer::ObjectId &system_id,
+ PortableServer::ObjectId &user_id)
+{
+ return this->id_hint_strategy_->recover_key (system_id,
+ user_id);
+}
+
+ACE_INLINE CORBA::Boolean
+TAO_Active_Object_Map::remaining_activations (PortableServer::Servant servant)
+{
+ return this->id_uniqueness_strategy_->remaining_activations (servant);
+}
+
+ACE_INLINE size_t
+TAO_Active_Object_Map::current_size (void)
+{
+ return this->user_id_map_->current_size ();
+}
+
+/* static */
+ACE_INLINE size_t
+TAO_Active_Object_Map::system_id_size (void)
+{
+ return TAO_Active_Object_Map::system_id_size_;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/Active_Object_Map_Entry.cpp b/TAO/tao/PortableServer/Active_Object_Map_Entry.cpp
new file mode 100644
index 00000000000..fc29e9faec0
--- /dev/null
+++ b/TAO/tao/PortableServer/Active_Object_Map_Entry.cpp
@@ -0,0 +1,21 @@
+// $Id$
+
+#include "tao/PortableServer/Active_Object_Map_Entry.h"
+
+ACE_RCSID(PortableServer,
+ Active_Object_Map_Entry,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Active_Object_Map_Entry::TAO_Active_Object_Map_Entry (void)
+ : user_id_ (),
+ system_id_ (),
+ servant_ (0),
+ reference_count_ (1),
+ deactivated_ (0),
+ priority_ (-1)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/Active_Object_Map_Entry.h b/TAO/tao/PortableServer/Active_Object_Map_Entry.h
new file mode 100644
index 00000000000..75d2a3d2c40
--- /dev/null
+++ b/TAO/tao/PortableServer/Active_Object_Map_Entry.h
@@ -0,0 +1,65 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Active_Object_Map_Entry.h
+ *
+ * $Id$
+ *
+ * @author Irfan Pyarali
+ */
+//=============================================================================
+
+
+#ifndef TAO_ACTIVE_OBJECT_MAP_ENTRY_H
+#define TAO_ACTIVE_OBJECT_MAP_ENTRY_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/PS_ForwardC.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @struct TAO_Active_Object_Map_Entry
+ *
+ * @brief Value field of the active object map.
+ *
+ * We need a mapping from and to all of the following fields:
+ * user_id, system_id, and servant. Therefore, we keep
+ * all the fields together in the map.
+ */
+struct TAO_Active_Object_Map_Entry
+{
+ /// Default constructor.
+ TAO_Active_Object_Map_Entry (void);
+
+ /// User id.
+ PortableServer::ObjectId user_id_;
+
+ /// System id.
+ PortableServer::ObjectId system_id_;
+
+ /// Servant.
+ PortableServer::Servant servant_;
+
+ /// Reference count on outstanding requests on this servant.
+ CORBA::UShort reference_count_;
+
+ /// Has this servant been deactivated already?
+ CORBA::Boolean deactivated_;
+
+ /// Priority of this servant.
+ CORBA::Short priority_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_ACTIVE_OBJECT_MAP_ENTRY_H */
diff --git a/TAO/tao/PortableServer/Active_Policy_Strategies.cpp b/TAO/tao/PortableServer/Active_Policy_Strategies.cpp
new file mode 100644
index 00000000000..33c267042ba
--- /dev/null
+++ b/TAO/tao/PortableServer/Active_Policy_Strategies.cpp
@@ -0,0 +1,241 @@
+// $Id$
+
+#include "tao/PortableServer/Active_Policy_Strategies.h"
+#include "tao/PortableServer/POA_Cached_Policies.h"
+
+#include "tao/PortableServer/ThreadStrategy.h"
+#include "tao/PortableServer/ThreadStrategyFactory.h"
+#include "tao/PortableServer/RequestProcessingStrategy.h"
+#include "tao/PortableServer/RequestProcessingStrategyFactory.h"
+#include "tao/PortableServer/IdAssignmentStrategy.h"
+#include "tao/PortableServer/IdAssignmentStrategyFactory.h"
+#include "tao/PortableServer/LifespanStrategy.h"
+#include "tao/PortableServer/LifespanStrategyFactory.h"
+#include "tao/PortableServer/IdUniquenessStrategy.h"
+#include "tao/PortableServer/IdUniquenessStrategyFactory.h"
+#include "tao/PortableServer/ImplicitActivationStrategy.h"
+#include "tao/PortableServer/ImplicitActivationStrategyFactory.h"
+#include "tao/PortableServer/ServantRetentionStrategy.h"
+#include "tao/PortableServer/ServantRetentionStrategyFactory.h"
+
+#include "tao/PortableServer/IdAssignmentPolicyC.h"
+#include "tao/PortableServer/IdUniquenessPolicyC.h"
+#include "tao/PortableServer/ImplicitActivationPolicyC.h"
+#include "tao/PortableServer/LifespanPolicyC.h"
+#include "tao/PortableServer/RequestProcessingPolicyC.h"
+#include "tao/PortableServer/ServantRetentionPolicyC.h"
+#include "tao/PortableServer/ThreadPolicyC.h"
+#include "tao/PortableServer/ServantRetentionPolicyC.h"
+
+#include "ace/Dynamic_Service.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/PortableServer/Active_Policy_Strategies.inl"
+#endif /* __ACE_INLINE__ */
+
+ACE_RCSID(PortableServer,
+ Active_Policy_Strategies,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ Active_Policy_Strategies::Active_Policy_Strategies (void)
+ : thread_strategy_ (0),
+ request_processing_strategy_ (0),
+ id_assignment_strategy_ (0),
+ lifespan_strategy_ (0),
+ id_uniqueness_strategy_ (0),
+ implicit_activation_strategy_ (0),
+ servant_retention_strategy_ (0),
+ thread_strategy_factory_ (0),
+ servant_retention_strategy_factory_ (0),
+ request_processing_strategy_factory_ (0),
+ lifespan_strategy_factory_ (0),
+ implicit_activation_strategy_factory_ (0),
+ id_uniqueness_strategy_factory_ (0),
+ id_assignment_strategy_factory_ (0)
+ {
+ }
+
+ void
+ Active_Policy_Strategies::update (Cached_Policies &policies,
+ ::TAO_Root_POA *poa
+ ACE_ENV_ARG_DECL)
+ {
+ this->thread_strategy_factory_ =
+ ACE_Dynamic_Service<ThreadStrategyFactory>::instance ("ThreadStrategyFactory");
+
+ if (this->thread_strategy_factory_ != 0)
+ this->thread_strategy_ =
+ this->thread_strategy_factory_->create (policies.thread());
+
+ /**/
+
+ this->id_assignment_strategy_factory_ =
+ ACE_Dynamic_Service<IdAssignmentStrategyFactory>::instance ("IdAssignmentStrategyFactory");
+
+ if (this->id_assignment_strategy_factory_ != 0)
+ this->id_assignment_strategy_ =
+ this->id_assignment_strategy_factory_->create (policies.id_assignment());
+
+ /**/
+
+ this->id_uniqueness_strategy_factory_ =
+ ACE_Dynamic_Service<IdUniquenessStrategyFactory>::instance ("IdUniquenessStrategyFactory");
+
+ if (this->id_uniqueness_strategy_factory_ != 0)
+ this->id_uniqueness_strategy_ =
+ this->id_uniqueness_strategy_factory_->create (policies.id_uniqueness());
+
+ /**/
+
+ this->servant_retention_strategy_factory_ =
+ ACE_Dynamic_Service<ServantRetentionStrategyFactory>::instance ("ServantRetentionStrategyFactory");
+
+ if (this->servant_retention_strategy_factory_ != 0)
+ this->servant_retention_strategy_ =
+ this->servant_retention_strategy_factory_->create (policies.servant_retention());
+
+ /**/
+
+ this->request_processing_strategy_factory_ =
+ ACE_Dynamic_Service<RequestProcessingStrategyFactory>::instance ("RequestProcessingStrategyFactory");
+
+ if (this->request_processing_strategy_factory_ != 0)
+ this->request_processing_strategy_ =
+ this->request_processing_strategy_factory_->create (policies.request_processing(), policies.servant_retention());
+
+ /**/
+
+ this->lifespan_strategy_factory_ =
+ ACE_Dynamic_Service<LifespanStrategyFactory>::instance ("LifespanStrategyFactory");
+
+ if (this->lifespan_strategy_factory_ != 0)
+ this->lifespan_strategy_ =
+ this->lifespan_strategy_factory_->create (policies.lifespan());
+
+ /**/
+
+ this->implicit_activation_strategy_factory_ =
+ ACE_Dynamic_Service<ImplicitActivationStrategyFactory>::instance ("ImplicitActivationStrategyFactory");
+
+ if (this->implicit_activation_strategy_factory_ != 0)
+ this->implicit_activation_strategy_ =
+ this->implicit_activation_strategy_factory_->create (policies.implicit_activation());
+
+ /**/
+
+// @todo, check if all pointers are != 0
+
+ if (this->lifespan_strategy_ != 0)
+ {
+ this->lifespan_strategy_->strategy_init (poa ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ if (this->request_processing_strategy_ != 0)
+ {
+ this->request_processing_strategy_->strategy_init (poa, policies.servant_retention() ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ if (this->id_uniqueness_strategy_ != 0)
+ {
+ this->id_uniqueness_strategy_->strategy_init (poa ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ if (this->implicit_activation_strategy_ != 0)
+ {
+ this->implicit_activation_strategy_->strategy_init (poa ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ if (this->thread_strategy_ != 0)
+ {
+ this->thread_strategy_->strategy_init (poa ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ if (this->servant_retention_strategy_ != 0)
+ {
+ this->servant_retention_strategy_->strategy_init (poa ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ if (this->id_assignment_strategy_ != 0)
+ {
+ this->id_assignment_strategy_->strategy_init (poa ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ }
+
+ void
+ Active_Policy_Strategies::cleanup (ACE_ENV_SINGLE_ARG_DECL)
+ {
+
+ if (this->lifespan_strategy_ != 0)
+ {
+ this->lifespan_strategy_factory_->destroy (lifespan_strategy_ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->lifespan_strategy_ = 0;
+ }
+
+ if (this->request_processing_strategy_ != 0)
+ {
+ this->request_processing_strategy_factory_->destroy (request_processing_strategy_ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->request_processing_strategy_ = 0;
+ }
+
+ if (this->id_uniqueness_strategy_ != 0)
+ {
+ this->id_uniqueness_strategy_factory_->destroy (id_uniqueness_strategy_ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->id_uniqueness_strategy_ = 0;
+ }
+
+ if (this->implicit_activation_strategy_ != 0)
+ {
+ this->implicit_activation_strategy_factory_->destroy (implicit_activation_strategy_ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->implicit_activation_strategy_ = 0;
+ }
+
+ if (this->thread_strategy_ != 0)
+ {
+ this->thread_strategy_factory_->destroy (thread_strategy_ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->thread_strategy_ = 0;
+ }
+
+ if (this->servant_retention_strategy_ != 0)
+ {
+ this->servant_retention_strategy_factory_->destroy (servant_retention_strategy_ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->servant_retention_strategy_ = 0;
+ }
+
+ if (this->id_assignment_strategy_ != 0)
+ {
+ this->id_assignment_strategy_factory_->destroy (id_assignment_strategy_ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->id_assignment_strategy_ = 0;
+ }
+ }
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/Active_Policy_Strategies.h b/TAO/tao/PortableServer/Active_Policy_Strategies.h
new file mode 100644
index 00000000000..685c6978c2b
--- /dev/null
+++ b/TAO/tao/PortableServer/Active_Policy_Strategies.h
@@ -0,0 +1,107 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Active_Policy_Strategies.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_PORTABLESERVER_ACTIVE_POLICY_STRATEGIES_H
+#define TAO_PORTABLESERVER_ACTIVE_POLICY_STRATEGIES_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Environment.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/CORBA_macros.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Root_POA;
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ class Cached_Policies;
+ class ThreadStrategy;
+ class RequestProcessingStrategy;
+ class IdAssignmentStrategy;
+ class LifespanStrategy;
+ class IdUniquenessStrategy;
+ class ImplicitActivationStrategy;
+ class ServantRetentionStrategy;
+
+ class ThreadStrategyFactory;
+ class ServantRetentionStrategyFactory;
+ class RequestProcessingStrategyFactory;
+ class LifespanStrategyFactory;
+ class ImplicitActivationStrategyFactory;
+ class IdUniquenessStrategyFactory;
+ class IdAssignmentStrategyFactory;
+
+ /**
+ * This class stores the active policy strategies used for a certain POA.
+ */
+ class Active_Policy_Strategies
+ {
+ public:
+ Active_Policy_Strategies (void);
+
+ void update (Cached_Policies &policies,
+ TAO_Root_POA* poa
+ ACE_ENV_ARG_DECL);
+
+ void cleanup (ACE_ENV_SINGLE_ARG_DECL);
+
+ ThreadStrategy *thread_strategy (void) const;
+
+ RequestProcessingStrategy *request_processing_strategy (void) const;
+
+ IdAssignmentStrategy *id_assignment_strategy (void) const;
+
+ IdUniquenessStrategy *id_uniqueness_strategy (void) const;
+
+ LifespanStrategy *lifespan_strategy (void) const;
+
+ ImplicitActivationStrategy *implicit_activation_strategy (void) const;
+
+ ServantRetentionStrategy *servant_retention_strategy (void) const;
+
+ private:
+ ThreadStrategy *thread_strategy_;
+ RequestProcessingStrategy *request_processing_strategy_;
+ IdAssignmentStrategy *id_assignment_strategy_;
+ LifespanStrategy *lifespan_strategy_;
+ IdUniquenessStrategy *id_uniqueness_strategy_;
+ ImplicitActivationStrategy *implicit_activation_strategy_;
+ ServantRetentionStrategy *servant_retention_strategy_;
+
+ ThreadStrategyFactory *thread_strategy_factory_;
+ ServantRetentionStrategyFactory *servant_retention_strategy_factory_;
+ RequestProcessingStrategyFactory *request_processing_strategy_factory_;
+ LifespanStrategyFactory *lifespan_strategy_factory_;
+ ImplicitActivationStrategyFactory *implicit_activation_strategy_factory_;
+ IdUniquenessStrategyFactory *id_uniqueness_strategy_factory_;
+ IdAssignmentStrategyFactory *id_assignment_strategy_factory_;
+ };
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/PortableServer/Active_Policy_Strategies.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_PORTABLESERVER_ACTIVE_POLICY_STRATEGIES_H */
diff --git a/TAO/tao/PortableServer/Active_Policy_Strategies.inl b/TAO/tao/PortableServer/Active_Policy_Strategies.inl
new file mode 100644
index 00000000000..ab606b04b1a
--- /dev/null
+++ b/TAO/tao/PortableServer/Active_Policy_Strategies.inl
@@ -0,0 +1,62 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ ACE_INLINE
+ ThreadStrategy*
+ Active_Policy_Strategies::thread_strategy (void) const
+ {
+ return this->thread_strategy_;
+ }
+
+ ACE_INLINE
+ RequestProcessingStrategy*
+ Active_Policy_Strategies::request_processing_strategy (void) const
+ {
+ return this->request_processing_strategy_;
+ }
+
+ ACE_INLINE
+ IdAssignmentStrategy *
+ Active_Policy_Strategies::id_assignment_strategy (void) const
+ {
+ return this->id_assignment_strategy_;
+ }
+
+ ACE_INLINE
+ IdUniquenessStrategy *
+ Active_Policy_Strategies::id_uniqueness_strategy (void) const
+ {
+ return this->id_uniqueness_strategy_;
+ }
+
+ ACE_INLINE
+ LifespanStrategy*
+ Active_Policy_Strategies::lifespan_strategy (void) const
+ {
+ return this->lifespan_strategy_;
+ }
+
+ ACE_INLINE
+ ImplicitActivationStrategy*
+ Active_Policy_Strategies::implicit_activation_strategy (void) const
+ {
+ return this->implicit_activation_strategy_;
+ }
+
+ ACE_INLINE
+ ServantRetentionStrategy*
+ Active_Policy_Strategies::servant_retention_strategy (void) const
+ {
+ return this->servant_retention_strategy_;
+ }
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/AdapterActivator.pidl b/TAO/tao/PortableServer/AdapterActivator.pidl
new file mode 100644
index 00000000000..40c13708947
--- /dev/null
+++ b/TAO/tao/PortableServer/AdapterActivator.pidl
@@ -0,0 +1,34 @@
+/**
+ * @file AdapterActivator.pidl
+ *
+ * $Id$
+ *
+ * @brief PIDL source for the PortableServer module.
+ *
+ */
+
+#ifndef _PORTABLESERVER_ADAPTER_ACTIVATOR_IDL_
+#define _PORTABLESERVER_ADAPTER_ACTIVATOR_IDL_
+
+///FUZZ: disable check_for_include/
+#include "tao/PortableServer/PS_Forward.pidl"
+
+#pragma prefix "omg.org"
+
+#if !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO) && !defined (TAO_HAS_MINIMUM_POA)
+
+module PortableServer
+{
+ /// AdapterActivator interface.
+ local interface AdapterActivator
+ {
+# pragma version AdapterActivator 2.3
+
+ boolean unknown_adapter (in POA parent,
+ in string name);
+ };
+};
+
+#endif
+
+#endif // _PORTABLESERVER_ADAPTER_ACTIVATOR_IDL_
diff --git a/TAO/tao/PortableServer/Adapter_Activator.cpp b/TAO/tao/PortableServer/Adapter_Activator.cpp
new file mode 100644
index 00000000000..1b97b7269b8
--- /dev/null
+++ b/TAO/tao/PortableServer/Adapter_Activator.cpp
@@ -0,0 +1,70 @@
+// $Id$
+
+#include "tao/PortableServer/Adapter_Activator.h"
+
+ACE_RCSID (PortableServer,
+ Adapter_Activator,
+ "$Id$")
+
+#if (TAO_HAS_MINIMUM_POA == 0)
+#if !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
+
+#include "tao/PortableServer/AdapterActivatorC.h"
+#include "tao/PortableServer/POAManagerC.h"
+#include "tao/PortableServer/PortableServer.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ Adapter_Activator::Adapter_Activator (
+ PortableServer::POAManager_ptr pm)
+ : poa_manager_ (PortableServer::POAManager::_duplicate (pm))
+ {
+ }
+
+ CORBA::Boolean
+ Adapter_Activator::unknown_adapter (PortableServer::POA_ptr parent,
+ const char *name
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ // Default policies
+ CORBA::PolicyList default_policies;
+
+ // This assumes that the lock on the parent is recursive
+ PortableServer::POA_var child =
+ parent->create_POA (name,
+ this->poa_manager_.in (),
+ default_policies
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ ACE_TRY
+ {
+ child->the_activator (this ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ (void) child->destroy (1,
+ 1
+ ACE_ENV_ARG_PARAMETER);
+
+ return false;
+ }
+ ACE_ENDTRY;
+ ACE_CHECK_RETURN (0);
+
+ // Finally everything is fine
+ return true;
+ }
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif
+#endif /* TAO_HAS_MINIMUM_POA == 0 */
diff --git a/TAO/tao/PortableServer/Adapter_Activator.h b/TAO/tao/PortableServer/Adapter_Activator.h
new file mode 100644
index 00000000000..9d70eaabddf
--- /dev/null
+++ b/TAO/tao/PortableServer/Adapter_Activator.h
@@ -0,0 +1,66 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Adapter_Activator.h
+ *
+ * $Id$
+ */
+//=============================================================================
+
+#ifndef TAO_ADAPTER_ACTIVATOR_H
+#define TAO_ADAPTER_ACTIVATOR_H
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/AdapterActivatorC.h"
+
+#if (TAO_HAS_MINIMUM_POA == 0)
+#if !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace PortableServer
+{
+ class POAManager;
+
+ typedef POAManager *POAManager_ptr;
+ typedef TAO_Objref_Var_T<POAManager> POAManager_var;
+}
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ class TAO_PortableServer_Export Adapter_Activator
+ : public PortableServer::AdapterActivator
+ {
+ public:
+
+ Adapter_Activator (PortableServer::POAManager_ptr poa_manager);
+
+ CORBA::Boolean unknown_adapter (PortableServer::POA_ptr parent,
+ const char *name
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ protected:
+
+ /// POA Manager
+ PortableServer::POAManager_var poa_manager_;
+ };
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif
+#endif /* TAO_HAS_MINIMUM_POA == 0 */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_ADAPTER_ACTIVATOR_H */
diff --git a/TAO/tao/PortableServer/Any_SArg_Traits.h b/TAO/tao/PortableServer/Any_SArg_Traits.h
new file mode 100644
index 00000000000..94980dc0c0b
--- /dev/null
+++ b/TAO/tao/PortableServer/Any_SArg_Traits.h
@@ -0,0 +1,51 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Any_SArg_Traits.h
+ *
+ * $Id$
+ *
+ * @author Jeff Parsons
+ * @author Ossama Othman
+ */
+//=============================================================================
+
+
+#ifndef TAO_ANY_SARG_TRAITS_H
+#define TAO_ANY_SARG_TRAITS_H
+
+#include /**/ "ace/pre.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/Var_Size_SArgument_T.h"
+#include "tao/PortableServer/portableserver_export.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace CORBA
+{
+ class Any;
+}
+
+namespace TAO
+{
+ template<>
+ class TAO_PortableServer_Export SArg_Traits<CORBA::Any>
+ : public
+ Var_Size_SArg_Traits_T<
+ CORBA::Any,
+ TAO::Any_Insert_Policy_Stream <CORBA::Any>
+ >
+ {
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_ANY_ARG_TRAITS_H */
diff --git a/TAO/tao/PortableServer/BD_String_SArgument_T.cpp b/TAO/tao/PortableServer/BD_String_SArgument_T.cpp
new file mode 100644
index 00000000000..a984d92b4c3
--- /dev/null
+++ b/TAO/tao/PortableServer/BD_String_SArgument_T.cpp
@@ -0,0 +1,154 @@
+// $Id$
+
+#ifndef TAO_BD_STRING_SARGUMENT_T_CPP
+#define TAO_BD_STRING_SARGUMENT_T_CPP
+
+#include "tao/PortableServer/BD_String_SArgument_T.h"
+
+#if !defined (__ACE_INLINE__)
+#include "tao/PortableServer/BD_String_SArgument_T.inl"
+#endif /* __ACE_INLINE__ */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template<typename S_var,
+ size_t BOUND,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::In_BD_String_SArgument_T<S_var,BOUND,Insert_Policy>::demarshal (
+ TAO_InputCDR & cdr
+ )
+{
+ typedef typename S_var::s_traits::to_type to_type;
+ return cdr >> to_type (this->x_.out (), BOUND);
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S_var,
+ size_t BOUND,
+ class Insert_Policy>
+void
+TAO::In_BD_String_SArgument_T<S_var,BOUND,Insert_Policy>::interceptor_value (
+ CORBA::Any *any) const
+{
+ typedef typename S_var::s_traits::from_type from_type;
+ Insert_Policy::any_insert (
+ any,
+ from_type (this->x_.in (), BOUND)
+ );
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+// ===========================================================
+
+template<typename S_var,
+ size_t BOUND,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::Inout_BD_String_SArgument_T<S_var,BOUND,Insert_Policy>::marshal (
+ TAO_OutputCDR & cdr
+ )
+{
+ typedef typename S_var::s_traits::from_type from_type;
+ return cdr << from_type (this->x_.in (), BOUND);
+}
+
+template<typename S_var,
+ size_t BOUND,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::Inout_BD_String_SArgument_T<S_var,BOUND,Insert_Policy>::demarshal (
+ TAO_InputCDR & cdr
+ )
+{
+ typedef typename S_var::s_traits::to_type to_type;
+ return cdr >> to_type (this->x_.out (), BOUND);
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S_var,
+ size_t BOUND,
+ class Insert_Policy>
+void
+TAO::Inout_BD_String_SArgument_T<S_var,BOUND,Insert_Policy>::
+interceptor_value (CORBA::Any *any) const
+{
+ typedef typename S_var::s_traits::from_type from_type;
+ Insert_Policy::any_insert (
+ any,
+ from_type (this->x_.in (), BOUND)
+ );
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+// ==============================================================
+
+template<typename S_var,
+ size_t BOUND,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::Out_BD_String_SArgument_T<S_var,BOUND,Insert_Policy>::marshal (
+ TAO_OutputCDR &cdr
+ )
+{
+ typedef typename S_var::s_traits::from_type from_type;
+ return cdr << from_type (this->x_.in (), BOUND);
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S_var,
+ size_t BOUND,
+ class Insert_Policy>
+void
+TAO::Out_BD_String_SArgument_T<S_var,BOUND,Insert_Policy>::
+interceptor_value (CORBA::Any *any) const
+{
+ typedef typename S_var::s_traits::from_type from_type;
+ Insert_Policy::any_insert (
+ any,
+ from_type (this->x_.in (), BOUND)
+ );
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+// ============================================================
+
+template<typename S_var,
+ size_t BOUND,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::Ret_BD_String_SArgument_T<S_var,BOUND,Insert_Policy>::marshal (
+ TAO_OutputCDR & cdr
+ )
+{
+ typedef typename S_var::s_traits::from_type from_type;
+ return cdr << from_type (this->x_.in (), BOUND);
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S_var,
+ size_t BOUND,
+ class Insert_Policy>
+void
+TAO::Ret_BD_String_SArgument_T<S_var,BOUND,Insert_Policy>::
+interceptor_value (CORBA::Any *any) const
+{
+ typedef typename S_var::s_traits::from_type from_type;
+ Insert_Policy::any_insert (
+ any,
+ from_type (this->x_.in (), BOUND)
+ );
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_BD_STRING_SARGUMENT_T_CPP */
diff --git a/TAO/tao/PortableServer/BD_String_SArgument_T.h b/TAO/tao/PortableServer/BD_String_SArgument_T.h
new file mode 100644
index 00000000000..4ef604e4453
--- /dev/null
+++ b/TAO/tao/PortableServer/BD_String_SArgument_T.h
@@ -0,0 +1,183 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file BD_String_SArgument_T.h
+ *
+ * $Id$
+ *
+ * @authors Jeff Parsons, Carlos O'Ryan and Ossama Othman
+ */
+//=============================================================================
+
+
+#ifndef TAO_BD_STRING_SARGUMENT_T_H
+#define TAO_BD_STRING_SARGUMENT_T_H
+
+#include /**/ "ace/pre.h"
+
+#include "ace/CDR_Stream.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Argument.h"
+#include "tao/Any_Insert_Policy_T.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ /**
+ * @class In_BD_String_SArgument_T
+ *
+ * @brief Template class for IN skeleton bd (w)string argument.
+ *
+ */
+ template<typename S_var,
+ size_t BOUND,
+ class Insert_Policy>
+ class In_BD_String_SArgument_T : public InArgument
+ {
+ public:
+ In_BD_String_SArgument_T (void);
+
+ virtual CORBA::Boolean demarshal (TAO_InputCDR &);
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ const typename S_var::s_traits::char_type * arg (void) const;
+
+ private:
+ S_var x_;
+ };
+
+ /**
+ * @class Inout_BD_String_SArgument_T
+ *
+ * @brief Template class for INOUT skeleton bd (w)string argument.
+ *
+ */
+ template<typename S_var,
+ size_t BOUND,
+ class Insert_Policy>
+ class Inout_BD_String_SArgument_T : public InoutArgument
+ {
+ public:
+ Inout_BD_String_SArgument_T (void);
+
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+ virtual CORBA::Boolean demarshal (TAO_InputCDR &);
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ typename S_var::s_traits::char_type *& arg (void);
+
+ private:
+ S_var x_;
+ };
+
+ /**
+ * @class Out_BD_String_SArgument_T
+ *
+ * @brief Template class for INOUT skeleton bd (w)string argument.
+ *
+ */
+ template<typename S_var,
+ size_t BOUND,
+ class Insert_Policy>
+ class Out_BD_String_SArgument_T : public OutArgument
+ {
+ public:
+ Out_BD_String_SArgument_T (void);
+
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ typename S_var::s_traits::char_type *& arg (void);
+
+ private:
+ S_var x_;
+ };
+
+ /**
+ * @class Ret_BD_String_SArgument_T
+ *
+ * @brief Template class for return skeleton value of bd (w)string.
+ *
+ */
+ template<typename S_var,
+ size_t BOUND,
+ class Insert_Policy>
+ class Ret_BD_String_SArgument_T : public RetArgument
+ {
+ public:
+ Ret_BD_String_SArgument_T (void);
+
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ typename S_var::s_traits::char_type *& arg (void);
+
+ private:
+ S_var x_;
+ };
+
+ /**
+ * @struct Basic_SArg_Traits_T
+ *
+ * @brief Template class for skeleton argument traits of bounded (w)strings.
+ *
+ */
+ template<typename T_var,
+ size_t BOUND,
+ class Insert_Policy>
+ struct BD_String_SArg_Traits_T
+ {
+ typedef typename T_var::s_traits::char_type * ret_type;
+ typedef const typename T_var::s_traits::char_type * in_type;
+ typedef typename T_var::s_traits::char_type *& inout_type;
+ typedef typename T_var::s_traits::string_out out_type;
+
+ typedef In_BD_String_SArgument_T<T_var,
+ BOUND,
+ Insert_Policy> in_arg_val;
+ typedef Inout_BD_String_SArgument_T<T_var,
+ BOUND,
+ Insert_Policy> inout_arg_val;
+ typedef Out_BD_String_SArgument_T<T_var,
+ BOUND,
+ Insert_Policy> out_arg_val;
+ typedef Ret_BD_String_SArgument_T<T_var,
+ BOUND,
+ Insert_Policy> ret_val;
+
+ // Typedefs corresponding to return value of arg() method in both
+ // the client and server side argument class templates.
+ typedef in_type in_arg_type;
+ typedef inout_type inout_arg_type;
+ typedef inout_type out_arg_type;
+ typedef inout_type ret_arg_type;
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+#include "tao/PortableServer/BD_String_SArgument_T.inl"
+#endif /* __ACE_INLINE__ */
+
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+#include "tao/PortableServer/BD_String_SArgument_T.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
+#pragma implementation ("BD_String_SArgument_T.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_BD_STRING_SARGUMENT_T_H */
diff --git a/TAO/tao/PortableServer/BD_String_SArgument_T.inl b/TAO/tao/PortableServer/BD_String_SArgument_T.inl
new file mode 100644
index 00000000000..1359afa5a9c
--- /dev/null
+++ b/TAO/tao/PortableServer/BD_String_SArgument_T.inl
@@ -0,0 +1,89 @@
+// -*- C+ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template<typename S_var,
+ size_t BOUND,
+ class Insert_Policy>
+ACE_INLINE
+TAO::In_BD_String_SArgument_T<S_var,BOUND,Insert_Policy>::
+In_BD_String_SArgument_T (void)
+{}
+
+template<typename S_var,
+ size_t BOUND,
+ class Insert_Policy>
+ACE_INLINE
+const typename S_var::s_traits::char_type *
+TAO::In_BD_String_SArgument_T<S_var,BOUND,Insert_Policy>::
+arg (void) const
+{
+ return this->x_.in ();
+}
+
+// ==========================================================================
+
+template<typename S_var,
+ size_t BOUND,
+ class Insert_Policy>
+ACE_INLINE
+TAO::Inout_BD_String_SArgument_T<S_var,BOUND,Insert_Policy>::
+Inout_BD_String_SArgument_T (void)
+{}
+
+template<typename S_var,
+ size_t BOUND,
+ class Insert_Policy>
+ACE_INLINE
+typename S_var::s_traits::char_type *&
+TAO::Inout_BD_String_SArgument_T<S_var,BOUND,Insert_Policy>::
+arg (void)
+{
+ return this->x_.inout ();
+}
+
+// ==========================================================================
+
+template<typename S_var,
+ size_t BOUND,
+ class Insert_Policy>
+ACE_INLINE
+TAO::Out_BD_String_SArgument_T<S_var,BOUND,Insert_Policy>::
+Out_BD_String_SArgument_T (void)
+{}
+
+template<typename S_var,
+ size_t BOUND,
+ class Insert_Policy>
+ACE_INLINE
+typename S_var::s_traits::char_type *&
+TAO::Out_BD_String_SArgument_T<S_var,BOUND,Insert_Policy>::
+arg (void)
+{
+ return this->x_.out ();
+}
+
+// ==========================================================================
+
+template<typename S_var,
+ size_t BOUND,
+ class Insert_Policy>
+ACE_INLINE
+TAO::Ret_BD_String_SArgument_T<S_var,BOUND,Insert_Policy>::
+Ret_BD_String_SArgument_T (void)
+{}
+
+template<typename S_var,
+ size_t BOUND,
+ class Insert_Policy>
+ACE_INLINE
+typename S_var::s_traits::char_type *&
+TAO::Ret_BD_String_SArgument_T<S_var,BOUND,Insert_Policy>::
+arg (void)
+{
+ return this->x_.out ();
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/Basic_SArgument_T.cpp b/TAO/tao/PortableServer/Basic_SArgument_T.cpp
new file mode 100644
index 00000000000..2065c8ed885
--- /dev/null
+++ b/TAO/tao/PortableServer/Basic_SArgument_T.cpp
@@ -0,0 +1,110 @@
+// $Id$
+
+#ifndef TAO_BASIC_SARGUMENT_T_CPP
+#define TAO_BASIC_SARGUMENT_T_CPP
+
+#include "tao/PortableServer/Basic_SArgument_T.h"
+
+#if !defined (__ACE_INLINE__)
+#include "tao/PortableServer/Basic_SArgument_T.inl"
+#endif /* __ACE_INLINE__ */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template<typename S,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::In_Basic_SArgument_T<S,Insert_Policy>::demarshal (TAO_InputCDR &cdr)
+{
+ return cdr >> this->x_;
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S,
+ class Insert_Policy>
+void
+TAO::In_Basic_SArgument_T<S,Insert_Policy>::interceptor_value (CORBA::Any *any) const
+{
+ Insert_Policy::any_insert (any, this->x_);
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+// ===========================================================
+
+template<typename S,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::Inout_Basic_SArgument_T<S,Insert_Policy>::marshal (TAO_OutputCDR &cdr)
+{
+ return cdr << this->x_;
+}
+
+template<typename S,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::Inout_Basic_SArgument_T<S,Insert_Policy>::demarshal (TAO_InputCDR & cdr)
+{
+ return cdr >> this->x_;
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S,
+ class Insert_Policy>
+void
+TAO::Inout_Basic_SArgument_T<S,Insert_Policy>::interceptor_value (CORBA::Any *any) const
+{
+ Insert_Policy::any_insert (any, this->x_);
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+// ==============================================================
+
+template<typename S,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::Out_Basic_SArgument_T<S,Insert_Policy>::marshal (TAO_OutputCDR &cdr)
+{
+ return cdr << this->x_;
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S,
+ class Insert_Policy>
+void
+TAO::Out_Basic_SArgument_T<S,Insert_Policy>::interceptor_value (CORBA::Any *any) const
+{
+ Insert_Policy::any_insert (any, this->x_);
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+// ============================================================
+
+template<typename S,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::Ret_Basic_SArgument_T<S,Insert_Policy>::marshal (TAO_OutputCDR &cdr)
+{
+ return cdr << this->x_;
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S,
+ class Insert_Policy>
+void
+TAO::Ret_Basic_SArgument_T<S,Insert_Policy>::interceptor_value (CORBA::Any *any) const
+{
+ Insert_Policy::any_insert (any, this->x_);
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_BASIC_SARGUMENT_T_CPP */
diff --git a/TAO/tao/PortableServer/Basic_SArgument_T.h b/TAO/tao/PortableServer/Basic_SArgument_T.h
new file mode 100644
index 00000000000..611c3d5b327
--- /dev/null
+++ b/TAO/tao/PortableServer/Basic_SArgument_T.h
@@ -0,0 +1,163 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Basic_SArgument_T.h
+ *
+ * $Id$
+ *
+ * @authors Jeff Parsons, Carlos O'Ryan and Ossama Othman
+ */
+//=============================================================================
+
+
+#ifndef TAO_BASIC_SARGUMENT_T_H
+#define TAO_BASIC_SARGUMENT_T_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Argument.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ /**
+ * @class In_Basic_SArgument_T
+ *
+ * @brief Template class for IN skeleton argument of basic IDL types.
+ *
+ */
+ template<typename S, class Insert_Policy>
+ class In_Basic_SArgument_T : public InArgument
+ {
+ public:
+ In_Basic_SArgument_T (void);
+
+ virtual CORBA::Boolean demarshal (TAO_InputCDR &);
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ S arg (void) const;
+
+ private:
+ S x_;
+ };
+
+ /**
+ * @class Inout_Basic_SArgument_T
+ *
+ * @brief Template class for INOUT skeleton argument of basic IDL types.
+ *
+ */
+ template<typename S, class Insert_Policy>
+ class Inout_Basic_SArgument_T : public InoutArgument
+ {
+ public:
+ Inout_Basic_SArgument_T (void);
+
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+ virtual CORBA::Boolean demarshal (TAO_InputCDR &);
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ S & arg (void);
+
+ private:
+ S x_;
+ };
+
+ /**
+ * @class Out_Basic_SArgument_T
+ *
+ * @brief Template class for OUT skeleton argument of basic IDL types.
+ *
+ */
+ template<typename S, class Insert_Policy>
+ class Out_Basic_SArgument_T : public OutArgument
+ {
+ public:
+ Out_Basic_SArgument_T (void);
+
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ S & arg (void);
+
+ private:
+ S x_;
+ };
+
+ /**
+ * @class Ret_Basic_SArgument_T
+ *
+ * @brief Template class for return skeleton value of basic IDL types.
+ *
+ */
+ template<typename S, class Insert_Policy>
+ class Ret_Basic_SArgument_T : public RetArgument
+ {
+ public:
+ Ret_Basic_SArgument_T (void);
+
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ S & arg (void);
+
+ private:
+ S x_;
+ };
+
+ /**
+ * @struct Basic_SArg_Traits_T
+ *
+ * @brief Template class for skeleton argument traits of basic IDL types.
+ *
+ */
+ template<typename T, class Insert_Policy>
+ struct Basic_SArg_Traits_T
+ {
+ typedef T ret_type;
+ typedef T in_type;
+ typedef T & inout_type;
+ typedef T & out_type;
+
+ typedef In_Basic_SArgument_T<T, Insert_Policy> in_arg_val;
+ typedef Inout_Basic_SArgument_T<T, Insert_Policy> inout_arg_val;
+ typedef Out_Basic_SArgument_T<T, Insert_Policy> out_arg_val;
+ typedef Ret_Basic_SArgument_T<T, Insert_Policy> ret_val;
+
+ // Typedefs corresponding to return value of arg() method in both
+ // the client and server side argument class templates.
+ typedef in_type in_arg_type;
+ typedef inout_type inout_arg_type;
+ typedef out_type out_arg_type;
+ typedef out_type ret_arg_type;
+
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+#include "tao/PortableServer/Basic_SArgument_T.inl"
+#endif /* __ACE_INLINE__ */
+
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+#include "tao/PortableServer/Basic_SArgument_T.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
+#pragma implementation ("Basic_SArgument_T.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_BASIC_SARGUMENT_T_H */
diff --git a/TAO/tao/PortableServer/Basic_SArgument_T.inl b/TAO/tao/PortableServer/Basic_SArgument_T.inl
new file mode 100644
index 00000000000..815328650ed
--- /dev/null
+++ b/TAO/tao/PortableServer/Basic_SArgument_T.inl
@@ -0,0 +1,73 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template<typename S,
+ class Insert_Policy>
+ACE_INLINE
+TAO::In_Basic_SArgument_T<S,Insert_Policy>::In_Basic_SArgument_T (void)
+{}
+
+template<typename S,
+ class Insert_Policy>
+ACE_INLINE
+S
+TAO::In_Basic_SArgument_T<S,Insert_Policy>::arg (void) const
+{
+ return this->x_;
+}
+
+// ================================================================
+
+template<typename S,
+ class Insert_Policy>
+ACE_INLINE
+TAO::Inout_Basic_SArgument_T<S,Insert_Policy>::Inout_Basic_SArgument_T (void)
+{}
+
+template<typename S,
+ class Insert_Policy>
+ACE_INLINE
+S &
+TAO::Inout_Basic_SArgument_T<S,Insert_Policy>::arg (void)
+{
+ return this->x_;
+}
+
+// ================================================================
+
+template<typename S,
+ class Insert_Policy>
+ACE_INLINE
+TAO::Out_Basic_SArgument_T<S,Insert_Policy>::Out_Basic_SArgument_T (void)
+{}
+
+template<typename S,
+ class Insert_Policy>
+ACE_INLINE
+S &
+TAO::Out_Basic_SArgument_T<S,Insert_Policy>::arg (void)
+{
+ return this->x_;
+}
+
+// ================================================================
+
+template<typename S,
+ class Insert_Policy>
+ACE_INLINE
+TAO::Ret_Basic_SArgument_T<S,Insert_Policy>::Ret_Basic_SArgument_T (void)
+{}
+
+template<typename S,
+ class Insert_Policy>
+ACE_INLINE
+S &
+TAO::Ret_Basic_SArgument_T<S,Insert_Policy>::arg (void)
+{
+ return this->x_;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/Basic_SArguments.h b/TAO/tao/PortableServer/Basic_SArguments.h
new file mode 100644
index 00000000000..433002d391f
--- /dev/null
+++ b/TAO/tao/PortableServer/Basic_SArguments.h
@@ -0,0 +1,114 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Basic_SArguments.h
+ *
+ * $Id$
+ *
+ * @authors Jeff Parsons and Carlos O'Ryan
+ */
+//=============================================================================
+
+
+#ifndef TAO_BASIC_SARGUMENTS_H
+#define TAO_BASIC_SARGUMENTS_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/Basic_SArgument_T.h"
+#include "tao/PortableServer/SArg_Traits_T.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ /**
+ *
+ * @brief Specialization for void return type.
+ *
+ */
+ template<>
+ class TAO_PortableServer_Export SArg_Traits<void>
+ {
+ public:
+
+ typedef void ret_type;
+ typedef RetArgument ret_val;
+
+ };
+
+ /**
+ *
+ * @brief Specializations for basic skeleton arg types,
+ * except (w)char/boolean/octet.
+ *
+ */
+
+ template<>
+ class TAO_PortableServer_Export SArg_Traits<CORBA::Short>
+ : public Basic_SArg_Traits_T<CORBA::Short, TAO::Any_Insert_Policy_Stream <CORBA::Short> >
+ {
+ };
+
+ template<>
+ class TAO_PortableServer_Export SArg_Traits<CORBA::Long>
+ : public Basic_SArg_Traits_T<CORBA::Long, TAO::Any_Insert_Policy_Stream <CORBA::Long> >
+ {
+ };
+
+ template<>
+ class TAO_PortableServer_Export SArg_Traits<CORBA::UShort>
+ : public Basic_SArg_Traits_T<CORBA::UShort, TAO::Any_Insert_Policy_Stream <CORBA::UShort> >
+ {
+ };
+
+ template<>
+ class TAO_PortableServer_Export SArg_Traits<CORBA::ULong>
+ : public Basic_SArg_Traits_T<CORBA::ULong, TAO::Any_Insert_Policy_Stream <CORBA::ULong> >
+ {
+ };
+
+ template<>
+ class TAO_PortableServer_Export SArg_Traits<CORBA::Float>
+ : public Basic_SArg_Traits_T<CORBA::Float, TAO::Any_Insert_Policy_Stream <CORBA::Float> >
+ {
+ };
+
+ template<>
+ class TAO_PortableServer_Export SArg_Traits<CORBA::Double>
+ : public Basic_SArg_Traits_T<CORBA::Double, TAO::Any_Insert_Policy_Stream <CORBA::Double> >
+ {
+ };
+
+ template<>
+ class TAO_PortableServer_Export SArg_Traits<CORBA::LongLong>
+ : public Basic_SArg_Traits_T<CORBA::LongLong, TAO::Any_Insert_Policy_Stream <CORBA::LongLong> >
+ {
+ };
+
+ template<>
+ class TAO_PortableServer_Export SArg_Traits<CORBA::ULongLong>
+ : public Basic_SArg_Traits_T<CORBA::ULongLong, TAO::Any_Insert_Policy_Stream <CORBA::ULongLong> >
+ {
+ };
+
+ template<>
+ class TAO_PortableServer_Export SArg_Traits<CORBA::LongDouble>
+ : public Basic_SArg_Traits_T<CORBA::LongDouble, TAO::Any_Insert_Policy_Stream <CORBA::LongDouble> >
+ {
+ };
+
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_BASIC_SARGUMENTS_H */
diff --git a/TAO/tao/PortableServer/Collocated_Object_Proxy_Broker.cpp b/TAO/tao/PortableServer/Collocated_Object_Proxy_Broker.cpp
new file mode 100644
index 00000000000..26939a27be7
--- /dev/null
+++ b/TAO/tao/PortableServer/Collocated_Object_Proxy_Broker.cpp
@@ -0,0 +1,330 @@
+//$Id$
+// -- PortableServer Include --
+#include "tao/PortableServer/Collocated_Object_Proxy_Broker.h"
+#include "tao/PortableServer/Object_Adapter.h"
+#include "tao/PortableServer/Servant_Upcall.h"
+#include "tao/PortableServer/Servant_Base.h"
+
+
+// -- TAO Include --
+#include "tao/Stub.h"
+#include "tao/ORB_Core.h"
+#include "tao/Profile.h"
+
+ACE_RCSID (PortableServer,
+ Collocated_Object_Proxy_Broker,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ CORBA::Boolean
+ Collocated_Object_Proxy_Broker::_is_a (CORBA::Object_ptr target,
+ const char *type_id
+ ACE_ENV_ARG_DECL)
+ {
+ TAO_Stub *stub = target->_stubobj ();
+
+ // Which collocation strategy should we use?
+ if (stub != 0 &&
+ stub->servant_orb_var ()->orb_core ()->get_collocation_strategy ()
+ == TAO_ORB_Core::THRU_POA)
+ {
+ TAO::Portable_Server::Servant_Upcall servant_upcall (
+ stub->servant_orb_var ()->orb_core ()
+ );
+
+ CORBA::Object_var forward_to;
+ servant_upcall.prepare_for_upcall (
+ stub->profile_in_use ()->object_key (),
+ "_is_a",
+ forward_to.out ()
+ ACE_ENV_ARG_PARAMETER
+ );
+ ACE_CHECK_RETURN (0);
+
+ servant_upcall.pre_invoke_collocated_request (
+ ACE_ENV_SINGLE_ARG_PARAMETER
+ );
+ ACE_CHECK_RETURN (0);
+
+ return servant_upcall.servant ()->_is_a (type_id
+ ACE_ENV_ARG_PARAMETER);
+ }
+
+ // Direct collocation strategy is used.
+ if (target->_servant () != 0)
+ {
+ return target->_servant ()->_is_a (type_id
+ ACE_ENV_ARG_PARAMETER);
+ }
+
+ return 0;
+ }
+
+#if (TAO_HAS_MINIMUM_CORBA == 0)
+
+ char *
+ Collocated_Object_Proxy_Broker::_repository_id (CORBA::Object_ptr target
+ ACE_ENV_ARG_DECL)
+ {
+ TAO_Stub *stub = target->_stubobj ();
+ char * _tao_retval = 0;
+
+ ACE_TRY
+ {
+ // Which collocation strategy should we use?
+ if (stub != 0 &&
+ stub->servant_orb_var ()->orb_core ()
+ ->get_collocation_strategy () == TAO_ORB_Core::THRU_POA)
+ {
+ TAO::Portable_Server::Servant_Upcall servant_upcall (
+ stub->servant_orb_var ()->orb_core ()
+ );
+
+ CORBA::Object_var forward_to;
+ servant_upcall.prepare_for_upcall (
+ stub->profile_in_use ()->object_key (),
+ "_repository_id",
+ forward_to.out ()
+ ACE_ENV_ARG_PARAMETER
+ );
+ ACE_TRY_CHECK;
+
+ _tao_retval =
+ servant_upcall.servant ()->_repository_id (
+ ACE_ENV_SINGLE_ARG_PARAMETER
+ );
+ ACE_TRY_CHECK;
+ }
+ // Direct collocation strategy is used.
+ else if (target->_servant () != 0)
+ {
+ _tao_retval =
+ target->_servant ()->_repository_id (
+ ACE_ENV_SINGLE_ARG_PARAMETER
+ );
+ ACE_TRY_CHECK;
+ }
+ }
+ ACE_CATCH (CORBA::OBJECT_NOT_EXIST, ex)
+ {
+ // Ignore this exception.
+ }
+ ACE_CATCHANY
+ {
+ ACE_RE_THROW;
+ }
+ ACE_ENDTRY;
+ ACE_CHECK_RETURN (_tao_retval);
+
+ return _tao_retval;
+ }
+
+ CORBA::Boolean
+ Collocated_Object_Proxy_Broker::_non_existent (CORBA::Object_ptr target
+ ACE_ENV_ARG_DECL)
+ {
+ CORBA::Boolean _tao_retval = true;
+
+ TAO_Stub *stub = target->_stubobj ();
+
+ // Which collocation strategy should we use?
+ if (stub != 0 &&
+ stub->servant_orb_var ()->orb_core ()
+ ->get_collocation_strategy () == TAO_ORB_Core::THRU_POA)
+ {
+ TAO::Portable_Server::Servant_Upcall servant_upcall (
+ target->_stubobj ()->servant_orb_var ()->orb_core ()
+ );
+
+ CORBA::Object_var forward_to;
+
+ servant_upcall.prepare_for_upcall (
+ target->_stubobj ()->object_key (),
+ "_non_existent",
+ forward_to.out ()
+ ACE_ENV_ARG_PARAMETER
+ );
+ ACE_CHECK_RETURN (_tao_retval);
+
+ servant_upcall.pre_invoke_collocated_request (
+ ACE_ENV_SINGLE_ARG_PARAMETER
+ );
+ ACE_CHECK_RETURN (_tao_retval);
+
+ _tao_retval =
+ servant_upcall.servant ()->_non_existent (
+ ACE_ENV_SINGLE_ARG_PARAMETER
+ );
+ ACE_CHECK_RETURN (_tao_retval);
+ }
+ // Direct collocation strategy is used.
+ else if (target->_servant () != 0)
+ {
+ _tao_retval =
+ target->_servant ()->_non_existent (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (_tao_retval);
+ }
+
+ return _tao_retval;
+ }
+
+ CORBA::Object_ptr
+ Collocated_Object_Proxy_Broker::_get_component (CORBA::Object_ptr target
+ ACE_ENV_ARG_DECL)
+ {
+ CORBA::Object_var _tao_retval (CORBA::Object::_nil ());
+
+ TAO_Stub *stub = target->_stubobj ();
+
+ ACE_TRY
+ {
+ // Which collocation strategy should we use?
+ if (stub != 0 &&
+ stub->servant_orb_var ()->orb_core ()
+ ->get_collocation_strategy () == TAO_ORB_Core::THRU_POA)
+ {
+ TAO::Portable_Server::Servant_Upcall servant_upcall (
+ stub->servant_orb_var ()->orb_core ()
+ );
+
+ CORBA::Object_var forward_to;
+ servant_upcall.prepare_for_upcall (
+ stub->profile_in_use ()->object_key (),
+ "_component",
+ forward_to.out ()
+ ACE_ENV_ARG_PARAMETER
+ );
+ ACE_TRY_CHECK;
+
+ _tao_retval =
+ servant_upcall.servant ()->_get_component (
+ ACE_ENV_SINGLE_ARG_PARAMETER
+ );
+ ACE_TRY_CHECK;
+ }
+ // Direct collocation strategy is used.
+ else if (target->_servant () != 0)
+ {
+ _tao_retval =
+ target->_servant ()->_get_component (
+ ACE_ENV_SINGLE_ARG_PARAMETER
+ );
+ ACE_TRY_CHECK;
+ }
+ }
+ ACE_CATCH (CORBA::OBJECT_NOT_EXIST, ex)
+ {
+ // Ignore this exception.
+ }
+ ACE_CATCHANY
+ {
+ ACE_RE_THROW;
+ }
+ ACE_ENDTRY;
+ ACE_CHECK_RETURN (_tao_retval._retn ());
+
+ return _tao_retval._retn ();
+ }
+
+ CORBA::InterfaceDef_ptr
+ Collocated_Object_Proxy_Broker::_get_interface (
+ CORBA::Object_ptr target
+ ACE_ENV_ARG_DECL)
+ {
+ CORBA::InterfaceDef_ptr _tao_retval = 0;
+
+ TAO_Stub *stub = target->_stubobj ();
+
+ ACE_TRY
+ {
+ // Which collocation strategy should we use?
+ if (stub != 0 &&
+ stub->servant_orb_var ()->orb_core ()->get_collocation_strategy ()
+ == TAO_ORB_Core::THRU_POA)
+ {
+ TAO::Portable_Server::Servant_Upcall servant_upcall (
+ target->_stubobj ()->servant_orb_var ()->orb_core ()
+ );
+
+ CORBA::Object_var forward_to;
+
+ servant_upcall.prepare_for_upcall (
+ target->_stubobj ()->object_key (),
+ "_interface",
+ forward_to.out ()
+ ACE_ENV_ARG_PARAMETER
+ );
+ ACE_TRY_CHECK;
+
+ servant_upcall.pre_invoke_collocated_request (
+ ACE_ENV_SINGLE_ARG_PARAMETER
+ );
+ ACE_TRY_CHECK;
+
+ _tao_retval =
+ servant_upcall.servant ()->_get_interface (
+ ACE_ENV_SINGLE_ARG_PARAMETER
+ );
+ ACE_TRY_CHECK;
+ }
+ // Direct collocation strategy is used.
+ else if (target->_servant () != 0)
+ {
+ _tao_retval =
+ target->_servant ()->_get_interface (
+ ACE_ENV_SINGLE_ARG_PARAMETER
+ );
+ ACE_TRY_CHECK;
+ }
+ }
+ ACE_CATCH (CORBA::OBJECT_NOT_EXIST, ex)
+ {
+ // Ignore this exception.
+ }
+ ACE_CATCHANY
+ {
+ ACE_RE_THROW;
+ }
+ ACE_ENDTRY;
+ ACE_CHECK_RETURN (_tao_retval);
+
+ return _tao_retval;
+ }
+
+#endif /* TAO_HAS_MINIMUM_CORBA == 0 */
+
+}
+
+// -----------------------------------------------------
+TAO::Collocated_Object_Proxy_Broker *
+the_tao_collocated_object_proxy_broker (void)
+{
+ static TAO::Collocated_Object_Proxy_Broker the_broker;
+ return &the_broker;
+}
+
+TAO::Object_Proxy_Broker * _TAO_collocation_Object_Proxy_Broker_Factory (void)
+{
+ return the_tao_collocated_object_proxy_broker ();
+}
+
+int
+_TAO_collocation_Object_Proxy_Broker_Factory_Initializer (size_t)
+{
+ _TAO_Object_Proxy_Broker_Factory_function_pointer =
+ _TAO_collocation_Object_Proxy_Broker_Factory;
+
+ return 0;
+}
+
+static int
+_TAO_collocation_Object_Proxy_Broker_Factory_Initializer_Scarecrow =
+_TAO_collocation_Object_Proxy_Broker_Factory_Initializer (
+ reinterpret_cast<size_t> (_TAO_collocation_Object_Proxy_Broker_Factory_Initializer
+ )
+ );
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/Collocated_Object_Proxy_Broker.h b/TAO/tao/PortableServer/Collocated_Object_Proxy_Broker.h
new file mode 100644
index 00000000000..cd28b880933
--- /dev/null
+++ b/TAO/tao/PortableServer/Collocated_Object_Proxy_Broker.h
@@ -0,0 +1,82 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Collocated_Object_Proxy_Broker.h
+ *
+ * $Id$
+ *
+ * This files contains the Collocated Proxy Broker implementation
+ * for the CORBA Object.
+ *
+ * @author Angelo Corsaro <corsaro@cs.wustl.edu>
+ * @author Balachandran Natarajan (modified the implementation)
+ */
+//=============================================================================
+
+#ifndef TAO_COLLOCATED_OBJECT_PROXY_BROKER_H
+#define TAO_COLLOCATED_OBJECT_PROXY_BROKER_H
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Object_Proxy_Broker.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ /**
+ * @class Collocated_Object_Proxy_Broker
+ *
+ * @brief Collocated_Object_Proxy_Broker
+ *
+ * A broker for standard CORBA::Object calls that needs to be made
+ * on remote objects.
+ */
+ class TAO_PortableServer_Export Collocated_Object_Proxy_Broker
+ : public Object_Proxy_Broker
+ {
+ public:
+ /// Please see the documentation in Object_Proxy_Broker.h for
+ /// details.
+ virtual CORBA::Boolean _is_a (CORBA::Object_ptr target,
+ const char *logical_type_id
+ ACE_ENV_ARG_DECL);
+
+#if (TAO_HAS_MINIMUM_CORBA == 0)
+
+ virtual CORBA::Boolean _non_existent (CORBA::Object_ptr target
+ ACE_ENV_ARG_DECL);
+
+ virtual CORBA::InterfaceDef * _get_interface (
+ CORBA::Object_ptr target
+ ACE_ENV_ARG_DECL
+ );
+
+ virtual CORBA::Object_ptr _get_component (CORBA::Object_ptr target
+ ACE_ENV_ARG_DECL);
+
+ virtual char * _repository_id (CORBA::Object_ptr target
+ ACE_ENV_ARG_DECL);
+
+#endif /* TAO_HAS_MINIMUM_CORBA == 0 */
+
+ };
+}
+
+// -----------------------------------------------------
+
+/// This function is used to access the unique instance of strategized
+/// proxy broker. All the CORBA::Object share the proxy broker.
+TAO::Collocated_Object_Proxy_Broker *the_tao_collocated_object_proxy_broker (void);
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_COLLOCATED_OBJECT_PROXY_BROKER_H*/
diff --git a/TAO/tao/PortableServer/Creation_Time.cpp b/TAO/tao/PortableServer/Creation_Time.cpp
new file mode 100644
index 00000000000..0156db0dec3
--- /dev/null
+++ b/TAO/tao/PortableServer/Creation_Time.cpp
@@ -0,0 +1,10 @@
+#include "tao/PortableServer/Creation_Time.h"
+
+ACE_RCSID (PortableServer,
+ Creation_Time,
+ "$Id$")
+
+#if !defined (__ACE_INLINE__)
+# include "tao/PortableServer/Creation_Time.inl"
+#endif /* ! __ACE_INLINE__ */
+
diff --git a/TAO/tao/PortableServer/Creation_Time.h b/TAO/tao/PortableServer/Creation_Time.h
new file mode 100644
index 00000000000..5fb58f93e72
--- /dev/null
+++ b/TAO/tao/PortableServer/Creation_Time.h
@@ -0,0 +1,104 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Creation_Time.h
+ *
+ * $Id$
+ *
+ * Header file for Creation_Time and Temporary_Creation_Time
+ *
+ * @author Irfan Pyarali <irfan@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_CREATION_TIME_H
+#define TAO_CREATION_TIME_H
+
+#include /**/ "ace/pre.h"
+
+#include "ace/Time_Value.h"
+#include "tao/Basic_Types.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ class Temporary_Creation_Time;
+
+ class Creation_Time
+ {
+ public:
+ explicit Creation_Time (const ACE_Time_Value &creation_time);
+
+ Creation_Time (void);
+
+ void creation_time (const void *creation_time);
+
+ const void *creation_time (void) const;
+
+ static CORBA::ULong creation_time_length (void);
+
+ bool operator== (const Creation_Time &rhs) const;
+
+ bool operator!= (const Creation_Time &rhs) const;
+
+ bool operator== (const Temporary_Creation_Time &rhs) const;
+
+ bool operator!= (const Temporary_Creation_Time &rhs) const;
+
+ protected:
+
+ enum
+ {
+ SEC_FIELD = 0,
+ USEC_FIELD = 1
+ };
+
+ /// Timestamp
+ CORBA::ULong time_stamp_[2];
+
+ };
+
+ /**
+ * @class Temporary_Creation_Time
+ *
+ * @brief Special creation time only useful in the lifetime of the
+ * upcall.
+ *
+ * Special creation time only useful in the lifetime of the upcall.
+ */
+ class Temporary_Creation_Time
+ {
+ public:
+
+ Temporary_Creation_Time (void);
+
+ void creation_time (const void *creation_time);
+
+ bool operator== (const Creation_Time &rhs) const;
+
+ bool operator!= (const Creation_Time &rhs) const;
+
+ protected:
+
+ void *time_stamp_;
+ };
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/PortableServer/Creation_Time.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_CREATION_TIME_H */
diff --git a/TAO/tao/PortableServer/Creation_Time.inl b/TAO/tao/PortableServer/Creation_Time.inl
new file mode 100644
index 00000000000..f629b10e91b
--- /dev/null
+++ b/TAO/tao/PortableServer/Creation_Time.inl
@@ -0,0 +1,126 @@
+// -*- C++ -*-
+//
+// $Id$
+
+#include "tao/orbconf.h" /* For POA_NO_TIMESTAMP definition. */
+#include "ace/OS_NS_string.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ ACE_INLINE CORBA::ULong
+ Creation_Time::creation_time_length (void)
+ {
+ return 2 * sizeof (CORBA::ULong);
+ }
+
+ ACE_INLINE
+ Creation_Time::Creation_Time (const ACE_Time_Value &creation_time)
+ {
+ this->time_stamp_[Creation_Time::SEC_FIELD] = (CORBA::ULong) creation_time.sec ();
+ this->time_stamp_[Creation_Time::USEC_FIELD] = (CORBA::ULong) creation_time.usec ();
+ }
+
+ ACE_INLINE
+ Creation_Time::Creation_Time (void)
+ {
+ this->time_stamp_[Creation_Time::SEC_FIELD] = 0;
+ this->time_stamp_[Creation_Time::USEC_FIELD] = 0;
+ }
+
+ ACE_INLINE void
+ Creation_Time::creation_time (const void *creation_time)
+ {
+ ACE_OS::memcpy (&this->time_stamp_,
+ creation_time,
+ Creation_Time::creation_time_length ());
+ }
+
+ ACE_INLINE const void *
+ Creation_Time::creation_time (void) const
+ {
+ return &this->time_stamp_;
+ }
+
+ ACE_INLINE bool
+ Creation_Time::operator== (const Creation_Time &rhs) const
+ {
+ #if (POA_NO_TIMESTAMP == 1)
+ ACE_UNUSED_ARG (rhs);
+ return true;
+ #else
+ return ACE_OS::memcmp (&this->time_stamp_,
+ &rhs.time_stamp_,
+ Creation_Time::creation_time_length ()) == 0;
+ #endif /* POA_NO_TIMESTAMP */
+ }
+
+ ACE_INLINE bool
+ Creation_Time::operator!= (const Creation_Time &rhs) const
+ {
+ #if (POA_NO_TIMESTAMP == 1)
+ ACE_UNUSED_ARG (rhs);
+ return false;
+ #else
+ return ACE_OS::memcmp (&this->time_stamp_,
+ &rhs.time_stamp_,
+ Creation_Time::creation_time_length ()) != 0;
+ #endif /* POA_NO_TIMESTAMP */
+ }
+
+ ACE_INLINE bool
+ Temporary_Creation_Time::operator== (const Creation_Time &rhs) const
+ {
+ #if (POA_NO_TIMESTAMP == 1)
+ ACE_UNUSED_ARG (rhs);
+ return true;
+ #else
+ return ACE_OS::memcmp (this->time_stamp_,
+ rhs.creation_time (),
+ Creation_Time::creation_time_length ()) == 0;
+ #endif /* POA_NO_TIMESTAMP */
+ }
+
+ ACE_INLINE bool
+ Temporary_Creation_Time::operator!= (const Creation_Time &rhs) const
+ {
+ #if (POA_NO_TIMESTAMP == 1)
+ ACE_UNUSED_ARG (rhs);
+ return false;
+ #else
+ return ACE_OS::memcmp (this->time_stamp_,
+ rhs.creation_time (),
+ Creation_Time::creation_time_length ()) != 0;
+ #endif /* POA_NO_TIMESTAMP */
+ }
+
+ ACE_INLINE bool
+ Creation_Time::operator== (const Temporary_Creation_Time &rhs) const
+ {
+ return rhs == *this;
+ }
+
+ ACE_INLINE bool
+ Creation_Time::operator!= (const Temporary_Creation_Time &rhs) const
+ {
+ return rhs != *this;
+ }
+
+ ACE_INLINE
+ Temporary_Creation_Time::Temporary_Creation_Time (void)
+ : time_stamp_ (0)
+ {
+ }
+
+ ACE_INLINE void
+ Temporary_Creation_Time::creation_time (const void *creation_time)
+ {
+ this->time_stamp_ = (void *) creation_time;
+ }
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/Default_Acceptor_Filter.cpp b/TAO/tao/PortableServer/Default_Acceptor_Filter.cpp
new file mode 100644
index 00000000000..40177f90b27
--- /dev/null
+++ b/TAO/tao/PortableServer/Default_Acceptor_Filter.cpp
@@ -0,0 +1,58 @@
+// @(#) $Id$
+
+#include "tao/PortableServer/Default_Acceptor_Filter.h"
+#include "tao/Transport_Acceptor.h"
+#include "tao/MProfile.h"
+#include "tao/Profile.h"
+
+ACE_RCSID(PortableServer,
+ Default_Acceptor_Filter,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Default_Acceptor_Filter::TAO_Default_Acceptor_Filter (void)
+{
+}
+
+int
+TAO_Default_Acceptor_Filter::fill_profile (const TAO::ObjectKey &object_key,
+ TAO_MProfile &mprofile,
+ TAO_Acceptor **acceptors_begin,
+ TAO_Acceptor **acceptors_end,
+ CORBA::Short priority)
+{
+ // Go through all the acceptors.
+ for (TAO_Acceptor** acceptor = acceptors_begin;
+ acceptor != acceptors_end;
+ ++acceptor)
+ {
+ // Ask each acceptor to make a profile.
+ if ((*acceptor)->create_profile (object_key,
+ mprofile,
+ priority) == -1)
+ return -1;
+ }
+
+ return 0;
+}
+
+int
+TAO_Default_Acceptor_Filter::encode_endpoints (TAO_MProfile &mprofile)
+{
+ // if -ORBUseSharedProfile is set, there may be multiple endpoints
+ // per profile, even without priority.
+ for (CORBA::ULong i = 0;
+ i < mprofile.profile_count ();
+ ++i)
+ {
+ TAO_Profile *profile = mprofile.get_profile (i);
+ if (profile->encode_alternate_endpoints () == -1)
+ return -1;
+ }
+
+ return 0;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/Default_Acceptor_Filter.h b/TAO/tao/PortableServer/Default_Acceptor_Filter.h
new file mode 100644
index 00000000000..3b1bca11b17
--- /dev/null
+++ b/TAO/tao/PortableServer/Default_Acceptor_Filter.h
@@ -0,0 +1,64 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Default_Acceptor_Filter.h
+ *
+ * $Id$
+ *
+ * Default strategy for populating mprofile
+ *
+ * @author Marina Spivak <marina@cs.wustl.edu>
+ * @author Carlos O'Ryan <coryan@uci.edu>
+ */
+//=============================================================================
+
+
+#ifndef TAO_DEFAULT_ACCEPTOR_FILTER_H
+#define TAO_DEFAULT_ACCEPTOR_FILTER_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Acceptor_Filter.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Acceptor;
+
+/**
+ * @class TAO_Default_Acceptor_Filter
+ *
+ * @brief Default Acceptor_Filter.
+ *
+ * Default strategy for populating mprofile: all available
+ * endpoints are included.
+ */
+class TAO_PortableServer_Export TAO_Default_Acceptor_Filter
+ : public TAO_Acceptor_Filter
+{
+public:
+ TAO_Default_Acceptor_Filter (void);
+
+ /// Populate @a mprofile with all available endpoints.
+ virtual int fill_profile (const TAO::ObjectKey &object_key,
+ TAO_MProfile &mprofile,
+ TAO_Acceptor **acceptors_begin,
+ TAO_Acceptor **acceptors_end,
+ CORBA::Short priority = TAO_INVALID_PRIORITY);
+
+ /// Encodes the endpoints in the profiles into the TAO_TAG_ENDPOINTS
+ /// tag component of profiles.
+ int encode_endpoints (TAO_MProfile &mprofile);
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_DEFAULT_ACCEPTOR_FILTER_H */
diff --git a/TAO/tao/PortableServer/Default_Policy_Validator.cpp b/TAO/tao/PortableServer/Default_Policy_Validator.cpp
new file mode 100644
index 00000000000..8152f2fb385
--- /dev/null
+++ b/TAO/tao/PortableServer/Default_Policy_Validator.cpp
@@ -0,0 +1,157 @@
+// $Id$
+
+#include "tao/PortableServer/Default_Policy_Validator.h"
+#include "tao/ORB_Core.h"
+#include "tao/Policy_Set.h"
+#include "tao/PolicyFactory_Registry_Adapter.h"
+#include "tao/PortableServer/PortableServer.h"
+
+ACE_RCSID (PortableServer,
+ Default_Policy_Validator,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_POA_Default_Policy_Validator::TAO_POA_Default_Policy_Validator (
+ TAO_ORB_Core &orb_core)
+ : TAO_Policy_Validator (orb_core)
+{
+}
+
+TAO_POA_Default_Policy_Validator::~TAO_POA_Default_Policy_Validator (void)
+{
+}
+
+void
+TAO_POA_Default_Policy_Validator::validate_impl (TAO_Policy_Set &policies
+ ACE_ENV_ARG_DECL)
+{
+#if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
+ CORBA::Policy_var policy =
+ policies.get_cached_policy (TAO_CACHED_POLICY_SERVANT_RETENTION
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ PortableServer::ServantRetentionPolicy_var srp =
+ PortableServer::ServantRetentionPolicy::_narrow (policy.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ PortableServer::ServantRetentionPolicyValue servant_retention =
+ srp->value (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ policy =
+ policies.get_cached_policy (TAO_CACHED_POLICY_REQUEST_PROCESSING
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ PortableServer::RequestProcessingPolicy_var rpp =
+ PortableServer::RequestProcessingPolicy::_narrow (policy.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ PortableServer::RequestProcessingPolicyValue request_processing =
+ rpp->value (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // The NON_RETAIN policy requires either the USE_DEFAULT_SERVANT or
+ // USE_SERVANT_MANAGER policies.
+ if (servant_retention == PortableServer::NON_RETAIN)
+ if (request_processing != PortableServer::USE_SERVANT_MANAGER &&
+ request_processing != PortableServer::USE_DEFAULT_SERVANT)
+ ACE_THROW (PortableServer::POA::InvalidPolicy ());
+
+ // USE_ACTIVE_OBJECT_MAP_ONLY requires the RETAIN policy.
+ if (request_processing == PortableServer::USE_ACTIVE_OBJECT_MAP_ONLY)
+ if (servant_retention != PortableServer::RETAIN)
+ ACE_THROW (PortableServer::POA::InvalidPolicy ());
+
+ policy =
+ policies.get_cached_policy (TAO_CACHED_POLICY_ID_UNIQUENESS
+ ACE_ENV_ARG_PARAMETER);
+
+ ACE_CHECK;
+
+ PortableServer::IdUniquenessPolicy_var iup =
+ PortableServer::IdUniquenessPolicy::_narrow (policy.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ PortableServer::IdUniquenessPolicyValue id_uniqueness =
+ iup->value (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ policy =
+ policies.get_cached_policy (TAO_CACHED_POLICY_IMPLICIT_ACTIVATION
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ PortableServer::ImplicitActivationPolicy_var iap =
+ PortableServer::ImplicitActivationPolicy::_narrow (policy.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ PortableServer::ImplicitActivationPolicyValue implicit_activation =
+ iap->value (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ policy =
+ policies.get_cached_policy (TAO_CACHED_POLICY_ID_ASSIGNMENT
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ PortableServer::IdAssignmentPolicy_var idap =
+ PortableServer::IdAssignmentPolicy::_narrow (policy.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ PortableServer::IdAssignmentPolicyValue id_assignment =
+ idap->value (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // USE_DEFAULT_SERVANT requires the MULTIPLE_ID policy.
+ if (request_processing == PortableServer::USE_DEFAULT_SERVANT)
+ if (id_uniqueness != PortableServer::MULTIPLE_ID)
+ ACE_THROW (PortableServer::POA::InvalidPolicy ());
+
+ // IMPLICIT_ACTIVATION requires the SYSTEM_ID and RETAIN policies.
+ if (implicit_activation == PortableServer::IMPLICIT_ACTIVATION)
+ if (servant_retention != PortableServer::RETAIN ||
+ id_assignment != PortableServer::SYSTEM_ID)
+ ACE_THROW (PortableServer::POA::InvalidPolicy ());
+#else /* TAO_HAS_MINIMUM_POA == 0 */
+ ACE_UNUSED_ARG (policies);
+ ACE_ENV_ARG_NOT_USED; // FUZZ: ignore check_for_ace_check
+#endif /* TAO_HAS_MINIMUM_POA == 0 */
+}
+
+CORBA::Boolean
+TAO_POA_Default_Policy_Validator::legal_policy_impl (CORBA::PolicyType type)
+{
+ // Check known POA policies, or if given PolicyType has a
+ // corresponding PolicyFactory. The PolicyFactory check is mandated
+ // by the CORBA specification.
+ return
+ (
+# if ! defined (CORBA_E_COMPACT) && ! defined (CORBA_E_MICRO)
+ type == PortableServer::THREAD_POLICY_ID ||
+# endif
+# if ! defined (CORBA_E_MICRO)
+ type == PortableServer::LIFESPAN_POLICY_ID ||
+ type == PortableServer::ID_UNIQUENESS_POLICY_ID ||
+ type == PortableServer::ID_ASSIGNMENT_POLICY_ID ||
+# endif
+# if ! defined (CORBA_E_COMPACT) && ! defined (CORBA_E_MICRO)
+ type == PortableServer::IMPLICIT_ACTIVATION_POLICY_ID ||
+ type == PortableServer::SERVANT_RETENTION_POLICY_ID ||
+ type == PortableServer::REQUEST_PROCESSING_POLICY_ID ||
+# endif
+ (this->orb_core_.policy_factory_registry () != 0 &&
+ this->orb_core_.policy_factory_registry ()->factory_exists (type)));
+}
+
+void
+TAO_POA_Default_Policy_Validator::merge_policies_impl (
+ TAO_Policy_Set &
+ ACE_ENV_ARG_DECL_NOT_USED)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/Default_Policy_Validator.h b/TAO/tao/PortableServer/Default_Policy_Validator.h
new file mode 100644
index 00000000000..ce099b9d402
--- /dev/null
+++ b/TAO/tao/PortableServer/Default_Policy_Validator.h
@@ -0,0 +1,68 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Default_Policy_Validator.h
+ *
+ * $Id$
+ *
+ * This file contains the declaration for the default POA policy validator.
+ *
+ * @author Angelo Corsaro <corsaro@cs.wustl.edu>
+ * @author Frank Hunleth <fhuntleth@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_DEFAULT_POLICY_VALIDATOR_H_
+#define TAO_DEFAULT_POLICY_VALIDATOR_H_
+
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Policy_Validator.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_PortableServer_Export TAO_POA_Default_Policy_Validator
+ : public TAO_Policy_Validator
+{
+public:
+
+ /// Constructor.
+ TAO_POA_Default_Policy_Validator (TAO_ORB_Core &orb_core);
+
+ /// Destructor.
+ ~TAO_POA_Default_Policy_Validator (void);
+
+protected:
+ /**
+ * Validate that the policies in the specified set
+ * are consistent and legal. Throw an appropriate exception
+ * if that is not the case.
+ */
+ void validate_impl (TAO_Policy_Set &policies
+ ACE_ENV_ARG_DECL);
+
+ /// Add/merge policies.
+ void merge_policies_impl (TAO_Policy_Set &policies
+ ACE_ENV_ARG_DECL);
+
+ /**
+ * Return whether the specified policy type is legal for the
+ * current configuration. This is needed since the user can
+ * potentially specify policies that are unknown to an
+ * validate () routine, and these need to be caught.
+ */
+ virtual CORBA::Boolean legal_policy_impl (CORBA::PolicyType type);
+
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_DEFAULT_POLICY_VALIDATOR_H_ */
diff --git a/TAO/tao/PortableServer/Default_Servant_Dispatcher.cpp b/TAO/tao/PortableServer/Default_Servant_Dispatcher.cpp
new file mode 100644
index 00000000000..d964a4d4f90
--- /dev/null
+++ b/TAO/tao/PortableServer/Default_Servant_Dispatcher.cpp
@@ -0,0 +1,69 @@
+// $Id$
+
+#include "tao/PortableServer/Default_Servant_Dispatcher.h"
+#include "tao/PortableServer/Root_POA.h"
+
+ACE_RCSID(PortableServer,
+ Default_Servant_Dispatcher,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Default_Servant_Dispatcher::~TAO_Default_Servant_Dispatcher (void)
+{
+}
+
+TAO_Root_POA *
+TAO_Default_Servant_Dispatcher::create_Root_POA (const ACE_CString &name,
+ PortableServer::POAManager_ptr poa_manager,
+ const TAO_POA_Policy_Set &policies,
+ ACE_Lock &lock,
+ TAO_SYNCH_MUTEX &thread_lock,
+ TAO_ORB_Core &orb_core,
+ TAO_Object_Adapter *object_adapter
+ ACE_ENV_ARG_DECL)
+{
+ TAO_Root_POA *poa = 0;
+
+ ACE_NEW_THROW_EX (poa,
+ TAO_Root_POA (name,
+ poa_manager,
+ policies,
+ 0,
+ lock,
+ thread_lock,
+ orb_core,
+ object_adapter
+ ACE_ENV_ARG_PARAMETER), CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (0);
+
+ return poa;
+}
+
+void
+TAO_Default_Servant_Dispatcher::pre_invoke_remote_request (
+ TAO_Root_POA &,
+ CORBA::Short,
+ TAO_ServerRequest &,
+ TAO::Portable_Server::Servant_Upcall::Pre_Invoke_State &
+ ACE_ENV_ARG_DECL_NOT_USED)
+{
+}
+
+void
+TAO_Default_Servant_Dispatcher::pre_invoke_collocated_request (
+ TAO_Root_POA &,
+ CORBA::Short,
+ TAO::Portable_Server::Servant_Upcall::Pre_Invoke_State &
+ ACE_ENV_ARG_DECL_NOT_USED)
+{
+}
+
+void
+TAO_Default_Servant_Dispatcher::post_invoke (
+ TAO_Root_POA &,
+ TAO::Portable_Server::Servant_Upcall::Pre_Invoke_State &)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/Default_Servant_Dispatcher.h b/TAO/tao/PortableServer/Default_Servant_Dispatcher.h
new file mode 100644
index 00000000000..e5f5f2b71db
--- /dev/null
+++ b/TAO/tao/PortableServer/Default_Servant_Dispatcher.h
@@ -0,0 +1,77 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Default_Servant_Dispatcher.h
+ *
+ * $Id$
+ *
+ * @author Frank Hunleth (fhunleth@cs.wustl.edu)
+ */
+//=============================================================================
+
+#ifndef TAO_DEFAULT_SERVANT_DISPATCHER_H
+#define TAO_DEFAULT_SERVANT_DISPATCHER_H
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/Servant_Dispatcher.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_Default_Servant_Dispatcher
+ *
+ * @brief Concrete instantiation of the Servant_Dispatcher strategy.
+ *
+ * This class just calls _dispatch on the servant_upcall. No extra
+ * processing is done or needed.
+ *
+ */
+class TAO_PortableServer_Export TAO_Default_Servant_Dispatcher
+ : public TAO_Servant_Dispatcher
+{
+public:
+ virtual ~TAO_Default_Servant_Dispatcher (void);
+
+ /// Pre_invoke remote request.
+ void pre_invoke_remote_request (
+ TAO_Root_POA &poa,
+ CORBA::Short servant_priority,
+ TAO_ServerRequest &req,
+ TAO::Portable_Server::Servant_Upcall::Pre_Invoke_State &pre_invoke_state
+ ACE_ENV_ARG_DECL);
+
+ /// Pre_invoke collocated request.
+ void pre_invoke_collocated_request (
+ TAO_Root_POA &poa,
+ CORBA::Short servant_priority,
+ TAO::Portable_Server::Servant_Upcall::Pre_Invoke_State &pre_invoke_state
+ ACE_ENV_ARG_DECL);
+
+ /// Post_invoke request.
+ void post_invoke (
+ TAO_Root_POA &poa,
+ TAO::Portable_Server::Servant_Upcall::Pre_Invoke_State &pre_invoke_state);
+
+ /// Factory method for creating new POA's.
+ TAO_Root_POA *create_Root_POA (
+ const ACE_CString &name,
+ PortableServer::POAManager_ptr poa_manager,
+ const TAO_POA_Policy_Set &policies,
+ ACE_Lock &lock,
+ TAO_SYNCH_MUTEX &thread_lock,
+ TAO_ORB_Core &orb_core,
+ TAO_Object_Adapter *object_adapter
+ ACE_ENV_ARG_DECL);
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_DEFAULT_SERVANT_DISPATCHER_H */
diff --git a/TAO/tao/PortableServer/Direct_Collocation_Upcall_Wrapper.cpp b/TAO/tao/PortableServer/Direct_Collocation_Upcall_Wrapper.cpp
new file mode 100644
index 00000000000..d7ce947dbae
--- /dev/null
+++ b/TAO/tao/PortableServer/Direct_Collocation_Upcall_Wrapper.cpp
@@ -0,0 +1,73 @@
+// $Id$
+
+#include "tao/PortableServer/Direct_Collocation_Upcall_Wrapper.h"
+
+#if (TAO_HAS_MINIMUM_CORBA == 0)
+# include "tao/PortableServer/ForwardRequestC.h"
+#endif /* TAO_HAS_MINIMUM_CORBA == 0 */
+
+#include "tao/Abstract_Servant_Base.h"
+#include "tao/SystemException.h"
+#include "tao/ORB_Constants.h"
+#include "tao/Object.h"
+#include "tao/Environment.h"
+
+ACE_RCSID (PortableServer,
+ Direct_Collocation_Upcall_Wrapper,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+void
+TAO::Direct_Collocation_Upcall_Wrapper::upcall (
+ CORBA::Object_ptr obj,
+ CORBA::Object_out forward_obj,
+ TAO::Argument ** args,
+ int num_args,
+ const char * op,
+ size_t op_len,
+ TAO::Collocation_Strategy strategy
+ ACE_ENV_ARG_DECL
+)
+ACE_THROW_SPEC ((CORBA::Exception))
+{
+ TAO_Abstract_ServantBase * const servant = obj->_servant ();
+
+ TAO_Collocated_Skeleton collocated_skel;
+ int const status = servant->_find (op,
+ collocated_skel,
+ strategy,
+ op_len);
+
+ if (status == -1)
+ {
+ ACE_THROW (CORBA::BAD_OPERATION (CORBA::OMGVMCID | 2, CORBA::COMPLETED_NO));
+ }
+
+ ACE_TRY
+ {
+ collocated_skel (servant,
+ args,
+ num_args
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+#if (TAO_HAS_MINIMUM_CORBA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
+ ACE_CATCH (PortableServer::ForwardRequest, forward_request)
+ {
+ forward_obj =
+ CORBA::Object::_duplicate (forward_request.forward_reference.in ());
+ return;
+ }
+#else
+ ACE_CATCHANY
+ {
+ ACE_UNUSED_ARG (forward_obj);
+ ACE_RE_THROW;
+ }
+#endif /* TAO_HAS_MINIMUM_CORBA && !CORBA_E_COMPACT && !CORBA_E_MICRO*/
+ ACE_ENDTRY;
+ ACE_CHECK;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/Direct_Collocation_Upcall_Wrapper.h b/TAO/tao/PortableServer/Direct_Collocation_Upcall_Wrapper.h
new file mode 100644
index 00000000000..edc4c39f479
--- /dev/null
+++ b/TAO/tao/PortableServer/Direct_Collocation_Upcall_Wrapper.h
@@ -0,0 +1,78 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Direct_Collocation_Upcall_Wrapper.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen
+ */
+//=============================================================================
+
+#ifndef TAO_DIRECT_COLLOCATION_UPCALL_WRAPPER_H
+#define TAO_DIRECT_COLLOCATION_UPCALL_WRAPPER_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#ifndef ACE_LACKS_PRAGMA_ONCE
+# pragma once
+#endif /* !ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Basic_Types.h"
+#include "tao/orbconf.h"
+#include "tao/Collocation_Strategy.h"
+#include "tao/Exception.h"
+#include "tao/CORBA_methods.h"
+#include "tao/Pseudo_VarOut_T.h"
+#include "ace/CORBA_macros.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace CORBA
+{
+ class Environment;
+
+ class Object;
+ typedef Object *Object_ptr;
+ typedef TAO_Pseudo_Var_T<Object> Object_var;
+ typedef TAO_Pseudo_Out_T<Object> Object_out;
+}
+
+namespace TAO
+{
+ class Argument;
+
+ /**
+ * @class Direct_Collocation_Upcall_Wrapper
+ *
+ * @brief Wraps the activities direct collocation upcall
+ *
+ */
+ class TAO_PortableServer_Export Direct_Collocation_Upcall_Wrapper
+ {
+ public:
+
+ /// Perform the upcall
+ void upcall (
+ CORBA::Object_ptr obj,
+ CORBA::Object_out forward_obj,
+ TAO::Argument ** args,
+ int num_args,
+ const char * op,
+ size_t op_len,
+ TAO::Collocation_Strategy strategy
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::Exception));
+ };
+
+} // End namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_DIRECT_COLLOCATION_UPCALL_WRAPPER_H */
diff --git a/TAO/tao/PortableServer/Fixed_Array_SArgument_T.cpp b/TAO/tao/PortableServer/Fixed_Array_SArgument_T.cpp
new file mode 100644
index 00000000000..fd989f3ebf9
--- /dev/null
+++ b/TAO/tao/PortableServer/Fixed_Array_SArgument_T.cpp
@@ -0,0 +1,132 @@
+// $Id$
+
+#ifndef TAO_FIXED_ARRAY_SARGUMENT_T_CPP
+#define TAO_FIXED_ARRAY_SARGUMENT_T_CPP
+
+#include "tao/PortableServer/Fixed_Array_SArgument_T.h"
+
+#if !defined (__ACE_INLINE__)
+#include "tao/PortableServer/Fixed_Array_SArgument_T.inl"
+#endif /* __ACE_INLINE__ */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template<typename S_forany,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::In_Fixed_Array_SArgument_T<S_forany,
+ Insert_Policy>::demarshal (TAO_InputCDR &cdr)
+{
+ S_forany tmp (this->x_);
+ return cdr >> tmp;
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S_forany,
+ class Insert_Policy>
+void
+TAO::In_Fixed_Array_SArgument_T<S_forany,
+ Insert_Policy>::interceptor_value (
+ CORBA::Any *any) const
+{
+ Insert_Policy::any_insert (any, S_forany (this->x_));
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+// ===========================================================
+
+template<typename S_forany,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::Inout_Fixed_Array_SArgument_T<S_forany,
+ Insert_Policy>::marshal (TAO_OutputCDR &cdr)
+{
+ return cdr << S_forany (this->x_);
+}
+
+template<typename S_forany,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::Inout_Fixed_Array_SArgument_T<S_forany,
+ Insert_Policy>::
+demarshal (TAO_InputCDR & cdr)
+{
+ S_forany tmp (this->x_);
+ return cdr >> tmp;
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S_forany,
+ class Insert_Policy>
+void
+TAO::Inout_Fixed_Array_SArgument_T<S_forany,
+ Insert_Policy>::interceptor_value (
+ CORBA::Any *any) const
+{
+ Insert_Policy::any_insert (any, S_forany (this->x_));
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+// ==============================================================
+
+template<typename S_forany,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::Out_Fixed_Array_SArgument_T<S_forany,
+ Insert_Policy>::marshal (TAO_OutputCDR &cdr)
+{
+ return cdr << S_forany (this->x_);
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S_forany,
+ class Insert_Policy>
+void
+TAO::Out_Fixed_Array_SArgument_T<S_forany,
+ Insert_Policy>::interceptor_value (
+ CORBA::Any *any) const
+{
+ Insert_Policy::any_insert (any, S_forany (this->x_));
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+// ============================================================
+
+template<typename S_var,
+ typename S_forany,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::Ret_Fixed_Array_SArgument_T<S_var,
+ S_forany,
+ Insert_Policy>::marshal (
+ TAO_OutputCDR & cdr
+ )
+{
+ return cdr << S_forany (this->x_.inout ());
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S_var,
+ typename S_forany,
+ class Insert_Policy>
+void
+TAO::Ret_Fixed_Array_SArgument_T<S_var,
+ S_forany,
+ Insert_Policy>::interceptor_value (
+ CORBA::Any *any) const
+{
+ Insert_Policy::any_insert (any, S_forany (this->x_.ptr ()));
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_FIXED_ARRAY_SARGUMENT_T_CPP */
diff --git a/TAO/tao/PortableServer/Fixed_Array_SArgument_T.h b/TAO/tao/PortableServer/Fixed_Array_SArgument_T.h
new file mode 100644
index 00000000000..eb280d5b838
--- /dev/null
+++ b/TAO/tao/PortableServer/Fixed_Array_SArgument_T.h
@@ -0,0 +1,173 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Fixed_Array_SArgument_T.h
+ *
+ * $Id$
+ *
+ * @authors Jeff Parsons, Carlos O'Ryan and Ossama Othman
+ */
+//=============================================================================
+
+
+#ifndef TAO_FIXED_ARRAY_SARGUMENT_T_H
+#define TAO_FIXED_ARRAY_SARGUMENT_T_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Argument.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ /**
+ * @class In_Fixed_Array_SArgument_T
+ *
+ * @brief IN skeleton argument of fixed size element array.
+ *
+ */
+ template<typename S_forany,
+ class Insert_Policy>
+ class In_Fixed_Array_SArgument_T : public InArgument
+ {
+ public:
+ In_Fixed_Array_SArgument_T (void);
+
+ virtual CORBA::Boolean demarshal (TAO_InputCDR &);
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ typename S_forany::_slice_type const * arg (void) const;
+
+ private:
+ mutable typename S_forany::_array_type x_;
+ };
+
+ /**
+ * @class Inout_Fixed_Array_SArgument_T
+ *
+ * @brief INOUT skeleton argument of fixed size element array.
+ */
+ template<typename S_forany,
+ class Insert_Policy>
+ class Inout_Fixed_Array_SArgument_T : public InoutArgument
+ {
+ public:
+ Inout_Fixed_Array_SArgument_T (void);
+
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+ virtual CORBA::Boolean demarshal (TAO_InputCDR &cdr);
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ typename S_forany::_slice_type * arg (void);
+
+ private:
+ mutable typename S_forany::_array_type x_;
+ };
+
+ /**
+ * @class Out_Fixed_Array_SArgument_T
+ *
+ * @brief OUT skeleton argument of fixed size element array.
+ */
+ template<typename S_forany,
+ class Insert_Policy>
+ class Out_Fixed_Array_SArgument_T : public OutArgument
+ {
+ public:
+ Out_Fixed_Array_SArgument_T (void);
+
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ typename S_forany::_slice_type * arg (void);
+
+ private:
+ mutable typename S_forany::_array_type x_;
+ };
+
+ /**
+ * @class Ret_Fixed_Array_SArgument_T
+ *
+ * @brief Skeleton value of fixed size element array.
+ *
+ */
+ template<typename S_var,
+ typename S_forany,
+ class Insert_Policy>
+ class Ret_Fixed_Array_SArgument_T : public RetArgument
+ {
+ public:
+ Ret_Fixed_Array_SArgument_T (void);
+
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ typename S_forany::_slice_type *& arg (void);
+
+ private:
+ S_var x_;
+ };
+
+ /**
+ * @struct Fixed_Array_Arg_Traits_T
+ *
+ * @brief Argument traits of fixed size element array.
+ *
+ */
+ template<typename T_var,
+ typename T_forany,
+ class Insert_Policy>
+ struct Fixed_Array_SArg_Traits_T
+ {
+ typedef typename T_forany::_slice_type * ret_type;
+ typedef const typename T_forany::_array_type in_type;
+ typedef typename T_forany::_array_type inout_type;
+ typedef typename T_forany::_array_type out_type;
+
+ typedef In_Fixed_Array_SArgument_T<T_forany,
+ Insert_Policy> in_arg_val;
+ typedef Inout_Fixed_Array_SArgument_T<T_forany,
+ Insert_Policy> inout_arg_val;
+ typedef Out_Fixed_Array_SArgument_T<T_forany,
+ Insert_Policy> out_arg_val;
+ typedef Ret_Fixed_Array_SArgument_T<T_var,
+ T_forany,
+ Insert_Policy> ret_val;
+
+ // Typedefs corresponding to return value of arg() method in both
+ // the client and server side argument class templates.
+ typedef typename T_forany::_slice_type const * in_arg_type;
+ typedef ret_type inout_arg_type;
+ typedef ret_type out_arg_type;
+ typedef ret_type & ret_arg_type;
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+#include "tao/PortableServer/Fixed_Array_SArgument_T.inl"
+#endif /* __ACE_INLINE__ */
+
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+#include "tao/PortableServer/Fixed_Array_SArgument_T.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
+#pragma implementation ("Fixed_Array_SArgument_T.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_FIXED_ARRAY_SARGUMENT_T_H */
diff --git a/TAO/tao/PortableServer/Fixed_Array_SArgument_T.inl b/TAO/tao/PortableServer/Fixed_Array_SArgument_T.inl
new file mode 100644
index 00000000000..f910e871d2d
--- /dev/null
+++ b/TAO/tao/PortableServer/Fixed_Array_SArgument_T.inl
@@ -0,0 +1,95 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template<typename S_forany,
+ class Insert_Policy>
+ACE_INLINE
+TAO::In_Fixed_Array_SArgument_T<S_forany,
+ Insert_Policy>::In_Fixed_Array_SArgument_T (void)
+{
+}
+
+template<typename S_forany,
+ class Insert_Policy>
+ACE_INLINE
+typename S_forany::_slice_type const *
+TAO::In_Fixed_Array_SArgument_T<S_forany,
+ Insert_Policy>::arg (void) const
+{
+ S_forany tmp (this->x_);
+ return tmp.in ();
+}
+
+// ===========================================================================
+
+template<typename S_forany,
+ class Insert_Policy>
+ACE_INLINE
+TAO::Inout_Fixed_Array_SArgument_T<S_forany,
+ Insert_Policy>::
+Inout_Fixed_Array_SArgument_T (void)
+{
+}
+
+template<typename S_forany,
+ class Insert_Policy>
+ACE_INLINE
+typename S_forany::_slice_type *
+TAO::Inout_Fixed_Array_SArgument_T<S_forany,
+ Insert_Policy>::arg (void)
+{
+ S_forany tmp (this->x_);
+ return tmp.inout ();
+}
+
+// ===========================================================================
+
+template<typename S_forany,
+ class Insert_Policy>
+ACE_INLINE
+TAO::Out_Fixed_Array_SArgument_T<S_forany,
+ Insert_Policy>::
+Out_Fixed_Array_SArgument_T (void)
+{
+}
+
+template<typename S_forany,
+ class Insert_Policy>
+ACE_INLINE
+typename S_forany::_slice_type *
+TAO::Out_Fixed_Array_SArgument_T<S_forany,
+ Insert_Policy>::arg (void)
+{
+ S_forany tmp (this->x_);
+ return tmp.inout ();
+}
+
+// ===========================================================================
+
+template<typename S_var,
+ typename S_forany,
+ class Insert_Policy>
+ACE_INLINE
+TAO::Ret_Fixed_Array_SArgument_T<S_var,
+ S_forany,
+ Insert_Policy>::
+Ret_Fixed_Array_SArgument_T (void)
+{
+}
+
+template<typename S_var,
+ typename S_forany,
+ class Insert_Policy>
+ACE_INLINE
+typename S_forany::_slice_type *&
+TAO::Ret_Fixed_Array_SArgument_T<S_var,
+ S_forany,
+ Insert_Policy>::arg (void)
+{
+ return this->x_._retn_arg ();
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/Fixed_Size_SArgument_T.cpp b/TAO/tao/PortableServer/Fixed_Size_SArgument_T.cpp
new file mode 100644
index 00000000000..33990ec3594
--- /dev/null
+++ b/TAO/tao/PortableServer/Fixed_Size_SArgument_T.cpp
@@ -0,0 +1,115 @@
+// $Id$
+
+#ifndef TAO_FIXED_SIZE_SARGUMENT_T_CPP
+#define TAO_FIXED_SIZE_SARGUMENT_T_CPP
+
+#include "tao/PortableServer/Fixed_Size_SArgument_T.h"
+
+#if !defined (__ACE_INLINE__)
+#include "tao/PortableServer/Fixed_Size_SArgument_T.inl"
+#endif /* __ACE_INLINE__ */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template<typename S,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::In_Fixed_Size_SArgument_T<S,Insert_Policy>::demarshal (TAO_InputCDR & cdr)
+{
+ return cdr >> this->x_;
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S,
+ class Insert_Policy>
+void
+TAO::In_Fixed_Size_SArgument_T<S,Insert_Policy>::interceptor_value (
+ CORBA::Any *any) const
+{
+ Insert_Policy::any_insert (any, this->x_);
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+// ===========================================================
+
+template<typename S,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::Inout_Fixed_Size_SArgument_T<S,Insert_Policy>::marshal (TAO_OutputCDR &cdr)
+{
+ return cdr << this->x_;
+}
+
+template<typename S,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::Inout_Fixed_Size_SArgument_T<S,Insert_Policy>::demarshal (
+ TAO_InputCDR & cdr)
+{
+ return cdr >> this->x_;
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S,
+ class Insert_Policy>
+void
+TAO::Inout_Fixed_Size_SArgument_T<S,Insert_Policy>::interceptor_value (
+ CORBA::Any *any) const
+{
+ Insert_Policy::any_insert (any, this->x_);
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+// ==============================================================
+
+template<typename S,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::Out_Fixed_Size_SArgument_T<S,Insert_Policy>::marshal (TAO_OutputCDR &cdr)
+{
+ return cdr << this->x_;
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S,
+ class Insert_Policy>
+void
+TAO::Out_Fixed_Size_SArgument_T<S,Insert_Policy>::interceptor_value (
+ CORBA::Any *any) const
+{
+ Insert_Policy::any_insert (any, this->x_);
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+// ============================================================
+
+template<typename S,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::Ret_Fixed_Size_SArgument_T<S,Insert_Policy>::marshal (TAO_OutputCDR &cdr)
+{
+ return cdr << this->x_;
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S,
+ class Insert_Policy>
+void
+TAO::Ret_Fixed_Size_SArgument_T<S,Insert_Policy>::interceptor_value (
+ CORBA::Any *any) const
+{
+ Insert_Policy::any_insert (any, this->x_);
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_FIXED_SIZE_SARGUMENT_T_CPP */
diff --git a/TAO/tao/PortableServer/Fixed_Size_SArgument_T.h b/TAO/tao/PortableServer/Fixed_Size_SArgument_T.h
new file mode 100644
index 00000000000..0912f64c017
--- /dev/null
+++ b/TAO/tao/PortableServer/Fixed_Size_SArgument_T.h
@@ -0,0 +1,234 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Fixed_Size_SArgument_T.h
+ *
+ * $Id$
+ *
+ * @author Jeff Parsons
+ * @author Carlos O'Ryan
+ * @author Ossama Othman
+ */
+//=============================================================================
+
+#ifndef TAO_FIXED_SIZE_SARGUMENT_T_H
+#define TAO_FIXED_SIZE_SARGUMENT_T_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Argument.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ /**
+ * @class In_Fixed_Size_SArgument_T
+ *
+ * @brief Skeleton class template for operation "IN" arguments of
+ * fixed size IDL types.
+ *
+ * Skeleton class template for operation "IN" arguments of fixed
+ * size IDL types.
+ */
+ template<typename S, class Insert_Policy>
+ class In_Fixed_Size_SArgument_T : public InArgument
+ {
+ public:
+
+ /**
+ * @name @c TAO::Argument Method Overrides
+ *
+ * @c TAO::Argument method overrides specific to the type of
+ * operation argument represented by this class.
+ *
+ * @see @c TAO::Argument.
+ */
+ //@{
+ virtual CORBA::Boolean demarshal (TAO_InputCDR & cdr);
+
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ //@}
+
+ /// Retrieve underlying argument.
+ S const & arg (void) const;
+
+ private:
+
+ /// Reference to the "IN" argument.
+ S x_;
+
+ };
+
+ // ------------------------------------------------------------
+
+ /**
+ * @class Inout_Fixed_Size_SArgument_T
+ *
+ * @brief Template class for INOUT skeleton arg of fixed size IDL types.
+ *
+ */
+ template<typename S, class Insert_Policy>
+ class Inout_Fixed_Size_SArgument_T : public InoutArgument
+ {
+ public:
+
+ /// Constructor.
+ Inout_Fixed_Size_SArgument_T (void);
+
+ /**
+ * @name @c TAO::Argument Method Overrides
+ *
+ * @c TAO::Argument method overrides specific to the type of
+ * operation argument represented by this class.
+ *
+ * @see @c TAO::Argument.
+ */
+ //@{
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+ virtual CORBA::Boolean demarshal (TAO_InputCDR &);
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ //@}
+
+ S & arg (void);
+
+ private:
+
+ S x_;
+ };
+
+ // ------------------------------------------------------------
+
+ /**
+ * @class Out_Fixed_Size_SArgument_T
+ *
+ * @brief Template class for OUT skeleton argument of fixed size IDL types.
+ *
+ */
+ template<typename S, class Insert_Policy>
+ class Out_Fixed_Size_SArgument_T : public OutArgument
+ {
+ public:
+
+ /// Constructor.
+ Out_Fixed_Size_SArgument_T (void);
+
+ /**
+ * @name @c TAO::Argument Method Overrides
+ *
+ * @c TAO::Argument method overrides specific to the type of
+ * operation argument represented by this class.
+ *
+ * @see @c TAO::Argument.
+ */
+ //@{
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ //@}
+
+ S & arg (void);
+
+ private:
+
+ S x_;
+
+ };
+
+ // ------------------------------------------------------------
+
+ /**
+ * @class Ret_Fixed_Size_SArgument_T
+ *
+ * @brief Template class for return skeleton value of fixed size IDL types.
+ *
+ */
+ template<typename S, class Insert_Policy>
+ class Ret_Fixed_Size_SArgument_T : public RetArgument
+ {
+ public:
+
+ /// Constructor.
+ Ret_Fixed_Size_SArgument_T (void);
+
+ /**
+ * @name @c TAO::Argument Method Overrides
+ *
+ * @c TAO::Argument method overrides specific to the type of
+ * operation argument represented by this class.
+ *
+ * @see @c TAO::Argument.
+ */
+ //@{
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ //@}
+
+ S & arg (void);
+
+ private:
+
+ S x_;
+
+ };
+
+ // ------------------------------------------------------------
+
+ /**
+ * @struct Fixed_Size_SArg_Traits_T
+ *
+ * @brief Template class for argument traits of fixed size IDL types.
+ *
+ */
+ template<typename T,
+ class Insert_Policy>
+ struct Fixed_Size_SArg_Traits_T
+ {
+ typedef T ret_type;
+ typedef T const & in_type;
+ typedef T & inout_type;
+ typedef T & out_type;
+
+ typedef In_Fixed_Size_SArgument_T<T,Insert_Policy> in_arg_val;
+ typedef Inout_Fixed_Size_SArgument_T<T,Insert_Policy> inout_arg_val;
+ typedef Out_Fixed_Size_SArgument_T<T,Insert_Policy> out_arg_val;
+ typedef Ret_Fixed_Size_SArgument_T<T,Insert_Policy> ret_val;
+
+ // Typedefs corresponding to return value of arg() method in both
+ // the client and server side argument class templates.
+ typedef in_type in_arg_type;
+ typedef inout_type inout_arg_type;
+ typedef out_type out_arg_type;
+ typedef out_type ret_arg_type;
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+#include "tao/PortableServer/Fixed_Size_SArgument_T.inl"
+#endif /* __ACE_INLINE__ */
+
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+#include "tao/PortableServer/Fixed_Size_SArgument_T.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
+#pragma implementation ("Fixed_Size_SArgument_T.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_FIXED_SIZE_SARGUMENT_T_H */
diff --git a/TAO/tao/PortableServer/Fixed_Size_SArgument_T.inl b/TAO/tao/PortableServer/Fixed_Size_SArgument_T.inl
new file mode 100644
index 00000000000..367a060b576
--- /dev/null
+++ b/TAO/tao/PortableServer/Fixed_Size_SArgument_T.inl
@@ -0,0 +1,71 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template<typename S,
+ class Insert_Policy>
+ACE_INLINE
+S const &
+TAO::In_Fixed_Size_SArgument_T<S,Insert_Policy>::arg (void) const
+{
+ return this->x_;
+}
+
+// ==========================================================================
+
+template<typename S,
+ class Insert_Policy>
+ACE_INLINE
+TAO::Inout_Fixed_Size_SArgument_T<S,Insert_Policy>::
+Inout_Fixed_Size_SArgument_T (void)
+{
+}
+
+template<typename S,
+ class Insert_Policy>
+ACE_INLINE
+S &
+TAO::Inout_Fixed_Size_SArgument_T<S,Insert_Policy>::arg (void)
+{
+ return this->x_;
+}
+
+// ==========================================================================
+
+template<typename S,
+ class Insert_Policy>
+ACE_INLINE
+TAO::Out_Fixed_Size_SArgument_T<S,
+ Insert_Policy>::
+Out_Fixed_Size_SArgument_T (void)
+{}
+
+template<typename S,
+ class Insert_Policy>
+ACE_INLINE
+S &
+TAO::Out_Fixed_Size_SArgument_T<S,Insert_Policy>::arg (void)
+{
+ return this->x_;
+}
+
+// ==========================================================================
+
+template<typename S,
+ class Insert_Policy>
+ACE_INLINE
+TAO::Ret_Fixed_Size_SArgument_T<S,Insert_Policy>::Ret_Fixed_Size_SArgument_T (void)
+{}
+
+template<typename S,
+ class Insert_Policy>
+ACE_INLINE
+S &
+TAO::Ret_Fixed_Size_SArgument_T<S,Insert_Policy>::arg (void)
+{
+ return this->x_;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/ForwardRequest.pidl b/TAO/tao/PortableServer/ForwardRequest.pidl
new file mode 100644
index 00000000000..1752ac6eef2
--- /dev/null
+++ b/TAO/tao/PortableServer/ForwardRequest.pidl
@@ -0,0 +1,28 @@
+/**
+ * @file ForwardRequest.pidl
+ *
+ * $Id$
+ *
+ * @brief PIDL source for the PortableServer module.
+ */
+
+#ifndef _PORTABLESERVER_FORWARDREQUEST_IDL_
+#define _PORTABLESERVER_FORWARDREQUEST_IDL_
+
+#pragma prefix "omg.org"
+
+#if !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO) && !defined (TAO_HAS_MINIMUM_POA)
+
+module PortableServer
+{
+# pragma version PortableServer 2.3
+
+ exception ForwardRequest
+ {
+ Object forward_reference;
+ };
+};
+
+#endif
+
+#endif // _PORTABLESERVER_FORWARDREQUEST_IDL_
diff --git a/TAO/tao/PortableServer/IdAssignmentPolicy.cpp b/TAO/tao/PortableServer/IdAssignmentPolicy.cpp
new file mode 100644
index 00000000000..7d036f83c72
--- /dev/null
+++ b/TAO/tao/PortableServer/IdAssignmentPolicy.cpp
@@ -0,0 +1,71 @@
+#include "tao/PortableServer/IdAssignmentPolicy.h"
+#include "tao/PortableServer/PortableServer.h"
+
+ACE_RCSID (PortableServer,
+ IdAssignmentPolicy,
+ "$Id$")
+
+#if !defined (CORBA_E_MICRO)
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ IdAssignmentPolicy::IdAssignmentPolicy (
+ ::PortableServer::IdAssignmentPolicyValue value) :
+ value_ (value)
+ {
+ }
+
+ CORBA::Policy_ptr
+ IdAssignmentPolicy::copy (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ IdAssignmentPolicy *copy = 0;
+ ACE_NEW_THROW_EX (copy,
+ IdAssignmentPolicy (this->value_),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+
+ return copy;
+ }
+
+ void
+ IdAssignmentPolicy::destroy (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ }
+
+ ::PortableServer::IdAssignmentPolicyValue
+ IdAssignmentPolicy::value (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ return value_;
+ }
+
+ CORBA::PolicyType
+ IdAssignmentPolicy::policy_type (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ return ::PortableServer::ID_ASSIGNMENT_POLICY_ID;
+ }
+
+ TAO_Cached_Policy_Type
+ IdAssignmentPolicy::_tao_cached_type (void) const
+ {
+ return TAO_CACHED_POLICY_ID_ASSIGNMENT;
+ }
+
+ TAO_Policy_Scope
+ IdAssignmentPolicy::_tao_scope (void) const
+ {
+ return TAO_POLICY_POA_SCOPE;
+ }
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif
diff --git a/TAO/tao/PortableServer/IdAssignmentPolicy.h b/TAO/tao/PortableServer/IdAssignmentPolicy.h
new file mode 100644
index 00000000000..83cec156f2c
--- /dev/null
+++ b/TAO/tao/PortableServer/IdAssignmentPolicy.h
@@ -0,0 +1,81 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file IdAssignmentPolicy.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_PORTABLESERVER_IDASSIGNMENTPOLICY_H
+#define TAO_PORTABLESERVER_IDASSIGNMENTPOLICY_H
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/IdAssignmentPolicyC.h"
+#include "tao/LocalObject.h"
+
+// This is to remove "inherits via dominance" warnings from MSVC.
+// MSVC is being a little too paranoid.
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+#if !defined (CORBA_E_MICRO)
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ class TAO_PortableServer_Export IdAssignmentPolicy
+ : public virtual ::PortableServer::IdAssignmentPolicy,
+ public virtual TAO_Local_RefCounted_Object
+ {
+ public:
+ IdAssignmentPolicy (::PortableServer::IdAssignmentPolicyValue value);
+
+ CORBA::Policy_ptr copy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ void destroy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ ::PortableServer::IdAssignmentPolicyValue value (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ CORBA::PolicyType policy_type (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Return the cached policy type for this policy.
+ virtual TAO_Cached_Policy_Type _tao_cached_type (void) const;
+
+ /// Returns the scope at which this policy can be applied. See orbconf.h.
+ virtual TAO_Policy_Scope _tao_scope (void) const;
+
+ private:
+ ::PortableServer::IdAssignmentPolicyValue value_;
+ };
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_PORTABLESERVER_IDASSIGNMENTPOLICY_H */
diff --git a/TAO/tao/PortableServer/IdAssignmentPolicy.pidl b/TAO/tao/PortableServer/IdAssignmentPolicy.pidl
new file mode 100644
index 00000000000..af99fc0469c
--- /dev/null
+++ b/TAO/tao/PortableServer/IdAssignmentPolicy.pidl
@@ -0,0 +1,36 @@
+/**
+ * @file IdAssignmentPolicy.pidl
+ *
+ * $Id$
+ *
+ * @brief PIDL source for the PortableServer module.
+ */
+
+#ifndef _PORTABLESERVER_IDASSIGNMENTPOLICY_IDL_
+#define _PORTABLESERVER_IDASSIGNMENTPOLICY_IDL_
+
+#include "tao/Policy.pidl"
+
+#pragma prefix "omg.org"
+
+module PortableServer
+{
+# pragma version PortableServer 2.3
+
+ enum IdAssignmentPolicyValue
+ {
+ USER_ID,
+ SYSTEM_ID
+ };
+
+#if !defined (CORBA_E_MICRO)
+
+ local interface IdAssignmentPolicy : CORBA::Policy
+ {
+ readonly attribute IdAssignmentPolicyValue value;
+ };
+
+#endif
+};
+
+#endif // _PORTABLESERVER_IDASSIGNMENTPOLICY_IDL_
diff --git a/TAO/tao/PortableServer/IdAssignmentStrategy.cpp b/TAO/tao/PortableServer/IdAssignmentStrategy.cpp
new file mode 100644
index 00000000000..969a6bfa112
--- /dev/null
+++ b/TAO/tao/PortableServer/IdAssignmentStrategy.cpp
@@ -0,0 +1,46 @@
+// $Id$
+
+#include "tao/PortableServer/IdAssignmentStrategy.h"
+
+ACE_RCSID (PortableServer,
+ IdAssignmentStrategy,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ void
+ IdAssignmentStrategy::strategy_init (TAO_Root_POA * /*poa*/
+ ACE_ENV_ARG_DECL_NOT_USED)
+ {
+ }
+
+ void
+ IdAssignmentStrategy::strategy_cleanup(ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ {
+ }
+
+ char
+ IdAssignmentStrategy::key_type_length (void) const
+ {
+ return sizeof (char);
+ }
+
+ void
+ IdAssignmentStrategy::create_key (
+ CORBA::Octet *buffer,
+ CORBA::ULong& starting_at)
+ {
+ // Copy the system id byte.
+ buffer[starting_at] = (CORBA::Octet) this->id_assignment_key_type ();
+ starting_at += this->key_type_length ();
+ }
+
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/IdAssignmentStrategy.h b/TAO/tao/PortableServer/IdAssignmentStrategy.h
new file mode 100644
index 00000000000..d53a67c62b3
--- /dev/null
+++ b/TAO/tao/PortableServer/IdAssignmentStrategy.h
@@ -0,0 +1,59 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file IdAssignmentStrategy.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_ID_ASSIGNMENT_STRATEGY_H
+#define TAO_ID_ASSIGNMENT_STRATEGY_H
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/Policy_Strategy.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Basic_Types.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ class IdAssignmentStrategy
+ : public Policy_Strategy
+ {
+ public:
+ virtual void strategy_init(TAO_Root_POA *poa ACE_ENV_ARG_DECL);
+
+ virtual void strategy_cleanup(ACE_ENV_SINGLE_ARG_DECL);
+
+ /**
+ * Returns the key type the says which specific policy we have
+ */
+ virtual char id_assignment_key_type (void) const = 0;
+
+ /**
+ * Returns the length of the id_assignment type
+ */
+ char key_type_length (void) const;
+
+ void create_key (CORBA::Octet *buffer, CORBA::ULong& starting_at);
+
+ virtual bool has_system_id (void) const = 0;
+ };
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_ID_ASSIGNMENT_STRATEGY_H */
diff --git a/TAO/tao/PortableServer/IdAssignmentStrategyFactory.h b/TAO/tao/PortableServer/IdAssignmentStrategyFactory.h
new file mode 100644
index 00000000000..2d0dd83a80c
--- /dev/null
+++ b/TAO/tao/PortableServer/IdAssignmentStrategyFactory.h
@@ -0,0 +1,52 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file IdAssignmentStrategyFactory.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_PORTABLESERVER_IDASSIGNMENTSTRATEGYFACTORY_H
+#define TAO_PORTABLESERVER_IDASSIGNMENTSTRATEGYFACTORY_H
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/StrategyFactory.h"
+#include "tao/PortableServer/IdAssignmentPolicyC.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ class IdAssignmentStrategy;
+
+ class TAO_PortableServer_Export IdAssignmentStrategyFactory
+ : public StrategyFactory
+ {
+ public:
+ /// Create a new servant retention strategy
+ virtual IdAssignmentStrategy* create (
+ ::PortableServer::IdAssignmentPolicyValue value) = 0;
+
+ virtual void destroy (
+ IdAssignmentStrategy *strategy
+ ACE_ENV_ARG_DECL) = 0;
+ };
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_PORTABLESERVER_IDASSIGNMENTSTRATEGYFACTORY_H */
diff --git a/TAO/tao/PortableServer/IdAssignmentStrategyFactoryImpl.cpp b/TAO/tao/PortableServer/IdAssignmentStrategyFactoryImpl.cpp
new file mode 100644
index 00000000000..475632c8363
--- /dev/null
+++ b/TAO/tao/PortableServer/IdAssignmentStrategyFactoryImpl.cpp
@@ -0,0 +1,73 @@
+// $Id$
+
+#include "tao/PortableServer/IdAssignmentStrategyFactoryImpl.h"
+#include "tao/PortableServer/IdAssignmentStrategy.h"
+#include "ace/Dynamic_Service.h"
+
+ACE_RCSID (PortableServer,
+ IdAssignmentStrategyFactoryImpl,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ IdAssignmentStrategy*
+ IdAssignmentStrategyFactoryImpl::create (
+ ::PortableServer::IdAssignmentPolicyValue value)
+ {
+ IdAssignmentStrategy* strategy = 0;
+ const char * strategy_name = 0;
+
+ switch (value)
+ {
+ case ::PortableServer::SYSTEM_ID :
+ {
+ strategy_name = "IdAssignmentStrategySystem";
+ break;
+ }
+ case ::PortableServer::USER_ID :
+ {
+ strategy_name = "IdAssignmentStrategyUser";
+ break;
+ }
+ }
+
+ strategy =
+ ACE_Dynamic_Service<IdAssignmentStrategy>::instance (strategy_name);
+
+ if (strategy == 0)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) ERROR, Unable to get %s\n"),
+ strategy_name));
+
+ return strategy;
+ }
+
+ void
+ IdAssignmentStrategyFactoryImpl::destroy (
+ IdAssignmentStrategy * /*strategy*/
+ ACE_ENV_ARG_DECL_NOT_USED)
+ {
+ // Noop because both types are singletons
+ }
+
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DEFINE (
+ IdAssignmentStrategyFactoryImpl,
+ ACE_TEXT ("IdAssignmentStrategyFactory"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (IdAssignmentStrategyFactoryImpl),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0)
+
+ACE_FACTORY_NAMESPACE_DEFINE (
+ ACE_Local_Service,
+ IdAssignmentStrategyFactoryImpl,
+ TAO::Portable_Server::IdAssignmentStrategyFactoryImpl)
diff --git a/TAO/tao/PortableServer/IdAssignmentStrategyFactoryImpl.h b/TAO/tao/PortableServer/IdAssignmentStrategyFactoryImpl.h
new file mode 100644
index 00000000000..1e7cadb3267
--- /dev/null
+++ b/TAO/tao/PortableServer/IdAssignmentStrategyFactoryImpl.h
@@ -0,0 +1,54 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file IdAssignmentStrategyFactoryImpl.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_PORTABLESERVER_IDASSIGNMENTSTRATEGYFACTORYIMPL_H
+#define TAO_PORTABLESERVER_IDASSIGNMENTSTRATEGYFACTORYIMPL_H
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/IdAssignmentStrategyFactory.h"
+#include "ace/Service_Config.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ class TAO_PortableServer_Export IdAssignmentStrategyFactoryImpl
+ : public IdAssignmentStrategyFactory
+ {
+ public:
+ /// Create a new servant retention strategy
+ virtual IdAssignmentStrategy* create (
+ ::PortableServer::IdAssignmentPolicyValue value);
+
+ virtual void destroy (
+ IdAssignmentStrategy *strategy
+ ACE_ENV_ARG_DECL);
+ };
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE_EXPORT (TAO_PortableServer, IdAssignmentStrategyFactoryImpl)
+ACE_FACTORY_DECLARE (TAO_PortableServer, IdAssignmentStrategyFactoryImpl)
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_PORTABLESERVER_IDASSIGNMENTSTRATEGYFACTORYIMPL_H */
diff --git a/TAO/tao/PortableServer/IdAssignmentStrategySystem.cpp b/TAO/tao/PortableServer/IdAssignmentStrategySystem.cpp
new file mode 100644
index 00000000000..d7775832e2c
--- /dev/null
+++ b/TAO/tao/PortableServer/IdAssignmentStrategySystem.cpp
@@ -0,0 +1,44 @@
+// $Id$
+
+#include "tao/PortableServer/IdAssignmentStrategySystem.h"
+
+ACE_RCSID (PortableServer,
+ Id_Assignment_Strategy,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ char
+ IdAssignmentStrategySystem::id_assignment_key_type (void) const
+ {
+ return 'S';
+ }
+
+ bool
+ IdAssignmentStrategySystem::has_system_id (void) const
+ {
+ return true;
+ }
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_FACTORY_NAMESPACE_DEFINE (
+ ACE_Local_Service,
+ IdAssignmentStrategySystem,
+ TAO::Portable_Server::IdAssignmentStrategySystem)
+
+ACE_STATIC_SVC_DEFINE (
+ IdAssignmentStrategySystem,
+ ACE_TEXT ("IdAssignmentStrategySystem"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (IdAssignmentStrategySystem),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0)
+
diff --git a/TAO/tao/PortableServer/IdAssignmentStrategySystem.h b/TAO/tao/PortableServer/IdAssignmentStrategySystem.h
new file mode 100644
index 00000000000..e77cbc95b8f
--- /dev/null
+++ b/TAO/tao/PortableServer/IdAssignmentStrategySystem.h
@@ -0,0 +1,49 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file IdAssignmentStrategySystem.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_IDASSIGNMENTSTRATEGYSYSTEM_H
+#define TAO_IDASSIGNMENTSTRATEGYSYSTEM_H
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/IdAssignmentStrategy.h"
+#include "ace/Service_Config.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ class IdAssignmentStrategySystem
+ : public IdAssignmentStrategy
+ {
+ public:
+ virtual char id_assignment_key_type (void) const;
+
+ virtual bool has_system_id (void) const;
+ };
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE_EXPORT (TAO_PortableServer, IdAssignmentStrategySystem)
+ACE_FACTORY_DECLARE (TAO_PortableServer, IdAssignmentStrategySystem)
+
+#include /**/ "ace/post.h"
+#endif /* TAO_IDASSIGNMENTSTRATEGYSYSTEM_H */
diff --git a/TAO/tao/PortableServer/IdAssignmentStrategyUser.cpp b/TAO/tao/PortableServer/IdAssignmentStrategyUser.cpp
new file mode 100644
index 00000000000..3cfa5cef85a
--- /dev/null
+++ b/TAO/tao/PortableServer/IdAssignmentStrategyUser.cpp
@@ -0,0 +1,42 @@
+// $Id$
+
+#include "tao/PortableServer/IdAssignmentStrategyUser.h"
+
+ACE_RCSID (PortableServer,
+ Id_Assignment_Strategy,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ char
+ IdAssignmentStrategyUser::id_assignment_key_type (void) const
+ {
+ return 'U';
+ }
+
+ bool
+ IdAssignmentStrategyUser::has_system_id (void) const
+ {
+ return false;
+ }
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_FACTORY_NAMESPACE_DEFINE (
+ ACE_Local_Service,
+ IdAssignmentStrategyUser,
+ TAO::Portable_Server::IdAssignmentStrategyUser)
+
+ACE_STATIC_SVC_DEFINE (
+ IdAssignmentStrategyUser,
+ ACE_TEXT ("IdAssignmentStrategyUser"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (IdAssignmentStrategyUser),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0)
diff --git a/TAO/tao/PortableServer/IdAssignmentStrategyUser.h b/TAO/tao/PortableServer/IdAssignmentStrategyUser.h
new file mode 100644
index 00000000000..f3560cef1d5
--- /dev/null
+++ b/TAO/tao/PortableServer/IdAssignmentStrategyUser.h
@@ -0,0 +1,49 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @fileIdAssignmentStrategyUser.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_IDASSIGNMENTSTRATEGYUSER_H
+#define TAO_IDASSIGNMENTSTRATEGYUSER_H
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/IdAssignmentStrategy.h"
+#include "ace/Service_Config.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ class IdAssignmentStrategyUser
+ : public IdAssignmentStrategy
+ {
+ public:
+ virtual char id_assignment_key_type (void) const;
+
+ virtual bool has_system_id (void) const;
+ };
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE_EXPORT (TAO_PortableServer, IdAssignmentStrategyUser)
+ACE_FACTORY_DECLARE (TAO_PortableServer, IdAssignmentStrategyUser)
+
+#include /**/ "ace/post.h"
+#endif /* TAO_IDASSIGNMENTSTRATEGYUSER_H */
diff --git a/TAO/tao/PortableServer/IdUniquenessPolicy.cpp b/TAO/tao/PortableServer/IdUniquenessPolicy.cpp
new file mode 100644
index 00000000000..8796492f65d
--- /dev/null
+++ b/TAO/tao/PortableServer/IdUniquenessPolicy.cpp
@@ -0,0 +1,71 @@
+#include "tao/PortableServer/IdUniquenessPolicy.h"
+#include "tao/PortableServer/PortableServer.h"
+
+ACE_RCSID (PortableServer,
+ IdUniquenessPolicy,
+ "$Id$")
+
+#if !defined (CORBA_E_MICRO)
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ IdUniquenessPolicy::IdUniquenessPolicy (
+ ::PortableServer::IdUniquenessPolicyValue value) :
+ value_ (value)
+ {
+ }
+
+ CORBA::Policy_ptr
+ IdUniquenessPolicy::copy (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ IdUniquenessPolicy *copy = 0;
+ ACE_NEW_THROW_EX (copy,
+ IdUniquenessPolicy (this->value_),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+
+ return copy;
+ }
+
+ void
+ IdUniquenessPolicy::destroy (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ }
+
+ ::PortableServer::IdUniquenessPolicyValue
+ IdUniquenessPolicy::value (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ return value_;
+ }
+
+ CORBA::PolicyType
+ IdUniquenessPolicy::policy_type (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ return ::PortableServer::ID_UNIQUENESS_POLICY_ID;
+ }
+
+ TAO_Cached_Policy_Type
+ IdUniquenessPolicy::_tao_cached_type (void) const
+ {
+ return TAO_CACHED_POLICY_ID_UNIQUENESS;
+ }
+
+ TAO_Policy_Scope
+ IdUniquenessPolicy::_tao_scope (void) const
+ {
+ return TAO_POLICY_POA_SCOPE;
+ }
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif
diff --git a/TAO/tao/PortableServer/IdUniquenessPolicy.h b/TAO/tao/PortableServer/IdUniquenessPolicy.h
new file mode 100644
index 00000000000..f1446d6e2fe
--- /dev/null
+++ b/TAO/tao/PortableServer/IdUniquenessPolicy.h
@@ -0,0 +1,81 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file IdUniquenessPolicy.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_PORTABLESERVER_IDUNIQUENESSTPOLICY_H
+#define TAO_PORTABLESERVER_IDUNIQUENESSTPOLICY_H
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/IdUniquenessPolicyC.h"
+#include "tao/LocalObject.h"
+
+// This is to remove "inherits via dominance" warnings from MSVC.
+// MSVC is being a little too paranoid.
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+#if !defined (CORBA_E_MICRO)
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ class TAO_PortableServer_Export IdUniquenessPolicy
+ : public virtual ::PortableServer::IdUniquenessPolicy,
+ public virtual TAO_Local_RefCounted_Object
+ {
+ public:
+ IdUniquenessPolicy (::PortableServer::IdUniquenessPolicyValue value);
+
+ CORBA::Policy_ptr copy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ void destroy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ ::PortableServer::IdUniquenessPolicyValue value (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ CORBA::PolicyType policy_type (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Return the cached policy type for this policy.
+ virtual TAO_Cached_Policy_Type _tao_cached_type (void) const;
+
+ /// Returns the scope at which this policy can be applied. See orbconf.h.
+ virtual TAO_Policy_Scope _tao_scope (void) const;
+
+ private:
+ ::PortableServer::IdUniquenessPolicyValue value_;
+ };
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_PORTABLESERVER_IDUNIQUENESSTPOLICY_H */
diff --git a/TAO/tao/PortableServer/IdUniquenessPolicy.pidl b/TAO/tao/PortableServer/IdUniquenessPolicy.pidl
new file mode 100644
index 00000000000..ee9fe9a3e38
--- /dev/null
+++ b/TAO/tao/PortableServer/IdUniquenessPolicy.pidl
@@ -0,0 +1,37 @@
+/**
+ * @file IdUniquenessPolicy.pidl
+ *
+ * $Id$
+ *
+ * @brief PIDL source for the PortableServer module.
+ */
+
+#ifndef _PORTABLESERVER_IDUNIQUENESSPOLICY_IDL_
+#define _PORTABLESERVER_IDUNIQUENESSPOLICY_IDL_
+
+#include "tao/Policy.pidl"
+
+#pragma prefix "omg.org"
+
+module PortableServer
+{
+# pragma version PortableServer 2.3
+
+ enum IdUniquenessPolicyValue
+ {
+ UNIQUE_ID,
+ MULTIPLE_ID
+ };
+
+#if !defined (CORBA_E_MICRO)
+
+ local interface IdUniquenessPolicy : CORBA::Policy
+ {
+ readonly attribute IdUniquenessPolicyValue value;
+ };
+
+#endif
+};
+
+
+#endif // _PORTABLESERVER_IDUNIQUENESSPOLICY_IDL_
diff --git a/TAO/tao/PortableServer/IdUniquenessStrategy.h b/TAO/tao/PortableServer/IdUniquenessStrategy.h
new file mode 100644
index 00000000000..de0fb20c737
--- /dev/null
+++ b/TAO/tao/PortableServer/IdUniquenessStrategy.h
@@ -0,0 +1,56 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file IdUniquenessStrategy.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_ID_UNIQUENESS_STRATEGY_H
+#define TAO_ID_UNIQUENESS_STRATEGY_H
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/Policy_Strategy.h"
+#include "tao/PortableServer/IdUniquenessPolicyC.h"
+#include "tao/PortableServer/PS_ForwardC.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ class TAO_PortableServer_Export IdUniquenessStrategy
+ : public Policy_Strategy
+ {
+ public:
+ /*
+ * Validate if the servant may be activated
+ * @retval true This servant may be activated
+ * @retval false This servant may not be activated
+ */
+ virtual bool is_servant_activation_allowed (
+ PortableServer::Servant s,
+ int &w) = 0;
+
+ virtual bool allow_multiple_activations (void) const = 0;
+
+ virtual ::PortableServer::IdUniquenessPolicyValue type() const = 0;
+ };
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_ID_UNIQUENESS_STRATEGY_H */
diff --git a/TAO/tao/PortableServer/IdUniquenessStrategyFactory.h b/TAO/tao/PortableServer/IdUniquenessStrategyFactory.h
new file mode 100644
index 00000000000..b3f973ef19f
--- /dev/null
+++ b/TAO/tao/PortableServer/IdUniquenessStrategyFactory.h
@@ -0,0 +1,53 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file IdUniquenessStrategyFactory.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_PORTABLESERVER_IDUNIQUENESSSTRATEGYFACTORY_H
+#define TAO_PORTABLESERVER_IDUNIQUENESSSTRATEGYFACTORY_H
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/StrategyFactory.h"
+#include "tao/PortableServer/IdUniquenessPolicyC.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ class IdUniquenessStrategy;
+
+ class TAO_PortableServer_Export IdUniquenessStrategyFactory
+ : public StrategyFactory
+ {
+ public:
+ /// Create a new servant retention strategy
+ virtual IdUniquenessStrategy* create (
+ ::PortableServer::IdUniquenessPolicyValue value) = 0;
+
+ /// Cleanup the given strategy instance
+ virtual void destroy (
+ IdUniquenessStrategy *strategy
+ ACE_ENV_ARG_DECL) = 0;
+ };
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_PORTABLESERVER_IDUNIQUENESSSTRATEGYFACTORY_H */
diff --git a/TAO/tao/PortableServer/IdUniquenessStrategyFactoryImpl.cpp b/TAO/tao/PortableServer/IdUniquenessStrategyFactoryImpl.cpp
new file mode 100644
index 00000000000..47530f5a9a9
--- /dev/null
+++ b/TAO/tao/PortableServer/IdUniquenessStrategyFactoryImpl.cpp
@@ -0,0 +1,100 @@
+// $Id$
+
+#include "tao/PortableServer/IdUniquenessStrategyFactoryImpl.h"
+#include "tao/PortableServer/IdUniquenessStrategy.h"
+#include "ace/Dynamic_Service.h"
+
+ACE_RCSID (PortableServer,
+ IdUniquenessStrategyFactoryImpl,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ IdUniquenessStrategy*
+ IdUniquenessStrategyFactoryImpl::create (
+ ::PortableServer::IdUniquenessPolicyValue value)
+ {
+ IdUniquenessStrategy* strategy = 0;
+ switch (value)
+ {
+ case ::PortableServer::MULTIPLE_ID :
+ {
+ strategy =
+ ACE_Dynamic_Service<IdUniquenessStrategy>::instance ("IdUniquenessStrategyMultiple");
+
+ if (strategy == 0)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) %p\n"),
+ ACE_TEXT ("ERROR, Unable to get ")
+ ACE_TEXT ("IdUniquenessStrategyMultiple")));
+
+ break;
+ }
+ case ::PortableServer::UNIQUE_ID :
+ {
+ IdUniquenessStrategyFactory *strategy_factory =
+ ACE_Dynamic_Service<IdUniquenessStrategyFactory>::instance ("IdUniquenessStrategyUniqueFactory");
+
+ if (strategy_factory != 0)
+ strategy = strategy_factory->create (value);
+ else
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) %p\n"),
+ ACE_TEXT ("ERROR, Unable to get ")
+ ACE_TEXT ("IdUniquenessStrategyUniqueFactory")));
+
+ break;
+ }
+ }
+
+ return strategy;
+ }
+
+ void
+ IdUniquenessStrategyFactoryImpl::destroy (
+ IdUniquenessStrategy *strategy
+ ACE_ENV_ARG_DECL)
+ {
+ switch (strategy->type ())
+ {
+ case ::PortableServer::MULTIPLE_ID :
+ {
+ // Noop
+ break;
+ }
+ case ::PortableServer::UNIQUE_ID :
+ {
+ IdUniquenessStrategyFactory *strategy_factory =
+ ACE_Dynamic_Service<IdUniquenessStrategyFactory>::instance ("IdUniquenessStrategyUniqueFactory");
+
+ if (strategy_factory != 0)
+ {
+ strategy_factory->destroy (strategy ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ break;
+ }
+ }
+ }
+
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DEFINE (
+ IdUniquenessStrategyFactoryImpl,
+ ACE_TEXT ("IdUniquenessStrategyFactory"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (IdUniquenessStrategyFactoryImpl),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0)
+
+ACE_FACTORY_NAMESPACE_DEFINE (
+ ACE_Local_Service,
+ IdUniquenessStrategyFactoryImpl,
+ TAO::Portable_Server::IdUniquenessStrategyFactoryImpl)
diff --git a/TAO/tao/PortableServer/IdUniquenessStrategyFactoryImpl.h b/TAO/tao/PortableServer/IdUniquenessStrategyFactoryImpl.h
new file mode 100644
index 00000000000..8846237437d
--- /dev/null
+++ b/TAO/tao/PortableServer/IdUniquenessStrategyFactoryImpl.h
@@ -0,0 +1,53 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file IdUniquenessStrategyFactoryImpl.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_PORTABLESERVER_IDUNIQUENESSSTRATEGYFACTORYIMPL_H
+#define TAO_PORTABLESERVER_IDUNIQUENESSSTRATEGYFACTORYIMPL_H
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/Service_Config.h"
+#include "tao/PortableServer/IdUniquenessStrategyFactory.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ class TAO_PortableServer_Export IdUniquenessStrategyFactoryImpl
+ : public IdUniquenessStrategyFactory
+ {
+ public:
+ /// Create a new servant retention strategy
+ virtual IdUniquenessStrategy* create (
+ ::PortableServer::IdUniquenessPolicyValue value);
+
+ virtual void destroy (
+ IdUniquenessStrategy *strategy
+ ACE_ENV_ARG_DECL);
+ };
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE (IdUniquenessStrategyFactoryImpl)
+ACE_FACTORY_DECLARE (TAO_PortableServer, IdUniquenessStrategyFactoryImpl)
+
+#include /**/ "ace/post.h"
+#endif /* TAO_PORTABLESERVER_IDUNIQUENESSSTRATEGYFACTORYIMPL_H */
diff --git a/TAO/tao/PortableServer/IdUniquenessStrategyMultiple.cpp b/TAO/tao/PortableServer/IdUniquenessStrategyMultiple.cpp
new file mode 100644
index 00000000000..d1071f1470c
--- /dev/null
+++ b/TAO/tao/PortableServer/IdUniquenessStrategyMultiple.cpp
@@ -0,0 +1,67 @@
+// $Id$
+
+#include "tao/PortableServer/IdUniquenessStrategyMultiple.h"
+
+ACE_RCSID (PortableServer,
+ Id_Uniqueness_Strategy,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ void
+ IdUniquenessStrategyMultiple::strategy_init (
+ TAO_Root_POA * /*poa*/
+ ACE_ENV_ARG_DECL_NOT_USED)
+ {
+ }
+
+ void
+ IdUniquenessStrategyMultiple::strategy_cleanup(
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ {
+ }
+
+ bool
+ IdUniquenessStrategyMultiple::is_servant_activation_allowed (
+ PortableServer::Servant /*servant*/,
+ int & /*wait_occurred_restart_call*/)
+ {
+ // With the multiple id strategy we can always activate the servant
+ // another time
+ return true;
+ }
+
+ bool
+ IdUniquenessStrategyMultiple::allow_multiple_activations (void) const
+ {
+ return true;
+ }
+
+ ::PortableServer::IdUniquenessPolicyValue
+ IdUniquenessStrategyMultiple::type() const
+ {
+ return ::PortableServer::MULTIPLE_ID;
+ }
+
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_FACTORY_NAMESPACE_DEFINE (
+ ACE_Local_Service,
+ IdUniquenessStrategyMultiple,
+ TAO::Portable_Server::IdUniquenessStrategyMultiple)
+
+ACE_STATIC_SVC_DEFINE (
+ IdUniquenessStrategyMultiple,
+ ACE_TEXT ("IdUniquenessStrategyMultiple"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (IdUniquenessStrategyMultiple),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0)
diff --git a/TAO/tao/PortableServer/IdUniquenessStrategyMultiple.h b/TAO/tao/PortableServer/IdUniquenessStrategyMultiple.h
new file mode 100644
index 00000000000..f3c2e405447
--- /dev/null
+++ b/TAO/tao/PortableServer/IdUniquenessStrategyMultiple.h
@@ -0,0 +1,59 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file IdUniquenessStrategyMultiple.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_ID_UNIQUENESSSTRATEGY_MULITPLE_H
+#define TAO_ID_UNIQUENESSSTRATEGY_MULITPLE_H
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/IdUniquenessStrategy.h"
+#include "ace/Service_Config.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ class TAO_PortableServer_Export IdUniquenessStrategyMultiple
+ : public IdUniquenessStrategy
+ {
+ public:
+ virtual void strategy_init (TAO_Root_POA *poa ACE_ENV_ARG_DECL);
+
+ virtual void strategy_cleanup (ACE_ENV_SINGLE_ARG_DECL);
+
+ virtual bool is_servant_activation_allowed (
+ PortableServer::Servant servant,
+ int &w);
+
+ virtual bool allow_multiple_activations (void) const;
+
+ virtual ::PortableServer::IdUniquenessPolicyValue type() const;
+ };
+
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE_EXPORT (TAO_PortableServer, IdUniquenessStrategyMultiple)
+ACE_FACTORY_DECLARE (TAO_PortableServer, IdUniquenessStrategyMultiple)
+
+
+#include /**/ "ace/post.h"
+#endif /* TAO_ID_UNIQUENESSSTRATEGY_MULITPLE_H */
diff --git a/TAO/tao/PortableServer/IdUniquenessStrategyUnique.cpp b/TAO/tao/PortableServer/IdUniquenessStrategyUnique.cpp
new file mode 100644
index 00000000000..3c5516d4956
--- /dev/null
+++ b/TAO/tao/PortableServer/IdUniquenessStrategyUnique.cpp
@@ -0,0 +1,79 @@
+// $Id$
+
+#include "tao/PortableServer/IdUniquenessStrategyUnique.h"
+#include "tao/PortableServer/Root_POA.h"
+
+ACE_RCSID (PortableServer,
+ Id_Uniqueness_Strategy,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ IdUniquenessStrategyUnique::IdUniquenessStrategyUnique (void) :
+ poa_ (0)
+ {
+ }
+
+ void
+ IdUniquenessStrategyUnique::strategy_init (
+ TAO_Root_POA *poa
+ ACE_ENV_ARG_DECL_NOT_USED)
+ {
+ poa_ = poa;
+ }
+
+ void
+ IdUniquenessStrategyUnique::strategy_cleanup (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ {
+ poa_ = 0;
+ }
+
+ bool
+ IdUniquenessStrategyUnique::is_servant_activation_allowed (
+ PortableServer::Servant servant,
+ int &wait_occurred_restart_call)
+ {
+ // If the specified servant is already in the Active Object Map, the
+ // ServantAlreadyActive exception is raised.
+ int result =
+ this->poa_->is_servant_active (servant,
+ wait_occurred_restart_call);
+
+ return (!(result || wait_occurred_restart_call));
+ }
+
+ bool
+ IdUniquenessStrategyUnique::allow_multiple_activations (void) const
+ {
+ return false;
+ }
+
+ ::PortableServer::IdUniquenessPolicyValue
+ IdUniquenessStrategyUnique::type() const
+ {
+ return ::PortableServer::UNIQUE_ID;
+ }
+
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_FACTORY_NAMESPACE_DEFINE (
+ ACE_Local_Service,
+ IdUniquenessStrategyUnique,
+ TAO::Portable_Server::IdUniquenessStrategyUnique)
+
+ACE_STATIC_SVC_DEFINE (
+ IdUniquenessStrategyUnique,
+ ACE_TEXT ("IdUniquenessStrategyUnique"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (IdUniquenessStrategyUnique),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0)
diff --git a/TAO/tao/PortableServer/IdUniquenessStrategyUnique.h b/TAO/tao/PortableServer/IdUniquenessStrategyUnique.h
new file mode 100644
index 00000000000..58bbf096de5
--- /dev/null
+++ b/TAO/tao/PortableServer/IdUniquenessStrategyUnique.h
@@ -0,0 +1,65 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file IdUniquenessStrategyUnique.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_ID_UNIQUENESSSTRATEGYUNIQUE_H
+#define TAO_ID_UNIQUENESSSTRATEGYUNIQUE_H
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/IdUniquenessStrategy.h"
+#include "ace/Service_Config.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ class TAO_PortableServer_Export IdUniquenessStrategyUnique
+ : public IdUniquenessStrategy
+ {
+ public:
+ IdUniquenessStrategyUnique (void);
+
+ virtual void strategy_init (TAO_Root_POA *poa
+ ACE_ENV_ARG_DECL);
+
+ virtual void strategy_cleanup (ACE_ENV_SINGLE_ARG_DECL);
+
+ virtual bool is_servant_activation_allowed (
+ PortableServer::Servant servant,
+ int &wait_occurred_restart_call);
+
+ virtual bool allow_multiple_activations (void) const;
+
+ virtual ::PortableServer::IdUniquenessPolicyValue type() const;
+
+ private:
+ TAO_Root_POA* poa_;
+ };
+
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE_EXPORT (TAO_PortableServer, IdUniquenessStrategyUnique)
+ACE_FACTORY_DECLARE (TAO_PortableServer, IdUniquenessStrategyUnique)
+
+
+#include /**/ "ace/post.h"
+#endif /* TAO_ID_UNIQUENESSSTRATEGYUNIQUE_H */
diff --git a/TAO/tao/PortableServer/IdUniquenessStrategyUniqueFactoryImpl.cpp b/TAO/tao/PortableServer/IdUniquenessStrategyUniqueFactoryImpl.cpp
new file mode 100644
index 00000000000..b29178c143f
--- /dev/null
+++ b/TAO/tao/PortableServer/IdUniquenessStrategyUniqueFactoryImpl.cpp
@@ -0,0 +1,68 @@
+// $Id$
+
+#include "tao/PortableServer/IdUniquenessStrategyUniqueFactoryImpl.h"
+#include "tao/PortableServer/IdUniquenessStrategyUnique.h"
+#include "ace/Dynamic_Service.h"
+
+ACE_RCSID (PortableServer,
+ IdUniquenessStrategyUniqueFactoryImpl,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ IdUniquenessStrategy*
+ IdUniquenessStrategyUniqueFactoryImpl::create (
+ ::PortableServer::IdUniquenessPolicyValue value)
+ {
+ IdUniquenessStrategy* strategy = 0;
+
+ switch (value)
+ {
+ case ::PortableServer::UNIQUE_ID :
+ {
+ ACE_NEW_RETURN (strategy, IdUniquenessStrategyUnique, 0);
+ break;
+ }
+ case ::PortableServer::MULTIPLE_ID :
+ {
+ ACE_ERROR ((LM_ERROR, "Incorrect type in IdUniquenessStrategyUniqueFactoryImpl"));
+ break;
+ }
+ }
+
+ return strategy;
+ }
+
+ void
+ IdUniquenessStrategyUniqueFactoryImpl::destroy (
+ IdUniquenessStrategy *strategy
+ ACE_ENV_ARG_DECL)
+ {
+ strategy->strategy_cleanup (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ delete strategy;
+ }
+
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DEFINE (
+ IdUniquenessStrategyUniqueFactoryImpl,
+ ACE_TEXT ("IdUniquenessStrategyUniqueFactory"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (IdUniquenessStrategyUniqueFactoryImpl),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0)
+
+ACE_FACTORY_NAMESPACE_DEFINE (
+ ACE_Local_Service,
+ IdUniquenessStrategyUniqueFactoryImpl,
+ TAO::Portable_Server::IdUniquenessStrategyUniqueFactoryImpl)
+
diff --git a/TAO/tao/PortableServer/IdUniquenessStrategyUniqueFactoryImpl.h b/TAO/tao/PortableServer/IdUniquenessStrategyUniqueFactoryImpl.h
new file mode 100644
index 00000000000..721ae2a6eb9
--- /dev/null
+++ b/TAO/tao/PortableServer/IdUniquenessStrategyUniqueFactoryImpl.h
@@ -0,0 +1,55 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file IdUniquenessStrategyUniqueFactoryImpl.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_PORTABLESERVER_IDUNIQUENESSSTRATEGYUNIQUEFACTORYIMPL_H
+#define TAO_PORTABLESERVER_IDUNIQUENESSSTRATEGYUNIQUEFACTORYIMPL_H
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/Service_Config.h"
+#include "tao/PortableServer/IdUniquenessStrategyFactory.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ class TAO_PortableServer_Export IdUniquenessStrategyUniqueFactoryImpl
+ : public IdUniquenessStrategyFactory
+ {
+ public:
+ /// Create a new strategy
+ virtual IdUniquenessStrategy* create (
+ ::PortableServer::IdUniquenessPolicyValue value);
+
+ virtual void destroy (
+ IdUniquenessStrategy *strategy
+ ACE_ENV_ARG_DECL);
+ };
+
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE_EXPORT (TAO_PortableServer, IdUniquenessStrategyUniqueFactoryImpl)
+ACE_FACTORY_DECLARE (TAO_PortableServer, IdUniquenessStrategyUniqueFactoryImpl)
+
+
+#include /**/ "ace/post.h"
+#endif /* TAO_PORTABLESERVER_IDUNIQUENESSSTRATEGYUNIQUEFACTORYIMPL_H */
diff --git a/TAO/tao/PortableServer/ImR_Client_Adapter.cpp b/TAO/tao/PortableServer/ImR_Client_Adapter.cpp
new file mode 100644
index 00000000000..c5a9d148f85
--- /dev/null
+++ b/TAO/tao/PortableServer/ImR_Client_Adapter.cpp
@@ -0,0 +1,21 @@
+// $Id$
+
+#include "tao/PortableServer/ImR_Client_Adapter.h"
+
+ACE_RCSID (tao,
+ ImR_Client_Adapter,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ ImR_Client_Adapter::~ImR_Client_Adapter (void)
+ {
+ }
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/ImR_Client_Adapter.h b/TAO/tao/PortableServer/ImR_Client_Adapter.h
new file mode 100644
index 00000000000..e5b55bd6077
--- /dev/null
+++ b/TAO/tao/PortableServer/ImR_Client_Adapter.h
@@ -0,0 +1,65 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file ImR_Client_Adapter.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+
+#ifndef TAO_IMR_CLIENT_ADAPTER_H
+#define TAO_IMR_CLIENT_ADAPTER_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/Service_Object.h"
+#include "ace/CORBA_macros.h"
+#include "tao/orbconf.h"
+#include "tao/Environment.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Root_POA;
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ /**
+ * @class ImR_Client_Adapter
+ *
+ * @brief IFR_Client_Adapter.
+ *
+ * Class that adapts various functions in the PortableServer library
+ * which use the Implementation Repository. This is a base class for
+ * the actual implementation in the TAO_IMR_Client library.
+ */
+ class TAO_PortableServer_Export ImR_Client_Adapter :
+ public ACE_Service_Object
+ {
+ public:
+ virtual ~ImR_Client_Adapter (void);
+
+ /// ImplRepo helper method, notify the ImplRepo on startup
+ virtual void imr_notify_startup (TAO_Root_POA* poa ACE_ENV_ARG_DECL) = 0;
+
+ /// ImplRepo helper method, notify the ImplRepo on shutdown
+ virtual void imr_notify_shutdown (TAO_Root_POA* poa ACE_ENV_ARG_DECL) = 0;
+ };
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_IMR_CLIENT_ADAPTER_H */
diff --git a/TAO/tao/PortableServer/ImplicitActivationPolicy.cpp b/TAO/tao/PortableServer/ImplicitActivationPolicy.cpp
new file mode 100644
index 00000000000..c683f2640c7
--- /dev/null
+++ b/TAO/tao/PortableServer/ImplicitActivationPolicy.cpp
@@ -0,0 +1,71 @@
+#include "tao/PortableServer/ImplicitActivationPolicy.h"
+#include "tao/PortableServer/PortableServer.h"
+
+ACE_RCSID (PortableServer,
+ ImplicitActivationPolicy,
+ "$Id$")
+
+#if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ ImplicitActivationPolicy::ImplicitActivationPolicy (
+ ::PortableServer::ImplicitActivationPolicyValue value) :
+ value_ (value)
+ {
+ }
+
+ CORBA::Policy_ptr
+ ImplicitActivationPolicy::copy (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ ImplicitActivationPolicy *copy = 0;
+ ACE_NEW_THROW_EX (copy,
+ ImplicitActivationPolicy (this->value_),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+
+ return copy;
+ }
+
+ void
+ ImplicitActivationPolicy::destroy (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ }
+
+ ::PortableServer::ImplicitActivationPolicyValue
+ ImplicitActivationPolicy::value (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ return value_;
+ }
+
+ CORBA::PolicyType
+ ImplicitActivationPolicy::policy_type (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ return ::PortableServer::IMPLICIT_ACTIVATION_POLICY_ID;
+ }
+
+ TAO_Cached_Policy_Type
+ ImplicitActivationPolicy::_tao_cached_type (void) const
+ {
+ return TAO_CACHED_POLICY_IMPLICIT_ACTIVATION;
+ }
+
+ TAO_Policy_Scope
+ ImplicitActivationPolicy::_tao_scope (void) const
+ {
+ return TAO_POLICY_POA_SCOPE;
+ }
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_MINIMUM_POA == 0 && !CORBA_E_COMPACT && !CORBA_E_MICRO */
diff --git a/TAO/tao/PortableServer/ImplicitActivationPolicy.h b/TAO/tao/PortableServer/ImplicitActivationPolicy.h
new file mode 100644
index 00000000000..fb0a3d99179
--- /dev/null
+++ b/TAO/tao/PortableServer/ImplicitActivationPolicy.h
@@ -0,0 +1,81 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file ImplicitActivationPolicy.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_PORTABLESERVER_IMPLICITACTIVATIONPOLICY_H
+#define TAO_PORTABLESERVER_IMPLICITACTIVATIONPOLICY_H
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/ImplicitActivationPolicyC.h"
+#include "tao/LocalObject.h"
+
+// This is to remove "inherits via dominance" warnings from MSVC.
+// MSVC is being a little too paranoid.
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+#if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ class TAO_PortableServer_Export ImplicitActivationPolicy
+ : public virtual ::PortableServer::ImplicitActivationPolicy,
+ public virtual TAO_Local_RefCounted_Object
+ {
+ public:
+ ImplicitActivationPolicy (::PortableServer::ImplicitActivationPolicyValue value);
+
+ CORBA::Policy_ptr copy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ void destroy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ ::PortableServer::ImplicitActivationPolicyValue value (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ CORBA::PolicyType policy_type (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Return the cached policy type for this policy.
+ virtual TAO_Cached_Policy_Type _tao_cached_type (void) const;
+
+ /// Returns the scope at which this policy can be applied. See orbconf.h.
+ virtual TAO_Policy_Scope _tao_scope (void) const;
+
+ private:
+ ::PortableServer::ImplicitActivationPolicyValue value_;
+ };
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_MINIMUM_POA == 0 && !CORBA_E_COMPACT && !CORBA_E_MICRO */
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_PORTABLESERVER_IMPLICITACTIVATIONPOLICY_H */
diff --git a/TAO/tao/PortableServer/ImplicitActivationPolicy.pidl b/TAO/tao/PortableServer/ImplicitActivationPolicy.pidl
new file mode 100644
index 00000000000..041c2344015
--- /dev/null
+++ b/TAO/tao/PortableServer/ImplicitActivationPolicy.pidl
@@ -0,0 +1,35 @@
+/**
+ * @file ImplicitActivationPolicy.pidl
+ *
+ * $Id$
+ *
+ * @brief PIDL source for the PortableServer module.
+ */
+
+#ifndef _PORTABLESERVER_IMPLICITACTIVATIONPOLICY_IDL_
+#define _PORTABLESERVER_IMPLICITACTIVATIONPOLICY_IDL_
+
+#include "tao/Policy.pidl"
+
+#pragma prefix "omg.org"
+
+module PortableServer
+{
+# pragma version PortableServer 2.3
+
+ enum ImplicitActivationPolicyValue
+ {
+ IMPLICIT_ACTIVATION,
+ NO_IMPLICIT_ACTIVATION
+ };
+
+#if !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO) && ! defined (TAO_HAS_MINIMUM_POA)
+ local interface ImplicitActivationPolicy : CORBA::Policy
+ {
+ readonly attribute ImplicitActivationPolicyValue value;
+ };
+#endif
+};
+
+
+#endif // _PORTABLESERVER_IMPLICITACTIVATIONPOLICY_IDL_
diff --git a/TAO/tao/PortableServer/ImplicitActivationStrategy.cpp b/TAO/tao/PortableServer/ImplicitActivationStrategy.cpp
new file mode 100644
index 00000000000..f2761572e36
--- /dev/null
+++ b/TAO/tao/PortableServer/ImplicitActivationStrategy.cpp
@@ -0,0 +1,31 @@
+// -*- C++ -*-
+
+#include "tao/PortableServer/ImplicitActivationStrategy.h"
+
+ACE_RCSID (PortableServer,
+ ImplicitActivationStrategy,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ void
+ ImplicitActivationStrategy::strategy_init (
+ TAO_Root_POA * /*poa*/
+ ACE_ENV_ARG_DECL_NOT_USED)
+ {
+ // dependent on type create the correct strategy.
+ }
+
+ void
+ ImplicitActivationStrategy::strategy_cleanup(
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ {
+ }
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/ImplicitActivationStrategy.h b/TAO/tao/PortableServer/ImplicitActivationStrategy.h
new file mode 100644
index 00000000000..22ca61b5cbf
--- /dev/null
+++ b/TAO/tao/PortableServer/ImplicitActivationStrategy.h
@@ -0,0 +1,45 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file ImplicitActivationStrategy.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_ACTIVATION_STRATEGY_H
+#define TAO_ACTIVATION_STRATEGY_H
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/Policy_Strategy.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ class ImplicitActivationStrategy
+ : public Policy_Strategy
+ {
+ public:
+ virtual void strategy_init(TAO_Root_POA *poa ACE_ENV_ARG_DECL);
+
+ virtual void strategy_cleanup(ACE_ENV_SINGLE_ARG_DECL);
+
+ virtual bool allow_implicit_activation (void) const = 0;
+ };
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_ACTIVATION_STRATEGY_H */
diff --git a/TAO/tao/PortableServer/ImplicitActivationStrategyExplicit.cpp b/TAO/tao/PortableServer/ImplicitActivationStrategyExplicit.cpp
new file mode 100644
index 00000000000..09ca4fb613e
--- /dev/null
+++ b/TAO/tao/PortableServer/ImplicitActivationStrategyExplicit.cpp
@@ -0,0 +1,38 @@
+// -*- C++ -*-
+
+#include "tao/PortableServer/ImplicitActivationStrategyExplicit.h"
+
+ACE_RCSID (PortableServer,
+ ImplicitActivationStrategyExplicit,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ bool
+ ImplicitActivationStrategyExplicit::allow_implicit_activation (void) const
+ {
+ return false;
+ }
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+
+ACE_FACTORY_NAMESPACE_DEFINE (
+ ACE_Local_Service,
+ ImplicitActivationStrategyExplicit,
+ TAO::Portable_Server::ImplicitActivationStrategyExplicit)
+
+ACE_STATIC_SVC_DEFINE (
+ ImplicitActivationStrategyExplicit,
+ ACE_TEXT ("ImplicitActivationStrategyExplicit"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (ImplicitActivationStrategyExplicit),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0)
+
diff --git a/TAO/tao/PortableServer/ImplicitActivationStrategyExplicit.h b/TAO/tao/PortableServer/ImplicitActivationStrategyExplicit.h
new file mode 100644
index 00000000000..af9e70e931e
--- /dev/null
+++ b/TAO/tao/PortableServer/ImplicitActivationStrategyExplicit.h
@@ -0,0 +1,48 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file ImplicitActivationStrategyExplicit.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_IMPLICITACTIVATIONSTRATEGYEXPLICIT_H
+#define TAO_IMPLICITACTIVATIONSTRATEGYEXPLICIT_H
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/ImplicitActivationStrategy.h"
+#include "ace/Service_Config.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ class ImplicitActivationStrategyExplicit :
+ public ImplicitActivationStrategy
+ {
+ public:
+ virtual bool allow_implicit_activation (void) const;
+ };
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+
+ACE_STATIC_SVC_DECLARE_EXPORT (TAO_PortableServer, ImplicitActivationStrategyExplicit)
+ACE_FACTORY_DECLARE (TAO_PortableServer, ImplicitActivationStrategyExplicit)
+
+#include /**/ "ace/post.h"
+#endif /* TAO_IMPLICITACTIVATIONSTRATEGYEXPLICIT_H */
diff --git a/TAO/tao/PortableServer/ImplicitActivationStrategyFactory.h b/TAO/tao/PortableServer/ImplicitActivationStrategyFactory.h
new file mode 100644
index 00000000000..f5d1a8aa5f4
--- /dev/null
+++ b/TAO/tao/PortableServer/ImplicitActivationStrategyFactory.h
@@ -0,0 +1,52 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file ImplicitActivationStrategyFactory.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_PORTABLESERVER_IMPLICITACTIVATIONSTRATEGYFACTORY_H
+#define TAO_PORTABLESERVER_IMPLICITACTIVATIONSTRATEGYFACTORY_H
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/StrategyFactory.h"
+#include "tao/PortableServer/ImplicitActivationPolicyC.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ class ImplicitActivationStrategy;
+
+ class TAO_PortableServer_Export ImplicitActivationStrategyFactory
+ : public StrategyFactory
+ {
+ public:
+ /// Create a new servant retention strategy
+ virtual ImplicitActivationStrategy* create (
+ ::PortableServer::ImplicitActivationPolicyValue value) = 0;
+
+ virtual void destroy (
+ ImplicitActivationStrategy *strategy
+ ACE_ENV_ARG_DECL) = 0;
+ };
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_PORTABLESERVER_IMPLICITACTIVATIONSTRATEGYFACTORY_H */
diff --git a/TAO/tao/PortableServer/ImplicitActivationStrategyFactoryImpl.cpp b/TAO/tao/PortableServer/ImplicitActivationStrategyFactoryImpl.cpp
new file mode 100644
index 00000000000..0fa7771687c
--- /dev/null
+++ b/TAO/tao/PortableServer/ImplicitActivationStrategyFactoryImpl.cpp
@@ -0,0 +1,75 @@
+// $Id$
+
+#include "tao/PortableServer/ImplicitActivationStrategyFactoryImpl.h"
+#include "ace/Dynamic_Service.h"
+#include "tao/PortableServer/ImplicitActivationStrategyImplicit.h"
+#include "tao/PortableServer/ImplicitActivationStrategyExplicit.h"
+
+ACE_RCSID (PortableServer,
+ ImplicitActivationStrategyFactoryImpl,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ ImplicitActivationStrategy*
+ ImplicitActivationStrategyFactoryImpl::create (
+ ::PortableServer::ImplicitActivationPolicyValue value)
+ {
+ ImplicitActivationStrategy* strategy = 0;
+ const char * strategy_name = 0;
+
+ switch (value)
+ {
+ case ::PortableServer::IMPLICIT_ACTIVATION :
+ {
+ strategy_name = "ImplicitActivationStrategyImplicit";
+ break;
+ }
+ case ::PortableServer::NO_IMPLICIT_ACTIVATION :
+ {
+ strategy_name = "ImplicitActivationStrategyExplicit";
+ break;
+ }
+ }
+
+ strategy =
+ ACE_Dynamic_Service<ImplicitActivationStrategy>::instance (strategy_name);
+
+ if (strategy == 0)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) ERROR, Unable to get %s\n"),
+ strategy_name));
+
+ return strategy;
+ }
+
+ void
+ ImplicitActivationStrategyFactoryImpl::destroy (
+ ImplicitActivationStrategy * /*strategy*/
+ ACE_ENV_ARG_DECL_NOT_USED)
+ {
+ // Noop because both types are singletons
+ }
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_FACTORY_NAMESPACE_DEFINE (
+ ACE_Local_Service,
+ ImplicitActivationStrategyFactoryImpl,
+ TAO_VERSIONED_NAMESPACE_NAME::TAO::Portable_Server::ImplicitActivationStrategyFactoryImpl)
+
+
+ACE_STATIC_SVC_DEFINE (
+ ImplicitActivationStrategyFactoryImpl,
+ ACE_TEXT ("ImplicitActivationStrategyFactory"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (ImplicitActivationStrategyFactoryImpl),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0)
+
diff --git a/TAO/tao/PortableServer/ImplicitActivationStrategyFactoryImpl.h b/TAO/tao/PortableServer/ImplicitActivationStrategyFactoryImpl.h
new file mode 100644
index 00000000000..6b9e87ef7f3
--- /dev/null
+++ b/TAO/tao/PortableServer/ImplicitActivationStrategyFactoryImpl.h
@@ -0,0 +1,54 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file ImplicitActivationStrategyFactoryImpl.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_PORTABLESERVER_IMPLICITACTIVATIONSTRATEGYFACTORYIMPL_H
+#define TAO_PORTABLESERVER_IMPLICITACTIVATIONSTRATEGYFACTORYIMPL_H
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/Service_Config.h"
+#include "tao/PortableServer/ImplicitActivationStrategyFactory.h"
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ class ImplicitActivationStrategyFactoryImpl
+ : public ImplicitActivationStrategyFactory
+ {
+ public:
+ /// Create a new servant retention strategy
+ virtual ImplicitActivationStrategy* create (
+ ::PortableServer::ImplicitActivationPolicyValue value);
+
+ virtual void destroy (
+ ImplicitActivationStrategy *strategy
+ ACE_ENV_ARG_DECL);
+ };
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE_EXPORT (TAO_PortableServer, ImplicitActivationStrategyFactoryImpl)
+ACE_FACTORY_DECLARE (TAO_PortableServer, ImplicitActivationStrategyFactoryImpl)
+
+#include /**/ "ace/post.h"
+#endif /* TAO_PORTABLESERVER_IMPLICITACTIVATIONSTRATEGYFACTORYIMPL_H */
diff --git a/TAO/tao/PortableServer/ImplicitActivationStrategyImplicit.cpp b/TAO/tao/PortableServer/ImplicitActivationStrategyImplicit.cpp
new file mode 100644
index 00000000000..551d6f45bdf
--- /dev/null
+++ b/TAO/tao/PortableServer/ImplicitActivationStrategyImplicit.cpp
@@ -0,0 +1,39 @@
+// -*- C++ -*-
+
+#include "tao/PortableServer/ImplicitActivationStrategyImplicit.h"
+
+ACE_RCSID (PortableServer,
+ ImplicitActivationStrategyImplicit,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ bool
+ ImplicitActivationStrategyImplicit::allow_implicit_activation (void) const
+ {
+ return true;
+ }
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_FACTORY_NAMESPACE_DEFINE (
+ ACE_Local_Service,
+ ImplicitActivationStrategyImplicit,
+ TAO::Portable_Server::ImplicitActivationStrategyImplicit)
+
+ACE_STATIC_SVC_DEFINE (
+ ImplicitActivationStrategyImplicit,
+ ACE_TEXT ("ImplicitActivationStrategyImplicit"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (ImplicitActivationStrategyImplicit),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0)
+
+
diff --git a/TAO/tao/PortableServer/ImplicitActivationStrategyImplicit.h b/TAO/tao/PortableServer/ImplicitActivationStrategyImplicit.h
new file mode 100644
index 00000000000..92f9feab992
--- /dev/null
+++ b/TAO/tao/PortableServer/ImplicitActivationStrategyImplicit.h
@@ -0,0 +1,48 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file ImplicitActivationStrategyImplicit.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_IMPLICITACTIVATIONSTRATEGYIMPLICIT_H
+#define TAO_IMPLICITACTIVATIONSTRATEGYIMPLICIT_H
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/ImplicitActivationStrategy.h"
+#include "ace/Service_Config.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ class TAO_PortableServer_Export ImplicitActivationStrategyImplicit
+ : public ImplicitActivationStrategy
+ {
+ public:
+ virtual bool allow_implicit_activation (void) const;
+ };
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE_EXPORT (TAO_PortableServer, ImplicitActivationStrategyImplicit)
+ACE_FACTORY_DECLARE (TAO_PortableServer, ImplicitActivationStrategyImplicit)
+
+
+#include /**/ "ace/post.h"
+#endif /* TAO_IMPLICITACTIVATIONSTRATEGYIMPLICIT_H */
diff --git a/TAO/tao/PortableServer/Key_Adapters.cpp b/TAO/tao/PortableServer/Key_Adapters.cpp
new file mode 100644
index 00000000000..9263e4470fc
--- /dev/null
+++ b/TAO/tao/PortableServer/Key_Adapters.cpp
@@ -0,0 +1,152 @@
+// $Id$
+
+#include "tao/PortableServer/Key_Adapters.h"
+
+#include "ace/ACE.h"
+#include "ace/OS_NS_string.h"
+#include "ace/Map_T.h"
+
+ACE_RCSID (PortableServer,
+ Key_Adapters,
+ "$Id$")
+
+///////////////////////////////////////////////////////////////////////////////
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Incremental_Key_Generator::TAO_Incremental_Key_Generator (void)
+ : counter_ (0)
+{
+}
+
+int
+TAO_Incremental_Key_Generator::operator() (PortableServer::ObjectId &id)
+{
+ // Resize to accommodate the counter.
+ id.length (sizeof this->counter_);
+
+ // Add new key data.
+ ACE_OS::memcpy (id.get_buffer (),
+ &++this->counter_,
+ sizeof this->counter_);
+
+ // Success.
+ return 0;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+
+u_long
+TAO_ObjectId_Hash::operator () (const PortableServer::ObjectId &id) const
+{
+ return ACE::hash_pjw ((const char *) id.get_buffer (),
+ id.length ());
+}
+
+////////////////////////////////////////////////////////////////////////////////
+
+int
+TAO_Ignore_Original_Key_Adapter::encode (const PortableServer::ObjectId &original_key,
+ const ACE_Active_Map_Manager_Key &active_key,
+ PortableServer::ObjectId &modified_key)
+{
+ ACE_UNUSED_ARG (original_key);
+
+ // Size of active key.
+ size_t active_key_size = active_key.size ();
+
+ // Resize to accommodate both the original data and the new active key.
+ modified_key.length (static_cast <CORBA::ULong> (active_key_size));
+
+ // Copy active key data into user key.
+ active_key.encode (modified_key.get_buffer ());
+
+ // Success.
+ return 0;
+}
+
+int
+TAO_Ignore_Original_Key_Adapter::decode (const PortableServer::ObjectId &modified_key,
+ ACE_Active_Map_Manager_Key &active_key)
+{
+ // Read off value of index and generation.
+ active_key.decode (modified_key.get_buffer ());
+
+ // Success.
+ return 0;
+}
+
+int
+TAO_Ignore_Original_Key_Adapter::decode (const PortableServer::ObjectId &modified_key,
+ PortableServer::ObjectId &original_key)
+{
+ // Smartly copy all the data; <original_key does not own the data>.
+ original_key.replace (modified_key.maximum (),
+ modified_key.length (),
+ const_cast <CORBA::Octet *>
+ (modified_key.get_buffer ()),
+ 0);
+
+ // Success.
+ return 0;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+
+int
+TAO_Preserve_Original_Key_Adapter::encode (const PortableServer::ObjectId &original_key,
+ const ACE_Active_Map_Manager_Key &active_key,
+ PortableServer::ObjectId &modified_key)
+{
+ // Size of active key.
+ size_t active_key_size = active_key.size ();
+
+ // Resize to accommodate both the original data and the new active key.
+ modified_key.length (static_cast <CORBA::ULong> (active_key_size)
+ + original_key.length ());
+
+ // Copy active key data into user key.
+ active_key.encode (modified_key.get_buffer ());
+
+ // Copy the original key after the active key.
+ ACE_OS::memcpy (modified_key.get_buffer () + active_key_size,
+ original_key.get_buffer (),
+ original_key.length ());
+
+ // Success.
+ return 0;
+}
+
+int
+TAO_Preserve_Original_Key_Adapter::decode (const PortableServer::ObjectId &modified_key,
+ ACE_Active_Map_Manager_Key &active_key)
+{
+ // Read off value of index and generation.
+ active_key.decode (modified_key.get_buffer ());
+
+ // Success.
+ return 0;
+}
+
+int
+TAO_Preserve_Original_Key_Adapter::decode (const PortableServer::ObjectId &modified_key,
+ PortableServer::ObjectId &original_key)
+{
+ // Size of active key.
+ size_t active_key_size = ACE_Active_Map_Manager_Key::size ();
+
+ // Smartly copy all the data; <original_key does not own the data>.
+ original_key.replace (static_cast <CORBA::ULong>
+ (modified_key.maximum () - active_key_size),
+ static_cast <CORBA::ULong>
+ (modified_key.length () - active_key_size),
+ const_cast <CORBA::Octet *>
+ (modified_key.get_buffer ()) + active_key_size,
+ 0);
+
+ // Success.
+ return 0;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
diff --git a/TAO/tao/PortableServer/Key_Adapters.h b/TAO/tao/PortableServer/Key_Adapters.h
new file mode 100644
index 00000000000..ac5881a10fa
--- /dev/null
+++ b/TAO/tao/PortableServer/Key_Adapters.h
@@ -0,0 +1,129 @@
+/* -*- C++ -*- */
+
+//=============================================================================
+/**
+ * @file Key_Adapters.h
+ *
+ * $Id$
+ *
+ * @author Irfan Pyarali
+ */
+//=============================================================================
+
+#ifndef TAO_KEY_ADAPTERS_H
+#define TAO_KEY_ADAPTERS_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/PS_ForwardC.h"
+
+ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+class ACE_Active_Map_Manager_Key;
+ACE_END_VERSIONED_NAMESPACE_DECL
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+///////////////////////////////////////////////////////////////////////////////
+
+/**
+ * @class TAO_Incremental_Key_Generator
+ *
+ * @brief Defines a key generator.
+ *
+ * This class is used in adapters of maps that do not produce keys.
+ */
+class TAO_Incremental_Key_Generator
+{
+public:
+
+ TAO_Incremental_Key_Generator (void);
+
+ int operator() (PortableServer::ObjectId &id);
+
+protected:
+
+ CORBA::ULong counter_;
+};
+
+////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * @class TAO_ObjectId_Hash
+ *
+ * @brief Hashing class for Object Ids.
+ *
+ * Define the hash() method for Object Ids.
+ */
+class TAO_PortableServer_Export TAO_ObjectId_Hash
+{
+public:
+
+ /// Returns hash value.
+ u_long operator () (const PortableServer::ObjectId &id) const;
+};
+
+////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * @class TAO_Ignore_Original_Key_Adapter
+ *
+ * @brief A key adapter (encode/decode) class.
+ *
+ * Define the encoding and decoding methods for converting
+ * between Object Ids and active keys. This class ignores the
+ * <original_key> passed to it.
+ */
+class TAO_Ignore_Original_Key_Adapter
+{
+public:
+
+ int encode (const PortableServer::ObjectId &original_key,
+ const ACE_Active_Map_Manager_Key &active_key,
+ PortableServer::ObjectId &modified_key);
+
+ int decode (const PortableServer::ObjectId &modified_key,
+ ACE_Active_Map_Manager_Key &active_key);
+
+ int decode (const PortableServer::ObjectId &modified_key,
+ PortableServer::ObjectId &original_key);
+};
+
+////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * @class TAO_Preserve_Original_Key_Adapter
+ *
+ * @brief A key adapter (encode/decode) class.
+ *
+ * Define the encoding and decoding methods for converting
+ * between Object Ids and active keys. This class remembers the
+ * <original_key> passed to it.
+ */
+class TAO_Preserve_Original_Key_Adapter
+{
+public:
+
+ int encode (const PortableServer::ObjectId &original_key,
+ const ACE_Active_Map_Manager_Key &active_key,
+ PortableServer::ObjectId &modified_key);
+
+ int decode (const PortableServer::ObjectId &modified_key,
+ ACE_Active_Map_Manager_Key &active_key);
+
+ int decode (const PortableServer::ObjectId &modified_key,
+ PortableServer::ObjectId &original_key);
+};
+
+///////////////////////////////////////////////////////////////////////////////
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_KEY_ADAPTERS_H */
diff --git a/TAO/tao/PortableServer/LifespanPolicy.cpp b/TAO/tao/PortableServer/LifespanPolicy.cpp
new file mode 100644
index 00000000000..b61dd7b3cbb
--- /dev/null
+++ b/TAO/tao/PortableServer/LifespanPolicy.cpp
@@ -0,0 +1,71 @@
+#include "tao/PortableServer/LifespanPolicy.h"
+#include "tao/PortableServer/PortableServer.h"
+
+ACE_RCSID (PortableServer,
+ LifespanPolicy,
+ "$Id$")
+
+#if !defined (CORBA_E_MICRO)
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ LifespanPolicy::LifespanPolicy (
+ ::PortableServer::LifespanPolicyValue value) :
+ value_ (value)
+ {
+ }
+
+ CORBA::Policy_ptr
+ LifespanPolicy::copy (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ LifespanPolicy *copy = 0;
+ ACE_NEW_THROW_EX (copy,
+ LifespanPolicy (this->value_),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+
+ return copy;
+ }
+
+ void
+ LifespanPolicy::destroy (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ }
+
+ ::PortableServer::LifespanPolicyValue
+ LifespanPolicy::value (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ return value_;
+ }
+
+ CORBA::PolicyType
+ LifespanPolicy::policy_type (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ return ::PortableServer::LIFESPAN_POLICY_ID;
+ }
+
+ TAO_Cached_Policy_Type
+ LifespanPolicy::_tao_cached_type (void) const
+ {
+ return TAO_CACHED_POLICY_LIFESPAN;
+ }
+
+ TAO_Policy_Scope
+ LifespanPolicy::_tao_scope (void) const
+ {
+ return TAO_POLICY_POA_SCOPE;
+ }
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif
diff --git a/TAO/tao/PortableServer/LifespanPolicy.h b/TAO/tao/PortableServer/LifespanPolicy.h
new file mode 100644
index 00000000000..8782763623f
--- /dev/null
+++ b/TAO/tao/PortableServer/LifespanPolicy.h
@@ -0,0 +1,81 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file LifespanPolicy.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_POA_LIFESPANPOLICY_H
+#define TAO_POA_LIFESPANPOLICY_H
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/LifespanPolicyC.h"
+#include "tao/LocalObject.h"
+
+// This is to remove "inherits via dominance" warnings from MSVC.
+// MSVC is being a little too paranoid.
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+#if !defined (CORBA_E_MICRO)
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ class TAO_PortableServer_Export LifespanPolicy
+ : public virtual ::PortableServer::LifespanPolicy,
+ public virtual TAO_Local_RefCounted_Object
+ {
+ public:
+ LifespanPolicy (::PortableServer::LifespanPolicyValue value);
+
+ CORBA::Policy_ptr copy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ void destroy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ ::PortableServer::LifespanPolicyValue value (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ CORBA::PolicyType policy_type (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Return the cached policy type for this policy.
+ virtual TAO_Cached_Policy_Type _tao_cached_type (void) const;
+
+ /// Returns the scope at which this policy can be applied. See orbconf.h.
+ virtual TAO_Policy_Scope _tao_scope (void) const;
+
+ private:
+ ::PortableServer::LifespanPolicyValue value_;
+ };
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_POA_LIFESPANPOLICY_H */
diff --git a/TAO/tao/PortableServer/LifespanPolicy.pidl b/TAO/tao/PortableServer/LifespanPolicy.pidl
new file mode 100644
index 00000000000..9283b9415f1
--- /dev/null
+++ b/TAO/tao/PortableServer/LifespanPolicy.pidl
@@ -0,0 +1,37 @@
+/**
+ * @file LifespanPolicy.pidl
+ *
+ * $Id$
+ *
+ * @brief PIDL source for the PortableServer module.
+ */
+
+#ifndef _PORTABLESERVER_LIFESPANPOLICY_IDL_
+#define _PORTABLESERVER_LIFESPANPOLICY_IDL_
+
+#include "tao/Policy.pidl"
+
+#pragma prefix "omg.org"
+
+module PortableServer
+{
+# pragma version PortableServer 2.3
+
+ enum LifespanPolicyValue
+ {
+ TRANSIENT,
+ PERSISTENT
+ };
+
+#if !defined (CORBA_E_MICRO)
+
+ local interface LifespanPolicy : CORBA::Policy
+ {
+ readonly attribute LifespanPolicyValue value;
+ };
+
+#endif
+};
+
+
+#endif // _PORTABLESERVER_LIFESPANPOLICY_IDL_
diff --git a/TAO/tao/PortableServer/LifespanStrategy.cpp b/TAO/tao/PortableServer/LifespanStrategy.cpp
new file mode 100644
index 00000000000..aea66e7161c
--- /dev/null
+++ b/TAO/tao/PortableServer/LifespanStrategy.cpp
@@ -0,0 +1,52 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file LifespanStrategy.cpp
+ *
+ * $Id$
+ *
+ */
+//=============================================================================
+
+#include "tao/PortableServer/LifespanStrategy.h"
+
+ACE_RCSID (PortableServer,
+ LifespanStrategy,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ LifespanStrategy::LifespanStrategy () :
+ poa_ (0)
+ {
+ }
+
+ void
+ LifespanStrategy::strategy_init (
+ TAO_Root_POA *poa
+ ACE_ENV_ARG_DECL_NOT_USED)
+ {
+ poa_ = poa;
+ }
+
+ void
+ LifespanStrategy::strategy_cleanup(
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ {
+ poa_ = 0;
+ }
+
+ CORBA::ULong
+ LifespanStrategy::key_type_length (void) const
+ {
+ return sizeof (char);
+ }
+ } /* namespace Portable_Server */
+} /* namespace TAO */
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/LifespanStrategy.h b/TAO/tao/PortableServer/LifespanStrategy.h
new file mode 100644
index 00000000000..895c20335d8
--- /dev/null
+++ b/TAO/tao/PortableServer/LifespanStrategy.h
@@ -0,0 +1,89 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file LifespanStrategy.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_PORTABLESERVER_LIFESPANPOLICY_H
+#define TAO_PORTABLESERVER_LIFESPANPOLICY_H
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/Policy_Strategy.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/LifespanPolicyC.h"
+#include "tao/Object_KeyC.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ class Temporary_Creation_Time;
+
+ class LifespanStrategy
+ : public Policy_Strategy
+ {
+ public:
+ LifespanStrategy (void);
+
+ virtual void strategy_init(TAO_Root_POA *poa ACE_ENV_ARG_DECL);
+
+ virtual void strategy_cleanup(ACE_ENV_SINGLE_ARG_DECL);
+
+ void create (const char *name, const TAO::ObjectKey &key);
+
+ virtual void notify_startup (ACE_ENV_SINGLE_ARG_DECL) = 0;
+
+ virtual void notify_shutdown (ACE_ENV_SINGLE_ARG_DECL) = 0;
+
+ /**
+ * Validate the passed object key if it belongs to this POA.
+ */
+ bool validate (TAO::ObjectKey_var& key);
+
+ /**
+ * Returns the length of the key type
+ */
+ virtual CORBA::ULong key_length (void) const = 0;
+
+ CORBA::ULong key_type_length (void) const;
+
+ /// Do we have set persistent or not,
+ virtual CORBA::Boolean is_persistent (void) const = 0;
+
+ virtual void create_key (CORBA::Octet *buffer, CORBA::ULong& starting_at) = 0;
+
+ /// Validate whether this matches the set lifespan strategy
+ virtual bool validate (
+ CORBA::Boolean is_persistent,
+ const TAO::Portable_Server::Temporary_Creation_Time& creation_time) const = 0;
+
+ /// Check the state of the POA.
+ virtual void check_state (ACE_ENV_SINGLE_ARG_DECL) = 0;
+
+ virtual ::PortableServer::LifespanPolicyValue type() const = 0;
+
+ virtual bool use_imr () const = 0;
+
+ protected:
+ TAO_Root_POA *poa_;
+ };
+
+ } /* namespace Portable_Server */
+} /* namespace TAO */
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_PORTABLESERVER_LIFESPANPOLICY_H */
diff --git a/TAO/tao/PortableServer/LifespanStrategyFactory.h b/TAO/tao/PortableServer/LifespanStrategyFactory.h
new file mode 100644
index 00000000000..085e2c75228
--- /dev/null
+++ b/TAO/tao/PortableServer/LifespanStrategyFactory.h
@@ -0,0 +1,53 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file LifespanStrategyFactory.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_PORTABLESERVER_LIFEPSPANSTRATEGYFACTORY_H
+#define TAO_PORTABLESERVER_LIFEPSPANSTRATEGYFACTORY_H
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/StrategyFactory.h"
+#include "tao/PortableServer/LifespanPolicyC.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ class LifespanStrategy;
+
+ class TAO_PortableServer_Export LifespanStrategyFactory
+ : public StrategyFactory
+ {
+ public:
+ /// Create a new servant retention strategy
+ virtual LifespanStrategy* create (
+ ::PortableServer::LifespanPolicyValue value) = 0;
+
+ /// Cleanup the given strategy instance
+ virtual void destroy (
+ LifespanStrategy *strategy
+ ACE_ENV_ARG_DECL) = 0;
+ };
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_PORTABLESERVER_LIFEPSPANSTRATEGYFACTORY_H */
diff --git a/TAO/tao/PortableServer/LifespanStrategyFactoryImpl.cpp b/TAO/tao/PortableServer/LifespanStrategyFactoryImpl.cpp
new file mode 100644
index 00000000000..07e24aebc59
--- /dev/null
+++ b/TAO/tao/PortableServer/LifespanStrategyFactoryImpl.cpp
@@ -0,0 +1,101 @@
+// $Id$
+
+#include "tao/PortableServer/LifespanStrategyFactoryImpl.h"
+#include "tao/PortableServer/LifespanStrategy.h"
+#include "ace/Dynamic_Service.h"
+
+ACE_RCSID (PortableServer,
+ LifespanStrategyFactoryImpl,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ LifespanStrategy*
+ LifespanStrategyFactoryImpl::create (
+ ::PortableServer::LifespanPolicyValue value)
+ {
+ LifespanStrategy *strategy = 0;
+ const char *strategy_name = 0;
+
+ switch (value)
+ {
+ case ::PortableServer::PERSISTENT :
+ {
+ strategy_name = "LifespanStrategyPersistentFactory";
+ break;
+ }
+ case ::PortableServer::TRANSIENT :
+ {
+ strategy_name = "LifespanStrategyTransientFactory";
+ break;
+ }
+ }
+
+ LifespanStrategyFactory *strategy_factory =
+ ACE_Dynamic_Service<LifespanStrategyFactory>::instance (strategy_name);
+
+ if (strategy_factory != 0)
+ strategy = strategy_factory->create (value);
+ else
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) ERROR, Unable to get %s\n"),
+ strategy_name));
+
+
+ return strategy;
+ }
+
+ void
+ LifespanStrategyFactoryImpl::destroy (
+ LifespanStrategy *strategy
+ ACE_ENV_ARG_DECL)
+ {
+ switch (strategy->type ())
+ {
+ case ::PortableServer::PERSISTENT :
+ {
+ LifespanStrategyFactory *strategy_factory =
+ ACE_Dynamic_Service<LifespanStrategyFactory>::instance ("LifespanStrategyPersistentFactory");
+
+ if (strategy_factory != 0)
+ {
+ strategy_factory->destroy (strategy ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ break;
+ }
+ case ::PortableServer::TRANSIENT :
+ {
+ LifespanStrategyFactory *strategy_factory =
+ ACE_Dynamic_Service<LifespanStrategyFactory>::instance ("LifespanStrategyTransientFactory");
+
+ if (strategy_factory != 0)
+ {
+ strategy_factory->destroy (strategy ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ break;
+ }
+ }
+ }
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DEFINE (
+ LifespanStrategyFactoryImpl,
+ ACE_TEXT ("LifespanStrategyFactory"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (LifespanStrategyFactoryImpl),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0)
+
+ACE_FACTORY_NAMESPACE_DEFINE (
+ ACE_Local_Service,
+ LifespanStrategyFactoryImpl,
+ TAO::Portable_Server::LifespanStrategyFactoryImpl)
diff --git a/TAO/tao/PortableServer/LifespanStrategyFactoryImpl.h b/TAO/tao/PortableServer/LifespanStrategyFactoryImpl.h
new file mode 100644
index 00000000000..e0ece8266bb
--- /dev/null
+++ b/TAO/tao/PortableServer/LifespanStrategyFactoryImpl.h
@@ -0,0 +1,55 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file LifespanStrategyFactoryImpl.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_PORTABLESERVER_LIFEPSPANSTRATEGYFACTORYIMPL_H
+#define TAO_PORTABLESERVER_LIFEPSPANSTRATEGYFACTORYIMPL_H
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/Service_Config.h"
+#include "tao/PortableServer/LifespanStrategyFactory.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ class TAO_PortableServer_Export LifespanStrategyFactoryImpl
+ : public LifespanStrategyFactory
+ {
+ public:
+ /// Create a new servant retention strategy
+ virtual LifespanStrategy* create (
+ ::PortableServer::LifespanPolicyValue value);
+
+ /// Cleanup the given strategy instance
+ virtual void destroy (
+ LifespanStrategy *strategy
+ ACE_ENV_ARG_DECL);
+ };
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE_EXPORT (TAO_PortableServer, LifespanStrategyFactoryImpl)
+ACE_FACTORY_DECLARE (TAO_PortableServer, LifespanStrategyFactoryImpl)
+
+
+#include /**/ "ace/post.h"
+#endif /* TAO_PORTABLESERVER_LIFEPSPANSTRATEGYFACTORYIMPL_H */
diff --git a/TAO/tao/PortableServer/LifespanStrategyPersistent.cpp b/TAO/tao/PortableServer/LifespanStrategyPersistent.cpp
new file mode 100644
index 00000000000..6b2e3420c14
--- /dev/null
+++ b/TAO/tao/PortableServer/LifespanStrategyPersistent.cpp
@@ -0,0 +1,159 @@
+// -*- C++ -*-
+
+#include "tao/PortableServer/LifespanStrategyPersistent.h"
+
+ACE_RCSID (PortableServer,
+ Lifespan_Strategy,
+ "$Id$")
+
+#include "tao/PortableServer/Root_POA.h"
+#include "tao/PortableServer/POAManager.h"
+#include "tao/PortableServer/ImR_Client_Adapter.h"
+#include "tao/ORB_Core.h"
+#include "ace/OS_NS_sys_time.h"
+#include "ace/Dynamic_Service.h"
+#include "ace/Service_Config.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ void
+ LifespanStrategyPersistent::strategy_init (
+ TAO_Root_POA *poa
+ ACE_ENV_ARG_DECL)
+ {
+ LifespanStrategy::strategy_init (poa ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->use_imr_ = this->poa_->orb_core ().use_implrepo ();
+ }
+
+ bool
+ LifespanStrategyPersistent::validate (
+ CORBA::Boolean is_persistent,
+ const TAO::Portable_Server::Temporary_Creation_Time& /*creation_time*/) const
+ {
+ return is_persistent;
+ }
+
+ char
+ LifespanStrategyPersistent::key_type (void) const
+ {
+ return 'P';
+ }
+
+ CORBA::Boolean
+ LifespanStrategyPersistent::is_persistent (void) const
+ {
+ return true;
+ }
+
+ void
+ LifespanStrategyPersistent::create_key (
+ CORBA::Octet *buffer,
+ CORBA::ULong& starting_at)
+ {
+ // Copy the persistence byte.
+ buffer[starting_at] = static_cast<CORBA::Octet> (this->key_type ());
+ starting_at += this->key_type_length ();
+ }
+
+ CORBA::ULong
+ LifespanStrategyPersistent::key_length () const
+ {
+ return this->key_type_length ();
+ }
+
+ void
+ LifespanStrategyPersistent::notify_startup (ACE_ENV_SINGLE_ARG_DECL)
+ {
+ if (this->use_imr_)
+ {
+ // The user specified that the ImR should be used.
+ ImR_Client_Adapter *adapter =
+ ACE_Dynamic_Service<ImR_Client_Adapter>::instance (
+ TAO_Root_POA::imr_client_adapter_name ()
+ );
+
+#if !defined (TAO_AS_STATIC_LIBS)
+ // In case we build shared, try to load the ImR Client library, in a
+ // static build we just can't do this, so don't try it, lower layers
+ // output an error then.
+ if (adapter == 0)
+ {
+ ACE_Service_Config::process_directive (
+ ACE_DYNAMIC_SERVICE_DIRECTIVE(
+ "ImR_Client_Adapter", "TAO_ImR_Client",
+ "_make_ImR_Client_Adapter_Impl", ""));
+
+ adapter =
+ ACE_Dynamic_Service<ImR_Client_Adapter>::instance (
+ TAO_Root_POA::imr_client_adapter_name ());
+ }
+#endif /* !TAO_AS_STATIC_LIBS */
+
+ if (adapter != 0)
+ {
+ adapter->imr_notify_startup (this->poa_ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else
+ {
+ // When we don't have a ImR_Client adapter, but the user
+ // has specified that the ImR has to be used we have an
+ // error situation which has to be reported.
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) ERROR: No ImR_Client library ")
+ ACE_TEXT ("available but use IMR has been specified.\n")));
+
+ ACE_THROW (CORBA::INTERNAL ());
+ }
+ }
+ }
+
+ void
+ LifespanStrategyPersistent::notify_shutdown (ACE_ENV_SINGLE_ARG_DECL)
+ {
+ ImR_Client_Adapter *adapter =
+ ACE_Dynamic_Service<ImR_Client_Adapter>::instance (
+ TAO_Root_POA::imr_client_adapter_name ()
+ );
+
+ if (adapter != 0)
+ {
+ adapter->imr_notify_shutdown (this->poa_ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ }
+
+ LifespanStrategyPersistent::LifespanStrategyPersistent() :
+ use_imr_ (true)
+ {
+ }
+
+ void
+ LifespanStrategyPersistent::check_state (ACE_ENV_SINGLE_ARG_DECL)
+ {
+ this->poa_->tao_poa_manager().check_state (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ ::PortableServer::LifespanPolicyValue
+ LifespanStrategyPersistent::type() const
+ {
+ return ::PortableServer::PERSISTENT;
+ }
+
+ bool
+ LifespanStrategyPersistent::use_imr () const
+ {
+ return use_imr_;
+ }
+ } /* namespace Portable_Server */
+} /* namespace TAO */
+
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/LifespanStrategyPersistent.h b/TAO/tao/PortableServer/LifespanStrategyPersistent.h
new file mode 100644
index 00000000000..01634563c72
--- /dev/null
+++ b/TAO/tao/PortableServer/LifespanStrategyPersistent.h
@@ -0,0 +1,73 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file LifespanStrategyPersistent.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_LIFESPANSTRATEGYPERSISTENT_H
+#define TAO_LIFESPANSTRATEGYPERSISTENT_H
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/LifespanStrategy.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Object_KeyC.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class ServerObject_i;
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ class LifespanStrategyPersistent
+ : public LifespanStrategy
+ {
+ public:
+ LifespanStrategyPersistent ();
+
+ virtual void strategy_init(TAO_Root_POA *poa ACE_ENV_ARG_DECL);
+
+ virtual void notify_startup (ACE_ENV_SINGLE_ARG_DECL);
+
+ virtual void notify_shutdown (ACE_ENV_SINGLE_ARG_DECL);
+
+ char key_type (void) const;
+
+ virtual CORBA::Boolean is_persistent (void) const;
+
+ CORBA::ULong key_length (void) const;
+
+ virtual void create_key (CORBA::Octet *buffer, CORBA::ULong& starting_at);
+
+ virtual bool
+ validate (CORBA::Boolean is_persistent,
+ const TAO::Portable_Server::Temporary_Creation_Time& creation_time) const;
+
+ /// Check the state of the POA.
+ virtual void check_state (ACE_ENV_SINGLE_ARG_DECL);
+
+ virtual ::PortableServer::LifespanPolicyValue type() const;
+
+ virtual bool use_imr () const;
+
+ private:
+ bool use_imr_;
+ };
+ } /* namespace Portable_Server */
+} /* namespace TAO */
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_LIFESPANSTRATEGYPERSISTENT_H */
diff --git a/TAO/tao/PortableServer/LifespanStrategyPersistentFactoryImpl.cpp b/TAO/tao/PortableServer/LifespanStrategyPersistentFactoryImpl.cpp
new file mode 100644
index 00000000000..ab24406bf5f
--- /dev/null
+++ b/TAO/tao/PortableServer/LifespanStrategyPersistentFactoryImpl.cpp
@@ -0,0 +1,67 @@
+// $Id$
+
+#include "tao/PortableServer/LifespanStrategyPersistentFactoryImpl.h"
+#include "ace/Dynamic_Service.h"
+#include "tao/PortableServer/LifespanStrategyPersistent.h"
+
+ACE_RCSID (PortableServer,
+ LifespanStrategyFactoryImpl,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ LifespanStrategy*
+ LifespanStrategyPersistentFactoryImpl::create (
+ ::PortableServer::LifespanPolicyValue value)
+ {
+ LifespanStrategy* strategy = 0;
+
+ switch (value)
+ {
+ case ::PortableServer::PERSISTENT :
+ {
+ ACE_NEW_RETURN (strategy, LifespanStrategyPersistent, 0);
+ break;
+ }
+ case ::PortableServer::TRANSIENT :
+ {
+ ACE_ERROR ((LM_ERROR, "Incorrect type in LifespanStrategyPersistentFactoryImpl"));
+ break;
+ }
+ }
+
+ return strategy;
+ }
+
+ void
+ LifespanStrategyPersistentFactoryImpl::destroy (
+ LifespanStrategy *strategy
+ ACE_ENV_ARG_DECL)
+ {
+ strategy->strategy_cleanup (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ delete strategy;
+ }
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DEFINE (
+ LifespanStrategyPersistentFactoryImpl,
+ ACE_TEXT ("LifespanStrategyPersistentFactory"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (LifespanStrategyPersistentFactoryImpl),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0)
+
+ACE_FACTORY_NAMESPACE_DEFINE (
+ ACE_Local_Service,
+ LifespanStrategyPersistentFactoryImpl,
+ TAO::Portable_Server::LifespanStrategyPersistentFactoryImpl)
+
diff --git a/TAO/tao/PortableServer/LifespanStrategyPersistentFactoryImpl.h b/TAO/tao/PortableServer/LifespanStrategyPersistentFactoryImpl.h
new file mode 100644
index 00000000000..b32a3c63440
--- /dev/null
+++ b/TAO/tao/PortableServer/LifespanStrategyPersistentFactoryImpl.h
@@ -0,0 +1,55 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file LifespanStrategyPersistentFactoryImpl.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_PORTABLESERVER_LIFEPSPANSTRATEGYPERSISTENTFACTORYIMPL_H
+#define TAO_PORTABLESERVER_LIFEPSPANSTRATEGYPERSISTENTFACTORYIMPL_H
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/Service_Config.h"
+#include "tao/PortableServer/LifespanStrategyFactory.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ class TAO_PortableServer_Export LifespanStrategyPersistentFactoryImpl
+ : public LifespanStrategyFactory
+ {
+ public:
+ /// Create a new strategy
+ virtual LifespanStrategy* create (
+ ::PortableServer::LifespanPolicyValue value);
+
+ /// Cleanup the given strategy instance
+ virtual void destroy (
+ LifespanStrategy *strategy
+ ACE_ENV_ARG_DECL);
+ };
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE_EXPORT (TAO_PortableServer, LifespanStrategyPersistentFactoryImpl)
+ACE_FACTORY_DECLARE (TAO_PortableServer, LifespanStrategyPersistentFactoryImpl)
+
+
+#include /**/ "ace/post.h"
+#endif /* TAO_PORTABLESERVER_LIFEPSPANSTRATEGYPERSISTENTFACTORYIMPL_H */
diff --git a/TAO/tao/PortableServer/LifespanStrategyTransient.cpp b/TAO/tao/PortableServer/LifespanStrategyTransient.cpp
new file mode 100644
index 00000000000..d1859883dac
--- /dev/null
+++ b/TAO/tao/PortableServer/LifespanStrategyTransient.cpp
@@ -0,0 +1,118 @@
+// -*- C++ -*-
+
+#include "tao/PortableServer/LifespanStrategyTransient.h"
+
+ACE_RCSID (PortableServer,
+ Lifespan_Strategy,
+ "$Id$")
+
+#include "ace/OS_NS_sys_time.h"
+#include "ace/OS_NS_string.h"
+#include "tao/PortableServer/POAManager.h"
+#include "tao/PortableServer/Root_POA.h"
+#include "tao/ORB_Constants.h"
+#include "tao/PortableServer/Creation_Time.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ LifespanStrategyTransient::LifespanStrategyTransient () :
+ creation_time_ (ACE_OS::gettimeofday ())
+ {
+ }
+
+ void
+ LifespanStrategyTransient::notify_startup (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ {
+ }
+
+ void
+ LifespanStrategyTransient::notify_shutdown (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ {
+ }
+
+ CORBA::Boolean
+ LifespanStrategyTransient::is_persistent (void) const
+ {
+ return false;
+ }
+
+ bool
+ LifespanStrategyTransient::validate (
+ CORBA::Boolean is_persistent,
+ const TAO::Portable_Server::Temporary_Creation_Time &creation_time) const
+ {
+ return (!is_persistent && this->creation_time_ == creation_time);
+ }
+
+ CORBA::ULong
+ LifespanStrategyTransient::key_length (void) const
+ {
+ CORBA::ULong keylength = sizeof (char);
+
+ #if (POA_NO_TIMESTAMP == 0)
+ // Calculate the space required for the timestamp.
+ keylength += TAO::Portable_Server::Creation_Time::creation_time_length ();
+ #endif /* POA_NO_TIMESTAMP */
+
+ return keylength;
+ }
+
+ void
+ LifespanStrategyTransient::create_key (
+ CORBA::Octet *buffer,
+ CORBA::ULong& starting_at)
+ {
+ // Copy the persistence byte.
+ buffer[starting_at] = (CORBA::Octet) this->key_type ();
+ starting_at += this->key_type_length ();
+
+ #if (POA_NO_TIMESTAMP == 0)
+ // Then copy the timestamp for transient POAs.
+ ACE_OS::memcpy (&buffer[starting_at],
+ this->creation_time_.creation_time (),
+ TAO::Portable_Server::Creation_Time::creation_time_length ());
+ starting_at += TAO::Portable_Server::Creation_Time::creation_time_length ();
+ #endif /* POA_NO_TIMESTAMP */
+ }
+
+ char
+ LifespanStrategyTransient::key_type (void) const
+ {
+ return 'T';
+ }
+
+ void
+ LifespanStrategyTransient::check_state (ACE_ENV_SINGLE_ARG_DECL)
+ {
+ if (this->poa_->tao_poa_manager().get_state_i () ==
+ PortableServer::POAManager::INACTIVE)
+ {
+ ACE_THROW (CORBA::OBJECT_NOT_EXIST (CORBA::OMGVMCID | 4,
+ CORBA::COMPLETED_NO));
+ }
+ else
+ {
+ this->poa_->tao_poa_manager().check_state (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ }
+
+ bool
+ LifespanStrategyTransient::use_imr () const
+ {
+ return false;
+ }
+
+ ::PortableServer::LifespanPolicyValue
+ LifespanStrategyTransient::type() const
+ {
+ return ::PortableServer::TRANSIENT;
+ }
+ } /* namespace Portable_Server */
+} /* namespace TAO */
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/LifespanStrategyTransient.h b/TAO/tao/PortableServer/LifespanStrategyTransient.h
new file mode 100644
index 00000000000..6638973712f
--- /dev/null
+++ b/TAO/tao/PortableServer/LifespanStrategyTransient.h
@@ -0,0 +1,70 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file LifespanStrategyTransient.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_LIFESPANSTRATEGYTRANSIENT_H
+#define TAO_LIFESPANSTRATEGYTRANSIENT_H
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/LifespanStrategy.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/Creation_Time.h"
+#include "tao/Object_KeyC.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ class LifespanStrategyTransient
+ : public LifespanStrategy
+ {
+ public:
+ LifespanStrategyTransient (void);
+
+ virtual void notify_startup (ACE_ENV_SINGLE_ARG_DECL);
+
+ virtual void notify_shutdown (ACE_ENV_SINGLE_ARG_DECL);
+
+ char key_type (void) const;
+
+ virtual CORBA::Boolean is_persistent (void) const;
+
+ CORBA::ULong key_length (void) const;
+
+ virtual void create_key (CORBA::Octet *buffer, CORBA::ULong& starting_at);
+
+ virtual
+ bool validate (CORBA::Boolean is_persistent,
+ const TAO::Portable_Server::Temporary_Creation_Time& creation_time) const;
+
+ /// Check the state of the POA.
+ virtual void check_state (ACE_ENV_SINGLE_ARG_DECL);
+
+ virtual ::PortableServer::LifespanPolicyValue type() const;
+
+ virtual bool use_imr () const;
+
+ private:
+ TAO::Portable_Server::Creation_Time creation_time_;
+ };
+ } /* namespace Portable_Server */
+} /* namespace TAO */
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_LIFESPANSTRATEGYTRANSIENT_H */
diff --git a/TAO/tao/PortableServer/LifespanStrategyTransientFactoryImpl.cpp b/TAO/tao/PortableServer/LifespanStrategyTransientFactoryImpl.cpp
new file mode 100644
index 00000000000..896745f0846
--- /dev/null
+++ b/TAO/tao/PortableServer/LifespanStrategyTransientFactoryImpl.cpp
@@ -0,0 +1,68 @@
+// $Id$
+
+#include "tao/PortableServer/LifespanStrategyTransientFactoryImpl.h"
+#include "ace/Dynamic_Service.h"
+#include "tao/PortableServer/LifespanStrategyTransient.h"
+
+ACE_RCSID (PortableServer,
+ LifespanStrategyFactoryImpl,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ LifespanStrategy*
+ LifespanStrategyTransientFactoryImpl::create (
+ ::PortableServer::LifespanPolicyValue value)
+ {
+ LifespanStrategy* strategy = 0;
+
+ switch (value)
+ {
+ case ::PortableServer::PERSISTENT :
+ {
+ ACE_ERROR ((LM_ERROR, "Incorrect type in LifespanStrategyTransientFactoryImpl"));
+ break;
+ }
+ case ::PortableServer::TRANSIENT :
+ {
+ ACE_NEW_RETURN (strategy, LifespanStrategyTransient, 0);
+ break;
+ }
+ }
+
+ return strategy;
+ }
+
+ void
+ LifespanStrategyTransientFactoryImpl::destroy (
+ LifespanStrategy *strategy
+ ACE_ENV_ARG_DECL)
+ {
+ strategy->strategy_cleanup (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ delete strategy;
+ }
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DEFINE (
+ LifespanStrategyTransientFactoryImpl,
+ ACE_TEXT ("LifespanStrategyTransientFactory"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (LifespanStrategyTransientFactoryImpl),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0)
+
+ACE_FACTORY_NAMESPACE_DEFINE (
+ ACE_Local_Service,
+ LifespanStrategyTransientFactoryImpl,
+ TAO::Portable_Server::LifespanStrategyTransientFactoryImpl)
+
+
diff --git a/TAO/tao/PortableServer/LifespanStrategyTransientFactoryImpl.h b/TAO/tao/PortableServer/LifespanStrategyTransientFactoryImpl.h
new file mode 100644
index 00000000000..e3a8c076934
--- /dev/null
+++ b/TAO/tao/PortableServer/LifespanStrategyTransientFactoryImpl.h
@@ -0,0 +1,57 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file LifespanStrategyTransientFactoryImpl.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_PORTABLESERVER_LIFEPSPANSTRATEGYTRANSIENTFACTORYIMPL_H
+#define TAO_PORTABLESERVER_LIFEPSPANSTRATEGYTRANSIENTFACTORYIMPL_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/Service_Config.h"
+#include "tao/PortableServer/LifespanStrategyFactory.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ class TAO_PortableServer_Export LifespanStrategyTransientFactoryImpl
+ : public LifespanStrategyFactory
+ {
+ public:
+ /// Create a new strategy
+ virtual LifespanStrategy* create (
+ ::PortableServer::LifespanPolicyValue value);
+
+ /// Cleanup the given strategy instance
+ virtual void destroy (
+ LifespanStrategy *strategy
+ ACE_ENV_ARG_DECL);
+ };
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE_EXPORT (TAO_PortableServer, LifespanStrategyTransientFactoryImpl)
+ACE_FACTORY_DECLARE (TAO_PortableServer, LifespanStrategyTransientFactoryImpl)
+
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_PORTABLESERVER_LIFEPSPANSTRATEGYTRANSIENTFACTORYIMPL_H */
diff --git a/TAO/tao/PortableServer/Local_Servant_Base.cpp b/TAO/tao/PortableServer/Local_Servant_Base.cpp
new file mode 100644
index 00000000000..007b1ca5e05
--- /dev/null
+++ b/TAO/tao/PortableServer/Local_Servant_Base.cpp
@@ -0,0 +1,24 @@
+// $Id$
+
+#include "tao/PortableServer/Local_Servant_Base.h"
+#include "tao/SystemException.h"
+
+ACE_RCSID (PortableServer,
+ Local_Servant_Base,
+ "$Id$")
+
+#if !defined (__ACE_INLINE__)
+# include "tao/PortableServer/Local_Servant_Base.inl"
+#endif /* ! __ACE_INLINE__ */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+void
+TAO_Local_ServantBase::_dispatch (TAO_ServerRequest &,
+ void *
+ ACE_ENV_ARG_DECL)
+{
+ ACE_THROW (CORBA::BAD_OPERATION ());
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/Local_Servant_Base.h b/TAO/tao/PortableServer/Local_Servant_Base.h
new file mode 100644
index 00000000000..dd3d9447932
--- /dev/null
+++ b/TAO/tao/PortableServer/Local_Servant_Base.h
@@ -0,0 +1,62 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Local_Servant_Base.h
+ *
+ * $Id$
+ *
+ * @author Irfan Pyarali <irfan@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_LOCAL_SERVANT_BASE_H
+#define TAO_LOCAL_SERVANT_BASE_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/Servant_Base.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_Local_ServantBase
+ *
+ * @brief Base class for local servants.
+ *
+ * This servant does not register with the POA and does not
+ * produce a valid stub, i.e., object references of this servant
+ * cannot be exported. The (collocated) stubs of these servants
+ * will always be direct, i.e., call directly to the servant and
+ * don't call through the POA since this servant is not
+ * registered with the POA.
+ */
+class TAO_PortableServer_Export TAO_Local_ServantBase
+ : public virtual TAO_ServantBase
+{
+protected:
+ /// This is an auxiliary method for _this(). Make sure *not* to
+ /// register with the default POA.
+ TAO_Stub *_create_stub (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS);
+
+ /// Throws CORBA::BAD_OPERATION exception.
+ void _dispatch (TAO_ServerRequest &request,
+ void *servant_upcall
+ ACE_ENV_ARG_DECL);
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/PortableServer/Local_Servant_Base.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_LOCAL_SERVANT_BASE_H */
diff --git a/TAO/tao/PortableServer/Local_Servant_Base.inl b/TAO/tao/PortableServer/Local_Servant_Base.inl
new file mode 100644
index 00000000000..f811de25b9f
--- /dev/null
+++ b/TAO/tao/PortableServer/Local_Servant_Base.inl
@@ -0,0 +1,13 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE TAO_Stub *
+TAO_Local_ServantBase::_create_stub (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+{
+ return 0;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/Non_Servant_Upcall.cpp b/TAO/tao/PortableServer/Non_Servant_Upcall.cpp
new file mode 100644
index 00000000000..2660f700538
--- /dev/null
+++ b/TAO/tao/PortableServer/Non_Servant_Upcall.cpp
@@ -0,0 +1,95 @@
+// $Id$
+
+#include "tao/PortableServer/Non_Servant_Upcall.h"
+#include "tao/PortableServer/Object_Adapter.h"
+#include "tao/PortableServer/Root_POA.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/PortableServer/Non_Servant_Upcall.inl"
+#endif /* __ACE_INLINE__ */
+
+ACE_RCSID (PortableServer,
+ Non_Servant_Upcall,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ Non_Servant_Upcall::Non_Servant_Upcall (::TAO_Root_POA &poa)
+ : object_adapter_ (poa.object_adapter ()),
+ poa_ (poa),
+ previous_ (0)
+ {
+ // Check if this is a nested non_servant_upcall.
+ if (this->object_adapter_.non_servant_upcall_nesting_level_ != 0)
+ {
+ // Remember previous instance of non_servant_upcall.
+ this->previous_ = this->object_adapter_.non_servant_upcall_in_progress_;
+
+ // Assert that the thread is the same as the one before.
+ ACE_ASSERT (ACE_OS::thr_equal (this->object_adapter_.non_servant_upcall_thread_,
+ ACE_OS::thr_self ()));
+ }
+
+ // Remember which thread is calling the adapter activators.
+ this->object_adapter_.non_servant_upcall_thread_ = ACE_OS::thr_self ();
+
+ // Mark the fact that a non-servant upcall is in progress.
+ this->object_adapter_.non_servant_upcall_in_progress_ = this;
+
+ // Adjust the nesting level.
+ this->object_adapter_.non_servant_upcall_nesting_level_++;
+
+ // We always release
+ this->object_adapter_.lock ().release ();
+ }
+
+ Non_Servant_Upcall::~Non_Servant_Upcall (void)
+ {
+ // Reacquire the Object Adapter lock.
+ this->object_adapter_.lock ().acquire ();
+
+ // Adjust the nesting level.
+ this->object_adapter_.non_servant_upcall_nesting_level_--;
+
+ // We are done with this nested upcall.
+ this->object_adapter_.non_servant_upcall_in_progress_ = this->previous_;
+
+ // If we are at the outer nested upcall.
+ if (this->object_adapter_.non_servant_upcall_nesting_level_ == 0)
+ {
+ // Reset thread id.
+ this->object_adapter_.non_servant_upcall_thread_ =
+ ACE_OS::NULL_thread;
+
+ // Check if all pending requests are over.
+ if (this->poa_.waiting_destruction () &&
+ this->poa_.outstanding_requests () == 0)
+ {
+ ACE_TRY_NEW_ENV
+ {
+ this->poa_.complete_destruction_i (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ // Ignore exceptions
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "TAO_POA::complete_destruction_i");
+ }
+ ACE_ENDTRY;
+ }
+
+ // If locking is enabled.
+ if (this->object_adapter_.enable_locking_)
+ // Wakeup all waiting threads.
+ this->object_adapter_.non_servant_upcall_condition_.broadcast ();
+ }
+ }
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/Non_Servant_Upcall.h b/TAO/tao/PortableServer/Non_Servant_Upcall.h
new file mode 100644
index 00000000000..92b05194d9d
--- /dev/null
+++ b/TAO/tao/PortableServer/Non_Servant_Upcall.h
@@ -0,0 +1,79 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Non_Servant_Upcall.h
+ *
+ * $Id$
+ *
+ * @author Irfan Pyarali
+ */
+//=============================================================================
+
+#ifndef TAO_NONSERVANT_UPCALL_H
+#define TAO_NONSERVANT_UPCALL_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/orbconf.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Forward declaration
+class TAO_Root_POA;
+class TAO_Object_Adapter;
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ /**
+ * @class Non_Servant_Upcall
+ *
+ * @brief This class helps us with a recursive thread lock without
+ * using a recursive thread lock. Non_Servant_Upcall has a
+ * magic constructor and destructor. We unlock the
+ * Object_Adapter lock for the duration of the non-servant
+ * (i.e., adapter activator and servant activator) upcalls;
+ * reacquiring once the upcalls complete. Even though we are
+ * releasing the lock, other threads will not be able to make
+ * progress since
+ * <Object_Adapter::non_servant_upcall_in_progress_> has been
+ * set.
+ */
+ class TAO_PortableServer_Export Non_Servant_Upcall
+ {
+ public:
+
+ /// Constructor.
+ Non_Servant_Upcall (::TAO_Root_POA &poa);
+
+ /// Destructor.
+ ~Non_Servant_Upcall (void);
+
+ ::TAO_Root_POA &poa (void) const;
+
+ protected:
+
+ TAO_Object_Adapter &object_adapter_;
+ TAO_Root_POA &poa_;
+ Non_Servant_Upcall *previous_;
+ };
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/PortableServer/Non_Servant_Upcall.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_NONSERVANT_UPCALL_H */
diff --git a/TAO/tao/PortableServer/Non_Servant_Upcall.inl b/TAO/tao/PortableServer/Non_Servant_Upcall.inl
new file mode 100644
index 00000000000..0a9b6f2e8de
--- /dev/null
+++ b/TAO/tao/PortableServer/Non_Servant_Upcall.inl
@@ -0,0 +1,19 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ ACE_INLINE ::TAO_Root_POA &
+ Non_Servant_Upcall::poa (void) const
+ {
+ return this->poa_;
+ }
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/ORT_Adapter.h b/TAO/tao/PortableServer/ORT_Adapter.h
new file mode 100644
index 00000000000..34d89eb42db
--- /dev/null
+++ b/TAO/tao/PortableServer/ORT_Adapter.h
@@ -0,0 +1,117 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file ORT_Adapter.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+#ifndef TAO_ORT_ADAPTER_H
+#define TAO_ORT_ADAPTER_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/SystemException.h"
+#include "tao/PI_ForwardC.h"
+#include "ace/Service_Object.h"
+#include "ace/Array_Base.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace CORBA
+{
+ class Object;
+ typedef Object *Object_ptr;
+}
+
+namespace PortableInterceptor
+{
+ class ObjectReferenceTemplate;
+ class ObjectReferenceFactory;
+}
+
+namespace PortableServer
+{
+ class POA;
+ typedef POA* POA_ptr;
+}
+
+namespace TAO
+{
+ /**
+ * @class ORT_Adapter
+ *
+ * @brief ORT_Adapter
+ *
+ * Class that offers an interface to the POA to load and manipulate
+ * ORT library.
+ */
+ class TAO_PortableServer_Export ORT_Adapter
+ : public ACE_Service_Object
+ {
+ public:
+ /// Activate the ORT library
+ virtual int activate (const char *server_id,
+ const char *orb_id,
+ PortableInterceptor::AdapterName *,
+ PortableServer::POA_ptr poa
+ ACE_ENV_ARG_DECL) = 0;
+
+ /// Set a different ort_factory to be used.
+ virtual int set_obj_ref_factory (
+ PortableInterceptor::ObjectReferenceFactory *current_factory
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS) = 0;
+
+ /// Accessor methods to ObjectReferenceTemplate template
+ virtual PortableInterceptor::ObjectReferenceTemplate *
+ get_adapter_template (void) = 0;
+
+ /// Accessor methods to PortableInterceptor::ObjectReferenceFactory
+ virtual PortableInterceptor::ObjectReferenceFactory *
+ get_obj_ref_factory (void) = 0;
+
+ /// Release any references on @c ObjectReferenceTemplate @a t.
+ virtual void release (
+ PortableInterceptor::ObjectReferenceTemplate * t) = 0;
+
+ /**
+ * @name PortableInterceptor::ObjectReferenceFactory Methods
+ *
+ * Methods required by the
+ * PortableInterceptor::ObjectReferenceFactory ValueType.
+ *
+ * @todo
+ * @@ Johnny, we won't be needing the exception specification
+ * below for long. Once bug 1852 is fixed, we can the
+ * exception specification and the "tao/SystemException.h"
+ * include above.
+ */
+ //@{
+ virtual CORBA::Object_ptr make_object (
+ const char * repository_id,
+ const PortableInterceptor::ObjectId & id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+ //@}
+ };
+
+ typedef
+ ACE_Array_Base<PortableInterceptor::ObjectReferenceTemplate*> ORT_Array;
+
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_ORT_ADAPTER_H */
diff --git a/TAO/tao/PortableServer/ORT_Adapter_Factory.cpp b/TAO/tao/PortableServer/ORT_Adapter_Factory.cpp
new file mode 100644
index 00000000000..7d4a85297b8
--- /dev/null
+++ b/TAO/tao/PortableServer/ORT_Adapter_Factory.cpp
@@ -0,0 +1,18 @@
+// $Id$
+
+#include "tao/PortableServer/ORT_Adapter_Factory.h"
+
+ACE_RCSID (PortableServer,
+ ORT_Adapter_Factory,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ ORT_Adapter_Factory::~ORT_Adapter_Factory (void)
+ {
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/ORT_Adapter_Factory.h b/TAO/tao/PortableServer/ORT_Adapter_Factory.h
new file mode 100644
index 00000000000..d5c7570f93f
--- /dev/null
+++ b/TAO/tao/PortableServer/ORT_Adapter_Factory.h
@@ -0,0 +1,74 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file ORT_Adapter_Factory.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+
+#ifndef TAO_ORT_ADAPTER_FACTORY_H
+#define TAO_ORT_ADAPTER_FACTORY_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Versioned_Namespace.h"
+#include "ace/Service_Object.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ class ORT_Adapter;
+}
+
+namespace TAO
+{
+ /**
+ * @class ORT_Adapter_Factory
+ *
+ * @brief ORT_Adapter_Factory
+ *
+ * Class that creates one instance of TAO::ORT_Adapter per
+ * POA on the POA's first usage of its objectreferencetemplate_adapter.
+ * This is a base class for the actual implementation in the
+ * TAO_ObjectReferenceTemplate library.
+ */
+ class TAO_PortableServer_Export ORT_Adapter_Factory
+ : public ACE_Service_Object
+ {
+ public:
+
+ /// Destructor.
+ /**
+ * @note Even though this class only defines an interface, a
+ * destructor is necessary to avoid dynamic_cast<> failures
+ * when using g++ 4.0's -fvisibility-inlines-hidden command
+ * line option. Apparently the compiler generated
+ * destructor is inlined.
+ */
+ virtual ~ORT_Adapter_Factory (void);
+
+ /// Create a new adapter, in case not possible to allocate, returns 0
+ virtual TAO::ORT_Adapter * create () = 0;
+
+ /// Destroy the passed adapter
+ virtual void destroy (TAO::ORT_Adapter * adapter) = 0;
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_ORT_ADAPTER_FACTORY_H */
diff --git a/TAO/tao/PortableServer/Object_Adapter.cpp b/TAO/tao/PortableServer/Object_Adapter.cpp
new file mode 100644
index 00000000000..2f2305ec233
--- /dev/null
+++ b/TAO/tao/PortableServer/Object_Adapter.cpp
@@ -0,0 +1,1289 @@
+// $Id$
+
+// -- PortableServer Include --
+#include "tao/PortableServer/Object_Adapter.h"
+#include "tao/PortableServer/Non_Servant_Upcall.h"
+#include "tao/PortableServer/Servant_Upcall.h"
+#include "tao/PortableServer/Root_POA.h"
+#include "tao/PortableServer/Regular_POA.h"
+#include "tao/PortableServer/Creation_Time.h"
+#include "tao/PortableServer/POA_Guard.h"
+#include "tao/PortableServer/Default_Servant_Dispatcher.h"
+#include "tao/PortableServer/Collocated_Object_Proxy_Broker.h"
+#include "tao/PortableServer/POAManager.h"
+#include "tao/PortableServer/POAManagerFactory.h"
+#include "tao/PortableServer/Servant_Base.h"
+
+// -- ACE Include --
+#include "ace/Auto_Ptr.h"
+#include "ace/Log_Msg.h"
+#include "ace/OS_NS_string.h"
+
+// -- TAO Include --
+#include "tao/PortableInterceptorC.h"
+#include "tao/ORB.h"
+#include "tao/ORB_Core.h"
+#include "tao/TSS_Resources.h"
+#include "tao/TAO_Server_Request.h"
+#include "tao/Stub.h"
+#include "tao/Profile.h"
+#include "tao/MProfile.h"
+#include "tao/debug.h"
+#include "tao/PortableInterceptor.h"
+#include "tao/ORBInitializer_Registry.h"
+#include "tao/Thread_Lane_Resources_Manager.h"
+#include "tao/Thread_Lane_Resources.h"
+#include "tao/Protocols_Hooks.h"
+#include "tao/ServerRequestInterceptor_Adapter.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/PortableServer/Object_Adapter.i"
+#endif /* __ACE_INLINE__ */
+
+#include "tao/PortableServer/ThreadPolicy.h"
+#include "tao/PortableServer/LifespanPolicy.h"
+#include "tao/PortableServer/IdAssignmentPolicy.h"
+#include "tao/PortableServer/IdUniquenessPolicy.h"
+#include "tao/PortableServer/ImplicitActivationPolicy.h"
+#include "tao/PortableServer/RequestProcessingPolicy.h"
+#include "tao/PortableServer/ServantRetentionPolicy.h"
+
+ACE_RCSID (PortableServer,
+ Object_Adapter,
+ "$Id$")
+
+#if !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
+namespace PortableServer
+{
+ class POAManagerFactory;
+ typedef POAManagerFactory *POAManagerFactory_ptr;
+}
+#endif
+
+// Timeprobes class
+#include "tao/Timeprobe.h"
+
+#if defined (ACE_ENABLE_TIMEPROBES)
+
+static const char *TAO_Object_Adapter_Timeprobe_Description[] =
+{
+ "Object_Adapter::dispatch_servant - start",
+ "Object_Adapter::dispatch_servant - end",
+
+ "POA::parse_key - start",
+ "POA::parse_key - end",
+
+ "Object_Adapter::find_poa - start",
+ "Object_Adapter::find_poa - end",
+
+ "POA::locate_servant - start",
+ "POA::locate_servant - end",
+
+ "Servant::_dispatch - start",
+ "Servant::_dispatch - end",
+};
+
+enum
+{
+ // Timeprobe description table start key
+ TAO_OBJECT_ADAPTER_DISPATCH_SERVANT_START = 200,
+ TAO_OBJECT_ADAPTER_DISPATCH_SERVANT_END,
+
+ TAO_POA_PARSE_KEY_START,
+ TAO_POA_PARSE_KEY_END,
+
+ TAO_OBJECT_ADAPTER_FIND_POA_START,
+ TAO_OBJECT_ADAPTER_FIND_POA_END,
+
+ TAO_POA_LOCATE_SERVANT_START,
+ TAO_POA_LOCATE_SERVANT_END,
+
+ TAO_SERVANT_DISPATCH_START,
+ TAO_SERVANT_DISPATCH_END
+};
+
+// Setup Timeprobes
+ACE_TIMEPROBE_EVENT_DESCRIPTIONS (TAO_Object_Adapter_Timeprobe_Description,
+ TAO_OBJECT_ADAPTER_DISPATCH_SERVANT_START);
+
+#endif /* ACE_ENABLE_TIMEPROBES */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/* static */
+CORBA::ULong TAO_Object_Adapter::transient_poa_name_size_ = 0;
+
+void
+TAO_Object_Adapter::set_transient_poa_name_size (const TAO_Server_Strategy_Factory::Active_Object_Map_Creation_Parameters &creation_parameters)
+{
+ if (TAO_Object_Adapter::transient_poa_name_size_ == 0)
+ {
+ switch (creation_parameters.poa_lookup_strategy_for_transient_id_policy_)
+ {
+#if (TAO_HAS_MINIMUM_POA_MAPS == 0)
+ case TAO_LINEAR:
+ TAO_Object_Adapter::transient_poa_name_size_ =
+ sizeof (CORBA::ULong);
+ break;
+ case TAO_DYNAMIC_HASH:
+ TAO_Object_Adapter::transient_poa_name_size_ =
+ sizeof (CORBA::ULong);
+ break;
+#endif /* TAO_HAS_MINIMUM_POA_MAPS == 0 */
+ case TAO_ACTIVE_DEMUX:
+ default:
+ TAO_Object_Adapter::transient_poa_name_size_ =
+ static_cast <CORBA::ULong>(
+ ACE_Active_Map_Manager_Key::size ());
+ break;
+ }
+ }
+}
+
+TAO_Object_Adapter::TAO_Object_Adapter (const TAO_Server_Strategy_Factory::Active_Object_Map_Creation_Parameters &creation_parameters,
+ TAO_ORB_Core &orb_core)
+ : hint_strategy_ (0),
+ servant_dispatcher_ (0),
+ persistent_poa_name_map_ (0),
+ transient_poa_map_ (0),
+ orb_core_ (orb_core),
+ enable_locking_ (orb_core_.server_factory ()->enable_poa_locking ()),
+ thread_lock_ (),
+ lock_ (TAO_Object_Adapter::create_lock (enable_locking_,
+ thread_lock_)),
+ reverse_lock_ (*lock_),
+ non_servant_upcall_condition_ (thread_lock_),
+ non_servant_upcall_in_progress_ (0),
+ non_servant_upcall_nesting_level_ (0),
+ non_servant_upcall_thread_ (ACE_OS::NULL_thread),
+ root_ (0),
+ default_validator_ (orb_core),
+ default_poa_policies_ ()
+{
+ TAO_Object_Adapter::set_transient_poa_name_size (creation_parameters);
+
+ Hint_Strategy *hint_strategy = 0;
+ if (creation_parameters.use_active_hint_in_poa_names_)
+ ACE_NEW (hint_strategy,
+ Active_Hint_Strategy (creation_parameters.poa_map_size_));
+ else
+ ACE_NEW (hint_strategy,
+ No_Hint_Strategy);
+
+ // Give ownership to the auto pointer.
+ auto_ptr<Hint_Strategy> new_hint_strategy (hint_strategy);
+
+ new_hint_strategy->object_adapter (this);
+
+ persistent_poa_name_map *ppnm = 0;
+ switch (creation_parameters.poa_lookup_strategy_for_persistent_id_policy_)
+ {
+ case TAO_LINEAR:
+#if (TAO_HAS_MINIMUM_POA_MAPS == 0)
+ ACE_NEW (ppnm,
+ persistent_poa_name_linear_map (creation_parameters.poa_map_size_));
+
+ break;
+#else
+ ACE_ERROR ((LM_ERROR,
+ "linear option for -ORBPersistentidPolicyDemuxStrategy "
+ "not supported with minimum POA maps. "
+ "Ingoring option to use default... \n"));
+ /* FALL THROUGH */
+#endif /* TAO_HAS_MINIMUM_POA_MAPS == 0 */
+ case TAO_DYNAMIC_HASH:
+ default:
+ ACE_NEW (ppnm,
+ persistent_poa_name_hash_map (creation_parameters.poa_map_size_));
+ break;
+ }
+ // Give ownership to the auto pointer.
+ auto_ptr<persistent_poa_name_map> new_persistent_poa_name_map (ppnm);
+
+ transient_poa_map *tpm = 0;
+ switch (creation_parameters.poa_lookup_strategy_for_transient_id_policy_)
+ {
+#if (TAO_HAS_MINIMUM_POA_MAPS == 0)
+ case TAO_LINEAR:
+ ACE_NEW (tpm,
+ transient_poa_linear_map (creation_parameters.poa_map_size_));
+ break;
+ case TAO_DYNAMIC_HASH:
+ ACE_NEW (tpm,
+ transient_poa_hash_map (creation_parameters.poa_map_size_));
+ break;
+#else
+ case TAO_LINEAR:
+ case TAO_DYNAMIC_HASH:
+ ACE_ERROR ((LM_ERROR,
+ "linear and dynamic options for -ORBTransientidPolicyDemuxStrategy "
+ "are not supported with minimum POA maps. "
+ "Ingoring option to use default... \n"));
+ /* FALL THROUGH */
+#endif /* TAO_HAS_MINIMUM_POA_MAPS == 0 */
+ case TAO_ACTIVE_DEMUX:
+ default:
+ ACE_NEW (tpm,
+ transient_poa_active_map (creation_parameters.poa_map_size_));
+ break;
+ }
+ // Give ownership to the auto pointer.
+ auto_ptr<transient_poa_map> new_transient_poa_map (tpm);
+
+ this->hint_strategy_ =
+ new_hint_strategy.release ();
+ this->persistent_poa_name_map_ =
+ new_persistent_poa_name_map.release ();
+ this->transient_poa_map_ =
+ new_transient_poa_map.release ();
+}
+
+void
+TAO_Object_Adapter::init_default_policies (TAO_POA_Policy_Set &policies
+ ACE_ENV_ARG_DECL)
+{
+ // Initialize the default policies.
+#if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
+
+ TAO::Portable_Server::ThreadPolicy thread_policy (PortableServer::ORB_CTRL_MODEL);
+ policies.merge_policy (&thread_policy ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+#endif /* TAO_HAS_MINIMUM_POA == 0 */
+
+#if !defined (CORBA_E_MICRO)
+ // Lifespan policy.
+ TAO::Portable_Server::LifespanPolicy lifespan_policy (PortableServer::TRANSIENT);
+ policies.merge_policy (&lifespan_policy ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+#endif
+
+#if !defined (CORBA_E_MICRO)
+ // ID uniqueness policy.
+ TAO::Portable_Server::IdUniquenessPolicy id_uniqueness_policy (PortableServer::UNIQUE_ID);
+ policies.merge_policy (&id_uniqueness_policy ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+#endif
+
+#if !defined (CORBA_E_MICRO)
+ // ID assignment policy.
+ TAO::Portable_Server::IdAssignmentPolicy id_assignment_policy (PortableServer::SYSTEM_ID);
+ policies.merge_policy (&id_assignment_policy ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+#endif
+
+#if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
+ // Implicit activation policy.
+ TAO::Portable_Server::ImplicitActivationPolicy implicit_activation_policy
+ (PortableServer::NO_IMPLICIT_ACTIVATION);
+ policies.merge_policy (&implicit_activation_policy ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Servant retention policy.
+ TAO::Portable_Server::ServantRetentionPolicy servant_retention_policy
+ (PortableServer::RETAIN);
+ policies.merge_policy (&servant_retention_policy ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Request processing policy.
+ TAO::Portable_Server::RequestProcessingPolicy request_processing_policy
+ (PortableServer::USE_ACTIVE_OBJECT_MAP_ONLY);
+ policies.merge_policy (&request_processing_policy ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+#endif /* TAO_HAS_MINIMUM_POA == 0 */
+#if defined (CORBA_E_MICRO)
+ ACE_UNUSED_ARG (policies);
+#endif
+}
+
+TAO_Object_Adapter::~TAO_Object_Adapter (void)
+{
+ delete this->hint_strategy_;
+ delete this->persistent_poa_name_map_;
+ delete this->transient_poa_map_;
+ delete this->lock_;
+
+ delete this->servant_dispatcher_;
+}
+
+/* static */
+ACE_Lock *
+TAO_Object_Adapter::create_lock (int enable_locking,
+ TAO_SYNCH_MUTEX &thread_lock)
+{
+#if defined (ACE_HAS_THREADS)
+ if (enable_locking)
+ {
+ ACE_Lock *the_lock = 0;
+ ACE_NEW_RETURN (the_lock,
+ ACE_Lock_Adapter<TAO_SYNCH_MUTEX> (thread_lock),
+ 0);
+ return the_lock;
+ }
+#else
+ ACE_UNUSED_ARG (enable_locking);
+ ACE_UNUSED_ARG (thread_lock);
+#endif /* ACE_HAS_THREADS */
+
+ ACE_Lock *the_lock = 0;
+ ACE_NEW_RETURN (the_lock,
+ ACE_Lock_Adapter<ACE_SYNCH_NULL_MUTEX> (),
+ 0);
+ return the_lock;
+}
+
+int
+TAO_Object_Adapter::dispatch_servant (const TAO::ObjectKey &key,
+ TAO_ServerRequest &req,
+ CORBA::Object_out forward_to
+ ACE_ENV_ARG_DECL)
+{
+ ACE_FUNCTION_TIMEPROBE (TAO_OBJECT_ADAPTER_DISPATCH_SERVANT_START);
+
+ // This object is magical, i.e., it has a non-trivial constructor
+ // and destructor.
+ TAO::Portable_Server::Servant_Upcall servant_upcall (&this->orb_core_);
+
+ // Set up state in the POA et al (including the POA Current), so
+ // that we know that this servant is currently in an upcall.
+ const char *operation = req.operation ();
+ int result =
+ servant_upcall.prepare_for_upcall (key,
+ operation,
+ forward_to
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (result);
+
+ if (result != TAO_Adapter::DS_OK)
+ return result;
+
+ // Preprocess request.
+ if (req.collocated ())
+ {
+ servant_upcall.pre_invoke_collocated_request (
+ ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (result);
+ }
+ else
+ {
+ servant_upcall.pre_invoke_remote_request (req
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (result);
+ }
+
+ // Servant dispatch.
+ {
+ ACE_FUNCTION_TIMEPROBE (TAO_SERVANT_DISPATCH_START);
+
+ do_dispatch (req, servant_upcall ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (result);
+ }
+
+ return result;
+}
+
+void
+TAO_Object_Adapter::locate_poa (const TAO::ObjectKey &key,
+ PortableServer::ObjectId &system_id,
+ TAO_Root_POA *&poa
+ ACE_ENV_ARG_DECL)
+{
+ TAO_Object_Adapter::poa_name poa_system_name;
+ CORBA::Boolean is_root = false;
+ CORBA::Boolean is_persistent = false;
+ CORBA::Boolean is_system_id = false;
+ TAO::Portable_Server::Temporary_Creation_Time poa_creation_time;
+
+ int result = 0;
+
+ {
+ ACE_FUNCTION_TIMEPROBE (TAO_POA_PARSE_KEY_START);
+
+ result = TAO_Root_POA::parse_key (key,
+ poa_system_name,
+ system_id,
+ is_root,
+ is_persistent,
+ is_system_id,
+ poa_creation_time);
+ }
+
+ if (result != 0)
+ ACE_THROW (CORBA::OBJ_ADAPTER ());
+
+ {
+ ACE_FUNCTION_TIMEPROBE (TAO_OBJECT_ADAPTER_FIND_POA_START);
+
+ result = this->find_poa (poa_system_name,
+ is_persistent,
+ is_root,
+ poa_creation_time,
+ poa
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ if (result != 0)
+ ACE_THROW (CORBA::OBJECT_NOT_EXIST (CORBA::OMGVMCID | 2,
+ CORBA::COMPLETED_NO));
+}
+
+int
+TAO_Object_Adapter::activate_poa (const poa_name &folded_name,
+ TAO_Root_POA *&poa
+ ACE_ENV_ARG_DECL)
+{
+ int result = -1;
+
+#if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_MICRO)
+
+ iteratable_poa_name ipn (folded_name);
+ iteratable_poa_name::iterator iterator = ipn.begin ();
+ iteratable_poa_name::iterator end = ipn.end ();
+
+ TAO_Root_POA *parent = this->root_;
+ if (parent == 0 || parent->name () != *iterator)
+ ACE_THROW_RETURN (CORBA::OBJ_ADAPTER (),
+ -1);
+ else
+ ++iterator;
+
+ for (;
+ iterator != end;
+ ++iterator)
+ {
+ TAO_Root_POA *current = 0;
+
+ ACE_TRY
+ {
+ current = parent->find_POA_i (*iterator,
+ 1
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCH (PortableServer::POA::AdapterNonExistent, ex)
+ {
+ return -1;
+ }
+ ACE_ENDTRY;
+ ACE_CHECK_RETURN (-1);
+
+ parent = current;
+ }
+
+ poa = parent;
+ result = 0;
+#else
+ ACE_UNUSED_ARG (folded_name);
+ ACE_UNUSED_ARG (poa);
+ ACE_ENV_ARG_NOT_USED; // FUZZ: ignore check_for_ace_check
+#endif /* TAO_HAS_MINIMUM_POA == 0 */
+
+ return result;
+}
+
+int
+TAO_Object_Adapter::find_transient_poa (const poa_name &system_name,
+ CORBA::Boolean root,
+ const TAO::Portable_Server::Temporary_Creation_Time &poa_creation_time,
+ TAO_Root_POA *&poa
+ ACE_ENV_ARG_DECL_NOT_USED)
+{
+ int result = 0;
+
+ if (root)
+ {
+ poa = this->root_;
+ }
+ else
+ {
+ result = this->transient_poa_map_->find (system_name,
+ poa);
+ }
+
+ if (poa == 0
+ || (result == 0 && !poa->validate_lifespan (false, poa_creation_time)))
+ result = -1;
+
+ return result;
+}
+
+int
+TAO_Object_Adapter::bind_poa (const poa_name &folded_name,
+ TAO_Root_POA *poa,
+ poa_name_out system_name)
+{
+ if (poa->persistent ())
+ return this->bind_persistent_poa (folded_name,
+ poa,
+ system_name);
+ else
+ return this->bind_transient_poa (poa,
+ system_name);
+}
+
+int
+TAO_Object_Adapter::unbind_poa (TAO_Root_POA *poa,
+ const poa_name &folded_name,
+ const poa_name &system_name)
+{
+ if (poa->persistent ())
+ return this->unbind_persistent_poa (folded_name,
+ system_name);
+ else
+ return this->unbind_transient_poa (system_name);
+}
+
+int
+TAO_Object_Adapter::locate_servant_i (const TAO::ObjectKey &key
+ ACE_ENV_ARG_DECL)
+{
+ ACE_FUNCTION_TIMEPROBE (TAO_POA_LOCATE_SERVANT_START);
+
+ PortableServer::ObjectId id;
+ TAO_Root_POA *poa = 0;
+
+ this->locate_poa (key,
+ id,
+ poa
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ PortableServer::Servant servant = 0;
+ TAO_SERVANT_LOCATION servant_location =
+ poa->locate_servant_i (id,
+ servant
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ switch (servant_location)
+ {
+ case TAO_SERVANT_FOUND:
+ // Optimistic attitude
+ case TAO_DEFAULT_SERVANT:
+ case TAO_SERVANT_MANAGER:
+ return 0;
+
+ case TAO_SERVANT_NOT_FOUND:
+ return -1;
+ }
+
+ return -1;
+}
+
+TAO_SERVANT_LOCATION
+TAO_Object_Adapter::find_servant_i (const TAO::ObjectKey &key,
+ PortableServer::Servant &servant
+ ACE_ENV_ARG_DECL)
+{
+ PortableServer::ObjectId id;
+ TAO_Root_POA *poa = 0;
+
+ this->locate_poa (key,
+ id,
+ poa
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO_SERVANT_NOT_FOUND);
+
+ TAO_SERVANT_LOCATION servant_location = poa->locate_servant_i (id,
+ servant
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO_SERVANT_NOT_FOUND);
+
+ return servant_location;
+}
+
+void
+TAO_Object_Adapter::open (ACE_ENV_SINGLE_ARG_DECL)
+{
+ // Add in the default POA policies to the default list.
+ this->init_default_policies (this->default_poa_policies ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // If a POA extension hasn't changed the servant dispatcher, initialize the
+ // default one.
+ if (this->servant_dispatcher_ == 0)
+ {
+ ACE_NEW (this->servant_dispatcher_,
+ TAO_Default_Servant_Dispatcher);
+ }
+
+#if !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
+ ACE_NEW_THROW_EX (this->poa_manager_factory_,
+ TAO_POAManager_Factory (*this),
+ CORBA::NO_MEMORY ());
+
+ ::CORBA::PolicyList policy;
+ PortableServer::POAManager_var poa_manager
+ = poa_manager_factory_->create_POAManager (TAO_DEFAULT_ROOTPOAMANAGER_NAME,
+ policy
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+#else
+ PortableServer::POAManager_var poa_manager;
+ PortableServer::POAManager_ptr pm = PortableServer::POAManager::_nil ();
+ ::CORBA::PolicyList policy_list;
+ ACE_NEW_THROW_EX (pm,
+ TAO_POA_Manager (*this, 0, policy_list, 0),
+ CORBA::NO_MEMORY
+ (CORBA::SystemException::_tao_minor_code (0, ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (::PortableServer::POAManager::_nil ());
+ poa_manager = pm;
+#endif
+
+ // This makes sure that the default resources are open when the Root
+ // POA is created.
+ this->orb_core_.thread_lane_resources_manager ().open_default_resources (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ TAO_POA_Policy_Set policies (this->default_poa_policies ());
+
+#if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
+ // Specify the implicit activation policy since it should
+ // be different from the default. Note that merge_policy
+ // takes a const reference and makes its own copy of the
+ // policy. (Otherwise, we'd have to allocate the policy
+ // on the heap.)
+ // Implicit activation policy.
+ TAO::Portable_Server::ImplicitActivationPolicy implicit_activation_policy
+ (PortableServer::IMPLICIT_ACTIVATION);
+ policies.merge_policy (&implicit_activation_policy ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+#endif /* TAO_HAS_MINIMUM_POA == 0 */
+
+ // Merge policies from the ORB level.
+ this->validator ().merge_policies (policies.policies ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // If any of the policy objects specified are not valid for the ORB
+ // implementation, if conflicting policy objects are specified, or
+ // if any of the specified policy objects require prior
+ // administrative action that has not been performed, an
+ // InvalidPolicy exception is raised containing the index in the
+ // policies parameter value of the first offending policy object.
+ policies.validate_policies (this->validator (),
+ this->orb_core_
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Construct a new POA
+ TAO_Root_POA::String root_poa_name (TAO_DEFAULT_ROOTPOA_NAME);
+ this->root_ =
+ this->servant_dispatcher_->create_Root_POA (root_poa_name,
+ poa_manager.in (),
+ policies,
+ this->lock (),
+ this->thread_lock (),
+ this->orb_core_,
+ this
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // The Object_Adapter will keep a reference to the Root POA so that
+ // on its destruction, it can check whether the Root POA has been
+ // destroyed yet or not.
+ this->root_->_add_ref ();
+
+ // Lock access for the duration of this transaction.
+ TAO::Portable_Server::POA_Guard poa_guard (*this->root_ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Iterate over the registered IOR interceptors so that they may be
+ // given the opportunity to add tagged components to the profiles
+ // for this servant.
+ this->root_->establish_components (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+void
+TAO_Object_Adapter::close (int wait_for_completion
+ ACE_ENV_ARG_DECL)
+{
+ this->check_close (wait_for_completion ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Shutting down the ORB causes all object adapters to be destroyed,
+ // since they cannot exist in the absence of an ORB. Shut down is
+ // complete when all ORB processing (including request processing
+ // and object deactivation or other operations associated with
+ // object adapters) has completed and the object adapters have been
+ // destroyed. In the case of the POA, this means that all object
+ // etherealizations have finished and root POA has been destroyed
+ // (implying that all descendent POAs have also been destroyed).
+ TAO_Root_POA *root = 0;
+ TAO_POAManager_Factory* factory = 0;
+ {
+ ACE_GUARD (ACE_Lock, ace_mon, this->lock ());
+ if (this->root_ == 0)
+ return;
+ root = this->root_;
+ this->root_ = 0;
+ if (this->poa_manager_factory_ == 0)
+ return;
+ factory = this->poa_manager_factory_;
+ this->poa_manager_factory_ = 0;
+ }
+ CORBA::Boolean etherealize_objects = 1;
+ root->destroy (etherealize_objects,
+ wait_for_completion
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ ::CORBA::release (root);
+#if !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
+ ::CORBA::release (factory);
+#endif
+}
+
+void
+TAO_Object_Adapter::check_close (int wait_for_completion
+ ACE_ENV_ARG_DECL)
+{
+ TAO_Root_POA::check_for_valid_wait_for_completions (this->orb_core (),
+ wait_for_completion
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+int
+TAO_Object_Adapter::priority (void) const
+{
+ return 0;
+}
+
+int
+TAO_Object_Adapter::dispatch (TAO::ObjectKey &key,
+ TAO_ServerRequest &request,
+ CORBA::Object_out forward_to
+ ACE_ENV_ARG_DECL)
+{
+ if (key.length() < TAO_Root_POA::TAO_OBJECTKEY_PREFIX_SIZE
+ || ACE_OS::memcmp (key.get_buffer (),
+ &TAO_Root_POA::objectkey_prefix[0],
+ TAO_Root_POA::TAO_OBJECTKEY_PREFIX_SIZE) != 0)
+ {
+ return TAO_Adapter::DS_MISMATCHED_KEY;
+ }
+
+ int result = 0;
+
+#if TAO_HAS_INTERCEPTORS == 1
+ TAO::ServerRequestInterceptor_Adapter *sri_adapter =
+ orb_core_.serverrequestinterceptor_adapter ();
+
+ ACE_TRY
+ {
+ if (sri_adapter != 0)
+ {
+#if TAO_HAS_EXTENDED_FT_INTERCEPTORS == 1
+ CORBA::OctetSeq_var ocs;
+ sri_adapter->tao_ft_interception_point (request,
+ 0, // args
+ 0, // nargs
+ 0, // servant_upcall
+ 0, // exceptions
+ 0, // nexceptions
+ ocs.out ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ /// If we have a cached result, just go ahead and send the reply
+ /// and let us return
+ if (ocs.ptr () != 0)
+ {
+ // request.result_seq (
+ request.send_cached_reply (ocs.inout ());
+
+ return TAO_Adapter::DS_OK;
+ }
+
+ // If a PortableInterceptor::ForwardRequest exception was
+ // thrown, then set the forward_to object reference and return
+ // with the appropriate return status.
+ forward_to.ptr () = request.forward_location ();
+ if (!CORBA::is_nil (request.forward_location ()))
+ {
+ return TAO_Adapter::DS_FORWARD;
+ }
+#endif /*TAO_HAS_EXTENDED_FT_INTERCEPTORS*/
+
+ // The receive_request_service_contexts() interception point
+ // must be invoked before the operation is dispatched to the
+ // servant.
+ sri_adapter->receive_request_service_contexts (request,
+ 0, // args
+ 0, // nargs
+ 0, // servant_upcall
+ 0, // exceptions
+ 0 // nexceptions
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ // If a PortableInterceptor::ForwardRequest exception was
+ // thrown, then set the forward_to object reference and return
+ // with the appropriate return status.
+ forward_to.ptr () = request.forward_location ();
+ if (!CORBA::is_nil (request.forward_location ()))
+ {
+ return TAO_Adapter::DS_FORWARD;
+ }
+ }
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+
+ result = this->dispatch_servant (key,
+ request,
+ forward_to
+ ACE_ENV_ARG_PARAMETER);
+
+#if TAO_HAS_INTERCEPTORS == 1
+ ACE_TRY_CHECK;
+
+ if (result == TAO_Adapter::DS_FORWARD)
+ {
+ request.forward_location (forward_to.ptr ());
+ if (sri_adapter != 0)
+ {
+ sri_adapter->send_other (request,
+ 0, // args
+ 0, // nargs
+ 0, // servant_upcall
+ 0, // exceptions
+ 0 // nexceptions
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ }
+ }
+ ACE_CATCHANY
+ {
+ // Just assume the current exception is a system exception, the
+ // status can only change when the interceptor changes this
+ // and this is only done when the sri_adapter is available. If we
+ // don't have an sri_adapter we just rethrow the exception
+ PortableInterceptor::ReplyStatus status =
+ PortableInterceptor::SYSTEM_EXCEPTION;
+
+ if (sri_adapter != 0)
+ {
+ request.caught_exception (&ACE_ANY_EXCEPTION);
+
+ sri_adapter->send_exception (request,
+ 0, // args
+ 0, // nargs
+ 0, // servant_upcall
+ 0, // exceptions
+ 0 // nexceptions
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ status =
+ request.reply_status ();
+ }
+
+ // Only re-throw the exception if it hasn't been transformed by
+ // the send_exception() interception point (e.g. to a
+ // LOCATION_FORWARD).
+ if (status == PortableInterceptor::SYSTEM_EXCEPTION
+ || status == PortableInterceptor::USER_EXCEPTION)
+ {
+ ACE_RE_THROW;
+ }
+ }
+ ACE_ENDTRY;
+ ACE_CHECK_RETURN (result);
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+
+ return result;
+}
+
+const char *
+TAO_Object_Adapter::name (void) const
+{
+ return TAO_OBJID_ROOTPOA;
+}
+
+CORBA::Object_ptr
+TAO_Object_Adapter::root (void)
+{
+ return CORBA::Object::_duplicate (this->root_);
+}
+
+CORBA::Object_ptr
+TAO_Object_Adapter::create_collocated_object (TAO_Stub *stub,
+ const TAO_MProfile &mp)
+{
+ TAO_ServantBase *sb = this->get_collocated_servant (mp);
+
+ // Set the servant ORB. Do not duplicate the ORB here since
+ // TAO_Stub::servant_orb() duplicates it.
+ stub->servant_orb (this->orb_core_.orb ());
+
+ // It is ok to create a collocated object even when <sb> is
+ // zero. This constructor will set the stub collocated indicator and
+ // the strategized proxy broker if required.
+ CORBA::Object_ptr x;
+ ACE_NEW_RETURN (x,
+ CORBA::Object (stub,
+ 1,
+ sb),
+ CORBA::Object::_nil ());
+
+ // Success.
+ return x;
+}
+
+CORBA::Long
+TAO_Object_Adapter::initialize_collocated_object (TAO_Stub *stub)
+{
+ // If we have been forwarded: use the forwarded profiles
+ const TAO_MProfile &mp = stub->forward_profiles () ? *(stub->forward_profiles ())
+ : stub->base_profiles ();
+
+ TAO_ServantBase *sb = this->get_collocated_servant (mp);
+
+ // Set the servant ORB. Do not duplicate the ORB here since
+ // TAO_Stub::servant_orb() duplicates it.
+ stub->servant_orb (this->orb_core_.orb ());
+
+ // It is ok to set the object as a collocated object even when
+ // <sb> is zero.
+ stub->collocated_servant (sb);
+
+ // Mark the stub as collocated. This will set the strategized object
+ // proxy broker if required.
+ stub->is_collocated (true);
+
+ // Return 0 (success) iff we found a servant.
+ return ! sb;
+}
+
+TAO_ServantBase *
+TAO_Object_Adapter::get_collocated_servant (const TAO_MProfile &mp)
+{
+ for (TAO_PHandle j = 0;
+ j != mp.profile_count ();
+ ++j)
+ {
+ const TAO_Profile *profile = mp.get_profile (j);
+ TAO::ObjectKey_var objkey = profile->_key ();
+
+ if (objkey->length() < TAO_Root_POA::TAO_OBJECTKEY_PREFIX_SIZE
+ || ACE_OS::memcmp (objkey->get_buffer (),
+ &TAO_Root_POA::objectkey_prefix[0],
+ TAO_Root_POA::TAO_OBJECTKEY_PREFIX_SIZE) != 0)
+ continue;
+
+ TAO_ServantBase *servant = 0;
+
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ this->find_servant (objkey.in (),
+ servant
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ }
+ ACE_ENDTRY;
+
+ return servant;
+ }
+
+ return 0;
+}
+
+// ****************************************************************
+
+TAO_Object_Adapter::Hint_Strategy::~Hint_Strategy (void)
+{
+}
+
+void
+TAO_Object_Adapter::Hint_Strategy::object_adapter (TAO_Object_Adapter *oa)
+{
+ this->object_adapter_ = oa;
+}
+
+TAO_Object_Adapter::Active_Hint_Strategy::Active_Hint_Strategy (CORBA::ULong map_size)
+ : persistent_poa_system_map_ (map_size)
+{
+}
+
+TAO_Object_Adapter::Active_Hint_Strategy::~Active_Hint_Strategy (void)
+{
+}
+
+int
+TAO_Object_Adapter::Active_Hint_Strategy::find_persistent_poa (
+ const poa_name &system_name,
+ TAO_Root_POA *&poa
+ ACE_ENV_ARG_DECL)
+{
+ poa_name folded_name;
+ int result = this->persistent_poa_system_map_.recover_key (system_name,
+ folded_name);
+
+ if (result == 0)
+ {
+ result = this->persistent_poa_system_map_.find (system_name,
+ poa);
+ if (result != 0
+ || folded_name != poa->folded_name ())
+ {
+ result =
+ this->object_adapter_->persistent_poa_name_map_->find (folded_name,
+ poa);
+ if (result != 0)
+ {
+ result =
+ this->object_adapter_->activate_poa (folded_name,
+ poa
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+ }
+ }
+ }
+
+ return result;
+}
+
+int
+TAO_Object_Adapter::Active_Hint_Strategy::bind_persistent_poa (
+ const poa_name &folded_name,
+ TAO_Root_POA *poa,
+ poa_name_out system_name)
+{
+ poa_name name = folded_name;
+ int result = this->persistent_poa_system_map_.bind_modify_key (poa,
+ name);
+
+ if (result == 0)
+ {
+ result =
+ this->object_adapter_->persistent_poa_name_map_->bind (folded_name,
+ poa);
+
+ if (result != 0)
+ this->persistent_poa_system_map_.unbind (name);
+ else
+ ACE_NEW_RETURN (system_name,
+ poa_name (name),
+ -1);
+ }
+
+ return result;
+}
+
+int
+TAO_Object_Adapter::Active_Hint_Strategy::unbind_persistent_poa (
+ const poa_name &folded_name,
+ const poa_name &system_name)
+{
+ int result = this->persistent_poa_system_map_.unbind (system_name);
+
+ if (result == 0)
+ result =
+ this->object_adapter_->persistent_poa_name_map_->unbind (folded_name);
+
+ return result;
+}
+
+TAO_Object_Adapter::No_Hint_Strategy::~No_Hint_Strategy (void)
+{
+}
+
+int
+TAO_Object_Adapter::No_Hint_Strategy::find_persistent_poa (
+ const poa_name &system_name,
+ TAO_Root_POA *&poa
+ ACE_ENV_ARG_DECL)
+{
+ int result =
+ this->object_adapter_->persistent_poa_name_map_->find (system_name,
+ poa);
+ if (result != 0)
+ {
+ result =
+ this->object_adapter_->activate_poa (system_name,
+ poa
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+ }
+
+ return result;
+}
+
+int
+TAO_Object_Adapter::No_Hint_Strategy::bind_persistent_poa (
+ const poa_name &folded_name,
+ TAO_Root_POA *poa,
+ poa_name_out system_name)
+{
+ int result =
+ this->object_adapter_->persistent_poa_name_map_->bind (folded_name,
+ poa);
+ if (result == 0)
+ ACE_NEW_RETURN (system_name,
+ poa_name (folded_name),
+ -1);
+ return result;
+}
+
+int
+TAO_Object_Adapter::No_Hint_Strategy::unbind_persistent_poa (
+ const poa_name & folded_name,
+ const poa_name & /* system_name */)
+{
+ return this->object_adapter_->persistent_poa_name_map_->unbind (folded_name);
+}
+
+TAO_Object_Adapter::poa_name_iterator::poa_name_iterator (
+ int begin,
+ CORBA::ULong size,
+ const CORBA::Octet *folded_buffer)
+ : size_ (size),
+ folded_buffer_ (folded_buffer),
+ last_separator_ ((CORBA::ULong) ~0)
+{
+ if (begin)
+ {
+ this->position_ = (CORBA::ULong) ~0;
+ this->operator++ ();
+ }
+ else
+ this->position_ = this->size_;
+}
+
+bool
+TAO_Object_Adapter::poa_name_iterator::operator== (const poa_name_iterator &rhs) const
+{
+ return this->position_ == rhs.position_;
+}
+
+bool
+TAO_Object_Adapter::poa_name_iterator::operator!= (const poa_name_iterator &rhs) const
+{
+ return !this->operator== (rhs);
+}
+
+ACE_CString
+TAO_Object_Adapter::poa_name_iterator::operator* () const
+{
+ CORBA::ULong start_at =
+ this->last_separator_ +
+ TAO_Root_POA::name_separator_length ();
+
+ CORBA::ULong how_many =
+ this->position_
+ - this->last_separator_
+ - TAO_Root_POA::name_separator_length ();
+
+ return ACE_CString (reinterpret_cast <const char *>
+ (&this->folded_buffer_[start_at]),
+ how_many);
+}
+
+TAO_Object_Adapter::poa_name_iterator &
+TAO_Object_Adapter::poa_name_iterator::operator++ (void)
+{
+ for (this->last_separator_ = this->position_;
+ ;
+ )
+ {
+ ++this->position_;
+ if (this->position_ < this->size_)
+ {
+ if (this->folded_buffer_[this->position_] == TAO_Root_POA::name_separator ())
+ break;
+ }
+ else
+ break;
+ }
+
+ return *this;
+}
+
+TAO_Object_Adapter::iteratable_poa_name::iteratable_poa_name (
+ const poa_name &folded_name)
+ : folded_name_ (folded_name)
+{
+}
+
+TAO_Object_Adapter::iteratable_poa_name::iterator
+TAO_Object_Adapter::iteratable_poa_name::begin (void) const
+{
+ return iterator (1,
+ this->folded_name_.length (),
+ this->folded_name_.get_buffer ());
+}
+
+TAO_Object_Adapter::iteratable_poa_name::iterator
+TAO_Object_Adapter::iteratable_poa_name::end (void) const
+{
+ return iterator (0,
+ this->folded_name_.length (),
+ this->folded_name_.get_buffer ());
+}
+
+void
+TAO_Object_Adapter::wait_for_non_servant_upcalls_to_complete (ACE_ENV_SINGLE_ARG_DECL)
+{
+ // Check if a non-servant upcall is in progress. If a non-servant
+ // upcall is in progress, wait for it to complete. Unless of
+ // course, the thread making the non-servant upcall is this thread.
+ while (this->enable_locking_ &&
+ this->non_servant_upcall_in_progress_ &&
+ ! ACE_OS::thr_equal (this->non_servant_upcall_thread_,
+ ACE_OS::thr_self ()))
+ {
+ // If so wait...
+ int result =
+ this->non_servant_upcall_condition_.wait ();
+ if (result == -1)
+ ACE_THROW (CORBA::OBJ_ADAPTER ());
+ }
+}
+
+void
+TAO_Object_Adapter::wait_for_non_servant_upcalls_to_complete_no_throw (void)
+{
+ // Non-exception throwing version.
+ ACE_TRY_NEW_ENV
+ {
+ this->wait_for_non_servant_upcalls_to_complete (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ ACE_ERROR ((LM_ERROR,
+ "TAO_Object_Adapter::wait_for_non_servant_upcalls_to_complete "
+ "threw exception it should not have!\n"));
+ }
+ ACE_ENDTRY;
+}
+
+void
+TAO_Object_Adapter::servant_dispatcher (TAO_Servant_Dispatcher *dispatcher)
+{
+ if (this->servant_dispatcher_)
+ delete this->servant_dispatcher_;
+
+ this->servant_dispatcher_ = dispatcher;
+}
+
+void
+TAO_Object_Adapter::do_dispatch (TAO_ServerRequest& req,
+ TAO::Portable_Server::Servant_Upcall& upcall
+ ACE_ENV_ARG_DECL)
+{
+ upcall.servant ()->_dispatch(req,
+ &upcall
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/Object_Adapter.h b/TAO/tao/PortableServer/Object_Adapter.h
new file mode 100644
index 00000000000..59f40a596b5
--- /dev/null
+++ b/TAO/tao/PortableServer/Object_Adapter.h
@@ -0,0 +1,521 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Object_Adapter.h
+ *
+ * $Id$
+ *
+ * @author Irfan Pyarali
+ */
+//=============================================================================
+
+#ifndef TAO_OBJECT_ADAPTER_H
+#define TAO_OBJECT_ADAPTER_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/Key_Adapters.h"
+#include "tao/PortableServer/poa_macros.h"
+#include "tao/PortableServer/Servant_Location.h"
+#include "tao/PortableServer/Default_Policy_Validator.h"
+#include "tao/PortableServer/POA_Policy_Set.h"
+
+#include "tao/Adapter.h"
+#include "tao/Adapter_Factory.h"
+#include "tao/Server_Strategy_Factory.h"
+#include "tao/LocalObject.h"
+
+#include "ace/Reverse_Lock_T.h"
+#include "ace/Condition_Thread_Mutex.h"
+#include "ace/Map_T.h"
+
+#include "tao/PortableServer/Servant_Location.h"
+
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Root_POA;
+class TAO_POA_Manager;
+class TAO_TSS_Resources;
+class TAO_Transport;
+class TAO_Servant_Dispatcher;
+class TAO_POAManager_Factory;
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ class Non_Servant_Upcall;
+ class Servant_Upcall;
+ class POA_Current_Impl;
+ class Temporary_Creation_Time;
+ }
+}
+
+/**
+ * @class TAO_Object_Adapter
+ *
+ * @brief Defines the Object Adapter abstraction.
+ *
+ * This class will be used as a facade for the POAs in a server
+ */
+class TAO_PortableServer_Export TAO_Object_Adapter
+ : public TAO_Adapter
+{
+public:
+
+ friend class TAO_Root_POA;
+
+ typedef PortableServer::ObjectId poa_name;
+ typedef PortableServer::ObjectId_var poa_name_var;
+ typedef PortableServer::ObjectId_out poa_name_out;
+
+ /// Constructor.
+ TAO_Object_Adapter (const TAO_Server_Strategy_Factory::Active_Object_Map_Creation_Parameters &creation_parameters,
+ TAO_ORB_Core &orb_core);
+
+ /// Destructor.
+ ~TAO_Object_Adapter (void);
+
+ int dispatch_servant (const TAO::ObjectKey &key,
+ TAO_ServerRequest &req,
+ CORBA::Object_out forward_to
+ ACE_ENV_ARG_DECL);
+
+ int locate_servant (const TAO::ObjectKey &key
+ ACE_ENV_ARG_DECL);
+
+ TAO_SERVANT_LOCATION find_servant (const TAO::ObjectKey &key,
+ PortableServer::Servant &servant
+ ACE_ENV_ARG_DECL);
+
+ int find_poa (const poa_name &system_name,
+ CORBA::Boolean activate_it,
+ CORBA::Boolean root,
+ const TAO::Portable_Server::Temporary_Creation_Time &poa_creation_time,
+ TAO_Root_POA *&poa
+ ACE_ENV_ARG_DECL);
+
+ int bind_poa (const poa_name &folded_name,
+ TAO_Root_POA *poa,
+ poa_name_out system_name);
+
+ int unbind_poa (TAO_Root_POA *poa,
+ const poa_name &folded_name,
+ const poa_name &system_name);
+
+ int activate_poa (const poa_name &folded_name,
+ TAO_Root_POA *&poa
+ ACE_ENV_ARG_DECL);
+
+ ACE_Lock &lock (void);
+
+ TAO_SYNCH_MUTEX &thread_lock (void);
+
+ ACE_Reverse_Lock<ACE_Lock> &reverse_lock (void);
+
+ /// Access the root poa.
+ TAO_Root_POA *root_poa (void) const;
+
+ /// Access to ORB Core.
+ TAO_ORB_Core &orb_core (void) const;
+
+ /// Wait for non-servant upcalls to complete.
+ void wait_for_non_servant_upcalls_to_complete (ACE_ENV_SINGLE_ARG_DECL);
+
+ /// Non-exception throwing version.
+ void wait_for_non_servant_upcalls_to_complete_no_throw (void);
+
+ static CORBA::ULong transient_poa_name_size (void);
+
+ /// Return the validator.
+ TAO_Policy_Validator &validator (void);
+
+ int enable_locking() const;
+
+ /// Return the set of default policies.
+ TAO_POA_Policy_Set &default_poa_policies (void);
+
+ /// Set the servant dispatcher method. Ownership is transferred to
+ /// this Object Adapter. Note: This should only be called
+ /// at initialization.
+ void servant_dispatcher (TAO_Servant_Dispatcher *dispatcher);
+
+ /// Initialize the default set of POA policies.
+ void init_default_policies (TAO_POA_Policy_Set &policies
+ ACE_ENV_ARG_DECL);
+
+ // = The TAO_Adapter methods, please check tao/Adapter.h for the
+ // documentation
+ virtual void open (ACE_ENV_SINGLE_ARG_DECL);
+ virtual void close (int wait_for_completion
+ ACE_ENV_ARG_DECL);
+ virtual void check_close (int wait_for_completion
+ ACE_ENV_ARG_DECL);
+ virtual int priority (void) const;
+ virtual int dispatch (TAO::ObjectKey &key,
+ TAO_ServerRequest &request,
+ CORBA::Object_out forward_to
+ ACE_ENV_ARG_DECL);
+ virtual const char *name (void) const;
+ virtual CORBA::Object_ptr root (void);
+ virtual CORBA::Object_ptr create_collocated_object (TAO_Stub *,
+ const TAO_MProfile &);
+
+ virtual CORBA::Long initialize_collocated_object (TAO_Stub *);
+
+protected:
+
+ int locate_servant_i (const TAO::ObjectKey &key
+ ACE_ENV_ARG_DECL);
+
+ TAO_SERVANT_LOCATION find_servant_i (const TAO::ObjectKey &key,
+ PortableServer::Servant &servant
+ ACE_ENV_ARG_DECL);
+
+ void dispatch_servant_i (const TAO::ObjectKey &key,
+ TAO_ServerRequest &req,
+ void *context
+ ACE_ENV_ARG_DECL);
+
+ void locate_poa (const TAO::ObjectKey &key,
+ PortableServer::ObjectId &id,
+ TAO_Root_POA *&poa
+ ACE_ENV_ARG_DECL);
+
+ int find_transient_poa (const poa_name &system_name,
+ CORBA::Boolean root,
+ const TAO::Portable_Server::Temporary_Creation_Time &poa_creation_time,
+ TAO_Root_POA *&poa
+ ACE_ENV_ARG_DECL);
+
+ int find_persistent_poa (const poa_name &system_name,
+ TAO_Root_POA *&poa
+ ACE_ENV_ARG_DECL);
+
+ int bind_transient_poa (TAO_Root_POA *poa,
+ poa_name_out system_name);
+
+ int bind_persistent_poa (const poa_name &folded_name,
+ TAO_Root_POA *poa,
+ poa_name_out system_name);
+
+ int unbind_transient_poa (const poa_name &system_name);
+
+ int unbind_persistent_poa (const poa_name &folded_name,
+ const poa_name &system_name);
+
+ static ACE_Lock *create_lock (int enable_locking,
+ TAO_SYNCH_MUTEX &thread_lock);
+
+ virtual void do_dispatch (TAO_ServerRequest& req,
+ TAO::Portable_Server::Servant_Upcall& upcall
+ ACE_ENV_ARG_DECL);
+
+public:
+
+ /**
+ * @class Hint_Strategy
+ *
+ * @brief Base class for POA active hint strategy.
+ *
+ * This class also provides for common structures used by all
+ * the derived classes.
+ */
+ class TAO_PortableServer_Export Hint_Strategy
+ {
+ public:
+
+ virtual ~Hint_Strategy (void);
+
+ virtual int find_persistent_poa (const poa_name &system_name,
+ TAO_Root_POA *&poa
+ ACE_ENV_ARG_DECL) = 0;
+
+ virtual int bind_persistent_poa (const poa_name &folded_name,
+ TAO_Root_POA *poa,
+ poa_name_out system_name) = 0;
+
+ virtual int unbind_persistent_poa (const poa_name &folded_name,
+ const poa_name &system_name) = 0;
+
+ void object_adapter (TAO_Object_Adapter *oa);
+
+ protected:
+
+ TAO_Object_Adapter *object_adapter_;
+ };
+
+ /**
+ * @class Active_Hint_Strategy
+ *
+ * @brief This class uses active demux hint for POA active hint
+ * strategy.
+ *
+ * This class will append an active hint to the POA name,
+ * making the POA lookups fast and predictable.
+ */
+ class TAO_PortableServer_Export Active_Hint_Strategy : public Hint_Strategy
+ {
+ public:
+
+ Active_Hint_Strategy (CORBA::ULong map_size);
+
+ virtual ~Active_Hint_Strategy (void);
+
+ virtual int find_persistent_poa (const poa_name &system_name,
+ TAO_Root_POA *&poa
+ ACE_ENV_ARG_DECL);
+
+ virtual int bind_persistent_poa (const poa_name &folded_name,
+ TAO_Root_POA *poa,
+ poa_name_out system_name);
+
+ virtual int unbind_persistent_poa (const poa_name &folded_name,
+ const poa_name &system_name);
+
+ protected:
+
+ typedef ACE_Active_Map_Manager_Adapter<
+ poa_name,
+ TAO_Root_POA *,
+ TAO_Preserve_Original_Key_Adapter> persistent_poa_system_map;
+
+ persistent_poa_system_map persistent_poa_system_map_;
+ };
+
+ friend class Active_Hint_Strategy;
+
+ /**
+ * @class No_Hint_Strategy
+ *
+ * @brief This class doesn't use any hints for POA active hint
+ * strategy.
+ *
+ * This class will simply use the POA names as is. And since
+ * no hint is added, the IORs will be smaller.
+ */
+ class TAO_PortableServer_Export No_Hint_Strategy : public Hint_Strategy
+ {
+ public:
+
+ virtual ~No_Hint_Strategy (void);
+
+ virtual int find_persistent_poa (const poa_name &system_name,
+ TAO_Root_POA *&poa
+ ACE_ENV_ARG_DECL);
+
+ virtual int bind_persistent_poa (const poa_name &folded_name,
+ TAO_Root_POA *poa,
+ poa_name_out system_name);
+
+ virtual int unbind_persistent_poa (const poa_name &folded_name,
+ const poa_name &system_name);
+
+ };
+
+ friend class No_Hint_Strategy;
+
+protected:
+
+ Hint_Strategy *hint_strategy_;
+
+ /// Base class of the id map.
+ typedef ACE_Map<
+ poa_name,
+ TAO_Root_POA *> transient_poa_map;
+
+#if (TAO_HAS_MINIMUM_POA_MAPS == 0)
+ /// Id hash map.
+ typedef ACE_Hash_Map_Manager_Ex_Adapter<
+ poa_name,
+ TAO_Root_POA *,
+ TAO_ObjectId_Hash,
+ ACE_Equal_To<poa_name>,
+ TAO_Incremental_Key_Generator> transient_poa_hash_map;
+#endif /* TAO_HAS_MINIMUM_POA_MAPS == 0 */
+
+#if (TAO_HAS_MINIMUM_POA_MAPS == 0)
+ /// Id linear map.
+ typedef ACE_Map_Manager_Adapter<
+ poa_name,
+ TAO_Root_POA *,
+ TAO_Incremental_Key_Generator> transient_poa_linear_map;
+#endif /* TAO_HAS_MINIMUM_POA_MAPS == 0 */
+
+ /// Id active map.
+ typedef ACE_Active_Map_Manager_Adapter<
+ poa_name,
+ TAO_Root_POA *,
+ TAO_Ignore_Original_Key_Adapter> transient_poa_active_map;
+
+ /// Base class of the name map.
+ typedef ACE_Map<
+ poa_name,
+ TAO_Root_POA *> persistent_poa_name_map;
+
+ /// Id hash map.
+ typedef ACE_Hash_Map_Manager_Ex_Adapter<
+ poa_name,
+ TAO_Root_POA *,
+ TAO_ObjectId_Hash,
+ ACE_Equal_To<PortableServer::ObjectId>,
+ ACE_Noop_Key_Generator<poa_name> > persistent_poa_name_hash_map;
+
+#if (TAO_HAS_MINIMUM_POA_MAPS == 0)
+ /// Id linear map.
+ typedef ACE_Map_Manager_Adapter<
+ poa_name,
+ TAO_Root_POA *,
+ ACE_Noop_Key_Generator<poa_name> > persistent_poa_name_linear_map;
+#endif /* TAO_HAS_MINIMUM_POA_MAPS == 0 */
+
+ /// Strategy for dispatching a request to a servant.
+ TAO_Servant_Dispatcher *servant_dispatcher_;
+
+ /// Persistent POA map
+ persistent_poa_name_map *persistent_poa_name_map_;
+
+ /// Transient POA map
+ transient_poa_map *transient_poa_map_;
+
+protected:
+
+ static CORBA::ULong transient_poa_name_size_;
+
+ static void set_transient_poa_name_size (const TAO_Server_Strategy_Factory::Active_Object_Map_Creation_Parameters &creation_parameters);
+
+ TAO_ORB_Core &orb_core_;
+
+ int enable_locking_;
+
+ TAO_SYNCH_MUTEX thread_lock_;
+
+ ACE_Lock *lock_;
+
+ ACE_Reverse_Lock<ACE_Lock> reverse_lock_;
+
+public:
+
+ /**
+ * @class poa_name_iterator
+ *
+ * @brief Iterator for a folded poa name.
+ */
+ class poa_name_iterator
+ {
+ public:
+
+ /// Constructor.
+ poa_name_iterator (int begin,
+ CORBA::ULong size,
+ const CORBA::Octet *folded_buffer);
+
+ /// Comparison operators.
+ bool operator== (const poa_name_iterator &rhs) const;
+ bool operator!= (const poa_name_iterator &rhs) const;
+
+ /// Dereference operator.
+ ACE_CString operator* () const;
+
+ /// Prefix advance.
+ poa_name_iterator &operator++ (void);
+
+ protected:
+
+ CORBA::ULong size_;
+ CORBA::ULong position_;
+ const CORBA::Octet *folded_buffer_;
+ CORBA::ULong last_separator_;
+ };
+
+ /**
+ * @class iteratable_poa_name
+ *
+ * @brief This class allows iteration over a folded poa name.
+ */
+ class iteratable_poa_name
+ {
+ public:
+
+ typedef poa_name_iterator iterator;
+
+ iteratable_poa_name (const poa_name &folded_name);
+
+ iterator begin (void) const;
+ iterator end (void) const;
+
+ protected:
+
+ const poa_name &folded_name_;
+ };
+
+ friend class TAO::Portable_Server::Non_Servant_Upcall;
+
+ friend class TAO::Portable_Server::Servant_Upcall;
+
+public:
+
+ /// Pointer to the non-servant upcall in progress. If no non-servant
+ /// upcall is in progress, this pointer is zero.
+ TAO::Portable_Server::Non_Servant_Upcall *non_servant_upcall_in_progress (void) const;
+
+private:
+
+ /// Helper method to get collocated servant
+ TAO_ServantBase *get_collocated_servant (const TAO_MProfile &mp);
+
+private:
+
+ /// Condition variable for waiting on non-servant upcalls to end.
+ TAO_SYNCH_CONDITION non_servant_upcall_condition_;
+
+ /// Pointer to the non-servant upcall in progress. If no non-servant
+ /// upcall is in progress, this pointer is zero.
+ TAO::Portable_Server::Non_Servant_Upcall *non_servant_upcall_in_progress_;
+
+ /// Current nesting level of non_servant_upcalls.
+ unsigned int non_servant_upcall_nesting_level_;
+
+ /// Id of thread making the non-servant upcall.
+ ACE_thread_t non_servant_upcall_thread_;
+
+ /// The Root POA
+ TAO_Root_POA *root_;
+
+ /// The POAManager factory.
+ TAO_POAManager_Factory *poa_manager_factory_;
+
+ /// The default validator and the beginning of the chain of
+ /// policy validators.
+ TAO_POA_Default_Policy_Validator default_validator_;
+
+ /// Save a list of default policies that should be included in
+ /// every POA (unless overridden).
+ TAO_POA_Policy_Set default_poa_policies_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#if defined (__ACE_INLINE__)
+# include "tao/PortableServer/Object_Adapter.i"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_OBJECT_ADAPTER_H */
diff --git a/TAO/tao/PortableServer/Object_Adapter.i b/TAO/tao/PortableServer/Object_Adapter.i
new file mode 100644
index 00000000000..2fe048e9a5e
--- /dev/null
+++ b/TAO/tao/PortableServer/Object_Adapter.i
@@ -0,0 +1,170 @@
+// -*- C++ -*-
+//
+// $Id$
+
+#include "tao/SystemException.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE TAO_Policy_Validator &
+TAO_Object_Adapter::validator (void)
+{
+ return this->default_validator_;
+}
+
+ACE_INLINE int
+TAO_Object_Adapter::enable_locking (void) const
+{
+ return this->enable_locking_;
+}
+
+ACE_INLINE TAO_POA_Policy_Set &
+TAO_Object_Adapter::default_poa_policies (void)
+{
+ return this->default_poa_policies_;
+}
+
+ACE_INLINE ACE_Lock &
+TAO_Object_Adapter::lock (void)
+{
+ return *this->lock_;
+}
+
+ACE_INLINE TAO_SYNCH_MUTEX &
+TAO_Object_Adapter::thread_lock (void)
+{
+ return this->thread_lock_;
+}
+
+ACE_INLINE ACE_Reverse_Lock<ACE_Lock> &
+TAO_Object_Adapter::reverse_lock (void)
+{
+ return this->reverse_lock_;
+}
+
+/* static */
+ACE_INLINE CORBA::ULong
+TAO_Object_Adapter::transient_poa_name_size ()
+{
+ return TAO_Object_Adapter::transient_poa_name_size_;
+}
+
+ACE_INLINE int
+TAO_Object_Adapter::locate_servant (const TAO::ObjectKey &key
+ ACE_ENV_ARG_DECL)
+{
+ // Lock access for the duration of this transaction.
+ TAO_OBJECT_ADAPTER_GUARD_RETURN (-1);
+
+ return this->locate_servant_i (key
+ ACE_ENV_ARG_PARAMETER);
+}
+
+ACE_INLINE TAO_SERVANT_LOCATION
+TAO_Object_Adapter::find_servant (const TAO::ObjectKey &key,
+ PortableServer::Servant &servant
+ ACE_ENV_ARG_DECL)
+{
+ // Lock access for the duration of this transaction.
+ TAO_OBJECT_ADAPTER_GUARD_RETURN (TAO_SERVANT_NOT_FOUND);
+
+ return this->find_servant_i (key,
+ servant
+ ACE_ENV_ARG_PARAMETER);
+}
+
+ACE_INLINE int
+TAO_Object_Adapter::find_persistent_poa (const poa_name &system_name,
+ TAO_Root_POA *&poa
+ ACE_ENV_ARG_DECL)
+{
+ return this->hint_strategy_->find_persistent_poa (system_name,
+ poa
+ ACE_ENV_ARG_PARAMETER);
+}
+
+ACE_INLINE int
+TAO_Object_Adapter::find_poa (const poa_name &system_name,
+ CORBA::Boolean activate_it,
+ CORBA::Boolean root,
+ const TAO::Portable_Server::Temporary_Creation_Time &poa_creation_time,
+ TAO_Root_POA *&poa
+ ACE_ENV_ARG_DECL)
+{
+ if (activate_it)
+ {
+ return this->find_persistent_poa (system_name,
+ poa
+ ACE_ENV_ARG_PARAMETER);
+ }
+ else
+ {
+ return this->find_transient_poa (system_name,
+ root,
+ poa_creation_time,
+ poa
+ ACE_ENV_ARG_PARAMETER);
+ }
+}
+
+ACE_INLINE int
+TAO_Object_Adapter::bind_transient_poa (TAO_Root_POA *poa,
+ poa_name_out system_name)
+{
+ poa_name name;
+ int result = this->transient_poa_map_->bind_create_key (poa,
+ name);
+
+ if (result == 0)
+ {
+ ACE_NEW_RETURN (system_name,
+ poa_name (name),
+ -1);
+ }
+
+ return result;
+}
+
+ACE_INLINE int
+TAO_Object_Adapter::bind_persistent_poa (const poa_name &folded_name,
+ TAO_Root_POA *poa,
+ poa_name_out system_name)
+{
+ return this->hint_strategy_->bind_persistent_poa (folded_name,
+ poa,
+ system_name);
+}
+
+ACE_INLINE int
+TAO_Object_Adapter::unbind_transient_poa (const poa_name &system_name)
+{
+ return this->transient_poa_map_->unbind (system_name);
+}
+
+ACE_INLINE int
+TAO_Object_Adapter::unbind_persistent_poa (const poa_name &folded_name,
+ const poa_name &system_name)
+{
+ return this->hint_strategy_->unbind_persistent_poa (folded_name,
+ system_name);
+}
+
+ACE_INLINE TAO_Root_POA *
+TAO_Object_Adapter::root_poa (void) const
+{
+ return this->root_;
+}
+
+ACE_INLINE TAO_ORB_Core &
+TAO_Object_Adapter::orb_core (void) const
+{
+ return this->orb_core_;
+}
+
+ACE_INLINE TAO::Portable_Server::Non_Servant_Upcall *
+TAO_Object_Adapter::non_servant_upcall_in_progress (void) const
+{
+ return this->non_servant_upcall_in_progress_;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/Object_Adapter_Factory.cpp b/TAO/tao/PortableServer/Object_Adapter_Factory.cpp
new file mode 100644
index 00000000000..0e2859d333c
--- /dev/null
+++ b/TAO/tao/PortableServer/Object_Adapter_Factory.cpp
@@ -0,0 +1,30 @@
+// $Id$
+
+#include "tao/PortableServer/Object_Adapter_Factory.h"
+#include "tao/PortableServer/Object_Adapter.h"
+#include "tao/ORB_Core.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Adapter*
+TAO_Object_Adapter_Factory::create (TAO_ORB_Core *orb_core)
+{
+ TAO_Adapter* adapter = 0;
+ ACE_NEW_RETURN (adapter,
+ TAO_Object_Adapter (orb_core->server_factory ()->
+ active_object_map_creation_parameters (),
+ *orb_core),
+ 0);
+ return adapter;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_FACTORY_DEFINE (TAO_PortableServer, TAO_Object_Adapter_Factory)
+ACE_STATIC_SVC_DEFINE (TAO_Object_Adapter_Factory,
+ ACE_TEXT ("TAO_Object_Adapter_Factory"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (TAO_Object_Adapter_Factory),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0)
+
diff --git a/TAO/tao/PortableServer/Object_Adapter_Factory.h b/TAO/tao/PortableServer/Object_Adapter_Factory.h
new file mode 100644
index 00000000000..77266900e27
--- /dev/null
+++ b/TAO/tao/PortableServer/Object_Adapter_Factory.h
@@ -0,0 +1,46 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Object_Adapter_Factory.h
+ *
+ * $Id$
+ *
+ * @author Irfan Pyarali
+ */
+//=============================================================================
+
+#ifndef TAO_OBJECT_ADAPTER_FACTORY_H
+#define TAO_OBJECT_ADAPTER_FACTORY_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Adapter_Factory.h"
+#include "ace/Service_Config.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_PortableServer_Export TAO_Object_Adapter_Factory
+ : public TAO_Adapter_Factory
+{
+public:
+
+ // = The TAO_Adapter_Factory methods, please read tao/Adapter.h for
+ // details.
+ virtual TAO_Adapter *create (TAO_ORB_Core *orb_core);
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE (TAO_Object_Adapter_Factory)
+ACE_FACTORY_DECLARE (TAO_PortableServer, TAO_Object_Adapter_Factory)
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_OBJECT_ADAPTER_FACTORY_H */
diff --git a/TAO/tao/PortableServer/Object_SArg_Traits.h b/TAO/tao/PortableServer/Object_SArg_Traits.h
new file mode 100644
index 00000000000..0145ec7909e
--- /dev/null
+++ b/TAO/tao/PortableServer/Object_SArg_Traits.h
@@ -0,0 +1,61 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Object_SArg_Traits.h
+ *
+ * $Id$
+ *
+ * @author Ossama Othman
+ */
+//=============================================================================
+
+#ifndef TAO_OBJECT_SARG_TRAITS_H
+#define TAO_OBJECT_SARG_TRAITS_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/CORBA_methods.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/Object_SArgument_T.h"
+#include "tao/PortableServer/SArg_Traits_T.h"
+#include "tao/Pseudo_VarOut_T.h"
+#include "tao/Any_Insert_Policy_T.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace CORBA
+{
+ class Object;
+ typedef Object *Object_ptr;
+
+ typedef TAO_Pseudo_Var_T<Object> Object_var;
+ typedef TAO_Pseudo_Out_T<Object> Object_out;
+}
+
+// --------------------------------------------------------------
+
+namespace TAO
+{
+ /// Used in generated code if CORBA::Object is an argument or
+ /// return type.
+ template<>
+ class TAO_PortableServer_Export SArg_Traits<CORBA::Object>
+ : public Object_SArg_Traits_T<CORBA::Object_ptr,
+ CORBA::Object_var,
+ CORBA::Object_out,
+ TAO::Any_Insert_Policy_Stream <CORBA::Object_ptr>
+ >
+ {
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_OBJECT_SARG_TRAITS_H */
diff --git a/TAO/tao/PortableServer/Object_SArgument_T.cpp b/TAO/tao/PortableServer/Object_SArgument_T.cpp
new file mode 100644
index 00000000000..9bdc6b3bcae
--- /dev/null
+++ b/TAO/tao/PortableServer/Object_SArgument_T.cpp
@@ -0,0 +1,125 @@
+// $Id$
+
+#ifndef TAO_OBJECT_SARGUMENT_T_CPP
+#define TAO_OBJECT_SARGUMENT_T_CPP
+
+#include "tao/PortableServer/Object_SArgument_T.h"
+
+#if !defined (__ACE_INLINE__)
+#include "tao/PortableServer/Object_SArgument_T.inl"
+#endif /* __ACE_INLINE__ */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template<typename S_ptr,
+ typename S_var,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::In_Object_SArgument_T<S_ptr,S_var,Insert_Policy>::demarshal (TAO_InputCDR &cdr)
+{
+ return cdr >> this->x_.out ();
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S_ptr,
+ typename S_var,
+ class Insert_Policy>
+void
+TAO::In_Object_SArgument_T<S_ptr,S_var,Insert_Policy>::interceptor_value (
+ CORBA::Any *any) const
+{
+ Insert_Policy::any_insert (any, this->x_.in ());
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+// ===========================================================
+
+template<typename S_ptr,
+ typename S_var,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::Inout_Object_SArgument_T<S_ptr,S_var,Insert_Policy>::marshal (TAO_OutputCDR &cdr)
+{
+ return cdr << this->x_.in ();
+}
+
+template<typename S_ptr,
+ typename S_var,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::Inout_Object_SArgument_T<S_ptr,S_var,Insert_Policy>::demarshal (TAO_InputCDR & cdr)
+{
+ return cdr >> this->x_.out ();
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S_ptr,
+ typename S_var,
+ class Insert_Policy>
+void
+TAO::Inout_Object_SArgument_T<S_ptr,S_var,Insert_Policy>::interceptor_value (
+ CORBA::Any *any) const
+{
+ Insert_Policy::any_insert (any, this->x_.in ());
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+// ==============================================================
+
+template<typename S_ptr,
+ typename S_var,
+ typename S_out,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::Out_Object_SArgument_T<S_ptr,S_var,S_out,Insert_Policy>::marshal (TAO_OutputCDR &cdr)
+{
+ return cdr << this->x_.in ();
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S_ptr,
+ typename S_var,
+ typename S_out,
+ class Insert_Policy>
+void
+TAO::Out_Object_SArgument_T<S_ptr,S_var,S_out,Insert_Policy>::interceptor_value (
+ CORBA::Any *any) const
+{
+ Insert_Policy::any_insert (any, this->x_.in ());
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+// ============================================================
+
+template<typename S_ptr,
+ typename S_var,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::Ret_Object_SArgument_T<S_ptr,S_var,Insert_Policy>::marshal (TAO_OutputCDR &cdr)
+{
+ return cdr << this->x_.in ();
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S_ptr,
+ typename S_var,
+ class Insert_Policy>
+void
+TAO::Ret_Object_SArgument_T<S_ptr,S_var,Insert_Policy>::interceptor_value (
+ CORBA::Any *any) const
+{
+ Insert_Policy::any_insert (any, this->x_.in ());
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_OBJECT_SARGUMENT_T_CPP */
diff --git a/TAO/tao/PortableServer/Object_SArgument_T.h b/TAO/tao/PortableServer/Object_SArgument_T.h
new file mode 100644
index 00000000000..2274a22c781
--- /dev/null
+++ b/TAO/tao/PortableServer/Object_SArgument_T.h
@@ -0,0 +1,187 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Object_SArgument_T.h
+ *
+ * $Id$
+ *
+ * @authors Jeff Parsons, Carlos O'Ryan and Ossama Othman
+ */
+//=============================================================================
+
+
+#ifndef TAO_OBJECT_SARGUMENT_T_H
+#define TAO_OBJECT_SARGUMENT_T_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Argument.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// This set of classes is also used by valuetype arguments. If the
+// specialization is done using S * for the parameter, the semantics
+// are the same as for interfaces, so there's no need for another
+// set of classes.
+
+namespace TAO
+{
+ /**
+ * @class In_Object_SArgument_T
+ *
+ * @brief Template class for IN skeleton object argument.
+ *
+ */
+ template<typename S_ptr,
+ typename S_var,
+ class Insert_Policy>
+ class In_Object_SArgument_T : public InArgument
+ {
+ public:
+
+ virtual CORBA::Boolean demarshal (TAO_InputCDR &);
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ S_ptr arg (void) const;
+
+ private:
+ S_var x_;
+ };
+
+ /**
+ * @class Inout_Object_SArgument_T
+ *
+ * @brief Template class for INOUT skeleton object argument.
+ *
+ */
+ template<typename S_ptr,
+ typename S_var,
+ class Insert_Policy>
+ class Inout_Object_SArgument_T : public InoutArgument
+ {
+ public:
+ Inout_Object_SArgument_T (void);
+
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+ virtual CORBA::Boolean demarshal (TAO_InputCDR &);
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ S_ptr & arg (void);
+
+ private:
+ S_var x_;
+ };
+
+ /**
+ * @class Out_Object_SArgument_T
+ *
+ * @brief Template class for INOUT skeleton object argument.
+ *
+ */
+ template<typename S_ptr,
+ typename S_var,
+ typename S_out,
+ class Insert_Policy>
+ class Out_Object_SArgument_T : public OutArgument
+ {
+ public:
+ Out_Object_SArgument_T (void);
+
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ S_out arg (void);
+
+ private:
+ S_var x_;
+ };
+
+ /**
+ * @class Ret_Object_SArgument_T
+ *
+ * @brief Template class for return skeleton value of object.
+ *
+ */
+ template<typename S_ptr,
+ typename S_var,
+ class Insert_Policy>
+ class Ret_Object_SArgument_T : public RetArgument
+ {
+ public:
+ Ret_Object_SArgument_T (void);
+
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ S_ptr & arg (void);
+
+ private:
+ S_var x_;
+ };
+
+ /**
+ * @struct Object_SArg_Traits_T
+ *
+ * @brief Template class for skeleton argument traits of objects.
+ *
+ */
+ template<typename T_ptr,
+ typename T_var,
+ typename T_out,
+ class Insert_Policy>
+ struct Object_SArg_Traits_T
+ {
+ typedef T_ptr ret_type;
+ typedef T_ptr in_type;
+ typedef T_ptr & inout_type;
+ typedef T_out out_type;
+
+ typedef In_Object_SArgument_T<T_ptr,
+ T_var,
+ Insert_Policy> in_arg_val;
+ typedef Inout_Object_SArgument_T<T_ptr,
+ T_var,
+ Insert_Policy> inout_arg_val;
+ typedef Out_Object_SArgument_T<T_ptr,
+ T_var,
+ T_out,
+ Insert_Policy> out_arg_val;
+ typedef Ret_Object_SArgument_T<T_ptr,
+ T_var,
+ Insert_Policy> ret_val;
+
+ // Typedefs corresponding to return value of arg() method in both
+ // the client and server side argument class templates.
+ typedef in_type in_arg_type;
+ typedef inout_type inout_arg_type;
+ typedef out_type out_arg_type;
+ typedef inout_type ret_arg_type;
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+#include "tao/PortableServer/Object_SArgument_T.inl"
+#endif /* __ACE_INLINE__ */
+
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+#include "tao/PortableServer/Object_SArgument_T.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
+#pragma implementation ("Object_SArgument_T.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_OBJECT_SARGUMENT_T_H */
diff --git a/TAO/tao/PortableServer/Object_SArgument_T.inl b/TAO/tao/PortableServer/Object_SArgument_T.inl
new file mode 100644
index 00000000000..d6392bc972f
--- /dev/null
+++ b/TAO/tao/PortableServer/Object_SArgument_T.inl
@@ -0,0 +1,83 @@
+// -*- C++ -*-
+//
+// $Id$
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template<typename S_ptr,
+ typename S_var,
+ class Insert_Policy>
+ACE_INLINE
+S_ptr
+TAO::In_Object_SArgument_T<S_ptr,S_var,Insert_Policy>::arg (void) const
+{
+ return this->x_.in ();
+}
+
+// ==========================================================================
+
+template<typename S_ptr,
+ typename S_var,
+ class Insert_Policy>
+ACE_INLINE
+TAO::Inout_Object_SArgument_T<S_ptr,S_var,Insert_Policy>::
+Inout_Object_SArgument_T (void)
+{
+}
+
+template<typename S_ptr,
+ typename S_var,
+ class Insert_Policy>
+ACE_INLINE
+S_ptr&
+TAO::Inout_Object_SArgument_T<S_ptr,S_var,Insert_Policy>::arg (void)
+{
+ return this->x_.inout ();
+}
+
+// ==========================================================================
+
+template<typename S_ptr,
+ typename S_var,
+ typename S_out,
+ class Insert_Policy>
+ACE_INLINE
+TAO::Out_Object_SArgument_T<S_ptr,S_var,S_out,Insert_Policy>::
+Out_Object_SArgument_T (void)
+{
+}
+
+template<typename S_ptr,
+ typename S_var,
+ typename S_out,
+ class Insert_Policy>
+ACE_INLINE
+S_out
+TAO::Out_Object_SArgument_T<S_ptr,S_var,S_out,Insert_Policy>::arg (void)
+{
+ return this->x_.out ();
+}
+
+// ==========================================================================
+
+template<typename S_ptr,
+ typename S_var,
+ class Insert_Policy>
+ACE_INLINE
+TAO::Ret_Object_SArgument_T<S_ptr,S_var,Insert_Policy>::
+Ret_Object_SArgument_T (void)
+{
+}
+
+template<typename S_ptr,
+ typename S_var,
+ class Insert_Policy>
+ACE_INLINE
+S_ptr &
+TAO::Ret_Object_SArgument_T<S_ptr,S_var,Insert_Policy>::arg (void)
+{
+ return this->x_.out ();
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/Operation_Table.cpp b/TAO/tao/PortableServer/Operation_Table.cpp
new file mode 100644
index 00000000000..bf8be18d80d
--- /dev/null
+++ b/TAO/tao/PortableServer/Operation_Table.cpp
@@ -0,0 +1,25 @@
+// $Id$
+
+#include "tao/PortableServer/Operation_Table.h"
+#include "tao/ORB.h"
+
+ACE_RCSID(PortableServer,
+ Operation_Table,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// destructor
+TAO_Operation_Table::~TAO_Operation_Table (void)
+{
+}
+
+/**************************************************************/
+TAO::Operation_Skeletons::Operation_Skeletons (void)
+ : skel_ptr (0)
+ , thruPOA_skel_ptr (0)
+ , direct_skel_ptr (0)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/Operation_Table.h b/TAO/tao/PortableServer/Operation_Table.h
new file mode 100644
index 00000000000..d573d2c9f8e
--- /dev/null
+++ b/TAO/tao/PortableServer/Operation_Table.h
@@ -0,0 +1,139 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Operation_Table.h
+ *
+ * $Id$
+ *
+ * @author Aniruddha Gokhale
+ */
+//=============================================================================
+
+#ifndef TAO_OPTABLE_H
+#define TAO_OPTABLE_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Object.h"
+#include "tao/Collocation_Strategy.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_ServerRequest;
+class TAO_Abstract_ServantBase;
+
+namespace CORBA
+{
+ class Environment;
+}
+
+typedef void (*TAO_Skeleton)(
+ TAO_ServerRequest &,
+ void *,
+ void *
+#if !defined (TAO_HAS_EXCEPTIONS) || defined (ACE_ENV_BKWD_COMPAT)
+ , CORBA::Environment &
+#endif
+ );
+
+typedef void (*TAO_Collocated_Skeleton)(
+ TAO_Abstract_ServantBase *,
+ TAO::Argument **,
+ int
+#if !defined (TAO_HAS_EXCEPTIONS) || defined (ACE_ENV_BKWD_COMPAT)
+ , CORBA::Environment &
+#endif
+ );
+
+/**
+ * @struct TAO_operation_db_entry
+ *
+ * @brief Define a table entry that holds an operation name and its
+ * corresponding skeleton. A table of such entries is used to
+ * initialize the different lookup strategies.
+ */
+struct TAO_operation_db_entry
+{
+ /// Operation name
+ char const * opname;
+
+ /// Remote/thru-POA skeleton pointer
+ TAO_Skeleton skel_ptr;
+
+ /// Collocated skeleton pointers.
+ TAO_Collocated_Skeleton direct_skel_ptr;
+};
+
+// --------------------------
+
+namespace TAO
+{
+ /**
+ * @class Operation_Skeleton_Ptr
+ *
+ * @brief A logical aggregation of all the operation skeleton pointers
+ * in use.
+ *
+ * This is not used by the IDL compiler. This is used internally
+ * within different strategies.
+ */
+ struct Operation_Skeletons
+ {
+ Operation_Skeletons (void);
+
+ /// Remote skeleton pointer
+ TAO_Skeleton skel_ptr;
+
+ /// Collocated skeleton pointers.
+ TAO_Skeleton thruPOA_skel_ptr;
+ TAO_Collocated_Skeleton direct_skel_ptr;
+ };
+}
+
+/**
+ * @class TAO_Operation_Table
+ *
+ * @brief Abstract class for maintaining and lookup of CORBA IDL
+ * operation names.
+ */
+class TAO_PortableServer_Export TAO_Operation_Table
+{
+public:
+ /**
+ * Uses @a opname to look up the skeleton function and pass it back
+ * in @a skelfunc. Returns non-negative integer on success, or -1
+ * on failure.
+ */
+ virtual int find (const char *opname,
+ TAO_Skeleton &skelfunc,
+ const unsigned int length = 0) = 0;
+
+ /**
+ * Uses @a opname to look up the collocated skeleton function and
+ * pass it back in @a skelfunc. Returns non-negative integer on
+ * success, or -1 on failure.
+ */
+ virtual int find (const char *opname,
+ TAO_Collocated_Skeleton &skelfunc,
+ TAO::Collocation_Strategy s,
+ const unsigned int length = 0) = 0;
+
+ /// Associate the skeleton @a skel_ptr with an operation named
+ /// @a opname. Returns -1 on failure, 0 on success, 1 on duplicate.
+ virtual int bind (const char *opname,
+ const TAO::Operation_Skeletons skel_ptr) = 0;
+
+ virtual ~TAO_Operation_Table (void);
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_OPTABLE_H */
diff --git a/TAO/tao/PortableServer/Operation_Table_Binary_Search.cpp b/TAO/tao/PortableServer/Operation_Table_Binary_Search.cpp
new file mode 100644
index 00000000000..0df9e27630a
--- /dev/null
+++ b/TAO/tao/PortableServer/Operation_Table_Binary_Search.cpp
@@ -0,0 +1,91 @@
+// $Id$
+
+#include "tao/PortableServer/Operation_Table_Binary_Search.h"
+#include "tao/Timeprobe.h"
+#include "ace/Log_Msg.h"
+
+ACE_RCSID(PortableServer,
+ Operation_Table_Binary_Search,
+ "$Id$")
+
+#if defined (ACE_ENABLE_TIMEPROBES)
+
+static const char *TAO_Operation_Table_Timeprobe_Description[] =
+ {
+ "TAO_Binary_Search_OpTable::find - start",
+ "TAO_Binary_Search_OpTable::find - end"
+ };
+
+enum
+ {
+ // Timeprobe description table start key
+ TAO_BINARY_SEARCH_OPTABLE_FIND_START = 608,
+ TAO_BINARY_SEARCH_OPTABLE_FIND_END
+ };
+
+// Setup Timeprobes
+ACE_TIMEPROBE_EVENT_DESCRIPTIONS (TAO_Operation_Table_Timeprobe_Description,
+ TAO_BINARY_SEARCH_OPTABLE_FIND_START);
+
+#endif /* ACE_ENABLE_TIMEPROBES */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Binary_Search_OpTable::~TAO_Binary_Search_OpTable (void)
+{
+}
+
+int
+TAO_Binary_Search_OpTable::find (const char *opname,
+ TAO_Skeleton &skelfunc,
+ const unsigned int /* length */)
+{
+ ACE_FUNCTION_TIMEPROBE (TAO_BINARY_SEARCH_OPTABLE_FIND_START);
+
+ TAO_operation_db_entry const * const entry = lookup (opname);
+
+ if (entry == 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("TAO_Binary_Search_Table:find failed\n")),
+ -1);
+ // Valid entry. Figure out the skel_ptr.
+ skelfunc = entry->skel_ptr;
+
+ return 0;
+}
+
+int
+TAO_Binary_Search_OpTable::find (const char *opname,
+ TAO_Collocated_Skeleton &skelfunc,
+ TAO::Collocation_Strategy st,
+ const unsigned int /* length */)
+{
+ ACE_FUNCTION_TIMEPROBE (TAO_BINARY_SEARCH_OPTABLE_FIND_START);
+
+ TAO_operation_db_entry const * const entry = lookup (opname);
+
+ if (entry == 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("TAO_Binary_Search_Table:find failed\n")),
+ -1);
+
+ switch (st)
+ {
+ case TAO::TAO_CS_DIRECT_STRATEGY:
+ skelfunc = entry->direct_skel_ptr;
+ break;
+ default:
+ return -1;
+ }
+
+ return 0;
+}
+
+int
+TAO_Binary_Search_OpTable::bind (const char *,
+ const TAO::Operation_Skeletons)
+{
+ return 0;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/Operation_Table_Binary_Search.h b/TAO/tao/PortableServer/Operation_Table_Binary_Search.h
new file mode 100644
index 00000000000..1d8d0a11c02
--- /dev/null
+++ b/TAO/tao/PortableServer/Operation_Table_Binary_Search.h
@@ -0,0 +1,69 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Operation_Table_Binary_Search.h
+ *
+ * $Id$
+ *
+ * @author Aniruddha Gokhale
+ */
+//=============================================================================
+
+#ifndef TAO_OPERATION_TABLE_BINARY_SEARCH_H
+#define TAO_OPERATION_TABLE_BINARY_SEARCH_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/Operation_Table.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_Binary_Search_OpTable
+ *
+ * @brief Helper class for using binary search operatin lookup strategy
+ * in the server skeletons.
+ *
+ * This class declares pure virtual method called 'lookup ()'
+ * which will be generated by the GPERF program. This method is
+ * used by 'bind ()' and 'find ()' methods. Subclasses will
+ * define the lookup method.
+ */
+class TAO_PortableServer_Export TAO_Binary_Search_OpTable
+ : public TAO_Operation_Table
+{
+public:
+
+ /// Do nothing destrctor.
+ virtual ~TAO_Binary_Search_OpTable (void);
+
+ /// See the documentation in the base class for details.
+ virtual int find (const char *opname,
+ TAO_Skeleton &skelfunc,
+ const unsigned int length = 0);
+
+ virtual int find (const char *opname,
+ TAO_Collocated_Skeleton &skelfunc,
+ TAO::Collocation_Strategy s,
+ const unsigned int length = 0);
+
+ virtual int bind (const char *opname,
+ const TAO::Operation_Skeletons skel_ptr);
+
+private:
+ /// Method that should defined by the subclasses. GPERF program
+ /// will generate this routine routines.
+ virtual const TAO_operation_db_entry* lookup (const char *str) = 0;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_OPERATION_TABLE_BINARY_SEARCH_H */
diff --git a/TAO/tao/PortableServer/Operation_Table_Dynamic_Hash.cpp b/TAO/tao/PortableServer/Operation_Table_Dynamic_Hash.cpp
new file mode 100644
index 00000000000..21a206d9fba
--- /dev/null
+++ b/TAO/tao/PortableServer/Operation_Table_Dynamic_Hash.cpp
@@ -0,0 +1,133 @@
+// $Id$
+
+#include "tao/PortableServer/Operation_Table_Dynamic_Hash.h"
+#include "tao/Timeprobe.h"
+#include "ace/Log_Msg.h"
+
+ACE_RCSID(PortableServer,
+ Operation_Table_Dynamic_Hash,
+ "$Id$")
+
+#if defined (ACE_ENABLE_TIMEPROBES)
+
+static const char *TAO_Operation_Table_Timeprobe_Description[] =
+ {
+ "TAO_Dynamic_Hash_OpTable::find - start",
+ "TAO_Dynamic_Hash_OpTable::find - end",
+ };
+
+enum
+ {
+ // Timeprobe description table start key
+ TAO_DYNAMIC_HASH_OPTABLE_FIND_START = 600,
+ TAO_DYNAMIC_HASH_OPTABLE_FIND_END,
+ };
+
+// Setup Timeprobes
+ACE_TIMEPROBE_EVENT_DESCRIPTIONS (TAO_Operation_Table_Timeprobe_Description,
+ TAO_DYNAMIC_HASH_OPTABLE_FIND_START);
+
+#endif /* ACE_ENABLE_TIMEPROBES */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// constructor
+TAO_Dynamic_Hash_OpTable::TAO_Dynamic_Hash_OpTable (
+ TAO_operation_db_entry const * db,
+ CORBA::ULong dbsize,
+ CORBA::ULong hashtblsize,
+ ACE_Allocator *alloc)
+ : hash_ (hashtblsize, alloc)
+{
+ // Iterate thru each entry in the database and bind the operation
+ // name to its corresponding skeleton.
+ for (CORBA::ULong i = 0; i < dbsize; ++i)
+ {
+ TAO::Operation_Skeletons s;
+ s.skel_ptr = db[i].skel_ptr;
+ s.thruPOA_skel_ptr = db[i].skel_ptr;
+ s.direct_skel_ptr = db[i].direct_skel_ptr;
+
+ // @@ (ASG): what happens if bind fails ???
+ if (this->bind (db[i].opname, s) == -1)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) %p\n"),
+ ACE_TEXT ("bind failed")));
+ }
+}
+
+TAO_Dynamic_Hash_OpTable::~TAO_Dynamic_Hash_OpTable (void)
+{
+ // Initialize an iterator. We need to go thru each entry and free
+ // up storage allocated to hold the external ids. In this case,
+ // these are strings.
+ OP_MAP_MANAGER::ITERATOR iterator (this->hash_);
+
+ for (OP_MAP_MANAGER::ENTRY *entry = 0;
+ iterator.next (entry) != 0;
+ iterator.advance ())
+ {
+ // We had allocated memory and stored the string. So we free the
+ // memory.
+ CORBA::string_free ((char *) entry->ext_id_);
+ entry->ext_id_ = 0;
+ }
+}
+
+int
+TAO_Dynamic_Hash_OpTable::bind (const char *opname,
+ const TAO::Operation_Skeletons skel_ptr)
+{
+ return this->hash_.bind (CORBA::string_dup (opname),
+ skel_ptr);
+}
+
+int
+TAO_Dynamic_Hash_OpTable::find (const char *opname,
+ TAO_Skeleton& skel_ptr,
+ const unsigned int )
+{
+ ACE_FUNCTION_TIMEPROBE (TAO_DYNAMIC_HASH_OPTABLE_FIND_START);
+ TAO::Operation_Skeletons s;
+
+ int retval =
+ this->hash_.find ((const char *)opname,
+ s);
+
+ if (retval != -1)
+ {
+ skel_ptr = s.skel_ptr;
+ }
+
+ return retval;
+}
+
+int
+TAO_Dynamic_Hash_OpTable::find (const char *opname,
+ TAO_Collocated_Skeleton& skel_ptr,
+ TAO::Collocation_Strategy s,
+ const unsigned int )
+{
+ ACE_FUNCTION_TIMEPROBE (TAO_DYNAMIC_HASH_OPTABLE_FIND_START);
+
+ TAO::Operation_Skeletons skel;
+
+ int retval =
+ this->hash_.find ((const char *)opname, skel);
+
+ if (retval != -1)
+ {
+ switch (s)
+ {
+ case TAO::TAO_CS_DIRECT_STRATEGY:
+ skel_ptr = skel.direct_skel_ptr;
+ break;
+ default:
+ return -1;
+ }
+ }
+
+ return retval;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/Operation_Table_Dynamic_Hash.h b/TAO/tao/PortableServer/Operation_Table_Dynamic_Hash.h
new file mode 100644
index 00000000000..40973757eba
--- /dev/null
+++ b/TAO/tao/PortableServer/Operation_Table_Dynamic_Hash.h
@@ -0,0 +1,84 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Operation_Table_Dynamic_Hash.h
+ *
+ * $Id$
+ *
+ * @author Aniruddha Gokhale
+ */
+//=============================================================================
+
+#ifndef TAO_OPERATION_TABLE_DYNAMIC_HASH_H
+#define TAO_OPERATION_TABLE_DYNAMIC_HASH_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/Operation_Table.h"
+#include "ace/Hash_Map_Manager.h"
+#include "ace/Synch_Traits.h"
+#include "ace/Null_Mutex.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_Dynamic_Hash_OpTable
+ *
+ * @brief Dynamic Hashing scheme for CORBA IDL operation name lookup.
+ */
+class TAO_PortableServer_Export TAO_Dynamic_Hash_OpTable
+ : public TAO_Operation_Table
+{
+public:
+ // = Initialization and termination methods.
+ /**
+ * Initialize the dynamic hash operation table with a database of
+ * operation names. The hash table size may be different from the
+ * size of the database. Hence we use the third argument to specify
+ * the size of the internal hash table. The <alloc> argument is
+ * used to determine where the memory comes from (usually from
+ * <ACE_Static_Allocator_Base>).
+ */
+ TAO_Dynamic_Hash_OpTable (const TAO_operation_db_entry *db,
+ CORBA::ULong dbsize,
+ CORBA::ULong hashtblsize,
+ ACE_Allocator *alloc);
+
+ /// Destructor
+ ~TAO_Dynamic_Hash_OpTable (void);
+
+ /// See the documentation in the base class for details.
+ virtual int bind (const char *opname,
+ const TAO::Operation_Skeletons skel_ptr);
+
+ virtual int find (const char *opname,
+ TAO_Skeleton &skelfunc,
+ const unsigned int length = 0);
+
+ virtual int find (const char *opname,
+ TAO_Collocated_Skeleton &skelfunc,
+ TAO::Collocation_Strategy s,
+ const unsigned int length = 0);
+private:
+ typedef ACE_Hash_Map_Manager_Ex<const char *,
+ TAO::Operation_Skeletons,
+ ACE_Hash<const char *>,
+ ACE_Equal_To<const char *>,
+ ACE_Null_Mutex>
+ OP_MAP_MANAGER;
+
+ /// The hash table data structure.
+ OP_MAP_MANAGER hash_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_OPERATION_TABLE_DYNAMIC_HASH_H */
diff --git a/TAO/tao/PortableServer/Operation_Table_Linear_Search.cpp b/TAO/tao/PortableServer/Operation_Table_Linear_Search.cpp
new file mode 100644
index 00000000000..0ad27a2c2c8
--- /dev/null
+++ b/TAO/tao/PortableServer/Operation_Table_Linear_Search.cpp
@@ -0,0 +1,93 @@
+// $Id$
+
+#include "tao/PortableServer/Operation_Table_Linear_Search.h"
+#include "tao/Timeprobe.h"
+#include "ace/Log_Msg.h"
+
+ACE_RCSID(PortableServer,
+ Operation_Table_Linear_Searc,
+ "$Id$")
+
+#if defined (ACE_ENABLE_TIMEPROBES)
+
+static const char *TAO_Operation_Table_Timeprobe_Description[] =
+ {
+ "TAO_Linear_Search_OpTable::find - start",
+ "TAO_Linear_Search_OpTable::find - end",
+ };
+
+enum
+ {
+ // Timeprobe description table start key
+ TAO_LINEAR_SEARCH_OPTABLE_FIND_START = 602,
+ TAO_LINEAR_SEARCH_OPTABLE_FIND_END,
+ };
+
+// Setup Timeprobes
+ACE_TIMEPROBE_EVENT_DESCRIPTIONS (TAO_Operation_Table_Timeprobe_Description,
+ TAO_LINEAR_SEARCH_OPTABLE_FIND_START);
+
+#endif /* ACE_ENABLE_TIMEPROBES */
+
+/***************************************************************/
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Linear_Search_OpTable::~TAO_Linear_Search_OpTable (void)
+{
+}
+
+int
+TAO_Linear_Search_OpTable::bind (const char *,
+ const TAO::Operation_Skeletons )
+{
+ return 0;
+}
+
+int
+TAO_Linear_Search_OpTable::find (const char *opname,
+ TAO_Skeleton& skelfunc,
+ const unsigned int )
+{
+ ACE_FUNCTION_TIMEPROBE (TAO_LINEAR_SEARCH_OPTABLE_FIND_START);
+
+ TAO_operation_db_entry const * const entry = lookup (opname);
+ if (entry == 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("TAO_Linear_Search_Table:find failed\n")),
+ -1);
+
+ // Valid entry. Figure out the skel_ptr.
+ skelfunc = entry->skel_ptr;
+
+ return 0;
+}
+
+
+int
+TAO_Linear_Search_OpTable::find (const char *opname,
+ TAO_Collocated_Skeleton &skelfunc,
+ TAO::Collocation_Strategy st,
+ const unsigned int )
+{
+ ACE_FUNCTION_TIMEPROBE (TAO_LINEAR_SEARCH_OPTABLE_FIND_START);
+
+ TAO_operation_db_entry const * const entry = lookup (opname);
+ if (entry == 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("TAO_Linear_Search_Table:find failed\n")),
+ -1);
+
+ switch (st)
+ {
+ case TAO::TAO_CS_DIRECT_STRATEGY:
+ skelfunc = entry->direct_skel_ptr;
+ break;
+ default:
+ return -1;
+ }
+
+ return 0;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/Operation_Table_Linear_Search.h b/TAO/tao/PortableServer/Operation_Table_Linear_Search.h
new file mode 100644
index 00000000000..1f26bc71a2f
--- /dev/null
+++ b/TAO/tao/PortableServer/Operation_Table_Linear_Search.h
@@ -0,0 +1,65 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Operation_Table_Linear_Search.h
+ *
+ * $Id$
+ *
+ * @author Aniruddha Gokhale
+ */
+//=============================================================================
+
+#ifndef TAO_OPERATION_TABLE_LINEAR_SEARCH_H
+#define TAO_OPERATION_TABLE_LINEAR_SEARCH_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/Operation_Table.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_Linear_Search_OpTable
+ *
+ * @brief Operation table lookup strategy based on
+ * linear search. Not efficient, but it works.
+ */
+class TAO_PortableServer_Export TAO_Linear_Search_OpTable
+ : public TAO_Operation_Table
+{
+public:
+ // = Initialization and termination methods.
+
+ /// Destructor.
+ ~TAO_Linear_Search_OpTable (void);
+
+ /// See the documentation in the base class for details.
+ virtual int find (const char *opname,
+ TAO_Skeleton &skel_ptr,
+ const unsigned int length = 0);
+
+ virtual int find (const char *opname,
+ TAO_Collocated_Skeleton &skelfunc,
+ TAO::Collocation_Strategy s,
+ const unsigned int length = 0);
+
+ virtual int bind (const char *opname,
+ const TAO::Operation_Skeletons skelptr);
+
+private:
+ // = Method that should defined by the subclasses. GPERF program
+ // will generate this routine routines.
+ virtual const TAO_operation_db_entry* lookup (const char *str) = 0;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_OPERATION_TABLE_LINEAR_SEARCH_H */
diff --git a/TAO/tao/PortableServer/Operation_Table_Perfect_Hash.cpp b/TAO/tao/PortableServer/Operation_Table_Perfect_Hash.cpp
new file mode 100644
index 00000000000..c0b75b8b6fe
--- /dev/null
+++ b/TAO/tao/PortableServer/Operation_Table_Perfect_Hash.cpp
@@ -0,0 +1,103 @@
+// $Id$
+
+#include "tao/PortableServer/Operation_Table_Perfect_Hash.h"
+#include "tao/Timeprobe.h"
+#include "ace/Log_Msg.h"
+
+ACE_RCSID(PortableServer,
+ Operation_Table_Perfect_Hash,
+ "$Id$")
+
+#if defined (ACE_ENABLE_TIMEPROBES)
+
+static const char *TAO_Operation_Table_Timeprobe_Description[] =
+ {
+ "TAO_Perfect_Hash_OpTable::find - start",
+ "TAO_Perfect_Hash_OpTable::find - end",
+ };
+
+enum
+ {
+ // Timeprobe description table start key
+ TAO_PERFECT_HASH_OPTABLE_FIND_START = 606,
+ TAO_PERFECT_HASH_OPTABLE_FIND_END,
+ };
+
+// Setup Timeprobes
+ACE_TIMEPROBE_EVENT_DESCRIPTIONS (TAO_Operation_Table_Timeprobe_Description,
+ TAO_PERFECT_HASH_OPTABLE_FIND_START);
+
+#endif /* ACE_ENABLE_TIMEPROBES */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Do nothing destrctor.
+TAO_Perfect_Hash_OpTable::~TAO_Perfect_Hash_OpTable (void)
+{
+}
+
+int
+TAO_Perfect_Hash_OpTable::find (const char *opname,
+ TAO_Skeleton &skelfunc,
+ const unsigned int length)
+{
+ ACE_FUNCTION_TIMEPROBE (TAO_PERFECT_HASH_OPTABLE_FIND_START);
+
+ TAO_operation_db_entry const * const entry = lookup (opname,
+ length);
+ if (entry == 0)
+ {
+ skelfunc = 0; // insure that somebody can't call a wrong function!
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("TAO_Perfect_Hash_OpTable:find for ")
+ ACE_TEXT ("operation '%s' (length=%d) failed\n"),
+ ACE_TEXT_CHAR_TO_TCHAR (opname ? opname : "<null string>"), length),
+ -1);
+ }
+
+ // Valid entry. Figure out the skel_ptr.
+ skelfunc = entry->skel_ptr;
+
+ return 0;
+}
+
+int
+TAO_Perfect_Hash_OpTable::find (const char *opname,
+ TAO_Collocated_Skeleton &skelfunc,
+ TAO::Collocation_Strategy st,
+ const unsigned int length)
+{
+ ACE_FUNCTION_TIMEPROBE (TAO_PERFECT_HASH_OPTABLE_FIND_START);
+
+ TAO_operation_db_entry const * const entry = lookup (opname,
+ length);
+ if (entry == 0)
+ {
+ skelfunc = 0; // insure that somebody can't call a wrong function!
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("TAO_Perfect_Hash_OpTable:find for ")
+ ACE_TEXT ("operation '%s' (length=%d) failed\n"),
+ ACE_TEXT_CHAR_TO_TCHAR (opname ? opname : "<null string>"), length),
+ -1);
+ }
+
+ switch (st)
+ {
+ case TAO::TAO_CS_DIRECT_STRATEGY:
+ skelfunc = entry->direct_skel_ptr;
+ break;
+ default:
+ return -1;
+ }
+
+ return 0;
+}
+
+int
+TAO_Perfect_Hash_OpTable::bind (const char *,
+ const TAO::Operation_Skeletons)
+{
+ return 0;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/Operation_Table_Perfect_Hash.h b/TAO/tao/PortableServer/Operation_Table_Perfect_Hash.h
new file mode 100644
index 00000000000..00338dcc2c7
--- /dev/null
+++ b/TAO/tao/PortableServer/Operation_Table_Perfect_Hash.h
@@ -0,0 +1,74 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Operation_Table_Perfect_Hash.h
+ *
+ * $Id$
+ *
+ * @author Aniruddha Gokhale
+ */
+//=============================================================================
+
+#ifndef TAO_OPERATION_TABLE_PERFECT_HASH_H
+#define TAO_OPERATION_TABLE_PERFECT_HASH_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/Operation_Table.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_Perfect_Hash_OpTable
+ *
+ * @brief Helper class for use of perfect hashing operation lookup
+ * strategy.
+ *
+ * This class declares pure virtual methods called 'lookup ()'
+ * and 'hash ()' which will be generated by the GPERF
+ * program. These methods are used by 'bind ()' and 'find ()'
+ * methods. Subclasses will define the lookup and hash
+ * functions.
+ */
+class TAO_PortableServer_Export TAO_Perfect_Hash_OpTable
+ : public TAO_Operation_Table
+{
+public:
+
+ /// Do nothing destrctor.
+ virtual ~TAO_Perfect_Hash_OpTable (void);
+
+ /// See the documentation in the base class for details.
+ virtual int find (const char *opname,
+ TAO_Skeleton &skelfunc,
+ const unsigned int length = 0);
+
+ virtual int find (const char *opname,
+ TAO_Collocated_Skeleton &skelfunc,
+ TAO::Collocation_Strategy s,
+ const unsigned int length = 0);
+
+ virtual int bind (const char *opname,
+ const TAO::Operation_Skeletons skel_ptr);
+
+private:
+ // = Methods that should defined by the subclasses. GPERF program
+ // will generate these routines.
+
+ virtual unsigned int hash (const char *str, unsigned int len) = 0;
+
+ virtual const TAO_operation_db_entry* lookup (const char *str,
+ unsigned int len) = 0;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_OPERATION_TABLE_PERFECT_HASH_H */
diff --git a/TAO/tao/PortableServer/POA.pidl b/TAO/tao/PortableServer/POA.pidl
new file mode 100644
index 00000000000..43a0791f165
--- /dev/null
+++ b/TAO/tao/PortableServer/POA.pidl
@@ -0,0 +1,255 @@
+/**
+ * @file POA.pidl
+ *
+ * $Id$
+ *
+ * @brief Pre-compiled IDL source for the PortableServer module.
+ *
+ * This file was used to generate the code in
+ * PortableServerC.{h,inl,cpp}, using the following command:
+ *
+ * tao_idl.exe \
+ * -o orig -Sci -Gp -Gd -Ge 1 -GA -I$(TAO_ROOT)
+ * -Wb,export_macro=TAO_PortableServer_Export \
+ * -Wb,export_include="portableserver_export.h" \
+ * -Wb,pre_include="ace/pre.h" \
+ * -Wb,post_include="ace/post.h" \
+ * PortableServer.pidl
+ *
+ * After the file is generated a patch from the diffs directory must
+ * be applied. The patch:
+ *
+ * - Disables parts of the code under certain configurations.
+ *
+ * - Eliminates cycles in the include dependencies.
+ *
+ * - Adds non-idl components of PortableServer to the namespace.
+ * This includes (a) Servant (b) ServantBase (c) RefCountServantBase
+ * (d) Cookie (e) ObjectId_to_string (f) string_to_ObjectId (g)
+ * ObjectId_to_wstring (h) wstring_to_ObjectId (i) ServantBase_var
+ * (j) DynamicImplementation (k) LocalServantBase
+ *
+ * Apply patches using the following command:
+ *
+ * patch < diffs/PortableServer.diff
+ *
+ * Note: The diffs were generated using:
+ *
+ * rm diffs/PortableServer.diff
+ * for i in PortableServerC.{h,i,cpp}; do
+ * diff -wub orig/$i $i >> diffs/PortableServer.diff
+ * done
+ */
+
+#ifndef _POA_SERVER_IDL_
+#define _POA_SERVER_IDL_
+
+///FUZZ: disable check_for_include/
+#include "tao/Policy_Forward.pidl"
+#include "tao/OctetSeq.pidl"
+#include "tao/orb_types.pidl"
+#include "tao/PortableServer/PS_Forward.pidl"
+#include "tao/PortableServer/IdAssignmentPolicy.pidl"
+#include "tao/PortableServer/IdUniquenessPolicy.pidl"
+#include "tao/PortableServer/ImplicitActivationPolicy.pidl"
+#include "tao/PortableServer/LifespanPolicy.pidl"
+#include "tao/PortableServer/RequestProcessingPolicy.pidl"
+#include "tao/PortableServer/ServantRetentionPolicy.pidl"
+#include "tao/PortableServer/ThreadPolicy.pidl"
+
+#pragma prefix "omg.org"
+
+module PortableServer
+{
+# pragma version PortableServer 2.3
+
+ typedef sequence<POA> POAList;
+
+ // Policy IDs
+# if ! defined (CORBA_E_COMPACT) && ! defined (CORBA_E_MICRO)
+ const CORBA::PolicyType THREAD_POLICY_ID = 16;
+# endif
+# if ! defined (CORBA_E_MICRO)
+ const CORBA::PolicyType LIFESPAN_POLICY_ID = 17;
+ const CORBA::PolicyType ID_UNIQUENESS_POLICY_ID = 18;
+ const CORBA::PolicyType ID_ASSIGNMENT_POLICY_ID = 19;
+# endif
+# if ! defined (CORBA_E_COMPACT) && ! defined (CORBA_E_MICRO)
+ const CORBA::PolicyType IMPLICIT_ACTIVATION_POLICY_ID = 20;
+ const CORBA::PolicyType SERVANT_RETENTION_POLICY_ID = 21;
+ const CORBA::PolicyType REQUEST_PROCESSING_POLICY_ID = 22;
+# endif
+
+ // Forward declaration POAManager interface.
+ local interface POAManager;
+
+#if ! defined (CORBA_E_COMPACT) && ! defined (CORBA_E_MICRO)
+ // Forward declaration POAManagerFactory interface.
+ local interface POAManagerFactory;
+#endif
+
+#if ! defined (CORBA_E_COMPACT) && ! defined (CORBA_E_MICRO) && ! defined (TAO_HAS_MINIMUM_POA)
+ // Forward declaration AdapterActivator interface.
+ local interface AdapterActivator;
+#endif
+
+#if ! defined (CORBA_E_COMPACT) && ! defined (CORBA_E_MICRO)
+ // Forward declaration servantManager interface.
+ local interface ServantManager;
+#endif
+
+ local interface POA
+ {
+# pragma version POA 2.3
+
+# if ! defined (CORBA_E_MICRO)
+ exception AdapterAlreadyExists {};
+ exception AdapterNonExistent {};
+ exception InvalidPolicy {unsigned short index;};
+#if !defined (TAO_HAS_MINIMUM_POA)
+ exception NoServant {};
+#endif
+ exception ObjectAlreadyActive {};
+# endif
+ exception ObjectNotActive {};
+ exception ServantAlreadyActive {};
+ exception ServantNotActive {};
+ exception WrongAdapter {};
+ exception WrongPolicy {};
+
+
+# if ! defined (CORBA_E_MICRO)
+ /// POA creation and destruction.
+ POA create_POA (in string adapter_name,
+ in POAManager a_POAManager,
+ in CORBA::PolicyList policies)
+ raises (AdapterAlreadyExists,
+ InvalidPolicy);
+
+ POA find_POA (in string adapter_name,
+ in boolean activate_it)
+ raises (AdapterNonExistent);
+#endif
+
+ void destroy (in boolean etherealize_objects,
+ in boolean wait_for_completion);
+
+ // Factories for Policy objects.
+
+# if ! defined (CORBA_E_COMPACT) && ! defined (CORBA_E_MICRO) && !defined (TAO_HAS_MINIMUM_POA)
+ ThreadPolicy create_thread_policy (in ThreadPolicyValue value);
+#endif
+# if ! defined (CORBA_E_MICRO)
+ LifespanPolicy create_lifespan_policy (
+ in LifespanPolicyValue value
+ );
+
+ IdUniquenessPolicy create_id_uniqueness_policy (
+ in IdUniquenessPolicyValue value
+ );
+
+ IdAssignmentPolicy create_id_assignment_policy (
+ in IdAssignmentPolicyValue value
+ );
+#endif
+# if ! defined (CORBA_E_COMPACT) && ! defined (CORBA_E_MICRO) && !defined (TAO_HAS_MINIMUM_POA)
+ ImplicitActivationPolicy create_implicit_activation_policy (
+ in ImplicitActivationPolicyValue value
+ );
+
+ ServantRetentionPolicy create_servant_retention_policy (
+ in ServantRetentionPolicyValue value
+ );
+
+ RequestProcessingPolicy create_request_processing_policy (
+ in RequestProcessingPolicyValue value
+ );
+# endif
+
+ // POA attributes
+ readonly attribute string the_name;
+ readonly attribute POA the_parent;
+# if ! defined (CORBA_E_COMPACT) && ! defined (CORBA_E_MICRO)
+ readonly attribute POAList the_children;
+# endif
+ readonly attribute POAManager the_POAManager;
+# if ! defined (CORBA_E_COMPACT) && ! defined (CORBA_E_MICRO)
+ readonly attribute POAManagerFactory the_POAManagerFactory;
+#endif
+# if ! defined (CORBA_E_COMPACT) && ! defined (CORBA_E_MICRO) && !defined (TAO_HAS_MINIMUM_POA)
+ attribute AdapterActivator the_activator;
+# endif
+
+# if ! defined (CORBA_E_COMPACT) && ! defined (CORBA_E_MICRO) && !defined (TAO_HAS_MINIMUM_POA)
+ // Servant Manager registration:
+
+ ServantManager get_servant_manager ()
+ raises (WrongPolicy);
+
+ void set_servant_manager (in ServantManager imgr)
+ raises (WrongPolicy);
+
+ // Operations for the USE_DEFAULT_SERVANT policy.
+
+ Servant get_servant ()
+ raises (NoServant,
+ WrongPolicy);
+
+ void set_servant (in Servant p_servant)
+ raises (WrongPolicy);
+# endif
+
+ // Object activation and deactivation.
+
+ ObjectId activate_object (in Servant p_servant)
+ raises (ServantAlreadyActive,
+ WrongPolicy);
+
+#if !defined (CORBA_E_MICRO)
+ void activate_object_with_id (in ObjectId id,
+ in Servant p_servant)
+ raises (ServantAlreadyActive,
+ ObjectAlreadyActive,
+ WrongPolicy);
+#endif
+
+ void deactivate_object (in ObjectId oid)
+ raises (ObjectNotActive, WrongPolicy);
+
+ // Reference creation operations.
+
+ Object create_reference (in CORBA::RepositoryId intf)
+ raises (WrongPolicy);
+
+ Object create_reference_with_id (in ObjectId oid,
+ in CORBA::RepositoryId intf);
+
+ // Identity mapping operations:.
+ ObjectId servant_to_id (in Servant p_servant)
+ raises (ServantNotActive,
+ WrongPolicy);
+
+ Object servant_to_reference (in Servant p_servant)
+ raises (ServantNotActive, WrongPolicy);
+
+ Servant reference_to_servant (in Object reference)
+ raises (ObjectNotActive,
+ WrongAdapter,
+ WrongPolicy);
+
+ ObjectId reference_to_id (in Object reference)
+ raises (WrongAdapter,
+ WrongPolicy);
+
+ Servant id_to_servant (in ObjectId oid)
+ raises (ObjectNotActive, WrongPolicy);
+
+ Object id_to_reference (in ObjectId oid)
+ raises (ObjectNotActive,
+ WrongPolicy);
+
+ readonly attribute CORBA::OctetSeq id;
+ };
+};
+
+#endif // _PORTABLE_SERVER_IDL_
diff --git a/TAO/tao/PortableServer/POAManager.cpp b/TAO/tao/PortableServer/POAManager.cpp
new file mode 100644
index 00000000000..26519a791ee
--- /dev/null
+++ b/TAO/tao/PortableServer/POAManager.cpp
@@ -0,0 +1,413 @@
+// $Id$
+
+#include "tao/PortableServer/POAManager.h"
+#include "tao/PortableServer/POAManagerFactory.h"
+#include "tao/PortableServer/Root_POA.h"
+#include "tao/PortableServer/poa_macros.h"
+#include "tao/Server_Strategy_Factory.h"
+#include "tao/ORB_Core.h"
+#include "tao/IORInterceptor_Adapter.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/PortableServer/POAManager.i"
+#endif /* ! __ACE_INLINE__ */
+
+ACE_RCSID (PortableServer,
+ POAManager,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_POA_Manager::TAO_POA_Manager (
+ TAO_Object_Adapter &object_adapter,
+ const char * id,
+ const ::CORBA::PolicyList &policies,
+ PortableServer::POAManagerFactory_ptr poa_manager_factory)
+ : state_ (PortableServer::POAManager::HOLDING),
+ lock_ (object_adapter.lock ()),
+ poa_collection_ (),
+ object_adapter_ (object_adapter),
+ id_ (id == 0 ? this->generate_manager_id () : CORBA::string_dup (id)),
+#if !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
+ poa_manager_factory_ (* dynamic_cast <TAO_POAManager_Factory*> (poa_manager_factory)),
+#endif
+ policies_ (policies)
+{
+#if !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
+ poa_manager_factory_._add_ref ();
+#endif
+}
+
+TAO_POA_Manager::~TAO_POA_Manager (void)
+{
+#if !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
+ poa_manager_factory_._remove_ref ();
+#endif
+}
+
+char *
+TAO_POA_Manager::get_id (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return CORBA::string_dup (this->id_.in ());
+}
+
+void
+TAO_POA_Manager::activate_i (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POAManager::AdapterInactive))
+{
+ // This operation changes the state of the POA manager to active. If
+ // issued while the POA manager is in the inactive state, the
+ // AdapterInactive exception is raised. Entering the active state
+ // enables the associated POAs to process requests.
+
+ if (this->state_ == PortableServer::POAManager::INACTIVE)
+ {
+ ACE_THROW (PortableServer::POAManager::AdapterInactive ());
+ }
+ else
+ {
+ this->state_ = PortableServer::POAManager::ACTIVE;
+ // Find the poas that applied the custom servant dispatching
+ // strategy to launch the dispatching threads.
+
+ for (POA_COLLECTION::iterator iterator = this->poa_collection_.begin ();
+ iterator != this->poa_collection_.end ();
+ ++iterator)
+ {
+ (*iterator)->poa_activated_hook ();
+ }
+ }
+
+ this->adapter_manager_state_changed (this->state_
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+void
+TAO_POA_Manager::deactivate_i (CORBA::Boolean etherealize_objects,
+ CORBA::Boolean wait_for_completion
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POAManager::AdapterInactive))
+{
+ // Is the <wait_for_completion> semantics for this thread correct?
+ TAO_Root_POA::check_for_valid_wait_for_completions (this->object_adapter_.orb_core (),
+ wait_for_completion
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // This operation changes the state of the POA manager to
+ // inactive. If issued while the POA manager is in the inactive
+ // state, the AdapterInactive exception is raised. Entering the
+ // inactive state causes the associated POAs to reject requests that
+ // have not begun to be executed as well as any new requests.
+
+ if (this->state_ == PortableServer::POAManager::INACTIVE)
+ {
+ ACE_THROW (PortableServer::POAManager::AdapterInactive ());
+ }
+ else
+ {
+ this->state_ = PortableServer::POAManager::INACTIVE;
+ }
+
+ // After changing the state, if the etherealize_objects parameter is:
+ //
+ // a) TRUE - the POA manager will cause all associated POAs that
+ // have the RETAIN and USE_SERVANT_MANAGER policies to perform the
+ // etherealize operation on the associated servant manager for all
+ // active objects.
+ //
+ // b) FALSE - the etherealize operation is not called. The purpose
+ // is to provide developers with a means to shut down POAs in a
+ // crisis (for example, unrecoverable error) situation.
+
+ // If the wait_for_completion parameter is FALSE, this operation
+ // will return immediately after changing the state. If the
+ // parameter is TRUE and the current thread is not in an invocation
+ // context dispatched by some POA belonging to the same ORB as this
+ // POA, this operation does not return until there are no actively
+ // executing requests in any of the POAs associated with this POA
+ // manager (that is, all requests that were started prior to the
+ // state change have completed) and, in the case of a TRUE
+ // etherealize_objects, all invocations of etherealize have
+ // completed for POAs having the RETAIN and USE_SERVANT_MANAGER
+ // policies. If the parameter is TRUE and the current thread is in
+ // an invocation context dispatched by some POA belonging to the
+ // same ORB as this POA the BAD_INV_ORDER exception is raised and
+ // the state is not changed.
+
+ for (POA_COLLECTION::iterator iterator = this->poa_collection_.begin ();
+ iterator != this->poa_collection_.end ();
+ ++iterator)
+ {
+ TAO_Root_POA *poa = *iterator;
+ // Notify the poas that applied the custom servant dispatching
+ // strategy to stop the dispatching threads.
+ poa->poa_deactivated_hook ();
+
+ poa->deactivate_all_objects_i (etherealize_objects,
+ wait_for_completion
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ // If the ORB::shutdown operation is called, it makes a call on
+ // deactivate with a TRUE etherealize_objects parameter for each POA
+ // manager known in the process; the wait_for_completion parameter
+ // to deactivate will be the same as the similarly named parameter
+ // of ORB::shutdown.
+
+ this->adapter_manager_state_changed (this->state_
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+void
+TAO_POA_Manager::adapter_manager_state_changed (PortableServer::POAManager::State state
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ PortableInterceptor::AdapterState adapter_state =
+ static_cast<PortableInterceptor::AdapterState> (state);
+
+ TAO_IORInterceptor_Adapter *ior_adapter =
+ this->object_adapter_.orb_core ().ior_interceptor_adapter ();
+
+ if (ior_adapter)
+ {
+ ior_adapter->adapter_manager_state_changed (this->id_.in (),
+ adapter_state
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+}
+
+#if (TAO_HAS_MINIMUM_POA == 0)
+
+void
+TAO_POA_Manager::hold_requests_i (CORBA::Boolean wait_for_completion
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POAManager::AdapterInactive))
+{
+ // Is the <wait_for_completion> semantics for this thread correct?
+ TAO_Root_POA::check_for_valid_wait_for_completions (this->object_adapter_.orb_core (),
+ wait_for_completion
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // This operation changes the state of the POA manager to
+ // holding. If issued while the POA manager is in the inactive
+ // state, the AdapterInactive exception is raised. Entering the
+ // holding state causes the associated POAs to queue incoming
+ // requests. Any requests that have been queued but have not
+ // started executing will continue to be queued while in the holding
+ // state.
+
+ if (this->state_ == PortableServer::POAManager::INACTIVE)
+ {
+ ACE_THROW (PortableServer::POAManager::AdapterInactive ());
+ }
+ else
+ {
+ this->state_ = PortableServer::POAManager::HOLDING;
+ }
+
+ // If the wait_for_completion parameter is FALSE, this operation
+ // returns immediately after changing the state. If the parameter is
+ // TRUE and the current thread is not in an invocation context
+ // dispatched by some POA belonging to the same ORB as this POA,
+ // this operation does not return until either there are no actively
+ // executing requests in any of the POAs associated with this POA
+ // manager (that is, all requests that were started prior to the
+ // state change have completed) or the state of the POA manager is
+ // changed to a state other than holding. If the parameter is TRUE
+ // and the current thread is in an invocation context dispatched by
+ // some POA belonging to the same ORB as this POA the BAD_INV_ORDER
+ // exception is raised and the state is not changed.
+
+ if (wait_for_completion)
+ {
+ for (POA_COLLECTION::iterator iterator = this->poa_collection_.begin ();
+ iterator != this->poa_collection_.end ();
+ ++iterator)
+ {
+ TAO_Root_POA *poa = *iterator;
+ poa->wait_for_completions (wait_for_completion
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ }
+
+ this->adapter_manager_state_changed (this->state_
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+void
+TAO_POA_Manager::discard_requests_i (CORBA::Boolean wait_for_completion
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POAManager::AdapterInactive))
+{
+ // Is the <wait_for_completion> semantics for this thread correct?
+ TAO_Root_POA::check_for_valid_wait_for_completions (this->object_adapter_.orb_core (),
+ wait_for_completion
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // This operation changes the state of the POA manager to
+ // discarding. If issued while the POA manager is in the inactive
+ // state, the AdapterInactive exception is raised. Entering the
+ // discarding state causes the associated POAs to discard incoming
+ // requests. In addition, any requests that have been queued but
+ // have not started executing are discarded. When a request is
+ // discarded, a TRANSIENT system exception is returned to the
+ // client.
+
+ if (this->state_ == PortableServer::POAManager::INACTIVE)
+ {
+ ACE_THROW (PortableServer::POAManager::AdapterInactive ());
+ }
+ else
+ {
+ this->state_ = PortableServer::POAManager::DISCARDING;
+ }
+
+ // If the wait_for_completion parameter is FALSE, this operation
+ // returns immediately after changing the state. If the
+ // parameter is TRUE and the current thread is not in an
+ // invocation context dispatched by some POA belonging to the
+ // same ORB as this POA, this operation does not return until
+ // either there are no actively executing requests in any of the
+ // POAs associated with this POA manager (that is, all requests
+ // that were started prior to the state change have completed)
+ // or the state of the POA manager is changed to a state other
+ // than discarding. If the parameter is TRUE and the current
+ // thread is in an invocation context dispatched by some POA
+ // belonging to the same ORB as this POA the BAD_INV_ORDER
+ // exception is raised and the state is not changed.
+
+ if (wait_for_completion)
+ {
+ for (POA_COLLECTION::iterator iterator = this->poa_collection_.begin ();
+ iterator != this->poa_collection_.end ();
+ ++iterator)
+ {
+ TAO_Root_POA *poa = *iterator;
+ poa->wait_for_completions (wait_for_completion
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ }
+
+ this->adapter_manager_state_changed (this->state_
+ ACE_ENV_ARG_PARAMETER);
+}
+
+#endif /* TAO_HAS_MINIMUM_POA == 0 */
+
+int
+TAO_POA_Manager::remove_poa (TAO_Root_POA *poa)
+{
+ int const result = this->poa_collection_.remove (poa);
+
+ if (result == 0)
+ {
+ if (this->poa_collection_.is_empty ())
+ {
+#if !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
+ this->poa_manager_factory_.remove_poamanager (this);
+#endif
+ }
+ }
+
+ return result;
+}
+
+int
+TAO_POA_Manager::register_poa (TAO_Root_POA *poa)
+{
+ return this->poa_collection_.insert (poa);
+}
+
+void
+TAO_POA_Manager::check_state (ACE_ENV_SINGLE_ARG_DECL)
+{
+ if (state_ == PortableServer::POAManager::ACTIVE)
+ {
+ // When a POA manager is in the active state, the associated
+ // POAs will receive and start processing requests (assuming
+ // that appropriate thread resources are available).
+ return;
+ }
+
+ if (state_ == PortableServer::POAManager::DISCARDING)
+ {
+ // When a POA manager is in the discarding state, the associated
+ // POAs will discard all incoming requests (whose processing has
+ // not yet begun). When a request is discarded, the TRANSIENT
+ // system exception, with standard minor code 1, must be
+ // returned to the client-side to indicate that the request
+ // should be re-issued. (Of course, an ORB may always reject a
+ // request for other reasons and raise some other system
+ // exception.)
+ ACE_THROW (
+ CORBA::TRANSIENT (
+ CORBA::SystemException::_tao_minor_code (
+ TAO_POA_DISCARDING,
+ 1),
+ CORBA::COMPLETED_NO));
+ }
+
+ if (state_ == PortableServer::POAManager::HOLDING)
+ {
+ // When a POA manager is in the holding state, the associated
+ // POAs will queue incoming requests. The number of requests
+ // that can be queued is an implementation limit. If this limit
+ // is reached, the POAs may discard requests and return the
+ // TRANSIENT system exception, with standard minor code 1, to
+ // the client to indicate that the client should reissue the
+ // request. (Of course, an ORB may always reject a request for
+ // other reasons and raise some other system exception.)
+
+ // Since there is no queuing in TAO, we immediately raise a
+ // TRANSIENT exception.
+ ACE_THROW (CORBA::TRANSIENT (
+ CORBA::SystemException::_tao_minor_code (
+ TAO_POA_HOLDING,
+ 1),
+ CORBA::COMPLETED_NO));
+ }
+
+ if (state_ == PortableServer::POAManager::INACTIVE)
+ {
+ // The inactive state is entered when the associated POAs are to
+ // be shut down. Unlike the discarding state, the inactive state
+ // is not a temporary state. When a POA manager is in the
+ // inactive state, the associated POAs will reject new
+ // requests. The rejection mechanism used is specific to the
+ // vendor. The GIOP location forwarding mechanism and
+ // CloseConnection message are examples of mechanisms that could
+ // be used to indicate the rejection. If the client is
+ // co-resident in the same process, the ORB could raise the
+ // OBJ_ADAPTER system exception, with standard minor code 1, to
+ // indicate that the object implementation is unavailable.
+ ACE_THROW (CORBA::OBJ_ADAPTER (
+ CORBA::SystemException::_tao_minor_code (
+ TAO_POA_INACTIVE,
+ 1),
+ CORBA::COMPLETED_NO));
+ }
+}
+
+CORBA::ORB_ptr
+TAO_POA_Manager::_get_orb (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+{
+ return CORBA::ORB::_duplicate (this->object_adapter_.orb_core ().orb ());
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/POAManager.h b/TAO/tao/PortableServer/POAManager.h
new file mode 100644
index 00000000000..bf5d217f335
--- /dev/null
+++ b/TAO/tao/PortableServer/POAManager.h
@@ -0,0 +1,191 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file POAManager.h
+ *
+ * $Id$
+ *
+ * POAManager
+ *
+ * @author Irfan Pyarali
+ */
+//=============================================================================
+
+#ifndef TAO_POAMANAGER_H
+#define TAO_POAMANAGER_H
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/poa_macros.h"
+#include "tao/PortableServer/POAManagerC.h"
+
+// Local Object
+#include "tao/LocalObject.h"
+#include "tao/PI_ForwardC.h"
+#include "ace/Unbounded_Set.h"
+
+// This is to remove "inherits via dominance" warnings from MSVC.
+// MSVC is being a little too paranoid.
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Forward decl.
+class TAO_Root_POA;
+class TAO_Object_Adapter;
+class TAO_POAManager_Factory;
+
+namespace PortableServer
+{
+ class POAManagerFactory;
+ typedef POAManagerFactory *POAManagerFactory_ptr;
+}
+
+class TAO_PortableServer_Export TAO_POA_Manager :
+ public PortableServer::POAManager,
+ public TAO_Local_RefCounted_Object
+{
+ friend class TAO_Root_POA;
+ friend class TAO_Object_Adapter;
+
+public:
+
+ void activate (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POAManager::AdapterInactive));
+
+#if (TAO_HAS_MINIMUM_POA == 0)
+
+ void hold_requests (CORBA::Boolean wait_for_completion
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POAManager::AdapterInactive));
+
+ void discard_requests (CORBA::Boolean wait_for_completion
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POAManager::AdapterInactive));
+
+ void deactivate (CORBA::Boolean etherealize_objects,
+ CORBA::Boolean wait_for_completion
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POAManager::AdapterInactive));
+
+#endif /* TAO_HAS_MINIMUM_POA == 0 */
+
+ PortableServer::POAManager::State get_state (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ char *get_id (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ TAO_POA_Manager (TAO_Object_Adapter &object_adapter,
+ const char * id,
+ const ::CORBA::PolicyList & policies,
+ PortableServer::POAManagerFactory_ptr poa_manager_factory);
+
+ ~TAO_POA_Manager (void);
+
+ /// Check the state of this POA manager
+ void check_state (ACE_ENV_SINGLE_ARG_DECL);
+
+ PortableServer::POAManager::State get_state_i ()
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual CORBA::ORB_ptr _get_orb (
+ ACE_ENV_SINGLE_ARG_DECL
+ );
+
+ CORBA::PolicyList& get_policies ();
+
+protected:
+
+ void activate_i (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POAManager::AdapterInactive));
+
+ void deactivate_i (CORBA::Boolean etherealize_objects,
+ CORBA::Boolean wait_for_completion
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POAManager::AdapterInactive));
+
+ /// Method needed for notifying the IORInterceptors that the state
+ /// of POAManager changed.
+ void adapter_manager_state_changed (PortableServer::POAManager::State state
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+#if (TAO_HAS_MINIMUM_POA == 0)
+
+ void hold_requests_i (CORBA::Boolean wait_for_completion
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POAManager::AdapterInactive));
+
+ void discard_requests_i (CORBA::Boolean wait_for_completion
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POAManager::AdapterInactive));
+
+#endif /* TAO_HAS_MINIMUM_POA == 0 */
+
+ ACE_Lock &lock (void);
+
+ int remove_poa (TAO_Root_POA *poa);
+
+ int register_poa (TAO_Root_POA *poa);
+
+protected:
+
+ PortableServer::POAManager::State state_;
+
+ ACE_Lock &lock_;
+
+ typedef ACE_Unbounded_Set<TAO_Root_POA *> POA_COLLECTION;
+
+ POA_COLLECTION poa_collection_;
+
+ TAO_Object_Adapter &object_adapter_;
+
+ CORBA::String_var id_;
+
+#if !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
+ TAO_POAManager_Factory& poa_manager_factory_;
+#endif
+
+ CORBA::PolicyList policies_;
+
+private :
+
+ /**
+ * Generate an id for this POAManager.
+ * @return A value that uniquely identifies the POAManager within a
+ * given process.
+ * @note: The id_ has the ownership of the memory allocated in this method.
+ */
+ char* generate_manager_id (void) const;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#if defined (__ACE_INLINE__)
+# include "tao/PortableServer/POAManager.i"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_POAMANAGER_H */
diff --git a/TAO/tao/PortableServer/POAManager.i b/TAO/tao/PortableServer/POAManager.i
new file mode 100644
index 00000000000..5dad4c14de5
--- /dev/null
+++ b/TAO/tao/PortableServer/POAManager.i
@@ -0,0 +1,137 @@
+// -*- C++ -*-
+//
+// $Id$
+
+#include "tao/Environment.h"
+#include "tao/SystemException.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE ACE_Lock &
+TAO_POA_Manager::lock (void)
+{
+ return this->lock_;
+}
+
+ACE_INLINE void
+TAO_POA_Manager::activate (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POAManager::AdapterInactive))
+{
+ // Lock access to the POAManager for the duration of this transaction
+ TAO_OBJECT_ADAPTER_GUARD;
+
+ this->activate_i (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+#if (TAO_HAS_MINIMUM_POA == 0)
+
+ACE_INLINE void
+TAO_POA_Manager::hold_requests (CORBA::Boolean wait_for_completion
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POAManager::AdapterInactive))
+{
+ // Lock access to the POAManager for the duration of this transaction
+ TAO_OBJECT_ADAPTER_GUARD;
+
+ this->hold_requests_i (wait_for_completion ACE_ENV_ARG_PARAMETER);
+}
+
+ACE_INLINE void
+TAO_POA_Manager::discard_requests (CORBA::Boolean wait_for_completion
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POAManager::AdapterInactive))
+{
+ // Lock access to the POAManager for the duration of this transaction
+ TAO_OBJECT_ADAPTER_GUARD;
+
+ this->discard_requests_i (wait_for_completion ACE_ENV_ARG_PARAMETER);
+}
+
+ACE_INLINE void
+TAO_POA_Manager::deactivate (CORBA::Boolean etherealize_objects,
+ CORBA::Boolean wait_for_completion
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POAManager::AdapterInactive))
+{
+ // Lock access to the POAManager for the duration of this transaction
+ TAO_OBJECT_ADAPTER_GUARD;
+
+ this->deactivate_i (etherealize_objects,
+ wait_for_completion
+ ACE_ENV_ARG_PARAMETER);
+}
+
+#endif /* TAO_HAS_MINIMUM_POA == 0 */
+
+ACE_INLINE PortableServer::POAManager::State
+TAO_POA_Manager::get_state_i (void)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return this->state_;
+}
+
+ACE_INLINE PortableServer::POAManager::State
+TAO_POA_Manager::get_state (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ // Lock access to the POAManager for the duration of this transaction
+ TAO_OBJECT_ADAPTER_GUARD_RETURN (this->state_);
+
+ return this->get_state_i ();
+}
+
+ACE_INLINE char*
+TAO_POA_Manager::generate_manager_id (void) const
+{
+ // The AdapterManagerId must be unique across all Adapter Managers
+ // (e.g. POAManagers) within a given process. To avoid locking
+ // overhead, the address of the POAManager object is used as the
+ // AdapterManagerId. This guarantees that the AdapterManagerId is
+ // unique.
+ //
+ // For 64-bit platforms, only the lower 32 bits are used. Hopefully
+ // that will be enough to ensure uniqueness.
+
+ // This is basically the same trick used in
+ // TAO_GIOP_Invocation::generate_request_id(). However, no right
+ // shifting of 64 bit addresses is performed since the
+ // TAO_POA_Manager object is not large enough to allow that trick.
+
+ CORBA::Long id = 0;
+
+ // Note that we reinterpret_cast to an "unsigned long" instead of
+ // CORBA::ULong since we need to first cast to an integer large
+ // enough to hold an address to avoid compile-time warnings on some
+ // 64-bit platforms.
+
+ if (sizeof (this) == 4) // 32 bit address
+ id = reinterpret_cast <ptrdiff_t> (this);
+
+ else if (sizeof (this) == 8) // 64 bit address -- use lower 32 bits
+ id = reinterpret_cast <ptrdiff_t> (this) & 0xFFFFFFFFu;
+
+ // @@ If we ever hit a platform where neither of the above cases are
+ // satisfied, we're up the creek!
+
+// else
+// // Fallback on an atomically incremented variable specific to the
+// // ORB, or perhaps specific to the process.
+// id = ...GENERATE_ID_ATOMICALLY...; // Fallback
+
+ char* buf = new char [25];
+ ACE_OS::sprintf (buf, "POAManager%d", id);
+ return buf;
+}
+
+ACE_INLINE
+CORBA::PolicyList& TAO_POA_Manager::get_policies ()
+{
+ return this->policies_;
+}
+
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/POAManager.pidl b/TAO/tao/PortableServer/POAManager.pidl
new file mode 100644
index 00000000000..05f2e737550
--- /dev/null
+++ b/TAO/tao/PortableServer/POAManager.pidl
@@ -0,0 +1,52 @@
+/**
+ * @file POAManager.pidl
+ *
+ * $Id$
+ *
+ * @brief PIDL source for the PortableServer module.
+ */
+
+#ifndef _PORTABLESERVER_POA_MANAGER_IDL_
+#define _PORTABLESERVER_POA_MANAGER_IDL_
+
+#pragma prefix "omg.org"
+
+module PortableServer
+{
+# pragma version PortableServer 2.3
+
+ // POAManager interface
+ local interface POAManager
+ {
+ exception AdapterInactive {};
+
+ enum State
+ {
+ HOLDING,
+ ACTIVE,
+ DISCARDING,
+ INACTIVE
+ };
+
+ void activate ()
+ raises(AdapterInactive);
+
+#if !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO) && !defined (TAO_HAS_MINIMUM_POA)
+ void hold_requests (in boolean wait_for_completion)
+ raises(AdapterInactive);
+
+ void discard_requests (in boolean wait_for_completion)
+ raises(AdapterInactive);
+
+ void deactivate (in boolean etherealize_objects,
+ in boolean wait_for_completion)
+ raises(AdapterInactive);
+#endif
+
+ State get_state ();
+
+ string get_id();
+ };
+};
+
+#endif // _PORTABLESERVER_POA_MANAGER_IDL_
diff --git a/TAO/tao/PortableServer/POAManagerFactory.cpp b/TAO/tao/PortableServer/POAManagerFactory.cpp
new file mode 100644
index 00000000000..49c02bf3808
--- /dev/null
+++ b/TAO/tao/PortableServer/POAManagerFactory.cpp
@@ -0,0 +1,165 @@
+// $Id$
+
+#include "tao/PortableServer/POAManagerFactory.h"
+#include "tao/PortableServer/POAManager.h"
+#include "tao/EndpointPolicy/EndpointPolicyTypeC.h"
+
+#include "ace/OS_NS_string.h"
+
+ACE_RCSID (PortableServer,
+ POAManagerFactory,
+ "$Id$")
+
+#if !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_POAManager_Factory::TAO_POAManager_Factory (TAO_Object_Adapter &object_adapter) :
+ object_adapter_ (object_adapter)
+{
+}
+
+TAO_POAManager_Factory::~TAO_POAManager_Factory (void)
+{
+ for (POAMANAGERSET::iterator iterator = this->poamanager_set_.begin ();
+ iterator != this->poamanager_set_.end ();
+ ++iterator)
+ {
+ ::PortableServer::POAManager_ptr poamanager = (*iterator);
+ CORBA::release (poamanager);
+ }
+}
+
+::PortableServer::POAManager_ptr
+TAO_POAManager_Factory::create_POAManager (
+ const char * id,
+ const ::CORBA::PolicyList & policies
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ ::PortableServer::POAManagerFactory::ManagerAlreadyExists,
+ ::CORBA::PolicyError))
+{
+ if (policies.length () > 1
+ || (policies.length () == 1 &&
+ policies[0]->policy_type () != EndpointPolicy::ENDPOINT_POLICY_TYPE))
+ {
+ ACE_THROW_RETURN (CORBA::PolicyError (CORBA::BAD_POLICY),
+ ::PortableServer::POAManager::_nil ());
+ }
+
+ PortableServer::POAManager_var poamanager =
+ PortableServer::POAManager::_nil ();
+ if (id != 0)
+ {
+ poamanager = this->find (id ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (::PortableServer::POAManager::_nil ());
+
+ // If we already have a manager with the same name throw an exception
+ if (!CORBA::is_nil (poamanager.in()))
+ {
+ ACE_THROW_RETURN (
+ ::PortableServer::POAManagerFactory::ManagerAlreadyExists (),
+ ::PortableServer::POAManager::_nil ());
+ }
+ }
+
+ // this indirection brought to you by borland's compiler and its refusal
+ // to directly assign the newly created TAO_POA_Manager to a POAManager_var.
+ {
+ PortableServer::POAManager_ptr pm = 0;
+ ACE_NEW_THROW_EX (pm,
+ TAO_POA_Manager (object_adapter_, id, policies, this),
+ CORBA::NO_MEMORY
+ (CORBA::SystemException::_tao_minor_code (0, ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (::PortableServer::POAManager::_nil ());
+ poamanager = pm;
+ }
+
+ this->register_poamanager (poamanager.in ());
+
+ return PortableServer::POAManager::_duplicate (poamanager.in ());
+}
+
+::PortableServer::POAManagerFactory::POAManagerSeq *
+TAO_POAManager_Factory::list (
+ ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ ::PortableServer::POAManagerFactory::POAManagerSeq_var poamanagers;
+ CORBA::ULong number_of_poamanagers = static_cast <CORBA::ULong>
+ (this->poamanager_set_.size ());
+ ACE_NEW_THROW_EX (poamanagers,
+ PortableServer::POAManagerFactory::POAManagerSeq (
+ number_of_poamanagers),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (0);
+
+ poamanagers->length (number_of_poamanagers);
+
+ CORBA::ULong index = 0;
+ for (POAMANAGERSET::iterator iterator = this->poamanager_set_.begin ();
+ iterator != this->poamanager_set_.end ();
+ ++iterator, ++index)
+ {
+ ::PortableServer::POAManager_ptr poamanager = (*iterator);
+ poamanagers[index] =
+ PortableServer::POAManager::_duplicate (poamanager);
+ }
+
+ return poamanagers._retn ();
+}
+
+::PortableServer::POAManager_ptr
+TAO_POAManager_Factory::find (
+ const char * id ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ ::PortableServer::POAManager_ptr poamanager =
+ ::PortableServer::POAManager::_nil();
+
+ for (POAMANAGERSET::iterator iterator = this->poamanager_set_.begin ();
+ iterator != this->poamanager_set_.end ();
+ ++iterator)
+ {
+ CORBA::String_var poamanagerid =
+ (*iterator)->get_id (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (::PortableServer::POAManager::_nil());
+
+ if (ACE_OS::strcmp (id, poamanagerid.in()) == 0)
+ {
+ poamanager = PortableServer::POAManager::_duplicate (*iterator);
+ break;
+ }
+ }
+
+ return poamanager;
+}
+
+int
+TAO_POAManager_Factory::remove_poamanager (
+ ::PortableServer::POAManager_ptr poamanager)
+{
+ int retval = 0;
+ retval = this->poamanager_set_.remove (poamanager);
+
+ if (retval == 0)
+ {
+ CORBA::release (poamanager);
+ }
+
+ return retval;
+}
+
+int
+TAO_POAManager_Factory::register_poamanager (
+ ::PortableServer::POAManager_ptr poamanager)
+{
+ return this->poamanager_set_.insert (
+ PortableServer::POAManager::_duplicate (poamanager));
+}
+
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif
diff --git a/TAO/tao/PortableServer/POAManagerFactory.h b/TAO/tao/PortableServer/POAManagerFactory.h
new file mode 100644
index 00000000000..ab2b6da2b19
--- /dev/null
+++ b/TAO/tao/PortableServer/POAManagerFactory.h
@@ -0,0 +1,87 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file POAManagerFactory.h
+ *
+ * $Id$
+ *
+ * POAManagerFactory
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_POAMANAGERFACTORY_H
+#define TAO_POAMANAGERFACTORY_H
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/POAManagerFactoryC.h"
+#include "tao/PortableServer/Object_Adapter.h"
+#include "tao/LocalObject.h"
+#include "ace/Unbounded_Set.h"
+
+// This is to remove "inherits via dominance" warnings from MSVC.
+// MSVC is being a little too paranoid.
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+#if !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_PortableServer_Export TAO_POAManager_Factory :
+ public ::PortableServer::POAManagerFactory,
+ public TAO_Local_RefCounted_Object
+{
+public:
+ TAO_POAManager_Factory (TAO_Object_Adapter &object_adapter);
+
+ virtual ~TAO_POAManager_Factory (void);
+
+ virtual ::PortableServer::POAManager_ptr create_POAManager (
+ const char * id,
+ const ::CORBA::PolicyList & policies
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ ::PortableServer::POAManagerFactory::ManagerAlreadyExists,
+ ::CORBA::PolicyError));
+
+ virtual ::PortableServer::POAManagerFactory::POAManagerSeq * list (
+ ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual ::PortableServer::POAManager_ptr find (
+ const char * id ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ int remove_poamanager (::PortableServer::POAManager_ptr poamanager);
+
+ int register_poamanager (::PortableServer::POAManager_ptr poamanager);
+
+private:
+ TAO_Object_Adapter &object_adapter_;
+
+ typedef ACE_Unbounded_Set < ::PortableServer::POAManager_ptr> POAMANAGERSET;
+
+ POAMANAGERSET poamanager_set_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_POAMANAGERFACTORY_H */
diff --git a/TAO/tao/PortableServer/POAManagerFactory.pidl b/TAO/tao/PortableServer/POAManagerFactory.pidl
new file mode 100644
index 00000000000..56d5315bcba
--- /dev/null
+++ b/TAO/tao/PortableServer/POAManagerFactory.pidl
@@ -0,0 +1,51 @@
+/**
+ * @file POAManagerFactory.pidl
+ *
+ * $Id$
+ *
+ * @brief Pre-compiled IDL source for the PortableServer module.
+ *
+ $ACE_ROOT/bin/tao_idl \
+ -Gp -Gd -Ge 1 -Sci -I$TAO_ROOT \
+ -Wb,export_macro=TAO_PortableServer_Export \
+ -Wb,export_include="tao/PortableServer/portableserver_export.h" \
+ -Wb,pre_include="ace/pre.h" \
+ -Wb,post_include="ace/post.h" \
+ POAManagerFactory.pidl
+ */
+
+#ifndef _PORTABLESERVER_POAMANAGER_FACTORY_IDL
+#define _PORTABLESERVER_POAMANAGER_FACTORY_IDL
+
+#include "tao/Policy.pidl"
+
+#pragma prefix "omg.org"
+
+#if !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
+
+module PortableServer
+{
+# pragma version PortableServer 2.3
+
+ local interface POAManager;
+
+ local interface POAManagerFactory
+ {
+ typedef sequence<POAManager> POAManagerSeq;
+
+ exception ManagerAlreadyExists {};
+
+ POAManager create_POAManager(
+ in string id,
+ in CORBA::PolicyList policies
+ ) raises(ManagerAlreadyExists, CORBA::PolicyError);
+
+ POAManagerSeq list();
+
+ POAManager find(in string id);
+ };
+};
+
+#endif
+
+#endif // _PORTABLESERVER_POAMANAGER_FACTORY_IDL
diff --git a/TAO/tao/PortableServer/POA_Cached_Policies.cpp b/TAO/tao/PortableServer/POA_Cached_Policies.cpp
new file mode 100644
index 00000000000..beff73439c1
--- /dev/null
+++ b/TAO/tao/PortableServer/POA_Cached_Policies.cpp
@@ -0,0 +1,174 @@
+// $Id$
+
+#include "tao/PortableServer/POA_Cached_Policies.h"
+#include "tao/PortableServer/POA_Policy_Set.h"
+#include "tao/PortableServer/IdAssignmentPolicyC.h"
+#include "tao/PortableServer/IdUniquenessPolicyC.h"
+#include "tao/PortableServer/ImplicitActivationPolicyC.h"
+#include "tao/PortableServer/LifespanPolicyC.h"
+#include "tao/PortableServer/RequestProcessingPolicyC.h"
+#include "tao/PortableServer/ServantRetentionPolicyC.h"
+#include "tao/PortableServer/ThreadPolicyC.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/PortableServer/POA_Cached_Policies.i"
+#endif /* ! __ACE_INLINE__ */
+
+ACE_RCSID(PortableServer,
+ POA_Cached_Policies,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ Cached_Policies::Cached_Policies () :
+ thread_ (::PortableServer::ORB_CTRL_MODEL),
+ lifespan_ (::PortableServer::TRANSIENT),
+ id_uniqueness_ (::PortableServer::UNIQUE_ID),
+ id_assignment_ (::PortableServer::SYSTEM_ID),
+ implicit_activation_ (::PortableServer::NO_IMPLICIT_ACTIVATION),
+ servant_retention_ (::PortableServer::RETAIN),
+ request_processing_ (::PortableServer::USE_ACTIVE_OBJECT_MAP_ONLY),
+ priority_model_ (Cached_Policies::NOT_SPECIFIED),
+ server_priority_ (TAO_INVALID_PRIORITY)
+ {
+ }
+
+
+ Cached_Policies::~Cached_Policies (void)
+ {
+ }
+
+ void
+ Cached_Policies::update (TAO_POA_Policy_Set &policy_set
+ ACE_ENV_ARG_DECL)
+ {
+ for (CORBA::ULong i = 0; i < policy_set.num_policies (); i++)
+ {
+ CORBA::Policy_var policy = policy_set.get_policy_by_index (i);
+
+ this->update_policy (policy.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ }
+
+ void
+ Cached_Policies::update_policy (const CORBA::Policy_ptr policy
+ ACE_ENV_ARG_DECL)
+ {
+
+ #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
+ ::PortableServer::ThreadPolicy_var thread
+ = ::PortableServer::ThreadPolicy::_narrow (policy
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (!CORBA::is_nil (thread.in ()))
+ {
+ this->thread_ = thread->value (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ return;
+ }
+ #endif /* TAO_HAS_MINIMUM_POA == 0 */
+
+ #if !defined (CORBA_E_MICRO)
+ ::PortableServer::LifespanPolicy_var lifespan
+ = ::PortableServer::LifespanPolicy::_narrow (policy
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (!CORBA::is_nil (lifespan.in ()))
+ {
+ this->lifespan_ = lifespan->value (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ return;
+ }
+ #endif
+
+ #if !defined (CORBA_E_MICRO)
+ ::PortableServer::IdUniquenessPolicy_var id_uniqueness
+ = ::PortableServer::IdUniquenessPolicy::_narrow (policy
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (!CORBA::is_nil (id_uniqueness.in ()))
+ {
+ this->id_uniqueness_ = id_uniqueness->value (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ return;
+ }
+ #endif
+
+ #if !defined (CORBA_E_MICRO)
+ ::PortableServer::IdAssignmentPolicy_var id_assignment
+ = ::PortableServer::IdAssignmentPolicy::_narrow (policy
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (!CORBA::is_nil (id_assignment.in ()))
+ {
+ this->id_assignment_ = id_assignment->value (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ return;
+ }
+ #endif
+
+ #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
+
+ ::PortableServer::ImplicitActivationPolicy_var implicit_activation
+ = ::PortableServer::ImplicitActivationPolicy::_narrow (policy
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (!CORBA::is_nil (implicit_activation.in ()))
+ {
+ this->implicit_activation_ = implicit_activation->value (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ return;
+ }
+
+ ::PortableServer::ServantRetentionPolicy_var servant_retention
+ = ::PortableServer::ServantRetentionPolicy::_narrow (policy
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (!CORBA::is_nil (servant_retention.in ()))
+ {
+ this->servant_retention_ = servant_retention->value (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ return;
+ }
+
+ ::PortableServer::RequestProcessingPolicy_var request_processing
+ = ::PortableServer::RequestProcessingPolicy::_narrow (policy
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (!CORBA::is_nil (request_processing.in ()))
+ {
+ this->request_processing_ = request_processing->value (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ return;
+ }
+
+ #endif /* TAO_HAS_MINIMUM_POA == 0 */
+
+ #if defined (CORBA_E_MICRO)
+ ACE_UNUSED_ARG (policy);
+ #endif
+ }
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/POA_Cached_Policies.h b/TAO/tao/PortableServer/POA_Cached_Policies.h
new file mode 100644
index 00000000000..a756f101782
--- /dev/null
+++ b/TAO/tao/PortableServer/POA_Cached_Policies.h
@@ -0,0 +1,114 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file POA_Cached_Policies.h
+ *
+ * $Id$
+ *
+ * POA
+ *
+ * @author Irfan Pyarali
+ */
+//=============================================================================
+
+#ifndef TAO_POA_CACHED_POLICIES_H
+#define TAO_POA_CACHED_POLICIES_H
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/ThreadPolicyC.h"
+#include "tao/PortableServer/LifespanPolicyC.h"
+#include "tao/PortableServer/IdUniquenessPolicyC.h"
+#include "tao/PortableServer/IdAssignmentPolicyC.h"
+#include "tao/PortableServer/ImplicitActivationPolicyC.h"
+#include "tao/PortableServer/ServantRetentionPolicyC.h"
+#include "tao/PortableServer/RequestProcessingPolicyC.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Forward references.
+class TAO_POA_Policy_Set;
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ class TAO_PortableServer_Export Cached_Policies
+ {
+ public:
+
+ enum PriorityModel
+ {
+ CLIENT_PROPAGATED,
+ SERVER_DECLARED,
+ NOT_SPECIFIED
+ };
+
+ Cached_Policies ();
+
+ ~Cached_Policies (void);
+
+ /// Update the cached policy values.
+ void update (TAO_POA_Policy_Set &policy_set
+ ACE_ENV_ARG_DECL);
+
+ /**
+ * @name Accessor methods to cached values.
+ */
+ //@{
+ ::PortableServer::ThreadPolicyValue thread (void) const;
+ ::PortableServer::LifespanPolicyValue lifespan (void) const;
+ ::PortableServer::IdUniquenessPolicyValue id_uniqueness (void) const;
+ ::PortableServer::IdAssignmentPolicyValue id_assignment (void) const;
+ ::PortableServer::ImplicitActivationPolicyValue implicit_activation (void) const;
+ ::PortableServer::ServantRetentionPolicyValue servant_retention (void) const;
+ ::PortableServer::RequestProcessingPolicyValue request_processing (void) const;
+ PriorityModel priority_model (void) const;
+ CORBA::Short server_priority (void) const;
+
+ void priority_model (PriorityModel priority_model);
+ void server_priority (CORBA::Short priority);
+ void implicit_activation (::PortableServer::ImplicitActivationPolicyValue value);
+ //@}
+
+ protected:
+
+ /// Helper method to update a particular policy.
+ void update_policy (const CORBA::Policy_ptr policy
+ ACE_ENV_ARG_DECL);
+
+ ::PortableServer::ThreadPolicyValue thread_;
+
+ ::PortableServer::LifespanPolicyValue lifespan_;
+
+ ::PortableServer::IdUniquenessPolicyValue id_uniqueness_;
+
+ ::PortableServer::IdAssignmentPolicyValue id_assignment_;
+
+ ::PortableServer::ImplicitActivationPolicyValue implicit_activation_;
+
+ ::PortableServer::ServantRetentionPolicyValue servant_retention_;
+
+ ::PortableServer::RequestProcessingPolicyValue request_processing_;
+
+ PriorityModel priority_model_;
+
+ CORBA::Short server_priority_;
+ };
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/PortableServer/POA_Cached_Policies.i"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_POA_CACHED_POLICIES_H */
diff --git a/TAO/tao/PortableServer/POA_Cached_Policies.i b/TAO/tao/PortableServer/POA_Cached_Policies.i
new file mode 100644
index 00000000000..b3699fe3e7d
--- /dev/null
+++ b/TAO/tao/PortableServer/POA_Cached_Policies.i
@@ -0,0 +1,85 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ ACE_INLINE ::PortableServer::ThreadPolicyValue
+ Cached_Policies::thread (void) const
+ {
+ return this->thread_;
+ }
+
+ ACE_INLINE ::PortableServer::LifespanPolicyValue
+ Cached_Policies::lifespan (void) const
+ {
+ return this->lifespan_;
+ }
+
+ ACE_INLINE ::PortableServer::IdUniquenessPolicyValue
+ Cached_Policies::id_uniqueness (void) const
+ {
+ return this->id_uniqueness_;
+ }
+
+ ACE_INLINE ::PortableServer::IdAssignmentPolicyValue
+ Cached_Policies::id_assignment (void) const
+ {
+ return this->id_assignment_;
+ }
+
+ ACE_INLINE ::PortableServer::ImplicitActivationPolicyValue
+ Cached_Policies::implicit_activation (void) const
+ {
+ return this->implicit_activation_;
+ }
+
+ ACE_INLINE ::PortableServer::ServantRetentionPolicyValue
+ Cached_Policies::servant_retention (void) const
+ {
+ return this->servant_retention_;
+ }
+
+ ACE_INLINE ::PortableServer::RequestProcessingPolicyValue
+ Cached_Policies::request_processing (void) const
+ {
+ return this->request_processing_;
+ }
+
+ ACE_INLINE Cached_Policies::PriorityModel
+ Cached_Policies::priority_model (void) const
+ {
+ return this->priority_model_;
+ }
+
+ ACE_INLINE CORBA::Short
+ Cached_Policies::server_priority (void) const
+ {
+ return this->server_priority_;
+ }
+
+ ACE_INLINE void
+ Cached_Policies::priority_model (PriorityModel priority_model)
+ {
+ this->priority_model_ = priority_model;
+ }
+
+ ACE_INLINE void
+ Cached_Policies::server_priority (CORBA::Short priority)
+ {
+ this->server_priority_ = priority;
+ }
+
+ ACE_INLINE void
+ Cached_Policies::implicit_activation (PortableServer::ImplicitActivationPolicyValue value)
+ {
+ this->implicit_activation_ = value;
+ }
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/POA_Current.cpp b/TAO/tao/PortableServer/POA_Current.cpp
new file mode 100644
index 00000000000..a1e30c3faed
--- /dev/null
+++ b/TAO/tao/PortableServer/POA_Current.cpp
@@ -0,0 +1,94 @@
+// $Id$
+
+// -- PortableServer Include --
+#include "tao/PortableServer/POA_Current.h"
+#include "tao/PortableServer/POA_Current_Impl.h"
+
+// -- TAO Include --
+#include "tao/TSS_Resources.h"
+
+ACE_RCSID (PortableServer,
+ POA_Current,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ PortableServer::POA_ptr
+ POA_Current::get_POA (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::Current::NoContext))
+ {
+ POA_Current_Impl *impl = this->implementation ();
+
+ if (impl == 0)
+ ACE_THROW_RETURN (PortableServer::Current::NoContext (),
+ 0);
+ return impl->get_POA ();
+ }
+
+ PortableServer::ObjectId *
+ POA_Current::get_object_id (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::Current::NoContext))
+ {
+ POA_Current_Impl *impl = this->implementation ();
+
+ if (impl == 0)
+ ACE_THROW_RETURN (PortableServer::Current::NoContext (),
+ 0);
+ return impl->get_object_id ();
+ }
+
+ PortableServer::Servant
+ POA_Current::get_servant (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::Current::NoContext))
+ {
+ POA_Current_Impl *impl = this->implementation ();
+
+ if (impl == 0)
+ ACE_THROW_RETURN (PortableServer::Current::NoContext (),
+ 0);
+ return impl->get_servant ();
+ }
+
+ CORBA::Object_ptr
+ POA_Current::get_reference (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::Current::NoContext))
+ {
+ POA_Current_Impl *impl = this->implementation ();
+
+ if (impl == 0)
+ ACE_THROW_RETURN (PortableServer::Current::NoContext (),
+ 0);
+ return impl->get_reference ();
+ }
+
+ POA_Current_Impl *
+ POA_Current::implementation (void)
+ {
+ return static_cast <POA_Current_Impl *>
+ (TAO_TSS_Resources::instance ()->poa_current_impl_);
+ }
+
+ POA_Current_Impl *
+ POA_Current::implementation (POA_Current_Impl *new_current)
+ {
+ TAO_TSS_Resources *tss =
+ TAO_TSS_Resources::instance ();
+
+ POA_Current_Impl *old =
+ static_cast <POA_Current_Impl *>
+ (tss->poa_current_impl_);
+ tss->poa_current_impl_ = new_current;
+ return old;
+ }
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/POA_Current.h b/TAO/tao/PortableServer/POA_Current.h
new file mode 100644
index 00000000000..4af15a2b241
--- /dev/null
+++ b/TAO/tao/PortableServer/POA_Current.h
@@ -0,0 +1,104 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file POA_Current.h
+ *
+ * $Id$
+ *
+ * @author Irfan Pyarali
+ */
+//=============================================================================
+
+#ifndef TAO_POA_CURRENT_H
+#define TAO_POA_CURRENT_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/PS_CurrentC.h"
+#include "tao/LocalObject.h"
+
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ class POA_Current_Impl;
+
+ class TAO_PortableServer_Export POA_Current
+ : public PortableServer::Current
+ , public TAO_Local_RefCounted_Object
+ {
+ public:
+
+ /**
+ * Returns the POA on which the current request is being invoked.
+ * Can raise the @c NoContext exception if this function is
+ * not invoked in the context of an upcall.
+ */
+ PortableServer::POA_ptr get_POA (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::Current::NoContext));
+
+ /**
+ * Returns the object id of the current request being invoked. Can
+ * raise the @c NoContext exception if this function is not
+ * invoked in the context of an upcall.
+ */
+ PortableServer::ObjectId *get_object_id (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::Current::NoContext));
+
+ /**
+ * This operation returns a locally manufactured reference to the object
+ * in the context of which it is called. If called outside the context
+ * of a POA dispatched operation, a NoContext exception is raised.
+ * @note This reference is not guaranteed to be identical to the original
+ * reference the client used to make the invocation, and calling the
+ * Object::is_equivalent operation to compare the two references may not
+ * necessarily return true.
+ */
+ CORBA::Object_ptr get_reference (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::Current::NoContext));
+
+ /**
+ * Returns a reference to the servant that hosts the object in whose
+ * context it is called. If called outside the context of the POA
+ * dispatched operation, a NoContext exception is raised
+ */
+ PortableServer::Servant get_servant (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::Current::NoContext));
+
+ /// Returns the class that implements this interface.
+ POA_Current_Impl *implementation (void);
+
+ /// Sets the thread-specific pointer to the new POA Current state,
+ /// returning a pointer to the existing POA Current state.
+ POA_Current_Impl *implementation (POA_Current_Impl *new_current);
+ };
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_POA_CURRENT_H */
diff --git a/TAO/tao/PortableServer/POA_Current_Factory.cpp b/TAO/tao/PortableServer/POA_Current_Factory.cpp
new file mode 100644
index 00000000000..081147aad3c
--- /dev/null
+++ b/TAO/tao/PortableServer/POA_Current_Factory.cpp
@@ -0,0 +1,32 @@
+// $Id$
+
+#include "tao/PortableServer/POA_Current_Factory.h"
+#include "tao/PortableServer/POA_Current.h"
+#include "tao/ORB_Core.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+CORBA::Object_ptr
+TAO_POA_Current_Factory::create_object (CORBA::ORB_ptr,
+ int,
+ ACE_TCHAR * []
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ TAO::Portable_Server::POA_Current* adapter = 0;
+ ACE_NEW_RETURN (adapter,
+ TAO::Portable_Server::POA_Current (),
+ 0);
+ return adapter;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_FACTORY_DEFINE (TAO_PortableServer, TAO_POA_Current_Factory)
+ACE_STATIC_SVC_DEFINE (TAO_POA_Current_Factory,
+ ACE_TEXT ("TAO_POA_Current_Factory"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (TAO_POA_Current_Factory),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0)
+
diff --git a/TAO/tao/PortableServer/POA_Current_Factory.h b/TAO/tao/PortableServer/POA_Current_Factory.h
new file mode 100644
index 00000000000..6ef224d32fd
--- /dev/null
+++ b/TAO/tao/PortableServer/POA_Current_Factory.h
@@ -0,0 +1,49 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file POA_Current_Factory.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_POA_CURRENT_FACTORY_H
+#define TAO_POA_CURRENT_FACTORY_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Object_Loader.h"
+#include "ace/Service_Config.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_PortableServer_Export TAO_POA_Current_Factory
+ : public TAO_Object_Loader
+{
+public:
+
+ /// Creates a PICurrent and returns it.
+ virtual CORBA::Object_ptr create_object (CORBA::ORB_ptr orb,
+ int argc,
+ ACE_TCHAR *argv []
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE (TAO_POA_Current_Factory)
+ACE_FACTORY_DECLARE (TAO_PortableServer, TAO_POA_Current_Factory)
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_OBJECT_ADAPTER_FACTORY_H */
diff --git a/TAO/tao/PortableServer/POA_Current_Impl.cpp b/TAO/tao/PortableServer/POA_Current_Impl.cpp
new file mode 100644
index 00000000000..eab3e4d0e4f
--- /dev/null
+++ b/TAO/tao/PortableServer/POA_Current_Impl.cpp
@@ -0,0 +1,110 @@
+// $Id$
+
+// -- PortableServer Include --
+#include "tao/PortableServer/Object_Adapter.h"
+#include "tao/PortableServer/POA_Current_Impl.h"
+#include "tao/PortableServer/Root_POA.h"
+
+#include "tao/TSS_Resources.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/PortableServer/POA_Current_Impl.inl"
+#endif /* __ACE_INLINE__ */
+
+ACE_RCSID (PortableServer,
+ POA_Current_IMpl,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ POA_Current_Impl::POA_Current_Impl (void)
+ : poa_ (0),
+ object_id_ (TAO_POA_OBJECT_ID_BUF_SIZE, 0, object_id_buf_),
+ object_key_ (0),
+ servant_ (0),
+ priority_ (TAO_INVALID_PRIORITY),
+ previous_current_impl_ (0),
+ setup_done_ (0)
+ {
+ }
+
+ void
+ POA_Current_Impl::setup (::TAO_Root_POA *p,
+ const TAO::ObjectKey &key)
+ {
+ // Remember information about this upcall.
+ this->poa_ = p;
+ this->object_key_ = &key;
+
+ // Set the current context and remember the old one.
+ this->tss_resources_ = TAO_TSS_Resources::instance ();
+
+ this->previous_current_impl_ =
+ static_cast <POA_Current_Impl *>
+ (this->tss_resources_->poa_current_impl_);
+ this->tss_resources_->poa_current_impl_ = this;
+
+ // Setup is complete.
+ this->setup_done_ = 1;
+ }
+
+ POA_Current_Impl *
+ POA_Current_Impl::previous (void) const
+ {
+ return this->previous_current_impl_;
+ }
+
+ void
+ POA_Current_Impl::teardown (void)
+ {
+ if (this->setup_done_)
+ {
+ // Reset the old context.
+ this->tss_resources_->poa_current_impl_ = this->previous_current_impl_;
+ }
+ }
+
+ PortableServer::POA_ptr
+ POA_Current_Impl::get_POA (void)
+ {
+ return PortableServer::POA::_duplicate (this->poa_);
+ }
+
+ PortableServer::ObjectId *
+ POA_Current_Impl::get_object_id (void)
+ {
+ PortableServer::ObjectId *objid = 0;
+
+ // Create a new one and pass it back
+ ACE_NEW_RETURN (objid,
+ PortableServer::ObjectId (this->object_id_),
+ 0);
+ return objid;
+ }
+
+ CORBA::Object_ptr
+ POA_Current_Impl::get_reference (void)
+ {
+ return this->poa_->id_to_reference (this->object_id_);
+ }
+
+ PortableServer::Servant
+ POA_Current_Impl::get_servant (void)
+ {
+ return this->servant_;
+ }
+
+ TAO_ORB_Core &
+ POA_Current_Impl::orb_core (void) const
+
+ {
+ return this->poa_->orb_core ();
+ }
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/POA_Current_Impl.h b/TAO/tao/PortableServer/POA_Current_Impl.h
new file mode 100644
index 00000000000..c14df79916d
--- /dev/null
+++ b/TAO/tao/PortableServer/POA_Current_Impl.h
@@ -0,0 +1,194 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file POA_Current_Impl.h
+ *
+ * $Id$
+ *
+ * @author Irfan Pyarali
+ */
+//=============================================================================
+
+#ifndef TAO_POA_CURRENT_IMPL_H
+#define TAO_POA_CURRENT_IMPL_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/PS_ForwardC.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+#ifndef TAO_POA_OBJECT_ID_BUF_SIZE
+#define TAO_POA_OBJECT_ID_BUF_SIZE 512
+#endif /* TAO_POA_OBJECT_ID_BUF_SIZE */
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ class Non_Servant_Upcall;
+ class Servant_Upcall;
+ }
+
+ class ObjectKey;
+}
+
+class TAO_TSS_Resources;
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ /**
+ * @class POA_Current_Impl
+ *
+ * @brief Implementation of the PortableServer::Current object.
+ *
+ * Objects of this class hold state information regarding the
+ * current POA invocation. Savvy readers will notice that this
+ * contains substantially more methods than the POA spec shows;
+ * they exist because the ORB either (a) needs them or (b) finds
+ * them useful for implementing a more efficient ORB.
+ * The intent is that instances of this class are held in
+ * Thread-Specific Storage so that upcalls can get context
+ * information regarding their invocation. The POA itself must
+ * insure that all <set_*> operations are performed in the
+ * execution thread so that the proper <TAO_POA_Current> pointer
+ * is obtained from TSS.
+ */
+ class TAO_PortableServer_Export POA_Current_Impl
+ {
+ public:
+ friend class ::TAO_Root_POA;
+
+ /// Return pointer to the invoking POA. Raises the
+ /// <CORBA::NoContext> exception.
+ PortableServer::POA_ptr get_POA (void);
+
+ /**
+ * Return pointer to the object id through which this was invoked.
+ * This may be necessary in cases where a <Servant> is serving under
+ * the guise of multiple object ids.
+ */
+ PortableServer::ObjectId *get_object_id (void);
+
+ /**
+ * Returns a reference to the servant that hosts the object in whose
+ * context it is called.
+ */
+ PortableServer::Servant get_servant (void);
+
+ /**
+ * This operation returns a locally manufactured reference to the object
+ * in the context of which it is called.
+ */
+ CORBA::Object_ptr get_reference (void);
+
+ /// Set the POA implementation.
+ void poa (::TAO_Root_POA *);
+
+ /// Get the POA implemantation
+ ::TAO_Root_POA *poa (void) const;
+
+ /// ORB Core for this current.
+ TAO_ORB_Core &orb_core (void) const;
+
+ /// Set the object ID.
+ void object_id (const PortableServer::ObjectId &id);
+
+ /// Get the object ID.
+ const PortableServer::ObjectId &object_id (void) const;
+
+ /// Just replace the object id smartly
+ void replace_object_id (const PortableServer::ObjectId &system_id);
+
+ /// Set the object key.
+ void object_key (const TAO::ObjectKey &key);
+
+ /// Get the object key.
+ const TAO::ObjectKey &object_key (void) const;
+
+ /// Set the servant for the current upcall.
+ void servant (PortableServer::Servant servant);
+
+ /// Get the servant for the current upcall.
+ PortableServer::Servant servant (void) const;
+
+ /// Set the priority for the current upcall.
+ void priority (CORBA::Short priority);
+
+ /// Get the priority for the current upcall.
+ CORBA::Short priority (void) const;
+
+ /// Convenience constructor combining construction & initialization.
+ POA_Current_Impl (void);
+
+ /// Return the previous current implementation.
+ POA_Current_Impl *previous (void) const;
+
+ /// Teardown the current for this request.
+ void teardown (void);
+
+ /// Setup the current.
+ void setup (::TAO_Root_POA *impl,
+ const TAO::ObjectKey &key);
+
+ private:
+
+ // = Hidden because we don't allow these
+ POA_Current_Impl (const POA_Current_Impl &);
+ void operator= (const POA_Current_Impl &);
+
+ protected:
+ /// The POA implementation invoking an upcall
+ ::TAO_Root_POA *poa_;
+
+ /// In order to avoid memory allocations, we will populate
+ /// the object id with this buffer.
+ CORBA::Octet object_id_buf_[TAO_POA_OBJECT_ID_BUF_SIZE];
+
+ /**
+ * The object ID of the current context. This is the user id and
+ * not the id the goes into the IOR. Note also that unlike the
+ * <object_key>, this field is stored by value.
+ */
+ PortableServer::ObjectId object_id_;
+
+ /// The object key of the current context.
+ const TAO::ObjectKey *object_key_;
+
+ /// The servant for the current upcall.
+ PortableServer::Servant servant_;
+
+ /// The priority for the current upcall.
+ CORBA::Short priority_;
+
+ /// Current previous from <this>.
+ POA_Current_Impl *previous_current_impl_;
+
+ /// Is setup complete?
+ int setup_done_;
+
+ /// Pointer to tss resources.
+ TAO_TSS_Resources *tss_resources_;
+
+ };
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/PortableServer/POA_Current_Impl.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_POA_CURRENT_IMPL_H */
diff --git a/TAO/tao/PortableServer/POA_Current_Impl.inl b/TAO/tao/PortableServer/POA_Current_Impl.inl
new file mode 100644
index 00000000000..cf3fee49d65
--- /dev/null
+++ b/TAO/tao/PortableServer/POA_Current_Impl.inl
@@ -0,0 +1,103 @@
+// -*- C++ -*-
+//
+// $Id$
+
+#include "tao/SystemException.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ ACE_INLINE void
+ POA_Current_Impl::poa (::TAO_Root_POA *p)
+ {
+ this->poa_ = p;
+ }
+
+ ACE_INLINE ::TAO_Root_POA *
+ POA_Current_Impl::poa (void) const
+ {
+ return this->poa_;
+ }
+
+ ACE_INLINE void
+ POA_Current_Impl::object_id (const PortableServer::ObjectId &id)
+ {
+ if (this->object_id_.release () ||
+ this->object_id_.get_buffer() == this->object_id_buf_)
+ {
+ // Resize the current object_id_. If it is less than the
+ // length of the current buffer, no allocation will take place.
+ size_t id_size = id.length ();
+ this->object_id_.length (id_size);
+
+ // Get the buffer and copy the new object id in it's place.
+ ACE_OS::memcpy (this->object_id_.get_buffer (),
+ id.get_buffer (), id_size);
+ }
+ else
+ {
+ this->object_id_ = id;
+ }
+ }
+
+ ACE_INLINE const PortableServer::ObjectId &
+ POA_Current_Impl::object_id (void) const
+ {
+ return this->object_id_;
+ }
+
+ ACE_INLINE void
+ POA_Current_Impl::replace_object_id (
+ const PortableServer::ObjectId &system_id)
+ {
+ // This has the effect of replacing the underlying buffer
+ // with that of another object id without copying.
+ object_id_.replace (system_id.maximum (),
+ system_id.length (),
+ const_cast <CORBA::Octet *> (system_id.get_buffer ()),
+ 0);
+ }
+
+ ACE_INLINE void
+ POA_Current_Impl::object_key (const TAO::ObjectKey &key)
+ {
+ this->object_key_ = &key;
+ }
+
+ ACE_INLINE const TAO::ObjectKey &
+ POA_Current_Impl::object_key (void) const
+ {
+ return *this->object_key_;
+ }
+
+ ACE_INLINE void
+ POA_Current_Impl::servant (PortableServer::Servant servant)
+ {
+ this->servant_ = servant;
+ }
+
+ ACE_INLINE PortableServer::Servant
+ POA_Current_Impl::servant (void) const
+ {
+ return this->servant_;
+ }
+
+ ACE_INLINE void
+ POA_Current_Impl::priority (CORBA::Short priority)
+ {
+ this->priority_ = priority;
+ }
+
+ ACE_INLINE CORBA::Short
+ POA_Current_Impl::priority (void) const
+ {
+ return this->priority_;
+ }
+
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/POA_Guard.cpp b/TAO/tao/PortableServer/POA_Guard.cpp
new file mode 100644
index 00000000000..a2943714015
--- /dev/null
+++ b/TAO/tao/PortableServer/POA_Guard.cpp
@@ -0,0 +1,49 @@
+// $Id$
+
+#include "tao/PortableServer/POA_Guard.h"
+#include "tao/PortableServer/Root_POA.h"
+#include "tao/ORB_Constants.h"
+
+ACE_RCSID(PortableServer,
+ POA_Guard,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ POA_Guard::POA_Guard (::TAO_Root_POA &poa
+ ACE_ENV_ARG_DECL,
+ int check_for_destruction)
+ : guard_ (poa.lock ())
+ {
+ if (!this->guard_.locked ())
+ ACE_THROW (
+ CORBA::INTERNAL (
+ CORBA::SystemException::_tao_minor_code (
+ TAO_GUARD_FAILURE,
+ 0),
+ CORBA::COMPLETED_NO));
+
+ // Check if a non-servant upcall is in progress. If a non-servant
+ // upcall is in progress, wait for it to complete. Unless of
+ // course, the thread making the non-servant upcall is this thread.
+ poa.object_adapter ().wait_for_non_servant_upcalls_to_complete (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (check_for_destruction &&
+ poa.cleanup_in_progress ())
+ ACE_THROW (
+ CORBA::BAD_INV_ORDER (
+ CORBA::SystemException::_tao_minor_code (
+ TAO_POA_BEING_DESTROYED,
+ 0),
+ CORBA::COMPLETED_NO));
+ }
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/POA_Guard.h b/TAO/tao/PortableServer/POA_Guard.h
new file mode 100644
index 00000000000..da0f74dedae
--- /dev/null
+++ b/TAO/tao/PortableServer/POA_Guard.h
@@ -0,0 +1,58 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file POA_Guard.h
+ *
+ * $Id$
+ */
+//=============================================================================
+
+#ifndef TAO_POA_GUARD_H
+#define TAO_POA_GUARD_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Environment.h"
+#include "ace/Guard_T.h"
+#include "ace/CORBA_macros.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Root_POA;
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ /**
+ * @class POA_Guard
+ *
+ * @brief POA_Guard
+ *
+ * POA_Guard
+ */
+ class TAO_PortableServer_Export POA_Guard
+ {
+ public:
+ POA_Guard (::TAO_Root_POA &poa
+ ACE_ENV_ARG_DECL,
+ int check_for_destruction = 1);
+
+ private:
+ ACE_Guard<ACE_Lock> guard_;
+ };
+ } /* namespace Portable_Server */
+} /* namespace TAO */
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_POA_GUARD_H */
diff --git a/TAO/tao/PortableServer/POA_Policy_Set.cpp b/TAO/tao/PortableServer/POA_Policy_Set.cpp
new file mode 100644
index 00000000000..c3200dbe136
--- /dev/null
+++ b/TAO/tao/PortableServer/POA_Policy_Set.cpp
@@ -0,0 +1,98 @@
+// @(#) $Id$
+
+#include "tao/PortableServer/POA_Policy_Set.h"
+#include "tao/PortableServer/POA_Cached_Policies.h"
+#include "tao/PortableServer/PortableServer.h"
+
+#include "tao/Policy_Validator.h"
+#include "tao/ORB_Core.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/PortableServer/POA_Policy_Set.i"
+#endif /* ! __ACE_INLINE__ */
+
+ACE_RCSID (PortableServer,
+ POA_Policy_Set,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_POA_Policy_Set::TAO_POA_Policy_Set (void)
+ : impl_ (TAO_POLICY_POA_SCOPE)
+{
+}
+
+TAO_POA_Policy_Set::TAO_POA_Policy_Set (const TAO_POA_Policy_Set &rhs)
+ :
+ impl_ (rhs.impl_)
+{
+}
+
+TAO_POA_Policy_Set::~TAO_POA_Policy_Set (void)
+{
+}
+
+void
+TAO_POA_Policy_Set::add_client_exposed_fixed_policies (CORBA::PolicyList *client_exposed_policies
+ ACE_ENV_ARG_DECL)
+{
+ CORBA::ULong cep_index = client_exposed_policies->length ();
+
+ for (CORBA::ULong i = 0;
+ i < this->num_policies ();
+ ++i)
+ {
+ CORBA::Policy_var policy = this->get_policy_by_index (i);
+
+ // If this policy is client exposed, add it to the list.
+ if (policy->_tao_scope () & TAO_POLICY_CLIENT_EXPOSED)
+ {
+ client_exposed_policies->length (cep_index + 1);
+ (*client_exposed_policies)[cep_index] =
+ policy->copy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ cep_index++;
+ }
+ }
+}
+
+void
+TAO_POA_Policy_Set::validate_policies (TAO_Policy_Validator &validator,
+ TAO_ORB_Core &orb_core
+ ACE_ENV_ARG_DECL)
+{
+ // Just give a last chance for all the unloaded validators in other
+ // libraries to be registered
+ orb_core.load_policy_validators (validator ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Validate that all of the specified policies make sense.
+ validator.validate (this->impl_ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Verify that all policies are legal for the currently loaded
+ // POA extensions.
+ for (CORBA::ULong i = 0;
+ i < this->impl_.num_policies ();
+ i++)
+ {
+ CORBA::Policy_var policy = this->impl_.get_policy_by_index (i);
+
+ CORBA::PolicyType type = policy->policy_type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (validator.legal_policy (type) == 0)
+ {
+#if ! defined (CORBA_E_MICRO)
+ // An invalid policy was specified. Let the user know about
+ // it.
+ ACE_THROW (PortableServer::POA::InvalidPolicy ());
+#else
+ ACE_ERROR ((LM_ERROR, "Invalid policy\n"));
+#endif
+ }
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/POA_Policy_Set.h b/TAO/tao/PortableServer/POA_Policy_Set.h
new file mode 100644
index 00000000000..182ad836a8f
--- /dev/null
+++ b/TAO/tao/PortableServer/POA_Policy_Set.h
@@ -0,0 +1,83 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file POA_Policy_Set.h
+ *
+ * $Id$
+ *
+ * POA
+ *
+ * @author Irfan Pyarali
+ */
+//=============================================================================
+
+#ifndef TAO_POA_POLICY_SET_H
+#define TAO_POA_POLICY_SET_H
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Policy_Set.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Policy_Validator;
+
+class TAO_PortableServer_Export TAO_POA_Policy_Set
+{
+public:
+
+ TAO_POA_Policy_Set (void);
+
+ TAO_POA_Policy_Set (const TAO_POA_Policy_Set &rhs);
+
+ ~TAO_POA_Policy_Set (void);
+
+ /// Returns the policy at the specified index.
+ /// CORBA::Policy::_nil () is returned if the policy doesn't exist
+ CORBA::Policy *get_policy_by_index (CORBA::ULong index);
+
+ /// Get the number of policies
+ CORBA::ULong num_policies (void) const;
+
+ /// Obtain a single cached policy.
+ CORBA::Policy_ptr get_cached_policy (TAO_Cached_Policy_Type type
+ ACE_ENV_ARG_DECL);
+
+ void merge_policies (const CORBA::PolicyList &policies
+ ACE_ENV_ARG_DECL);
+
+ void merge_policy (const CORBA::Policy_ptr policy
+ ACE_ENV_ARG_DECL);
+
+ void validate_policies (TAO_Policy_Validator &validator,
+ TAO_ORB_Core &orb_core
+ ACE_ENV_ARG_DECL);
+
+ /// Add all of the client exposed policies to the specified list.
+ void add_client_exposed_fixed_policies (CORBA::PolicyList *client_exposed_policies
+ ACE_ENV_ARG_DECL);
+
+ TAO_Policy_Set &policies (void);
+
+ /// Obtain a single policy.
+ CORBA::Policy_ptr get_policy (CORBA::PolicyType policy
+ ACE_ENV_ARG_DECL);
+
+protected:
+ TAO_Policy_Set impl_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/PortableServer/POA_Policy_Set.i"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_POA_POLICY_SET_H */
diff --git a/TAO/tao/PortableServer/POA_Policy_Set.i b/TAO/tao/PortableServer/POA_Policy_Set.i
new file mode 100644
index 00000000000..4181baecf48
--- /dev/null
+++ b/TAO/tao/PortableServer/POA_Policy_Set.i
@@ -0,0 +1,59 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE CORBA::ULong
+TAO_POA_Policy_Set::num_policies (void) const
+{
+ return this->impl_.num_policies ();
+}
+
+ACE_INLINE CORBA::Policy *
+TAO_POA_Policy_Set::get_policy_by_index (CORBA::ULong index)
+{
+ return this->impl_.get_policy_by_index (index);
+}
+
+ACE_INLINE CORBA::Policy_ptr
+TAO_POA_Policy_Set::get_cached_policy (TAO_Cached_Policy_Type type
+ ACE_ENV_ARG_DECL)
+{
+ return this->impl_.get_cached_policy (type
+ ACE_ENV_ARG_PARAMETER);
+}
+
+ACE_INLINE void
+TAO_POA_Policy_Set::merge_policies (const CORBA::PolicyList &policies
+ ACE_ENV_ARG_DECL)
+{
+ // Add the policies if they don't exist, override them if they do.
+ this->impl_.set_policy_overrides (policies,
+ CORBA::ADD_OVERRIDE
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+ACE_INLINE void
+TAO_POA_Policy_Set::merge_policy (const CORBA::Policy_ptr policy
+ ACE_ENV_ARG_DECL)
+{
+ this->impl_.set_policy (policy ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+ACE_INLINE CORBA::Policy_ptr
+TAO_POA_Policy_Set::get_policy (CORBA::PolicyType policy
+ ACE_ENV_ARG_DECL)
+{
+ return this->impl_.get_policy (policy ACE_ENV_ARG_PARAMETER);
+}
+
+ACE_INLINE TAO_Policy_Set &
+TAO_POA_Policy_Set::policies (void)
+{
+ return this->impl_;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/PS_Current.pidl b/TAO/tao/PortableServer/PS_Current.pidl
new file mode 100644
index 00000000000..3d7a646ced7
--- /dev/null
+++ b/TAO/tao/PortableServer/PS_Current.pidl
@@ -0,0 +1,43 @@
+/**
+ * @file PS_Current.pidl
+ *
+ * $Id$
+ *
+ * @brief PIDL source for the PortableServer module.
+ */
+
+#ifndef _PORTABLESERVER_CURRENT_IDL_
+#define _PORTABLESERVER_CURRENT_IDL_
+
+///FUZZ: disable check_for_include/
+#include "tao/PortableServer/PS_Forward.pidl"
+#include "tao/Current.pidl"
+
+#pragma prefix "omg.org"
+
+module PortableServer
+{
+# pragma version PortableServer 2.3
+
+ // Current interface.
+ local interface Current : CORBA::Current
+ {
+# pragma version Current 2.3
+
+ exception NoContext {};
+
+ POA get_POA ()
+ raises (NoContext);
+
+ ObjectId get_object_id ()
+ raises (NoContext);
+
+ Object get_reference ()
+ raises (NoContext);
+
+ Servant get_servant ()
+ raises (NoContext);
+ };
+};
+
+#endif // _PORTABLESERVER_CURRENT_IDL_
diff --git a/TAO/tao/PortableServer/PS_Forward.pidl b/TAO/tao/PortableServer/PS_Forward.pidl
new file mode 100644
index 00000000000..408fd7360ad
--- /dev/null
+++ b/TAO/tao/PortableServer/PS_Forward.pidl
@@ -0,0 +1,42 @@
+/**
+ * @file PS_Forward.pidl
+ *
+ * $Id$
+ *
+ * @brief Pre-compiled IDL source for the PortableServer module.
+ *
+ * This file was used to generate the code in
+ * PS_ForwardC.{h,inl,cpp}, using the following command:
+ *
+ * tao_idl.exe \
+ * -o orig -Gp -Gd -Ge 1 -Sci -GA -I$(TAO_ROOT)
+ * -Wb,export_macro=TAO_PortableServer_Export \
+ * -Wb,export_include="portableserver_export.h" \
+ * -Wb,pre_include="ace/pre.h" \
+ * -Wb,post_include="ace/post.h" \
+ * PS_Forward.pidl
+ *
+ * Apply patches using the following command:
+ *
+ * patch < diffs/PS_Forward.diff
+ */
+
+#ifndef _PORTABLESERVER_PS_FORWARD_IDL_
+#define _PORTABLESERVER_PS_FORWARD_IDL_
+
+#include "tao/OctetSeq.pidl"
+
+#pragma prefix "omg.org"
+
+module PortableServer
+{
+# pragma version PortableServer 2.3
+
+ typedef CORBA::OctetSeq ObjectId;
+
+ local interface POA;
+
+ native Servant;
+};
+
+#endif // _PORTABLESERVER_PS_FORWARD_IDL_
diff --git a/TAO/tao/PortableServer/PS_ForwardA.cpp b/TAO/tao/PortableServer/PS_ForwardA.cpp
new file mode 100644
index 00000000000..efaca76332e
--- /dev/null
+++ b/TAO/tao/PortableServer/PS_ForwardA.cpp
@@ -0,0 +1,56 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+#include "tao/AnyTypeCode/Null_RefCount_Policy.h"
+#include "tao/AnyTypeCode/TypeCode_Constants.h"
+#include "tao/AnyTypeCode/Alias_TypeCode_Static.h"
+#include "tao/PortableServer/PS_ForwardA.h"
+#include "tao/CDR.h"
+#include "tao/AnyTypeCode/Any.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/alias_typecode.cpp:50
+
+static TAO::TypeCode::Alias<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_PortableServer_ObjectId (
+ CORBA::tk_alias,
+ "IDL:omg.org/PortableServer/ObjectId:2.3",
+ "ObjectId",
+ &CORBA::_tc_OctetSeq);
+
+namespace PortableServer
+{
+ ::CORBA::TypeCode_ptr const _tc_ObjectId =
+ &_tao_tc_PortableServer_ObjectId;
+}
+
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/PS_ForwardA.h b/TAO/tao/PortableServer/PS_ForwardA.h
new file mode 100644
index 00000000000..047e66c649b
--- /dev/null
+++ b/TAO/tao/PortableServer/PS_ForwardA.h
@@ -0,0 +1,63 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:754
+
+#ifndef _TAO_IDL_PS_FORWARDA_H_
+#define _TAO_IDL_PS_FORWARDA_H_
+
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+#include "tao/PortableServer/PS_ForwardC.h"
+#include "tao/AnyTypeCode/OctetSeqA.h"
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_module/module_ch.cpp:59
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace PortableServer
+{
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:49
+
+ extern TAO_PortableServer_Export ::CORBA::TypeCode_ptr const _tc_ObjectId;
+
+// TAO_IDL - Generated from
+// be\be_visitor_module/module_ch.cpp:86
+
+} // module PortableServer
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* ifndef */
diff --git a/TAO/tao/PortableServer/PS_ForwardC.cpp b/TAO/tao/PortableServer/PS_ForwardC.cpp
new file mode 100644
index 00000000000..d23e1ebf431
--- /dev/null
+++ b/TAO/tao/PortableServer/PS_ForwardC.cpp
@@ -0,0 +1,46 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:277
+
+
+#include "tao/PortableServer/PS_ForwardC.h"
+#include "tao/CDR.h"
+#include "tao/ORB_Core.h"
+
+// TAO_IDL - Generated from
+// be\be_visitor_arg_traits.cpp:70
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Arg traits specializations.
+namespace TAO
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/PS_ForwardC.h b/TAO/tao/PortableServer/PS_ForwardC.h
new file mode 100644
index 00000000000..4d4aa7d4ddc
--- /dev/null
+++ b/TAO/tao/PortableServer/PS_ForwardC.h
@@ -0,0 +1,128 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:154
+
+#ifndef _TAO_IDL_PS_FORWARDC_H_
+#define _TAO_IDL_PS_FORWARDC_H_
+
+#include /**/ "ace/pre.h"
+
+
+#include "ace/config-all.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/portableserver_export.h"
+#include "tao/ORB.h"
+#include "tao/Environment.h"
+#include "tao/Objref_VarOut_T.h"
+
+#include "tao/OctetSeqC.h"
+
+#if defined (TAO_EXPORT_MACRO)
+#undef TAO_EXPORT_MACRO
+#endif
+#define TAO_EXPORT_MACRO TAO_PortableServer_Export
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_ServantBase;
+class TAO_Local_ServantBase;
+class TAO_Root_POA;
+class TAO_DynamicImplementation;
+
+// TAO_IDL - Generated from
+// be\be_visitor_module/module_ch.cpp:49
+
+namespace PortableServer
+{
+ typedef TAO_ServantBase ServantBase;
+ struct RefCountServantBase {};
+ template <class T> class Servant_var;
+ typedef Servant_var<TAO_ServantBase> ServantBase_var;
+ typedef ServantBase *Servant;
+
+ typedef TAO_Local_ServantBase LocalServantBase;
+ typedef TAO_DynamicImplementation DynamicImplementation;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typedef/typedef_ch.cpp:472
+
+ typedef CORBA::OctetSeq ObjectId;
+ typedef CORBA::OctetSeq_var ObjectId_var;
+ typedef CORBA::OctetSeq_out ObjectId_out;
+
+ // TAO_IDL - Generated from
+ // be\be_interface.cpp:598
+
+#if !defined (_PORTABLESERVER_POA__VAR_OUT_CH_)
+#define _PORTABLESERVER_POA__VAR_OUT_CH_
+
+ class POA;
+ typedef POA *POA_ptr;
+
+ typedef
+ TAO_Objref_Var_T<
+ POA
+ >
+ POA_var;
+
+ typedef
+ TAO_Objref_Out_T<
+ POA
+ >
+ POA_out;
+
+#endif /* end #if !defined */
+
+// TAO_IDL - Generated from
+// be\be_visitor_module/module_ch.cpp:78
+
+} // module PortableServer
+
+// TAO_IDL - Generated from
+// be\be_visitor_traits.cpp:61
+
+// Traits specializations.
+namespace TAO
+{
+}
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:1028
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* ifndef */
+
+
diff --git a/TAO/tao/PortableServer/PolicyS.cpp b/TAO/tao/PortableServer/PolicyS.cpp
new file mode 100644
index 00000000000..9eae2512e9b
--- /dev/null
+++ b/TAO/tao/PortableServer/PolicyS.cpp
@@ -0,0 +1,1088 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:599
+
+#ifndef _TAO_IDL_ORIG_POLICYS_CPP_
+#define _TAO_IDL_ORIG_POLICYS_CPP_
+
+
+#include "tao/AnyTypeCode/TypeCode.h"
+#include "tao/AnyTypeCode/Any.h"
+#include "tao/PortableServer/PolicyS.h"
+#include "tao/PortableServer/Operation_Table_Perfect_Hash.h"
+#include "tao/PortableServer/Direct_Collocation_Upcall_Wrapper.h"
+#include "tao/PortableServer/Upcall_Command.h"
+#include "tao/PortableServer/Upcall_Wrapper.h"
+#include "tao/PortableServer/Basic_SArguments.h"
+#include "tao/PortableServer/Object_SArgument_T.h"
+#include "tao/PortableServer/Special_Basic_SArguments.h"
+#include "tao/PortableServer/UB_String_SArguments.h"
+#include "tao/PortableServer/TypeCode_SArg_Traits.h"
+#include "tao/PortableServer/Object_SArg_Traits.h"
+#include "tao/PortableServer/get_arg.h"
+#include "tao/Special_Basic_Arguments.h"
+#include "tao/UB_String_Arguments.h"
+#include "tao/TAO_Server_Request.h"
+#include "tao/ORB_Core.h"
+#include "tao/Profile.h"
+#include "tao/Stub.h"
+#include "tao/IFR_Client_Adapter.h"
+#include "tao/Object_T.h"
+#include "tao/CDR.h"
+#include "tao/operation_details.h"
+#include "tao/PortableInterceptor.h"
+#include "tao/Basic_Arguments.h"
+#include "tao/Object_Argument_T.h"
+#include "ace/Dynamic_Service.h"
+#include "ace/Malloc_Allocator.h"
+
+// TAO_IDL - Generated from
+// be\be_visitor_arg_traits.cpp:69
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Arg traits specializations.
+namespace TAO
+{
+
+#if !defined (_CORBA_POLICY__SARG_TRAITS_SS_)
+#define _CORBA_POLICY__SARG_TRAITS_SS_
+
+ template<>
+ class SArg_Traits<CORBA::Policy>
+ : public
+ Object_SArg_Traits_T<
+ CORBA::Policy_ptr,
+ CORBA::Policy_var,
+ CORBA::Policy_out,
+ TAO::Any_Insert_Policy_Stream <CORBA::Policy_ptr>
+ >
+ {
+ };
+
+#endif /* end #if !defined */
+}
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_arg_traits.cpp:69
+
+// Arg traits specializations.
+namespace TAO
+{
+
+#if !defined (_CORBA_POLICY__ARG_TRAITS_SS_)
+#define _CORBA_POLICY__ARG_TRAITS_SS_
+
+ template<>
+ class Arg_Traits<CORBA::Policy>
+ : public
+ Object_Arg_Traits_T<
+ CORBA::Policy_ptr,
+ CORBA::Policy_var,
+ CORBA::Policy_out,
+ TAO::Objref_Traits<CORBA::Policy>,
+ TAO::Any_Insert_Policy_Stream <CORBA::Policy_ptr>
+ >
+ {
+ };
+
+#endif /* end #if !defined */
+}
+
+
+// TAO_IDL - Generated from
+// be\be_interface.cpp:1455
+
+class TAO_CORBA_Policy_Perfect_Hash_OpTable
+ : public TAO_Perfect_Hash_OpTable
+{
+private:
+ unsigned int hash (const char *str, unsigned int len);
+
+public:
+ const TAO_operation_db_entry * lookup (const char *str, unsigned int len);
+};
+
+/* C++ code produced by gperf version 2.8 (ACE version) */
+/* Command-line: c:\ACE\latest\ACE_wrappers\bin\gperf.exe -m -M -J -c -C -D -E -T -f 0 -F 0,0 -a -o -t -p -K opname -L C++ -Z TAO_CORBA_Policy_Perfect_Hash_OpTable -N lookup */
+unsigned int
+TAO_CORBA_Policy_Perfect_Hash_OpTable::hash (const char *str, unsigned int len)
+{
+ static const unsigned char asso_values[] =
+ {
+#if defined (ACE_MVS)
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 0,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 0,
+ 22, 0, 0, 5, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 0, 22, 22, 22, 22, 0, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22,
+#else
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 0, 22, 0, 22, 0,
+ 0, 5, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 0, 22, 22, 22,
+ 22, 0, 22, 22, 22, 22, 22, 22,
+#endif /* ACE_MVS */
+ };
+ return len + asso_values[(int) str[len - 1]] + asso_values[(int) str[0]];
+}
+
+const TAO_operation_db_entry *
+TAO_CORBA_Policy_Perfect_Hash_OpTable::lookup (const char *str, unsigned int len)
+{
+ enum
+ {
+ TOTAL_KEYWORDS = 7,
+ MIN_WORD_LENGTH = 4,
+ MAX_WORD_LENGTH = 16,
+ MIN_HASH_VALUE = 4,
+ MAX_HASH_VALUE = 21,
+ HASH_VALUE_RANGE = 18,
+ DUPLICATES = 0,
+ WORDLIST_SIZE = 11
+ };
+
+ static const TAO_operation_db_entry wordlist[] =
+ {
+ {"",0,0},{"",0,0},{"",0,0},{"",0,0},
+ {"copy", &POA_CORBA::Policy::copy_skel, &POA_CORBA::_TAO_Policy_Direct_Proxy_Impl::copy},
+ {"_is_a", &POA_CORBA::Policy::_is_a_skel, 0},
+ {"",0,0},
+ {"destroy", &POA_CORBA::Policy::destroy_skel, &POA_CORBA::_TAO_Policy_Direct_Proxy_Impl::destroy},
+ {"",0,0},{"",0,0},
+ {"_component", &POA_CORBA::Policy::_component_skel, 0},
+ {"",0,0},{"",0,0},
+ {"_non_existent", &POA_CORBA::Policy::_non_existent_skel, 0},
+ {"",0,0},
+ {"_interface", &POA_CORBA::Policy::_interface_skel, 0},
+ {"",0,0},{"",0,0},{"",0,0},{"",0,0},{"",0,0},
+ {"_get_policy_type", &POA_CORBA::Policy::_get_policy_type_skel, &POA_CORBA::_TAO_Policy_Direct_Proxy_Impl::_get_policy_type},
+ };
+
+ if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
+ {
+ unsigned int key = hash (str, len);
+
+ if (key <= MAX_HASH_VALUE && key >= MIN_HASH_VALUE)
+ {
+ const char *s = wordlist[key].opname;
+
+ if (*str == *s && !strncmp (str + 1, s + 1, len - 1))
+ return &wordlist[key];
+ }
+ }
+ return 0;
+}
+
+static TAO_CORBA_Policy_Perfect_Hash_OpTable tao_CORBA_Policy_optable;
+///////////////////////////////////////////////////////////////////////
+// Strategized Proxy Broker Implementation
+//
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/strategized_proxy_broker_ss.cpp:40
+
+// Factory function Implementation.
+POA_CORBA::_TAO_Policy_Strategized_Proxy_Broker *
+POA_CORBA::_TAO_Policy_Strategized_Proxy_Broker::the_TAO_Policy_Strategized_Proxy_Broker (void)
+{
+ static POA_CORBA::_TAO_Policy_Strategized_Proxy_Broker
+ strategized_proxy_broker;
+
+ return &strategized_proxy_broker;
+}
+
+POA_CORBA::_TAO_Policy_Strategized_Proxy_Broker::_TAO_Policy_Strategized_Proxy_Broker (void)
+{
+}
+
+POA_CORBA::_TAO_Policy_Strategized_Proxy_Broker::~_TAO_Policy_Strategized_Proxy_Broker (void)
+{
+}
+
+TAO::Collocation_Strategy
+POA_CORBA::_TAO_Policy_Strategized_Proxy_Broker::get_strategy (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ TAO::Collocation_Strategy strategy =
+ TAO_ORB_Core::collocation_strategy (obj ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO::TAO_CS_REMOTE_STRATEGY);
+
+ return strategy;
+}
+
+void
+POA_CORBA::_TAO_Policy_Strategized_Proxy_Broker::dispatch (
+ CORBA::Object_ptr obj,
+ CORBA::Object_out forward_obj,
+ TAO::Argument ** args,
+ int num_args,
+ const char * op,
+ size_t op_len,
+ TAO::Collocation_Strategy strategy
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::Exception))
+{
+ TAO::Direct_Collocation_Upcall_Wrapper collocation_upcall_wrapper;
+ collocation_upcall_wrapper.upcall (
+ obj,
+ forward_obj,
+ args,
+ num_args,
+ op,
+ op_len,
+ strategy
+ ACE_ENV_ARG_PARAMETER);
+}
+
+//
+// End Strategized Proxy Broker Implementation
+///////////////////////////////////////////////////////////////////////
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/interface_ss.cpp:999
+
+TAO::Collocation_Proxy_Broker *
+CORBA__TAO_Policy_Proxy_Broker_Factory_function (CORBA::Object_ptr)
+{
+ return
+ ::POA_CORBA::_TAO_Policy_Strategized_Proxy_Broker::the_TAO_Policy_Strategized_Proxy_Broker ();
+}
+
+int
+CORBA__TAO_Policy_Proxy_Broker_Factory_Initializer (size_t)
+{
+ CORBA__TAO_Policy_Proxy_Broker_Factory_function_pointer =
+ CORBA__TAO_Policy_Proxy_Broker_Factory_function;
+
+ return 0;
+}
+
+static int
+CORBA__TAO_Policy_Proxy_Broker_Stub_Factory_Initializer_Scarecrow =
+ CORBA__TAO_Policy_Proxy_Broker_Factory_Initializer (
+ reinterpret_cast<size_t> (CORBA__TAO_Policy_Proxy_Broker_Factory_Initializer)
+ );
+
+
+
+///////////////////////////////////////////////////////////////////////
+// Direct Proxy Implementation
+//
+
+POA_CORBA::_TAO_Policy_Direct_Proxy_Impl::_TAO_Policy_Direct_Proxy_Impl (void)
+{}
+
+POA_CORBA::_TAO_Policy_Direct_Proxy_Impl::~_TAO_Policy_Direct_Proxy_Impl (void)
+{}
+
+// TAO_IDL - Generated from
+// be\be_visitor_operation/direct_proxy_impl_ss.cpp:42
+
+void
+POA_CORBA::_TAO_Policy_Direct_Proxy_Impl::_get_policy_type (
+ TAO_Abstract_ServantBase *servant,
+ TAO::Argument ** args,
+ int
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ ((TAO::Arg_Traits< ::CORBA::PolicyType>::ret_val *) args[0])->arg () =
+ dynamic_cast<POA_CORBA::Policy_ptr>
+ (servant)
+ ->policy_type (
+ ACE_ENV_SINGLE_ARG_PARAMETER
+ );
+ ACE_CHECK;
+}
+// TAO_IDL - Generated from
+// be\be_visitor_operation/direct_proxy_impl_ss.cpp:42
+
+void
+POA_CORBA::_TAO_Policy_Direct_Proxy_Impl::copy (
+ TAO_Abstract_ServantBase *servant,
+ TAO::Argument ** args,
+ int
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ ((TAO::Arg_Traits< CORBA::Policy>::ret_val *) args[0])->arg () =
+ dynamic_cast<POA_CORBA::Policy_ptr>
+ (servant)
+ ->copy (
+ ACE_ENV_SINGLE_ARG_PARAMETER
+ );
+ ACE_CHECK;
+}
+// TAO_IDL - Generated from
+// be\be_visitor_operation/direct_proxy_impl_ss.cpp:42
+
+void
+POA_CORBA::_TAO_Policy_Direct_Proxy_Impl::destroy (
+ TAO_Abstract_ServantBase *servant,
+ TAO::Argument **,
+ int
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ dynamic_cast<POA_CORBA::Policy_ptr>
+ (servant)
+ ->destroy (
+ ACE_ENV_SINGLE_ARG_PARAMETER
+ );
+ ACE_CHECK;
+}
+
+
+//
+// End Direct Proxy Implementation
+///////////////////////////////////////////////////////////////////////
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/interface_ss.cpp:103
+
+POA_CORBA::Policy::Policy (void)
+ : TAO_ServantBase ()
+{
+ this->optable_ = &tao_CORBA_Policy_optable;
+}
+
+POA_CORBA::Policy::Policy (const Policy& rhs)
+ : TAO_Abstract_ServantBase (rhs),
+ TAO_ServantBase (rhs)
+{
+}
+
+POA_CORBA::Policy::~Policy (void)
+{
+}
+namespace POA_CORBA
+{
+
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/upcall_command_ss.cpp:127
+
+ class _get_policy_type_Policy
+ : public TAO::Upcall_Command
+ {
+ public:
+ inline _get_policy_type_Policy (
+ POA_CORBA::Policy * servant,
+ TAO_Operation_Details const * operation_details,
+ TAO::Argument * const args[])
+ : servant_ (servant)
+ , operation_details_ (operation_details)
+ , args_ (args)
+ {
+ }
+
+ virtual void execute (ACE_ENV_SINGLE_ARG_DECL)
+ {
+ TAO::SArg_Traits< ::CORBA::PolicyType>::ret_arg_type retval =
+ TAO::Portable_Server::get_ret_arg< ::CORBA::PolicyType> (
+ this->operation_details_,
+ this->args_);
+
+
+ retval =
+ this->servant_->policy_type (
+ ACE_ENV_SINGLE_ARG_PARAMETER);
+
+ }
+
+ private:
+ POA_CORBA::Policy * const servant_;
+ TAO_Operation_Details const * const operation_details_;
+ TAO::Argument * const * const args_;
+ };
+
+}
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_operation/operation_ss.cpp:192
+
+void POA_CORBA::Policy::_get_policy_type_skel (
+ TAO_ServerRequest & server_request,
+ void * TAO_INTERCEPTOR (servant_upcall),
+ void * servant
+ ACE_ENV_ARG_DECL
+ )
+{
+
+
+#if TAO_HAS_INTERCEPTORS == 1
+ static CORBA::TypeCode_ptr const * const exceptions = 0;
+ static CORBA::ULong const nexceptions = 0;
+#endif /* TAO_HAS_INTERCEPTORS */
+
+ TAO::SArg_Traits< ::CORBA::PolicyType>::ret_val retval;
+
+ TAO::Argument * const args[] =
+ {
+ &retval
+ };
+
+ static size_t const nargs = 1;
+
+ POA_CORBA::Policy * const impl =
+ static_cast<POA_CORBA::Policy *> (servant);
+
+ _get_policy_type_Policy command (
+ impl,
+ server_request.operation_details (),
+ args);
+
+ TAO::Upcall_Wrapper upcall_wrapper;
+ upcall_wrapper.upcall (server_request
+ , args
+ , nargs
+ , command
+#if TAO_HAS_INTERCEPTORS == 1
+ , servant_upcall
+ , exceptions
+ , nexceptions
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+}
+namespace POA_CORBA
+{
+
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/upcall_command_ss.cpp:127
+
+ class copy_Policy
+ : public TAO::Upcall_Command
+ {
+ public:
+ inline copy_Policy (
+ POA_CORBA::Policy * servant,
+ TAO_Operation_Details const * operation_details,
+ TAO::Argument * const args[])
+ : servant_ (servant)
+ , operation_details_ (operation_details)
+ , args_ (args)
+ {
+ }
+
+ virtual void execute (ACE_ENV_SINGLE_ARG_DECL)
+ {
+ TAO::SArg_Traits< CORBA::Policy>::ret_arg_type retval =
+ TAO::Portable_Server::get_ret_arg< CORBA::Policy> (
+ this->operation_details_,
+ this->args_);
+
+
+ retval =
+ this->servant_->copy (
+ ACE_ENV_SINGLE_ARG_PARAMETER);
+
+ }
+
+ private:
+ POA_CORBA::Policy * const servant_;
+ TAO_Operation_Details const * const operation_details_;
+ TAO::Argument * const * const args_;
+ };
+
+}
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_operation/operation_ss.cpp:192
+
+void POA_CORBA::Policy::copy_skel (
+ TAO_ServerRequest & server_request,
+ void * TAO_INTERCEPTOR (servant_upcall),
+ void * servant
+ ACE_ENV_ARG_DECL
+ )
+{
+
+
+#if TAO_HAS_INTERCEPTORS == 1
+ static CORBA::TypeCode_ptr const * const exceptions = 0;
+ static CORBA::ULong const nexceptions = 0;
+#endif /* TAO_HAS_INTERCEPTORS */
+
+ TAO::SArg_Traits< CORBA::Policy>::ret_val retval;
+
+ TAO::Argument * const args[] =
+ {
+ &retval
+ };
+
+ static size_t const nargs = 1;
+
+ POA_CORBA::Policy * const impl =
+ static_cast<POA_CORBA::Policy *> (servant);
+
+ copy_Policy command (
+ impl,
+ server_request.operation_details (),
+ args);
+
+ TAO::Upcall_Wrapper upcall_wrapper;
+ upcall_wrapper.upcall (server_request
+ , args
+ , nargs
+ , command
+#if TAO_HAS_INTERCEPTORS == 1
+ , servant_upcall
+ , exceptions
+ , nexceptions
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+}
+namespace POA_CORBA
+{
+
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/upcall_command_ss.cpp:127
+
+ class destroy_Policy
+ : public TAO::Upcall_Command
+ {
+ public:
+ inline destroy_Policy (
+ POA_CORBA::Policy * servant)
+ : servant_ (servant)
+ {
+ }
+
+ virtual void execute (ACE_ENV_SINGLE_ARG_DECL)
+ {
+ this->servant_->destroy (
+ ACE_ENV_SINGLE_ARG_PARAMETER);
+
+ }
+
+ private:
+ POA_CORBA::Policy * const servant_;
+ };
+
+}
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_operation/operation_ss.cpp:192
+
+void POA_CORBA::Policy::destroy_skel (
+ TAO_ServerRequest & server_request,
+ void * TAO_INTERCEPTOR (servant_upcall),
+ void * servant
+ ACE_ENV_ARG_DECL
+ )
+{
+
+
+#if TAO_HAS_INTERCEPTORS == 1
+ static CORBA::TypeCode_ptr const * const exceptions = 0;
+ static CORBA::ULong const nexceptions = 0;
+#endif /* TAO_HAS_INTERCEPTORS */
+
+ TAO::SArg_Traits< void>::ret_val retval;
+
+ TAO::Argument * const args[] =
+ {
+ &retval
+ };
+
+ static size_t const nargs = 1;
+
+ POA_CORBA::Policy * const impl =
+ static_cast<POA_CORBA::Policy *> (servant);
+
+ destroy_Policy command (
+ impl);
+
+ TAO::Upcall_Wrapper upcall_wrapper;
+ upcall_wrapper.upcall (server_request
+ , args
+ , nargs
+ , command
+#if TAO_HAS_INTERCEPTORS == 1
+ , servant_upcall
+ , exceptions
+ , nexceptions
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/interface_ss.cpp:169
+
+namespace POA_CORBA
+{
+
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/upcall_command_ss.cpp:127
+
+ class _is_a_Policy_Upcall_Command
+ : public TAO::Upcall_Command
+ {
+ public:
+ inline _is_a_Policy_Upcall_Command (
+ POA_CORBA::Policy * servant,
+ TAO_Operation_Details const * operation_details,
+ TAO::Argument * const args[])
+ : servant_ (servant)
+ , operation_details_ (operation_details)
+ , args_ (args)
+ {
+ }
+
+ virtual void execute (ACE_ENV_SINGLE_ARG_DECL)
+ {
+ TAO::SArg_Traits< ::ACE_InputCDR::to_boolean>::ret_arg_type retval =
+ TAO::Portable_Server::get_ret_arg< ::ACE_InputCDR::to_boolean> (
+ this->operation_details_,
+ this->args_);
+
+ TAO::SArg_Traits< CORBA::Char *>::in_arg_type arg_1 =
+ TAO::Portable_Server::get_in_arg< CORBA::Char *> (
+ this->operation_details_,
+ this->args_,
+ 1);
+
+
+ retval =
+ this->servant_-> _is_a (
+ arg_1
+ ACE_ENV_ARG_PARAMETER);
+
+ }
+
+ private:
+ POA_CORBA::Policy * const servant_;
+ TAO_Operation_Details const * const operation_details_;
+ TAO::Argument * const * const args_;
+ };
+
+}
+void POA_CORBA::Policy::_is_a_skel (
+ TAO_ServerRequest & server_request,
+ void * TAO_INTERCEPTOR (servant_upcall),
+ void * servant
+ ACE_ENV_ARG_DECL
+ )
+{
+
+
+#if TAO_HAS_INTERCEPTORS == 1
+ static CORBA::TypeCode_ptr const * const exceptions = 0;
+ static CORBA::ULong const nexceptions = 0;
+#endif /* TAO_HAS_INTERCEPTORS */
+
+ TAO::SArg_Traits< ::ACE_InputCDR::to_boolean>::ret_val retval;
+ TAO::SArg_Traits< CORBA::Char *>::in_arg_val _tao_repository_id;
+
+ TAO::Argument * const args[] =
+ {
+ &retval,
+ &_tao_repository_id
+ };
+
+ static size_t const nargs = 2;
+
+ POA_CORBA::Policy * const impl =
+ static_cast<POA_CORBA::Policy *> (servant);
+
+ _is_a_Policy_Upcall_Command command (
+ impl,
+ server_request.operation_details (),
+ args);
+
+ TAO::Upcall_Wrapper upcall_wrapper;
+ upcall_wrapper.upcall (server_request
+ , args
+ , nargs
+ , command
+#if TAO_HAS_INTERCEPTORS == 1
+ , servant_upcall
+ , exceptions
+ , nexceptions
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+}
+
+namespace POA_CORBA
+{
+
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/upcall_command_ss.cpp:127
+
+ class _non_existent_Policy_Upcall_Command
+ : public TAO::Upcall_Command
+ {
+ public:
+ inline _non_existent_Policy_Upcall_Command (
+ POA_CORBA::Policy * servant,
+ TAO_Operation_Details const * operation_details,
+ TAO::Argument * const args[])
+ : servant_ (servant)
+ , operation_details_ (operation_details)
+ , args_ (args)
+ {
+ }
+
+ virtual void execute (ACE_ENV_SINGLE_ARG_DECL)
+ {
+ TAO::SArg_Traits< ::ACE_InputCDR::to_boolean>::ret_arg_type retval =
+ TAO::Portable_Server::get_ret_arg< ::ACE_InputCDR::to_boolean> (
+ this->operation_details_,
+ this->args_);
+
+
+ retval =
+ this->servant_-> _non_existent (
+ ACE_ENV_SINGLE_ARG_PARAMETER);
+
+ }
+
+ private:
+ POA_CORBA::Policy * const servant_;
+ TAO_Operation_Details const * const operation_details_;
+ TAO::Argument * const * const args_;
+ };
+
+}
+void POA_CORBA::Policy::_non_existent_skel (
+ TAO_ServerRequest & server_request,
+ void * TAO_INTERCEPTOR (servant_upcall),
+ void * servant
+ ACE_ENV_ARG_DECL
+ )
+{
+
+
+#if TAO_HAS_INTERCEPTORS == 1
+ static CORBA::TypeCode_ptr const * const exceptions = 0;
+ static CORBA::ULong const nexceptions = 0;
+#endif /* TAO_HAS_INTERCEPTORS */
+
+ TAO::SArg_Traits< ::ACE_InputCDR::to_boolean>::ret_val retval;
+
+ TAO::Argument * const args[] =
+ {
+ &retval
+ };
+
+ static size_t const nargs = 1;
+
+ POA_CORBA::Policy * const impl =
+ static_cast<POA_CORBA::Policy *> (servant);
+
+ _non_existent_Policy_Upcall_Command command (
+ impl,
+ server_request.operation_details (),
+ args);
+
+ TAO::Upcall_Wrapper upcall_wrapper;
+ upcall_wrapper.upcall (server_request
+ , args
+ , nargs
+ , command
+#if TAO_HAS_INTERCEPTORS == 1
+ , servant_upcall
+ , exceptions
+ , nexceptions
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+}
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/interface_ss.cpp:393
+
+
+
+void POA_CORBA::Policy::_interface_skel (
+ TAO_ServerRequest & server_request,
+ void * /* servant_upcall */,
+ void * servant
+ ACE_ENV_ARG_DECL
+ )
+{
+ TAO_IFR_Client_Adapter *_tao_adapter =
+ ACE_Dynamic_Service<TAO_IFR_Client_Adapter>::instance (
+ TAO_ORB_Core::ifr_client_adapter_name ()
+ );
+
+ if (_tao_adapter == 0)
+ {
+ ACE_THROW (CORBA::INTF_REPOS (CORBA::OMGVMCID | 1,
+ CORBA::COMPLETED_NO));
+ }
+
+ POA_CORBA::Policy * const impl =
+ static_cast<POA_CORBA::Policy *> (servant);
+ CORBA::InterfaceDef_ptr _tao_retval =
+ impl->_get_interface (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ server_request.init_reply ();
+ TAO_OutputCDR &_tao_out = *server_request.outgoing ();
+
+ CORBA::Boolean const _tao_result =
+ _tao_adapter->interfacedef_cdr_insert (
+ _tao_out,
+ _tao_retval
+ );
+
+ _tao_adapter->dispose (_tao_retval);
+
+ if (_tao_result == 0)
+ {
+ ACE_THROW (CORBA::MARSHAL ());
+ }
+}
+
+namespace POA_CORBA
+{
+
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/upcall_command_ss.cpp:127
+
+ class _get_component_Policy_Upcall_Command
+ : public TAO::Upcall_Command
+ {
+ public:
+ inline _get_component_Policy_Upcall_Command (
+ POA_CORBA::Policy * servant,
+ TAO_Operation_Details const * operation_details,
+ TAO::Argument * const args[])
+ : servant_ (servant)
+ , operation_details_ (operation_details)
+ , args_ (args)
+ {
+ }
+
+ virtual void execute (ACE_ENV_SINGLE_ARG_DECL)
+ {
+ TAO::SArg_Traits< ::CORBA::Object>::ret_arg_type retval =
+ TAO::Portable_Server::get_ret_arg< ::CORBA::Object> (
+ this->operation_details_,
+ this->args_);
+
+
+ retval =
+ this->servant_-> _get_component (
+ ACE_ENV_SINGLE_ARG_PARAMETER);
+
+ }
+
+ private:
+ POA_CORBA::Policy * const servant_;
+ TAO_Operation_Details const * const operation_details_;
+ TAO::Argument * const * const args_;
+ };
+
+}
+void POA_CORBA::Policy::_component_skel (
+ TAO_ServerRequest & server_request,
+ void * TAO_INTERCEPTOR (servant_upcall),
+ void * servant
+ ACE_ENV_ARG_DECL
+ )
+{
+
+
+#if TAO_HAS_INTERCEPTORS == 1
+ static CORBA::TypeCode_ptr const * const exceptions = 0;
+ static CORBA::ULong const nexceptions = 0;
+#endif /* TAO_HAS_INTERCEPTORS */
+
+ TAO::SArg_Traits< ::CORBA::Object>::ret_val retval;
+
+ TAO::Argument * const args[] =
+ {
+ &retval
+ };
+
+ static size_t const nargs = 1;
+
+ POA_CORBA::Policy * const impl =
+ static_cast<POA_CORBA::Policy *> (servant);
+
+ _get_component_Policy_Upcall_Command command (
+ impl,
+ server_request.operation_details (),
+ args);
+
+ TAO::Upcall_Wrapper upcall_wrapper;
+ upcall_wrapper.upcall (server_request
+ , args
+ , nargs
+ , command
+#if TAO_HAS_INTERCEPTORS == 1
+ , servant_upcall
+ , exceptions
+ , nexceptions
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+}
+
+CORBA::Boolean POA_CORBA::Policy::_is_a (
+ const char* value
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return
+ (
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/Policy:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/Object:1.0"
+ )
+ );
+}
+
+const char* POA_CORBA::Policy::_interface_repository_id (void) const
+{
+ return "IDL:omg.org/CORBA/Policy:1.0";
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/interface_ss.cpp:940
+
+void POA_CORBA::Policy::_dispatch (
+ TAO_ServerRequest & req,
+ void * servant_upcall
+ ACE_ENV_ARG_DECL
+ )
+{
+ this->synchronous_upcall_dispatch (req,
+ servant_upcall,
+ this
+ ACE_ENV_ARG_PARAMETER);
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/interface_ss.cpp:891
+
+CORBA::Policy *
+POA_CORBA::Policy::_this (ACE_ENV_SINGLE_ARG_DECL)
+{
+ TAO_Stub *stub = this->_create_stub (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ TAO_Stub_Auto_Ptr safe_stub (stub);
+ CORBA::Object_ptr tmp = CORBA::Object::_nil ();
+
+ CORBA::Boolean _tao_opt_colloc =
+ stub->servant_orb_var ()->orb_core ()->optimize_collocation_objects ();
+
+ ACE_NEW_RETURN (
+ tmp,
+ CORBA::Object (stub, _tao_opt_colloc, this),
+ 0
+ );
+
+ CORBA::Object_var obj = tmp;
+ (void) safe_stub.release ();
+
+ typedef ::CORBA::Policy STUB_SCOPED_NAME;
+ return
+ TAO::Narrow_Utils<STUB_SCOPED_NAME>::unchecked_narrow (
+ obj.in (),
+ CORBA__TAO_Policy_Proxy_Broker_Factory_function_pointer
+ );
+}
+
+#endif /* ifndef */
+
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/PolicyS.h b/TAO/tao/PortableServer/PolicyS.h
new file mode 100644
index 00000000000..91d1c44b232
--- /dev/null
+++ b/TAO/tao/PortableServer/PolicyS.h
@@ -0,0 +1,326 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:391
+
+#ifndef _TAO_IDL_ORIG_POLICYS_H_
+#define _TAO_IDL_ORIG_POLICYS_H_
+
+#include /**/ "ace/pre.h"
+
+#include "tao/PolicyC.h"
+#include "tao/UShortSeqS.h"
+#include "tao/CurrentS.h"
+#include "tao/Policy_ForwardS.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Collocation_Proxy_Broker.h"
+#include "tao/PortableServer/PortableServer.h"
+#include "tao/PortableServer/Servant_Base.h"
+
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+#if defined (__BORLANDC__)
+#pragma option push -w-rvl -w-rch -w-ccc -w-inl
+#endif /* __BORLANDC__ */
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if defined (TAO_EXPORT_MACRO)
+#undef TAO_EXPORT_MACRO
+#endif
+#define TAO_EXPORT_MACRO TAO_PortableServer_Export
+
+// TAO_IDL - Generated from
+// be\be_visitor_module/module_sh.cpp:49
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace POA_CORBA
+{
+
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_sh.cpp:87
+
+ class Policy;
+ typedef Policy *Policy_ptr;
+
+ class _TAO_Policy_Direct_Proxy_Impl;
+ class _TAO_Policy_Strategized_Proxy_Broker;
+
+ class TAO_PortableServer_Export Policy
+ : public virtual PortableServer::ServantBase
+ {
+ protected:
+ Policy (void);
+
+ public:
+ // Useful for template programming.
+ typedef ::CORBA::Policy _stub_type;
+ typedef ::CORBA::Policy_ptr _stub_ptr_type;
+ typedef ::CORBA::Policy_var _stub_var_type;
+
+ Policy (const Policy& rhs);
+ virtual ~Policy (void);
+
+ virtual CORBA::Boolean _is_a (
+ const char* logical_type_id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static void _is_a_skel (
+ TAO_ServerRequest & req,
+ void * servant_upcall,
+ void * servant
+ ACE_ENV_ARG_DECL
+ );
+
+ static void _non_existent_skel (
+ TAO_ServerRequest & req,
+ void * servant_upcall,
+ void * servant
+ ACE_ENV_ARG_DECL
+ );
+
+ static void _interface_skel (
+ TAO_ServerRequest & req,
+ void * servant_upcall,
+ void * servant
+ ACE_ENV_ARG_DECL
+ );
+
+ static void _component_skel (
+ TAO_ServerRequest & req,
+ void * servant_upcall,
+ void * servant
+ ACE_ENV_ARG_DECL
+ );
+
+ virtual void _dispatch (
+ TAO_ServerRequest & req,
+ void * servant_upcall
+ ACE_ENV_ARG_DECL
+ );
+
+ ::CORBA::Policy *_this (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ );
+
+ virtual const char* _interface_repository_id (void) const;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_sh.cpp:45
+
+ virtual CORBA::PolicyType policy_type (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ static void _get_policy_type_skel (
+ TAO_ServerRequest & server_request,
+ void * servant_upcall,
+ void * servant
+ ACE_ENV_ARG_DECL
+ );
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_sh.cpp:45
+
+ virtual ::CORBA::Policy_ptr copy (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ static void copy_skel (
+ TAO_ServerRequest & server_request,
+ void * servant_upcall,
+ void * servant
+ ACE_ENV_ARG_DECL
+ );
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_sh.cpp:45
+
+ virtual void destroy (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ static void destroy_skel (
+ TAO_ServerRequest & server_request,
+ void * servant_upcall,
+ void * servant
+ ACE_ENV_ARG_DECL
+ );
+ };
+
+ ///////////////////////////////////////////////////////////////////////
+ // Strategized Proxy Broker Declaration
+ //
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/strategized_proxy_broker_sh.cpp:36
+
+ class TAO_PortableServer_Export _TAO_Policy_Strategized_Proxy_Broker
+ : public virtual TAO::Collocation_Proxy_Broker
+ {
+ public:
+ _TAO_Policy_Strategized_Proxy_Broker (void);
+
+ virtual ~_TAO_Policy_Strategized_Proxy_Broker (void);
+
+ TAO::Collocation_Strategy
+ get_strategy (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ void
+ dispatch (
+ CORBA::Object_ptr obj,
+ CORBA::Object_out forward_obj,
+ TAO::Argument ** args,
+ int num_args,
+ const char * op,
+ size_t op_len,
+ TAO::Collocation_Strategy strategy
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::Exception));
+
+ static _TAO_Policy_Strategized_Proxy_Broker *
+ the_TAO_Policy_Strategized_Proxy_Broker (void);
+ };
+
+ //
+ // End Strategized Proxy Broker Declaration
+ ///////////////////////////////////////////////////////////////////////
+
+
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/direct_proxy_impl_sh.cpp:31
+
+ ///////////////////////////////////////////////////////////////////////
+ // Direct Impl. Declaration
+ //
+
+ class TAO_PortableServer_Export _TAO_Policy_Direct_Proxy_Impl
+ {
+ public:
+ _TAO_Policy_Direct_Proxy_Impl (void);
+
+ virtual ~_TAO_Policy_Direct_Proxy_Impl (void);
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/proxy_impl_xh.cpp:24
+
+ static void
+ _get_policy_type (
+ TAO_Abstract_ServantBase *servant,
+ TAO::Argument ** args,
+ int num_args
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/proxy_impl_xh.cpp:24
+
+ static void
+ copy (
+ TAO_Abstract_ServantBase *servant,
+ TAO::Argument ** args,
+ int num_args
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/proxy_impl_xh.cpp:24
+
+ static void
+ destroy (
+ TAO_Abstract_ServantBase *servant,
+ TAO::Argument ** args,
+ int num_args
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+ };
+
+ //
+ // Direct Proxy Impl. Declaration
+ ///////////////////////////////////////////////////////////////////////
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_module/module_sh.cpp:80
+
+} // module CORBA
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:995
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include "tao/PortableServer/PolicyS_T.h"
+
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#if defined (__BORLANDC__)
+#pragma option pop
+#endif /* __BORLANDC__ */
+
+#include /**/ "ace/post.h"
+#endif /* ifndef */
+
diff --git a/TAO/tao/PortableServer/PolicyS_T.cpp b/TAO/tao/PortableServer/PolicyS_T.cpp
new file mode 100644
index 00000000000..dfe7cbabbdd
--- /dev/null
+++ b/TAO/tao/PortableServer/PolicyS_T.cpp
@@ -0,0 +1,41 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:677
+
+#ifndef _TAO_IDL_ORIG_POLICYS_T_CPP_
+#define _TAO_IDL_ORIG_POLICYS_T_CPP_
+
+#include "tao/PortableServer/PolicyS_T.h"
+
+#if !defined (__ACE_INLINE__)
+#include "tao/PortableServer/PolicyS_T.inl"
+#endif /* !defined INLINE */
+
+
+#endif /* ifndef */
diff --git a/TAO/tao/PortableServer/PolicyS_T.h b/TAO/tao/PortableServer/PolicyS_T.h
new file mode 100644
index 00000000000..6bf094e5c33
--- /dev/null
+++ b/TAO/tao/PortableServer/PolicyS_T.h
@@ -0,0 +1,154 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:536
+
+#ifndef _TAO_IDL_ORIG_POLICYS_T_H_
+#define _TAO_IDL_ORIG_POLICYS_T_H_
+
+#include /**/ "ace/pre.h"
+
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// TAO_IDL - Generated from
+// be\be_visitor_root/root_sth.cpp:116
+
+namespace POA_CORBA
+{
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/tie_sh.cpp:87
+
+ // TIE class: Refer to CORBA v2.2, Section 20.34.4
+ template <class T>
+ class Policy_tie : public Policy
+ {
+ public:
+ Policy_tie (T &t);
+ // the T& ctor
+ Policy_tie (T &t, PortableServer::POA_ptr poa);
+ // ctor taking a POA
+ Policy_tie (T *tp, CORBA::Boolean release = true);
+ // ctor taking pointer and an ownership flag
+ Policy_tie (
+ T *tp,
+ PortableServer::POA_ptr poa,
+ CORBA::Boolean release = true
+ );
+ // ctor with T*, ownership flag and a POA
+ ~Policy_tie (void);
+ // dtor
+
+ // TIE specific functions
+ T *_tied_object (void);
+ // return the underlying object
+ void _tied_object (T &obj);
+ // set the underlying object
+ void _tied_object (T *obj, CORBA::Boolean release = true);
+ // set the underlying object and the ownership flag
+ CORBA::Boolean _is_owner (void);
+ // do we own it
+ void _is_owner (CORBA::Boolean b);
+ // set the ownership
+
+ // overridden ServantBase operations
+ PortableServer::POA_ptr _default_POA (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ );
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/tie_sh.cpp:60
+
+ CORBA::PolicyType policy_type (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/tie_sh.cpp:60
+
+ ::CORBA::Policy_ptr copy (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/tie_sh.cpp:60
+
+ void destroy (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ private:
+ T *ptr_;
+ PortableServer::POA_var poa_;
+ CORBA::Boolean rel_;
+
+ // copy and assignment are not allowed
+ Policy_tie (const Policy_tie &);
+ void operator= (const Policy_tie &);
+ };
+} // module CORBA
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:1096
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+#include "tao/PortableServer/PolicyS_T.inl"
+#endif /* defined INLINE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+#include "tao/PortableServer/PolicyS_T.cpp"
+#endif /* defined REQUIRED SOURCE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
+#pragma implementation ("PolicyS_T.cpp")
+#endif /* defined REQUIRED PRAGMA */
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#include /**/ "ace/post.h"
+#endif /* ifndef */
+
diff --git a/TAO/tao/PortableServer/PolicyS_T.inl b/TAO/tao/PortableServer/PolicyS_T.inl
new file mode 100644
index 00000000000..4bccdaee36d
--- /dev/null
+++ b/TAO/tao/PortableServer/PolicyS_T.inl
@@ -0,0 +1,172 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/tie_si.cpp:96
+
+template <class T> ACE_INLINE
+POA_CORBA::Policy_tie<T>::Policy_tie (T &t)
+ : ptr_ (&t),
+ poa_ (PortableServer::POA::_nil ()),
+ rel_ (0)
+{}
+
+template <class T> ACE_INLINE
+POA_CORBA::Policy_tie<T>::Policy_tie (T &t, PortableServer::POA_ptr poa)
+ : ptr_ (&t),
+ poa_ (PortableServer::POA::_duplicate (poa)),
+ rel_ (0)
+{}
+
+template <class T> ACE_INLINE
+POA_CORBA::Policy_tie<T>::Policy_tie (T *tp, CORBA::Boolean release)
+ : ptr_ (tp),
+ poa_ (PortableServer::POA::_nil ()),
+ rel_ (release)
+{}
+
+template <class T> ACE_INLINE
+POA_CORBA::Policy_tie<T>::Policy_tie (T *tp, PortableServer::POA_ptr poa, CORBA::Boolean release)
+ : ptr_ (tp),
+ poa_ (PortableServer::POA::_duplicate (poa)),
+ rel_ (release)
+{}
+
+template <class T> ACE_INLINE
+POA_CORBA::Policy_tie<T>::~Policy_tie (void)
+{
+ if (this->rel_)
+ {
+ delete this->ptr_;
+ }
+}
+
+template <class T> ACE_INLINE T *
+POA_CORBA::Policy_tie<T>::_tied_object (void)
+{
+ return this->ptr_;
+}
+
+template <class T> ACE_INLINE void
+POA_CORBA::Policy_tie<T>::_tied_object (T &obj)
+{
+ if (this->rel_)
+ {
+ delete this->ptr_;
+ }
+
+ this->ptr_ = &obj;
+ this->rel_ = 0;
+}
+
+template <class T> ACE_INLINE void
+POA_CORBA::Policy_tie<T>::_tied_object (T *obj, CORBA::Boolean release)
+{
+ if (this->rel_)
+ {
+ delete this->ptr_;
+ }
+
+ this->ptr_ = obj;
+ this->rel_ = release;
+}
+
+template <class T> ACE_INLINE CORBA::Boolean
+POA_CORBA::Policy_tie<T>::_is_owner (void)
+{
+ return this->rel_;
+}
+
+template <class T> ACE_INLINE void
+POA_CORBA::Policy_tie<T>::_is_owner (CORBA::Boolean b)
+{
+ this->rel_ = b;
+}
+
+template <class T> ACE_INLINE PortableServer::POA_ptr
+POA_CORBA::Policy_tie<T>::_default_POA (ACE_ENV_SINGLE_ARG_DECL)
+{
+ if (!CORBA::is_nil (this->poa_.in ()))
+ {
+ return PortableServer::POA::_duplicate (this->poa_.in ());
+ }
+
+ return this->Policy::_default_POA (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_operation/tie_si.cpp:68
+
+template <class T> ACE_INLINE
+CORBA::PolicyType POA_CORBA::Policy_tie<T>::policy_type (
+ ACE_ENV_SINGLE_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ return this->ptr_->policy_type (
+ ACE_ENV_SINGLE_ARG_PARAMETER
+ );
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_operation/tie_si.cpp:68
+
+template <class T> ACE_INLINE
+::CORBA::Policy_ptr POA_CORBA::Policy_tie<T>::copy (
+ ACE_ENV_SINGLE_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ return this->ptr_->copy (
+ ACE_ENV_SINGLE_ARG_PARAMETER
+ );
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_operation/tie_si.cpp:68
+
+template <class T> ACE_INLINE
+void POA_CORBA::Policy_tie<T>::destroy (
+ ACE_ENV_SINGLE_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ this->ptr_->destroy (
+ ACE_ENV_SINGLE_ARG_PARAMETER
+ );
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/Policy_Strategy.h b/TAO/tao/PortableServer/Policy_Strategy.h
new file mode 100644
index 00000000000..d0854a95849
--- /dev/null
+++ b/TAO/tao/PortableServer/Policy_Strategy.h
@@ -0,0 +1,50 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Policy_Strategy.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_POLICY_STRATEGY_H
+#define TAO_POLICY_STRATEGY_H
+#include /**/ "ace/pre.h"
+
+#include "tao/Environment.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/Service_Object.h"
+#include "ace/CORBA_macros.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Root_POA;
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ class Policy_Strategy
+ : public ACE_Service_Object
+ {
+ public:
+ virtual void strategy_init(TAO_Root_POA *poa ACE_ENV_ARG_DECL) = 0;
+
+ virtual void strategy_cleanup(ACE_ENV_SINGLE_ARG_DECL) = 0;
+
+ virtual ~Policy_Strategy (void) {};
+ };
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_POLICY_STRATEGY_H */
diff --git a/TAO/tao/PortableServer/PortableServer.cpp b/TAO/tao/PortableServer/PortableServer.cpp
new file mode 100644
index 00000000000..ea45384c804
--- /dev/null
+++ b/TAO/tao/PortableServer/PortableServer.cpp
@@ -0,0 +1,177 @@
+// $Id$
+#include "tao/PortableServer/PortableServer.h"
+#include "tao/PortableServer/Object_Adapter.h"
+#include "tao/PortableServer/Object_Adapter_Factory.h"
+#include "tao/PortableServer/POA_Current_Factory.h"
+
+#include "tao/PortableServer/ThreadStrategyFactoryImpl.h"
+#include "tao/PortableServer/LifespanStrategyFactoryImpl.h"
+#include "tao/PortableServer/IdAssignmentStrategyFactoryImpl.h"
+#include "tao/PortableServer/IdUniquenessStrategyFactoryImpl.h"
+#include "tao/PortableServer/ImplicitActivationStrategyFactoryImpl.h"
+#include "tao/PortableServer/RequestProcessingStrategyFactoryImpl.h"
+#include "tao/PortableServer/ServantRetentionStrategyFactoryImpl.h"
+
+#include "tao/PortableServer/ThreadStrategyORBControl.h"
+#include "tao/PortableServer/ThreadStrategySingle.h"
+#include "tao/PortableServer/ThreadStrategySingleFactoryImpl.h"
+
+#include "tao/PortableServer/IdAssignmentStrategySystem.h"
+#include "tao/PortableServer/IdAssignmentStrategyUser.h"
+
+#include "tao/PortableServer/IdUniquenessStrategyMultiple.h"
+#include "tao/PortableServer/IdUniquenessStrategyUnique.h"
+
+#include "tao/PortableServer/ImplicitActivationStrategyExplicit.h"
+#include "tao/PortableServer/ImplicitActivationStrategyImplicit.h"
+
+#include "tao/PortableServer/RequestProcessingStrategyAOMOnly.h"
+#include "tao/PortableServer/RequestProcessingStrategyDefaultServant.h"
+#include "tao/PortableServer/RequestProcessingStrategyServantManager.h"
+
+#include "tao/PortableServer/ServantRetentionStrategyNonRetainFactoryImpl.h"
+#include "tao/PortableServer/ServantRetentionStrategyRetainFactoryImpl.h"
+
+#include "tao/PortableServer/RequestProcessingStrategyDefaultServantFI.h"
+#include "tao/PortableServer/RequestProcessingStrategyAOMOnlyFactoryImpl.h"
+#include "tao/PortableServer/RequestProcessingStrategyServantActivatorFI.h"
+#include "tao/PortableServer/RequestProcessingStrategyServantLocatorFI.h"
+
+#include "tao/PortableServer/IdUniquenessStrategyUniqueFactoryImpl.h"
+
+#include "tao/PortableServer/LifespanStrategyPersistentFactoryImpl.h"
+#include "tao/PortableServer/LifespanStrategyTransientFactoryImpl.h"
+
+ACE_RCSID (PortableServer,
+ PortableServer,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+int
+TAO_POA_Initializer::init (void)
+{
+ ACE_Service_Config::process_directive (
+ ace_svc_desc_IdAssignmentStrategySystem
+ );
+
+ ACE_Service_Config::process_directive (
+ ace_svc_desc_IdAssignmentStrategyUser
+ );
+
+ ACE_Service_Config::process_directive (
+ ace_svc_desc_IdUniquenessStrategyMultiple
+ );
+
+ ACE_Service_Config::process_directive (
+ ace_svc_desc_IdUniquenessStrategyUnique
+ );
+
+ ACE_Service_Config::process_directive (
+ ace_svc_desc_IdUniquenessStrategyUniqueFactoryImpl
+ );
+
+ ACE_Service_Config::process_directive (
+ ace_svc_desc_ImplicitActivationStrategyExplicit
+ );
+
+ ACE_Service_Config::process_directive (
+ ace_svc_desc_ImplicitActivationStrategyImplicit
+ );
+
+ // Strategy factories
+
+ ACE_Service_Config::process_directive (
+ ace_svc_desc_ThreadStrategyFactoryImpl
+ );
+
+#if (TAO_HAS_MINIMUM_POA == 0)
+ ACE_Service_Config::process_directive (
+ ace_svc_desc_ThreadStrategySingleFactoryImpl
+ );
+#endif /* TAO_HAS_MINIMUM_POA == 0 */
+
+ ACE_Service_Config::process_directive (
+ ace_svc_desc_LifespanStrategyFactoryImpl
+ );
+
+ ACE_Service_Config::process_directive (
+ ace_svc_desc_LifespanStrategyPersistentFactoryImpl
+ );
+
+ ACE_Service_Config::process_directive (
+ ace_svc_desc_LifespanStrategyTransientFactoryImpl
+ );
+
+ ACE_Service_Config::process_directive (
+ ace_svc_desc_IdAssignmentStrategyFactoryImpl
+ );
+
+ ACE_Service_Config::process_directive (
+ ace_svc_desc_IdUniquenessStrategyFactoryImpl
+ );
+
+ ACE_Service_Config::process_directive (
+ ace_svc_desc_ImplicitActivationStrategyFactoryImpl
+ );
+
+ ACE_Service_Config::process_directive (
+ ace_svc_desc_RequestProcessingStrategyFactoryImpl
+ );
+
+ ACE_Service_Config::process_directive (
+ ace_svc_desc_RequestProcessingStrategyAOMOnlyFactoryImpl
+ );
+
+#if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
+ ACE_Service_Config::process_directive (
+ ace_svc_desc_RequestProcessingStrategyDefaultServantFactoryImpl
+ );
+
+ ACE_Service_Config::process_directive (
+ ace_svc_desc_RequestProcessingStrategyServantActivatorFactoryImpl
+ );
+
+ ACE_Service_Config::process_directive (
+ ace_svc_desc_RequestProcessingStrategyServantLocatorFactoryImpl
+ );
+#endif /* TAO_HAS_MINIMUM_POA == 0 */
+
+ ACE_Service_Config::process_directive (
+ ace_svc_desc_ServantRetentionStrategyFactoryImpl
+ );
+
+ ACE_Service_Config::process_directive (
+ ace_svc_desc_ServantRetentionStrategyRetainFactoryImpl
+ );
+
+#if (TAO_HAS_MINIMUM_POA == 0)
+ ACE_Service_Config::process_directive (
+ ace_svc_desc_ServantRetentionStrategyNonRetainFactoryImpl
+ );
+#endif /* TAO_HAS_MINIMUM_POA == 0 */
+
+ // Strategy implementations
+
+ ACE_Service_Config::process_directive (
+ ace_svc_desc_ThreadStrategyORBControl
+ );
+
+#if (TAO_HAS_MINIMUM_POA == 0)
+ ACE_Service_Config::process_directive (
+ ace_svc_desc_ThreadStrategySingle
+ );
+#endif /* TAO_HAS_MINIMUM_POA == 0 */
+
+ ACE_Service_Config::process_directive (
+ ace_svc_desc_TAO_POA_Current_Factory
+ );
+
+ return
+ ACE_Service_Config::process_directive (
+ ace_svc_desc_TAO_Object_Adapter_Factory
+ );
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/PortableServer.h b/TAO/tao/PortableServer/PortableServer.h
new file mode 100644
index 00000000000..256499a7456
--- /dev/null
+++ b/TAO/tao/PortableServer/PortableServer.h
@@ -0,0 +1,59 @@
+/* -*- C++ -*- */
+
+//=============================================================================
+/**
+ * @file PortableServer.h
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan <coryan@uci.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_PORTABLESERVER_H
+#define TAO_PORTABLESERVER_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Versioned_Namespace.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_PortableServer_Export TAO_POA_Initializer
+{
+public:
+ /// Used to force the initialization of the ORB code.
+ static int init (void);
+};
+
+static int
+TAO_Requires_POA_Initializer = TAO_POA_Initializer::init ();
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#define TAO_PORTABLESERVER_SAFE_INCLUDE
+#include "tao/PortableServer/PortableServerC.h"
+#undef TAO_PORTABLESERVER_SAFE_INCLUDE
+#include "tao/PortableServer/POAManagerC.h"
+#include "tao/PortableServer/POAManagerFactoryC.h"
+#include "tao/PortableServer/PS_CurrentC.h"
+#include "tao/PortableServer/PortableServer_Functions.h"
+#include "tao/PortableServer/PortableServer_WFunctions.h"
+#include "tao/PortableServer/PS_ForwardA.h"
+#include "tao/PortableServer/IdUniquenessPolicyA.h"
+#include "tao/PortableServer/ImplicitActivationPolicyA.h"
+#include "tao/PortableServer/RequestProcessingPolicyA.h"
+#include "tao/PortableServer/ServantRetentionPolicyA.h"
+#include "tao/PortableServer/ThreadPolicyA.h"
+#include "tao/PortableServer/IdAssignmentPolicyA.h"
+#include "tao/PortableServer/LifespanPolicyA.h"
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_PORTABLESERVER_H */
diff --git a/TAO/tao/PortableServer/PortableServer.pidl b/TAO/tao/PortableServer/PortableServer.pidl
new file mode 100644
index 00000000000..14a8e4afdfc
--- /dev/null
+++ b/TAO/tao/PortableServer/PortableServer.pidl
@@ -0,0 +1,50 @@
+/**
+ * @file PortableServer.pidl
+ *
+ * $Id$
+ *
+ * @brief Pre-compiled IDL source for the PortableServer module.
+ *
+ * This file was used to generate the code in
+ * PortableServerC.{h,inl,cpp}, using the following command:
+ *
+ * tao_idl.exe \
+ * -o orig -Sci -Gp -Gd -Ge 1 -GA -I$(TAO_ROOT)
+ * -Wb,export_macro=TAO_PortableServer_Export \
+ * -Wb,export_include="portableserver_export.h" \
+ * -Wb,pre_include="ace/pre.h" \
+ * -Wb,post_include="ace/post.h" \
+ * PortableServer.pidl
+ *
+ * After the file is generated a patch from the diffs directory must
+ * be applied. The patch:
+ *
+ * - Disables parts of the code under certain configurations.
+ *
+ * - Eliminates cycles in the include dependencies.
+ *
+ * - Adds non-idl components of PortableServer to the namespace.
+ * This includes (a) Servant (b) ServantBase (c) RefCountServantBase
+ * (d) Cookie (e) ObjectId_to_string (f) string_to_ObjectId (g)
+ * ObjectId_to_wstring (h) wstring_to_ObjectId (i) ServantBase_var
+ * (j) DynamicImplementation (k) LocalServantBase
+ *
+ * Apply patches using the following command:
+ *
+ * patch < diffs/PortableServer.diff
+ *
+ * Note: The diffs were generated using:
+ *
+ * rm diffs/PortableServer.diff
+ * for i in PortableServerC.{h,i,cpp}; do
+ * diff -wub orig/$i $i >> diffs/PortableServer.diff
+ * done
+ */
+
+#ifndef _PORTABLE_SERVER_IDL_
+#define _PORTABLE_SERVER_IDL_
+
+///FUZZ: disable check_for_include/
+#include "tao/PortableServer/POA.pidl"
+
+#endif // _POA_SERVER_IDL_
diff --git a/TAO/tao/PortableServer/PortableServerA.h b/TAO/tao/PortableServer/PortableServerA.h
new file mode 100644
index 00000000000..e543e41332e
--- /dev/null
+++ b/TAO/tao/PortableServer/PortableServerA.h
@@ -0,0 +1,3 @@
+// $Id$
+// This file deliberately empty. See bugzilla #2549.
+
diff --git a/TAO/tao/PortableServer/PortableServerC.cpp b/TAO/tao/PortableServer/PortableServerC.cpp
new file mode 100644
index 00000000000..0f3e5f7d0f5
--- /dev/null
+++ b/TAO/tao/PortableServer/PortableServerC.cpp
@@ -0,0 +1,53 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:282
+
+
+#include "PortableServer.h"
+#include "tao/AnyTypeCode/Null_RefCount_Policy.h"
+#include "tao/AnyTypeCode/TypeCode_Constants.h"
+#include "tao/AnyTypeCode/Alias_TypeCode_Static.h"
+#include "tao/AnyTypeCode/String_TypeCode_Static.h"
+#include "tao/CDR.h"
+
+// TAO_IDL - Generated from
+// be\be_visitor_arg_traits.cpp:71
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+
+
+// Arg traits specializations.
+namespace TAO
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+
+
diff --git a/TAO/tao/PortableServer/PortableServerC.h b/TAO/tao/PortableServer/PortableServerC.h
new file mode 100644
index 00000000000..6c461a182f1
--- /dev/null
+++ b/TAO/tao/PortableServer/PortableServerC.h
@@ -0,0 +1,81 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:154
+
+#ifndef _TAO_IDL_PORTABLESERVER_PORTABLESERVERC_H_
+#define _TAO_IDL_PORTABLESERVER_PORTABLESERVERC_H_
+
+#include /**/ "ace/pre.h"
+
+
+#include "ace/config-all.h"
+
+#ifndef TAO_PORTABLESERVER_SAFE_INCLUDE
+#error "You should not include PortableServerC.h directly, use PortableServer.h"
+#endif /* !TAO_PORTABLESERVER_SAFE_INCLUDE */
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/portableserver_export.h"
+#include "tao/AnyTypeCode/AnyTypeCode_methods.h"
+#include "tao/ORB.h"
+#include "tao/SystemException.h"
+#include "tao/Environment.h"
+#include "tao/Versioned_Namespace.h"
+
+#include "tao/PortableServer/POAC.h"
+
+#if defined (TAO_EXPORT_MACRO)
+#undef TAO_EXPORT_MACRO
+#endif
+#define TAO_EXPORT_MACRO TAO_PortableServer_Export
+
+// TAO_IDL - Generated from
+// be\be_visitor_traits.cpp:63
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+
+
+// Traits specializations.
+namespace TAO
+{
+}
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:1092
+#include /**/ "ace/post.h"
+
+#endif /* ifndef */
+
+
diff --git a/TAO/tao/PortableServer/PortableServerS.h b/TAO/tao/PortableServer/PortableServerS.h
new file mode 100644
index 00000000000..17b1360599e
--- /dev/null
+++ b/TAO/tao/PortableServer/PortableServerS.h
@@ -0,0 +1,28 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// Skeleton file generation suppressed with command line option -SS
diff --git a/TAO/tao/PortableServer/PortableServer_Functions.cpp b/TAO/tao/PortableServer/PortableServer_Functions.cpp
new file mode 100644
index 00000000000..ac70be706c3
--- /dev/null
+++ b/TAO/tao/PortableServer/PortableServer_Functions.cpp
@@ -0,0 +1,60 @@
+#include "tao/PortableServer/PortableServer_Functions.h"
+
+ACE_RCSID (PortableServer,
+ PortableServer_Functions,
+ "$Id$")
+
+#include "ace/OS_NS_string.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace PortableServer
+{
+ PortableServer::ObjectId *
+ string_to_ObjectId (const char *string)
+ {
+ // Size of string
+ //
+ // We DO NOT include the zero terminator, as this is simply an
+ // artifact of the way strings are stored in C.
+ //
+ CORBA::ULong buffer_size = static_cast <CORBA::ULong>
+ (ACE_OS::strlen (string));
+
+ // Create the buffer for the Id
+ CORBA::Octet *buffer = PortableServer::ObjectId::allocbuf (buffer_size);
+
+ // Copy the contents
+ ACE_OS::memcpy (buffer, string, buffer_size);
+
+ // Create and return a new ID
+ PortableServer::ObjectId *id = 0;
+ ACE_NEW_RETURN (id,
+ PortableServer::ObjectId (buffer_size,
+ buffer_size,
+ buffer,
+ 1),
+ 0);
+
+ return id;
+ }
+
+ char *
+ ObjectId_to_string (const PortableServer::ObjectId &id)
+ {
+ // Create space
+ char * string = CORBA::string_alloc (id.length ());
+
+ // Copy the data
+ ACE_OS::memcpy (string, id.get_buffer (), id.length ());
+
+ // Null terminate the string
+ string[id.length ()] = '\0';
+
+ // Return string
+ return string;
+ }
+}
+
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/PortableServer_Functions.h b/TAO/tao/PortableServer/PortableServer_Functions.h
new file mode 100644
index 00000000000..e14222ac6b9
--- /dev/null
+++ b/TAO/tao/PortableServer/PortableServer_Functions.h
@@ -0,0 +1,59 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file PortableServer_Functions.h
+ *
+ * $Id$
+ *
+ * PortableServer helper functions
+ *
+ * @author Irfan Pyarali <irfan@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_PORTABLESERVER_FUNCTIONS_H
+#define TAO_PORTABLESERVER_FUNCTIONS_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/orbconf.h"
+
+#if defined (TAO_EXPORT_MACRO)
+#undef TAO_EXPORT_MACRO
+#endif
+#define TAO_EXPORT_MACRO TAO_PortableServer_Export
+
+#if defined (TAO_EXPORT_NESTED_CLASSES)
+# if defined (TAO_EXPORT_NESTED_MACRO)
+# undef TAO_EXPORT_NESTED_MACRO
+# endif /* defined (TAO_EXPORT_NESTED_MACRO) */
+# define TAO_EXPORT_NESTED_MACRO TAO_PortableServer_Export
+#endif /* TAO_EXPORT_NESTED_CLASSES */
+
+#include "tao/PortableServer/PS_ForwardC.h"
+#include "ace/OS_NS_wchar.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace PortableServer
+{
+ /// Utility functions for the other
+ TAO_NAMESPACE_STORAGE_CLASS char* ObjectId_to_string (
+ const PortableServer::ObjectId &id);
+
+ TAO_NAMESPACE_STORAGE_CLASS PortableServer::ObjectId *string_to_ObjectId (
+ const char *id);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_PORTABLESERVER_FUNCTIONS_H */
diff --git a/TAO/tao/PortableServer/PortableServer_WFunctions.cpp b/TAO/tao/PortableServer/PortableServer_WFunctions.cpp
new file mode 100644
index 00000000000..d980f303b74
--- /dev/null
+++ b/TAO/tao/PortableServer/PortableServer_WFunctions.cpp
@@ -0,0 +1,71 @@
+#include "tao/PortableServer/PortableServer_WFunctions.h"
+
+ACE_RCSID (PortableServer,
+ PortableServer_WFunctions,
+ "$Id$")
+
+#include "ace/OS_NS_string.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace PortableServer
+{
+ PortableServer::ObjectId *
+ wstring_to_ObjectId (const CORBA::WChar *string)
+ {
+ // Size of Id
+ //
+ // We DO NOT include the zero terminator, as this is simply an
+ // artifact of the way strings are stored in C.
+ //
+ u_int string_length = ACE_OS::wslen (string);
+
+ CORBA::ULong buffer_size = string_length * sizeof (CORBA::WChar);
+
+ // Create the buffer for the Id
+ CORBA::Octet *buffer = PortableServer::ObjectId::allocbuf (buffer_size);
+
+ // Copy contents
+ ACE_OS::memcpy (buffer, string, buffer_size);
+
+ // Create a new ID
+ PortableServer::ObjectId *id = 0;
+ ACE_NEW_RETURN (id,
+ PortableServer::ObjectId (buffer_size,
+ buffer_size,
+ buffer,
+ 1),
+ 0);
+
+ return id;
+ }
+
+ CORBA::WChar *
+ ObjectId_to_wstring (const PortableServer::ObjectId &id)
+ {
+ // Compute resulting wide string's length.
+ CORBA::ULong string_length =
+ id.length () / sizeof (CORBA::WChar);
+
+ // Allocate an extra slot if the id's length is not "aligned" on a
+ // CORBA::WChar.
+ if (id.length () % sizeof (CORBA::WChar))
+ string_length++;
+
+ // Create space - note that this method adds + 1 for the '\0'.
+ CORBA::WChar* string = CORBA::wstring_alloc (string_length);
+
+ // Copy the data
+ ACE_OS::memcpy (string,
+ id.get_buffer (),
+ id.length ());
+
+ // Null terminate the string
+ string[string_length] = '\0';
+
+ // Return string.
+ return string;
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/PortableServer_WFunctions.h b/TAO/tao/PortableServer/PortableServer_WFunctions.h
new file mode 100644
index 00000000000..2d6cdcbabb4
--- /dev/null
+++ b/TAO/tao/PortableServer/PortableServer_WFunctions.h
@@ -0,0 +1,58 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file PortableServer_WFunctions.h
+ *
+ * $Id$
+ *
+ * PortableServer helper functions
+ *
+ * @author Irfan Pyarali <irfan@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_PORTABLESERVER_WFUNCTIONS_H
+#define TAO_PORTABLESERVER_WFUNCTIONS_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/orbconf.h"
+
+#if defined (TAO_EXPORT_MACRO)
+#undef TAO_EXPORT_MACRO
+#endif
+#define TAO_EXPORT_MACRO TAO_PortableServer_Export
+
+#if defined (TAO_EXPORT_NESTED_CLASSES)
+# if defined (TAO_EXPORT_NESTED_MACRO)
+# undef TAO_EXPORT_NESTED_MACRO
+# endif /* defined (TAO_EXPORT_NESTED_MACRO) */
+# define TAO_EXPORT_NESTED_MACRO TAO_PortableServer_Export
+#endif /* TAO_EXPORT_NESTED_CLASSES */
+
+#include "tao/PortableServer/PS_ForwardC.h"
+#include "ace/OS_NS_wchar.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace PortableServer
+{
+ TAO_NAMESPACE_STORAGE_CLASS CORBA::WChar* ObjectId_to_wstring (
+ const PortableServer::ObjectId &id);
+
+ TAO_NAMESPACE_STORAGE_CLASS PortableServer::ObjectId *wstring_to_ObjectId (
+ const CORBA::WChar *id);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_PORTABLESERVER_WFUNCTIONS_H */
diff --git a/TAO/tao/PortableServer/PortableServer_include.pidl b/TAO/tao/PortableServer/PortableServer_include.pidl
new file mode 100644
index 00000000000..95d7690fc8d
--- /dev/null
+++ b/TAO/tao/PortableServer/PortableServer_include.pidl
@@ -0,0 +1,40 @@
+/**
+ * @file PortableServer_include.pidl
+ *
+ * $Id$
+ *
+ * @brief Include file for use in applications that need PortableServer.pidl.
+ *
+ * This file just includes PortableServer.pidl. The *C.h file generated from
+ * this is hand-crafted to itself include PortableServer.h instead of
+ * PortableServerC.h (which will produce a compiler error message if
+ * included directly). The PortableServer_includeC.h file can then be
+ * included directly and automatically by the IDL compiler when
+ * building the application.
+ *
+ * 1. Run the tao_idl compiler on the pidl file. The command used for
+ * this is:
+ *
+ * tao_idl -o orig -St -Sp -Sci -SS
+ * -Wb,export_macro=TAO_PortableServer_Export \
+ * -Wb,export_include="portableserver_export.h" \
+ * -Wb,pre_include="ace/pre.h"
+ * -Wb,post_include="ace/post.h"
+ * PortableServer_include.pidl
+ *
+ * 2. Then change this line in PortableServer_includeC.h:
+ *
+ * #include "PortableServerC.h"
+ *
+ * to
+ *
+ * #include "PortableServer.h"
+ */
+
+#ifndef _PORTABLESERVER_INCLUDE_IDL_
+#define _PORTABLESERVER_INCLUDE_IDL_
+
+///FUZZ: disable check_for_include/
+#include "tao/PortableServer/PortableServer.pidl"
+
+#endif /* _PORTABLESERVER_INCLUDE_IDL_ */
diff --git a/TAO/tao/PortableServer/PortableServer_includeA.h b/TAO/tao/PortableServer/PortableServer_includeA.h
new file mode 100644
index 00000000000..2874993878d
--- /dev/null
+++ b/TAO/tao/PortableServer/PortableServer_includeA.h
@@ -0,0 +1,44 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:390
+
+#ifndef _TAO_IDL_ORIG_PORTABLESERVER_INCLUDEA_H_
+#define _TAO_IDL_ORIG_PORTABLESERVER_INCLUDEA_H_
+
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/PortableServer_includeC.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include /**/ "ace/post.h"
+#endif /* ifndef */
+
diff --git a/TAO/tao/PortableServer/PortableServer_includeC.h b/TAO/tao/PortableServer/PortableServer_includeC.h
new file mode 100644
index 00000000000..8f2a1503f6c
--- /dev/null
+++ b/TAO/tao/PortableServer/PortableServer_includeC.h
@@ -0,0 +1,74 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:154
+
+#ifndef _TAO_IDL_PORTABLESERVER_INCLUDEC_H_
+#define _TAO_IDL_PORTABLESERVER_INCLUDEC_H_
+
+#include /**/ "ace/pre.h"
+
+
+#include "ace/config-all.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/portableserver_export.h"
+#include "tao/ORB.h"
+#include "tao/SystemException.h"
+#include "tao/Environment.h"
+
+#include "tao/PortableServer/PortableServer.h"
+
+#if defined (TAO_EXPORT_MACRO)
+#undef TAO_EXPORT_MACRO
+#endif
+#define TAO_EXPORT_MACRO TAO_PortableServer_Export
+
+// TAO_IDL - Generated from
+// be\be_visitor_traits.cpp:61
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Traits specializations.
+namespace TAO
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:1028
+
+#include /**/ "ace/post.h"
+
+#endif /* ifndef */
+
+
diff --git a/TAO/tao/PortableServer/PortableServer_includeS.h b/TAO/tao/PortableServer/PortableServer_includeS.h
new file mode 100644
index 00000000000..17b1360599e
--- /dev/null
+++ b/TAO/tao/PortableServer/PortableServer_includeS.h
@@ -0,0 +1,28 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// Skeleton file generation suppressed with command line option -SS
diff --git a/TAO/tao/PortableServer/Regular_POA.cpp b/TAO/tao/PortableServer/Regular_POA.cpp
new file mode 100644
index 00000000000..08f4965c8e7
--- /dev/null
+++ b/TAO/tao/PortableServer/Regular_POA.cpp
@@ -0,0 +1,73 @@
+#include "tao/PortableServer/Regular_POA.h"
+
+ACE_RCSID (PortableServer,
+ POA,
+ "$Id$")
+
+//
+#if !defined (__ACE_INLINE__)
+# include "tao/PortableServer/Regular_POA.inl"
+#endif /* ! __ACE_INLINE__ */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Regular_POA::TAO_Regular_POA (const TAO_Root_POA::String &name,
+ PortableServer::POAManager_ptr poa_manager,
+ const TAO_POA_Policy_Set &policies,
+ TAO_Root_POA *parent,
+ ACE_Lock &lock,
+ TAO_SYNCH_MUTEX &thread_lock,
+ TAO_ORB_Core &orb_core,
+ TAO_Object_Adapter *object_adapter
+ ACE_ENV_ARG_DECL)
+ : TAO_Root_POA (name,
+ poa_manager,
+ policies,
+ parent,
+ lock,
+ thread_lock,
+ orb_core,
+ object_adapter
+ ACE_ENV_ARG_PARAMETER),
+ parent_ (parent)
+{
+}
+
+TAO_Regular_POA::~TAO_Regular_POA (void)
+{
+}
+
+void
+TAO_Regular_POA::remove_from_parent_i (ACE_ENV_SINGLE_ARG_DECL)
+{
+ // Remove POA from the parent
+ if (this->parent_ != 0)
+ {
+ int result = this->parent_->delete_child (this->name_);
+ if (result != 0)
+ {
+ ACE_THROW (CORBA::OBJ_ADAPTER ());
+ }
+ }
+}
+
+CORBA::Boolean
+TAO_Regular_POA::root (void) const
+{
+ return (parent_ == 0);
+}
+
+char
+TAO_Regular_POA::root_key_type (void)
+{
+ if (this->parent_ != 0)
+ {
+ return TAO_Root_POA::non_root_key_char ();
+ }
+ else
+ {
+ return TAO_Root_POA::root_key_type ();
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/Regular_POA.h b/TAO/tao/PortableServer/Regular_POA.h
new file mode 100644
index 00000000000..eddd7bf3205
--- /dev/null
+++ b/TAO/tao/PortableServer/Regular_POA.h
@@ -0,0 +1,79 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Regular_POA.h
+ *
+ * $Id$
+ *
+ * Header file for CORBA's ORB type.
+ *
+ * @author Irfan Pyarali <irfan@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_REGULAR_POA_H
+#define TAO_REGULAR_POA_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/Root_POA.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_Regular_POA
+ *
+ * @brief Implementation of the PortableServer::POA interface.
+ *
+ * Implementation of the PortableServer::POA interface.
+ */
+class TAO_PortableServer_Export TAO_Regular_POA
+ : public TAO_Root_POA
+{
+public:
+ TAO_Regular_POA (const String &name,
+ PortableServer::POAManager_ptr poa_manager,
+ const TAO_POA_Policy_Set &policies,
+ TAO_Root_POA *parent,
+ ACE_Lock &lock,
+ TAO_SYNCH_MUTEX &thread_lock,
+ TAO_ORB_Core &orb_core,
+ TAO_Object_Adapter *object_adapter
+ ACE_ENV_ARG_DECL);
+
+ virtual ~TAO_Regular_POA (void);
+
+ PortableServer::POA_ptr the_parent (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+protected:
+ virtual void remove_from_parent_i (ACE_ENV_SINGLE_ARG_DECL);
+
+ virtual CORBA::Boolean root (void) const;
+
+ virtual char root_key_type (void);
+
+ /// The parent of this POA, be aware that in case this pointer is nill,
+ /// we are a parent. This can be achieved by deriving from this Regular_POA
+ /// and pass a nill pointer as parent with the constructor.
+ TAO_Root_POA *parent_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+// ****************************************************************
+
+#if defined (__ACE_INLINE__)
+# include "tao/PortableServer/Regular_POA.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_REGULAR_POA_H */
diff --git a/TAO/tao/PortableServer/Regular_POA.inl b/TAO/tao/PortableServer/Regular_POA.inl
new file mode 100644
index 00000000000..04b4b4b091b
--- /dev/null
+++ b/TAO/tao/PortableServer/Regular_POA.inl
@@ -0,0 +1,14 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE PortableServer::POA_ptr
+TAO_Regular_POA::the_parent (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return PortableServer::POA::_duplicate (this->parent_);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/RequestProcessingPolicy.cpp b/TAO/tao/PortableServer/RequestProcessingPolicy.cpp
new file mode 100644
index 00000000000..7b55a084199
--- /dev/null
+++ b/TAO/tao/PortableServer/RequestProcessingPolicy.cpp
@@ -0,0 +1,73 @@
+#include "tao/PortableServer/RequestProcessingPolicy.h"
+#include "tao/PortableServer/PortableServer.h"
+
+ACE_RCSID (PortableServer,
+ RequestProcessingPolicy,
+ "$Id$")
+
+#if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ RequestProcessingPolicy::RequestProcessingPolicy (
+ ::PortableServer::RequestProcessingPolicyValue value) :
+ value_ (value)
+ {
+ }
+
+ CORBA::Policy_ptr
+ RequestProcessingPolicy::copy (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ RequestProcessingPolicy *copy = 0;
+ ACE_NEW_THROW_EX (copy,
+ RequestProcessingPolicy (this->value_),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+
+ return copy;
+ }
+
+ void
+ RequestProcessingPolicy::destroy (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ }
+
+ ::PortableServer::RequestProcessingPolicyValue
+ RequestProcessingPolicy::value (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ return value_;
+ }
+
+ CORBA::PolicyType
+ RequestProcessingPolicy::policy_type (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ return ::PortableServer::REQUEST_PROCESSING_POLICY_ID;
+ }
+
+ TAO_Cached_Policy_Type
+ RequestProcessingPolicy::_tao_cached_type (void) const
+ {
+ return TAO_CACHED_POLICY_REQUEST_PROCESSING;
+ }
+
+ TAO_Policy_Scope
+ RequestProcessingPolicy::_tao_scope (void) const
+ {
+ return TAO_POLICY_POA_SCOPE;
+ }
+
+
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_MINIMUM_POA == 0 */
diff --git a/TAO/tao/PortableServer/RequestProcessingPolicy.h b/TAO/tao/PortableServer/RequestProcessingPolicy.h
new file mode 100644
index 00000000000..34f850757f1
--- /dev/null
+++ b/TAO/tao/PortableServer/RequestProcessingPolicy.h
@@ -0,0 +1,81 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file RequestProcessingPolicy.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_PORTABLESERVER_REQUESTPROCESSINGPOLICY_H
+#define TAO_PORTABLESERVER_REQUESTPROCESSINGPOLICY_H
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/RequestProcessingPolicyC.h"
+#include "tao/LocalObject.h"
+
+// This is to remove "inherits via dominance" warnings from MSVC.
+// MSVC is being a little too paranoid.
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+#if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ class TAO_PortableServer_Export RequestProcessingPolicy :
+ public virtual ::PortableServer::RequestProcessingPolicy,
+ public virtual TAO_Local_RefCounted_Object
+ {
+ public:
+ RequestProcessingPolicy (::PortableServer::RequestProcessingPolicyValue value);
+
+ CORBA::Policy_ptr copy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ void destroy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ ::PortableServer::RequestProcessingPolicyValue value (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ CORBA::PolicyType policy_type (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Return the cached policy type for this policy.
+ virtual TAO_Cached_Policy_Type _tao_cached_type (void) const;
+
+ /// Returns the scope at which this policy can be applied. See orbconf.h.
+ virtual TAO_Policy_Scope _tao_scope (void) const;
+
+ private:
+ ::PortableServer::RequestProcessingPolicyValue value_;
+ };
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_MINIMUM_POA == 0 */
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_PORTABLESERVER_REQUESTPROCESSINGPOLICY_H */
diff --git a/TAO/tao/PortableServer/RequestProcessingPolicy.pidl b/TAO/tao/PortableServer/RequestProcessingPolicy.pidl
new file mode 100644
index 00000000000..a7d47f4747c
--- /dev/null
+++ b/TAO/tao/PortableServer/RequestProcessingPolicy.pidl
@@ -0,0 +1,46 @@
+/**
+ * @file RequestProcessingPolicy.pidl
+ *
+ * $Id$
+ *
+ * @brief Pre-compiled IDL source for the PortableServer module.
+ *
+ * tao_idl.exe \
+ * -o orig -Gp -Gd -Ge 1 -Sci -GA -I$(TAO_ROOT)
+ * -Wb,export_macro=TAO_PortableServer_Export \
+ * -Wb,export_include="portableserver_export.h" \
+ * -Wb,pre_include="ace/pre.h" \
+ * -Wb,post_include="ace/post.h" \
+ * RequestProcessingPolicy.pidl
+ */
+
+#ifndef _PORTABLESERVER_REQUESTPROCESSINGPOLICY_IDL_
+#define _PORTABLESERVER_REQUESTPROCESSINGPOLICY_IDL_
+
+#include "tao/Policy.pidl"
+
+#pragma prefix "omg.org"
+
+module PortableServer
+{
+# pragma version PortableServer 2.3
+
+ enum RequestProcessingPolicyValue
+ {
+ USE_ACTIVE_OBJECT_MAP_ONLY,
+ USE_DEFAULT_SERVANT,
+ USE_SERVANT_MANAGER
+ };
+
+#if !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO) && !defined (TAO_HAS_MINIMUM_POA)
+
+ local interface RequestProcessingPolicy : CORBA::Policy
+ {
+ readonly attribute RequestProcessingPolicyValue value;
+ };
+
+#endif
+
+};
+
+#endif // _PORTABLESERVER_REQUESTPROCESSINGPOLICY_IDL_
diff --git a/TAO/tao/PortableServer/RequestProcessingStrategy.cpp b/TAO/tao/PortableServer/RequestProcessingStrategy.cpp
new file mode 100644
index 00000000000..535faabda48
--- /dev/null
+++ b/TAO/tao/PortableServer/RequestProcessingStrategy.cpp
@@ -0,0 +1,61 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file RequestProcessingStrategy.cpp
+ *
+ * $Id$
+ */
+//=============================================================================
+
+#include "tao/PortableServer/RequestProcessingStrategy.h"
+
+ACE_RCSID (PortableServer,
+ RequestProcessingStrategy,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ RequestProcessingStrategy::RequestProcessingStrategy (void)
+ : poa_ (0)
+ {
+ }
+
+ void
+ RequestProcessingStrategy::strategy_init(
+ TAO_Root_POA *poa,
+ ::PortableServer::ServantRetentionPolicyValue sr_value
+ ACE_ENV_ARG_DECL_NOT_USED)
+ {
+ poa_ = poa;
+ sr_value_ = sr_value;
+ }
+
+ void
+ RequestProcessingStrategy::strategy_init(
+ TAO_Root_POA *poa
+ ACE_ENV_ARG_DECL_NOT_USED)
+ {
+ poa_ = poa;
+ }
+
+ void
+ RequestProcessingStrategy::strategy_cleanup(ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ {
+ poa_ = 0;
+ }
+
+ ::PortableServer::ServantRetentionPolicyValue
+ RequestProcessingStrategy::sr_type() const
+ {
+ return sr_value_;
+ }
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/RequestProcessingStrategy.h b/TAO/tao/PortableServer/RequestProcessingStrategy.h
new file mode 100644
index 00000000000..8c767103d0b
--- /dev/null
+++ b/TAO/tao/PortableServer/RequestProcessingStrategy.h
@@ -0,0 +1,145 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file RequestProcessingStrategy.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_REQUEST_PROCESSING_STRATEGY_H
+#define TAO_REQUEST_PROCESSING_STRATEGY_H
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/Policy_Strategy.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/PortableServer.h"
+#include "tao/PortableServer/Servant_Location.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace PortableServer
+{
+ class ServantManager;
+ typedef ServantManager *ServantManager_ptr;
+}
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ class Servant_Upcall;
+ class POA_Current_Impl;
+ }
+}
+
+class TAO_Root_POA;
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ class RequestProcessingStrategy
+ : public Policy_Strategy
+ {
+ public:
+ RequestProcessingStrategy (void);
+
+ virtual void strategy_init(
+ TAO_Root_POA *poa
+ ACE_ENV_ARG_DECL);
+
+ virtual void strategy_init(
+ TAO_Root_POA *poa,
+ ::PortableServer::ServantRetentionPolicyValue
+ ACE_ENV_ARG_DECL);
+
+ virtual void strategy_cleanup(ACE_ENV_SINGLE_ARG_DECL);
+
+#if (TAO_HAS_MINIMUM_POA == 0)
+
+ virtual PortableServer::ServantManager_ptr get_servant_manager (
+ ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongPolicy)) = 0;
+
+ virtual void set_servant_manager (
+ PortableServer::ServantManager_ptr imgr
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongPolicy)) = 0;
+
+ virtual void set_servant (PortableServer::Servant servant ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongPolicy)) = 0;
+
+#endif /* TAO_HAS_MINIMUM_POA == 0 */
+
+ virtual PortableServer::Servant get_servant (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongPolicy)) = 0;
+
+ virtual TAO_SERVANT_LOCATION locate_servant (
+ const PortableServer::ObjectId &system_id,
+ PortableServer::Servant &servant
+ ACE_ENV_ARG_DECL) = 0;
+
+ virtual PortableServer::Servant locate_servant (
+ const char *operation,
+ const PortableServer::ObjectId &system_id,
+ TAO::Portable_Server::Servant_Upcall &servant_upcall,
+ TAO::Portable_Server::POA_Current_Impl &poa_current_impl,
+ int &wait_occurred_restart_call
+ ACE_ENV_ARG_DECL) = 0;
+
+ virtual void cleanup_servant (
+ PortableServer::Servant servant,
+ const PortableServer::ObjectId &user_id
+ ACE_ENV_ARG_DECL) = 0;
+
+ virtual PortableServer::Servant system_id_to_servant (
+ const PortableServer::ObjectId &system_id
+ ACE_ENV_ARG_DECL) = 0;
+
+ virtual PortableServer::Servant id_to_servant (
+ const PortableServer::ObjectId &id
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ObjectNotActive,
+ PortableServer::POA::WrongPolicy)) = 0;
+
+ virtual void etherealize_objects (CORBA::Boolean etherealize_objects) = 0;
+
+ virtual PortableServer::ObjectId *servant_to_id (
+ PortableServer::Servant servant
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ServantNotActive,
+ PortableServer::POA::WrongPolicy)) = 0;
+
+ virtual void post_invoke_servant_cleanup(
+ const PortableServer::ObjectId &system_id,
+ const TAO::Portable_Server::Servant_Upcall &servant_upcall) = 0;
+
+ virtual ::PortableServer::RequestProcessingPolicyValue type() const = 0;
+
+ virtual ::PortableServer::ServantRetentionPolicyValue sr_type() const;
+
+ protected:
+ TAO_Root_POA* poa_;
+ ::PortableServer::ServantRetentionPolicyValue sr_value_;
+ };
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_REQUEST_PROCESSING_STRATEGY_H */
diff --git a/TAO/tao/PortableServer/RequestProcessingStrategyAOMOnly.cpp b/TAO/tao/PortableServer/RequestProcessingStrategyAOMOnly.cpp
new file mode 100644
index 00000000000..877f8033219
--- /dev/null
+++ b/TAO/tao/PortableServer/RequestProcessingStrategyAOMOnly.cpp
@@ -0,0 +1,185 @@
+// -*- C++ -*-
+
+#include "tao/ORB_Constants.h"
+#include "tao/PortableServer/RequestProcessingStrategyAOMOnly.h"
+#include "tao/PortableServer/ServantManagerC.h"
+#include "tao/PortableServer/Non_Servant_Upcall.h"
+#include "tao/PortableServer/Servant_Base.h"
+#include "tao/PortableServer/Root_POA.h"
+
+ACE_RCSID (PortableServer,
+ Request_Processing,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ RequestProcessingStrategyAOMOnly::RequestProcessingStrategyAOMOnly()
+ {
+ }
+
+#if (TAO_HAS_MINIMUM_POA == 0)
+
+ PortableServer::ServantManager_ptr
+ RequestProcessingStrategyAOMOnly::get_servant_manager (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongPolicy))
+ {
+ ACE_THROW_RETURN (PortableServer::POA::WrongPolicy (),
+ PortableServer::ServantManager::_nil ());
+ }
+
+ void
+ RequestProcessingStrategyAOMOnly::set_servant_manager (
+ PortableServer::ServantManager_ptr /*imgr*/
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongPolicy))
+ {
+ ACE_THROW (PortableServer::POA::WrongPolicy ());
+ }
+
+ void
+ RequestProcessingStrategyAOMOnly::set_servant (
+ PortableServer::Servant /*servant*/
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongPolicy))
+ {
+ ACE_THROW (PortableServer::POA::WrongPolicy ());
+ }
+
+#endif /* TAO_HAS_MINIMUM_POA == 0 */
+
+ PortableServer::Servant
+ RequestProcessingStrategyAOMOnly::get_servant (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongPolicy))
+ {
+ ACE_THROW_RETURN (PortableServer::POA::WrongPolicy (),
+ 0);
+ }
+
+ TAO_SERVANT_LOCATION
+ RequestProcessingStrategyAOMOnly::locate_servant (
+ const PortableServer::ObjectId & system_id,
+ PortableServer::Servant & servant
+ ACE_ENV_ARG_DECL)
+ {
+ return this->poa_->servant_present (system_id,
+ servant
+ ACE_ENV_ARG_PARAMETER);
+ }
+
+ PortableServer::Servant
+ RequestProcessingStrategyAOMOnly::locate_servant (
+ const char * /*operation*/,
+ const PortableServer::ObjectId &system_id,
+ TAO::Portable_Server::Servant_Upcall &servant_upcall,
+ TAO::Portable_Server::POA_Current_Impl &poa_current_impl,
+ int & /*wait_occurred_restart_call*/
+ ACE_ENV_ARG_DECL)
+ {
+ PortableServer::Servant servant = 0;
+
+ servant = this->poa_->find_servant (system_id,
+ servant_upcall,
+ poa_current_impl
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ if (servant == 0)
+ {
+ ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (CORBA::OMGVMCID | 2,
+ CORBA::COMPLETED_NO),
+ 0);
+ }
+
+ return servant;
+ }
+
+ PortableServer::Servant
+ RequestProcessingStrategyAOMOnly::system_id_to_servant (
+ const PortableServer::ObjectId &system_id
+ ACE_ENV_ARG_DECL)
+ {
+ return this->poa_->find_servant (system_id
+ ACE_ENV_ARG_PARAMETER);
+ }
+
+ PortableServer::Servant
+ RequestProcessingStrategyAOMOnly::id_to_servant (
+ const PortableServer::ObjectId &id
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ObjectNotActive,
+ PortableServer::POA::WrongPolicy))
+ {
+ return this->poa_->user_id_to_servant_i (id
+ ACE_ENV_ARG_PARAMETER);
+ }
+
+ void
+ RequestProcessingStrategyAOMOnly::cleanup_servant (
+ PortableServer::Servant servant,
+ const PortableServer::ObjectId &user_id
+ ACE_ENV_ARG_DECL)
+ {
+ if (servant)
+ {
+ // ATTENTION: Trick locking here, see class header for details
+ Non_Servant_Upcall non_servant_upcall (*this->poa_);
+ ACE_UNUSED_ARG (non_servant_upcall);
+
+ servant->_remove_ref (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ // This operation causes the association of the Object Id specified
+ // by the oid parameter and its servant to be removed from the
+ // Active Object Map.
+ int result = this->poa_->unbind_using_user_id (user_id);
+
+ if (result != 0)
+ {
+ ACE_THROW (CORBA::OBJ_ADAPTER ());
+ }
+ }
+
+ void
+ RequestProcessingStrategyAOMOnly::etherealize_objects (
+ CORBA::Boolean /*etherealize_objects*/)
+ {
+ }
+
+ PortableServer::ObjectId *
+ RequestProcessingStrategyAOMOnly::servant_to_id (
+ PortableServer::Servant servant
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ServantNotActive,
+ PortableServer::POA::WrongPolicy))
+ {
+ return this->poa_->servant_to_user_id (servant ACE_ENV_ARG_PARAMETER);
+ }
+
+ void
+ RequestProcessingStrategyAOMOnly::post_invoke_servant_cleanup(
+ const PortableServer::ObjectId &/*system_id*/,
+ const TAO::Portable_Server::Servant_Upcall &/*servant_upcall*/)
+ {
+ }
+
+ ::PortableServer::RequestProcessingPolicyValue
+ RequestProcessingStrategyAOMOnly::type() const
+ {
+ return ::PortableServer::USE_ACTIVE_OBJECT_MAP_ONLY;
+ }
+
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/RequestProcessingStrategyAOMOnly.h b/TAO/tao/PortableServer/RequestProcessingStrategyAOMOnly.h
new file mode 100644
index 00000000000..b8b1b493ad4
--- /dev/null
+++ b/TAO/tao/PortableServer/RequestProcessingStrategyAOMOnly.h
@@ -0,0 +1,121 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file RequestProcessingStrategyAOMOnly.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_REQUESTPROCESSINGSTRATEGYAOMONLY_H
+#define TAO_REQUESTPROCESSINGSTRATEGYAOMONLY_H
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/RequestProcessingStrategy.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/Servant_Location.h"
+#include "tao/PortableServer/PortableServer.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ /**
+ * @class RequestProcessingStrategyAOMOnly
+ *
+ * Request Processing Strategy which only uses the Active Object Map (AOM)
+ */
+ class RequestProcessingStrategyAOMOnly
+ : public RequestProcessingStrategy
+ {
+ public:
+ RequestProcessingStrategyAOMOnly (void);
+
+#if (TAO_HAS_MINIMUM_POA == 0)
+
+ PortableServer::ServantManager_ptr
+ get_servant_manager (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongPolicy));
+
+ void
+ set_servant_manager (PortableServer::ServantManager_ptr imgr
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongPolicy));
+
+ void
+ set_servant (PortableServer::Servant servant
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongPolicy));
+
+#endif /* TAO_HAS_MINIMUM_POA == 0 */
+
+ PortableServer::Servant
+ get_servant (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongPolicy));
+
+ virtual
+ TAO_SERVANT_LOCATION
+ locate_servant (const PortableServer::ObjectId &system_id,
+ PortableServer::Servant &servant
+ ACE_ENV_ARG_DECL);
+
+ virtual
+ PortableServer::Servant
+ locate_servant (const char *operation,
+ const PortableServer::ObjectId &system_id,
+ TAO::Portable_Server::Servant_Upcall &servant_upcall,
+ TAO::Portable_Server::POA_Current_Impl &poa_current_impl,
+ int &wait_occurred_restart_call
+ ACE_ENV_ARG_DECL);
+
+ virtual PortableServer::Servant system_id_to_servant (
+ const PortableServer::ObjectId &system_id
+ ACE_ENV_ARG_DECL);
+
+ virtual PortableServer::Servant id_to_servant (
+ const PortableServer::ObjectId &id
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ObjectNotActive,
+ PortableServer::POA::WrongPolicy));
+
+ virtual void cleanup_servant (
+ PortableServer::Servant servant,
+ const PortableServer::ObjectId &user_id
+ ACE_ENV_ARG_DECL);
+
+ virtual void etherealize_objects (CORBA::Boolean etherealize_objects);
+
+ virtual PortableServer::ObjectId *servant_to_id (
+ PortableServer::Servant servant
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ServantNotActive,
+ PortableServer::POA::WrongPolicy));
+
+ virtual void post_invoke_servant_cleanup(
+ const PortableServer::ObjectId &system_id,
+ const TAO::Portable_Server::Servant_Upcall &servant_upcall);
+
+ virtual ::PortableServer::RequestProcessingPolicyValue type() const;
+ };
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_REQUESTPROCESSINGSTRATEGYAOMONLY_H */
diff --git a/TAO/tao/PortableServer/RequestProcessingStrategyAOMOnlyFactoryImpl.cpp b/TAO/tao/PortableServer/RequestProcessingStrategyAOMOnlyFactoryImpl.cpp
new file mode 100644
index 00000000000..820605a1d42
--- /dev/null
+++ b/TAO/tao/PortableServer/RequestProcessingStrategyAOMOnlyFactoryImpl.cpp
@@ -0,0 +1,69 @@
+// $Id$
+
+#include "tao/PortableServer/RequestProcessingStrategyAOMOnlyFactoryImpl.h"
+#include "tao/PortableServer/RequestProcessingStrategy.h"
+#include "tao/PortableServer/RequestProcessingStrategyAOMOnly.h"
+#include "ace/Dynamic_Service.h"
+#include "ace/Log_Msg.h"
+
+ACE_RCSID (PortableServer,
+ RequestProcessingStrategyAOMOnlyFactoryImpl,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ RequestProcessingStrategy*
+ RequestProcessingStrategyAOMOnlyFactoryImpl::create (
+ ::PortableServer::RequestProcessingPolicyValue value,
+ ::PortableServer::ServantRetentionPolicyValue /*srvalue*/)
+ {
+ RequestProcessingStrategy* strategy = 0;
+
+ switch (value)
+ {
+ case ::PortableServer::USE_ACTIVE_OBJECT_MAP_ONLY :
+ {
+ ACE_NEW_RETURN (strategy, RequestProcessingStrategyAOMOnly, 0);
+ break;
+ }
+ default :
+ {
+ ACE_ERROR ((LM_ERROR, "Incorrect type in RequestProcessingStrategyAOMOnlyFactoryImpl"));
+ break;
+ }
+ }
+
+ return strategy;
+ }
+
+ void
+ RequestProcessingStrategyAOMOnlyFactoryImpl::destroy (
+ RequestProcessingStrategy *strategy
+ ACE_ENV_ARG_DECL)
+ {
+ strategy->strategy_cleanup (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ delete strategy;
+ }
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DEFINE (
+ RequestProcessingStrategyAOMOnlyFactoryImpl,
+ ACE_TEXT ("RequestProcessingStrategyAOMOnlyFactory"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (RequestProcessingStrategyAOMOnlyFactoryImpl),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0)
+
+ACE_FACTORY_NAMESPACE_DEFINE (
+ ACE_Local_Service,
+ RequestProcessingStrategyAOMOnlyFactoryImpl,
+ TAO::Portable_Server::RequestProcessingStrategyAOMOnlyFactoryImpl)
diff --git a/TAO/tao/PortableServer/RequestProcessingStrategyAOMOnlyFactoryImpl.h b/TAO/tao/PortableServer/RequestProcessingStrategyAOMOnlyFactoryImpl.h
new file mode 100644
index 00000000000..44a9df665af
--- /dev/null
+++ b/TAO/tao/PortableServer/RequestProcessingStrategyAOMOnlyFactoryImpl.h
@@ -0,0 +1,55 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file RequestProcessingStrategyAOMOnlyFactoryImpl.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_PORTABLESERVER_REQUESTPROCESSINGSTRATEGYAOMONLYFACTORYIMPL_H
+#define TAO_PORTABLESERVER_REQUESTPROCESSINGSTRATEGYAOMONLYFACTORYIMPL_H
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/Service_Config.h"
+#include "tao/PortableServer/RequestProcessingStrategyFactory.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ class TAO_PortableServer_Export RequestProcessingStrategyAOMOnlyFactoryImpl
+ : public RequestProcessingStrategyFactory
+ {
+ public:
+ /// Create a new servant retention strategy
+ virtual RequestProcessingStrategy* create (
+ ::PortableServer::RequestProcessingPolicyValue value,
+ ::PortableServer::ServantRetentionPolicyValue srvalue);
+
+ virtual void destroy (
+ RequestProcessingStrategy *strategy
+ ACE_ENV_ARG_DECL);
+ };
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE_EXPORT (TAO_PortableServer, RequestProcessingStrategyAOMOnlyFactoryImpl)
+ACE_FACTORY_DECLARE (TAO_PortableServer, RequestProcessingStrategyAOMOnlyFactoryImpl)
+
+
+#include /**/ "ace/post.h"
+#endif /* TAO_PORTABLESERVER_REQUESTPROCESSINGSTRATEGYAOMONLYFACTORYIMPL_H*/
diff --git a/TAO/tao/PortableServer/RequestProcessingStrategyDefaultServant.cpp b/TAO/tao/PortableServer/RequestProcessingStrategyDefaultServant.cpp
new file mode 100644
index 00000000000..63e873629e9
--- /dev/null
+++ b/TAO/tao/PortableServer/RequestProcessingStrategyDefaultServant.cpp
@@ -0,0 +1,288 @@
+// -*- C++ -*-
+
+#include "tao/ORB_Constants.h"
+#include "tao/TSS_Resources.h"
+#include "tao/PortableServer/RequestProcessingStrategyDefaultServant.h"
+#include "tao/PortableServer/Non_Servant_Upcall.h"
+#include "tao/PortableServer/Root_POA.h"
+#include "tao/PortableServer/ServantManagerC.h"
+#include "tao/PortableServer/Servant_Base.h"
+#include "tao/PortableServer/POA_Current_Impl.h"
+
+ACE_RCSID (PortableServer,
+ Request_Processing,
+ "$Id$")
+
+#if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ RequestProcessingStrategyDefaultServant::RequestProcessingStrategyDefaultServant (void)
+ : default_servant_ (0)
+ {
+ }
+
+ void
+ RequestProcessingStrategyDefaultServant::strategy_cleanup(
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ {
+ this->default_servant_ = 0;
+ }
+
+ PortableServer::ServantManager_ptr
+ RequestProcessingStrategyDefaultServant::get_servant_manager (
+ ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongPolicy))
+ {
+ ACE_THROW_RETURN (PortableServer::POA::WrongPolicy (),
+ PortableServer::ServantManager::_nil ());
+ }
+
+ void
+ RequestProcessingStrategyDefaultServant::set_servant_manager (
+ PortableServer::ServantManager_ptr /*imgr*/
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongPolicy))
+ {
+ ACE_THROW (PortableServer::POA::WrongPolicy ());
+ }
+
+ PortableServer::Servant
+ RequestProcessingStrategyDefaultServant::get_servant (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongPolicy))
+ {
+ // This operation returns the default servant associated with the
+ // POA.
+ return this->default_servant_.in ();
+ }
+
+ void
+ RequestProcessingStrategyDefaultServant::set_servant (
+ PortableServer::Servant servant
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongPolicy))
+ {
+ // This operation registers the specified servant with the POA as
+ // the default servant. This servant will be used for all requests
+ // for which no servant is found in the Active Object Map.
+ this->default_servant_ = servant;
+
+ // The implementation of set_servant will invoke _add_ref at least
+ // once on the Servant argument before returning. When the POA no
+ // longer needs the Servant, it will invoke _remove_ref on it the
+ // same number of times.
+ if (servant != 0)
+ {
+ // A recursive thread lock without using a recursive thread
+ // lock. Non_Servant_Upcall has a magic constructor and
+ // destructor. We unlock the Object_Adapter lock for the
+ // duration of the servant activator upcalls; reacquiring once
+ // the upcalls complete. Even though we are releasing the lock,
+ // other threads will not be able to make progress since
+ // <Object_Adapter::non_servant_upcall_in_progress_> has been
+ // set.
+ Non_Servant_Upcall non_servant_upcall (*this->poa_);
+ ACE_UNUSED_ARG (non_servant_upcall);
+
+ servant->_add_ref (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ }
+
+ TAO_SERVANT_LOCATION
+ RequestProcessingStrategyDefaultServant::locate_servant (
+ const PortableServer::ObjectId & system_id,
+ PortableServer::Servant & servant
+ ACE_ENV_ARG_DECL)
+ {
+ TAO_SERVANT_LOCATION location = TAO_SERVANT_NOT_FOUND;
+
+ location = this->poa_->servant_present (system_id,
+ servant
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO_SERVANT_NOT_FOUND);
+
+ if (location == TAO_SERVANT_NOT_FOUND)
+ {
+ if (this->default_servant_.in () != 0)
+ {
+ location = TAO_DEFAULT_SERVANT;
+ }
+ }
+
+ return location;
+ }
+
+ PortableServer::Servant
+ RequestProcessingStrategyDefaultServant::locate_servant (
+ const char * /*operation*/,
+ const PortableServer::ObjectId & system_id,
+ TAO::Portable_Server::Servant_Upcall &servant_upcall,
+ TAO::Portable_Server::POA_Current_Impl &poa_current_impl,
+ int & /*wait_occurred_restart_call*/
+ ACE_ENV_ARG_DECL)
+ {
+ PortableServer::Servant servant = 0;
+
+ servant = this->poa_->find_servant (system_id,
+ servant_upcall,
+ poa_current_impl
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ if (servant == 0)
+ {
+ // If the POA has the USE_DEFAULT_SERVANT policy, a default servant
+ // has been associated with the POA so the POA will invoke the
+ // appropriate method on that servant. If no servant has been
+ // associated with the POA, the POA raises the OBJ_ADAPTER system
+ // exception.
+ PortableServer::Servant default_servant = this->default_servant_.in ();
+ if (default_servant == 0)
+ {
+ ACE_THROW_RETURN (CORBA::OBJ_ADAPTER (CORBA::OMGVMCID | 3,
+ CORBA::COMPLETED_NO),
+ 0);
+ }
+ else
+ {
+ // Success
+ servant = default_servant;
+ }
+ }
+
+ return servant;
+ }
+
+ PortableServer::Servant
+ RequestProcessingStrategyDefaultServant::system_id_to_servant (
+ const PortableServer::ObjectId &system_id
+ ACE_ENV_ARG_DECL)
+ {
+ PortableServer::Servant servant = this->default_servant_.in ();
+
+ if (servant == 0)
+ {
+ servant = this->poa_->find_servant (system_id
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+ }
+
+ return servant;
+ }
+
+ PortableServer::Servant
+ RequestProcessingStrategyDefaultServant::id_to_servant (
+ const PortableServer::ObjectId & /*id*/
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ObjectNotActive,
+ PortableServer::POA::WrongPolicy))
+ {
+ PortableServer::Servant servant = this->default_servant_.in ();
+
+ if (servant == 0)
+ {
+ /*
+ * If using default servant request processing strategy but
+ * no default servant is available, we will raise the
+ * ObjectNotActive system exception.
+ */
+ ACE_THROW_RETURN (PortableServer::POA::ObjectNotActive (),
+ 0);
+ }
+
+ return servant;
+ }
+
+ void
+ RequestProcessingStrategyDefaultServant::cleanup_servant (
+ PortableServer::Servant servant,
+ const PortableServer::ObjectId &user_id
+ ACE_ENV_ARG_DECL)
+ {
+ if (servant)
+ {
+ // ATTENTION: Trick locking here, see class header for details
+ Non_Servant_Upcall non_servant_upcall (*this->poa_);
+ ACE_UNUSED_ARG (non_servant_upcall);
+
+ servant->_remove_ref (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ // This operation causes the association of the Object Id specified
+ // by the oid parameter and its servant to be removed from the
+ // Active Object Map.
+ int result = this->poa_->unbind_using_user_id (user_id);
+
+ if (result != 0)
+ {
+ ACE_THROW (CORBA::OBJ_ADAPTER ());
+ }
+ }
+
+ void
+ RequestProcessingStrategyDefaultServant::etherealize_objects (
+ CORBA::Boolean /*etherealize_objects*/)
+ {
+ }
+
+ PortableServer::ObjectId *
+ RequestProcessingStrategyDefaultServant::servant_to_id (
+ PortableServer::Servant servant
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ServantNotActive,
+ PortableServer::POA::WrongPolicy))
+ {
+ PortableServer::Servant default_servant = this->default_servant_.in ();
+
+ if (default_servant != 0 &&
+ default_servant == servant)
+ {
+ // If they are the same servant, then check if we are in an
+ // upcall.
+ TAO::Portable_Server::POA_Current_Impl *poa_current_impl =
+ static_cast <TAO::Portable_Server::POA_Current_Impl *>
+ (TAO_TSS_Resources::instance ()->poa_current_impl_);
+ // If we are in an upcall on the default servant, return the
+ // ObjectId associated with the current invocation.
+ if (poa_current_impl != 0 &&
+ servant == poa_current_impl->servant ())
+ {
+ return poa_current_impl->get_object_id ();
+ }
+ }
+
+ return this->poa_->servant_to_user_id (servant ACE_ENV_ARG_PARAMETER);
+ }
+
+ void
+ RequestProcessingStrategyDefaultServant::post_invoke_servant_cleanup(
+ const PortableServer::ObjectId &/*system_id*/,
+ const TAO::Portable_Server::Servant_Upcall &/*servant_upcall*/)
+ {
+ }
+
+ ::PortableServer::RequestProcessingPolicyValue
+ RequestProcessingStrategyDefaultServant::type() const
+ {
+ return ::PortableServer::USE_DEFAULT_SERVANT;
+ }
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_MINIMUM_POA == 0 */
+
diff --git a/TAO/tao/PortableServer/RequestProcessingStrategyDefaultServant.h b/TAO/tao/PortableServer/RequestProcessingStrategyDefaultServant.h
new file mode 100644
index 00000000000..6752b0dfe36
--- /dev/null
+++ b/TAO/tao/PortableServer/RequestProcessingStrategyDefaultServant.h
@@ -0,0 +1,123 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file RequestProcessingStrategyDefaultServant.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_REQUESTPROCESSINGSTRATEGYDEFAULTSERVANT_H
+#define TAO_REQUESTPROCESSINGSTRATEGYDEFAULTSERVANT_H
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/RequestProcessingStrategy.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/Servant_Base.h"
+
+#include "tao/PortableServer/Servant_Location.h"
+#include "tao/PortableServer/PortableServer.h"
+
+#if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Root_POA;
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ class RequestProcessingStrategyDefaultServant
+ : public RequestProcessingStrategy
+ {
+ public:
+ RequestProcessingStrategyDefaultServant (void);
+
+ virtual void strategy_cleanup(ACE_ENV_SINGLE_ARG_DECL);
+
+ PortableServer::ServantManager_ptr
+ get_servant_manager (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongPolicy));
+
+ void set_servant_manager (
+ PortableServer::ServantManager_ptr imgr
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongPolicy));
+
+ PortableServer::Servant get_servant (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongPolicy));
+
+ void set_servant (
+ PortableServer::Servant servant
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongPolicy));
+
+ virtual TAO_SERVANT_LOCATION locate_servant (
+ const PortableServer::ObjectId &system_id,
+ PortableServer::Servant &servant
+ ACE_ENV_ARG_DECL);
+
+ virtual PortableServer::Servant locate_servant (
+ const char *operation,
+ const PortableServer::ObjectId &system_id,
+ TAO::Portable_Server::Servant_Upcall &servant_upcall,
+ TAO::Portable_Server::POA_Current_Impl &poa_current_impl,
+ int &wait_occurred_restart_call
+ ACE_ENV_ARG_DECL);
+
+ virtual PortableServer::Servant system_id_to_servant (
+ const PortableServer::ObjectId &system_id
+ ACE_ENV_ARG_DECL);
+
+ virtual PortableServer::Servant id_to_servant (
+ const PortableServer::ObjectId &id
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ObjectNotActive,
+ PortableServer::POA::WrongPolicy));
+
+ virtual void cleanup_servant (
+ PortableServer::Servant servant,
+ const PortableServer::ObjectId &user_id
+ ACE_ENV_ARG_DECL);
+
+ virtual void etherealize_objects (CORBA::Boolean etherealize_objects);
+
+ virtual PortableServer::ObjectId *servant_to_id (
+ PortableServer::Servant servant
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ServantNotActive,
+ PortableServer::POA::WrongPolicy));
+
+ virtual void post_invoke_servant_cleanup(
+ const PortableServer::ObjectId &system_id,
+ const TAO::Portable_Server::Servant_Upcall &servant_upcall);
+
+ virtual ::PortableServer::RequestProcessingPolicyValue type() const;
+
+ private:
+ PortableServer::ServantBase_var default_servant_;
+ };
+
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_MINIMUM_POA == 0 */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_REQUESTPROCESSINGSTRATEGYDEFAULTSERVANT_H */
diff --git a/TAO/tao/PortableServer/RequestProcessingStrategyDefaultServantFI.cpp b/TAO/tao/PortableServer/RequestProcessingStrategyDefaultServantFI.cpp
new file mode 100644
index 00000000000..9ad0493cb75
--- /dev/null
+++ b/TAO/tao/PortableServer/RequestProcessingStrategyDefaultServantFI.cpp
@@ -0,0 +1,75 @@
+// $Id$
+
+#include "tao/PortableServer/RequestProcessingStrategyDefaultServantFI.h"
+#include "tao/PortableServer/RequestProcessingStrategy.h"
+#include "tao/PortableServer/RequestProcessingStrategyDefaultServant.h"
+#include "ace/Dynamic_Service.h"
+#include "ace/Log_Msg.h"
+
+ACE_RCSID (PortableServer,
+ RequestProcessingStrategyDefaultServantFI,
+ "$Id$")
+
+#if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ RequestProcessingStrategy*
+ RequestProcessingStrategyDefaultServantFactoryImpl::create (
+ ::PortableServer::RequestProcessingPolicyValue value,
+ ::PortableServer::ServantRetentionPolicyValue /*srvalue*/)
+ {
+ RequestProcessingStrategy* strategy = 0;
+
+ switch (value)
+ {
+ case ::PortableServer::USE_DEFAULT_SERVANT :
+ {
+ ACE_NEW_RETURN (strategy, RequestProcessingStrategyDefaultServant, 0);
+ break;
+ }
+ default :
+ {
+ ACE_ERROR ((LM_ERROR, "Incorrect type in RequestProcessingStrategyDefaultServantFactoryImpl"));
+ break;
+ }
+ }
+
+ return strategy;
+ }
+
+ void
+ RequestProcessingStrategyDefaultServantFactoryImpl::destroy (
+ RequestProcessingStrategy *strategy
+ ACE_ENV_ARG_DECL)
+ {
+ strategy->strategy_cleanup (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ delete strategy;
+ }
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DEFINE (
+ RequestProcessingStrategyDefaultServantFactoryImpl,
+ ACE_TEXT ("RequestProcessingStrategyDefaultServantFactory"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (RequestProcessingStrategyDefaultServantFactoryImpl),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0)
+
+ACE_FACTORY_NAMESPACE_DEFINE (
+ ACE_Local_Service,
+ RequestProcessingStrategyDefaultServantFactoryImpl,
+ TAO::Portable_Server::RequestProcessingStrategyDefaultServantFactoryImpl)
+
+
+#endif /* TAO_HAS_MINIMUM_POA == 0 */
+
diff --git a/TAO/tao/PortableServer/RequestProcessingStrategyDefaultServantFI.h b/TAO/tao/PortableServer/RequestProcessingStrategyDefaultServantFI.h
new file mode 100644
index 00000000000..220c4ffdfc1
--- /dev/null
+++ b/TAO/tao/PortableServer/RequestProcessingStrategyDefaultServantFI.h
@@ -0,0 +1,58 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file RequestProcessingStrategyDefaultServantFI.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_PORTABLESERVER_REQUESTPROCESSINGSTRATEGYDEFAULTSERVANTFACTORYIMPL_H
+#define TAO_PORTABLESERVER_REQUESTPROCESSINGSTRATEGYDEFAULTSERVANTFACTORYIMPL_H
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/Service_Config.h"
+#include "tao/PortableServer/RequestProcessingStrategyFactory.h"
+
+#if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ class TAO_PortableServer_Export RequestProcessingStrategyDefaultServantFactoryImpl
+ : public RequestProcessingStrategyFactory
+ {
+ public:
+ /// Create a new servant retention strategy
+ virtual RequestProcessingStrategy* create (
+ ::PortableServer::RequestProcessingPolicyValue value,
+ ::PortableServer::ServantRetentionPolicyValue srvalue);
+
+ virtual void destroy (
+ RequestProcessingStrategy *strategy
+ ACE_ENV_ARG_DECL);
+ };
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE_EXPORT (TAO_PortableServer, RequestProcessingStrategyDefaultServantFactoryImpl)
+ACE_FACTORY_DECLARE (TAO_PortableServer, RequestProcessingStrategyDefaultServantFactoryImpl)
+
+#endif /* TAO_HAS_MINIMUM_POA == 0 */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_PORTABLESERVER_REQUESTPROCESSINGSTRATEGYDEFAULTSERVANTFACTORYIMPL_H*/
diff --git a/TAO/tao/PortableServer/RequestProcessingStrategyFactory.h b/TAO/tao/PortableServer/RequestProcessingStrategyFactory.h
new file mode 100644
index 00000000000..9ee872f1a90
--- /dev/null
+++ b/TAO/tao/PortableServer/RequestProcessingStrategyFactory.h
@@ -0,0 +1,54 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file RequestProcessingStrategyFactory.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_PORTABLESERVER_REQUESTPROCESSINGSTRATEGYFACTORY_H
+#define TAO_PORTABLESERVER_REQUESTPROCESSINGSTRATEGYFACTORY_H
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/StrategyFactory.h"
+#include "tao/PortableServer/RequestProcessingPolicyC.h"
+#include "tao/PortableServer/ServantRetentionPolicyC.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ class RequestProcessingStrategy;
+
+ class TAO_PortableServer_Export RequestProcessingStrategyFactory
+ : public StrategyFactory
+ {
+ public:
+ /// Create a new servant retention strategy
+ virtual RequestProcessingStrategy* create (
+ ::PortableServer::RequestProcessingPolicyValue value,
+ ::PortableServer::ServantRetentionPolicyValue srvalue) = 0;
+
+ virtual void destroy (
+ RequestProcessingStrategy *strategy
+ ACE_ENV_ARG_DECL) = 0;
+ };
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_PORTABLESERVER_REQUESTPROCESSINGSTRATEGYFACTORY_H */
diff --git a/TAO/tao/PortableServer/RequestProcessingStrategyFactoryImpl.cpp b/TAO/tao/PortableServer/RequestProcessingStrategyFactoryImpl.cpp
new file mode 100644
index 00000000000..138fee4eb92
--- /dev/null
+++ b/TAO/tao/PortableServer/RequestProcessingStrategyFactoryImpl.cpp
@@ -0,0 +1,150 @@
+// $Id$
+
+#include "tao/PortableServer/RequestProcessingStrategyFactoryImpl.h"
+#include "tao/PortableServer/RequestProcessingStrategyAOMOnly.h"
+#include "tao/PortableServer/RequestProcessingStrategyDefaultServant.h"
+#include "tao/PortableServer/RequestProcessingStrategyServantLocator.h"
+#include "tao/PortableServer/RequestProcessingStrategyServantActivator.h"
+#include "ace/Dynamic_Service.h"
+#include "ace/Log_Msg.h"
+
+ACE_RCSID (PortableServer,
+ RequestProcessingStrategyFactoryImpl,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ RequestProcessingStrategy*
+ RequestProcessingStrategyFactoryImpl::create (
+ ::PortableServer::RequestProcessingPolicyValue value,
+ ::PortableServer::ServantRetentionPolicyValue srvalue)
+ {
+ RequestProcessingStrategy* strategy = 0;
+ RequestProcessingStrategyFactory *strategy_factory = 0;
+
+ switch (value)
+ {
+ case ::PortableServer::USE_ACTIVE_OBJECT_MAP_ONLY :
+ {
+ strategy_factory =
+ ACE_Dynamic_Service<RequestProcessingStrategyFactory>::instance ("RequestProcessingStrategyAOMOnlyFactory");
+
+ break;
+ }
+ case ::PortableServer::USE_DEFAULT_SERVANT :
+ {
+ strategy_factory =
+ ACE_Dynamic_Service<RequestProcessingStrategyFactory>::instance ("RequestProcessingStrategyDefaultServantFactory");
+
+ break;
+ }
+ case ::PortableServer::USE_SERVANT_MANAGER :
+ {
+#if (TAO_HAS_MINIMUM_POA == 0)
+ switch (srvalue)
+ {
+ case ::PortableServer::RETAIN :
+ {
+ strategy_factory =
+ ACE_Dynamic_Service<RequestProcessingStrategyFactory>::instance ("RequestProcessingStrategyServantActivatorFactory");
+
+ break;
+ }
+ case ::PortableServer::NON_RETAIN :
+ {
+ strategy_factory =
+ ACE_Dynamic_Service<RequestProcessingStrategyFactory>::instance ("RequestProcessingStrategyServantLocatorFactory");
+
+ break;
+ }
+ }
+#endif /* TAO_HAS_MINIMUM_POA == 0 */
+ break;
+ }
+ }
+
+ if (strategy_factory != 0)
+ strategy = strategy_factory->create (value, srvalue);
+ else
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) %p\n"),
+ ACE_TEXT ("ERROR, Unable to get ")
+ ACE_TEXT ("RequestProcessingStrategyFactory")));
+
+ return strategy;
+ }
+
+ void
+ RequestProcessingStrategyFactoryImpl::destroy (
+ RequestProcessingStrategy *strategy
+ ACE_ENV_ARG_DECL)
+ {
+ RequestProcessingStrategyFactory *strategy_factory = 0;
+
+ switch (strategy->type ())
+ {
+ case ::PortableServer::USE_ACTIVE_OBJECT_MAP_ONLY :
+ {
+ strategy_factory =
+ ACE_Dynamic_Service<RequestProcessingStrategyFactory>::instance ("RequestProcessingStrategyAOMOnlyFactory");
+
+ break;
+ }
+ case ::PortableServer::USE_DEFAULT_SERVANT :
+ {
+ strategy_factory =
+ ACE_Dynamic_Service<RequestProcessingStrategyFactory>::instance ("RequestProcessingStrategyDefaultServantFactory");
+
+ break;
+ }
+ case ::PortableServer::USE_SERVANT_MANAGER :
+ {
+#if (TAO_HAS_MINIMUM_POA == 0)
+ switch (strategy->sr_type ())
+ {
+ case ::PortableServer::RETAIN :
+ {
+ strategy_factory =
+ ACE_Dynamic_Service<RequestProcessingStrategyFactory>::instance ("RequestProcessingStrategyServantActivatorFactory");
+
+ break;
+ }
+ case ::PortableServer::NON_RETAIN :
+ {
+ strategy_factory =
+ ACE_Dynamic_Service<RequestProcessingStrategyFactory>::instance ("RequestProcessingStrategyServantLocatorFactory");
+ break;
+ }
+ }
+#endif /* TAO_HAS_MINIMUM_POA == 0 */
+ break;
+ }
+ }
+
+ if (strategy_factory != 0)
+ {
+ strategy_factory->destroy (strategy ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ }
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DEFINE (
+ RequestProcessingStrategyFactoryImpl,
+ ACE_TEXT ("RequestProcessingStrategyFactory"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (RequestProcessingStrategyFactoryImpl),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0)
+
+ACE_FACTORY_NAMESPACE_DEFINE (
+ ACE_Local_Service,
+ RequestProcessingStrategyFactoryImpl,
+ TAO::Portable_Server::RequestProcessingStrategyFactoryImpl)
diff --git a/TAO/tao/PortableServer/RequestProcessingStrategyFactoryImpl.h b/TAO/tao/PortableServer/RequestProcessingStrategyFactoryImpl.h
new file mode 100644
index 00000000000..fa07f1c30a3
--- /dev/null
+++ b/TAO/tao/PortableServer/RequestProcessingStrategyFactoryImpl.h
@@ -0,0 +1,54 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file RequestProcessingStrategyFactoryImpl.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_PORTABLESERVER_REQUESTPROCESSINGSTRATEGYFACTORYIMPL_H
+#define TAO_PORTABLESERVER_REQUESTPROCESSINGSTRATEGYFACTORYIMPL_H
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/Service_Config.h"
+#include "tao/PortableServer/RequestProcessingStrategyFactory.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ class TAO_PortableServer_Export RequestProcessingStrategyFactoryImpl
+ : public RequestProcessingStrategyFactory
+ {
+ public:
+ virtual RequestProcessingStrategy* create (
+ ::PortableServer::RequestProcessingPolicyValue value,
+ ::PortableServer::ServantRetentionPolicyValue srvalue);
+
+ virtual void destroy (
+ RequestProcessingStrategy *strategy
+ ACE_ENV_ARG_DECL);
+ };
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE_EXPORT (TAO_PortableServer, RequestProcessingStrategyFactoryImpl)
+ACE_FACTORY_DECLARE (TAO_PortableServer, RequestProcessingStrategyFactoryImpl)
+
+
+#include /**/ "ace/post.h"
+#endif /* TAO_PORTABLESERVER_REQUESTPROCESSINGSTRATEGYFACTORYIMPL_H */
diff --git a/TAO/tao/PortableServer/RequestProcessingStrategyServantActivator.cpp b/TAO/tao/PortableServer/RequestProcessingStrategyServantActivator.cpp
new file mode 100644
index 00000000000..2010b5e9076
--- /dev/null
+++ b/TAO/tao/PortableServer/RequestProcessingStrategyServantActivator.cpp
@@ -0,0 +1,355 @@
+// $Id$
+#include "tao/ORB_Constants.h"
+#include "tao/PortableServer/ServantActivatorC.h"
+#include "tao/PortableServer/RequestProcessingStrategyServantActivator.h"
+#include "tao/PortableServer/Servant_Base.h"
+#include "tao/PortableServer/Non_Servant_Upcall.h"
+#include "tao/PortableServer/Root_POA.h"
+#include "tao/PortableServer/POA_Current_Impl.h"
+#include "tao/PortableServer/Servant_Upcall.h"
+
+ACE_RCSID (PortableServer,
+ Request_Processing,
+ "$Id$")
+
+#if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ RequestProcessingStrategyServantActivator::RequestProcessingStrategyServantActivator (void) :
+ etherealize_objects_ (1)
+ {
+ }
+
+ void
+ RequestProcessingStrategyServantActivator::strategy_cleanup (
+ ACE_ENV_SINGLE_ARG_DECL)
+ {
+ {
+ Non_Servant_Upcall non_servant_upcall (*this->poa_);
+ ACE_UNUSED_ARG (non_servant_upcall);
+
+ this->servant_activator_ =
+ PortableServer::ServantActivator::_nil ();
+ }
+
+ RequestProcessingStrategy::strategy_cleanup (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ PortableServer::ServantManager_ptr
+ RequestProcessingStrategyServantActivator::get_servant_manager (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongPolicy))
+ {
+ return PortableServer::ServantManager::_duplicate (this->servant_activator_.in ());
+ }
+
+ void
+ RequestProcessingStrategyServantActivator::set_servant_manager (
+ PortableServer::ServantManager_ptr imgr
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongPolicy))
+ {
+ // This operation sets the default servant manager associated with the
+ // POA. This operation may only be invoked once after a POA has been
+ // created. Attempting to set the servant manager after one has already
+ // been set will result in the BAD_INV_ORDER system exception with
+ // standard minor code 6 being raised (see 11.3.9.12 of the corba spec)
+ if (!CORBA::is_nil (this->servant_activator_.in ()))
+ {
+ ACE_THROW (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 6,
+ CORBA::COMPLETED_NO));
+ }
+
+ this->servant_activator_ =
+ PortableServer::ServantActivator::_narrow (imgr
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->validate_servant_manager (this->servant_activator_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ TAO_SERVANT_LOCATION
+ RequestProcessingStrategyServantActivator::locate_servant (
+ const PortableServer::ObjectId &system_id,
+ PortableServer::Servant &servant
+ ACE_ENV_ARG_DECL)
+ {
+ TAO_SERVANT_LOCATION location = TAO_SERVANT_NOT_FOUND;
+
+ location = this->poa_->servant_present (system_id,
+ servant
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO_SERVANT_NOT_FOUND);
+
+ if (location == TAO_SERVANT_NOT_FOUND)
+ {
+ if (!CORBA::is_nil (this->servant_activator_.in ()))
+ {
+ location = TAO_SERVANT_MANAGER;
+ }
+ }
+
+ return location;
+ }
+
+ PortableServer::Servant
+ RequestProcessingStrategyServantActivator::locate_servant (
+ const char * /*operation*/,
+ const PortableServer::ObjectId &system_id,
+ TAO::Portable_Server::Servant_Upcall &servant_upcall,
+ TAO::Portable_Server::POA_Current_Impl &poa_current_impl,
+ int &wait_occurred_restart_call
+ ACE_ENV_ARG_DECL)
+ {
+ PortableServer::Servant servant = 0;
+
+ servant = this->poa_->find_servant (system_id,
+ servant_upcall,
+ poa_current_impl
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ if (servant != 0)
+ {
+ return servant;
+ }
+
+ // If the POA has the USE_SERVANT_MANAGER policy, a servant manager
+ // has been associated with the POA so the POA will invoke incarnate
+ // or preinvoke on it to find a servant that may handle the
+ // request. (The choice of method depends on the NON_RETAIN or
+ // RETAIN policy of the POA.) If no servant manager has been
+ // associated with the POA, the POA raises the OBJ_ADAPTER system
+ // exception.
+ //
+ // If a servant manager is located and invoked, but the servant
+ // manager is not directly capable of incarnating the object, it
+ // (the servant manager) may deal with the circumstance in a variety
+ // of ways, all of which are the application's responsibility. Any
+ // system exception raised by the servant manager will be returned
+ // to the client in the reply. In addition to standard CORBA
+ // exceptions, a servant manager is capable of raising a
+ // ForwardRequest exception. This exception includes an object
+ // reference.
+ //
+
+ this->validate_servant_manager (this->servant_activator_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ servant =
+ this->incarnate_servant (poa_current_impl.object_id ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ // If the incarnate operation returns a servant that is
+ // already active for a different Object Id and if the POA
+ // also has the UNIQUE_ID policy, the incarnate has violated
+ // the POA policy and is considered to be in error. The POA
+ // will raise an OBJ_ADAPTER system exception for the
+ // request.
+ bool may_activate =
+ this->poa_->is_servant_activation_allowed (servant,
+ wait_occurred_restart_call);
+
+ if (!may_activate)
+ {
+ // If we are not allowed to activate the servant, throw an exception
+ // etherealize is not called because the servant is never added to
+ // the active object map
+ ACE_THROW_RETURN (CORBA::OBJ_ADAPTER (),
+ 0);
+ }
+
+ // The POA enters the returned Servant value into the Active
+ // Object Map so that subsequent requests with the same
+ // ObjectId value will be delivered directly to that servant
+ // without invoking the servant manager. Only run if there
+ // are no errors or if a restart is not required.
+ if (!wait_occurred_restart_call)
+ {
+ int result =
+ this->poa_->
+ rebind_using_user_id_and_system_id (servant,
+ poa_current_impl.object_id (),
+ system_id,
+ servant_upcall);
+ if (result != 0)
+ {
+ // Throw an exception, etherealize is not called because servant
+ // is not added to the active object map
+ ACE_THROW_RETURN (CORBA::OBJ_ADAPTER (),
+ 0);
+ }
+
+ // Increment the reference count on the servant upcall.
+ servant_upcall.increment_servant_refcount ();
+ }
+ else
+ {
+ CORBA::Boolean cleanup_in_progress = 0;
+ this->etherealize_servant (poa_current_impl.object_id (),
+ servant,
+ cleanup_in_progress
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ // We ended up waiting on a condition variable, the
+ // POA state may have changed while we are waiting.
+ // Therefore, we need to restart this call.
+ return 0;
+ }
+
+ // Success
+ return servant;
+ }
+
+ void
+ RequestProcessingStrategyServantActivator::etherealize_servant (
+ const PortableServer::ObjectId& object_id,
+ PortableServer::Servant servant,
+ CORBA::Boolean cleanup_in_progress
+ ACE_ENV_ARG_DECL)
+ {
+ CORBA::Boolean remaining_activations =
+ this->poa_->servant_has_remaining_activations (servant);
+
+ // ATTENTION: Trick locking here, see class header for details
+ Non_Servant_Upcall non_servant_upcall (*this->poa_);
+ ACE_UNUSED_ARG (non_servant_upcall);
+
+ // @todo This is not according to the spec. According to 11.3.6.2 at the
+ // end when etherealize returns a system exception the POA ignores the
+ // exception
+ this->servant_activator_->etherealize (object_id,
+ this->poa_,
+ servant,
+ cleanup_in_progress,
+ remaining_activations
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ PortableServer::Servant
+ RequestProcessingStrategyServantActivator::incarnate_servant (
+ const PortableServer::ObjectId& object_id
+ ACE_ENV_ARG_DECL)
+ {
+ PortableServer::Servant servant = 0;
+
+ // ATTENTION: Trick locking here, see class header for details
+ Non_Servant_Upcall non_servant_upcall (*this->poa_);
+ ACE_UNUSED_ARG (non_servant_upcall);
+
+ // @@
+ // Invocations of incarnate on the servant manager are serialized.
+ // Invocations of etherealize on the servant manager are serialized.
+ // Invocations of incarnate and etherealize on the servant manager are mutually exclusive.
+ servant = this->servant_activator_->incarnate (object_id,
+ this->poa_
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ if (servant == 0)
+ {
+ ACE_THROW_RETURN (CORBA::OBJ_ADAPTER (CORBA::OMGVMCID | 7,
+ CORBA::COMPLETED_NO),
+ 0);
+ }
+ else
+ {
+ return servant;
+ }
+ }
+
+ void
+ RequestProcessingStrategyServantActivator::cleanup_servant (
+ PortableServer::Servant servant,
+ const PortableServer::ObjectId &user_id
+ ACE_ENV_ARG_DECL)
+ {
+ // If a servant manager is associated with the POA,
+ // ServantLocator::etherealize will be invoked with the oid and the
+ // servant. (The deactivate_object operation does not wait for the
+ // etherealize operation to complete before deactivate_object
+ // returns.)
+ //
+ // Note: If the servant associated with the oid is serving multiple
+ // Object Ids, ServantLocator::etherealize may be invoked multiple
+ // times with the same servant when the other objects are
+ // deactivated. It is the responsibility of the object
+ // implementation to refrain from destroying the servant while it is
+ // active with any Id.
+
+ // If the POA has no ServantActivator associated with it, the POA
+ // implementation calls _remove_ref when all operation invocations
+ // have completed. If there is a ServantActivator, the Servant is
+ // consumed by the call to ServantActivator::etherealize instead.
+
+ // @bala, is this order correct, see 11.3.9.17 of the spec, it
+ // says first remove from the map, then etherealize. not the
+ // other way around
+ // @@ Johnny, you are right! This will not show up until a
+ // thread is trying to activate the object in another thread
+ // using activate_object_with_id (). A test case is a must for
+ // atleast this issue.
+ if (servant)
+ {
+ if (this->etherealize_objects_ &&
+ !CORBA::is_nil (this->servant_activator_.in ()))
+ {
+ this->etherealize_servant (user_id,
+ servant,
+ this->poa_->cleanup_in_progress ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else
+ {
+ // ATTENTION: Trick locking here, see class header for details
+ Non_Servant_Upcall non_servant_upcall (*this->poa_);
+ ACE_UNUSED_ARG (non_servant_upcall);
+
+ servant->_remove_ref (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ }
+
+ // This operation causes the association of the Object Id specified
+ // by the oid parameter and its servant to be removed from the
+ // Active Object Map.
+ int result = this->poa_->unbind_using_user_id (user_id);
+
+ if (result != 0)
+ ACE_THROW (CORBA::OBJ_ADAPTER ());
+ }
+
+ void
+ RequestProcessingStrategyServantActivator::etherealize_objects (
+ CORBA::Boolean etherealize_objects)
+ {
+ this->etherealize_objects_ = etherealize_objects;
+ }
+
+ void
+ RequestProcessingStrategyServantActivator::post_invoke_servant_cleanup(
+ const PortableServer::ObjectId &/*system_id*/,
+ const TAO::Portable_Server::Servant_Upcall &/*servant_upcall*/)
+ {
+ }
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_MINIMUM_POA == 0 */
diff --git a/TAO/tao/PortableServer/RequestProcessingStrategyServantActivator.h b/TAO/tao/PortableServer/RequestProcessingStrategyServantActivator.h
new file mode 100644
index 00000000000..19e1337576b
--- /dev/null
+++ b/TAO/tao/PortableServer/RequestProcessingStrategyServantActivator.h
@@ -0,0 +1,98 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file RequestProcessingStrategyServantActivator.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_REQUESTPROCESSINGSTRATEGYSERVANTACTIVATOR_H
+#define TAO_REQUESTPROCESSINGSTRATEGYSERVANTACTIVATOR_H
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/RequestProcessingStrategyServantManager.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
+
+#include "tao/PortableServer/Servant_Location.h"
+#include "tao/PortableServer/PortableServer.h"
+#include "tao/PortableServer/ServantActivatorC.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ class RequestProcessingStrategyServantActivator
+ : public RequestProcessingStrategyServantManager
+ {
+ public:
+ RequestProcessingStrategyServantActivator (void);
+
+ virtual void strategy_cleanup(ACE_ENV_SINGLE_ARG_DECL);
+
+ PortableServer::ServantManager_ptr get_servant_manager (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongPolicy));
+
+ void set_servant_manager (PortableServer::ServantManager_ptr imgr
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongPolicy));
+
+ virtual TAO_SERVANT_LOCATION locate_servant (
+ const PortableServer::ObjectId &system_id,
+ PortableServer::Servant &servant
+ ACE_ENV_ARG_DECL);
+
+ virtual PortableServer::Servant locate_servant (
+ const char *operation,
+ const PortableServer::ObjectId &system_id,
+ TAO::Portable_Server::Servant_Upcall &servant_upcall,
+ TAO::Portable_Server::POA_Current_Impl &poa_current_impl,
+ int &wait_occurred_restart_call
+ ACE_ENV_ARG_DECL);
+
+ virtual void cleanup_servant (
+ PortableServer::Servant servant,
+ const PortableServer::ObjectId &user_id
+ ACE_ENV_ARG_DECL);
+
+ virtual void etherealize_objects (CORBA::Boolean etherealize_objects);
+
+ virtual void post_invoke_servant_cleanup(
+ const PortableServer::ObjectId &system_id,
+ const TAO::Portable_Server::Servant_Upcall &servant_upcall);
+
+ private:
+ PortableServer::Servant incarnate_servant (
+ const PortableServer::ObjectId& object_id
+ ACE_ENV_ARG_DECL);
+
+ void etherealize_servant (const PortableServer::ObjectId& object_id,
+ PortableServer::Servant servant,
+ CORBA::Boolean cleanup_in_progress
+ ACE_ENV_ARG_DECL);
+
+ private:
+ PortableServer::ServantActivator_var servant_activator_;
+ CORBA::Boolean etherealize_objects_;
+ };
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_MINIMUM_POA == 0 */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_REQUESTPROCESSINGSTRATEGYSERVANTACTIVATOR_H */
diff --git a/TAO/tao/PortableServer/RequestProcessingStrategyServantActivatorFI.cpp b/TAO/tao/PortableServer/RequestProcessingStrategyServantActivatorFI.cpp
new file mode 100644
index 00000000000..69ae2437301
--- /dev/null
+++ b/TAO/tao/PortableServer/RequestProcessingStrategyServantActivatorFI.cpp
@@ -0,0 +1,86 @@
+// $Id$
+
+#include "tao/PortableServer/RequestProcessingStrategyServantActivatorFI.h"
+#include "tao/PortableServer/RequestProcessingStrategy.h"
+#include "tao/PortableServer/RequestProcessingStrategyServantActivator.h"
+#include "ace/Dynamic_Service.h"
+#include "ace/Log_Msg.h"
+
+ACE_RCSID (PortableServer,
+ RequestProcessingStrategyServantActivatorFactoryImpl,
+ "$Id$")
+
+#if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ RequestProcessingStrategy*
+ RequestProcessingStrategyServantActivatorFactoryImpl::create (
+ ::PortableServer::RequestProcessingPolicyValue value,
+ ::PortableServer::ServantRetentionPolicyValue srvalue)
+ {
+ RequestProcessingStrategy* strategy = 0;
+
+ switch (value)
+ {
+ case ::PortableServer::USE_SERVANT_MANAGER :
+ {
+ switch (srvalue)
+ {
+ case ::PortableServer::RETAIN :
+ {
+ ACE_NEW_RETURN (strategy, RequestProcessingStrategyServantActivator, 0);
+ break;
+ }
+ case ::PortableServer::NON_RETAIN :
+ {
+ ACE_ERROR ((LM_ERROR, "Incorrect type in RequestProcessingStrategyServantActivatorFactoryImpl"));
+ break;
+ }
+ }
+ break;
+ }
+ default :
+ {
+ ACE_ERROR ((LM_ERROR, "Incorrect type in RequestProcessingStrategyServantActivatorFactoryImpl"));
+ break;
+ }
+ }
+
+ return strategy;
+ }
+
+ void
+ RequestProcessingStrategyServantActivatorFactoryImpl::destroy (
+ RequestProcessingStrategy *strategy
+ ACE_ENV_ARG_DECL)
+ {
+ strategy->strategy_cleanup (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ delete strategy;
+ }
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DEFINE (
+ RequestProcessingStrategyServantActivatorFactoryImpl,
+ ACE_TEXT ("RequestProcessingStrategyServantActivatorFactory"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (RequestProcessingStrategyServantActivatorFactoryImpl),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0)
+
+ACE_FACTORY_NAMESPACE_DEFINE (
+ ACE_Local_Service,
+ RequestProcessingStrategyServantActivatorFactoryImpl,
+ TAO::Portable_Server::RequestProcessingStrategyServantActivatorFactoryImpl)
+
+
+#endif /* TAO_HAS_MINIMUM_POA == 0 */
diff --git a/TAO/tao/PortableServer/RequestProcessingStrategyServantActivatorFI.h b/TAO/tao/PortableServer/RequestProcessingStrategyServantActivatorFI.h
new file mode 100644
index 00000000000..b9aae2ca3d6
--- /dev/null
+++ b/TAO/tao/PortableServer/RequestProcessingStrategyServantActivatorFI.h
@@ -0,0 +1,59 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file RequestProcessingStrategyServantActivatorFI.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_PORTABLESERVER_REQUESTPROCESSINGSTRATEGYSERVANTACTIVATORFACTORYIMPL_H
+#define TAO_PORTABLESERVER_REQUESTPROCESSINGSTRATEGYSERVANTACTIVATORFACTORYIMPL_H
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/Service_Config.h"
+#include "tao/PortableServer/RequestProcessingStrategyFactory.h"
+
+#if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ class TAO_PortableServer_Export RequestProcessingStrategyServantActivatorFactoryImpl
+ : public RequestProcessingStrategyFactory
+ {
+ public:
+ /// Create a new servant retention strategy
+ virtual RequestProcessingStrategy* create (
+ ::PortableServer::RequestProcessingPolicyValue value,
+ ::PortableServer::ServantRetentionPolicyValue srvalue);
+
+ virtual void destroy (
+ RequestProcessingStrategy *strategy
+ ACE_ENV_ARG_DECL);
+ };
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE_EXPORT (TAO_PortableServer, RequestProcessingStrategyServantActivatorFactoryImpl)
+ACE_FACTORY_DECLARE (TAO_PortableServer, RequestProcessingStrategyServantActivatorFactoryImpl)
+
+
+#endif /* TAO_HAS_MINIMUM_POA == 0 */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_PORTABLESERVER_REQUESTPROCESSINGSTRATEGYSERVANTACTIVATORFACTORYIMPL_H */
diff --git a/TAO/tao/PortableServer/RequestProcessingStrategyServantLocator.cpp b/TAO/tao/PortableServer/RequestProcessingStrategyServantLocator.cpp
new file mode 100644
index 00000000000..481521ad6fb
--- /dev/null
+++ b/TAO/tao/PortableServer/RequestProcessingStrategyServantLocator.cpp
@@ -0,0 +1,259 @@
+#include "tao/ORB_Constants.h"
+#include "tao/PortableServer/ServantLocatorC.h"
+#include "tao/PortableServer/RequestProcessingStrategyServantLocator.h"
+#include "tao/PortableServer/Root_POA.h"
+#include "tao/PortableServer/POA_Current_Impl.h"
+#include "tao/PortableServer/Servant_Upcall.h"
+#include "tao/PortableServer/Non_Servant_Upcall.h"
+#include "tao/PortableServer/Servant_Base.h"
+
+ACE_RCSID (PortableServer,
+ Request_Processing,
+ "$Id$")
+
+#if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ RequestProcessingStrategyServantLocator::RequestProcessingStrategyServantLocator (void)
+ {
+ }
+
+ void
+ RequestProcessingStrategyServantLocator::strategy_cleanup(
+ ACE_ENV_SINGLE_ARG_DECL)
+ {
+ {
+ Non_Servant_Upcall non_servant_upcall (*this->poa_);
+ ACE_UNUSED_ARG (non_servant_upcall);
+
+ this->servant_locator_ = PortableServer::ServantLocator::_nil ();
+ }
+
+ RequestProcessingStrategy::strategy_cleanup (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ PortableServer::ServantManager_ptr
+ RequestProcessingStrategyServantLocator::get_servant_manager (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongPolicy))
+ {
+ return PortableServer::ServantManager::_duplicate (this->servant_locator_.in ());
+ }
+
+ void
+ RequestProcessingStrategyServantLocator::set_servant_manager (
+ PortableServer::ServantManager_ptr imgr
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongPolicy))
+ {
+ // This operation sets the default servant manager associated with the
+ // POA. This operation may only be invoked once after a POA has been
+ // created. Attempting to set the servant manager after one has already
+ // been set will result in the BAD_INV_ORDER system exception with
+ // standard minor code 6 being raised (see 11.3.9.12 of the corba spec)
+ if (!CORBA::is_nil (this->servant_locator_.in ()))
+ {
+ ACE_THROW (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 6,
+ CORBA::COMPLETED_NO));
+ }
+
+ this->servant_locator_ = PortableServer::ServantLocator::_narrow (imgr
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->validate_servant_manager (this->servant_locator_.in () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ TAO_SERVANT_LOCATION
+ RequestProcessingStrategyServantLocator::locate_servant (
+ const PortableServer::ObjectId &system_id,
+ PortableServer::Servant &servant
+ ACE_ENV_ARG_DECL)
+ {
+ TAO_SERVANT_LOCATION location = TAO_SERVANT_NOT_FOUND;
+
+ location = this->poa_->servant_present (system_id,
+ servant
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO_SERVANT_NOT_FOUND);
+
+ if (location == TAO_SERVANT_NOT_FOUND)
+ {
+ if (!CORBA::is_nil (this->servant_locator_.in ()))
+ {
+ location = TAO_SERVANT_MANAGER;
+ }
+ }
+
+ return location;
+ }
+
+ PortableServer::Servant
+ RequestProcessingStrategyServantLocator::locate_servant (
+ const char *operation,
+ const PortableServer::ObjectId &system_id,
+ TAO::Portable_Server::Servant_Upcall &servant_upcall,
+ TAO::Portable_Server::POA_Current_Impl &poa_current_impl,
+ int &/*wait_occurred_restart_call*/
+ ACE_ENV_ARG_DECL)
+ {
+ PortableServer::Servant servant = 0;
+
+ servant = this->poa_->find_servant (system_id,
+ servant_upcall,
+ poa_current_impl
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ if (servant != 0)
+ {
+ return servant;
+ }
+
+ // If the POA has the USE_SERVANT_MANAGER policy, a servant manager
+ // has been associated with the POA so the POA will invoke incarnate
+ // or preinvoke on it to find a servant that may handle the
+ // request. (The choice of method depends on the NON_RETAIN or
+ // RETAIN policy of the POA.) If no servant manager has been
+ // associated with the POA, the POA raises the OBJ_ADAPTER system
+ // exception.
+ //
+ // If a servant manager is located and invoked, but the servant
+ // manager is not directly capable of incarnating the object, it
+ // (the servant manager) may deal with the circumstance in a variety
+ // of ways, all of which are the application's responsibility. Any
+ // system exception raised by the servant manager will be returned
+ // to the client in the reply. In addition to standard CORBA
+ // exceptions, a servant manager is capable of raising a
+ // ForwardRequest exception. This exception includes an object
+ // reference.
+ //
+
+ this->validate_servant_manager (this->servant_locator_.in () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ // No serialization of invocations of preinvoke or
+ // postinvoke may be assumed; there may be multiple
+ // concurrent invocations of preinvoke for the same
+ // ObjectId.
+ //
+ // The same thread will be used to preinvoke the object,
+ // process the request, and postinvoke the object.
+
+ // @@ Note that it is possible for some other thread to
+ // reset the servant locator once the lock is released.
+ // However, this possiblility also exists for postinvoke()
+ // which is also called outside the lock.
+
+ // Release the object adapter lock.
+ this->poa_->object_adapter().lock ().release ();
+
+ // We have released the object adapter lock. Record this
+ // for later use.
+ servant_upcall.state (TAO::Portable_Server::Servant_Upcall::OBJECT_ADAPTER_LOCK_RELEASED);
+
+ PortableServer::ServantLocator::Cookie cookie = 0;
+ servant =
+ this->servant_locator_->preinvoke (poa_current_impl.object_id (),
+ this->poa_,
+ operation,
+ cookie
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ if (servant == 0)
+ {
+ ACE_THROW_RETURN (CORBA::OBJ_ADAPTER (CORBA::OMGVMCID | 7,
+ CORBA::COMPLETED_NO),
+ 0);
+ }
+
+ // Remember the cookie
+ servant_upcall.locator_cookie (cookie);
+
+ // Remember operation name.
+ servant_upcall.operation (operation);
+
+ // Success
+ return servant;
+ }
+
+ void
+ RequestProcessingStrategyServantLocator::cleanup_servant (
+ PortableServer::Servant servant,
+ const PortableServer::ObjectId &user_id
+ ACE_ENV_ARG_DECL)
+ {
+ if (servant)
+ {
+ // ATTENTION: Trick locking here, see class header for details
+ Non_Servant_Upcall non_servant_upcall (*this->poa_);
+ ACE_UNUSED_ARG (non_servant_upcall);
+
+ servant->_remove_ref (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ // This operation causes the association of the Object Id specified
+ // by the oid parameter and its servant to be removed from the
+ // Active Object Map.
+ int result = this->poa_->unbind_using_user_id (user_id);
+
+ if (result != 0)
+ {
+ ACE_THROW (CORBA::OBJ_ADAPTER ());
+ }
+ }
+
+ void
+ RequestProcessingStrategyServantLocator::etherealize_objects (
+ CORBA::Boolean /*etherealize_objects*/)
+ {
+ }
+
+ void
+ RequestProcessingStrategyServantLocator::post_invoke_servant_cleanup(
+ const PortableServer::ObjectId &system_id,
+ const TAO::Portable_Server::Servant_Upcall &servant_upcall)
+ {
+ // @todo This method seems to misbehave according to the corba spec, see
+ // section 11.3.7.2. It says that when postinvoke raises an system
+ // exception the methods normal return is overrriden, the request completes
+ // with the exception
+
+ if (!CORBA::is_nil (this->servant_locator_.in ()))
+ {
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ servant_locator_->postinvoke (system_id,
+ this->poa_,
+ servant_upcall.operation (),
+ servant_upcall.locator_cookie (),
+ servant_upcall.servant ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ // Ignore errors from servant locator ....
+ }
+ ACE_ENDTRY;
+ }
+ }
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_MINIMUM_POA == 0 */
+
diff --git a/TAO/tao/PortableServer/RequestProcessingStrategyServantLocator.h b/TAO/tao/PortableServer/RequestProcessingStrategyServantLocator.h
new file mode 100644
index 00000000000..79cac166c68
--- /dev/null
+++ b/TAO/tao/PortableServer/RequestProcessingStrategyServantLocator.h
@@ -0,0 +1,89 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file RequestProcessingStrategyServantLocator.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_REQUESTPROCESSINGSTRATEGYSERVANTLOCATOR_H
+#define TAO_REQUESTPROCESSINGSTRATEGYSERVANTLOCATOR_H
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/RequestProcessingStrategyServantManager.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
+
+#include "tao/PortableServer/Servant_Location.h"
+#include "tao/PortableServer/PortableServer.h"
+#include "tao/PortableServer/ServantLocatorC.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ class RequestProcessingStrategyServantLocator
+ : public RequestProcessingStrategyServantManager
+ {
+ public:
+ RequestProcessingStrategyServantLocator (void);
+
+ virtual void strategy_cleanup(ACE_ENV_SINGLE_ARG_DECL);
+
+ PortableServer::ServantManager_ptr get_servant_manager (
+ ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongPolicy));
+
+ void set_servant_manager (
+ PortableServer::ServantManager_ptr imgr
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongPolicy));
+
+ virtual TAO_SERVANT_LOCATION locate_servant (
+ const PortableServer::ObjectId &system_id,
+ PortableServer::Servant &servant
+ ACE_ENV_ARG_DECL);
+
+ virtual void post_invoke_servant_cleanup(
+ const PortableServer::ObjectId &system_id,
+ const TAO::Portable_Server::Servant_Upcall &servant_upcall);
+
+ virtual PortableServer::Servant locate_servant (
+ const char *operation,
+ const PortableServer::ObjectId &system_id,
+ TAO::Portable_Server::Servant_Upcall &servant_upcall,
+ TAO::Portable_Server::POA_Current_Impl &poa_current_impl,
+ int &wait_occurred_restart_call
+ ACE_ENV_ARG_DECL);
+
+ virtual void cleanup_servant (
+ PortableServer::Servant servant,
+ const PortableServer::ObjectId &user_id
+ ACE_ENV_ARG_DECL);
+
+ virtual void etherealize_objects (CORBA::Boolean etherealize_objects);
+
+ private:
+ PortableServer::ServantLocator_var servant_locator_;
+ };
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_MINIMUM_POA == 0 */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_REQUESTPROCESSINGSTRATEGYSERVANTLOCATOR_H */
diff --git a/TAO/tao/PortableServer/RequestProcessingStrategyServantLocatorFI.cpp b/TAO/tao/PortableServer/RequestProcessingStrategyServantLocatorFI.cpp
new file mode 100644
index 00000000000..fe3d489977d
--- /dev/null
+++ b/TAO/tao/PortableServer/RequestProcessingStrategyServantLocatorFI.cpp
@@ -0,0 +1,87 @@
+// $Id$
+
+#include "tao/PortableServer/RequestProcessingStrategyServantLocatorFI.h"
+#include "tao/PortableServer/RequestProcessingStrategy.h"
+#include "tao/PortableServer/RequestProcessingStrategyServantLocator.h"
+#include "ace/Dynamic_Service.h"
+#include "ace/Log_Msg.h"
+
+ACE_RCSID (PortableServer,
+ RequestProcessingStrategyServantLocatorFactoryImpl,
+ "$Id$")
+
+#if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ RequestProcessingStrategy*
+ RequestProcessingStrategyServantLocatorFactoryImpl::create (
+ ::PortableServer::RequestProcessingPolicyValue value,
+ ::PortableServer::ServantRetentionPolicyValue srvalue)
+ {
+ RequestProcessingStrategy* strategy = 0;
+
+ switch (value)
+ {
+ case ::PortableServer::USE_SERVANT_MANAGER :
+ {
+ switch (srvalue)
+ {
+ case ::PortableServer::RETAIN :
+ {
+ ACE_ERROR ((LM_ERROR, "Incorrect type in RequestProcessingStrategyServantLocatorFactoryImpl"));
+ break;
+ }
+ case ::PortableServer::NON_RETAIN :
+ {
+ ACE_NEW_RETURN (strategy, RequestProcessingStrategyServantLocator, 0);
+ break;
+ }
+ }
+ break;
+ }
+ default :
+ {
+ ACE_ERROR ((LM_ERROR, "Incorrect type in RequestProcessingStrategyServantLocatorFactoryImpl"));
+ break;
+ }
+ }
+
+ return strategy;
+ }
+
+ void
+ RequestProcessingStrategyServantLocatorFactoryImpl::destroy (
+ RequestProcessingStrategy *strategy
+ ACE_ENV_ARG_DECL)
+ {
+ strategy->strategy_cleanup (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ delete strategy;
+ }
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DEFINE (
+ RequestProcessingStrategyServantLocatorFactoryImpl,
+ ACE_TEXT ("RequestProcessingStrategyServantLocatorFactory"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (RequestProcessingStrategyServantLocatorFactoryImpl),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0)
+
+ACE_FACTORY_NAMESPACE_DEFINE (
+ ACE_Local_Service,
+ RequestProcessingStrategyServantLocatorFactoryImpl,
+ TAO::Portable_Server::RequestProcessingStrategyServantLocatorFactoryImpl)
+
+
+#endif /* TAO_HAS_MINIMUM_POA == 0 */
+
diff --git a/TAO/tao/PortableServer/RequestProcessingStrategyServantLocatorFI.h b/TAO/tao/PortableServer/RequestProcessingStrategyServantLocatorFI.h
new file mode 100644
index 00000000000..adce55b71f2
--- /dev/null
+++ b/TAO/tao/PortableServer/RequestProcessingStrategyServantLocatorFI.h
@@ -0,0 +1,58 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file RequestProcessingStrategyServantLocatorFI.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_PORTABLESERVER_REQUESTPROCESSINGSTRATEGYSERVANTLOCATORFACTORYIMPL_H
+#define TAO_PORTABLESERVER_REQUESTPROCESSINGSTRATEGYSERVANTLOCATORFACTORYIMPL_H
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/Service_Config.h"
+#include "tao/PortableServer/RequestProcessingStrategyFactory.h"
+
+#if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ class TAO_PortableServer_Export RequestProcessingStrategyServantLocatorFactoryImpl
+ : public RequestProcessingStrategyFactory
+ {
+ public:
+ /// Create a new servant retention strategy
+ virtual RequestProcessingStrategy* create (
+ ::PortableServer::RequestProcessingPolicyValue value,
+ ::PortableServer::ServantRetentionPolicyValue srvalue);
+
+ virtual void destroy (
+ RequestProcessingStrategy *strategy
+ ACE_ENV_ARG_DECL);
+ };
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE_EXPORT (TAO_PortableServer, RequestProcessingStrategyServantLocatorFactoryImpl)
+ACE_FACTORY_DECLARE (TAO_PortableServer, RequestProcessingStrategyServantLocatorFactoryImpl)
+
+#endif /* TAO_HAS_MINIMUM_POA == 0 */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_PORTABLESERVER_REQUESTPROCESSINGSTRATEGYSERVANTLOCATORFACTORYIMPL_H */
diff --git a/TAO/tao/PortableServer/RequestProcessingStrategyServantManager.cpp b/TAO/tao/PortableServer/RequestProcessingStrategyServantManager.cpp
new file mode 100644
index 00000000000..60cd7eb033f
--- /dev/null
+++ b/TAO/tao/PortableServer/RequestProcessingStrategyServantManager.cpp
@@ -0,0 +1,102 @@
+// -*- C++ -*-
+
+#include "tao/PortableServer/RequestProcessingStrategyServantManager.h"
+#include "tao/PortableServer/ServantManagerC.h"
+#include "tao/PortableServer/Root_POA.h"
+#include "tao/ORB_Constants.h"
+
+ACE_RCSID (PortableServer,
+ Request_Processing,
+ "$Id$")
+
+#if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ RequestProcessingStrategyServantManager::RequestProcessingStrategyServantManager (void)
+ {
+ }
+
+ PortableServer::Servant
+ RequestProcessingStrategyServantManager::get_servant (
+ ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongPolicy))
+ {
+ ACE_THROW_RETURN (PortableServer::POA::WrongPolicy (),
+ 0);
+ }
+
+ void
+ RequestProcessingStrategyServantManager::set_servant (
+ PortableServer::Servant servant
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongPolicy))
+ {
+ ACE_UNUSED_ARG (servant);
+
+ ACE_THROW (PortableServer::POA::WrongPolicy ());
+ }
+
+ void
+ RequestProcessingStrategyServantManager::validate_servant_manager (
+ PortableServer::ServantManager_ptr servant_manager
+ ACE_ENV_ARG_DECL)
+ {
+ // When no servant manager is set, give an exception with minor code 4,
+ // see 11.3.8.6 of the corba spec
+ if (CORBA::is_nil (servant_manager))
+ {
+ ACE_THROW (CORBA::OBJ_ADAPTER (CORBA::OMGVMCID | 4,
+ CORBA::COMPLETED_NO));
+ }
+ }
+
+ PortableServer::Servant
+ RequestProcessingStrategyServantManager::system_id_to_servant (
+ const PortableServer::ObjectId &system_id
+ ACE_ENV_ARG_DECL)
+ {
+ return this->poa_->find_servant (system_id
+ ACE_ENV_ARG_PARAMETER);
+ }
+
+ PortableServer::ObjectId *
+ RequestProcessingStrategyServantManager::servant_to_id (
+ PortableServer::Servant servant
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ServantNotActive,
+ PortableServer::POA::WrongPolicy))
+ {
+ return this->poa_->servant_to_user_id (servant ACE_ENV_ARG_PARAMETER);
+ }
+
+ PortableServer::Servant
+ RequestProcessingStrategyServantManager::id_to_servant (
+ const PortableServer::ObjectId &id
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ObjectNotActive,
+ PortableServer::POA::WrongPolicy))
+ {
+ return this->poa_->user_id_to_servant_i (id ACE_ENV_ARG_PARAMETER);
+ }
+
+ ::PortableServer::RequestProcessingPolicyValue
+ RequestProcessingStrategyServantManager::type() const
+ {
+ return ::PortableServer::USE_SERVANT_MANAGER;
+ }
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_MINIMUM_POA == 0 */
+
diff --git a/TAO/tao/PortableServer/RequestProcessingStrategyServantManager.h b/TAO/tao/PortableServer/RequestProcessingStrategyServantManager.h
new file mode 100644
index 00000000000..ee152e2585e
--- /dev/null
+++ b/TAO/tao/PortableServer/RequestProcessingStrategyServantManager.h
@@ -0,0 +1,80 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file RequestProcessingStrategyServantManager.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_REQUESTPROCESSINGSTRATEGYSERVANTMANAGER_H
+#define TAO_REQUESTPROCESSINGSTRATEGYSERVANTMANAGER_H
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/RequestProcessingStrategy.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/Servant_Location.h"
+#include "tao/PortableServer/PortableServer.h"
+
+#if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ class RequestProcessingStrategyServantManager
+ : public RequestProcessingStrategy
+ {
+ public:
+ RequestProcessingStrategyServantManager (void);
+
+ PortableServer::Servant get_servant (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongPolicy));
+
+ void set_servant (PortableServer::Servant servant ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongPolicy));
+
+ void validate_servant_manager (
+ PortableServer::ServantManager_ptr servant_manager
+ ACE_ENV_ARG_DECL);
+
+ virtual PortableServer::Servant system_id_to_servant (
+ const PortableServer::ObjectId &system_id
+ ACE_ENV_ARG_DECL);
+
+ virtual PortableServer::Servant id_to_servant (
+ const PortableServer::ObjectId &id
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ObjectNotActive,
+ PortableServer::POA::WrongPolicy));
+
+ virtual PortableServer::ObjectId *servant_to_id (
+ PortableServer::Servant servant
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ServantNotActive,
+ PortableServer::POA::WrongPolicy));
+
+ virtual ::PortableServer::RequestProcessingPolicyValue type() const;
+ };
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_MINIMUM_POA == 0 */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_REQUESTPROCESSINGSTRATEGYSERVANTMANAGER_H */
diff --git a/TAO/tao/PortableServer/Root_POA.cpp b/TAO/tao/PortableServer/Root_POA.cpp
new file mode 100644
index 00000000000..a1fa33136ac
--- /dev/null
+++ b/TAO/tao/PortableServer/Root_POA.cpp
@@ -0,0 +1,2985 @@
+// $Id$
+
+#include "tao/PortableServer/Root_POA.h"
+#include "tao/PortableServer/Regular_POA.h"
+
+#include "tao/PortableServer/ThreadPolicy.h"
+#include "tao/PortableServer/LifespanPolicy.h"
+#include "tao/PortableServer/IdAssignmentPolicy.h"
+#include "tao/PortableServer/IdUniquenessPolicy.h"
+#include "tao/PortableServer/ImplicitActivationPolicy.h"
+#include "tao/PortableServer/RequestProcessingPolicy.h"
+#include "tao/PortableServer/ServantRetentionPolicy.h"
+#include "tao/PortableServer/Active_Object_Map.h"
+#include "tao/PortableServer/Default_Acceptor_Filter.h"
+#include "tao/PortableServer/ORT_Adapter.h"
+#include "tao/PortableServer/ORT_Adapter_Factory.h"
+#include "tao/PortableServer/POA_Current_Impl.h"
+#include "tao/PortableServer/Servant_Upcall.h"
+#include "tao/PortableServer/AdapterActivatorC.h"
+#include "tao/PortableServer/Non_Servant_Upcall.h"
+#include "tao/PortableServer/POAManager.h"
+#include "tao/PortableServer/POAManagerFactory.h"
+#include "tao/PortableServer/ServantManagerC.h"
+#include "tao/PortableServer/poa_macros.h"
+#include "tao/PortableServer/POA_Guard.h"
+#include "tao/PortableServer/Creation_Time.h"
+#include "tao/PortableServer/RequestProcessingStrategy.h"
+#include "tao/PortableServer/LifespanStrategy.h"
+#include "tao/PortableServer/IdUniquenessStrategy.h"
+#include "tao/PortableServer/IdAssignmentStrategy.h"
+#include "tao/PortableServer/ServantRetentionStrategy.h"
+#include "tao/PortableServer/ImplicitActivationStrategy.h"
+#include "tao/PortableServer/ThreadStrategy.h"
+#include "tao/PortableServer/Acceptor_Filter_Factory.h"
+
+#include "tao/StringSeqC.h"
+#include "tao/PortableInterceptorC.h"
+#include "tao/PolicyC.h"
+#include "tao/ORB_Core.h"
+#include "tao/ORB.h"
+#include "tao/Server_Strategy_Factory.h"
+#include "tao/Acceptor_Registry.h"
+#include "tao/Thread_Lane_Resources.h"
+#include "tao/Environment.h"
+#include "tao/Exception.h"
+#include "tao/Stub.h"
+#include "tao/Profile.h"
+#include "tao/TSS_Resources.h"
+#include "tao/IORInterceptor_Adapter.h"
+#include "tao/debug.h"
+
+// auto_ptr class
+#include "ace/Auto_Ptr.h"
+#include "ace/Dynamic_Service.h"
+#include "ace/OS_NS_netdb.h"
+#include "ace/OS_NS_string.h"
+#include "ace/OS_NS_unistd.h"
+#include "ace/Log_Msg.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/PortableServer/Root_POA.inl"
+#endif /* ! __ACE_INLINE__ */
+
+ACE_RCSID (PortableServer,
+ Root_POA,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// This is the TAO_Object_key-prefix that is appended to all TAO Object keys.
+// It's an array of octets representing ^t^a^o/0 in octal.
+CORBA::Octet const
+TAO_Root_POA::objectkey_prefix [TAO_Root_POA::TAO_OBJECTKEY_PREFIX_SIZE] = {
+ 024, // octal for ^t
+ 001, // octal for ^a
+ 017, // octal for ^o
+ 000
+};
+
+#if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
+
+PortableServer::ThreadPolicy_ptr
+TAO_Root_POA::create_thread_policy (PortableServer::ThreadPolicyValue value
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ TAO::Portable_Server::ThreadPolicy *policy = 0;
+ ACE_NEW_THROW_EX (policy,
+ TAO::Portable_Server::ThreadPolicy (value),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (PortableServer::ThreadPolicy::_nil ());
+
+ return policy;
+}
+
+#endif /* TAO_HAS_MINIMUM_POA == 0 && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO) */
+
+#if !defined (CORBA_E_MICRO)
+
+PortableServer::LifespanPolicy_ptr
+TAO_Root_POA::create_lifespan_policy (PortableServer::LifespanPolicyValue value
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ TAO::Portable_Server::LifespanPolicy *policy = 0;
+ ACE_NEW_THROW_EX (policy,
+ TAO::Portable_Server::LifespanPolicy (value),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (PortableServer::LifespanPolicy::_nil ());
+
+ return policy;
+}
+
+#endif
+
+#if !defined (CORBA_E_MICRO)
+PortableServer::IdUniquenessPolicy_ptr
+TAO_Root_POA::create_id_uniqueness_policy (PortableServer::IdUniquenessPolicyValue value
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ TAO::Portable_Server::IdUniquenessPolicy *policy = 0;
+ ACE_NEW_THROW_EX (policy,
+ TAO::Portable_Server::IdUniquenessPolicy (value),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (PortableServer::IdUniquenessPolicy::_nil ());
+
+ return policy;
+}
+#endif
+
+#if !defined (CORBA_E_MICRO)
+PortableServer::IdAssignmentPolicy_ptr
+TAO_Root_POA::create_id_assignment_policy (PortableServer::IdAssignmentPolicyValue value
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ TAO::Portable_Server::IdAssignmentPolicy *policy = 0;
+ ACE_NEW_THROW_EX (policy,
+ TAO::Portable_Server::IdAssignmentPolicy (value),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (PortableServer::IdAssignmentPolicy::_nil ());
+
+ return policy;
+}
+#endif
+
+#if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
+
+PortableServer::ImplicitActivationPolicy_ptr
+TAO_Root_POA::create_implicit_activation_policy (PortableServer::ImplicitActivationPolicyValue value
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ TAO::Portable_Server::ImplicitActivationPolicy *policy = 0;
+ ACE_NEW_THROW_EX (policy,
+ TAO::Portable_Server::ImplicitActivationPolicy (value),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (PortableServer::ImplicitActivationPolicy::_nil ());
+
+ return policy;
+}
+
+PortableServer::ServantRetentionPolicy_ptr
+TAO_Root_POA::create_servant_retention_policy (PortableServer::ServantRetentionPolicyValue value
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ TAO::Portable_Server::ServantRetentionPolicy *policy = 0;
+ ACE_NEW_THROW_EX (policy,
+ TAO::Portable_Server::ServantRetentionPolicy (value),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (PortableServer::ServantRetentionPolicy::_nil ());
+
+ return policy;
+}
+
+PortableServer::RequestProcessingPolicy_ptr
+TAO_Root_POA::create_request_processing_policy (PortableServer::RequestProcessingPolicyValue value
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ TAO::Portable_Server::RequestProcessingPolicy *policy = 0;
+ ACE_NEW_THROW_EX (policy,
+ TAO::Portable_Server::RequestProcessingPolicy (value),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (PortableServer::RequestProcessingPolicy::_nil ());
+
+ return policy;
+}
+
+#endif /* TAO_HAS_MINIMUM_POA == 0 */
+
+void
+TAO_Root_POA::set_obj_ref_factory (
+ PortableInterceptor::ObjectReferenceFactory *current_factory
+ ACE_ENV_ARG_DECL)
+{
+ TAO::ORT_Adapter *adapter = this->ORT_adapter (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (adapter)
+ {
+ // Activate a different factory
+ this->ort_adapter_->set_obj_ref_factory (current_factory
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+}
+
+TAO_Root_POA::TAO_Root_POA (const TAO_Root_POA::String &name,
+ PortableServer::POAManager_ptr poa_manager,
+ const TAO_POA_Policy_Set &policies,
+ TAO_Root_POA *parent,
+ ACE_Lock &lock,
+ TAO_SYNCH_MUTEX &thread_lock,
+ TAO_ORB_Core &orb_core,
+ TAO_Object_Adapter *object_adapter
+ ACE_ENV_ARG_DECL)
+ : name_ (name),
+ poa_manager_ (* (dynamic_cast <TAO_POA_Manager*> (poa_manager))),
+ poa_manager_factory_ (* (object_adapter->poa_manager_factory_)),
+ tagged_component_ (),
+ tagged_component_id_ (),
+ profile_id_array_ (0),
+ policies_ (policies),
+ ort_adapter_ (0),
+ adapter_state_ (PortableInterceptor::HOLDING),
+
+#if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
+
+ adapter_activator_ (),
+
+#endif /* TAO_HAS_MINIMUM_POA == 0 */
+
+ children_ (),
+ lock_ (lock),
+ orb_core_ (orb_core),
+ object_adapter_ (object_adapter),
+ cleanup_in_progress_ (0),
+ outstanding_requests_ (0),
+ outstanding_requests_condition_ (thread_lock),
+ wait_for_completion_pending_ (0),
+ waiting_destruction_ (0),
+ servant_deactivation_condition_ (thread_lock),
+ filter_factory_ (0),
+ caller_key_to_object_ (0),
+ servant_for_key_to_object_ (0)
+{
+ // Parse the policies that are used in the critical path in
+ // a cache.
+ this->cached_policies_.update (this->policies_
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+#if (TAO_HAS_MINIMUM_POA == 1)
+ // If this is the RootPOA, set the value of the ImplicitActivationPolicy
+ // to IMPLICIT_ACTIVATION since it is impossible to pass the policy
+ // as it is not compiled into the library.
+ //
+ // If the ImplicitActivationPolicy policy is ever compiled in the
+ // minimum POA builds, remove this code and remove the guards
+ // in Object_Adapter.cpp when changing the default policy for the
+ // RootPOA.
+ if (ACE_OS::strcmp (this->name_.c_str (),
+ TAO_DEFAULT_ROOTPOA_NAME) == 0)
+ {
+ this->cached_policies_.implicit_activation
+ (PortableServer::IMPLICIT_ACTIVATION);
+ }
+#endif /* TAO_HAS_MINIMUM_POA == 1 */
+
+ // Set the active strategies to be used by this POA
+ this->active_policy_strategies_.update (this->cached_policies_,
+ this
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Set the folded name of this POA.
+ this->set_folded_name (parent);
+
+ // Register self with manager.
+ int result = this->poa_manager_.register_poa (this);
+ if (result != 0)
+ {
+ ACE_THROW (CORBA::OBJ_ADAPTER ());
+ }
+
+ // Add self to Object Adapter class.
+ result =
+ this->object_adapter ().bind_poa (this->folded_name_,
+ this,
+ this->system_name_.out ());
+ if (result != 0)
+ {
+ // Remove from POA Manager in case of errors. No checks of
+ // further errors...
+ this->poa_manager_.remove_poa (this);
+
+ ACE_THROW (CORBA::OBJ_ADAPTER ());
+ }
+
+ // Set the id for this POA.
+ this->set_id (parent);
+
+ // Notify the Lifespan strategy of our startup
+ ACE_TRY
+ {
+ this->active_policy_strategies_.lifespan_strategy()->notify_startup (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ this->poa_manager_.remove_poa (this);
+ this->object_adapter ().unbind_poa (this,
+ this->folded_name_,
+ this->system_name_.in ());
+ ACE_RE_THROW;
+ }
+ ACE_ENDTRY;
+ ACE_CHECK;
+}
+
+TAO_Root_POA::~TAO_Root_POA (void)
+{
+}
+
+void
+TAO_Root_POA::complete_destruction_i (ACE_ENV_SINGLE_ARG_DECL)
+{
+ // No longer awaiting destruction.
+ this->waiting_destruction_ = 0;
+
+ // Remove POA from the POAManager.
+ int result = this->poa_manager_.remove_poa (this);
+
+ if (result != 0)
+ ACE_THROW (CORBA::OBJ_ADAPTER ());
+
+ // Remove POA from the Object Adapter.
+ result = this->object_adapter ().unbind_poa (this,
+ this->folded_name_,
+ this->system_name_.in ());
+ if (result != 0)
+ ACE_THROW (CORBA::OBJ_ADAPTER ());
+
+ // Cleanup all strategies
+ this->active_policy_strategies_.cleanup (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Forced cleanup. The new memory management scheme is evil and can
+ // lead to reference deadlock, i.e., POA holds object A, but POA
+ // cannot die because object A hold POA.
+ {
+ //
+ // If new things are added to this cleanup code, make sure to move
+ // the minimum CORBA #define after the declaration of
+ // <non_servant_upcall>.
+ //
+
+#if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
+
+ // ATTENTION: Trick locking here, see class header for details
+ TAO::Portable_Server::Non_Servant_Upcall non_servant_upcall (*this);
+ ACE_UNUSED_ARG (non_servant_upcall);
+
+ this->adapter_activator_ = PortableServer::AdapterActivator::_nil ();
+
+#endif /* TAO_HAS_MINIMUM_POA == 0 */
+
+ }
+
+ ::CORBA::release (this);
+}
+
+#if ! defined (CORBA_E_MICRO)
+PortableServer::POA_ptr
+TAO_Root_POA::create_POA_i (const char *adapter_name,
+ PortableServer::POAManager_ptr poa_manager,
+ const CORBA::PolicyList &policies
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::AdapterAlreadyExists,
+ PortableServer::POA::InvalidPolicy))
+{
+ // Initialize a TAO_POA_Policy_Set instance so that it contains the
+ // default POA policies.
+ TAO_POA_Policy_Set tao_policies (this->object_adapter ().default_poa_policies ());
+
+ // Merge policies from the ORB level.
+ this->object_adapter ().validator ().merge_policies (tao_policies.policies ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (PortableServer::POA::_nil ());
+
+ // Merge in any policies that the user may have specified.
+ tao_policies.merge_policies (policies
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (PortableServer::POA::_nil ());
+
+ // If any of the policy objects specified are not valid for the ORB
+ // implementation, if conflicting policy objects are specified, or
+ // if any of the specified policy objects require prior
+ // administrative action that has not been performed, an
+ // InvalidPolicy exception is raised containing the index in the
+ // policies parameter value of the first offending policy object.
+ tao_policies.validate_policies (this->object_adapter ().validator (),
+ this->orb_core_
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (PortableServer::POA::_nil ());
+
+ // If the poa_manager parameter is null, a new POAManager object is
+ // created and associated with the new POA. Otherwise, the specified
+ // POAManager object is associated with the new POA. The POAManager
+ // object can be obtained using the attribute name the_POAManager.
+
+ PortableServer::POAManager_var the_poa_manager;
+
+ if (CORBA::is_nil (poa_manager))
+ {
+ PortableServer::POA_var poa = PortableServer::POA::_duplicate (this);
+ PortableServer::POA_var root_poa;
+
+ // Find the RootPOA by traversing the POA hierarchy until the
+ // RootPOA is reached. The RootPOA has no parent.
+ while (!CORBA::is_nil (poa.in ()))
+ {
+ root_poa = poa;
+ poa = poa->the_parent (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (PortableServer::POA::_nil ());
+ }
+
+ // Get the POAManagerFactory instance owned by RootPOA.
+ PortableServer::POAManagerFactory_var tao_poa_manager_factory
+ = root_poa->the_POAManagerFactory ();
+
+ CORBA::PolicyList empty_policies;
+
+ // The POAManager name will be generated when the POAManager instance
+ // is created.
+ the_poa_manager
+ = tao_poa_manager_factory->create_POAManager (0,
+ empty_policies
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (PortableServer::POA::_nil ());
+ }
+ else
+ {
+ the_poa_manager = PortableServer::POAManager::_duplicate (poa_manager);
+ }
+
+ PortableServer::POA_var poa = this->create_POA_i (adapter_name,
+ the_poa_manager.in (),
+ tao_policies
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (PortableServer::POA::_nil ());
+
+ return poa._retn ();
+}
+#endif
+
+TAO_Root_POA *
+TAO_Root_POA::new_POA (const String &name,
+ PortableServer::POAManager_ptr poa_manager,
+ const TAO_POA_Policy_Set &policies,
+ TAO_Root_POA *parent,
+ ACE_Lock &lock,
+ TAO_SYNCH_MUTEX &thread_lock,
+ TAO_ORB_Core &orb_core,
+ TAO_Object_Adapter *object_adapter
+ ACE_ENV_ARG_DECL)
+{
+ TAO_Regular_POA *poa = 0;
+
+ ACE_NEW_THROW_EX (poa,
+ TAO_Regular_POA (name,
+ poa_manager,
+ policies,
+ parent,
+ lock,
+ thread_lock,
+ orb_core,
+ object_adapter
+ ACE_ENV_ARG_PARAMETER),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (0);
+
+ return poa;
+}
+
+#if ! defined (CORBA_E_MICRO)
+PortableServer::POA_ptr
+TAO_Root_POA::create_POA_i (const TAO_Root_POA::String &adapter_name,
+ PortableServer::POAManager_ptr poa_manager,
+ const TAO_POA_Policy_Set &policies
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::AdapterAlreadyExists,
+ PortableServer::POA::InvalidPolicy))
+{
+ // This operaton creates a new POA as a child of the target POA. The
+ // specified name identifies the new POA with respect to other POAs
+ // with the same parent POA. If the target POA already has a child
+ // POA with the specified name, the AdapterAlreadyExists exception
+ // is raised.
+ int result = this->children_.find (adapter_name);
+
+ // Child was found
+ if (result != -1)
+ {
+ ACE_THROW_RETURN (PortableServer::POA::AdapterAlreadyExists (),
+ PortableServer::POA::_nil ());
+ }
+
+ //
+ // Child was not found. Create one.
+ //
+
+ // The specified policy objects are associated with the POA and used
+ // to control its behavior. The policy objects are effectively
+ // copied before this operation returns, so the application is free
+ // to destroy them while the POA is in use. Policies are not
+ // inherited from the parent POA.
+ TAO_Root_POA * poa = this->new_POA (adapter_name,
+ poa_manager,
+ policies,
+ this,
+ this->object_adapter ().lock (),
+ this->object_adapter ().thread_lock (),
+ this->orb_core_,
+ this->object_adapter_
+ ACE_ENV_ARG_PARAMETER);
+
+ // Give ownership of the new map to the POA_var. Note, that it
+ // is important for the POA_var to take ownership before
+ // checking for exception since we may need to delete the new map.
+ PortableServer::POA_var new_poa = poa;
+
+ // Check for exception in construction of the POA.
+ ACE_CHECK_RETURN (PortableServer::POA::_nil ());
+
+ // Add to children map
+ result = this->children_.bind (adapter_name,
+ poa);
+ if (result != 0)
+ {
+ ACE_THROW_RETURN (CORBA::OBJ_ADAPTER (),
+ PortableServer::POA::_nil ());
+ }
+
+ // Increment the reference count on the child POA since the children
+ // map must retain ownership. Do so immediately before any other
+ // operations to prevent memory cleanup problems induced from
+ // errors below.
+ poa->_add_ref ();
+
+ // Iterate over the registered IOR interceptors so that they may be
+ // given the opportunity to add tagged components to the profiles
+ // for this servant.
+ poa->establish_components (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (PortableServer::POA::_nil ());
+
+ // Note: Creating a POA using a POA manager that is in the active
+ // state can lead to race conditions if the POA supports preexisting
+ // objects, because the new POA may receive a request before its
+ // adapter activator, servant manager, or default servant have been
+ // initialized. These problems do not occur if the POA is created by
+ // an adapter activator registered with a parent of the new POA,
+ // because requests are queued until the adapter activator
+ // returns. To avoid these problems when a POA must be explicitly
+ // initialized, the application can initialize the POA by invoking
+ // find_POA with a TRUE activate parameter.
+
+ // Everything is fine. Don't let the POA_var release the
+ // implementation.
+ return new_poa._retn ();
+}
+#endif
+
+#if ! defined (CORBA_E_MICRO)
+PortableServer::POA_ptr
+TAO_Root_POA::find_POA (const char *adapter_name,
+ CORBA::Boolean activate_it
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::AdapterNonExistent))
+{
+ // Lock access for the duration of this transaction.
+ TAO_POA_GUARD_RETURN (0);
+
+ TAO_Root_POA *poa = this->find_POA_i (adapter_name,
+ activate_it
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (PortableServer::POA::_nil ());
+
+ return PortableServer::POA::_duplicate (poa);
+}
+#endif
+
+#if ! defined (CORBA_E_MICRO)
+TAO_Root_POA *
+TAO_Root_POA::find_POA_i (const ACE_CString &child_name,
+ CORBA::Boolean activate_it
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::AdapterNonExistent))
+{
+ TAO_Root_POA *child = 0;
+ int result = this->children_.find (child_name,
+ child);
+
+#if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT)
+
+ if (result != 0)
+ {
+ if (activate_it)
+ {
+ if (!CORBA::is_nil (this->adapter_activator_.in ()))
+ {
+ // Check our state
+ this->check_state (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ CORBA::Boolean success = false;
+ ACE_TRY_EX (UnknownAdapter)
+ {
+ // ATTENTION: Trick locking here, see class header for details
+ TAO::Portable_Server::Non_Servant_Upcall non_servant_upcall (
+ *this);
+ ACE_UNUSED_ARG (non_servant_upcall);
+
+ // When unknown_adapter gives a system exception, the POA
+ // should raise OBJ_ADAPTER with standard minor code 1.
+ // See 11.3.9.2 of the Corba spec
+ success =
+ this->adapter_activator_->unknown_adapter (
+ this,
+ child_name.c_str ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK_EX (UnknownAdapter);
+ }
+ ACE_CATCH (CORBA::SystemException, ex)
+ {
+ ACE_TRY_THROW_EX (CORBA::OBJ_ADAPTER (CORBA::OMGVMCID | 1,
+ CORBA::COMPLETED_NO),
+ UnknownAdapter);
+ }
+ ACE_ENDTRY;
+ ACE_CHECK_RETURN (0);
+
+ if (success)
+ {
+ result = this->children_.find (child_name,
+ child);
+ }
+ else
+ {
+ result = -1;
+ }
+ }
+ else
+ {
+ result = -1;
+ }
+ }
+ else
+ {
+ result = -1;
+ }
+ }
+#else
+ ACE_UNUSED_ARG (activate_it);
+#endif /* TAO_HAS_MINIMUM_POA == 0 */
+
+ if (result == 0)
+ {
+ return child;
+ }
+ else
+ {
+ // Otherwise, the AdapterNonExistent exception is raised.
+ ACE_THROW_RETURN (PortableServer::POA::AdapterNonExistent (),
+ 0);
+ }
+}
+#endif
+
+TAO_POA_Manager &
+TAO_Root_POA::tao_poa_manager ()
+{
+ return poa_manager_;
+}
+
+#if ! defined (CORBA_E_MICRO)
+PortableServer::POA_ptr
+TAO_Root_POA::create_POA (const char *adapter_name,
+ PortableServer::POAManager_ptr poa_manager,
+ const CORBA::PolicyList &policies
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::AdapterAlreadyExists,
+ PortableServer::POA::InvalidPolicy))
+{
+ // Lock access for the duration of this transaction.
+ TAO_POA_GUARD_RETURN (0);
+
+ return this->create_POA_i (adapter_name,
+ poa_manager,
+ policies
+ ACE_ENV_ARG_PARAMETER);
+}
+#endif
+
+PortableServer::ObjectId *
+TAO_Root_POA::servant_to_id (PortableServer::Servant servant
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ServantNotActive,
+ PortableServer::POA::WrongPolicy))
+{
+ // If we had upgradeable locks, this would initially be a read lock
+ //
+ // Lock access for the duration of this transaction.
+ TAO_POA_GUARD_RETURN (0);
+
+ return this->servant_to_id_i (servant
+ ACE_ENV_ARG_PARAMETER);
+}
+
+PortableServer::ObjectId *
+TAO_Root_POA::servant_to_user_id (PortableServer::Servant servant
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ServantNotActive,
+ PortableServer::POA::WrongPolicy))
+{
+ return this->active_policy_strategies_.servant_retention_strategy()->
+ servant_to_user_id (servant ACE_ENV_ARG_PARAMETER);
+}
+
+PortableServer::Servant
+TAO_Root_POA::reference_to_servant (CORBA::Object_ptr reference
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ObjectNotActive,
+ PortableServer::POA::WrongAdapter,
+ PortableServer::POA::WrongPolicy))
+{
+ // Lock access for the duration of this transaction.
+ TAO_POA_GUARD_RETURN (0);
+
+ return this->reference_to_servant_i (reference
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::Object_ptr
+TAO_Root_POA::servant_to_reference (PortableServer::Servant servant
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ServantNotActive,
+ PortableServer::POA::WrongPolicy))
+{
+ TAO_POA_GUARD_RETURN (CORBA::Object::_nil ());
+
+ return this->servant_to_reference_i (servant
+ ACE_ENV_ARG_PARAMETER);
+}
+
+PortableServer::POAList *
+TAO_Root_POA::the_children (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ // Lock access for the duration of this transaction.
+ TAO_POA_GUARD_RETURN (0);
+
+ return this->the_children_i (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+
+PortableServer::Servant
+TAO_Root_POA::id_to_servant (const PortableServer::ObjectId &oid
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ObjectNotActive,
+ PortableServer::POA::WrongPolicy))
+{
+ // Lock access for the duration of this transaction.
+ TAO_POA_GUARD_RETURN (0);
+
+ return this->id_to_servant_i (oid
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::Object_ptr
+TAO_Root_POA::id_to_reference (const PortableServer::ObjectId &oid
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ObjectNotActive,
+ PortableServer::POA::WrongPolicy))
+{
+ // Lock access for the duration of this transaction.
+ TAO_POA_GUARD_RETURN (0);
+
+ return this->id_to_reference_i (oid, true ACE_ENV_ARG_PARAMETER);
+}
+
+
+CORBA::Object_ptr
+TAO_Root_POA::create_reference_with_id (const PortableServer::ObjectId &id,
+ const char *intf
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ // Lock access for the duration of this transaction.
+ TAO_POA_GUARD_RETURN (CORBA::Object::_nil ());
+
+ return this->create_reference_with_id_i (id,
+ intf,
+ this->server_priority ()
+ ACE_ENV_ARG_PARAMETER);
+}
+
+
+void
+TAO_Root_POA::destroy (CORBA::Boolean etherealize_objects,
+ CORBA::Boolean wait_for_completion
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ // Lock access for the duration of this transaction.
+ TAO::Portable_Server::POA_Guard poa_guard (*this ACE_ENV_ARG_PARAMETER, 0);
+ ACE_CHECK;
+ ACE_UNUSED_ARG (poa_guard);
+
+ this->destroy_i (etherealize_objects,
+ wait_for_completion
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+void
+TAO_Root_POA::remove_from_parent_i (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+{
+ // The root poa has no parent, so this is a noop
+}
+
+void
+TAO_Root_POA::destroy_i (CORBA::Boolean etherealize_objects,
+ CORBA::Boolean wait_for_completion
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ if (this->cleanup_in_progress_)
+ return;
+
+ // Is the <wait_for_completion> semantics for this thread correct?
+ TAO_Root_POA::check_for_valid_wait_for_completions (this->orb_core (),
+ wait_for_completion
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->cleanup_in_progress_ = 1;
+
+ // Inform the custom servant dispatching strategy to stop the working
+ // threads when the poa is destroyed.
+ this->poa_deactivated_hook ();
+
+ // This operation destroys the POA and all descendant POAs. The POA
+ // so destroyed (that is, the POA with its name) may be re-created
+ // later in the same process. (This differs from the
+ // POAManager::deactivate operation that does not allow a
+ // re-creation of its associated POA in the same process.)
+
+ // Remove POA from the parent
+ this->remove_from_parent_i (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ TAO::ORT_Array array_obj_ref_template (1);
+
+ CORBA::ULong i = 0;
+
+ // Gather all ObjectReferenceTemplates and change all adapter states
+ // to INACTIVE.
+ for (CHILDREN::iterator iterator = this->children_.begin ();
+ iterator != this->children_.end ();
+ ++iterator)
+ {
+ TAO_Root_POA * const child_poa = (*iterator).int_id_;
+
+ TAO::ORT_Adapter * const adapter = child_poa->ORT_adapter_i ();
+
+ // In case no ORT library is linked we get zero.
+ if (adapter != 0)
+ {
+ // Get the ObjectReferenceTemplate for the child POA.
+ PortableInterceptor::ObjectReferenceTemplate * const ort =
+ adapter->get_adapter_template ();
+
+ // Add it to the sequence of object reference templates that
+ // will be destroyed.
+ array_obj_ref_template.size (1);
+
+ array_obj_ref_template[0] = ort;
+ }
+
+ child_poa->adapter_state_ =
+ PortableInterceptor::INACTIVE;
+
+ // Notify the state changes to the IORInterceptors
+ this->adapter_state_changed (array_obj_ref_template,
+ PortableInterceptor::INACTIVE
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (adapter != 0)
+ adapter->release (array_obj_ref_template[0]);
+
+ ++i;
+ }
+
+ // Destroy all child POA's now.
+ for (CHILDREN::iterator destroy_iterator = this->children_.begin ();
+ destroy_iterator != this->children_.end ();
+ ++destroy_iterator)
+ {
+ TAO_Root_POA *destroy_child_poa = (*destroy_iterator).int_id_;
+
+ destroy_child_poa->destroy_i (etherealize_objects,
+ wait_for_completion
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ // Notify the lifespan strategy of our shutdown
+ this->active_policy_strategies_.lifespan_strategy()->notify_shutdown (
+ ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+// @todo, is the exception handling above correct, should we just fail when
+// the notify above fails
+
+ // When a POA is destroyed, any requests that have started execution
+ // continue to completion. Any requests that have not started
+ // execution are processed as if they were newly arrived, that is,
+ // the POA will attempt to cause recreation of the POA by invoking
+ // one or more adapter activators as described in Section 3.3.3.
+ // If the wait_for_completion parameter is TRUE, the destroy
+ // operation will return only after all requests in process have
+ // completed and all invocations of etherealize have
+ // completed. Otherwise, the destroy operation returns after
+ // destroying the POAs.
+
+ this->deactivate_all_objects_i (etherealize_objects,
+ wait_for_completion
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // If there are no outstanding requests and that we are not in a
+ // non-servant upcall or if we are in a non-servant upcall, make
+ // sure we are the POA related to the non-servant upcall.
+ TAO::Portable_Server::Non_Servant_Upcall *non_servant_upcall_in_progress =
+ this->object_adapter ().non_servant_upcall_in_progress ();
+ if (this->outstanding_requests_ == 0 &&
+ (non_servant_upcall_in_progress == 0 ||
+ &non_servant_upcall_in_progress->poa () != this))
+ {
+ TAO::ORT_Array my_array_obj_ref_template;
+
+ TAO::ORT_Adapter * const ort_adapter =
+ this->ORT_adapter_i ();
+
+ // In case no ORT library is linked we get zero.
+ if (ort_adapter != 0)
+ {
+ // Get the ObjectReferenceTemplate.
+ PortableInterceptor::ObjectReferenceTemplate * const ort =
+ ort_adapter->get_adapter_template ();
+
+ // Add it to the sequence of object reference templates, we
+ // just notify for ourselves that we are now non_existent,
+ // our childs will do it for themselves.
+ my_array_obj_ref_template.size (1);
+ my_array_obj_ref_template[0] = ort;
+ }
+
+ // According to the ORT spec, after a POA is destroyed, its state
+ // has to be changed to NON_EXISTENT and all the registered
+ // interceptors are to be informed. Since, the POA is destroyed
+ // and is released in the complete_destruction_i method, we are
+ // trying to keep the poa still around by doing a duplicate of
+ // it. (a hack).
+ PortableServer::POA_var poa = PortableServer::POA::_duplicate (this);
+
+ this->complete_destruction_i (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->adapter_state_ = PortableInterceptor::NON_EXISTENT;
+
+ this->adapter_state_changed (my_array_obj_ref_template,
+ this->adapter_state_
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (ort_adapter != 0)
+ {
+ ort_adapter->release (my_array_obj_ref_template[0]);
+
+ TAO::ORT_Adapter_Factory *ort_factory =
+ this->ORT_adapter_factory ();
+
+ ort_factory->destroy (ort_adapter);
+
+ this->ort_adapter_ = 0;
+ }
+ }
+ else
+ {
+ // Mark that we are ready for destruction.
+ this->waiting_destruction_ = 1;
+ }
+}
+
+int
+TAO_Root_POA::delete_child (const TAO_Root_POA::String &child)
+{
+ int result = 0;
+
+ // If we are not closing down, we must remove this child from our
+ // collection.
+ if (!this->cleanup_in_progress_)
+ result = this->children_.unbind (child);
+
+ // Otherwise, if we are closing down, we are currently iterating
+ // over our children and there is not need to remove this child from
+ // our collection.
+
+ return result;
+}
+
+PortableServer::POAList *
+TAO_Root_POA::the_children_i (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ PortableServer::POAList_var children;
+ CORBA::ULong child_current = static_cast <CORBA::ULong>
+ (this->children_.current_size ());
+ ACE_NEW_THROW_EX (children,
+ PortableServer::POAList (child_current),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (0);
+
+ children->length (child_current);
+
+ CORBA::ULong index = 0;
+ for (CHILDREN::iterator iterator = this->children_.begin ();
+ iterator != this->children_.end ();
+ ++iterator, ++index)
+ {
+ TAO_Root_POA *child_poa = (*iterator).int_id_;
+ children[index] = PortableServer::POA::_duplicate (child_poa);
+ }
+
+ return children._retn ();
+}
+
+PortableInterceptor::AdapterName *
+TAO_Root_POA::adapter_name_i (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ // The adapter name is the sequence of names starting from the
+ // RootPOA to the one whose name is requested. The name of the
+ // RootPOA is "RootPOA".
+
+ PortableServer::POA_var poa = PortableServer::POA::_duplicate (this);
+
+ CORBA::ULong len = 0;
+
+ // Find the length of the adapter name sequence by traversing the
+ // POA hierarchy until the RootPOA is reached. The RootPOA has no
+ // parent.
+ while (!CORBA::is_nil (poa.in ()))
+ {
+ poa = poa->the_parent (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ ++len;
+ }
+
+ // Empty adapter name sequence.
+ PortableInterceptor::AdapterName *names = 0;
+ ACE_NEW_THROW_EX (names,
+ PortableInterceptor::AdapterName (len),
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (0);
+
+ PortableInterceptor::AdapterName_var safe_names (names);
+
+ names->length (len);
+
+ poa = PortableServer::POA::_duplicate (this);
+
+ (*names)[0] = CORBA::string_dup ("RootPOA");
+
+ // Fill in the AdapterName sequence as the POA hierarchy is
+ // traversed.
+ CORBA::ULong ilen = len;
+ for (CORBA::ULong i = 1; i < len; ++i)
+ {
+ (*names)[--ilen] = poa->the_name (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ poa = poa->the_parent (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ // If this condition asserts, the POA hierarchy was modified
+ // (i.e. reduced in size) by another thread!
+ ACE_ASSERT ((ilen > 0 ? !CORBA::is_nil (poa.in ()) : 1));
+ }
+
+ return safe_names._retn ();
+}
+
+void
+TAO_Root_POA::add_ior_component (TAO_MProfile & mprofile,
+ const IOP::TaggedComponent &component
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ // Add the given tagged component to all profiles.
+ const CORBA::ULong profile_count = mprofile.profile_count ();
+
+ for (CORBA::ULong i = 0; i < profile_count; ++i)
+ {
+ TAO_Profile *profile = mprofile.get_profile (i);
+
+ profile->add_tagged_component (component
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+}
+
+void
+TAO_Root_POA::add_ior_component_to_profile (
+ TAO_MProfile & mprofile,
+ const IOP::TaggedComponent &component,
+ IOP::ProfileId profile_id
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ // Add the given tagged component to all profiles matching the given
+ // ProfileId.
+ bool found_profile = false;
+
+ CORBA::ULong const profile_count = mprofile.profile_count ();
+
+ for (CORBA::ULong i = 0; i < profile_count; ++i)
+ {
+ TAO_Profile *profile = mprofile.get_profile (i);
+
+ if (profile->tag () == profile_id)
+ {
+ profile->add_tagged_component (component
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ found_profile = true;
+ }
+ }
+
+ // According to the Portable Interceptor specification, we're
+ // supposed to throw a CORBA::BAD_PARAM exception if no profile
+ // matched the given ProfileId.
+ if (found_profile == false)
+ ACE_THROW (CORBA::BAD_PARAM (CORBA::OMGVMCID | 29,
+ CORBA::COMPLETED_NO));
+}
+
+void
+TAO_Root_POA::adapter_state_changed (
+ const TAO::ORT_Array &array_obj_ref_template,
+ PortableInterceptor::AdapterState state
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ TAO_IORInterceptor_Adapter *ior_adapter =
+ this->orb_core_.ior_interceptor_adapter ();
+
+ if (ior_adapter)
+ {
+ ior_adapter->adapter_state_changed (array_obj_ref_template,
+ state
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+}
+
+PortableServer::ObjectId *
+TAO_Root_POA::activate_object_i (PortableServer::Servant servant,
+ CORBA::Short priority,
+ int &wait_occurred_restart_call
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ServantAlreadyActive,
+ PortableServer::POA::WrongPolicy))
+{
+ return this->active_policy_strategies_.servant_retention_strategy()->
+ activate_object (servant,
+ priority,
+ wait_occurred_restart_call
+ ACE_ENV_ARG_PARAMETER);
+}
+
+PortableServer::ObjectId *
+TAO_Root_POA::activate_object (PortableServer::Servant servant
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ServantAlreadyActive,
+ PortableServer::POA::WrongPolicy))
+{
+ while (1)
+ {
+ int wait_occurred_restart_call = 0;
+
+ // Lock access for the duration of this transaction.
+ TAO_POA_GUARD_RETURN (0);
+
+ PortableServer::ObjectId *result =
+ this->activate_object_i (servant,
+ this->server_priority (),
+ wait_occurred_restart_call
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ // If we ended up waiting on a condition variable, the POA state
+ // may have changed while we are waiting. Therefore, we need to
+ // restart this call.
+ if (wait_occurred_restart_call)
+ continue;
+ else
+ return result;
+ }
+}
+
+#if !defined (CORBA_E_MICRO)
+void
+TAO_Root_POA::activate_object_with_id (const PortableServer::ObjectId &id,
+ PortableServer::Servant servant
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ServantAlreadyActive,
+ PortableServer::POA::ObjectAlreadyActive,
+ PortableServer::POA::WrongPolicy))
+{
+ while (1)
+ {
+ int wait_occurred_restart_call = 0;
+
+ // Lock access for the duration of this transaction.
+ TAO_POA_GUARD;
+
+ this->activate_object_with_id_i (id,
+ servant,
+ this->server_priority (),
+ wait_occurred_restart_call
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // If we ended up waiting on a condition variable, the POA state
+ // may have changed while we are waiting. Therefore, we need to
+ // restart this call.
+ if (wait_occurred_restart_call)
+ continue;
+ else
+ return;
+ }
+}
+#endif
+
+#if !defined (CORBA_E_MICRO)
+void
+TAO_Root_POA::activate_object_with_id_i (const PortableServer::ObjectId &id,
+ PortableServer::Servant servant,
+ CORBA::Short priority,
+ int &wait_occurred_restart_call
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ServantAlreadyActive,
+ PortableServer::POA::ObjectAlreadyActive,
+ PortableServer::POA::WrongPolicy))
+{
+ this->active_policy_strategies_.servant_retention_strategy()->
+ activate_object_with_id (id,
+ servant,
+ priority,
+ wait_occurred_restart_call
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+#endif
+
+void
+TAO_Root_POA::deactivate_all_objects_i (CORBA::Boolean etherealize_objects,
+ CORBA::Boolean wait_for_completion
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongPolicy))
+{
+ this->deactivate_all_objects_i (etherealize_objects
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->wait_for_completions (wait_for_completion
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+void
+TAO_Root_POA::wait_for_completions (CORBA::Boolean wait_for_completion
+ ACE_ENV_ARG_DECL)
+{
+ while (this->object_adapter ().enable_locking_ &&
+ wait_for_completion &&
+ this->outstanding_requests_ > 0)
+ {
+ this->wait_for_completion_pending_ = 1;
+
+ int result = this->outstanding_requests_condition_.wait ();
+ if (result == -1)
+ {
+ ACE_THROW (CORBA::OBJ_ADAPTER ());
+ }
+ }
+}
+
+/* static */
+void
+TAO_Root_POA::check_for_valid_wait_for_completions (const TAO_ORB_Core &orb_core,
+ CORBA::Boolean wait_for_completion
+ ACE_ENV_ARG_DECL)
+{
+ if (wait_for_completion)
+ {
+ TAO::Portable_Server::POA_Current_Impl *poa_current_impl =
+ static_cast <TAO::Portable_Server::POA_Current_Impl *>
+ (TAO_TSS_Resources::instance ()->poa_current_impl_);
+
+ while (1)
+ {
+ // If wait_for_completion is TRUE and the current thread is
+ // in an invocation context dispatched from some POA
+ // belonging to the same ORB as this POA, the BAD_INV_ORDER
+ // system exception with standard minor code 3 is raised and
+ // POA destruction does not occur.
+ if (poa_current_impl != 0)
+ {
+ if (&orb_core == &poa_current_impl->orb_core ())
+ {
+ // CORBA 2.3 specifies which minor code corresponds
+ // to this particular problem.
+ ACE_THROW (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 3,
+ CORBA::COMPLETED_NO));
+ }
+ }
+ else
+ break;
+
+ poa_current_impl =
+ poa_current_impl->previous_current_impl_;
+ }
+ }
+}
+
+void
+TAO_Root_POA::deactivate_all_objects_i (CORBA::Boolean etherealize_objects
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongPolicy))
+{
+ this->active_policy_strategies_.request_processing_strategy ()->
+ etherealize_objects (etherealize_objects);
+
+ this->active_policy_strategies_.servant_retention_strategy ()->
+ deactivate_all_objects (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+void
+TAO_Root_POA::deactivate_object (const PortableServer::ObjectId &oid
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ObjectNotActive,
+ PortableServer::POA::WrongPolicy))
+{
+ // Lock access for the duration of this transaction.
+ TAO_POA_GUARD;
+
+ this->deactivate_object_i (oid
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+
+void
+TAO_Root_POA::deactivate_object_i (const PortableServer::ObjectId &id
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ObjectNotActive,
+ PortableServer::POA::WrongPolicy))
+{
+ this->active_policy_strategies_.servant_retention_strategy()->
+ deactivate_object (id
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+CORBA::Boolean
+TAO_Root_POA::is_persistent (void) const
+{
+ return active_policy_strategies_.lifespan_strategy()->is_persistent ();
+}
+
+CORBA::Object_ptr
+TAO_Root_POA::create_reference (const char *intf
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongPolicy))
+{
+ // Lock access for the duration of this transaction.
+ TAO_POA_GUARD_RETURN (CORBA::Object::_nil ());
+
+ return this->create_reference_i (intf,
+ this->server_priority ()
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::Object_ptr
+TAO_Root_POA::create_reference_i (const char *intf,
+ CORBA::Short priority
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongPolicy))
+{
+ if (!this->has_system_id ())
+ {
+ ACE_THROW_RETURN (PortableServer::POA::WrongPolicy (),
+ CORBA::Object::_nil ());
+ }
+
+ return this->active_policy_strategies_.servant_retention_strategy()->
+ create_reference (intf, priority ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::Object_ptr
+TAO_Root_POA::invoke_key_to_object_helper_i (const char * repository_id,
+ const PortableServer::ObjectId & id
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ const PortableInterceptor::ObjectId &user_oid =
+ reinterpret_cast <const PortableInterceptor::ObjectId &>(id);
+
+ // Ask the ORT to create the object.
+ if (this->ORT_adapter_i ())
+ {
+ // Ask the ORT to create the object.
+ return this->ort_adapter_->make_object (repository_id,
+ user_oid
+ ACE_ENV_ARG_PARAMETER);
+ }
+ else
+ {
+ return this->invoke_key_to_object (ACE_ENV_SINGLE_ARG_PARAMETER);
+ }
+}
+
+CORBA::Object_ptr
+TAO_Root_POA::create_reference_with_id_i (const PortableServer::ObjectId &user_id,
+ const char *intf,
+ CORBA::Short priority
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ // If the POA has the SYSTEM_ID policy and it detects that the
+ // Object Id value was not generated by the system or for this POA,
+ // the create_reference_with_id operation may raise the BAD_PARAM
+ // system exception. An ORB is not required to detect all such
+ // invalid Object Id values, but a portable application must not
+ // invoke this operation on a POA that has the SYSTEM_ID policy with
+ // an Object Id value that was not previously generated by the
+ // system for that POA, or, if the POA also has the PERSISTENT
+ // policy, for a previous instantiation of the same POA.
+ if (this->has_system_id () &&
+ !this->is_poa_generated_id (user_id))
+ {
+ ACE_THROW_RETURN (CORBA::BAD_PARAM (CORBA::OMGVMCID | 14,
+ CORBA::COMPLETED_NO),
+ CORBA::Object::_nil ());
+ }
+
+ return this->active_policy_strategies_.servant_retention_strategy()->
+ create_reference_with_id (user_id, intf, priority ACE_ENV_ARG_PARAMETER);
+}
+
+PortableServer::ObjectId *
+TAO_Root_POA::servant_to_id_i (PortableServer::Servant servant
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ServantNotActive,
+ PortableServer::POA::WrongPolicy))
+{
+ return this->active_policy_strategies_.request_processing_strategy()->
+ servant_to_id (servant ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::Object_ptr
+TAO_Root_POA::servant_to_reference_i (PortableServer::Servant servant
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ServantNotActive,
+ PortableServer::POA::WrongPolicy))
+{
+ return this->active_policy_strategies_.servant_retention_strategy()->
+ servant_to_reference (servant ACE_ENV_ARG_PARAMETER);
+}
+
+PortableServer::Servant
+TAO_Root_POA::reference_to_servant_i (CORBA::Object_ptr reference
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ObjectNotActive,
+ PortableServer::POA::WrongAdapter,
+ PortableServer::POA::WrongPolicy))
+{
+ // Make sure that the reference is valid.
+ if (CORBA::is_nil (reference))
+ {
+ ACE_THROW_RETURN (CORBA::BAD_PARAM (),
+ 0);
+ }
+
+ PortableServer::ObjectId system_id;
+ bool const is_generated =
+ this->is_poa_generated (reference, system_id ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ if (!is_generated)
+ {
+ // In case this object reference is not generated by this POA throw
+ // an exception
+ ACE_THROW_RETURN (PortableServer::POA::WrongAdapter (),
+ 0);
+ }
+
+ PortableServer::Servant servant =
+ this->active_policy_strategies_.request_processing_strategy()->
+ system_id_to_servant (system_id ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ if (servant != 0)
+ {
+ // ATTENTION: Trick locking here, see class header for details
+ TAO::Portable_Server::Non_Servant_Upcall non_servant_upcall (*this);
+ ACE_UNUSED_ARG (non_servant_upcall);
+
+ // The POA invokes _add_ref once on the Servant before returning
+ // it. If the application uses reference counting, the caller of
+ // id_to_servant is responsible for invoking _remove_ref once on
+ // the returned Servant when it is finished with it. A
+ // conforming caller need not invoke _remove_ref on the returned
+ // Servant if the type of the Servant uses the default reference
+ // counting inherited from ServantBase.
+ servant->_add_ref (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+ }
+
+ return servant;
+}
+
+bool
+TAO_Root_POA::is_poa_generated (CORBA::Object_ptr reference,
+ PortableServer::ObjectId &system_id
+ ACE_ENV_ARG_DECL)
+{
+ TAO::ObjectKey_var key = reference->_key (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ TAO_Object_Adapter::poa_name poa_system_name;
+ CORBA::Boolean is_root = false;
+ CORBA::Boolean is_persistent = false;
+ CORBA::Boolean is_system_id = false;
+ TAO::Portable_Server::Temporary_Creation_Time poa_creation_time;
+
+ int const result = this->parse_key (key.in (),
+ poa_system_name,
+ system_id,
+ is_root,
+ is_persistent,
+ is_system_id,
+ poa_creation_time);
+ if (result != 0 ||
+ !this->root () &&
+ poa_system_name != this->system_name () ||
+ is_root != this->root () ||
+ is_system_id != this->system_id () ||
+ !this->validate_lifespan (is_persistent, poa_creation_time))
+ {
+ // The passed reference is NOT generated by this POA
+ return false;
+ }
+ else
+ {
+ // The passed reference is generated by this POA
+ return true;
+ }
+}
+
+PortableServer::ObjectId *
+TAO_Root_POA::reference_to_id (CORBA::Object_ptr reference
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongAdapter,
+ PortableServer::POA::WrongPolicy))
+{
+ // Make sure that the reference is valid.
+ if (CORBA::is_nil (reference))
+ {
+ ACE_THROW_RETURN (CORBA::BAD_PARAM (),
+ 0);
+ }
+
+ // The WrongPolicy exception is declared to allow future extensions.
+
+ // This operation is valid only if the reference was created by the
+ // POA on which the operation is being performed. If the object
+ // reference was not created by this POA, the WrongAdapter exception
+ // is raised.
+ PortableServer::ObjectId system_id;
+ bool const is_generated = this->is_poa_generated (reference,
+ system_id
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ if (!is_generated)
+ {
+ ACE_THROW_RETURN (PortableServer::POA::WrongAdapter (),
+ 0);
+ }
+
+ // Lock access for the duration of this transaction.
+ TAO_POA_GUARD_RETURN (0);
+
+ return this->active_policy_strategies_.servant_retention_strategy()->
+ system_id_to_object_id (system_id ACE_ENV_ARG_PARAMETER);
+}
+
+PortableServer::Servant
+TAO_Root_POA::find_servant (const PortableServer::ObjectId &system_id
+ ACE_ENV_ARG_DECL)
+{
+ return this->active_policy_strategies_.servant_retention_strategy()->
+ find_servant (system_id ACE_ENV_ARG_PARAMETER);
+}
+
+int
+TAO_Root_POA::unbind_using_user_id (const PortableServer::ObjectId &user_id)
+{
+ return this->active_policy_strategies_.servant_retention_strategy()->
+ unbind_using_user_id (user_id);
+}
+
+void
+TAO_Root_POA::cleanup_servant (
+ PortableServer::Servant servant,
+ const PortableServer::ObjectId &user_id
+ ACE_ENV_ARG_DECL)
+{
+ this->active_policy_strategies_.request_processing_strategy()->
+ cleanup_servant (servant, user_id ACE_ENV_ARG_PARAMETER);
+}
+
+PortableServer::Servant
+TAO_Root_POA::id_to_servant_i (const PortableServer::ObjectId &id
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ObjectNotActive,
+ PortableServer::POA::WrongPolicy))
+{
+
+ PortableServer::Servant servant =
+ this->active_policy_strategies_.request_processing_strategy()->
+ id_to_servant (id ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ if (servant != 0)
+ {
+ // ATTENTION: Trick locking here, see class header for details
+ TAO::Portable_Server::Non_Servant_Upcall non_servant_upcall (*this);
+ ACE_UNUSED_ARG (non_servant_upcall);
+
+ // The POA invokes _add_ref once on the Servant before returning
+ // it. If the application uses reference counting, the caller of
+ // id_to_servant is responsible for invoking _remove_ref once on
+ // the returned Servant when it is finished with it. A
+ // conforming caller need not invoke _remove_ref on the returned
+ // Servant if the type of the Servant uses the default reference
+ // counting inherited from ServantBase.
+ servant->_add_ref (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+ }
+
+ return servant;
+}
+
+PortableServer::Servant
+TAO_Root_POA::user_id_to_servant_i (const PortableServer::ObjectId &id
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ObjectNotActive,
+ PortableServer::POA::WrongPolicy))
+{
+ return this->active_policy_strategies_.servant_retention_strategy()->
+ user_id_to_servant (id ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::Object_ptr
+TAO_Root_POA::id_to_reference_i (const PortableServer::ObjectId &id,
+ bool indirect
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ObjectNotActive,
+ PortableServer::POA::WrongPolicy))
+{
+ return this->active_policy_strategies_.servant_retention_strategy()->
+ id_to_reference (id, indirect ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::OctetSeq *
+TAO_Root_POA::id (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ CORBA::OctetSeq *id = 0;
+ ACE_NEW_THROW_EX (id,
+ CORBA::OctetSeq (this->id_),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (0);
+
+ return id;
+}
+
+PortableServer::Servant
+TAO_Root_POA::locate_servant_i (const char *operation,
+ const PortableServer::ObjectId &system_id,
+ TAO::Portable_Server::Servant_Upcall &servant_upcall,
+ TAO::Portable_Server::POA_Current_Impl &poa_current_impl,
+ int &wait_occurred_restart_call
+ ACE_ENV_ARG_DECL)
+{
+ return this->active_policy_strategies_.request_processing_strategy()->
+ locate_servant (operation,
+ system_id,
+ servant_upcall,
+ poa_current_impl,
+ wait_occurred_restart_call
+ ACE_ENV_ARG_PARAMETER);
+}
+
+/* static */
+int
+TAO_Root_POA::parse_key (const TAO::ObjectKey &key,
+ TAO_Object_Adapter::poa_name &poa_system_name,
+ PortableServer::ObjectId &system_id,
+ CORBA::Boolean &is_root,
+ CORBA::Boolean &is_persistent,
+ CORBA::Boolean &is_system_id,
+ TAO::Portable_Server::Temporary_Creation_Time &poa_creation_time)
+{
+ // Get the object key octets.
+ const CORBA::Octet *key_data = key.get_buffer ();
+
+ // Skip the object key prefix since we have already checked for this.
+ CORBA::ULong starting_at = TAO_OBJECTKEY_PREFIX_SIZE;
+
+ // Check the root indicator.
+ char root_key_type = key_data[starting_at];
+ if (root_key_type == TAO_Root_POA::root_key_char ())
+ {
+ is_root = true;
+ }
+ else if (root_key_type == TAO_Root_POA::non_root_key_char ())
+ {
+ is_root = false;
+ }
+ else
+ {
+ // Incorrect key
+ return -1;
+ }
+
+ // Skip past the system id indicator
+ starting_at += TAO_Root_POA::root_key_type_length ();
+
+ // Check the system id indicator.
+ char system_id_key_type = key_data[starting_at];
+ if (system_id_key_type == TAO_Root_POA::system_id_key_char ())
+ {
+ is_system_id = true;
+ }
+ else if (system_id_key_type == TAO_Root_POA::user_id_key_char ())
+ {
+ is_system_id = false;
+ }
+ else
+ {
+ // Incorrect key
+ return -1;
+ }
+
+ // Skip past the system id indicator
+ starting_at += TAO_Root_POA::system_id_key_type_length ();
+
+ // Check the persistence indicator
+ char persistent_key_type = key_data[starting_at];
+ if (persistent_key_type == TAO_Root_POA::persistent_key_char ())
+ {
+ is_persistent = true;
+ }
+ else if (persistent_key_type == TAO_Root_POA::transient_key_char ())
+ {
+ is_persistent = false;
+ }
+ else
+ {
+ // Incorrect key
+ return -1;
+ }
+
+ // Skip past the persistent indicator
+ starting_at += TAO_Root_POA::persistent_key_type_length ();
+
+#if (POA_NO_TIMESTAMP == 0)
+ // Grab the timestamp for transient POAs.
+ if (!is_persistent)
+ {
+ // Take the creation time for the timestamp
+ poa_creation_time.creation_time (key_data + starting_at);
+
+ // Skip past the timestamp
+ starting_at += TAO::Portable_Server::Creation_Time::creation_time_length ();
+ }
+#else
+ ACE_UNUSED_ARG (poa_creation_time);
+#endif /* POA_NO_TIMESTAMP */
+
+ // Calculate the size of the POA name.
+ CORBA::ULong poa_name_size = 0;
+ if (!is_persistent)
+ {
+ // Transient POAs have fixed size.
+ poa_name_size = TAO_Object_Adapter::transient_poa_name_size ();
+ }
+ else if (is_system_id)
+ {
+ // System ids have fixed size.
+ poa_name_size = static_cast <CORBA::ULong>
+ (key.length () - starting_at -
+ TAO_Active_Object_Map::system_id_size ());
+ }
+ else
+ {
+ // Get the size from the object key.
+ ACE_OS::memcpy (&poa_name_size,
+ key_data + starting_at,
+ sizeof (poa_name_size));
+ poa_name_size = ACE_NTOHL (poa_name_size);
+
+ starting_at += sizeof (poa_name_size);
+ }
+
+ // Grep the name if there is a name
+ if (!is_root)
+ {
+ poa_system_name.replace (poa_name_size,
+ poa_name_size,
+ (CORBA::Octet *) key_data + starting_at,
+ 0);
+
+ starting_at += poa_name_size;
+ }
+
+ // The rest is the system id.
+ CORBA::ULong system_id_size = key.length () - starting_at;
+
+ // Reset <system_id>.
+ system_id.length (system_id_size);
+ CORBA::Octet * buf = system_id.get_buffer ();
+ ACE_OS::memcpy (buf, key_data + starting_at, system_id_size);
+
+ // Success
+ return 0;
+}
+
+TAO::ObjectKey *
+TAO_Root_POA::create_object_key (const PortableServer::ObjectId &id)
+{
+ // Calculate the space required for the key.
+ CORBA::ULong buffer_size =
+ this->id_.length () +
+ id.length ();
+
+ // Create the buffer for the key.
+ CORBA::Octet *buffer = TAO::ObjectKey::allocbuf (buffer_size);
+
+ // First copy the POA id into the key.
+ ACE_OS::memcpy (&buffer[0],
+ this->id_.get_buffer (),
+ this->id_.length ());
+
+ // Then copy the object id into the key.
+ ACE_OS::memcpy (&buffer[this->id_.length ()],
+ id.get_buffer (),
+ id.length ());
+
+ // Create the key, giving the ownership of the buffer to the
+ // sequence.
+ TAO::ObjectKey *key = 0;
+ ACE_NEW_RETURN (key,
+ TAO::ObjectKey (buffer_size,
+ buffer_size,
+ buffer,
+ 1),
+ 0);
+
+ return key;
+}
+
+void
+TAO_Root_POA::set_id (TAO_Root_POA *parent)
+{
+ // Calculate the prefix size.
+ CORBA::ULong prefix_size = 0;
+ prefix_size += TAO_OBJECTKEY_PREFIX_SIZE;
+
+ // If we are dealing with a persistent POA and user ids are being
+ // used, then we need to add the POA name length field to the object
+ // key. Otherwise, the POA name length can be calculated by looking
+ // at the remainder after extracting other parts of the key.
+ bool const add_poa_name_length =
+ this->is_persistent () &&
+ !this->system_id ();
+
+ // Size required by the POA name.
+ CORBA::ULong poa_name = 0;
+
+ // Calculate the space required for the POA name.
+ CORBA::ULong poa_name_length = this->system_name_->length ();
+ if (parent != 0)
+ {
+ poa_name += poa_name_length;
+ }
+
+ // Check if we need to added the length of the POA name.
+ if (add_poa_name_length)
+ {
+ poa_name += sizeof (poa_name_length);
+ }
+
+ // Get the space needed for the lifespan length
+ // byte.
+ CORBA::ULong const lifespan_key_length =
+ this->active_policy_strategies_.lifespan_strategy()->key_length ();
+
+ CORBA::ULong const id_assignment_key_length =
+ this->active_policy_strategies_.id_assignment_strategy()->key_type_length ();
+
+ // Calculate the space required for the POA id.
+ CORBA::ULong const buffer_size =
+ prefix_size +
+ this->root_key_type_length () +
+ id_assignment_key_length +
+ lifespan_key_length +
+ poa_name;
+
+ // Create the buffer for the POA id.
+ this->id_.length (buffer_size);
+ CORBA::Octet *buffer = &this->id_[0];
+
+ // Keeps track of where the next infomation goes; start at 0 byte.
+ CORBA::ULong starting_at = 0;
+
+ // Add the object key prefix.
+ ACE_OS::memcpy (&buffer[starting_at],
+ &objectkey_prefix[0],
+ TAO_OBJECTKEY_PREFIX_SIZE);
+
+ starting_at += TAO_OBJECTKEY_PREFIX_SIZE;
+
+ // Copy the root byte.
+ if (parent != 0)
+ {
+ buffer[starting_at] = (CORBA::Octet) TAO_Root_POA::non_root_key_char ();
+ }
+ else
+ {
+ buffer[starting_at] = (CORBA::Octet) TAO_Root_POA::root_key_char ();
+ }
+ starting_at += this->root_key_type_length ();
+
+ // Add the id_assignment part
+ this->active_policy_strategies_.id_assignment_strategy()->create_key (buffer, starting_at);
+
+ // Add the lifespan part
+ this->active_policy_strategies_.lifespan_strategy()->create_key (buffer, starting_at);
+
+ // Check if we need to added the length of the POA name.
+ if (add_poa_name_length)
+ {
+ poa_name_length = ACE_HTONL (poa_name_length);
+ ACE_OS::memcpy (&buffer[starting_at],
+ &poa_name_length,
+ sizeof (poa_name_length));
+ starting_at += sizeof (poa_name_length);
+ }
+
+ // Put the POA name into the key (for non-root POAs).
+ if (parent != 0)
+ {
+ ACE_OS::memcpy (&buffer[starting_at],
+ this->system_name_->get_buffer (),
+ this->system_name_->length ());
+ starting_at += this->system_name_->length ();
+ }
+}
+
+int
+TAO_Root_POA::is_poa_generated_id (const PortableServer::ObjectId &id)
+{
+#if defined (POA_NAME_IN_POA_GENERATED_ID)
+
+ // Grab the buffer
+ const char *id_buffer = (const char *) id.get_buffer ();
+
+ // Check to see if the POA name is the first part of the id
+ return
+ this->name_.length () < id.length () &&
+ ACE_OS::strncmp (id_buffer,
+ this->name_.c_str (),
+ this->name_.length ()) == 0;
+#else /* POA_NAME_IN_POA_GENERATED_ID */
+
+ ACE_UNUSED_ARG (id);
+ return 1;
+
+#endif /* POA_NAME_IN_POA_GENERATED_ID */
+}
+
+void
+TAO_Root_POA::set_folded_name (TAO_Root_POA *parent)
+{
+ size_t length = 0;
+ size_t parent_length = 0;
+
+ if (parent != 0)
+ {
+ parent_length = parent->folded_name ().length ();
+ length += parent_length;
+ }
+
+ length += this->name_.length ();
+ length += TAO_Root_POA::name_separator_length ();
+
+ this->folded_name_.length (static_cast <CORBA::ULong> (length));
+ CORBA::Octet *folded_name_buffer = this->folded_name_.get_buffer ();
+
+ if (parent != 0)
+ {
+ ACE_OS::memcpy (folded_name_buffer,
+ parent->folded_name ().get_buffer (),
+ parent_length);
+ }
+
+ ACE_OS::memcpy (&folded_name_buffer[parent_length],
+ this->name_.c_str (),
+ this->name_.length ());
+
+ folded_name_buffer[length - TAO_Root_POA::name_separator_length ()] = TAO_Root_POA::name_separator ();
+}
+
+int
+TAO_Root_POA::parse_ir_object_key (const TAO::ObjectKey &object_key,
+ PortableServer::ObjectId &user_id)
+{
+ TAO_Object_Adapter::poa_name poa_system_name;
+ CORBA::Boolean is_root = false;
+ CORBA::Boolean is_persistent = false;
+ CORBA::Boolean is_system_id = false;
+ TAO::Portable_Server::Temporary_Creation_Time poa_creation_time;
+
+ return TAO_Root_POA::parse_key (object_key,
+ poa_system_name,
+ user_id,
+ is_root,
+ is_persistent,
+ is_system_id,
+ poa_creation_time);
+}
+
+TAO_Object_Adapter &
+TAO_Root_POA::object_adapter (void)
+{
+ return *this->object_adapter_;
+}
+
+CORBA::Object_ptr
+TAO_Root_POA::invoke_key_to_object (ACE_ENV_SINGLE_ARG_DECL)
+{
+ PortableServer::ObjectId_var &system_id =
+ *this->key_to_object_params_.system_id_;
+
+ // Create object key.
+ TAO::ObjectKey_var key =
+ this->create_object_key (system_id.in ());
+
+ return this->key_to_object (key.in (),
+ this->key_to_object_params_.type_id_,
+ this->key_to_object_params_.servant_,
+ this->key_to_object_params_.collocated_,
+ this->key_to_object_params_.priority_,
+ this->key_to_object_params_.indirect_
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::Object_ptr
+TAO_Root_POA::key_to_object (const TAO::ObjectKey &key,
+ const char *type_id,
+ TAO_ServantBase *servant,
+ CORBA::Boolean collocated,
+ CORBA::Short priority,
+ bool indirect
+ ACE_ENV_ARG_DECL)
+{
+ // Check if the ORB is still running, otherwise throw an exception.
+ // @@ What if the ORB was destroyed? In that case we shouldn't even
+ // get here!
+ this->orb_core_.check_shutdown (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ //
+ // ImplRepo related.
+ //
+#if (TAO_HAS_MINIMUM_CORBA == 0)
+
+ CORBA::Object_ptr obj = CORBA::Object::_nil ();
+
+ if (indirect && this->active_policy_strategies_.lifespan_strategy()->use_imr ()
+ && this->orb_core ().imr_endpoints_in_ior ())
+ {
+ // Check to see if we alter the IOR.
+ CORBA::Object_var imr =
+ this->orb_core ().implrepo_service ();
+
+ if (CORBA::is_nil (imr.in ())
+ || !imr->_stubobj ()
+ || !imr->_stubobj ()->profile_in_use ())
+ {
+ if (TAO_debug_level > 1)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "Missing ImR IOR, will not use the ImR\n"));
+ }
+ goto orbkey;
+ }
+
+ CORBA::String_var imr_str =
+ imr->_stubobj ()->profile_in_use ()->to_string (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (obj);
+
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ "IMR IOR = \n%s\n",
+ ACE_TEXT_CHAR_TO_TCHAR (imr_str.in ())));
+
+ // Search for "corbaloc:" alone, without the protocol. This code
+ // should be protocol neutral.
+ const char corbaloc[] = "corbaloc:";
+ char *pos = ACE_OS::strstr (imr_str.inout (), corbaloc);
+ pos = ACE_OS::strchr (pos + sizeof (corbaloc), ':');
+
+ pos = ACE_OS::strchr (pos + 1,
+ imr->_stubobj ()->profile_in_use ()->object_key_delimiter ());
+
+ if (pos)
+ pos[1] = 0; // Crop the string.
+ else
+ {
+ if (TAO_debug_level > 0)
+ ACE_ERROR ((LM_ERROR,
+ "Could not parse ImR IOR, skipping ImRification\n"));
+ goto orbkey;
+ }
+
+ ACE_CString ior (imr_str.in ());
+
+ // Add the key.
+
+ CORBA::String_var key_str;
+ TAO::ObjectKey::encode_sequence_to_string (key_str.inout (), key);
+
+ ior += key_str.in ();
+
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ "ImR-ified IOR = \n%s\n",
+ ACE_TEXT_CHAR_TO_TCHAR (ior.c_str ())));
+
+ obj =
+ this->orb_core_.orb ()->string_to_object (ior.c_str ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (obj);
+
+ return obj;
+ }
+
+orbkey:
+
+#else
+ ACE_UNUSED_ARG (indirect);
+#endif /* TAO_HAS_MINIMUM_CORBA */
+
+ TAO_Stub *data =
+ this->key_to_stub_i (key, type_id, priority ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Object::_nil ());
+
+ TAO_Stub_Auto_Ptr safe_data (data);
+
+ CORBA::Object_ptr tmp;
+
+ if (this->orb_core_.optimize_collocation_objects ())
+ {
+ ACE_NEW_THROW_EX (tmp, CORBA::Object (data,
+ collocated,
+ servant),
+ CORBA::INTERNAL ());
+
+ ACE_CHECK_RETURN (CORBA::Object::_nil ());
+ }
+ else
+ {
+ ACE_NEW_THROW_EX (tmp,
+ CORBA::Object (data,
+ collocated),
+ CORBA::INTERNAL ());
+ ACE_CHECK_RETURN (CORBA::Object::_nil ());
+ }
+
+ data->servant_orb (this->orb_core_.orb ());
+
+ // Transfer ownership to the Object.
+ (void) safe_data.release ();
+
+ return tmp;
+}
+
+TAO_Stub *
+TAO_Root_POA::key_to_stub (const TAO::ObjectKey &key,
+ const char *type_id,
+ CORBA::Short priority
+ ACE_ENV_ARG_DECL)
+{
+ // Check if the ORB is still running, otherwise throw an exception.
+ // @@ What if the ORB was destroyed? In that case we shouldn't even
+ // get here!
+ this->orb_core_.check_shutdown (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ return this->key_to_stub_i (key, type_id, priority ACE_ENV_ARG_PARAMETER);
+}
+
+TAO_Stub *
+TAO_Root_POA::key_to_stub_i (const TAO::ObjectKey &key,
+ const char *type_id,
+ CORBA::Short priority
+ ACE_ENV_ARG_DECL)
+{
+ CORBA::PolicyList_var client_exposed_policies =
+ this->client_exposed_policies (priority
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ if (this->filter_factory_ == 0)
+ this->filter_factory_
+ = ACE_Dynamic_Service<TAO_Acceptor_Filter_Factory>::instance ("TAO_Acceptor_Filter_Factory");
+
+ TAO_Acceptor_Filter* filter =
+ this->filter_factory_->create_object (this->poa_manager_);
+
+ // Give ownership to the auto pointer.
+ auto_ptr<TAO_Acceptor_Filter> new_filter (filter);
+
+ TAO_Stub *data =
+ this->create_stub_object (
+ key,
+ type_id,
+ client_exposed_policies._retn (),
+ filter,
+ this->orb_core_.lane_resources ().acceptor_registry ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ return data;
+}
+
+void
+TAO_Root_POA::establish_components (ACE_ENV_SINGLE_ARG_DECL)
+{
+ TAO_IORInterceptor_Adapter *ior_adapter =
+ this->orb_core_.ior_interceptor_adapter ();
+
+ if (ior_adapter)
+ {
+ ior_adapter->establish_components (this ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+}
+
+void
+TAO_Root_POA::components_established (PortableInterceptor::IORInfo_ptr info
+ ACE_ENV_ARG_DECL)
+{
+ TAO_IORInterceptor_Adapter *ior_adapter =
+ this->orb_core_.ior_interceptor_adapter ();
+
+ if (ior_adapter)
+ {
+ ior_adapter->components_established (info ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+}
+
+void
+TAO_Root_POA::save_ior_component (const IOP::TaggedComponent &component
+ ACE_ENV_ARG_DECL_NOT_USED)
+{
+ const CORBA::ULong old_len = this->tagged_component_.length ();
+
+ this->tagged_component_.length (old_len + 1);
+ this->tagged_component_[old_len] = component;
+}
+
+void
+TAO_Root_POA::
+save_ior_component_and_profile_id (const IOP::TaggedComponent &component,
+ IOP::ProfileId profile_id
+ ACE_ENV_ARG_DECL_NOT_USED)
+{
+ // The length of this->tagged_component_id_ is the same as the
+ // length of the profile_id_array_ since we are trying to make a
+ // one-to-one link between these two arrays. So, whenever
+ // this->tagged_component_id_ is increased, we need to increase the
+ // size of this->profile_id_array_ also.
+
+ CORBA::ULong const old_len = this->tagged_component_id_.length ();
+
+ CORBA::ULong const new_len = old_len + 1;
+
+ this->tagged_component_id_.length (new_len);
+ this->tagged_component_id_[old_len] = component;
+
+ this->profile_id_array_.size (new_len);
+ this->profile_id_array_[old_len] = profile_id;
+}
+
+TAO_Stub *
+TAO_Root_POA::create_stub_object (const TAO::ObjectKey &object_key,
+ const char *type_id,
+ CORBA::PolicyList *policy_list,
+ TAO_Acceptor_Filter *filter,
+ TAO_Acceptor_Registry &acceptor_registry
+ ACE_ENV_ARG_DECL)
+{
+ int error = 0;
+
+ // Count the number of endpoints.
+ size_t const profile_count =
+ acceptor_registry.endpoint_count ();
+
+ // Create a profile container and have acceptor registries populate
+ // it with profiles as appropriate.
+ TAO_MProfile mprofile (0);
+
+ // Allocate space for storing the profiles. There can never be more
+ // profiles than there are endpoints. In some cases, there can be
+ // less profiles than endpoints.
+ int result =
+ mprofile.set (static_cast <CORBA::ULong> (profile_count));
+ if (result == -1)
+ error = 1;
+
+ if (!error)
+ {
+ result =
+ filter->fill_profile (object_key,
+ mprofile,
+ acceptor_registry.begin (),
+ acceptor_registry.end ());
+ if (result == -1)
+ error = 1;
+ }
+
+ if (!error)
+ result = filter->encode_endpoints (mprofile);
+ if (result == -1)
+ error = 1;
+
+ if (error)
+ ACE_THROW_RETURN (CORBA::INTERNAL (
+ CORBA::SystemException::_tao_minor_code (
+ TAO_MPROFILE_CREATION_ERROR,
+ 0),
+ CORBA::COMPLETED_NO),
+ 0);
+
+ // Make sure we have at least one profile. <mp> may end up being
+ // empty if none of the acceptor endpoints have the right priority
+ // for this object, for example.
+ if (mprofile.profile_count () == 0)
+ ACE_THROW_RETURN (CORBA::BAD_PARAM (
+ CORBA::SystemException::_tao_minor_code (
+ TAO_MPROFILE_CREATION_ERROR,
+ 0),
+ CORBA::COMPLETED_NO),
+ 0);
+
+ TAO_Stub *stub =
+ this->orb_core_.create_stub_object (mprofile,
+ type_id,
+ policy_list
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ // Add the saved tagged components methods to the profiles.
+ CORBA::ULong len = this->tagged_component_.length ();
+ for (CORBA::ULong i = 0; i != len; ++i)
+ {
+ this->add_ior_component (mprofile,
+ this->tagged_component_[i]
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+ }
+
+ len = this->tagged_component_id_.length ();
+
+ for (CORBA::ULong k = 0; k != len; ++k)
+ {
+ this->add_ior_component_to_profile (mprofile,
+ this->tagged_component_id_[k],
+ this->profile_id_array_[k]
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+ }
+
+ return stub;
+}
+
+CORBA::PolicyList *
+TAO_Root_POA::client_exposed_policies (CORBA::Short /* object_priority */
+ ACE_ENV_ARG_DECL)
+{
+ CORBA::PolicyList *client_exposed_policies = 0;
+ ACE_NEW_THROW_EX (client_exposed_policies,
+ CORBA::PolicyList (),
+ CORBA::NO_MEMORY (TAO::VMCID,
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (0);
+
+ CORBA::PolicyList_var policies = client_exposed_policies;
+
+ // Add in all of the client exposed policies.
+ this->policies_.add_client_exposed_fixed_policies (client_exposed_policies
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ return policies._retn ();
+}
+
+TAO_SERVANT_LOCATION
+TAO_Root_POA::locate_servant_i (const PortableServer::ObjectId &system_id,
+ PortableServer::Servant &servant
+ ACE_ENV_ARG_DECL)
+{
+ return this->active_policy_strategies_.request_processing_strategy()->
+ locate_servant (system_id, servant ACE_ENV_ARG_PARAMETER);
+}
+
+TAO_SERVANT_LOCATION
+TAO_Root_POA::servant_present (const PortableServer::ObjectId &system_id,
+ PortableServer::Servant &servant
+ ACE_ENV_ARG_DECL)
+{
+ return this->active_policy_strategies_.servant_retention_strategy()->
+ servant_present (system_id, servant ACE_ENV_ARG_PARAMETER);
+}
+
+PortableServer::Servant
+TAO_Root_POA::find_servant (
+ const PortableServer::ObjectId &system_id,
+ TAO::Portable_Server::Servant_Upcall &servant_upcall,
+ TAO::Portable_Server::POA_Current_Impl &poa_current_impl
+ ACE_ENV_ARG_DECL)
+{
+ return this->active_policy_strategies_.servant_retention_strategy()->
+ find_servant (system_id,
+ servant_upcall,
+ poa_current_impl
+ ACE_ENV_ARG_PARAMETER);
+}
+
+int
+TAO_Root_POA::find_servant_priority (
+ const PortableServer::ObjectId &system_id,
+ CORBA::Short &priority
+ ACE_ENV_ARG_DECL)
+{
+ return this->active_policy_strategies_.servant_retention_strategy()->
+ find_servant_priority (system_id,
+ priority
+ ACE_ENV_ARG_PARAMETER);
+}
+
+TAO::ORT_Adapter_Factory *
+TAO_Root_POA::ORT_adapter_factory (void)
+{
+ return ACE_Dynamic_Service<TAO::ORT_Adapter_Factory>::instance
+ (orb_core_.configuration (),
+ TAO_Root_POA::ort_adapter_factory_name ());
+}
+
+TAO::ORT_Adapter *
+TAO_Root_POA::ORT_adapter_i (void)
+{
+ if (this->ort_adapter_ != 0)
+ return this->ort_adapter_;
+
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ TAO::ORT_Adapter_Factory * ort_ap_factory =
+ this->ORT_adapter_factory ();
+
+ if (!ort_ap_factory)
+ return 0;
+
+ // Get the full adapter name of this POA, do this before we
+ // create the adapter so that in case this fails, we just
+ // return 0 and not a not activated adapter
+ PortableInterceptor::AdapterName *adapter_name =
+ this->adapter_name_i (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ this->ort_adapter_ =
+ ort_ap_factory->create ();
+
+ if (!this->ort_adapter_)
+ return 0;
+
+ // @todo We have to look at this, we activate it but hold the POA lock,
+ // in case we are called by ORT_adapter, we shouldn't keep the lock
+ // here, but then the ort_adapter should be guarded against multiple
+ // activations.
+ this->ort_adapter_->activate (this->orb_core_.server_id (),
+ this->orb_core_.orbid (),
+ adapter_name,
+ this
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "(%P|%t) Cannot initialize the "
+ "object_reference_template_adapter\n");
+ }
+ ACE_ENDTRY;
+ ACE_CHECK_RETURN (0);
+
+ return this->ort_adapter_;
+}
+
+#if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
+
+PortableServer::AdapterActivator_ptr
+TAO_Root_POA::the_activator (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ // Lock access for the duration of this transaction.
+ TAO_POA_GUARD_RETURN (PortableServer::AdapterActivator::_nil ());
+
+ return PortableServer::AdapterActivator::_duplicate (this->adapter_activator_.in ());
+}
+
+void
+TAO_Root_POA::the_activator (PortableServer::AdapterActivator_ptr adapter_activator
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ // Lock access for the duration of this transaction.
+ TAO_POA_GUARD;
+
+ this->adapter_activator_ = PortableServer::AdapterActivator::_duplicate (adapter_activator);
+}
+
+#endif /* TAO_HAS_MINIMUM_POA == 0 && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)*/
+
+#if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
+
+PortableServer::ServantManager_ptr
+TAO_Root_POA::get_servant_manager (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongPolicy))
+{
+ // Lock access for the duration of this transaction.
+ TAO_POA_GUARD_RETURN (PortableServer::ServantManager::_nil ());
+
+ return this->active_policy_strategies_.request_processing_strategy()->
+ get_servant_manager (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+void
+TAO_Root_POA::set_servant_manager (PortableServer::ServantManager_ptr imgr
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongPolicy))
+{
+ // Lock access for the duration of this transaction.
+ TAO_POA_GUARD;
+
+ this->active_policy_strategies_.request_processing_strategy()->
+ set_servant_manager (imgr ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+PortableServer::Servant
+TAO_Root_POA::get_servant_i (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongPolicy))
+{
+ return this->active_policy_strategies_.request_processing_strategy()->
+ get_servant (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+PortableServer::Servant
+TAO_Root_POA::get_servant (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::NoServant,
+ PortableServer::POA::WrongPolicy))
+{
+ // Lock access for the duration of this transaction.
+ TAO_POA_GUARD_RETURN (0);
+
+ PortableServer::Servant servant =
+ this->get_servant_i (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ if (servant != 0)
+ {
+ // ATTENTION: Trick locking here, see class header for details
+ TAO::Portable_Server::Non_Servant_Upcall non_servant_upcall (*this);
+ ACE_UNUSED_ARG (non_servant_upcall);
+
+ // The POA invokes _add_ref once on the Servant before returning
+ // it. If the application uses reference counting, the caller of
+ // get_servant is responsible for invoking _remove_ref once on
+ // the returned Servant when it is finished with it. A
+ // conforming caller need not invoke _remove_ref on the returned
+ // Servant if the type of the Servant uses the default reference
+ // counting inherited from ServantBase.
+ servant->_add_ref (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ return servant;
+ }
+ else
+ {
+ // If no servant has been associated with the POA, the NoServant
+ // exception is raised.
+ ACE_THROW_RETURN (PortableServer::POA::NoServant (),
+ 0);
+ }
+}
+
+void
+TAO_Root_POA::set_servant (PortableServer::Servant servant
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongPolicy))
+{
+ // Lock access for the duration of this transaction.
+ TAO_POA_GUARD;
+
+ this->active_policy_strategies_.request_processing_strategy()->
+ set_servant (servant ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+#endif /* TAO_HAS_MINIMUM_POA == 0 && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO) */
+
+bool
+TAO_Root_POA::is_servant_activation_allowed (PortableServer::Servant servant,
+ int &wait_occurred_restart_call)
+{
+ return this->active_policy_strategies_.id_uniqueness_strategy ()->
+ is_servant_activation_allowed (servant, wait_occurred_restart_call);
+}
+
+bool
+TAO_Root_POA::has_system_id (void) const
+{
+ return this->active_policy_strategies_.id_assignment_strategy ()->
+ has_system_id ();
+}
+
+int
+TAO_Root_POA::rebind_using_user_id_and_system_id (
+ PortableServer::Servant servant,
+ const PortableServer::ObjectId &user_id,
+ const PortableServer::ObjectId &system_id,
+ TAO::Portable_Server::Servant_Upcall &servant_upcall)
+{
+ return this->active_policy_strategies_.servant_retention_strategy ()->
+ rebind_using_user_id_and_system_id (servant,
+ user_id,
+ system_id,
+ servant_upcall);
+}
+
+CORBA::Boolean
+TAO_Root_POA::servant_has_remaining_activations (PortableServer::Servant servant)
+{
+ return this->active_policy_strategies_.servant_retention_strategy ()->
+ servant_has_remaining_activations (servant);
+}
+
+bool
+TAO_Root_POA::allow_implicit_activation (void) const
+{
+ return this->active_policy_strategies_.implicit_activation_strategy ()->
+ allow_implicit_activation ();
+}
+
+bool
+TAO_Root_POA::allow_multiple_activations (void) const
+{
+ return this->active_policy_strategies_.id_uniqueness_strategy ()->
+ allow_multiple_activations ();
+}
+
+void
+TAO_Root_POA::post_invoke_servant_cleanup(
+ const PortableServer::ObjectId &system_id,
+ const TAO::Portable_Server::Servant_Upcall &servant_upcall)
+{
+ this->active_policy_strategies_.request_processing_strategy ()->
+ post_invoke_servant_cleanup (system_id, servant_upcall);
+}
+
+CORBA::Short
+TAO_Root_POA::server_priority (void) const
+{
+ return this->cached_policies_.server_priority ();
+}
+
+int
+TAO_Root_POA::is_servant_active (
+ PortableServer::Servant servant,
+ int &wait_occurred_restart_call)
+{
+ return this->active_policy_strategies_.servant_retention_strategy ()->
+ is_servant_in_map (servant, wait_occurred_restart_call);
+}
+
+TAO::Portable_Server::Cached_Policies::PriorityModel
+TAO_Root_POA::priority_model (void) const
+{
+ return cached_policies_.priority_model ();
+}
+
+#if (TAO_HAS_MINIMUM_POA == 0)
+int
+TAO_Root_POA::enter ()
+{
+ return this->active_policy_strategies_.thread_strategy ()->enter();
+}
+#endif /* TAO_HAS_MINIMUM_POA == 0 */
+
+#if (TAO_HAS_MINIMUM_POA == 0)
+int
+TAO_Root_POA::exit ()
+{
+ return this->active_policy_strategies_.thread_strategy ()->exit();
+}
+#endif /* TAO_HAS_MINIMUM_POA == 0 */
+
+bool
+TAO_Root_POA::validate_lifespan (
+ CORBA::Boolean is_persistent,
+ const TAO::Portable_Server::Temporary_Creation_Time& creation_time) const
+{
+ return this->active_policy_strategies_.lifespan_strategy()->
+ validate (is_persistent, creation_time);
+}
+
+CORBA::Boolean
+TAO_Root_POA::root (void) const
+{
+ return true;
+}
+
+TAO::ORT_Adapter *
+TAO_Root_POA::ORT_adapter (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ if (this->ort_adapter_ != 0)
+ return this->ort_adapter_;
+
+ // Lock access for the duration of this transaction.
+ TAO_POA_GUARD_RETURN (0);
+
+ // DCL ..
+ if (this->ort_adapter_ != 0)
+ return this->ort_adapter_;
+
+ return this->ORT_adapter_i ();
+}
+
+CORBA::Policy *
+TAO_Root_POA::server_protocol (void)
+{
+ return 0;
+}
+
+void
+TAO_Root_POA::Key_To_Object_Params::set (PortableServer::ObjectId_var &system_id,
+ const char *type_id,
+ TAO_ServantBase *servant,
+ CORBA::Boolean collocated,
+ CORBA::Short priority,
+ bool indirect)
+{
+ this->system_id_ = &system_id;
+ this->type_id_ = type_id;
+ this->servant_ = servant;
+ this->collocated_ = collocated;
+ this->priority_ = priority;
+ this->indirect_ = indirect;
+}
+
+CORBA::ULong
+TAO_Root_POA::waiting_servant_deactivation (void) const
+{
+ return this->active_policy_strategies_.servant_retention_strategy ()->
+ waiting_servant_deactivation ();
+}
+
+void
+TAO_Root_POA::ort_adapter_factory_name (const char *name)
+{
+ TAO_POA_Static_Resources::instance ()->ort_adapter_factory_name_ =
+ name;
+}
+
+CORBA::Policy_ptr
+TAO_Root_POA::get_policy (CORBA::PolicyType policy
+ ACE_ENV_ARG_DECL)
+{
+ return this->policies_.get_policy (policy ACE_ENV_ARG_PARAMETER);
+}
+
+void
+TAO_Root_POA::check_state (ACE_ENV_SINGLE_ARG_DECL)
+{
+ this->active_policy_strategies_.lifespan_strategy ()->
+ check_state (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+const char *
+TAO_Root_POA::ort_adapter_factory_name (void)
+{
+ return TAO_POA_Static_Resources::instance ()->ort_adapter_factory_name_.c_str();
+}
+
+void
+TAO_Root_POA::imr_client_adapter_name (const char *name)
+{
+ TAO_POA_Static_Resources::instance ()->imr_client_adapter_name_ = name;
+}
+
+const char *
+TAO_Root_POA::imr_client_adapter_name (void)
+{
+ return TAO_POA_Static_Resources::instance ()->imr_client_adapter_name_.c_str();
+}
+
+PortableServer::POAManager_ptr
+TAO_Root_POA::the_POAManager (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return PortableServer::POAManager::_duplicate (&this->poa_manager_);
+}
+
+#if !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
+PortableServer::POAManagerFactory_ptr
+TAO_Root_POA::the_POAManagerFactory (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return PortableServer::POAManagerFactory::_duplicate (&this->poa_manager_factory_);
+}
+#endif
+
+CORBA::ORB_ptr
+TAO_Root_POA::_get_orb (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+{
+ return CORBA::ORB::_duplicate (this->orb_core_.orb ());
+}
+
+// Initialize instance_ to 0, since this is what we test for in the call
+// to instance (). Note that this does not require a constructor call, so
+// it is always initialized by the time that instance () can be called.
+TAO_POA_Static_Resources* TAO_POA_Static_Resources::instance_ = 0;
+
+// Force an instance to be created at module initialization time,
+// since we do not want to worry about double checked locking and
+// the race condition to initialize the lock.
+TAO_POA_Static_Resources* TAO_POA_Static_Resources::initialization_reference_ =
+ TAO_POA_Static_Resources::instance ();
+
+TAO_POA_Static_Resources*
+TAO_POA_Static_Resources::instance (void)
+{
+ if (TAO_POA_Static_Resources::instance_ == 0)
+ {
+ // This new is never freed on purpose. The data specified by
+ // it needs to be around for the last shared library that references
+ // this class. This could occur in a destructor in a shared library
+ // that is unloaded after this one. One solution to avoid this
+ // harmless memory leak would be to use reference counting.
+ ACE_NEW_RETURN (TAO_POA_Static_Resources::instance_,
+ TAO_POA_Static_Resources (),
+ 0);
+ }
+
+ return TAO_POA_Static_Resources::instance_;
+}
+
+TAO_POA_Static_Resources::TAO_POA_Static_Resources (void)
+ : ort_adapter_factory_name_ ("ORT_Adapter_Factory"),
+ imr_client_adapter_name_ ("ImR_Client_Adapter")
+{
+}
+
+void
+TAO_Root_POA::poa_activated_hook ()
+{
+}
+
+void
+TAO_Root_POA::poa_deactivated_hook ()
+{
+}
+
+void
+TAO_Root_POA::servant_activated_hook (PortableServer::Servant,
+ const PortableServer::ObjectId&
+ ACE_ENV_ARG_DECL)
+{
+}
+
+void
+TAO_Root_POA::servant_deactivated_hook (PortableServer::Servant,
+ const PortableServer::ObjectId&
+ ACE_ENV_ARG_DECL)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/Root_POA.h b/TAO/tao/PortableServer/Root_POA.h
new file mode 100644
index 00000000000..c6f97421b05
--- /dev/null
+++ b/TAO/tao/PortableServer/Root_POA.h
@@ -0,0 +1,1053 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Root_POA.h
+ *
+ * $Id$
+ *
+ * Header file for CORBA's ORB type.
+ *
+ * @author Irfan Pyarali <irfan@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_ROOT_POA_H
+#define TAO_ROOT_POA_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+// Object Adapter
+#include "tao/PortableServer/Object_Adapter.h"
+
+// POA Policy Set
+#include "tao/PortableServer/POA_Policy_Set.h"
+
+// Cached POA Policies
+#include "tao/PortableServer/POA_Cached_Policies.h"
+#include "tao/PortableServer/Active_Policy_Strategies.h"
+
+#include "tao/PortableServer/ORT_Adapter.h"
+
+#include "tao/PortableServer/PortableServer.h"
+
+// Object_Key
+#include "tao/Object_KeyC.h"
+
+// Local Object
+#include "tao/LocalObject.h"
+
+// Portable Interceptor
+#include "tao/PI_ForwardC.h"
+
+// OctetSeq
+#include "tao/OctetSeqC.h"
+
+#include "ace/SString.h"
+#include "ace/Hash_Map_Manager_T.h"
+#include "ace/Array_Base.h"
+#include "ace/Synch_Traits.h"
+#include "ace/Thread_Mutex.h"
+#include "ace/Recursive_Thread_Mutex.h"
+#include "ace/Null_Mutex.h"
+
+// This is to remove "inherits via dominance" warnings from MSVC.
+// MSVC is being a little too paranoid.
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Forward Declaration
+class TAO_Acceptor_Filter;
+class TAO_Acceptor_Filter_Factory;
+class TAO_Acceptor_Registry;
+class TAO_IORInfo;
+class TAO_Regular_POA;
+class TAO_POAManager_Factory;
+
+namespace PortableInterceptor
+{
+ class IORInfo;
+ typedef IORInfo *IORInfo_ptr;
+}
+
+namespace TAO
+{
+ class ORT_Adapter;
+ class ORT_Adapter_Factory;
+
+ namespace Portable_Server
+ {
+ class Servant_Upcall;
+ class POA_Current_Impl;
+ class Temporary_Creation_Time;
+ }
+}
+
+namespace PortableServer
+{
+ class POAManager;
+ typedef POAManager *POAManager_ptr;
+}
+
+/**
+ * @class TAO_Root_POA
+ *
+ * @brief Implementation of the PortableServer::POA interface.
+ *
+ * Implementation of the PortableServer::POA interface.
+ */
+class TAO_PortableServer_Export TAO_Root_POA
+ : public virtual PortableServer::POA,
+ public virtual TAO_Local_RefCounted_Object
+{
+public:
+
+ friend class TAO_Object_Adapter;
+ friend class TAO::Portable_Server::Servant_Upcall;
+ friend class TAO::Portable_Server::Non_Servant_Upcall;
+ friend class TAO_POA_Manager;
+ friend class TAO_RT_Collocation_Resolver;
+ friend class TAO_IORInfo;
+
+ typedef ACE_CString String;
+
+#if !defined (CORBA_E_MICRO)
+ PortableServer::POA_ptr create_POA (
+ const char *adapter_name,
+ PortableServer::POAManager_ptr poa_manager,
+ const CORBA::PolicyList &policies
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::AdapterAlreadyExists,
+ PortableServer::POA::InvalidPolicy));
+
+ PortableServer::POA_ptr find_POA (const char *adapter_name,
+ CORBA::Boolean activate_it
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::AdapterNonExistent));
+#endif
+
+ void destroy (CORBA::Boolean etherealize_objects,
+ CORBA::Boolean wait_for_completion
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+#if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
+ PortableServer::ThreadPolicy_ptr create_thread_policy (
+ PortableServer::ThreadPolicyValue value
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException));
+#endif /* TAO_HAS_MINIMUM_POA == 0 */
+
+#if !defined (CORBA_E_MICRO)
+ PortableServer::LifespanPolicy_ptr create_lifespan_policy (
+ PortableServer::LifespanPolicyValue value
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException));
+#endif
+
+#if !defined (CORBA_E_MICRO)
+ PortableServer::IdUniquenessPolicy_ptr create_id_uniqueness_policy (
+ PortableServer::IdUniquenessPolicyValue value
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException));
+#endif
+
+#if !defined (CORBA_E_MICRO)
+ PortableServer::IdAssignmentPolicy_ptr create_id_assignment_policy (
+ PortableServer::IdAssignmentPolicyValue value
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException));
+#endif
+
+#if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
+
+ PortableServer::ImplicitActivationPolicy_ptr
+ create_implicit_activation_policy (
+ PortableServer::ImplicitActivationPolicyValue value
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ PortableServer::ServantRetentionPolicy_ptr
+ create_servant_retention_policy (
+ PortableServer::ServantRetentionPolicyValue value
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ PortableServer::RequestProcessingPolicy_ptr
+ create_request_processing_policy (
+ PortableServer::RequestProcessingPolicyValue value
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+#endif /* TAO_HAS_MINIMUM_POA == 0 && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO) */
+
+ char * the_name (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ PortableServer::POA_ptr the_parent (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ PortableServer::POAList *the_children (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ PortableServer::POAManager_ptr the_POAManager (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+#if !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
+ PortableServer::POAManagerFactory_ptr the_POAManagerFactory (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+#endif
+
+ /// This method returns the adapter_name as a sequence of strings of
+ /// length one or more or just a fixed name depending on the Object
+ /// Adapter. Added wrt to ORT Spec.
+ PortableInterceptor::AdapterName *adapter_name (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Store the given TaggedComponent for eventual insertion into all
+ /// object reference profiles.
+ void save_ior_component (const IOP::TaggedComponent &component
+ ACE_ENV_ARG_DECL);
+
+ /// Store the given TaggedComponent for eventual insertion into all
+ /// object reference profiles with the given ProfileId.
+ void save_ior_component_and_profile_id (
+ const IOP::TaggedComponent &component,
+ IOP::ProfileId profile_id
+ ACE_ENV_ARG_DECL);
+
+#if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
+ PortableServer::AdapterActivator_ptr the_activator (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ void the_activator (PortableServer::AdapterActivator_ptr adapter_activator
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ PortableServer::ServantManager_ptr get_servant_manager (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongPolicy));
+
+ void set_servant_manager (PortableServer::ServantManager_ptr imgr
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongPolicy));
+
+ PortableServer::Servant get_servant (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::NoServant,
+ PortableServer::POA::WrongPolicy));
+
+ void set_servant (PortableServer::Servant servant
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongPolicy));
+#endif /* TAO_HAS_MINIMUM_POA == 0 !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO) */
+
+ PortableServer::ObjectId *activate_object (PortableServer::Servant p_servant
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ServantAlreadyActive,
+ PortableServer::POA::WrongPolicy));
+
+#if !defined (CORBA_E_MICRO)
+ void activate_object_with_id (const PortableServer::ObjectId &id,
+ PortableServer::Servant p_servant
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ServantAlreadyActive,
+ PortableServer::POA::ObjectAlreadyActive,
+ PortableServer::POA::WrongPolicy));
+#endif
+
+ void deactivate_object (const PortableServer::ObjectId &oid
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ObjectNotActive,
+ PortableServer::POA::WrongPolicy));
+
+ CORBA::Object_ptr create_reference (const char *intf
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongPolicy));
+
+ CORBA::Object_ptr create_reference_with_id (
+ const PortableServer::ObjectId &oid,
+ const char *intf
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ PortableServer::ObjectId *servant_to_id (PortableServer::Servant p_servant
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ServantNotActive,
+ PortableServer::POA::WrongPolicy));
+
+ PortableServer::ObjectId *servant_to_user_id (PortableServer::Servant p_servant
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ServantNotActive,
+ PortableServer::POA::WrongPolicy));
+
+ CORBA::Object_ptr servant_to_reference (PortableServer::Servant p_servant
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ServantNotActive,
+ PortableServer::POA::WrongPolicy));
+
+ PortableServer::Servant reference_to_servant (
+ CORBA::Object_ptr reference
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ObjectNotActive,
+ PortableServer::POA::WrongAdapter,
+ PortableServer::POA::WrongPolicy));
+
+ PortableServer::ObjectId *reference_to_id (CORBA::Object_ptr reference
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongAdapter,
+ PortableServer::POA::WrongPolicy));
+
+ PortableServer::Servant id_to_servant (const PortableServer::ObjectId &oid
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ObjectNotActive,
+ PortableServer::POA::WrongPolicy));
+
+ CORBA::Object_ptr id_to_reference (const PortableServer::ObjectId &oid
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ObjectNotActive,
+ PortableServer::POA::WrongPolicy));
+
+ CORBA::OctetSeq *id (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Accessor for POA policies.
+ TAO_POA_Policy_Set &policies (void);
+
+ /// Get the set policy of the given type.
+ CORBA::Policy_ptr get_policy (CORBA::PolicyType policy ACE_ENV_ARG_DECL);
+
+ /// This method gives the policies that are exposed to the client.
+ /// These policies are shipped within the IOR.
+ virtual CORBA::PolicyList *client_exposed_policies (
+ CORBA::Short object_priority
+ ACE_ENV_ARG_DECL
+ );
+
+ TAO_Root_POA (const String &name,
+ PortableServer::POAManager_ptr poa_manager,
+ const TAO_POA_Policy_Set &policies,
+ TAO_Root_POA *parent,
+ ACE_Lock &lock,
+ TAO_SYNCH_MUTEX &thread_lock,
+ TAO_ORB_Core &orb_core,
+ TAO_Object_Adapter *object_adapter
+ ACE_ENV_ARG_DECL);
+
+ virtual ~TAO_Root_POA (void);
+
+ static char name_separator (void);
+
+ static CORBA::ULong name_separator_length (void);
+
+ enum
+ {
+ TAO_OBJECTKEY_PREFIX_SIZE = 4
+ };
+
+ static CORBA::Octet const objectkey_prefix[TAO_OBJECTKEY_PREFIX_SIZE];
+
+ const TAO_Object_Adapter::poa_name &folded_name (void) const;
+
+ const TAO_Object_Adapter::poa_name &system_name (void) const;
+
+ static void check_for_valid_wait_for_completions (
+ const TAO_ORB_Core &orb_core,
+ CORBA::Boolean wait_for_completion
+ ACE_ENV_ARG_DECL
+ );
+
+ /// ORB Core for POA.
+ TAO_ORB_Core &orb_core (void) const;
+
+ TAO::Portable_Server::Cached_Policies::PriorityModel priority_model (void) const;
+
+ CORBA::Boolean cleanup_in_progress (void);
+
+ /// Calls protected static method used when POACurrent is not appropriate.
+ static int parse_ir_object_key (const TAO::ObjectKey &object_key,
+ PortableServer::ObjectId &user_id);
+
+ TAO_Object_Adapter &object_adapter (void);
+
+ ACE_Lock &lock (void);
+
+ /// Create the correct stub, properly initialized with the
+ /// attributes and policies attached to the current POA.
+ TAO_Stub* key_to_stub (const TAO::ObjectKey &key,
+ const char *type_id,
+ CORBA::Short priority
+ ACE_ENV_ARG_DECL);
+
+ /// Accessor methods to POA state.
+ /**
+ * The POA can be in one of HOLDING, ACTIVE, DISCARDING, INACTIVE
+ * and NON_EXISTENT states.
+ */
+ PortableInterceptor::AdapterState get_adapter_state (
+ ACE_ENV_SINGLE_ARG_DECL);
+
+ virtual void *thread_pool (void) const;
+
+ virtual CORBA::Policy *server_protocol (void);
+
+ CORBA::ULong outstanding_requests (void) const;
+
+ const ACE_CString &name (void) const;
+
+ CORBA::Boolean waiting_destruction (void) const;
+
+ static void ort_adapter_factory_name (const char *name);
+
+ static const char *ort_adapter_factory_name (void);
+
+ /// Sets the value of TAO_POA_Static_Resources::imr_client_adapter_name_.
+ static void imr_client_adapter_name (const char *name);
+
+ /// Gets the value of TAO_POA_Static_Resources::imr_client_adapter_name_.
+ static const char *imr_client_adapter_name (void);
+
+ CORBA::Object_ptr invoke_key_to_object (ACE_ENV_SINGLE_ARG_DECL);
+
+ CORBA::Boolean system_id (void);
+
+ CORBA::ULong waiting_servant_deactivation (void) const;
+
+ /// Return the POA Manager related to this POA
+ TAO_POA_Manager &tao_poa_manager ();
+
+ bool is_poa_generated (CORBA::Object_ptr reference,
+ PortableServer::ObjectId &system_id
+ ACE_ENV_ARG_DECL);
+
+ /*
+ * Validate if the servant may be activated
+ * @retval true This servant may be activated
+ * @retval false This servant may not be activated
+ */
+ bool is_servant_activation_allowed (
+ PortableServer::Servant servant,
+ int &wait_occurred_restart_call);
+
+ int rebind_using_user_id_and_system_id (
+ PortableServer::Servant servant,
+ const PortableServer::ObjectId &user_id,
+ const PortableServer::ObjectId &system_id,
+ TAO::Portable_Server::Servant_Upcall &servant_upcall);
+
+ CORBA::Boolean servant_has_remaining_activations (
+ PortableServer::Servant servant);
+
+ bool allow_implicit_activation (void) const;
+
+ bool allow_multiple_activations (void) const;
+
+ int is_servant_active (
+ PortableServer::Servant servant,
+ int &wait_occurred_restart_call);
+
+ void deactivate_object_i (const PortableServer::ObjectId &oid
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ObjectNotActive,
+ PortableServer::POA::WrongPolicy));
+
+ CORBA::Boolean is_persistent (void) const;
+
+ CORBA::Short server_priority (void) const;
+
+ bool has_system_id (void) const;
+
+ PortableServer::Servant find_servant (const PortableServer::ObjectId &system_id
+ ACE_ENV_ARG_DECL);
+
+ TAO_SERVANT_LOCATION servant_present (
+ const PortableServer::ObjectId &system_id,
+ PortableServer::Servant &servant
+ ACE_ENV_ARG_DECL);
+
+ PortableServer::Servant find_servant (
+ const PortableServer::ObjectId &system_id,
+ TAO::Portable_Server::Servant_Upcall &servant_upcall,
+ TAO::Portable_Server::POA_Current_Impl &poa_current_impl
+ ACE_ENV_ARG_DECL);
+
+ /**
+ * Find the the servant with ObjectId <system_id>, and retrieve
+ * its priority.Usually used in RT CORBA with SERVER_DECLARED
+ * priority model.
+ *
+ * @return -1 if servant does not exist, else 0 indicating the
+ * servant exists and priority successfully retrieved.
+ */
+ int find_servant_priority (
+ const PortableServer::ObjectId &system_id,
+ CORBA::Short &priority
+ ACE_ENV_ARG_DECL);
+
+ int unbind_using_user_id (const PortableServer::ObjectId &user_id);
+
+ void cleanup_servant (
+ PortableServer::Servant servant,
+ const PortableServer::ObjectId &user_id
+ ACE_ENV_ARG_DECL);
+
+ void post_invoke_servant_cleanup(
+ const PortableServer::ObjectId &system_id,
+ const TAO::Portable_Server::Servant_Upcall &servant_upcall);
+
+ bool validate_lifespan (
+ CORBA::Boolean is_persistent,
+ const TAO::Portable_Server::Temporary_Creation_Time& creation_time) const;
+
+ PortableServer::ObjectId *activate_object_i (
+ PortableServer::Servant p_servant,
+ CORBA::Short priority,
+ int &wait_occurred_restart_call
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ServantAlreadyActive,
+ PortableServer::POA::WrongPolicy));
+
+ CORBA::Object_ptr id_to_reference_i (const PortableServer::ObjectId &oid,
+ bool indirect
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ObjectNotActive,
+ PortableServer::POA::WrongPolicy));
+
+ PortableServer::ObjectId *servant_to_id_i (PortableServer::Servant servant
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ServantNotActive,
+ PortableServer::POA::WrongPolicy));
+
+ TAO_SYNCH_CONDITION &servant_deactivation_condition (void);
+
+ int is_poa_generated_id (const PortableServer::ObjectId &id);
+
+ /// Check the state of this POA
+ void check_state (ACE_ENV_SINGLE_ARG_DECL);
+
+ int delete_child (const String &child);
+
+ PortableServer::Servant user_id_to_servant_i (const PortableServer::ObjectId &oid
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ObjectNotActive,
+ PortableServer::POA::WrongPolicy));
+
+ virtual CORBA::ORB_ptr _get_orb (
+ ACE_ENV_SINGLE_ARG_DECL
+ );
+
+ /// These hooks are needed by the CSD strategy to override
+ /// and no-ops by default.
+
+ /// Hook - The POA has been (or is being) activated.
+ virtual void poa_activated_hook ();
+
+ /// Hook - The POA has been deactivated.
+ virtual void poa_deactivated_hook ();
+
+ /// Hook - A servant has been activated.
+ virtual void servant_activated_hook (PortableServer::Servant servant,
+ const PortableServer::ObjectId& oid
+ ACE_ENV_ARG_DECL);
+
+ /// Hook - A servant has been deactivated.
+ virtual void servant_deactivated_hook (PortableServer::Servant servant,
+ const PortableServer::ObjectId& oid
+ ACE_ENV_ARG_DECL);
+
+protected:
+
+#if (TAO_HAS_MINIMUM_POA == 0)
+ int enter (void);
+
+ int exit (void);
+#endif /* TAO_HAS_MINIMUM_POA == 0 */
+
+ /// Template method for creating new POA's of this type.
+ virtual TAO_Root_POA *new_POA (const String &name,
+ PortableServer::POAManager_ptr poa_manager,
+ const TAO_POA_Policy_Set &policies,
+ TAO_Root_POA *parent,
+ ACE_Lock &lock,
+ TAO_SYNCH_MUTEX &thread_lock,
+ TAO_ORB_Core &orb_core,
+ TAO_Object_Adapter *object_adapter
+ ACE_ENV_ARG_DECL);
+
+#if ! defined (CORBA_E_MICRO)
+ PortableServer::POA_ptr create_POA_i (
+ const char *adapter_name,
+ PortableServer::POAManager_ptr poa_manager,
+ const CORBA::PolicyList &policies
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::AdapterAlreadyExists,
+ PortableServer::POA::InvalidPolicy));
+
+ PortableServer::POA_ptr create_POA_i (const String &adapter_name,
+ PortableServer::POAManager_ptr poa_manager,
+ const TAO_POA_Policy_Set &policies
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::AdapterAlreadyExists,
+ PortableServer::POA::InvalidPolicy));
+
+ TAO_Root_POA *find_POA_i (const ACE_CString &child_name,
+ CORBA::Boolean activate_it
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::AdapterNonExistent));
+#endif
+
+ void destroy_i (CORBA::Boolean etherealize_objects,
+ CORBA::Boolean wait_for_completion
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ void complete_destruction_i (ACE_ENV_SINGLE_ARG_DECL);
+
+ PortableServer::POAList *the_children_i (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// This method returns the adapter_name as a sequence of strings of
+ /// length one or more or just a fixed name depending on the Object
+ /// Adapter. Added wrt to ORT Spec.
+ PortableInterceptor::AdapterName *adapter_name_i (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Method to notify the IOR Interceptors when there is a state
+ /// changed not related to POAManager.
+ void adapter_state_changed (
+ const TAO::ORT_Array &array_obj_ref_template,
+ PortableInterceptor::AdapterState state
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Add the given tagged component to all profiles.
+ void add_ior_component (TAO_MProfile & mprofile,
+ const IOP::TaggedComponent & component
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Add the given tagged component to all profiles matching the given
+ /// ProfileId.
+ void add_ior_component_to_profile (TAO_MProfile & mprofile,
+ const IOP::TaggedComponent & component,
+ IOP::ProfileId profile_id
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Wrapper for the ORB's key_to_object that will alter the object pointer
+ /// if the ImplRepo is used.
+ CORBA::Object_ptr key_to_object (const TAO::ObjectKey &key,
+ const char *type_id,
+ TAO_ServantBase *servant,
+ CORBA::Boolean collocated,
+ CORBA::Short priority,
+ bool indirect
+ ACE_ENV_ARG_DECL);
+
+ /// Like key_to_stub() but assume that the ORB is not shutting down.
+ virtual TAO_Stub* key_to_stub_i (const TAO::ObjectKey &key,
+ const char *type_id,
+ CORBA::Short priority
+ ACE_ENV_ARG_DECL);
+
+ TAO_Stub *create_stub_object (const TAO::ObjectKey &object_key,
+ const char *type_id,
+ CORBA::PolicyList *policy_list,
+ TAO_Acceptor_Filter *filter,
+ TAO_Acceptor_Registry &acceptor_registry
+ ACE_ENV_ARG_DECL);
+
+ PortableServer::Servant get_servant_i (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongPolicy));
+
+protected:
+#if !defined (CORBA_E_MICRO)
+ void activate_object_with_id_i (const PortableServer::ObjectId &id,
+ PortableServer::Servant p_servant,
+ CORBA::Short priority,
+ int &wait_occurred_restart_call
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ServantAlreadyActive,
+ PortableServer::POA::ObjectAlreadyActive,
+ PortableServer::POA::WrongPolicy));
+#endif
+
+ virtual void remove_from_parent_i (ACE_ENV_SINGLE_ARG_DECL);
+
+ void deactivate_all_objects_i (CORBA::Boolean etherealize_objects
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongPolicy));
+
+ void deactivate_all_objects_i (CORBA::Boolean etherealize_objects,
+ CORBA::Boolean wait_for_completion
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongPolicy));
+
+ void wait_for_completions (CORBA::Boolean wait_for_completion
+ ACE_ENV_ARG_DECL);
+
+ CORBA::Object_ptr create_reference_i (const char *intf,
+ CORBA::Short priority
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongPolicy));
+
+ CORBA::Object_ptr create_reference_with_id_i (
+ const PortableServer::ObjectId &oid,
+ const char *intf,
+ CORBA::Short priority
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ PortableServer::Servant reference_to_servant_i (
+ CORBA::Object_ptr reference
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ObjectNotActive,
+ PortableServer::POA::WrongAdapter,
+ PortableServer::POA::WrongPolicy));
+
+ CORBA::Object_ptr servant_to_reference_i (PortableServer::Servant p_servant
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ServantNotActive,
+ PortableServer::POA::WrongPolicy));
+
+ PortableServer::Servant id_to_servant_i (const PortableServer::ObjectId &oid
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ObjectNotActive,
+ PortableServer::POA::WrongPolicy));
+
+ /// Call the IORInterceptor::establish_components() method on all
+ /// registered IORInterceptors.
+ /**
+ * This method calls IORInterceptor::establish_components() method
+ * on all registered IORInterceptors, and
+ * IORInterceptor::components_established() once the former is
+ * completed.
+ */
+ void establish_components (ACE_ENV_SINGLE_ARG_DECL);
+
+ /// Call the IORInterceptor::components_established() method on all
+ /// registered IORInterceptors.
+ void components_established (PortableInterceptor::IORInfo_ptr info
+ ACE_ENV_ARG_DECL);
+
+ void set_folded_name (TAO_Root_POA *parent);
+
+ void set_id (TAO_Root_POA *parent);
+
+ TAO::ObjectKey *create_object_key (const PortableServer::ObjectId &id);
+
+ static int parse_key (const TAO::ObjectKey &key,
+ TAO_Object_Adapter::poa_name &poa_system_name,
+ PortableServer::ObjectId &system_id,
+ CORBA::Boolean &is_root,
+ CORBA::Boolean &is_persistent,
+ CORBA::Boolean &is_system_id,
+ TAO::Portable_Server::Temporary_Creation_Time &poa_creation_time);
+
+protected:
+ /// Accessor methods to ObjectReferenceTemplate
+ PortableInterceptor::ObjectReferenceTemplate *
+ get_adapter_template (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Accessor methods to ObjectReferenceTemplate, non locked version
+ PortableInterceptor::ObjectReferenceTemplate *get_adapter_template_i (void);
+
+ /// Accessor methods to PortableInterceptor::ObjectReferenceFactory
+ PortableInterceptor::ObjectReferenceFactory *
+ get_obj_ref_factory (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Set the object reference factory
+ void set_obj_ref_factory (
+ PortableInterceptor::ObjectReferenceFactory *current_factory
+ ACE_ENV_ARG_DECL);
+
+
+ TAO_SERVANT_LOCATION locate_servant_i (const PortableServer::ObjectId &id,
+ PortableServer::Servant &servant
+ ACE_ENV_ARG_DECL);
+
+ PortableServer::Servant locate_servant_i (
+ const char *operation,
+ const PortableServer::ObjectId &id,
+ TAO::Portable_Server::Servant_Upcall &servant_upcall,
+ TAO::Portable_Server::POA_Current_Impl &poa_current_impl,
+ int &wait_occurred_restart_call
+ ACE_ENV_ARG_DECL
+ );
+
+public:
+ // @todo Temporarily for servant retention
+ CORBA::Object_ptr
+ invoke_key_to_object_helper_i (const char * repository_id,
+ const PortableServer::ObjectId & id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+protected:
+
+ /// Get the ORT adapter, in case there is no adapter yet, this method will
+ /// try to create one and hold the POA lock
+ TAO::ORT_Adapter *ORT_adapter (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Get the ORT adapter, in case there is no adapter yet, this method will
+ /// try to create one but assumes the POA lock is already hold
+ TAO::ORT_Adapter *ORT_adapter_i (void);
+
+ TAO::ORT_Adapter_Factory *ORT_adapter_factory (void);
+
+ CORBA::Boolean persistent (void);
+
+ static char persistent_key_char (void);
+
+ static char transient_key_char (void);
+
+ static CORBA::ULong persistent_key_type_length (void);
+
+ static char system_id_key_char (void);
+
+ static char user_id_key_char (void);
+
+ static CORBA::ULong system_id_key_type_length (void);
+
+ virtual CORBA::Boolean root (void) const;
+
+ virtual char root_key_type (void);
+
+ static char root_key_char (void);
+
+ static char non_root_key_char (void);
+
+ static CORBA::ULong root_key_type_length (void);
+
+ void outstanding_requests (CORBA::ULong new_outstanding_requests);
+
+ CORBA::ULong increment_outstanding_requests (void);
+
+ CORBA::ULong decrement_outstanding_requests (void);
+
+ String name_;
+
+ /// Reference to the POAManager that this poa assicuates with.
+ TAO_POA_Manager &poa_manager_;
+ /// Reference to the POAManagerFactory that generate the POAManager.
+ TAO_POAManager_Factory& poa_manager_factory_;
+
+ IOP::TaggedComponentList tagged_component_;
+
+ IOP::TaggedComponentList tagged_component_id_;
+
+ ACE_Array_Base <IOP::ProfileId> profile_id_array_;
+
+ TAO_POA_Policy_Set policies_;
+
+ TAO_Object_Adapter::poa_name folded_name_;
+
+ TAO_Object_Adapter::poa_name_var system_name_;
+
+ CORBA::OctetSeq id_;
+
+ /// Pointer to the object reference template adapter.
+ TAO::ORT_Adapter *ort_adapter_;
+
+ /// Adapter can be accepting, rejecting etc.
+ PortableInterceptor::AdapterState adapter_state_;
+
+ TAO::Portable_Server::Cached_Policies cached_policies_;
+
+ TAO::Portable_Server::Active_Policy_Strategies active_policy_strategies_;
+
+#if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
+ PortableServer::AdapterActivator_var adapter_activator_;
+#endif /* TAO_HAS_MINIMUM_POA == 0 !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO) */
+
+ typedef
+ ACE_Hash_Map_Manager_Ex<
+ ACE_CString, TAO_Root_POA *,
+ ACE_Hash<ACE_CString>,
+ ACE_Equal_To<ACE_CString>,
+ ACE_Null_Mutex
+ >
+ CHILDREN;
+
+ CHILDREN children_;
+
+ ACE_Lock &lock_;
+
+ TAO_ORB_Core &orb_core_;
+
+ /// The object adapter we belong to
+ TAO_Object_Adapter *object_adapter_;
+
+ CORBA::Boolean cleanup_in_progress_;
+
+ CORBA::ULong outstanding_requests_;
+
+ TAO_SYNCH_CONDITION outstanding_requests_condition_;
+
+ CORBA::Boolean wait_for_completion_pending_;
+
+ CORBA::Boolean waiting_destruction_;
+
+ TAO_SYNCH_CONDITION servant_deactivation_condition_;
+
+ TAO_Acceptor_Filter_Factory * filter_factory_;
+
+public:
+ // @todo Temporarily for servant retention
+ CORBA::ULong caller_key_to_object_;
+
+ PortableServer::Servant servant_for_key_to_object_;
+
+ struct Key_To_Object_Params
+ {
+ PortableServer::ObjectId_var *system_id_;
+ const char *type_id_;
+ TAO_ServantBase *servant_;
+ CORBA::Boolean collocated_;
+ CORBA::Short priority_;
+ bool indirect_;
+
+ void set (PortableServer::ObjectId_var &system_id_,
+ const char *type_id_,
+ TAO_ServantBase *servant_,
+ CORBA::Boolean collocated_,
+ CORBA::Short priority_,
+ bool indirect);
+ };
+
+ Key_To_Object_Params key_to_object_params_;
+};
+
+/**
+ * @class TAO_POA_Static_Resources
+ *
+ * @brief The static (global) resoures of all POA's.
+ *
+ * This class is used by the POA to store the resources global to
+ * all POA's. All instance variables that would have been
+ * declared "static" in TAO_Regular_POA, should be declared in this class
+ * to avoid the "static initialization order fiasco" as described in
+ * http://www.parashift.com/c++-faq-lite/ctors.html#faq-10.11.
+ * Briefly, this is the problem that occurs if any static initializers
+ * in any other code call into set static members of TAO_Regular_POA.
+ * Since the order in which these initializers execute is unspecified,
+ * uninitialized members can be accessed.
+ */
+class TAO_PortableServer_Export TAO_POA_Static_Resources
+{
+public:
+
+ /// Return the singleton instance.
+ static TAO_POA_Static_Resources* instance (void);
+
+public:
+
+ /**
+ * Name of the factory object used to adapt function calls on the
+ * PortableInterceptor interfaces ORT. The default value is
+ * "ObjectReferenceTemplate_Adapter_Factory". If the ORT library is linked,
+ * the corresponding accessor function
+ * objectreferencefactory_adapter_factory_name() will be called to set
+ * the value to "Concrete_ObjectReferenceTemplate_Adapter_Factory".
+ */
+ ACE_CString ort_adapter_factory_name_;
+
+ /**
+ * Name of the service object for functions that make calls on
+ * the Implementation Repository. The default value is "ImR_Client_Adapter".
+ * If TAO_IMR_CLient is linked, imr_client_adapter_name() will be
+ * called to set the value to "Concrete_ImR_Client_Adapter".
+ */
+ ACE_CString imr_client_adapter_name_;
+private:
+ /// Constructor.
+ TAO_POA_Static_Resources (void);
+
+private:
+ /// The singleton instance.
+ static TAO_POA_Static_Resources* instance_;
+
+ /// Mostly unused variable whose sole purpose is to enforce
+ /// the instantiation of a TAO_POA_Static_Resources instance
+ /// at initialization time.
+ static TAO_POA_Static_Resources* initialization_reference_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+// ****************************************************************
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#if defined (__ACE_INLINE__)
+# include "tao/PortableServer/Root_POA.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_ROOT_POA_H */
diff --git a/TAO/tao/PortableServer/Root_POA.inl b/TAO/tao/PortableServer/Root_POA.inl
new file mode 100644
index 00000000000..116d1d99c4f
--- /dev/null
+++ b/TAO/tao/PortableServer/Root_POA.inl
@@ -0,0 +1,246 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// Exception macros
+#include "tao/Environment.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE CORBA::Boolean
+TAO_Root_POA::cleanup_in_progress (void)
+{
+ return this->cleanup_in_progress_;
+}
+
+ACE_INLINE ACE_Lock &
+TAO_Root_POA::lock (void)
+{
+ return this->lock_;
+}
+
+ACE_INLINE TAO_POA_Policy_Set &
+TAO_Root_POA::policies (void)
+{
+ return this->policies_;
+}
+
+ACE_INLINE PortableServer::POA_ptr
+TAO_Root_POA::the_parent (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return PortableServer::POA::_nil ();
+}
+
+ACE_INLINE PortableInterceptor::AdapterName *
+TAO_Root_POA::adapter_name (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return this->adapter_name_i (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+ACE_INLINE PortableInterceptor::ObjectReferenceTemplate *
+TAO_Root_POA::get_adapter_template (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ TAO::ORT_Adapter *adapter = this->ORT_adapter (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ if (adapter)
+ {
+ return this->ort_adapter_->get_adapter_template();
+ }
+
+ return 0;
+}
+
+ACE_INLINE PortableInterceptor::ObjectReferenceTemplate *
+TAO_Root_POA::get_adapter_template_i ()
+{
+ if (this->ORT_adapter_i ())
+ {
+ return this->ort_adapter_->get_adapter_template ();
+ }
+
+ return 0;
+}
+
+ACE_INLINE PortableInterceptor::ObjectReferenceFactory *
+TAO_Root_POA::get_obj_ref_factory (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ TAO::ORT_Adapter *adapter = this->ORT_adapter (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ if (adapter)
+ {
+ return this->ort_adapter_->get_obj_ref_factory();
+ }
+
+ return 0;
+}
+
+ACE_INLINE CORBA::Boolean
+TAO_Root_POA::system_id (void)
+{
+ return (this->cached_policies_.id_assignment () == PortableServer::SYSTEM_ID);
+}
+
+ACE_INLINE CORBA::Boolean
+TAO_Root_POA::persistent (void)
+{
+ return (this->cached_policies_.lifespan () == PortableServer::PERSISTENT);
+}
+
+ACE_INLINE const ACE_CString &
+TAO_Root_POA::name (void) const
+{
+ return this->name_;
+}
+
+ACE_INLINE char *
+TAO_Root_POA::the_name (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return CORBA::string_dup (this->name_.c_str ());
+}
+
+ACE_INLINE const TAO_Object_Adapter::poa_name &
+TAO_Root_POA::folded_name (void) const
+{
+ return this->folded_name_;
+}
+
+ACE_INLINE const TAO_Object_Adapter::poa_name &
+TAO_Root_POA::system_name (void) const
+{
+ return this->system_name_.in ();
+}
+
+ACE_INLINE char
+TAO_Root_POA::name_separator (void)
+{
+ return '\0';
+}
+
+ACE_INLINE CORBA::ULong
+TAO_Root_POA::name_separator_length (void)
+{
+ return sizeof (char);
+}
+
+ACE_INLINE char
+TAO_Root_POA::persistent_key_char (void)
+{
+ return 'P';
+}
+
+ACE_INLINE char
+TAO_Root_POA::transient_key_char (void)
+{
+ return 'T';
+}
+
+ACE_INLINE CORBA::ULong
+TAO_Root_POA::persistent_key_type_length (void)
+{
+ return sizeof (char);
+}
+
+ACE_INLINE char
+TAO_Root_POA::system_id_key_char (void)
+{
+ return 'S';
+}
+
+ACE_INLINE char
+TAO_Root_POA::user_id_key_char (void)
+{
+ return 'U';
+}
+
+ACE_INLINE CORBA::ULong
+TAO_Root_POA::system_id_key_type_length (void)
+{
+ return sizeof (char);
+}
+
+ACE_INLINE char
+TAO_Root_POA::root_key_char (void)
+{
+ return 'R';
+}
+
+ACE_INLINE char
+TAO_Root_POA::non_root_key_char (void)
+{
+ return 'N';
+}
+
+ACE_INLINE char
+TAO_Root_POA::root_key_type (void)
+{
+ return TAO_Root_POA::root_key_char ();
+}
+
+ACE_INLINE CORBA::ULong
+TAO_Root_POA::root_key_type_length (void)
+{
+ return sizeof (char);
+}
+
+ACE_INLINE CORBA::ULong
+TAO_Root_POA::outstanding_requests (void) const
+{
+ return this->outstanding_requests_;
+}
+
+ACE_INLINE void
+TAO_Root_POA::outstanding_requests (CORBA::ULong new_outstanding_requests)
+{
+ this->outstanding_requests_ = new_outstanding_requests;
+}
+
+ACE_INLINE CORBA::ULong
+TAO_Root_POA::increment_outstanding_requests (void)
+{
+ return ++this->outstanding_requests_;
+}
+
+ACE_INLINE CORBA::ULong
+TAO_Root_POA::decrement_outstanding_requests (void)
+{
+ return --this->outstanding_requests_;
+}
+
+ACE_INLINE CORBA::Boolean
+TAO_Root_POA::waiting_destruction (void) const
+{
+ return this->waiting_destruction_;
+}
+
+ACE_INLINE TAO_ORB_Core &
+TAO_Root_POA::orb_core (void) const
+{
+ return this->orb_core_;
+}
+
+ACE_INLINE PortableInterceptor::AdapterState
+TAO_Root_POA::get_adapter_state (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+{
+ return this->adapter_state_;
+}
+
+ACE_INLINE void *
+TAO_Root_POA::thread_pool (void) const
+{
+ return 0;
+}
+
+ACE_INLINE TAO_SYNCH_CONDITION &
+TAO_Root_POA::servant_deactivation_condition (void)
+{
+ return servant_deactivation_condition_;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/SArg_Traits_T.h b/TAO/tao/PortableServer/SArg_Traits_T.h
new file mode 100644
index 00000000000..09f01b6bef4
--- /dev/null
+++ b/TAO/tao/PortableServer/SArg_Traits_T.h
@@ -0,0 +1,42 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file SArg_Traits_T.h
+ *
+ * $Id$
+ *
+ * @author Jeff Parsons
+ * @author Carlos O'Ryan
+ */
+//=============================================================================
+
+#ifndef TAO_SARG_TRAITS_T_H
+#define TAO_SARG_TRAITS_T_H
+
+#include /**/ "ace/pre.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ /**
+ *
+ * @brief Base class for all skeleton arg traits specializations.
+ *
+ */
+ template<typename T>
+ class SArg_Traits
+ {
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_SARG_TRAITS_T_H */
diff --git a/TAO/tao/PortableServer/ServantActivator.pidl b/TAO/tao/PortableServer/ServantActivator.pidl
new file mode 100644
index 00000000000..daadaa4a612
--- /dev/null
+++ b/TAO/tao/PortableServer/ServantActivator.pidl
@@ -0,0 +1,54 @@
+/**
+ * @file ServantActivator.pidl
+ *
+ * $Id$
+ *
+ * @brief Pre-compiled IDL source for the PortableServer module.
+ *
+ * This file was used to generate the code in
+ * ServantActivatorC.{h,inl,cpp}, using the following command:
+ *
+ * tao_idl.exe \
+ * -o orig -Gp -Gd -Ge 1 -Sci -GA -I$(TAO_ROOT)
+ * -Wb,export_macro=TAO_PortableServer_Export \
+ * -Wb,export_include="portableserver_export.h" \
+ * -Wb,pre_include="ace/pre.h" \
+ * -Wb,post_include="ace/post.h" \
+ * ServantActivator.pidl
+ */
+
+#ifndef _PORTABLESERVER_SERVANT_ACTIVATOR_IDL_
+#define _PORTABLESERVER_SERVANT_ACTIVATOR_IDL_
+
+///FUZZ: disable check_for_include/
+#include "tao/PortableServer/PS_Forward.pidl"
+#include "tao/PortableServer/ServantManager.pidl"
+#include "tao/PortableServer/ForwardRequest.pidl"
+
+#pragma prefix "omg.org"
+
+#if ! defined (CORBA_E_COMPACT) && ! defined (CORBA_E_MICRO) && !defined (TAO_HAS_MINIMUM_POA)
+
+module PortableServer
+{
+# pragma version PortableServer 2.3
+
+ local interface ServantActivator : ServantManager
+ {
+# pragma version ServantActivator 2.3
+
+ Servant incarnate (in ObjectId oid,
+ in POA adapter)
+ raises (ForwardRequest);
+
+ void etherealize (in ObjectId oid,
+ in POA adapter,
+ in Servant serv,
+ in boolean cleanup_in_progress,
+ in boolean remaining_activations);
+ };
+};
+
+#endif
+
+#endif // _PORTABLESERVER_SERVANT_ACTIVATOR_IDL_
diff --git a/TAO/tao/PortableServer/ServantLocator.pidl b/TAO/tao/PortableServer/ServantLocator.pidl
new file mode 100644
index 00000000000..19221cde6f8
--- /dev/null
+++ b/TAO/tao/PortableServer/ServantLocator.pidl
@@ -0,0 +1,63 @@
+/**
+ * @file ServantLocator.pidl
+ *
+ * $Id$
+ *
+ * @brief Pre-compiled IDL source for the PortableServer module.
+ *
+ * This file was used to generate the code in
+ * ServantLocatorC.{h,inl,cpp}, using the following command:
+ *
+ * tao_idl.exe \
+ * -o orig -Gp -Gd -Ge 1 -Sci -GA -I$(TAO_ROOT)
+ * -Wb,export_macro=TAO_PortableServer_Export \
+ * -Wb,export_include="portableserver_export.h" \
+ * -Wb,pre_include="ace/pre.h" \
+ * -Wb,post_include="ace/post.h" \
+ * ServantLocator.pidl
+ *
+ * Apply patches using the following command:
+ *
+ * patch < diffs/PS_Forward.diff
+ */
+
+#ifndef _PORTABLESERVER_SERVANTLOCATOR_IDL_
+#define _PORTABLESERVER_SERVANTLOCATOR_IDL_
+
+///FUZZ: disable check_for_include/
+#include "tao/orb_types.pidl"
+#include "tao/PortableServer/PS_Forward.pidl"
+#include "tao/PortableServer/ServantManager.pidl"
+#include "tao/PortableServer/ForwardRequest.pidl"
+
+#pragma prefix "omg.org"
+
+#if ! defined (CORBA_E_COMPACT) && ! defined (CORBA_E_MICRO) && !defined (TAO_HAS_MINIMUM_POA)
+
+module PortableServer
+{
+# pragma version PortableServer 2.3
+
+ local interface ServantLocator : ServantManager
+ {
+# pragma version ServantLocator 2.3
+
+ native Cookie;
+
+ Servant preinvoke (in ObjectId oid,
+ in POA adapter,
+ in CORBA::Identifier operation,
+ out Cookie the_cookie)
+ raises (ForwardRequest);
+
+ void postinvoke (in ObjectId oid,
+ in POA adapter,
+ in CORBA::Identifier operation,
+ in Cookie the_cookie,
+ in Servant the_servant);
+ };
+};
+
+#endif
+
+#endif // _PORTABLESERVER_SERVANTLOCATOR_IDL_
diff --git a/TAO/tao/PortableServer/ServantManager.pidl b/TAO/tao/PortableServer/ServantManager.pidl
new file mode 100644
index 00000000000..52c3707f543
--- /dev/null
+++ b/TAO/tao/PortableServer/ServantManager.pidl
@@ -0,0 +1,37 @@
+/**
+ * @file ServantManager.pidl
+ *
+ * $Id$
+ *
+ * @brief Pre-compiled IDL source for the PortableServer module.
+ *
+ * This file was used to generate the code in
+ * ServantManagerC.{h,inl,cpp}, using the following command:
+ *
+ * tao_idl.exe \
+ * -o orig -Gp -Gd -Ge 1 -Sci -GA -I$(TAO_ROOT)
+ * -Wb,export_macro=TAO_PortableServer_Export \
+ * -Wb,export_include="portableserver_export.h" \
+ * -Wb,pre_include="ace/pre.h" \
+ * -Wb,post_include="ace/post.h" \
+ * ServantManager.pidl
+ */
+
+#ifndef _PORTABLESERVER_SERVANT_MANAGER_IDL_
+#define _PORTABLESERVER_SERVANT_MANAGER_IDL_
+
+#pragma prefix "omg.org"
+
+#if !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO) && !defined (TAO_HAS_MINIMUM_POA)
+
+module PortableServer
+{
+# pragma version PortableServer 2.3
+
+ // ServantManager interface.
+ local interface ServantManager {};
+};
+
+#endif
+
+#endif // _PORTABLESERVER_SERVANT_MANAGER_IDL_
diff --git a/TAO/tao/PortableServer/ServantRetentionPolicy.cpp b/TAO/tao/PortableServer/ServantRetentionPolicy.cpp
new file mode 100644
index 00000000000..b4301aef697
--- /dev/null
+++ b/TAO/tao/PortableServer/ServantRetentionPolicy.cpp
@@ -0,0 +1,71 @@
+#include "tao/PortableServer/ServantRetentionPolicy.h"
+#include "tao/PortableServer/PortableServer.h"
+
+ACE_RCSID (PortableServer,
+ ServantRetentionPolicy,
+ "$Id$")
+
+#if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ ServantRetentionPolicy::ServantRetentionPolicy (
+ ::PortableServer::ServantRetentionPolicyValue value) :
+ value_ (value)
+ {
+ }
+
+ CORBA::Policy_ptr
+ ServantRetentionPolicy::copy (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ ServantRetentionPolicy *copy = 0;
+ ACE_NEW_THROW_EX (copy,
+ ServantRetentionPolicy (this->value_),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+
+ return copy;
+ }
+
+ void
+ ServantRetentionPolicy::destroy (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ }
+
+ ::PortableServer::ServantRetentionPolicyValue
+ ServantRetentionPolicy::value (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ return this->value_;
+ }
+
+ CORBA::PolicyType
+ ServantRetentionPolicy::policy_type (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ return ::PortableServer::SERVANT_RETENTION_POLICY_ID;
+ }
+
+ TAO_Cached_Policy_Type
+ ServantRetentionPolicy::_tao_cached_type (void) const
+ {
+ return TAO_CACHED_POLICY_SERVANT_RETENTION;
+ }
+
+ TAO_Policy_Scope
+ ServantRetentionPolicy::_tao_scope (void) const
+ {
+ return TAO_POLICY_POA_SCOPE;
+ }
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_MINIMUM_POA == 0 */
diff --git a/TAO/tao/PortableServer/ServantRetentionPolicy.h b/TAO/tao/PortableServer/ServantRetentionPolicy.h
new file mode 100644
index 00000000000..948d7ee33dc
--- /dev/null
+++ b/TAO/tao/PortableServer/ServantRetentionPolicy.h
@@ -0,0 +1,81 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file ServantRetentionPolicy.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_PORTABLESERVER_SERVANTRETENTIONPOLICY_H
+#define TAO_PORTABLESERVER_SERVANTRETENTIONPOLICY_H
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/ServantRetentionPolicyC.h"
+#include "tao/LocalObject.h"
+
+// This is to remove "inherits via dominance" warnings from MSVC.
+// MSVC is being a little too paranoid.
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+#if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ class TAO_PortableServer_Export ServantRetentionPolicy :
+ public virtual ::PortableServer::ServantRetentionPolicy,
+ public virtual TAO_Local_RefCounted_Object
+ {
+ public:
+ ServantRetentionPolicy (::PortableServer::ServantRetentionPolicyValue value);
+
+ CORBA::Policy_ptr copy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ void destroy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ ::PortableServer::ServantRetentionPolicyValue value (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ CORBA::PolicyType policy_type (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Return the cached policy type for this policy.
+ TAO_Cached_Policy_Type _tao_cached_type (void) const;
+
+ /// Returns the scope at which this policy can be applied. See orbconf.h.
+ TAO_Policy_Scope _tao_scope (void) const;
+
+ private:
+ ::PortableServer::ServantRetentionPolicyValue value_;
+ };
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_MINIMUM_POA == 0 */
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_PORTABLESERVER_SERVANTRETENTIONPOLICY_H */
diff --git a/TAO/tao/PortableServer/ServantRetentionPolicy.pidl b/TAO/tao/PortableServer/ServantRetentionPolicy.pidl
new file mode 100644
index 00000000000..79f6b54bd46
--- /dev/null
+++ b/TAO/tao/PortableServer/ServantRetentionPolicy.pidl
@@ -0,0 +1,45 @@
+/**
+ * @file ServantRetentionPolicy.pidl
+ *
+ * $Id$
+ *
+ * @brief Pre-compiled IDL source for the PortableServer module.
+ *
+ * tao_idl.exe \
+ * -o orig -Gp -Gd -Ge 1 -Sci -GA -I$(TAO_ROOT)
+ * -Wb,export_macro=TAO_PortableServer_Export \
+ * -Wb,export_include="portableserver_export.h" \
+ * -Wb,pre_include="ace/pre.h" \
+ * -Wb,post_include="ace/post.h" \
+ * ServantRetentionPolicy.pidl
+ */
+
+#ifndef _PORTABLESERVER_SERVANTRETENTIONPOLICY_IDL_
+#define _PORTABLESERVER_SERVANTRETENTIONPOLICY_IDL_
+
+#include "tao/Policy.pidl"
+
+#pragma prefix "omg.org"
+
+module PortableServer
+{
+# pragma version PortableServer 2.3
+
+ enum ServantRetentionPolicyValue
+ {
+ RETAIN,
+ NON_RETAIN
+ };
+
+#if !defined (TAO_HAS_MINIMUM_POA) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
+
+ local interface ServantRetentionPolicy : CORBA::Policy
+ {
+ readonly attribute ServantRetentionPolicyValue value;
+ };
+
+#endif
+
+};
+
+#endif // _PORTABLESERVER_SERVANTRETENTIONPOLICY_IDL_
diff --git a/TAO/tao/PortableServer/ServantRetentionStrategy.h b/TAO/tao/PortableServer/ServantRetentionStrategy.h
new file mode 100644
index 00000000000..053fcb8961e
--- /dev/null
+++ b/TAO/tao/PortableServer/ServantRetentionStrategy.h
@@ -0,0 +1,166 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file ServantRetentionStrategy.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_SERVANTRETENTIONSTRATEGY_H
+#define TAO_SERVANTRETENTIONSTRATEGY_H
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/Policy_Strategy.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/Servant_Location.h"
+#include "tao/PortableServer/Servant_Upcall.h"
+#include "tao/PortableServer/ServantRetentionPolicyC.h"
+#include "tao/PortableServer/PortableServer.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Root_POA;
+class TAO_Active_Object_Map;
+struct TAO_Active_Object_Map_Entry;
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ class ServantRetentionStrategy
+ : public Policy_Strategy
+ {
+ public:
+ virtual CORBA::ULong waiting_servant_deactivation (void) const = 0;
+
+ virtual int is_servant_in_map (PortableServer::Servant servant,
+ int &wait_occurred_restart_call) = 0;
+
+ virtual TAO_SERVANT_LOCATION servant_present (
+ const PortableServer::ObjectId &system_id,
+ PortableServer::Servant &servant
+ ACE_ENV_ARG_DECL) = 0;
+
+ virtual PortableServer::Servant find_servant (
+ const PortableServer::ObjectId &system_id,
+ TAO::Portable_Server::Servant_Upcall &servant_upcall,
+ TAO::Portable_Server::POA_Current_Impl &poa_current_impl
+ ACE_ENV_ARG_DECL) = 0;
+
+ virtual int find_servant_priority (
+ const PortableServer::ObjectId &system_id,
+ CORBA::Short &priority
+ ACE_ENV_ARG_DECL) = 0;
+
+ virtual PortableServer::ObjectId *activate_object (
+ PortableServer::Servant servant,
+ CORBA::Short priority,
+ int &wait_occurred_restart_call
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ServantAlreadyActive,
+ PortableServer::POA::WrongPolicy)) = 0;
+
+#if !defined (CORBA_E_MICRO)
+ virtual void activate_object_with_id (
+ const PortableServer::ObjectId &id,
+ PortableServer::Servant servant,
+ CORBA::Short priority,
+ int &wait_occurred_restart_call
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ServantAlreadyActive,
+ PortableServer::POA::ObjectAlreadyActive,
+ PortableServer::POA::WrongPolicy)) = 0;
+#endif
+
+ virtual void deactivate_object (const PortableServer::ObjectId &id
+ ACE_ENV_ARG_DECL) = 0;
+
+ virtual PortableServer::Servant find_servant (
+ const PortableServer::ObjectId &system_id
+ ACE_ENV_ARG_DECL) = 0;
+
+ virtual PortableServer::ObjectId *system_id_to_object_id (
+ const PortableServer::ObjectId &system_id
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongAdapter,
+ PortableServer::POA::WrongPolicy)) = 0;
+
+ virtual PortableServer::Servant user_id_to_servant (
+ const PortableServer::ObjectId &id
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ObjectNotActive,
+ PortableServer::POA::WrongPolicy)) = 0;
+
+ virtual CORBA::Object_ptr id_to_reference (
+ const PortableServer::ObjectId &id,
+ bool indirect
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ObjectNotActive,
+ PortableServer::POA::WrongPolicy)) = 0;
+
+ virtual void deactivate_all_objects (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongPolicy)) = 0;
+
+ virtual PortableServer::ObjectId *servant_to_user_id (
+ PortableServer::Servant servant
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ServantNotActive,
+ PortableServer::POA::WrongPolicy)) = 0;
+
+ virtual CORBA::Object_ptr servant_to_reference (
+ PortableServer::Servant servant
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ServantNotActive,
+ PortableServer::POA::WrongPolicy)) = 0;
+
+ virtual CORBA::Object_ptr create_reference (
+ const char *intf,
+ CORBA::Short priority
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongPolicy)) = 0;
+
+ virtual CORBA::Object_ptr create_reference_with_id (
+ const PortableServer::ObjectId &oid,
+ const char *intf,
+ CORBA::Short priority
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException)) = 0;
+
+ virtual int rebind_using_user_id_and_system_id (
+ PortableServer::Servant servant,
+ const PortableServer::ObjectId &user_id,
+ const PortableServer::ObjectId &system_id,
+ TAO::Portable_Server::Servant_Upcall &servant_upcall) = 0;
+
+ virtual int unbind_using_user_id (
+ const PortableServer::ObjectId &user_id) = 0;
+
+ virtual CORBA::Boolean servant_has_remaining_activations (
+ PortableServer::Servant servant) = 0;
+
+ virtual ::PortableServer::ServantRetentionPolicyValue type() const = 0;
+ };
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_SERVANTRETENTIONSTRATEGY_H */
diff --git a/TAO/tao/PortableServer/ServantRetentionStrategyFactory.h b/TAO/tao/PortableServer/ServantRetentionStrategyFactory.h
new file mode 100644
index 00000000000..84d581d0c18
--- /dev/null
+++ b/TAO/tao/PortableServer/ServantRetentionStrategyFactory.h
@@ -0,0 +1,52 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file ServantRetentionStrategyFactory.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_PORTABLESERVER_SERVANTRETENTIONSTRATEGYFACTORY_H
+#define TAO_PORTABLESERVER_SERVANTRETENTIONSTRATEGYFACTORY_H
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/StrategyFactory.h"
+#include "tao/PortableServer/ServantRetentionPolicyC.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ class ServantRetentionStrategy;
+
+ class TAO_PortableServer_Export ServantRetentionStrategyFactory
+ : public StrategyFactory
+ {
+ public:
+ /// Create a new servant retention strategy
+ virtual ServantRetentionStrategy* create (
+ ::PortableServer::ServantRetentionPolicyValue value) = 0;
+
+ virtual void destroy (
+ ServantRetentionStrategy *strategy
+ ACE_ENV_ARG_DECL) = 0;
+ };
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_PORTABLESERVER_SERVANTRETENTIONSTRATEGYFACTORY_H */
diff --git a/TAO/tao/PortableServer/ServantRetentionStrategyFactoryImpl.cpp b/TAO/tao/PortableServer/ServantRetentionStrategyFactoryImpl.cpp
new file mode 100644
index 00000000000..c1a5c11f000
--- /dev/null
+++ b/TAO/tao/PortableServer/ServantRetentionStrategyFactoryImpl.cpp
@@ -0,0 +1,96 @@
+// $Id$
+
+#include "tao/PortableServer/ServantRetentionStrategyFactoryImpl.h"
+#include "tao/PortableServer/ServantRetentionStrategy.h"
+#include "ace/Dynamic_Service.h"
+#include "ace/Log_Msg.h"
+
+ACE_RCSID (PortableServer,
+ ServantRetentionStrategyFactoryImpl,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ ServantRetentionStrategy*
+ ServantRetentionStrategyFactoryImpl::create (
+ ::PortableServer::ServantRetentionPolicyValue value)
+ {
+ ServantRetentionStrategyFactory *strategy_factory = 0;
+ const char *strategy_factory_name = 0;
+
+ switch (value)
+ {
+ case ::PortableServer::RETAIN :
+ {
+ strategy_factory_name = "ServantRetentionStrategyRetainFactory";
+ break;
+ }
+ case ::PortableServer::NON_RETAIN :
+ {
+ strategy_factory_name = "ServantRetentionStrategyNonRetainFactory";
+ break;
+ }
+ }
+
+ strategy_factory =
+ ACE_Dynamic_Service<ServantRetentionStrategyFactory>::instance (strategy_factory_name);
+
+ if (strategy_factory == 0)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) ERROR, Unable to get %s\n"),
+ strategy_factory_name));
+
+ return strategy_factory->create (value);
+ }
+
+ void
+ ServantRetentionStrategyFactoryImpl::destroy (
+ ServantRetentionStrategy *strategy
+ ACE_ENV_ARG_DECL)
+ {
+ const char *strategy_factory_name = 0;
+
+ switch (strategy->type ())
+ {
+ case ::PortableServer::RETAIN :
+ {
+ strategy_factory_name = "ServantRetentionStrategyRetainFactory";
+ break;
+ }
+ case ::PortableServer::NON_RETAIN :
+ {
+ strategy_factory_name = "ServantRetentionStrategyNonRetainFactory";
+ break;
+ }
+ }
+
+ ServantRetentionStrategyFactory *servantretention_strategy_factory =
+ ACE_Dynamic_Service<ServantRetentionStrategyFactory>::instance (strategy_factory_name);
+
+ if (servantretention_strategy_factory != 0)
+ {
+ servantretention_strategy_factory->destroy (strategy ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ }
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DEFINE (
+ ServantRetentionStrategyFactoryImpl,
+ ACE_TEXT ("ServantRetentionStrategyFactory"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (ServantRetentionStrategyFactoryImpl),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0)
+
+ACE_FACTORY_NAMESPACE_DEFINE (
+ ACE_Local_Service,
+ ServantRetentionStrategyFactoryImpl,
+ TAO::Portable_Server::ServantRetentionStrategyFactoryImpl)
diff --git a/TAO/tao/PortableServer/ServantRetentionStrategyFactoryImpl.h b/TAO/tao/PortableServer/ServantRetentionStrategyFactoryImpl.h
new file mode 100644
index 00000000000..b6864c9984e
--- /dev/null
+++ b/TAO/tao/PortableServer/ServantRetentionStrategyFactoryImpl.h
@@ -0,0 +1,53 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file ServantRetentionStrategyFactoryImpl.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_PORTABLESERVER_SERVANTRETENTIONSTRATEGYFACTORYIMPL_H
+#define TAO_PORTABLESERVER_SERVANTRETENTIONSTRATEGYFACTORYIMPL_H
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/Service_Config.h"
+#include "tao/PortableServer/ServantRetentionStrategyFactory.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ class TAO_PortableServer_Export ServantRetentionStrategyFactoryImpl
+ : public ServantRetentionStrategyFactory
+ {
+ public:
+ /// Create a new servant retention strategy
+ virtual ServantRetentionStrategy* create (
+ ::PortableServer::ServantRetentionPolicyValue value);
+
+ virtual void destroy (
+ ServantRetentionStrategy *strategy
+ ACE_ENV_ARG_DECL);
+ };
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE_EXPORT (TAO_PortableServer, ServantRetentionStrategyFactoryImpl)
+ACE_FACTORY_DECLARE (TAO_PortableServer, ServantRetentionStrategyFactoryImpl)
+
+#include /**/ "ace/post.h"
+#endif /* TAO_PORTABLESERVER_SERVANTRETENTIONSTRATEGYFACTORYIMPL_H */
diff --git a/TAO/tao/PortableServer/ServantRetentionStrategyNonRetain.cpp b/TAO/tao/PortableServer/ServantRetentionStrategyNonRetain.cpp
new file mode 100644
index 00000000000..a0a365fd003
--- /dev/null
+++ b/TAO/tao/PortableServer/ServantRetentionStrategyNonRetain.cpp
@@ -0,0 +1,347 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file ServantRetentionStrategyNonRetain.cpp
+ *
+ * $Id$
+ *
+ */
+//=============================================================================
+
+#include "tao/PortableServer/ServantRetentionStrategyNonRetain.h"
+#include "tao/PortableServer/Non_Servant_Upcall.h"
+#include "tao/PortableServer/Servant_Upcall.h"
+#include "tao/PortableServer/POA_Current_Impl.h"
+#include "tao/PortableServer/Root_POA.h"
+#include "tao/PortableServer/Servant_Base.h"
+#include "tao/debug.h"
+
+ACE_RCSID (PortableServer,
+ Servant_Retention_Strategy,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ ServantRetentionStrategyNonRetain::ServantRetentionStrategyNonRetain (void) :
+ poa_ (0)
+ {
+ }
+
+ void
+ ServantRetentionStrategyNonRetain::strategy_init (
+ TAO_Root_POA *poa
+ ACE_ENV_ARG_DECL_NOT_USED)
+ {
+ poa_ = poa;
+ }
+
+ void
+ ServantRetentionStrategyNonRetain::strategy_cleanup (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ {
+ poa_ = 0;
+ }
+
+ void
+ ServantRetentionStrategyNonRetain::deactivate_object (
+ const PortableServer::ObjectId &/*id*/
+ ACE_ENV_ARG_DECL)
+ {
+ // When using Non_Retain we don't have an active object map and we just
+ // can't deactivate any object
+ ACE_THROW (PortableServer::POA::WrongPolicy ());
+ }
+
+ PortableServer::Servant
+ ServantRetentionStrategyNonRetain::find_servant (
+ const PortableServer::ObjectId &/*system_id*/
+ ACE_ENV_ARG_DECL)
+ {
+ ACE_THROW_RETURN (PortableServer::POA::WrongPolicy (),
+ 0);
+ }
+
+ PortableServer::ObjectId *
+ ServantRetentionStrategyNonRetain::system_id_to_object_id (
+ const PortableServer::ObjectId &system_id
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongAdapter,
+ PortableServer::POA::WrongPolicy))
+ {
+ // The system id is the id (and no conversion/transformation is
+ // needed).
+ PortableServer::ObjectId *id = 0;
+ ACE_NEW_THROW_EX (id,
+ PortableServer::ObjectId (system_id),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (0);
+
+ return id;
+ }
+
+ PortableServer::Servant
+ ServantRetentionStrategyNonRetain::user_id_to_servant (
+ const PortableServer::ObjectId &/*id*/
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ObjectNotActive,
+ PortableServer::POA::WrongPolicy))
+ {
+ ACE_THROW_RETURN (PortableServer::POA::WrongPolicy (),
+ 0);
+ }
+
+ CORBA::Object_ptr
+ ServantRetentionStrategyNonRetain::id_to_reference (
+ const PortableServer::ObjectId &/*id*/,
+ bool /*indirect*/
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ObjectNotActive,
+ PortableServer::POA::WrongPolicy))
+ {
+ ACE_THROW_RETURN (PortableServer::POA::WrongPolicy (),
+ CORBA::Object::_nil ());
+ }
+
+ TAO_SERVANT_LOCATION
+ ServantRetentionStrategyNonRetain::servant_present (
+ const PortableServer::ObjectId &/*system_id*/,
+ PortableServer::Servant &/*servant*/
+ ACE_ENV_ARG_DECL_NOT_USED)
+ {
+ return TAO_SERVANT_NOT_FOUND;
+ }
+
+ PortableServer::Servant
+ ServantRetentionStrategyNonRetain::find_servant (
+ const PortableServer::ObjectId &system_id,
+ TAO::Portable_Server::Servant_Upcall &servant_upcall,
+ TAO::Portable_Server::POA_Current_Impl &poa_current_impl
+ ACE_ENV_ARG_DECL_NOT_USED)
+ {
+ // We have the NON_RETAIN policy, user id is the system id.
+
+ // Smartly copy all the data; <poa_current_impl.object_id_> does
+ // not own the data.
+ poa_current_impl.replace_object_id (system_id);
+
+ servant_upcall.user_id (&system_id);
+
+ return 0;
+ }
+
+ int
+ ServantRetentionStrategyNonRetain::find_servant_priority (
+ const PortableServer::ObjectId &/*system_id*/,
+ CORBA::Short &/*priority*/
+ ACE_ENV_ARG_DECL)
+ {
+ return -1;
+ }
+
+ int
+ ServantRetentionStrategyNonRetain::is_servant_in_map (
+ PortableServer::Servant /*servant*/,
+ int &/*wait_occurred_restart_call*/)
+ {
+ return 0;
+ }
+
+ CORBA::ULong
+ ServantRetentionStrategyNonRetain::waiting_servant_deactivation (void) const
+ {
+ return 0;
+ }
+
+ void
+ ServantRetentionStrategyNonRetain::deactivate_all_objects (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongPolicy))
+ {
+ }
+
+ PortableServer::ObjectId *
+ ServantRetentionStrategyNonRetain::servant_to_user_id (
+ PortableServer::Servant /*servant*/
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ServantNotActive,
+ PortableServer::POA::WrongPolicy))
+ {
+ ACE_THROW_RETURN (PortableServer::POA::WrongPolicy (),
+ 0);
+ }
+
+ CORBA::Object_ptr
+ ServantRetentionStrategyNonRetain::servant_to_reference (
+ PortableServer::Servant /*servant*/
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ServantNotActive,
+ PortableServer::POA::WrongPolicy))
+ {
+ ACE_THROW_RETURN (PortableServer::POA::WrongPolicy (),
+ CORBA::Object::_nil ());
+ }
+
+ PortableServer::ObjectId *
+ ServantRetentionStrategyNonRetain::activate_object (
+ PortableServer::Servant /*servant*/,
+ CORBA::Short /*priority*/,
+ int &/*wait_occurred_restart_call*/
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ServantAlreadyActive,
+ PortableServer::POA::WrongPolicy))
+ {
+ ACE_THROW_RETURN (PortableServer::POA::WrongPolicy (),
+ 0);
+ }
+
+#if !defined (CORBA_E_MICRO)
+ void
+ ServantRetentionStrategyNonRetain::activate_object_with_id (
+ const PortableServer::ObjectId &/*id*/,
+ PortableServer::Servant /*servant*/,
+ CORBA::Short /*priority*/,
+ int &/*wait_occurred_restart_call*/
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ServantAlreadyActive,
+ PortableServer::POA::ObjectAlreadyActive,
+ PortableServer::POA::WrongPolicy))
+ {
+ ACE_THROW (PortableServer::POA::WrongPolicy ());
+ }
+#endif
+
+ CORBA::Object_ptr
+ ServantRetentionStrategyNonRetain::create_reference (
+ const char *intf,
+ CORBA::Short priority
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongPolicy))
+ {
+ // This operation creates an object reference that encapsulates a
+ // POA-generated Object Id value and the specified interface
+ // repository id. This operation does not cause an activation to
+ // take place. The resulting reference may be passed to clients, so
+ // that subsequent requests on those references will cause the
+ // appropriate servant manager to be invoked, if one is
+ // available. The generated Object Id value may be obtained by
+ // invoking POA::reference_to_id with the created reference.
+
+ PortableServer::ObjectId_var system_id;
+ PortableServer::ObjectId user_id;
+
+ // Otherwise, it is the NON_RETAIN policy. Therefore, any ol'
+ // object id will do (even an empty one).
+ PortableServer::ObjectId *sys_id = 0;
+ ACE_NEW_THROW_EX (sys_id,
+ PortableServer::ObjectId,
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (CORBA::Object::_nil ());
+
+ system_id = sys_id;
+
+ // User id is the same as system id.
+ user_id = system_id.in ();
+
+ // Remember params for potentially invoking <key_to_object> later.
+ this->poa_->key_to_object_params_.set (system_id,
+ intf,
+ 0,
+ 1,
+ priority,
+ true);
+
+ return this->poa_->invoke_key_to_object_helper_i (intf,
+ user_id
+ ACE_ENV_ARG_PARAMETER);
+ }
+
+ CORBA::Object_ptr
+ ServantRetentionStrategyNonRetain::create_reference_with_id (
+ const PortableServer::ObjectId &oid,
+ const char *intf,
+ CORBA::Short priority
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ // This operation creates an object reference that encapsulates the
+ // specified Object Id and interface repository Id values. This
+ // operation does not cause an activation to take place. The
+ // resulting reference may be passed to clients, so that subsequent
+ // requests on those references will cause the object to be
+ // activated if necessary, or the default servant used, depending on
+ // the applicable policies.
+
+ PortableServer::Servant servant = 0;
+ PortableServer::ObjectId_var system_id;
+
+ // Otherwise, it is the NON_RETAIN policy. Therefore, user id
+ // is the same as system id.
+ PortableServer::ObjectId *sys_id;
+ ACE_NEW_THROW_EX (sys_id,
+ PortableServer::ObjectId (oid),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (CORBA::Object::_nil ());
+
+ system_id = sys_id;
+
+ // Remember params for potentially invoking <key_to_object> later.
+ this->poa_->key_to_object_params_.set (system_id,
+ intf,
+ servant,
+ 1,
+ priority,
+ true);
+
+ return this->poa_->invoke_key_to_object_helper_i (intf,
+ oid
+ ACE_ENV_ARG_PARAMETER);
+ }
+
+ int
+ ServantRetentionStrategyNonRetain::rebind_using_user_id_and_system_id (
+ PortableServer::Servant /*servant*/,
+ const PortableServer::ObjectId &/*user_id*/,
+ const PortableServer::ObjectId &/*system_id*/,
+ TAO::Portable_Server::Servant_Upcall &/*servant_upcall*/)
+ {
+ return -1;
+ }
+
+ CORBA::Boolean
+ ServantRetentionStrategyNonRetain::servant_has_remaining_activations (
+ PortableServer::Servant /*servant*/)
+ {
+ return false;
+ }
+
+ int
+ ServantRetentionStrategyNonRetain::unbind_using_user_id (
+ const PortableServer::ObjectId &/*user_id*/)
+ {
+ return 0;
+ }
+
+ ::PortableServer::ServantRetentionPolicyValue
+ ServantRetentionStrategyNonRetain::type() const
+ {
+ return ::PortableServer::NON_RETAIN;
+ }
+
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/ServantRetentionStrategyNonRetain.h b/TAO/tao/PortableServer/ServantRetentionStrategyNonRetain.h
new file mode 100644
index 00000000000..1b26e36fe54
--- /dev/null
+++ b/TAO/tao/PortableServer/ServantRetentionStrategyNonRetain.h
@@ -0,0 +1,173 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file ServantRetentionStrategyNonRetain.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_SERVANT_RETENTION_STRATEGY_NON_RETAIN_H
+#define TAO_SERVANT_RETENTION_STRATEGY_NON_RETAIN_H
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/ServantRetentionStrategy.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/Servant_Location.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Root_POA;
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ class ServantRetentionStrategyNonRetain
+ : public ServantRetentionStrategy
+ {
+ public:
+ ServantRetentionStrategyNonRetain (void);
+
+ virtual void strategy_init (TAO_Root_POA *poa ACE_ENV_ARG_DECL);
+
+ virtual void strategy_cleanup(ACE_ENV_SINGLE_ARG_DECL);
+
+ CORBA::ULong waiting_servant_deactivation (void) const;
+
+ virtual
+ PortableServer::ObjectId *
+ activate_object (PortableServer::Servant servant,
+ CORBA::Short priority,
+ int &wait_occurred_restart_call
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ServantAlreadyActive,
+ PortableServer::POA::WrongPolicy));
+
+#if !defined (CORBA_E_MICRO)
+ virtual
+ void
+ activate_object_with_id (const PortableServer::ObjectId &id,
+ PortableServer::Servant servant,
+ CORBA::Short priority,
+ int &wait_occurred_restart_call
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ServantAlreadyActive,
+ PortableServer::POA::ObjectAlreadyActive,
+ PortableServer::POA::WrongPolicy));
+#endif
+
+ virtual void deactivate_object (const PortableServer::ObjectId &id
+ ACE_ENV_ARG_DECL);
+
+ virtual PortableServer::Servant find_servant (
+ const PortableServer::ObjectId &system_id
+ ACE_ENV_ARG_DECL);
+
+ virtual int is_servant_in_map (PortableServer::Servant servant,
+ int &wait_occurred_restart_call);
+
+ virtual PortableServer::ObjectId *system_id_to_object_id (
+ const PortableServer::ObjectId &system_id
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongAdapter,
+ PortableServer::POA::WrongPolicy));
+
+ virtual
+ PortableServer::Servant
+ user_id_to_servant (const PortableServer::ObjectId &id
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ObjectNotActive,
+ PortableServer::POA::WrongPolicy));
+
+ CORBA::Object_ptr
+ id_to_reference (const PortableServer::ObjectId &id,
+ bool indirect
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ObjectNotActive,
+ PortableServer::POA::WrongPolicy));
+
+ virtual TAO_SERVANT_LOCATION servant_present (
+ const PortableServer::ObjectId &system_id,
+ PortableServer::Servant &servant
+ ACE_ENV_ARG_DECL);
+
+ virtual PortableServer::Servant find_servant (
+ const PortableServer::ObjectId &system_id,
+ TAO::Portable_Server::Servant_Upcall &servant_upcall,
+ TAO::Portable_Server::POA_Current_Impl &poa_current_impl
+ ACE_ENV_ARG_DECL);
+
+ virtual int find_servant_priority (
+ const PortableServer::ObjectId &system_id,
+ CORBA::Short &priority
+ ACE_ENV_ARG_DECL);
+
+ virtual void deactivate_all_objects (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongPolicy));
+
+ virtual PortableServer::ObjectId *servant_to_user_id (
+ PortableServer::Servant servant
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ServantNotActive,
+ PortableServer::POA::WrongPolicy));
+
+ virtual CORBA::Object_ptr servant_to_reference (
+ PortableServer::Servant servant
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ServantNotActive,
+ PortableServer::POA::WrongPolicy));
+
+ virtual CORBA::Object_ptr create_reference (
+ const char *intf,
+ CORBA::Short priority
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongPolicy));
+
+ virtual CORBA::Object_ptr create_reference_with_id (
+ const PortableServer::ObjectId &oid,
+ const char *intf,
+ CORBA::Short priority
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual int rebind_using_user_id_and_system_id (
+ PortableServer::Servant servant,
+ const PortableServer::ObjectId &user_id,
+ const PortableServer::ObjectId &system_id,
+ TAO::Portable_Server::Servant_Upcall &servant_upcall);
+
+ virtual CORBA::Boolean servant_has_remaining_activations (
+ PortableServer::Servant servant);
+
+ virtual int unbind_using_user_id (
+ const PortableServer::ObjectId &user_id);
+
+ virtual ::PortableServer::ServantRetentionPolicyValue type() const;
+
+ protected:
+ TAO_Root_POA *poa_;
+ };
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_SERVANT_RETENTION_STRATEGY_NON_RETAIN_H */
diff --git a/TAO/tao/PortableServer/ServantRetentionStrategyNonRetainFactoryImpl.cpp b/TAO/tao/PortableServer/ServantRetentionStrategyNonRetainFactoryImpl.cpp
new file mode 100644
index 00000000000..bc3a3510554
--- /dev/null
+++ b/TAO/tao/PortableServer/ServantRetentionStrategyNonRetainFactoryImpl.cpp
@@ -0,0 +1,72 @@
+// $Id$
+
+#include "tao/PortableServer/ServantRetentionStrategyNonRetainFactoryImpl.h"
+#include "tao/PortableServer/ServantRetentionStrategy.h"
+#include "tao/PortableServer/ServantRetentionStrategyNonRetain.h"
+#include "ace/Dynamic_Service.h"
+#include "ace/Log_Msg.h"
+
+ACE_RCSID (PortableServer,
+ ServantRetentionStrategyNonRetainFactoryImpl,
+ "$Id$")
+
+#if (TAO_HAS_MINIMUM_POA == 0)
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ ServantRetentionStrategy*
+ ServantRetentionStrategyNonRetainFactoryImpl::create (
+ ::PortableServer::ServantRetentionPolicyValue value)
+ {
+ ServantRetentionStrategy* strategy = 0;
+
+ switch (value)
+ {
+ case ::PortableServer::NON_RETAIN :
+ {
+ ACE_NEW_RETURN (strategy, ServantRetentionStrategyNonRetain, 0);
+ break;
+ }
+ case ::PortableServer::RETAIN :
+ {
+ ACE_ERROR ((LM_ERROR, "Incorrect type in ServantRetentionStrategyNonRetainFactoryImpl"));
+ break;
+ }
+ }
+
+ return strategy;
+ }
+
+ void
+ ServantRetentionStrategyNonRetainFactoryImpl::destroy (
+ ServantRetentionStrategy *strategy
+ ACE_ENV_ARG_DECL)
+ {
+ strategy->strategy_cleanup (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ delete strategy;
+ }
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DEFINE (
+ ServantRetentionStrategyNonRetainFactoryImpl,
+ ACE_TEXT ("ServantRetentionStrategyNonRetainFactory"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (ServantRetentionStrategyNonRetainFactoryImpl),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0)
+
+ACE_FACTORY_NAMESPACE_DEFINE (
+ ACE_Local_Service,
+ ServantRetentionStrategyNonRetainFactoryImpl,
+ TAO::Portable_Server::ServantRetentionStrategyNonRetainFactoryImpl)
+
+#endif /* TAO_HAS_MINIMUM_POA == 0 */
diff --git a/TAO/tao/PortableServer/ServantRetentionStrategyNonRetainFactoryImpl.h b/TAO/tao/PortableServer/ServantRetentionStrategyNonRetainFactoryImpl.h
new file mode 100644
index 00000000000..688e49cbeec
--- /dev/null
+++ b/TAO/tao/PortableServer/ServantRetentionStrategyNonRetainFactoryImpl.h
@@ -0,0 +1,57 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file ServantRetentionStrategyNonRetainFactoryImpl.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_PORTABLESERVER_SERVANTRETENTIONSTRATEGYNONRETAIN_FACTORYIMPL_H
+#define TAO_PORTABLESERVER_SERVANTRETENTIONSTRATEGYNONRETAIN_FACTORYIMPL_H
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/Service_Config.h"
+#include "tao/PortableServer/ServantRetentionStrategyFactory.h"
+
+#if (TAO_HAS_MINIMUM_POA == 0)
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ class TAO_PortableServer_Export ServantRetentionStrategyNonRetainFactoryImpl
+ : public ServantRetentionStrategyFactory
+ {
+ public:
+ /// Create a new servant retention strategy
+ virtual ServantRetentionStrategy* create (
+ ::PortableServer::ServantRetentionPolicyValue value);
+
+ virtual void destroy (
+ ServantRetentionStrategy *strategy
+ ACE_ENV_ARG_DECL);
+ };
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE_EXPORT (TAO_PortableServer, ServantRetentionStrategyNonRetainFactoryImpl)
+ACE_FACTORY_DECLARE (TAO_PortableServer, ServantRetentionStrategyNonRetainFactoryImpl)
+
+#endif /* TAO_HAS_MINIMUM_POA == 0 */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_PORTABLESERVER_SERVANTRETENTIONSTRATEGYNONRETAIN_FACTORYIMPL_H*/
diff --git a/TAO/tao/PortableServer/ServantRetentionStrategyRetain.cpp b/TAO/tao/PortableServer/ServantRetentionStrategyRetain.cpp
new file mode 100644
index 00000000000..3543a783c74
--- /dev/null
+++ b/TAO/tao/PortableServer/ServantRetentionStrategyRetain.cpp
@@ -0,0 +1,1096 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file ServantRetentionStrategyRetain.cpp
+ *
+ * $Id$
+ *
+ */
+//=============================================================================
+
+#include "tao/ORB_Core.h"
+#include "tao/debug.h"
+#include "tao/PortableServer/ServantRetentionStrategyRetain.h"
+#include "tao/PortableServer/Non_Servant_Upcall.h"
+#include "tao/PortableServer/Servant_Upcall.h"
+#include "tao/PortableServer/POA_Current_Impl.h"
+#include "tao/PortableServer/Root_POA.h"
+#include "tao/PortableServer/Active_Object_Map.h"
+#include "tao/PortableServer/Active_Object_Map_Entry.h"
+#include "ace/Auto_Ptr.h"
+
+ACE_RCSID (PortableServer,
+ Servant_Retention_Strategy,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ ServantRetentionStrategyRetain::ServantRetentionStrategyRetain (void) :
+ ServantRetentionStrategyNonRetain (),
+ active_object_map_ (0),
+ waiting_servant_deactivation_ (0)
+ {
+ }
+
+ void
+ ServantRetentionStrategyRetain::strategy_init (
+ TAO_Root_POA *poa
+ ACE_ENV_ARG_DECL)
+ {
+ poa_ = poa;
+
+ // Create the active object map to be used
+ TAO_Active_Object_Map *active_object_map = 0;
+ ACE_NEW_THROW_EX (active_object_map,
+ TAO_Active_Object_Map (!poa->system_id (),
+ !poa->allow_multiple_activations (),
+ poa->is_persistent (),
+ poa->orb_core().server_factory ()->active_object_map_creation_parameters ()
+ ACE_ENV_ARG_PARAMETER), CORBA::NO_MEMORY ());
+ ACE_CHECK;
+
+ // Give ownership of the new map to the auto pointer. Note, that it
+ // is important for the auto pointer to take ownership before
+ // checking for exception since we may need to delete the new map.
+ auto_ptr<TAO_Active_Object_Map> new_active_object_map (active_object_map);
+
+ // Check for exception in construction of the active object map.
+ ACE_CHECK;
+
+ // Finally everything is fine. Make sure to take ownership away
+ // from the auto pointer.
+ this->active_object_map_ = new_active_object_map.release ();
+ }
+
+ void
+ ServantRetentionStrategyRetain::strategy_cleanup(
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ {
+ // Delete the active object map.
+ delete this->active_object_map_;
+ active_object_map_ = 0;
+ }
+
+ void
+ ServantRetentionStrategyRetain::deactivate_object (
+ const PortableServer::ObjectId &id
+ ACE_ENV_ARG_DECL)
+ {
+
+ TAO_Active_Object_Map_Entry *active_object_map_entry = 0;
+ int result = this->active_object_map_->
+ find_entry_using_user_id (id,
+ active_object_map_entry);
+
+ // If there is no active object associated with the specified Object
+ // Id, the operation raises an ObjectNotActive exception.
+ if (result != 0)
+ {
+ ACE_THROW (PortableServer::POA::ObjectNotActive ());
+ }
+
+ this->deactivate_map_entry (active_object_map_entry
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ void
+ ServantRetentionStrategyRetain::deactivate_map_entry (
+ TAO_Active_Object_Map_Entry *active_object_map_entry
+ ACE_ENV_ARG_DECL)
+ {
+ // Decrement the reference count.
+ CORBA::UShort new_count = --active_object_map_entry->reference_count_;
+
+ // Inform the custom servant dispatching (CSD) strategy that the
+ // servant is deactivated. This would be called just once when the
+ // servant is deactivated the first time.
+ if (active_object_map_entry->deactivated_ == 0)
+ {
+ this->poa_->servant_deactivated_hook (
+ active_object_map_entry->servant_,
+ active_object_map_entry->user_id_
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ if (new_count == 0)
+ {
+ this->poa_->cleanup_servant (active_object_map_entry->servant_,
+ active_object_map_entry->user_id_
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else
+ {
+ // It should be noted that there may be a period of time between
+ // an object's deactivation and the etherealization (during
+ // which outstanding requests are being processed) in which
+ // arriving requests on that object should not be passed to its
+ // servant. During this period, requests targeted for such an
+ // object act as if the POA were in holding state until
+ // etherealize completes. If etherealize is called as a
+ // consequence of a deactivate call with a etherealize_objects
+ // parameter of TRUE, incoming requests are rejected.
+
+ // Else mark entry as closed...
+ active_object_map_entry->deactivated_ = 1;
+ }
+ }
+
+ int
+ ServantRetentionStrategyRetain::unbind_using_user_id (
+ const PortableServer::ObjectId &user_id)
+ {
+ return this->active_object_map_->
+ unbind_using_user_id (user_id);
+ }
+
+ PortableServer::Servant
+ ServantRetentionStrategyRetain::find_servant (
+ const PortableServer::ObjectId &system_id
+ ACE_ENV_ARG_DECL)
+ {
+ // Find user id from system id.
+ PortableServer::ObjectId_var user_id;
+ if (active_object_map_->
+ find_user_id_using_system_id (system_id,
+ user_id.out()) != 0)
+ {
+ ACE_THROW_RETURN (CORBA::OBJ_ADAPTER (),
+ 0);
+ }
+
+ // This operation returns the active servant associated with the
+ // specified system Object Id value. If the Object Id value is
+ // not active in the POA, an ObjectNotActive exception is
+ // raised.
+ TAO_Active_Object_Map_Entry *entry = 0;
+ PortableServer::Servant servant = 0;
+
+ int result =
+ active_object_map_->
+ find_servant_using_system_id_and_user_id (system_id,
+ user_id.in(),
+ servant,
+ entry);
+
+ if (result == -1)
+ {
+ ACE_THROW_RETURN (PortableServer::POA::ObjectNotActive (),
+ 0);
+ }
+
+ return servant;
+ }
+
+ PortableServer::ObjectId *
+ ServantRetentionStrategyRetain::system_id_to_object_id (
+ const PortableServer::ObjectId &system_id
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongAdapter,
+ PortableServer::POA::WrongPolicy))
+ {
+ // The object denoted by the reference does not have to be
+ // active for this operation to succeed.
+ PortableServer::ObjectId_var user_id;
+ if (this->active_object_map_->
+ find_user_id_using_system_id (system_id,
+ user_id.out ()) != 0)
+ {
+ ACE_THROW_RETURN (CORBA::OBJ_ADAPTER (),
+ 0);
+ }
+
+ return user_id._retn ();
+ }
+
+ PortableServer::Servant
+ ServantRetentionStrategyRetain::user_id_to_servant (
+ const PortableServer::ObjectId &id
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ObjectNotActive,
+ PortableServer::POA::WrongPolicy))
+ {
+ // If the POA has the RETAIN policy and the specified ObjectId is in
+ // the Active Object Map, this operation returns the servant
+ // associated with that object in the Active Object Map.
+ PortableServer::Servant servant = 0;
+
+ int result =
+ this->active_object_map_->find_servant_using_user_id (id,
+ servant);
+
+ if (result == -1)
+ {
+ ACE_THROW_RETURN (PortableServer::POA::ObjectNotActive (),
+ 0);
+ }
+
+ return servant;
+ }
+
+ CORBA::Object_ptr
+ ServantRetentionStrategyRetain::id_to_reference (
+ const PortableServer::ObjectId &id,
+ bool indirect
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ObjectNotActive,
+ PortableServer::POA::WrongPolicy))
+ {
+ // If an object with the specified Object Id value is currently
+ // active, a reference encapsulating the information used to
+ // activate the object is returned.
+ PortableServer::ObjectId_var system_id;
+ PortableServer::Servant servant;
+ CORBA::Short priority;
+
+ if (this->active_object_map_->
+ find_servant_and_system_id_using_user_id (id,
+ servant,
+ system_id.out (),
+ priority) == 0)
+ {
+ // Remember params for potentially invoking <key_to_object> later.
+ this->poa_->key_to_object_params_.set (system_id,
+ servant->_interface_repository_id (),
+ servant,
+ 1,
+ priority,
+ indirect);
+
+ return this->poa_->invoke_key_to_object_helper_i (servant->_interface_repository_id (),
+ id
+ ACE_ENV_ARG_PARAMETER);
+ }
+ else
+ {
+ // If the Object Id value is not active in the POA, an
+ // ObjectNotActive exception is raised.
+ ACE_THROW_RETURN (PortableServer::POA::ObjectNotActive (),
+ CORBA::Object::_nil ());
+ }
+ }
+
+ TAO_SERVANT_LOCATION
+ ServantRetentionStrategyRetain::servant_present (
+ const PortableServer::ObjectId &system_id,
+ PortableServer::Servant &servant
+ ACE_ENV_ARG_DECL)
+ {
+ // Find user id from system id.
+ PortableServer::ObjectId_var user_id;
+ if (this->active_object_map_->
+ find_user_id_using_system_id (system_id,
+ user_id.out()) != 0)
+ {
+ ACE_THROW_RETURN (CORBA::OBJ_ADAPTER (),
+ TAO_SERVANT_NOT_FOUND);
+ }
+
+ TAO_Active_Object_Map_Entry *entry = 0;
+ int result = this->active_object_map_->
+ find_servant_using_system_id_and_user_id (system_id,
+ user_id.in(),
+ servant,
+ entry);
+ if (result == 0)
+ {
+ // Success
+ return TAO_SERVANT_FOUND;
+ }
+ else
+ {
+ return TAO_SERVANT_NOT_FOUND;
+ }
+ }
+
+ PortableServer::Servant
+ ServantRetentionStrategyRetain::find_servant (
+ const PortableServer::ObjectId &system_id,
+ TAO::Portable_Server::Servant_Upcall &servant_upcall,
+ TAO::Portable_Server::POA_Current_Impl &poa_current_impl
+ ACE_ENV_ARG_DECL)
+ {
+ PortableServer::ObjectId user_id;
+ // If we have the RETAIN policy, convert/transform from system id to
+ // user id.
+ if (this->active_object_map_->
+ find_user_id_using_system_id (system_id,
+ user_id) != 0)
+ {
+ ACE_THROW_RETURN (CORBA::OBJ_ADAPTER (),
+ 0);
+ }
+
+ poa_current_impl.object_id(user_id);
+ servant_upcall.user_id (&poa_current_impl.object_id());
+
+ // If the POA has the RETAIN policy, the POA looks in the Active
+ // Object Map to find if there is a servant associated with the
+ // Object Id value from the request. If such a servant exists, the
+ // POA invokes the appropriate method on the servant.
+ PortableServer::Servant servant = 0;
+ TAO_Active_Object_Map_Entry *active_object_map_entry = 0;
+ int result = this->active_object_map_->
+ find_servant_using_system_id_and_user_id (system_id,
+ user_id,
+ servant,
+ active_object_map_entry);
+
+
+ if (result == 0)
+ {
+ servant_upcall.active_object_map_entry (active_object_map_entry);
+
+ // Increment the reference count.
+ servant_upcall.increment_servant_refcount ();
+ }
+
+ return servant;
+ }
+
+ int
+ ServantRetentionStrategyRetain::find_servant_priority (
+ const PortableServer::ObjectId &system_id,
+ CORBA::Short &priority
+ ACE_ENV_ARG_DECL)
+ {
+ PortableServer::ObjectId user_id;
+ // If we have the RETAIN policy, convert/transform from system id to
+ // user id.
+ if (this->active_object_map_->
+ find_user_id_using_system_id (system_id,
+ user_id) != 0)
+ {
+ ACE_THROW_RETURN (CORBA::OBJ_ADAPTER (),
+ -1);
+ }
+
+ // If the POA has the RETAIN policy, the POA looks in the Active
+ // Object Map to find if there is a servant associated with the
+ // Object Id value from the request. If such a servant exists, the
+ // POA invokes the appropriate method on the servant.
+ PortableServer::Servant servant = 0;
+ TAO_Active_Object_Map_Entry *active_object_map_entry = 0;
+ int result = this->active_object_map_->
+ find_servant_using_system_id_and_user_id (system_id,
+ user_id,
+ servant,
+ active_object_map_entry);
+
+ if (result == 0)
+ {
+ priority = active_object_map_entry->priority_;
+ return 0;
+ }
+
+ return -1;
+ }
+
+ int
+ ServantRetentionStrategyRetain::is_servant_in_map (
+ PortableServer::Servant servant,
+ int &wait_occurred_restart_call)
+ {
+ int deactivated = 0;
+ int servant_in_map =
+ this->active_object_map_->is_servant_in_map (servant,
+ deactivated);
+
+ if (!servant_in_map)
+ {
+ return 0;
+ }
+ else
+ {
+ if (deactivated)
+ {
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("(%t) TAO_Root_POA::is_servant_in_map: waiting for servant to deactivate\n")));
+
+ // We are going to wait on this condition variable; the POA
+ // state may change by the time we get the lock again.
+ // Therefore, indicate to the caller that all conditions
+ // need to be checked again.
+ wait_occurred_restart_call = 1;
+
+ ++this->waiting_servant_deactivation_;
+
+ if (this->poa_->object_adapter ().enable_locking ())
+ this->poa_->servant_deactivation_condition ().wait ();
+
+ --this->waiting_servant_deactivation_;
+
+ return 0;
+ }
+ else
+ {
+ return 1;
+ }
+ }
+ }
+
+ int
+ ServantRetentionStrategyRetain::is_user_id_in_map (
+ const PortableServer::ObjectId &id,
+ CORBA::Short priority,
+ int &priorities_match,
+ int &wait_occurred_restart_call)
+ {
+ int deactivated = 0;
+ int user_id_in_map =
+ this->active_object_map_->is_user_id_in_map (id,
+ priority,
+ priorities_match,
+ deactivated);
+
+ if (!user_id_in_map)
+ {
+ return 0;
+ }
+ else
+ {
+ if (deactivated)
+ {
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("(%t) TAO_Root_POA::is_user_id_in_map: waiting for servant to deactivate\n")));
+
+ // We are going to wait on this condition variable; the POA
+ // state may change by the time we get the lock again.
+ // Therefore, indicate to the caller that all conditions
+ // need to be checked again.
+ wait_occurred_restart_call = 1;
+
+ ++this->waiting_servant_deactivation_;
+
+ if (this->poa_->object_adapter ().enable_locking ())
+ this->poa_->servant_deactivation_condition ().wait ();
+
+ --this->waiting_servant_deactivation_;
+
+ return 0;
+ }
+ else
+ {
+ return 1;
+ }
+ }
+ }
+
+ CORBA::ULong
+ ServantRetentionStrategyRetain::waiting_servant_deactivation (void) const
+ {
+ return waiting_servant_deactivation_;
+ }
+
+ void
+ ServantRetentionStrategyRetain::deactivate_all_objects (
+ ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongPolicy))
+ {
+ // If the etherealize_objects parameter is TRUE, the POA has the
+ // RETAIN policy, and a servant manager is registered with the POA,
+ // the etherealize operation on the servant manager will be called
+ // for each active object in the Active Object Map. The apparent
+ // destruction of the POA occurs before any calls to etherealize are
+ // made. Thus, for example, an etherealize method that attempts to
+ // invoke operations on the POA will receive the OBJECT_NOT_EXIST
+ // exception.
+
+ // We must copy the map entries into a separate place since we
+ // cannot remove entries while iterating through the map.
+ ACE_Array_Base<TAO_Active_Object_Map_Entry *> map_entries
+ (this->active_object_map_->current_size ());
+
+ size_t counter = 0;
+ TAO_Active_Object_Map::user_id_map::iterator end
+ = this->active_object_map_->user_id_map_->end ();
+
+ for (TAO_Active_Object_Map::user_id_map::iterator iter
+ = this->active_object_map_->user_id_map_->begin ();
+ iter != end;
+ ++iter)
+ {
+ TAO_Active_Object_Map::user_id_map::value_type map_pair = *iter;
+ TAO_Active_Object_Map_Entry *active_object_map_entry = map_pair.second ();
+
+ if (!active_object_map_entry->deactivated_)
+ {
+ map_entries[counter] = active_object_map_entry;
+ ++counter;
+ }
+ }
+
+ for (size_t i = 0;
+ i < counter;
+ ++i)
+ {
+ this->deactivate_map_entry (map_entries[i]
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ }
+
+ PortableServer::ObjectId *
+ ServantRetentionStrategyRetain::servant_to_user_id (
+ PortableServer::Servant servant
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ServantNotActive,
+ PortableServer::POA::WrongPolicy))
+ {
+ // This operation requires the RETAIN and either the UNIQUE_ID or
+ // IMPLICIT_ACTIVATION policies; if not present, the WrongPolicy
+ // exception is raised.
+ if (!((!this->poa_->allow_multiple_activations ()
+ || this->poa_->allow_implicit_activation ())))
+ {
+ ACE_THROW_RETURN (PortableServer::POA::WrongPolicy (),
+ 0);
+ }
+
+ /**
+ * If the POA has both the RETAIN and the UNIQUE_ID policy and the
+ * specified servant is active, the Object Id associated with that
+ * servant is returned.
+ *
+ * If the POA has both the RETAIN and the IMPLICIT_ACTIVATION policy and
+ * either the POA has the MULTIPLE_ID policy or the specified servant is
+ * not active, the servant is activated using a POA-generated Object Id
+ * and the Interface Id associated with the servant, and that Object Id
+ * is returned.
+ *
+ */
+
+ // If the POA has the UNIQUE_ID policy and the specified servant is
+ // active, the Object Id associated with that servant is returned.
+ PortableServer::ObjectId_var user_id;
+ if (!this->poa_->allow_multiple_activations () &&
+ this->active_object_map_->
+ find_user_id_using_servant (servant,
+ user_id.out ()) != -1)
+ {
+ return user_id._retn ();
+ }
+
+ // If the POA has the IMPLICIT_ACTIVATION policy and either the POA
+ // has the MULTIPLE_ID policy or the specified servant is not
+ // active, the servant is activated using a POA-generated Object Id
+ // and the Interface Id associated with the servant, and that Object
+ // Id is returned.
+ if (this->poa_->allow_implicit_activation ())
+ {
+ // If we reach here, then we either have the MULTIPLE_ID policy
+ // or we have the UNIQUE_ID policy and we are not in the active
+ // object map.
+ PortableServer::ObjectId_var user_id;
+ if (this->active_object_map_->
+ bind_using_system_id_returning_user_id (servant,
+ this->poa_->server_priority (),
+ user_id.out ()) != 0)
+ {
+ ACE_THROW_RETURN (CORBA::OBJ_ADAPTER (),
+ 0);
+ }
+
+ //
+ // Everything is finally ok
+ //
+
+ // Inform the custom servant dispatching (CSD) strategy that the
+ // sevant is activated.
+ this->poa_->servant_activated_hook (servant,
+ user_id.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ // ATTENTION: Trick locking here, see class header for details
+ Non_Servant_Upcall non_servant_upcall (*this->poa_);
+ ACE_UNUSED_ARG (non_servant_upcall);
+
+ // If this operation causes the object to be activated, _add_ref
+ // is invoked at least once on the Servant argument before
+ // returning. Otherwise, the POA does not increment or decrement
+ // the reference count of the Servant passed to this function.
+ servant->_add_ref (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ return user_id._retn ();
+ }
+
+ /*
+ * Otherwise, the ServantNotActive exception is raised.
+ */
+ ACE_THROW_RETURN (PortableServer::POA::ServantNotActive (),
+ 0);
+ }
+
+ PortableServer::ObjectId *
+ ServantRetentionStrategyRetain::servant_to_system_id_i (
+ PortableServer::Servant servant,
+ CORBA::Short &priority
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ServantNotActive,
+ PortableServer::POA::WrongPolicy))
+ {
+ // This operation requires the RETAIN and either the UNIQUE_ID or
+ // IMPLICIT_ACTIVATION policies; if not present, the WrongPolicy
+ // exception is raised.
+ if (!((!this->poa_->allow_multiple_activations ()
+ || this->poa_->allow_implicit_activation ())))
+ {
+ ACE_THROW_RETURN (PortableServer::POA::WrongPolicy (),
+ 0);
+ }
+
+ // This operation has three possible behaviors.
+
+ // If the POA has the UNIQUE_ID policy and the specified servant is
+ // active, the Object Id associated with that servant is returned.
+ PortableServer::ObjectId_var system_id;
+ if (!this->poa_->allow_multiple_activations () &&
+ this->active_object_map_->
+ find_system_id_using_servant (servant,
+ system_id.out (),
+ priority) != -1)
+ {
+ return system_id._retn ();
+ }
+
+ // If the POA has the IMPLICIT_ACTIVATION policy and either the POA
+ // has the MULTIPLE_ID policy or the specified servant is not
+ // active, the servant is activated using a POA-generated Object Id
+ // and the Interface Id associated with the servant, and that Object
+ // Id is returned.
+ if (this->poa_->allow_implicit_activation ())
+ {
+ // If we reach here, then we either have the MULTIPLE_ID policy
+ // or we have the UNIQUE_ID policy and we are not in the active
+ // object map.
+ PortableServer::ObjectId_var system_id;
+ if (this->active_object_map_->
+ bind_using_system_id_returning_system_id (servant,
+ priority,
+ system_id.out ()) != 0)
+ {
+ ACE_THROW_RETURN (CORBA::OBJ_ADAPTER (),
+ 0);
+ }
+
+ //
+ // Everything is finally ok
+ //
+
+ // Inform the custom servant dispatching (CSD) strategy that the
+ // sevant is activated.
+ this->poa_->servant_activated_hook (servant,
+ system_id.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ // ATTENTION: Trick locking here, see class header for details
+ Non_Servant_Upcall non_servant_upcall (*this->poa_);
+ ACE_UNUSED_ARG (non_servant_upcall);
+
+ // If this operation causes the object to be activated, _add_ref
+ // is invoked at least once on the Servant argument before
+ // returning. Otherwise, the POA does not increment or decrement
+ // the reference count of the Servant passed to this function.
+ servant->_add_ref (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ return system_id._retn ();
+ }
+
+ // Otherwise, the ServantNotActive exception is raised.
+ ACE_THROW_RETURN (PortableServer::POA::ServantNotActive (),
+ 0);
+ }
+
+ CORBA::Object_ptr
+ ServantRetentionStrategyRetain::servant_to_reference (
+ PortableServer::Servant servant
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ServantNotActive,
+ PortableServer::POA::WrongPolicy))
+ {
+ // Note: The allocation of an Object Id value and installation in
+ // the Active Object Map caused by implicit activation may actually
+ // be deferred until an attempt is made to externalize the
+ // reference. The real requirement here is that a reference is
+ // produced that will behave appropriately (that is, yield a
+ // consistent Object Id value when asked politely).
+ CORBA::Short priority =
+ this->poa_->server_priority ();
+
+ PortableServer::ObjectId_var system_id =
+ this->servant_to_system_id_i (servant,
+ priority
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Object::_nil ());
+
+ PortableServer::ObjectId user_id;
+
+ // This operation requires the RETAIN, therefore don't worry about
+ // the NON_RETAIN case.
+ if (this->active_object_map_->
+ find_user_id_using_system_id (system_id.in (),
+ user_id) != 0)
+ {
+ ACE_THROW_RETURN (CORBA::OBJ_ADAPTER (),
+ CORBA::Object::_nil ());
+ }
+
+ // Remember params for potentially invoking <key_to_object> later.
+ this->poa_->key_to_object_params_.set (
+ system_id,
+ servant->_interface_repository_id (),
+ servant,
+ 1,
+ priority,
+ true);
+
+ // Ask the ORT to create the object.
+ // @@NOTE:There is a possible deadlock lurking here. We held the
+ // lock, and we are possibly trying to make a call into the
+ // application code. Think what would happen if the app calls us
+ // back. We need to get to this at some point.
+ return this->poa_->invoke_key_to_object_helper_i (
+ servant->_interface_repository_id (),
+ user_id
+ ACE_ENV_ARG_PARAMETER);
+ }
+
+ PortableServer::ObjectId *
+ ServantRetentionStrategyRetain::activate_object (
+ PortableServer::Servant servant,
+ CORBA::Short priority,
+ int &wait_occurred_restart_call
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ServantAlreadyActive,
+ PortableServer::POA::WrongPolicy))
+ {
+ if (!this->poa_->has_system_id ())
+ {
+ ACE_THROW_RETURN (PortableServer::POA::WrongPolicy (),
+ 0);
+ }
+
+ bool may_activate =
+ this->poa_->is_servant_activation_allowed (servant, wait_occurred_restart_call);
+
+ if (!may_activate)
+ {
+ if (wait_occurred_restart_call)
+ {
+ return 0;
+ }
+ else
+ {
+ ACE_THROW_RETURN (PortableServer::POA::ServantAlreadyActive (),
+ 0);
+ }
+ }
+
+ // Otherwise, the activate_object operation generates an Object Id
+ // and enters the Object Id and the specified servant in the Active
+ // Object Map. The Object Id is returned.
+ PortableServer::ObjectId_var user_id;
+ if (this->active_object_map_->
+ bind_using_system_id_returning_user_id (servant,
+ priority,
+ user_id.out ()) != 0)
+ {
+ ACE_THROW_RETURN (CORBA::OBJ_ADAPTER (),
+ 0);
+ }
+
+ //
+ // Everything is finally ok
+ //
+
+ // Inform the custom servant dispatching (CSD) strategy that the
+ // sevant is activated.
+ this->poa_->servant_activated_hook (servant,
+ user_id.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ // ATTENTION: Trick locking here, see class header for details
+ Non_Servant_Upcall non_servant_upcall (*this->poa_);
+ ACE_UNUSED_ARG (non_servant_upcall);
+
+ // The implementation of activate_object will invoke _add_ref at
+ // least once on the Servant argument before returning. When the POA
+ // no longer needs the Servant, it will invoke _remove_ref on it the
+ // same number of times.
+ servant->_add_ref (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ return user_id._retn ();
+ }
+
+#if !defined (CORBA_E_MICRO)
+ void
+ ServantRetentionStrategyRetain::activate_object_with_id (
+ const PortableServer::ObjectId &id,
+ PortableServer::Servant servant,
+ CORBA::Short priority,
+ int &wait_occurred_restart_call
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ServantAlreadyActive,
+ PortableServer::POA::ObjectAlreadyActive,
+ PortableServer::POA::WrongPolicy))
+ {
+ // If the POA has the SYSTEM_ID policy and it detects that the
+ // Object Id value was not generated by the system or for this POA,
+ // the activate_object_with_id operation may raise the BAD_PARAM
+ // system exception. An ORB is not required to detect all such
+ // invalid Object Id values, but a portable application must not
+ // invoke activate_object_with_id on a POA that has the SYSTEM_ID
+ // policy with an Object Id value that was not previously generated
+ // by the system for that POA, or, if the POA also has the
+ // PERSISTENT policy, for a previous instantiation of the same POA.
+ if (this->poa_->has_system_id () &&
+ !this->poa_->is_poa_generated_id (id))
+ {
+ ACE_THROW (CORBA::BAD_PARAM ());
+ }
+
+ // If the CORBA object denoted by the Object Id value is already
+ // active in this POA (there is a servant bound to it in the Active
+ // Object Map), the ObjectAlreadyActive exception is raised.
+ int priorities_match = 1;
+ int result =
+ this->is_user_id_in_map (id,
+ priority,
+ priorities_match,
+ wait_occurred_restart_call);
+
+ // @johnny the implementation is not complete, this does the spec also say
+ // If the POA has the UNIQUE_ID policy and the servant is already
+ // in the Active Object Map, the ServantAlreadyActive exception is raised.
+ if (result)
+ {
+ ACE_THROW (PortableServer::POA::ObjectAlreadyActive ());
+ }
+ else if (wait_occurred_restart_call)
+ {
+ // We ended up waiting on a condition variable, the POA state
+ // may have changed while we are waiting. Therefore, we need to
+ // restart this call.
+ return;
+ }
+
+ // If the activate_object_with_id_and_priority operation is invoked
+ // with a different priority to an earlier invocation of one of the
+ // create reference with priority operations, for the same object,
+ // then the ORB shall raise a BAD_INV_ORDER system exception (with a
+ // Standard Minor Exception Code of 1). If the priority value is the
+ // same then the ORB shall return SUCCESS.
+ if (!priorities_match)
+ {
+ ACE_THROW (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 1,
+ CORBA::COMPLETED_NO));
+ }
+
+ bool may_activate =
+ this->poa_->is_servant_activation_allowed (servant, wait_occurred_restart_call);
+
+ if (!may_activate)
+ {
+ if (wait_occurred_restart_call)
+ {
+ return;
+ }
+ else
+ {
+ ACE_THROW (PortableServer::POA::ServantAlreadyActive ());
+ }
+ }
+
+ // Otherwise, the activate_object_with_id operation enters an
+ // association between the specified Object Id and the specified
+ // servant in the Active Object Map.
+ if (this->active_object_map_->bind_using_user_id (servant,
+ id,
+ priority) != 0)
+ {
+ ACE_THROW (CORBA::OBJ_ADAPTER ());
+ }
+
+ //
+ // Everything is finally ok
+ //
+
+ // Inform the custom servant dispatching (CSD) strategy that the
+ // sevant is activated.
+ this->poa_->servant_activated_hook (servant,
+ id
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // ATTENTION: Trick locking here, see class header for details
+ Non_Servant_Upcall non_servant_upcall (*this->poa_);
+ ACE_UNUSED_ARG (non_servant_upcall);
+
+ // The implementation of activate_object_with_id will invoke
+ // _add_ref at least once on the Servant argument before
+ // returning. When the POA no longer needs the Servant, it will
+ // invoke _remove_ref on it the same number of times.
+ servant->_add_ref (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+#endif
+
+ CORBA::Object_ptr
+ ServantRetentionStrategyRetain::create_reference (
+ const char *intf,
+ CORBA::Short priority
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongPolicy))
+ {
+ // This operation creates an object reference that encapsulates a
+ // POA-generated Object Id value and the specified interface
+ // repository id. This operation does not cause an activation to
+ // take place. The resulting reference may be passed to clients, so
+ // that subsequent requests on those references will cause the
+ // appropriate servant manager to be invoked, if one is
+ // available. The generated Object Id value may be obtained by
+ // invoking POA::reference_to_id with the created reference.
+
+ PortableServer::ObjectId_var system_id;
+ PortableServer::ObjectId user_id;
+
+ if (this->active_object_map_->
+ bind_using_system_id_returning_system_id (0,
+ priority,
+ system_id.out ()) != 0)
+ {
+ ACE_THROW_RETURN (CORBA::OBJ_ADAPTER (),
+ CORBA::Object::_nil ());
+ }
+
+ // Find user id from system id.
+ if (this->active_object_map_->
+ find_user_id_using_system_id (system_id.in (),
+ user_id) != 0)
+ {
+ ACE_THROW_RETURN (CORBA::OBJ_ADAPTER (),
+ CORBA::Object::_nil ());
+ }
+
+ // Remember params for potentially invoking <key_to_object> later.
+ this->poa_->key_to_object_params_.set (system_id,
+ intf,
+ 0,
+ 1,
+ priority,
+ true);
+
+ return this->poa_->invoke_key_to_object_helper_i (intf,
+ user_id
+ ACE_ENV_ARG_PARAMETER);
+
+ }
+
+ CORBA::Object_ptr
+ ServantRetentionStrategyRetain::create_reference_with_id (
+ const PortableServer::ObjectId &oid,
+ const char *intf,
+ CORBA::Short priority
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ // This operation creates an object reference that encapsulates the
+ // specified Object Id and interface repository Id values. This
+ // operation does not cause an activation to take place. The
+ // resulting reference may be passed to clients, so that subsequent
+ // requests on those references will cause the object to be
+ // activated if necessary, or the default servant used, depending on
+ // the applicable policies.
+
+ PortableServer::Servant servant = 0;
+ PortableServer::ObjectId_var system_id;
+
+ // @@ We need something that can find the system id using
+ // appropriate strategy, at the same time, return the servant if
+ // one is available. Before we have that function,
+ // <create_reference_with_id_i> basically generates broken
+ // collocated object when DIRECT collocation strategy is used.
+
+ if (this->active_object_map_->
+ find_system_id_using_user_id (oid,
+ priority,
+ system_id.out ()) != 0)
+ {
+ ACE_THROW_RETURN (CORBA::OBJ_ADAPTER (),
+ CORBA::Object::_nil ());
+ }
+
+ // Remember params for potentially invoking <key_to_object> later.
+ this->poa_->key_to_object_params_.set (system_id,
+ intf,
+ servant,
+ 1,
+ priority,
+ true);
+
+ return this->poa_->invoke_key_to_object_helper_i (intf,
+ oid
+ ACE_ENV_ARG_PARAMETER);
+ }
+
+ int
+ ServantRetentionStrategyRetain::rebind_using_user_id_and_system_id (
+ PortableServer::Servant servant,
+ const PortableServer::ObjectId &user_id,
+ const PortableServer::ObjectId &system_id,
+ TAO::Portable_Server::Servant_Upcall &servant_upcall)
+ {
+ TAO_Active_Object_Map_Entry *entry = 0;
+ int result = this->active_object_map_->
+ rebind_using_user_id_and_system_id (servant,
+ user_id,
+ system_id,
+ entry);
+ servant_upcall.active_object_map_entry(entry);
+
+ return result;
+ }
+
+ CORBA::Boolean
+ ServantRetentionStrategyRetain::servant_has_remaining_activations (
+ PortableServer::Servant servant)
+ {
+ return this->active_object_map_->remaining_activations (servant);
+ }
+
+
+ ::PortableServer::ServantRetentionPolicyValue
+ ServantRetentionStrategyRetain::type() const
+ {
+ return ::PortableServer::RETAIN;
+ }
+
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/ServantRetentionStrategyRetain.h b/TAO/tao/PortableServer/ServantRetentionStrategyRetain.h
new file mode 100644
index 00000000000..a82ba0aa20a
--- /dev/null
+++ b/TAO/tao/PortableServer/ServantRetentionStrategyRetain.h
@@ -0,0 +1,196 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file ServantRetentionStrategyRetain.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_SERVANT_RETENTION_STRATEGY_RETAIN_H
+#define TAO_SERVANT_RETENTION_STRATEGY_RETAIN_H
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/ServantRetentionStrategyNonRetain.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Root_POA;
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ class ServantRetentionStrategyRetain
+ : public ServantRetentionStrategyNonRetain
+ {
+ public:
+ ServantRetentionStrategyRetain (void);
+
+ CORBA::ULong waiting_servant_deactivation (void) const;
+
+ virtual void strategy_init (TAO_Root_POA *poa ACE_ENV_ARG_DECL);
+
+ virtual void strategy_cleanup(ACE_ENV_SINGLE_ARG_DECL);
+
+ virtual int is_servant_in_map (PortableServer::Servant servant,
+ int &wait_occurred_restart_call);
+
+ virtual
+ PortableServer::ObjectId *
+ activate_object (PortableServer::Servant servant,
+ CORBA::Short priority,
+ int &wait_occurred_restart_call
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ServantAlreadyActive,
+ PortableServer::POA::WrongPolicy));
+
+#if !defined (CORBA_E_MICRO)
+ virtual
+ void
+ activate_object_with_id (const PortableServer::ObjectId &id,
+ PortableServer::Servant servant,
+ CORBA::Short priority,
+ int &wait_occurred_restart_call
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ServantAlreadyActive,
+ PortableServer::POA::ObjectAlreadyActive,
+ PortableServer::POA::WrongPolicy));
+#endif
+
+ void deactivate_object (const PortableServer::ObjectId &id
+ ACE_ENV_ARG_DECL);
+
+ virtual PortableServer::Servant find_servant (
+ const PortableServer::ObjectId &system_id
+ ACE_ENV_ARG_DECL);
+
+ virtual PortableServer::ObjectId * system_id_to_object_id (
+ const PortableServer::ObjectId &system_id
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongAdapter,
+ PortableServer::POA::WrongPolicy));
+
+ virtual
+ PortableServer::Servant
+ user_id_to_servant (const PortableServer::ObjectId &id
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ObjectNotActive,
+ PortableServer::POA::WrongPolicy));
+
+ CORBA::Object_ptr id_to_reference (const PortableServer::ObjectId &id,
+ bool indirect ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ObjectNotActive,
+ PortableServer::POA::WrongPolicy));
+
+ virtual
+ TAO_SERVANT_LOCATION
+ servant_present (const PortableServer::ObjectId &system_id,
+ PortableServer::Servant &servant
+ ACE_ENV_ARG_DECL);
+
+ virtual PortableServer::Servant find_servant (
+ const PortableServer::ObjectId &system_id,
+ TAO::Portable_Server::Servant_Upcall &servant_upcall,
+ TAO::Portable_Server::POA_Current_Impl &poa_current_impl
+ ACE_ENV_ARG_DECL);
+
+ virtual int find_servant_priority (
+ const PortableServer::ObjectId &system_id,
+ CORBA::Short &priority
+ ACE_ENV_ARG_DECL);
+
+ virtual void deactivate_all_objects (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongPolicy));
+
+ virtual PortableServer::ObjectId *servant_to_user_id (
+ PortableServer::Servant servant
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ServantNotActive,
+ PortableServer::POA::WrongPolicy));
+
+ virtual
+ CORBA::Object_ptr
+ servant_to_reference (PortableServer::Servant servant
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ServantNotActive,
+ PortableServer::POA::WrongPolicy));
+
+ virtual
+ CORBA::Object_ptr create_reference (
+ const char *intf,
+ CORBA::Short priority
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongPolicy));
+
+ virtual
+ CORBA::Object_ptr create_reference_with_id (
+ const PortableServer::ObjectId &oid,
+ const char *intf,
+ CORBA::Short priority
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual ::PortableServer::ServantRetentionPolicyValue type() const;
+
+ protected:
+ int
+ is_user_id_in_map (const PortableServer::ObjectId &id,
+ CORBA::Short priority,
+ int &priorities_match,
+ int &wait_occurred_restart_call);
+
+ void
+ deactivate_map_entry (TAO_Active_Object_Map_Entry *active_object_map_entry
+ ACE_ENV_ARG_DECL);
+
+ PortableServer::ObjectId *servant_to_system_id_i (
+ PortableServer::Servant p_servant,
+ CORBA::Short &priority
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ServantNotActive,
+ PortableServer::POA::WrongPolicy));
+
+ virtual
+ int rebind_using_user_id_and_system_id (
+ PortableServer::Servant servant,
+ const PortableServer::ObjectId &user_id,
+ const PortableServer::ObjectId &system_id,
+ TAO::Portable_Server::Servant_Upcall &servant_upcall);
+
+ virtual
+ CORBA::Boolean servant_has_remaining_activations (
+ PortableServer::Servant servant);
+
+ virtual int unbind_using_user_id (
+ const PortableServer::ObjectId &user_id);
+
+ private:
+ TAO_Active_Object_Map *active_object_map_;
+ CORBA::ULong waiting_servant_deactivation_;
+ };
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_SERVANT_RETENTION_STRATEGY_RETAIN_H */
diff --git a/TAO/tao/PortableServer/ServantRetentionStrategyRetainFactoryImpl.cpp b/TAO/tao/PortableServer/ServantRetentionStrategyRetainFactoryImpl.cpp
new file mode 100644
index 00000000000..f801a3b5e25
--- /dev/null
+++ b/TAO/tao/PortableServer/ServantRetentionStrategyRetainFactoryImpl.cpp
@@ -0,0 +1,68 @@
+// $Id$
+
+#include "tao/PortableServer/ServantRetentionStrategyRetainFactoryImpl.h"
+#include "tao/PortableServer/ServantRetentionStrategy.h"
+#include "tao/PortableServer/ServantRetentionStrategyRetain.h"
+#include "ace/Dynamic_Service.h"
+#include "ace/Log_Msg.h"
+
+ACE_RCSID (PortableServer,
+ ServantRetentionStrategyRetainFactoryImpl,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ ServantRetentionStrategy*
+ ServantRetentionStrategyRetainFactoryImpl::create (
+ ::PortableServer::ServantRetentionPolicyValue value)
+ {
+ ServantRetentionStrategy* strategy = 0;
+
+ switch (value)
+ {
+ case ::PortableServer::RETAIN :
+ {
+ ACE_NEW_RETURN (strategy, ServantRetentionStrategyRetain, 0);
+ break;
+ }
+ case ::PortableServer::NON_RETAIN :
+ {
+ ACE_ERROR ((LM_ERROR, "Incorrect type in ServantRetentionStrategyNonRetainFactoryImpl"));
+ break;
+ }
+ }
+
+ return strategy;
+ }
+
+ void
+ ServantRetentionStrategyRetainFactoryImpl::destroy (
+ ServantRetentionStrategy *strategy
+ ACE_ENV_ARG_DECL)
+ {
+ strategy->strategy_cleanup (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ delete strategy;
+ }
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DEFINE (
+ ServantRetentionStrategyRetainFactoryImpl,
+ ACE_TEXT ("ServantRetentionStrategyRetainFactory"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (ServantRetentionStrategyRetainFactoryImpl),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0)
+
+ACE_FACTORY_NAMESPACE_DEFINE (
+ ACE_Local_Service,
+ ServantRetentionStrategyRetainFactoryImpl,
+ TAO::Portable_Server::ServantRetentionStrategyRetainFactoryImpl)
diff --git a/TAO/tao/PortableServer/ServantRetentionStrategyRetainFactoryImpl.h b/TAO/tao/PortableServer/ServantRetentionStrategyRetainFactoryImpl.h
new file mode 100644
index 00000000000..1dbddfbb378
--- /dev/null
+++ b/TAO/tao/PortableServer/ServantRetentionStrategyRetainFactoryImpl.h
@@ -0,0 +1,54 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file ServantRetentionStrategyRetainFactoryImpl.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_PORTABLESERVER_SERVANTRETENTIONSTRATEGYRETAIN_FACTORYIMPL_H
+#define TAO_PORTABLESERVER_SERVANTRETENTIONSTRATEGYRETAIN_FACTORYIMPL_H
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/Service_Config.h"
+#include "tao/PortableServer/ServantRetentionStrategyFactory.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ class TAO_PortableServer_Export ServantRetentionStrategyRetainFactoryImpl
+ : public ServantRetentionStrategyFactory
+ {
+ public:
+ /// Create a new servant retention strategy
+ virtual ServantRetentionStrategy* create (
+ ::PortableServer::ServantRetentionPolicyValue value);
+
+ virtual void destroy (
+ ServantRetentionStrategy *strategy
+ ACE_ENV_ARG_DECL);
+ };
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE_EXPORT (TAO_PortableServer, ServantRetentionStrategyRetainFactoryImpl)
+ACE_FACTORY_DECLARE (TAO_PortableServer, ServantRetentionStrategyRetainFactoryImpl)
+
+
+#include /**/ "ace/post.h"
+#endif /* TAO_PORTABLESERVER_SERVANTRETENTIONSTRATEGYRETAIN_FACTORYIMPL_H*/
diff --git a/TAO/tao/PortableServer/Servant_Base.cpp b/TAO/tao/PortableServer/Servant_Base.cpp
new file mode 100644
index 00000000000..0d66b79c7e5
--- /dev/null
+++ b/TAO/tao/PortableServer/Servant_Base.cpp
@@ -0,0 +1,361 @@
+// $Id$
+
+#include "tao/PortableServer/Servant_Base.h"
+#include "tao/PortableServer/Root_POA.h"
+#include "tao/PortableServer/Operation_Table.h"
+#include "tao/PortableServer/POA_Current_Impl.h"
+
+#include "tao/Timeprobe.h"
+#include "tao/ORB_Core.h"
+#include "tao/TSS_Resources.h"
+#include "tao/Stub.h"
+#include "tao/Environment.h"
+#include "tao/TAO_Server_Request.h"
+#include "tao/IFR_Client_Adapter.h"
+
+#include "ace/Dynamic_Service.h"
+#include "ace/OS_NS_string.h"
+
+//@@ TAO_SERVANT_BASE_INCLUDE_ADD_HOOK
+
+ACE_RCSID (PortableServer,
+ Servant_Base,
+ "$Id$")
+
+#if !defined (__ACE_INLINE__)
+# include "tao/PortableServer/Servant_Base.i"
+#endif /* ! __ACE_INLINE__ */
+
+#if defined (ACE_ENABLE_TIMEPROBES)
+
+static const char *TAO_Servant_Base_Timeprobe_Description[] =
+{
+ "Servant_Base::_find - start",
+ "Servant_Base::_find - end"
+};
+
+enum
+ {
+ TAO_SERVANT_BASE_FIND_START = 700,
+ TAO_SERVANT_BASE_FIND_END
+ };
+
+// Setup Timeprobes
+ACE_TIMEPROBE_EVENT_DESCRIPTIONS (TAO_Servant_Base_Timeprobe_Description,
+ TAO_SERVANT_BASE_FIND_START);
+
+#endif /* ACE_ENABLE_TIMEPROBES */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_ServantBase::TAO_ServantBase (void)
+ : TAO_Abstract_ServantBase ()
+ , ref_count_ (1)
+ , optable_ (0)
+{
+}
+
+TAO_ServantBase::TAO_ServantBase (const TAO_ServantBase &rhs)
+ : TAO_Abstract_ServantBase ()
+ , ref_count_ (1)
+ , optable_ (rhs.optable_)
+{
+}
+
+TAO_ServantBase &
+TAO_ServantBase::operator= (const TAO_ServantBase &rhs)
+{
+ this->optable_ = rhs.optable_;
+ return *this;
+}
+
+TAO_ServantBase::~TAO_ServantBase (void)
+{
+}
+
+PortableServer::POA_ptr
+TAO_ServantBase::_default_POA (ACE_ENV_SINGLE_ARG_DECL)
+{
+ CORBA::Object_var object =
+ TAO_ORB_Core_instance ()->root_poa (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (PortableServer::POA::_nil ());
+
+ return PortableServer::POA::_narrow (object.in ()
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::Boolean
+TAO_ServantBase::_is_a (const char *logical_type_id
+ ACE_ENV_ARG_DECL_NOT_USED)
+{
+ static char const id[] = "IDL:omg.org/CORBA/Object:1.0";
+ return ACE_OS::strcmp (logical_type_id, id) == 0;
+}
+
+CORBA::Boolean
+TAO_ServantBase::_non_existent (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+{
+ return false;
+}
+
+CORBA::InterfaceDef_ptr
+TAO_ServantBase::_get_interface (ACE_ENV_SINGLE_ARG_DECL)
+{
+ TAO_IFR_Client_Adapter *adapter =
+ ACE_Dynamic_Service<TAO_IFR_Client_Adapter>::instance (
+ TAO_ORB_Core::ifr_client_adapter_name ()
+ );
+
+ if (adapter == 0)
+ {
+ ACE_THROW_RETURN (CORBA::INTF_REPOS (),
+ 0);
+ }
+
+ // This doesn't take multiple ORBs into account, but it's being
+ // used only to resolve the IFR, so we should be ok.
+ return adapter->get_interface (TAO_ORB_Core_instance ()->orb (),
+ this->_interface_repository_id ()
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::Object_ptr
+TAO_ServantBase::_get_component (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+{
+ return CORBA::Object::_nil ();
+}
+
+char *
+TAO_ServantBase::_repository_id (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+{
+ return CORBA::string_dup (this->_interface_repository_id ());
+}
+
+int
+TAO_ServantBase::_find (const char *opname,
+ TAO_Skeleton& skelfunc,
+ const size_t length)
+{
+ ACE_FUNCTION_TIMEPROBE (TAO_SERVANT_BASE_FIND_START);
+ return this->optable_->find (opname, skelfunc, length);
+}
+
+int
+TAO_ServantBase::_find (const char *opname,
+ TAO_Collocated_Skeleton& skelfunc,
+ TAO::Collocation_Strategy st,
+ const size_t length)
+{
+ ACE_FUNCTION_TIMEPROBE (TAO_SERVANT_BASE_FIND_START);
+ return this->optable_->find (opname, skelfunc, st, length);
+}
+
+TAO_Stub *
+TAO_ServantBase::_create_stub (ACE_ENV_SINGLE_ARG_DECL)
+{
+ TAO_Stub *stub = 0;
+
+ TAO::Portable_Server::POA_Current_Impl *poa_current_impl =
+ static_cast<TAO::Portable_Server::POA_Current_Impl *>
+ (TAO_TSS_Resources::instance ()->poa_current_impl_);
+
+ CORBA::ORB_ptr servant_orb = 0;
+
+ if (poa_current_impl != 0
+ && this == poa_current_impl->servant ())
+ {
+ servant_orb = poa_current_impl->orb_core ().orb () ;
+
+ stub =
+ poa_current_impl->poa ()->key_to_stub (
+ poa_current_impl->object_key (),
+ this->_interface_repository_id (),
+ poa_current_impl->priority ()
+ ACE_ENV_ARG_PARAMETER
+ );
+ ACE_CHECK_RETURN (0);
+ }
+ else
+ {
+ PortableServer::POA_var poa =
+ this->_default_POA (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ CORBA::Object_var object =
+ poa->servant_to_reference (this ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ // Get the stub object
+ stub = object->_stubobj ();
+
+ // Increment the reference count since <object> will zap its
+ // stub object on deletion.
+ stub->_incr_refcnt ();
+
+ servant_orb = stub->orb_core ()->orb ();
+ }
+
+ stub->servant_orb (servant_orb);
+ return stub;
+}
+
+void TAO_ServantBase::synchronous_upcall_dispatch (TAO_ServerRequest & req,
+ void * servant_upcall,
+ void * derived_this
+ ACE_ENV_ARG_DECL)
+{
+ TAO_Skeleton skel;
+ char const * const opname = req.operation ();
+
+ // It seems that I might have missed s/g here. What if
+ // it is a one way that is SYNC_WITH_SERVER.
+ // Add the following line to handle this reply send as well.
+
+ // Handle the one ways that are SYNC_WITH_SERVER and not collocated
+ if (req.sync_with_server () && !req.collocated ())
+ {
+ req.send_no_exception_reply ();
+ }
+
+ // Fetch the skeleton for this operation
+ if (this->_find (opname,
+ skel,
+ static_cast <unsigned int> (req.operation_length())) == -1)
+ {
+ ACE_THROW (CORBA::BAD_OPERATION ());
+ }
+
+ CORBA::Boolean const send_reply =
+ !req.sync_with_server ()
+ && req.response_expected ()
+ && !req.deferred_reply ();
+
+ ACE_TRY
+ {
+ // Invoke the skeleton, it will demarshal the arguments, invoke
+ // the right operation on the skeleton class, and marshal any
+ // results. De/marshaling will only occur in the uncollocated
+ // case.
+ skel (req,
+ servant_upcall,
+ derived_this
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ /*
+ * Dispatch resolution specialization add hook.
+ * Over-ridden with code to handle optimized dispatch.
+ */
+ //@@ TAO_DISPATCH_RESOLUTION_OPT_ADD_HOOK
+
+ // It is our job to send the already marshaled reply, but only
+ // send if it is expected and it has not already been sent
+
+ // We send the reply only if it is NOT a SYNC_WITH_SERVER, a
+ // response is expected and if the reply is not deferred.
+ if (send_reply)
+ {
+ req.tao_send_reply ();
+ }
+ }
+ ACE_CATCHANY
+ {
+ // If an exception was raised we should marshal it and send
+ // the appropriate reply to the client
+ if (send_reply)
+ {
+ if (req.collocated ())
+ {
+ // Report the exception to the collocated client.
+ ACE_RE_THROW;
+ }
+ else
+ req.tao_send_reply_exception (ACE_ANY_EXCEPTION);
+ }
+ }
+ ACE_ENDTRY;
+ ACE_CHECK;
+
+ return;
+}
+
+void TAO_ServantBase::asynchronous_upcall_dispatch (TAO_ServerRequest & req,
+ void * servant_upcall,
+ void * derived_this
+ ACE_ENV_ARG_DECL)
+{
+ TAO_Skeleton skel;
+ const char *opname = req.operation ();
+
+ // It seems that I might have missed s/g here. What if
+ // it is a one way that is SYNC_WITH_SERVER.
+ // Add the following line to handle this reply send as well.
+
+ // Handle the one ways that are SYNC_WITH_SERVER
+ if (req.sync_with_server ())
+ {
+ req.send_no_exception_reply ();
+ }
+
+ // Fetch the skeleton for this operation
+ if (this->_find (opname,
+ skel,
+ static_cast <unsigned int> (req.operation_length())) == -1)
+ {
+ ACE_THROW (CORBA::BAD_OPERATION ());
+ }
+
+ ACE_TRY
+ {
+ // Invoke the skeleton, it will demarshal the arguments, invoke
+ // the right operation on the skeleton class, and marshal any
+ // results. De/marshaling will only occur in the uncollocated
+ // case.
+ skel (req,
+ servant_upcall,
+ derived_this
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ // It is our job to send the already marshaled reply, but only
+ // send if it is expected and it has not already been sent
+
+ // Return immediately. Do not send a reply; this is an
+ // asynchronous upcall. (unless, of course there is a system
+ // exception.
+
+ }
+ ACE_CATCHANY
+ {
+ // If an exception was raised we should marshal it and send
+ // the appropriate reply to the client
+ req.tao_send_reply_exception (ACE_ANY_EXCEPTION);
+ }
+ ACE_ENDTRY;
+ ACE_CHECK;
+
+ return;
+}
+
+void
+TAO_ServantBase::_add_ref (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+{
+ ++this->ref_count_;
+}
+
+void
+TAO_ServantBase::_remove_ref (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+{
+ long const new_count = --this->ref_count_;
+
+ if (new_count == 0)
+ delete this;
+}
+
+CORBA::ULong
+TAO_ServantBase::_refcount_value (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) const
+{
+ return static_cast<CORBA::ULong> (this->ref_count_.value ());
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/Servant_Base.h b/TAO/tao/PortableServer/Servant_Base.h
new file mode 100644
index 00000000000..63757c06ecf
--- /dev/null
+++ b/TAO/tao/PortableServer/Servant_Base.h
@@ -0,0 +1,197 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Servant_Base.h
+ *
+ * $Id$
+ *
+ * @author Irfan Pyarali <irfan@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_SERVANT_BASE_H
+#define TAO_SERVANT_BASE_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/PS_ForwardC.h"
+#include "tao/PortableServer/Servant_var.h"
+#include "tao/Abstract_Servant_Base.h"
+#include "ace/Atomic_Op.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Operation_Table;
+
+/**
+ * @class TAO_ServantBase
+ *
+ * @brief Base class for skeletons and servants.
+ *
+ * The POA spec requires that all servants inherit from this class'
+ * base class.
+ *
+ * An instance of a servant class derived from
+ * ServantBase initially has a reference count of
+ * one. Invoking _add_ref on the servant instance increases its
+ * reference count by one. Invoking _remove_ref on the servant
+ * instance decreases its reference count by one; if the
+ * resulting reference count equals zero, _remove_ref invokes
+ * delete on its this pointer in order to destroy the
+ * servant. For ORBs that operate in multi-threaded
+ * environments, the implementations of _add_ref and _remove_ref
+ * that the ServantBase class provides shall be
+ * thread-safe.
+ *
+ * Like ServantBase supports copy
+ * construction and the default assignment operation. Copy
+ * construction always sets the reference count of the new
+ * servant instance to one. The default assignment
+ * implementation merely returns *this and does not affect the
+ * reference count.
+ *
+ */
+class TAO_PortableServer_Export TAO_ServantBase
+ : public virtual TAO_Abstract_ServantBase
+{
+public:
+
+ /// Destructor.
+ virtual ~TAO_ServantBase (void);
+
+ /// Returns the default POA for this servant.
+ virtual PortableServer::POA_ptr _default_POA (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ );
+
+ /// Local implementation of the CORBA::Object::_is_a method.
+ virtual CORBA::Boolean _is_a (const char *logical_type_id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ /// Default _non_existent: always returns false.
+ virtual CORBA::Boolean _non_existent (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ );
+
+ /// Query the Interface Repository for the interface definition.
+ virtual CORBA::InterfaceDef_ptr _get_interface (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ );
+
+ /// Default _get_component: always returns CORBA::Object::_nil().
+ virtual CORBA::Object_ptr _get_component (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ );
+
+ /// Get the repository id.
+ virtual char * _repository_id (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ );
+
+ /// This is an auxiliary method for _this() and _narrow().
+ virtual TAO_Stub *_create_stub (ACE_ENV_SINGLE_ARG_DECL);
+
+ /**
+ * Dispatches a request to the object: find the operation, cast the
+ * type to the most derived type, demarshall all the parameters from
+ * the request and finally invokes the operation, storing the
+ * results and out parameters (if any) or the exceptions thrown into
+ * @a request.
+ */
+ virtual void _dispatch (TAO_ServerRequest &request,
+ void *servant_upcall
+ ACE_ENV_ARG_DECL) = 0;
+
+ /// Please see documentation in tao/Abstract_Servant_Base.h for
+ /// details.
+ virtual int _find (const char *opname,
+ TAO_Skeleton &skelfunc,
+ const size_t length = 0);
+
+ virtual int _find (const char *opname,
+ TAO_Collocated_Skeleton &skelfunc,
+ TAO::Collocation_Strategy st,
+ const size_t length = 0);
+
+ /// Get this interface's repository id (TAO specific).
+ virtual const char *_interface_repository_id (void) const = 0;
+
+ //@{
+ /**
+ * @name Reference Counting Operations
+ */
+ /// Increase reference count by one.
+ virtual void _add_ref (ACE_ENV_SINGLE_ARG_DECL);
+
+ /**
+ * Decreases reference count by one; if the resulting reference
+ * count equals zero, _remove_ref invokes delete on its this pointer
+ * in order to destroy the servant.
+ */
+ virtual void _remove_ref (ACE_ENV_SINGLE_ARG_DECL);
+
+ /**
+ * Returns the current reference count value.
+ */
+ virtual CORBA::ULong _refcount_value (ACE_ENV_SINGLE_ARG_DECL) const;
+ //@}
+
+protected:
+
+ /// Default constructor, only derived classes can be created.
+ TAO_ServantBase (void);
+
+ /// Copy constructor, protected so no instances can be created.
+ TAO_ServantBase (const TAO_ServantBase &);
+
+ /// Assignment operator.
+ TAO_ServantBase &operator= (const TAO_ServantBase &);
+
+ virtual void synchronous_upcall_dispatch (TAO_ServerRequest & req,
+ void * servant_upcall,
+ void * derived_this
+ ACE_ENV_ARG_DECL);
+
+ virtual void asynchronous_upcall_dispatch (TAO_ServerRequest & req,
+ void * servant_upcall,
+ void * derived_this
+ ACE_ENV_ARG_DECL);
+
+protected:
+ /// Reference counter.
+ ACE_Atomic_Op<TAO_SYNCH_MUTEX, long> ref_count_;
+
+ /// The operation table for this servant. It is initialized by the
+ /// most derived class.
+ TAO_Operation_Table * optable_;
+};
+
+class TAO_PortableServer_Export TAO_Servant_Hash
+{
+public:
+ /// Returns hash value.
+ u_long operator () (PortableServer::Servant servant) const;
+};
+
+
+namespace PortableServer
+{
+ typedef Servant_var<TAO_ServantBase> ServantBase_var;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/PortableServer/Servant_Base.i"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_SERVANT_BASE_H */
diff --git a/TAO/tao/PortableServer/Servant_Base.i b/TAO/tao/PortableServer/Servant_Base.i
new file mode 100644
index 00000000000..afa16b3fb71
--- /dev/null
+++ b/TAO/tao/PortableServer/Servant_Base.i
@@ -0,0 +1,13 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE u_long
+TAO_Servant_Hash::operator () (PortableServer::Servant servant) const
+{
+ return static_cast<u_long> (reinterpret_cast<ptrdiff_t> (servant));
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/Servant_Dispatcher.cpp b/TAO/tao/PortableServer/Servant_Dispatcher.cpp
new file mode 100644
index 00000000000..05f34b15345
--- /dev/null
+++ b/TAO/tao/PortableServer/Servant_Dispatcher.cpp
@@ -0,0 +1,16 @@
+// $Id$
+
+#include "tao/PortableServer/Servant_Dispatcher.h"
+
+ACE_RCSID(PortableServer,
+ Servant_Dispatcher,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Servant_Dispatcher::~TAO_Servant_Dispatcher (void)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/Servant_Dispatcher.h b/TAO/tao/PortableServer/Servant_Dispatcher.h
new file mode 100644
index 00000000000..10c062e52d1
--- /dev/null
+++ b/TAO/tao/PortableServer/Servant_Dispatcher.h
@@ -0,0 +1,91 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Servant_Dispatcher.h
+ *
+ * $Id$
+ *
+ * @author Frank Hunleth <fhunleth@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_SERVANT_DISPATCHER_H
+#define TAO_SERVANT_DISPATCHER_H
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/Servant_Upcall.h"
+#include "ace/SStringfwd.h"
+
+ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+class ACE_Lock;
+ACE_END_VERSIONED_NAMESPACE_DECL
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Forward references.
+class TAO_POA_Manager;
+class TAO_POA_Policy_Set;
+class TAO_Root_POA;
+class TAO_ORB_Core;
+class TAO_ServerRequest;
+
+namespace PortableServer
+{
+ class POAManager;
+ typedef POAManager *POAManager_ptr;
+}
+
+/**
+ * @class TAO_Servant_Dispatcher
+ *
+ * @brief Interface for POA servant dispatching strategies.
+ */
+class TAO_PortableServer_Export TAO_Servant_Dispatcher
+{
+public:
+ virtual ~TAO_Servant_Dispatcher (void);
+
+ /// Pre_invoke remote request.
+ virtual void pre_invoke_remote_request (
+ TAO_Root_POA &poa,
+ CORBA::Short servant_priority,
+ TAO_ServerRequest &req,
+ TAO::Portable_Server::Servant_Upcall::Pre_Invoke_State &pre_invoke_state
+ ACE_ENV_ARG_DECL
+ ) = 0;
+
+ /// Pre_invoke collocated request.
+ virtual void pre_invoke_collocated_request (
+ TAO_Root_POA &poa,
+ CORBA::Short servant_priority,
+ TAO::Portable_Server::Servant_Upcall::Pre_Invoke_State &pre_invoke_state
+ ACE_ENV_ARG_DECL) = 0;
+
+ /// Post_invoke request.
+ virtual void post_invoke (
+ TAO_Root_POA &poa,
+ TAO::Portable_Server::Servant_Upcall::Pre_Invoke_State &pre_invoke_state) = 0;
+
+ /// Factory method for creating new POA's.
+ virtual TAO_Root_POA *create_Root_POA (
+ const ACE_CString &name,
+ PortableServer::POAManager_ptr poa_manager,
+ const TAO_POA_Policy_Set &policies,
+ ACE_Lock &lock,
+ TAO_SYNCH_MUTEX &thread_lock,
+ TAO_ORB_Core &orb_core,
+ TAO_Object_Adapter *object_adapter
+ ACE_ENV_ARG_DECL) = 0;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_SERVANT_DISPATCHER_H */
diff --git a/TAO/tao/PortableServer/Servant_Location.h b/TAO/tao/PortableServer/Servant_Location.h
new file mode 100644
index 00000000000..7ab08442408
--- /dev/null
+++ b/TAO/tao/PortableServer/Servant_Location.h
@@ -0,0 +1,38 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Servant_Location.h
+ *
+ * $Id$
+ *
+ * @author Irfan Pyarali
+ */
+//=============================================================================
+
+#ifndef TAO_SERVANT_LOCATION_H
+#define TAO_SERVANT_LOCATION_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+enum TAO_SERVANT_LOCATION
+{
+ TAO_SERVANT_FOUND,
+ TAO_DEFAULT_SERVANT,
+ TAO_SERVANT_MANAGER,
+ TAO_SERVANT_NOT_FOUND
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_SERVANT_LOCATION_H */
diff --git a/TAO/tao/PortableServer/Servant_Upcall.cpp b/TAO/tao/PortableServer/Servant_Upcall.cpp
new file mode 100644
index 00000000000..9e5ef598e2b
--- /dev/null
+++ b/TAO/tao/PortableServer/Servant_Upcall.cpp
@@ -0,0 +1,473 @@
+// $Id$
+
+#include "tao/PortableServer/Object_Adapter.h"
+#include "tao/PortableServer/Servant_Upcall.h"
+#include "tao/PortableServer/Root_POA.h"
+#include "tao/PortableServer/Default_Servant_Dispatcher.h"
+#include "tao/PortableServer/Collocated_Object_Proxy_Broker.h"
+#include "tao/PortableServer/Active_Object_Map_Entry.h"
+#include "tao/PortableServer/ForwardRequestC.h"
+
+// -- TAO Include --
+#include "tao/ORB.h"
+#include "tao/ORB_Core.h"
+#include "tao/debug.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/PortableServer/Servant_Upcall.inl"
+#endif /* __ACE_INLINE__ */
+
+#include "ace/OS_NS_string.h"
+
+ACE_RCSID (PortableServer,
+ Servant_Upcall,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ Servant_Upcall::Servant_Upcall (TAO_ORB_Core *oc)
+ : object_adapter_ (0),
+ poa_ (0),
+ servant_ (0),
+ state_ (INITIAL_STAGE),
+ system_id_ (TAO_POA_OBJECT_ID_BUF_SIZE, 0, system_id_buf_),
+ user_id_ (0),
+ current_context_ (),
+#if (TAO_HAS_MINIMUM_POA == 0)
+ cookie_ (0),
+ operation_ (0),
+#endif /* TAO_HAS_MINIMUM_POA == 0 */
+ active_object_map_entry_ (0)
+ {
+ TAO_Object_Adapter *object_adapter =
+ dynamic_cast<TAO_Object_Adapter *>(oc->poa_adapter ());
+ this->object_adapter_ = object_adapter;
+ }
+
+ int
+ Servant_Upcall::prepare_for_upcall (
+ const TAO::ObjectKey &key,
+ const char *operation,
+ CORBA::Object_out forward_to
+ ACE_ENV_ARG_DECL)
+ {
+ while (1)
+ {
+ int wait_occurred_restart_call = 0;
+
+ int result =
+ this->prepare_for_upcall_i (key,
+ operation,
+ forward_to,
+ wait_occurred_restart_call
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO_Adapter::DS_FAILED);
+
+ if (result == TAO_Adapter::DS_FAILED &&
+ wait_occurred_restart_call)
+ {
+ // We ended up waiting on a condition variable. The POA
+ // state may have changed while we are waiting. Therefore,
+ // we need to call prepare_for_upcall_i() again. We also
+ // need to cleanup the state of the upcall object before
+ // continuing.
+ this->upcall_cleanup ();
+ continue;
+ }
+ else
+ {
+ return result;
+ }
+ }
+ }
+
+ int
+ Servant_Upcall::prepare_for_upcall_i (
+ const TAO::ObjectKey &key,
+ const char *operation,
+ CORBA::Object_out forward_to,
+ int &wait_occurred_restart_call
+ ACE_ENV_ARG_DECL)
+ {
+ // Acquire the object adapter lock first.
+ int result = this->object_adapter_->lock ().acquire ();
+ if (result == -1)
+ // Locking error.
+ ACE_THROW_RETURN (CORBA::OBJ_ADAPTER (),
+ TAO_Adapter::DS_FAILED);
+
+ // We have acquired the object adapter lock. Record this for later
+ // use.
+ this->state_ = OBJECT_ADAPTER_LOCK_ACQUIRED;
+
+ // Check if a non-servant upcall is in progress. If a non-servant
+ // upcall is in progress, wait for it to complete. Unless of
+ // course, the thread making the non-servant upcall is this thread.
+ this->object_adapter_->wait_for_non_servant_upcalls_to_complete (
+ ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO_Adapter::DS_FAILED);
+
+ // Locate the POA.
+ this->object_adapter_->locate_poa (key,
+ this->system_id_,
+ this->poa_
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO_Adapter::DS_FAILED);
+
+ // Check the state of the POA.
+ this->poa_->check_state (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO_Adapter::DS_FAILED);
+
+ // Setup current for this request.
+ this->current_context_.setup (this->poa_,
+ key);
+
+ // Increase <poa->outstanding_requests_> for the duration of finding
+ // the POA, finding the servant, and making the upcall.
+ this->poa_->increment_outstanding_requests ();
+
+ // We have setup the POA Current. Record this for later use.
+ this->state_ = POA_CURRENT_SETUP;
+
+ ACE_TRY
+ {
+ // Lookup the servant.
+ this->servant_ =
+ this->poa_->locate_servant_i (operation,
+ this->system_id_,
+ *this,
+ this->current_context_,
+ wait_occurred_restart_call
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (wait_occurred_restart_call)
+ return TAO_Adapter::DS_FAILED;
+ }
+#if (TAO_HAS_MINIMUM_CORBA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
+ ACE_CATCH (PortableServer::ForwardRequest, forward_request)
+ {
+ forward_to =
+ CORBA::Object::_duplicate (forward_request.forward_reference.in ());
+ return TAO_Adapter::DS_FORWARD;
+ }
+#else
+ ACE_CATCHANY
+ {
+ ACE_UNUSED_ARG (forward_to);
+ ACE_RE_THROW;
+ }
+#endif /* TAO_HAS_MINIMUM_CORBA */
+ ACE_ENDTRY;
+
+ // Now that we know the servant.
+ this->current_context_.servant (this->servant_);
+
+ // For servants from Servant Locators, there is no active object map
+ // entry.
+ if (this->active_object_map_entry ())
+ this->current_context_.priority (this->active_object_map_entry ()->priority_);
+
+ if (this->state_ != OBJECT_ADAPTER_LOCK_RELEASED)
+ {
+ // Release the object adapter lock.
+ this->object_adapter_->lock ().release ();
+
+ // We have release the object adapter lock. Record this for
+ // later use.
+ this->state_ = OBJECT_ADAPTER_LOCK_RELEASED;
+ }
+
+ // Serialize servants (if appropriate).
+ this->single_threaded_poa_setup (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO_Adapter::DS_FAILED);
+
+ // We have acquired the servant lock. Record this for later use.
+ this->state_ = SERVANT_LOCK_ACQUIRED;
+
+ // After this point, <this->servant_> is ready for dispatching.
+ return TAO_Adapter::DS_OK;
+ }
+
+ void
+ Servant_Upcall::pre_invoke_remote_request (
+ TAO_ServerRequest &req
+ ACE_ENV_ARG_DECL)
+ {
+ this->object_adapter_->servant_dispatcher_->pre_invoke_remote_request (
+ this->poa (),
+ this->priority (),
+ req,
+ this->pre_invoke_state_
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ void
+ Servant_Upcall::pre_invoke_collocated_request (
+ ACE_ENV_SINGLE_ARG_DECL)
+ {
+ this->object_adapter_->servant_dispatcher_->pre_invoke_collocated_request (
+ this->poa (),
+ this->priority (),
+ this->pre_invoke_state_
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ void
+ Servant_Upcall::post_invoke (void)
+ {
+ this->object_adapter_->servant_dispatcher_->post_invoke (
+ this->poa (),
+ this->pre_invoke_state_);
+ }
+
+ Servant_Upcall::Pre_Invoke_State::Pre_Invoke_State (void)
+ : state_ (NO_ACTION_REQUIRED),
+ original_native_priority_ (0),
+ original_CORBA_priority_ (0)
+ {
+ }
+
+ ::TAO_Root_POA *
+ Servant_Upcall::lookup_POA (const TAO::ObjectKey &key
+ ACE_ENV_ARG_DECL)
+ {
+ // Acquire the object adapter lock first.
+ int result = this->object_adapter_->lock ().acquire ();
+ if (result == -1)
+ // Locking error.
+ ACE_THROW_RETURN (CORBA::OBJ_ADAPTER (),
+ 0);
+
+ // We have acquired the object adapter lock. Record this for later
+ // use.
+ this->state_ = OBJECT_ADAPTER_LOCK_ACQUIRED;
+
+ // Check if a non-servant upcall is in progress. If a non-servant
+ // upcall is in progress, wait for it to complete. Unless of
+ // course, the thread making the non-servant upcall is this thread.
+ this->object_adapter_->wait_for_non_servant_upcalls_to_complete (
+ ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ // Locate the POA.
+ this->object_adapter_->locate_poa (key,
+ this->system_id_,
+ this->poa_
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ return this->poa_;
+ }
+
+ Servant_Upcall::~Servant_Upcall (void)
+ {
+ this->upcall_cleanup ();
+ }
+
+ void
+ Servant_Upcall::upcall_cleanup (void)
+ {
+ this->post_invoke ();
+
+ switch (this->state_)
+ {
+ case SERVANT_LOCK_ACQUIRED:
+ // Unlock servant (if appropriate).
+ this->single_threaded_poa_cleanup ();
+
+ /* FALLTHRU */
+
+ case OBJECT_ADAPTER_LOCK_RELEASED:
+ // Cleanup servant locator related state. Note that because
+ // this operation does not change any Object Adapter related
+ // state, it is ok to call it outside the lock.
+ this->post_invoke_servant_cleanup ();
+
+ // Since the object adapter lock was released, we must acquire
+ // it.
+ //
+ // Note that errors are ignored here since we cannot do much
+ // with it.
+ this->object_adapter_->lock ().acquire ();
+
+ // Check if a non-servant upcall is in progress. If a
+ // non-servant upcall is in progress, wait for it to complete.
+ // Unless of course, the thread making the non-servant upcall is
+ // this thread.
+ this->object_adapter_->wait_for_non_servant_upcalls_to_complete_no_throw ();
+
+ // Cleanup servant related state.
+ this->servant_cleanup ();
+
+ /* FALLTHRU */
+
+ case POA_CURRENT_SETUP:
+ // Cleanup POA related state.
+ this->poa_cleanup ();
+
+ // Teardown current for this request.
+ this->current_context_.teardown ();
+
+ /* FALLTHRU */
+
+ case OBJECT_ADAPTER_LOCK_ACQUIRED:
+ // Finally, since the object adapter lock was acquired, we must
+ // release it.
+ this->object_adapter_->lock ().release ();
+
+ /* FALLTHRU */
+
+ case INITIAL_STAGE:
+ default:
+ // @@ Keep compiler happy, the states above are the only
+ // possible ones.
+ break;
+ }
+ }
+
+ void
+ Servant_Upcall::post_invoke_servant_cleanup (void)
+ {
+ this->poa_->post_invoke_servant_cleanup (this->current_context_.object_id (),
+ *this);
+ }
+
+ void
+ Servant_Upcall::single_threaded_poa_setup (ACE_ENV_SINGLE_ARG_DECL)
+ {
+#if (TAO_HAS_MINIMUM_POA == 0)
+ // Serialize servants (if necessary).
+ //
+ // Note that this lock must be acquired *after* the object adapter
+ // lock has been released. This is necessary since we cannot block
+ // waiting for the servant lock while holding the object adapter
+ // lock. Otherwise, the thread that wants to release this lock will
+ // not be able to do so since it can't acquire the object adapterx
+ // lock.
+ int result = this->poa_->enter();
+
+ if (result == -1)
+ // Locking error.
+ ACE_THROW (CORBA::OBJ_ADAPTER ());
+#else
+ ACE_ENV_ARG_NOT_USED; // FUZZ: ignore check_for_ace_check
+#endif /* !TAO_HAS_MINIMUM_POA == 0 */
+ }
+
+ void
+ Servant_Upcall::single_threaded_poa_cleanup (void)
+ {
+#if (TAO_HAS_MINIMUM_POA == 0)
+ int result = 0;
+
+ // Since the servant lock was acquired, we must release it.
+ result = this->poa_->exit ();
+
+ ACE_UNUSED_ARG (result);
+#endif /* TAO_HAS_MINIMUM_POA == 0 */
+ }
+
+ void
+ Servant_Upcall::increment_servant_refcount (void)
+ {
+ // Cleanup servant related stuff.
+ if (this->active_object_map_entry_ != 0)
+ ++this->active_object_map_entry_->reference_count_;
+ }
+
+ void
+ Servant_Upcall::servant_cleanup (void)
+ {
+ // Cleanup servant related stuff.
+ if (this->active_object_map_entry_ != 0)
+ {
+ // Decrement the reference count.
+ CORBA::UShort new_count =
+ --this->active_object_map_entry_->reference_count_;
+
+ if (new_count == 0)
+ {
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ this->poa_->cleanup_servant (
+ this->active_object_map_entry_->servant_,
+ this->active_object_map_entry_->user_id_
+ ACE_ENV_ARG_PARAMETER);
+
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHALL
+ {
+ // Ignore errors from servant cleanup ....
+ }
+ ACE_ENDTRY;
+
+ if (this->poa_->waiting_servant_deactivation() > 0 &&
+ this->object_adapter_->enable_locking_)
+ {
+ // Wakeup all waiting threads.
+ this->poa_->servant_deactivation_condition_.broadcast ();
+ }
+ }
+ }
+ }
+
+ void
+ Servant_Upcall::poa_cleanup (void)
+ {
+ // Decrease <poa->outstanding_requests_> now that the upcall
+ // is complete.
+ //
+ // Note that the object adapter lock is acquired before
+ // <POA::outstanding_requests_> is decreased.
+ CORBA::ULong outstanding_requests =
+ this->poa_->decrement_outstanding_requests ();
+
+ // Check if all pending requests are over.
+ if (outstanding_requests == 0)
+ {
+ // If locking is enabled and some thread is waiting in POA::destroy.
+ if (this->object_adapter_->enable_locking_ &&
+ this->poa_->wait_for_completion_pending_)
+ {
+ // Wakeup all waiting threads.
+ this->poa_->outstanding_requests_condition_.broadcast ();
+ }
+
+ // Note that there is no need to check for
+ // <non_servant_upcall_in_progress> since it is not possible for
+ // non-servant upcalls to be in progress at this point.
+ if (this->poa_->waiting_destruction_)
+ {
+ ACE_DECLARE_NEW_CORBA_ENV;
+
+ ACE_TRY
+ {
+ this->poa_->complete_destruction_i (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ // Ignore exceptions
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "TAO_POA::~complete_destruction_i");
+ }
+ ACE_ENDTRY;
+ ACE_CHECK;
+
+ this->poa_ = 0;
+ }
+ }
+ }
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/Servant_Upcall.h b/TAO/tao/PortableServer/Servant_Upcall.h
new file mode 100644
index 00000000000..427934e4faa
--- /dev/null
+++ b/TAO/tao/PortableServer/Servant_Upcall.h
@@ -0,0 +1,251 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Servant_Upcall.h
+ *
+ * $Id$
+ *
+ * @author Irfan Pyarali
+ */
+//=============================================================================
+
+#ifndef TAO_SERVANT_UPCALL_H
+#define TAO_SERVANT_UPCALL_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/POA_Current_Impl.h"
+
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Forward declaration
+class TAO_Root_POA;
+class TAO_ServerRequest;
+class TAO_Object_Adapter;
+class TAO_RT_Collocation_Resolver;
+struct TAO_Active_Object_Map_Entry;
+
+namespace CORBA
+{
+ class Object;
+ typedef Object *Object_ptr;
+ typedef TAO_Pseudo_Var_T<Object> Object_var;
+ typedef TAO_Pseudo_Out_T<Object> Object_out;
+}
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ /**
+ * @class Servant_Upcall
+ *
+ * @brief This class finds out the POA and the servant to perform an
+ * upcall. It can only be instantiated without the object
+ * adapter's lock held. For each upcall a new instance of this
+ * class is created.
+ */
+ class TAO_PortableServer_Export Servant_Upcall
+ {
+ public:
+ friend class ::TAO_RT_Collocation_Resolver;
+
+ /**
+ * @class Pre_Invoke_State
+ *
+ * @brief This struct keeps track of state related to pre- and
+ * post-invoke operations.
+ */
+ class Pre_Invoke_State
+ {
+ public:
+ /// Constructor.
+ Pre_Invoke_State (void);
+
+ enum State
+ {
+ NO_ACTION_REQUIRED,
+ PRIORITY_RESET_REQUIRED
+ };
+
+ /// Indicates whether the priority of the thread needs to be
+ /// reset back to its original value.
+ State state_;
+
+ /// Original native priority of the thread.
+ CORBA::Short original_native_priority_;
+
+ /// Original CORBA priority of the thread.
+ CORBA::Short original_CORBA_priority_;
+ };
+
+ /// Constructor.
+ explicit Servant_Upcall (TAO_ORB_Core *orb_core);
+
+ /// Destructor.
+ ~Servant_Upcall (void);
+
+ /// Locate POA and servant.
+ int prepare_for_upcall (const TAO::ObjectKey &key,
+ const char *operation,
+ CORBA::Object_out forward_to
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ /// Helper.
+ int prepare_for_upcall_i (const TAO::ObjectKey &key,
+ const char *operation,
+ CORBA::Object_out forward_to,
+ int &wait_occurred_restart_call
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ /// Run pre_invoke for a remote request.
+ void pre_invoke_remote_request (TAO_ServerRequest &req
+ ACE_ENV_ARG_DECL);
+
+ /// Run pre_invoke for a collocated request.
+ void pre_invoke_collocated_request (ACE_ENV_SINGLE_ARG_DECL);
+
+ /// Run post_invoke for a request.
+ void post_invoke (void);
+
+ /// Locate POA.
+ ::TAO_Root_POA *lookup_POA (const TAO::ObjectKey &key
+ ACE_ENV_ARG_DECL);
+
+ /// POA accessor.
+ ::TAO_Root_POA &poa (void) const;
+
+ /// Object Adapter accessor.
+ TAO_Object_Adapter &object_adapter (void) const;
+
+ /// System ID accessor.
+ const PortableServer::ObjectId &id (void) const;
+
+ /// User ID accessors. This is the same value returned by
+ /// PortableServer::Current::get_object_id().
+ void user_id (const PortableServer::ObjectId *);
+ const PortableServer::ObjectId &user_id (void) const;
+
+ /// Servant accessor.
+ PortableServer::Servant servant (void) const;
+
+ #if (TAO_HAS_MINIMUM_POA == 0)
+
+ /// Get the Servant Locator's cookie
+ void* locator_cookie (void) const;
+
+ /// Set the Servant Locator's cookie
+ void locator_cookie (void* cookie);
+
+ /// Get the operation name.
+ const char *operation (void) const;
+
+ /// Set the operation name.
+ void operation (const char *);
+
+ #endif /* TAO_HAS_MINIMUM_POA == 0 */
+
+ /// Set the active_object_map_entry.
+ void active_object_map_entry (TAO_Active_Object_Map_Entry *entry);
+
+ /// Get the active_object_map_entry.
+ TAO_Active_Object_Map_Entry *active_object_map_entry (void) const;
+
+ /// Get the priority for the current upcall.
+ CORBA::Short priority (void) const;
+
+ enum State
+ {
+ INITIAL_STAGE,
+ OBJECT_ADAPTER_LOCK_ACQUIRED,
+ POA_CURRENT_SETUP,
+ OBJECT_ADAPTER_LOCK_RELEASED,
+ SERVANT_LOCK_ACQUIRED
+ };
+
+ /// Get the state.
+ State state (void) const;
+
+ /// Set the state.
+ void state (State);
+
+ /// Increment the refcount
+ void increment_servant_refcount (void);
+
+ protected:
+
+ void post_invoke_servant_cleanup (void);
+ void single_threaded_poa_setup (ACE_ENV_SINGLE_ARG_DECL);
+ void single_threaded_poa_cleanup (void);
+ void servant_cleanup (void);
+ void poa_cleanup (void);
+
+ /// Clean-up / reset state of this Servant_Upcall object.
+ void upcall_cleanup (void);
+
+ protected:
+
+ TAO_Object_Adapter *object_adapter_;
+
+ ::TAO_Root_POA *poa_;
+
+ PortableServer::Servant servant_;
+
+ State state_;
+
+ CORBA::Octet system_id_buf_[TAO_POA_OBJECT_ID_BUF_SIZE];
+ PortableServer::ObjectId system_id_;
+
+ const PortableServer::ObjectId *user_id_;
+
+ POA_Current_Impl current_context_;
+
+ #if (TAO_HAS_MINIMUM_POA == 0)
+
+ /// Servant Locator's cookie
+ void* cookie_;
+
+ /// Operation name for this current.
+ const char *operation_;
+
+ #endif /* TAO_HAS_MINIMUM_POA == 0 */
+
+ /// Pointer to the entry in the TAO_Active_Object_Map corresponding
+ /// to the servant for this request.
+ TAO_Active_Object_Map_Entry *active_object_map_entry_;
+
+ /// Preinvoke data for the upcall.
+ Pre_Invoke_State pre_invoke_state_;
+
+ private:
+ Servant_Upcall (const Servant_Upcall &);
+ void operator= (const Servant_Upcall &);
+ };
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#if defined (__ACE_INLINE__)
+# include "tao/PortableServer/Servant_Upcall.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_SERVANT_UPCALL_H */
diff --git a/TAO/tao/PortableServer/Servant_Upcall.inl b/TAO/tao/PortableServer/Servant_Upcall.inl
new file mode 100644
index 00000000000..5f016db3fe6
--- /dev/null
+++ b/TAO/tao/PortableServer/Servant_Upcall.inl
@@ -0,0 +1,108 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ ACE_INLINE ::TAO_Root_POA &
+ Servant_Upcall::poa (void) const
+ {
+ return *this->poa_;
+ }
+
+ ACE_INLINE PortableServer::Servant
+ Servant_Upcall::servant (void) const
+ {
+ return this->servant_;
+ }
+
+ ACE_INLINE TAO_Object_Adapter &
+ Servant_Upcall::object_adapter (void) const
+ {
+ return *this->object_adapter_;
+ }
+
+ ACE_INLINE const PortableServer::ObjectId &
+ Servant_Upcall::id (void) const
+ {
+ return this->system_id_;
+ }
+
+ ACE_INLINE void
+ Servant_Upcall::user_id (
+ const PortableServer::ObjectId *id)
+ {
+ this->user_id_ = id;
+ }
+
+ ACE_INLINE const PortableServer::ObjectId &
+ Servant_Upcall::user_id (void) const
+ {
+ return *(this->user_id_);
+ }
+
+ #if (TAO_HAS_MINIMUM_POA == 0)
+
+ ACE_INLINE void*
+ Servant_Upcall::locator_cookie (void) const
+ {
+ return this->cookie_;
+ }
+
+ ACE_INLINE void
+ Servant_Upcall::locator_cookie (void* cookie)
+ {
+ this->cookie_ = cookie;
+ }
+
+ ACE_INLINE const char *
+ Servant_Upcall::operation (void) const
+ {
+ return this->operation_;
+ }
+
+ ACE_INLINE void
+ Servant_Upcall::operation (const char *name)
+ {
+ this->operation_ = name;
+ }
+
+ #endif /* TAO_HAS_MINIMUM_POA == 0 */
+
+ ACE_INLINE void
+ Servant_Upcall::active_object_map_entry (TAO_Active_Object_Map_Entry *entry)
+ {
+ this->active_object_map_entry_ = entry;
+ }
+
+ ACE_INLINE TAO_Active_Object_Map_Entry *
+ Servant_Upcall::active_object_map_entry (void) const
+ {
+ return this->active_object_map_entry_;
+ }
+
+ ACE_INLINE CORBA::Short
+ Servant_Upcall::priority (void) const
+ {
+ return this->current_context_.priority ();
+ }
+
+ ACE_INLINE Servant_Upcall::State
+ Servant_Upcall::state (void) const
+ {
+ return this->state_;
+ }
+
+ ACE_INLINE void
+ Servant_Upcall::state (Servant_Upcall::State state)
+ {
+ this->state_ = state;
+ }
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/Servant_var.cpp b/TAO/tao/PortableServer/Servant_var.cpp
new file mode 100755
index 00000000000..e5fca921aaa
--- /dev/null
+++ b/TAO/tao/PortableServer/Servant_var.cpp
@@ -0,0 +1,65 @@
+// $Id$
+
+#ifndef TAO_PORTABLESERVER_SERVANT_VAR_CPP
+#define TAO_PORTABLESERVER_SERVANT_VAR_CPP
+
+#include "tao/PortableServer/Servant_var.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/PortableServer/Servant_var.inl"
+#endif /* __ACE_INLINE__ */
+
+#include "tao/Exception.h"
+#include "tao/Environment.h"
+#include "ace/CORBA_macros.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template <class T>
+T *
+PortableServer::Servant_var<T>::_duplicate (T * p)
+{
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ if (p != 0)
+ {
+ p->_add_ref (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ }
+ ACE_CATCHALL
+ {
+ ACE_RE_THROW;
+ }
+ ACE_ENDTRY;
+ ACE_CHECK_RETURN (0);
+
+ return p;
+}
+
+template <class T>
+PortableServer::Servant_var<T>::~Servant_var (void) /* throw () */
+{
+ // Unfortunately, there is no throw spec on _remove_ref, so we
+ // can't assume that it will not throw. If it does, then we are in
+ // trouble. In any event, we can't let the exception escape our
+ // destructor.
+ ACE_TRY_NEW_ENV
+ {
+ if (this->ptr_ != 0)
+ {
+ this->ptr_->_remove_ref (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ }
+ ACE_CATCHALL
+ {
+ // Forget the exception..
+ }
+ ACE_ENDTRY;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_PORTABLESERVER_SERVANT_VAR_CPP */
diff --git a/TAO/tao/PortableServer/Servant_var.h b/TAO/tao/PortableServer/Servant_var.h
new file mode 100755
index 00000000000..94a7ada7655
--- /dev/null
+++ b/TAO/tao/PortableServer/Servant_var.h
@@ -0,0 +1,170 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Servant_var.h
+ *
+ * $Id$
+ *
+ * @author Jody Hagins <jody@atdesk.com>
+ * @author Carlos O'Ryan <coryan@atdesk.com>
+ */
+//=============================================================================
+
+#ifndef TAO_PORTABLESERVER_SERVANT_VAR_H
+#define TAO_PORTABLESERVER_SERVANT_VAR_H
+#include /**/ "ace/pre.h"
+#include "ace/config-all.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/orbconf.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace PortableServer
+{
+ /**
+ * @class Servant_var
+ *
+ * @brief Provides a type safe counted reference to servants.
+ *
+ * @author Jody Hagins
+ *
+ * @todo Life would be much easier if _add_ref() and _remove_ref() had
+ * throw specs of "throw ()", that can be hidden in static
+ * methods though.
+ */
+ template<class T>
+ class Servant_var
+ {
+ public:
+ typedef T servant_type;
+
+ /// Constructor. Assumes ownership of @c p.
+ explicit Servant_var (T * p = 0);
+
+ /// Copy constructor. Adds reference to @c rhs.
+ Servant_var (Servant_var<T> const & rhs);
+
+ /// Assignment operator. Adds reference to @c rhs.
+ Servant_var<T> & operator= (Servant_var<T> const & rhs);
+
+ /// Destructor. Removes a reference from the underlying object,
+ /// possibly destroying it.
+ /**
+ * This destructor doesn't throw exceptions.
+ */
+ ~Servant_var (void) /* throw () */;
+
+ /// Assignment operator. Assumes ownership of @c p.
+ Servant_var<T> & operator= (T * p);
+
+# if !defined(ACE_LACKS_MEMBER_TEMPLATES)
+ /// Template member constructor from a pointer that will implicitly
+ /// cast to type T. Assumes ownership of @c p.
+ /// This constructor allows constructs such as:
+ /// Servant_Base<Base> p(new Derived);
+ template <class Y>
+ Servant_var (Y * p);
+
+ /// Template member copy constructor from a Servant_var<Y>, where
+ /// Y can be implicitly cast to type T.
+ template <class Y>
+ Servant_var (Servant_var<Y> const & rhs);
+
+ /// Template member assignment operator from a Servant_var<Y>, where
+ /// Y can be implicitly cast to type T.
+ template <class Y>
+ Servant_var<T> & operator= (Servant_var<Y> const & rhs);
+
+ /// Template member assignment operator from a pointer to Y, where Y
+ /// can be implicitly cast to type T.
+ template <class Y>
+ Servant_var<T> & operator= (Y * p);
+# endif /* ACE_LACKS_MEMBER_TEMPLATES */
+
+ /// Smart pointer operator-> provides access to the underlying object.
+ T const * operator->() const;
+
+ /// Smart pointer operator-> provides access to the underlying object.
+ T * operator->();
+
+ /// Dereference the underlying object.
+ T const & operator*() const;
+
+ /// Dereference the underlying object.
+ T & operator*();
+
+ /// Return a void pointer to the underlying object. This allows
+ /// it to be used in conditional code and tested against 0.
+ operator void const * () const;
+
+ /// As an IN parameter.
+ T * in() const;
+
+ /// As an INOUT parameter.
+ T *& inout();
+
+ /// As an OUT parameter.
+ T *& out();
+
+ /// Return a pointer to the underlying object, and this counted
+ /// reference will no longer own the object.
+ T * _retn();
+
+ /// Increment the reference count and return the servant.
+ /**
+ * It is safe to pass in a null pointer, the pointer is simply
+ * returned in that case.
+ *
+ * @todo We might want to add a throw spec and catch all (potential)
+ * exceptions in _add_ref()
+ *
+ * @todo It might be useful to add a _release() method that handles
+ * any potential exceptions...
+ */
+ static T * _duplicate (T *);
+
+ /// Swap the contents of a Servant_var<T> with another
+ /// Servant_var<T>
+ /**
+ * Non-throwing swap operation.
+ * Often used to implement strong exception safety.
+ */
+ void swap (Servant_var<T> & rhs) /* throw () */;
+
+ private:
+ T * ptr_;
+ };
+
+ /// Compare two Servant_vars for equivalence.
+ template <class X, class Y>
+ bool operator==(Servant_var<X> const & x,
+ Servant_var<Y> const & y);
+
+ /// Compare two Servant_vars for non-equivalence.
+ template <class X, class Y>
+ bool operator!=(Servant_var<X> const & x,
+ Servant_var<Y> const & y);
+
+} // namespace PortableServer
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/PortableServer/Servant_var.inl"
+#endif /* __ACE_INLINE__ */
+
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+#include "tao/PortableServer/Servant_var.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
+#pragma implementation ("tao/PortableServer/Servant_var.cpp")
+#endif
+
+#include /**/ "ace/post.h"
+#endif /* TAO_PORTABLESERVER_SERVANT_VAR_H */
diff --git a/TAO/tao/PortableServer/Servant_var.inl b/TAO/tao/PortableServer/Servant_var.inl
new file mode 100755
index 00000000000..01434bf16ba
--- /dev/null
+++ b/TAO/tao/PortableServer/Servant_var.inl
@@ -0,0 +1,182 @@
+// -*- C++ -*-
+//
+// $Id$
+
+#include <algorithm>
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template <class T>
+ACE_INLINE void
+PortableServer::Servant_var<T>::swap (Servant_var<T> & rhs) /* throw () */
+{
+ std::swap (this->ptr_, rhs.ptr_);
+}
+
+template <class T>
+ACE_INLINE
+PortableServer::Servant_var<T>::Servant_var (T * p)
+ : ptr_ (p)
+{
+}
+
+// If _add_ref throws, this object will not be completely constructed
+// so the destructor will not be called.
+template <class T>
+ACE_INLINE
+PortableServer::Servant_var<T>::Servant_var (Servant_var<T> const & rhs)
+ : ptr_ (Servant_var<T>::_duplicate(rhs.ptr_))
+{
+}
+
+template <class T>
+ACE_INLINE PortableServer::Servant_var<T> &
+PortableServer::Servant_var<T>::operator= (Servant_var<T> const & rhs)
+{
+ PortableServer::Servant_var<T> tmp (rhs);
+ this->swap (tmp);
+ return *this;
+}
+
+template <class T>
+ACE_INLINE typename PortableServer::Servant_var<T> &
+PortableServer::Servant_var<T>::operator= (T * p)
+{
+ if (this->ptr_ != p)
+ {
+ // This constructor doesn't increase the reference count, nor is
+ // it a copy constructor, so we must check for self-assignment.
+ // Otherwise the reference count would be prematurely
+ // decremented upon exiting this scope.
+ PortableServer::Servant_var<T> tmp (p);
+ this->swap (tmp);
+ }
+
+ return *this;
+}
+
+#if !defined(ACE_LACKS_MEMBER_TEMPLATES)
+template <class T> template <class Y>
+ACE_INLINE
+PortableServer::Servant_var<T>::Servant_var (Y * p)
+ : ptr_ (p)
+{
+}
+
+template <class T> template <class Y>
+ACE_INLINE
+PortableServer::Servant_var<T>::Servant_var (Servant_var<Y> const & rhs)
+ : ptr_ (Servant_var<T>::_duplicate (rhs.in ()))
+{
+}
+
+template <class T> template <class Y>
+ACE_INLINE typename PortableServer::Servant_var<T> &
+PortableServer::Servant_var<T>::operator=(Servant_var<Y> const & rhs)
+{
+ PortableServer::Servant_var<T> tmp (rhs);
+ this->swap (tmp);
+ return *this;
+}
+
+template <class T> template <class Y>
+ACE_INLINE typename PortableServer::Servant_var<T> &
+PortableServer::Servant_var<T>::operator= (Y * p)
+{
+ if (this->ptr_ != p)
+ {
+ // This constructor doesn't increase the reference count, nor is
+ // it a copy constructor, so we must check for self-assignment.
+ // Otherwise the reference count would be prematurely
+ // decremented upon exiting this scope.
+ PortableServer::Servant_var<T> tmp (p);
+ this->swap (tmp);
+ }
+
+ return *this;
+}
+#endif /* ACE_LACKS_MEMBER_TEMPLATES */
+
+template <class T>
+ACE_INLINE T const *
+PortableServer::Servant_var<T>::operator->() const
+{
+ return this->ptr_;
+}
+
+template <class T>
+ACE_INLINE T *
+PortableServer::Servant_var<T>::operator->()
+{
+ return this->ptr_;
+}
+
+template <class T>
+ACE_INLINE T const &
+PortableServer::Servant_var<T>::operator*() const
+{
+ return *this->ptr_;
+}
+
+template <class T>
+ACE_INLINE T &
+PortableServer::Servant_var<T>::operator*()
+{
+ return *this->ptr_;
+}
+
+template <class T>
+ACE_INLINE PortableServer::Servant_var<T>::operator void const * () const
+{
+ return this->ptr_;
+}
+
+template <class T>
+ACE_INLINE T *
+PortableServer::Servant_var<T>::in (void) const
+{
+ return this->ptr_;
+}
+
+template <class T>
+ACE_INLINE T *&
+PortableServer::Servant_var<T>::inout (void)
+{
+ return this->ptr_;
+}
+
+template <class T>
+ACE_INLINE T *&
+PortableServer::Servant_var<T>::out (void)
+{
+ PortableServer::Servant_var<T> tmp;
+ this->swap (tmp);
+ return this->ptr_;
+}
+
+template <class T>
+ACE_INLINE T *
+PortableServer::Servant_var<T>::_retn (void)
+{
+ T * const rval = ptr_;
+ this->ptr_ = 0;
+ return rval;
+}
+
+template <class X, class Y>
+ACE_INLINE bool
+operator== (typename PortableServer::Servant_var<X> const & x,
+ typename PortableServer::Servant_var<Y> const & y)
+{
+ return x.in () == y.in ();
+}
+
+template <class X, class Y>
+ACE_INLINE bool
+operator!= (typename PortableServer::Servant_var<X> const & x,
+ typename PortableServer::Servant_var<Y> const & y)
+{
+ return x.in () != y.in ();
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/Special_Basic_SArgument_T.cpp b/TAO/tao/PortableServer/Special_Basic_SArgument_T.cpp
new file mode 100644
index 00000000000..52e00cb5110
--- /dev/null
+++ b/TAO/tao/PortableServer/Special_Basic_SArgument_T.cpp
@@ -0,0 +1,145 @@
+// $Id$
+
+#ifndef TAO_SPECIAL_BASIC_SARGUMENT_T_CPP
+#define TAO_SPECIAL_BASIC_SARGUMENT_T_CPP
+
+#include "tao/PortableServer/Special_Basic_SArgument_T.h"
+
+#if !defined (__ACE_INLINE__)
+#include "tao/PortableServer/Special_Basic_SArgument_T.inl"
+#endif /* __ACE_INLINE__ */
+
+
+// ============================================================
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template<typename S,
+ typename to_S,
+ typename from_S,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::In_Special_Basic_SArgument_T<S,to_S,from_S,Insert_Policy>::demarshal (
+ TAO_InputCDR & cdr
+ )
+{
+ return cdr >> to_S (this->x_);
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S,
+ typename to_S,
+ typename from_S,
+ class Insert_Policy>
+void
+TAO::In_Special_Basic_SArgument_T<S,to_S,from_S,Insert_Policy>::
+interceptor_value (CORBA::Any *any) const
+{
+ Insert_Policy::any_insert (any, from_S (this->x_));
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+// ===========================================================
+
+template<typename S,
+ typename to_S,
+ typename from_S,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::Inout_Special_Basic_SArgument_T<S,to_S,from_S,Insert_Policy>::marshal (
+ TAO_OutputCDR & cdr
+ )
+{
+ return cdr << from_S (this->x_);
+}
+
+template<typename S,
+ typename to_S,
+ typename from_S,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::Inout_Special_Basic_SArgument_T<S,to_S,from_S,Insert_Policy>::demarshal (
+ TAO_InputCDR & cdr
+ )
+{
+ return cdr >> to_S (this->x_);
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S,
+ typename to_S,
+ typename from_S,
+ class Insert_Policy>
+void
+TAO::Inout_Special_Basic_SArgument_T<S,to_S,from_S,Insert_Policy>::
+interceptor_value (CORBA::Any *any) const
+{
+ Insert_Policy::any_insert (any, from_S (this->x_));
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+// ==============================================================
+
+template<typename S,
+ typename to_S,
+ typename from_S,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::Out_Special_Basic_SArgument_T<S,to_S,from_S,Insert_Policy>::marshal (
+ TAO_OutputCDR & cdr
+ )
+{
+ return cdr << from_S (this->x_);
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S,
+ typename to_S,
+ typename from_S,
+ class Insert_Policy>
+void
+TAO::Out_Special_Basic_SArgument_T<S,to_S,from_S,Insert_Policy>::
+interceptor_value (CORBA::Any *any) const
+{
+ Insert_Policy::any_insert (any, from_S (this->x_));
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+// ==============================================================
+
+template<typename S,
+ typename to_S,
+ typename from_S,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::Ret_Special_Basic_SArgument_T<S,to_S,from_S,Insert_Policy>::marshal (
+ TAO_OutputCDR & cdr
+ )
+{
+ return cdr << from_S (this->x_);
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S,
+ typename to_S,
+ typename from_S,
+ class Insert_Policy>
+void
+TAO::Ret_Special_Basic_SArgument_T<S,to_S,from_S,Insert_Policy>::
+interceptor_value (CORBA::Any *any) const
+{
+ Insert_Policy::any_insert (any, from_S (this->x_));
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_SPECIAL_BASIC_SARGUMENT_T_CPP */
diff --git a/TAO/tao/PortableServer/Special_Basic_SArgument_T.h b/TAO/tao/PortableServer/Special_Basic_SArgument_T.h
new file mode 100644
index 00000000000..505fcd74c27
--- /dev/null
+++ b/TAO/tao/PortableServer/Special_Basic_SArgument_T.h
@@ -0,0 +1,177 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Special_Basic_SArgument_T.h
+ *
+ * $Id$
+ *
+ * @authors Jeff Parsons, Carlos O'Ryan and Ossama Othman
+ */
+//=============================================================================
+
+
+#ifndef TAO_SPECIAL_BASIC_SARGUMENT_T_H
+#define TAO_SPECIAL_BASIC_SARGUMENT_T_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Argument.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ /**
+ * @class In_Special_Basic_SArgument_T
+ *
+ * @brief Template class for IN skeleton argument of (w)char/boolean/octet.
+ *
+ */
+ template<typename S,
+ typename to_S,
+ typename from_S,
+ class Insert_Policy>
+ class In_Special_Basic_SArgument_T : public InArgument
+ {
+ public:
+ In_Special_Basic_SArgument_T (void);
+
+ virtual CORBA::Boolean demarshal (TAO_InputCDR &);
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ S const & arg (void) const;
+
+ private:
+ S x_;
+ };
+
+ /**
+ * @class Inout_Special_Basic_SArgument_T
+ *
+ * @brief Template class for INOUT (w)char/boolean/octet skeleton argument.
+ *
+ */
+ template<typename S,
+ typename to_S,
+ typename from_S,
+ class Insert_Policy>
+ class Inout_Special_Basic_SArgument_T : public InoutArgument
+ {
+ public:
+ Inout_Special_Basic_SArgument_T (void);
+
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+ virtual CORBA::Boolean demarshal (TAO_InputCDR &);
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ S & arg (void);
+
+ private:
+ S x_;
+ };
+
+ /**
+ * @class Out_Special_Basic_SArgument_T
+ *
+ * @brief Template class for OUT skeleton argument of (w)char/boolean/octet.
+ *
+ */
+ template<typename S,
+ typename to_S,
+ typename from_S,
+ class Insert_Policy>
+ class Out_Special_Basic_SArgument_T : public OutArgument
+ {
+ public:
+ Out_Special_Basic_SArgument_T (void);
+
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ S & arg (void);
+
+ private:
+ S x_;
+ };
+
+ /**
+ * @class Ret_Basic_SArgument_T
+ *
+ * @brief Template class for return skeleton value of (w)char/boolean/octet.
+ *
+ */
+ template<typename S,
+ typename to_S,
+ typename from_S,
+ class Insert_Policy>
+ class Ret_Special_Basic_SArgument_T : public RetArgument
+ {
+ public:
+ Ret_Special_Basic_SArgument_T (void);
+
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ S & arg (void);
+
+ private:
+ S x_;
+ };
+
+ /**
+ * @struct Special_Basic_SArg_Traits_T
+ *
+ * @brief Template class for skeleton argument traits
+ * of (w)char/boolean/octet.
+ *
+ */
+ template<typename T, typename to_T, typename from_T, class Insert_Policy>
+ struct Special_Basic_SArg_Traits_T
+ {
+ typedef T ret_type;
+ typedef T in_type;
+ typedef T & inout_type;
+ typedef T & out_type;
+
+ typedef In_Special_Basic_SArgument_T<T,to_T,from_T,Insert_Policy> in_arg_val;
+ typedef Inout_Special_Basic_SArgument_T<T,to_T,from_T,Insert_Policy> inout_arg_val;
+ typedef Out_Special_Basic_SArgument_T<T,to_T,from_T,Insert_Policy> out_arg_val;
+ typedef Ret_Special_Basic_SArgument_T<T,to_T,from_T,Insert_Policy> ret_val;
+
+ // Typedefs corresponding to return value of arg() method in both
+ // the client and server side argument class templates.
+ typedef T const & in_arg_type;
+ typedef inout_type inout_arg_type;
+ typedef out_type out_arg_type;
+ typedef out_type ret_arg_type;
+
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+#include "tao/PortableServer/Special_Basic_SArgument_T.inl"
+#endif /* __ACE_INLINE__ */
+
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+#include "tao/PortableServer/Special_Basic_SArgument_T.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
+#pragma implementation ("Special_Basic_SArgument_T.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_SPECIAL_BASIC_SARGUMENT_T_H */
diff --git a/TAO/tao/PortableServer/Special_Basic_SArgument_T.inl b/TAO/tao/PortableServer/Special_Basic_SArgument_T.inl
new file mode 100644
index 00000000000..a6f4dd1a499
--- /dev/null
+++ b/TAO/tao/PortableServer/Special_Basic_SArgument_T.inl
@@ -0,0 +1,96 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template<typename S,
+ typename to_S,
+ typename from_S,
+ class Insert_Policy>
+ACE_INLINE
+TAO::In_Special_Basic_SArgument_T<S,to_S,from_S,Insert_Policy>::
+In_Special_Basic_SArgument_T (void)
+{
+}
+
+template<typename S,
+ typename to_S,
+ typename from_S,
+ class Insert_Policy>
+ACE_INLINE
+S const &
+TAO::In_Special_Basic_SArgument_T<S,to_S,from_S,Insert_Policy>::arg (void) const
+{
+ return this->x_;
+}
+
+// ===========================================================================
+
+template<typename S,
+ typename to_S,
+ typename from_S,
+ class Insert_Policy>
+ACE_INLINE
+TAO::Inout_Special_Basic_SArgument_T<S,to_S,from_S,Insert_Policy>::
+Inout_Special_Basic_SArgument_T (void)
+{
+}
+
+template<typename S,
+ typename to_S,
+ typename from_S,
+ class Insert_Policy>
+ACE_INLINE
+S &
+TAO::Inout_Special_Basic_SArgument_T<S,to_S,from_S,Insert_Policy>::arg (void)
+{
+ return this->x_;
+}
+
+// ===========================================================================
+
+template<typename S,
+ typename to_S,
+ typename from_S,
+ class Insert_Policy>
+ACE_INLINE
+TAO::Out_Special_Basic_SArgument_T<S,to_S,from_S,Insert_Policy>::
+Out_Special_Basic_SArgument_T (void)
+{
+}
+
+template<typename S,
+ typename to_S,
+ typename from_S,
+ class Insert_Policy>
+S &
+TAO::Out_Special_Basic_SArgument_T<S,to_S,from_S,Insert_Policy>::arg (void)
+{
+ return this->x_;
+}
+
+// ===========================================================================
+
+template<typename S,
+ typename to_S,
+ typename from_S,
+ class Insert_Policy>
+ACE_INLINE
+TAO::Ret_Special_Basic_SArgument_T<S,to_S,from_S,Insert_Policy>::
+Ret_Special_Basic_SArgument_T (void)
+{
+}
+
+template<typename S,
+ typename to_S,
+ typename from_S,
+ class Insert_Policy>
+ACE_INLINE
+S &
+TAO::Ret_Special_Basic_SArgument_T<S,to_S,from_S,Insert_Policy>::arg (void)
+{
+ return this->x_;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/Special_Basic_SArguments.h b/TAO/tao/PortableServer/Special_Basic_SArguments.h
new file mode 100644
index 00000000000..f306336fe83
--- /dev/null
+++ b/TAO/tao/PortableServer/Special_Basic_SArguments.h
@@ -0,0 +1,83 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Special_Basic_SArguments.h
+ *
+ * $Id$
+ *
+ * @author Jeff Parsons
+ * @author Carlos O'Ryan
+ */
+//=============================================================================
+
+
+#ifndef TAO_SPECIAL_BASIC_SARGUMENTS_H
+#define TAO_SPECIAL_BASIC_SARGUMENTS_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/Special_Basic_SArgument_T.h"
+#include "tao/PortableServer/SArg_Traits_T.h"
+
+#include "ace/CDR_Stream.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ /**
+ *
+ * @brief Specializations for (w)char, octet and boolean.
+ *
+ */
+
+ template<>
+ class TAO_PortableServer_Export SArg_Traits<ACE_InputCDR::to_char>
+ : public Special_Basic_SArg_Traits_T<CORBA::Char,
+ ACE_InputCDR::to_char,
+ ACE_OutputCDR::from_char,
+ TAO::Any_Insert_Policy_Stream <ACE_OutputCDR::from_char> >
+ {
+ };
+
+ template<>
+ class TAO_PortableServer_Export SArg_Traits<ACE_InputCDR::to_wchar>
+ : public Special_Basic_SArg_Traits_T<CORBA::WChar,
+ ACE_InputCDR::to_wchar,
+ ACE_OutputCDR::from_wchar,
+ TAO::Any_Insert_Policy_Stream <ACE_OutputCDR::from_wchar> >
+ {
+ };
+
+ template<>
+ class TAO_PortableServer_Export SArg_Traits<ACE_InputCDR::to_octet>
+ : public Special_Basic_SArg_Traits_T<CORBA::Octet,
+ ACE_InputCDR::to_octet,
+ ACE_OutputCDR::from_octet,
+ TAO::Any_Insert_Policy_Stream <ACE_OutputCDR::from_octet> >
+ {
+ };
+
+ template<>
+ class TAO_PortableServer_Export SArg_Traits<ACE_InputCDR::to_boolean>
+ : public Special_Basic_SArg_Traits_T<CORBA::Boolean,
+ ACE_InputCDR::to_boolean,
+ ACE_OutputCDR::from_boolean,
+ TAO::Any_Insert_Policy_Stream <ACE_OutputCDR::from_boolean> >
+
+ {
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_SPECIAL_BASIC_SARGUMENTS_H */
diff --git a/TAO/tao/PortableServer/StrategyFactory.cpp b/TAO/tao/PortableServer/StrategyFactory.cpp
new file mode 100644
index 00000000000..58a4bc04c11
--- /dev/null
+++ b/TAO/tao/PortableServer/StrategyFactory.cpp
@@ -0,0 +1,22 @@
+// $Id$
+
+#include "tao/PortableServer/StrategyFactory.h"
+#include "ace/Dynamic_Service.h"
+
+ACE_RCSID (PortableServer,
+ StrategyFactory,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ StrategyFactory::~StrategyFactory (void)
+ {
+ }
+ } /* namespace Portable_Server */
+} /* namespace TAO */
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/StrategyFactory.h b/TAO/tao/PortableServer/StrategyFactory.h
new file mode 100644
index 00000000000..b441256d214
--- /dev/null
+++ b/TAO/tao/PortableServer/StrategyFactory.h
@@ -0,0 +1,45 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file StrategyFactory.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_PORTABLESERVER_STRATEGYFACTORY_H
+#define TAO_PORTABLESERVER_STRATEGYFACTORY_H
+
+#include /**/ "ace/pre.h"
+
+#include "ace/Service_Object.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/orbconf.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ class StrategyFactory
+ : public ACE_Service_Object
+ {
+ public:
+ virtual ~StrategyFactory (void);
+ };
+ } /* namespace Portable_Server */
+} /* namespace TAO */
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_PORTABLESERVER_STRATEGYFACTORY_H */
diff --git a/TAO/tao/PortableServer/TAO_PortableServer.pc.in b/TAO/tao/PortableServer/TAO_PortableServer.pc.in
new file mode 100644
index 00000000000..47b7b8b4e46
--- /dev/null
+++ b/TAO/tao/PortableServer/TAO_PortableServer.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: TAO_PortableServer
+Description: TAO PortableServer Library
+Requires: TAO_AnyTypeCode, TAO
+Version: @VERSION@
+Libs: -L${libdir} -lTAO_PortableServer
+Cflags: -I${includedir}
diff --git a/TAO/tao/PortableServer/TAO_PortableServer.rc b/TAO/tao/PortableServer/TAO_PortableServer.rc
new file mode 100644
index 00000000000..f16419968f5
--- /dev/null
+++ b/TAO/tao/PortableServer/TAO_PortableServer.rc
@@ -0,0 +1,30 @@
+#include "..\Version.h"
+
+1 VERSIONINFO
+ FILEVERSION TAO_MAJOR_VERSION,TAO_MINOR_VERSION,TAO_BETA_VERSION,0
+ PRODUCTVERSION TAO_MAJOR_VERSION,TAO_MINOR_VERSION,TAO_BETA_VERSION,0
+ FILEFLAGSMASK 0x3fL
+ FILEFLAGS 0x0L
+ FILEOS 0x4L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904B0"
+ BEGIN
+ VALUE "FileDescription", "PortableServer\0"
+ VALUE "FileVersion", TAO_VERSION "\0"
+ VALUE "InternalName", "TAO_PortableServerDLL\0"
+ VALUE "LegalCopyright", "\0"
+ VALUE "LegalTrademarks", "\0"
+ VALUE "OriginalFilename", "TAO_PortableServer.DLL\0"
+ VALUE "ProductName", "TAO\0"
+ VALUE "ProductVersion", TAO_VERSION "\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
diff --git a/TAO/tao/PortableServer/ThreadPolicy.cpp b/TAO/tao/PortableServer/ThreadPolicy.cpp
new file mode 100644
index 00000000000..747e4b42ef3
--- /dev/null
+++ b/TAO/tao/PortableServer/ThreadPolicy.cpp
@@ -0,0 +1,70 @@
+#include "tao/PortableServer/ThreadPolicy.h"
+#include "tao/PortableServer/PortableServer.h"
+
+ACE_RCSID (PortableServer,
+ ThreadPolicy,
+ "$Id$")
+
+#if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ ThreadPolicy::ThreadPolicy (::PortableServer::ThreadPolicyValue value)
+ : value_ (value)
+ {
+ }
+
+ CORBA::Policy_ptr
+ ThreadPolicy::copy (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ ThreadPolicy *copy = 0;
+ ACE_NEW_THROW_EX (copy,
+ ThreadPolicy (this->value_),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+
+ return copy;
+ }
+
+ void
+ ThreadPolicy::destroy (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ }
+
+ ::PortableServer::ThreadPolicyValue
+ ThreadPolicy::value (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ return value_;
+ }
+
+ CORBA::PolicyType
+ ThreadPolicy::policy_type (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ return ::PortableServer::THREAD_POLICY_ID;
+ }
+
+ TAO_Cached_Policy_Type
+ ThreadPolicy::_tao_cached_type (void) const
+ {
+ return TAO_CACHED_POLICY_THREAD;
+ }
+
+ TAO_Policy_Scope
+ ThreadPolicy::_tao_scope (void) const
+ {
+ return TAO_POLICY_POA_SCOPE;
+ }
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_MINIMUM_POA == 0 */
diff --git a/TAO/tao/PortableServer/ThreadPolicy.h b/TAO/tao/PortableServer/ThreadPolicy.h
new file mode 100644
index 00000000000..5159fc646be
--- /dev/null
+++ b/TAO/tao/PortableServer/ThreadPolicy.h
@@ -0,0 +1,81 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file ThreadPolicy.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_PORTABLESERVER_THREADPOLICY_H
+#define TAO_PORTABLESERVER_THREADPOLICY_H
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/ThreadPolicyC.h"
+#include "tao/LocalObject.h"
+
+// This is to remove "inherits via dominance" warnings from MSVC.
+// MSVC is being a little too paranoid.
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+#if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ class TAO_PortableServer_Export ThreadPolicy
+ : public virtual ::PortableServer::ThreadPolicy,
+ public virtual TAO_Local_RefCounted_Object
+ {
+ public:
+ ThreadPolicy (::PortableServer::ThreadPolicyValue value);
+
+ CORBA::Policy_ptr copy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ void destroy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ ::PortableServer::ThreadPolicyValue value (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ CORBA::PolicyType policy_type (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Return the cached policy type for this policy.
+ TAO_Cached_Policy_Type _tao_cached_type (void) const;
+
+ /// Returns the scope at which this policy can be applied. See orbconf.h.
+ TAO_Policy_Scope _tao_scope (void) const;
+
+ private:
+ ::PortableServer::ThreadPolicyValue value_;
+ };
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_MINIMUM_POA == 0 */
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_PORTABLESERVER_THREADPOLICY_H */
diff --git a/TAO/tao/PortableServer/ThreadPolicy.pidl b/TAO/tao/PortableServer/ThreadPolicy.pidl
new file mode 100644
index 00000000000..253a7b8dcbb
--- /dev/null
+++ b/TAO/tao/PortableServer/ThreadPolicy.pidl
@@ -0,0 +1,44 @@
+/**
+ * @file ThreadPolicy.pidl
+ *
+ * $Id$
+ *
+ * @brief Pre-compiled IDL source for the PortableServer module.
+ *
+ * tao_idl.exe \
+ * -o orig -Gp -Gd -Ge 1 -Sci -GA -I$(TAO_ROOT)
+ * -Wb,export_macro=TAO_PortableServer_Export \
+ * -Wb,export_include="portableserver_export.h" \
+ * -Wb,pre_include="ace/pre.h" \
+ * -Wb,post_include="ace/post.h" \
+ * ThreadPolicy.pidl
+ */
+
+#ifndef _PORTABLESERVER_THREAD_POLICY_IDL_
+#define _PORTABLESERVER_THREAD_POLICY_IDL_
+
+#include "tao/Policy.pidl"
+
+#pragma prefix "omg.org"
+
+module PortableServer
+{
+# pragma version PortableServer 2.3
+
+ enum ThreadPolicyValue
+ {
+ ORB_CTRL_MODEL,
+ SINGLE_THREAD_MODEL
+/* ,MAIN_THREAD_MODEL*/
+ };
+
+#if !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO) && !defined (TAO_HAS_MINIMUM_POA)
+ local interface ThreadPolicy : CORBA::Policy
+ {
+ readonly attribute ThreadPolicyValue value;
+ };
+#endif
+
+};
+
+#endif // _PORTABLESERVER_THREAD_POLICY_IDL_
diff --git a/TAO/tao/PortableServer/ThreadStrategy.cpp b/TAO/tao/PortableServer/ThreadStrategy.cpp
new file mode 100644
index 00000000000..c3d6a446a4a
--- /dev/null
+++ b/TAO/tao/PortableServer/ThreadStrategy.cpp
@@ -0,0 +1,28 @@
+// $Id$
+
+#include "tao/PortableServer/ThreadStrategy.h"
+
+ACE_RCSID (PortableServer,
+ ThreadStrategy,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ void
+ ThreadStrategy::strategy_init (TAO_Root_POA * /*poa*/
+ ACE_ENV_ARG_DECL_NOT_USED)
+ {
+ }
+
+ void
+ ThreadStrategy::strategy_cleanup(ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ {
+ }
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/ThreadStrategy.h b/TAO/tao/PortableServer/ThreadStrategy.h
new file mode 100644
index 00000000000..622ad7d3748
--- /dev/null
+++ b/TAO/tao/PortableServer/ThreadStrategy.h
@@ -0,0 +1,52 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file ThreadStrategy.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_THREAD_STRATEGY_H
+#define TAO_THREAD_STRATEGY_H
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/Policy_Strategy.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/ThreadPolicyC.h"
+#include "tao/orbconf.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ class ThreadStrategy
+ : public Policy_Strategy
+ {
+ public:
+ virtual int enter () = 0;
+
+ virtual int exit () = 0;
+
+ virtual void strategy_init (TAO_Root_POA *poa ACE_ENV_ARG_DECL);
+
+ virtual void strategy_cleanup(ACE_ENV_SINGLE_ARG_DECL);
+
+ virtual ::PortableServer::ThreadPolicyValue type() const = 0;
+ };
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_THREAD_STRATEGY_H */
diff --git a/TAO/tao/PortableServer/ThreadStrategyFactory.h b/TAO/tao/PortableServer/ThreadStrategyFactory.h
new file mode 100644
index 00000000000..a22078ed773
--- /dev/null
+++ b/TAO/tao/PortableServer/ThreadStrategyFactory.h
@@ -0,0 +1,54 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file ThreadStrategyFactory.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_PORTABLESERVER_THREADPOLICYSTRATEGYFACTORY_H
+#define TAO_PORTABLESERVER_THREADPOLICYSTRATEGYFACTORY_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/StrategyFactory.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/ThreadPolicyC.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ class ThreadStrategy;
+
+ class ThreadStrategyFactory
+ : public StrategyFactory
+ {
+ public:
+ /// Create a new servant retention strategy
+ virtual ThreadStrategy *create (
+ ::PortableServer::ThreadPolicyValue value) = 0;
+
+ /// Cleanup the given strategy instance
+ virtual void destroy (
+ ThreadStrategy *strategy
+ ACE_ENV_ARG_DECL) = 0;
+ };
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_PORTABLESERVER_THREADPOLICYSTRATEGYFACTORY_H */
diff --git a/TAO/tao/PortableServer/ThreadStrategyFactoryImpl.cpp b/TAO/tao/PortableServer/ThreadStrategyFactoryImpl.cpp
new file mode 100644
index 00000000000..b21116e42b1
--- /dev/null
+++ b/TAO/tao/PortableServer/ThreadStrategyFactoryImpl.cpp
@@ -0,0 +1,102 @@
+// $Id$
+
+#include "tao/PortableServer/ThreadStrategyFactoryImpl.h"
+#include "tao/PortableServer/ThreadStrategy.h"
+#include "ace/Dynamic_Service.h"
+#include "ace/Log_Msg.h"
+
+ACE_RCSID (PortableServer,
+ ThreadStrategyFactoryImpl,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ ThreadStrategy*
+ ThreadStrategyFactoryImpl::create (
+ ::PortableServer::ThreadPolicyValue value)
+ {
+ ThreadStrategy* strategy = 0;
+
+ switch (value)
+ {
+ case ::PortableServer::SINGLE_THREAD_MODEL :
+ {
+ ThreadStrategyFactory *strategy_factory =
+ ACE_Dynamic_Service<ThreadStrategyFactory>::instance ("ThreadStrategySingleFactory");
+
+ if (strategy_factory != 0)
+ strategy = strategy_factory->create (value);
+ else
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) %p\n"),
+ ACE_TEXT ("ERROR, Unable to get ")
+ ACE_TEXT ("ThreadStrategySingleFactory")));
+
+ break;
+ }
+ case ::PortableServer::ORB_CTRL_MODEL :
+ {
+ strategy =
+ ACE_Dynamic_Service<ThreadStrategy>::instance ("ThreadStrategyORBControl");
+
+ if (strategy == 0)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) %p\n"),
+ ACE_TEXT ("ERROR, Unable to get ")
+ ACE_TEXT ("ThreadStrategyORBControl")));
+
+ break;
+ }
+ }
+
+ return strategy;
+ }
+
+ void
+ ThreadStrategyFactoryImpl::destroy (
+ ThreadStrategy *strategy
+ ACE_ENV_ARG_DECL)
+ {
+ switch (strategy->type ())
+ {
+ case ::PortableServer::SINGLE_THREAD_MODEL :
+ {
+ ThreadStrategyFactory *strategy_factory =
+ ACE_Dynamic_Service<ThreadStrategyFactory>::instance ("ThreadStrategySingleFactory");
+
+ if (strategy_factory != 0)
+ {
+ strategy_factory->destroy (strategy ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ break;
+ }
+ case ::PortableServer::ORB_CTRL_MODEL :
+ {
+ // Noop
+ break;
+ }
+ }
+ }
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DEFINE (
+ ThreadStrategyFactoryImpl,
+ ACE_TEXT ("ThreadStrategyFactory"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (ThreadStrategyFactoryImpl),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0)
+
+ACE_FACTORY_NAMESPACE_DEFINE (
+ ACE_Local_Service,
+ ThreadStrategyFactoryImpl,
+ TAO::Portable_Server::ThreadStrategyFactoryImpl)
+
diff --git a/TAO/tao/PortableServer/ThreadStrategyFactoryImpl.h b/TAO/tao/PortableServer/ThreadStrategyFactoryImpl.h
new file mode 100644
index 00000000000..cfe8b44147c
--- /dev/null
+++ b/TAO/tao/PortableServer/ThreadStrategyFactoryImpl.h
@@ -0,0 +1,53 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file ThreadStrategyFactoryImpl.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_PORTABLESERVER_THREADPOLICYSTRATEGYFACTORYIMPL_H
+#define TAO_PORTABLESERVER_THREADPOLICYSTRATEGYFACTORYIMPL_H
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/Service_Config.h"
+#include "tao/PortableServer/ThreadStrategyFactory.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ class TAO_PortableServer_Export ThreadStrategyFactoryImpl
+ : public ThreadStrategyFactory
+ {
+ public:
+ /// Create a new servant retention strategy
+ virtual ThreadStrategy* create (
+ ::PortableServer::ThreadPolicyValue value);
+
+ virtual void destroy (
+ ThreadStrategy *strategy
+ ACE_ENV_ARG_DECL);
+ };
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE_EXPORT (TAO_PortableServer, ThreadStrategyFactoryImpl)
+ACE_FACTORY_DECLARE (TAO_PortableServer, ThreadStrategyFactoryImpl)
+
+#include /**/ "ace/post.h"
+#endif /* TAO_PORTABLESERVER_THREADPOLICYSTRATEGYFACTORYIMPL_H */
diff --git a/TAO/tao/PortableServer/ThreadStrategyORBControl.cpp b/TAO/tao/PortableServer/ThreadStrategyORBControl.cpp
new file mode 100644
index 00000000000..44edaa4b6a9
--- /dev/null
+++ b/TAO/tao/PortableServer/ThreadStrategyORBControl.cpp
@@ -0,0 +1,50 @@
+// $Id$
+
+#include "tao/PortableServer/ThreadStrategyORBControl.h"
+#include "ace/Log_Msg.h"
+
+ACE_RCSID (PortableServer,
+ ThreadStrategyORBControl,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ int
+ ThreadStrategyORBControl::enter ()
+ {
+ return 0;
+ }
+
+ int
+ ThreadStrategyORBControl::exit ()
+ {
+ return 0;
+ }
+
+ ::PortableServer::ThreadPolicyValue
+ ThreadStrategyORBControl::type() const
+ {
+ return ::PortableServer::ORB_CTRL_MODEL;
+ }
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+
+ACE_FACTORY_NAMESPACE_DEFINE (
+ ACE_Local_Service,
+ ThreadStrategyORBControl,
+ TAO::Portable_Server::ThreadStrategyORBControl)
+
+ACE_STATIC_SVC_DEFINE (
+ ThreadStrategyORBControl,
+ ACE_TEXT ("ThreadStrategyORBControl"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (ThreadStrategyORBControl),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0)
diff --git a/TAO/tao/PortableServer/ThreadStrategyORBControl.h b/TAO/tao/PortableServer/ThreadStrategyORBControl.h
new file mode 100644
index 00000000000..d88997c2214
--- /dev/null
+++ b/TAO/tao/PortableServer/ThreadStrategyORBControl.h
@@ -0,0 +1,54 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file ThreadStrategyORBControl.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_THREADSTRATEGYORBCONTROL_H
+#define TAO_THREADSTRATEGYORBCONTROL_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/ThreadStrategy.h"
+#include "tao/orbconf.h"
+#include "ace/Service_Config.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ class ThreadStrategyORBControl
+ : public ThreadStrategy
+ {
+ public:
+ virtual int enter ();
+
+ virtual int exit ();
+
+ virtual ::PortableServer::ThreadPolicyValue type() const;
+ };
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE_EXPORT (TAO_PortableServer, ThreadStrategyORBControl)
+ACE_FACTORY_DECLARE (TAO_PortableServer, ThreadStrategyORBControl)
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_THREADSTRATEGYORBCONTROL_H */
diff --git a/TAO/tao/PortableServer/ThreadStrategySingle.cpp b/TAO/tao/PortableServer/ThreadStrategySingle.cpp
new file mode 100644
index 00000000000..2a903d2876b
--- /dev/null
+++ b/TAO/tao/PortableServer/ThreadStrategySingle.cpp
@@ -0,0 +1,54 @@
+// $Id$
+
+#include "tao/PortableServer/ThreadStrategySingle.h"
+#include "ace/Dynamic_Service.h"
+#include "ace/Log_Msg.h"
+
+ACE_RCSID (PortableServer,
+ ThreadStrategySingle,
+ "$Id$")
+
+#if (TAO_HAS_MINIMUM_POA == 0)
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ int
+ ThreadStrategySingle::enter ()
+ {
+ return lock_.acquire();
+ }
+
+ int
+ ThreadStrategySingle::exit ()
+ {
+ return lock_.release();
+ }
+
+ ::PortableServer::ThreadPolicyValue
+ ThreadStrategySingle::type() const
+ {
+ return ::PortableServer::SINGLE_THREAD_MODEL;
+ }
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_FACTORY_NAMESPACE_DEFINE (
+ ACE_Local_Service,
+ ThreadStrategySingle,
+ TAO::Portable_Server::ThreadStrategySingle)
+
+ACE_STATIC_SVC_DEFINE (
+ ThreadStrategySingle,
+ ACE_TEXT ("ThreadStrategySingle"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (ThreadStrategySingle),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0)
+
+#endif /* TAO_HAS_MINIMUM_POA == 0 */
diff --git a/TAO/tao/PortableServer/ThreadStrategySingle.h b/TAO/tao/PortableServer/ThreadStrategySingle.h
new file mode 100644
index 00000000000..0836472a09e
--- /dev/null
+++ b/TAO/tao/PortableServer/ThreadStrategySingle.h
@@ -0,0 +1,67 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file ThreadStrategySingle.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_THREADSTRATEGYSINGLE_H
+#define TAO_THREADSTRATEGYSINGLE_H
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/ThreadStrategy.h"
+
+#include "tao/orbconf.h"
+
+#include "ace/Service_Config.h"
+
+// Locking
+#include "ace/Synch_Traits.h"
+#include "ace/Thread_Mutex.h"
+#include "ace/Recursive_Thread_Mutex.h"
+#include "ace/Null_Mutex.h"
+
+
+#if (TAO_HAS_MINIMUM_POA == 0)
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ class TAO_PortableServer_Export ThreadStrategySingle :
+ public ThreadStrategy
+ {
+ public:
+ virtual int enter ();
+
+ virtual int exit ();
+
+ virtual ::PortableServer::ThreadPolicyValue type() const;
+ private:
+ TAO_SYNCH_RECURSIVE_MUTEX lock_;
+ };
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE_EXPORT (TAO_PortableServer, ThreadStrategySingle)
+ACE_FACTORY_DECLARE (TAO_PortableServer, ThreadStrategySingle)
+
+#endif /* TAO_HAS_MINIMUM_POA == 0 */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_THREADSTRATEGYSINGLE_H */
diff --git a/TAO/tao/PortableServer/ThreadStrategySingleFactoryImpl.cpp b/TAO/tao/PortableServer/ThreadStrategySingleFactoryImpl.cpp
new file mode 100644
index 00000000000..b718ea02ef2
--- /dev/null
+++ b/TAO/tao/PortableServer/ThreadStrategySingleFactoryImpl.cpp
@@ -0,0 +1,72 @@
+// $Id$
+
+#include "tao/PortableServer/ThreadStrategySingleFactoryImpl.h"
+#include "tao/PortableServer/ThreadStrategy.h"
+#include "tao/PortableServer/ThreadStrategySingle.h"
+#include "ace/Dynamic_Service.h"
+#include "ace/Log_Msg.h"
+
+ACE_RCSID (PortableServer,
+ ThreadStrategyFactoryImpl,
+ "$Id$")
+
+#if (TAO_HAS_MINIMUM_POA == 0)
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ ThreadStrategy*
+ ThreadStrategySingleFactoryImpl::create (
+ ::PortableServer::ThreadPolicyValue value)
+ {
+ ThreadStrategy* strategy = 0;
+
+ switch (value)
+ {
+ case ::PortableServer::SINGLE_THREAD_MODEL :
+ {
+ ACE_NEW_RETURN (strategy, ThreadStrategySingle, 0);
+ break;
+ }
+ case ::PortableServer::ORB_CTRL_MODEL :
+ {
+ ACE_ERROR ((LM_ERROR, "Incorrect type in ThreadStrategySingleFactoryImpl"));
+ break;
+ }
+ }
+
+ return strategy;
+ }
+
+ void
+ ThreadStrategySingleFactoryImpl::destroy (
+ ThreadStrategy *strategy
+ ACE_ENV_ARG_DECL)
+ {
+ strategy->strategy_cleanup (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ delete strategy;
+ }
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DEFINE (
+ ThreadStrategySingleFactoryImpl,
+ ACE_TEXT ("ThreadStrategySingleFactory"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (ThreadStrategySingleFactoryImpl),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0)
+
+ACE_FACTORY_NAMESPACE_DEFINE (
+ ACE_Local_Service,
+ ThreadStrategySingleFactoryImpl,
+ TAO::Portable_Server::ThreadStrategySingleFactoryImpl)
+
+#endif /* TAO_HAS_MINIMUM_POA == 0 */
diff --git a/TAO/tao/PortableServer/ThreadStrategySingleFactoryImpl.h b/TAO/tao/PortableServer/ThreadStrategySingleFactoryImpl.h
new file mode 100644
index 00000000000..e04f0995a42
--- /dev/null
+++ b/TAO/tao/PortableServer/ThreadStrategySingleFactoryImpl.h
@@ -0,0 +1,57 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file ThreadStrategySingleFactoryImpl.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_PORTABLESERVER_THREADPOLICYSINGLESTRATEGYFACTORYIMPL_H
+#define TAO_PORTABLESERVER_THREADPOLICYSINGLESTRATEGYFACTORYIMPL_H
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/Service_Config.h"
+#include "tao/PortableServer/ThreadStrategyFactory.h"
+
+#if (TAO_HAS_MINIMUM_POA == 0)
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ class ThreadStrategySingleFactoryImpl
+ : public ThreadStrategyFactory
+ {
+ public:
+ /// Create a new thread strategy
+ virtual ThreadStrategy* create (
+ ::PortableServer::ThreadPolicyValue value);
+
+ virtual void destroy (
+ ThreadStrategy *strategy
+ ACE_ENV_ARG_DECL);
+ };
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE_EXPORT (TAO_PortableServer, ThreadStrategySingleFactoryImpl)
+ACE_FACTORY_DECLARE (TAO_PortableServer, ThreadStrategySingleFactoryImpl)
+
+#endif /* TAO_HAS_MINIMUM_POA == 0 */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_PORTABLESERVER_THREADPOLICYSINGLESTRATEGYFACTORYIMPL_H*/
diff --git a/TAO/tao/PortableServer/TypeCode_SArg_Traits.h b/TAO/tao/PortableServer/TypeCode_SArg_Traits.h
new file mode 100644
index 00000000000..5bfc9b5a7dd
--- /dev/null
+++ b/TAO/tao/PortableServer/TypeCode_SArg_Traits.h
@@ -0,0 +1,61 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file TypeCode_SArg_Traits.h
+ *
+ * $Id$
+ *
+ * @author Ossama Othman
+ */
+//=============================================================================
+
+#ifndef TAO_TYPECODE_SARG_TRAITS_H
+#define TAO_TYPECODE_SARG_TRAITS_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/CORBA_methods.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/Object_SArgument_T.h"
+#include "tao/Pseudo_VarOut_T.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace CORBA
+{
+ class TypeCode;
+ typedef TypeCode *TypeCode_ptr;
+
+ typedef TAO_Pseudo_Var_T<TypeCode> TypeCode_var;
+ typedef TAO_Pseudo_Out_T<TypeCode> TypeCode_out;
+}
+
+// --------------------------------------------------------------
+
+namespace TAO
+{
+ template <typename T> class SArg_Traits;
+
+ /// Used in generated code if CORBA::TypeCode is an argument or
+ /// return type.
+ template<>
+ class TAO_PortableServer_Export SArg_Traits<CORBA::TypeCode>
+ : public Object_SArg_Traits_T<CORBA::TypeCode_ptr,
+ CORBA::TypeCode_var,
+ CORBA::TypeCode_out,
+ TAO::Any_Insert_Policy_Stream <CORBA::TypeCode_ptr>
+ >
+ {
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_TYPECODE_SARG_TRAITS_H */
diff --git a/TAO/tao/PortableServer/UB_String_SArgument_T.cpp b/TAO/tao/PortableServer/UB_String_SArgument_T.cpp
new file mode 100644
index 00000000000..7f8db0408f5
--- /dev/null
+++ b/TAO/tao/PortableServer/UB_String_SArgument_T.cpp
@@ -0,0 +1,105 @@
+// $Id$
+
+#ifndef TAO_UB_STRING_SARGUMENT_T_CPP
+#define TAO_UB_STRING_SARGUMENT_T_CPP
+
+#include "tao/PortableServer/UB_String_SArgument_T.h"
+
+#if !defined (__ACE_INLINE__)
+#include "tao/PortableServer/UB_String_SArgument_T.inl"
+#endif /* __ACE_INLINE__ */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template<typename S, typename S_var>
+CORBA::Boolean
+TAO::In_UB_String_SArgument_T<S,S_var>::demarshal (TAO_InputCDR &cdr)
+{
+ return cdr >> this->x_.out ();
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S, typename S_var>
+void
+TAO::In_UB_String_SArgument_T<S,S_var>::interceptor_value (
+ CORBA::Any *any) const
+{
+ (*any) <<= this->x_.in ();
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+// ===========================================================
+
+template<typename S, typename S_var>
+CORBA::Boolean
+TAO::Inout_UB_String_SArgument_T<S,S_var>::marshal (TAO_OutputCDR &cdr)
+{
+ return cdr << this->x_.in ();
+}
+
+template<typename S, typename S_var>
+CORBA::Boolean
+TAO::Inout_UB_String_SArgument_T<S,S_var>::demarshal (TAO_InputCDR & cdr)
+{
+ return cdr >> this->x_.out ();
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S, typename S_var>
+void
+TAO::Inout_UB_String_SArgument_T<S,S_var>::interceptor_value (
+ CORBA::Any *any) const
+{
+ (*any) <<= this->x_.in ();
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+// ==============================================================
+
+template<typename S, typename S_var>
+CORBA::Boolean
+TAO::Out_UB_String_SArgument_T<S,S_var>::marshal (TAO_OutputCDR &cdr)
+{
+ return cdr << this->x_.in ();
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S, typename S_var>
+void
+TAO::Out_UB_String_SArgument_T<S,S_var>::interceptor_value (
+ CORBA::Any *any) const
+{
+ (*any) <<= this->x_.in ();
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+// ============================================================
+
+template<typename S, typename S_var>
+CORBA::Boolean
+TAO::Ret_UB_String_SArgument_T<S,S_var>::marshal (TAO_OutputCDR &cdr)
+{
+ return cdr << this->x_.in ();
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S, typename S_var>
+void
+TAO::Ret_UB_String_SArgument_T<S,S_var>::interceptor_value (
+ CORBA::Any *any) const
+{
+ (*any) <<= this->x_.in ();
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_UB_STRING_SARGUMENT_T_CPP */
diff --git a/TAO/tao/PortableServer/UB_String_SArgument_T.h b/TAO/tao/PortableServer/UB_String_SArgument_T.h
new file mode 100644
index 00000000000..ac1202a2d4f
--- /dev/null
+++ b/TAO/tao/PortableServer/UB_String_SArgument_T.h
@@ -0,0 +1,162 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file UB_String_SArgument_T.h
+ *
+ * $Id$
+ *
+ * @authors Jeff Parsons, Carlos O'Ryan and Ossama Othman
+ */
+//=============================================================================
+
+#ifndef TAO_UB_STRING_SARGUMENT_T_H
+#define TAO_UB_STRING_SARGUMENT_T_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Argument.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ /**
+ * @class In_UB_String_SArgument_T
+ *
+ * @brief Template class for IN skeleton UB (w)string argument.
+ *
+ */
+ template<typename S, typename S_var>
+ class In_UB_String_SArgument_T : public InArgument
+ {
+ public:
+ In_UB_String_SArgument_T (void);
+
+ virtual CORBA::Boolean demarshal (TAO_InputCDR &);
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ S const * arg (void) const;
+
+ private:
+ S_var x_;
+ };
+
+ /**
+ * @class Inout_UB_String_SArgument_T
+ *
+ * @brief Template class for INOUT skeleton UB (w)string argument.
+ *
+ */
+ template<typename S, typename S_var>
+ class Inout_UB_String_SArgument_T : public InoutArgument
+ {
+ public:
+ Inout_UB_String_SArgument_T (void);
+
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+ virtual CORBA::Boolean demarshal (TAO_InputCDR &);
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ S *& arg (void);
+
+ private:
+ S_var x_;
+ };
+
+ /**
+ * @class Out_UB_String_SArgument_T
+ *
+ * @brief Template class for INOUT skeleton UB (w)string argument.
+ *
+ */
+ template<typename S, typename S_var>
+ class Out_UB_String_SArgument_T : public OutArgument
+ {
+ public:
+ Out_UB_String_SArgument_T (void);
+
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ S *& arg (void);
+
+ private:
+ S_var x_;
+ };
+
+ /**
+ * @class Ret_UB_String_SArgument_T
+ *
+ * @brief Template class for return skeleton value of UB (w)string.
+ *
+ */
+ template<typename S, typename S_var>
+ class Ret_UB_String_SArgument_T : public RetArgument
+ {
+ public:
+ Ret_UB_String_SArgument_T (void);
+
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ S *& arg (void);
+
+ private:
+ S_var x_;
+ };
+
+ /**
+ * @struct UB_String_SArg_Traits_T
+ *
+ * @brief Template class for argument traits of unbounded (w)strings.
+ *
+ */
+ template<typename T, typename T_var, typename T_out>
+ struct UB_String_SArg_Traits_T
+ {
+ typedef T * ret_type;
+ typedef const T * in_type;
+ typedef T *& inout_type;
+ typedef T_out out_type;
+
+ typedef In_UB_String_SArgument_T<T,T_var> in_arg_val;
+ typedef Inout_UB_String_SArgument_T<T,T_var> inout_arg_val;
+ typedef Out_UB_String_SArgument_T<T,T_var> out_arg_val;
+ typedef Ret_UB_String_SArgument_T<T,T_var> ret_val;
+
+ // Typedefs corresponding to return value of arg() method in both
+ // the client and server side argument class templates.
+ typedef in_type in_arg_type;
+ typedef inout_type inout_arg_type;
+ typedef inout_type out_arg_type;
+ typedef inout_type ret_arg_type;
+
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+#include "tao/PortableServer/UB_String_SArgument_T.inl"
+#endif /* __ACE_INLINE__ */
+
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+#include "tao/PortableServer/UB_String_SArgument_T.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
+#pragma implementation ("UB_String_SArgument_T.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_UB_STRING_SARGUMENT_T_H */
diff --git a/TAO/tao/PortableServer/UB_String_SArgument_T.inl b/TAO/tao/PortableServer/UB_String_SArgument_T.inl
new file mode 100644
index 00000000000..b60809e056d
--- /dev/null
+++ b/TAO/tao/PortableServer/UB_String_SArgument_T.inl
@@ -0,0 +1,65 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template<typename S, typename S_var>
+ACE_INLINE
+TAO::In_UB_String_SArgument_T<S,S_var>::In_UB_String_SArgument_T (void)
+{}
+
+template<typename S, typename S_var>
+const S *
+TAO::In_UB_String_SArgument_T<S,S_var>::arg (void) const
+{
+ return this->x_.in ();
+}
+
+// ==========================================================================
+
+template<typename S, typename S_var>
+ACE_INLINE
+TAO::Inout_UB_String_SArgument_T<S,S_var>::Inout_UB_String_SArgument_T (void)
+{}
+
+template<typename S, typename S_var>
+ACE_INLINE
+S *&
+TAO::Inout_UB_String_SArgument_T<S,S_var>::arg (void)
+{
+ return this->x_.inout ();
+}
+
+// ==========================================================================
+
+template<typename S, typename S_var>
+ACE_INLINE
+TAO::Out_UB_String_SArgument_T<S,S_var>::Out_UB_String_SArgument_T (
+ void
+ )
+{}
+
+template<typename S, typename S_var>
+ACE_INLINE
+S *&
+TAO::Out_UB_String_SArgument_T<S,S_var>::arg (void)
+{
+ return this->x_.out ();
+}
+
+// ==========================================================================
+
+template<typename S, typename S_var>
+ACE_INLINE
+TAO::Ret_UB_String_SArgument_T<S,S_var>::Ret_UB_String_SArgument_T (void)
+{}
+
+template<typename S, typename S_var>
+S *&
+TAO::Ret_UB_String_SArgument_T<S,S_var>::arg (void)
+{
+ return this->x_.out ();
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/UB_String_SArguments.h b/TAO/tao/PortableServer/UB_String_SArguments.h
new file mode 100644
index 00000000000..e86e7c0ae24
--- /dev/null
+++ b/TAO/tao/PortableServer/UB_String_SArguments.h
@@ -0,0 +1,59 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file UB_String_SArguments.h
+ *
+ * $Id$
+ *
+ * @author Jeff Parsons
+ * @author Carlos O'Ryan
+ */
+//=============================================================================
+
+#ifndef TAO_UB_STRING_SARGUMENTS_H
+#define TAO_UB_STRING_SARGUMENTS_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/UB_String_SArgument_T.h"
+#include "tao/PortableServer/SArg_Traits_T.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ /**
+ *
+ * @brief Specializatons for unbounded (w)strings.
+ *
+ */
+
+ template<>
+ class TAO_PortableServer_Export SArg_Traits<CORBA::Char *>
+ : public UB_String_SArg_Traits_T<CORBA::Char,
+ CORBA::String_var,
+ CORBA::String_out>
+ {
+ };
+
+ template<>
+ class TAO_PortableServer_Export SArg_Traits<CORBA::WChar *>
+ : public UB_String_SArg_Traits_T<CORBA::WChar,
+ CORBA::WString_var,
+ CORBA::WString_out>
+ {
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_UB_STRING_SARGUMENTS_H */
diff --git a/TAO/tao/PortableServer/Upcall_Command.cpp b/TAO/tao/PortableServer/Upcall_Command.cpp
new file mode 100644
index 00000000000..dd6b7d8e85f
--- /dev/null
+++ b/TAO/tao/PortableServer/Upcall_Command.cpp
@@ -0,0 +1,17 @@
+// $Id$
+
+#include "tao/PortableServer/Upcall_Command.h"
+
+
+ACE_RCSID (PortableServer,
+ Upcall_Command,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO::Upcall_Command::~Upcall_Command (void)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/Upcall_Command.h b/TAO/tao/PortableServer/Upcall_Command.h
new file mode 100644
index 00000000000..40c216457f7
--- /dev/null
+++ b/TAO/tao/PortableServer/Upcall_Command.h
@@ -0,0 +1,67 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Upcall_Command.h
+ *
+ * $Id$
+ *
+ * @author Ossama Othman
+ */
+//=============================================================================
+
+#ifndef TAO_UPCALL_COMMAND_H
+#define TAO_UPCALL_COMMAND_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#ifndef ACE_LACKS_PRAGMA_ONCE
+# pragma once
+#endif /* !ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Versioned_Namespace.h"
+#include "ace/CORBA_macros.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace CORBA
+{
+ class Environment;
+}
+
+namespace TAO
+{
+
+ /**
+ * @class Upcall_Command
+ *
+ * @brief "ABC" that all operation-specific command objects must
+ * subclass.
+ *
+ * The actual upcall into a servant is executed through a concrete
+ * @c Upcall_Command object. This is necessary to simplify upcall
+ * interactions in the presence of interceptors, such as when the
+ * @c send_exception() interception point must be invoked when the
+ * servant operation throws an exception.
+ */
+ class TAO_PortableServer_Export Upcall_Command
+ {
+ public:
+
+ /// Destructor.
+ virtual ~Upcall_Command (void);
+
+ /// Execute the upcall.
+ virtual void execute (ACE_ENV_SINGLE_ARG_DECL) = 0;
+
+ };
+
+} // End namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_UPCALL_COMMAND_H */
diff --git a/TAO/tao/PortableServer/Upcall_Wrapper.cpp b/TAO/tao/PortableServer/Upcall_Wrapper.cpp
new file mode 100644
index 00000000000..2e9b1f1564d
--- /dev/null
+++ b/TAO/tao/PortableServer/Upcall_Wrapper.cpp
@@ -0,0 +1,302 @@
+// $Id$
+
+#include "tao/PortableServer/Upcall_Wrapper.h"
+#include "tao/PortableServer/Upcall_Command.h"
+
+#if TAO_HAS_INTERCEPTORS == 1
+# include "tao/ServerRequestInterceptor_Adapter.h"
+# include "tao/PortableInterceptorC.h"
+# include "tao/ORB_Core.h"
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+
+#include "tao/PortableInterceptor.h"
+
+#include "tao/TAO_Server_Request.h"
+#include "tao/CDR.h"
+#include "tao/Argument.h"
+#include "tao/operation_details.h"
+#include "ace/Log_Msg.h"
+
+ACE_RCSID (PortableServer,
+ Upcall_Wrapper,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+void
+TAO::Upcall_Wrapper::upcall (TAO_ServerRequest & server_request,
+ TAO::Argument * const args[],
+ size_t nargs,
+ TAO::Upcall_Command & command
+
+#if TAO_HAS_INTERCEPTORS == 1
+ , void * servant_upcall
+ , CORBA::TypeCode_ptr const * exceptions
+ , CORBA::ULong nexceptions
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+
+ ACE_ENV_ARG_DECL
+ )
+{
+ if (server_request.incoming ())
+ {
+ this->pre_upcall (*server_request.incoming (),
+ args,
+ nargs
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+ // Make sure that, for the collocated case, we use the client-side
+ // arguments. For the non-collocated case, we will use the server-side
+ // arguments since they got set up in our pre_upcall() method. Note that
+ // our pre_upcall() method doesn't get invoked in the collocated case,
+ // and is the reason why we need to provide the client-side args instead
+ // of the (never set or initialized) server-side args.
+ //
+ // Before the following logic was added, the
+ // $TAO_ROOT/tests/Portable_Interceptors/Collocated/run_test.pl
+ // showed that the server-side request interceptor was getting bogus
+ // values when it took a look at the request arguments. Some
+ // additional testing revealed that this only occurred in the
+ // collocated request case.
+
+ // By default, we assume that we will use the server-side args.
+ TAO::Argument * const * the_args = args;
+ size_t the_nargs = nargs;
+
+ if (server_request.collocated())
+ {
+ // It is a collocated request so we need to use the client-side
+ // args instead.
+ the_args = server_request.operation_details()->args();
+ the_nargs = server_request.operation_details()->args_num();
+ }
+
+ TAO::ServerRequestInterceptor_Adapter *interceptor_adapter =
+ server_request.orb_core ()->serverrequestinterceptor_adapter ();
+
+ ACE_TRY
+ {
+ {
+ if (interceptor_adapter != 0)
+ {
+ // Invoke intermediate server side interception points.
+ interceptor_adapter->receive_request (server_request,
+ the_args,
+ the_nargs,
+ servant_upcall,
+ exceptions,
+ nexceptions
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+
+ // Don't bother performing the upcall if an interceptor caused a
+ // location forward.
+ CORBA::Object_var forward_to = server_request.forward_location ();
+ if (CORBA::is_nil (forward_to.in ()))
+ {
+ if (interceptor_adapter != 0)
+ {
+ interceptor_adapter->execute_command (server_request,
+ command
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ else
+#endif /* TAO_HAS_INTERCEPTORS */
+ {
+ // The actual upcall.
+ command.execute (ACE_ENV_SINGLE_ARG_PARAMETER);
+ TAO_INTERCEPTOR_CHECK;
+ }
+
+#if TAO_HAS_INTERCEPTORS == 1
+ }
+ }
+
+ if (interceptor_adapter == 0)
+ {
+ server_request.reply_status (PortableInterceptor::SUCCESSFUL);
+ }
+ else
+ {
+ // Do not execute the send_reply() interception point if an
+ // interceptor caused a location forward. The send_other()
+ // interception point should already have been executed by the
+ // ServerRequestInterceptor_Adapter object.
+ //
+ // It should actually be safe to call this interception point,
+ // regardless, since the interceptor flow stack should have been
+ // emptied by the send_other() interception point. Note that
+ // we'd still need to avoid resetting the reply status to
+ // SUCCESSFUL, however.
+ CORBA::Object_var forward_to_after = server_request.forward_location ();
+ if (CORBA::is_nil (forward_to_after.in ()))
+ {
+ // No location forward by interceptors and successful upcall.
+ server_request.reply_status (PortableInterceptor::SUCCESSFUL);
+ interceptor_adapter->send_reply (server_request,
+ the_args,
+ the_nargs,
+ servant_upcall,
+ exceptions,
+ nexceptions
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ }
+ }
+ ACE_CATCHANY
+ {
+ // Just assume the current exception is a system exception, the
+ // status can only change when the interceptor changes this
+ // and this is only done when the sri_adapter is available. If we
+ // don't have an sri_adapter we just rethrow the exception
+ PortableInterceptor::ReplyStatus status =
+ PortableInterceptor::SYSTEM_EXCEPTION;
+
+ server_request.caught_exception (&ACE_ANY_EXCEPTION);
+
+ if (interceptor_adapter != 0)
+ {
+ interceptor_adapter->send_exception (server_request,
+ the_args,
+ the_nargs,
+ servant_upcall,
+ exceptions,
+ nexceptions
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ status =
+ server_request.reply_status ();
+ }
+
+ if (status == PortableInterceptor::SYSTEM_EXCEPTION
+ || status == PortableInterceptor::USER_EXCEPTION)
+ {
+ ACE_RE_THROW;
+ }
+ }
+# if defined (ACE_HAS_EXCEPTIONS) \
+ && defined (ACE_HAS_BROKEN_UNEXPECTED_EXCEPTIONS)
+ ACE_CATCHALL
+ {
+ // Just assume the current exception is a system exception, the
+ // status can only change when the interceptor changes this
+ // and this is only done when the sri_adapter is available. If we
+ // don't have an sri_adapter we just rethrow the exception
+ PortableInterceptor::ReplyStatus status =
+ PortableInterceptor::SYSTEM_EXCEPTION;
+
+ CORBA::UNKNOWN ex;
+
+ server_request.caught_exception (&ex);
+
+ if (interceptor_adapter != 0)
+ {
+ interceptor_adapter->send_exception (server_request,
+ the_args,
+ the_nargs,
+ servant_upcall,
+ exceptions,
+ nexceptions
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ status =
+ server_request.reply_status ();
+ }
+
+ if (status == PortableInterceptor::SYSTEM_EXCEPTION)
+ ACE_TRY_THROW (ex);
+ }
+# endif /* ACE_HAS_EXCEPTIONS && ACE_HAS_BROKEN_UNEXPECTED_EXCEPTIONS */
+ ACE_ENDTRY;
+ ACE_CHECK;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+
+ if (server_request.response_expected ()
+ && !server_request.sync_with_server ())
+ {
+ server_request.init_reply ();
+ }
+
+#if TAO_HAS_INTERCEPTORS == 1
+ // Don't bother marshaling inout/out/return values if an interceptor
+ // caused a location forward.
+ CORBA::Object_var forward_to_end = server_request.forward_location ();
+ if (CORBA::is_nil (forward_to_end.in ()))
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ {
+ if (server_request.outgoing ())
+ {
+ this->post_upcall (*server_request.outgoing (),
+ args,
+ nargs
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ }
+}
+
+void
+TAO::Upcall_Wrapper::pre_upcall (TAO_InputCDR & cdr,
+ TAO::Argument * const * args,
+ size_t nargs
+ ACE_ENV_ARG_DECL)
+{
+ // Demarshal the operation "in" and "inout" arguments, if any.
+
+ // NOTE: The TAO::Argument corresponding to the return value is
+ // always the first element in the array, regardless of
+ // whether or not the return type is void.
+
+ ACE_ASSERT (nargs != 0);
+
+ TAO::Argument * const * const begin = args + 1; // Skip the return value.
+ TAO::Argument * const * const end = args + nargs;
+
+ for (TAO::Argument * const * i = begin; i != end; ++i)
+ {
+ if (!(*i)->demarshal (cdr))
+ {
+ TAO_InputCDR::throw_skel_exception (errno
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ }
+}
+
+void
+TAO::Upcall_Wrapper::post_upcall (TAO_OutputCDR & cdr,
+ TAO::Argument * const * args,
+ size_t nargs
+ ACE_ENV_ARG_DECL)
+{
+ // Marshal the operation "inout" and "out" arguments and return
+ // value, if any.
+
+ TAO::Argument * const * const begin = args;
+ TAO::Argument * const * const end = args + nargs;
+
+ for (TAO::Argument * const * i = begin; i != end; ++i)
+ {
+ if (!(*i)->marshal (cdr))
+ {
+ TAO_OutputCDR::throw_skel_exception (errno
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ }
+
+ // Reply body marshaling completed. No other fragments to send.
+ cdr.more_fragments (false);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
diff --git a/TAO/tao/PortableServer/Upcall_Wrapper.h b/TAO/tao/PortableServer/Upcall_Wrapper.h
new file mode 100644
index 00000000000..f0ba3f1c7e0
--- /dev/null
+++ b/TAO/tao/PortableServer/Upcall_Wrapper.h
@@ -0,0 +1,131 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Upcall_Wrapper.h
+ *
+ * $Id$
+ *
+ * @author Ossama Othman
+ * @author Jeff Parsons
+ * @author Carlos O'Ryan
+ */
+//=============================================================================
+
+#ifndef TAO_UPCALL_WRAPPER_H
+#define TAO_UPCALL_WRAPPER_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableServer/portableserver_export.h"
+
+#ifndef ACE_LACKS_PRAGMA_ONCE
+# pragma once
+#endif /* !ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Basic_Types.h"
+#include "tao/orbconf.h"
+#include "ace/CORBA_macros.h"
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_ServantBase;
+class TAO_ServerRequest;
+class TAO_InputCDR;
+class TAO_OutputCDR;
+
+namespace PortableServer
+{
+ typedef ::TAO_ServantBase ServantBase;
+}
+
+namespace CORBA
+{
+ class Environment;
+}
+
+namespace TAO
+{
+ class Argument;
+ class Upcall_Command;
+
+ /**
+ * @class Upcall_Wrapper
+ *
+ * @brief Wraps the activities of the _skel operations.
+ *
+ */
+ class TAO_PortableServer_Export Upcall_Wrapper
+ {
+ public:
+
+ /**
+ * @note The TAO::Argument corresponding to the return value is
+ * always the first element in the array, regardless of
+ * whether or not the return type is void.
+ */
+
+ /// Perform the upcall.
+ /**
+ * @param server_request Object containing server side messaging
+ * operations (e.g. CDR reply construction, etc).
+ * @param args Operation argument list.
+ * @param nargs Number of arguments in the operation
+ * argument list.
+ * @param command @c Command object that performs the
+ * actual upcall into the servant.
+ *
+ * @param servant_upcall Object containing information for POA
+ * that dispatched the servant.
+ * @param servant The servant handling the upcall.
+ * @param exceptions Array of user exceptions the operation
+ * may raise.
+ * @param nexceptions The number of exceptions in the operation
+ * user exception array.
+ */
+ void upcall (TAO_ServerRequest & server_request,
+ TAO::Argument * const args[],
+ size_t nargs,
+ TAO::Upcall_Command & command
+
+#if TAO_HAS_INTERCEPTORS == 1
+ , void * servant_upcall
+ , CORBA::TypeCode_ptr const * exceptions
+ , CORBA::ULong nexceptions
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+
+ ACE_ENV_ARG_DECL);
+
+ private:
+
+
+ /// Perform pre-upcall operations.
+ /**
+ * Perform pre-upcall operations, including operation @c IN and
+ * @c INOUT argument demarshaling.
+ */
+ void pre_upcall (TAO_InputCDR & cdr,
+ TAO::Argument * const * args,
+ size_t nargs
+ ACE_ENV_ARG_DECL);
+
+ /// Perform post-upcall operations.
+ /**
+ * Perform post-upcall operations, including operation @c INOUT
+ * and @c OUT argument marshaling.
+ */
+ void post_upcall (TAO_OutputCDR & cdr,
+ TAO::Argument * const * args,
+ size_t nargs
+ ACE_ENV_ARG_DECL);
+
+ };
+
+} // End namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_UPCALL_WRAPPER_H */
diff --git a/TAO/tao/PortableServer/Var_Array_SArgument_T.cpp b/TAO/tao/PortableServer/Var_Array_SArgument_T.cpp
new file mode 100644
index 00000000000..489af67b782
--- /dev/null
+++ b/TAO/tao/PortableServer/Var_Array_SArgument_T.cpp
@@ -0,0 +1,142 @@
+// $Id$
+
+#ifndef TAO_VAR_ARRAY_SARGUMENT_T_CPP
+#define TAO_VAR_ARRAY_SARGUMENT_T_CPP
+
+#include "tao/PortableServer/Var_Array_SArgument_T.h"
+
+#if !defined (__ACE_INLINE__)
+#include "tao/PortableServer/Var_Array_SArgument_T.inl"
+#endif /* __ACE_INLINE__ */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template<typename S_forany,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::In_Var_Array_SArgument_T<S_forany,
+ Insert_Policy>::demarshal (TAO_InputCDR & cdr)
+{
+ S_forany tmp (this->x_);
+ return cdr >> tmp;
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S_forany,
+ class Insert_Policy>
+void
+TAO::In_Var_Array_SArgument_T<S_forany,
+ Insert_Policy>::interceptor_value (
+ CORBA::Any *any) const
+{
+ Insert_Policy::any_insert (any, S_forany (this->x_));
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+// ===========================================================
+
+template<typename S_forany,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::Inout_Var_Array_SArgument_T<S_forany,
+ Insert_Policy>::marshal (TAO_OutputCDR &cdr)
+{
+ return cdr << S_forany (this->x_);
+}
+
+template<typename S_forany,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::Inout_Var_Array_SArgument_T<S_forany,
+ Insert_Policy>::demarshal (TAO_InputCDR & cdr)
+{
+ S_forany tmp (this->x_);
+ return cdr >> tmp;
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S_forany,
+ class Insert_Policy>
+void
+TAO::Inout_Var_Array_SArgument_T<S_forany,
+ Insert_Policy>::interceptor_value (
+ CORBA::Any *any) const
+{
+ typedef typename S_forany::_slice_type slice_type;
+ Insert_Policy::any_insert (
+ any,
+ S_forany (const_cast <slice_type *>(this->x_))
+ );
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+// ==============================================================
+
+template<typename S_var,
+ typename S_forany,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::Out_Var_Array_SArgument_T<S_var,
+ S_forany,
+ Insert_Policy>::marshal (
+ TAO_OutputCDR & cdr
+ )
+{
+ S_forany tmp (this->x_.ptr ());
+ return cdr << tmp;
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S_var,
+ typename S_forany,
+ class Insert_Policy>
+void
+TAO::Out_Var_Array_SArgument_T<S_var,
+ S_forany,
+ Insert_Policy>::interceptor_value (
+ CORBA::Any *any) const
+{
+ Insert_Policy::any_insert (any, S_forany (this->x_.ptr ()));
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+// ============================================================
+
+template<typename S_var,
+ typename S_forany,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::Ret_Var_Array_SArgument_T<S_var,
+ S_forany,
+ Insert_Policy>::marshal (
+ TAO_OutputCDR & cdr
+ )
+{
+ return cdr << S_forany (this->x_.ptr ());
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S_var,
+ typename S_forany,
+ class Insert_Policy>
+void
+TAO::Ret_Var_Array_SArgument_T<S_var,
+ S_forany,
+ Insert_Policy>::interceptor_value (
+ CORBA::Any *any) const
+{
+ Insert_Policy::any_insert (any, S_forany (this->x_.ptr ()));
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_VAR_ARRAY_SARGUMENT_T_CPP */
diff --git a/TAO/tao/PortableServer/Var_Array_SArgument_T.h b/TAO/tao/PortableServer/Var_Array_SArgument_T.h
new file mode 100644
index 00000000000..22a1ee23caa
--- /dev/null
+++ b/TAO/tao/PortableServer/Var_Array_SArgument_T.h
@@ -0,0 +1,176 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Var_Array_SArgument_T.h
+ *
+ * $Id$
+ *
+ * @authors Jeff Parsons, Carlos O'Ryan and Ossama Othman
+ */
+//=============================================================================
+
+#ifndef TAO_VAR_ARRAY_SARGUMENT_T_H
+#define TAO_VAR_ARRAY_SARGUMENT_T_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Argument.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ /**
+ * @class In_Var_Array_SArgument_T
+ *
+ * @brief IN skeleton argument of variable size element array.
+ *
+ */
+ template<typename S_forany,
+ class Insert_Policy>
+ class In_Var_Array_SArgument_T : public InArgument
+ {
+ public:
+
+ In_Var_Array_SArgument_T (void);
+
+ virtual CORBA::Boolean demarshal (TAO_InputCDR &);
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ typename S_forany::_slice_type const * arg (void) const;
+
+ private:
+ mutable typename S_forany::_array_type x_;
+ };
+
+ /**
+ * @class Inout_Var_Array_SArgument_T
+ *
+ * @brief INOUT skeleton argument of variable size element array.
+ *
+ */
+ template<typename S_forany,
+ class Insert_Policy>
+ class Inout_Var_Array_SArgument_T : public InoutArgument
+ {
+ public:
+ Inout_Var_Array_SArgument_T (void);
+
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+ virtual CORBA::Boolean demarshal (TAO_InputCDR &);
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ typename S_forany::_slice_type * arg (void);
+
+ private:
+ typename S_forany::_array_type x_;
+ };
+
+ /**
+ * @class Out_Var_Array_SArgument_T
+ *
+ * @brief OUT skeleton argument of variable size element array.
+ *
+ */
+ template<typename S_var,
+ typename S_forany,
+ class Insert_Policy>
+ class Out_Var_Array_SArgument_T : public OutArgument
+ {
+ public:
+ Out_Var_Array_SArgument_T (void);
+
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ typename S_forany::_slice_type *& arg (void);
+
+ private:
+ S_var x_;
+ };
+
+ /**
+ * @class Ret_Var_Array_SArgument_T
+ *
+ * @brief Skeleton value of variable size element array.
+ *
+ */
+ template<typename S_var,
+ typename S_forany,
+ class Insert_Policy>
+ class Ret_Var_Array_SArgument_T : public RetArgument
+ {
+ public:
+ Ret_Var_Array_SArgument_T (void);
+
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ typename S_forany::_slice_type *& arg (void);
+
+ private:
+ S_var x_;
+ };
+
+ /**
+ * @struct Var_Array_SArg_Traits_T
+ *
+ * @brief Argument traits of variable size element array.
+ *
+ */
+ template<typename T_out,
+ typename T_forany,
+ class Insert_Policy>
+ struct Var_Array_SArg_Traits_T
+ {
+ typedef typename T_forany::_slice_type * ret_type;
+ typedef const typename T_forany::_array_type in_type;
+ typedef typename T_forany::_array_type inout_type;
+ typedef T_out out_type;
+
+ typedef In_Var_Array_SArgument_T<T_forany,
+ Insert_Policy> in_arg_val;
+ typedef Inout_Var_Array_SArgument_T<T_forany,
+ Insert_Policy> inout_arg_val;
+ typedef Out_Var_Array_SArgument_T<typename T_out::_var_type,
+ T_forany,
+ Insert_Policy> out_arg_val;
+ typedef Ret_Var_Array_SArgument_T<typename T_out::_var_type,
+ T_forany,
+ Insert_Policy> ret_val;
+
+ // Typedefs corresponding to return value of arg() method in both
+ // the client and server side argument class templates.
+ typedef typename T_forany::_slice_type const * in_arg_type;
+ typedef ret_type inout_arg_type;
+ typedef ret_type & out_arg_type;
+ typedef ret_type & ret_arg_type;
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+#include "tao/PortableServer/Var_Array_SArgument_T.inl"
+#endif /* __ACE_INLINE__ */
+
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+#include "tao/PortableServer/Var_Array_SArgument_T.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
+#pragma implementation ("Var_Array_SArgument_T.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_VAR_ARRAY_SARGUMENT_T_H */
diff --git a/TAO/tao/PortableServer/Var_Array_SArgument_T.inl b/TAO/tao/PortableServer/Var_Array_SArgument_T.inl
new file mode 100644
index 00000000000..0d0e74abafd
--- /dev/null
+++ b/TAO/tao/PortableServer/Var_Array_SArgument_T.inl
@@ -0,0 +1,95 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template<typename S_forany,
+ class Insert_Policy>
+ACE_INLINE
+TAO::In_Var_Array_SArgument_T<S_forany,
+ Insert_Policy>::In_Var_Array_SArgument_T (void)
+{}
+
+template<typename S_forany,
+ class Insert_Policy>
+ACE_INLINE
+typename S_forany::_slice_type const *
+TAO::In_Var_Array_SArgument_T<S_forany,
+ Insert_Policy>::arg (void) const
+{
+ S_forany tmp (this->x_);
+ return tmp.in ();
+}
+
+// ==========================================================================
+
+template<typename S_forany,
+ class Insert_Policy>
+ACE_INLINE
+TAO::Inout_Var_Array_SArgument_T<S_forany,
+ Insert_Policy>::
+Inout_Var_Array_SArgument_T (void)
+{
+}
+
+template<typename S_forany,
+ class Insert_Policy>
+typename S_forany::_slice_type *
+TAO::Inout_Var_Array_SArgument_T<S_forany,
+ Insert_Policy>::arg (void)
+{
+ S_forany tmp (this->x_);
+ return tmp.inout ();
+}
+
+// ==========================================================================
+
+template<typename S_var,
+ typename S_forany,
+ class Insert_Policy>
+ACE_INLINE
+TAO::Out_Var_Array_SArgument_T<S_var,
+ S_forany,
+ Insert_Policy>::
+Out_Var_Array_SArgument_T (void)
+{
+}
+
+template<typename S_var,
+ typename S_forany,
+ class Insert_Policy>
+typename S_forany::_slice_type *&
+TAO::Out_Var_Array_SArgument_T<S_var,
+ S_forany,
+ Insert_Policy>::arg (void)
+{
+ return this->x_.out ();
+}
+
+// ==========================================================================
+
+template<typename S_var,
+ typename S_forany,
+ class Insert_Policy>
+ACE_INLINE
+TAO::Ret_Var_Array_SArgument_T<S_var,
+ S_forany,
+ Insert_Policy>::
+Ret_Var_Array_SArgument_T (void)
+{
+}
+
+template<typename S_var,
+ typename S_forany,
+ class Insert_Policy>
+ACE_INLINE
+typename S_forany::_slice_type *&
+TAO::Ret_Var_Array_SArgument_T<S_var,
+ S_forany,
+ Insert_Policy>::arg (void)
+{
+ return this->x_.out ();
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/Var_Size_SArgument_T.cpp b/TAO/tao/PortableServer/Var_Size_SArgument_T.cpp
new file mode 100644
index 00000000000..cb8864f7859
--- /dev/null
+++ b/TAO/tao/PortableServer/Var_Size_SArgument_T.cpp
@@ -0,0 +1,117 @@
+// $Id$
+
+#ifndef TAO_VAR_SIZE_SARGUMENT_T_CPP
+#define TAO_VAR_SIZE_SARGUMENT_T_CPP
+
+#include "tao/PortableServer/Var_Size_SArgument_T.h"
+
+#if !defined (__ACE_INLINE__)
+#include "tao/PortableServer/Var_Size_SArgument_T.inl"
+#endif /* __ACE_INLINE__ */
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template<typename S,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::In_Var_Size_SArgument_T<S,Insert_Policy>::demarshal (TAO_InputCDR &cdr)
+{
+ return cdr >> this->x_;
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S,
+ class Insert_Policy>
+void
+TAO::In_Var_Size_SArgument_T<S,Insert_Policy>::interceptor_value (
+ CORBA::Any *any
+ ) const
+{
+ Insert_Policy::any_insert (any, this->x_);
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+// ===========================================================
+
+template<typename S,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::Inout_Var_Size_SArgument_T<S,Insert_Policy>::marshal (TAO_OutputCDR &cdr)
+{
+ return cdr << this->x_;
+}
+
+template<typename S,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::Inout_Var_Size_SArgument_T<S,Insert_Policy>::demarshal (TAO_InputCDR & cdr)
+{
+ return cdr >> this->x_;
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S,
+ class Insert_Policy>
+void
+TAO::Inout_Var_Size_SArgument_T<S,Insert_Policy>::interceptor_value (
+ CORBA::Any *any
+ ) const
+{
+ Insert_Policy::any_insert (any, this->x_);
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+// ==============================================================
+
+template<typename S,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::Out_Var_Size_SArgument_T<S,Insert_Policy>::marshal (TAO_OutputCDR &cdr)
+{
+ return cdr << this->x_.in ();
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S,
+ class Insert_Policy>
+void
+TAO::Out_Var_Size_SArgument_T<S,Insert_Policy>::interceptor_value (
+ CORBA::Any *any) const
+{
+ Insert_Policy::any_insert (any, this->x_.in ());
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+// ============================================================
+
+template<typename S,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::Ret_Var_Size_SArgument_T<S,Insert_Policy>::marshal (TAO_OutputCDR &cdr)
+{
+ return cdr << this->x_.in ();
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S,
+ class Insert_Policy>
+void
+TAO::Ret_Var_Size_SArgument_T<S,Insert_Policy>::interceptor_value (
+ CORBA::Any *any) const
+{
+ Insert_Policy::any_insert (any, this->x_.in ());
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_VAR_SIZE_SARGUMENT_T_CPP */
diff --git a/TAO/tao/PortableServer/Var_Size_SArgument_T.h b/TAO/tao/PortableServer/Var_Size_SArgument_T.h
new file mode 100644
index 00000000000..1632a639a54
--- /dev/null
+++ b/TAO/tao/PortableServer/Var_Size_SArgument_T.h
@@ -0,0 +1,165 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Var_Size_SArgument_T.h
+ *
+ * $Id$
+ *
+ * @authors Jeff Parsons, Carlos O'Ryan and Ossama Othman
+ */
+//=============================================================================
+
+#ifndef TAO_VAR_SIZE_SARGUMENT_T_H
+#define TAO_VAR_SIZE_SARGUMENT_T_H
+
+#include /**/ "ace/pre.h"
+#include "tao/Argument.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ /**
+ * @class In_Var_Size_SArgument_T
+ *
+ * @brief Template class for IN skeleton argument of fixed size IDL types.
+ *
+ */
+ template<typename S,
+ class Insert_Policy>
+ class In_Var_Size_SArgument_T : public InArgument
+ {
+ public:
+
+ virtual CORBA::Boolean demarshal (TAO_InputCDR &);
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ S const & arg (void) const;
+
+ private:
+ S x_;
+ };
+
+ /**
+ * @class Inout_Var_Size_SArgument_T
+ *
+ * @brief Template class for INOUT skeleton arg of fixed size IDL types.
+ *
+ */
+ template<typename S,
+ class Insert_Policy>
+ class Inout_Var_Size_SArgument_T : public InoutArgument
+ {
+ public:
+ Inout_Var_Size_SArgument_T (void);
+
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+ virtual CORBA::Boolean demarshal (TAO_InputCDR &);
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ S & arg (void);
+
+ private:
+ S x_;
+ };
+
+ /**
+ * @class Out_Var_Size_SArgument_T
+ *
+ * @brief Template class for OUT skeleton argument of fixed size IDL types.
+ *
+ */
+ template<typename S,
+ class Insert_Policy>
+ class Out_Var_Size_SArgument_T : public OutArgument
+ {
+ public:
+ Out_Var_Size_SArgument_T (void);
+
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ S *& arg (void);
+
+ private:
+ typename S::_var_type x_;
+ };
+
+ /**
+ * @class Ret_Var_Size_SArgument_T
+ *
+ * @brief Template class for return skeleton value of fixed size IDL types.
+ *
+ */
+ template<typename S,
+ class Insert_Policy>
+ class Ret_Var_Size_SArgument_T : public RetArgument
+ {
+ public:
+ Ret_Var_Size_SArgument_T (void);
+
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ S *& arg (void);
+
+ private:
+ typename S::_var_type x_;
+ };
+
+ /**
+ * @struct Var_Size_SArg_Traits_T
+ *
+ * @brief Template class for skeleton argument traits of
+ * variable size IDL types.
+ *
+ */
+ template<typename T,
+ class Insert_Policy>
+ struct Var_Size_SArg_Traits_T
+ {
+ typedef T * ret_type;
+ typedef const T & in_type;
+ typedef T & inout_type;
+ typedef typename T::_out_type out_type;
+
+ typedef In_Var_Size_SArgument_T<T,Insert_Policy> in_arg_val;
+ typedef Inout_Var_Size_SArgument_T<T,Insert_Policy> inout_arg_val;
+ typedef Out_Var_Size_SArgument_T<T,Insert_Policy> out_arg_val;
+ typedef Ret_Var_Size_SArgument_T<T,Insert_Policy> ret_val;
+
+ // Typedefs corresponding to return value of arg() method in both
+ // the client and server side argument class templates.
+ typedef in_type in_arg_type;
+ typedef inout_type inout_arg_type;
+ typedef ret_type & out_arg_type;
+ typedef ret_type & ret_arg_type;
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+#include "tao/PortableServer/Var_Size_SArgument_T.inl"
+#endif /* __ACE_INLINE__ */
+
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+#include "tao/PortableServer/Var_Size_SArgument_T.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
+#pragma implementation ("Var_Size_SArgument_T.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_VAR_SIZE_SARGUMENT_T_H */
diff --git a/TAO/tao/PortableServer/Var_Size_SArgument_T.inl b/TAO/tao/PortableServer/Var_Size_SArgument_T.inl
new file mode 100644
index 00000000000..80d2c3fd9bf
--- /dev/null
+++ b/TAO/tao/PortableServer/Var_Size_SArgument_T.inl
@@ -0,0 +1,67 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template<typename S,
+ class Insert_Policy>
+S const &
+TAO::In_Var_Size_SArgument_T<S,Insert_Policy>::arg (void) const
+{
+ return this->x_;
+}
+
+// ==========================================================================
+
+template<typename S,
+ class Insert_Policy>
+ACE_INLINE
+TAO::Inout_Var_Size_SArgument_T<S,Insert_Policy>::Inout_Var_Size_SArgument_T (void)
+{
+}
+
+template<typename S,
+ class Insert_Policy>
+S &
+TAO::Inout_Var_Size_SArgument_T<S,Insert_Policy>::arg (void)
+{
+ return this->x_;
+}
+
+// ==========================================================================
+
+template<typename S,
+ class Insert_Policy>
+ACE_INLINE
+TAO::Out_Var_Size_SArgument_T<S,Insert_Policy>::Out_Var_Size_SArgument_T (void)
+{
+}
+
+template<typename S,
+ class Insert_Policy>
+S *&
+TAO::Out_Var_Size_SArgument_T<S,Insert_Policy>::arg (void)
+{
+ return this->x_.out ();
+}
+
+// ==========================================================================
+
+template<typename S,
+ class Insert_Policy>
+ACE_INLINE
+TAO::Ret_Var_Size_SArgument_T<S,Insert_Policy>::Ret_Var_Size_SArgument_T (void)
+{
+}
+
+template<typename S,
+ class Insert_Policy>
+ACE_INLINE
+S *&
+TAO::Ret_Var_Size_SArgument_T<S,Insert_Policy>::arg (void)
+{
+ return this->x_.out ();
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/PortableServer/diffs/PS_Forward.diff b/TAO/tao/PortableServer/diffs/PS_Forward.diff
new file mode 100644
index 00000000000..db64ebb520b
--- /dev/null
+++ b/TAO/tao/PortableServer/diffs/PS_Forward.diff
@@ -0,0 +1,63 @@
+--- orig/PS_ForwardC.h 2005-04-29 12:01:04.396555200 +0200
++++ PS_ForwardC.h 2005-05-25 15:19:21.321457600 +0200
+@@ -1,6 +1,6 @@
+ // -*- C++ -*-
+ //
+-// $Id$
++// $Id$
+
+ // **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+ // TAO and the TAO IDL Compiler have been developed by:
+@@ -61,11 +61,24 @@
+ #pragma option push -w-rvl -w-rch -w-ccc -w-inl
+ #endif /* __BORLANDC__ */
+
++class TAO_ServantBase;
++class TAO_ServantBase_var;
++class TAO_Local_ServantBase;
++class TAO_Root_POA;
++class TAO_DynamicImplementation;
++
+ // TAO_IDL - Generated from
+ // be\be_visitor_module/module_ch.cpp:48
+
+ namespace PortableServer
+ {
++ typedef TAO_ServantBase ServantBase;
++ struct RefCountServantBase {};
++ typedef TAO_ServantBase_var ServantBase_var;
++ typedef ServantBase *Servant;
++
++ typedef TAO_Local_ServantBase LocalServantBase;
++ typedef TAO_DynamicImplementation DynamicImplementation;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typedef/typedef_ch.cpp:472
+@@ -113,27 +126,6 @@
+ // Traits specializations.
+ namespace TAO
+ {
+-
+-#if !defined (_PORTABLESERVER_POA__TRAITS_CH_)
+-#define _PORTABLESERVER_POA__TRAITS_CH_
+-
+- template<>
+- struct TAO_PortableServer_Export Objref_Traits< ::PortableServer::POA>
+- {
+- static ::PortableServer::POA_ptr duplicate (
+- ::PortableServer::POA_ptr
+- );
+- static void release (
+- ::PortableServer::POA_ptr
+- );
+- static ::PortableServer::POA_ptr nil (void);
+- static CORBA::Boolean marshal (
+- ::PortableServer::POA_ptr p,
+- TAO_OutputCDR & cdr
+- );
+- };
+-
+-#endif /* end #if !defined */
+ }
+
+ // TAO_IDL - Generated from
diff --git a/TAO/tao/PortableServer/diffs/PortableServer.diff b/TAO/tao/PortableServer/diffs/PortableServer.diff
new file mode 100644
index 00000000000..f79f1875c64
--- /dev/null
+++ b/TAO/tao/PortableServer/diffs/PortableServer.diff
@@ -0,0 +1,247 @@
+--- orig/PortableServerC.h 2005-04-11 16:44:01.152521600 +0200
++++ PortableServerC.h 2005-04-11 16:44:04.287028800 +0200
+@@ -36,6 +36,10 @@
+
+ #include "ace/config-all.h"
+
++#ifndef TAO_PORTABLESERVER_SAFE_INCLUDE
++#error "You should not include PortableServerC.h directly, use PortableServer.h"
++#endif /* !TAO_PORTABLESERVER_SAFE_INCLUDE */
++
+ #if !defined (ACE_LACKS_PRAGMA_ONCE)
+ # pragma once
+ #endif /* ACE_LACKS_PRAGMA_ONCE */
+@@ -465,6 +469,8 @@
+ // TAO_IDL - Generated from
+ // be\be_visitor_exception/exception_ch.cpp:51
+
++#if (TAO_HAS_MINIMUM_POA == 0)
++
+ #if !defined (_PORTABLESERVER_POA_NOSERVANT_CH_)
+ #define _PORTABLESERVER_POA_NOSERVANT_CH_
+
+@@ -512,6 +518,8 @@
+
+ #endif /* end #if !defined */
+
++#endif /* TAO_HAS_MINIMUM_CORBA == 0 */
++
+ // TAO_IDL - Generated from
+ // be\be_visitor_exception/exception_ch.cpp:51
+
+@@ -855,6 +863,7 @@
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
++#if (TAO_HAS_MINIMUM_POA == 0)
+ virtual ::PortableServer::ThreadPolicy_ptr create_thread_policy (
+ ::PortableServer::ThreadPolicyValue value
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+@@ -862,6 +871,7 @@
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
++#endif /* TAO_HAS_MINIMUM_POA == 0 */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+@@ -899,6 +909,7 @@
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
++#if (TAO_HAS_MINIMUM_POA == 0)
+ virtual ::PortableServer::ImplicitActivationPolicy_ptr create_implicit_activation_policy (
+ ::PortableServer::ImplicitActivationPolicyValue value
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+@@ -906,10 +917,12 @@
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
++#endif /* TAO_HAS_MINIMUM_POA == 0 */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
++#if (TAO_HAS_MINIMUM_POA == 0)
+ virtual ::PortableServer::ServantRetentionPolicy_ptr create_servant_retention_policy (
+ ::PortableServer::ServantRetentionPolicyValue value
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+@@ -917,10 +930,12 @@
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
++#endif /* TAO_HAS_MINIMUM_POA == 0 */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
++#if (TAO_HAS_MINIMUM_POA == 0)
+ virtual ::PortableServer::RequestProcessingPolicy_ptr create_request_processing_policy (
+ ::PortableServer::RequestProcessingPolicyValue value
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+@@ -928,6 +943,7 @@
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
++#endif /* TAO_HAS_MINIMUM_POA == 0 */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+@@ -972,6 +988,8 @@
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
++#if (TAO_HAS_MINIMUM_POA == 0)
++
+ virtual ::PortableServer::AdapterActivator_ptr the_activator (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+@@ -989,10 +1007,12 @@
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
++#endif /* TAO_HAS_MINIMUM_POA == 0 */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
++#if (TAO_HAS_MINIMUM_POA == 0)
+ virtual ::PortableServer::ServantManager_ptr get_servant_manager (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+@@ -1012,10 +1032,13 @@
+ CORBA::SystemException,
+ ::PortableServer::POA::WrongPolicy
+ )) = 0;
++#endif /* TAO_HAS_MINIMUM_POA == 0 */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
++#if (TAO_HAS_MINIMUM_POA == 0)
++
+ virtual ::PortableServer::Servant get_servant (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+@@ -1037,6 +1060,8 @@
+ ::PortableServer::POA::WrongPolicy
+ )) = 0;
+
++#endif /* TAO_HAS_MINIMUM_CORBA == 0 */
++
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+@@ -1298,11 +1323,15 @@
+ // TAO_IDL - Generated from
+ // be\be_visitor_exception/any_op_ch.cpp:52
+
++#if (TAO_HAS_MINIMUM_POA == 0)
++
+ TAO_PortableServer_Export void operator<<= (CORBA::Any &, const PortableServer::POA::NoServant &); // copying version
+ TAO_PortableServer_Export void operator<<= (CORBA::Any &, PortableServer::POA::NoServant*); // noncopying version
+ TAO_PortableServer_Export CORBA::Boolean operator>>= (const CORBA::Any &, PortableServer::POA::NoServant *&); // deprecated
+ TAO_PortableServer_Export CORBA::Boolean operator>>= (const CORBA::Any &, const PortableServer::POA::NoServant *&);
+
++#endif /* TAO_HAS_MINIMUM_CORBA == 0 */
++
+ // TAO_IDL - Generated from
+ // be\be_visitor_exception/any_op_ch.cpp:52
+
+@@ -1366,4 +1395,3 @@
+
+ #endif /* ifndef */
+
+-
+--- orig/PortableServerC.cpp 2005-04-11 16:44:01.152521600 +0200
++++ PortableServerC.cpp 2005-04-11 16:44:04.317072000 +0200
+@@ -29,7 +29,7 @@
+ // be\be_codegen.cpp:291
+
+
+-#include "PortableServerC.h"
++#include "PortableServer.h"
+ #include "tao/CDR.h"
+ #include "tao/ORB_Core.h"
+ #include "tao/Object_Argument_T.h"
+@@ -45,7 +45,6 @@
+ // Arg traits specializations.
+ namespace TAO
+ {
+-
+ #if !defined (_PORTABLESERVER_ADAPTERACTIVATOR__ARG_TRAITS_CS_)
+ #define _PORTABLESERVER_ADAPTERACTIVATOR__ARG_TRAITS_CS_
+
+@@ -64,7 +63,6 @@
+ #endif /* end #if !defined */
+ }
+
+-
+ // TAO_IDL - Generated from
+ // be\be_visitor_sequence/sequence_cs.cpp:65
+
+@@ -463,6 +461,8 @@
+ // TAO_IDL - Generated from
+ // be\be_visitor_exception/exception_cs.cpp:63
+
++#if (TAO_HAS_MINIMUM_POA == 0)
++
+ PortableServer::POA::NoServant::NoServant (void)
+ : CORBA::UserException (
+ "IDL:omg.org/PortableServer/POA/NoServant:2.3",
+@@ -555,6 +555,8 @@
+ return ::PortableServer::POA::_tc_NoServant;
+ }
+
++#endif /* TAO_HAS_MINIMUM_CORBA == 0 */
++
+ // TAO_IDL - Generated from
+ // be\be_visitor_exception/exception_cs.cpp:63
+
+--- orig/PortableServerA.cpp 2005-04-11 16:44:01.152521600 +0200
++++ PortableServerA.cpp 2005-04-11 16:44:04.337100800 +0200
+@@ -25,7 +25,7 @@
+ // Information about TAO is available at:
+ // http://www.cs.wustl.edu/~schmidt/TAO.html
+
+-#include "PortableServerC.h"
++#include "PortableServer.h"
+ #include "tao/Null_RefCount_Policy.h"
+ #include "tao/TypeCode_Constants.h"
+ #include "tao/Alias_TypeCode.h"
+@@ -154,6 +154,8 @@
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/struct_typecode.cpp:70
+
++#if (TAO_HAS_MINIMUM_POA == 0)
++
+ static TAO::TypeCode::Struct_Field<char const *, CORBA::TypeCode_ptr const *> const * const _tao_fields_PortableServer_POA_NoServant = 0;
+ static TAO::TypeCode::Struct<char const *,
+ CORBA::TypeCode_ptr const *,
+@@ -170,6 +172,8 @@
+ ::CORBA::TypeCode_ptr const PortableServer::POA::_tc_NoServant =
+ &_tao_tc_PortableServer_POA_NoServant;
+
++#endif /* TAO_HAS_MINIMUM_CORBA == 0 */
++
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/struct_typecode.cpp:70
+
+@@ -662,6 +666,8 @@
+ // TAO_IDL - Generated from
+ // be\be_visitor_exception/any_op_cs.cpp:50
+
++#if (TAO_HAS_MINIMUM_POA == 0)
++
+ template<>
+ CORBA::Boolean
+ TAO::Any_Dual_Impl_T<PortableServer::POA::NoServant>::marshal_value (TAO_OutputCDR &)
+@@ -731,6 +737,8 @@
+ );
+ }
+
++#endif /* TAO_HAS_MINIMUM_CORBA == 0 */
++
+ // TAO_IDL - Generated from
+ // be\be_visitor_exception/any_op_cs.cpp:50
+
diff --git a/TAO/tao/PortableServer/diffs/PortableServer_include.diff b/TAO/tao/PortableServer/diffs/PortableServer_include.diff
new file mode 100644
index 00000000000..d6638858330
--- /dev/null
+++ b/TAO/tao/PortableServer/diffs/PortableServer_include.diff
@@ -0,0 +1,11 @@
+--- orig/PortableServer_includeC.h 2005-04-11 16:44:03.175430400 +0200
++++ PortableServer_includeC.h 2005-04-11 16:44:05.098195200 +0200
+@@ -45,7 +45,7 @@
+ #include "tao/SystemException.h"
+ #include "tao/Environment.h"
+
+-#include "tao/PortableServer/PortableServerC.h"
++#include "tao/PortableServer/PortableServer.h"
+
+ #if defined (TAO_EXPORT_MACRO)
+ #undef TAO_EXPORT_MACRO
diff --git a/TAO/tao/PortableServer/get_arg.h b/TAO/tao/PortableServer/get_arg.h
new file mode 100644
index 00000000000..1d0d05827b5
--- /dev/null
+++ b/TAO/tao/PortableServer/get_arg.h
@@ -0,0 +1,105 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file get_arg.h
+ *
+ * $Id$
+ *
+ * Thru-POA/skeleton argument selection function templates.
+ * @par
+ * These function templates are used to choose between arguments
+ * supplied in thru-POA collocated invocations and arguments in
+ * uncollocated invocations.
+ *
+ * @note A function template approach is used to avoid complicated
+ * argument conversions between stub supplied arguments and
+ * skeleton supplied ones. For example, it is possible to make
+ * argument selection more transparent by taking advantage of
+ * run-time polymorphism. However, that approach would incur
+ * additional footprint overhead on the client side due to the
+ * introduction of virtual tables, etc.
+ *
+ * @author Ossama Othman
+ */
+//=============================================================================
+
+#ifndef TAO_GET_ARG_H
+#define TAO_GET_ARG_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/operation_details.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Portable_Server
+ {
+ /// Get return value/argument.
+ template<typename T>
+ typename TAO::SArg_Traits<T>::ret_arg_type
+ get_ret_arg (TAO_Operation_Details const * details,
+ TAO::Argument * const * skel_args)
+ {
+ return
+ (details != 0 && details->args () != 0)
+ ? static_cast<typename TAO::Arg_Traits<T>::ret_val *> (
+ details->args ()[0])->arg ()
+ : static_cast<typename TAO::SArg_Traits<T>::ret_val *> (
+ skel_args[0])->arg ();
+ }
+
+ /// Get "in" argument.
+ template<typename T>
+ typename TAO::SArg_Traits<T>::in_arg_type
+ get_in_arg (TAO_Operation_Details const * details,
+ TAO::Argument * const * skel_args,
+ size_t i)
+ {
+ return
+ (details != 0 && details->args () != 0)
+ ? static_cast<typename TAO::Arg_Traits<T>::in_arg_val *> (
+ details->args ()[i])->arg ()
+ : static_cast<typename TAO::SArg_Traits<T>::in_arg_val *> (
+ skel_args[i])->arg ();
+ }
+
+ /// Get "inout" argument.
+ template<typename T>
+ typename TAO::SArg_Traits<T>::inout_arg_type
+ get_inout_arg (TAO_Operation_Details const * details,
+ TAO::Argument * const * skel_args,
+ size_t i)
+ {
+ return
+ (details != 0 && details->args () != 0)
+ ? static_cast<typename TAO::Arg_Traits<T>::inout_arg_val *> (
+ details->args ()[i])->arg ()
+ : static_cast<typename TAO::SArg_Traits<T>::inout_arg_val *> (
+ skel_args[i])->arg ();
+ }
+
+ /// Get "out" argument.
+ template<typename T>
+ typename TAO::SArg_Traits<T>::out_arg_type
+ get_out_arg (TAO_Operation_Details const * details,
+ TAO::Argument * const * skel_args,
+ size_t i)
+ {
+ return
+ (details != 0 && details->args () != 0)
+ ? static_cast<typename TAO::Arg_Traits<T>::out_arg_val *> (
+ details->args ()[i])->arg ()
+ : static_cast<typename TAO::SArg_Traits<T>::out_arg_val *> (
+ skel_args[i])->arg ();
+ }
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_GET_ARG_H*/
diff --git a/TAO/tao/PortableServer/poa_macros.h b/TAO/tao/PortableServer/poa_macros.h
new file mode 100644
index 00000000000..4ef9552bfd4
--- /dev/null
+++ b/TAO/tao/PortableServer/poa_macros.h
@@ -0,0 +1,43 @@
+// -*- C++ -*-
+
+// $Id$
+
+#ifndef TAO_POA_MACROS_H
+#define TAO_POA_MACROS_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+#include "ace/CORBA_macros.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#define TAO_OBJECT_ADAPTER_GUARD \
+ ACE_GUARD_THROW_EX (ACE_Lock, \
+ monitor, \
+ this->lock (), \
+ CORBA::OBJ_ADAPTER ()); \
+ ACE_CHECK
+
+#define TAO_OBJECT_ADAPTER_GUARD_RETURN(RETURN) \
+ ACE_GUARD_THROW_EX (ACE_Lock, \
+ monitor, \
+ this->lock (), \
+ CORBA::OBJ_ADAPTER ()); \
+ ACE_CHECK_RETURN (RETURN)
+
+#define TAO_POA_GUARD \
+ TAO::Portable_Server::POA_Guard poa_guard (*this ACE_ENV_ARG_PARAMETER); \
+ ACE_UNUSED_ARG (poa_guard); \
+ ACE_CHECK
+
+#define TAO_POA_GUARD_RETURN(RETURN) \
+ TAO::Portable_Server::POA_Guard poa_guard (*this ACE_ENV_ARG_PARAMETER); \
+ ACE_UNUSED_ARG (poa_guard); \
+ ACE_CHECK_RETURN (RETURN)
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_POA_MACROS_H */
diff --git a/TAO/tao/PortableServer/portableserver_export.h b/TAO/tao/PortableServer/portableserver_export.h
new file mode 100644
index 00000000000..81c9200c157
--- /dev/null
+++ b/TAO/tao/PortableServer/portableserver_export.h
@@ -0,0 +1,40 @@
+
+// -*- C++ -*-
+// $Id$
+// Definition for Win32 Export directives.
+// This file is generated automatically by generate_export_file.pl
+// ------------------------------
+#ifndef TAO_PORTABLESERVER_EXPORT_H
+#define TAO_PORTABLESERVER_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if defined (TAO_AS_STATIC_LIBS)
+# if !defined (TAO_PORTABLESERVER_HAS_DLL)
+# define TAO_PORTABLESERVER_HAS_DLL 0
+# endif /* ! TAO_PORTABLESERVER_HAS_DLL */
+#else
+# if !defined (TAO_PORTABLESERVER_HAS_DLL)
+# define TAO_PORTABLESERVER_HAS_DLL 1
+# endif /* ! TAO_PORTABLESERVER_HAS_DLL */
+#endif
+
+#if defined (TAO_PORTABLESERVER_HAS_DLL) && (TAO_PORTABLESERVER_HAS_DLL == 1)
+# if defined (TAO_PORTABLESERVER_BUILD_DLL)
+# define TAO_PortableServer_Export ACE_Proper_Export_Flag
+# define TAO_PORTABLESERVER_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# define TAO_PORTABLESERVER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# else /* TAO_PORTABLESERVER_BUILD_DLL */
+# define TAO_PortableServer_Export ACE_Proper_Import_Flag
+# define TAO_PORTABLESERVER_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# define TAO_PORTABLESERVER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# endif /* TAO_PORTABLESERVER_BUILD_DLL */
+#else /* TAO_PORTABLESERVER_HAS_DLL == 1 */
+# define TAO_PortableServer_Export
+# define TAO_PORTABLESERVER_SINGLETON_DECLARATION(T)
+# define TAO_PORTABLESERVER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+#endif /* TAO_PORTABLESERVER_HAS_DLL == 1 */
+
+#endif /* TAO_PORTABLESERVER_EXPORT_H */
+
+// End of auto generated file.
diff --git a/TAO/tao/Principal.cpp b/TAO/tao/Principal.cpp
new file mode 100644
index 00000000000..f7fed0a138c
--- /dev/null
+++ b/TAO/tao/Principal.cpp
@@ -0,0 +1,67 @@
+// $Id$
+
+// Copyright 1994-1995 by Sun Microsystems Inc.
+// All Rights Reserved
+// ORB: Principal identifier pseudo-objref
+
+#include "tao/Principal.h"
+#include "tao/CDR.h"
+
+#if !defined (__ACE_INLINE__)
+#include "tao/Principal.i"
+#endif /* __ACE_INLINE__ */
+
+ACE_RCSID (tao,
+ Principal,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+CORBA::Principal::Principal (void)
+ : refcount_ (1)
+{
+}
+
+CORBA::Principal::~Principal (void)
+{
+}
+
+CORBA::Boolean
+operator<< (TAO_OutputCDR & cdr, CORBA::Principal * x)
+{
+ if (x != 0)
+ {
+ CORBA::ULong length = x->id.length ();
+ cdr.write_long (length);
+ cdr.write_octet_array (x->id.get_buffer (), length);
+ }
+ else
+ {
+ cdr.write_ulong (0);
+ }
+
+ return (CORBA::Boolean) cdr.good_bit ();
+}
+
+CORBA::Boolean
+operator>> (TAO_InputCDR & cdr, CORBA::Principal *& x)
+{
+ CORBA::ULong length;
+ cdr.read_ulong (length);
+
+ if (length == 0 || !cdr.good_bit ())
+ {
+ x = 0;
+ }
+ else
+ {
+ ACE_NEW_RETURN (x, CORBA::Principal, 0);
+ x->id.length (length);
+ cdr.read_octet_array (x->id.get_buffer (), length);
+ }
+
+ return (CORBA::Boolean) cdr.good_bit ();
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Principal.h b/TAO/tao/Principal.h
new file mode 100644
index 00000000000..4607ce51e5c
--- /dev/null
+++ b/TAO/tao/Principal.h
@@ -0,0 +1,115 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Principal.h
+ *
+ * $Id$
+ *
+ * The CORBA::Principal pseudo-object implementation.
+ *
+ * @author Copyright 1994-1995 by Sun Microsystems Inc.
+ * @author DOC group at Wash U and UCI.
+ */
+//=============================================================================
+
+
+#ifndef TAO_PRINCIPAL_H
+#define TAO_PRINCIPAL_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/CORBA_methods.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/OctetSeqC.h"
+#include "tao/Pseudo_VarOut_T.h"
+
+#include "ace/Thread_Mutex.h"
+#include "ace/Atomic_Op.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace CORBA
+{
+ class Principal;
+ typedef Principal *Principal_ptr;
+
+ typedef TAO_Pseudo_Var_T<Principal> Principal_var;
+ typedef TAO_Pseudo_Out_T<Principal> Principal_out;
+
+ /**
+ * @class Principal
+ *
+ * @brief A "Principal" identifies an authenticated entity in the
+ * network administration framework.
+ *
+ * Identities are used to control acccess (authorization) as well as
+ * in audit trails (accountability).
+ *
+ * @note This CORBA feature has been deprecated by the OMG. Use the
+ * CORBA Security Service instead.
+ */
+ class TAO_Export Principal
+ {
+ public:
+ // To applications, the identifier is an opaque ID.
+
+ // CORBA::SEQUENCE <CORBA::Octet> id;
+ CORBA::OctetSeq id;
+
+ // @@ add "==", "<", ">" operators
+
+ // The pseudo object operations.
+ static Principal * _duplicate (Principal *);
+ static Principal * _nil (void);
+
+ // = Stuff required for memory management.
+ unsigned long _incr_refcnt (void);
+ unsigned long _decr_refcnt (void);
+
+ Principal (void);
+
+ // Useful for template programming.
+ typedef Principal_ptr _ptr_type;
+ typedef Principal_var _var_type;
+
+ protected:
+
+ /// Destructor
+ /**
+ * Protected destructor to enforce proper memory management
+ * through the reference counting mechanism.
+ */
+ ~Principal (void);
+
+ private:
+
+ // = Prevent copying
+ Principal &operator = (const CORBA::Principal_ptr &);
+ Principal (const CORBA::Principal_ptr &);
+
+ private:
+ /// Reference counter.
+ ACE_Atomic_Op<TAO_SYNCH_MUTEX, unsigned long> refcount_;
+ };
+} // End CORBA namespace
+
+TAO_Export CORBA::Boolean
+operator<< (TAO_OutputCDR &, CORBA::Principal *);
+
+TAO_Export CORBA::Boolean
+operator>> (TAO_InputCDR &, CORBA::Principal *&);
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/Principal.i"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_PRINCIPAL_H */
diff --git a/TAO/tao/Principal.i b/TAO/tao/Principal.i
new file mode 100644
index 00000000000..8ea7d1f905f
--- /dev/null
+++ b/TAO/tao/Principal.i
@@ -0,0 +1,64 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+CORBA::Boolean
+CORBA::is_nil (CORBA::Principal_ptr principal)
+{
+ return principal == 0;
+}
+
+ACE_INLINE
+unsigned long
+CORBA::Principal::_decr_refcnt (void)
+{
+ unsigned long new_count = --this->refcount_;
+
+ if (new_count == 0)
+ delete this;
+
+ return new_count;
+}
+
+ACE_INLINE
+void
+CORBA::release (CORBA::Principal_ptr principal)
+{
+ if (principal)
+ {
+ principal->_decr_refcnt ();
+ }
+}
+
+ACE_INLINE
+unsigned long
+CORBA::Principal::_incr_refcnt (void)
+{
+ return ++this->refcount_;
+}
+
+
+ACE_INLINE
+CORBA::Principal *
+CORBA::Principal::_duplicate (CORBA::Principal * x)
+{
+ if (x != 0)
+ {
+ x->_incr_refcnt ();
+ }
+
+ return x;
+}
+
+
+ACE_INLINE
+CORBA::Principal *
+CORBA::Principal::_nil (void)
+{
+ return 0;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Profile.cpp b/TAO/tao/Profile.cpp
new file mode 100644
index 00000000000..4485d84c13d
--- /dev/null
+++ b/TAO/tao/Profile.cpp
@@ -0,0 +1,977 @@
+// $Id$
+
+#include "tao/Profile.h"
+#include "tao/Messaging_PolicyValueC.h"
+#include "tao/Stub.h"
+#include "tao/debug.h"
+#include "tao/target_specification.h"
+#include "tao/ORB_Core.h"
+#include "tao/Client_Strategy_Factory.h"
+#include "tao/CDR.h"
+#include "tao/SystemException.h"
+#include "tao/PolicyC.h"
+#include "tao/Endpoint.h"
+
+#include "ace/ACE.h"
+#include "ace/OS_NS_string.h"
+#include "ace/os_include/os_ctype.h"
+
+#if !defined (__ACE_INLINE__)
+#include "tao/Profile.i"
+#endif /* __ACE_INLINE__ */
+
+
+ACE_RCSID (tao,
+ Profile,
+ "$Id$")
+
+// ****************************************************************
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Profile::TAO_Profile (CORBA::ULong tag,
+ TAO_ORB_Core *orb_core,
+ const TAO::ObjectKey &obj_key,
+ const TAO_GIOP_Message_Version &version)
+ : version_ (version)
+ , are_policies_parsed_ (false)
+ , addressing_mode_ (0)
+ , tagged_profile_ (0)
+ , ref_object_key_ (0)
+ , tag_ (tag)
+ , orb_core_ (orb_core)
+ , forward_to_ (0)
+ , refcount_ (this->orb_core_->
+ client_factory ()->create_profile_refcount ())
+{
+ (void) this->orb_core_->object_key_table ().bind (obj_key,
+ this->ref_object_key_);
+}
+
+TAO_Profile::TAO_Profile (CORBA::ULong tag,
+ TAO_ORB_Core *orb_core,
+ const TAO_GIOP_Message_Version &version)
+ : version_ (version)
+ , are_policies_parsed_ (false)
+ , addressing_mode_ (0)
+ , tagged_profile_ (0)
+ , ref_object_key_ (0)
+ , tag_ (tag)
+ , orb_core_ (orb_core)
+ , forward_to_ (0)
+ , refcount_ (this->orb_core_->
+ client_factory ()->create_profile_refcount ())
+{
+}
+
+TAO_Profile::~TAO_Profile (void)
+{
+ if (this->tagged_profile_)
+ {
+ delete this->tagged_profile_;
+ }
+
+ this->orb_core_->object_key_table ().unbind (this->ref_object_key_);
+
+ //@@ TAO_PROFILE_SPL_DESTRUCTOR_ADD_HOOK
+}
+
+unsigned long
+TAO_Profile::_incr_refcnt (void)
+{
+ return this->refcount_.increment ();
+}
+
+unsigned long
+TAO_Profile::_decr_refcnt (void)
+{
+ unsigned long count = this->refcount_.decrement ();
+ if (count != 0)
+ return count;
+
+ // refcount is 0, so delete us!
+ // delete will call our ~ destructor which in turn deletes stuff.
+ delete this;
+ return 0;
+}
+
+void
+TAO_Profile::add_tagged_component (const IOP::TaggedComponent &component
+ ACE_ENV_ARG_DECL)
+{
+ // Sanity checks.
+ this->verify_orb_configuration (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->verify_profile_version (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // ----------------------------------------------------------------
+
+ // Add the given tagged component to this profile.
+ //
+ // Note that multiple tagged profiles with the same tag value may be
+ // added, unless the tagged component is known to be unique by TAO.
+ this->tagged_components_.set_component (component);
+}
+
+TAO::ObjectKey *
+TAO_Profile::_key (void) const
+{
+ TAO::ObjectKey *key = 0;
+
+ if (this->ref_object_key_)
+ {
+ ACE_NEW_RETURN (key,
+ TAO::ObjectKey (this->ref_object_key_->object_key ()),
+ 0);
+ }
+ return key;
+}
+
+
+int
+TAO_Profile::encode (TAO_OutputCDR &stream) const
+{
+ // UNSIGNED LONG, protocol tag
+ stream.write_ulong (this->tag_);
+
+ // Create the encapsulation....
+ TAO_OutputCDR encap (ACE_CDR::DEFAULT_BUFSIZE,
+ TAO_ENCAP_BYTE_ORDER,
+ this->orb_core ()->output_cdr_buffer_allocator (),
+ this->orb_core ()->output_cdr_dblock_allocator (),
+ this->orb_core ()->output_cdr_msgblock_allocator (),
+ this->orb_core ()->orb_params ()->cdr_memcpy_tradeoff (),
+ TAO_DEF_GIOP_MAJOR,
+ TAO_DEF_GIOP_MINOR);
+
+ // Create the profile body
+ this->create_profile_body (encap);
+
+ // write the encapsulation as an octet sequence...
+ stream << CORBA::ULong (encap.total_length ());
+ stream.write_octet_array_mb (encap.begin ());
+
+ return 1;
+}
+
+int
+TAO_Profile::decode (TAO_InputCDR& cdr)
+{
+ size_t const encap_len = cdr.length ();
+
+ // Read and verify major, minor versions, ignoring profiles
+ // whose versions we don't understand.
+ if (!(cdr.read_octet (this->version_.major)
+ && this->version_.major == TAO_DEF_GIOP_MAJOR
+ && cdr.read_octet (this->version_.minor)
+ && this->version_.minor <= TAO_DEF_GIOP_MINOR))
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - Profile::decode - v%d.%d\n"),
+ this->version_.major,
+ this->version_.minor));
+ }
+
+ return -1;
+ }
+
+ // Transport specific details
+ if (this->decode_profile (cdr) < 0)
+ {
+ return -1;
+ }
+
+ // @@NOTE: This place *may* need strategizing. Here are the
+ // issues. Placing the ObjectKey in the table adds an allocation and
+ // a lock while decoding. This is bad for some cases especially if
+ // the application is marshalling object references across to the
+ // server end. But the server could use "lazy" evaluation and avoid
+ // this during marshalling.
+ //
+ // The only place this will get important is when a thead tries to
+ // use the object reference to create a CORBA object to make an
+ // invocation. Since creation of a CORBA object itself is expensive,
+ // it looks like we may not need to worry much.
+ //
+ // Remember strategizing needs reconciliation of forces imposed
+ // by runtime memory growth. Doing a random strategization would
+ // destroy the wins in runtime memory growth got by using this
+ // table scheme.
+ TAO::ObjectKey ok;
+
+ // ... and object key.
+ if (TAO::ObjectKey::demarshal_key (ok,
+ cdr) == 0)
+ {
+ return -1;
+ }
+
+ TAO::ObjectKey_Table &okt = this->orb_core ()->object_key_table ();
+
+ if (okt.bind (ok, this->ref_object_key_) == -1)
+ {
+ return -1;
+ }
+
+ // Tagged Components *only* exist after version 1.0!
+ // For GIOP 1.2, IIOP and GIOP have same version numbers!
+ if (this->version_.major > 1
+ || this->version_.minor > 0)
+ {
+ if (this->tagged_components_.decode (cdr) == 0)
+ {
+ return -1;
+ }
+ }
+
+ if (cdr.length () != 0 && TAO_debug_level)
+ {
+ // If there is extra data in the profile we are supposed to
+ // ignore it, but print a warning just in case...
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("%d bytes out of %d left after profile data\n"),
+ cdr.length (),
+ encap_len));
+ }
+
+ // Decode any additional endpoints per profile. This is used by RTCORBA
+ // and by IIOP when TAG_ALTERNATE_IIOP_ADDRESS components are present.
+ if (this->decode_endpoints () == -1)
+ {
+ return -1;
+ }
+
+ return 1;
+}
+
+IOP::TaggedProfile *
+TAO_Profile::create_tagged_profile (void)
+{
+ if (this->tagged_profile_ == 0)
+ {
+ ACE_NEW_RETURN (this->tagged_profile_,
+ IOP::TaggedProfile,
+ 0);
+
+ // As we have not created we will now create the TaggedProfile
+ this->tagged_profile_->tag = this->tag_;
+
+ // Create the encapsulation....
+ TAO_OutputCDR encap (ACE_DEFAULT_CDR_BUFSIZE,
+ TAO_ENCAP_BYTE_ORDER,
+ this->orb_core ()->output_cdr_buffer_allocator (),
+ this->orb_core ()->output_cdr_dblock_allocator (),
+ this->orb_core ()->output_cdr_msgblock_allocator (),
+ this->orb_core ()->orb_params ()->cdr_memcpy_tradeoff (),
+ TAO_DEF_GIOP_MAJOR,
+ TAO_DEF_GIOP_MINOR);
+
+ // Create the profile body
+ this->create_profile_body (encap);
+
+ CORBA::ULong const length =
+ static_cast <CORBA::ULong> (encap.total_length ());
+
+#if (TAO_NO_COPY_OCTET_SEQUENCES == 1)
+ // Place the message block in to the Sequence of Octets that we
+ // have
+ this->tagged_profile_->profile_data.replace (length,
+ encap.begin ());
+#else
+ this->tagged_profile_->profile_data.length (length);
+ CORBA::Octet *buffer =
+ this->tagged_profile_->profile_data.get_buffer ();
+
+ for (const ACE_Message_Block *i = encap.begin ();
+ i != encap.end ();
+ i = i->next ())
+ {
+ ACE_OS::memcpy (buffer, i->rd_ptr (), i->length ());
+ buffer += i->length ();
+ }
+#endif /* TAO_NO_COPY_OCTET_SEQUENCES == 1 */
+ }
+
+ return this->tagged_profile_;
+}
+
+void
+TAO_Profile::set_tagged_components (TAO_OutputCDR &out_cdr)
+{
+ CORBA::ULong const length = static_cast <CORBA::ULong> (out_cdr.total_length ());
+
+ IOP::TaggedComponent tagged_component;
+ tagged_component.tag = TAO_TAG_ENDPOINTS;
+ tagged_component.component_data.length (length);
+ CORBA::Octet *buf =
+ tagged_component.component_data.get_buffer ();
+
+ for (const ACE_Message_Block *iterator = out_cdr.begin ();
+ iterator != 0;
+ iterator = iterator->cont ())
+ {
+ size_t const i_length = iterator->length ();
+ ACE_OS::memcpy (buf, iterator->rd_ptr (), i_length);
+
+ buf += i_length;
+ }
+
+ // Add component with encoded endpoint data to this profile's
+ // TaggedComponents.
+ tagged_components_.set_component (tagged_component);
+}
+
+
+void
+TAO_Profile::policies (CORBA::PolicyList *policy_list
+ ACE_ENV_ARG_DECL)
+{
+#if (TAO_HAS_CORBA_MESSAGING == 1)
+
+ if (policy_list == 0)
+ {
+ if (TAO_debug_level)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO_Profile::policies: ")
+ ACE_TEXT ("Null Policy List!\n")));
+ }
+
+ return;
+ }
+
+ Messaging::PolicyValue pv;
+ Messaging::PolicyValueSeq policy_value_seq;
+
+ size_t length;
+ CORBA::Octet *buf = 0;
+
+ policy_value_seq.length (policy_list->length ());
+
+ // This loop iterates through CORBA::PolicyList to convert
+ // each CORBA::Policy into a CORBA::PolicyValue
+ const size_t plen = policy_list->length ();
+
+ for (CORBA::ULong i = 0; i < plen; ++i)
+ {
+ TAO_OutputCDR out_CDR;
+ policy_value_seq[i].ptype =
+ (*policy_list)[i]->policy_type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ out_CDR << ACE_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER);
+ (*policy_list)[i]->_tao_encode (out_CDR);
+
+ length = out_CDR.total_length ();
+ policy_value_seq[i].pvalue.length (static_cast <CORBA::ULong>(length));
+
+ buf = policy_value_seq[i].pvalue.get_buffer ();
+
+ // Copy the CDR buffer data into the octet sequence buffer.
+
+ for (const ACE_Message_Block *iterator = out_CDR.begin ();
+ iterator != 0;
+ iterator = iterator->cont ())
+ {
+ ACE_OS::memcpy (buf, iterator->rd_ptr (), iterator->length ());
+ buf += iterator->length ();
+ }
+ }
+
+ TAO_OutputCDR out_cdr;
+ // Now we have to embed the Messaging::PolicyValueSeq into
+ // a TaggedComponent.
+
+ IOP::TaggedComponent tagged_component;
+ tagged_component.tag = Messaging::TAG_POLICIES;
+
+ out_cdr << ACE_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER);
+ out_cdr << policy_value_seq;
+
+ length = out_cdr.total_length ();
+
+ tagged_component.component_data.length (static_cast <CORBA::ULong>(length));
+ buf = tagged_component.component_data.get_buffer ();
+
+ for (const ACE_Message_Block *iterator = out_cdr.begin ();
+ iterator != 0;
+ iterator = iterator->cont ())
+ {
+ size_t const i_length = iterator->length ();
+ ACE_OS::memcpy (buf, iterator->rd_ptr (), i_length);
+
+ buf += i_length;
+ }
+
+ // Eventually we add the TaggedComponent to the TAO_TaggedComponents
+ // member variable.
+ tagged_components_.set_component (tagged_component);
+ this->are_policies_parsed_ = true;
+
+#else /* TAO_HAS_CORBA_MESSAGING == 1 */
+
+ ACE_UNUSED_ARG (policy_list);
+ ACE_ENV_ARG_NOT_USED; // FUZZ: ignore check_for_ace_check
+
+#endif /* TAO_HAS_CORBA_MESSAGING == 1 */
+}
+
+
+
+void
+TAO_Profile::get_policies (CORBA::PolicyList& pl
+ ACE_ENV_ARG_DECL)
+{
+#if (TAO_HAS_CORBA_MESSAGING == 1) && !defined (CORBA_E_MICRO)
+
+ if (!this->are_policies_parsed_)
+ // None has already parsed the policies.
+ {
+ IOP::TaggedComponent tagged_component;
+ tagged_component.tag = Messaging::TAG_POLICIES;
+
+ // This gets a component with the proper "tag" field
+ // if it exists.
+ if (this->tagged_components_.get_component (tagged_component))
+ {
+ const CORBA::Octet *buf =
+ tagged_component.component_data.get_buffer ();
+
+ TAO_InputCDR in_cdr (reinterpret_cast <const char *> (buf),
+ tagged_component.component_data.length ());
+
+ // Extract the Byte Order
+ CORBA::Boolean byte_order;
+
+ if ((in_cdr >> ACE_InputCDR::to_boolean (byte_order)) == 0)
+ {
+ return ;
+ }
+
+ in_cdr.reset_byte_order (static_cast <int> (byte_order));
+
+ // Now we take out the Messaging::PolicyValueSeq out from the
+ // CDR.
+ Messaging::PolicyValueSeq policy_value_seq;
+
+ if (!(in_cdr >> policy_value_seq))
+ {
+ ACE_THROW (CORBA::INV_OBJREF ());
+ }
+
+ // Here we extract the Messaging::PolicyValue out of the sequence
+ // and we convert those into the proper CORBA::Policy
+
+ CORBA::Policy_var policy;
+ CORBA::ULong const length = policy_value_seq.length ();
+
+ // Set the policy list length.
+ pl.length (length);
+
+ for (CORBA::ULong i = 0; i < length; ++i)
+ {
+ ACE_TRY_NEW_ENV
+ {
+ policy =
+ this->orb_core_->orb ()->_create_policy (
+ policy_value_seq[i].ptype
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (!CORBA::is_nil (policy.in ()))
+ {
+ buf = policy_value_seq[i].pvalue.get_buffer ();
+
+ TAO_InputCDR in_cdr (
+ reinterpret_cast <const char*> (buf),
+ policy_value_seq[i].pvalue.length ());
+
+ if (!(in_cdr >> ACE_InputCDR::to_boolean (byte_order)))
+ ACE_TRY_THROW (CORBA::INV_OBJREF ());
+
+ in_cdr.reset_byte_order (static_cast <int> (byte_order));
+
+ policy->_tao_decode (in_cdr);
+ pl[i] = policy._retn ();
+ }
+ else
+ {
+ // This case should occure when in the IOR are
+ // embedded policies that TAO doesn't support,
+ // so as specified by the RT-CORBA
+ // spec. ptc/99-05-03 we just ignore these
+ // un-understood policies.
+
+ if (TAO_debug_level >= 5)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("The IOR contains unsupported ")
+ ACE_TEXT ("policies.\n")));
+ }
+ }
+ ACE_CATCHANY
+ {
+ // This case should occur when in the IOR are
+ // embedded policies that TAO doesn't support, so as
+ // specified by the RT-CORBA spec. ptc/99-05-03 we
+ // just ignore these un-understood policies.
+
+ if (TAO_debug_level >= 5)
+ ACE_PRINT_EXCEPTION(ACE_ANY_EXCEPTION,
+ ACE_TEXT ("IOR contains ")
+ ACE_TEXT ("unsupported policies."));
+ }
+ ACE_ENDTRY;
+ }
+ }
+ }
+
+#else
+ ACE_UNUSED_ARG (pl);
+ ACE_ENV_ARG_NOT_USED; // FUZZ: ignore check_for_ace_check
+#endif /* (TAO_HAS_CORBA_MESSAGING == 1) */
+
+}
+
+
+void
+TAO_Profile::verify_orb_configuration (ACE_ENV_SINGLE_ARG_DECL)
+{
+ // If the ORB isn't configured to support tagged components, then
+ // throw an exception.
+ if (this->orb_core_->orb_params ()->std_profile_components () == 0
+ || !this->orb_core_->orb ()->_use_omg_ior_format ())
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) Cannot add ")
+ ACE_TEXT ("IOP::TaggedComponent to profile.\n")
+ ACE_TEXT ("(%P|%t) Standard profile components ")
+ ACE_TEXT ("have been disabled or URL style IORs\n")
+ ACE_TEXT ("(%P|%t) are in use. Try ")
+ ACE_TEXT ("\"-ORBStdProfileComponents 1\" and/or\n")
+ ACE_TEXT ("(%P|%t) \"-ORBObjRefStyle IOR\".\n")));
+ }
+
+ // According to the Portable Interceptor specification, we're
+ // supposed to throw a CORBA::BAD_PARAM exception if it isn't
+ // possible to add components to the profile.
+ // @todo: We need the proper minor code as soon as the spec is
+ // updated.
+ ACE_THROW (CORBA::BAD_PARAM (
+ CORBA::SystemException::_tao_minor_code (
+ 0,
+ EINVAL),
+ CORBA::COMPLETED_NO));
+ }
+}
+
+void
+TAO_Profile::verify_profile_version (ACE_ENV_SINGLE_ARG_DECL)
+{
+ // GIOP 1.0 does not support tagged components. Throw an exception
+ // if the profile is a GIOP 1.0 profile.
+
+ if (this->version_.major == 1 && this->version_.minor == 0)
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) Cannot add ")
+ ACE_TEXT ("IOP::TaggedComponent to GIOP 1.0")
+ ACE_TEXT ("IOR profile.\n")
+ ACE_TEXT ("(%P|%t) Try using a GIOP 1.1 or ")
+ ACE_TEXT ("greater endpoint.\n")));
+ }
+
+ // According to the Portable Interceptor specification, we're
+ // supposed to throw a CORBA::BAD_PARAM exception if it isn't
+ // possible to add components to the profile.
+ // @todo: We need the proper minor code as soon as the spec is
+ // updated.
+ ACE_THROW (CORBA::BAD_PARAM (
+ CORBA::SystemException::_tao_minor_code (
+ 0,
+ EINVAL),
+ CORBA::COMPLETED_NO));
+ }
+}
+
+int
+TAO_Profile::supports_multicast (void) const
+{
+ // Most profiles do not support multicast endpoints.
+ return 0;
+}
+
+bool
+TAO_Profile::supports_non_blocking_oneways (void) const
+{
+ return !(this->version_.major == 1 && this->version_.minor == 0);
+}
+
+void
+TAO_Profile::addressing_mode (CORBA::Short addr
+ ACE_ENV_ARG_DECL)
+{
+ // ** See race condition note about addressing mode in Profile.h **
+ switch (addr)
+ {
+ case TAO_Target_Specification::Key_Addr:
+ case TAO_Target_Specification::Profile_Addr:
+ case TAO_Target_Specification::Reference_Addr:
+ this->addressing_mode_ = addr;
+ break;
+
+ default:
+ ACE_THROW (CORBA::BAD_PARAM (
+ CORBA::SystemException::_tao_minor_code (
+ 0,
+ EINVAL),
+ CORBA::COMPLETED_NO));
+ }
+}
+
+void
+TAO_Profile::parse_string (const char *ior
+ ACE_ENV_ARG_DECL)
+{
+ if (!ior || !*ior)
+ {
+ ACE_THROW (CORBA::INV_OBJREF (
+ CORBA::SystemException::_tao_minor_code (
+ 0,
+ EINVAL),
+ CORBA::COMPLETED_NO));
+ }
+
+ // Remove the "N.n@" version prefix, if it exists, and verify the
+ // version is one that we accept.
+
+ // Check for version
+ if (isdigit (ior [0]) &&
+ ior[1] == '.' &&
+ isdigit (ior [2]) &&
+ ior[3] == '@')
+ {
+ // @@ This may fail for non-ascii character sets [but take that
+ // with a grain of salt]
+ this->version_.set_version ((char) (ior[0] - '0'),
+ (char) (ior[2] - '0'));
+ ior += 4;
+ // Skip over the "N.n@"
+ }
+ else
+ {
+ // CORBA spec requires 1.0 if a version isn't specified.
+ this->version_.set_version (1, 0);
+ }
+
+ if (this->version_.major != TAO_DEF_GIOP_MAJOR ||
+ this->version_.minor > TAO_DEF_GIOP_MINOR)
+ {
+ ACE_THROW (CORBA::INV_OBJREF (
+ CORBA::SystemException::_tao_minor_code (
+ 0,
+ EINVAL),
+ CORBA::COMPLETED_NO));
+ }
+
+ this->parse_string_i (ior
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::Boolean
+TAO_Profile::is_equivalent (const TAO_Profile *other)
+{
+ CORBA::Boolean result = false;
+ if (other)
+ {
+ TAO_Service_Callbacks::Profile_Equivalence callback
+ = this->is_equivalent_hook (other);
+ switch (callback)
+ {
+ case TAO_Service_Callbacks::DONT_KNOW:
+ return this->tag () == other->tag ()
+ && this->version_ == other->version ()
+ && this->endpoint_count () == other->endpoint_count ()
+ && this->object_key () == other->object_key ()
+ && this->do_is_equivalent (other);
+ case TAO_Service_Callbacks::EQUIVALENT:
+ result = true;
+ break;
+ case TAO_Service_Callbacks::NOT_EQUIVALENT:
+ break;
+ }
+ }
+ return result;
+}
+
+CORBA::Boolean
+TAO_Profile::compare_key (const TAO_Profile *other) const
+{
+ return (this->ref_object_key_ == other->ref_object_key_) ||
+ ((this->ref_object_key_ != 0 &&
+ other->ref_object_key_ != 0 &&
+ this->ref_object_key_->object_key() ==
+ other->ref_object_key_->object_key()));
+}
+
+TAO_Endpoint *
+TAO_Profile::first_filtered_endpoint (void)
+{
+ TAO_Endpoint *ep = this->endpoint();
+ return ep == 0 ? 0 : ep->next_filtered(this->orb_core_,0);
+}
+
+TAO_Endpoint *
+TAO_Profile::next_filtered_endpoint (TAO_Endpoint *source)
+{
+ if (source == 0)
+ return this->first_filtered_endpoint();
+ return source->next_filtered(this->orb_core_,this->endpoint());
+}
+
+void
+TAO_Profile::add_generic_endpoint (TAO_Endpoint *)
+{
+ // noop for the base type
+}
+
+TAO_Service_Callbacks::Profile_Equivalence
+TAO_Profile::is_equivalent_hook (const TAO_Profile *other)
+{
+ // Allow services to apply their own definition of "equivalence."
+ return this->orb_core_->is_profile_equivalent (this, other);
+}
+
+CORBA::ULong
+TAO_Profile::hash_service_i (CORBA::ULong m)
+{
+ return this->orb_core_->hash_service (this, m);
+}
+
+/*
+ * Hook to comment out no op method
+ * in the base class that is specialized in the
+ * derived class.
+ */
+//@@ TAO_PROFILE_SPL_COMMENT_HOOK_START
+
+int
+TAO_Profile::encode_alternate_endpoints(void)
+{
+ // this should be a pure virtual, but there are many
+ // existing specializations that would need to be
+ // modified. This maintains the existing behavior, since
+ // the previous version of the POA did not gather alternate
+ // endpoints.
+
+ return 0;
+}
+
+void
+TAO_Profile::remove_generic_endpoint (TAO_Endpoint *)
+{
+ // default for virtual methods, thus a no-op
+}
+
+//@@ TAO_PROFILE_SPL_COMMENT_HOOK_END
+
+//@@ TAO_PROFILE_SPL_METHODS_ADD_HOOK
+
+// ****************************************************************
+
+TAO_Unknown_Profile::TAO_Unknown_Profile (CORBA::ULong tag,
+ TAO_ORB_Core *orb_core)
+ : TAO_Profile (tag,
+ orb_core,
+ TAO_GIOP_Message_Version (TAO_DEF_GIOP_MAJOR,
+ TAO_DEF_GIOP_MINOR))
+{
+}
+
+TAO_Endpoint*
+TAO_Unknown_Profile::endpoint (void)
+{
+ return 0;
+}
+
+CORBA::ULong
+TAO_Unknown_Profile::endpoint_count (void) const
+{
+ return 0;
+}
+
+void
+TAO_Unknown_Profile::parse_string (const char *
+ ACE_ENV_ARG_DECL_NOT_USED)
+{
+ // @@ THROW something????
+}
+
+void
+TAO_Unknown_Profile::parse_string_i (const char *
+ ACE_ENV_ARG_DECL_NOT_USED)
+{
+ // @@ THROW something????
+}
+
+char
+TAO_Unknown_Profile::object_key_delimiter (void) const
+{
+ return 0;
+}
+
+char *
+TAO_Unknown_Profile::to_string (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+{
+ // @@ THROW something?
+ return 0;
+}
+
+int
+TAO_Unknown_Profile::decode (TAO_InputCDR& cdr)
+{
+ if ((cdr >> this->body_) == 0)
+ {
+ return -1;
+ }
+
+ return 0;
+}
+
+int
+TAO_Unknown_Profile::decode_profile (TAO_InputCDR &)
+{
+ return 0;
+}
+
+int
+TAO_Unknown_Profile::decode_endpoints (void)
+{
+ return 0;
+}
+
+int
+TAO_Unknown_Profile::encode (TAO_OutputCDR &stream) const
+{
+ stream.write_ulong (this->tag ());
+ return (stream << this->body_);
+}
+
+int
+TAO_Unknown_Profile::encode_endpoints (void)
+{
+ return 0;
+}
+
+const TAO::ObjectKey &
+TAO_Unknown_Profile::object_key (void) const
+{
+ // @@ TODO this is wrong, but the function is deprecated anyway....
+ static TAO::ObjectKey empty_key;
+ return empty_key;
+}
+
+TAO::ObjectKey *
+TAO_Unknown_Profile::_key (void) const
+{
+ return 0;
+}
+
+CORBA::Boolean
+TAO_Unknown_Profile::do_is_equivalent (const TAO_Profile* other_profile)
+{
+ const TAO_Unknown_Profile * op =
+ dynamic_cast <const TAO_Unknown_Profile *> (other_profile);
+
+ return (CORBA::Boolean) (op == 0 ? 0 : this->body_ == op->body_);
+}
+
+TAO_Service_Callbacks::Profile_Equivalence
+TAO_Unknown_Profile::is_equivalent_hook (const TAO_Profile * /* other */)
+{
+ // Override the default implementation since we don't need the
+ // additional checks it performs.
+
+ return TAO_Service_Callbacks::DONT_KNOW;
+}
+
+CORBA::ULong
+TAO_Unknown_Profile::hash (CORBA::ULong max
+ ACE_ENV_ARG_DECL_NOT_USED)
+{
+ return (ACE::hash_pjw (reinterpret_cast <const char*>
+ (this->body_.get_buffer ()),
+ this->body_.length ()) % max);
+}
+
+void
+TAO_Unknown_Profile::create_profile_body (TAO_OutputCDR &) const
+{
+ // No idea about the profile body! Just return
+ return;
+}
+
+
+
+// *************************************************************
+// Operators for TAO_opaque encoding and decoding
+// *************************************************************
+
+CORBA::Boolean
+operator<< (TAO_OutputCDR& cdr, const TAO_opaque& x)
+{
+ CORBA::ULong const length = x.length ();
+ cdr.write_ulong (length);
+
+#if (TAO_NO_COPY_OCTET_SEQUENCES == 1)
+ if (x.mb () != 0)
+ {
+ cdr.write_octet_array_mb (x.mb ());
+ }
+ else
+#endif /* TAO_NO_COPY_OCTET_SEQUENCES == 1 */
+ {
+ cdr.write_octet_array (x.get_buffer (), length);
+ }
+
+ return (CORBA::Boolean) cdr.good_bit ();
+}
+
+CORBA::Boolean
+operator>>(TAO_InputCDR& cdr, TAO_opaque& x)
+{
+ CORBA::ULong length;
+ cdr.read_ulong (length);
+
+#if (TAO_NO_COPY_OCTET_SEQUENCES == 1)
+ if(ACE_BIT_DISABLED(cdr.start()->flags(),
+ ACE_Message_Block::DONT_DELETE)
+ && (cdr.orb_core() == 0
+ || 1 == cdr.orb_core()->
+ resource_factory()->
+ input_cdr_allocator_type_locked()
+ )
+ )
+ {
+ x.replace (length, cdr.start ());
+ x.mb ()->wr_ptr (x.mb ()->rd_ptr () + length);
+ cdr.skip_bytes (length);
+ }
+ else
+#endif /* TAO_NO_COPY_OCTET_SEQUENCES == 0 */
+ {
+ x.length (length);
+ cdr.read_octet_array (x.get_buffer (), length);
+ }
+
+ return (CORBA::Boolean) cdr.good_bit ();
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Profile.h b/TAO/tao/Profile.h
new file mode 100644
index 00000000000..dd9ee9ecfca
--- /dev/null
+++ b/TAO/tao/Profile.h
@@ -0,0 +1,461 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Profile.h
+ *
+ * $Id$
+ *
+ * @author Fred Kuhns <fredk@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_PROFILE_H
+#define TAO_PROFILE_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Tagged_Components.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/GIOP_Message_Version.h"
+#include "tao/Refcounted_ObjectKey.h"
+#include "tao/Service_Callbacks.h"
+#include "tao/Configurable_Refcount.h"
+
+ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+class ACE_Lock;
+ACE_END_VERSIONED_NAMESPACE_DECL
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_MProfile;
+class TAO_Stub;
+class TAO_Endpoint;
+class TAO_ORB_Core;
+
+namespace CORBA
+{
+ /// Forward declaration of PolicyList
+ class PolicyList;
+}
+
+/**
+ * @class TAO_Profile
+ *
+ * @brief Defines the Profile interface
+ *
+ * An abstract base class for representing object location
+ * information. This is based on the CORBA IOR definitions.
+ */
+class TAO_Export TAO_Profile
+{
+public:
+
+ /// Constructor
+ TAO_Profile (CORBA::ULong tag,
+ TAO_ORB_Core *orb_core,
+ const TAO_GIOP_Message_Version &version);
+
+ /**
+ * @name Non virtual methods for the profile classes.
+ */
+ //@{
+ /// The tag, each concrete class will have a specific tag value.
+ CORBA::ULong tag (void) const;
+
+ /// Return a pointer to this profile's version. This object
+ /// maintains ownership.
+ const TAO_GIOP_Message_Version &version (void) const;
+
+ /// Get a pointer to the TAO_ORB_Core.
+ TAO_ORB_Core *orb_core (void) const;
+
+ /// Increase the reference count by one on this object.
+ unsigned long _incr_refcnt (void);
+
+ /// Decrement the object's reference count. When this count goes to
+ /// 0 this object will be deleted.
+ unsigned long _decr_refcnt (void);
+
+ /// Keep a pointer to the forwarded profile
+ void forward_to (TAO_MProfile *mprofiles);
+
+ /// MProfile accessor
+ TAO_MProfile* forward_to (void);
+
+ /// Access the tagged components, notice that they they could be
+ /// empty (or ignored) for non-GIOP protocols (and even for GIOP-1.0)
+ const TAO_Tagged_Components& tagged_components (void) const;
+ TAO_Tagged_Components& tagged_components (void);
+
+ /// Add the given tagged component to the profile.
+ void add_tagged_component (const IOP::TaggedComponent &component
+ ACE_ENV_ARG_DECL);
+
+ /**
+ * Return the current addressing mode for this profile.
+ * In almost all cases, this is TAO_Target_Specification::Key_Addr.
+ */
+ CORBA::Short addressing_mode (void) const;
+
+ /// @deprecated Return a reference to the Object Key.
+ const TAO::ObjectKey &object_key (void) const;
+
+ /// Obtain the object key, return 0 if the profile cannot be parsed.
+ /// The memory is owned by the caller!
+ TAO::ObjectKey *_key (void) const;
+ //@}
+
+ /**
+ * @name Template methods that needs to be implemented by the
+ * concrete classes. Some of the methods may be overridden only
+ * under specila circumstances.
+ */
+ //@{
+ /// Encode this profile in a stream, i.e. marshal it.
+ virtual int encode (TAO_OutputCDR &stream) const;
+
+ /// Initialize this object using the given CDR octet string.
+ virtual int decode (TAO_InputCDR& cdr);
+
+ /**
+ * This method is used to get the IOP::TaggedProfile. The profile
+ * information that is received from the server side would have
+ * already been decoded. So this method will just make a
+ * IOP::TaggedProfile struct from the existing information and
+ * return the reference to that. This method is necessary for GIOP
+ * 1.2.
+ */
+ IOP::TaggedProfile *create_tagged_profile (void);
+
+ /// This method sets the client exposed policies, i.e., the ones
+ /// propagated in the IOR, for this profile.
+ virtual void policies (CORBA::PolicyList *policy_list
+ ACE_ENV_ARG_DECL);
+
+ /// Accessor for the client exposed policies of this profile.
+ virtual void get_policies (CORBA::PolicyList &policy_list
+ ACE_ENV_ARG_DECL);
+
+ /// Returns true if this profile can specify multicast endpoints.
+ virtual int supports_multicast (void) const;
+
+ /// Returns true if this profile supports non blocking oneways
+ virtual bool supports_non_blocking_oneways (void) const;
+
+ /**
+ * Set the addressing mode if a remote servant replies with
+ * an addressing mode exception. If this profile doesn't
+ * support a particular addressing mode, this method needs to
+ * be overridden signal the appropriate error.
+ *
+ * ** RACE CONDITION NOTE **
+ *
+ * Currently, getting and setting the addressing mode is not
+ * protected by a mutex. Theoretically, this could cause a race
+ * condition if one thread sends a request, then gets an exception
+ * from the remote servant to change the addressing mode, and then
+ * another thread sends a different request to the same servant
+ * using the wrong addressing mode. The result of this is that
+ * we'll get another address change exception. (Annoying, but not
+ * that bad.)
+ *
+ * In practice at the current time, the above theoretical case
+ * never happens since the target specification always uses the
+ * object key except for MIOP requests. Remote ORBs can't respond
+ * to MIOP requests even to send exceptions, so even in this case,
+ * the race condition can't happen.
+ *
+ * Therefore, for the time being, there is no lock to protect the
+ * addressing mode. Given that the addressing mode is checked in
+ * the critical path, this decision seems like a good thing.
+ */
+ virtual void addressing_mode (CORBA::Short addr_mode
+ ACE_ENV_ARG_DECL);
+
+ /// The object key delimiter.
+ virtual char object_key_delimiter (void) const = 0;
+
+ /// Initialize this object using the given input string.
+ /// Supports URL style of object references
+ virtual void parse_string (const char *string
+ ACE_ENV_ARG_DECL);
+
+ /// Return a string representation for this profile. Client must
+ /// deallocate memory. Only one endpoint is included into the
+ /// string.
+ virtual char* to_string (ACE_ENV_SINGLE_ARG_DECL) = 0;
+
+ /**
+ * Encodes this profile's endpoints into a tagged component.
+ * This is done only if RTCORBA is enabled, since currently this is
+ * the only case when we have more than one endpoint per profile.
+ */
+ virtual int encode_endpoints (void) = 0;
+
+ /**
+ * Encodes this profile's endpoints into protocol specific tagged
+ * components. This is used for non-RTCORBA applications that share
+ * endpoints on profiles. The only known implementation is IIOP, using
+ * TAG_ALTERNATE_IIOP_ADDRESS components.
+ */
+ virtual int encode_alternate_endpoints (void);
+
+ /**
+ * Return a pointer to this profile's endpoint. If the profile
+ * contains more than one endpoint, i.e., a list, the method returns
+ * the head of the list.
+ */
+ virtual TAO_Endpoint *endpoint (void) = 0;
+
+ /// Return how many endpoints this profile contains.
+ virtual CORBA::ULong endpoint_count (void) const = 0;
+
+ /**
+ * Return the first endpoint in the list that matches some filtering
+ * constraint, such as IPv6 compatibility for IIOP endpoints. This
+ * method is implemented in terms of TAO_Endpoint;:next_filtered().
+ */
+ TAO_Endpoint *first_filtered_endpoint (void);
+
+ /// Return the next filtered endpoint in the list after the one
+ /// passed in. This method is implemented in terms of
+ /// TAO_Endpoint;:next_filtered(). If the supplied source endpoint
+ /// is null, this returns the first filtered endpoint.
+ TAO_Endpoint *next_filtered_endpoint (TAO_Endpoint *source);
+
+ /**
+ * Remove the provided endpoint from the profile. Some
+ * subclasses of TAO_Profile already have a protocol-specific
+ * version of remove_endpoint, but this generic interface is
+ * required. The default implementation is a no-op. Protocol
+ * maintainers wishing to add support for the EndpointPolicy must
+ * implement remove_generic_endpoint to call their protocol-specific
+ * version of remove_endpoint
+ */
+ virtual void remove_generic_endpoint (TAO_Endpoint *ep);
+
+ /// Add a protocol-agnostic endpoint
+ virtual void add_generic_endpoint (TAO_Endpoint *ep);
+
+ /// Verify profile equivalance.
+ /**
+ * Two profiles are equivalent if their tag, object_key, version
+ * and all endpoints are the same.
+ *
+ * @see do_is_equivalent_i()
+ * @see is_equivalent_hook()
+ *
+ * @return @c true if this profile is equivalent to @c other_profile.
+ */
+ CORBA::Boolean is_equivalent (const TAO_Profile* other_profile);
+
+ /**
+ * Compare the object key for this profile with that of
+ * another. This is weaker than is_equivalent
+ */
+ CORBA::Boolean compare_key (const TAO_Profile *other) const;
+
+ /// Return a hash value for this object.
+ virtual CORBA::ULong hash (CORBA::ULong max
+ ACE_ENV_ARG_DECL) = 0;
+ //@}
+
+ //@@ TAO_PROFILE_SPL_PUBLIC_METHODS_ADD_HOOK
+
+protected:
+ /// If you have a virtual method you need a virtual dtor.
+ virtual ~TAO_Profile (void);
+
+ /**
+ * @name Protected template methods.
+ */
+ //@{
+ /// Decode the protocol specific profile details.
+ virtual int decode_profile (TAO_InputCDR &cdr) = 0;
+
+ /// Creates an encapsulation of the ProfileBody struct in the @a cdr
+ virtual void create_profile_body (TAO_OutputCDR &cdr) const = 0;
+
+ /**
+ * Helper for decode(). Decodes endpoints from a tagged component.
+ * Decode only if RTCORBA is enabled. Furthermore, we may not find
+ * TAO_TAG_ENDPOINTS component, e.g., if we are talking to nonRT
+ * version of TAO or some other ORB. This is not an error, and we
+ * must proceed. Return 0 on success and -1 on failure.
+ */
+ virtual int decode_endpoints (void) = 0;
+
+ /// Protocol specific implementation of parse_string ()
+ virtual void parse_string_i (const char *string
+ ACE_ENV_ARG_DECL) = 0;
+ //@}
+
+ /// To be used by inherited classes
+ TAO_Profile (CORBA::ULong tag,
+ TAO_ORB_Core *orb_core,
+ const TAO::ObjectKey &key,
+ const TAO_GIOP_Message_Version &version);
+
+ /// Helper method that encodes the endpoints for RTCORBA as
+ /// tagged_components.
+ void set_tagged_components (TAO_OutputCDR &cdr);
+
+ /// Profile equivalence template method invoked on subclasses.
+ /**
+ * TAO_Profile subclasses must implement this template method so
+ * that they can apply their own definition of profile equivalence.
+ */
+ virtual CORBA::Boolean do_is_equivalent (const TAO_Profile * other) = 0;
+
+ /// Allow services to apply their own definition of "equivalence."
+ /**
+ * This method differs from the @c do_is_equivalent() template
+ * method in that it has a default implementation that may or not be
+ * applicable to all TAO_Profile subclasses.
+ */
+ virtual TAO_Service_Callbacks::Profile_Equivalence is_equivalent_hook (
+ const TAO_Profile * other);
+
+ CORBA::ULong hash_service_i (CORBA::ULong m);
+
+private:
+
+ /// This object keeps ownership of this object
+ TAO_MProfile *forward_to_i (void);
+
+ /// Verify that the current ORB's configuration supports tagged
+ /// components in IORs.
+ void verify_orb_configuration (ACE_ENV_SINGLE_ARG_DECL);
+
+ /// Verify that the given profile supports tagged components,
+ /// i.e. is not a GIOP 1.0 profile.
+ void verify_profile_version (ACE_ENV_SINGLE_ARG_DECL);
+
+ // Profiles should not be copied or assigned!
+ TAO_Profile (const TAO_Profile&);
+ void operator= (const TAO_Profile&);
+
+ //@@ TAO_PROFILE_SPL_PROTECTED_METHODS_ADD_HOOK
+
+protected:
+
+ /// IIOP version number.
+ TAO_GIOP_Message_Version version_;
+
+ /// The tagged components
+ TAO_Tagged_Components tagged_components_;
+
+ /// Flag indicating whether the lazy decoding of the client exposed
+ /// policies has taken place.
+ CORBA::Boolean are_policies_parsed_;
+
+ /// The current addressing mode.
+ /// This may be changed if a remote server sends back an address mode
+ /// exception.
+ CORBA::Short addressing_mode_;
+
+ /// Our tagged profile
+ IOP::TaggedProfile *tagged_profile_;
+
+ /// object_key associated with this profile.
+ TAO::Refcounted_ObjectKey *ref_object_key_;
+
+private:
+ /// IOP protocol tag.
+ CORBA::ULong const tag_;
+
+ /// Pointer to the ORB core
+ TAO_ORB_Core * const orb_core_;
+
+ /// The TAO_MProfile which contains the profiles for the forwarded
+ /// object.
+ TAO_MProfile* forward_to_;
+
+ /// Number of outstanding references to this object.
+ TAO_Configurable_Refcount refcount_;
+
+ //@@ TAO_PROFILE_SPL_PRIVATE_DATA_ADD_HOOK
+};
+
+//@@ TAO_PROFILE_SPL_EXTERN_ADD_HOOK
+
+// A helper class to handle the various kinds of octet sequences used
+// inside the ORB.
+
+typedef TAO::unbounded_value_sequence<CORBA::Octet> TAO_opaque;
+
+TAO_Export CORBA::Boolean
+operator<< (TAO_OutputCDR&, const TAO_opaque&);
+
+TAO_Export CORBA::Boolean
+operator>> (TAO_InputCDR&, TAO_opaque&);
+
+/**
+ * @class TAO_Unknown_Profile
+ *
+ * @brief A TAO_Profile class to handle foreign profiles.
+ *
+ * The CORBA spec implies that ORBs must be prepared to save and
+ * pass around profiles for protocols it does not recognize. It is
+ * not mandatory to *use* those profiles but they shouldn't be
+ * dropped.
+ * This class stores the information required to marshal and
+ * demarshal an unknown profile, but simply returns an error if
+ * any of the TAO internal methods are invoked.
+ */
+class TAO_Export TAO_Unknown_Profile : public TAO_Profile
+{
+public:
+ /// Create the profile
+ TAO_Unknown_Profile (CORBA::ULong tag,
+ TAO_ORB_Core *orb_core);
+
+ // = The TAO_Profile methods look above
+ virtual void parse_string (const char *string
+ ACE_ENV_ARG_DECL);
+ virtual char object_key_delimiter (void) const;
+ virtual char* to_string (ACE_ENV_SINGLE_ARG_DECL);
+ virtual int decode (TAO_InputCDR& cdr);
+ virtual int encode (TAO_OutputCDR &stream) const;
+ virtual int encode_endpoints (void);
+ virtual const TAO::ObjectKey &object_key (void) const;
+ virtual TAO::ObjectKey *_key (void) const;
+ virtual TAO_Endpoint *endpoint (void);
+ virtual CORBA::ULong endpoint_count (void) const;
+ virtual CORBA::ULong hash (CORBA::ULong max
+ ACE_ENV_ARG_DECL);
+
+ virtual int decode_profile (TAO_InputCDR &cdr);
+ virtual int decode_endpoints (void);
+
+protected:
+
+ virtual CORBA::Boolean do_is_equivalent (const TAO_Profile* other_profile);
+ virtual TAO_Service_Callbacks::Profile_Equivalence is_equivalent_hook (
+ const TAO_Profile* other_profile);
+
+private:
+ virtual void create_profile_body (TAO_OutputCDR &encap) const;
+
+ virtual void parse_string_i (const char *string
+ ACE_ENV_ARG_DECL);
+private:
+ TAO_opaque body_;
+};
+
+//@@ TAO_PROFILE_SPL_EXTERN_HOOK
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/Profile.i"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_PROFILE_H */
diff --git a/TAO/tao/Profile.i b/TAO/tao/Profile.i
new file mode 100644
index 00000000000..4cbbee30eb3
--- /dev/null
+++ b/TAO/tao/Profile.i
@@ -0,0 +1,67 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE CORBA::ULong
+TAO_Profile::tag (void) const
+{
+ return this->tag_;
+}
+
+ACE_INLINE const TAO_GIOP_Message_Version &
+TAO_Profile::version (void) const
+{
+ return this->version_;
+}
+
+ACE_INLINE TAO_ORB_Core *
+TAO_Profile::orb_core (void) const
+{
+ return this->orb_core_;
+}
+
+ACE_INLINE void
+TAO_Profile::forward_to (TAO_MProfile *mprofiles)
+{
+ this->forward_to_ = mprofiles;
+}
+
+ACE_INLINE TAO_MProfile *
+TAO_Profile::forward_to (void)
+{
+ return this->forward_to_;
+}
+
+ACE_INLINE TAO_MProfile *
+TAO_Profile::forward_to_i (void)
+{
+ return this->forward_to_;
+}
+
+ACE_INLINE const TAO_Tagged_Components&
+TAO_Profile::tagged_components (void) const
+{
+ return this->tagged_components_;
+}
+
+ACE_INLINE TAO_Tagged_Components&
+TAO_Profile::tagged_components (void)
+{
+ return this->tagged_components_;
+}
+
+ACE_INLINE CORBA::Short
+TAO_Profile::addressing_mode (void) const
+{
+ return this->addressing_mode_;
+}
+
+ACE_INLINE const TAO::ObjectKey &
+TAO_Profile::object_key (void) const
+{
+ return this->ref_object_key_->object_key ();
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Profile_Transport_Resolver.cpp b/TAO/tao/Profile_Transport_Resolver.cpp
new file mode 100644
index 00000000000..81d3a67f52d
--- /dev/null
+++ b/TAO/tao/Profile_Transport_Resolver.cpp
@@ -0,0 +1,278 @@
+// $Id$
+
+#include "tao/Profile_Transport_Resolver.h"
+#include "tao/Profile.h"
+#include "tao/Stub.h"
+#include "tao/Transport.h"
+#include "tao/Invocation_Endpoint_Selectors.h"
+#include "tao/ORB_Core.h"
+#include "tao/Thread_Lane_Resources.h"
+#include "tao/Transport_Cache_Manager.h"
+#include "tao/Endpoint_Selector_Factory.h"
+#include "tao/Codeset_Manager.h"
+#include "tao/Connector_Registry.h"
+#include "tao/Transport_Connector.h"
+#include "tao/Endpoint.h"
+#include "tao/SystemException.h"
+#include "tao/Client_Strategy_Factory.h"
+
+#include "ace/Countdown_Time.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/Profile_Transport_Resolver.inl"
+#endif /* __ACE_INLINE__ */
+
+ACE_RCSID (tao,
+ Profile_Transport_Resolver,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+
+ Profile_Transport_Resolver::~Profile_Transport_Resolver (void)
+ {
+ if (this->profile_)
+ {
+ this->profile_->_decr_refcnt ();
+ }
+
+ if (this->transport_)
+ {
+ if (this->is_released_ == false)
+ {
+ this->transport_->make_idle ();
+ }
+
+ this->transport_->remove_reference ();
+ }
+
+ delete this->inconsistent_policies_;
+ }
+
+ void
+ Profile_Transport_Resolver::profile (TAO_Profile *p)
+ {
+ // Dont do anything if the incoming profile is null
+ if (p)
+ {
+ // @note This is just a workaround for a more serious problem
+ // with profile management. This would cover some potential
+ // issues that Ossama is working on. Ossama, please remove
+ // them when you are done.
+ TAO_Profile *tmp = this->profile_;
+
+ (void) p->_incr_refcnt ();
+ this->profile_ = p;
+
+ if (tmp)
+ {
+ (void) tmp->_decr_refcnt ();
+ }
+ }
+ }
+
+
+ void
+ Profile_Transport_Resolver::resolve (ACE_Time_Value *max_time_val
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ ACE_Countdown_Time countdown (max_time_val);
+
+ TAO_Invocation_Endpoint_Selector *es =
+ this->stub_->orb_core ()->endpoint_selector_factory ()->get_selector (
+ ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Select the endpoint
+ es->select_endpoint (this,
+ max_time_val
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (this->transport_ == 0)
+ {
+ ACE_THROW (CORBA::INTERNAL ());
+ }
+
+ const TAO_GIOP_Message_Version& version =
+ this->profile_->version ();
+
+ // Initialize the messaging object
+ if (this->transport_->messaging_init (version.major, version.minor) == -1)
+ {
+ ACE_THROW (CORBA::INTERNAL (
+ CORBA::SystemException::_tao_minor_code (
+ 0,
+ EINVAL),
+ CORBA::COMPLETED_NO));
+ }
+
+ if (!this->transport_->is_tcs_set ())
+ {
+ TAO_Codeset_Manager * const tcm =
+ this->stub_->orb_core ()->codeset_manager ();
+ if (tcm)
+ tcm->set_tcs (*this->profile_, *this->transport_);
+ }
+ }
+
+ bool
+ Profile_Transport_Resolver::try_connect (
+ TAO_Transport_Descriptor_Interface *desc,
+ ACE_Time_Value *max_time_value
+ ACE_ENV_ARG_DECL
+ )
+ {
+ return this->try_connect_i (desc,max_time_value,0 ACE_ENV_ARG_PARAMETER);
+ }
+
+ bool
+ Profile_Transport_Resolver::try_parallel_connect (
+ TAO_Transport_Descriptor_Interface *desc,
+ ACE_Time_Value *max_time_value
+ ACE_ENV_ARG_DECL
+ )
+ {
+ return this->try_connect_i (desc,max_time_value,1 ACE_ENV_ARG_PARAMETER);
+ }
+
+
+ bool
+ Profile_Transport_Resolver::try_connect_i (
+ TAO_Transport_Descriptor_Interface *desc,
+ ACE_Time_Value *max_time_value,
+ bool parallel
+ ACE_ENV_ARG_DECL
+ )
+ {
+ TAO_Connector_Registry *conn_reg =
+ this->stub_->orb_core ()->connector_registry (
+ ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ if (conn_reg == 0)
+ {
+ ACE_THROW_RETURN (CORBA::INTERNAL (
+ CORBA::SystemException::_tao_minor_code (
+ 0,
+ EINVAL),
+ CORBA::COMPLETED_NO),
+ false);
+ }
+
+ ACE_Time_Value connection_timeout;
+
+ bool const is_conn_timeout =
+ this->get_connection_timeout (connection_timeout);
+
+ ACE_Time_Value *max_wait_time =
+ is_conn_timeout ? &connection_timeout : max_time_value;
+
+ if (parallel)
+ {
+ this->transport_ =
+ conn_reg->get_connector (desc->endpoint ()->tag ())->
+ parallel_connect (this,
+ desc,
+ max_wait_time
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+ }
+ else
+ {
+ // Obtain a connection.
+ this->transport_ =
+ conn_reg->get_connector (desc->endpoint ()->tag ())->
+ connect (this,
+ desc,
+ max_wait_time
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+ }
+ // A timeout error occurred.
+ // If the user has set a roundtrip timeout policy, throw a timeout
+ // exception. Otherwise, just fall through and return false to
+ // look at the next endpoint.
+ if (this->transport_ == 0
+ && is_conn_timeout == false
+ && errno == ETIME)
+ {
+ ACE_THROW_RETURN (CORBA::TIMEOUT (
+ CORBA::SystemException::_tao_minor_code (
+ TAO_TIMEOUT_CONNECT_MINOR_CODE,
+ errno),
+ CORBA::COMPLETED_NO),
+ false);
+ }
+ else if (this->transport_ == 0)
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ bool
+ Profile_Transport_Resolver::use_parallel_connect (void) const
+ {
+ TAO_ORB_Core *oc = this->stub_->orb_core();
+ return (oc->orb_params()->use_parallel_connects()
+#if 0 // it was decided that even with blocked connects
+ // parallel connects could be useful, at least for cache
+ // processing.
+ oc->client_factory()->connect_strategy() !=
+ TAO_Client_Strategy_Factory::TAO_BLOCKED_CONNECT
+#endif /* 0 */
+ );
+ }
+
+ bool
+ Profile_Transport_Resolver::get_connection_timeout (
+ ACE_Time_Value &max_wait_time)
+ {
+ bool is_conn_timeout = false;
+
+ // Check for the connection timout policy in the ORB
+ this->stub_->orb_core ()->connection_timeout (this->stub_,
+ is_conn_timeout,
+ max_wait_time);
+
+ return is_conn_timeout;
+ }
+
+
+ void
+ Profile_Transport_Resolver::init_inconsistent_policies (
+ ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ ACE_NEW_THROW_EX (this->inconsistent_policies_,
+ CORBA::PolicyList (0),
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ 0,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ }
+
+
+ int
+ Profile_Transport_Resolver::find_transport (TAO_Transport_Descriptor_Interface *desc)
+ {
+ TAO::Transport_Cache_Manager & cache =
+ this->profile_->orb_core()->lane_resources ().transport_cache();
+
+ // the cache increments the reference count on the transport if the
+ // find is successful. Find_transport uses negative logic in its return,
+ // 0 for success
+ return (cache.find_transport(desc,this->transport_) == 0);
+ }
+
+
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Profile_Transport_Resolver.h b/TAO/tao/Profile_Transport_Resolver.h
new file mode 100644
index 00000000000..34cef016395
--- /dev/null
+++ b/TAO/tao/Profile_Transport_Resolver.h
@@ -0,0 +1,222 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Profile_Transport_Resolver.h
+ *
+ * $Id$
+ *
+ *
+ * @author Balachandran Natarajan <bala@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_PROFILE_TRANSPORT_RESOLVER_H
+#define TAO_PROFILE_TRANSPORT_RESOLVER_H
+
+#include /**/ "ace/pre.h"
+#include "ace/Global_Macros.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/CORBA_macros.h"
+
+#include "tao/SystemException.h"
+
+ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+class ACE_Time_Value;
+ACE_END_VERSIONED_NAMESPACE_DECL
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Stub;
+class TAO_Profile;
+class TAO_Transport;
+class TAO_Endpoint;
+class TAO_Transport_Descriptor_Interface;
+
+namespace CORBA
+{
+ class Environment;
+ class Object;
+ class PolicyList;
+
+ class Object;
+ typedef Object *Object_ptr;
+}
+
+namespace TAO
+{
+ class Synch_Twoway_Invocation;
+
+ /**
+ * @class Profile_Transport_Resolver
+ *
+ * @brief Chooses the profile and a transport for a target object on
+ * which an invocation can be made.
+ *
+ * A target object is represented by multiple profiles, which
+ * theoretically provides multiple paths to the same target
+ * object. This class helps in choosing the right profile, and pick
+ * a transport from cache (or create a new transport if needed) that
+ * represents the profile.
+ */
+ class TAO_Export Profile_Transport_Resolver
+ {
+ public:
+ /// Constructor
+ /**
+ * With @a block we tell whether this resolved should always deliver
+ * a connection by blocking or unblock before the connection is
+ * completely established. Please note that this has *nothing* to
+ * do with the synchronous or asynch connect strategy used for
+ * making connections. This is a local flag used by the clients of
+ * this to dictate some local behavior.
+ */
+ Profile_Transport_Resolver (CORBA::Object *p,
+ TAO_Stub *stub,
+ bool block = true);
+
+ ~Profile_Transport_Resolver (void);
+
+ /// Method where the bunch of the action takes place.
+ /**
+ * This is the entry point from the TAO::Invocation_Adapter
+ * class. This method accesses the endpoint selector factory from
+ * the ORB_Core to decide on the strategy to be used for selecting
+ * the profile.
+ */
+ void resolve (ACE_Time_Value *val
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ //@{
+ /**
+ * @name Accessors and mutators for this class. The following methods
+ * are used by the clients of this class to access strategies and
+ * other internal workings.
+ */
+
+ /// Mutator for profile.
+ void profile (TAO_Profile *pfile);
+
+ /// Accessor for profile.
+ TAO_Profile *profile (void) const;
+
+ /// Accessor for TAO_Stub
+ TAO_Stub *stub (void) const;
+
+ /// Accessor for the target in use
+ CORBA::Object *object (void) const;
+
+ /// Accessor for the transport reserved for this invocation.
+ TAO_Transport *transport (void) const;
+
+ /// See if the transport cache has an available transport and
+ /// use that one rather than trying to connect via the connector.
+ /// Separating this functionality enables the look up of many
+ /// endpoints before trying the more time-consuming trip through
+ /// the actual connector.
+ int find_transport (TAO_Transport_Descriptor_Interface *);
+
+ /// Accessor to indicate whether we should block while
+ /// establishing a connection.
+ bool blocked_connect (void) const;
+ //@}
+
+ /// Signal to let the resolver know that the transport has been
+ /// released back to the cache.
+ void transport_released (void) const;
+
+ /// This is a callback method used by the endpoint selectors to
+ /// delegate the responsibility of reserving a transport from the
+ /// connection cache for this invocation. When the descriptor
+ /// contains more than one endpoint (as part of a linked list) and
+ /// the parallel flag is true then the connector will look for a
+ /// connection on any of the endpoints if it supports that
+ /// behavior, otherwise an ENOTSUP errno will be set and the
+ /// method will return false.
+ bool try_connect (TAO_Transport_Descriptor_Interface *desc,
+ ACE_Time_Value *val
+ ACE_ENV_ARG_DECL);
+
+ bool try_parallel_connect (TAO_Transport_Descriptor_Interface *desc,
+ ACE_Time_Value *val
+ ACE_ENV_ARG_DECL);
+
+ /// This method wraps a call to the orb core to see if parallel
+ /// connection attempts are even desired. This is controlled by
+ /// the -ORBUseParallelConnects 1|0 commandline option.
+ bool use_parallel_connect (void) const;
+
+ /// Initialize the inconsistent policy list that this object has
+ /// cached.
+ void init_inconsistent_policies (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ CORBA::PolicyList *inconsistent_policies (void) const;
+
+ CORBA::PolicyList *steal_inconsistent_policies (void);
+ private:
+
+ /// Helper method to access get the connection timeout from the
+ /// ORB.
+ bool get_connection_timeout (ACE_Time_Value &max_wait_time);
+
+ private:
+ bool try_connect_i (TAO_Transport_Descriptor_Interface *desc,
+ ACE_Time_Value *val,
+ bool parallel
+ ACE_ENV_ARG_DECL);
+
+ /// Target object
+ mutable CORBA::Object *obj_;
+
+ /// Stub object for the target object.
+ TAO_Stub *stub_;
+
+ /// The transport selected for this invocation.
+ TAO_Transport *transport_;
+
+ /// The profile that has been selected for this invocation.
+ TAO_Profile *profile_;
+
+ /// List of inconsistent policies
+ /**
+ * If current effective policies cause the invocation to raise
+ * CORBA::INV_POLICY exception, the conflicting/problematic policies
+ * are stored in this list. This is used by \param
+ * Object::_validate_connection method to inform clients about
+ * causes of invocation failure.
+ * @par
+ * Conflicting policies are only stored in this list if \param
+ * init_inconsistent_policies method has been called prior to the
+ * beginning of invocation. This saves extra work of conflicting
+ * policies 'logging' when it's not needed.
+ *
+ * @note We don't use _var with a reason. Using _var would
+ * involve including the header file for at least
+ * Policy_ForwardC.h, and that is what we precisely want to
+ * avoid.
+ */
+ CORBA::PolicyList *inconsistent_policies_;
+
+ /// Has the transport been idle?
+ mutable bool is_released_;
+
+ /// Should we block while trying to make a connection
+ bool const blocked_;
+ };
+} // TAO namespace end
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/Profile_Transport_Resolver.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /*TAO_PROFILE_TRANSPORT_RESOLVER_H*/
diff --git a/TAO/tao/Profile_Transport_Resolver.inl b/TAO/tao/Profile_Transport_Resolver.inl
new file mode 100644
index 00000000000..3617d71e3da
--- /dev/null
+++ b/TAO/tao/Profile_Transport_Resolver.inl
@@ -0,0 +1,76 @@
+// -*- C++ -*-
+//
+// $Id$
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ ACE_INLINE
+ Profile_Transport_Resolver::Profile_Transport_Resolver (
+ CORBA::Object *p,
+ TAO_Stub *stub,
+ bool block)
+ : obj_ (p)
+ , stub_ (stub)
+ , transport_ (0)
+ , profile_ (0)
+ , inconsistent_policies_ (0)
+ , is_released_ (false)
+ , blocked_ (block)
+ {
+ }
+
+ ACE_INLINE TAO_Stub *
+ Profile_Transport_Resolver::stub (void) const
+ {
+ return this->stub_;
+ }
+
+ ACE_INLINE CORBA::Object_ptr
+ Profile_Transport_Resolver::object (void) const
+ {
+ return this->obj_;
+ }
+
+ ACE_INLINE TAO_Profile *
+ Profile_Transport_Resolver::profile (void) const
+ {
+ return this->profile_;
+ }
+
+ ACE_INLINE TAO_Transport *
+ Profile_Transport_Resolver::transport (void) const
+ {
+ return this->transport_;
+ }
+
+ ACE_INLINE bool
+ Profile_Transport_Resolver::blocked_connect (void) const
+ {
+ return this->blocked_;
+ }
+
+ ACE_INLINE void
+ Profile_Transport_Resolver::transport_released (void) const
+ {
+ this->is_released_ = true;
+ }
+
+ ACE_INLINE CORBA::PolicyList *
+ Profile_Transport_Resolver::inconsistent_policies (void) const
+ {
+ return this->inconsistent_policies_;
+ }
+
+ ACE_INLINE CORBA::PolicyList *
+ Profile_Transport_Resolver::steal_inconsistent_policies (void)
+ {
+ CORBA::PolicyList *tmp = this->inconsistent_policies_;
+ this->inconsistent_policies_ = 0;
+ return tmp;
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Protocol_Factory.cpp b/TAO/tao/Protocol_Factory.cpp
new file mode 100644
index 00000000000..7d67c460789
--- /dev/null
+++ b/TAO/tao/Protocol_Factory.cpp
@@ -0,0 +1,65 @@
+// $Id$
+
+#include "tao/Protocol_Factory.h"
+
+ACE_RCSID (tao,
+ Protocol_Factory,
+ "$Id$")
+
+static const char the_prefix[] = "";
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Protocol_Factory::TAO_Protocol_Factory (CORBA::ULong tag)
+ : tag_ (tag)
+{
+}
+
+TAO_Protocol_Factory::~TAO_Protocol_Factory (void)
+{
+}
+
+CORBA::ULong
+TAO_Protocol_Factory::tag (void) const
+{
+ return this->tag_;
+}
+
+int
+TAO_Protocol_Factory::init (int /* argc */,
+ ACE_TCHAR * /* argv */ [])
+{
+ return -1;
+}
+
+TAO_Acceptor *
+TAO_Protocol_Factory::make_acceptor (void)
+{
+ return 0;
+}
+
+TAO_Connector *
+TAO_Protocol_Factory::make_connector (void)
+{
+ return 0;
+}
+
+int
+TAO_Protocol_Factory::match_prefix (const ACE_CString & /* prefix */)
+{
+ return 0;
+}
+
+const char *
+TAO_Protocol_Factory::prefix (void) const
+{
+ return ::the_prefix;
+}
+
+char
+TAO_Protocol_Factory::options_delimiter (void) const
+{
+ return '\0';
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Protocol_Factory.h b/TAO/tao/Protocol_Factory.h
new file mode 100644
index 00000000000..7e0bcb71b0c
--- /dev/null
+++ b/TAO/tao/Protocol_Factory.h
@@ -0,0 +1,84 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Protocol_Factory.h
+ *
+ * $Id$
+ *
+ * @author Fred Kuhns <fredk@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_PROTOCOL_FACTORY_H
+#define TAO_PROTOCOL_FACTORY_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/TAO_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Basic_Types.h"
+
+#include "ace/Service_Object.h"
+#include "ace/SStringfwd.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Acceptor;
+class TAO_Connector;
+
+class TAO_Export TAO_Protocol_Factory : public ACE_Service_Object
+{
+public:
+ TAO_Protocol_Factory (CORBA::ULong tag);
+ virtual ~TAO_Protocol_Factory (void);
+
+ /// Initialization hook.
+ virtual int init (int argc, ACE_TCHAR *argv[]);
+
+ /// The protocol tag, each concrete class will have a specific tag
+ /// value.
+ CORBA::ULong tag (void) const;
+
+ /// Verify prefix is a match
+ virtual int match_prefix (const ACE_CString &prefix);
+
+ /// Returns the prefix used by the protocol.
+ virtual const char *prefix (void) const;
+
+ /// Return the character used to mark where an endpoint ends and
+ /// where its options begin.
+ virtual char options_delimiter (void) const;
+
+ // Factory methods
+ /// Create an acceptor
+ virtual TAO_Acceptor *make_acceptor (void);
+
+ /// Create a connector
+ virtual TAO_Connector *make_connector (void);
+
+ /**
+ * Some protocols should not create a default endpoint unless the
+ * user specifies a -ORBEndpoint option. For example, local IPC
+ * (aka UNIX domain sockets) is unable to remove the rendesvouz
+ * point if the server crashes. For those protocols it is better to
+ * create the endpoint only if the user requests one.
+ */
+ virtual int requires_explicit_endpoint (void) const = 0;
+
+private:
+
+ /// IOP protocol tag.
+ CORBA::ULong const tag_;
+
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_PROTOCOL_FACTORY_H */
diff --git a/TAO/tao/Protocols_Hooks.cpp b/TAO/tao/Protocols_Hooks.cpp
new file mode 100644
index 00000000000..444d92846a6
--- /dev/null
+++ b/TAO/tao/Protocols_Hooks.cpp
@@ -0,0 +1,59 @@
+// $Id$
+
+#include "tao/Protocols_Hooks.h"
+#include "ace/Dynamic_Service.h"
+
+ACE_RCSID (tao,
+ Protocols_Hooks,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_IIOP_Protocol_Properties::TAO_IIOP_Protocol_Properties (void)
+ : send_buffer_size_ (0),
+ recv_buffer_size_ (0),
+ keep_alive_ (0),
+ dont_route_ (0),
+ no_delay_ (0),
+ enable_network_priority_ (0)
+{
+}
+
+TAO_UIOP_Protocol_Properties::TAO_UIOP_Protocol_Properties (void)
+ : send_buffer_size_ (0),
+ recv_buffer_size_ (0)
+{
+}
+
+TAO_SHMIOP_Protocol_Properties::TAO_SHMIOP_Protocol_Properties (void)
+ : send_buffer_size_ (0),
+ recv_buffer_size_ (0),
+ keep_alive_ (0),
+ dont_route_ (0),
+ no_delay_ (0),
+ preallocate_buffer_size_ (0),
+ mmap_filename_ (),
+ mmap_lockname_ ()
+{
+}
+
+TAO_DIOP_Protocol_Properties::TAO_DIOP_Protocol_Properties (void)
+ : enable_network_priority_ (0)
+{
+}
+
+TAO_SCIOP_Protocol_Properties::TAO_SCIOP_Protocol_Properties (void)
+ : send_buffer_size_ (0),
+ recv_buffer_size_ (0),
+ keep_alive_ (0),
+ dont_route_ (0),
+ no_delay_ (0),
+ enable_network_priority_ (0)
+{
+}
+
+TAO_Protocols_Hooks::~TAO_Protocols_Hooks (void)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Protocols_Hooks.h b/TAO/tao/Protocols_Hooks.h
new file mode 100644
index 00000000000..ddec97f4919
--- /dev/null
+++ b/TAO/tao/Protocols_Hooks.h
@@ -0,0 +1,210 @@
+// -*- C++ -*-
+
+// ===================================================================
+/**
+ * @file Protocols_Hooks.h
+ *
+ * $Id$
+ *
+ * @author Priyanka Gontla <pgontla@ece.uci.edu>
+ */
+// ===================================================================
+
+#ifndef TAO_PROTOCOLS_HOOKS_H
+#define TAO_PROTOCOLS_HOOKS_H
+
+#include /**/ "ace/pre.h"
+#include "ace/CORBA_macros.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/Service_Object.h"
+
+#include "tao/TAO_Export.h"
+#include "tao/Basic_Types.h"
+#include "tao/IOP_IORC.h"
+#include "ace/SString.h"
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace CORBA
+{
+ class Policy;
+ class Environment;
+}
+
+class TAO_ORB_Core;
+class TAO_Service_Context;
+class TAO_Connection_Handler;
+class TAO_Stub;
+
+class TAO_Export TAO_IIOP_Protocol_Properties
+{
+public:
+
+ TAO_IIOP_Protocol_Properties (void);
+
+ CORBA::Long send_buffer_size_;
+ CORBA::Long recv_buffer_size_;
+ int keep_alive_;
+ int dont_route_;
+ int no_delay_;
+ CORBA::Boolean enable_network_priority_;
+};
+
+class TAO_Export TAO_UIOP_Protocol_Properties
+{
+public:
+
+ TAO_UIOP_Protocol_Properties (void);
+
+ CORBA::Long send_buffer_size_;
+ CORBA::Long recv_buffer_size_;
+};
+
+class TAO_Export TAO_SHMIOP_Protocol_Properties
+{
+public:
+
+ TAO_SHMIOP_Protocol_Properties (void);
+
+ CORBA::Long send_buffer_size_;
+ CORBA::Long recv_buffer_size_;
+ int keep_alive_;
+ int dont_route_;
+ int no_delay_;
+ CORBA::Long preallocate_buffer_size_;
+ ACE_CString mmap_filename_;
+ ACE_CString mmap_lockname_;
+};
+
+class TAO_Export TAO_DIOP_Protocol_Properties
+{
+public:
+
+ TAO_DIOP_Protocol_Properties (void);
+
+ CORBA::Boolean enable_network_priority_;
+};
+
+class TAO_Export TAO_SCIOP_Protocol_Properties
+{
+public:
+
+ TAO_SCIOP_Protocol_Properties (void);
+
+ CORBA::Long send_buffer_size_;
+ CORBA::Long recv_buffer_size_;
+ int keep_alive_;
+ int dont_route_;
+ int no_delay_;
+ CORBA::Boolean enable_network_priority_;
+};
+
+class TAO_Export TAO_Protocols_Hooks : public ACE_Service_Object
+{
+public:
+ /// destructor
+ virtual ~TAO_Protocols_Hooks (void);
+
+ /// Initialize the protocols hooks instance.
+ virtual void init_hooks (TAO_ORB_Core *orb_core
+ ACE_ENV_ARG_DECL) = 0;
+
+ virtual CORBA::Boolean set_client_network_priority (IOP::ProfileId protocol_tag,
+ TAO_Stub *stub
+ ACE_ENV_ARG_DECL) = 0;
+
+ virtual CORBA::Boolean set_server_network_priority (IOP::ProfileId protocol_tag,
+ CORBA::Policy *policy
+ ACE_ENV_ARG_DECL) = 0;
+
+ virtual void server_protocol_properties_at_orb_level (TAO_IIOP_Protocol_Properties &protocol_properties
+ ACE_ENV_ARG_DECL) = 0;
+
+ virtual void client_protocol_properties_at_orb_level (TAO_IIOP_Protocol_Properties &protocol_properties
+ ACE_ENV_ARG_DECL) = 0;
+
+ virtual void server_protocol_properties_at_orb_level (TAO_UIOP_Protocol_Properties &protocol_properties
+ ACE_ENV_ARG_DECL) = 0;
+
+ virtual void client_protocol_properties_at_orb_level (TAO_UIOP_Protocol_Properties &protocol_properties
+ ACE_ENV_ARG_DECL) = 0;
+
+ virtual void server_protocol_properties_at_orb_level (TAO_SHMIOP_Protocol_Properties &protocol_properties
+ ACE_ENV_ARG_DECL) = 0;
+
+ virtual void client_protocol_properties_at_orb_level (TAO_SHMIOP_Protocol_Properties &protocol_properties
+ ACE_ENV_ARG_DECL) = 0;
+
+ virtual void server_protocol_properties_at_orb_level (TAO_DIOP_Protocol_Properties &protocol_properties
+ ACE_ENV_ARG_DECL) = 0;
+
+ virtual void client_protocol_properties_at_orb_level (TAO_DIOP_Protocol_Properties &protocol_properties
+ ACE_ENV_ARG_DECL) = 0;
+
+ virtual void server_protocol_properties_at_orb_level (TAO_SCIOP_Protocol_Properties &protocol_properties
+ ACE_ENV_ARG_DECL) = 0;
+
+ virtual void client_protocol_properties_at_orb_level (TAO_SCIOP_Protocol_Properties &protocol_properties
+ ACE_ENV_ARG_DECL) = 0;
+
+ virtual CORBA::Long get_dscp_codepoint (void) = 0;
+
+ virtual void rt_service_context (TAO_Stub *stub,
+ TAO_Service_Context &service_context,
+ CORBA::Boolean restart
+ ACE_ENV_ARG_DECL) = 0;
+
+ virtual void add_rt_service_context_hook (
+ TAO_Service_Context &service_context,
+ CORBA::Policy *model_policy,
+ CORBA::Short &client_priority
+ ACE_ENV_ARG_DECL) = 0;
+
+ virtual void get_selector_hook (CORBA::Policy *model_policy,
+ CORBA::Boolean
+ &is_client_propagated,
+ CORBA::Short &server_priority) = 0;
+
+ virtual void get_selector_bands_policy_hook (CORBA::Policy *bands_policy,
+ CORBA::Short priority,
+ CORBA::Short &min_priority,
+ CORBA::Short &max_priority,
+ int &in_range) = 0;
+
+ /**
+ * @name Accessor and modifier to the current thread priority, used to
+ * implement the RTCORBA::Current interface, but it is faster for
+ * some critical components. If the RTCORBA library isn't used,
+ * these operations are no-ops.
+ */
+ //@{
+ virtual int get_thread_CORBA_priority (CORBA::Short &
+ ACE_ENV_ARG_DECL) = 0;
+
+ virtual int get_thread_native_priority (CORBA::Short &
+ ACE_ENV_ARG_DECL) = 0;
+
+ virtual int get_thread_CORBA_and_native_priority (
+ CORBA::Short &,
+ CORBA::Short &
+ ACE_ENV_ARG_DECL) = 0;
+
+ virtual int set_thread_CORBA_priority (CORBA::Short
+ ACE_ENV_ARG_DECL) = 0;
+
+ virtual int set_thread_native_priority (CORBA::Short
+ ACE_ENV_ARG_DECL) = 0;
+
+ //@}
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_PROTOCOLS_HOOKS_H */
diff --git a/TAO/tao/Pseudo_VarOut_T.cpp b/TAO/tao/Pseudo_VarOut_T.cpp
new file mode 100644
index 00000000000..b63c21b6db9
--- /dev/null
+++ b/TAO/tao/Pseudo_VarOut_T.cpp
@@ -0,0 +1,29 @@
+// $Id$
+
+#ifndef TAO_PSEUDO_VAROUT_T_CPP
+#define TAO_PSEUDO_VAROUT_T_CPP
+
+#include "tao/Pseudo_VarOut_T.h"
+
+#if !defined (__ACE_INLINE__)
+#include "tao/Pseudo_VarOut_T.inl"
+#endif /* __ACE_INLINE__ */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template <typename T>
+TAO_Pseudo_Var_T<T> &
+TAO_Pseudo_Var_T<T>::operator= (const TAO_Pseudo_Var_T<T> & p)
+{
+ if (this != &p)
+ {
+ ::CORBA::release (this->ptr_);
+ this->ptr_ = T::_duplicate (p.ptr ());
+ }
+
+ return *this;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_PSEUDO_VAROUT_T_CPP */
diff --git a/TAO/tao/Pseudo_VarOut_T.h b/TAO/tao/Pseudo_VarOut_T.h
new file mode 100644
index 00000000000..3043b0249e6
--- /dev/null
+++ b/TAO/tao/Pseudo_VarOut_T.h
@@ -0,0 +1,143 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Pseudo_VarOut_T.h
+ *
+ * $Id$
+ *
+ * @note This header should be included after all types to be passed
+ * as template parameters to the TAO_Pseudo_{Var,Out}_T template
+ * classes have been declared. If the types in question are defined
+ * in another header, include that header before this one.
+ * @par
+ * Including other headers like "tao/CORBA_methods.h" here can cause
+ * circular dependency related problems when using compilers that
+ * lookup and bind non-dependent names in templates at definition time
+ * (i.e. while parsing the code) instead of at instantiation time.
+ *
+ * @todo Look into adding a template parameter to each of the
+ * templates in question that would be a trait containing the
+ * means for releasing references managed by the templates.
+ * Doing so should work around the non-dependent name issues in
+ * g++ 3.4, thus easing the requirement that this header be
+ * parsed last.
+ *
+ * -Ossama
+ *
+ *
+ * @author Jeff Parsons
+ */
+//=============================================================================
+
+
+#ifndef TAO_PSEUDO_VAROUT_T_H
+#define TAO_PSEUDO_VAROUT_T_H
+
+#include /**/ "ace/pre.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/varbase.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_Pseudo_Var_T
+ *
+ * @brief Parametrized implementation of _var class for
+ * TypeCode, Object, AbstractBase, NamedValue, NVList,
+ * Principal, Request, Context, ORB, LocalObject,
+ * and Environment.
+ *
+ */
+template <typename T>
+class TAO_Pseudo_Var_T : private TAO_Base_var
+{
+public:
+ TAO_Pseudo_Var_T (void);
+ TAO_Pseudo_Var_T (typename T::_ptr_type);
+ TAO_Pseudo_Var_T (const TAO_Pseudo_Var_T<T> &);
+
+ ~TAO_Pseudo_Var_T (void);
+
+ TAO_Pseudo_Var_T<T> & operator= (typename T::_ptr_type);
+ TAO_Pseudo_Var_T<T> & operator= (const TAO_Pseudo_Var_T<T> &);
+
+ typename T::_ptr_type operator-> (void) const;
+
+ operator typename T::_ptr_type const & () const;
+ operator typename T::_ptr_type & ();
+
+ typedef typename T::_ptr_type _in_type;
+ typedef typename T::_ptr_type & _inout_type;
+ typedef typename T::_ptr_type & _out_type;
+ typedef typename T::_ptr_type _retn_type;
+
+ _in_type in (void) const;
+ _inout_type inout (void);
+ _out_type out (void);
+ _retn_type _retn (void);
+
+ // TAO extension.
+ _retn_type ptr (void) const;
+private:
+
+ // Unimplemented - prevents widening assignment.
+ TAO_Pseudo_Var_T (const TAO_Base_var &);
+ void operator= (const TAO_Base_var &);
+
+private:
+ typename T::_ptr_type ptr_;
+};
+
+/**
+ * @class TAO_Pseudo_Out_T
+ *
+ * @brief Parametrized implementation of _out class for
+ * TypeCode, Object, AbstractBase, NamedValue, NVList,
+ * Principal, Request, Context, ORB, LocalObject,
+ * and Environment.
+ *
+ */
+template <typename T>
+class TAO_Pseudo_Out_T
+{
+public:
+ TAO_Pseudo_Out_T (typename T::_ptr_type &);
+ TAO_Pseudo_Out_T (typename T::_var_type &);
+ TAO_Pseudo_Out_T (const TAO_Pseudo_Out_T<T> &);
+
+ TAO_Pseudo_Out_T<T> & operator= (const TAO_Pseudo_Out_T<T> &);
+ TAO_Pseudo_Out_T<T> & operator= (typename T::_ptr_type);
+
+ operator typename T::_ptr_type & ();
+ typename T::_ptr_type & ptr (void);
+ typename T::_ptr_type operator-> (void);
+
+private:
+ typename T::_ptr_type & ptr_;
+
+ /// Assignment from _var not allowed.
+ TAO_Pseudo_Out_T<T> & operator= (const typename T::_var_type &);
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+#include "tao/Pseudo_VarOut_T.inl"
+#endif /* __ACE_INLINE__ */
+
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+#include "tao/Pseudo_VarOut_T.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
+#pragma implementation ("Pseudo_VarOut_T.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_PSEUDO_VAROUT_T_H */
diff --git a/TAO/tao/Pseudo_VarOut_T.inl b/TAO/tao/Pseudo_VarOut_T.inl
new file mode 100644
index 00000000000..bbfb69aedc8
--- /dev/null
+++ b/TAO/tao/Pseudo_VarOut_T.inl
@@ -0,0 +1,177 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template <typename T>
+ACE_INLINE
+TAO_Pseudo_Var_T<T>::TAO_Pseudo_Var_T (void)
+ : ptr_ (T::_nil ())
+{}
+
+template <typename T>
+ACE_INLINE
+TAO_Pseudo_Var_T<T>::TAO_Pseudo_Var_T (typename T::_ptr_type p)
+ : ptr_ (p)
+{}
+
+template <typename T>
+ACE_INLINE
+TAO_Pseudo_Var_T<T>::TAO_Pseudo_Var_T (const TAO_Pseudo_Var_T<T> & p)
+ : TAO_Base_var ()
+ , ptr_ (T::_duplicate (p.ptr ()))
+{}
+
+template <typename T>
+ACE_INLINE
+TAO_Pseudo_Var_T<T>::~TAO_Pseudo_Var_T (void)
+{
+ ::CORBA::release (this->ptr_);
+}
+
+template <typename T>
+ACE_INLINE
+TAO_Pseudo_Var_T<T> &
+TAO_Pseudo_Var_T<T>::operator= (typename T::_ptr_type p)
+{
+ ::CORBA::release (this->ptr_);
+ this->ptr_ = p;
+ return *this;
+}
+
+template <typename T>
+ACE_INLINE
+TAO_Pseudo_Var_T<T>::operator typename T::_ptr_type const & () const
+{
+ return this->ptr_;
+}
+
+template <typename T>
+ACE_INLINE
+TAO_Pseudo_Var_T<T>::operator typename T::_ptr_type & ()
+{
+ return this->ptr_;
+}
+
+template <typename T>
+ACE_INLINE
+typename T::_ptr_type
+TAO_Pseudo_Var_T<T>::operator-> (void) const
+{
+ return this->ptr_;
+}
+
+template <typename T>
+ACE_INLINE
+typename T::_ptr_type
+TAO_Pseudo_Var_T<T>::in (void) const
+{
+ return this->ptr_;
+}
+
+template <typename T>
+ACE_INLINE
+typename T::_ptr_type &
+TAO_Pseudo_Var_T<T>::inout (void)
+{
+ return this->ptr_;
+}
+
+template <typename T>
+ACE_INLINE
+typename T::_ptr_type &
+TAO_Pseudo_Var_T<T>::out (void)
+{
+ ::CORBA::release (this->ptr_);
+ this->ptr_ = T::_nil ();
+ return this->ptr_;
+}
+
+template <typename T>
+ACE_INLINE
+typename T::_ptr_type
+TAO_Pseudo_Var_T<T>::_retn (void)
+{
+ typename T::_ptr_type val = this->ptr_;
+ this->ptr_ = T::_nil ();
+ return val;
+}
+
+template <typename T>
+ACE_INLINE
+typename T::_ptr_type
+TAO_Pseudo_Var_T<T>::ptr (void) const
+{
+ return this->ptr_;
+}
+
+// *************************************************************
+
+template <typename T>
+ACE_INLINE
+TAO_Pseudo_Out_T<T>::TAO_Pseudo_Out_T (typename T::_ptr_type & p)
+ : ptr_ (p)
+{
+ this->ptr_ = T::_nil ();
+}
+
+template <typename T>
+ACE_INLINE
+TAO_Pseudo_Out_T<T>::TAO_Pseudo_Out_T (typename T::_var_type & p)
+ : ptr_ (p.out ())
+{
+ ::CORBA::release (this->ptr_);
+ this->ptr_ = T::_nil ();
+}
+
+template <typename T>
+ACE_INLINE
+TAO_Pseudo_Out_T<T>::TAO_Pseudo_Out_T (
+ const TAO_Pseudo_Out_T<T> & p
+ )
+ : ptr_ (p.ptr_)
+{}
+
+template <typename T>
+ACE_INLINE
+TAO_Pseudo_Out_T<T> &
+TAO_Pseudo_Out_T<T>::operator= (const TAO_Pseudo_Out_T<T> & p)
+{
+ this->ptr_ = p.ptr_;
+ return *this;
+}
+
+template <typename T>
+ACE_INLINE
+TAO_Pseudo_Out_T<T> &
+TAO_Pseudo_Out_T<T>::operator= (typename T::_ptr_type p)
+{
+ this->ptr_ = p;
+ return *this;
+}
+
+template <typename T>
+ACE_INLINE
+typename T::_ptr_type &
+TAO_Pseudo_Out_T<T>::ptr (void)
+{
+ return this->ptr_;
+}
+
+template <typename T>
+ACE_INLINE
+TAO_Pseudo_Out_T<T>::operator typename T::_ptr_type & ()
+{
+ return this->ptr_;
+}
+
+template <typename T>
+ACE_INLINE
+typename T::_ptr_type
+TAO_Pseudo_Out_T<T>::operator-> (void)
+{
+ return this->ptr_;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/QtResource.mpc b/TAO/tao/QtResource.mpc
new file mode 100644
index 00000000000..9a2f0c5eeb2
--- /dev/null
+++ b/TAO/tao/QtResource.mpc
@@ -0,0 +1,31 @@
+// -*- MPC -*- now wouldn't this be cool...
+// $Id$
+
+project(TAO_QtResource) : acelib, taolib, core, tao_output, taodefaults, ace_qtreactor, tao_versioning_idl_defaults {
+
+ sharedname = TAO_QtResource
+ dynamicflags += TAO_QTRESOURCE_BUILD_DLL
+
+ Source_Files {
+ QtResource
+ }
+
+ Header_Files {
+ QtResource
+ }
+
+ Inline_Files {
+ }
+
+ Template_Files {
+ }
+
+ Resource_Files {
+ }
+
+ PIDL_Files {
+ }
+
+ IDL_Files {
+ }
+}
diff --git a/TAO/tao/QtResource/QtResource_Factory.cpp b/TAO/tao/QtResource/QtResource_Factory.cpp
new file mode 100644
index 00000000000..e14004464f1
--- /dev/null
+++ b/TAO/tao/QtResource/QtResource_Factory.cpp
@@ -0,0 +1,47 @@
+//$Id$
+
+#include "tao/QtResource/QtResource_Factory.h"
+#include "tao/debug.h"
+#include "ace/QtReactor.h"
+
+ACE_RCSID (TAO_QtResource,
+ QtResource_Factory,
+ "$Id$");
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ QtResource_Factory::QtResource_Factory (QApplication *qapp)
+ : reactor_impl_ (0)
+ , qapp_ (qapp)
+ {
+ }
+
+ ACE_Reactor_Impl *
+ QtResource_Factory::reactor_impl (void)
+ { // synchronized by external locks
+ if (this->qapp_ == 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "TAO (%P|%t) - QApplication is undefined.",
+ " Cannot create ACE_XtReactor \n"));
+ return 0;
+ }
+
+ if (!this->reactor_impl_)
+ {
+ ACE_NEW_RETURN (this->reactor_impl_,
+ ACE_QtReactor (qapp_),
+ 0);
+
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - ACE_QtReactor created\n"));
+ }
+
+ return this->reactor_impl_;
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/QtResource/QtResource_Factory.h b/TAO/tao/QtResource/QtResource_Factory.h
new file mode 100644
index 00000000000..8af126b607a
--- /dev/null
+++ b/TAO/tao/QtResource/QtResource_Factory.h
@@ -0,0 +1,68 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file QtResource_Factory.h
+ *
+ * $Id$
+ *
+ * @author Balachandran Natarajan <bala@dre.vanderbilt.edu>
+ * @author Marek Brudka <mbrudka@aster.pl>
+ */
+//=============================================================================
+#ifndef TAO_QTRESOURCE_FACTORY_H
+#define TAO_QTRESOURCE_FACTORY_H
+#include /**/ "ace/pre.h"
+
+#include "tao/QtResource/TAO_QtResource_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include <qapplication.h>
+#include "ace/QtReactor.h"
+#include "tao/GUIResource_Factory.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ /**
+ * @class QtResource_Factory
+ *
+ * @brief TAO_GUI_Resource_Factory for creating QtReactor.
+ *
+ * This factory is intended for creating QtReactor for ORB. This
+ * factory can be feed into ORB using
+ * TAO_ORB_Core::set_gui_resource_factory method which is usually
+ * done by TAO_QtResource_Loader.
+ */
+ class TAO_QtResource_Export QtResource_Factory : public GUIResource_Factory
+ {
+ public:
+
+ QtResource_Factory (QApplication *qapp_);
+
+ protected:
+
+ /// Create or obtain current reactor implementation
+ virtual ACE_Reactor_Impl *reactor_impl (void);
+
+ private:
+
+ /// Reactor created by this factory.
+ ACE_QtReactor *reactor_impl_;
+
+ /// QApplication running reactor
+ QApplication *qapp_;
+
+ /// For internal locking.
+ TAO_SYNCH_MUTEX lock_;
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_QTRESOURCE_FACTORY_H */
diff --git a/TAO/tao/QtResource/QtResource_Loader.cpp b/TAO/tao/QtResource/QtResource_Loader.cpp
new file mode 100644
index 00000000000..c63dd54e4dc
--- /dev/null
+++ b/TAO/tao/QtResource/QtResource_Loader.cpp
@@ -0,0 +1,29 @@
+//$Id$
+#include "tao/QtResource/QtResource_Loader.h"
+#include "tao/ORB_Core.h"
+#include "tao/QtResource/QtResource_Factory.h"
+
+ACE_RCSID( TAO_QtResource,
+ QtResource_Loader,
+ "$Id$");
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ QtResource_Loader::QtResource_Loader (QApplication *qapp)
+ {
+ QtResource_Factory *tmp = 0;
+
+ ACE_NEW (tmp,
+ QtResource_Factory (qapp));
+
+ TAO_ORB_Core::set_gui_resource_factory (tmp);
+ }
+
+ QtResource_Loader::~QtResource_Loader (void)
+ {
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/QtResource/QtResource_Loader.h b/TAO/tao/QtResource/QtResource_Loader.h
new file mode 100644
index 00000000000..2f7ef42e7a7
--- /dev/null
+++ b/TAO/tao/QtResource/QtResource_Loader.h
@@ -0,0 +1,58 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file QtResource_Loader.h
+ *
+ * $Id$
+ *
+ * @author Marek Brudka <mbrudka@aster.pl>
+ * @author Balachandran Natarajan <bala@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_QTRESOURCE_LOADER_H
+#define TAO_QTRESOURCE_LOADER_H
+#include /**/ "ace/pre.h"
+
+#include "tao/QtResource/TAO_QtResource_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Versioned_Namespace.h"
+
+#include <qapplication.h>
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ /**
+ * @class QtResource_Loader
+ *
+ * @brief Loads TAO resources related with Qt.
+ *
+ * This class changes the default reactor implementation into
+ * ACE_QtReactor one by calling TAO_ORB_Core::set_gui_resource_factory.
+ * User should create an instance of this class before ORB_init
+ * when the TAO server has has to be integrated within Qt event loop.
+ *
+ * Please notice, this class has to be created in the main Qt thread,
+ * because set_gui_resource_factory creates a variable in TSS. This way
+ * QtReactor is instantiated only in Qt event loop thread.
+ */
+
+ class TAO_QtResource_Export QtResource_Loader
+ {
+ public:
+ QtResource_Loader (QApplication *qapp);
+ virtual ~QtResource_Loader (void);
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_QTRESOURCE_LOADER_H */
diff --git a/TAO/tao/QtResource/TAO_QtResource_Export.h b/TAO/tao/QtResource/TAO_QtResource_Export.h
new file mode 100644
index 00000000000..1e61d00a1c0
--- /dev/null
+++ b/TAO/tao/QtResource/TAO_QtResource_Export.h
@@ -0,0 +1,58 @@
+
+// -*- C++ -*-
+// $Id$
+// Definition for Win32 Export directives.
+// This file is generated automatically by generate_export_file.pl -s TAO_QtResource
+// ------------------------------
+#ifndef TAO_QTRESOURCE_EXPORT_H
+#define TAO_QTRESOURCE_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if defined (ACE_AS_STATIC_LIBS) && !defined (TAO_QTRESOURCE_HAS_DLL)
+# define TAO_QTRESOURCE_HAS_DLL 0
+#endif /* ACE_AS_STATIC_LIBS && TAO_QTRESOURCE_HAS_DLL */
+
+#if !defined (TAO_QTRESOURCE_HAS_DLL)
+# define TAO_QTRESOURCE_HAS_DLL 1
+#endif /* ! TAO_QTRESOURCE_HAS_DLL */
+
+#if defined (TAO_QTRESOURCE_HAS_DLL) && (TAO_QTRESOURCE_HAS_DLL == 1)
+# if defined (TAO_QTRESOURCE_BUILD_DLL)
+# define TAO_QtResource_Export ACE_Proper_Export_Flag
+# define TAO_QTRESOURCE_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# define TAO_QTRESOURCE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# else /* TAO_QTRESOURCE_BUILD_DLL */
+# define TAO_QtResource_Export ACE_Proper_Import_Flag
+# define TAO_QTRESOURCE_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# define TAO_QTRESOURCE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# endif /* TAO_QTRESOURCE_BUILD_DLL */
+#else /* TAO_QTRESOURCE_HAS_DLL == 1 */
+# define TAO_QtResource_Export
+# define TAO_QTRESOURCE_SINGLETON_DECLARATION(T)
+# define TAO_QTRESOURCE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+#endif /* TAO_QTRESOURCE_HAS_DLL == 1 */
+
+// Set TAO_QTRESOURCE_NTRACE = 0 to turn on library specific tracing even if
+// tracing is turned off for ACE.
+#if !defined (TAO_QTRESOURCE_NTRACE)
+# if (ACE_NTRACE == 1)
+# define TAO_QTRESOURCE_NTRACE 1
+# else /* (ACE_NTRACE == 1) */
+# define TAO_QTRESOURCE_NTRACE 0
+# endif /* (ACE_NTRACE == 1) */
+#endif /* !TAO_QTRESOURCE_NTRACE */
+
+#if (TAO_QTRESOURCE_NTRACE == 1)
+# define TAO_QTRESOURCE_TRACE(X)
+#else /* (TAO_QTRESOURCE_NTRACE == 1) */
+# if !defined (ACE_HAS_TRACE)
+# define ACE_HAS_TRACE
+# endif /* ACE_HAS_TRACE */
+# define TAO_QTRESOURCE_TRACE(X) ACE_TRACE_IMPL(X)
+# include "ace/Trace.h"
+#endif /* (TAO_QTRESOURCE_NTRACE == 1) */
+
+#endif /* TAO_QTRESOURCE_EXPORT_H */
+
+// End of auto generated file.
diff --git a/TAO/tao/Queued_Message.cpp b/TAO/tao/Queued_Message.cpp
new file mode 100644
index 00000000000..8b4b73072c9
--- /dev/null
+++ b/TAO/tao/Queued_Message.cpp
@@ -0,0 +1,105 @@
+// $Id$
+
+#include "tao/Queued_Message.h"
+
+ACE_RCSID (tao,
+ Queued_Message,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Queued_Message::TAO_Queued_Message (TAO_ORB_Core *oc,
+ ACE_Allocator *alloc,
+ bool is_heap_allocated)
+ : allocator_ (alloc)
+ , is_heap_created_ (is_heap_allocated)
+ , orb_core_ (oc)
+ , next_ (0)
+ , prev_ (0)
+{
+}
+
+TAO_Queued_Message::~TAO_Queued_Message (void)
+{
+}
+
+TAO_Queued_Message *
+TAO_Queued_Message::next (void) const
+{
+ return this->next_;
+}
+
+TAO_Queued_Message *
+TAO_Queued_Message::prev (void) const
+{
+ return this->prev_;
+}
+
+void
+TAO_Queued_Message::remove_from_list (TAO_Queued_Message *&head,
+ TAO_Queued_Message *&tail)
+{
+ if (this->prev_ != 0)
+ {
+ this->prev_->next_ = this->next_;
+ }
+ else if(head == this)
+ {
+ head = this->next_;
+ }
+
+ if (this->next_ != 0)
+ {
+ this->next_->prev_ = this->prev_;
+ }
+ else if(tail == this)
+ {
+ tail = this->prev_;
+ }
+
+ this->next_ = 0;
+ this->prev_ = 0;
+}
+
+void
+TAO_Queued_Message::push_back (TAO_Queued_Message *&head,
+ TAO_Queued_Message *&tail)
+{
+ if (tail == 0)
+ {
+ tail = this;
+ head = this;
+ this->next_ = 0;
+ this->prev_ = 0;
+ }
+ else
+ {
+ tail->next_ = this;
+ this->prev_ = tail;
+ this->next_ = 0;
+ tail = this;
+ }
+}
+
+void
+TAO_Queued_Message::push_front (TAO_Queued_Message *&head,
+ TAO_Queued_Message *&tail)
+{
+ if (head == 0)
+ {
+ tail = this;
+ head = this;
+ this->next_ = 0;
+ this->prev_ = 0;
+ }
+ else
+ {
+ head->prev_ = this;
+ this->next_ = head;
+ this->prev_ = 0;
+ head = this;
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Queued_Message.h b/TAO/tao/Queued_Message.h
new file mode 100644
index 00000000000..70defaa15cd
--- /dev/null
+++ b/TAO/tao/Queued_Message.h
@@ -0,0 +1,225 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Queued_Message.h
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan <coryan@uci.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_QUEUED_MESSAGE_H
+#define TAO_QUEUED_MESSAGE_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/LF_Invocation_Event.h"
+#include "ace/os_include/os_stddef.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+struct iovec;
+
+ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+class ACE_Message_Block;
+class ACE_Allocator;
+ACE_END_VERSIONED_NAMESPACE_DECL
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_ORB_Core;
+
+/**
+ * @class TAO_Queued_Message
+ *
+ * @brief Represent messages queued in the outgoing data path of the
+ * TAO_Transport class.
+ *
+ * Please read the documentation in the TAO_Transport class to find
+ * out more about the design of the outgoing data path.
+ *
+ * In some configurations TAO needs to maintain a per-connection queue
+ * of outgoing messages. This queue is drained by the pluggable
+ * protocols framework, normally under control of the ACE_Reactor, but
+ * other configurations are conceivable. The elements in the queue
+ * may be removed early, for example, because the application can
+ * specify timeouts for each message, or because the underlying
+ * connection is broken.
+ *
+ * In many cases the message corresponds to some application request,
+ * the application may be blocked waiting for the request to be sent,
+ * even more importantlyl, the ORB can be configured to use the
+ * Leader/Followers strategy, in which case one of the waiting threads
+ * can be required to wake up before its message completes
+ * each message may contain a 'Sent_Notifier'
+ *
+ * <H4>NOTE:</H4> The contents of the ACE_Message_Block may have been
+ * allocated from TSS storage, in that case we cannot steal them.
+ * However, we do not need to perform a deep copy all the time, for
+ * example, in a twoway request the sending thread blocks until the
+ * data goes out. The queued message can borrow the memory as it will
+ * be deallocated by the sending thread when it finishes.
+ * Oneways and asynchronous calls are another story.
+ *
+ * @todo Change the ORB to allocate oneway and AMI buffer from global
+ * memory, to avoid the data copy in this path. What happens
+ * if the there is no queueing? Can we check that before
+ * allocating the memory?
+ *
+ */
+class TAO_Export TAO_Queued_Message : public TAO_LF_Invocation_Event
+{
+public:
+ /// Constructor
+ TAO_Queued_Message (TAO_ORB_Core *oc,
+ ACE_Allocator *alloc = 0,
+ bool is_heap_allocated = false);
+
+ /// Destructor
+ virtual ~TAO_Queued_Message (void);
+
+ /** @name Intrusive list manipulation
+ *
+ * The messages are put in a doubled linked list (for easy insertion
+ * and removal). To minimize memory allocations the list is
+ * intrusive, i.e. each element in the list contains the pointers
+ * for the next and previous element.
+ *
+ * The following methods are used to manipulate this implicit list.
+ *
+ * @todo We should implement this as a base template, something
+ * like:<BR>
+ * template<class T> Intrusive_Node {<BR>
+ * public:<BR><BR>
+ * void next (T *);<BR>
+ * T* next () const;<BR><BR>
+ * private:<BR>
+ * T* next_;<BR>
+ * };<BR>
+ * and use it as follows:<BR>
+ * class TAO_Queued_Message : public Intrusive_Node<TAO_Queued_Message><BR>
+ * {<BR>
+ * };<BR>
+ *
+ */
+ //@{
+ /// Set/get the next element in the list
+ virtual TAO_Queued_Message *next (void) const;
+
+ /// Set/get the previous element in the list
+ virtual TAO_Queued_Message *prev (void) const;
+
+ /// Remove this element from the list
+ virtual void remove_from_list (TAO_Queued_Message *&head,
+ TAO_Queued_Message *&tail);
+
+ /// Insert the current element at the tail of the queue.
+ virtual void push_back (TAO_Queued_Message *&head,
+ TAO_Queued_Message *&tail);
+
+ /// Insert the current element at the head of the queue.
+ virtual void push_front (TAO_Queued_Message *&head,
+ TAO_Queued_Message *&tail);
+ //@}
+
+ /** @name Template Methods
+ */
+ //@{
+
+ /// Return the length of the message
+ /**
+ * If the message has been partially sent it returns the number of
+ * bytes that are still not sent.
+ */
+ virtual size_t message_length (void) const = 0;
+
+ /// Return 1 if all the data has been sent
+ virtual int all_data_sent (void) const = 0;
+
+ /// Fill up an io vector using the connects of the message
+ /**
+ * Different versions of this class represent the message using
+ * either a single buffer, or a message block.
+ * This method allows a derived class to fill up the contents of an
+ * io vector, the TAO_Transport class uses this method to group as
+ * many messages as possible in an iovector before sending them to
+ * the OS I/O subsystem.
+ *
+ * @param iovcnt_max The number of elements in iov
+ * @param iovcnt The number of elements already used by iov, this
+ * method should update this counter
+ * @param iov The io vector
+ */
+ virtual void fill_iov (int iovcnt_max,
+ int &iovcnt,
+ iovec iov[]) const = 0;
+
+ /// Update the internal state, data has been sent.
+ /**
+ * After the TAO_Transport class completes a successful (or
+ * partially successful) I/O operation it must update the state of
+ * all the messages queued. This callback method is used by each
+ * message to update its state and determine if all the data has
+ * been sent already.
+ *
+ * @param byte_count The number of bytes succesfully sent. The
+ * TAO_Queued_Message should decrement this value
+ * by the number of bytes that must still be sent.
+ * @return Returns 1 if the TAO_Queued_Message has any more data to
+ * send.
+ */
+ virtual void bytes_transferred (size_t &byte_count) = 0;
+
+ /// Clone this element
+ /*
+ * Clone the element and return a pointer to the cloned element on
+ * the heap.
+ *
+ * @param allocator Use the allocator for creating the new element
+ * on the heap. Remember, that the allocator will
+ * not be used allocate the data contained in this
+ * element.
+ */
+ virtual TAO_Queued_Message *clone (ACE_Allocator *allocator) = 0;
+
+ /// Reclaim resources
+ /**
+ * Reliable messages are allocated from the stack, thus they do not
+ * be deallocated.
+ * Asynchronous (SYNC_NONE) messages are allocated from the heap (or
+ * a pool), they need to be reclaimed explicitly.
+ */
+ virtual void destroy (void) = 0;
+ //@}
+
+protected:
+ /*
+ * Allocator that was used to create @c this object on the heap. If the
+ * allocator is null then @a this is on stack.
+ */
+ ACE_Allocator *allocator_;
+
+ /*
+ * A flag to indicate whether @a this is on stack or heap. A true value
+ * indicates that @a this was created on heap.
+ */
+ bool is_heap_created_;
+
+ /// Cached copy of ORB_Core pointer
+ TAO_ORB_Core *orb_core_;
+
+private:
+ /// Implement an intrusive double-linked list for the message queue
+ TAO_Queued_Message *next_;
+ TAO_Queued_Message *prev_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_QUEUED_MESSAGE_H */
diff --git a/TAO/tao/RTCORBA.mpc b/TAO/tao/RTCORBA.mpc
new file mode 100644
index 00000000000..b409840f159
--- /dev/null
+++ b/TAO/tao/RTCORBA.mpc
@@ -0,0 +1,37 @@
+//$Id$
+project : taolib, core, pi {
+ sharedname = TAO_RTCORBA
+ dynamicflags = TAO_RTCORBA_BUILD_DLL
+ requires += rt_corba
+
+ Source_Files {
+ RTCORBA
+ }
+
+ Header_Files {
+ RTCORBA
+ }
+
+ Inline_Files {
+ RTCORBA
+ }
+
+ Template_Files {
+ RTCORBA
+ }
+
+ Resource_Files {
+ RTCORBA
+ }
+
+ PIDL_Files {
+ RTCORBA
+ }
+
+ IDL_Files {
+ }
+
+ Pkgconfig_Files {
+ RTCORBA/TAO_RTCORBA.pc.in
+ }
+}
diff --git a/TAO/tao/RTCORBA/Continuous_Priority_Mapping.cpp b/TAO/tao/RTCORBA/Continuous_Priority_Mapping.cpp
new file mode 100644
index 00000000000..de53baf576f
--- /dev/null
+++ b/TAO/tao/RTCORBA/Continuous_Priority_Mapping.cpp
@@ -0,0 +1,135 @@
+// $Id$
+
+#include "tao/RTCORBA/Continuous_Priority_Mapping.h"
+
+#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
+
+#include "ace/Sched_Params.h"
+
+ACE_RCSID(RTCORBA, Continuous_Priority_Mapping, "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Continuous_Priority_Mapping::TAO_Continuous_Priority_Mapping (int policy)
+ : policy_ (policy)
+{
+ this->min_ =
+ ACE_Sched_Params::priority_min (this->policy_);
+
+ this->max_ =
+ ACE_Sched_Params::priority_max (this->policy_);
+}
+
+TAO_Continuous_Priority_Mapping::~TAO_Continuous_Priority_Mapping (void)
+{
+}
+
+CORBA::Boolean
+TAO_Continuous_Priority_Mapping::to_native (RTCORBA::Priority corba_priority,
+ RTCORBA::NativePriority &native_priority)
+{
+ if (corba_priority < 0)
+ return 0;
+
+#if defined (ACE_WIN32)
+
+ int current_native_priority = this->min_;
+ int next_native_priority;
+ for (int i = 1; i <= corba_priority; ++i)
+ {
+ next_native_priority =
+ ACE_Sched_Params::next_priority (this->policy_,
+ current_native_priority);
+
+ if (next_native_priority == current_native_priority)
+ return 0;
+
+ current_native_priority = next_native_priority;
+ }
+
+ native_priority = static_cast<RTCORBA::NativePriority> (current_native_priority);
+ return 1;
+
+#else
+
+ if (this->min_ < this->max_)
+ {
+ native_priority = corba_priority + this->min_;
+ if (native_priority > this->max_)
+ return 0;
+ }
+ else if (this->min_ > this->max_)
+ {
+ native_priority = this->min_ - corba_priority;
+ if (native_priority < this->max_)
+ return 0;
+ }
+ else
+ {
+ // There is only one native priority.
+ if (corba_priority != 0)
+ return 0;
+
+ native_priority = this->min_;
+ }
+
+ return 1;
+
+#endif /* ACE_WIN32 */
+
+}
+
+CORBA::Boolean
+TAO_Continuous_Priority_Mapping::to_CORBA (RTCORBA::NativePriority native_priority,
+ RTCORBA::Priority &corba_priority)
+{
+
+#if defined (ACE_WIN32)
+
+ int current_native_priority = this->min_;
+ for (corba_priority = 0; ; ++corba_priority)
+ {
+ if (current_native_priority == native_priority)
+ return 1;
+
+ else if (current_native_priority == this->max_)
+ return 0;
+
+ else
+ current_native_priority =
+ ACE_Sched_Params::next_priority (this->policy_,
+ current_native_priority);
+ }
+
+#else
+
+ if (this->min_ < this->max_)
+ {
+ if (native_priority < this->min_
+ || native_priority > this->max_)
+ return 0;
+ corba_priority = native_priority - this->min_;
+ }
+ else if (this->min_ > this->max_)
+ {
+ if (native_priority > this->min_
+ || native_priority < this->max_)
+ return 0;
+ corba_priority = this->min_ - native_priority;
+ }
+ else if (this->min_ == this->max_)
+ {
+ if (native_priority != this->min_)
+ return 0;
+ corba_priority = 0;
+ }
+
+ return 1;
+
+#endif /* ACE_WIN32 */
+
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
diff --git a/TAO/tao/RTCORBA/Continuous_Priority_Mapping.h b/TAO/tao/RTCORBA/Continuous_Priority_Mapping.h
new file mode 100644
index 00000000000..a2a4b976e7a
--- /dev/null
+++ b/TAO/tao/RTCORBA/Continuous_Priority_Mapping.h
@@ -0,0 +1,81 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Continuous_Priority_Mapping.h
+ *
+ * $Id$
+ *
+ * @author Irfan Pyarali
+ */
+// ===================================================================
+
+#ifndef TAO_CONTINUOUS_PRIORITY_MAPPING_H
+#define TAO_CONTINUOUS_PRIORITY_MAPPING_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
+
+#include "tao/RTCORBA/rtcorba_export.h"
+#include "tao/RTCORBA/Priority_Mapping.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_Continuous_Priority_Mapping
+ *
+ * @brief Maps the first n CORBA priorities to the range of native
+ * priorities, where n is the number of native priorities.
+ *
+ * The lowest native priority is mapped to CORBA priority 0, next
+ * higher native priority is mapped to CORBA priority 1, and so
+ * on. Since in all the operating systems where TAO is supported the
+ * native priority set contains less than 32767 priorities, part of
+ * the CORBA priority range is left unused. Consider NT as an
+ * example. NT native priorities -15 -2 -1 0 1 2 15 are mapped to
+ * CORBA priorities 0 1 2 3 4 5 6, respectively, and the rest of the
+ * CORBA priority range is not used.
+ *
+ * This class was previously called Direct_Priority_Mapping.
+ *
+ * \nosubgrouping
+ **/
+class TAO_RTCORBA_Export TAO_Continuous_Priority_Mapping
+ : public TAO_Priority_Mapping
+{
+public:
+
+ /// Constructor.
+ TAO_Continuous_Priority_Mapping (int policy = ACE_SCHED_OTHER);
+
+ /// Destructor.
+ ~TAO_Continuous_Priority_Mapping (void);
+
+ /// Convert CORBA priority to native priority.
+ CORBA::Boolean to_native (RTCORBA::Priority corba_priority,
+ RTCORBA::NativePriority &native_priority);
+
+ /// Convert native priority to CORBA priority.
+ CORBA::Boolean to_CORBA (RTCORBA::NativePriority native_priority,
+ RTCORBA::Priority &corba_priority);
+
+private:
+ int policy_;
+ int min_;
+ int max_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_CONTINUOUS_PRIORITY_MAPPING_H */
diff --git a/TAO/tao/RTCORBA/Direct_Priority_Mapping.cpp b/TAO/tao/RTCORBA/Direct_Priority_Mapping.cpp
new file mode 100644
index 00000000000..124b0bfefa9
--- /dev/null
+++ b/TAO/tao/RTCORBA/Direct_Priority_Mapping.cpp
@@ -0,0 +1,42 @@
+// $Id$
+
+#include "tao/orbconf.h"
+
+#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
+
+#include "tao/RTCORBA/Direct_Priority_Mapping.h"
+#include "ace/Sched_Params.h"
+
+ACE_RCSID(RTCORBA,
+ Direct_Priority_Mapping,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Direct_Priority_Mapping::TAO_Direct_Priority_Mapping (long)
+{
+}
+
+TAO_Direct_Priority_Mapping::~TAO_Direct_Priority_Mapping (void)
+{
+}
+
+CORBA::Boolean
+TAO_Direct_Priority_Mapping::to_native (RTCORBA::Priority corba_priority,
+ RTCORBA::NativePriority &native_priority)
+{
+ native_priority = corba_priority;
+ return 1;
+}
+
+CORBA::Boolean
+TAO_Direct_Priority_Mapping::to_CORBA (RTCORBA::NativePriority native_priority,
+ RTCORBA::Priority &corba_priority)
+{
+ corba_priority = native_priority;
+ return 1;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
diff --git a/TAO/tao/RTCORBA/Direct_Priority_Mapping.h b/TAO/tao/RTCORBA/Direct_Priority_Mapping.h
new file mode 100644
index 00000000000..ceee55ac971
--- /dev/null
+++ b/TAO/tao/RTCORBA/Direct_Priority_Mapping.h
@@ -0,0 +1,61 @@
+// -*- C++ -*-
+
+// =======================================================================
+/**
+ * @file Direct_Priority_Mapping.h
+ *
+ * $Id$
+ *
+ * Declares the Direct_Priority_Mapping interface, as defined in the
+ * RT-CORBA spec.
+ *
+ * @author Carlos O'Ryan (coryan@cs.wustl.edu)
+ */
+// =======================================================================
+
+#ifndef TAO_DIRECT_PRIORITY_MAPPING_H
+#define TAO_DIRECT_PRIORITY_MAPPING_H
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#include "tao/RTCORBA/Priority_Mapping.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_Direct_Priority_Mapping
+ *
+ * @brief A simple implementation of the Priority_Mapping interface
+ *
+ * This implementation uses direct mapping.
+ */
+class TAO_RTCORBA_Export TAO_Direct_Priority_Mapping : public TAO_Priority_Mapping
+{
+public:
+
+ TAO_Direct_Priority_Mapping (long);
+
+ /// The destructor
+ virtual ~TAO_Direct_Priority_Mapping (void);
+
+ virtual CORBA::Boolean
+ to_native (RTCORBA::Priority corba_priority,
+ RTCORBA::NativePriority &native_priority);
+ virtual CORBA::Boolean
+ to_CORBA (RTCORBA::NativePriority native_priority,
+ RTCORBA::Priority &corba_priority);
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_DIRECT_PRIORITY_MAPPING_H */
diff --git a/TAO/tao/RTCORBA/Linear_Network_Priority_Mapping.cpp b/TAO/tao/RTCORBA/Linear_Network_Priority_Mapping.cpp
new file mode 100644
index 00000000000..68d4353dbd8
--- /dev/null
+++ b/TAO/tao/RTCORBA/Linear_Network_Priority_Mapping.cpp
@@ -0,0 +1,142 @@
+
+// $Id$
+
+#include "tao/orbconf.h"
+
+#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
+
+#include "tao/RTCORBA/Linear_Network_Priority_Mapping.h"
+#include "tao/debug.h"
+
+#include "ace/Sched_Params.h"
+#include "ace/Log_Msg.h"
+
+ACE_RCSID (RTCORBA,
+ Linear_Network_Priority_Mapping,
+ "$Id$")
+
+#define IPDSFIELD_DSCP_DEFAULT 0x00
+#define IPDSFIELD_DSCP_CS1 0x08
+#define IPDSFIELD_DSCP_CS2 0x10
+#define IPDSFIELD_DSCP_CS3 0x18
+#define IPDSFIELD_DSCP_CS4 0x20
+#define IPDSFIELD_DSCP_CS5 0x28
+#define IPDSFIELD_DSCP_CS6 0x30
+#define IPDSFIELD_DSCP_CS7 0x38
+#define IPDSFIELD_DSCP_AF11 0x0A
+#define IPDSFIELD_DSCP_AF12 0x0C
+#define IPDSFIELD_DSCP_AF13 0x0E
+#define IPDSFIELD_DSCP_AF21 0x12
+#define IPDSFIELD_DSCP_AF22 0x14
+#define IPDSFIELD_DSCP_AF23 0x16
+#define IPDSFIELD_DSCP_AF31 0x1A
+#define IPDSFIELD_DSCP_AF32 0x1C
+#define IPDSFIELD_DSCP_AF33 0x1E
+#define IPDSFIELD_DSCP_AF41 0x22
+#define IPDSFIELD_DSCP_AF42 0x24
+#define IPDSFIELD_DSCP_AF43 0x26
+#define IPDSFIELD_ECT_MASK 0x02
+#define IPDSFIELD_CE_MASK 0x01
+#define IPDSFIELD_DSCP_EF 0x2E
+
+static int const dscp[] =
+{
+ IPDSFIELD_DSCP_DEFAULT ,
+ IPDSFIELD_DSCP_CS1 ,
+ IPDSFIELD_DSCP_CS2 ,
+ IPDSFIELD_DSCP_CS3 ,
+ IPDSFIELD_DSCP_CS4 ,
+ IPDSFIELD_DSCP_CS5 ,
+ IPDSFIELD_DSCP_CS6 ,
+ IPDSFIELD_DSCP_CS7 ,
+ IPDSFIELD_DSCP_AF11 ,
+ IPDSFIELD_DSCP_AF12 ,
+ IPDSFIELD_DSCP_AF13 ,
+ IPDSFIELD_DSCP_AF21 ,
+ IPDSFIELD_DSCP_AF22 ,
+ IPDSFIELD_DSCP_AF23 ,
+ IPDSFIELD_DSCP_AF31 ,
+ IPDSFIELD_DSCP_AF32 ,
+ IPDSFIELD_DSCP_AF33 ,
+ IPDSFIELD_DSCP_AF41 ,
+ IPDSFIELD_DSCP_AF42 ,
+ IPDSFIELD_DSCP_AF43 ,
+ IPDSFIELD_DSCP_EF
+};
+
+/*
+static const char * const dscp_char[]=
+{
+ "Normal",
+ "CS1",
+ "CS2",
+ "CS3",
+ "CS4",
+ "CS5",
+ "CS6",
+ "CS7",
+ "Assured Forwarding 11",
+ "Assured Forwarding 12",
+ "Assured Forwarding 13",
+ "Assured Forwarding 21",
+ "Assured Forwarding 22",
+ "Assured Forwarding 23",
+ "Assured Forwarding 31",
+ "Assured Forwarding 32",
+ "Assured Forwarding 33",
+ "Assured Forwarding 41",
+ "Assured Forwarding 42",
+ "Assured Forwarding 43",
+ "Expedited Forwarding"
+};
+*/
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Linear_Network_Priority_Mapping::TAO_Linear_Network_Priority_Mapping (long)
+{
+}
+
+CORBA::Boolean
+TAO_Linear_Network_Priority_Mapping::to_network (
+ RTCORBA::Priority corba_priority,
+ RTCORBA::NetworkPriority &network_priority)
+{
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO_Linear_Network_Priority_Mapping::to_network corba_priority %d\n",
+ corba_priority));
+
+ const int total_slots = sizeof (dscp) / sizeof (int);
+
+ int array_slot =
+ static_cast<int> (((corba_priority - RTCORBA::minPriority) / double (RTCORBA::maxPriority - RTCORBA::minPriority)) * total_slots);
+
+ if (array_slot == total_slots)
+ array_slot -= 1;
+
+ network_priority = dscp[array_slot];
+
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO_Linear_Network_Priority_Mapping::to_network = %x\n",
+ network_priority));
+
+ return 1;
+}
+
+CORBA::Boolean
+TAO_Linear_Network_Priority_Mapping::to_CORBA (RTCORBA::NetworkPriority network_priority,
+ RTCORBA::Priority &/*corba_priority*/)
+{
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO_Linear_Network_Priority_Mapping::to_CORBA network_priority %d\n",
+ network_priority));
+
+ return 0;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
diff --git a/TAO/tao/RTCORBA/Linear_Network_Priority_Mapping.h b/TAO/tao/RTCORBA/Linear_Network_Priority_Mapping.h
new file mode 100644
index 00000000000..5c8410bf943
--- /dev/null
+++ b/TAO/tao/RTCORBA/Linear_Network_Priority_Mapping.h
@@ -0,0 +1,64 @@
+// -*- C++ -*-
+
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO
+//
+// = FILENAME
+// Linear_Network_Priority_Mapping.h
+//
+// = DESCRIPTION
+// Declares the Linear_Network_Priority_Mapping interface,
+//
+// = AUTHOR
+// Yamuna Krishnamurthy (yamuna@oomworks.com)
+//
+// ============================================================================
+
+#ifndef TAO_LINEAR_NETWORK_PRIORITY_MAPPING_H
+#define TAO_LINEAR_NETWORK_PRIORITY_MAPPING_H
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#include "tao/RTCORBA/rtcorba_export.h"
+#include "tao/RTCORBA/Network_Priority_Mapping.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_Linear_Network_Priority_Mapping
+ *
+ * @brief A simple implementation of the Network_Priority_Mapping interface
+ *
+ * This implementation uses linear mapping between the range of
+ * DiffServ priorities and CORBA priorities.
+ */
+class TAO_RTCORBA_Export TAO_Linear_Network_Priority_Mapping : public TAO_Network_Priority_Mapping
+{
+public:
+
+ TAO_Linear_Network_Priority_Mapping (long);
+
+ CORBA::Boolean to_network (RTCORBA::Priority corba_priority,
+ RTCORBA::NetworkPriority &network_priority);
+
+ CORBA::Boolean to_CORBA (RTCORBA::NetworkPriority network_priority,
+ RTCORBA::Priority &corba_priority);
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_LINEAR_NETWORK_PRIORITY_MAPPING_H */
diff --git a/TAO/tao/RTCORBA/Linear_Priority_Mapping.cpp b/TAO/tao/RTCORBA/Linear_Priority_Mapping.cpp
new file mode 100644
index 00000000000..f6889d5a7c5
--- /dev/null
+++ b/TAO/tao/RTCORBA/Linear_Priority_Mapping.cpp
@@ -0,0 +1,168 @@
+// $Id$
+
+#include "tao/orbconf.h"
+
+#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
+
+#include "tao/RTCORBA/Linear_Priority_Mapping.h"
+#include "tao/debug.h"
+#include "ace/Sched_Params.h"
+#include "ace/Log_Msg.h"
+
+ACE_RCSID (RTCORBA,
+ Linear_Priority_Mapping,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Linear_Priority_Mapping::TAO_Linear_Priority_Mapping (long policy)
+ : policy_ (policy)
+ , min_ (ACE_Sched_Params::priority_min (this->policy_))
+ , max_ (ACE_Sched_Params::priority_max (this->policy_))
+{
+}
+
+TAO_Linear_Priority_Mapping::~TAO_Linear_Priority_Mapping (void)
+{
+}
+
+CORBA::Boolean
+TAO_Linear_Priority_Mapping::to_native (
+ RTCORBA::Priority corba_priority,
+ RTCORBA::NativePriority &native_priority)
+{
+ if (corba_priority < RTCORBA::minPriority
+ // The line below will always be false unless the value of
+ // RTCORBA::maxPriority, which is now assigned the value of
+ // 32767, is changed in RTCORBA.pidl.
+// || corba_priority > RTCORBA::maxPriority
+ )
+ {
+ return 0;
+ }
+
+#if defined (ACE_WIN32)
+ // Count up the number of distinct native priorities on current
+ // platform.
+ int n;
+ int current_priority = this->min_;
+ for (n = 1; current_priority != this->max_; ++n)
+ {
+ current_priority =
+ ACE_Sched_Params::next_priority (this->policy_,
+ current_priority);
+ }
+ int native_priority_index =
+ 1
+ + ((n - 1)
+ * corba_priority
+ / (RTCORBA::maxPriority - RTCORBA::minPriority));
+
+ // Now, find the value corresponding to this index.
+ native_priority = static_cast<RTCORBA::NativePriority> (this->min_);
+ for (int i = 2; i <= native_priority_index; ++i)
+ {
+ native_priority = static_cast<RTCORBA::NativePriority>
+ (ACE_Sched_Params::next_priority (this->policy_, native_priority));
+ }
+ return 1;
+
+#else
+
+ native_priority =
+ this->min_
+ + ((this->max_ - this->min_)
+ * corba_priority
+ / (RTCORBA::maxPriority - RTCORBA::minPriority));
+
+ return 1;
+
+#endif /* ACE_WIN32 */
+}
+
+CORBA::Boolean
+TAO_Linear_Priority_Mapping::to_CORBA (RTCORBA::NativePriority native_priority,
+ RTCORBA::Priority &corba_priority)
+{
+#if defined (ACE_WIN32)
+
+ // Iterate over native priorities in order to 1) make sure
+ // <native_priority> argument contains a valid value, 2) count its
+ // index among all valid native pr. values, 3) get the total number
+ // of native priority values for the current platform.
+
+ int total;
+ int native_priority_index = 0;
+ int current_priority = this->min_;
+ for (total = 1; ; ++total)
+ {
+ if (native_priority == current_priority)
+ native_priority_index = total;
+
+ if (current_priority == this->max_)
+ break;
+
+ current_priority =
+ ACE_Sched_Params::next_priority (this->policy_,
+ current_priority);
+ }
+
+ if (native_priority_index == 0)
+ return 0;
+
+ int delta = total - 1;
+ if (delta != 0)
+ {
+ corba_priority = static_cast<RTCORBA::Priority> (RTCORBA::minPriority
+ + ((RTCORBA::maxPriority - RTCORBA::minPriority)
+ * (native_priority_index - 1) / delta));
+ }
+ else
+ {
+ // There is only one native priority.
+ corba_priority = RTCORBA::minPriority;
+ }
+
+ return 1;
+
+#else
+
+ if ((this->min_ < this->max_
+ && (native_priority < this->min_
+ || native_priority > this->max_))
+ || (this->min_ > this->max_
+ && (native_priority < this->max_
+ || native_priority > this->min_)))
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - Linear_Priority_Mapping::to_CORBA: "
+ " priority %d out of range [%d,%d]\n",
+ native_priority, this->min_, this->max_));
+ return 0;
+ }
+
+ int delta = this->max_ - this->min_;
+ if (delta != 0)
+ {
+ corba_priority =
+ RTCORBA::minPriority
+ + ((RTCORBA::maxPriority - RTCORBA::minPriority)
+ * (native_priority - this->min_) / delta);
+ }
+ else
+ {
+ // There is only one native priority.
+ if (native_priority != this->min_)
+ return 0;
+ corba_priority = RTCORBA::minPriority;
+ }
+
+ return 1;
+
+#endif /* ACE_WIN32 */
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
diff --git a/TAO/tao/RTCORBA/Linear_Priority_Mapping.h b/TAO/tao/RTCORBA/Linear_Priority_Mapping.h
new file mode 100644
index 00000000000..164e7f024b7
--- /dev/null
+++ b/TAO/tao/RTCORBA/Linear_Priority_Mapping.h
@@ -0,0 +1,77 @@
+// -*- C++ -*-
+
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO
+//
+// = FILENAME
+// Linear_Priority_Mapping.h
+//
+// = DESCRIPTION
+// Declares the Linear_Priority_Mapping interface, as defined in the
+// RT-CORBA spec.
+//
+// = AUTHOR
+// Carlos O'Ryan (coryan@cs.wustl.edu)
+//
+// ============================================================================
+
+#ifndef TAO_LINEAR_PRIORITY_MAPPING_H
+#define TAO_LINEAR_PRIORITY_MAPPING_H
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#include "tao/RTCORBA/rtcorba_export.h"
+#include "tao/RTCORBA/Priority_Mapping.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_Linear_Priority_Mapping
+ *
+ * @brief A simple implementation of the Priority_Mapping interface.
+ *
+ * This implementation uses linear mapping between the range of
+ * priorities for a given scheduling class (ACE_SCHED_OTHER,
+ * ACE_SCHED_FIFO, ACE_SCHED_RR) and the valid range of CORBA
+ * priorities (0...32767)
+ */
+class TAO_RTCORBA_Export TAO_Linear_Priority_Mapping : public TAO_Priority_Mapping
+{
+public:
+ /// Default constructor
+ TAO_Linear_Priority_Mapping (long policy);
+
+ /// The destructor
+ virtual ~TAO_Linear_Priority_Mapping (void);
+
+ virtual CORBA::Boolean to_native (RTCORBA::Priority corba_priority,
+ RTCORBA::NativePriority &native_priority);
+ virtual CORBA::Boolean to_CORBA (RTCORBA::NativePriority native_priority,
+ RTCORBA::Priority &corba_priority);
+
+private:
+ /// The scheduling policy
+ long policy_;
+
+ // The range
+ int const min_;
+ int const max_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_LINEAR_PRIORITY_MAPPING_H */
diff --git a/TAO/tao/RTCORBA/Multi_Priority_Mapping.cpp b/TAO/tao/RTCORBA/Multi_Priority_Mapping.cpp
new file mode 100644
index 00000000000..b53c0995b31
--- /dev/null
+++ b/TAO/tao/RTCORBA/Multi_Priority_Mapping.cpp
@@ -0,0 +1,243 @@
+// $Id$
+
+#include "tao/orbconf.h"
+
+#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
+
+#include "tao/RTCORBA/Multi_Priority_Mapping.h"
+#include "tao/debug.h"
+#include "ace/Log_Msg.h"
+#include "ace/Sched_Params.h"
+
+ACE_RCSID (RTCORBA,
+ Multi_Priority_Mapping,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Multi_Priority_Mapping::TAO_Multi_Priority_Mapping (
+ int base_native_priority,
+ int base_corba_priority,
+ int priority_spacing,
+ int priorities_contiguous,
+ int policy)
+ : base_native_priority_ (base_native_priority)
+ , base_corba_priority_ (base_corba_priority)
+ , priority_spacing_ (priority_spacing)
+ , priorities_contiguous_(priorities_contiguous)
+ , policy_ (policy)
+ , min_ (ACE_Sched_Params::priority_min (this->policy_))
+ , max_ (ACE_Sched_Params::priority_max (this->policy_))
+{
+ if ( this->min_ < this->max_ )
+ {
+ if (base_native_priority_ < this->min_)
+ {
+ if (TAO_debug_level > 2)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - Multi_Priority_Mapping::ctor: "
+ " base_native_priority %d out of range [%d,%d]\n",
+ base_native_priority_, this->min_, this->max_));
+ }
+ }
+ }
+ else
+ {
+ if (base_native_priority_ > this->min_)
+ {
+ if (TAO_debug_level > 2)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - Multi_Priority_Mapping::ctor: "
+ " base_native_priority %d out of range [%d,%d]\n",
+ base_native_priority_, this->min_, this->max_));
+ }
+ }
+ }
+
+ if (base_corba_priority_ > RTCORBA::maxPriority)
+ {
+ if (TAO_debug_level > 2)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - Multi_Priority_Mapping::ctor: "
+ " base_corba_priority %d out of range [%d,%d]\n",
+ base_corba_priority_, RTCORBA::minPriority, RTCORBA::maxPriority));
+ }
+ }
+}
+
+TAO_Multi_Priority_Mapping::~TAO_Multi_Priority_Mapping (void)
+{
+}
+
+CORBA::Boolean
+TAO_Multi_Priority_Mapping::to_native (RTCORBA::Priority corba_priority,
+ RTCORBA::NativePriority &native_priority)
+{
+ // Check for an invalid native priority
+ if (corba_priority < RTCORBA::minPriority || corba_priority > this->base_corba_priority_ )
+ {
+ if (TAO_debug_level > 2)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - Multi_Priority_Mapping::to_native: "
+ " corba priority %d out of range [%d,%d]\n",
+ corba_priority, RTCORBA::minPriority, this->base_corba_priority_));
+ }
+ return 0;
+ }
+
+ if (corba_priority == base_corba_priority_)
+ {
+ // If this is the highest priority endpoint, then just give it the highest priority corba base priority
+ native_priority = static_cast<RTCORBA::NativePriority> (base_native_priority_);
+ }
+ else
+ {
+ if (priorities_contiguous_ == 1)
+ {
+ if ( this->min_ < this->max_ )
+ {
+ native_priority = static_cast<RTCORBA::NativePriority>
+ (((corba_priority - base_corba_priority_) / priority_spacing_) + base_native_priority_);
+ }
+ else
+ {
+ native_priority = static_cast<RTCORBA::NativePriority>
+ (((base_corba_priority_ - corba_priority) / priority_spacing_) + base_native_priority_);
+ }
+ }
+ else
+ {
+ // Start at the max priority and search until we reach the base priority
+ int last_priority = this->base_corba_priority_;
+ while (true)
+ {
+ if (last_priority == RTCORBA::minPriority) break;
+ if (base_corba_priority_ >= --last_priority) break;
+ }
+
+ int priority_ndx = 0;
+ while (true)
+ {
+ if (last_priority == RTCORBA::minPriority) break;
+ if (corba_priority >= --last_priority) break;
+ priority_ndx++;
+ }
+
+ // Start at the max priority and search until we reach the base priority
+ last_priority = this->base_native_priority_;
+ for (int current_ndx = 0; current_ndx < priority_ndx; current_ndx++)
+ {
+ native_priority = static_cast<RTCORBA::NativePriority>
+ (ACE_Sched_Params::previous_priority (this->policy_,
+ last_priority,
+ ACE_SCOPE_THREAD));
+ }
+ }
+ }
+
+ return 1;
+}
+
+CORBA::Boolean
+TAO_Multi_Priority_Mapping::to_CORBA (RTCORBA::NativePriority native_priority,
+ RTCORBA::Priority &corba_priority)
+{
+ // Check for an invalid native priority
+ if ((this->min_ < this->max_ && (native_priority < this->min_ || native_priority > this->base_native_priority_ )) ||
+ (this->min_ > this->max_ && (native_priority < this->base_corba_priority_ || native_priority > this->min_)))
+ {
+ if (TAO_debug_level > 2)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - Multi_Priority_Mapping::to_CORBA: "
+ " priority %d out of range [%d,%d]\n",
+ native_priority, this->min_, this->base_corba_priority_));
+ }
+ return 0;
+ }
+
+ if (native_priority == base_native_priority_)
+ {
+ // If this is the highest priority endpoint, then just give it the highest priority corba base priority
+ corba_priority = static_cast<RTCORBA::Priority> (base_corba_priority_);
+ }
+ else
+ {
+ if (priorities_contiguous_ == 1)
+ {
+ if ( this->min_ < this->max_ )
+ {
+ corba_priority = static_cast<RTCORBA::Priority>
+ (((native_priority - base_native_priority_) * priority_spacing_) + base_corba_priority_);
+ }
+ else
+ {
+ corba_priority = static_cast<RTCORBA::Priority>
+ (((base_native_priority_ - native_priority) * priority_spacing_) + base_corba_priority_);
+ }
+ }
+ else
+ {
+ // Start at the max priority and search until we reach the base priority
+ int last_priority = this->base_native_priority_;
+ while (true)
+ {
+ int previous_priority = ACE_Sched_Params::previous_priority (this->policy_,
+ last_priority,
+ ACE_SCOPE_THREAD);
+ last_priority = previous_priority;
+
+ if (last_priority == this->min_)
+ {
+ break;
+ }
+
+ if ( this->min_ < this->max_ )
+ {
+ if (base_native_priority_ >= previous_priority) break;
+ }
+ else
+ {
+ if (base_native_priority_ <= previous_priority) break;
+ }
+ }
+
+ int priority_ndx = 1;
+ while (true)
+ {
+ if (last_priority == this->min_)
+ {
+ break;
+ }
+
+ if ( this->min_ < this->max_ )
+ {
+ if (native_priority >= last_priority) break;
+ }
+ else
+ {
+ if (native_priority <= last_priority) break;
+ }
+
+ int previous_priority = ACE_Sched_Params::previous_priority (this->policy_,
+ last_priority,
+ ACE_SCOPE_THREAD);
+ last_priority = previous_priority;
+ priority_ndx++;
+ }
+
+ corba_priority = static_cast<RTCORBA::Priority>
+ (base_corba_priority_ - priority_ndx);
+ }
+ }
+
+ return 1;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
diff --git a/TAO/tao/RTCORBA/Multi_Priority_Mapping.h b/TAO/tao/RTCORBA/Multi_Priority_Mapping.h
new file mode 100644
index 00000000000..a3b3b58ec75
--- /dev/null
+++ b/TAO/tao/RTCORBA/Multi_Priority_Mapping.h
@@ -0,0 +1,98 @@
+// -*- C++ -*-
+
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO
+//
+// = FILENAME
+// Multi_Priority_Mapping.h
+//
+// = DESCRIPTION
+// Declares a priority mapping to support cross platform communication.
+//
+// = AUTHOR
+// Brian Mendel (brian.r.mendel@boeing.com)
+//
+// ============================================================================
+
+#ifndef TAO_MULTI_PRIORITY_MAPPING_H
+#define TAO_MULTI_PRIORITY_MAPPING_H
+
+#include "tao/orbconf.h"
+
+#include "tao/RTCORBA/Priority_Mapping.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_Multi_Priority_Mapping
+ *
+ * @brief An implementation of the Priority_Mapping interface for communication
+ * between different platforms
+ *
+ * This implementation uses a custom mapping between the range of
+ * priorities for a given scheduling class (ACE_SCHED_OTHER,
+ * ACE_SCHED_FIFO, ACE_SCHED_RR) and the valid range of CORBA
+ * priorities (0...32767)
+ */
+class TAO_RTCORBA_Export TAO_Multi_Priority_Mapping
+: public TAO_Priority_Mapping
+{
+public:
+ /// Default constructor
+ /**
+ * @param base_native_priority The native priority to use for the highest
+ * priority endpoint.
+ * @param base_corba_priority The corba priority to use for the highest
+ * priority endpoint
+ * @param priority_spacing The priority increment to use between endpoints
+ * @param priorities_contiguous Some platforms do use contiguous priorities
+ * @param policy The scheduling policy to use.
+ */
+ TAO_Multi_Priority_Mapping (int base_native_priority,
+ int base_corba_priority,
+ int priority_spacing = 1,
+ int priorities_contiguous = 1,
+ int policy = ACE_SCHED_FIFO);
+
+ /// The destructor
+ virtual ~TAO_Multi_Priority_Mapping (void);
+
+ virtual CORBA::Boolean
+ to_native (RTCORBA::Priority corba_priority,
+ RTCORBA::NativePriority &native_priority);
+ virtual CORBA::Boolean
+ to_CORBA (RTCORBA::NativePriority native_priority,
+ RTCORBA::Priority &corba_priority);
+
+private:
+
+ int base_native_priority_;
+ int base_corba_priority_;
+ // The base settings
+
+ const int priority_spacing_;
+ const int priorities_contiguous_;
+
+ /// The scheduling policy
+ int policy_;
+
+ int const min_;
+ int const max_;
+ // The range
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
+
+#endif /* TAO_MULTI_PRIORITY_MAPPING_H */
diff --git a/TAO/tao/RTCORBA/Network_Priority_Mapping.cpp b/TAO/tao/RTCORBA/Network_Priority_Mapping.cpp
new file mode 100644
index 00000000000..b896b6c61d2
--- /dev/null
+++ b/TAO/tao/RTCORBA/Network_Priority_Mapping.cpp
@@ -0,0 +1,21 @@
+// $Id$
+
+#include "tao/orbconf.h"
+
+#include "tao/RTCORBA/Network_Priority_Mapping.h"
+
+ACE_RCSID(RTCORBA,
+ Network_Priority_Mapping,
+ "$Id$")
+
+#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Network_Priority_Mapping::~TAO_Network_Priority_Mapping (void)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
diff --git a/TAO/tao/RTCORBA/Network_Priority_Mapping.h b/TAO/tao/RTCORBA/Network_Priority_Mapping.h
new file mode 100644
index 00000000000..4fa09f454f4
--- /dev/null
+++ b/TAO/tao/RTCORBA/Network_Priority_Mapping.h
@@ -0,0 +1,66 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Network_Priority_Mapping.h
+ *
+ * $Id$
+ *
+ * Class that declares the Network Priority Mapping
+ * that can be overriden to provide different mappings
+ *
+ *
+ * @author Yamuna Krishnamurthy (yamuna@oomworks.com)
+ */
+//=============================================================================
+
+
+#ifndef TAO_NETWORK_PRIORITY_MAPPING_H
+#define TAO_NETWORK_PRIORITY_MAPPING_H
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#define TAO_RTCORBA_SAFE_INCLUDE
+#include "tao/RTCORBA/RTCORBAC.h"
+#undef TAO_RTCORBA_SAFE_INCLUDE
+
+#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_Network_Priority_Mapping
+ *
+ * @brief The interface for priority mapping.
+ *
+ * Check the RT-CORBA spec (orbos/99-02-12) secions 4.5.2
+ */
+class TAO_RTCORBA_Export TAO_Network_Priority_Mapping
+{
+public:
+ /// The destructor
+ virtual ~TAO_Network_Priority_Mapping (void);
+
+ virtual CORBA::Boolean
+ to_network (RTCORBA::Priority corba_priority,
+ RTCORBA::NetworkPriority &network_priority) = 0;
+ virtual CORBA::Boolean
+ to_CORBA (RTCORBA::NetworkPriority network_priority,
+ RTCORBA::Priority &corba_priority) = 0;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_NETWORK_PRIORITY_MAPPING_H */
+
+
+
+
diff --git a/TAO/tao/RTCORBA/Network_Priority_Mapping_Manager.cpp b/TAO/tao/RTCORBA/Network_Priority_Mapping_Manager.cpp
new file mode 100644
index 00000000000..387adcf5677
--- /dev/null
+++ b/TAO/tao/RTCORBA/Network_Priority_Mapping_Manager.cpp
@@ -0,0 +1,61 @@
+// $Id$
+
+#include "tao/RTCORBA/Network_Priority_Mapping_Manager.h"
+
+#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
+
+#if ! defined (__ACE_INLINE__)
+#include "tao/RTCORBA/Network_Priority_Mapping_Manager.i"
+#endif /* __ACE_INLINE__ */
+
+ACE_RCSID (RTCORBA,
+ Network_Priority_Mapping_Manager,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Network_Priority_Mapping_Manager::~TAO_Network_Priority_Mapping_Manager (
+ void
+ )
+{
+ delete this->mapping_;
+}
+
+TAO_Network_Priority_Mapping_Manager_ptr
+TAO_Network_Priority_Mapping_Manager::_narrow (CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_NOT_USED)
+{
+ if (CORBA::is_nil (obj))
+ {
+ return TAO_Network_Priority_Mapping_Manager::_nil ();
+ }
+
+ return
+ TAO_Network_Priority_Mapping_Manager::_duplicate (
+ dynamic_cast<TAO_Network_Priority_Mapping_Manager_ptr> (obj)
+ );
+}
+
+TAO_Network_Priority_Mapping_Manager_ptr
+TAO_Network_Priority_Mapping_Manager::_duplicate (
+ TAO_Network_Priority_Mapping_Manager_ptr obj
+ )
+{
+ if (!CORBA::is_nil (obj))
+ {
+ obj->_add_ref ();
+ }
+
+ return obj;
+}
+
+const char*
+TAO_Network_Priority_Mapping_Manager::_interface_repository_id (void) const
+{
+ return "IDL:Network_Priority_Mapping_Manager:1.0";
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
+
diff --git a/TAO/tao/RTCORBA/Network_Priority_Mapping_Manager.h b/TAO/tao/RTCORBA/Network_Priority_Mapping_Manager.h
new file mode 100644
index 00000000000..7237c16ad55
--- /dev/null
+++ b/TAO/tao/RTCORBA/Network_Priority_Mapping_Manager.h
@@ -0,0 +1,159 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Network_Priority_Mapping_Manager.h
+ *
+ * $Id$
+ *
+ * @author Yamuna Krishnamurthy (yamuna@oomworks.com)
+ */
+//=============================================================================
+
+
+#ifndef TAO_NETWORK_PRIORITY_MAPPING_MANAGER_H
+#define TAO_NETWORK_PRIORITY_MAPPING_MANAGER_H
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+#include "tao/RTCORBA/rtcorba_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
+
+#include "tao/RTCORBA/Network_Priority_Mapping.h"
+#include "tao/LocalObject.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Network_Priority_Mapping_Manager;
+class TAO_Network_Priority_Mapping_Manager_var;
+typedef TAO_Network_Priority_Mapping_Manager *TAO_Network_Priority_Mapping_Manager_ptr;
+
+
+namespace RTCORBA
+{
+}
+/**
+ * @class TAO_Network_Priority_Mapping_Manager
+ *
+ * @brief Network_Priority_Mapping_Manager pseudo-objref.
+ *
+ * Allows setting of user-defined Network_Priority_Mapping at run-time.
+ */
+class TAO_RTCORBA_Export TAO_Network_Priority_Mapping_Manager :
+ public virtual TAO_Local_RefCounted_Object
+{
+
+public:
+ /// Constructor.
+ TAO_Network_Priority_Mapping_Manager (RTCORBA::NetworkPriorityMapping * mapping);
+
+ ///
+ void mapping (RTCORBA::NetworkPriorityMapping * mapping);
+
+ ///
+ RTCORBA::NetworkPriorityMapping *mapping (void);
+
+public:
+ typedef TAO_Network_Priority_Mapping_Manager_ptr _ptr_type;
+ typedef TAO_Network_Priority_Mapping_Manager_var _var_type;
+
+ // the static operations
+ static TAO_Network_Priority_Mapping_Manager_ptr _duplicate (
+ TAO_Network_Priority_Mapping_Manager_ptr obj
+ );
+ static TAO_Network_Priority_Mapping_Manager_ptr _narrow (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ static TAO_Network_Priority_Mapping_Manager_ptr _nil (void)
+ {
+ return (TAO_Network_Priority_Mapping_Manager_ptr)0;
+ }
+
+ virtual const char* _interface_repository_id (void) const;
+
+protected:
+
+ /// Protected destructor to enforce proper memory management of this
+ /// reference counted object.
+ ~TAO_Network_Priority_Mapping_Manager (void);
+
+private:
+
+ TAO_Network_Priority_Mapping_Manager (const TAO_Network_Priority_Mapping_Manager &);
+ void operator= (const TAO_Network_Priority_Mapping_Manager &);
+
+private:
+
+ TAO_Network_Priority_Mapping *mapping_;
+};
+
+class TAO_RTCORBA_Export TAO_Network_Priority_Mapping_Manager_var
+ : private TAO_Base_var
+{
+public:
+ TAO_Network_Priority_Mapping_Manager_var (void); // default constructor
+ TAO_Network_Priority_Mapping_Manager_var (TAO_Network_Priority_Mapping_Manager_ptr);
+ TAO_Network_Priority_Mapping_Manager_var (const TAO_Network_Priority_Mapping_Manager_var &); // copy constructor
+ ~TAO_Network_Priority_Mapping_Manager_var (void); // destructor
+
+ TAO_Network_Priority_Mapping_Manager_var &operator= (TAO_Network_Priority_Mapping_Manager_ptr);
+ TAO_Network_Priority_Mapping_Manager_var &operator= (const TAO_Network_Priority_Mapping_Manager_var &);
+ TAO_Network_Priority_Mapping_Manager_ptr operator-> (void) const;
+
+ /// in, inout, out, _retn
+ operator const TAO_Network_Priority_Mapping_Manager_ptr &() const;
+ operator TAO_Network_Priority_Mapping_Manager_ptr &();
+ TAO_Network_Priority_Mapping_Manager_ptr in (void) const;
+ TAO_Network_Priority_Mapping_Manager_ptr &inout (void);
+ TAO_Network_Priority_Mapping_Manager_ptr &out (void);
+ TAO_Network_Priority_Mapping_Manager_ptr _retn (void);
+ TAO_Network_Priority_Mapping_Manager_ptr ptr (void) const;
+
+ // Hooks used by template sequence and object manager classes
+ // for non-defined forward declared interfaces.
+ static TAO_Network_Priority_Mapping_Manager_ptr duplicate (TAO_Network_Priority_Mapping_Manager_ptr);
+ static void release (TAO_Network_Priority_Mapping_Manager_ptr);
+ static TAO_Network_Priority_Mapping_Manager_ptr nil (void);
+ static TAO_Network_Priority_Mapping_Manager_ptr narrow (CORBA::Object * ACE_ENV_ARG_DECL_NOT_USED);
+ static CORBA::Object * upcast (void *);
+
+private:
+ /// Unimplemented - prevents widening assignment.
+ TAO_Network_Priority_Mapping_Manager_ptr ptr_;
+ TAO_Network_Priority_Mapping_Manager_var (const TAO_Base_var &rhs);
+ TAO_Network_Priority_Mapping_Manager_var &operator= (const TAO_Base_var &rhs);
+};
+
+class TAO_RTCORBA_Export TAO_Network_Priority_Mapping_Manager_out
+{
+public:
+ TAO_Network_Priority_Mapping_Manager_out (TAO_Network_Priority_Mapping_Manager_ptr &);
+ TAO_Network_Priority_Mapping_Manager_out (TAO_Network_Priority_Mapping_Manager_var &);
+ TAO_Network_Priority_Mapping_Manager_out (const TAO_Network_Priority_Mapping_Manager_out &);
+ TAO_Network_Priority_Mapping_Manager_out &operator= (const TAO_Network_Priority_Mapping_Manager_out &);
+ TAO_Network_Priority_Mapping_Manager_out &operator= (const TAO_Network_Priority_Mapping_Manager_var &);
+ TAO_Network_Priority_Mapping_Manager_out &operator= (TAO_Network_Priority_Mapping_Manager_ptr);
+ operator TAO_Network_Priority_Mapping_Manager_ptr &();
+ TAO_Network_Priority_Mapping_Manager_ptr &ptr (void);
+ TAO_Network_Priority_Mapping_Manager_ptr operator-> (void);
+
+private:
+ TAO_Network_Priority_Mapping_Manager_ptr &ptr_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+#include "tao/RTCORBA/Network_Priority_Mapping_Manager.i"
+#endif /* __ACE_INLINE__ */
+
+#endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_NETWORK_PRIORITY_MAPPING_MANAGER_H */
diff --git a/TAO/tao/RTCORBA/Network_Priority_Mapping_Manager.i b/TAO/tao/RTCORBA/Network_Priority_Mapping_Manager.i
new file mode 100644
index 00000000000..919fecdfcab
--- /dev/null
+++ b/TAO/tao/RTCORBA/Network_Priority_Mapping_Manager.i
@@ -0,0 +1,225 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// *************************************************************
+// Inline operations for class TAO_Network_Priority_Mapping_Manager_var
+// *************************************************************
+
+ACE_INLINE
+TAO_Network_Priority_Mapping_Manager_var::TAO_Network_Priority_Mapping_Manager_var (void) // default constructor
+ : ptr_ (TAO_Network_Priority_Mapping_Manager::_nil ())
+{}
+
+ACE_INLINE
+TAO_Network_Priority_Mapping_Manager_var::TAO_Network_Priority_Mapping_Manager_var (TAO_Network_Priority_Mapping_Manager_ptr p)
+ : ptr_ (p)
+{}
+
+ACE_INLINE ::TAO_Network_Priority_Mapping_Manager_ptr
+TAO_Network_Priority_Mapping_Manager_var::ptr (void) const
+{
+ return this->ptr_;
+}
+
+ACE_INLINE
+TAO_Network_Priority_Mapping_Manager_var::TAO_Network_Priority_Mapping_Manager_var (const ::TAO_Network_Priority_Mapping_Manager_var &p) // copy constructor
+ : TAO_Base_var (),
+ ptr_ (TAO_Network_Priority_Mapping_Manager::_duplicate (p.ptr ()))
+{}
+
+ACE_INLINE
+TAO_Network_Priority_Mapping_Manager_var::~TAO_Network_Priority_Mapping_Manager_var (void) // destructor
+{
+ CORBA::release (this->ptr_);
+}
+
+ACE_INLINE TAO_Network_Priority_Mapping_Manager_var &
+TAO_Network_Priority_Mapping_Manager_var::operator= (TAO_Network_Priority_Mapping_Manager_ptr p)
+{
+ CORBA::release (this->ptr_);
+ this->ptr_ = p;
+ return *this;
+}
+
+ACE_INLINE TAO_Network_Priority_Mapping_Manager_var &
+TAO_Network_Priority_Mapping_Manager_var::operator= (const ::TAO_Network_Priority_Mapping_Manager_var &p)
+{
+ if (this != &p)
+ {
+ CORBA::release (this->ptr_);
+ this->ptr_ = ::TAO_Network_Priority_Mapping_Manager::_duplicate (p.ptr ());
+ }
+ return *this;
+}
+
+ACE_INLINE
+TAO_Network_Priority_Mapping_Manager_var::operator const ::TAO_Network_Priority_Mapping_Manager_ptr &() const // cast
+{
+ return this->ptr_;
+}
+
+ACE_INLINE
+TAO_Network_Priority_Mapping_Manager_var::operator ::TAO_Network_Priority_Mapping_Manager_ptr &() // cast
+{
+ return this->ptr_;
+}
+
+ACE_INLINE ::TAO_Network_Priority_Mapping_Manager_ptr
+TAO_Network_Priority_Mapping_Manager_var::operator-> (void) const
+{
+ return this->ptr_;
+}
+
+ACE_INLINE ::TAO_Network_Priority_Mapping_Manager_ptr
+TAO_Network_Priority_Mapping_Manager_var::in (void) const
+{
+ return this->ptr_;
+}
+
+ACE_INLINE ::TAO_Network_Priority_Mapping_Manager_ptr &
+TAO_Network_Priority_Mapping_Manager_var::inout (void)
+{
+ return this->ptr_;
+}
+
+ACE_INLINE ::TAO_Network_Priority_Mapping_Manager_ptr &
+TAO_Network_Priority_Mapping_Manager_var::out (void)
+{
+ CORBA::release (this->ptr_);
+ this->ptr_ = ::TAO_Network_Priority_Mapping_Manager::_nil ();
+ return this->ptr_;
+}
+
+ACE_INLINE ::TAO_Network_Priority_Mapping_Manager_ptr
+TAO_Network_Priority_Mapping_Manager_var::_retn (void)
+{
+ // yield ownership of managed obj reference
+ ::TAO_Network_Priority_Mapping_Manager_ptr val = this->ptr_;
+ this->ptr_ = ::TAO_Network_Priority_Mapping_Manager::_nil ();
+ return val;
+}
+
+ACE_INLINE ::TAO_Network_Priority_Mapping_Manager_ptr
+TAO_Network_Priority_Mapping_Manager_var::duplicate (TAO_Network_Priority_Mapping_Manager_ptr p)
+{
+ return ::TAO_Network_Priority_Mapping_Manager::_duplicate (p);
+}
+
+ACE_INLINE void
+TAO_Network_Priority_Mapping_Manager_var::release (TAO_Network_Priority_Mapping_Manager_ptr p)
+{
+ CORBA::release (p);
+}
+
+ACE_INLINE ::TAO_Network_Priority_Mapping_Manager_ptr
+TAO_Network_Priority_Mapping_Manager_var::nil (void)
+{
+ return ::TAO_Network_Priority_Mapping_Manager::_nil ();
+}
+
+ACE_INLINE ::TAO_Network_Priority_Mapping_Manager_ptr
+TAO_Network_Priority_Mapping_Manager_var::narrow (
+ CORBA::Object *p
+ ACE_ENV_ARG_DECL
+ )
+{
+ return ::TAO_Network_Priority_Mapping_Manager::_narrow (p ACE_ENV_ARG_PARAMETER);
+}
+
+ACE_INLINE CORBA::Object *
+TAO_Network_Priority_Mapping_Manager_var::upcast (void *src)
+{
+ TAO_Network_Priority_Mapping_Manager **tmp =
+ static_cast<TAO_Network_Priority_Mapping_Manager **> (src);
+ return *tmp;
+}
+
+
+// *************************************************************
+// Inline operations for class TAO_Network_Priority_Mapping_Manager_out
+// *************************************************************
+
+ACE_INLINE
+TAO_Network_Priority_Mapping_Manager_out::TAO_Network_Priority_Mapping_Manager_out (TAO_Network_Priority_Mapping_Manager_ptr &p)
+ : ptr_ (p)
+{
+ this->ptr_ = ::TAO_Network_Priority_Mapping_Manager::_nil ();
+}
+
+ACE_INLINE
+TAO_Network_Priority_Mapping_Manager_out::TAO_Network_Priority_Mapping_Manager_out (TAO_Network_Priority_Mapping_Manager_var &p) // constructor from _var
+ : ptr_ (p.out ())
+{
+ CORBA::release (this->ptr_);
+ this->ptr_ = ::TAO_Network_Priority_Mapping_Manager::_nil ();
+}
+
+ACE_INLINE
+TAO_Network_Priority_Mapping_Manager_out::TAO_Network_Priority_Mapping_Manager_out (const ::TAO_Network_Priority_Mapping_Manager_out &p) // copy constructor
+ : ptr_ (const_cast<TAO_Network_Priority_Mapping_Manager_out &> (p).ptr_)
+{}
+
+ACE_INLINE ::TAO_Network_Priority_Mapping_Manager_out &
+TAO_Network_Priority_Mapping_Manager_out::operator= (const ::TAO_Network_Priority_Mapping_Manager_out &p)
+{
+ this->ptr_ = const_cast<TAO_Network_Priority_Mapping_Manager_out&> (p).ptr_;
+ return *this;
+}
+
+ACE_INLINE TAO_Network_Priority_Mapping_Manager_out &
+TAO_Network_Priority_Mapping_Manager_out::operator= (const ::TAO_Network_Priority_Mapping_Manager_var &p)
+{
+ this->ptr_ = ::TAO_Network_Priority_Mapping_Manager::_duplicate (p.ptr ());
+ return *this;
+}
+
+ACE_INLINE TAO_Network_Priority_Mapping_Manager_out &
+TAO_Network_Priority_Mapping_Manager_out::operator= (TAO_Network_Priority_Mapping_Manager_ptr p)
+{
+ this->ptr_ = p;
+ return *this;
+}
+
+ACE_INLINE
+TAO_Network_Priority_Mapping_Manager_out::operator ::TAO_Network_Priority_Mapping_Manager_ptr &() // cast
+{
+ return this->ptr_;
+}
+
+ACE_INLINE ::TAO_Network_Priority_Mapping_Manager_ptr &
+TAO_Network_Priority_Mapping_Manager_out::ptr (void) // ptr
+{
+ return this->ptr_;
+}
+
+ACE_INLINE ::TAO_Network_Priority_Mapping_Manager_ptr
+TAO_Network_Priority_Mapping_Manager_out::operator-> (void)
+{
+ return this->ptr_;
+}
+
+///////////////////////////////////////////////////////////////////////////
+ACE_INLINE
+TAO_Network_Priority_Mapping_Manager::TAO_Network_Priority_Mapping_Manager (RTCORBA::NetworkPriorityMapping * mapping)
+ : mapping_ (mapping)
+{
+}
+
+ACE_INLINE RTCORBA::NetworkPriorityMapping *
+TAO_Network_Priority_Mapping_Manager::mapping (void)
+{
+ return this->mapping_;
+}
+
+ACE_INLINE void
+TAO_Network_Priority_Mapping_Manager::mapping (RTCORBA::NetworkPriorityMapping *mapping)
+{
+ delete this->mapping_;
+ this->mapping_ = mapping;
+}
+
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/RTCORBA/Priority_Mapping.cpp b/TAO/tao/RTCORBA/Priority_Mapping.cpp
new file mode 100644
index 00000000000..ae4f6ebcf3f
--- /dev/null
+++ b/TAO/tao/RTCORBA/Priority_Mapping.cpp
@@ -0,0 +1,21 @@
+// $Id$
+
+#include "tao/orbconf.h"
+
+#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
+
+#include "tao/RTCORBA/Priority_Mapping.h"
+
+ACE_RCSID(RTCORBA,
+ Priority_Mapping,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Priority_Mapping::~TAO_Priority_Mapping (void)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
diff --git a/TAO/tao/RTCORBA/Priority_Mapping.h b/TAO/tao/RTCORBA/Priority_Mapping.h
new file mode 100644
index 00000000000..10425814b01
--- /dev/null
+++ b/TAO/tao/RTCORBA/Priority_Mapping.h
@@ -0,0 +1,61 @@
+
+//=============================================================================
+/**
+ * @file Priority_Mapping.h
+ *
+ * $Id$
+ *
+ * Declares the Priority_Mapping interface, as defined in the
+ * RT-CORBA spec.
+ *
+ *
+ * @author Carlos O'Ryan (coryan@cs.wustl.edu)
+ */
+//=============================================================================
+
+
+#ifndef TAO_PRIORITY_MAPPING_H
+#define TAO_PRIORITY_MAPPING_H
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
+
+#define TAO_RTCORBA_SAFE_INCLUDE
+#include "tao/RTCORBA/RTCORBAC.h"
+#undef TAO_RTCORBA_SAFE_INCLUDE
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_Priority_Mapping
+ *
+ * @brief The interface for priority mapping.
+ *
+ * Check the RT-CORBA spec (orbos/99-02-12) secions 4.5.2
+ */
+class TAO_RTCORBA_Export TAO_Priority_Mapping
+{
+public:
+ /// The destructor
+ virtual ~TAO_Priority_Mapping (void);
+
+ virtual CORBA::Boolean
+ to_native (RTCORBA::Priority corba_priority,
+ RTCORBA::NativePriority &native_priority) = 0;
+ virtual CORBA::Boolean
+ to_CORBA (RTCORBA::NativePriority native_priority,
+ RTCORBA::Priority &corba_priority) = 0;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_PRIORITY_MAPPING_H */
diff --git a/TAO/tao/RTCORBA/Priority_Mapping_Manager.cpp b/TAO/tao/RTCORBA/Priority_Mapping_Manager.cpp
new file mode 100644
index 00000000000..47f3804489a
--- /dev/null
+++ b/TAO/tao/RTCORBA/Priority_Mapping_Manager.cpp
@@ -0,0 +1,54 @@
+// $Id$
+
+#include "tao/RTCORBA/Priority_Mapping_Manager.h"
+
+#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
+
+#if ! defined (__ACE_INLINE__)
+#include "tao/RTCORBA/Priority_Mapping_Manager.i"
+#endif /* __ACE_INLINE__ */
+
+ACE_RCSID (RTCORBA,
+ Priority_Mapping_Manager,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Priority_Mapping_Manager::~TAO_Priority_Mapping_Manager (void)
+{
+ delete this->mapping_;
+}
+
+TAO_Priority_Mapping_Manager_ptr
+TAO_Priority_Mapping_Manager::_narrow (CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_NOT_USED)
+{
+ if (CORBA::is_nil (obj))
+ {
+ return TAO_Priority_Mapping_Manager::_nil ();
+ }
+
+ return
+ TAO_Priority_Mapping_Manager::_duplicate (
+ dynamic_cast<TAO_Priority_Mapping_Manager_ptr> (obj)
+ );
+}
+
+TAO_Priority_Mapping_Manager_ptr
+TAO_Priority_Mapping_Manager::_duplicate (TAO_Priority_Mapping_Manager_ptr obj)
+{
+ if (!CORBA::is_nil (obj))
+ obj->_add_ref ();
+ return obj;
+}
+
+const char*
+TAO_Priority_Mapping_Manager::_interface_repository_id (void) const
+{
+ return "IDL:Priority_Mapping_Manager:1.0";
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
+
diff --git a/TAO/tao/RTCORBA/Priority_Mapping_Manager.h b/TAO/tao/RTCORBA/Priority_Mapping_Manager.h
new file mode 100644
index 00000000000..e5b63369e51
--- /dev/null
+++ b/TAO/tao/RTCORBA/Priority_Mapping_Manager.h
@@ -0,0 +1,154 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Priority_Mapping_Manager.h
+ *
+ * $Id$
+ *
+ * @author Marina Spivak (marina@cs.wustl.edu)
+ */
+//=============================================================================
+
+
+#ifndef TAO_PRIORITY_MAPPING_MANAGER_H
+#define TAO_PRIORITY_MAPPING_MANAGER_H
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+#include "tao/RTCORBA/rtcorba_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
+
+#include "tao/RTCORBA/Priority_Mapping.h"
+#include "tao/LocalObject.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Priority_Mapping_Manager;
+class TAO_Priority_Mapping_Manager_var;
+typedef TAO_Priority_Mapping_Manager *TAO_Priority_Mapping_Manager_ptr;
+
+
+/**
+ * @class TAO_Priority_Mapping_Manager
+ *
+ * @brief Priority_Mapping_Manager pseudo-objref.
+ *
+ * Allows setting of user-defined Priority_Mapping at run-time.
+ */
+class TAO_RTCORBA_Export TAO_Priority_Mapping_Manager :
+ public virtual TAO_Local_RefCounted_Object
+{
+
+public:
+ /// Constructor.
+ TAO_Priority_Mapping_Manager (RTCORBA::PriorityMapping * mapping);
+
+ ///
+ void mapping (RTCORBA::PriorityMapping * mapping);
+
+ ///
+ RTCORBA::PriorityMapping *mapping (void);
+
+public:
+ typedef TAO_Priority_Mapping_Manager_ptr _ptr_type;
+ typedef TAO_Priority_Mapping_Manager_var _var_type;
+
+ // the static operations
+ static TAO_Priority_Mapping_Manager_ptr _duplicate (TAO_Priority_Mapping_Manager_ptr obj);
+ static TAO_Priority_Mapping_Manager_ptr _narrow (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ static TAO_Priority_Mapping_Manager_ptr _nil (void)
+ {
+ return (TAO_Priority_Mapping_Manager_ptr)0;
+ }
+
+ virtual const char* _interface_repository_id (void) const;
+
+protected:
+
+ /// Protected destructor to enforce proper memory management of this
+ /// reference counted object.
+ ~TAO_Priority_Mapping_Manager (void);
+
+private:
+
+ TAO_Priority_Mapping_Manager (const TAO_Priority_Mapping_Manager &);
+ void operator= (const TAO_Priority_Mapping_Manager &);
+
+private:
+
+ TAO_Priority_Mapping *mapping_;
+};
+
+class TAO_RTCORBA_Export TAO_Priority_Mapping_Manager_var
+ : private TAO_Base_var
+{
+public:
+ TAO_Priority_Mapping_Manager_var (void); // default constructor
+ TAO_Priority_Mapping_Manager_var (TAO_Priority_Mapping_Manager_ptr);
+ TAO_Priority_Mapping_Manager_var (const TAO_Priority_Mapping_Manager_var &); // copy constructor
+ ~TAO_Priority_Mapping_Manager_var (void); // destructor
+
+ TAO_Priority_Mapping_Manager_var &operator= (TAO_Priority_Mapping_Manager_ptr);
+ TAO_Priority_Mapping_Manager_var &operator= (const TAO_Priority_Mapping_Manager_var &);
+ TAO_Priority_Mapping_Manager_ptr operator-> (void) const;
+
+ /// in, inout, out, _retn
+ operator const TAO_Priority_Mapping_Manager_ptr &() const;
+ operator TAO_Priority_Mapping_Manager_ptr &();
+ TAO_Priority_Mapping_Manager_ptr in (void) const;
+ TAO_Priority_Mapping_Manager_ptr &inout (void);
+ TAO_Priority_Mapping_Manager_ptr &out (void);
+ TAO_Priority_Mapping_Manager_ptr _retn (void);
+ TAO_Priority_Mapping_Manager_ptr ptr (void) const;
+
+ // Hooks used by template sequence and object manager classes
+ // for non-defined forward declared interfaces.
+ static TAO_Priority_Mapping_Manager_ptr duplicate (TAO_Priority_Mapping_Manager_ptr);
+ static void release (TAO_Priority_Mapping_Manager_ptr);
+ static TAO_Priority_Mapping_Manager_ptr nil (void);
+ static TAO_Priority_Mapping_Manager_ptr narrow (CORBA::Object * ACE_ENV_ARG_DECL_NOT_USED);
+ static CORBA::Object * upcast (void *);
+
+private:
+ /// Unimplemented - prevents widening assignment.
+ TAO_Priority_Mapping_Manager_ptr ptr_;
+ TAO_Priority_Mapping_Manager_var (const TAO_Base_var &rhs);
+ TAO_Priority_Mapping_Manager_var &operator= (const TAO_Base_var &rhs);
+};
+
+class TAO_RTCORBA_Export TAO_Priority_Mapping_Manager_out
+{
+public:
+ TAO_Priority_Mapping_Manager_out (TAO_Priority_Mapping_Manager_ptr &);
+ TAO_Priority_Mapping_Manager_out (TAO_Priority_Mapping_Manager_var &);
+ TAO_Priority_Mapping_Manager_out (const TAO_Priority_Mapping_Manager_out &);
+ TAO_Priority_Mapping_Manager_out &operator= (const TAO_Priority_Mapping_Manager_out &);
+ TAO_Priority_Mapping_Manager_out &operator= (const TAO_Priority_Mapping_Manager_var &);
+ TAO_Priority_Mapping_Manager_out &operator= (TAO_Priority_Mapping_Manager_ptr);
+ operator TAO_Priority_Mapping_Manager_ptr &();
+ TAO_Priority_Mapping_Manager_ptr &ptr (void);
+ TAO_Priority_Mapping_Manager_ptr operator-> (void);
+
+private:
+ TAO_Priority_Mapping_Manager_ptr &ptr_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+#include "tao/RTCORBA/Priority_Mapping_Manager.i"
+#endif /* __ACE_INLINE__ */
+
+#endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_PRIORITY_MAPPING_MANAGER_H */
diff --git a/TAO/tao/RTCORBA/Priority_Mapping_Manager.i b/TAO/tao/RTCORBA/Priority_Mapping_Manager.i
new file mode 100644
index 00000000000..4d8fa4007ab
--- /dev/null
+++ b/TAO/tao/RTCORBA/Priority_Mapping_Manager.i
@@ -0,0 +1,224 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// *************************************************************
+// Inline operations for class TAO_Priority_Mapping_Manager_var
+// *************************************************************
+
+ACE_INLINE
+TAO_Priority_Mapping_Manager_var::TAO_Priority_Mapping_Manager_var (void) // default constructor
+ : ptr_ (TAO_Priority_Mapping_Manager::_nil ())
+{}
+
+ACE_INLINE
+TAO_Priority_Mapping_Manager_var::TAO_Priority_Mapping_Manager_var (TAO_Priority_Mapping_Manager_ptr p)
+ : ptr_ (p)
+{}
+
+ACE_INLINE ::TAO_Priority_Mapping_Manager_ptr
+TAO_Priority_Mapping_Manager_var::ptr (void) const
+{
+ return this->ptr_;
+}
+
+ACE_INLINE
+TAO_Priority_Mapping_Manager_var::TAO_Priority_Mapping_Manager_var (const ::TAO_Priority_Mapping_Manager_var &p) // copy constructor
+ : TAO_Base_var (),
+ ptr_ (TAO_Priority_Mapping_Manager::_duplicate (p.ptr ()))
+{}
+
+ACE_INLINE
+TAO_Priority_Mapping_Manager_var::~TAO_Priority_Mapping_Manager_var (void) // destructor
+{
+ CORBA::release (this->ptr_);
+}
+
+ACE_INLINE TAO_Priority_Mapping_Manager_var &
+TAO_Priority_Mapping_Manager_var::operator= (TAO_Priority_Mapping_Manager_ptr p)
+{
+ CORBA::release (this->ptr_);
+ this->ptr_ = p;
+ return *this;
+}
+
+ACE_INLINE TAO_Priority_Mapping_Manager_var &
+TAO_Priority_Mapping_Manager_var::operator= (const ::TAO_Priority_Mapping_Manager_var &p)
+{
+ if (this != &p)
+ {
+ CORBA::release (this->ptr_);
+ this->ptr_ = ::TAO_Priority_Mapping_Manager::_duplicate (p.ptr ());
+ }
+ return *this;
+}
+
+ACE_INLINE
+TAO_Priority_Mapping_Manager_var::operator const ::TAO_Priority_Mapping_Manager_ptr &() const // cast
+{
+ return this->ptr_;
+}
+
+ACE_INLINE
+TAO_Priority_Mapping_Manager_var::operator ::TAO_Priority_Mapping_Manager_ptr &() // cast
+{
+ return this->ptr_;
+}
+
+ACE_INLINE ::TAO_Priority_Mapping_Manager_ptr
+TAO_Priority_Mapping_Manager_var::operator-> (void) const
+{
+ return this->ptr_;
+}
+
+ACE_INLINE ::TAO_Priority_Mapping_Manager_ptr
+TAO_Priority_Mapping_Manager_var::in (void) const
+{
+ return this->ptr_;
+}
+
+ACE_INLINE ::TAO_Priority_Mapping_Manager_ptr &
+TAO_Priority_Mapping_Manager_var::inout (void)
+{
+ return this->ptr_;
+}
+
+ACE_INLINE ::TAO_Priority_Mapping_Manager_ptr &
+TAO_Priority_Mapping_Manager_var::out (void)
+{
+ CORBA::release (this->ptr_);
+ this->ptr_ = ::TAO_Priority_Mapping_Manager::_nil ();
+ return this->ptr_;
+}
+
+ACE_INLINE ::TAO_Priority_Mapping_Manager_ptr
+TAO_Priority_Mapping_Manager_var::_retn (void)
+{
+ // yield ownership of managed obj reference
+ ::TAO_Priority_Mapping_Manager_ptr val = this->ptr_;
+ this->ptr_ = ::TAO_Priority_Mapping_Manager::_nil ();
+ return val;
+}
+
+ACE_INLINE ::TAO_Priority_Mapping_Manager_ptr
+TAO_Priority_Mapping_Manager_var::duplicate (TAO_Priority_Mapping_Manager_ptr p)
+{
+ return ::TAO_Priority_Mapping_Manager::_duplicate (p);
+}
+
+ACE_INLINE void
+TAO_Priority_Mapping_Manager_var::release (TAO_Priority_Mapping_Manager_ptr p)
+{
+ CORBA::release (p);
+}
+
+ACE_INLINE ::TAO_Priority_Mapping_Manager_ptr
+TAO_Priority_Mapping_Manager_var::nil (void)
+{
+ return ::TAO_Priority_Mapping_Manager::_nil ();
+}
+
+ACE_INLINE ::TAO_Priority_Mapping_Manager_ptr
+TAO_Priority_Mapping_Manager_var::narrow (
+ CORBA::Object *p
+ ACE_ENV_ARG_DECL
+ )
+{
+ return ::TAO_Priority_Mapping_Manager::_narrow (p ACE_ENV_ARG_PARAMETER);
+}
+
+ACE_INLINE CORBA::Object *
+TAO_Priority_Mapping_Manager_var::upcast (void *src)
+{
+ TAO_Priority_Mapping_Manager **tmp =
+ static_cast<TAO_Priority_Mapping_Manager **> (src);
+ return *tmp;
+}
+
+
+// *************************************************************
+// Inline operations for class TAO_Priority_Mapping_Manager_out
+// *************************************************************
+
+ACE_INLINE
+TAO_Priority_Mapping_Manager_out::TAO_Priority_Mapping_Manager_out (TAO_Priority_Mapping_Manager_ptr &p)
+ : ptr_ (p)
+{
+ this->ptr_ = ::TAO_Priority_Mapping_Manager::_nil ();
+}
+
+ACE_INLINE
+TAO_Priority_Mapping_Manager_out::TAO_Priority_Mapping_Manager_out (TAO_Priority_Mapping_Manager_var &p) // constructor from _var
+ : ptr_ (p.out ())
+{
+ CORBA::release (this->ptr_);
+ this->ptr_ = ::TAO_Priority_Mapping_Manager::_nil ();
+}
+
+ACE_INLINE
+TAO_Priority_Mapping_Manager_out::TAO_Priority_Mapping_Manager_out (const ::TAO_Priority_Mapping_Manager_out &p) // copy constructor
+ : ptr_ (const_cast<TAO_Priority_Mapping_Manager_out &> (p).ptr_)
+{}
+
+ACE_INLINE ::TAO_Priority_Mapping_Manager_out &
+TAO_Priority_Mapping_Manager_out::operator= (const ::TAO_Priority_Mapping_Manager_out &p)
+{
+ this->ptr_ = const_cast<TAO_Priority_Mapping_Manager_out&> (p).ptr_;
+ return *this;
+}
+
+ACE_INLINE TAO_Priority_Mapping_Manager_out &
+TAO_Priority_Mapping_Manager_out::operator= (const ::TAO_Priority_Mapping_Manager_var &p)
+{
+ this->ptr_ = ::TAO_Priority_Mapping_Manager::_duplicate (p.ptr ());
+ return *this;
+}
+
+ACE_INLINE TAO_Priority_Mapping_Manager_out &
+TAO_Priority_Mapping_Manager_out::operator= (TAO_Priority_Mapping_Manager_ptr p)
+{
+ this->ptr_ = p;
+ return *this;
+}
+
+ACE_INLINE
+TAO_Priority_Mapping_Manager_out::operator ::TAO_Priority_Mapping_Manager_ptr &() // cast
+{
+ return this->ptr_;
+}
+
+ACE_INLINE ::TAO_Priority_Mapping_Manager_ptr &
+TAO_Priority_Mapping_Manager_out::ptr (void) // ptr
+{
+ return this->ptr_;
+}
+
+ACE_INLINE ::TAO_Priority_Mapping_Manager_ptr
+TAO_Priority_Mapping_Manager_out::operator-> (void)
+{
+ return this->ptr_;
+}
+
+///////////////////////////////////////////////////////////////////////////
+ACE_INLINE
+TAO_Priority_Mapping_Manager::TAO_Priority_Mapping_Manager (RTCORBA::PriorityMapping * mapping)
+ : mapping_ (mapping)
+{
+}
+
+ACE_INLINE RTCORBA::PriorityMapping *
+TAO_Priority_Mapping_Manager::mapping (void)
+{
+ return this->mapping_;
+}
+
+ACE_INLINE void
+TAO_Priority_Mapping_Manager::mapping (RTCORBA::PriorityMapping *mapping)
+{
+ delete this->mapping_;
+ this->mapping_ = mapping;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/RTCORBA/RTCORBA.cpp b/TAO/tao/RTCORBA/RTCORBA.cpp
new file mode 100644
index 00000000000..3f29493da22
--- /dev/null
+++ b/TAO/tao/RTCORBA/RTCORBA.cpp
@@ -0,0 +1,20 @@
+// $Id$
+
+#include "tao/RTCORBA/RTCORBA.h"
+
+#if TAO_HAS_CORBA_MESSAGING == 1
+
+#include "tao/RTCORBA/RT_ORB_Loader.h"
+
+ACE_RCSID (RTCORBA, RTCORBA, "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_RTCORBA_Initializer::TAO_RTCORBA_Initializer (void)
+{
+ ACE_Service_Config::process_directive (ace_svc_desc_TAO_RT_ORB_Loader);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
diff --git a/TAO/tao/RTCORBA/RTCORBA.h b/TAO/tao/RTCORBA/RTCORBA.h
new file mode 100644
index 00000000000..ead9d8ce329
--- /dev/null
+++ b/TAO/tao/RTCORBA/RTCORBA.h
@@ -0,0 +1,55 @@
+// -*- C++ -*-
+
+// $Id$
+
+//=============================================================================
+/**
+ * @file RTCORBA.h
+ *
+ * $Id$
+ *
+ * Takes care of the RT ORB loading on static build.
+ *
+ *
+ * @author Angelo Corsaro <corsaro@cs.wustl.edu>
+ * @author Frank Hunleth <fhunleth@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_RTCORBA_H_
+#define TAO_RTCORBA_H_
+
+#include /**/ "ace/pre.h"
+
+#include "tao/RTCORBA/rtcorba_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/orbconf.h"
+
+#if TAO_HAS_CORBA_MESSAGING == 1
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_RTCORBA_Export TAO_RTCORBA_Initializer
+{
+public:
+ // Constructor.
+ TAO_RTCORBA_Initializer (void);
+};
+
+static TAO_RTCORBA_Initializer TAO_RTCORBA_initializer;
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#define TAO_RTCORBA_SAFE_INCLUDE
+#include "tao/RTCORBA/RTCORBAC.h"
+#undef TAO_RTCORBA_SAFE_INCLUDE
+
+#endif /* TAO_HAS_CORBA_MESSAGING != 0 */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_RTCORBA_H_ */
diff --git a/TAO/tao/RTCORBA/RTCORBA.pidl b/TAO/tao/RTCORBA/RTCORBA.pidl
new file mode 100644
index 00000000000..703ae6c7732
--- /dev/null
+++ b/TAO/tao/RTCORBA/RTCORBA.pidl
@@ -0,0 +1,315 @@
+/**
+ * @file RTCORBA.pidl
+ *
+ * $Id$
+ *
+ * @brief Pre-compiled IDL source for the RTCORBA module.
+ *
+ * The RTCORBA module specified in CORBA v2.4.2 Chapter 24 (February,
+ * 2001).
+ *
+ * Changes to the original OMG idl:
+ *
+ * 1. Two TAO-specific interfaces, UnixDomainProtocolProperties
+ * and SharedMemoryProtocolProperties, have been added to allow
+ * configuration of TAO's UIOP and SHMEM pluggable protocols
+ * through RTCORBA Protocol Policies.
+ * 2. TAO-specific support for named mutexes has been added.
+ * 3. Added RT_ORB::create_tcp_protocol_properties which seems
+ * to come and go from the formal specification, but is needed.
+ *
+ * This file was used to generate the code in RTCORBAC.{h,inl,cpp}.
+ * The steps to regenerate the code are as follows:
+ *
+ * 1. Run the tao_idl compiler on the pidl file. The command used for
+ * this is:
+ *
+ * tao_idl -o orig -Gp -Gd -Ge 1 -Sci -I../..
+ * -Wb,export_macro=TAO_RTCORBA_Export
+ * -Wb,export_include="rtcorba_export.h"
+ * -Wb,pre_include="ace/pre.h"
+ * -Wb,post_include="ace/post.h"
+ * RTCORBA.pidl
+ *
+ * 2. Then apply the patches in tao/RTCORBA/diffs to the generated code.
+ * The patches provide the following fixes: 1) remove several unnecessary
+ * includes, e.g., corba.h, stream.h, Policy.h, 3) add anything else we
+ * need into the namespace, i.e., TAO_Priority_Mapping, and 4) fix
+ * "nested_class" occurrences in the .cpp.
+ *
+ * Apply patches using the following commands:
+ *
+ * patch < diffs/RTCORBA.diff
+ *
+ * Note: The diffs were generated with these commands:
+ *
+ * for i in RTCORBAC.{h,inl,cpp}; do
+ * diff -wBbu orig/$i $i
+ * done > diffs/RTCORBA.diff
+ *
+ */
+
+#ifndef _RT_CORBA_IDL_
+#define _RT_CORBA_IDL_
+
+#include "tao/IOP.pidl"
+#include "tao/TimeBase.pidl"
+#include "tao/Policy.pidl"
+
+#pragma prefix "omg.org"
+
+module RTCORBA
+{
+ // Priorities.
+ typedef short NativePriority;
+ typedef short Priority;
+ const Priority minPriority = 0;
+ const Priority maxPriority = 32767;
+
+ native PriorityMapping;
+ native PriorityTransform;
+
+ typedef long NetworkPriority;
+ native NetworkPriorityMapping;
+
+ // Threadpool types.
+ typedef unsigned long ThreadpoolId;
+
+ struct ThreadpoolLane
+ {
+ Priority lane_priority;
+ unsigned long static_threads;
+ unsigned long dynamic_threads;
+ };
+ typedef sequence <ThreadpoolLane> ThreadpoolLanes;
+
+ // RT Policies.
+
+ // Priority Model Policy.
+ const CORBA::PolicyType PRIORITY_MODEL_POLICY_TYPE = 40;
+ enum PriorityModel
+ {
+ CLIENT_PROPAGATED,
+ SERVER_DECLARED
+ };
+
+ local interface PriorityModelPolicy : CORBA::Policy
+ {
+ readonly attribute PriorityModel priority_model;
+ readonly attribute Priority server_priority;
+ };
+
+ // Threadpool Policy.
+ const CORBA::PolicyType THREADPOOL_POLICY_TYPE = 41;
+ local interface ThreadpoolPolicy : CORBA::Policy
+ {
+ readonly attribute ThreadpoolId threadpool;
+ };
+
+ // Protocol Properties.
+ local interface ProtocolProperties {};
+
+ struct Protocol
+ {
+ IOP::ProfileId protocol_type;
+ ProtocolProperties orb_protocol_properties;
+ ProtocolProperties transport_protocol_properties;
+ };
+
+ typedef sequence <Protocol> ProtocolList;
+
+ // Server Protocol Policy
+ const CORBA::PolicyType SERVER_PROTOCOL_POLICY_TYPE = 42;
+
+ // Locality constrained interface
+ local interface ServerProtocolPolicy : CORBA::Policy
+ {
+ readonly attribute ProtocolList protocols;
+ };
+
+ // Client Protocol Policy
+ const CORBA::PolicyType CLIENT_PROTOCOL_POLICY_TYPE = 43;
+
+ // Locality constrained interface
+ local interface ClientProtocolPolicy : CORBA::Policy
+ {
+ readonly attribute ProtocolList protocols;
+ };
+
+ // Private Connection Policy
+ const CORBA::PolicyType PRIVATE_CONNECTION_POLICY_TYPE = 44;
+
+ // Locality constrained interface
+ local interface PrivateConnectionPolicy : CORBA::Policy {};
+
+ local interface TCPProtocolProperties : ProtocolProperties
+ {
+ attribute long send_buffer_size;
+ attribute long recv_buffer_size;
+ attribute boolean keep_alive;
+ attribute boolean dont_route;
+ attribute boolean no_delay;
+ attribute boolean enable_network_priority;
+ };
+
+ local interface GIOPProtocolProperties : ProtocolProperties {};
+
+ // Properties for TAO-specific protocols (these protocols &
+ // interfaces are not specified by the OMG).
+
+ // Communication over Unix Domain Sockets (Local IPC).
+ local interface UnixDomainProtocolProperties : ProtocolProperties
+ {
+ attribute long send_buffer_size;
+ attribute long recv_buffer_size;
+ };
+
+ // Communication over Shared Memory.
+ local interface SharedMemoryProtocolProperties : ProtocolProperties
+ {
+ attribute long send_buffer_size;
+ attribute long recv_buffer_size;
+ attribute boolean keep_alive;
+ attribute boolean dont_route;
+ attribute boolean no_delay;
+ attribute long preallocate_buffer_size;
+ attribute string mmap_filename;
+ attribute string mmap_lockname;
+ };
+
+ local interface UserDatagramProtocolProperties : ProtocolProperties
+ {
+ attribute boolean enable_network_priority;
+ };
+
+ local interface StreamControlProtocolProperties : ProtocolProperties
+ {
+ attribute long send_buffer_size;
+ attribute long recv_buffer_size;
+ attribute boolean keep_alive;
+ attribute boolean dont_route;
+ attribute boolean no_delay;
+ attribute boolean enable_network_priority;
+ };
+
+ // End of TAO-specific interfaces.
+
+ // PriorityBandedConnectionPolicy.
+ struct PriorityBand
+ {
+ Priority low;
+ Priority high;
+ };
+ typedef sequence <PriorityBand> PriorityBands;
+
+ const CORBA::PolicyType PRIORITY_BANDED_CONNECTION_POLICY_TYPE = 45;
+ local interface PriorityBandedConnectionPolicy : CORBA::Policy
+ {
+ readonly attribute PriorityBands priority_bands;
+ };
+
+ // RT Current.
+ local interface Current : CORBA::Current
+ {
+ attribute Priority the_priority;
+ };
+
+ // Mutex.
+ local interface Mutex
+ {
+ void lock ();
+ void unlock ();
+ boolean try_lock (in TimeBase::TimeT max_wait);
+ // if max_wait = 0 then return immediately
+ };
+
+ // RTORB.
+ local interface RTORB
+ {
+ // Mutex creation/destruction.
+ Mutex create_mutex ();
+ void destroy_mutex (in Mutex the_mutex);
+
+ // TAO specific
+ // Named Mutex creation/opening
+ exception MutexNotFound {};
+ Mutex create_named_mutex (in string name,
+ out boolean created_flag);
+ Mutex open_named_mutex (in string name)
+ raises (MutexNotFound);
+
+ // End TAO specific
+
+ TCPProtocolProperties create_tcp_protocol_properties(
+ in long send_buffer_size,
+ in long recv_buffer_size,
+ in boolean keep_alive,
+ in boolean dont_route,
+ in boolean no_delay,
+ in boolean enable_network_priority);
+
+ UnixDomainProtocolProperties create_unix_domain_protocol_properties(
+ in long send_buffer_size,
+ in long recv_buffer_size);
+
+ SharedMemoryProtocolProperties create_shared_memory_protocol_properties(
+ in long send_buffer_size,
+ in long recv_buffer_size,
+ in boolean keep_alive,
+ in boolean dont_route,
+ in boolean no_delay,
+ in long preallocate_buffer_size,
+ in string mmap_filename,
+ in string mmap_lockname);
+
+ UserDatagramProtocolProperties create_user_datagram_protocol_properties(
+ in boolean enable_network_priority);
+
+ StreamControlProtocolProperties create_stream_control_protocol_properties(
+ in long send_buffer_size,
+ in long recv_buffer_size,
+ in boolean keep_alive,
+ in boolean dont_route,
+ in boolean no_delay,
+ in boolean enable_network_priority);
+
+ // Threadpool creation/destruction.
+ exception InvalidThreadpool {};
+
+ ThreadpoolId create_threadpool (in unsigned long stacksize,
+ in unsigned long static_threads,
+ in unsigned long dynamic_threads,
+ in Priority default_priority,
+ in boolean allow_request_buffering,
+ in unsigned long max_buffered_requests,
+ in unsigned long max_request_buffer_size);
+
+ ThreadpoolId create_threadpool_with_lanes (in unsigned long stacksize,
+ in ThreadpoolLanes lanes,
+ in boolean allow_borrowing,
+ in boolean allow_request_buffering,
+ in unsigned long max_buffered_requests,
+ in unsigned long max_request_buffer_size);
+
+ void destroy_threadpool (in ThreadpoolId threadpool)
+ raises (InvalidThreadpool);
+
+ // RT Policies creation.
+ PriorityModelPolicy create_priority_model_policy (in PriorityModel priority_model,
+ in Priority server_priority);
+
+ ThreadpoolPolicy create_threadpool_policy (in ThreadpoolId threadpool);
+
+ PriorityBandedConnectionPolicy
+ create_priority_banded_connection_policy (in PriorityBands priority_bands);
+
+
+ ServerProtocolPolicy create_server_protocol_policy (in ProtocolList protocols);
+
+ ClientProtocolPolicy create_client_protocol_policy (in ProtocolList protocols);
+
+ PrivateConnectionPolicy create_private_connection_policy ();
+ };
+};
+
+#endif /* _RT_CORBA_IDL_ */
diff --git a/TAO/tao/RTCORBA/RTCORBAA.cpp b/TAO/tao/RTCORBA/RTCORBAA.cpp
new file mode 100644
index 00000000000..5f9260f6d8e
--- /dev/null
+++ b/TAO/tao/RTCORBA/RTCORBAA.cpp
@@ -0,0 +1,2471 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+#include "tao/AnyTypeCode/Null_RefCount_Policy.h"
+#include "tao/AnyTypeCode/TypeCode_Constants.h"
+#include "tao/AnyTypeCode/Alias_TypeCode_Static.h"
+#include "tao/AnyTypeCode/Enum_TypeCode_Static.h"
+#include "tao/AnyTypeCode/Objref_TypeCode_Static.h"
+#include "tao/AnyTypeCode/Sequence_TypeCode_Static.h"
+#include "tao/AnyTypeCode/String_TypeCode_Static.h"
+#include "tao/AnyTypeCode/Struct_TypeCode_Static.h"
+#include "tao/AnyTypeCode/TypeCode_Struct_Field.h"
+#include "tao/AnyTypeCode/Recursive_Type_TypeCode.h"
+#include "tao/RTCORBA/RTCORBA.h"
+#include "tao/CDR.h"
+#include "tao/AnyTypeCode/Any.h"
+#include "tao/AnyTypeCode/Any_Impl_T.h"
+#include "tao/AnyTypeCode/Any_Dual_Impl_T.h"
+#include "tao/AnyTypeCode/Any_Basic_Impl_T.h"
+#include "tao/AnyTypeCode/IOP_IORA.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/alias_typecode.cpp:50
+
+static TAO::TypeCode::Alias<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_RTCORBA_NativePriority (
+ CORBA::tk_alias,
+ "IDL:omg.org/RTCORBA/NativePriority:1.0",
+ "NativePriority",
+ &CORBA::_tc_short);
+
+namespace RTCORBA
+{
+ ::CORBA::TypeCode_ptr const _tc_NativePriority =
+ &_tao_tc_RTCORBA_NativePriority;
+}
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/alias_typecode.cpp:50
+
+static TAO::TypeCode::Alias<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_RTCORBA_Priority (
+ CORBA::tk_alias,
+ "IDL:omg.org/RTCORBA/Priority:1.0",
+ "Priority",
+ &CORBA::_tc_short);
+
+namespace RTCORBA
+{
+ ::CORBA::TypeCode_ptr const _tc_Priority =
+ &_tao_tc_RTCORBA_Priority;
+}
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/alias_typecode.cpp:50
+
+static TAO::TypeCode::Alias<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_RTCORBA_NetworkPriority (
+ CORBA::tk_alias,
+ "IDL:omg.org/RTCORBA/NetworkPriority:1.0",
+ "NetworkPriority",
+ &CORBA::_tc_long);
+
+namespace RTCORBA
+{
+ ::CORBA::TypeCode_ptr const _tc_NetworkPriority =
+ &_tao_tc_RTCORBA_NetworkPriority;
+}
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/alias_typecode.cpp:50
+
+static TAO::TypeCode::Alias<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_RTCORBA_ThreadpoolId (
+ CORBA::tk_alias,
+ "IDL:omg.org/RTCORBA/ThreadpoolId:1.0",
+ "ThreadpoolId",
+ &CORBA::_tc_ulong);
+
+namespace RTCORBA
+{
+ ::CORBA::TypeCode_ptr const _tc_ThreadpoolId =
+ &_tao_tc_RTCORBA_ThreadpoolId;
+}
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/struct_typecode.cpp:87
+
+static TAO::TypeCode::Struct_Field<char const *, CORBA::TypeCode_ptr const *> const _tao_fields_RTCORBA_ThreadpoolLane[] =
+ {
+ { "lane_priority", &RTCORBA::_tc_Priority },
+ { "static_threads", &CORBA::_tc_ulong },
+ { "dynamic_threads", &CORBA::_tc_ulong }
+
+ };
+static TAO::TypeCode::Struct<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::TypeCode::Struct_Field<char const *, CORBA::TypeCode_ptr const *> const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_RTCORBA_ThreadpoolLane (
+ CORBA::tk_struct,
+ "IDL:omg.org/RTCORBA/ThreadpoolLane:1.0",
+ "ThreadpoolLane",
+ _tao_fields_RTCORBA_ThreadpoolLane,
+ 3);
+
+namespace RTCORBA
+{
+ ::CORBA::TypeCode_ptr const _tc_ThreadpoolLane =
+ &_tao_tc_RTCORBA_ThreadpoolLane;
+}
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/alias_typecode.cpp:50
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/typecode_defn.cpp:937
+
+
+#ifndef _TAO_TYPECODE_RTCORBA_ThreadpoolLanes_GUARD
+#define _TAO_TYPECODE_RTCORBA_ThreadpoolLanes_GUARD
+namespace TAO
+{
+ namespace TypeCode
+ {
+ TAO::TypeCode::Sequence< ::CORBA::TypeCode_ptr const *,
+ TAO::Null_RefCount_Policy>
+ RTCORBA_ThreadpoolLanes_0 (
+ CORBA::tk_sequence,
+ &RTCORBA::_tc_ThreadpoolLane,
+ 0U);
+
+ ::CORBA::TypeCode_ptr const tc_RTCORBA_ThreadpoolLanes_0 =
+ &RTCORBA_ThreadpoolLanes_0;
+
+ }
+}
+
+
+#endif /* _TAO_TYPECODE_RTCORBA_ThreadpoolLanes_GUARD */
+
+static TAO::TypeCode::Alias<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_RTCORBA_ThreadpoolLanes (
+ CORBA::tk_alias,
+ "IDL:omg.org/RTCORBA/ThreadpoolLanes:1.0",
+ "ThreadpoolLanes",
+ &TAO::TypeCode::tc_RTCORBA_ThreadpoolLanes_0);
+
+namespace RTCORBA
+{
+ ::CORBA::TypeCode_ptr const _tc_ThreadpoolLanes =
+ &_tao_tc_RTCORBA_ThreadpoolLanes;
+}
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/enum_typecode.cpp:34
+
+static char const * const _tao_enumerators_RTCORBA_PriorityModel[] =
+ {
+ "CLIENT_PROPAGATED",
+ "SERVER_DECLARED"
+
+ };
+
+static TAO::TypeCode::Enum<char const *,
+ char const * const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_RTCORBA_PriorityModel (
+ "IDL:omg.org/RTCORBA/PriorityModel:1.0",
+ "PriorityModel",
+ _tao_enumerators_RTCORBA_PriorityModel,
+ 2);
+
+namespace RTCORBA
+{
+ ::CORBA::TypeCode_ptr const _tc_PriorityModel =
+ &_tao_tc_RTCORBA_PriorityModel;
+}
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/objref_typecode.cpp:76
+
+static TAO::TypeCode::Objref<char const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_RTCORBA_PriorityModelPolicy (
+ CORBA::tk_local_interface,
+ "IDL:omg.org/RTCORBA/PriorityModelPolicy:1.0",
+ "PriorityModelPolicy");
+
+namespace RTCORBA
+{
+ ::CORBA::TypeCode_ptr const _tc_PriorityModelPolicy =
+ &_tao_tc_RTCORBA_PriorityModelPolicy;
+}
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/objref_typecode.cpp:76
+
+static TAO::TypeCode::Objref<char const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_RTCORBA_ThreadpoolPolicy (
+ CORBA::tk_local_interface,
+ "IDL:omg.org/RTCORBA/ThreadpoolPolicy:1.0",
+ "ThreadpoolPolicy");
+
+namespace RTCORBA
+{
+ ::CORBA::TypeCode_ptr const _tc_ThreadpoolPolicy =
+ &_tao_tc_RTCORBA_ThreadpoolPolicy;
+}
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/objref_typecode.cpp:76
+
+static TAO::TypeCode::Objref<char const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_RTCORBA_ProtocolProperties (
+ CORBA::tk_local_interface,
+ "IDL:omg.org/RTCORBA/ProtocolProperties:1.0",
+ "ProtocolProperties");
+
+namespace RTCORBA
+{
+ ::CORBA::TypeCode_ptr const _tc_ProtocolProperties =
+ &_tao_tc_RTCORBA_ProtocolProperties;
+}
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/struct_typecode.cpp:87
+
+static TAO::TypeCode::Struct_Field<char const *, CORBA::TypeCode_ptr const *> const _tao_fields_RTCORBA_Protocol[] =
+ {
+ { "protocol_type", &IOP::_tc_ProfileId },
+ { "orb_protocol_properties", &RTCORBA::_tc_ProtocolProperties },
+ { "transport_protocol_properties", &RTCORBA::_tc_ProtocolProperties }
+
+ };
+static TAO::TypeCode::Struct<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::TypeCode::Struct_Field<char const *, CORBA::TypeCode_ptr const *> const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_RTCORBA_Protocol (
+ CORBA::tk_struct,
+ "IDL:omg.org/RTCORBA/Protocol:1.0",
+ "Protocol",
+ _tao_fields_RTCORBA_Protocol,
+ 3);
+
+namespace RTCORBA
+{
+ ::CORBA::TypeCode_ptr const _tc_Protocol =
+ &_tao_tc_RTCORBA_Protocol;
+}
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/alias_typecode.cpp:50
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/typecode_defn.cpp:937
+
+
+#ifndef _TAO_TYPECODE_RTCORBA_ProtocolList_GUARD
+#define _TAO_TYPECODE_RTCORBA_ProtocolList_GUARD
+namespace TAO
+{
+ namespace TypeCode
+ {
+ TAO::TypeCode::Sequence< ::CORBA::TypeCode_ptr const *,
+ TAO::Null_RefCount_Policy>
+ RTCORBA_ProtocolList_0 (
+ CORBA::tk_sequence,
+ &RTCORBA::_tc_Protocol,
+ 0U);
+
+ ::CORBA::TypeCode_ptr const tc_RTCORBA_ProtocolList_0 =
+ &RTCORBA_ProtocolList_0;
+
+ }
+}
+
+
+#endif /* _TAO_TYPECODE_RTCORBA_ProtocolList_GUARD */
+
+static TAO::TypeCode::Alias<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_RTCORBA_ProtocolList (
+ CORBA::tk_alias,
+ "IDL:omg.org/RTCORBA/ProtocolList:1.0",
+ "ProtocolList",
+ &TAO::TypeCode::tc_RTCORBA_ProtocolList_0);
+
+namespace RTCORBA
+{
+ ::CORBA::TypeCode_ptr const _tc_ProtocolList =
+ &_tao_tc_RTCORBA_ProtocolList;
+}
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/objref_typecode.cpp:76
+
+static TAO::TypeCode::Objref<char const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_RTCORBA_ServerProtocolPolicy (
+ CORBA::tk_local_interface,
+ "IDL:omg.org/RTCORBA/ServerProtocolPolicy:1.0",
+ "ServerProtocolPolicy");
+
+namespace RTCORBA
+{
+ ::CORBA::TypeCode_ptr const _tc_ServerProtocolPolicy =
+ &_tao_tc_RTCORBA_ServerProtocolPolicy;
+}
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/objref_typecode.cpp:76
+
+static TAO::TypeCode::Objref<char const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_RTCORBA_ClientProtocolPolicy (
+ CORBA::tk_local_interface,
+ "IDL:omg.org/RTCORBA/ClientProtocolPolicy:1.0",
+ "ClientProtocolPolicy");
+
+namespace RTCORBA
+{
+ ::CORBA::TypeCode_ptr const _tc_ClientProtocolPolicy =
+ &_tao_tc_RTCORBA_ClientProtocolPolicy;
+}
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/objref_typecode.cpp:76
+
+static TAO::TypeCode::Objref<char const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_RTCORBA_PrivateConnectionPolicy (
+ CORBA::tk_local_interface,
+ "IDL:omg.org/RTCORBA/PrivateConnectionPolicy:1.0",
+ "PrivateConnectionPolicy");
+
+namespace RTCORBA
+{
+ ::CORBA::TypeCode_ptr const _tc_PrivateConnectionPolicy =
+ &_tao_tc_RTCORBA_PrivateConnectionPolicy;
+}
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/objref_typecode.cpp:76
+
+static TAO::TypeCode::Objref<char const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_RTCORBA_TCPProtocolProperties (
+ CORBA::tk_local_interface,
+ "IDL:omg.org/RTCORBA/TCPProtocolProperties:1.0",
+ "TCPProtocolProperties");
+
+namespace RTCORBA
+{
+ ::CORBA::TypeCode_ptr const _tc_TCPProtocolProperties =
+ &_tao_tc_RTCORBA_TCPProtocolProperties;
+}
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/objref_typecode.cpp:76
+
+static TAO::TypeCode::Objref<char const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_RTCORBA_GIOPProtocolProperties (
+ CORBA::tk_local_interface,
+ "IDL:omg.org/RTCORBA/GIOPProtocolProperties:1.0",
+ "GIOPProtocolProperties");
+
+namespace RTCORBA
+{
+ ::CORBA::TypeCode_ptr const _tc_GIOPProtocolProperties =
+ &_tao_tc_RTCORBA_GIOPProtocolProperties;
+}
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/objref_typecode.cpp:76
+
+static TAO::TypeCode::Objref<char const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_RTCORBA_UnixDomainProtocolProperties (
+ CORBA::tk_local_interface,
+ "IDL:omg.org/RTCORBA/UnixDomainProtocolProperties:1.0",
+ "UnixDomainProtocolProperties");
+
+namespace RTCORBA
+{
+ ::CORBA::TypeCode_ptr const _tc_UnixDomainProtocolProperties =
+ &_tao_tc_RTCORBA_UnixDomainProtocolProperties;
+}
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/objref_typecode.cpp:76
+
+static TAO::TypeCode::Objref<char const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_RTCORBA_SharedMemoryProtocolProperties (
+ CORBA::tk_local_interface,
+ "IDL:omg.org/RTCORBA/SharedMemoryProtocolProperties:1.0",
+ "SharedMemoryProtocolProperties");
+
+namespace RTCORBA
+{
+ ::CORBA::TypeCode_ptr const _tc_SharedMemoryProtocolProperties =
+ &_tao_tc_RTCORBA_SharedMemoryProtocolProperties;
+}
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/objref_typecode.cpp:76
+
+static TAO::TypeCode::Objref<char const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_RTCORBA_UserDatagramProtocolProperties (
+ CORBA::tk_local_interface,
+ "IDL:omg.org/RTCORBA/UserDatagramProtocolProperties:1.0",
+ "UserDatagramProtocolProperties");
+
+namespace RTCORBA
+{
+ ::CORBA::TypeCode_ptr const _tc_UserDatagramProtocolProperties =
+ &_tao_tc_RTCORBA_UserDatagramProtocolProperties;
+}
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/objref_typecode.cpp:76
+
+static TAO::TypeCode::Objref<char const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_RTCORBA_StreamControlProtocolProperties (
+ CORBA::tk_local_interface,
+ "IDL:omg.org/RTCORBA/StreamControlProtocolProperties:1.0",
+ "StreamControlProtocolProperties");
+
+namespace RTCORBA
+{
+ ::CORBA::TypeCode_ptr const _tc_StreamControlProtocolProperties =
+ &_tao_tc_RTCORBA_StreamControlProtocolProperties;
+}
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/struct_typecode.cpp:87
+
+static TAO::TypeCode::Struct_Field<char const *, CORBA::TypeCode_ptr const *> const _tao_fields_RTCORBA_PriorityBand[] =
+ {
+ { "low", &RTCORBA::_tc_Priority },
+ { "high", &RTCORBA::_tc_Priority }
+
+ };
+static TAO::TypeCode::Struct<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::TypeCode::Struct_Field<char const *, CORBA::TypeCode_ptr const *> const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_RTCORBA_PriorityBand (
+ CORBA::tk_struct,
+ "IDL:omg.org/RTCORBA/PriorityBand:1.0",
+ "PriorityBand",
+ _tao_fields_RTCORBA_PriorityBand,
+ 2);
+
+namespace RTCORBA
+{
+ ::CORBA::TypeCode_ptr const _tc_PriorityBand =
+ &_tao_tc_RTCORBA_PriorityBand;
+}
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/alias_typecode.cpp:50
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/typecode_defn.cpp:937
+
+
+#ifndef _TAO_TYPECODE_RTCORBA_PriorityBands_GUARD
+#define _TAO_TYPECODE_RTCORBA_PriorityBands_GUARD
+namespace TAO
+{
+ namespace TypeCode
+ {
+ TAO::TypeCode::Sequence< ::CORBA::TypeCode_ptr const *,
+ TAO::Null_RefCount_Policy>
+ RTCORBA_PriorityBands_0 (
+ CORBA::tk_sequence,
+ &RTCORBA::_tc_PriorityBand,
+ 0U);
+
+ ::CORBA::TypeCode_ptr const tc_RTCORBA_PriorityBands_0 =
+ &RTCORBA_PriorityBands_0;
+
+ }
+}
+
+
+#endif /* _TAO_TYPECODE_RTCORBA_PriorityBands_GUARD */
+
+static TAO::TypeCode::Alias<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_RTCORBA_PriorityBands (
+ CORBA::tk_alias,
+ "IDL:omg.org/RTCORBA/PriorityBands:1.0",
+ "PriorityBands",
+ &TAO::TypeCode::tc_RTCORBA_PriorityBands_0);
+
+namespace RTCORBA
+{
+ ::CORBA::TypeCode_ptr const _tc_PriorityBands =
+ &_tao_tc_RTCORBA_PriorityBands;
+}
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/objref_typecode.cpp:76
+
+static TAO::TypeCode::Objref<char const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_RTCORBA_PriorityBandedConnectionPolicy (
+ CORBA::tk_local_interface,
+ "IDL:omg.org/RTCORBA/PriorityBandedConnectionPolicy:1.0",
+ "PriorityBandedConnectionPolicy");
+
+namespace RTCORBA
+{
+ ::CORBA::TypeCode_ptr const _tc_PriorityBandedConnectionPolicy =
+ &_tao_tc_RTCORBA_PriorityBandedConnectionPolicy;
+}
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/objref_typecode.cpp:76
+
+static TAO::TypeCode::Objref<char const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_RTCORBA_Current (
+ CORBA::tk_local_interface,
+ "IDL:omg.org/RTCORBA/Current:1.0",
+ "Current");
+
+namespace RTCORBA
+{
+ ::CORBA::TypeCode_ptr const _tc_Current =
+ &_tao_tc_RTCORBA_Current;
+}
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/objref_typecode.cpp:76
+
+static TAO::TypeCode::Objref<char const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_RTCORBA_Mutex (
+ CORBA::tk_local_interface,
+ "IDL:omg.org/RTCORBA/Mutex:1.0",
+ "Mutex");
+
+namespace RTCORBA
+{
+ ::CORBA::TypeCode_ptr const _tc_Mutex =
+ &_tao_tc_RTCORBA_Mutex;
+}
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/struct_typecode.cpp:87
+
+static TAO::TypeCode::Struct_Field<char const *, CORBA::TypeCode_ptr const *> const * const _tao_fields_RTCORBA_RTORB_MutexNotFound = 0;
+static TAO::TypeCode::Struct<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::TypeCode::Struct_Field<char const *, CORBA::TypeCode_ptr const *> const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_RTCORBA_RTORB_MutexNotFound (
+ CORBA::tk_except,
+ "IDL:omg.org/RTCORBA/RTORB/MutexNotFound:1.0",
+ "MutexNotFound",
+ _tao_fields_RTCORBA_RTORB_MutexNotFound,
+ 0);
+
+::CORBA::TypeCode_ptr const RTCORBA::RTORB::_tc_MutexNotFound =
+ &_tao_tc_RTCORBA_RTORB_MutexNotFound;
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/struct_typecode.cpp:87
+
+static TAO::TypeCode::Struct_Field<char const *, CORBA::TypeCode_ptr const *> const * const _tao_fields_RTCORBA_RTORB_InvalidThreadpool = 0;
+static TAO::TypeCode::Struct<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::TypeCode::Struct_Field<char const *, CORBA::TypeCode_ptr const *> const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_RTCORBA_RTORB_InvalidThreadpool (
+ CORBA::tk_except,
+ "IDL:omg.org/RTCORBA/RTORB/InvalidThreadpool:1.0",
+ "InvalidThreadpool",
+ _tao_fields_RTCORBA_RTORB_InvalidThreadpool,
+ 0);
+
+::CORBA::TypeCode_ptr const RTCORBA::RTORB::_tc_InvalidThreadpool =
+ &_tao_tc_RTCORBA_RTORB_InvalidThreadpool;
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/objref_typecode.cpp:76
+
+static TAO::TypeCode::Objref<char const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_RTCORBA_RTORB (
+ CORBA::tk_local_interface,
+ "IDL:omg.org/RTCORBA/RTORB:1.0",
+ "RTORB");
+
+namespace RTCORBA
+{
+ ::CORBA::TypeCode_ptr const _tc_RTORB =
+ &_tao_tc_RTCORBA_RTORB;
+}
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_structure/any_op_cs.cpp:54
+
+// Copying insertion.
+void operator<<= (
+ CORBA::Any &_tao_any,
+ const RTCORBA::ThreadpoolLane &_tao_elem
+ )
+{
+ TAO::Any_Dual_Impl_T<RTCORBA::ThreadpoolLane>::insert_copy (
+ _tao_any,
+ RTCORBA::ThreadpoolLane::_tao_any_destructor,
+ RTCORBA::_tc_ThreadpoolLane,
+ _tao_elem
+ );
+}
+
+// Non-copying insertion.
+void operator<<= (
+ CORBA::Any &_tao_any,
+ RTCORBA::ThreadpoolLane *_tao_elem
+ )
+{
+ TAO::Any_Dual_Impl_T<RTCORBA::ThreadpoolLane>::insert (
+ _tao_any,
+ RTCORBA::ThreadpoolLane::_tao_any_destructor,
+ RTCORBA::_tc_ThreadpoolLane,
+ _tao_elem
+ );
+}
+
+// Extraction to non-const pointer (deprecated).
+CORBA::Boolean operator>>= (
+ const CORBA::Any &_tao_any,
+ RTCORBA::ThreadpoolLane *&_tao_elem
+ )
+{
+ return _tao_any >>= const_cast<
+ const RTCORBA::ThreadpoolLane *&> (
+ _tao_elem
+ );
+}
+
+// Extraction to const pointer.
+CORBA::Boolean operator>>= (
+ const CORBA::Any &_tao_any,
+ const RTCORBA::ThreadpoolLane *&_tao_elem
+ )
+{
+ return
+ TAO::Any_Dual_Impl_T<RTCORBA::ThreadpoolLane>::extract (
+ _tao_any,
+ RTCORBA::ThreadpoolLane::_tao_any_destructor,
+ RTCORBA::_tc_ThreadpoolLane,
+ _tao_elem
+ );
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_sequence/any_op_cs.cpp:54
+
+
+// Copying insertion.
+void operator<<= (
+ CORBA::Any &_tao_any,
+ const RTCORBA::ThreadpoolLanes &_tao_elem
+ )
+{
+ TAO::Any_Dual_Impl_T<RTCORBA::ThreadpoolLanes>::insert_copy (
+ _tao_any,
+ RTCORBA::ThreadpoolLanes::_tao_any_destructor,
+ TAO::TypeCode::tc_RTCORBA_ThreadpoolLanes_0,
+ _tao_elem
+ );
+}
+
+// Non-copying insertion.
+void operator<<= (
+ CORBA::Any &_tao_any,
+ RTCORBA::ThreadpoolLanes *_tao_elem
+ )
+{
+ TAO::Any_Dual_Impl_T<RTCORBA::ThreadpoolLanes>::insert (
+ _tao_any,
+ RTCORBA::ThreadpoolLanes::_tao_any_destructor,
+ TAO::TypeCode::tc_RTCORBA_ThreadpoolLanes_0,
+ _tao_elem
+ );
+}
+
+// Extraction to non-const pointer (deprecated).
+CORBA::Boolean operator>>= (
+ const CORBA::Any &_tao_any,
+ RTCORBA::ThreadpoolLanes *&_tao_elem
+ )
+{
+ return _tao_any >>= const_cast<
+ const RTCORBA::ThreadpoolLanes *&> (
+ _tao_elem
+ );
+}
+
+// Extraction to const pointer.
+CORBA::Boolean operator>>= (
+ const CORBA::Any &_tao_any,
+ const RTCORBA::ThreadpoolLanes *&_tao_elem
+ )
+{
+ return
+ TAO::Any_Dual_Impl_T<RTCORBA::ThreadpoolLanes>::extract (
+ _tao_any,
+ RTCORBA::ThreadpoolLanes::_tao_any_destructor,
+ TAO::TypeCode::tc_RTCORBA_ThreadpoolLanes_0,
+ _tao_elem
+ );
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_enum/any_op_cs.cpp:52
+
+void operator<<= (
+ CORBA::Any &_tao_any,
+ RTCORBA::PriorityModel _tao_elem
+ )
+{
+ TAO::Any_Basic_Impl_T<RTCORBA::PriorityModel>::insert (
+ _tao_any,
+ RTCORBA::_tc_PriorityModel,
+ _tao_elem
+ );
+}
+
+CORBA::Boolean operator>>= (
+ const CORBA::Any &_tao_any,
+ RTCORBA::PriorityModel &_tao_elem
+ )
+{
+ return
+ TAO::Any_Basic_Impl_T<RTCORBA::PriorityModel>::extract (
+ _tao_any,
+ RTCORBA::_tc_PriorityModel,
+ _tao_elem
+ );
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/any_op_cs.cpp:50
+
+namespace TAO
+{
+ template<>
+ CORBA::Boolean
+ Any_Impl_T<RTCORBA::PriorityModelPolicy>::to_object (
+ CORBA::Object_ptr &_tao_elem
+ ) const
+ {
+ _tao_elem = CORBA::Object::_duplicate (this->value_);
+ return true;
+ }
+}
+
+namespace TAO
+{
+ template<>
+ CORBA::Boolean
+ Any_Impl_T<RTCORBA::PriorityModelPolicy>::marshal_value (TAO_OutputCDR &)
+ {
+ return false;
+ }
+
+ template<>
+ CORBA::Boolean
+ Any_Impl_T<RTCORBA::PriorityModelPolicy>::demarshal_value (TAO_InputCDR &)
+ {
+ return false;
+ }
+}
+
+// Copying insertion.
+void
+operator<<= (
+ CORBA::Any &_tao_any,
+ RTCORBA::PriorityModelPolicy_ptr _tao_elem
+ )
+{
+ RTCORBA::PriorityModelPolicy_ptr _tao_objptr =
+ RTCORBA::PriorityModelPolicy::_duplicate (_tao_elem);
+ _tao_any <<= &_tao_objptr;
+}
+
+// Non-copying insertion.
+void
+operator<<= (
+ CORBA::Any &_tao_any,
+ RTCORBA::PriorityModelPolicy_ptr *_tao_elem
+ )
+{
+ TAO::Any_Impl_T<RTCORBA::PriorityModelPolicy>::insert (
+ _tao_any,
+ RTCORBA::PriorityModelPolicy::_tao_any_destructor,
+ RTCORBA::_tc_PriorityModelPolicy,
+ *_tao_elem
+ );
+}
+
+CORBA::Boolean
+operator>>= (
+ const CORBA::Any &_tao_any,
+ RTCORBA::PriorityModelPolicy_ptr &_tao_elem
+ )
+{
+ return
+ TAO::Any_Impl_T<RTCORBA::PriorityModelPolicy>::extract (
+ _tao_any,
+ RTCORBA::PriorityModelPolicy::_tao_any_destructor,
+ RTCORBA::_tc_PriorityModelPolicy,
+ _tao_elem
+ );
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/any_op_cs.cpp:50
+
+namespace TAO
+{
+ template<>
+ CORBA::Boolean
+ Any_Impl_T<RTCORBA::ThreadpoolPolicy>::to_object (
+ CORBA::Object_ptr &_tao_elem
+ ) const
+ {
+ _tao_elem = CORBA::Object::_duplicate (this->value_);
+ return true;
+ }
+}
+
+namespace TAO
+{
+ template<>
+ CORBA::Boolean
+ Any_Impl_T<RTCORBA::ThreadpoolPolicy>::marshal_value (TAO_OutputCDR &)
+ {
+ return false;
+ }
+
+ template<>
+ CORBA::Boolean
+ Any_Impl_T<RTCORBA::ThreadpoolPolicy>::demarshal_value (TAO_InputCDR &)
+ {
+ return false;
+ }
+}
+
+// Copying insertion.
+void
+operator<<= (
+ CORBA::Any &_tao_any,
+ RTCORBA::ThreadpoolPolicy_ptr _tao_elem
+ )
+{
+ RTCORBA::ThreadpoolPolicy_ptr _tao_objptr =
+ RTCORBA::ThreadpoolPolicy::_duplicate (_tao_elem);
+ _tao_any <<= &_tao_objptr;
+}
+
+// Non-copying insertion.
+void
+operator<<= (
+ CORBA::Any &_tao_any,
+ RTCORBA::ThreadpoolPolicy_ptr *_tao_elem
+ )
+{
+ TAO::Any_Impl_T<RTCORBA::ThreadpoolPolicy>::insert (
+ _tao_any,
+ RTCORBA::ThreadpoolPolicy::_tao_any_destructor,
+ RTCORBA::_tc_ThreadpoolPolicy,
+ *_tao_elem
+ );
+}
+
+CORBA::Boolean
+operator>>= (
+ const CORBA::Any &_tao_any,
+ RTCORBA::ThreadpoolPolicy_ptr &_tao_elem
+ )
+{
+ return
+ TAO::Any_Impl_T<RTCORBA::ThreadpoolPolicy>::extract (
+ _tao_any,
+ RTCORBA::ThreadpoolPolicy::_tao_any_destructor,
+ RTCORBA::_tc_ThreadpoolPolicy,
+ _tao_elem
+ );
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/any_op_cs.cpp:50
+
+namespace TAO
+{
+ template<>
+ CORBA::Boolean
+ Any_Impl_T<RTCORBA::ProtocolProperties>::to_object (
+ CORBA::Object_ptr &_tao_elem
+ ) const
+ {
+ _tao_elem = CORBA::Object::_duplicate (this->value_);
+ return true;
+ }
+}
+
+namespace TAO
+{
+ template<>
+ CORBA::Boolean
+ Any_Impl_T<RTCORBA::ProtocolProperties>::marshal_value (TAO_OutputCDR &)
+ {
+ return false;
+ }
+
+ template<>
+ CORBA::Boolean
+ Any_Impl_T<RTCORBA::ProtocolProperties>::demarshal_value (TAO_InputCDR &)
+ {
+ return false;
+ }
+}
+
+// Copying insertion.
+void
+operator<<= (
+ CORBA::Any &_tao_any,
+ RTCORBA::ProtocolProperties_ptr _tao_elem
+ )
+{
+ RTCORBA::ProtocolProperties_ptr _tao_objptr =
+ RTCORBA::ProtocolProperties::_duplicate (_tao_elem);
+ _tao_any <<= &_tao_objptr;
+}
+
+// Non-copying insertion.
+void
+operator<<= (
+ CORBA::Any &_tao_any,
+ RTCORBA::ProtocolProperties_ptr *_tao_elem
+ )
+{
+ TAO::Any_Impl_T<RTCORBA::ProtocolProperties>::insert (
+ _tao_any,
+ RTCORBA::ProtocolProperties::_tao_any_destructor,
+ RTCORBA::_tc_ProtocolProperties,
+ *_tao_elem
+ );
+}
+
+CORBA::Boolean
+operator>>= (
+ const CORBA::Any &_tao_any,
+ RTCORBA::ProtocolProperties_ptr &_tao_elem
+ )
+{
+ return
+ TAO::Any_Impl_T<RTCORBA::ProtocolProperties>::extract (
+ _tao_any,
+ RTCORBA::ProtocolProperties::_tao_any_destructor,
+ RTCORBA::_tc_ProtocolProperties,
+ _tao_elem
+ );
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_structure/any_op_cs.cpp:54
+
+
+
+namespace TAO
+{
+ template<>
+ CORBA::Boolean
+ Any_Dual_Impl_T<RTCORBA::Protocol>::marshal_value (TAO_OutputCDR &)
+ {
+ return false;
+ }
+
+ template<>
+ CORBA::Boolean
+ Any_Dual_Impl_T<RTCORBA::Protocol>::demarshal_value (TAO_InputCDR &)
+ {
+ return false;
+ }
+}// Copying insertion.
+void operator<<= (
+ CORBA::Any &_tao_any,
+ const RTCORBA::Protocol &_tao_elem
+ )
+{
+ TAO::Any_Dual_Impl_T<RTCORBA::Protocol>::insert_copy (
+ _tao_any,
+ RTCORBA::Protocol::_tao_any_destructor,
+ RTCORBA::_tc_Protocol,
+ _tao_elem
+ );
+}
+
+// Non-copying insertion.
+void operator<<= (
+ CORBA::Any &_tao_any,
+ RTCORBA::Protocol *_tao_elem
+ )
+{
+ TAO::Any_Dual_Impl_T<RTCORBA::Protocol>::insert (
+ _tao_any,
+ RTCORBA::Protocol::_tao_any_destructor,
+ RTCORBA::_tc_Protocol,
+ _tao_elem
+ );
+}
+
+// Extraction to non-const pointer (deprecated).
+CORBA::Boolean operator>>= (
+ const CORBA::Any &_tao_any,
+ RTCORBA::Protocol *&_tao_elem
+ )
+{
+ return _tao_any >>= const_cast<
+ const RTCORBA::Protocol *&> (
+ _tao_elem
+ );
+}
+
+// Extraction to const pointer.
+CORBA::Boolean operator>>= (
+ const CORBA::Any &_tao_any,
+ const RTCORBA::Protocol *&_tao_elem
+ )
+{
+ return
+ TAO::Any_Dual_Impl_T<RTCORBA::Protocol>::extract (
+ _tao_any,
+ RTCORBA::Protocol::_tao_any_destructor,
+ RTCORBA::_tc_Protocol,
+ _tao_elem
+ );
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_sequence/any_op_cs.cpp:54
+
+namespace TAO
+{
+ template<>
+ CORBA::Boolean
+ Any_Dual_Impl_T<RTCORBA::ProtocolList>::marshal_value (TAO_OutputCDR &)
+ {
+ return false;
+ }
+
+ template<>
+ CORBA::Boolean
+ Any_Dual_Impl_T<RTCORBA::ProtocolList>::demarshal_value (TAO_InputCDR &)
+ {
+ return false;
+ }
+}
+
+// Copying insertion.
+void operator<<= (
+ CORBA::Any &_tao_any,
+ const RTCORBA::ProtocolList &_tao_elem
+ )
+{
+ TAO::Any_Dual_Impl_T<RTCORBA::ProtocolList>::insert_copy (
+ _tao_any,
+ RTCORBA::ProtocolList::_tao_any_destructor,
+ TAO::TypeCode::tc_RTCORBA_ProtocolList_0,
+ _tao_elem
+ );
+}
+
+// Non-copying insertion.
+void operator<<= (
+ CORBA::Any &_tao_any,
+ RTCORBA::ProtocolList *_tao_elem
+ )
+{
+ TAO::Any_Dual_Impl_T<RTCORBA::ProtocolList>::insert (
+ _tao_any,
+ RTCORBA::ProtocolList::_tao_any_destructor,
+ TAO::TypeCode::tc_RTCORBA_ProtocolList_0,
+ _tao_elem
+ );
+}
+
+// Extraction to non-const pointer (deprecated).
+CORBA::Boolean operator>>= (
+ const CORBA::Any &_tao_any,
+ RTCORBA::ProtocolList *&_tao_elem
+ )
+{
+ return _tao_any >>= const_cast<
+ const RTCORBA::ProtocolList *&> (
+ _tao_elem
+ );
+}
+
+// Extraction to const pointer.
+CORBA::Boolean operator>>= (
+ const CORBA::Any &_tao_any,
+ const RTCORBA::ProtocolList *&_tao_elem
+ )
+{
+ return
+ TAO::Any_Dual_Impl_T<RTCORBA::ProtocolList>::extract (
+ _tao_any,
+ RTCORBA::ProtocolList::_tao_any_destructor,
+ TAO::TypeCode::tc_RTCORBA_ProtocolList_0,
+ _tao_elem
+ );
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/any_op_cs.cpp:50
+
+namespace TAO
+{
+ template<>
+ CORBA::Boolean
+ Any_Impl_T<RTCORBA::ServerProtocolPolicy>::to_object (
+ CORBA::Object_ptr &_tao_elem
+ ) const
+ {
+ _tao_elem = CORBA::Object::_duplicate (this->value_);
+ return true;
+ }
+}
+
+namespace TAO
+{
+ template<>
+ CORBA::Boolean
+ Any_Impl_T<RTCORBA::ServerProtocolPolicy>::marshal_value (TAO_OutputCDR &)
+ {
+ return false;
+ }
+
+ template<>
+ CORBA::Boolean
+ Any_Impl_T<RTCORBA::ServerProtocolPolicy>::demarshal_value (TAO_InputCDR &)
+ {
+ return false;
+ }
+}
+
+// Copying insertion.
+void
+operator<<= (
+ CORBA::Any &_tao_any,
+ RTCORBA::ServerProtocolPolicy_ptr _tao_elem
+ )
+{
+ RTCORBA::ServerProtocolPolicy_ptr _tao_objptr =
+ RTCORBA::ServerProtocolPolicy::_duplicate (_tao_elem);
+ _tao_any <<= &_tao_objptr;
+}
+
+// Non-copying insertion.
+void
+operator<<= (
+ CORBA::Any &_tao_any,
+ RTCORBA::ServerProtocolPolicy_ptr *_tao_elem
+ )
+{
+ TAO::Any_Impl_T<RTCORBA::ServerProtocolPolicy>::insert (
+ _tao_any,
+ RTCORBA::ServerProtocolPolicy::_tao_any_destructor,
+ RTCORBA::_tc_ServerProtocolPolicy,
+ *_tao_elem
+ );
+}
+
+CORBA::Boolean
+operator>>= (
+ const CORBA::Any &_tao_any,
+ RTCORBA::ServerProtocolPolicy_ptr &_tao_elem
+ )
+{
+ return
+ TAO::Any_Impl_T<RTCORBA::ServerProtocolPolicy>::extract (
+ _tao_any,
+ RTCORBA::ServerProtocolPolicy::_tao_any_destructor,
+ RTCORBA::_tc_ServerProtocolPolicy,
+ _tao_elem
+ );
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/any_op_cs.cpp:50
+
+namespace TAO
+{
+ template<>
+ CORBA::Boolean
+ Any_Impl_T<RTCORBA::ClientProtocolPolicy>::to_object (
+ CORBA::Object_ptr &_tao_elem
+ ) const
+ {
+ _tao_elem = CORBA::Object::_duplicate (this->value_);
+ return true;
+ }
+}
+
+namespace TAO
+{
+ template<>
+ CORBA::Boolean
+ Any_Impl_T<RTCORBA::ClientProtocolPolicy>::marshal_value (TAO_OutputCDR &)
+ {
+ return false;
+ }
+
+ template<>
+ CORBA::Boolean
+ Any_Impl_T<RTCORBA::ClientProtocolPolicy>::demarshal_value (TAO_InputCDR &)
+ {
+ return false;
+ }
+}
+
+// Copying insertion.
+void
+operator<<= (
+ CORBA::Any &_tao_any,
+ RTCORBA::ClientProtocolPolicy_ptr _tao_elem
+ )
+{
+ RTCORBA::ClientProtocolPolicy_ptr _tao_objptr =
+ RTCORBA::ClientProtocolPolicy::_duplicate (_tao_elem);
+ _tao_any <<= &_tao_objptr;
+}
+
+// Non-copying insertion.
+void
+operator<<= (
+ CORBA::Any &_tao_any,
+ RTCORBA::ClientProtocolPolicy_ptr *_tao_elem
+ )
+{
+ TAO::Any_Impl_T<RTCORBA::ClientProtocolPolicy>::insert (
+ _tao_any,
+ RTCORBA::ClientProtocolPolicy::_tao_any_destructor,
+ RTCORBA::_tc_ClientProtocolPolicy,
+ *_tao_elem
+ );
+}
+
+CORBA::Boolean
+operator>>= (
+ const CORBA::Any &_tao_any,
+ RTCORBA::ClientProtocolPolicy_ptr &_tao_elem
+ )
+{
+ return
+ TAO::Any_Impl_T<RTCORBA::ClientProtocolPolicy>::extract (
+ _tao_any,
+ RTCORBA::ClientProtocolPolicy::_tao_any_destructor,
+ RTCORBA::_tc_ClientProtocolPolicy,
+ _tao_elem
+ );
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/any_op_cs.cpp:50
+
+namespace TAO
+{
+ template<>
+ CORBA::Boolean
+ Any_Impl_T<RTCORBA::PrivateConnectionPolicy>::to_object (
+ CORBA::Object_ptr &_tao_elem
+ ) const
+ {
+ _tao_elem = CORBA::Object::_duplicate (this->value_);
+ return true;
+ }
+}
+
+namespace TAO
+{
+ template<>
+ CORBA::Boolean
+ Any_Impl_T<RTCORBA::PrivateConnectionPolicy>::marshal_value (TAO_OutputCDR &)
+ {
+ return false;
+ }
+
+ template<>
+ CORBA::Boolean
+ Any_Impl_T<RTCORBA::PrivateConnectionPolicy>::demarshal_value (TAO_InputCDR &)
+ {
+ return false;
+ }
+}
+
+// Copying insertion.
+void
+operator<<= (
+ CORBA::Any &_tao_any,
+ RTCORBA::PrivateConnectionPolicy_ptr _tao_elem
+ )
+{
+ RTCORBA::PrivateConnectionPolicy_ptr _tao_objptr =
+ RTCORBA::PrivateConnectionPolicy::_duplicate (_tao_elem);
+ _tao_any <<= &_tao_objptr;
+}
+
+// Non-copying insertion.
+void
+operator<<= (
+ CORBA::Any &_tao_any,
+ RTCORBA::PrivateConnectionPolicy_ptr *_tao_elem
+ )
+{
+ TAO::Any_Impl_T<RTCORBA::PrivateConnectionPolicy>::insert (
+ _tao_any,
+ RTCORBA::PrivateConnectionPolicy::_tao_any_destructor,
+ RTCORBA::_tc_PrivateConnectionPolicy,
+ *_tao_elem
+ );
+}
+
+CORBA::Boolean
+operator>>= (
+ const CORBA::Any &_tao_any,
+ RTCORBA::PrivateConnectionPolicy_ptr &_tao_elem
+ )
+{
+ return
+ TAO::Any_Impl_T<RTCORBA::PrivateConnectionPolicy>::extract (
+ _tao_any,
+ RTCORBA::PrivateConnectionPolicy::_tao_any_destructor,
+ RTCORBA::_tc_PrivateConnectionPolicy,
+ _tao_elem
+ );
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/any_op_cs.cpp:50
+
+namespace TAO
+{
+ template<>
+ CORBA::Boolean
+ Any_Impl_T<RTCORBA::TCPProtocolProperties>::to_object (
+ CORBA::Object_ptr &_tao_elem
+ ) const
+ {
+ _tao_elem = CORBA::Object::_duplicate (this->value_);
+ return true;
+ }
+}
+
+namespace TAO
+{
+ template<>
+ CORBA::Boolean
+ Any_Impl_T<RTCORBA::TCPProtocolProperties>::marshal_value (TAO_OutputCDR &)
+ {
+ return false;
+ }
+
+ template<>
+ CORBA::Boolean
+ Any_Impl_T<RTCORBA::TCPProtocolProperties>::demarshal_value (TAO_InputCDR &)
+ {
+ return false;
+ }
+}
+
+// Copying insertion.
+void
+operator<<= (
+ CORBA::Any &_tao_any,
+ RTCORBA::TCPProtocolProperties_ptr _tao_elem
+ )
+{
+ RTCORBA::TCPProtocolProperties_ptr _tao_objptr =
+ RTCORBA::TCPProtocolProperties::_duplicate (_tao_elem);
+ _tao_any <<= &_tao_objptr;
+}
+
+// Non-copying insertion.
+void
+operator<<= (
+ CORBA::Any &_tao_any,
+ RTCORBA::TCPProtocolProperties_ptr *_tao_elem
+ )
+{
+ TAO::Any_Impl_T<RTCORBA::TCPProtocolProperties>::insert (
+ _tao_any,
+ RTCORBA::TCPProtocolProperties::_tao_any_destructor,
+ RTCORBA::_tc_TCPProtocolProperties,
+ *_tao_elem
+ );
+}
+
+CORBA::Boolean
+operator>>= (
+ const CORBA::Any &_tao_any,
+ RTCORBA::TCPProtocolProperties_ptr &_tao_elem
+ )
+{
+ return
+ TAO::Any_Impl_T<RTCORBA::TCPProtocolProperties>::extract (
+ _tao_any,
+ RTCORBA::TCPProtocolProperties::_tao_any_destructor,
+ RTCORBA::_tc_TCPProtocolProperties,
+ _tao_elem
+ );
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/any_op_cs.cpp:50
+
+namespace TAO
+{
+ template<>
+ CORBA::Boolean
+ Any_Impl_T<RTCORBA::GIOPProtocolProperties>::to_object (
+ CORBA::Object_ptr &_tao_elem
+ ) const
+ {
+ _tao_elem = CORBA::Object::_duplicate (this->value_);
+ return true;
+ }
+}
+
+namespace TAO
+{
+ template<>
+ CORBA::Boolean
+ Any_Impl_T<RTCORBA::GIOPProtocolProperties>::marshal_value (TAO_OutputCDR &)
+ {
+ return false;
+ }
+
+ template<>
+ CORBA::Boolean
+ Any_Impl_T<RTCORBA::GIOPProtocolProperties>::demarshal_value (TAO_InputCDR &)
+ {
+ return false;
+ }
+}
+
+// Copying insertion.
+void
+operator<<= (
+ CORBA::Any &_tao_any,
+ RTCORBA::GIOPProtocolProperties_ptr _tao_elem
+ )
+{
+ RTCORBA::GIOPProtocolProperties_ptr _tao_objptr =
+ RTCORBA::GIOPProtocolProperties::_duplicate (_tao_elem);
+ _tao_any <<= &_tao_objptr;
+}
+
+// Non-copying insertion.
+void
+operator<<= (
+ CORBA::Any &_tao_any,
+ RTCORBA::GIOPProtocolProperties_ptr *_tao_elem
+ )
+{
+ TAO::Any_Impl_T<RTCORBA::GIOPProtocolProperties>::insert (
+ _tao_any,
+ RTCORBA::GIOPProtocolProperties::_tao_any_destructor,
+ RTCORBA::_tc_GIOPProtocolProperties,
+ *_tao_elem
+ );
+}
+
+CORBA::Boolean
+operator>>= (
+ const CORBA::Any &_tao_any,
+ RTCORBA::GIOPProtocolProperties_ptr &_tao_elem
+ )
+{
+ return
+ TAO::Any_Impl_T<RTCORBA::GIOPProtocolProperties>::extract (
+ _tao_any,
+ RTCORBA::GIOPProtocolProperties::_tao_any_destructor,
+ RTCORBA::_tc_GIOPProtocolProperties,
+ _tao_elem
+ );
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/any_op_cs.cpp:50
+
+namespace TAO
+{
+ template<>
+ CORBA::Boolean
+ Any_Impl_T<RTCORBA::UnixDomainProtocolProperties>::to_object (
+ CORBA::Object_ptr &_tao_elem
+ ) const
+ {
+ _tao_elem = CORBA::Object::_duplicate (this->value_);
+ return true;
+ }
+}
+
+namespace TAO
+{
+ template<>
+ CORBA::Boolean
+ Any_Impl_T<RTCORBA::UnixDomainProtocolProperties>::marshal_value (TAO_OutputCDR &)
+ {
+ return false;
+ }
+
+ template<>
+ CORBA::Boolean
+ Any_Impl_T<RTCORBA::UnixDomainProtocolProperties>::demarshal_value (TAO_InputCDR &)
+ {
+ return false;
+ }
+}
+
+// Copying insertion.
+void
+operator<<= (
+ CORBA::Any &_tao_any,
+ RTCORBA::UnixDomainProtocolProperties_ptr _tao_elem
+ )
+{
+ RTCORBA::UnixDomainProtocolProperties_ptr _tao_objptr =
+ RTCORBA::UnixDomainProtocolProperties::_duplicate (_tao_elem);
+ _tao_any <<= &_tao_objptr;
+}
+
+// Non-copying insertion.
+void
+operator<<= (
+ CORBA::Any &_tao_any,
+ RTCORBA::UnixDomainProtocolProperties_ptr *_tao_elem
+ )
+{
+ TAO::Any_Impl_T<RTCORBA::UnixDomainProtocolProperties>::insert (
+ _tao_any,
+ RTCORBA::UnixDomainProtocolProperties::_tao_any_destructor,
+ RTCORBA::_tc_UnixDomainProtocolProperties,
+ *_tao_elem
+ );
+}
+
+CORBA::Boolean
+operator>>= (
+ const CORBA::Any &_tao_any,
+ RTCORBA::UnixDomainProtocolProperties_ptr &_tao_elem
+ )
+{
+ return
+ TAO::Any_Impl_T<RTCORBA::UnixDomainProtocolProperties>::extract (
+ _tao_any,
+ RTCORBA::UnixDomainProtocolProperties::_tao_any_destructor,
+ RTCORBA::_tc_UnixDomainProtocolProperties,
+ _tao_elem
+ );
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/any_op_cs.cpp:50
+
+namespace TAO
+{
+ template<>
+ CORBA::Boolean
+ Any_Impl_T<RTCORBA::SharedMemoryProtocolProperties>::to_object (
+ CORBA::Object_ptr &_tao_elem
+ ) const
+ {
+ _tao_elem = CORBA::Object::_duplicate (this->value_);
+ return true;
+ }
+}
+
+namespace TAO
+{
+ template<>
+ CORBA::Boolean
+ Any_Impl_T<RTCORBA::SharedMemoryProtocolProperties>::marshal_value (TAO_OutputCDR &)
+ {
+ return false;
+ }
+
+ template<>
+ CORBA::Boolean
+ Any_Impl_T<RTCORBA::SharedMemoryProtocolProperties>::demarshal_value (TAO_InputCDR &)
+ {
+ return false;
+ }
+}
+
+// Copying insertion.
+void
+operator<<= (
+ CORBA::Any &_tao_any,
+ RTCORBA::SharedMemoryProtocolProperties_ptr _tao_elem
+ )
+{
+ RTCORBA::SharedMemoryProtocolProperties_ptr _tao_objptr =
+ RTCORBA::SharedMemoryProtocolProperties::_duplicate (_tao_elem);
+ _tao_any <<= &_tao_objptr;
+}
+
+// Non-copying insertion.
+void
+operator<<= (
+ CORBA::Any &_tao_any,
+ RTCORBA::SharedMemoryProtocolProperties_ptr *_tao_elem
+ )
+{
+ TAO::Any_Impl_T<RTCORBA::SharedMemoryProtocolProperties>::insert (
+ _tao_any,
+ RTCORBA::SharedMemoryProtocolProperties::_tao_any_destructor,
+ RTCORBA::_tc_SharedMemoryProtocolProperties,
+ *_tao_elem
+ );
+}
+
+CORBA::Boolean
+operator>>= (
+ const CORBA::Any &_tao_any,
+ RTCORBA::SharedMemoryProtocolProperties_ptr &_tao_elem
+ )
+{
+ return
+ TAO::Any_Impl_T<RTCORBA::SharedMemoryProtocolProperties>::extract (
+ _tao_any,
+ RTCORBA::SharedMemoryProtocolProperties::_tao_any_destructor,
+ RTCORBA::_tc_SharedMemoryProtocolProperties,
+ _tao_elem
+ );
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/any_op_cs.cpp:50
+
+namespace TAO
+{
+ template<>
+ CORBA::Boolean
+ Any_Impl_T<RTCORBA::UserDatagramProtocolProperties>::to_object (
+ CORBA::Object_ptr &_tao_elem
+ ) const
+ {
+ _tao_elem = CORBA::Object::_duplicate (this->value_);
+ return true;
+ }
+}
+
+namespace TAO
+{
+ template<>
+ CORBA::Boolean
+ Any_Impl_T<RTCORBA::UserDatagramProtocolProperties>::marshal_value (TAO_OutputCDR &)
+ {
+ return false;
+ }
+
+ template<>
+ CORBA::Boolean
+ Any_Impl_T<RTCORBA::UserDatagramProtocolProperties>::demarshal_value (TAO_InputCDR &)
+ {
+ return false;
+ }
+}
+
+// Copying insertion.
+void
+operator<<= (
+ CORBA::Any &_tao_any,
+ RTCORBA::UserDatagramProtocolProperties_ptr _tao_elem
+ )
+{
+ RTCORBA::UserDatagramProtocolProperties_ptr _tao_objptr =
+ RTCORBA::UserDatagramProtocolProperties::_duplicate (_tao_elem);
+ _tao_any <<= &_tao_objptr;
+}
+
+// Non-copying insertion.
+void
+operator<<= (
+ CORBA::Any &_tao_any,
+ RTCORBA::UserDatagramProtocolProperties_ptr *_tao_elem
+ )
+{
+ TAO::Any_Impl_T<RTCORBA::UserDatagramProtocolProperties>::insert (
+ _tao_any,
+ RTCORBA::UserDatagramProtocolProperties::_tao_any_destructor,
+ RTCORBA::_tc_UserDatagramProtocolProperties,
+ *_tao_elem
+ );
+}
+
+CORBA::Boolean
+operator>>= (
+ const CORBA::Any &_tao_any,
+ RTCORBA::UserDatagramProtocolProperties_ptr &_tao_elem
+ )
+{
+ return
+ TAO::Any_Impl_T<RTCORBA::UserDatagramProtocolProperties>::extract (
+ _tao_any,
+ RTCORBA::UserDatagramProtocolProperties::_tao_any_destructor,
+ RTCORBA::_tc_UserDatagramProtocolProperties,
+ _tao_elem
+ );
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/any_op_cs.cpp:50
+
+namespace TAO
+{
+ template<>
+ CORBA::Boolean
+ Any_Impl_T<RTCORBA::StreamControlProtocolProperties>::to_object (
+ CORBA::Object_ptr &_tao_elem
+ ) const
+ {
+ _tao_elem = CORBA::Object::_duplicate (this->value_);
+ return true;
+ }
+}
+
+namespace TAO
+{
+ template<>
+ CORBA::Boolean
+ Any_Impl_T<RTCORBA::StreamControlProtocolProperties>::marshal_value (TAO_OutputCDR &)
+ {
+ return false;
+ }
+
+ template<>
+ CORBA::Boolean
+ Any_Impl_T<RTCORBA::StreamControlProtocolProperties>::demarshal_value (TAO_InputCDR &)
+ {
+ return false;
+ }
+}
+
+// Copying insertion.
+void
+operator<<= (
+ CORBA::Any &_tao_any,
+ RTCORBA::StreamControlProtocolProperties_ptr _tao_elem
+ )
+{
+ RTCORBA::StreamControlProtocolProperties_ptr _tao_objptr =
+ RTCORBA::StreamControlProtocolProperties::_duplicate (_tao_elem);
+ _tao_any <<= &_tao_objptr;
+}
+
+// Non-copying insertion.
+void
+operator<<= (
+ CORBA::Any &_tao_any,
+ RTCORBA::StreamControlProtocolProperties_ptr *_tao_elem
+ )
+{
+ TAO::Any_Impl_T<RTCORBA::StreamControlProtocolProperties>::insert (
+ _tao_any,
+ RTCORBA::StreamControlProtocolProperties::_tao_any_destructor,
+ RTCORBA::_tc_StreamControlProtocolProperties,
+ *_tao_elem
+ );
+}
+
+CORBA::Boolean
+operator>>= (
+ const CORBA::Any &_tao_any,
+ RTCORBA::StreamControlProtocolProperties_ptr &_tao_elem
+ )
+{
+ return
+ TAO::Any_Impl_T<RTCORBA::StreamControlProtocolProperties>::extract (
+ _tao_any,
+ RTCORBA::StreamControlProtocolProperties::_tao_any_destructor,
+ RTCORBA::_tc_StreamControlProtocolProperties,
+ _tao_elem
+ );
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_structure/any_op_cs.cpp:54
+
+// Copying insertion.
+void operator<<= (
+ CORBA::Any &_tao_any,
+ const RTCORBA::PriorityBand &_tao_elem
+ )
+{
+ TAO::Any_Dual_Impl_T<RTCORBA::PriorityBand>::insert_copy (
+ _tao_any,
+ RTCORBA::PriorityBand::_tao_any_destructor,
+ RTCORBA::_tc_PriorityBand,
+ _tao_elem
+ );
+}
+
+// Non-copying insertion.
+void operator<<= (
+ CORBA::Any &_tao_any,
+ RTCORBA::PriorityBand *_tao_elem
+ )
+{
+ TAO::Any_Dual_Impl_T<RTCORBA::PriorityBand>::insert (
+ _tao_any,
+ RTCORBA::PriorityBand::_tao_any_destructor,
+ RTCORBA::_tc_PriorityBand,
+ _tao_elem
+ );
+}
+
+// Extraction to non-const pointer (deprecated).
+CORBA::Boolean operator>>= (
+ const CORBA::Any &_tao_any,
+ RTCORBA::PriorityBand *&_tao_elem
+ )
+{
+ return _tao_any >>= const_cast<
+ const RTCORBA::PriorityBand *&> (
+ _tao_elem
+ );
+}
+
+// Extraction to const pointer.
+CORBA::Boolean operator>>= (
+ const CORBA::Any &_tao_any,
+ const RTCORBA::PriorityBand *&_tao_elem
+ )
+{
+ return
+ TAO::Any_Dual_Impl_T<RTCORBA::PriorityBand>::extract (
+ _tao_any,
+ RTCORBA::PriorityBand::_tao_any_destructor,
+ RTCORBA::_tc_PriorityBand,
+ _tao_elem
+ );
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_sequence/any_op_cs.cpp:54
+
+
+// Copying insertion.
+void operator<<= (
+ CORBA::Any &_tao_any,
+ const RTCORBA::PriorityBands &_tao_elem
+ )
+{
+ TAO::Any_Dual_Impl_T<RTCORBA::PriorityBands>::insert_copy (
+ _tao_any,
+ RTCORBA::PriorityBands::_tao_any_destructor,
+ TAO::TypeCode::tc_RTCORBA_PriorityBands_0,
+ _tao_elem
+ );
+}
+
+// Non-copying insertion.
+void operator<<= (
+ CORBA::Any &_tao_any,
+ RTCORBA::PriorityBands *_tao_elem
+ )
+{
+ TAO::Any_Dual_Impl_T<RTCORBA::PriorityBands>::insert (
+ _tao_any,
+ RTCORBA::PriorityBands::_tao_any_destructor,
+ TAO::TypeCode::tc_RTCORBA_PriorityBands_0,
+ _tao_elem
+ );
+}
+
+// Extraction to non-const pointer (deprecated).
+CORBA::Boolean operator>>= (
+ const CORBA::Any &_tao_any,
+ RTCORBA::PriorityBands *&_tao_elem
+ )
+{
+ return _tao_any >>= const_cast<
+ const RTCORBA::PriorityBands *&> (
+ _tao_elem
+ );
+}
+
+// Extraction to const pointer.
+CORBA::Boolean operator>>= (
+ const CORBA::Any &_tao_any,
+ const RTCORBA::PriorityBands *&_tao_elem
+ )
+{
+ return
+ TAO::Any_Dual_Impl_T<RTCORBA::PriorityBands>::extract (
+ _tao_any,
+ RTCORBA::PriorityBands::_tao_any_destructor,
+ TAO::TypeCode::tc_RTCORBA_PriorityBands_0,
+ _tao_elem
+ );
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/any_op_cs.cpp:50
+
+namespace TAO
+{
+ template<>
+ CORBA::Boolean
+ Any_Impl_T<RTCORBA::PriorityBandedConnectionPolicy>::to_object (
+ CORBA::Object_ptr &_tao_elem
+ ) const
+ {
+ _tao_elem = CORBA::Object::_duplicate (this->value_);
+ return true;
+ }
+}
+
+namespace TAO
+{
+ template<>
+ CORBA::Boolean
+ Any_Impl_T<RTCORBA::PriorityBandedConnectionPolicy>::marshal_value (TAO_OutputCDR &)
+ {
+ return false;
+ }
+
+ template<>
+ CORBA::Boolean
+ Any_Impl_T<RTCORBA::PriorityBandedConnectionPolicy>::demarshal_value (TAO_InputCDR &)
+ {
+ return false;
+ }
+}
+
+// Copying insertion.
+void
+operator<<= (
+ CORBA::Any &_tao_any,
+ RTCORBA::PriorityBandedConnectionPolicy_ptr _tao_elem
+ )
+{
+ RTCORBA::PriorityBandedConnectionPolicy_ptr _tao_objptr =
+ RTCORBA::PriorityBandedConnectionPolicy::_duplicate (_tao_elem);
+ _tao_any <<= &_tao_objptr;
+}
+
+// Non-copying insertion.
+void
+operator<<= (
+ CORBA::Any &_tao_any,
+ RTCORBA::PriorityBandedConnectionPolicy_ptr *_tao_elem
+ )
+{
+ TAO::Any_Impl_T<RTCORBA::PriorityBandedConnectionPolicy>::insert (
+ _tao_any,
+ RTCORBA::PriorityBandedConnectionPolicy::_tao_any_destructor,
+ RTCORBA::_tc_PriorityBandedConnectionPolicy,
+ *_tao_elem
+ );
+}
+
+CORBA::Boolean
+operator>>= (
+ const CORBA::Any &_tao_any,
+ RTCORBA::PriorityBandedConnectionPolicy_ptr &_tao_elem
+ )
+{
+ return
+ TAO::Any_Impl_T<RTCORBA::PriorityBandedConnectionPolicy>::extract (
+ _tao_any,
+ RTCORBA::PriorityBandedConnectionPolicy::_tao_any_destructor,
+ RTCORBA::_tc_PriorityBandedConnectionPolicy,
+ _tao_elem
+ );
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/any_op_cs.cpp:50
+
+namespace TAO
+{
+ template<>
+ CORBA::Boolean
+ Any_Impl_T<RTCORBA::Current>::to_object (
+ CORBA::Object_ptr &_tao_elem
+ ) const
+ {
+ _tao_elem = CORBA::Object::_duplicate (this->value_);
+ return true;
+ }
+}
+
+namespace TAO
+{
+ template<>
+ CORBA::Boolean
+ Any_Impl_T<RTCORBA::Current>::marshal_value (TAO_OutputCDR &)
+ {
+ return false;
+ }
+
+ template<>
+ CORBA::Boolean
+ Any_Impl_T<RTCORBA::Current>::demarshal_value (TAO_InputCDR &)
+ {
+ return false;
+ }
+}
+
+// Copying insertion.
+void
+operator<<= (
+ CORBA::Any &_tao_any,
+ RTCORBA::Current_ptr _tao_elem
+ )
+{
+ RTCORBA::Current_ptr _tao_objptr =
+ RTCORBA::Current::_duplicate (_tao_elem);
+ _tao_any <<= &_tao_objptr;
+}
+
+// Non-copying insertion.
+void
+operator<<= (
+ CORBA::Any &_tao_any,
+ RTCORBA::Current_ptr *_tao_elem
+ )
+{
+ TAO::Any_Impl_T<RTCORBA::Current>::insert (
+ _tao_any,
+ RTCORBA::Current::_tao_any_destructor,
+ RTCORBA::_tc_Current,
+ *_tao_elem
+ );
+}
+
+CORBA::Boolean
+operator>>= (
+ const CORBA::Any &_tao_any,
+ RTCORBA::Current_ptr &_tao_elem
+ )
+{
+ return
+ TAO::Any_Impl_T<RTCORBA::Current>::extract (
+ _tao_any,
+ RTCORBA::Current::_tao_any_destructor,
+ RTCORBA::_tc_Current,
+ _tao_elem
+ );
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/any_op_cs.cpp:50
+
+namespace TAO
+{
+ template<>
+ CORBA::Boolean
+ Any_Impl_T<RTCORBA::Mutex>::to_object (
+ CORBA::Object_ptr &_tao_elem
+ ) const
+ {
+ _tao_elem = CORBA::Object::_duplicate (this->value_);
+ return true;
+ }
+}
+
+namespace TAO
+{
+ template<>
+ CORBA::Boolean
+ Any_Impl_T<RTCORBA::Mutex>::marshal_value (TAO_OutputCDR &)
+ {
+ return false;
+ }
+
+ template<>
+ CORBA::Boolean
+ Any_Impl_T<RTCORBA::Mutex>::demarshal_value (TAO_InputCDR &)
+ {
+ return false;
+ }
+}
+
+// Copying insertion.
+void
+operator<<= (
+ CORBA::Any &_tao_any,
+ RTCORBA::Mutex_ptr _tao_elem
+ )
+{
+ RTCORBA::Mutex_ptr _tao_objptr =
+ RTCORBA::Mutex::_duplicate (_tao_elem);
+ _tao_any <<= &_tao_objptr;
+}
+
+// Non-copying insertion.
+void
+operator<<= (
+ CORBA::Any &_tao_any,
+ RTCORBA::Mutex_ptr *_tao_elem
+ )
+{
+ TAO::Any_Impl_T<RTCORBA::Mutex>::insert (
+ _tao_any,
+ RTCORBA::Mutex::_tao_any_destructor,
+ RTCORBA::_tc_Mutex,
+ *_tao_elem
+ );
+}
+
+CORBA::Boolean
+operator>>= (
+ const CORBA::Any &_tao_any,
+ RTCORBA::Mutex_ptr &_tao_elem
+ )
+{
+ return
+ TAO::Any_Impl_T<RTCORBA::Mutex>::extract (
+ _tao_any,
+ RTCORBA::Mutex::_tao_any_destructor,
+ RTCORBA::_tc_Mutex,
+ _tao_elem
+ );
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/any_op_cs.cpp:50
+
+namespace TAO
+{
+ template<>
+ CORBA::Boolean
+ Any_Impl_T<RTCORBA::RTORB>::to_object (
+ CORBA::Object_ptr &_tao_elem
+ ) const
+ {
+ _tao_elem = CORBA::Object::_duplicate (this->value_);
+ return true;
+ }
+}
+
+namespace TAO
+{
+ template<>
+ CORBA::Boolean
+ Any_Impl_T<RTCORBA::RTORB>::marshal_value (TAO_OutputCDR &)
+ {
+ return false;
+ }
+
+ template<>
+ CORBA::Boolean
+ Any_Impl_T<RTCORBA::RTORB>::demarshal_value (TAO_InputCDR &)
+ {
+ return false;
+ }
+}
+
+// Copying insertion.
+void
+operator<<= (
+ CORBA::Any &_tao_any,
+ RTCORBA::RTORB_ptr _tao_elem
+ )
+{
+ RTCORBA::RTORB_ptr _tao_objptr =
+ RTCORBA::RTORB::_duplicate (_tao_elem);
+ _tao_any <<= &_tao_objptr;
+}
+
+// Non-copying insertion.
+void
+operator<<= (
+ CORBA::Any &_tao_any,
+ RTCORBA::RTORB_ptr *_tao_elem
+ )
+{
+ TAO::Any_Impl_T<RTCORBA::RTORB>::insert (
+ _tao_any,
+ RTCORBA::RTORB::_tao_any_destructor,
+ RTCORBA::_tc_RTORB,
+ *_tao_elem
+ );
+}
+
+CORBA::Boolean
+operator>>= (
+ const CORBA::Any &_tao_any,
+ RTCORBA::RTORB_ptr &_tao_elem
+ )
+{
+ return
+ TAO::Any_Impl_T<RTCORBA::RTORB>::extract (
+ _tao_any,
+ RTCORBA::RTORB::_tao_any_destructor,
+ RTCORBA::_tc_RTORB,
+ _tao_elem
+ );
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_exception/any_op_cs.cpp:50
+
+namespace TAO
+{
+ template<>
+ CORBA::Boolean
+ Any_Dual_Impl_T<RTCORBA::RTORB::MutexNotFound>::marshal_value (TAO_OutputCDR &)
+ {
+ return false;
+ }
+
+ template<>
+ CORBA::Boolean
+ Any_Dual_Impl_T<RTCORBA::RTORB::MutexNotFound>::demarshal_value (TAO_InputCDR &)
+ {
+ return false;
+ }
+}
+
+// Copying insertion.
+void operator<<= (
+ CORBA::Any &_tao_any,
+ const RTCORBA::RTORB::MutexNotFound &_tao_elem
+ )
+{
+ TAO::Any_Dual_Impl_T<RTCORBA::RTORB::MutexNotFound>::insert_copy (
+ _tao_any,
+ RTCORBA::RTORB::MutexNotFound::_tao_any_destructor,
+ RTCORBA::RTORB::_tc_MutexNotFound,
+ _tao_elem
+ );
+}
+
+// Non-copying insertion.
+void operator<<= (
+ CORBA::Any &_tao_any,
+ RTCORBA::RTORB::MutexNotFound *_tao_elem
+ )
+{
+ TAO::Any_Dual_Impl_T<RTCORBA::RTORB::MutexNotFound>::insert (
+ _tao_any,
+ RTCORBA::RTORB::MutexNotFound::_tao_any_destructor,
+ RTCORBA::RTORB::_tc_MutexNotFound,
+ _tao_elem
+ );
+}
+
+// Extraction to non-const pointer (deprecated).
+CORBA::Boolean operator>>= (
+ const CORBA::Any &_tao_any,
+ RTCORBA::RTORB::MutexNotFound *&_tao_elem
+ )
+{
+ return _tao_any >>= const_cast<
+ const RTCORBA::RTORB::MutexNotFound *&> (
+ _tao_elem
+ );
+}
+
+// Extraction to const pointer.
+CORBA::Boolean operator>>= (
+ const CORBA::Any &_tao_any,
+ const RTCORBA::RTORB::MutexNotFound *&_tao_elem
+ )
+{
+ return
+ TAO::Any_Dual_Impl_T<RTCORBA::RTORB::MutexNotFound>::extract (
+ _tao_any,
+ RTCORBA::RTORB::MutexNotFound::_tao_any_destructor,
+ RTCORBA::RTORB::_tc_MutexNotFound,
+ _tao_elem
+ );
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_exception/any_op_cs.cpp:50
+
+namespace TAO
+{
+ template<>
+ CORBA::Boolean
+ Any_Dual_Impl_T<RTCORBA::RTORB::InvalidThreadpool>::marshal_value (TAO_OutputCDR &)
+ {
+ return false;
+ }
+
+ template<>
+ CORBA::Boolean
+ Any_Dual_Impl_T<RTCORBA::RTORB::InvalidThreadpool>::demarshal_value (TAO_InputCDR &)
+ {
+ return false;
+ }
+}
+
+// Copying insertion.
+void operator<<= (
+ CORBA::Any &_tao_any,
+ const RTCORBA::RTORB::InvalidThreadpool &_tao_elem
+ )
+{
+ TAO::Any_Dual_Impl_T<RTCORBA::RTORB::InvalidThreadpool>::insert_copy (
+ _tao_any,
+ RTCORBA::RTORB::InvalidThreadpool::_tao_any_destructor,
+ RTCORBA::RTORB::_tc_InvalidThreadpool,
+ _tao_elem
+ );
+}
+
+// Non-copying insertion.
+void operator<<= (
+ CORBA::Any &_tao_any,
+ RTCORBA::RTORB::InvalidThreadpool *_tao_elem
+ )
+{
+ TAO::Any_Dual_Impl_T<RTCORBA::RTORB::InvalidThreadpool>::insert (
+ _tao_any,
+ RTCORBA::RTORB::InvalidThreadpool::_tao_any_destructor,
+ RTCORBA::RTORB::_tc_InvalidThreadpool,
+ _tao_elem
+ );
+}
+
+// Extraction to non-const pointer (deprecated).
+CORBA::Boolean operator>>= (
+ const CORBA::Any &_tao_any,
+ RTCORBA::RTORB::InvalidThreadpool *&_tao_elem
+ )
+{
+ return _tao_any >>= const_cast<
+ const RTCORBA::RTORB::InvalidThreadpool *&> (
+ _tao_elem
+ );
+}
+
+// Extraction to const pointer.
+CORBA::Boolean operator>>= (
+ const CORBA::Any &_tao_any,
+ const RTCORBA::RTORB::InvalidThreadpool *&_tao_elem
+ )
+{
+ return
+ TAO::Any_Dual_Impl_T<RTCORBA::RTORB::InvalidThreadpool>::extract (
+ _tao_any,
+ RTCORBA::RTORB::InvalidThreadpool::_tao_any_destructor,
+ RTCORBA::RTORB::_tc_InvalidThreadpool,
+ _tao_elem
+ );
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/RTCORBA/RTCORBAA.h b/TAO/tao/RTCORBA/RTCORBAA.h
new file mode 100644
index 00000000000..e543e41332e
--- /dev/null
+++ b/TAO/tao/RTCORBA/RTCORBAA.h
@@ -0,0 +1,3 @@
+// $Id$
+// This file deliberately empty. See bugzilla #2549.
+
diff --git a/TAO/tao/RTCORBA/RTCORBAC.cpp b/TAO/tao/RTCORBA/RTCORBAC.cpp
new file mode 100644
index 00000000000..fa163250e7a
--- /dev/null
+++ b/TAO/tao/RTCORBA/RTCORBAC.cpp
@@ -0,0 +1,2739 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:291
+
+
+#include "tao/RTCORBA/RTCORBA.h"
+#include "tao/CDR.h"
+#include "tao/Basic_Arguments.h"
+#include "tao/Special_Basic_Arguments.h"
+#include "tao/UB_String_Arguments.h"
+#include "ace/OS_NS_string.h"
+
+#if defined (__BORLANDC__)
+#pragma option -w-rvl -w-rch -w-ccc -w-aus -w-sig
+#endif /* __BORLANDC__ */
+
+// TAO_IDL - Generated from
+// be\be_visitor_arg_traits.cpp:70
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Arg traits specializations.
+namespace TAO
+{
+}
+
+//////////////////////////////////////////////////////
+// CDR Encoding Support hand crafted
+
+CORBA::Boolean
+RTCORBA::ProtocolProperties::_tao_encode (TAO_OutputCDR &)
+{
+ return 1;
+}
+// TAO_IDL - Generated from
+// be/be_visitor_arg_traits.cpp:60
+
+CORBA::Boolean
+RTCORBA::ProtocolProperties::_tao_decode (TAO_InputCDR &)
+{
+ return 1;
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_structure/structure_cs.cpp:66
+
+void
+RTCORBA::ThreadpoolLane::_tao_any_destructor (
+ void *_tao_void_pointer
+ )
+{
+ ThreadpoolLane *_tao_tmp_pointer =
+ static_cast<ThreadpoolLane *> (_tao_void_pointer);
+ delete _tao_tmp_pointer;
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_sequence/sequence_cs.cpp:65
+
+#if !defined (_RTCORBA_THREADPOOLLANES_CS_)
+#define _RTCORBA_THREADPOOLLANES_CS_
+
+RTCORBA::ThreadpoolLanes::ThreadpoolLanes (void)
+{}
+
+RTCORBA::ThreadpoolLanes::ThreadpoolLanes (
+ CORBA::ULong max
+ )
+ : TAO::unbounded_value_sequence<
+ RTCORBA::ThreadpoolLane
+ >
+ (max)
+{}
+
+RTCORBA::ThreadpoolLanes::ThreadpoolLanes (
+ CORBA::ULong max,
+ CORBA::ULong length,
+ RTCORBA::ThreadpoolLane * buffer,
+ CORBA::Boolean release
+ )
+ : TAO::unbounded_value_sequence<
+ RTCORBA::ThreadpoolLane
+ >
+ (max, length, buffer, release)
+{}
+
+RTCORBA::ThreadpoolLanes::ThreadpoolLanes (
+ const ThreadpoolLanes &seq
+ )
+ : TAO::unbounded_value_sequence<
+ RTCORBA::ThreadpoolLane
+ >
+ (seq)
+{}
+
+RTCORBA::ThreadpoolLanes::~ThreadpoolLanes (void)
+{}
+
+void RTCORBA::ThreadpoolLanes::_tao_any_destructor (
+ void * _tao_void_pointer
+ )
+{
+ ThreadpoolLanes * _tao_tmp_pointer =
+ static_cast<ThreadpoolLanes *> (_tao_void_pointer);
+ delete _tao_tmp_pointer;
+}
+
+#endif /* end #if !defined */
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/interface_cs.cpp:60
+
+// Traits specializations for RTCORBA::PriorityModelPolicy.
+
+RTCORBA::PriorityModelPolicy_ptr
+TAO::Objref_Traits<RTCORBA::PriorityModelPolicy>::duplicate (
+ RTCORBA::PriorityModelPolicy_ptr p
+ )
+{
+ return RTCORBA::PriorityModelPolicy::_duplicate (p);
+}
+
+void
+TAO::Objref_Traits<RTCORBA::PriorityModelPolicy>::release (
+ RTCORBA::PriorityModelPolicy_ptr p
+ )
+{
+ ::CORBA::release (p);
+}
+
+RTCORBA::PriorityModelPolicy_ptr
+TAO::Objref_Traits<RTCORBA::PriorityModelPolicy>::nil (void)
+{
+ return RTCORBA::PriorityModelPolicy::_nil ();
+}
+
+CORBA::Boolean
+TAO::Objref_Traits<RTCORBA::PriorityModelPolicy>::marshal (
+ RTCORBA::PriorityModelPolicy_ptr p,
+ TAO_OutputCDR & cdr
+ )
+{
+ return CORBA::Object::marshal (p, cdr);
+}
+
+RTCORBA::PriorityModelPolicy::PriorityModelPolicy (void)
+{}
+
+RTCORBA::PriorityModelPolicy::~PriorityModelPolicy (void)
+{}
+
+void
+RTCORBA::PriorityModelPolicy::_tao_any_destructor (void *_tao_void_pointer)
+{
+ PriorityModelPolicy *_tao_tmp_pointer =
+ static_cast<PriorityModelPolicy *> (_tao_void_pointer);
+ ::CORBA::release (_tao_tmp_pointer);
+}
+
+RTCORBA::PriorityModelPolicy_ptr
+RTCORBA::PriorityModelPolicy::_narrow (
+ CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return PriorityModelPolicy::_duplicate (
+ dynamic_cast<PriorityModelPolicy_ptr> (_tao_objref)
+ );
+}
+
+RTCORBA::PriorityModelPolicy_ptr
+RTCORBA::PriorityModelPolicy::_unchecked_narrow (
+ CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return PriorityModelPolicy::_duplicate (
+ dynamic_cast<PriorityModelPolicy_ptr> (_tao_objref)
+ );
+}
+
+RTCORBA::PriorityModelPolicy_ptr
+RTCORBA::PriorityModelPolicy::_duplicate (PriorityModelPolicy_ptr obj)
+{
+ if (! ::CORBA::is_nil (obj))
+ {
+ obj->_add_ref ();
+ }
+
+ return obj;
+}
+
+void
+RTCORBA::PriorityModelPolicy::_tao_release (PriorityModelPolicy_ptr obj)
+{
+ ::CORBA::release (obj);
+}
+
+CORBA::Boolean
+RTCORBA::PriorityModelPolicy::_is_a (
+ const char *value
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ if (
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/Policy:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/RTCORBA/PriorityModelPolicy:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/LocalObject:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/Object:1.0"
+ )
+ )
+ {
+ return true; // success using local knowledge
+ }
+ else
+ {
+ return false;
+ }
+}
+
+const char* RTCORBA::PriorityModelPolicy::_interface_repository_id (void) const
+{
+ return "IDL:omg.org/RTCORBA/PriorityModelPolicy:1.0";
+}
+
+CORBA::Boolean
+RTCORBA::PriorityModelPolicy::marshal (TAO_OutputCDR &)
+{
+ return false;
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/interface_cs.cpp:60
+
+// Traits specializations for RTCORBA::ThreadpoolPolicy.
+
+RTCORBA::ThreadpoolPolicy_ptr
+TAO::Objref_Traits<RTCORBA::ThreadpoolPolicy>::duplicate (
+ RTCORBA::ThreadpoolPolicy_ptr p
+ )
+{
+ return RTCORBA::ThreadpoolPolicy::_duplicate (p);
+}
+
+void
+TAO::Objref_Traits<RTCORBA::ThreadpoolPolicy>::release (
+ RTCORBA::ThreadpoolPolicy_ptr p
+ )
+{
+ ::CORBA::release (p);
+}
+
+RTCORBA::ThreadpoolPolicy_ptr
+TAO::Objref_Traits<RTCORBA::ThreadpoolPolicy>::nil (void)
+{
+ return RTCORBA::ThreadpoolPolicy::_nil ();
+}
+
+CORBA::Boolean
+TAO::Objref_Traits<RTCORBA::ThreadpoolPolicy>::marshal (
+ RTCORBA::ThreadpoolPolicy_ptr p,
+ TAO_OutputCDR & cdr
+ )
+{
+ return CORBA::Object::marshal (p, cdr);
+}
+
+RTCORBA::ThreadpoolPolicy::ThreadpoolPolicy (void)
+{}
+
+RTCORBA::ThreadpoolPolicy::~ThreadpoolPolicy (void)
+{}
+
+void
+RTCORBA::ThreadpoolPolicy::_tao_any_destructor (void *_tao_void_pointer)
+{
+ ThreadpoolPolicy *_tao_tmp_pointer =
+ static_cast<ThreadpoolPolicy *> (_tao_void_pointer);
+ ::CORBA::release (_tao_tmp_pointer);
+}
+
+RTCORBA::ThreadpoolPolicy_ptr
+RTCORBA::ThreadpoolPolicy::_narrow (
+ CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return ThreadpoolPolicy::_duplicate (
+ dynamic_cast<ThreadpoolPolicy_ptr> (_tao_objref)
+ );
+}
+
+RTCORBA::ThreadpoolPolicy_ptr
+RTCORBA::ThreadpoolPolicy::_unchecked_narrow (
+ CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return ThreadpoolPolicy::_duplicate (
+ dynamic_cast<ThreadpoolPolicy_ptr> (_tao_objref)
+ );
+}
+
+RTCORBA::ThreadpoolPolicy_ptr
+RTCORBA::ThreadpoolPolicy::_duplicate (ThreadpoolPolicy_ptr obj)
+{
+ if (! ::CORBA::is_nil (obj))
+ {
+ obj->_add_ref ();
+ }
+
+ return obj;
+}
+
+void
+RTCORBA::ThreadpoolPolicy::_tao_release (ThreadpoolPolicy_ptr obj)
+{
+ ::CORBA::release (obj);
+}
+
+CORBA::Boolean
+RTCORBA::ThreadpoolPolicy::_is_a (
+ const char *value
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ if (
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/Policy:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/RTCORBA/ThreadpoolPolicy:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/LocalObject:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/Object:1.0"
+ )
+ )
+ {
+ return true; // success using local knowledge
+ }
+ else
+ {
+ return false;
+ }
+}
+
+const char* RTCORBA::ThreadpoolPolicy::_interface_repository_id (void) const
+{
+ return "IDL:omg.org/RTCORBA/ThreadpoolPolicy:1.0";
+}
+
+CORBA::Boolean
+RTCORBA::ThreadpoolPolicy::marshal (TAO_OutputCDR &)
+{
+ return false;
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/interface_cs.cpp:60
+
+// Traits specializations for RTCORBA::ProtocolProperties.
+
+RTCORBA::ProtocolProperties_ptr
+TAO::Objref_Traits<RTCORBA::ProtocolProperties>::duplicate (
+ RTCORBA::ProtocolProperties_ptr p
+ )
+{
+ return RTCORBA::ProtocolProperties::_duplicate (p);
+}
+
+void
+TAO::Objref_Traits<RTCORBA::ProtocolProperties>::release (
+ RTCORBA::ProtocolProperties_ptr p
+ )
+{
+ ::CORBA::release (p);
+}
+
+RTCORBA::ProtocolProperties_ptr
+TAO::Objref_Traits<RTCORBA::ProtocolProperties>::nil (void)
+{
+ return RTCORBA::ProtocolProperties::_nil ();
+}
+
+CORBA::Boolean
+TAO::Objref_Traits<RTCORBA::ProtocolProperties>::marshal (
+ RTCORBA::ProtocolProperties_ptr p,
+ TAO_OutputCDR & cdr
+ )
+{
+ return CORBA::Object::marshal (p, cdr);
+}
+
+RTCORBA::ProtocolProperties::ProtocolProperties (void)
+{}
+
+RTCORBA::ProtocolProperties::~ProtocolProperties (void)
+{}
+
+void
+RTCORBA::ProtocolProperties::_tao_any_destructor (void *_tao_void_pointer)
+{
+ ProtocolProperties *_tao_tmp_pointer =
+ static_cast<ProtocolProperties *> (_tao_void_pointer);
+ ::CORBA::release (_tao_tmp_pointer);
+}
+
+RTCORBA::ProtocolProperties_ptr
+RTCORBA::ProtocolProperties::_narrow (
+ CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return ProtocolProperties::_duplicate (
+ dynamic_cast<ProtocolProperties_ptr> (_tao_objref)
+ );
+}
+
+RTCORBA::ProtocolProperties_ptr
+RTCORBA::ProtocolProperties::_unchecked_narrow (
+ CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return ProtocolProperties::_duplicate (
+ dynamic_cast<ProtocolProperties_ptr> (_tao_objref)
+ );
+}
+
+RTCORBA::ProtocolProperties_ptr
+RTCORBA::ProtocolProperties::_duplicate (ProtocolProperties_ptr obj)
+{
+ if (! ::CORBA::is_nil (obj))
+ {
+ obj->_add_ref ();
+ }
+
+ return obj;
+}
+
+void
+RTCORBA::ProtocolProperties::_tao_release (ProtocolProperties_ptr obj)
+{
+ ::CORBA::release (obj);
+}
+
+CORBA::Boolean
+RTCORBA::ProtocolProperties::_is_a (
+ const char *value
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ if (
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/RTCORBA/ProtocolProperties:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/LocalObject:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/Object:1.0"
+ )
+ )
+ {
+ return true; // success using local knowledge
+ }
+ else
+ {
+ return false;
+ }
+}
+
+const char* RTCORBA::ProtocolProperties::_interface_repository_id (void) const
+{
+ return "IDL:omg.org/RTCORBA/ProtocolProperties:1.0";
+}
+
+CORBA::Boolean
+RTCORBA::ProtocolProperties::marshal (TAO_OutputCDR &)
+{
+ return false;
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_structure/structure_cs.cpp:66
+
+void
+RTCORBA::Protocol::_tao_any_destructor (
+ void *_tao_void_pointer
+ )
+{
+ Protocol *_tao_tmp_pointer =
+ static_cast<Protocol *> (_tao_void_pointer);
+ delete _tao_tmp_pointer;
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_sequence/sequence_cs.cpp:65
+
+#if !defined (_RTCORBA_PROTOCOLLIST_CS_)
+#define _RTCORBA_PROTOCOLLIST_CS_
+
+RTCORBA::ProtocolList::ProtocolList (void)
+{}
+
+RTCORBA::ProtocolList::ProtocolList (
+ CORBA::ULong max
+ )
+ : TAO::unbounded_value_sequence<
+ RTCORBA::Protocol
+ >
+ (max)
+{}
+
+RTCORBA::ProtocolList::ProtocolList (
+ CORBA::ULong max,
+ CORBA::ULong length,
+ RTCORBA::Protocol * buffer,
+ CORBA::Boolean release
+ )
+ : TAO::unbounded_value_sequence<
+ RTCORBA::Protocol
+ >
+ (max, length, buffer, release)
+{}
+
+RTCORBA::ProtocolList::ProtocolList (
+ const ProtocolList &seq
+ )
+ : TAO::unbounded_value_sequence<
+ RTCORBA::Protocol
+ >
+ (seq)
+{}
+
+RTCORBA::ProtocolList::~ProtocolList (void)
+{}
+
+void RTCORBA::ProtocolList::_tao_any_destructor (
+ void * _tao_void_pointer
+ )
+{
+ ProtocolList * _tao_tmp_pointer =
+ static_cast<ProtocolList *> (_tao_void_pointer);
+ delete _tao_tmp_pointer;
+}
+
+#endif /* end #if !defined */
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/interface_cs.cpp:60
+
+// Traits specializations for RTCORBA::ServerProtocolPolicy.
+
+RTCORBA::ServerProtocolPolicy_ptr
+TAO::Objref_Traits<RTCORBA::ServerProtocolPolicy>::duplicate (
+ RTCORBA::ServerProtocolPolicy_ptr p
+ )
+{
+ return RTCORBA::ServerProtocolPolicy::_duplicate (p);
+}
+
+void
+TAO::Objref_Traits<RTCORBA::ServerProtocolPolicy>::release (
+ RTCORBA::ServerProtocolPolicy_ptr p
+ )
+{
+ ::CORBA::release (p);
+}
+
+RTCORBA::ServerProtocolPolicy_ptr
+TAO::Objref_Traits<RTCORBA::ServerProtocolPolicy>::nil (void)
+{
+ return RTCORBA::ServerProtocolPolicy::_nil ();
+}
+
+CORBA::Boolean
+TAO::Objref_Traits<RTCORBA::ServerProtocolPolicy>::marshal (
+ RTCORBA::ServerProtocolPolicy_ptr p,
+ TAO_OutputCDR & cdr
+ )
+{
+ return CORBA::Object::marshal (p, cdr);
+}
+
+RTCORBA::ServerProtocolPolicy::ServerProtocolPolicy (void)
+{}
+
+RTCORBA::ServerProtocolPolicy::~ServerProtocolPolicy (void)
+{}
+
+void
+RTCORBA::ServerProtocolPolicy::_tao_any_destructor (void *_tao_void_pointer)
+{
+ ServerProtocolPolicy *_tao_tmp_pointer =
+ static_cast<ServerProtocolPolicy *> (_tao_void_pointer);
+ ::CORBA::release (_tao_tmp_pointer);
+}
+
+RTCORBA::ServerProtocolPolicy_ptr
+RTCORBA::ServerProtocolPolicy::_narrow (
+ CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return ServerProtocolPolicy::_duplicate (
+ dynamic_cast<ServerProtocolPolicy_ptr> (_tao_objref)
+ );
+}
+
+RTCORBA::ServerProtocolPolicy_ptr
+RTCORBA::ServerProtocolPolicy::_unchecked_narrow (
+ CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return ServerProtocolPolicy::_duplicate (
+ dynamic_cast<ServerProtocolPolicy_ptr> (_tao_objref)
+ );
+}
+
+RTCORBA::ServerProtocolPolicy_ptr
+RTCORBA::ServerProtocolPolicy::_duplicate (ServerProtocolPolicy_ptr obj)
+{
+ if (! ::CORBA::is_nil (obj))
+ {
+ obj->_add_ref ();
+ }
+
+ return obj;
+}
+
+void
+RTCORBA::ServerProtocolPolicy::_tao_release (ServerProtocolPolicy_ptr obj)
+{
+ ::CORBA::release (obj);
+}
+
+CORBA::Boolean
+RTCORBA::ServerProtocolPolicy::_is_a (
+ const char *value
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ if (
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/Policy:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/RTCORBA/ServerProtocolPolicy:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/LocalObject:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/Object:1.0"
+ )
+ )
+ {
+ return true; // success using local knowledge
+ }
+ else
+ {
+ return false;
+ }
+}
+
+const char* RTCORBA::ServerProtocolPolicy::_interface_repository_id (void) const
+{
+ return "IDL:omg.org/RTCORBA/ServerProtocolPolicy:1.0";
+}
+
+CORBA::Boolean
+RTCORBA::ServerProtocolPolicy::marshal (TAO_OutputCDR &)
+{
+ return false;
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/interface_cs.cpp:60
+
+// Traits specializations for RTCORBA::ClientProtocolPolicy.
+
+RTCORBA::ClientProtocolPolicy_ptr
+TAO::Objref_Traits<RTCORBA::ClientProtocolPolicy>::duplicate (
+ RTCORBA::ClientProtocolPolicy_ptr p
+ )
+{
+ return RTCORBA::ClientProtocolPolicy::_duplicate (p);
+}
+
+void
+TAO::Objref_Traits<RTCORBA::ClientProtocolPolicy>::release (
+ RTCORBA::ClientProtocolPolicy_ptr p
+ )
+{
+ ::CORBA::release (p);
+}
+
+RTCORBA::ClientProtocolPolicy_ptr
+TAO::Objref_Traits<RTCORBA::ClientProtocolPolicy>::nil (void)
+{
+ return RTCORBA::ClientProtocolPolicy::_nil ();
+}
+
+CORBA::Boolean
+TAO::Objref_Traits<RTCORBA::ClientProtocolPolicy>::marshal (
+ RTCORBA::ClientProtocolPolicy_ptr p,
+ TAO_OutputCDR & cdr
+ )
+{
+ return CORBA::Object::marshal (p, cdr);
+}
+
+RTCORBA::ClientProtocolPolicy::ClientProtocolPolicy (void)
+{}
+
+RTCORBA::ClientProtocolPolicy::~ClientProtocolPolicy (void)
+{}
+
+void
+RTCORBA::ClientProtocolPolicy::_tao_any_destructor (void *_tao_void_pointer)
+{
+ ClientProtocolPolicy *_tao_tmp_pointer =
+ static_cast<ClientProtocolPolicy *> (_tao_void_pointer);
+ ::CORBA::release (_tao_tmp_pointer);
+}
+
+RTCORBA::ClientProtocolPolicy_ptr
+RTCORBA::ClientProtocolPolicy::_narrow (
+ CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return ClientProtocolPolicy::_duplicate (
+ dynamic_cast<ClientProtocolPolicy_ptr> (_tao_objref)
+ );
+}
+
+RTCORBA::ClientProtocolPolicy_ptr
+RTCORBA::ClientProtocolPolicy::_unchecked_narrow (
+ CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return ClientProtocolPolicy::_duplicate (
+ dynamic_cast<ClientProtocolPolicy_ptr> (_tao_objref)
+ );
+}
+
+RTCORBA::ClientProtocolPolicy_ptr
+RTCORBA::ClientProtocolPolicy::_duplicate (ClientProtocolPolicy_ptr obj)
+{
+ if (! ::CORBA::is_nil (obj))
+ {
+ obj->_add_ref ();
+ }
+
+ return obj;
+}
+
+void
+RTCORBA::ClientProtocolPolicy::_tao_release (ClientProtocolPolicy_ptr obj)
+{
+ ::CORBA::release (obj);
+}
+
+CORBA::Boolean
+RTCORBA::ClientProtocolPolicy::_is_a (
+ const char *value
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ if (
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/Policy:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/RTCORBA/ClientProtocolPolicy:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/LocalObject:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/Object:1.0"
+ )
+ )
+ {
+ return true; // success using local knowledge
+ }
+ else
+ {
+ return false;
+ }
+}
+
+const char* RTCORBA::ClientProtocolPolicy::_interface_repository_id (void) const
+{
+ return "IDL:omg.org/RTCORBA/ClientProtocolPolicy:1.0";
+}
+
+CORBA::Boolean
+RTCORBA::ClientProtocolPolicy::marshal (TAO_OutputCDR &)
+{
+ return false;
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/interface_cs.cpp:60
+
+// Traits specializations for RTCORBA::PrivateConnectionPolicy.
+
+RTCORBA::PrivateConnectionPolicy_ptr
+TAO::Objref_Traits<RTCORBA::PrivateConnectionPolicy>::duplicate (
+ RTCORBA::PrivateConnectionPolicy_ptr p
+ )
+{
+ return RTCORBA::PrivateConnectionPolicy::_duplicate (p);
+}
+
+void
+TAO::Objref_Traits<RTCORBA::PrivateConnectionPolicy>::release (
+ RTCORBA::PrivateConnectionPolicy_ptr p
+ )
+{
+ ::CORBA::release (p);
+}
+
+RTCORBA::PrivateConnectionPolicy_ptr
+TAO::Objref_Traits<RTCORBA::PrivateConnectionPolicy>::nil (void)
+{
+ return RTCORBA::PrivateConnectionPolicy::_nil ();
+}
+
+CORBA::Boolean
+TAO::Objref_Traits<RTCORBA::PrivateConnectionPolicy>::marshal (
+ RTCORBA::PrivateConnectionPolicy_ptr p,
+ TAO_OutputCDR & cdr
+ )
+{
+ return CORBA::Object::marshal (p, cdr);
+}
+
+RTCORBA::PrivateConnectionPolicy::PrivateConnectionPolicy (void)
+{}
+
+RTCORBA::PrivateConnectionPolicy::~PrivateConnectionPolicy (void)
+{}
+
+void
+RTCORBA::PrivateConnectionPolicy::_tao_any_destructor (void *_tao_void_pointer)
+{
+ PrivateConnectionPolicy *_tao_tmp_pointer =
+ static_cast<PrivateConnectionPolicy *> (_tao_void_pointer);
+ ::CORBA::release (_tao_tmp_pointer);
+}
+
+RTCORBA::PrivateConnectionPolicy_ptr
+RTCORBA::PrivateConnectionPolicy::_narrow (
+ CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return PrivateConnectionPolicy::_duplicate (
+ dynamic_cast<PrivateConnectionPolicy_ptr> (_tao_objref)
+ );
+}
+
+RTCORBA::PrivateConnectionPolicy_ptr
+RTCORBA::PrivateConnectionPolicy::_unchecked_narrow (
+ CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return PrivateConnectionPolicy::_duplicate (
+ dynamic_cast<PrivateConnectionPolicy_ptr> (_tao_objref)
+ );
+}
+
+RTCORBA::PrivateConnectionPolicy_ptr
+RTCORBA::PrivateConnectionPolicy::_duplicate (PrivateConnectionPolicy_ptr obj)
+{
+ if (! ::CORBA::is_nil (obj))
+ {
+ obj->_add_ref ();
+ }
+
+ return obj;
+}
+
+void
+RTCORBA::PrivateConnectionPolicy::_tao_release (PrivateConnectionPolicy_ptr obj)
+{
+ ::CORBA::release (obj);
+}
+
+CORBA::Boolean
+RTCORBA::PrivateConnectionPolicy::_is_a (
+ const char *value
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ if (
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/Policy:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/RTCORBA/PrivateConnectionPolicy:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/LocalObject:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/Object:1.0"
+ )
+ )
+ {
+ return true; // success using local knowledge
+ }
+ else
+ {
+ return false;
+ }
+}
+
+const char* RTCORBA::PrivateConnectionPolicy::_interface_repository_id (void) const
+{
+ return "IDL:omg.org/RTCORBA/PrivateConnectionPolicy:1.0";
+}
+
+CORBA::Boolean
+RTCORBA::PrivateConnectionPolicy::marshal (TAO_OutputCDR &)
+{
+ return false;
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/interface_cs.cpp:60
+
+// Traits specializations for RTCORBA::TCPProtocolProperties.
+
+RTCORBA::TCPProtocolProperties_ptr
+TAO::Objref_Traits<RTCORBA::TCPProtocolProperties>::duplicate (
+ RTCORBA::TCPProtocolProperties_ptr p
+ )
+{
+ return RTCORBA::TCPProtocolProperties::_duplicate (p);
+}
+
+void
+TAO::Objref_Traits<RTCORBA::TCPProtocolProperties>::release (
+ RTCORBA::TCPProtocolProperties_ptr p
+ )
+{
+ ::CORBA::release (p);
+}
+
+RTCORBA::TCPProtocolProperties_ptr
+TAO::Objref_Traits<RTCORBA::TCPProtocolProperties>::nil (void)
+{
+ return RTCORBA::TCPProtocolProperties::_nil ();
+}
+
+CORBA::Boolean
+TAO::Objref_Traits<RTCORBA::TCPProtocolProperties>::marshal (
+ RTCORBA::TCPProtocolProperties_ptr p,
+ TAO_OutputCDR & cdr
+ )
+{
+ return CORBA::Object::marshal (p, cdr);
+}
+
+RTCORBA::TCPProtocolProperties::TCPProtocolProperties (void)
+{}
+
+RTCORBA::TCPProtocolProperties::~TCPProtocolProperties (void)
+{}
+
+void
+RTCORBA::TCPProtocolProperties::_tao_any_destructor (void *_tao_void_pointer)
+{
+ TCPProtocolProperties *_tao_tmp_pointer =
+ static_cast<TCPProtocolProperties *> (_tao_void_pointer);
+ ::CORBA::release (_tao_tmp_pointer);
+}
+
+RTCORBA::TCPProtocolProperties_ptr
+RTCORBA::TCPProtocolProperties::_narrow (
+ CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return TCPProtocolProperties::_duplicate (
+ dynamic_cast<TCPProtocolProperties_ptr> (_tao_objref)
+ );
+}
+
+RTCORBA::TCPProtocolProperties_ptr
+RTCORBA::TCPProtocolProperties::_unchecked_narrow (
+ CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return TCPProtocolProperties::_duplicate (
+ dynamic_cast<TCPProtocolProperties_ptr> (_tao_objref)
+ );
+}
+
+RTCORBA::TCPProtocolProperties_ptr
+RTCORBA::TCPProtocolProperties::_duplicate (TCPProtocolProperties_ptr obj)
+{
+ if (! ::CORBA::is_nil (obj))
+ {
+ obj->_add_ref ();
+ }
+
+ return obj;
+}
+
+void
+RTCORBA::TCPProtocolProperties::_tao_release (TCPProtocolProperties_ptr obj)
+{
+ ::CORBA::release (obj);
+}
+
+CORBA::Boolean
+RTCORBA::TCPProtocolProperties::_is_a (
+ const char *value
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ if (
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/RTCORBA/ProtocolProperties:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/RTCORBA/TCPProtocolProperties:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/LocalObject:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/Object:1.0"
+ )
+ )
+ {
+ return true; // success using local knowledge
+ }
+ else
+ {
+ return false;
+ }
+}
+
+const char* RTCORBA::TCPProtocolProperties::_interface_repository_id (void) const
+{
+ return "IDL:omg.org/RTCORBA/TCPProtocolProperties:1.0";
+}
+
+CORBA::Boolean
+RTCORBA::TCPProtocolProperties::marshal (TAO_OutputCDR &)
+{
+ return false;
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/interface_cs.cpp:60
+
+// Traits specializations for RTCORBA::GIOPProtocolProperties.
+
+RTCORBA::GIOPProtocolProperties_ptr
+TAO::Objref_Traits<RTCORBA::GIOPProtocolProperties>::duplicate (
+ RTCORBA::GIOPProtocolProperties_ptr p
+ )
+{
+ return RTCORBA::GIOPProtocolProperties::_duplicate (p);
+}
+
+void
+TAO::Objref_Traits<RTCORBA::GIOPProtocolProperties>::release (
+ RTCORBA::GIOPProtocolProperties_ptr p
+ )
+{
+ ::CORBA::release (p);
+}
+
+RTCORBA::GIOPProtocolProperties_ptr
+TAO::Objref_Traits<RTCORBA::GIOPProtocolProperties>::nil (void)
+{
+ return RTCORBA::GIOPProtocolProperties::_nil ();
+}
+
+CORBA::Boolean
+TAO::Objref_Traits<RTCORBA::GIOPProtocolProperties>::marshal (
+ RTCORBA::GIOPProtocolProperties_ptr p,
+ TAO_OutputCDR & cdr
+ )
+{
+ return CORBA::Object::marshal (p, cdr);
+}
+
+RTCORBA::GIOPProtocolProperties::GIOPProtocolProperties (void)
+{}
+
+RTCORBA::GIOPProtocolProperties::~GIOPProtocolProperties (void)
+{}
+
+void
+RTCORBA::GIOPProtocolProperties::_tao_any_destructor (void *_tao_void_pointer)
+{
+ GIOPProtocolProperties *_tao_tmp_pointer =
+ static_cast<GIOPProtocolProperties *> (_tao_void_pointer);
+ ::CORBA::release (_tao_tmp_pointer);
+}
+
+RTCORBA::GIOPProtocolProperties_ptr
+RTCORBA::GIOPProtocolProperties::_narrow (
+ CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return GIOPProtocolProperties::_duplicate (
+ dynamic_cast<GIOPProtocolProperties_ptr> (_tao_objref)
+ );
+}
+
+RTCORBA::GIOPProtocolProperties_ptr
+RTCORBA::GIOPProtocolProperties::_unchecked_narrow (
+ CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return GIOPProtocolProperties::_duplicate (
+ dynamic_cast<GIOPProtocolProperties_ptr> (_tao_objref)
+ );
+}
+
+RTCORBA::GIOPProtocolProperties_ptr
+RTCORBA::GIOPProtocolProperties::_duplicate (GIOPProtocolProperties_ptr obj)
+{
+ if (! ::CORBA::is_nil (obj))
+ {
+ obj->_add_ref ();
+ }
+
+ return obj;
+}
+
+void
+RTCORBA::GIOPProtocolProperties::_tao_release (GIOPProtocolProperties_ptr obj)
+{
+ ::CORBA::release (obj);
+}
+
+CORBA::Boolean
+RTCORBA::GIOPProtocolProperties::_is_a (
+ const char *value
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ if (
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/RTCORBA/ProtocolProperties:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/RTCORBA/GIOPProtocolProperties:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/LocalObject:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/Object:1.0"
+ )
+ )
+ {
+ return true; // success using local knowledge
+ }
+ else
+ {
+ return false;
+ }
+}
+
+const char* RTCORBA::GIOPProtocolProperties::_interface_repository_id (void) const
+{
+ return "IDL:omg.org/RTCORBA/GIOPProtocolProperties:1.0";
+}
+
+CORBA::Boolean
+RTCORBA::GIOPProtocolProperties::marshal (TAO_OutputCDR &)
+{
+ return false;
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/interface_cs.cpp:60
+
+// Traits specializations for RTCORBA::UnixDomainProtocolProperties.
+
+RTCORBA::UnixDomainProtocolProperties_ptr
+TAO::Objref_Traits<RTCORBA::UnixDomainProtocolProperties>::duplicate (
+ RTCORBA::UnixDomainProtocolProperties_ptr p
+ )
+{
+ return RTCORBA::UnixDomainProtocolProperties::_duplicate (p);
+}
+
+void
+TAO::Objref_Traits<RTCORBA::UnixDomainProtocolProperties>::release (
+ RTCORBA::UnixDomainProtocolProperties_ptr p
+ )
+{
+ ::CORBA::release (p);
+}
+
+RTCORBA::UnixDomainProtocolProperties_ptr
+TAO::Objref_Traits<RTCORBA::UnixDomainProtocolProperties>::nil (void)
+{
+ return RTCORBA::UnixDomainProtocolProperties::_nil ();
+}
+
+CORBA::Boolean
+TAO::Objref_Traits<RTCORBA::UnixDomainProtocolProperties>::marshal (
+ RTCORBA::UnixDomainProtocolProperties_ptr p,
+ TAO_OutputCDR & cdr
+ )
+{
+ return CORBA::Object::marshal (p, cdr);
+}
+
+RTCORBA::UnixDomainProtocolProperties::UnixDomainProtocolProperties (void)
+{}
+
+RTCORBA::UnixDomainProtocolProperties::~UnixDomainProtocolProperties (void)
+{}
+
+void
+RTCORBA::UnixDomainProtocolProperties::_tao_any_destructor (void *_tao_void_pointer)
+{
+ UnixDomainProtocolProperties *_tao_tmp_pointer =
+ static_cast<UnixDomainProtocolProperties *> (_tao_void_pointer);
+ ::CORBA::release (_tao_tmp_pointer);
+}
+
+RTCORBA::UnixDomainProtocolProperties_ptr
+RTCORBA::UnixDomainProtocolProperties::_narrow (
+ CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return UnixDomainProtocolProperties::_duplicate (
+ dynamic_cast<UnixDomainProtocolProperties_ptr> (_tao_objref)
+ );
+}
+
+RTCORBA::UnixDomainProtocolProperties_ptr
+RTCORBA::UnixDomainProtocolProperties::_unchecked_narrow (
+ CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return UnixDomainProtocolProperties::_duplicate (
+ dynamic_cast<UnixDomainProtocolProperties_ptr> (_tao_objref)
+ );
+}
+
+RTCORBA::UnixDomainProtocolProperties_ptr
+RTCORBA::UnixDomainProtocolProperties::_duplicate (UnixDomainProtocolProperties_ptr obj)
+{
+ if (! ::CORBA::is_nil (obj))
+ {
+ obj->_add_ref ();
+ }
+
+ return obj;
+}
+
+void
+RTCORBA::UnixDomainProtocolProperties::_tao_release (UnixDomainProtocolProperties_ptr obj)
+{
+ ::CORBA::release (obj);
+}
+
+CORBA::Boolean
+RTCORBA::UnixDomainProtocolProperties::_is_a (
+ const char *value
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ if (
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/RTCORBA/ProtocolProperties:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/RTCORBA/UnixDomainProtocolProperties:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/LocalObject:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/Object:1.0"
+ )
+ )
+ {
+ return true; // success using local knowledge
+ }
+ else
+ {
+ return false;
+ }
+}
+
+const char* RTCORBA::UnixDomainProtocolProperties::_interface_repository_id (void) const
+{
+ return "IDL:omg.org/RTCORBA/UnixDomainProtocolProperties:1.0";
+}
+
+CORBA::Boolean
+RTCORBA::UnixDomainProtocolProperties::marshal (TAO_OutputCDR &)
+{
+ return false;
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/interface_cs.cpp:60
+
+// Traits specializations for RTCORBA::SharedMemoryProtocolProperties.
+
+RTCORBA::SharedMemoryProtocolProperties_ptr
+TAO::Objref_Traits<RTCORBA::SharedMemoryProtocolProperties>::duplicate (
+ RTCORBA::SharedMemoryProtocolProperties_ptr p
+ )
+{
+ return RTCORBA::SharedMemoryProtocolProperties::_duplicate (p);
+}
+
+void
+TAO::Objref_Traits<RTCORBA::SharedMemoryProtocolProperties>::release (
+ RTCORBA::SharedMemoryProtocolProperties_ptr p
+ )
+{
+ ::CORBA::release (p);
+}
+
+RTCORBA::SharedMemoryProtocolProperties_ptr
+TAO::Objref_Traits<RTCORBA::SharedMemoryProtocolProperties>::nil (void)
+{
+ return RTCORBA::SharedMemoryProtocolProperties::_nil ();
+}
+
+CORBA::Boolean
+TAO::Objref_Traits<RTCORBA::SharedMemoryProtocolProperties>::marshal (
+ RTCORBA::SharedMemoryProtocolProperties_ptr p,
+ TAO_OutputCDR & cdr
+ )
+{
+ return CORBA::Object::marshal (p, cdr);
+}
+
+RTCORBA::SharedMemoryProtocolProperties::SharedMemoryProtocolProperties (void)
+{}
+
+RTCORBA::SharedMemoryProtocolProperties::~SharedMemoryProtocolProperties (void)
+{}
+
+void
+RTCORBA::SharedMemoryProtocolProperties::_tao_any_destructor (void *_tao_void_pointer)
+{
+ SharedMemoryProtocolProperties *_tao_tmp_pointer =
+ static_cast<SharedMemoryProtocolProperties *> (_tao_void_pointer);
+ ::CORBA::release (_tao_tmp_pointer);
+}
+
+RTCORBA::SharedMemoryProtocolProperties_ptr
+RTCORBA::SharedMemoryProtocolProperties::_narrow (
+ CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return SharedMemoryProtocolProperties::_duplicate (
+ dynamic_cast<SharedMemoryProtocolProperties_ptr> (_tao_objref)
+ );
+}
+
+RTCORBA::SharedMemoryProtocolProperties_ptr
+RTCORBA::SharedMemoryProtocolProperties::_unchecked_narrow (
+ CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return SharedMemoryProtocolProperties::_duplicate (
+ dynamic_cast<SharedMemoryProtocolProperties_ptr> (_tao_objref)
+ );
+}
+
+RTCORBA::SharedMemoryProtocolProperties_ptr
+RTCORBA::SharedMemoryProtocolProperties::_duplicate (SharedMemoryProtocolProperties_ptr obj)
+{
+ if (! ::CORBA::is_nil (obj))
+ {
+ obj->_add_ref ();
+ }
+
+ return obj;
+}
+
+void
+RTCORBA::SharedMemoryProtocolProperties::_tao_release (SharedMemoryProtocolProperties_ptr obj)
+{
+ ::CORBA::release (obj);
+}
+
+CORBA::Boolean
+RTCORBA::SharedMemoryProtocolProperties::_is_a (
+ const char *value
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ if (
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/RTCORBA/ProtocolProperties:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/RTCORBA/SharedMemoryProtocolProperties:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/LocalObject:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/Object:1.0"
+ )
+ )
+ {
+ return true; // success using local knowledge
+ }
+ else
+ {
+ return false;
+ }
+}
+
+const char* RTCORBA::SharedMemoryProtocolProperties::_interface_repository_id (void) const
+{
+ return "IDL:omg.org/RTCORBA/SharedMemoryProtocolProperties:1.0";
+}
+
+CORBA::Boolean
+RTCORBA::SharedMemoryProtocolProperties::marshal (TAO_OutputCDR &)
+{
+ return false;
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/interface_cs.cpp:60
+
+// Traits specializations for RTCORBA::UserDatagramProtocolProperties.
+
+RTCORBA::UserDatagramProtocolProperties_ptr
+TAO::Objref_Traits<RTCORBA::UserDatagramProtocolProperties>::duplicate (
+ RTCORBA::UserDatagramProtocolProperties_ptr p
+ )
+{
+ return RTCORBA::UserDatagramProtocolProperties::_duplicate (p);
+}
+
+void
+TAO::Objref_Traits<RTCORBA::UserDatagramProtocolProperties>::release (
+ RTCORBA::UserDatagramProtocolProperties_ptr p
+ )
+{
+ ::CORBA::release (p);
+}
+
+RTCORBA::UserDatagramProtocolProperties_ptr
+TAO::Objref_Traits<RTCORBA::UserDatagramProtocolProperties>::nil (void)
+{
+ return RTCORBA::UserDatagramProtocolProperties::_nil ();
+}
+
+CORBA::Boolean
+TAO::Objref_Traits<RTCORBA::UserDatagramProtocolProperties>::marshal (
+ RTCORBA::UserDatagramProtocolProperties_ptr p,
+ TAO_OutputCDR & cdr
+ )
+{
+ return CORBA::Object::marshal (p, cdr);
+}
+
+RTCORBA::UserDatagramProtocolProperties::UserDatagramProtocolProperties (void)
+{}
+
+RTCORBA::UserDatagramProtocolProperties::~UserDatagramProtocolProperties (void)
+{}
+
+void
+RTCORBA::UserDatagramProtocolProperties::_tao_any_destructor (void *_tao_void_pointer)
+{
+ UserDatagramProtocolProperties *_tao_tmp_pointer =
+ static_cast<UserDatagramProtocolProperties *> (_tao_void_pointer);
+ ::CORBA::release (_tao_tmp_pointer);
+}
+
+RTCORBA::UserDatagramProtocolProperties_ptr
+RTCORBA::UserDatagramProtocolProperties::_narrow (
+ CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return UserDatagramProtocolProperties::_duplicate (
+ dynamic_cast<UserDatagramProtocolProperties_ptr> (_tao_objref)
+ );
+}
+
+RTCORBA::UserDatagramProtocolProperties_ptr
+RTCORBA::UserDatagramProtocolProperties::_unchecked_narrow (
+ CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return UserDatagramProtocolProperties::_duplicate (
+ dynamic_cast<UserDatagramProtocolProperties_ptr> (_tao_objref)
+ );
+}
+
+RTCORBA::UserDatagramProtocolProperties_ptr
+RTCORBA::UserDatagramProtocolProperties::_duplicate (UserDatagramProtocolProperties_ptr obj)
+{
+ if (! ::CORBA::is_nil (obj))
+ {
+ obj->_add_ref ();
+ }
+
+ return obj;
+}
+
+void
+RTCORBA::UserDatagramProtocolProperties::_tao_release (UserDatagramProtocolProperties_ptr obj)
+{
+ ::CORBA::release (obj);
+}
+
+CORBA::Boolean
+RTCORBA::UserDatagramProtocolProperties::_is_a (
+ const char *value
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ if (
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/RTCORBA/ProtocolProperties:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/RTCORBA/UserDatagramProtocolProperties:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/LocalObject:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/Object:1.0"
+ )
+ )
+ {
+ return true; // success using local knowledge
+ }
+ else
+ {
+ return false;
+ }
+}
+
+const char* RTCORBA::UserDatagramProtocolProperties::_interface_repository_id (void) const
+{
+ return "IDL:omg.org/RTCORBA/UserDatagramProtocolProperties:1.0";
+}
+
+CORBA::Boolean
+RTCORBA::UserDatagramProtocolProperties::marshal (TAO_OutputCDR &)
+{
+ return false;
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/interface_cs.cpp:60
+
+// Traits specializations for RTCORBA::StreamControlProtocolProperties.
+
+RTCORBA::StreamControlProtocolProperties_ptr
+TAO::Objref_Traits<RTCORBA::StreamControlProtocolProperties>::duplicate (
+ RTCORBA::StreamControlProtocolProperties_ptr p
+ )
+{
+ return RTCORBA::StreamControlProtocolProperties::_duplicate (p);
+}
+
+void
+TAO::Objref_Traits<RTCORBA::StreamControlProtocolProperties>::release (
+ RTCORBA::StreamControlProtocolProperties_ptr p
+ )
+{
+ ::CORBA::release (p);
+}
+
+RTCORBA::StreamControlProtocolProperties_ptr
+TAO::Objref_Traits<RTCORBA::StreamControlProtocolProperties>::nil (void)
+{
+ return RTCORBA::StreamControlProtocolProperties::_nil ();
+}
+
+CORBA::Boolean
+TAO::Objref_Traits<RTCORBA::StreamControlProtocolProperties>::marshal (
+ RTCORBA::StreamControlProtocolProperties_ptr p,
+ TAO_OutputCDR & cdr
+ )
+{
+ return CORBA::Object::marshal (p, cdr);
+}
+
+RTCORBA::StreamControlProtocolProperties::StreamControlProtocolProperties (void)
+{}
+
+RTCORBA::StreamControlProtocolProperties::~StreamControlProtocolProperties (void)
+{}
+
+void
+RTCORBA::StreamControlProtocolProperties::_tao_any_destructor (void *_tao_void_pointer)
+{
+ StreamControlProtocolProperties *_tao_tmp_pointer =
+ static_cast<StreamControlProtocolProperties *> (_tao_void_pointer);
+ ::CORBA::release (_tao_tmp_pointer);
+}
+
+RTCORBA::StreamControlProtocolProperties_ptr
+RTCORBA::StreamControlProtocolProperties::_narrow (
+ CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return StreamControlProtocolProperties::_duplicate (
+ dynamic_cast<StreamControlProtocolProperties_ptr> (_tao_objref)
+ );
+}
+
+RTCORBA::StreamControlProtocolProperties_ptr
+RTCORBA::StreamControlProtocolProperties::_unchecked_narrow (
+ CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return StreamControlProtocolProperties::_duplicate (
+ dynamic_cast<StreamControlProtocolProperties_ptr> (_tao_objref)
+ );
+}
+
+RTCORBA::StreamControlProtocolProperties_ptr
+RTCORBA::StreamControlProtocolProperties::_duplicate (StreamControlProtocolProperties_ptr obj)
+{
+ if (! ::CORBA::is_nil (obj))
+ {
+ obj->_add_ref ();
+ }
+
+ return obj;
+}
+
+void
+RTCORBA::StreamControlProtocolProperties::_tao_release (StreamControlProtocolProperties_ptr obj)
+{
+ ::CORBA::release (obj);
+}
+
+CORBA::Boolean
+RTCORBA::StreamControlProtocolProperties::_is_a (
+ const char *value
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ if (
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/RTCORBA/ProtocolProperties:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/RTCORBA/StreamControlProtocolProperties:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/LocalObject:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/Object:1.0"
+ )
+ )
+ {
+ return true; // success using local knowledge
+ }
+ else
+ {
+ return false;
+ }
+}
+
+const char* RTCORBA::StreamControlProtocolProperties::_interface_repository_id (void) const
+{
+ return "IDL:omg.org/RTCORBA/StreamControlProtocolProperties:1.0";
+}
+
+CORBA::Boolean
+RTCORBA::StreamControlProtocolProperties::marshal (TAO_OutputCDR &)
+{
+ return false;
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_structure/structure_cs.cpp:66
+
+void
+RTCORBA::PriorityBand::_tao_any_destructor (
+ void *_tao_void_pointer
+ )
+{
+ PriorityBand *_tao_tmp_pointer =
+ static_cast<PriorityBand *> (_tao_void_pointer);
+ delete _tao_tmp_pointer;
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_sequence/sequence_cs.cpp:65
+
+#if !defined (_RTCORBA_PRIORITYBANDS_CS_)
+#define _RTCORBA_PRIORITYBANDS_CS_
+
+RTCORBA::PriorityBands::PriorityBands (void)
+{}
+
+RTCORBA::PriorityBands::PriorityBands (
+ CORBA::ULong max
+ )
+ : TAO::unbounded_value_sequence<
+ RTCORBA::PriorityBand
+ >
+ (max)
+{}
+
+RTCORBA::PriorityBands::PriorityBands (
+ CORBA::ULong max,
+ CORBA::ULong length,
+ RTCORBA::PriorityBand * buffer,
+ CORBA::Boolean release
+ )
+ : TAO::unbounded_value_sequence<
+ RTCORBA::PriorityBand
+ >
+ (max, length, buffer, release)
+{}
+
+RTCORBA::PriorityBands::PriorityBands (
+ const PriorityBands &seq
+ )
+ : TAO::unbounded_value_sequence<
+ RTCORBA::PriorityBand
+ >
+ (seq)
+{}
+
+RTCORBA::PriorityBands::~PriorityBands (void)
+{}
+
+void RTCORBA::PriorityBands::_tao_any_destructor (
+ void * _tao_void_pointer
+ )
+{
+ PriorityBands * _tao_tmp_pointer =
+ static_cast<PriorityBands *> (_tao_void_pointer);
+ delete _tao_tmp_pointer;
+}
+
+#endif /* end #if !defined */
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/interface_cs.cpp:60
+
+// Traits specializations for RTCORBA::PriorityBandedConnectionPolicy.
+
+RTCORBA::PriorityBandedConnectionPolicy_ptr
+TAO::Objref_Traits<RTCORBA::PriorityBandedConnectionPolicy>::duplicate (
+ RTCORBA::PriorityBandedConnectionPolicy_ptr p
+ )
+{
+ return RTCORBA::PriorityBandedConnectionPolicy::_duplicate (p);
+}
+
+void
+TAO::Objref_Traits<RTCORBA::PriorityBandedConnectionPolicy>::release (
+ RTCORBA::PriorityBandedConnectionPolicy_ptr p
+ )
+{
+ ::CORBA::release (p);
+}
+
+RTCORBA::PriorityBandedConnectionPolicy_ptr
+TAO::Objref_Traits<RTCORBA::PriorityBandedConnectionPolicy>::nil (void)
+{
+ return RTCORBA::PriorityBandedConnectionPolicy::_nil ();
+}
+
+CORBA::Boolean
+TAO::Objref_Traits<RTCORBA::PriorityBandedConnectionPolicy>::marshal (
+ RTCORBA::PriorityBandedConnectionPolicy_ptr p,
+ TAO_OutputCDR & cdr
+ )
+{
+ return CORBA::Object::marshal (p, cdr);
+}
+
+RTCORBA::PriorityBandedConnectionPolicy::PriorityBandedConnectionPolicy (void)
+{}
+
+RTCORBA::PriorityBandedConnectionPolicy::~PriorityBandedConnectionPolicy (void)
+{}
+
+void
+RTCORBA::PriorityBandedConnectionPolicy::_tao_any_destructor (void *_tao_void_pointer)
+{
+ PriorityBandedConnectionPolicy *_tao_tmp_pointer =
+ static_cast<PriorityBandedConnectionPolicy *> (_tao_void_pointer);
+ ::CORBA::release (_tao_tmp_pointer);
+}
+
+RTCORBA::PriorityBandedConnectionPolicy_ptr
+RTCORBA::PriorityBandedConnectionPolicy::_narrow (
+ CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return PriorityBandedConnectionPolicy::_duplicate (
+ dynamic_cast<PriorityBandedConnectionPolicy_ptr> (_tao_objref)
+ );
+}
+
+RTCORBA::PriorityBandedConnectionPolicy_ptr
+RTCORBA::PriorityBandedConnectionPolicy::_unchecked_narrow (
+ CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return PriorityBandedConnectionPolicy::_duplicate (
+ dynamic_cast<PriorityBandedConnectionPolicy_ptr> (_tao_objref)
+ );
+}
+
+RTCORBA::PriorityBandedConnectionPolicy_ptr
+RTCORBA::PriorityBandedConnectionPolicy::_duplicate (PriorityBandedConnectionPolicy_ptr obj)
+{
+ if (! ::CORBA::is_nil (obj))
+ {
+ obj->_add_ref ();
+ }
+
+ return obj;
+}
+
+void
+RTCORBA::PriorityBandedConnectionPolicy::_tao_release (PriorityBandedConnectionPolicy_ptr obj)
+{
+ ::CORBA::release (obj);
+}
+
+CORBA::Boolean
+RTCORBA::PriorityBandedConnectionPolicy::_is_a (
+ const char *value
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ if (
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/Policy:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/RTCORBA/PriorityBandedConnectionPolicy:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/LocalObject:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/Object:1.0"
+ )
+ )
+ {
+ return true; // success using local knowledge
+ }
+ else
+ {
+ return false;
+ }
+}
+
+const char* RTCORBA::PriorityBandedConnectionPolicy::_interface_repository_id (void) const
+{
+ return "IDL:omg.org/RTCORBA/PriorityBandedConnectionPolicy:1.0";
+}
+
+CORBA::Boolean
+RTCORBA::PriorityBandedConnectionPolicy::marshal (TAO_OutputCDR &)
+{
+ return false;
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/interface_cs.cpp:60
+
+// Traits specializations for RTCORBA::Current.
+
+RTCORBA::Current_ptr
+TAO::Objref_Traits<RTCORBA::Current>::duplicate (
+ RTCORBA::Current_ptr p
+ )
+{
+ return RTCORBA::Current::_duplicate (p);
+}
+
+void
+TAO::Objref_Traits<RTCORBA::Current>::release (
+ RTCORBA::Current_ptr p
+ )
+{
+ ::CORBA::release (p);
+}
+
+RTCORBA::Current_ptr
+TAO::Objref_Traits<RTCORBA::Current>::nil (void)
+{
+ return RTCORBA::Current::_nil ();
+}
+
+CORBA::Boolean
+TAO::Objref_Traits<RTCORBA::Current>::marshal (
+ RTCORBA::Current_ptr p,
+ TAO_OutputCDR & cdr
+ )
+{
+ return CORBA::Object::marshal (p, cdr);
+}
+
+RTCORBA::Current::Current (void)
+{}
+
+RTCORBA::Current::~Current (void)
+{}
+
+void
+RTCORBA::Current::_tao_any_destructor (void *_tao_void_pointer)
+{
+ Current *_tao_tmp_pointer =
+ static_cast<Current *> (_tao_void_pointer);
+ ::CORBA::release (_tao_tmp_pointer);
+}
+
+RTCORBA::Current_ptr
+RTCORBA::Current::_narrow (
+ CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return Current::_duplicate (
+ dynamic_cast<Current_ptr> (_tao_objref)
+ );
+}
+
+RTCORBA::Current_ptr
+RTCORBA::Current::_unchecked_narrow (
+ CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return Current::_duplicate (
+ dynamic_cast<Current_ptr> (_tao_objref)
+ );
+}
+
+RTCORBA::Current_ptr
+RTCORBA::Current::_duplicate (Current_ptr obj)
+{
+ if (! ::CORBA::is_nil (obj))
+ {
+ obj->_add_ref ();
+ }
+
+ return obj;
+}
+
+void
+RTCORBA::Current::_tao_release (Current_ptr obj)
+{
+ ::CORBA::release (obj);
+}
+
+CORBA::Boolean
+RTCORBA::Current::_is_a (
+ const char *value
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ if (
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/Current:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/RTCORBA/Current:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/LocalObject:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/Object:1.0"
+ )
+ )
+ {
+ return true; // success using local knowledge
+ }
+ else
+ {
+ return false;
+ }
+}
+
+const char* RTCORBA::Current::_interface_repository_id (void) const
+{
+ return "IDL:omg.org/RTCORBA/Current:1.0";
+}
+
+CORBA::Boolean
+RTCORBA::Current::marshal (TAO_OutputCDR &)
+{
+ return false;
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/interface_cs.cpp:60
+
+// Traits specializations for RTCORBA::Mutex.
+
+RTCORBA::Mutex_ptr
+TAO::Objref_Traits<RTCORBA::Mutex>::duplicate (
+ RTCORBA::Mutex_ptr p
+ )
+{
+ return RTCORBA::Mutex::_duplicate (p);
+}
+
+void
+TAO::Objref_Traits<RTCORBA::Mutex>::release (
+ RTCORBA::Mutex_ptr p
+ )
+{
+ ::CORBA::release (p);
+}
+
+RTCORBA::Mutex_ptr
+TAO::Objref_Traits<RTCORBA::Mutex>::nil (void)
+{
+ return RTCORBA::Mutex::_nil ();
+}
+
+CORBA::Boolean
+TAO::Objref_Traits<RTCORBA::Mutex>::marshal (
+ RTCORBA::Mutex_ptr p,
+ TAO_OutputCDR & cdr
+ )
+{
+ return CORBA::Object::marshal (p, cdr);
+}
+
+RTCORBA::Mutex::Mutex (void)
+{}
+
+RTCORBA::Mutex::~Mutex (void)
+{}
+
+void
+RTCORBA::Mutex::_tao_any_destructor (void *_tao_void_pointer)
+{
+ Mutex *_tao_tmp_pointer =
+ static_cast<Mutex *> (_tao_void_pointer);
+ ::CORBA::release (_tao_tmp_pointer);
+}
+
+RTCORBA::Mutex_ptr
+RTCORBA::Mutex::_narrow (
+ CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return Mutex::_duplicate (
+ dynamic_cast<Mutex_ptr> (_tao_objref)
+ );
+}
+
+RTCORBA::Mutex_ptr
+RTCORBA::Mutex::_unchecked_narrow (
+ CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return Mutex::_duplicate (
+ dynamic_cast<Mutex_ptr> (_tao_objref)
+ );
+}
+
+RTCORBA::Mutex_ptr
+RTCORBA::Mutex::_duplicate (Mutex_ptr obj)
+{
+ if (! ::CORBA::is_nil (obj))
+ {
+ obj->_add_ref ();
+ }
+
+ return obj;
+}
+
+void
+RTCORBA::Mutex::_tao_release (Mutex_ptr obj)
+{
+ ::CORBA::release (obj);
+}
+
+CORBA::Boolean
+RTCORBA::Mutex::_is_a (
+ const char *value
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ if (
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/RTCORBA/Mutex:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/LocalObject:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/Object:1.0"
+ )
+ )
+ {
+ return true; // success using local knowledge
+ }
+ else
+ {
+ return false;
+ }
+}
+
+const char* RTCORBA::Mutex::_interface_repository_id (void) const
+{
+ return "IDL:omg.org/RTCORBA/Mutex:1.0";
+}
+
+CORBA::Boolean
+RTCORBA::Mutex::marshal (TAO_OutputCDR &)
+{
+ return false;
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/interface_cs.cpp:60
+
+// Traits specializations for RTCORBA::RTORB.
+
+RTCORBA::RTORB_ptr
+TAO::Objref_Traits<RTCORBA::RTORB>::duplicate (
+ RTCORBA::RTORB_ptr p
+ )
+{
+ return RTCORBA::RTORB::_duplicate (p);
+}
+
+void
+TAO::Objref_Traits<RTCORBA::RTORB>::release (
+ RTCORBA::RTORB_ptr p
+ )
+{
+ ::CORBA::release (p);
+}
+
+RTCORBA::RTORB_ptr
+TAO::Objref_Traits<RTCORBA::RTORB>::nil (void)
+{
+ return RTCORBA::RTORB::_nil ();
+}
+
+CORBA::Boolean
+TAO::Objref_Traits<RTCORBA::RTORB>::marshal (
+ RTCORBA::RTORB_ptr p,
+ TAO_OutputCDR & cdr
+ )
+{
+ return CORBA::Object::marshal (p, cdr);
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_exception/exception_cs.cpp:63
+
+RTCORBA::RTORB::MutexNotFound::MutexNotFound (void)
+ : CORBA::UserException (
+ "IDL:omg.org/RTCORBA/RTORB/MutexNotFound:1.0",
+ "MutexNotFound"
+ )
+{
+}
+
+RTCORBA::RTORB::MutexNotFound::~MutexNotFound (void)
+{
+}
+
+RTCORBA::RTORB::MutexNotFound::MutexNotFound (const ::RTCORBA::RTORB::MutexNotFound &_tao_excp)
+ : CORBA::UserException (
+ _tao_excp._rep_id (),
+ _tao_excp._name ()
+ )
+{
+}
+
+RTCORBA::RTORB::MutexNotFound&
+RTCORBA::RTORB::MutexNotFound::operator= (const ::RTCORBA::RTORB::MutexNotFound &_tao_excp)
+{
+ this->::CORBA::UserException::operator= (_tao_excp);
+ return *this;
+}
+
+void RTCORBA::RTORB::MutexNotFound::_tao_any_destructor (void *_tao_void_pointer)
+{
+ MutexNotFound *_tao_tmp_pointer =
+ static_cast<MutexNotFound *> (_tao_void_pointer);
+ delete _tao_tmp_pointer;
+}
+
+RTCORBA::RTORB::MutexNotFound *
+RTCORBA::RTORB::MutexNotFound::_downcast (CORBA::Exception *_tao_excp)
+{
+ return dynamic_cast<MutexNotFound *> (_tao_excp);
+}
+
+const RTCORBA::RTORB::MutexNotFound *
+RTCORBA::RTORB::MutexNotFound::_downcast (CORBA::Exception const *_tao_excp)
+{
+ return dynamic_cast<const MutexNotFound *> (_tao_excp);
+}
+
+CORBA::Exception *RTCORBA::RTORB::MutexNotFound::_alloc (void)
+{
+ CORBA::Exception *retval = 0;
+ ACE_NEW_RETURN (retval, ::RTCORBA::RTORB::MutexNotFound, 0);
+ return retval;
+}
+
+CORBA::Exception *
+RTCORBA::RTORB::MutexNotFound::_tao_duplicate (void) const
+{
+ CORBA::Exception *result = 0;
+ ACE_NEW_RETURN (
+ result,
+ ::RTCORBA::RTORB::MutexNotFound (*this),
+ 0
+ );
+ return result;
+}
+
+void RTCORBA::RTORB::MutexNotFound::_raise (void) const
+{
+ TAO_RAISE (*this);
+}
+
+void RTCORBA::RTORB::MutexNotFound::_tao_encode (
+ TAO_OutputCDR &
+ ACE_ENV_ARG_DECL
+ ) const
+{
+ ACE_THROW (CORBA::MARSHAL ());
+}
+
+void RTCORBA::RTORB::MutexNotFound::_tao_decode (
+ TAO_InputCDR &
+ ACE_ENV_ARG_DECL
+ )
+{
+ ACE_THROW (CORBA::MARSHAL ());
+}
+
+// TAO extension - the virtual _type method.
+CORBA::TypeCode_ptr RTCORBA::RTORB::MutexNotFound::_tao_type (void) const
+{
+ return ::RTCORBA::RTORB::_tc_MutexNotFound;
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_exception/exception_cs.cpp:63
+
+RTCORBA::RTORB::InvalidThreadpool::InvalidThreadpool (void)
+ : CORBA::UserException (
+ "IDL:omg.org/RTCORBA/RTORB/InvalidThreadpool:1.0",
+ "InvalidThreadpool"
+ )
+{
+}
+
+RTCORBA::RTORB::InvalidThreadpool::~InvalidThreadpool (void)
+{
+}
+
+RTCORBA::RTORB::InvalidThreadpool::InvalidThreadpool (const ::RTCORBA::RTORB::InvalidThreadpool &_tao_excp)
+ : CORBA::UserException (
+ _tao_excp._rep_id (),
+ _tao_excp._name ()
+ )
+{
+}
+
+RTCORBA::RTORB::InvalidThreadpool&
+RTCORBA::RTORB::InvalidThreadpool::operator= (const ::RTCORBA::RTORB::InvalidThreadpool &_tao_excp)
+{
+ this->::CORBA::UserException::operator= (_tao_excp);
+ return *this;
+}
+
+void RTCORBA::RTORB::InvalidThreadpool::_tao_any_destructor (void *_tao_void_pointer)
+{
+ InvalidThreadpool *_tao_tmp_pointer =
+ static_cast<InvalidThreadpool *> (_tao_void_pointer);
+ delete _tao_tmp_pointer;
+}
+
+RTCORBA::RTORB::InvalidThreadpool *
+RTCORBA::RTORB::InvalidThreadpool::_downcast (CORBA::Exception *_tao_excp)
+{
+ return dynamic_cast<InvalidThreadpool *> (_tao_excp);
+}
+
+const RTCORBA::RTORB::InvalidThreadpool *
+RTCORBA::RTORB::InvalidThreadpool::_downcast (CORBA::Exception const *_tao_excp)
+{
+ return dynamic_cast<const InvalidThreadpool *> (_tao_excp);
+}
+
+CORBA::Exception *RTCORBA::RTORB::InvalidThreadpool::_alloc (void)
+{
+ CORBA::Exception *retval = 0;
+ ACE_NEW_RETURN (retval, ::RTCORBA::RTORB::InvalidThreadpool, 0);
+ return retval;
+}
+
+CORBA::Exception *
+RTCORBA::RTORB::InvalidThreadpool::_tao_duplicate (void) const
+{
+ CORBA::Exception *result = 0;
+ ACE_NEW_RETURN (
+ result,
+ ::RTCORBA::RTORB::InvalidThreadpool (*this),
+ 0
+ );
+ return result;
+}
+
+void RTCORBA::RTORB::InvalidThreadpool::_raise (void) const
+{
+ TAO_RAISE (*this);
+}
+
+void RTCORBA::RTORB::InvalidThreadpool::_tao_encode (
+ TAO_OutputCDR &
+ ACE_ENV_ARG_DECL
+ ) const
+{
+ ACE_THROW (CORBA::MARSHAL ());
+}
+
+void RTCORBA::RTORB::InvalidThreadpool::_tao_decode (
+ TAO_InputCDR &
+ ACE_ENV_ARG_DECL
+ )
+{
+ ACE_THROW (CORBA::MARSHAL ());
+}
+
+// TAO extension - the virtual _type method.
+CORBA::TypeCode_ptr RTCORBA::RTORB::InvalidThreadpool::_tao_type (void) const
+{
+ return ::RTCORBA::RTORB::_tc_InvalidThreadpool;
+}
+
+RTCORBA::RTORB::RTORB (void)
+{}
+
+RTCORBA::RTORB::~RTORB (void)
+{}
+
+void
+RTCORBA::RTORB::_tao_any_destructor (void *_tao_void_pointer)
+{
+ RTORB *_tao_tmp_pointer =
+ static_cast<RTORB *> (_tao_void_pointer);
+ ::CORBA::release (_tao_tmp_pointer);
+}
+
+RTCORBA::RTORB_ptr
+RTCORBA::RTORB::_narrow (
+ CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return RTORB::_duplicate (
+ dynamic_cast<RTORB_ptr> (_tao_objref)
+ );
+}
+
+RTCORBA::RTORB_ptr
+RTCORBA::RTORB::_unchecked_narrow (
+ CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return RTORB::_duplicate (
+ dynamic_cast<RTORB_ptr> (_tao_objref)
+ );
+}
+
+RTCORBA::RTORB_ptr
+RTCORBA::RTORB::_duplicate (RTORB_ptr obj)
+{
+ if (! ::CORBA::is_nil (obj))
+ {
+ obj->_add_ref ();
+ }
+
+ return obj;
+}
+
+void
+RTCORBA::RTORB::_tao_release (RTORB_ptr obj)
+{
+ ::CORBA::release (obj);
+}
+
+CORBA::Boolean
+RTCORBA::RTORB::_is_a (
+ const char *value
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ if (
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/RTCORBA/RTORB:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/LocalObject:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/Object:1.0"
+ )
+ )
+ {
+ return true; // success using local knowledge
+ }
+ else
+ {
+ return false;
+ }
+}
+
+const char* RTCORBA::RTORB::_interface_repository_id (void) const
+{
+ return "IDL:omg.org/RTCORBA/RTORB:1.0";
+}
+
+CORBA::Boolean
+RTCORBA::RTORB::marshal (TAO_OutputCDR &)
+{
+ return false;
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_structure/cdr_op_cs.cpp:61
+
+CORBA::Boolean operator<< (
+ TAO_OutputCDR &strm,
+ const RTCORBA::ThreadpoolLane &_tao_aggregate
+ )
+{
+ return
+ (strm << _tao_aggregate.lane_priority) &&
+ (strm << _tao_aggregate.static_threads) &&
+ (strm << _tao_aggregate.dynamic_threads);
+}
+
+CORBA::Boolean operator>> (
+ TAO_InputCDR &strm,
+ RTCORBA::ThreadpoolLane &_tao_aggregate
+ )
+{
+ return
+ (strm >> _tao_aggregate.lane_priority) &&
+ (strm >> _tao_aggregate.static_threads) &&
+ (strm >> _tao_aggregate.dynamic_threads);
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_sequence/cdr_op_cs.cpp:96
+
+#if !defined _TAO_CDR_OP_RTCORBA_ThreadpoolLanes_CPP_
+#define _TAO_CDR_OP_RTCORBA_ThreadpoolLanes_CPP_
+
+CORBA::Boolean operator<< (
+ TAO_OutputCDR &strm,
+ const RTCORBA::ThreadpoolLanes &_tao_sequence
+ )
+{
+ return TAO::marshal_sequence(strm, _tao_sequence);
+}
+
+CORBA::Boolean operator>> (
+ TAO_InputCDR &strm,
+ RTCORBA::ThreadpoolLanes &_tao_sequence
+ )
+{
+ return TAO::demarshal_sequence(strm, _tao_sequence);
+}
+
+#endif /* _TAO_CDR_OP_RTCORBA_ThreadpoolLanes_CPP_ */
+
+// TAO_IDL - Generated from
+// be\be_visitor_enum/cdr_op_cs.cpp:51
+
+CORBA::Boolean operator<< (TAO_OutputCDR & strm, RTCORBA::PriorityModel _tao_enumerator)
+{
+ return strm << static_cast<CORBA::ULong> (_tao_enumerator);
+}
+
+CORBA::Boolean operator>> (TAO_InputCDR & strm, RTCORBA::PriorityModel & _tao_enumerator)
+{
+ CORBA::ULong _tao_temp = 0;
+ CORBA::Boolean const _tao_success = strm >> _tao_temp;
+
+ if (_tao_success)
+ {
+ _tao_enumerator = static_cast<RTCORBA::PriorityModel> (_tao_temp);
+ }
+
+ return _tao_success;
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_structure/cdr_op_cs.cpp:61
+
+CORBA::Boolean operator<< (
+ TAO_OutputCDR &strm,
+ const RTCORBA::PriorityBand &_tao_aggregate
+ )
+{
+ return
+ (strm << _tao_aggregate.low) &&
+ (strm << _tao_aggregate.high);
+}
+
+CORBA::Boolean operator>> (
+ TAO_InputCDR &strm,
+ RTCORBA::PriorityBand &_tao_aggregate
+ )
+{
+ return
+ (strm >> _tao_aggregate.low) &&
+ (strm >> _tao_aggregate.high);
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_sequence/cdr_op_cs.cpp:96
+
+#if !defined _TAO_CDR_OP_RTCORBA_PriorityBands_CPP_
+#define _TAO_CDR_OP_RTCORBA_PriorityBands_CPP_
+
+CORBA::Boolean operator<< (
+ TAO_OutputCDR &strm,
+ const RTCORBA::PriorityBands &_tao_sequence
+ )
+{
+ const CORBA::ULong _tao_seq_len = _tao_sequence.length ();
+
+ if (strm << _tao_seq_len)
+ {
+ // Encode all elements.
+ CORBA::Boolean _tao_marshal_flag = true;
+
+ for (CORBA::ULong i = 0; i < _tao_seq_len && _tao_marshal_flag; ++i)
+ {
+ _tao_marshal_flag = (strm << _tao_sequence[i]);
+ }
+
+ return _tao_marshal_flag;
+ }
+
+ return false;
+}
+
+CORBA::Boolean operator>> (
+ TAO_InputCDR &strm,
+ RTCORBA::PriorityBands &_tao_sequence
+ )
+{
+ CORBA::ULong _tao_seq_len;
+
+ if (strm >> _tao_seq_len)
+ {
+ // Add a check to the length of the sequence
+ // to make sure it does not exceed the length
+ // of the stream. (See bug 58.)
+ if (_tao_seq_len > strm.length ())
+ {
+ return false;
+ }
+
+ // Set the length of the sequence.
+ _tao_sequence.length (_tao_seq_len);
+
+ // If length is 0 we return true.
+ if (0 >= _tao_seq_len)
+ {
+ return true;
+ }
+
+ // Retrieve all the elements.
+ CORBA::Boolean _tao_marshal_flag = true;
+
+ for (CORBA::ULong i = 0; i < _tao_seq_len && _tao_marshal_flag; ++i)
+ {
+ _tao_marshal_flag = (strm >> _tao_sequence[i]);
+ }
+
+ return _tao_marshal_flag;
+
+ }
+
+ return false;
+}
+
+#endif /* _TAO_CDR_OP_RTCORBA_PriorityBands_CPP_ */
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/RTCORBA/RTCORBAC.h b/TAO/tao/RTCORBA/RTCORBAC.h
new file mode 100644
index 00000000000..51d166c6bcf
--- /dev/null
+++ b/TAO/tao/RTCORBA/RTCORBAC.h
@@ -0,0 +1,3507 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:153
+
+#ifndef _TAO_IDL_ORIG_RTCORBAC_H_
+#define _TAO_IDL_ORIG_RTCORBAC_H_
+
+#include /**/ "ace/pre.h"
+
+
+#include "ace/config-all.h"
+
+#ifndef TAO_RTCORBA_SAFE_INCLUDE
+#error "You should not include RTCORBAC.h directly, use RTCORBA.h"
+#endif /* !TAO_RTCORBA_SAFE_INCLUDE */
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/RTCORBA/rtcorba_export.h"
+#include "tao/RTCORBA/rtcorba_typedefs.h"
+#include "tao/ORB.h"
+#include "tao/TimeBaseC.h"
+#include "tao/SystemException.h"
+#include "tao/Environment.h"
+#include "tao/Object.h"
+#include "tao/Sequence_T.h"
+#include "tao/Objref_VarOut_T.h"
+#include "tao/Seq_Var_T.h"
+#include "tao/Seq_Out_T.h"
+#include "tao/VarOut_T.h"
+
+#include "tao/IOPC.h"
+#include "tao/TimeBaseC.h"
+#include "tao/PolicyC.h"
+
+#if defined (TAO_EXPORT_MACRO)
+#undef TAO_EXPORT_MACRO
+#endif
+#define TAO_EXPORT_MACRO TAO_RTCORBA_Export
+
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+#if defined (__BORLANDC__)
+#pragma option push -w-rvl -w-rch -w-ccc -w-inl
+#endif /* __BORLANDC__ */
+
+// TAO_IDL - Generated from
+// be\be_visitor_module/module_ch.cpp:48
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace RTCORBA
+{
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typedef/typedef_ch.cpp:379
+
+ typedef CORBA::Short NativePriority;
+ typedef CORBA::Short_out NativePriority_out;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:44
+
+ extern TAO_RTCORBA_Export ::CORBA::TypeCode_ptr const _tc_NativePriority;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typedef/typedef_ch.cpp:379
+
+ typedef CORBA::Short Priority;
+ typedef CORBA::Short_out Priority_out;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:44
+
+ extern TAO_RTCORBA_Export ::CORBA::TypeCode_ptr const _tc_Priority;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_constant/constant_ch.cpp:52
+
+ const RTCORBA::Priority minPriority = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_constant/constant_ch.cpp:52
+
+ const RTCORBA::Priority maxPriority = 32767;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typedef/typedef_ch.cpp:379
+
+ typedef CORBA::Long NetworkPriority;
+ typedef CORBA::Long_out NetworkPriority_out;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:44
+
+ extern TAO_RTCORBA_Export ::CORBA::TypeCode_ptr const _tc_NetworkPriority;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typedef/typedef_ch.cpp:379
+
+ typedef CORBA::ULong ThreadpoolId;
+ typedef CORBA::ULong_out ThreadpoolId_out;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:44
+
+ extern TAO_RTCORBA_Export ::CORBA::TypeCode_ptr const _tc_ThreadpoolId;
+
+ // TAO_IDL - Generated from
+ // be\be_type.cpp:258
+
+ struct ThreadpoolLane;
+
+ typedef
+ TAO_Fixed_Var_T<
+ ThreadpoolLane
+ >
+ ThreadpoolLane_var;
+
+ typedef
+ ThreadpoolLane &
+ ThreadpoolLane_out;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_structure/structure_ch.cpp:52
+
+ struct TAO_RTCORBA_Export ThreadpoolLane
+ {
+ typedef ThreadpoolLane_var _var_type;
+
+ static void _tao_any_destructor (void *);
+ RTCORBA::Priority lane_priority;
+ CORBA::ULong static_threads;
+ CORBA::ULong dynamic_threads;
+ };
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:44
+
+ extern TAO_RTCORBA_Export ::CORBA::TypeCode_ptr const _tc_ThreadpoolLane;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_sequence/sequence_ch.cpp:101
+
+#if !defined (_RTCORBA_THREADPOOLLANES_CH_)
+#define _RTCORBA_THREADPOOLLANES_CH_
+
+ class ThreadpoolLanes;
+
+ typedef
+ TAO_FixedSeq_Var_T<
+ ThreadpoolLanes
+ >
+ ThreadpoolLanes_var;
+
+ typedef
+ TAO_Seq_Out_T<
+ ThreadpoolLanes
+ >
+ ThreadpoolLanes_out;
+
+ class TAO_RTCORBA_Export ThreadpoolLanes
+ : public
+ TAO::unbounded_value_sequence<
+ ThreadpoolLane
+ >
+ {
+ public:
+ ThreadpoolLanes (void);
+ ThreadpoolLanes (CORBA::ULong max);
+ ThreadpoolLanes (
+ CORBA::ULong max,
+ CORBA::ULong length,
+ ThreadpoolLane* buffer,
+ CORBA::Boolean release = false
+ );
+ ThreadpoolLanes (const ThreadpoolLanes &);
+ ~ThreadpoolLanes (void);
+
+ static void _tao_any_destructor (void *);
+
+ typedef ThreadpoolLanes_var _var_type;
+ };
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:44
+
+ extern TAO_RTCORBA_Export ::CORBA::TypeCode_ptr const _tc_ThreadpoolLanes;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_constant/constant_ch.cpp:52
+
+ const CORBA::PolicyType PRIORITY_MODEL_POLICY_TYPE = 40U;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_enum/enum_ch.cpp:57
+
+ enum PriorityModel
+ {
+ CLIENT_PROPAGATED,
+ SERVER_DECLARED
+ };
+
+ typedef PriorityModel &PriorityModel_out;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:44
+
+ extern TAO_RTCORBA_Export ::CORBA::TypeCode_ptr const _tc_PriorityModel;
+
+ // TAO_IDL - Generated from
+ // be\be_interface.cpp:598
+
+#if !defined (_RTCORBA_PRIORITYMODELPOLICY__VAR_OUT_CH_)
+#define _RTCORBA_PRIORITYMODELPOLICY__VAR_OUT_CH_
+
+ class PriorityModelPolicy;
+ typedef PriorityModelPolicy *PriorityModelPolicy_ptr;
+
+ typedef
+ TAO_Objref_Var_T<
+ PriorityModelPolicy
+ >
+ PriorityModelPolicy_var;
+
+ typedef
+ TAO_Objref_Out_T<
+ PriorityModelPolicy
+ >
+ PriorityModelPolicy_out;
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:54
+
+#if !defined (_RTCORBA_PRIORITYMODELPOLICY_CH_)
+#define _RTCORBA_PRIORITYMODELPOLICY_CH_
+
+ class TAO_RTCORBA_Export PriorityModelPolicy
+ : public virtual ::CORBA::Policy
+ {
+ public:
+ typedef PriorityModelPolicy_ptr _ptr_type;
+ typedef PriorityModelPolicy_var _var_type;
+
+ // The static operations.
+ static PriorityModelPolicy_ptr _duplicate (PriorityModelPolicy_ptr obj);
+
+ static void _tao_release (PriorityModelPolicy_ptr obj);
+
+ static PriorityModelPolicy_ptr _narrow (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static PriorityModelPolicy_ptr _unchecked_narrow (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static PriorityModelPolicy_ptr _nil (void)
+ {
+ return static_cast<PriorityModelPolicy_ptr> (0);
+ }
+
+ static void _tao_any_destructor (void *);
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual ::RTCORBA::PriorityModel priority_model (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual RTCORBA::Priority server_priority (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual ::CORBA::Policy_ptr copy (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void destroy (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:210
+
+ virtual CORBA::Boolean _is_a (
+ const char *type_id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ virtual const char* _interface_repository_id (void) const;
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+
+ protected:
+ // Abstract or local interface only.
+ PriorityModelPolicy (void);
+
+ virtual ~PriorityModelPolicy (void);
+
+ private:
+ // Private and unimplemented for concrete interfaces.
+ PriorityModelPolicy (const PriorityModelPolicy &);
+
+ void operator= (const PriorityModelPolicy &);
+ };
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:44
+
+ extern TAO_RTCORBA_Export ::CORBA::TypeCode_ptr const _tc_PriorityModelPolicy;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_constant/constant_ch.cpp:52
+
+ const CORBA::PolicyType THREADPOOL_POLICY_TYPE = 41U;
+
+ // TAO_IDL - Generated from
+ // be\be_interface.cpp:598
+
+#if !defined (_RTCORBA_THREADPOOLPOLICY__VAR_OUT_CH_)
+#define _RTCORBA_THREADPOOLPOLICY__VAR_OUT_CH_
+
+ class ThreadpoolPolicy;
+ typedef ThreadpoolPolicy *ThreadpoolPolicy_ptr;
+
+ typedef
+ TAO_Objref_Var_T<
+ ThreadpoolPolicy
+ >
+ ThreadpoolPolicy_var;
+
+ typedef
+ TAO_Objref_Out_T<
+ ThreadpoolPolicy
+ >
+ ThreadpoolPolicy_out;
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:54
+
+#if !defined (_RTCORBA_THREADPOOLPOLICY_CH_)
+#define _RTCORBA_THREADPOOLPOLICY_CH_
+
+ class TAO_RTCORBA_Export ThreadpoolPolicy
+ : public virtual ::CORBA::Policy
+ {
+ public:
+ typedef ThreadpoolPolicy_ptr _ptr_type;
+ typedef ThreadpoolPolicy_var _var_type;
+
+ // The static operations.
+ static ThreadpoolPolicy_ptr _duplicate (ThreadpoolPolicy_ptr obj);
+
+ static void _tao_release (ThreadpoolPolicy_ptr obj);
+
+ static ThreadpoolPolicy_ptr _narrow (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static ThreadpoolPolicy_ptr _unchecked_narrow (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static ThreadpoolPolicy_ptr _nil (void)
+ {
+ return static_cast<ThreadpoolPolicy_ptr> (0);
+ }
+
+ static void _tao_any_destructor (void *);
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual RTCORBA::ThreadpoolId threadpool (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual ::CORBA::Policy_ptr copy (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void destroy (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:210
+
+ virtual CORBA::Boolean _is_a (
+ const char *type_id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ virtual const char* _interface_repository_id (void) const;
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+
+ protected:
+ // Abstract or local interface only.
+ ThreadpoolPolicy (void);
+
+ virtual ~ThreadpoolPolicy (void);
+
+ private:
+ // Private and unimplemented for concrete interfaces.
+ ThreadpoolPolicy (const ThreadpoolPolicy &);
+
+ void operator= (const ThreadpoolPolicy &);
+ };
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:44
+
+ extern TAO_RTCORBA_Export ::CORBA::TypeCode_ptr const _tc_ThreadpoolPolicy;
+
+ // TAO_IDL - Generated from
+ // be\be_interface.cpp:598
+
+#if !defined (_RTCORBA_PROTOCOLPROPERTIES__VAR_OUT_CH_)
+#define _RTCORBA_PROTOCOLPROPERTIES__VAR_OUT_CH_
+
+ class ProtocolProperties;
+ typedef ProtocolProperties *ProtocolProperties_ptr;
+
+ typedef
+ TAO_Objref_Var_T<
+ ProtocolProperties
+ >
+ ProtocolProperties_var;
+
+ typedef
+ TAO_Objref_Out_T<
+ ProtocolProperties
+ >
+ ProtocolProperties_out;
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:54
+
+#if !defined (_RTCORBA_PROTOCOLPROPERTIES_CH_)
+#define _RTCORBA_PROTOCOLPROPERTIES_CH_
+
+ class TAO_RTCORBA_Export ProtocolProperties
+ : public virtual CORBA::Object
+ {
+ public:
+ typedef ProtocolProperties_ptr _ptr_type;
+ typedef ProtocolProperties_var _var_type;
+
+ // The static operations.
+ static ProtocolProperties_ptr _duplicate (ProtocolProperties_ptr obj);
+
+ static void _tao_release (ProtocolProperties_ptr obj);
+
+ static ProtocolProperties_ptr _narrow (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static ProtocolProperties_ptr _unchecked_narrow (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static ProtocolProperties_ptr _nil (void)
+ {
+ return static_cast<ProtocolProperties_ptr> (0);
+ }
+
+ static void _tao_any_destructor (void *);
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:210
+
+ virtual CORBA::Boolean _is_a (
+ const char *type_id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ virtual const char* _interface_repository_id (void) const;
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+
+ // CDR Encoder/Decoder methods. (handcrafted)
+ virtual CORBA::Boolean _tao_encode (TAO_OutputCDR &out_cdr);
+ virtual CORBA::Boolean _tao_decode (TAO_InputCDR &in_cdr);
+ protected:
+ // Abstract or local interface only.
+ ProtocolProperties (void);
+
+ virtual ~ProtocolProperties (void);
+
+ private:
+ // Private and unimplemented for concrete interfaces.
+ ProtocolProperties (const ProtocolProperties &);
+
+ void operator= (const ProtocolProperties &);
+ };
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:44
+
+ extern TAO_RTCORBA_Export ::CORBA::TypeCode_ptr const _tc_ProtocolProperties;
+
+ // TAO_IDL - Generated from
+ // be\be_type.cpp:258
+
+ struct Protocol;
+
+ typedef
+ TAO_Var_Var_T<
+ Protocol
+ >
+ Protocol_var;
+
+ typedef
+ TAO_Out_T<
+ Protocol
+ >
+ Protocol_out;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_structure/structure_ch.cpp:52
+
+ struct TAO_RTCORBA_Export Protocol
+ {
+ typedef Protocol_var _var_type;
+
+ static void _tao_any_destructor (void *);
+ IOP::ProfileId protocol_type;
+ RTCORBA::ProtocolProperties_var orb_protocol_properties;
+ RTCORBA::ProtocolProperties_var transport_protocol_properties;
+ };
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:44
+
+ extern TAO_RTCORBA_Export ::CORBA::TypeCode_ptr const _tc_Protocol;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_sequence/sequence_ch.cpp:101
+
+#if !defined (_RTCORBA_PROTOCOLLIST_CH_)
+#define _RTCORBA_PROTOCOLLIST_CH_
+
+ class ProtocolList;
+
+ typedef
+ TAO_VarSeq_Var_T<
+ ProtocolList
+ >
+ ProtocolList_var;
+
+ typedef
+ TAO_Seq_Out_T<
+ ProtocolList
+ >
+ ProtocolList_out;
+
+ class TAO_RTCORBA_Export ProtocolList
+ : public
+ TAO::unbounded_value_sequence<
+ Protocol
+ >
+ {
+ public:
+ ProtocolList (void);
+ ProtocolList (CORBA::ULong max);
+ ProtocolList (
+ CORBA::ULong max,
+ CORBA::ULong length,
+ Protocol* buffer,
+ CORBA::Boolean release = false
+ );
+ ProtocolList (const ProtocolList &);
+ ~ProtocolList (void);
+
+ static void _tao_any_destructor (void *);
+
+ typedef ProtocolList_var _var_type;
+ };
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:44
+
+ extern TAO_RTCORBA_Export ::CORBA::TypeCode_ptr const _tc_ProtocolList;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_constant/constant_ch.cpp:52
+
+ const CORBA::PolicyType SERVER_PROTOCOL_POLICY_TYPE = 42U;
+
+ // TAO_IDL - Generated from
+ // be\be_interface.cpp:598
+
+#if !defined (_RTCORBA_SERVERPROTOCOLPOLICY__VAR_OUT_CH_)
+#define _RTCORBA_SERVERPROTOCOLPOLICY__VAR_OUT_CH_
+
+ class ServerProtocolPolicy;
+ typedef ServerProtocolPolicy *ServerProtocolPolicy_ptr;
+
+ typedef
+ TAO_Objref_Var_T<
+ ServerProtocolPolicy
+ >
+ ServerProtocolPolicy_var;
+
+ typedef
+ TAO_Objref_Out_T<
+ ServerProtocolPolicy
+ >
+ ServerProtocolPolicy_out;
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:54
+
+#if !defined (_RTCORBA_SERVERPROTOCOLPOLICY_CH_)
+#define _RTCORBA_SERVERPROTOCOLPOLICY_CH_
+
+ class TAO_RTCORBA_Export ServerProtocolPolicy
+ : public virtual ::CORBA::Policy
+ {
+ public:
+ typedef ServerProtocolPolicy_ptr _ptr_type;
+ typedef ServerProtocolPolicy_var _var_type;
+
+ // The static operations.
+ static ServerProtocolPolicy_ptr _duplicate (ServerProtocolPolicy_ptr obj);
+
+ static void _tao_release (ServerProtocolPolicy_ptr obj);
+
+ static ServerProtocolPolicy_ptr _narrow (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static ServerProtocolPolicy_ptr _unchecked_narrow (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static ServerProtocolPolicy_ptr _nil (void)
+ {
+ return static_cast<ServerProtocolPolicy_ptr> (0);
+ }
+
+ static void _tao_any_destructor (void *);
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual ::RTCORBA::ProtocolList * protocols (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual ::CORBA::Policy_ptr copy (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void destroy (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:210
+
+ virtual CORBA::Boolean _is_a (
+ const char *type_id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ virtual const char* _interface_repository_id (void) const;
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+
+ protected:
+ // Abstract or local interface only.
+ ServerProtocolPolicy (void);
+
+ virtual ~ServerProtocolPolicy (void);
+
+ private:
+ // Private and unimplemented for concrete interfaces.
+ ServerProtocolPolicy (const ServerProtocolPolicy &);
+
+ void operator= (const ServerProtocolPolicy &);
+ };
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:44
+
+ extern TAO_RTCORBA_Export ::CORBA::TypeCode_ptr const _tc_ServerProtocolPolicy;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_constant/constant_ch.cpp:52
+
+ const CORBA::PolicyType CLIENT_PROTOCOL_POLICY_TYPE = 43U;
+
+ // TAO_IDL - Generated from
+ // be\be_interface.cpp:598
+
+#if !defined (_RTCORBA_CLIENTPROTOCOLPOLICY__VAR_OUT_CH_)
+#define _RTCORBA_CLIENTPROTOCOLPOLICY__VAR_OUT_CH_
+
+ class ClientProtocolPolicy;
+ typedef ClientProtocolPolicy *ClientProtocolPolicy_ptr;
+
+ typedef
+ TAO_Objref_Var_T<
+ ClientProtocolPolicy
+ >
+ ClientProtocolPolicy_var;
+
+ typedef
+ TAO_Objref_Out_T<
+ ClientProtocolPolicy
+ >
+ ClientProtocolPolicy_out;
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:54
+
+#if !defined (_RTCORBA_CLIENTPROTOCOLPOLICY_CH_)
+#define _RTCORBA_CLIENTPROTOCOLPOLICY_CH_
+
+ class TAO_RTCORBA_Export ClientProtocolPolicy
+ : public virtual ::CORBA::Policy
+ {
+ public:
+ typedef ClientProtocolPolicy_ptr _ptr_type;
+ typedef ClientProtocolPolicy_var _var_type;
+
+ // The static operations.
+ static ClientProtocolPolicy_ptr _duplicate (ClientProtocolPolicy_ptr obj);
+
+ static void _tao_release (ClientProtocolPolicy_ptr obj);
+
+ static ClientProtocolPolicy_ptr _narrow (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static ClientProtocolPolicy_ptr _unchecked_narrow (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static ClientProtocolPolicy_ptr _nil (void)
+ {
+ return static_cast<ClientProtocolPolicy_ptr> (0);
+ }
+
+ static void _tao_any_destructor (void *);
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual ::RTCORBA::ProtocolList * protocols (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual ::CORBA::Policy_ptr copy (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void destroy (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:210
+
+ virtual CORBA::Boolean _is_a (
+ const char *type_id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ virtual const char* _interface_repository_id (void) const;
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+
+ protected:
+ // Abstract or local interface only.
+ ClientProtocolPolicy (void);
+
+ virtual ~ClientProtocolPolicy (void);
+
+ private:
+ // Private and unimplemented for concrete interfaces.
+ ClientProtocolPolicy (const ClientProtocolPolicy &);
+
+ void operator= (const ClientProtocolPolicy &);
+ };
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:44
+
+ extern TAO_RTCORBA_Export ::CORBA::TypeCode_ptr const _tc_ClientProtocolPolicy;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_constant/constant_ch.cpp:52
+
+ const CORBA::PolicyType PRIVATE_CONNECTION_POLICY_TYPE = 44U;
+
+ // TAO_IDL - Generated from
+ // be\be_interface.cpp:598
+
+#if !defined (_RTCORBA_PRIVATECONNECTIONPOLICY__VAR_OUT_CH_)
+#define _RTCORBA_PRIVATECONNECTIONPOLICY__VAR_OUT_CH_
+
+ class PrivateConnectionPolicy;
+ typedef PrivateConnectionPolicy *PrivateConnectionPolicy_ptr;
+
+ typedef
+ TAO_Objref_Var_T<
+ PrivateConnectionPolicy
+ >
+ PrivateConnectionPolicy_var;
+
+ typedef
+ TAO_Objref_Out_T<
+ PrivateConnectionPolicy
+ >
+ PrivateConnectionPolicy_out;
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:54
+
+#if !defined (_RTCORBA_PRIVATECONNECTIONPOLICY_CH_)
+#define _RTCORBA_PRIVATECONNECTIONPOLICY_CH_
+
+ class TAO_RTCORBA_Export PrivateConnectionPolicy
+ : public virtual ::CORBA::Policy
+ {
+ public:
+ typedef PrivateConnectionPolicy_ptr _ptr_type;
+ typedef PrivateConnectionPolicy_var _var_type;
+
+ // The static operations.
+ static PrivateConnectionPolicy_ptr _duplicate (PrivateConnectionPolicy_ptr obj);
+
+ static void _tao_release (PrivateConnectionPolicy_ptr obj);
+
+ static PrivateConnectionPolicy_ptr _narrow (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static PrivateConnectionPolicy_ptr _unchecked_narrow (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static PrivateConnectionPolicy_ptr _nil (void)
+ {
+ return static_cast<PrivateConnectionPolicy_ptr> (0);
+ }
+
+ static void _tao_any_destructor (void *);
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual ::CORBA::Policy_ptr copy (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void destroy (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:210
+
+ virtual CORBA::Boolean _is_a (
+ const char *type_id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ virtual const char* _interface_repository_id (void) const;
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+
+ protected:
+ // Abstract or local interface only.
+ PrivateConnectionPolicy (void);
+
+ virtual ~PrivateConnectionPolicy (void);
+
+ private:
+ // Private and unimplemented for concrete interfaces.
+ PrivateConnectionPolicy (const PrivateConnectionPolicy &);
+
+ void operator= (const PrivateConnectionPolicy &);
+ };
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:44
+
+ extern TAO_RTCORBA_Export ::CORBA::TypeCode_ptr const _tc_PrivateConnectionPolicy;
+
+ // TAO_IDL - Generated from
+ // be\be_interface.cpp:598
+
+#if !defined (_RTCORBA_TCPPROTOCOLPROPERTIES__VAR_OUT_CH_)
+#define _RTCORBA_TCPPROTOCOLPROPERTIES__VAR_OUT_CH_
+
+ class TCPProtocolProperties;
+ typedef TCPProtocolProperties *TCPProtocolProperties_ptr;
+
+ typedef
+ TAO_Objref_Var_T<
+ TCPProtocolProperties
+ >
+ TCPProtocolProperties_var;
+
+ typedef
+ TAO_Objref_Out_T<
+ TCPProtocolProperties
+ >
+ TCPProtocolProperties_out;
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:54
+
+#if !defined (_RTCORBA_TCPPROTOCOLPROPERTIES_CH_)
+#define _RTCORBA_TCPPROTOCOLPROPERTIES_CH_
+
+ class TAO_RTCORBA_Export TCPProtocolProperties
+ : public virtual ::RTCORBA::ProtocolProperties
+ {
+ public:
+ typedef TCPProtocolProperties_ptr _ptr_type;
+ typedef TCPProtocolProperties_var _var_type;
+
+ // The static operations.
+ static TCPProtocolProperties_ptr _duplicate (TCPProtocolProperties_ptr obj);
+
+ static void _tao_release (TCPProtocolProperties_ptr obj);
+
+ static TCPProtocolProperties_ptr _narrow (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static TCPProtocolProperties_ptr _unchecked_narrow (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static TCPProtocolProperties_ptr _nil (void)
+ {
+ return static_cast<TCPProtocolProperties_ptr> (0);
+ }
+
+ static void _tao_any_destructor (void *);
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual CORBA::Long send_buffer_size (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void send_buffer_size (
+ ::CORBA::Long send_buffer_size
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual CORBA::Long recv_buffer_size (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void recv_buffer_size (
+ ::CORBA::Long recv_buffer_size
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual CORBA::Boolean keep_alive (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void keep_alive (
+ ::CORBA::Boolean keep_alive
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual CORBA::Boolean dont_route (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void dont_route (
+ ::CORBA::Boolean dont_route
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual CORBA::Boolean no_delay (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void no_delay (
+ ::CORBA::Boolean no_delay
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual CORBA::Boolean enable_network_priority (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void enable_network_priority (
+ ::CORBA::Boolean enable_network_priority
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:210
+
+ virtual CORBA::Boolean _is_a (
+ const char *type_id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ virtual const char* _interface_repository_id (void) const;
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+
+ protected:
+ // Abstract or local interface only.
+ TCPProtocolProperties (void);
+
+ virtual ~TCPProtocolProperties (void);
+
+ private:
+ // Private and unimplemented for concrete interfaces.
+ TCPProtocolProperties (const TCPProtocolProperties &);
+
+ void operator= (const TCPProtocolProperties &);
+ };
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:44
+
+ extern TAO_RTCORBA_Export ::CORBA::TypeCode_ptr const _tc_TCPProtocolProperties;
+
+ // TAO_IDL - Generated from
+ // be\be_interface.cpp:598
+
+#if !defined (_RTCORBA_GIOPPROTOCOLPROPERTIES__VAR_OUT_CH_)
+#define _RTCORBA_GIOPPROTOCOLPROPERTIES__VAR_OUT_CH_
+
+ class GIOPProtocolProperties;
+ typedef GIOPProtocolProperties *GIOPProtocolProperties_ptr;
+
+ typedef
+ TAO_Objref_Var_T<
+ GIOPProtocolProperties
+ >
+ GIOPProtocolProperties_var;
+
+ typedef
+ TAO_Objref_Out_T<
+ GIOPProtocolProperties
+ >
+ GIOPProtocolProperties_out;
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:54
+
+#if !defined (_RTCORBA_GIOPPROTOCOLPROPERTIES_CH_)
+#define _RTCORBA_GIOPPROTOCOLPROPERTIES_CH_
+
+ class TAO_RTCORBA_Export GIOPProtocolProperties
+ : public virtual ::RTCORBA::ProtocolProperties
+ {
+ public:
+ typedef GIOPProtocolProperties_ptr _ptr_type;
+ typedef GIOPProtocolProperties_var _var_type;
+
+ // The static operations.
+ static GIOPProtocolProperties_ptr _duplicate (GIOPProtocolProperties_ptr obj);
+
+ static void _tao_release (GIOPProtocolProperties_ptr obj);
+
+ static GIOPProtocolProperties_ptr _narrow (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static GIOPProtocolProperties_ptr _unchecked_narrow (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static GIOPProtocolProperties_ptr _nil (void)
+ {
+ return static_cast<GIOPProtocolProperties_ptr> (0);
+ }
+
+ static void _tao_any_destructor (void *);
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:210
+
+ virtual CORBA::Boolean _is_a (
+ const char *type_id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ virtual const char* _interface_repository_id (void) const;
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+
+ protected:
+ // Abstract or local interface only.
+ GIOPProtocolProperties (void);
+
+ virtual ~GIOPProtocolProperties (void);
+
+ private:
+ // Private and unimplemented for concrete interfaces.
+ GIOPProtocolProperties (const GIOPProtocolProperties &);
+
+ void operator= (const GIOPProtocolProperties &);
+ };
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:44
+
+ extern TAO_RTCORBA_Export ::CORBA::TypeCode_ptr const _tc_GIOPProtocolProperties;
+
+ // TAO_IDL - Generated from
+ // be\be_interface.cpp:598
+
+#if !defined (_RTCORBA_UNIXDOMAINPROTOCOLPROPERTIES__VAR_OUT_CH_)
+#define _RTCORBA_UNIXDOMAINPROTOCOLPROPERTIES__VAR_OUT_CH_
+
+ class UnixDomainProtocolProperties;
+ typedef UnixDomainProtocolProperties *UnixDomainProtocolProperties_ptr;
+
+ typedef
+ TAO_Objref_Var_T<
+ UnixDomainProtocolProperties
+ >
+ UnixDomainProtocolProperties_var;
+
+ typedef
+ TAO_Objref_Out_T<
+ UnixDomainProtocolProperties
+ >
+ UnixDomainProtocolProperties_out;
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:54
+
+#if !defined (_RTCORBA_UNIXDOMAINPROTOCOLPROPERTIES_CH_)
+#define _RTCORBA_UNIXDOMAINPROTOCOLPROPERTIES_CH_
+
+ class TAO_RTCORBA_Export UnixDomainProtocolProperties
+ : public virtual ::RTCORBA::ProtocolProperties
+ {
+ public:
+ typedef UnixDomainProtocolProperties_ptr _ptr_type;
+ typedef UnixDomainProtocolProperties_var _var_type;
+
+ // The static operations.
+ static UnixDomainProtocolProperties_ptr _duplicate (UnixDomainProtocolProperties_ptr obj);
+
+ static void _tao_release (UnixDomainProtocolProperties_ptr obj);
+
+ static UnixDomainProtocolProperties_ptr _narrow (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static UnixDomainProtocolProperties_ptr _unchecked_narrow (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static UnixDomainProtocolProperties_ptr _nil (void)
+ {
+ return static_cast<UnixDomainProtocolProperties_ptr> (0);
+ }
+
+ static void _tao_any_destructor (void *);
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual CORBA::Long send_buffer_size (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void send_buffer_size (
+ ::CORBA::Long send_buffer_size
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual CORBA::Long recv_buffer_size (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void recv_buffer_size (
+ ::CORBA::Long recv_buffer_size
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:210
+
+ virtual CORBA::Boolean _is_a (
+ const char *type_id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ virtual const char* _interface_repository_id (void) const;
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+
+ protected:
+ // Abstract or local interface only.
+ UnixDomainProtocolProperties (void);
+
+ virtual ~UnixDomainProtocolProperties (void);
+
+ private:
+ // Private and unimplemented for concrete interfaces.
+ UnixDomainProtocolProperties (const UnixDomainProtocolProperties &);
+
+ void operator= (const UnixDomainProtocolProperties &);
+ };
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:44
+
+ extern TAO_RTCORBA_Export ::CORBA::TypeCode_ptr const _tc_UnixDomainProtocolProperties;
+
+ // TAO_IDL - Generated from
+ // be\be_interface.cpp:598
+
+#if !defined (_RTCORBA_SHAREDMEMORYPROTOCOLPROPERTIES__VAR_OUT_CH_)
+#define _RTCORBA_SHAREDMEMORYPROTOCOLPROPERTIES__VAR_OUT_CH_
+
+ class SharedMemoryProtocolProperties;
+ typedef SharedMemoryProtocolProperties *SharedMemoryProtocolProperties_ptr;
+
+ typedef
+ TAO_Objref_Var_T<
+ SharedMemoryProtocolProperties
+ >
+ SharedMemoryProtocolProperties_var;
+
+ typedef
+ TAO_Objref_Out_T<
+ SharedMemoryProtocolProperties
+ >
+ SharedMemoryProtocolProperties_out;
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:54
+
+#if !defined (_RTCORBA_SHAREDMEMORYPROTOCOLPROPERTIES_CH_)
+#define _RTCORBA_SHAREDMEMORYPROTOCOLPROPERTIES_CH_
+
+ class TAO_RTCORBA_Export SharedMemoryProtocolProperties
+ : public virtual ::RTCORBA::ProtocolProperties
+ {
+ public:
+ typedef SharedMemoryProtocolProperties_ptr _ptr_type;
+ typedef SharedMemoryProtocolProperties_var _var_type;
+
+ // The static operations.
+ static SharedMemoryProtocolProperties_ptr _duplicate (SharedMemoryProtocolProperties_ptr obj);
+
+ static void _tao_release (SharedMemoryProtocolProperties_ptr obj);
+
+ static SharedMemoryProtocolProperties_ptr _narrow (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static SharedMemoryProtocolProperties_ptr _unchecked_narrow (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static SharedMemoryProtocolProperties_ptr _nil (void)
+ {
+ return static_cast<SharedMemoryProtocolProperties_ptr> (0);
+ }
+
+ static void _tao_any_destructor (void *);
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual CORBA::Long send_buffer_size (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void send_buffer_size (
+ ::CORBA::Long send_buffer_size
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual CORBA::Long recv_buffer_size (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void recv_buffer_size (
+ ::CORBA::Long recv_buffer_size
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual CORBA::Boolean keep_alive (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void keep_alive (
+ ::CORBA::Boolean keep_alive
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual CORBA::Boolean dont_route (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void dont_route (
+ ::CORBA::Boolean dont_route
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual CORBA::Boolean no_delay (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void no_delay (
+ ::CORBA::Boolean no_delay
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual CORBA::Long preallocate_buffer_size (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void preallocate_buffer_size (
+ ::CORBA::Long preallocate_buffer_size
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual char * mmap_filename (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void mmap_filename (
+ const char * mmap_filename
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual char * mmap_lockname (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void mmap_lockname (
+ const char * mmap_lockname
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:210
+
+ virtual CORBA::Boolean _is_a (
+ const char *type_id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ virtual const char* _interface_repository_id (void) const;
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+
+ protected:
+ // Abstract or local interface only.
+ SharedMemoryProtocolProperties (void);
+
+ virtual ~SharedMemoryProtocolProperties (void);
+
+ private:
+ // Private and unimplemented for concrete interfaces.
+ SharedMemoryProtocolProperties (const SharedMemoryProtocolProperties &);
+
+ void operator= (const SharedMemoryProtocolProperties &);
+ };
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:44
+
+ extern TAO_RTCORBA_Export ::CORBA::TypeCode_ptr const _tc_SharedMemoryProtocolProperties;
+
+ // TAO_IDL - Generated from
+ // be\be_interface.cpp:598
+
+#if !defined (_RTCORBA_USERDATAGRAMPROTOCOLPROPERTIES__VAR_OUT_CH_)
+#define _RTCORBA_USERDATAGRAMPROTOCOLPROPERTIES__VAR_OUT_CH_
+
+ class UserDatagramProtocolProperties;
+ typedef UserDatagramProtocolProperties *UserDatagramProtocolProperties_ptr;
+
+ typedef
+ TAO_Objref_Var_T<
+ UserDatagramProtocolProperties
+ >
+ UserDatagramProtocolProperties_var;
+
+ typedef
+ TAO_Objref_Out_T<
+ UserDatagramProtocolProperties
+ >
+ UserDatagramProtocolProperties_out;
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:54
+
+#if !defined (_RTCORBA_USERDATAGRAMPROTOCOLPROPERTIES_CH_)
+#define _RTCORBA_USERDATAGRAMPROTOCOLPROPERTIES_CH_
+
+ class TAO_RTCORBA_Export UserDatagramProtocolProperties
+ : public virtual ::RTCORBA::ProtocolProperties
+ {
+ public:
+ typedef UserDatagramProtocolProperties_ptr _ptr_type;
+ typedef UserDatagramProtocolProperties_var _var_type;
+
+ // The static operations.
+ static UserDatagramProtocolProperties_ptr _duplicate (UserDatagramProtocolProperties_ptr obj);
+
+ static void _tao_release (UserDatagramProtocolProperties_ptr obj);
+
+ static UserDatagramProtocolProperties_ptr _narrow (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static UserDatagramProtocolProperties_ptr _unchecked_narrow (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static UserDatagramProtocolProperties_ptr _nil (void)
+ {
+ return static_cast<UserDatagramProtocolProperties_ptr> (0);
+ }
+
+ static void _tao_any_destructor (void *);
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual CORBA::Boolean enable_network_priority (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void enable_network_priority (
+ ::CORBA::Boolean enable_network_priority
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:210
+
+ virtual CORBA::Boolean _is_a (
+ const char *type_id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ virtual const char* _interface_repository_id (void) const;
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+
+ protected:
+ // Abstract or local interface only.
+ UserDatagramProtocolProperties (void);
+
+ virtual ~UserDatagramProtocolProperties (void);
+
+ private:
+ // Private and unimplemented for concrete interfaces.
+ UserDatagramProtocolProperties (const UserDatagramProtocolProperties &);
+
+ void operator= (const UserDatagramProtocolProperties &);
+ };
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:44
+
+ extern TAO_RTCORBA_Export ::CORBA::TypeCode_ptr const _tc_UserDatagramProtocolProperties;
+
+ // TAO_IDL - Generated from
+ // be\be_interface.cpp:598
+
+#if !defined (_RTCORBA_STREAMCONTROLPROTOCOLPROPERTIES__VAR_OUT_CH_)
+#define _RTCORBA_STREAMCONTROLPROTOCOLPROPERTIES__VAR_OUT_CH_
+
+ class StreamControlProtocolProperties;
+ typedef StreamControlProtocolProperties *StreamControlProtocolProperties_ptr;
+
+ typedef
+ TAO_Objref_Var_T<
+ StreamControlProtocolProperties
+ >
+ StreamControlProtocolProperties_var;
+
+ typedef
+ TAO_Objref_Out_T<
+ StreamControlProtocolProperties
+ >
+ StreamControlProtocolProperties_out;
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:54
+
+#if !defined (_RTCORBA_STREAMCONTROLPROTOCOLPROPERTIES_CH_)
+#define _RTCORBA_STREAMCONTROLPROTOCOLPROPERTIES_CH_
+
+ class TAO_RTCORBA_Export StreamControlProtocolProperties
+ : public virtual ::RTCORBA::ProtocolProperties
+ {
+ public:
+ typedef StreamControlProtocolProperties_ptr _ptr_type;
+ typedef StreamControlProtocolProperties_var _var_type;
+
+ // The static operations.
+ static StreamControlProtocolProperties_ptr _duplicate (StreamControlProtocolProperties_ptr obj);
+
+ static void _tao_release (StreamControlProtocolProperties_ptr obj);
+
+ static StreamControlProtocolProperties_ptr _narrow (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static StreamControlProtocolProperties_ptr _unchecked_narrow (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static StreamControlProtocolProperties_ptr _nil (void)
+ {
+ return static_cast<StreamControlProtocolProperties_ptr> (0);
+ }
+
+ static void _tao_any_destructor (void *);
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual CORBA::Long send_buffer_size (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void send_buffer_size (
+ ::CORBA::Long send_buffer_size
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual CORBA::Long recv_buffer_size (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void recv_buffer_size (
+ ::CORBA::Long recv_buffer_size
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual CORBA::Boolean keep_alive (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void keep_alive (
+ ::CORBA::Boolean keep_alive
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual CORBA::Boolean dont_route (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void dont_route (
+ ::CORBA::Boolean dont_route
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual CORBA::Boolean no_delay (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void no_delay (
+ ::CORBA::Boolean no_delay
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual CORBA::Boolean enable_network_priority (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void enable_network_priority (
+ ::CORBA::Boolean enable_network_priority
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:210
+
+ virtual CORBA::Boolean _is_a (
+ const char *type_id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ virtual const char* _interface_repository_id (void) const;
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+
+ protected:
+ // Abstract or local interface only.
+ StreamControlProtocolProperties (void);
+
+ virtual ~StreamControlProtocolProperties (void);
+
+ private:
+ // Private and unimplemented for concrete interfaces.
+ StreamControlProtocolProperties (const StreamControlProtocolProperties &);
+
+ void operator= (const StreamControlProtocolProperties &);
+ };
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:44
+
+ extern TAO_RTCORBA_Export ::CORBA::TypeCode_ptr const _tc_StreamControlProtocolProperties;
+
+ // TAO_IDL - Generated from
+ // be\be_type.cpp:258
+
+ struct PriorityBand;
+
+ typedef
+ TAO_Fixed_Var_T<
+ PriorityBand
+ >
+ PriorityBand_var;
+
+ typedef
+ PriorityBand &
+ PriorityBand_out;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_structure/structure_ch.cpp:52
+
+ struct TAO_RTCORBA_Export PriorityBand
+ {
+ typedef PriorityBand_var _var_type;
+
+ static void _tao_any_destructor (void *);
+ RTCORBA::Priority low;
+ RTCORBA::Priority high;
+ };
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:44
+
+ extern TAO_RTCORBA_Export ::CORBA::TypeCode_ptr const _tc_PriorityBand;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_sequence/sequence_ch.cpp:101
+
+#if !defined (_RTCORBA_PRIORITYBANDS_CH_)
+#define _RTCORBA_PRIORITYBANDS_CH_
+
+ class PriorityBands;
+
+ typedef
+ TAO_FixedSeq_Var_T<
+ PriorityBands
+ >
+ PriorityBands_var;
+
+ typedef
+ TAO_Seq_Out_T<
+ PriorityBands
+ >
+ PriorityBands_out;
+
+ class TAO_RTCORBA_Export PriorityBands
+ : public
+ TAO::unbounded_value_sequence<
+ PriorityBand
+ >
+ {
+ public:
+ PriorityBands (void);
+ PriorityBands (CORBA::ULong max);
+ PriorityBands (
+ CORBA::ULong max,
+ CORBA::ULong length,
+ PriorityBand* buffer,
+ CORBA::Boolean release = false
+ );
+ PriorityBands (const PriorityBands &);
+ ~PriorityBands (void);
+
+ static void _tao_any_destructor (void *);
+
+ typedef PriorityBands_var _var_type;
+ };
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:44
+
+ extern TAO_RTCORBA_Export ::CORBA::TypeCode_ptr const _tc_PriorityBands;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_constant/constant_ch.cpp:52
+
+ const CORBA::PolicyType PRIORITY_BANDED_CONNECTION_POLICY_TYPE = 45U;
+
+ // TAO_IDL - Generated from
+ // be\be_interface.cpp:598
+
+#if !defined (_RTCORBA_PRIORITYBANDEDCONNECTIONPOLICY__VAR_OUT_CH_)
+#define _RTCORBA_PRIORITYBANDEDCONNECTIONPOLICY__VAR_OUT_CH_
+
+ class PriorityBandedConnectionPolicy;
+ typedef PriorityBandedConnectionPolicy *PriorityBandedConnectionPolicy_ptr;
+
+ typedef
+ TAO_Objref_Var_T<
+ PriorityBandedConnectionPolicy
+ >
+ PriorityBandedConnectionPolicy_var;
+
+ typedef
+ TAO_Objref_Out_T<
+ PriorityBandedConnectionPolicy
+ >
+ PriorityBandedConnectionPolicy_out;
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:54
+
+#if !defined (_RTCORBA_PRIORITYBANDEDCONNECTIONPOLICY_CH_)
+#define _RTCORBA_PRIORITYBANDEDCONNECTIONPOLICY_CH_
+
+ class TAO_RTCORBA_Export PriorityBandedConnectionPolicy
+ : public virtual ::CORBA::Policy
+ {
+ public:
+ typedef PriorityBandedConnectionPolicy_ptr _ptr_type;
+ typedef PriorityBandedConnectionPolicy_var _var_type;
+
+ // The static operations.
+ static PriorityBandedConnectionPolicy_ptr _duplicate (PriorityBandedConnectionPolicy_ptr obj);
+
+ static void _tao_release (PriorityBandedConnectionPolicy_ptr obj);
+
+ static PriorityBandedConnectionPolicy_ptr _narrow (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static PriorityBandedConnectionPolicy_ptr _unchecked_narrow (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static PriorityBandedConnectionPolicy_ptr _nil (void)
+ {
+ return static_cast<PriorityBandedConnectionPolicy_ptr> (0);
+ }
+
+ static void _tao_any_destructor (void *);
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual ::RTCORBA::PriorityBands * priority_bands (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual ::CORBA::Policy_ptr copy (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void destroy (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:210
+
+ virtual CORBA::Boolean _is_a (
+ const char *type_id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ virtual const char* _interface_repository_id (void) const;
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+
+ protected:
+ // Abstract or local interface only.
+ PriorityBandedConnectionPolicy (void);
+
+ virtual ~PriorityBandedConnectionPolicy (void);
+
+ private:
+ // Private and unimplemented for concrete interfaces.
+ PriorityBandedConnectionPolicy (const PriorityBandedConnectionPolicy &);
+
+ void operator= (const PriorityBandedConnectionPolicy &);
+ };
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:44
+
+ extern TAO_RTCORBA_Export ::CORBA::TypeCode_ptr const _tc_PriorityBandedConnectionPolicy;
+
+ // TAO_IDL - Generated from
+ // be\be_interface.cpp:598
+
+#if !defined (_RTCORBA_CURRENT__VAR_OUT_CH_)
+#define _RTCORBA_CURRENT__VAR_OUT_CH_
+
+ class Current;
+ typedef Current *Current_ptr;
+
+ typedef
+ TAO_Objref_Var_T<
+ Current
+ >
+ Current_var;
+
+ typedef
+ TAO_Objref_Out_T<
+ Current
+ >
+ Current_out;
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:54
+
+#if !defined (_RTCORBA_CURRENT_CH_)
+#define _RTCORBA_CURRENT_CH_
+
+ class TAO_RTCORBA_Export Current
+ : public virtual ::CORBA::Current
+ {
+ public:
+ typedef Current_ptr _ptr_type;
+ typedef Current_var _var_type;
+
+ // The static operations.
+ static Current_ptr _duplicate (Current_ptr obj);
+
+ static void _tao_release (Current_ptr obj);
+
+ static Current_ptr _narrow (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static Current_ptr _unchecked_narrow (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static Current_ptr _nil (void)
+ {
+ return static_cast<Current_ptr> (0);
+ }
+
+ static void _tao_any_destructor (void *);
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual RTCORBA::Priority the_priority (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void the_priority (
+ ::RTCORBA::Priority the_priority
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:210
+
+ virtual CORBA::Boolean _is_a (
+ const char *type_id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ virtual const char* _interface_repository_id (void) const;
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+
+ protected:
+ // Abstract or local interface only.
+ Current (void);
+
+ virtual ~Current (void);
+
+ private:
+ // Private and unimplemented for concrete interfaces.
+ Current (const Current &);
+
+ void operator= (const Current &);
+ };
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:44
+
+ extern TAO_RTCORBA_Export ::CORBA::TypeCode_ptr const _tc_Current;
+
+ // TAO_IDL - Generated from
+ // be\be_interface.cpp:598
+
+#if !defined (_RTCORBA_MUTEX__VAR_OUT_CH_)
+#define _RTCORBA_MUTEX__VAR_OUT_CH_
+
+ class Mutex;
+ typedef Mutex *Mutex_ptr;
+
+ typedef
+ TAO_Objref_Var_T<
+ Mutex
+ >
+ Mutex_var;
+
+ typedef
+ TAO_Objref_Out_T<
+ Mutex
+ >
+ Mutex_out;
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:54
+
+#if !defined (_RTCORBA_MUTEX_CH_)
+#define _RTCORBA_MUTEX_CH_
+
+ class TAO_RTCORBA_Export Mutex
+ : public virtual CORBA::Object
+ {
+ public:
+ typedef Mutex_ptr _ptr_type;
+ typedef Mutex_var _var_type;
+
+ // The static operations.
+ static Mutex_ptr _duplicate (Mutex_ptr obj);
+
+ static void _tao_release (Mutex_ptr obj);
+
+ static Mutex_ptr _narrow (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static Mutex_ptr _unchecked_narrow (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static Mutex_ptr _nil (void)
+ {
+ return static_cast<Mutex_ptr> (0);
+ }
+
+ static void _tao_any_destructor (void *);
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void lock (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void unlock (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual CORBA::Boolean try_lock (
+ ::TimeBase::TimeT max_wait
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:210
+
+ virtual CORBA::Boolean _is_a (
+ const char *type_id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ virtual const char* _interface_repository_id (void) const;
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+
+ protected:
+ // Abstract or local interface only.
+ Mutex (void);
+
+ virtual ~Mutex (void);
+
+ private:
+ // Private and unimplemented for concrete interfaces.
+ Mutex (const Mutex &);
+
+ void operator= (const Mutex &);
+ };
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:44
+
+ extern TAO_RTCORBA_Export ::CORBA::TypeCode_ptr const _tc_Mutex;
+
+ // TAO_IDL - Generated from
+ // be\be_interface.cpp:598
+
+#if !defined (_RTCORBA_RTORB__VAR_OUT_CH_)
+#define _RTCORBA_RTORB__VAR_OUT_CH_
+
+ class RTORB;
+ typedef RTORB *RTORB_ptr;
+
+ typedef
+ TAO_Objref_Var_T<
+ RTORB
+ >
+ RTORB_var;
+
+ typedef
+ TAO_Objref_Out_T<
+ RTORB
+ >
+ RTORB_out;
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:54
+
+#if !defined (_RTCORBA_RTORB_CH_)
+#define _RTCORBA_RTORB_CH_
+
+ class TAO_RTCORBA_Export RTORB
+ : public virtual CORBA::Object
+ {
+ public:
+ typedef RTORB_ptr _ptr_type;
+ typedef RTORB_var _var_type;
+
+ // The static operations.
+ static RTORB_ptr _duplicate (RTORB_ptr obj);
+
+ static void _tao_release (RTORB_ptr obj);
+
+ static RTORB_ptr _narrow (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static RTORB_ptr _unchecked_narrow (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static RTORB_ptr _nil (void)
+ {
+ return static_cast<RTORB_ptr> (0);
+ }
+
+ static void _tao_any_destructor (void *);
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual ::RTCORBA::Mutex_ptr create_mutex (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void destroy_mutex (
+ ::RTCORBA::Mutex_ptr the_mutex
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_exception/exception_ch.cpp:53
+
+#if !defined (_RTCORBA_RTORB_MUTEXNOTFOUND_CH_)
+#define _RTCORBA_RTORB_MUTEXNOTFOUND_CH_
+
+ class TAO_RTCORBA_Export MutexNotFound : public CORBA::UserException
+ {
+ public:
+
+ MutexNotFound (void);
+ MutexNotFound (const MutexNotFound &);
+ ~MutexNotFound (void);
+
+ MutexNotFound &operator= (const MutexNotFound &);
+
+ static void _tao_any_destructor (void *);
+
+ static MutexNotFound *_downcast (CORBA::Exception *);
+ static const MutexNotFound *_downcast (CORBA::Exception const *);
+
+ static CORBA::Exception *_alloc (void);
+
+ virtual CORBA::Exception *_tao_duplicate (void) const;
+
+ virtual void _raise (void) const;
+
+ virtual void _tao_encode (
+ TAO_OutputCDR &
+ ACE_ENV_ARG_DECL
+ ) const;
+
+ virtual void _tao_decode (
+ TAO_InputCDR &
+ ACE_ENV_ARG_DECL
+ );
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_exception/exception_ch.cpp:129
+
+ virtual CORBA::TypeCode_ptr _tao_type (void) const;
+ };
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:44
+
+ static ::CORBA::TypeCode_ptr const _tc_MutexNotFound;
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual ::RTCORBA::Mutex_ptr create_named_mutex (
+ const char * name,
+ ::CORBA::Boolean_out created_flag
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual ::RTCORBA::Mutex_ptr open_named_mutex (
+ const char * name
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ ::RTCORBA::RTORB::MutexNotFound
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual ::RTCORBA::TCPProtocolProperties_ptr create_tcp_protocol_properties (
+ ::CORBA::Long send_buffer_size,
+ ::CORBA::Long recv_buffer_size,
+ ::CORBA::Boolean keep_alive,
+ ::CORBA::Boolean dont_route,
+ ::CORBA::Boolean no_delay,
+ ::CORBA::Boolean enable_network_priority
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual ::RTCORBA::UnixDomainProtocolProperties_ptr create_unix_domain_protocol_properties (
+ ::CORBA::Long send_buffer_size,
+ ::CORBA::Long recv_buffer_size
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual ::RTCORBA::SharedMemoryProtocolProperties_ptr create_shared_memory_protocol_properties (
+ ::CORBA::Long send_buffer_size,
+ ::CORBA::Long recv_buffer_size,
+ ::CORBA::Boolean keep_alive,
+ ::CORBA::Boolean dont_route,
+ ::CORBA::Boolean no_delay,
+ ::CORBA::Long preallocate_buffer_size,
+ const char * mmap_filename,
+ const char * mmap_lockname
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual ::RTCORBA::UserDatagramProtocolProperties_ptr create_user_datagram_protocol_properties (
+ ::CORBA::Boolean enable_network_priority
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual ::RTCORBA::StreamControlProtocolProperties_ptr create_stream_control_protocol_properties (
+ ::CORBA::Long send_buffer_size,
+ ::CORBA::Long recv_buffer_size,
+ ::CORBA::Boolean keep_alive,
+ ::CORBA::Boolean dont_route,
+ ::CORBA::Boolean no_delay,
+ ::CORBA::Boolean enable_network_priority
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_exception/exception_ch.cpp:53
+
+#if !defined (_RTCORBA_RTORB_INVALIDTHREADPOOL_CH_)
+#define _RTCORBA_RTORB_INVALIDTHREADPOOL_CH_
+
+ class TAO_RTCORBA_Export InvalidThreadpool : public CORBA::UserException
+ {
+ public:
+
+ InvalidThreadpool (void);
+ InvalidThreadpool (const InvalidThreadpool &);
+ ~InvalidThreadpool (void);
+
+ InvalidThreadpool &operator= (const InvalidThreadpool &);
+
+ static void _tao_any_destructor (void *);
+
+ static InvalidThreadpool *_downcast (CORBA::Exception *);
+ static const InvalidThreadpool *_downcast (CORBA::Exception const *);
+
+ static CORBA::Exception *_alloc (void);
+
+ virtual CORBA::Exception *_tao_duplicate (void) const;
+
+ virtual void _raise (void) const;
+
+ virtual void _tao_encode (
+ TAO_OutputCDR &
+ ACE_ENV_ARG_DECL
+ ) const;
+
+ virtual void _tao_decode (
+ TAO_InputCDR &
+ ACE_ENV_ARG_DECL
+ );
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_exception/exception_ch.cpp:129
+
+ virtual CORBA::TypeCode_ptr _tao_type (void) const;
+ };
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:44
+
+ static ::CORBA::TypeCode_ptr const _tc_InvalidThreadpool;
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual RTCORBA::ThreadpoolId create_threadpool (
+ ::CORBA::ULong stacksize,
+ ::CORBA::ULong static_threads,
+ ::CORBA::ULong dynamic_threads,
+ ::RTCORBA::Priority default_priority,
+ ::CORBA::Boolean allow_request_buffering,
+ ::CORBA::ULong max_buffered_requests,
+ ::CORBA::ULong max_request_buffer_size
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual RTCORBA::ThreadpoolId create_threadpool_with_lanes (
+ ::CORBA::ULong stacksize,
+ const ::RTCORBA::ThreadpoolLanes & lanes,
+ ::CORBA::Boolean allow_borrowing,
+ ::CORBA::Boolean allow_request_buffering,
+ ::CORBA::ULong max_buffered_requests,
+ ::CORBA::ULong max_request_buffer_size
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void destroy_threadpool (
+ ::RTCORBA::ThreadpoolId threadpool
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ ::RTCORBA::RTORB::InvalidThreadpool
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual ::RTCORBA::PriorityModelPolicy_ptr create_priority_model_policy (
+ ::RTCORBA::PriorityModel priority_model,
+ ::RTCORBA::Priority server_priority
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual ::RTCORBA::ThreadpoolPolicy_ptr create_threadpool_policy (
+ ::RTCORBA::ThreadpoolId threadpool
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual ::RTCORBA::PriorityBandedConnectionPolicy_ptr create_priority_banded_connection_policy (
+ const ::RTCORBA::PriorityBands & priority_bands
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual ::RTCORBA::ServerProtocolPolicy_ptr create_server_protocol_policy (
+ const ::RTCORBA::ProtocolList & protocols
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual ::RTCORBA::ClientProtocolPolicy_ptr create_client_protocol_policy (
+ const ::RTCORBA::ProtocolList & protocols
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual ::RTCORBA::PrivateConnectionPolicy_ptr create_private_connection_policy (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:210
+
+ virtual CORBA::Boolean _is_a (
+ const char *type_id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ virtual const char* _interface_repository_id (void) const;
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+
+ protected:
+ // Abstract or local interface only.
+ RTORB (void);
+
+ virtual ~RTORB (void);
+
+ private:
+ // Private and unimplemented for concrete interfaces.
+ RTORB (const RTORB &);
+
+ void operator= (const RTORB &);
+ };
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:44
+
+ extern TAO_RTCORBA_Export ::CORBA::TypeCode_ptr const _tc_RTORB;
+
+// TAO_IDL - Generated from
+// be\be_visitor_module/module_ch.cpp:66
+
+} // module RTCORBA
+
+// TAO_IDL - Generated from
+// be\be_visitor_traits.cpp:61
+
+// Traits specializations.
+namespace TAO
+{
+
+#if !defined (_RTCORBA_PRIORITYMODELPOLICY__TRAITS_CH_)
+#define _RTCORBA_PRIORITYMODELPOLICY__TRAITS_CH_
+
+ template<>
+ struct TAO_RTCORBA_Export Objref_Traits< ::RTCORBA::PriorityModelPolicy>
+ {
+ static ::RTCORBA::PriorityModelPolicy_ptr duplicate (
+ ::RTCORBA::PriorityModelPolicy_ptr
+ );
+ static void release (
+ ::RTCORBA::PriorityModelPolicy_ptr
+ );
+ static ::RTCORBA::PriorityModelPolicy_ptr nil (void);
+ static CORBA::Boolean marshal (
+ ::RTCORBA::PriorityModelPolicy_ptr p,
+ TAO_OutputCDR & cdr
+ );
+ };
+
+#endif /* end #if !defined */
+
+#if !defined (_RTCORBA_THREADPOOLPOLICY__TRAITS_CH_)
+#define _RTCORBA_THREADPOOLPOLICY__TRAITS_CH_
+
+ template<>
+ struct TAO_RTCORBA_Export Objref_Traits< ::RTCORBA::ThreadpoolPolicy>
+ {
+ static ::RTCORBA::ThreadpoolPolicy_ptr duplicate (
+ ::RTCORBA::ThreadpoolPolicy_ptr
+ );
+ static void release (
+ ::RTCORBA::ThreadpoolPolicy_ptr
+ );
+ static ::RTCORBA::ThreadpoolPolicy_ptr nil (void);
+ static CORBA::Boolean marshal (
+ ::RTCORBA::ThreadpoolPolicy_ptr p,
+ TAO_OutputCDR & cdr
+ );
+ };
+
+#endif /* end #if !defined */
+
+#if !defined (_RTCORBA_PROTOCOLPROPERTIES__TRAITS_CH_)
+#define _RTCORBA_PROTOCOLPROPERTIES__TRAITS_CH_
+
+ template<>
+ struct TAO_RTCORBA_Export Objref_Traits< ::RTCORBA::ProtocolProperties>
+ {
+ static ::RTCORBA::ProtocolProperties_ptr duplicate (
+ ::RTCORBA::ProtocolProperties_ptr
+ );
+ static void release (
+ ::RTCORBA::ProtocolProperties_ptr
+ );
+ static ::RTCORBA::ProtocolProperties_ptr nil (void);
+ static CORBA::Boolean marshal (
+ ::RTCORBA::ProtocolProperties_ptr p,
+ TAO_OutputCDR & cdr
+ );
+ };
+
+#endif /* end #if !defined */
+
+#if !defined (_RTCORBA_SERVERPROTOCOLPOLICY__TRAITS_CH_)
+#define _RTCORBA_SERVERPROTOCOLPOLICY__TRAITS_CH_
+
+ template<>
+ struct TAO_RTCORBA_Export Objref_Traits< ::RTCORBA::ServerProtocolPolicy>
+ {
+ static ::RTCORBA::ServerProtocolPolicy_ptr duplicate (
+ ::RTCORBA::ServerProtocolPolicy_ptr
+ );
+ static void release (
+ ::RTCORBA::ServerProtocolPolicy_ptr
+ );
+ static ::RTCORBA::ServerProtocolPolicy_ptr nil (void);
+ static CORBA::Boolean marshal (
+ ::RTCORBA::ServerProtocolPolicy_ptr p,
+ TAO_OutputCDR & cdr
+ );
+ };
+
+#endif /* end #if !defined */
+
+#if !defined (_RTCORBA_CLIENTPROTOCOLPOLICY__TRAITS_CH_)
+#define _RTCORBA_CLIENTPROTOCOLPOLICY__TRAITS_CH_
+
+ template<>
+ struct TAO_RTCORBA_Export Objref_Traits< ::RTCORBA::ClientProtocolPolicy>
+ {
+ static ::RTCORBA::ClientProtocolPolicy_ptr duplicate (
+ ::RTCORBA::ClientProtocolPolicy_ptr
+ );
+ static void release (
+ ::RTCORBA::ClientProtocolPolicy_ptr
+ );
+ static ::RTCORBA::ClientProtocolPolicy_ptr nil (void);
+ static CORBA::Boolean marshal (
+ ::RTCORBA::ClientProtocolPolicy_ptr p,
+ TAO_OutputCDR & cdr
+ );
+ };
+
+#endif /* end #if !defined */
+
+#if !defined (_RTCORBA_PRIVATECONNECTIONPOLICY__TRAITS_CH_)
+#define _RTCORBA_PRIVATECONNECTIONPOLICY__TRAITS_CH_
+
+ template<>
+ struct TAO_RTCORBA_Export Objref_Traits< ::RTCORBA::PrivateConnectionPolicy>
+ {
+ static ::RTCORBA::PrivateConnectionPolicy_ptr duplicate (
+ ::RTCORBA::PrivateConnectionPolicy_ptr
+ );
+ static void release (
+ ::RTCORBA::PrivateConnectionPolicy_ptr
+ );
+ static ::RTCORBA::PrivateConnectionPolicy_ptr nil (void);
+ static CORBA::Boolean marshal (
+ ::RTCORBA::PrivateConnectionPolicy_ptr p,
+ TAO_OutputCDR & cdr
+ );
+ };
+
+#endif /* end #if !defined */
+
+#if !defined (_RTCORBA_TCPPROTOCOLPROPERTIES__TRAITS_CH_)
+#define _RTCORBA_TCPPROTOCOLPROPERTIES__TRAITS_CH_
+
+ template<>
+ struct TAO_RTCORBA_Export Objref_Traits< ::RTCORBA::TCPProtocolProperties>
+ {
+ static ::RTCORBA::TCPProtocolProperties_ptr duplicate (
+ ::RTCORBA::TCPProtocolProperties_ptr
+ );
+ static void release (
+ ::RTCORBA::TCPProtocolProperties_ptr
+ );
+ static ::RTCORBA::TCPProtocolProperties_ptr nil (void);
+ static CORBA::Boolean marshal (
+ ::RTCORBA::TCPProtocolProperties_ptr p,
+ TAO_OutputCDR & cdr
+ );
+ };
+
+#endif /* end #if !defined */
+
+#if !defined (_RTCORBA_GIOPPROTOCOLPROPERTIES__TRAITS_CH_)
+#define _RTCORBA_GIOPPROTOCOLPROPERTIES__TRAITS_CH_
+
+ template<>
+ struct TAO_RTCORBA_Export Objref_Traits< ::RTCORBA::GIOPProtocolProperties>
+ {
+ static ::RTCORBA::GIOPProtocolProperties_ptr duplicate (
+ ::RTCORBA::GIOPProtocolProperties_ptr
+ );
+ static void release (
+ ::RTCORBA::GIOPProtocolProperties_ptr
+ );
+ static ::RTCORBA::GIOPProtocolProperties_ptr nil (void);
+ static CORBA::Boolean marshal (
+ ::RTCORBA::GIOPProtocolProperties_ptr p,
+ TAO_OutputCDR & cdr
+ );
+ };
+
+#endif /* end #if !defined */
+
+#if !defined (_RTCORBA_UNIXDOMAINPROTOCOLPROPERTIES__TRAITS_CH_)
+#define _RTCORBA_UNIXDOMAINPROTOCOLPROPERTIES__TRAITS_CH_
+
+ template<>
+ struct TAO_RTCORBA_Export Objref_Traits< ::RTCORBA::UnixDomainProtocolProperties>
+ {
+ static ::RTCORBA::UnixDomainProtocolProperties_ptr duplicate (
+ ::RTCORBA::UnixDomainProtocolProperties_ptr
+ );
+ static void release (
+ ::RTCORBA::UnixDomainProtocolProperties_ptr
+ );
+ static ::RTCORBA::UnixDomainProtocolProperties_ptr nil (void);
+ static CORBA::Boolean marshal (
+ ::RTCORBA::UnixDomainProtocolProperties_ptr p,
+ TAO_OutputCDR & cdr
+ );
+ };
+
+#endif /* end #if !defined */
+
+#if !defined (_RTCORBA_SHAREDMEMORYPROTOCOLPROPERTIES__TRAITS_CH_)
+#define _RTCORBA_SHAREDMEMORYPROTOCOLPROPERTIES__TRAITS_CH_
+
+ template<>
+ struct TAO_RTCORBA_Export Objref_Traits< ::RTCORBA::SharedMemoryProtocolProperties>
+ {
+ static ::RTCORBA::SharedMemoryProtocolProperties_ptr duplicate (
+ ::RTCORBA::SharedMemoryProtocolProperties_ptr
+ );
+ static void release (
+ ::RTCORBA::SharedMemoryProtocolProperties_ptr
+ );
+ static ::RTCORBA::SharedMemoryProtocolProperties_ptr nil (void);
+ static CORBA::Boolean marshal (
+ ::RTCORBA::SharedMemoryProtocolProperties_ptr p,
+ TAO_OutputCDR & cdr
+ );
+ };
+
+#endif /* end #if !defined */
+
+#if !defined (_RTCORBA_USERDATAGRAMPROTOCOLPROPERTIES__TRAITS_CH_)
+#define _RTCORBA_USERDATAGRAMPROTOCOLPROPERTIES__TRAITS_CH_
+
+ template<>
+ struct TAO_RTCORBA_Export Objref_Traits< ::RTCORBA::UserDatagramProtocolProperties>
+ {
+ static ::RTCORBA::UserDatagramProtocolProperties_ptr duplicate (
+ ::RTCORBA::UserDatagramProtocolProperties_ptr
+ );
+ static void release (
+ ::RTCORBA::UserDatagramProtocolProperties_ptr
+ );
+ static ::RTCORBA::UserDatagramProtocolProperties_ptr nil (void);
+ static CORBA::Boolean marshal (
+ ::RTCORBA::UserDatagramProtocolProperties_ptr p,
+ TAO_OutputCDR & cdr
+ );
+ };
+
+#endif /* end #if !defined */
+
+#if !defined (_RTCORBA_STREAMCONTROLPROTOCOLPROPERTIES__TRAITS_CH_)
+#define _RTCORBA_STREAMCONTROLPROTOCOLPROPERTIES__TRAITS_CH_
+
+ template<>
+ struct TAO_RTCORBA_Export Objref_Traits< ::RTCORBA::StreamControlProtocolProperties>
+ {
+ static ::RTCORBA::StreamControlProtocolProperties_ptr duplicate (
+ ::RTCORBA::StreamControlProtocolProperties_ptr
+ );
+ static void release (
+ ::RTCORBA::StreamControlProtocolProperties_ptr
+ );
+ static ::RTCORBA::StreamControlProtocolProperties_ptr nil (void);
+ static CORBA::Boolean marshal (
+ ::RTCORBA::StreamControlProtocolProperties_ptr p,
+ TAO_OutputCDR & cdr
+ );
+ };
+
+#endif /* end #if !defined */
+
+#if !defined (_RTCORBA_PRIORITYBANDEDCONNECTIONPOLICY__TRAITS_CH_)
+#define _RTCORBA_PRIORITYBANDEDCONNECTIONPOLICY__TRAITS_CH_
+
+ template<>
+ struct TAO_RTCORBA_Export Objref_Traits< ::RTCORBA::PriorityBandedConnectionPolicy>
+ {
+ static ::RTCORBA::PriorityBandedConnectionPolicy_ptr duplicate (
+ ::RTCORBA::PriorityBandedConnectionPolicy_ptr
+ );
+ static void release (
+ ::RTCORBA::PriorityBandedConnectionPolicy_ptr
+ );
+ static ::RTCORBA::PriorityBandedConnectionPolicy_ptr nil (void);
+ static CORBA::Boolean marshal (
+ ::RTCORBA::PriorityBandedConnectionPolicy_ptr p,
+ TAO_OutputCDR & cdr
+ );
+ };
+
+#endif /* end #if !defined */
+
+#if !defined (_RTCORBA_CURRENT__TRAITS_CH_)
+#define _RTCORBA_CURRENT__TRAITS_CH_
+
+ template<>
+ struct TAO_RTCORBA_Export Objref_Traits< ::RTCORBA::Current>
+ {
+ static ::RTCORBA::Current_ptr duplicate (
+ ::RTCORBA::Current_ptr
+ );
+ static void release (
+ ::RTCORBA::Current_ptr
+ );
+ static ::RTCORBA::Current_ptr nil (void);
+ static CORBA::Boolean marshal (
+ ::RTCORBA::Current_ptr p,
+ TAO_OutputCDR & cdr
+ );
+ };
+
+#endif /* end #if !defined */
+
+#if !defined (_RTCORBA_MUTEX__TRAITS_CH_)
+#define _RTCORBA_MUTEX__TRAITS_CH_
+
+ template<>
+ struct TAO_RTCORBA_Export Objref_Traits< ::RTCORBA::Mutex>
+ {
+ static ::RTCORBA::Mutex_ptr duplicate (
+ ::RTCORBA::Mutex_ptr
+ );
+ static void release (
+ ::RTCORBA::Mutex_ptr
+ );
+ static ::RTCORBA::Mutex_ptr nil (void);
+ static CORBA::Boolean marshal (
+ ::RTCORBA::Mutex_ptr p,
+ TAO_OutputCDR & cdr
+ );
+ };
+
+#endif /* end #if !defined */
+
+#if !defined (_RTCORBA_RTORB__TRAITS_CH_)
+#define _RTCORBA_RTORB__TRAITS_CH_
+
+ template<>
+ struct TAO_RTCORBA_Export Objref_Traits< ::RTCORBA::RTORB>
+ {
+ static ::RTCORBA::RTORB_ptr duplicate (
+ ::RTCORBA::RTORB_ptr
+ );
+ static void release (
+ ::RTCORBA::RTORB_ptr
+ );
+ static ::RTCORBA::RTORB_ptr nil (void);
+ static CORBA::Boolean marshal (
+ ::RTCORBA::RTORB_ptr p,
+ TAO_OutputCDR & cdr
+ );
+ };
+
+#endif /* end #if !defined */
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_structure/any_op_ch.cpp:52
+
+TAO_RTCORBA_Export void operator<<= (CORBA::Any &, const RTCORBA::ThreadpoolLane &); // copying version
+TAO_RTCORBA_Export void operator<<= (CORBA::Any &, RTCORBA::ThreadpoolLane*); // noncopying version
+TAO_RTCORBA_Export CORBA::Boolean operator>>= (const CORBA::Any &, RTCORBA::ThreadpoolLane *&); // deprecated
+TAO_RTCORBA_Export CORBA::Boolean operator>>= (const CORBA::Any &, const RTCORBA::ThreadpoolLane *&);
+
+// TAO_IDL - Generated from
+// be\be_visitor_sequence/any_op_ch.cpp:52
+
+TAO_RTCORBA_Export void operator<<= (CORBA::Any &, const RTCORBA::ThreadpoolLanes &); // copying version
+TAO_RTCORBA_Export void operator<<= (CORBA::Any &, RTCORBA::ThreadpoolLanes*); // noncopying version
+TAO_RTCORBA_Export CORBA::Boolean operator>>= (const CORBA::Any &, RTCORBA::ThreadpoolLanes *&); // deprecated
+TAO_RTCORBA_Export CORBA::Boolean operator>>= (const CORBA::Any &, const RTCORBA::ThreadpoolLanes *&);
+
+// TAO_IDL - Generated from
+// be\be_visitor_enum/any_op_ch.cpp:51
+
+TAO_RTCORBA_Export void operator<<= (CORBA::Any &, RTCORBA::PriorityModel);
+TAO_RTCORBA_Export CORBA::Boolean operator>>= (const CORBA::Any &, RTCORBA::PriorityModel &);
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/any_op_ch.cpp:52
+
+TAO_RTCORBA_Export void operator<<= (CORBA::Any &, RTCORBA::PriorityModelPolicy_ptr); // copying
+TAO_RTCORBA_Export void operator<<= (CORBA::Any &, RTCORBA::PriorityModelPolicy_ptr *); // non-copying
+TAO_RTCORBA_Export CORBA::Boolean operator>>= (const CORBA::Any &, RTCORBA::PriorityModelPolicy_ptr &);
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/any_op_ch.cpp:52
+
+TAO_RTCORBA_Export void operator<<= (CORBA::Any &, RTCORBA::ThreadpoolPolicy_ptr); // copying
+TAO_RTCORBA_Export void operator<<= (CORBA::Any &, RTCORBA::ThreadpoolPolicy_ptr *); // non-copying
+TAO_RTCORBA_Export CORBA::Boolean operator>>= (const CORBA::Any &, RTCORBA::ThreadpoolPolicy_ptr &);
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/any_op_ch.cpp:52
+
+TAO_RTCORBA_Export void operator<<= (CORBA::Any &, RTCORBA::ProtocolProperties_ptr); // copying
+TAO_RTCORBA_Export void operator<<= (CORBA::Any &, RTCORBA::ProtocolProperties_ptr *); // non-copying
+TAO_RTCORBA_Export CORBA::Boolean operator>>= (const CORBA::Any &, RTCORBA::ProtocolProperties_ptr &);
+
+// TAO_IDL - Generated from
+// be\be_visitor_structure/any_op_ch.cpp:52
+
+TAO_RTCORBA_Export void operator<<= (CORBA::Any &, const RTCORBA::Protocol &); // copying version
+TAO_RTCORBA_Export void operator<<= (CORBA::Any &, RTCORBA::Protocol*); // noncopying version
+TAO_RTCORBA_Export CORBA::Boolean operator>>= (const CORBA::Any &, RTCORBA::Protocol *&); // deprecated
+TAO_RTCORBA_Export CORBA::Boolean operator>>= (const CORBA::Any &, const RTCORBA::Protocol *&);
+
+// TAO_IDL - Generated from
+// be\be_visitor_sequence/any_op_ch.cpp:52
+
+TAO_RTCORBA_Export void operator<<= (CORBA::Any &, const RTCORBA::ProtocolList &); // copying version
+TAO_RTCORBA_Export void operator<<= (CORBA::Any &, RTCORBA::ProtocolList*); // noncopying version
+TAO_RTCORBA_Export CORBA::Boolean operator>>= (const CORBA::Any &, RTCORBA::ProtocolList *&); // deprecated
+TAO_RTCORBA_Export CORBA::Boolean operator>>= (const CORBA::Any &, const RTCORBA::ProtocolList *&);
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/any_op_ch.cpp:52
+
+TAO_RTCORBA_Export void operator<<= (CORBA::Any &, RTCORBA::ServerProtocolPolicy_ptr); // copying
+TAO_RTCORBA_Export void operator<<= (CORBA::Any &, RTCORBA::ServerProtocolPolicy_ptr *); // non-copying
+TAO_RTCORBA_Export CORBA::Boolean operator>>= (const CORBA::Any &, RTCORBA::ServerProtocolPolicy_ptr &);
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/any_op_ch.cpp:52
+
+TAO_RTCORBA_Export void operator<<= (CORBA::Any &, RTCORBA::ClientProtocolPolicy_ptr); // copying
+TAO_RTCORBA_Export void operator<<= (CORBA::Any &, RTCORBA::ClientProtocolPolicy_ptr *); // non-copying
+TAO_RTCORBA_Export CORBA::Boolean operator>>= (const CORBA::Any &, RTCORBA::ClientProtocolPolicy_ptr &);
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/any_op_ch.cpp:52
+
+TAO_RTCORBA_Export void operator<<= (CORBA::Any &, RTCORBA::PrivateConnectionPolicy_ptr); // copying
+TAO_RTCORBA_Export void operator<<= (CORBA::Any &, RTCORBA::PrivateConnectionPolicy_ptr *); // non-copying
+TAO_RTCORBA_Export CORBA::Boolean operator>>= (const CORBA::Any &, RTCORBA::PrivateConnectionPolicy_ptr &);
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/any_op_ch.cpp:52
+
+TAO_RTCORBA_Export void operator<<= (CORBA::Any &, RTCORBA::TCPProtocolProperties_ptr); // copying
+TAO_RTCORBA_Export void operator<<= (CORBA::Any &, RTCORBA::TCPProtocolProperties_ptr *); // non-copying
+TAO_RTCORBA_Export CORBA::Boolean operator>>= (const CORBA::Any &, RTCORBA::TCPProtocolProperties_ptr &);
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/any_op_ch.cpp:52
+
+TAO_RTCORBA_Export void operator<<= (CORBA::Any &, RTCORBA::GIOPProtocolProperties_ptr); // copying
+TAO_RTCORBA_Export void operator<<= (CORBA::Any &, RTCORBA::GIOPProtocolProperties_ptr *); // non-copying
+TAO_RTCORBA_Export CORBA::Boolean operator>>= (const CORBA::Any &, RTCORBA::GIOPProtocolProperties_ptr &);
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/any_op_ch.cpp:52
+
+TAO_RTCORBA_Export void operator<<= (CORBA::Any &, RTCORBA::UnixDomainProtocolProperties_ptr); // copying
+TAO_RTCORBA_Export void operator<<= (CORBA::Any &, RTCORBA::UnixDomainProtocolProperties_ptr *); // non-copying
+TAO_RTCORBA_Export CORBA::Boolean operator>>= (const CORBA::Any &, RTCORBA::UnixDomainProtocolProperties_ptr &);
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/any_op_ch.cpp:52
+
+TAO_RTCORBA_Export void operator<<= (CORBA::Any &, RTCORBA::SharedMemoryProtocolProperties_ptr); // copying
+TAO_RTCORBA_Export void operator<<= (CORBA::Any &, RTCORBA::SharedMemoryProtocolProperties_ptr *); // non-copying
+TAO_RTCORBA_Export CORBA::Boolean operator>>= (const CORBA::Any &, RTCORBA::SharedMemoryProtocolProperties_ptr &);
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/any_op_ch.cpp:52
+
+TAO_RTCORBA_Export void operator<<= (CORBA::Any &, RTCORBA::UserDatagramProtocolProperties_ptr); // copying
+TAO_RTCORBA_Export void operator<<= (CORBA::Any &, RTCORBA::UserDatagramProtocolProperties_ptr *); // non-copying
+TAO_RTCORBA_Export CORBA::Boolean operator>>= (const CORBA::Any &, RTCORBA::UserDatagramProtocolProperties_ptr &);
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/any_op_ch.cpp:52
+
+TAO_RTCORBA_Export void operator<<= (CORBA::Any &, RTCORBA::StreamControlProtocolProperties_ptr); // copying
+TAO_RTCORBA_Export void operator<<= (CORBA::Any &, RTCORBA::StreamControlProtocolProperties_ptr *); // non-copying
+TAO_RTCORBA_Export CORBA::Boolean operator>>= (const CORBA::Any &, RTCORBA::StreamControlProtocolProperties_ptr &);
+
+// TAO_IDL - Generated from
+// be\be_visitor_structure/any_op_ch.cpp:52
+
+TAO_RTCORBA_Export void operator<<= (CORBA::Any &, const RTCORBA::PriorityBand &); // copying version
+TAO_RTCORBA_Export void operator<<= (CORBA::Any &, RTCORBA::PriorityBand*); // noncopying version
+TAO_RTCORBA_Export CORBA::Boolean operator>>= (const CORBA::Any &, RTCORBA::PriorityBand *&); // deprecated
+TAO_RTCORBA_Export CORBA::Boolean operator>>= (const CORBA::Any &, const RTCORBA::PriorityBand *&);
+
+// TAO_IDL - Generated from
+// be\be_visitor_sequence/any_op_ch.cpp:52
+
+TAO_RTCORBA_Export void operator<<= (CORBA::Any &, const RTCORBA::PriorityBands &); // copying version
+TAO_RTCORBA_Export void operator<<= (CORBA::Any &, RTCORBA::PriorityBands*); // noncopying version
+TAO_RTCORBA_Export CORBA::Boolean operator>>= (const CORBA::Any &, RTCORBA::PriorityBands *&); // deprecated
+TAO_RTCORBA_Export CORBA::Boolean operator>>= (const CORBA::Any &, const RTCORBA::PriorityBands *&);
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/any_op_ch.cpp:52
+
+TAO_RTCORBA_Export void operator<<= (CORBA::Any &, RTCORBA::PriorityBandedConnectionPolicy_ptr); // copying
+TAO_RTCORBA_Export void operator<<= (CORBA::Any &, RTCORBA::PriorityBandedConnectionPolicy_ptr *); // non-copying
+TAO_RTCORBA_Export CORBA::Boolean operator>>= (const CORBA::Any &, RTCORBA::PriorityBandedConnectionPolicy_ptr &);
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/any_op_ch.cpp:52
+
+TAO_RTCORBA_Export void operator<<= (CORBA::Any &, RTCORBA::Current_ptr); // copying
+TAO_RTCORBA_Export void operator<<= (CORBA::Any &, RTCORBA::Current_ptr *); // non-copying
+TAO_RTCORBA_Export CORBA::Boolean operator>>= (const CORBA::Any &, RTCORBA::Current_ptr &);
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/any_op_ch.cpp:52
+
+TAO_RTCORBA_Export void operator<<= (CORBA::Any &, RTCORBA::Mutex_ptr); // copying
+TAO_RTCORBA_Export void operator<<= (CORBA::Any &, RTCORBA::Mutex_ptr *); // non-copying
+TAO_RTCORBA_Export CORBA::Boolean operator>>= (const CORBA::Any &, RTCORBA::Mutex_ptr &);
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/any_op_ch.cpp:52
+
+TAO_RTCORBA_Export void operator<<= (CORBA::Any &, RTCORBA::RTORB_ptr); // copying
+TAO_RTCORBA_Export void operator<<= (CORBA::Any &, RTCORBA::RTORB_ptr *); // non-copying
+TAO_RTCORBA_Export CORBA::Boolean operator>>= (const CORBA::Any &, RTCORBA::RTORB_ptr &);
+
+// TAO_IDL - Generated from
+// be\be_visitor_exception/any_op_ch.cpp:52
+
+TAO_RTCORBA_Export void operator<<= (CORBA::Any &, const RTCORBA::RTORB::MutexNotFound &); // copying version
+TAO_RTCORBA_Export void operator<<= (CORBA::Any &, RTCORBA::RTORB::MutexNotFound*); // noncopying version
+TAO_RTCORBA_Export CORBA::Boolean operator>>= (const CORBA::Any &, RTCORBA::RTORB::MutexNotFound *&); // deprecated
+TAO_RTCORBA_Export CORBA::Boolean operator>>= (const CORBA::Any &, const RTCORBA::RTORB::MutexNotFound *&);
+
+// TAO_IDL - Generated from
+// be\be_visitor_exception/any_op_ch.cpp:52
+
+TAO_RTCORBA_Export void operator<<= (CORBA::Any &, const RTCORBA::RTORB::InvalidThreadpool &); // copying version
+TAO_RTCORBA_Export void operator<<= (CORBA::Any &, RTCORBA::RTORB::InvalidThreadpool*); // noncopying version
+TAO_RTCORBA_Export CORBA::Boolean operator>>= (const CORBA::Any &, RTCORBA::RTORB::InvalidThreadpool *&); // deprecated
+TAO_RTCORBA_Export CORBA::Boolean operator>>= (const CORBA::Any &, const RTCORBA::RTORB::InvalidThreadpool *&);
+
+// TAO_IDL - Generated from
+// be\be_visitor_structure/cdr_op_ch.cpp:54
+
+TAO_RTCORBA_Export CORBA::Boolean operator<< (TAO_OutputCDR &, const RTCORBA::ThreadpoolLane &);
+TAO_RTCORBA_Export CORBA::Boolean operator>> (TAO_InputCDR &, RTCORBA::ThreadpoolLane &);
+
+// TAO_IDL - Generated from
+// be\be_visitor_sequence/cdr_op_ch.cpp:71
+
+#if !defined _TAO_CDR_OP_RTCORBA_ThreadpoolLanes_H_
+#define _TAO_CDR_OP_RTCORBA_ThreadpoolLanes_H_
+
+TAO_RTCORBA_Export CORBA::Boolean operator<< (
+ TAO_OutputCDR &,
+ const RTCORBA::ThreadpoolLanes &
+ );
+TAO_RTCORBA_Export CORBA::Boolean operator>> (
+ TAO_InputCDR &,
+ RTCORBA::ThreadpoolLanes &
+ );
+
+#endif /* _TAO_CDR_OP_RTCORBA_ThreadpoolLanes_H_ */
+
+// TAO_IDL - Generated from
+// be\be_visitor_enum/cdr_op_ch.cpp:50
+
+TAO_RTCORBA_Export CORBA::Boolean operator<< (TAO_OutputCDR &, RTCORBA::PriorityModel);
+TAO_RTCORBA_Export CORBA::Boolean operator>> (TAO_InputCDR &, RTCORBA::PriorityModel &);
+
+// TAO_IDL - Generated from
+// be\be_visitor_structure/cdr_op_ch.cpp:54
+
+TAO_RTCORBA_Export CORBA::Boolean operator<< (TAO_OutputCDR &, const RTCORBA::PriorityBand &);
+TAO_RTCORBA_Export CORBA::Boolean operator>> (TAO_InputCDR &, RTCORBA::PriorityBand &);
+
+// TAO_IDL - Generated from
+// be\be_visitor_sequence/cdr_op_ch.cpp:71
+
+#if !defined _TAO_CDR_OP_RTCORBA_PriorityBands_H_
+#define _TAO_CDR_OP_RTCORBA_PriorityBands_H_
+
+TAO_RTCORBA_Export CORBA::Boolean operator<< (
+ TAO_OutputCDR &,
+ const RTCORBA::PriorityBands &
+ );
+TAO_RTCORBA_Export CORBA::Boolean operator>> (
+ TAO_InputCDR &,
+ RTCORBA::PriorityBands &
+ );
+
+#endif /* _TAO_CDR_OP_RTCORBA_PriorityBands_H_ */
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:955
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#if defined (__BORLANDC__)
+#pragma option pop
+#endif /* __BORLANDC__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* ifndef */
+
+
diff --git a/TAO/tao/RTCORBA/RTCORBAS.h b/TAO/tao/RTCORBA/RTCORBAS.h
new file mode 100644
index 00000000000..e543e41332e
--- /dev/null
+++ b/TAO/tao/RTCORBA/RTCORBAS.h
@@ -0,0 +1,3 @@
+// $Id$
+// This file deliberately empty. See bugzilla #2549.
+
diff --git a/TAO/tao/RTCORBA/RTCORBA_include.pidl b/TAO/tao/RTCORBA/RTCORBA_include.pidl
new file mode 100644
index 00000000000..a728652a44e
--- /dev/null
+++ b/TAO/tao/RTCORBA/RTCORBA_include.pidl
@@ -0,0 +1,37 @@
+/**
+ * @file RTCORBA_include.pidl
+ *
+ * $Id$
+ *
+ * @brief Include file for use in applications that need RTCORBA.pidl.
+ *
+ * This file just includes RTCORBA.pidl. The *C.h file generated from
+ * this is hand-crafted to itself include RTCORBA.h instead of
+ * RTCORBAC.h (which will produce a compiler error message if
+ * included directly). The RTCORBA_includeC.h file can then be
+ * included directly and automatically by the IDL compiler when
+ * building the application.
+ *
+ * 1. Run the tao_idl compiler on the pidl file. The command used for
+ * this is:
+ *
+ * tao_idl -o orig -St -Sp
+ * -Wb,pre_include="ace/pre.h"
+ * -Wb,post_include="ace/post.h"
+ * RTCORBA_include.pidl
+ *
+ * 2. Then change this line in RTCORBA_includeC.h:
+ *
+ * #include "RTCORBAC.h"
+ *
+ * to
+ *
+ * #include "RTCORBA.h"
+ */
+
+#ifndef _RT_CORBA_INCLUDE_IDL_
+#define _RT_CORBA_INCLUDE_IDL_
+
+#include "tao/RTCORBA/RTCORBA.pidl"
+
+#endif /* _RT_CORBA_INCLUDE_IDL_ */
diff --git a/TAO/tao/RTCORBA/RTCORBA_includeA.h b/TAO/tao/RTCORBA/RTCORBA_includeA.h
new file mode 100644
index 00000000000..e0779b11bc4
--- /dev/null
+++ b/TAO/tao/RTCORBA/RTCORBA_includeA.h
@@ -0,0 +1,4 @@
+//$Id$
+/**
+* Just a place holder for files that include RTCORBA_include.pidl
+*/
diff --git a/TAO/tao/RTCORBA/RTCORBA_includeC.h b/TAO/tao/RTCORBA/RTCORBA_includeC.h
new file mode 100644
index 00000000000..1b7cc8c0f9a
--- /dev/null
+++ b/TAO/tao/RTCORBA/RTCORBA_includeC.h
@@ -0,0 +1,100 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// .\be\be_codegen.cpp:186
+
+#ifndef _TAO_IDL_ORIG_RTCORBA_INCLUDEC_H_
+#define _TAO_IDL_ORIG_RTCORBA_INCLUDEC_H_
+
+#include "tao/ORB.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/CDR.h"
+#include "tao/Environment.h"
+
+#include "tao/RTCORBA/RTCORBA.h"
+
+#if defined (TAO_EXPORT_MACRO)
+#undef TAO_EXPORT_MACRO
+#endif
+#define TAO_EXPORT_MACRO
+
+#if defined (TAO_EXPORT_NESTED_CLASSES)
+# if defined (TAO_EXPORT_NESTED_MACRO)
+# undef TAO_EXPORT_NESTED_MACRO
+# endif /* defined (TAO_EXPORT_NESTED_MACRO) */
+# define TAO_EXPORT_NESTED_MACRO
+#endif /* TAO_EXPORT_NESTED_CLASSES */
+
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+#if defined (__BORLANDC__)
+#pragma option push -w-rvl -w-rch -w-ccc -w-inl
+#endif /* __BORLANDC__ */
+
+// TAO_IDL - Generated from
+// .\be\be_visitor_traits.cpp:50
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Traits specializations.
+namespace TAO
+{
+}
+
+// TAO_IDL - Generated from
+// w:\ace_wrappers\tao\tao_idl\be\be_visitor_root/cdr_op.cpp:48
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#ifndef __ACE_INLINE__
+
+// TAO_IDL - Generated from
+// w:\ace_wrappers\tao\tao_idl\be\be_visitor_root/cdr_op.cpp:64
+
+#endif /* __ACE_INLINE__ */
+
+// TAO_IDL - Generated from
+// .\be\be_codegen.cpp:1050
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#if defined (__BORLANDC__)
+#pragma option pop
+#endif /* __BORLANDC__ */
+
+#endif /* ifndef */
+
diff --git a/TAO/tao/RTCORBA/RTCORBA_includeS.h b/TAO/tao/RTCORBA/RTCORBA_includeS.h
new file mode 100644
index 00000000000..e0779b11bc4
--- /dev/null
+++ b/TAO/tao/RTCORBA/RTCORBA_includeS.h
@@ -0,0 +1,4 @@
+//$Id$
+/**
+* Just a place holder for files that include RTCORBA_include.pidl
+*/
diff --git a/TAO/tao/RTCORBA/RT_Current.cpp b/TAO/tao/RTCORBA/RT_Current.cpp
new file mode 100644
index 00000000000..5c9170dd78e
--- /dev/null
+++ b/TAO/tao/RTCORBA/RT_Current.cpp
@@ -0,0 +1,72 @@
+//
+// $Id$
+//
+
+#include "tao/RTCORBA/RT_Current.h"
+
+#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
+
+#include "tao/RTCORBA/Priority_Mapping.h"
+
+#include "tao/Stub.h"
+#include "tao/ORB_Core.h"
+#include "tao/Protocols_Hooks.h"
+
+#include "ace/Thread.h"
+
+ACE_RCSID (RTCORBA,
+ RT_Current,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_RT_Current::TAO_RT_Current (TAO_ORB_Core *orb_core)
+ : orb_core_ (orb_core)
+{
+}
+
+TAO_RT_Current::~TAO_RT_Current (void)
+{
+}
+
+RTCORBA::Priority
+TAO_RT_Current::the_priority (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ TAO_Protocols_Hooks *tph =
+ this->orb_core_->get_protocols_hooks ();
+
+ RTCORBA::Priority priority;
+
+ int result =
+ tph->get_thread_CORBA_priority (priority
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ if (result == -1)
+ ACE_THROW_RETURN (CORBA::DATA_CONVERSION (1, CORBA::COMPLETED_NO), -1);
+
+ return priority;
+}
+
+void
+TAO_RT_Current::the_priority (RTCORBA::Priority the_priority
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+
+ TAO_Protocols_Hooks *tph =
+ this->orb_core_->get_protocols_hooks ();
+
+ int result =
+ tph->set_thread_CORBA_priority (the_priority
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (result == -1)
+ ACE_THROW (CORBA::DATA_CONVERSION (1, CORBA::COMPLETED_NO));
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
diff --git a/TAO/tao/RTCORBA/RT_Current.h b/TAO/tao/RTCORBA/RT_Current.h
new file mode 100644
index 00000000000..58b994d0bee
--- /dev/null
+++ b/TAO/tao/RTCORBA/RT_Current.h
@@ -0,0 +1,84 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file RT_Current.h
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan (coryan@cs.wustl.edu)
+ */
+//=============================================================================
+
+
+#ifndef TAO_RT_CURRENT_H
+#define TAO_RT_CURRENT_H
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
+
+#define TAO_RTCORBA_SAFE_INCLUDE
+#include "tao/RTCORBA/RTCORBAC.h"
+#undef TAO_RTCORBA_SAFE_INCLUDE
+
+#include "tao/LocalObject.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_RT_Current
+ *
+ * @brief RTCORBA::Current interface iplementation.
+ *
+ * Allows setting/getting the priority of the current thread.
+ */
+class TAO_RTCORBA_Export TAO_RT_Current
+ : public RTCORBA::Current
+ , public TAO_Local_RefCounted_Object
+{
+public:
+
+ /// Default constructor.
+ TAO_RT_Current (TAO_ORB_Core *orb_core);
+
+ virtual RTCORBA::Priority the_priority (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual void the_priority (RTCORBA::Priority the_priority
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+protected:
+
+ /// Protected destructor to enforce proper memory management of this
+ /// reference counted object.
+ virtual ~TAO_RT_Current (void);
+
+private:
+
+ /// ORB Core that owns us.
+ TAO_ORB_Core * const orb_core_;
+
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_RT_CURRENT_H */
diff --git a/TAO/tao/RTCORBA/RT_Endpoint_Selector_Factory.cpp b/TAO/tao/RTCORBA/RT_Endpoint_Selector_Factory.cpp
new file mode 100644
index 00000000000..a74d7ea7277
--- /dev/null
+++ b/TAO/tao/RTCORBA/RT_Endpoint_Selector_Factory.cpp
@@ -0,0 +1,52 @@
+#include "tao/RTCORBA/RT_Endpoint_Selector_Factory.h"
+
+#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
+
+#include "tao/RTCORBA/RT_Invocation_Endpoint_Selectors.h"
+#include "tao/RTCORBA/RT_Endpoint_Utils.h"
+#include "tao/RTCORBA/RT_Stub.h"
+
+#include "tao/Protocols_Hooks.h"
+
+#include "ace/Log_Msg.h"
+
+
+ACE_RCSID (RTCORBA,
+ RT_Endpoint_Selector_Factory,
+ "$Id$")
+
+
+// ****************************************************************
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+RT_Endpoint_Selector_Factory::RT_Endpoint_Selector_Factory (void)
+{
+ ACE_NEW (this->rt_invocation_endpoint_selector_,
+ TAO_RT_Invocation_Endpoint_Selector);
+}
+
+RT_Endpoint_Selector_Factory::~RT_Endpoint_Selector_Factory (void)
+{
+ delete this->rt_invocation_endpoint_selector_;
+}
+
+TAO_Invocation_Endpoint_Selector *
+RT_Endpoint_Selector_Factory::get_selector (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+{
+ return this->rt_invocation_endpoint_selector_;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+// ****************************************************************
+
+ACE_STATIC_SVC_DEFINE (RT_Endpoint_Selector_Factory,
+ ACE_TEXT ("RT_Endpoint_Selector_Factory"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (RT_Endpoint_Selector_Factory),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0)
+ACE_FACTORY_DEFINE (TAO_RTCORBA, RT_Endpoint_Selector_Factory)
+
+#endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
diff --git a/TAO/tao/RTCORBA/RT_Endpoint_Selector_Factory.h b/TAO/tao/RTCORBA/RT_Endpoint_Selector_Factory.h
new file mode 100644
index 00000000000..f361563ad22
--- /dev/null
+++ b/TAO/tao/RTCORBA/RT_Endpoint_Selector_Factory.h
@@ -0,0 +1,78 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file RT_Endpoint_Selector_Factory.h
+ *
+ * $Id$
+ *
+ * Strategies for selecting profile/endpoint from an IOR for making an
+ * invocation.
+ *
+ * @author Marina Spivak <marina@cs.wustl.edu>
+ */
+//=============================================================================
+
+
+#ifndef RT_ENDPOINT_SELECTOR_FACTORY_H
+#define RT_ENDPOINT_SELECTOR_FACTORY_H
+#include /**/ "ace/pre.h"
+
+#include "tao/RTCORBA/rtcorba_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Endpoint_Selector_Factory.h"
+#include "tao/orbconf.h"
+
+#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
+
+#include "ace/Service_Config.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_RT_Invocation_Endpoint_Selector;
+
+// ****************************************************************
+/**
+ * @class RT_Endpoint_Selector_Factory
+ *
+ * @brief Factory for obtaining appropriate <Invocation_Selector>.
+ *
+ * Used by Invocation classes to intialize its endpoint selection
+ * strategy and state based on the effective policies. Endpoint
+ * selection strategies are stateless objects - all the state they
+ * need is contained by Invocation. Thus, rather than allocating an
+ * endpoint selection strategy object for each Invocation, the factory
+ * simply returns the appropriate one from the set preallocated in the
+ * ORB_Core. One endpoint selection strategy object can be used by
+ * many invocations concurrently.
+ */
+class TAO_RTCORBA_Export RT_Endpoint_Selector_Factory
+ : public TAO_Endpoint_Selector_Factory
+{
+public:
+ /// Constructor.
+ RT_Endpoint_Selector_Factory (void);
+
+ /// Destructor.
+ virtual ~RT_Endpoint_Selector_Factory (void);
+
+ virtual TAO_Invocation_Endpoint_Selector *get_selector (
+ ACE_ENV_SINGLE_ARG_DECL);
+
+private:
+ TAO_RT_Invocation_Endpoint_Selector *rt_invocation_endpoint_selector_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE_EXPORT (TAO_RTCORBA, RT_Endpoint_Selector_Factory)
+ACE_FACTORY_DECLARE (TAO_RTCORBA, RT_Endpoint_Selector_Factory)
+
+#endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
+
+#include /**/ "ace/post.h"
+#endif /* RT_ENDPOINT_SELECTOR_FACTORY_H */
diff --git a/TAO/tao/RTCORBA/RT_Endpoint_Utils.cpp b/TAO/tao/RTCORBA/RT_Endpoint_Utils.cpp
new file mode 100644
index 00000000000..841c73bc6dc
--- /dev/null
+++ b/TAO/tao/RTCORBA/RT_Endpoint_Utils.cpp
@@ -0,0 +1,56 @@
+#include "tao/RTCORBA/RT_Endpoint_Utils.h"
+#include "tao/Profile_Transport_Resolver.h"
+
+#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
+
+#include "tao/RTCORBA/RT_Endpoint_Selector_Factory.h"
+#include "tao/RTCORBA/RT_Invocation_Endpoint_Selectors.h"
+
+#include "tao/RTCORBA/RT_Stub.h"
+
+ACE_RCSID (RTCORBA,
+ RT_Endpoint_Utils,
+ "$Id$")
+
+// ****************************************************************
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+CORBA::Policy *
+TAO_RT_Endpoint_Utils::policy (TAO_Cached_Policy_Type type,
+ TAO::Profile_Transport_Resolver &r
+ ACE_ENV_ARG_DECL)
+{
+ CORBA::Policy *policy = CORBA::Policy::_nil ();
+
+ TAO_RT_Stub *rt_stub = dynamic_cast<TAO_RT_Stub *> (r.stub ());
+
+ ACE_TRY
+ {
+ policy =
+ rt_stub->get_cached_policy (type
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCH (CORBA::INV_POLICY, ex)
+ {
+ if (r.inconsistent_policies ())
+ {
+ CORBA::PolicyList *p = r.inconsistent_policies ();
+ p->length (1);
+ (*p)[0u] = rt_stub->TAO_Stub::get_cached_policy (type
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+
+ ACE_RE_THROW;
+ }
+ ACE_ENDTRY;
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+
+ return policy;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
diff --git a/TAO/tao/RTCORBA/RT_Endpoint_Utils.h b/TAO/tao/RTCORBA/RT_Endpoint_Utils.h
new file mode 100644
index 00000000000..649c3ca2896
--- /dev/null
+++ b/TAO/tao/RTCORBA/RT_Endpoint_Utils.h
@@ -0,0 +1,60 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file RT_Endpoint_Utils.h
+ *
+ * $Id$
+ *
+ * Commonly used utility methods used by RT_Endpoint_Selectors.
+ *
+ * @author Angelo Corsaro <corsaro@cs.wustl.edu>
+ * @author Frank Hunleth <fhunleth@cs.wustl.edu>
+ */
+//=============================================================================
+
+
+#ifndef RT_ENDPOINT_UTILS_H
+#define RT_ENDPOINT_UTILS_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/RTCORBA/rtcorba_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Policy_ForwardC.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ class Profile_Transport_Resolver;
+}
+
+/**
+ * @class RT_Endpoint_Utils
+ *
+ * @brief Commonly used utility methods used by the RT_Endpoint_Selectors.
+ *
+ */
+class TAO_RTCORBA_Export TAO_RT_Endpoint_Utils
+{
+public:
+ static
+ CORBA::Policy *policy (TAO_Cached_Policy_Type type,
+ TAO::Profile_Transport_Resolver &r
+ ACE_ENV_ARG_DECL);
+
+private:
+ /// ctor.
+ TAO_RT_Endpoint_Utils ();
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* RT_ENDPOINT_UTILS_H */
diff --git a/TAO/tao/RTCORBA/RT_Invocation_Endpoint_Selectors.cpp b/TAO/tao/RTCORBA/RT_Invocation_Endpoint_Selectors.cpp
new file mode 100644
index 00000000000..a850ca0bea8
--- /dev/null
+++ b/TAO/tao/RTCORBA/RT_Invocation_Endpoint_Selectors.cpp
@@ -0,0 +1,380 @@
+#include "tao/RTCORBA/RT_Invocation_Endpoint_Selectors.h"
+
+#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
+
+#include "tao/RTCORBA/RT_Policy_i.h"
+#include "tao/RTCORBA/RT_Stub.h"
+#include "tao/RTCORBA/RT_Transport_Descriptor.h"
+#include "tao/RTCORBA/RT_Transport_Descriptor_Property.h"
+#include "tao/RTCORBA/RT_Endpoint_Utils.h"
+#include "tao/RTCORBA/RT_Protocols_Hooks.h"
+#include "tao/Stub.h"
+#include "tao/ORB_Core.h"
+#include "tao/Profile.h"
+#include "tao/Endpoint.h"
+#include "tao/debug.h"
+#include "tao/Profile.h"
+#include "tao/Endpoint.h"
+#include "tao/Profile_Transport_Resolver.h"
+#include "tao/ORB_Core.h"
+
+ACE_RCSID (RTCORBA,
+ RT_Invocation_Endpoint_Selectors,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+void
+TAO_RT_Invocation_Endpoint_Selector::select_endpoint (
+ TAO::Profile_Transport_Resolver *r,
+ ACE_Time_Value *val
+ ACE_ENV_ARG_DECL)
+{
+ if (r == 0)
+ ACE_THROW (CORBA::INTERNAL ());
+
+ CORBA::Policy_var client_protocol_policy_base =
+ TAO_RT_Endpoint_Utils::policy (TAO_CACHED_POLICY_RT_CLIENT_PROTOCOL,
+ *r
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (client_protocol_policy_base.ptr () == 0)
+ {
+ do
+ {
+ r->profile (r->stub ()->profile_in_use ());
+
+ int status =
+ this->endpoint_from_profile (*r,
+ val
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (status == 1)
+ return;
+ }
+ while (r->stub ()->next_profile_retry () != 0);
+
+ // If we get here, we completely failed to find an endpoint selector
+ // that we know how to use, so throw an exception.
+ ACE_THROW (CORBA::TRANSIENT (CORBA::OMGVMCID | 2,
+ CORBA::COMPLETED_NO));
+ }
+ else
+ {
+ RTCORBA::ClientProtocolPolicy_var client_protocol_policy =
+ RTCORBA::ClientProtocolPolicy::_narrow (
+ client_protocol_policy_base.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ /// Cast to TAO_ClientProtocolPolicy
+ TAO_ClientProtocolPolicy *tao_client_protocol_policy =
+ static_cast<TAO_ClientProtocolPolicy *> (client_protocol_policy.in ());
+
+ /// Get the ProtocolList
+ RTCORBA::ProtocolList &client_protocols =
+ tao_client_protocol_policy->protocols_rep ();
+
+ this->select_endpoint_based_on_client_protocol_policy (
+ *r,
+ client_protocol_policy.in (),
+ client_protocols,
+ val
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+}
+
+void
+TAO_RT_Invocation_Endpoint_Selector::select_endpoint_based_on_client_protocol_policy (
+ TAO::Profile_Transport_Resolver &r,
+ RTCORBA::ClientProtocolPolicy_ptr client_protocol_policy,
+ RTCORBA::ProtocolList &client_protocols,
+ ACE_Time_Value *val
+ ACE_ENV_ARG_DECL)
+{
+ CORBA::Boolean valid_profile_found = false;
+
+ // Even though cycling through all the protocols is the correct
+ // things to do to find a match, starting from the start of the
+ // profile list is not. In addition, this code is also ignoring the
+ // forwarded reference (if it exists). This behavior is caused by
+ // problems with the profile management in TAO which are documented
+ // in bugzilla bugs 1237, 1238, and 1239. Once the above problems
+ // are fixed, this behavior should be fixed to do the right thing.
+ for (CORBA::ULong protocol_index = 0;
+ protocol_index < client_protocols.length ();
+ ++protocol_index)
+ {
+ // Find the profiles that match the current protocol.
+ TAO_Profile *profile = 0;
+ TAO_MProfile &mprofile = r.stub ()->base_profiles ();
+
+ for (TAO_PHandle i = 0;
+ i < mprofile.profile_count ();
+ ++i)
+ {
+ profile = mprofile.get_profile (i);
+
+ if (profile->tag () == client_protocols[protocol_index].protocol_type)
+ {
+ valid_profile_found = true;
+
+ r.profile (profile);
+
+ int const status =
+ this->endpoint_from_profile (r,
+ val
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (status == 1)
+ return;
+ // @@ Else we should check for potential forwarding here.
+ }
+ }
+ }
+
+ // We have tried all the profiles specified in the client protocol
+ // policy with no success. Throw exception.
+ if (!valid_profile_found)
+ {
+ if (r.inconsistent_policies ())
+ {
+ CORBA::PolicyList *p =
+ r.inconsistent_policies ();
+
+ p->length (1);
+ (*p)[0u] =
+ CORBA::Policy::_duplicate (client_protocol_policy);
+ }
+ ACE_THROW (CORBA::INV_POLICY ());
+ }
+
+ // If we get here, we found at least one pertinent profile, but no
+ // usable endpoints.
+ ACE_THROW (CORBA::TRANSIENT (CORBA::OMGVMCID | 2,
+ CORBA::COMPLETED_NO));
+
+}
+
+int
+TAO_RT_Invocation_Endpoint_Selector::endpoint_from_profile (
+ TAO::Profile_Transport_Resolver &r,
+ ACE_Time_Value *val
+ ACE_ENV_ARG_DECL)
+{
+ // Narrow to the RT Stub.
+ TAO_RT_Stub *rt_stub =
+ dynamic_cast <TAO_RT_Stub *> (r.stub ());
+
+ // Get the priority model policy.
+ CORBA::Policy_var priority_model_policy =
+ rt_stub->get_cached_policy (TAO_CACHED_POLICY_PRIORITY_MODEL
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ // Get the bands policy.
+ CORBA::Policy_var bands_policy =
+ TAO_RT_Endpoint_Utils::policy (TAO_CACHED_POLICY_RT_PRIORITY_BANDED_CONNECTION,
+ r
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ int all_endpoints_are_valid = 0;
+ int match_priority = 0;
+ int match_bands = 0;
+ CORBA::Short client_thread_priority = 0;
+ CORBA::Short min_priority = 0;
+ CORBA::Short max_priority = 0;
+
+ // If the priority model policy is not set.
+ if (priority_model_policy.ptr () == 0)
+ {
+ // Bands without priority model do not make sense.
+ if (bands_policy.ptr () != 0)
+ {
+ if (r.inconsistent_policies ())
+ {
+ CORBA::PolicyList *p =
+ r.inconsistent_policies ();
+
+ p->length (1);
+ (*p)[0u] =
+ CORBA::Policy::_duplicate (bands_policy.in ());
+ }
+ // Indicate error.
+ ACE_THROW_RETURN (CORBA::INV_POLICY (), 0);
+ }
+
+ // No priority model policy (and no bands policy): all endpoints
+ // are fair game.
+ all_endpoints_are_valid = 1;
+ }
+ // If the priority model policy is set.
+ else
+ {
+ // Get the protocol hooks.
+ TAO_Protocols_Hooks *protocol_hooks =
+ r.stub ()->orb_core ()->get_protocols_hooks ();
+
+ CORBA::Short server_priority = 0;
+ CORBA::Boolean is_client_propagated = 0;
+
+ // Check the priority model policy to see if it is client
+ // propagated.
+ protocol_hooks->get_selector_hook (priority_model_policy.in (),
+ is_client_propagated,
+ server_priority);
+
+ if (!is_client_propagated)
+ {
+ // Server declared: all endpoints are fair game.
+ all_endpoints_are_valid = 1;
+ }
+ // Client propagated.
+ else
+ {
+ // Get client thread priority.
+ int status =
+ protocol_hooks->get_thread_CORBA_priority (
+ client_thread_priority // side effect
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+ if (status == -1)
+ {
+ ACE_THROW_RETURN (CORBA::DATA_CONVERSION (CORBA::OMGVMCID | 1,
+ CORBA::COMPLETED_NO),
+ 0);
+ }
+
+ // If there are no bands.
+ if (bands_policy.ptr () == 0)
+ {
+
+ // Match the priority of the client thread with the
+ // endpoint.
+ match_priority = 1;
+ }
+ // There are bands.
+ else
+ {
+
+ // Check which band range we fall in.
+ int in_range = 0;
+ protocol_hooks->get_selector_bands_policy_hook (
+ bands_policy.in (),
+ client_thread_priority,
+ min_priority,
+ max_priority,
+ in_range);
+
+ // If priority doesn't fall into any of the bands.
+ if (!in_range)
+ {
+ if (r.inconsistent_policies ())
+ {
+
+ CORBA::PolicyList *p =
+ r.inconsistent_policies ();
+ p->length (2);
+ (*p)[0u] =
+ CORBA::Policy::_duplicate (bands_policy.in ());
+ (*p)[1u] =
+ CORBA::Policy::_duplicate (
+ priority_model_policy.in ());
+ }
+
+ // Indicate error.
+ ACE_THROW_RETURN (CORBA::INV_POLICY (),
+ 0);
+ }
+
+ // Match the priority of the band with the endpoint.
+ match_bands = 1;
+ }
+ }
+ }
+
+ TAO_Endpoint *ep =
+ r.profile ()->endpoint ();
+
+ while (ep != 0)
+ {
+ // Get the priority of the endpoint.
+ CORBA::Short endpoint_priority =
+ ep->priority ();
+
+ // If <all_endpoints_are_valid> or match the priority of the
+ // client thread or match the priority of the band or
+ // profile contains just one endpoint. This happens when:
+ // a) we are talking to a nonTAO server (which doesn't have
+ // the concept of multiple endpoints per profile)
+ // or
+ // b) we have TAO server with a non-lane threadpool, in which
+ // case there is only one acceptor
+ // In both cases we should use the endpoint regardless of its priority.
+
+ if (all_endpoints_are_valid ||
+ (match_priority &&
+ client_thread_priority == endpoint_priority) ||
+ (match_bands &&
+ endpoint_priority <= max_priority &&
+ endpoint_priority >= min_priority) ||
+ r.profile ()->endpoint_count () == 1 &&
+ endpoint_priority == TAO_INVALID_PRIORITY)
+ {
+ TAO_RT_Transport_Descriptor_Private_Connection_Property
+ private_connection_descriptor_property;
+
+ TAO_RT_Transport_Descriptor_Banded_Connection_Property
+ banded_connection_descriptor_property;
+
+ TAO_RT_Transport_Descriptor
+ rt_transport_descriptor (ep);
+
+ CORBA::Policy_var private_connection_policy =
+ rt_stub->get_cached_policy (TAO_CACHED_POLICY_RT_PRIVATE_CONNECTION
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ if (!CORBA::is_nil (private_connection_policy.in ()))
+ {
+ private_connection_descriptor_property.init
+ (static_cast<long> (reinterpret_cast<ptrdiff_t> (r.stub ())));
+ rt_transport_descriptor.insert
+ (&private_connection_descriptor_property);
+ }
+
+ if (match_bands)
+ {
+ banded_connection_descriptor_property.init
+ (min_priority, max_priority);
+
+ rt_transport_descriptor.insert
+ (&banded_connection_descriptor_property);
+ }
+
+ bool status =
+ r.try_connect (&rt_transport_descriptor,
+ val
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ // Check if the invocation has completed.
+ if (status == true)
+ return 1;
+ }
+
+ // Go to the next endpoint in this profile.
+ ep = ep->next();
+ }
+
+ return 0;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
diff --git a/TAO/tao/RTCORBA/RT_Invocation_Endpoint_Selectors.h b/TAO/tao/RTCORBA/RT_Invocation_Endpoint_Selectors.h
new file mode 100644
index 00000000000..4c6d75e022e
--- /dev/null
+++ b/TAO/tao/RTCORBA/RT_Invocation_Endpoint_Selectors.h
@@ -0,0 +1,77 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file RT_Invocation_Endpoint_Selectors.h
+ *
+ * $Id$
+ *
+ * Strategies for selecting profile/endpoint from an IOR for making an
+ * invocation.
+ *
+ *
+ * @author Priyanka Gontla <pgontla@ece.uci.edu>
+ */
+//=============================================================================
+
+
+#ifndef TAO_RT_INVOCATION_ENDPOINT_SELECTOR_H
+#define TAO_RT_INVOCATION_ENDPOINT_SELECTOR_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/RTCORBA/rtcorba_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/orbconf.h"
+
+#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
+
+#include "tao/RTCORBA/RTCORBA.h"
+
+#include "tao/Invocation_Endpoint_Selectors.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_RT_Invocation_Endpoint_Selector
+ *
+ * @brief TAO_RT_Invocation_Endpoint_Selector
+ *
+ * This strategy is used when the only policy that might be set is the
+ * private connection policy.
+ *
+ **/
+class TAO_RTCORBA_Export TAO_RT_Invocation_Endpoint_Selector
+ : public TAO_Invocation_Endpoint_Selector
+{
+public:
+
+ virtual void select_endpoint (TAO::Profile_Transport_Resolver *r,
+ ACE_Time_Value *val
+ ACE_ENV_ARG_DECL);
+
+protected:
+ void select_endpoint_based_on_client_protocol_policy (
+ TAO::Profile_Transport_Resolver &r,
+ RTCORBA::ClientProtocolPolicy_ptr client_protocol_policy,
+ RTCORBA::ProtocolList &protocols,
+ ACE_Time_Value *v
+ ACE_ENV_ARG_DECL
+ );
+
+ int endpoint_from_profile (TAO::Profile_Transport_Resolver &r,
+ ACE_Time_Value *v
+ ACE_ENV_ARG_DECL);
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_RT_INVOCATION_ENDPOINT_SELECTOR_H */
diff --git a/TAO/tao/RTCORBA/RT_Mutex.cpp b/TAO/tao/RTCORBA/RT_Mutex.cpp
new file mode 100644
index 00000000000..701505481ee
--- /dev/null
+++ b/TAO/tao/RTCORBA/RT_Mutex.cpp
@@ -0,0 +1,97 @@
+// $Id$
+#include "tao/RTCORBA/RT_Mutex.h"
+
+#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
+
+#include "tao/RTCORBA/RT_ORB.h"
+#include "ace/OS_NS_sys_time.h"
+
+ACE_RCSID(RTCORBA,
+ RT_Mutex,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_RT_Mutex::~TAO_RT_Mutex (void)
+{
+}
+
+void
+TAO_RT_Mutex::lock (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ if (this->mu_.acquire () != 0)
+ ACE_THROW (CORBA::INTERNAL ());
+}
+
+void
+TAO_RT_Mutex::unlock (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ if (this->mu_.release () != 0)
+ ACE_THROW (CORBA::INTERNAL ());
+}
+
+CORBA::Boolean
+TAO_RT_Mutex::try_lock (TimeBase::TimeT wait_time
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ int result;
+
+ if (wait_time == 0)
+ // No wait.
+ result = this->mu_.tryacquire ();
+ else
+ {
+ // Wait for the specified amount of time before giving up.
+ // (wait_time units are 100ns. See TimeBase.pidl)
+ TimeBase::TimeT seconds = wait_time / 10000000u;
+ TimeBase::TimeT microseconds = (wait_time % 10000000u) / 10;
+
+ ACE_Time_Value relative_time (ACE_U64_TO_U32 (seconds),
+ ACE_U64_TO_U32 (microseconds));
+
+ ACE_Time_Value absolute_time =
+ relative_time +
+ ACE_OS::gettimeofday ();
+
+ result = this->mu_.acquire (absolute_time);
+ }
+
+ if (result == 0)
+ return 1;
+ else if (result == -1 &&
+ (errno == ETIME ||
+ errno == EBUSY))
+ return 0;
+ else
+ // Some really bad error.
+ ACE_THROW_RETURN (CORBA::INTERNAL (), 0);
+}
+
+const char *
+TAO_RT_Mutex::name (void) const
+{
+ return 0;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+#if (TAO_HAS_NAMED_RT_MUTEXES == 1)
+TAO_Named_RT_Mutex::TAO_Named_RT_Mutex (const char *name)
+ : name_ (name)
+{
+}
+
+const char *
+TAO_Named_RT_Mutex::name (void) const
+{
+ return this->name_.c_str ();
+}
+#endif /* TAO_HAS_NAMED_RT_MUTEXES == 1 */
+
+///////////////////////////////////////////////////////////////////////////////
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
diff --git a/TAO/tao/RTCORBA/RT_Mutex.h b/TAO/tao/RTCORBA/RT_Mutex.h
new file mode 100644
index 00000000000..2381712964f
--- /dev/null
+++ b/TAO/tao/RTCORBA/RT_Mutex.h
@@ -0,0 +1,123 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file RT_Mutex.h
+ *
+ * $Id$
+ *
+ * @author Frank Hunleth <fhunleth@cs.wustl.edu>
+ */
+//=============================================================================
+
+
+#ifndef TAO_RT_MUTEX_H
+#define TAO_RT_MUTEX_H
+
+#include /**/ "ace/pre.h"
+#include "tao/orbconf.h"
+
+#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#define TAO_RTCORBA_SAFE_INCLUDE
+#include "tao/RTCORBA/RTCORBAC.h"
+#undef TAO_RTCORBA_SAFE_INCLUDE
+
+#include "tao/LocalObject.h"
+
+#if (TAO_HAS_NAMED_RT_MUTEXES == 1)
+# include "ace/SString.h"
+#endif /* TAO_HAS_NAMED_RT_MUTEXES == 1 */
+
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_RT_Mutex
+ *
+ * @brief Abstract base class for the TAO RT Mutex implementations
+ *
+ * This class just serves as a base class for any of the TAO
+ * RT Mutex implementations. Instances of these classes should
+ * be created using the RTCORBA::create_mutex() method.
+ *
+ */
+
+class TAO_RTCORBA_Export TAO_RT_Mutex
+ : public RTCORBA::Mutex,
+ public TAO_Local_RefCounted_Object
+{
+public:
+
+ /// Acquire the lock.
+ virtual void lock (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Release the lock.
+ virtual void unlock (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /**
+ * Acquire the lock, but only wait up to @a max_wait time. Note
+ * that this operation may not be available on all OS platforms, so
+ * if you're interested in writing maximally portable programs avoid
+ * using this operation in your program designs.
+ */
+ virtual CORBA::Boolean try_lock (TimeBase::TimeT max_wait
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Returns the name of the mutex.
+ virtual const char *name (void) const;
+
+protected:
+
+ /// Destructor.
+ virtual ~TAO_RT_Mutex (void);
+
+protected:
+ /// Synchronization lock.
+ TAO_SYNCH_MUTEX mu_;
+};
+
+#if (TAO_HAS_NAMED_RT_MUTEXES == 1)
+/**
+ * @class TAO_Named_RT_Mutex
+ *
+ * @brief Extension to TAO_RT_Mutex to support named mutexes.
+ *
+ */
+class TAO_RTCORBA_Export TAO_Named_RT_Mutex : public TAO_RT_Mutex
+{
+public:
+ /// Constructor.
+ TAO_Named_RT_Mutex (const char *name);
+
+ /// Returns the name of the mutex.
+ virtual const char *name (void) const;
+
+protected:
+
+ /// My name.
+ ACE_CString name_;
+};
+#endif /* TAO_HAS_NAMED_RT_MUTEXES == 1 */
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_RT_MUTEX_H */
diff --git a/TAO/tao/RTCORBA/RT_ORB.cpp b/TAO/tao/RTCORBA/RT_ORB.cpp
new file mode 100644
index 00000000000..7f6e2cc028b
--- /dev/null
+++ b/TAO/tao/RTCORBA/RT_ORB.cpp
@@ -0,0 +1,559 @@
+// $Id$
+
+#include "tao/RTCORBA/RT_ORB.h"
+
+#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
+
+#include "tao/RTCORBA/RT_Policy_i.h"
+#include "tao/RTCORBA/RT_Mutex.h"
+#include "tao/RTCORBA/Priority_Mapping_Manager.h"
+#include "tao/ORB_Core.h"
+#include "tao/ORB.h"
+#include "tao/RTCORBA/Thread_Pool.h"
+#include "tao/RTCORBA/RT_Thread_Lane_Resources_Manager.h"
+#include "ace/Sched_Params.h"
+
+ACE_RCSID(RTCORBA,
+ RT_ORB,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_RT_ORB::TAO_RT_ORB (TAO_ORB_Core *orb_core,
+ ACE_Time_Value const &dynamic_thread_idle_timeout)
+ : orb_core_ (orb_core),
+ mutex_mgr_ (),
+ tp_manager_ (0),
+ dynamic_thread_idle_timeout_ (dynamic_thread_idle_timeout)
+{
+ TAO_Thread_Lane_Resources_Manager *thread_lane_resources_manager =
+ &this->orb_core_->thread_lane_resources_manager ();
+
+ TAO_RT_Thread_Lane_Resources_Manager *rt_thread_lane_resources_manager =
+ dynamic_cast <TAO_RT_Thread_Lane_Resources_Manager *> (thread_lane_resources_manager);
+
+ this->tp_manager_ =
+ &rt_thread_lane_resources_manager->tp_manager ();
+}
+
+TAO_RT_ORB::~TAO_RT_ORB (void)
+{
+}
+
+RTCORBA::Mutex_ptr
+TAO_RT_ORB::create_mutex (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return this->mutex_mgr_.create_mutex (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+void
+TAO_RT_ORB::destroy_mutex (RTCORBA::Mutex_ptr mutex
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->mutex_mgr_.destroy_mutex (mutex
+ ACE_ENV_ARG_PARAMETER);
+}
+
+
+RTCORBA::Mutex_ptr
+TAO_RT_ORB::create_named_mutex (const char *name,
+ CORBA::Boolean_out created_flag
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return this->mutex_mgr_.create_named_mutex (name,
+ created_flag
+ ACE_ENV_ARG_PARAMETER);
+}
+
+RTCORBA::Mutex_ptr
+TAO_RT_ORB::open_named_mutex (const char *name
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ RTCORBA::RTORB::MutexNotFound))
+{
+ return this->mutex_mgr_.open_named_mutex (name
+ ACE_ENV_ARG_PARAMETER);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+
+TAO_Named_RT_Mutex_Manager::TAO_Named_RT_Mutex_Manager (void)
+{
+}
+
+TAO_Named_RT_Mutex_Manager::~TAO_Named_RT_Mutex_Manager (void)
+{
+}
+
+RTCORBA::Mutex_ptr
+TAO_Named_RT_Mutex_Manager::create_mutex (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ TAO_RT_Mutex *mutex = 0;
+ ACE_NEW_THROW_EX (mutex,
+ TAO_RT_Mutex (),
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (RTCORBA::Mutex::_nil ());
+
+ return mutex;
+}
+
+// If Named RT_Mutexes aren't enabled, this function is a nop
+// as also indicated by the comment below.
+#if (TAO_HAS_NAMED_RT_MUTEXES == 1)
+void
+TAO_Named_RT_Mutex_Manager::destroy_mutex (RTCORBA::Mutex_ptr mutex
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ TAO_RT_Mutex *tao_mutex =
+ dynamic_cast<TAO_RT_Mutex *> (mutex);
+
+ // If this mutex is named, then we need to remove it from our table.
+ // Otherwise, we don't have to do anything.
+ const char *name = tao_mutex->name ();
+ if (name != 0)
+ {
+ // The following should be atomic.
+ ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX,
+ monitor,
+ this->lock_,
+ CORBA::INTERNAL ());
+ ACE_CHECK;
+
+ int result =
+ this->map_.unbind (name);
+
+ if (result != 0)
+ ACE_THROW (CORBA::INTERNAL ());
+ }
+}
+#else /* TAO_HAS_NAMED_RT_MUTEXES == 1 */
+void
+TAO_Named_RT_Mutex_Manager::destroy_mutex (RTCORBA::Mutex_ptr
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+}
+#endif /* TAO_HAS_NAMED_RT_MUTEXES == 1 */
+
+RTCORBA::Mutex_ptr
+TAO_Named_RT_Mutex_Manager::create_named_mutex (const char *name,
+ CORBA::Boolean_out created_flag
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+#if (TAO_HAS_NAMED_RT_MUTEXES == 1)
+ // The following should be atomic.
+ ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX,
+ monitor,
+ this->lock_,
+ CORBA::INTERNAL ());
+ ACE_CHECK_RETURN (RTCORBA::Mutex::_nil ());
+
+ // Optimistic that we'll find it.
+ created_flag = 0;
+
+ // If we find the mutex, simply return it.
+ RTCORBA::Mutex_var mutex;
+ if (this->map_.find (name,
+ mutex) != 0)
+ {
+ // Oops, we didn't find it.
+ created_flag = 1;
+
+ RTCORBA::Mutex_ptr tmp_mutex;
+
+ // Create a new one.
+ ACE_NEW_THROW_EX (tmp_mutex,
+ TAO_Named_RT_Mutex (name),
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (RTCORBA::Mutex::_nil ());
+
+ mutex = tmp_mutex;
+
+ // Add it to the map.
+ int result =
+ this->map_.bind (name,
+ mutex);
+
+ if (result != 0)
+ ACE_THROW_RETURN (CORBA::INTERNAL (),
+ RTCORBA::Mutex::_nil ());
+ }
+
+ // Return the one we found or created.
+ return mutex._retn ();
+#else /* TAO_HAS_NAMED_RT_MUTEXES */
+ ACE_UNUSED_ARG (name);
+ ACE_UNUSED_ARG (created_flag);
+ ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (),
+ RTCORBA::Mutex::_nil ());
+#endif /* TAO_HAS_NAMED_RT_MUTEXES */
+}
+
+RTCORBA::Mutex_ptr
+TAO_Named_RT_Mutex_Manager::open_named_mutex (const char *name
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ RTCORBA::RTORB::MutexNotFound))
+{
+#if (TAO_HAS_NAMED_RT_MUTEXES == 1)
+ // The following should be atomic.
+ ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX,
+ monitor,
+ this->lock_,
+ CORBA::INTERNAL ());
+ ACE_CHECK_RETURN (RTCORBA::Mutex::_nil ());
+
+ // If we find the mutex, simply return it.
+ RTCORBA::Mutex_var mutex;
+ if (this->map_.find (name,
+ mutex) != 0)
+ ACE_THROW_RETURN (RTCORBA::RTORB::MutexNotFound (),
+ RTCORBA::Mutex::_nil ());
+
+ // Return the one we found.
+ return mutex._retn ();
+#else /* TAO_HAS_NAMED_RT_MUTEXES */
+ ACE_UNUSED_ARG (name);
+ ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (),
+ RTCORBA::Mutex::_nil ());
+#endif /* TAO_HAS_NAMED_RT_MUTEXES */
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+RTCORBA::TCPProtocolProperties_ptr
+TAO_RT_ORB::create_tcp_protocol_properties (CORBA::Long send_buffer_size,
+ CORBA::Long recv_buffer_size,
+ CORBA::Boolean keep_alive,
+ CORBA::Boolean dont_route,
+ CORBA::Boolean no_delay,
+ CORBA::Boolean enable_network_priority
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException ))
+{
+ TAO_TCP_Protocol_Properties *tmp = 0;
+ ACE_NEW_THROW_EX (tmp,
+ TAO_TCP_Protocol_Properties (send_buffer_size,
+ recv_buffer_size,
+ keep_alive,
+ dont_route,
+ no_delay,
+ enable_network_priority),
+ CORBA::NO_MEMORY (TAO::VMCID,
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (RTCORBA::TCPProtocolProperties::_nil ());
+
+ return tmp;
+}
+
+RTCORBA::UnixDomainProtocolProperties_ptr
+TAO_RT_ORB::create_unix_domain_protocol_properties (
+ CORBA::Long send_buffer_size,
+ CORBA::Long recv_buffer_size
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ TAO_UnixDomain_Protocol_Properties *tmp = 0;
+ ACE_NEW_THROW_EX (tmp,
+ TAO_UnixDomain_Protocol_Properties (
+ send_buffer_size,
+ recv_buffer_size),
+ CORBA::NO_MEMORY (TAO::VMCID,
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (RTCORBA::UnixDomainProtocolProperties::_nil ());
+
+ return tmp;
+}
+
+RTCORBA::SharedMemoryProtocolProperties_ptr
+TAO_RT_ORB::create_shared_memory_protocol_properties (
+ CORBA::Long send_buffer_size,
+ CORBA::Long recv_buffer_size,
+ CORBA::Boolean keep_alive,
+ CORBA::Boolean dont_route,
+ CORBA::Boolean no_delay,
+ CORBA::Long preallocate_buffer_size,
+ const char *mmap_filename,
+ const char *mmap_lockname
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ TAO_SharedMemory_Protocol_Properties *tmp = 0;
+ ACE_NEW_THROW_EX (tmp,
+ TAO_SharedMemory_Protocol_Properties (send_buffer_size,
+ recv_buffer_size,
+ keep_alive,
+ dont_route,
+ no_delay,
+ preallocate_buffer_size,
+ mmap_filename,
+ mmap_lockname),
+ CORBA::NO_MEMORY (TAO::VMCID,
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (RTCORBA::SharedMemoryProtocolProperties::_nil ());
+
+ return tmp;
+}
+
+RTCORBA::UserDatagramProtocolProperties_ptr
+TAO_RT_ORB::create_user_datagram_protocol_properties (
+ CORBA::Boolean enable_network_priority
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ TAO_UserDatagram_Protocol_Properties *tmp = 0;
+ ACE_NEW_THROW_EX (tmp,
+ TAO_UserDatagram_Protocol_Properties (
+ enable_network_priority),
+ CORBA::NO_MEMORY (TAO::VMCID,
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (RTCORBA::UserDatagramProtocolProperties::_nil ());
+
+ return tmp;
+}
+
+RTCORBA::StreamControlProtocolProperties_ptr
+TAO_RT_ORB::create_stream_control_protocol_properties (
+ CORBA::Long send_buffer_size,
+ CORBA::Long recv_buffer_size,
+ CORBA::Boolean keep_alive,
+ CORBA::Boolean dont_route,
+ CORBA::Boolean no_delay,
+ CORBA::Boolean enable_network_priority
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ TAO_StreamControl_Protocol_Properties *tmp = 0;
+ ACE_NEW_THROW_EX (tmp,
+ TAO_StreamControl_Protocol_Properties (
+ send_buffer_size,
+ recv_buffer_size,
+ keep_alive,
+ dont_route,
+ no_delay,
+ enable_network_priority),
+ CORBA::NO_MEMORY (TAO::VMCID,
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (RTCORBA::StreamControlProtocolProperties::_nil ());
+
+ return tmp;
+}
+
+RTCORBA::ThreadpoolId
+TAO_RT_ORB::create_threadpool (CORBA::ULong stacksize,
+ CORBA::ULong static_threads,
+ CORBA::ULong dynamic_threads,
+ RTCORBA::Priority default_priority,
+ CORBA::Boolean allow_request_buffering,
+ CORBA::ULong max_buffered_requests,
+ CORBA::ULong max_request_buffer_size
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return this->tp_manager_->create_threadpool (stacksize,
+ static_threads,
+ dynamic_threads,
+ default_priority,
+ allow_request_buffering,
+ max_buffered_requests,
+ max_request_buffer_size,
+ this->dynamic_thread_idle_timeout_
+ ACE_ENV_ARG_PARAMETER);
+}
+
+RTCORBA::ThreadpoolId
+TAO_RT_ORB::create_threadpool_with_lanes (CORBA::ULong stacksize,
+ const RTCORBA::ThreadpoolLanes &lanes,
+ CORBA::Boolean allow_borrowing,
+ CORBA::Boolean allow_request_buffering,
+ CORBA::ULong max_buffered_requests,
+ CORBA::ULong max_request_buffer_size
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return this->tp_manager_->create_threadpool_with_lanes (stacksize,
+ lanes,
+ allow_borrowing,
+ allow_request_buffering,
+ max_buffered_requests,
+ max_request_buffer_size,
+ this->dynamic_thread_idle_timeout_
+ ACE_ENV_ARG_PARAMETER);
+}
+
+void
+TAO_RT_ORB::destroy_threadpool (RTCORBA::ThreadpoolId threadpool
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ RTCORBA::RTORB::InvalidThreadpool))
+{
+ this->tp_manager_->destroy_threadpool (threadpool
+ ACE_ENV_ARG_PARAMETER);
+}
+
+RTCORBA::PriorityModelPolicy_ptr
+TAO_RT_ORB::create_priority_model_policy (RTCORBA::PriorityModel priority_model,
+ RTCORBA::Priority server_priority
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ TAO_PriorityModelPolicy *tmp = 0;
+ ACE_NEW_THROW_EX (tmp,
+ TAO_PriorityModelPolicy (priority_model, server_priority),
+ CORBA::NO_MEMORY (TAO::VMCID,
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (RTCORBA::PriorityModelPolicy::_nil ());
+
+ return tmp;
+}
+
+RTCORBA::ThreadpoolPolicy_ptr
+TAO_RT_ORB::create_threadpool_policy (RTCORBA::ThreadpoolId threadpool
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ TAO_ThreadpoolPolicy *tmp = 0;
+ ACE_NEW_THROW_EX (tmp,
+ TAO_ThreadpoolPolicy (threadpool),
+ CORBA::NO_MEMORY (TAO::VMCID,
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (RTCORBA::ThreadpoolPolicy::_nil ());
+
+ return tmp;
+}
+
+RTCORBA::PriorityBandedConnectionPolicy_ptr
+TAO_RT_ORB::create_priority_banded_connection_policy (const
+ RTCORBA::PriorityBands & priority_bands
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ TAO_PriorityBandedConnectionPolicy *tmp = 0;
+ ACE_NEW_THROW_EX (tmp,
+ TAO_PriorityBandedConnectionPolicy (priority_bands),
+ CORBA::NO_MEMORY (TAO::VMCID,
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (RTCORBA::PriorityBandedConnectionPolicy::_nil ());
+
+ return tmp;
+}
+
+RTCORBA::PrivateConnectionPolicy_ptr
+TAO_RT_ORB::create_private_connection_policy (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ TAO_PrivateConnectionPolicy *tmp = 0;
+ ACE_NEW_THROW_EX (tmp,
+ TAO_PrivateConnectionPolicy (),
+ CORBA::NO_MEMORY (TAO::VMCID,
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (RTCORBA::PrivateConnectionPolicy::_nil ());
+
+ return tmp;
+}
+
+RTCORBA::ServerProtocolPolicy_ptr
+TAO_RT_ORB::create_server_protocol_policy (const RTCORBA::ProtocolList & protocols
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ TAO_ServerProtocolPolicy *tmp = 0;
+ ACE_NEW_THROW_EX (tmp,
+ TAO_ServerProtocolPolicy (protocols),
+ CORBA::NO_MEMORY (TAO::VMCID,
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (RTCORBA::ServerProtocolPolicy::_nil ());
+
+ return tmp;
+}
+
+RTCORBA::ClientProtocolPolicy_ptr
+TAO_RT_ORB::create_client_protocol_policy (const RTCORBA::ProtocolList & protocols
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ TAO_ClientProtocolPolicy *tmp = 0;
+ ACE_NEW_THROW_EX (tmp,
+ TAO_ClientProtocolPolicy (protocols),
+ CORBA::NO_MEMORY (TAO::VMCID,
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (RTCORBA::ClientProtocolPolicy::_nil ());
+
+ return tmp;
+}
+
+TAO_Thread_Pool_Manager &
+TAO_RT_ORB::tp_manager (void) const
+{
+ return *this->tp_manager_;
+}
+
+TAO_ORB_Core *
+TAO_RT_ORB::orb_core (void) const
+{
+ return this->orb_core_;
+}
+
+/* static */
+int
+TAO_RT_ORB::modify_thread_scheduling_policy (CORBA::ORB_ptr orb)
+{
+ //
+ // This method changes the scheduling policy of the calling thread
+ // to match the scheduling policy specified in the svc.conf file.
+ // The priority of the calling thread will be set to the minimum
+ // priority supported by that scheduling policy.
+ //
+ // This method make sense on those platform (e.g., Linux) where
+ // PTHREAD_SCOPE_SYSTEM is the only scheduling scope supported. On
+ // other platforms, this method is a no-op since the only way to get
+ // the real-time threading behavior is to setup the
+ // PTHREAD_SCOPE_SYSTEM scheduling scope when a thread is being
+ // created. On such platforms, one can set the correct scheduling
+ // scope and policy when creating the thread, thus not needing to
+ // use this method.
+ //
+
+#if defined (linux)
+
+ int sched_policy =
+ orb->orb_core ()->orb_params ()->ace_sched_policy ();
+
+ int minimum_priority =
+ ACE_Sched_Params::priority_min (sched_policy);
+
+ ACE_hthread_t thread_id;
+ ACE_Thread::self (thread_id);
+
+ return ACE_Thread::setprio (thread_id,
+ minimum_priority,
+ sched_policy);
+
+#else /* linux */
+
+ ACE_UNUSED_ARG (orb);
+ ACE_NOTSUP_RETURN (-1);
+
+#endif /* linux */
+
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+///////////////////////////////////////////////////////////////////////////////
+
+#endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
diff --git a/TAO/tao/RTCORBA/RT_ORB.h b/TAO/tao/RTCORBA/RT_ORB.h
new file mode 100644
index 00000000000..612108d048d
--- /dev/null
+++ b/TAO/tao/RTCORBA/RT_ORB.h
@@ -0,0 +1,337 @@
+/* -*- C++ -*- */
+//=============================================================================
+/**
+ * @file RT_ORB.h
+ *
+ * $Id$
+ *
+ * @author Marina Spivak <marina@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_RT_ORB_H
+#define TAO_RT_ORB_H
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#define TAO_RTCORBA_SAFE_INCLUDE
+#include "tao/RTCORBA/RTCORBAC.h"
+#undef TAO_RTCORBA_SAFE_INCLUDE
+
+#include "tao/LocalObject.h"
+#include "ace/Hash_Map_Manager_T.h"
+
+#if (TAO_HAS_NAMED_RT_MUTEXES == 1)
+# include "ace/Null_Mutex.h"
+#endif
+
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Forward reference for TAO_Named_RT_Mutex_Manager
+class TAO_RT_Mutex;
+class TAO_Thread_Pool_Manager;
+
+/**
+ * @class TAO_Named_RT_Mutex_Manager
+ *
+ * @brief Manages the names of named and unnamed RT Mutexes
+ *
+ */
+
+class TAO_RTCORBA_Export TAO_Named_RT_Mutex_Manager
+{
+
+public:
+ /// Constructor.
+ TAO_Named_RT_Mutex_Manager (void);
+
+ /// Destructor.
+ ~TAO_Named_RT_Mutex_Manager (void);
+
+ RTCORBA::Mutex_ptr create_mutex (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ void destroy_mutex (RTCORBA::Mutex_ptr the_mutex
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ RTCORBA::Mutex_ptr create_named_mutex (const char *name,
+ CORBA::Boolean_out created_flag
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ RTCORBA::Mutex_ptr open_named_mutex (const char * name
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ RTCORBA::RTORB::MutexNotFound
+ ));
+
+private:
+
+#if (TAO_HAS_NAMED_RT_MUTEXES == 1)
+ /// Hash map for named RT Mutexes
+ ACE_Hash_Map_Manager_Ex<
+ ACE_CString,
+ RTCORBA::Mutex_var,
+ ACE_Hash<ACE_CString>,
+ ACE_Equal_To<ACE_CString>,
+ ACE_Null_Mutex> map_;
+
+ TAO_SYNCH_MUTEX lock_;
+#endif /* TAO_HAS_NAMED_RT_MUTEXES == 1 */
+};
+
+
+/**
+ * @class TAO_RT_ORB
+ *
+ * @brief RTCORBA::RTORB implementation
+ *
+ * Creates and destroys RT CORBA objects, i.e., policies,
+ * threadpools, mutexes.
+ */
+class TAO_RTCORBA_Export TAO_RT_ORB
+ : public RTCORBA::RTORB,
+ public TAO_Local_RefCounted_Object
+{
+public:
+
+ /// Constructor.
+ TAO_RT_ORB (TAO_ORB_Core *orb_core, ACE_Time_Value const &dynamic_thread_idle_timeout);
+
+ /**
+ * Create a new mutex. Mutexes returned by this method
+ * are the same as those used internally by the ORB, so that
+ * consistant priority inheritance/piority ceiling semantics
+ * can be guaranteed.
+ */
+ virtual RTCORBA::Mutex_ptr create_mutex (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /**
+ * Destroy a mutex. Currently this is a no-op since RTCORBA::Mutex
+ * instances are destroyed as soon as their reference counts go to
+ * 0.
+ */
+ virtual void destroy_mutex (RTCORBA::Mutex_ptr the_mutex
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /**
+ * Create a mutex and assign a name to it. If the
+ * mutex already exists, it is returned and the created_flag
+ * is set to 0.
+ */
+ virtual RTCORBA::Mutex_ptr create_named_mutex (const char *name,
+ CORBA::Boolean_out created_flag
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Retrieve a previously created mutex.
+ virtual RTCORBA::Mutex_ptr open_named_mutex (const char * name
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS )
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ RTCORBA::RTORB::MutexNotFound
+ ));
+
+ /**
+ * Create and return a TCPProtocolProperties instance with the specified
+ * parameters.
+ */
+ RTCORBA::TCPProtocolProperties_ptr
+ create_tcp_protocol_properties (
+ CORBA::Long send_buffer_size,
+ CORBA::Long recv_buffer_size,
+ CORBA::Boolean keep_alive,
+ CORBA::Boolean dont_route,
+ CORBA::Boolean no_delay,
+ CORBA::Boolean enable_network_priority
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException ));
+
+ RTCORBA::UnixDomainProtocolProperties_ptr
+ create_unix_domain_protocol_properties (
+ CORBA::Long send_buffer_size,
+ CORBA::Long recv_buffer_size
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ RTCORBA::SharedMemoryProtocolProperties_ptr
+ create_shared_memory_protocol_properties (
+ CORBA::Long send_buffer_size,
+ CORBA::Long recv_buffer_size,
+ CORBA::Boolean keep_alive,
+ CORBA::Boolean dont_route,
+ CORBA::Boolean no_delay,
+ CORBA::Long preallocate_buffer_size,
+ const char *mmap_filename,
+ const char *mmap_lockname
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ RTCORBA::UserDatagramProtocolProperties_ptr
+ create_user_datagram_protocol_properties (
+ CORBA::Boolean enable_network_priority
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ RTCORBA::StreamControlProtocolProperties_ptr
+ create_stream_control_protocol_properties (
+ CORBA::Long send_buffer_size,
+ CORBA::Long recv_buffer_size,
+ CORBA::Boolean keep_alive,
+ CORBA::Boolean dont_route,
+ CORBA::Boolean no_delay,
+ CORBA::Boolean enable_network_priority
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Create a RTCORBA threadpool to manage a set of threads without lanes.
+ virtual RTCORBA::ThreadpoolId
+ create_threadpool (CORBA::ULong stacksize,
+ CORBA::ULong static_threads,
+ CORBA::ULong dynamic_threads,
+ RTCORBA::Priority default_priority,
+ CORBA::Boolean allow_request_buffering,
+ CORBA::ULong max_buffered_requests,
+ CORBA::ULong max_request_buffer_size
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /**
+ * Create a threadpool and separate it into subsets based on
+ * priorities.
+ */
+ virtual RTCORBA::ThreadpoolId
+ create_threadpool_with_lanes (CORBA::ULong stacksize,
+ const RTCORBA::ThreadpoolLanes & lanes,
+ CORBA::Boolean allow_borrowing,
+ CORBA::Boolean allow_request_buffering,
+ CORBA::ULong max_buffered_requests,
+ CORBA::ULong max_request_buffer_size
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Free the resources associated with the specified threadpool.
+ virtual void destroy_threadpool (RTCORBA::ThreadpoolId threadpool
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ RTCORBA::RTORB::InvalidThreadpool));
+
+ /// Create a priority model policy for use when configuring a POA.
+ virtual RTCORBA::PriorityModelPolicy_ptr
+ create_priority_model_policy (
+ RTCORBA::PriorityModel priority_model,
+ RTCORBA::Priority server_priority
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Create a ThreadpoolPolicy instance for POA creation
+ virtual RTCORBA::ThreadpoolPolicy_ptr
+ create_threadpool_policy (RTCORBA::ThreadpoolId threadpool
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /**
+ * Create a PriorityBandedConnectionPolicy instance
+ * for use on either the client or server side
+ */
+ virtual RTCORBA::PriorityBandedConnectionPolicy_ptr
+ create_priority_banded_connection_policy (const RTCORBA::PriorityBands &
+ priority_bands
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /**
+ * Create a PrivateConnectionPolicy instance to use on client
+ * to request a private (non-multiplexed) transport connection
+ * to the server.
+ */
+ virtual RTCORBA::PrivateConnectionPolicy_ptr
+ create_private_connection_policy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /**
+ * Create a ServerProtocolPolicy instance to select and configure
+ * communication protocols on the server side.
+ */
+ virtual RTCORBA::ServerProtocolPolicy_ptr
+ create_server_protocol_policy (const RTCORBA::ProtocolList & protocols
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /**
+ * Create a ClientProtocolPolicy instance to select and configure
+ * communication protocols on the client side.
+ */
+ virtual RTCORBA::ClientProtocolPolicy_ptr
+ create_client_protocol_policy (const RTCORBA::ProtocolList & protocols
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Reference to our creating ORB Core.
+ TAO_ORB_Core *orb_core (void) const;
+
+ /// Get the Thread Pool Manager.
+ TAO_Thread_Pool_Manager &tp_manager (void) const;
+
+ /**
+ * This method changes the scheduling policy of the calling thread
+ * to match the scheduling policy specified in the svc.conf file.
+ * The priority of the calling thread will be set to the minimum
+ * priority supported by that scheduling policy.
+ *
+ * This method make sense on those platform (e.g., Linux) where
+ * PTHREAD_SCOPE_SYSTEM is the only scheduling scope supported. On
+ * other platforms, this method is a no-op since the only way to get
+ * the real-time threading behavior is to setup the
+ * PTHREAD_SCOPE_SYSTEM scheduling scope when a thread is being
+ * created. On such platforms, one can set the correct scheduling
+ * scope and policy when creating the thread, thus not needing to
+ * use this method.
+ */
+ static int modify_thread_scheduling_policy (CORBA::ORB_ptr orb);
+
+protected:
+
+ /// Protected destructor to enforce proper memory management of this
+ /// reference counted object.
+ virtual ~TAO_RT_ORB (void);
+
+protected:
+
+ /// Reference to our creating ORB Core.
+ TAO_ORB_Core * const orb_core_;
+
+ /// mutex_mgr_ manages the names associated with named mutexes.
+ TAO_Named_RT_Mutex_Manager mutex_mgr_;
+
+ /// Thread Pool Manager
+ TAO_Thread_Pool_Manager *tp_manager_;
+
+ /// Dynamic thread idle timeout
+ ACE_Time_Value const dynamic_thread_idle_timeout_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_RT_ORB_H */
diff --git a/TAO/tao/RTCORBA/RT_ORBInitializer.cpp b/TAO/tao/RTCORBA/RT_ORBInitializer.cpp
new file mode 100644
index 00000000000..464c35660aa
--- /dev/null
+++ b/TAO/tao/RTCORBA/RT_ORBInitializer.cpp
@@ -0,0 +1,312 @@
+#include "tao/RTCORBA/RT_ORBInitializer.h"
+
+#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
+
+ACE_RCSID (RTCORBA,
+ RT_ORBInitializer,
+ "$Id$")
+
+
+#define TAO_RTCORBA_SAFE_INCLUDE
+#include "tao/RTCORBA/RTCORBAC.h"
+#undef TAO_RTCORBA_SAFE_INCLUDE
+
+#include "tao/RTCORBA/RT_Policy_i.h"
+#include "tao/RTCORBA/RT_PolicyFactory.h"
+#include "tao/RTCORBA/RT_Protocols_Hooks.h"
+#include "tao/RTCORBA/Priority_Mapping_Manager.h"
+#include "tao/RTCORBA/Network_Priority_Mapping_Manager.h"
+#include "tao/RTCORBA/RT_ORB_Loader.h"
+#include "tao/RTCORBA/RT_Stub_Factory.h"
+#include "tao/RTCORBA/RT_Endpoint_Selector_Factory.h"
+#include "tao/RTCORBA/Continuous_Priority_Mapping.h"
+#include "tao/RTCORBA/Linear_Priority_Mapping.h"
+#include "tao/RTCORBA/Direct_Priority_Mapping.h"
+#include "tao/RTCORBA/Linear_Network_Priority_Mapping.h"
+#include "tao/RTCORBA/RT_ORB.h"
+#include "tao/RTCORBA/RT_Current.h"
+#include "tao/RTCORBA/RT_Thread_Lane_Resources_Manager.h"
+
+#include "tao/Exception.h"
+#include "tao/ORB_Core.h"
+#include "tao/PI/ORBInitInfo.h"
+#include "tao/debug.h"
+
+#include "ace/Service_Repository.h"
+#include "ace/Svc_Conf.h"
+#include "ace/Sched_Params.h"
+
+static const char rt_poa_factory_name[] = "TAO_RT_Object_Adapter_Factory";
+static const ACE_TCHAR rt_poa_factory_directive[] =
+ ACE_DYNAMIC_SERVICE_DIRECTIVE(
+ "TAO_RT_Object_Adapter_Factory",
+ "TAO_RTPortableServer",
+ "_make_TAO_RT_Object_Adapter_Factory",
+ "");
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_RT_ORBInitializer::TAO_RT_ORBInitializer (int priority_mapping_type,
+ int network_priority_mapping_type,
+ int ace_sched_policy,
+ long sched_policy,
+ long scope_policy,
+ ACE_Time_Value const &dynamic_thread_idle_timeout)
+ : priority_mapping_type_ (priority_mapping_type),
+ network_priority_mapping_type_ (network_priority_mapping_type),
+ ace_sched_policy_ (ace_sched_policy),
+ sched_policy_ (sched_policy),
+ scope_policy_ (scope_policy),
+ dynamic_thread_idle_timeout_ (dynamic_thread_idle_timeout)
+{
+}
+
+void
+TAO_RT_ORBInitializer::pre_init (
+ PortableInterceptor::ORBInitInfo_ptr info
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ //
+ // Register all of the RT related services.
+ //
+
+ // Set the name of the Protocol_Hooks to be RT_Protocols_Hooks.
+ TAO_ORB_Core::set_protocols_hooks ("RT_Protocols_Hooks");
+ ACE_Service_Config::process_directive (ace_svc_desc_TAO_RT_Protocols_Hooks);
+
+ // Set the name of the stub factory to be RT_Stub_Factory.
+ TAO_ORB_Core::set_stub_factory ("RT_Stub_Factory");
+ ACE_Service_Config::process_directive (ace_svc_desc_TAO_RT_Stub_Factory);
+
+ // Set the name of the stub factory to be RT_Stub_Factory.
+ TAO_ORB_Core::set_endpoint_selector_factory ("RT_Endpoint_Selector_Factory");
+ ACE_Service_Config::process_directive (ace_svc_desc_RT_Endpoint_Selector_Factory);
+
+ // Set the name of the thread lane resources manager to be RT_Thread_Lane_Resources_Manager.
+ TAO_ORB_Core::set_thread_lane_resources_manager_factory ("RT_Thread_Lane_Resources_Manager_Factory");
+ ACE_Service_Config::process_directive (ace_svc_desc_TAO_RT_Thread_Lane_Resources_Manager_Factory);
+
+ // If the application resolves the root POA, make sure we load the RT POA.
+ TAO_ORB_Core::set_poa_factory (rt_poa_factory_name,
+ ACE_TEXT_ALWAYS_CHAR (rt_poa_factory_directive));
+
+ // Create the initial priority mapping instance.
+ TAO_Priority_Mapping *pm = 0;
+ switch (this->priority_mapping_type_)
+ {
+ case TAO_PRIORITY_MAPPING_CONTINUOUS:
+ ACE_NEW (pm,
+ TAO_Continuous_Priority_Mapping (this->ace_sched_policy_));
+ break;
+ case TAO_PRIORITY_MAPPING_LINEAR:
+ ACE_NEW (pm,
+ TAO_Linear_Priority_Mapping (this->ace_sched_policy_));
+ break;
+ default:
+ case TAO_PRIORITY_MAPPING_DIRECT:
+ ACE_NEW (pm,
+ TAO_Direct_Priority_Mapping (this->ace_sched_policy_));
+ break;
+ }
+
+ // Set the Priority_Mapping_Manager
+ TAO_Priority_Mapping_Manager *manager = 0;
+
+ ACE_NEW_THROW_EX (manager,
+ TAO_Priority_Mapping_Manager (pm),
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_CHECK;
+
+ TAO_Priority_Mapping_Manager_var safe_manager = manager;
+
+ info->register_initial_reference ("PriorityMappingManager",
+ manager
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Create the initial priority mapping instance.
+ TAO_Network_Priority_Mapping *npm = 0;
+ switch (this->network_priority_mapping_type_)
+ {
+ default:
+ case TAO_NETWORK_PRIORITY_MAPPING_LINEAR:
+ ACE_NEW (npm,
+ TAO_Linear_Network_Priority_Mapping (this->ace_sched_policy_));
+ break;
+ }
+
+ // Set the Priority_Mapping_Manager
+ TAO_Network_Priority_Mapping_Manager * network_manager = 0;
+
+ // @@ There is a potential memory leak here. If the new() below
+ // throws an exception, the memory for the network priority
+ // mapping allocated above will be leaked. Use an auto_ptr<> or
+ // the appropriate memory management tool.
+
+ ACE_NEW_THROW_EX (network_manager,
+ TAO_Network_Priority_Mapping_Manager (npm),
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_CHECK;
+
+ TAO_Network_Priority_Mapping_Manager_var safe_network_manager =
+ network_manager;
+
+ info->register_initial_reference ("NetworkPriorityMappingManager",
+ network_manager
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Narrow to a TAO_ORBInitInfo object to get access to the
+ // orb_core() TAO extension.
+ TAO_ORBInitInfo_var tao_info =
+ TAO_ORBInitInfo::_narrow (info
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (CORBA::is_nil (tao_info.in ()))
+ {
+ if (TAO_debug_level > 0)
+ ACE_ERROR ((LM_ERROR,
+ "(%P|%t) TAO_RT_ORBInitializer::pre_init:\n"
+ "(%P|%t) Unable to narrow "
+ "\"PortableInterceptor::ORBInitInfo_ptr\" to\n"
+ "(%P|%t) \"TAO_ORBInitInfo *.\"\n"));
+
+ ACE_THROW (CORBA::INTERNAL ());
+ }
+
+ // Create the RT_ORB.
+ CORBA::Object_ptr rt_orb = CORBA::Object::_nil ();
+ ACE_NEW_THROW_EX (rt_orb,
+ TAO_RT_ORB (tao_info->orb_core (),
+ dynamic_thread_idle_timeout_),
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_CHECK;
+ CORBA::Object_var safe_rt_orb = rt_orb;
+
+ info->register_initial_reference (TAO_OBJID_RTORB,
+ rt_orb
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Create the RT_Current.
+ CORBA::Object_ptr current = CORBA::Object::_nil ();
+ ACE_NEW_THROW_EX (current,
+ TAO_RT_Current (tao_info->orb_core ()),
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_CHECK;
+ CORBA::Object_var safe_rt_current = current;
+
+ info->register_initial_reference (TAO_OBJID_RTCURRENT,
+ current
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ tao_info->orb_core ()->orb_params ()->scope_policy (this->scope_policy_);
+ tao_info->orb_core ()->orb_params ()->sched_policy (this->sched_policy_);
+ tao_info->orb_core ()->orb_params ()->ace_sched_policy (this->ace_sched_policy_);
+}
+
+void
+TAO_RT_ORBInitializer::post_init (
+ PortableInterceptor::ORBInitInfo_ptr info
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->register_policy_factories (info
+ ACE_ENV_ARG_PARAMETER);
+
+ ACE_CHECK;
+}
+
+void
+TAO_RT_ORBInitializer::register_policy_factories (
+ PortableInterceptor::ORBInitInfo_ptr info
+ ACE_ENV_ARG_DECL)
+{
+ // The RTCorba policy factory is stateless and reentrant, so share a
+ // single instance between all ORBs.
+ if (CORBA::is_nil (this->policy_factory_.in ()))
+ {
+ PortableInterceptor::PolicyFactory_ptr policy_factory;
+ ACE_NEW_THROW_EX (policy_factory,
+ TAO_RT_PolicyFactory,
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_CHECK;
+
+ this->policy_factory_ = policy_factory;
+ }
+
+ // Bind the same policy factory to all RTCORBA related policy
+ // types since a single policy factory is used to create each of
+ // the different types of RTCORBA policies.
+ static CORBA::PolicyType const type[] = {
+ RTCORBA::PRIORITY_MODEL_POLICY_TYPE,
+ RTCORBA::THREADPOOL_POLICY_TYPE,
+ RTCORBA::SERVER_PROTOCOL_POLICY_TYPE,
+ RTCORBA::CLIENT_PROTOCOL_POLICY_TYPE,
+ RTCORBA::PRIVATE_CONNECTION_POLICY_TYPE,
+ RTCORBA::PRIORITY_BANDED_CONNECTION_POLICY_TYPE
+ };
+
+ const CORBA::PolicyType *end =
+ type + sizeof (type) / sizeof (type[0]);
+
+ for (CORBA::PolicyType const * i = type;
+ i != end;
+ ++i)
+ {
+ ACE_TRY
+ {
+ info->register_policy_factory (*i,
+ this->policy_factory_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCH (CORBA::BAD_INV_ORDER, ex)
+ {
+ if (ex.minor () == (CORBA::OMGVMCID | 16))
+ {
+ // The factory is already there, it happens because the
+ // magic initializer in PortableServer.cpp registers
+ // with the ORB multiple times. This is an indication
+ // that we should do no more work in this
+ // ORBInitializer.
+ return;
+ }
+ ACE_RE_THROW;
+ }
+ ACE_CATCHANY
+ {
+ // Rethrow any other exceptions...
+ ACE_RE_THROW;
+ }
+ ACE_ENDTRY;
+ ACE_CHECK;
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
diff --git a/TAO/tao/RTCORBA/RT_ORBInitializer.h b/TAO/tao/RTCORBA/RT_ORBInitializer.h
new file mode 100644
index 00000000000..c2f04c46c04
--- /dev/null
+++ b/TAO/tao/RTCORBA/RT_ORBInitializer.h
@@ -0,0 +1,145 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file RT_ORBInitializer.h
+ *
+ * $Id$
+ *
+ * @author Ossama Othman <ossama@uci.edu>
+ */
+//=============================================================================
+
+
+#ifndef TAO_RT_ORB_INITIALIZER_H
+#define TAO_RT_ORB_INITIALIZER_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
+
+#include "tao/RTCORBA/rtcorba_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+
+#include "tao/PI/PI.h"
+#include "tao/LocalObject.h"
+
+// This is to remove "inherits via dominance" warnings from MSVC.
+// MSVC is being a little too paranoid.
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/// RTCORBA ORB initializer.
+class TAO_RT_ORBInitializer
+ : public virtual PortableInterceptor::ORBInitializer
+ , public virtual TAO_Local_RefCounted_Object
+{
+public:
+ /// Priority mapping types
+ enum
+ {
+ TAO_PRIORITY_MAPPING_CONTINUOUS,
+ TAO_PRIORITY_MAPPING_LINEAR,
+ TAO_PRIORITY_MAPPING_DIRECT
+ };
+
+ enum
+ {
+ TAO_NETWORK_PRIORITY_MAPPING_LINEAR
+ };
+
+ TAO_RT_ORBInitializer (int priority_mapping_type,
+ int network_priority_mapping_type,
+ int ace_sched_policy,
+ long sched_policy,
+ long scope_policy,
+ ACE_Time_Value const &dynamic_thread_idle_timeout);
+
+ virtual void pre_init (PortableInterceptor::ORBInitInfo_ptr info
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual void post_init (PortableInterceptor::ORBInitInfo_ptr info
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+private:
+
+ /// Register RTCORBA policy factories.
+ void register_policy_factories (
+ PortableInterceptor::ORBInitInfo_ptr info
+ ACE_ENV_ARG_DECL);
+
+private:
+ /// Instance of the RTCorba policy factory.
+ /**
+ * The RTCorba policy factory is stateless and reentrant, so share
+ * a single instance between all ORBs.
+ */
+ PortableInterceptor::PolicyFactory_var policy_factory_;
+
+ /// Priority mapping type.
+ int const priority_mapping_type_;
+
+ /// Network Priority mapping type.
+ int const network_priority_mapping_type_;
+
+ /// Scheduling policy.
+ /**
+ * Scheduling policy specified by the user through the
+ * -ORBSchedPolicy option. This value is typically used by
+ * functions like ACE_OS::thr_setprio() and
+ * ACE_Sched_Params::priority_min(). Legal values are ACE_SCHED_RR,
+ * ACE_SCHED_FIFO, and ACE_SCHED_OTHER.
+ */
+ int const ace_sched_policy_;
+
+ /// Scheduling policy flag.
+ /**
+ * Scheduling policy specified by the user through the
+ * -ORBSchedPolicy option. This value is typically used by ACE
+ * thread creation functions. Legal values are THR_SCHED_RR,
+ * THR_SCHED_FIFO, and THR_SCHED_DEFAULT.
+ */
+ long const sched_policy_;
+
+ /// Scheduling scope flag.
+ /**
+ * Scheduling policy specified by the user through the
+ * -ORBScopePolicy option. This value is typically used by ACE
+ * thread creation functions. Legal values are THR_SCOPE_SYSTEM and
+ * THR_SCOPE_PROCESS.
+ */
+ long const scope_policy_;
+
+ /// Dynamic thread idle timeout
+ /**
+ * When using thread pool a certain number of dynamic threads can be created.
+ * By default these threads are created when needed but never end, when this
+ * timeout is specified the threads end themselves at the moment they
+ * have not been serving any requests for the specified amount of time
+ */
+ ACE_Time_Value const dynamic_thread_idle_timeout_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_RT_ORB_INITIALIZER_H */
diff --git a/TAO/tao/RTCORBA/RT_ORB_Loader.cpp b/TAO/tao/RTCORBA/RT_ORB_Loader.cpp
new file mode 100644
index 00000000000..381da1bd572
--- /dev/null
+++ b/TAO/tao/RTCORBA/RT_ORB_Loader.cpp
@@ -0,0 +1,208 @@
+#include "tao/RTCORBA/RT_ORB_Loader.h"
+
+#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
+
+#include "tao/RTCORBA/RT_ORBInitializer.h"
+
+#include "tao/debug.h"
+#include "tao/ORB_Constants.h"
+#include "tao/ORBInitializer_Registry.h"
+#include "tao/SystemException.h"
+#include "ace/OS_NS_strings.h"
+#include "ace/Arg_Shifter.h"
+
+ACE_RCSID (RTCORBA,
+ RT_ORB_Loader,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_RT_ORB_Loader::~TAO_RT_ORB_Loader (void)
+{
+}
+
+int
+TAO_RT_ORB_Loader::init (int argc,
+ ACE_TCHAR* argv[])
+{
+ ACE_TRACE ("TAO_RT_ORB_Loader::init");
+
+ static bool initialized = false;
+
+ // Only allow initialization once.
+ if (initialized)
+ return 0;
+
+ initialized = true;
+
+ // Set defaults.
+ int priority_mapping_type =
+ TAO_RT_ORBInitializer::TAO_PRIORITY_MAPPING_DIRECT;
+ int network_priority_mapping_type =
+ TAO_RT_ORBInitializer::TAO_NETWORK_PRIORITY_MAPPING_LINEAR;
+ int ace_sched_policy = ACE_SCHED_OTHER;
+ long sched_policy = THR_SCHED_DEFAULT;
+ long scope_policy = THR_SCOPE_PROCESS;
+ int curarg = 0;
+ ACE_Time_Value dynamic_thread_idle_timeout;
+
+ ACE_Arg_Shifter arg_shifter (argc, argv);
+
+ // Parse any service configurator parameters.
+ while (arg_shifter.is_anything_left ())
+ {
+ const ACE_TCHAR *current_arg = 0;
+ if (0 != (current_arg = arg_shifter.get_the_parameter
+ (ACE_TEXT("-ORBPriorityMapping"))))
+ {
+ const ACE_TCHAR *name = current_arg;
+ if (ACE_OS::strcasecmp (name,
+ ACE_TEXT("continuous")) == 0)
+ priority_mapping_type =
+ TAO_RT_ORBInitializer::TAO_PRIORITY_MAPPING_CONTINUOUS;
+ else if (ACE_OS::strcasecmp (name,
+ ACE_TEXT("linear")) == 0)
+ priority_mapping_type =
+ TAO_RT_ORBInitializer::TAO_PRIORITY_MAPPING_LINEAR;
+ else if (ACE_OS::strcasecmp (name,
+ ACE_TEXT("direct")) == 0)
+ priority_mapping_type =
+ TAO_RT_ORBInitializer::TAO_PRIORITY_MAPPING_DIRECT;
+ else
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT("RT_ORB_Loader - unknown argument")
+ ACE_TEXT(" <%s> for -ORBPriorityMapping\n"),
+ name));
+ arg_shifter.consume_arg ();
+ }
+ else if (0 != (current_arg = arg_shifter.get_the_parameter
+ (ACE_TEXT("-ORBSchedPolicy"))))
+ {
+ const ACE_TCHAR *name = current_arg;
+ if (ACE_OS::strcasecmp (name,
+ ACE_TEXT("SCHED_OTHER")) == 0)
+ {
+ ace_sched_policy = ACE_SCHED_OTHER;
+ sched_policy = THR_SCHED_DEFAULT;
+ }
+ else if (ACE_OS::strcasecmp (name,
+ ACE_TEXT("SCHED_FIFO")) == 0)
+ {
+ ace_sched_policy = ACE_SCHED_FIFO;
+ sched_policy = THR_SCHED_FIFO;
+ }
+ else if (ACE_OS::strcasecmp (name,
+ ACE_TEXT("SCHED_RR")) == 0)
+ {
+ ace_sched_policy = ACE_SCHED_RR;
+ sched_policy = THR_SCHED_RR;
+ }
+ else
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT("RT_ORB_Loader - unknown argument")
+ ACE_TEXT(" <%s> for -ORBSchedPolicy\n"),
+ name));
+ arg_shifter.consume_arg ();
+ }
+ else if (0 != (current_arg = arg_shifter.get_the_parameter
+ (ACE_TEXT("-ORBScopePolicy"))))
+ {
+ const ACE_TCHAR *name = current_arg;
+ if (ACE_OS::strcasecmp (name,
+ ACE_TEXT("SYSTEM")) == 0)
+ scope_policy = THR_SCOPE_SYSTEM;
+ else if (ACE_OS::strcasecmp (name,
+ ACE_TEXT("PROCESS")) == 0)
+ scope_policy = THR_SCOPE_PROCESS;
+ else
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT("RT_ORB_Loader - unknown argument")
+ ACE_TEXT(" <%s> for -ORBScopePolicy\n"),
+ name));
+ arg_shifter.consume_arg ();
+ }
+ else if (0 != (current_arg = arg_shifter.get_the_parameter
+ (ACE_TEXT("-RTORBNetworkPriorityMapping"))))
+ {
+ const ACE_TCHAR *name = current_arg;
+ if (ACE_OS::strcasecmp (name,
+ ACE_TEXT("linear")) == 0)
+ network_priority_mapping_type =
+ TAO_RT_ORBInitializer::TAO_NETWORK_PRIORITY_MAPPING_LINEAR;
+ arg_shifter.consume_arg ();
+ }
+ else if (0 != (current_arg = arg_shifter.get_the_parameter
+ (ACE_TEXT("-RTORBDynamicThreadIdleTimeout"))))
+ {
+ const ACE_TCHAR *name = current_arg;
+ int timeout = ACE_OS::atoi (name);
+ dynamic_thread_idle_timeout = ACE_Time_Value (0, timeout);
+ arg_shifter.consume_arg ();
+ }
+ else
+ {
+ arg_shifter.ignore_arg ();
+ if (TAO_debug_level > 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT("RT_ORB_Loader: Unknown option ")
+ ACE_TEXT("<%s>.\n"),
+ argv[curarg]));
+ }
+ }
+ }
+
+ // Register the ORB initializer.
+ ACE_TRY_NEW_ENV
+ {
+ PortableInterceptor::ORBInitializer_ptr temp_orb_initializer =
+ PortableInterceptor::ORBInitializer::_nil ();
+
+ /// Register the RTCORBA ORBInitializer.
+ ACE_NEW_THROW_EX (temp_orb_initializer,
+ TAO_RT_ORBInitializer (priority_mapping_type,
+ network_priority_mapping_type,
+ ace_sched_policy,
+ sched_policy,
+ scope_policy,
+ dynamic_thread_idle_timeout),
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_TRY_CHECK;
+
+ PortableInterceptor::ORBInitializer_var orb_initializer;
+ orb_initializer = temp_orb_initializer;
+
+ PortableInterceptor::register_orb_initializer (orb_initializer.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "Unexpected exception caught while "
+ "initializing the RTORB");
+ return 1;
+ }
+ ACE_ENDTRY;
+
+ return 0;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+/////////////////////////////////////////////////////////////////////
+
+ACE_FACTORY_DEFINE (TAO_RTCORBA, TAO_RT_ORB_Loader)
+ACE_STATIC_SVC_DEFINE (TAO_RT_ORB_Loader,
+ ACE_TEXT ("RT_ORB_Loader"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (TAO_RT_ORB_Loader),
+ ACE_Service_Type::DELETE_THIS
+ | ACE_Service_Type::DELETE_OBJ,
+ 0)
+
+#endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
diff --git a/TAO/tao/RTCORBA/RT_ORB_Loader.h b/TAO/tao/RTCORBA/RT_ORB_Loader.h
new file mode 100644
index 00000000000..a3e2d4cd375
--- /dev/null
+++ b/TAO/tao/RTCORBA/RT_ORB_Loader.h
@@ -0,0 +1,57 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file RT_ORB_Loader.h
+ *
+ * $Id$
+ *
+ * Header file for Loading RT_ORB.
+ *
+ *
+ * @author Priyanka Gontla <gontla_p@ociweb.com>
+ */
+//=============================================================================
+
+#ifndef TAO_RT_ORB_LOADER_H
+#define TAO_RT_ORB_LOADER_H
+#include /**/ "ace/pre.h"
+
+#include "tao/RTCORBA/rtcorba_export.h"
+
+#include "tao/orbconf.h"
+
+#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
+
+#include "ace/Service_Object.h"
+#include "ace/Service_Config.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_ORB_Core;
+
+class TAO_RTCORBA_Export TAO_RT_ORB_Loader : public ACE_Service_Object
+{
+public:
+
+ /// Destructor.
+ virtual ~TAO_RT_ORB_Loader (void);
+
+ /// Initialize the RT ORB loader hooks.
+ virtual int init (int argc,
+ ACE_TCHAR* []);
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE_EXPORT (TAO_RTCORBA, TAO_RT_ORB_Loader)
+ACE_FACTORY_DECLARE (TAO_RTCORBA, TAO_RT_ORB_Loader)
+
+#endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_RT_ORB_LOADER_H */
diff --git a/TAO/tao/RTCORBA/RT_PolicyFactory.cpp b/TAO/tao/RTCORBA/RT_PolicyFactory.cpp
new file mode 100644
index 00000000000..cd80662c192
--- /dev/null
+++ b/TAO/tao/RTCORBA/RT_PolicyFactory.cpp
@@ -0,0 +1,109 @@
+#include "tao/RTCORBA/RT_PolicyFactory.h"
+
+#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
+
+ACE_RCSID (RTCORBA,
+ RT_PolicyFactory,
+ "$Id$")
+
+#include "tao/RTCORBA/RT_Policy_i.h"
+
+#include "tao/PolicyC.h"
+#include "tao/ORB_Constants.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+CORBA::Policy_ptr
+TAO_RT_PolicyFactory::create_policy (
+ CORBA::PolicyType type,
+ const CORBA::Any &value
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ CORBA::PolicyError))
+{
+ if (type == RTCORBA::PRIORITY_MODEL_POLICY_TYPE)
+ return TAO_PriorityModelPolicy::create (value
+ ACE_ENV_ARG_PARAMETER);
+
+ if (type == RTCORBA::THREADPOOL_POLICY_TYPE)
+ return TAO_ThreadpoolPolicy::create (value
+ ACE_ENV_ARG_PARAMETER);
+
+ if (type == RTCORBA::SERVER_PROTOCOL_POLICY_TYPE)
+ return TAO_ServerProtocolPolicy::create (value
+ ACE_ENV_ARG_PARAMETER);
+
+ if (type == RTCORBA::CLIENT_PROTOCOL_POLICY_TYPE)
+ return TAO_ClientProtocolPolicy::create (value
+ ACE_ENV_ARG_PARAMETER);
+
+ if (type == RTCORBA::PRIVATE_CONNECTION_POLICY_TYPE)
+ return TAO_PrivateConnectionPolicy::create (value
+ ACE_ENV_ARG_PARAMETER);
+
+ if (type == RTCORBA::PRIORITY_BANDED_CONNECTION_POLICY_TYPE)
+ return TAO_PriorityBandedConnectionPolicy::create (value
+ ACE_ENV_ARG_PARAMETER);
+
+ ACE_THROW_RETURN (CORBA::PolicyError (CORBA::BAD_POLICY_TYPE),
+ CORBA::Policy::_nil ());
+}
+
+CORBA::Policy_ptr
+TAO_RT_PolicyFactory::_create_policy (
+ CORBA::PolicyType type
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ CORBA::PolicyError))
+{
+ CORBA::Policy_ptr policy = CORBA::Policy::_nil ();
+
+ if (type == RTCORBA::PRIORITY_MODEL_POLICY_TYPE)
+ {
+ ACE_NEW_THROW_EX (policy,
+ TAO_PriorityModelPolicy,
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+
+ return policy;
+ }
+
+ if (type == RTCORBA::PRIORITY_BANDED_CONNECTION_POLICY_TYPE)
+ {
+ ACE_NEW_THROW_EX (policy,
+ TAO_PriorityBandedConnectionPolicy,
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+
+ return policy;
+ }
+
+ if (type == RTCORBA::CLIENT_PROTOCOL_POLICY_TYPE)
+ {
+ ACE_NEW_THROW_EX (policy,
+ TAO_ClientProtocolPolicy,
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+
+ return policy;
+ }
+
+ ACE_THROW_RETURN (CORBA::PolicyError (CORBA::BAD_POLICY_TYPE),
+ CORBA::Policy::_nil ());
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
diff --git a/TAO/tao/RTCORBA/RT_PolicyFactory.h b/TAO/tao/RTCORBA/RT_PolicyFactory.h
new file mode 100644
index 00000000000..0d7877c9489
--- /dev/null
+++ b/TAO/tao/RTCORBA/RT_PolicyFactory.h
@@ -0,0 +1,71 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file RT_PolicyFactory.h
+ *
+ * $Id$
+ *
+ * @author Angelo Corsaro <corsaro@cs.wustl.edu>
+ * @author Ossama Othman <ossama@uci.edu>
+ */
+//=============================================================================
+
+
+#ifndef TAO_RT_POLICY_FACTORY_H
+#define TAO_RT_POLICY_FACTORY_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
+
+#include "tao/RTCORBA/rtcorba_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PI/PI.h"
+#include "tao/LocalObject.h"
+
+// This is to remove "inherits via dominance" warnings from MSVC.
+// MSVC is being a little too paranoid.
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/// Policy factory for all RTCORBA related policies.
+class TAO_RT_PolicyFactory
+ : public virtual PortableInterceptor::PolicyFactory,
+ public virtual TAO_Local_RefCounted_Object
+{
+public:
+
+ CORBA::Policy_ptr create_policy (CORBA::PolicyType type,
+ const CORBA::Any &value
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ CORBA::PolicyError));
+
+ CORBA::Policy_ptr _create_policy (CORBA::PolicyType type
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ CORBA::PolicyError));
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_RT_POLICY_FACTORY_H */
diff --git a/TAO/tao/RTCORBA/RT_Policy_i.cpp b/TAO/tao/RTCORBA/RT_Policy_i.cpp
new file mode 100644
index 00000000000..5cb4737b17a
--- /dev/null
+++ b/TAO/tao/RTCORBA/RT_Policy_i.cpp
@@ -0,0 +1,1410 @@
+// $Id$
+
+#include "tao/RTCORBA/RT_Policy_i.h"
+
+#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
+
+#include "tao/ORB_Core.h"
+#include "tao/Policy_Manager.h"
+#include "tao/debug.h"
+#include "tao/CDR.h"
+#include "tao/AnyTypeCode/Any.h"
+
+#include "ace/OS_NS_string.h"
+
+ACE_RCSID (RTCORBA,
+ RT_Policy_i,
+ "$Id$")
+
+// ****************************************************************
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_PriorityModelPolicy::TAO_PriorityModelPolicy (
+ RTCORBA::PriorityModel priority_model,
+ RTCORBA::Priority server_priority)
+ : ::CORBA::Object ()
+ , ::CORBA::Policy ()
+ , ::CORBA::LocalObject ()
+ , RTCORBA::PriorityModelPolicy ()
+ , TAO_Local_RefCounted_Object ()
+ , priority_model_ (priority_model)
+ , server_priority_ (server_priority)
+{
+}
+
+TAO_PriorityModelPolicy::TAO_PriorityModelPolicy (const TAO_PriorityModelPolicy &rhs)
+ : ::CORBA::Object ()
+ , ::CORBA::Policy ()
+ , ::CORBA::LocalObject ()
+ , RTCORBA::PriorityModelPolicy ()
+ , TAO_Local_RefCounted_Object ()
+ , priority_model_ (rhs.priority_model_)
+ , server_priority_ (rhs.server_priority_)
+{
+}
+
+TAO_PriorityModelPolicy::TAO_PriorityModelPolicy (void)
+ : priority_model_ (RTCORBA::SERVER_DECLARED),
+ server_priority_ (0)
+{
+}
+
+TAO_PriorityModelPolicy::~TAO_PriorityModelPolicy (void)
+{
+}
+
+CORBA::Policy_ptr
+TAO_PriorityModelPolicy::create (const CORBA::Any &
+ ACE_ENV_ARG_DECL)
+{
+ /*
+ * @@ The following code should be changed once the OMG spec has
+ * been fixed such that a RTCORBA::PriorityModelPolicy can be
+ * created by using the ORB::create_policy interface.
+ */
+ ACE_THROW_RETURN (CORBA::PolicyError (CORBA::BAD_POLICY_VALUE),
+ CORBA::Policy::_nil ());
+}
+
+RTCORBA::PriorityModel
+TAO_PriorityModelPolicy::get_priority_model (void)
+{
+ return this->priority_model_;
+}
+
+RTCORBA::PriorityModel
+TAO_PriorityModelPolicy::priority_model (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return this->priority_model_;
+}
+
+RTCORBA::Priority
+TAO_PriorityModelPolicy::server_priority (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return this->server_priority_;
+}
+
+CORBA::PolicyType
+TAO_PriorityModelPolicy::policy_type (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return RTCORBA::PRIORITY_MODEL_POLICY_TYPE;
+}
+
+CORBA::Policy_ptr
+TAO_PriorityModelPolicy::copy (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ TAO_PriorityModelPolicy* tmp = 0;
+ ACE_NEW_THROW_EX (tmp,
+ TAO_PriorityModelPolicy (*this),
+ CORBA::NO_MEMORY (TAO::VMCID,
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+
+ return tmp;
+}
+
+void
+TAO_PriorityModelPolicy::destroy (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+}
+
+CORBA::Boolean
+TAO_PriorityModelPolicy::_tao_encode (TAO_OutputCDR &out_cdr)
+{
+ // Note: the fields are encoded according to
+ // the order specified in the RTCORBA 1.0 spec (ptc/99-05-03)
+ // section 4.7.3.
+
+ return ((out_cdr << priority_model_) && (out_cdr << server_priority_));
+}
+
+CORBA::Boolean
+TAO_PriorityModelPolicy::_tao_decode (TAO_InputCDR &in_cdr)
+{
+ return ((in_cdr >> priority_model_) && (in_cdr >> server_priority_));
+}
+
+TAO_Cached_Policy_Type
+TAO_PriorityModelPolicy::_tao_cached_type (void) const
+{
+ return TAO_CACHED_POLICY_PRIORITY_MODEL;
+}
+
+TAO_Policy_Scope
+TAO_PriorityModelPolicy::_tao_scope (void) const
+{
+ // Note that this policy is propogated to the client even though
+ // it is not specified here. The reason for this is that the
+ // server priority field is set dynamically depending on the model
+ // and the servant's priority. Therefore, it can't be simply
+ // copied to the list of client exposed policies.
+ return static_cast<TAO_Policy_Scope> (TAO_POLICY_ORB_SCOPE |
+ TAO_POLICY_POA_SCOPE);
+}
+
+// ****************************************************************
+
+TAO_ThreadpoolPolicy::TAO_ThreadpoolPolicy (RTCORBA::ThreadpoolId id)
+ : ::CORBA::Object ()
+ , ::CORBA::Policy ()
+ , ::CORBA::LocalObject ()
+ , RTCORBA::ThreadpoolPolicy ()
+ , TAO_Local_RefCounted_Object ()
+ , id_ (id)
+{
+}
+
+TAO_ThreadpoolPolicy::TAO_ThreadpoolPolicy (const TAO_ThreadpoolPolicy &rhs)
+ : ::CORBA::Object ()
+ , ::CORBA::Policy ()
+ , ::CORBA::LocalObject ()
+ , RTCORBA::ThreadpoolPolicy ()
+ , TAO_Local_RefCounted_Object ()
+ , id_ (rhs.id_)
+{
+}
+
+TAO_ThreadpoolPolicy::~TAO_ThreadpoolPolicy (void)
+{
+}
+
+CORBA::Policy_ptr
+TAO_ThreadpoolPolicy::create (const CORBA::Any &val
+ ACE_ENV_ARG_DECL)
+{
+ RTCORBA::ThreadpoolId value;
+ if ((val >>= value) == 0)
+ ACE_THROW_RETURN (CORBA::PolicyError (CORBA::BAD_POLICY_VALUE),
+ CORBA::Policy::_nil ());
+
+ TAO_ThreadpoolPolicy *tmp = 0;
+ ACE_NEW_THROW_EX (tmp,
+ TAO_ThreadpoolPolicy (value),
+ CORBA::NO_MEMORY (TAO::VMCID,
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+
+ return tmp;
+}
+
+RTCORBA::ThreadpoolId
+TAO_ThreadpoolPolicy::threadpool (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return this->id_;
+}
+
+CORBA::PolicyType
+TAO_ThreadpoolPolicy::policy_type (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return RTCORBA::THREADPOOL_POLICY_TYPE;
+}
+
+CORBA::Policy_ptr
+TAO_ThreadpoolPolicy::copy (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ TAO_ThreadpoolPolicy* tmp = 0;
+ ACE_NEW_THROW_EX (tmp,
+ TAO_ThreadpoolPolicy (*this),
+ CORBA::NO_MEMORY (TAO::VMCID,
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+
+ return tmp;
+}
+
+void
+TAO_ThreadpoolPolicy::destroy (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+}
+
+TAO_Cached_Policy_Type
+TAO_ThreadpoolPolicy::_tao_cached_type (void) const
+{
+ return TAO_CACHED_POLICY_THREADPOOL;
+}
+
+TAO_Policy_Scope
+TAO_ThreadpoolPolicy::_tao_scope (void) const
+{
+ return static_cast<TAO_Policy_Scope> (TAO_POLICY_ORB_SCOPE |
+ TAO_POLICY_POA_SCOPE);
+}
+
+// ****************************************************************
+
+TAO_PrivateConnectionPolicy::TAO_PrivateConnectionPolicy (void)
+ : ::CORBA::Object ()
+ , ::CORBA::Policy ()
+ , ::CORBA::LocalObject ()
+ , RTCORBA::PrivateConnectionPolicy ()
+ , TAO_Local_RefCounted_Object ()
+{
+}
+
+TAO_PrivateConnectionPolicy::TAO_PrivateConnectionPolicy (const TAO_PrivateConnectionPolicy &)
+ : ::CORBA::Object ()
+ , ::CORBA::Policy ()
+ , ::CORBA::LocalObject ()
+ , RTCORBA::PrivateConnectionPolicy ()
+ , TAO_Local_RefCounted_Object ()
+{
+}
+
+TAO_PrivateConnectionPolicy::~TAO_PrivateConnectionPolicy (void)
+{
+}
+
+CORBA::Policy_ptr
+TAO_PrivateConnectionPolicy::create (const CORBA::Any &
+ ACE_ENV_ARG_DECL)
+{
+ TAO_PrivateConnectionPolicy *tmp = 0;
+ ACE_NEW_THROW_EX (tmp,
+ TAO_PrivateConnectionPolicy (),
+ CORBA::NO_MEMORY (TAO::VMCID,
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+
+ return tmp;
+}
+
+CORBA::PolicyType
+TAO_PrivateConnectionPolicy::policy_type (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return RTCORBA::PRIVATE_CONNECTION_POLICY_TYPE;
+}
+
+CORBA::Policy_ptr
+TAO_PrivateConnectionPolicy::copy (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ TAO_PrivateConnectionPolicy* tmp = 0;
+ ACE_NEW_THROW_EX (tmp,
+ TAO_PrivateConnectionPolicy (*this),
+ CORBA::NO_MEMORY (TAO::VMCID,
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+
+ return tmp;
+}
+
+void
+TAO_PrivateConnectionPolicy::destroy (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+}
+
+TAO_Cached_Policy_Type
+TAO_PrivateConnectionPolicy::_tao_cached_type (void) const
+{
+ return TAO_CACHED_POLICY_RT_PRIVATE_CONNECTION;
+}
+
+TAO_Policy_Scope
+TAO_PrivateConnectionPolicy::_tao_scope (void) const
+{
+ return static_cast<TAO_Policy_Scope> (TAO_POLICY_OBJECT_SCOPE |
+ TAO_POLICY_THREAD_SCOPE |
+ TAO_POLICY_ORB_SCOPE);
+}
+
+// ****************************************************************
+
+TAO_PriorityBandedConnectionPolicy::TAO_PriorityBandedConnectionPolicy (const RTCORBA::PriorityBands &bands)
+ : ::CORBA::Object ()
+ , ::CORBA::Policy ()
+ , ::CORBA::LocalObject ()
+ , RTCORBA::PriorityBandedConnectionPolicy ()
+ , TAO_Local_RefCounted_Object ()
+ , priority_bands_ (bands)
+{
+}
+
+TAO_PriorityBandedConnectionPolicy::TAO_PriorityBandedConnectionPolicy (const TAO_PriorityBandedConnectionPolicy &rhs)
+ : ::CORBA::Object ()
+ , ::CORBA::Policy ()
+ , ::CORBA::LocalObject ()
+ , RTCORBA::PriorityBandedConnectionPolicy ()
+ , TAO_Local_RefCounted_Object ()
+ , priority_bands_ (rhs.priority_bands_)
+{
+}
+
+TAO_PriorityBandedConnectionPolicy::TAO_PriorityBandedConnectionPolicy (void)
+{
+}
+
+TAO_PriorityBandedConnectionPolicy::~TAO_PriorityBandedConnectionPolicy (void)
+{
+}
+
+CORBA::Policy_ptr
+TAO_PriorityBandedConnectionPolicy::create (const CORBA::Any &val
+ ACE_ENV_ARG_DECL)
+{
+ RTCORBA::PriorityBands *value = 0;
+ if ((val >>= value) == 0)
+ ACE_THROW_RETURN (CORBA::PolicyError (CORBA::BAD_POLICY_VALUE),
+ CORBA::Policy::_nil ());
+
+ TAO_PriorityBandedConnectionPolicy *tmp = 0;
+ ACE_NEW_THROW_EX (tmp,
+ TAO_PriorityBandedConnectionPolicy (*value),
+ CORBA::NO_MEMORY (TAO::VMCID,
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+
+ return tmp;
+}
+
+RTCORBA::PriorityBands *
+TAO_PriorityBandedConnectionPolicy::priority_bands (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ RTCORBA::PriorityBands *tmp;
+ ACE_NEW_THROW_EX (tmp,
+ RTCORBA::PriorityBands (this->priority_bands_),
+ CORBA::NO_MEMORY (TAO::VMCID,
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (0);
+
+ return tmp;
+}
+
+CORBA::PolicyType
+TAO_PriorityBandedConnectionPolicy::policy_type (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return RTCORBA::PRIORITY_BANDED_CONNECTION_POLICY_TYPE;
+}
+
+CORBA::Policy_ptr
+TAO_PriorityBandedConnectionPolicy::copy (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ TAO_PriorityBandedConnectionPolicy *tmp = 0;
+ ACE_NEW_THROW_EX (tmp,
+ TAO_PriorityBandedConnectionPolicy (*this),
+ CORBA::NO_MEMORY (TAO::VMCID,
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+
+ return tmp;
+}
+
+void
+TAO_PriorityBandedConnectionPolicy::destroy (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+}
+
+CORBA::Boolean
+TAO_PriorityBandedConnectionPolicy::_tao_encode (TAO_OutputCDR &out_cdr)
+{
+ return out_cdr << priority_bands_;
+}
+
+CORBA::Boolean
+TAO_PriorityBandedConnectionPolicy::_tao_decode (TAO_InputCDR &in_cdr)
+{
+ return in_cdr >> priority_bands_;
+}
+
+TAO_Cached_Policy_Type
+TAO_PriorityBandedConnectionPolicy::_tao_cached_type (void) const
+{
+ return TAO_CACHED_POLICY_RT_PRIORITY_BANDED_CONNECTION;
+}
+
+TAO_Policy_Scope
+TAO_PriorityBandedConnectionPolicy::_tao_scope (void) const
+{
+ return static_cast<TAO_Policy_Scope> (TAO_POLICY_DEFAULT_SCOPE |
+ TAO_POLICY_CLIENT_EXPOSED);
+}
+
+RTCORBA::PriorityBands &
+TAO_PriorityBandedConnectionPolicy::priority_bands_rep (void)
+{
+ return priority_bands_;
+}
+
+// ****************************************************************
+
+TAO_ServerProtocolPolicy::TAO_ServerProtocolPolicy (const RTCORBA::ProtocolList &protocols)
+ : ::CORBA::Object ()
+ , ::CORBA::Policy ()
+ , ::CORBA::LocalObject ()
+ , RTCORBA::ServerProtocolPolicy ()
+ , TAO_Local_RefCounted_Object ()
+ , protocols_ (protocols)
+{
+}
+
+TAO_ServerProtocolPolicy::TAO_ServerProtocolPolicy (const TAO_ServerProtocolPolicy &rhs)
+ : ::CORBA::Object ()
+ , ::CORBA::Policy ()
+ , ::CORBA::LocalObject ()
+ , RTCORBA::ServerProtocolPolicy ()
+ , TAO_Local_RefCounted_Object ()
+ , protocols_ (rhs.protocols_)
+{
+}
+
+TAO_ServerProtocolPolicy::~TAO_ServerProtocolPolicy (void)
+{
+}
+
+CORBA::Policy_ptr
+TAO_ServerProtocolPolicy::create (const CORBA::Any &val
+ ACE_ENV_ARG_DECL)
+{
+ RTCORBA::ProtocolList *value = 0;
+ if ((val >>= value) == 0)
+ ACE_THROW_RETURN (CORBA::PolicyError (CORBA::BAD_POLICY_VALUE),
+ CORBA::Policy::_nil ());
+
+ TAO_ServerProtocolPolicy *tmp = 0;
+ ACE_NEW_THROW_EX (tmp,
+ TAO_ServerProtocolPolicy (*value),
+ CORBA::NO_MEMORY (TAO::VMCID,
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+
+ return tmp;
+}
+
+RTCORBA::ProtocolList *
+TAO_ServerProtocolPolicy::protocols (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ RTCORBA::ProtocolList *tmp = 0;
+ ACE_NEW_THROW_EX (tmp,
+ RTCORBA::ProtocolList (this->protocols_),
+ CORBA::NO_MEMORY (TAO::VMCID,
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (0);
+
+ return tmp;
+}
+
+CORBA::PolicyType
+TAO_ServerProtocolPolicy::policy_type (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return RTCORBA::SERVER_PROTOCOL_POLICY_TYPE;
+}
+
+CORBA::Policy_ptr
+TAO_ServerProtocolPolicy::copy (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ TAO_ServerProtocolPolicy* tmp = 0;
+ ACE_NEW_THROW_EX (tmp,
+ TAO_ServerProtocolPolicy (*this),
+ CORBA::NO_MEMORY (TAO::VMCID,
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+
+ return tmp;
+}
+
+void
+TAO_ServerProtocolPolicy::destroy (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+}
+
+TAO_Cached_Policy_Type
+TAO_ServerProtocolPolicy::_tao_cached_type (void) const
+{
+ return TAO_CACHED_POLICY_RT_SERVER_PROTOCOL;
+}
+
+TAO_Policy_Scope
+TAO_ServerProtocolPolicy::_tao_scope (void) const
+{
+ return static_cast<TAO_Policy_Scope> (TAO_POLICY_ORB_SCOPE |
+ TAO_POLICY_POA_SCOPE);
+}
+
+RTCORBA::ProtocolList &
+TAO_ServerProtocolPolicy::protocols_rep (void)
+{
+ return protocols_;
+}
+
+// ****************************************************************
+
+TAO_ClientProtocolPolicy::TAO_ClientProtocolPolicy (void)
+{
+}
+
+
+TAO_ClientProtocolPolicy::TAO_ClientProtocolPolicy (const RTCORBA::ProtocolList &protocols)
+ : ::CORBA::Object ()
+ , ::CORBA::Policy ()
+ , ::CORBA::LocalObject ()
+ , RTCORBA::ClientProtocolPolicy ()
+ , TAO_Local_RefCounted_Object ()
+ , protocols_ (protocols)
+{
+}
+
+TAO_ClientProtocolPolicy::TAO_ClientProtocolPolicy (const TAO_ClientProtocolPolicy &rhs)
+ : ::CORBA::Object ()
+ , ::CORBA::Policy ()
+ , ::CORBA::LocalObject ()
+ , RTCORBA::ClientProtocolPolicy ()
+ , TAO_Local_RefCounted_Object ()
+ , protocols_ (rhs.protocols_)
+{
+}
+
+TAO_ClientProtocolPolicy::~TAO_ClientProtocolPolicy ()
+{
+}
+
+CORBA::Policy_ptr
+TAO_ClientProtocolPolicy::create (const CORBA::Any &val
+ ACE_ENV_ARG_DECL)
+{
+ RTCORBA::ProtocolList *value = 0;
+ if ((val >>= value) == 0)
+ ACE_THROW_RETURN (CORBA::PolicyError (CORBA::BAD_POLICY_VALUE),
+ CORBA::Policy::_nil ());
+
+ TAO_ClientProtocolPolicy *tmp = 0;
+ ACE_NEW_THROW_EX (tmp,
+ TAO_ClientProtocolPolicy (*value),
+ CORBA::NO_MEMORY (TAO::VMCID,
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+
+ return tmp;
+}
+
+RTCORBA::ProtocolList *
+TAO_ClientProtocolPolicy::protocols (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ RTCORBA::ProtocolList *tmp = 0;
+ ACE_NEW_THROW_EX (tmp,
+ RTCORBA::ProtocolList (this->protocols_),
+ CORBA::NO_MEMORY (TAO::VMCID,
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (0);
+
+ return tmp;
+}
+
+CORBA::PolicyType
+TAO_ClientProtocolPolicy::policy_type (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return RTCORBA::CLIENT_PROTOCOL_POLICY_TYPE;
+}
+
+CORBA::Policy_ptr
+TAO_ClientProtocolPolicy::copy (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ TAO_ClientProtocolPolicy* tmp = 0;
+ ACE_NEW_THROW_EX (tmp,
+ TAO_ClientProtocolPolicy (*this),
+ CORBA::NO_MEMORY (TAO::VMCID,
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+
+ return tmp;
+}
+
+void
+TAO_ClientProtocolPolicy::destroy (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+}
+
+TAO_Cached_Policy_Type
+TAO_ClientProtocolPolicy::_tao_cached_type (void) const
+{
+ return TAO_CACHED_POLICY_RT_CLIENT_PROTOCOL;
+}
+
+TAO_Policy_Scope
+TAO_ClientProtocolPolicy::_tao_scope (void) const
+{
+ return static_cast<TAO_Policy_Scope> (TAO_POLICY_DEFAULT_SCOPE |
+ TAO_POLICY_CLIENT_EXPOSED);
+}
+
+CORBA::Boolean
+TAO_ClientProtocolPolicy::_tao_encode (TAO_OutputCDR &out_cdr)
+{
+ CORBA::Boolean is_write_ok = out_cdr << this->protocols_.length ();
+
+ for (CORBA::ULong i = 0;
+ (i < this->protocols_.length ()) && is_write_ok;
+ i++)
+ {
+ is_write_ok =
+ (out_cdr << this->protocols_[i].protocol_type)
+ &&
+ this->protocols_[i].orb_protocol_properties->_tao_encode (out_cdr)
+ &&
+ this->protocols_[i].transport_protocol_properties->_tao_encode (out_cdr);
+ }
+
+ return is_write_ok;
+}
+
+CORBA::Boolean
+TAO_ClientProtocolPolicy::_tao_decode (TAO_InputCDR &in_cdr)
+{
+ CORBA::ULong length;
+ CORBA::Boolean is_read_ok = in_cdr >> length;
+
+ this->protocols_.length (length);
+
+ for (CORBA::ULong i = 0; (i < length) && is_read_ok; i++)
+ {
+ is_read_ok = in_cdr >> this->protocols_[i].protocol_type;
+
+ this->protocols_[i].orb_protocol_properties =
+ TAO_Protocol_Properties_Factory::create_orb_protocol_property
+ (this->protocols_[i].protocol_type);
+
+ this->protocols_[i].transport_protocol_properties =
+ TAO_Protocol_Properties_Factory::create_transport_protocol_property
+ (this->protocols_[i].protocol_type, in_cdr.orb_core ());
+
+ if (is_read_ok
+ && (this->protocols_[i].orb_protocol_properties.ptr () != 0))
+ is_read_ok =
+ this->protocols_[i].orb_protocol_properties->_tao_decode (in_cdr);
+
+ if (is_read_ok
+ && (this->protocols_[i].transport_protocol_properties.ptr () != 0))
+ is_read_ok =
+ this->protocols_[i].transport_protocol_properties->_tao_decode (in_cdr);
+
+ }
+
+ return is_read_ok;
+}
+
+RTCORBA::ProtocolList &
+TAO_ClientProtocolPolicy::protocols_rep (void)
+{
+ return protocols_;
+}
+
+// ****************************************************************
+
+TAO_TCP_Protocol_Properties::TAO_TCP_Protocol_Properties (CORBA::Long send_buffer_size,
+ CORBA::Long recv_buffer_size,
+ CORBA::Boolean keep_alive,
+ CORBA::Boolean dont_route,
+ CORBA::Boolean no_delay,
+ CORBA::Boolean enable_network_priority)
+ : send_buffer_size_ (send_buffer_size),
+ recv_buffer_size_ (recv_buffer_size),
+ keep_alive_ (keep_alive),
+ dont_route_ (dont_route),
+ no_delay_ (no_delay),
+ enable_network_priority_ (enable_network_priority)
+{
+}
+
+TAO_TCP_Protocol_Properties::~TAO_TCP_Protocol_Properties (void)
+{
+}
+
+CORBA::Long
+TAO_TCP_Protocol_Properties::send_buffer_size (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return this->send_buffer_size_;
+}
+
+void
+TAO_TCP_Protocol_Properties::send_buffer_size (CORBA::Long send_buffer_size
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->send_buffer_size_ = send_buffer_size;
+}
+
+CORBA::Long
+TAO_TCP_Protocol_Properties::recv_buffer_size (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return this->recv_buffer_size_;
+}
+
+void
+TAO_TCP_Protocol_Properties::recv_buffer_size (CORBA::Long recv_buffer_size
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->recv_buffer_size_ = recv_buffer_size;
+}
+
+CORBA::Boolean
+TAO_TCP_Protocol_Properties::keep_alive (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return this->keep_alive_;
+}
+
+void
+TAO_TCP_Protocol_Properties::keep_alive (CORBA::Boolean keep_alive
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->keep_alive_ = keep_alive;
+}
+
+CORBA::Boolean
+TAO_TCP_Protocol_Properties::dont_route (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return this->dont_route_;
+}
+
+void
+TAO_TCP_Protocol_Properties::dont_route (CORBA::Boolean dont_route
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->dont_route_ = dont_route;
+}
+
+CORBA::Boolean TAO_TCP_Protocol_Properties::no_delay (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return this->no_delay_;
+}
+
+void
+TAO_TCP_Protocol_Properties::no_delay (CORBA::Boolean no_delay
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->no_delay_ = no_delay;
+}
+
+CORBA::Boolean
+TAO_TCP_Protocol_Properties::enable_network_priority (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return this->enable_network_priority_;
+}
+
+void
+TAO_TCP_Protocol_Properties::enable_network_priority (CORBA::Boolean enable
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->enable_network_priority_ = enable;
+}
+
+CORBA::Boolean
+TAO_TCP_Protocol_Properties::_tao_encode (TAO_OutputCDR & out_cdr)
+{
+ return ((out_cdr << this->send_buffer_size_)
+ &&
+ (out_cdr << this->recv_buffer_size_)
+ &&
+ (out_cdr.write_boolean (this->keep_alive_))
+ &&
+ (out_cdr.write_boolean (this->dont_route_))
+ &&
+ (out_cdr.write_boolean (this->no_delay_)));
+}
+
+CORBA::Boolean
+TAO_TCP_Protocol_Properties::_tao_decode (TAO_InputCDR &in_cdr)
+{
+ return ((in_cdr >> this->send_buffer_size_)
+ &&
+ (in_cdr >> this->recv_buffer_size_)
+ &&
+ (in_cdr.read_boolean (this->keep_alive_))
+ &&
+ (in_cdr.read_boolean (this->dont_route_))
+ &&
+ (in_cdr.read_boolean (this->no_delay_)));
+}
+
+// ****************************************************************
+
+TAO_UnixDomain_Protocol_Properties::TAO_UnixDomain_Protocol_Properties
+(CORBA::Long send_buffer_size,
+ CORBA::Long recv_buffer_size)
+ : send_buffer_size_ (send_buffer_size),
+ recv_buffer_size_ (recv_buffer_size)
+{
+}
+
+TAO_UnixDomain_Protocol_Properties::~TAO_UnixDomain_Protocol_Properties (void)
+{
+}
+
+CORBA::Long
+TAO_UnixDomain_Protocol_Properties::send_buffer_size (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return this->send_buffer_size_;
+}
+
+void
+TAO_UnixDomain_Protocol_Properties::send_buffer_size (CORBA::Long send_buffer_size
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->send_buffer_size_ = send_buffer_size;
+}
+
+CORBA::Long
+TAO_UnixDomain_Protocol_Properties::recv_buffer_size (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return this->recv_buffer_size_;
+}
+
+void
+TAO_UnixDomain_Protocol_Properties::recv_buffer_size (CORBA::Long recv_buffer_size
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->recv_buffer_size_ = recv_buffer_size;
+}
+
+CORBA::Boolean
+TAO_UnixDomain_Protocol_Properties::_tao_encode (TAO_OutputCDR &out_cdr)
+{
+ return ((out_cdr << this->send_buffer_size_)
+ && (out_cdr << this->recv_buffer_size_));
+}
+
+CORBA::Boolean
+TAO_UnixDomain_Protocol_Properties::_tao_decode (TAO_InputCDR &in_cdr)
+{
+ return ((in_cdr >> this->send_buffer_size_)
+ && (in_cdr >> this->recv_buffer_size_));
+}
+
+// ****************************************************************
+
+TAO_SharedMemory_Protocol_Properties::TAO_SharedMemory_Protocol_Properties (CORBA::Long send_buffer_size,
+ CORBA::Long recv_buffer_size,
+ CORBA::Boolean keep_alive,
+ CORBA::Boolean dont_route,
+ CORBA::Boolean no_delay,
+ CORBA::Long preallocate_buffer_size,
+ const char *mmap_filename,
+ const char *mmap_lockname)
+ : send_buffer_size_ (send_buffer_size),
+ recv_buffer_size_ (recv_buffer_size),
+ keep_alive_ (keep_alive),
+ dont_route_ (dont_route),
+ no_delay_ (no_delay),
+ preallocate_buffer_size_ (preallocate_buffer_size),
+ mmap_filename_ (mmap_filename),
+ mmap_lockname_ (mmap_lockname)
+{
+}
+
+TAO_SharedMemory_Protocol_Properties::~TAO_SharedMemory_Protocol_Properties (void)
+{
+}
+
+
+CORBA::Long
+TAO_SharedMemory_Protocol_Properties::send_buffer_size (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return this->send_buffer_size_;
+}
+
+void
+TAO_SharedMemory_Protocol_Properties::send_buffer_size (CORBA::Long send_buffer_size
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->send_buffer_size_ = send_buffer_size;
+}
+
+CORBA::Long
+TAO_SharedMemory_Protocol_Properties::recv_buffer_size (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return this->recv_buffer_size_;
+}
+
+void
+TAO_SharedMemory_Protocol_Properties::recv_buffer_size (CORBA::Long recv_buffer_size
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->recv_buffer_size_ = recv_buffer_size;
+}
+
+CORBA::Boolean
+TAO_SharedMemory_Protocol_Properties::keep_alive (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return this->keep_alive_;
+}
+
+void
+TAO_SharedMemory_Protocol_Properties::keep_alive (CORBA::Boolean keep_alive
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->keep_alive_ = keep_alive;
+}
+
+CORBA::Boolean
+TAO_SharedMemory_Protocol_Properties::dont_route (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return this->dont_route_;
+}
+
+void
+TAO_SharedMemory_Protocol_Properties::dont_route (CORBA::Boolean dont_route
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->dont_route_ = dont_route;
+}
+
+CORBA::Boolean
+TAO_SharedMemory_Protocol_Properties::no_delay (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return this->no_delay_;
+}
+
+void
+TAO_SharedMemory_Protocol_Properties::no_delay (CORBA::Boolean no_delay
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->no_delay_ = no_delay;
+}
+
+CORBA::Long
+TAO_SharedMemory_Protocol_Properties::preallocate_buffer_size (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return this->preallocate_buffer_size_;
+}
+
+void
+TAO_SharedMemory_Protocol_Properties::preallocate_buffer_size (CORBA::Long preallocate_buffer_size
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->preallocate_buffer_size_ = preallocate_buffer_size;
+}
+
+char *
+TAO_SharedMemory_Protocol_Properties::mmap_filename (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return this->mmap_filename_.rep ();
+}
+
+void
+TAO_SharedMemory_Protocol_Properties::mmap_filename (const char * mmap_filename
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->mmap_filename_.set (mmap_filename);
+}
+
+char *
+TAO_SharedMemory_Protocol_Properties::mmap_lockname (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return this->mmap_lockname_.rep ();
+}
+
+void
+TAO_SharedMemory_Protocol_Properties::mmap_lockname (const char * mmap_lockname
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->mmap_lockname_.set (mmap_lockname);
+}
+
+CORBA::Boolean
+TAO_SharedMemory_Protocol_Properties::_tao_encode (TAO_OutputCDR &out_cdr)
+{
+ return ((out_cdr << this->send_buffer_size_)
+ &&
+ (out_cdr << this->recv_buffer_size_)
+ &&
+ (out_cdr.write_boolean (this->keep_alive_))
+ &&
+ (out_cdr.write_boolean (this->dont_route_))
+ &&
+ (out_cdr.write_boolean (this->no_delay_))
+ &&
+ (out_cdr << this->preallocate_buffer_size_)
+ &&
+ (out_cdr << this->mmap_filename_)
+ &&
+ (out_cdr << this->mmap_lockname_));
+}
+
+CORBA::Boolean
+TAO_SharedMemory_Protocol_Properties::_tao_decode (TAO_InputCDR &in_cdr)
+{
+ return ((in_cdr >> this->send_buffer_size_)
+ &&
+ (in_cdr >> this->recv_buffer_size_)
+ &&
+ (in_cdr.read_boolean (this->keep_alive_))
+ &&
+ (in_cdr.read_boolean (this->dont_route_))
+ &&
+ (in_cdr.read_boolean (this->no_delay_))
+ &&
+ (in_cdr >> this->preallocate_buffer_size_)
+ &&
+ (in_cdr >> this->mmap_filename_)
+ &&
+ (in_cdr >> this->mmap_lockname_));
+}
+
+// ****************************************************************
+
+TAO_UserDatagram_Protocol_Properties::TAO_UserDatagram_Protocol_Properties (CORBA::Boolean enable_network_priority)
+ : enable_network_priority_ (enable_network_priority)
+{
+}
+
+TAO_UserDatagram_Protocol_Properties::~TAO_UserDatagram_Protocol_Properties (void)
+{
+}
+
+CORBA::Boolean
+TAO_UserDatagram_Protocol_Properties::enable_network_priority (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return this->enable_network_priority_;
+}
+
+void
+TAO_UserDatagram_Protocol_Properties::enable_network_priority (CORBA::Boolean enable
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->enable_network_priority_ = enable;
+}
+
+CORBA::Boolean
+TAO_UserDatagram_Protocol_Properties::_tao_encode (TAO_OutputCDR &)
+{
+ return true;
+}
+
+CORBA::Boolean
+TAO_UserDatagram_Protocol_Properties::_tao_decode (TAO_InputCDR &)
+{
+ return true;
+}
+
+// ****************************************************************
+
+TAO_StreamControl_Protocol_Properties::TAO_StreamControl_Protocol_Properties (CORBA::Long send_buffer_size,
+ CORBA::Long recv_buffer_size,
+ CORBA::Boolean keep_alive,
+ CORBA::Boolean dont_route,
+ CORBA::Boolean no_delay,
+ CORBA::Boolean enable_network_priority)
+ : send_buffer_size_ (send_buffer_size),
+ recv_buffer_size_ (recv_buffer_size),
+ keep_alive_ (keep_alive),
+ dont_route_ (dont_route),
+ no_delay_ (no_delay),
+ enable_network_priority_ (enable_network_priority)
+{
+}
+
+TAO_StreamControl_Protocol_Properties::~TAO_StreamControl_Protocol_Properties (void)
+{
+}
+
+CORBA::Long
+TAO_StreamControl_Protocol_Properties::send_buffer_size (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return this->send_buffer_size_;
+}
+
+void
+TAO_StreamControl_Protocol_Properties::send_buffer_size (CORBA::Long send_buffer_size
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->send_buffer_size_ = send_buffer_size;
+}
+
+CORBA::Long
+TAO_StreamControl_Protocol_Properties::recv_buffer_size (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return this->recv_buffer_size_;
+}
+
+void
+TAO_StreamControl_Protocol_Properties::recv_buffer_size (CORBA::Long recv_buffer_size
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->recv_buffer_size_ = recv_buffer_size;
+}
+
+CORBA::Boolean
+TAO_StreamControl_Protocol_Properties::keep_alive (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return this->keep_alive_;
+}
+
+void
+TAO_StreamControl_Protocol_Properties::keep_alive (CORBA::Boolean keep_alive
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->keep_alive_ = keep_alive;
+}
+
+CORBA::Boolean
+TAO_StreamControl_Protocol_Properties::dont_route (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return this->dont_route_;
+}
+
+void
+TAO_StreamControl_Protocol_Properties::dont_route (CORBA::Boolean dont_route
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->dont_route_ = dont_route;
+}
+
+CORBA::Boolean TAO_StreamControl_Protocol_Properties::no_delay (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return this->no_delay_;
+}
+
+void
+TAO_StreamControl_Protocol_Properties::no_delay (CORBA::Boolean no_delay
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->no_delay_ = no_delay;
+}
+
+CORBA::Boolean
+TAO_StreamControl_Protocol_Properties::enable_network_priority (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return this->enable_network_priority_;
+}
+
+void
+TAO_StreamControl_Protocol_Properties::enable_network_priority (CORBA::Boolean enable
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->enable_network_priority_ = enable;
+}
+
+CORBA::Boolean
+TAO_StreamControl_Protocol_Properties::_tao_encode (TAO_OutputCDR & out_cdr)
+{
+ return ((out_cdr << this->send_buffer_size_)
+ &&
+ (out_cdr << this->recv_buffer_size_)
+ &&
+ (out_cdr.write_boolean (this->keep_alive_))
+ &&
+ (out_cdr.write_boolean (this->dont_route_))
+ &&
+ (out_cdr.write_boolean (this->no_delay_)));
+}
+
+CORBA::Boolean
+TAO_StreamControl_Protocol_Properties::_tao_decode (TAO_InputCDR &in_cdr)
+{
+ return ((in_cdr >> this->send_buffer_size_)
+ &&
+ (in_cdr >> this->recv_buffer_size_)
+ &&
+ (in_cdr.read_boolean (this->keep_alive_))
+ &&
+ (in_cdr.read_boolean (this->dont_route_))
+ &&
+ (in_cdr.read_boolean (this->no_delay_)));
+}
+
+// ****************************************************************
+
+TAO_GIOP_Protocol_Properties::TAO_GIOP_Protocol_Properties (void)
+{
+}
+
+TAO_GIOP_Protocol_Properties::~TAO_GIOP_Protocol_Properties (void)
+{
+}
+
+CORBA::Boolean
+TAO_GIOP_Protocol_Properties::_tao_encode (TAO_OutputCDR &)
+{
+ return 1;
+}
+
+CORBA::Boolean
+TAO_GIOP_Protocol_Properties::_tao_decode (TAO_InputCDR &)
+{
+ return 1;
+}
+
+// ****************************************************************
+
+RTCORBA::ProtocolProperties *
+TAO_Protocol_Properties_Factory::create_transport_protocol_property (IOP::ProfileId id,
+ TAO_ORB_Core *orb_core)
+{
+ RTCORBA::ProtocolProperties* property = 0;
+
+ if (id == IOP::TAG_INTERNET_IOP)
+ {
+ int send_buffer_size = orb_core ? orb_core->orb_params ()->sock_sndbuf_size () : 0;
+ int recv_buffer_size = orb_core ? orb_core->orb_params ()->sock_rcvbuf_size () : 0;
+ int no_delay = orb_core ? orb_core->orb_params ()->nodelay () : 0;
+ CORBA::Boolean keep_alive = true;
+ CORBA::Boolean dont_route = false;
+ CORBA::Boolean enable_network_priority = false;
+
+ ACE_NEW_RETURN (property,
+ TAO_TCP_Protocol_Properties (send_buffer_size,
+ recv_buffer_size,
+ keep_alive,
+ dont_route,
+ no_delay,
+ enable_network_priority),
+ 0);
+ }
+
+ else if (id == TAO_TAG_SHMEM_PROFILE)
+ {
+ int send_buffer_size = orb_core ? orb_core->orb_params ()->sock_sndbuf_size () : 0;
+ int recv_buffer_size = orb_core ? orb_core->orb_params ()->sock_rcvbuf_size () : 0;
+ int no_delay = orb_core ? orb_core->orb_params ()->nodelay () : 0;
+ CORBA::Boolean keep_alive = true;
+ CORBA::Boolean dont_route = false;
+ CORBA::Long preallocate_buffer_size = false;
+ const char *mmap_filename = "";
+ const char *mmap_lockname = "";
+
+ ACE_NEW_RETURN (property,
+ TAO_SharedMemory_Protocol_Properties (send_buffer_size,
+ recv_buffer_size,
+ keep_alive,
+ dont_route,
+ no_delay,
+ preallocate_buffer_size,
+ mmap_filename,
+ mmap_lockname),
+ 0);
+ }
+
+ else if (id == TAO_TAG_UIOP_PROFILE)
+ {
+ int send_buffer_size = orb_core ? orb_core->orb_params ()->sock_sndbuf_size () : 0;
+ int recv_buffer_size = orb_core ? orb_core->orb_params ()->sock_rcvbuf_size () : 0;
+
+ ACE_NEW_RETURN (property,
+ TAO_UnixDomain_Protocol_Properties (send_buffer_size,
+ recv_buffer_size),
+ 0);
+ }
+
+ else if (id == TAO_TAG_DIOP_PROFILE)
+ {
+ CORBA::Boolean enable_network_priority = 0;
+
+ ACE_NEW_RETURN (property,
+ TAO_UserDatagram_Protocol_Properties (enable_network_priority),
+ 0);
+ }
+
+ else if (id == TAO_TAG_SCIOP_PROFILE)
+ {
+ int send_buffer_size = orb_core ? orb_core->orb_params ()->sock_sndbuf_size () : 0;
+ int recv_buffer_size = orb_core ? orb_core->orb_params ()->sock_rcvbuf_size () : 0;
+ int no_delay = orb_core ? orb_core->orb_params ()->nodelay () : 0;
+ CORBA::Boolean keep_alive = true;
+ CORBA::Boolean dont_route = false;
+ CORBA::Boolean enable_network_priority = false;
+
+ ACE_NEW_RETURN (property,
+ TAO_StreamControl_Protocol_Properties (send_buffer_size,
+ recv_buffer_size,
+ keep_alive,
+ dont_route,
+ no_delay,
+ enable_network_priority),
+ 0);
+ }
+
+ return property;
+}
+
+RTCORBA::ProtocolProperties*
+TAO_Protocol_Properties_Factory::create_orb_protocol_property (IOP::ProfileId id)
+{
+ RTCORBA::ProtocolProperties* property = 0;
+
+ if (id == IOP::TAG_INTERNET_IOP)
+ ACE_NEW_RETURN (property,
+ TAO_GIOP_Protocol_Properties,
+ 0);
+
+ // Right now the only supported ORB protocol is GIOP
+ // so we couple this with every protocol property.
+ // The else statement is not necessary, but it
+ // is here just to make clear that as soon as
+ // new ORB protocol are supported other case
+ // should be considered.
+ else
+ ACE_NEW_RETURN (property,
+ TAO_GIOP_Protocol_Properties,
+ 0);
+ return property;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
diff --git a/TAO/tao/RTCORBA/RT_Policy_i.h b/TAO/tao/RTCORBA/RT_Policy_i.h
new file mode 100644
index 00000000000..ed8e1cfe6a4
--- /dev/null
+++ b/TAO/tao/RTCORBA/RT_Policy_i.h
@@ -0,0 +1,912 @@
+/* -*- C++ -*- */
+//=============================================================================
+/**
+ * @file RT_Policy_i.h
+ *
+ * $Id$
+ *
+ * @author Marina Spivak (marina@cs.wustl.edu)
+ */
+//=============================================================================
+
+
+#ifndef TAO_RT_POLICY_I_H
+#define TAO_RT_POLICY_I_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#define TAO_RTCORBA_SAFE_INCLUDE
+#include "tao/RTCORBA/RTCORBAC.h"
+#undef TAO_RTCORBA_SAFE_INCLUDE
+
+#include "tao/LocalObject.h"
+#include "tao/Basic_Types.h"
+
+#include "ace/SString.h"
+
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_PriorityModelPolicy
+ *
+ * @brief RTCORBA::PriorityModelPolicy implementation
+ *
+ * This policy controls how the priority at which a server handles
+ * requests from clients is determined.
+ */
+class TAO_RTCORBA_Export TAO_PriorityModelPolicy
+ : public RTCORBA::PriorityModelPolicy,
+ public TAO_Local_RefCounted_Object
+{
+public:
+ /// Constructor.
+ TAO_PriorityModelPolicy (RTCORBA::PriorityModel priority_model,
+ RTCORBA::Priority server_priority);
+
+ /// Copy constructor.
+ TAO_PriorityModelPolicy (const TAO_PriorityModelPolicy &rhs);
+
+ /**
+ * Accessor for the <priority_model_> attribute. This method is
+ * used internally by the orb. This is a more efficient
+ * (non-virtual, no exception handling) relative of the idl interface
+ * implementation <priority_model> below.
+ */
+ RTCORBA::PriorityModel get_priority_model (void);
+
+ RTCORBA::PriorityModel priority_model (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ RTCORBA::Priority server_priority (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ CORBA::PolicyType policy_type (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ CORBA::Policy_ptr copy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ void destroy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// This method writes a CDR representation of the object state.
+ CORBA::Boolean _tao_encode (TAO_OutputCDR &out_cdr);
+
+ /// This method reads the object state from a CDR representation.
+ CORBA::Boolean _tao_decode (TAO_InputCDR &in_cdr);
+
+ // Return the cached policy type for this policy.
+ TAO_Cached_Policy_Type _tao_cached_type (void) const;
+
+ // Returns the scope at which this policy can be applied. See orbconf.h.
+ TAO_Policy_Scope _tao_scope (void) const;
+
+ /// Helper method for the implementation of
+ /// CORBA::ORB::create_policy.
+ static CORBA::Policy_ptr create (const CORBA::Any &val
+ ACE_ENV_ARG_DECL);
+
+protected:
+
+ /// Protected destructor to enforce proper memory management of this
+ /// reference counted object.
+ virtual ~TAO_PriorityModelPolicy (void);
+
+ /// This constructor is used by TAO_RT_PolicyFactory when decoding
+ /// policies from tagged components in an IOR.
+ friend class TAO_RT_PolicyFactory;
+ TAO_PriorityModelPolicy (void);
+
+private:
+
+ /// Attributes.
+ RTCORBA::PriorityModel priority_model_;
+ RTCORBA::Priority server_priority_;
+};
+
+//*************************************************************************
+
+/**
+ * @class TAO_ThreadpoolPolicy
+ *
+ * @brief RTCORBA::ThreadpoolPolicy implementation
+ *
+ * This policy controls which threadpool is associated with a POA.
+ */
+class TAO_RTCORBA_Export TAO_ThreadpoolPolicy
+ : public RTCORBA::ThreadpoolPolicy,
+ public TAO_Local_RefCounted_Object
+{
+public:
+ /// Constructor.
+ TAO_ThreadpoolPolicy (RTCORBA::ThreadpoolId id);
+
+ /// Copy constructor.
+ TAO_ThreadpoolPolicy (const TAO_ThreadpoolPolicy &rhs);
+
+ RTCORBA::ThreadpoolId threadpool (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ CORBA::PolicyType policy_type (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ CORBA::Policy_ptr copy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ void destroy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ // Return the cached policy type for this policy.
+ TAO_Cached_Policy_Type _tao_cached_type (void) const;
+
+ // Returns the scope at which this policy can be applied. See orbconf.h.
+ TAO_Policy_Scope _tao_scope (void) const;
+
+ /// Helper method for the implementation of
+ /// CORBA::ORB::create_policy.
+ static CORBA::Policy_ptr create (const CORBA::Any &val
+ ACE_ENV_ARG_DECL);
+
+protected:
+
+ /// Protected destructor to enforce proper memory management of this
+ /// reference counted object.
+ virtual ~TAO_ThreadpoolPolicy (void);
+
+private:
+
+ /// Attribute.
+ RTCORBA::ThreadpoolId id_;
+};
+
+//*************************************************************************
+
+/**
+ * @class TAO_PrivateConnectionPolicy
+ *
+ * @brief RTCORBA::PrivateConnectionPolicy implementation
+ *
+ * This policy controls whether the transport connection for the
+ * Object is private, i.e., not available for carrying out invocations on
+ * other objects.
+ */
+class TAO_RTCORBA_Export TAO_PrivateConnectionPolicy
+ : public RTCORBA::PrivateConnectionPolicy,
+ public TAO_Local_RefCounted_Object
+{
+public:
+ /// Constructor.
+ TAO_PrivateConnectionPolicy (void);
+
+ /// Copy constructor.
+ TAO_PrivateConnectionPolicy (const TAO_PrivateConnectionPolicy &rhs);
+
+ CORBA::PolicyType policy_type (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ CORBA::Policy_ptr copy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ void destroy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ // Return the cached policy type for this policy.
+ TAO_Cached_Policy_Type _tao_cached_type (void) const;
+
+ // Returns the scope at which this policy can be applied. See orbconf.h.
+ TAO_Policy_Scope _tao_scope (void) const;
+
+ /// Helper method for the implementation of
+ /// CORBA::ORB::create_policy.
+ static CORBA::Policy_ptr create (const CORBA::Any &val
+ ACE_ENV_ARG_DECL);
+
+protected:
+
+ /// Protected destructor to enforce proper memory management of this
+ /// reference counted object.
+ virtual ~TAO_PrivateConnectionPolicy (void);
+
+};
+
+//*************************************************************************
+
+/**
+ * @class TAO_PriorityBandedConnectionPolicy
+ *
+ * @brief RTCORBA::PriorityBandedConnectionPolicy implementation
+ *
+ * RT CORBA provides facility for a client to communicate with a
+ * server via multiple connections, aka bands, with each connection handling
+ * invocations that are made at a different CORBA priority.
+ * This policy allows the specification of the number of such
+ * bands and their priorities.
+ */
+class TAO_RTCORBA_Export TAO_PriorityBandedConnectionPolicy
+ : public RTCORBA::PriorityBandedConnectionPolicy,
+ public TAO_Local_RefCounted_Object
+{
+public:
+ /// Constructor.
+ TAO_PriorityBandedConnectionPolicy (const RTCORBA::PriorityBands &bands);
+
+ /// Copy constructor.
+ TAO_PriorityBandedConnectionPolicy (const TAO_PriorityBandedConnectionPolicy &rhs);
+
+ /**
+ * Accessor to the underlying priority bands of the policy (does not
+ * make a copy like the idl accessor <priority_bands> implementation
+ * below.)
+ */
+ RTCORBA::PriorityBands &priority_bands_rep (void);
+
+ RTCORBA::PriorityBands *priority_bands (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ CORBA::PolicyType policy_type (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ CORBA::Policy_ptr copy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ void destroy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// This method writes a CDR representation of the current object.
+ CORBA::Boolean _tao_encode (TAO_OutputCDR &out_cdr);
+
+ /// This method reads the object state from a CDR representation.
+ CORBA::Boolean _tao_decode (TAO_InputCDR &in_cdr);
+
+ // Return the cached policy type for this policy.
+ TAO_Cached_Policy_Type _tao_cached_type (void) const;
+
+ // Returns the scope at which this policy can be applied. See orbconf.h.
+ TAO_Policy_Scope _tao_scope (void) const;
+
+ /// Helper method for the implementation of
+ /// CORBA::ORB::create_policy.
+ static CORBA::Policy_ptr create (const CORBA::Any &val
+ ACE_ENV_ARG_DECL);
+
+protected:
+
+ /// Protected destructor to enforce proper memory management of this
+ /// reference counted object.
+ virtual ~TAO_PriorityBandedConnectionPolicy (void);
+
+ /// This constructor is used by TAO_RT_PolicyFactory when decoding
+ /// policies from tagged components in an IOR.
+ friend class TAO_RT_PolicyFactory;
+ TAO_PriorityBandedConnectionPolicy (void);
+
+private:
+
+ /// Attribute.
+ RTCORBA::PriorityBands priority_bands_;
+};
+
+//*************************************************************************
+
+/**
+ * @class TAO_ServerProtocolPolicy
+ *
+ * @brief RTCORBA::ServerProtocolPolicy implementation
+ *
+ * This policy controls selection and configuration of
+ * communication protocols on the server-side of the RT ORB.
+ */
+class TAO_RTCORBA_Export TAO_ServerProtocolPolicy
+ : public RTCORBA::ServerProtocolPolicy,
+ public TAO_Local_RefCounted_Object
+{
+public:
+ /// Constructor.
+ TAO_ServerProtocolPolicy (const RTCORBA::ProtocolList &protocols);
+
+ /// Copy constructor.
+ TAO_ServerProtocolPolicy (const TAO_ServerProtocolPolicy &rhs);
+
+ /**
+ * Accessor to the underlying protocols list of the policy (does not
+ * make a copy like the idl accessor <protocols> implementation
+ * below.)
+ */
+ RTCORBA::ProtocolList & protocols_rep (void);
+
+ RTCORBA::ProtocolList *protocols
+ (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ CORBA::PolicyType policy_type (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ CORBA::Policy_ptr copy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ void destroy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ // Return the cached policy type for this policy.
+ TAO_Cached_Policy_Type _tao_cached_type (void) const;
+
+ // Returns the scope at which this policy can be applied. See orbconf.h.
+ TAO_Policy_Scope _tao_scope (void) const;
+
+ /// Helper method for the implementation of
+ /// CORBA::ORB::create_policy.
+ static CORBA::Policy_ptr create (const CORBA::Any &val
+ ACE_ENV_ARG_DECL);
+
+protected:
+
+ /// Protected destructor to enforce proper memory management of this
+ /// reference counted object.
+ virtual ~TAO_ServerProtocolPolicy (void);
+
+private:
+
+ /// Attribute.
+ RTCORBA::ProtocolList protocols_;
+};
+
+//*************************************************************************
+
+/**
+ * @class TAO_ClientProtocolPolicy
+ *
+ * @brief RTCORBA::ClientProtocolPolicy implementation
+ *
+ * This policy controls selection and configuration of
+ * communication protocols on the client-side of the RT ORB.
+ */
+class TAO_RTCORBA_Export TAO_ClientProtocolPolicy
+ : public RTCORBA::ClientProtocolPolicy,
+ public TAO_Local_RefCounted_Object
+{
+public:
+ /// Constructor.
+ TAO_ClientProtocolPolicy (const RTCORBA::ProtocolList &protocols);
+
+ /// Copy constructor.
+ TAO_ClientProtocolPolicy (const TAO_ClientProtocolPolicy &rhs);
+
+ /**
+ * Accessor to the underlying protocols list of the policy (does not
+ * make a copy like the idl accessor <protocols> implementation
+ * below.)
+ */
+ RTCORBA::ProtocolList & protocols_rep (void);
+
+ RTCORBA::ProtocolList *protocols
+ (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ CORBA::PolicyType policy_type (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ CORBA::Policy_ptr copy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ void destroy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ // = CDR Encoder/Decoder.
+
+ /// This method writes a CDR representation of the current object.
+ CORBA::Boolean _tao_encode (TAO_OutputCDR &out_cdr);
+
+ /// This method reads the object state from a CDR representation.
+ CORBA::Boolean _tao_decode (TAO_InputCDR &in_cdr);
+
+ // Return the cached policy type for this policy.
+ TAO_Cached_Policy_Type _tao_cached_type (void) const;
+
+ // Returns the scope at which this policy can be applied. See orbconf.h.
+ TAO_Policy_Scope _tao_scope (void) const;
+
+ /// Helper method for the implementation of
+ /// CORBA::ORB::create_policy.
+ static CORBA::Policy_ptr create (const CORBA::Any &val
+ ACE_ENV_ARG_DECL);
+
+protected:
+
+ /// Protected destructor to enforce proper memory management of this
+ /// reference counted object.
+ virtual ~TAO_ClientProtocolPolicy (void);
+
+ /// This constructor is used by TAO_RT_PolicyFactory when decoding
+ /// policies from tagged components in an IOR.
+ friend class TAO_RT_PolicyFactory;
+ TAO_ClientProtocolPolicy (void);
+
+private:
+
+ /// Attribute.
+ RTCORBA::ProtocolList protocols_;
+};
+
+//*************************************************************************
+
+/**
+ * @class TAO_TCP_Protocol_Properties
+ *
+ * @brief RTCORBA::TCPProtocolProperties implementation
+ *
+ * Stores TCP Protocol configuration properties.
+ */
+class TAO_RTCORBA_Export TAO_TCP_Protocol_Properties
+ : public RTCORBA::TCPProtocolProperties,
+ public TAO_Local_RefCounted_Object
+{
+public:
+ /// Constructor.
+ TAO_TCP_Protocol_Properties (CORBA::Long send_buffer_size,
+ CORBA::Long recv_buffer_size,
+ CORBA::Boolean keep_alive,
+ CORBA::Boolean dont_route,
+ CORBA::Boolean no_delay,
+ CORBA::Boolean enable_network_priority);
+
+ CORBA::Long send_buffer_size (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ void send_buffer_size (CORBA::Long send_buffer_size
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ CORBA::Long recv_buffer_size (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ void recv_buffer_size (CORBA::Long recv_buffer_size
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ CORBA::Boolean keep_alive (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ void keep_alive (CORBA::Boolean keep_alive
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ CORBA::Boolean dont_route (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ void dont_route (CORBA::Boolean dont_route
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ CORBA::Boolean no_delay (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ void no_delay (CORBA::Boolean no_delay
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ CORBA::Boolean enable_network_priority (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ void enable_network_priority (CORBA::Boolean enable
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// This method writes a CDR representation of TCPProtocolProperties.
+ CORBA::Boolean _tao_encode (TAO_OutputCDR &out_cdr);
+
+ /// This method reads the object state from a CDR representation.
+ CORBA::Boolean _tao_decode (TAO_InputCDR &in_cdr);
+
+protected:
+
+ /// Protected destructor to enforce proper memory management of this
+ /// reference counted object.
+ virtual ~TAO_TCP_Protocol_Properties (void);
+
+private:
+ // = Attributes.
+
+ CORBA::Long send_buffer_size_;
+ CORBA::Long recv_buffer_size_;
+ CORBA::Boolean keep_alive_;
+ CORBA::Boolean dont_route_;
+ CORBA::Boolean no_delay_;
+ CORBA::Boolean enable_network_priority_;
+};
+
+//*************************************************************************
+
+/**
+ * @class TAO_UnixDomain_Protocol_Properties
+ *
+ * @brief RTCORBA::UnixDomainProtocolProperties implementation.
+ *
+ * Stores Unix Domain Sockets (Local IPC) Protocol configuration
+ * properties.
+ */
+class TAO_RTCORBA_Export TAO_UnixDomain_Protocol_Properties
+ : public RTCORBA::UnixDomainProtocolProperties,
+ public TAO_Local_RefCounted_Object
+{
+public:
+
+ /// Constructor
+ TAO_UnixDomain_Protocol_Properties (CORBA::Long send_buffer_size,
+ CORBA::Long recv_buffer_size);
+
+ CORBA::Long send_buffer_size (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ void send_buffer_size (CORBA::Long send_buffer_size
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ CORBA::Long recv_buffer_size (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ void recv_buffer_size (CORBA::Long recv_buffer_size
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /**
+ * This method writes the CDR encapsulation of an instance of
+ * UnixDomainProperties. This Protocol Property in TAO specific,
+ * so there is no order of encapsulation specified in the
+ * RT CORBA Spec. The current implementation encodes the field
+ * according to the order of declaration (i.e. first is encoded
+ * send_buffer_size and then recv_buffer_size).
+ */
+ CORBA::Boolean _tao_encode (TAO_OutputCDR &out_cdr);
+
+ /**
+ * This method reads an instance of UnixDomainProperties from
+ * a CDR encapsulation. This Protocol Property in TAO specific,
+ * so there is no order of encapsulation specified in the
+ * RT CORBA Spec. The current implementation expect the field
+ * according to the order of declaration.
+ */
+ CORBA::Boolean _tao_decode (TAO_InputCDR &in_cdr);
+
+protected:
+
+ /// Protected destructor to enforce proper memory management of this
+ /// reference counted object.
+ virtual ~TAO_UnixDomain_Protocol_Properties (void);
+
+private:
+
+ // = Attributes.
+ CORBA::Long send_buffer_size_;
+ CORBA::Long recv_buffer_size_;
+};
+
+//*************************************************************************
+
+/**
+ * @class TAO_SharedMemory_Protocol_Properties
+ *
+ * @brief RTCORBA::SharedMemoryProtocolProperties implementation.
+ *
+ * Stores Shared Memory Protocol configuration
+ * properties.
+ */
+class TAO_RTCORBA_Export TAO_SharedMemory_Protocol_Properties
+ : public RTCORBA::SharedMemoryProtocolProperties,
+ public TAO_Local_RefCounted_Object
+{
+public:
+ /// Constructor.
+ TAO_SharedMemory_Protocol_Properties (CORBA::Long send_buffer_size,
+ CORBA::Long recv_buffer_size,
+ CORBA::Boolean keep_alive,
+ CORBA::Boolean dont_route,
+ CORBA::Boolean no_delay,
+ CORBA::Long preallocate_buffer_size,
+ const char *mmap_filename,
+ const char *mmap_lockname);
+
+ // = IDL interface methods.
+
+ CORBA::Long send_buffer_size (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ void send_buffer_size (CORBA::Long send_buffer_size
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ CORBA::Long recv_buffer_size (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ void recv_buffer_size (CORBA::Long recv_buffer_size
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ CORBA::Boolean keep_alive (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ void keep_alive (CORBA::Boolean keep_alive
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ CORBA::Boolean dont_route (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ void dont_route (CORBA::Boolean dont_route
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ CORBA::Boolean no_delay (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ void no_delay (CORBA::Boolean no_delay
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ CORBA::Boolean enable_network_priority (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ CORBA::Long preallocate_buffer_size (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ void preallocate_buffer_size (CORBA::Long preallocate_buffer_size
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ char *mmap_filename (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ void mmap_filename (const char *mmap_filename
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ char *mmap_lockname (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ void mmap_lockname (const char *mmap_lockname
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /**
+ * This method writes the CDR encapsulation of an instance of
+ * SharedMemoryProperties. This Protocol Property in TAO specific,
+ * so there is no order of encapsulation specified in the
+ * RT CORBA Spec. The current implementation encodes the field
+ * according to the order of declaration.
+ */
+ CORBA::Boolean _tao_encode (TAO_OutputCDR &out_cdr);
+
+ /**
+ * This method reads an instance of SharedMemoryProperties from
+ * a CDR encapsulation. This Protocol Property in TAO specific,
+ * so there is no order of encapsulation specified in the
+ * RT CORBA Spec. The current implementation expect the field
+ * according to the order of declaration.
+ */
+ CORBA::Boolean _tao_decode (TAO_InputCDR &in_cdr);
+
+protected:
+
+ /// Protected destructor to enforce proper memory management of this
+ /// reference counted object.
+ virtual ~TAO_SharedMemory_Protocol_Properties (void);
+
+private:
+
+ // = Attributes.
+ CORBA::Long send_buffer_size_;
+ CORBA::Long recv_buffer_size_;
+ CORBA::Boolean keep_alive_;
+ CORBA::Boolean dont_route_;
+ CORBA::Boolean no_delay_;
+ CORBA::Long preallocate_buffer_size_;
+ ACE_CString mmap_filename_;
+ ACE_CString mmap_lockname_;
+};
+
+//*************************************************************************
+
+/**
+ * @class TAO_UserDatagram_Protocol_Properties
+ *
+ * @brief RTCORBA::UserDatagramProtocolProperties implementation
+ *
+ * Stores UserDatagram Protocol configuration properties.
+ */
+class TAO_RTCORBA_Export TAO_UserDatagram_Protocol_Properties
+ : public RTCORBA::UserDatagramProtocolProperties,
+ public TAO_Local_RefCounted_Object
+{
+public:
+ /// Constructor.
+ TAO_UserDatagram_Protocol_Properties (CORBA::Boolean enable_network_priority);
+
+ CORBA::Boolean enable_network_priority (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ void enable_network_priority (CORBA::Boolean enable
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// This method writes a CDR representation of UserDatagramProtocolProperties.
+ CORBA::Boolean _tao_encode (TAO_OutputCDR &out_cdr);
+
+ /// This method reads the object state from a CDR representation.
+ CORBA::Boolean _tao_decode (TAO_InputCDR &in_cdr);
+
+protected:
+
+ /// Protected destructor to enforce proper memory management of this
+ /// reference counted object.
+ virtual ~TAO_UserDatagram_Protocol_Properties (void);
+
+private:
+ // = Attributes.
+
+ CORBA::Boolean enable_network_priority_;
+};
+
+//*************************************************************************
+
+/**
+ * @class TAO_StreamControl_Protocol_Properties
+ *
+ * @brief RTCORBA::StreamControlProtocolProperties implementation
+ *
+ * Stores StreamControl Protocol configuration properties.
+ */
+class TAO_RTCORBA_Export TAO_StreamControl_Protocol_Properties
+ : public RTCORBA::StreamControlProtocolProperties,
+ public TAO_Local_RefCounted_Object
+{
+public:
+ /// Constructor.
+ TAO_StreamControl_Protocol_Properties (CORBA::Long send_buffer_size,
+ CORBA::Long recv_buffer_size,
+ CORBA::Boolean keep_alive,
+ CORBA::Boolean dont_route,
+ CORBA::Boolean no_delay,
+ CORBA::Boolean enable_network_priority);
+
+ CORBA::Long send_buffer_size (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ void send_buffer_size (CORBA::Long send_buffer_size
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ CORBA::Long recv_buffer_size (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ void recv_buffer_size (CORBA::Long recv_buffer_size
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ CORBA::Boolean keep_alive (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ void keep_alive (CORBA::Boolean keep_alive
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ CORBA::Boolean dont_route (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ void dont_route (CORBA::Boolean dont_route
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ CORBA::Boolean no_delay (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ void no_delay (CORBA::Boolean no_delay
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ CORBA::Boolean enable_network_priority (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ void enable_network_priority (CORBA::Boolean enable
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// This method writes a CDR representation of StreamControlProtocolProperties.
+ CORBA::Boolean _tao_encode (TAO_OutputCDR &out_cdr);
+
+ /// This method reads the object state from a CDR representation.
+ CORBA::Boolean _tao_decode (TAO_InputCDR &in_cdr);
+
+protected:
+
+ /// Protected destructor to enforce proper memory management of this
+ /// reference counted object.
+ virtual ~TAO_StreamControl_Protocol_Properties (void);
+
+private:
+ // = Attributes.
+
+ CORBA::Long send_buffer_size_;
+ CORBA::Long recv_buffer_size_;
+ CORBA::Boolean keep_alive_;
+ CORBA::Boolean dont_route_;
+ CORBA::Boolean no_delay_;
+ CORBA::Boolean enable_network_priority_;
+};
+
+//*************************************************************************
+
+class TAO_RTCORBA_Export TAO_GIOP_Protocol_Properties
+ : public RTCORBA::GIOPProtocolProperties,
+ public TAO_Local_RefCounted_Object
+{
+public:
+
+ // = CDR encoding methods
+ CORBA::Boolean _tao_encode (TAO_OutputCDR &out_cdr);
+ CORBA::Boolean _tao_decode (TAO_InputCDR &in_cdr);
+
+protected:
+
+ /// Protected destructor to enforce proper memory management of this
+ /// reference counted object.
+ virtual ~TAO_GIOP_Protocol_Properties ();
+
+ friend class TAO_Protocol_Properties_Factory;
+ TAO_GIOP_Protocol_Properties (void);
+};
+
+//*************************************************************************
+
+class TAO_RTCORBA_Export TAO_Protocol_Properties_Factory
+{
+public:
+
+ /**
+ * Creates the proper transport ProtocolProperties subclass that matches
+ * the IOP::ProfileId.
+ * NOTE: Each IOP::ProfileId corresponds to two sets of protocol
+ * properties: one describes the transport protocol and the other
+ * describes the ORB messaging protocol.
+ */
+ static RTCORBA::ProtocolProperties *create_transport_protocol_property (
+ IOP::ProfileId id,
+ TAO_ORB_Core *orb_core);
+
+ /**
+ * Creates the proper orb ProtocolProperties subclass for
+ * IOP::ProfileId.
+ * NOTE: Each IOP::ProfileId corresponds to two sets of protocol
+ * properties: one describes the transport protocol and the other
+ * describes the ORB messaging protocol.
+ */
+ static RTCORBA::ProtocolProperties *create_orb_protocol_property (IOP::ProfileId id);
+
+private:
+
+ TAO_Protocol_Properties_Factory (void);
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_RT_POLICY_I_H */
diff --git a/TAO/tao/RTCORBA/RT_Protocols_Hooks.cpp b/TAO/tao/RTCORBA/RT_Protocols_Hooks.cpp
new file mode 100644
index 00000000000..ec2c6cfbfeb
--- /dev/null
+++ b/TAO/tao/RTCORBA/RT_Protocols_Hooks.cpp
@@ -0,0 +1,829 @@
+#include "tao/RTCORBA/RT_Protocols_Hooks.h"
+
+#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
+
+#include "tao/RTCORBA/RT_Policy_i.h"
+#include "tao/RTCORBA/Priority_Mapping_Manager.h"
+#include "tao/RTCORBA/RT_Stub.h"
+
+#include "tao/Stub.h"
+#include "tao/ORB_Core.h"
+#include "tao/MProfile.h"
+#include "tao/Service_Context.h"
+#include "tao/Acceptor_Registry.h"
+#include "tao/Thread_Lane_Resources.h"
+#include "tao/Protocol_Factory.h"
+#include "tao/Transport_Acceptor.h"
+#include "tao/Transport_Connector.h"
+#include "tao/Policy_Set.h"
+#include "tao/debug.h"
+#include "tao/CDR.h"
+
+#include "ace/Dynamic_Service.h"
+#include "ace/OS_NS_string.h"
+
+ACE_RCSID (RTCORBA,
+ RT_Protocols_Hooks,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_RT_Protocols_Hooks::TAO_RT_Protocols_Hooks (void)
+ : orb_core_ (0)
+ , current_ ()
+{
+}
+
+
+TAO_RT_Protocols_Hooks::~TAO_RT_Protocols_Hooks (void)
+{
+}
+
+void
+TAO_RT_Protocols_Hooks::init_hooks (TAO_ORB_Core *orb_core
+ ACE_ENV_ARG_DECL)
+{
+ this->orb_core_ = orb_core;
+
+ // Save a reference to the priority mapping manager.
+ CORBA::Object_var obj =
+ orb_core->object_ref_table ().resolve_initial_reference (
+ TAO_OBJID_PRIORITYMAPPINGMANAGER);
+
+ this->mapping_manager_ =
+ TAO_Priority_Mapping_Manager::_narrow (obj.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Save a reference to the priority mapping manager.
+ CORBA::Object_var object =
+ orb_core->object_ref_table ().resolve_initial_reference (
+ TAO_OBJID_NETWORKPRIORITYMAPPINGMANAGER);
+
+ this->network_mapping_manager_ =
+ TAO_Network_Priority_Mapping_Manager::_narrow (object.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ object =
+ this->orb_core_->object_ref_table ().resolve_initial_reference (
+ TAO_OBJID_RTCURRENT);
+
+ this->current_ =
+ RTCORBA::Current::_narrow (object.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+}
+
+RTCORBA::ProtocolProperties_ptr
+TAO_RT_Protocols_Hooks::server_protocol_properties (IOP::ProfileId protocol_tag,
+ CORBA::Policy_ptr policy
+ ACE_ENV_ARG_DECL)
+{
+ if (CORBA::is_nil (policy))
+ return 0;
+
+ RTCORBA::ServerProtocolPolicy_var server_protocol_policy =
+ RTCORBA::ServerProtocolPolicy::_narrow (policy
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ if (CORBA::is_nil (server_protocol_policy.in ()))
+ return 0;
+
+ TAO_ServerProtocolPolicy *server_protocols =
+ dynamic_cast<TAO_ServerProtocolPolicy *> (server_protocol_policy.in ());
+
+ if (server_protocols == 0)
+ return 0;
+
+ // TAO_ServerProtocolPolicy
+ RTCORBA::ProtocolList &protocols =
+ server_protocols->protocols_rep ();
+
+ for (CORBA::ULong j = 0; j < protocols.length (); ++j)
+ {
+ if (protocols[j].protocol_type == protocol_tag)
+ {
+ return RTCORBA::ProtocolProperties::_duplicate (protocols[j].transport_protocol_properties.in ());
+ }
+ }
+
+ return 0;
+}
+
+RTCORBA::ProtocolProperties_ptr
+TAO_RT_Protocols_Hooks::client_protocol_properties (IOP::ProfileId protocol_tag,
+ CORBA::Policy_ptr policy
+ ACE_ENV_ARG_DECL)
+{
+ if (CORBA::is_nil (policy))
+ return 0;
+
+ RTCORBA::ClientProtocolPolicy_var client_protocol_policy =
+ RTCORBA::ClientProtocolPolicy::_narrow (policy
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ if (CORBA::is_nil (client_protocol_policy.in ()))
+ return 0;
+
+ TAO_ClientProtocolPolicy *client_protocols =
+ dynamic_cast<TAO_ClientProtocolPolicy *> (client_protocol_policy.in ());
+
+ if (client_protocols == 0)
+ return 0;
+
+ // TAO_ClientProtocolPolicy
+ RTCORBA::ProtocolList &protocols =
+ client_protocols->protocols_rep ();
+
+ for (CORBA::ULong j = 0; j < protocols.length (); ++j)
+ {
+ if (protocols[j].protocol_type == protocol_tag)
+ {
+ return RTCORBA::ProtocolProperties::_duplicate (protocols[j].transport_protocol_properties.in ());
+ }
+ }
+
+ return 0;
+}
+
+RTCORBA::ProtocolProperties_ptr
+TAO_RT_Protocols_Hooks::server_protocol_properties_at_orb_level (IOP::ProfileId protocol_tag
+ ACE_ENV_ARG_DECL)
+{
+ CORBA::Policy_var policy =
+ this->orb_core_->get_cached_policy (TAO_CACHED_POLICY_RT_SERVER_PROTOCOL
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ return this->server_protocol_properties (protocol_tag,
+ policy.in ()
+ ACE_ENV_ARG_PARAMETER);
+}
+
+RTCORBA::ProtocolProperties_ptr
+TAO_RT_Protocols_Hooks::client_protocol_properties_at_orb_level (IOP::ProfileId protocol_tag
+ ACE_ENV_ARG_DECL)
+{
+ CORBA::Policy_var policy =
+ this->orb_core_->get_cached_policy (TAO_CACHED_POLICY_RT_CLIENT_PROTOCOL
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ return this->client_protocol_properties (protocol_tag,
+ policy.in ()
+ ACE_ENV_ARG_PARAMETER);
+}
+
+RTCORBA::ProtocolProperties_ptr
+TAO_RT_Protocols_Hooks::client_protocol_properties_at_object_level (IOP::ProfileId protocol_tag,
+ TAO_Stub *stub
+ ACE_ENV_ARG_DECL)
+{
+ CORBA::Policy_var policy =
+ stub->get_cached_policy (TAO_CACHED_POLICY_RT_CLIENT_PROTOCOL
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ return this->client_protocol_properties (protocol_tag,
+ policy.in ()
+ ACE_ENV_ARG_PARAMETER);
+}
+
+void
+TAO_RT_Protocols_Hooks::extract_protocol_properties (TAO_IIOP_Protocol_Properties &to,
+ RTCORBA::ProtocolProperties_ptr from
+ ACE_ENV_ARG_DECL)
+{
+ RTCORBA::TCPProtocolProperties_var protocol_properties =
+ RTCORBA::TCPProtocolProperties::_narrow (from
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ to.send_buffer_size_ = protocol_properties->send_buffer_size ();
+ to.recv_buffer_size_ = protocol_properties->recv_buffer_size ();
+ to.keep_alive_ = protocol_properties->keep_alive ();
+ to.dont_route_ = protocol_properties->dont_route ();
+ to.no_delay_ = protocol_properties->no_delay ();
+ to.enable_network_priority_ = protocol_properties->enable_network_priority ();
+}
+
+void
+TAO_RT_Protocols_Hooks::server_protocol_properties_at_orb_level (TAO_IIOP_Protocol_Properties &to
+ ACE_ENV_ARG_DECL)
+{
+ RTCORBA::ProtocolProperties_var from =
+ this->server_protocol_properties_at_orb_level (IOP::TAG_INTERNET_IOP
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (!CORBA::is_nil (from.in ()))
+ this->extract_protocol_properties (to,
+ from.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+void
+TAO_RT_Protocols_Hooks::client_protocol_properties_at_orb_level (TAO_IIOP_Protocol_Properties &to
+ ACE_ENV_ARG_DECL)
+{
+ RTCORBA::ProtocolProperties_var from =
+ this->client_protocol_properties_at_orb_level (IOP::TAG_INTERNET_IOP
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (!CORBA::is_nil (from.in ()))
+ this->extract_protocol_properties (to,
+ from.in ()
+ ACE_ENV_ARG_PARAMETER);
+}
+
+void
+TAO_RT_Protocols_Hooks::extract_protocol_properties (TAO_UIOP_Protocol_Properties &to,
+ RTCORBA::ProtocolProperties_ptr from
+ ACE_ENV_ARG_DECL)
+{
+ RTCORBA::UnixDomainProtocolProperties_var protocol_properties =
+ RTCORBA::UnixDomainProtocolProperties::_narrow (from
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ to.send_buffer_size_ = protocol_properties->send_buffer_size ();
+ to.recv_buffer_size_ = protocol_properties->recv_buffer_size ();
+}
+
+void
+TAO_RT_Protocols_Hooks::server_protocol_properties_at_orb_level (TAO_UIOP_Protocol_Properties &to
+ ACE_ENV_ARG_DECL)
+{
+ RTCORBA::ProtocolProperties_var from =
+ this->server_protocol_properties_at_orb_level (TAO_TAG_UIOP_PROFILE
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (!CORBA::is_nil (from.in ()))
+ this->extract_protocol_properties (to,
+ from.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+void
+TAO_RT_Protocols_Hooks::client_protocol_properties_at_orb_level (TAO_UIOP_Protocol_Properties &to
+ ACE_ENV_ARG_DECL)
+{
+ RTCORBA::ProtocolProperties_var from =
+ this->client_protocol_properties_at_orb_level (TAO_TAG_UIOP_PROFILE
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (!CORBA::is_nil (from.in ()))
+ this->extract_protocol_properties (to,
+ from.in ()
+ ACE_ENV_ARG_PARAMETER);
+}
+
+void
+TAO_RT_Protocols_Hooks::extract_protocol_properties (TAO_SHMIOP_Protocol_Properties &to,
+ RTCORBA::ProtocolProperties_ptr from
+ ACE_ENV_ARG_DECL)
+{
+ RTCORBA::SharedMemoryProtocolProperties_var protocol_properties =
+ RTCORBA::SharedMemoryProtocolProperties::_narrow (from
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ to.preallocate_buffer_size_ = protocol_properties->preallocate_buffer_size ();
+ to.mmap_filename_ = protocol_properties->mmap_filename ();
+ to.mmap_lockname_ = protocol_properties->mmap_lockname ();
+}
+
+void
+TAO_RT_Protocols_Hooks::server_protocol_properties_at_orb_level (TAO_SHMIOP_Protocol_Properties &to
+ ACE_ENV_ARG_DECL)
+{
+ RTCORBA::ProtocolProperties_var from =
+ this->server_protocol_properties_at_orb_level (TAO_TAG_SHMEM_PROFILE
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (!CORBA::is_nil (from.in ()))
+ this->extract_protocol_properties (to,
+ from.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+void
+TAO_RT_Protocols_Hooks::client_protocol_properties_at_orb_level (TAO_SHMIOP_Protocol_Properties &to
+ ACE_ENV_ARG_DECL)
+{
+ RTCORBA::ProtocolProperties_var from =
+ this->client_protocol_properties_at_orb_level (TAO_TAG_SHMEM_PROFILE
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (!CORBA::is_nil (from.in ()))
+ this->extract_protocol_properties (to,
+ from.in ()
+ ACE_ENV_ARG_PARAMETER);
+}
+
+void
+TAO_RT_Protocols_Hooks::extract_protocol_properties (TAO_DIOP_Protocol_Properties &to,
+ RTCORBA::ProtocolProperties_ptr from
+ ACE_ENV_ARG_DECL)
+{
+ RTCORBA::UserDatagramProtocolProperties_var protocol_properties =
+ RTCORBA::UserDatagramProtocolProperties::_narrow (from
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ to.enable_network_priority_ = protocol_properties->enable_network_priority ();
+}
+
+void
+TAO_RT_Protocols_Hooks::server_protocol_properties_at_orb_level (TAO_DIOP_Protocol_Properties &to
+ ACE_ENV_ARG_DECL)
+{
+ RTCORBA::ProtocolProperties_var from =
+ this->server_protocol_properties_at_orb_level (TAO_TAG_DIOP_PROFILE
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (!CORBA::is_nil (from.in ()))
+ this->extract_protocol_properties (to,
+ from.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+void
+TAO_RT_Protocols_Hooks::client_protocol_properties_at_orb_level (TAO_DIOP_Protocol_Properties &to
+ ACE_ENV_ARG_DECL)
+{
+ RTCORBA::ProtocolProperties_var from =
+ this->client_protocol_properties_at_orb_level (TAO_TAG_DIOP_PROFILE
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (!CORBA::is_nil (from.in ()))
+ this->extract_protocol_properties (to,
+ from.in ()
+ ACE_ENV_ARG_PARAMETER);
+}
+
+void
+TAO_RT_Protocols_Hooks::extract_protocol_properties (TAO_SCIOP_Protocol_Properties &to,
+ RTCORBA::ProtocolProperties_ptr from
+ ACE_ENV_ARG_DECL)
+{
+ RTCORBA::StreamControlProtocolProperties_var protocol_properties =
+ RTCORBA::StreamControlProtocolProperties::_narrow (from
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ to.send_buffer_size_ = protocol_properties->send_buffer_size ();
+ to.recv_buffer_size_ = protocol_properties->recv_buffer_size ();
+ to.keep_alive_ = protocol_properties->keep_alive ();
+ to.dont_route_ = protocol_properties->dont_route ();
+ to.no_delay_ = protocol_properties->no_delay ();
+ to.enable_network_priority_ = protocol_properties->enable_network_priority ();
+}
+
+void
+TAO_RT_Protocols_Hooks::server_protocol_properties_at_orb_level (TAO_SCIOP_Protocol_Properties &to
+ ACE_ENV_ARG_DECL)
+{
+ RTCORBA::ProtocolProperties_var from =
+ this->server_protocol_properties_at_orb_level (TAO_TAG_SCIOP_PROFILE
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (!CORBA::is_nil (from.in ()))
+ this->extract_protocol_properties (to,
+ from.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+void
+TAO_RT_Protocols_Hooks::client_protocol_properties_at_orb_level (TAO_SCIOP_Protocol_Properties &to
+ ACE_ENV_ARG_DECL)
+{
+ RTCORBA::ProtocolProperties_var from =
+ this->client_protocol_properties_at_orb_level (TAO_TAG_SCIOP_PROFILE
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (!CORBA::is_nil (from.in ()))
+ this->extract_protocol_properties (to,
+ from.in ()
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::Boolean
+TAO_RT_Protocols_Hooks::set_network_priority (IOP::ProfileId protocol_tag,
+ RTCORBA::ProtocolProperties_ptr protocol_properties
+ ACE_ENV_ARG_DECL)
+{
+ if (CORBA::is_nil (protocol_properties))
+ return false;
+
+ if (protocol_tag == IOP::TAG_INTERNET_IOP)
+ {
+ RTCORBA::TCPProtocolProperties_var tcp_protocol_properties =
+ RTCORBA::TCPProtocolProperties::_narrow (protocol_properties
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ return tcp_protocol_properties->enable_network_priority ();
+ }
+
+ if (protocol_tag == TAO_TAG_DIOP_PROFILE)
+ {
+ RTCORBA::UserDatagramProtocolProperties_var udp_protocol_properties =
+ RTCORBA::UserDatagramProtocolProperties::_narrow (protocol_properties
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ return udp_protocol_properties->enable_network_priority ();
+ }
+
+ if (protocol_tag == TAO_TAG_SCIOP_PROFILE)
+ {
+ RTCORBA::StreamControlProtocolProperties_var sctp_protocol_properties =
+ RTCORBA::StreamControlProtocolProperties::_narrow (protocol_properties
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ return sctp_protocol_properties->enable_network_priority ();
+ }
+
+ return false;
+}
+
+CORBA::Boolean
+TAO_RT_Protocols_Hooks::set_client_network_priority (IOP::ProfileId protocol_tag,
+ TAO_Stub *stub
+ ACE_ENV_ARG_DECL)
+{
+ if (protocol_tag != IOP::TAG_INTERNET_IOP &&
+ protocol_tag != TAO_TAG_DIOP_PROFILE &&
+ protocol_tag != TAO_TAG_SCIOP_PROFILE)
+ return false;
+
+ RTCORBA::ProtocolProperties_var protocol_properties =
+ this->client_protocol_properties_at_object_level (protocol_tag,
+ stub
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ return this->set_network_priority (protocol_tag,
+ protocol_properties.in ()
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::Boolean
+TAO_RT_Protocols_Hooks::set_server_network_priority (IOP::ProfileId protocol_tag,
+ CORBA::Policy *policy
+ ACE_ENV_ARG_DECL)
+{
+ if (protocol_tag != IOP::TAG_INTERNET_IOP &&
+ protocol_tag != TAO_TAG_DIOP_PROFILE &&
+ protocol_tag != TAO_TAG_SCIOP_PROFILE)
+ return false;
+
+ RTCORBA::ProtocolProperties_var protocol_properties =
+ this->server_protocol_properties (protocol_tag,
+ policy
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ return this->set_network_priority (protocol_tag,
+ protocol_properties.in ()
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::Long
+TAO_RT_Protocols_Hooks::get_dscp_codepoint (void)
+{
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO_RT_Protocols_Hooks::get_dscp_codepoint\n"));
+
+ CORBA::Long codepoint = 0;
+
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ // Make several invocation, changing the priority of this thread
+ // for each.
+
+ RTCORBA::NetworkPriorityMapping *pm =
+ this->network_mapping_manager_->mapping ();
+
+ const CORBA::Short priority =
+ this->current_->the_priority (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (pm->to_network (priority, codepoint) == 0)
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "Cannot convert corba priority %d "
+ "to network priority\n",
+ priority));
+ }
+
+ return -1;
+ }
+ }
+ ACE_CATCHANY
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "TAO_RT_Protocols_Hooks::get_dscp_codepoint");
+ }
+
+ return -1;
+ }
+ ACE_ENDTRY;
+ ACE_CHECK_RETURN (-1);
+
+ return codepoint;
+}
+
+void
+TAO_RT_Protocols_Hooks::rt_service_context (
+ TAO_Stub *stub,
+ TAO_Service_Context &service_context,
+ CORBA::Boolean restart
+ ACE_ENV_ARG_DECL
+ )
+{
+ // If the restart flag is true, then this call for a
+ // reinvocation. We need not prepare the Service Context List once
+ // again. We can use the already existing one.
+ if (!restart)
+ {
+ TAO_RT_Stub *rt_stub =
+ dynamic_cast<TAO_RT_Stub *> (stub);
+
+ CORBA::Policy_var priority_model_policy =
+ rt_stub->get_cached_policy (TAO_CACHED_POLICY_PRIORITY_MODEL
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (!CORBA::is_nil (priority_model_policy.in ()))
+ {
+ CORBA::Short client_priority;
+
+ int status =
+ this->get_thread_CORBA_priority (client_priority
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (status == -1)
+ ACE_THROW (CORBA::DATA_CONVERSION (1, CORBA::COMPLETED_NO));
+
+ this->add_rt_service_context_hook (service_context,
+ priority_model_policy.in (),
+ client_priority
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else
+ {
+ // The Object does not contain PriorityModel policy in its IOR.
+ // We must be talking to a non-RT ORB. Do nothing.
+ }
+ }
+}
+
+void
+TAO_RT_Protocols_Hooks::add_rt_service_context_hook (
+ TAO_Service_Context &service_context,
+ CORBA::Policy *model_policy,
+ CORBA::Short &client_priority
+ ACE_ENV_ARG_DECL
+ )
+{
+
+ RTCORBA::PriorityModelPolicy_var model_policy_ptr =
+ RTCORBA::PriorityModelPolicy::_narrow (model_policy
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ TAO_PriorityModelPolicy *priority_model =
+ static_cast<TAO_PriorityModelPolicy *> (model_policy_ptr.in ());
+
+ if (priority_model->get_priority_model () == RTCORBA::CLIENT_PROPAGATED)
+ {
+ // Encapsulate the priority of the current thread into
+ // a service context.
+ TAO_OutputCDR cdr;
+ if ((cdr << ACE_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER) == 0)
+ || (cdr << client_priority) == 0)
+ {
+ ACE_THROW (CORBA::MARSHAL ());
+ }
+
+ service_context.set_context (IOP::RTCorbaPriority, cdr);
+ }
+}
+
+void
+TAO_RT_Protocols_Hooks::get_selector_hook (
+ CORBA::Policy *model_policy,
+ CORBA::Boolean &is_client_propagated,
+ CORBA::Short &server_priority
+ )
+{
+
+ RTCORBA::PriorityModelPolicy_var model_policy_ptr =
+ RTCORBA::PriorityModelPolicy::_narrow (model_policy);
+
+ TAO_PriorityModelPolicy *priority_model_policy =
+ static_cast<TAO_PriorityModelPolicy *> (model_policy_ptr.in ());
+
+ if (priority_model_policy->get_priority_model ()
+ == RTCORBA::CLIENT_PROPAGATED)
+ {
+ is_client_propagated = 1;
+ }
+
+ if (!is_client_propagated)
+ {
+ server_priority = priority_model_policy->server_priority ();
+ }
+
+ return;
+}
+
+void
+TAO_RT_Protocols_Hooks::get_selector_bands_policy_hook (
+ CORBA::Policy *bands_policy,
+ CORBA::Short priority,
+ CORBA::Short &min_priority,
+ CORBA::Short &max_priority,
+ int &in_range
+ )
+{
+ RTCORBA::PriorityBandedConnectionPolicy_var bands_policy_ptr =
+ RTCORBA::PriorityBandedConnectionPolicy::_narrow (bands_policy);
+
+ TAO_PriorityBandedConnectionPolicy *priority_bands_policy =
+ static_cast<TAO_PriorityBandedConnectionPolicy *> (bands_policy_ptr.in ());
+
+ // Find the band with the range covering our target priority.
+ RTCORBA::PriorityBands &bands =
+ priority_bands_policy->priority_bands_rep ();
+
+ for (CORBA::ULong i = 0; i < bands.length (); ++i)
+ {
+ if (bands[i].low <= priority && bands[i].high >= priority)
+ {
+ min_priority = bands[i].low;
+ max_priority = bands[i].high;
+
+ in_range = 1;
+ break;
+ }
+ }
+}
+
+int
+TAO_RT_Protocols_Hooks::get_thread_CORBA_priority (CORBA::Short &priority
+ ACE_ENV_ARG_DECL)
+{
+ CORBA::Short native_priority = 0;
+ int const result =
+ this->get_thread_CORBA_and_native_priority (priority,
+ native_priority
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ if (result == -1)
+ {
+ return result;
+ }
+
+ return 0;
+}
+
+int
+TAO_RT_Protocols_Hooks::get_thread_native_priority (
+ CORBA::Short &native_priority
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ ACE_hthread_t current;
+ ACE_Thread::self (current);
+
+ int priority;
+
+ if (ACE_Thread::getprio (current, priority) == -1)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - ")
+ ACE_TEXT ("RT_Protocols_Hooks::get_thread_priority: ")
+ ACE_TEXT (" ACE_Thread::get_prio\n")));
+
+ return -1;
+ }
+
+ native_priority = CORBA::Short (priority);
+ return 0;
+}
+
+int
+TAO_RT_Protocols_Hooks::get_thread_CORBA_and_native_priority (
+ CORBA::Short &priority,
+ CORBA::Short &native_priority
+ ACE_ENV_ARG_DECL
+ )
+{
+ int result =
+ this->get_thread_native_priority (native_priority
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ if (result == -1)
+ {
+ return result;
+ }
+
+ TAO_Priority_Mapping *priority_mapping =
+ this->mapping_manager_.in ()->mapping ();
+
+ if (priority_mapping->to_CORBA (native_priority, priority) == 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - ")
+ ACE_TEXT ("RT_Protocols_Hooks::get_thread_priority: ")
+ ACE_TEXT ("Priority_Mapping::to_CORBA\n")));
+ return -1;
+ }
+
+ return 0;
+}
+
+int
+TAO_RT_Protocols_Hooks::set_thread_CORBA_priority (CORBA::Short priority
+ ACE_ENV_ARG_DECL)
+{
+ TAO_Priority_Mapping *priority_mapping =
+ this->mapping_manager_.in ()->mapping ();
+
+ CORBA::Short native_priority;
+
+ if (priority_mapping->to_native (priority, native_priority) == 0)
+ {
+ return -1;
+ }
+
+ return this->set_thread_native_priority (native_priority
+ ACE_ENV_ARG_PARAMETER);
+}
+
+int
+TAO_RT_Protocols_Hooks::set_thread_native_priority (
+ CORBA::Short native_priority
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ ACE_hthread_t current;
+ ACE_Thread::self (current);
+
+ if (ACE_Thread::setprio (current, native_priority) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("(%N,%l) Error setting thread ")
+ ACE_TEXT ("priority to %d, errno %d %m\n"),
+ native_priority,
+ errno ),
+ -1);
+ }
+
+ return 0;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DEFINE (TAO_RT_Protocols_Hooks,
+ ACE_TEXT ("RT_Protocols_Hooks"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (TAO_RT_Protocols_Hooks),
+ ACE_Service_Type::DELETE_THIS
+ | ACE_Service_Type::DELETE_OBJ,
+ 0)
+ACE_FACTORY_DEFINE (TAO_RTCORBA, TAO_RT_Protocols_Hooks)
+
+#endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
diff --git a/TAO/tao/RTCORBA/RT_Protocols_Hooks.h b/TAO/tao/RTCORBA/RT_Protocols_Hooks.h
new file mode 100644
index 00000000000..a1542f2e2a8
--- /dev/null
+++ b/TAO/tao/RTCORBA/RT_Protocols_Hooks.h
@@ -0,0 +1,197 @@
+// -*- C++ -*-
+
+// ===================================================================
+/**
+ * @file RT_Protocols_Hooks.h
+ *
+ * $Id$
+ *
+ * @author Priyanka Gontla <pgontla@ece.uci.edu>
+ */
+// ===================================================================
+
+#ifndef TAO_RT_PROTOCOLS_HOOKS_H
+#define TAO_RT_PROTOCOLS_HOOKS_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
+
+#include "tao/RTCORBA/Priority_Mapping_Manager.h"
+#include "tao/RTCORBA/Network_Priority_Mapping_Manager.h"
+
+#include "tao/Protocols_Hooks.h"
+
+#include "ace/Service_Config.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_RTCORBA_Export TAO_RT_Protocols_Hooks : public TAO_Protocols_Hooks
+{
+public:
+
+ /// Constructor
+ TAO_RT_Protocols_Hooks (void);
+
+ /// Destructor
+ virtual ~TAO_RT_Protocols_Hooks (void);
+
+ /// Initialize the protocols hooks instance.
+ void init_hooks (TAO_ORB_Core *orb_core
+ ACE_ENV_ARG_DECL);
+
+ CORBA::Boolean set_client_network_priority (IOP::ProfileId protocol_tag,
+ TAO_Stub *stub
+ ACE_ENV_ARG_DECL);
+
+ CORBA::Boolean set_server_network_priority (IOP::ProfileId protocol_tag,
+ CORBA::Policy *policy
+ ACE_ENV_ARG_DECL);
+
+ void server_protocol_properties_at_orb_level (TAO_IIOP_Protocol_Properties &protocol_properties
+ ACE_ENV_ARG_DECL);
+
+ void client_protocol_properties_at_orb_level (TAO_IIOP_Protocol_Properties &protocol_properties
+ ACE_ENV_ARG_DECL);
+
+ void server_protocol_properties_at_orb_level (TAO_UIOP_Protocol_Properties &protocol_properties
+ ACE_ENV_ARG_DECL);
+
+ void client_protocol_properties_at_orb_level (TAO_UIOP_Protocol_Properties &protocol_properties
+ ACE_ENV_ARG_DECL);
+
+ void server_protocol_properties_at_orb_level (TAO_SHMIOP_Protocol_Properties &protocol_properties
+ ACE_ENV_ARG_DECL);
+
+ void client_protocol_properties_at_orb_level (TAO_SHMIOP_Protocol_Properties &protocol_properties
+ ACE_ENV_ARG_DECL);
+
+ void server_protocol_properties_at_orb_level (TAO_DIOP_Protocol_Properties &protocol_properties
+ ACE_ENV_ARG_DECL);
+
+ void client_protocol_properties_at_orb_level (TAO_DIOP_Protocol_Properties &protocol_properties
+ ACE_ENV_ARG_DECL);
+
+ void server_protocol_properties_at_orb_level (TAO_SCIOP_Protocol_Properties &protocol_properties
+ ACE_ENV_ARG_DECL);
+
+ void client_protocol_properties_at_orb_level (TAO_SCIOP_Protocol_Properties &protocol_properties
+ ACE_ENV_ARG_DECL);
+
+ CORBA::Long get_dscp_codepoint (void);
+
+ void rt_service_context (TAO_Stub *stub,
+ TAO_Service_Context &service_context,
+ CORBA::Boolean restart
+ ACE_ENV_ARG_DECL);
+
+ void add_rt_service_context_hook (TAO_Service_Context &service_context,
+ CORBA::Policy *model_policy,
+ CORBA::Short &client_priority
+ ACE_ENV_ARG_DECL);
+
+ void get_selector_hook (CORBA::Policy *model_policy,
+ CORBA::Boolean
+ &is_client_propagated,
+ CORBA::Short &server_priority);
+
+ void get_selector_bands_policy_hook (CORBA::Policy *bands_policy,
+ CORBA::Short priority,
+ CORBA::Short &min_priority,
+ CORBA::Short &max_priority,
+ int &in_range);
+
+ /**
+ * Accessor and modifier to the current thread priority, used to
+ * implement the RTCORBA::Current interface, but it is faster for
+ * some critical components.
+ */
+ //@{
+ int get_thread_CORBA_priority (CORBA::Short &
+ ACE_ENV_ARG_DECL);
+
+ int get_thread_native_priority (CORBA::Short &
+ ACE_ENV_ARG_DECL);
+
+ int get_thread_CORBA_and_native_priority (CORBA::Short &,
+ CORBA::Short &
+ ACE_ENV_ARG_DECL);
+
+ int set_thread_CORBA_priority (CORBA::Short
+ ACE_ENV_ARG_DECL);
+
+ int set_thread_native_priority (CORBA::Short
+ ACE_ENV_ARG_DECL);
+
+ //@}
+
+protected:
+
+ RTCORBA::ProtocolProperties_ptr server_protocol_properties (IOP::ProfileId protocol_tag,
+ CORBA::Policy_ptr policy
+ ACE_ENV_ARG_DECL);
+
+ RTCORBA::ProtocolProperties_ptr client_protocol_properties (IOP::ProfileId protocol_tag,
+ CORBA::Policy_ptr policy
+ ACE_ENV_ARG_DECL);
+
+ RTCORBA::ProtocolProperties_ptr server_protocol_properties_at_orb_level (IOP::ProfileId protocol_tag
+ ACE_ENV_ARG_DECL);
+
+ RTCORBA::ProtocolProperties_ptr client_protocol_properties_at_orb_level (IOP::ProfileId protocol_tag
+ ACE_ENV_ARG_DECL);
+
+ RTCORBA::ProtocolProperties_ptr client_protocol_properties_at_object_level (IOP::ProfileId protocol_tag,
+ TAO_Stub *stub
+ ACE_ENV_ARG_DECL);
+
+ void extract_protocol_properties (TAO_IIOP_Protocol_Properties &to,
+ RTCORBA::ProtocolProperties_ptr from
+ ACE_ENV_ARG_DECL);
+
+ void extract_protocol_properties (TAO_UIOP_Protocol_Properties &to,
+ RTCORBA::ProtocolProperties_ptr from
+ ACE_ENV_ARG_DECL);
+
+ void extract_protocol_properties (TAO_SHMIOP_Protocol_Properties &to,
+ RTCORBA::ProtocolProperties_ptr from
+ ACE_ENV_ARG_DECL);
+
+ void extract_protocol_properties (TAO_DIOP_Protocol_Properties &to,
+ RTCORBA::ProtocolProperties_ptr from
+ ACE_ENV_ARG_DECL);
+
+ void extract_protocol_properties (TAO_SCIOP_Protocol_Properties &to,
+ RTCORBA::ProtocolProperties_ptr from
+ ACE_ENV_ARG_DECL);
+
+ CORBA::Boolean set_network_priority (IOP::ProfileId protocol_tag,
+ RTCORBA::ProtocolProperties_ptr protocol_properties
+ ACE_ENV_ARG_DECL);
+
+protected:
+
+ TAO_ORB_Core *orb_core_;
+
+ // Save a reference to the priority mapping manager.
+ TAO_Priority_Mapping_Manager_var mapping_manager_;
+ TAO_Network_Priority_Mapping_Manager_var network_mapping_manager_;
+
+ RTCORBA::Current_var current_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE_EXPORT (TAO_RTCORBA, TAO_RT_Protocols_Hooks)
+ACE_FACTORY_DECLARE (TAO_RTCORBA, TAO_RT_Protocols_Hooks)
+
+#endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_RT_PROTOCOLS_HOOKS_H */
diff --git a/TAO/tao/RTCORBA/RT_Stub.cpp b/TAO/tao/RTCORBA/RT_Stub.cpp
new file mode 100644
index 00000000000..a82714e4802
--- /dev/null
+++ b/TAO/tao/RTCORBA/RT_Stub.cpp
@@ -0,0 +1,304 @@
+// $Id$
+
+#include "tao/RTCORBA/RT_Stub.h"
+
+#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
+
+#include "tao/RTCORBA/RT_Policy_i.h"
+#include "tao/ORB_Core.h"
+#include "tao/Policy_Set.h"
+#include "tao/Policy_Manager.h"
+
+
+ACE_RCSID (RTCORBA,
+ RT_Stub,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_RT_Stub::TAO_RT_Stub (const char *repository_id,
+ const TAO_MProfile &profiles,
+ TAO_ORB_Core *orb_core)
+ : TAO_Stub (repository_id,
+ profiles,
+ orb_core),
+ priority_model_policy_ (0),
+ priority_banded_connection_policy_ (0),
+ client_protocol_policy_ (0),
+ are_policies_parsed_ (0)
+{
+}
+
+TAO_RT_Stub::~TAO_RT_Stub (void)
+{
+ if (this->priority_model_policy_.in ())
+ this->priority_model_policy_->destroy ();
+
+ if (this->priority_banded_connection_policy_.in ())
+ this->priority_banded_connection_policy_->destroy ();
+
+ if (this->client_protocol_policy_.in ())
+ this->client_protocol_policy_->destroy ();
+}
+
+void
+TAO_RT_Stub::parse_policies (ACE_ENV_SINGLE_ARG_DECL)
+{
+ CORBA::PolicyList_var policy_list
+ = this->base_profiles_.policy_list (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ CORBA::ULong length = policy_list->length ();
+
+ // Cache away the policies that we'll need later.
+ for (CORBA::ULong i = 0; i < length; ++i)
+ {
+ if (policy_list[i]->policy_type () ==
+ RTCORBA::PRIORITY_MODEL_POLICY_TYPE)
+ this->exposed_priority_model (policy_list[i]);
+
+ else if (policy_list[i]->policy_type () ==
+ RTCORBA::PRIORITY_BANDED_CONNECTION_POLICY_TYPE)
+ this->exposed_priority_banded_connection (policy_list[i]);
+
+ else if (policy_list[i]->policy_type () ==
+ RTCORBA::CLIENT_PROTOCOL_POLICY_TYPE)
+ this->exposed_client_protocol (policy_list[i]);
+ }
+
+ this->are_policies_parsed_ = 1;
+}
+
+CORBA::Policy *
+TAO_RT_Stub::exposed_priority_model (ACE_ENV_SINGLE_ARG_DECL)
+{
+ if (!this->are_policies_parsed_)
+ {
+ this->parse_policies (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+ }
+
+ return CORBA::Policy::_duplicate (this->priority_model_policy_.in ());
+}
+
+void
+TAO_RT_Stub::exposed_priority_model (CORBA::Policy_ptr policy)
+{
+ this->priority_model_policy_ = CORBA::Policy::_duplicate (policy);
+}
+
+CORBA::Policy *
+TAO_RT_Stub::exposed_priority_banded_connection (ACE_ENV_SINGLE_ARG_DECL)
+{
+ if (!this->are_policies_parsed_)
+ {
+ this->parse_policies (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+ }
+
+ return CORBA::Policy::_duplicate (this->priority_banded_connection_policy_.in ());
+}
+
+void
+TAO_RT_Stub::exposed_priority_banded_connection (CORBA::Policy_ptr policy)
+{
+ this->priority_banded_connection_policy_ =
+ CORBA::Policy::_duplicate (policy);
+}
+
+CORBA::Policy *
+TAO_RT_Stub::exposed_client_protocol (ACE_ENV_SINGLE_ARG_DECL)
+{
+ if (!this->are_policies_parsed_)
+ {
+ this->parse_policies (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+ }
+
+ return CORBA::Policy::_duplicate (this->client_protocol_policy_.in ());
+}
+
+void
+TAO_RT_Stub::exposed_client_protocol (CORBA::Policy_ptr policy)
+{
+ this->client_protocol_policy_ = CORBA::Policy::_duplicate (policy);
+}
+
+#if (TAO_HAS_CORBA_MESSAGING == 1)
+
+CORBA::Policy_ptr
+TAO_RT_Stub::get_policy (CORBA::PolicyType type
+ ACE_ENV_ARG_DECL)
+{
+ // If we are dealing with a client exposed policy, check if any
+ // value came in the IOR/reconcile IOR value and overrides.
+ if (type == RTCORBA::PRIORITY_MODEL_POLICY_TYPE)
+ return this->exposed_priority_model (ACE_ENV_SINGLE_ARG_PARAMETER);
+
+ if (type == RTCORBA::PRIORITY_BANDED_CONNECTION_POLICY_TYPE)
+ return this->effective_priority_banded_connection (ACE_ENV_SINGLE_ARG_PARAMETER);
+
+ if (type == RTCORBA::CLIENT_PROTOCOL_POLICY_TYPE)
+ return this->effective_client_protocol (ACE_ENV_SINGLE_ARG_PARAMETER);
+
+ return this->TAO_Stub::get_policy (type ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::Policy_ptr
+TAO_RT_Stub::get_cached_policy (TAO_Cached_Policy_Type type
+ ACE_ENV_ARG_DECL)
+{
+ // If we are dealing with a client exposed policy, check if any
+ // value came in the IOR/reconcile IOR value and overrides.
+ if (type == TAO_CACHED_POLICY_PRIORITY_MODEL)
+ return this->exposed_priority_model (ACE_ENV_SINGLE_ARG_PARAMETER);
+
+ if (type == TAO_CACHED_POLICY_RT_PRIORITY_BANDED_CONNECTION)
+ return this->effective_priority_banded_connection (ACE_ENV_SINGLE_ARG_PARAMETER);
+
+ if (type == TAO_CACHED_POLICY_RT_CLIENT_PROTOCOL)
+ return this->effective_client_protocol (ACE_ENV_SINGLE_ARG_PARAMETER);
+
+ return this->TAO_Stub::get_cached_policy (type ACE_ENV_ARG_PARAMETER);
+}
+
+
+TAO_Stub *
+TAO_RT_Stub::set_policy_overrides (const CORBA::PolicyList & policies,
+ CORBA::SetOverrideType set_add
+ ACE_ENV_ARG_DECL)
+{
+ // Validity check. Make sure requested policies are allowed to be
+ // set at this scope.
+ for (CORBA::ULong i = 0; i < policies.length (); ++i)
+ {
+ CORBA::Policy_ptr policy = policies[i];
+ if (CORBA::is_nil (policy))
+ continue;
+
+ CORBA::PolicyType type = policy->policy_type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ if (type == RTCORBA::PRIORITY_MODEL_POLICY_TYPE ||
+ type == RTCORBA::THREADPOOL_POLICY_TYPE ||
+ type == RTCORBA::SERVER_PROTOCOL_POLICY_TYPE)
+ ACE_THROW_RETURN (CORBA::NO_PERMISSION (), 0);
+
+ }
+
+ // We are not required to check for consistency of <policies> with
+ // overrides at other levels or with policies exported in the IOR.
+ return this->TAO_Stub::set_policy_overrides(policies, set_add ACE_ENV_ARG_PARAMETER);
+}
+
+#endif /* TAO_HAS_CORBA_MESSAGING */
+
+CORBA::Policy *
+TAO_RT_Stub::effective_priority_banded_connection (ACE_ENV_SINGLE_ARG_DECL)
+{
+ // Get effective override.
+ CORBA::Policy_var override =
+ this->TAO_Stub::get_cached_policy (TAO_CACHED_POLICY_RT_PRIORITY_BANDED_CONNECTION
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+
+ // Get the value from the ior.
+ CORBA::Policy_var exposed =
+ this->exposed_priority_banded_connection (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+
+ // Reconcile client-exposed and locally set values.
+ if (CORBA::is_nil (exposed.in ()))
+ return override._retn ();
+
+ if (CORBA::is_nil (override.in ()))
+ return exposed._retn ();
+
+ RTCORBA::PriorityBandedConnectionPolicy_var override_policy_var =
+ RTCORBA::PriorityBandedConnectionPolicy::_narrow (override.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+
+ TAO_PriorityBandedConnectionPolicy *override_policy =
+ static_cast<TAO_PriorityBandedConnectionPolicy *> (override_policy_var.in ());
+
+ RTCORBA::PriorityBandedConnectionPolicy_var exposed_policy_var =
+ RTCORBA::PriorityBandedConnectionPolicy::_narrow (exposed.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+
+ TAO_PriorityBandedConnectionPolicy *exposed_policy =
+ static_cast<TAO_PriorityBandedConnectionPolicy *> (exposed_policy_var.in ());
+
+ // Both override and exposed have been set.
+ // See if either of them has empty priority bands.
+ if (exposed_policy->priority_bands_rep ().length () == 0)
+ return override._retn ();
+
+ if (override_policy->priority_bands_rep ().length () == 0)
+ return exposed._retn ();
+
+ // Both override and exposed have been set and neither has empty
+ // priority bands. This is illegal (ptc/99-05-03, sec. 4.12.1).
+ ACE_THROW_RETURN (CORBA::INV_POLICY (),
+ 0);
+}
+
+CORBA::Policy *
+TAO_RT_Stub::effective_client_protocol (ACE_ENV_SINGLE_ARG_DECL)
+{
+ // Get effective override.
+ CORBA::Policy_var override =
+ this->TAO_Stub::get_cached_policy (TAO_CACHED_POLICY_RT_CLIENT_PROTOCOL
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+
+ // Get the value from the ior.
+ CORBA::Policy_var exposed =
+ this->exposed_client_protocol (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+
+ // Reconcile client-exposed and locally set values.
+ if (CORBA::is_nil (exposed.in ()))
+ return override._retn ();
+
+ if (CORBA::is_nil (override.in ()))
+ return exposed._retn ();
+
+ RTCORBA::ClientProtocolPolicy_var override_policy_var =
+ RTCORBA::ClientProtocolPolicy::_narrow (override.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+
+ TAO_ClientProtocolPolicy *override_policy =
+ static_cast<TAO_ClientProtocolPolicy *> (override_policy_var.in ());
+
+ RTCORBA::ClientProtocolPolicy_var exposed_policy_var =
+ RTCORBA::ClientProtocolPolicy::_narrow (exposed.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+
+ TAO_ClientProtocolPolicy *exposed_policy =
+ static_cast<TAO_ClientProtocolPolicy *> (exposed_policy_var.in ());
+
+ // Both override and exposed have been set.
+ // See if either of them has empty priority bands.
+ RTCORBA::ProtocolList &protocols_rep_var =
+ exposed_policy->protocols_rep ();
+
+ if (protocols_rep_var.length () == 0)
+ return override._retn ();
+
+ if (override_policy->protocols_rep ().length () == 0)
+ return exposed._retn ();
+
+ // Both override and exposed have been set and neither has empty
+ // protocols. This is illegal (ptc/99-05-03, sec. 4.15.4).
+ ACE_THROW_RETURN (CORBA::INV_POLICY (),
+ 0);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
diff --git a/TAO/tao/RTCORBA/RT_Stub.h b/TAO/tao/RTCORBA/RT_Stub.h
new file mode 100644
index 00000000000..fcaf8a32562
--- /dev/null
+++ b/TAO/tao/RTCORBA/RT_Stub.h
@@ -0,0 +1,140 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file RT_Stub.h
+ *
+ * $Id$
+ *
+ * This file contains the declaration for the RTCORBA Stub.
+ *
+ *
+ * @author Angelo Corsaro <corsaro@cs.wustl.edu>
+ * @author Frank Hunleth <fhunleth@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_RT_STUB_H_
+#define TAO_RT_STUB_H_
+
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
+
+#include "tao/RTCORBA/rtcorba_export.h"
+
+#include "tao/Stub.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Forward references.
+class TAO_PriorityModelPolicy;
+class TAO_PriorityBandedConnectionPolicy;
+class TAO_ClientProtocolPolicy;
+class TAO_PrivateConnectionPolicy;
+
+/**
+ * @class TAO_RT_Stub
+ *
+ * This class represent a stub with extended functionality, which are needed
+ * for RTCORBA.
+ */
+class TAO_RTCORBA_Export TAO_RT_Stub : public TAO_Stub
+{
+public:
+
+ TAO_RT_Stub (const char *repository_id,
+ const TAO_MProfile &profiles,
+ TAO_ORB_Core *orb_core);
+
+ virtual ~TAO_RT_Stub (void);
+
+
+#if (TAO_HAS_CORBA_MESSAGING == 1)
+
+ /**
+ * Returns the effective policy if <type> is a known client-exposed
+ * policy type. Returns the effective override for all other policy
+ * types.
+ */
+ CORBA::Policy_ptr get_policy (CORBA::PolicyType type
+ ACE_ENV_ARG_DECL);
+
+ CORBA::Policy_ptr get_cached_policy (TAO_Cached_Policy_Type type
+ ACE_ENV_ARG_DECL);
+
+ TAO_Stub* set_policy_overrides (const CORBA::PolicyList & policies,
+ CORBA::SetOverrideType set_add
+ ACE_ENV_ARG_DECL);
+
+#endif /* TAO_HAS_CORBA_MESSAGING */
+
+private:
+
+ /// Helper method used to parse the policies.
+ void parse_policies (ACE_ENV_SINGLE_ARG_DECL);
+
+ void exposed_priority_model (CORBA::Policy_ptr policy);
+
+ void exposed_priority_banded_connection (CORBA::Policy_ptr policy);
+
+ void exposed_client_protocol (CORBA::Policy_ptr policy);
+
+ /// Returns the CORBA::Policy (which will be narrowed to be
+ /// used as RTCORBA::PriorityModelPolicy) exported
+ /// in object's IOR.
+ CORBA::Policy_ptr exposed_priority_model (ACE_ENV_SINGLE_ARG_DECL);
+
+ /// Returns the CORBA::Policy (which will be narrowed and used
+ /// as RTCORBA::PriorityBandedConnectionPolicy) exported
+ /// in object's IOR.
+ CORBA::Policy_ptr exposed_priority_banded_connection (ACE_ENV_SINGLE_ARG_DECL);
+
+ /// Returns the CORBA::Policy (which will be narrowed and used
+ /// as RTCORBA::ClientProtocolPolicy) exported
+ /// in object's IOR.
+ CORBA::Policy_ptr exposed_client_protocol (ACE_ENV_SINGLE_ARG_DECL);
+
+ // = Methods for obtaining effective policies.
+ //
+ // Effective policy is the one that would be used if a request
+ // were made. The policy is determined by obtaining the effective
+ // override for a given policy type, and then reconciling it with
+ // the policy value exported in the Object's IOR.
+
+ CORBA::Policy *effective_priority_banded_connection (ACE_ENV_SINGLE_ARG_DECL);
+ CORBA::Policy *effective_client_protocol (ACE_ENV_SINGLE_ARG_DECL);
+
+ // The following attribute are used to cache
+ // the different kind of policies and avoid to
+ // parse the MProfile's policy list each time we
+ // are asked about a given policy.
+
+ CORBA::Policy_var priority_model_policy_;
+
+ CORBA::Policy_var priority_banded_connection_policy_;
+
+ CORBA::Policy_var client_protocol_policy_;
+
+ CORBA::Boolean are_policies_parsed_;
+
+private:
+ // = Disallow copying and assignment.
+ TAO_RT_Stub (const TAO_RT_Stub &);
+ TAO_RT_Stub &operator = (const TAO_RT_Stub &);
+
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_RT_STUB_FACTORY_H_ */
diff --git a/TAO/tao/RTCORBA/RT_Stub_Factory.cpp b/TAO/tao/RTCORBA/RT_Stub_Factory.cpp
new file mode 100644
index 00000000000..84f376955cd
--- /dev/null
+++ b/TAO/tao/RTCORBA/RT_Stub_Factory.cpp
@@ -0,0 +1,57 @@
+// $Id$
+#include "tao/RTCORBA/RT_Stub_Factory.h"
+
+#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
+
+#include "tao/RTCORBA/RT_Stub.h"
+
+#include "tao/ORB_Constants.h"
+#include "tao/SystemException.h"
+
+#include "ace/Log_Msg.h"
+
+
+ACE_RCSID (RTCORBA,
+ RT_TAO_Stub_Factory,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_RT_Stub_Factory::~TAO_RT_Stub_Factory (void)
+{
+}
+
+TAO_Stub *
+TAO_RT_Stub_Factory::create_stub (const char *repository_id,
+ const TAO_MProfile &profiles,
+ TAO_ORB_Core *orb_core
+ ACE_ENV_ARG_DECL)
+{
+ // @@ TODO: As soon as the RT_STUB is done change this to
+ // create an RT_STUB
+ TAO_Stub *retval = 0;
+
+ ACE_NEW_THROW_EX (retval,
+ TAO_RT_Stub (repository_id, profiles, orb_core),
+ CORBA::NO_MEMORY (TAO::VMCID,
+ CORBA::COMPLETED_MAYBE));
+
+ ACE_CHECK_RETURN (retval);
+
+ return retval;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+// ****************************************************************
+
+ACE_STATIC_SVC_DEFINE (TAO_RT_Stub_Factory,
+ ACE_TEXT ("RT_Stub_Factory"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (TAO_RT_Stub_Factory),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0)
+ACE_FACTORY_DEFINE (TAO_RTCORBA, TAO_RT_Stub_Factory)
+
+#endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
diff --git a/TAO/tao/RTCORBA/RT_Stub_Factory.h b/TAO/tao/RTCORBA/RT_Stub_Factory.h
new file mode 100644
index 00000000000..27a8f8cf712
--- /dev/null
+++ b/TAO/tao/RTCORBA/RT_Stub_Factory.h
@@ -0,0 +1,68 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file RT_Stub_Factory.h
+ *
+ * $Id$
+ *
+ * Defines the a factory interface for creating Stubs.
+ * This class creates the default stub, that is used in
+ * plain CORBA.
+ *
+ * @author Angelo Corsaro <corsaro@cs.wustl.edu>
+ * @author Frank Hunleth <fhunleth@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_RT_STUB_FACTORY_H_
+#define TAO_RT_STUB_FACTORY_H_
+
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
+
+#include "tao/RTCORBA/rtcorba_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Stub_Factory.h"
+
+#include "ace/Service_Config.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_RT_Stub_Factory
+ *
+ * This class is a factory whose product is the TAO_RT_Stub used by
+ * TAO. This factory, or one of its subclasses is dynamically
+ * plugged into the ORB_Core, and is used by the ORB_Core to create
+ * Stub Objects.
+ */
+class TAO_RTCORBA_Export TAO_RT_Stub_Factory : public TAO_Stub_Factory
+{
+public:
+ // -- Ctor/Dtor --
+ virtual ~TAO_RT_Stub_Factory (void);
+
+ /// Creates a Stub Object.
+ virtual TAO_Stub *create_stub (const char *repository_id,
+ const TAO_MProfile &profiles,
+ TAO_ORB_Core *orb_core
+ ACE_ENV_ARG_DECL);
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE_EXPORT (TAO_RTCORBA, TAO_RT_Stub_Factory)
+ACE_FACTORY_DECLARE (TAO_RTCORBA, TAO_RT_Stub_Factory)
+
+#endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_RT_STUB_FACTORY_H_ */
diff --git a/TAO/tao/RTCORBA/RT_Thread_Lane_Resources_Manager.cpp b/TAO/tao/RTCORBA/RT_Thread_Lane_Resources_Manager.cpp
new file mode 100644
index 00000000000..1b7aa28ff78
--- /dev/null
+++ b/TAO/tao/RTCORBA/RT_Thread_Lane_Resources_Manager.cpp
@@ -0,0 +1,160 @@
+// $Id$
+
+#include "tao/RTCORBA/RT_Thread_Lane_Resources_Manager.h"
+
+#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
+
+ACE_RCSID (RTCORBA,
+ RT_Thread_Lane_Resources_Manager,
+ "$Id$")
+
+#include "tao/ORB_Core.h"
+#include "tao/ORB_Core_TSS_Resources.h"
+#include "tao/Acceptor_Registry.h"
+#include "tao/Thread_Lane_Resources.h"
+#include "tao/RTCORBA/Thread_Pool.h"
+#include "tao/LF_Follower.h"
+#include "tao/Leader_Follower.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_RT_Thread_Lane_Resources_Manager::TAO_RT_Thread_Lane_Resources_Manager (TAO_ORB_Core &orb_core)
+ : TAO_Thread_Lane_Resources_Manager (orb_core),
+ default_lane_resources_ (0),
+ tp_manager_ (0)
+{
+ // Create the default resources.
+ ACE_NEW (this->default_lane_resources_,
+ TAO_Thread_Lane_Resources (orb_core));
+
+ // Create the thread-pool manager.
+ ACE_NEW (this->tp_manager_,
+ TAO_Thread_Pool_Manager (orb_core));
+
+}
+
+TAO_RT_Thread_Lane_Resources_Manager::~TAO_RT_Thread_Lane_Resources_Manager (void)
+{
+ // Delete the default resources.
+ delete this->default_lane_resources_;
+
+ // Delete the thread-pool manager.
+ delete this->tp_manager_;
+}
+
+int
+TAO_RT_Thread_Lane_Resources_Manager::open_default_resources (ACE_ENV_SINGLE_ARG_DECL)
+{
+ TAO_ORB_Parameters *params =
+ this->orb_core_->orb_params ();
+
+ TAO_EndpointSet endpoint_set;
+
+ params->get_endpoint_set (TAO_DEFAULT_LANE,
+ endpoint_set);
+
+ bool ignore_address = false;
+
+ int result =
+ this->default_lane_resources_->open_acceptor_registry (endpoint_set,
+ ignore_address
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ return result;
+}
+
+void
+TAO_RT_Thread_Lane_Resources_Manager::finalize (void)
+{
+ // Finalize default resources.
+ this->default_lane_resources_->finalize ();
+
+ // Finalize resources managed by the thread-pool manager.
+ this->tp_manager_->finalize ();
+}
+
+void
+TAO_RT_Thread_Lane_Resources_Manager::shutdown_reactor (void)
+{
+ // Shutdown default reactors.
+ this->default_lane_resources_->shutdown_reactor ();
+
+ // Shutdown reactors managed by the thread-pool manager.
+ this->tp_manager_->shutdown_reactor ();
+}
+
+void
+TAO_RT_Thread_Lane_Resources_Manager::cleanup_rw_transports (void)
+{
+ // Shutdown default reactors.
+ this->default_lane_resources_->cleanup_rw_transports ();
+}
+
+int
+TAO_RT_Thread_Lane_Resources_Manager::is_collocated (const TAO_MProfile &mprofile)
+{
+ int result =
+ this->default_lane_resources_->is_collocated (mprofile);
+
+ if (result)
+ return result;
+
+ return this->tp_manager_->is_collocated (mprofile);
+}
+
+TAO_Thread_Lane_Resources &
+TAO_RT_Thread_Lane_Resources_Manager::lane_resources (void)
+{
+ // Get the ORB_Core's TSS resources.
+ TAO_ORB_Core_TSS_Resources &tss =
+ *this->orb_core_->get_tss_resources ();
+
+ // Get the lane for this thread.
+ TAO_Thread_Lane *lane =
+ static_cast <TAO_Thread_Lane *> (tss.lane_);
+
+ // If we have a valid lane, use that lane's resources.
+ if (lane)
+ return lane->resources ();
+ else
+ // Otherwise, return the default resources.
+ return *this->default_lane_resources_;
+}
+
+TAO_Thread_Lane_Resources &
+TAO_RT_Thread_Lane_Resources_Manager::default_lane_resources (void)
+{
+ return *this->default_lane_resources_;
+}
+
+TAO_Thread_Pool_Manager &
+TAO_RT_Thread_Lane_Resources_Manager::tp_manager (void)
+{
+ return *this->tp_manager_;
+}
+
+TAO_Thread_Lane_Resources_Manager *
+TAO_RT_Thread_Lane_Resources_Manager_Factory::create_thread_lane_resources_manager (TAO_ORB_Core &core)
+{
+ TAO_Thread_Lane_Resources_Manager *manager = 0;
+
+ /// Create the RT Thread Lane Resources Manager.
+ ACE_NEW_RETURN (manager,
+ TAO_RT_Thread_Lane_Resources_Manager (core),
+ 0);
+
+ return manager;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DEFINE (TAO_RT_Thread_Lane_Resources_Manager_Factory,
+ ACE_TEXT ("RT_Thread_Lane_Resources_Manager_Factory"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (TAO_RT_Thread_Lane_Resources_Manager_Factory),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0)
+ACE_FACTORY_DEFINE (TAO_RTCORBA, TAO_RT_Thread_Lane_Resources_Manager_Factory)
+
+#endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
diff --git a/TAO/tao/RTCORBA/RT_Thread_Lane_Resources_Manager.h b/TAO/tao/RTCORBA/RT_Thread_Lane_Resources_Manager.h
new file mode 100644
index 00000000000..a1cfe5cdbf8
--- /dev/null
+++ b/TAO/tao/RTCORBA/RT_Thread_Lane_Resources_Manager.h
@@ -0,0 +1,117 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file RT_Thread_Lane_Resources_Manager.h
+ *
+ * $Id$
+ *
+ * @author Irfan Pyarali
+ */
+// ===================================================================
+
+#ifndef TAO_RT_THREAD_LANE_RESOURCES_MANAGER_H
+#define TAO_RT_THREAD_LANE_RESOURCES_MANAGER_H
+
+#include /**/ "ace/pre.h"
+#include "tao/orbconf.h"
+
+#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/RTCORBA/rtcorba_export.h"
+#include "tao/Thread_Lane_Resources_Manager.h"
+#include "ace/Service_Config.h"
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Thread_Pool_Manager;
+
+/**
+ * @class TAO_RT_Thread_Lane_Resources_Manager
+ *
+ * @brief Manager for thread lane resources.
+ *
+ * \nosubgrouping
+ *
+ **/
+class TAO_RTCORBA_Export TAO_RT_Thread_Lane_Resources_Manager :
+ public TAO_Thread_Lane_Resources_Manager
+{
+public:
+
+ /// Constructor.
+ TAO_RT_Thread_Lane_Resources_Manager (TAO_ORB_Core &orb_core);
+
+ /// Destructor.
+ ~TAO_RT_Thread_Lane_Resources_Manager (void);
+
+ /// Finalize resources.
+ void finalize (void);
+
+ /// Open default resources.
+ int open_default_resources (ACE_ENV_SINGLE_ARG_DECL);
+
+ /// Shutdown reactor.
+ void shutdown_reactor (void);
+
+ /// Certain ORB policies such as dropping replies on shutdown with
+ /// RW connection handlers would need cleanup of transports to wake
+ /// threads up.
+ void cleanup_rw_transports (void);
+
+ /// Does @a mprofile belong to us?
+ int is_collocated (const TAO_MProfile &mprofile);
+
+ /// @name Accessors
+ // @{
+
+ TAO_Thread_Lane_Resources &lane_resources (void);
+
+ TAO_Thread_Lane_Resources &default_lane_resources (void);
+
+ TAO_Thread_Pool_Manager &tp_manager (void);
+
+ // @}
+
+protected:
+
+ /// Default lane resources.
+ TAO_Thread_Lane_Resources *default_lane_resources_;
+
+ /// Thread Pool Manager.
+ TAO_Thread_Pool_Manager *tp_manager_;
+};
+
+/**
+ * @class TAO_RT_Thread_Lane_Resources_Manager_Factory
+ *
+ * @brief This class is a factory for managers of thread resources.
+ *
+ * \nosubgrouping
+ *
+ **/
+class TAO_RTCORBA_Export TAO_RT_Thread_Lane_Resources_Manager_Factory
+ : public TAO_Thread_Lane_Resources_Manager_Factory
+{
+public:
+
+ /// Factory method.
+ TAO_Thread_Lane_Resources_Manager *create_thread_lane_resources_manager (TAO_ORB_Core &core);
+
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE_EXPORT (TAO_RTCORBA, TAO_RT_Thread_Lane_Resources_Manager_Factory)
+ACE_FACTORY_DECLARE (TAO_RTCORBA, TAO_RT_Thread_Lane_Resources_Manager_Factory)
+
+#endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_RT_THREAD_LANE_RESOURCES_MANAGER_H */
diff --git a/TAO/tao/RTCORBA/RT_Transport_Descriptor.cpp b/TAO/tao/RTCORBA/RT_Transport_Descriptor.cpp
new file mode 100644
index 00000000000..79c86d3d785
--- /dev/null
+++ b/TAO/tao/RTCORBA/RT_Transport_Descriptor.cpp
@@ -0,0 +1,117 @@
+// $Id$
+
+#include "tao/RTCORBA/RT_Transport_Descriptor.h"
+#include "ace/OS_Memory.h"
+
+#if ! defined (__ACE_INLINE__)
+#include "tao/RTCORBA/RT_Transport_Descriptor.inl"
+#endif /* __ACE_INLINE__ */
+
+ACE_RCSID(RTCORBA, TAO_RT_Transport_Descriptor, "$Id$")
+
+#include "tao/RTCORBA/RT_Transport_Descriptor_Property.h"
+#include "tao/Endpoint.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_RT_Transport_Descriptor::~TAO_RT_Transport_Descriptor ()
+{
+ if (this->delete_properties_ == 1)
+ {
+ TAO_RT_Transport_Descriptor_Property *current =
+ this->property_list_;
+
+ while (current)
+ {
+ TAO_RT_Transport_Descriptor_Property *next =
+ current->next_;
+
+ delete current;
+
+ current = next;
+ }
+ }
+}
+
+TAO_Transport_Descriptor_Interface *
+TAO_RT_Transport_Descriptor::duplicate (void)
+{
+ // Get a copy of the underlying endpoint
+ TAO_Endpoint *endpoint =
+ this->endpoint_->duplicate ();
+ if (endpoint == 0)
+ return 0;
+
+ TAO_RT_Transport_Descriptor *new_descriptor = 0;
+
+ ACE_NEW_RETURN (new_descriptor,
+ TAO_RT_Transport_Descriptor (endpoint, 1),
+ 0);
+
+ // Copy the Properties.
+ TAO_RT_Transport_Descriptor_Property *current_property =
+ this->property_list_;
+
+ TAO_RT_Transport_Descriptor_Property *current_new_property = 0;
+ TAO_RT_Transport_Descriptor_Property *new_property = 0;
+
+ while (current_property)
+ {
+ new_property =
+ current_property->duplicate ();
+
+ // Note that we cannot use <insert> because that will reverse the stack.
+ if (new_descriptor->property_list_ == 0)
+ new_descriptor->property_list_ = new_property;
+ else
+ current_new_property->next_ = new_property;
+
+ current_new_property = new_property;
+ current_property = current_property->next_;
+ }
+
+ return new_descriptor;
+}
+
+CORBA::Boolean
+TAO_RT_Transport_Descriptor::is_equivalent (const TAO_Transport_Descriptor_Interface *other_prop)
+{
+ const TAO_RT_Transport_Descriptor *rhs =
+ dynamic_cast<const TAO_RT_Transport_Descriptor*> (other_prop);
+
+ if (rhs == 0)
+ return false;
+
+ // Check if endpoint is equivalent.
+ if (this->endpoint_->is_equivalent (rhs->endpoint_) == 0)
+ return false;
+
+ // Check the property_list_.
+ TAO_RT_Transport_Descriptor_Property *current =
+ this->property_list_;
+
+ TAO_RT_Transport_Descriptor_Property *rhs_current =
+ rhs->property_list_;
+
+ while (current || rhs_current)
+ {
+ if (rhs_current == 0 || current == 0)
+ return false;
+
+ if (current->is_equivalent (rhs_current) == 0)
+ return false;
+
+ current = current->next_;
+ rhs_current = rhs_current->next_;
+ }
+
+ return true;
+}
+
+u_long
+TAO_RT_Transport_Descriptor::hash (void) const
+{
+ return this->endpoint_->hash ();
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/RTCORBA/RT_Transport_Descriptor.h b/TAO/tao/RTCORBA/RT_Transport_Descriptor.h
new file mode 100644
index 00000000000..7e3b2bcce33
--- /dev/null
+++ b/TAO/tao/RTCORBA/RT_Transport_Descriptor.h
@@ -0,0 +1,80 @@
+// -*- C++ -*-
+
+/**
+ * @file RT_Transport_Descriptor.h
+ *
+ * $Id$
+ *
+ * @author Pradeep Gore <pradeep@oomworks.com>
+ */
+
+#ifndef TAO_RT_TRANSPORT_DESCRIPTOR_H
+#define TAO_RT_TRANSPORT_DESCRIPTOR_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/RTCORBA/rtcorba_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/RTCORBA/RT_Transport_Descriptor_Property.h"
+
+#include "tao/Transport_Descriptor_Interface.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_RT_Transport_Descriptor
+ *
+ * @brief Transport Descriptor for RTCORBA.
+ *
+ * The TAO_RT_Transport_Descriptor contains Descriptor Properties.
+ * It uses the "Chain of Command" pattern in the implementation of the <_is_equivalent> method.
+ *
+ */
+class TAO_RTCORBA_Export TAO_RT_Transport_Descriptor
+ : public TAO_Transport_Descriptor_Interface
+{
+public:
+ /// Constuctor
+ TAO_RT_Transport_Descriptor (TAO_Endpoint *endpoint,
+ CORBA::Boolean flag = false);
+
+ /// Destructor
+ ~TAO_RT_Transport_Descriptor ();
+
+ /// Insert Properties.
+ void insert (TAO_RT_Transport_Descriptor_Property *descriptor_property);
+
+ /// = TAO_Transport_Descriptor_Interface methods
+
+ /// This call allocates and copies the contents of this class and
+ /// returns the pointer
+ virtual TAO_Transport_Descriptor_Interface *duplicate (void);
+
+ /// Try to determine if this object is same as the <other_prop>.
+ virtual CORBA::Boolean is_equivalent (
+ const TAO_Transport_Descriptor_Interface *other_prop);
+
+ /// Generate hash value for our class
+ virtual u_long hash (void) const;
+
+private:
+ /// Stack of properties.
+ TAO_RT_Transport_Descriptor_Property *property_list_;
+
+ /// Flag to delete properties.
+ int delete_properties_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+#include "tao/RTCORBA/RT_Transport_Descriptor.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_RT_TRANSPORT_DESCRIPTOR_H */
diff --git a/TAO/tao/RTCORBA/RT_Transport_Descriptor.inl b/TAO/tao/RTCORBA/RT_Transport_Descriptor.inl
new file mode 100644
index 00000000000..3afd7b186e8
--- /dev/null
+++ b/TAO/tao/RTCORBA/RT_Transport_Descriptor.inl
@@ -0,0 +1,24 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO_RT_Transport_Descriptor::TAO_RT_Transport_Descriptor (TAO_Endpoint *endpoint,
+ CORBA::Boolean flag)
+ : TAO_Transport_Descriptor_Interface (endpoint, flag)
+ , property_list_ (0)
+ , delete_properties_ (flag)
+{
+}
+
+ACE_INLINE void
+TAO_RT_Transport_Descriptor::insert (TAO_RT_Transport_Descriptor_Property *descriptor_property)
+{
+ descriptor_property->next_ = this->property_list_;
+
+ this->property_list_ = descriptor_property;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/RTCORBA/RT_Transport_Descriptor_Property.cpp b/TAO/tao/RTCORBA/RT_Transport_Descriptor_Property.cpp
new file mode 100644
index 00000000000..020fe70267a
--- /dev/null
+++ b/TAO/tao/RTCORBA/RT_Transport_Descriptor_Property.cpp
@@ -0,0 +1,80 @@
+// $Id$
+
+#include "tao/RTCORBA/RT_Transport_Descriptor_Property.h"
+
+#include "ace/OS_Memory.h"
+
+#if ! defined (__ACE_INLINE__)
+#include "tao/RTCORBA/RT_Transport_Descriptor_Property.inl"
+#endif /* __ACE_INLINE__ */
+
+ACE_RCSID (RTCORBA,
+ TAO_RT_Transport_Descriptor_Property,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_RT_Transport_Descriptor_Property::~TAO_RT_Transport_Descriptor_Property (void)
+{
+}
+
+/*************************************************************************************************/
+
+TAO_RT_Transport_Descriptor_Private_Connection_Property::~TAO_RT_Transport_Descriptor_Private_Connection_Property (void)
+{
+}
+
+TAO_RT_Transport_Descriptor_Property*
+TAO_RT_Transport_Descriptor_Private_Connection_Property::duplicate (void)
+{
+ // Construct a copy of our class
+ TAO_RT_Transport_Descriptor_Private_Connection_Property *desc_prop = 0;
+
+ ACE_NEW_RETURN (desc_prop,
+ TAO_RT_Transport_Descriptor_Private_Connection_Property (this->object_id_),
+ 0);
+
+ return desc_prop;
+}
+
+CORBA::Boolean
+TAO_RT_Transport_Descriptor_Private_Connection_Property::is_equivalent (const TAO_RT_Transport_Descriptor_Property *other_prop)
+{
+ const TAO_RT_Transport_Descriptor_Private_Connection_Property *rhs =
+ dynamic_cast<const TAO_RT_Transport_Descriptor_Private_Connection_Property*> (other_prop);
+ return (rhs != 0 &&
+ this->object_id_ == rhs->object_id_);
+}
+
+/*************************************************************************************************/
+
+TAO_RT_Transport_Descriptor_Banded_Connection_Property::~TAO_RT_Transport_Descriptor_Banded_Connection_Property ()
+{
+}
+
+TAO_RT_Transport_Descriptor_Property*
+TAO_RT_Transport_Descriptor_Banded_Connection_Property::duplicate (void)
+{
+ // Construct a copy of our class
+ TAO_RT_Transport_Descriptor_Banded_Connection_Property *desc_prop = 0;
+
+ ACE_NEW_RETURN (desc_prop,
+ TAO_RT_Transport_Descriptor_Banded_Connection_Property (this->low_priority_,
+ this->high_priority_),
+ 0);
+
+ return desc_prop;
+}
+
+CORBA::Boolean
+TAO_RT_Transport_Descriptor_Banded_Connection_Property::is_equivalent (const TAO_RT_Transport_Descriptor_Property *other_prop)
+{
+ const TAO_RT_Transport_Descriptor_Banded_Connection_Property *rhs =
+ dynamic_cast<const TAO_RT_Transport_Descriptor_Banded_Connection_Property*> (other_prop);
+
+ return (rhs != 0 &&
+ this->low_priority_ == rhs->low_priority_ &&
+ this->high_priority_ == rhs->high_priority_);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/RTCORBA/RT_Transport_Descriptor_Property.h b/TAO/tao/RTCORBA/RT_Transport_Descriptor_Property.h
new file mode 100644
index 00000000000..cf38816b4d6
--- /dev/null
+++ b/TAO/tao/RTCORBA/RT_Transport_Descriptor_Property.h
@@ -0,0 +1,144 @@
+// -*- C++ -*-
+
+/**
+ * @file RT_Transport_Descriptor_Property.h
+ *
+ * $Id$
+ *
+ * @author Pradeep Gore <pradeep@oomworks.com>
+ */
+
+#ifndef TAO_RT_TRANSPORT_DESCRIPTOR_PROPERTY_H
+#define TAO_RT_TRANSPORT_DESCRIPTOR_PROPERTY_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/RTCORBA/rtcorba_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Basic_Types.h"
+
+#include "ace/Global_Macros.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_RT_Transport_Descriptor_Property
+ *
+ * @brief Base RT Transport Descriptor Property that can be <insert> ed into the TAO_RT_Transport_Descriptor class.
+ *
+ */
+class TAO_RTCORBA_Export TAO_RT_Transport_Descriptor_Property
+{
+ friend class TAO_RT_Transport_Descriptor;
+
+public:
+ /// Constuctor
+ TAO_RT_Transport_Descriptor_Property (void);
+
+ /// Destructor
+ virtual ~TAO_RT_Transport_Descriptor_Property (void);
+
+ virtual TAO_RT_Transport_Descriptor_Property *duplicate (void) = 0;
+
+ virtual CORBA::Boolean is_equivalent (const TAO_RT_Transport_Descriptor_Property *other_prop) = 0;
+
+protected:
+ /// Properties can be chanined using the <next_> pointer;
+ TAO_RT_Transport_Descriptor_Property* next_;
+
+private:
+ // = Disallow copying and assignment.
+ TAO_RT_Transport_Descriptor_Property (const TAO_RT_Transport_Descriptor_Property &);
+ TAO_RT_Transport_Descriptor_Property & operator= (const TAO_RT_Transport_Descriptor_Property &);
+};
+
+/**
+ * @class TAO_RT_Transport_Descriptor_Private_Connection_Property
+ *
+ * @brief Descriptor Property for Private Connections.
+ *
+ * Holds info necessary to identify private connections and
+ * store/look them up in the Transport Cache. (For description
+ * of private connections see RTCORBA::PrivateTransportPolicy.)
+ *
+ */
+class TAO_RTCORBA_Export TAO_RT_Transport_Descriptor_Private_Connection_Property
+ : public TAO_RT_Transport_Descriptor_Property
+{
+public:
+ /// Constuctor
+ TAO_RT_Transport_Descriptor_Private_Connection_Property (void);
+ TAO_RT_Transport_Descriptor_Private_Connection_Property (long object_id);
+
+ /// Destructor
+ ~TAO_RT_Transport_Descriptor_Private_Connection_Property (void);
+
+ /// Init
+ void init (long object_id);
+
+ virtual TAO_RT_Transport_Descriptor_Property *duplicate (void);
+
+ virtual CORBA::Boolean is_equivalent (const TAO_RT_Transport_Descriptor_Property *other_prop);
+
+private:
+ /**
+ * Unique identifier of the object to which private connection
+ * identified with this descriptor belongs. The value of
+ * @c object_id_ is the @c TAO_Stub* of the object.
+ */
+ long object_id_;
+
+};
+
+/*****************************************************************************/
+
+/**
+ * @class TAO_RT_Transport_Descriptor_Banded_Connection_Property
+ *
+ * @brief Descriptor Property for Banded Connections.
+ *
+ * This property holds the Band information necessary to identify a banded connection.
+ *
+ */
+class TAO_RTCORBA_Export TAO_RT_Transport_Descriptor_Banded_Connection_Property
+ : public TAO_RT_Transport_Descriptor_Property
+{
+public:
+ /// Constuctor
+ TAO_RT_Transport_Descriptor_Banded_Connection_Property (void);
+ TAO_RT_Transport_Descriptor_Banded_Connection_Property (CORBA::Short low_priority,
+ CORBA::Short high_priority);
+
+ /// Destructor
+ ~TAO_RT_Transport_Descriptor_Banded_Connection_Property (void);
+
+ /// Init
+ void init (CORBA::Short low_priority, CORBA::Short high_priority);
+
+ virtual TAO_RT_Transport_Descriptor_Property *duplicate (void);
+
+ virtual CORBA::Boolean is_equivalent (const TAO_RT_Transport_Descriptor_Property *other_prop);
+
+protected:
+ /// The low priority of the Band.
+ CORBA::Short low_priority_;
+
+ /// The high priority of the Band.
+ CORBA::Short high_priority_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+/*****************************************************************************/
+
+#if defined (__ACE_INLINE__)
+#include "tao/RTCORBA/RT_Transport_Descriptor_Property.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_RT_TRANSPORT_DESCRIPTOR_PROPERTY_H */
diff --git a/TAO/tao/RTCORBA/RT_Transport_Descriptor_Property.inl b/TAO/tao/RTCORBA/RT_Transport_Descriptor_Property.inl
new file mode 100644
index 00000000000..89c98fe4485
--- /dev/null
+++ b/TAO/tao/RTCORBA/RT_Transport_Descriptor_Property.inl
@@ -0,0 +1,57 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO_RT_Transport_Descriptor_Property::TAO_RT_Transport_Descriptor_Property (void)
+ : next_ (0)
+{
+}
+
+/*************************************************************************************************/
+ACE_INLINE
+TAO_RT_Transport_Descriptor_Private_Connection_Property::TAO_RT_Transport_Descriptor_Private_Connection_Property (void)
+ : object_id_ (-1)
+{
+}
+
+ACE_INLINE
+TAO_RT_Transport_Descriptor_Private_Connection_Property::TAO_RT_Transport_Descriptor_Private_Connection_Property (long object_id)
+ : object_id_ (object_id)
+{
+}
+
+ACE_INLINE void
+TAO_RT_Transport_Descriptor_Private_Connection_Property::init (long object_id)
+{
+ this->object_id_ = object_id;
+}
+
+/*************************************************************************************************/
+
+ACE_INLINE
+TAO_RT_Transport_Descriptor_Banded_Connection_Property::TAO_RT_Transport_Descriptor_Banded_Connection_Property (void)
+ : low_priority_ (-1)
+ , high_priority_ (-1)
+{
+}
+
+ACE_INLINE
+TAO_RT_Transport_Descriptor_Banded_Connection_Property::TAO_RT_Transport_Descriptor_Banded_Connection_Property (CORBA::Short low_priority,
+ CORBA::Short high_priority)
+ : low_priority_ (low_priority)
+ , high_priority_ (high_priority)
+{
+}
+
+ACE_INLINE void
+TAO_RT_Transport_Descriptor_Banded_Connection_Property::init (CORBA::Short low_priority,
+ CORBA::Short high_priority)
+{
+ this->low_priority_ = low_priority;
+ this->high_priority_ = high_priority;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/RTCORBA/TAO_RTCORBA.pc.in b/TAO/tao/RTCORBA/TAO_RTCORBA.pc.in
new file mode 100644
index 00000000000..a778557fe3b
--- /dev/null
+++ b/TAO/tao/RTCORBA/TAO_RTCORBA.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: TAO_RTCORBA
+Description: TAO Real-Time CORBA Library
+Requires: TAO_PI, TAO_CodecFactory, TAO_AnyTypeCode, TAO
+Version: @VERSION@
+Libs: -L${libdir} -lTAO_RTCORBA
+Cflags: -I${includedir}
diff --git a/TAO/tao/RTCORBA/TAO_RTCORBA.rc b/TAO/tao/RTCORBA/TAO_RTCORBA.rc
new file mode 100644
index 00000000000..c4c1b19b422
--- /dev/null
+++ b/TAO/tao/RTCORBA/TAO_RTCORBA.rc
@@ -0,0 +1,30 @@
+#include "..\Version.h"
+
+1 VERSIONINFO
+ FILEVERSION TAO_MAJOR_VERSION,TAO_MINOR_VERSION,TAO_BETA_VERSION,0
+ PRODUCTVERSION TAO_MAJOR_VERSION,TAO_MINOR_VERSION,TAO_BETA_VERSION,0
+ FILEFLAGSMASK 0x3fL
+ FILEFLAGS 0x0L
+ FILEOS 0x4L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904B0"
+ BEGIN
+ VALUE "FileDescription", "RTCORBA\0"
+ VALUE "FileVersion", TAO_VERSION "\0"
+ VALUE "InternalName", "TAO_RTCORBADLL\0"
+ VALUE "LegalCopyright", "\0"
+ VALUE "LegalTrademarks", "\0"
+ VALUE "OriginalFilename", "TAO_RTCORBA.DLL\0"
+ VALUE "ProductName", "TAO\0"
+ VALUE "ProductVersion", TAO_VERSION "\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
diff --git a/TAO/tao/RTCORBA/Thread_Pool.cpp b/TAO/tao/RTCORBA/Thread_Pool.cpp
new file mode 100644
index 00000000000..32476bbef4b
--- /dev/null
+++ b/TAO/tao/RTCORBA/Thread_Pool.cpp
@@ -0,0 +1,957 @@
+#include "tao/RTCORBA/Thread_Pool.h"
+
+#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
+
+ACE_RCSID (RTCORBA,
+ Thread_Pool,
+ "$Id$")
+
+#if ! defined (__ACE_INLINE__)
+#include "tao/RTCORBA/Thread_Pool.inl"
+#endif /* __ACE_INLINE__ */
+
+#include "tao/Exception.h"
+#include "tao/ORB_Core.h"
+#include "tao/ORB_Core_TSS_Resources.h"
+#include "tao/ORB.h"
+#include "tao/Acceptor_Registry.h"
+#include "tao/Transport_Cache_Manager.h"
+#include "tao/debug.h"
+#include "tao/RTCORBA/Priority_Mapping_Manager.h"
+#include "tao/LF_Follower.h"
+#include "tao/Leader_Follower.h"
+#include "ace/Auto_Ptr.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_RT_New_Leader_Generator::TAO_RT_New_Leader_Generator (
+ TAO_Thread_Lane &lane)
+ : lane_ (lane)
+{
+}
+
+void
+TAO_RT_New_Leader_Generator::no_leaders_available (void)
+{
+ // Request a new dynamic thread from the Thread Lane
+ this->lane_.new_dynamic_thread ();
+}
+
+TAO_Thread_Pool_Threads::TAO_Thread_Pool_Threads (TAO_Thread_Lane &lane)
+ : ACE_Task_Base (lane.pool ().manager ().orb_core ().thr_mgr ()),
+ lane_ (lane)
+{
+}
+
+int
+TAO_Thread_Pool_Threads::svc (void)
+{
+ TAO_ORB_Core &orb_core =
+ this->lane ().pool ().manager ().orb_core ();
+
+ if (orb_core.has_shutdown ())
+ return 0;
+
+ // Set TSS resources for this thread.
+ TAO_Thread_Pool_Threads::set_tss_resources (orb_core,
+ this->lane_);
+
+ ACE_TRY_NEW_ENV
+ {
+ // Do the work
+ this->run (orb_core);
+ }
+ ACE_CATCHANY
+ {
+ // No point propagating this exception. Print it out.
+ ACE_ERROR ((LM_ERROR,
+ "orb->run() raised exception for thread %t\n"));
+
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "");
+ }
+ ACE_ENDTRY;
+
+ return 0;
+}
+
+int
+TAO_Thread_Pool_Threads::run (TAO_ORB_Core &orb_core ACE_ENV_ARG_PARAMETER)
+{
+ CORBA::ORB_ptr orb = orb_core.orb ();
+
+ // Run the ORB.
+ orb->run (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ return 0;
+}
+
+void
+TAO_Thread_Pool_Threads::set_tss_resources (TAO_ORB_Core &orb_core,
+ TAO_Thread_Lane &thread_lane)
+{
+ /// Get the ORB_Core's TSS resources.
+ TAO_ORB_Core_TSS_Resources &tss =
+ *orb_core.get_tss_resources ();
+
+ /// Set the lane attribute in TSS.
+ tss.lane_ = &thread_lane;
+}
+
+TAO_Dynamic_Thread_Pool_Threads::TAO_Dynamic_Thread_Pool_Threads (TAO_Thread_Lane &lane)
+ : TAO_Thread_Pool_Threads (lane)
+{
+}
+
+int
+TAO_Dynamic_Thread_Pool_Threads::run (TAO_ORB_Core &orb_core ACE_ENV_ARG_PARAMETER)
+{
+ CORBA::ORB_ptr orb = orb_core.orb ();
+
+ if (this->lane_.dynamic_thread_idle_timeout () == ACE_Time_Value::zero)
+ {
+ // No timeout specified, run the ORB until it shutdowns
+ orb->run (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ else
+ {
+ // A timeout is specified, run the ORB in an idle loop, if we
+ // don't handle any operations for the given timeout we just
+ // exit the loop and this thread ends itself.
+ ACE_Time_Value tv (this->lane_.dynamic_thread_idle_timeout ());
+ while (!orb_core.has_shutdown () && orb->work_pending (tv))
+ {
+ orb->perform_work ();
+ tv = this->lane_.dynamic_thread_idle_timeout ();
+ }
+
+ if (TAO_debug_level > 7)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO Process %P Pool %d Lane %d Thread %t\n")
+ ACE_TEXT ("Current number of dynamic threads left = %d; ")
+ ACE_TEXT ("RTCorba worker thread is ending!\n"),
+ this->lane_.pool ().id (),
+ this->lane_.id (),
+ this->thr_count () - 1));
+ }
+
+ return 0;
+}
+
+TAO_Thread_Lane::TAO_Thread_Lane (TAO_Thread_Pool &pool,
+ CORBA::ULong id,
+ CORBA::Short lane_priority,
+ CORBA::ULong static_threads,
+ CORBA::ULong dynamic_threads,
+ ACE_Time_Value const &dynamic_thread_idle_timeout
+ ACE_ENV_ARG_DECL_NOT_USED)
+ : pool_ (pool),
+ id_ (id),
+ lane_priority_ (lane_priority),
+ shutdown_ (false),
+ static_threads_number_ (static_threads),
+ dynamic_threads_number_ (dynamic_threads),
+ static_threads_ (*this),
+ dynamic_threads_ (*this),
+ new_thread_generator_ (*this),
+ resources_ (pool.manager ().orb_core (),
+ &new_thread_generator_),
+ native_priority_ (TAO_INVALID_PRIORITY),
+ dynamic_thread_idle_timeout_ (dynamic_thread_idle_timeout)
+{
+}
+
+bool
+TAO_Thread_Lane::new_dynamic_thread (void)
+{
+ // Note that we are checking this condition below without the lock
+ // held.
+ if (this->dynamic_threads_.thr_count () >= this->dynamic_threads_number_)
+ return false;
+
+ ACE_GUARD_RETURN (ACE_SYNCH_MUTEX,
+ mon,
+ this->lock_,
+ false);
+
+ TAO_Thread_Pool_Manager &manager =
+ this->pool_.manager ();
+
+ if (!manager.orb_core ().has_shutdown () && !this->shutdown_&&
+ this->dynamic_threads_.thr_count () < this->dynamic_threads_number_)
+ {
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO Process %P Pool %d Lane %d Thread %t\n")
+ ACE_TEXT ("Current number of dynamic threads = %d; ")
+ ACE_TEXT ("static threads = %d; max dynamic threads = %d\n")
+ ACE_TEXT ("No leaders available; creating new leader!\n"),
+ this->pool_.id (),
+ this->id_,
+ this->dynamic_threads_.thr_count (),
+ this->static_threads_number_,
+ this->dynamic_threads_number_));
+
+ int result =
+ this->create_threads_i (this->dynamic_threads_,
+ 1,
+ THR_BOUND | THR_DETACHED);
+
+ if (result != 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("Pool %d Lane %d Thread %t: ")
+ ACE_TEXT ("cannot create dynamic thread\n"),
+ this->pool_.id (),
+ this->id_),
+ false);
+ }
+
+ return true;
+}
+
+void
+TAO_Thread_Lane::shutting_down (void)
+{
+ ACE_GUARD (ACE_SYNCH_MUTEX,
+ mon,
+ this->lock_);
+
+ // We are shutting down, this way we are not creating any more new dynamic
+ // threads
+ this->shutdown_ = true;
+}
+
+void
+TAO_Thread_Lane::validate_and_map_priority (ACE_ENV_SINGLE_ARG_DECL)
+{
+ // Make sure that static_threads_number_ is not zero.
+ if (this->static_threads_number_ == 0)
+ ACE_THROW (CORBA::BAD_PARAM ());
+
+ // Check that the priority is in bounds.
+ if (this->lane_priority_ < RTCORBA::minPriority
+ // The line below will always be false unless the value of
+ // RTCORBA::maxPriority, which is now assigned the value of
+ // 32767, is changed in RTCORBA.pidl.
+// || this->lane_priority_ > RTCORBA::maxPriority
+ )
+ {
+ ACE_THROW (CORBA::BAD_PARAM ());
+ }
+
+ CORBA::ORB_ptr orb =
+ this->pool_.manager ().orb_core ().orb ();
+
+ // Get the priority mapping manager.
+ CORBA::Object_var obj =
+ orb->resolve_initial_references (TAO_OBJID_PRIORITYMAPPINGMANAGER
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ TAO_Priority_Mapping_Manager_var mapping_manager =
+ TAO_Priority_Mapping_Manager::_narrow (obj.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ RTCORBA::PriorityMapping *pm =
+ mapping_manager.in ()->mapping ();
+
+ // Map CORBA priority to native priority.
+ CORBA::Boolean result =
+ pm->to_native (this->lane_priority_,
+ this->native_priority_);
+
+ if (!result)
+ ACE_THROW (CORBA::DATA_CONVERSION ());
+
+ if (TAO_debug_level > 3)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - creating thread at ")
+ ACE_TEXT ("(corba:native) priority %d:%d\n"),
+ this->lane_priority_,
+ this->native_priority_));
+ }
+}
+
+void
+TAO_Thread_Lane::open (ACE_ENV_SINGLE_ARG_DECL)
+{
+ // Validate and map priority.
+ this->validate_and_map_priority (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Create a string with the pool:thread id.
+ char pool_lane_id[10];
+ ACE_OS::sprintf (pool_lane_id,
+ "%d:%d",
+ this->pool ().id (),
+ this->id ());
+
+ TAO_ORB_Parameters *params =
+ this->pool ().manager ().orb_core ().orb_params ();
+
+ TAO_EndpointSet endpoint_set;
+ bool ignore_address;
+
+ // Get the endpoints for this lane.
+ params->get_endpoint_set (pool_lane_id,
+ endpoint_set);
+
+ if (endpoint_set.is_empty ())
+ {
+ // If endpoints are not specified for this lane, use the
+ // endpoints specified for the default lane but ignore their
+ // addresses.
+ params->get_endpoint_set (TAO_DEFAULT_LANE,
+ endpoint_set);
+
+ ignore_address = true;
+ }
+ else
+ {
+ // If endpoints are specified for this lane, use them with thier
+ // addresses.
+ ignore_address = false;
+ }
+
+ // Open the acceptor registry.
+ int result = 0;
+ result =
+ this->resources_.open_acceptor_registry (endpoint_set,
+ ignore_address
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (result == -1)
+ ACE_THROW (CORBA::INTERNAL (
+ CORBA::SystemException::_tao_minor_code (
+ TAO_ACCEPTOR_REGISTRY_OPEN_LOCATION_CODE,
+ 0),
+ CORBA::COMPLETED_NO));
+}
+
+TAO_Thread_Lane::~TAO_Thread_Lane (void)
+{
+}
+
+void
+TAO_Thread_Lane::finalize (void)
+{
+ // Finalize resources.
+ this->resources_.finalize ();
+}
+
+void
+TAO_Thread_Lane::shutdown_reactor (void)
+{
+ this->resources_.shutdown_reactor ();
+}
+
+void
+TAO_Thread_Lane::wait (void)
+{
+ this->static_threads_.wait ();
+ this->dynamic_threads_.wait ();
+}
+
+int
+TAO_Thread_Lane::is_collocated (const TAO_MProfile &mprofile)
+{
+ return this->resources_.is_collocated (mprofile);
+}
+
+CORBA::ULong
+TAO_Thread_Lane::current_threads (void) const
+{
+ ACE_GUARD_RETURN (ACE_SYNCH_MUTEX,
+ mon,
+ this->lock_,
+ 0);
+
+ return (this->static_threads_.thr_count () +
+ this->dynamic_threads_.thr_count ());
+}
+
+
+int
+TAO_Thread_Lane::create_static_threads (void)
+{
+ ACE_GUARD_RETURN (ACE_SYNCH_MUTEX,
+ mon,
+ this->lock_,
+ 0);
+
+ // Create static threads.
+ return this->create_threads_i (this->static_threads_,
+ this->static_threads_number_,
+ THR_NEW_LWP | THR_JOINABLE);
+}
+
+int
+TAO_Thread_Lane::create_dynamic_threads (CORBA::ULong number_of_threads)
+{
+ ACE_GUARD_RETURN (ACE_SYNCH_MUTEX,
+ mon,
+ this->lock_,
+ 0);
+
+ return this->create_threads_i (this->dynamic_threads_,
+ number_of_threads,
+ THR_BOUND | THR_DETACHED);
+}
+
+int
+TAO_Thread_Lane::create_threads_i (TAO_Thread_Pool_Threads &thread_pool,
+ CORBA::ULong number_of_threads,
+ long thread_flags)
+{
+ // Overwritten parameters.
+ int force_active = 1;
+
+ // Default parameters.
+ int default_grp_id = -1;
+ ACE_Task_Base *default_task = 0;
+ ACE_hthread_t *default_thread_handles = 0;
+ void **default_stack = 0;
+
+ // Setting stack size.
+ size_t *stack_size_array = 0;
+ ACE_NEW_RETURN (stack_size_array,
+ size_t[number_of_threads],
+ -1);
+ size_t index;
+ for (index = 0;
+ index != number_of_threads;
+ ++index)
+ stack_size_array[index] =
+ this->pool ().stack_size ();
+
+ // Make sure the dynamically created stack size array is properly
+ // deleted.
+ ACE_Auto_Basic_Array_Ptr<size_t> auto_stack_size_array (stack_size_array);
+
+ TAO_ORB_Core &orb_core =
+ this->pool ().manager ().orb_core ();
+
+ long flags =
+ thread_flags |
+ orb_core.orb_params ()->thread_creation_flags ();
+
+ // Activate the threads.
+ int result =
+ thread_pool.activate (flags,
+ number_of_threads,
+ force_active,
+ this->native_priority_,
+ default_grp_id,
+ default_task,
+ default_thread_handles,
+ default_stack,
+ stack_size_array);
+
+ if (result != 0)
+ return result;
+
+ return result;
+}
+
+TAO_Thread_Pool::TAO_Thread_Pool (TAO_Thread_Pool_Manager &manager,
+ CORBA::ULong id,
+ CORBA::ULong stack_size,
+ CORBA::ULong static_threads,
+ CORBA::ULong dynamic_threads,
+ CORBA::Short default_priority,
+ CORBA::Boolean allow_request_buffering,
+ CORBA::ULong max_buffered_requests,
+ CORBA::ULong max_request_buffer_size,
+ ACE_Time_Value const &dynamic_thread_idle_timeout
+ ACE_ENV_ARG_DECL)
+ : manager_ (manager),
+ id_ (id),
+ stack_size_ (stack_size),
+ allow_borrowing_ (0),
+ allow_request_buffering_ (allow_request_buffering),
+ max_buffered_requests_ (max_buffered_requests),
+ max_request_buffer_size_ (max_request_buffer_size),
+ dynamic_thread_idle_timeout_ (dynamic_thread_idle_timeout),
+ lanes_ (0),
+ number_of_lanes_ (1),
+ with_lanes_ (false)
+{
+ // No support for buffering.
+ if (allow_request_buffering)
+ ACE_THROW (CORBA::NO_IMPLEMENT ());
+
+ // Create one lane.
+ ACE_NEW (this->lanes_,
+ TAO_Thread_Lane *[this->number_of_lanes_]);
+ ACE_NEW (this->lanes_[0],
+ TAO_Thread_Lane (*this,
+ 0,
+ default_priority,
+ static_threads,
+ dynamic_threads,
+ dynamic_thread_idle_timeout
+ ACE_ENV_ARG_PARAMETER));
+}
+
+TAO_Thread_Pool::TAO_Thread_Pool (TAO_Thread_Pool_Manager &manager,
+ CORBA::ULong id,
+ CORBA::ULong stack_size,
+ const RTCORBA::ThreadpoolLanes &lanes,
+ CORBA::Boolean allow_borrowing,
+ CORBA::Boolean allow_request_buffering,
+ CORBA::ULong max_buffered_requests,
+ CORBA::ULong max_request_buffer_size,
+ ACE_Time_Value const &dynamic_thread_idle_timeout
+ ACE_ENV_ARG_DECL)
+ : manager_ (manager),
+ id_ (id),
+ stack_size_ (stack_size),
+ allow_borrowing_ (allow_borrowing),
+ allow_request_buffering_ (allow_request_buffering),
+ max_buffered_requests_ (max_buffered_requests),
+ max_request_buffer_size_ (max_request_buffer_size),
+ dynamic_thread_idle_timeout_ (dynamic_thread_idle_timeout),
+ lanes_ (0),
+ number_of_lanes_ (lanes.length ()),
+ with_lanes_ (true)
+{
+ // No support for buffering or borrowing.
+ if (allow_borrowing ||
+ allow_request_buffering)
+ ACE_THROW (CORBA::NO_IMPLEMENT ());
+
+ // Create multiple lane.
+ ACE_NEW (this->lanes_,
+ TAO_Thread_Lane *[this->number_of_lanes_]);
+ for (CORBA::ULong i = 0;
+ i != this->number_of_lanes_;
+ ++i)
+ ACE_NEW (this->lanes_[i],
+ TAO_Thread_Lane (*this,
+ i,
+ lanes[i].lane_priority,
+ lanes[i].static_threads,
+ lanes[i].dynamic_threads,
+ dynamic_thread_idle_timeout
+ ACE_ENV_ARG_PARAMETER));
+}
+
+void
+TAO_Thread_Pool::open (ACE_ENV_SINGLE_ARG_DECL)
+{
+ // Open all the lanes.
+ for (CORBA::ULong i = 0;
+ i != this->number_of_lanes_;
+ ++i)
+ {
+ this->lanes_[i]->open (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+}
+
+TAO_Thread_Pool::~TAO_Thread_Pool (void)
+{
+ // Delete all the lanes.
+ for (CORBA::ULong i = 0;
+ i != this->number_of_lanes_;
+ ++i)
+ delete this->lanes_[i];
+
+ delete[] this->lanes_;
+}
+
+void
+TAO_Thread_Pool::finalize (void)
+{
+ // Finalize all the lanes.
+ for (CORBA::ULong i = 0;
+ i != this->number_of_lanes_;
+ ++i)
+ this->lanes_[i]->finalize ();
+}
+
+void
+TAO_Thread_Pool::shutdown_reactor (void)
+{
+ // Finalize all the lanes.
+ for (CORBA::ULong i = 0;
+ i != this->number_of_lanes_;
+ ++i)
+ this->lanes_[i]->shutdown_reactor ();
+}
+
+void
+TAO_Thread_Pool::shutting_down (void)
+{
+ // Finalize all the lanes.
+ for (CORBA::ULong i = 0;
+ i != this->number_of_lanes_;
+ ++i)
+ this->lanes_[i]->shutting_down ();
+}
+
+
+void
+TAO_Thread_Pool::wait (void)
+{
+ // Finalize all the lanes.
+ for (CORBA::ULong i = 0;
+ i != this->number_of_lanes_;
+ ++i)
+ this->lanes_[i]->wait ();
+}
+
+int
+TAO_Thread_Pool::is_collocated (const TAO_MProfile &mprofile)
+{
+ // Finalize all the lanes.
+ for (CORBA::ULong i = 0;
+ i != this->number_of_lanes_;
+ ++i)
+ {
+ int result =
+ this->lanes_[i]->is_collocated (mprofile);
+
+ if (result)
+ return result;
+ }
+
+ return 0;
+}
+
+int
+TAO_Thread_Pool::create_static_threads (void)
+{
+ for (CORBA::ULong i = 0;
+ i != this->number_of_lanes_;
+ ++i)
+ {
+ // Ask each lane to create its set of static threads.
+ int result = this->lanes_[i]->create_static_threads ();
+
+ // Return on failure.
+ if (result != 0)
+ return result;
+ }
+
+ // Success.
+ return 0;
+}
+
+#define TAO_THREAD_POOL_MANAGER_GUARD \
+ ACE_GUARD_THROW_EX ( \
+ ACE_SYNCH_MUTEX, \
+ mon, \
+ this->lock_, \
+ CORBA::INTERNAL ( \
+ CORBA::SystemException::_tao_minor_code ( \
+ TAO_GUARD_FAILURE, \
+ 0), \
+ CORBA::COMPLETED_NO));
+
+TAO_Thread_Pool_Manager::TAO_Thread_Pool_Manager (TAO_ORB_Core &orb_core)
+ : orb_core_ (orb_core),
+ thread_pools_ (),
+ thread_pool_id_counter_ (1),
+ lock_ ()
+{
+}
+
+TAO_Thread_Pool_Manager::~TAO_Thread_Pool_Manager (void)
+{
+ // Delete all the pools.
+ for (THREAD_POOLS::ITERATOR iterator = this->thread_pools_.begin ();
+ iterator != this->thread_pools_.end ();
+ ++iterator)
+ delete (*iterator).int_id_;
+}
+
+void
+TAO_Thread_Pool_Manager::finalize (void)
+{
+ // Finalize all the pools.
+ for (THREAD_POOLS::ITERATOR iterator = this->thread_pools_.begin ();
+ iterator != this->thread_pools_.end ();
+ ++iterator)
+ (*iterator).int_id_->finalize ();
+}
+
+void
+TAO_Thread_Pool_Manager::shutdown_reactor (void)
+{
+ // Finalize all the pools.
+ for (THREAD_POOLS::ITERATOR iterator = this->thread_pools_.begin ();
+ iterator != this->thread_pools_.end ();
+ ++iterator)
+ (*iterator).int_id_->shutdown_reactor ();
+}
+
+void
+TAO_Thread_Pool_Manager::wait (void)
+{
+ // Finalize all the pools.
+ for (THREAD_POOLS::ITERATOR iterator = this->thread_pools_.begin ();
+ iterator != this->thread_pools_.end ();
+ ++iterator)
+ (*iterator).int_id_->wait ();
+}
+
+int
+TAO_Thread_Pool_Manager::is_collocated (const TAO_MProfile &mprofile)
+{
+ // Finalize all the pools.
+ for (THREAD_POOLS::ITERATOR iterator = this->thread_pools_.begin ();
+ iterator != this->thread_pools_.end ();
+ ++iterator)
+ {
+ int result =
+ (*iterator).int_id_->is_collocated (mprofile);
+
+ if (result)
+ return result;
+ }
+
+ return 0;
+}
+
+RTCORBA::ThreadpoolId
+TAO_Thread_Pool_Manager::create_threadpool (CORBA::ULong stacksize,
+ CORBA::ULong static_threads,
+ CORBA::ULong dynamic_threads,
+ RTCORBA::Priority default_priority,
+ CORBA::Boolean allow_request_buffering,
+ CORBA::ULong max_buffered_requests,
+ CORBA::ULong max_request_buffer_size,
+ ACE_Time_Value const &dynamic_thread_idle_timeout
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ TAO_THREAD_POOL_MANAGER_GUARD;
+ ACE_CHECK_RETURN (0);
+
+ return this->create_threadpool_i (stacksize,
+ static_threads,
+ dynamic_threads,
+ default_priority,
+ allow_request_buffering,
+ max_buffered_requests,
+ max_request_buffer_size,
+ dynamic_thread_idle_timeout
+ ACE_ENV_ARG_PARAMETER);
+}
+
+RTCORBA::ThreadpoolId
+TAO_Thread_Pool_Manager::create_threadpool_with_lanes (CORBA::ULong stacksize,
+ const RTCORBA::ThreadpoolLanes & lanes,
+ CORBA::Boolean allow_borrowing,
+ CORBA::Boolean allow_request_buffering,
+ CORBA::ULong max_buffered_requests,
+ CORBA::ULong max_request_buffer_size,
+ ACE_Time_Value const &dynamic_thread_idle_timeout
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ TAO_THREAD_POOL_MANAGER_GUARD;
+ ACE_CHECK_RETURN (0);
+
+ return this->create_threadpool_with_lanes_i (stacksize,
+ lanes,
+ allow_borrowing,
+ allow_request_buffering,
+ max_buffered_requests,
+ max_request_buffer_size,
+ dynamic_thread_idle_timeout
+ ACE_ENV_ARG_PARAMETER);
+}
+
+void
+TAO_Thread_Pool_Manager::destroy_threadpool (RTCORBA::ThreadpoolId threadpool
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ RTCORBA::RTORB::InvalidThreadpool))
+{
+ TAO_Thread_Pool *tao_thread_pool = 0;
+
+ // The guard is just for the map, don't do a wait inside the guard, because
+ // during the wait other threads can try to access the thread pool manager
+ // also, this can be one of the threads we are waiting for, which then
+ // results in a deadlock
+ {
+ TAO_THREAD_POOL_MANAGER_GUARD;
+ ACE_CHECK;
+
+ // Unbind the thread pool from the map.
+ int result =
+ this->thread_pools_.unbind (threadpool,
+ tao_thread_pool);
+
+ // If the thread pool is not found in our map.
+ if (result != 0)
+ ACE_THROW (RTCORBA::RTORB::InvalidThreadpool ());
+ }
+
+ // Mark the thread pool that we are shutting down.
+ tao_thread_pool->shutting_down ();
+
+ // Shutdown reactor.
+ tao_thread_pool->shutdown_reactor ();
+
+ // Wait for the threads.
+ tao_thread_pool->wait ();
+
+ // Finalize resources.
+ tao_thread_pool->finalize ();
+
+ // Delete the thread pool.
+ delete tao_thread_pool;
+
+}
+
+RTCORBA::ThreadpoolId
+TAO_Thread_Pool_Manager::create_threadpool_i (CORBA::ULong stacksize,
+ CORBA::ULong static_threads,
+ CORBA::ULong dynamic_threads,
+ RTCORBA::Priority default_priority,
+ CORBA::Boolean allow_request_buffering,
+ CORBA::ULong max_buffered_requests,
+ CORBA::ULong max_request_buffer_size,
+ ACE_Time_Value const &dynamic_thread_idle_timeout
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ // Create the thread pool.
+ TAO_Thread_Pool *thread_pool = 0;
+
+ ACE_NEW_THROW_EX (thread_pool,
+ TAO_Thread_Pool (*this,
+ this->thread_pool_id_counter_,
+ stacksize,
+ static_threads,
+ dynamic_threads,
+ default_priority,
+ allow_request_buffering,
+ max_buffered_requests,
+ max_request_buffer_size,
+ dynamic_thread_idle_timeout
+ ACE_ENV_ARG_PARAMETER),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (0);
+
+ return this->create_threadpool_helper (thread_pool
+ ACE_ENV_ARG_PARAMETER);
+}
+
+RTCORBA::ThreadpoolId
+TAO_Thread_Pool_Manager::create_threadpool_with_lanes_i (CORBA::ULong stacksize,
+ const RTCORBA::ThreadpoolLanes &lanes,
+ CORBA::Boolean allow_borrowing,
+ CORBA::Boolean allow_request_buffering,
+ CORBA::ULong max_buffered_requests,
+ CORBA::ULong max_request_buffer_size,
+ ACE_Time_Value const &dynamic_thread_idle_timeout
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ // Create the thread pool.
+ TAO_Thread_Pool *thread_pool = 0;
+
+ ACE_NEW_THROW_EX (thread_pool,
+ TAO_Thread_Pool (*this,
+ this->thread_pool_id_counter_,
+ stacksize,
+ lanes,
+ allow_borrowing,
+ allow_request_buffering,
+ max_buffered_requests,
+ max_request_buffer_size,
+ dynamic_thread_idle_timeout
+ ACE_ENV_ARG_PARAMETER),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (0);
+
+ return this->create_threadpool_helper (thread_pool
+ ACE_ENV_ARG_PARAMETER);
+}
+
+RTCORBA::ThreadpoolId
+TAO_Thread_Pool_Manager::create_threadpool_helper (TAO_Thread_Pool *thread_pool
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ // Make sure of safe deletion in case of errors.
+ auto_ptr<TAO_Thread_Pool> safe_thread_pool (thread_pool);
+
+ // Open the pool.
+ thread_pool->open (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ // Create the static threads.
+ int result =
+ thread_pool->create_static_threads ();
+
+ // Throw exception in case of errors.
+ if (result != 0)
+ {
+ // Finalize thread pool related resources.
+ thread_pool->finalize ();
+
+ ACE_THROW_RETURN (
+ CORBA::INTERNAL (
+ CORBA::SystemException::_tao_minor_code (
+ TAO_RTCORBA_THREAD_CREATION_LOCATION_CODE,
+ errno),
+ CORBA::COMPLETED_NO),
+ result);
+ }
+
+ // Bind thread to internal table.
+ result =
+ this->thread_pools_.bind (this->thread_pool_id_counter_,
+ thread_pool);
+
+ // Throw exceptin in case of errors.
+ if (result != 0)
+ ACE_THROW_RETURN (CORBA::INTERNAL (),
+ result);
+
+ //
+ // Success.
+ //
+
+ // No need to delete thread pool.
+ safe_thread_pool.release ();
+
+ // Return current counter and perform post-increment.
+ return this->thread_pool_id_counter_++;
+}
+
+TAO_Thread_Pool *
+TAO_Thread_Pool_Manager::get_threadpool (RTCORBA::ThreadpoolId thread_pool_id ACE_ENV_ARG_DECL)
+{
+ TAO_THREAD_POOL_MANAGER_GUARD;
+ ACE_CHECK_RETURN (0);
+
+ TAO_Thread_Pool *thread_pool = 0;
+ int result =
+ thread_pools_.find (thread_pool_id,
+ thread_pool);
+
+ ACE_UNUSED_ARG (result);
+
+ return thread_pool;
+}
+
+TAO_ORB_Core &
+TAO_Thread_Pool_Manager::orb_core (void) const
+{
+ return this->orb_core_;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
diff --git a/TAO/tao/RTCORBA/Thread_Pool.h b/TAO/tao/RTCORBA/Thread_Pool.h
new file mode 100644
index 00000000000..cd0047741e9
--- /dev/null
+++ b/TAO/tao/RTCORBA/Thread_Pool.h
@@ -0,0 +1,477 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Thread_Pool.h
+ *
+ * $Id$
+ *
+ * @author Irfan Pyarali
+ * @author Johnny Willemsen
+ */
+// ===================================================================
+
+#ifndef TAO_THREAD_POOL_H
+#define TAO_THREAD_POOL_H
+
+#include /**/ "ace/pre.h"
+#include "tao/orbconf.h"
+
+#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#define TAO_RTCORBA_SAFE_INCLUDE
+#include "tao/RTCORBA/RTCORBAC.h"
+#undef TAO_RTCORBA_SAFE_INCLUDE
+
+#include "ace/Hash_Map_Manager.h"
+#include "tao/Thread_Lane_Resources.h"
+#include "tao/New_Leader_Generator.h"
+#include "ace/Task.h"
+#include "ace/Null_Mutex.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Thread_Lane;
+
+/**
+ * @class TAO_RT_New_Leader_Generator
+ *
+ * @brief Class for creating dynamic threads.
+ *
+ * \nosubgrouping
+ *
+ **/
+class TAO_RTCORBA_Export TAO_RT_New_Leader_Generator
+ : public TAO_New_Leader_Generator
+{
+public:
+
+ /// Constructor.
+ TAO_RT_New_Leader_Generator (TAO_Thread_Lane &lane);
+
+ /// Leader/Follower class uses this method to notify the system that
+ /// we are out of leaders.
+ void no_leaders_available (void);
+
+private:
+
+ /// Lane associated with this leader generator.
+ TAO_Thread_Lane &lane_;
+};
+
+/**
+ * @class TAO_Thread_Pool_Threads
+ *
+ * @brief Class representing a static thread running in a thread lane.
+ *
+ * \nosubgrouping
+ *
+ **/
+class TAO_Thread_Pool_Threads : public ACE_Task_Base
+{
+public:
+
+ /// Constructor.
+ TAO_Thread_Pool_Threads (TAO_Thread_Lane &lane);
+
+ /// Method executed when a thread is spawned.
+ int svc (void);
+
+ /// Accessor to the lane to which this thread belongs to.
+ TAO_Thread_Lane &lane (void) const;
+
+ /// Set TSS resources for the current thread.
+ static void set_tss_resources (TAO_ORB_Core &orb_core,
+ TAO_Thread_Lane &thread_lane);
+
+protected:
+ /// Do the real work
+ virtual int run (TAO_ORB_Core &orb_core ACE_ENV_ARG_PARAMETER);
+
+ /// Lane to which this thread belongs to.
+ TAO_Thread_Lane &lane_;
+};
+
+/**
+ * @class TAO_Dynamic_Thread_Pool_Threads
+ *
+ * @brief Class representing a dynamic thread running in a thread lane.
+ *
+ * \nosubgrouping
+ *
+ **/
+class TAO_Dynamic_Thread_Pool_Threads : public TAO_Thread_Pool_Threads
+{
+public:
+ /// Constructor.
+ TAO_Dynamic_Thread_Pool_Threads (TAO_Thread_Lane &lane);
+
+protected:
+ /// Do the real work
+ virtual int run (TAO_ORB_Core &orb_core ACE_ENV_ARG_PARAMETER);
+};
+
+class TAO_Thread_Pool;
+
+/**
+ * @class TAO_Thread_Lane
+ *
+ * @brief Class representing the thread lane inside a thread pool.
+ *
+ * \nosubgrouping
+ *
+ **/
+class TAO_RTCORBA_Export TAO_Thread_Lane
+{
+public:
+
+ /// Constructor.
+ TAO_Thread_Lane (TAO_Thread_Pool &pool,
+ CORBA::ULong id,
+ CORBA::Short lane_priority,
+ CORBA::ULong static_threads,
+ CORBA::ULong dynamic_threads,
+ ACE_Time_Value const &dynamic_thread_idle_timeout
+ ACE_ENV_ARG_DECL);
+
+ /// Destructor.
+ ~TAO_Thread_Lane (void);
+
+ /// Open the lane.
+ void open (ACE_ENV_SINGLE_ARG_DECL);
+
+ /// Finalize the resources.
+ void finalize (void);
+
+ /// Shutdown the reactor.
+ void shutdown_reactor (void);
+
+ /// Wait for threads to exit.
+ void wait (void);
+
+ /// Does @a mprofile belong to us?
+ int is_collocated (const TAO_MProfile &mprofile);
+
+ /// Create the static threads - only called once.
+ int create_static_threads (void);
+
+ /// Mark that this lane is shutting down, we then don't create any
+ /// dynamic threads anymore. When the pool is shutting down the leader
+ /// follower loop is called which can cause a request to create a
+ /// new dynamic thread but we shouldn't create a new one.
+ void shutting_down (void);
+
+ /// Called by the TAO_RT_New_Leader_Generator to request a new dynamic
+ /// thread.
+ /**
+ * It can be that no thread can be created because the number of
+ * threads is equal to the maximum we can have or the Thread Lane
+ * is shutting down.
+ * @retval true A new thread is created
+ * @retval false No thread could be created
+ */
+ bool new_dynamic_thread (void);
+
+ /// @name Accessors
+ // @{
+
+ TAO_Thread_Pool &pool (void) const;
+ CORBA::ULong id (void) const;
+
+ CORBA::Short lane_priority (void) const;
+ CORBA::ULong static_threads (void) const;
+ CORBA::ULong dynamic_threads (void) const;
+
+ CORBA::ULong current_threads (void) const;
+
+ CORBA::Short native_priority (void) const;
+
+ TAO_Thread_Lane_Resources &resources (void);
+
+ ACE_Time_Value const &dynamic_thread_idle_timeout (void) const;
+ // @}
+
+private:
+
+ /// Validate lane's priority and map it to a native value.
+ void validate_and_map_priority (ACE_ENV_SINGLE_ARG_DECL);
+
+ int create_threads_i (TAO_Thread_Pool_Threads &thread_pool,
+ CORBA::ULong number_of_threads,
+ long thread_flags);
+
+ /// Create @a number_of_threads of dynamic threads. Can be called
+ /// multiple times.
+ int create_dynamic_threads (CORBA::ULong number_of_threads);
+
+ /// The Thread Pool to which this lane belongs.
+ TAO_Thread_Pool &pool_;
+
+ /// The id of this lane
+ CORBA::ULong const id_;
+
+ CORBA::Short lane_priority_;
+
+ /// This boolean is set when we are shutting down, then we will not create
+ /// any new dynamic threads
+ bool shutdown_;
+
+ /// Number of static threads
+ CORBA::ULong const static_threads_number_;
+
+ /// Maximum number of threads we are allowed to create
+ CORBA::ULong const dynamic_threads_number_;
+
+ /// Array with all static threads
+ TAO_Thread_Pool_Threads static_threads_;
+
+ /// Array with all dynamic threads
+ TAO_Dynamic_Thread_Pool_Threads dynamic_threads_;
+
+ TAO_RT_New_Leader_Generator new_thread_generator_;
+
+ TAO_Thread_Lane_Resources resources_;
+
+ CORBA::Short native_priority_;
+
+ ACE_Time_Value const dynamic_thread_idle_timeout_;
+
+ /// Lock to guard all members of the lane
+ mutable ACE_SYNCH_MUTEX lock_;
+};
+
+class TAO_Thread_Pool_Manager;
+
+/**
+ * @class TAO_Thread_Pool
+ *
+ * @brief Class representing the thread pool inside a thread pool
+ * manager.
+ *
+ * \nosubgrouping
+ *
+ **/
+class TAO_RTCORBA_Export TAO_Thread_Pool
+{
+public:
+
+ /// Constructor (for pools without lanes).
+ TAO_Thread_Pool (TAO_Thread_Pool_Manager &manager,
+ CORBA::ULong id,
+ CORBA::ULong stack_size,
+ CORBA::ULong static_threads,
+ CORBA::ULong dynamic_threads,
+ CORBA::Short default_priority,
+ CORBA::Boolean allow_request_buffering,
+ CORBA::ULong max_buffered_requests,
+ CORBA::ULong max_request_buffer_size,
+ ACE_Time_Value const &dynamic_thread_idle_timeout
+ ACE_ENV_ARG_DECL);
+
+ /// Constructor (for pools with lanes).
+ TAO_Thread_Pool (TAO_Thread_Pool_Manager &manager,
+ CORBA::ULong id,
+ CORBA::ULong stack_size,
+ const RTCORBA::ThreadpoolLanes &lanes,
+ CORBA::Boolean allow_borrowing,
+ CORBA::Boolean allow_request_buffering,
+ CORBA::ULong max_buffered_requests,
+ CORBA::ULong max_request_buffer_size,
+ ACE_Time_Value const &dynamic_thread_idle_timeout
+ ACE_ENV_ARG_DECL);
+
+ /// Destructor.
+ ~TAO_Thread_Pool (void);
+
+ /// Open the pool.
+ void open (ACE_ENV_SINGLE_ARG_DECL);
+
+ /// Finalize the resources.
+ void finalize (void);
+
+ /// Shutdown the reactor.
+ void shutdown_reactor (void);
+
+ /// Wait for threads to exit.
+ void wait (void);
+
+ /// Mark this thread pool that we are shutting down.
+ void shutting_down (void);
+
+ /// Does @a mprofile belong to us?
+ int is_collocated (const TAO_MProfile &mprofile);
+
+ /// Create the static threads - only called once.
+ int create_static_threads (void);
+
+ /// Check if this thread pool has (explicit) lanes.
+ bool with_lanes (void) const;
+
+ /// @name Accessors
+ // @{
+
+ TAO_Thread_Pool_Manager &manager (void) const;
+ CORBA::ULong id (void) const;
+
+ CORBA::ULong stack_size (void) const;
+ CORBA::Boolean allow_borrowing (void) const;
+ CORBA::Boolean allow_request_buffering (void) const;
+ CORBA::ULong max_buffered_requests (void) const;
+ CORBA::ULong max_request_buffer_size (void) const;
+
+ TAO_Thread_Lane **lanes (void);
+ CORBA::ULong number_of_lanes (void) const;
+
+ // @}
+
+private:
+
+ TAO_Thread_Pool_Manager &manager_;
+ CORBA::ULong id_;
+
+ CORBA::ULong stack_size_;
+ CORBA::Boolean allow_borrowing_;
+ CORBA::Boolean allow_request_buffering_;
+ CORBA::ULong max_buffered_requests_;
+ CORBA::ULong max_request_buffer_size_;
+ ACE_Time_Value const dynamic_thread_idle_timeout_;
+
+ TAO_Thread_Lane **lanes_;
+ CORBA::ULong number_of_lanes_;
+ bool with_lanes_;
+};
+
+class TAO_ORB_Core;
+
+/**
+ * @class TAO_Thread_Pool_Manager
+ *
+ * @brief Class for managing thread pools.
+ *
+ * \nosubgrouping
+ *
+ **/
+class TAO_RTCORBA_Export TAO_Thread_Pool_Manager
+{
+public:
+
+ /// Constructor.
+ TAO_Thread_Pool_Manager (TAO_ORB_Core &orb_core);
+
+ /// Destructor.
+ ~TAO_Thread_Pool_Manager (void);
+
+ /// Finalize the resources.
+ void finalize (void);
+
+ /// Shutdown the reactor.
+ void shutdown_reactor (void);
+
+ /// Wait for threads to exit.
+ void wait (void);
+
+ /// Does @a mprofile belong to us?
+ int is_collocated (const TAO_MProfile &mprofile);
+
+ /// Create a threadpool without lanes.
+ RTCORBA::ThreadpoolId
+ create_threadpool (CORBA::ULong stacksize,
+ CORBA::ULong static_threads,
+ CORBA::ULong dynamic_threads,
+ RTCORBA::Priority default_priority,
+ CORBA::Boolean allow_request_buffering,
+ CORBA::ULong max_buffered_requests,
+ CORBA::ULong max_request_buffer_size,
+ ACE_Time_Value const &dynamic_thread_idle_timeout
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Create a threadpool with lanes.
+ RTCORBA::ThreadpoolId
+ create_threadpool_with_lanes (CORBA::ULong stacksize,
+ const RTCORBA::ThreadpoolLanes & lanes,
+ CORBA::Boolean allow_borrowing,
+ CORBA::Boolean allow_request_buffering,
+ CORBA::ULong max_buffered_requests,
+ CORBA::ULong max_request_buffer_size,
+ ACE_Time_Value const &dynamic_thread_idle_timeout
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Destroy a threadpool.
+ void destroy_threadpool (RTCORBA::ThreadpoolId threadpool
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ RTCORBA::RTORB::InvalidThreadpool));
+
+ TAO_Thread_Pool *get_threadpool (RTCORBA::ThreadpoolId thread_pool_id ACE_ENV_ARG_DECL);
+
+ /// Collection of thread pools.
+ typedef ACE_Hash_Map_Manager<RTCORBA::ThreadpoolId, TAO_Thread_Pool *, ACE_Null_Mutex> THREAD_POOLS;
+
+ /// @name Accessors
+ // @{
+
+ TAO_ORB_Core &orb_core (void) const;
+
+ // @}
+
+private:
+
+ /// @name Helpers
+ // @{
+
+ RTCORBA::ThreadpoolId
+ create_threadpool_i (CORBA::ULong stacksize,
+ CORBA::ULong static_threads,
+ CORBA::ULong dynamic_threads,
+ RTCORBA::Priority default_priority,
+ CORBA::Boolean allow_request_buffering,
+ CORBA::ULong max_buffered_requests,
+ CORBA::ULong max_request_buffer_size,
+ ACE_Time_Value const &dynamic_thread_idle_timeout
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ RTCORBA::ThreadpoolId
+ create_threadpool_with_lanes_i (CORBA::ULong stacksize,
+ const RTCORBA::ThreadpoolLanes & lanes,
+ CORBA::Boolean allow_borrowing,
+ CORBA::Boolean allow_request_buffering,
+ CORBA::ULong max_buffered_requests,
+ CORBA::ULong max_request_buffer_size,
+ ACE_Time_Value const &dynamic_thread_idle_timeout
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ RTCORBA::ThreadpoolId
+ create_threadpool_helper (TAO_Thread_Pool *thread_pool
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ // @}
+
+private:
+
+ TAO_ORB_Core &orb_core_;
+
+ THREAD_POOLS thread_pools_;
+ RTCORBA::ThreadpoolId thread_pool_id_counter_;
+ ACE_SYNCH_MUTEX lock_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+#include "tao/RTCORBA/Thread_Pool.inl"
+#endif /* __ACE_INLINE__ */
+
+#endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_THREAD_POOL_H */
diff --git a/TAO/tao/RTCORBA/Thread_Pool.inl b/TAO/tao/RTCORBA/Thread_Pool.inl
new file mode 100644
index 00000000000..4dd08236764
--- /dev/null
+++ b/TAO/tao/RTCORBA/Thread_Pool.inl
@@ -0,0 +1,140 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO_Thread_Lane &
+TAO_Thread_Pool_Threads::lane (void) const
+{
+ return this->lane_;
+}
+
+ACE_INLINE
+CORBA::ULong
+TAO_Thread_Lane::id (void) const
+{
+ return this->id_;
+}
+
+ACE_INLINE
+TAO_Thread_Pool &
+TAO_Thread_Lane::pool (void) const
+{
+ return this->pool_;
+}
+
+ACE_INLINE
+CORBA::Short
+TAO_Thread_Lane::lane_priority (void) const
+{
+ return this->lane_priority_;
+}
+
+ACE_INLINE
+CORBA::Short
+TAO_Thread_Lane::native_priority (void) const
+{
+ return this->native_priority_;
+}
+
+ACE_INLINE
+CORBA::ULong
+TAO_Thread_Lane::static_threads (void) const
+{
+ return this->static_threads_number_;
+}
+
+ACE_INLINE
+CORBA::ULong
+TAO_Thread_Lane::dynamic_threads (void) const
+{
+ return this->dynamic_threads_number_;
+}
+
+ACE_INLINE
+TAO_Thread_Lane_Resources &
+TAO_Thread_Lane::resources (void)
+{
+ return this->resources_;
+}
+
+ACE_INLINE
+ACE_Time_Value const &
+TAO_Thread_Lane::dynamic_thread_idle_timeout (void) const
+{
+ return this->dynamic_thread_idle_timeout_;
+}
+
+ACE_INLINE
+bool
+TAO_Thread_Pool::with_lanes (void) const
+{
+ return this->with_lanes_;
+}
+
+ACE_INLINE
+TAO_Thread_Pool_Manager &
+TAO_Thread_Pool::manager (void) const
+{
+ return this->manager_;
+}
+
+ACE_INLINE
+CORBA::ULong
+TAO_Thread_Pool::id (void) const
+{
+ return this->id_;
+}
+
+ACE_INLINE
+CORBA::ULong
+TAO_Thread_Pool::stack_size (void) const
+{
+ return this->stack_size_;
+}
+
+ACE_INLINE
+CORBA::Boolean
+TAO_Thread_Pool::allow_borrowing (void) const
+{
+ return this->allow_borrowing_;
+}
+
+ACE_INLINE
+CORBA::Boolean
+TAO_Thread_Pool::allow_request_buffering (void) const
+{
+ return this->allow_request_buffering_;
+}
+
+ACE_INLINE
+CORBA::ULong
+TAO_Thread_Pool::max_buffered_requests (void) const
+{
+ return this->max_buffered_requests_;
+}
+
+ACE_INLINE
+CORBA::ULong
+TAO_Thread_Pool::max_request_buffer_size (void) const
+{
+ return this->max_request_buffer_size_;
+}
+
+ACE_INLINE
+TAO_Thread_Lane **
+TAO_Thread_Pool::lanes (void)
+{
+ return this->lanes_;
+}
+
+ACE_INLINE
+CORBA::ULong
+TAO_Thread_Pool::number_of_lanes (void) const
+{
+ return this->number_of_lanes_;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/RTCORBA/diffs/RTCORBA.diff b/TAO/tao/RTCORBA/diffs/RTCORBA.diff
new file mode 100644
index 00000000000..6d460573026
--- /dev/null
+++ b/TAO/tao/RTCORBA/diffs/RTCORBA.diff
@@ -0,0 +1,76 @@
+--- orig/RTCORBAC.h 2005-03-25 19:39:53.847483200 +0100
++++ RTCORBAC.h 2005-03-25 19:41:00.863848000 +0100
+@@ -36,12 +36,18 @@
+
+ #include "ace/config-all.h"
+
++#ifndef TAO_RTCORBA_SAFE_INCLUDE
++#error "You should not include RTCORBAC.h directly, use RTCORBA.h"
++#endif /* !TAO_RTCORBA_SAFE_INCLUDE */
++
+ #if !defined (ACE_LACKS_PRAGMA_ONCE)
+ # pragma once
+ #endif /* ACE_LACKS_PRAGMA_ONCE */
+
+ #include "rtcorba_export.h"
++#include "rtcorba_typedefs.h"
+ #include "tao/ORB.h"
++#include "tao/TimeBaseC.h"
+ #include "tao/SystemException.h"
+ #include "tao/Environment.h"
+ #include "tao/Object.h"
+@@ -576,6 +585,9 @@
+ virtual const char* _interface_repository_id (void) const;
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+
++ // CDR Encoder/Decoder methods. (handcrafted)
++ virtual CORBA::Boolean _tao_encode (TAO_OutputCDR &out_cdr);
++ virtual CORBA::Boolean _tao_decode (TAO_InputCDR &in_cdr);
+ protected:
+ // Abstract or local interface only.
+ ProtocolProperties (void);
+--- orig/RTCORBAC.cpp 2005-03-25 19:39:53.847483200 +0100
++++ RTCORBAC.cpp 2005-03-25 19:39:54.318160000 +0100
+@@ -29,7 +29,7 @@
+ // be\be_codegen.cpp:302
+
+
+-#include "RTCORBAC.h"
++#include "RTCORBA.h"
+ #include "tao/CDR.h"
+ #include "tao/Null_RefCount_Policy.h"
+ #include "tao/TypeCode_Constants.h"
+@@ -61,6 +61,22 @@
+ {
+ }
+
++//////////////////////////////////////////////////////
++// CDR Encoding Support hand crafted
++
++CORBA::Boolean
++RTCORBA::ProtocolProperties::_tao_encode (TAO_OutputCDR &)
++{
++ return 1;
++}
++// TAO_IDL - Generated from
++// be/be_visitor_arg_traits.cpp:60
++
++CORBA::Boolean
++RTCORBA::ProtocolProperties::_tao_decode (TAO_InputCDR &)
++{
++ return 1;
++}
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_structure/structure_cs.cpp:68
+--- orig/RTCORBAA.cpp 2005-03-25 19:39:53.857497600 +0100
++++ RTCORBAA.cpp 2005-03-25 19:40:06.796102400 +0100
+@@ -25,7 +25,7 @@
+ // Information about TAO is available at:
+ // http://www.cs.wustl.edu/~schmidt/TAO.html
+
+-#include "RTCORBAC.h"
++#include "RTCORBA.h"
+ #include "tao/Null_RefCount_Policy.h"
+ #include "tao/TypeCode_Constants.h"
+ #include "tao/Alias_TypeCode.h"
diff --git a/TAO/tao/RTCORBA/rtcorba_export.h b/TAO/tao/RTCORBA/rtcorba_export.h
new file mode 100644
index 00000000000..e712f3013ce
--- /dev/null
+++ b/TAO/tao/RTCORBA/rtcorba_export.h
@@ -0,0 +1,40 @@
+
+// -*- C++ -*-
+// $Id$
+// Definition for Win32 Export directives.
+// This file is generated automatically by generate_export_file.pl
+// ------------------------------
+#ifndef TAO_RTCORBA_EXPORT_H
+#define TAO_RTCORBA_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if defined (TAO_AS_STATIC_LIBS)
+# if !defined (TAO_RTCORBA_HAS_DLL)
+# define TAO_RTCORBA_HAS_DLL 0
+# endif /* ! TAO_RTCORBA_HAS_DLL */
+#else
+# if !defined (TAO_RTCORBA_HAS_DLL)
+# define TAO_RTCORBA_HAS_DLL 1
+# endif /* ! TAO_RTCORBA_HAS_DLL */
+#endif
+
+#if defined (TAO_RTCORBA_HAS_DLL) && (TAO_RTCORBA_HAS_DLL == 1)
+# if defined (TAO_RTCORBA_BUILD_DLL)
+# define TAO_RTCORBA_Export ACE_Proper_Export_Flag
+# define TAO_RTCORBA_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# define TAO_RTCORBA_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# else /* TAO_RTCORBA_BUILD_DLL */
+# define TAO_RTCORBA_Export ACE_Proper_Import_Flag
+# define TAO_RTCORBA_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# define TAO_RTCORBA_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# endif /* TAO_RTCORBA_BUILD_DLL */
+#else /* TAO_RTCORBA_HAS_DLL == 1 */
+# define TAO_RTCORBA_Export
+# define TAO_RTCORBA_SINGLETON_DECLARATION(T)
+# define TAO_RTCORBA_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+#endif /* TAO_RTCORBA_HAS_DLL == 1 */
+
+#endif /* TAO_RTCORBA_EXPORT_H */
+
+// End of auto generated file.
diff --git a/TAO/tao/RTCORBA/rtcorba_typedefs.h b/TAO/tao/RTCORBA/rtcorba_typedefs.h
new file mode 100644
index 00000000000..513e1a4169d
--- /dev/null
+++ b/TAO/tao/RTCORBA/rtcorba_typedefs.h
@@ -0,0 +1,62 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file rtcorba_typedefs.h
+ *
+ * $Id$
+ *
+ * TAO specific typedef's moved away from the generated code.
+ *
+ * @author Balachandran Natarajan <bala@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_RTCORBA_TYPEDEFS_H
+#define TAO_RTCORBA_TYPEDEFS_H
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Basic_Types.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Forward references.
+class TAO_Priority_Mapping_Manager;
+class TAO_Priority_Mapping_Manager_var;
+class TAO_Priority_Mapping_Manager_out;
+class TAO_Priority_Mapping;
+class TAO_Network_Priority_Mapping_Manager;
+class TAO_Network_Priority_Mapping_Manager_var;
+class TAO_Network_Priority_Mapping_Manager_out;
+class TAO_Network_Priority_Mapping;
+
+namespace RTCORBA
+{
+ // TAO-specific typedefs
+ typedef TAO_Priority_Mapping_Manager PriorityMappingManager;
+ typedef TAO_Priority_Mapping_Manager *PriorityMappingManager_ptr;
+ typedef TAO_Priority_Mapping_Manager_var PriorityMappingManager_var;
+ typedef TAO_Priority_Mapping_Manager_out PriorityMappingManager_out;
+
+ typedef TAO_Network_Priority_Mapping_Manager NetworkPriorityMappingManager;
+ typedef TAO_Network_Priority_Mapping_Manager *NetworkPriorityMappingManager_ptr;
+ typedef TAO_Network_Priority_Mapping_Manager_var NetworkPriorityMappingManager_var;
+ typedef TAO_Network_Priority_Mapping_Manager_out NetworkPriorityMappingManager_out;
+
+ typedef CORBA::Long NetworkPriority;
+
+ typedef TAO_Priority_Mapping PriorityMapping;
+ typedef TAO_Network_Priority_Mapping NetworkPriorityMapping;
+ // End TAO-specific typedef
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /*TAO_RTCORBA_TYPEDEFS_H*/
diff --git a/TAO/tao/RTPortableServer.mpc b/TAO/tao/RTPortableServer.mpc
new file mode 100644
index 00000000000..79c6cf8cc12
--- /dev/null
+++ b/TAO/tao/RTPortableServer.mpc
@@ -0,0 +1,43 @@
+//$Id$
+project : taolib, core, rtcorba, portableserver {
+ sharedname = TAO_RTPortableServer
+ dynamicflags = TAO_RTPORTABLESERVER_BUILD_DLL
+
+ Source_Files {
+ RTPortableServer
+ }
+
+ Header_Files {
+ RTPortableServer
+ }
+
+ Inline_Files {
+ RTPortableServer
+ }
+
+ Template_Files {
+ RTPortableServer
+ }
+
+ Resource_Files {
+ RTPortableServer
+ }
+
+ PIDL_Files {
+ RTPortableServer
+ }
+
+ IDL_Files {
+ idlflags += -Gp -Gd -Ge 1 -Sci -SS -Sorb \
+ -Wb,export_macro=TAO_RTPortableServer_Export \
+ -Wb,export_include=tao/RTPortableServer/rtportableserver_export.h \
+ -Wb,include_guard=TAO_RT_PORTABLESERVER_SAFE_INCLUDE \
+ -Wb,safe_include=tao/RTPortableServer/RTPortableServer.h \
+ -o RTPortableServer
+ RTPortableServer/RTPortableServer.pidl
+ }
+
+ Pkgconfig_Files {
+ RTPortableServer/TAO_RTPortableServer.pc.in
+ }
+}
diff --git a/TAO/tao/RTPortableServer/RTPortableServer.cpp b/TAO/tao/RTPortableServer/RTPortableServer.cpp
new file mode 100644
index 00000000000..bb1ea26cbdb
--- /dev/null
+++ b/TAO/tao/RTPortableServer/RTPortableServer.cpp
@@ -0,0 +1,32 @@
+// $Id$
+// =================================================================
+//
+// = LIBRARY
+// TAO
+//
+// = FILENAME
+// RTPortableServer.cpp
+//
+// = AUTHOR
+// Frank Hunleth <fhunleth@cs.wustl.edu>
+//
+// =================================================================
+
+#include "tao/RTPortableServer/RTPortableServer.h"
+#include "tao/RTPortableServer/RT_Object_Adapter_Factory.h"
+
+#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
+
+ACE_RCSID (RTPortableServer,
+ RTPortableServer,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_RTPortableServer_Initializer::TAO_RTPortableServer_Initializer (void)
+{
+ ACE_Service_Config::process_directive (ace_svc_desc_TAO_RT_Object_Adapter_Factory);
+}
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
diff --git a/TAO/tao/RTPortableServer/RTPortableServer.h b/TAO/tao/RTPortableServer/RTPortableServer.h
new file mode 100644
index 00000000000..82e605cccba
--- /dev/null
+++ b/TAO/tao/RTPortableServer/RTPortableServer.h
@@ -0,0 +1,50 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file RTPortableServer.h
+ *
+ * $Id$
+ *
+ * @author Frank Hunleth <fhuntleth@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_RT_PORTABLESERVER_H
+#define TAO_RT_PORTABLESERVER_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/RTPortableServer/rtportableserver_export.h"
+#include "tao/orbconf.h"
+
+#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/RTCORBA/RTCORBA.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_RTPortableServer_Export TAO_RTPortableServer_Initializer
+{
+public:
+ /// Constructor.
+ TAO_RTPortableServer_Initializer (void);
+};
+
+static TAO_RTPortableServer_Initializer TAO_RTPortableServer_initializer;
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#define TAO_RT_PORTABLESERVER_SAFE_INCLUDE
+#include "tao/RTPortableServer/RTPortableServerC.h"
+#undef TAO_RT_PORTABLESERVER_SAFE_INCLUDE
+
+#endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_RT_PORTABLESERVER_H */
diff --git a/TAO/tao/RTPortableServer/RTPortableServer.pidl b/TAO/tao/RTPortableServer/RTPortableServer.pidl
new file mode 100644
index 00000000000..24d24cd5302
--- /dev/null
+++ b/TAO/tao/RTPortableServer/RTPortableServer.pidl
@@ -0,0 +1,57 @@
+/**
+ * @file RTPortableServer.pidl
+ *
+ * $Id$
+ *
+ * @brief Pre-compiled IDL source for the RTPortableServer module.
+ *
+ * This file was used to generate the code in RTPortableServerC.{h,cpp}
+ * The steps to regenerate the code are as follows:
+ *
+ * 1. Run the tao_idl compiler on the pidl file. The command used for
+ * this is:
+ *
+ * tao_idl
+ * -o orig -Ge 1 -GA -Sci
+ * -Wb,export_macro=TAO_RTPortableServer_Export
+ * -Wb,export_include="rtportableserver_export.h"
+ * -Wb,pre_include="ace/pre.h"
+ * -Wb,post_include="ace/post.h"
+ * RTPortableServer.pidl
+ *
+ * 2. The generated files are ready to use
+ */
+
+#ifndef _RT_PORTABLE_SERVER_IDL_
+#define _RT_PORTABLE_SERVER_IDL_
+
+#include "tao/PortableServer/PortableServer_include.pidl"
+#include "tao/RTCORBA/RTCORBA_include.pidl"
+
+#pragma prefix "omg.org"
+
+module RTPortableServer
+{
+ local interface POA : PortableServer::POA
+ {
+ Object create_reference_with_priority (in CORBA::RepositoryId intf,
+ in RTCORBA::Priority priority)
+ raises (WrongPolicy);
+
+ Object create_reference_with_id_and_priority (in PortableServer::ObjectId oid,
+ in CORBA::RepositoryId intf,
+ in RTCORBA::Priority priority)
+ raises (WrongPolicy);
+
+ PortableServer::ObjectId activate_object_with_priority (in PortableServer::Servant p_servant,
+ in RTCORBA::Priority priority)
+ raises (ServantAlreadyActive, WrongPolicy);
+
+ void activate_object_with_id_and_priority (in PortableServer::ObjectId oid,
+ in PortableServer::Servant p_servant,
+ in RTCORBA::Priority priority)
+ raises ( ServantAlreadyActive, ObjectAlreadyActive, WrongPolicy );
+ };
+};
+
+#endif /* _RT_PORTABLE_SERVER_IDL_ */
diff --git a/TAO/tao/RTPortableServer/RTPortableServerA.h b/TAO/tao/RTPortableServer/RTPortableServerA.h
new file mode 100644
index 00000000000..e543e41332e
--- /dev/null
+++ b/TAO/tao/RTPortableServer/RTPortableServerA.h
@@ -0,0 +1,3 @@
+// $Id$
+// This file deliberately empty. See bugzilla #2549.
+
diff --git a/TAO/tao/RTPortableServer/RTPortableServer_include.pidl b/TAO/tao/RTPortableServer/RTPortableServer_include.pidl
new file mode 100644
index 00000000000..0a16df733bd
--- /dev/null
+++ b/TAO/tao/RTPortableServer/RTPortableServer_include.pidl
@@ -0,0 +1,40 @@
+/**
+ * @file RTPortableServer_include.pidl
+ *
+ * $Id$
+ *
+ * @brief Include file for use in applications that need RTPortableServer.pidl.
+ *
+ * This file just includes RTPortableServer.pidl. The *C.h file generated from
+ * this is hand-crafted to itself include RTPortableServer.h instead of
+ * RTPortableServerC.h (which will produce a compiler error message if
+ * included directly). The RTPortableServer_includeC.h file can then be
+ * included directly and automatically by the IDL compiler when
+ * building the application.
+ *
+ * 1. Run the tao_idl compiler on the pidl file. The command used for
+ * this is:
+ *
+ * tao_idl -o orig -St -Sp -Sci -SS
+ * -Wb,export_macro=TAO_RTPortableServer_Export \
+ * -Wb,export_include="rtportableserver_export.h" \
+ * -Wb,pre_include="ace/pre.h"
+ * -Wb,post_include="ace/post.h"
+ * RTPortableServer_include.pidl
+ *
+ * 2. Then change this line in RTPortableServer_includeC.h:
+ *
+ * #include "RTPortableServerC.h"
+ *
+ * to
+ *
+ * #include "RTPortableServer.h"
+ */
+
+#ifndef _RTPORTABLESERVER_INCLUDE_IDL_
+#define _RTPORTABLESERVER_INCLUDE_IDL_
+
+///FUZZ: disable check_for_include/
+#include "tao/RTPortableServer/RTPortableServer.pidl"
+
+#endif /* _RTPORTABLESERVER_INCLUDE_IDL_ */
diff --git a/TAO/tao/RTPortableServer/RTPortableServer_includeA.h b/TAO/tao/RTPortableServer/RTPortableServer_includeA.h
new file mode 100644
index 00000000000..e543e41332e
--- /dev/null
+++ b/TAO/tao/RTPortableServer/RTPortableServer_includeA.h
@@ -0,0 +1,3 @@
+// $Id$
+// This file deliberately empty. See bugzilla #2549.
+
diff --git a/TAO/tao/RTPortableServer/RTPortableServer_includeC.h b/TAO/tao/RTPortableServer/RTPortableServer_includeC.h
new file mode 100644
index 00000000000..2b42eb48285
--- /dev/null
+++ b/TAO/tao/RTPortableServer/RTPortableServer_includeC.h
@@ -0,0 +1,91 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:153
+
+#ifndef _TAO_IDL_ORIG_RTPORTABLESERVER_INCLUDEC_H_
+#define _TAO_IDL_ORIG_RTPORTABLESERVER_INCLUDEC_H_
+
+#include /**/ "ace/pre.h"
+
+
+#include "ace/config-all.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/RTPortableServer/rtportableserver_export.h"
+#include "tao/ORB.h"
+#include "tao/SystemException.h"
+#include "tao/Environment.h"
+
+#include "tao/RTPortableServer/RTPortableServer.h"
+
+#if defined (TAO_EXPORT_MACRO)
+#undef TAO_EXPORT_MACRO
+#endif
+#define TAO_EXPORT_MACRO TAO_RTPortableServer_Export
+
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+#if defined (__BORLANDC__)
+#pragma option push -w-rvl -w-rch -w-ccc -w-inl
+#endif /* __BORLANDC__ */
+
+// TAO_IDL - Generated from
+// be\be_visitor_traits.cpp:61
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Traits specializations.
+namespace TAO
+{
+}
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:955
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#if defined (__BORLANDC__)
+#pragma option pop
+#endif /* __BORLANDC__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* ifndef */
+
+
diff --git a/TAO/tao/RTPortableServer/RTPortableServer_includeS.h b/TAO/tao/RTPortableServer/RTPortableServer_includeS.h
new file mode 100644
index 00000000000..17b1360599e
--- /dev/null
+++ b/TAO/tao/RTPortableServer/RTPortableServer_includeS.h
@@ -0,0 +1,28 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// Skeleton file generation suppressed with command line option -SS
diff --git a/TAO/tao/RTPortableServer/RT_Acceptor_Filters.cpp b/TAO/tao/RTPortableServer/RT_Acceptor_Filters.cpp
new file mode 100644
index 00000000000..53444f8e1b4
--- /dev/null
+++ b/TAO/tao/RTPortableServer/RT_Acceptor_Filters.cpp
@@ -0,0 +1,69 @@
+// $Id$
+
+#include "tao/RTPortableServer/RT_Acceptor_Filters.h"
+
+#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
+
+#include "tao/Transport_Acceptor.h"
+#include "tao/MProfile.h"
+#include "tao/Profile.h"
+
+ACE_RCSID (RTPortableServer,
+ RT_Acceptor_Filter,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Server_Protocol_Acceptor_Filter::TAO_Server_Protocol_Acceptor_Filter (
+ RTCORBA::ProtocolList &protocols)
+ : protocols_ (protocols)
+{
+}
+
+int
+TAO_Server_Protocol_Acceptor_Filter::fill_profile (
+ const TAO::ObjectKey &object_key,
+ TAO_MProfile &mprofile,
+ TAO_Acceptor **acceptors_begin,
+ TAO_Acceptor **acceptors_end,
+ CORBA::Short priority)
+{
+ // RTCORBA 1.0, Section 4.15.1: ServerProtocolPolicy determines
+ // which protocols get included into IOR and in what order.
+ for (CORBA::ULong j = 0; j < this->protocols_.length (); ++j)
+ {
+ CORBA::ULong protocol_type = this->protocols_[j].protocol_type;
+
+ for (TAO_Acceptor** acceptor = acceptors_begin;
+ acceptor != acceptors_end;
+ ++acceptor)
+ if ((*acceptor)->tag () == protocol_type &&
+ ((*acceptor)->create_profile (object_key,
+ mprofile,
+ priority) == -1))
+ return -1;
+ }
+
+ return 0;
+}
+
+int
+TAO_Server_Protocol_Acceptor_Filter::encode_endpoints (TAO_MProfile &mprofile)
+{
+ // Encode endpoints.
+ for (CORBA::ULong i = 0;
+ i < mprofile.profile_count ();
+ ++i)
+ {
+ TAO_Profile *profile = mprofile.get_profile (i);
+ if (profile->encode_endpoints () == -1)
+ return -1;
+ }
+
+ return 0;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
diff --git a/TAO/tao/RTPortableServer/RT_Acceptor_Filters.h b/TAO/tao/RTPortableServer/RT_Acceptor_Filters.h
new file mode 100644
index 00000000000..6eb39e04677
--- /dev/null
+++ b/TAO/tao/RTPortableServer/RT_Acceptor_Filters.h
@@ -0,0 +1,75 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file RT_Acceptor_Filters.h
+ *
+ * $Id$
+ *
+ * RTCORBA strategies for populating mprofile.
+ *
+ * @author Marina Spivak <marina@cs.wustl.edu>
+ */
+// ===================================================================
+
+#ifndef TAO_RT_ACCEPTOR_FILTER_H
+#define TAO_RT_ACCEPTOR_FILTER_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
+
+#include "tao/RTPortableServer/rtportableserver_export.h"
+#include "tao/Acceptor_Filter.h"
+
+#define TAO_RTCORBA_SAFE_INCLUDE
+#include "tao/RTCORBA/RTCORBAC.h"
+#undef TAO_RTCORBA_SAFE_INCLUDE
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Acceptor;
+
+/**
+ * @class TAO_Server_Protocol_Acceptor_Filter
+ *
+ * @brief Populates mprofile with endpoints selected based on the
+ * RTCORBA::ServerProtocolPolicy.
+ */
+class TAO_RTPortableServer_Export TAO_Server_Protocol_Acceptor_Filter :
+ public TAO_Acceptor_Filter
+{
+public:
+ /// Constructor
+ TAO_Server_Protocol_Acceptor_Filter (RTCORBA::ProtocolList &protocols);
+
+ /// Populate @a mprofile based on what's in <protocols_>.
+ int fill_profile (const TAO::ObjectKey &object_key,
+ TAO_MProfile &mprofile,
+ TAO_Acceptor **acceptors_begin,
+ TAO_Acceptor **acceptors_end,
+ CORBA::Short priority);
+
+ /// Encodes the endpoints in the profiles into the TAO_TAG_ENDPOINTS
+ /// tag component of profiles.
+ int encode_endpoints (TAO_MProfile &mprofile);
+
+private:
+ /// Value of the ServerProtocolPolicy used for endpoint
+ /// selection.
+ RTCORBA::ProtocolList &protocols_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_RT_ACCEPTOR_FILTER_H */
diff --git a/TAO/tao/RTPortableServer/RT_Collocation_Resolver.cpp b/TAO/tao/RTPortableServer/RT_Collocation_Resolver.cpp
new file mode 100644
index 00000000000..0eecb7136a9
--- /dev/null
+++ b/TAO/tao/RTPortableServer/RT_Collocation_Resolver.cpp
@@ -0,0 +1,124 @@
+// $Id$
+
+#include "tao/RTPortableServer/RT_Collocation_Resolver.h"
+
+#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
+
+ACE_RCSID(RTPortableServer,
+ RT_Collocation_Resolver,
+ "$Id$")
+
+#include "tao/ORB_Core.h"
+#include "tao/ORB_Core_TSS_Resources.h"
+#include "tao/Object.h"
+#include "tao/Stub.h"
+#include "tao/PortableServer/Servant_Upcall.h"
+#include "tao/PortableServer/Root_POA.h"
+#include "tao/RTCORBA/Thread_Pool.h"
+#include "tao/Profile.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+CORBA::Boolean
+TAO_RT_Collocation_Resolver::is_collocated (CORBA::Object_ptr object
+ ACE_ENV_ARG_DECL) const
+{
+ // Make sure that the servant is in the same ORB that created this
+ // object.
+ if (!object->_is_collocated ())
+ return false;
+
+ // Get the orb core.
+ TAO_ORB_Core *orb_core =
+ object->_stubobj ()->servant_orb_var ()->orb_core ();
+
+ // Lookup the target POA. Note that Object Adapter lock is held
+ // until <servant_upcall> dies.
+ TAO::Portable_Server::Servant_Upcall servant_upcall (orb_core);
+ TAO_Root_POA *poa =
+ servant_upcall.lookup_POA (object->_stubobj ()->object_key ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ // Get the thread pool associated with this POA.
+ TAO_Thread_Pool *target_thread_pool =
+ static_cast <TAO_Thread_Pool *> (poa->thread_pool ());
+
+ // If the target POA does not have a dedicated thread pool, then all
+ // calls to it are collocated.
+ if (target_thread_pool == 0)
+ return true;
+
+ /// Get the ORB_Core's TSS resources.
+ TAO_ORB_Core_TSS_Resources &tss =
+ *orb_core->get_tss_resources ();
+
+ // Get the lane for this thread.
+ TAO_Thread_Lane *current_thread_lane =
+ static_cast <TAO_Thread_Lane *> (tss.lane_);
+
+ TAO_Thread_Pool *current_thread_pool = 0;
+
+ // If we don't have a lane, we don't have a pool.
+ if (current_thread_lane)
+ current_thread_pool =
+ &current_thread_lane->pool ();
+
+ // If the pools don't match, then the current thread belongs to a
+ // different pool than POA. Therefore, this object is not
+ // collocated.
+ if (current_thread_pool != target_thread_pool)
+ return false;
+
+ // If the current thread and the POA are in the default thread pool,
+ // then the object is collocated.
+ if (current_thread_pool == 0)
+ return true;
+
+ // If the current thread and the POA are in a thread pool without
+ // lanes, then the object is collocated.
+ if (!current_thread_pool->with_lanes ())
+ return true;
+
+ // Grab the priority model used by the POA. Note that this cannot
+ // be NOT_SPECIFIED because NOT_SPECIFIED is not allowed with thread
+ // pool with lanes.
+ TAO::Portable_Server::Cached_Policies::PriorityModel priority_model =
+ poa->priority_model ();
+
+ // If the policy is CLIENT_PROPAGATED, then we are collocated
+ // because the current thread is of the correct priority :-) and
+ // we'll simple use the current thread to run the upcall.
+ if (priority_model == TAO::Portable_Server::Cached_Policies::CLIENT_PROPAGATED)
+ return true;
+
+ // Find the target servant priority. We are really not interested in the
+ // servant itself but in the priority that this servant will run at.
+ CORBA::Short target_priority;
+
+ if (-1 == poa->find_servant_priority (servant_upcall.system_id_,
+ target_priority
+ ACE_ENV_ARG_PARAMETER))
+ {
+ return false;
+ };
+
+ // If it matches the current thread's priority, then we are
+ // collocated. Otherwise we are not.
+ if (target_priority == current_thread_lane->lane_priority ())
+ return true;
+ else
+ return false;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DEFINE (TAO_RT_Collocation_Resolver,
+ ACE_TEXT ("RT_Collocation_Resolver"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (TAO_RT_Collocation_Resolver),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0)
+ACE_FACTORY_DEFINE (TAO_RTPortableServer, TAO_RT_Collocation_Resolver)
+
+#endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
diff --git a/TAO/tao/RTPortableServer/RT_Collocation_Resolver.h b/TAO/tao/RTPortableServer/RT_Collocation_Resolver.h
new file mode 100644
index 00000000000..64f3016a4bd
--- /dev/null
+++ b/TAO/tao/RTPortableServer/RT_Collocation_Resolver.h
@@ -0,0 +1,60 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file RT_Collocation_Resolver.h
+ *
+ * $Id$
+ *
+ * @author Irfan Pyarali
+ */
+// ===================================================================
+
+#ifndef TAO_RT_COLLOCATION_RESOLVER_H
+#define TAO_RT_COLLOCATION_RESOLVER_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/RTPortableServer/rtportableserver_export.h"
+#include "tao/Collocation_Resolver.h"
+#include "ace/Service_Config.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_RT_Collocation_Resolver
+ *
+ * @brief This class helps decide on collocation among the maze of
+ * thread pools and lanes.
+ *
+ * \nosubgrouping
+ *
+ **/
+class TAO_RTPortableServer_Export TAO_RT_Collocation_Resolver :
+ public TAO_Collocation_Resolver
+{
+public:
+
+ /// Is @a object collocated?
+ virtual CORBA::Boolean is_collocated (CORBA::Object_ptr object
+ ACE_ENV_ARG_DECL) const;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE_EXPORT (TAO_RTPortableServer, TAO_RT_Collocation_Resolver)
+ACE_FACTORY_DECLARE (TAO_RTPortableServer, TAO_RT_Collocation_Resolver)
+
+#endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_RT_COLLOCATION_RESOLVER_H */
diff --git a/TAO/tao/RTPortableServer/RT_Object_Adapter_Factory.cpp b/TAO/tao/RTPortableServer/RT_Object_Adapter_Factory.cpp
new file mode 100644
index 00000000000..4dc295d06aa
--- /dev/null
+++ b/TAO/tao/RTPortableServer/RT_Object_Adapter_Factory.cpp
@@ -0,0 +1,66 @@
+// $Id$
+
+#include "tao/RTPortableServer/RT_Object_Adapter_Factory.h"
+
+#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
+
+#include "tao/PortableServer/Object_Adapter.h"
+#include "tao/ORB_Core.h"
+#include "tao/RTPortableServer/RT_Servant_Dispatcher.h"
+#include "tao/RTPortableServer/RT_Policy_Validator.h"
+#include "tao/RTPortableServer/RT_Collocation_Resolver.h"
+
+ACE_RCSID (RTPortableServer,
+ RT_Object_Adapter_Factory,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Adapter*
+TAO_RT_Object_Adapter_Factory::create (TAO_ORB_Core *orb_core)
+{
+ if (!orb_core->orb_params ()->disable_rt_collocation_resolver ())
+ {
+ // Set the name of the collocation resolver to be RT_Collocation_Resolver.
+ TAO_ORB_Core::set_collocation_resolver (
+ "RT_Collocation_Resolver");
+ ACE_Service_Config::process_directive (
+ ace_svc_desc_TAO_RT_Collocation_Resolver);
+ }
+
+ TAO_Object_Adapter *object_adapter = 0;
+ ACE_NEW_RETURN (object_adapter,
+ TAO_Object_Adapter (orb_core->server_factory ()->
+ active_object_map_creation_parameters (),
+ *orb_core),
+ 0);
+
+ // Create and register the RT servant dispatcher.
+ TAO_RT_Servant_Dispatcher *rt_servant_dispatcher = 0;
+ ACE_NEW_RETURN (rt_servant_dispatcher,
+ TAO_RT_Servant_Dispatcher,
+ 0);
+ object_adapter->servant_dispatcher (rt_servant_dispatcher);
+
+ // Create and add the RT policy validator.
+ TAO_POA_RT_Policy_Validator *rt_validator = 0;
+ ACE_NEW_RETURN (rt_validator,
+ TAO_POA_RT_Policy_Validator (*orb_core),
+ 0);
+ object_adapter->validator ().add_validator (rt_validator);
+
+ return object_adapter;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_FACTORY_DEFINE (TAO_RTPortableServer, TAO_RT_Object_Adapter_Factory)
+ACE_STATIC_SVC_DEFINE (TAO_RT_Object_Adapter_Factory,
+ ACE_TEXT ("TAO_RT_Object_Adapter_Factory"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (TAO_RT_Object_Adapter_Factory),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0)
+
+#endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
diff --git a/TAO/tao/RTPortableServer/RT_Object_Adapter_Factory.h b/TAO/tao/RTPortableServer/RT_Object_Adapter_Factory.h
new file mode 100644
index 00000000000..5749011b0e6
--- /dev/null
+++ b/TAO/tao/RTPortableServer/RT_Object_Adapter_Factory.h
@@ -0,0 +1,50 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file RT_Object_Adapter_Factory.h
+ *
+ * $Id$
+ *
+ * @author Frank Hunleth
+ */
+// ===================================================================
+
+#ifndef TAO_RT_OBJECT_ADAPTER_FACTORY_H
+#define TAO_RT_OBJECT_ADAPTER_FACTORY_H
+#include /**/ "ace/pre.h"
+
+#include "tao/RTPortableServer/rtportableserver_export.h"
+
+#include "tao/Adapter_Factory.h"
+#include "tao/orbconf.h"
+
+#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
+
+#include "ace/Service_Config.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_RTPortableServer_Export TAO_RT_Object_Adapter_Factory
+ : public TAO_Adapter_Factory
+{
+public:
+
+ /// Create adapter.
+ virtual TAO_Adapter *create (TAO_ORB_Core *orb_core);
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE (TAO_RT_Object_Adapter_Factory)
+ACE_FACTORY_DECLARE (TAO_RTPortableServer, TAO_RT_Object_Adapter_Factory)
+
+#endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_RT_OBJECT_ADAPTER_FACTORY_H */
diff --git a/TAO/tao/RTPortableServer/RT_POA.cpp b/TAO/tao/RTPortableServer/RT_POA.cpp
new file mode 100644
index 00000000000..7cfc74d470f
--- /dev/null
+++ b/TAO/tao/RTPortableServer/RT_POA.cpp
@@ -0,0 +1,958 @@
+// $Id$
+
+#include "tao/RTPortableServer/RT_POA.h"
+
+#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
+
+#include "tao/RTPortableServer/RT_Acceptor_Filters.h"
+
+#include "tao/ORB_Core.h"
+#include "tao/ORB.h"
+#include "tao/Server_Strategy_Factory.h"
+#include "tao/Environment.h"
+#include "tao/Exception.h"
+#include "tao/Stub.h"
+#include "tao/Policy_Manager.h"
+#include "tao/debug.h"
+#include "tao/RTCORBA/Thread_Pool.h"
+#include "tao/Thread_Lane_Resources.h"
+#include "tao/Acceptor_Registry.h"
+#include "tao/Thread_Lane_Resources.h"
+#include "tao/Thread_Lane_Resources_Manager.h"
+
+#include "tao/RTCORBA/RT_Policy_i.h"
+
+#include "tao/PortableServer/Default_Acceptor_Filter.h"
+#include "tao/RTPortableServer/RT_Policy_Validator.h"
+
+#include "ace/Auto_Ptr.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/RTPortableServer/RT_POA.i"
+#endif /* ! __ACE_INLINE__ */
+
+ACE_RCSID (RTPortableServer,
+ RT_POA,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_RT_POA::TAO_RT_POA (const TAO_Root_POA::String &name,
+ PortableServer::POAManager_ptr poa_manager,
+ const TAO_POA_Policy_Set &policies,
+ TAO_Root_POA *parent,
+ ACE_Lock &lock,
+ TAO_SYNCH_MUTEX &thread_lock,
+ TAO_ORB_Core &orb_core,
+ TAO_Object_Adapter *object_adapter
+ ACE_ENV_ARG_DECL)
+ : TAO_Regular_POA (name,
+ poa_manager,
+ policies,
+ parent,
+ lock,
+ thread_lock,
+ orb_core,
+ object_adapter
+ ACE_ENV_ARG_PARAMETER),
+ thread_pool_ (0)
+{
+ ACE_CHECK;
+
+ // Parse the RT policies and update our policy cache.
+ this->parse_rt_policies (this->policies ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+TAO_RT_POA::~TAO_RT_POA (void)
+{
+}
+
+TAO_Root_POA *
+TAO_RT_POA::new_POA (const String &name,
+ PortableServer::POAManager_ptr poa_manager,
+ const TAO_POA_Policy_Set &policies,
+ TAO_Root_POA *parent,
+ ACE_Lock &lock,
+ TAO_SYNCH_MUTEX &thread_lock,
+ TAO_ORB_Core &orb_core,
+ TAO_Object_Adapter *object_adapter
+ ACE_ENV_ARG_DECL)
+{
+ TAO_RT_POA *poa = 0;
+
+ ACE_NEW_THROW_EX (poa,
+ TAO_RT_POA (name,
+ poa_manager,
+ policies,
+ parent,
+ lock,
+ thread_lock,
+ orb_core,
+ object_adapter
+ ACE_ENV_ARG_PARAMETER),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (0);
+
+ return poa;
+}
+
+void
+TAO_RT_POA::parse_rt_policies (TAO_POA_Policy_Set &policies
+ ACE_ENV_ARG_DECL)
+{
+ {
+ CORBA::Policy_var policy =
+ policies.get_cached_policy (TAO_CACHED_POLICY_PRIORITY_MODEL
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ RTCORBA::PriorityModelPolicy_var priority_model =
+ RTCORBA::PriorityModelPolicy::_narrow (policy.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (!CORBA::is_nil (priority_model.in ()))
+ {
+ RTCORBA::PriorityModel rt_priority_model =
+ priority_model->priority_model (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->cached_policies_.priority_model (
+ TAO::Portable_Server::Cached_Policies::PriorityModel (rt_priority_model));
+
+ RTCORBA::Priority priority =
+ priority_model->server_priority (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->cached_policies_.server_priority (priority);
+ }
+ }
+
+ this->thread_pool_ =
+ TAO_POA_RT_Policy_Validator::extract_thread_pool (this->orb_core_,
+ policies.policies ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+void
+TAO_RT_POA::validate_priority (RTCORBA::Priority priority
+ ACE_ENV_ARG_DECL)
+{
+ if (priority < RTCORBA::minPriority
+ // The line below will always be false unless the value of
+ // RTCORBA::maxPriority, which is now assigned the value of
+ // 32767, is changed in RTCORBA.pidl.
+// || priority > RTCORBA::maxPriority
+ )
+ {
+ ACE_THROW (CORBA::BAD_PARAM ());
+ }
+
+ // If this POA is using a thread pool with lanes, make sure the
+ // priority matches one of the thread lanes. Note that in this
+ // case, bands do not matter since matching the lanes priority is a
+ // stricter condition than meeting the band ranges. In addition,
+ // when the POA was created, the bands had to match the lanes.
+ if (this->thread_pool_ != 0 &&
+ this->thread_pool_->with_lanes ())
+ {
+ TAO_Thread_Lane **lanes =
+ this->thread_pool_->lanes ();
+
+ for (CORBA::ULong i = 0;
+ i != this->thread_pool_->number_of_lanes ();
+ ++i)
+ {
+ if (lanes[i]->lane_priority () == priority)
+ return;
+ }
+
+ ACE_THROW (CORBA::BAD_PARAM ());
+ }
+ else
+ // Else we are dealing with a thread pool without lanes.
+ {
+ // Check if we have bands.
+ CORBA::Policy_var bands =
+ this->policies ().get_cached_policy (
+ TAO_CACHED_POLICY_RT_PRIORITY_BANDED_CONNECTION
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ RTCORBA::PriorityBandedConnectionPolicy_var priority_bands
+ = RTCORBA::PriorityBandedConnectionPolicy::_narrow (bands.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ TAO_PriorityBandedConnectionPolicy *priority_bands_i =
+ dynamic_cast <TAO_PriorityBandedConnectionPolicy *>
+ (priority_bands.in ());
+
+ if (priority_bands_i)
+ {
+ // If we do have bands, make sure that the priority is
+ // matching one of the bands.
+ RTCORBA::PriorityBands &bands =
+ priority_bands_i->priority_bands_rep ();
+
+ for (CORBA::ULong i = 0;
+ i < bands.length ();
+ ++i)
+ {
+ if (bands[i].low <= priority &&
+ bands[i].high >= priority)
+ return;
+ }
+
+ ACE_THROW (CORBA::BAD_PARAM ());
+ }
+ }
+}
+
+void
+TAO_RT_POA::validate_policies (ACE_ENV_SINGLE_ARG_DECL)
+{
+ // For each of the above operations, if the POA supports the
+ // IMPLICIT_ACTIVATION option for the ImplicitActivationPolicy then
+ // the ORB shall raise a WrongPolicy user exception. This relieves
+ // an ORB implementation of the need to retrieve the target object's
+ // priority from "somewhere" when a request arrives for an inactive
+ // object.
+ if (this->cached_policies_.implicit_activation () ==
+ PortableServer::IMPLICIT_ACTIVATION)
+ {
+ ACE_THROW (PortableServer::POA::WrongPolicy ());
+ }
+
+ // For each of the above operations, if the POA does not support the
+ // SERVER_DECLARED option for the PriorityModelPolicy then the ORB
+ // shall raise a WrongPolicy user exception.
+ if (this->cached_policies_.priority_model () !=
+ TAO::Portable_Server::Cached_Policies::SERVER_DECLARED)
+ {
+ ACE_THROW (PortableServer::POA::WrongPolicy ());
+ }
+
+ // In all other respects the semantics of the corresponding
+ // (i.e. without the name extensions "_with_priority" and
+ // "_and_priority") PortableServer::POA operations shall be
+ // observed.
+}
+
+TAO_Stub *
+TAO_RT_POA::key_to_stub_i (const TAO::ObjectKey &object_key,
+ const char *type_id,
+ CORBA::Short priority
+ ACE_ENV_ARG_DECL)
+{
+ // Client exposed policies.
+ CORBA::PolicyList_var client_exposed_policies =
+ this->client_exposed_policies (priority
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ // Server protocol policy.
+ CORBA::Policy_var protocol =
+ this->policies ().get_cached_policy (TAO_CACHED_POLICY_RT_SERVER_PROTOCOL
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ RTCORBA::ServerProtocolPolicy_var server_protocol_policy =
+ RTCORBA::ServerProtocolPolicy::_narrow (protocol.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ TAO_ServerProtocolPolicy *server_protocol =
+ dynamic_cast <TAO_ServerProtocolPolicy *> (server_protocol_policy.in ());
+
+ // Filter for server protocol.
+ TAO_Server_Protocol_Acceptor_Filter filter (server_protocol->protocols_rep ());
+
+ // If this POA is using the default thread pool or a thread pool
+ // without lanes, create the IOR with the acceptors in the thread
+ // pool.
+ if (this->thread_pool_ == 0 ||
+ !this->thread_pool_->with_lanes ())
+ {
+ TAO_Acceptor_Registry *acceptor_registry = 0;
+
+ if (this->thread_pool_ == 0)
+ {
+ TAO_Thread_Lane_Resources_Manager &thread_lane_resources_manager =
+ this->orb_core_.thread_lane_resources_manager ();
+
+ TAO_Thread_Lane_Resources &resources =
+ thread_lane_resources_manager.default_lane_resources ();
+
+ acceptor_registry =
+ &resources.acceptor_registry ();
+ }
+ else
+ {
+ TAO_Thread_Lane **lanes =
+ this->thread_pool_->lanes ();
+
+ TAO_Thread_Lane_Resources &resources =
+ lanes[0]->resources ();
+
+ acceptor_registry =
+ &resources.acceptor_registry ();
+ }
+
+ return
+ this->TAO_Regular_POA::create_stub_object (object_key,
+ type_id,
+ client_exposed_policies._retn (),
+ &filter,
+ *acceptor_registry
+ ACE_ENV_ARG_PARAMETER);
+ }
+
+ // If this POA has the SERVER_DECLARED policy, create the IOR with
+ // the acceptors in the only thread lane that matches the priority
+ // of the object.
+ if (this->cached_policies_.priority_model () ==
+ TAO::Portable_Server::Cached_Policies::SERVER_DECLARED)
+ {
+ TAO_Thread_Lane **lanes =
+ this->thread_pool_->lanes ();
+
+ for (CORBA::ULong i = 0;
+ i != this->thread_pool_->number_of_lanes ();
+ ++i)
+ {
+ if (lanes[i]->lane_priority () == priority)
+ return this->TAO_Regular_POA::create_stub_object (object_key,
+ type_id,
+ client_exposed_policies._retn (),
+ &filter,
+ lanes[i]->resources ().acceptor_registry ()
+ ACE_ENV_ARG_PARAMETER);
+ }
+
+ ACE_ASSERT (0);
+ }
+
+ // If this POA has the CLIENT_PROPAGATED policy, create the IOR with
+ // the acceptors in the thread lanes that matches the bands in this
+ // POA. If there are no bands, all the thread lanes are used.
+ CORBA::Policy_var bands =
+ this->policies ().get_cached_policy (
+ TAO_CACHED_POLICY_RT_PRIORITY_BANDED_CONNECTION
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ RTCORBA::PriorityBandedConnectionPolicy_var priority_bands
+ = RTCORBA::PriorityBandedConnectionPolicy::_narrow (bands.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ TAO_PriorityBandedConnectionPolicy *priority_bands_i =
+ dynamic_cast <TAO_PriorityBandedConnectionPolicy *> (priority_bands.in ());
+
+ return this->create_stub_object (object_key,
+ type_id,
+ client_exposed_policies._retn (),
+ &filter,
+ priority_bands_i
+ ACE_ENV_ARG_PARAMETER);
+}
+
+TAO_Stub *
+TAO_RT_POA::create_stub_object (const TAO::ObjectKey &object_key,
+ const char *type_id,
+ CORBA::PolicyList *policy_list,
+ TAO_Acceptor_Filter *filter,
+ TAO_PriorityBandedConnectionPolicy *priority_bands
+ ACE_ENV_ARG_DECL)
+{
+ int error = 0;
+
+ // Count the number of endpoints.
+ size_t profile_count =
+ this->endpoint_count ();
+
+ // Create a profile container and have acceptor registries populate
+ // it with profiles as appropriate.
+ TAO_MProfile mprofile (0);
+
+ // Allocate space for storing the profiles. There can never be more
+ // profiles than there are endpoints. In some cases, there can be
+ // less profiles than endpoints.
+ int result =
+ mprofile.set (static_cast <CORBA::ULong> (profile_count));
+ if (result == -1)
+ error = 1;
+
+ TAO_Thread_Lane **lanes =
+ this->thread_pool_->lanes ();
+
+ // Leave it to the filter to decide which acceptors/in which order
+ // go into the mprofile.
+ for (CORBA::ULong i = 0;
+ i != this->thread_pool_->number_of_lanes () &&
+ !error;
+ ++i)
+ {
+ if (this->lane_required (lanes[i],
+ priority_bands))
+ {
+ TAO_Acceptor_Registry &acceptor_registry =
+ lanes[i]->resources ().acceptor_registry ();
+
+ result =
+ filter->fill_profile (object_key,
+ mprofile,
+ acceptor_registry.begin (),
+ acceptor_registry.end (),
+ lanes[i]->lane_priority ());
+ if (result == -1)
+ error = 1;
+ }
+ }
+
+ if (!error)
+ result = filter->encode_endpoints (mprofile);
+ if (result == -1)
+ error = 1;
+
+ if (error)
+ ACE_THROW_RETURN (CORBA::INTERNAL (
+ CORBA::SystemException::_tao_minor_code (
+ TAO_MPROFILE_CREATION_ERROR,
+ 0),
+ CORBA::COMPLETED_NO),
+ 0);
+
+ // Make sure we have at least one profile. <mp> may end up being
+ // empty if none of the acceptor endpoints have the right priority
+ // for this object, for example.
+ if (mprofile.profile_count () == 0)
+ ACE_THROW_RETURN (CORBA::BAD_PARAM (
+ CORBA::SystemException::_tao_minor_code (
+ TAO_MPROFILE_CREATION_ERROR,
+ 0),
+ CORBA::COMPLETED_NO),
+ 0);
+
+ return
+ this->orb_core_.create_stub_object (mprofile,
+ type_id,
+ policy_list
+ ACE_ENV_ARG_PARAMETER);
+}
+
+size_t
+TAO_RT_POA::endpoint_count (void)
+{
+ size_t profile_count = 0;
+
+ TAO_Thread_Lane **lanes =
+ this->thread_pool_->lanes ();
+
+ for (CORBA::ULong i = 0;
+ i != this->thread_pool_->number_of_lanes ();
+ ++i)
+ profile_count +=
+ lanes[i]->resources ().acceptor_registry ().endpoint_count ();
+
+ return profile_count;
+}
+
+int
+TAO_RT_POA::lane_required (TAO_Thread_Lane *lane,
+ TAO_PriorityBandedConnectionPolicy *priority_bands)
+{
+ if (priority_bands == 0)
+ return 1;
+
+ RTCORBA::PriorityBands &bands =
+ priority_bands->priority_bands_rep ();
+
+ for (CORBA::ULong i = 0;
+ i < bands.length ();
+ ++i)
+ {
+ if (bands[i].low <= lane->lane_priority () &&
+ bands[i].high >= lane->lane_priority ())
+ return 1;
+ }
+
+ return 0;
+}
+
+CORBA::PolicyList *
+TAO_RT_POA::client_exposed_policies (CORBA::Short object_priority
+ ACE_ENV_ARG_DECL)
+{
+ CORBA::PolicyList *client_exposed_policies = 0;
+ ACE_NEW_THROW_EX (client_exposed_policies,
+ CORBA::PolicyList (),
+ CORBA::NO_MEMORY (TAO::VMCID,
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (0);
+
+ CORBA::PolicyList_var safe_client_exposed_policies = client_exposed_policies;
+
+ // Add in all of the client exposed policies.
+ this->policies_.add_client_exposed_fixed_policies (client_exposed_policies
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ // Check if the priority model policy has been set, and if so, let
+ // the client know about it.
+ CORBA::Short poa_priority =
+ this->cached_policies_.server_priority ();
+
+ if (poa_priority != TAO_INVALID_PRIORITY)
+ {
+ TAO::Portable_Server::Cached_Policies::PriorityModel priority_model =
+ this->cached_policies_.priority_model ();
+
+ // If the priority model is client propagated, let the client
+ // about the default server priority (the POA priority). If
+ // the priority model is server declared, tell the client the
+ // servant's priority.
+ CORBA::Short priority;
+ if (priority_model == TAO::Portable_Server::Cached_Policies::CLIENT_PROPAGATED)
+ priority = poa_priority;
+ else
+ priority = object_priority;
+
+ const CORBA::ULong current_length =
+ client_exposed_policies->length ();
+ client_exposed_policies->length (current_length + 1);
+
+ TAO_PriorityModelPolicy *priority_model_policy;
+ ACE_NEW_THROW_EX (priority_model_policy,
+ TAO_PriorityModelPolicy (RTCORBA::PriorityModel (priority_model),
+ priority),
+ CORBA::NO_MEMORY (TAO::VMCID,
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (0);
+
+ (*client_exposed_policies)[current_length] = priority_model_policy;
+ }
+
+ return safe_client_exposed_policies._retn ();
+}
+
+
+// Standard POA interfaces
+PortableServer::POA_ptr
+TAO_RT_POA::create_POA (const char *adapter_name,
+ PortableServer::POAManager_ptr poa_manager,
+ const CORBA::PolicyList &policies
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::AdapterAlreadyExists,
+ PortableServer::POA::InvalidPolicy))
+{
+ PortableServer::POA_ptr poa = this->TAO_Regular_POA::create_POA (adapter_name,
+ poa_manager,
+ policies
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (poa);
+ return poa;
+}
+
+PortableServer::POA_ptr
+TAO_RT_POA::find_POA (const char *adapter_name,
+ CORBA::Boolean activate_it
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::AdapterNonExistent))
+{
+ PortableServer::POA_ptr poa = this->TAO_Regular_POA::find_POA (adapter_name,
+ activate_it
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (poa);
+ return poa;
+}
+
+void
+TAO_RT_POA::destroy (CORBA::Boolean etherealize_objects,
+ CORBA::Boolean wait_for_completion
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->TAO_Regular_POA::destroy (etherealize_objects,
+ wait_for_completion
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+
+#if (TAO_HAS_MINIMUM_POA == 0)
+
+PortableServer::ThreadPolicy_ptr
+TAO_RT_POA::create_thread_policy (PortableServer::ThreadPolicyValue value
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ PortableServer::ThreadPolicy_ptr policy =
+ this->TAO_Regular_POA::create_thread_policy (value
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (policy);
+ return policy;
+}
+
+#endif /* TAO_HAS_MINIMUM_POA == 0 */
+
+PortableServer::LifespanPolicy_ptr
+TAO_RT_POA::create_lifespan_policy (PortableServer::LifespanPolicyValue value
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ PortableServer::LifespanPolicy_ptr policy =
+ this->TAO_Regular_POA::create_lifespan_policy (value
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (policy);
+ return policy;
+}
+
+PortableServer::IdUniquenessPolicy_ptr
+TAO_RT_POA::create_id_uniqueness_policy (PortableServer::IdUniquenessPolicyValue value
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ PortableServer::IdUniquenessPolicy_ptr policy =
+ this->TAO_Regular_POA::create_id_uniqueness_policy (value
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (policy);
+ return policy;
+}
+
+
+PortableServer::IdAssignmentPolicy_ptr
+TAO_RT_POA::create_id_assignment_policy (PortableServer::IdAssignmentPolicyValue value
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ PortableServer::IdAssignmentPolicy_ptr policy =
+ this->TAO_Regular_POA::create_id_assignment_policy (value
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (policy);
+ return policy;
+}
+
+
+#if (TAO_HAS_MINIMUM_POA == 0)
+
+PortableServer::ImplicitActivationPolicy_ptr
+TAO_RT_POA::create_implicit_activation_policy (PortableServer::ImplicitActivationPolicyValue value
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ PortableServer::ImplicitActivationPolicy_ptr policy =
+ this->TAO_Regular_POA::create_implicit_activation_policy (value
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (policy);
+ return policy;
+}
+
+PortableServer::ServantRetentionPolicy_ptr
+TAO_RT_POA::create_servant_retention_policy (PortableServer::ServantRetentionPolicyValue value
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ PortableServer::ServantRetentionPolicy_ptr policy =
+ this->TAO_Regular_POA::create_servant_retention_policy (value
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (policy);
+ return policy;
+}
+
+
+PortableServer::RequestProcessingPolicy_ptr
+TAO_RT_POA::create_request_processing_policy (PortableServer::RequestProcessingPolicyValue value
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ PortableServer::RequestProcessingPolicy_ptr policy =
+ this->TAO_Regular_POA::create_request_processing_policy (value
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (policy);
+ return policy;
+}
+
+
+#endif /* TAO_HAS_MINIMUM_POA == 0 */
+
+char *
+TAO_RT_POA::the_name (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ char * name =
+ this->TAO_Regular_POA::the_name (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (name);
+ return name;
+}
+
+PortableServer::POA_ptr
+TAO_RT_POA::the_parent (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ PortableServer::POA_ptr parent =
+ this->TAO_Regular_POA::the_parent (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (parent);
+ return parent;
+}
+
+PortableServer::POAList *
+TAO_RT_POA::the_children (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ PortableServer::POAList *children =
+ this->TAO_Regular_POA::the_children (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (children);
+ return children;
+}
+
+PortableServer::POAManager_ptr
+TAO_RT_POA::the_POAManager (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ PortableServer::POAManager_ptr poa_manager =
+ this->TAO_Regular_POA::the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (poa_manager);
+ return poa_manager;
+}
+
+
+#if (TAO_HAS_MINIMUM_POA == 0)
+
+PortableServer::AdapterActivator_ptr
+TAO_RT_POA::the_activator (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ PortableServer::AdapterActivator_ptr activator =
+ this->TAO_Regular_POA::the_activator (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (activator);
+ return activator;
+}
+
+void
+TAO_RT_POA::the_activator (PortableServer::AdapterActivator_ptr adapter_activator
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->TAO_Regular_POA::the_activator (adapter_activator
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+PortableServer::ServantManager_ptr
+TAO_RT_POA::get_servant_manager (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongPolicy))
+{
+ PortableServer::ServantManager_ptr servant_manager =
+ this->TAO_Regular_POA::get_servant_manager (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (servant_manager);
+ return servant_manager;
+}
+
+void
+TAO_RT_POA::set_servant_manager (PortableServer::ServantManager_ptr imgr
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongPolicy))
+{
+ this->TAO_Regular_POA::set_servant_manager (imgr
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+PortableServer::Servant
+TAO_RT_POA::get_servant (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::NoServant,
+ PortableServer::POA::WrongPolicy))
+{
+ PortableServer::Servant servant =
+ this->TAO_Regular_POA::get_servant (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (servant);
+ return servant;
+}
+
+void
+TAO_RT_POA::set_servant (PortableServer::Servant servant
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongPolicy))
+{
+ this->TAO_Regular_POA::set_servant (servant
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+#endif /* TAO_HAS_MINIMUM_POA == 0 */
+
+PortableServer::ObjectId *
+TAO_RT_POA::activate_object (PortableServer::Servant p_servant
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ServantAlreadyActive,
+ PortableServer::POA::WrongPolicy))
+{
+ PortableServer::ObjectId *object_id =
+ this->TAO_Regular_POA::activate_object (p_servant
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (object_id);
+ return object_id;
+}
+
+void
+TAO_RT_POA::activate_object_with_id (const PortableServer::ObjectId &id,
+ PortableServer::Servant p_servant
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ServantAlreadyActive,
+ PortableServer::POA::ObjectAlreadyActive,
+ PortableServer::POA::WrongPolicy))
+{
+ this->TAO_Regular_POA::activate_object_with_id (id,
+ p_servant
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+void
+TAO_RT_POA::deactivate_object (const PortableServer::ObjectId &oid
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ObjectNotActive,
+ PortableServer::POA::WrongPolicy))
+{
+ this->TAO_Regular_POA::deactivate_object (oid
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+CORBA::Object_ptr
+TAO_RT_POA::create_reference (const char *intf
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongPolicy))
+{
+ CORBA::Object_ptr obj =
+ this->TAO_Regular_POA::create_reference (intf
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (obj);
+ return obj;
+}
+
+CORBA::Object_ptr
+TAO_RT_POA::create_reference_with_id (const PortableServer::ObjectId &oid,
+ const char *intf
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ CORBA::Object_ptr obj =
+ this->TAO_Regular_POA::create_reference_with_id (oid,
+ intf
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (obj);
+ return obj;
+}
+
+PortableServer::ObjectId *
+TAO_RT_POA::servant_to_id (PortableServer::Servant p_servant
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ServantNotActive,
+ PortableServer::POA::WrongPolicy))
+{
+ PortableServer::ObjectId *object_id =
+ this->TAO_Regular_POA::servant_to_id (p_servant
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (object_id);
+ return object_id;
+}
+
+CORBA::Object_ptr
+TAO_RT_POA::servant_to_reference (PortableServer::Servant p_servant
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ServantNotActive,
+ PortableServer::POA::WrongPolicy))
+{
+ CORBA::Object_ptr obj =
+ this->TAO_Regular_POA::servant_to_reference (p_servant
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (obj);
+ return obj;
+}
+
+
+PortableServer::Servant
+TAO_RT_POA::reference_to_servant (CORBA::Object_ptr reference
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ObjectNotActive,
+ PortableServer::POA::WrongAdapter,
+ PortableServer::POA::WrongPolicy))
+{
+ PortableServer::Servant servant =
+ this->TAO_Regular_POA::reference_to_servant (reference
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (servant);
+ return servant;
+}
+
+PortableServer::ObjectId *
+TAO_RT_POA::reference_to_id (CORBA::Object_ptr reference
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongAdapter,
+ PortableServer::POA::WrongPolicy))
+{
+ PortableServer::ObjectId *object_id =
+ this->TAO_Regular_POA::reference_to_id (reference
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (object_id);
+ return object_id;
+}
+
+PortableServer::Servant
+TAO_RT_POA::id_to_servant (const PortableServer::ObjectId &oid
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ObjectNotActive,
+ PortableServer::POA::WrongPolicy))
+{
+ PortableServer::Servant servant =
+ this->TAO_Regular_POA::id_to_servant (oid
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (servant);
+ return servant;
+}
+
+CORBA::Object_ptr
+TAO_RT_POA::id_to_reference (const PortableServer::ObjectId &oid
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ObjectNotActive,
+ PortableServer::POA::WrongPolicy))
+{
+ CORBA::Object_ptr obj =
+ this->TAO_Regular_POA::id_to_reference (oid
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (obj);
+ return obj;
+}
+
+CORBA::OctetSeq *
+TAO_RT_POA::id (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return this->TAO_Regular_POA::id (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
diff --git a/TAO/tao/RTPortableServer/RT_POA.h b/TAO/tao/RTPortableServer/RT_POA.h
new file mode 100644
index 00000000000..2e255935f4b
--- /dev/null
+++ b/TAO/tao/RTPortableServer/RT_POA.h
@@ -0,0 +1,330 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file RT_POA.h
+ *
+ * $Id$
+ *
+ * RT_POA
+ *
+ * @author Irfan Pyarali
+ */
+// ===================================================================
+
+#ifndef TAO_RT_POA_H
+#define TAO_RT_POA_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/RTPortableServer/rtportableserver_export.h"
+
+#include "tao/PortableServer/Regular_POA.h"
+#include "tao/orbconf.h"
+
+#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
+
+#define TAO_RT_PORTABLESERVER_SAFE_INCLUDE
+#include "tao/RTPortableServer/RTPortableServerC.h"
+#undef TAO_RT_PORTABLESERVER_SAFE_INCLUDE
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+// This is to remove "inherits via dominance" warnings from MSVC.
+// MSVC is being a little too paranoid.
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Thread_Pool;
+class TAO_Thread_Lane;
+class TAO_PriorityBandedConnectionPolicy;
+
+class TAO_RTPortableServer_Export TAO_RT_POA
+ : public virtual RTPortableServer::POA
+ , public virtual TAO_Regular_POA
+{
+public:
+
+ // RTCORBA specific methods
+ CORBA::Object_ptr create_reference_with_priority (const char * intf,
+ RTCORBA::Priority priority
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongPolicy));
+
+ CORBA::Object_ptr create_reference_with_id_and_priority (const PortableServer::ObjectId & oid,
+ const char * intf,
+ RTCORBA::Priority priority
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongPolicy));
+
+ PortableServer::ObjectId * activate_object_with_priority (PortableServer::Servant p_servant,
+ RTCORBA::Priority priority
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ServantAlreadyActive,
+ PortableServer::POA::WrongPolicy));
+
+ void activate_object_with_id_and_priority (const PortableServer::ObjectId & oid,
+ PortableServer::Servant p_servant,
+ RTCORBA::Priority priority
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ServantAlreadyActive,
+ PortableServer::POA::ObjectAlreadyActive,
+ PortableServer::POA::WrongPolicy));
+ // End RTCORBA specific methods
+
+ // Standard POA interface methods
+ PortableServer::POA_ptr create_POA (const char *adapter_name,
+ PortableServer::POAManager_ptr poa_manager,
+ const CORBA::PolicyList &policies
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::AdapterAlreadyExists,
+ PortableServer::POA::InvalidPolicy));
+
+ PortableServer::POA_ptr find_POA (const char *adapter_name,
+ CORBA::Boolean activate_it
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::AdapterNonExistent));
+
+ void destroy (CORBA::Boolean etherealize_objects,
+ CORBA::Boolean wait_for_completion
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+#if (TAO_HAS_MINIMUM_POA == 0)
+
+ PortableServer::ThreadPolicy_ptr create_thread_policy (PortableServer::ThreadPolicyValue value
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+#endif /* TAO_HAS_MINIMUM_POA == 0 */
+
+ PortableServer::LifespanPolicy_ptr create_lifespan_policy (PortableServer::LifespanPolicyValue value
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ PortableServer::IdUniquenessPolicy_ptr create_id_uniqueness_policy (PortableServer::IdUniquenessPolicyValue value
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ PortableServer::IdAssignmentPolicy_ptr create_id_assignment_policy (PortableServer::IdAssignmentPolicyValue value
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+#if (TAO_HAS_MINIMUM_POA == 0)
+
+ PortableServer::ImplicitActivationPolicy_ptr create_implicit_activation_policy (PortableServer::ImplicitActivationPolicyValue value
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ PortableServer::ServantRetentionPolicy_ptr create_servant_retention_policy (PortableServer::ServantRetentionPolicyValue value
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ PortableServer::RequestProcessingPolicy_ptr create_request_processing_policy (PortableServer::RequestProcessingPolicyValue value
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+#endif /* TAO_HAS_MINIMUM_POA == 0 */
+
+ char * the_name (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ PortableServer::POA_ptr the_parent (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ PortableServer::POAList *the_children (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ PortableServer::POAManager_ptr the_POAManager (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+#if (TAO_HAS_MINIMUM_POA == 0)
+
+ PortableServer::AdapterActivator_ptr the_activator (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ void the_activator (PortableServer::AdapterActivator_ptr adapter_activator
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ PortableServer::ServantManager_ptr get_servant_manager (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongPolicy));
+
+ void set_servant_manager (PortableServer::ServantManager_ptr imgr
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongPolicy));
+
+ PortableServer::Servant get_servant (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::NoServant,
+ PortableServer::POA::WrongPolicy));
+
+ void set_servant (PortableServer::Servant servant
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongPolicy));
+
+#endif /* TAO_HAS_MINIMUM_POA == 0 */
+
+ PortableServer::ObjectId *activate_object (PortableServer::Servant p_servant
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ServantAlreadyActive,
+ PortableServer::POA::WrongPolicy));
+
+ void activate_object_with_id (const PortableServer::ObjectId &id,
+ PortableServer::Servant p_servant
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ServantAlreadyActive,
+ PortableServer::POA::ObjectAlreadyActive,
+ PortableServer::POA::WrongPolicy));
+
+ void deactivate_object (const PortableServer::ObjectId &oid
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ObjectNotActive,
+ PortableServer::POA::WrongPolicy));
+
+ CORBA::Object_ptr create_reference (const char *intf
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongPolicy));
+
+ CORBA::Object_ptr create_reference_with_id (const PortableServer::ObjectId &oid,
+ const char *intf
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ PortableServer::ObjectId *servant_to_id (PortableServer::Servant p_servant
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ServantNotActive,
+ PortableServer::POA::WrongPolicy));
+
+ CORBA::Object_ptr servant_to_reference (PortableServer::Servant p_servant
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ServantNotActive,
+ PortableServer::POA::WrongPolicy));
+
+ PortableServer::Servant reference_to_servant (CORBA::Object_ptr reference
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ObjectNotActive,
+ PortableServer::POA::WrongAdapter,
+ PortableServer::POA::WrongPolicy));
+
+ PortableServer::ObjectId *reference_to_id (CORBA::Object_ptr reference
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongAdapter,
+ PortableServer::POA::WrongPolicy));
+
+ PortableServer::Servant id_to_servant (const PortableServer::ObjectId &oid
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ObjectNotActive,
+ PortableServer::POA::WrongPolicy));
+
+ CORBA::Object_ptr id_to_reference (const PortableServer::ObjectId &oid
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ObjectNotActive,
+ PortableServer::POA::WrongPolicy));
+
+ CORBA::OctetSeq *id (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ // End standard POA interface methods.
+
+ virtual CORBA::PolicyList *client_exposed_policies (CORBA::Short object_priority
+ ACE_ENV_ARG_DECL);
+
+ TAO_RT_POA (const String &name,
+ PortableServer::POAManager_ptr poa_manager,
+ const TAO_POA_Policy_Set &policies,
+ TAO_Root_POA *parent,
+ ACE_Lock &lock,
+ TAO_SYNCH_MUTEX &thread_lock,
+ TAO_ORB_Core &orb_core,
+ TAO_Object_Adapter *object_adapter
+ ACE_ENV_ARG_DECL);
+
+ virtual ~TAO_RT_POA (void);
+
+ void *thread_pool (void) const;
+
+protected:
+
+ /// Template method for creating new POA's of this type.
+ virtual TAO_Root_POA *new_POA (const String &name,
+ PortableServer::POAManager_ptr poa_manager,
+ const TAO_POA_Policy_Set &policies,
+ TAO_Root_POA *parent,
+ ACE_Lock &lock,
+ TAO_SYNCH_MUTEX &thread_lock,
+ TAO_ORB_Core &orb_core,
+ TAO_Object_Adapter *object_adapter
+ ACE_ENV_ARG_DECL);
+
+ virtual TAO_Stub *key_to_stub_i (const TAO::ObjectKey &key,
+ const char *type_id,
+ CORBA::Short priority
+ ACE_ENV_ARG_DECL);
+
+ void validate_priority (RTCORBA::Priority priority
+ ACE_ENV_ARG_DECL);
+
+ void validate_policies (ACE_ENV_SINGLE_ARG_DECL);
+
+ /// Parse the policy list for RT policies and update our
+ /// cached policy instance.
+ void parse_rt_policies (TAO_POA_Policy_Set &policies
+ ACE_ENV_ARG_DECL);
+
+ size_t endpoint_count (void);
+
+ TAO_Stub *create_stub_object (const TAO::ObjectKey &object_key,
+ const char *type_id,
+ CORBA::PolicyList *policy_list,
+ TAO_Acceptor_Filter *filter,
+ TAO_PriorityBandedConnectionPolicy *priority_bands
+ ACE_ENV_ARG_DECL);
+
+ int lane_required (TAO_Thread_Lane *lane,
+ TAO_PriorityBandedConnectionPolicy *priority_bands);
+
+ TAO_Thread_Pool *thread_pool_;
+
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#if defined (__ACE_INLINE__)
+# include "tao/RTPortableServer/RT_POA.i"
+#endif /* __ACE_INLINE__ */
+
+#endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_POA_H */
diff --git a/TAO/tao/RTPortableServer/RT_POA.i b/TAO/tao/RTPortableServer/RT_POA.i
new file mode 100644
index 00000000000..9197a39d399
--- /dev/null
+++ b/TAO/tao/RTPortableServer/RT_POA.i
@@ -0,0 +1,144 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// Exception macros
+#include "tao/PortableServer/poa_macros.h"
+#include "tao/PortableServer/POA_Guard.h"
+#include "tao/Environment.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE CORBA::Object_ptr
+TAO_RT_POA::create_reference_with_priority (const char * intf,
+ RTCORBA::Priority priority
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongPolicy))
+{
+ // Check that this method can be used based on this POA's policies.
+ this->validate_policies (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Object::_nil ());
+
+ this->validate_priority (priority ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Object::_nil ());
+
+ // Lock access for the duration of this transaction.
+ TAO_POA_GUARD_RETURN (0);
+
+ return this->create_reference_i (intf,
+ priority
+ ACE_ENV_ARG_PARAMETER);
+}
+
+ACE_INLINE CORBA::Object_ptr
+TAO_RT_POA::create_reference_with_id_and_priority (const PortableServer::ObjectId & oid,
+ const char * intf,
+ RTCORBA::Priority priority
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::WrongPolicy))
+{
+ // Check that this method can be used based on this POA's policies.
+ this->validate_policies (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Object::_nil ());
+
+ this->validate_priority (priority ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Object::_nil ());
+
+ // Lock access for the duration of this transaction.
+ TAO_POA_GUARD_RETURN (0);
+
+ return this->create_reference_with_id_i (oid,
+ intf,
+ priority
+ ACE_ENV_ARG_PARAMETER);
+}
+
+ACE_INLINE PortableServer::ObjectId *
+TAO_RT_POA::activate_object_with_priority (PortableServer::Servant servant,
+ RTCORBA::Priority priority
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ServantAlreadyActive,
+ PortableServer::POA::WrongPolicy))
+{
+ // Check that this method can be used based on this POA's policies.
+ this->validate_policies (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ this->validate_priority (priority ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ while (1)
+ {
+ int wait_occurred_restart_call = 0;
+
+ // Lock access for the duration of this transaction.
+ TAO_POA_GUARD_RETURN (0);
+
+ PortableServer::ObjectId *result =
+ this->activate_object_i (servant,
+ priority,
+ wait_occurred_restart_call
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ // If we ended up waiting on a condition variable, the POA state
+ // may have changed while we are waiting. Therefore, we need to
+ // restart this call.
+ if (wait_occurred_restart_call)
+ continue;
+ else
+ return result;
+ }
+}
+
+ACE_INLINE void
+TAO_RT_POA::activate_object_with_id_and_priority (const PortableServer::ObjectId & oid,
+ PortableServer::Servant servant,
+ RTCORBA::Priority priority
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableServer::POA::ServantAlreadyActive,
+ PortableServer::POA::ObjectAlreadyActive,
+ PortableServer::POA::WrongPolicy))
+{
+ // Check that this method can be used based on this POA's policies.
+ this->validate_policies (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->validate_priority (priority ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ while (1)
+ {
+ int wait_occurred_restart_call = 0;
+
+ // Lock access for the duration of this transaction.
+ TAO_POA_GUARD;
+
+ this->activate_object_with_id_i (oid,
+ servant,
+ priority,
+ wait_occurred_restart_call
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // If we ended up waiting on a condition variable, the POA state
+ // may have changed while we are waiting. Therefore, we need to
+ // restart this call.
+ if (wait_occurred_restart_call)
+ continue;
+ else
+ return;
+ }
+}
+
+ACE_INLINE void *
+TAO_RT_POA::thread_pool (void) const
+{
+ return this->thread_pool_;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/RTPortableServer/RT_Policy_Validator.cpp b/TAO/tao/RTPortableServer/RT_Policy_Validator.cpp
new file mode 100644
index 00000000000..4e11afb2d2e
--- /dev/null
+++ b/TAO/tao/RTPortableServer/RT_Policy_Validator.cpp
@@ -0,0 +1,602 @@
+#include "tao/RTPortableServer/RT_Policy_Validator.h"
+
+#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
+
+#include "tao/PortableServer/POA_Cached_Policies.h"
+#include "tao/PortableServer/PortableServer.h"
+#include "tao/RTCORBA/RT_Policy_i.h"
+#include "tao/RTCORBA/Thread_Pool.h"
+#include "tao/RTCORBA/RT_ORB.h"
+#include "tao/Thread_Lane_Resources_Manager.h"
+#include "tao/Thread_Lane_Resources.h"
+#include "tao/Acceptor_Registry.h"
+#include "tao/ORB_Core.h"
+#include "tao/Policy_Set.h"
+#include "tao/Transport_Acceptor.h"
+
+ACE_RCSID (RTPortableServer,
+ RT_Policy_Validator,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_POA_RT_Policy_Validator::TAO_POA_RT_Policy_Validator (TAO_ORB_Core &orb_core)
+ : TAO_Policy_Validator (orb_core),
+ thread_pool_ (0)
+{
+ // No-Op.
+}
+
+TAO_POA_RT_Policy_Validator::~TAO_POA_RT_Policy_Validator (void)
+{
+ // No-Op.
+}
+
+void
+TAO_POA_RT_Policy_Validator::validate_impl (TAO_Policy_Set &policies
+ ACE_ENV_ARG_DECL)
+{
+ this->validate_thread_pool (policies ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->validate_server_protocol (policies ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->validate_priorities (policies ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+CORBA::Boolean
+TAO_POA_RT_Policy_Validator::legal_policy_impl (CORBA::PolicyType type)
+{
+ return (type == RTCORBA::PRIORITY_MODEL_POLICY_TYPE ||
+ type == RTCORBA::THREADPOOL_POLICY_TYPE ||
+ type == RTCORBA::CLIENT_PROTOCOL_POLICY_TYPE ||
+ type == RTCORBA::SERVER_PROTOCOL_POLICY_TYPE ||
+ type == RTCORBA::PRIORITY_BANDED_CONNECTION_POLICY_TYPE);
+}
+
+void
+TAO_POA_RT_Policy_Validator::validate_server_protocol (TAO_Policy_Set &policies
+ ACE_ENV_ARG_DECL)
+{
+ // Make sure we have an endpoint for at least one of the protocols
+ // specified in the RTCORBA::ServerProtocolPolicy. This ensure we
+ // will be able to create non-nil object references.
+ CORBA::Policy_var protocol =
+ policies.get_cached_policy (TAO_CACHED_POLICY_RT_SERVER_PROTOCOL
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (CORBA::is_nil (protocol.in ()))
+ {
+ // If the server protocol policy has not been specified, then
+ // add a server policy that reflects the protocols supported by
+ // the acceptor registries of the POA's thread pool.
+ protocol =
+ TAO_POA_RT_Policy_Validator::server_protocol_policy_from_thread_pool (this->thread_pool_,
+ this->orb_core_);
+
+ if (!CORBA::is_nil (protocol.in ()))
+ {
+ // If so, we'll use that policy.
+ policies.set_policy (protocol.in () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ }
+
+ RTCORBA::ServerProtocolPolicy_var server_protocol_policy =
+ RTCORBA::ServerProtocolPolicy::_narrow (protocol.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ TAO_ServerProtocolPolicy *server_protocol =
+ dynamic_cast <TAO_ServerProtocolPolicy *>
+ (server_protocol_policy.in ());
+
+ RTCORBA::ProtocolList &protocols =
+ server_protocol->protocols_rep ();
+
+ for (CORBA::ULong j = 0; j < protocols.length (); ++j)
+ {
+ int found = 0;
+ CORBA::ULong protocol_type = protocols[j].protocol_type;
+
+ if (this->thread_pool_)
+ {
+ TAO_Thread_Lane **lanes =
+ this->thread_pool_->lanes ();
+
+ for (CORBA::ULong i = 0;
+ i != this->thread_pool_->number_of_lanes ();
+ ++i)
+ {
+ TAO_Thread_Lane_Resources &resources =
+ lanes[i]->resources ();
+
+ TAO_Acceptor_Registry &acceptor_registry =
+ resources.acceptor_registry ();
+
+ for (TAO_AcceptorSetIterator a = acceptor_registry.begin ();
+ a != acceptor_registry.end ();
+ ++a)
+ {
+ if ((*a)->tag () == protocol_type)
+ {
+ found = 1;
+ break;
+ }
+ }
+ }
+ }
+ else
+ {
+ TAO_Thread_Lane_Resources_Manager &thread_lane_resources_manager =
+ this->orb_core_.thread_lane_resources_manager ();
+
+ TAO_Thread_Lane_Resources &resources =
+ thread_lane_resources_manager.default_lane_resources ();
+
+ TAO_Acceptor_Registry &acceptor_registry =
+ resources.acceptor_registry ();
+
+ for (TAO_AcceptorSetIterator a = acceptor_registry.begin ();
+ a != acceptor_registry.end ();
+ ++a)
+ {
+ if ((*a)->tag () == protocol_type)
+ {
+ found = 1;
+ break;
+ }
+ }
+ }
+
+ if (!found)
+ ACE_THROW (PortableServer::POA::InvalidPolicy ());
+ }
+}
+
+void
+TAO_POA_RT_Policy_Validator::validate_priorities (TAO_Policy_Set &policies
+ ACE_ENV_ARG_DECL)
+{
+ // Initialize to the default priority/priority model.
+ CORBA::Short priority =
+ TAO_INVALID_PRIORITY;
+ TAO::Portable_Server::Cached_Policies::PriorityModel rt_priority_model =
+ TAO::Portable_Server::Cached_Policies::NOT_SPECIFIED;
+
+ CORBA::Policy_var policy =
+ policies.get_cached_policy (TAO_CACHED_POLICY_PRIORITY_MODEL
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ RTCORBA::PriorityModelPolicy_var priority_model =
+ RTCORBA::PriorityModelPolicy::_narrow (policy.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (!CORBA::is_nil (priority_model.in ()))
+ {
+ priority = priority_model->server_priority (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ rt_priority_model =
+ TAO::Portable_Server::Cached_Policies::PriorityModel (
+ priority_model->priority_model (ACE_ENV_SINGLE_ARG_PARAMETER));
+ ACE_CHECK;
+
+ // Check that the priority is in bounds.
+ if (priority < RTCORBA::minPriority
+ // The line below will always be false unless the value of
+ // RTCORBA::maxPriority, which is now assigned the value of
+ // 32767, is changed in RTCORBA.pidl.
+// || priority > RTCORBA::maxPriority
+ )
+ {
+ ACE_THROW (PortableServer::POA::InvalidPolicy ());
+ }
+ }
+ else
+ // If priority model was not specified, then we better not have a
+ // thread pool with lanes.
+ {
+ if (this->thread_pool_ != 0 &&
+ this->thread_pool_->with_lanes ())
+ ACE_THROW (PortableServer::POA::InvalidPolicy ());
+ }
+
+ policy =
+ policies.get_cached_policy (TAO_CACHED_POLICY_RT_PRIORITY_BANDED_CONNECTION
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ RTCORBA::PriorityBandedConnectionPolicy_var priority_bands
+ = RTCORBA::PriorityBandedConnectionPolicy::_narrow (policy.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ TAO_PriorityBandedConnectionPolicy *bands_policy =
+ dynamic_cast<TAO_PriorityBandedConnectionPolicy *> (priority_bands.in ());
+
+ // If priority banded connections are set, make sure that:
+ // 0. A priority model was specified.
+ // 1. There is at least one band.
+ // 2a. low is not < RTCORBA::minPriority
+ // 2b. low <= high
+ // 2c. high is not > RTCORBA::maxPriority
+ // 3. If priority model is SERVER_DECLARED, server_priority must
+ // match one of the bands.
+ // 4. If this POA has a thread pool with lanes, then for each band,
+ // there must be at least one thread lane that can service it,
+ // i.e., whose priority falls into the band's range.
+ if (bands_policy != 0)
+ {
+ // Checks 0.
+ if (rt_priority_model == TAO::Portable_Server::Cached_Policies::NOT_SPECIFIED)
+ ACE_THROW (PortableServer::POA::InvalidPolicy ());
+
+ RTCORBA::PriorityBands &bands =
+ bands_policy->priority_bands_rep ();
+
+ // Checks 1.
+ if (bands.length () == 0)
+ ACE_THROW (PortableServer::POA::InvalidPolicy ());
+
+ // Checks 2.
+ for (CORBA::ULong i = 0; i < bands.length (); ++i)
+ {
+ // 2a. low is not < RTCORBA::minPriority
+ // 2b. low is not > high
+ // 2c. high is not > RTCORBA::maxPriority
+ if (bands[i].low < RTCORBA::minPriority
+ || bands[i].low > bands[i].high
+ // The line below will always be false unless the value of
+ // RTCORBA::maxPriority, which is now assigned the value of
+ // 32767, is changed in RTCORBA.pidl.
+// || bands[i].high > RTCORBA::maxPriority
+ )
+ {
+ ACE_THROW (PortableServer::POA::InvalidPolicy ());
+ }
+ }
+
+ // Check 3.
+ if (rt_priority_model == TAO::Portable_Server::Cached_Policies::SERVER_DECLARED)
+ {
+ int match = 0;
+ for (CORBA::ULong i = 0; i < bands.length (); ++i)
+ {
+ if (priority <= bands[i].high &&
+ priority >= bands[i].low)
+ {
+ match = 1;
+ break;
+ }
+ }
+
+ if (!match)
+ ACE_THROW (PortableServer::POA::InvalidPolicy ());
+ }
+
+ //
+ // Check 4.
+ //
+
+ // If this POA is using the default thread pool (which doesn't
+ // have lanes) or a thread pool without lanes, we are done with
+ // the checks.
+ if (this->thread_pool_ == 0 ||
+ !this->thread_pool_->with_lanes ())
+ return;
+
+ // If this POA is using a thread pool with lanes, make sure we
+ // have at least one thread lane that corresponds to these
+ // each band.
+ TAO_Thread_Lane **lanes =
+ this->thread_pool_->lanes ();
+
+ for (CORBA::ULong band = 0;
+ band < bands.length ();
+ ++band)
+ {
+ int match = 0;
+ for (CORBA::ULong lane = 0;
+ lane != this->thread_pool_->number_of_lanes () && !match;
+ ++lane)
+ {
+ CORBA::Short lane_priority =
+ lanes[lane]->lane_priority ();
+
+ if (lane_priority <= bands[band].high &&
+ lane_priority >= bands[band].low)
+ match = 1;
+ }
+ if (!match)
+ ACE_THROW (PortableServer::POA::InvalidPolicy ());
+ }
+
+ // Done with checks.
+ return;
+ }
+
+ // If priority banded connections are not set, and the priority
+ // model is SERVER_DECLARED, make sure we have at least one thread
+ // lane that can provide service for the specified SERVER_DECLARED
+ // priority.
+ if (rt_priority_model == TAO::Portable_Server::Cached_Policies::SERVER_DECLARED)
+ {
+ // If this POA is using the default thread pool (which doesn't
+ // have lanes) or a thread pool without lanes, we are done with
+ // the checks.
+ if (this->thread_pool_ == 0 ||
+ !this->thread_pool_->with_lanes ())
+ return;
+
+ // If this POA is using a thread pool with lanes, make sure we
+ // have at least one thread lane that can provide service for
+ // the specified SERVER_DECLARED priority.
+ TAO_Thread_Lane **lanes =
+ this->thread_pool_->lanes ();
+
+ int match = 0;
+ for (CORBA::ULong lane = 0;
+ lane != this->thread_pool_->number_of_lanes () && !match;
+ ++lane)
+ {
+ CORBA::Short lane_priority =
+ lanes[lane]->lane_priority ();
+
+ if (lane_priority <= priority &&
+ lane_priority >= priority)
+ match = 1;
+ }
+ if (!match)
+ ACE_THROW (PortableServer::POA::InvalidPolicy ());
+
+ // Done with checks.
+ return;
+ }
+
+}
+
+void
+TAO_POA_RT_Policy_Validator::validate_thread_pool (TAO_Policy_Set &policies
+ ACE_ENV_ARG_DECL)
+{
+ this->thread_pool_ =
+ TAO_POA_RT_Policy_Validator::extract_thread_pool (this->orb_core_,
+ policies
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+void
+TAO_POA_RT_Policy_Validator::merge_policies_impl (TAO_Policy_Set &policies
+ ACE_ENV_ARG_DECL)
+{
+ // Check if the user has specified the priority model policy.
+ CORBA::Policy_var priority_model =
+ policies.get_cached_policy (TAO_CACHED_POLICY_PRIORITY_MODEL
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (CORBA::is_nil (priority_model.in ()))
+ {
+ // If not, check if the priority model policy has been specified
+ // at the ORB level.
+ priority_model =
+ this->orb_core_.get_cached_policy (TAO_CACHED_POLICY_PRIORITY_MODEL
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (!CORBA::is_nil (priority_model.in ()))
+ {
+ // If so, we'll use that policy.
+ policies.set_policy (priority_model.in () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ }
+
+ // Check if the user has specified the server protocol policy.
+ CORBA::Policy_var server_protocol =
+ policies.get_cached_policy (TAO_CACHED_POLICY_RT_SERVER_PROTOCOL
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (CORBA::is_nil (server_protocol.in ()))
+ {
+ // If not, check if the server protocol policy has been
+ // specified at the ORB level.
+ server_protocol =
+ this->orb_core_.get_cached_policy (
+ TAO_CACHED_POLICY_RT_SERVER_PROTOCOL
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (!CORBA::is_nil (server_protocol.in ()))
+ {
+ // If so, we'll use that policy.
+ policies.set_policy (server_protocol.in () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ }
+
+ // Check if the user has specified the thread pool policy.
+ CORBA::Policy_var thread_pool =
+ policies.get_cached_policy (TAO_CACHED_POLICY_THREADPOOL
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (CORBA::is_nil (thread_pool.in ()))
+ {
+ // If not, check if the thread pool policy has been specified at
+ // the ORB level.
+ thread_pool =
+ this->orb_core_.get_cached_policy (TAO_CACHED_POLICY_THREADPOOL
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (!CORBA::is_nil (thread_pool.in ()))
+ {
+ // If so, we'll use that policy.
+ policies.set_policy (thread_pool.in () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ }
+}
+
+/* static */
+RTCORBA::ServerProtocolPolicy_ptr
+TAO_POA_RT_Policy_Validator::server_protocol_policy_from_thread_pool (TAO_Thread_Pool *thread_pool,
+ TAO_ORB_Core &orb_core)
+{
+ RTCORBA::ProtocolList protocols;
+
+ if (thread_pool)
+ {
+ TAO_Thread_Lane **lanes =
+ thread_pool->lanes ();
+
+ for (CORBA::ULong i = 0;
+ i != thread_pool->number_of_lanes ();
+ ++i)
+ {
+ TAO_Thread_Lane_Resources &resources =
+ lanes[i]->resources ();
+
+ TAO_Acceptor_Registry &acceptor_registry =
+ resources.acceptor_registry ();
+
+ TAO_POA_RT_Policy_Validator::server_protocol_policy_from_acceptor_registry (protocols,
+ acceptor_registry,
+ orb_core);
+ }
+ }
+ else
+ {
+ TAO_Thread_Lane_Resources_Manager &thread_lane_resources_manager =
+ orb_core.thread_lane_resources_manager ();
+
+ TAO_Thread_Lane_Resources &resources =
+ thread_lane_resources_manager.default_lane_resources ();
+
+ TAO_Acceptor_Registry &acceptor_registry =
+ resources.acceptor_registry ();
+
+ TAO_POA_RT_Policy_Validator::server_protocol_policy_from_acceptor_registry (protocols,
+ acceptor_registry,
+ orb_core);
+ }
+
+ // Set ServerProtocolPolicy.
+ TAO_ServerProtocolPolicy *server_protocol_policy = 0;
+ ACE_NEW_RETURN (server_protocol_policy,
+ TAO_ServerProtocolPolicy (protocols),
+ 0);
+
+ return server_protocol_policy;
+}
+
+/* static */
+void
+TAO_POA_RT_Policy_Validator::server_protocol_policy_from_acceptor_registry (RTCORBA::ProtocolList &protocols,
+ TAO_Acceptor_Registry &acceptor_registry,
+ TAO_ORB_Core &orb_core)
+{
+ TAO_AcceptorSetIterator end =
+ acceptor_registry.end ();
+
+ for (TAO_AcceptorSetIterator acceptor =
+ acceptor_registry.begin ();
+ acceptor != end;
+ ++acceptor)
+ {
+ if (*acceptor == 0)
+ continue;
+
+ CORBA::ULong current_length =
+ protocols.length ();
+
+ // Make sure that this protocol is not already in the protocol
+ // list.
+ bool protocol_already_present = false;
+ for (CORBA::ULong i = 0;
+ i < current_length && !protocol_already_present;
+ ++i)
+ {
+ if (protocols[i].protocol_type == (*acceptor)->tag ())
+ protocol_already_present = true;
+ }
+
+ if (protocol_already_present)
+ continue;
+
+ protocols.length (current_length + 1);
+
+ protocols[current_length].protocol_type =
+ (*acceptor)->tag ();
+
+ protocols[current_length].orb_protocol_properties =
+ RTCORBA::ProtocolProperties::_nil ();
+
+ protocols[current_length].transport_protocol_properties =
+ TAO_Protocol_Properties_Factory::create_transport_protocol_property ((*acceptor)->tag (),
+ &orb_core);
+ }
+}
+
+/* static */
+TAO_Thread_Pool *
+TAO_POA_RT_Policy_Validator::extract_thread_pool (TAO_ORB_Core &orb_core,
+ TAO_Policy_Set &policies
+ ACE_ENV_ARG_DECL)
+{
+ CORBA::Policy_var policy =
+ policies.get_cached_policy (TAO_CACHED_POLICY_THREADPOOL
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ RTCORBA::ThreadpoolPolicy_var thread_pool_policy =
+ RTCORBA::ThreadpoolPolicy::_narrow (policy.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ if (CORBA::is_nil (thread_pool_policy.in ()))
+ return 0;
+
+ RTCORBA::ThreadpoolId thread_pool_id =
+ thread_pool_policy->threadpool (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ // Get the RTORB.
+ CORBA::Object_var object =
+ orb_core.resolve_rt_orb ();
+
+ RTCORBA::RTORB_var rt_orb =
+ RTCORBA::RTORB::_narrow (object.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ TAO_RT_ORB *tao_rt_orb =
+ dynamic_cast <TAO_RT_ORB *> (rt_orb.in ());
+
+ TAO_Thread_Pool_Manager &tp_manager =
+ tao_rt_orb->tp_manager ();
+
+ TAO_Thread_Pool *thread_pool =
+ tp_manager.get_threadpool (thread_pool_id ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ if (thread_pool == 0)
+ ACE_THROW_RETURN (PortableServer::POA::InvalidPolicy (),
+ 0);
+
+ return thread_pool;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0 */
diff --git a/TAO/tao/RTPortableServer/RT_Policy_Validator.h b/TAO/tao/RTPortableServer/RT_Policy_Validator.h
new file mode 100644
index 00000000000..2f96666c544
--- /dev/null
+++ b/TAO/tao/RTPortableServer/RT_Policy_Validator.h
@@ -0,0 +1,102 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file RT_Policy_Validator.h
+ *
+ * $Id$
+ *
+ * This file contains the declaration for the RTCORBA policy validator.
+ *
+ * @author Angelo Corsaro <corsaro@cs.wustl.edu>
+ * @author Frank Hunleth <fhuntleth@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_RT_POLICY_VALIDATOR_H_
+#define TAO_RT_POLICY_VALIDATOR_H_
+
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/RTPortableServer/rtportableserver_export.h"
+#include "tao/Policy_Validator.h"
+#include "tao/RTCORBA/RTCORBA.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_ORB_Core;
+class TAO_Acceptor_Registry;
+class TAO_Thread_Pool;
+
+class TAO_RTPortableServer_Export TAO_POA_RT_Policy_Validator
+ : public TAO_Policy_Validator
+{
+public:
+ /// Constructor.
+ TAO_POA_RT_Policy_Validator (TAO_ORB_Core &orb_core);
+
+ /// Destructor.
+ ~TAO_POA_RT_Policy_Validator (void);
+
+ static RTCORBA::ServerProtocolPolicy_ptr server_protocol_policy_from_thread_pool (TAO_Thread_Pool *thread_pool,
+ TAO_ORB_Core &orb_core);
+
+ static void server_protocol_policy_from_acceptor_registry (RTCORBA::ProtocolList &protocols,
+ TAO_Acceptor_Registry &acceptor_registry,
+ TAO_ORB_Core &orb_core);
+
+ static TAO_Thread_Pool *extract_thread_pool (TAO_ORB_Core &orb_core,
+ TAO_Policy_Set &policies
+ ACE_ENV_ARG_DECL);
+
+protected:
+
+ /**
+ * Validate that the policies in the specified set
+ * are consistent and legal. Throw an appropriate exception
+ * if that is not the case.
+ */
+ void validate_impl (TAO_Policy_Set &policies
+ ACE_ENV_ARG_DECL);
+
+ /// Add/merge policies.
+ void merge_policies_impl (TAO_Policy_Set &policies
+ ACE_ENV_ARG_DECL);
+
+ /**
+ * Return whether the specified policy type is legal for the
+ * current configuration. This is needed since the user can
+ * potentially specify policies that are unknown to an
+ * validate () routine, and these need to be caught.
+ */
+ virtual CORBA::Boolean legal_policy_impl (CORBA::PolicyType type);
+
+private:
+ void validate_server_protocol (TAO_Policy_Set &policies
+ ACE_ENV_ARG_DECL);
+
+ void validate_priorities (TAO_Policy_Set &policies
+ ACE_ENV_ARG_DECL);
+
+ void validate_thread_pool (TAO_Policy_Set &policies
+ ACE_ENV_ARG_DECL);
+
+ TAO_Thread_Pool *thread_pool_;
+
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_RT_POLICY_VALIDATOR_H_ */
diff --git a/TAO/tao/RTPortableServer/RT_Servant_Dispatcher.cpp b/TAO/tao/RTPortableServer/RT_Servant_Dispatcher.cpp
new file mode 100644
index 00000000000..25b735ea832
--- /dev/null
+++ b/TAO/tao/RTPortableServer/RT_Servant_Dispatcher.cpp
@@ -0,0 +1,403 @@
+
+#include "tao/RTPortableServer/RT_Servant_Dispatcher.h"
+
+#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
+
+#include "tao/RTPortableServer/RT_POA.h"
+
+#include "tao/ORB_Core.h"
+#include "tao/ORB_Core_TSS_Resources.h"
+#include "tao/TAO_Server_Request.h"
+#include "tao/Transport.h"
+#include "tao/Connection_Handler.h"
+#include "tao/Service_Context.h"
+#include "tao/Protocols_Hooks.h"
+#include "tao/debug.h"
+#include "tao/CDR.h"
+
+#include "tao/RTCORBA/Thread_Pool.h"
+
+#include "ace/OS_NS_stdio.h"
+#include "ace/OS_NS_string.h"
+
+ACE_RCSID (RTPortableServer,
+ RT_Servant_Dispatcher,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_RT_Servant_Dispatcher::~TAO_RT_Servant_Dispatcher (void)
+{
+}
+
+void
+TAO_RT_Servant_Dispatcher::pre_invoke_remote_request (
+ TAO_Root_POA &poa,
+ CORBA::Short servant_priority,
+ TAO_ServerRequest &req,
+ TAO::Portable_Server::Servant_Upcall::Pre_Invoke_State &pre_invoke_state
+ ACE_ENV_ARG_DECL)
+{
+ TAO_Service_Context &request_service_context =
+ req.request_service_context ();
+ TAO_Service_Context &reply_service_context = req.reply_service_context ();
+
+ TAO_Thread_Pool *thread_pool =
+ static_cast <TAO_Thread_Pool *> (poa.thread_pool ());
+
+ if (thread_pool != 0 &&
+ thread_pool->with_lanes ())
+ {
+ //
+ // We don't mess with the priority of threads in lanes.
+ //
+
+ if (TAO_debug_level > 0)
+ {
+ // Get the ORB_Core's TSS resources.
+ TAO_ORB_Core_TSS_Resources *tss =
+ poa.orb_core ().get_tss_resources ();
+
+ /// Get the lane attribute in TSS.
+ TAO_Thread_Lane *lane =
+ static_cast<TAO_Thread_Lane *> (tss->lane_);
+
+ ACE_ASSERT (lane->pool ().id () ==
+ thread_pool->id ());
+
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("Using thread pool with lane ")
+ ACE_TEXT ("(%P|%t|%d|%d): original thread ")
+ ACE_TEXT ("CORBA/native priority %d/%d not changed\n"),
+ lane->pool ().id (),
+ lane->id (),
+ lane->lane_priority (),
+ lane->native_priority ()));
+ }
+
+ return;
+ }
+
+ // Remember current thread's priority.
+ TAO_Protocols_Hooks *tph =
+ poa.orb_core ().get_protocols_hooks ();
+
+ const char *priority_model = 0;
+ RTCORBA::Priority target_priority = TAO_INVALID_PRIORITY;
+
+ // NOT_SPECIFIED PriorityModel processing.
+ if (poa.priority_model () ==
+ TAO::Portable_Server::Cached_Policies::NOT_SPECIFIED)
+ {
+ priority_model = "RTCORBA::NOT_SPECIFIED";
+ }
+
+ // CLIENT_PROPAGATED PriorityModel processing.
+ else if (poa.priority_model () ==
+ TAO::Portable_Server::Cached_Policies::CLIENT_PROPAGATED)
+ {
+ priority_model = "RTCORBA::CLIENT_PROPAGATED";
+
+ // Attempt to extract client-propagated priority from the
+ // ServiceContextList of the request.
+ const IOP::ServiceContext *context;
+
+ if (request_service_context.get_context (IOP::RTCorbaPriority,
+ &context) == 1)
+ {
+ // Extract the target priority
+ TAO_InputCDR cdr (reinterpret_cast
+ <const char*>
+ (context->context_data.get_buffer ()),
+ context->context_data.length ());
+ CORBA::Boolean byte_order;
+ if ((cdr >> ACE_InputCDR::to_boolean (byte_order)) == 0)
+ ACE_THROW (CORBA::MARSHAL ());
+ cdr.reset_byte_order (static_cast<int> (byte_order));
+
+ if ((cdr >> target_priority) == 0)
+ ACE_THROW (CORBA::MARSHAL ());
+
+ // Save the target priority in the response service
+ // context to propagate back to the client as specified
+ // by the RTCORBA specification.
+ reply_service_context.set_context (*context);
+ }
+ else
+ {
+ // Use default priority if none came in the request.
+ // (Request must have come from a non-RT ORB.)
+ target_priority = poa.server_priority ();
+ }
+ }
+ else
+ // SERVER_DECLARED PriorityModel processing.
+ {
+ priority_model = "RTCORBA::SERVER_DECLARED";
+
+ // Use the request associated with the servant.
+ target_priority = servant_priority;
+ }
+
+ char thread_pool_id[BUFSIZ];
+ if (TAO_debug_level > 0)
+ {
+ if (thread_pool == 0)
+ ACE_OS::strcpy (thread_pool_id,
+ "default thread pool");
+ else
+ ACE_OS::sprintf (thread_pool_id,
+ "thread pool %d",
+ thread_pool->id ());
+ }
+
+ // Target priority is invalid.
+ if (target_priority == TAO_INVALID_PRIORITY)
+ {
+ if (TAO_debug_level > 0)
+ {
+
+// If we are in a multi-threaded configuration, print out the current
+// thread priority.
+#if defined (ACE_HAS_THREADS)
+
+ if (tph->get_thread_CORBA_and_native_priority (
+ pre_invoke_state.original_CORBA_priority_,
+ pre_invoke_state.original_native_priority_
+ ACE_ENV_ARG_PARAMETER) == -1)
+ ACE_THROW (CORBA::DATA_CONVERSION (CORBA::OMGVMCID | 2,
+ CORBA::COMPLETED_NO));
+
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("(%P|%t): %s processing using %s ")
+ ACE_TEXT ("original thread CORBA/native priority %d/%d ")
+ ACE_TEXT ("not changed\n"),
+ ACE_TEXT_CHAR_TO_TCHAR (priority_model),
+ ACE_TEXT_CHAR_TO_TCHAR (thread_pool_id),
+ pre_invoke_state.original_CORBA_priority_,
+ pre_invoke_state.original_native_priority_));
+
+// If we are in a single-threaded configuration, we cannot get the
+// current thread priority. Therefore, print out a simpler message.
+#else /* ACE_HAS_THREADS */
+
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("(%P|%t): %s processing using %s ")
+ ACE_TEXT ("original thread CORBA/native priority ")
+ ACE_TEXT ("not changed\n"),
+ ACE_TEXT_CHAR_TO_TCHAR (priority_model),
+ ACE_TEXT_CHAR_TO_TCHAR (thread_pool_id)));
+
+#endif /* ACE_HAS_THREADS */
+
+ }
+ }
+ else
+ {
+ // Get the current thread's priority.
+
+ if (tph->get_thread_CORBA_and_native_priority (
+ pre_invoke_state.original_CORBA_priority_,
+ pre_invoke_state.original_native_priority_
+ ACE_ENV_ARG_PARAMETER) == -1)
+ ACE_THROW (CORBA::DATA_CONVERSION (CORBA::OMGVMCID | 2,
+ CORBA::COMPLETED_NO));
+
+ // Priority needs to be changed temporarily changed for the
+ // duration of request.
+ if (target_priority != pre_invoke_state.original_CORBA_priority_)
+ {
+ if (tph->set_thread_CORBA_priority (target_priority
+ ACE_ENV_ARG_PARAMETER)
+ == -1)
+ ACE_THROW (CORBA::DATA_CONVERSION (CORBA::OMGVMCID | 2,
+ CORBA::COMPLETED_NO));
+
+ pre_invoke_state.state_ =
+ TAO::Portable_Server::Servant_Upcall::Pre_Invoke_State::PRIORITY_RESET_REQUIRED;
+
+ if (TAO_debug_level > 0)
+ {
+ CORBA::Short native_priority;
+ tph->get_thread_native_priority (native_priority
+ ACE_ENV_ARG_PARAMETER);
+
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("%s processing using %s ")
+ ACE_TEXT ("(%P|%t): original thread CORBA/native priority %d/%d ")
+ ACE_TEXT ("temporarily changed to CORBA/native priority %d/%d\n"),
+ ACE_TEXT_CHAR_TO_TCHAR (priority_model),
+ ACE_TEXT_CHAR_TO_TCHAR (thread_pool_id),
+ pre_invoke_state.original_CORBA_priority_,
+ pre_invoke_state.original_native_priority_,
+ target_priority,
+ native_priority));
+ }
+ }
+ // No change in priority required.
+ else
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("%s processing using %s ")
+ ACE_TEXT ("(%P|%t): original thread CORBA/native priority %d/%d ")
+ ACE_TEXT ("is the same as the target priority\n"),
+ ACE_TEXT_CHAR_TO_TCHAR (priority_model),
+ ACE_TEXT_CHAR_TO_TCHAR (thread_pool_id),
+ pre_invoke_state.original_CORBA_priority_,
+ pre_invoke_state.original_native_priority_));
+ }
+ }
+ }
+
+ CORBA::Policy_var policy =
+ poa.policies ().get_cached_policy (
+ TAO_CACHED_POLICY_RT_SERVER_PROTOCOL
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ CORBA::Boolean set_server_network_priority =
+ tph->set_server_network_priority (req.transport ()->tag (),
+ policy.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ TAO_Connection_Handler *connection_handler =
+ req.transport ()->connection_handler ();
+
+ connection_handler->set_dscp_codepoint (set_server_network_priority);
+}
+
+void
+TAO_RT_Servant_Dispatcher::pre_invoke_collocated_request (TAO_Root_POA &poa,
+ CORBA::Short servant_priority,
+ TAO::Portable_Server::Servant_Upcall::Pre_Invoke_State &pre_invoke_state
+ ACE_ENV_ARG_DECL)
+{
+ TAO_Thread_Pool *thread_pool =
+ static_cast <TAO_Thread_Pool *> (poa.thread_pool ());
+
+ if (thread_pool == 0 ||
+ thread_pool->with_lanes ())
+ {
+ //
+ // We don't mess with the priority of threads in lanes or for
+ // the default thread pool.
+ //
+ return;
+ }
+
+ if (poa.priority_model () !=
+ TAO::Portable_Server::Cached_Policies::SERVER_DECLARED ||
+ servant_priority == TAO_INVALID_PRIORITY)
+ {
+ //
+ // We either don't have server declared model or servant
+ // priority is invalid.
+ //
+ return;
+ }
+
+ //
+ // SERVER_DECLARED PriorityModel processing.
+ //
+
+ // Remember current thread's priority.
+ TAO_Protocols_Hooks *tph =
+ poa.orb_core ().get_protocols_hooks ();
+
+ if (tph->get_thread_CORBA_and_native_priority (pre_invoke_state.original_CORBA_priority_,
+ pre_invoke_state.original_native_priority_
+ ACE_ENV_ARG_PARAMETER)
+ == -1)
+ ACE_THROW (CORBA::DATA_CONVERSION (CORBA::OMGVMCID | 2,
+ CORBA::COMPLETED_NO));
+
+ // Change the priority of the current thread for the duration of
+ // request.
+ if (servant_priority != pre_invoke_state.original_CORBA_priority_)
+ {
+ if (tph->set_thread_CORBA_priority (servant_priority
+ ACE_ENV_ARG_PARAMETER)
+ == -1)
+ ACE_THROW (CORBA::DATA_CONVERSION (CORBA::OMGVMCID | 2,
+ CORBA::COMPLETED_NO));
+
+ pre_invoke_state.state_ =
+ TAO::Portable_Server::Servant_Upcall::Pre_Invoke_State::PRIORITY_RESET_REQUIRED;
+ }
+}
+
+void
+TAO_RT_Servant_Dispatcher::post_invoke (TAO_Root_POA &poa,
+ TAO::Portable_Server::Servant_Upcall::Pre_Invoke_State &pre_invoke_state)
+
+{
+ if (pre_invoke_state.state_ ==
+ TAO::Portable_Server::Servant_Upcall::Pre_Invoke_State::PRIORITY_RESET_REQUIRED)
+ {
+ pre_invoke_state.state_ =
+ TAO::Portable_Server::Servant_Upcall::Pre_Invoke_State::NO_ACTION_REQUIRED;
+
+ ACE_DECLARE_NEW_CORBA_ENV;
+
+ ACE_TRY
+ {
+ // Reset the priority of the current thread back to its original
+ // value.
+ TAO_Protocols_Hooks *tph =
+ poa.orb_core ().get_protocols_hooks ();
+
+ if (tph->set_thread_native_priority (
+ pre_invoke_state.original_native_priority_
+ ACE_ENV_ARG_PARAMETER)
+ == -1)
+ ACE_THROW (CORBA::DATA_CONVERSION (CORBA::OMGVMCID | 2,
+ CORBA::COMPLETED_NO));
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ // Eat up the exception.
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "Exception caught: TAO - "
+ "Priority_Model_Processing::"
+ "~Priority_Model_Processing");
+ }
+ ACE_ENDTRY;
+ }
+}
+
+TAO_Root_POA *
+TAO_RT_Servant_Dispatcher::create_Root_POA (const ACE_CString &name,
+ PortableServer::POAManager_ptr poa_manager,
+ const TAO_POA_Policy_Set &policies,
+ ACE_Lock &lock,
+ TAO_SYNCH_MUTEX &thread_lock,
+ TAO_ORB_Core &orb_core,
+ TAO_Object_Adapter *object_adapter
+ ACE_ENV_ARG_DECL)
+{
+ TAO_RT_POA *poa = 0;
+
+ ACE_NEW_THROW_EX (poa,
+ TAO_RT_POA (name,
+ poa_manager,
+ policies,
+ 0,
+ lock,
+ thread_lock,
+ orb_core,
+ object_adapter
+ ACE_ENV_ARG_PARAMETER),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (0);
+
+ return poa;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
diff --git a/TAO/tao/RTPortableServer/RT_Servant_Dispatcher.h b/TAO/tao/RTPortableServer/RT_Servant_Dispatcher.h
new file mode 100644
index 00000000000..2e3af3ce333
--- /dev/null
+++ b/TAO/tao/RTPortableServer/RT_Servant_Dispatcher.h
@@ -0,0 +1,81 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file RT_Servant_Dispatcher.h
+ *
+ * $Id$
+ *
+ * @author Frank Hunleth (fhunleth@cs.wustl.edu)
+ */
+//=============================================================================
+
+
+#ifndef TAO_RT_SERVANT_DISPATCHER_H
+#define TAO_RT_SERVANT_DISPATCHER_H
+#include /**/ "ace/pre.h"
+
+#include "tao/RTPortableServer/rtportableserver_export.h"
+#include "tao/orbconf.h"
+
+#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
+
+#define TAO_RTCORBA_SAFE_INCLUDE
+#include "tao/RTCORBA/RTCORBAC.h"
+#undef TAO_RTCORBA_SAFE_INCLUDE
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/Servant_Dispatcher.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_RT_Servant_Dispatcher
+ *
+ * @brief Concrete instantiation of the Servant_Dispatcher strategy.
+ *
+ */
+class TAO_RTPortableServer_Export TAO_RT_Servant_Dispatcher
+ : public TAO_Servant_Dispatcher
+{
+public:
+ virtual ~TAO_RT_Servant_Dispatcher (void);
+
+ /// Pre_invoke remote request.
+ void pre_invoke_remote_request (TAO_Root_POA &poa,
+ CORBA::Short servant_priority,
+ TAO_ServerRequest &req,
+ TAO::Portable_Server::Servant_Upcall::Pre_Invoke_State &pre_invoke_state
+ ACE_ENV_ARG_DECL);
+
+ /// Pre_invoke collocated request.
+ void pre_invoke_collocated_request (TAO_Root_POA &poa,
+ CORBA::Short servant_priority,
+ TAO::Portable_Server::Servant_Upcall::Pre_Invoke_State &pre_invoke_state
+ ACE_ENV_ARG_DECL);
+
+ /// Post_invoke request.
+ void post_invoke (TAO_Root_POA &poa,
+ TAO::Portable_Server::Servant_Upcall::Pre_Invoke_State &pre_invoke_state);
+
+ /// Factory method for creating new POA's.
+ TAO_Root_POA *create_Root_POA (const ACE_CString &name,
+ PortableServer::POAManager_ptr poa_manager,
+ const TAO_POA_Policy_Set &policies,
+ ACE_Lock &lock,
+ TAO_SYNCH_MUTEX &thread_lock,
+ TAO_ORB_Core &orb_core,
+ TAO_Object_Adapter *object_adapter
+ ACE_ENV_ARG_DECL);
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_RT_SERVANT_DISPATCHER_H */
diff --git a/TAO/tao/RTPortableServer/TAO_RTPortableServer.pc.in b/TAO/tao/RTPortableServer/TAO_RTPortableServer.pc.in
new file mode 100644
index 00000000000..05f16980cea
--- /dev/null
+++ b/TAO/tao/RTPortableServer/TAO_RTPortableServer.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: TAO_RTPortableServer
+Description: TAO Real-Time PortableServer Library
+Requires: TAO_PortableServer, TAO_RTCORBA, TAO_PI, TAO_CodecFactory, TAO_AnyTypeCode, TAO
+Version: @VERSION@
+Libs: -L${libdir} -lTAO_RTPortableServer
+Cflags: -I${includedir}
diff --git a/TAO/tao/RTPortableServer/TAO_RTPortableServer.rc b/TAO/tao/RTPortableServer/TAO_RTPortableServer.rc
new file mode 100644
index 00000000000..b0eb456a209
--- /dev/null
+++ b/TAO/tao/RTPortableServer/TAO_RTPortableServer.rc
@@ -0,0 +1,30 @@
+#include "..\Version.h"
+
+1 VERSIONINFO
+ FILEVERSION TAO_MAJOR_VERSION,TAO_MINOR_VERSION,TAO_BETA_VERSION,0
+ PRODUCTVERSION TAO_MAJOR_VERSION,TAO_MINOR_VERSION,TAO_BETA_VERSION,0
+ FILEFLAGSMASK 0x3fL
+ FILEFLAGS 0x0L
+ FILEOS 0x4L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904B0"
+ BEGIN
+ VALUE "FileDescription", "RTPortableServer\0"
+ VALUE "FileVersion", TAO_VERSION "\0"
+ VALUE "InternalName", "TAO_RTPortableServerDLL\0"
+ VALUE "LegalCopyright", "\0"
+ VALUE "LegalTrademarks", "\0"
+ VALUE "OriginalFilename", "TAO_RTPortableServer.DLL\0"
+ VALUE "ProductName", "TAO\0"
+ VALUE "ProductVersion", TAO_VERSION "\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
diff --git a/TAO/tao/RTPortableServer/diffs/RTPortableServer_include.diff b/TAO/tao/RTPortableServer/diffs/RTPortableServer_include.diff
new file mode 100644
index 00000000000..5f7c99cbd30
--- /dev/null
+++ b/TAO/tao/RTPortableServer/diffs/RTPortableServer_include.diff
@@ -0,0 +1,11 @@
+--- orig/RTPortableServer_includeC.h 2005-04-12 10:13:57.566584000 +0200
++++ RTPortableServer_includeC.h 2005-04-12 10:13:57.726814400 +0200
+@@ -45,7 +45,7 @@
+ #include "tao/SystemException.h"
+ #include "tao/Environment.h"
+
+-#include "tao/RTPortableServer/RTPortableServerC.h"
++#include "tao/RTPortableServer/RTPortableServer.h"
+
+ #if defined (TAO_EXPORT_MACRO)
+ #undef TAO_EXPORT_MACRO
diff --git a/TAO/tao/RTPortableServer/rtportableserver_export.h b/TAO/tao/RTPortableServer/rtportableserver_export.h
new file mode 100644
index 00000000000..94bb07fc254
--- /dev/null
+++ b/TAO/tao/RTPortableServer/rtportableserver_export.h
@@ -0,0 +1,40 @@
+
+// -*- C++ -*-
+// $Id$
+// Definition for Win32 Export directives.
+// This file is generated automatically by generate_export_file.pl
+// ------------------------------
+#ifndef TAO_RTPORTABLESERVER_EXPORT_H
+#define TAO_RTPORTABLESERVER_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if defined (TAO_AS_STATIC_LIBS)
+# if !defined (TAO_RTPORTABLESERVER_HAS_DLL)
+# define TAO_RTPORTABLESERVER_HAS_DLL 0
+# endif /* ! TAO_RTPORTABLESERVER_HAS_DLL */
+#else
+# if !defined (TAO_RTPORTABLESERVER_HAS_DLL)
+# define TAO_RTPORTABLESERVER_HAS_DLL 1
+# endif /* ! TAO_RTPORTABLESERVER_HAS_DLL */
+#endif
+
+#if defined (TAO_RTPORTABLESERVER_HAS_DLL) && (TAO_RTPORTABLESERVER_HAS_DLL == 1)
+# if defined (TAO_RTPORTABLESERVER_BUILD_DLL)
+# define TAO_RTPortableServer_Export ACE_Proper_Export_Flag
+# define TAO_RTPORTABLESERVER_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# define TAO_RTPORTABLESERVER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# else /* TAO_RTPORTABLESERVER_BUILD_DLL */
+# define TAO_RTPortableServer_Export ACE_Proper_Import_Flag
+# define TAO_RTPORTABLESERVER_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# define TAO_RTPORTABLESERVER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# endif /* TAO_RTPORTABLESERVER_BUILD_DLL */
+#else /* TAO_RTPORTABLESERVER_HAS_DLL == 1 */
+# define TAO_RTPortableServer_Export
+# define TAO_RTPORTABLESERVER_SINGLETON_DECLARATION(T)
+# define TAO_RTPORTABLESERVER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+#endif /* TAO_RTPORTABLESERVER_HAS_DLL == 1 */
+
+#endif /* TAO_RTPORTABLESERVER_EXPORT_H */
+
+// End of auto generated file.
diff --git a/TAO/tao/RTScheduler.mpc b/TAO/tao/RTScheduler.mpc
new file mode 100644
index 00000000000..742f8cba2f6
--- /dev/null
+++ b/TAO/tao/RTScheduler.mpc
@@ -0,0 +1,43 @@
+//$Id$
+project : taolib, rtcorba, pi, pi_server, portableserver, core, corba_messaging, tao_versioning_idl_defaults {
+ sharedname = TAO_RTScheduler
+ dynamicflags = TAO_RTSCHEDULER_BUILD_DLL
+
+ Source_Files {
+ RTScheduling
+ }
+
+ Header_Files {
+ RTScheduling
+ }
+
+ Inline_Files {
+ RTScheduling
+ }
+
+ Template_Files {
+ RTScheduling
+ }
+
+ Resource_Files {
+ RTScheduling
+ }
+
+ PIDL_Files {
+ RTScheduling
+ }
+
+ IDL_Files {
+ idlflags += -Gp -Gd -Ge 1 -Sci -SS -Sorb \
+ -Wb,export_macro=TAO_RTScheduler_Export \
+ -Wb,export_include=tao/RTScheduling/rtscheduler_export.h \
+ -Wb,include_guard=TAO_RTSCHEDULER_SAFE_INCLUDE \
+ -Wb,safe_include=tao/RTScheduling/RTScheduler.h \
+ -o RTScheduling
+ RTScheduling/RTScheduler.pidl
+ }
+
+ Pkgconfig_Files {
+ RTScheduling/TAO_RTScheduler.pc.in
+ }
+}
diff --git a/TAO/tao/RTScheduling/Current.cpp b/TAO/tao/RTScheduling/Current.cpp
new file mode 100644
index 00000000000..08a4c9584f8
--- /dev/null
+++ b/TAO/tao/RTScheduling/Current.cpp
@@ -0,0 +1,994 @@
+#include "tao/RTScheduling/Current.h"
+#include "tao/RTScheduling/Distributable_Thread.h"
+#include "tao/RTCORBA/Priority_Mapping_Manager.h"
+#include "tao/RTCORBA/RT_Current.h"
+#include "tao/ORB_Core.h"
+#include "tao/TSS_Resources.h"
+#include "ace/ACE.h"
+#include "ace/OS_NS_errno.h"
+#include "ace/OS_NS_string.h"
+
+
+ACE_RCSID (RTScheduling,
+ Current,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_Atomic_Op<TAO_SYNCH_MUTEX, long> TAO_RTScheduler_Current::guid_counter;
+
+u_long
+TAO_DTId_Hash::operator () (const IdType &id) const
+{
+ return ACE::hash_pjw ((const char *) id.get_buffer (),
+ id.length ());
+}
+
+TAO_RTScheduler_Current::TAO_RTScheduler_Current (void)
+{
+}
+
+TAO_RTScheduler_Current::~TAO_RTScheduler_Current (void)
+{
+}
+
+void
+TAO_RTScheduler_Current::init (TAO_ORB_Core* orb
+ ACE_ENV_ARG_DECL)
+{
+ this->orb_ = orb;
+
+ // Create the RT_Current.
+ RTCORBA::Current_ptr current;
+ ACE_NEW_THROW_EX (current,
+ TAO_RT_Current (orb),
+ CORBA::NO_MEMORY (CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ this->rt_current_ = current;
+}
+
+void
+TAO_RTScheduler_Current::rt_current (RTCORBA::Current_ptr rt_current)
+{
+ this->rt_current_ = RTCORBA::Current::_duplicate (rt_current);
+}
+
+TAO_ORB_Core*
+TAO_RTScheduler_Current::orb (void)
+{
+ return this->orb_;
+}
+
+DT_Hash_Map*
+TAO_RTScheduler_Current::dt_hash (void)
+{
+ return &this->dt_hash_;
+}
+
+
+void
+TAO_RTScheduler_Current::begin_scheduling_segment (
+ const char * name,
+ CORBA::Policy_ptr sched_param,
+ CORBA::Policy_ptr implicit_sched_param
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ RTScheduling::Current::UNSUPPORTED_SCHEDULING_DISCIPLINE))
+{
+ TAO_RTScheduler_Current_i *impl = this->implementation ();
+
+ if (impl == 0)
+ {
+ ACE_NEW_THROW_EX (impl,
+ TAO_RTScheduler_Current_i (this->orb_,
+ &this->dt_hash_),
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_CHECK;
+
+ this->implementation (impl);
+ }
+
+ impl->begin_scheduling_segment (name,
+ sched_param,
+ implicit_sched_param
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+
+void
+TAO_RTScheduler_Current::update_scheduling_segment (const char * name,
+ CORBA::Policy_ptr sched_param,
+ CORBA::Policy_ptr implicit_sched_param
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ RTScheduling::Current::UNSUPPORTED_SCHEDULING_DISCIPLINE))
+{
+ TAO_RTScheduler_Current_i *impl = this->implementation ();
+
+ if (impl == 0)
+ ACE_THROW (CORBA::BAD_INV_ORDER ());
+
+ impl->update_scheduling_segment (name,
+ sched_param,
+ implicit_sched_param
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+void
+TAO_RTScheduler_Current::end_scheduling_segment (const char * name
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ TAO_RTScheduler_Current_i *impl = this->implementation ();
+
+ if (impl == 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "Missing scheduling context OR DT cancelled\n"));
+ ACE_THROW (CORBA::BAD_INV_ORDER ());
+ return;
+ }
+
+ impl->end_scheduling_segment (name
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+RTScheduling::DistributableThread_ptr
+TAO_RTScheduler_Current::lookup(const RTScheduling::Current::IdType & id
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ RTScheduling::DistributableThread_var DT;
+ int result = this->dt_hash_.find (id,
+ DT);
+ if (result == 0)
+ return DT._retn ();
+ else return RTScheduling::DistributableThread::_nil ();
+}
+
+// returns a null reference if
+// the distributable thread is
+// not known to the local scheduler
+
+RTScheduling::DistributableThread_ptr
+TAO_RTScheduler_Current::spawn (RTScheduling::ThreadAction_ptr start,
+ CORBA::VoidData data,
+ const char* name,
+ CORBA::Policy_ptr sched_param,
+ CORBA::Policy_ptr implicit_sched_param,
+ CORBA::ULong stack_size,
+ RTCORBA::Priority base_priority
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ TAO_RTScheduler_Current_i *impl = this->implementation ();
+
+ if (impl == 0)
+ ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (), 0);
+
+ return impl->spawn (start,
+ data,
+ name,
+ sched_param,
+ implicit_sched_param,
+ stack_size,
+ base_priority
+ ACE_ENV_ARG_PARAMETER);
+}
+
+RTScheduling::Current::IdType *
+TAO_RTScheduler_Current::id (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ TAO_RTScheduler_Current_i *impl = this->implementation ();
+
+ if (impl == 0)
+ ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (), 0);
+
+ return impl->id (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+CORBA::Policy_ptr
+TAO_RTScheduler_Current::scheduling_parameter (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+
+ TAO_RTScheduler_Current_i *impl = this->implementation ();
+
+ if (impl == 0)
+ ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (), 0);
+
+ return impl->scheduling_parameter (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+CORBA::Policy_ptr
+TAO_RTScheduler_Current::implicit_scheduling_parameter (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ TAO_RTScheduler_Current_i *impl = this->implementation ();
+
+ if (impl == 0)
+ ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (), 0);
+
+ return impl->implicit_scheduling_parameter (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+RTScheduling::Current::NameList *
+TAO_RTScheduler_Current::current_scheduling_segment_names (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ TAO_RTScheduler_Current_i *impl = this->implementation ();
+
+ if (impl == 0)
+ ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (), 0);
+
+ return impl->current_scheduling_segment_names (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+RTCORBA::Priority
+TAO_RTScheduler_Current::the_priority (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return this->rt_current_->the_priority (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+void
+TAO_RTScheduler_Current::the_priority (RTCORBA::Priority the_priority
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->rt_current_->the_priority(the_priority
+ ACE_ENV_ARG_PARAMETER);
+}
+
+TAO_RTScheduler_Current_i*
+TAO_RTScheduler_Current::implementation (TAO_RTScheduler_Current_i* new_current)
+{
+ TAO_TSS_Resources *tss =
+ TAO_TSS_Resources::instance ();
+
+ TAO_RTScheduler_Current_i *old =
+ static_cast<TAO_RTScheduler_Current_i *> (tss->rtscheduler_current_impl_);
+ tss->rtscheduler_current_impl_ = new_current;
+
+ return old;
+}
+
+TAO_RTScheduler_Current_i*
+TAO_RTScheduler_Current::implementation (void)
+{
+ TAO_TSS_Resources *tss =
+ TAO_TSS_Resources::instance ();
+
+ TAO_RTScheduler_Current_i* impl =
+ static_cast<TAO_RTScheduler_Current_i *> (tss->rtscheduler_current_impl_);
+ return impl;
+}
+
+TAO_ORB_Core*
+TAO_RTScheduler_Current_i::orb (void)
+{
+ return this->orb_;
+}
+
+DT_Hash_Map*
+TAO_RTScheduler_Current_i::dt_hash (void)
+{
+ return this->dt_hash_;
+}
+
+ RTScheduling::Scheduler_ptr
+TAO_RTScheduler_Current_i::scheduler (void)
+{
+ return RTScheduling::Scheduler::_duplicate (this->scheduler_.in ());
+}
+
+TAO_RTScheduler_Current_i::TAO_RTScheduler_Current_i (TAO_ORB_Core* orb,
+ DT_Hash_Map* dt_hash
+ ACE_ENV_ARG_DECL)
+ :orb_ (orb),
+ dt_ (RTScheduling::DistributableThread::_nil ()),
+ previous_current_ (0),
+ dt_hash_ (dt_hash)
+{
+ CORBA::Object_var scheduler_obj =
+ this->orb_->object_ref_table ().resolve_initial_reference (
+ "RTScheduler");
+
+ this->scheduler_ = RTScheduling::Scheduler::_narrow (scheduler_obj.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+TAO_RTScheduler_Current_i::TAO_RTScheduler_Current_i (
+ TAO_ORB_Core* orb,
+ DT_Hash_Map* dt_hash,
+ RTScheduling::Current::IdType guid,
+ const char * name,
+ CORBA::Policy_ptr sched_param,
+ CORBA::Policy_ptr implicit_sched_param,
+ RTScheduling::DistributableThread_ptr dt,
+ TAO_RTScheduler_Current_i* prev_current
+ ACE_ENV_ARG_DECL)
+ : orb_ (orb),
+ guid_ (guid),
+ name_ (CORBA::string_dup (name)),
+ sched_param_ (sched_param),
+ implicit_sched_param_ (implicit_sched_param),
+ dt_ (RTScheduling::DistributableThread::_duplicate (dt)),
+ previous_current_ (prev_current),
+ dt_hash_ (dt_hash)
+{
+ CORBA::Object_var scheduler_obj =
+ orb->object_ref_table ().resolve_initial_reference (
+ "RTScheduler");
+
+ this->scheduler_ = RTScheduling::Scheduler::_narrow (scheduler_obj.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+TAO_RTScheduler_Current_i::~TAO_RTScheduler_Current_i (void)
+{
+}
+
+void
+TAO_RTScheduler_Current_i::begin_scheduling_segment(
+ const char * name,
+ CORBA::Policy_ptr sched_param,
+ CORBA::Policy_ptr implicit_sched_param
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ RTScheduling::Current::UNSUPPORTED_SCHEDULING_DISCIPLINE))
+{
+ // Check if it is a new Scheduling Segmnet
+ if (this->guid_.length () == 0)
+ {
+ //Generate GUID
+ size_t temp = ++TAO_RTScheduler_Current::guid_counter;
+ this->guid_.length (sizeof(size_t));
+ ACE_OS::memcpy (this->guid_.get_buffer (),
+ &temp,
+ sizeof(size_t));
+
+ size_t guid;
+ ACE_OS::memcpy (&guid,
+ this->guid_.get_buffer (),
+ this->guid_.length ());
+
+
+ // Inform the scheduler of the new scheduling segment.
+ this->scheduler_->begin_new_scheduling_segment (this->guid_,
+ name,
+ sched_param,
+ implicit_sched_param
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (CORBA::is_nil (this->dt_.in ()))
+ //Create new DT.
+ this->dt_ = TAO_DistributableThread_Factory::create_DT ();
+
+ //Add new DT to map
+ int result = this->dt_hash_->bind (this->guid_,
+ this->dt_);
+
+ // Error in binding to the map - cancel thread.
+ if (result != 0)
+ {
+ this->cancel_thread (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ // Remember parameters for the scheduling segment.
+ this->name_ = CORBA::string_dup (name);
+ this->sched_param_ = CORBA::Policy::_duplicate (sched_param);
+ this->implicit_sched_param_ = CORBA::Policy::_duplicate (implicit_sched_param);
+
+ }
+ else //Nested segment
+ {
+ // Check current DT state.
+ if (this->dt_->state () == RTScheduling::DistributableThread::CANCELLED)
+ {
+ this->cancel_thread (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ // Inform scheduler of start of nested scheduling segment.
+ this->scheduler_->begin_nested_scheduling_segment
+ (this->guid_,
+ name,
+ sched_param,
+ implicit_sched_param
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ TAO_TSS_Resources *tss =
+ TAO_TSS_Resources::instance ();
+
+ TAO_RTScheduler_Current_i* new_current = 0;
+ ACE_NEW_THROW_EX (new_current,
+ TAO_RTScheduler_Current_i (this->orb_,
+ this->dt_hash_,
+ this->guid_,
+ name,
+ sched_param,
+ implicit_sched_param,
+ this->dt_.in (),
+ this),
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_CHECK;
+
+ tss->rtscheduler_current_impl_ = new_current;
+ }
+}
+
+void
+TAO_RTScheduler_Current_i::update_scheduling_segment (const char * name,
+ CORBA::Policy_ptr sched_param,
+ CORBA::Policy_ptr implicit_sched_param
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ RTScheduling::Current::UNSUPPORTED_SCHEDULING_DISCIPLINE))
+{
+ // Check if DT has been cancelled
+ if (this->dt_->state () == RTScheduling::DistributableThread::CANCELLED)
+ {
+ this->cancel_thread (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ // Let scheduler know of the updates.
+ this->scheduler_->update_scheduling_segment (this->guid_,
+ name,
+ sched_param,
+ implicit_sched_param
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Remember the new values.
+ this->name_ = CORBA::string_dup (name);
+ this->sched_param_ = CORBA::Policy::_duplicate (sched_param);
+ this->implicit_sched_param_ = CORBA::Policy::_duplicate (implicit_sched_param);
+}
+
+void
+TAO_RTScheduler_Current_i::end_scheduling_segment (const char * name
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ // Check if DT has been cancelled
+ if (this->dt_->state () == RTScheduling::DistributableThread::CANCELLED)
+ {
+ this->cancel_thread (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ if (this->previous_current_ == 0)
+ {
+ // Let the scheduler know that the DT is
+ // terminating.
+ this->scheduler_->end_scheduling_segment(this->guid_,
+ name
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Cleanup DT.
+ this->cleanup_DT ();
+
+ // Cleanup current.
+ this->cleanup_current ();
+
+ // A Nested segment.
+ } else {
+
+ // Inform scheduler of end of nested
+ // scheduling segment.
+ this->scheduler_->end_nested_scheduling_segment (this->guid_,
+ name,
+ this->previous_current_->sched_param_
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Cleanup current.
+ this->cleanup_current ();
+ }
+}
+
+
+// returns a null reference if
+// the distributable thread is
+// not known to the local scheduler
+RTScheduling::DistributableThread_ptr
+TAO_RTScheduler_Current_i::spawn (RTScheduling::ThreadAction_ptr start,
+ CORBA::VoidData data,
+ const char* name,
+ CORBA::Policy_ptr sched_param,
+ CORBA::Policy_ptr implicit_sched_param,
+ CORBA::ULong stack_size,
+ RTCORBA::Priority base_priority
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ // Check if DT has been cancelled.
+ if (this->dt_->state () == RTScheduling::DistributableThread::CANCELLED)
+ {
+ this->cancel_thread (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+ }
+
+ // Create new task for new DT.
+ DTTask *dttask = 0;
+
+ // If no scheduling parameter is specified then use the current
+ // implicit scheduling parameter as the scheduling parameter
+ if (sched_param == 0)
+ sched_param = this->implicit_sched_param_;
+
+ RTScheduling::DistributableThread_var dt = TAO_DistributableThread_Factory::create_DT ();
+ TAO_RTScheduler_Current_i *new_current = 0;
+
+ ACE_NEW_RETURN (new_current,
+ TAO_RTScheduler_Current_i (this->orb_,
+ this->dt_hash_),
+ 0);
+
+ new_current->DT (dt.in ());
+
+ ACE_NEW_RETURN (dttask,
+ DTTask (//thread_manager_,
+ this->orb_,
+ this->dt_hash_,
+ new_current,
+ start,
+ data,
+ name,
+ sched_param,
+ implicit_sched_param),
+ 0);
+
+ if (dttask->activate_task (base_priority,
+ stack_size) == -1)
+ {
+ ACE_ERROR((LM_ERROR,
+ "Unable to activate DistributableThread\n"));
+
+ RTScheduling::DistributableThread::_nil ();
+ }
+
+ return dt._retn ();
+}
+
+int
+DTTask::activate_task (RTCORBA::Priority base_priority,
+ CORBA::ULong stack_size
+ ACE_ENV_ARG_DECL)
+{
+ // Activate thread.
+ long default_flags = THR_NEW_LWP | THR_JOINABLE;
+ long flags =
+ default_flags |
+ this->orb_->orb_params ()->scope_policy () |
+ this->orb_->orb_params ()->sched_policy ();
+
+ CORBA::Object_var object =
+ this->orb_->object_ref_table ().resolve_initial_reference (
+ TAO_OBJID_PRIORITYMAPPINGMANAGER);
+
+ RTCORBA::PriorityMappingManager_var mapping_manager =
+ RTCORBA::PriorityMappingManager::_narrow (object.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ RTCORBA::PriorityMapping *pm =
+ mapping_manager->mapping ();
+
+ RTCORBA::NativePriority native_priority;
+ pm->to_native (base_priority,
+ native_priority);
+
+ size_t stack [1];
+ stack [0] = stack_size;
+ if (this->activate (flags,
+ 1,
+ 0,//force_active
+ native_priority,//priority
+ -1,//grp_id
+ 0,//ACE_Task_Base
+ 0,//thread_handles
+ 0,//stack
+ stack//stack_size
+ ) == -1)
+ {
+ if (ACE_OS::last_error () == EPERM)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("Insufficient privilege to run this test.\n")),
+ -1);
+ }
+ return 0;
+}
+
+DTTask::DTTask (//ACE_Thread_Manager *manager,
+ TAO_ORB_Core *orb,
+ DT_Hash_Map *dt_hash,
+ TAO_RTScheduler_Current_i* new_current,
+ RTScheduling::ThreadAction_ptr start,
+ CORBA::VoidData data,
+ const char *name,
+ CORBA::Policy_ptr sched_param,
+ CORBA::Policy_ptr implicit_sched_param)
+ ://manager_ (manager),
+ orb_ (orb),
+ dt_hash_ (dt_hash),
+ current_ (new_current),
+ start_ (RTScheduling::ThreadAction::_duplicate (start)),
+ data_ (data),
+ name_ (CORBA::string_dup (name)),
+ sched_param_ (CORBA::Policy::_duplicate (sched_param)),
+ implicit_sched_param_ (CORBA::Policy::_duplicate (implicit_sched_param))
+{
+}
+
+DTTask::~DTTask (void)
+{
+ delete this->current_;
+}
+
+int
+DTTask::svc (void)
+{
+ ACE_TRY_NEW_ENV
+ {
+
+ TAO_TSS_Resources *tss =
+ TAO_TSS_Resources::instance ();
+
+ tss->rtscheduler_current_impl_ = this->current_;
+
+ this->current_->begin_scheduling_segment (this->name_.in (),
+ this->sched_param_.in (),
+ this->implicit_sched_param_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ // Invoke entry point into new DT.
+ this->start_->_cxx_do (this->data_
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ this->current_->end_scheduling_segment (this->name_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "Caught exception:");
+ return -1;
+ }
+ ACE_ENDTRY;
+
+ return 0;
+}
+
+RTScheduling::Current::IdType *
+TAO_RTScheduler_Current_i::id (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+
+ RTScheduling::Current::IdType_var guid = this->guid_;
+ return guid._retn ();
+}
+
+
+CORBA::Policy_ptr
+TAO_RTScheduler_Current_i::scheduling_parameter (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return CORBA::Policy::_duplicate (this->sched_param_);
+}
+
+CORBA::Policy_ptr
+TAO_RTScheduler_Current_i::implicit_scheduling_parameter (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return CORBA::Policy::_duplicate (this->implicit_sched_param_);
+}
+
+RTScheduling::Current::NameList *
+TAO_RTScheduler_Current_i::current_scheduling_segment_names (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ RTScheduling::Current::NameList* name_list;
+ ACE_NEW_RETURN (name_list,
+ RTScheduling::Current::NameList,
+ 0);
+
+ TAO_RTScheduler_Current_i* current = this;
+
+ for (int index = 0; current != 0; index++)
+ {
+ name_list->length (index+1);
+ (*name_list) [index] = current->name ();
+ current = current->previous_current_;
+ }
+
+ return name_list;
+}
+
+const char*
+TAO_RTScheduler_Current_i::name (void)
+{
+ return CORBA::string_dup (this->name_.in ());
+}
+
+#if defined (THREAD_CANCELLED)
+#undef THREAD_CANCELLED
+#endif /* THREAD_CANCELLED */
+
+void
+TAO_RTScheduler_Current_i::cancel_thread (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ size_t guid;
+ ACE_OS::memcpy (&guid,
+ this->guid_.get_buffer (),
+ this->guid_.length ());
+
+ ACE_DEBUG ((LM_DEBUG,
+ "Distributable Thread - %d is cancelled\n",
+ guid));
+
+ // Let the scheduler know that the thread has
+ // been cancelled.
+ this->scheduler_->cancel (this->guid_
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->cleanup_DT ();
+
+ // Remove all related nested currents.
+ this->delete_all_currents ();
+
+ // Throw exception.
+ ACE_THROW (CORBA::THREAD_CANCELLED ());
+}
+
+void
+TAO_RTScheduler_Current_i::cleanup_DT (void)
+{
+ // Remove DT from map.
+ this->dt_hash_->unbind (this->guid_);
+}
+
+void
+TAO_RTScheduler_Current_i::cleanup_current (void)
+{
+ TAO_TSS_Resources *tss =
+ TAO_TSS_Resources::instance ();
+
+ tss->rtscheduler_current_impl_ = this->previous_current_;
+
+ // Delete this current.
+ delete this;
+}
+
+void
+TAO_RTScheduler_Current_i::delete_all_currents (void)
+{
+ TAO_RTScheduler_Current_i* current = this;
+
+ while (current != 0)
+ {
+ TAO_RTScheduler_Current_i* prev_current = current->previous_current_;
+ current->cleanup_current ();
+ current = prev_current;
+ }
+
+ TAO_TSS_Resources *tss =
+ TAO_TSS_Resources::instance ();
+
+ tss->rtscheduler_current_impl_ = tss->rtscheduler_previous_current_impl_;
+}
+
+void
+TAO_RTScheduler_Current_i::id (RTScheduling::Current::IdType guid)
+{
+ this->guid_ = guid;
+}
+
+void
+TAO_RTScheduler_Current_i::name (const char * name)
+{
+ this->name_ = CORBA::string_dup (name);
+}
+
+RTScheduling::DistributableThread_ptr
+TAO_RTScheduler_Current_i::DT (void)
+{
+ return this->dt_._retn ();
+}
+
+void
+TAO_RTScheduler_Current_i::DT (RTScheduling::DistributableThread_ptr dt)
+{
+ this->dt_ = RTScheduling::DistributableThread::_duplicate (dt);
+}
+
+void
+TAO_RTScheduler_Current_i::scheduling_parameter (CORBA::Policy_ptr sched_param)
+{
+ this->sched_param_ = CORBA::Policy::_duplicate (sched_param);
+}
+
+void
+TAO_RTScheduler_Current_i::implicit_scheduling_parameter (CORBA::Policy_ptr implicit_sched_param)
+{
+ this->implicit_sched_param_ = CORBA::Policy::_duplicate (implicit_sched_param);
+}
+
+
+// *************************************************************
+
+// *************************************************************
+// Operations for class TAO_RTScheduler_Current_var
+// *************************************************************
+
+TAO_RTScheduler_Current_var::TAO_RTScheduler_Current_var (void) // default constructor
+ : ptr_ (TAO_RTScheduler_Current::_nil ())
+{}
+
+::TAO_RTScheduler_Current_ptr
+TAO_RTScheduler_Current_var::ptr (void) const
+{
+ return this->ptr_;
+}
+
+TAO_RTScheduler_Current_var::TAO_RTScheduler_Current_var (const ::TAO_RTScheduler_Current_var &p)
+ : TAO_Base_var (),
+ ptr_ (TAO_RTScheduler_Current::_duplicate (p.ptr ()))
+{}
+
+TAO_RTScheduler_Current_var::~TAO_RTScheduler_Current_var (void) // destructor
+{
+ ::CORBA::release (this->ptr_);
+}
+
+TAO_RTScheduler_Current_var &
+TAO_RTScheduler_Current_var::operator= (TAO_RTScheduler_Current_ptr p)
+{
+ ::CORBA::release (this->ptr_);
+ this->ptr_ = p;
+ return *this;
+}
+
+TAO_RTScheduler_Current_var &
+TAO_RTScheduler_Current_var::operator= (const ::TAO_RTScheduler_Current_var &p)
+{
+ if (this != &p)
+ {
+ ::CORBA::release (this->ptr_);
+ this->ptr_ = ::TAO_RTScheduler_Current::_duplicate (p.ptr ());
+ }
+ return *this;
+}
+
+TAO_RTScheduler_Current_var::operator const ::TAO_RTScheduler_Current_ptr &() const
+{
+ return this->ptr_;
+}
+
+TAO_RTScheduler_Current_var::operator ::TAO_RTScheduler_Current_ptr &()
+{
+ return this->ptr_;
+}
+
+TAO_RTScheduler_Current_ptr
+TAO_RTScheduler_Current_var::operator-> (void) const
+{
+ return this->ptr_;
+}
+
+TAO_RTScheduler_Current_ptr
+TAO_RTScheduler_Current_var::in (void) const
+{
+ return this->ptr_;
+}
+
+TAO_RTScheduler_Current_ptr &
+TAO_RTScheduler_Current_var::inout (void)
+{
+ return this->ptr_;
+}
+
+TAO_RTScheduler_Current_ptr &
+TAO_RTScheduler_Current_var::out (void)
+{
+ ::CORBA::release (this->ptr_);
+ this->ptr_ = ::TAO_RTScheduler_Current::_nil ();
+ return this->ptr_;
+}
+
+TAO_RTScheduler_Current_ptr
+TAO_RTScheduler_Current_var::_retn (void)
+{
+ // yield ownership of managed obj reference
+ ::TAO_RTScheduler_Current_ptr val = this->ptr_;
+ this->ptr_ = ::TAO_RTScheduler_Current::_nil ();
+ return val;
+}
+
+TAO_RTScheduler_Current_ptr
+TAO_RTScheduler_Current_var::duplicate (TAO_RTScheduler_Current_ptr p)
+{
+ return ::TAO_RTScheduler_Current::_duplicate (p);
+}
+
+void
+TAO_RTScheduler_Current_var::release (TAO_RTScheduler_Current_ptr p)
+{
+ ::CORBA::release (p);
+}
+
+TAO_RTScheduler_Current_ptr
+TAO_RTScheduler_Current_var::nil (void)
+{
+ return ::TAO_RTScheduler_Current::_nil ();
+}
+
+TAO_RTScheduler_Current_ptr
+TAO_RTScheduler_Current_var::narrow (
+ CORBA::Object *p
+ ACE_ENV_ARG_DECL
+ )
+{
+ return ::TAO_RTScheduler_Current::_narrow (p ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::Object *
+TAO_RTScheduler_Current_var::upcast (void *src)
+{
+ TAO_RTScheduler_Current **tmp =
+ static_cast<TAO_RTScheduler_Current **> (src);
+ return *tmp;
+}
+
+TAO_RTScheduler_Current_ptr TAO_RTScheduler_Current::_narrow (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return
+ TAO_RTScheduler_Current::_duplicate (
+ dynamic_cast<TAO_RTScheduler_Current *> (obj)
+ );
+}
+
+TAO_RTScheduler_Current_ptr
+TAO_RTScheduler_Current::_duplicate (TAO_RTScheduler_Current_ptr obj)
+{
+ if (!CORBA::is_nil (obj))
+ obj->_add_ref ();
+ return obj;
+}
+
+const char* TAO_RTScheduler_Current::_interface_repository_id (void) const
+{
+ return "IDL:TAO_RTScheduler_Current:1.0";
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/RTScheduling/Current.h b/TAO/tao/RTScheduling/Current.h
new file mode 100644
index 00000000000..0189511e16f
--- /dev/null
+++ b/TAO/tao/RTScheduling/Current.h
@@ -0,0 +1,391 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Current.h
+ *
+ * $Id$
+ *
+ * @author
+ */
+//=============================================================================
+
+
+#ifndef TAO_RTSCHEDULER_CURRENT_H
+#define TAO_RTSCHEDULER_CURRENT_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/RTScheduling/rtscheduler_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/RTScheduling/RTScheduler.h"
+#include "tao/LocalObject.h"
+#include "ace/Hash_Map_Manager_T.h"
+#include "ace/Task.h"
+#include "ace/Atomic_Op.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_RTScheduler_Current_i;
+class TAO_TSS_Resources;
+
+/**
+ * @class TAO_DTId_Hash
+ *
+ * @brief Hashing class for Distributable Thread Ids.
+ *
+ * Define the hash() method for Object Ids.
+ */
+
+typedef TAO::unbounded_value_sequence<CORBA::Octet> IdType;
+
+class TAO_RTScheduler_Export TAO_DTId_Hash
+{
+public:
+
+ /// Returns hash value.
+ u_long operator () (const IdType &id) const;
+};
+
+
+typedef ACE_Hash_Map_Manager_Ex<IdType,
+ RTScheduling::DistributableThread_var,
+ TAO_DTId_Hash,
+ ACE_Equal_To<IdType>,
+ TAO_SYNCH_MUTEX>
+ DT_Hash_Map;
+
+typedef ACE_Hash_Map_Iterator_Ex<IdType,
+ RTScheduling::DistributableThread_var,
+ TAO_DTId_Hash,
+ ACE_Equal_To<IdType>,
+ TAO_SYNCH_MUTEX>
+ DT_Hash_Map_Iterator;
+
+typedef ACE_Hash_Map_Entry<IdType,
+ RTScheduling::DistributableThread_var>
+ DT_Hash_Map_Entry;
+
+class TAO_RTScheduler_Current;
+class TAO_RTScheduler_Current_var;
+
+typedef TAO_RTScheduler_Current* TAO_RTScheduler_Current_ptr;
+
+class TAO_RTScheduler_Export TAO_RTScheduler_Current
+ : public RTScheduling::Current,
+ public TAO_Local_RefCounted_Object
+{
+ public:
+ static ACE_Atomic_Op<TAO_SYNCH_MUTEX, long> guid_counter;
+
+ TAO_RTScheduler_Current (void);
+ virtual ~TAO_RTScheduler_Current (void);
+
+ void init (TAO_ORB_Core* orb
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ virtual RTCORBA::Priority the_priority (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual void the_priority (RTCORBA::Priority the_priority
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ void rt_current (RTCORBA::Current_ptr rt_current);
+
+ virtual void begin_scheduling_segment
+ (const char * name,
+ CORBA::Policy_ptr sched_param,
+ CORBA::Policy_ptr implicit_sched_param
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ RTScheduling::Current::UNSUPPORTED_SCHEDULING_DISCIPLINE));
+
+ virtual void update_scheduling_segment
+ (const char * name,
+ CORBA::Policy_ptr sched_param,
+ CORBA::Policy_ptr implicit_sched_param
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ RTScheduling::Current::UNSUPPORTED_SCHEDULING_DISCIPLINE));
+
+ virtual void end_scheduling_segment
+ (const char * name
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual RTScheduling::DistributableThread_ptr
+ lookup(const RTScheduling::Current::IdType & id
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ // returns a null reference if
+ // the distributable thread is
+ // not known to the local scheduler
+
+ virtual RTScheduling::DistributableThread_ptr
+ spawn (RTScheduling::ThreadAction_ptr start,
+ CORBA::VoidData data,
+ const char* name,
+ CORBA::Policy_ptr sched_param,
+ CORBA::Policy_ptr implicit_sched_param,
+ CORBA::ULong stack_size,
+ RTCORBA::Priority base_priority
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual ::RTScheduling::Current::IdType *
+ id (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual ::CORBA::Policy_ptr
+ scheduling_parameter (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual ::CORBA::Policy_ptr
+ implicit_scheduling_parameter (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual ::RTScheduling::Current::NameList *
+ current_scheduling_segment_names (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ TAO_RTScheduler_Current_i* implementation (void);
+
+ TAO_RTScheduler_Current_i* implementation (TAO_RTScheduler_Current_i*);
+
+ TAO_ORB_Core* orb (void);
+
+ DT_Hash_Map* dt_hash (void);
+
+ /**
+ * @name Reference Related Methods
+ */
+ //@{
+ typedef TAO_RTScheduler_Current_ptr _ptr_type;
+ typedef TAO_RTScheduler_Current_var _var_type;
+
+ static TAO_RTScheduler_Current_ptr _duplicate (TAO_RTScheduler_Current_ptr obj);
+
+ static TAO_RTScheduler_Current_ptr _narrow (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+
+ static TAO_RTScheduler_Current_ptr _nil (void)
+ {
+ return (TAO_RTScheduler_Current_ptr)0;
+ }
+
+ virtual const char* _interface_repository_id (void) const;
+ //@}
+
+ private:
+ RTCORBA::Current_var rt_current_;
+ TAO_ORB_Core* orb_;
+ DT_Hash_Map dt_hash_;
+
+};
+
+
+
+/**
+ * @class TAO_RTScheduler_Current_var
+ */
+class TAO_RTScheduler_Export TAO_RTScheduler_Current_var
+ : private TAO_Base_var
+{
+public:
+
+ TAO_RTScheduler_Current_var (void); // default constructor
+ TAO_RTScheduler_Current_var (TAO_RTScheduler_Current_ptr p) : ptr_ (p) {}
+ TAO_RTScheduler_Current_var (const TAO_RTScheduler_Current_var &); // copy constructor
+ ~TAO_RTScheduler_Current_var (void); // destructor
+
+ TAO_RTScheduler_Current_var &operator= (TAO_RTScheduler_Current_ptr);
+ TAO_RTScheduler_Current_var &operator= (const TAO_RTScheduler_Current_var &);
+ TAO_RTScheduler_Current_ptr operator-> (void) const;
+
+ operator const TAO_RTScheduler_Current_ptr &() const;
+ operator TAO_RTScheduler_Current_ptr &();
+ // in, inout, out, _retn
+ TAO_RTScheduler_Current_ptr in (void) const;
+ TAO_RTScheduler_Current_ptr &inout (void);
+ TAO_RTScheduler_Current_ptr &out (void);
+ TAO_RTScheduler_Current_ptr _retn (void);
+ TAO_RTScheduler_Current_ptr ptr (void) const;
+
+ // Hooks used by template sequence and object manager classes
+ // for non-defined forward declared interfaces.
+ static TAO_RTScheduler_Current_ptr duplicate (TAO_RTScheduler_Current_ptr);
+ static void release (TAO_RTScheduler_Current_ptr);
+ static TAO_RTScheduler_Current_ptr nil (void);
+ static TAO_RTScheduler_Current_ptr narrow (
+ CORBA::Object *
+ ACE_ENV_ARG_DECL_NOT_USED
+ );
+ static CORBA::Object * upcast (void *);
+
+private:
+
+ TAO_RTScheduler_Current_ptr ptr_;
+ // Unimplemented - prevents widening assignment.
+ TAO_RTScheduler_Current_var (const TAO_Base_var &rhs);
+ TAO_RTScheduler_Current_var &operator= (const TAO_Base_var &rhs);
+
+};
+
+
+class TAO_RTScheduler_Export TAO_RTScheduler_Current_i
+{
+ public:
+
+ TAO_RTScheduler_Current_i (TAO_ORB_Core* orb,
+ DT_Hash_Map* dt_hash
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ TAO_RTScheduler_Current_i (TAO_ORB_Core* orb,
+ DT_Hash_Map* dt_hash,
+ RTScheduling::Current::IdType guid,
+ const char * name,
+ CORBA::Policy_ptr sched_param,
+ CORBA::Policy_ptr implicit_sched_param,
+ RTScheduling::DistributableThread_ptr dt,
+ TAO_RTScheduler_Current_i* prev_current
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ virtual ~TAO_RTScheduler_Current_i (void);
+
+ virtual RTScheduling::DistributableThread_ptr
+ spawn (RTScheduling::ThreadAction_ptr start,
+ CORBA::VoidData data,
+ const char* name,
+ CORBA::Policy_ptr sched_param,
+ CORBA::Policy_ptr implicit_sched_param,
+ CORBA::ULong stack_size,
+ RTCORBA::Priority base_priority
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual void begin_scheduling_segment
+ (const char * name,
+ CORBA::Policy_ptr sched_param,
+ CORBA::Policy_ptr implicit_sched_param
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ RTScheduling::Current::UNSUPPORTED_SCHEDULING_DISCIPLINE));
+
+ virtual void update_scheduling_segment
+ (const char * name,
+ CORBA::Policy_ptr sched_param,
+ CORBA::Policy_ptr implicit_sched_param
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ RTScheduling::Current::UNSUPPORTED_SCHEDULING_DISCIPLINE));
+
+ virtual void end_scheduling_segment
+ (const char * name
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual RTScheduling::Current::IdType *
+ id (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+
+ void id (RTScheduling::Current::IdType guid );
+
+ virtual CORBA::Policy_ptr
+ scheduling_parameter (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual CORBA::Policy_ptr
+ implicit_scheduling_parameter (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+
+ void scheduling_parameter (CORBA::Policy_ptr);
+
+ void implicit_scheduling_parameter (CORBA::Policy_ptr);
+
+ virtual RTScheduling::Current::NameList *
+ current_scheduling_segment_names (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ void cancel_thread (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ void cleanup_DT (void);
+
+ void cleanup_current (void);
+
+ void delete_all_currents (void);
+
+ const char* name (void);
+ void name (const char *);
+
+ TAO_ORB_Core* orb (void);
+
+ RTScheduling::Scheduler_ptr scheduler (void);
+
+ DT_Hash_Map* dt_hash (void);
+
+ RTScheduling::DistributableThread_ptr DT (void);
+ void DT (RTScheduling::DistributableThread_ptr);
+
+ private:
+ RTScheduling::Scheduler_var scheduler_;
+ TAO_ORB_Core* orb_;
+ RTScheduling::Current::IdType guid_;
+ CORBA::String_var name_;
+ CORBA::Policy_ptr sched_param_;
+ CORBA::Policy_ptr implicit_sched_param_;
+ RTScheduling::DistributableThread_var dt_;
+ TAO_RTScheduler_Current_i* previous_current_;
+ DT_Hash_Map* dt_hash_;
+};
+
+// This class provides an entry point for the// new DT.
+class DTTask : public ACE_Task <ACE_SYNCH>
+{
+public:
+ DTTask (//ACE_Thread_Manager manager,
+ TAO_ORB_Core* orb,
+ DT_Hash_Map* dt_hash,
+ TAO_RTScheduler_Current_i*,
+ RTScheduling::ThreadAction_ptr start,
+ CORBA::VoidData data,
+ const char* name,
+ CORBA::Policy_ptr sched_param,
+ CORBA::Policy_ptr implicit_sched_param);
+
+ virtual ~DTTask (void);
+
+ int activate_task (RTCORBA::Priority base_priority,
+ CORBA::ULong stack_size
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ virtual int svc (void);
+
+ private:
+ //ACE_Thread_Manager* manager_;
+ TAO_ORB_Core* orb_;
+ DT_Hash_Map* dt_hash_;
+ TAO_RTScheduler_Current_i* current_;
+ RTScheduling::ThreadAction_var start_;
+ CORBA::VoidData data_;
+ RTScheduling::Current::IdType guid_;
+ CORBA::String_var name_;
+ CORBA::Policy_var sched_param_;
+ CORBA::Policy_var implicit_sched_param_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_RTSCHEDULER_CURRENT_H*/
diff --git a/TAO/tao/RTScheduling/Distributable_Thread.cpp b/TAO/tao/RTScheduling/Distributable_Thread.cpp
new file mode 100644
index 00000000000..87c9e02a245
--- /dev/null
+++ b/TAO/tao/RTScheduling/Distributable_Thread.cpp
@@ -0,0 +1,53 @@
+//$Id$
+
+#include "tao/RTScheduling/Distributable_Thread.h"
+#include "tao/ORB_Constants.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_DistributableThread::TAO_DistributableThread (void)
+ :state_ (RTScheduling::DistributableThread::ACTIVE)
+{
+}
+
+TAO_DistributableThread::~TAO_DistributableThread (void)
+{
+}
+
+void
+TAO_DistributableThread::cancel (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->state_ = RTScheduling::DistributableThread::CANCELLED;
+}
+
+RTScheduling::DistributableThread::DT_State
+TAO_DistributableThread::state (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return this->state_;
+}
+
+RTScheduling::DistributableThread_ptr
+TAO_DistributableThread_Factory::create_DT (void)
+{
+ ACE_DECLARE_NEW_CORBA_ENV;
+ TAO_DistributableThread* DT = 0;
+
+ ACE_NEW_THROW_EX (DT,
+ TAO_DistributableThread,
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (0);
+
+ //RTScheduling::DistributableThread_var dt = RTScheduling::DistributableThread::_narrow (DT
+ // ACE_ENV_ARG_PARAMETER);
+ //ACE_CHECK;
+
+ return DT;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/RTScheduling/Distributable_Thread.h b/TAO/tao/RTScheduling/Distributable_Thread.h
new file mode 100644
index 00000000000..281eb6984cf
--- /dev/null
+++ b/TAO/tao/RTScheduling/Distributable_Thread.h
@@ -0,0 +1,43 @@
+// -*- C++ -*-
+
+//$Id$
+
+#ifndef DISTRIBUTABLE_THREAD_H
+#define DISTRIBUTABLE_THREAD_H
+
+#include "tao/RTScheduling/RTScheduler.h"
+#include "tao/LocalObject.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_RTScheduler_Export TAO_DistributableThread:
+ public RTScheduling::DistributableThread,
+ public TAO_Local_RefCounted_Object
+{
+ public:
+
+ TAO_DistributableThread (void);
+
+ ~TAO_DistributableThread (void);
+
+ virtual void cancel (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+
+ virtual RTScheduling::DistributableThread::DT_State state (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ private:
+ RTScheduling::DistributableThread::DT_State state_;
+};
+
+
+class TAO_DistributableThread_Factory
+{
+public:
+ static RTScheduling::DistributableThread_ptr create_DT (void);
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /*DISTRIBUTABLE_THREAD_H*/
diff --git a/TAO/tao/RTScheduling/RTScheduler.cpp b/TAO/tao/RTScheduling/RTScheduler.cpp
new file mode 100644
index 00000000000..15eebbb61fe
--- /dev/null
+++ b/TAO/tao/RTScheduling/RTScheduler.cpp
@@ -0,0 +1,15 @@
+// $Id$
+
+#include "tao/RTScheduling/RTScheduler.h"
+#include "tao/RTScheduling/RTScheduler_Loader.h"
+
+ACE_RCSID (RTScheduler, RTScheduler, "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_RTScheduler_Initializer::TAO_RTScheduler_Initializer (void)
+{
+ ACE_Service_Config::process_directive (ace_svc_desc_TAO_RTScheduler_Loader);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/RTScheduling/RTScheduler.h b/TAO/tao/RTScheduling/RTScheduler.h
new file mode 100644
index 00000000000..3dbcb0553b9
--- /dev/null
+++ b/TAO/tao/RTScheduling/RTScheduler.h
@@ -0,0 +1,48 @@
+// -*- C++ -*-
+
+// $Id$
+
+//=============================================================================
+/**
+ * @file RTScheduler.h
+ *
+ * $Id$
+ *
+ * Takes care of the RT Scheduler loading on static build.
+ *
+ *
+ * @author Yamuna Krishnamurthy <yamuna@oomworks.com>
+ */
+//=============================================================================
+
+#ifndef TAO_RTSCHEDULER_H_
+#define TAO_RTSCHEDULER_H_
+#include /**/ "ace/pre.h"
+
+#include "tao/RTScheduling/rtscheduler_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Versioned_Namespace.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_RTScheduler_Export TAO_RTScheduler_Initializer
+{
+public:
+ // Constructor.
+ TAO_RTScheduler_Initializer (void);
+};
+
+static TAO_RTScheduler_Initializer TAO_RTScheduler_initializer;
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#define TAO_RTSCHEDULER_SAFE_INCLUDE
+#include "tao/RTScheduling/RTSchedulerC.h"
+#undef TAO_RTSCHEDULER_SAFE_INCLUDE
+
+#include /**/ "ace/post.h"
+#endif /* TAO_RTSCHEDULER_H_ */
diff --git a/TAO/tao/RTScheduling/RTScheduler.pidl b/TAO/tao/RTScheduling/RTScheduler.pidl
new file mode 100644
index 00000000000..72551c8785b
--- /dev/null
+++ b/TAO/tao/RTScheduling/RTScheduler.pidl
@@ -0,0 +1,213 @@
+//$Id$
+// ================================================================
+//
+// = LIBRARY
+// TAO_RTScheduling
+//
+// = FILENAME
+// RTScheduling.pidl
+//
+// = DESCRIPTION
+// Some new data types included for GIOP 1.2
+// This file was used to generate the code in
+// RTScheduler*.* The command used to generate code
+// is:
+//
+// tao_idl
+// -o orig -GA -Sa -Gp -Gd -Ge 1 -Sci
+// -Wb,export_macro=TAO_RTScheduler_Export
+// -Wb,export_include="rtscheduler_export.h"
+// -Wb,pre_include="ace/pre.h"
+// -Wb,post_include="ace/post.h"
+// -I$(TAO_ROOT)
+// RTScheduler.pidl
+//
+// ================================================================
+#ifndef TAO_RTSCHEDULER_PIDL
+#define TAO_RTSCHEDULER_PIDL
+
+#include "tao/RTCORBA/RTCORBA_include.pidl"
+#include "tao/PortableServer/PortableServer_include.pidl"
+#include "tao/PI/ClientRequestInfo.pidl"
+#include "tao/PI_Server/ServerRequestInfo.pidl"
+#include "tao/PortableInterceptor.pidl"
+#include "tao/PI/PIForwardRequest.pidl"
+
+module CORBA
+{
+ // Extensions by this proposal:
+ native VoidData;
+
+ // Ada: System.Address
+ // C: void*
+ // C++: void*
+ // Java: Object
+
+};
+
+module RTScheduling
+{
+ // ------------------------------------------------------------------
+ // Interfaces that are useful to dynamically schedule applications
+ // ------------------------------------------------------------------
+
+ local interface ThreadAction
+ {
+ void do(in CORBA::VoidData data);
+ };
+
+ local interface DistributableThread
+ {
+ enum DT_State
+ {
+ ACTIVE,
+ CANCELLED
+ };
+
+ void cancel();
+ // raises CORBA::OBJECT_NOT_FOUND if
+ // the distributable thread is
+ // not known to the scheduler
+ readonly attribute DT_State state;
+ };
+
+ local interface Current
+ : RTCORBA::Current
+ {
+ DistributableThread
+ spawn
+ (in ThreadAction start,
+ in CORBA::VoidData data,
+ in string name,
+ in CORBA::Policy sched_param,
+ in CORBA::Policy implicit_sched_param,
+ in unsigned long stack_size,
+ // zero means use the O/S default
+ in RTCORBA::Priority base_priority);
+
+ exception UNSUPPORTED_SCHEDULING_DISCIPLINE {};
+ // The scheduling_parameter argument didn't match the
+ // active scheduling policy.
+
+ void begin_scheduling_segment
+ (in string name,
+ in CORBA::Policy sched_param,
+ in CORBA::Policy implicit_sched_param)
+ raises (UNSUPPORTED_SCHEDULING_DISCIPLINE );
+
+ void update_scheduling_segment
+ (in string name,
+ in CORBA::Policy sched_param,
+ in CORBA::Policy implicit_sched_param)
+ raises ( UNSUPPORTED_SCHEDULING_DISCIPLINE );
+
+ void end_scheduling_segment(in string name);
+
+ typedef sequence<octet> IdType;
+
+ readonly attribute IdType id;
+ // a globally unique id
+
+ //IdType get_current_id();
+ // returns id of thread that is running
+
+ DistributableThread lookup(in IdType id);
+ // returns a null reference if
+ // the distributable thread is
+ // not known to the local scheduler
+
+ readonly attribute CORBA::Policy scheduling_parameter;
+ readonly attribute CORBA::Policy implicit_scheduling_parameter;
+
+ typedef sequence<string> NameList;
+
+ readonly attribute NameList current_scheduling_segment_names;
+ // Ordered from innermost segment name
+ // to outmost segment name
+ };
+
+ local interface ResourceManager
+ : RTCORBA::Mutex
+ {
+ };
+
+ local interface Scheduler
+ {
+ exception INCOMPATIBLE_SCHEDULING_DISCIPLINES {};
+
+ attribute CORBA::PolicyList scheduling_policies;
+ readonly attribute CORBA::PolicyList poa_policies;
+ readonly attribute string scheduling_discipline_name;
+
+ ResourceManager
+ create_resource_manager
+ (in string name,
+ in CORBA::Policy scheduling_parameter);
+
+ void set_scheduling_parameter
+ (inout PortableServer::Servant resource,
+ in string name,
+ in CORBA::Policy scheduling_parameter);
+
+ void begin_new_scheduling_segment (in Current::IdType guid,
+ in string name,
+ in CORBA::Policy sched_param,
+ in CORBA::Policy implicit_sched_param)
+ raises (Current::UNSUPPORTED_SCHEDULING_DISCIPLINE);
+
+ void begin_nested_scheduling_segment (in Current::IdType guid,
+ in string name,
+ in CORBA::Policy sched_param,
+ in CORBA::Policy implicit_sched_param)
+ raises (Current::UNSUPPORTED_SCHEDULING_DISCIPLINE);
+
+
+ void update_scheduling_segment (in Current::IdType guid,
+ in string name,
+ in CORBA::Policy sched_param,
+ in CORBA::Policy implicit_sched_param)
+ raises (Current::UNSUPPORTED_SCHEDULING_DISCIPLINE);
+
+ void end_scheduling_segment (in Current::IdType guid,
+ in string name);
+
+
+ void end_nested_scheduling_segment (in Current::IdType guid,
+ in string name,
+ in CORBA::Policy outer_sched_param);
+
+ void send_request (in PortableInterceptor::ClientRequestInfo ri)
+ raises (PortableInterceptor::ForwardRequest);
+
+ void receive_request (in PortableInterceptor::ServerRequestInfo ri,
+ out Current::IdType guid,
+ out string name,
+ out CORBA::Policy sched_param,
+ out CORBA::Policy implicit_sched_param)
+ raises (PortableInterceptor::ForwardRequest);
+
+ void send_reply (in PortableInterceptor::ServerRequestInfo ri);
+
+ void send_exception (in PortableInterceptor::ServerRequestInfo ri)
+ raises (PortableInterceptor::ForwardRequest);
+
+ void send_other (in PortableInterceptor::ServerRequestInfo ri)
+ raises (PortableInterceptor::ForwardRequest);
+
+ void send_poll (in PortableInterceptor::ClientRequestInfo ri)
+ raises (PortableInterceptor::ForwardRequest);
+
+ void receive_reply (in PortableInterceptor::ClientRequestInfo ri);
+
+ void receive_exception (in PortableInterceptor::ClientRequestInfo ri)
+ raises (PortableInterceptor::ForwardRequest);
+
+ void receive_other (in PortableInterceptor::ClientRequestInfo ri)
+ raises (PortableInterceptor::ForwardRequest);
+
+ void cancel (in Current::IdType guid);
+ };
+
+};
+
+#endif /*TAO_RTSCHEDULER_PIDL*/
diff --git a/TAO/tao/RTScheduling/RTSchedulerA.cpp b/TAO/tao/RTScheduling/RTSchedulerA.cpp
new file mode 100644
index 00000000000..38df96e2be8
--- /dev/null
+++ b/TAO/tao/RTScheduling/RTSchedulerA.cpp
@@ -0,0 +1,273 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+#include "tao/RTScheduling/RTScheduler.h"
+#include "tao/AnyTypeCode/Null_RefCount_Policy.h"
+#include "tao/AnyTypeCode/TypeCode_Constants.h"
+#include "tao/AnyTypeCode/Alias_TypeCode_Static.h"
+#include "tao/AnyTypeCode/Enum_TypeCode_Static.h"
+#include "tao/AnyTypeCode/Objref_TypeCode_Static.h"
+#include "tao/AnyTypeCode/Sequence_TypeCode_Static.h"
+#include "tao/AnyTypeCode/String_TypeCode_Static.h"
+#include "tao/AnyTypeCode/Struct_TypeCode_Static.h"
+#include "tao/AnyTypeCode/TypeCode_Struct_Field.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/objref_typecode.cpp:76
+
+static TAO::TypeCode::Objref<char const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_RTScheduling_ThreadAction (
+ CORBA::tk_local_interface,
+ "IDL:RTScheduling/ThreadAction:1.0",
+ "ThreadAction");
+
+namespace RTScheduling
+{
+ ::CORBA::TypeCode_ptr const _tc_ThreadAction =
+ &_tao_tc_RTScheduling_ThreadAction;
+}
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/enum_typecode.cpp:34
+
+static char const * const _tao_enumerators_RTScheduling_DistributableThread_DT_State[] =
+ {
+ "ACTIVE",
+ "CANCELLED"
+
+ };
+
+static TAO::TypeCode::Enum<char const *,
+ char const * const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_RTScheduling_DistributableThread_DT_State (
+ "IDL:RTScheduling/DistributableThread/DT_State:1.0",
+ "DT_State",
+ _tao_enumerators_RTScheduling_DistributableThread_DT_State,
+ 2);
+
+::CORBA::TypeCode_ptr const RTScheduling::DistributableThread::_tc_DT_State =
+ &_tao_tc_RTScheduling_DistributableThread_DT_State;
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/objref_typecode.cpp:76
+
+static TAO::TypeCode::Objref<char const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_RTScheduling_DistributableThread (
+ CORBA::tk_local_interface,
+ "IDL:RTScheduling/DistributableThread:1.0",
+ "DistributableThread");
+
+namespace RTScheduling
+{
+ ::CORBA::TypeCode_ptr const _tc_DistributableThread =
+ &_tao_tc_RTScheduling_DistributableThread;
+}
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/struct_typecode.cpp:87
+
+static TAO::TypeCode::Struct_Field<char const *, CORBA::TypeCode_ptr const *> const * const _tao_fields_RTScheduling_Current_UNSUPPORTED_SCHEDULING_DISCIPLINE = 0;
+static TAO::TypeCode::Struct<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::TypeCode::Struct_Field<char const *, CORBA::TypeCode_ptr const *> const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_RTScheduling_Current_UNSUPPORTED_SCHEDULING_DISCIPLINE (
+ CORBA::tk_except,
+ "IDL:RTScheduling/Current/UNSUPPORTED_SCHEDULING_DISCIPLINE:1.0",
+ "UNSUPPORTED_SCHEDULING_DISCIPLINE",
+ _tao_fields_RTScheduling_Current_UNSUPPORTED_SCHEDULING_DISCIPLINE,
+ 0);
+
+::CORBA::TypeCode_ptr const RTScheduling::Current::_tc_UNSUPPORTED_SCHEDULING_DISCIPLINE =
+ &_tao_tc_RTScheduling_Current_UNSUPPORTED_SCHEDULING_DISCIPLINE;
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/alias_typecode.cpp:50
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/typecode_defn.cpp:937
+
+
+#ifndef _TAO_TYPECODE_RTScheduling_Current_IdType_GUARD
+#define _TAO_TYPECODE_RTScheduling_Current_IdType_GUARD
+namespace TAO
+{
+ namespace TypeCode
+ {
+ TAO::TypeCode::Sequence< ::CORBA::TypeCode_ptr const *,
+ TAO::Null_RefCount_Policy>
+ RTScheduling_Current_IdType_0 (
+ CORBA::tk_sequence,
+ &CORBA::_tc_octet,
+ 0U);
+
+ ::CORBA::TypeCode_ptr const tc_RTScheduling_Current_IdType_0 =
+ &RTScheduling_Current_IdType_0;
+
+ }
+}
+
+
+#endif /* _TAO_TYPECODE_RTScheduling_Current_IdType_GUARD */
+
+static TAO::TypeCode::Alias<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_RTScheduling_Current_IdType (
+ CORBA::tk_alias,
+ "IDL:RTScheduling/Current/IdType:1.0",
+ "IdType",
+ &TAO::TypeCode::tc_RTScheduling_Current_IdType_0);
+
+::CORBA::TypeCode_ptr const RTScheduling::Current::_tc_IdType =
+ &_tao_tc_RTScheduling_Current_IdType;
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/alias_typecode.cpp:50
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/typecode_defn.cpp:937
+
+
+#ifndef _TAO_TYPECODE_RTScheduling_Current_NameList_GUARD
+#define _TAO_TYPECODE_RTScheduling_Current_NameList_GUARD
+namespace TAO
+{
+ namespace TypeCode
+ {
+ TAO::TypeCode::Sequence< ::CORBA::TypeCode_ptr const *,
+ TAO::Null_RefCount_Policy>
+ RTScheduling_Current_NameList_0 (
+ CORBA::tk_sequence,
+ &CORBA::_tc_string,
+ 0U);
+
+ ::CORBA::TypeCode_ptr const tc_RTScheduling_Current_NameList_0 =
+ &RTScheduling_Current_NameList_0;
+
+ }
+}
+
+
+#endif /* _TAO_TYPECODE_RTScheduling_Current_NameList_GUARD */
+
+static TAO::TypeCode::Alias<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_RTScheduling_Current_NameList (
+ CORBA::tk_alias,
+ "IDL:RTScheduling/Current/NameList:1.0",
+ "NameList",
+ &TAO::TypeCode::tc_RTScheduling_Current_NameList_0);
+
+::CORBA::TypeCode_ptr const RTScheduling::Current::_tc_NameList =
+ &_tao_tc_RTScheduling_Current_NameList;
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/objref_typecode.cpp:76
+
+static TAO::TypeCode::Objref<char const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_RTScheduling_Current (
+ CORBA::tk_local_interface,
+ "IDL:RTScheduling/Current:1.0",
+ "Current");
+
+namespace RTScheduling
+{
+ ::CORBA::TypeCode_ptr const _tc_Current =
+ &_tao_tc_RTScheduling_Current;
+}
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/objref_typecode.cpp:76
+
+static TAO::TypeCode::Objref<char const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_RTScheduling_ResourceManager (
+ CORBA::tk_local_interface,
+ "IDL:RTScheduling/ResourceManager:1.0",
+ "ResourceManager");
+
+namespace RTScheduling
+{
+ ::CORBA::TypeCode_ptr const _tc_ResourceManager =
+ &_tao_tc_RTScheduling_ResourceManager;
+}
+
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/struct_typecode.cpp:87
+
+static TAO::TypeCode::Struct_Field<char const *, CORBA::TypeCode_ptr const *> const * const _tao_fields_RTScheduling_Scheduler_INCOMPATIBLE_SCHEDULING_DISCIPLINES = 0;
+static TAO::TypeCode::Struct<char const *,
+ CORBA::TypeCode_ptr const *,
+ TAO::TypeCode::Struct_Field<char const *, CORBA::TypeCode_ptr const *> const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_RTScheduling_Scheduler_INCOMPATIBLE_SCHEDULING_DISCIPLINES (
+ CORBA::tk_except,
+ "IDL:RTScheduling/Scheduler/INCOMPATIBLE_SCHEDULING_DISCIPLINES:1.0",
+ "INCOMPATIBLE_SCHEDULING_DISCIPLINES",
+ _tao_fields_RTScheduling_Scheduler_INCOMPATIBLE_SCHEDULING_DISCIPLINES,
+ 0);
+
+::CORBA::TypeCode_ptr const RTScheduling::Scheduler::_tc_INCOMPATIBLE_SCHEDULING_DISCIPLINES =
+ &_tao_tc_RTScheduling_Scheduler_INCOMPATIBLE_SCHEDULING_DISCIPLINES;
+
+// TAO_IDL - Generated from
+// be\be_visitor_typecode/objref_typecode.cpp:76
+
+static TAO::TypeCode::Objref<char const *,
+ TAO::Null_RefCount_Policy>
+ _tao_tc_RTScheduling_Scheduler (
+ CORBA::tk_local_interface,
+ "IDL:RTScheduling/Scheduler:1.0",
+ "Scheduler");
+
+namespace RTScheduling
+{
+ ::CORBA::TypeCode_ptr const _tc_Scheduler =
+ &_tao_tc_RTScheduling_Scheduler;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/RTScheduling/RTSchedulerA.h b/TAO/tao/RTScheduling/RTSchedulerA.h
new file mode 100644
index 00000000000..e543e41332e
--- /dev/null
+++ b/TAO/tao/RTScheduling/RTSchedulerA.h
@@ -0,0 +1,3 @@
+// $Id$
+// This file deliberately empty. See bugzilla #2549.
+
diff --git a/TAO/tao/RTScheduling/RTSchedulerC.cpp b/TAO/tao/RTScheduling/RTSchedulerC.cpp
new file mode 100644
index 00000000000..11262996eaf
--- /dev/null
+++ b/TAO/tao/RTScheduling/RTSchedulerC.cpp
@@ -0,0 +1,946 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:291
+
+
+#include "tao/RTScheduling/RTScheduler.h"
+#include "tao/CDR.h"
+#include "tao/ORB_Core.h"
+#include "tao/Var_Size_Argument_T.h"
+#include "ace/OS_NS_string.h"
+
+#if defined (__BORLANDC__)
+#pragma option -w-rvl -w-rch -w-ccc -w-aus -w-sig
+#endif /* __BORLANDC__ */
+
+// TAO_IDL - Generated from
+// be\be_visitor_arg_traits.cpp:70
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Arg traits specializations.
+namespace TAO
+{
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_arg_traits.cpp:539
+
+#if !defined (_CORBA_POLICYLIST__ARG_TRAITS_CS_)
+#define _CORBA_POLICYLIST__ARG_TRAITS_CS_
+
+ template<>
+ class Arg_Traits<CORBA::PolicyList>
+ : public
+ Var_Size_Arg_Traits_T<
+ CORBA::PolicyList,
+ TAO::Any_Insert_Policy_Stream <CORBA::PolicyList>
+ >
+ {
+ };
+
+#endif /* end #if !defined */
+}
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/interface_cs.cpp:60
+
+// Traits specializations for RTScheduling::ThreadAction.
+
+RTScheduling::ThreadAction_ptr
+TAO::Objref_Traits<RTScheduling::ThreadAction>::duplicate (
+ RTScheduling::ThreadAction_ptr p
+ )
+{
+ return RTScheduling::ThreadAction::_duplicate (p);
+}
+
+void
+TAO::Objref_Traits<RTScheduling::ThreadAction>::release (
+ RTScheduling::ThreadAction_ptr p
+ )
+{
+ ::CORBA::release (p);
+}
+
+RTScheduling::ThreadAction_ptr
+TAO::Objref_Traits<RTScheduling::ThreadAction>::nil (void)
+{
+ return RTScheduling::ThreadAction::_nil ();
+}
+
+CORBA::Boolean
+TAO::Objref_Traits<RTScheduling::ThreadAction>::marshal (
+ RTScheduling::ThreadAction_ptr p,
+ TAO_OutputCDR & cdr
+ )
+{
+ return CORBA::Object::marshal (p, cdr);
+}
+
+RTScheduling::ThreadAction::ThreadAction (void)
+{}
+
+RTScheduling::ThreadAction::~ThreadAction (void)
+{}
+
+RTScheduling::ThreadAction_ptr
+RTScheduling::ThreadAction::_narrow (
+ CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return ThreadAction::_duplicate (
+ dynamic_cast<ThreadAction_ptr> (_tao_objref)
+ );
+}
+
+RTScheduling::ThreadAction_ptr
+RTScheduling::ThreadAction::_unchecked_narrow (
+ CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return ThreadAction::_duplicate (
+ dynamic_cast<ThreadAction_ptr> (_tao_objref)
+ );
+}
+
+RTScheduling::ThreadAction_ptr
+RTScheduling::ThreadAction::_duplicate (ThreadAction_ptr obj)
+{
+ if (! ::CORBA::is_nil (obj))
+ {
+ obj->_add_ref ();
+ }
+
+ return obj;
+}
+
+void
+RTScheduling::ThreadAction::_tao_release (ThreadAction_ptr obj)
+{
+ ::CORBA::release (obj);
+}
+
+CORBA::Boolean
+RTScheduling::ThreadAction::_is_a (
+ const char *value
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ if (
+ !ACE_OS::strcmp (
+ value,
+ "IDL:RTScheduling/ThreadAction:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/LocalObject:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/Object:1.0"
+ )
+ )
+ {
+ return true; // success using local knowledge
+ }
+ else
+ {
+ return false;
+ }
+}
+
+const char* RTScheduling::ThreadAction::_interface_repository_id (void) const
+{
+ return "IDL:RTScheduling/ThreadAction:1.0";
+}
+
+CORBA::Boolean
+RTScheduling::ThreadAction::marshal (TAO_OutputCDR &)
+{
+ return false;
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/interface_cs.cpp:60
+
+// Traits specializations for RTScheduling::DistributableThread.
+
+RTScheduling::DistributableThread_ptr
+TAO::Objref_Traits<RTScheduling::DistributableThread>::duplicate (
+ RTScheduling::DistributableThread_ptr p
+ )
+{
+ return RTScheduling::DistributableThread::_duplicate (p);
+}
+
+void
+TAO::Objref_Traits<RTScheduling::DistributableThread>::release (
+ RTScheduling::DistributableThread_ptr p
+ )
+{
+ ::CORBA::release (p);
+}
+
+RTScheduling::DistributableThread_ptr
+TAO::Objref_Traits<RTScheduling::DistributableThread>::nil (void)
+{
+ return RTScheduling::DistributableThread::_nil ();
+}
+
+CORBA::Boolean
+TAO::Objref_Traits<RTScheduling::DistributableThread>::marshal (
+ RTScheduling::DistributableThread_ptr p,
+ TAO_OutputCDR & cdr
+ )
+{
+ return CORBA::Object::marshal (p, cdr);
+}
+
+RTScheduling::DistributableThread::DistributableThread (void)
+{}
+
+RTScheduling::DistributableThread::~DistributableThread (void)
+{}
+
+RTScheduling::DistributableThread_ptr
+RTScheduling::DistributableThread::_narrow (
+ CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return DistributableThread::_duplicate (
+ dynamic_cast<DistributableThread_ptr> (_tao_objref)
+ );
+}
+
+RTScheduling::DistributableThread_ptr
+RTScheduling::DistributableThread::_unchecked_narrow (
+ CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return DistributableThread::_duplicate (
+ dynamic_cast<DistributableThread_ptr> (_tao_objref)
+ );
+}
+
+RTScheduling::DistributableThread_ptr
+RTScheduling::DistributableThread::_duplicate (DistributableThread_ptr obj)
+{
+ if (! ::CORBA::is_nil (obj))
+ {
+ obj->_add_ref ();
+ }
+
+ return obj;
+}
+
+void
+RTScheduling::DistributableThread::_tao_release (DistributableThread_ptr obj)
+{
+ ::CORBA::release (obj);
+}
+
+CORBA::Boolean
+RTScheduling::DistributableThread::_is_a (
+ const char *value
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ if (
+ !ACE_OS::strcmp (
+ value,
+ "IDL:RTScheduling/DistributableThread:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/LocalObject:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/Object:1.0"
+ )
+ )
+ {
+ return true; // success using local knowledge
+ }
+ else
+ {
+ return false;
+ }
+}
+
+const char* RTScheduling::DistributableThread::_interface_repository_id (void) const
+{
+ return "IDL:RTScheduling/DistributableThread:1.0";
+}
+
+CORBA::Boolean
+RTScheduling::DistributableThread::marshal (TAO_OutputCDR &)
+{
+ return false;
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/interface_cs.cpp:60
+
+// Traits specializations for RTScheduling::Current.
+
+RTScheduling::Current_ptr
+TAO::Objref_Traits<RTScheduling::Current>::duplicate (
+ RTScheduling::Current_ptr p
+ )
+{
+ return RTScheduling::Current::_duplicate (p);
+}
+
+void
+TAO::Objref_Traits<RTScheduling::Current>::release (
+ RTScheduling::Current_ptr p
+ )
+{
+ ::CORBA::release (p);
+}
+
+RTScheduling::Current_ptr
+TAO::Objref_Traits<RTScheduling::Current>::nil (void)
+{
+ return RTScheduling::Current::_nil ();
+}
+
+CORBA::Boolean
+TAO::Objref_Traits<RTScheduling::Current>::marshal (
+ RTScheduling::Current_ptr p,
+ TAO_OutputCDR & cdr
+ )
+{
+ return CORBA::Object::marshal (p, cdr);
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_exception/exception_cs.cpp:63
+
+RTScheduling::Current::UNSUPPORTED_SCHEDULING_DISCIPLINE::UNSUPPORTED_SCHEDULING_DISCIPLINE (void)
+ : CORBA::UserException (
+ "IDL:RTScheduling/Current/UNSUPPORTED_SCHEDULING_DISCIPLINE:1.0",
+ "UNSUPPORTED_SCHEDULING_DISCIPLINE"
+ )
+{
+}
+
+RTScheduling::Current::UNSUPPORTED_SCHEDULING_DISCIPLINE::~UNSUPPORTED_SCHEDULING_DISCIPLINE (void)
+{
+}
+
+RTScheduling::Current::UNSUPPORTED_SCHEDULING_DISCIPLINE::UNSUPPORTED_SCHEDULING_DISCIPLINE (const ::RTScheduling::Current::UNSUPPORTED_SCHEDULING_DISCIPLINE &_tao_excp)
+ : CORBA::UserException (
+ _tao_excp._rep_id (),
+ _tao_excp._name ()
+ )
+{
+}
+
+RTScheduling::Current::UNSUPPORTED_SCHEDULING_DISCIPLINE&
+RTScheduling::Current::UNSUPPORTED_SCHEDULING_DISCIPLINE::operator= (const ::RTScheduling::Current::UNSUPPORTED_SCHEDULING_DISCIPLINE &_tao_excp)
+{
+ this->::CORBA::UserException::operator= (_tao_excp);
+ return *this;
+}
+
+RTScheduling::Current::UNSUPPORTED_SCHEDULING_DISCIPLINE *
+RTScheduling::Current::UNSUPPORTED_SCHEDULING_DISCIPLINE::_downcast (CORBA::Exception *_tao_excp)
+{
+ return dynamic_cast<UNSUPPORTED_SCHEDULING_DISCIPLINE *> (_tao_excp);
+}
+
+const RTScheduling::Current::UNSUPPORTED_SCHEDULING_DISCIPLINE *
+RTScheduling::Current::UNSUPPORTED_SCHEDULING_DISCIPLINE::_downcast (CORBA::Exception const *_tao_excp)
+{
+ return dynamic_cast<const UNSUPPORTED_SCHEDULING_DISCIPLINE *> (_tao_excp);
+}
+
+CORBA::Exception *RTScheduling::Current::UNSUPPORTED_SCHEDULING_DISCIPLINE::_alloc (void)
+{
+ CORBA::Exception *retval = 0;
+ ACE_NEW_RETURN (retval, ::RTScheduling::Current::UNSUPPORTED_SCHEDULING_DISCIPLINE, 0);
+ return retval;
+}
+
+CORBA::Exception *
+RTScheduling::Current::UNSUPPORTED_SCHEDULING_DISCIPLINE::_tao_duplicate (void) const
+{
+ CORBA::Exception *result = 0;
+ ACE_NEW_RETURN (
+ result,
+ ::RTScheduling::Current::UNSUPPORTED_SCHEDULING_DISCIPLINE (*this),
+ 0
+ );
+ return result;
+}
+
+void RTScheduling::Current::UNSUPPORTED_SCHEDULING_DISCIPLINE::_raise (void) const
+{
+ TAO_RAISE (*this);
+}
+
+void RTScheduling::Current::UNSUPPORTED_SCHEDULING_DISCIPLINE::_tao_encode (
+ TAO_OutputCDR &
+ ACE_ENV_ARG_DECL
+ ) const
+{
+ ACE_THROW (CORBA::MARSHAL ());
+}
+
+void RTScheduling::Current::UNSUPPORTED_SCHEDULING_DISCIPLINE::_tao_decode (
+ TAO_InputCDR &
+ ACE_ENV_ARG_DECL
+ )
+{
+ ACE_THROW (CORBA::MARSHAL ());
+}
+
+// TAO extension - the virtual _type method.
+CORBA::TypeCode_ptr RTScheduling::Current::UNSUPPORTED_SCHEDULING_DISCIPLINE::_tao_type (void) const
+{
+ return ::RTScheduling::Current::_tc_UNSUPPORTED_SCHEDULING_DISCIPLINE;
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_sequence/sequence_cs.cpp:65
+
+#if !defined (_RTSCHEDULING_CURRENT_IDTYPE_CS_)
+#define _RTSCHEDULING_CURRENT_IDTYPE_CS_
+
+RTScheduling::Current::IdType::IdType (void)
+{}
+
+RTScheduling::Current::IdType::IdType (
+ CORBA::ULong max
+ )
+ : TAO::unbounded_value_sequence<
+ CORBA::Octet
+ >
+ (max)
+{}
+
+RTScheduling::Current::IdType::IdType (
+ CORBA::ULong max,
+ CORBA::ULong length,
+ CORBA::Octet * buffer,
+ CORBA::Boolean release
+ )
+ : TAO::unbounded_value_sequence<
+ CORBA::Octet
+ >
+ (max, length, buffer, release)
+{}
+
+RTScheduling::Current::IdType::IdType (
+ const IdType &seq
+ )
+ : TAO::unbounded_value_sequence<
+ CORBA::Octet
+ >
+ (seq)
+{}
+
+RTScheduling::Current::IdType::~IdType (void)
+{}
+
+#endif /* end #if !defined */
+
+// TAO_IDL - Generated from
+// be\be_visitor_sequence/sequence_cs.cpp:65
+
+#if !defined (_RTSCHEDULING_CURRENT_NAMELIST_CS_)
+#define _RTSCHEDULING_CURRENT_NAMELIST_CS_
+
+RTScheduling::Current::NameList::NameList (void)
+{}
+
+RTScheduling::Current::NameList::NameList (
+ CORBA::ULong max
+ )
+ : TAO::unbounded_string_sequence
+ (max)
+{}
+
+RTScheduling::Current::NameList::NameList (
+ CORBA::ULong max,
+ CORBA::ULong length,
+ char * * buffer,
+ CORBA::Boolean release
+ )
+ : TAO::unbounded_string_sequence
+ (max, length, buffer, release)
+{}
+
+RTScheduling::Current::NameList::NameList (
+ const NameList &seq
+ )
+ : TAO::unbounded_string_sequence
+ (seq)
+{}
+
+RTScheduling::Current::NameList::~NameList (void)
+{}
+
+#endif /* end #if !defined */
+
+RTScheduling::Current::Current (void)
+{}
+
+RTScheduling::Current::~Current (void)
+{}
+
+RTScheduling::Current_ptr
+RTScheduling::Current::_narrow (
+ CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return Current::_duplicate (
+ dynamic_cast<Current_ptr> (_tao_objref)
+ );
+}
+
+RTScheduling::Current_ptr
+RTScheduling::Current::_unchecked_narrow (
+ CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return Current::_duplicate (
+ dynamic_cast<Current_ptr> (_tao_objref)
+ );
+}
+
+RTScheduling::Current_ptr
+RTScheduling::Current::_duplicate (Current_ptr obj)
+{
+ if (! ::CORBA::is_nil (obj))
+ {
+ obj->_add_ref ();
+ }
+
+ return obj;
+}
+
+void
+RTScheduling::Current::_tao_release (Current_ptr obj)
+{
+ ::CORBA::release (obj);
+}
+
+CORBA::Boolean
+RTScheduling::Current::_is_a (
+ const char *value
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ if (
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/Current:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/RTCORBA/Current:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:RTScheduling/Current:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/LocalObject:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/Object:1.0"
+ )
+ )
+ {
+ return true; // success using local knowledge
+ }
+ else
+ {
+ return false;
+ }
+}
+
+const char* RTScheduling::Current::_interface_repository_id (void) const
+{
+ return "IDL:RTScheduling/Current:1.0";
+}
+
+CORBA::Boolean
+RTScheduling::Current::marshal (TAO_OutputCDR &)
+{
+ return false;
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/interface_cs.cpp:60
+
+// Traits specializations for RTScheduling::ResourceManager.
+
+RTScheduling::ResourceManager_ptr
+TAO::Objref_Traits<RTScheduling::ResourceManager>::duplicate (
+ RTScheduling::ResourceManager_ptr p
+ )
+{
+ return RTScheduling::ResourceManager::_duplicate (p);
+}
+
+void
+TAO::Objref_Traits<RTScheduling::ResourceManager>::release (
+ RTScheduling::ResourceManager_ptr p
+ )
+{
+ ::CORBA::release (p);
+}
+
+RTScheduling::ResourceManager_ptr
+TAO::Objref_Traits<RTScheduling::ResourceManager>::nil (void)
+{
+ return RTScheduling::ResourceManager::_nil ();
+}
+
+CORBA::Boolean
+TAO::Objref_Traits<RTScheduling::ResourceManager>::marshal (
+ RTScheduling::ResourceManager_ptr p,
+ TAO_OutputCDR & cdr
+ )
+{
+ return CORBA::Object::marshal (p, cdr);
+}
+
+RTScheduling::ResourceManager::ResourceManager (void)
+{}
+
+RTScheduling::ResourceManager::~ResourceManager (void)
+{}
+
+RTScheduling::ResourceManager_ptr
+RTScheduling::ResourceManager::_narrow (
+ CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return ResourceManager::_duplicate (
+ dynamic_cast<ResourceManager_ptr> (_tao_objref)
+ );
+}
+
+RTScheduling::ResourceManager_ptr
+RTScheduling::ResourceManager::_unchecked_narrow (
+ CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return ResourceManager::_duplicate (
+ dynamic_cast<ResourceManager_ptr> (_tao_objref)
+ );
+}
+
+RTScheduling::ResourceManager_ptr
+RTScheduling::ResourceManager::_duplicate (ResourceManager_ptr obj)
+{
+ if (! ::CORBA::is_nil (obj))
+ {
+ obj->_add_ref ();
+ }
+
+ return obj;
+}
+
+void
+RTScheduling::ResourceManager::_tao_release (ResourceManager_ptr obj)
+{
+ ::CORBA::release (obj);
+}
+
+CORBA::Boolean
+RTScheduling::ResourceManager::_is_a (
+ const char *value
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ if (
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/RTCORBA/Mutex:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:RTScheduling/ResourceManager:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/LocalObject:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/Object:1.0"
+ )
+ )
+ {
+ return true; // success using local knowledge
+ }
+ else
+ {
+ return false;
+ }
+}
+
+const char* RTScheduling::ResourceManager::_interface_repository_id (void) const
+{
+ return "IDL:RTScheduling/ResourceManager:1.0";
+}
+
+CORBA::Boolean
+RTScheduling::ResourceManager::marshal (TAO_OutputCDR &)
+{
+ return false;
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_interface/interface_cs.cpp:60
+
+// Traits specializations for RTScheduling::Scheduler.
+
+RTScheduling::Scheduler_ptr
+TAO::Objref_Traits<RTScheduling::Scheduler>::duplicate (
+ RTScheduling::Scheduler_ptr p
+ )
+{
+ return RTScheduling::Scheduler::_duplicate (p);
+}
+
+void
+TAO::Objref_Traits<RTScheduling::Scheduler>::release (
+ RTScheduling::Scheduler_ptr p
+ )
+{
+ ::CORBA::release (p);
+}
+
+RTScheduling::Scheduler_ptr
+TAO::Objref_Traits<RTScheduling::Scheduler>::nil (void)
+{
+ return RTScheduling::Scheduler::_nil ();
+}
+
+CORBA::Boolean
+TAO::Objref_Traits<RTScheduling::Scheduler>::marshal (
+ RTScheduling::Scheduler_ptr p,
+ TAO_OutputCDR & cdr
+ )
+{
+ return CORBA::Object::marshal (p, cdr);
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_exception/exception_cs.cpp:63
+
+RTScheduling::Scheduler::INCOMPATIBLE_SCHEDULING_DISCIPLINES::INCOMPATIBLE_SCHEDULING_DISCIPLINES (void)
+ : CORBA::UserException (
+ "IDL:RTScheduling/Scheduler/INCOMPATIBLE_SCHEDULING_DISCIPLINES:1.0",
+ "INCOMPATIBLE_SCHEDULING_DISCIPLINES"
+ )
+{
+}
+
+RTScheduling::Scheduler::INCOMPATIBLE_SCHEDULING_DISCIPLINES::~INCOMPATIBLE_SCHEDULING_DISCIPLINES (void)
+{
+}
+
+RTScheduling::Scheduler::INCOMPATIBLE_SCHEDULING_DISCIPLINES::INCOMPATIBLE_SCHEDULING_DISCIPLINES (const ::RTScheduling::Scheduler::INCOMPATIBLE_SCHEDULING_DISCIPLINES &_tao_excp)
+ : CORBA::UserException (
+ _tao_excp._rep_id (),
+ _tao_excp._name ()
+ )
+{
+}
+
+RTScheduling::Scheduler::INCOMPATIBLE_SCHEDULING_DISCIPLINES&
+RTScheduling::Scheduler::INCOMPATIBLE_SCHEDULING_DISCIPLINES::operator= (const ::RTScheduling::Scheduler::INCOMPATIBLE_SCHEDULING_DISCIPLINES &_tao_excp)
+{
+ this->::CORBA::UserException::operator= (_tao_excp);
+ return *this;
+}
+
+RTScheduling::Scheduler::INCOMPATIBLE_SCHEDULING_DISCIPLINES *
+RTScheduling::Scheduler::INCOMPATIBLE_SCHEDULING_DISCIPLINES::_downcast (CORBA::Exception *_tao_excp)
+{
+ return dynamic_cast<INCOMPATIBLE_SCHEDULING_DISCIPLINES *> (_tao_excp);
+}
+
+const RTScheduling::Scheduler::INCOMPATIBLE_SCHEDULING_DISCIPLINES *
+RTScheduling::Scheduler::INCOMPATIBLE_SCHEDULING_DISCIPLINES::_downcast (CORBA::Exception const *_tao_excp)
+{
+ return dynamic_cast<const INCOMPATIBLE_SCHEDULING_DISCIPLINES *> (_tao_excp);
+}
+
+CORBA::Exception *RTScheduling::Scheduler::INCOMPATIBLE_SCHEDULING_DISCIPLINES::_alloc (void)
+{
+ CORBA::Exception *retval = 0;
+ ACE_NEW_RETURN (retval, ::RTScheduling::Scheduler::INCOMPATIBLE_SCHEDULING_DISCIPLINES, 0);
+ return retval;
+}
+
+CORBA::Exception *
+RTScheduling::Scheduler::INCOMPATIBLE_SCHEDULING_DISCIPLINES::_tao_duplicate (void) const
+{
+ CORBA::Exception *result = 0;
+ ACE_NEW_RETURN (
+ result,
+ ::RTScheduling::Scheduler::INCOMPATIBLE_SCHEDULING_DISCIPLINES (*this),
+ 0
+ );
+ return result;
+}
+
+void RTScheduling::Scheduler::INCOMPATIBLE_SCHEDULING_DISCIPLINES::_raise (void) const
+{
+ TAO_RAISE (*this);
+}
+
+void RTScheduling::Scheduler::INCOMPATIBLE_SCHEDULING_DISCIPLINES::_tao_encode (
+ TAO_OutputCDR &
+ ACE_ENV_ARG_DECL
+ ) const
+{
+ ACE_THROW (CORBA::MARSHAL ());
+}
+
+void RTScheduling::Scheduler::INCOMPATIBLE_SCHEDULING_DISCIPLINES::_tao_decode (
+ TAO_InputCDR &
+ ACE_ENV_ARG_DECL
+ )
+{
+ ACE_THROW (CORBA::MARSHAL ());
+}
+
+// TAO extension - the virtual _type method.
+CORBA::TypeCode_ptr RTScheduling::Scheduler::INCOMPATIBLE_SCHEDULING_DISCIPLINES::_tao_type (void) const
+{
+ return ::RTScheduling::Scheduler::_tc_INCOMPATIBLE_SCHEDULING_DISCIPLINES;
+}
+
+RTScheduling::Scheduler::Scheduler (void)
+{}
+
+RTScheduling::Scheduler::~Scheduler (void)
+{}
+
+RTScheduling::Scheduler_ptr
+RTScheduling::Scheduler::_narrow (
+ CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return Scheduler::_duplicate (
+ dynamic_cast<Scheduler_ptr> (_tao_objref)
+ );
+}
+
+RTScheduling::Scheduler_ptr
+RTScheduling::Scheduler::_unchecked_narrow (
+ CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ return Scheduler::_duplicate (
+ dynamic_cast<Scheduler_ptr> (_tao_objref)
+ );
+}
+
+RTScheduling::Scheduler_ptr
+RTScheduling::Scheduler::_duplicate (Scheduler_ptr obj)
+{
+ if (! ::CORBA::is_nil (obj))
+ {
+ obj->_add_ref ();
+ }
+
+ return obj;
+}
+
+void
+RTScheduling::Scheduler::_tao_release (Scheduler_ptr obj)
+{
+ ::CORBA::release (obj);
+}
+
+CORBA::Boolean
+RTScheduling::Scheduler::_is_a (
+ const char *value
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+{
+ if (
+ !ACE_OS::strcmp (
+ value,
+ "IDL:RTScheduling/Scheduler:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/LocalObject:1.0"
+ ) ||
+ !ACE_OS::strcmp (
+ value,
+ "IDL:omg.org/CORBA/Object:1.0"
+ )
+ )
+ {
+ return true; // success using local knowledge
+ }
+ else
+ {
+ return false;
+ }
+}
+
+const char* RTScheduling::Scheduler::_interface_repository_id (void) const
+{
+ return "IDL:RTScheduling/Scheduler:1.0";
+}
+
+CORBA::Boolean
+RTScheduling::Scheduler::marshal (TAO_OutputCDR &)
+{
+ return false;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/RTScheduling/RTSchedulerC.h b/TAO/tao/RTScheduling/RTSchedulerC.h
new file mode 100644
index 00000000000..322b2f7da10
--- /dev/null
+++ b/TAO/tao/RTScheduling/RTSchedulerC.h
@@ -0,0 +1,1292 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:153
+
+#ifndef _TAO_IDL_ORIG_RTSCHEDULERC_H_
+#define _TAO_IDL_ORIG_RTSCHEDULERC_H_
+
+#include /**/ "ace/pre.h"
+
+
+#include "ace/config-all.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/RTScheduling/rtscheduler_export.h"
+
+#include "tao/PI_Server/ServerRequestInfoC.h"
+#include "tao/PI/ClientRequestInfoC.h"
+#include "tao/PI/PIForwardRequestC.h"
+
+#include "tao/RTCORBA/RTCORBA_includeC.h"
+
+#include "tao/PortableServer/PortableServer_includeC.h"
+
+#include "tao/ORB.h"
+#include "tao/SystemException.h"
+#include "tao/Environment.h"
+#include "tao/Object.h"
+#include "tao/Sequence_T.h"
+#include "tao/Objref_VarOut_T.h"
+#include "tao/Seq_Var_T.h"
+#include "tao/Seq_Out_T.h"
+#include "tao/PortableInterceptorC.h"
+
+#ifndef TAO_RTSCHEDULER_SAFE_INCLUDE
+#error "You should not include RTSchedulerC.h directly, use RTScheduler.h"
+#endif /* !TAO_RTSCHEDULER_SAFE_INCLUDE */
+
+#if defined (TAO_EXPORT_MACRO)
+#undef TAO_EXPORT_MACRO
+#endif
+#define TAO_EXPORT_MACRO TAO_RTScheduler_Export
+
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+#if defined (__BORLANDC__)
+#pragma option push -w-rvl -w-rch -w-ccc -w-inl
+#endif /* __BORLANDC__ */
+
+// TAO_IDL - Generated from
+// be\be_visitor_module/module_ch.cpp:48
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace CORBA
+{
+
+// TAO_IDL - Generated from
+// be\be_visitor_module/module_ch.cpp:66
+
+ // Hand crafted
+ typedef void* VoidData;
+
+} // module CORBA
+
+// TAO_IDL - Generated from
+// be\be_visitor_module/module_ch.cpp:48
+
+namespace RTScheduling
+{
+
+ // TAO_IDL - Generated from
+ // be\be_interface.cpp:598
+
+#if !defined (_RTSCHEDULING_THREADACTION__VAR_OUT_CH_)
+#define _RTSCHEDULING_THREADACTION__VAR_OUT_CH_
+
+ class ThreadAction;
+ typedef ThreadAction *ThreadAction_ptr;
+
+ typedef
+ TAO_Objref_Var_T<
+ ThreadAction
+ >
+ ThreadAction_var;
+
+ typedef
+ TAO_Objref_Out_T<
+ ThreadAction
+ >
+ ThreadAction_out;
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:54
+
+#if !defined (_RTSCHEDULING_THREADACTION_CH_)
+#define _RTSCHEDULING_THREADACTION_CH_
+
+ class TAO_RTScheduler_Export ThreadAction
+ : public virtual CORBA::Object
+ {
+ public:
+ typedef ThreadAction_ptr _ptr_type;
+ typedef ThreadAction_var _var_type;
+
+ // The static operations.
+ static ThreadAction_ptr _duplicate (ThreadAction_ptr obj);
+
+ static void _tao_release (ThreadAction_ptr obj);
+
+ static ThreadAction_ptr _narrow (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static ThreadAction_ptr _unchecked_narrow (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static ThreadAction_ptr _nil (void)
+ {
+ return static_cast<ThreadAction_ptr> (0);
+ }
+
+
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void _cxx_do (
+ ::CORBA::VoidData data
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:210
+
+ virtual CORBA::Boolean _is_a (
+ const char *type_id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ virtual const char* _interface_repository_id (void) const;
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+
+ protected:
+ // Abstract or local interface only.
+ ThreadAction (void);
+
+ virtual ~ThreadAction (void);
+
+ private:
+ // Private and unimplemented for concrete interfaces.
+ ThreadAction (const ThreadAction &);
+
+ void operator= (const ThreadAction &);
+ };
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:44
+
+ extern TAO_RTScheduler_Export ::CORBA::TypeCode_ptr const _tc_ThreadAction;
+
+ // TAO_IDL - Generated from
+ // be\be_interface.cpp:598
+
+#if !defined (_RTSCHEDULING_DISTRIBUTABLETHREAD__VAR_OUT_CH_)
+#define _RTSCHEDULING_DISTRIBUTABLETHREAD__VAR_OUT_CH_
+
+ class DistributableThread;
+ typedef DistributableThread *DistributableThread_ptr;
+
+ typedef
+ TAO_Objref_Var_T<
+ DistributableThread
+ >
+ DistributableThread_var;
+
+ typedef
+ TAO_Objref_Out_T<
+ DistributableThread
+ >
+ DistributableThread_out;
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:54
+
+#if !defined (_RTSCHEDULING_DISTRIBUTABLETHREAD_CH_)
+#define _RTSCHEDULING_DISTRIBUTABLETHREAD_CH_
+
+ class TAO_RTScheduler_Export DistributableThread
+ : public virtual CORBA::Object
+ {
+ public:
+ typedef DistributableThread_ptr _ptr_type;
+ typedef DistributableThread_var _var_type;
+
+ // The static operations.
+ static DistributableThread_ptr _duplicate (DistributableThread_ptr obj);
+
+ static void _tao_release (DistributableThread_ptr obj);
+
+ static DistributableThread_ptr _narrow (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static DistributableThread_ptr _unchecked_narrow (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static DistributableThread_ptr _nil (void)
+ {
+ return static_cast<DistributableThread_ptr> (0);
+ }
+
+
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_enum/enum_ch.cpp:57
+
+ enum DT_State
+ {
+ ACTIVE,
+ CANCELLED
+ };
+
+ typedef DT_State &DT_State_out;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:44
+
+ static ::CORBA::TypeCode_ptr const _tc_DT_State;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void cancel (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual ::RTScheduling::DistributableThread::DT_State state (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:210
+
+ virtual CORBA::Boolean _is_a (
+ const char *type_id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ virtual const char* _interface_repository_id (void) const;
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+
+ protected:
+ // Abstract or local interface only.
+ DistributableThread (void);
+
+ virtual ~DistributableThread (void);
+
+ private:
+ // Private and unimplemented for concrete interfaces.
+ DistributableThread (const DistributableThread &);
+
+ void operator= (const DistributableThread &);
+ };
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:44
+
+ extern TAO_RTScheduler_Export ::CORBA::TypeCode_ptr const _tc_DistributableThread;
+
+ // TAO_IDL - Generated from
+ // be\be_interface.cpp:598
+
+#if !defined (_RTSCHEDULING_CURRENT__VAR_OUT_CH_)
+#define _RTSCHEDULING_CURRENT__VAR_OUT_CH_
+
+ class Current;
+ typedef Current *Current_ptr;
+
+ typedef
+ TAO_Objref_Var_T<
+ Current
+ >
+ Current_var;
+
+ typedef
+ TAO_Objref_Out_T<
+ Current
+ >
+ Current_out;
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:54
+
+#if !defined (_RTSCHEDULING_CURRENT_CH_)
+#define _RTSCHEDULING_CURRENT_CH_
+
+ class TAO_RTScheduler_Export Current
+ : public virtual ::RTCORBA::Current
+ {
+ public:
+ typedef Current_ptr _ptr_type;
+ typedef Current_var _var_type;
+
+ // The static operations.
+ static Current_ptr _duplicate (Current_ptr obj);
+
+ static void _tao_release (Current_ptr obj);
+
+ static Current_ptr _narrow (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static Current_ptr _unchecked_narrow (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static Current_ptr _nil (void)
+ {
+ return static_cast<Current_ptr> (0);
+ }
+
+
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual ::RTScheduling::DistributableThread_ptr spawn (
+ ::RTScheduling::ThreadAction_ptr start,
+ ::CORBA::VoidData data,
+ const char * name,
+ ::CORBA::Policy_ptr sched_param,
+ ::CORBA::Policy_ptr implicit_sched_param,
+ ::CORBA::ULong stack_size,
+ ::RTCORBA::Priority base_priority
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_exception/exception_ch.cpp:53
+
+#if !defined (_RTSCHEDULING_CURRENT_UNSUPPORTED_SCHEDULING_DISCIPLINE_CH_)
+#define _RTSCHEDULING_CURRENT_UNSUPPORTED_SCHEDULING_DISCIPLINE_CH_
+
+ class TAO_RTScheduler_Export UNSUPPORTED_SCHEDULING_DISCIPLINE : public CORBA::UserException
+ {
+ public:
+
+ UNSUPPORTED_SCHEDULING_DISCIPLINE (void);
+ UNSUPPORTED_SCHEDULING_DISCIPLINE (const UNSUPPORTED_SCHEDULING_DISCIPLINE &);
+ ~UNSUPPORTED_SCHEDULING_DISCIPLINE (void);
+
+ UNSUPPORTED_SCHEDULING_DISCIPLINE &operator= (const UNSUPPORTED_SCHEDULING_DISCIPLINE &);
+
+ static UNSUPPORTED_SCHEDULING_DISCIPLINE *_downcast (CORBA::Exception *);
+ static const UNSUPPORTED_SCHEDULING_DISCIPLINE *_downcast (CORBA::Exception const *);
+
+ static CORBA::Exception *_alloc (void);
+
+ virtual CORBA::Exception *_tao_duplicate (void) const;
+
+ virtual void _raise (void) const;
+
+ virtual void _tao_encode (
+ TAO_OutputCDR &
+ ACE_ENV_ARG_DECL
+ ) const;
+
+ virtual void _tao_decode (
+ TAO_InputCDR &
+ ACE_ENV_ARG_DECL
+ );
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_exception/exception_ch.cpp:129
+
+ virtual CORBA::TypeCode_ptr _tao_type (void) const;
+ };
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:44
+
+ static ::CORBA::TypeCode_ptr const _tc_UNSUPPORTED_SCHEDULING_DISCIPLINE;
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void begin_scheduling_segment (
+ const char * name,
+ ::CORBA::Policy_ptr sched_param,
+ ::CORBA::Policy_ptr implicit_sched_param
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ ::RTScheduling::Current::UNSUPPORTED_SCHEDULING_DISCIPLINE
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void update_scheduling_segment (
+ const char * name,
+ ::CORBA::Policy_ptr sched_param,
+ ::CORBA::Policy_ptr implicit_sched_param
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ ::RTScheduling::Current::UNSUPPORTED_SCHEDULING_DISCIPLINE
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void end_scheduling_segment (
+ const char * name
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_sequence/sequence_ch.cpp:101
+
+#if !defined (_RTSCHEDULING_CURRENT_IDTYPE_CH_)
+#define _RTSCHEDULING_CURRENT_IDTYPE_CH_
+
+ class IdType;
+
+ typedef
+ TAO_FixedSeq_Var_T<
+ IdType
+ >
+ IdType_var;
+
+ typedef
+ TAO_Seq_Out_T<
+ IdType
+ >
+ IdType_out;
+
+ class TAO_RTScheduler_Export IdType
+ : public
+ TAO::unbounded_value_sequence<
+ CORBA::Octet
+ >
+ {
+ public:
+ IdType (void);
+ IdType (CORBA::ULong max);
+ IdType (
+ CORBA::ULong max,
+ CORBA::ULong length,
+ CORBA::Octet* buffer,
+ CORBA::Boolean release = false
+ );
+ IdType (const IdType &);
+ ~IdType (void);
+
+ typedef IdType_var _var_type;
+
+#if (TAO_NO_COPY_OCTET_SEQUENCES == 1)
+ IdType (
+ CORBA::ULong length,
+ const ACE_Message_Block* mb
+ )
+ : TAO::unbounded_value_sequence<CORBA::Octet> (length, mb) {}
+#endif /* TAO_NO_COPY_OCTET_SEQUENCE == 1 */
+ };
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:44
+
+ static ::CORBA::TypeCode_ptr const _tc_IdType;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual ::RTScheduling::Current::IdType * id (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual ::RTScheduling::DistributableThread_ptr lookup (
+ const ::RTScheduling::Current::IdType & id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual ::CORBA::Policy_ptr scheduling_parameter (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual ::CORBA::Policy_ptr implicit_scheduling_parameter (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_sequence/sequence_ch.cpp:101
+
+#if !defined (_RTSCHEDULING_CURRENT_NAMELIST_CH_)
+#define _RTSCHEDULING_CURRENT_NAMELIST_CH_
+
+ class NameList;
+
+ typedef
+ TAO_VarSeq_Var_T<
+ NameList
+ >
+ NameList_var;
+
+ typedef
+ TAO_Seq_Out_T<
+ NameList
+ >
+ NameList_out;
+
+ class TAO_RTScheduler_Export NameList
+ : public
+ TAO::unbounded_string_sequence
+ {
+ public:
+ NameList (void);
+ NameList (CORBA::ULong max);
+ NameList (
+ CORBA::ULong max,
+ CORBA::ULong length,
+ char ** buffer,
+ CORBA::Boolean release = false
+ );
+ NameList (const NameList &);
+ ~NameList (void);
+
+ typedef NameList_var _var_type;
+ };
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:44
+
+ static ::CORBA::TypeCode_ptr const _tc_NameList;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual ::RTScheduling::Current::NameList * current_scheduling_segment_names (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:210
+
+ virtual CORBA::Boolean _is_a (
+ const char *type_id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ virtual const char* _interface_repository_id (void) const;
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+
+ protected:
+ // Abstract or local interface only.
+ Current (void);
+
+ virtual ~Current (void);
+
+ private:
+ // Private and unimplemented for concrete interfaces.
+ Current (const Current &);
+
+ void operator= (const Current &);
+ };
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:44
+
+ extern TAO_RTScheduler_Export ::CORBA::TypeCode_ptr const _tc_Current;
+
+ // TAO_IDL - Generated from
+ // be\be_interface.cpp:598
+
+#if !defined (_RTSCHEDULING_RESOURCEMANAGER__VAR_OUT_CH_)
+#define _RTSCHEDULING_RESOURCEMANAGER__VAR_OUT_CH_
+
+ class ResourceManager;
+ typedef ResourceManager *ResourceManager_ptr;
+
+ typedef
+ TAO_Objref_Var_T<
+ ResourceManager
+ >
+ ResourceManager_var;
+
+ typedef
+ TAO_Objref_Out_T<
+ ResourceManager
+ >
+ ResourceManager_out;
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:54
+
+#if !defined (_RTSCHEDULING_RESOURCEMANAGER_CH_)
+#define _RTSCHEDULING_RESOURCEMANAGER_CH_
+
+ class TAO_RTScheduler_Export ResourceManager
+ : public virtual ::RTCORBA::Mutex
+ {
+ public:
+ typedef ResourceManager_ptr _ptr_type;
+ typedef ResourceManager_var _var_type;
+
+ // The static operations.
+ static ResourceManager_ptr _duplicate (ResourceManager_ptr obj);
+
+ static void _tao_release (ResourceManager_ptr obj);
+
+ static ResourceManager_ptr _narrow (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static ResourceManager_ptr _unchecked_narrow (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static ResourceManager_ptr _nil (void)
+ {
+ return static_cast<ResourceManager_ptr> (0);
+ }
+
+
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:210
+
+ virtual CORBA::Boolean _is_a (
+ const char *type_id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ virtual const char* _interface_repository_id (void) const;
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+
+ protected:
+ // Abstract or local interface only.
+ ResourceManager (void);
+
+ virtual ~ResourceManager (void);
+
+ private:
+ // Private and unimplemented for concrete interfaces.
+ ResourceManager (const ResourceManager &);
+
+ void operator= (const ResourceManager &);
+ };
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:44
+
+ extern TAO_RTScheduler_Export ::CORBA::TypeCode_ptr const _tc_ResourceManager;
+
+ // TAO_IDL - Generated from
+ // be\be_interface.cpp:598
+
+#if !defined (_RTSCHEDULING_SCHEDULER__VAR_OUT_CH_)
+#define _RTSCHEDULING_SCHEDULER__VAR_OUT_CH_
+
+ class Scheduler;
+ typedef Scheduler *Scheduler_ptr;
+
+ typedef
+ TAO_Objref_Var_T<
+ Scheduler
+ >
+ Scheduler_var;
+
+ typedef
+ TAO_Objref_Out_T<
+ Scheduler
+ >
+ Scheduler_out;
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:54
+
+#if !defined (_RTSCHEDULING_SCHEDULER_CH_)
+#define _RTSCHEDULING_SCHEDULER_CH_
+
+ class TAO_RTScheduler_Export Scheduler
+ : public virtual CORBA::Object
+ {
+ public:
+ typedef Scheduler_ptr _ptr_type;
+ typedef Scheduler_var _var_type;
+
+ // The static operations.
+ static Scheduler_ptr _duplicate (Scheduler_ptr obj);
+
+ static void _tao_release (Scheduler_ptr obj);
+
+ static Scheduler_ptr _narrow (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static Scheduler_ptr _unchecked_narrow (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ static Scheduler_ptr _nil (void)
+ {
+ return static_cast<Scheduler_ptr> (0);
+ }
+
+
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_exception/exception_ch.cpp:53
+
+#if !defined (_RTSCHEDULING_SCHEDULER_INCOMPATIBLE_SCHEDULING_DISCIPLINES_CH_)
+#define _RTSCHEDULING_SCHEDULER_INCOMPATIBLE_SCHEDULING_DISCIPLINES_CH_
+
+ class TAO_RTScheduler_Export INCOMPATIBLE_SCHEDULING_DISCIPLINES : public CORBA::UserException
+ {
+ public:
+
+ INCOMPATIBLE_SCHEDULING_DISCIPLINES (void);
+ INCOMPATIBLE_SCHEDULING_DISCIPLINES (const INCOMPATIBLE_SCHEDULING_DISCIPLINES &);
+ ~INCOMPATIBLE_SCHEDULING_DISCIPLINES (void);
+
+ INCOMPATIBLE_SCHEDULING_DISCIPLINES &operator= (const INCOMPATIBLE_SCHEDULING_DISCIPLINES &);
+
+ static INCOMPATIBLE_SCHEDULING_DISCIPLINES *_downcast (CORBA::Exception *);
+ static const INCOMPATIBLE_SCHEDULING_DISCIPLINES *_downcast (CORBA::Exception const *);
+
+ static CORBA::Exception *_alloc (void);
+
+ virtual CORBA::Exception *_tao_duplicate (void) const;
+
+ virtual void _raise (void) const;
+
+ virtual void _tao_encode (
+ TAO_OutputCDR &
+ ACE_ENV_ARG_DECL
+ ) const;
+
+ virtual void _tao_decode (
+ TAO_InputCDR &
+ ACE_ENV_ARG_DECL
+ );
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_exception/exception_ch.cpp:129
+
+ virtual CORBA::TypeCode_ptr _tao_type (void) const;
+ };
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:44
+
+ static ::CORBA::TypeCode_ptr const _tc_INCOMPATIBLE_SCHEDULING_DISCIPLINES;
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual ::CORBA::PolicyList * scheduling_policies (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void scheduling_policies (
+ const ::CORBA::PolicyList & scheduling_policies
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual ::CORBA::PolicyList * poa_policies (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual char * scheduling_discipline_name (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual ::RTScheduling::ResourceManager_ptr create_resource_manager (
+ const char * name,
+ ::CORBA::Policy_ptr scheduling_parameter
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void set_scheduling_parameter (
+ ::PortableServer::Servant & resource,
+ const char * name,
+ ::CORBA::Policy_ptr scheduling_parameter
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void begin_new_scheduling_segment (
+ const ::RTScheduling::Current::IdType & guid,
+ const char * name,
+ ::CORBA::Policy_ptr sched_param,
+ ::CORBA::Policy_ptr implicit_sched_param
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ ::RTScheduling::Current::UNSUPPORTED_SCHEDULING_DISCIPLINE
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void begin_nested_scheduling_segment (
+ const ::RTScheduling::Current::IdType & guid,
+ const char * name,
+ ::CORBA::Policy_ptr sched_param,
+ ::CORBA::Policy_ptr implicit_sched_param
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ ::RTScheduling::Current::UNSUPPORTED_SCHEDULING_DISCIPLINE
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void update_scheduling_segment (
+ const ::RTScheduling::Current::IdType & guid,
+ const char * name,
+ ::CORBA::Policy_ptr sched_param,
+ ::CORBA::Policy_ptr implicit_sched_param
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ ::RTScheduling::Current::UNSUPPORTED_SCHEDULING_DISCIPLINE
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void end_scheduling_segment (
+ const ::RTScheduling::Current::IdType & guid,
+ const char * name
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void end_nested_scheduling_segment (
+ const ::RTScheduling::Current::IdType & guid,
+ const char * name,
+ ::CORBA::Policy_ptr outer_sched_param
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void send_request (
+ ::PortableInterceptor::ClientRequestInfo_ptr ri
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ ::PortableInterceptor::ForwardRequest
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void receive_request (
+ ::PortableInterceptor::ServerRequestInfo_ptr ri,
+ ::RTScheduling::Current::IdType_out guid,
+ CORBA::String_out name,
+ ::CORBA::Policy_out sched_param,
+ ::CORBA::Policy_out implicit_sched_param
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ ::PortableInterceptor::ForwardRequest
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void send_reply (
+ ::PortableInterceptor::ServerRequestInfo_ptr ri
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void send_exception (
+ ::PortableInterceptor::ServerRequestInfo_ptr ri
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ ::PortableInterceptor::ForwardRequest
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void send_other (
+ ::PortableInterceptor::ServerRequestInfo_ptr ri
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ ::PortableInterceptor::ForwardRequest
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void send_poll (
+ ::PortableInterceptor::ClientRequestInfo_ptr ri
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ ::PortableInterceptor::ForwardRequest
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void receive_reply (
+ ::PortableInterceptor::ClientRequestInfo_ptr ri
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void receive_exception (
+ ::PortableInterceptor::ClientRequestInfo_ptr ri
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ ::PortableInterceptor::ForwardRequest
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void receive_other (
+ ::PortableInterceptor::ClientRequestInfo_ptr ri
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ ::PortableInterceptor::ForwardRequest
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_operation/operation_ch.cpp:46
+
+ virtual void cancel (
+ const ::RTScheduling::Current::IdType & guid
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ )) = 0;
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/interface_ch.cpp:210
+
+ virtual CORBA::Boolean _is_a (
+ const char *type_id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ );
+
+ virtual const char* _interface_repository_id (void) const;
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+
+ protected:
+ // Abstract or local interface only.
+ Scheduler (void);
+
+ virtual ~Scheduler (void);
+
+ private:
+ // Private and unimplemented for concrete interfaces.
+ Scheduler (const Scheduler &);
+
+ void operator= (const Scheduler &);
+ };
+
+#endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_typecode/typecode_decl.cpp:44
+
+ extern TAO_RTScheduler_Export ::CORBA::TypeCode_ptr const _tc_Scheduler;
+
+// TAO_IDL - Generated from
+// be\be_visitor_module/module_ch.cpp:66
+
+} // module RTScheduling
+
+// TAO_IDL - Generated from
+// be\be_visitor_traits.cpp:61
+
+// Traits specializations.
+namespace TAO
+{
+
+#if !defined (_RTSCHEDULING_THREADACTION__TRAITS_CH_)
+#define _RTSCHEDULING_THREADACTION__TRAITS_CH_
+
+ template<>
+ struct TAO_RTScheduler_Export Objref_Traits< ::RTScheduling::ThreadAction>
+ {
+ static ::RTScheduling::ThreadAction_ptr duplicate (
+ ::RTScheduling::ThreadAction_ptr
+ );
+ static void release (
+ ::RTScheduling::ThreadAction_ptr
+ );
+ static ::RTScheduling::ThreadAction_ptr nil (void);
+ static CORBA::Boolean marshal (
+ ::RTScheduling::ThreadAction_ptr p,
+ TAO_OutputCDR & cdr
+ );
+ };
+
+#endif /* end #if !defined */
+
+#if !defined (_RTSCHEDULING_DISTRIBUTABLETHREAD__TRAITS_CH_)
+#define _RTSCHEDULING_DISTRIBUTABLETHREAD__TRAITS_CH_
+
+ template<>
+ struct TAO_RTScheduler_Export Objref_Traits< ::RTScheduling::DistributableThread>
+ {
+ static ::RTScheduling::DistributableThread_ptr duplicate (
+ ::RTScheduling::DistributableThread_ptr
+ );
+ static void release (
+ ::RTScheduling::DistributableThread_ptr
+ );
+ static ::RTScheduling::DistributableThread_ptr nil (void);
+ static CORBA::Boolean marshal (
+ ::RTScheduling::DistributableThread_ptr p,
+ TAO_OutputCDR & cdr
+ );
+ };
+
+#endif /* end #if !defined */
+
+#if !defined (_RTSCHEDULING_CURRENT__TRAITS_CH_)
+#define _RTSCHEDULING_CURRENT__TRAITS_CH_
+
+ template<>
+ struct TAO_RTScheduler_Export Objref_Traits< ::RTScheduling::Current>
+ {
+ static ::RTScheduling::Current_ptr duplicate (
+ ::RTScheduling::Current_ptr
+ );
+ static void release (
+ ::RTScheduling::Current_ptr
+ );
+ static ::RTScheduling::Current_ptr nil (void);
+ static CORBA::Boolean marshal (
+ ::RTScheduling::Current_ptr p,
+ TAO_OutputCDR & cdr
+ );
+ };
+
+#endif /* end #if !defined */
+
+#if !defined (_RTSCHEDULING_RESOURCEMANAGER__TRAITS_CH_)
+#define _RTSCHEDULING_RESOURCEMANAGER__TRAITS_CH_
+
+ template<>
+ struct TAO_RTScheduler_Export Objref_Traits< ::RTScheduling::ResourceManager>
+ {
+ static ::RTScheduling::ResourceManager_ptr duplicate (
+ ::RTScheduling::ResourceManager_ptr
+ );
+ static void release (
+ ::RTScheduling::ResourceManager_ptr
+ );
+ static ::RTScheduling::ResourceManager_ptr nil (void);
+ static CORBA::Boolean marshal (
+ ::RTScheduling::ResourceManager_ptr p,
+ TAO_OutputCDR & cdr
+ );
+ };
+
+#endif /* end #if !defined */
+
+#if !defined (_RTSCHEDULING_SCHEDULER__TRAITS_CH_)
+#define _RTSCHEDULING_SCHEDULER__TRAITS_CH_
+
+ template<>
+ struct TAO_RTScheduler_Export Objref_Traits< ::RTScheduling::Scheduler>
+ {
+ static ::RTScheduling::Scheduler_ptr duplicate (
+ ::RTScheduling::Scheduler_ptr
+ );
+ static void release (
+ ::RTScheduling::Scheduler_ptr
+ );
+ static ::RTScheduling::Scheduler_ptr nil (void);
+ static CORBA::Boolean marshal (
+ ::RTScheduling::Scheduler_ptr p,
+ TAO_OutputCDR & cdr
+ );
+ };
+
+#endif /* end #if !defined */
+}
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:955
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#if defined (__BORLANDC__)
+#pragma option pop
+#endif /* __BORLANDC__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* ifndef */
+
+
diff --git a/TAO/tao/RTScheduling/RTScheduler_Initializer.cpp b/TAO/tao/RTScheduling/RTScheduler_Initializer.cpp
new file mode 100644
index 00000000000..574b964f843
--- /dev/null
+++ b/TAO/tao/RTScheduling/RTScheduler_Initializer.cpp
@@ -0,0 +1,178 @@
+// -*- C++ -*-
+//
+// $Id$
+
+#include "tao/RTScheduling/RTScheduler_Initializer.h"
+#include "tao/RTScheduling/Request_Interceptor.h"
+
+ACE_RCSID (TAO, RTScheduler_Initializer, "$Id$")
+
+#include "tao/RTScheduling/RTScheduler.h"
+#include "tao/RTScheduling/Current.h"
+#include "tao/RTScheduling/RTScheduler_Manager.h"
+
+#include "tao/Exception.h"
+#include "tao/ORB_Core.h"
+#include "tao/PI/ORBInitInfo.h"
+#include "tao/debug.h"
+#include "ace/Service_Repository.h"
+#include "ace/Svc_Conf.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+static TAO_RTScheduler_Current_var current_cleanup;
+
+void
+ TAO_RTScheduler_ORB_Initializer::pre_init (
+ PortableInterceptor::ORBInitInfo_ptr info
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ //
+ // Register all of the RT related services.
+ //
+
+ // Create the RT_Current.
+
+ // Narrow to a TAO_ORBInitInfo object to get access to the
+ // orb_core() TAO extension.
+
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ "In pre_init\n"));
+
+ TAO_ORBInitInfo_var tao_info = TAO_ORBInitInfo::_narrow (info
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (CORBA::is_nil (tao_info.in ()))
+ {
+ if (TAO_debug_level > 0)
+ ACE_ERROR ((LM_ERROR,
+ "(%P|%t) Security_ORBInitializer::pre_init:\n"
+ "(%P|%t) Unable to narrow "
+ "\"PortableInterceptor::ORBInitInfo_ptr\" to\n"
+ "(%P|%t) \"TAO_ORBInitInfo *.\"\n"));
+
+ ACE_THROW (CORBA::INTERNAL ());
+ }
+
+
+ ACE_NEW_THROW_EX (this->current_,
+ TAO_RTScheduler_Current,
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_CHECK;
+
+ current_cleanup = this->current_;
+
+ this->current_->init (tao_info->orb_core ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ CORBA::Object_var current_obj = RTScheduling::Current::_narrow (this->current_
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ info->register_initial_reference ("RTScheduler_Current",
+ current_obj.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ Client_Interceptor *client_interceptor = 0;
+ ACE_NEW_THROW_EX (client_interceptor,
+ Client_Interceptor,
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_CHECK;
+
+ PortableInterceptor::ClientRequestInterceptor_var safe_client =
+ client_interceptor;
+
+ info->add_client_request_interceptor (client_interceptor
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ Server_Interceptor *server_interceptor = 0;
+ ACE_NEW_THROW_EX (server_interceptor,
+ Server_Interceptor (this->current_),
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_CHECK;
+
+ PortableInterceptor::ServerRequestInterceptor_var safe_server =
+ server_interceptor;
+
+ info->add_server_request_interceptor (server_interceptor
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Set the RTScheduler_Manager
+ TAO_RTScheduler_Manager *manager = 0;
+
+ ACE_NEW_THROW_EX (manager,
+ TAO_RTScheduler_Manager (tao_info->orb_core ()),
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_CHECK;
+
+
+ TAO_RTScheduler_Manager_var safe_manager = manager;
+
+ info->register_initial_reference ("RTSchedulerManager",
+ manager
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+void
+TAO_RTScheduler_ORB_Initializer::post_init (PortableInterceptor::ORBInitInfo_ptr info
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+
+ // @@ This is busted. TAO_ORBInitInfo should do proper reference
+ // counting.
+ // Narrow to a TAO_ORBInitInfo object to get access to the
+ // orb_core() TAO extension.
+ //TAO_ORBInitInfo_var tao_info = TAO_ORBInitInfo::_narrow (info
+ // ACE_ENV_ARG_PARAMETER);
+ //ACE_CHECK;
+
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ "In post_init\n"));
+
+ CORBA::Object_var rt_current_obj = info->resolve_initial_references ("RTCurrent"
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+
+ RTCORBA::Current_var rt_current = RTCORBA::Current::_narrow (rt_current_obj.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (CORBA::is_nil (rt_current.in ()))
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "(%P|%t) ::post_init \n"
+ "(%P|%t) Unable to narrow to RTCORBA::Current\n"));
+ ACE_THROW (CORBA::INTERNAL ());
+ }
+
+ this->current_->rt_current (rt_current.in ());
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/RTScheduling/RTScheduler_Initializer.h b/TAO/tao/RTScheduling/RTScheduler_Initializer.h
new file mode 100644
index 00000000000..8b242f9af9e
--- /dev/null
+++ b/TAO/tao/RTScheduling/RTScheduler_Initializer.h
@@ -0,0 +1,67 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file RTScheduler_Initializer.h
+ *
+ * $Id$
+ *
+ * @author Yamuna Krishnamurthy <yamuna@oomworks.com>
+ */
+//=============================================================================
+
+
+#ifndef TAO_RTSCHEDULER_INITIALIZER_H
+#define TAO_RTSCHEDULER_INITIALIZER_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Basic_Types.h"
+#include "tao/RTScheduling/rtscheduler_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PI/PI.h"
+#include "tao/LocalObject.h"
+
+// This is to remove "inherits via dominance" warnings from MSVC.
+// MSVC is being a little too paranoid.
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_RTScheduler_Current;
+
+/// RTCORBA ORB initializer.
+class TAO_RTScheduler_ORB_Initializer
+ : public virtual PortableInterceptor::ORBInitializer
+ , public virtual TAO_Local_RefCounted_Object
+{
+public:
+ virtual void pre_init (PortableInterceptor::ORBInitInfo_ptr info
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual void post_init (PortableInterceptor::ORBInitInfo_ptr info
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+private:
+
+ TAO_RTScheduler_Current* current_;
+
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_RTSCHEDULER_INITIALIZER_H */
diff --git a/TAO/tao/RTScheduling/RTScheduler_Loader.cpp b/TAO/tao/RTScheduling/RTScheduler_Loader.cpp
new file mode 100644
index 00000000000..bc4f99432bb
--- /dev/null
+++ b/TAO/tao/RTScheduling/RTScheduler_Loader.cpp
@@ -0,0 +1,83 @@
+
+// $Id$
+
+#include "tao/RTScheduling/RTScheduler_Loader.h"
+#include "tao/RTScheduling/RTScheduler_Initializer.h"
+
+#include "tao/debug.h"
+#include "tao/ORB_Core.h"
+#include "tao/ORBInitializer_Registry.h"
+
+ACE_RCSID (TAO, RTScheduler_Loader, "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_RTScheduler_Loader::~TAO_RTScheduler_Loader (void)
+{
+}
+
+int
+TAO_RTScheduler_Loader::init (int,
+ ACE_TCHAR* [])
+{
+ ACE_TRACE ("TAO_RTScheduler_Loader::init");
+
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ "In RTScheduler_Loader::init\n"));
+
+ static int initialized = 0;
+
+ // Only allow initialization once.
+ if (initialized)
+ return 0;
+
+ initialized = 1;
+
+ // Register the ORB initializer.
+ ACE_TRY_NEW_ENV
+ {
+ PortableInterceptor::ORBInitializer_ptr temp_orb_initializer =
+ PortableInterceptor::ORBInitializer::_nil ();
+
+ /// Register the RTCORBA ORBInitializer.
+ ACE_NEW_THROW_EX (temp_orb_initializer,
+ TAO_RTScheduler_ORB_Initializer,
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_TRY_CHECK;
+
+ PortableInterceptor::ORBInitializer_var orb_initializer =
+ temp_orb_initializer;
+
+ PortableInterceptor::register_orb_initializer (orb_initializer.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "Unexpected exception caught while initializing the RTScheduler:");
+ return 1;
+ }
+ ACE_ENDTRY;
+
+ return 0;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+/////////////////////////////////////////////////////////////////////
+
+ACE_FACTORY_DEFINE (TAO_RTScheduler, TAO_RTScheduler_Loader)
+ACE_STATIC_SVC_DEFINE (TAO_RTScheduler_Loader,
+ ACE_TEXT ("RTScheduler_Loader"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (TAO_RTScheduler_Loader),
+ ACE_Service_Type::DELETE_THIS
+ | ACE_Service_Type::DELETE_OBJ,
+ 0)
diff --git a/TAO/tao/RTScheduling/RTScheduler_Loader.h b/TAO/tao/RTScheduling/RTScheduler_Loader.h
new file mode 100644
index 00000000000..750f8eeddb3
--- /dev/null
+++ b/TAO/tao/RTScheduling/RTScheduler_Loader.h
@@ -0,0 +1,52 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file RTScheduler_Loader.h
+ *
+ * $Id$
+ *
+ * Header file for Loading RTScheduler.
+ *
+ *
+ * @author Yamuna Krishnamurthy <yamuna@oomworks.com>
+ */
+//=============================================================================
+
+#ifndef TAO_RTSCHEDULER_LOADER_H
+#define TAO_RTSCHEDULER_LOADER_H
+#include /**/ "ace/pre.h"
+
+#include "tao/RTScheduling/rtscheduler_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PI/PI.h"
+#include "tao/Versioned_Namespace.h"
+
+#include "ace/Service_Object.h"
+#include "ace/Service_Config.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_RTScheduler_Export TAO_RTScheduler_Loader : public ACE_Service_Object
+{
+public:
+
+ /// Destructor.
+ virtual ~TAO_RTScheduler_Loader (void);
+
+ /// Initialize the RTScheduler loader hooks.
+ virtual int init (int argc,
+ ACE_TCHAR* []);
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE_EXPORT (TAO_RTScheduler, TAO_RTScheduler_Loader)
+ACE_FACTORY_DECLARE (TAO_RTScheduler, TAO_RTScheduler_Loader)
+
+#include /**/ "ace/post.h"
+#endif /* TAO_RTSCHEDULER_LOADER_H */
diff --git a/TAO/tao/RTScheduling/RTScheduler_Manager.cpp b/TAO/tao/RTScheduling/RTScheduler_Manager.cpp
new file mode 100644
index 00000000000..14c269cab6c
--- /dev/null
+++ b/TAO/tao/RTScheduling/RTScheduler_Manager.cpp
@@ -0,0 +1,46 @@
+// $Id$
+
+#include "tao/RTScheduling/RTScheduler_Manager.h"
+
+#if ! defined (__ACE_INLINE__)
+#include "tao/RTScheduling/RTScheduler_Manager.i"
+#endif /* __ACE_INLINE__ */
+
+ACE_RCSID(TAO, RT_ORB, "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_RTScheduler_Manager::TAO_RTScheduler_Manager (void)
+{
+
+}
+
+TAO_RTScheduler_Manager::~TAO_RTScheduler_Manager (void)
+{
+}
+
+TAO_RTScheduler_Manager_ptr
+TAO_RTScheduler_Manager::_narrow (CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_NOT_USED)
+{
+ return
+ TAO_RTScheduler_Manager::_duplicate (
+ dynamic_cast<TAO_RTScheduler_Manager *> (obj)
+ );
+}
+
+TAO_RTScheduler_Manager_ptr
+TAO_RTScheduler_Manager::_duplicate (TAO_RTScheduler_Manager_ptr obj)
+{
+ if (!CORBA::is_nil (obj))
+ obj->_add_ref ();
+ return obj;
+}
+
+const char*
+TAO_RTScheduler_Manager::_interface_repository_id (void) const
+{
+ return "IDL:RTScheduler_Manager:1.0";
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/RTScheduling/RTScheduler_Manager.h b/TAO/tao/RTScheduling/RTScheduler_Manager.h
new file mode 100644
index 00000000000..908922f6bda
--- /dev/null
+++ b/TAO/tao/RTScheduling/RTScheduler_Manager.h
@@ -0,0 +1,143 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file RTScheduler_Manager.h
+ *
+ * $Id$
+ *
+ * @author Yamuna Krishnmaurthy <yamuna@oomworks.com>
+ */
+//=============================================================================
+
+
+#ifndef TAO_PRIORITY_MAPPING_MANAGER_H
+#define TAO_PRIORITY_MAPPING_MANAGER_H
+
+#include "tao/RTScheduling/RTScheduler.h"
+#include "tao/LocalObject.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_RTScheduler_Manager;
+class TAO_RTScheduler_Manager_var;
+typedef TAO_RTScheduler_Manager *TAO_RTScheduler_Manager_ptr;
+
+
+/**
+ * @class TAO_RTScheduler_Manager
+ *
+ * @brief RTScheduler_Manager pseudo-objref.
+ *
+ * Allows setting of user-defined RTScheduler at run-time.
+ */
+class TAO_RTScheduler_Export TAO_RTScheduler_Manager :
+ public virtual TAO_Local_RefCounted_Object
+{
+public:
+
+ TAO_RTScheduler_Manager (void);
+ /// Constructor.
+ TAO_RTScheduler_Manager (TAO_ORB_Core*);
+
+ ///
+ void rtscheduler (RTScheduling::Scheduler_ptr rtscheduler
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ ///
+ RTScheduling::Scheduler_ptr rtscheduler (void);
+
+public:
+ typedef TAO_RTScheduler_Manager_ptr _ptr_type;
+ typedef TAO_RTScheduler_Manager_var _var_type;
+
+ // the static operations
+ static TAO_RTScheduler_Manager_ptr _duplicate (TAO_RTScheduler_Manager_ptr obj);
+ static TAO_RTScheduler_Manager_ptr _narrow (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ static TAO_RTScheduler_Manager_ptr _nil (void)
+ {
+ return (TAO_RTScheduler_Manager_ptr)0;
+ }
+
+ virtual const char* _interface_repository_id (void) const;
+
+protected:
+
+ /// Protected destructor to enforce proper memory management of this
+ /// reference counted object.
+ ~TAO_RTScheduler_Manager (void);
+
+private:
+
+ TAO_RTScheduler_Manager (const TAO_RTScheduler_Manager &);
+ void operator= (const TAO_RTScheduler_Manager &);
+ TAO_ORB_Core* orb_;
+
+private:
+ RTScheduling::Scheduler_var rtscheduler_;
+};
+
+class TAO_RTScheduler_Export TAO_RTScheduler_Manager_var
+ : private TAO_Base_var
+{
+public:
+ TAO_RTScheduler_Manager_var (void); // default constructor
+ TAO_RTScheduler_Manager_var (TAO_RTScheduler_Manager_ptr);
+ TAO_RTScheduler_Manager_var (const TAO_RTScheduler_Manager_var &); // copy constructor
+ ~TAO_RTScheduler_Manager_var (void); // destructor
+
+ TAO_RTScheduler_Manager_var &operator= (TAO_RTScheduler_Manager_ptr);
+ TAO_RTScheduler_Manager_var &operator= (const TAO_RTScheduler_Manager_var &);
+ TAO_RTScheduler_Manager_ptr operator-> (void) const;
+
+ /// in, inout, out, _retn
+ operator const TAO_RTScheduler_Manager_ptr &() const;
+ operator TAO_RTScheduler_Manager_ptr &();
+ TAO_RTScheduler_Manager_ptr in (void) const;
+ TAO_RTScheduler_Manager_ptr &inout (void);
+ TAO_RTScheduler_Manager_ptr &out (void);
+ TAO_RTScheduler_Manager_ptr _retn (void);
+ TAO_RTScheduler_Manager_ptr ptr (void) const;
+
+ // Hooks used by template sequence and object manager classes
+ // for non-defined forward declared interfaces.
+ static TAO_RTScheduler_Manager_ptr duplicate (TAO_RTScheduler_Manager_ptr);
+ static void release (TAO_RTScheduler_Manager_ptr);
+ static TAO_RTScheduler_Manager_ptr nil (void);
+ static TAO_RTScheduler_Manager_ptr narrow (CORBA::Object * ACE_ENV_ARG_DECL_NOT_USED);
+ static CORBA::Object * upcast (void *);
+
+private:
+ /// Unimplemented - prevents widening assignment.
+ TAO_RTScheduler_Manager_ptr ptr_;
+ TAO_RTScheduler_Manager_var (const TAO_Base_var &rhs);
+ TAO_RTScheduler_Manager_var &operator= (const TAO_Base_var &rhs);
+};
+
+class TAO_RTScheduler_Export TAO_RTScheduler_Manager_out
+{
+public:
+ TAO_RTScheduler_Manager_out (TAO_RTScheduler_Manager_ptr &);
+ TAO_RTScheduler_Manager_out (TAO_RTScheduler_Manager_var &);
+ TAO_RTScheduler_Manager_out (const TAO_RTScheduler_Manager_out &);
+ TAO_RTScheduler_Manager_out &operator= (const TAO_RTScheduler_Manager_out &);
+ TAO_RTScheduler_Manager_out &operator= (const TAO_RTScheduler_Manager_var &);
+ TAO_RTScheduler_Manager_out &operator= (TAO_RTScheduler_Manager_ptr);
+ operator TAO_RTScheduler_Manager_ptr &();
+ TAO_RTScheduler_Manager_ptr &ptr (void);
+ TAO_RTScheduler_Manager_ptr operator-> (void);
+
+private:
+ TAO_RTScheduler_Manager_ptr &ptr_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+#include "tao/RTScheduling/RTScheduler_Manager.i"
+#endif /* __ACE_INLINE__ */
+
+#endif /* TAO_PRIORITY_MAPPING_MANAGER_H */
diff --git a/TAO/tao/RTScheduling/RTScheduler_Manager.i b/TAO/tao/RTScheduling/RTScheduler_Manager.i
new file mode 100644
index 00000000000..da473a28e64
--- /dev/null
+++ b/TAO/tao/RTScheduling/RTScheduler_Manager.i
@@ -0,0 +1,234 @@
+// -*- C++ -*-
+//
+// $Id$
+
+#include "tao/ORB_Core.h"
+#include "tao/ORB.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// *************************************************************
+// Inline operations for class TAO_RTScheduler_Manager_var
+// *************************************************************
+
+ACE_INLINE
+TAO_RTScheduler_Manager_var::TAO_RTScheduler_Manager_var (void)
+ : ptr_ (TAO_RTScheduler_Manager::_nil ())
+{}
+
+ACE_INLINE
+TAO_RTScheduler_Manager_var::TAO_RTScheduler_Manager_var (
+ TAO_RTScheduler_Manager_ptr p)
+ : ptr_ (p)
+{}
+
+ACE_INLINE ::TAO_RTScheduler_Manager_ptr
+TAO_RTScheduler_Manager_var::ptr (void) const
+{
+ return this->ptr_;
+}
+
+ACE_INLINE
+TAO_RTScheduler_Manager_var::TAO_RTScheduler_Manager_var (
+ const ::TAO_RTScheduler_Manager_var &p) // copy constructor
+ : TAO_Base_var (),
+ ptr_ (TAO_RTScheduler_Manager::_duplicate (p.ptr ()))
+{}
+
+ACE_INLINE
+TAO_RTScheduler_Manager_var::~TAO_RTScheduler_Manager_var (void)
+{
+ CORBA::release (this->ptr_);
+}
+
+ACE_INLINE TAO_RTScheduler_Manager_var &
+TAO_RTScheduler_Manager_var::operator= (TAO_RTScheduler_Manager_ptr p)
+{
+ CORBA::release (this->ptr_);
+ this->ptr_ = p;
+ return *this;
+}
+
+ACE_INLINE TAO_RTScheduler_Manager_var &
+TAO_RTScheduler_Manager_var::operator= (const ::TAO_RTScheduler_Manager_var &p)
+{
+ if (this != &p)
+ {
+ CORBA::release (this->ptr_);
+ this->ptr_ = ::TAO_RTScheduler_Manager::_duplicate (p.ptr ());
+ }
+
+ return *this;
+}
+
+ACE_INLINE
+TAO_RTScheduler_Manager_var::operator const ::TAO_RTScheduler_Manager_ptr &() const // cast
+{
+ return this->ptr_;
+}
+
+ACE_INLINE
+TAO_RTScheduler_Manager_var::operator ::TAO_RTScheduler_Manager_ptr &() // cast
+{
+ return this->ptr_;
+}
+
+ACE_INLINE ::TAO_RTScheduler_Manager_ptr
+TAO_RTScheduler_Manager_var::operator-> (void) const
+{
+ return this->ptr_;
+}
+
+ACE_INLINE ::TAO_RTScheduler_Manager_ptr
+TAO_RTScheduler_Manager_var::in (void) const
+{
+ return this->ptr_;
+}
+
+ACE_INLINE ::TAO_RTScheduler_Manager_ptr &
+TAO_RTScheduler_Manager_var::inout (void)
+{
+ return this->ptr_;
+}
+
+ACE_INLINE ::TAO_RTScheduler_Manager_ptr &
+TAO_RTScheduler_Manager_var::out (void)
+{
+ CORBA::release (this->ptr_);
+ this->ptr_ = ::TAO_RTScheduler_Manager::_nil ();
+ return this->ptr_;
+}
+
+ACE_INLINE ::TAO_RTScheduler_Manager_ptr
+TAO_RTScheduler_Manager_var::_retn (void)
+{
+ // yield ownership of managed obj reference
+ ::TAO_RTScheduler_Manager_ptr val = this->ptr_;
+ this->ptr_ = ::TAO_RTScheduler_Manager::_nil ();
+ return val;
+}
+
+ACE_INLINE ::TAO_RTScheduler_Manager_ptr
+TAO_RTScheduler_Manager_var::duplicate (TAO_RTScheduler_Manager_ptr p)
+{
+ return ::TAO_RTScheduler_Manager::_duplicate (p);
+}
+
+ACE_INLINE void
+TAO_RTScheduler_Manager_var::release (TAO_RTScheduler_Manager_ptr p)
+{
+ CORBA::release (p);
+}
+
+ACE_INLINE ::TAO_RTScheduler_Manager_ptr
+TAO_RTScheduler_Manager_var::nil (void)
+{
+ return ::TAO_RTScheduler_Manager::_nil ();
+}
+
+ACE_INLINE ::TAO_RTScheduler_Manager_ptr
+TAO_RTScheduler_Manager_var::narrow (
+ CORBA::Object * p
+ ACE_ENV_ARG_DECL)
+{
+ return ::TAO_RTScheduler_Manager::_narrow (p ACE_ENV_ARG_PARAMETER);
+}
+
+ACE_INLINE CORBA::Object *
+TAO_RTScheduler_Manager_var::upcast (void *src)
+{
+ TAO_RTScheduler_Manager **tmp =
+ static_cast<TAO_RTScheduler_Manager **> (src);
+ return *tmp;
+}
+
+
+// *************************************************************
+// Inline operations for class TAO_RTScheduler_Manager_out
+// *************************************************************
+
+ACE_INLINE
+TAO_RTScheduler_Manager_out::TAO_RTScheduler_Manager_out (TAO_RTScheduler_Manager_ptr &p)
+ : ptr_ (p)
+{
+ this->ptr_ = ::TAO_RTScheduler_Manager::_nil ();
+}
+
+ACE_INLINE
+TAO_RTScheduler_Manager_out::TAO_RTScheduler_Manager_out (TAO_RTScheduler_Manager_var &p) // constructor from _var
+ : ptr_ (p.out ())
+{
+ CORBA::release (this->ptr_);
+ this->ptr_ = ::TAO_RTScheduler_Manager::_nil ();
+}
+
+ACE_INLINE
+TAO_RTScheduler_Manager_out::TAO_RTScheduler_Manager_out (const ::TAO_RTScheduler_Manager_out &p) // copy constructor
+ : ptr_ (const_cast<TAO_RTScheduler_Manager_out &> (p).ptr_)
+{}
+
+ACE_INLINE ::TAO_RTScheduler_Manager_out &
+TAO_RTScheduler_Manager_out::operator= (const ::TAO_RTScheduler_Manager_out &p)
+{
+ this->ptr_ = const_cast<TAO_RTScheduler_Manager_out&> (p).ptr_;
+ return *this;
+}
+
+ACE_INLINE TAO_RTScheduler_Manager_out &
+TAO_RTScheduler_Manager_out::operator= (const ::TAO_RTScheduler_Manager_var &p)
+{
+ this->ptr_ = ::TAO_RTScheduler_Manager::_duplicate (p.ptr ());
+ return *this;
+}
+
+ACE_INLINE TAO_RTScheduler_Manager_out &
+TAO_RTScheduler_Manager_out::operator= (TAO_RTScheduler_Manager_ptr p)
+{
+ this->ptr_ = p;
+ return *this;
+}
+
+ACE_INLINE
+TAO_RTScheduler_Manager_out::operator ::TAO_RTScheduler_Manager_ptr &() // cast
+{
+ return this->ptr_;
+}
+
+ACE_INLINE ::TAO_RTScheduler_Manager_ptr &
+TAO_RTScheduler_Manager_out::ptr (void) // ptr
+{
+ return this->ptr_;
+}
+
+ACE_INLINE ::TAO_RTScheduler_Manager_ptr
+TAO_RTScheduler_Manager_out::operator-> (void)
+{
+ return this->ptr_;
+}
+
+///////////////////////////////////////////////////////////////////////////
+ACE_INLINE
+TAO_RTScheduler_Manager::TAO_RTScheduler_Manager (TAO_ORB_Core* orb)
+ : orb_ (orb)
+{
+}
+
+ACE_INLINE RTScheduling::Scheduler_ptr
+TAO_RTScheduler_Manager::rtscheduler (void)
+{
+ return RTScheduling::Scheduler::_duplicate (this->rtscheduler_.in());
+}
+
+ACE_INLINE void
+TAO_RTScheduler_Manager::rtscheduler (RTScheduling::Scheduler_ptr rtscheduler
+ ACE_ENV_ARG_DECL)
+{
+ this->rtscheduler_ = RTScheduling::Scheduler::_duplicate (rtscheduler);
+ this->orb_->orb ()->register_initial_reference (
+ "RTScheduler",
+ RTScheduling::Scheduler::_duplicate (this->rtscheduler_.in ())
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/RTScheduling/RTScheduler_include.pidl b/TAO/tao/RTScheduling/RTScheduler_include.pidl
new file mode 100644
index 00000000000..4ab39b3131a
--- /dev/null
+++ b/TAO/tao/RTScheduling/RTScheduler_include.pidl
@@ -0,0 +1,38 @@
+/**
+ * @file RTScheduler_include.pidl
+ *
+ * $Id$
+ *
+ * @brief Include file for use in applications that need RTScheduler.pidl.
+ *
+ * This file just includes RTScheduler.pidl. The *C.h file generated from
+ * this is hand-crafted to itself include RTScheduler.h instead of
+ * RTSchedulerC.h (which will produce a compiler error message if
+ * included directly). The RTScheduler_includeC.h file can then be
+ * included directly and automatically by the IDL compiler when
+ * building the application.
+ *
+ * 1. Run the tao_idl compiler on the pidl file. The command used for
+ * this is:
+ *
+ * tao_idl -o orig -St -Sp
+ * -Wb,pre_include="ace/pre.h"
+ * -Wb,post_include="ace/post.h"
+ * RTScheduler_include.pidl
+ *
+ * 2. Then change this line in RTScheduler_includeC.h:
+ *
+ * #include "RTSchedulerC.h"
+ *
+ * to
+ *
+ * #include "RTScheduler.h"
+ */
+
+#ifndef _RT_SCHEDULER_INCLUDE_IDL_
+#define _RT_SCHEDULER_INCLUDE_IDL_
+
+#include "tao/RTScheduling/RTScheduler.pidl"
+
+#endif /* _RT_SCHEDULER_INCLUDE_IDL_ */
+
diff --git a/TAO/tao/RTScheduling/RTScheduler_includeA.h b/TAO/tao/RTScheduling/RTScheduler_includeA.h
new file mode 100644
index 00000000000..08e80fef94b
--- /dev/null
+++ b/TAO/tao/RTScheduling/RTScheduler_includeA.h
@@ -0,0 +1,100 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// C:\ACElatest\ACE_wrappers\TAO\TAO_IDL\be\be_codegen.cpp:186
+
+#ifndef _TAO_IDL_RTSCHEDULER_INCLUDEA_H_
+#define _TAO_IDL_RTSCHEDULER_INCLUDEA_H_
+
+#include "tao/ORB.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/CDR.h"
+#include "tao/Environment.h"
+
+#include "tao/RTScheduling/RTScheduler.h"
+
+#if defined (TAO_EXPORT_MACRO)
+#undef TAO_EXPORT_MACRO
+#endif
+#define TAO_EXPORT_MACRO
+
+#if defined (TAO_EXPORT_NESTED_CLASSES)
+# if defined (TAO_EXPORT_NESTED_MACRO)
+# undef TAO_EXPORT_NESTED_MACRO
+# endif /* defined (TAO_EXPORT_NESTED_MACRO) */
+# define TAO_EXPORT_NESTED_MACRO
+#endif /* TAO_EXPORT_NESTED_CLASSES */
+
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+#if defined (__BORLANDC__)
+#pragma option push -w-rvl -w-rch -w-ccc -w-inl
+#endif /* __BORLANDC__ */
+
+// TAO_IDL - Generated from
+// C:\ACElatest\ACE_wrappers\TAO\TAO_IDL\be\be_visitor_traits.cpp:58
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Traits specializations.
+namespace TAO
+{
+}
+
+// TAO_IDL - Generated from
+// C:\ACElatest\ACE_wrappers\TAO\TAO_IDL\be\be_visitor_root/cdr_op.cpp:48
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#ifndef __ACE_INLINE__
+
+// TAO_IDL - Generated from
+// C:\ACElatest\ACE_wrappers\TAO\TAO_IDL\be\be_visitor_root/cdr_op.cpp:64
+
+#endif /* __ACE_INLINE__ */
+
+// TAO_IDL - Generated from
+// C:\ACElatest\ACE_wrappers\TAO\TAO_IDL\be\be_codegen.cpp:1050
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#if defined (__BORLANDC__)
+#pragma option pop
+#endif /* __BORLANDC__ */
+
+#endif /* ifndef */
+
diff --git a/TAO/tao/RTScheduling/RTScheduler_includeC.h b/TAO/tao/RTScheduling/RTScheduler_includeC.h
new file mode 100644
index 00000000000..c9361beee75
--- /dev/null
+++ b/TAO/tao/RTScheduling/RTScheduler_includeC.h
@@ -0,0 +1,100 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// C:\ACElatest\ACE_wrappers\TAO\TAO_IDL\be\be_codegen.cpp:186
+
+#ifndef _TAO_IDL_RTSCHEDULER_INCLUDEC_H_
+#define _TAO_IDL_RTSCHEDULER_INCLUDEC_H_
+
+#include "tao/ORB.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/CDR.h"
+#include "tao/Environment.h"
+
+#include "tao/RTScheduling/RTScheduler.h"
+
+#if defined (TAO_EXPORT_MACRO)
+#undef TAO_EXPORT_MACRO
+#endif
+#define TAO_EXPORT_MACRO
+
+#if defined (TAO_EXPORT_NESTED_CLASSES)
+# if defined (TAO_EXPORT_NESTED_MACRO)
+# undef TAO_EXPORT_NESTED_MACRO
+# endif /* defined (TAO_EXPORT_NESTED_MACRO) */
+# define TAO_EXPORT_NESTED_MACRO
+#endif /* TAO_EXPORT_NESTED_CLASSES */
+
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+#if defined (__BORLANDC__)
+#pragma option push -w-rvl -w-rch -w-ccc -w-inl
+#endif /* __BORLANDC__ */
+
+// TAO_IDL - Generated from
+// C:\ACElatest\ACE_wrappers\TAO\TAO_IDL\be\be_visitor_traits.cpp:58
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Traits specializations.
+namespace TAO
+{
+}
+
+// TAO_IDL - Generated from
+// C:\ACElatest\ACE_wrappers\TAO\TAO_IDL\be\be_visitor_root/cdr_op.cpp:48
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#ifndef __ACE_INLINE__
+
+// TAO_IDL - Generated from
+// C:\ACElatest\ACE_wrappers\TAO\TAO_IDL\be\be_visitor_root/cdr_op.cpp:64
+
+#endif /* __ACE_INLINE__ */
+
+// TAO_IDL - Generated from
+// C:\ACElatest\ACE_wrappers\TAO\TAO_IDL\be\be_codegen.cpp:1050
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#if defined (__BORLANDC__)
+#pragma option pop
+#endif /* __BORLANDC__ */
+
+#endif /* ifndef */
+
diff --git a/TAO/tao/RTScheduling/RTScheduler_includeS.h b/TAO/tao/RTScheduling/RTScheduler_includeS.h
new file mode 100644
index 00000000000..17b1360599e
--- /dev/null
+++ b/TAO/tao/RTScheduling/RTScheduler_includeS.h
@@ -0,0 +1,28 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// Skeleton file generation suppressed with command line option -SS
diff --git a/TAO/tao/RTScheduling/Request_Interceptor.cpp b/TAO/tao/RTScheduling/Request_Interceptor.cpp
new file mode 100644
index 00000000000..d0a8fc4c313
--- /dev/null
+++ b/TAO/tao/RTScheduling/Request_Interceptor.cpp
@@ -0,0 +1,510 @@
+//$Id$
+
+#include "tao/AnyTypeCode/Any.h"
+#include "tao/AnyTypeCode/TypeCode.h"
+
+#include "tao/RTScheduling/Request_Interceptor.h"
+#include "tao/RTScheduling/Current.h"
+#include "tao/RTScheduling/Distributable_Thread.h"
+
+#include "tao/TSS_Resources.h"
+#include "tao/debug.h"
+#include "tao/ORB_Constants.h"
+#include "ace/OS_NS_string.h"
+
+ACE_RCSID (RTScheduling,
+ Request_Interceptor,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+const IOP::ServiceId
+Client_Interceptor::SchedulingInfo = 30;
+
+void
+Client_Interceptor::send_request (PortableInterceptor::ClientRequestInfo_ptr ri
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableInterceptor::ForwardRequest))
+{
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ "Client_Interceptor::send_request\n"));
+
+ // Temporary current.
+ TAO_RTScheduler_Current_i *new_current = 0;
+ TAO_RTScheduler_Current_i *current = 0;
+
+ TAO_TSS_Resources *tss = TAO_TSS_Resources::instance ();
+
+ current = static_cast<TAO_RTScheduler_Current_i *> (tss->rtscheduler_current_impl_);
+
+ if (current != 0)
+ {
+ // If this is a one way request
+ if (!ri->response_expected ())
+ {
+
+ // Generate GUID.
+ RTScheduling::Current::IdType guid;
+ guid.length (sizeof(long));
+
+ size_t temp = ++TAO_RTScheduler_Current::guid_counter;
+ ACE_OS::memcpy (guid.get_buffer (),
+ &temp,
+ sizeof(size_t));
+
+ size_t id;
+ ACE_OS::memcpy (&id,
+ guid.get_buffer (),
+ guid.length ());
+
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ "The Guid is %d %d\n",
+ id,
+ TAO_RTScheduler_Current::guid_counter.value_i ()));
+
+ // Create new DT.
+ RTScheduling::DistributableThread_var dt =
+ TAO_DistributableThread_Factory::create_DT ();
+
+ // Add new DT to map.
+ int result = current->dt_hash ()->bind (guid, dt);
+ if (result != 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "No Scheduling Segment Context\n"));
+ ACE_THROW (CORBA::INTERNAL ());
+
+ }
+
+ // @@ Store implicit_sched_param in a var
+
+ // Create new temporary current. Note that
+ // the new <sched_param> is the current
+ // <implicit_sched_param> and there is no
+ // segment name.
+ ACE_NEW (new_current,
+ TAO_RTScheduler_Current_i (current->orb (),
+ current->dt_hash (),
+ guid,
+ 0,
+ current->implicit_scheduling_parameter (ACE_ENV_SINGLE_ARG_PARAMETER),
+ 0,
+ dt.in (),
+ current));
+
+ // Install new current in the ORB.
+ //current->implementation (new_current);
+ tss->rtscheduler_current_impl_ = new_current;
+
+ }
+
+ // Scheduler populates the service context with
+ // scheduling parameters.
+ RTScheduling::Scheduler_var scheduler = current->scheduler ();
+ scheduler->send_request (ri);
+
+ // If this is a one way request
+ if (!ri->response_expected ())
+ {
+ // Cleanup temporary DT.
+ new_current->cleanup_DT ();
+
+ //Restore old current
+ new_current->cleanup_current ();
+ }
+ }
+}
+
+void
+Client_Interceptor::send_poll (PortableInterceptor::ClientRequestInfo_ptr ri
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ "Client_Interceptor::send_poll\n"));
+
+ TAO_RTScheduler_Current_i *current = 0;
+
+ TAO_TSS_Resources *tss = TAO_TSS_Resources::instance ();
+
+ current = static_cast<TAO_RTScheduler_Current_i *> (tss->rtscheduler_current_impl_);
+ if (current != 0)
+ {
+ RTScheduling::Scheduler_var scheduler = current->scheduler ();
+ scheduler->send_poll (ri);
+ }
+}
+
+void
+Client_Interceptor::receive_reply (PortableInterceptor::ClientRequestInfo_ptr ri
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ "Client_Interceptor::receive_reply\n"));
+
+ TAO_RTScheduler_Current_i *current = 0;
+
+ TAO_TSS_Resources *tss = TAO_TSS_Resources::instance ();
+
+ current = static_cast<TAO_RTScheduler_Current_i *> (tss->rtscheduler_current_impl_);
+ if (current != 0)
+ {
+ RTScheduling::Scheduler_var scheduler = current->scheduler ();
+ scheduler->receive_reply (ri);
+ }
+}
+
+void
+Client_Interceptor::receive_exception (PortableInterceptor::ClientRequestInfo_ptr ri
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableInterceptor::ForwardRequest))
+{
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ "Client_Interceptor::receive_exception\n"));
+
+
+ TAO_RTScheduler_Current_i *current = 0;
+
+ TAO_TSS_Resources *tss = TAO_TSS_Resources::instance ();
+
+ current = static_cast<TAO_RTScheduler_Current_i *> (tss->rtscheduler_current_impl_);
+
+ if (current != 0)
+ {
+ if (ri == 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "ri = 0\n"));
+ return;
+ }
+
+ CORBA::Any_var ex =
+ ri->received_exception (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ CORBA::TypeCode_var type = ex->type ();
+
+ if (CORBA::is_nil (type.in ()))
+ {
+ ACE_ERROR ((LM_ERROR,
+ "type = 0 \n"));
+ return;
+ }
+ const char * id = type->id (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ "Received Exception %s\n",
+ ACE_TEXT_CHAR_TO_TCHAR (id)));
+
+
+ // If the remote host threw a THREAD_CANCELLED
+ // exception, make sure to take the appropriate
+ // local action.
+ if (ACE_OS::strstr (id, "CORBA::THREAD_CANCELLED") == 0)
+ {
+ // Perform the necessary cleanup as the
+ // thread was cancelled.
+ current->cancel_thread (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else
+ {
+ // Inform scheduler that exception was
+ // received.
+ RTScheduling::Scheduler_var scheduler = current->scheduler ();
+ scheduler->receive_exception (ri);
+ }
+ }
+}
+
+void
+Client_Interceptor::receive_other (PortableInterceptor::ClientRequestInfo_ptr ri
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableInterceptor::ForwardRequest))
+{
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ "Client_Interceptor::receive_other\n"));
+
+ TAO_RTScheduler_Current_i *current = 0;
+
+ TAO_TSS_Resources *tss = TAO_TSS_Resources::instance ();
+
+ current = static_cast<TAO_RTScheduler_Current_i *> (tss->rtscheduler_current_impl_);
+ if (current != 0)
+ {
+ RTScheduling::Scheduler_var scheduler = current->scheduler ();
+ scheduler->receive_other (ri);
+ }
+}
+
+char*
+Client_Interceptor::name (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return CORBA::string_dup ("RTSchdeuler_Client_Interceptor");
+}
+
+void
+Client_Interceptor::destroy (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+}
+
+const IOP::ServiceId
+Server_Interceptor::SchedulingInfo = 30;
+
+Server_Interceptor::Server_Interceptor (TAO_RTScheduler_Current_ptr current)
+{
+ this->current_ = TAO_RTScheduler_Current::_duplicate (current);
+}
+
+void
+Server_Interceptor::receive_request_service_contexts (PortableInterceptor::ServerRequestInfo_ptr
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableInterceptor::ForwardRequest))
+{
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ "Server_Interceptor::receive_request_service_contexts\n"));
+
+}
+
+void
+Server_Interceptor::receive_request (PortableInterceptor::ServerRequestInfo_ptr ri
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableInterceptor::ForwardRequest))
+{
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ "Server_Interceptor::receive_request\n"));
+
+ IOP::ServiceContext_var serv_cxt;
+
+ ACE_TRY
+ {
+ serv_cxt =
+ ri->get_request_service_context (Server_Interceptor::SchedulingInfo
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ "Invalid Service Request\n"));
+ return;
+ }
+ ACE_ENDTRY;
+ ACE_CHECK;
+
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ "Request from Distributable Thread\n"));
+
+ RTScheduling::Current::IdType_var guid_var;
+ char* name = 0;
+ CORBA::Policy_ptr sched_param = 0;
+ CORBA::Policy_ptr implicit_sched_param = 0;
+
+ TAO_RTScheduler_Current_i* new_current = 0;
+ ACE_NEW_THROW_EX (new_current,
+ TAO_RTScheduler_Current_i (this->current_->orb (),
+ this->current_->dt_hash ()),
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_CHECK;
+
+ // Scheduler retrieves scheduling parameters
+ // from request and populates the out
+ // parameters.
+ RTScheduling::Scheduler_var scheduler = new_current->scheduler();
+ scheduler->receive_request (ri,
+ guid_var.out (),
+ name,
+ sched_param,
+ implicit_sched_param);
+
+ if (guid_var->length () == 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "The scheduler MUST retreive and return the "
+ "GUID from the service context\n"));
+ return;
+ }
+ RTScheduling::Current::IdType guid;
+ guid.length (sizeof (size_t));
+ ACE_OS::memcpy (guid.get_buffer (),
+ guid_var->get_buffer (),
+ sizeof (size_t));
+
+ size_t id;
+ ACE_OS::memcpy (&id,
+ guid.get_buffer (),
+ guid.length ());
+
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ "The Guid is %d \n",
+ id));
+
+ // Create new DT.
+ RTScheduling::DistributableThread_var dt = TAO_DistributableThread_Factory::create_DT ();
+
+ // Add new DT to map.
+ int result = new_current->dt_hash ()->bind (guid, dt);
+
+ if (result != 0)
+ {
+ ACE_THROW (CORBA::INTERNAL ());
+ }
+
+ // Create new temporary current. Note that the new <sched_param> is
+ // the current <implicit_sched_param> and there is no segment name.
+ new_current->id (guid);
+ new_current->name (name);
+ new_current->scheduling_parameter (sched_param);
+ new_current->implicit_scheduling_parameter (implicit_sched_param);
+ new_current->DT (dt.in ());
+
+ // Install new current in the ORB and store the previous current
+ // implementation
+ // current->implementation (new_current)
+ TAO_TSS_Resources *tss = TAO_TSS_Resources::instance ();
+
+ tss->rtscheduler_previous_current_impl_ = this->current_->implementation (new_current);
+}
+
+void
+Server_Interceptor::send_reply (PortableInterceptor::ServerRequestInfo_ptr ri
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ "Server_Interceptor::send_reply\n"));
+
+ TAO_RTScheduler_Current_i *current = 0;
+ TAO_RTScheduler_Current_i *prev_current = 0;
+
+ TAO_TSS_Resources *tss = TAO_TSS_Resources::instance ();
+
+ current = static_cast<TAO_RTScheduler_Current_i *> (tss->rtscheduler_current_impl_);
+ if (current != 0)
+ {
+
+ if (current->DT ()->state () == RTScheduling::DistributableThread::CANCELLED)
+ {
+ current->cancel_thread (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ return;
+ }
+ else ACE_DEBUG ((LM_DEBUG,
+ "Thread Not Cancelled\n"));
+
+
+ // Inform scheduler that upcall is complete.
+ RTScheduling::Scheduler_var scheduler = current->scheduler ();
+ scheduler->send_reply (ri ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ current->cleanup_DT ();
+ current->cleanup_current ();
+
+ // Get the previous current if any.
+ prev_current = static_cast<TAO_RTScheduler_Current_i *> (tss->rtscheduler_previous_current_impl_);
+
+ // Restore the previous current.
+ tss->rtscheduler_current_impl_ = prev_current;
+
+ // Reset the previous current pointer.
+ tss->rtscheduler_previous_current_impl_ = 0;
+
+ }
+ else ACE_DEBUG ((LM_DEBUG,
+ "Send Reply Current is 0\n"));
+}
+
+void
+Server_Interceptor::send_exception (PortableInterceptor::ServerRequestInfo_ptr ri
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableInterceptor::ForwardRequest))
+{
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ "Server_Interceptor::send_exception\n"));
+
+ TAO_RTScheduler_Current_i *current = 0;
+
+ TAO_TSS_Resources *tss = TAO_TSS_Resources::instance ();
+
+ current = static_cast<TAO_RTScheduler_Current_i *> (tss->rtscheduler_current_impl_);
+ if (current != 0)
+ {
+ // Inform scheduler that upcall is complete.
+ RTScheduling::Scheduler_var scheduler = current->scheduler ();
+ scheduler->send_exception (ri);
+
+ current->cleanup_DT ();
+ current->cleanup_current ();
+ }
+}
+
+void
+Server_Interceptor::send_other (PortableInterceptor::ServerRequestInfo_ptr ri
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableInterceptor::ForwardRequest))
+{
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ "Server_Interceptor::send_other\n"));
+
+ TAO_RTScheduler_Current_i *current = 0;
+
+ TAO_TSS_Resources *tss = TAO_TSS_Resources::instance ();
+
+ current = static_cast<TAO_RTScheduler_Current_i *> (tss->rtscheduler_current_impl_);
+ if (current != 0)
+ {
+ // Inform scheduler that upcall is complete.
+ RTScheduling::Scheduler_var scheduler = current->scheduler ();
+ scheduler->send_other (ri);
+
+ current->cleanup_DT ();
+ current->cleanup_current ();
+ }
+}
+
+char*
+Server_Interceptor::name (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return CORBA::string_dup ("RTSchdeuler_Server_Interceptor");
+}
+
+void
+Server_Interceptor::destroy (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/RTScheduling/Request_Interceptor.h b/TAO/tao/RTScheduling/Request_Interceptor.h
new file mode 100644
index 00000000000..1a8c74a389a
--- /dev/null
+++ b/TAO/tao/RTScheduling/Request_Interceptor.h
@@ -0,0 +1,108 @@
+// -*- C++ -*-
+//
+//$Id$
+
+#ifndef TAO_RTSCHEDULING_REQUEST_INTERCEPTOR_H
+#define TAO_RTSCHEDULING_REQUEST_INTERCEPTOR_H
+
+#include "tao/RTScheduling/rtscheduler_export.h"
+#include "tao/RTScheduling/RTScheduler.h"
+#include "ace/Atomic_Op.h"
+#include "tao/RTScheduling/Current.h"
+#include "tao/LocalObject.h"
+
+#include "tao/PI/PI.h"
+#include "tao/PI_Server/PI_Server.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+extern ACE_Atomic_Op<TAO_SYNCH_MUTEX, long> server_guid_counter;
+
+class TAO_RTScheduler_Export Client_Interceptor:
+ public PortableInterceptor::ClientRequestInterceptor,
+ public TAO_Local_RefCounted_Object
+{
+public:
+
+ // Client_Interceptor (RTScheduling::Current_ptr current);
+ virtual void send_request (PortableInterceptor::ClientRequestInfo_ptr ri
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableInterceptor::ForwardRequest));
+
+ virtual void send_poll (PortableInterceptor::ClientRequestInfo_ptr ri
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual void receive_reply (PortableInterceptor::ClientRequestInfo_ptr ri
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual void receive_exception (PortableInterceptor::ClientRequestInfo_ptr ri
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableInterceptor::ForwardRequest));
+
+ virtual void receive_other (PortableInterceptor::ClientRequestInfo_ptr ri
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableInterceptor::ForwardRequest));
+
+ virtual char* name (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual void destroy (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ static const IOP::ServiceId SchedulingInfo;
+
+};
+
+class TAO_RTScheduler_Export Server_Interceptor :
+ public PortableInterceptor::ServerRequestInterceptor,
+ public TAO_Local_RefCounted_Object
+{
+
+public:
+ Server_Interceptor (TAO_RTScheduler_Current_ptr current);
+
+ virtual void receive_request_service_contexts (PortableInterceptor::ServerRequestInfo_ptr ri
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableInterceptor::ForwardRequest));
+
+ virtual void receive_request (PortableInterceptor::ServerRequestInfo_ptr ri
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableInterceptor::ForwardRequest));
+
+ virtual void send_reply (PortableInterceptor::ServerRequestInfo_ptr ri
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual void send_exception (PortableInterceptor::ServerRequestInfo_ptr ri
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableInterceptor::ForwardRequest));
+
+ virtual void send_other (PortableInterceptor::ServerRequestInfo_ptr ri
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableInterceptor::ForwardRequest));
+
+ virtual char* name (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual void destroy (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ static const IOP::ServiceId SchedulingInfo;
+
+ private:
+ TAO_RTScheduler_Current_var current_;
+
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_RTSCHEDULING_REQUEST_INTERCEPTOR_H */
diff --git a/TAO/tao/RTScheduling/TAO_RTScheduler.pc.in b/TAO/tao/RTScheduling/TAO_RTScheduler.pc.in
new file mode 100644
index 00000000000..211432d843e
--- /dev/null
+++ b/TAO/tao/RTScheduling/TAO_RTScheduler.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: TAO_RTScheduler
+Description: TAO Real-Time Scheduler Library
+Requires: TAO_PI_Server, TAO_PortableServer, TAO_RTCORBA, TAO_PI, TAO_CodecFactory, TAO_AnyTypeCode, TAO
+Version: @VERSION@
+Libs: -L${libdir} -lTAO_RTScheduler
+Cflags: -I${includedir}
diff --git a/TAO/tao/RTScheduling/TAO_RTScheduler.rc b/TAO/tao/RTScheduling/TAO_RTScheduler.rc
new file mode 100644
index 00000000000..ab00b88e7fd
--- /dev/null
+++ b/TAO/tao/RTScheduling/TAO_RTScheduler.rc
@@ -0,0 +1,30 @@
+#include "..\Version.h"
+
+1 VERSIONINFO
+ FILEVERSION TAO_MAJOR_VERSION,TAO_MINOR_VERSION,TAO_BETA_VERSION,0
+ PRODUCTVERSION TAO_MAJOR_VERSION,TAO_MINOR_VERSION,TAO_BETA_VERSION,0
+ FILEFLAGSMASK 0x3fL
+ FILEFLAGS 0x0L
+ FILEOS 0x4L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904B0"
+ BEGIN
+ VALUE "FileDescription", "RTScheduler\0"
+ VALUE "FileVersion", TAO_VERSION "\0"
+ VALUE "InternalName", "TAO_RTSchedulerDLL\0"
+ VALUE "LegalCopyright", "\0"
+ VALUE "LegalTrademarks", "\0"
+ VALUE "OriginalFilename", "TAO_RTScheduler.DLL\0"
+ VALUE "ProductName", "TAO\0"
+ VALUE "ProductVersion", TAO_VERSION "\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
diff --git a/TAO/tao/RTScheduling/ThreadAction.h b/TAO/tao/RTScheduling/ThreadAction.h
new file mode 100644
index 00000000000..e7b7fc530cd
--- /dev/null
+++ b/TAO/tao/RTScheduling/ThreadAction.h
@@ -0,0 +1,28 @@
+// -*- C++ -*-
+
+//$Id$
+#ifndef TAO_ThreadAction_H
+#define TAO_ThreadAction_H
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/RTScheduling/RTSchedulerC.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_RTScheduler_Export TAO_ThreadAction:
+public RTScheduling::ThreadAction,
+ public TAO_Local_RefCounted_Object
+{
+ public:
+
+ virtual void do (CORBA::VoidData data
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException)) = 0;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /*TAO_ThreadAction_H*/
diff --git a/TAO/tao/RTScheduling/diffs/RTScheduler.diff b/TAO/tao/RTScheduling/diffs/RTScheduler.diff
new file mode 100644
index 00000000000..cce9a2de77b
--- /dev/null
+++ b/TAO/tao/RTScheduling/diffs/RTScheduler.diff
@@ -0,0 +1,45 @@
+--- orig/RTSchedulerC.h 2005-03-29 14:15:37.951680000 +0200
++++ RTSchedulerC.h 2005-03-29 14:15:38.292169600 +0200
+@@ -54,6 +54,10 @@
+ #include "tao/PortableServer/PortableServer_includeC.h"
+ #include "tao/PortableInterceptorC.h"
+
++#ifndef TAO_RTSCHEDULER_SAFE_INCLUDE
++#error "You should not include RTSchedulerC.h directly, use RTScheduler.h"
++#endif /* !TAO_RTSCHEDULER_SAFE_INCLUDE */
++
+ #if defined (TAO_EXPORT_MACRO)
+ #undef TAO_EXPORT_MACRO
+ #endif
+@@ -95,6 +99,9 @@
+ // TAO_IDL - Generated from
+ // be\be_visitor_module/module_ch.cpp:66
+
++ // Hand crafted
++ typedef void* VoidData;
++
+ } // module CORBA
+
+ // TAO_IDL - Generated from
+--- orig/RTSchedulerC.cpp 2005-03-29 14:15:37.951680000 +0200
++++ RTSchedulerC.cpp 2005-03-29 14:15:38.302184000 +0200
+@@ -29,7 +29,7 @@
+ // be\be_codegen.cpp:302
+
+
+-#include "RTSchedulerC.h"
++#include "RTScheduler.h"
+ #include "tao/CDR.h"
+ #include "tao/ORB_Core.h"
+ #include "tao/Null_RefCount_Policy.h"
+--- orig/RTSchedulerA.cpp 2005-03-29 14:15:37.951680000 +0200
++++ RTSchedulerA.cpp 2005-03-29 14:15:38.312198400 +0200
+@@ -25,7 +25,7 @@
+ // Information about TAO is available at:
+ // http://www.cs.wustl.edu/~schmidt/TAO.html
+
+-#include "RTSchedulerC.h"
++#include "RTScheduler.h"
+ #include "tao/Null_RefCount_Policy.h"
+ #include "tao/TypeCode_Constants.h"
+ #include "tao/Alias_TypeCode.h"
diff --git a/TAO/tao/RTScheduling/rtscheduler_export.h b/TAO/tao/RTScheduling/rtscheduler_export.h
new file mode 100644
index 00000000000..6ebbee7d77b
--- /dev/null
+++ b/TAO/tao/RTScheduling/rtscheduler_export.h
@@ -0,0 +1,56 @@
+
+// -*- C++ -*-
+// $Id$
+// Definition for Win32 Export directives.
+// This file is generated automatically by generate_export_file.pl TAO_RTScheduler
+// ------------------------------
+#ifndef TAO_RTSCHEDULER_EXPORT_H
+#define TAO_RTSCHEDULER_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if defined (TAO_AS_STATIC_LIBS)
+# if !defined (TAO_RTSCHEDULER_HAS_DLL)
+# define TAO_RTSCHEDULER_HAS_DLL 0
+# endif /* ! TAO_RTSCHEDULER_HAS_DLL */
+#else
+# if !defined (TAO_RTSCHEDULER_HAS_DLL)
+# define TAO_RTSCHEDULER_HAS_DLL 1
+# endif /* ! TAO_RTSCHEDULER_HAS_DLL */
+#endif
+
+#if defined (TAO_RTSCHEDULER_HAS_DLL) && (TAO_RTSCHEDULER_HAS_DLL == 1)
+# if defined (TAO_RTSCHEDULER_BUILD_DLL)
+# define TAO_RTScheduler_Export ACE_Proper_Export_Flag
+# define TAO_RTSCHEDULER_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# define TAO_RTSCHEDULER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# else /* TAO_RTSCHEDULER_BUILD_DLL */
+# define TAO_RTScheduler_Export ACE_Proper_Import_Flag
+# define TAO_RTSCHEDULER_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# define TAO_RTSCHEDULER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# endif /* TAO_RTSCHEDULER_BUILD_DLL */
+#else /* TAO_RTSCHEDULER_HAS_DLL == 1 */
+# define TAO_RTScheduler_Export
+# define TAO_RTSCHEDULER_SINGLETON_DECLARATION(T)
+# define TAO_RTSCHEDULER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+#endif /* TAO_RTSCHEDULER_HAS_DLL == 1 */
+
+// Set TAO_RTSCHEDULER_NTRACE = 0 to turn on library specific tracing even if
+// tracing is turned off for ACE.
+#if !defined (TAO_RTSCHEDULER_NTRACE)
+# if (ACE_NTRACE == 1)
+# define TAO_RTSCHEDULER_NTRACE 1
+# else /* (ACE_NTRACE == 1) */
+# define TAO_RTSCHEDULER_NTRACE 0
+# endif /* (ACE_NTRACE == 1) */
+#endif /* !TAO_RTSCHEDULER_NTRACE */
+
+#if (TAO_RTSCHEDULER_NTRACE == 1)
+# define TAO_RTSCHEDULER_TRACE(X)
+#else /* (TAO_RTSCHEDULER_NTRACE == 1) */
+# define TAO_RTSCHEDULER_TRACE(X) ACE_TRACE_IMPL(X)
+#endif /* (TAO_RTSCHEDULER_NTRACE == 1) */
+
+#endif /* TAO_RTSCHEDULER_EXPORT_H */
+
+// End of auto generated file.
diff --git a/TAO/tao/Range_Checking_T.h b/TAO/tao/Range_Checking_T.h
new file mode 100644
index 00000000000..f5e461ef09f
--- /dev/null
+++ b/TAO/tao/Range_Checking_T.h
@@ -0,0 +1,150 @@
+#ifndef guard_range_checking_hpp
+#define guard_range_checking_hpp
+/**
+ * @file
+ *
+ * @brief Details can be found in the documentation for
+ * TAO::details::generic_sequence
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan
+ */
+
+#include "tao/Basic_Types.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+namespace details
+{
+
+/**
+ * @struct range_checking
+ *
+ * @brief Configurable traits to tradeoff safety vs. performance in
+ * the implementation of TAO sequences.
+ *
+ * The CORBA specification grants certain latitude to implementors by
+ * not defining the behavior of sequences under certain conditions.
+ * Probably the most clear example is the operator[] access, where the
+ * application <b>must</b> set the length to a high enough value
+ * before using the operator[].
+ *
+ * Implementors that cater to high-performance applications tend to
+ * exploit this latitude to the extreme, basically reasoning that
+ * correct applications will behave normally, while incorrect
+ * applications will crash, but those crashes will be detected during
+ * development/testing.
+ *
+ * Realizing that this may be a bad tradeoff some implementors offer
+ * compile-time hooks to control the behavior of sequences when used
+ * improperly, some implementors may go as far as using run-time
+ * hooks.
+ *
+ * The implementation of sequences calls the following template class
+ * in points where the application may trigger undefined behavior.
+ * The application developer can use partial (or full) template
+ * specialization to introduce her own code at these critical points.
+ *
+ * Some examples may help, suppose you want to change your application
+ * so for all sequence types the operator[] raises an exception if the
+ * index is out of range. Then you would provide the following
+ * (partial) template specialization:
+ *
+ * <PRE>
+ * template<typename T>
+ * struct range_checking<T,true> {
+ * void check(CORBA::ULong index, CORBA::ULong length) {
+ * if (index < length)
+ * return;
+ * throw std::range_error("CORBA sequence range error");
+ * };
+ * ...
+ * ..
+ * };
+ * </PRE>
+ *
+ * This specialization must be introduced before any sequence code is
+ * seen, therefore, the application would also need to define the
+ * following macro in their $ACE_ROOT/ace/config.h file:
+ *
+ * - #define TAO_USER_DEFINED_SEQUENCE_SAFETY_TRAITS_INCLUDE "<filename here>"
+ *
+ * Likewise, if the application only wanted to check the range for a
+ * special type, say some structure MyStruct, then they would provide
+ * a full specialization. Just for giggles, we will also introduce
+ * run-time controls to this example:
+ *
+ * <PRE>
+ * template<>
+ * struct safety_traits<tao::details::value_traits<MyStruct>,true> {
+ * bool enable_range_checking;
+ * void check_range(CORBA::ULong index, CORBA::ULong length) {
+ * if (!enable_range_checking || index < length)
+ * return;
+ * throw std::range_error("CORBA sequence range error");
+ * };
+ * ...
+ * ..
+ * };
+ * </PRE>
+ *
+ *
+ *
+ * @todo There is no control on a per-sequence type basis, only on a
+ * per-underlying type basis, for example, the following two IDL
+ * sequences would get the same behavior:
+ * // IDL
+ * typedef sequence<MyStruct> MyStructSequence;
+ * typedef sequence<MyStruct> MyStructList;
+ *
+ * @todo There is no way to control behavior on a per-sequence basis,
+ * i.e. to have some sequences of longs checked while others are
+ * not. This is easy to fix, simply:
+ * - make all members of safety_traits non-static
+ * - have each sequence contain their own instance of
+ * safety_traits
+ * - grant users read/write access to the safety_traits of each
+ * sequence
+ * but there are footprint consequences to that approach. Until
+ * there is more demand to justify the cost, I will not
+ * implement such a change.
+ */
+template<typename T, bool dummy>
+struct range_checking
+{
+ typedef T value_type;
+
+ inline static void check(
+ CORBA::ULong /* index */,
+ CORBA::ULong /* length */,
+ CORBA::ULong /* maximum */,
+ char const * /* function_name */)
+ {
+ // Applications and tests can specialize this function to define
+ // their own behavior
+ }
+
+ inline static void check_length(
+ CORBA::ULong & /* new_length */,
+ CORBA::ULong /* maximum */)
+ {
+ /*
+ if (maximum < new_length)
+ new_length = maximum;
+ */
+ }
+};
+
+} // namespace details
+} // namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined(TAO_USER_DEFINED_SEQUENCE_RANGE_CHECKING_INCLUDE)
+# include TAO_USER_DEFINED_SEQUENCE_RANGE_CHECKING_INCLUDE
+#endif // TAO_USER_DEFINED_SEQUENCE_RANGE_CHECKING_INCLUDE
+
+#endif // guard_range_checking_hpp
diff --git a/TAO/tao/Reactive_Connect_Strategy.cpp b/TAO/tao/Reactive_Connect_Strategy.cpp
new file mode 100644
index 00000000000..17a9d2d642a
--- /dev/null
+++ b/TAO/tao/Reactive_Connect_Strategy.cpp
@@ -0,0 +1,99 @@
+#include "tao/Reactive_Connect_Strategy.h"
+#include "tao/Connection_Handler.h"
+#include "tao/ORB_Core.h"
+#include "tao/debug.h"
+#include "tao/Transport.h"
+#include "tao/LF_Multi_Event.h"
+
+#include "ace/Synch_Options.h"
+
+ACE_RCSID(tao,
+ Reactive_Connect_Strategy,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Reactive_Connect_Strategy::TAO_Reactive_Connect_Strategy (
+ TAO_ORB_Core *orb_core)
+ : TAO_Connect_Strategy (orb_core)
+{
+}
+
+TAO_Reactive_Connect_Strategy::~TAO_Reactive_Connect_Strategy (void)
+{
+}
+
+void
+TAO_Reactive_Connect_Strategy::synch_options (ACE_Time_Value *timeout,
+ ACE_Synch_Options &options)
+{
+ if (timeout != 0)
+ {
+ options.set (ACE_Synch_Options::USE_REACTOR,
+ *timeout);
+ }
+ else
+ {
+ // Making it sure it is blocking.
+ options.set (ACE_Synch_Options::USE_REACTOR,
+ ACE_Time_Value::zero);
+ }
+}
+
+int
+TAO_Reactive_Connect_Strategy::wait_i (TAO_LF_Event *ev,
+ TAO_Transport *,
+ ACE_Time_Value * max_wait_time)
+{
+ int result = 0;
+ if (ev == 0)
+ return -1;
+
+ if (TAO_debug_level > 2)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - Waiting in the Reactor for ")
+ ACE_TEXT ("connection completion - wait ()\n")));
+ }
+
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ while (ev->keep_waiting ())
+ {
+ result =
+ this->orb_core_->run (max_wait_time, 1 ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ // Did we timeout? If so, stop running the loop.
+ if (result == 0 &&
+ max_wait_time != 0 &&
+ *max_wait_time == ACE_Time_Value::zero)
+ {
+ errno = ETIME;
+ result = -1;
+ break;
+ }
+
+ // Other errors? If so, stop running the loop.
+ if (result == -1)
+ break;
+ }
+ }
+ ACE_CATCHANY
+ {
+ result = -1;
+ }
+ ACE_ENDTRY;
+
+ // Set the result.
+ if (result != -1 && ev->error_detected ())
+ {
+ result = -1;
+ }
+
+ return result;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Reactive_Connect_Strategy.h b/TAO/tao/Reactive_Connect_Strategy.h
new file mode 100644
index 00000000000..694bbb49560
--- /dev/null
+++ b/TAO/tao/Reactive_Connect_Strategy.h
@@ -0,0 +1,63 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Reactive_Connect_Strategy.h
+ *
+ * $Id$
+ *
+ * @author Balachandran Natarajan <bala@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_REACTIVE_CONNECT_STRATEGY_H
+#define TAO_REACTIVE_CONNECT_STRATEGY_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Connect_Strategy.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+class ACE_Time_Value;
+class ACE_Synch_Options;
+ACE_END_VERSIONED_NAMESPACE_DECL
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_Reactive_Connect_Strategy
+ *
+ * @brief Concrete implementation of a connect strategy that waits on
+ * the reactor during asynch connects
+ *
+ */
+class TAO_Export TAO_Reactive_Connect_Strategy : public TAO_Connect_Strategy
+{
+public:
+ /// Constructor
+ TAO_Reactive_Connect_Strategy (TAO_ORB_Core *orb);
+
+ /// Destructor
+ ~TAO_Reactive_Connect_Strategy (void);
+
+ /*
+ * Concrete implementation for this class. Please see
+ * Connect_Strategy.h for details
+ */
+ virtual void synch_options (ACE_Time_Value *val,
+ ACE_Synch_Options &opt);
+
+protected:
+ virtual int wait_i (TAO_LF_Event *ch, TAO_Transport *, ACE_Time_Value *val);
+
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_REACTIVE_CONNECT_STRATEGY_H */
diff --git a/TAO/tao/Reactive_Flushing_Strategy.cpp b/TAO/tao/Reactive_Flushing_Strategy.cpp
new file mode 100644
index 00000000000..085779f99ed
--- /dev/null
+++ b/TAO/tao/Reactive_Flushing_Strategy.cpp
@@ -0,0 +1,83 @@
+// -*- C++ -*-
+// $Id$
+
+#include "tao/Reactive_Flushing_Strategy.h"
+#include "tao/Transport.h"
+#include "tao/ORB_Core.h"
+#include "tao/Queued_Message.h"
+
+ACE_RCSID (tao,
+ Reactive_Flushing_Strategy,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+int
+TAO_Reactive_Flushing_Strategy::schedule_output (TAO_Transport *transport)
+{
+ return transport->schedule_output_i ();
+}
+
+int
+TAO_Reactive_Flushing_Strategy::cancel_output (TAO_Transport *transport)
+{
+ return transport->cancel_output_i ();
+}
+
+int
+TAO_Reactive_Flushing_Strategy::flush_message (TAO_Transport *transport,
+ TAO_Queued_Message *msg,
+ ACE_Time_Value *max_wait_time)
+{
+ int result = 0;
+
+ // @@ Should we pass this down? Can we?
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ TAO_ORB_Core * const orb_core = transport->orb_core ();
+
+ while (!msg->all_data_sent () && result >= 0)
+ {
+ result = orb_core->run (max_wait_time, 1 ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ }
+ ACE_CATCHANY
+ {
+ return -1;
+ }
+ ACE_ENDTRY;
+
+ return result;
+}
+
+int
+TAO_Reactive_Flushing_Strategy::flush_transport (TAO_Transport *transport)
+{
+ // @@ Should we pass this down? Can we?
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ TAO_ORB_Core * const orb_core = transport->orb_core ();
+
+ while (!transport->queue_is_empty ())
+ {
+ int const result = orb_core->run (0, 1 ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (result == -1)
+ return -1;
+ }
+ }
+ ACE_CATCHANY
+ {
+ return -1;
+ }
+ ACE_ENDTRY;
+
+ return 0;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Reactive_Flushing_Strategy.h b/TAO/tao/Reactive_Flushing_Strategy.h
new file mode 100644
index 00000000000..56896b01f95
--- /dev/null
+++ b/TAO/tao/Reactive_Flushing_Strategy.h
@@ -0,0 +1,46 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Reactive_Flushing_Strategy.h
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan <coryan@uci.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_REACTIVE_FLUSHING_STRATEGY_H
+#define TAO_REACTIVE_FLUSHING_STRATEGY_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Flushing_Strategy.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_Reactive_Flushing_Strategy
+ *
+ * @brief Implement a flushing strategy that uses the reactor.
+ */
+class TAO_Reactive_Flushing_Strategy : public TAO_Flushing_Strategy
+{
+public:
+ virtual int schedule_output (TAO_Transport *transport);
+ virtual int cancel_output (TAO_Transport *transport);
+ virtual int flush_message (TAO_Transport *transport,
+ TAO_Queued_Message *msg,
+ ACE_Time_Value *max_wait_time);
+ virtual int flush_transport (TAO_Transport *transport);
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_REACTIVE_FLUSHING_STRATEGY_H */
diff --git a/TAO/tao/Refcounted_ObjectKey.cpp b/TAO/tao/Refcounted_ObjectKey.cpp
new file mode 100644
index 00000000000..074a9e3d6ed
--- /dev/null
+++ b/TAO/tao/Refcounted_ObjectKey.cpp
@@ -0,0 +1,41 @@
+//$Id$
+#include "tao/Refcounted_ObjectKey.h"
+#include "ace/Log_Msg.h"
+
+#if !defined (__ACE_INLINE__)
+#include "tao/Refcounted_ObjectKey.inl"
+#endif /* defined INLINE */
+
+ACE_RCSID(tao,
+ Refcounted_ObjectKey,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO::Refcounted_ObjectKey::Refcounted_ObjectKey (const TAO::ObjectKey &key)
+ : object_key_ (key)
+ , ref_count_ (1)
+{
+}
+
+TAO::Refcounted_ObjectKey::~Refcounted_ObjectKey (void)
+{
+}
+
+CORBA::ULong
+TAO::Refcounted_ObjectKey::decr_refcount (void)
+{
+ if (--this->ref_count_ > 0)
+ {
+ return this->ref_count_;
+ }
+
+ ACE_ASSERT (this->ref_count_ == 0);
+
+ delete this;
+
+ return 0;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Refcounted_ObjectKey.h b/TAO/tao/Refcounted_ObjectKey.h
new file mode 100644
index 00000000000..5c0ae02629d
--- /dev/null
+++ b/TAO/tao/Refcounted_ObjectKey.h
@@ -0,0 +1,79 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Refcounted_ObjectKey.h
+ *
+ * $Id$
+ *
+ * @author Balachandran Natarajan <bala@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_REFCOUNTED_OBJECTKEY_H
+#define TAO_REFCOUNTED_OBJECTKEY_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/TAO_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Object_KeyC.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ /**
+ * @class Refcounted_ObjectKey
+ *
+ * @brief A wrapper class that ties together a refcount to an
+ * ObjectKey.
+ *
+ * The refcount in this class is manipulated within the context of
+ * the lock in the TAO::ObjectKey_Table. Manipulating the refcount
+ * from anywhere else is strictly forbidden.
+ */
+ class TAO_Export Refcounted_ObjectKey
+ {
+ public:
+ /// Constructor
+ Refcounted_ObjectKey (const ObjectKey &ref);
+
+ /// Accessor for the underlying ObjectKey.
+ const ObjectKey &object_key (void) const;
+
+ protected:
+ friend class ObjectKey_Table;
+
+ /// Protected destructor
+ ~Refcounted_ObjectKey (void);
+
+ /// Methods for incrementing refcount.
+ void incr_refcount (void);
+
+ /// Methods for decrementing refcount. Return the refcount, used by the
+ /// ObjectKey table.
+ CORBA::ULong decr_refcount (void);
+
+ private:
+ /// The object key
+ ObjectKey object_key_;
+
+ /// The refcount on the object key..
+ CORBA::ULong ref_count_;
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+#include "tao/Refcounted_ObjectKey.inl"
+#endif /* defined INLINE */
+
+#include /**/ "ace/post.h"
+
+#endif /*TAO_REFCOUNTED_OBJECTKEY_H*/
diff --git a/TAO/tao/Refcounted_ObjectKey.inl b/TAO/tao/Refcounted_ObjectKey.inl
new file mode 100644
index 00000000000..117f9db4ee9
--- /dev/null
+++ b/TAO/tao/Refcounted_ObjectKey.inl
@@ -0,0 +1,20 @@
+// -*- C++ -*-
+//
+// $Id$
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE void
+TAO::Refcounted_ObjectKey::incr_refcount (void)
+{
+ ++this->ref_count_;
+}
+
+ACE_INLINE const TAO::ObjectKey &
+TAO::Refcounted_ObjectKey::object_key (void) const
+{
+ return this->object_key_;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Remote_Invocation.cpp b/TAO/tao/Remote_Invocation.cpp
new file mode 100644
index 00000000000..417722db92b
--- /dev/null
+++ b/TAO/tao/Remote_Invocation.cpp
@@ -0,0 +1,209 @@
+//$Id$
+
+#include "tao/Remote_Invocation.h"
+#include "tao/Profile.h"
+#include "tao/Profile_Transport_Resolver.h"
+#include "tao/Stub.h"
+#include "tao/Transport.h"
+#include "tao/Connection_Handler.h"
+#include "tao/operation_details.h"
+#include "tao/ORB_Core.h"
+#include "tao/Protocols_Hooks.h"
+#include "tao/debug.h"
+
+ACE_RCSID (tao,
+ Remote_Invocation,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ Remote_Invocation::Remote_Invocation (
+ CORBA::Object_ptr otarget,
+ Profile_Transport_Resolver &resolver,
+ TAO_Operation_Details &detail,
+ bool response_expected)
+ : Invocation_Base (otarget,
+ resolver.object (),
+ resolver.stub (),
+ detail,
+ response_expected,
+ true /* request_is_remote */ )
+ , resolver_ (resolver)
+ {
+ }
+
+ void
+ Remote_Invocation::init_target_spec (TAO_Target_Specification &target_spec
+ ACE_ENV_ARG_DECL)
+ {
+ /**
+ * Mega hack for RTCORBA start. I don't think that
+ * PortableInterceptor would work here esp. for RTCORBA. PI needs
+ * to be improved to help our cause.
+ */
+ this->resolver_.stub ()->orb_core ()->service_context_list (
+ this->resolver_.stub (),
+ this->details_.request_service_context (),
+ 0
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ /**
+ * Mega hack for RTCORBA END
+ */
+
+ TAO_Profile *pfile = this->resolver_.profile ();
+
+ // Set the target specification mode
+ switch (pfile->addressing_mode ())
+ {
+ case TAO_Target_Specification::Key_Addr:
+ target_spec.target_specifier (pfile->object_key ());
+ break;
+ case TAO_Target_Specification::Profile_Addr:
+ {
+ IOP::TaggedProfile *tp =
+ pfile->create_tagged_profile ();
+
+ if (tp)
+ {
+ target_spec.target_specifier (*tp);
+ }
+ }
+ break;
+
+ case TAO_Target_Specification::Reference_Addr:
+ // We need to call the method seperately. If there is no
+ // IOP::IOR info, the call would create the info and return the
+ // index that we need.
+ CORBA::ULong index = 0;
+ IOP::IOR *ior_info = 0;
+ int const retval =
+ this->resolver_.stub ()->create_ior_info (ior_info,
+ index
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (retval == -1)
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) - ")
+ ACE_TEXT ("Remote_Invocation::init_target_spec, ")
+ ACE_TEXT ("Error in finding index for ")
+ ACE_TEXT ("IOP::IOR \n")));
+ }
+
+ return;
+ }
+
+ target_spec.target_specifier (*ior_info,
+ index);
+ break;
+ }
+
+
+ }
+
+ void
+ Remote_Invocation::write_header (TAO_Target_Specification &spec,
+ TAO_OutputCDR &out_stream
+ ACE_ENV_ARG_DECL)
+ {
+ this->resolver_.transport ()->clear_translators (0,
+ &out_stream);
+
+ // Send the request for the header
+ if (this->resolver_.transport ()->generate_request_header (this->details_,
+ spec,
+ out_stream)
+ == -1)
+ {
+ ACE_THROW (CORBA::MARSHAL ());
+ }
+
+ this->resolver_.transport ()->assign_translators (0,
+ &out_stream);
+ }
+
+ void
+ Remote_Invocation::marshal_data (TAO_OutputCDR &out_stream
+ ACE_ENV_ARG_DECL)
+ {
+ if (this->details_.marshal_args (out_stream) == false)
+ {
+ ACE_THROW (CORBA::MARSHAL ());
+ }
+
+ return;
+ }
+
+ Invocation_Status
+ Remote_Invocation::send_message (TAO_OutputCDR &cdr,
+ short message_semantics,
+ ACE_Time_Value *max_wait_time
+ ACE_ENV_ARG_DECL)
+ {
+ TAO_Protocols_Hooks *tph =
+ this->resolver_.stub ()->orb_core ()->get_protocols_hooks ();
+
+ CORBA::Boolean set_client_network_priority =
+ tph->set_client_network_priority (this->resolver_.transport ()->tag (),
+ this->resolver_.stub ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO_INVOKE_FAILURE);
+
+ TAO_Connection_Handler *connection_handler =
+ this->resolver_.transport ()->connection_handler ();
+
+ connection_handler->set_dscp_codepoint (set_client_network_priority);
+
+ int const retval =
+ this->resolver_.transport ()->send_request (
+ this->resolver_.stub (),
+ this->resolver_.stub ()->orb_core (),
+ cdr,
+ message_semantics,
+ max_wait_time);
+
+ if (retval == -1)
+ {
+ if (errno == ETIME)
+ {
+ // We sent a message already and we haven't gotten a
+ // reply. Just throw TIMEOUT with *COMPLETED_MAYBE*.
+ ACE_THROW_RETURN (
+ CORBA::TIMEOUT (
+ CORBA::SystemException::_tao_minor_code (
+ TAO_TIMEOUT_SEND_MINOR_CODE,
+ errno
+ ),
+ CORBA::COMPLETED_MAYBE
+ ),
+ TAO_INVOKE_FAILURE
+ );
+ }
+
+ if (TAO_debug_level > 2)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - ")
+ ACE_TEXT ("Remote_Invocation::send_message, ")
+ ACE_TEXT ("failure while sending message \n")));
+ }
+
+ // Close the transport and all the associated stuff along with
+ // it.
+ this->resolver_.transport ()->close_connection ();
+ this->resolver_.stub ()->reset_profiles ();
+ return TAO_INVOKE_RESTART;
+ }
+
+ this->resolver_.stub ()->set_valid_profile ();
+ return TAO_INVOKE_SUCCESS;
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Remote_Invocation.h b/TAO/tao/Remote_Invocation.h
new file mode 100644
index 00000000000..9bb187a3ea8
--- /dev/null
+++ b/TAO/tao/Remote_Invocation.h
@@ -0,0 +1,102 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Remote_Invocation.h
+ *
+ * $Id$
+ *
+ *
+ * @author Balachandran Natarajan <bala@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_REMOTE_INVOCATION_H
+#define TAO_REMOTE_INVOCATION_H
+
+#include /**/ "ace/pre.h"
+#include "ace/CORBA_macros.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Invocation_Base.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Operation_Details;
+class TAO_Target_Specification;
+class TAO_OutputCDR;
+
+namespace CORBA
+{
+ class Environment;
+}
+
+namespace TAO
+{
+ class Profile_Transport_Resolver;
+ class Argument;
+
+ /**
+ * @class Remote_Invocation
+ *
+ * @brief Base class for remote invocations.
+ *
+ * This class encapulates some of the common functionalities used by
+ * synchronous, asynchronous, DII and DSI invocations.
+ *
+ */
+ class TAO_Export Remote_Invocation : public Invocation_Base
+ {
+ public:
+ /**
+ * @param otarget The original target on which this invocation
+ * was started. This is there to be passed up to its parent
+ * class.
+ *
+ * @param resolver The profile and transport holder.
+ *
+ * @param detail Pperation details of the invocation on the target
+ *
+ * @param response_expected Flag to indicate whether the
+ * operation encapsulated by @a op returns a response or not.
+ */
+ Remote_Invocation (CORBA::Object_ptr otarget,
+ Profile_Transport_Resolver &resolver,
+ TAO_Operation_Details &detail,
+ bool response_expected);
+
+ protected:
+
+ /// Initialize the @a spec.
+ void init_target_spec (TAO_Target_Specification &spec
+ ACE_ENV_ARG_DECL);
+
+ /// Write the GIOP header into the stream.
+ void write_header (TAO_Target_Specification &spec,
+ TAO_OutputCDR &out_stream
+ ACE_ENV_ARG_DECL);
+
+ /// Marshal the arguments into the stream.
+ void marshal_data (TAO_OutputCDR &cdr
+ ACE_ENV_ARG_DECL);
+
+ /// Write the message onto the socket
+ Invocation_Status send_message (TAO_OutputCDR &cdr,
+ short message_semantics,
+ ACE_Time_Value *max_wait_time
+ ACE_ENV_ARG_DECL);
+
+ protected:
+ /// Our resolver
+ Profile_Transport_Resolver &resolver_;
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /*TAO_REMOTE_INVOCATION_H*/
diff --git a/TAO/tao/Remote_Object_Proxy_Broker.cpp b/TAO/tao/Remote_Object_Proxy_Broker.cpp
new file mode 100644
index 00000000000..fd4bc75cde0
--- /dev/null
+++ b/TAO/tao/Remote_Object_Proxy_Broker.cpp
@@ -0,0 +1,152 @@
+#include "tao/Remote_Object_Proxy_Broker.h"
+#include "tao/CORBA_String.h"
+#include "tao/UB_String_Arguments.h"
+#include "tao/Special_Basic_Arguments.h"
+#include "tao/Invocation_Adapter.h"
+#include "tao/IFR_Client_Adapter.h"
+#include "tao/ORB_Core.h"
+#include "tao/SystemException.h"
+
+#include "ace/Dynamic_Service.h"
+
+ACE_RCSID (tao,
+ Remote_Object_Proxy_Broker,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ CORBA::Boolean
+ Remote_Object_Proxy_Broker::_is_a (CORBA::Object_ptr target,
+ const char *type_id
+ ACE_ENV_ARG_DECL)
+ {
+ TAO::Arg_Traits<ACE_InputCDR::to_boolean>::ret_val _tao_retval;
+ TAO::Arg_Traits<char *>::in_arg_val _tao_id (type_id);
+
+ TAO::Argument *_tao_signature [] =
+ {
+ &_tao_retval,
+ &_tao_id
+ };
+
+ TAO::Invocation_Adapter tao_call (target,
+ _tao_signature,
+ 2,
+ "_is_a",
+ 5,
+ 0);
+
+ tao_call.invoke (0, 0 ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (_tao_retval.excp ());
+
+ return _tao_retval.retn ();
+ }
+
+#if (TAO_HAS_MINIMUM_CORBA == 0)
+
+ CORBA::Boolean
+ Remote_Object_Proxy_Broker::_non_existent (CORBA::Object_ptr target
+ ACE_ENV_ARG_DECL)
+ {
+ TAO::Arg_Traits<ACE_InputCDR::to_boolean>::ret_val _tao_retval;
+
+ TAO::Argument *_tao_signature [] =
+ {
+ &_tao_retval
+ };
+
+ TAO::Invocation_Adapter _tao_call (target,
+ _tao_signature,
+ 1,
+ "_non_existent",
+ 13,
+ 0);
+
+ _tao_call.invoke (0, 0 ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (_tao_retval.excp ());
+
+ return _tao_retval.retn ();
+ }
+
+ CORBA::Object_ptr
+ Remote_Object_Proxy_Broker::_get_component (CORBA::Object_ptr target
+ ACE_ENV_ARG_DECL)
+ {
+ TAO::Arg_Traits<CORBA::Object>::ret_val _tao_retval;
+
+ TAO::Argument *_tao_signature [] =
+ {
+ &_tao_retval
+ };
+
+ TAO::Invocation_Adapter _tao_call (target,
+ _tao_signature,
+ 1,
+ "_component",
+ 10,
+ 0);
+
+ _tao_call.invoke (0, 0 ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (_tao_retval.excp ());
+
+ return _tao_retval.retn ();
+ }
+
+ CORBA::InterfaceDef_ptr
+ Remote_Object_Proxy_Broker::_get_interface (CORBA::Object_ptr target
+ ACE_ENV_ARG_DECL)
+ {
+ TAO_IFR_Client_Adapter *adapter =
+ ACE_Dynamic_Service<TAO_IFR_Client_Adapter>::instance (
+ TAO_ORB_Core::ifr_client_adapter_name ()
+ );
+
+ if (adapter == 0)
+ {
+ ACE_THROW_RETURN (CORBA::INTF_REPOS (),
+ 0);
+ }
+
+ return adapter->get_interface_remote (target
+ ACE_ENV_ARG_PARAMETER);
+ }
+
+ char *
+ Remote_Object_Proxy_Broker::_repository_id (CORBA::Object_ptr target
+ ACE_ENV_ARG_DECL)
+ {
+ TAO::Arg_Traits< ::CORBA::Char *>::ret_val _tao_retval;
+
+ TAO::Argument *_tao_signature [] =
+ {
+ &_tao_retval
+ };
+
+ TAO::Invocation_Adapter _tao_call (target,
+ _tao_signature,
+ 1,
+ "_repository_id",
+ 14,
+ 0);
+
+ _tao_call.invoke (0, 0 ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (_tao_retval.excp ());
+
+ return _tao_retval.retn ();
+ }
+#endif /* TAO_HAS_MINIMUM_CORBA == 0 */
+}
+
+// -----------------------------------------------------
+
+TAO::Remote_Object_Proxy_Broker *
+the_tao_remote_object_proxy_broker (void)
+{
+ static TAO::Remote_Object_Proxy_Broker the_broker;
+ return &the_broker;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Remote_Object_Proxy_Broker.h b/TAO/tao/Remote_Object_Proxy_Broker.h
new file mode 100644
index 00000000000..eab7f29e5b7
--- /dev/null
+++ b/TAO/tao/Remote_Object_Proxy_Broker.h
@@ -0,0 +1,80 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Remote_Object_Proxy_Broker.h
+ *
+ * $Id$
+ *
+ * This files contains the Remote Proxy Broker implementation
+ * for the CORBA Object.
+ *
+ * @author Angelo Corsaro <corsaro@cs.wustl.edu>
+ * @author Balachandran Natarajan (modified the implementation)
+ */
+//=============================================================================
+
+#ifndef TAO_REMOTE_OBJECT_PROXY_BROKER_H
+#define TAO_REMOTE_OBJECT_PROXY_BROKER_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Object_Proxy_Broker.h"
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ /**
+ * @class Remote_Object_Proxy_Broker
+ *
+ * @brief Remote_Object_Proxy_Broker
+ *
+ * A broker for standard CORBA::Object calls that needs to be made
+ * on remote objects.
+ */
+
+ class TAO_Export Remote_Object_Proxy_Broker : public Object_Proxy_Broker
+ {
+ public:
+ /// Please see the documentation in Object_Proxy_Broker.h for
+ /// details.
+
+ virtual CORBA::Boolean _is_a (CORBA::Object_ptr target,
+ const char *logical_type_id
+ ACE_ENV_ARG_DECL);
+
+#if (TAO_HAS_MINIMUM_CORBA == 0)
+
+ virtual CORBA::Boolean _non_existent (CORBA::Object_ptr target
+ ACE_ENV_ARG_DECL);
+
+ virtual CORBA::InterfaceDef * _get_interface (
+ CORBA::Object_ptr target
+ ACE_ENV_ARG_DECL
+ );
+
+ virtual CORBA::Object_ptr _get_component (CORBA::Object_ptr target
+ ACE_ENV_ARG_DECL);
+
+ virtual char * _repository_id (CORBA::Object_ptr target
+ ACE_ENV_ARG_DECL);
+#endif /* TAO_HAS_MINIMUM_CORBA == 0 */
+
+ };
+}
+
+// -----------------------------------------------------
+
+TAO::Remote_Object_Proxy_Broker *the_tao_remote_object_proxy_broker (void);
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_REMOTE_OBJECT_PROXY_BROKER_H */
diff --git a/TAO/tao/Reply_Dispatcher.cpp b/TAO/tao/Reply_Dispatcher.cpp
new file mode 100644
index 00000000000..278f4463203
--- /dev/null
+++ b/TAO/tao/Reply_Dispatcher.cpp
@@ -0,0 +1,27 @@
+// $Id$
+
+#include "tao/Reply_Dispatcher.h"
+
+ACE_RCSID (tao,
+ Reply_Dispatcher,
+ "$Id$")
+
+#if !defined (__ACE_INLINE__)
+#include "tao/Reply_Dispatcher.i"
+#endif /* __ACE_INLINE__ */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Constructor.
+TAO_Reply_Dispatcher::TAO_Reply_Dispatcher (void)
+ // Just an invalid reply status.
+ : reply_status_ (100)
+{
+}
+
+// Destructor.
+TAO_Reply_Dispatcher::~TAO_Reply_Dispatcher (void)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Reply_Dispatcher.h b/TAO/tao/Reply_Dispatcher.h
new file mode 100644
index 00000000000..4f4c16e879b
--- /dev/null
+++ b/TAO/tao/Reply_Dispatcher.h
@@ -0,0 +1,100 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Reply_Dispatcher.h
+ *
+ * $Id$
+ *
+ * Define the interface for the Reply_Dispatcher strategies.
+ *
+ *
+ * @author Alexander Babu Arulanthu <alex@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_REPLY_DISPATCHER_H
+#define TAO_REPLY_DISPATCHER_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/TAO_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Basic_Types.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Forward Declarations.
+class TAO_GIOP_Message_State;
+class TAO_GIOP_Message_Version;
+class TAO_Transport;
+class TAO_Pluggable_Reply_Params;
+
+/**
+ * @class TAO_Reply_Dispatcher
+ *
+ *
+ * Different invocation modes process the Reply messages in
+ * different ways. Traditional synchronous replies simply receive
+ * the message and wake up the waiting thread (if any).
+ * Asynchronous Method Invocation (Callbacks) must process the
+ * message in the thread that receives it.
+ * Deferred Synchronous (DII) and AMI in the Poller mode save the
+ * reply for later processing in the application.
+ * The lower level components in the ORB only deal with this
+ * abstract interface, when the invocation is made the right type
+ * of Reply Dispatcher is instantiated and registered with the
+ * Transport object.
+ */
+class TAO_Export TAO_Reply_Dispatcher
+{
+
+public:
+ /// Constructor.
+ TAO_Reply_Dispatcher (void);
+
+ /// Destructor.
+ virtual ~TAO_Reply_Dispatcher (void);
+
+ /**
+ * Dispatch the reply. Return 1 on sucess, -1 on error.
+ * @todo Pluggable Messaging: this method has too many arguments,
+ * the "Right Thing"[tm] is for the Transport Object to create a
+ * "ClientReply" that encapsulates all we need to process a
+ * reply. Naturally it is possible that different messaging
+ * protocols implement different variants of such ClientReply
+ * class.
+ */
+ virtual int dispatch_reply (TAO_Pluggable_Reply_Params &params) = 0;
+
+ /**
+ * The used for the pending reply has been closed.
+ * No reply is expected.
+ * @todo If the connection was closed due to a CloseConnection
+ * message then we could re-issue the request instead of raising
+ * the exception, it would a matter of simply adding a boolean
+ * argument to this function.
+ */
+ virtual void connection_closed (void) = 0;
+
+ /// Get the reply status.
+ CORBA::ULong reply_status (void) const;
+
+protected:
+ /// Reply or LocateReply status.
+ CORBA::ULong reply_status_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+#include "tao/Reply_Dispatcher.i"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_REPLY_DISPATCHER_H */
diff --git a/TAO/tao/Reply_Dispatcher.i b/TAO/tao/Reply_Dispatcher.i
new file mode 100644
index 00000000000..e390ec5911c
--- /dev/null
+++ b/TAO/tao/Reply_Dispatcher.i
@@ -0,0 +1,14 @@
+// -*- C++ -*-
+//
+// $Id$
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE CORBA::ULong
+TAO_Reply_Dispatcher::reply_status (void) const
+{
+ return this->reply_status_;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Request_Dispatcher.cpp b/TAO/tao/Request_Dispatcher.cpp
new file mode 100644
index 00000000000..3663d1ee49e
--- /dev/null
+++ b/TAO/tao/Request_Dispatcher.cpp
@@ -0,0 +1,31 @@
+// $Id$
+
+#include "tao/Request_Dispatcher.h"
+#include "tao/TAO_Server_Request.h"
+#include "tao/ORB_Core.h"
+
+ACE_RCSID (tao,
+ Request_Dispatcher,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Request_Dispatcher::~TAO_Request_Dispatcher (void)
+{
+}
+
+void
+TAO_Request_Dispatcher::dispatch (TAO_ORB_Core *orb_core,
+ TAO_ServerRequest &request,
+ CORBA::Object_out forward_to
+ ACE_ENV_ARG_DECL)
+{
+ // Dispatch based on object key
+ orb_core->adapter_registry ()->dispatch (request.object_key (),
+ request,
+ forward_to
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Request_Dispatcher.h b/TAO/tao/Request_Dispatcher.h
new file mode 100644
index 00000000000..ce097986e58
--- /dev/null
+++ b/TAO/tao/Request_Dispatcher.h
@@ -0,0 +1,68 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Request_Dispatcher.h
+ *
+ * $Id$
+ *
+ * A class that strategizes the request dispatching procedure.
+ *
+ * @author Frank Hunleth <fhunleth@cs.wustl.edu>
+ */
+//=============================================================================
+
+
+#ifndef TAO_REQUEST_DISPATCHER_H
+#define TAO_REQUEST_DISPATCHER_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/SystemException.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Objref_VarOut_T.h"
+#include "tao/Pseudo_VarOut_T.h"
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_ORB_Core;
+class TAO_ServerRequest;
+
+namespace CORBA
+{
+ class Object;
+ typedef TAO_Pseudo_Var_T<Object> Object_var;
+ typedef TAO_Pseudo_Out_T<Object> Object_out;
+}
+
+/**
+ * @class TAO_Request_Dispatcher
+ *
+ * @brief A class that strategizes the request dispatching procedure.
+ *
+ */
+class TAO_Export TAO_Request_Dispatcher
+{
+public:
+ /// Destructor.
+ virtual ~TAO_Request_Dispatcher (void);
+
+ /**
+ * Dispatch a request.
+ */
+ virtual void dispatch (TAO_ORB_Core *orb_core,
+ TAO_ServerRequest &request,
+ CORBA::Object_out forward_to
+ ACE_ENV_ARG_DECL);
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_REQUEST_DISPATCHER_H */
diff --git a/TAO/tao/Resource_Factory.cpp b/TAO/tao/Resource_Factory.cpp
new file mode 100644
index 00000000000..20a72732aa8
--- /dev/null
+++ b/TAO/tao/Resource_Factory.cpp
@@ -0,0 +1,233 @@
+// $Id$
+
+#include "tao/Resource_Factory.h"
+#include "tao/Protocol_Factory.h"
+#include "tao/orbconf.h"
+
+#include "ace/ACE.h"
+
+ACE_RCSID (tao,
+ Resource_Factory,
+ "$Id$")
+
+
+// ****************************************************************
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Protocol_Item::TAO_Protocol_Item (const ACE_CString &name)
+ : name_ (name),
+ factory_ (0),
+ factory_owner_ (0)
+{
+}
+
+TAO_Protocol_Item::~TAO_Protocol_Item (void)
+{
+ if (this->factory_owner_ == 1)
+ delete this->factory_;
+}
+
+const ACE_CString &
+TAO_Protocol_Item::protocol_name (void)
+{
+ return this->name_;
+}
+
+TAO_Protocol_Factory *
+TAO_Protocol_Item::factory (void)
+{
+ return this->factory_;
+}
+
+void
+TAO_Protocol_Item::factory (TAO_Protocol_Factory *factory,
+ int owner)
+{
+ this->factory_ = factory;
+ this->factory_owner_ = owner;
+}
+
+// **********************************************************************
+
+// ********************************************************************
+
+TAO_Resource_Factory::TAO_Resource_Factory (void)
+{
+}
+
+TAO_Resource_Factory::~TAO_Resource_Factory (void)
+{
+}
+
+int
+TAO_Resource_Factory::use_locked_data_blocks (void) const
+{
+ return 0;
+}
+
+ACE_Reactor *
+TAO_Resource_Factory::get_reactor (void)
+{
+ return 0;
+}
+
+void
+TAO_Resource_Factory::reclaim_reactor (ACE_Reactor *)
+{
+ return;
+}
+
+TAO_Connector_Registry *
+TAO_Resource_Factory::get_connector_registry (void)
+{
+ return 0;
+}
+
+TAO_Acceptor_Registry *
+TAO_Resource_Factory::get_acceptor_registry (void)
+{
+ return 0;
+}
+
+void
+TAO_Resource_Factory::use_local_memory_pool (bool)
+{
+}
+
+ACE_Allocator *
+TAO_Resource_Factory::input_cdr_dblock_allocator (void)
+{
+ return 0;
+}
+
+ACE_Allocator *
+TAO_Resource_Factory::input_cdr_buffer_allocator (void)
+{
+ return 0;
+}
+
+ACE_Allocator *
+TAO_Resource_Factory::input_cdr_msgblock_allocator (void)
+{
+ return 0;
+}
+
+int
+TAO_Resource_Factory::input_cdr_allocator_type_locked (void)
+{
+ return -1;
+}
+
+ACE_Allocator *
+TAO_Resource_Factory::output_cdr_dblock_allocator (void)
+{
+ return 0;
+}
+
+ACE_Allocator *
+TAO_Resource_Factory::output_cdr_buffer_allocator (void)
+{
+ return 0;
+}
+
+ACE_Allocator *
+TAO_Resource_Factory::output_cdr_msgblock_allocator (void)
+{
+ return 0;
+}
+
+ACE_Allocator *
+TAO_Resource_Factory::amh_response_handler_allocator (void)
+{
+ return 0;
+}
+
+ACE_Allocator *
+TAO_Resource_Factory::ami_response_handler_allocator (void)
+{
+ return 0;
+}
+
+TAO_ProtocolFactorySet *
+TAO_Resource_Factory::get_protocol_factories (void)
+{
+ return 0;
+}
+
+int
+TAO_Resource_Factory::init_protocol_factories (void)
+{
+ return -1;
+}
+
+TAO_Codeset_Manager *
+TAO_Resource_Factory::codeset_manager (void)
+{
+ return 0;
+}
+
+int
+TAO_Resource_Factory::cache_maximum (void) const
+{
+ return TAO_CONNECTION_CACHE_MAXIMUM;
+}
+
+int
+TAO_Resource_Factory::purge_percentage (void) const
+{
+ return 0;
+}
+
+int
+TAO_Resource_Factory::max_muxed_connections (void) const
+{
+ return 0;
+}
+
+
+int
+TAO_Resource_Factory::get_parser_names (char **&,
+ int &)
+{
+ return 0;
+}
+
+ACE_Lock *
+TAO_Resource_Factory::create_cached_connection_lock (void)
+{
+ return 0;
+}
+
+int
+TAO_Resource_Factory::locked_transport_cache (void)
+{
+ return 0;
+}
+
+ACE_Lock *
+TAO_Resource_Factory::create_object_key_table_lock (void)
+{
+ return 0;
+}
+
+ACE_Lock *
+TAO_Resource_Factory::create_corba_object_lock (void)
+{
+ return 0;
+}
+
+TAO_Configurable_Refcount
+TAO_Resource_Factory::create_corba_object_refcount (void)
+{
+ return TAO_Configurable_Refcount (
+ TAO_Configurable_Refcount::TAO_NULL_LOCK);
+}
+
+int
+TAO_Resource_Factory::load_default_protocols (void)
+{
+ return 0;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Resource_Factory.h b/TAO/tao/Resource_Factory.h
new file mode 100644
index 00000000000..580092f2887
--- /dev/null
+++ b/TAO/tao/Resource_Factory.h
@@ -0,0 +1,283 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Resource_Factory.h
+ *
+ * $Id$
+ *
+ * @author Chris Cleeland
+ * @author Carlos O'Ryan
+ */
+//=============================================================================
+
+#ifndef TAO_RESOURCE_FACTORY_H
+#define TAO_RESOURCE_FACTORY_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/TAO_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Versioned_Namespace.h"
+#include "tao/Basic_Types.h"
+#include "tao/Configurable_Refcount.h"
+
+#include "ace/Service_Object.h"
+#include "ace/Unbounded_Set.h"
+#include "ace/SString.h"
+#include "ace/CDR_Base.h"
+
+
+ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+class ACE_Lock;
+ACE_END_VERSIONED_NAMESPACE_DECL
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Protocol_Factory;
+class TAO_Acceptor_Registry;
+class TAO_Connector_Registry;
+
+class TAO_Flushing_Strategy;
+class TAO_Connection_Purging_Strategy;
+class TAO_LF_Strategy;
+class TAO_Codeset_Manager;
+class TAO_GIOP_Fragmentation_Strategy;
+class TAO_Transport;
+
+// ****************************************************************
+
+class TAO_Export TAO_Protocol_Item
+{
+public:
+ /// Creator method, the protocol name can only be set when the
+ /// object is created.
+ TAO_Protocol_Item (const ACE_CString &name);
+
+ /// Destructor that deallocates the factory object if the
+ /// Protocol_Item retains ownership.
+ ~TAO_Protocol_Item (void);
+
+ /// Return a reference to the character representation of the protocol
+ /// factories name.
+ const ACE_CString &protocol_name (void);
+
+ /// Return a pointer to the protocol factory.
+ TAO_Protocol_Factory *factory (void);
+
+ /// Set the factory pointer's value.
+ void factory (TAO_Protocol_Factory *factory, int owner = 0);
+
+private:
+
+ // Disallow copying and assignment.
+ TAO_Protocol_Item (const TAO_Protocol_Item&);
+ void operator= (const TAO_Protocol_Item&);
+
+private:
+ /// Protocol factory name.
+ ACE_CString name_;
+
+ /// Pointer to factory object.
+ TAO_Protocol_Factory *factory_;
+
+ /// Whether we own (and therefore have to delete) the factory object.
+ int factory_owner_;
+};
+
+// typedefs for containers containing the list of loaded protocol
+// factories.
+typedef ACE_Unbounded_Set<TAO_Protocol_Item*>
+ TAO_ProtocolFactorySet;
+
+typedef ACE_Unbounded_Set_Iterator<TAO_Protocol_Item*>
+ TAO_ProtocolFactorySetItor;
+
+// ****************************************************************
+
+/**
+ * @class TAO_Resource_Factory
+ *
+ * @brief Factory which manufacturers resources for use by the ORB Core.
+ *
+ * This class is a factory/repository for critical ORB Core
+ * resources.
+ */
+class TAO_Export TAO_Resource_Factory : public ACE_Service_Object
+{
+public:
+
+ enum Purging_Strategy
+ {
+ /// Least Recently Used
+ LRU,
+
+ /// Least Frequently Used
+ LFU,
+
+ /// First In First Out
+ FIFO,
+
+ /// Dont use any strategy.
+ NOOP
+ };
+
+ enum Resource_Usage
+ {
+ /// Use resources in an eager fashion
+ TAO_EAGER,
+
+ /// Use resources in a lazy manner
+ TAO_LAZY
+ };
+
+ // = Initialization and termination methods.
+ TAO_Resource_Factory (void);
+ virtual ~TAO_Resource_Factory (void);
+
+ // = Resource Retrieval
+
+ /// @@ Backwards compatibility, return 1 if the ORB core should use
+ /// Locked_Data_Blocks
+ virtual int use_locked_data_blocks (void) const;
+
+ /// Return an ACE_Reactor to be utilized.
+ virtual ACE_Reactor *get_reactor (void);
+
+ /// Reclaim reactor resources (e.g. deallocate, etc).
+ virtual void reclaim_reactor (ACE_Reactor *reactor);
+
+ /// Return a reference to the acceptor registry.
+ virtual TAO_Acceptor_Registry *get_acceptor_registry (void);
+
+ /// Return a connector to be utilized.
+ virtual TAO_Connector_Registry *get_connector_registry (void);
+
+ /// Return the Allocator's memory pool type
+ virtual void use_local_memory_pool (bool);
+
+ /// @name Access the input CDR allocators.
+ //@{
+ virtual ACE_Allocator* input_cdr_dblock_allocator (void);
+ virtual ACE_Allocator* input_cdr_buffer_allocator (void);
+ virtual ACE_Allocator* input_cdr_msgblock_allocator (void);
+ //@}
+
+ // Return 1 when the input CDR allocator uses a lock else 0.
+ virtual int input_cdr_allocator_type_locked (void);
+
+ /// @name Access the output CDR allocators.
+ //@{
+ virtual ACE_Allocator* output_cdr_dblock_allocator (void);
+ virtual ACE_Allocator* output_cdr_buffer_allocator (void);
+ virtual ACE_Allocator* output_cdr_msgblock_allocator (void);
+ //@}
+
+ /// Access the AMH response handler allocator
+ virtual ACE_Allocator* amh_response_handler_allocator (void);
+
+ /// Access the AMI response handler allocator
+ virtual ACE_Allocator* ami_response_handler_allocator (void);
+
+ /**
+ * The protocol factory list is implemented in this class since
+ * a) it will be a global resource and
+ * b) it is initialized at start up and then not altered.
+ * Returns a container holding the list of loaded protocols.
+ */
+ virtual TAO_ProtocolFactorySet *get_protocol_factories (void);
+
+ /**
+ * This method will loop through the protocol list and
+ * using the protocol name field this method will
+ * retrieve a pointer to the associated protocol factory
+ * from the service configurator. It is assumed
+ * that only one thread will call this method at ORB initialization.
+ * NON-THREAD-SAFE
+ */
+ virtual int init_protocol_factories (void);
+
+ /// Gets the codeset manager.
+ virtual TAO_Codeset_Manager* codeset_manager (void);
+
+ /// This denotes the maximum number of connections that can be cached.
+ virtual int cache_maximum (void) const;
+
+ /// This denotes the amount of entries to remove from the connection
+ /// cache.
+ virtual int purge_percentage (void) const;
+
+ /// Return the number of muxed connections that are allowed for a
+ /// remote endpoint
+ virtual int max_muxed_connections (void) const;
+
+ virtual int get_parser_names (char **&names,
+ int &number_of_names);
+
+ /// Creates the lock for the lock needed in the Cache Map
+ /// @deprecated
+ virtual ACE_Lock *create_cached_connection_lock (void);
+
+ /// Should the transport cache have a lock or not? Return 1 if the
+ /// transport cache needs to be locked else return 0
+ virtual int locked_transport_cache (void);
+
+ /// Creates a lock needed for the table that stores the object keys.
+ virtual ACE_Lock *create_object_key_table_lock (void);
+
+ /// Creates the lock for the CORBA Object
+ virtual ACE_Lock *create_corba_object_lock (void);
+
+ /// Creates the configurable refcount for the CORBA Object
+ virtual TAO_Configurable_Refcount create_corba_object_refcount (void);
+
+ /// Creates the flushing strategy. The new instance is owned by the
+ /// caller.
+ virtual TAO_Flushing_Strategy *create_flushing_strategy (void) = 0;
+
+ /// Creates the connection purging strategy.
+ virtual TAO_Connection_Purging_Strategy *create_purging_strategy (void) = 0;
+
+ /// Creates the leader followers strategy. The new instance is owned by the
+ /// caller.
+ virtual TAO_LF_Strategy *create_lf_strategy (void) = 0;
+
+ /// Outgoing fragment creation strategy.
+ virtual auto_ptr<TAO_GIOP_Fragmentation_Strategy>
+ create_fragmentation_strategy (TAO_Transport * transport,
+ CORBA::ULong max_message_size) const = 0;
+
+ /// Disables the factory. When a new factory is installed and used,
+ /// this function should be called on the previously used (default)
+ /// factory. This should result in proper error reporting if the
+ /// user attempts to set options on an unused factory.
+ virtual void disable_factory (void) = 0;
+
+ /// Return the resource usage strategy.
+ virtual
+ TAO_Resource_Factory::Resource_Usage
+ resource_usage_strategy (void) const = 0;
+
+ /// Return the value of the strategy that indicates whether
+ /// the ORB should wait for the replies during shutdown or drop
+ /// replies during shutdown.
+ virtual bool drop_replies_during_shutdown () const = 0;
+protected:
+ /**
+ * Loads the default protocols. This method is used so that the
+ * advanced_resource.cpp can call the one in default_resource.cpp
+ * without calling unnecessary functions.
+ */
+ virtual int load_default_protocols (void);
+
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_RESOURCE_FACTORY_H */
diff --git a/TAO/tao/Resume_Handle.cpp b/TAO/tao/Resume_Handle.cpp
new file mode 100644
index 00000000000..6ce7297a70f
--- /dev/null
+++ b/TAO/tao/Resume_Handle.cpp
@@ -0,0 +1,81 @@
+#include "tao/Resume_Handle.h"
+#include "tao/ORB_Core.h"
+#include "debug.h"
+
+#include "ace/Reactor.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/Resume_Handle.inl"
+#endif /* __ACE_INLINE__ */
+
+ACE_RCSID (tao,
+ Resume_Handle,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+void
+TAO_Resume_Handle::resume_handle (void)
+{
+ // If we have a complete message, just resume the handler
+ // Resume the handler.
+ if (this->orb_core_ &&
+ this->orb_core_->reactor ()->resumable_handler () &&
+ this->flag_ == TAO_HANDLE_RESUMABLE &&
+ this->handle_ != ACE_INVALID_HANDLE)
+ {
+ this->orb_core_->reactor ()->resume_handler (this->handle_);
+ }
+
+ // Set the flag, so that we dont resume again..
+ this->flag_ = TAO_HANDLE_ALREADY_RESUMED;
+}
+
+void
+TAO_Resume_Handle::handle_input_return_value_hook (int& return_value)
+{
+ // RT8248: The return value is only changed from 1 to 0 if:
+ // 1) the handle_input return value wants an immediate callback
+ // on the handle (i.e. will return "1")
+ // 2) this->resume_handle was already called
+ // 3) reactor->resume_handler was called by this->resume_handle
+ // The value is changed because you can't ask for an immediate callback
+ // on a handle that you have already given up ownership of. (RT8248)
+ if ( return_value == 1 &&
+ this->flag_ == TAO_HANDLE_ALREADY_RESUMED &&
+ this->orb_core_ &&
+ this->orb_core_->reactor ()->resumable_handler () &&
+ this->handle_ != ACE_INVALID_HANDLE)
+ {
+ // a return value of "1" means "call me back immediately;
+ // but we can't "call me back immediately" on an
+ // already-resumed handle
+ return_value = 0;
+
+ if (TAO_debug_level > 6)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - Resume_Handle::handle_input_return_value_hook, "
+ "overriding return value of 1 with retval = %d\n",
+ return_value));
+ }
+ }
+ else if ( return_value == -1 )
+ {
+ // this covers the "connection close" case, where you want
+ // to leave the handle suspended if you're return -1 to
+ // remove the handle from the Reactor. (See ChangeLog entry
+ // Fri Dec 16 14:40:54 2005)
+ this->flag_ = TAO_HANDLE_LEAVE_SUSPENDED;
+
+ if (TAO_debug_level > 6)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - Resume_Handle::handle_input_return_value_hook, "
+ "handle_input returning -1, so handle is not resumed.\n"));
+ }
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Resume_Handle.h b/TAO/tao/Resume_Handle.h
new file mode 100644
index 00000000000..9fd1f4949e9
--- /dev/null
+++ b/TAO/tao/Resume_Handle.h
@@ -0,0 +1,103 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Resume_Handle.h
+ *
+ * $Id$
+ *
+ * @author Balachandran Natarajan <bala@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_RESUME_HANDLE_H
+#define TAO_RESUME_HANDLE_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/TAO_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Versioned_Namespace.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_ORB_Core;
+
+/**
+ * @class TAO_Resume_Handle
+ *
+ * @brief A utility class that helps in resuming handlers if TAO uses
+ * a TP Reactor from ACE.
+ *
+ * Please read the documentation in the bugzilla #575 in the bugzilla
+ * database what we mean by handler resumption.
+ *
+ * When TAO uses a TP reactor, it takes care of resuming the handler
+ * once it makes sure that it has read the whole message out of the
+ * socket. During the process of reading the transport object would
+ * have to deal with errors in 'read' from the socket, or errors in
+ * the messages that has been received. Instead of calling
+ * resume_handler () on the reactor at every point in the code, we
+ * use this utility class to take care of the resumption.
+ */
+
+class TAO_Export TAO_Resume_Handle
+{
+
+public:
+
+ /// Ctor.
+ TAO_Resume_Handle (TAO_ORB_Core *orb_core = 0,
+ ACE_HANDLE h = ACE_INVALID_HANDLE);
+ /// Dtor
+ ~TAO_Resume_Handle (void);
+
+ enum TAO_Handle_Resume_Flag
+ {
+ TAO_HANDLE_RESUMABLE = 0,
+ TAO_HANDLE_ALREADY_RESUMED,
+ TAO_HANDLE_LEAVE_SUSPENDED
+ };
+
+ /// Allow the users of this class to change the underlying flag.
+ void set_flag (TAO_Handle_Resume_Flag fl);
+
+ /// Assignment operator
+ TAO_Resume_Handle &operator= (const TAO_Resume_Handle &rhs);
+
+ /// Resume the handle in the reactor only if the ORB uses a TP
+ /// reactor. Else we don't resume the handle.
+ void resume_handle (void);
+
+ // Hook method called at the end of a connection handler's
+ // handle_input function. Might override the handle_input
+ // return value or change the resume_handler's flag_ value.
+ void handle_input_return_value_hook (int& return_value);
+
+
+private:
+
+ /// Our ORB Core.
+ TAO_ORB_Core *orb_core_;
+
+ /// The actual handle that needs resumption..
+ ACE_HANDLE handle_;
+
+ /// The flag for indicating whether the handle has been resumed or
+ /// not. A value of '0' indicates that the handle needs resumption.
+ TAO_Handle_Resume_Flag flag_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/Resume_Handle.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /*TAO_RESUME_HANDLE*/
diff --git a/TAO/tao/Resume_Handle.inl b/TAO/tao/Resume_Handle.inl
new file mode 100644
index 00000000000..e89466fd4e2
--- /dev/null
+++ b/TAO/tao/Resume_Handle.inl
@@ -0,0 +1,40 @@
+// -*- C++ -*-
+//
+//$Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO_Resume_Handle::TAO_Resume_Handle (TAO_ORB_Core *orb_core,
+ ACE_HANDLE h)
+ : orb_core_ (orb_core),
+ handle_ (h),
+ flag_ (TAO_HANDLE_RESUMABLE)
+{
+}
+
+ACE_INLINE
+TAO_Resume_Handle::~TAO_Resume_Handle (void)
+{
+ if (this->flag_ == TAO_HANDLE_RESUMABLE)
+ this->resume_handle ();
+}
+
+
+ACE_INLINE void
+TAO_Resume_Handle::set_flag (TAO_Handle_Resume_Flag fl)
+{
+ this->flag_ = fl;
+}
+
+ACE_INLINE TAO_Resume_Handle &
+TAO_Resume_Handle::operator= (const TAO_Resume_Handle &rhs)
+{
+ this->orb_core_ = rhs.orb_core_;
+ this->handle_ = rhs.handle_;
+ this->flag_ = rhs.flag_;
+
+ return *this;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Seq_Out_T.cpp b/TAO/tao/Seq_Out_T.cpp
new file mode 100644
index 00000000000..02bc2c7f89f
--- /dev/null
+++ b/TAO/tao/Seq_Out_T.cpp
@@ -0,0 +1,12 @@
+// $Id$
+
+#ifndef TAO_SEQ_OUT_T_CPP
+#define TAO_SEQ_OUT_T_CPP
+
+#include "tao/Seq_Out_T.h"
+
+#if !defined (__ACE_INLINE__)
+#include "tao/Seq_Out_T.inl"
+#endif /* __ACE_INLINE__ */
+
+#endif /* TAO_SEQUENCE_OUT_T_CPP */
diff --git a/TAO/tao/Seq_Out_T.h b/TAO/tao/Seq_Out_T.h
new file mode 100644
index 00000000000..baaf937394a
--- /dev/null
+++ b/TAO/tao/Seq_Out_T.h
@@ -0,0 +1,70 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Seq_Out_T.h
+ *
+ * $Id$
+ *
+ * @author Jeff Parsons
+ */
+//=============================================================================
+
+#ifndef TAO_SEQ_OUT_T_H
+#define TAO_SEQ_OUT_T_H
+#include /**/ "ace/pre.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_Seq_Out_T
+ *
+ * @brief Parametrized implementation of _out class for sequences.
+ *
+ */
+template <typename T>
+class TAO_Seq_Out_T
+{
+public:
+ typedef typename T::subscript_type T_elem;
+ typedef typename T::_var_type T_var;
+
+ TAO_Seq_Out_T (T *&);
+ TAO_Seq_Out_T (T_var &);
+ TAO_Seq_Out_T (const TAO_Seq_Out_T<T> &);
+
+ TAO_Seq_Out_T &operator= (const TAO_Seq_Out_T<T> &);
+ TAO_Seq_Out_T &operator= (T *);
+
+ operator T *& ();
+ T * operator-> (void);
+
+ T_elem operator[] (CORBA::ULong index);
+ T *& ptr (void);
+
+private:
+ T *& ptr_;
+ // Assignment from T_var not allowed.
+ void operator= (const T_var &);
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+#include "tao/Seq_Out_T.inl"
+#endif /* defined INLINE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+#include "tao/Seq_Out_T.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
+#pragma implementation ("Seq_Out_T.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_SEQ_OUT_T_H */
diff --git a/TAO/tao/Seq_Out_T.inl b/TAO/tao/Seq_Out_T.inl
new file mode 100644
index 00000000000..80e460f6cf2
--- /dev/null
+++ b/TAO/tao/Seq_Out_T.inl
@@ -0,0 +1,83 @@
+// -*- C++ -*-
+//
+//$Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template<typename T>
+ACE_INLINE
+TAO_Seq_Out_T<T>::TAO_Seq_Out_T (T *& p)
+ : ptr_ (p)
+{
+ this->ptr_ = 0;
+}
+
+template<typename T>
+ACE_INLINE
+TAO_Seq_Out_T<T>::TAO_Seq_Out_T (T_var & p)
+ : ptr_ (p.out ())
+{
+ delete this->ptr_;
+ this->ptr_ = 0;
+}
+
+template<typename T>
+ACE_INLINE
+TAO_Seq_Out_T<T>::TAO_Seq_Out_T (
+ const TAO_Seq_Out_T<T> & p
+ )
+ : ptr_ (p.ptr_)
+{}
+
+template<typename T>
+ACE_INLINE
+TAO_Seq_Out_T<T> &
+TAO_Seq_Out_T<T>::operator= (
+ const TAO_Seq_Out_T<T> & p
+ )
+{
+ this->ptr_ = p.ptr_;
+ return *this;
+}
+
+template<typename T>
+ACE_INLINE
+TAO_Seq_Out_T<T> &
+TAO_Seq_Out_T<T>::operator= (T * p)
+{
+ this->ptr_ = p;
+ return *this;
+}
+
+template<typename T>
+ACE_INLINE
+TAO_Seq_Out_T<T>::operator T *& ()
+{
+ return this->ptr_;
+}
+
+template<typename T>
+ACE_INLINE
+T *&
+TAO_Seq_Out_T<T>::ptr (void)
+{
+ return this->ptr_;
+}
+
+template<typename T>
+ACE_INLINE
+T *
+TAO_Seq_Out_T<T>::operator-> (void)
+{
+ return this->ptr_;
+}
+
+template<typename T>
+ACE_INLINE
+typename TAO_Seq_Out_T<T>::T_elem
+TAO_Seq_Out_T<T>::operator[] (CORBA::ULong index)
+{
+ return this->ptr_->operator[] (index);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Seq_Var_T.cpp b/TAO/tao/Seq_Var_T.cpp
new file mode 100644
index 00000000000..a9929293475
--- /dev/null
+++ b/TAO/tao/Seq_Var_T.cpp
@@ -0,0 +1,76 @@
+// $Id$
+
+#ifndef TAO_SEQ_VAR_T_CPP
+#define TAO_SEQ_VAR_T_CPP
+
+#include "tao/Seq_Var_T.h"
+
+#if !defined (__ACE_INLINE__)
+#include "tao/Seq_Var_T.inl"
+#endif /* __ACE_INLINE__ */
+
+#include "ace/OS_Memory.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template<typename T>
+TAO_Seq_Var_Base_T<T>::TAO_Seq_Var_Base_T (
+ const TAO_Seq_Var_Base_T<T> & p)
+ : ptr_ (p.ptr_ ? new T (*p.ptr_) : 0)
+{
+}
+
+// ****************************************************************************
+
+template<typename T>
+TAO_FixedSeq_Var_T<T> &
+TAO_FixedSeq_Var_T<T>::operator= (
+ const TAO_FixedSeq_Var_T<T> & p)
+{
+ // Strongly exception safe assignment using copy and non-throwing
+ // swap technique.
+ TAO_FixedSeq_Var_T<T> tmp (p);
+
+ T * old_ptr = this->ptr_;
+ this->ptr_ = tmp.ptr_;
+ tmp.ptr_ = old_ptr;
+
+ return *this;
+}
+
+// Fixed-size types only.
+template<typename T>
+TAO_FixedSeq_Var_T<T> &
+TAO_FixedSeq_Var_T<T>::operator= (const T & p)
+{
+ // Strongly exception safe assignment using copy and non-throwing
+ // swap technique.
+ TAO_FixedSeq_Var_T<T> tmp (p);
+
+ T * old_ptr = this->ptr_;
+ this->ptr_ = tmp.ptr_;
+ tmp.ptr_ = old_ptr;
+
+ return *this;
+}
+
+// ****************************************************************************
+
+template<typename T>
+TAO_VarSeq_Var_T<T> &
+TAO_VarSeq_Var_T<T>::operator= (const TAO_VarSeq_Var_T<T> & p)
+{
+ // Strongly exception safe assignment using copy and non-throwing
+ // swap technique.
+ TAO_VarSeq_Var_T<T> tmp (p);
+
+ T * old_ptr = this->ptr_;
+ this->ptr_ = tmp.ptr_;
+ tmp.ptr_ = old_ptr;
+
+ return *this;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_SEQ_VAR_T_CPP */
diff --git a/TAO/tao/Seq_Var_T.h b/TAO/tao/Seq_Var_T.h
new file mode 100644
index 00000000000..527c63e664f
--- /dev/null
+++ b/TAO/tao/Seq_Var_T.h
@@ -0,0 +1,142 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Seq_Var_T.h
+ *
+ * $Id$
+ *
+ * @author Jeff Parsons
+ */
+//=============================================================================
+
+#ifndef TAO_SEQ_VAR_T_H
+#define TAO_SEQ_VAR_T_H
+
+#include /**/ "ace/pre.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Versioned_Namespace.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_Seq_Var_Base_T
+ *
+ * @brief Parametrized implementation of _var base class for sequences
+ *
+ */
+template <typename T>
+class TAO_Seq_Var_Base_T
+{
+public:
+ typedef typename T::subscript_type T_elem;
+
+ TAO_Seq_Var_Base_T (void);
+ TAO_Seq_Var_Base_T (T *);
+ TAO_Seq_Var_Base_T (const TAO_Seq_Var_Base_T<T> &);
+
+ ~TAO_Seq_Var_Base_T (void);
+
+ T *operator-> (void);
+ const T *operator-> (void) const;
+
+ operator const T & () const;
+ operator T & ();
+ operator T & () const;
+
+ typedef const T & _in_type;
+ typedef T & _inout_type;
+ typedef T *& _out_type;
+ typedef T * _retn_type;
+
+ // in, inout, out, _retn
+ _in_type in (void) const;
+ _inout_type inout (void);
+ _out_type out (void);
+ _retn_type _retn (void);
+
+ /// TAO extension.
+ _retn_type ptr (void) const;
+protected:
+ T * ptr_;
+};
+
+/**
+ * @class TAO_FixedSeq_Var_T
+ *
+ * @brief Parametrized implementation of _var class for sequences
+ * whose element is of fixed size..
+ */
+template <typename T>
+class TAO_FixedSeq_Var_T : public TAO_Seq_Var_Base_T<T>
+{
+public:
+ typedef typename T::subscript_type T_elem;
+ typedef typename T::const_subscript_type T_const_elem;
+
+ TAO_FixedSeq_Var_T (void);
+ TAO_FixedSeq_Var_T (T *);
+ TAO_FixedSeq_Var_T (const TAO_FixedSeq_Var_T<T> &);
+
+ // Fixed-size base types only.
+ TAO_FixedSeq_Var_T (const T &);
+
+ TAO_FixedSeq_Var_T & operator= (T *);
+ TAO_FixedSeq_Var_T & operator= (const TAO_FixedSeq_Var_T<T> &);
+
+ T_elem operator[] (CORBA::ULong index);
+ T_const_elem operator[] (CORBA::ULong index) const;
+
+ /// Fixed-size base types only.
+ TAO_FixedSeq_Var_T & operator= (const T &);
+};
+
+/**
+ * @class TAO_VarSeq_Var_T
+ *
+ * @brief Parametrized implementation of _var class for sequences
+ * whose element is of variable size..
+ *
+ */
+template <typename T>
+class TAO_VarSeq_Var_T : public TAO_Seq_Var_Base_T<T>
+{
+public:
+ typedef typename T::subscript_type T_elem;
+ typedef typename T::const_subscript_type T_const_elem;
+
+ TAO_VarSeq_Var_T (void);
+ TAO_VarSeq_Var_T (T *);
+ TAO_VarSeq_Var_T (const TAO_VarSeq_Var_T<T> &);
+
+ TAO_VarSeq_Var_T & operator= (T *);
+ TAO_VarSeq_Var_T & operator= (const TAO_VarSeq_Var_T<T> &);
+
+ T_elem operator[] (CORBA::ULong index);
+ T_const_elem operator[] (CORBA::ULong index) const;
+
+ /// Variable-size base types only.
+ operator T *& ();
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+#include "tao/Seq_Var_T.inl"
+#endif /* defined INLINE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+#include "tao/Seq_Var_T.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
+#pragma implementation ("Seq_Var_T.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_SEQ_VAROUT_T_H */
diff --git a/TAO/tao/Seq_Var_T.inl b/TAO/tao/Seq_Var_T.inl
new file mode 100644
index 00000000000..ac3515783d4
--- /dev/null
+++ b/TAO/tao/Seq_Var_T.inl
@@ -0,0 +1,220 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template<typename T>
+ACE_INLINE
+TAO_Seq_Var_Base_T<T>::TAO_Seq_Var_Base_T (void)
+ : ptr_ (0)
+{}
+
+template<typename T>
+ACE_INLINE
+TAO_Seq_Var_Base_T<T>::TAO_Seq_Var_Base_T (T * p)
+ : ptr_ (p)
+{}
+
+template<typename T>
+ACE_INLINE
+TAO_Seq_Var_Base_T<T>::~TAO_Seq_Var_Base_T (void)
+{
+ delete this->ptr_;
+}
+
+template<typename T>
+ACE_INLINE
+const T *
+TAO_Seq_Var_Base_T<T>::operator-> (void) const
+{
+ return this->ptr_;
+}
+
+template<typename T>
+ACE_INLINE
+T *
+TAO_Seq_Var_Base_T<T>::operator-> (void)
+{
+ return this->ptr_;
+}
+
+template<typename T>
+ACE_INLINE
+TAO_Seq_Var_Base_T<T>::operator const T & () const
+{
+ return *this->ptr_;
+}
+
+template<typename T>
+ACE_INLINE
+TAO_Seq_Var_Base_T<T>::operator T & ()
+{
+ return *this->ptr_;
+}
+
+template<typename T>
+ACE_INLINE
+TAO_Seq_Var_Base_T<T>::operator T & () const
+{
+ return *this->ptr_;
+}
+
+template<typename T>
+ACE_INLINE
+const T &
+TAO_Seq_Var_Base_T<T>::in (void) const
+{
+ return *this->ptr_;
+}
+
+template<typename T>
+ACE_INLINE
+T &
+TAO_Seq_Var_Base_T<T>::inout (void)
+{
+ return *this->ptr_;
+}
+
+template<typename T>
+ACE_INLINE
+T *&
+TAO_Seq_Var_Base_T<T>::out (void)
+{
+ delete this->ptr_;
+ this->ptr_ = 0;
+ return this->ptr_;
+}
+
+template<typename T>
+ACE_INLINE
+T *
+TAO_Seq_Var_Base_T<T>::_retn (void)
+{
+ T * tmp = this->ptr_;
+ this->ptr_ = 0;
+ return tmp;
+}
+
+template<typename T>
+ACE_INLINE
+T *
+TAO_Seq_Var_Base_T<T>::ptr (void) const
+{
+ return this->ptr_;
+}
+
+// ***************************************************************
+
+template<typename T>
+ACE_INLINE
+TAO_FixedSeq_Var_T<T>::TAO_FixedSeq_Var_T (void)
+{}
+
+template<typename T>
+ACE_INLINE
+TAO_FixedSeq_Var_T<T>::TAO_FixedSeq_Var_T (T * p)
+ : TAO_Seq_Var_Base_T<T> (p)
+{}
+
+template<typename T>
+TAO_FixedSeq_Var_T<T>::TAO_FixedSeq_Var_T (
+ const TAO_FixedSeq_Var_T<T> & p
+ )
+ : TAO_Seq_Var_Base_T<T> (p)
+{
+}
+
+// Fixed-size base types only.
+template<typename T>
+ACE_INLINE
+TAO_FixedSeq_Var_T<T>::TAO_FixedSeq_Var_T (const T & p)
+{
+ ACE_NEW (this->ptr_,
+ T (p));
+}
+
+template<typename T>
+ACE_INLINE
+TAO_FixedSeq_Var_T<T> &
+TAO_FixedSeq_Var_T<T>::operator= (T * p)
+{
+ delete this->ptr_;
+ this->ptr_ = p;
+ return *this;
+}
+
+template<typename T>
+ACE_INLINE
+typename TAO_FixedSeq_Var_T<T>::T_elem
+TAO_FixedSeq_Var_T<T>::operator[] (CORBA::ULong index)
+{
+ return this->ptr_->operator[] (index);
+}
+
+template<typename T>
+ACE_INLINE
+typename TAO_FixedSeq_Var_T<T>::T_const_elem
+TAO_FixedSeq_Var_T<T>::operator[] (CORBA::ULong index) const
+{
+ return this->ptr_->operator[] (index);
+}
+
+// ***************************************************************
+
+template<typename T>
+ACE_INLINE
+TAO_VarSeq_Var_T<T>::TAO_VarSeq_Var_T (void)
+{
+}
+
+template<typename T>
+ACE_INLINE
+TAO_VarSeq_Var_T<T>::TAO_VarSeq_Var_T (T * p)
+ : TAO_Seq_Var_Base_T<T> (p)
+{
+}
+
+template<typename T>
+TAO_VarSeq_Var_T<T>::TAO_VarSeq_Var_T (
+ const TAO_VarSeq_Var_T<T> & p)
+ : TAO_Seq_Var_Base_T<T> (p)
+{
+}
+
+template<typename T>
+ACE_INLINE
+TAO_VarSeq_Var_T<T> &
+TAO_VarSeq_Var_T<T>::operator= (T * p)
+{
+ delete this->ptr_;
+ this->ptr_ = p;
+ return *this;
+}
+
+// Variable-size types only.
+template<typename T>
+ACE_INLINE
+TAO_VarSeq_Var_T<T>::operator T *& ()
+{
+ return this->ptr_;
+}
+
+template<typename T>
+ACE_INLINE
+typename TAO_VarSeq_Var_T<T>::T_elem
+TAO_VarSeq_Var_T<T>::operator[] (CORBA::ULong index)
+{
+ return this->ptr_->operator[] (index);
+}
+
+template<typename T>
+ACE_INLINE
+typename TAO_VarSeq_Var_T<T>::T_const_elem
+TAO_VarSeq_Var_T<T>::operator[] (CORBA::ULong index) const
+{
+ return this->ptr_->operator[] (index);
+}
+
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Sequence_T.h b/TAO/tao/Sequence_T.h
new file mode 100644
index 00000000000..5105a76b7df
--- /dev/null
+++ b/TAO/tao/Sequence_T.h
@@ -0,0 +1,16 @@
+// $Id$
+
+#include "tao/Unbounded_Octet_Sequence_T.h"
+#include "tao/Unbounded_Value_Sequence_T.h"
+#include "tao/Unbounded_Wstring_Sequence_T.h"
+#include "tao/Unbounded_String_Sequence_T.h"
+#include "tao/Unbounded_Object_Reference_Sequence_T.h"
+#include "tao/Unbounded_Array_Sequence_T.h"
+#include "tao/Unbounded_Sequence_CDR_T.h"
+#include "tao/Bounded_Value_Sequence_T.h"
+#include "tao/Bounded_Wstring_Sequence_T.h"
+#include "tao/Bounded_String_Sequence_T.h"
+#include "tao/Bounded_Object_Reference_Sequence_T.h"
+#include "tao/Bounded_Array_Sequence_T.h"
+#include "tao/Bounded_Sequence_CDR_T.h"
+
diff --git a/TAO/tao/ServerRequestInterceptor_Adapter.cpp b/TAO/tao/ServerRequestInterceptor_Adapter.cpp
new file mode 100644
index 00000000000..7afe711cb85
--- /dev/null
+++ b/TAO/tao/ServerRequestInterceptor_Adapter.cpp
@@ -0,0 +1,15 @@
+#include "tao/ServerRequestInterceptor_Adapter.h"
+
+ACE_RCSID (tao,
+ ServerRequestInterceptorAdapter,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO::ServerRequestInterceptor_Adapter::~ServerRequestInterceptor_Adapter (void)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+
diff --git a/TAO/tao/ServerRequestInterceptor_Adapter.h b/TAO/tao/ServerRequestInterceptor_Adapter.h
new file mode 100644
index 00000000000..5a9c372870f
--- /dev/null
+++ b/TAO/tao/ServerRequestInterceptor_Adapter.h
@@ -0,0 +1,178 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file ServerRequestInterceptor_Adapter.h
+ *
+ * $Id$
+ *
+ * This file an adapter class to simplify the support of
+ * interceptors.
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_SERVER_REQUEST_INTERCEPTOR_ADAPTER_H
+#define TAO_SERVER_REQUEST_INTERCEPTOR_ADAPTER_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/TAO_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/CORBA_macros.h"
+#include "tao/SystemException.h"
+
+#if TAO_HAS_EXTENDED_FT_INTERCEPTORS == 1
+# include "tao/OctetSeqC.h"
+#endif /*TAO_HAS_EXTENDED_FT_INTERCEPTORS*/
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace PortableInterceptor
+{
+ class ServerRequestInterceptor;
+ typedef ServerRequestInterceptor *ServerRequestInterceptor_ptr;
+
+ typedef CORBA::Short ReplyStatus;
+}
+
+namespace CORBA
+{
+ class PolicyList;
+}
+
+class TAO_ServerRequest;
+
+namespace TAO
+{
+ class ServerRequestInfo;
+ class Argument;
+ class PICurrent_Impl;
+ class Upcall_Command;
+
+ /**
+ * @class ServerRequestInterceptor_Adapter
+ */
+ class TAO_Export ServerRequestInterceptor_Adapter
+ {
+ public:
+ virtual ~ServerRequestInterceptor_Adapter (void);
+
+ /**
+ * @name PortableInterceptor Server Side Interception Points
+ *
+ * Each of these methods corresponds to a client side interception
+ * point.
+ */
+ //@{
+#if TAO_HAS_EXTENDED_FT_INTERCEPTORS == 1
+ /// This method implements the "starting" server side interception
+ /// point. It will be used as the first interception point and it is
+ /// proprietary to TAO.
+ /// @@ Will go away once Bug 1369 is fixed
+ virtual void tao_ft_interception_point (
+ TAO_ServerRequest &server_request,
+ TAO::Argument * const args[],
+ size_t nargs,
+ void * servant_upcall,
+ CORBA::TypeCode_ptr const * exceptions,
+ CORBA::ULong nexceptions,
+ CORBA::OctetSeq_out oc
+ ACE_ENV_ARG_DECL) = 0;
+#endif /*TAO_HAS_EXTENDED_FT_INTERCEPTORS*/
+
+ /// This method implements the "intermediate" server side
+ /// interception point if the above #ifdef is set to 1 and a
+ /// starting intercetion point if it is not set to 1.
+ ///
+ /// @note This method should have been the "starting" interception
+ /// point according to the interceptor spec. This will be
+ /// fixed once Bug 1369 is completely done.
+ virtual void receive_request_service_contexts (
+ TAO_ServerRequest &server_request,
+ TAO::Argument * const args[],
+ size_t nargs,
+ void * servant_upcall,
+ CORBA::TypeCode_ptr const * exceptions,
+ CORBA::ULong nexceptions
+ ACE_ENV_ARG_DECL) = 0;
+
+ /// This method an "intermediate" server side interception point.
+ virtual void receive_request (
+ TAO_ServerRequest &server_request,
+ TAO::Argument * const args[],
+ size_t nargs,
+ void * servant_upcall,
+ CORBA::TypeCode_ptr const * exceptions,
+ CORBA::ULong nexceptions
+ ACE_ENV_ARG_DECL) = 0;
+
+ /// This method implements one of the "ending" server side
+ /// interception points.
+ virtual void send_reply (
+ TAO_ServerRequest &server_request,
+ TAO::Argument * const args[],
+ size_t nargs,
+ void * servant_upcall,
+ CORBA::TypeCode_ptr const * exceptions,
+ CORBA::ULong nexceptions
+ ACE_ENV_ARG_DECL) = 0;
+
+ /// This method implements one of the "ending" server side
+ /// interception points.
+ virtual void send_exception (
+ TAO_ServerRequest &server_request,
+ TAO::Argument * const args[],
+ size_t nargs,
+ void * servant_upcall,
+ CORBA::TypeCode_ptr const * exceptions,
+ CORBA::ULong nexceptions
+ ACE_ENV_ARG_DECL) = 0;
+
+ /// This method implements one of the "ending" server side
+ /// interception points.
+ virtual void send_other (
+ TAO_ServerRequest &server_request,
+ TAO::Argument * const args[],
+ size_t nargs,
+ void * servant_upcall,
+ CORBA::TypeCode_ptr const * exceptions,
+ CORBA::ULong nexceptions
+ ACE_ENV_ARG_DECL) = 0;
+ //@}
+
+ /// Register an interceptor.
+ virtual void add_interceptor (
+ PortableInterceptor::ServerRequestInterceptor_ptr interceptor
+ ACE_ENV_ARG_DECL) = 0;
+
+ /// Register an interceptor with policies.
+ virtual void add_interceptor (
+ PortableInterceptor::ServerRequestInterceptor_ptr interceptor,
+ const CORBA::PolicyList& policies
+ ACE_ENV_ARG_DECL) = 0;
+
+ virtual void destroy_interceptors (ACE_ENV_SINGLE_ARG_DECL) = 0;
+
+ virtual TAO::PICurrent_Impl *allocate_pi_current (void) = 0;
+
+ virtual void deallocate_pi_current (
+ TAO::PICurrent_Impl *picurrent) = 0;
+
+ virtual void execute_command (
+ TAO_ServerRequest &server_request,
+ TAO::Upcall_Command &command
+ ACE_ENV_ARG_DECL) = 0;
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_SERVER_REQUEST_INTERCEPTOR_ADAPTER_H */
diff --git a/TAO/tao/ServerRequestInterceptor_Adapter_Factory.cpp b/TAO/tao/ServerRequestInterceptor_Adapter_Factory.cpp
new file mode 100644
index 00000000000..3408f8b97aa
--- /dev/null
+++ b/TAO/tao/ServerRequestInterceptor_Adapter_Factory.cpp
@@ -0,0 +1,14 @@
+#include "tao/ServerRequestInterceptor_Adapter_Factory.h"
+
+ACE_RCSID (tao,
+ ServerRequestInterceptorAdapterFactory,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_ServerRequestInterceptor_Adapter_Factory::~TAO_ServerRequestInterceptor_Adapter_Factory (void)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/ServerRequestInterceptor_Adapter_Factory.h b/TAO/tao/ServerRequestInterceptor_Adapter_Factory.h
new file mode 100644
index 00000000000..e97987173d6
--- /dev/null
+++ b/TAO/tao/ServerRequestInterceptor_Adapter_Factory.h
@@ -0,0 +1,52 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file ServerRequestInterceptor_Adapter_Factory.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+
+#ifndef TAO_SERVERREQUESTINTERCEPTOR_ADAPTER_FACTORY_H
+#define TAO_SERVERREQUESTINTERCEPTOR_ADAPTER_FACTORY_H
+
+#include /**/ "ace/pre.h"
+#include "ace/Service_Object.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/SystemException.h"
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ class ServerRequestInterceptor_Adapter;
+}
+
+/**
+ * @class TAO_ServerRequestInterceptor_Adapter_Factory
+ *
+ * @brief TAO_ServerRequestInterceptor_Adapter_Factory.
+ */
+class TAO_Export TAO_ServerRequestInterceptor_Adapter_Factory
+ : public ACE_Service_Object
+{
+public:
+ virtual ~TAO_ServerRequestInterceptor_Adapter_Factory (void);
+
+ virtual TAO::ServerRequestInterceptor_Adapter * create (void) = 0;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_SERVERREQUESTINTERCEPTOR_ADAPTER_FACTORY_H */
diff --git a/TAO/tao/Server_Strategy_Factory.cpp b/TAO/tao/Server_Strategy_Factory.cpp
new file mode 100644
index 00000000000..7b8c1f300c4
--- /dev/null
+++ b/TAO/tao/Server_Strategy_Factory.cpp
@@ -0,0 +1,78 @@
+// $Id$
+
+#include "tao/Server_Strategy_Factory.h"
+#include "tao/orbconf.h"
+
+ACE_RCSID (tao,
+ Server_Strategy_Factory,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Server_Strategy_Factory::TAO_Server_Strategy_Factory (void)
+ : active_object_map_creation_parameters_ ()
+{
+}
+
+TAO_Server_Strategy_Factory::~TAO_Server_Strategy_Factory(void)
+{
+}
+
+int
+TAO_Server_Strategy_Factory::open (TAO_ORB_Core*)
+{
+ return 0;
+}
+
+int
+TAO_Server_Strategy_Factory::enable_poa_locking (void)
+{
+ return -1;
+}
+
+int
+TAO_Server_Strategy_Factory::activate_server_connections (void)
+{
+ return 0;
+}
+
+int
+TAO_Server_Strategy_Factory::thread_per_connection_timeout (ACE_Time_Value &)
+{
+ return -1;
+}
+
+int
+TAO_Server_Strategy_Factory::server_connection_thread_flags (void)
+{
+ return 0;
+}
+
+int
+TAO_Server_Strategy_Factory::server_connection_thread_count (void)
+{
+ return 0;
+}
+
+const TAO_Server_Strategy_Factory::Active_Object_Map_Creation_Parameters &
+TAO_Server_Strategy_Factory::active_object_map_creation_parameters (void) const
+{
+ return this->active_object_map_creation_parameters_;
+}
+
+TAO_Server_Strategy_Factory::Active_Object_Map_Creation_Parameters::Active_Object_Map_Creation_Parameters (void)
+ : active_object_map_size_ (TAO_DEFAULT_SERVER_ACTIVE_OBJECT_MAP_SIZE),
+ object_lookup_strategy_for_user_id_policy_ (TAO_DYNAMIC_HASH),
+ object_lookup_strategy_for_system_id_policy_ (TAO_ACTIVE_DEMUX),
+ reverse_object_lookup_strategy_for_unique_id_policy_ (TAO_DYNAMIC_HASH),
+ use_active_hint_in_ids_ (1),
+ allow_reactivation_of_system_ids_ (1),
+ poa_map_size_ (TAO_DEFAULT_SERVER_POA_MAP_SIZE),
+ poa_lookup_strategy_for_transient_id_policy_ (TAO_ACTIVE_DEMUX),
+ poa_lookup_strategy_for_persistent_id_policy_ (TAO_DYNAMIC_HASH),
+ use_active_hint_in_poa_names_ (1)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Server_Strategy_Factory.h b/TAO/tao/Server_Strategy_Factory.h
new file mode 100644
index 00000000000..2e5fdc2800a
--- /dev/null
+++ b/TAO/tao/Server_Strategy_Factory.h
@@ -0,0 +1,137 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Server_Strategy_Factory.h
+ *
+ * $Id$
+ *
+ * @author Chris Cleeland
+ */
+//=============================================================================
+
+#ifndef TAO_SERVER_STRATEGY_FACTORY_H
+#define TAO_SERVER_STRATEGY_FACTORY_H
+
+#include /**/ "ace/pre.h"
+
+#include "ace/Service_Object.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/TAO_Export.h"
+#include "tao/Basic_Types.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_ORB_Core;
+
+enum TAO_Demux_Strategy
+{
+ TAO_LINEAR,
+ TAO_DYNAMIC_HASH,
+ TAO_ACTIVE_DEMUX,
+ TAO_USER_DEFINED
+};
+
+/**
+ * @class TAO_Server_Strategy_Factory
+ *
+ * @brief Base class for the server's abstract factory that manufactures
+ * various strategies of special utility to it. This simply
+ * serves as an interface to a subclass that REALLY gets
+ * specified and loaded by the Service Configurator.
+ */
+class TAO_Export TAO_Server_Strategy_Factory : public ACE_Service_Object
+{
+public:
+
+ struct Active_Object_Map_Creation_Parameters
+ {
+ /// Constructor.
+ Active_Object_Map_Creation_Parameters (void);
+
+ /// Default size of object lookup table.
+ CORBA::ULong active_object_map_size_;
+
+ /// The type of lookup/demultiplexing strategy being used for user
+ /// id policy
+ TAO_Demux_Strategy object_lookup_strategy_for_user_id_policy_;
+
+ /// The type of lookup/demultiplexing strategy being used for
+ /// system id policy
+ TAO_Demux_Strategy object_lookup_strategy_for_system_id_policy_;
+
+ /// The type of reverse lookup/demultiplexing strategy being used
+ /// for the UNIQUE_ID policy
+ TAO_Demux_Strategy reverse_object_lookup_strategy_for_unique_id_policy_;
+
+ /// Flag to indicate whether the active hint should be used with
+ /// the IOR.
+ int use_active_hint_in_ids_;
+
+ /// Flag to indicate whether reactivations of servants was required
+ /// (under the system id policy). If not, certain resources may
+ /// not be required.
+ int allow_reactivation_of_system_ids_;
+
+ CORBA::ULong poa_map_size_;
+
+ TAO_Demux_Strategy poa_lookup_strategy_for_transient_id_policy_;
+
+ TAO_Demux_Strategy poa_lookup_strategy_for_persistent_id_policy_;
+
+ int use_active_hint_in_poa_names_;
+ };
+
+ // = Initialization and termination methods.
+ /// Constructor.
+ TAO_Server_Strategy_Factory (void);
+
+ /// Destructor.
+ virtual ~TAO_Server_Strategy_Factory(void);
+
+ /**
+ * Call <open> on various strategies. This is not performed in
+ * <init> so that the other portions of the ORB have a chance to
+ * "settle" in their initialization since the streategies herein
+ * might need some of that information.
+ */
+ virtual int open (TAO_ORB_Core* orb_core);
+
+ /// Enable POA locking?
+ virtual int enable_poa_locking (void);
+
+ /// Are server connections active (i.e. run in their own thread)
+ virtual int activate_server_connections (void);
+
+ /**
+ * Obtain the timeout value used by the thread-per-connection server
+ * threads to poll the shutdown flag in the ORB.
+ * Return -1 if the ORB should use the compile-time defaults.
+ * If the return value is zero then the threads block without
+ * timeouts.
+ */
+ virtual int thread_per_connection_timeout (ACE_Time_Value &timeout);
+
+ /// The thread activation parameters
+ virtual int server_connection_thread_flags (void);
+ virtual int server_connection_thread_count (void);
+
+ /// Return the active object map creation parameters.
+ virtual
+ const Active_Object_Map_Creation_Parameters &
+ active_object_map_creation_parameters (void) const;
+
+protected:
+ /// Active object map creation parameters.
+ Active_Object_Map_Creation_Parameters active_object_map_creation_parameters_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_SERVER_STRATEGY_FACTORY_H */
diff --git a/TAO/tao/Service_Callbacks.cpp b/TAO/tao/Service_Callbacks.cpp
new file mode 100644
index 00000000000..0e9b89c9ff1
--- /dev/null
+++ b/TAO/tao/Service_Callbacks.cpp
@@ -0,0 +1,97 @@
+#include "tao/Service_Callbacks.h"
+#include "tao/ORB_Constants.h"
+#include "tao/SystemException.h"
+#include "tao/Environment.h"
+#include "tao/Invocation_Utils.h"
+
+ACE_RCSID (tao,
+ Service_Callbacks,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Service_Callbacks::~TAO_Service_Callbacks (void)
+{
+}
+
+CORBA::Boolean
+TAO_Service_Callbacks::select_profile (TAO_MProfile * /*mprofile*/,
+ TAO_Profile *& /*pfile*/)
+{
+ return false;
+}
+
+CORBA::Boolean
+TAO_Service_Callbacks::reselect_profile (TAO_Stub * /*stub*/,
+ TAO_Profile *& /*pfile*/)
+{
+ return false;
+}
+
+
+CORBA::Boolean
+TAO_Service_Callbacks::object_is_nil (CORBA::Object_ptr /* obj */)
+{
+ // We shouldn't be here at all. But in case if we are here,
+ // something is wrong. So, we send a true for a is_nil () call
+ return true;
+}
+
+void
+TAO_Service_Callbacks::reset_profile_flags (void)
+{
+ return;
+}
+
+
+TAO_Service_Callbacks::Profile_Equivalence
+TAO_Service_Callbacks::is_profile_equivalent (const TAO_Profile *,
+ const TAO_Profile *)
+{
+ return DONT_KNOW;
+}
+
+CORBA::ULong
+TAO_Service_Callbacks::hash_ft (TAO_Profile *,
+ CORBA::ULong )
+{
+ return 0;
+}
+
+CORBA::Boolean
+TAO_Service_Callbacks::is_permanent_forward_condition (const CORBA::Object_ptr,
+ const TAO_Service_Context &) const
+{
+ return false;
+}
+
+TAO::Invocation_Status
+TAO_Service_Callbacks::raise_comm_failure (
+ IOP::ServiceContextList &,
+ TAO_Profile * /*profile*/
+ ACE_ENV_ARG_DECL)
+{
+ ACE_THROW_RETURN (CORBA::COMM_FAILURE (
+ CORBA::SystemException::_tao_minor_code (
+ TAO_INVOCATION_RECV_REQUEST_MINOR_CODE,
+ -1),
+ CORBA::COMPLETED_MAYBE),
+ TAO::TAO_INVOKE_FAILURE);
+}
+
+TAO::Invocation_Status
+TAO_Service_Callbacks::raise_transient_failure (
+ IOP::ServiceContextList &,
+ TAO_Profile * /*profile*/
+ ACE_ENV_ARG_DECL)
+{
+ ACE_THROW_RETURN (CORBA::TRANSIENT (
+ CORBA::SystemException::_tao_minor_code (
+ TAO_INVOCATION_RECV_REQUEST_MINOR_CODE,
+ -1),
+ CORBA::COMPLETED_MAYBE),
+ TAO::TAO_INVOKE_FAILURE);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Service_Callbacks.h b/TAO/tao/Service_Callbacks.h
new file mode 100644
index 00000000000..935dda88764
--- /dev/null
+++ b/TAO/tao/Service_Callbacks.h
@@ -0,0 +1,128 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Service_Callbacks.h
+ *
+ * $Id$
+ *
+ * This is a generic interface that would be used to override many
+ * of the default functionalities that the ORB provides by the
+ * services if they have been loaded in to the ORB_Core
+ *
+ * @author Bala Natarajan <bala@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_SERVICE_CALLBACK_H
+#define TAO_SERVICE_CALLBACK_H
+
+#include /**/ "ace/pre.h"
+#include "ace/CORBA_macros.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/TAO_Export.h"
+#include "tao/Basic_Types.h"
+#include "tao/Invocation_Utils.h"
+#include "tao/Object.h"
+#include "tao/Service_Context.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Profile;
+class TAO_MProfile;
+class TAO_Stub;
+
+namespace CORBA
+{
+ class Object;
+ typedef Object *Object_ptr;
+
+ class Environment;
+}
+
+namespace IOP
+{
+ class ServiceContextList;
+}
+
+/**
+ * @class TAO_Service_Callbacks
+ *
+ * @brief An Abstract Base class for the hooks in the ORB.
+ *
+ * This class (would) define all the hooks that may be needed by
+ * the ORB to override some of its default behaviour. The methods
+ * can be potentially used to call service level specific
+ * processing that may be required.
+ */
+class TAO_Export TAO_Service_Callbacks
+{
+
+public:
+
+ enum Profile_Equivalence
+ {
+ EQUIVALENT,
+ NOT_EQUIVALENT,
+ DONT_KNOW
+ };
+
+
+ /// Dtor
+ virtual ~TAO_Service_Callbacks (void);
+
+ /// Select the profile from MProfile as the needs of the services
+ /// may be. Return the profile in <pfile>
+ virtual CORBA::Boolean select_profile (TAO_MProfile *mprofile,
+ TAO_Profile *&pfile);
+
+ /// Select the profile from MProfile as the needs of the services
+ /// may be. Return the profile in <pfile>
+ virtual CORBA::Boolean reselect_profile (TAO_Stub *stub,
+ TAO_Profile *&pfile);
+
+ /// Reset the profile flags that the services could have
+ virtual void reset_profile_flags (void);
+
+ /// Check whether <obj> is nil or not.
+ virtual CORBA::Boolean object_is_nil (CORBA::Object_ptr obj);
+
+
+ /// Check for equivalency of the two profiles
+ virtual Profile_Equivalence is_profile_equivalent (const TAO_Profile *,
+ const TAO_Profile *);
+
+ /// Calculate the hash value..
+ virtual CORBA::ULong hash_ft (TAO_Profile *p,
+ CORBA::ULong m);
+
+ // Verify if condition is given for LOCATION_FORWARD_PERM reply
+ virtual CORBA::Boolean is_permanent_forward_condition (const CORBA::Object_ptr obj,
+ const TAO_Service_Context &service_context) const;
+
+
+
+ /// Allow the service layer to decide whether the COMM_FAILURE
+ /// exception should be thrown or a reinvocation is needed
+ virtual TAO::Invocation_Status raise_comm_failure (
+ IOP::ServiceContextList &clist,
+ TAO_Profile *profile
+ ACE_ENV_ARG_DECL);
+
+ /// Allow the service layer to decide whether the TRANSIENT
+ /// exception should be thrown or a reinvocation is needed
+ virtual TAO::Invocation_Status raise_transient_failure (
+ IOP::ServiceContextList &clist,
+ TAO_Profile *profile
+ ACE_ENV_ARG_DECL);
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /*TAO_SERVICE_CALLBACK_H*/
diff --git a/TAO/tao/Service_Context.cpp b/TAO/tao/Service_Context.cpp
new file mode 100644
index 00000000000..78cc30595b6
--- /dev/null
+++ b/TAO/tao/Service_Context.cpp
@@ -0,0 +1,224 @@
+// $Id$
+
+#include "tao/Service_Context.h"
+#include "tao/CDR.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/Service_Context.inl"
+#endif /* ! __ACE_INLINE__ */
+
+#include "ace/OS_NS_string.h"
+
+ACE_RCSID (tao,
+ Service_Context,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+void
+TAO_Service_Context::set_context_i (IOP::ServiceId id,
+ TAO_OutputCDR &cdr)
+{
+ IOP::ServiceContext context;
+ context.context_id = id;
+
+ // Make a *copy* of the CDR stream...
+ size_t const length = cdr.total_length ();
+ context.context_data.length (static_cast<CORBA::ULong> (length));
+ CORBA::Octet *buf = context.context_data.get_buffer ();
+
+ for (const ACE_Message_Block *i = cdr.begin ();
+ i != 0;
+ i = i->cont ())
+ {
+ ACE_OS::memcpy (buf, i->rd_ptr (), i->length ());
+ buf += i->length ();
+ }
+
+ this->set_context_i (context);
+}
+
+void
+TAO_Service_Context::set_context_i (IOP::ServiceContext &context,
+ TAO_OutputCDR &cdr)
+{
+ // Make a *copy* of the CDR stream...
+ size_t const length = cdr.total_length ();
+ context.context_data.length (static_cast<CORBA::ULong> (length));
+ CORBA::Octet *buf = context.context_data.get_buffer ();
+
+ for (const ACE_Message_Block *i = cdr.begin ();
+ i != 0;
+ i = i->cont ())
+ {
+ ACE_OS::memcpy (buf, i->rd_ptr (), i->length ());
+ buf += i->length ();
+ }
+}
+
+void
+TAO_Service_Context::set_context (const IOP::ServiceContext &context)
+{
+ this->add_context_i (context);
+}
+
+int
+TAO_Service_Context::set_context (const IOP::ServiceContext &context,
+ CORBA::Boolean replace)
+{
+ for (CORBA::ULong i = 0; i != this->service_context_.length (); ++i)
+ {
+ if (context.context_id == this->service_context_[i].context_id)
+ {
+ if (replace)
+ {
+ this->service_context_[i] = context;
+ return 1;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+ }
+
+ this->add_context_i (context);
+ return 1;
+}
+
+void
+TAO_Service_Context::set_context (IOP::ServiceContext &context)
+{
+ this->add_context_i (context);
+}
+
+void
+TAO_Service_Context::set_context_i (const IOP::ServiceContext& context)
+{
+ // @@ TODO Some contexts can show up multiple times, others
+ // can't find out and take appropiate action.
+ for (CORBA::ULong i = 0; i != this->service_context_.length (); ++i)
+ {
+ if (context.context_id == this->service_context_[i].context_id)
+ {
+ this->service_context_[i] = context;
+ return;
+ }
+ }
+
+ this->add_context_i (context);
+}
+
+void
+TAO_Service_Context::set_context_i (IOP::ServiceContext& context)
+{
+ for (CORBA::ULong i = 0; i != this->service_context_.length (); ++i)
+ {
+ if (context.context_id == this->service_context_[i].context_id)
+ {
+ CORBA::ULong const max = context.context_data.maximum ();
+ CORBA::ULong const len = context.context_data.length ();
+ CORBA::Octet * const buf = context.context_data.get_buffer (1);
+ this->service_context_[i].context_data.replace (max, len, buf, 1);
+ return;
+ }
+ }
+
+ this->add_context_i (context);
+}
+
+void
+TAO_Service_Context::add_context_i (IOP::ServiceContext& context)
+{
+ // @@ TODO Some contexts can show up multiple times, others
+ // can't find out and take appropiate action.
+ CORBA::ULong const l = this->service_context_.length ();
+ this->service_context_.length (l + 1);
+ this->service_context_[l].context_id = context.context_id;
+ CORBA::ULong const max = context.context_data.maximum ();
+ CORBA::ULong const len = context.context_data.length ();
+ CORBA::Octet* const buf = context.context_data.get_buffer (1);
+ this->service_context_[l].context_data.replace (max, len, buf, 1);
+}
+
+void
+TAO_Service_Context::add_context_i (const IOP::ServiceContext& context)
+{
+ // @@ TODO Some contexts can show up multiple times, others
+ // can't find out and take appropiate action.
+ CORBA::ULong const l = this->service_context_.length ();
+ this->service_context_.length (l + 1);
+ this->service_context_[l] = context;
+}
+
+int
+TAO_Service_Context::get_context (IOP::ServiceContext& context) const
+{
+ for (CORBA::ULong i = 0; i != this->service_context_.length (); ++i)
+ {
+ if (context.context_id == this->service_context_[i].context_id)
+ {
+ context = this->service_context_[i];
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
+int
+TAO_Service_Context::get_context (IOP::ServiceId id,
+ const IOP::ServiceContext **context) const
+{
+ for (CORBA::ULong i = 0; i != this->service_context_.length (); ++i)
+ {
+ if (id == this->service_context_[i].context_id)
+ {
+ *context = &this->service_context_[i];
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
+int
+TAO_Service_Context::get_context (IOP::ServiceId id,
+ IOP::ServiceContext_out context)
+{
+ CORBA::ULong const len = this->service_context_.length ();
+
+ for (CORBA::ULong i = 0; i < len; ++i)
+ {
+ if (id == this->service_context_[i].context_id)
+ {
+ ACE_NEW_RETURN (context, IOP::ServiceContext, 0);
+
+ *(context.ptr ()) = this->service_context_[i];
+
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
+int
+TAO_Service_Context::encode (TAO_OutputCDR& cdr) const
+{
+ return (cdr << this->service_context_);
+}
+
+int
+TAO_Service_Context::decode (TAO_InputCDR& cdr)
+{
+ if ((cdr >> this->service_context_) == 0)
+ {
+ return 0;
+ }
+
+ return 1;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Service_Context.h b/TAO/tao/Service_Context.h
new file mode 100644
index 00000000000..dcf9cebbc4c
--- /dev/null
+++ b/TAO/tao/Service_Context.h
@@ -0,0 +1,161 @@
+// -*- C++ -*-
+
+// ===================================================================
+/**
+ * @file Service_Context.h
+ *
+ * $Id$
+ *
+ * @author Balachandran Natarajan <bala@cs.wustl.edu>
+ */
+// ===================================================================
+
+#ifndef TAO_SERVICE_CONTEXT_H
+#define TAO_SERVICE_CONTEXT_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/IOPC.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace CSD
+ {
+ class FW_Server_Request_Wrapper;
+ }
+}
+
+/**
+ * @class TAO_Service_Context
+ *
+ * @brief Helper class for managing the service context list
+ * information.
+ *
+ * This class is used to manipulate and access the service context
+ * list that is passed around with every GIOP request/reply. The
+ * definition of the service context list is simply a sequence of the
+ * following structures:
+ * typedef unsigned long ServiceId;
+ * struct ServiceContext
+ * {
+ * ServiceId context_id;
+ * sequence <octet> context_data;
+ * };
+ * typedef sequence <ServiceContext> ServiceContextList;
+ *
+ * the real motivation behind this class is to consolidate all the
+ * marshalling and unmarshalling information pertaining to service
+ * context list
+ *
+ * @note Somewhere down the line we may want to use this class for
+ * fast access to the info that we need from the Service Context
+ * List.
+ */
+class TAO_Export TAO_Service_Context
+{
+public:
+ /// Declare FW_Server_Request_Wrapper a friend
+ /// This friendship makes the FW_Server_Request_Wrapper be able to
+ /// clone the TAO_Service_Context data member in TAO_ServerRequest.
+ friend class TAO::CSD::FW_Server_Request_Wrapper;
+
+ /// Constructor
+ TAO_Service_Context (void);
+
+
+ /// = Generic components
+
+ /// Insert the component into the list, making a copy of the octet
+ /// sequence.
+ void set_context (const IOP::ServiceContext &context);
+
+ /// Insert the component into the list, making a copy of the octet
+ /// sequence. Search the list before insertion so that the
+ /// insertion does not cause a duplicate context to be in the list.
+ /// If the replace flag is true, update the specified context.
+ /// Return 0 if the component was present and the replace flag
+ /// was not set to true.
+ int set_context (const IOP::ServiceContext &context,
+ CORBA::Boolean replace);
+
+ /// Insert the component into the list, but efficiently stealing the
+ /// contents of the octet sequence.
+ void set_context (IOP::ServiceContext &context);
+
+ /// Get a copy of the context identified by <context.context_id>, return
+ /// 0 if the component is not present.
+ int get_context (IOP::ServiceContext &context) const;
+
+ /// Get a reference to a context identified by id, return
+ /// 0 if the component is not present.
+ int get_context (IOP::ServiceId id, const IOP::ServiceContext **context) const;
+
+ /// Get a copy of the Service Context corresponding to the given
+ /// ServiceId. The caller owns the returned Service Context.
+ /**
+ * @return 0 If a Service Context with the given ServiceId doesn't
+ * exist.
+ */
+ int get_context (IOP::ServiceId id, IOP::ServiceContext_out context);
+
+ /// Set the context from the CDR stream and add that to the service
+ /// Context list
+ void set_context (IOP::ServiceId id, TAO_OutputCDR &cdr);
+
+ /// Set the context from the CDR stream and return the context back
+ /// to the caller. *Does not* modify the underlying service context
+ /// list.
+ void set_context (IOP::ServiceContext &context, TAO_OutputCDR &cdr);
+
+ /// Is the <id> available in the underlying service context list? If
+ /// so return 1, else return 0
+ int is_service_id (IOP::ServiceId id);
+
+ /// = Marshaling and demarshaling the list
+ int encode (TAO_OutputCDR& cdr) const;
+ int decode (TAO_InputCDR& cdr);
+
+ /// Return the underlying service context list
+ IOP::ServiceContextList &service_info (void);
+ const IOP::ServiceContextList &service_info (void) const;
+
+ // @@ Note: The above method is only for backward comptiblity. We
+ // need to get this removed once RT folks have their service
+ // addition info done through this interface
+
+private:
+ /// Helper methods to implement set_context()
+ void set_context_i (const IOP::ServiceContext &context);
+ void set_context_i (IOP::ServiceContext &context);
+ void add_context_i (const IOP::ServiceContext &context);
+ void add_context_i (IOP::ServiceContext &context);
+ void set_context_i (IOP::ServiceId id, TAO_OutputCDR &cdr);
+ void set_context_i (IOP::ServiceContext &context, TAO_OutputCDR &cdr);
+
+ /// Helper methods to implement get_context()
+ int get_context_i (IOP::ServiceContext &context) const;
+
+ // Prevent copying
+ TAO_Service_Context (const TAO_Service_Context &);
+ TAO_Service_Context &operator= (const TAO_Service_Context &);
+
+private:
+ /// The ServiceContextList info.
+ IOP::ServiceContextList service_context_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/Service_Context.inl"
+#endif /* ! __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_SERVICE_CONTEXT_H */
diff --git a/TAO/tao/Service_Context.inl b/TAO/tao/Service_Context.inl
new file mode 100644
index 00000000000..1facf7680a7
--- /dev/null
+++ b/TAO/tao/Service_Context.inl
@@ -0,0 +1,57 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO_Service_Context::TAO_Service_Context (void)
+ : service_context_ ()
+{
+}
+
+ACE_INLINE IOP::ServiceContextList &
+TAO_Service_Context::service_info (void)
+{
+ return this->service_context_;
+}
+
+ACE_INLINE const IOP::ServiceContextList &
+TAO_Service_Context::service_info (void) const
+{
+ return this->service_context_;
+}
+
+
+ACE_INLINE void
+TAO_Service_Context::set_context (IOP::ServiceId id,
+ TAO_OutputCDR &cdr)
+{
+ this->set_context_i (id,
+ cdr);
+}
+
+ACE_INLINE void
+TAO_Service_Context::set_context (IOP::ServiceContext &context,
+ TAO_OutputCDR &cdr)
+{
+ this->set_context_i (context,
+ cdr);
+}
+
+ACE_INLINE int
+TAO_Service_Context::is_service_id (IOP::ServiceId id)
+{
+ for (CORBA::ULong i = 0;
+ i != this->service_context_.length ();
+ ++i)
+ {
+ if (id == this->service_context_[i].context_id)
+ {
+ return 1;
+ }
+ }
+ return 0;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Services.pidl b/TAO/tao/Services.pidl
new file mode 100644
index 00000000000..c855d525ca0
--- /dev/null
+++ b/TAO/tao/Services.pidl
@@ -0,0 +1,54 @@
+// -*- IDL -*-
+//
+// $Id$
+
+// ================================================================
+//
+// This file was used to generate the code in ServicesC.*
+// The command used to generate code is:
+//
+// tao_idl
+// -o orig -Ge 1 -GA -SS -Sci
+// -Wb,export_macro="tao/TAO_Export"
+// -Wb,pre_include="ace/pre.h"
+// -Wb,post_include="ace/post.h"
+// Services.pidl
+//
+// Patches for changes to the generated code are available in the
+// `diffs' directory.
+// ================================================================
+
+
+#ifndef TAO_CORBA_SERVICES_IDL
+#define TAO_CORBA_SERVICES_IDL
+
+#include "tao/OctetSeq.pidl"
+
+#pragma prefix "omg.org"
+
+module CORBA
+{
+ typedef unsigned short ServiceType;
+ typedef unsigned long ServiceOption;
+ typedef unsigned long ServiceDetailType;
+ typedef OctetSeq ServiceDetailData;
+ typedef sequence<ServiceOption> ServiceOptionSeq;
+
+ const ServiceType Security = 1;
+
+ struct ServiceDetail
+ {
+ ServiceDetailType service_detail_type;
+ ServiceDetailData service_detail;
+ };
+
+ typedef sequence<ServiceDetail> ServiceDetailSeq;
+
+ struct ServiceInformation
+ {
+ ServiceOptionSeq service_options;
+ ServiceDetailSeq service_details;
+ };
+};
+
+#endif /* TAO_CORBA_SERVICES_IDL */
diff --git a/TAO/tao/Services_Activate.cpp b/TAO/tao/Services_Activate.cpp
new file mode 100644
index 00000000000..22944bd9430
--- /dev/null
+++ b/TAO/tao/Services_Activate.cpp
@@ -0,0 +1,13 @@
+#include "tao/Services_Activate.h"
+
+ACE_RCSID (tao,
+ Services_Activate,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Services_Activate::~TAO_Services_Activate (void)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Services_Activate.h b/TAO/tao/Services_Activate.h
new file mode 100644
index 00000000000..d1e1905d8f6
--- /dev/null
+++ b/TAO/tao/Services_Activate.h
@@ -0,0 +1,64 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Services_Activate.h
+ *
+ * $Id$
+ *
+ * This is a generic interface that would be used to activate
+ * the services that are loaded through the svc.conf file
+ *
+ * @author Bala Natarajan <bala@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_SERVICES_ACTIVATE_H
+#define TAO_SERVICES_ACTIVATE_H
+
+#include /**/ "ace/pre.h"
+#include "ace/Service_Object.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/SystemException.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_ORB_Core;
+class TAO_Service_Callbacks;
+
+/**
+ * @class TAO_Services_Activate
+ *
+ * @brief A class to dynamically load callback implementations in to an
+ * ORB.
+ *
+ * Many services and components of the ORB whose default behaviour
+ * needs to be changed can use this class to activate the Callback
+ * hooks. These hooks can then be called by the ORB at the right
+ * points.
+ * @@ TODO
+ */
+class TAO_Export TAO_Services_Activate : public ACE_Service_Object
+{
+public:
+ /// The destructor
+ virtual ~TAO_Services_Activate (void);
+
+ /**
+ * Create and activate the service callbacks into the orb.
+ * This method cannot throw any exception, but it can return a nil
+ * object to indicate an error condition.
+ */
+ virtual TAO_Service_Callbacks* activate_services (TAO_ORB_Core *orb)
+ ACE_THROW_SPEC ((CORBA::SystemException)) = 0;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /*TAO_SERVICES_ACTIVATE_H*/
diff --git a/TAO/tao/ShortSeq.pidl b/TAO/tao/ShortSeq.pidl
new file mode 100644
index 00000000000..cef83a5f810
--- /dev/null
+++ b/TAO/tao/ShortSeq.pidl
@@ -0,0 +1,32 @@
+// -*- IDL -*-
+//
+// $Id$
+
+// ================================================================
+/**
+ * This file was used to generate the code in ShortSeq*.*
+ * The command used to generate code is:
+ *
+ * tao_idl
+ * -o orig -Ge 1 -GA -SS -Sci
+ * -Wb,export_macro=TAO_Export
+ * -Wb,pre_include="ace/pre.h"
+ * -Wb,post_include="ace/post.h"
+ * ShortSeq.pidl
+ *
+ * Patches for changes to the generated code are available in the
+ * `diffs' directory.
+ */
+// ================================================================
+
+#ifndef TAO_CORBA_SHORT_SEQ_IDL
+#define TAO_CORBA_SHORT_SEQ_IDL
+
+#pragma prefix "omg.org"
+
+module CORBA
+{
+ typedef sequence<short> ShortSeq;
+};
+
+#endif /* TAO_CORBA_SHORT_SEQ_IDL */
diff --git a/TAO/tao/SmartProxies.mpc b/TAO/tao/SmartProxies.mpc
new file mode 100644
index 00000000000..bf0850d9fe7
--- /dev/null
+++ b/TAO/tao/SmartProxies.mpc
@@ -0,0 +1,35 @@
+//$Id$
+project : taolib, core, tao_versioning_idl_defaults {
+ sharedname = TAO_SmartProxies
+ dynamicflags = TAO_SMARTPROXIES_BUILD_DLL
+
+ Source_Files {
+ SmartProxies
+ }
+
+ Header_Files {
+ SmartProxies
+ }
+
+ Inline_Files {
+ SmartProxies
+ }
+
+ Template_Files {
+ SmartProxies
+ }
+
+ Resource_Files {
+ SmartProxies
+ }
+
+ PIDL_Files {
+ }
+
+ IDL_Files {
+ }
+
+ Pkgconfig_Files {
+ SmartProxies/TAO_SmartProxies.pc.in
+ }
+}
diff --git a/TAO/tao/SmartProxies/SmartProxies.rc b/TAO/tao/SmartProxies/SmartProxies.rc
new file mode 100644
index 00000000000..2c2665118ef
--- /dev/null
+++ b/TAO/tao/SmartProxies/SmartProxies.rc
@@ -0,0 +1,30 @@
+#include "..\Version.h"
+
+1 VERSIONINFO
+ FILEVERSION TAO_MAJOR_VERSION,TAO_MINOR_VERSION,TAO_BETA_VERSION,0
+ PRODUCTVERSION TAO_MAJOR_VERSION,TAO_MINOR_VERSION,TAO_BETA_VERSION,0
+ FILEFLAGSMASK 0x3fL
+ FILEFLAGS 0x0L
+ FILEOS 0x4L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904B0"
+ BEGIN
+ VALUE "FileDescription", "SmartProxies\0"
+ VALUE "FileVersion", TAO_VERSION "\0"
+ VALUE "InternalName", "TAO_SmartProxiesDLL\0"
+ VALUE "LegalCopyright", "\0"
+ VALUE "LegalTrademarks", "\0"
+ VALUE "OriginalFilename", "TAO_SmartProxies.DLL\0"
+ VALUE "ProductName", "TAO\0"
+ VALUE "ProductVersion", TAO_VERSION "\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
diff --git a/TAO/tao/SmartProxies/Smart_Proxies.cpp b/TAO/tao/SmartProxies/Smart_Proxies.cpp
new file mode 100644
index 00000000000..10707265d59
--- /dev/null
+++ b/TAO/tao/SmartProxies/Smart_Proxies.cpp
@@ -0,0 +1,16 @@
+// $Id$
+
+#include "tao/SmartProxies/Smart_Proxies.h"
+
+ACE_RCSID(SmartProxies, Smart_Proxies, "$Id$")
+
+#if !defined (__ACE_INLINE__)
+#include "tao/SmartProxies/Smart_Proxies.inl"
+#endif /* defined INLINE */
+
+// Add this line to please the AIX linker, otherwise it complains
+// "ld: 0711-244 ERROR: No csects or exported symbols have been saved."
+
+#if defined (ACE_NDEBUG) && defined (AIX)
+int the_bogus_value_to_please_linker_to_export_symbol;
+#endif
diff --git a/TAO/tao/SmartProxies/Smart_Proxies.h b/TAO/tao/SmartProxies/Smart_Proxies.h
new file mode 100644
index 00000000000..204702f7ec9
--- /dev/null
+++ b/TAO/tao/SmartProxies/Smart_Proxies.h
@@ -0,0 +1,63 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Smart_Proxies.h
+ *
+ * $Id$
+ *
+ * This file contains a base class for the generated smart proxy classes
+ * It's purpose is to hold the pointer to the real proxy
+ *
+ * @author Brian Wallis <brian.wallis@ot.com.au>
+ */
+//=============================================================================
+
+#ifndef TAO_SMARTPROXIES_H
+#define TAO_SMARTPROXIES_H
+#include /**/ "ace/pre.h"
+
+#include "tao/SmartProxies/smartproxies_export.h"
+#include "tao/Object.h"
+#include "tao/TAO_Singleton.h"
+#include "tao/LocalObject.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_Smart_Proxy_Base
+ *
+ * @brief A base class for all TAO_IDL generated smart proxy base classes.
+ *
+ * Contains the _var pointer to the real proxy.
+ */
+class TAO_SmartProxies_Export TAO_Smart_Proxy_Base
+ : public TAO_Local_RefCounted_Object
+{
+public:
+ /// Destructor
+ virtual ~TAO_Smart_Proxy_Base (void);
+
+protected:
+ /// Constructor.
+ TAO_Smart_Proxy_Base (void);
+
+ /// Constructor.
+ TAO_Smart_Proxy_Base (CORBA::Object_ptr proxy);
+
+ /// The proxy to which remote/collocated calls are made.
+ CORBA::Object_var base_proxy_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+#include "tao/SmartProxies/Smart_Proxies.inl"
+#endif /* defined INLINE */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_SMARTPROXIES_H */
diff --git a/TAO/tao/SmartProxies/Smart_Proxies.inl b/TAO/tao/SmartProxies/Smart_Proxies.inl
new file mode 100644
index 00000000000..232cacd0f34
--- /dev/null
+++ b/TAO/tao/SmartProxies/Smart_Proxies.inl
@@ -0,0 +1,23 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO_Smart_Proxy_Base::TAO_Smart_Proxy_Base (void)
+{
+}
+
+ACE_INLINE
+TAO_Smart_Proxy_Base::TAO_Smart_Proxy_Base (CORBA::Object_ptr proxy)
+ : base_proxy_(proxy)
+{
+}
+
+ACE_INLINE
+TAO_Smart_Proxy_Base::~TAO_Smart_Proxy_Base (void)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/SmartProxies/TAO_SmartProxies.pc.in b/TAO/tao/SmartProxies/TAO_SmartProxies.pc.in
new file mode 100644
index 00000000000..59c34f50735
--- /dev/null
+++ b/TAO/tao/SmartProxies/TAO_SmartProxies.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: TAO_SmartProxies
+Description: TAO Smart Proxies Library
+Requires: TAO
+Version: @VERSION@
+Libs: -L${libdir} -lTAO_SmartProxies
+Cflags: -I${includedir}
diff --git a/TAO/tao/SmartProxies/smartproxies_export.h b/TAO/tao/SmartProxies/smartproxies_export.h
new file mode 100644
index 00000000000..62fb3430f21
--- /dev/null
+++ b/TAO/tao/SmartProxies/smartproxies_export.h
@@ -0,0 +1,40 @@
+
+// -*- C++ -*-
+// $Id$
+// Definition for Win32 Export directives.
+// This file is generated automatically by generate_export_file.pl
+// ------------------------------
+#ifndef TAO_SMARTPROXIES_EXPORT_H
+#define TAO_SMARTPROXIES_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if defined (TAO_AS_STATIC_LIBS)
+# if !defined (TAO_SMARTPROXIES_HAS_DLL)
+# define TAO_SMARTPROXIES_HAS_DLL 0
+# endif /* ! TAO_SMARTPROXIES_HAS_DLL */
+#else
+# if !defined (TAO_SMARTPROXIES_HAS_DLL)
+# define TAO_SMARTPROXIES_HAS_DLL 1
+# endif /* ! TAO_SMARTPROXIES_HAS_DLL */
+#endif
+
+#if defined (TAO_SMARTPROXIES_HAS_DLL) && (TAO_SMARTPROXIES_HAS_DLL == 1)
+# if defined (TAO_SMARTPROXIES_BUILD_DLL)
+# define TAO_SmartProxies_Export ACE_Proper_Export_Flag
+# define TAO_SMARTPROXIES_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# define TAO_SMARTPROXIES_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# else /* TAO_SMARTPROXIES_BUILD_DLL */
+# define TAO_SmartProxies_Export ACE_Proper_Import_Flag
+# define TAO_SMARTPROXIES_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# define TAO_SMARTPROXIES_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# endif /* TAO_SMARTPROXIES_BUILD_DLL */
+#else /* TAO_SMARTPROXIES_HAS_DLL == 1 */
+# define TAO_SmartProxies_Export
+# define TAO_SMARTPROXIES_SINGLETON_DECLARATION(T)
+# define TAO_SMARTPROXIES_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+#endif /* TAO_SMARTPROXIES_HAS_DLL == 1 */
+
+#endif /* TAO_SMARTPROXIES_EXPORT_H */
+
+// End of auto generated file.
diff --git a/TAO/tao/Special_Basic_Argument_T.cpp b/TAO/tao/Special_Basic_Argument_T.cpp
new file mode 100644
index 00000000000..0f12d085957
--- /dev/null
+++ b/TAO/tao/Special_Basic_Argument_T.cpp
@@ -0,0 +1,141 @@
+// $Id$
+
+#ifndef TAO_SPECIAL_BASIC_ARGUMENT_T_CPP
+#define TAO_SPECIAL_BASIC_ARGUMENT_T_CPP
+
+#include "tao/Special_Basic_Argument_T.h"
+#include "tao/CDR.h"
+
+#if !defined (__ACE_INLINE__)
+#include "tao/Special_Basic_Argument_T.inl"
+#endif /* __ACE_INLINE__ */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template<typename S,
+ typename to_S,
+ typename from_S,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::In_Special_Basic_Argument_T<S,to_S,from_S,Insert_Policy>::marshal (TAO_OutputCDR &cdr)
+{
+ return cdr << from_S (this->x_);
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S,
+ typename to_S,
+ typename from_S,
+ class Insert_Policy>
+void
+TAO::In_Special_Basic_Argument_T<S,to_S,from_S,Insert_Policy>::interceptor_value (
+ CORBA::Any *any) const
+{
+ Insert_Policy::any_insert (any, from_S (this->x_));
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+// ===========================================================
+
+template<typename S,
+ typename to_S,
+ typename from_S,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::Inout_Special_Basic_Argument_T<S,to_S,from_S,Insert_Policy>::marshal (
+ TAO_OutputCDR & cdr)
+{
+ return cdr << from_S (this->x_);
+}
+
+template<typename S,
+ typename to_S,
+ typename from_S,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::Inout_Special_Basic_Argument_T<S,to_S,from_S,Insert_Policy>::demarshal (
+ TAO_InputCDR & cdr
+ )
+{
+ return cdr >> to_S (this->x_);
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S,
+ typename to_S,
+ typename from_S,
+ class Insert_Policy>
+void
+TAO::Inout_Special_Basic_Argument_T<S,to_S,from_S,Insert_Policy>::interceptor_value (
+ CORBA::Any *any) const
+{
+ Insert_Policy::any_insert (any, from_S (this->x_));
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+// ==============================================================
+
+template<typename S,
+ typename to_S,
+ typename from_S,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::Out_Special_Basic_Argument_T<S,to_S,from_S,Insert_Policy>::demarshal (
+ TAO_InputCDR & cdr
+ )
+{
+ return cdr >> to_S (this->x_);
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S,
+ typename to_S,
+ typename from_S,
+ class Insert_Policy>
+void
+TAO::Out_Special_Basic_Argument_T<S,to_S,from_S,Insert_Policy>::interceptor_value (
+ CORBA::Any *any) const
+{
+ Insert_Policy::any_insert (any, from_S (this->x_));
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+// ============================================================
+
+template<typename S,
+ typename to_S,
+ typename from_S,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::Ret_Special_Basic_Argument_T<S,to_S,from_S,Insert_Policy>::demarshal (
+ TAO_InputCDR & cdr
+ )
+{
+ return cdr >> to_S (this->x_);
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S,
+ typename to_S,
+ typename from_S,
+ class Insert_Policy>
+void
+TAO::Ret_Special_Basic_Argument_T<S,to_S,from_S,Insert_Policy>::interceptor_value (
+ CORBA::Any *any) const
+{
+ Insert_Policy::any_insert (any, from_S (this->x_));
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_SPECIAL_BASIC_ARGUMENT_T_CPP */
+
diff --git a/TAO/tao/Special_Basic_Argument_T.h b/TAO/tao/Special_Basic_Argument_T.h
new file mode 100644
index 00000000000..e793035ba24
--- /dev/null
+++ b/TAO/tao/Special_Basic_Argument_T.h
@@ -0,0 +1,184 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Special_Basic_Argument_T.h
+ *
+ * $Id$
+ *
+ * @authors Jeff Parsons and Carlos O'Ryan
+ */
+//=============================================================================
+
+
+#ifndef TAO_SPECIAL_BASIC_ARGUMENT_T_H
+#define TAO_SPECIAL_BASIC_ARGUMENT_T_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Argument.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ /**
+ * @class In_Special_Basic_Argument_T
+ *
+ * @brief Template class for IN stub argument of (w)char/boolean/octet.
+ *
+ */
+ template<typename S,
+ typename to_S,
+ typename from_S,
+ class Insert_Policy>
+ class In_Special_Basic_Argument_T : public InArgument
+ {
+ public:
+ In_Special_Basic_Argument_T (S const &);
+
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ S const & arg (void) const;
+
+ private:
+ S const & x_;
+ };
+
+ /**
+ * @class Inout_Special_Basic_Argument_T
+ *
+ * @brief Template class for INOUT stub argument of (w)char/boolean/octet.
+ *
+ */
+ template<typename S,
+ typename to_S,
+ typename from_S,
+ class Insert_Policy>
+ class Inout_Special_Basic_Argument_T : public InoutArgument
+ {
+ public:
+ Inout_Special_Basic_Argument_T (S & x);
+
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+ virtual CORBA::Boolean demarshal (TAO_InputCDR &);
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ S & arg (void);
+
+ private:
+ S & x_;
+ };
+
+ /**
+ * @class Out_Special_Basic_Argument_T
+ *
+ * @brief Template class for OUT stub argument of (w)char/boolean/octet.
+ *
+ */
+ template<typename S,
+ typename to_S,
+ typename from_S,
+ class Insert_Policy>
+ class Out_Special_Basic_Argument_T : public OutArgument
+ {
+ public:
+ Out_Special_Basic_Argument_T (S & x);
+
+ virtual CORBA::Boolean demarshal (TAO_InputCDR &);
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ S & arg (void);
+
+ private:
+ S & x_;
+ };
+
+ /**
+ * @class Ret_Basic_Argument_T
+ *
+ * @brief Template class for return stub value of (w)char/boolean/octet.
+ *
+ */
+ template<typename S,
+ typename to_S,
+ typename from_S,
+ class Insert_Policy>
+ class Ret_Special_Basic_Argument_T : public RetArgument
+ {
+ public:
+ Ret_Special_Basic_Argument_T (void);
+
+ virtual CORBA::Boolean demarshal (TAO_InputCDR &);
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ S & arg (void);
+
+ S excp (void);
+ S retn (void);
+
+ private:
+ S x_;
+ };
+
+ /**
+ * @struct Special_Basic_Tag
+ *
+ * @brief Struct for basic IDL type arguments id tag.
+ *
+ */
+ struct TAO_Export Special_Basic_Tag {};
+
+ /**
+ * @struct Special_Basic_Arg_Traits_T
+ *
+ * @brief Template class for stub argument traits of (w)char/boolean/octet.
+ *
+ */
+ template<typename T,
+ typename to_T,
+ typename from_T,
+ class Insert_Policy>
+ struct Special_Basic_Arg_Traits_T
+ {
+ typedef T ret_type;
+ typedef T in_type;
+ typedef T & inout_type;
+ typedef T & out_type;
+
+ typedef In_Special_Basic_Argument_T<T,to_T,from_T,Insert_Policy> in_arg_val;
+ typedef Inout_Special_Basic_Argument_T<T,to_T,from_T,Insert_Policy> inout_arg_val;
+ typedef Out_Special_Basic_Argument_T<T,to_T,from_T,Insert_Policy> out_arg_val;
+ typedef Ret_Special_Basic_Argument_T<T,to_T,from_T,Insert_Policy> ret_val;
+
+ typedef Special_Basic_Tag idl_tag;
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+#include "tao/Special_Basic_Argument_T.inl"
+#endif /* __ACE_INLINE__ */
+
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+#include "tao/Special_Basic_Argument_T.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
+#pragma implementation ("Special_Basic_Argument_T.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_SPECIAL_BASIC_ARGUMENT_T_H */
diff --git a/TAO/tao/Special_Basic_Argument_T.inl b/TAO/tao/Special_Basic_Argument_T.inl
new file mode 100644
index 00000000000..869f232897b
--- /dev/null
+++ b/TAO/tao/Special_Basic_Argument_T.inl
@@ -0,0 +1,120 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template<typename S,
+ typename to_S,
+ typename from_S,
+ class Insert_Policy>
+ACE_INLINE
+TAO::In_Special_Basic_Argument_T<S,to_S,from_S,Insert_Policy>::In_Special_Basic_Argument_T (
+ S const & x
+ )
+ : x_ (x)
+{}
+
+template<typename S,
+ typename to_S,
+ typename from_S,
+ class Insert_Policy>
+ACE_INLINE
+S const &
+TAO::In_Special_Basic_Argument_T<S,to_S,from_S,Insert_Policy>::arg (void) const
+{
+ return this->x_;
+}
+
+// ===========================================================================
+
+template<typename S,
+ typename to_S,
+ typename from_S,
+ class Insert_Policy>
+ACE_INLINE
+TAO::Inout_Special_Basic_Argument_T<S,to_S,from_S,Insert_Policy>::
+Inout_Special_Basic_Argument_T (S & x)
+ : x_ (x)
+{}
+
+template<typename S,
+ typename to_S,
+ typename from_S,
+ class Insert_Policy>
+ACE_INLINE
+S &
+TAO::Inout_Special_Basic_Argument_T<S,to_S,from_S,Insert_Policy>::arg (void)
+{
+ return this->x_;
+}
+
+// ===========================================================================
+
+template<typename S,
+ typename to_S,
+ typename from_S,
+ class Insert_Policy>
+ACE_INLINE
+TAO::Out_Special_Basic_Argument_T<S,to_S,from_S,Insert_Policy>::
+Out_Special_Basic_Argument_T (S & x)
+ : x_ (x)
+{}
+
+template<typename S,
+ typename to_S,
+ typename from_S,
+ class Insert_Policy>
+ACE_INLINE
+S &
+TAO::Out_Special_Basic_Argument_T<S,to_S,from_S,Insert_Policy>::arg (void)
+{
+ return this->x_;
+}
+
+// ===========================================================================
+
+template<typename S,
+ typename to_S,
+ typename from_S,
+ class Insert_Policy>
+ACE_INLINE
+TAO::Ret_Special_Basic_Argument_T<S,to_S,from_S,Insert_Policy>::
+Ret_Special_Basic_Argument_T (void)
+{
+}
+
+template<typename S,
+ typename to_S,
+ typename from_S,
+ class Insert_Policy>
+ACE_INLINE
+S &
+TAO::Ret_Special_Basic_Argument_T<S,to_S,from_S,Insert_Policy>::arg (void)
+{
+ return this->x_;
+}
+
+template<typename S,
+ typename to_S,
+ typename from_S,
+ class Insert_Policy>
+ACE_INLINE
+S
+TAO::Ret_Special_Basic_Argument_T<S,to_S,from_S,Insert_Policy>::excp (void)
+{
+ return this->x_;
+}
+
+template<typename S,
+ typename to_S,
+ typename from_S,
+ class Insert_Policy>
+ACE_INLINE
+S
+TAO::Ret_Special_Basic_Argument_T<S,to_S,from_S,Insert_Policy>::retn (void)
+{
+ return this->x_;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Special_Basic_Arguments.h b/TAO/tao/Special_Basic_Arguments.h
new file mode 100644
index 00000000000..ff938db4b58
--- /dev/null
+++ b/TAO/tao/Special_Basic_Arguments.h
@@ -0,0 +1,80 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Special_Basic_Arguments.h
+ *
+ * $Id$
+ *
+ * @author Jeff Parsons
+ * @author Carlos O'Ryan
+ */
+//=============================================================================
+
+
+#ifndef TAO_SPECIAL_BASIC_ARGUMENTS_H
+#define TAO_SPECIAL_BASIC_ARGUMENTS_H
+
+#include /**/ "ace/pre.h"
+
+#include "ace/CDR_Stream.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Special_Basic_Argument_T.h"
+#include "tao/Arg_Traits_T.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ /**
+ *
+ * @brief Specializations for (w)char, octet and boolean.
+ *
+ */
+
+ template<>
+ class TAO_Export Arg_Traits<ACE_InputCDR::to_char>
+ : public Special_Basic_Arg_Traits_T<CORBA::Char,
+ ACE_InputCDR::to_char,
+ ACE_OutputCDR::from_char,
+ TAO::Any_Insert_Policy_AnyTypeCode_Adapter <ACE_OutputCDR::from_char> >
+ {
+ };
+
+ template<>
+ class TAO_Export Arg_Traits<ACE_InputCDR::to_wchar>
+ : public Special_Basic_Arg_Traits_T<CORBA::WChar,
+ ACE_InputCDR::to_wchar,
+ ACE_OutputCDR::from_wchar,
+ TAO::Any_Insert_Policy_AnyTypeCode_Adapter <ACE_OutputCDR::from_wchar> >
+ {
+ };
+
+ template<>
+ class TAO_Export Arg_Traits<ACE_InputCDR::to_octet>
+ : public Special_Basic_Arg_Traits_T<CORBA::Octet,
+ ACE_InputCDR::to_octet,
+ ACE_OutputCDR::from_octet,
+ TAO::Any_Insert_Policy_AnyTypeCode_Adapter <ACE_OutputCDR::from_octet> >
+ {
+ };
+
+ template<>
+ class TAO_Export Arg_Traits<ACE_InputCDR::to_boolean>
+ : public Special_Basic_Arg_Traits_T<CORBA::Boolean,
+ ACE_InputCDR::to_boolean,
+ ACE_OutputCDR::from_boolean,
+ TAO::Any_Insert_Policy_AnyTypeCode_Adapter <ACE_OutputCDR::from_boolean> >
+ {
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/"ace/post.h"
+
+#endif /* TAO_SPECIAL_BASIC_ARGUMENTS_H */
diff --git a/TAO/tao/Strategies.mpc b/TAO/tao/Strategies.mpc
new file mode 100644
index 00000000000..28964b876b4
--- /dev/null
+++ b/TAO/tao/Strategies.mpc
@@ -0,0 +1,45 @@
+//$Id$
+
+project : taolib, core, core_anytypecode, tao_versioning_idl_defaults {
+ avoids += ace_for_tao // Requires Unix domain sockets and MEM stuff
+ sharedname = TAO_Strategies
+ dynamicflags = TAO_STRATEGIES_BUILD_DLL
+
+ Source_Files {
+ Strategies
+ }
+
+ Header_Files {
+ Strategies
+ }
+
+ Inline_Files {
+ Strategies
+ }
+
+ Template_Files {
+ Strategies
+ }
+
+ Resource_Files {
+ Strategies
+ }
+
+ PIDL_Files {
+ Strategies
+ }
+
+ IDL_Files {
+ idlflags += -Sci -SS -Gp -Gd -Ge 1 -Sc -Sorb -DCORBA3 \
+ -Wb,export_macro=TAO_Strategies_Export \
+ -Wb,export_include=tao/Strategies/strategies_export.h \
+ -o Strategies
+ idlflags -= -St
+ Strategies/uiop_endpoints.pidl
+ Strategies/sciop_endpoints.pidl
+ }
+
+ Pkgconfig_Files {
+ Strategies/TAO_Strategies.pc.in
+ }
+}
diff --git a/TAO/tao/Strategies/DIOP_Acceptor.cpp b/TAO/tao/Strategies/DIOP_Acceptor.cpp
new file mode 100644
index 00000000000..4944c37f3d5
--- /dev/null
+++ b/TAO/tao/Strategies/DIOP_Acceptor.cpp
@@ -0,0 +1,763 @@
+// This may look like C, but it's really -*- C++ -*-
+// $Id$
+
+#include "tao/Strategies/DIOP_Acceptor.h"
+
+#if defined (TAO_HAS_DIOP) && (TAO_HAS_DIOP != 0)
+
+#include "tao/Strategies/DIOP_Profile.h"
+#include "tao/MProfile.h"
+#include "tao/ORB_Core.h"
+#include "tao/debug.h"
+#include "tao/Protocols_Hooks.h"
+#include "tao/Codeset_Manager.h"
+#include "tao/CDR.h"
+
+#include "ace/Auto_Ptr.h"
+#include "ace/OS_NS_string.h"
+
+#if !defined(__ACE_INLINE__)
+#include "tao/Strategies/DIOP_Acceptor.i"
+#endif /* __ACE_INLINE__ */
+
+#include "ace/os_include/os_netdb.h"
+
+ACE_RCSID (Strategies,
+ DIOP_Acceptor,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_DIOP_Acceptor::TAO_DIOP_Acceptor (CORBA::Boolean flag)
+ : TAO_Acceptor (TAO_TAG_DIOP_PROFILE),
+ addrs_ (0),
+ hosts_ (0),
+ endpoint_count_ (0),
+ version_ (TAO_DEF_GIOP_MAJOR, TAO_DEF_GIOP_MINOR),
+ orb_core_ (0),
+ lite_flag_ (flag),
+ connection_handler_ (0)
+{
+}
+
+TAO_DIOP_Acceptor::~TAO_DIOP_Acceptor (void)
+{
+ // Make sure we are closed before we start destroying the
+ // strategies.
+ this->close ();
+
+ delete [] this->addrs_;
+
+ for (size_t i = 0; i < this->endpoint_count_; ++i)
+ CORBA::string_free (this->hosts_[i]);
+
+ delete [] this->hosts_;
+}
+
+// TODO =
+// 2) For V1.[1,2] there are tagged components
+
+int
+TAO_DIOP_Acceptor::create_profile (const TAO::ObjectKey & object_key,
+ TAO_MProfile &mprofile,
+ CORBA::Short priority)
+{
+ // Sanity check.
+ if (this->endpoint_count_ == 0)
+ return -1;
+
+ // Check if multiple endpoints should be put in one profile or if
+ // they should be spread across multiple profiles.
+ if (priority == TAO_INVALID_PRIORITY)
+ return this->create_new_profile (object_key,
+ mprofile,
+ priority);
+ else
+ return this->create_shared_profile (object_key,
+ mprofile,
+ priority);
+}
+
+int
+TAO_DIOP_Acceptor::create_new_profile (const TAO::ObjectKey &object_key,
+ TAO_MProfile &mprofile,
+ CORBA::Short priority)
+{
+ // Adding this->endpoint_count_ to the TAO_MProfile.
+ int const count = mprofile.profile_count ();
+ if ((mprofile.size () - count) < this->endpoint_count_
+ && mprofile.grow (count + this->endpoint_count_) == -1)
+ return -1;
+
+ // Create a profile for each acceptor endpoint.
+ for (size_t i = 0; i < this->endpoint_count_; ++i)
+ {
+ TAO_DIOP_Profile *pfile = 0;
+ ACE_NEW_RETURN (pfile,
+ TAO_DIOP_Profile (this->hosts_[i],
+ this->addrs_[i].get_port_number (),
+ object_key,
+ this->addrs_[i],
+ this->version_,
+ this->orb_core_),
+ -1);
+ pfile->endpoint ()->priority (priority);
+
+ if (mprofile.give_profile (pfile) == -1)
+ {
+ pfile->_decr_refcnt ();
+ pfile = 0;
+ return -1;
+ }
+
+ // Do not add any tagged components to the profile if configured
+ // by the user not to do so, or if an IIOP 1.0 endpoint is being
+ // created (IIOP 1.0 did not support tagged components).
+ if (this->orb_core_->orb_params ()->std_profile_components () == 0
+ || (this->version_.major == 1 && this->version_.minor == 0))
+ continue;
+
+ pfile->tagged_components ().set_orb_type (TAO_ORB_TYPE);
+
+ TAO_Codeset_Manager *csm = this->orb_core_->codeset_manager();
+ if (csm)
+ csm->set_codeset(pfile->tagged_components());
+ }
+
+ return 0;
+}
+
+int
+TAO_DIOP_Acceptor::create_shared_profile (const TAO::ObjectKey &object_key,
+ TAO_MProfile &mprofile,
+ CORBA::Short priority)
+{
+ size_t index = 0;
+ TAO_Profile *pfile = 0;
+ TAO_DIOP_Profile *iiop_profile = 0;
+
+ // First see if <mprofile> already contains a DIOP profile.
+ for (TAO_PHandle i = 0; i != mprofile.profile_count (); ++i)
+ {
+ pfile = mprofile.get_profile (i);
+ if (pfile->tag () == TAO_TAG_DIOP_PROFILE)
+ {
+ iiop_profile = dynamic_cast<TAO_DIOP_Profile *> (pfile);
+ break;
+ }
+ }
+
+ // If <mprofile> doesn't contain a DIOP_Profile, we need to create
+ // one.
+ if (iiop_profile == 0)
+ {
+ ACE_NEW_RETURN (iiop_profile,
+ TAO_DIOP_Profile (this->hosts_[0],
+ this->addrs_[0].get_port_number (),
+ object_key,
+ this->addrs_[0],
+ this->version_,
+ this->orb_core_),
+ -1);
+ iiop_profile->endpoint ()->priority (priority);
+
+ if (mprofile.give_profile (iiop_profile) == -1)
+ {
+ iiop_profile->_decr_refcnt ();
+ iiop_profile = 0;
+ return -1;
+ }
+
+ if (this->orb_core_->orb_params ()->std_profile_components () != 0
+ && (this->version_.major >= 1 && this->version_.minor >= 1))
+ {
+ iiop_profile->tagged_components ().set_orb_type (TAO_ORB_TYPE);
+ TAO_Codeset_Manager *csm = this->orb_core_->codeset_manager();
+ if (csm)
+ csm->set_codeset(pfile->tagged_components());
+ }
+
+ index = 1;
+ }
+
+ // Add any remaining acceptor endpoints to the DIOP_Profile.
+ for (;
+ index < this->endpoint_count_;
+ ++index)
+ {
+ TAO_DIOP_Endpoint *endpoint = 0;
+ ACE_NEW_RETURN (endpoint,
+ TAO_DIOP_Endpoint (this->hosts_[index],
+ this->addrs_[index].get_port_number (),
+ this->addrs_[index]),
+ -1);
+ endpoint->priority (priority);
+ iiop_profile->add_endpoint (endpoint);
+ }
+
+ return 0;
+}
+
+int
+TAO_DIOP_Acceptor::is_collocated (const TAO_Endpoint *endpoint)
+{
+ const TAO_DIOP_Endpoint *endp =
+ dynamic_cast<const TAO_DIOP_Endpoint *> (endpoint);
+
+ // Make sure the dynamically cast pointer is valid.
+ if (endp == 0)
+ return 0;
+
+ for (size_t i = 0; i < this->endpoint_count_; ++i)
+ {
+ // compare the port and host name. Please do *NOT* optimize
+ // this code by comparing the IP address instead. That would
+ // trigger the following bug:
+ //
+ // http://deuce.doc.wustl.edu/bugzilla/show_bug.cgi?id=1220
+ //
+ if (endp->port() == this->addrs_[i].get_port_number()
+ && ACE_OS::strcmp(endp->host(), this->hosts_[i]) == 0)
+ return 1; // Collocated
+ }
+
+ return 0; // Not collocated
+}
+
+int
+TAO_DIOP_Acceptor::close (void)
+{
+ return 0;
+}
+
+int
+TAO_DIOP_Acceptor::open (TAO_ORB_Core *orb_core,
+ ACE_Reactor *reactor,
+ int major,
+ int minor,
+ const char *address,
+ const char *options)
+{
+ this->orb_core_ = orb_core;
+
+ if (this->hosts_ != 0)
+ {
+ // The hostname cache has already been set!
+ // This is bad mojo, i.e. an internal TAO error.
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) ")
+ ACE_TEXT ("DIOP_Acceptor::open - ")
+ ACE_TEXT ("hostname already set\n\n")),
+ -1);
+ }
+
+ if (address == 0)
+ return -1;
+
+ if (major >=0 && minor >= 0)
+ this->version_.set_version (static_cast<CORBA::Octet> (major),
+ static_cast<CORBA::Octet> (minor));
+ // Parse options
+ if (this->parse_options (options) == -1)
+ return -1;
+
+ ACE_INET_Addr addr;
+
+ const char *port_separator_loc = ACE_OS::strchr (address, ':');
+ const char *specified_hostname = 0;
+ char tmp_host[MAXHOSTNAMELEN + 1];
+
+ if (port_separator_loc == address)
+ {
+ // The address is a port number or port name. No hostname was
+ // specified. The hostname for each network interface and the
+ // fully qualified domain name must be obtained.
+
+ // Check for multiple network interfaces.
+ if (this->probe_interfaces (orb_core) == -1)
+ return -1;
+
+ // First convert the port into a usable form.
+ if (addr.set (address + sizeof (':')) != 0)
+ return -1;
+
+ // Now reset the port and set the host.
+ if (addr.set (addr.get_port_number (),
+ static_cast<ACE_UINT32> (INADDR_ANY),
+ 1) != 0)
+ return -1;
+ else
+ return this->open_i (addr,
+ reactor);
+ }
+ else if (port_separator_loc == 0)
+ {
+ // The address is a hostname. No port was specified, so assume
+ // port zero (port will be chosen for us).
+ if (addr.set ((unsigned short) 0, address) != 0)
+ return -1;
+
+ specified_hostname = address;
+ }
+ else
+ {
+ // Host and port were specified.
+ if (addr.set (address) != 0)
+ return -1;
+
+ // Extract out just the host part of the address.
+ size_t len = port_separator_loc - address;
+ ACE_OS::memcpy (tmp_host, address, len);
+ tmp_host[len] = '\0';
+
+ specified_hostname = tmp_host;
+ }
+
+ this->endpoint_count_ = 1; // Only one hostname to store
+
+ ACE_NEW_RETURN (this->addrs_,
+ ACE_INET_Addr[this->endpoint_count_],
+ -1);
+
+ ACE_NEW_RETURN (this->hosts_,
+ char *[this->endpoint_count_],
+ -1);
+
+ this->hosts_[0] = 0;
+
+ if (this->hostname (orb_core,
+ addr,
+ this->hosts_[0],
+ specified_hostname) != 0)
+ return -1;
+
+ // Copy the addr. The port is (re)set in
+ // TAO_DIOP_Acceptor::open_i().
+ if (this->addrs_[0].set (addr) != 0)
+ return -1;
+
+ return this->open_i (addr,
+ reactor);
+}
+
+int
+TAO_DIOP_Acceptor::open_default (TAO_ORB_Core *orb_core,
+ ACE_Reactor *reactor,
+ int major,
+ int minor,
+ const char *options)
+{
+ this->orb_core_ = orb_core;
+
+ if (this->hosts_ != 0)
+ {
+ // The hostname cache has already been set!
+ // This is bad mojo, i.e. an internal TAO error.
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) ")
+ ACE_TEXT ("DIOP_Acceptor::open_default - ")
+ ACE_TEXT ("hostname already set\n\n")),
+ -1);
+ }
+
+ if (major >=0 && minor >= 0)
+ this->version_.set_version (static_cast<CORBA::Octet> (major),
+ static_cast<CORBA::Octet> (minor));
+
+ // Parse options
+ if (this->parse_options (options) == -1)
+ return -1;
+
+ // Check for multiple network interfaces.
+ if (this->probe_interfaces (orb_core) == -1)
+ return -1;
+
+ // Now that each network interface's hostname has been cached, open
+ // an endpoint on each network interface using the INADDR_ANY
+ // address.
+ ACE_INET_Addr addr;
+
+ if (addr.set (static_cast<unsigned short> (0),
+ static_cast<ACE_UINT32> (INADDR_ANY),
+ 1) != 0)
+ return -1;
+
+ return this->open_i (addr,
+ reactor);
+}
+
+int
+TAO_DIOP_Acceptor::open_i (const ACE_INET_Addr& addr,
+ ACE_Reactor *reactor)
+{
+ ACE_NEW_RETURN (this->connection_handler_,
+ TAO_DIOP_Connection_Handler (this->orb_core_,
+ this->lite_flag_),
+ -1);
+
+ this->connection_handler_->local_addr (addr);
+ this->connection_handler_->open_server ();
+
+ // Register only with a valid handle
+ int const result =
+ reactor->register_handler (this->connection_handler_,
+ ACE_Event_Handler::READ_MASK);
+ if (result == -1)
+ return result;
+
+ // Connection handler ownership now belongs to the Reactor.
+ this->connection_handler_->remove_reference ();
+
+ ACE_INET_Addr address;
+
+ // We do this make sure the port number the endpoint is listening on
+ // gets set in the addr.
+ if (this->connection_handler_->dgram ().get_local_addr (address) != 0)
+ {
+ if (TAO_debug_level > 0)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) DIOP_Acceptor::open_i ")
+ ACE_TEXT ("- %p"),
+ ACE_TEXT ("cannot get local addr\n")));
+ return -1;
+ }
+
+ // Set the port for each addr. If there is more than one network
+ // interface then the endpoint created on each interface will be on
+ // the same port. This is how a wildcard socket bind() is supposed
+ // to work.
+ u_short const port = address.get_port_number ();
+ for (size_t j = 0; j < this->endpoint_count_; ++j)
+ this->addrs_[j].set_port_number (port, 1);
+
+ if (TAO_debug_level > 5)
+ {
+ for (size_t i = 0; i < this->endpoint_count_; ++i)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("\nTAO (%P|%t) DIOP_Acceptor::open_i - ")
+ ACE_TEXT ("listening on: <%s:%u>\n"),
+ ACE_TEXT_CHAR_TO_TCHAR (this->hosts_[i]),
+ this->addrs_[i].get_port_number ()));
+ }
+ }
+
+ return 0;
+}
+
+int
+TAO_DIOP_Acceptor::hostname (TAO_ORB_Core *orb_core,
+ ACE_INET_Addr &addr,
+ char *&host,
+ const char *specified_hostname)
+{
+ if (orb_core->orb_params ()->use_dotted_decimal_addresses ())
+ {
+ // If dotted decimal addresses are enabled,
+ // just return ours.
+ return this->dotted_decimal_address (addr, host);
+ }
+ else
+ if (specified_hostname != 0)
+ {
+ // If the user specified a hostname, pass it back
+ // blindly as it overrides our choice of hostname.
+ host = CORBA::string_dup (specified_hostname);
+ }
+ else
+ {
+ char tmp_host[MAXHOSTNAMELEN + 1];
+
+ // Get the hostname associated with our address
+ if (addr.get_host_name (tmp_host, sizeof (tmp_host)) != 0)
+ {
+ // On failure, just return the decimal address.
+ return this->dotted_decimal_address (addr, host);
+ }
+ else
+ {
+ host = CORBA::string_dup (tmp_host);
+ }
+ }
+
+ return 0;
+}
+
+int
+TAO_DIOP_Acceptor::dotted_decimal_address (ACE_INET_Addr &addr,
+ char *&host)
+{
+ const char *tmp = addr.get_host_addr ();
+ if (tmp == 0)
+ {
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("\n\nTAO (%P|%t) ")
+ ACE_TEXT ("DIOP_Acceptor::dotted_decimal_address ")
+ ACE_TEXT ("- %p\n\n"),
+ ACE_TEXT ("cannot determine hostname")));
+ return -1;
+ }
+
+ host = CORBA::string_dup (tmp);
+ return 0;
+}
+
+int
+TAO_DIOP_Acceptor::probe_interfaces (TAO_ORB_Core *orb_core)
+{
+ // Extract the hostname for each network interface, and then cache
+ // it. The hostnames will then be used when creating a
+ // TAO_DIOP_Profile for each endpoint setup on the probed
+ // network interfaces.
+ ACE_INET_Addr *if_addrs = 0;
+ size_t if_cnt = 0;
+
+ if (ACE::get_ip_interfaces (if_cnt,
+ if_addrs) != 0
+ && errno != ENOTSUP)
+ {
+ // In the case where errno == ENOTSUP, if_cnt and if_addrs will
+ // not be modified, and will each remain equal to zero. This
+ // causes the default interface to be used.
+ return -1;
+ }
+
+ if (if_cnt == 0 || if_addrs == 0)
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_WARNING,
+ ACE_TEXT ("TAO (%P|%t) Unable to probe network ")
+ ACE_TEXT ("interfaces. Using default.")));
+ }
+
+ if_cnt = 1; // Force the network interface count to be one.
+ delete [] if_addrs;
+ ACE_NEW_RETURN (if_addrs,
+ ACE_INET_Addr[if_cnt],
+ -1);
+ }
+
+ // Scan for the loopback interface since it shouldn't be included in
+ // the list of cached hostnames unless it is the only interface.
+ size_t lo_cnt = 0; // Loopback interface count
+ for (size_t j = 0; j < if_cnt; ++j)
+ if (if_addrs[j].get_ip_address () == INADDR_LOOPBACK)
+ lo_cnt++;
+
+ // The instantiation for this template is in
+ // tao/DIOP_Connector.cpp.
+ ACE_Auto_Basic_Array_Ptr<ACE_INET_Addr> safe_if_addrs (if_addrs);
+
+ // If the loopback interface is the only interface then include it
+ // in the list of interfaces to query for a hostname, otherwise
+ // exclude it from the list.
+ if (if_cnt == lo_cnt)
+ this->endpoint_count_ = static_cast<CORBA::ULong> (if_cnt);
+ else
+ this->endpoint_count_ = static_cast<CORBA::ULong> (if_cnt - lo_cnt);
+
+ ACE_NEW_RETURN (this->addrs_,
+ ACE_INET_Addr[this->endpoint_count_],
+ -1);
+
+ ACE_NEW_RETURN (this->hosts_,
+ char *[this->endpoint_count_],
+ -1);
+
+ ACE_OS::memset (this->hosts_, 0, sizeof (char*) * this->endpoint_count_);
+
+ // The number of hosts/interfaces we want to cache may not be the
+ // same as the number of detected interfaces so keep a separate
+ // count.
+ size_t host_cnt = 0;
+
+ for (size_t i = 0; i < if_cnt; ++i)
+ {
+ // Ignore any loopback interface if there are other
+ // non-loopback interfaces.
+ if (if_cnt != lo_cnt &&
+ if_addrs[i].get_ip_address() == INADDR_LOOPBACK)
+ continue;
+
+ if (this->hostname (orb_core,
+ if_addrs[i],
+ this->hosts_[host_cnt]) != 0)
+ return -1;
+
+ // Copy the addr. The port is (re)set in
+ // TAO_DIOP_Acceptor::open_i().
+ if (this->addrs_[host_cnt].set (if_addrs[i]) != 0)
+ return -1;
+
+ host_cnt++;
+ }
+
+ return 0;
+}
+
+CORBA::ULong
+TAO_DIOP_Acceptor::endpoint_count (void)
+{
+ return this->endpoint_count_;
+}
+
+int
+TAO_DIOP_Acceptor::object_key (IOP::TaggedProfile &profile,
+ TAO::ObjectKey &object_key)
+{
+ // Create the decoding stream from the encapsulation in the buffer,
+#if (TAO_NO_COPY_OCTET_SEQUENCES == 1)
+ TAO_InputCDR cdr (profile.profile_data.mb ());
+#else
+ TAO_InputCDR cdr (reinterpret_cast<char*> (profile.profile_data.get_buffer ()),
+ profile.profile_data.length ());
+#endif /* TAO_NO_COPY_OCTET_SEQUENCES == 1 */
+
+ CORBA::Octet major;
+ CORBA::Octet minor = CORBA::Octet();
+
+ // Read the version. We just read it here. We don't*do any*
+ // processing.
+ if (!(cdr.read_octet (major)
+ && cdr.read_octet (minor)))
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) DIOP_Profile::decode - v%d.%d\n"),
+ major,
+ minor));
+ }
+ return -1;
+ }
+
+ CORBA::String_var host;
+ CORBA::UShort port = 0;
+
+ // Get host and port. No processing here too..
+ if (cdr.read_string (host.out ()) == 0
+ || cdr.read_ushort (port) == 0)
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) TAO_DIOP_Acceptor::object_key - ")
+ ACE_TEXT ("error while decoding host/port")));
+ }
+ return -1;
+ }
+
+ // ... and object key.
+ if ((cdr >> object_key) == 0)
+ return -1;
+
+ // We are NOT bothered about the rest.
+
+ return 1;
+}
+
+
+int
+TAO_DIOP_Acceptor::parse_options (const char *str)
+{
+ if (str == 0)
+ return 0; // No options to parse. Not a problem.
+
+ // Use an option format similar to the one used for CGI scripts in
+ // HTTP URLs.
+ // e.g.: option1=foo&option2=bar
+
+ ACE_CString options (str);
+
+ size_t len = options.length ();
+
+ const char option_delimiter = '&';
+
+ // Count the number of options.
+
+ CORBA::ULong option_count = 1;
+ // Number of endpoints in the string (initialized to 1).
+
+ // Only check for endpoints after the protocol specification and
+ // before the object key.
+ for (size_t i = 0; i < len; ++i)
+ if (options[i] == option_delimiter)
+ option_count++;
+
+ // The idea behind the following loop is to split the options into
+ // (option, name) pairs.
+ // For example,
+ // `option1=foo&option2=bar'
+ // will be parsed into:
+ // `option1=foo'
+ // `option2=bar'
+
+ ACE_CString::size_type begin = 0;
+ ACE_CString::size_type end = 0;
+
+ for (CORBA::ULong j = 0; j < option_count; ++j)
+ {
+ if (j < option_count - 1)
+ end = options.find (option_delimiter, begin);
+ else
+ end = len;
+
+ if (end == begin)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) Zero length DIOP option.\n")),
+ -1);
+ }
+ else if (end != ACE_CString::npos)
+ {
+ ACE_CString opt = options.substring (begin, end - begin);
+
+ ACE_CString::size_type const slot = opt.find ("=");
+
+ if (slot == len - 1
+ || slot == ACE_CString::npos)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) DIOP option <%s> is ")
+ ACE_TEXT ("missing a value.\n"),
+ ACE_TEXT_CHAR_TO_TCHAR (opt.c_str ())),
+ -1);
+
+ ACE_CString name = opt.substring (0, slot);
+ ACE_CString value = opt.substring (slot + 1);
+
+ if (name.length () == 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) Zero length DIOP ")
+ ACE_TEXT ("option name.\n")),
+ -1);
+
+ if (name == "priority")
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) Invalid DIOP endpoint format: ")
+ ACE_TEXT ("endpoint priorities no longer supported. \n")),
+ -1);
+ }
+ else
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) Invalid DIOP option: <%s>\n"),
+ ACE_TEXT_CHAR_TO_TCHAR (name.c_str ())),
+ -1);
+ }
+
+ begin = end + 1;
+ }
+ else
+ {
+ break; // No other options.
+ }
+ }
+ return 0;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_DIOP && TAO_HAS_DIOP != 0 */
diff --git a/TAO/tao/Strategies/DIOP_Acceptor.h b/TAO/tao/Strategies/DIOP_Acceptor.h
new file mode 100644
index 00000000000..93e48da8146
--- /dev/null
+++ b/TAO/tao/Strategies/DIOP_Acceptor.h
@@ -0,0 +1,191 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file DIOP_Acceptor.h
+ *
+ * $Id$
+ *
+ * DIOP specific acceptor processing
+ *
+ * @author Michael Kircher
+ */
+//=============================================================================
+
+
+#ifndef TAO_DIOP_ACCEPTOR_H
+#define TAO_DIOP_ACCEPTOR_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if defined (TAO_HAS_DIOP) && (TAO_HAS_DIOP != 0)
+
+#include "tao/Transport_Acceptor.h"
+#include "tao/Strategies/DIOP_Connection_Handler.h"
+#include "tao/Acceptor_Impl.h"
+
+#include "tao/GIOP_Message_Version.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// TAO DIOP_Acceptor concrete call defination
+
+/**
+ * @class TAO_DIOP_Acceptor
+ *
+ * @brief TAO_DIOP_Acceptor
+ *
+ * The DIOP-specific bridge class for the concrete acceptor.
+ */
+class TAO_Strategies_Export TAO_DIOP_Acceptor : public TAO_Acceptor
+{
+public:
+ /// Constructor.
+ TAO_DIOP_Acceptor (CORBA::Boolean flag = false);
+
+ /// Destructor.
+ ~TAO_DIOP_Acceptor (void);
+
+ /// @@ Helper method for the implementation repository, should go
+ /// away
+ const ACE_INET_Addr& address (void) const;
+
+ /// Returns the array of endpoints in this acceptor
+ const ACE_INET_Addr *endpoints (void);
+
+ /**
+ * @name The TAO_Acceptor Methods
+ *
+ * Please check the documentation in Transport_Acceptor.h for details.
+ */
+ //@{
+ virtual int open (TAO_ORB_Core *orb_core,
+ ACE_Reactor *reactor,
+ int version_major,
+ int version_minor,
+ const char *address,
+ const char *options = 0);
+ virtual int open_default (TAO_ORB_Core *orb_core,
+ ACE_Reactor *reactor,
+ int version_major,
+ int version_minor,
+ const char *options = 0);
+ virtual int close (void);
+ virtual int create_profile (const TAO::ObjectKey &object_key,
+ TAO_MProfile &mprofile,
+ CORBA::Short priority);
+
+ virtual int is_collocated (const TAO_Endpoint *endpoint);
+ virtual CORBA::ULong endpoint_count (void);
+
+ virtual int object_key (IOP::TaggedProfile &profile,
+ TAO::ObjectKey &key);
+ //@}
+
+ /**
+ * Set the host name for the given addr.
+ * A hostname may be forced by using specified_hostname. This
+ * is useful if the given address corresponds to more than one
+ * hostname and the desired one cannot be determined in any
+ * other way.
+ */
+ int hostname (TAO_ORB_Core *orb_core,
+ ACE_INET_Addr &addr,
+ char *&host,
+ const char *specified_hostname = 0);
+
+ /**
+ * Set the host name for the given address using the dotted decimal
+ * format.
+ */
+ int dotted_decimal_address (ACE_INET_Addr &addr,
+ char *&host);
+
+protected:
+
+ /**
+ * Implement the common part of the open*() methods. This method is
+ * virtual to allow a derived class implementation to be invoked
+ * instead.
+ */
+ virtual int open_i (const ACE_INET_Addr &addr,
+ ACE_Reactor *reactor);
+
+ /**
+ * Probe the system for available network interfaces, and initialize
+ * the <addrs_> array with an ACE_INET_Addr for each network
+ * interface. The port for each initialized ACE_INET_Addr will be
+ * set in the open_i() method. This method only gets invoked when
+ * no explicit hostname is provided in the specified endpoint.
+ */
+ int probe_interfaces (TAO_ORB_Core *orb_core);
+
+ /// Parse protocol specific options.
+ virtual int parse_options (const char *options);
+
+ /// Helper method to add a new profile to the mprofile for
+ /// each endpoint.
+ int create_new_profile (const TAO::ObjectKey &object_key,
+ TAO_MProfile &mprofile,
+ CORBA::Short priority);
+
+ /// Helper method to create a profile that contains all of
+ /// our endpoints.
+ int create_shared_profile (const TAO::ObjectKey &object_key,
+ TAO_MProfile &mprofile,
+ CORBA::Short priority);
+protected:
+
+ /// Array of ACE_INET_Addr instances, each one corresponding to a
+ /// given network interface.
+ ACE_INET_Addr *addrs_;
+
+ /**
+ * Cache the information about the endpoints serviced by this
+ * acceptor.
+ * There may in fact be multiple hostnames for this endpoint. For
+ * example, if the IP address is INADDR_ANY (0.0.0.0) then there
+ * will be possibly a different hostname for each interface.
+ */
+ char **hosts_;
+
+ /// The number of host names cached in the hosts_ array (equivalent
+ /// to the number of endpoints opened by this Acceptor).
+ CORBA::ULong endpoint_count_;
+
+ /**
+ * The GIOP version for this endpoint
+ * @@ Theoretically they shouldn't be here!! We need to look at a
+ * way to move this out
+ */
+ TAO_GIOP_Message_Version version_;
+
+ /// ORB Core.
+ TAO_ORB_Core *orb_core_;
+
+ /// Should we use GIOP lite??
+ CORBA::Boolean lite_flag_;
+
+private:
+ // @@ Frank: From DIOP_Acceptor.h
+ TAO_DIOP_Connection_Handler *connection_handler_;
+
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined(__ACE_INLINE__)
+#include "tao/Strategies/DIOP_Acceptor.i"
+#endif /* __ACE_INLINE__ */
+
+#endif /* TAO_HAS_DIOP && TAO_HAS_DIOP != 0 */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_DIOP_ACCEPTOR_H */
diff --git a/TAO/tao/Strategies/DIOP_Acceptor.i b/TAO/tao/Strategies/DIOP_Acceptor.i
new file mode 100644
index 00000000000..2603d4e7156
--- /dev/null
+++ b/TAO/tao/Strategies/DIOP_Acceptor.i
@@ -0,0 +1,28 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE const ACE_INET_Addr&
+TAO_DIOP_Acceptor::address (void) const
+{
+ ACE_ASSERT (this->addrs_ != 0);
+
+ // @@ This is busted.
+ // The Implementation Repository will have to start supporting
+ // IORs with multiple profiles. For now, we just return the
+ // first addr.
+ // -Ossama
+ return this->addrs_[0];
+}
+
+ACE_INLINE const ACE_INET_Addr *
+TAO_DIOP_Acceptor::endpoints (void)
+{
+ ACE_ASSERT (this->addrs_ != 0);
+
+ return this->addrs_;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Strategies/DIOP_Connection_Handler.cpp b/TAO/tao/Strategies/DIOP_Connection_Handler.cpp
new file mode 100644
index 00000000000..335567bc4e1
--- /dev/null
+++ b/TAO/tao/Strategies/DIOP_Connection_Handler.cpp
@@ -0,0 +1,306 @@
+// $Id$
+
+#include "tao/Strategies/DIOP_Connection_Handler.h"
+
+#if defined (TAO_HAS_DIOP) && (TAO_HAS_DIOP != 0)
+
+#include "tao/Timeprobe.h"
+#include "tao/debug.h"
+#include "tao/ORB_Core.h"
+#include "tao/ORB.h"
+#include "tao/CDR.h"
+#include "tao/Server_Strategy_Factory.h"
+#include "tao/Transport_Cache_Manager.h"
+#include "tao/Thread_Lane_Resources.h"
+#include "tao/Base_Transport_Property.h"
+#include "tao/Protocols_Hooks.h"
+#include "tao/Resume_Handle.h"
+
+#include "tao/Strategies/DIOP_Transport.h"
+#include "tao/Strategies/DIOP_Endpoint.h"
+
+#include "ace/os_include/netinet/os_tcp.h"
+#include "ace/os_include/os_netdb.h"
+
+ACE_RCSID(tao, DIOP_Connect, "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_DIOP_Connection_Handler::TAO_DIOP_Connection_Handler (ACE_Thread_Manager *t)
+ : TAO_DIOP_SVC_HANDLER (t, 0 , 0),
+ TAO_Connection_Handler (0),
+ dscp_codepoint_ (IPDSFIELD_DSCP_DEFAULT << 2)
+{
+ // This constructor should *never* get called, it is just here to
+ // make the compiler happy: the default implementation of the
+ // Creation_Strategy requires a constructor with that signature, we
+ // don't use that implementation, but some (most?) compilers
+ // instantiate it anyway.
+ ACE_ASSERT (0);
+}
+
+
+TAO_DIOP_Connection_Handler::TAO_DIOP_Connection_Handler (TAO_ORB_Core *orb_core,
+ CORBA::Boolean flag)
+ : TAO_DIOP_SVC_HANDLER (orb_core->thr_mgr (), 0, 0),
+ TAO_Connection_Handler (orb_core),
+ dscp_codepoint_ (IPDSFIELD_DSCP_DEFAULT << 2)
+{
+ TAO_DIOP_Transport* specific_transport = 0;
+ ACE_NEW (specific_transport,
+ TAO_DIOP_Transport(this, orb_core, flag));
+
+ // store this pointer (indirectly increment ref count)
+ this->transport (specific_transport);
+}
+
+
+TAO_DIOP_Connection_Handler::~TAO_DIOP_Connection_Handler (void)
+{
+ delete this->transport ();
+ this->udp_socket_.close ();
+}
+
+// DIOP Additions - Begin
+ACE_HANDLE
+TAO_DIOP_Connection_Handler::get_handle (void) const
+{
+ return this->udp_socket_.get_handle ();
+}
+
+
+const ACE_INET_Addr &
+TAO_DIOP_Connection_Handler::addr (void)
+{
+ return this->addr_;
+}
+
+
+void
+TAO_DIOP_Connection_Handler::addr (const ACE_INET_Addr &addr)
+{
+ this->addr_ = addr;
+}
+
+
+const ACE_INET_Addr &
+TAO_DIOP_Connection_Handler::local_addr (void)
+{
+ return local_addr_;
+}
+
+
+void
+TAO_DIOP_Connection_Handler::local_addr (const ACE_INET_Addr &addr)
+{
+ local_addr_ = addr;
+}
+
+
+const ACE_SOCK_Dgram &
+TAO_DIOP_Connection_Handler::dgram (void)
+{
+ return this->udp_socket_;
+}
+// DIOP Additions - End
+
+int
+TAO_DIOP_Connection_Handler::open_handler (void *v)
+{
+ return this->open (v);
+}
+
+int
+TAO_DIOP_Connection_Handler::open (void*)
+{
+ // Currently, the DIOP properties are not used. This code is here
+ // for consistency with other protocols.
+ TAO_DIOP_Protocol_Properties protocol_properties;
+
+ TAO_Protocols_Hooks *tph =
+ this->orb_core ()->get_protocols_hooks ();
+
+ bool client =
+ this->transport ()->opened_as () == TAO::TAO_CLIENT_ROLE;
+
+ ACE_DECLARE_NEW_CORBA_ENV;
+
+ ACE_TRY
+ {
+ if (client)
+ {
+ tph->client_protocol_properties_at_orb_level (
+ protocol_properties
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ else
+ {
+ tph->server_protocol_properties_at_orb_level (
+ protocol_properties
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ }
+ ACE_CATCHANY
+ {
+ return -1;
+ }
+ ACE_ENDTRY;
+ ACE_CHECK_RETURN (-1);
+
+ this->udp_socket_.open (this->local_addr_);
+
+ if (TAO_debug_level > 5)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT("\nTAO (%P|%t) TAO_DIOP_Connection_Handler::open -")
+ ACE_TEXT("listening on: <%s:%u>\n"),
+ ACE_TEXT_CHAR_TO_TCHAR (this->local_addr_.get_host_name ()),
+ this->local_addr_.get_port_number ()));
+ }
+
+ // Set that the transport is now connected, if fails we return -1
+ // Use C-style cast b/c otherwise we get warnings on lots of
+ // compilers
+ if (!this->transport ()->post_open ((size_t) this->get_handle ()))
+ return -1;
+
+ this->state_changed (TAO_LF_Event::LFS_SUCCESS,
+ this->orb_core ()->leader_follower ());
+
+ return 0;
+}
+
+int
+TAO_DIOP_Connection_Handler::open_server (void)
+{
+ this->udp_socket_.open (this->local_addr_);
+ if( TAO_debug_level > 5)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT("\nTAO (%P|%t) TAO_DIOP_Connection_Handler::open_server -")
+ ACE_TEXT("listening on %s:%d\n"),
+ ACE_TEXT_CHAR_TO_TCHAR (this->local_addr_.get_host_name ()),
+ this->local_addr_.get_port_number ()
+ ));
+ }
+
+ this->transport ()->id ((size_t) this->get_handle ());
+
+ return 0;
+}
+
+int
+TAO_DIOP_Connection_Handler::resume_handler (void)
+{
+ return ACE_Event_Handler::ACE_APPLICATION_RESUMES_HANDLER;
+}
+
+int
+TAO_DIOP_Connection_Handler::close_connection (void)
+{
+ return this->close_connection_eh (this);
+}
+
+int
+TAO_DIOP_Connection_Handler::handle_input (ACE_HANDLE h)
+{
+ return this->handle_input_eh (h, this);
+}
+
+int
+TAO_DIOP_Connection_Handler::handle_output (ACE_HANDLE handle)
+{
+ int result =
+ this->handle_output_eh (handle, this);
+
+ if (result == -1)
+ {
+ this->close_connection ();
+ return 0;
+ }
+
+ return result;
+}
+
+int
+TAO_DIOP_Connection_Handler::handle_timeout (const ACE_Time_Value &,
+ const void *)
+{
+ // We don't use this upcall from the Reactor. However, we should
+ // override this since the base class returns -1 which will result
+ // in handle_close() getting called.
+ return 0;
+}
+
+int
+TAO_DIOP_Connection_Handler::handle_close (ACE_HANDLE,
+ ACE_Reactor_Mask)
+{
+ // No asserts here since the handler is registered with the Reactor
+ // and the handler ownership is given to the Reactor. When the
+ // Reactor closes, it will call handle_close() on the handler. It
+ // is however important to overwrite handle_close() to do nothing
+ // since the base class does too much.
+ return 0;
+}
+
+int
+TAO_DIOP_Connection_Handler::close (u_long)
+{
+ return this->close_handler ();
+}
+
+int
+TAO_DIOP_Connection_Handler::release_os_resources (void)
+{
+ return this->peer ().close ();
+}
+
+int
+TAO_DIOP_Connection_Handler::set_dscp_codepoint (CORBA::Boolean set_network_priority)
+{
+ int tos = IPDSFIELD_DSCP_DEFAULT << 2;
+
+ if (set_network_priority)
+ {
+ TAO_Protocols_Hooks *tph =
+ this->orb_core ()->get_protocols_hooks ();
+
+ CORBA::Long codepoint =
+ tph->get_dscp_codepoint ();
+
+ tos = (int)(codepoint) << 2;
+ }
+
+ if (tos != this->dscp_codepoint_)
+ {
+ int result = this->dgram ().set_option (IPPROTO_IP,
+ IP_TOS,
+ (int *) &tos ,
+ (int) sizeof (tos));
+
+ if (TAO_debug_level)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - DIOP_Connection_Handler::"
+ "set_dscp_codepoint -> dscp: %x; result: %d; %s\n",
+ tos,
+ result,
+ result == -1 ? "try running as superuser" : ""));
+ }
+
+ // On successful setting of TOS field.
+ if (result == 0)
+ this->dscp_codepoint_ = tos;
+
+ }
+
+ return 0;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_DIOP && TAO_HAS_DIOP != 0 */
diff --git a/TAO/tao/Strategies/DIOP_Connection_Handler.h b/TAO/tao/Strategies/DIOP_Connection_Handler.h
new file mode 100644
index 00000000000..f2b4218bad5
--- /dev/null
+++ b/TAO/tao/Strategies/DIOP_Connection_Handler.h
@@ -0,0 +1,167 @@
+// -*- C++ -*-
+
+// ===================================================================
+/**
+ * @file DIOP_Connection_Handler.h
+ *
+ * $Id$
+ *
+ * @author Michael Kircher
+ */
+// ===================================================================
+
+#ifndef TAO_DIOP_CONNECTION_HANDLER_H
+#define TAO_DIOP_CONNECTION_HANDLER_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+#pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if defined (TAO_HAS_DIOP) && (TAO_HAS_DIOP != 0)
+
+#include "tao/Strategies/strategies_export.h"
+#include "tao/Wait_Strategy.h"
+#include "tao/Connection_Handler.h"
+#include "tao/Strategies/DIOP_Transport.h"
+#include "ace/SOCK_Dgram.h"
+#include "ace/Reactor.h"
+#include "ace/Acceptor.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Forward Decls
+class TAO_Pluggable_Messaging;
+
+// ****************************************************************
+
+/**
+ * @class TAO_DIOP_Connection_Handler
+ *
+ * @brief Handles requests on a single connection.
+ *
+ * The Connection handler which is common for the Acceptor and
+ * the Connector
+ */
+class TAO_Strategies_Export TAO_DIOP_Connection_Handler
+ : public TAO_DIOP_SVC_HANDLER
+ , public TAO_Connection_Handler
+{
+
+public:
+
+ TAO_DIOP_Connection_Handler (ACE_Thread_Manager* t = 0);
+
+ /// Constructor.
+ TAO_DIOP_Connection_Handler (TAO_ORB_Core *orb_core,
+ CORBA::Boolean flag);
+
+ /// Destructor.
+ ~TAO_DIOP_Connection_Handler (void);
+
+ /// Called by the <Strategy_Acceptor> when the handler is completely
+ /// connected. Argument is unused.
+ virtual int open (void *);
+
+ // @@ Frank: Similar to open, but called on server
+ virtual int open_server (void);
+
+ //@{
+ /**
+ * Connection_Handler overloads
+ */
+ virtual int open_handler (void *);
+ //@}
+
+ /// Close called by the Acceptor or Connector when connection
+ /// establishment fails.
+ int close (u_long = 0);
+
+ //@{
+ /** @name Event Handler overloads
+ */
+ virtual int resume_handler (void);
+ virtual int close_connection (void);
+ virtual int handle_input (ACE_HANDLE);
+ virtual int handle_output (ACE_HANDLE);
+ virtual int handle_close (ACE_HANDLE, ACE_Reactor_Mask);
+ virtual int handle_timeout (const ACE_Time_Value &current_time,
+ const void *act = 0);
+ //@}
+
+ /// Add ourselves to Cache.
+ int add_transport_to_cache (void);
+
+ // @@ Frank: Not needed
+ /*
+ /// Process the <listen_list>
+ int process_listen_point_list (DIOP::ListenPointList &listen_list);
+ */
+
+ // DIOP Additions - Begin
+ /**
+ * @name The DIOP Additions
+ *
+ */
+ //@{
+ ACE_HANDLE get_handle (void) const;
+
+ const ACE_INET_Addr &addr (void);
+
+ void addr (const ACE_INET_Addr &addr);
+
+ const ACE_INET_Addr &local_addr (void);
+
+ void local_addr (const ACE_INET_Addr &addr);
+
+ const ACE_INET_Addr &server_addr (void);
+
+ void server_addr (const ACE_INET_Addr &addr);
+
+ const ACE_SOCK_Dgram &dgram (void);
+ //@}
+ // DIOP Additions - End
+
+ /// Set Diff-Serv codepoint on outgoing packets.
+ int set_dscp_codepoint (CORBA::Boolean set_network_priority);
+
+protected:
+
+ //@{
+ /**
+ * @name TAO_Connection Handler overloads
+ */
+ virtual int release_os_resources (void);
+ //@}
+
+ // DIOP Additions - Begin
+ /**
+ * @name The DIOP Additions
+ *
+ */
+ //@{
+ ACE_SOCK_Dgram udp_socket_;
+
+ /// This is always the remote address
+ ACE_INET_Addr addr_;
+
+ /// This is always the local address for the connector
+ ACE_INET_Addr local_addr_;
+ //@}
+ // DIOP Additions - End
+
+private:
+ /// Stores the type of service value.
+ int dscp_codepoint_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_DIOP && TAO_HAS_DIOP != 0 */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_DIOP_CONNECTION_HANDLER_H */
diff --git a/TAO/tao/Strategies/DIOP_Connector.cpp b/TAO/tao/Strategies/DIOP_Connector.cpp
new file mode 100644
index 00000000000..b7fd7318cef
--- /dev/null
+++ b/TAO/tao/Strategies/DIOP_Connector.cpp
@@ -0,0 +1,242 @@
+// This may look like C, but it's really -*- C++ -*-
+// $Id$
+
+#include "tao/Strategies/DIOP_Connector.h"
+
+#if defined (TAO_HAS_DIOP) && (TAO_HAS_DIOP != 0)
+
+#include "ace/Connector.h"
+
+#include "tao/debug.h"
+#include "tao/ORB_Core.h"
+#include "tao/Environment.h"
+#include "tao/Base_Transport_Property.h"
+#include "tao/Protocols_Hooks.h"
+#include "ace/OS_NS_strings.h"
+#include "ace/OS_NS_string.h"
+
+#include "tao/Strategies/DIOP_Profile.h"
+
+
+ACE_RCSID (Strategies,
+ DIOP_Connector,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_DIOP_Connector::TAO_DIOP_Connector (CORBA::Boolean flag)
+ : TAO_Connector (TAO_TAG_DIOP_PROFILE),
+ lite_flag_ (flag)
+{
+}
+
+TAO_DIOP_Connector::~TAO_DIOP_Connector (void)
+{
+}
+
+int
+TAO_DIOP_Connector::open (TAO_ORB_Core *orb_core)
+{
+ this->orb_core (orb_core);
+
+ // Create our connect strategy
+ if (this->create_connect_strategy () == -1)
+ return -1;
+
+ // @@ Michael: We do not use regular connection management.
+
+ return 0;
+}
+
+int
+TAO_DIOP_Connector::close (void)
+{
+ // The list of service handlers cleans itself??
+ SvcHandlerIterator iter (svc_handler_table_);
+
+ while (!iter.done ())
+ {
+ (*iter).int_id_->remove_reference ();
+ iter++;
+ }
+
+ // @@ Michael: We do not use regular connection management.
+ return 0;
+}
+
+int
+TAO_DIOP_Connector::set_validate_endpoint (TAO_Endpoint *endpoint)
+{
+ TAO_DIOP_Endpoint *diop_endpoint =
+ this->remote_endpoint (endpoint);
+
+ if (diop_endpoint == 0)
+ return -1;
+
+ const ACE_INET_Addr &remote_address =
+ diop_endpoint->object_addr ();
+
+ // Verify that the remote ACE_INET_Addr was initialized properly.
+ // Failure can occur if hostname lookup failed when initializing the
+ // remote ACE_INET_Addr.
+ if (remote_address.get_type () != AF_INET)
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) DIOP connection failed.\n")
+ ACE_TEXT ("TAO (%P|%t) This is most likely ")
+ ACE_TEXT ("due to a hostname lookup ")
+ ACE_TEXT ("failure.\n")));
+ }
+
+ return -1;
+ }
+
+ return 0;
+}
+
+TAO_Transport *
+TAO_DIOP_Connector::make_connection (TAO::Profile_Transport_Resolver *,
+ TAO_Transport_Descriptor_Interface &desc,
+ ACE_Time_Value * /*max_wait_time*/)
+{
+ TAO_DIOP_Endpoint *diop_endpoint =
+ this->remote_endpoint (desc.endpoint ());
+
+ if (diop_endpoint == 0)
+ return 0;
+
+ const ACE_INET_Addr &remote_address =
+ diop_endpoint->object_addr ();
+
+ TAO_DIOP_Connection_Handler *svc_handler = 0;
+
+ if (svc_handler_table_.find (remote_address, svc_handler) == -1)
+ {
+ TAO_DIOP_Connection_Handler *svc_handler_i = 0;
+ ACE_NEW_RETURN (svc_handler_i,
+ TAO_DIOP_Connection_Handler (this->orb_core (),
+ this->lite_flag_),
+ 0);
+
+ svc_handler_i->local_addr (ACE_sap_any_cast (ACE_INET_Addr &));
+ svc_handler_i->addr (remote_address);
+
+ svc_handler_i->open (0);
+
+ svc_handler_table_.bind (remote_address,
+ svc_handler_i);
+ svc_handler = svc_handler_i;
+
+ if (TAO_debug_level > 2)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("(%P|%t) DIOP_Connector::connect - ")
+ ACE_TEXT ("new connection on HANDLE %d\n"),
+ svc_handler->get_handle ()));
+ }
+
+ // @@ Michael: We do not use regular connection management.
+ svc_handler->add_reference ();
+ TAO_Transport *transport =
+ svc_handler->transport ();
+
+ return transport;
+}
+
+TAO_Profile *
+TAO_DIOP_Connector::create_profile (TAO_InputCDR& cdr)
+{
+ TAO_Profile *pfile = 0;
+ ACE_NEW_RETURN (pfile,
+ TAO_DIOP_Profile (this->orb_core ()),
+ 0);
+
+ int const r = pfile->decode (cdr);
+ if (r == -1)
+ {
+ pfile->_decr_refcnt ();
+ pfile = 0;
+ }
+
+ return pfile;
+}
+
+TAO_Profile *
+TAO_DIOP_Connector::make_profile (ACE_ENV_SINGLE_ARG_DECL)
+{
+ // The endpoint should be of the form:
+ // N.n@host:port/object_key
+ // or:
+ // host:port/object_key
+
+ TAO_Profile *profile = 0;
+ ACE_NEW_THROW_EX (profile,
+ TAO_DIOP_Profile (this->orb_core ()),
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (0);
+
+ return profile;
+}
+
+int
+TAO_DIOP_Connector::check_prefix (const char *endpoint)
+{
+ // Check for a valid string
+ if (!endpoint || !*endpoint)
+ return -1; // Failure
+
+ const char *protocol[] = { "diop", "dioploc" };
+
+ size_t const slot = ACE_OS::strchr (endpoint, ':') - endpoint;
+
+ size_t const len0 = ACE_OS::strlen (protocol[0]);
+ size_t const len1 = ACE_OS::strlen (protocol[1]);
+
+ // Check for the proper prefix in the IOR. If the proper prefix
+ // isn't in the IOR then it is not an IOR we can use.
+ if (slot == len0
+ && ACE_OS::strncasecmp (endpoint, protocol[0], len0) == 0)
+ return 0;
+ else if (slot == len1
+ && ACE_OS::strncasecmp (endpoint, protocol[1], len1) == 0)
+ return 0;
+
+ return -1;
+ // Failure: not an DIOP IOR
+ // DO NOT throw an exception here.
+}
+
+char
+TAO_DIOP_Connector::object_key_delimiter (void) const
+{
+ return TAO_DIOP_Profile::object_key_delimiter_;
+}
+
+TAO_DIOP_Endpoint *
+TAO_DIOP_Connector::remote_endpoint (TAO_Endpoint *endpoint)
+{
+ if (endpoint->tag () != TAO_TAG_DIOP_PROFILE)
+ return 0;
+
+ TAO_DIOP_Endpoint *diop_endpoint =
+ dynamic_cast<TAO_DIOP_Endpoint *> (endpoint );
+
+ return diop_endpoint;
+}
+
+int
+TAO_DIOP_Connector::cancel_svc_handler (
+ TAO_Connection_Handler * /* svc_handler */)
+{
+ return 0;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_DIOP && TAO_HAS_DIOP != 0 */
diff --git a/TAO/tao/Strategies/DIOP_Connector.h b/TAO/tao/Strategies/DIOP_Connector.h
new file mode 100644
index 00000000000..7d4c8c1f182
--- /dev/null
+++ b/TAO/tao/Strategies/DIOP_Connector.h
@@ -0,0 +1,124 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file DIOP_Connector.h
+ *
+ * $Id$
+ *
+ * DIOP specific connector processing
+ *
+ * @author Michael Kircher
+ */
+//=============================================================================
+
+#ifndef TAO_DIOP_CONNECTOR_H
+#define TAO_DIOP_CONNECTOR_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if defined (TAO_HAS_DIOP) && (TAO_HAS_DIOP != 0)
+
+#include "tao/Strategies/DIOP_Connection_Handler.h"
+#include "tao/Transport_Connector.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Endpoint;
+class TAO_DIOP_Endpoint;
+
+// ****************************************************************
+
+/**
+ * @class TAO_DIOP_Connector
+ *
+ * @brief DIOP-specific Connector bridge for pluggable protocols.
+ *
+ * Concrete instance of the TAO_Connector class. Responsible
+ * for establishing a connection with a server and is called from the
+ * Connector_Registory.
+ */
+class TAO_Strategies_Export TAO_DIOP_Connector : public TAO_Connector
+{
+public:
+ // = Initialization and termination methods.
+ /// Constructor.
+ TAO_DIOP_Connector (CORBA::Boolean flag = false);
+
+ /// Destructor.
+ ~TAO_DIOP_Connector (void);
+
+ /**
+ * @name The TAO_Connector Methods
+ *
+ * Please check the documentation in Transport_Connector.h for details.
+ */
+ //@{
+ int open (TAO_ORB_Core *orb_core);
+ int close (void);
+
+ TAO_Profile *create_profile (TAO_InputCDR& cdr);
+
+ virtual int check_prefix (const char *endpoint);
+
+ virtual char object_key_delimiter (void) const;
+ //@}
+
+protected:
+
+ /**
+ * @name More TAO_Connector Methods
+ *
+ * Please check the documentation in Transport_Connector.h for details.
+ */
+ //@{
+ int set_validate_endpoint (TAO_Endpoint *ep);
+
+ TAO_Transport *make_connection (TAO::Profile_Transport_Resolver *r,
+ TAO_Transport_Descriptor_Interface &desc,
+ ACE_Time_Value *timeout = 0);
+
+ virtual TAO_Profile * make_profile (ACE_ENV_SINGLE_ARG_DECL);
+ //@}
+
+ /// Cancel the passed cvs handler from the connector
+ int cancel_svc_handler (TAO_Connection_Handler * svc_handler);
+
+protected:
+
+ /// Do we need to use a GIOP_Lite for sending messages?
+ CORBA::Boolean lite_flag_;
+
+private:
+
+ /// Return the remote endpoint, a helper function
+ TAO_DIOP_Endpoint *remote_endpoint (TAO_Endpoint *ep);
+
+private:
+ // @@ Michael: UDP Addition
+ ACE_Hash_Map_Manager_Ex < ACE_INET_Addr,
+ TAO_DIOP_Connection_Handler *,
+ ACE_Hash < ACE_INET_Addr >,
+ ACE_Equal_To < ACE_INET_Addr >,
+ ACE_Null_Mutex > svc_handler_table_;
+
+ typedef ACE_Hash_Map_Iterator_Ex < ACE_INET_Addr,
+ TAO_DIOP_Connection_Handler *,
+ ACE_Hash < ACE_INET_Addr >,
+ ACE_Equal_To < ACE_INET_Addr >,
+ ACE_Null_Mutex > SvcHandlerIterator;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_DIOP && TAO_HAS_DIOP != 0 */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_DIOP_CONNECTOR_H */
diff --git a/TAO/tao/Strategies/DIOP_Endpoint.cpp b/TAO/tao/Strategies/DIOP_Endpoint.cpp
new file mode 100644
index 00000000000..0932758ff8c
--- /dev/null
+++ b/TAO/tao/Strategies/DIOP_Endpoint.cpp
@@ -0,0 +1,251 @@
+// This may look like C, but it's really -*- C++ -*-
+// $Id$
+
+
+#include "tao/Strategies/DIOP_Endpoint.h"
+
+#if defined (TAO_HAS_DIOP) && (TAO_HAS_DIOP != 0)
+
+#include "tao/Strategies/DIOP_Connection_Handler.h"
+#include "tao/debug.h"
+#include "tao/ORB_Constants.h"
+
+#include "ace/OS_NS_stdio.h"
+#include "ace/OS_NS_string.h"
+
+
+ACE_RCSID (Strategies,
+ DIOP_Endpoint,
+ "$Id$")
+
+
+#if !defined (__ACE_INLINE__)
+# include "tao/Strategies/DIOP_Endpoint.i"
+#endif /* __ACE_INLINE__ */
+
+#include "ace/os_include/os_netdb.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_DIOP_Endpoint::TAO_DIOP_Endpoint (const ACE_INET_Addr &addr,
+ int use_dotted_decimal_addresses)
+
+ : TAO_Endpoint (TAO_TAG_DIOP_PROFILE)
+ , host_ ()
+ , port_ (0)
+ , object_addr_ (addr)
+ , object_addr_set_ (false)
+ , next_ (0)
+{
+ this->set (addr, use_dotted_decimal_addresses);
+}
+
+TAO_DIOP_Endpoint::TAO_DIOP_Endpoint (const char *host,
+ CORBA::UShort port,
+ const ACE_INET_Addr &addr,
+ CORBA::Short priority)
+ : TAO_Endpoint (TAO_TAG_DIOP_PROFILE,
+ priority)
+ , host_ ()
+ , port_ (port)
+ , object_addr_ (addr)
+ , object_addr_set_ (false)
+ , next_ (0)
+{
+ if (host != 0)
+ this->host_ = host;
+}
+
+TAO_DIOP_Endpoint::TAO_DIOP_Endpoint (void)
+ : TAO_Endpoint (TAO_TAG_DIOP_PROFILE),
+ host_ (),
+ port_ (0),
+ object_addr_ (),
+ object_addr_set_ (false),
+ next_ (0)
+{
+}
+
+TAO_DIOP_Endpoint::TAO_DIOP_Endpoint (const char *host,
+ CORBA::UShort port,
+ CORBA::Short priority)
+ : TAO_Endpoint (TAO_TAG_DIOP_PROFILE),
+ host_ (),
+ port_ (port),
+ object_addr_ (),
+ object_addr_set_ (false),
+ next_ (0)
+{
+ if (host != 0)
+ this->host_ = host;
+
+ this->priority (priority);
+}
+
+TAO_DIOP_Endpoint::~TAO_DIOP_Endpoint (void)
+{
+
+}
+
+int
+TAO_DIOP_Endpoint::set (const ACE_INET_Addr &addr,
+ int use_dotted_decimal_addresses)
+{
+ char tmp_host[MAXHOSTNAMELEN + 1];
+
+ if (use_dotted_decimal_addresses
+ || addr.get_host_name (tmp_host, sizeof (tmp_host)) != 0)
+ {
+ const char *tmp = addr.get_host_addr ();
+ if (tmp == 0)
+ {
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("\n\nTAO (%P|%t) ")
+ ACE_TEXT ("DIOP_Endpoint::set ")
+ ACE_TEXT ("- %p\n\n"),
+ ACE_TEXT ("cannot determine hostname")));
+ return -1;
+ }
+ else
+ this->host_ = tmp;
+ }
+ else
+ this->host_ = CORBA::string_dup (tmp_host);
+
+ this->port_ = addr.get_port_number();
+
+ return 0;
+}
+
+int
+TAO_DIOP_Endpoint::addr_to_string (char *buffer, size_t length)
+{
+ size_t const actual_len =
+ ACE_OS::strlen (this->host_.in ()) // chars in host name
+ + sizeof (':') // delimiter
+ + ACE_OS::strlen ("65536") // max port
+ + sizeof ('\0');
+
+ if (length < actual_len)
+ return -1;
+
+ ACE_OS::sprintf (buffer, "%s:%d",
+ this->host_.in (), this->port_);
+
+ return 0;
+}
+
+const char *
+TAO_DIOP_Endpoint::host (const char *h)
+{
+ this->host_ = h;
+
+ return this->host_.in ();
+}
+
+TAO_Endpoint *
+TAO_DIOP_Endpoint::next (void)
+{
+ return this->next_;
+}
+
+TAO_Endpoint *
+TAO_DIOP_Endpoint::duplicate (void)
+{
+ TAO_DIOP_Endpoint *endpoint = 0;
+
+ ACE_NEW_RETURN (endpoint,
+ TAO_DIOP_Endpoint (this->host_.in (),
+ this->port_,
+ this->object_addr_,
+ this->priority ()),
+ 0);
+
+ return endpoint;
+}
+
+CORBA::Boolean
+TAO_DIOP_Endpoint::is_equivalent (const TAO_Endpoint *other_endpoint)
+{
+ TAO_Endpoint *endpt = const_cast<TAO_Endpoint *> (other_endpoint);
+
+ TAO_DIOP_Endpoint *endpoint = dynamic_cast<TAO_DIOP_Endpoint *> (endpt);
+ if (endpoint == 0)
+ return 0;
+
+ return (this->port () == endpoint->port ()
+ && ACE_OS::strcmp(this->host (), endpoint->host()) == 0);
+}
+
+CORBA::ULong
+TAO_DIOP_Endpoint::hash (void)
+{
+ if (this->hash_val_ != 0)
+ return this->hash_val_;
+
+ {
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
+ guard,
+ this->addr_lookup_lock_,
+ this->hash_val_);
+ // .. DCL
+ if (this->hash_val_ != 0)
+ return this->hash_val_;
+
+ this->hash_val_ =
+ ACE::hash_pjw (this->host ()) + this->port ();
+ }
+
+ return this->hash_val_;
+}
+
+const ACE_INET_Addr &
+TAO_DIOP_Endpoint::object_addr (void) const
+{
+ // The object_addr_ is initialized here, rather than at IOR decode
+ // time for several reasons:
+ // 1. A request on the object may never be invoked.
+ // 2. The DNS setup may have changed dynamically.
+ // ...etc..
+
+ // Double checked locking optimization.
+ if (!this->object_addr_set_)
+ {
+ // We need to modify the object_addr_ in this method. Do so
+ // using a non-const copy of the <this> pointer.
+ TAO_DIOP_Endpoint *endpoint =
+ const_cast<TAO_DIOP_Endpoint *> (this);
+
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
+ guard,
+ endpoint->addr_lookup_lock_,
+ this->object_addr_ );
+
+ if (!this->object_addr_set_)
+ {
+ if (endpoint->object_addr_.set (this->port_,
+ this->host_.in ()) == -1)
+ {
+ // If this call fails, it most likely due a hostname
+ // lookup failure caused by a DNS misconfiguration. If
+ // a request is made to the object at the given host and
+ // port, then a CORBA::TRANSIENT() exception should be
+ // thrown.
+
+ // Invalidate the ACE_INET_Addr. This is used as a flag
+ // to denote that ACE_INET_Addr initialization failed.
+ endpoint->object_addr_.set_type (-1);
+ }
+ else
+ {
+ endpoint->object_addr_set_ = true;
+ }
+ }
+ }
+ return this->object_addr_;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_DIOP && TAO_HAS_DIOP != 0 */
diff --git a/TAO/tao/Strategies/DIOP_Endpoint.h b/TAO/tao/Strategies/DIOP_Endpoint.h
new file mode 100644
index 00000000000..7690b7eac99
--- /dev/null
+++ b/TAO/tao/Strategies/DIOP_Endpoint.h
@@ -0,0 +1,147 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file DIOP_Endpoint.h
+ *
+ * $Id$
+ *
+ * DIOP implementation of PP Framework Endpoint interface.
+ *
+ * @author Michael Kircher
+ */
+//=============================================================================
+
+
+#ifndef TAO_DIOP_ENDPOINT_H
+#define TAO_DIOP_ENDPOINT_H
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if defined (TAO_HAS_DIOP) && (TAO_HAS_DIOP != 0)
+
+#include "tao/Strategies/strategies_export.h"
+#include "tao/Endpoint.h"
+#include "tao/CORBA_String.h"
+#include "ace/INET_Addr.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_DIOP_Connection_Handler;
+
+/**
+ * @class TAO_DIOP_Endpoint
+ *
+ * @brief TAO_DIOP_Endpoint
+ *
+ * DIOP-specific implementation of PP Framework Endpoint interface.
+ */
+class TAO_Strategies_Export TAO_DIOP_Endpoint : public TAO_Endpoint
+{
+public:
+
+ friend class TAO_DIOP_Profile;
+ friend class TAO_SSLIOP_Profile;
+
+ // = Initialization and termination methods.
+
+ /// Default constructor.
+ TAO_DIOP_Endpoint (void);
+
+ /// Constructor. This is the most efficient constructor since it
+ /// does not require any address resolution processing.
+ TAO_DIOP_Endpoint (const char *host,
+ CORBA::UShort port,
+ const ACE_INET_Addr &addr,
+ CORBA::Short priority = TAO_INVALID_PRIORITY);
+
+ /// Constructor.
+ TAO_DIOP_Endpoint (const ACE_INET_Addr &addr,
+ int use_dotted_decimal_addresses);
+
+ /// Constructor. This constructor is used when decoding endpoints.
+ TAO_DIOP_Endpoint (const char *host,
+ CORBA::UShort port,
+ CORBA::Short priority);
+
+ /// Destructor.
+ ~TAO_DIOP_Endpoint (void);
+
+ /**
+ * @name TAO_Endpoint Methods
+ *
+ * Please check the documentation in Endpoint.h for details.
+ */
+ //@{
+ virtual TAO_Endpoint *next (void);
+ virtual int addr_to_string (char *buffer, size_t length);
+ virtual TAO_Endpoint *duplicate (void);
+
+ /// Return true if this endpoint is equivalent to <other_endpoint>. Two
+ /// endpoints are equivalent iff their port and host are the same.
+ CORBA::Boolean is_equivalent (const TAO_Endpoint *other_endpoint);
+
+ /// Return a hash value for this object.
+ CORBA::ULong hash (void);
+ //@}
+
+ // Allocates memory and returns a copy of <this>
+
+ // = DIOP_Endpoint-specific methods.
+
+ /// Return a reference to the <object_addr>.
+ const ACE_INET_Addr &object_addr (void) const;
+
+ /// Return a pointer to the host string. This object maintains
+ /// ownership of this string.
+ const char *host (void) const;
+
+ /// Copy the string <h> into <host_> and return the resulting pointer.
+ /// This object maintains ownership of this string.
+ const char *host (const char *h);
+
+ /// Return the port number.
+ CORBA::UShort port (void) const;
+
+ /// Set the port number.
+ CORBA::UShort port (CORBA::UShort p);
+
+private:
+
+ /// Helper method for setting INET_Addr.
+ int set (const ACE_INET_Addr &addr,
+ int use_dotted_decimal_addresses);
+
+ /// String representing the host name.
+ CORBA::String_var host_;
+
+ /// TCP port number.
+ CORBA::UShort port_;
+
+ /// Cached instance of <ACE_INET_Addr> for use in making
+ /// invocations, etc.
+ ACE_INET_Addr object_addr_;
+
+ /// Flag to indicate if the address has been resolved and set.
+ bool object_addr_set_;
+
+ /// DIOP Endpoints can be stringed into a list. Return the next
+ /// endpoint in the list, if any.
+ TAO_DIOP_Endpoint *next_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/Strategies/DIOP_Endpoint.i"
+#endif /* __ACE_INLINE__ */
+
+#endif /* TAO_HAS_DIOP && TAO_HAS_DIOP != 0 */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_DIOP_PROFILE_H */
diff --git a/TAO/tao/Strategies/DIOP_Endpoint.i b/TAO/tao/Strategies/DIOP_Endpoint.i
new file mode 100644
index 00000000000..03c7835ffbe
--- /dev/null
+++ b/TAO/tao/Strategies/DIOP_Endpoint.i
@@ -0,0 +1,25 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE const char *
+TAO_DIOP_Endpoint::host (void) const
+{
+ return this->host_.in ();
+}
+
+ACE_INLINE CORBA::UShort
+TAO_DIOP_Endpoint::port (void) const
+{
+ return this->port_;
+}
+
+ACE_INLINE CORBA::UShort
+TAO_DIOP_Endpoint::port (CORBA::UShort p)
+{
+ return this->port_ = p;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Strategies/DIOP_Factory.cpp b/TAO/tao/Strategies/DIOP_Factory.cpp
new file mode 100644
index 00000000000..8c23791d31f
--- /dev/null
+++ b/TAO/tao/Strategies/DIOP_Factory.cpp
@@ -0,0 +1,109 @@
+// $Id$
+
+#include "tao/Strategies/DIOP_Factory.h"
+
+#if defined (TAO_HAS_DIOP) && (TAO_HAS_DIOP != 0)
+
+#include "tao/Strategies/DIOP_Acceptor.h"
+#include "tao/Strategies/DIOP_Connector.h"
+
+#include "tao/ORB_Constants.h"
+
+#include "ace/OS_NS_strings.h"
+
+ACE_RCSID (Strategies,
+ DIOP_Factory,
+ "$Id$")
+
+static const char the_prefix[] = "diop";
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_DIOP_Protocol_Factory::TAO_DIOP_Protocol_Factory (void)
+ : TAO_Protocol_Factory (TAO_TAG_DIOP_PROFILE),
+ major_ (TAO_DEF_GIOP_MAJOR),
+ minor_ (TAO_DEF_GIOP_MINOR)
+{
+}
+
+TAO_DIOP_Protocol_Factory::~TAO_DIOP_Protocol_Factory (void)
+{
+}
+
+int
+TAO_DIOP_Protocol_Factory::match_prefix (const ACE_CString &prefix)
+{
+ // Check for the proper prefix for this protocol.
+ return (ACE_OS::strcasecmp (prefix.c_str (), ::the_prefix) == 0);
+}
+
+const char *
+TAO_DIOP_Protocol_Factory::prefix (void) const
+{
+ return ::the_prefix;
+}
+
+char
+TAO_DIOP_Protocol_Factory::options_delimiter (void) const
+{
+ return '/';
+}
+
+TAO_Acceptor *
+TAO_DIOP_Protocol_Factory::make_acceptor (void)
+{
+ TAO_Acceptor *acceptor = 0;
+
+ ACE_NEW_RETURN (acceptor,
+ TAO_DIOP_Acceptor,
+ 0);
+
+ return acceptor;
+}
+
+int
+TAO_DIOP_Protocol_Factory::init (int /* argc */,
+ ACE_TCHAR* /* argv */ [])
+{
+ return 0;
+}
+
+TAO_Connector *
+TAO_DIOP_Protocol_Factory::make_connector (void)
+{
+ TAO_Connector *connector = 0;
+
+ ACE_NEW_RETURN (connector,
+ TAO_DIOP_Connector,
+ 0);
+ return connector;
+}
+
+int
+TAO_DIOP_Protocol_Factory::requires_explicit_endpoint (void) const
+{
+ // This switch is actually meant to distinguish between pluggable
+ // protocols which are able to clean up their endpoints and such
+ // that aren't. E.g. UIOP will leave files, it therefore returns 1,
+ // IIOP cleans up its endpoint resources, which therefore return 0.
+ //
+ // DIOP does clean up endpoint resources, but as DIOP is only
+ // suitable for special environments, e.g. it supports only one-ways,
+ // it returns 1 for an other reason than resource clean-up.
+
+ return 1;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DEFINE (TAO_DIOP_Protocol_Factory,
+ ACE_TEXT ("DIOP_Factory"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (TAO_DIOP_Protocol_Factory),
+ ACE_Service_Type::DELETE_THIS |
+ ACE_Service_Type::DELETE_OBJ,
+ 0)
+
+ACE_FACTORY_DEFINE (TAO_Strategies, TAO_DIOP_Protocol_Factory)
+
+#endif /* TAO_HAS_DIOP && TAO_HAS_DIOP != 0 */
diff --git a/TAO/tao/Strategies/DIOP_Factory.h b/TAO/tao/Strategies/DIOP_Factory.h
new file mode 100644
index 00000000000..011900bb655
--- /dev/null
+++ b/TAO/tao/Strategies/DIOP_Factory.h
@@ -0,0 +1,87 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file DIOP_Factory.h
+ *
+ * $Id$
+ *
+ * @author Michael Kircher
+ */
+//=============================================================================
+
+
+#ifndef TAO_DIOP_FACTORY_H
+#define TAO_DIOP_FACTORY_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if defined (TAO_HAS_DIOP) && (TAO_HAS_DIOP != 0)
+
+#include "tao/Strategies/strategies_export.h"
+#include "tao/Protocol_Factory.h"
+#include "ace/Service_Config.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Acceptor;
+class TAO_Connector;
+
+class TAO_Strategies_Export TAO_DIOP_Protocol_Factory
+ : public TAO_Protocol_Factory
+{
+public:
+ /// Constructor.
+ TAO_DIOP_Protocol_Factory (void);
+
+ /// Destructor.
+ virtual ~TAO_DIOP_Protocol_Factory (void);
+
+ // = Service Configurator hooks.
+ /// Dynamic linking hook
+ virtual int init (int argc, ACE_TCHAR* argv[]);
+
+ /// Verify prefix is a match
+ virtual int match_prefix (const ACE_CString &prefix);
+
+ /// Returns the prefix used by the protocol.
+ virtual const char *prefix (void) const;
+
+ /// Return the character used to mark where an endpoint ends and
+ /// where its options begin.
+ virtual char options_delimiter (void) const;
+
+ /**
+ * @name Protocol factory methods
+ *
+ * Check Protocol_Factory.h for a description of these methods.
+ */
+ //@{
+ virtual TAO_Acceptor *make_acceptor (void);
+ virtual TAO_Connector *make_connector (void);
+ virtual int requires_explicit_endpoint (void) const;
+ //@}
+
+private:
+ /// Changing the version number can be used to provide backwards
+ /// compatibility with old clients.
+ int major_;
+ int minor_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE (TAO_DIOP_Protocol_Factory)
+ACE_FACTORY_DECLARE (TAO_Strategies, TAO_DIOP_Protocol_Factory)
+
+#endif /* TAO_HAS_DIOP && TAO_HAS_DIOP != 0 */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_DIOP_FACTORY_H */
diff --git a/TAO/tao/Strategies/DIOP_Profile.cpp b/TAO/tao/Strategies/DIOP_Profile.cpp
new file mode 100644
index 00000000000..cfe07e382d7
--- /dev/null
+++ b/TAO/tao/Strategies/DIOP_Profile.cpp
@@ -0,0 +1,478 @@
+// $Id$
+
+#include "tao/Strategies/DIOP_Profile.h"
+
+#if defined (TAO_HAS_DIOP) && (TAO_HAS_DIOP != 0)
+
+#include "tao/CDR.h"
+#include "tao/Environment.h"
+#include "tao/ORB.h"
+#include "tao/ORB_Core.h"
+#include "tao/debug.h"
+#include "tao/IIOP_EndpointsC.h"
+
+#include "ace/OS_NS_stdio.h"
+#include "ace/OS_NS_string.h"
+#include "ace/os_include/os_netdb.h"
+
+ACE_RCSID (Strategies,
+ DIOP_Profile,
+ "$Id$")
+
+static const char the_prefix[] = "diop";
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+const char TAO_DIOP_Profile::object_key_delimiter_ = '/';
+
+char
+TAO_DIOP_Profile::object_key_delimiter (void) const
+{
+ return TAO_DIOP_Profile::object_key_delimiter_;
+}
+
+
+TAO_DIOP_Profile::TAO_DIOP_Profile (const ACE_INET_Addr &addr,
+ const TAO::ObjectKey &object_key,
+ const TAO_GIOP_Message_Version &version,
+ TAO_ORB_Core *orb_core)
+ : TAO_Profile (TAO_TAG_DIOP_PROFILE,
+ orb_core,
+ object_key,
+ version),
+ endpoint_ (addr,
+ orb_core->orb_params ()->use_dotted_decimal_addresses ()),
+ count_ (1)
+{
+}
+
+TAO_DIOP_Profile::TAO_DIOP_Profile (const char* host,
+ CORBA::UShort port,
+ const TAO::ObjectKey &object_key,
+ const ACE_INET_Addr &addr,
+ const TAO_GIOP_Message_Version &version,
+ TAO_ORB_Core *orb_core)
+ : TAO_Profile (TAO_TAG_DIOP_PROFILE,
+ orb_core,
+ object_key,
+ version),
+ endpoint_ (host, port, addr),
+ count_ (1)
+{
+}
+
+TAO_DIOP_Profile::TAO_DIOP_Profile (TAO_ORB_Core *orb_core)
+ : TAO_Profile (TAO_TAG_DIOP_PROFILE,
+ orb_core,
+ TAO_GIOP_Message_Version (TAO_DEF_GIOP_MAJOR, TAO_DEF_GIOP_MINOR)),
+ endpoint_ (),
+ count_ (1)
+{
+}
+
+TAO_DIOP_Profile::~TAO_DIOP_Profile (void)
+{
+ // Clean up the list of endpoints since we own it.
+ // Skip the head, since it is not dynamically allocated.
+ TAO_Endpoint *tmp = 0;
+
+ for (TAO_Endpoint *next = this->endpoint ()->next ();
+ next != 0;
+ next = tmp)
+ {
+ tmp = next->next ();
+ delete next;
+ }
+}
+
+// return codes:
+// -1 -> error
+// 0 -> can't understand this version
+// 1 -> success.
+
+int
+TAO_DIOP_Profile::decode_profile (TAO_InputCDR& cdr)
+{
+ // @@ NOTE: This code is repeated thrice. Need to factor out in a
+ // better manner.
+ // Decode host and port into the <endpoint_>.
+ if (cdr.read_string (this->endpoint_.host_.out ()) == 0
+ || cdr.read_ushort (this->endpoint_.port_) == 0)
+ {
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) DIOP_Profile::decode - ")
+ ACE_TEXT ("error while decoding host/port")));
+ return -1;
+ }
+
+ if (cdr.good_bit ())
+ {
+ // Invalidate the object_addr_ until first access.
+ this->endpoint_.object_addr_.set_type (-1);
+
+ return 1;
+ }
+
+ return -1;
+}
+
+void
+TAO_DIOP_Profile::parse_string_i (const char *ior
+ ACE_ENV_ARG_DECL)
+{
+ // Pull off the "hostname:port/" part of the objref
+ // Copy the string because we are going to modify it...
+ const char *okd =
+ ACE_OS::strchr (ior, this->object_key_delimiter_);
+
+ if (okd == 0 || okd == ior)
+ {
+ // No object key delimiter or no hostname specified.
+ ACE_THROW (CORBA::INV_OBJREF (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ EINVAL),
+ CORBA::COMPLETED_NO));
+ }
+
+ // Length of host string.
+ CORBA::ULong length_host = 0;
+
+ const char *cp_pos = ACE_OS::strchr (ior, ':'); // Look for a port
+
+ if (cp_pos == ior)
+ {
+ // No hostname specified! It is required by the spec.
+ ACE_THROW (CORBA::INV_OBJREF (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ EINVAL),
+ CORBA::COMPLETED_NO));
+ }
+ else if (cp_pos != 0)
+ {
+ // A port number or port name was specified.
+ CORBA::ULong length_port = okd - cp_pos - 1;
+
+ CORBA::String_var tmp = CORBA::string_alloc (length_port);
+
+ ACE_OS::strncpy (tmp.inout (), cp_pos + 1, length_port);
+ tmp[length_port] = '\0';
+
+ this->endpoint_.port_ =
+ static_cast<CORBA::UShort> (ACE_OS::atoi (tmp.in ()));
+
+ length_host = cp_pos - ior;
+ }
+ else
+ length_host = okd - ior;
+
+ CORBA::String_var tmp = CORBA::string_alloc (length_host);
+
+ // Skip the trailing '/'
+ ACE_OS::strncpy (tmp.inout (), ior, length_host);
+ tmp[length_host] = '\0';
+
+ this->endpoint_.host_ = tmp._retn ();
+
+ if (ACE_OS::strcmp (this->endpoint_.host_.in (), "") == 0)
+ {
+ ACE_INET_Addr host_addr;
+
+ char tmp_host [MAXHOSTNAMELEN + 1];
+
+ // If no host is specified: assign the default host, i.e. the
+ // local host.
+ if (host_addr.get_host_name (tmp_host,
+ sizeof (tmp_host)) != 0)
+ {
+ // Can't get the IP address since the INET_Addr wasn't
+ // initialized. Just throw an exception.
+
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("\n\nTAO (%P|%t) ")
+ ACE_TEXT ("IIOP_Profile::parse_string ")
+ ACE_TEXT ("- %p\n\n"),
+ ACE_TEXT ("cannot determine hostname")));
+
+ // @@ What's the right exception to throw here?
+ ACE_THROW (CORBA::INV_OBJREF (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ EINVAL),
+ CORBA::COMPLETED_NO));
+ }
+ else
+ this->endpoint_.host_ = CORBA::string_dup (tmp_host);
+ }
+
+ TAO::ObjectKey ok;
+ TAO::ObjectKey::decode_string_to_sequence (ok,
+ okd + 1);
+
+ (void) this->orb_core ()->object_key_table ().bind (ok,
+ this->ref_object_key_);
+}
+
+CORBA::Boolean
+TAO_DIOP_Profile::do_is_equivalent (const TAO_Profile *other_profile)
+{
+ const TAO_DIOP_Profile *op =
+ dynamic_cast<const TAO_DIOP_Profile *> (other_profile);
+
+ // Check endpoints equivalence.
+ const TAO_DIOP_Endpoint *other_endp = &op->endpoint_;
+ for (TAO_DIOP_Endpoint *endp = &this->endpoint_;
+ endp != 0;
+ endp = endp->next_)
+ {
+ if (endp->is_equivalent (other_endp))
+ other_endp = other_endp->next_;
+ else
+ return false;
+ }
+
+ return true;
+}
+
+CORBA::ULong
+TAO_DIOP_Profile::hash (CORBA::ULong max
+ ACE_ENV_ARG_DECL_NOT_USED)
+{
+ // Get the hashvalue for all endpoints.
+ CORBA::ULong hashval = 0;
+ for (TAO_DIOP_Endpoint *endp = &this->endpoint_;
+ endp != 0;
+ endp = endp->next_)
+ {
+ hashval += endp->hash ();
+ }
+
+ hashval += this->version_.minor;
+ hashval += this->tag ();
+
+ const TAO::ObjectKey &ok =
+ this->ref_object_key_->object_key ();
+
+ if (ok.length () >= 4)
+ {
+ hashval += ok[1];
+ hashval += ok[3];
+ }
+
+ hashval += this->hash_service_i (max);
+
+ return hashval % max;
+}
+
+TAO_Endpoint*
+TAO_DIOP_Profile::endpoint (void)
+{
+ return &this->endpoint_;
+}
+
+CORBA::ULong
+TAO_DIOP_Profile::endpoint_count (void) const
+{
+ return this->count_;
+}
+
+void
+TAO_DIOP_Profile::add_endpoint (TAO_DIOP_Endpoint *endp)
+{
+ endp->next_ = this->endpoint_.next_;
+ this->endpoint_.next_ = endp;
+
+ this->count_++;
+}
+
+char *
+TAO_DIOP_Profile::to_string (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+{
+ CORBA::String_var key;
+ TAO::ObjectKey::encode_sequence_to_string (key.inout(),
+ this->ref_object_key_->object_key ());
+
+ size_t buflen = (8 /* "corbaloc" */ +
+ 1 /* colon separator */ +
+ ACE_OS::strlen (::the_prefix) +
+ 1 /* colon separator */ +
+ 1 /* major version */ +
+ 1 /* decimal point */ +
+ 1 /* minor version */ +
+ 1 /* `@' character */ +
+ ACE_OS::strlen (this->endpoint_.host ()) +
+ 1 /* colon separator */ +
+ 5 /* port number */ +
+ 1 /* object key separator */ +
+ ACE_OS::strlen (key.in ()));
+
+ char * buf = CORBA::string_alloc (static_cast<CORBA::ULong> (buflen));
+
+ static const char digits [] = "0123456789";
+
+ ACE_OS::sprintf (buf,
+ "corbaloc:%s:%c.%c@%s:%d%c%s",
+ ::the_prefix,
+ digits [this->version_.major],
+ digits [this->version_.minor],
+ this->endpoint_.host (),
+ this->endpoint_.port (),
+ this->object_key_delimiter_,
+ key.in ());
+
+ return buf;
+}
+
+const char *
+TAO_DIOP_Profile::prefix (void)
+{
+ return ::the_prefix;
+}
+
+void
+TAO_DIOP_Profile::create_profile_body (TAO_OutputCDR &encap) const
+{
+ encap.write_octet (TAO_ENCAP_BYTE_ORDER);
+
+ // The GIOP version
+ encap.write_octet (this->version_.major);
+ encap.write_octet (this->version_.minor);
+
+ // STRING hostname from profile
+ encap.write_string (this->endpoint_.host ());
+
+ // UNSIGNED SHORT port number
+ encap.write_ushort (this->endpoint_.port ());
+
+ // OCTET SEQUENCE for object key
+ if (this->ref_object_key_)
+ encap << this->ref_object_key_->object_key ();
+ else
+ {
+ ACE_ERROR ((LM_ERROR,
+ "(%P|%t) TAO - UIOP_Profile::create_profile_body "
+ "no object key marshalled \n"));
+ }
+
+ if (this->version_.major > 1
+ || this->version_.minor > 0)
+ this->tagged_components ().encode (encap);
+}
+
+int
+TAO_DIOP_Profile::encode_endpoints (void)
+{
+ // Create a data structure and fill it with endpoint info for wire
+ // transfer.
+ // We include information for the head of the list
+ // together with other endpoints because even though its addressing
+ // info is transmitted using standard ProfileBody components, its
+ // priority is not!
+
+ TAO::IIOPEndpointSequence endpoints;
+ endpoints.length (this->count_);
+
+ const TAO_DIOP_Endpoint *endpoint = &this->endpoint_;
+ for (CORBA::ULong i = 0;
+ i < this->count_;
+ ++i)
+ {
+ endpoints[i].host = endpoint->host ();
+ endpoints[i].port = endpoint->port ();
+ endpoints[i].priority = endpoint->priority ();
+
+ endpoint = endpoint->next_;
+ }
+
+ // Encode the data structure.
+ TAO_OutputCDR out_cdr;
+ if ((out_cdr << ACE_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER)
+ == 0)
+ || (out_cdr << endpoints) == 0)
+ return -1;
+ size_t length = out_cdr.total_length ();
+
+ IOP::TaggedComponent tagged_component;
+ tagged_component.tag = TAO_TAG_ENDPOINTS;
+ tagged_component.component_data.length (static_cast<CORBA::ULong> (length));
+ CORBA::Octet *buf =
+ tagged_component.component_data.get_buffer ();
+
+ for (const ACE_Message_Block *iterator = out_cdr.begin ();
+ iterator != 0;
+ iterator = iterator->cont ())
+ {
+ size_t i_length = iterator->length ();
+ ACE_OS::memcpy (buf, iterator->rd_ptr (), i_length);
+
+ buf += i_length;
+ }
+
+ // Add component with encoded endpoint data to this profile's
+ // TaggedComponents.
+ tagged_components_.set_component (tagged_component);
+
+ return 0;
+}
+
+int
+TAO_DIOP_Profile::decode_endpoints (void)
+{
+ IOP::TaggedComponent tagged_component;
+ tagged_component.tag = TAO_TAG_ENDPOINTS;
+
+ if (this->tagged_components_.get_component (tagged_component))
+ {
+ const CORBA::Octet *buf =
+ tagged_component.component_data.get_buffer ();
+
+ TAO_InputCDR in_cdr (reinterpret_cast<const char*> (buf),
+ tagged_component.component_data.length ());
+
+ // Extract the Byte Order.
+ CORBA::Boolean byte_order;
+ if ((in_cdr >> ACE_InputCDR::to_boolean (byte_order)) == 0)
+ return -1;
+ in_cdr.reset_byte_order (static_cast<int> (byte_order));
+
+ // Extract endpoints sequence.
+ TAO::IIOPEndpointSequence endpoints;
+
+ if ((in_cdr >> endpoints) == 0)
+ return -1;
+
+ // Get the priority of the first endpoint (head of the list.
+ // It's other data is extracted as part of the standard profile
+ // decoding.
+ this->endpoint_.priority (endpoints[0].priority);
+
+ // Use information extracted from the tagged component to
+ // populate the profile. Skip the first endpoint, since it is
+ // always extracted through standard profile body. Also, begin
+ // from the end of the sequence to preserve endpoint order,
+ // since <add_endpoint> method reverses the order of endpoints
+ // in the list.
+ for (CORBA::ULong i = endpoints.length () - 1;
+ i > 0;
+ --i)
+ {
+ TAO_DIOP_Endpoint *endpoint = 0;
+ ACE_NEW_RETURN (endpoint,
+ TAO_DIOP_Endpoint (endpoints[i].host,
+ endpoints[i].port,
+ endpoints[i].priority),
+ -1);
+
+ this->add_endpoint (endpoint);
+ }
+ }
+
+ return 0;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_DIOP && TAO_HAS_DIOP != 0 */
diff --git a/TAO/tao/Strategies/DIOP_Profile.h b/TAO/tao/Strategies/DIOP_Profile.h
new file mode 100644
index 00000000000..f2c670042dd
--- /dev/null
+++ b/TAO/tao/Strategies/DIOP_Profile.h
@@ -0,0 +1,132 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file DIOP_Profile.h
+ *
+ * $Id$
+ *
+ * DIOP profile specific processing
+ *
+ *
+ * @author Michael Kircher
+ */
+//=============================================================================
+
+
+#ifndef TAO_DIOP_PROFILE_H
+#define TAO_DIOP_PROFILE_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if defined (TAO_HAS_DIOP) && (TAO_HAS_DIOP != 0)
+
+#include "tao/Strategies/DIOP_Endpoint.h"
+#include "tao/Profile.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// TAO DIOP_Profile concrete Profile definitions
+/**
+ * @class TAO_DIOP_Profile
+ *
+ * @brief This class defines the protocol specific attributes required
+ * for locating ORBs over a TCP/IP network.
+ *
+ * This class defines the DIOP profile as specified in the CORBA
+ * specification.
+ */
+class TAO_Strategies_Export TAO_DIOP_Profile : public TAO_Profile
+{
+public:
+ /// The object key delimiter that DIOP uses or expects.
+ static const char object_key_delimiter_;
+ virtual char object_key_delimiter (void) const;
+
+ /// Return the char string prefix.
+ static const char *prefix (void);
+
+ /// Profile constructor, same as above except the object_key has
+ /// already been marshaled.
+ TAO_DIOP_Profile (const ACE_INET_Addr &addr,
+ const TAO::ObjectKey &object_key,
+ const TAO_GIOP_Message_Version &version,
+ TAO_ORB_Core *orb_core);
+
+ /// Profile constructor, this is the most efficient since it
+ /// doesn't require any address resolution processing.
+ TAO_DIOP_Profile (const char *host,
+ CORBA::UShort port,
+ const TAO::ObjectKey &object_key,
+ const ACE_INET_Addr &addr,
+ const TAO_GIOP_Message_Version &version,
+ TAO_ORB_Core *orb_core);
+
+
+ /// Profile constructor, default.
+ TAO_DIOP_Profile (TAO_ORB_Core *orb_core);
+
+ /// Destructor is to be called only through <_decr_refcnt>.
+ ~TAO_DIOP_Profile (void);
+
+
+ /// Template methods. Please tao/Profile.h for documentation.
+ virtual char * to_string (ACE_ENV_SINGLE_ARG_DECL);
+ virtual int encode_endpoints (void);
+ virtual TAO_Endpoint *endpoint (void);
+ virtual CORBA::ULong endpoint_count (void) const;
+ virtual CORBA::ULong hash (CORBA::ULong max
+ ACE_ENV_ARG_DECL);
+ /**
+ * Add <endp> to this profile's list of endpoints (it is inserted
+ * next to the head of the list). This profiles takes ownership of
+ * <endp>.
+ */
+ void add_endpoint (TAO_DIOP_Endpoint *endp);
+
+protected:
+
+ /// Template methods. Please see tao/Profile.h for documentation.
+ virtual int decode_profile (TAO_InputCDR& cdr);
+ virtual void parse_string_i (const char *string
+ ACE_ENV_ARG_DECL);
+ virtual void create_profile_body (TAO_OutputCDR &cdr) const;
+ virtual int decode_endpoints (void);
+ virtual CORBA::Boolean do_is_equivalent (const TAO_Profile *other_profile);
+
+protected:
+
+ /**
+ * Head of this profile's list of endpoints. This endpoint is not
+ * dynamically allocated because a profile always contains at least
+ * one endpoint.
+ *
+ * Currently, a profile contains more than one endpoint, i.e.,
+ * list contains more than just the head, only when RTCORBA is enabled.
+ * However, in the near future, this will be used in nonRT
+ * mode as well, e.g., to support TAG_ALTERNATE_DIOP_ADDRESS
+ * feature.
+ * Addressing info of the default endpoint, i.e., head of the list,
+ * is transmitted using standard DIOP ProfileBody components. See
+ * <encode_endpoints> method documentation above for how the rest of
+ * the endpoint list is transmitted.
+ */
+ TAO_DIOP_Endpoint endpoint_;
+
+ /// Number of endpoints in the list headed by <endpoint_>.
+ CORBA::ULong count_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_DIOP && TAO_HAS_DIOP != 0 */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_DIOP_PROFILE_H */
diff --git a/TAO/tao/Strategies/DIOP_Transport.cpp b/TAO/tao/Strategies/DIOP_Transport.cpp
new file mode 100644
index 00000000000..22de0661c8a
--- /dev/null
+++ b/TAO/tao/Strategies/DIOP_Transport.cpp
@@ -0,0 +1,355 @@
+// $Id$
+
+#include "tao/Strategies/DIOP_Transport.h"
+
+#if defined (TAO_HAS_DIOP) && (TAO_HAS_DIOP != 0)
+
+#include "tao/Strategies/DIOP_Connection_Handler.h"
+#include "tao/Strategies/DIOP_Acceptor.h"
+#include "tao/Strategies/DIOP_Profile.h"
+#include "tao/Acceptor_Registry.h"
+#include "tao/operation_details.h"
+#include "tao/Timeprobe.h"
+#include "tao/CDR.h"
+#include "tao/Transport_Mux_Strategy.h"
+#include "tao/Wait_Strategy.h"
+#include "tao/Stub.h"
+#include "tao/ORB_Core.h"
+#include "tao/debug.h"
+#include "tao/Resume_Handle.h"
+#include "tao/GIOP_Message_Base.h"
+#include "tao/GIOP_Message_Lite.h"
+
+ACE_RCSID (tao, DIOP_Transport, "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_DIOP_Transport::TAO_DIOP_Transport (TAO_DIOP_Connection_Handler *handler,
+ TAO_ORB_Core *orb_core,
+ CORBA::Boolean flag)
+ : TAO_Transport (TAO_TAG_DIOP_PROFILE,
+ orb_core)
+ , connection_handler_ (handler)
+ , messaging_object_ (0)
+{
+/*
+ * Hook to customize the messaging object when the concrete messaging
+ * object is known a priori. In this case, the flag is ignored.
+ */
+//@@ MESSAGING_SPL_COMMENT_HOOK_START
+
+ // @@ Michael: Set the input CDR size to ACE_MAX_DGRAM_SIZE so that
+ // we read the whole UDP packet on a single read.
+ if (flag)
+ {
+ // Use the lite version of the protocol
+ ACE_NEW (this->messaging_object_,
+ TAO_GIOP_Message_Lite (orb_core,
+ ACE_MAX_DGRAM_SIZE));
+ }
+ else
+ {
+ // Use the normal GIOP object
+ ACE_NEW (this->messaging_object_,
+ TAO_GIOP_Message_Base (orb_core,
+ this,
+ ACE_MAX_DGRAM_SIZE));
+ }
+
+//@@ MESSAGING_SPL_COMMENT_HOOK_END
+
+}
+
+TAO_DIOP_Transport::~TAO_DIOP_Transport (void)
+{
+ delete this->messaging_object_;
+}
+
+ACE_Event_Handler *
+TAO_DIOP_Transport::event_handler_i (void)
+{
+ return this->connection_handler_;
+}
+
+TAO_Connection_Handler *
+TAO_DIOP_Transport::connection_handler_i (void)
+{
+ return this->connection_handler_;
+}
+
+TAO_Pluggable_Messaging *
+TAO_DIOP_Transport::messaging_object (void)
+{
+ return this->messaging_object_;
+}
+
+ssize_t
+TAO_DIOP_Transport::send (iovec *iov, int iovcnt,
+ size_t &bytes_transferred,
+ const ACE_Time_Value *)
+{
+ const ACE_INET_Addr &addr = this->connection_handler_->addr ();
+
+ ssize_t bytes_to_send = 0;
+ for (int i = 0; i < iovcnt; i++)
+ bytes_to_send += iov[i].iov_len;
+
+ this->connection_handler_->dgram ().send (iov,
+ iovcnt,
+ addr);
+ // @@ Michael:
+ // Always return a positive number of bytes sent, as we do
+ // not handle sending errors in DIOP.
+
+ bytes_transferred = bytes_to_send;
+
+ return 1;
+}
+
+ssize_t
+TAO_DIOP_Transport::recv (char *buf,
+ size_t len,
+ const ACE_Time_Value * /* max_wait_time */)
+{
+ ACE_INET_Addr from_addr;
+
+ ssize_t n = this->connection_handler_->dgram ().recv (buf,
+ len,
+ from_addr);
+
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO_DIOP_Transport::recv_i: received %d bytes from %s:%d %d\n",
+ n,
+ ACE_TEXT_CHAR_TO_TCHAR (from_addr.get_host_name ()),
+ from_addr.get_port_number (),
+ errno));
+ }
+
+ // Most of the errors handling is common for
+ // Now the message has been read
+ if (n == -1 && TAO_debug_level > 4)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - %p \n"),
+ ACE_TEXT ("TAO - read message failure ")
+ ACE_TEXT ("recv () \n")));
+ }
+
+ // Error handling
+ if (n == -1)
+ {
+ if (errno == EWOULDBLOCK)
+ return 0;
+
+ return -1;
+ }
+ // @@ What are the other error handling here??
+ else if (n == 0)
+ {
+ return -1;
+ }
+
+ // Remember the from addr to eventually use it as remote
+ // addr for the reply.
+ this->connection_handler_->addr (from_addr);
+
+ return n;
+}
+
+int
+TAO_DIOP_Transport::handle_input (TAO_Resume_Handle &rh,
+ ACE_Time_Value *max_wait_time,
+ int /*block*/)
+{
+ // If there are no messages then we can go ahead to read from the
+ // handle for further reading..
+
+ // The buffer on the stack which will be used to hold the input
+ // messages
+ char buf [ACE_MAX_DGRAM_SIZE + ACE_CDR::MAX_ALIGNMENT];
+
+#if defined (ACE_INITIALIZE_MEMORY_BEFORE_USE)
+ (void) ACE_OS::memset (buf,
+ '\0',
+ sizeof buf);
+#endif /* ACE_INITIALIZE_MEMORY_BEFORE_USE */
+
+ // Create a data block
+ ACE_Data_Block db (sizeof (buf),
+ ACE_Message_Block::MB_DATA,
+ buf,
+ this->orb_core_->input_cdr_buffer_allocator (),
+ this->orb_core_->locking_strategy (),
+ ACE_Message_Block::DONT_DELETE,
+ this->orb_core_->input_cdr_dblock_allocator ());
+
+ // Create a message block
+ ACE_Message_Block message_block (&db,
+ ACE_Message_Block::DONT_DELETE,
+ this->orb_core_->input_cdr_msgblock_allocator ());
+
+
+ // Align the message block
+ ACE_CDR::mb_align (&message_block);
+
+
+ // Read the message into the message block that we have created on
+ // the stack.
+ ssize_t n = this->recv (message_block.rd_ptr (),
+ message_block.space (),
+ max_wait_time);
+
+ // If there is an error return to the reactor..
+ if (n <= 0)
+ {
+ if (n == -1)
+ this->tms_->connection_closed ();
+
+ return n;
+ }
+
+ // Set the write pointer in the stack buffer
+ message_block.wr_ptr (n);
+
+ // Make a node of the message block..
+ TAO_Queued_Data qd (&message_block);
+ size_t mesg_length;
+
+ // Parse the incoming message for validity. The check needs to be
+ // performed by the messaging objects.
+ if (this->messaging_object ()->parse_next_message (message_block,
+ qd,
+ mesg_length) == -1)
+ return -1;
+
+ if (qd.missing_data_ == TAO_MISSING_DATA_UNDEFINED)
+ {
+ // parse/marshal error
+ return -1;
+ }
+
+ if (message_block.length () > mesg_length)
+ {
+ // we read too much data
+ return -1;
+ }
+
+ // NOTE: We are not performing any queueing nor any checking for
+ // missing data. We are assuming that ALL the data would be got in a
+ // single read.
+
+ // Process the message
+ return this->process_parsed_messages (&qd, rh);
+}
+
+
+int
+TAO_DIOP_Transport::register_handler (void)
+{
+ // @@ Michael:
+ //
+ // We do never register register the handler with the reactor
+ // as we never need to be informed about any incoming data,
+ // assuming we only use one-ways.
+ // If we would register and ICMP Messages would arrive, e.g
+ // due to a not reachable server, we would get informed - as this
+ // disturbs the general DIOP assumptions of not being
+ // interested in any network failures, we ignore ICMP messages.
+ return 0;
+}
+
+
+int
+TAO_DIOP_Transport::send_request (TAO_Stub *stub,
+ TAO_ORB_Core *orb_core,
+ TAO_OutputCDR &stream,
+ int message_semantics,
+ ACE_Time_Value *max_wait_time)
+{
+ if (this->ws_->sending_request (orb_core,
+ message_semantics) == -1)
+ return -1;
+
+ if (this->send_message (stream,
+ stub,
+ message_semantics,
+ max_wait_time) == -1)
+
+ return -1;
+
+ this->first_request_sent();
+
+ return 0;
+}
+
+int
+TAO_DIOP_Transport::send_message (TAO_OutputCDR &stream,
+ TAO_Stub *stub,
+ int message_semantics,
+ ACE_Time_Value *max_wait_time)
+{
+ // Format the message in the stream first
+ if (this->messaging_object_->format_message (stream) != 0)
+ return -1;
+
+ // Strictly speaking, should not need to loop here because the
+ // socket never gets set to a nonblocking mode ... some Linux
+ // versions seem to need it though. Leaving it costs little.
+
+ // This guarantees to send all data (bytes) or return an error.
+ ssize_t n = this->send_message_shared (stub,
+ message_semantics,
+ stream.begin (),
+ max_wait_time);
+
+ if (n == -1)
+ {
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO: (%P|%t|%N|%l) closing transport %d after fault %p\n"),
+ this->id (),
+ ACE_TEXT ("send_message ()\n")));
+
+ return -1;
+ }
+
+ return 1;
+}
+
+int
+TAO_DIOP_Transport::send_message_shared (TAO_Stub *stub,
+ int message_semantics,
+ const ACE_Message_Block *message_block,
+ ACE_Time_Value *max_wait_time)
+{
+ int result;
+
+ {
+ ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->handler_lock_, -1);
+
+ result =
+ this->send_message_shared_i (stub, message_semantics,
+ message_block, max_wait_time);
+ }
+
+ if (result == -1)
+ {
+ this->close_connection ();
+ }
+
+ return result;
+}
+
+int
+TAO_DIOP_Transport::messaging_init (CORBA::Octet major,
+ CORBA::Octet minor)
+{
+ this->messaging_object_->init (major, minor);
+ return 1;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_DIOP && TAO_HAS_DIOP != 0 */
diff --git a/TAO/tao/Strategies/DIOP_Transport.h b/TAO/tao/Strategies/DIOP_Transport.h
new file mode 100644
index 00000000000..2cae623c67e
--- /dev/null
+++ b/TAO/tao/Strategies/DIOP_Transport.h
@@ -0,0 +1,133 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file DIOP_Transport.h
+ *
+ * $Id$
+ *
+ * @author Michael Kircher
+ */
+//=============================================================================
+
+#ifndef TAO_DIOP_TRANSPORT_H
+#define TAO_DIOP_TRANSPORT_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if defined (TAO_HAS_DIOP) && (TAO_HAS_DIOP != 0)
+
+#include "tao/Strategies/strategies_export.h"
+#include "tao/Transport.h"
+#include "ace/SOCK_Stream.h"
+#include "ace/Svc_Handler.h"
+
+#if defined ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT
+template class TAO_Strategies_Export ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH>;
+#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Forward decls.
+class TAO_DIOP_Connection_Handler;
+class TAO_ORB_Core;
+class TAO_Operation_Details;
+class TAO_Pluggable_Messaging;
+class TAO_Acceptor;
+
+// Service Handler for this transport
+typedef ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH>
+ TAO_DIOP_SVC_HANDLER;
+
+/**
+ * @class TAO_DIOP_Transport
+ *
+ * @brief Specialization of the base TAO_Transport class to handle the
+ * DIOP protocol.
+ */
+class TAO_Strategies_Export TAO_DIOP_Transport : public TAO_Transport
+{
+public:
+
+ /// Constructor.
+ TAO_DIOP_Transport (TAO_DIOP_Connection_Handler *handler,
+ TAO_ORB_Core *orb_core,
+ CORBA::Boolean flag);
+
+ /// Default destructor.
+ ~TAO_DIOP_Transport (void);
+
+ /// Look for the documentation in Transport.h.
+ virtual int handle_input (TAO_Resume_Handle &rh,
+ ACE_Time_Value *max_wait_time = 0,
+ int block = 0);
+protected:
+ /** @name Overridden Template Methods
+ *
+ * These are implementations of template methods declared by TAO_Transport.
+ */
+ //@{
+
+ virtual ACE_Event_Handler * event_handler_i (void);
+ virtual TAO_Connection_Handler *connection_handler_i (void);
+ virtual TAO_Pluggable_Messaging *messaging_object (void);
+
+ /// Write the complete Message_Block chain to the connection.
+ virtual ssize_t send (iovec *iov, int iovcnt,
+ size_t &bytes_transferred,
+ const ACE_Time_Value *max_wait_time);
+
+ /// Read len bytes from into buf.
+ virtual ssize_t recv (char *buf,
+ size_t len,
+ const ACE_Time_Value *s = 0);
+
+ virtual int send_message_shared (TAO_Stub *stub,
+ int message_semantics,
+ const ACE_Message_Block *message_block,
+ ACE_Time_Value *max_wait_time);
+
+ virtual int register_handler (void);
+
+ ///@}
+public:
+ /// @todo These methods IMHO should have more meaningful names.
+ /// The names seem to indicate nothing.
+ virtual int send_request (TAO_Stub *stub,
+ TAO_ORB_Core *orb_core,
+ TAO_OutputCDR &stream,
+ int message_semantics,
+ ACE_Time_Value *max_wait_time);
+
+ virtual int send_message (TAO_OutputCDR &stream,
+ TAO_Stub *stub = 0,
+ int message_semantics = TAO_Transport::TAO_TWOWAY_REQUEST,
+ ACE_Time_Value *max_time_wait = 0);
+
+ /// Initialising the messaging object
+ virtual int messaging_init (CORBA::Octet major,
+ CORBA::Octet minor);
+
+private:
+
+ /// The connection service handler used for accessing lower layer
+ /// communication protocols.
+ TAO_DIOP_Connection_Handler *connection_handler_;
+
+ /// Our messaging object.
+ TAO_Pluggable_Messaging *messaging_object_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_DIOP && TAO_HAS_DIOP != 0 */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_DIOP_TRANSPORT_H */
diff --git a/TAO/tao/Strategies/FIFO_Connection_Purging_Strategy.cpp b/TAO/tao/Strategies/FIFO_Connection_Purging_Strategy.cpp
new file mode 100644
index 00000000000..c973cee3a80
--- /dev/null
+++ b/TAO/tao/Strategies/FIFO_Connection_Purging_Strategy.cpp
@@ -0,0 +1,31 @@
+// $Id$
+
+#include "tao/Strategies/FIFO_Connection_Purging_Strategy.h"
+#include "tao/Transport.h"
+
+ACE_RCSID(tao, FIFO_Connection_Purging_Strategy, "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_FIFO_Connection_Purging_Strategy::TAO_FIFO_Connection_Purging_Strategy (
+ int cache_maximum)
+ : TAO_Connection_Purging_Strategy (cache_maximum),
+ // Initialized to 1 to insure that the transports purging_order
+ // is only 0 upon initialization.
+ order_ (1)
+{
+}
+
+void
+TAO_FIFO_Connection_Purging_Strategy::update_item (TAO_Transport* transport)
+{
+ // FIFO, so only update the purging order if this
+ // item has not been cached yet.
+ if (transport->purging_order () == 0)
+ {
+ transport->purging_order (this->order_++);
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Strategies/FIFO_Connection_Purging_Strategy.h b/TAO/tao/Strategies/FIFO_Connection_Purging_Strategy.h
new file mode 100644
index 00000000000..5deda35a567
--- /dev/null
+++ b/TAO/tao/Strategies/FIFO_Connection_Purging_Strategy.h
@@ -0,0 +1,57 @@
+// -*- C++ -*-
+
+// ================================================================
+/**
+ * @file FIFO_Connection_Purging_Strategy.h
+ *
+ * $Id$
+ *
+ * @author Chad Elliott (elliott_c@ociweb.com)
+ */
+// ================================================================
+
+#ifndef TAO_FIFO_PURGING_STRATEGY_H
+#define TAO_FIFO_PURGING_STRATEGY_H
+#include /**/ "ace/pre.h"
+
+#include "tao/Strategies/strategies_export.h"
+#include "tao/Connection_Purging_Strategy.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+// ****************************************************************
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_FIFO_Connection_Purging_Strategy
+ *
+ * @brief The First In First Out connection purging strategy
+ *
+ * This class maintains it's own count which is only applied to the
+ * item passed if it has not yet been cached. This way, each successive
+ * transport has a larger ordering number than the previous. This will
+ * cause the first transport to be purged first.
+ */
+
+class TAO_Strategies_Export TAO_FIFO_Connection_Purging_Strategy:
+ public TAO_Connection_Purging_Strategy
+{
+public:
+ /// The constructor
+ TAO_FIFO_Connection_Purging_Strategy (int cache_maximum);
+
+ /// Called when accessing an item from the cache
+ virtual void update_item (TAO_Transport* transport);
+
+private:
+ /// The ordering information for each transport in the cache
+ unsigned long order_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_FIFO_PURGING_STRATEGY_H */
diff --git a/TAO/tao/Strategies/LFU_Connection_Purging_Strategy.cpp b/TAO/tao/Strategies/LFU_Connection_Purging_Strategy.cpp
new file mode 100644
index 00000000000..c254f148637
--- /dev/null
+++ b/TAO/tao/Strategies/LFU_Connection_Purging_Strategy.cpp
@@ -0,0 +1,23 @@
+// $Id$
+
+#include "tao/Strategies/LFU_Connection_Purging_Strategy.h"
+#include "tao/Transport.h"
+
+ACE_RCSID(tao, LFU_Connection_Purging_Strategy, "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_LFU_Connection_Purging_Strategy::TAO_LFU_Connection_Purging_Strategy (
+ int cache_maximum)
+: TAO_Connection_Purging_Strategy (cache_maximum)
+{
+}
+
+void
+TAO_LFU_Connection_Purging_Strategy::update_item (TAO_Transport* transport)
+{
+ transport->purging_order (transport->purging_order () + 1);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Strategies/LFU_Connection_Purging_Strategy.h b/TAO/tao/Strategies/LFU_Connection_Purging_Strategy.h
new file mode 100644
index 00000000000..a0a6afbccaf
--- /dev/null
+++ b/TAO/tao/Strategies/LFU_Connection_Purging_Strategy.h
@@ -0,0 +1,52 @@
+// -*- C++ -*-
+
+// ================================================================
+/**
+ * @file LFU_Connection_Purging_Strategy.h
+ *
+ * $Id$
+ *
+ * @author Chad Elliott (elliott_c@ociweb.com)
+ */
+// ================================================================
+
+#ifndef TAO_LFU_PURGING_STRATEGY_H
+#define TAO_LFU_PURGING_STRATEGY_H
+#include /**/ "ace/pre.h"
+
+#include "tao/Strategies/strategies_export.h"
+#include "tao/Connection_Purging_Strategy.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+// ****************************************************************
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_LFU_Connection_Purging_Strategy
+ *
+ * @brief The Least Frequently Used connection purging strategy
+ *
+ * This class increments the order information on each item passed
+ * in. This way, the least frequently used transport has the
+ * smallest ordering number and will therefore be purged first.
+ */
+
+class TAO_Strategies_Export TAO_LFU_Connection_Purging_Strategy:
+ public TAO_Connection_Purging_Strategy
+{
+public:
+ /// The constructor
+ TAO_LFU_Connection_Purging_Strategy (int cache_maximum);
+
+ /// Called when accessing an item from the cache
+ virtual void update_item (TAO_Transport* transport);
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_LFU_PURGING_STRATEGY_H */
diff --git a/TAO/tao/Strategies/LF_Strategy_Null.cpp b/TAO/tao/Strategies/LF_Strategy_Null.cpp
new file mode 100644
index 00000000000..67c5f5e0871
--- /dev/null
+++ b/TAO/tao/Strategies/LF_Strategy_Null.cpp
@@ -0,0 +1,36 @@
+// $Id$
+
+#include "tao/Strategies/LF_Strategy_Null.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/Strategies/LF_Strategy_Null.inl"
+#endif /* __ACE_INLINE__ */
+
+ACE_RCSID(tao, LF_Strategy_Null, "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_LF_Strategy_Null::~TAO_LF_Strategy_Null (void)
+{
+}
+
+void
+TAO_LF_Strategy_Null::set_upcall_thread (TAO_Leader_Follower &)
+{
+}
+
+int
+TAO_LF_Strategy_Null::set_event_loop_thread (ACE_Time_Value *,
+ TAO_Leader_Follower &)
+{
+ return 0;
+}
+
+void
+TAO_LF_Strategy_Null::reset_event_loop_thread (int,
+ TAO_Leader_Follower &)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Strategies/LF_Strategy_Null.h b/TAO/tao/Strategies/LF_Strategy_Null.h
new file mode 100644
index 00000000000..18ba5632ad0
--- /dev/null
+++ b/TAO/tao/Strategies/LF_Strategy_Null.h
@@ -0,0 +1,60 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file LF_Strategy_Null.h
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan <coryan@uci.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_LF_STRATEGY_NULL_H
+#define TAO_LF_STRATEGY_NULL_H
+#include /**/ "ace/pre.h"
+
+#include "tao/Strategies/strategies_export.h"
+#include "tao/LF_Strategy.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_LF_Strategy_Null
+ *
+ * @brief A concrete TAO_LF_Strategy for ORB configurations that do
+ * not use the Leader/Followers event loop.
+ */
+class TAO_Strategies_Export TAO_LF_Strategy_Null : public TAO_LF_Strategy
+{
+public:
+ /// Constructor
+ TAO_LF_Strategy_Null (void);
+
+ //@{
+ /** @name Virtual Methods
+ *
+ * Please check the documentation in TAO_LF_Strategy
+ */
+ virtual ~TAO_LF_Strategy_Null (void);
+
+ virtual void set_upcall_thread (TAO_Leader_Follower &);
+ virtual int set_event_loop_thread (ACE_Time_Value *max_wait_time,
+ TAO_Leader_Follower &);
+ virtual void reset_event_loop_thread (int call_reset,
+ TAO_Leader_Follower &);
+ //@}
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/Strategies/LF_Strategy_Null.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_LF_STRATEGY_NULL_H */
diff --git a/TAO/tao/Strategies/LF_Strategy_Null.inl b/TAO/tao/Strategies/LF_Strategy_Null.inl
new file mode 100644
index 00000000000..c073be304e7
--- /dev/null
+++ b/TAO/tao/Strategies/LF_Strategy_Null.inl
@@ -0,0 +1,6 @@
+// $Id$
+
+ACE_INLINE
+TAO_LF_Strategy_Null::TAO_LF_Strategy_Null (void)
+{
+}
diff --git a/TAO/tao/Strategies/NULL_Connection_Purging_Strategy.cpp b/TAO/tao/Strategies/NULL_Connection_Purging_Strategy.cpp
new file mode 100644
index 00000000000..4c49b8ee312
--- /dev/null
+++ b/TAO/tao/Strategies/NULL_Connection_Purging_Strategy.cpp
@@ -0,0 +1,27 @@
+// $Id$
+
+#include "tao/Strategies/NULL_Connection_Purging_Strategy.h"
+#include "tao/Transport.h"
+
+ACE_RCSID(tao, NULL_Connection_Purging_Strategy, "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_NULL_Connection_Purging_Strategy::TAO_NULL_Connection_Purging_Strategy (
+ int cache_maximum)
+ : TAO_Connection_Purging_Strategy (cache_maximum)
+{
+}
+
+void
+TAO_NULL_Connection_Purging_Strategy::update_item (TAO_Transport*)
+{
+}
+
+int
+TAO_NULL_Connection_Purging_Strategy::cache_maximum (void) const
+{
+ return -1;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Strategies/NULL_Connection_Purging_Strategy.h b/TAO/tao/Strategies/NULL_Connection_Purging_Strategy.h
new file mode 100644
index 00000000000..2da2ceb6e0e
--- /dev/null
+++ b/TAO/tao/Strategies/NULL_Connection_Purging_Strategy.h
@@ -0,0 +1,52 @@
+// -*- C++ -*-
+
+// ================================================================
+/**
+ * @file NULL_Connection_Purging_Strategy.h
+ *
+ * $Id$
+ *
+ * @author Chad Elliott (elliott_c@ociweb.com)
+ */
+// ================================================================
+
+#ifndef TAO_NULL_PURGING_STRATEGY_H
+#define TAO_NULL_PURGING_STRATEGY_H
+#include /**/ "ace/pre.h"
+
+#include "tao/Strategies/strategies_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Connection_Purging_Strategy.h"
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_NULL_Connection_Purging_Strategy
+ *
+ * @brief The null connection purging strategy
+ *
+ * This class does not do anything.
+ */
+
+class TAO_Strategies_Export TAO_NULL_Connection_Purging_Strategy: public TAO_Connection_Purging_Strategy
+{
+public:
+ /// The constructor
+ TAO_NULL_Connection_Purging_Strategy (int cache_maximum);
+
+ /// Does nothing.
+ virtual void update_item (TAO_Transport* transport);
+
+ /// Returns -1 to signify no maximum
+ virtual int cache_maximum (void) const;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_NULL_PURGING_STRATEGY_H */
diff --git a/TAO/tao/Strategies/OC_Endpoint_Selector_Factory.cpp b/TAO/tao/Strategies/OC_Endpoint_Selector_Factory.cpp
new file mode 100644
index 00000000000..96c1cf8c8b2
--- /dev/null
+++ b/TAO/tao/Strategies/OC_Endpoint_Selector_Factory.cpp
@@ -0,0 +1,67 @@
+// $Id$
+
+#include "tao/Strategies/OC_Endpoint_Selector_Factory.h"
+#include "tao/Strategies/Optimized_Connection_Endpoint_Selector.h"
+#include "ace/Log_Msg.h"
+#include "tao/ORB_Core.h"
+#include "ace/OS.h"
+
+ACE_RCSID (tao,
+ OC_Endpoint_Selector_Factory,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_OC_Endpoint_Selector_Factory::TAO_OC_Endpoint_Selector_Factory (void)
+ : oc_endpoint_selector_(0)
+{
+}
+
+TAO_OC_Endpoint_Selector_Factory::~TAO_OC_Endpoint_Selector_Factory (void)
+{
+ delete this->oc_endpoint_selector_;
+}
+
+int
+TAO_OC_Endpoint_Selector_Factory::init (int argc, ACE_TCHAR *argv[])
+{
+ ACE_Time_Value timeout(0,0);
+
+ TAO_ORB_Core::set_endpoint_selector_factory ("OC_Endpoint_Selector_Factory");
+ for (int count = 0; count < argc; count++)
+ {
+ if ((ACE_OS::strcasecmp (argv[count],
+ ACE_TEXT ("-connect_timeout")) == 0) &&
+ count < argc-1)
+ {
+ count++;
+ long ms = ACE_OS::strtol(argv[count],0,10);
+ timeout.msec (ms);
+ }
+ }
+
+ ACE_NEW_RETURN (this->oc_endpoint_selector_,
+ TAO_Optimized_Connection_Endpoint_Selector(timeout),
+ -1);
+ return 0;
+}
+
+
+TAO_Invocation_Endpoint_Selector *
+TAO_OC_Endpoint_Selector_Factory::get_selector ( ACE_ENV_SINGLE_ARG_DECL_NOT_USED )
+{
+ // Trivial endpoint selector. Just return the default selector.
+ return this->oc_endpoint_selector_;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+// ****************************************************************
+
+ACE_STATIC_SVC_DEFINE (TAO_OC_Endpoint_Selector_Factory,
+ ACE_TEXT ("OC_Endpoint_Selector_Factory"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (TAO_OC_Endpoint_Selector_Factory),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0)
+ACE_FACTORY_DEFINE (TAO_Strategies, TAO_OC_Endpoint_Selector_Factory)
diff --git a/TAO/tao/Strategies/OC_Endpoint_Selector_Factory.h b/TAO/tao/Strategies/OC_Endpoint_Selector_Factory.h
new file mode 100644
index 00000000000..c1cae879efb
--- /dev/null
+++ b/TAO/tao/Strategies/OC_Endpoint_Selector_Factory.h
@@ -0,0 +1,87 @@
+// This may look like C, but it's really -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file OC_Endpoint_Selector_Factory.h
+ *
+ * $Id$
+ *
+ * Strategies for selecting profile/endpoint from an IOR for making an
+ * invocation.
+ *
+ * @author Phil Mesnier <mesnier_p@ociweb.com>
+ */
+//=============================================================================
+
+
+#ifndef TAO_OC_ENDPOINT_SELECTOR_FACTORY_H
+#define TAO_OC_ENDPOINT_SELECTOR_FACTORY_H
+#include /**/ "ace/pre.h"
+
+
+#include "tao/Strategies/strategies_export.h"
+
+#include "tao/Endpoint_Selector_Factory.h"
+#include "ace/Service_Config.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Forward references
+class TAO_Optimized_Connection_Endpoint_Selector;
+
+// ****************************************************************
+
+/**
+ * @class TAO_OC_Endpoint_Selector_Factory
+ *
+ * @brief Factory for initializing <Endpoint_Selection_State> and
+ * obtaining appropriate <Invocation_Endpoint_Selector>.
+ *
+ * Used by Invocation classes to intialize its endpoint selection
+ * strategy and state based on the effective policies.
+ * Endpoint selection strategies are stateless objects - all the
+ * state they need is contained by Invocation in
+ * <Endpoint_Selection_State>. Thus, rather than allocating an
+ * endpoint selection strategy object for each Invocation, the
+ * factory simply returns the appropriate one from the
+ * set preallocated in the ORB_Core. One endpoint selection
+ * strategy object can be used by many invocations concurrently.
+ */
+class TAO_Strategies_Export TAO_OC_Endpoint_Selector_Factory
+ : public TAO_Endpoint_Selector_Factory
+{
+public:
+ /// Constructor.
+ TAO_OC_Endpoint_Selector_Factory (void);
+
+ /// Destructor.
+ virtual ~TAO_OC_Endpoint_Selector_Factory (void);
+
+
+ virtual int init (int argc, ACE_TCHAR *argv[]);
+
+ /// Get an Invocation's endpoint selection strategy and
+ /// initialize the endpoint selection state instance.
+ virtual TAO_Invocation_Endpoint_Selector *get_selector (
+ ACE_ENV_SINGLE_ARG_DECL);
+
+protected:
+ /// The possible endpoint selector strategies that can be
+ /// returned by this factory
+
+ TAO_Optimized_Connection_Endpoint_Selector *oc_endpoint_selector_;
+};
+
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+
+ACE_STATIC_SVC_DECLARE_EXPORT (TAO_Strategies, TAO_OC_Endpoint_Selector_Factory)
+ACE_FACTORY_DECLARE (TAO_Strategies, TAO_OC_Endpoint_Selector_Factory)
+
+#include /**/ "ace/post.h"
+#endif /* TAO_OC_ENDPOINT_SELECTOR_FACTORY_H */
diff --git a/TAO/tao/Strategies/OC_Endpoint_Selector_Loader.cpp b/TAO/tao/Strategies/OC_Endpoint_Selector_Loader.cpp
new file mode 100644
index 00000000000..314ec97354b
--- /dev/null
+++ b/TAO/tao/Strategies/OC_Endpoint_Selector_Loader.cpp
@@ -0,0 +1,28 @@
+// =================================================================
+/**
+ * @file OC_Endpoint_Selector_Loader.cpp
+ *
+ * $Id$
+ *
+ * @author Phil Mesnier <mesnier_p@ociweb.com>
+ *
+ */
+// =================================================================
+// $Id$
+
+#include "tao/Strategies/OC_Endpoint_Selector_Loader.h"
+#include "tao/Strategies/OC_Endpoint_Selector_Factory.h"
+
+ACE_RCSID (tao,
+ OC_Endpoint_Selector_Loader,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+int
+TAO_OC_Endpoint_Selector_Loader::init (void)
+{
+ return ACE_Service_Config::process_directive (ace_svc_desc_TAO_OC_Endpoint_Selector_Factory);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Strategies/OC_Endpoint_Selector_Loader.h b/TAO/tao/Strategies/OC_Endpoint_Selector_Loader.h
new file mode 100644
index 00000000000..a19f9cf5b1e
--- /dev/null
+++ b/TAO/tao/Strategies/OC_Endpoint_Selector_Loader.h
@@ -0,0 +1,63 @@
+// This may look like C, but it's really -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file OC_Endpoint_Selector_Loader.h
+ *
+ * $Id$
+ *
+ * Strategies for selecting profile/endpoint from an IOR for making an
+ * invocation.
+ *
+ * @author Phil Mesnier <mesnier_p@ociweb.com>
+ */
+//=============================================================================
+
+
+#ifndef TAO_OC_ENDPOINT_LOADER_H
+#define TAO_OC_ENDPOINT_LOADER_H
+#include /**/ "ace/pre.h"
+
+#include "tao/Strategies/strategies_export.h"
+#include "tao/Strategies/OC_Endpoint_Selector_Factory.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Forward references
+class TAO_Optimized_Connection_Endpoint_Selector;
+
+// ****************************************************************
+
+/**
+ * @class TAO_OC_Endpoint_Selector_Loader
+ *
+ * @brief Static initializer used to ensure the Optimized Connector
+ * Endpoint Selector is available for use in static applications
+ *
+ * This class is not needed when using dynamic linking and the service
+ * configuratior. Statically linked applications need to include this
+ * header to ensure that all the necessary dependencies are met. In
+ * addition, the svc config directive is required for setting any
+ * initialization parameters for the endpoint selector.
+ *
+ */
+class TAO_Strategies_Export TAO_OC_Endpoint_Selector_Loader
+{
+public:
+ static int init(void);
+};
+
+static int
+TAO_Requires_OC_Endpoint_Selector_Loader =
+ TAO_OC_Endpoint_Selector_Loader::init ();
+
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_OC_ENDPOINT_LOADER_H */
diff --git a/TAO/tao/Strategies/Optimized_Connection_Endpoint_Selector.cpp b/TAO/tao/Strategies/Optimized_Connection_Endpoint_Selector.cpp
new file mode 100644
index 00000000000..ad864ad1b9f
--- /dev/null
+++ b/TAO/tao/Strategies/Optimized_Connection_Endpoint_Selector.cpp
@@ -0,0 +1,178 @@
+// -*- C++ -*-
+
+#include "tao/Strategies/Optimized_Connection_Endpoint_Selector.h"
+
+#include "tao/debug.h"
+#include "tao/Stub.h"
+#include "tao/Profile.h"
+#include "tao/Endpoint.h"
+#include "tao/Base_Transport_Property.h"
+#include "tao/ORB_Core.h"
+#include "tao/Transport.h"
+#include "tao/Profile_Transport_Resolver.h"
+
+ACE_RCSID (tao,
+ Invocation_Endpoint_Selectors,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// ****************************************************************
+
+ACE_Time_Value TAO_Optimized_Connection_Endpoint_Selector::timeout_;
+
+TAO_Optimized_Connection_Endpoint_Selector::TAO_Optimized_Connection_Endpoint_Selector (const ACE_Time_Value &tv)
+{
+ TAO_Optimized_Connection_Endpoint_Selector::timeout_ = tv;
+ if (TAO_debug_level)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO(%P|%t) Optimized Connection Enpoint Selector: ")
+ ACE_TEXT ("Initializing timeout hook tv = %d sec, %d usec\n"),
+ tv.sec(), tv.usec()));
+ }
+ if (tv > ACE_Time_Value::zero)
+ {
+ TAO_ORB_Core::connection_timeout_hook
+ (TAO_Optimized_Connection_Endpoint_Selector::hook);
+ }
+}
+
+TAO_Optimized_Connection_Endpoint_Selector::~TAO_Optimized_Connection_Endpoint_Selector (void)
+{
+}
+
+
+void
+TAO_Optimized_Connection_Endpoint_Selector::hook (TAO_ORB_Core *,
+ TAO_Stub *,
+ bool &has_timeout,
+ ACE_Time_Value &tv)
+{
+ has_timeout =
+ TAO_Optimized_Connection_Endpoint_Selector::
+ timeout_ > ACE_Time_Value::zero;
+ if (has_timeout)
+ tv = TAO_Optimized_Connection_Endpoint_Selector::timeout_;
+}
+
+int
+TAO_Optimized_Connection_Endpoint_Selector::check_profile (TAO_Profile *p,
+ TAO::Profile_Transport_Resolver *r)
+{
+ TAO_Endpoint *effective_endpoint = 0;
+
+ r->profile(p);
+ effective_endpoint = p->endpoint ();
+ size_t endpoint_count = p->endpoint_count();
+ for (size_t i = 0; i < endpoint_count; ++i)
+ {
+ TAO_Base_Transport_Property desc (effective_endpoint);
+ if (r->find_transport(&desc))
+ return 1;
+ // Go to the next endpoint in this profile
+ effective_endpoint = effective_endpoint->next();
+ }
+ return 0;
+}
+
+void
+TAO_Optimized_Connection_Endpoint_Selector::select_endpoint
+ ( TAO::Profile_Transport_Resolver *r,
+ ACE_Time_Value *max_wait_time
+ ACE_ENV_ARG_DECL)
+{
+ TAO_Stub *stub = r->stub();
+ TAO_Profile *p = stub->profile_in_use();
+
+ // first, look for the endpoints for the current profile in use.
+ // if that is available then go for it.
+
+ if (this->check_profile (p, r) != 0)
+ return;
+
+ // next, look for any other profiles. If the stub has any forward profiles,
+ // use those, otherwise look at the base profiles. This separation is
+ // necessary to avoid re-using a corbaloc or other previously forwarded
+ // profile.
+
+ const TAO_MProfile *profiles = stub->forward_profiles();
+ if (profiles != 0)
+ {
+ for (CORBA::ULong count = 0; count < profiles->profile_count(); count++)
+ {
+ p = const_cast<TAO_Profile *>(profiles->get_profile(count));
+ if (this->check_profile (p, r) != 0)
+ {
+ if (stub->profile_in_use() != p)
+ {
+ // thread-safe way to coerse stub to this profile.
+ stub->reset_profiles();
+ while (stub->profile_in_use() != p)
+ if (stub->next_profile_retry() == 0)
+ break;
+ }
+ return;
+ }
+ }
+ }
+ else
+ {
+ do
+ {
+ p = stub->profile_in_use();
+ if (this->check_profile(p, r) != 0)
+ return;
+ }
+ while (stub->next_profile_retry () != 0);
+ }
+
+
+
+ // at this point, we do not have an existing transport, so we must
+ // reset the profile list and try establishing connections via the
+ // connector(s).
+
+ do
+ {
+ r->profile (r->stub ()->profile_in_use ());
+
+ // Check whether we need to do a blocked wait or we have a
+ // non-blocked wait and we support that. If this is not the
+ // case we can't use this profile so try the next.
+ if (r->blocked_connect () ||
+ (!r->blocked_connect () && r->profile ()->supports_non_blocking_oneways ()))
+ {
+ const size_t endpoint_count =
+ r->profile ()->endpoint_count ();
+
+ TAO_Endpoint *ep =
+ r->profile ()->endpoint ();
+
+ for (size_t i = 0; i < endpoint_count; ++i)
+ {
+ TAO_Base_Transport_Property desc (ep);
+ const bool retval =
+ r->try_connect (&desc,
+ max_wait_time
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Check if the connect has completed.
+ if (retval)
+ return;
+
+ // Go to the next endpoint in this profile.
+ ep = ep->next ();
+ }
+ }
+ }
+ while (r->stub ()->next_profile_retry () != 0);
+
+ // If we get here, we completely failed to find an endpoint selector
+ // that we know how to use, so throw an exception.
+ ACE_THROW (CORBA::TRANSIENT (CORBA::OMGVMCID | 2,
+ CORBA::COMPLETED_NO));
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Strategies/Optimized_Connection_Endpoint_Selector.h b/TAO/tao/Strategies/Optimized_Connection_Endpoint_Selector.h
new file mode 100644
index 00000000000..818541916c6
--- /dev/null
+++ b/TAO/tao/Strategies/Optimized_Connection_Endpoint_Selector.h
@@ -0,0 +1,80 @@
+// This may look like C, but it's really -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Optimized_Connection_Endpoint_Selector.h
+ *
+ * $Id$
+ *
+ * Strategies for selecting profile/endpoint from an IOR for making an
+ * invocation.
+ *
+ * @author Phil Mesnier <mesnier_p@ociweb.com>
+ */
+//=============================================================================
+
+
+#ifndef TAO_OPTIMIZED_CONNECTION_ENDPOINT_SELECTOR_H
+#define TAO_OPTIMIZED_ENDPOINT_SELECTOR_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/corbafwd.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Strategies/strategies_export.h"
+
+#include "tao/Invocation_Endpoint_Selectors.h"
+#include "ace/Time_Value.h"
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_GIOP_Invocation;
+class TAO_ORB_Core;
+class TAO_Stub;
+class TAO_Profile;
+
+/**
+ * @class TAO_Optimized_Connection_Endpoint_Selector
+ *
+ * @brief More efficient connection strategy for endpoint selection.
+ *
+ * This strategy builds on the default by first querying the connection
+ * cache for all potential endpoints before iterating over the list to
+ * attempt to create new connections.
+ */
+
+class TAO_Strategies_Export TAO_Optimized_Connection_Endpoint_Selector :
+public TAO_Default_Endpoint_Selector
+{
+public:
+ /// Constructor.
+ TAO_Optimized_Connection_Endpoint_Selector (const ACE_Time_Value& tv);
+
+ /// Destructor.
+ virtual ~TAO_Optimized_Connection_Endpoint_Selector (void);
+
+ static void hook (TAO_ORB_Core *,
+ TAO_Stub *,
+ bool &has_timeout,
+ ACE_Time_Value &tv);
+
+ virtual void select_endpoint (TAO::Profile_Transport_Resolver *,
+ ACE_Time_Value *max_wait_time
+ ACE_ENV_ARG_DECL);
+private:
+
+ int check_profile (TAO_Profile *,
+ TAO::Profile_Transport_Resolver *);
+
+ static ACE_Time_Value timeout_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_OPTIMIZED_CONNECTION_ENDPOINT_SELECTOR_H */
diff --git a/TAO/tao/Strategies/SCIOP_Acceptor.cpp b/TAO/tao/Strategies/SCIOP_Acceptor.cpp
new file mode 100644
index 00000000000..c6e29bc4827
--- /dev/null
+++ b/TAO/tao/Strategies/SCIOP_Acceptor.cpp
@@ -0,0 +1,1040 @@
+#include "tao/Strategies/SCIOP_Acceptor.h"
+#include "tao/Strategies/SCIOP_Profile.h"
+
+#if TAO_HAS_SCIOP == 1
+
+#include "tao/MProfile.h"
+#include "tao/debug.h"
+#include "tao/Protocols_Hooks.h"
+#include "tao/Codeset_Manager.h"
+#include "tao/Transport.h"
+#include "tao/CDR.h"
+
+#if !defined(__ACE_INLINE__)
+#include "tao/Strategies/SCIOP_Acceptor.i"
+#endif /* __ACE_INLINE__ */
+
+ACE_RCSID(tao,
+ SCIOP_Acceptor,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_SCIOP_Acceptor::TAO_SCIOP_Acceptor (CORBA::Boolean flag)
+ : TAO_Acceptor (TAO_TAG_SCIOP_PROFILE),
+ addrs_ (0),
+ port_span_ (1),
+ hosts_ (0),
+ endpoint_count_ (0),
+ hostname_in_ior_ (0),
+ version_ (TAO_DEF_SCIOP_MAJOR, TAO_DEF_SCIOP_MINOR),
+ orb_core_ (0),
+ lite_flag_ (flag),
+ base_acceptor_ (),
+ creation_strategy_ (0),
+ concurrency_strategy_ (0),
+ accept_strategy_ (0)
+{
+}
+
+TAO_SCIOP_Acceptor::~TAO_SCIOP_Acceptor (void)
+{
+ // Make sure we are closed before we start destroying the
+ // strategies.
+ this->close ();
+
+ delete this->creation_strategy_;
+ delete this->concurrency_strategy_;
+ delete this->accept_strategy_;
+
+ delete [] this->addrs_;
+
+ for (CORBA::ULong i = 0; i < this->endpoint_count_; ++i)
+ CORBA::string_free (this->hosts_[i]);
+
+ delete [] this->hosts_;
+}
+
+// TODO =
+// 2) For V1.[1,2] there are tagged components
+int
+TAO_SCIOP_Acceptor::create_profile (const TAO::ObjectKey &object_key,
+ TAO_MProfile &mprofile,
+ CORBA::Short priority)
+{
+ // Sanity check.
+ if (this->endpoint_count_ == 0)
+ return -1;
+
+ // Check if multiple endpoints should be put in one profile or
+ // if they should be spread across multiple profiles.
+ /*
+ if (priority == TAO_INVALID_PRIORITY)
+ return this->create_new_profile (object_key,
+ mprofile,
+ priority);
+ else
+ */
+ return this->create_shared_profile (object_key,
+ mprofile,
+ priority);
+}
+
+int
+TAO_SCIOP_Acceptor::create_new_profile (const TAO::ObjectKey &object_key,
+ TAO_MProfile &mprofile,
+ CORBA::Short priority)
+{
+ // Adding this->endpoint_count_ to the TAO_MProfile.
+ int const count = mprofile.profile_count ();
+ if ((mprofile.size () - count) < this->endpoint_count_
+ && mprofile.grow (count + this->endpoint_count_) == -1)
+ return -1;
+
+ // Create a profile for each acceptor endpoint.
+ for (CORBA::ULong i = 0; i < this->endpoint_count_; ++i)
+ {
+ TAO_SCIOP_Profile *pfile = 0;
+ ACE_NEW_RETURN (pfile,
+ TAO_SCIOP_Profile (this->hosts_[i],
+ this->addrs_[i].get_port_number (),
+ object_key,
+ this->addrs_[i],
+ this->version_,
+ this->orb_core_),
+ -1);
+ pfile->endpoint ()->priority (priority);
+
+ if (mprofile.give_profile (pfile) == -1)
+ {
+ pfile->_decr_refcnt ();
+ pfile = 0;
+ return -1;
+ }
+
+ pfile->tagged_components ().set_orb_type (TAO_ORB_TYPE);
+
+ TAO_Codeset_Manager *csm = this->orb_core_->codeset_manager();
+ if (csm)
+ csm->set_codeset(pfile->tagged_components());
+ }
+
+ return 0;
+}
+
+int
+TAO_SCIOP_Acceptor::create_shared_profile (const TAO::ObjectKey &object_key,
+ TAO_MProfile &mprofile,
+ CORBA::Short priority)
+{
+ CORBA::ULong index = 0;
+ TAO_SCIOP_Profile *sciop_profile = 0;
+
+ // Do not check <mprofile> for the presence of an existing
+ // SCIOP_Profile. With SCIOP, there is a one-to-one relationship
+ // between Acceptors and Profiles.
+ {
+ ACE_NEW_RETURN (sciop_profile,
+ TAO_SCIOP_Profile (this->hosts_[0],
+ this->addrs_[0].get_port_number (),
+ object_key,
+ this->addrs_[0],
+ this->version_,
+ this->orb_core_),
+ -1);
+ sciop_profile->endpoint ()->priority (priority);
+
+ if (mprofile.give_profile (sciop_profile) == -1)
+ {
+ sciop_profile->_decr_refcnt ();
+ sciop_profile = 0;
+ return -1;
+ }
+
+ sciop_profile->tagged_components ().set_orb_type (TAO_ORB_TYPE);
+
+ TAO_Codeset_Manager *csm = this->orb_core_->codeset_manager();
+ if (csm)
+ csm->set_codeset(sciop_profile->tagged_components());
+
+ index = 1;
+ }
+
+ // Add any remaining acceptor endpoints to the SCIOP_Profile.
+ for (;
+ index < this->endpoint_count_;
+ ++index)
+ {
+ TAO_SCIOP_Endpoint *endpoint = 0;
+ ACE_NEW_RETURN (endpoint,
+ TAO_SCIOP_Endpoint (this->hosts_[index],
+ this->addrs_[index].get_port_number (),
+ this->addrs_[index]),
+ -1);
+ endpoint->priority (priority);
+ sciop_profile->add_endpoint (endpoint);
+ }
+
+ return 0;
+}
+
+int
+TAO_SCIOP_Acceptor::is_collocated (const TAO_Endpoint *endpoint)
+{
+ const TAO_SCIOP_Endpoint *endp =
+ dynamic_cast<const TAO_SCIOP_Endpoint *> (endpoint);
+
+ // Make sure the dynamically cast pointer is valid.
+ if (endp == 0)
+ return 0;
+
+ for (CORBA::ULong i = 0; i < this->endpoint_count_; ++i)
+ {
+ // compare the port and host name. Please do *NOT* optimize
+ // this code by comparing the IP address instead. That would
+ // trigger the following bug:
+ //
+ // http://deuce.doc.wustl.edu/bugzilla/show_bug.cgi?id=1220
+ //
+ if (endp->port() == this->addrs_[i].get_port_number()
+ && ACE_OS::strcmp(endp->host(), this->hosts_[i]) == 0)
+ return 1;
+ }
+
+ return 0;
+}
+
+int
+TAO_SCIOP_Acceptor::close (void)
+{
+ return this->base_acceptor_.close ();
+}
+
+int
+TAO_SCIOP_Acceptor::open (TAO_ORB_Core *orb_core,
+ ACE_Reactor *reactor,
+ int major,
+ int minor,
+ const char *address,
+ const char *options)
+{
+
+ this->orb_core_ = orb_core;
+
+ if (this->hosts_ != 0)
+ {
+ // The hostname cache has already been set!
+ // This is bad mojo, i.e. an internal TAO error.
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) - ")
+ ACE_TEXT ("SCIOP_Acceptor::open, ")
+ ACE_TEXT ("hostname already set\n\n")),
+ -1);
+ }
+
+ if (address == 0)
+ return -1;
+
+ ACE_UNUSED_ARG (major);
+ ACE_UNUSED_ARG (minor);
+
+ // Parse options
+ if (this->parse_options (options) == -1)
+ return -1;
+
+ ACE_Multihomed_INET_Addr addr;
+
+ const char *port_separator_loc = ACE_OS::strchr (address, ':');
+ ACE_Auto_Basic_Array_Ptr<char> tmp_host_auto;
+
+ if (port_separator_loc == address)
+ {
+ // The address is a port number or port name. No hostname was
+ // specified. The hostname for each network interface and the
+ // fully qualified domain name must be obtained.
+
+ // Check for multiple network interfaces.
+ if (this->probe_interfaces (orb_core) == -1)
+ return -1;
+
+ // First convert the port into a usable form.
+ ACE_INET_Addr temp_addr;
+ if (temp_addr.set (address + sizeof (':')) != 0)
+ return -1;
+
+ // Now reset the port and set the host.
+ if (addr.set (temp_addr.get_port_number (),
+ static_cast<ACE_UINT32> (INADDR_ANY),
+ 1) != 0)
+ return -1;
+ else
+ return this->open_i (addr,
+ reactor);
+ }
+
+ // If we've reached this point, then the address consists of one or
+ // more hostnames, followed perhaps by a port.
+
+ u_short port_number = 0;
+ char *tmp_host = 0;
+ size_t hostname_length = 0;
+
+ if (port_separator_loc != 0) {
+
+ // Port separator was found. Check that the next character is
+ // not the terminator.
+ const char *port_loc = port_separator_loc;
+ ++port_loc;
+ if (port_loc == 0) {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) ")
+ ACE_TEXT ("SCIOP_Acceptor::open - ")
+ ACE_TEXT ("no port number after the ")
+ ACE_TEXT ("colon in \"%s\"\n"),
+ address),
+ -1);
+ }
+
+ // Read the port number
+ ACE_INET_Addr temp_addr;
+ if (temp_addr.string_to_addr(port_loc) != 0)
+ return -1;
+ port_number = temp_addr.get_port_number();
+
+ // Set the length of the hostname
+ hostname_length = port_separator_loc - address;
+
+ } else {
+
+ // Port separator was not found. We allow port_number to retain
+ // the value of 0, which will cause the port to be chosen for us
+ // in open_i.
+
+ // Set the length of the hostname
+ hostname_length = ACE_OS::strlen(address);
+ }
+
+ ACE_NEW_RETURN(tmp_host, char[hostname_length + 1], -1);
+ tmp_host_auto.reset(tmp_host);
+ ACE_OS::memcpy (tmp_host, address, hostname_length);
+ tmp_host[hostname_length] = '\0';
+
+ // There may be multiple hostnames. Parse them.
+ ACE_Array<ACE_CString> hostnames;
+ if (parse_multiple_hostnames(tmp_host, hostnames) != 0)
+ return -1;
+
+ // Check that at least one hostname was obtained.
+ if (hostnames.size() < 1) {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) ")
+ ACE_TEXT ("SCIOP_Acceptor::open - ")
+ ACE_TEXT ("no hostnames in string \"%s\"\n"),
+ tmp_host),
+ -1);
+ }
+
+ // Obtain the primary ip address.
+ ACE_UINT32 primary_ip_addr = 0;
+ {
+ // Obtain a char* for the primary hostname.
+ ACE_CString & primary_hostname_obj = hostnames[0];
+ ACE_Auto_Basic_Array_Ptr<char> primary_hostname_auto(primary_hostname_obj.rep());
+ const char* primary_hostname = primary_hostname_auto.get();
+
+ // Convert the primary hostname to ACE_UINT32
+ ACE_INET_Addr temp_addr;
+ if (temp_addr.set((u_short) 0, primary_hostname) != 0)
+ return -1;
+
+ primary_ip_addr = temp_addr.get_ip_address();
+ }
+
+ // Allocate an array of secondary ip addresses.
+ ACE_UINT32 *secondary_ip_addrs = 0;
+ ACE_Auto_Basic_Array_Ptr<ACE_UINT32> secondary_ip_addrs_auto;
+ size_t num_secondary_ip_addrs = hostnames.size() - 1;
+ if (num_secondary_ip_addrs > 0) {
+ ACE_NEW_RETURN(secondary_ip_addrs,
+ ACE_UINT32[num_secondary_ip_addrs],
+ -1);
+ secondary_ip_addrs_auto.reset(secondary_ip_addrs);
+ }
+
+ // Populate the array of secondary ip addresses
+ size_t i = 0;
+ ACE_INET_Addr temp_addr;
+ while (i < num_secondary_ip_addrs) {
+
+ // Obtain a char* for a single secondary hostname.
+ ACE_CString & hostname_obj = hostnames[i + 1];
+ ACE_Auto_Basic_Array_Ptr<char> hostname_auto(hostname_obj.rep());
+ const char* hostname = hostname_auto.get();
+
+ // Obtain the ip address for this secondary hostname.
+ if (temp_addr.set((u_short) 0, hostname) != 0)
+ return -1;
+
+ // Put secondary ip address into the array
+ secondary_ip_addrs[i++] = temp_addr.get_ip_address();
+ }
+
+ // Populate our ACE_Multihomed_INET_Addr with all the right
+ // stuff.
+ if (addr.set(port_number,
+ primary_ip_addr,
+ 1,
+ secondary_ip_addrs,
+ num_secondary_ip_addrs));
+
+ // Number of endpoints equals the size of the hostname array.
+ this->endpoint_count_ = hostnames.size();
+
+ ACE_NEW_RETURN (this->addrs_,
+ ACE_INET_Addr[this->endpoint_count_],
+ -1);
+
+ ACE_NEW_RETURN (this->hosts_,
+ char *[this->endpoint_count_],
+ -1);
+
+ // Copy the primary address to the first slot of the
+ // addrs_ array.
+ this->addrs_[0].set (addr);
+
+ // Copy secondary addresses to the remaining slots of the
+ // addrs_ array.
+ ACE_INET_Addr *secondary_addrs = this->addrs_;
+ ++secondary_addrs;
+ addr.get_secondary_addresses(secondary_addrs, num_secondary_ip_addrs);
+
+ // Set cached hostnames.
+ i = 0;
+ while (i < hostnames.size()) {
+
+ // The hostname_in_ior_ field may override the FIRST hostname only.
+ if (this->hostname_in_ior_ != 0 && i == 0)
+ {
+ if (TAO_debug_level > 2)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("Overriding address in IOR with %s\n"),
+ this->hostname_in_ior_));
+ }
+ if (this->hostname (orb_core,
+ this->addrs_[i],
+ this->hosts_[i],
+ this->hostname_in_ior_) != 0)
+ return -1;
+ }
+ else
+ {
+ // Obtain a char* for the hostname.
+ ACE_CString & hostname_obj = hostnames[i];
+ ACE_Auto_Basic_Array_Ptr<char> hostname_auto(hostname_obj.rep());
+ const char* hostname = hostname_auto.get();
+
+ if (this->hostname (orb_core,
+ this->addrs_[i],
+ this->hosts_[i],
+ hostname) != 0)
+ return -1;
+ }
+
+ ++i;
+ }
+
+ // Invoke open_i.
+ return this->open_i (addr,
+ reactor);
+}
+
+int
+TAO_SCIOP_Acceptor::open_default (TAO_ORB_Core *orb_core,
+ ACE_Reactor *reactor,
+ int major,
+ int minor,
+ const char *options)
+{
+ this->orb_core_ = orb_core;
+
+ if (this->hosts_ != 0)
+ {
+ // The hostname cache has already been set!
+ // This is bad mojo, i.e. an internal TAO error.
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) ")
+ ACE_TEXT ("SCIOP_Acceptor::open_default - ")
+ ACE_TEXT ("hostname already set\n\n")),
+ -1);
+ }
+
+
+ ACE_UNUSED_ARG (major);
+ ACE_UNUSED_ARG (minor);
+
+ // Parse options
+ if (this->parse_options (options) == -1)
+ return -1;
+
+ // Check for multiple network interfaces.
+ if (this->probe_interfaces (orb_core) == -1)
+ return -1;
+
+ // Now that each network interface's hostname has been cached, open
+ // an endpoint on each network interface using the INADDR_ANY
+ // address.
+ ACE_Multihomed_INET_Addr addr;
+
+ if (addr.set (static_cast<u_short> (0),
+ static_cast<ACE_UINT32> (INADDR_ANY),
+ 1) != 0)
+ return -1;
+
+ return this->open_i (addr,
+ reactor);
+}
+
+int
+TAO_SCIOP_Acceptor::open_i (const ACE_Multihomed_INET_Addr& addr,
+ ACE_Reactor *reactor)
+{
+ ACE_NEW_RETURN (this->creation_strategy_,
+ TAO_SCIOP_CREATION_STRATEGY (this->orb_core_,
+ this->lite_flag_),
+ -1);
+
+ ACE_NEW_RETURN (this->concurrency_strategy_,
+ TAO_SCIOP_CONCURRENCY_STRATEGY (this->orb_core_),
+ -1);
+
+ ACE_NEW_RETURN (this->accept_strategy_,
+ TAO_SCIOP_ACCEPT_STRATEGY (this->orb_core_),
+ -1);
+
+ u_short requested_port = addr.get_port_number ();
+ if (requested_port == 0)
+ {
+ // don't care, i.e., let the OS choose an ephemeral port
+ if (this->base_acceptor_.open (addr,
+ reactor,
+ this->creation_strategy_,
+ this->accept_strategy_,
+ this->concurrency_strategy_) == -1)
+ {
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("\n\nTAO (%P|%t) SCIOP_Acceptor::open_i ")
+ ACE_TEXT ("- %p\n\n"),
+ ACE_TEXT ("cannot open acceptor")));
+ return -1;
+ }
+ }
+ else
+ {
+ ACE_Multihomed_INET_Addr a(addr);
+
+ int found_a_port = 0;
+ ACE_UINT32 last_port = requested_port + this->port_span_ - 1;
+ if (last_port > ACE_MAX_DEFAULT_PORT)
+ {
+ last_port = ACE_MAX_DEFAULT_PORT;
+ }
+
+ for (ACE_UINT32 p = requested_port; p <= last_port; p++)
+ {
+ if (TAO_debug_level > 5)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) SCIOP_Acceptor::open_i() ")
+ ACE_TEXT ("trying to listen on port %d\n"), p));
+
+ // Now try to actually open on that port
+ a.set_port_number ((u_short)p);
+ if (this->base_acceptor_.open (a,
+ reactor,
+ this->creation_strategy_,
+ this->accept_strategy_,
+ this->concurrency_strategy_) != -1)
+ {
+ found_a_port = 1;
+ break;
+ }
+ }
+
+ // Now, if we couldn't locate a port, we punt
+ if (! found_a_port)
+ {
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("\n\nTAO (%P|%t) SCIOP_Acceptor::open_i ")
+ ACE_TEXT ("cannot open acceptor in port range (%d,%d)")
+ ACE_TEXT ("- %p\n\n"),
+ requested_port, last_port, ACE_TEXT("")));
+ return -1;
+ }
+ }
+
+ ACE_INET_Addr address;
+
+ // We do this make sure the port number the endpoint is listening on
+ // gets set in the addr.
+ if (this->base_acceptor_.acceptor ().get_local_addr (address) != 0)
+ {
+ // @@ Should this be a catastrophic error???
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("\n\nTAO (%P|%t) SCIOP_Acceptor::open_i ")
+ ACE_TEXT ("- %p\n\n"),
+ ACE_TEXT ("cannot get local addr")));
+ return -1;
+ }
+
+ // Set the port for each addr. If there is more than one network
+ // interface then the endpoint created on each interface will be on
+ // the same port. This is how a wildcard socket bind() is supposed
+ // to work.
+ u_short port = address.get_port_number ();
+ for (CORBA::ULong j = 0; j < this->endpoint_count_; ++j)
+ this->addrs_[j].set_port_number (port, 1);
+
+ (void) this->base_acceptor_.acceptor().enable (ACE_CLOEXEC);
+ // This avoids having child processes acquire the listen socket thereby
+ // denying the server the opportunity to restart on a well-known endpoint.
+ // This does not affect the aberrent behavior on Win32 platforms.
+
+ if (TAO_debug_level > 5)
+ {
+ for (CORBA::ULong i = 0; i < this->endpoint_count_; ++i)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("\nTAO (%P|%t) SCIOP_Acceptor::open_i - ")
+ ACE_TEXT ("listening on: <%s:%u>\n"),
+ ACE_TEXT_CHAR_TO_TCHAR(this->hosts_[i]),
+ this->addrs_[i].get_port_number ()));
+ }
+ }
+
+ return 0;
+}
+
+int
+TAO_SCIOP_Acceptor::hostname (TAO_ORB_Core *orb_core,
+ ACE_INET_Addr &addr,
+ char *&host,
+ const char *specified_hostname)
+{
+ if (orb_core->orb_params ()->use_dotted_decimal_addresses ())
+ {
+ // If dotted decimal addresses are enabled,
+ // just return ours.
+ return this->dotted_decimal_address (addr, host);
+ }
+ else if (specified_hostname != 0)
+ {
+ // If the user specified a hostname, pass it back
+ // blindly as it overrides our choice of hostname.
+ host = CORBA::string_dup (specified_hostname);
+ }
+ else
+ {
+ char tmp_host[MAXHOSTNAMELEN + 1];
+
+ // Get the hostname associated with our address
+ if (addr.get_host_name (tmp_host, sizeof (tmp_host)) != 0)
+ {
+ // On failure, just return the decimal address.
+ return this->dotted_decimal_address (addr, host);
+ }
+ else
+ {
+ host = CORBA::string_dup (tmp_host);
+ }
+ }
+
+ return 0;
+}
+
+int
+TAO_SCIOP_Acceptor::dotted_decimal_address (ACE_INET_Addr &addr,
+ char *&host)
+{
+ int result = 0;
+ const char *tmp = 0;
+
+ // If the IP address in the INET_Addr is the INADDR_ANY address,
+ // then force the actual IP address to be used by initializing a new
+ // INET_Addr with the hostname from the original one. If that fails
+ // then something is seriously wrong with the systems networking
+ // setup.
+ if (addr.get_ip_address () == INADDR_ANY)
+ {
+ ACE_INET_Addr new_addr;
+ result = new_addr.set (addr.get_port_number (),
+ addr.get_host_name ());
+ tmp = new_addr.get_host_addr ();
+ }
+ else
+ tmp = addr.get_host_addr ();
+
+ if (tmp == 0 || result != 0)
+ {
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("\n\nTAO (%P|%t) ")
+ ACE_TEXT ("SCIOP_Acceptor::dotted_decimal_address ")
+ ACE_TEXT ("- %p\n\n"),
+ ACE_TEXT ("cannot determine hostname")));
+ return -1;
+ }
+
+ host = CORBA::string_dup (tmp);
+ return 0;
+}
+
+int
+TAO_SCIOP_Acceptor::probe_interfaces (TAO_ORB_Core *orb_core)
+{
+ // Extract the hostname for each network interface, and then cache
+ // it. The hostnames will then be used when creating a
+ // TAO_SCIOP_Profile for each endpoint setup on the probed
+ // network interfaces.
+ ACE_INET_Addr *if_addrs = 0;
+ size_t if_cnt = 0;
+
+ if (ACE::get_ip_interfaces (if_cnt,
+ if_addrs) != 0
+ && errno != ENOTSUP)
+ {
+ // In the case where errno == ENOTSUP, if_cnt and if_addrs will
+ // not be modified, and will each remain equal to zero. This
+ // causes the default interface to be used.
+ return -1;
+ }
+
+ if (if_cnt == 0 || if_addrs == 0)
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_WARNING,
+ ACE_TEXT ("TAO (%P|%t) Unable to probe network ")
+ ACE_TEXT ("interfaces. Using default.\n")));
+ }
+
+ if_cnt = 1; // Force the network interface count to be one.
+ delete [] if_addrs;
+ ACE_NEW_RETURN (if_addrs,
+ ACE_INET_Addr[if_cnt],
+ -1);
+ }
+
+ // Scan for the loopback interface since it shouldn't be included in
+ // the list of cached hostnames unless it is the only interface.
+ size_t lo_cnt = 0; // Loopback interface count
+ for (size_t j = 0; j < if_cnt; ++j)
+ if (if_addrs[j].get_ip_address () == INADDR_LOOPBACK)
+ ++lo_cnt;
+
+ // The instantiation for this template is in
+ // tao/SCIOP_Connector.cpp.
+ ACE_Auto_Basic_Array_Ptr<ACE_INET_Addr> safe_if_addrs (if_addrs);
+
+ // If the loopback interface is the only interface then include it
+ // in the list of interfaces to query for a hostname, otherwise
+ // exclude it from the list.
+ if (if_cnt == lo_cnt)
+ this->endpoint_count_ = static_cast<CORBA::ULong> (if_cnt);
+ else
+ this->endpoint_count_ = static_cast<CORBA::ULong> (if_cnt - lo_cnt);
+
+ ACE_NEW_RETURN (this->addrs_,
+ ACE_INET_Addr[this->endpoint_count_],
+ -1);
+
+ ACE_NEW_RETURN (this->hosts_,
+ char *[this->endpoint_count_],
+ -1);
+
+ ACE_OS::memset (this->hosts_, 0, sizeof (char*) * this->endpoint_count_);
+
+ // The number of hosts/interfaces we want to cache may not be the
+ // same as the number of detected interfaces so keep a separate
+ // count.
+ size_t host_cnt = 0;
+
+ for (size_t i = 0; i < if_cnt; ++i)
+ {
+ // Ignore any loopback interface if there are other
+ // non-loopback interfaces.
+ if (if_cnt != lo_cnt &&
+ if_addrs[i].get_ip_address() == INADDR_LOOPBACK)
+ continue;
+
+ if (this->hostname_in_ior_ != 0)
+ {
+ if (TAO_debug_level > 2)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("Overriding address in IOR with %s\n"),
+ this->hostname_in_ior_));
+ }
+ if (this->hostname (orb_core,
+ if_addrs[i],
+ this->hosts_[host_cnt],
+ this->hostname_in_ior_) != 0)
+ return -1;
+ }
+ else
+ {
+ if (this->hostname (orb_core,
+ if_addrs[i],
+ this->hosts_[host_cnt]) != 0)
+ return -1;
+ }
+
+ // Copy the addr. The port is (re)set in
+ // TAO_SCIOP_Acceptor::open_i().
+ if (this->addrs_[host_cnt].set (if_addrs[i]) != 0)
+ return -1;
+
+ ++host_cnt;
+ }
+
+ return 0;
+}
+
+int
+TAO_SCIOP_Acceptor::parse_multiple_hostnames (const char *hostnames,
+ ACE_Array<ACE_CString> &hostnames_out)
+{
+
+ // Make a copy of hostnames string
+ int const hostnames_string_length = ACE_OS::strlen(hostnames) + 1;
+ char* hostnames_copy = 0;
+ ACE_NEW_RETURN (hostnames_copy,
+ char[hostnames_string_length],
+ -1);
+ ACE_Auto_Basic_Array_Ptr<char> hostnames_copy_auto(hostnames_copy);
+ ACE_OS::strncpy(hostnames_copy, hostnames, hostnames_string_length);
+
+ // Count the number of hostnames separated by "+"
+ size_t num_hostnames = 0;
+ char *last = 0;
+ const char* hostname = ACE_OS::strtok_r (hostnames_copy, "+", &last);
+
+ while (hostname != 0) {
+ ++num_hostnames;
+ hostname = ACE_OS::strtok_r (0, "+", &last);
+ }
+
+ // Set the size of the array to the number of hostnames
+ if (hostnames_out.size(num_hostnames) == -1) {
+
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) Could not allocate storage ")
+ ACE_TEXT ("for %d hostnames in SCIOP endpoint\n"),
+ num_hostnames),
+ -1);
+ }
+
+ // Refresh copy of hostnames string
+ ACE_NEW_RETURN (hostnames_copy,
+ char[hostnames_string_length],
+ -1);
+ hostnames_copy_auto.reset(hostnames_copy);
+ ACE_OS::strncpy(hostnames_copy, hostnames, hostnames_string_length);
+
+ // Iterate over the hostnames and stuff them into the array
+ size_t index = 0;
+ last = 0;
+ hostname = ACE_OS::strtok_r (hostnames_copy, "+", &last);
+
+ while (index < num_hostnames) {
+ ACE_CString hostname_object(hostname);
+ hostnames_out.set(hostname_object, index++);
+
+ hostname = ACE_OS::strtok_r (0, "+", &last);
+ }
+
+ return 0;
+}
+
+
+CORBA::ULong
+TAO_SCIOP_Acceptor::endpoint_count (void)
+{
+ return this->endpoint_count_;
+}
+
+int
+TAO_SCIOP_Acceptor::object_key (IOP::TaggedProfile &profile,
+ TAO::ObjectKey &object_key)
+{
+ // Create the decoding association from the encapsulation in the buffer,
+#if (TAO_NO_COPY_OCTET_SEQUENCES == 1)
+ TAO_InputCDR cdr (profile.profile_data.mb ());
+#else
+ TAO_InputCDR cdr (reinterpret_cast<char*> (profile.profile_data.get_buffer ()),
+ profile.profile_data.length ());
+#endif /* TAO_NO_COPY_OCTET_SEQUENCES == 1 */
+
+ CORBA::Octet major, minor;
+
+ // Read the version. We just read it here. We don't*do any*
+ // processing.
+ if (!(cdr.read_octet (major)
+ && cdr.read_octet (minor)))
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) SCIOP_Profile::decode - v%d.%d\n"),
+ major,
+ minor));
+ }
+ return -1;
+ }
+
+ CORBA::String_var host;
+ CORBA::UShort port = 0;
+
+ // Get host and port. No processing here too..
+ if (cdr.read_string (host.out ()) == 0
+ || cdr.read_ushort (port) == 0)
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) TAO_SCIOP_Acceptor::object_key - ")
+ ACE_TEXT ("error while decoding host/port")));
+ }
+ return -1;
+ }
+
+ // ... and object key.
+ if ((cdr >> object_key) == 0)
+ return -1;
+
+ // We are NOT bothered about the rest.
+
+ return 1;
+}
+
+
+int
+TAO_SCIOP_Acceptor::parse_options (const char *str)
+{
+ if (str == 0)
+ return 0; // No options to parse. Not a problem.
+
+ // Use an option format similar to the one used for CGI scripts in
+ // HTTP URLs.
+ // e.g.: option1=foo&option2=bar
+
+ ACE_CString options (str);
+
+ size_t len = options.length ();
+
+ const char option_delimiter = '&';
+
+ // Count the number of options.
+
+ CORBA::ULong option_count = 1;
+ // Number of endpoints in the string (initialized to 1).
+
+ // Only check for endpoints after the protocol specification and
+ // before the object key.
+ for (size_t i = 0; i < len; ++i)
+ if (options[i] == option_delimiter)
+ ++option_count;
+
+ // The idea behind the following loop is to split the options into
+ // (option, name) pairs.
+ // For example,
+ // `option1=foo&option2=bar'
+ // will be parsed into:
+ // `option1=foo'
+ // `option2=bar'
+
+ ACE_CString::size_type begin = 0;
+ ACE_CString::size_type end = 0;
+
+ for (CORBA::ULong j = 0; j < option_count; ++j)
+ {
+ if (j < option_count - 1)
+ end = options.find (option_delimiter, begin);
+ else
+ end = len;
+
+ if (end == begin)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) Zero length SCIOP option.\n")),
+ -1);
+ else if (end != ACE_CString::npos)
+ {
+ ACE_CString opt = options.substring (begin, end - begin);
+
+ ACE_CString::size_type slot = opt.find ("=");
+
+ if (slot == len - 1
+ || slot == ACE_CString::npos)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) SCIOP option <%s> is ")
+ ACE_TEXT ("missing a value.\n"),
+ opt.c_str ()),
+ -1);
+
+ ACE_CString name = opt.substring (0, slot);
+ ACE_CString value = opt.substring (slot + 1);
+
+ if (name.length () == 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) Zero length SCIOP ")
+ ACE_TEXT ("option name.\n")),
+ -1);
+
+ if (name == "priority")
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) Invalid SCIOP endpoint format: ")
+ ACE_TEXT ("endpoint priorities no longer supported. \n")),
+ -1);
+ }
+ else if (name == "portspan")
+ {
+ int range = static_cast<int> (ACE_OS::atoi (value.c_str ()));
+ // @@ What's the lower bound on the range? zero, or one?
+ if (range < 1 || range > ACE_MAX_DEFAULT_PORT)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) Invalid SCIOP endpoint ")
+ ACE_TEXT ("portspan: <%s>\n")
+ ACE_TEXT ("Valid range 1 -- %d\n"),
+ value.c_str (), ACE_MAX_DEFAULT_PORT),
+ -1);
+
+ this->port_span_ = static_cast<u_short> (range);
+ }
+ else if (name == "hostname_in_ior")
+ {
+ this->hostname_in_ior_ = value.rep ();
+ }
+ else
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) Invalid SCIOP option: <%s>\n"),
+ name.c_str ()),
+ -1);
+
+ begin = end + 1;
+ }
+ else
+ {
+ break; // No other options.
+ }
+ }
+
+ return 0;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_SCIOP == 1 */
diff --git a/TAO/tao/Strategies/SCIOP_Acceptor.h b/TAO/tao/Strategies/SCIOP_Acceptor.h
new file mode 100644
index 00000000000..8422c68bee9
--- /dev/null
+++ b/TAO/tao/Strategies/SCIOP_Acceptor.h
@@ -0,0 +1,231 @@
+// -*- C++ -*-
+
+// $Id$
+// ===================================================================
+/*
+ * @file SCIOP_Acceptor.h
+ *
+ * SCIOP specific acceptor processing
+ *
+ * @author Jason Cohen, Lockheed Martin ATL <jcohen@atl.lmco.com>
+ * @author Keith O'Hara, Lockheed Martin ATL
+ */
+// ===================================================================
+
+
+#ifndef TAO_SCIOP_ACCEPTOR_H
+#define TAO_SCIOP_ACCEPTOR_H
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if TAO_HAS_SCIOP == 1
+
+#include "tao/Transport_Acceptor.h"
+#include "tao/Strategies/SCIOP_Connection_Handler.h"
+#include "tao/Acceptor_Impl.h"
+#include "tao/GIOP_Message_Version.h"
+
+#include "ace/SOCK_SEQPACK_Acceptor.h"
+#include "ace/Acceptor.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// TAO SCIOP_Acceptor concrete call defination
+
+/**
+ * @class TAO_SCIOP_Acceptor
+ *
+ * @brief TAO_SCIOP_Acceptor
+ *
+ * The SCIOP-specific bridge class for the concrete acceptor.
+ */
+class TAO_Strategies_Export TAO_SCIOP_Acceptor : public TAO_Acceptor
+{
+public:
+ /// Constructor.
+ TAO_SCIOP_Acceptor (CORBA::Boolean flag = false);
+
+ /// Destructor.
+ ~TAO_SCIOP_Acceptor (void);
+
+ /// @@ Helper method for the implementation repository, should go
+ /// away
+ const ACE_INET_Addr& address (void) const;
+
+ /// Returns the array of endpoints in this acceptor
+ const ACE_INET_Addr *endpoints (void);
+
+ typedef ACE_Strategy_Acceptor<TAO_SCIOP_Connection_Handler, ACE_SOCK_SEQPACK_ACCEPTOR> TAO_SCIOP_BASE_ACCEPTOR;
+ typedef TAO_Creation_Strategy<TAO_SCIOP_Connection_Handler> TAO_SCIOP_CREATION_STRATEGY;
+ typedef TAO_Concurrency_Strategy<TAO_SCIOP_Connection_Handler> TAO_SCIOP_CONCURRENCY_STRATEGY;
+ typedef TAO_Accept_Strategy<TAO_SCIOP_Connection_Handler, ACE_SOCK_SEQPACK_ACCEPTOR> TAO_SCIOP_ACCEPT_STRATEGY;
+
+ /**
+ * The TAO_Acceptor methods, check the documentation in
+ * Transport_Acceptor.h for details.
+ */
+ virtual int open (TAO_ORB_Core *orb_core,
+ ACE_Reactor *reactor,
+ int version_major,
+ int version_minor,
+ const char *address,
+ const char *options = 0);
+ virtual int open_default (TAO_ORB_Core *orb_core,
+ ACE_Reactor *reactor,
+ int version_major,
+ int version_minor,
+ const char *options = 0);
+ virtual int close (void);
+ virtual int create_profile (const TAO::ObjectKey &object_key,
+ TAO_MProfile &mprofile,
+ CORBA::Short priority);
+ virtual int is_collocated (const TAO_Endpoint *endpoint);
+ virtual CORBA::ULong endpoint_count (void);
+
+ virtual int object_key (IOP::TaggedProfile &profile,
+ TAO::ObjectKey &key);
+
+ /**
+ * Set the host name for the given addr.
+ * A hostname may be forced by using specified_hostname. This
+ * is useful if the given address corresponds to more than one
+ * hostname and the desired one cannot be determined in any
+ * other way.
+ */
+ int hostname (TAO_ORB_Core *orb_core,
+ ACE_INET_Addr &addr,
+ char *&host,
+ const char *specified_hostname = 0);
+
+ /**
+ * Set the host name for the given address using the dotted decimal
+ * format.
+ */
+ int dotted_decimal_address (ACE_INET_Addr &addr,
+ char *&host);
+
+protected:
+
+ /**
+ * Implement the common part of the open*() methods. This method is
+ * virtual to allow a derived class implementation to be invoked
+ * instead.
+ */
+ virtual int open_i (const ACE_Multihomed_INET_Addr &addr,
+ ACE_Reactor *reactor);
+
+ /**
+ * Probe the system for available network interfaces, and initialize
+ * the <addrs_> array with an ACE_INET_Addr for each network
+ * interface. The port for each initialized ACE_INET_Addr will be
+ * set in the open_i() method. This method only gets invoked when
+ * no explicit hostname is provided in the specified endpoint.
+ */
+ int probe_interfaces (TAO_ORB_Core *orb_core);
+
+ /**
+ * Split the string into hostnames separated by the plus character
+ * ('+').
+ */
+ int parse_multiple_hostnames (const char *hostnames,
+ ACE_Array<ACE_CString> &hostnames_out);
+
+ /**
+ * Parse protocol specific options.
+ *
+ * Currently supported:
+ * portspan -- specifies the range of ports over which the acceptor
+ * should scan looking for a free port (this is convenient
+ * for situations where you might normally use an ephemeral
+ * port but can't because you're behind a firewall and don't
+ * want to permit passage on all ephemeral ports)
+ */
+ virtual int parse_options (const char *options);
+
+ /// Obtain tcp properties that must be used by this acceptor, i.e.,
+ /// initialize <tcp_properties_>.
+ int init_tcp_properties (void);
+
+ /// Helper method to add a new profile to the mprofile for
+ /// each endpoint.
+ int create_new_profile (const TAO::ObjectKey &object_key,
+ TAO_MProfile &mprofile,
+ CORBA::Short priority);
+
+ /// Helper method to create a profile that contains all of
+ /// our endpoints.
+ int create_shared_profile (const TAO::ObjectKey &object_key,
+ TAO_MProfile &mprofile,
+ CORBA::Short priority);
+
+protected:
+
+ /// Array of ACE_INET_Addr instances, each one corresponding to a
+ /// given network interface.
+ ACE_INET_Addr *addrs_;
+
+ /**
+ * The number of ports over which the acceptor should search (starting
+ * at the port specified in each element of addrs_) for an available
+ * port. This is specified via the "portspan=" option to the endpoint.
+ */
+ u_short port_span_;
+
+ /**
+ * Cache the information about the endpoints serviced by this
+ * acceptor.
+ * There may in fact be multiple hostnames for this endpoint. For
+ * example, if the IP address is INADDR_ANY (0.0.0.0) then there
+ * will be possibly a different hostname for each interface.
+ */
+ char **hosts_;
+
+ /// The number of host names cached in the hosts_ array (equivalent
+ /// to the number of endpoints opened by this Acceptor).
+ CORBA::ULong endpoint_count_;
+
+ /**
+ * Override the hostname used in the ORBEndPoint.
+ */
+ char *hostname_in_ior_;
+
+ /**
+ * The GIOP version for this endpoint
+ * @@ Theoretically they shouldn't be here!! We need to look at a
+ * way to move this out
+ */
+ TAO_GIOP_Message_Version version_;
+
+ /// ORB Core.
+ TAO_ORB_Core *orb_core_;
+
+ /// Should we use GIOP lite??
+ CORBA::Boolean lite_flag_;
+
+private:
+
+ /// the concrete acceptor, as a pointer to it's base class.
+ TAO_SCIOP_BASE_ACCEPTOR base_acceptor_;
+
+ /// Acceptor strategies.
+ TAO_SCIOP_CREATION_STRATEGY *creation_strategy_;
+ TAO_SCIOP_CONCURRENCY_STRATEGY *concurrency_strategy_;
+ TAO_SCIOP_ACCEPT_STRATEGY *accept_strategy_;
+
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined(__ACE_INLINE__)
+#include "tao/Strategies/SCIOP_Acceptor.i"
+#endif /* __ACE_INLINE__ */
+
+#endif /* TAO_HAS_SCIOP == 1 */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_SCIOP_ACCEPTOR_H */
diff --git a/TAO/tao/Strategies/SCIOP_Acceptor.i b/TAO/tao/Strategies/SCIOP_Acceptor.i
new file mode 100644
index 00000000000..a5f51de6042
--- /dev/null
+++ b/TAO/tao/Strategies/SCIOP_Acceptor.i
@@ -0,0 +1,28 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE const ACE_INET_Addr&
+TAO_SCIOP_Acceptor::address (void) const
+{
+ ACE_ASSERT (this->addrs_ != 0);
+
+ // @@ This is busted.
+ // The Implementation Repository will have to start supporting
+ // IORs with multiple profiles. For now, we just return the
+ // first addr.
+ // -Ossama
+ return this->addrs_[0];
+}
+
+ACE_INLINE const ACE_INET_Addr *
+TAO_SCIOP_Acceptor::endpoints (void)
+{
+ ACE_ASSERT (this->addrs_ != 0);
+
+ return this->addrs_;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Strategies/SCIOP_Connection_Handler.cpp b/TAO/tao/Strategies/SCIOP_Connection_Handler.cpp
new file mode 100644
index 00000000000..dd83f2fac6e
--- /dev/null
+++ b/TAO/tao/Strategies/SCIOP_Connection_Handler.cpp
@@ -0,0 +1,390 @@
+#include "tao/Strategies/SCIOP_Connection_Handler.h"
+
+#if TAO_HAS_SCIOP == 1
+
+// jcohen@atl.lmco.com: The purpose of this is to allow RH9 to build
+// SCIOR Profile support even without a functioning SCTP implementation
+
+#ifndef IPPROTO_SCTP
+# include "netinet/sctp.h"
+#else // !IPPROTO_SCTP
+# ifndef SCTP_NODELAY
+# define SCTP_NODELAY 1
+# endif // !SCTP_NODELAY
+#endif
+
+#include "tao/Timeprobe.h"
+#include "tao/debug.h"
+#include "tao/ORB_Core.h"
+#include "tao/ORB.h"
+#include "tao/CDR.h"
+#include "tao/Server_Strategy_Factory.h"
+#include "tao/Strategies/SCIOP_Transport.h"
+#include "tao/Strategies/SCIOP_Endpoint.h"
+#include "tao/Transport_Cache_Manager.h"
+#include "tao/Thread_Lane_Resources.h"
+#include "tao/Base_Transport_Property.h"
+#include "tao/Resume_Handle.h"
+#include "tao/Protocols_Hooks.h"
+#include "tao/Wait_Strategy.h"
+
+ACE_RCSID (tao,
+ SCIOP_Connection_Handler,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_SCIOP_Connection_Handler::TAO_SCIOP_Connection_Handler (ACE_Thread_Manager *t)
+ : TAO_SCIOP_SVC_HANDLER (t, 0 , 0),
+ TAO_Connection_Handler (0),
+ dscp_codepoint_ (IPDSFIELD_DSCP_DEFAULT << 2)
+{
+ // This constructor should *never* get called, it is just here to
+ // make the compiler happy: the default implementation of the
+ // Creation_Strategy requires a constructor with that signature, we
+ // don't use that implementation, but some (most?) compilers
+ // instantiate it anyway.
+ ACE_ASSERT (0);
+}
+
+
+TAO_SCIOP_Connection_Handler::TAO_SCIOP_Connection_Handler (TAO_ORB_Core *orb_core,
+ CORBA::Boolean flag)
+ : TAO_SCIOP_SVC_HANDLER (orb_core->thr_mgr (), 0, 0),
+ TAO_Connection_Handler (orb_core),
+ dscp_codepoint_ (IPDSFIELD_DSCP_DEFAULT << 2)
+{
+ TAO_SCIOP_Transport* specific_transport = 0;
+ ACE_NEW (specific_transport,
+ TAO_SCIOP_Transport (this, orb_core, flag));
+
+ // store this pointer (indirectly increment ref count)
+ this->transport (specific_transport);
+}
+
+TAO_SCIOP_Connection_Handler::TAO_SCIOP_Connection_Handler (TAO_ORB_Core *orb_core)
+ : TAO_SCIOP_SVC_HANDLER (orb_core->thr_mgr (), 0, 0),
+ TAO_Connection_Handler (orb_core),
+ dscp_codepoint_ (IPDSFIELD_DSCP_DEFAULT << 2)
+{
+}
+
+
+TAO_SCIOP_Connection_Handler::~TAO_SCIOP_Connection_Handler (void)
+{
+ delete this->transport ();
+}
+
+int
+TAO_SCIOP_Connection_Handler::open_handler (void *v)
+{
+ return this->open (v);
+}
+
+int
+TAO_SCIOP_Connection_Handler::open (void*)
+{
+ TAO_SCIOP_Protocol_Properties protocol_properties;
+
+ // Initialize values from ORB params.
+ protocol_properties.send_buffer_size_ =
+ this->orb_core ()->orb_params ()->sock_sndbuf_size ();
+ protocol_properties.recv_buffer_size_ =
+ this->orb_core ()->orb_params ()->sock_rcvbuf_size ();
+ protocol_properties.no_delay_ =
+ this->orb_core ()->orb_params ()->nodelay ();
+
+ TAO_Protocols_Hooks *tph =
+ this->orb_core ()->get_protocols_hooks ();
+
+ bool client =
+ this->transport ()->opened_as () == TAO::TAO_CLIENT_ROLE;;
+
+ ACE_DECLARE_NEW_CORBA_ENV;
+
+ ACE_TRY
+ {
+ if (client)
+ {
+ tph->client_protocol_properties_at_orb_level (
+ protocol_properties
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ else
+ {
+ tph->server_protocol_properties_at_orb_level (
+ protocol_properties
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ }
+ ACE_CATCHANY
+ {
+ return -1;
+ }
+ ACE_ENDTRY;
+ ACE_CHECK_RETURN (-1);
+
+ if (this->set_socket_option (this->peer (),
+ protocol_properties.send_buffer_size_,
+ protocol_properties.recv_buffer_size_) == -1)
+ return -1;
+
+#if !defined (ACE_LACKS_TCP_NODELAY)
+ if (this->peer ().set_option (IPPROTO_SCTP,
+ SCTP_NODELAY,
+ (void *) &protocol_properties.no_delay_,
+ sizeof (protocol_properties.no_delay_)) == -1)
+ return -1;
+#endif /* ! ACE_LACKS_TCP_NODELAY */
+
+ if (this->transport ()->wait_strategy ()->non_blocking ())
+ {
+ if (this->peer ().enable (ACE_NONBLOCK) == -1)
+ return -1;
+ }
+
+ // Called by the <Strategy_Acceptor> when the handler is
+ // completely connected.
+
+ ACE_INET_Addr remote_addr;
+ if (this->peer ().get_remote_addr (remote_addr) == -1)
+ return -1;
+
+ ACE_INET_Addr local_addr;
+ if (this->peer ().get_local_addr (local_addr) == -1)
+ return -1;
+
+
+ if (TAO_debug_level > 2)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT("TAO(%P|%t) - SCIOP_Connection_Handler::open, ")
+ ACE_TEXT("The local addr is (%s) \n"),
+ local_addr. get_host_addr ()));
+
+ if (local_addr.get_ip_address () == remote_addr.get_ip_address ()
+ && local_addr.get_port_number () == remote_addr.get_port_number ())
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_TCHAR remote_as_string[MAXHOSTNAMELEN + 16];
+ ACE_TCHAR local_as_string[MAXHOSTNAMELEN + 16];
+
+ (void) remote_addr.addr_to_string (remote_as_string,
+ sizeof(remote_as_string));
+ (void) local_addr.addr_to_string (local_as_string,
+ sizeof(local_as_string));
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT("TAO(%P|%t) - TAO_SCIOP_Connection_Handler::open, ")
+ ACE_TEXT("Holy Cow! The remote addr and ")
+ ACE_TEXT("local addr are identical (%s == %s)\n"),
+ remote_as_string, local_as_string));
+ }
+ return -1;
+ }
+
+ if (TAO_debug_level > 0)
+ {
+ ACE_TCHAR client[MAXHOSTNAMELEN + 16];
+
+ // Verify that we can resolve the peer hostname.
+ if (remote_addr.addr_to_string (client, sizeof (client)) == -1)
+ return -1;
+
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - SCIOP_Connection_Handler::open, SCIOP ")
+ ACE_TEXT ("connection to peer <%s> on %d\n"),
+ client, this->peer ().get_handle ()));
+ }
+
+ // Set that the transport is now connected, if fails we return -1
+ // Use C-style cast b/c otherwise we get warnings on lots of
+ // compilers
+ if (!this->transport ()->post_open ((size_t) this->get_handle ()))
+ return -1;
+
+ this->state_changed (TAO_LF_Event::LFS_SUCCESS,
+ this->orb_core ()->leader_follower ());
+
+ return 0;
+}
+
+int
+TAO_SCIOP_Connection_Handler::resume_handler (void)
+{
+ return ACE_Event_Handler::ACE_APPLICATION_RESUMES_HANDLER;
+}
+
+int
+TAO_SCIOP_Connection_Handler::close_connection (void)
+{
+ return this->close_connection_eh (this);
+}
+
+int
+TAO_SCIOP_Connection_Handler::handle_input (ACE_HANDLE h)
+{
+ return this->handle_input_eh (h, this);
+}
+
+int
+TAO_SCIOP_Connection_Handler::handle_output (ACE_HANDLE handle)
+{
+ int const result =
+ this->handle_output_eh (handle, this);
+
+ if (result == -1)
+ {
+ this->close_connection ();
+ return 0;
+ }
+
+ return result;
+}
+
+int
+TAO_SCIOP_Connection_Handler::handle_timeout (const ACE_Time_Value &,
+ const void *)
+{
+ // We don't use this upcall for I/O. This is only used by the
+ // Connector to indicate that the connection timedout. Therefore,
+ // we should call close().
+ return this->close ();
+}
+
+int
+TAO_SCIOP_Connection_Handler::handle_close (ACE_HANDLE,
+ ACE_Reactor_Mask)
+{
+ ACE_ASSERT (0);
+ return 0;
+}
+
+int
+TAO_SCIOP_Connection_Handler::close (u_long)
+{
+ return this->close_handler ();
+}
+
+int
+TAO_SCIOP_Connection_Handler::release_os_resources (void)
+{
+ return this->peer().close ();
+}
+
+int
+TAO_SCIOP_Connection_Handler::add_transport_to_cache (void)
+{
+ ACE_INET_Addr addr;
+
+ // Get the peername.
+ if (this->peer ().get_remote_addr (addr) == -1)
+ return -1;
+
+ // Construct an SCIOP_Endpoint object
+ TAO_SCIOP_Endpoint endpoint (
+ addr,
+ this->orb_core()->orb_params()->use_dotted_decimal_addresses ());
+
+ // Construct a property object
+ TAO_Base_Transport_Property prop (&endpoint);
+
+ TAO::Transport_Cache_Manager &cache =
+ this->orb_core ()->lane_resources ().transport_cache ();
+
+ // Idle the transport..
+ return cache.cache_idle_transport (&prop,
+ this->transport ());
+
+}
+
+int
+TAO_SCIOP_Connection_Handler::process_listen_point_list (
+ IIOP::ListenPointList &listen_list)
+{
+ // Get the size of the list
+ CORBA::ULong const len = listen_list.length ();
+
+ for (CORBA::ULong i = 0; i < len; ++ i)
+ {
+ IIOP::ListenPoint listen_point = listen_list[i];
+ ACE_INET_Addr addr (listen_point.port,
+ listen_point.host.in ());
+
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT("(%P|%t) Listening port [%d] on [%s]\n"),
+ listen_point.port,
+ ACE_TEXT_CHAR_TO_TCHAR(listen_point.host.in ())));
+ }
+
+ // Construct an SCIOP_Endpoint object
+ TAO_SCIOP_Endpoint endpoint (addr,
+ this->orb_core()->orb_params()->use_dotted_decimal_addresses ());
+
+ // Construct a property object
+ TAO_Base_Transport_Property prop (&endpoint);
+
+ // Mark the connection as bidirectional
+ prop.set_bidir_flag (1);
+
+ // The property for this handler has changed. Recache the
+ // handler with this property
+ int const retval = this->transport ()->recache_transport (&prop);
+ if (retval == -1)
+ return retval;
+
+ // Make the handler idle and ready for use
+ this->transport ()->make_idle ();
+ }
+
+ return 0;
+}
+
+int
+TAO_SCIOP_Connection_Handler::set_dscp_codepoint (CORBA::Boolean set_network_priority)
+{
+ int tos = IPDSFIELD_DSCP_DEFAULT << 2;
+
+ if (set_network_priority)
+ {
+ TAO_Protocols_Hooks *tph =
+ this->orb_core ()->get_protocols_hooks ();
+
+ CORBA::Long codepoint =
+ tph->get_dscp_codepoint ();
+
+ tos = (int)(codepoint) << 2;
+ }
+
+ if (tos != this->dscp_codepoint_)
+ {
+ int const result = this->peer ().set_option (IPPROTO_IP,
+ IP_TOS,
+ (int *) &tos ,
+ (int) sizeof (tos));
+
+ if (TAO_debug_level)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - SCIOP_Connection_Handler::"
+ "set_dscp_codepoint -> dscp: %x; result: %d; %s\n",
+ tos,
+ result,
+ result == -1 ? "try running as superuser" : ""));
+ }
+
+ // On successful setting of TOS field.
+ if (result == 0)
+ this->dscp_codepoint_ = tos;
+
+ }
+
+ return 0;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_SCIOP == 1 */
diff --git a/TAO/tao/Strategies/SCIOP_Connection_Handler.h b/TAO/tao/Strategies/SCIOP_Connection_Handler.h
new file mode 100644
index 00000000000..2a43c03057c
--- /dev/null
+++ b/TAO/tao/Strategies/SCIOP_Connection_Handler.h
@@ -0,0 +1,144 @@
+// -*- C++ -*-
+
+// $Id$
+// ===================================================================
+/**
+ * @file SCIOP_Connection_Handler.h
+ *
+ * @author Jason Cohen, Lockheed Martin ATL <jcohen@atl.lmco.com>
+ * @author Keith O'Hara, Lockheed Martin ATL
+ */
+// ===================================================================
+
+#ifndef TAO_SCIOP_CONNECTION_HANDLER_H
+#define TAO_SCIOP_CONNECTION_HANDLER_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+#pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if TAO_HAS_SCIOP == 1
+
+#include "tao/Strategies/strategies_export.h"
+#include "tao/Connection_Handler.h"
+#include "tao/IIOPC.h"
+#include "tao/TimeBaseC.h"
+
+#include "ace/Reactor.h"
+#include "ace/Svc_Handler.h"
+#include "ace/SOCK_SEQPACK_Association.h"
+
+#if defined ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT
+template class TAO_Strategies_Export ACE_Svc_Handler<ACE_SOCK_SEQPACK_ASSOCIATION, ACE_NULL_SYNCH>;
+#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Service Handler for this transport
+typedef ACE_Svc_Handler<ACE_SOCK_SEQPACK_ASSOCIATION, ACE_NULL_SYNCH>
+ TAO_SCIOP_SVC_HANDLER;
+
+// Forward Decls
+class TAO_Pluggable_Messaging;
+
+// ****************************************************************
+
+/**
+ * @class TAO_SCIOP_Connection_Handler
+ *
+ * @brief Handles requests on a single connection.
+ *
+ * The Connection handler which is common for the Acceptor and
+ * the Connector
+ */
+
+
+class TAO_Strategies_Export TAO_SCIOP_Connection_Handler
+ : public TAO_SCIOP_SVC_HANDLER,
+ public TAO_Connection_Handler
+{
+
+public:
+
+ TAO_SCIOP_Connection_Handler (ACE_Thread_Manager* t = 0);
+
+ /// Constructor.
+ TAO_SCIOP_Connection_Handler (TAO_ORB_Core *orb_core,
+ CORBA::Boolean flag);
+
+ /// Destructor.
+ ~TAO_SCIOP_Connection_Handler (void);
+
+ //@{
+ /**
+ * Connection_Handler overloads
+ */
+ virtual int open_handler (void *);
+ //@}
+
+ /// Called by the <Strategy_Acceptor> when the handler is completely
+ /// connected. Argument is unused.
+ virtual int open (void *);
+
+ /// Close called by the Acceptor or Connector when connection
+ /// establishment fails.
+ int close (u_long = 0);
+
+ //@{
+ /** @name Event Handler overloads
+ */
+ virtual int resume_handler (void);
+ virtual int close_connection (void);
+ virtual int handle_input (ACE_HANDLE);
+ virtual int handle_output (ACE_HANDLE);
+ virtual int handle_close (ACE_HANDLE, ACE_Reactor_Mask);
+ virtual int handle_timeout (const ACE_Time_Value &current_time,
+ const void *act = 0);
+ //@}
+
+ /// Add ourselves to Cache.
+ int add_transport_to_cache (void);
+
+ /// Process the <listen_list>
+ int process_listen_point_list (IIOP::ListenPointList &listen_list);
+
+ /// Set Diff-Serv codepoint on outgoing packets.
+ int set_dscp_codepoint (CORBA::Boolean set_network_priority);
+
+protected:
+
+ /// Constructor that could be used by the derived classes.
+ /**
+ * Sometimes new pluggbale protocols which have similarties with
+ * IIOP may be tempted to this class for their use. Classical
+ * example being that of IIOP_SSL_Connection_Handler. This
+ * constructor just initializes its base class and sets all of its
+ * contents to the default value, if any
+ */
+ TAO_SCIOP_Connection_Handler (TAO_ORB_Core *orb_core);
+
+ //@{
+ /**
+ * @name TAO_Connection Handler overloads
+ */
+ // void handle_close_i (void);
+ virtual int release_os_resources (void);
+ //@}
+
+private:
+
+ /// Stores the type of service value.
+ int dscp_codepoint_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_SCIOP == 1 */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_SCIOP_CONNECTION_HANDLER_H */
diff --git a/TAO/tao/Strategies/SCIOP_Connector.cpp b/TAO/tao/Strategies/SCIOP_Connector.cpp
new file mode 100644
index 00000000000..663bccdb60a
--- /dev/null
+++ b/TAO/tao/Strategies/SCIOP_Connector.cpp
@@ -0,0 +1,430 @@
+#include "tao/Strategies/SCIOP_Connector.h"
+#include "tao/Strategies/SCIOP_Profile.h"
+
+#if TAO_HAS_SCIOP == 1
+
+#include "tao/debug.h"
+#include "tao/ORB_Core.h"
+#include "tao/Client_Strategy_Factory.h"
+#include "tao/Environment.h"
+#include "tao/Base_Transport_Property.h"
+#include "tao/Protocols_Hooks.h"
+#include "tao/Transport_Cache_Manager.h"
+#include "tao/Connect_Strategy.h"
+#include "tao/Thread_Lane_Resources.h"
+#include "tao/Transport.h"
+#include "tao/Wait_Strategy.h"
+#include "tao/Profile_Transport_Resolver.h"
+
+#include "ace/OS_NS_strings.h"
+#include "ace/Strategies_T.h"
+
+
+ACE_RCSID (TAO,
+ SCIOP_Connector,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_SCIOP_Connector::TAO_SCIOP_Connector (CORBA::Boolean flag)
+ : TAO_Connector (TAO_TAG_SCIOP_PROFILE),
+ lite_flag_ (flag),
+ connect_strategy_ (),
+ base_connector_ ()
+{
+}
+
+TAO_SCIOP_Connector::~TAO_SCIOP_Connector (void)
+{
+}
+
+int
+TAO_SCIOP_Connector::open (TAO_ORB_Core *orb_core)
+{
+ // @@todo: The functionality of the following two statements could
+ // be done in the constructor, but that involves changing the
+ // interface of the pluggable transport factory.
+
+ // Set the ORB Core
+ this->orb_core (orb_core);
+
+ // Create our connect strategy
+ if (this->create_connect_strategy () == -1)
+ return -1;
+
+ /// Our connect creation strategy
+ TAO_SCIOP_CONNECT_CREATION_STRATEGY *connect_creation_strategy = 0;
+
+ ACE_NEW_RETURN (connect_creation_strategy,
+ TAO_SCIOP_CONNECT_CREATION_STRATEGY
+ (orb_core->thr_mgr (),
+ orb_core,
+ this->lite_flag_),
+ -1);
+
+ /// Our activation strategy
+ TAO_SCIOP_CONNECT_CONCURRENCY_STRATEGY *concurrency_strategy = 0;
+
+ ACE_NEW_RETURN (concurrency_strategy,
+ TAO_SCIOP_CONNECT_CONCURRENCY_STRATEGY (orb_core),
+ -1);
+
+ return this->base_connector_.open (this->orb_core ()->reactor (),
+ connect_creation_strategy,
+ &this->connect_strategy_,
+ concurrency_strategy);
+}
+
+int
+TAO_SCIOP_Connector::close (void)
+{
+ delete this->base_connector_.concurrency_strategy ();
+ delete this->base_connector_.creation_strategy ();
+ return this->base_connector_.close ();
+}
+
+int
+TAO_SCIOP_Connector::set_validate_endpoint (TAO_Endpoint *endpoint)
+{
+ TAO_SCIOP_Endpoint *sciop_endpoint =
+ this->remote_endpoint (endpoint);
+
+ if (sciop_endpoint == 0)
+ return -1;
+
+ const ACE_INET_Addr &remote_address =
+ sciop_endpoint->object_addr ();
+
+ // Verify that the remote ACE_INET_Addr was initialized properly.
+ // Failure can occur if hostname lookup failed when initializing the
+ // remote ACE_INET_Addr.
+ if (remote_address.get_type () != AF_INET)
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) SCIOP connection failed.\n")
+ ACE_TEXT ("TAO (%P|%t) This is most likely ")
+ ACE_TEXT ("due to a hostname lookup ")
+ ACE_TEXT ("failure.\n")));
+ }
+
+ return -1;
+ }
+
+ return 0;
+}
+
+TAO_Transport *
+TAO_SCIOP_Connector::make_connection (TAO::Profile_Transport_Resolver *r,
+ TAO_Transport_Descriptor_Interface &desc,
+ ACE_Time_Value *timeout)
+{
+ TAO_Endpoint *tao_endpoint = desc.endpoint ();
+
+ TAO_Transport *transport = 0;
+
+ // @@ ATL folks, is this while loop needed?
+ // TAO_Default_Endpoint_Selector has this code already, i.e., the
+ // loop.
+ while (tao_endpoint != 0)
+ {
+ TAO_SCIOP_Endpoint *sciop_endpoint =
+ this->remote_endpoint (tao_endpoint);
+
+ if (sciop_endpoint != 0)
+ {
+ transport =
+ this->make_connection_i (r, desc, timeout, sciop_endpoint);
+ if (transport)
+ {
+ break;
+ }
+ }
+ tao_endpoint = tao_endpoint->next();
+ }
+
+ return transport;
+}
+
+
+TAO_Transport *
+TAO_SCIOP_Connector::make_connection_i (TAO::Profile_Transport_Resolver *r,
+ TAO_Transport_Descriptor_Interface &desc,
+ ACE_Time_Value *timeout,
+ TAO_SCIOP_Endpoint *sciop_endpoint)
+{
+ const ACE_INET_Addr &remote_address =
+ sciop_endpoint->object_addr ();
+
+ if (TAO_debug_level > 2)
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - SCIOP_Connector::make_connection_i, "
+ "to <%s:%d> which should %s\n",
+ ACE_TEXT_CHAR_TO_TCHAR(sciop_endpoint->host()),
+ sciop_endpoint->port(),
+ r->blocked_connect () ? ACE_TEXT("block") : ACE_TEXT("nonblock")));
+
+ // Get the right synch options
+ ACE_Synch_Options synch_options;
+
+ this->active_connect_strategy_->synch_options (timeout,
+ synch_options);
+
+ // If we don't need to block for a transport just set the timeout to
+ // be zero.
+ ACE_Time_Value tmp_zero (ACE_Time_Value::zero);
+ if (!r->blocked_connect())
+ {
+ synch_options.timeout (ACE_Time_Value::zero);
+ timeout = &tmp_zero;
+ }
+
+ TAO_SCIOP_Connection_Handler *svc_handler = 0;
+
+ // Connect.
+ ACE_Multihomed_INET_Addr multihomed;
+ if (multihomed.set(remote_address.get_port_number(),
+ remote_address.get_ip_address()))
+ return 0;
+
+ ACE_Multihomed_INET_Addr local_address;
+
+ bool pn =
+ sciop_endpoint->is_preferred_network ();
+
+ if (pn)
+ local_address.set ((u_short) 0,
+ sciop_endpoint->preferred_network ());
+
+ int result =
+ this->base_connector_.connect (svc_handler,
+ multihomed,
+ synch_options,
+ local_address);
+
+ // This call creates the service handler and bumps the #REFCOUNT# up
+ // one extra. There are three possibilities: (a) connection
+ // succeeds immediately - in this case, the #REFCOUNT# on the
+ // handler is two; (b) connection completion is pending - in this
+ // case, the #REFCOUNT# on the handler is also two; (c) connection
+ // fails immediately - in this case, the #REFCOUNT# on the handler
+ // is one since close() gets called on the handler.
+ //
+ // The extra reference count in
+ // TAO_Connect_Creation_Strategy::make_svc_handler() is needed in
+ // the case when connection completion is pending and we are going
+ // to wait on a variable in the handler to changes, signifying
+ // success or failure. Note, that this increment cannot be done
+ // once the connect() returns since this might be too late if
+ // another thread pick up the completion and potentially deletes the
+ // handler before we get a chance to increment the reference count.
+
+ // Make sure that we always do a remove_reference
+ ACE_Event_Handler_var svc_handler_auto_ptr (svc_handler);
+
+ TAO_Transport *transport =
+ svc_handler->transport ();
+
+ if (result == -1)
+ {
+ // No immediate result, wait for completion
+ if (errno == EWOULDBLOCK)
+ {
+ // Try to wait until connection completion. Incase we block, then we
+ // get a connected transport or not. In case of non block we get
+ // a connected or not connected transport
+ if (!this->wait_for_connection_completion (r,
+ transport,
+ timeout))
+ {
+ if (TAO_debug_level > 2)
+ ACE_ERROR ((LM_ERROR, "TAO (%P|%t) - SCIOP_Connector::"
+ "make_connection_i, "
+ "wait for completion failed\n"));
+ }
+ }
+ else
+ {
+ // Transport is not usable
+ transport = 0;
+ }
+ }
+
+ // In case of errors transport is zero
+ if (transport == 0)
+ {
+ // Give users a clue to the problem.
+ if (TAO_debug_level)
+ {
+ ACE_DEBUG ((LM_ERROR,
+ "TAO (%P|%t) - SCIOP_Connector::make_connection_i, "
+ "connection to <%s:%d> failed (%p)\n",
+ sciop_endpoint->host (), sciop_endpoint->port (),
+ "errno"));
+ }
+
+ return 0;
+ }
+
+ // At this point, the connection has be successfully connected.
+ // #REFCOUNT# is one.
+ if (TAO_debug_level > 2)
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - SCIOP_Connector::make_connection_i, "
+ "new %s connection to <%s:%d> on Transport[%d]\n",
+ transport->is_connected() ? "connected" : "not connected",
+ sciop_endpoint->host (), sciop_endpoint->port (),
+ svc_handler->peer ().get_handle ()));
+
+ // Add the handler to Cache
+ int retval =
+ this->orb_core ()->lane_resources ().transport_cache ().cache_transport (&desc,
+ transport);
+
+ // Failure in adding to cache.
+ if (retval != 0)
+ {
+ // Close the handler.
+ svc_handler->close ();
+
+ if (TAO_debug_level > 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "TAO (%P|%t) - SCIOP_Connector::make_connection_i, "
+ "could not add the new connection to cache\n"));
+ }
+
+ return 0;
+ }
+
+ if (transport->is_connected () &&
+ transport->wait_strategy ()->register_handler () != 0)
+ {
+ // Registration failures.
+
+ // Purge from the connection cache, if we are not in the cache, this
+ // just does nothing.
+ (void) transport->purge_entry ();
+
+ // Close the handler.
+ (void) transport->close_connection ();
+
+ if (TAO_debug_level > 0)
+ ACE_ERROR ((LM_ERROR,
+ "TAO (%P|%t) - SCIOP_Connector [%d]::make_connection_i, "
+ "could not register the transport "
+ "in the reactor.\n",
+ transport->id ()));
+
+ return 0;
+ }
+
+ return transport;
+}
+
+TAO_Profile *
+TAO_SCIOP_Connector::create_profile (TAO_InputCDR& cdr)
+{
+ TAO_Profile *pfile;
+ ACE_NEW_RETURN (pfile,
+ TAO_SCIOP_Profile (this->orb_core ()),
+ 0);
+
+ int r = pfile->decode (cdr);
+ if (r == -1)
+ {
+ pfile->_decr_refcnt ();
+ pfile = 0;
+ }
+
+ return pfile;
+}
+
+TAO_Profile *
+TAO_SCIOP_Connector::make_profile (ACE_ENV_SINGLE_ARG_DECL)
+{
+ // The endpoint should be of the form:
+ // N.n@host:port/object_key
+ // or:
+ // host:port/object_key
+
+ TAO_Profile *profile = 0;
+ ACE_NEW_THROW_EX (profile,
+ TAO_SCIOP_Profile (this->orb_core ()),
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (0);
+
+ return profile;
+}
+
+int
+TAO_SCIOP_Connector::check_prefix (const char *endpoint)
+{
+ // Check for a valid string
+ if (!endpoint || !*endpoint)
+ return -1; // Failure
+
+ const char *protocol[] = { "sciop", "scioploc" };
+
+ size_t slot = ACE_OS::strchr (endpoint, ':') - endpoint;
+
+ size_t len0 = ACE_OS::strlen (protocol[0]);
+ size_t len1 = ACE_OS::strlen (protocol[1]);
+
+ // Check for the proper prefix in the IOR. If the proper prefix
+ // isn't in the IOR then it is not an IOR we can use.
+ if (slot == len0
+ && ACE_OS::strncasecmp (endpoint, protocol[0], len0) == 0)
+ return 0;
+ else if (slot == len1
+ && ACE_OS::strncasecmp (endpoint, protocol[1], len1) == 0)
+ return 0;
+
+ return -1;
+ // Failure: not an SCIOP IOR
+ // DO NOT throw an exception here.
+}
+
+char
+TAO_SCIOP_Connector::object_key_delimiter (void) const
+{
+ return TAO_SCIOP_Profile::object_key_delimiter_;
+}
+
+TAO_SCIOP_Endpoint *
+TAO_SCIOP_Connector::remote_endpoint (TAO_Endpoint *endpoint)
+{
+ if (endpoint->tag () != TAO_TAG_SCIOP_PROFILE)
+ return 0;
+
+ TAO_SCIOP_Endpoint *sciop_endpoint =
+ dynamic_cast<TAO_SCIOP_Endpoint *> (endpoint );
+ if (sciop_endpoint == 0)
+ return 0;
+
+ return sciop_endpoint;
+}
+
+int
+TAO_SCIOP_Connector::cancel_svc_handler (
+ TAO_Connection_Handler * svc_handler)
+{
+ TAO_SCIOP_Connection_Handler* handler=
+ dynamic_cast<TAO_SCIOP_Connection_Handler*>(svc_handler);
+
+ if (handler)
+ // Cancel from the connector
+ return this->base_connector_.cancel (handler);
+
+ return -1;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_SCIOP == 1 */
diff --git a/TAO/tao/Strategies/SCIOP_Connector.h b/TAO/tao/Strategies/SCIOP_Connector.h
new file mode 100644
index 00000000000..32654e24662
--- /dev/null
+++ b/TAO/tao/Strategies/SCIOP_Connector.h
@@ -0,0 +1,134 @@
+// -*- C++ -*-
+
+// $Id$
+//=============================================================================
+/**
+ * @file SCIOP_Connector.h
+ *
+ * SCIOP specific connector processing
+ *
+ * @author Jason Cohen, Lockheed Martin ATL <jcohen@atl.lmco.com>
+ * @author Keith O'Hara, Lockheed Martin ATL
+ */
+//=============================================================================
+
+#ifndef TAO_SCIOP_CONNECTOR_H
+#define TAO_SCIOP_CONNECTOR_H
+
+#include /**/ "ace/pre.h"
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if TAO_HAS_SCIOP == 1
+
+#include "tao/Transport_Connector.h"
+#include "tao/Connector_Impl.h"
+#include "tao/Strategies/SCIOP_Connection_Handler.h"
+#include "ace/SOCK_SEQPACK_Connector.h"
+#include "ace/Connector.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_SCIOP_Endpoint;
+
+// ****************************************************************
+
+/**
+ * @class TAO_SCIOP_Connector
+ *
+ * @brief SCIOP-specific Connector bridge for pluggable protocols.
+ *
+ * Concrete instance of the TAO_Connector class. Responsible
+ * for establishing a connection with a server and is called from the
+ * Connector_Registory.
+ */
+class TAO_Strategies_Export TAO_SCIOP_Connector : public TAO_Connector
+{
+public:
+ // = Initialization and termination methods.
+ /// Constructor.
+ TAO_SCIOP_Connector (CORBA::Boolean flag = false);
+
+ /// Destructor.
+ ~TAO_SCIOP_Connector (void);
+
+ // = The TAO_Connector methods, please check the documentation on
+ // Transport_Connector.h
+ int open (TAO_ORB_Core *orb_core);
+ int close (void);
+ TAO_Profile *create_profile (TAO_InputCDR& cdr);
+
+ virtual int check_prefix (const char *endpoint);
+
+ virtual char object_key_delimiter (void) const;
+
+public:
+
+ typedef TAO_Connect_Concurrency_Strategy<TAO_SCIOP_Connection_Handler>
+ TAO_SCIOP_CONNECT_CONCURRENCY_STRATEGY;
+
+ typedef TAO_Connect_Creation_Strategy<TAO_SCIOP_Connection_Handler>
+ TAO_SCIOP_CONNECT_CREATION_STRATEGY;
+
+ typedef ACE_Connect_Strategy<TAO_SCIOP_Connection_Handler,
+ ACE_SOCK_SEQPACK_CONNECTOR>
+ TAO_SCIOP_CONNECT_STRATEGY ;
+
+ typedef ACE_Strategy_Connector<TAO_SCIOP_Connection_Handler,
+ ACE_SOCK_SEQPACK_CONNECTOR>
+ TAO_SCIOP_BASE_CONNECTOR;
+
+protected:
+
+ // = The TAO_Connector methods, please check the documentation on
+ // Transport_Connector.h
+ int set_validate_endpoint (TAO_Endpoint *ep);
+
+ TAO_Transport *make_connection (TAO::Profile_Transport_Resolver *r,
+ TAO_Transport_Descriptor_Interface &desc,
+ ACE_Time_Value *timeout = 0);
+
+ /// More TAO_Connector methods, please check the documentation on
+ /// Transport_Connector.h
+ virtual TAO_Profile *make_profile (ACE_ENV_SINGLE_ARG_DECL);
+
+ /// Cancel the passed cvs handler from the connector
+ int cancel_svc_handler (TAO_Connection_Handler * svc_handler);
+
+protected:
+
+ /// Do we need to use a GIOP_Lite for sending messages?
+ CORBA::Boolean lite_flag_;
+
+
+private:
+
+ /// Return the remote endpoint, a helper function
+ TAO_SCIOP_Endpoint *remote_endpoint (TAO_Endpoint *ep);
+
+ /// Try to make a connection to the next endpoint in the list.
+ TAO_Transport *make_connection_i (TAO::Profile_Transport_Resolver *r,
+ TAO_Transport_Descriptor_Interface &desc,
+ ACE_Time_Value *timeout,
+ TAO_SCIOP_Endpoint *sciop_endpoint);
+
+private:
+
+ /// Our connect strategy
+ TAO_SCIOP_CONNECT_STRATEGY connect_strategy_;
+
+ /// The connector initiating connection requests for SCIOP.
+ TAO_SCIOP_BASE_CONNECTOR base_connector_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_SCIOP == 1 */
+
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_SCIOP_CONNECTOR_H */
diff --git a/TAO/tao/Strategies/SCIOP_Endpoint.cpp b/TAO/tao/Strategies/SCIOP_Endpoint.cpp
new file mode 100644
index 00000000000..136d8927ff2
--- /dev/null
+++ b/TAO/tao/Strategies/SCIOP_Endpoint.cpp
@@ -0,0 +1,370 @@
+#include "tao/Strategies/SCIOP_Endpoint.h"
+
+#if TAO_HAS_SCIOP == 1
+
+#include "tao/ORB_Constants.h"
+#include "tao/debug.h"
+
+#include "ace/Synch_Traits.h"
+#include "ace/Thread_Mutex.h"
+#include "ace/OS_NS_string.h"
+#include "ace/Log_Msg.h"
+#include "ace/Synch.h"
+#include "ace/OS_NS_stdio.h"
+#include "tao/ORB_Core.h"
+
+ACE_RCSID (Strategies,
+ SCIOP_Endpoint,
+ "$Id$")
+
+
+#if !defined (__ACE_INLINE__)
+# include "tao/Strategies/SCIOP_Endpoint.i"
+#endif /* __ACE_INLINE__ */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_SCIOP_Endpoint::TAO_SCIOP_Endpoint (const ACE_INET_Addr &addr,
+ int use_dotted_decimal_addresses)
+ : TAO_Endpoint (TAO_TAG_SCIOP_PROFILE)
+ , host_ ()
+ , port_ (683) // default port (IANA assigned)
+ , object_addr_ (addr)
+ , object_addr_set_ (0)
+ , preferred_path_ ()
+ , is_encodable_ (true)
+ , next_ (0)
+{
+ this->set (addr, use_dotted_decimal_addresses);
+}
+
+TAO_SCIOP_Endpoint::TAO_SCIOP_Endpoint (const char *host,
+ CORBA::UShort port,
+ const ACE_INET_Addr &addr,
+ CORBA::Short priority)
+ : TAO_Endpoint (TAO_TAG_SCIOP_PROFILE,
+ priority)
+ , host_ (host)
+ , port_ (port)
+ , object_addr_ (addr)
+ , object_addr_set_ (0)
+ , preferred_path_ ()
+ , is_encodable_ (true)
+ , next_ (0)
+{
+}
+
+TAO_SCIOP_Endpoint::TAO_SCIOP_Endpoint (void)
+ : TAO_Endpoint (TAO_TAG_SCIOP_PROFILE)
+ , host_ ()
+ , port_ (683) // default port (IANA assigned)
+ , object_addr_ ()
+ , object_addr_set_ (0)
+ , preferred_path_ ()
+ , is_encodable_ (true)
+ , next_ (0)
+{
+}
+
+TAO_SCIOP_Endpoint::TAO_SCIOP_Endpoint (const char *host,
+ CORBA::UShort port,
+ CORBA::Short priority)
+ : TAO_Endpoint (TAO_TAG_SCIOP_PROFILE)
+ , host_ (host)
+ , port_ (port)
+ , object_addr_ ()
+ , object_addr_set_ (0)
+ , preferred_path_ ()
+ , is_encodable_ (true)
+ , next_ (0)
+{
+ this->priority (priority);
+}
+
+TAO_SCIOP_Endpoint::~TAO_SCIOP_Endpoint (void)
+{
+}
+
+TAO_SCIOP_Endpoint::TAO_SCIOP_Endpoint (const TAO_SCIOP_Endpoint &rhs)
+ : TAO_Endpoint (rhs.tag_,
+ rhs.priority_)
+ , host_ (rhs.host_)
+ , port_ (rhs.port_)
+ , object_addr_ (rhs.object_addr_)
+ , object_addr_set_ (rhs.object_addr_set_)
+ , preferred_path_ (rhs.preferred_path_)
+ , is_encodable_ (rhs.is_encodable_)
+ , next_ (0)
+{
+}
+
+int
+TAO_SCIOP_Endpoint::set (const ACE_INET_Addr &addr,
+ int use_dotted_decimal_addresses)
+{
+ char tmp_host[MAXHOSTNAMELEN + 1];
+
+ if (use_dotted_decimal_addresses
+ || addr.get_host_name (tmp_host, sizeof (tmp_host)) != 0)
+ {
+ const char *tmp = addr.get_host_addr ();
+ if (tmp == 0)
+ {
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("\n\nTAO (%P|%t) ")
+ ACE_TEXT ("SCIOP_Endpoint::set ")
+ ACE_TEXT ("- %p\n\n"),
+ ACE_TEXT ("cannot determine hostname")));
+ return -1;
+ }
+ else
+ this->host_ = tmp;
+ }
+ else
+ this->host_ = CORBA::string_dup (tmp_host);
+
+ this->port_ = addr.get_port_number();
+
+ return 0;
+}
+
+int
+TAO_SCIOP_Endpoint::addr_to_string (char *buffer, size_t length)
+{
+ size_t actual_len =
+ ACE_OS::strlen (this->host_.in ()) // chars in host name
+ + sizeof (':') // delimiter
+ + ACE_OS::strlen ("65536") // max port
+ + sizeof ('\0');
+
+ if (length < actual_len)
+ return -1;
+
+ ACE_OS::sprintf (buffer, "%s:%d",
+ this->host_.in (), this->port_);
+
+ return 0;
+}
+
+const char *
+TAO_SCIOP_Endpoint::host (const char *h)
+{
+ this->host_ = h;
+
+ return this->host_.in ();
+}
+
+TAO_Endpoint *
+TAO_SCIOP_Endpoint::next (void)
+{
+ return this->next_;
+}
+
+TAO_Endpoint *
+TAO_SCIOP_Endpoint::duplicate (void)
+{
+ TAO_SCIOP_Endpoint *endpoint = 0;
+
+ // @@NOTE: Not at all exception safe
+ ACE_NEW_RETURN (endpoint,
+ TAO_SCIOP_Endpoint (*this),
+ 0);
+
+ return endpoint;
+}
+
+CORBA::Boolean
+TAO_SCIOP_Endpoint::is_equivalent (const TAO_Endpoint *other_endpoint)
+{
+ TAO_Endpoint *endpt =
+ const_cast<TAO_Endpoint *> (other_endpoint);
+
+ TAO_SCIOP_Endpoint *endpoint =
+ dynamic_cast<TAO_SCIOP_Endpoint *> (endpt);
+ if (endpoint == 0)
+ return 0;
+
+ return (this->port_ == endpoint->port_
+ && (ACE_OS::strcmp(this->host(), endpoint->host()) == 0));
+}
+
+CORBA::ULong
+TAO_SCIOP_Endpoint::hash (void)
+{
+ if (this->hash_val_ != 0)
+ return this->hash_val_;
+
+ {
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
+ guard,
+ this->addr_lookup_lock_,
+ this->hash_val_);
+ // .. DCL
+ if (this->hash_val_ != 0)
+ return this->hash_val_;
+
+ // A few comments about this optimization. The call below will
+ // deadlock if the object_addr_set is false. If you don't belive
+
+ if (!this->object_addr_set_)
+ {
+ // Set the object_addr first
+ (void) this->object_addr_i ();
+ }
+
+ this->hash_val_ =
+ this->object_addr_.get_ip_address () + this->port ();
+ }
+
+ return this->hash_val_;
+}
+
+const ACE_INET_Addr &
+TAO_SCIOP_Endpoint::object_addr (void) const
+{
+ // The object_addr_ is initialized here, rather than at IOR decode
+ // time for several reasons:
+ // 1. A request on the object may never be invoked.
+ // 2. The DNS setup may have changed dynamically.
+ // ...etc..
+
+ // Double checked locking optimization.
+ if (!this->object_addr_set_)
+ {
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
+ guard,
+ this->addr_lookup_lock_,
+ this->object_addr_);
+
+ if (!this->object_addr_set_)
+ {
+ (void) this->object_addr_i ();
+ }
+ }
+
+ return this->object_addr_;
+}
+
+void
+TAO_SCIOP_Endpoint::object_addr_i (void) const
+{
+ if (this->object_addr_.set (this->port_,
+ this->host_.in ()) == -1)
+ {
+ // If this call fails, it most likely due a hostname
+ // lookup failure caused by a DNS misconfiguration. If
+ // a request is made to the object at the given host and
+ // port, then a CORBA::TRANSIENT() exception should be
+ // thrown.
+
+ // Invalidate the ACE_INET_Addr. This is used as a flag
+ // to denote that ACE_INET_Addr initialization failed.
+ this->object_addr_.set_type (-1);
+ }
+ else
+ {
+ this->object_addr_set_ = true;
+ }
+}
+
+CORBA::ULong
+TAO_SCIOP_Endpoint::preferred_interfaces (TAO_ORB_Core *oc)
+{
+ ACE_CString tmp (
+ oc->orb_params ()->preferred_interfaces ());
+
+ ssize_t pos = 0;
+
+ pos = tmp.find (this->host_.in ());
+
+ TAO_SCIOP_Endpoint *latest = this;
+
+ CORBA::ULong count = 0;
+
+ while (pos != ACE_CString::npos)
+ {
+ // Do we have a "," or an '\0'?
+ ssize_t new_pos = tmp.find (",",
+ pos + 1);
+
+ // Length of the preferred path
+ int length = 0;
+
+ if (new_pos == ACE_CString::npos)
+ length = tmp.length () - pos;
+ else
+ length = new_pos - pos;
+
+ ACE_CString rem_tmp = tmp.substr (pos, length);
+
+ // Search for the ":"
+ ssize_t col_pos = rem_tmp.find (":");
+
+ if (col_pos == ACE_CString::npos)
+ {
+ pos = tmp.find (latest->host_.in (),
+ pos + length);
+ continue;
+ }
+
+ ACE_CString path = rem_tmp.substr (col_pos + 1);
+
+ latest->preferred_path_.host =
+ CORBA::string_dup (path.c_str ());
+
+ if (TAO_debug_level > 3)
+ ACE_DEBUG ((LM_DEBUG,
+ "(%P|%t) Adding path [%s] "
+ " as preferred path for [%s] \n",
+ path.c_str (), this->host_.in ()));
+
+ pos = tmp.find (latest->host_.in (),
+ pos + length);
+
+ if (pos != ACE_CString::npos)
+ {
+ TAO_Endpoint *tmp_ep =
+ latest->duplicate ();
+
+ latest->next_ = dynamic_cast<TAO_SCIOP_Endpoint *> (tmp_ep);
+
+ if (latest->next_ == 0) return count;
+
+ latest = latest->next_;
+ ++count;
+ }
+ }
+
+ if (tmp.length () != 0 &&
+ !oc->orb_params ()->enforce_pref_interfaces ())
+ {
+ TAO_Endpoint *tmp_ep = latest->duplicate ();
+
+ latest->next_ =
+ dynamic_cast<TAO_SCIOP_Endpoint *> (tmp_ep);
+
+ if (latest->next_ == 0) return count;
+
+ latest->next_->preferred_path_.host = (const char *) 0;
+ ++count;
+ }
+
+ return count;
+}
+
+bool
+TAO_SCIOP_Endpoint::is_preferred_network (void) const
+{
+ return (this->preferred_path_.host.in () != 0);
+}
+
+const char *
+TAO_SCIOP_Endpoint::preferred_network (void) const
+{
+ return this->preferred_path_.host.in ();
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_SCIOP == 1 */
diff --git a/TAO/tao/Strategies/SCIOP_Endpoint.h b/TAO/tao/Strategies/SCIOP_Endpoint.h
new file mode 100644
index 00000000000..7772b4f4a0c
--- /dev/null
+++ b/TAO/tao/Strategies/SCIOP_Endpoint.h
@@ -0,0 +1,172 @@
+// -*- C++ -*-
+
+//===========================================================================
+/**
+ * @file SCIOP_Endpoint.h
+ *
+ * SCIOP implementation of PP Framework Endpoint interface.
+ *
+ * $Id$
+ *
+ * @author Jason Cohen, Lockheed Martin ATL <jcohen@atl.lmco.com>
+ * @author Keith O'Hara, Lockheed Martin ATL
+ */
+//==========================================================================
+
+
+#ifndef TAO_SCIOP_ENDPOINT_H
+#define TAO_SCIOP_ENDPOINT_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if TAO_HAS_SCIOP == 1
+#include "tao/Endpoint.h"
+#include "tao/Strategies/strategies_export.h"
+#include "tao/CORBA_String.h"
+#include "ace/INET_Addr.h"
+#include "tao/IIOP_EndpointsC.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_SCIOP_Connection_Handler;
+
+/**
+ * @class TAO_SCIOP_Endpoint
+ *
+ * @brief TAO_SCIOP_Endpoint
+ *
+ * SCIOP-specific implementation of PP Framework Endpoint interface.
+ */
+class TAO_Strategies_Export TAO_SCIOP_Endpoint : public TAO_Endpoint
+{
+public:
+
+ // @todo Lose these friends!
+ friend class TAO_SCIOP_Profile;
+ friend class TAO_SSLIOP_Profile;
+
+ // = Initialization and termination methods.
+
+ /// Default constructor.
+ TAO_SCIOP_Endpoint (void);
+
+ /// Constructor. This is the most efficient constructor since it
+ /// does not require any address resolution processing.
+ TAO_SCIOP_Endpoint (const char *host,
+ CORBA::UShort port,
+ const ACE_INET_Addr &addr,
+ CORBA::Short priority = TAO_INVALID_PRIORITY);
+
+ /// Constructor.
+ TAO_SCIOP_Endpoint (const ACE_INET_Addr &addr,
+ int use_dotted_decimal_addresses);
+
+ /// Constructor. This constructor is used when decoding endpoints.
+ TAO_SCIOP_Endpoint (const char *host,
+ CORBA::UShort port,
+ CORBA::Short priority);
+
+ /// Destructor.
+ ~TAO_SCIOP_Endpoint (void);
+
+ // = Implementation of abstract TAO_Endpoint methods. See
+ // Endpoint.h for their documentation.
+
+ virtual TAO_Endpoint *next (void);
+ virtual int addr_to_string (char *buffer, size_t length);
+ virtual TAO_Endpoint *duplicate (void);
+
+ /// Return true if this endpoint is equivalent to <other_endpoint>. Two
+ /// endpoints are equivalent iff their port and host are the same.
+ virtual CORBA::Boolean is_equivalent (const TAO_Endpoint *other_endpoint);
+
+ /// Return a hash value for this object.
+ virtual CORBA::ULong hash (void);
+
+ // = SCIOP_Endpoint-specific methods.
+
+ /// Return a reference to the <object_addr>.
+ const ACE_INET_Addr &object_addr (void) const;
+
+ /// Return a pointer to the host string. This object maintains
+ /// ownership of this string.
+ const char *host (void) const;
+
+ /// Copy the string <h> into <host_> and return the resulting pointer.
+ /// This object maintains ownership of this string.
+ const char *host (const char *h);
+
+ /// Return the port number.
+ CORBA::UShort port (void) const;
+
+ /// Set the port number.
+ CORBA::UShort port (CORBA::UShort p);
+
+ /// Do we have a preferred local network for the target?
+ bool is_preferred_network (void) const;
+
+ /// Return the preferred network if any.
+ const char *preferred_network (void) const;
+
+private:
+
+ /// Helper method for setting INET_Addr.
+ int set (const ACE_INET_Addr &addr,
+ int use_dotted_decimal_addresses);
+
+ /// Helper method for object_addr ().
+ void object_addr_i (void) const;
+
+ /// Generate preferred interfaces from the options passed in by the
+ /// user.
+ CORBA::ULong preferred_interfaces (TAO_ORB_Core *oc);
+
+ /// Canonical copy constructor
+ /**
+ * In private section to prevent clients from invoking this
+ * accidentally. Clients should only use duplicate () to make a depp
+ * copy
+ */
+ TAO_SCIOP_Endpoint (const TAO_SCIOP_Endpoint &);
+
+
+ /// String representing the host name.
+ CORBA::String_var host_;
+
+ /// TCP port number.
+ CORBA::UShort port_;
+
+ /// Cached instance of <ACE_INET_Addr> for use in making
+ /// invocations, etc.
+ mutable ACE_INET_Addr object_addr_;
+
+ /// Flag to indicate if the address has been resolved and set.
+ mutable int object_addr_set_;
+
+ /// Preferred path for this endpoint.
+ TAO::IIOP_Endpoint_Info preferred_path_;
+
+ /// Is this endpoint created encodable as part of the IOR?
+ bool is_encodable_;
+
+ /// SCIOP Endpoints can be stringed into a list. Return the next
+ /// endpoint in the list, if any.
+ TAO_SCIOP_Endpoint *next_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/Strategies/SCIOP_Endpoint.i"
+#endif /* __ACE_INLINE__ */
+
+#endif /* TAO_HAS_SCIOP == 1 */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_SCIOP_PROFILE_H */
diff --git a/TAO/tao/Strategies/SCIOP_Endpoint.i b/TAO/tao/Strategies/SCIOP_Endpoint.i
new file mode 100644
index 00000000000..2174f62be7b
--- /dev/null
+++ b/TAO/tao/Strategies/SCIOP_Endpoint.i
@@ -0,0 +1,24 @@
+// -*- C++ -*-
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE const char *
+TAO_SCIOP_Endpoint::host (void) const
+{
+ return this->host_.in ();
+}
+
+ACE_INLINE CORBA::UShort
+TAO_SCIOP_Endpoint::port (void) const
+{
+ return this->port_;
+}
+
+ACE_INLINE CORBA::UShort
+TAO_SCIOP_Endpoint::port (CORBA::UShort p)
+{
+ return this->port_ = p;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Strategies/SCIOP_Factory.cpp b/TAO/tao/Strategies/SCIOP_Factory.cpp
new file mode 100644
index 00000000000..c6c0d3a271d
--- /dev/null
+++ b/TAO/tao/Strategies/SCIOP_Factory.cpp
@@ -0,0 +1,96 @@
+#include "tao/Strategies/SCIOP_Factory.h"
+#include "tao/Strategies/SCIOP_Acceptor.h"
+#include "tao/Strategies/SCIOP_Connector.h"
+#include "ace/OS_NS_strings.h"
+
+#if TAO_HAS_SCIOP == 1
+
+#include "tao/IOPC.h"
+
+ACE_RCSID (tao,
+ SCIOP_Factory,
+ "$Id$")
+
+static const char prefix_[] = "sciop";
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_SCIOP_Protocol_Factory::TAO_SCIOP_Protocol_Factory (void)
+ : TAO_Protocol_Factory (TAO_TAG_SCIOP_PROFILE),
+ major_ (TAO_DEF_SCIOP_MAJOR),
+ minor_ (TAO_DEF_SCIOP_MINOR)
+{
+}
+
+TAO_SCIOP_Protocol_Factory::~TAO_SCIOP_Protocol_Factory (void)
+{
+}
+
+int
+TAO_SCIOP_Protocol_Factory::match_prefix (const ACE_CString &prefix)
+{
+ // Check for the proper prefix for this protocol.
+ return (ACE_OS::strcasecmp (prefix.c_str (), ::prefix_) == 0);
+}
+
+const char *
+TAO_SCIOP_Protocol_Factory::prefix (void) const
+{
+ return ::prefix_;
+}
+
+char
+TAO_SCIOP_Protocol_Factory::options_delimiter (void) const
+{
+ return '/';
+}
+
+TAO_Acceptor *
+TAO_SCIOP_Protocol_Factory::make_acceptor (void)
+{
+ TAO_Acceptor *acceptor = 0;
+
+ ACE_NEW_RETURN (acceptor,
+ TAO_SCIOP_Acceptor,
+ 0);
+
+ return acceptor;
+}
+
+int
+TAO_SCIOP_Protocol_Factory::init (int /* argc */,
+ ACE_TCHAR* /* argv */ [])
+{
+ return 0;
+}
+
+TAO_Connector *
+TAO_SCIOP_Protocol_Factory::make_connector (void)
+{
+ TAO_Connector *connector = 0;
+
+ ACE_NEW_RETURN (connector,
+ TAO_SCIOP_Connector,
+ 0);
+ return connector;
+}
+
+int
+TAO_SCIOP_Protocol_Factory::requires_explicit_endpoint (void) const
+{
+ return 1;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DEFINE (TAO_SCIOP_Protocol_Factory,
+ ACE_TEXT ("SCIOP_Factory"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (TAO_SCIOP_Protocol_Factory),
+ ACE_Service_Type::DELETE_THIS |
+ ACE_Service_Type::DELETE_OBJ,
+ 0)
+
+ACE_FACTORY_DEFINE (TAO, TAO_SCIOP_Protocol_Factory)
+
+#endif /* TAO_HAS_SCIOP == 1 */
diff --git a/TAO/tao/Strategies/SCIOP_Factory.h b/TAO/tao/Strategies/SCIOP_Factory.h
new file mode 100644
index 00000000000..d0b1fc489fa
--- /dev/null
+++ b/TAO/tao/Strategies/SCIOP_Factory.h
@@ -0,0 +1,77 @@
+// -*- C++ -*-
+
+// $Id$
+//=============================================================================
+/**
+ * @file SCIOP_Factory.h
+ *
+ * @author Jason Cohen, Lockheed Martin ATL <jcohen@atl.lmco.com>
+ * @author Keith O'Hara, Lockheed Martin ATL
+ */
+//=============================================================================
+
+
+#ifndef TAO_SCIOP_FACTORY_H
+#define TAO_SCIOP_FACTORY_H
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if TAO_HAS_SCIOP == 1
+
+#include "tao/Strategies/strategies_export.h"
+#include "ace/Service_Config.h"
+#include "tao/Protocol_Factory.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Acceptor;
+class TAO_Connector;
+
+class TAO_Strategies_Export TAO_SCIOP_Protocol_Factory
+: public TAO_Protocol_Factory
+{
+public:
+ TAO_SCIOP_Protocol_Factory (void);
+ virtual ~TAO_SCIOP_Protocol_Factory (void);
+
+ // = Service Configurator hooks.
+ /// Dynamic linking hook
+ virtual int init (int argc, ACE_TCHAR* argv[]);
+
+ /// Verify prefix is a match
+ virtual int match_prefix (const ACE_CString &prefix);
+
+ /// Returns the prefix used by the protocol.
+ virtual const char *prefix (void) const;
+
+ /// Return the character used to mark where an endpoint ends and
+ /// where its options begin.
+ virtual char options_delimiter (void) const;
+
+ // = Check Protocol_Factory.h for a description of these methods.
+ virtual TAO_Acceptor *make_acceptor (void);
+ virtual TAO_Connector *make_connector (void);
+ virtual int requires_explicit_endpoint (void) const;
+
+private:
+ /// Changing the version number can be used to provide backwards
+ /// compatibility with old clients.
+ int major_;
+ int minor_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE_EXPORT (TAO_Strategies, TAO_SCIOP_Protocol_Factory)
+ACE_FACTORY_DECLARE (TAO_Strategies, TAO_SCIOP_Protocol_Factory)
+
+
+#endif /* TAO_HAS_SCIOP == 1 */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_SCIOP_FACTORY_H */
diff --git a/TAO/tao/Strategies/SCIOP_Lite_Factory.cpp b/TAO/tao/Strategies/SCIOP_Lite_Factory.cpp
new file mode 100644
index 00000000000..e71cb4dd6ce
--- /dev/null
+++ b/TAO/tao/Strategies/SCIOP_Lite_Factory.cpp
@@ -0,0 +1,100 @@
+#include "tao/Strategies/SCIOP_Lite_Factory.h"
+#include "tao/Strategies/SCIOP_Acceptor.h"
+#include "tao/Strategies/SCIOP_Connector.h"
+#include "ace/Dynamic_Service.h"
+#include "ace/Get_Opt.h"
+#include "ace/OS_NS_strings.h"
+
+#if TAO_HAS_SCIOP == 1
+
+ACE_RCSID(tao, SCIOP_Factory, "$Id$")
+
+static const char prefix_[] = "sciop";
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_SCIOP_Lite_Protocol_Factory::TAO_SCIOP_Lite_Protocol_Factory (void)
+ : TAO_Protocol_Factory (TAO_TAG_SCIOP_PROFILE),
+ major_ (TAO_DEF_SCIOP_MAJOR),
+ minor_ (TAO_DEF_SCIOP_MINOR)
+{
+}
+
+TAO_SCIOP_Lite_Protocol_Factory::~TAO_SCIOP_Lite_Protocol_Factory (void)
+{
+
+}
+
+int
+TAO_SCIOP_Lite_Protocol_Factory::match_prefix (const ACE_CString &prefix)
+{
+ // Check for the proper prefix for this protocol.
+ return (ACE_OS::strcasecmp (prefix.c_str (), ::prefix_) == 0);
+}
+
+const char *
+TAO_SCIOP_Lite_Protocol_Factory::prefix (void) const
+{
+ return ::prefix_;
+}
+
+char
+TAO_SCIOP_Lite_Protocol_Factory::options_delimiter (void) const
+{
+ return '/';
+}
+
+TAO_Acceptor *
+TAO_SCIOP_Lite_Protocol_Factory::make_acceptor (void)
+{
+ TAO_Acceptor *acceptor = 0;
+
+ // We are a Lite factory
+ CORBA::Boolean lite_flag = 1;
+ ACE_NEW_RETURN (acceptor,
+ TAO_SCIOP_Acceptor (lite_flag),
+ 0);
+
+ return acceptor;
+}
+
+int
+TAO_SCIOP_Lite_Protocol_Factory::init (int /*argc*/,
+ ACE_TCHAR* /*argv*/ [])
+{
+ return 0;
+}
+
+TAO_Connector *
+TAO_SCIOP_Lite_Protocol_Factory::make_connector (void)
+{
+ TAO_Connector *connector = 0;
+
+ // We are a Lite factory
+ CORBA::Boolean lite_flag = 1;
+
+ ACE_NEW_RETURN (connector,
+ TAO_SCIOP_Connector (lite_flag),
+ 0);
+ return connector;
+}
+
+int
+TAO_SCIOP_Lite_Protocol_Factory::requires_explicit_endpoint (void) const
+{
+ return 0;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DEFINE (TAO_SCIOP_Lite_Protocol_Factory,
+ ACE_TEXT ("SCIOP_Lite_Factory"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (TAO_SCIOP_Lite_Protocol_Factory),
+ ACE_Service_Type::DELETE_THIS |
+ ACE_Service_Type::DELETE_OBJ,
+ 0)
+
+ACE_FACTORY_DEFINE (TAO, TAO_SCIOP_Lite_Protocol_Factory)
+
+#endif /* TAO_HAS_SCIOP == 1 */
diff --git a/TAO/tao/Strategies/SCIOP_Lite_Factory.h b/TAO/tao/Strategies/SCIOP_Lite_Factory.h
new file mode 100644
index 00000000000..7c9dbd4d181
--- /dev/null
+++ b/TAO/tao/Strategies/SCIOP_Lite_Factory.h
@@ -0,0 +1,77 @@
+// -*- C++ -*-
+
+// $Id$
+//==========================================================================
+/**
+ * @file SCIOP_Lite_Factory.h
+ *
+ * @author Jason Cohen, Lockheed Martin ATL <jcohen@atl.lmco.com>
+ * @author Keith O'Hara, Lockheed Martin ATL
+ */
+//==========================================================================
+
+
+#ifndef TAO_SCIOP_LITE_FACTORY_H
+#define TAO_SCIOP_LITE_FACTORY_H
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if TAO_HAS_SCIOP == 1
+
+#include "tao/Strategies/strategies_export.h"
+#include "ace/Service_Config.h"
+#include "tao/Protocol_Factory.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Acceptor;
+class TAO_Connector;
+
+class TAO_Strategies_Export TAO_SCIOP_Lite_Protocol_Factory :
+ public TAO_Protocol_Factory
+{
+public:
+ TAO_SCIOP_Lite_Protocol_Factory (void);
+
+ virtual ~TAO_SCIOP_Lite_Protocol_Factory (void);
+
+ // = Service Configurator hooks.
+ /// Dynamic linking hook
+ virtual int init (int argc, ACE_TCHAR* argv[]);
+
+ /// Verify prefix is a match
+ virtual int match_prefix (const ACE_CString &prefix);
+
+ /// Returns the prefix used by the protocol.
+ virtual const char *prefix (void) const;
+
+ /// Return the character used to mark where an endpoint ends and
+ /// where its options begin.
+ virtual char options_delimiter (void) const;
+
+ // = Check Protocol_Factory.h for a description of these methods.
+ virtual TAO_Acceptor *make_acceptor (void);
+ virtual TAO_Connector *make_connector (void);
+ virtual int requires_explicit_endpoint (void) const;
+
+private:
+ /// Changing the version number can be used to provide backwards
+ /// compatibility with old clients.
+ int major_;
+ int minor_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE_EXPORT (TAO_Strategies, TAO_SCIOP_Lite_Protocol_Factory)
+ACE_FACTORY_DECLARE (TAO_Strategies, TAO_SCIOP_Lite_Protocol_Factory)
+
+#endif /* TAO_HAS_SCIOP == 1 */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_SCIOP_Lite_factory_H */
diff --git a/TAO/tao/Strategies/SCIOP_Profile.cpp b/TAO/tao/Strategies/SCIOP_Profile.cpp
new file mode 100644
index 00000000000..a09a100ef89
--- /dev/null
+++ b/TAO/tao/Strategies/SCIOP_Profile.cpp
@@ -0,0 +1,518 @@
+// This may look like C, but it's really -*- C++ -*-
+// SCIOP_Profile.cpp
+
+#include "tao/Strategies/SCIOP_Profile.h"
+
+#if TAO_HAS_SCIOP == 1
+
+#include "tao/CDR.h"
+#include "tao/Environment.h"
+#include "tao/ORB.h"
+#include "tao/ORB_Core.h"
+#include "tao/debug.h"
+#include "tao/StringSeqC.h"
+#include "tao/Strategies/sciop_endpointsC.h"
+
+ACE_RCSID(Strategies,
+ SCIOP_Profile,
+ "$Id$")
+
+static const char prefix_[] = "sciop";
+
+const char TAO_SCIOP_Profile::object_key_delimiter_ = '/';
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+char
+TAO_SCIOP_Profile::object_key_delimiter (void) const
+{
+ return TAO_SCIOP_Profile::object_key_delimiter_;
+}
+
+TAO_SCIOP_Profile::TAO_SCIOP_Profile (const ACE_INET_Addr &addr,
+ const TAO::ObjectKey &object_key,
+ const TAO_GIOP_Message_Version &version,
+ TAO_ORB_Core *orb_core)
+ : TAO_Profile (TAO_TAG_SCIOP_PROFILE,
+ orb_core,
+ object_key,
+ version),
+ endpoint_ (addr,
+ orb_core->orb_params ()->use_dotted_decimal_addresses ()),
+ count_ (1)
+{
+}
+
+TAO_SCIOP_Profile::TAO_SCIOP_Profile (const char* host,
+ CORBA::UShort port,
+ const TAO::ObjectKey &object_key,
+ const ACE_INET_Addr &addr,
+ const TAO_GIOP_Message_Version &version,
+ TAO_ORB_Core *orb_core)
+ : TAO_Profile (TAO_TAG_SCIOP_PROFILE,
+ orb_core,
+ object_key,
+ version),
+ endpoint_ (host, port, addr),
+ count_ (1)
+{
+}
+
+TAO_SCIOP_Profile::TAO_SCIOP_Profile (TAO_ORB_Core *orb_core)
+ : TAO_Profile (TAO_TAG_SCIOP_PROFILE,
+ orb_core,
+ TAO_GIOP_Message_Version (TAO_DEF_SCIOP_MAJOR, TAO_DEF_SCIOP_MINOR)),
+ endpoint_ (),
+ count_ (1)
+{
+}
+
+TAO_SCIOP_Profile::~TAO_SCIOP_Profile (void)
+{
+ // Clean up the list of endpoints since we own it.
+ // Skip the head, since it is not dynamically allocated.
+ TAO_Endpoint *tmp = 0;
+
+ for (TAO_Endpoint *next = this->endpoint ()->next ();
+ next != 0;
+ next = tmp)
+ {
+ tmp = next->next ();
+ delete next;
+ }
+}
+
+int
+TAO_SCIOP_Profile::decode_profile (TAO_InputCDR& cdr)
+{
+ // Decode multiple endpoints, starting with the primary (endpoint_)
+ CORBA::StringSeq endpointSeq;
+ cdr >> endpointSeq;
+
+ this->endpoint_.host_ = endpointSeq[0];
+
+ if (cdr.read_ushort (this->endpoint_.port_) == 0)
+ {
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) SCIOP_Profile::decode - ")
+ ACE_TEXT ("error while decoding host/port")));
+ return -1;
+ }
+
+ // Add multiple endpoints > 1
+
+ for (int i=endpointSeq.length() - 1; i > 0 ; i--)
+ {
+ TAO_SCIOP_Endpoint *endpoint = 0;
+ ACE_NEW_RETURN (endpoint,
+ TAO_SCIOP_Endpoint (endpointSeq[i],
+ this->endpoint_.port_,
+ this->endpoint_.priority()),
+ -1);
+
+ this->count_ +=
+ endpoint->preferred_interfaces (this->orb_core ());
+
+ this->add_endpoint (endpoint);
+ }
+
+ // SCIOR has a max_streams variable
+ // We are ignoring it for now since ACE SCTP code fixes at 1 anyway.
+
+ CORBA::UShort max_streams;
+ if ((cdr.read_ushort(max_streams)) == 0) {
+ return -1;
+ }
+
+ if (cdr.good_bit ())
+ {
+ // Invalidate the object_addr_ until first access.
+ this->endpoint_.object_addr_.set_type (-1);
+
+ return 1;
+ }
+
+ return -1;
+}
+
+void
+TAO_SCIOP_Profile::parse_string_i (const char *ior
+ ACE_ENV_ARG_DECL)
+{
+ // Pull off the "hostname:port/" part of the objref
+ // Copy the string because we are going to modify it...
+
+ const char *okd = ACE_OS::strchr (ior, this->object_key_delimiter_);
+
+ if (okd == 0 || okd == ior)
+ {
+ // No object key delimiter or no hostname specified.
+ ACE_THROW (CORBA::INV_OBJREF (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ EINVAL),
+ CORBA::COMPLETED_NO));
+ }
+
+ // Length of host string.
+ CORBA::ULong length_host = 0;
+
+ const char *cp_pos = ACE_OS::strchr (ior, ':'); // Look for a port
+
+ if (cp_pos == ior)
+ {
+ // No hostname specified! It is required by the spec.
+ ACE_THROW (CORBA::INV_OBJREF (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ EINVAL),
+ CORBA::COMPLETED_NO));
+ }
+ else if (cp_pos != 0)
+ {
+ // A port number or port name was specified.
+ CORBA::ULong length_port = okd - cp_pos - 1;
+
+ CORBA::String_var tmp = CORBA::string_alloc (length_port);
+
+ ACE_OS::strncpy (tmp.inout (), cp_pos + 1, length_port);
+ tmp[length_port] = '\0';
+
+ this->endpoint_.port_ =
+ static_cast<CORBA::UShort> (ACE_OS::atoi (tmp.in ()));
+
+ length_host = cp_pos - ior;
+ }
+ else
+ length_host = okd - ior;
+
+ CORBA::String_var tmp = CORBA::string_alloc (length_host);
+
+ // Skip the trailing '/'
+ ACE_OS::strncpy (tmp.inout (), ior, length_host);
+ tmp[length_host] = '\0';
+
+ this->endpoint_.host_ = tmp._retn ();
+
+ if (ACE_OS::strcmp (this->endpoint_.host_.in (), "") == 0)
+ {
+ ACE_INET_Addr host_addr;
+
+ char tmp_host [MAXHOSTNAMELEN + 1];
+
+ // If no host is specified: assign the default host, i.e. the
+ // local host.
+ if (host_addr.get_host_name (tmp_host,
+ sizeof (tmp_host)) != 0)
+ {
+ // Can't get the IP address since the INET_Addr wasn't
+ // initialized. Just throw an exception.
+
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("\n\nTAO (%P|%t) ")
+ ACE_TEXT ("SCIOP_Profile::parse_string ")
+ ACE_TEXT ("- %p\n\n"),
+ ACE_TEXT ("cannot determine hostname")));
+
+ // @@ What's the right exception to throw here?
+ ACE_THROW (CORBA::INV_OBJREF (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ EINVAL),
+ CORBA::COMPLETED_NO));
+ }
+ else
+ this->endpoint_.host_ = CORBA::string_dup (tmp_host);
+ }
+
+ TAO::ObjectKey ok;
+
+ TAO::ObjectKey::decode_string_to_sequence (ok,
+ okd + 1);
+
+ (void) this->orb_core ()->object_key_table ().bind (ok,
+ this->ref_object_key_);
+}
+
+CORBA::Boolean
+TAO_SCIOP_Profile::do_is_equivalent (const TAO_Profile *other_profile)
+{
+ const TAO_SCIOP_Profile *op =
+ dynamic_cast<const TAO_SCIOP_Profile *> (other_profile);
+
+ if (op == 0)
+ return false;
+
+ // Check endpoints equivalence.
+ const TAO_SCIOP_Endpoint *other_endp = &op->endpoint_;
+ for (TAO_SCIOP_Endpoint *endp = &this->endpoint_;
+ endp != 0;
+ endp = endp->next_)
+ {
+ if (endp->is_equivalent (other_endp))
+ other_endp = other_endp->next_;
+ else
+ return false;
+ }
+
+ return true;
+}
+
+CORBA::ULong
+TAO_SCIOP_Profile::hash (CORBA::ULong max
+ ACE_ENV_ARG_DECL_NOT_USED)
+{
+ // Get the hash value for all endpoints.
+ CORBA::ULong hashval = 0;
+ for (TAO_SCIOP_Endpoint *endp = &this->endpoint_;
+ endp != 0;
+ endp = endp->next_)
+ {
+ hashval += endp->hash ();
+ }
+
+ hashval += this->version_.minor;
+ hashval += this->tag ();
+
+ const TAO::ObjectKey &ok =
+ this->ref_object_key_->object_key ();
+
+ if (ok.length () >= 4)
+ {
+ hashval += ok[1];
+ hashval += ok[3];
+ }
+
+ hashval += this->hash_service_i (max);
+
+ return hashval % max;
+}
+
+TAO_Endpoint*
+TAO_SCIOP_Profile::endpoint (void)
+{
+ return &this->endpoint_;
+}
+
+CORBA::ULong
+TAO_SCIOP_Profile::endpoint_count (void) const
+{
+ return this->count_;
+}
+
+void
+TAO_SCIOP_Profile::add_endpoint (TAO_SCIOP_Endpoint *endp)
+{
+ endp->next_ = this->endpoint_.next_;
+ this->endpoint_.next_ = endp;
+
+ this->count_++;
+}
+
+char *
+TAO_SCIOP_Profile::to_string (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+{
+ CORBA::String_var key;
+ TAO::ObjectKey::encode_sequence_to_string (key.inout(),
+ this->ref_object_key_->object_key());
+
+ size_t buflen = (8 /* "corbaloc" */ +
+ 1 /* colon separator */ +
+ ACE_OS::strlen (::prefix_) +
+ 1 /* colon separator */ +
+ 1 /* major version */ +
+ 1 /* decimal point */ +
+ 1 /* minor version */ +
+ 1 /* `@' character */ +
+ ACE_OS::strlen (this->endpoint_.host ()) +
+ 1 /* colon separator */ +
+ 5 /* port number */ +
+ 1 /* object key separator */ +
+ ACE_OS::strlen (key.in ()));
+
+ char * buf = CORBA::string_alloc (static_cast<CORBA::ULong> (buflen));
+
+ static const char digits [] = "0123456789";
+
+ ACE_OS::sprintf (buf,
+ "corbaloc:%s:%c.%c@%s:%d%c%s",
+ ::prefix_,
+ digits [this->version_.major],
+ digits [this->version_.minor],
+ this->endpoint_.host (),
+ this->endpoint_.port (),
+ this->object_key_delimiter_,
+ key.in ());
+
+ return buf;
+}
+
+const char *
+TAO_SCIOP_Profile::prefix (void)
+{
+ return ::prefix_;
+}
+
+void
+TAO_SCIOP_Profile::create_profile_body (TAO_OutputCDR &encap) const
+{
+ encap.write_octet (TAO_ENCAP_BYTE_ORDER);
+
+ // The SCIOP version
+ encap.write_octet (this->version_.major);
+ encap.write_octet (this->version_.minor);
+
+ // STRING hostname from profile
+ // encap.write_string (this->endpoint_.host ());
+
+ CORBA::StringSeq strseq;
+ strseq.length(this->count_);
+
+ const TAO_SCIOP_Endpoint *endpoint = &this->endpoint_;
+ for (CORBA::ULong i = 0;
+ i < this->count_;
+ ++i)
+ {
+ strseq[i] = endpoint->host();
+ endpoint = endpoint->next_;
+ }
+
+ // strseq[0] = this->endpoint_.host();
+ encap << strseq;
+
+ // UNSIGNED SHORT port number
+ encap.write_ushort (this->endpoint_.port ());
+
+ // UNSIGNED SHORT max_streams
+ encap.write_ushort (1);
+
+ // OCTET SEQUENCE for object key
+ if (this->ref_object_key_)
+ encap << this->ref_object_key_->object_key ();
+ else
+ {
+ ACE_ERROR ((LM_ERROR,
+ "(%P|%t) TAO - IIOP_Profile::create_profile_body "
+ "no object key marshalled \n"));
+ }
+
+ // Tagged Components
+ this->tagged_components ().encode (encap);
+}
+
+int
+TAO_SCIOP_Profile::encode_endpoints (void)
+{
+ CORBA::ULong actual_count = 0;
+
+ const TAO_SCIOP_Endpoint *endpoint = &this->endpoint_;
+
+ // Count the number of endpoints that needs to be encoded
+ for (CORBA::ULong c = 0;
+ c != this->count_;
+ ++c)
+ {
+ if (endpoint->is_encodable_)
+ ++actual_count;
+
+ endpoint = endpoint->next_;
+ }
+
+ // Create a data structure and fill it with endpoint info for wire
+ // transfer.
+ // We include information for the head of the list
+ // together with other endpoints because even though its addressing
+ // info is transmitted using standard ProfileBody components, its
+ // priority is not!
+
+ TAO_SCIOPEndpointSequence endpoints;
+ endpoints.length (actual_count);
+
+ endpoint = &this->endpoint_;
+
+ for (CORBA::ULong i = 0;
+ i < this->count_;
+ ++i)
+ {
+ if (endpoint->is_encodable_)
+ {
+ endpoints[i].host = endpoint->host ();
+ endpoints[i].port = endpoint->port ();
+ endpoints[i].priority = endpoint->priority ();
+ }
+
+ endpoint = endpoint->next_;
+ }
+
+ // Encode the data structure.
+ TAO_OutputCDR out_cdr;
+ if ((out_cdr << ACE_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER)
+ == 0)
+ || (out_cdr << endpoints) == 0)
+ return -1;
+
+ this->set_tagged_components (out_cdr);
+
+ return 0;
+}
+
+int
+TAO_SCIOP_Profile::decode_endpoints (void)
+{
+ IOP::TaggedComponent tagged_component;
+ tagged_component.tag = TAO_TAG_ENDPOINTS;
+
+ if (this->tagged_components_.get_component (tagged_component))
+ {
+ const CORBA::Octet *buf =
+ tagged_component.component_data.get_buffer ();
+
+ TAO_InputCDR in_cdr (reinterpret_cast<const char*> (buf),
+ tagged_component.component_data.length ());
+
+ // Extract the Byte Order.
+ CORBA::Boolean byte_order;
+ if ((in_cdr >> ACE_InputCDR::to_boolean (byte_order)) == 0)
+ return -1;
+ in_cdr.reset_byte_order (static_cast<int> (byte_order));
+
+ // Extract endpoints sequence.
+ TAO_SCIOPEndpointSequence endpoints;
+
+ if ((in_cdr >> endpoints) == 0)
+ return -1;
+
+ // Get the priority of the first endpoint (head of the list.
+ // It's other data is extracted as part of the standard profile
+ // decoding.
+ this->endpoint_.priority (endpoints[0].priority);
+
+ // Use information extracted from the tagged component to
+ // populate the profile. Skip the first endpoint, since it is
+ // always extracted through standard profile body. Also, begin
+ // from the end of the sequence to preserve endpoint order,
+ // since <add_endpoint> method reverses the order of endpoints
+ // in the list.
+ for (CORBA::ULong i = endpoints.length () - 1;
+ i > 0;
+ --i)
+ {
+ TAO_SCIOP_Endpoint *endpoint = 0;
+ ACE_NEW_RETURN (endpoint,
+ TAO_SCIOP_Endpoint (endpoints[i].host,
+ endpoints[i].port,
+ endpoints[i].priority),
+ -1);
+
+ this->add_endpoint (endpoint);
+ }
+ }
+
+ return 0;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_SCIOP == 1 */
diff --git a/TAO/tao/Strategies/SCIOP_Profile.h b/TAO/tao/Strategies/SCIOP_Profile.h
new file mode 100644
index 00000000000..4bfc18ebb6a
--- /dev/null
+++ b/TAO/tao/Strategies/SCIOP_Profile.h
@@ -0,0 +1,143 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file SCIOP_Profile.h
+ *
+ * $Id$
+ *
+ * @author Jason Cohen, Lockheed Martin ATL <jcohen@atl.lmco.com>
+ * @author Keith O'Hara, Lockheed Martin ATL
+ */
+//=============================================================================
+
+
+#ifndef TAO_SCIOP_PROFILE_H
+#define TAO_SCIOP_PROFILE_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if TAO_HAS_SCIOP == 1
+
+#include "tao/Strategies/SCIOP_Endpoint.h"
+#include "tao/Profile.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// TAO SCIOP_Profile concrete Profile definitions
+/**
+ * @class TAO_SCIOP_Profile
+ *
+ * @brief This class defines the protocol specific attributes required
+ * for locating ORBs over a TCP/IP network.
+ *
+ * This class defines the SCIOP profile as specified in the CORBA
+ * specification.
+ */
+class TAO_Strategies_Export TAO_SCIOP_Profile : public TAO_Profile
+{
+public:
+ /// The object key delimiter that SCIOP uses or expects.
+ static const char object_key_delimiter_;
+ virtual char object_key_delimiter (void) const;
+
+ /// Return the char string prefix.
+ static const char *prefix (void);
+
+ /// Profile constructor, same as above except the object_key has
+ /// already been marshaled.
+ TAO_SCIOP_Profile (const ACE_INET_Addr &addr,
+ const TAO::ObjectKey &object_key,
+ const TAO_GIOP_Message_Version &version,
+ TAO_ORB_Core *orb_core);
+
+ /// Profile constructor, this is the most efficient since it
+ /// doesn't require any address resolution processing.
+ TAO_SCIOP_Profile (const char *host,
+ CORBA::UShort port,
+ const TAO::ObjectKey &object_key,
+ const ACE_INET_Addr &addr,
+ const TAO_GIOP_Message_Version &version,
+ TAO_ORB_Core *orb_core);
+
+ /// Profile constructor, default.
+ TAO_SCIOP_Profile (TAO_ORB_Core *orb_core);
+
+ /// Destructor is to be called only through <_decr_refcnt>.
+ ~TAO_SCIOP_Profile (void);
+
+ /// Template methods. Please see Profile.h for documentation.
+ virtual char * to_string (ACE_ENV_SINGLE_ARG_DECL);
+ virtual int encode_endpoints (void);
+ virtual TAO_Endpoint *endpoint (void);
+ virtual CORBA::ULong endpoint_count (void) const;
+ virtual CORBA::ULong hash (CORBA::ULong max
+ ACE_ENV_ARG_DECL);
+ /**
+ * Add <endp> to this profile's list of endpoints (it is inserted
+ * next to the head of the list). This profiles takes ownership of
+ * <endp>.
+ */
+ void add_endpoint (TAO_SCIOP_Endpoint *endp);
+
+protected:
+
+ /// Template methods. Please see Profile.h for the documentation.
+ virtual int decode_profile (TAO_InputCDR &cdr);
+ virtual int decode_endpoints (void);
+ virtual void parse_string_i (const char *string
+ ACE_ENV_ARG_DECL);
+ virtual void create_profile_body (TAO_OutputCDR &cdr) const;
+ virtual CORBA::Boolean do_is_equivalent (const TAO_Profile *other_profile);
+
+protected:
+
+ /**
+ * Head of this profile's list of endpoints. This endpoint is not
+ * dynamically allocated because a profile always contains at least
+ * one endpoint.
+ *
+ * Currently, a profile contains more than one endpoint, i.e.,
+ * list contains more than just the head, only for two cases
+ * (1) when RTCORBA is enabled and
+ * (2) the ORB is initialized with -ORBPreferredInterfaces option.
+ * However, in the near future, this will be used in for mode as
+ * well, e.g., to support TAG_ALTERNATE_IIOP_ADDRESS feature.
+ *
+ * This is probably as good a place to discuss how the list of
+ * endpoints is used for #2. If the ORB is configured to use
+ * preferred interfaces for invocation, TAO creates an endpoint per
+ * preferred interface. To be clear, every tuple
+ * <destination:target> will have an endpoint. What TAO essentially
+ * does is that creates it multiple endpoints so that the invocation
+ * code path can use existing iterating techniques to try one
+ * preferred interface after another (if the first did not work). If
+ * the ORB is configured with -ORBEnforcePreferredInterface set to
+ * false in addition to the ORBPreferredInterfaces option , TAO
+ * creates another endpoint with the preferred bit set to null, so
+ * that the invocation code can fall back to a SCTP stack returned
+ * local address.
+ * Addressing info of the default endpoint, i.e., head of the list,
+ * is transmitted using standard SCIOP ProfileBody components. See
+ * <encode_endpoints> method documentation above for how the rest of
+ * the endpoint list is transmitted.
+ */
+ TAO_SCIOP_Endpoint endpoint_;
+
+ /// Number of endpoints in the list headed by <endpoint_>.
+ CORBA::ULong count_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_SCIOP == 1 */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_SCIOP_PROFILE_H */
diff --git a/TAO/tao/Strategies/SCIOP_Transport.cpp b/TAO/tao/Strategies/SCIOP_Transport.cpp
new file mode 100644
index 00000000000..f306345bca0
--- /dev/null
+++ b/TAO/tao/Strategies/SCIOP_Transport.cpp
@@ -0,0 +1,387 @@
+// $Id$
+
+#include "tao/Strategies/SCIOP_Transport.h"
+
+#if TAO_HAS_SCIOP == 1
+
+#include "tao/Strategies/SCIOP_Connection_Handler.h"
+#include "tao/Strategies/SCIOP_Acceptor.h"
+#include "tao/Strategies/SCIOP_Profile.h"
+#include "tao/Acceptor_Registry.h"
+#include "tao/Thread_Lane_Resources.h"
+#include "tao/operation_details.h"
+#include "tao/Timeprobe.h"
+#include "tao/CDR.h"
+#include "tao/Transport_Mux_Strategy.h"
+#include "tao/Wait_Strategy.h"
+#include "tao/Stub.h"
+#include "tao/ORB_Core.h"
+#include "tao/debug.h"
+#include "tao/GIOP_Message_Base.h"
+#include "tao/Protocols_Hooks.h"
+#include "tao/Adapter.h"
+
+ACE_RCSID (tao,
+ SCIOP_Transport,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_SCIOP_Transport::TAO_SCIOP_Transport (TAO_SCIOP_Connection_Handler *handler,
+ TAO_ORB_Core *orb_core,
+ CORBA::Boolean )
+ : TAO_Transport (TAO_TAG_SCIOP_PROFILE,
+ orb_core)
+ , connection_handler_ (handler)
+ , messaging_object_ (0)
+{
+#if 0
+ // First step in deprecating this.
+ if (flag)
+ {
+ // Use the lite version of the protocol
+ ACE_NEW (this->messaging_object_,
+ TAO_GIOP_Message_Lite (orb_core));
+ }
+ else
+#endif /*if 0*/
+ {
+ // Use the normal GIOP object
+ ACE_NEW (this->messaging_object_,
+ TAO_GIOP_Message_Base (orb_core, this));
+ }
+}
+
+TAO_SCIOP_Transport::~TAO_SCIOP_Transport (void)
+{
+ delete this->messaging_object_;
+}
+
+ACE_Event_Handler *
+TAO_SCIOP_Transport::event_handler_i (void)
+{
+ return this->connection_handler_;
+}
+
+TAO_Connection_Handler *
+TAO_SCIOP_Transport::connection_handler_i (void)
+{
+ return this->connection_handler_;
+}
+
+TAO_Pluggable_Messaging *
+TAO_SCIOP_Transport::messaging_object (void)
+{
+ return this->messaging_object_;
+}
+
+ssize_t
+TAO_SCIOP_Transport::send (iovec *iov, int iovcnt,
+ size_t &bytes_transferred,
+ const ACE_Time_Value *max_wait_time)
+{
+ ssize_t retval = this->connection_handler_->peer ().sendv (iov, iovcnt,
+ max_wait_time);
+ if (retval > 0)
+ bytes_transferred = retval;
+
+ return retval;
+}
+
+ssize_t
+TAO_SCIOP_Transport::recv (char *buf,
+ size_t len,
+ const ACE_Time_Value *max_wait_time)
+{
+ ssize_t n = this->connection_handler_->peer ().recv (buf,
+ len,
+ max_wait_time);
+
+ // Do not print the error message if it is a timeout, which could
+ // occur in thread-per-connection.
+ if (n == -1 &&
+ TAO_debug_level > 4 &&
+ errno != ETIME)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - SCIOP_Transport[%d]::recv, ")
+ ACE_TEXT ("read failure - %m\n"),
+ this->id ()));
+ }
+
+ // Error handling
+ if (n == -1)
+ {
+ if (errno == EWOULDBLOCK)
+ return 0;
+
+
+ return -1;
+ }
+
+ // Most of the errors handling is common for
+ // Now the message has been read
+
+ // @@ What are the other error handling here??
+ else if (n == 0)
+ {
+ return -1;
+ }
+
+ return n;
+}
+
+int
+TAO_SCIOP_Transport::send_request (TAO_Stub *stub,
+ TAO_ORB_Core *orb_core,
+ TAO_OutputCDR &stream,
+ int message_semantics,
+ ACE_Time_Value *max_wait_time)
+{
+ if (this->ws_->sending_request (orb_core,
+ message_semantics) == -1)
+
+ return -1;
+
+ if (this->send_message (stream,
+ stub,
+ message_semantics,
+ max_wait_time) == -1)
+ return -1;
+
+ this->first_request_sent();
+
+ return 0;
+}
+
+int
+TAO_SCIOP_Transport::send_message (TAO_OutputCDR &stream,
+ TAO_Stub *stub,
+ int message_semantics,
+ ACE_Time_Value *max_wait_time)
+{
+ // Format the message in the stream first
+ if (this->messaging_object_->format_message (stream) != 0)
+ return -1;
+
+ // This guarantees to send all data (bytes) or return an error.
+ ssize_t n = this->send_message_shared (stub,
+ message_semantics,
+ stream.begin (),
+ max_wait_time);
+
+ if (n == -1)
+ {
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - SCIOP_Transport[%d]::send_message, ")
+ ACE_TEXT (" write failure - %m\n"),
+ this->id ()));
+ return -1;
+ }
+
+ return 1;
+}
+
+int
+TAO_SCIOP_Transport::send_message_shared (TAO_Stub *stub,
+ int message_semantics,
+ const ACE_Message_Block *message_block,
+ ACE_Time_Value *max_wait_time)
+{
+ int r;
+
+ {
+ ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->handler_lock_, -1);
+
+ r = this->send_message_shared_i (stub, message_semantics,
+ message_block, max_wait_time);
+ }
+
+ if (r == -1)
+ {
+ this->close_connection ();
+ }
+
+ return r;
+}
+
+int
+TAO_SCIOP_Transport::generate_request_header (TAO_Operation_Details &opdetails,
+ TAO_Target_Specification &spec,
+ TAO_OutputCDR &msg)
+{
+ // Check whether we have a Bi Dir SCIOP policy set, whether the
+ // messaging objects are ready to handle bidirectional connections
+ // and also make sure that we have not recd. or sent any information
+ // regarding this before...
+ if (this->orb_core ()->bidir_giop_policy () &&
+ this->messaging_object_->is_ready_for_bidirectional (msg) &&
+ this->bidirectional_flag () < 0)
+ {
+ this->set_bidir_context_info (opdetails);
+
+ // Set the flag to 1 (i.e., originating side)
+ this->bidirectional_flag (1);
+
+ // At the moment we enable BiDIR giop we have to get a new
+ // request id to make sure that we follow the even/odd rule
+ // for request id's. We only need to do this when enabled
+ // it, after that the Transport Mux Strategy will make sure
+ // that the rule is followed
+ opdetails.request_id (this->tms ()->request_id ());
+ }
+
+ return TAO_Transport::generate_request_header (opdetails,
+ spec,
+ msg);
+}
+
+int
+TAO_SCIOP_Transport::messaging_init (CORBA::Octet major,
+ CORBA::Octet minor)
+{
+ this->messaging_object_->init (major, minor);
+
+ return 1;
+}
+
+int
+TAO_SCIOP_Transport::tear_listen_point_list (TAO_InputCDR &cdr)
+{
+ CORBA::Boolean byte_order;
+ if ((cdr >> ACE_InputCDR::to_boolean (byte_order)) == 0)
+ return -1;
+
+ cdr.reset_byte_order (static_cast<int> (byte_order));
+
+ IIOP::ListenPointList listen_list;
+ if ((cdr >> listen_list) == 0)
+ return -1;
+
+ // As we have received a bidirectional information, set the flag to
+ // 1 (i.e., non-originating side)
+ this->bidirectional_flag (0);
+
+ return this->connection_handler_->process_listen_point_list (listen_list);
+}
+
+void
+TAO_SCIOP_Transport::set_bidir_context_info (TAO_Operation_Details &opdetails)
+{
+ // Get a handle to the acceptor registry
+ TAO_Acceptor_Registry &ar =
+ this->orb_core ()->lane_resources ().acceptor_registry ();
+
+ // Get the first acceptor in the registry
+ TAO_AcceptorSetIterator acceptor = ar.begin ();
+
+ IIOP::ListenPointList listen_point_list;
+
+ for (;
+ acceptor != ar.end ();
+ acceptor++)
+ {
+ // Check whether it is a SCIOP acceptor
+ if ((*acceptor)->tag () == TAO_TAG_SCIOP_PROFILE)
+ {
+ if (this->get_listen_point (listen_point_list,
+ *acceptor) == -1)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "TAO (%P|%t) - SCIOP_Transport::set_bidir_info, "
+ "error getting listen_point \n"));
+
+ return;
+ }
+ }
+ }
+
+ // We have the ListenPointList at this point. Create a output CDR
+ // stream at this point
+ TAO_OutputCDR cdr;
+
+ // Marshall the information into the stream
+ if ((cdr << ACE_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER) == 0)
+ || (cdr << listen_point_list) == 0)
+ return;
+
+ // Add this info in to the svc_list
+ opdetails.request_service_context ().set_context (IOP::BI_DIR_IIOP,
+ cdr);
+
+ return;
+}
+
+int
+TAO_SCIOP_Transport::get_listen_point (
+ IIOP::ListenPointList &listen_point_list,
+ TAO_Acceptor *acceptor)
+{
+ TAO_SCIOP_Acceptor *sciop_acceptor =
+ dynamic_cast<TAO_SCIOP_Acceptor *> (acceptor );
+
+ // Get the array of endpoints serviced by TAO_SCIOP_Acceptor
+ const ACE_INET_Addr *endpoint_addr =
+ sciop_acceptor->endpoints ();
+
+ // Get the endpoint count
+ size_t count =
+ sciop_acceptor->endpoint_count ();
+
+ // Get the local address of the connection
+ ACE_INET_Addr local_addr;
+
+ if (this->connection_handler_->peer ().get_local_addr (local_addr)
+ == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) Could not resolve local ")
+ ACE_TEXT ("host address in ")
+ ACE_TEXT ("get_listen_point()\n")),
+ -1);
+ }
+
+ // Note: Looks like there is no point in sending the list of
+ // endpoints on interfaces on which this connection has not
+ // been established. If this is wrong, please correct me.
+ CORBA::String_var local_interface;
+
+ // Get the hostname for the local address
+ if (sciop_acceptor->hostname (this->orb_core_,
+ local_addr,
+ local_interface.out ()) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) Could not resolve local host")
+ ACE_TEXT (" name \n")),
+ -1);
+ }
+
+ for (size_t index = 0;
+ index != count;
+ index++)
+ {
+ if (local_addr.get_ip_address()
+ == endpoint_addr[index].get_ip_address())
+ {
+ // Get the count of the number of elements
+ CORBA::ULong len = listen_point_list.length ();
+
+ // Increase the length by 1
+ listen_point_list.length (len + 1);
+
+ // We have the connection and the acceptor endpoint on the
+ // same interface
+ IIOP::ListenPoint &point = listen_point_list[len];
+ point.host = CORBA::string_dup (local_interface.in ());
+ point.port = endpoint_addr[index].get_port_number ();
+ }
+ }
+
+ return 1;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_SCIOP == 1 */
diff --git a/TAO/tao/Strategies/SCIOP_Transport.h b/TAO/tao/Strategies/SCIOP_Transport.h
new file mode 100644
index 00000000000..c99b24aa10d
--- /dev/null
+++ b/TAO/tao/Strategies/SCIOP_Transport.h
@@ -0,0 +1,148 @@
+// -*- C++ -*-
+
+// $Id$
+// ===================================================================
+/**
+ * @file SCIOP_Transport.h
+ *
+ * @author Jason Cohen, Lockheed Martin ATL <jcohen@atl.lmco.com>
+ * @author Keith O'Hara, Lockheed Martin ATL
+ */
+// ===================================================================
+
+#ifndef TAO_SCIOP_TRANSPORT_H
+#define TAO_SCIOP_TRANSPORT_H
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if TAO_HAS_SCIOP == 1
+
+#include "tao/Strategies/strategies_export.h"
+#include "tao/Transport.h"
+#include "tao/IIOPC.h"
+#include "ace/SOCK_SEQPACK_Association.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Forward decls.
+class TAO_SCIOP_Connection_Handler;
+class TAO_ORB_Core;
+class TAO_Operation_Details;
+class TAO_Pluggable_Messaging;
+class TAO_Acceptor;
+
+/**
+ * @class TAO_SCIOP_Transport
+ *
+ * @brief Specialization of the base TAO_Transport class to handle the
+ * SCIOP protocol.
+ *
+ * Specialization of the base TAO_Transport class to handle the SCIOP
+ * protocol.
+ */
+class TAO_Strategies_Export TAO_SCIOP_Transport : public TAO_Transport
+{
+public:
+
+ /// Constructor.
+ TAO_SCIOP_Transport (TAO_SCIOP_Connection_Handler *handler,
+ TAO_ORB_Core *orb_core,
+ CORBA::Boolean flag);
+
+protected:
+
+ /// Destructor
+ /**
+ * Protected destructor to enforce proper memory management through
+ * the reference counting mechanism.
+ */
+ virtual ~TAO_SCIOP_Transport (void);
+
+ /** @name Overridden Template Methods
+ *
+ * Please check the documentation in "tao/Transport.h" for more
+ * details.
+ */
+ //@{
+
+ virtual ACE_Event_Handler * event_handler_i (void);
+
+ /// Access the underlying messaging object
+ virtual TAO_Pluggable_Messaging *messaging_object (void);
+
+ virtual ssize_t send (iovec *iov, int iovcnt,
+ size_t &bytes_transferred,
+ const ACE_Time_Value *timeout = 0);
+
+ virtual ssize_t recv (char *buf,
+ size_t len,
+ const ACE_Time_Value *s = 0);
+
+ virtual int send_message_shared (TAO_Stub *stub,
+ int message_semantics,
+ const ACE_Message_Block *message_block,
+ ACE_Time_Value *max_wait_time);
+
+
+public:
+ /// @todo These methods IMHO should have more meaningful
+ /// names. The names seem to indicate nothing.
+ virtual int send_request (TAO_Stub *stub,
+ TAO_ORB_Core *orb_core,
+ TAO_OutputCDR &association,
+ int message_semantics,
+ ACE_Time_Value *max_wait_time);
+
+ virtual int send_message (TAO_OutputCDR &association,
+ TAO_Stub *stub = 0,
+ int message_semantics = TAO_Transport::TAO_TWOWAY_REQUEST,
+ ACE_Time_Value *max_time_wait = 0);
+
+ /*virtual int send_reply (TAO_OutputCDR &stream,
+ TAO_Adapter *poa = 0);*/
+
+ virtual int generate_request_header (TAO_Operation_Details &opdetails,
+ TAO_Target_Specification &spec,
+ TAO_OutputCDR &msg);
+
+ virtual int messaging_init (CORBA::Octet major,
+ CORBA::Octet minor);
+
+ virtual int tear_listen_point_list (TAO_InputCDR &cdr);
+
+ virtual TAO_Connection_Handler * connection_handler_i (void);
+
+ //@}
+
+private:
+
+ /// Set the Bidirectional context info in the service context list
+ void set_bidir_context_info (TAO_Operation_Details &opdetails);
+
+ /// Add the listen points in <acceptor> to the <listen_point_list>
+ /// if this connection is in the same interface as that of the
+ /// endpoints in the <acceptor>
+ int get_listen_point (IIOP::ListenPointList &listen_point_list,
+ TAO_Acceptor *acceptor);
+private:
+
+ /// The connection service handler used for accessing lower layer
+ /// communication protocols.
+ TAO_SCIOP_Connection_Handler *connection_handler_;
+
+ /// Our messaging object.
+ TAO_Pluggable_Messaging *messaging_object_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_SCIOP == 1 */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_SCIOP_TRANSPORT_H */
diff --git a/TAO/tao/Strategies/SHMIOP_Acceptor.cpp b/TAO/tao/Strategies/SHMIOP_Acceptor.cpp
new file mode 100644
index 00000000000..895df2ad9b2
--- /dev/null
+++ b/TAO/tao/Strategies/SHMIOP_Acceptor.cpp
@@ -0,0 +1,514 @@
+// $Id$
+
+#include "tao/Strategies/SHMIOP_Acceptor.h"
+
+#if defined (TAO_HAS_SHMIOP) && (TAO_HAS_SHMIOP != 0)
+
+#include "tao/Strategies/SHMIOP_Profile.h"
+#include "tao/MProfile.h"
+#include "tao/ORB_Core.h"
+#include "tao/Server_Strategy_Factory.h"
+#include "tao/debug.h"
+#include "tao/Codeset_Manager.h"
+#include "tao/CDR.h"
+
+#include "ace/os_include/os_netdb.h"
+#include "ace/os_include/os_ctype.h"
+
+ACE_RCSID (Strategies,
+ SHMIOP_Acceptor,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_SHMIOP_Acceptor::TAO_SHMIOP_Acceptor (CORBA::Boolean flag)
+ : TAO_Acceptor (TAO_TAG_SHMEM_PROFILE),
+ version_ (TAO_DEF_GIOP_MAJOR, TAO_DEF_GIOP_MINOR),
+ orb_core_ (0),
+ base_acceptor_ (),
+ creation_strategy_ (0),
+ concurrency_strategy_ (0),
+ accept_strategy_ (0),
+ mmap_file_prefix_ (0),
+ mmap_size_ (1024 * 1024),
+ lite_flag_ (flag)
+{
+}
+
+TAO_SHMIOP_Acceptor::~TAO_SHMIOP_Acceptor (void)
+{
+ // Make sure we are closed before we start destroying the
+ // strategies.
+ this->close ();
+
+ delete this->creation_strategy_;
+ delete this->concurrency_strategy_;
+ delete this->accept_strategy_;
+}
+
+// TODO =
+// 2) For V1.[1,2] there are tagged components
+// 3) Create multiple profiles for wild carded endpoints (may be multiple
+// interfaces over which we can receive requests. Thus a profile
+// must be made for each one.
+int
+TAO_SHMIOP_Acceptor::create_profile (const TAO::ObjectKey &object_key,
+ TAO_MProfile &mprofile,
+ CORBA::Short priority)
+{
+ // Check if multiple endpoints should be put in one profile or
+ // if they should be spread across multiple profiles.
+ if (priority == TAO_INVALID_PRIORITY)
+ return this->create_new_profile (object_key,
+ mprofile,
+ priority);
+ else
+ return this->create_shared_profile (object_key,
+ mprofile,
+ priority);
+}
+
+int
+TAO_SHMIOP_Acceptor::create_new_profile (const TAO::ObjectKey &object_key,
+ TAO_MProfile &mprofile,
+ CORBA::Short priority)
+{
+ // @@ we only make one for now
+ int count = mprofile.profile_count ();
+ if ((mprofile.size () - count) < 1
+ && mprofile.grow (count + 1) == -1)
+ return -1;
+
+ TAO_SHMIOP_Profile *pfile = 0;
+ ACE_NEW_RETURN (pfile,
+ TAO_SHMIOP_Profile (this->host_.c_str (),
+ this->address_.get_port_number (),
+ object_key,
+ this->address_.get_remote_addr (),
+ this->version_,
+ this->orb_core_),
+ -1);
+ pfile->endpoint ()->priority (priority);
+
+ if (mprofile.give_profile (pfile) == -1)
+ {
+ pfile->_decr_refcnt ();
+ pfile = 0;
+ return -1;
+ }
+
+ // Do not add any tagged components to the profile if configured
+ // by the user not to do so, or if an SHMIOP 1.0 endpoint is being
+ // created (IIOP 1.0 did not support tagged components, so we follow
+ // the same convention for SHMIOP).
+ if (this->orb_core_->orb_params ()->std_profile_components () == 0
+ || (this->version_.major == 1 && this->version_.minor == 0))
+ return 0;
+
+ pfile->tagged_components ().set_orb_type (TAO_ORB_TYPE);
+ TAO_Codeset_Manager *csm = this->orb_core_->codeset_manager();
+ if (csm)
+ csm->set_codeset(pfile->tagged_components());
+ return 0;
+}
+
+int
+TAO_SHMIOP_Acceptor::create_shared_profile (const TAO::ObjectKey &object_key,
+ TAO_MProfile &mprofile,
+ CORBA::Short priority)
+{
+ TAO_Profile *pfile = 0;
+ TAO_SHMIOP_Profile *shmiop_profile = 0;
+
+ // First see if <mprofile> already contains a SHMIOP profile.
+ for (TAO_PHandle i = 0; i != mprofile.profile_count (); ++i)
+ {
+ pfile = mprofile.get_profile (i);
+ if (pfile->tag () == TAO_TAG_SHMEM_PROFILE)
+ {
+ shmiop_profile = dynamic_cast <TAO_SHMIOP_Profile *>(pfile);
+ break;
+ }
+ }
+
+ if (shmiop_profile == 0)
+ {
+ // If <mprofile> doesn't contain SHMIOP_Profile, we need to create
+ // one.
+ return create_new_profile (object_key,
+ mprofile,
+ priority);
+ }
+ else
+ {
+ // A SHMIOP_Profile already exists - just add our endpoint to it.
+
+ TAO_SHMIOP_Endpoint *endpoint = 0;
+ ACE_NEW_RETURN (endpoint,
+ TAO_SHMIOP_Endpoint (this->host_.c_str (),
+ this->address_.get_port_number (),
+ this->address_.get_remote_addr ()),
+ -1);
+ endpoint->priority (priority);
+ shmiop_profile->add_endpoint (endpoint);
+
+ return 0;
+ }
+}
+
+int
+TAO_SHMIOP_Acceptor::is_collocated (const TAO_Endpoint *endpoint)
+{
+ const TAO_SHMIOP_Endpoint *endp =
+ dynamic_cast <const TAO_SHMIOP_Endpoint *> (endpoint);
+
+ // Make sure the dynamically cast pointer is valid.
+ if (endp == 0)
+ return 0;
+
+ // @@ TODO The following code looks funky, why only the host
+ // name is compared? What if there are multiple SHMIOP
+ // servers in the same address? Why do SHMIOP_Endpoints keep
+ // a INET_Addr but not a MEM_Addr? And why is there no lazy
+ // evaluation of IP-addresses for SHMIOP endpoints? Is it
+ // because it is always 'localhost'? We need answers to
+ // these questions to solve:
+ //
+ // http://deuce.doc.wustl.edu/bugzilla/show_bug.cgi?id=1220
+ //
+ // The following code is suspec
+ // compare the port and sin_addr (numeric host address)
+ return this->address_.same_host (endp->object_addr ());
+}
+
+int
+TAO_SHMIOP_Acceptor::close (void)
+{
+ return this->base_acceptor_.close ();
+}
+
+int
+TAO_SHMIOP_Acceptor::open (TAO_ORB_Core *orb_core,
+ ACE_Reactor *reactor,
+ int major,
+ int minor,
+ const char *port,
+ const char *options)
+{
+ if (major >=0 && minor >= 0)
+ this->version_.set_version (static_cast <CORBA::Octet>(major),
+ static_cast <CORBA::Octet>(minor));
+ // Parse options
+ if (this->parse_options (options) == -1)
+ return -1;
+
+ if (isdigit (*port) == 0)
+ return -1; // Port number must consist of digits
+
+ if (port)
+ this->address_.set (ACE_TEXT_CHAR_TO_TCHAR(port));
+
+ return this->open_i (orb_core,
+ reactor);
+}
+
+int
+TAO_SHMIOP_Acceptor::open_default (TAO_ORB_Core *orb_core,
+ ACE_Reactor *reactor,
+ int major,
+ int minor,
+ const char *options)
+{
+ if (major >=0 && minor >= 0)
+ this->version_.set_version (static_cast <CORBA::Octet>(major),
+ static_cast <CORBA::Octet>(minor));
+
+ // Parse options
+ if (this->parse_options (options) == -1)
+ return -1;
+
+ // @@ Until we can support multihomed machines correctly we must
+ // pick the "default interface" and only listen on that IP
+ // address.
+ this->host_ = this->address_.get_host_name ();
+
+ return this->open_i (orb_core,
+ reactor);
+}
+
+int
+TAO_SHMIOP_Acceptor::set_mmap_options (const ACE_TCHAR *prefix,
+ off_t size)
+{
+ this->mmap_file_prefix_ = prefix;
+ this->mmap_size_ = size;
+
+ return 0;
+}
+
+int
+TAO_SHMIOP_Acceptor::open_i (TAO_ORB_Core* orb_core,
+ ACE_Reactor *reactor)
+{
+ this->orb_core_ = orb_core;
+
+ ACE_NEW_RETURN (this->creation_strategy_,
+ TAO_SHMIOP_CREATION_STRATEGY (this->orb_core_,
+ this->lite_flag_),
+ -1);
+
+ ACE_NEW_RETURN (this->concurrency_strategy_,
+ TAO_SHMIOP_CONCURRENCY_STRATEGY (this->orb_core_),
+ -1);
+
+ ACE_NEW_RETURN (this->accept_strategy_,
+ TAO_SHMIOP_ACCEPT_STRATEGY (this->orb_core_),
+ -1);
+
+ // We only accept connection on localhost.
+ if (this->base_acceptor_.open (this->address_,
+ reactor,
+ this->creation_strategy_,
+ this->accept_strategy_,
+ this->concurrency_strategy_) == -1)
+ {
+ if (TAO_debug_level > 0)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) - SHMIOP_Acceptor::open_i, %p\n\n"),
+ ACE_TEXT ("cannot open acceptor")));
+ return -1;
+ }
+
+ this->base_acceptor_.acceptor().mmap_prefix (this->mmap_file_prefix_);
+ this->base_acceptor_.acceptor().init_buffer_size (this->mmap_size_);
+
+ if (orb_core->server_factory ()->activate_server_connections () != 0)
+ this->base_acceptor_.acceptor().preferred_strategy (ACE_MEM_IO::MT);
+
+ // @@ Should this be a catastrophic error???
+ if (this->base_acceptor_.acceptor ().get_local_addr (this->address_) != 0)
+ {
+ if (TAO_debug_level > 0)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) - SHMIOP_Acceptor::open_i, %p\n\n"),
+ ACE_TEXT ("cannot get local addr\n")));
+ return -1;
+ }
+
+ // If the ORB is instructed to use dotted decimal addresses, we respect that
+ // also for shmiop
+ if (orb_core->orb_params ()->use_dotted_decimal_addresses ())
+ {
+ // Get the ip address, we get the remote addr to put in the IOR, don't
+ // calls get_host_addr() directly on address_, we then get the internal
+ // address back
+ const char *tmp = this->address_.get_remote_addr().get_host_addr ();
+
+ if (tmp == 0)
+ {
+ if (TAO_debug_level > 0)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) - ")
+ ACE_TEXT ("SHMIOP_Acceptor::open_i, ")
+ ACE_TEXT ("- %p, "),
+ ACE_TEXT ("cannot determine hostname\n")));
+ return -1;
+ }
+
+ this->host_ = tmp;
+ }
+ else
+ {
+ // This will be the actualy host name of the original endpoint.
+ ACE_TCHAR tmp_host[MAXHOSTNAMELEN+1];
+
+ if (this->address_.get_host_name (tmp_host,
+ sizeof tmp_host) != 0)
+ {
+ if (TAO_debug_level > 0)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) - SHMIOP_Acceptor::open_i, - %p\n"),
+ ACE_TEXT ("cannot cache hostname\n")));
+ return -1;
+ }
+ this->host_ = ACE_TEXT_ALWAYS_CHAR(tmp_host);
+ }
+
+ // This avoids having child processes acquire the listen socket thereby
+ // denying the server the opportunity to restart on a well-known endpoint.
+ // This does not affect the aberrent behavior on Win32 platforms.
+ (void) this->base_acceptor_.acceptor().enable (ACE_CLOEXEC);
+
+ if (TAO_debug_level > 5)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - SHMIOP_Acceptor::open_i, ")
+ ACE_TEXT ("listening on : <%s:%u>\n"),
+ ACE_TEXT_CHAR_TO_TCHAR(this->host_.c_str ()),
+ this->address_.get_port_number ()));
+ }
+ return 0;
+}
+
+
+int
+TAO_SHMIOP_Acceptor::object_key (IOP::TaggedProfile &profile,
+ TAO::ObjectKey &object_key)
+{
+ // Create the decoding stream from the encapsulation in the buffer,
+#if (TAO_NO_COPY_OCTET_SEQUENCES == 1)
+ TAO_InputCDR cdr (profile.profile_data.mb ());
+#else
+ TAO_InputCDR cdr (reinterpret_cast<char*>(profile.profile_data.get_buffer ()),
+ profile.profile_data.length ());
+#endif /* TAO_NO_COPY_OCTET_SEQUENCES == 1 */
+
+ CORBA::Octet major = 0;
+ CORBA::Octet minor = 0;
+
+ // Read the version. We just read it here. We don't*do any*
+ // processing.
+ if (!(cdr.read_octet (major)
+ && cdr.read_octet (minor)))
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - SHMIOP_Profile::decode, v%d.%d\n"),
+ major,
+ minor));
+ }
+ return -1;
+ }
+
+ CORBA::String_var host;
+ CORBA::UShort port = 0;
+
+ // Get host and port. No processing here too..
+ if (cdr.read_string (host.out ()) == 0
+ || cdr.read_ushort (port) == 0)
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) - SHMIOP_Acceptor::object_key, ")
+ ACE_TEXT ("error while decoding host/port\n")));
+ }
+ return -1;
+ }
+
+ // ... and object key.
+ if ((cdr >> object_key) == 0)
+ return -1;
+
+ // We are NOT bothered about the rest.
+
+ return 1;
+}
+
+
+CORBA::ULong
+TAO_SHMIOP_Acceptor::endpoint_count (void)
+{
+ // @@ for now just assume one!
+ // we should take a look at the local address, if it is zero then
+ // get the list of available IP interfaces and return this number.
+ return 1;
+}
+
+int
+TAO_SHMIOP_Acceptor::parse_options (const char *str)
+{
+ if (str == 0)
+ return 0; // No options to parse. Not a problem.
+
+ // Use an option format similar to the one used for CGI scripts in
+ // HTTP URLs.
+ // e.g.: option1=foo&option2=bar
+
+ ACE_CString options (str);
+
+ size_t len = options.length ();
+
+ const char option_delimiter = '&';
+
+ // Count the number of options.
+
+ CORBA::ULong option_count = 1;
+ // Number of endpoints in the string (initialized to 1).
+
+ // Only check for endpoints after the protocol specification and
+ // before the object key.
+ for (size_t i = 0; i < len; ++i)
+ if (options[i] == option_delimiter)
+ ++option_count;
+
+ // The idea behind the following loop is to split the options into
+ // (option, name) pairs.
+ // For example,
+ // `option1=foo&option2=bar'
+ // will be parsed into:
+ // `option1=foo'
+ // `option2=bar'
+
+ ACE_CString::size_type begin = 0;
+ ACE_CString::size_type end = 0;
+
+ for (CORBA::ULong j = 0; j < option_count; ++j)
+ {
+ if (j < option_count - 1)
+ end = options.find (option_delimiter, begin);
+ else
+ end = len;
+
+ if (end == begin)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) Zero length SHMIOP option.\n")),
+ -1);
+ else if (end != ACE_CString::npos)
+ {
+ ACE_CString opt = options.substring (begin, end - begin);
+
+ ACE_CString::size_type const slot = opt.find ("=");
+
+ if (slot == len - 1
+ || slot == ACE_CString::npos)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) SHMIOP option <%s> is ")
+ ACE_TEXT ("missing a value.\n"),
+ ACE_TEXT_CHAR_TO_TCHAR(opt.c_str ())),
+ -1);
+
+ ACE_CString name = opt.substring (0, slot);
+ ACE_CString value = opt.substring (slot + 1);
+
+ if (name.length () == 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) Zero length SHMIOP ")
+ ACE_TEXT ("option name.\n")),
+ -1);
+
+ if (name == "priority")
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) Invalid SHMIOP endpoint format: ")
+ ACE_TEXT ("endpoint priorities no longer supported.\n")),
+ -1);
+ }
+ else
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) Invalid SHMIOP option: <%s>\n"),
+ ACE_TEXT_CHAR_TO_TCHAR(name.c_str ())),
+ -1);
+
+ begin = end + 1;
+ }
+ else
+ break; // No other options.
+ }
+ return 0;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_SHMIOP && TAO_HAS_SHMIOP != 0 */
diff --git a/TAO/tao/Strategies/SHMIOP_Acceptor.h b/TAO/tao/Strategies/SHMIOP_Acceptor.h
new file mode 100644
index 00000000000..acb57ed33fe
--- /dev/null
+++ b/TAO/tao/Strategies/SHMIOP_Acceptor.h
@@ -0,0 +1,154 @@
+// -*- C++ -*-
+// $Id$
+
+// $Id$
+// ===================================================================
+/**
+ * @file SHMIOP_Acceptor.h
+ *
+ * @brief SHMIOP specific acceptor processing
+ *
+ * @author Nanbor Wang <nanbor@cs.wustl.edu>
+ */
+// ===================================================================
+
+#ifndef TAO_SHMIOP_ACCEPTOR_H
+#define TAO_SHMIOP_ACCEPTOR_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if defined (TAO_HAS_SHMIOP) && (TAO_HAS_SHMIOP != 0)
+
+#include "tao/Transport_Acceptor.h"
+#include "tao/Strategies/SHMIOP_Connection_Handler.h"
+#include "tao/Acceptor_Impl.h"
+#include "ace/Acceptor.h"
+#include "ace/MEM_Acceptor.h"
+#include "tao/GIOP_Message_Version.h"
+// TAO SHMIOP_Acceptor concrete call definitions
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_SHMIOP_Acceptor
+ *
+ * @brief The SHMIOP-specific bridge class for the concrete acceptor.
+ *
+ */
+class TAO_Strategies_Export TAO_SHMIOP_Acceptor : public TAO_Acceptor
+{
+public:
+ /// Constructor.
+ TAO_SHMIOP_Acceptor (CORBA::Boolean flag = false);
+
+ /// Destructor.
+ ~TAO_SHMIOP_Acceptor (void);
+
+ typedef ACE_Strategy_Acceptor<TAO_SHMIOP_Connection_Handler, ACE_MEM_ACCEPTOR> TAO_SHMIOP_BASE_ACCEPTOR;
+ typedef TAO_Creation_Strategy<TAO_SHMIOP_Connection_Handler> TAO_SHMIOP_CREATION_STRATEGY;
+ typedef TAO_Concurrency_Strategy<TAO_SHMIOP_Connection_Handler> TAO_SHMIOP_CONCURRENCY_STRATEGY;
+ typedef TAO_Accept_Strategy<TAO_SHMIOP_Connection_Handler, ACE_MEM_ACCEPTOR> TAO_SHMIOP_ACCEPT_STRATEGY;
+
+ /**
+ * @name The TAO_Acceptor Methods
+ *
+ * Please check the documentation in Transport_Acceptor.h for details.
+ */
+ //@{
+ virtual int open (TAO_ORB_Core *orb_core,
+ ACE_Reactor *reactor,
+ int version_major,
+ int version_minor,
+ const char *port,
+ const char *options = 0);
+ virtual int open_default (TAO_ORB_Core *orb_core,
+ ACE_Reactor *reactor,
+ int version_major,
+ int version_minor,
+ const char *options = 0);
+ virtual int close (void);
+ virtual int create_profile (const TAO::ObjectKey &object_key,
+ TAO_MProfile &mprofile,
+ CORBA::Short priority);
+
+ virtual int is_collocated (const TAO_Endpoint* endpoint);
+ virtual CORBA::ULong endpoint_count (void);
+
+ virtual int object_key (IOP::TaggedProfile &profile,
+ TAO::ObjectKey &key);
+ //@}
+
+ /// Set the MMAP options the MEM_Stream this acceptor creates will
+ /// use.
+ int set_mmap_options (const ACE_TCHAR *prefix,
+ off_t size);
+
+private:
+ /// Implement the common part of the open*() methods.
+ int open_i (TAO_ORB_Core* orb_core,
+ ACE_Reactor *reactor);
+
+ /// Parse protocol specific options.
+ virtual int parse_options (const char *options);
+
+ /// Create a SHMIOP profile representing this acceptor.
+ int create_new_profile (const TAO::ObjectKey &object_key,
+ TAO_MProfile &mprofile,
+ CORBA::Short priority);
+
+ /// Add the endpoints on this acceptor to a shared profile.
+ int create_shared_profile (const TAO::ObjectKey &object_key,
+ TAO_MProfile &mprofile,
+ CORBA::Short priority);
+
+protected:
+ /// Cache the information about the endpoint serviced by this
+ /// acceptor.
+ /// @todo There may in fact be multiple hostnames for this endpoint.
+ /// For example it the IP address is INADDR_ANY
+ /// (0.0.0.0) then there will be possibly a different hostname for
+ /// each interface.
+ ACE_CString host_;
+
+ /// A local endpoint.
+ ACE_MEM_Addr address_;
+
+ /// The GIOP version for this endpoint
+ TAO_GIOP_Message_Version version_;
+
+ /// ORB Core.
+ TAO_ORB_Core *orb_core_;
+
+private:
+ /// The concrete acceptor, as a pointer to it's base class.
+ TAO_SHMIOP_BASE_ACCEPTOR base_acceptor_;
+
+ /// Acceptor strategies.
+ TAO_SHMIOP_CREATION_STRATEGY *creation_strategy_;
+ TAO_SHMIOP_CONCURRENCY_STRATEGY *concurrency_strategy_;
+ TAO_SHMIOP_ACCEPT_STRATEGY *accept_strategy_;
+
+ /// Determine the prefix (include path name) of the mmap file.
+ const ACE_TCHAR *mmap_file_prefix_;
+
+ /// Determine the minimum size of mmap file. This dictate the
+ /// maximum size of a CORBA method invocation.
+ off_t mmap_size_;
+
+ /// Should we use GIOP lite??
+ CORBA::Boolean lite_flag_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_SHMIOP && TAO_HAS_SHMIOP != 0 */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_SHMIOP_ACCEPTOR_H */
diff --git a/TAO/tao/Strategies/SHMIOP_Connection_Handler.cpp b/TAO/tao/Strategies/SHMIOP_Connection_Handler.cpp
new file mode 100644
index 00000000000..788407dfd7d
--- /dev/null
+++ b/TAO/tao/Strategies/SHMIOP_Connection_Handler.cpp
@@ -0,0 +1,257 @@
+// $Id$
+
+#include "tao/Strategies/SHMIOP_Connection_Handler.h"
+
+#if defined (TAO_HAS_SHMIOP) && (TAO_HAS_SHMIOP != 0)
+
+#include "tao/Timeprobe.h"
+#include "tao/debug.h"
+#include "tao/ORB_Core.h"
+#include "tao/ORB.h"
+#include "tao/CDR.h"
+#include "tao/Server_Strategy_Factory.h"
+#include "tao/Base_Transport_Property.h"
+#include "tao/Transport_Cache_Manager.h"
+#include "tao/Thread_Lane_Resources.h"
+#include "tao/Strategies/SHMIOP_Endpoint.h"
+#include "tao/Resume_Handle.h"
+#include "tao/Protocols_Hooks.h"
+
+#include "ace/os_include/netinet/os_tcp.h"
+#include "ace/os_include/os_netdb.h"
+
+ACE_RCSID (Strategies,
+ SHMIOP_Connection_Handler,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_SHMIOP_Connection_Handler::TAO_SHMIOP_Connection_Handler (ACE_Thread_Manager *t)
+ : TAO_SHMIOP_SVC_HANDLER (t, 0 , 0),
+ TAO_Connection_Handler (0)
+{
+ // This constructor should *never* get called, it is just here to
+ // make the compiler happy: the default implementation of the
+ // Creation_Strategy requires a constructor with that signature, we
+ // don't use that implementation, but some (most?) compilers
+ // instantiate it anyway.
+ ACE_ASSERT (0);
+}
+
+
+TAO_SHMIOP_Connection_Handler::TAO_SHMIOP_Connection_Handler (TAO_ORB_Core *orb_core,
+ CORBA::Boolean flag)
+ : TAO_SHMIOP_SVC_HANDLER (orb_core->thr_mgr (), 0, 0),
+ TAO_Connection_Handler (orb_core)
+{
+ TAO_SHMIOP_Transport* specific_transport = 0;
+ ACE_NEW (specific_transport,
+ TAO_SHMIOP_Transport(this, orb_core, flag));
+
+ // store this pointer (indirectly increment ref count)
+ this->transport (specific_transport);
+}
+
+
+TAO_SHMIOP_Connection_Handler::~TAO_SHMIOP_Connection_Handler (void)
+{
+ delete this->transport ();
+}
+
+int
+TAO_SHMIOP_Connection_Handler::open_handler (void *v)
+{
+ return this->open (v);
+}
+
+int
+TAO_SHMIOP_Connection_Handler::open (void*)
+{
+ TAO_SHMIOP_Protocol_Properties protocol_properties;
+
+ // Initialize values from ORB params.
+ protocol_properties.send_buffer_size_ =
+ this->orb_core ()->orb_params ()->sock_sndbuf_size ();
+ protocol_properties.recv_buffer_size_ =
+ this->orb_core ()->orb_params ()->sock_rcvbuf_size ();
+ protocol_properties.no_delay_ =
+ this->orb_core ()->orb_params ()->nodelay ();
+
+ TAO_Protocols_Hooks *tph =
+ this->orb_core ()->get_protocols_hooks ();
+
+ bool client =
+ this->transport ()->opened_as () == TAO::TAO_CLIENT_ROLE;;
+
+ ACE_DECLARE_NEW_CORBA_ENV;
+
+ ACE_TRY
+ {
+ if (client)
+ {
+ tph->client_protocol_properties_at_orb_level (
+ protocol_properties
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ else
+ {
+ tph->server_protocol_properties_at_orb_level (
+ protocol_properties
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ }
+ ACE_CATCHANY
+ {
+ return -1;
+ }
+ ACE_ENDTRY;
+ ACE_CHECK_RETURN (-1);
+
+ if (this->set_socket_option (this->peer (),
+ protocol_properties.send_buffer_size_,
+ protocol_properties.recv_buffer_size_) == -1)
+ return -1;
+
+#if !defined (ACE_LACKS_TCP_NODELAY)
+ if (this->peer ().set_option (ACE_IPPROTO_TCP,
+ TCP_NODELAY,
+ (void *) &protocol_properties.no_delay_,
+ sizeof (protocol_properties.no_delay_)) == -1)
+ return -1;
+
+#endif /* ! ACE_LACKS_TCP_NODELAY */
+
+ if (this->transport ()->wait_strategy ()->non_blocking ())
+ {
+ if (this->peer ().enable (ACE_NONBLOCK) == -1)
+ return -1;
+ }
+
+ // Called by the <Strategy_Acceptor> when the handler is
+ // completely connected.
+ ACE_INET_Addr addr;
+
+ ACE_TCHAR local_as_string[MAXHOSTNAMELEN + 16];
+
+ // Get the peername.
+ if (this->peer ().get_remote_addr (addr) == -1)
+ return -1;
+
+ // Verify that we can resolve the peer hostname.
+ else if (addr.addr_to_string (local_as_string, sizeof (local_as_string)) == -1)
+ return -1;
+
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - SHMIOP connection from client")
+ ACE_TEXT ("<%s> on %d\n"),
+ local_as_string, this->peer ().get_handle ()));
+ }
+
+ // Set that the transport is now connected, if fails we return -1
+ // Use C-style cast b/c otherwise we get warnings on lots of
+ // compilers
+ if (!this->transport ()->post_open ((size_t) this->get_handle ()))
+ return -1;
+
+ // Not needed, anyway
+ this->state_changed (TAO_LF_Event::LFS_SUCCESS,
+ this->orb_core ()->leader_follower ());
+
+ return 0;
+}
+
+int
+TAO_SHMIOP_Connection_Handler::resume_handler (void)
+{
+ return ACE_Event_Handler::ACE_APPLICATION_RESUMES_HANDLER;
+}
+
+int
+TAO_SHMIOP_Connection_Handler::close_connection (void)
+{
+ return this->close_connection_eh (this);
+}
+
+int
+TAO_SHMIOP_Connection_Handler::handle_input (ACE_HANDLE h)
+{
+ return this->handle_input_eh (h, this);
+}
+
+int
+TAO_SHMIOP_Connection_Handler::handle_output (ACE_HANDLE handle)
+{
+ int result =
+ this->handle_output_eh (handle, this);
+
+ if (result == -1)
+ {
+ this->close_connection ();
+ return 0;
+ }
+
+ return result;
+}
+
+int
+TAO_SHMIOP_Connection_Handler::handle_timeout (const ACE_Time_Value &,
+ const void *)
+{
+ // We don't use this upcall for I/O. This is only used by the
+ // Connector to indicate that the connection timedout. Therefore,
+ // we should call close().
+ return this->close ();
+}
+
+int
+TAO_SHMIOP_Connection_Handler::handle_close (ACE_HANDLE,
+ ACE_Reactor_Mask)
+{
+ ACE_ASSERT (0);
+ return 0;
+}
+
+int
+TAO_SHMIOP_Connection_Handler::close (u_long)
+{
+ return this->close_handler ();
+}
+
+int
+TAO_SHMIOP_Connection_Handler::release_os_resources (void)
+{
+ return this->peer().close ();
+}
+
+int
+TAO_SHMIOP_Connection_Handler::add_transport_to_cache (void)
+{
+ ACE_INET_Addr addr;
+
+ // Get the peername.
+ if (this->peer ().get_remote_addr (addr) == -1)
+ return -1;
+
+ // Construct an SHMIOP_Endpoint object
+ TAO_SHMIOP_Endpoint endpoint (
+ addr,
+ this->orb_core()->orb_params()->use_dotted_decimal_addresses ());
+
+ // Construct a property object
+ TAO_Base_Transport_Property prop (&endpoint);
+
+ TAO::Transport_Cache_Manager &cache =
+ this->orb_core ()->lane_resources ().transport_cache ();
+
+ // Add the handler to Cache
+ return cache.cache_idle_transport (&prop,
+ this->transport ());
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /*(TAO_HAS_SHMIOP) && (TAO_HAS_SHMIOP != 0) */
diff --git a/TAO/tao/Strategies/SHMIOP_Connection_Handler.h b/TAO/tao/Strategies/SHMIOP_Connection_Handler.h
new file mode 100644
index 00000000000..8b432e5750f
--- /dev/null
+++ b/TAO/tao/Strategies/SHMIOP_Connection_Handler.h
@@ -0,0 +1,112 @@
+// -*- C++ -*-
+
+// ===================================================================
+/**
+ * @file SHMIOP_Connection_Handler.h
+ *
+ * $Id$
+ *
+ * @author Nanbor Wang <nanbor@cs.wustl.edu>
+ */
+// ===================================================================
+
+#ifndef TAO_SHMIOP_CONNECT_H
+#define TAO_SHMIOP_CONNECT_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+#pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if defined (TAO_HAS_SHMIOP) && (TAO_HAS_SHMIOP != 0)
+
+#include "ace/Reactor.h"
+#include "ace/Acceptor.h"
+#include "tao/Wait_Strategy.h"
+#include "tao/Connection_Handler.h"
+#include "tao/Strategies/SHMIOP_Transport.h"
+
+// ****************************************************************
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_SHMIOP_Connection_Handler
+ *
+ * @brief Handles requests on a single connection.
+ *
+ * The Connection handler which is common for the Acceptor and
+ * the Connector
+ */
+class TAO_Strategies_Export TAO_SHMIOP_Connection_Handler :
+ public TAO_SHMIOP_SVC_HANDLER,
+ public TAO_Connection_Handler
+{
+
+public:
+ /// Constructor.
+ TAO_SHMIOP_Connection_Handler (ACE_Thread_Manager* t = 0);
+
+ /// Constructor.
+ TAO_SHMIOP_Connection_Handler (TAO_ORB_Core *orb_core,
+ CORBA::Boolean flag);
+
+ /// Destructor.
+ ~TAO_SHMIOP_Connection_Handler (void);
+
+ /// Called by the <Strategy_Acceptor> when the handler is completely
+ /// connected. Argument is unused.
+ virtual int open (void *);
+
+ //@{
+ /**
+ * Connection_Handler overloads
+ */
+ virtual int open_handler (void *);
+ //@}
+
+ /// Close called by the Acceptor or Connector when connection
+ /// establishment fails.
+ int close (u_long = 0);
+
+ //@{
+ /** @name Event Handler overloads
+ */
+ virtual int resume_handler (void);
+ virtual int close_connection (void);
+ virtual int handle_input (ACE_HANDLE);
+ virtual int handle_output (ACE_HANDLE);
+ virtual int handle_close (ACE_HANDLE, ACE_Reactor_Mask);
+ virtual int handle_timeout (const ACE_Time_Value &current_time,
+ const void *act = 0);
+ //@}
+
+ /// Add ourselves to Cache.
+ int add_transport_to_cache (void);
+
+protected:
+
+ //@{
+ /**
+ * @name TAO_Connection Handler overloads
+ */
+ virtual int release_os_resources (void);
+ //@}
+
+private:
+ /// Flag that we will be passing to the event handler to indicate
+ /// whether the handle will be resumed by the method or not.
+ int resume_flag_;
+
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_SHMIOP && TAO_HAS_SHMIOP != 0 */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_SHMIOP_CONNECT_H */
diff --git a/TAO/tao/Strategies/SHMIOP_Connector.cpp b/TAO/tao/Strategies/SHMIOP_Connector.cpp
new file mode 100644
index 00000000000..adba9338dc1
--- /dev/null
+++ b/TAO/tao/Strategies/SHMIOP_Connector.cpp
@@ -0,0 +1,354 @@
+// $Id$
+
+
+#include "tao/Strategies/SHMIOP_Connector.h"
+
+#if defined (TAO_HAS_SHMIOP) && (TAO_HAS_SHMIOP != 0)
+
+#include "tao/Strategies/SHMIOP_Profile.h"
+#include "tao/Strategies/SHMIOP_Endpoint.h"
+#include "tao/debug.h"
+#include "tao/Base_Transport_Property.h"
+#include "tao/ORB_Core.h"
+#include "tao/Client_Strategy_Factory.h"
+#include "tao/Environment.h"
+#include "tao/Transport_Cache_Manager.h"
+#include "tao/Thread_Lane_Resources.h"
+#include "tao/Blocked_Connect_Strategy.h"
+#include "ace/OS_NS_strings.h"
+
+ACE_RCSID (Strategies,
+ SHMIOP_Connector,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_SHMIOP_Connector::TAO_SHMIOP_Connector (CORBA::Boolean flag)
+ : TAO_Connector (TAO_TAG_SHMEM_PROFILE),
+ connect_strategy_ (),
+ base_connector_ (),
+ lite_flag_ (flag)
+{
+}
+
+TAO_SHMIOP_Connector::~TAO_SHMIOP_Connector (void)
+{
+}
+
+int
+TAO_SHMIOP_Connector::open (TAO_ORB_Core *orb_core)
+{
+ this->orb_core (orb_core);
+
+ // The SHMIOP always uses a blocked connect strategy
+ // @@todo: There are better ways of doing this. Let it be like this
+ // for the present.
+ ACE_NEW_RETURN (this->active_connect_strategy_,
+ TAO_Blocked_Connect_Strategy (orb_core),
+ -1);
+
+ // Our connect creation strategy
+ TAO_SHMIOP_CONNECT_CREATION_STRATEGY *connect_creation_strategy = 0;
+
+ ACE_NEW_RETURN (connect_creation_strategy,
+ TAO_SHMIOP_CONNECT_CREATION_STRATEGY
+ (orb_core->thr_mgr (),
+ orb_core,
+ this->lite_flag_),
+ -1);
+
+ /// Our activation strategy
+ TAO_SHMIOP_CONNECT_CONCURRENCY_STRATEGY *concurrency_strategy = 0;
+
+ ACE_NEW_RETURN (concurrency_strategy,
+ TAO_SHMIOP_CONNECT_CONCURRENCY_STRATEGY (orb_core),
+ -1);
+
+ if (this->base_connector_.open (this->orb_core ()->reactor (),
+ connect_creation_strategy,
+ &this->connect_strategy_,
+ concurrency_strategy) == -1)
+ return -1;
+ // We can take advantage of the multithreaded shared-memory transport
+ // if the client will block on read (i.e., will not allow callback.)
+ else if (orb_core->client_factory ()->allow_callback () == 0)
+
+ {
+ this->base_connector_.connector ().preferred_strategy (ACE_MEM_IO::MT);
+ this->connect_strategy_.connector ().preferred_strategy (ACE_MEM_IO::MT);
+ }
+ return 0;
+}
+
+int
+TAO_SHMIOP_Connector::close (void)
+{
+ delete this->base_connector_.concurrency_strategy ();
+ delete this->base_connector_.creation_strategy ();
+ return this->base_connector_.close ();
+}
+
+int
+TAO_SHMIOP_Connector::set_validate_endpoint (TAO_Endpoint *endpoint)
+{
+ if (endpoint->tag () != TAO_TAG_SHMEM_PROFILE)
+ return -1;
+
+ TAO_SHMIOP_Endpoint *shmiop_endpoint =
+ dynamic_cast <TAO_SHMIOP_Endpoint *>(endpoint);
+ if (shmiop_endpoint == 0)
+ return -1;
+
+ const ACE_INET_Addr &remote_address =
+ shmiop_endpoint->object_addr ();
+
+ // Verify that the remote ACE_INET_Addr was initialized properly.
+ // Failure can occur if hostname lookup failed when initializing the
+ // remote ACE_INET_Addr.
+ if (remote_address.get_type () != AF_INET)
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) SHMIOP connection failed.\n")
+ ACE_TEXT ("TAO (%P|%t) This is most likely ")
+ ACE_TEXT ("due to a hostname lookup ")
+ ACE_TEXT ("failure.\n")));
+ }
+
+ return -1;
+ }
+
+ return 0;
+
+}
+
+TAO_Transport *
+TAO_SHMIOP_Connector::make_connection (TAO::Profile_Transport_Resolver *,
+ TAO_Transport_Descriptor_Interface &desc,
+ ACE_Time_Value *timeout)
+{
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - SHMIOP_Connector::make_connection, ")
+ ACE_TEXT ("looking for SHMIOP connection.\n")));
+
+ TAO_SHMIOP_Endpoint *shmiop_endpoint =
+ this->remote_endpoint (desc.endpoint ());
+
+ if (shmiop_endpoint == 0)
+ return 0;
+
+ const ACE_INET_Addr &remote_address =
+ shmiop_endpoint->object_addr ();
+
+ if (TAO_debug_level > 2)
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - SHMIOP_Connector::make_connection, "
+ "making a new connection to <%s:%d>\n",
+ ACE_TEXT_CHAR_TO_TCHAR (shmiop_endpoint->host ()),
+ shmiop_endpoint->port ()));
+
+ // Get the right synch options
+ ACE_Synch_Options synch_options;
+
+ this->active_connect_strategy_->synch_options (timeout,
+ synch_options);
+
+ TAO_SHMIOP_Connection_Handler *svc_handler = 0;
+
+ // Connect.
+ int result = this->base_connector_.connect (svc_handler,
+ remote_address,
+ synch_options);
+
+ // This call creates the service handler and bumps the #REFCOUNT# up
+ // one extra. There are two possibilities: (a) connection succeeds
+ // immediately - in this case, the #REFCOUNT# on the handler is two;
+ // (b) connection fails immediately - in this case, the #REFCOUNT#
+ // on the handler is one since close() gets called on the handler.
+ // We always use a blocking connection so the connection is never
+ // pending.
+
+ // Make sure that we always do a remove_reference
+ ACE_Event_Handler_var svc_handler_auto_ptr (svc_handler);
+
+ // In case of errors.
+ if (result == -1)
+ {
+ // Give users a clue to the problem.
+ if (TAO_debug_level > 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) - SHMIOP_Connector::make_connection, ")
+ ACE_TEXT ("connection to <%s:%u> failed (%p)\n"),
+ ACE_TEXT_CHAR_TO_TCHAR (shmiop_endpoint->host ()),
+ shmiop_endpoint->port (),
+ ACE_TEXT ("errno")));
+ }
+
+ return 0;
+ }
+
+ // At this point, the connection has be successfully connected.
+ // #REFCOUNT# is one.
+ if (TAO_debug_level > 2)
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - SHMIOP_Connector::make_connection, "
+ "new connection to <%s:%d> on Transport[%d]\n",
+ ACE_TEXT_CHAR_TO_TCHAR (shmiop_endpoint->host ()),
+ shmiop_endpoint->port (),
+ svc_handler->peer ().get_handle ()));
+
+ TAO_Transport *transport =
+ svc_handler->transport ();
+
+ // Add the handler to Cache
+ int retval =
+ this->orb_core ()->lane_resources ().transport_cache ().cache_transport (&desc,
+ transport);
+
+ // Failure in adding to cache.
+ if (retval != 0)
+ {
+ // Close the handler.
+ svc_handler->close ();
+
+ if (TAO_debug_level > 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "TAO (%P|%t) - SHMIOP_Connector::make_connection, "
+ "could not add the new connection to cache\n"));
+ }
+
+ return 0;
+ }
+
+ if (transport->is_connected () &&
+ transport->wait_strategy ()->register_handler () != 0)
+ {
+ // Registration failures.
+
+ // Purge from the connection cache, if we are not in the cache, this
+ // just does nothing.
+ (void) transport->purge_entry ();
+
+ // Close the handler.
+ (void) transport->close_connection ();
+
+ if (TAO_debug_level > 0)
+ ACE_ERROR ((LM_ERROR,
+ "TAO (%P|%t) - SHMIOP_Connector [%d]::make_connection, "
+ "could not register the transport in the reactor.\n",
+ transport->id ()));
+
+ return 0;
+ }
+
+ return transport;
+}
+
+TAO_Profile *
+TAO_SHMIOP_Connector::create_profile (TAO_InputCDR& cdr)
+{
+ TAO_Profile *pfile = 0;
+ ACE_NEW_RETURN (pfile,
+ TAO_SHMIOP_Profile (this->orb_core ()),
+ 0);
+
+ int r = pfile->decode (cdr);
+ if (r == -1)
+ {
+ pfile->_decr_refcnt ();
+ pfile = 0;
+ }
+
+ return pfile;
+}
+
+TAO_Profile *
+TAO_SHMIOP_Connector::make_profile (ACE_ENV_SINGLE_ARG_DECL)
+{
+ // The endpoint should be of the form:
+ // N.n@port/object_key
+ // or:
+ // port/object_key
+
+ TAO_Profile *profile = 0;
+ ACE_NEW_THROW_EX (profile,
+ TAO_SHMIOP_Profile (this->orb_core ()),
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (0);
+
+ return profile;
+}
+
+int
+TAO_SHMIOP_Connector::check_prefix (const char *endpoint)
+{
+ // Check for a valid string
+ if (!endpoint || !*endpoint)
+ return -1; // Failure
+
+ const char *protocol[] = { "shmiop", "shmioploc" };
+
+ size_t slot = ACE_OS::strchr (endpoint, ':') - endpoint;
+
+ size_t len0 = ACE_OS::strlen (protocol[0]);
+ size_t len1 = ACE_OS::strlen (protocol[1]);
+
+ // Check for the proper prefix in the IOR. If the proper prefix
+ // isn't in the IOR then it is not an IOR we can use.
+ if (slot == len0
+ && ACE_OS::strncasecmp (endpoint, protocol[0], len0) == 0)
+ return 0;
+ else if (slot == len1
+ && ACE_OS::strncasecmp (endpoint, protocol[1], len1) == 0)
+ return 0;
+
+ return -1;
+ // Failure: not an SHMIOP IOR
+ // DO NOT throw an exception here.
+}
+
+char
+TAO_SHMIOP_Connector::object_key_delimiter (void) const
+{
+ return TAO_SHMIOP_Profile::object_key_delimiter_;
+}
+
+TAO_SHMIOP_Endpoint *
+TAO_SHMIOP_Connector::remote_endpoint (TAO_Endpoint *endpoint)
+{
+ if (endpoint->tag () != TAO_TAG_SHMEM_PROFILE)
+ return 0;
+
+ TAO_SHMIOP_Endpoint *shmiop_endpoint =
+ dynamic_cast <TAO_SHMIOP_Endpoint *>(endpoint);
+ if (shmiop_endpoint == 0)
+ return 0;
+
+ return shmiop_endpoint;
+}
+
+int
+TAO_SHMIOP_Connector::cancel_svc_handler (
+ TAO_Connection_Handler * svc_handler)
+{
+ TAO_SHMIOP_Connection_Handler* handler=
+ dynamic_cast<TAO_SHMIOP_Connection_Handler*>(svc_handler);
+
+ if (handler)
+ // Cancel from the connector
+ return this->base_connector_.cancel (handler);
+
+ return -1;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_SHMIOP && TAO_HAS_SHMIOP != 0 */
diff --git a/TAO/tao/Strategies/SHMIOP_Connector.h b/TAO/tao/Strategies/SHMIOP_Connector.h
new file mode 100644
index 00000000000..014e4afcc90
--- /dev/null
+++ b/TAO/tao/Strategies/SHMIOP_Connector.h
@@ -0,0 +1,137 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file SHMIOP_Connector.h
+ *
+ * $Id$
+ *
+ * SHMIOP specific connector processing
+ *
+ * @author Nanbor Wang <nanbor@cs.wustl.edu>
+ */
+//=============================================================================
+
+
+#ifndef TAO_SHMIOP_CONNECTOR_H
+#define TAO_SHMIOP_CONNECTOR_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if defined (TAO_HAS_SHMIOP) && (TAO_HAS_SHMIOP != 0)
+
+#include "ace/MEM_Connector.h"
+#include "ace/Connector.h"
+#include "tao/Transport_Connector.h"
+#include "tao/Strategies/SHMIOP_Connection_Handler.h"
+#include "tao/Resource_Factory.h"
+#include "tao/Connector_Impl.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_SHMIOP_Endpoint;
+
+// ****************************************************************
+
+/**
+ * @class TAO_SHMIOP_Connector
+ *
+ * @brief SHMIOP-specific Connector bridge for pluggable protocols.
+ *
+ * Concrete instance of the TAO_Connector class. Responsible
+ * for establishing a connection with a server and is called from the
+ * Connector_Registory.
+ */
+class TAO_Strategies_Export TAO_SHMIOP_Connector : public TAO_Connector
+{
+public:
+ /// Constructor.
+ TAO_SHMIOP_Connector (CORBA::Boolean flag = false);
+
+ /// Default destructor
+ ~TAO_SHMIOP_Connector (void);
+
+ /**
+ * @name The TAO_Connector Methods
+ *
+ * Please check the documentation in Transport_Connector.h for details.
+ */
+ //@{
+ int open (TAO_ORB_Core *orb_core);
+ int close (void);
+
+ TAO_Profile *create_profile (TAO_InputCDR& cdr);
+
+ virtual int check_prefix (const char *endpoint);
+
+ virtual char object_key_delimiter (void) const;
+ //@}
+
+public:
+
+ typedef TAO_Connect_Concurrency_Strategy<TAO_SHMIOP_Connection_Handler>
+ TAO_SHMIOP_CONNECT_CONCURRENCY_STRATEGY;
+
+ typedef TAO_Connect_Creation_Strategy<TAO_SHMIOP_Connection_Handler>
+ TAO_SHMIOP_CONNECT_CREATION_STRATEGY;
+
+ typedef ACE_Connect_Strategy<TAO_SHMIOP_Connection_Handler,
+ ACE_MEM_CONNECTOR>
+ TAO_SHMIOP_CONNECT_STRATEGY ;
+
+ typedef ACE_Strategy_Connector<TAO_SHMIOP_Connection_Handler,
+ ACE_MEM_CONNECTOR>
+ TAO_SHMIOP_BASE_CONNECTOR;
+
+protected:
+ /**
+ * @name More TAO_Connector Methods
+ *
+ * Please check the documentation in Transport_Connector.h for details.
+ */
+ //@{
+ int set_validate_endpoint (TAO_Endpoint *endpoint);
+
+ TAO_Transport *make_connection (TAO::Profile_Transport_Resolver *r,
+ TAO_Transport_Descriptor_Interface &desc,
+ ACE_Time_Value *timeout = 0);
+
+ virtual TAO_Profile *make_profile (ACE_ENV_SINGLE_ARG_DECL);
+
+ /// Cancel the passed cvs handler from the connector
+ int cancel_svc_handler (TAO_Connection_Handler * svc_handler);
+ //@}
+
+private:
+
+ /// Return the remote endpoint, a helper function
+ TAO_SHMIOP_Endpoint *remote_endpoint (TAO_Endpoint *ep);
+
+private:
+
+ /// Local address.
+ ACE_MEM_Addr address_;
+
+ /// Our connect strategy.
+ TAO_SHMIOP_CONNECT_STRATEGY connect_strategy_;
+
+ /// The connector initiating connection requests for SHMIOP.
+ TAO_SHMIOP_BASE_CONNECTOR base_connector_;
+
+ /// Are we using GIOP lite?
+ CORBA::Boolean lite_flag_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_SHMIOP && TAO_HAS_SHMIOP != 0 */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_SHMIOP_CONNECTOR_H */
diff --git a/TAO/tao/Strategies/SHMIOP_Endpoint.cpp b/TAO/tao/Strategies/SHMIOP_Endpoint.cpp
new file mode 100644
index 00000000000..cf24fcd5fba
--- /dev/null
+++ b/TAO/tao/Strategies/SHMIOP_Endpoint.cpp
@@ -0,0 +1,266 @@
+// $Id$
+
+#include "tao/Strategies/SHMIOP_Endpoint.h"
+
+#if defined (TAO_HAS_SHMIOP) && (TAO_HAS_SHMIOP != 0)
+
+#include "tao/Strategies/SHMIOP_Connection_Handler.h"
+#include "tao/debug.h"
+#include "tao/ORB_Constants.h"
+
+#include "ace/OS_NS_stdio.h"
+
+
+ACE_RCSID (Strategies,
+ SHMIOP_Endpoint,
+ "$Id$")
+
+
+#if !defined (__ACE_INLINE__)
+# include "tao/Strategies/SHMIOP_Endpoint.i"
+#endif /* __ACE_INLINE__ */
+
+#include "ace/os_include/os_netdb.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_SHMIOP_Endpoint::TAO_SHMIOP_Endpoint (const ACE_MEM_Addr &addr,
+ int use_dotted_decimal_addresses)
+ : TAO_Endpoint (TAO_TAG_SHMEM_PROFILE)
+ , host_ ()
+ , port_ (0)
+ , object_addr_ (addr.get_remote_addr ())
+ , object_addr_set_ (0)
+ , next_ (0)
+{
+ this->set (addr.get_remote_addr (), use_dotted_decimal_addresses);
+}
+
+TAO_SHMIOP_Endpoint::TAO_SHMIOP_Endpoint (const ACE_INET_Addr &addr,
+ int use_dotted_decimal_addresses)
+ : TAO_Endpoint (TAO_TAG_SHMEM_PROFILE)
+ , host_ ()
+ , port_ (0)
+ , object_addr_ (addr)
+ , object_addr_set_ (0)
+ , next_ (0)
+{
+ this->set (addr, use_dotted_decimal_addresses);
+}
+
+TAO_SHMIOP_Endpoint::TAO_SHMIOP_Endpoint (const char *host,
+ CORBA::UShort port,
+ const ACE_INET_Addr &addr,
+ CORBA::Short priority)
+ : TAO_Endpoint (TAO_TAG_SHMEM_PROFILE, priority)
+ , host_ ()
+ , port_ (port)
+ , object_addr_ (addr)
+ , object_addr_set_ (0)
+ , next_ (0)
+{
+ if (host != 0)
+ this->host_ = host;
+}
+
+TAO_SHMIOP_Endpoint::TAO_SHMIOP_Endpoint (void)
+ : TAO_Endpoint (TAO_TAG_SHMEM_PROFILE)
+ , host_ ()
+ , port_ (0)
+ , object_addr_ ()
+ , object_addr_set_ (0)
+ , next_ (0)
+{
+}
+
+TAO_SHMIOP_Endpoint::TAO_SHMIOP_Endpoint (const char *host,
+ CORBA::UShort port,
+ CORBA::Short priority)
+ : TAO_Endpoint (TAO_TAG_SHMEM_PROFILE)
+ , host_ ()
+ , port_ (port)
+ , object_addr_ ()
+ , object_addr_set_ (0)
+ , next_ (0)
+{
+ if (host != 0)
+ this->host_ = host;
+
+ this->priority (priority);
+}
+
+TAO_SHMIOP_Endpoint::~TAO_SHMIOP_Endpoint (void)
+{
+}
+
+int
+TAO_SHMIOP_Endpoint::set (const ACE_INET_Addr &addr,
+ int use_dotted_decimal_addresses)
+{
+ char tmp_host[MAXHOSTNAMELEN + 1];
+
+ if (use_dotted_decimal_addresses
+ || addr.get_host_name (tmp_host, sizeof (tmp_host)) != 0)
+ {
+ if (use_dotted_decimal_addresses == 0 && TAO_debug_level > 5)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - SHMIOP_Endpoint::set, ")
+ ACE_TEXT ("- %p cannot determine hostname\n")));
+ }
+
+ const char *tmp = addr.get_host_addr ();
+ if (tmp == 0)
+ {
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - ")
+ ACE_TEXT ("SHMIOP_Endpoint::set ")
+ ACE_TEXT ("- %p\n"),
+ ACE_TEXT ("cannot determine hostname")));
+ return -1;
+ }
+ else
+ this->host_ = tmp;
+ }
+ else
+ this->host_ = CORBA::string_dup (tmp_host);
+
+ this->port_ = addr.get_port_number();
+
+ return 0;
+}
+
+int
+TAO_SHMIOP_Endpoint::addr_to_string (char *buffer, size_t length)
+{
+ size_t actual_len =
+ ACE_OS::strlen (this->host_.in ()) // chars in host name
+ + sizeof (':') // delimiter
+ + ACE_OS::strlen ("65536") // max port
+ + sizeof ('\0');
+
+ if (length < actual_len)
+ return -1;
+
+ ACE_OS::sprintf (buffer, "%s:%d",
+ this->host_.in (), this->port_);
+
+ return 0;
+}
+
+const char *
+TAO_SHMIOP_Endpoint::host (const char *h)
+{
+ this->host_ = h;
+
+ return this->host_.in ();
+}
+
+TAO_Endpoint *
+TAO_SHMIOP_Endpoint::next (void)
+{
+ return this->next_;
+}
+
+TAO_Endpoint *
+TAO_SHMIOP_Endpoint::duplicate (void)
+{
+ TAO_SHMIOP_Endpoint *endpoint = 0;
+ ACE_NEW_RETURN (endpoint,
+ TAO_SHMIOP_Endpoint (this->host_.in (),
+ this->port_,
+ this->object_addr_,
+ this->priority ()),
+ 0);
+
+ return endpoint;
+}
+
+
+CORBA::Boolean
+TAO_SHMIOP_Endpoint::is_equivalent (const TAO_Endpoint *other_endpoint)
+{
+ const TAO_SHMIOP_Endpoint *endpoint = dynamic_cast <const TAO_SHMIOP_Endpoint *>
+ (other_endpoint);
+
+ if (endpoint == 0)
+ return 0;
+
+ return
+ this->port_ == endpoint->port_
+ && ACE_OS::strcmp (this->host_.in (), endpoint->host_.in ()) == 0;
+}
+
+CORBA::ULong
+TAO_SHMIOP_Endpoint::hash (void)
+{
+ if (this->hash_val_ != 0)
+ return this->hash_val_;
+
+ {
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
+ guard,
+ this->addr_lookup_lock_,
+ this->hash_val_);
+ // .. DCL
+ if (this->hash_val_ != 0)
+ return this->hash_val_;
+
+ this->hash_val_ =
+ ACE::hash_pjw (this->host ()) + this->port ();
+ }
+
+ return this->hash_val_;
+}
+
+const ACE_INET_Addr &
+TAO_SHMIOP_Endpoint::object_addr (void) const
+{
+ // The object_addr_ is initialized here, rather than at IOR decode
+ // time for several reasons:
+ // 1. A request on the object may never be invoked.
+ // 2. The DNS setup may have changed dynamically.
+ // ...etc..
+
+ // Double checked locking optimization.
+ if (!this->object_addr_set_)
+ {
+ // We need to modify the object_addr_ in this method. Do so
+ // using a non-const copy of the <this> pointer.
+ TAO_SHMIOP_Endpoint *endpoint =
+ const_cast <TAO_SHMIOP_Endpoint *>(this);
+
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
+ guard,
+ endpoint->addr_lookup_lock_,
+ this->object_addr_ );
+
+ if (!this->object_addr_set_)
+ {
+ if (endpoint->object_addr_.set (this->port_,
+ this->host_.in ()) == -1)
+ {
+ // If this call fails, it most likely due a hostname
+ // lookup failure caused by a DNS misconfiguration. If
+ // a request is made to the object at the given host and
+ // port, then a CORBA::TRANSIENT() exception should be
+ // thrown.
+
+ // Invalidate the ACE_INET_Addr. This is used as a flag
+ // to denote that ACE_INET_Addr initialization failed.
+ endpoint->object_addr_.set_type (-1);
+ }
+ else
+ {
+ endpoint->object_addr_set_ = 1;
+ }
+ }
+ }
+
+ return this->object_addr_;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_SHMIOP && TAO_HAS_SHMIOP != 0 */
diff --git a/TAO/tao/Strategies/SHMIOP_Endpoint.h b/TAO/tao/Strategies/SHMIOP_Endpoint.h
new file mode 100644
index 00000000000..e48e208443f
--- /dev/null
+++ b/TAO/tao/Strategies/SHMIOP_Endpoint.h
@@ -0,0 +1,148 @@
+// -*- C++ -*-
+
+//==========================================================================
+/**
+ * @file SHMIOP_Endpoint.h
+ *
+ * $Id$
+ *
+ * SHMIOP implementation of PP Framework Endpoint interface.
+ *
+ * @author Marina Spivak <marina@cs.wustl.edu>
+ */
+//==========================================================================
+
+#ifndef TAO_SHMIOP_ENDPOINT_H
+#define TAO_SHMIOP_ENDPOINT_H
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if defined (TAO_HAS_SHMIOP) && (TAO_HAS_SHMIOP != 0)
+
+#include "tao/CORBA_String.h"
+#include "tao/Endpoint.h"
+#include "tao/Strategies/strategies_export.h"
+
+#include "ace/INET_Addr.h"
+#include "ace/MEM_Addr.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_SHMIOP_Endpoint
+ *
+ * @brief TAO_SHMIOP_Endpoint
+ *
+ * SHMIOP-specific implementation of PP Framework Endpoint interface.
+ */
+class TAO_Strategies_Export TAO_SHMIOP_Endpoint : public TAO_Endpoint
+{
+public:
+
+ friend class TAO_SHMIOP_Profile;
+
+ // = Initialization and termination methods.
+
+ /// Default constructor.
+ TAO_SHMIOP_Endpoint (void);
+
+ /// Constructor. This is the most efficient constructor since it
+ /// does not require any address resolution processing.
+ TAO_SHMIOP_Endpoint (const char *host,
+ CORBA::UShort port,
+ const ACE_INET_Addr &addr,
+ CORBA::Short priority = TAO_INVALID_PRIORITY);
+
+ /// Constructor.
+ TAO_SHMIOP_Endpoint (const ACE_MEM_Addr &addr,
+ int use_dotted_decimal_addresses);
+
+ /// Constructor. -- More of a extension of the previous one. One of
+ /// them need to go. We will decide about that as time goes by.
+ TAO_SHMIOP_Endpoint (const ACE_INET_Addr &addr,
+ int use_dotted_decimal_addresses);
+
+ /// Constructor. This constructor is used when decoding endpoints.
+ TAO_SHMIOP_Endpoint (const char *host,
+ CORBA::UShort port,
+ CORBA::Short priority);
+
+ /// Destructor.
+ ~TAO_SHMIOP_Endpoint (void);
+
+ /**
+ * @name TAO_Endpoint Methods
+ *
+ * Please check the documentation in Endpoint.h for details.
+ */
+ //@{
+ /// Return a copy of @c this
+ virtual TAO_Endpoint *next (void);
+ virtual int addr_to_string (char *buffer, size_t length);
+ virtual TAO_Endpoint *duplicate (void);
+
+ /// Return true if this endpoint is equivalent to @a other_endpoint. Two
+ /// endpoints are equivalent iff their port and host are the same.
+ CORBA::Boolean is_equivalent (const TAO_Endpoint *other_endpoint);
+
+ /// Return a hash value for this object.
+ CORBA::ULong hash (void);
+ //@}
+
+ // = SHMIOP_Endpoint-specific methods.
+
+ /// Return a reference to the <object_addr>.
+ const ACE_INET_Addr &object_addr (void) const;
+
+ /// Return a pointer to the host string. This object maintains
+ /// ownership of this string.
+ const char *host (void) const;
+
+ /// Copy the string <h> into <host_> and return the resulting pointer.
+ /// This object maintains ownership of this string.
+ const char *host (const char *h);
+
+ /// Return the port number.
+ CORBA::UShort port (void) const;
+
+ /// Set the port number.
+ CORBA::UShort port (CORBA::UShort p);
+
+private:
+ /// Helper method for setting INET_Addr.
+ int set (const ACE_INET_Addr &addr,
+ int use_dotted_decimal_addresses);
+
+ /// String representing the host name.
+ CORBA::String_var host_;
+
+ /// TCP port number.
+ CORBA::UShort port_;
+
+ /// Cached instance of <ACE_INET_Addr> for use in making
+ /// invocations, etc.
+ ACE_INET_Addr object_addr_;
+
+ /// Flag to indicate if the address has been resolved and set.
+ int object_addr_set_;
+
+ /// SHMIOP Endpoints can be stringed into a list. Return the next
+ /// endpoint in the list, if any.
+ TAO_SHMIOP_Endpoint *next_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/Strategies/SHMIOP_Endpoint.i"
+#endif /* __ACE_INLINE__ */
+
+#endif /* TAO_HAS_SHMIOP && TAO_HAS_SHMIOP != 0 */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_IIOP_PROFILE_H */
diff --git a/TAO/tao/Strategies/SHMIOP_Endpoint.i b/TAO/tao/Strategies/SHMIOP_Endpoint.i
new file mode 100644
index 00000000000..e507b39c440
--- /dev/null
+++ b/TAO/tao/Strategies/SHMIOP_Endpoint.i
@@ -0,0 +1,25 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE const char *
+TAO_SHMIOP_Endpoint::host (void) const
+{
+ return this->host_.in ();
+}
+
+ACE_INLINE CORBA::UShort
+TAO_SHMIOP_Endpoint::port (void) const
+{
+ return this->port_;
+}
+
+ACE_INLINE CORBA::UShort
+TAO_SHMIOP_Endpoint::port (CORBA::UShort p)
+{
+ return this->port_ = p;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Strategies/SHMIOP_Factory.cpp b/TAO/tao/Strategies/SHMIOP_Factory.cpp
new file mode 100644
index 00000000000..27cca45b226
--- /dev/null
+++ b/TAO/tao/Strategies/SHMIOP_Factory.cpp
@@ -0,0 +1,133 @@
+#include "tao/Strategies/SHMIOP_Factory.h"
+
+#if defined (TAO_HAS_SHMIOP) && (TAO_HAS_SHMIOP != 0)
+
+#include "tao/Strategies/SHMIOP_Acceptor.h"
+#include "tao/Strategies/SHMIOP_Connector.h"
+
+#include "tao/ORB_Constants.h"
+
+#include "ace/Arg_Shifter.h"
+#include "ace/Argv_Type_Converter.h"
+#include "ace/OS_NS_strings.h"
+
+
+ACE_RCSID (Strategies,
+ SHMIOP_Factory,
+ "$Id$")
+
+
+static const char prefix_[] = "shmiop";
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_SHMIOP_Protocol_Factory::TAO_SHMIOP_Protocol_Factory (void)
+ : TAO_Protocol_Factory (TAO_TAG_SHMEM_PROFILE),
+ major_ (TAO_DEF_GIOP_MAJOR),
+ minor_ (TAO_DEF_GIOP_MINOR),
+ mmap_prefix_ (0),
+ min_bytes_ (10*1024) // @@ Nanbor, remove this magic number!!
+{
+}
+
+TAO_SHMIOP_Protocol_Factory::~TAO_SHMIOP_Protocol_Factory (void)
+{
+ delete [] this->mmap_prefix_;
+}
+
+int
+TAO_SHMIOP_Protocol_Factory::match_prefix (const ACE_CString &prefix)
+{
+ // Check for the proper prefix for this protocol.
+ return (ACE_OS::strcasecmp (prefix.c_str (), ::prefix_) == 0);
+}
+
+const char *
+TAO_SHMIOP_Protocol_Factory::prefix (void) const
+{
+ return ::prefix_;
+}
+
+char
+TAO_SHMIOP_Protocol_Factory::options_delimiter (void) const
+{
+ return '/';
+}
+
+TAO_Acceptor *
+TAO_SHMIOP_Protocol_Factory::make_acceptor (void)
+{
+ TAO_SHMIOP_Acceptor *acceptor = 0;
+
+ ACE_NEW_RETURN (acceptor,
+ TAO_SHMIOP_Acceptor,
+ 0);
+
+ acceptor->set_mmap_options (this->mmap_prefix_,
+ this->min_bytes_);
+
+ return acceptor;
+}
+
+int
+TAO_SHMIOP_Protocol_Factory::init (int argc,
+ ACE_TCHAR* argv[])
+{
+ // Copy command line parameter not to use original as well as type conversion.
+ ACE_Argv_Type_Converter command_line(argc, argv);
+
+ ACE_Arg_Shifter arg_shifter (command_line.get_argc(), command_line.get_TCHAR_argv());
+
+ while (arg_shifter.is_anything_left ())
+ {
+ const ACE_TCHAR *current_arg = 0;
+
+ if (0 != (current_arg = arg_shifter.get_the_parameter (ACE_TEXT("-MMAPFileSize"))))
+ {
+ this->min_bytes_ = ACE_OS::atoi (current_arg);
+ arg_shifter.consume_arg ();
+ }
+ else if (0 != (current_arg = arg_shifter.get_the_parameter (ACE_TEXT("-MMAPFilePrefix"))))
+ {
+ this->mmap_prefix_ = ACE::strnew (current_arg);
+ arg_shifter.consume_arg ();
+ }
+ else
+ // Any arguments that don't match are ignored so that the
+ // caller can still use them.
+ arg_shifter.ignore_arg ();
+ }
+
+ return 0;
+}
+
+TAO_Connector *
+TAO_SHMIOP_Protocol_Factory::make_connector (void)
+{
+ TAO_Connector *connector = 0;
+
+ ACE_NEW_RETURN (connector,
+ TAO_SHMIOP_Connector,
+ 0);
+ return connector;
+}
+
+int
+TAO_SHMIOP_Protocol_Factory::requires_explicit_endpoint (void) const
+{
+ return 1;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DEFINE (TAO_SHMIOP_Protocol_Factory,
+ ACE_TEXT ("SHMIOP_Factory"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (TAO_SHMIOP_Protocol_Factory),
+ ACE_Service_Type::DELETE_THIS |
+ ACE_Service_Type::DELETE_OBJ,
+ 0)
+
+ACE_FACTORY_DEFINE (TAO_Strategies, TAO_SHMIOP_Protocol_Factory)
+
+#endif /* TAO_HAS_SHMIOP && TAO_HAS_SHMIOP != 0 */
diff --git a/TAO/tao/Strategies/SHMIOP_Factory.h b/TAO/tao/Strategies/SHMIOP_Factory.h
new file mode 100644
index 00000000000..0b623455790
--- /dev/null
+++ b/TAO/tao/Strategies/SHMIOP_Factory.h
@@ -0,0 +1,99 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file SHMIOP_Factory.h
+ *
+ * $Id$
+ *
+ * @author Nanbor Wang <nanbor@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_SHMIOP_FACTORY_H
+#define TAO_SHMIOP_FACTORY_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if defined (TAO_HAS_SHMIOP) && (TAO_HAS_SHMIOP != 0)
+
+#include "tao/Protocol_Factory.h"
+#include "tao/Strategies/strategies_export.h"
+
+#include "ace/Service_Config.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Acceptor;
+class TAO_Connector;
+
+class TAO_Strategies_Export TAO_SHMIOP_Protocol_Factory
+ : public TAO_Protocol_Factory
+{
+public:
+ /// Constructor.
+ TAO_SHMIOP_Protocol_Factory (void);
+
+ /// Destructor.
+ virtual ~TAO_SHMIOP_Protocol_Factory (void);
+
+ // = Service Configurator hooks.
+ /// Dynamic linking hook
+ virtual int init (int argc, ACE_TCHAR* argv[]);
+
+ /// Verify prefix is a match
+ virtual int match_prefix (const ACE_CString &prefix);
+
+ /// Returns the prefix used by the protocol.
+ virtual const char *prefix (void) const;
+
+ /// Return the character used to mark where an endpoint ends and
+ /// where its options begin.
+ virtual char options_delimiter (void) const;
+
+ /**
+ * @name Protocol factory methods
+ *
+ * Check Protocol_Factory.h for a description of these methods.
+ */
+ //@{
+ virtual TAO_Acceptor *make_acceptor (void);
+ virtual TAO_Connector *make_connector (void);
+ virtual int requires_explicit_endpoint (void) const;
+ //@}
+
+ /// Set mmap file prefix
+ void mmap_file_prefix (const ACE_TCHAR *prefix);
+
+ /// Get mmap file prefix
+ const ACE_TCHAR *mmap_file_prefix (void);
+
+private:
+ int major_;
+ int minor_;
+ // Changing the version number can be used to provide backwards
+ // compatibility with old clients.
+
+ /// Specify the prefix (full path) for mmap files
+ ACE_TCHAR *mmap_prefix_;
+
+ /// Minimum bytes of the mmap files.
+ off_t min_bytes_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE (TAO_SHMIOP_Protocol_Factory)
+ACE_FACTORY_DECLARE (TAO_Strategies, TAO_SHMIOP_Protocol_Factory)
+
+#endif /* TAO_HAS_SHMIOP && TAO_HAS_SHMIOP != 0 */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_SHMIOP_FACTORY_H */
diff --git a/TAO/tao/Strategies/SHMIOP_Profile.cpp b/TAO/tao/Strategies/SHMIOP_Profile.cpp
new file mode 100644
index 00000000000..71a73c4dc7c
--- /dev/null
+++ b/TAO/tao/Strategies/SHMIOP_Profile.cpp
@@ -0,0 +1,516 @@
+#include "tao/Strategies/SHMIOP_Profile.h"
+
+#if defined (TAO_HAS_SHMIOP) && (TAO_HAS_SHMIOP != 0)
+
+#include "tao/CDR.h"
+#include "tao/Environment.h"
+#include "tao/ORB.h"
+#include "tao/ORB_Core.h"
+#include "tao/debug.h"
+#include "tao/IIOP_EndpointsC.h"
+
+#include "ace/OS_NS_stdio.h"
+#include "ace/OS_NS_string.h"
+
+ACE_RCSID (Strategies,
+ SHMIOP_Profile,
+ "$Id$")
+
+#include "ace/os_include/os_netdb.h"
+
+static const char prefix_[] = "shmiop";
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+const char TAO_SHMIOP_Profile::object_key_delimiter_ = '/';
+
+char
+TAO_SHMIOP_Profile::object_key_delimiter (void) const
+{
+ return TAO_SHMIOP_Profile::object_key_delimiter_;
+}
+
+TAO_SHMIOP_Profile::TAO_SHMIOP_Profile (const ACE_MEM_Addr &addr,
+ const TAO::ObjectKey &object_key,
+ const TAO_GIOP_Message_Version &version,
+ TAO_ORB_Core *orb_core)
+ : TAO_Profile (TAO_TAG_SHMEM_PROFILE,
+ orb_core,
+ object_key,
+ version),
+ endpoint_ (addr,
+ orb_core->orb_params ()->use_dotted_decimal_addresses ()),
+ count_ (1)
+{
+}
+
+TAO_SHMIOP_Profile::TAO_SHMIOP_Profile (const char* host,
+ CORBA::UShort port,
+ const TAO::ObjectKey &object_key,
+ const ACE_INET_Addr &addr,
+ const TAO_GIOP_Message_Version &version,
+ TAO_ORB_Core *orb_core)
+ : TAO_Profile (TAO_TAG_SHMEM_PROFILE,
+ orb_core,
+ object_key,
+ version),
+ endpoint_ (host, port, addr),
+ count_ (1)
+{
+}
+
+TAO_SHMIOP_Profile::TAO_SHMIOP_Profile (TAO_ORB_Core *orb_core)
+ : TAO_Profile (TAO_TAG_SHMEM_PROFILE,
+ orb_core,
+ TAO_GIOP_Message_Version (TAO_DEF_GIOP_MAJOR, TAO_DEF_GIOP_MINOR)),
+ endpoint_ (),
+ count_ (1)
+{
+}
+
+TAO_SHMIOP_Profile::~TAO_SHMIOP_Profile (void)
+{
+ // Clean up the list of endpoints since we own it.
+ // Skip the head, since it is not dynamically allocated.
+ TAO_Endpoint *tmp = 0;
+
+ for (TAO_Endpoint *next = this->endpoint ()->next ();
+ next != 0;
+ next = tmp)
+ {
+ tmp = next->next ();
+ delete next;
+ }
+}
+
+TAO_Endpoint*
+TAO_SHMIOP_Profile::endpoint (void)
+{
+ return &this->endpoint_;
+}
+
+CORBA::ULong
+TAO_SHMIOP_Profile::endpoint_count (void) const
+{
+ return this->count_;
+}
+
+// return codes:
+// -1 -> error
+// 0 -> can't understand this version
+// 1 -> success.
+int
+TAO_SHMIOP_Profile::decode_profile (TAO_InputCDR& cdr)
+{
+ // Decode host and port into the <endpoint_>.
+ if (cdr.read_string (this->endpoint_.host_.out ()) == 0
+ || cdr.read_ushort (this->endpoint_.port_) == 0)
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) SHMIOP_Profile::decode - ")
+ ACE_TEXT ("error while decoding host/port")));
+ }
+ return -1;
+ }
+
+ if (cdr.good_bit ())
+ {
+ // Invalidate the object_addr_ until first access.
+ this->endpoint_.object_addr_.set_type (-1);
+
+ return 1;
+ }
+
+ return -1;
+}
+
+void
+TAO_SHMIOP_Profile::parse_string_i (const char *string
+ ACE_ENV_ARG_DECL)
+{
+ // Pull off the "hostname:port/" part of the objref
+ // Copy the string because we are going to modify it...
+ CORBA::String_var copy (string);
+
+ char *start = copy.inout ();
+ char *cp = ACE_OS::strchr (start, ':'); // Look for a port
+
+ if (cp == 0)
+ {
+ // No host/port delimiter!
+ ACE_THROW (CORBA::INV_OBJREF (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ EINVAL),
+ CORBA::COMPLETED_NO));
+ }
+
+ char *okd = ACE_OS::strchr (start, this->object_key_delimiter_);
+
+ if (okd == 0)
+ {
+ // No object key delimiter!
+ ACE_THROW (CORBA::INV_OBJREF (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ EINVAL),
+ CORBA::COMPLETED_NO));
+ }
+
+ // Don't increment the pointer 'cp' directly since we still need
+ // to use it immediately after this block.
+
+ CORBA::ULong length = okd - (cp + 1);
+ // Don't allocate space for the colon ':'.
+
+ CORBA::String_var tmp = CORBA::string_alloc (length);
+
+ ACE_OS::strncpy (tmp.inout (), cp + 1, length);
+ tmp[length] = '\0';
+
+ if (ACE_OS::strspn (tmp.in (), "1234567890") == length)
+ {
+ this->endpoint_.port_ =
+ static_cast <CORBA::UShort> (ACE_OS::atoi (tmp.in ()));
+ }
+ else
+ {
+ ACE_INET_Addr ia;
+ if (ia.string_to_addr (tmp.in ()) == -1)
+ {
+ ACE_THROW (CORBA::INV_OBJREF (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ EINVAL),
+ CORBA::COMPLETED_NO));
+ }
+ else
+ {
+ this->endpoint_.port_ = ia.get_port_number ();
+ }
+ }
+
+ length = cp - start;
+
+ tmp = CORBA::string_alloc (length);
+
+ ACE_OS::strncpy (tmp.inout (), start, length);
+ tmp[length] = '\0';
+
+ this->endpoint_.host_ = tmp._retn ();
+
+ ACE_INET_Addr host_addr;
+
+ if (ACE_OS::strcmp (this->endpoint_.host_.in (), "") == 0)
+ {
+ char tmp_host [MAXHOSTNAMELEN + 1];
+
+ // If no host is specified: assign the default host : the local host.
+ if (host_addr.get_host_name (tmp_host,
+ sizeof (tmp_host)) != 0)
+ {
+ const char *tmp = host_addr.get_host_addr ();
+ if (tmp == 0)
+ {
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("\n\nTAO (%P|%t) ")
+ ACE_TEXT ("SHMIOP_Profile::parse_string ")
+ ACE_TEXT ("- %p\n\n"),
+ ACE_TEXT ("cannot determine hostname")));
+
+ // @@ What's the right exception to throw here?
+ ACE_THROW (CORBA::INV_OBJREF (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ EINVAL),
+ CORBA::COMPLETED_NO));
+ }
+ else
+ this->endpoint_.host_ = tmp;
+ }
+ else
+ {
+ this->endpoint_.host_ = (const char *) tmp_host;
+ }
+ }
+
+ if (this->endpoint_.object_addr_.set (this->endpoint_.port_,
+ this->endpoint_.host_.in ()) == -1)
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) SHMIOP_Profile::parse_string () - \n")
+ ACE_TEXT ("TAO (%P|%t) ACE_INET_Addr::set () failed")));
+ }
+
+ // @@ What's the right exception to throw here?
+ ACE_THROW (CORBA::INV_OBJREF (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ EINVAL),
+ CORBA::COMPLETED_NO));
+ }
+
+ start = ++okd; // increment past the object key separator
+
+ TAO::ObjectKey ok;
+ TAO::ObjectKey::decode_string_to_sequence (ok,
+ okd + 1);
+
+ (void) this->orb_core ()->object_key_table ().bind (ok,
+ this->ref_object_key_);
+}
+
+CORBA::Boolean
+TAO_SHMIOP_Profile::do_is_equivalent (const TAO_Profile *other_profile)
+{
+ const TAO_SHMIOP_Profile *op =
+ dynamic_cast <const TAO_SHMIOP_Profile *> (other_profile);
+
+ if (op == 0)
+ return 0;
+
+ // Check endpoints equivalence.
+ const TAO_SHMIOP_Endpoint *other_endp = &op->endpoint_;
+ for (TAO_SHMIOP_Endpoint *endp = &this->endpoint_;
+ endp != 0;
+ endp = endp->next_)
+ {
+ if (endp->is_equivalent (other_endp))
+ other_endp = other_endp->next_;
+ else
+ return 0;
+ }
+
+ return 1;
+}
+
+CORBA::ULong
+TAO_SHMIOP_Profile::hash (CORBA::ULong max
+ ACE_ENV_ARG_DECL_NOT_USED)
+{
+ // Get the hashvalue for all endpoints.
+ CORBA::ULong hashval = 0;
+ for (TAO_SHMIOP_Endpoint *endp = &this->endpoint_;
+ endp != 0;
+ endp = endp->next_)
+ {
+ hashval += endp->hash ();
+ }
+
+ hashval += this->version_.minor;
+ hashval += this->tag ();
+
+ const TAO::ObjectKey &ok =
+ this->ref_object_key_->object_key ();
+
+ if (ok.length () >= 4)
+ {
+ hashval += ok[1];
+ hashval += ok[3];
+ }
+
+ hashval += this->hash_service_i (max);
+
+ return hashval % max;
+}
+
+void
+TAO_SHMIOP_Profile::add_endpoint (TAO_SHMIOP_Endpoint *endp)
+{
+ endp->next_ = this->endpoint_.next_;
+ this->endpoint_.next_ = endp;
+
+ this->count_++;
+}
+
+char *
+TAO_SHMIOP_Profile::to_string (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+{
+ CORBA::String_var key;
+ TAO::ObjectKey::encode_sequence_to_string (key.inout(),
+ this->ref_object_key_->object_key ());
+
+ size_t buflen = (8 /* corbaloc */ +
+ 1 /* colon separator */ +
+ ACE_OS::strlen (::prefix_) +
+ 1 /* colon separator */ +
+ 1 /* major version */ +
+ 1 /* decimal point */ +
+ 1 /* minor version */ +
+ 1 /* `@' character */ +
+ ACE_OS::strlen (this->endpoint_.host ()) +
+ 1 /* colon separator */ +
+ 5 /* port number */ +
+ 1 /* object key separator */ +
+ ACE_OS::strlen (key.in ()));
+
+ char * buf = CORBA::string_alloc (static_cast <CORBA::ULong> (buflen));
+
+ static const char digits [] = "0123456789";
+
+ ACE_OS::sprintf (buf,
+ "corbaloc:%s:%c.%c@%s:%d%c%s",
+ ::prefix_,
+ digits [this->version_.major],
+ digits [this->version_.minor],
+ this->endpoint_.host (),
+ this->endpoint_.port (),
+ this->object_key_delimiter_,
+ key.in ());
+ return buf;
+}
+
+const char *
+TAO_SHMIOP_Profile::prefix (void)
+{
+ return ::prefix_;
+}
+
+void
+TAO_SHMIOP_Profile::create_profile_body (TAO_OutputCDR &encap) const
+{
+ encap.write_octet (TAO_ENCAP_BYTE_ORDER);
+
+ // The GIOP version
+ encap.write_octet (this->version_.major);
+ encap.write_octet (this->version_.minor);
+
+ // STRING hostname from profile
+ encap.write_string (this->endpoint_.host ());
+
+ // UNSIGNED SHORT port number
+ encap.write_ushort (this->endpoint_.port ());
+
+ // OCTET SEQUENCE for object key
+ if (this->ref_object_key_)
+ encap << this->ref_object_key_->object_key ();
+ else
+ {
+ ACE_ERROR ((LM_ERROR,
+ "(%P|%t) TAO - UIOP_Profile::create_profile_body "
+ "no object key marshalled \n"));
+ }
+
+ if (this->version_.major > 1
+ || this->version_.minor > 0)
+ this->tagged_components ().encode (encap);
+}
+
+int
+TAO_SHMIOP_Profile::encode_endpoints (void)
+{
+ // Create a data structure and fill it with endpoint info for wire
+ // transfer.
+ // We include information for the head of the list
+ // together with other endpoints because even though its addressing
+ // info is transmitted using standard ProfileBody components, its
+ // priority is not!
+ TAO::IIOPEndpointSequence endpoints;
+ endpoints.length (this->count_);
+
+ TAO_SHMIOP_Endpoint *endpoint = &this->endpoint_;
+ for (CORBA::ULong i = 0;
+ i < this->count_;
+ ++i)
+ {
+ endpoints[i].host = endpoint->host ();
+ endpoints[i].port = endpoint->port ();
+ endpoints[i].priority = endpoint->priority ();
+
+ endpoint = endpoint->next_;
+ }
+
+ // Encode the data structure.
+ TAO_OutputCDR out_cdr;
+ if ((out_cdr << ACE_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER)
+ == 0)
+ || (out_cdr << endpoints) == 0)
+ return -1;
+ size_t length = out_cdr.total_length ();
+
+ IOP::TaggedComponent tagged_component;
+ tagged_component.tag = TAO_TAG_ENDPOINTS;
+ tagged_component.component_data.length (static_cast <CORBA::ULong>(length));
+ CORBA::Octet *buf =
+ tagged_component.component_data.get_buffer ();
+
+ for (const ACE_Message_Block *iterator = out_cdr.begin ();
+ iterator != 0;
+ iterator = iterator->cont ())
+ {
+ size_t i_length = iterator->length ();
+ ACE_OS::memcpy (buf, iterator->rd_ptr (), i_length);
+
+ buf += i_length;
+ }
+
+ // Add component with encoded endpoint data to this profile's
+ // TaggedComponents.
+ tagged_components_.set_component (tagged_component);
+
+ return 0;
+}
+
+int
+TAO_SHMIOP_Profile::decode_endpoints (void)
+{
+ IOP::TaggedComponent tagged_component;
+ tagged_component.tag = TAO_TAG_ENDPOINTS;
+
+ if (this->tagged_components_.get_component (tagged_component))
+ {
+ const CORBA::Octet *buf =
+ tagged_component.component_data.get_buffer ();
+
+ TAO_InputCDR in_cdr (reinterpret_cast <const char*> (buf),
+ tagged_component.component_data.length ());
+
+ // Extract the Byte Order.
+ CORBA::Boolean byte_order;
+ if ((in_cdr >> ACE_InputCDR::to_boolean (byte_order)) == 0)
+ return -1;
+ in_cdr.reset_byte_order (static_cast<int> (byte_order));
+
+ // Extract endpoints sequence.
+ TAO::IIOPEndpointSequence endpoints;
+
+ if ((in_cdr >> endpoints) == 0)
+ return -1;
+
+ // Get the priority of the first endpoint (head of the list.
+ // It's other data is extracted as part of the standard profile
+ // decoding.
+ this->endpoint_.priority (endpoints[0].priority);
+
+ // Use information extracted from the tagged component to
+ // populate the profile. Skip the first endpoint, since it is
+ // always extracted through standard profile body. Also, begin
+ // from the end of the sequence to preserve endpoint order,
+ // since <add_endpoint> method reverses the order of endpoints
+ // in the list.
+ for (CORBA::ULong i = endpoints.length () - 1;
+ i > 0;
+ --i)
+ {
+ TAO_SHMIOP_Endpoint *endpoint = 0;
+ ACE_NEW_RETURN (endpoint,
+ TAO_SHMIOP_Endpoint (endpoints[i].host,
+ endpoints[i].port,
+ endpoints[i].priority),
+ -1);
+
+ this->add_endpoint (endpoint);
+ }
+ }
+
+ return 0;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_SHMIOP && TAO_HAS_SHMIOP != 0 */
diff --git a/TAO/tao/Strategies/SHMIOP_Profile.h b/TAO/tao/Strategies/SHMIOP_Profile.h
new file mode 100644
index 00000000000..d75215ed4a9
--- /dev/null
+++ b/TAO/tao/Strategies/SHMIOP_Profile.h
@@ -0,0 +1,131 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file SHMIOP_Profile.h
+ *
+ * $Id$
+ *
+ * SHMIOP profile specific processing
+ *
+ * @author Nanbor Wang <nanbor@cs.wustl.edu>
+ */
+//=============================================================================
+
+
+#ifndef TAO_SHMIOP_PROFILE_H
+#define TAO_SHMIOP_PROFILE_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if defined (TAO_HAS_SHMIOP) && (TAO_HAS_SHMIOP != 0)
+
+#include "tao/Strategies/strategies_export.h"
+#include "tao/Profile.h"
+#include "tao/Strategies/SHMIOP_Endpoint.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// TAO SHMIOP_Profile concrete Profile definitions
+/**
+ * @class TAO_SHMIOP_Profile
+ *
+ * @brief This class defines the protocol specific attributes required
+ * for locating local ORBs over local IPC mechanism to use the
+ * shared memory transport.
+ *
+ * This class defines the SHMIOP profile.
+ */
+class TAO_Strategies_Export TAO_SHMIOP_Profile : public TAO_Profile
+{
+public:
+ /// The object key delimiter that SHMIOP uses or expects.
+ static const char object_key_delimiter_;
+ virtual char object_key_delimiter (void) const;
+
+ /// Return the char string prefix.
+ static const char *prefix (void);
+
+ /// Profile constructor, same as above except the object_key has
+ /// already been marshaled.
+ TAO_SHMIOP_Profile (const ACE_MEM_Addr &addr,
+ const TAO::ObjectKey &object_key,
+ const TAO_GIOP_Message_Version &version,
+ TAO_ORB_Core *orb_core);
+
+ /// Profile constructor, this is the most efficient since it
+ /// doesn't require any address resolution processing.
+ TAO_SHMIOP_Profile (const char *host,
+ CORBA::UShort port,
+ const TAO::ObjectKey &object_key,
+ const ACE_INET_Addr &addr,
+ const TAO_GIOP_Message_Version &version,
+ TAO_ORB_Core *orb_core);
+
+ /// Profile constructor, default.
+ TAO_SHMIOP_Profile (TAO_ORB_Core *orb_core);
+
+ /// Destructor is to be called only through <_decr_refcnt>.
+ ~TAO_SHMIOP_Profile (void);
+
+
+ /// Template methods, please see Profile.h for documentation.
+ virtual char * to_string (ACE_ENV_SINGLE_ARG_DECL);
+ virtual int encode_endpoints (void);
+ virtual TAO_Endpoint *endpoint (void);
+ virtual CORBA::ULong endpoint_count (void) const;
+ virtual CORBA::ULong hash (CORBA::ULong max
+ ACE_ENV_ARG_DECL);
+ /**
+ * Add <endp> to this profile's list of endpoints (it is inserted
+ * next to the head of the list). This profiles takes ownership of
+ * <endp>.
+ */
+ void add_endpoint (TAO_SHMIOP_Endpoint *endp);
+
+protected:
+
+ /// Template methods. Please see tao/Profile.h for documentation.
+ virtual int decode_profile (TAO_InputCDR& cdr);
+ virtual void parse_string_i (const char *string
+ ACE_ENV_ARG_DECL);
+ virtual void create_profile_body (TAO_OutputCDR &cdr) const;
+ virtual int decode_endpoints (void);
+ virtual CORBA::Boolean do_is_equivalent (const TAO_Profile *other_profile);
+
+private:
+
+ /**
+ * Head of this profile's list of endpoints. This endpoint is not
+ * dynamically allocated because a profile always contains at least
+ * one endpoint.
+ *
+ * Currently, a profile contains more than one endpoint, i.e.,
+ * list contains more than just the head, only when RTCORBA is enabled.
+ * However, in the near future, this will be used in nonRT
+ * mode as well, e.g., to support TAG_ALTERNATE_IIOP_ADDRESS-style
+ * feature.
+ * Addressing info of the default endpoint, i.e., head of the list,
+ * is transmitted using standard SHMIOP ProfileBody components. See
+ * <encode_endpoints> method documentation above for how the rest of
+ * the endpoint list is transmitted.
+ */
+ TAO_SHMIOP_Endpoint endpoint_;
+
+ /// Number of endpoints in the list headed by <endpoint_>.
+ CORBA::ULong count_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_SHMIOP && TAO_HAS_SHMIOP != 0 */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_SHMIOP_PROFILE_H */
diff --git a/TAO/tao/Strategies/SHMIOP_Transport.cpp b/TAO/tao/Strategies/SHMIOP_Transport.cpp
new file mode 100644
index 00000000000..bb99b50d002
--- /dev/null
+++ b/TAO/tao/Strategies/SHMIOP_Transport.cpp
@@ -0,0 +1,372 @@
+// $Id$
+
+#include "tao/Strategies/SHMIOP_Transport.h"
+
+#if defined (TAO_HAS_SHMIOP) && (TAO_HAS_SHMIOP != 0)
+
+#include "tao/Strategies/SHMIOP_Connection_Handler.h"
+#include "tao/Strategies/SHMIOP_Profile.h"
+#include "tao/Timeprobe.h"
+#include "tao/CDR.h"
+#include "tao/Transport_Mux_Strategy.h"
+#include "tao/Wait_Strategy.h"
+#include "tao/Stub.h"
+#include "tao/ORB_Core.h"
+#include "tao/debug.h"
+#include "tao/Resume_Handle.h"
+#include "tao/GIOP_Message_Base.h"
+#include "tao/GIOP_Message_Lite.h"
+
+ACE_RCSID (Strategies, SHMIOP_Transport, "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_SHMIOP_Transport::TAO_SHMIOP_Transport (TAO_SHMIOP_Connection_Handler *handler,
+ TAO_ORB_Core *orb_core,
+ CORBA::Boolean flag)
+ : TAO_Transport (TAO_TAG_SHMEM_PROFILE,
+ orb_core),
+ connection_handler_ (handler),
+ messaging_object_ (0)
+{
+/*
+ * Hook to customize the messaging object when the concrete messaging
+ * object is known a priori. In this case, the flag is ignored.
+ */
+//@@ MESSAGING_SPL_COMMENT_HOOK_START
+ if (flag)
+ {
+ // Use the lite version of the protocol
+ ACE_NEW (this->messaging_object_,
+ TAO_GIOP_Message_Lite (orb_core));
+ }
+ else
+ {
+ // Use the normal GIOP object
+ ACE_NEW (this->messaging_object_,
+ TAO_GIOP_Message_Base (orb_core, this));
+ }
+//@@ MESSAGING_SPL_COMMENT_HOOK_END
+}
+
+TAO_SHMIOP_Transport::~TAO_SHMIOP_Transport (void)
+{
+ delete this->messaging_object_;
+}
+
+ACE_Event_Handler *
+TAO_SHMIOP_Transport::event_handler_i (void)
+{
+ return this->connection_handler_;
+}
+
+TAO_Connection_Handler *
+TAO_SHMIOP_Transport::connection_handler_i (void)
+{
+ return this->connection_handler_;
+}
+
+TAO_Pluggable_Messaging *
+TAO_SHMIOP_Transport::messaging_object (void)
+{
+ return this->messaging_object_;
+}
+
+
+ssize_t
+TAO_SHMIOP_Transport::send (iovec *iov, int iovcnt,
+ size_t &bytes_transferred,
+ const ACE_Time_Value *max_wait_time)
+{
+ bytes_transferred = 0;
+ for (int i = 0; i < iovcnt; ++i)
+ {
+ ssize_t retval =
+ this->connection_handler_->peer ().send (iov[i].iov_base,
+ iov[i].iov_len,
+ max_wait_time);
+ if (retval > 0)
+ bytes_transferred += retval;
+ if (retval <= 0)
+ return retval;
+ }
+ return bytes_transferred;
+}
+
+ssize_t
+TAO_SHMIOP_Transport::recv (char *buf,
+ size_t len,
+ const ACE_Time_Value *max_wait_time)
+{
+ ssize_t n = 0;
+
+ int read_break = 0;
+
+ while (!read_break)
+ {
+ n = this->connection_handler_->peer ().recv (buf,
+ len,
+ max_wait_time);
+
+ // If we get a EWOULBLOCK we try to read again.
+ if (n == -1 && (errno == EAGAIN || errno == EWOULDBLOCK))
+ {
+ n = 0;
+ continue;
+ }
+
+ // If there is anything else we just drop out of the loop.
+ read_break = 1;
+ }
+
+ if (n == -1)
+ {
+ if (TAO_debug_level > 3 && errno != ETIME)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - %p \n"),
+ ACE_TEXT ("TAO - read message failure ")
+ ACE_TEXT ("recv_i () \n")));
+ }
+ }
+ else if (n == 0)
+ {
+ n = -1;
+ }
+ return n;
+}
+
+int
+TAO_SHMIOP_Transport::handle_input (TAO_Resume_Handle &rh,
+ ACE_Time_Value *max_wait_time,
+ int)
+{
+ if (TAO_debug_level > 3)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - SHMIOP_Transport[%d]::handle_input\n",
+ this->id ()));
+ }
+
+ // The buffer on the stack which will be used to hold the input
+ // messages, compensate shrink due to alignment
+ char buf [TAO_MAXBUFSIZE + ACE_CDR::MAX_ALIGNMENT];
+
+
+#if defined (ACE_INITIALIZE_MEMORY_BEFORE_USE)
+ (void) ACE_OS::memset (buf,
+ '\0',
+ sizeof buf);
+#endif /* ACE_INITIALIZE_MEMORY_BEFORE_USE */
+
+ // Create a data block
+ ACE_Data_Block db (sizeof (buf),
+ ACE_Message_Block::MB_DATA,
+ buf,
+ this->orb_core_->input_cdr_buffer_allocator (),
+ this->orb_core_->locking_strategy (),
+ ACE_Message_Block::DONT_DELETE,
+ this->orb_core_->input_cdr_dblock_allocator ());
+
+ // Create a message block
+ ACE_Message_Block message_block (&db,
+ ACE_Message_Block::DONT_DELETE,
+ this->orb_core_->input_cdr_msgblock_allocator ());
+
+
+ // Align the message block
+ ACE_CDR::mb_align (&message_block);
+
+ const size_t missing_header_data = this->messaging_object ()->header_length ();
+
+ if (missing_header_data == 0)
+ {
+ return -1;
+ }
+
+ // .. do a read on the socket again.
+ ssize_t bytes = 0;
+
+ // As this used for transports where things are available in one
+ // shot this looping should not create any problems.
+ for (size_t m = missing_header_data;
+ m != 0;
+ m -= bytes)
+ {
+ bytes = 0; // reset
+
+ // We would have liked to use something like a recv_n ()
+ // here. But at the time when the code was written, the MEM_Stream
+ // classes had poor support for recv_n (). Till a day when we
+ // get proper recv_n (), let us stick with this. The other
+ // argument that can be said against this is that, this is the
+ // bad layer in which this is being done ie. recv_n is
+ // simulated. But...
+ bytes = this->recv (message_block.wr_ptr (),
+ m,
+ max_wait_time);
+
+ if (bytes == 0 ||
+ bytes == -1)
+ {
+ return -1;
+ }
+
+ message_block.wr_ptr (bytes);
+ }
+
+ TAO_Queued_Data qd (&message_block);
+ size_t mesg_length; // not used
+
+ // Parse the incoming message for validity. The check needs to be
+ // performed by the messaging objects.
+ if (this->messaging_object ()->parse_next_message (message_block,
+ qd,
+ mesg_length) == -1)
+ return -1;
+
+ if (qd.missing_data_ == TAO_MISSING_DATA_UNDEFINED)
+ {
+ // parse/marshal error happened
+ return -1;
+ }
+
+ if (message_block.length () > mesg_length)
+ {
+ // we read too much data
+ return -1;
+ }
+
+ if (message_block.space () < qd.missing_data_)
+ {
+ const size_t message_size = message_block.length ()
+ + qd.missing_data_;
+
+ // reallocate buffer with correct size on heap
+ if (ACE_CDR::grow (&message_block, message_size) == -1)
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "TAO (%P|%t) - SHMIOP_Transport[%d]::handle_input, "
+ "error growing message buffer\n",
+ this->id () ));
+ }
+ return -1;
+ }
+
+ }
+
+ // As this used for transports where things are available in one
+ // shot this looping should not create any problems.
+ for (size_t n = qd.missing_data_;
+ n != 0;
+ n -= bytes)
+ {
+ bytes = 0; // reset
+
+ // We would have liked to use something like a recv_n ()
+ // here. But at the time when the code was written, the MEM_Stream
+ // classes had poor support for recv_n (). Till a day when we
+ // get proper recv_n (), let us stick with this. The other
+ // argument that can be said against this is that, this is the
+ // bad layer in which this is being done ie. recv_n is
+ // simulated. But...
+ bytes = this->recv (message_block.wr_ptr (),
+ n,
+ max_wait_time);
+
+ if (bytes == 0 ||
+ bytes == -1)
+ {
+ return -1;
+ }
+
+ message_block.wr_ptr (bytes);
+
+ }
+
+ qd.missing_data_ = 0;
+
+ // Now we have a full message in our buffer. Just go ahead and
+ // process that
+ if (this->process_parsed_messages (&qd, rh) == -1)
+ {
+ return -1;
+ }
+
+ return 0;
+}
+
+
+
+int
+TAO_SHMIOP_Transport::send_request (TAO_Stub *stub,
+ TAO_ORB_Core *orb_core,
+ TAO_OutputCDR &stream,
+ int message_semantics,
+ ACE_Time_Value *max_wait_time)
+{
+ if (this->ws_->sending_request (orb_core,
+ message_semantics) == -1)
+ return -1;
+
+ if (this->send_message (stream,
+ stub,
+ message_semantics,
+ max_wait_time) == -1)
+
+ return -1;
+ this->first_request_sent();
+
+ return 0;
+}
+
+int
+TAO_SHMIOP_Transport::send_message (TAO_OutputCDR &stream,
+ TAO_Stub *stub,
+ int message_semantics,
+ ACE_Time_Value *max_wait_time)
+{
+ // Format the message in the stream first
+ if (this->messaging_object_->format_message (stream) != 0)
+ return -1;
+
+ // Strictly speaking, should not need to loop here because the
+ // socket never gets set to a nonblocking mode ... some Linux
+ // versions seem to need it though. Leaving it costs little.
+
+ // This guarantees to send all data (bytes) or return an error.
+ ssize_t n = this->send_message_shared (stub,
+ message_semantics,
+ stream.begin (),
+ max_wait_time);
+
+ if (n == -1)
+ {
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO: (%P|%t|%N|%l) closing transport %d after fault %p\n"),
+ this->id (),
+ ACE_TEXT ("send_message ()\n")));
+
+ return -1;
+ }
+
+ return 1;
+}
+
+
+int
+TAO_SHMIOP_Transport::messaging_init (CORBA::Octet major,
+ CORBA::Octet minor)
+{
+ this->messaging_object_->init (major,
+ minor);
+ return 1;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_SHMIOP && TAO_HAS_SHMIOP != 0 */
diff --git a/TAO/tao/Strategies/SHMIOP_Transport.h b/TAO/tao/Strategies/SHMIOP_Transport.h
new file mode 100644
index 00000000000..e44b79d4173
--- /dev/null
+++ b/TAO/tao/Strategies/SHMIOP_Transport.h
@@ -0,0 +1,125 @@
+// -*- C++ -*-
+
+// ===================================================================
+/**
+ * @file SHMIOP_Transport.h
+ *
+ * $Id$
+ *
+ * @author Nanbor Wang <nanbor@cs.wustl.edu>
+ * @author Balachandran Natarajan <bala@cs.wustl.edu>
+ */
+// ===================================================================
+
+#ifndef TAO_SHMIOP_TRANSPORT_H
+#define TAO_SHMIOP_TRANSPORT_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if defined (TAO_HAS_SHMIOP) && (TAO_HAS_SHMIOP != 0)
+
+#include "tao/Strategies/strategies_export.h"
+#include "ace/Svc_Handler.h"
+#include "ace/MEM_Stream.h"
+#include "tao/Transport.h"
+
+#if defined ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT
+template class TAO_Strategies_Export ACE_Svc_Handler<ACE_MEM_STREAM, ACE_NULL_SYNCH>;
+#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_SHMIOP_Connection_Handler;
+class TAO_Pluggable_Messaging;
+class TAO_Target_Specification;
+class Tao_Operation_Details;
+
+typedef ACE_Svc_Handler<ACE_MEM_STREAM, ACE_NULL_SYNCH>
+ TAO_SHMIOP_SVC_HANDLER;
+
+/**
+ * @class TAO_SHMIOP_Transport
+ *
+ * @brief Specialization of the base TAO_Transport class to handle the
+ * SHMIOP protocol.
+ *
+ */
+
+class TAO_Strategies_Export TAO_SHMIOP_Transport : public TAO_Transport
+{
+public:
+
+ /// Constructor.
+ TAO_SHMIOP_Transport (TAO_SHMIOP_Connection_Handler *handler,
+ TAO_ORB_Core *orb_core,
+ CORBA::Boolean flag);
+
+ /// Default destructor.
+ ~TAO_SHMIOP_Transport (void);
+
+protected:
+ /**
+ * @name Overridden Template Methods
+ *
+ * These are implementations of template methods declared by TAO_Transport.
+ */
+ //@{
+ virtual ACE_Event_Handler * event_handler_i (void);
+ virtual TAO_Connection_Handler *connection_handler_i (void);
+ virtual TAO_Pluggable_Messaging *messaging_object (void);
+
+ /// Write the complete Message_Block chain to the connection.
+ virtual ssize_t send (iovec *iov, int iovcnt,
+ size_t &bytes_transferred,
+ const ACE_Time_Value *timeout = 0);
+
+ /// Read len bytes from into buf.
+ virtual ssize_t recv (char *buf,
+ size_t len,
+ const ACE_Time_Value *s = 0);
+
+ virtual int handle_input (TAO_Resume_Handle &rh,
+ ACE_Time_Value *max_wait_time,
+ int block = 0);
+ //@}
+
+public:
+ /// @todo These methods IMHO should have more meaningful names.
+ /// The names seem to indicate nothing.
+ virtual int send_request (TAO_Stub *stub,
+ TAO_ORB_Core *orb_core,
+ TAO_OutputCDR &stream,
+ int message_semantics,
+ ACE_Time_Value *max_wait_time);
+
+ virtual int send_message (TAO_OutputCDR &stream,
+ TAO_Stub *stub = 0,
+ int message_semantics = TAO_Transport::TAO_TWOWAY_REQUEST,
+ ACE_Time_Value *max_time_wait = 0);
+
+ /// Initialising the messaging object
+ virtual int messaging_init (CORBA::Octet major,
+ CORBA::Octet minor);
+
+private:
+ /// The connection service handler used for accessing lower layer
+ /// communication protocols.
+ TAO_SHMIOP_Connection_Handler *connection_handler_;
+
+ /// Our messaging object.
+ TAO_Pluggable_Messaging *messaging_object_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_SHMIOP && TAO_HAS_SHMIOP != 0 */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_SHMIOP_TRANSPORT_H */
diff --git a/TAO/tao/Strategies/TAO_Strategies.pc.in b/TAO/tao/Strategies/TAO_Strategies.pc.in
new file mode 100644
index 00000000000..45392069502
--- /dev/null
+++ b/TAO/tao/Strategies/TAO_Strategies.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: TAO_Strategies
+Description: TAO Strategies Library
+Requires: TAO_AnyTypeCode, TAO
+Version: @VERSION@
+Libs: -L${libdir} -lTAO_Strategies
+Cflags: -I${includedir}
diff --git a/TAO/tao/Strategies/TAO_Strategies.rc b/TAO/tao/Strategies/TAO_Strategies.rc
new file mode 100644
index 00000000000..d0646d177f1
--- /dev/null
+++ b/TAO/tao/Strategies/TAO_Strategies.rc
@@ -0,0 +1,30 @@
+#include "..\Version.h"
+
+1 VERSIONINFO
+ FILEVERSION TAO_MAJOR_VERSION,TAO_MINOR_VERSION,TAO_BETA_VERSION,0
+ PRODUCTVERSION TAO_MAJOR_VERSION,TAO_MINOR_VERSION,TAO_BETA_VERSION,0
+ FILEFLAGSMASK 0x3fL
+ FILEFLAGS 0x0L
+ FILEOS 0x4L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904B0"
+ BEGIN
+ VALUE "FileDescription", "Strategies\0"
+ VALUE "FileVersion", TAO_VERSION "\0"
+ VALUE "InternalName", "TAO_StrategiesDLL\0"
+ VALUE "LegalCopyright", "\0"
+ VALUE "LegalTrademarks", "\0"
+ VALUE "OriginalFilename", "TAO_Strategies.DLL\0"
+ VALUE "ProductName", "TAO\0"
+ VALUE "ProductVersion", TAO_VERSION "\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
diff --git a/TAO/tao/Strategies/UIOP_Acceptor.cpp b/TAO/tao/Strategies/UIOP_Acceptor.cpp
new file mode 100644
index 00000000000..790094e03a1
--- /dev/null
+++ b/TAO/tao/Strategies/UIOP_Acceptor.cpp
@@ -0,0 +1,486 @@
+#include "tao/Strategies/UIOP_Acceptor.h"
+
+#if TAO_HAS_UIOP == 1
+
+#include "tao/Strategies/UIOP_Profile.h"
+#include "tao/MProfile.h"
+#include "tao/ORB_Core.h"
+#include "tao/Server_Strategy_Factory.h"
+#include "tao/debug.h"
+#include "tao/Protocols_Hooks.h"
+#include "tao/Codeset_Manager.h"
+#include "tao/CDR.h"
+
+#include "ace/OS_NS_stdio.h"
+#include "ace/OS_NS_string.h"
+#include "ace/OS_NS_unistd.h"
+
+ACE_RCSID (Strategies,
+ UIOP_Acceptor,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_UIOP_Acceptor::TAO_UIOP_Acceptor (CORBA::Boolean flag)
+ : TAO_Acceptor (TAO_TAG_UIOP_PROFILE),
+ base_acceptor_ (),
+ creation_strategy_ (0),
+ concurrency_strategy_ (0),
+ accept_strategy_ (0),
+ version_ (TAO_DEF_GIOP_MAJOR, TAO_DEF_GIOP_MINOR),
+ orb_core_ (0),
+ unlink_on_close_ (true),
+ lite_flag_ (flag)
+{
+}
+
+TAO_UIOP_Acceptor::~TAO_UIOP_Acceptor (void)
+{
+ // Make sure we are closed before we start destroying the
+ // strategies.
+ this->close ();
+
+ delete this->creation_strategy_;
+ delete this->concurrency_strategy_;
+ delete this->accept_strategy_;
+}
+
+int
+TAO_UIOP_Acceptor::create_profile (const TAO::ObjectKey &object_key,
+ TAO_MProfile &mprofile,
+ CORBA::Short priority)
+{
+ // Check if multiple endpoints should be put in one profile or
+ // if they should be spread across multiple profiles.
+ if (priority == TAO_INVALID_PRIORITY)
+ return this->create_new_profile (object_key,
+ mprofile,
+ priority);
+ else
+ return this->create_shared_profile (object_key,
+ mprofile,
+ priority);
+
+}
+
+int
+TAO_UIOP_Acceptor::create_new_profile (const TAO::ObjectKey &object_key,
+ TAO_MProfile &mprofile,
+ CORBA::Short priority)
+{
+ ACE_UNIX_Addr addr;
+
+ if (this->base_acceptor_.acceptor ().get_local_addr (addr) == -1)
+ return 0;
+
+ int count = mprofile.profile_count ();
+ if ((mprofile.size () - count) < 1
+ && mprofile.grow (count + 1) == -1)
+ return -1;
+
+ TAO_UIOP_Profile *pfile = 0;
+ ACE_NEW_RETURN (pfile,
+ TAO_UIOP_Profile (addr,
+ object_key,
+ this->version_,
+ this->orb_core_),
+ -1);
+ pfile->endpoint ()->priority (priority);
+
+ if (mprofile.give_profile (pfile) == -1)
+ {
+ pfile->_decr_refcnt ();
+ pfile = 0;
+ return -1;
+ }
+
+ // Do not add any tagged components to the profile if configured
+ // by the user not to do so, or if an UIOP 1.0 endpoint is being
+ // created (IIOP 1.0 did not support tagged components, so we follow
+ // the same convention for UIOP).
+ if (this->orb_core_->orb_params ()->std_profile_components () == 0
+ || (this->version_.major == 1 && this->version_.minor == 0))
+ return 0;
+
+ pfile->tagged_components ().set_orb_type (TAO_ORB_TYPE);
+ TAO_Codeset_Manager *csm = this->orb_core_->codeset_manager();
+ if (csm)
+ csm->set_codeset(pfile->tagged_components());
+ return 0;
+}
+
+int
+TAO_UIOP_Acceptor::create_shared_profile (const TAO::ObjectKey &object_key,
+ TAO_MProfile &mprofile,
+ CORBA::Short priority)
+{
+ TAO_Profile *pfile = 0;
+ TAO_UIOP_Profile *uiop_profile = 0;
+
+ // First see if <mprofile> already contains a UIOP profile.
+ for (TAO_PHandle i = 0; i != mprofile.profile_count (); ++i)
+ {
+ pfile = mprofile.get_profile (i);
+ if (pfile->tag () == TAO_TAG_UIOP_PROFILE)
+ {
+ uiop_profile = dynamic_cast<TAO_UIOP_Profile *> (pfile);
+ break;
+ }
+ }
+
+ if (uiop_profile == 0)
+ {
+ // If <mprofile> doesn't contain UIOP_Profile, we need to create
+ // one.
+ return create_new_profile (object_key,
+ mprofile,
+ priority);
+ }
+ else
+ {
+ // A UIOP_Profile already exists - just add our endpoint to it.
+ ACE_UNIX_Addr addr;
+
+ if (this->base_acceptor_.acceptor ().get_local_addr (addr) == -1)
+ return 0;
+
+ TAO_UIOP_Endpoint *endpoint = 0;
+ ACE_NEW_RETURN (endpoint,
+ TAO_UIOP_Endpoint (addr),
+ -1);
+ endpoint->priority (priority);
+ uiop_profile->add_endpoint (endpoint);
+
+ return 0;
+ }
+}
+
+int
+TAO_UIOP_Acceptor::is_collocated (const TAO_Endpoint *endpoint)
+{
+ const TAO_UIOP_Endpoint *endp =
+ dynamic_cast<const TAO_UIOP_Endpoint *> (endpoint);
+
+ // Make sure the dynamically cast pointer is valid.
+ if (endp == 0)
+ return 0;
+
+ // For UNIX Files this is relatively cheap.
+ ACE_UNIX_Addr address;
+ if (this->base_acceptor_.acceptor ().get_local_addr (address) == -1)
+ return 0;
+
+ return endp->object_addr () == address;
+}
+
+int
+TAO_UIOP_Acceptor::close (void)
+{
+ if (this->unlink_on_close_)
+ {
+ ACE_UNIX_Addr addr;
+
+ if (this->base_acceptor_.acceptor ().get_local_addr (addr) == 0)
+ (void) ACE_OS::unlink (addr.get_path_name ());
+
+ this->unlink_on_close_ = false;
+ }
+
+ return this->base_acceptor_.close ();
+}
+
+int
+TAO_UIOP_Acceptor::open (TAO_ORB_Core *orb_core,
+ ACE_Reactor *reactor,
+ int major,
+ int minor,
+ const char *address,
+ const char *options)
+{
+ this->orb_core_ = orb_core;
+
+ if (address == 0)
+ return -1;
+
+ if (major >= 0 && minor >= 0)
+ this->version_.set_version (static_cast<CORBA::Octet> (major),
+ static_cast<CORBA::Octet> (minor));
+ // Parse options
+ if (this->parse_options (options) == -1)
+ return -1;
+ else
+ return this->open_i (address,
+ reactor);
+}
+
+int
+TAO_UIOP_Acceptor::open_default (TAO_ORB_Core *orb_core,
+ ACE_Reactor *reactor,
+ int major,
+ int minor,
+ const char *options)
+{
+ this->orb_core_ = orb_core;
+
+ if (major >= 0 && minor >= 0)
+ this->version_.set_version (static_cast<CORBA::Octet> (major),
+ static_cast<CORBA::Octet> (minor));
+
+ // Parse options
+ if (this->parse_options (options) == -1)
+ return -1;
+
+ ACE_Auto_String_Free tempname (ACE_OS::tempnam (0, "TAO"));
+
+ if (tempname.get () == 0)
+ return -1;
+
+ return this->open_i (tempname.get (),
+ reactor);
+}
+
+int
+TAO_UIOP_Acceptor::open_i (const char *rendezvous,
+ ACE_Reactor *reactor)
+{
+ ACE_NEW_RETURN (this->creation_strategy_,
+ TAO_UIOP_CREATION_STRATEGY (this->orb_core_,
+ this->lite_flag_),
+ -1);
+
+ ACE_NEW_RETURN (this->concurrency_strategy_,
+ TAO_UIOP_CONCURRENCY_STRATEGY (this->orb_core_),
+ -1);
+
+ ACE_NEW_RETURN (this->accept_strategy_,
+ TAO_UIOP_ACCEPT_STRATEGY (this->orb_core_),
+ -1);
+
+ ACE_UNIX_Addr addr;
+
+ this->rendezvous_point (addr, rendezvous);
+
+ if (this->base_acceptor_.open (addr,
+ reactor,
+ this->creation_strategy_,
+ this->accept_strategy_,
+ this->concurrency_strategy_) == -1)
+ {
+ // Don't unlink an existing rendezvous point since it may be in
+ // use by another UIOP server/client.
+ if (errno == EADDRINUSE)
+ this->unlink_on_close_ = false;
+
+ return -1;
+ }
+
+ (void) this->base_acceptor_.acceptor().enable (ACE_CLOEXEC);
+ // This avoids having child processes acquire the listen socket thereby
+ // denying the server the opportunity to restart on a well-known endpoint.
+ // This does not affect the aberrent behavior on Win32 platforms.
+
+ // @@ If Profile creation is slow we may need to cache the
+ // rendezvous point here
+
+ if (TAO_debug_level > 5)
+ ACE_DEBUG ((LM_DEBUG,
+ "\nTAO (%P|%t) UIOP_Acceptor::open_i - "
+ "listening on: <%s>\n",
+ addr.get_path_name ()));
+ return 0;
+}
+
+void
+TAO_UIOP_Acceptor::rendezvous_point (ACE_UNIX_Addr &addr,
+ const char *rendezvous)
+{
+ // To guarantee portability, local IPC rendezvous points (including
+ // the path and filename) should not be longer than 99 characters
+ // long. Some platforms may support longer rendezvous points,
+ // usually 108 characters including the null terminator, but
+ // Posix.1g only requires that local IPC rendezvous point arrays
+ // contain a maximum of at least 100 characters, including the null
+ // terminator. If an endpoint is longer than what the platform
+ // supports then it will be truncated so that it fits, and a warning
+ // will be issued.
+
+ // Avoid using relative paths in your UIOP endpoints. If possible,
+ // use absolute paths instead. Imagine that the server is given an
+ // endpoint to create using -ORBEndpoint uiop://foobar. A local IPC
+ // rendezvous point called foobar will be created in the current
+ // working directory. If the client is not started in the directory
+ // where the foobar rendezvous point exists then the client will not
+ // be able to communicate with the server since its point of
+ // communication, the rendezvous point, was not found. On the other
+ // hand, if an absolute path was used, the client would know exactly
+ // where to find the rendezvous point. It is up to the user to make
+ // sure that a given UIOP endpoint is accessible by both the server
+ // and the client.
+
+ addr.set (rendezvous);
+
+ const size_t length = ACE_OS::strlen (addr.get_path_name ());
+
+ // Check if rendezvous point was truncated by ACE_UNIX_Addr since
+ // most UNIX domain socket rendezvous points can only be less than
+ // 108 characters long.
+ if (length < ACE_OS::strlen (rendezvous))
+ ACE_DEBUG ((LM_WARNING,
+ "TAO (%P|%t) UIOP rendezvous point was truncated to <%s>\n"
+ "since it was longer than %d characters long.\n",
+ addr.get_path_name (),
+ length));
+}
+
+CORBA::ULong
+TAO_UIOP_Acceptor::endpoint_count (void)
+{
+ return 1;
+}
+
+int
+TAO_UIOP_Acceptor::object_key (IOP::TaggedProfile &profile,
+ TAO::ObjectKey &object_key)
+{
+ // Create the decoding stream from the encapsulation in the buffer,
+#if (TAO_NO_COPY_OCTET_SEQUENCES == 1)
+ TAO_InputCDR cdr (profile.profile_data.mb ());
+#else
+ TAO_InputCDR cdr (reinterpret_cast<char*> (profile.profile_data.get_buffer ()),
+ profile.profile_data.length ());
+#endif /* TAO_NO_COPY_OCTET_SEQUENCES == 1 */
+
+ CORBA::Octet major, minor;
+
+ // Read the version. We just read it here. We don't *do any*
+ // processing.
+ if (!(cdr.read_octet (major) && cdr.read_octet (minor)))
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) IIOP_Profile::decode - v%d.%d\n"),
+ major,
+ minor));
+ }
+
+ return -1;
+ }
+
+ char * rendezvous = 0;
+
+ // Get rendezvous_point
+ if (cdr.read_string (rendezvous) == 0)
+ {
+ ACE_ERROR ((LM_ERROR, "error decoding UIOP rendezvous_point"));
+
+ return -1;
+ }
+
+ // delete the rendezvous point. We don't do any processing.
+ delete [] rendezvous;
+
+ // ... and object key.
+ if ((cdr >> object_key) == 0)
+ return -1;
+
+ return 1;
+}
+
+int
+TAO_UIOP_Acceptor::parse_options (const char *str)
+{
+ if (str == 0)
+ return 0; // No options to parse. Not a problem.
+
+ // Use an option format similar to the one used for CGI scripts in
+ // HTTP URLs.
+ // e.g.: option1=foo&option2=bar
+
+ ACE_CString options (str);
+
+ const size_t len = options.length ();
+
+ static const char option_delimiter = '&';
+
+ // Count the number of options.
+
+ CORBA::ULong option_count = 1;
+ // Number of endpoints in the string (initialized to 1).
+
+ // Only check for endpoints after the protocol specification and
+ // before the object key.
+ for (size_t i = 0; i < len; ++i)
+ if (options[i] == option_delimiter)
+ ++option_count;
+
+ // The idea behind the following loop is to split the options into
+ // (option, name) pairs.
+ // For example,
+ // `option1=foo&option2=bar'
+ // will be parsed into:
+ // `option1=foo'
+ // `option2=bar'
+
+ ACE_CString::size_type begin = 0;
+ ACE_CString::size_type end = 0;
+
+ for (CORBA::ULong j = 0; j < option_count; ++j)
+ {
+ if (j < option_count - 1)
+ end = options.find (option_delimiter, begin);
+ else
+ end = len;
+
+ if (end == begin)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "TAO (%P|%t) Zero length UIOP option.\n"),
+ -1);
+ else if (end != ACE_CString::npos)
+ {
+ ACE_CString opt =
+ options.substring (begin, end - begin);
+
+ ACE_CString::size_type const slot = opt.find ("=");
+
+ if (slot == len - 1
+ || slot == ACE_CString::npos)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "TAO (%P|%t) UIOP option <%s> is "
+ "missing a value.\n",
+ opt.c_str ()),
+ -1);
+
+ const ACE_CString name (opt.substring (0, slot));
+ ACE_CString value = opt.substring (slot + 1);
+
+ if (name.length () == 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "TAO (%P|%t) Zero length UIOP "
+ "option name.\n"),
+ -1);
+
+ if (name == "priority")
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) Invalid UIOP endpoint format: ")
+ ACE_TEXT ("endpoint priorities no longer supported. \n")),
+ -1);
+ }
+ else
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "TAO (%P|%t) Invalid UIOP option: <%s>\n",
+ name.c_str ()),
+ -1);
+
+ begin = end + 1;
+ }
+ else
+ break; // No other options.
+ }
+ return 0;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_UIOP == 1 */
diff --git a/TAO/tao/Strategies/UIOP_Acceptor.h b/TAO/tao/Strategies/UIOP_Acceptor.h
new file mode 100644
index 00000000000..be767003245
--- /dev/null
+++ b/TAO/tao/Strategies/UIOP_Acceptor.h
@@ -0,0 +1,146 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file UIOP_Acceptor.h
+ *
+ * $Id$
+ *
+ * Unix Domain Socket (UIOP) specific acceptor processing
+ *
+ * @author Fred Kuhns <fredk@cs.wustl.edu>
+ * @author Ossama Othman <ossama@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+
+#ifndef TAO_UIOP_ACCEPTOR_H
+#define TAO_UIOP_ACCEPTOR_H
+
+#include /**/ "ace/pre.h"
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+# if TAO_HAS_UIOP == 1
+#include "tao/Strategies/UIOP_Connection_Handler.h"
+
+#include "tao/Transport_Acceptor.h"
+#include "tao/Acceptor_Impl.h"
+#include "tao/GIOP_Message_Version.h"
+
+#include "ace/Acceptor.h"
+#include "ace/LSOCK_Acceptor.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_UIOP_Acceptor
+ *
+ * @brief The UIOP-specific bridge class for the concrete acceptor.
+ */
+class TAO_Strategies_Export TAO_UIOP_Acceptor : public TAO_Acceptor
+{
+public:
+ // TAO_UIOP_Acceptor (ACE_UNIX_Addr &addr);
+ // Create Acceptor object using addr.
+
+ /// Create Acceptor object using addr.
+ TAO_UIOP_Acceptor (CORBA::Boolean flag = false);
+
+ /// Destructor
+ virtual ~TAO_UIOP_Acceptor (void);
+
+ typedef ACE_Strategy_Acceptor<TAO_UIOP_Connection_Handler, ACE_LSOCK_ACCEPTOR> TAO_UIOP_BASE_ACCEPTOR;
+ typedef TAO_Creation_Strategy<TAO_UIOP_Connection_Handler> TAO_UIOP_CREATION_STRATEGY;
+ typedef TAO_Concurrency_Strategy<TAO_UIOP_Connection_Handler> TAO_UIOP_CONCURRENCY_STRATEGY;
+ typedef TAO_Accept_Strategy<TAO_UIOP_Connection_Handler, ACE_LSOCK_ACCEPTOR> TAO_UIOP_ACCEPT_STRATEGY;
+
+ /**
+ * @name The TAO_Acceptor Methods
+ *
+ * Please check the documentation in Transport_Acceptor.h for details.
+ */
+ //@{
+ virtual int open (TAO_ORB_Core *orb_core,
+ ACE_Reactor *reactor,
+ int version_major,
+ int version_minor,
+ const char *address,
+ const char *options = 0);
+ virtual int open_default (TAO_ORB_Core *orb_core,
+ ACE_Reactor *reactor,
+ int version_major,
+ int version_minor,
+ const char *options = 0);
+ virtual int close (void);
+ virtual int create_profile (const TAO::ObjectKey &object_key,
+ TAO_MProfile &mprofile,
+ CORBA::Short priority);
+
+ virtual int is_collocated (const TAO_Endpoint* endpoint);
+ virtual CORBA::ULong endpoint_count (void);
+
+ virtual int object_key (IOP::TaggedProfile &profile,
+ TAO::ObjectKey &key);
+ //@}
+
+private:
+ /// Implement the common part of the open*() methods
+ int open_i (const char *rendezvous,
+ ACE_Reactor *reactor);
+
+ /// Set the rendezvous point and verify that it is
+ /// valid (e.g. wasn't truncated because it was too long).
+ void rendezvous_point (ACE_UNIX_Addr &, const char *rendezvous);
+
+ /// Parse protocol specific options.
+ int parse_options (const char *options);
+
+ /// Obtains uiop properties that must be used by this acceptor, i.e.,
+ /// initializes <uiop_properties_>.
+ int init_uiop_properties (void);
+
+ /// Create a UIOP profile representing this acceptor.
+ int create_new_profile (const TAO::ObjectKey &object_key,
+ TAO_MProfile &mprofile,
+ CORBA::Short priority);
+
+ /// Add the endpoints on this acceptor to a shared profile.
+ int create_shared_profile (const TAO::ObjectKey &object_key,
+ TAO_MProfile &mprofile,
+ CORBA::Short priority);
+
+private:
+ /// The concrete acceptor, as a pointer to its base class.
+ TAO_UIOP_BASE_ACCEPTOR base_acceptor_;
+
+ // Acceptor strategies.
+ TAO_UIOP_CREATION_STRATEGY *creation_strategy_;
+ TAO_UIOP_CONCURRENCY_STRATEGY *concurrency_strategy_;
+ TAO_UIOP_ACCEPT_STRATEGY *accept_strategy_;
+
+ /// The GIOP version for this endpoint
+ TAO_GIOP_Message_Version version_;
+
+ /// ORB Core.
+ TAO_ORB_Core *orb_core_;
+
+ /// Flag that determines whether or not the rendezvous point should
+ /// be unlinked on close. This is really only used when an error
+ /// occurs.
+ bool unlink_on_close_;
+
+ /// Should we use GIOP lite??
+ const bool lite_flag_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+# endif /* TAO_HAS_UIOP == 1 */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_UIOP_ACCEPTOR_H */
diff --git a/TAO/tao/Strategies/UIOP_Connection_Handler.cpp b/TAO/tao/Strategies/UIOP_Connection_Handler.cpp
new file mode 100644
index 00000000000..ada81ab9075
--- /dev/null
+++ b/TAO/tao/Strategies/UIOP_Connection_Handler.cpp
@@ -0,0 +1,234 @@
+// $Id$
+
+#include "tao/Strategies/UIOP_Connection_Handler.h"
+
+#if TAO_HAS_UIOP == 1
+
+#include "tao/Strategies/UIOP_Transport.h"
+#include "tao/Strategies/UIOP_Endpoint.h"
+#include "tao/debug.h"
+#include "tao/ORB_Core.h"
+#include "tao/ORB.h"
+#include "tao/CDR.h"
+#include "tao/Timeprobe.h"
+#include "tao/Server_Strategy_Factory.h"
+#include "tao/Base_Transport_Property.h"
+#include "tao/GIOP_Message_Lite.h"
+#include "tao/Transport_Cache_Manager.h"
+#include "tao/Resume_Handle.h"
+#include "tao/Thread_Lane_Resources.h"
+#include "tao/Protocols_Hooks.h"
+
+ACE_RCSID (Strategies,
+ UIOP_Connection_Handler,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_UIOP_Connection_Handler::TAO_UIOP_Connection_Handler (ACE_Thread_Manager *t)
+ : TAO_UIOP_SVC_HANDLER (t, 0 , 0),
+ TAO_Connection_Handler (0)
+{
+ // This constructor should *never* get called, it is just here to
+ // make the compiler happy: the default implementation of the
+ // Creation_Strategy requires a constructor with that signature, we
+ // don't use that implementation, but some (most?) compilers
+ // instantiate it anyway.
+ ACE_ASSERT (0);
+}
+
+
+TAO_UIOP_Connection_Handler::TAO_UIOP_Connection_Handler (
+ TAO_ORB_Core *orb_core,
+ CORBA::Boolean flag)
+ : TAO_UIOP_SVC_HANDLER (orb_core->thr_mgr (), 0, 0),
+ TAO_Connection_Handler (orb_core)
+{
+ TAO_UIOP_Transport* specific_transport = 0;
+ ACE_NEW (specific_transport,
+ TAO_UIOP_Transport (this, orb_core, flag));
+
+ // store this pointer (indirectly increment ref count)
+ this->transport (specific_transport);
+}
+
+
+TAO_UIOP_Connection_Handler::~TAO_UIOP_Connection_Handler (void)
+{
+ delete this->transport ();
+}
+
+int
+TAO_UIOP_Connection_Handler::open_handler (void *v)
+{
+ return this->open (v);
+}
+
+int
+TAO_UIOP_Connection_Handler::open (void*)
+{
+ TAO_UIOP_Protocol_Properties protocol_properties;
+
+ // Initialize values from ORB params.
+ protocol_properties.send_buffer_size_ =
+ this->orb_core ()->orb_params ()->sock_sndbuf_size ();
+ protocol_properties.recv_buffer_size_ =
+ this->orb_core ()->orb_params ()->sock_rcvbuf_size ();
+
+ TAO_Protocols_Hooks *tph =
+ this->orb_core ()->get_protocols_hooks ();
+
+ bool client =
+ this->transport ()->opened_as () == TAO::TAO_CLIENT_ROLE;;
+
+ ACE_DECLARE_NEW_CORBA_ENV;
+
+ ACE_TRY
+ {
+ if (client)
+ {
+ tph->client_protocol_properties_at_orb_level (
+ protocol_properties
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ else
+ {
+ tph->server_protocol_properties_at_orb_level (
+ protocol_properties
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ }
+ ACE_CATCHANY
+ {
+ return -1;
+ }
+ ACE_ENDTRY;
+ ACE_CHECK_RETURN (-1);
+
+ if (this->set_socket_option (this->peer (),
+ protocol_properties.send_buffer_size_,
+ protocol_properties.recv_buffer_size_) == -1)
+ return -1;
+
+ if (this->transport ()->wait_strategy ()->non_blocking ())
+ {
+ if (this->peer ().enable (ACE_NONBLOCK) == -1)
+ return -1;
+ }
+
+ // Called by the <Strategy_Acceptor> when the handler is completely
+ // connected.
+ ACE_UNIX_Addr addr;
+
+ if (this->peer ().get_remote_addr (addr) == -1)
+ return -1;
+
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) UIOP connection to server ")
+ ACE_TEXT ("<%s> on %d\n"),
+ addr.get_path_name (), this->peer ().get_handle ()));
+
+ // Set that the transport is now connected, if fails we return -1
+ // Use C-style cast b/c otherwise we get warnings on lots of
+ // compilers
+ if (!this->transport ()->post_open ((size_t) this->get_handle ()))
+ return -1;
+
+ this->state_changed (TAO_LF_Event::LFS_SUCCESS,
+ this->orb_core ()->leader_follower ());
+
+ return 0;
+}
+
+int
+TAO_UIOP_Connection_Handler::resume_handler (void)
+{
+ return ACE_Event_Handler::ACE_APPLICATION_RESUMES_HANDLER;
+}
+
+int
+TAO_UIOP_Connection_Handler::close_connection (void)
+{
+ return this->close_connection_eh (this);
+}
+
+int
+TAO_UIOP_Connection_Handler::handle_input (ACE_HANDLE h)
+{
+ return this->handle_input_eh (h, this);
+}
+
+int
+TAO_UIOP_Connection_Handler::handle_output (ACE_HANDLE handle)
+{
+ const int result =
+ this->handle_output_eh (handle, this);
+
+ if (result == -1)
+ {
+ this->close_connection ();
+ return 0;
+ }
+
+ return result;
+}
+
+int
+TAO_UIOP_Connection_Handler::handle_timeout (const ACE_Time_Value &,
+ const void *)
+{
+ // We don't use this upcall for I/O. This is only used by the
+ // Connector to indicate that the connection timedout. Therefore,
+ // we should call close().
+ return this->close ();
+}
+
+int
+TAO_UIOP_Connection_Handler::handle_close (ACE_HANDLE,
+ ACE_Reactor_Mask)
+{
+ ACE_ASSERT (0);
+ return 0;
+}
+
+int
+TAO_UIOP_Connection_Handler::close (u_long)
+{
+ return this->close_handler ();
+}
+
+int
+TAO_UIOP_Connection_Handler::release_os_resources (void)
+{
+ return this->peer().close ();
+}
+
+int
+TAO_UIOP_Connection_Handler::add_transport_to_cache (void)
+{
+ ACE_UNIX_Addr addr;
+
+ // Get the peername.
+ if (this->peer ().get_remote_addr (addr) == -1)
+ return -1;
+
+ // Construct an UIOP_Endpoint object
+ TAO_UIOP_Endpoint endpoint (addr);
+
+ // Construct a property object
+ TAO_Base_Transport_Property prop (&endpoint);
+
+ TAO::Transport_Cache_Manager &cache =
+ this->orb_core ()->lane_resources ().transport_cache ();
+
+ // Add the handler to Cache
+ return cache.cache_idle_transport (&prop,
+ this->transport ());
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /*TAO_HAS_UIOP == 1*/
diff --git a/TAO/tao/Strategies/UIOP_Connection_Handler.h b/TAO/tao/Strategies/UIOP_Connection_Handler.h
new file mode 100644
index 00000000000..107706a82b6
--- /dev/null
+++ b/TAO/tao/Strategies/UIOP_Connection_Handler.h
@@ -0,0 +1,106 @@
+// -*- C++ -*-
+
+// ===================================================================
+/**
+ * @file UIOP_Connection_Handler.h
+ *
+ * $Id$
+ *
+ * @author Originally by Ossama Othman <ossama@ece.uci.edu> as
+ * UIOP_Connect.h
+ * @author modified by Balachandran Natarajan <bala@cs.wustl.edu>
+ */
+// ===================================================================
+#ifndef TAO_UIOP_CONNECTION_HANDLER_H
+#define TAO_UIOP_CONNECTION_HANDLER_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+#pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if TAO_HAS_UIOP == 1
+
+#include "tao/Strategies/UIOP_Transport.h"
+#include "tao/Connection_Handler.h"
+#include "tao/Wait_Strategy.h"
+#include "ace/Acceptor.h"
+#include "ace/Reactor.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Forward Decls
+class TAO_Pluggable_Messaging;
+
+// ****************************************************************
+
+/**
+ * @class TAO_UIOP_Connection_Handler
+ *
+ * @brief Handles requests on a single connection.
+ *
+ * The Connection handler which is common for the Acceptor and
+ * the Connector
+ */
+class TAO_Strategies_Export TAO_UIOP_Connection_Handler : public TAO_UIOP_SVC_HANDLER,
+ public TAO_Connection_Handler
+{
+
+public:
+
+ TAO_UIOP_Connection_Handler (ACE_Thread_Manager* t = 0);
+
+ /// Constructor.
+ TAO_UIOP_Connection_Handler (TAO_ORB_Core *orb_core,
+ CORBA::Boolean flag);
+
+ /// Destructor.
+ ~TAO_UIOP_Connection_Handler (void);
+
+ //@{
+ /**
+ * Connection_Handler overloads
+ */
+ virtual int open_handler (void *);
+ //@}
+
+ /// Close called by the Acceptor or Connector when connection
+ /// establishment fails.
+ int close (u_long = 0);
+
+ //@{
+ /** @name Event Handler overloads
+ */
+ virtual int open (void *);
+ virtual int resume_handler (void);
+ virtual int close_connection (void);
+ virtual int handle_input (ACE_HANDLE);
+ virtual int handle_output (ACE_HANDLE);
+ virtual int handle_close (ACE_HANDLE, ACE_Reactor_Mask);
+ virtual int handle_timeout (const ACE_Time_Value &current_time,
+ const void *act = 0);
+ //@}
+
+ /// Add ourselves to Cache.
+ int add_transport_to_cache (void);
+
+protected:
+
+ //@{
+ /**
+ * @name TAO_Connection Handler overloads
+ */
+ virtual int release_os_resources (void);
+ //@}
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_UIOP == 1 */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_UIOP_CONNECT_H */
diff --git a/TAO/tao/Strategies/UIOP_Connector.cpp b/TAO/tao/Strategies/UIOP_Connector.cpp
new file mode 100644
index 00000000000..efce00f17d2
--- /dev/null
+++ b/TAO/tao/Strategies/UIOP_Connector.cpp
@@ -0,0 +1,411 @@
+#include "tao/Strategies/UIOP_Connector.h"
+
+#if TAO_HAS_UIOP == 1
+
+#include "tao/Strategies/UIOP_Profile.h"
+#include "tao/debug.h"
+#include "tao/ORB_Core.h"
+#include "tao/Environment.h"
+#include "tao/Protocols_Hooks.h"
+#include "tao/Base_Transport_Property.h"
+#include "tao/Transport_Cache_Manager.h"
+#include "tao/Thread_Lane_Resources.h"
+#include "tao/Connect_Strategy.h"
+#include "tao/Profile_Transport_Resolver.h"
+
+#include "ace/OS_NS_strings.h"
+#include "ace/OS_NS_string.h"
+
+
+ACE_RCSID(Strategies,
+ UIOP_Connector,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_UIOP_Connector::TAO_UIOP_Connector (CORBA::Boolean flag)
+ : TAO_Connector (TAO_TAG_UIOP_PROFILE),
+ connect_strategy_ (),
+ base_connector_ (),
+ lite_flag_ (flag)
+{
+}
+
+TAO_UIOP_Connector::~TAO_UIOP_Connector (void)
+{
+}
+
+int
+TAO_UIOP_Connector::open (TAO_ORB_Core *orb_core)
+{
+ this->orb_core (orb_core);
+
+ // Create our connect strategy
+ if (this->create_connect_strategy () == -1)
+ return -1;
+
+ // Our connect creation strategy
+ TAO_UIOP_CONNECT_CREATION_STRATEGY *connect_creation_strategy = 0;
+
+ ACE_NEW_RETURN (connect_creation_strategy,
+ TAO_UIOP_CONNECT_CREATION_STRATEGY
+ (orb_core->thr_mgr (),
+ orb_core,
+ this->lite_flag_),
+ -1);
+
+ /// Our activation strategy
+ TAO_UIOP_CONNECT_CONCURRENCY_STRATEGY *concurrency_strategy = 0;
+
+ ACE_NEW_RETURN (concurrency_strategy,
+ TAO_UIOP_CONNECT_CONCURRENCY_STRATEGY (orb_core),
+ -1);
+
+ return this->base_connector_.open (this->orb_core ()->reactor (),
+ connect_creation_strategy,
+ &this->connect_strategy_,
+ concurrency_strategy);
+}
+
+int
+TAO_UIOP_Connector::close (void)
+{
+ // Zap the creation strategy that we created earlier.
+ delete this->base_connector_.creation_strategy ();
+ delete this->base_connector_.concurrency_strategy ();
+
+ return this->base_connector_.close ();
+}
+
+TAO_Profile *
+TAO_UIOP_Connector::corbaloc_scan (const char *str, size_t &len
+ ACE_ENV_ARG_DECL)
+{
+ if (this->check_prefix (str) != 0)
+ return 0;
+
+ const char *separator = ACE_OS::strchr (str,'|');
+ if (separator == 0)
+ {
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG,
+ "(%P|%t) TAO_UIOP_CONNECTOR::corbaloc_scan error: "
+ "explicit terminating charactor '|' is missing from <%s>",
+ str));
+ return 0;
+ }
+ if (*(separator+1) != ',' && *(separator+1) != '/')
+ {
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG,
+ "(%P|%t) TAO_UIOP_CONNECTOR::corbaloc_scan warning: "
+ "terminating charactor '|' should be followed by a ','"
+ "or a '/' in <%s>",
+ str));
+ }
+ len = (separator - str) + 1;
+ return this->make_profile (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+
+int
+TAO_UIOP_Connector::set_validate_endpoint (TAO_Endpoint *endpoint)
+{
+ TAO_UIOP_Endpoint *uiop_endpoint = this->remote_endpoint (endpoint);
+
+ if (uiop_endpoint == 0)
+ return -1;
+
+ const ACE_UNIX_Addr &remote_address = uiop_endpoint->object_addr ();
+
+ // @@ Note, POSIX.1g renames AF_UNIX to AF_LOCAL.
+ // Verify that the remote ACE_UNIX_Addr was initialized properly.
+ // Failure can occur if hostname lookup failed when initializing the
+ // remote ACE_INET_Addr.
+ if (remote_address.get_type () != AF_UNIX)
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) UIOP failure.\n")
+ ACE_TEXT ("TAO (%P|%t) This is most likely ")
+ ACE_TEXT ("due to a hostname lookup ")
+ ACE_TEXT ("failure.\n")));
+ }
+
+ return -1;
+ }
+
+ return 0;
+}
+
+TAO_Transport *
+TAO_UIOP_Connector::make_connection (TAO::Profile_Transport_Resolver *r,
+ TAO_Transport_Descriptor_Interface &desc,
+ ACE_Time_Value *max_wait_time)
+{
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) UIUP_Connector::make_connection, ")
+ ACE_TEXT ("looking for UIOP connection.\n")));
+
+ TAO_UIOP_Endpoint *uiop_endpoint =
+ this->remote_endpoint (desc.endpoint ());
+
+ if (uiop_endpoint == 0)
+ return 0;
+
+ const ACE_UNIX_Addr &remote_address =
+ uiop_endpoint->object_addr ();
+
+ if (TAO_debug_level > 2)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) UIUP_Connector::make_connection, ")
+ ACE_TEXT ("making a new connection \n")));
+
+ // Get the right synch options
+ ACE_Synch_Options synch_options;
+
+ this->active_connect_strategy_->synch_options (max_wait_time,
+ synch_options);
+
+ // If we don't need to block for a transport just set the timeout to
+ // be zero.
+ ACE_Time_Value tmp_zero (ACE_Time_Value::zero);
+ if (!r->blocked_connect ())
+ {
+ synch_options.timeout (ACE_Time_Value::zero);
+ max_wait_time = &tmp_zero;
+ }
+
+ TAO_UIOP_Connection_Handler *svc_handler = 0;
+
+ // Connect.
+ int result =
+ this->base_connector_.connect (svc_handler,
+ remote_address,
+ synch_options);
+
+ // This call creates the service handler and bumps the #REFCOUNT# up
+ // one extra. There are three possibilities: (a) connection
+ // succeeds immediately - in this case, the #REFCOUNT# on the
+ // handler is two; (b) connection completion is pending - in this
+ // case, the #REFCOUNT# on the handler is also two; (c) connection
+ // fails immediately - in this case, the #REFCOUNT# on the handler
+ // is one since close() gets called on the handler.
+ //
+ // The extra reference count in
+ // TAO_Connect_Creation_Strategy::make_svc_handler() is needed in
+ // the case when connection completion is pending and we are going
+ // to wait on a variable in the handler to changes, signifying
+ // success or failure. Note, that this increment cannot be done
+ // once the connect() returns since this might be too late if
+ // another thread pick up the completion and potentially deletes the
+ // handler before we get a chance to increment the reference count.
+
+ // Make sure that we always do a remove_reference
+ ACE_Event_Handler_var svc_handler_auto_ptr (svc_handler);
+
+ TAO_Transport *transport =
+ svc_handler->transport ();
+
+ if (result == -1)
+ {
+ // No immediate result, wait for completion
+ if (errno == EWOULDBLOCK)
+ {
+ // Try to wait until connection completion. Incase we block, then we
+ // get a connected transport or not. In case of non block we get
+ // a connected or not connected transport
+ if (!this->wait_for_connection_completion (r,
+ transport,
+ max_wait_time))
+ {
+ if (TAO_debug_level > 2)
+ ACE_ERROR ((LM_ERROR, "TAO (%P|%t) - UIOP_Connector::"
+ "make_connection, "
+ "wait for completion failed\n"));
+ }
+ }
+ else
+ {
+ // Transport is not usable
+ transport = 0;
+ }
+ }
+
+ // In case of errors transport is zero
+ if (transport == 0)
+ {
+ // Give users a clue to the problem.
+ if (TAO_debug_level > 3)
+ ACE_DEBUG ((LM_ERROR,
+ "TAO (%P|%t) - UIOP_Connector::make_connection, "
+ "connection to <%s> failed (%p)\n",
+ uiop_endpoint->rendezvous_point (),
+ ACE_TEXT("errno")));
+
+ return 0;
+ }
+
+
+ // At this point, the connection has be successfully created
+ // connected or not connected, but we have a connection.
+ if (TAO_debug_level > 2)
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - UIOP_Connector::make_connection, "
+ "new %s connection to <%s> on Transport[%d]\n",
+ transport->is_connected() ? "connected" : "not connected",
+ uiop_endpoint->rendezvous_point (),
+ svc_handler->peer ().get_handle ()));
+
+ // Add the handler to Cache
+ int retval =
+ this->orb_core ()->lane_resources ().transport_cache ().cache_transport (&desc,
+ transport);
+ // Failure in adding to cache.
+ if (retval != 0)
+ {
+ // Close the handler.
+ svc_handler->close ();
+
+ if (TAO_debug_level > 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) UIOP_Connector::make_connection, ")
+ ACE_TEXT ("could not add the new connection to Cache \n")));
+ }
+
+ return 0;
+ }
+
+ if (transport->is_connected () &&
+ transport->wait_strategy ()->register_handler () != 0)
+ {
+ // Registration failures.
+
+ // Purge from the connection cache, if we are not in the cache, this
+ // just does nothing.
+ (void) transport->purge_entry ();
+
+ // Close the handler.
+ (void) transport->close_connection ();
+
+ if (TAO_debug_level > 0)
+ ACE_ERROR ((LM_ERROR,
+ "TAO (%P|%t) - UIOP_Connector [%d]::make_connection, "
+ "could not register the transport "
+ "in the reactor.\n",
+ transport->id ()));
+
+ return 0;
+ }
+
+ return transport;
+}
+
+
+TAO_Profile *
+TAO_UIOP_Connector::create_profile (TAO_InputCDR& cdr)
+{
+ TAO_Profile *pfile;
+ ACE_NEW_RETURN (pfile,
+ TAO_UIOP_Profile (this->orb_core ()),
+ 0);
+
+ const int r = pfile->decode (cdr);
+ if (r == -1)
+ {
+ pfile->_decr_refcnt ();
+ pfile = 0;
+ }
+
+ return pfile;
+}
+
+TAO_Profile *
+TAO_UIOP_Connector::make_profile (ACE_ENV_SINGLE_ARG_DECL)
+{
+ TAO_Profile *profile = 0;
+ ACE_NEW_THROW_EX (profile,
+ TAO_UIOP_Profile (this->orb_core ()),
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+
+ ACE_CHECK_RETURN (0);
+
+ return profile;
+}
+
+int
+TAO_UIOP_Connector::check_prefix (const char *endpoint)
+{
+ // Check for a valid string
+ if (!endpoint || !*endpoint)
+ return -1; // Failure
+
+ static const char *protocol[] = { "uiop", "uioploc" };
+
+ const size_t slot = ACE_OS::strchr (endpoint, ':') - endpoint;
+
+ const size_t len0 = ACE_OS::strlen (protocol[0]);
+ const size_t len1 = ACE_OS::strlen (protocol[1]);
+
+ // Check for the proper prefix in the IOR. If the proper prefix
+ // isn't in the IOR then it is not an IOR we can use.
+ if (slot == len0
+ && ACE_OS::strncasecmp (endpoint,
+ protocol[0],
+ len0) == 0)
+ return 0;
+ else if (slot == len1
+ && ACE_OS::strncasecmp (endpoint,
+ protocol[1],
+ len1) == 0)
+ return 0;
+
+ return -1;
+ // Failure: not an UIOP IOR DO NOT throw an exception here.
+}
+
+char
+TAO_UIOP_Connector::object_key_delimiter (void) const
+{
+ return TAO_UIOP_Profile::object_key_delimiter_;
+}
+
+TAO_UIOP_Endpoint *
+TAO_UIOP_Connector::remote_endpoint (TAO_Endpoint *endpoint)
+{
+ if (endpoint->tag () != TAO_TAG_UIOP_PROFILE)
+ return 0;
+
+ TAO_UIOP_Endpoint *uiop_endpoint =
+ dynamic_cast<TAO_UIOP_Endpoint *> (endpoint);
+
+ if (uiop_endpoint == 0)
+ return 0;
+
+ return uiop_endpoint;
+}
+
+int
+TAO_UIOP_Connector::cancel_svc_handler (
+ TAO_Connection_Handler * svc_handler)
+{
+ TAO_UIOP_Connection_Handler* handler=
+ dynamic_cast<TAO_UIOP_Connection_Handler*> (svc_handler);
+
+ if (handler)
+ // Cancel from the connector
+ return this->base_connector_.cancel (handler);
+
+ return -1;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_UIOP == 1 */
diff --git a/TAO/tao/Strategies/UIOP_Connector.h b/TAO/tao/Strategies/UIOP_Connector.h
new file mode 100644
index 00000000000..e575b6b27d4
--- /dev/null
+++ b/TAO/tao/Strategies/UIOP_Connector.h
@@ -0,0 +1,142 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file UIOP_Connector.h
+ *
+ * $Id$
+ *
+ * UIOP specific connector processing
+ *
+ *
+ * @author Fred Kuhns <fredk@cs.wustl.edu>
+ * @author Ossama Othman <ossama@uci.edu>
+ */
+//=============================================================================
+
+
+#ifndef TAO_UIOP_CONNECTOR_H
+#define TAO_UIOP_CONNECTOR_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+# if TAO_HAS_UIOP == 1
+
+#include "ace/LSOCK_Connector.h"
+#include "ace/Connector.h"
+#include "tao/Transport_Connector.h"
+#include "tao/Strategies/UIOP_Connection_Handler.h"
+#include "tao/Resource_Factory.h"
+#include "tao/Connector_Impl.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_UIOP_Endpoint;
+class TAO_Endpoint;
+
+/**
+ * @class TAO_UIOP_Connector
+ *
+ * @brief UIOP-specific Connector bridge for pluggable protocols.
+ *
+ */
+class TAO_Strategies_Export TAO_UIOP_Connector : public TAO_Connector
+{
+public:
+
+ /**
+ * Constructor.
+ * @@ Do we want to pass in the tag here or should it be statically
+ * defined?
+ */
+ TAO_UIOP_Connector (CORBA::Boolean flag = false);
+
+ /// Destructor
+ ~TAO_UIOP_Connector (void);
+
+ /**
+ * @name The TAO_Connector Methods
+ *
+ * Please check the documentation in Transport_Connector.h for details.
+ */
+ //@{
+ int open (TAO_ORB_Core *orb_core);
+ int close (void);
+
+ TAO_Profile *create_profile (TAO_InputCDR& cdr);
+
+ virtual int check_prefix (const char *endpoint);
+
+ virtual TAO_Profile *corbaloc_scan (const char *str, size_t &len
+ ACE_ENV_ARG_DECL);
+
+ virtual char object_key_delimiter (void) const;
+
+ /// Cancel the passed cvs handler from the connector
+ virtual int cancel_svc_handler (TAO_Connection_Handler * svc_handler);
+ //@}
+
+public:
+
+ typedef TAO_Connect_Concurrency_Strategy<TAO_UIOP_Connection_Handler>
+ TAO_UIOP_CONNECT_CONCURRENCY_STRATEGY;
+
+ typedef TAO_Connect_Creation_Strategy<TAO_UIOP_Connection_Handler>
+ TAO_UIOP_CONNECT_CREATION_STRATEGY;
+
+ typedef ACE_Connect_Strategy<TAO_UIOP_Connection_Handler,
+ ACE_LSOCK_CONNECTOR>
+ TAO_UIOP_CONNECT_STRATEGY ;
+
+ typedef ACE_Strategy_Connector<TAO_UIOP_Connection_Handler,
+ ACE_LSOCK_CONNECTOR>
+ TAO_UIOP_BASE_CONNECTOR;
+
+protected:
+
+ /**
+ * @name More TAO_Connector methods
+ *
+ * Please check the documentation in Transport_Connector.h.
+ */
+ //@{
+ int set_validate_endpoint (TAO_Endpoint *endpoint);
+
+ TAO_Transport *make_connection (TAO::Profile_Transport_Resolver *r,
+ TAO_Transport_Descriptor_Interface &desc,
+ ACE_Time_Value *timeout = 0);
+
+ virtual TAO_Profile *make_profile (ACE_ENV_SINGLE_ARG_DECL);
+
+ //@}
+
+private:
+
+ /// Return the remote endpoint, a helper function
+ TAO_UIOP_Endpoint *remote_endpoint (TAO_Endpoint *ep);
+
+private:
+
+ /// Our connect strategy
+ TAO_UIOP_CONNECT_STRATEGY connect_strategy_;
+
+ /// The connector initiating connection requests for UIOP.
+ TAO_UIOP_BASE_CONNECTOR base_connector_;
+
+ /// Do we need to use a GIOP_Lite for sending messages?
+ const bool lite_flag_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+# endif /* TAO_HAS_UIOP == 1 */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_UIOP_CONNECTOR_H */
diff --git a/TAO/tao/Strategies/UIOP_Endpoint.cpp b/TAO/tao/Strategies/UIOP_Endpoint.cpp
new file mode 100644
index 00000000000..f0ff4199582
--- /dev/null
+++ b/TAO/tao/Strategies/UIOP_Endpoint.cpp
@@ -0,0 +1,109 @@
+#include "tao/Strategies/UIOP_Endpoint.h"
+#include "tao/Strategies/UIOP_Connection_Handler.h"
+
+#include "tao/ORB_Constants.h"
+
+#include "ace/OS_NS_string.h"
+
+
+#if TAO_HAS_UIOP == 1
+
+
+ACE_RCSID (Strategies,
+ UIOP_Endpoint,
+ "$Id$")
+
+
+#if !defined (__ACE_INLINE__)
+# include "tao/Strategies/UIOP_Endpoint.i"
+#endif /* __ACE_INLINE__ */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_UIOP_Endpoint::TAO_UIOP_Endpoint (const ACE_UNIX_Addr &addr,
+ CORBA::Short priority)
+ : TAO_Endpoint (TAO_TAG_UIOP_PROFILE, priority)
+ , object_addr_ (addr)
+ , next_ (0)
+{
+}
+
+TAO_UIOP_Endpoint::TAO_UIOP_Endpoint (void)
+ : TAO_Endpoint (TAO_TAG_UIOP_PROFILE)
+ , object_addr_ ()
+ , next_ (0)
+{
+}
+
+TAO_UIOP_Endpoint::~TAO_UIOP_Endpoint (void)
+{
+}
+
+int
+TAO_UIOP_Endpoint::addr_to_string (char *buffer, size_t length)
+{
+ if (length < (ACE_OS::strlen (this->rendezvous_point ()) + 1))
+ return -1;
+
+ ACE_OS::strcpy (buffer, this->rendezvous_point ());
+
+ return 0;
+}
+
+TAO_Endpoint *
+TAO_UIOP_Endpoint::next (void)
+{
+ return this->next_;
+}
+
+TAO_Endpoint *
+TAO_UIOP_Endpoint::duplicate (void)
+{
+ TAO_UIOP_Endpoint *endpoint = 0;
+ ACE_NEW_RETURN (endpoint,
+ TAO_UIOP_Endpoint (this->object_addr_,
+ this->priority ()),
+ 0);
+
+ return endpoint;
+}
+
+CORBA::Boolean
+TAO_UIOP_Endpoint::is_equivalent (const TAO_Endpoint *other_endpoint)
+{
+ TAO_Endpoint *endpt = const_cast<TAO_Endpoint *> (other_endpoint);
+
+ TAO_UIOP_Endpoint *endpoint = dynamic_cast<TAO_UIOP_Endpoint *> (endpt);
+
+ if (endpoint == 0)
+ return 0;
+
+ return ACE_OS::strcmp (this->rendezvous_point (),
+ endpoint->rendezvous_point ()) == 0;
+}
+
+CORBA::ULong
+TAO_UIOP_Endpoint::hash (void)
+{
+ if (this->hash_val_ != 0)
+ return this->hash_val_;
+
+ {
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
+ guard,
+ this->addr_lookup_lock_,
+ this->hash_val_);
+ // .. DCL
+ if (this->hash_val_ != 0)
+ return this->hash_val_;
+
+ this->hash_val_ =
+ ACE::hash_pjw (this->rendezvous_point ());
+ }
+
+ return this->hash_val_;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_UIOP == 1 */
diff --git a/TAO/tao/Strategies/UIOP_Endpoint.h b/TAO/tao/Strategies/UIOP_Endpoint.h
new file mode 100644
index 00000000000..00af4e66e50
--- /dev/null
+++ b/TAO/tao/Strategies/UIOP_Endpoint.h
@@ -0,0 +1,105 @@
+// -*- C++ -*-
+
+//==========================================================================
+/**
+ * @file UIOP_Endpoint.h
+ *
+ * $Id$
+ *
+ * UIOP implementation of PP Framework Endpoint interface.
+ *
+ * @author Marina Spivak <marina@cs.wustl.edu>
+ */
+//==========================================================================
+
+#ifndef TAO_UIOP_ENDPOINT_H
+#define TAO_UIOP_ENDPOINT_H
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+# if TAO_HAS_UIOP == 1
+
+#include "tao/Strategies/strategies_export.h"
+#include "tao/Endpoint.h"
+#include "ace/UNIX_Addr.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_UIOP_Endpoint
+ *
+ * @brief TAO_UIOP_Endpoint
+ *
+ * UIOP-specific implementation of PP Framework Endpoint interface.
+ */
+class TAO_Strategies_Export TAO_UIOP_Endpoint : public TAO_Endpoint
+{
+public:
+
+ friend class TAO_UIOP_Profile;
+
+ // = Initialization and termination methods.
+
+ /// Default constructor.
+ TAO_UIOP_Endpoint (void);
+
+ /// Constructor.
+ TAO_UIOP_Endpoint (const ACE_UNIX_Addr &addr,
+ CORBA::Short priority = TAO_INVALID_PRIORITY);
+
+ /// Destructor.
+ ~TAO_UIOP_Endpoint (void);
+
+ /**
+ * @name TAO_Endpoint Methods
+ *
+ * Please check the documentation in Endpoint.h for details.
+ */
+ //@{
+ virtual TAO_Endpoint *next (void);
+ virtual int addr_to_string (char *buffer, size_t length);
+ virtual TAO_Endpoint *duplicate (void);
+
+ /// Return true if this endpoint is equivalent to <other_endpoint>. Two
+ /// endpoints are equivalent iff their rendezvous points are the same.
+ CORBA::Boolean is_equivalent (const TAO_Endpoint *other_endpoint);
+
+ /// Return a hash value for this object.
+ virtual CORBA::ULong hash (void);
+ //@}
+
+ // = UIOP_Endpoint-specific methods.
+
+ /// Return a reference to the <object_addr>.
+ const ACE_UNIX_Addr &object_addr (void) const;
+
+ /// Return a pointer to the rendezvous point string.
+ /// This object maintains ownership of the returned string.
+ const char *rendezvous_point (void) const;
+
+private:
+
+ /// Cached instance of <ACE_UNIX_Addr> for use in making
+ /// invocations, etc.
+ ACE_UNIX_Addr object_addr_;
+
+ /// UIOP Endpoints can be stringed into a list. Return the next
+ /// endpoint in the list, if any.
+ TAO_UIOP_Endpoint *next_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/Strategies/UIOP_Endpoint.i"
+#endif /* __ACE_INLINE__ */
+
+# endif /* TAO_HAS_UIOP == 1 */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_UIOP_ENDPOINT_H */
diff --git a/TAO/tao/Strategies/UIOP_Endpoint.i b/TAO/tao/Strategies/UIOP_Endpoint.i
new file mode 100644
index 00000000000..a7a01b59c3d
--- /dev/null
+++ b/TAO/tao/Strategies/UIOP_Endpoint.i
@@ -0,0 +1,23 @@
+// -*- C++ -*-
+//
+// $Id$
+
+# if TAO_HAS_UIOP == 1
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE const ACE_UNIX_Addr &
+TAO_UIOP_Endpoint::object_addr (void) const
+{
+ return this->object_addr_;
+}
+
+ACE_INLINE const char *
+TAO_UIOP_Endpoint::rendezvous_point (void) const
+{
+ return this->object_addr_.get_path_name ();
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_UIOP == 1 */
diff --git a/TAO/tao/Strategies/UIOP_Factory.cpp b/TAO/tao/Strategies/UIOP_Factory.cpp
new file mode 100644
index 00000000000..b74a464f82c
--- /dev/null
+++ b/TAO/tao/Strategies/UIOP_Factory.cpp
@@ -0,0 +1,105 @@
+// -*- C++ -*-
+// $Id$
+
+#include "tao/Strategies/UIOP_Factory.h"
+
+#if TAO_HAS_UIOP == 1
+
+#include "tao/Strategies/UIOP_Acceptor.h"
+#include "tao/Strategies/UIOP_Connector.h"
+
+#include "tao/ORB_Constants.h"
+
+#include "ace/OS_NS_strings.h"
+
+
+ACE_RCSID (Strategies,
+ UIOP_Factory,
+ "$Id$")
+
+
+static const char prefix_[] = "uiop";
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_UIOP_Protocol_Factory::TAO_UIOP_Protocol_Factory (void)
+ : TAO_Protocol_Factory (TAO_TAG_UIOP_PROFILE),
+ major_ (TAO_DEF_GIOP_MAJOR),
+ minor_ (TAO_DEF_GIOP_MINOR)
+{
+}
+
+TAO_UIOP_Protocol_Factory::~TAO_UIOP_Protocol_Factory (void)
+{
+}
+
+int
+TAO_UIOP_Protocol_Factory::match_prefix (const ACE_CString &prefix)
+{
+ // Check for the proper prefix for this protocol.
+ return (ACE_OS::strcasecmp (prefix.c_str (), ::prefix_) == 0);
+}
+
+const char *
+TAO_UIOP_Protocol_Factory::prefix (void) const
+{
+ return ::prefix_;
+}
+
+char
+TAO_UIOP_Protocol_Factory::options_delimiter (void) const
+{
+ return '|';
+}
+
+TAO_Acceptor *
+TAO_UIOP_Protocol_Factory::make_acceptor (void)
+{
+ TAO_Acceptor *acceptor = 0;
+
+ ACE_NEW_RETURN (acceptor,
+ TAO_UIOP_Acceptor,
+ 0);
+
+ return acceptor;
+}
+
+int
+TAO_UIOP_Protocol_Factory::init (int /* argc */,
+ ACE_TCHAR* /* argv */ [])
+{
+ return 0;
+}
+
+TAO_Connector *
+TAO_UIOP_Protocol_Factory::make_connector (void)
+{
+ TAO_Connector *connector = 0;
+
+ ACE_NEW_RETURN (connector,
+ TAO_UIOP_Connector,
+ 0);
+
+ return connector;
+}
+
+int
+TAO_UIOP_Protocol_Factory::requires_explicit_endpoint (void) const
+{
+ return 1;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DEFINE (TAO_UIOP_Protocol_Factory,
+ ACE_TEXT ("UIOP_Factory"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (TAO_UIOP_Protocol_Factory),
+ ACE_Service_Type::DELETE_THIS |
+ ACE_Service_Type::DELETE_OBJ,
+ 0)
+
+ACE_FACTORY_DEFINE (TAO_Strategies, TAO_UIOP_Protocol_Factory)
+
+
+#endif /* TAO_HAS_UIOP == 1 */
diff --git a/TAO/tao/Strategies/UIOP_Factory.h b/TAO/tao/Strategies/UIOP_Factory.h
new file mode 100644
index 00000000000..d3ec7616987
--- /dev/null
+++ b/TAO/tao/Strategies/UIOP_Factory.h
@@ -0,0 +1,90 @@
+// -*- C++ -*-
+
+// $Id$
+// ============================================================================
+//
+// = LIBRARY
+// TAO
+//
+// = FILENAME
+// UIOP_Factory.h
+//
+// = AUTHOR
+// Fred Kuhns <fredk@cs.wustl.edu>
+// Ossama Othman <othman@cs.wustl.edu>
+//
+// ============================================================================
+
+#ifndef TAO_UIOP_FACTORY_H
+#define TAO_UIOP_FACTORY_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+# if TAO_HAS_UIOP == 1
+
+#include "tao/Protocol_Factory.h"
+#include "tao/Strategies/strategies_export.h"
+#include "ace/Service_Config.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Acceptor;
+class TAO_Connector;
+
+class TAO_Strategies_Export TAO_UIOP_Protocol_Factory : public TAO_Protocol_Factory
+{
+public:
+ /// Constructor.
+ TAO_UIOP_Protocol_Factory (void);
+
+ /// Destructor.
+ virtual ~TAO_UIOP_Protocol_Factory (void);
+
+ // = Service Configurator hooks.
+ /// Dynamic linking hook
+ virtual int init (int argc, ACE_TCHAR* argv[]);
+
+ /// Verify prefix is a match
+ virtual int match_prefix (const ACE_CString &prefix);
+
+ /// Returns the prefix used by the protocol.
+ virtual const char *prefix (void) const;
+
+ /// Return the character used to mark where an endpoint ends and
+ /// where its options begin.
+ virtual char options_delimiter (void) const;
+
+ /**
+ * @name Protocol factory methods
+ *
+ * Check Protocol_Factory.h for a description of these methods.
+ */
+ //@{
+ virtual TAO_Acceptor *make_acceptor (void);
+ virtual TAO_Connector *make_connector (void);
+ virtual int requires_explicit_endpoint (void) const;
+ //@}
+
+private:
+ int major_;
+ int minor_;
+ // Changing the version number can be used to provide backwards
+ // compatibility with old clients.
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE (TAO_UIOP_Protocol_Factory)
+ACE_FACTORY_DECLARE (TAO_Strategies, TAO_UIOP_Protocol_Factory)
+
+# endif /* TAO_HAS_UIOP == 1 */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_UIOP_FACTORY_H */
diff --git a/TAO/tao/Strategies/UIOP_Lite_Factory.cpp b/TAO/tao/Strategies/UIOP_Lite_Factory.cpp
new file mode 100644
index 00000000000..8aa707a3472
--- /dev/null
+++ b/TAO/tao/Strategies/UIOP_Lite_Factory.cpp
@@ -0,0 +1,107 @@
+#include "tao/Strategies/UIOP_Lite_Factory.h"
+
+#if TAO_HAS_UIOP == 1
+
+#include "tao/Strategies/UIOP_Acceptor.h"
+#include "tao/Strategies/UIOP_Connector.h"
+
+#include "tao/ORB_Constants.h"
+
+#include "ace/Dynamic_Service.h"
+#include "ace/OS_NS_strings.h"
+
+
+ACE_RCSID (Strategies,
+ UIOP_Lite_Factory,
+ "$Id$")
+
+
+static const char prefix_[] = "uiop";
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_UIOP_Lite_Protocol_Factory::TAO_UIOP_Lite_Protocol_Factory (void)
+ : TAO_Protocol_Factory (TAO_TAG_UIOP_PROFILE),
+ major_ (TAO_DEF_GIOP_MAJOR),
+ minor_ (TAO_DEF_GIOP_MINOR)
+{
+}
+
+TAO_UIOP_Lite_Protocol_Factory::~TAO_UIOP_Lite_Protocol_Factory (void)
+{
+}
+
+int
+TAO_UIOP_Lite_Protocol_Factory::match_prefix (const ACE_CString &prefix)
+{
+ // Check for the proper prefix for this protocol.
+ return (ACE_OS::strcasecmp (prefix.c_str (), ::prefix_) == 0);
+}
+
+const char *
+TAO_UIOP_Lite_Protocol_Factory::prefix (void) const
+{
+ return ::prefix_;
+}
+
+char
+TAO_UIOP_Lite_Protocol_Factory::options_delimiter (void) const
+{
+ return '|';
+}
+
+TAO_Acceptor *
+TAO_UIOP_Lite_Protocol_Factory::make_acceptor (void)
+{
+ TAO_Acceptor *acceptor = 0;
+
+ // We are Lite factory
+ CORBA::Boolean lite_factory = 1;
+ ACE_NEW_RETURN (acceptor,
+ TAO_UIOP_Acceptor (lite_factory),
+ 0);
+
+ return acceptor;
+}
+
+int
+TAO_UIOP_Lite_Protocol_Factory::init (int /* argc */,
+ ACE_TCHAR* /* argv */ [])
+{
+ return 0;
+}
+
+TAO_Connector *
+TAO_UIOP_Lite_Protocol_Factory::make_connector (void)
+{
+ TAO_Connector *connector = 0;
+
+ // We are a lite factory
+ CORBA::Boolean lite_factory = 1;
+ ACE_NEW_RETURN (connector,
+ TAO_UIOP_Connector (lite_factory),
+ 0);
+
+ return connector;
+}
+
+int
+TAO_UIOP_Lite_Protocol_Factory::requires_explicit_endpoint (void) const
+{
+ return 1;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DEFINE (TAO_UIOP_Lite_Protocol_Factory,
+ ACE_TEXT ("UIOP_Lite_Factory"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (TAO_UIOP_Lite_Protocol_Factory),
+ ACE_Service_Type::DELETE_THIS |
+ ACE_Service_Type::DELETE_OBJ,
+ 0)
+
+ACE_FACTORY_DEFINE (TAO_Strategies, TAO_UIOP_Lite_Protocol_Factory)
+
+
+#endif /* TAO_HAS_UIOP == 1 */
diff --git a/TAO/tao/Strategies/UIOP_Lite_Factory.h b/TAO/tao/Strategies/UIOP_Lite_Factory.h
new file mode 100644
index 00000000000..98e127d58f7
--- /dev/null
+++ b/TAO/tao/Strategies/UIOP_Lite_Factory.h
@@ -0,0 +1,92 @@
+// -*- C++ -*-
+
+// $Id$
+// ============================================================================
+//
+// = LIBRARY
+// TAO
+//
+// = FILENAME
+// UIOP_Factory.h
+//
+// = AUTHOR
+// Fred Kuhns <fredk@cs.wustl.edu>
+// Ossama Othman <othman@cs.wustl.edu>
+//
+// ============================================================================
+
+#ifndef TAO_UIOP_LITE_FACTORY_H
+#define TAO_UIOP_LITE_FACTORY_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+# if TAO_HAS_UIOP == 1
+
+#include "ace/Service_Config.h"
+#include "tao/Strategies/strategies_export.h"
+#include "tao/Protocol_Factory.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Acceptor;
+class TAO_Connector;
+
+class TAO_Strategies_Export TAO_UIOP_Lite_Protocol_Factory :
+ public TAO_Protocol_Factory
+{
+public:
+ /// Constructor.
+ TAO_UIOP_Lite_Protocol_Factory (void);
+
+ /// Destructor.
+ virtual ~TAO_UIOP_Lite_Protocol_Factory (void);
+
+ // = Service Configurator hooks.
+ /// Dynamic linking hook
+ virtual int init (int argc, ACE_TCHAR* argv[]);
+
+ /// Verify prefix is a match
+ virtual int match_prefix (const ACE_CString &prefix);
+
+ /// Returns the prefix used by the protocol.
+ virtual const char *prefix (void) const;
+
+ /// Return the character used to mark where an endpoint ends and
+ /// where its options begin.
+ virtual char options_delimiter (void) const;
+
+ /**
+ * @name Protocol factory methods Methods
+ *
+ * Please check the documentation in Protocol_Factory.h for details.
+ */
+ //@{
+ virtual TAO_Acceptor *make_acceptor (void);
+ virtual TAO_Connector *make_connector (void);
+ virtual int requires_explicit_endpoint (void) const;
+ //@}
+
+private:
+ int major_;
+ int minor_;
+ // Changing the version number can be used to provide backwards
+ // compatibility with old clients.
+
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE (TAO_UIOP_Lite_Protocol_Factory)
+ACE_FACTORY_DECLARE (TAO_Strategies, TAO_UIOP_Lite_Protocol_Factory)
+
+# endif /* TAO_HAS_UIOP == 1 */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_UIOP_LITE_FACTORY_H */
diff --git a/TAO/tao/Strategies/UIOP_Profile.cpp b/TAO/tao/Strategies/UIOP_Profile.cpp
new file mode 100644
index 00000000000..1e665915348
--- /dev/null
+++ b/TAO/tao/Strategies/UIOP_Profile.cpp
@@ -0,0 +1,454 @@
+#include "tao/Strategies/UIOP_Profile.h"
+
+#if TAO_HAS_UIOP == 1
+
+#include "tao/Strategies/uiop_endpointsC.h"
+
+#include "tao/CDR.h"
+#include "tao/Environment.h"
+#include "tao/ORB.h"
+#include "tao/ORB_Core.h"
+#include "tao/debug.h"
+
+#include "ace/OS_NS_stdio.h"
+#include "ace/OS_NS_string.h"
+#include "ace/os_include/os_ctype.h"
+
+ACE_RCSID (Strategies,
+ UIOP_Profile,
+ "$Id$")
+
+static const char prefix_[] = "uiop";
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+const char TAO_UIOP_Profile::object_key_delimiter_ = '|';
+
+char
+TAO_UIOP_Profile::object_key_delimiter (void) const
+{
+ return TAO_UIOP_Profile::object_key_delimiter_;
+}
+
+TAO_UIOP_Profile::TAO_UIOP_Profile (const ACE_UNIX_Addr &addr,
+ const TAO::ObjectKey &object_key,
+ const TAO_GIOP_Message_Version &version,
+ TAO_ORB_Core *orb_core)
+ : TAO_Profile (TAO_TAG_UIOP_PROFILE,
+ orb_core,
+ object_key,
+ version),
+ endpoint_ (addr),
+ count_ (1)
+{
+}
+
+TAO_UIOP_Profile::TAO_UIOP_Profile (const char *,
+ const TAO::ObjectKey &object_key,
+ const ACE_UNIX_Addr &addr,
+ const TAO_GIOP_Message_Version &version,
+ TAO_ORB_Core *orb_core)
+ : TAO_Profile (TAO_TAG_UIOP_PROFILE,
+ orb_core,
+ object_key,
+ version),
+ endpoint_ (addr),
+ count_ (1)
+{
+}
+
+TAO_UIOP_Profile::TAO_UIOP_Profile (TAO_ORB_Core *orb_core)
+ : TAO_Profile (TAO_TAG_UIOP_PROFILE,
+ orb_core,
+ TAO_GIOP_Message_Version (TAO_DEF_GIOP_MAJOR,
+ TAO_DEF_GIOP_MINOR)),
+ endpoint_ (),
+ count_ (1)
+{
+}
+
+TAO_UIOP_Profile::~TAO_UIOP_Profile (void)
+{
+ // Clean up the list of endpoints since we own it.
+ // Skip the head, since it is not dynamically allocated.
+ TAO_Endpoint *tmp = 0;
+
+ for (TAO_Endpoint *next = this->endpoint ()->next ();
+ next != 0;
+ next = tmp)
+ {
+ tmp = next->next ();
+ delete next;
+ }
+}
+
+TAO_Endpoint*
+TAO_UIOP_Profile::endpoint (void)
+{
+ return &this->endpoint_;
+}
+
+CORBA::ULong
+TAO_UIOP_Profile::endpoint_count (void) const
+{
+ return this->count_;
+}
+
+void
+TAO_UIOP_Profile::parse_string_i (const char *string
+ ACE_ENV_ARG_DECL)
+{
+ if (!string || !*string)
+ {
+ ACE_THROW (CORBA::INV_OBJREF (
+ CORBA::SystemException::_tao_minor_code (
+ 0,
+ EINVAL),
+ CORBA::COMPLETED_NO));
+ }
+
+ // Remove the "N.n@" version prefix, if it exists, and verify the
+ // version is one that we accept.
+
+ // Check for version
+ if (isdigit (string [0]) &&
+ string[1] == '.' &&
+ isdigit (string [2]) &&
+ string[3] == '@')
+ {
+ // @@ This may fail for non-ascii character sets [but take that
+ // with a grain of salt]
+ this->version_.set_version ((char) (string [0] - '0'),
+ (char) (string [2] - '0'));
+ string += 4;
+ // Skip over the "N.n@"
+ }
+
+ if (this->version_.major != TAO_DEF_GIOP_MAJOR ||
+ this->version_.minor > TAO_DEF_GIOP_MINOR)
+ {
+ ACE_THROW (CORBA::INV_OBJREF (
+ CORBA::SystemException::_tao_minor_code (
+ 0,
+ EINVAL),
+ CORBA::COMPLETED_NO));
+ }
+
+
+ // Pull off the "rendezvous point" part of the objref
+ // Copy the string because we are going to modify it...
+ CORBA::String_var copy (string);
+
+ char *start = copy.inout ();
+ char *cp = ACE_OS::strchr (start, this->object_key_delimiter_);
+
+ if (cp == 0)
+ {
+ ACE_THROW (CORBA::INV_OBJREF (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ EINVAL),
+ CORBA::COMPLETED_NO));
+ // No rendezvous point specified
+ }
+
+ CORBA::ULong length = cp - start;
+
+ CORBA::String_var rendezvous = CORBA::string_alloc (length);
+
+ ACE_OS::strncpy (rendezvous.inout (), start, length);
+ rendezvous[length] = '\0';
+
+ if (this->endpoint_.object_addr_.set (rendezvous.in ()) != 0)
+ {
+ ACE_THROW (CORBA::INV_OBJREF (
+ CORBA::SystemException::_tao_minor_code (
+ TAO::VMCID,
+ EINVAL),
+ CORBA::COMPLETED_NO));
+ }
+
+ start = ++cp; // increment past the object key separator
+
+ TAO::ObjectKey ok;
+ TAO::ObjectKey::decode_string_to_sequence (ok,
+ start);
+
+ (void) this->orb_core ()->object_key_table ().bind (ok,
+ this->ref_object_key_);
+}
+
+CORBA::Boolean
+TAO_UIOP_Profile::do_is_equivalent (const TAO_Profile *other_profile)
+{
+ const TAO_UIOP_Profile *op =
+ dynamic_cast <const TAO_UIOP_Profile *> (other_profile);
+
+ if (op == 0)
+ return false;
+
+ // Check endpoints equivalence.
+ const TAO_UIOP_Endpoint *other_endp = &op->endpoint_;
+ for (TAO_UIOP_Endpoint *endp = &this->endpoint_;
+ endp != 0;
+ endp = endp->next_)
+ {
+ if (endp->is_equivalent (other_endp))
+ other_endp = other_endp->next_;
+ else
+ return false;
+ }
+
+ return true;
+}
+
+CORBA::ULong
+TAO_UIOP_Profile::hash (CORBA::ULong max
+ ACE_ENV_ARG_DECL_NOT_USED)
+{
+ // Get the hashvalue for all endpoints.
+ CORBA::ULong hashval = 0;
+ for (TAO_UIOP_Endpoint *endp = &this->endpoint_;
+ endp != 0;
+ endp = endp->next_)
+ {
+ hashval += endp->hash ();
+ }
+
+ hashval += this->version_.minor;
+ hashval += this->tag ();
+
+ const TAO::ObjectKey &ok =
+ this->ref_object_key_->object_key ();
+
+ if (ok.length () >= 4)
+ {
+ hashval += ok[1];
+ hashval += ok[3];
+ }
+
+ hashval += this->hash_service_i (max);
+
+ return hashval % max;
+}
+
+void
+TAO_UIOP_Profile::add_endpoint (TAO_UIOP_Endpoint *endp)
+{
+ endp->next_ = this->endpoint_.next_;
+ this->endpoint_.next_ = endp;
+
+ this->count_++;
+}
+
+
+char *
+TAO_UIOP_Profile::to_string (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+{
+ CORBA::String_var key;
+ TAO::ObjectKey::encode_sequence_to_string (key.inout(),
+ this->ref_object_key_->object_key ());
+
+ u_int buflen = (8 /* "corbaloc" */ +
+ 1 /* colon separator */ +
+ ACE_OS::strlen (::prefix_) +
+ 1 /* colon separator */ +
+ 1 /* major version */ +
+ 1 /* decimal point */ +
+ 1 /* minor version */ +
+ 1 /* `@' character */ +
+ ACE_OS::strlen (this->endpoint_.rendezvous_point ()) +
+ 1 /* object key separator */ +
+ ACE_OS::strlen (key.in ()));
+
+ char * buf = CORBA::string_alloc (buflen);
+
+ static const char digits [] = "0123456789";
+
+ ACE_OS::sprintf (buf,
+ "corbaloc:%s:%c.%c@%s%c%s",
+ ::prefix_,
+ digits [this->version_.major],
+ digits [this->version_.minor],
+ this->endpoint_.rendezvous_point (),
+ this->object_key_delimiter_,
+ key.in ());
+ return buf;
+}
+
+const char *
+TAO_UIOP_Profile::prefix (void)
+{
+ return ::prefix_;
+}
+
+int
+TAO_UIOP_Profile::decode_profile (TAO_InputCDR& cdr)
+{
+ char *rendezvous = 0;
+
+ // Get rendezvous_point
+ if (cdr.read_string (rendezvous) == 0)
+ {
+ ACE_DEBUG ((LM_DEBUG, "error decoding UIOP rendezvous_point"));
+ return -1;
+ }
+
+ if (this->endpoint_.object_addr_.set (rendezvous) == -1)
+ {
+ // In the case of an ACE_UNIX_Addr, this should call should
+ // never fail!
+ //
+ // If the call fails, allow the profile to be created, and rely
+ // on TAO's connection handling to throw the appropriate
+ // exception.
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) UIOP_Profile::decode - ")
+ ACE_TEXT ("ACE_UNIX_Addr::set() failed\n")));
+ }
+ }
+
+ // Clean up
+ delete [] rendezvous;
+
+ return 1;
+}
+
+void
+TAO_UIOP_Profile::create_profile_body (TAO_OutputCDR &encap) const
+{
+ // CHAR describing byte order, starting the encapsulation
+ encap.write_octet (TAO_ENCAP_BYTE_ORDER);
+
+ // The GIOP version
+ encap.write_octet (this->version_.major);
+ encap.write_octet (this->version_.minor);
+
+ // STRING rendezvous_pointname from profile
+ encap.write_string (this->endpoint_.rendezvous_point ());
+
+ // OCTET SEQUENCE for object key
+ if (this->ref_object_key_)
+ encap << this->ref_object_key_->object_key ();
+ else
+ {
+ ACE_ERROR ((LM_ERROR,
+ "(%P|%t) TAO - UIOP_Profile::create_profile_body "
+ "no object key marshalled \n"));
+ }
+
+ if (this->version_.major > 1
+ || this->version_.minor > 0)
+ this->tagged_components ().encode (encap);
+}
+
+int
+TAO_UIOP_Profile::encode_endpoints (void)
+{
+ // Create a data structure and fill it with endpoint info for wire
+ // transfer.
+ // We include information for the head of the list
+ // together with other endpoints because even though its addressing
+ // info is transmitted using standard ProfileBody components, its
+ // priority is not!
+ TAO_UIOPEndpointSequence endpoints;
+ endpoints.length (this->count_);
+
+ TAO_UIOP_Endpoint *endpoint = &this->endpoint_;
+ for (size_t i = 0;
+ i < this->count_;
+ ++i)
+ {
+ endpoints[i].rendezvous_point = endpoint->rendezvous_point ();
+ endpoints[i].priority = endpoint->priority ();
+
+ endpoint = endpoint->next_;
+ }
+
+ // Encode the data structure.
+ TAO_OutputCDR out_cdr;
+ if ((out_cdr << ACE_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER)
+ == 0)
+ || (out_cdr << endpoints) == 0)
+ return -1;
+
+ this->set_tagged_components (out_cdr);
+
+ return 0;
+}
+
+int
+TAO_UIOP_Profile::decode_endpoints (void)
+{
+ IOP::TaggedComponent tagged_component;
+ tagged_component.tag = TAO_TAG_ENDPOINTS;
+
+ if (this->tagged_components_.get_component (tagged_component))
+ {
+ const CORBA::Octet *buf =
+ tagged_component.component_data.get_buffer ();
+
+ TAO_InputCDR in_cdr (reinterpret_cast <const char*>(buf),
+ tagged_component.component_data.length ());
+
+ // Extract the Byte Order.
+ CORBA::Boolean byte_order;
+ if ((in_cdr >> ACE_InputCDR::to_boolean (byte_order)) == 0)
+ return -1;
+ in_cdr.reset_byte_order (static_cast<int>(byte_order));
+
+ // Extract endpoints sequence.
+ TAO_UIOPEndpointSequence endpoints;
+
+ if ((in_cdr >> endpoints) == 0)
+ return -1;
+
+ // Get the priority of the first endpoint (head of the list.
+ // It's other data is extracted as part of the standard profile
+ // decoding.
+ this->endpoint_.priority (endpoints[0].priority);
+
+ // Use information extracted from the tagged component to
+ // populate the profile. Skip the first endpoint, since it is
+ // always extracted through standard profile body. Also, begin
+ // from the end of the sequence to preserve endpoint order,
+ // since <add_endpoint> method reverses the order of endpoints
+ // in the list.
+ for (CORBA::ULong i = endpoints.length () - 1;
+ i > 0;
+ --i)
+ {
+ TAO_UIOP_Endpoint *endpoint = 0;
+ ACE_NEW_RETURN (endpoint,
+ TAO_UIOP_Endpoint,
+ -1);
+ this->add_endpoint (endpoint);
+ if (endpoint->object_addr_.set
+ (endpoints[i].rendezvous_point)
+ == -1)
+ {
+ // In the case of an ACE_UNIX_Addr, this should call should
+ // never fail!
+ // If the call fails, allow the profile to be created, and rely
+ // on TAO's connection handling to throw the appropriate
+ // exception.
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) UIOP_Profile::decode_endpoints - ")
+ ACE_TEXT ("ACE_UNIX_Addr::set() failed\n")));
+ }
+
+ }
+ endpoint->priority (endpoints[i].priority);
+ }
+ }
+
+ return 0;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_UIOP == 1 */
diff --git a/TAO/tao/Strategies/UIOP_Profile.h b/TAO/tao/Strategies/UIOP_Profile.h
new file mode 100644
index 00000000000..fe515c4d388
--- /dev/null
+++ b/TAO/tao/Strategies/UIOP_Profile.h
@@ -0,0 +1,130 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file UIOP_Profile.h
+ *
+ * $Id$
+ *
+ * Unix Domain Socket (UIOP) profile specific processing
+ *
+ * @author Ossama Othman <ossama@dre.vanderbilt.edu>
+ * @author Fred Kuhns <fredk@cs.wustl.edu>
+ */
+//=============================================================================
+
+
+#ifndef TAO_UIOP_PROFILE_H
+#define TAO_UIOP_PROFILE_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+# if TAO_HAS_UIOP == 1
+
+#include "tao/Strategies/strategies_export.h"
+#include "tao/Profile.h"
+#include "tao/Strategies/UIOP_Connection_Handler.h"
+#include "tao/Strategies/UIOP_Endpoint.h"
+
+#include "ace/UNIX_Addr.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_UIOP_Profile
+ *
+ * @brief This class defines the protocol specific attributes required
+ * for locating ORBs over local IPC.
+ *
+ * This class defines the UIOP profile.
+ */
+class TAO_Strategies_Export TAO_UIOP_Profile : public TAO_Profile
+{
+public:
+ /// The object key delimiter that UIOP uses or expects.
+ static const char object_key_delimiter_;
+ virtual char object_key_delimiter (void) const;
+
+ /// Return the char string prefix.
+ static const char *prefix (void);
+
+ /// Profile constructor, same as above except the object_key has
+ /// already been marshaled. (actually, no marshalling for this protocol)
+ TAO_UIOP_Profile (const ACE_UNIX_Addr &addr,
+ const TAO::ObjectKey &object_key,
+ const TAO_GIOP_Message_Version &version,
+ TAO_ORB_Core *orb_core);
+
+ /// Profile constructor
+ TAO_UIOP_Profile (const char *rendezvous_point,
+ const TAO::ObjectKey &object_key,
+ const ACE_UNIX_Addr &addr,
+ const TAO_GIOP_Message_Version &version,
+ TAO_ORB_Core *orb_core);
+
+ /// Profile constructor, default.
+ TAO_UIOP_Profile (TAO_ORB_Core *orb_core);
+
+ /// Destructor is to be called only through <_decr_refcnt>.
+ ~TAO_UIOP_Profile (void);
+
+ /// Template methods. Please see Profile.h for documentation.
+ virtual char *to_string (ACE_ENV_SINGLE_ARG_DECL);
+ virtual int encode_endpoints (void);
+ virtual TAO_Endpoint *endpoint (void);
+ virtual CORBA::ULong endpoint_count (void) const;
+ virtual CORBA::ULong hash (CORBA::ULong max
+ ACE_ENV_ARG_DECL);
+ /**
+ * Add <endp> to this profile's list of endpoints (it is inserted
+ * next to the head of the list). This profiles takes ownership of
+ * <endp>.
+ */
+ void add_endpoint (TAO_UIOP_Endpoint *endp);
+
+protected:
+
+ /// Protected template methods. Please see documentation in
+ /// Profile.h for details.
+ virtual int decode_profile (TAO_InputCDR& cdr);
+ virtual void parse_string_i (const char *string
+ ACE_ENV_ARG_DECL);
+ virtual void create_profile_body (TAO_OutputCDR &cdr) const;
+ virtual int decode_endpoints (void);
+ virtual CORBA::Boolean do_is_equivalent (const TAO_Profile *other_profile);
+
+private:
+ /**
+ * Head of this profile's list of endpoints. This endpoint is not
+ * dynamically allocated because a profile always contains at least
+ * one endpoint.
+ *
+ * Currently, a profile contains more than one endpoint, i.e.,
+ * list contains more than just the head, only when RTCORBA is enabled.
+ * However, in the near future, this will be used in nonRT
+ * mode as well, e.g., to support a la TAG_ALTERNATE_IIOP_ADDRESS
+ * feature.
+ * Addressing info of the default endpoint, i.e., head of the list,
+ * is transmitted using standard UIOP ProfileBody components. See
+ * <encode_endpoints> method documentation above for how the rest of
+ * the endpoint list is transmitted.
+ */
+ TAO_UIOP_Endpoint endpoint_;
+
+ /// Number of endpoints in the list headed by <endpoint_>.
+ CORBA::ULong count_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+# endif /* TAO_HAS_UIOP == 1 */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_UIOP_PROFILE_H */
diff --git a/TAO/tao/Strategies/UIOP_Transport.cpp b/TAO/tao/Strategies/UIOP_Transport.cpp
new file mode 100644
index 00000000000..c3cde036f2e
--- /dev/null
+++ b/TAO/tao/Strategies/UIOP_Transport.cpp
@@ -0,0 +1,200 @@
+// $Id$
+
+#include "tao/Strategies/UIOP_Transport.h"
+
+#if TAO_HAS_UIOP == 1
+
+#include "tao/Strategies/UIOP_Connection_Handler.h"
+#include "tao/Strategies/UIOP_Profile.h"
+#include "tao/Timeprobe.h"
+#include "tao/CDR.h"
+#include "tao/Transport_Mux_Strategy.h"
+#include "tao/Wait_Strategy.h"
+#include "tao/Stub.h"
+#include "tao/ORB_Core.h"
+#include "tao/debug.h"
+#include "tao/GIOP_Message_Base.h"
+#include "tao/GIOP_Message_Lite.h"
+
+ACE_RCSID (Strategies,
+ UIOP_Transport,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_UIOP_Transport::TAO_UIOP_Transport (TAO_UIOP_Connection_Handler *handler,
+ TAO_ORB_Core *orb_core,
+ CORBA::Boolean flag)
+ : TAO_Transport (TAO_TAG_UIOP_PROFILE,
+ orb_core)
+ , connection_handler_ (handler)
+ , messaging_object_ (0)
+{
+
+/*
+ * Hook to customize the messaging object when the concrete messaging
+ * object is known a priori. In this case, the flag is ignored.
+ */
+//@@ MESSAGING_SPL_COMMENT_HOOK_START
+ if (flag)
+ {
+ // Use the lite version of the protocol
+ ACE_NEW (this->messaging_object_,
+ TAO_GIOP_Message_Lite (orb_core));
+ }
+ else
+ {
+ // Use the normal GIOP object
+ ACE_NEW (this->messaging_object_,
+ TAO_GIOP_Message_Base (orb_core, this));
+ }
+//@@ MESSAGING_SPL_COMMENT_HOOK_END
+}
+
+TAO_UIOP_Transport::~TAO_UIOP_Transport (void)
+{
+ delete this->messaging_object_;
+}
+
+ACE_Event_Handler *
+TAO_UIOP_Transport::event_handler_i (void)
+{
+ return this->connection_handler_;
+}
+
+TAO_Connection_Handler *
+TAO_UIOP_Transport::connection_handler_i (void)
+{
+ return this->connection_handler_;
+}
+
+TAO_Pluggable_Messaging *
+TAO_UIOP_Transport::messaging_object (void)
+{
+ return this->messaging_object_;
+}
+
+ssize_t
+TAO_UIOP_Transport::send (iovec *iov, int iovcnt,
+ size_t &bytes_transferred,
+ const ACE_Time_Value *max_wait_time)
+{
+ const ssize_t retval =
+ this->connection_handler_->peer ().sendv (iov,
+ iovcnt,
+ max_wait_time);
+
+ if (retval > 0)
+ bytes_transferred = retval;
+
+ return retval;
+}
+
+ssize_t
+TAO_UIOP_Transport::recv (char *buf,
+ size_t len,
+ const ACE_Time_Value *max_wait_time)
+{
+ const ssize_t n = this->connection_handler_->peer ().recv (buf,
+ len,
+ max_wait_time);
+
+ // Most of the errors handling is common for
+ // Now the message has been read
+ if (n == -1 &&
+ TAO_debug_level > 4 &&
+ errno != ETIME)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - %p \n"),
+ ACE_TEXT ("TAO - read message failure ")
+ ACE_TEXT ("recv () \n")));
+ }
+
+ // Error handling
+ if (n == -1)
+ {
+ if (errno == EWOULDBLOCK)
+ return 0;
+
+ return -1;
+ }
+ // @@ What are the other error handling here??
+ else if (n == 0)
+ {
+ return -1;
+ }
+
+ return n;
+}
+
+int
+TAO_UIOP_Transport::send_request (TAO_Stub *stub,
+ TAO_ORB_Core *orb_core,
+ TAO_OutputCDR &stream,
+ int message_semantics,
+ ACE_Time_Value *max_wait_time)
+{
+ if (this->ws_->sending_request (orb_core,
+ message_semantics) == -1)
+ return -1;
+
+ if (this->send_message (stream,
+ stub,
+ message_semantics,
+ max_wait_time) == -1)
+
+ return -1;
+
+ this->first_request_sent();
+
+ return 0;
+}
+
+int
+TAO_UIOP_Transport::send_message (TAO_OutputCDR &stream,
+ TAO_Stub *stub,
+ int message_semantics,
+ ACE_Time_Value *max_wait_time)
+{
+ // Format the message in the stream first
+ if (this->messaging_object_->format_message (stream) != 0)
+ return -1;
+
+ // Strictly speaking, should not need to loop here because the
+ // socket never gets set to a nonblocking mode ... some Linux
+ // versions seem to need it though. Leaving it costs little.
+
+ // This guarantees to send all data (bytes) or return an error.
+ const ssize_t n = this->send_message_shared (stub,
+ message_semantics,
+ stream.begin (),
+ max_wait_time);
+
+ if (n == -1)
+ {
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO: (%P|%t|%N|%l) closing transport %d after fault %p\n"),
+ this->id (),
+ ACE_TEXT ("send_message ()\n")));
+
+ return -1;
+ }
+
+ return 1;
+}
+
+int
+TAO_UIOP_Transport::messaging_init (CORBA::Octet major,
+ CORBA::Octet minor)
+{
+ this->messaging_object_->init (major,
+ minor);
+ return 1;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_UIOP */
diff --git a/TAO/tao/Strategies/UIOP_Transport.h b/TAO/tao/Strategies/UIOP_Transport.h
new file mode 100644
index 00000000000..1a7599f45fb
--- /dev/null
+++ b/TAO/tao/Strategies/UIOP_Transport.h
@@ -0,0 +1,121 @@
+// -*- C++ -*-
+
+// ===================================================================
+/**
+ * @file UIOP_Transport.h
+ *
+ * $Id$
+ *
+ * @author Originally by Fred Kuhns <fredk@cs.wustl.edu>
+ * @author Ossama Othman <ossama@ece.uci.edu>
+ * @author Modified by Balachandran Natarajan <bala@cs.wustl.edu>
+ */
+// ===================================================================
+
+#ifndef TAO_UIOP_TRANSPORT_H
+#define TAO_UIOP_TRANSPORT_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+# if TAO_HAS_UIOP == 1
+
+#include "tao/Strategies/strategies_export.h"
+#include "ace/LSOCK_Acceptor.h"
+#include "ace/Svc_Handler.h"
+#include "tao/Transport.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Forward decls.
+
+class TAO_ORB_Core;
+class TAO_UIOP_Connection_Handler;
+class TAO_Pluggable_Messaging;
+
+typedef ACE_Svc_Handler<ACE_LSOCK_STREAM, ACE_NULL_SYNCH>
+ TAO_UIOP_SVC_HANDLER;
+
+/**
+ * @class TAO_UIOP_Transport
+ *
+ * @brief Specialization of the base TAO_Transport class to handle the
+ * UIOP protocol.
+ *
+ */
+
+class TAO_Strategies_Export TAO_UIOP_Transport : public TAO_Transport
+{
+public:
+
+ /// Constructor.
+ TAO_UIOP_Transport (TAO_UIOP_Connection_Handler *handler,
+ TAO_ORB_Core *orb_core,
+ CORBA::Boolean flag);
+
+ /// Default destructor.
+ ~TAO_UIOP_Transport (void);
+
+protected:
+ /** @name Overridden Template Methods
+ *
+ * These are implementations of template methods declared by TAO_Transport.
+ */
+ //@{
+
+ virtual ACE_Event_Handler * event_handler_i (void);
+ virtual TAO_Connection_Handler *connection_handler_i (void);
+ virtual TAO_Pluggable_Messaging *messaging_object (void);
+
+ /// Write the complete Message_Block chain to the connection.
+ virtual ssize_t send (iovec *iov, int iovcnt,
+ size_t &bytes_transferred,
+ const ACE_Time_Value *timeout = 0);
+
+ /// Read len bytes from into buf.
+ virtual ssize_t recv (char *buf,
+ size_t len,
+ const ACE_Time_Value *s = 0);
+
+public:
+ /// @todo These methods IMHO should have more meaningful names.
+ /// The names seem to indicate nothing.
+ virtual int send_request (TAO_Stub *stub,
+ TAO_ORB_Core *orb_core,
+ TAO_OutputCDR &stream,
+ int message_semantics,
+ ACE_Time_Value *max_wait_time);
+
+ virtual int send_message (TAO_OutputCDR &stream,
+ TAO_Stub *stub = 0,
+ int message_semantics = TAO_Transport::TAO_TWOWAY_REQUEST,
+ ACE_Time_Value *max_time_wait = 0);
+
+ /// Initialising the messaging object
+ virtual int messaging_init (CORBA::Octet major,
+ CORBA::Octet minor);
+
+ //@}
+
+private:
+
+ /// The connection service handler used for accessing lower layer
+ /// communication protocols.
+ TAO_UIOP_Connection_Handler *connection_handler_;
+
+ /// Our messaging object.
+ TAO_Pluggable_Messaging *messaging_object_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+# endif /* TAO_HAS_UIOP == 1 */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_UIOP_TRANSPORT_H */
diff --git a/TAO/tao/Strategies/advanced_resource.cpp b/TAO/tao/Strategies/advanced_resource.cpp
new file mode 100644
index 00000000000..57d5fd5cdaa
--- /dev/null
+++ b/TAO/tao/Strategies/advanced_resource.cpp
@@ -0,0 +1,649 @@
+// $Id$
+#include "ace/Service_Config.h"
+#include "tao/Strategies/advanced_resource.h"
+
+#include "tao/Strategies/UIOP_Factory.h"
+#include "tao/Strategies/SHMIOP_Factory.h"
+#include "tao/Strategies/DIOP_Factory.h"
+#include "tao/Strategies/SCIOP_Factory.h"
+
+#include "tao/Strategies/LFU_Connection_Purging_Strategy.h"
+#include "tao/Strategies/FIFO_Connection_Purging_Strategy.h"
+#include "tao/Strategies/NULL_Connection_Purging_Strategy.h"
+
+#include "tao/Strategies/LF_Strategy_Null.h"
+
+#include "tao/debug.h"
+#include "tao/LRU_Connection_Purging_Strategy.h"
+#include "tao/LF_Strategy_Complete.h"
+#include "tao/LF_Follower.h"
+#include "tao/Leader_Follower.h"
+#include "tao/StringSeqC.h"
+#include "tao/ORB_Core.h"
+#include "tao/Load_Protocol_Factory_T.h"
+
+#include "ace/Arg_Shifter.h"
+#include "ace/Service_Config.h"
+#include "ace/Select_Reactor.h"
+#include "ace/WFMO_Reactor.h"
+#include "ace/Msg_WFMO_Reactor.h"
+#include "ace/TP_Reactor.h"
+#include "ace/Malloc_T.h"
+#include "ace/Local_Memory_Pool.h"
+#include "ace/Null_Mutex.h"
+#include "ace/OS_NS_strings.h"
+
+ACE_RCSID(Strategies, advanced_resource, "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Resource_Factory_Changer::TAO_Resource_Factory_Changer (void)
+{
+
+ TAO_ORB_Core::set_resource_factory ("Advanced_Resource_Factory");
+ ACE_Service_Config::process_directive (ace_svc_desc_TAO_Advanced_Resource_Factory);
+
+#if TAO_HAS_UIOP == 1
+ ACE_Service_Config::process_directive (ace_svc_desc_TAO_UIOP_Protocol_Factory);
+#endif /* TAO_HAS_UIOP == 1 */
+
+#if TAO_HAS_SHMIOP == 1
+ ACE_Service_Config::process_directive (ace_svc_desc_TAO_SHMIOP_Protocol_Factory);
+#endif /* TAO_HAS_SHMIOP == 1 */
+
+#if TAO_HAS_DIOP == 1
+ ACE_Service_Config::process_directive (ace_svc_desc_TAO_DIOP_Protocol_Factory);
+#endif /* TAO_HAS_DIOP == 1 */
+
+#if TAO_HAS_SCIOP == 1
+ ACE_Service_Config::process_directive (ace_svc_desc_TAO_SCIOP_Protocol_Factory);
+#endif /* TAO_HAS_SCIOP == 1 */
+}
+
+TAO_Advanced_Resource_Factory::TAO_Advanced_Resource_Factory (void)
+ : reactor_type_ (TAO_REACTOR_TP),
+ threadqueue_type_ (TAO_THREAD_QUEUE_NOT_SET),
+ cdr_allocator_type_ (TAO_ALLOCATOR_THREAD_LOCK),
+ amh_response_handler_allocator_lock_type_ (TAO_ALLOCATOR_THREAD_LOCK),
+ ami_response_handler_allocator_lock_type_ (TAO_ALLOCATOR_THREAD_LOCK)
+{
+ // Constructor
+}
+
+TAO_Advanced_Resource_Factory::~TAO_Advanced_Resource_Factory (void)
+{
+ // Destructor
+ TAO_ProtocolFactorySetItor end = this->protocol_factories_.end ();
+
+ for (TAO_ProtocolFactorySetItor iterator =
+ this->protocol_factories_.begin ();
+ iterator != end;
+ ++iterator)
+ delete *iterator;
+
+ this->protocol_factories_.reset ();
+}
+
+int
+TAO_Advanced_Resource_Factory::init (int argc, ACE_TCHAR** argv)
+{
+ ACE_TRACE ("TAO_Advanced_Resource_Factory::init");
+
+ // If this factory has already been disabled then
+ // print a warning and exit because any options
+ // are useless
+ if (this->factory_disabled_) {
+ ACE_DEBUG ((LM_WARNING,
+ ACE_TEXT ("TAO (%P|%t) Warning: Resource_Factory options ignored\n")
+ ACE_TEXT ("Advanced Resource Factory is disabled\n")));
+ return 0;
+ }
+ this->options_processed_ = 1;
+
+
+ // If the default resource factory exists, then disable it.
+ // This causes any directives for the "Resource_Factory" to
+ // report warnings.
+ // Note: this is also being done in init_protocol_factories()
+ // to cover the case where init() is not called.
+ TAO_Resource_Factory *default_resource_factory =
+ ACE_Dynamic_Service<TAO_Resource_Factory>::instance ("Resource_Factory");
+ if (default_resource_factory != 0)
+ {
+ default_resource_factory->disable_factory ();
+ }
+
+ ACE_Arg_Shifter arg_shifter (argc, argv);
+
+ //for (int curarg = 0; curarg < argc; ++curarg)
+ const ACE_TCHAR *current_arg = 0;
+ while (arg_shifter.is_anything_left ())
+ {
+ if (arg_shifter.cur_arg_strncasecmp (ACE_TEXT("-ORBReactorRegistry")) == 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT("TAO_Advanced_Resource_Factory::init - ")
+ ACE_TEXT("-ORBReactorRegistry no longer supported\n")),
+ -1);
+
+ }
+ else if (0 != (current_arg = arg_shifter.get_the_parameter
+ (ACE_TEXT("-ORBReactorLock"))))
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT("TAO_Advanced_Resource_Factory - obsolete -ORBReactorLock ")
+ ACE_TEXT("option, please use -ORBReactorType\n")));
+
+ if (ACE_OS::strcasecmp (current_arg, ACE_TEXT("null")) == 0)
+ this->reactor_type_ = TAO_REACTOR_SELECT_ST;
+ else if (ACE_OS::strcasecmp (current_arg, ACE_TEXT("token")) == 0)
+ this->reactor_type_= TAO_REACTOR_SELECT_MT;
+
+ arg_shifter.consume_arg ();
+ }
+ else if (0 != (current_arg = arg_shifter.get_the_parameter
+ (ACE_TEXT("-ORBReactorType"))))
+ {
+ if (ACE_OS::strcasecmp (current_arg,
+ ACE_TEXT("select_mt")) == 0)
+ this->reactor_type_ = TAO_REACTOR_SELECT_MT;
+ else if (ACE_OS::strcasecmp (current_arg,
+ ACE_TEXT("select_st")) == 0)
+ this->reactor_type_ = TAO_REACTOR_SELECT_ST;
+ else if (ACE_OS::strcasecmp (current_arg,
+ ACE_TEXT("wfmo")) == 0)
+#if defined(ACE_WIN32)
+ this->reactor_type_ = TAO_REACTOR_WFMO;
+#else
+ this->report_unsupported_error (ACE_TEXT("WFMO Reactor"));
+#endif /* ACE_WIN32 */
+ else if (ACE_OS::strcasecmp (current_arg,
+ ACE_TEXT("msg_wfmo")) == 0)
+#if defined(ACE_WIN32)
+ this->reactor_type_ = TAO_REACTOR_MSGWFMO;
+#else
+ this->report_unsupported_error (ACE_TEXT("MsgWFMO Reactor"));
+#endif /* ACE_WIN32 */
+
+ else if (ACE_OS::strcasecmp (current_arg,
+ ACE_TEXT("tp")) == 0)
+ this->reactor_type_ = TAO_REACTOR_TP;
+ else if (ACE_OS::strcasecmp (current_arg,
+ ACE_TEXT("fl")) == 0)
+ this->report_option_value_error (
+ ACE_TEXT("FlReactor not supported by Advanced_Resources_Factory. Please use TAO_FlResource_Loader instead."),
+ current_arg);
+ else if (ACE_OS::strcasecmp (current_arg,
+ ACE_TEXT("tk")) == 0)
+ this->report_option_value_error (
+ ACE_TEXT("TkReactor not supported by Advanced_Resources_Factory. Please use TAO_TkResource_Loader instead."),
+ current_arg);
+ else
+ this->report_option_value_error (ACE_TEXT("-ORBReactorType"), current_arg);
+
+ arg_shifter.consume_arg ();
+ }
+ else if (0 != (current_arg = arg_shifter.get_the_parameter
+ (ACE_TEXT("-ORBInputCDRAllocator"))))
+ {
+ if (ACE_OS::strcasecmp (current_arg,
+ ACE_TEXT("null")) == 0)
+ {
+ this->cdr_allocator_type_ = TAO_ALLOCATOR_NULL_LOCK;
+ this->use_locked_data_blocks_ = 0;
+ }
+ else if (ACE_OS::strcasecmp (current_arg,
+ ACE_TEXT("thread")) == 0)
+ {
+ this->cdr_allocator_type_ = TAO_ALLOCATOR_THREAD_LOCK;
+ this->use_locked_data_blocks_ = 1;
+ }
+ else
+ {
+ this->report_option_value_error (ACE_TEXT("-ORBInputCDRAllocator"), current_arg);
+ }
+
+ arg_shifter.consume_arg ();
+ }
+ else if (0 != (current_arg = arg_shifter.get_the_parameter
+ (ACE_TEXT("-ORBAMHResponseHandlerAllocator"))))
+ {
+ if (ACE_OS::strcasecmp (current_arg,
+ ACE_TEXT("null")) == 0)
+ {
+ this->amh_response_handler_allocator_lock_type_ = TAO_ALLOCATOR_NULL_LOCK;
+ }
+ else if (ACE_OS::strcasecmp (current_arg,
+ ACE_TEXT("thread")) == 0)
+ {
+ this->amh_response_handler_allocator_lock_type_ = TAO_ALLOCATOR_THREAD_LOCK;
+ }
+ else
+ {
+ this->report_option_value_error (ACE_TEXT("-ORBAMHResponseHandlerAllocator"), current_arg);
+ }
+
+ arg_shifter.consume_arg ();
+ }
+ else if (0 != (current_arg = arg_shifter.get_the_parameter
+ (ACE_TEXT("-ORBAMIResponseHandlerAllocator"))))
+ {
+ if (ACE_OS::strcasecmp (current_arg,
+ ACE_TEXT("null")) == 0)
+ {
+ this->ami_response_handler_allocator_lock_type_ = TAO_ALLOCATOR_NULL_LOCK;
+ }
+ else if (ACE_OS::strcasecmp (current_arg,
+ ACE_TEXT("thread")) == 0)
+ {
+ this->ami_response_handler_allocator_lock_type_ = TAO_ALLOCATOR_THREAD_LOCK;
+ }
+ else
+ {
+ this->report_option_value_error (ACE_TEXT("-ORBAMIResponseHandlerAllocator"), current_arg);
+ }
+
+ arg_shifter.consume_arg ();
+ }
+ else if (0 != (current_arg = arg_shifter.get_the_parameter
+ (ACE_TEXT("-ORBReactorThreadQueue"))))
+ {
+ if (ACE_OS::strcasecmp (current_arg,
+ ACE_TEXT ("LIFO")) == 0)
+ this->threadqueue_type_ = TAO_THREAD_QUEUE_LIFO;
+ else if (ACE_OS::strcasecmp (current_arg,
+ ACE_TEXT ("FIFO")) == 0)
+ this->threadqueue_type_ = TAO_THREAD_QUEUE_FIFO;
+ else
+ this->report_option_value_error (ACE_TEXT ("-ORBReactorThreadQueue"),
+ current_arg);
+
+ arg_shifter.consume_arg ();
+ }
+ else
+ // Any arguments that don't match are ignored so that they can
+ // be passed to the TAO_Default_Resource_Factory.
+ arg_shifter.ignore_arg ();
+ }
+
+ // If -ORBReactorThreadQueue was passed, make sure it matches the
+ // correct reactor type. Currently, only the tp reactor can take
+ // advantage of the LIFO strategy, select_mt hangs.
+ if (this->threadqueue_type_ != TAO_THREAD_QUEUE_NOT_SET &&
+ this->reactor_type_ != TAO_REACTOR_TP)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO_Advanced_Resource_Factory: -ORBReactorThreadQueue ")
+ ACE_TEXT ("option can only be used with -ORBReactorType ")
+ ACE_TEXT ("tp.\n")));
+ // Explicitely set the default only if not set.
+ else if (this->threadqueue_type_ == TAO_THREAD_QUEUE_NOT_SET)
+ this->threadqueue_type_ = TAO_THREAD_QUEUE_LIFO;
+
+ return this->TAO_Default_Resource_Factory::init (argc, argv);
+}
+
+int
+TAO_Advanced_Resource_Factory::load_default_protocols (void)
+{
+ const int r =
+ this->TAO_Default_Resource_Factory::load_default_protocols ();
+
+ this->protocol_factories_ =
+ this->TAO_Default_Resource_Factory::protocol_factories_;
+
+ this->TAO_Default_Resource_Factory::protocol_factories_.reset ();
+
+ if (r == -1)
+ return -1;
+ // Load the UIOP and SHMIOP protocols...
+
+ return 0;
+}
+
+
+int
+TAO_Advanced_Resource_Factory::init_protocol_factories (void)
+{
+
+ // If the default resource factory exists, then disable it.
+ // This causes any directives for the "Resource_Factory" to
+ // report warnings.
+ // This is needed to ensure warnings when no static directive
+ // for this factory is used (and init() is not called).
+ TAO_Resource_Factory *default_resource_factory =
+ ACE_Dynamic_Service<TAO_Resource_Factory>::instance ("Resource_Factory");
+ if (default_resource_factory != 0)
+ {
+ default_resource_factory->disable_factory();
+ }
+
+ TAO_ProtocolFactorySetItor end = protocol_factories_.end ();
+ TAO_ProtocolFactorySetItor factory = protocol_factories_.begin ();
+
+ if (factory == end)
+ {
+ int const r = this->load_default_protocols ();
+
+ if (r == -1)
+ return -1;
+
+#if TAO_HAS_UIOP == 1
+ if (TAO::details::load_protocol_factory <TAO_UIOP_Protocol_Factory> (
+ this->protocol_factories_, "UIOP_Factory") == -1)
+ return -1;
+#endif /* TAO_HAS_UIOP == 1 */
+
+#if defined (TAO_HAS_SHMIOP) && (TAO_HAS_SHMIOP != 0)
+ if (TAO::details::load_protocol_factory <TAO_SHMIOP_Protocol_Factory> (
+ this->protocol_factories_, "SHMIOP_Factory") == -1)
+ return -1;
+#endif /* TAO_HAS_SHMIOP && TAO_HAS_SHMIOP != 0 */
+
+#if defined (TAO_HAS_DIOP) && (TAO_HAS_DIOP != 0)
+ if (TAO::details::load_protocol_factory <TAO_DIOP_Protocol_Factory> (
+ this->protocol_factories_, "DIOP_Factory") == -1)
+ return -1;
+#endif /* TAO_HAS_DIOP && TAO_HAS_DIOP != 0 */
+
+#if defined (TAO_HAS_SCIOP) && (TAO_HAS_SCIOP != 0)
+ if (TAO::details::load_protocol_factory <TAO_SCIOP_Protocol_Factory> (
+ this->protocol_factories_, "SCIOP_Factory") == -1)
+ return -1;
+#endif /* TAO_HAS_SCIOP && TAO_HAS_SCIOP != 0 */
+
+ return 0;
+
+ }
+
+ for (; factory != end; factory++)
+ {
+ const ACE_CString &name = (*factory)->protocol_name ();
+
+ (*factory)->factory (
+ ACE_Dynamic_Service<TAO_Protocol_Factory>::instance (name.c_str ()));
+ if ((*factory)->factory () == 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT("TAO (%P|%t) Unable to load ")
+ ACE_TEXT("protocol <%s>, %m\n"),
+ ACE_TEXT_CHAR_TO_TCHAR(name.c_str ())),
+ -1);
+ }
+
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT("TAO (%P|%t) Loaded protocol <%s>\n"),
+ ACE_TEXT_CHAR_TO_TCHAR(name.c_str ())));
+ }
+ }
+ return 0;
+}
+
+
+
+TAO_ProtocolFactorySet *
+TAO_Advanced_Resource_Factory::get_protocol_factories (void)
+{
+ return &protocol_factories_;
+}
+
+ACE_Reactor_Impl *
+TAO_Advanced_Resource_Factory::allocate_reactor_impl (void) const
+{
+ ACE_Reactor_Impl *impl = 0;
+
+ /*
+ * Hook for specializing the Reactor implementation in TAO.
+ */
+//@@ TAO_ADVANCED_RESOURCE_REACTOR_SPL_COMMENT_HOOK_START
+ switch (this->reactor_type_)
+ {
+ case TAO_REACTOR_SELECT_MT:
+ ACE_NEW_RETURN (impl,
+ TAO_REACTOR ((ACE_Sig_Handler*)0,
+ (ACE_Timer_Queue*)0,
+ 0,
+ (ACE_Reactor_Notify*)0,
+ this->reactor_mask_signals_),
+ 0);
+ break;
+
+ case TAO_REACTOR_SELECT_ST:
+ ACE_NEW_RETURN (impl,
+ TAO_NULL_LOCK_REACTOR ((ACE_Sig_Handler*)0,
+ (ACE_Timer_Queue*)0,
+ 0,
+ (ACE_Reactor_Notify*)0,
+ this->reactor_mask_signals_),
+ 0);
+ break;
+
+ case TAO_REACTOR_WFMO:
+#if defined(ACE_WIN32) && !defined (ACE_LACKS_MSG_WFMO)
+ ACE_NEW_RETURN (impl, ACE_WFMO_Reactor, 0);
+#endif /* ACE_WIN32 && !ACE_LACKS_MSG_WFMO */
+ break;
+
+ case TAO_REACTOR_MSGWFMO:
+#if defined(ACE_WIN32) && !defined (ACE_HAS_WINCE) && !defined (ACE_HAS_PHARLAP)
+ ACE_NEW_RETURN (impl, ACE_Msg_WFMO_Reactor, 0);
+#endif /* ACE_WIN32 && !ACE_HAS_WINCE */
+ break;
+
+ default:
+ case TAO_REACTOR_TP:
+ ACE_NEW_RETURN (impl, ACE_TP_Reactor ((ACE_Sig_Handler*)0,
+ (ACE_Timer_Queue*)0,
+ this->reactor_mask_signals_,
+ this->threadqueue_type_ == TAO_THREAD_QUEUE_FIFO ?
+ ACE_Select_Reactor_Token::FIFO :
+ ACE_Select_Reactor_Token::LIFO),
+ 0);
+ break;
+ }
+
+//@@ TAO_ADVANCED_RESOURCE_REACTOR_SPL_COMMENT_HOOK_END
+
+ return impl;
+}
+
+typedef ACE_Malloc<ACE_LOCAL_MEMORY_POOL,ACE_Null_Mutex> NULL_LOCK_MALLOC;
+typedef ACE_Allocator_Adapter<NULL_LOCK_MALLOC> NULL_LOCK_ALLOCATOR;
+
+ACE_Allocator *
+TAO_Advanced_Resource_Factory::input_cdr_dblock_allocator (void)
+{
+ ACE_Allocator *allocator = 0;
+ switch (this->cdr_allocator_type_)
+ {
+ case TAO_ALLOCATOR_NULL_LOCK:
+ ACE_NEW_RETURN (allocator,
+ NULL_LOCK_ALLOCATOR,
+ 0);
+ break;
+ default:
+ return
+ this->TAO_Default_Resource_Factory::input_cdr_dblock_allocator();
+ }
+
+ return allocator;
+}
+
+ACE_Allocator *
+TAO_Advanced_Resource_Factory::input_cdr_buffer_allocator (void)
+{
+ ACE_Allocator *allocator = 0;
+ switch (this->cdr_allocator_type_)
+ {
+ case TAO_ALLOCATOR_NULL_LOCK:
+ ACE_NEW_RETURN (allocator,
+ NULL_LOCK_ALLOCATOR,
+ 0);
+ break;
+ default:
+ return
+ this->TAO_Default_Resource_Factory::input_cdr_buffer_allocator();
+ }
+ return allocator;
+}
+
+ACE_Allocator *
+TAO_Advanced_Resource_Factory::input_cdr_msgblock_allocator (void)
+{
+ ACE_Allocator *allocator = 0;
+ switch (this->cdr_allocator_type_)
+ {
+ case TAO_ALLOCATOR_NULL_LOCK:
+ ACE_NEW_RETURN (allocator,
+ NULL_LOCK_ALLOCATOR,
+ 0);
+ break;
+ default:
+ return
+ this->TAO_Default_Resource_Factory::input_cdr_msgblock_allocator();
+ }
+
+ return allocator;
+}
+
+ACE_Allocator *
+TAO_Advanced_Resource_Factory::amh_response_handler_allocator (void)
+{
+ ACE_Allocator *allocator = 0;
+ switch (this->amh_response_handler_allocator_lock_type_)
+ {
+ case TAO_ALLOCATOR_NULL_LOCK:
+ ACE_NEW_RETURN (allocator,
+ NULL_LOCK_ALLOCATOR,
+ 0);
+ break;
+ default:
+ return
+ this->TAO_Default_Resource_Factory::amh_response_handler_allocator();
+ }
+
+ return allocator;
+}
+
+ACE_Allocator *
+TAO_Advanced_Resource_Factory::ami_response_handler_allocator (void)
+{
+ ACE_Allocator *allocator = 0;
+ switch (this->ami_response_handler_allocator_lock_type_)
+ {
+ case TAO_ALLOCATOR_NULL_LOCK:
+ ACE_NEW_RETURN (allocator,
+ NULL_LOCK_ALLOCATOR,
+ 0);
+ break;
+ default:
+ return
+ this->TAO_Default_Resource_Factory::ami_response_handler_allocator();
+ }
+
+ return allocator;
+}
+
+int
+TAO_Advanced_Resource_Factory::input_cdr_allocator_type_locked (void)
+{
+ return this->cdr_allocator_type_ == TAO_ALLOCATOR_NULL_LOCK ? 0 : 1;
+}
+
+TAO_Connection_Purging_Strategy *
+TAO_Advanced_Resource_Factory::create_purging_strategy (void)
+{
+ TAO_Connection_Purging_Strategy *strategy = 0;
+
+ switch(this->connection_purging_type_)
+ {
+ case TAO_Resource_Factory::LFU:
+ ACE_NEW_RETURN (strategy,
+ TAO_LFU_Connection_Purging_Strategy (
+ this->cache_maximum ()),
+ 0);
+ break;
+ case TAO_Resource_Factory::FIFO:
+ ACE_NEW_RETURN (strategy,
+ TAO_FIFO_Connection_Purging_Strategy (
+ this->cache_maximum ()),
+ 0);
+ break;
+ case TAO_Resource_Factory::NOOP:
+ ACE_NEW_RETURN (strategy,
+ TAO_NULL_Connection_Purging_Strategy (
+ this->cache_maximum ()),
+ 0);
+ break;
+ case TAO_Resource_Factory::LRU:
+ ACE_NEW_RETURN (strategy,
+ TAO_LRU_Connection_Purging_Strategy (
+ this->cache_maximum ()),
+ 0);
+ break;
+ default:
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT("TAO (%P|%t) - ")
+ ACE_TEXT("Unknown connection purging strategy ")
+ ACE_TEXT("type was found.\n")));
+ }
+
+ return strategy;
+}
+
+TAO_LF_Strategy *
+TAO_Advanced_Resource_Factory::create_lf_strategy (void)
+{
+ TAO_LF_Strategy *strategy = 0;
+
+ if (this->reactor_type_ == TAO_REACTOR_SELECT_ST)
+ {
+ ACE_NEW_RETURN (strategy,
+ TAO_LF_Strategy_Null,
+ 0);
+ }
+ else
+ {
+ ACE_NEW_RETURN (strategy,
+ TAO_LF_Strategy_Complete,
+ 0);
+ }
+ return strategy;
+}
+
+void
+TAO_Advanced_Resource_Factory::report_option_value_error (
+ const ACE_TCHAR* option_name,
+ const ACE_TCHAR* option_value)
+{
+ ACE_DEBUG((LM_DEBUG,
+ ACE_TEXT("Advanced_Resource_Factory - unknown argument")
+ ACE_TEXT(" <%s> for <%s>\n"),
+ option_value,
+ option_name));
+}
+
+void
+TAO_Advanced_Resource_Factory::report_unsupported_error (
+ const ACE_TCHAR* option_name)
+{
+ ACE_DEBUG((LM_DEBUG,
+ ACE_TEXT("Advanced_Resource_Factory - <%s>")
+ ACE_TEXT(" not supported on this platform\n"),
+ option_name));
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+// ****************************************************************
+
+ACE_STATIC_SVC_DEFINE (TAO_Advanced_Resource_Factory,
+ ACE_TEXT("Advanced_Resource_Factory"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (TAO_Advanced_Resource_Factory),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0)
+ACE_FACTORY_DEFINE (TAO_Strategies, TAO_Advanced_Resource_Factory)
+
+// ****************************************************************
diff --git a/TAO/tao/Strategies/advanced_resource.h b/TAO/tao/Strategies/advanced_resource.h
new file mode 100644
index 00000000000..98dde1143d3
--- /dev/null
+++ b/TAO/tao/Strategies/advanced_resource.h
@@ -0,0 +1,145 @@
+// $Id$
+
+#ifndef TAO_ADVANCED_RESOURCE_H
+#define TAO_ADVANCED_RESOURCE_H
+#include /**/ "ace/pre.h"
+
+#include "tao/Strategies/strategies_export.h"
+#include "tao/default_resource.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/ORB_Core.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Connection_Purging_Strategy;
+
+class TAO_Strategies_Export TAO_Resource_Factory_Changer
+{
+public:
+ TAO_Resource_Factory_Changer (void);
+};
+
+/**
+ * @class TAO_Advanced_Resource_Factory
+ *
+ * @brief TAO's default resource factory
+ *
+ * Using a <{resource source specifier}> as a discriminator, the
+ * factory can return resource instances which are, e.g., global,
+ * stored in thread-specific storage, stored in shared memory,
+ * etc.
+ *
+ */
+class TAO_Strategies_Export TAO_Advanced_Resource_Factory : public TAO_Default_Resource_Factory
+{
+public:
+ // = Initialization and termination methods.
+ /// Constructor.
+ TAO_Advanced_Resource_Factory (void);
+
+ /// Destructor.
+ virtual ~TAO_Advanced_Resource_Factory (void);
+
+ // = Service Configurator hooks.
+ /// Dynamic linking hook
+ virtual int init (int argc, ACE_TCHAR* argv[]);
+
+ /// Type of lock used for the allocators
+ enum Allocator_Lock_Type
+ {
+ TAO_ALLOCATOR_NULL_LOCK,
+ TAO_ALLOCATOR_THREAD_LOCK
+ };
+
+ /// Type of Reactor
+ enum
+ {
+ /// Use ACE_Token
+ TAO_REACTOR_SELECT_MT = 1,
+
+ /// Use ACE_Noop_Token
+ TAO_REACTOR_SELECT_ST = 2,
+ TAO_REACTOR_WFMO = 3,
+ TAO_REACTOR_MSGWFMO = 4,
+ TAO_REACTOR_TP = 5
+ };
+
+ /// Thread queueing Strategy
+ enum
+ {
+ /// Not set, use LIFO.
+ TAO_THREAD_QUEUE_NOT_SET,
+
+ /// FIFO, first-in-first-out.
+ TAO_THREAD_QUEUE_FIFO,
+
+ /// LIFO, last-in-first-out (default).
+ TAO_THREAD_QUEUE_LIFO
+ };
+
+ /**
+ * @name Resource Retrieval
+ */
+ //@{
+ virtual int init_protocol_factories (void);
+ virtual ACE_Allocator* input_cdr_dblock_allocator (void);
+ virtual ACE_Allocator* input_cdr_buffer_allocator (void);
+ virtual ACE_Allocator* input_cdr_msgblock_allocator (void);
+ virtual ACE_Allocator* amh_response_handler_allocator (void);
+ virtual ACE_Allocator* ami_response_handler_allocator (void);
+ virtual int input_cdr_allocator_type_locked (void);
+ virtual TAO_ProtocolFactorySet *get_protocol_factories (void);
+ //@}
+
+ virtual TAO_Connection_Purging_Strategy *create_purging_strategy (void);
+ virtual TAO_LF_Strategy *create_lf_strategy (void);
+
+protected:
+
+ /// Obtain the reactor implementation
+ virtual ACE_Reactor_Impl *allocate_reactor_impl (void) const;
+
+ void report_option_value_error (const ACE_TCHAR* option_name,
+ const ACE_TCHAR* option_value);
+
+ void report_unsupported_error (const ACE_TCHAR* option_name);
+
+ /// List of loaded protocol factories.
+ TAO_ProtocolFactorySet protocol_factories_;
+
+ /// The type of reactor registry.
+ int reactor_registry_type_;
+
+ /// Flag indicating which kind of reactor we should use.
+ int reactor_type_;
+
+ /// The type of queueing strategy to use for multi-threaded
+ /// select reactors, TAO_REACTOR_SELECT_MT and TAO_REACTOR_TP.
+ int threadqueue_type_;
+
+ /// The type of CDR allocators.
+ Allocator_Lock_Type cdr_allocator_type_;
+
+ /// Type of lock used by AMH response handler allocator.
+ Allocator_Lock_Type amh_response_handler_allocator_lock_type_;
+
+ /// Type of lock used by AMI response handler allocator.
+ Allocator_Lock_Type ami_response_handler_allocator_lock_type_;
+
+ virtual int load_default_protocols (void);
+
+};
+
+static TAO_Resource_Factory_Changer TAO_changer;
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE_EXPORT (TAO_Strategies, TAO_Advanced_Resource_Factory)
+ACE_FACTORY_DECLARE (TAO_Strategies, TAO_Advanced_Resource_Factory)
+
+#include /**/ "ace/post.h"
+#endif /* TAO_ADVANCED_RESOURCE_H */
diff --git a/TAO/tao/Strategies/sciop_endpoints.pidl b/TAO/tao/Strategies/sciop_endpoints.pidl
new file mode 100644
index 00000000000..4649ca5d751
--- /dev/null
+++ b/TAO/tao/Strategies/sciop_endpoints.pidl
@@ -0,0 +1,41 @@
+//
+// $Id$
+
+/**
+ * This file contains idl definition for data structures used to
+ * encapsulate data in TAO_TAG_ENDPOINTS tagged component. This
+ * TAO-specific component is used for transmission of multiple
+ * endpoints per single profile. Data structures defined here are
+ * used for transmission of SCIOP Endpoints. See SCIOP_Profile.*
+ * for more details.
+ *
+ * This file was used to generate the code in
+ * sciop_endpoints.* The command used to generate code
+ * is:
+ *
+ * tao_idl
+ * -o orig -Gp -Gd -Ge 1 -Sa -DCORBA3 -Sci
+ * -Wb,export_macro=TAO_Strategies_Export \
+ * -Wb,export_include="strategies_export.h" \
+ * -Wb,pre_include="ace/pre.h" \
+ * -Wb,post_include="ace/post.h" \
+ * sciop_endpoints.pidl
+ */
+
+#ifndef _SCIOP_ENDPOINTS_IDL_
+#define _SCIOP_ENDPOINTS_IDL_
+
+/// Stores information for a single SCIOP endpoint.
+struct TAO_SCIOP_Endpoint_Info
+{
+ string host;
+ short port;
+ short priority;
+};
+
+/// Stores information for a collection of SCIOP endpoints.
+typedef sequence <TAO_SCIOP_Endpoint_Info> TAO_SCIOPEndpointSequence;
+
+#pragma prefix ""
+
+#endif /* _SCIOP_ENDPOINTS_IDL_ */
diff --git a/TAO/tao/Strategies/strategies_export.h b/TAO/tao/Strategies/strategies_export.h
new file mode 100644
index 00000000000..9ca0498827d
--- /dev/null
+++ b/TAO/tao/Strategies/strategies_export.h
@@ -0,0 +1,40 @@
+
+// -*- C++ -*-
+// $Id$
+// Definition for Win32 Export directives.
+// This file is generated automatically by generate_export_file.pl
+// ------------------------------
+#ifndef TAO_STRATEGIES_EXPORT_H
+#define TAO_STRATEGIES_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if defined (TAO_AS_STATIC_LIBS)
+# if !defined (TAO_STRATEGIES_HAS_DLL)
+# define TAO_STRATEGIES_HAS_DLL 0
+# endif /* ! TAO_STRATEGIES_HAS_DLL */
+#else
+# if !defined (TAO_STRATEGIES_HAS_DLL)
+# define TAO_STRATEGIES_HAS_DLL 1
+# endif /* ! TAO_STRATEGIES_HAS_DLL */
+#endif
+
+#if defined (TAO_STRATEGIES_HAS_DLL) && (TAO_STRATEGIES_HAS_DLL == 1)
+# if defined (TAO_STRATEGIES_BUILD_DLL)
+# define TAO_Strategies_Export ACE_Proper_Export_Flag
+# define TAO_STRATEGIES_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# define TAO_STRATEGIES_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# else /* TAO_STRATEGIES_BUILD_DLL */
+# define TAO_Strategies_Export ACE_Proper_Import_Flag
+# define TAO_STRATEGIES_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# define TAO_STRATEGIES_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# endif /* TAO_STRATEGIES_BUILD_DLL */
+#else /* TAO_STRATEGIES_HAS_DLL == 1 */
+# define TAO_Strategies_Export
+# define TAO_STRATEGIES_SINGLETON_DECLARATION(T)
+# define TAO_STRATEGIES_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+#endif /* TAO_STRATEGIES_HAS_DLL == 1 */
+
+#endif /* TAO_STRATEGIES_EXPORT_H */
+
+// End of auto generated file.
diff --git a/TAO/tao/Strategies/uiop_endpoints.pidl b/TAO/tao/Strategies/uiop_endpoints.pidl
new file mode 100644
index 00000000000..239a54b7824
--- /dev/null
+++ b/TAO/tao/Strategies/uiop_endpoints.pidl
@@ -0,0 +1,39 @@
+// $Id$
+
+/**
+ * This file contains idl definition for data structures used to
+ * encapsulate data in TAO_TAG_ENDPOINTS tagged component. This
+ * TAO-specific component is used for transmission of multiple
+ * endpoints per single profile. Data structures defined here are
+ * used for transmission of UIOP Endpoints. See UIOP_Profile.* for
+ * more details.
+ *
+ * This file was used to generate the code in
+ * uiop_endpoints.* The command used to generate code
+ * is:
+ *
+ * tao_idl
+ * -o orig -Gp -Gd -Ge 1 -Sa -DCORBA3 -Sci
+ * -Wb,export_macro=TAO_Strategies_Export \
+ * -Wb,export_include="strategies_export.h" \
+ * -Wb,pre_include="ace/pre.h" \
+ * -Wb,post_include="ace/post.h" \
+ * uiop_endpoints.pidl
+ */
+
+#ifndef _UIOP_ENDPOINTS_IDL_
+#define _UIOP_ENDPOINTS_IDL_
+
+/// Stores information for a single UIOP endpoint.
+struct TAO_UIOP_Endpoint_Info
+{
+ string rendezvous_point;
+ short priority;
+};
+
+/// Stores information for a collection of UIOP endpoints.
+typedef sequence <TAO_UIOP_Endpoint_Info> TAO_UIOPEndpointSequence;
+
+#pragma prefix ""
+
+#endif /* _UIOP_ENDPOINTS_IDL_ */
diff --git a/TAO/tao/StringSeq.pidl b/TAO/tao/StringSeq.pidl
new file mode 100644
index 00000000000..7140ff2ac44
--- /dev/null
+++ b/TAO/tao/StringSeq.pidl
@@ -0,0 +1,30 @@
+// -*- IDL -*-
+//
+// $Id$
+
+// ================================================================
+//
+// This file was used to generate the code in StringSeqC.*
+// The command used to generate code is:
+//
+// tao_idl
+// -o orig -Ge 1 -GA -SS -Sci
+// -Wb,export_macro=TAO_Export
+// -Wb,pre_include="ace/pre.h"
+// -Wb,post_include="ace/post.h"
+// StringSeq.pidl
+//
+// ================================================================
+
+
+#ifndef TAO_CORBA_STRING_SEQ_IDL
+#define TAO_CORBA_STRING_SEQ_IDL
+
+#pragma prefix "omg.org"
+
+module CORBA
+{
+ typedef sequence<string> StringSeq;
+};
+
+#endif /* TAO_CORBA_STRING_SEQ_IDL */
diff --git a/TAO/tao/String_Alloc.cpp b/TAO/tao/String_Alloc.cpp
new file mode 100644
index 00000000000..253542123b4
--- /dev/null
+++ b/TAO/tao/String_Alloc.cpp
@@ -0,0 +1,102 @@
+#include "String_Alloc.h"
+
+#include "ace/OS_NS_string.h"
+#include "ace/OS_NS_wchar.h"
+#include "ace/OS_Memory.h"
+
+// FUZZ: disable check_for_streams_include
+#include "ace/streams.h"
+
+ACE_RCSID (tao,
+ String_Alloc,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+char *
+CORBA::string_dup (const char *str)
+{
+ if (!str)
+ {
+ errno = EINVAL;
+ return 0;
+ }
+
+ size_t const len = ACE_OS::strlen (str);
+
+ // This allocates an extra byte for the '\0';
+ char * copy = CORBA::string_alloc (static_cast<CORBA::ULong> (len));
+
+ if (copy != 0)
+ {
+ // The memcpy() assumes that the destination is a valid buffer.
+ ACE_OS::memcpy (copy,
+ str,
+ len + 1);
+ }
+
+ return copy;
+}
+
+char *
+CORBA::string_alloc (CORBA::ULong len)
+{
+ // Allocate 1 + strlen to accomodate the null terminating character.
+ char *s = 0;
+ ACE_NEW_RETURN (s,
+ char[size_t (len + 1)],
+ 0);
+
+ s[0]= '\0';
+
+ return s;
+}
+
+void
+CORBA::string_free (char *str)
+{
+ delete [] str;
+}
+
+// ****************************************************************
+
+CORBA::WChar*
+CORBA::wstring_dup (const WChar *const str)
+{
+ if (!str)
+ {
+ errno = EINVAL;
+ return 0;
+ }
+
+ CORBA::WChar* retval =
+ CORBA::wstring_alloc (static_cast <CORBA::ULong> (ACE_OS::strlen (str)));
+
+ // The wscpy() below assumes that the destination is a valid buffer.
+ if (retval == 0)
+ {
+ return 0;
+ }
+
+ return ACE_OS::wscpy (retval,
+ str);
+}
+
+CORBA::WChar*
+CORBA::wstring_alloc (CORBA::ULong len)
+{
+ CORBA::WChar *s = 0;
+ ACE_NEW_RETURN (s,
+ CORBA::WChar [(size_t) (len + 1)],
+ 0);
+
+ return s;
+}
+
+void
+CORBA::wstring_free (CORBA::WChar *const str)
+{
+ delete [] str;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/String_Alloc.h b/TAO/tao/String_Alloc.h
new file mode 100644
index 00000000000..6537f97b44b
--- /dev/null
+++ b/TAO/tao/String_Alloc.h
@@ -0,0 +1,57 @@
+// -*- C++ -*-
+//=============================================================================
+/**
+ * @file String_Alloc.h
+ *
+ * $Id$
+ *
+ * Header file for the CORBA string types.
+ *
+ * @author DOC Group at Wash U, UCI, and Vanderbilt U.
+ */
+//=============================================================================
+
+#ifndef TAO_STRING_ALLOC_H
+#define TAO_STRING_ALLOC_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/TAO_Export.h"
+#include "tao/Basic_Types.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace CORBA
+{
+ /**
+ * @name CORBA String Memory Management
+ *
+ * CORBA string memory management functions.
+ */
+ //@{
+ TAO_Export char * string_alloc (ULong len);
+ TAO_Export char * string_dup (const char *);
+ TAO_Export void string_free (char *);
+ //@}
+
+ /**
+ * @name CORBA Wide String Memory Management
+ *
+ * CORBA wide string memory management functions.
+ */
+ //@{
+ TAO_Export WChar * wstring_alloc (ULong len);
+ TAO_Export WChar * wstring_dup (const WChar * const);
+ TAO_Export void wstring_free (WChar * const);
+ //@}
+} // End CORBA namespace.
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_STRING_ALLOC_H */
diff --git a/TAO/tao/String_Manager_T.h b/TAO/tao/String_Manager_T.h
new file mode 100644
index 00000000000..a64b55c829a
--- /dev/null
+++ b/TAO/tao/String_Manager_T.h
@@ -0,0 +1,140 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file String_Manager_T.h
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen <jwillemsen@remedy.nl>
+ */
+//=============================================================================
+
+#ifndef TAO_STRING_MANAGER_T
+#define TAO_STRING_MANAGER_T
+
+#include /**/ "ace/pre.h"
+
+#include "tao/TAO_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Basic_Types.h"
+#include "tao/String_Traits_Base_T.h"
+
+#include <algorithm>
+
+/****************************************************************/
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+template <typename charT>
+class String_Manager_T
+{
+public:
+ typedef charT character_type;
+ typedef TAO::details::string_traits_base <charT> s_traits;
+
+ /// Default CTOR will initialize the underlying ptr_ to empty string.
+ inline String_Manager_T (void) : ptr_ (s_traits::default_initializer())
+ {
+ }
+
+ /// Copy constructor
+ inline String_Manager_T (const String_Manager_T<charT> &rhs) :
+ ptr_ (s_traits::duplicate (rhs.ptr_))
+ {
+ }
+
+ /// Constructor from const char* makes a copy.
+ inline String_Manager_T (const character_type *s) :
+ ptr_ (s_traits::duplicate (s))
+ {
+ }
+
+ /// Destructor
+ inline ~String_Manager_T (void) {
+ s_traits::release (this->ptr_);
+ }
+
+ /// Assignment from another managed type
+ inline String_Manager_T &operator= (const String_Manager_T<charT> &rhs) {
+ // Strongly exception safe by means of copy and non-throwing swap
+ // technique.
+ String_Manager_T <character_type> tmp (rhs);
+ std::swap (this->ptr_, tmp.ptr_);
+ return *this;
+ }
+
+ /// Assignment from var type will make a copy
+ inline String_Manager_T &operator= (const typename s_traits::string_var& value) {
+ // Strongly exception safe by means of copy and non-throwing swap
+ // technique.
+ String_Manager_T <character_type> tmp (value.in ());
+ std::swap (this->ptr_, tmp.ptr_);
+ return *this;
+ }
+
+ /// Assignment from a constant * will make a copy
+ inline String_Manager_T &operator= (const character_type *p) {
+ // Strongly exception safe by means of copy and non-throwing swap
+ // technique.
+ String_Manager_T <character_type> tmp (p);
+ std::swap (this->ptr_, tmp.ptr_);
+ return *this;
+ }
+
+ /// Assignment from char* will not make a copy. The String_Manager_T will now
+ /// own the string.
+ inline String_Manager_T &operator= (character_type *p) {
+ s_traits::release (this->ptr_);
+ this->ptr_ = p;
+ return *this;
+ }
+
+ /// Cast (read-only)
+ inline operator const character_type*() const {
+ return this->ptr_;
+ }
+
+ /// For in parameter.
+ inline const character_type *in (void) const {
+ return this->ptr_;
+ }
+
+ /// For inout parameter.
+ inline character_type *&inout (void) {
+ return this->ptr_;
+ }
+
+ /// for out parameter.
+ inline character_type *&out (void) {
+ s_traits::release (this->ptr_);
+ this->ptr_ = 0;
+ return this->ptr_;
+ }
+
+ /// For string of return type.
+ inline character_type *_retn (void) {
+ character_type *temp = this->ptr_;
+ this->ptr_ = 0;
+ return temp;
+ }
+
+private:
+ /// The underlying string
+ character_type *ptr_;
+};
+
+ typedef TAO::String_Manager_T<CORBA::Char> String_Manager;
+ typedef TAO::String_Manager_T<CORBA::WChar> WString_Manager;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_STRING_MANAGER_T */
diff --git a/TAO/tao/String_Sequence_Element_T.h b/TAO/tao/String_Sequence_Element_T.h
new file mode 100644
index 00000000000..9d7a2bec549
--- /dev/null
+++ b/TAO/tao/String_Sequence_Element_T.h
@@ -0,0 +1,128 @@
+#ifndef guard_string_sequence_element_hpp
+#define guard_string_sequence_element_hpp
+/**
+ * @file
+ *
+ * @brief Implement the type returned by operator[] in string
+ * sequences.
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan
+ */
+
+#include "tao/Basic_Types.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+namespace details
+{
+
+template<typename traits>
+class string_sequence_element
+{
+public:
+ typedef typename traits::char_type character_type;
+ typedef character_type * value_type;
+ typedef character_type const * const_value_type;
+ typedef typename traits::string_var string_var;
+ typedef typename traits::string_mgr string_mgr;
+
+private:
+ inline string_sequence_element<traits> & pseudo_copy_swap(
+ string_var & rhs)
+ {
+ if (release())
+ {
+ traits::release(*element_);
+ }
+ *element_ = rhs._retn();
+ return *this;
+ }
+
+public:
+ string_sequence_element(
+ value_type & e, CORBA::Boolean release)
+ : element_(&e)
+ , release_(release)
+ {
+ }
+
+ string_sequence_element(
+ string_sequence_element const & rhs)
+ : element_(rhs.element_)
+ , release_(rhs.release_)
+ {
+ }
+
+ ~string_sequence_element()
+ {
+ }
+
+ string_sequence_element & operator=(const_value_type rhs)
+ {
+ string_var tmp(rhs);
+ return pseudo_copy_swap(tmp);
+ }
+
+ string_sequence_element & operator=(value_type rhs)
+ {
+ string_var tmp(rhs);
+ return pseudo_copy_swap(tmp);
+ }
+
+ string_sequence_element & operator=(string_sequence_element const & rhs)
+ {
+ string_var tmp(static_cast<const_value_type>(rhs));
+ return pseudo_copy_swap(tmp);
+ }
+
+ string_sequence_element & operator=(string_var const & rhs)
+ {
+ string_var tmp(rhs);
+ return pseudo_copy_swap(tmp);
+ }
+
+ string_sequence_element & operator=(string_mgr const & rhs)
+ {
+ string_var tmp(rhs.in());
+ return pseudo_copy_swap(tmp);
+ }
+
+ inline operator const_value_type() const
+ {
+ return *this->element_;
+ }
+
+ inline const character_type *in (void) const {
+ return *this->element_;
+ }
+
+ void swap(string_sequence_element & rhs)
+ {
+ std::swap(element_, rhs.element_);
+ std::swap(release_, rhs.release_);
+ }
+
+ CORBA::Boolean release() const
+ {
+ return this->release_;
+ }
+
+private:
+ // This function is not implemented
+ string_sequence_element();
+
+private:
+ value_type * element_;
+ CORBA::Boolean release_;
+};
+
+} // namespace details
+} // namespace CORBA
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif // guard_string_sequence_element_hpp
diff --git a/TAO/tao/String_Traits_Base_T.h b/TAO/tao/String_Traits_Base_T.h
new file mode 100644
index 00000000000..0ab07b3a539
--- /dev/null
+++ b/TAO/tao/String_Traits_Base_T.h
@@ -0,0 +1,112 @@
+#ifndef guard_string_traits_base_hpp
+#define guard_string_traits_base_hpp
+/**
+ * @file
+ *
+ * @brief Isolate the string_traits from the accidental differences
+ * between wstring and string.
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan
+ */
+
+#include "tao/String_Alloc.h"
+#include "ace/CDR_Stream.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+template<typename charT>
+class String_Manager_T;
+
+template<typename charT>
+class String_var;
+
+template<typename charT>
+class String_out;
+
+namespace details
+{
+
+template<typename charT>
+struct string_traits_base
+{
+};
+
+template<>
+struct string_traits_base<char>
+{
+ typedef char char_type;
+ typedef TAO::String_var <char_type> string_var;
+ typedef TAO::String_out <char_type> string_out;
+ typedef TAO::String_Manager_T <char_type> string_mgr;
+ typedef ACE_InputCDR::to_string to_type;
+ typedef ACE_OutputCDR::from_string from_type;
+
+ inline static char_type * default_initializer()
+ {
+ return CORBA::string_dup("");
+ }
+
+ inline static char_type * duplicate(char_type const * s)
+ {
+ return CORBA::string_dup(s);
+ }
+
+ inline static void release(char_type * s)
+ {
+ CORBA::string_free(s);
+ }
+
+ inline static char_type * allocate (CORBA::ULong len)
+ {
+ return CORBA::string_alloc (len);
+ }
+};
+
+template<>
+struct string_traits_base<CORBA::WChar>
+{
+ typedef CORBA::WChar char_type;
+ typedef TAO::String_var <char_type> string_var;
+ typedef TAO::String_out <char_type> string_out;
+ typedef TAO::String_Manager_T <char_type> string_mgr;
+ typedef ACE_InputCDR::to_wstring to_type;
+ typedef ACE_OutputCDR::from_wstring from_type;
+
+ inline static char_type * default_initializer()
+ {
+#if defined(ACE_HAS_WCHAR) || defined(ACE_HAS_XPG4_MULTIBYTE_CHAR)
+ return CORBA::wstring_dup(L"");
+#else
+//#warning "platform not configured with native wchar_t support"
+// static CORBA::WChar empty[] = { 0 };
+ CORBA::WChar empty[] = { 0 };
+ return CORBA::wstring_dup(empty);
+#endif /* 0 */
+ }
+
+ inline static char_type * duplicate(char_type const * s)
+ {
+ return CORBA::wstring_dup(s);
+ }
+
+ inline static void release(char_type * s)
+ {
+ CORBA::wstring_free(s);
+ }
+
+ inline static char_type * allocate (CORBA::ULong len)
+ {
+ return CORBA::wstring_alloc (len);
+ }
+};
+
+} // namespace details
+} // namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif // guard_string_traits_base_hpp
diff --git a/TAO/tao/String_Traits_T.h b/TAO/tao/String_Traits_T.h
new file mode 100644
index 00000000000..3b55b49a011
--- /dev/null
+++ b/TAO/tao/String_Traits_T.h
@@ -0,0 +1,77 @@
+#ifndef guard_string_traits_hpp
+#define guard_string_traits_hpp
+/**
+ * @file
+ *
+ * @brief Implement the element manipulation traits for string types.
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan
+ */
+
+#include "String_Traits_Base_T.h"
+
+#include <algorithm>
+#include <functional>
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+namespace details
+{
+
+template<typename char_type, class derived>
+struct string_traits_decorator
+{
+ typedef char_type * value_type;
+ typedef char_type const * const_value_type;
+
+ inline static void zero_range(
+ char_type ** begin, char_type ** end)
+ {
+ std::fill(begin, end, static_cast<char_type*>(0));
+ }
+
+ inline static void initialize_range(
+ char_type ** begin, char_type ** end)
+ {
+ std::generate(begin, end, &derived::default_initializer);
+ }
+
+ inline static void copy_range(
+ char_type ** begin, char_type ** end, char_type ** dst)
+ {
+ std::transform(begin, end, dst, &derived::duplicate);
+ }
+
+ inline static void release_range(
+ char_type ** begin, char_type ** end)
+ {
+ std::for_each(begin, end, &derived::release);
+ }
+
+ inline static char_type const * initialize_if_zero(char_type * & element)
+ {
+ if (element == 0)
+ {
+ element = derived::default_initializer();
+ }
+ return element;
+ }
+};
+
+template<class charT, bool dummy>
+struct string_traits
+ : public string_traits_base<charT>
+ , public string_traits_decorator<charT,string_traits<charT,dummy> >
+{
+};
+
+} // namespace details
+} // namespace CORBA
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif // guard_string_traits_hpp
diff --git a/TAO/tao/Stub.cpp b/TAO/tao/Stub.cpp
new file mode 100644
index 00000000000..b7a03fdeedc
--- /dev/null
+++ b/TAO/tao/Stub.cpp
@@ -0,0 +1,680 @@
+// $Id$
+
+// Portions Copyright 1995 by Sun Microsystems Inc.
+// Portions Copyright 1997-2002 by Washington University
+// All Rights Reserved
+//
+// Some CORBA::Object and other operations are specific to this STUB
+// based implementation, and can neither be used by other kinds of
+// objref nor have a default implementation.
+
+#include "tao/Stub.h"
+#include "tao/Profile.h"
+#include "tao/ORB_Core.h"
+#include "tao/Client_Strategy_Factory.h"
+#include "tao/Remote_Object_Proxy_Broker.h"
+#include "tao/Transport_Queueing_Strategies.h"
+#include "tao/debug.h"
+#include "tao/Policy_Manager.h"
+#include "tao/SystemException.h"
+#include "tao/CDR.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/Stub.i"
+#endif /* ! __ACE_INLINE__ */
+
+#include "ace/Auto_Ptr.h"
+
+
+ACE_RCSID (tao,
+ TAO_Stub,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Stub::TAO_Stub (const char *repository_id,
+ const TAO_MProfile &profiles,
+ TAO_ORB_Core *orb_core)
+ : type_id (repository_id)
+ , orb_core_ (orb_core)
+ , orb_ ()
+ , is_collocated_ (false)
+ , servant_orb_ ()
+ , collocated_servant_ (0)
+ , object_proxy_broker_ (the_tao_remote_object_proxy_broker ())
+ , base_profiles_ ((CORBA::ULong) 0)
+ , forward_profiles_ (0)
+ , forward_profiles_perm_ (0)
+ , profile_in_use_ (0)
+ , profile_lock_ptr_ (0)
+ , profile_success_ (false)
+ , refcount_ (1)
+#if (TAO_HAS_CORBA_MESSAGING == 1)
+ , policies_ (0)
+#endif /* TAO_HAS_CORBA_MESSAGING == 1 */
+ , ior_info_ (0)
+ , forwarded_ior_info_ (0)
+ , collocation_opt_ (orb_core->optimize_collocation_objects ())
+{
+ if (this->orb_core_.get() == 0)
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO: (%P|%t) TAO_Stub created with default ")
+ ACE_TEXT ("ORB core\n")));
+ }
+
+ this->orb_core_.reset (TAO_ORB_Core_instance ());
+ }
+
+ // Duplicate the ORB_Core, otherwise the allocators and other
+ // resources that this class references (directly or indirectly)
+ // could be destroyed before it is time.
+ (void) this->orb_core_->_incr_refcnt ();
+
+ // Cache the ORB pointer to respond faster to certain queries.
+ this->orb_ = CORBA::ORB::_duplicate (this->orb_core_->orb ());
+
+ this->profile_lock_ptr_ =
+ this->orb_core_->client_factory ()->create_profile_lock ();
+
+ this->base_profiles (profiles);
+}
+
+TAO_Stub::~TAO_Stub (void)
+{
+ ACE_ASSERT (this->refcount_ == 0);
+
+ if (this->forward_profiles_)
+ reset_profiles ();
+
+ if (this->profile_in_use_ != 0)
+ {
+ // decrease reference count on profile
+ this->profile_in_use_->_decr_refcnt ();
+ this->profile_in_use_ = 0;
+ }
+
+ delete this->profile_lock_ptr_;
+
+#if (TAO_HAS_CORBA_MESSAGING == 1)
+
+ delete this->policies_;
+
+#endif /* TAO_HAS_CORBA_MESSAGING == 1 */
+
+ if (this->ior_info_)
+ delete this->ior_info_;
+
+ if (this->forwarded_ior_info_)
+ delete this->forwarded_ior_info_;
+}
+
+void
+TAO_Stub::add_forward_profiles (const TAO_MProfile &mprofiles,
+ const CORBA::Boolean permanent_forward)
+{
+ // we assume that the profile_in_use_ is being
+ // forwarded! Grab the lock so things don't change.
+ ACE_MT (ACE_GUARD (ACE_Lock,
+ guard,
+ *this->profile_lock_ptr_));
+
+ if (permanent_forward)
+ {
+ // paranoid, reset the bookmark, then clear the forward-stack
+ this->forward_profiles_perm_ = 0;
+
+ this->reset_forward ();
+ }
+
+ TAO_MProfile *now_pfiles = this->forward_profiles_;
+ if (now_pfiles == 0)
+ now_pfiles = &this->base_profiles_;
+
+ ACE_NEW (this->forward_profiles_,
+ TAO_MProfile (mprofiles));
+
+ if (permanent_forward)
+ // bookmark the new element at bottom of stack
+ this->forward_profiles_perm_ = this->forward_profiles_;
+
+ // forwarded profile points to the new IOR (profiles)
+ this->profile_in_use_->forward_to (this->forward_profiles_);
+
+ // new profile list points back to the list which was forwarded.
+ this->forward_profiles_->forward_from (now_pfiles);
+
+ // make sure we start at the beginning of mprofiles
+ this->forward_profiles_->rewind ();
+
+ // Since we have been forwarded, we must set profile_success_ to false
+ // since we are starting a new with a new set of profiles!
+ this->profile_success_ = false;
+
+ // Reset any flags that may be appropriate in the services that
+ // selects profiles for invocation
+ this->orb_core_->reset_service_profile_flags ();
+}
+
+int
+TAO_Stub::create_ior_info (IOP::IOR *&ior_info,
+ CORBA::ULong &index
+ ACE_ENV_ARG_DECL)
+{
+ // We are creating the IOR info. Let us not be disturbed. So grab a
+ // lock.
+ ACE_MT (ACE_GUARD_RETURN (ACE_Lock,
+ guard,
+ *this->profile_lock_ptr_,
+ -1));
+
+ IOP::IOR *tmp_info = 0;
+
+ if (this->forward_profiles_ != 0)
+ {
+ if (this->forwarded_ior_info_ == 0)
+ {
+ this->get_profile_ior_info (*this->forward_profiles_,
+ tmp_info
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ this->forwarded_ior_info_ = tmp_info;
+ }
+
+ // First we look at the forward profiles to see whether the
+ // profile_in_use is any of it.
+ for (CORBA::ULong i = 0;
+ i < this->forward_profiles_->profile_count ();
+ ++i)
+ {
+ if (this->forward_profiles_->get_profile (i)
+ == this->profile_in_use_)
+ {
+ ior_info = this->forwarded_ior_info_;
+ index = i;
+ return 0;
+ }
+ }
+ }
+
+ // Else we look at the base profiles
+ if (this->ior_info_ == 0)
+ {
+ this->get_profile_ior_info (this->base_profiles_,
+ tmp_info
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ this->ior_info_ = tmp_info;
+ }
+
+
+ for (CORBA::ULong ind = 0;
+ ind < this->base_profiles_.profile_count ();
+ ++ind)
+ {
+ if (this->base_profiles_.get_profile (ind) ==
+ this->profile_in_use_)
+ {
+ index = ind;
+ ior_info = this->ior_info_;
+ return 0;
+ }
+ }
+
+ // Error, there was no match
+ return -1;
+}
+
+const TAO::ObjectKey &
+TAO_Stub::object_key (void) const
+{
+ // Return the profile in use's object key if you see one.
+ if (this->profile_in_use_)
+ return this->profile_in_use_->object_key ();
+
+ if (this->forward_profiles_)
+ {
+ // Double-checked
+ ACE_Guard<ACE_Lock> obj (*this->profile_lock_ptr_);
+
+ if (obj.locked () != 0 && this->forward_profiles_ != 0)
+ return this->forward_profiles_->get_profile (0)->object_key ();
+ }
+
+ // If no forwarded profiles, just use the base profile
+ return this->base_profiles_.get_profile (0)->object_key ();
+}
+
+int
+TAO_Stub::get_profile_ior_info (TAO_MProfile &profiles,
+ IOP::IOR *&ior_info
+ ACE_ENV_ARG_DECL)
+{
+
+
+ ACE_NEW_THROW_EX (ior_info,
+ IOP::IOR (),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (-1);
+
+
+ // Get the number of elements
+ CORBA::ULong count = profiles.profile_count ();
+
+ // Set the number of elements in the sequence of tagged_profile
+ ior_info->profiles.length (count);
+
+ // Call the create_tagged_profile one every member of the
+ // profile and make the sequence
+ for (CORBA::ULong index = 0; index < count; ++index)
+ {
+ TAO_Profile *prof = profiles.get_profile (index);
+
+ IOP::TaggedProfile *tp =
+ prof->create_tagged_profile ();
+
+ if (tp == 0)
+ ACE_THROW_RETURN (CORBA::NO_MEMORY (),
+ -1);
+ ior_info->profiles[index] = *tp;
+ }
+
+ return 0;
+}
+
+void
+TAO_Stub::is_collocated (CORBA::Boolean collocated)
+{
+ if (this->is_collocated_ != collocated)
+ {
+ if (collocated &&
+ _TAO_Object_Proxy_Broker_Factory_function_pointer != 0)
+ {
+ this->object_proxy_broker_ =
+ _TAO_Object_Proxy_Broker_Factory_function_pointer ();
+ }
+ else
+ {
+ this->object_proxy_broker_ =
+ the_tao_remote_object_proxy_broker ();
+ }
+ this->is_collocated_ = collocated;
+ }
+}
+
+// Quick'n'dirty hash of objref data, for partitioning objrefs into
+// sets.
+//
+// NOTE that this must NOT go across the network!
+
+CORBA::ULong
+TAO_Stub::hash (CORBA::ULong max
+ ACE_ENV_ARG_DECL)
+{
+ // we rely on the profile objects that its address info
+ return this->base_profiles_.hash (max ACE_ENV_ARG_PARAMETER);
+}
+
+// Expensive comparison of objref data, to see if two objrefs
+// certainly point at the same object. (It's quite OK for this to
+// return FALSE, and yet have the two objrefs really point to the same
+// object.)
+//
+// NOTE that this must NOT go across the network!
+// @@ Two object references are the same if any two profiles are the
+// same! This function is only test the profile in use!!!
+CORBA::Boolean
+TAO_Stub::is_equivalent (CORBA::Object_ptr other_obj)
+{
+ if (CORBA::is_nil (other_obj))
+ return false;
+
+ TAO_Profile * const other_profile = other_obj->_stubobj ()->profile_in_use_;
+ TAO_Profile * const this_profile = this->profile_in_use_;
+
+ if (other_profile == 0 || this_profile == 0)
+ return false;
+
+ // Compare the profiles
+ return this_profile->is_equivalent (other_profile);
+}
+
+// Memory managment
+
+void
+TAO_Stub::_incr_refcnt (void)
+{
+ ++this->refcount_;
+}
+
+void
+TAO_Stub::_decr_refcnt (void)
+{
+ if (--this->refcount_ == 0)
+ delete this;
+}
+
+TAO_Profile *
+TAO_Stub::set_profile_in_use_i (TAO_Profile *pfile)
+{
+ TAO_Profile *const old = this->profile_in_use_;
+
+ // Since we are actively using this profile we dont want
+ // it to disappear, so increase the reference count by one!!
+ if (pfile && (pfile->_incr_refcnt () == 0))
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) unable to increment profile ref!\n")),
+ 0);
+ }
+
+ this->profile_in_use_ = pfile;
+
+ if (old)
+ old->_decr_refcnt ();
+
+ return this->profile_in_use_;
+}
+
+void
+TAO_Stub::forward_back_one (void)
+{
+ TAO_MProfile *from = forward_profiles_->forward_from ();
+
+ delete this->forward_profiles_;
+
+ // the current profile in this profile list is no
+ // longer being forwarded, so set the reference to zero.
+ if (from == &this->base_profiles_)
+ {
+ this->base_profiles_.get_current_profile ()->forward_to (0);
+ this->forward_profiles_ = 0;
+ }
+ else
+ {
+ from->get_current_profile ()->forward_to (0);
+ this->forward_profiles_ = from;
+ }
+}
+
+
+// Note that if the repository ID (typeID) is NULL, it will make
+// narrowing rather expensive, though it does ensure that type-safe
+// narrowing code gets thoroughly exercised/debugged! Without a
+// typeID, the _narrow will be required to make an expensive remote
+// "is_a" call.
+
+// THREADING NOTE: Code below this point is of course thread-safe (at
+// least on supported threaded platforms), so the caller of these
+// routines need only ensure that the data being passed in is not
+// being modified by any other thread.
+//
+// As an _experiment_ (to estimate the performance cost) remote calls
+// are currently deemed "cancel-safe". That means that they can be
+// called by threads when they're in asynchronous cancellation mode.
+// The only effective way to do this is to disable async cancellation
+// for the duration of the call. There are numerous rude interactions
+// with code generators for C++ ... cancellation handlers just do
+// normal stack unwinding like exceptions, but exceptions are purely
+// synchronous and sophisticated code generators rely on that to
+// generate better code, which in some cases may be very hard to
+// unwind.
+
+class TAO_Synchronous_Cancellation_Required
+// = TITLE
+// Stick one of these at the beginning of a block that can't
+// support asynchronous cancellation, and which must be
+// cancel-safe.
+//
+// = EXAMPLE
+// somefunc()
+// {
+// TAO_Synchronous_Cancellation_Required NOT_USED;
+// ...
+// }
+{
+public:
+ // These should probably be in a separate inline file, but they're
+ // only used within this one file right now, and we always want them
+ // inlined, so here they sit.
+ TAO_Synchronous_Cancellation_Required (void)
+ : old_type_ (0)
+ {
+#if !defined (VXWORKS)
+ ACE_OS::thr_setcanceltype (THR_CANCEL_DEFERRED, &old_type_);
+#endif /* ! VXWORKS */
+ }
+
+ ~TAO_Synchronous_Cancellation_Required (void)
+ {
+#if !defined (VXWORKS)
+ int dont_care;
+ ACE_OS::thr_setcanceltype(old_type_, &dont_care);
+#endif /* ! VXWORKS */
+ }
+private:
+ int old_type_;
+};
+
+// ****************************************************************
+
+#if (TAO_HAS_CORBA_MESSAGING == 1)
+
+// Some policies can only be set locally on the client, while others
+// can only be exported in the IOR by the server, and yet others can
+// be set by both by client and server. Furthermore, reconciliation
+// between client-set values and the ones exported in the IOR is
+// policy-specific. Therefore, with the current state of things, it
+// isn't possible to write generic code for <get_policy> that will
+// work for any policy type. Currently, we take specific action for
+// each of the known client-exposed policies (above), and simply look
+// up effective override for any other policy type (below). Later, if
+// there is a need/desire for generic code, it can be done by pushing
+// the smarts into the policies implementations, and will involve
+// modifying PolicyC* and friends, e.g., to add methods for policy
+// specific reconciliation, etc.
+
+CORBA::Policy_ptr
+TAO_Stub::get_policy (CORBA::PolicyType type
+ ACE_ENV_ARG_DECL)
+{
+ // No need to lock, the stub only changes its policies at
+ // construction time...
+
+ CORBA::Policy_var result;
+ if (this->policies_ != 0)
+ {
+ result =
+ this->policies_->get_policy (type
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK (CORBA::Policy::_nil ());
+ }
+
+ if (CORBA::is_nil (result.in ()))
+ {
+ result =
+ this->orb_core_->get_policy_including_current (type
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK (CORBA::Policy::_nil ());
+ }
+
+ return result._retn ();
+}
+
+CORBA::Policy_ptr
+TAO_Stub::get_cached_policy (TAO_Cached_Policy_Type type
+ ACE_ENV_ARG_DECL)
+{
+ // No need to lock, the stub only changes its policies at
+ // construction time...
+
+ CORBA::Policy_var result;
+ if (this->policies_ != 0)
+ {
+ result =
+ this->policies_->get_cached_policy (type
+ ACE_ENV_ARG_PARAMETER);
+
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+
+ }
+
+ if (CORBA::is_nil (result.in ()))
+ {
+ result =
+ this->orb_core_->get_cached_policy_including_current (type
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+ }
+
+ return result._retn ();
+}
+
+TAO_Stub *
+TAO_Stub::set_policy_overrides (const CORBA::PolicyList & policies,
+ CORBA::SetOverrideType set_add
+ ACE_ENV_ARG_DECL)
+{
+ // Notice the use of an explicit constructor....
+ auto_ptr<TAO_Policy_Set> policy_manager (
+ new TAO_Policy_Set (TAO_POLICY_OBJECT_SCOPE));
+
+ if (set_add == CORBA::SET_OVERRIDE)
+ {
+ policy_manager->set_policy_overrides (policies,
+ set_add
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+ }
+ else if (this->policies_ == 0)
+ {
+ policy_manager->set_policy_overrides (policies,
+ CORBA::SET_OVERRIDE
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+ }
+ else
+ {
+ policy_manager->copy_from (this->policies_
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ policy_manager->set_policy_overrides (policies,
+ set_add
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+ }
+
+ TAO_Stub* stub = this->orb_core_->create_stub (this->type_id.in (),
+ this->base_profiles_
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ stub->policies_ = policy_manager.release ();
+
+ // Copy the servant ORB if it is present.
+ stub->servant_orb (this->servant_orb_var ().in ());
+
+ return stub;
+}
+
+CORBA::PolicyList *
+TAO_Stub::get_policy_overrides (const CORBA::PolicyTypeSeq &types
+ ACE_ENV_ARG_DECL)
+{
+ if (this->policies_ == 0)
+ return 0;
+
+ return this->policies_->get_policy_overrides (types
+ ACE_ENV_ARG_PARAMETER);
+}
+
+#endif /* TAO_HAS_CORBA_MESSAGING == 1 */
+
+TAO::Transport_Queueing_Strategy &
+TAO_Stub::transport_queueing_strategy (void)
+{
+#if (TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1)
+
+ bool has_synchronization;
+ Messaging::SyncScope scope;
+
+ this->orb_core_->call_sync_scope_hook (this,
+ has_synchronization,
+ scope);
+
+ if (has_synchronization == true)
+ return this->orb_core_->get_transport_queueing_strategy (this,
+ scope);
+
+#endif /* TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1 */
+
+ return this->orb_core_->default_transport_queueing_strategy ();
+}
+
+CORBA::Boolean
+TAO_Stub::marshal (TAO_OutputCDR &cdr)
+{
+ // do as many outside of locked else-branch as posssible
+
+ // STRING, a type ID hint
+ if ((cdr << this->type_id.in()) == 0)
+ return 0;
+
+ if ( ! this->forward_profiles_perm_)
+ {
+ const TAO_MProfile& mprofile = this->base_profiles_;
+
+ CORBA::ULong profile_count = mprofile.profile_count ();
+ if ((cdr << profile_count) == 0)
+ return 0;
+
+ // @@ The MProfile should be locked during this iteration, is there
+ // anyway to achieve that?
+ for (CORBA::ULong i = 0; i < profile_count; ++i)
+ {
+ const TAO_Profile* p = mprofile.get_profile (i);
+ if (p->encode (cdr) == 0)
+ return 0;
+ }
+ }
+ else
+ {
+ ACE_MT (ACE_GUARD_RETURN (ACE_Lock,
+ guard,
+ *this->profile_lock_ptr_,
+ 0));
+
+ ACE_ASSERT(this->forward_profiles_ !=0);
+
+ // paranoid - in case of FT the basic_profiles_ would do, too,
+ // but might be dated
+ const TAO_MProfile& mprofile =
+ this->forward_profiles_perm_
+ ? *(this->forward_profiles_perm_)
+ : this->base_profiles_;
+
+ CORBA::ULong profile_count = mprofile.profile_count ();
+ if ((cdr << profile_count) == 0)
+ return 0;
+
+ // @@ The MProfile should be locked during this iteration, is there
+ // anyway to achieve that?
+ for (CORBA::ULong i = 0; i < profile_count; ++i)
+ {
+ const TAO_Profile* p = mprofile.get_profile (i);
+ if (p->encode (cdr) == 0)
+ return 0;
+ }
+
+ // release ACE_Lock
+ }
+
+ return (CORBA::Boolean) cdr.good_bit ();
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Stub.h b/TAO/tao/Stub.h
new file mode 100644
index 00000000000..000be6649a4
--- /dev/null
+++ b/TAO/tao/Stub.h
@@ -0,0 +1,452 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Stub.h
+ *
+ * $Id$
+ *
+ * @author Portions Copyright 1994-1995 by Sun Microsystems Inc.
+ * @author Portions Copyright 1997-2002 by Washington University
+ */
+//=============================================================================
+
+#ifndef TAO_STUB_H
+#define TAO_STUB_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/ORB.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/MProfile.h"
+#include "tao/ORB_Core_Auto_Ptr.h"
+
+#include "ace/Atomic_Op.h"
+
+#if defined (HPUX) && defined (IOR)
+ /* HP-UX 11.11 defines IOR in /usr/include/pa/inline.h
+ and we don't want that definition. See IOP_IORC.h. */
+# undef IOR
+#endif /* HPUX && IOR */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Forward declarations.
+class TAO_Abstract_ServantBase;
+class TAO_Policy_Set;
+class TAO_Profile;
+
+namespace TAO
+{
+ class ObjectKey;
+ class Object_Proxy_Broker;
+ class Transport_Queueing_Strategy;
+}
+
+namespace IOP
+{
+ struct IOR;
+}
+
+/**
+ * @class TAO_Stub
+ *
+ * @brief TAO_Stub
+ *
+ * Per-objref data includes the (protocol-specific) Profile, which
+ * is handled by placing it into a subclass of this type along
+ * with data that may be used in protocol-specific caching
+ * schemes.
+ * The type ID (the data specified by CORBA 2.0 that gets exposed
+ * "on the wire", and in stringified objrefs) is held by this
+ * module.
+ * The stub APIs are member functions of this type.
+ */
+class TAO_Export TAO_Stub
+{
+public:
+#if (TAO_HAS_CORBA_MESSAGING == 1)
+
+ /**
+ * Returns the effective policy if @a type is a known client-exposed
+ * policy type. Returns the effective override for all other policy
+ * types.
+ */
+ virtual CORBA::Policy_ptr get_policy (CORBA::PolicyType type
+ ACE_ENV_ARG_DECL);
+
+ virtual CORBA::Policy_ptr get_cached_policy (TAO_Cached_Policy_Type type
+ ACE_ENV_ARG_DECL);
+
+ virtual TAO_Stub* set_policy_overrides (const CORBA::PolicyList & policies,
+ CORBA::SetOverrideType set_add
+ ACE_ENV_ARG_DECL);
+
+ virtual CORBA::PolicyList *get_policy_overrides (
+ const CORBA::PolicyTypeSeq & types
+ ACE_ENV_ARG_DECL);
+
+#endif /* TAO_HAS_CORBA_MESSAGING == 1 */
+
+ /// Return the queueing strategy to be used in by the transport.
+ /// Selection will be based on the SyncScope policies.
+ TAO::Transport_Queueing_Strategy &transport_queueing_strategy (void);
+
+ /// All objref representations carry around a type ID.
+ CORBA::String_var type_id;
+
+ /**
+ * All objref representations know how to hash themselves and
+ * compare themselves for equivalence to others. It's easily
+ * possible to have two objrefs that are distinct copies of data
+ * that refers/points to the same remote object (i.e. are
+ * equivalent).
+ */
+ CORBA::ULong hash (CORBA::ULong maximum
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ /// Implement the is_equivalent() method for the CORBA::Object
+ CORBA::Boolean is_equivalent (CORBA::Object_ptr other_obj);
+
+ // Our Constructors ...
+
+ /// Construct from a repository ID and a list of profiles.
+ TAO_Stub (const char *repository_id,
+ const TAO_MProfile &profiles,
+ TAO_ORB_Core *orb_core);
+
+ // = Memory management.
+ void _incr_refcnt (void);
+ void _decr_refcnt (void);
+
+ /// Return the Profile lock. This lock can be used at places where
+ /// profiles need to be edited.
+ ACE_Lock *profile_lock (void) const;
+
+ // Manage the base (non-forwarded) profiles.
+ /// returns a pointer to the profile_in_use object. This object
+ /// retains ownership of this profile.
+ TAO_Profile *profile_in_use (void);
+
+ /// Return the ObjectKey
+ const TAO::ObjectKey &object_key (void) const;
+
+ /**
+ * Copy of the profile list, user must free memory when done.
+ * although the user can call make_profiles() then reorder
+ * the list and give it back to TAO_Stub.
+ */
+ TAO_MProfile *make_profiles (void);
+
+ /// Obtain a reference to the basic profile set.
+ const TAO_MProfile& base_profiles (void) const;
+
+ /// Obtain a reference to the basic profile set.
+ TAO_MProfile& base_profiles (void);
+
+ /// Obtain a pointer to the forwarded profile set
+ const TAO_MProfile *forward_profiles (void) const;
+
+ /// True if permanent location forward occured, in this case the lock must be set and the
+
+ // Manage forward and base profiles.
+ /**
+ * THREAD SAFE. If forward_profiles is null then this will
+ * get the next profile in the base_profiles list. If forward is not null
+ * then this will get the next profile for the list of forwarding
+ * profiles. If all profiles have been tried then 0 is returned and
+ * profile_in_use_ is set to the first profile in the base_profiles
+ * list.
+ */
+ TAO_Profile *next_profile (void);
+
+ /**
+ * THREAD SAFE
+ * this method will reset the base profile list to reference the first
+ * profile and if there are anmy existing forward profiles they are
+ * reset.
+ */
+ void reset_profiles (void);
+
+ /// Returns 1 if a forward profile has successfully been used.
+ /// profile_success_ && forward_profiles_
+ CORBA::Boolean valid_forward_profile (void);
+
+ /// NON-THREAD-SAFE. Will set profile_success_ to 0.
+ void set_valid_profile (void);
+
+ /// Returns TRUE if a connection was successful with at least
+ /// one profile.
+ CORBA::Boolean valid_profile (void) const;
+
+ /// Initialize the base_profiles_ and set profile_in_use_ to
+ /// reference the first profile.
+ TAO_Profile *base_profiles (const TAO_MProfile& mprofiles);
+
+ /**
+ * THREAD SAFE.
+ * Set the forward_profiles. This object will assume ownership of
+ * this TAO_MProfile object!! if permanent_forward is true,
+ * currently used profiles will be replaced permanently, otherwise
+ * stub may fallback to current profiles later. The flag
+ * permanent_forward=true is only valid if currently used profile
+ * set represents a GroupObject (IOGR), otherwise this flag will be
+ * ignored.
+ */
+ void add_forward_profiles (const TAO_MProfile &mprofiles,
+ const CORBA::Boolean permanent_forward=false);
+
+ /**
+ * THREAD SAFE
+ * Used to get the next profile after the one being used has
+ * failed during the initial connect or send of the message!
+ */
+ CORBA::Boolean next_profile_retry (void);
+
+ /// Accessor.
+ TAO_ORB_Core* orb_core (void) const;
+
+ /// Is this stub collocated with the servant?
+ CORBA::Boolean is_collocated (void) const;
+
+ /// Mutator to mark this stub as being collocated with the servant.
+ void is_collocated (CORBA::Boolean);
+
+ /// This returns a duplicated ORB pointer.
+ CORBA::ORB_ptr servant_orb_ptr (void);
+
+ /// This returns the ORB var itself (generally for temporary use).
+ CORBA::ORB_var &servant_orb_var (void);
+
+ /**
+ * Accesor and mutator for the servant ORB. Notice that the mutator
+ * assumes the ownership of the passed in ORB and the accesor does not
+ * return a copy of the orb since the accessing of the ORB is considered
+ * temporary.
+ */
+ void servant_orb (CORBA::ORB_ptr orb);
+
+ /// Mutator for setting the servant in collocated cases.
+ void collocated_servant (TAO_Abstract_ServantBase* servant);
+
+ /// Accessor for the servant reference in collocated cases.
+ TAO_Abstract_ServantBase* collocated_servant (void) const;
+
+ /// Mutator for setting the object proxy broker pointer.
+ /// CORBA::Objects using this stub will use this for standard calls
+ /// like is_a; get_interface; etc...
+ void object_proxy_broker (TAO::Object_Proxy_Broker *proxy_broker);
+
+ /// Accessor for getting the object proxy broker pointer.
+ /// CORBA::Objects using this stub use this for standard calls
+ /// like is_a; get_interface; etc...
+ TAO::Object_Proxy_Broker *object_proxy_broker (void) const;
+
+ /**
+ * Create the IOP::IOR info. We will create the info at most once.
+ * Get the index of the profile we are using to make the invocation.
+ */
+ int create_ior_info (IOP::IOR *&ior_info,
+ CORBA::ULong &index
+ ACE_ENV_ARG_DECL);
+
+ /// Deallocate the TAO_Stub object.
+ /**
+ * This method is intended to be used only by the CORBA::Object
+ * class.
+ */
+ void destroy (void);
+
+ /// Return the cached value from the ORB_Core.
+ /**
+ * This flag indicates whether the stub code should make use of the
+ * collocation opportunities that are available to the ORB.
+ */
+ CORBA::Boolean optimize_collocation_objects (void) const;
+
+ /// Needed to avoid copying forward_profiles for thread safety
+ CORBA::Boolean marshal (TAO_OutputCDR&);
+
+protected:
+
+ /// Destructor is to be called only through _decr_refcnt() to
+ /// enforce proper reference counting.
+ virtual ~TAO_Stub (void);
+
+ /// NON-THREAD SAFE version of reset_profiles (void);
+ void reset_profiles_i (void);
+
+ /// NON-THREAD SAFE version of next_profile (void)
+ TAO_Profile *next_profile_i (void);
+
+private:
+ /// Makes a copy of the profile and frees the existing profile_in_use.
+ /// NOT THREAD SAFE
+ TAO_Profile *set_profile_in_use_i (TAO_Profile *pfile);
+
+ /// NON-THREAD-SAFE. Utility method which resets or initializes
+ /// the base_profile list and forward flags.
+ void reset_base ();
+
+ /// NON-THREAD-SAFE. Utility method which unrolls (removes or pops)
+ /// the top most forwarding profile list.
+ void forward_back_one (void);
+
+ /// NOT THREAD-SAFE. Utility method which pops all forward profile
+ /// lists and resets the forward_profiles_ pointer.
+ void reset_forward ();
+
+ /// NON-THREAD-SAFE. utility method for next_profile.
+ TAO_Profile *next_forward_profile (void);
+
+ /// THREAD-SAFE Create the IOR info
+ int get_profile_ior_info (TAO_MProfile &profile,
+ IOP::IOR *&ior_info
+ ACE_ENV_ARG_DECL);
+
+private:
+
+ // = Disallow copy construction and assignment.
+ TAO_Stub (const TAO_Stub &);
+ TAO_Stub &operator = (const TAO_Stub &);
+
+protected:
+ /// Automatically manage the ORB_Core reference count
+ /**
+ * The ORB_Core cannot go away until the object references it
+ * creates are destroyed. There are multiple reasons for this, but
+ * in particular, the allocators used for some of the TAO_Profile
+ * objects contained on each TAO_Stub are owned by the TAO_ORB_Core.
+ *
+ * This <B>must</B> be the first field of the class, otherwise the
+ * TAO_ORB_Core is destroyed too early!
+ *
+ */
+ TAO_ORB_Core_Auto_Ptr orb_core_;
+
+ /// ORB required for reference counting. This will help us keep the
+ /// ORB around until the CORBA::Object we represent dies.
+ /**
+ * @todo Why do we need both a reference to the ORB_Core and its
+ * ORB? It think the memory management rules for the ORB_Core
+ * changed, in the good old days it was the CORBA::ORB class
+ * who owned the ORB_Core, now it is the other way around....
+ */
+ CORBA::ORB_var orb_;
+
+ /// Flag that indicates that this stub is collocated (and that it
+ /// belongs to an ORB for which collocation optimisation is active).
+ CORBA::Boolean is_collocated_;
+
+ /**
+ * If this stub refers to a collocated object then we need to hold on to
+ * the servant's ORB (which may be different from the client ORB) so that,
+ * 1. we know that the ORB will stay alive long enough, and,
+ * 2. we can search for the servant/POA's status starting from
+ * the ORB's RootPOA.
+ */
+ CORBA::ORB_var servant_orb_;
+
+ /// Servant pointer. It is 0 except for collocated objects.
+ TAO_Abstract_ServantBase *collocated_servant_;
+
+ /// Pointer to the Proxy Broker
+ /**
+ * This cached pointer instance takes care of routing the call for
+ * standard calls in CORBA::Object like _is_a (), _get_component
+ * () etc.
+ */
+ TAO::Object_Proxy_Broker *object_proxy_broker_;
+
+
+ /// Ordered list of profiles for this object.
+ TAO_MProfile base_profiles_;
+
+ /// The list of forwarding profiles. This is actually implemented as a
+ /// linked list of TAO_MProfile objects.
+ TAO_MProfile *forward_profiles_;
+
+ // The bookmark indicating permanent forward occured,
+ // the pointer is used to indentify bottom of stack forward_profiles_
+ TAO_MProfile *forward_profiles_perm_;
+
+ /// This is the profile that we are currently sending/receiving with.
+ TAO_Profile *profile_in_use_;
+
+ /// Mutex to protect access to the forwarding profile.
+ ACE_Lock* profile_lock_ptr_;
+
+ /// Have we successfully talked to the forward profile yet?
+ CORBA::Boolean profile_success_;
+
+ /// Reference counter.
+ ACE_Atomic_Op<TAO_SYNCH_MUTEX, unsigned long> refcount_;
+
+ /// The policy overrides in this object, if nil then use the default
+ /// policies.
+ TAO_Policy_Set *policies_;
+
+ /**
+ * The ior info. This is needed for GIOP 1.2, as the clients could
+ * receive an exception from the server asking for this info. The
+ * exception that the client receives is LOC_NEEDS_ADDRESSING_MODE.
+ * The data is set up here to be passed on to Invocation classes
+ * when they receive an exception. This info is for the base
+ * profiles that this class stores
+ */
+ IOP::IOR *ior_info_;
+
+ /// Forwarded IOR info
+ IOP::IOR *forwarded_ior_info_;
+
+ /// TRUE if we want to take advantage of collocation optimization in
+ /// this ORB.
+ /**
+ * This should be the same value as cached in the ORB_Core. The
+ * reason for caching this helps our generated code, notably the
+ * stubs to be decoubled from ORB_Core. Please do not move it away.
+ */
+ const CORBA::Boolean collocation_opt_;
+};
+
+// Define a TAO_Stub auto_ptr class.
+/**
+ * @class TAO_Stub_Auto_Ptr
+ *
+ * @brief Implements the draft C++ standard auto_ptr abstraction.
+ * This class allows one to work Stub Objects *Only*!
+ */
+class TAO_Export TAO_Stub_Auto_Ptr
+{
+public:
+ // = Initialization and termination methods.
+ explicit TAO_Stub_Auto_Ptr (TAO_Stub *p = 0);
+ TAO_Stub_Auto_Ptr (TAO_Stub_Auto_Ptr &ap);
+ TAO_Stub_Auto_Ptr &operator= (TAO_Stub_Auto_Ptr &rhs);
+ ~TAO_Stub_Auto_Ptr (void);
+
+ // = Accessor methods.
+ TAO_Stub &operator *() const;
+ TAO_Stub *get (void) const;
+ TAO_Stub *release (void);
+ void reset (TAO_Stub *p = 0);
+ TAO_Stub *operator-> () const;
+
+protected:
+ TAO_Stub *p_;
+
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/Stub.i"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_STUB_H */
diff --git a/TAO/tao/Stub.i b/TAO/tao/Stub.i
new file mode 100644
index 00000000000..51bc7a28e27
--- /dev/null
+++ b/TAO/tao/Stub.i
@@ -0,0 +1,400 @@
+// -*- C++ -*-
+//
+// $Id$
+
+#include "tao/ORB_Core.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE void
+TAO_Stub::reset_base (void)
+{
+ this->base_profiles_.rewind ();
+ this->profile_success_ = false;
+
+ this->set_profile_in_use_i (base_profiles_.get_next ());
+}
+
+
+ACE_INLINE ACE_Lock*
+TAO_Stub::profile_lock (void) const
+{
+ return this->profile_lock_ptr_;
+}
+
+ACE_INLINE void
+TAO_Stub::reset_forward (void)
+{
+ while (this->forward_profiles_ != 0)
+ this->forward_back_one ();
+}
+
+ACE_INLINE void
+TAO_Stub::reset_profiles_i (void)
+{
+ this->reset_forward ();
+ this->reset_base ();
+}
+
+ACE_INLINE void
+TAO_Stub::reset_profiles (void)
+{
+ ACE_MT (ACE_GUARD (ACE_Lock,
+ guard,
+ *this->profile_lock_ptr_));
+ this->reset_profiles_i ();
+}
+
+ACE_INLINE TAO_Profile *
+TAO_Stub::profile_in_use (void)
+{
+ return this->profile_in_use_;
+}
+
+ACE_INLINE TAO_MProfile *
+TAO_Stub::make_profiles (void)
+{
+ TAO_MProfile *mp = 0;
+
+ ACE_NEW_RETURN (mp,
+ TAO_MProfile (base_profiles_),
+ 0);
+
+ return mp;
+}
+
+ACE_INLINE TAO_Profile *
+TAO_Stub::next_forward_profile (void)
+{
+ TAO_Profile *pfile_next = 0;
+
+ while (this->forward_profiles_
+ && (pfile_next = this->forward_profiles_->get_next ()) == 0
+ && this->forward_profiles_ != this->forward_profiles_perm_) // do not remove permanent forward from bottom of stack
+ // that was the last profile. Now we clean up our forward profiles.
+ // since we own the forward MProfiles, we must delete them when done.
+ this->forward_back_one ();
+
+ return pfile_next;
+}
+
+ACE_INLINE TAO_Profile *
+TAO_Stub::next_profile_i (void)
+{
+ TAO_Profile *pfile_next = 0;
+
+ // First handle the case that a permanent forward occured
+ if (this->forward_profiles_perm_) // the permanent forward defined
+ // at bottom of stack
+ // forward_profiles_
+ {
+ // In case of permanent forward the base_profiles are ingored.
+
+ pfile_next = this->next_forward_profile ();
+
+ if (pfile_next == 0)
+ {
+ // COND: this->forward_profiles_ == this->forward_profiles_perm_
+
+ // reached end of list of permanent forward profiles
+ // now, reset forward_profiles_perm_
+
+ this->forward_profiles_->rewind ();
+ this->profile_success_ = false;
+ this->set_profile_in_use_i (this->forward_profiles_->get_next());
+ }
+ else
+ this->set_profile_in_use_i (pfile_next);
+
+ // We may have been forwarded to / from a collocated situation
+ // Check for this and apply / remove optimisation if required.
+ this->orb_core_->reinitialize_object (this);
+
+ return pfile_next;
+ }
+ else
+ {
+ if (this->forward_profiles_) // Now do the common operation
+ {
+ pfile_next = this->next_forward_profile ();
+ if (pfile_next == 0)
+ {
+ // Fall back to base profiles
+ pfile_next = this->base_profiles_.get_next ();
+ }
+
+ // We may have been forwarded to / from a collocated situation
+ // Check for this and apply / remove optimisation if required.
+ this->orb_core_->reinitialize_object (this);
+ }
+ else
+ pfile_next = this->base_profiles_.get_next ();
+
+ if (pfile_next == 0)
+ this->reset_base ();
+ else
+ this->set_profile_in_use_i (pfile_next);
+
+ return pfile_next;
+ }
+}
+
+ACE_INLINE TAO_Profile *
+TAO_Stub::next_profile (void)
+{
+
+ ACE_MT (ACE_GUARD_RETURN (ACE_Lock,
+ guard,
+ *this->profile_lock_ptr_,
+ 0));
+ return this->next_profile_i ();
+}
+
+ACE_INLINE CORBA::Boolean
+TAO_Stub::valid_forward_profile (void)
+{
+ return (this->profile_success_ && this->forward_profiles_);
+}
+
+ACE_INLINE void
+TAO_Stub::set_valid_profile (void)
+{
+ this->profile_success_ = true;
+}
+
+ACE_INLINE CORBA::Boolean
+TAO_Stub::valid_profile (void) const
+{
+ return this->profile_success_;
+}
+
+ACE_INLINE TAO_Profile *
+TAO_Stub::base_profiles (const TAO_MProfile &mprofiles)
+{
+ ACE_MT (ACE_GUARD_RETURN (ACE_Lock,
+ guard,
+ *this->profile_lock_ptr_,
+ 0));
+
+ // first reset things so we start from scratch!
+
+ // @note This reset forward could effect the collocation status
+ // but as this method is only used from the Stub ctr, when the status
+ // is already correctly set, we don't reinitialise here. sm.
+ this->reset_forward ();
+ this->base_profiles_.set (mprofiles);
+ this->reset_base ();
+ return this->profile_in_use_;
+
+}
+
+ACE_INLINE CORBA::Boolean
+TAO_Stub::next_profile_retry (void)
+{
+ ACE_MT (ACE_GUARD_RETURN (ACE_Lock,
+ guard,
+ *this->profile_lock_ptr_,
+ 0));
+
+ if (this->profile_success_ && this->forward_profiles_)
+ {
+ // We have a forwarded reference that we have managed to *send* a message to
+ // previously in the remote path only (but not counting object proxy broker ops).
+ // @todo I can see little sense to this. It is at best highly inconsistent. sm.
+
+ // In this case we are falling back from the forwarded IOR stright to the base IOR
+ this->reset_profiles_i ();
+ return true;
+ }
+ else if (this->next_profile_i ())
+ {
+ return true;
+ }
+
+ return false;
+#if 0
+ else
+ {
+ // Check whether the loaded services have something to say about
+ // this condition
+ TAO_Profile *prof = 0;
+ this->orb_core_->service_profile_reselection (this,
+ prof);
+
+ // If the service is loaded and has a profile then try it.
+ if (prof)
+ {
+ return true;
+ }
+ this->reset_profiles_i ();
+ return false;
+ }
+#endif /*If 0 */
+}
+
+ACE_INLINE const TAO_MProfile&
+TAO_Stub::base_profiles (void) const
+{
+ return this->base_profiles_;
+}
+
+ACE_INLINE TAO_MProfile&
+TAO_Stub::base_profiles (void)
+{
+ return this->base_profiles_;
+}
+
+ACE_INLINE const TAO_MProfile *
+TAO_Stub::forward_profiles (void) const
+{
+ return this->forward_profiles_;
+}
+
+ACE_INLINE CORBA::Boolean
+TAO_Stub::is_collocated (void) const
+{
+ return this->is_collocated_;
+}
+
+ACE_INLINE TAO_ORB_Core*
+TAO_Stub::orb_core (void) const
+{
+ return this->orb_core_.get ();
+}
+
+ACE_INLINE CORBA::ORB_var &
+TAO_Stub::servant_orb_var (void)
+{
+ // Simply pass back the ORB pointer for temporary use.
+ return this->servant_orb_;
+}
+
+ACE_INLINE CORBA::ORB_ptr
+TAO_Stub::servant_orb_ptr (void)
+{
+ // Simply pass back the ORB pointer for temporary use.
+ return CORBA::ORB::_duplicate (this->servant_orb_.in ());
+}
+
+ACE_INLINE void
+TAO_Stub::servant_orb (CORBA::ORB_ptr orb)
+{
+ this->servant_orb_ = CORBA::ORB::_duplicate (orb);
+}
+
+ACE_INLINE TAO_Abstract_ServantBase *
+TAO_Stub::collocated_servant (void) const
+{
+ return collocated_servant_;
+}
+
+ACE_INLINE void
+TAO_Stub::collocated_servant (TAO_Abstract_ServantBase * servant)
+{
+ this->collocated_servant_ = servant;
+}
+
+ACE_INLINE TAO::Object_Proxy_Broker *
+TAO_Stub::object_proxy_broker (void) const
+{
+ return this->object_proxy_broker_;
+}
+
+ACE_INLINE void
+TAO_Stub::object_proxy_broker (TAO::Object_Proxy_Broker * object_proxy_broker)
+{
+ this->object_proxy_broker_ = object_proxy_broker;
+}
+
+ACE_INLINE void
+TAO_Stub::destroy (void)
+{
+ // The reference count better be zero at this point!
+ delete this;
+}
+
+ACE_INLINE CORBA::Boolean
+TAO_Stub::optimize_collocation_objects (void) const
+{
+ return this->collocation_opt_;
+}
+
+// ---------------------------------------------------------------
+
+// Creator methods for TAO_Stub_Auto_Ptr (TAO_Stub Auto Pointer)
+ACE_INLINE
+TAO_Stub_Auto_Ptr::TAO_Stub_Auto_Ptr (TAO_Stub *p)
+ : p_ (p)
+{
+ ACE_TRACE ("TAO_Stub_Auto_Ptr::TAO_Stub_Auto_Ptr");
+}
+
+ACE_INLINE TAO_Stub *
+TAO_Stub_Auto_Ptr::get (void) const
+{
+ ACE_TRACE ("TAO_Stub_Auto_Ptr::get");
+ return this->p_;
+}
+
+ACE_INLINE TAO_Stub *
+TAO_Stub_Auto_Ptr::release (void)
+{
+ ACE_TRACE ("TAO_Stub_Auto_Ptr::release");
+ TAO_Stub *old = this->p_;
+ this->p_ = 0;
+ return old;
+}
+
+ACE_INLINE void
+TAO_Stub_Auto_Ptr::reset (TAO_Stub *p)
+{
+ ACE_TRACE ("TAO_Stub_Auto_Ptr::reset");
+ if (this->get () != p && this->get () != 0)
+ this->get ()->_decr_refcnt ();
+ this->p_ = p;
+}
+
+ACE_INLINE TAO_Stub *
+TAO_Stub_Auto_Ptr::operator-> () const
+{
+ ACE_TRACE ("TAO_Stub_Auto_Ptr::operator->");
+ return this->get ();
+}
+
+ACE_INLINE
+TAO_Stub_Auto_Ptr::TAO_Stub_Auto_Ptr (TAO_Stub_Auto_Ptr &rhs)
+ : p_ (rhs.release ())
+{
+ ACE_TRACE ("TAO_Stub_Auto_Ptr::TAO_Stub_Auto_Ptr");
+}
+
+ACE_INLINE TAO_Stub_Auto_Ptr &
+TAO_Stub_Auto_Ptr::operator= (TAO_Stub_Auto_Ptr &rhs)
+{
+ ACE_TRACE ("TAO_Stub_Auto_Ptr::operator=");
+ if (this != &rhs)
+ {
+ this->reset (rhs.release ());
+ }
+ return *this;
+}
+
+ACE_INLINE
+TAO_Stub_Auto_Ptr::~TAO_Stub_Auto_Ptr (void)
+{
+ ACE_TRACE ("TAO_Stub_Auto_Ptr::~TAO_Stub_Auto_Ptr");
+ if (this->get() != 0)
+ this->get ()->_decr_refcnt ();
+}
+
+// Accessor methods to the underlying Stub Object
+
+ACE_INLINE TAO_Stub &
+TAO_Stub_Auto_Ptr::operator *() const
+{
+ ACE_TRACE ("TAO_Stub_Auto_Ptr::operator *()");
+ // @@ Potential problem if this->p_ is zero!
+ return *this->get ();
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Stub_Factory.cpp b/TAO/tao/Stub_Factory.cpp
new file mode 100644
index 00000000000..4c76edc15c9
--- /dev/null
+++ b/TAO/tao/Stub_Factory.cpp
@@ -0,0 +1,15 @@
+// $Id$
+
+#include "tao/Stub_Factory.h"
+
+ACE_RCSID (tao,
+ TAO_Stub_Factory,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Stub_Factory::~TAO_Stub_Factory (void)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Stub_Factory.h b/TAO/tao/Stub_Factory.h
new file mode 100644
index 00000000000..ef42462eac1
--- /dev/null
+++ b/TAO/tao/Stub_Factory.h
@@ -0,0 +1,72 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Stub_Factory.h
+ *
+ * $Id$
+ *
+ * Defines the a factory interface for creating Stubs.
+ * This class creates the default stub, that is used in
+ * plain CORBA.
+ *
+ *
+ * @author Angelo Corsaro <corsaro@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_STUB_FACTORY_H_
+#define TAO_STUB_FACTORY_H_
+
+#include /**/ "ace/pre.h"
+
+#include "tao/TAO_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Versioned_Namespace.h"
+
+#include "ace/Service_Object.h"
+#include "ace/CORBA_macros.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Forward references
+class TAO_MProfile;
+class TAO_ORB_Core;
+class TAO_Stub;
+
+namespace CORBA
+{
+ class Environment;
+}
+
+/**
+ * @class TAO_Stub_Factory
+ *
+ * This class is a factory whose product is the plain TAO_Stub used by
+ * TAO. Its subclasses build Stub object that are specialization of
+ * the TAO_Stub. As an example TAO_RT_Stub_Factory creates
+ * RT_TAO_Stub. This factory, or one of its subclasses is dynamically
+ * plugged into the ORB_Core, and is used by the ORB_Core to create
+ * Stub Objects.
+ */
+class TAO_Export TAO_Stub_Factory : public ACE_Service_Object
+{
+public:
+ /// Destructor.
+ virtual ~TAO_Stub_Factory (void);
+
+ /// Creates a Stub Object.
+ virtual TAO_Stub *create_stub (const char *repository_id,
+ const TAO_MProfile &profiles,
+ TAO_ORB_Core *orb_core
+ ACE_ENV_ARG_DECL) = 0;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_STUB_FACTORY_H_ */
diff --git a/TAO/tao/Synch_Invocation.cpp b/TAO/tao/Synch_Invocation.cpp
new file mode 100644
index 00000000000..bff4141a033
--- /dev/null
+++ b/TAO/tao/Synch_Invocation.cpp
@@ -0,0 +1,826 @@
+// $Id$
+
+#include "tao/Synch_Invocation.h"
+#include "tao/Profile_Transport_Resolver.h"
+#include "tao/Profile.h"
+#include "tao/Synch_Reply_Dispatcher.h"
+#include "tao/Transport.h"
+#include "tao/Stub.h"
+#include "tao/Bind_Dispatcher_Guard.h"
+#include "tao/operation_details.h"
+#include "tao/Wait_Strategy.h"
+#include "tao/debug.h"
+#include "tao/ORB_Constants.h"
+#include "tao/Messaging_SyncScopeC.h"
+#include "tao/ORB_Core.h"
+#include "tao/Service_Context.h"
+
+#if TAO_HAS_INTERCEPTORS == 1
+# include "tao/PortableInterceptorC.h"
+#endif /*TAO_HAS_INTERCEPTORS */
+
+#include "ace/Auto_Ptr.h"
+#include "ace/OS_NS_string.h"
+#include "ace/Countdown_Time.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/Synch_Invocation.inl"
+#endif /* __ACE_INLINE__ */
+
+
+ACE_RCSID (tao,
+ Synch_Invocation,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ Synch_Twoway_Invocation::Synch_Twoway_Invocation (
+ CORBA::Object_ptr otarget,
+ Profile_Transport_Resolver &resolver,
+ TAO_Operation_Details &detail,
+ bool response_expected)
+ : Remote_Invocation (otarget,
+ resolver,
+ detail,
+ response_expected)
+ {
+ }
+
+ Invocation_Status
+ Synch_Twoway_Invocation::remote_twoway (ACE_Time_Value *max_wait_time
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::Exception))
+ {
+ ACE_Countdown_Time countdown (max_wait_time);
+
+ TAO_Synch_Reply_Dispatcher rd (this->resolver_.stub ()->orb_core (),
+ this->details_.reply_service_info ());
+
+ TAO_Target_Specification tspec;
+ this->init_target_spec (tspec ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO_INVOKE_FAILURE);
+
+ Invocation_Status s = TAO_INVOKE_FAILURE;
+
+#if TAO_HAS_INTERCEPTORS == 1
+ // Start the interception point here..
+ s =
+ this->send_request_interception (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO_INVOKE_FAILURE);
+
+ if (s != TAO_INVOKE_SUCCESS)
+ return s;
+#endif /*TAO_HAS_INTERCEPTORS */
+
+ // We have started the interception flow. We need to call the
+ // ending interception flow if things go wrong. The purpose of the
+ // try block is to do just this.
+ ACE_TRY
+ {
+ TAO_OutputCDR &cdr = this->resolver_.transport ()->out_stream ();
+
+ cdr.message_attributes (this->details_.request_id (),
+ this->resolver_.stub (),
+ TAO_Transport::TAO_TWOWAY_REQUEST,
+ max_wait_time);
+
+ this->write_header (tspec,
+ cdr
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ this->marshal_data (cdr
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ // Register a reply dispatcher for this invocation. Use the
+ // preallocated reply dispatcher.
+ TAO_Bind_Dispatcher_Guard dispatch_guard (
+ this->details_.request_id (),
+ &rd,
+ this->resolver_.transport ()->tms ());
+
+ if (dispatch_guard.status () != 0)
+ {
+ // @@ What is the right way to handle this error? Why should
+ // we close the connection?
+ this->resolver_.transport ()->close_connection ();
+
+ ACE_THROW_RETURN (
+ CORBA::INTERNAL (
+ 0,
+ CORBA::COMPLETED_NO),
+ s);
+ }
+
+ countdown.update ();
+
+ s = this->send_message (cdr,
+ TAO_Transport::TAO_TWOWAY_REQUEST,
+ max_wait_time
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+#if TAO_HAS_INTERCEPTORS == 1
+ // @@NOTE: Too much code repetition.
+ // If the above call returns a restart due to connection
+ // failure then call the receive_other interception point
+ // before we leave.
+ if (s == TAO_INVOKE_RESTART)
+ {
+ const Invocation_Status tmp =
+ this->receive_other_interception (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (tmp != TAO_INVOKE_SUCCESS)
+ s = tmp;
+ }
+#endif /*TAO_HAS_INTERCEPTORS */
+
+ if (s != TAO_INVOKE_SUCCESS)
+ return s;
+
+ countdown.update ();
+
+ // For some strategies one may want to release the transport
+ // back to cache. If the idling is successfull let the
+ // resolver about that.
+ if (this->resolver_.transport ()->idle_after_send ())
+ this->resolver_.transport_released ();
+
+ // @@ In all MT environments, there's a cancellation point lurking
+ // here; need to investigate. Client threads would frequently be
+ // canceled sometime during recv_request ... the correct action to
+ // take on being canceled is to issue a CancelRequest message to the
+ // server and then imediately let other client-side cancellation
+ // handlers do their jobs.
+ //
+ // In C++, that basically means to unwind the stack using almost
+ // normal procedures: all destructors should fire, and some "catch"
+ // blocks should probably be able to handle things like releasing
+ // pointers. (Without unwinding the C++ stack, resources that must
+ // be freed by thread cancellation won't be freed, and the process
+ // won't continue to function correctly.) The tricky part is that
+ // according to POSIX, all C stack frames must also have their
+ // (explicitly coded) handlers called. We assume a POSIX.1c/C/C++
+ // environment.
+
+ s =
+ this->wait_for_reply (max_wait_time,
+ rd,
+ dispatch_guard
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+#if TAO_HAS_INTERCEPTORS == 1
+ if (s == TAO_INVOKE_RESTART)
+ {
+ Invocation_Status tmp =
+ this->receive_other_interception (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ // Push the latest values for the return..
+ if (tmp != TAO_INVOKE_SUCCESS)
+ s = tmp;
+ }
+#endif /*TAO_HAS_INTERCEPTORS */
+
+ if (s != TAO_INVOKE_SUCCESS)
+ return s;
+
+ // What happens when the above call returns an error through
+ // the return value? That would be bogus as per the contract
+ // in the interface. The call violated the contract
+
+ s = this->check_reply_status (rd
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ // For some strategies one may want to release the transport
+ // back to cache after receiving the reply.
+ if (this->resolver_.transport ()->idle_after_reply ())
+ this->resolver_.transport_released ();
+
+#if TAO_HAS_INTERCEPTORS == 1
+ Invocation_Status tmp = TAO_INVOKE_FAILURE;
+ if (s == TAO_INVOKE_RESTART)
+ {
+ tmp =
+ this->receive_other_interception (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ else if (s == TAO_INVOKE_SUCCESS)
+ {
+ tmp =
+ this->receive_reply_interception (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ if (tmp != TAO_INVOKE_SUCCESS)
+ s = tmp;
+#endif /*TAO_HAS_INTERCEPTORS */
+
+ if (s != TAO_INVOKE_SUCCESS)
+ return s;
+ }
+ ACE_CATCHANY
+ {
+#if TAO_HAS_INTERCEPTORS == 1
+ const PortableInterceptor::ReplyStatus status =
+ this->handle_any_exception (&ACE_ANY_EXCEPTION
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (status == PortableInterceptor::LOCATION_FORWARD ||
+ status == PortableInterceptor::TRANSPORT_RETRY)
+ s = TAO_INVOKE_RESTART;
+ else if (status == PortableInterceptor::SYSTEM_EXCEPTION
+ || status == PortableInterceptor::USER_EXCEPTION)
+#endif /*TAO_HAS_INTERCEPTORS*/
+ ACE_RE_THROW;
+ }
+# if defined (ACE_HAS_EXCEPTIONS) \
+ && defined (ACE_HAS_BROKEN_UNEXPECTED_EXCEPTIONS)
+ ACE_CATCHALL
+ {
+#if TAO_HAS_INTERCEPTORS == 1
+ const PortableInterceptor::ReplyStatus st =
+ this->handle_all_exception (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (st == PortableInterceptor::LOCATION_FORWARD ||
+ st == PortableInterceptor::TRANSPORT_RETRY)
+ s = TAO_INVOKE_RESTART;
+ else
+#endif /*TAO_HAS_INTERCEPTORS == 1*/
+ ACE_RE_THROW;
+ }
+# endif /* ACE_HAS_EXCEPTIONS &&
+ ACE_HAS_BROKEN_UNEXPECTED_EXCEPTION*/
+ ACE_ENDTRY;
+ ACE_CHECK_RETURN (TAO_INVOKE_FAILURE);
+
+ return s;
+ }
+
+ Invocation_Status
+ Synch_Twoway_Invocation::wait_for_reply (ACE_Time_Value *max_wait_time,
+ TAO_Synch_Reply_Dispatcher &rd,
+ TAO_Bind_Dispatcher_Guard &bd
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ /*
+ * Precondition: The call went to the remote
+ * peer. <ACE_Thread::self> is waiting for the reply.
+ *
+ * Postcondition: Any error during a wait is marked by raising an
+ * exception. Success alone is returned through the return value.
+ */
+
+ const int reply_error =
+ this->resolver_.transport ()->wait_strategy ()->wait (max_wait_time,
+ rd);
+ if (TAO_debug_level > 0 && max_wait_time != 0)
+ {
+ const CORBA::ULong msecs = max_wait_time->msec ();
+
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - Synch_Twoway_Invocation::wait_for_reply, "
+ "timeout after recv is <%u> status <%d>\n",
+ msecs,
+ reply_error));
+ }
+
+ // Check the reply error.
+ if (reply_error == -1)
+ {
+ // Unbind the dispatcher, since its of no use at this point of
+ // time
+ if (TAO_debug_level > 3)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - Synch_Twoway_Invocation::wait_for_reply, "
+ "recovering after an error \n"));
+ }
+
+ // You the smarty, don't try to moving the unbind_dispatcher
+ // () call since it looks like it is repeated twice. That
+ // could land you in trouble. If you don't believe this
+ // warning go ahead and try. Try running tests to see what is
+ // going on ;)
+ if (errno == ETIME)
+ {
+ // If the unbind succeeds then thrown an exception to the
+ // application, else just collect the reply and dispatch
+ // that to the application.
+ //
+ // NOTE: A fragile synchronization is provided when using
+ // the Muxed Transport strategy. We could infact be a
+ // follower thread getting timedout in the LF whereas the
+ // dispatching thread could be on the reply_dispatcher
+ // that we created. This would lead bad crashes. To get
+ // around that, the call to unbind_dispatcher () will wait
+ // on the lock on the Muxed_Transport_Strategy if
+ // dispatching has started. This is fragile.
+ if (bd.unbind_dispatcher () == 0)
+ {
+ // Just a timeout with completed_maybe, don't close
+ // the connection or anything
+ ACE_THROW_RETURN (CORBA::TIMEOUT (
+ CORBA::SystemException::_tao_minor_code (
+ TAO_TIMEOUT_RECV_MINOR_CODE,
+ errno),
+ CORBA::COMPLETED_MAYBE),
+ TAO_INVOKE_FAILURE);
+ }
+ }
+ else
+ {
+ (void) bd.unbind_dispatcher ();
+ this->resolver_.transport ()->close_connection ();
+
+ ACE_TRY
+ {
+ return
+ this->orb_core ()->service_raise_comm_failure (
+ this->details_.request_service_context ().service_info (),
+ this->resolver_.profile ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ }
+ ACE_CATCHANY
+ {
+ this->resolver_.stub ()->reset_profiles ();
+ ACE_RE_THROW;
+ }
+ ACE_ENDTRY;
+ }
+ }
+
+ return TAO_INVOKE_SUCCESS;
+ }
+
+ Invocation_Status
+ Synch_Twoway_Invocation::check_reply_status (TAO_Synch_Reply_Dispatcher &rd
+ ACE_ENV_ARG_DECL)
+ {
+ /*
+ * Precondition: We probably got a reply. <ACE_Thread::self> is
+ * checking the status of the reply
+ *
+ * Postcondition: Any error while reading the reply is marked by
+ * raising an exception. LOCATION_FORWARDED replies are marked by
+ * returning a restart since that is what needed to be done by the
+ * callee.
+ */
+ TAO_InputCDR &cdr =
+ rd.reply_cdr ();
+
+ // Set the translators
+ this->resolver_.transport ()->assign_translators (&cdr, 0);
+
+ // At this point it can be assumed that the GIOP/whatever protocol
+ // header and the reply header are already handled. Further it
+ // can be assumed that the reply body contains the details
+ // required for further processing. All the other details should
+ // have been handled in the reply dispatcher/protocol framework.
+ switch (rd.reply_status ())
+ {
+ case TAO_PLUGGABLE_MESSAGE_NO_EXCEPTION:
+ {
+ Reply_Guard mon (this,
+ TAO_INVOKE_FAILURE);
+ if (this->details_.demarshal_args (cdr) == false)
+ {
+ ACE_THROW_RETURN (CORBA::MARSHAL (),
+ TAO_INVOKE_FAILURE);
+ }
+
+ mon.set_status (TAO_INVOKE_SUCCESS);
+ }
+ break;
+ case TAO_PLUGGABLE_MESSAGE_LOCATION_FORWARD:
+ return this->location_forward (cdr
+ ACE_ENV_ARG_PARAMETER);
+ case TAO_PLUGGABLE_MESSAGE_LOCATION_FORWARD_PERM:
+ {
+ // Unmarshal the location forward object and set the
+ // variable this->forward_to_.
+ const Invocation_Status s
+ = this->location_forward (cdr
+ ACE_ENV_ARG_PARAMETER);
+ if (s != TAO_INVOKE_FAILURE)
+ {
+ // de-marshalling of permanent object reference was successfull
+ const CORBA::Boolean permanent_forward_condition =
+ this->orb_core ()->is_permanent_forward_condition
+ (this->forwarded_to_.in (),
+ this->request_service_context ());
+
+ if (!permanent_forward_condition)
+ {
+ // permanent condition not given
+ if (TAO_debug_level > 3)
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - Synch_Twoway_Invocation::"
+ "check_reply_status: unexpected LOCATION_FORWARD_PERM reply\n"));
+
+ ACE_THROW_RETURN (CORBA::INTERNAL (0, CORBA::COMPLETED_NO),
+ TAO_INVOKE_FAILURE);
+ }
+ }
+
+ return s;
+ }
+ case TAO_PLUGGABLE_MESSAGE_USER_EXCEPTION:
+ return this->handle_user_exception (cdr
+ ACE_ENV_ARG_PARAMETER);
+ case TAO_PLUGGABLE_MESSAGE_SYSTEM_EXCEPTION:
+ return this->handle_system_exception (cdr
+ ACE_ENV_ARG_PARAMETER);
+
+ case TAO_PLUGGABLE_MESSAGE_NEEDS_ADDRESSING_MODE:
+ {
+ Reply_Guard mon (this,
+ TAO_INVOKE_FAILURE);
+ // We have received a message with a request to change the
+ // addressing mode. First let us read the mode that the
+ // server/agent asks for.
+ CORBA::Short addr_mode = 0;
+
+ if (cdr.read_short (addr_mode) == 0)
+ {
+ // Could not demarshal the addressing disposition, raise an local
+ // CORBA::MARSHAL
+ ACE_THROW_RETURN (CORBA::MARSHAL (0,
+ CORBA::COMPLETED_MAYBE),
+ TAO_INVOKE_FAILURE);
+ }
+
+ // Now set this addressing mode in the profile, so that
+ // the next invocation need not go through this.
+ this->resolver_.profile ()->addressing_mode (addr_mode
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO_INVOKE_FAILURE);
+
+ mon.set_status (TAO_INVOKE_RESTART);
+
+ // Now restart the invocation
+ return TAO_INVOKE_RESTART;
+ }
+ }
+ return TAO_INVOKE_SUCCESS;
+ }
+
+ Invocation_Status
+ Synch_Twoway_Invocation::location_forward (TAO_InputCDR &inp_stream
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ Reply_Guard mon (this,
+ TAO_INVOKE_FAILURE);
+
+ if (TAO_debug_level > 3)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - Synch_Twoway_Invocation::location_forward ")
+ ACE_TEXT ("being handled \n")));
+ }
+
+ CORBA::Object_var fwd;
+
+ if ((inp_stream >> fwd) == 0)
+ {
+ ACE_THROW_RETURN (CORBA::MARSHAL (
+ CORBA::SystemException::_tao_minor_code (
+ TAO_INVOCATION_LOCATION_FORWARD_MINOR_CODE,
+ errno),
+ CORBA::COMPLETED_NO),
+ TAO_INVOKE_FAILURE);
+ }
+
+ this->forwarded_reference (fwd.in ());
+
+ mon.set_status (TAO_INVOKE_RESTART);
+
+ return TAO_INVOKE_RESTART;
+ }
+
+ Invocation_Status
+ Synch_Twoway_Invocation::handle_user_exception (TAO_InputCDR &cdr
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::Exception))
+ {
+ Reply_Guard mon (this,
+ TAO_INVOKE_FAILURE);
+
+ if (TAO_debug_level > 3)
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - Synch_Twoway_Invocation::"
+ "handle_user_exception \n"));
+
+ // Pull the exception from the stream.
+ CORBA::String_var buf;
+
+ if ((cdr >> buf.inout ()) == 0)
+ {
+ // Could not demarshal the exception id, raise an local
+ // CORBA::MARSHAL
+ ACE_THROW_RETURN (CORBA::MARSHAL (0,
+ CORBA::COMPLETED_MAYBE),
+ TAO_INVOKE_FAILURE);
+ }
+
+ CORBA::Exception *exception =
+ this->details_.corba_exception (buf.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO_INVOKE_FAILURE);
+
+ exception->_tao_decode (cdr
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO_INVOKE_FAILURE);
+
+ if (TAO_debug_level > 5)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - Synch_Twoway_Invocation::")
+ ACE_TEXT ("handle_user_exception - ")
+ ACE_TEXT ("raising exception %s\n"),
+ ACE_TEXT_CHAR_TO_TCHAR (buf.in ())));
+ }
+
+ mon.set_status (TAO_INVOKE_USER_EXCEPTION);
+
+#if defined (TAO_HAS_EXCEPTIONS)
+ // If we have native exceptions, we must manage the memory allocated
+ // by the call above to alloc(). Otherwise the Environment class
+ // manages the memory.
+ auto_ptr<CORBA::Exception> safety (exception);
+
+ // Direct throw because we don't have the ACE_TRY_ENV.
+ exception->_raise ();
+#else
+ // We can not use ACE_THROW here.
+ ACE_TRY_ENV.exception (exception);
+#endif
+
+ return TAO_INVOKE_USER_EXCEPTION;
+ }
+
+ Invocation_Status
+ Synch_Twoway_Invocation::handle_system_exception (TAO_InputCDR &cdr
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ Reply_Guard mon (this, TAO_INVOKE_FAILURE);
+
+ if (TAO_debug_level > 3)
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - Synch_Twoway_Invocation::"
+ "handle_system_exception \n"));
+
+ CORBA::String_var type_id;
+
+ if ((cdr >> type_id.inout ()) == 0)
+ {
+ // Could not demarshal the exception id, raise an local
+ // CORBA::MARSHAL
+ ACE_THROW_RETURN (CORBA::MARSHAL (0,
+ CORBA::COMPLETED_MAYBE),
+ TAO_INVOKE_FAILURE);
+ }
+
+ CORBA::ULong minor = 0;
+ CORBA::ULong completion = 0;
+
+ if ((cdr >> minor) == 0
+ || (cdr >> completion) == 0)
+ {
+ ACE_THROW_RETURN (CORBA::MARSHAL (0,
+ CORBA::COMPLETED_MAYBE),
+ TAO_INVOKE_FAILURE);
+ }
+
+ // Special handling for non-fatal system exceptions.
+ //
+ // Note that we are careful to retain "at most once" semantics.
+ if ((ACE_OS_String::strcmp (type_id.in (),
+ "IDL:omg.org/CORBA/TRANSIENT:1.0") == 0 ||
+ ACE_OS_String::strcmp (type_id.in (),
+ "IDL:omg.org/CORBA/OBJ_ADAPTER:1.0") == 0 ||
+ ACE_OS_String::strcmp (type_id.in (),
+ "IDL:omg.org/CORBA/NO_RESPONSE:1.0") == 0 ||
+ ACE_OS_String::strcmp (type_id.in (),
+ "IDL:omg.org/CORBA/COMM_FAILURE:1.0") == 0) &&
+ (CORBA::CompletionStatus) completion != CORBA::COMPLETED_YES)
+ {
+ {
+ // Start the special case for FTCORBA.
+ /**
+ * There has been a unanimous view that this is not the
+ * right way to do things. But a need to be compliant is
+ * forcing us into this.
+ */
+ const Invocation_Status s =
+ this->orb_core ()->service_raise_transient_failure (
+ this->details_.request_service_context ().service_info (),
+ this->resolver_.profile ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO_INVOKE_FAILURE);
+
+ if (s == TAO_INVOKE_RESTART)
+ return s;
+ }
+
+ // Attempt profile retry.
+ /**
+ * @note A location forwarding loop may occur where a client
+ * is bounced from the original target to the forwarded
+ * target and back if the application is not equipped to
+ * handle retries of previously called targets. TAO may
+ * be able to help in this case but it ultimately ends
+ * up being an application issue.
+ */
+ if (this->resolver_.stub ()->next_profile_retry ())
+ {
+ return TAO_INVOKE_RESTART;
+ }
+
+ // Fall through and raise an exception.
+ }
+
+ CORBA::SystemException *ex =
+ TAO::create_system_exception (type_id.in ());
+
+ if (ex == 0)
+ {
+ // @@ We should raise a CORBA::NO_MEMORY, but we ran out
+ // of memory already. We need a pre-allocated, TSS,
+ // CORBA::NO_MEMORY instance
+ ACE_NEW_RETURN (ex,
+ CORBA::UNKNOWN,
+ TAO_INVOKE_FAILURE);
+ }
+
+#if defined (TAO_HAS_EXCEPTIONS)
+ // Without this, the call to create_system_exception() above
+ // causes a memory leak. On platforms without native exceptions,
+ // the CORBA::Environment class manages the memory.
+ auto_ptr<CORBA::SystemException> safety (ex);
+#endif
+
+ ex->minor (minor);
+ ex->completed (CORBA::CompletionStatus (completion));
+
+ if (TAO_debug_level > 4)
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - Synch_Twoway_Invocation::"
+ "handle_system_exception, about to raise\n"));
+
+ mon.set_status (TAO_INVOKE_SYSTEM_EXCEPTION);
+
+ // Raise the exception.
+ ACE_ENV_RAISE (ex);
+
+ return TAO_INVOKE_SYSTEM_EXCEPTION;
+ }
+
+ // =========================================================================
+
+ Synch_Oneway_Invocation::Synch_Oneway_Invocation (
+ CORBA::Object_ptr otarget,
+ Profile_Transport_Resolver &r,
+ TAO_Operation_Details &d)
+ : Synch_Twoway_Invocation (otarget, r, d, false)
+ {
+ }
+
+ Invocation_Status
+ Synch_Oneway_Invocation::remote_oneway (ACE_Time_Value *max_wait_time
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::Exception))
+ {
+ ACE_Countdown_Time countdown (max_wait_time);
+
+ const CORBA::Octet response_flags =
+ this->details_.response_flags ();
+
+ Invocation_Status s = TAO_INVOKE_FAILURE;
+
+ if (response_flags == CORBA::Octet (Messaging::SYNC_WITH_SERVER) ||
+ response_flags == CORBA::Octet (Messaging::SYNC_WITH_TARGET))
+ {
+ s = Synch_Twoway_Invocation::remote_twoway (max_wait_time
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO_INVOKE_FAILURE);
+
+ return s;
+ }
+
+ TAO_Target_Specification tspec;
+ this->init_target_spec (tspec ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO_INVOKE_FAILURE);
+
+#if TAO_HAS_INTERCEPTORS == 1
+ s = this->send_request_interception (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (TAO_INVOKE_FAILURE);
+
+ if (s != TAO_INVOKE_SUCCESS)
+ return s;
+#endif /*TAO_HAS_INTERCEPTORS */
+
+ TAO_Transport* transport =
+ this->resolver_.transport ();
+
+ TAO_OutputCDR &cdr = transport->out_stream ();
+
+ ACE_TRY
+ {
+ cdr.message_attributes (this->details_.request_id (),
+ this->resolver_.stub (),
+ TAO_Transport::TAO_ONEWAY_REQUEST,
+ max_wait_time);
+
+ this->write_header (tspec,
+ cdr
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ this->marshal_data (cdr
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ countdown.update ();
+
+ if (transport->is_connected())
+ {
+ // We have a connected transport so we can send the message
+ s = this->send_message (cdr,
+ TAO_Transport::TAO_ONEWAY_REQUEST,
+ max_wait_time
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ else
+ {
+ if (TAO_debug_level > 4)
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - Synch_Oneway_Invocation::"
+ "remote_oneway, queueing message\n"));
+
+ if (transport->format_queue_message (cdr) != 0)
+ s = TAO_INVOKE_FAILURE;
+ }
+
+#if TAO_HAS_INTERCEPTORS == 1
+ s =
+ this->receive_other_interception (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+#endif /*TAO_HAS_INTERCEPTORS */
+ }
+ ACE_CATCHANY
+ {
+#if TAO_HAS_INTERCEPTORS == 1
+ PortableInterceptor::ReplyStatus status =
+ this->handle_any_exception (&ACE_ANY_EXCEPTION
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (status == PortableInterceptor::LOCATION_FORWARD ||
+ status == PortableInterceptor::TRANSPORT_RETRY)
+ s = TAO_INVOKE_RESTART;
+ else if (status == PortableInterceptor::SYSTEM_EXCEPTION
+ || status == PortableInterceptor::USER_EXCEPTION)
+#endif /*TAO_HAS_INTERCEPTORS*/
+ ACE_RE_THROW;
+ }
+# if defined (ACE_HAS_EXCEPTIONS) \
+ && defined (ACE_HAS_BROKEN_UNEXPECTED_EXCEPTIONS)
+ ACE_CATCHALL
+ {
+#if TAO_HAS_INTERCEPTORS == 1
+ PortableInterceptor::ReplyStatus st =
+ this->handle_all_exception (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (st == PortableInterceptor::LOCATION_FORWARD ||
+ st == PortableInterceptor::TRANSPORT_RETRY)
+ s = TAO_INVOKE_RESTART;
+ else
+#endif /*TAO_HAS_INTERCEPTORS == 1*/
+ ACE_RE_THROW;
+ }
+# endif /* ACE_HAS_EXCEPTIONS &&
+ ACE_HAS_BROKEN_UNEXPECTED_EXCEPTION*/
+ ACE_ENDTRY;
+ ACE_CHECK_RETURN (TAO_INVOKE_FAILURE);
+
+ return s;
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Synch_Invocation.h b/TAO/tao/Synch_Invocation.h
new file mode 100644
index 00000000000..e3441f6b7be
--- /dev/null
+++ b/TAO/tao/Synch_Invocation.h
@@ -0,0 +1,215 @@
+// -*- C++ -*-
+//
+//=============================================================================
+/**
+ * @file Synch_Invocation.h
+ *
+ * $Id$
+ *
+ *
+ * @author Balachandran Natarajan <bala@dre.vanderbilt.edu>
+ */
+//=============================================================================
+#ifndef TAO_SYNCH_INVOCATION_H
+#define TAO_SYNCH_INVOCATION_H
+#include /**/ "ace/pre.h"
+
+#include "tao/Remote_Invocation.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/SystemException.h"
+
+ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+class ACE_Time_Value;
+ACE_END_VERSIONED_NAMESPACE_DECL
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Operation_Details;
+class TAO_Synch_Reply_Dispatcher;
+class TAO_InputCDR;
+class TAO_Bind_Dispatcher_Guard;
+
+namespace TAO
+{
+ class Profile_Transport_Resolver;
+
+ /**
+ * @class Synch_Twoway_Invocation
+ *
+ * @brief All the action for a synchronous twoway invocation happen
+ * here.
+ *
+ * An object of this type is created by TAO::Invocation_Adapter
+ * and invokes a method on this class. The method takes care of
+ * creating and sending a request, waiting for a reply and
+ * demarshalling the reply for the client.
+ *
+ */
+ class TAO_Export Synch_Twoway_Invocation : public Remote_Invocation
+ {
+ public:
+ /// Constructor used by TAO::Invocation_Adapter
+ /**
+ * @param otarget The original target on which this invocation
+ * was started. This is there to be passed up to its parent
+ * class.
+ *
+ * @param resolver The profile and transport holder.
+ *
+ * @param detail Operation details of the invocation on the target
+ *
+ * @param response_expected Flag to indicate whether the
+ * operation encapsulated by @a op returns a response or not.
+ */
+ Synch_Twoway_Invocation (CORBA::Object_ptr otarget,
+ Profile_Transport_Resolver &resolver,
+ TAO_Operation_Details &detail,
+ bool response_expected = true);
+
+ /// Method used by the adapter to kickstart an invocation to the
+ /// remote object.
+ /**
+ * There is a exception declaration in this method which ensures
+ * that the exceptions propogated by the remote objects are
+ * converted a CORBA exceptions for the clients. This method does
+ * a bunch of things necessary to create and send the
+ * invocation. This method is also nerve centre for the
+ * interceptor invocation points.
+ */
+ Invocation_Status remote_twoway (ACE_Time_Value *max_wait_time
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::Exception));
+
+ protected:
+
+ /**
+ * This method is selectively made virtual, so that inherited
+ * classes can overload the user exception handling type. For
+ * example the DII needs a totally different method of
+ * user exception exception handling
+ */
+ virtual Invocation_Status handle_user_exception (TAO_InputCDR &cdr
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::Exception));
+
+ /// Helper method used to handle location forwarded replies.
+ Invocation_Status location_forward (TAO_InputCDR &cdr
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Helper method used to handle system exceptions from the remote
+ /// objects.
+ Invocation_Status handle_system_exception (TAO_InputCDR &cdr
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// As the name suggests waits for a reply from the remote ORB.
+ /**
+ * This method returns an exception when there is an error.
+ */
+ Invocation_Status wait_for_reply (ACE_Time_Value *max_wait_time,
+ TAO_Synch_Reply_Dispatcher &rd,
+ TAO_Bind_Dispatcher_Guard &bd
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ private:
+
+ /// Helper method that checks the reply status of the
+ /// replies and takes appropriate action.
+ /**
+ * This method returns an exception when there is an error.
+ */
+ Invocation_Status check_reply_status (
+ TAO_Synch_Reply_Dispatcher &rd
+ ACE_ENV_ARG_DECL);
+
+ };
+
+ /**
+ * @class Synch_Oneway_Invocation
+ *
+ * @brief All the action for a synchronous oneway invocation happen
+ * here.
+ *
+ * This class inherits from twoway invocation for the following
+ * reasons
+ *
+ * - We deal with oneway invocation in more or less the same way as
+ * two but for waiting for the reply
+ *
+ * - For some SYNC_SCOPE policies namely SYNC_WITH_TARGET and
+ * SYNC_WITH_SERVER the invocation classes have to treat the
+ * invocation as a twoway invocation (more or less)
+ *
+ */
+ class TAO_Export Synch_Oneway_Invocation
+ : public Synch_Twoway_Invocation
+ {
+ public:
+ /// Constructor used by TAO::Invocation_Adapter
+ /**
+ * @param otarget The original target on which this invocation
+ * was started. This is there to be passed up to its parent
+ * class.
+ *
+ * @param resolver The profile and transport holder.
+ *
+ * @param detail Operation details of the invocation on the target
+ */
+ Synch_Oneway_Invocation (CORBA::Object_ptr otarget,
+ Profile_Transport_Resolver &resolver,
+ TAO_Operation_Details &detail);
+
+ /// Method used by the adapter to kickstart an oneway invocation
+ /// to the remote object.
+ Invocation_Status remote_oneway (ACE_Time_Value *max_wait_time
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::Exception));
+ };
+
+ /**
+ * @class Reply_Guard
+ *
+ * @brief A guard class used for storing and forwarding the reply
+ * status to the portable interceptors.
+ */
+ class TAO_Export Reply_Guard
+ {
+ public:
+
+ Reply_Guard (Invocation_Base *s,
+ Invocation_Status is);
+
+ /// The destructor calls Invocation_Base::reply_received with the
+ /// right reply status, which is useful for PI's.
+ ~Reply_Guard (void);
+
+ /// Mutator to set the invocation status.
+ void set_status (Invocation_Status s);
+
+ private:
+
+ Reply_Guard (Reply_Guard const &);
+ Reply_Guard & operator= (Reply_Guard const &);
+
+ private:
+
+ Invocation_Base * const invocation_;
+ Invocation_Status status_;
+ };
+
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/Synch_Invocation.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+#endif /*TAO_SYNCH_INVOCATION_H*/
diff --git a/TAO/tao/Synch_Invocation.inl b/TAO/tao/Synch_Invocation.inl
new file mode 100644
index 00000000000..649d3245412
--- /dev/null
+++ b/TAO/tao/Synch_Invocation.inl
@@ -0,0 +1,30 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ ACE_INLINE
+ Reply_Guard::Reply_Guard (Invocation_Base *b,
+ Invocation_Status s)
+ : invocation_ (b)
+ , status_ (s)
+ {
+ }
+
+ ACE_INLINE
+ Reply_Guard::~Reply_Guard (void)
+ {
+ this->invocation_->reply_received (this->status_);
+ }
+
+ ACE_INLINE void
+ Reply_Guard::set_status (Invocation_Status s)
+ {
+ this->status_ = s;
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Synch_Queued_Message.cpp b/TAO/tao/Synch_Queued_Message.cpp
new file mode 100644
index 00000000000..59fecb37311
--- /dev/null
+++ b/TAO/tao/Synch_Queued_Message.cpp
@@ -0,0 +1,184 @@
+// "$Id$"
+
+#include "tao/Synch_Queued_Message.h"
+#include "tao/debug.h"
+#include "tao/ORB_Core.h"
+
+#include "ace/Malloc_T.h"
+#include "ace/Message_Block.h"
+
+ACE_RCSID (tao,
+ Synch_Queued_Message,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Synch_Queued_Message::TAO_Synch_Queued_Message (
+ const ACE_Message_Block *contents,
+ TAO_ORB_Core *oc,
+ ACE_Allocator *alloc,
+ bool is_heap_allocated)
+ : TAO_Queued_Message (oc, alloc, is_heap_allocated)
+ , contents_ (const_cast<ACE_Message_Block*> (contents))
+ , current_block_ (contents_)
+{
+}
+
+TAO_Synch_Queued_Message::~TAO_Synch_Queued_Message (void)
+{
+
+}
+
+const ACE_Message_Block *
+TAO_Synch_Queued_Message::current_block (void) const
+{
+ return this->current_block_;
+}
+
+size_t
+TAO_Synch_Queued_Message::message_length (void) const
+{
+ if (this->current_block_ == 0)
+ {
+ return 0;
+ }
+
+ return this->current_block_->total_length ();
+}
+
+int
+TAO_Synch_Queued_Message::all_data_sent (void) const
+{
+ return this->current_block_ == 0;
+}
+
+void
+TAO_Synch_Queued_Message::fill_iov (int iovcnt_max,
+ int &iovcnt,
+ iovec iov[]) const
+{
+ ACE_ASSERT (iovcnt_max > iovcnt);
+
+ for (const ACE_Message_Block *message_block = this->current_block_;
+ message_block != 0 && iovcnt < iovcnt_max;
+ message_block = message_block->cont ())
+ {
+ size_t const message_block_length = message_block->length ();
+
+ // Check if this block has any data to be sent.
+ if (message_block_length > 0)
+ {
+ // Collect the data in the iovec.
+ iov[iovcnt].iov_base = message_block->rd_ptr ();
+ iov[iovcnt].iov_len = static_cast<u_long> (message_block_length);
+
+ // Increment iovec counter.
+ ++iovcnt;
+ }
+ }
+}
+
+void
+TAO_Synch_Queued_Message::bytes_transferred (size_t &byte_count)
+{
+ this->state_changed_i (TAO_LF_Event::LFS_ACTIVE);
+
+ while (this->current_block_ != 0 && byte_count > 0)
+ {
+ size_t const l = this->current_block_->length ();
+
+ if (byte_count < l)
+ {
+ this->current_block_->rd_ptr (byte_count);
+ byte_count = 0;
+ return;
+ }
+
+ byte_count -= l;
+ this->current_block_->rd_ptr (l);
+ this->current_block_ = this->current_block_->cont ();
+
+ while (this->current_block_ != 0
+ && this->current_block_->length () == 0)
+ {
+ this->current_block_ = this->current_block_->cont ();
+ }
+ }
+
+ if (this->current_block_ == 0)
+ this->state_changed (TAO_LF_Event::LFS_SUCCESS,
+ this->orb_core_->leader_follower ());
+}
+
+TAO_Queued_Message *
+TAO_Synch_Queued_Message::clone (ACE_Allocator *alloc)
+{
+ TAO_Synch_Queued_Message *qm = 0;
+
+ // Clone the message block.
+ // NOTE: We wantedly do the cloning from <current_block_> instead of
+ // starting from <contents_> since we dont want to clone blocks that
+ // have already been sent on the wire. Waste of memory and
+ // associated copying.
+ ACE_Message_Block *mb = this->current_block_->clone ();
+
+ if (alloc)
+ {
+ ACE_NEW_MALLOC_RETURN (qm,
+ static_cast<TAO_Synch_Queued_Message *> (
+ alloc->malloc (sizeof (TAO_Synch_Queued_Message))),
+ TAO_Synch_Queued_Message (mb,
+ this->orb_core_,
+ alloc),
+ 0);
+ }
+ else
+ {
+ // No allocator, so use the common heap!
+ if (TAO_debug_level == 4)
+ {
+ // This debug is for testing purposes!
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - Synch_Queued_Message::clone\n"
+ "Using global pool for allocation \n"));
+ }
+
+ ACE_NEW_RETURN (qm,
+ TAO_Synch_Queued_Message (mb, this->orb_core_),
+ 0);
+ }
+
+ // Set the flag to indicate that <qm> is created on the heap.
+ if (qm)
+ {
+ qm->is_heap_created_ = true;
+ }
+
+ return qm;
+}
+
+void
+TAO_Synch_Queued_Message::destroy (void)
+{
+ if (this->is_heap_created_)
+ {
+ ACE_Message_Block::release (this->contents_);
+ this->current_block_ = 0;
+
+ // If we have an allocator release the memory to the allocator
+ // pool.
+ if (this->allocator_)
+ {
+ ACE_DES_FREE (this,
+ this->allocator_->free,
+ TAO_Synch_Queued_Message);
+
+ }
+ else // global release..
+ {
+ delete this;
+ }
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Synch_Queued_Message.h b/TAO/tao/Synch_Queued_Message.h
new file mode 100644
index 00000000000..9dc77c54cc1
--- /dev/null
+++ b/TAO/tao/Synch_Queued_Message.h
@@ -0,0 +1,99 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Synch_Queued_Message.h
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan <coryan@uci.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_SYNCH_QUEUED_MESSAGE_H
+#define TAO_SYNCH_QUEUED_MESSAGE_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Queued_Message.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_Synch_Queued_Message
+ *
+ * @brief Specialize TAO_Queued_Message for synchronous requests,
+ * i.e. twoways and oneways sent with reliability better than
+ * SYNC_NONE.
+ *
+ * Reliable requests block the sending thread until the message is
+ * sent, likewise, the sending thread must be informed if the
+ * connection is closed or the message times out.
+ *
+ * In contrast oneway (and AMI) requests sent with the SYNC_NONE
+ * policy are simple discarded if the connection fails or they
+ * timeout.
+ *
+ * Another important difference is the management of the data buffer:
+ * one SYNC_NONE messages the buffer is immediately copied into a
+ * newly allocated buffer, and must be deallocated. Other types of
+ * requests use the memory allocated by the sending thread.
+ *
+ */
+class TAO_Export TAO_Synch_Queued_Message : public TAO_Queued_Message
+{
+public:
+ /// Constructor
+ /**
+ * @param contents The message block chain that must be sent.
+ *
+ * @param alloc The allocator that is used to allocate objects of
+ * this type.
+ */
+ TAO_Synch_Queued_Message (const ACE_Message_Block *contents,
+ TAO_ORB_Core *oc,
+ ACE_Allocator *alloc = 0,
+ bool is_heap_allocated = false);
+
+ /// Destructor
+ virtual ~TAO_Synch_Queued_Message (void);
+
+ const ACE_Message_Block *current_block (void) const;
+
+ /** @name Implement the Template Methods from TAO_Queued_Message
+ */
+ //@{
+ virtual size_t message_length (void) const;
+ virtual int all_data_sent (void) const;
+ virtual void fill_iov (int iovcnt_max, int &iovcnt, iovec iov[]) const;
+ virtual void bytes_transferred (size_t &byte_count);
+ virtual TAO_Queued_Message *clone (ACE_Allocator *alloc);
+ virtual void destroy (void);
+ //@}
+
+private:
+ /// The contents of the message.
+ /**
+ * The message is normally generated by a TAO_OutputCDR stream. The
+ * application marshals the payload, possibly generating a chain of
+ * message block connected via the 'cont()' field.
+ */
+ ACE_Message_Block *contents_;
+
+ /// The current message block
+ /**
+ * The message may be set in multiple writev() operations. This
+ * point keeps track of the next message to send out.
+ */
+ ACE_Message_Block *current_block_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_QUEUED_MESSAGE_H */
diff --git a/TAO/tao/Synch_Reply_Dispatcher.cpp b/TAO/tao/Synch_Reply_Dispatcher.cpp
new file mode 100644
index 00000000000..9dbdcb0eabd
--- /dev/null
+++ b/TAO/tao/Synch_Reply_Dispatcher.cpp
@@ -0,0 +1,120 @@
+// $Id$
+
+#include "tao/Synch_Reply_Dispatcher.h"
+#include "tao/ORB_Core.h"
+#include "tao/Pluggable_Messaging_Utils.h"
+#include "tao/debug.h"
+
+
+ACE_RCSID (tao,
+ Synch_Reply_Dispatcher,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Constructor.
+TAO_Synch_Reply_Dispatcher::TAO_Synch_Reply_Dispatcher (
+ TAO_ORB_Core *orb_core,
+ IOP::ServiceContextList &sc
+ )
+ : reply_service_info_ (sc),
+ orb_core_ (orb_core),
+ db_ (sizeof buf_,
+ ACE_Message_Block::MB_DATA,
+ this->buf_,
+ this->orb_core_->input_cdr_buffer_allocator (),
+ this->orb_core_->locking_strategy (),
+ ACE_Message_Block::DONT_DELETE,
+ this->orb_core_->input_cdr_dblock_allocator ()),
+ reply_cdr_ (&db_,
+ ACE_Message_Block::DONT_DELETE,
+ TAO_ENCAP_BYTE_ORDER,
+ TAO_DEF_GIOP_MAJOR,
+ TAO_DEF_GIOP_MINOR,
+ orb_core)
+{
+ // As a TAO_LF_Event we start in the active state....
+ this->state_changed_i (TAO_LF_Event::LFS_ACTIVE);
+}
+
+// Destructor.
+TAO_Synch_Reply_Dispatcher::~TAO_Synch_Reply_Dispatcher (void)
+{
+}
+
+TAO_InputCDR &
+TAO_Synch_Reply_Dispatcher::reply_cdr (void)
+{
+ return this->reply_cdr_;
+}
+
+int
+TAO_Synch_Reply_Dispatcher::dispatch_reply (
+ TAO_Pluggable_Reply_Params &params)
+{
+ if (params.input_cdr_ == 0)
+ return -1;
+
+ this->reply_status_ = params.reply_status_;
+
+ // Steal the buffer, that way we don't do any unnecesary copies of
+ // this data.
+ CORBA::ULong const max = params.svc_ctx_.maximum ();
+ CORBA::ULong const len = params.svc_ctx_.length ();
+ IOP::ServiceContext* context_list = params.svc_ctx_.get_buffer (1);
+ this->reply_service_info_.replace (max, len, context_list, 1);
+
+ // Must reset the message state, it is possible that the same reply
+ // dispatcher is used because the request must be re-sent.
+ //this->message_state_.reset (0);
+
+ // Transfer the <params.input_cdr_>'s content to this->reply_cdr_
+ if (ACE_BIT_DISABLED ((*params.input_cdr_).start()->data_block()->flags(),
+ ACE_Message_Block::DONT_DELETE))
+ {
+ // Data block is on the heap, so just duplicate it.
+ this->reply_cdr_ = *params.input_cdr_;
+ this->reply_cdr_.clr_mb_flags( ACE_Message_Block::DONT_DELETE );
+ }
+ else
+ {
+ ACE_Data_Block *db =
+ this->reply_cdr_.clone_from (*params.input_cdr_);
+
+ if (db == 0)
+ {
+ if (TAO_debug_level > 2)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "TAO (%P|%t) - Synch_Reply_Dispatcher::dispatch_reply "
+ "clone_from failed \n"));
+ }
+ return -1;
+ }
+
+ // See whether we need to delete the data block by checking the
+ // flags. We cannot be happy that we initally allocated the
+ // datablocks of the stack. If this method is called twice, as is in
+ // some cases where the same invocation object is used to make two
+ // invocations like forwarding, the release becomes essential.
+ if (ACE_BIT_DISABLED (db->flags (),
+ ACE_Message_Block::DONT_DELETE))
+ {
+ db->release ();
+ }
+ }
+
+ this->state_changed (TAO_LF_Event::LFS_SUCCESS,
+ this->orb_core_->leader_follower ());
+
+ return 1;
+}
+
+void
+TAO_Synch_Reply_Dispatcher::connection_closed (void)
+{
+ this->state_changed (TAO_LF_Event::LFS_CONNECTION_CLOSED,
+ this->orb_core_->leader_follower ());
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Synch_Reply_Dispatcher.h b/TAO/tao/Synch_Reply_Dispatcher.h
new file mode 100644
index 00000000000..c22e515cd47
--- /dev/null
+++ b/TAO/tao/Synch_Reply_Dispatcher.h
@@ -0,0 +1,95 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Synch_Reply_Dispatcher.h
+ *
+ * $Id$
+ *
+ * Dispatch the reply appropriately.
+ *
+ * @author Alexander Babu Arulanthu <alex@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_SYNCH_REPLY_DISPATCHER_H
+#define TAO_SYNCH_REPLY_DISPATCHER_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Reply_Dispatcher.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/LF_Invocation_Event.h"
+#include "tao/CDR.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Pluggable_Reply_Params;
+
+namespace IOP
+{
+ class ServiceContextList;
+}
+
+/**
+ * @class TAO_Synch_Reply_Dispatcher
+ *
+ * @brief Reply dispatcher for Synchronous Method Invocation (SMI)s.
+ *
+ */
+class TAO_Export TAO_Synch_Reply_Dispatcher
+ : public TAO_Reply_Dispatcher
+ , public TAO_LF_Invocation_Event
+{
+
+public:
+ /// Constructor.
+ TAO_Synch_Reply_Dispatcher (TAO_ORB_Core *orb_core,
+ IOP::ServiceContextList &sc);
+
+ /// Destructor.
+ virtual ~TAO_Synch_Reply_Dispatcher (void);
+
+ /// Return the reply CDR.
+ TAO_InputCDR &reply_cdr (void);
+
+ virtual int dispatch_reply (TAO_Pluggable_Reply_Params &params);
+
+ virtual void connection_closed (void);
+
+protected:
+ /// The service context list
+ IOP::ServiceContextList &reply_service_info_;
+
+private:
+ /// Cache the ORB Core pointer.
+ TAO_ORB_Core *orb_core_;
+
+ /* @todo At some point of time we are going to get to a situation
+ where TAO has huge stack sizes. Need to think on how we would
+ deal with that. One idea would be to push these things on TSS as
+ this is created by the thread on a per invocation basis. Post 1.2
+ would be a nice time for that I guess
+ */
+
+ /// The buffer that is used to initialise the data block
+ char buf_[ACE_CDR::DEFAULT_BUFSIZE];
+
+ /// datablock that is created on teh stack to initialise the CDR
+ /// stream underneath.
+ ACE_Data_Block db_;
+
+ /// CDR stream which has the reply information that needs to be
+ /// demarshalled by the stubs
+ TAO_InputCDR reply_cdr_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_REPLY_DISPATCHER_H */
diff --git a/TAO/tao/SystemException.cpp b/TAO/tao/SystemException.cpp
new file mode 100644
index 00000000000..a55e9cc3b6a
--- /dev/null
+++ b/TAO/tao/SystemException.cpp
@@ -0,0 +1,984 @@
+// $Id$
+
+#include "tao/SystemException.h"
+#include "tao/Environment.h"
+#include "tao/ORB_Constants.h"
+#include "tao/CORBA_String.h"
+#include "tao/CDR.h"
+#include "tao/debug.h"
+#include "tao/AnyTypeCode_Adapter.h"
+
+#include "ace/Malloc.h"
+#include "ace/SString.h"
+#include "ace/OS_NS_string.h"
+#include "ace/OS_NS_stdio.h"
+#include "ace/Dynamic_Service.h"
+
+#if !defined (ACE_LACKS_IOSTREAM_TOTALLY)
+// Needed for ostream& operator<< (ostream &os, const CORBA::Exception &e)
+// FUZZ: disable check_for_streams_include
+#include "ace/streams.h"
+#endif /* (ACE_LACKS_IOSTREAM_TOTALLY) */
+
+#if !defined (__ACE_INLINE__)
+# include "tao/SystemException.inl"
+#endif /* __ACE_INLINE__ */
+
+
+ACE_RCSID (tao,
+ SystemException,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @name @c errno Encoding
+ *
+ * The @c errno encoding is located in the bottom 7 bits.
+ */
+//@{
+const CORBA::ULong TAO_UNSPECIFIED_MINOR_CODE = 0x0U;
+const CORBA::ULong TAO_ETIMEDOUT_MINOR_CODE = 0x1U;
+const CORBA::ULong TAO_ENFILE_MINOR_CODE = 0x2U;
+const CORBA::ULong TAO_EMFILE_MINOR_CODE = 0x3U;
+const CORBA::ULong TAO_EPIPE_MINOR_CODE = 0x4U;
+const CORBA::ULong TAO_ECONNREFUSED_MINOR_CODE = 0x5U;
+const CORBA::ULong TAO_ENOENT_MINOR_CODE = 0x6U;
+const CORBA::ULong TAO_EBADF_MINOR_CODE = 0x7U;
+const CORBA::ULong TAO_ENOSYS_MINOR_CODE = 0x8U;
+const CORBA::ULong TAO_EPERM_MINOR_CODE = 0x9U;
+const CORBA::ULong TAO_EAFNOSUPPORT_MINOR_CODE = 0xAU;
+const CORBA::ULong TAO_EAGAIN_MINOR_CODE = 0xBU;
+const CORBA::ULong TAO_ENOMEM_MINOR_CODE = 0xCU;
+const CORBA::ULong TAO_EACCES_MINOR_CODE = 0xDU;
+const CORBA::ULong TAO_EFAULT_MINOR_CODE = 0xEU;
+const CORBA::ULong TAO_EBUSY_MINOR_CODE = 0xFU;
+const CORBA::ULong TAO_EEXIST_MINOR_CODE = 0x10U;
+const CORBA::ULong TAO_EINVAL_MINOR_CODE = 0x11U;
+const CORBA::ULong TAO_ECOMM_MINOR_CODE = 0x12U;
+const CORBA::ULong TAO_ECONNRESET_MINOR_CODE = 0x13U;
+const CORBA::ULong TAO_ENOTSUP_MINOR_CODE = 0x14U;
+// *Don't* use TAO_<errno>_MINOR_CODE greater than 0x7FU!
+//@}
+
+// ****************************************************************
+
+CORBA::SystemException::SystemException (void)
+ : minor_ (0),
+ completed_ (CORBA::COMPLETED_NO)
+{
+}
+
+CORBA::SystemException::SystemException (const char *repository_id,
+ const char *local_name,
+ CORBA::ULong code,
+ CORBA::CompletionStatus completed)
+ : CORBA::Exception (repository_id,
+ local_name),
+ minor_ (code),
+ completed_ (completed)
+{
+}
+
+CORBA::SystemException::SystemException (CORBA::ULong code,
+ CORBA::CompletionStatus completed)
+ : minor_ (code),
+ completed_ (completed)
+{
+}
+
+CORBA::SystemException::SystemException (const CORBA::SystemException &src)
+ : CORBA::Exception (src),
+ minor_ (src.minor_),
+ completed_ (src.completed_)
+{
+}
+
+CORBA::SystemException::~SystemException (void)
+{
+}
+
+CORBA::SystemException &
+CORBA::SystemException::operator= (const CORBA::SystemException &src)
+{
+ this->Exception::operator= (src);
+
+ this->minor_ = src.minor_;
+ this->completed_ = src.completed_;
+
+ return *this;
+}
+
+void
+CORBA::SystemException::_tao_encode (TAO_OutputCDR &cdr
+ ACE_ENV_ARG_DECL) const
+{
+ if (cdr.write_string (this->_rep_id ())
+ && cdr.write_ulong (this->minor ())
+ && cdr.write_ulong (this->completed ()))
+ {
+ return;
+ }
+
+ ACE_THROW (CORBA::MARSHAL ());
+}
+
+void
+CORBA::SystemException::_tao_decode (TAO_InputCDR &cdr
+ ACE_ENV_ARG_DECL)
+{
+ // The string is read by the caller, to determine the exact type of
+ // the exception. We just decode the fields...
+ // cdr.read_string (this->id ());
+ CORBA::ULong tmp;
+
+ if (cdr.read_ulong (this->minor_)
+ && cdr.read_ulong (tmp))
+ {
+ this->completed_ = CORBA::CompletionStatus (tmp);
+ return;
+ }
+
+ ACE_THROW (CORBA::MARSHAL ());
+}
+
+CORBA::ULong
+CORBA::SystemException::_tao_errno (int errno_value)
+{
+ switch (errno_value)
+ {
+ case 0:
+ return TAO_UNSPECIFIED_MINOR_CODE;
+ case ETIMEDOUT:
+ return TAO_ETIMEDOUT_MINOR_CODE;
+ case ENFILE:
+ return TAO_ENFILE_MINOR_CODE;
+ case EPIPE:
+ return TAO_EPIPE_MINOR_CODE;
+ case ECONNREFUSED:
+ return TAO_ECONNREFUSED_MINOR_CODE;
+ case ENOENT:
+ return TAO_ENOENT_MINOR_CODE;
+
+#if !defined (ACE_HAS_WINCE)
+ case EMFILE:
+ return TAO_EMFILE_MINOR_CODE;
+ case EBADF:
+ return TAO_EBADF_MINOR_CODE;
+ case EPERM:
+ return TAO_EPERM_MINOR_CODE;
+ case EINVAL:
+ return TAO_EINVAL_MINOR_CODE;
+#endif // ACE_HAS_WINCE
+
+#if (ENOSYS != EFAULT)
+ case ENOSYS:
+ return TAO_ENOSYS_MINOR_CODE;
+#endif /* ENOSYS != EFAULT */
+ case EAFNOSUPPORT:
+ return TAO_EAFNOSUPPORT_MINOR_CODE;
+ case EAGAIN:
+ return TAO_EAGAIN_MINOR_CODE;
+ case ENOMEM:
+ return TAO_ENOMEM_MINOR_CODE;
+ case EACCES:
+ return TAO_EACCES_MINOR_CODE;
+ case EFAULT:
+ return TAO_EFAULT_MINOR_CODE;
+ case EBUSY:
+ return TAO_EBUSY_MINOR_CODE;
+ case EEXIST:
+ return TAO_EEXIST_MINOR_CODE;
+ case ECOMM:
+ return TAO_ECOMM_MINOR_CODE;
+ case ECONNRESET:
+ return TAO_ECONNRESET_MINOR_CODE;
+#if (ENOTSUP != ENOSYS)
+ case ENOTSUP:
+ return TAO_ENOTSUP_MINOR_CODE;
+#endif /* ENOSYS != EFAULT */
+ default:
+ // Mask off bottom 7 bits and return them.
+ return errno_value & 0x7FU;
+ }
+}
+
+CORBA::Exception *
+CORBA::SystemException::_tao_duplicate (void) const
+{
+ return 0;
+}
+
+CORBA::ULong
+CORBA::SystemException::_tao_minor_code (u_int location,
+ int errno_value)
+{
+ return
+ TAO::VMCID
+ | location
+ | _tao_errno (errno_value);
+}
+
+void
+CORBA::SystemException::_tao_print_system_exception (FILE *) const
+{
+ ACE_DEBUG ((LM_ERROR,
+ ACE_TEXT("(%P|%t) system exception, ID '%s'\n"),
+ ACE_TEXT_CHAR_TO_TCHAR (this->_info ().c_str ())));
+}
+
+ACE_CString
+CORBA::SystemException::_info (void) const
+{
+ // @@ there are a few other "user exceptions" in the CORBA scope,
+ // they're not all standard/system exceptions ... really need to
+ // either compare exhaustively against all those IDs (yeech) or
+ // (preferably) to represent the exception type directly in the
+ // exception value so it can be queried.
+
+ ACE_CString info = "system exception, ID '";
+ info += this->_rep_id ();
+ info += "'\n";
+
+ const CORBA::ULong VMCID = this->minor () & 0xFFFFF000u;
+
+ if (VMCID == TAO::VMCID)
+ {
+ // @@ Move the following code to a subroutine, it is too long already!
+ const char *location;
+ switch (this->minor () & 0x00000F80u)
+ {
+ case TAO_INVOCATION_LOCATION_FORWARD_MINOR_CODE:
+ location = "location forward failed";
+ break;
+ case TAO_INVOCATION_SEND_REQUEST_MINOR_CODE:
+ location = "send request failed";
+ break;
+ case TAO_POA_DISCARDING:
+ location = "poa in discarding state";
+ break;
+ case TAO_POA_HOLDING:
+ location = "poa in holding state";
+ break;
+ case TAO_POA_INACTIVE:
+ location = "poa in inactive state";
+ break;
+ case TAO_UNHANDLED_SERVER_CXX_EXCEPTION:
+ location = "unhandled c++ exception in server side";
+ break;
+ case TAO_INVOCATION_RECV_REQUEST_MINOR_CODE:
+ location = "failed to recv request response";
+ break;
+ case TAO_CONNECTOR_REGISTRY_NO_USABLE_PROTOCOL:
+ location = "all protocols failed to parse the IOR";
+ break;
+ case TAO_MPROFILE_CREATION_ERROR:
+ location = "error during MProfile creation";
+ break;
+ case TAO_TIMEOUT_CONNECT_MINOR_CODE:
+ location = "timeout during connect";
+ break;
+ case TAO_TIMEOUT_SEND_MINOR_CODE:
+ location = "timeout during send";
+ break;
+ case TAO_TIMEOUT_RECV_MINOR_CODE:
+ location = "timeout during recv";
+ break;
+ case TAO_IMPLREPO_MINOR_CODE:
+ location = "implrepo server exception";
+ break;
+ case TAO_ACCEPTOR_REGISTRY_OPEN_LOCATION_CODE:
+ location = "endpoint initialization failure in Acceptor Registry";
+ break;
+ case TAO_ORB_CORE_INIT_LOCATION_CODE:
+ location = "ORB Core initialization failed";
+ break;
+ case TAO_POLICY_NARROW_CODE:
+ location = "Failure when narrowing a Policy";
+ break;
+ case TAO_GUARD_FAILURE:
+ location = "Failure when trying to acquire a guard/monitor";
+ break;
+ case TAO_POA_BEING_DESTROYED:
+ location = "POA has been destroyed or is currently being destroyed";
+ break;
+ case TAO_AMH_REPLY_LOCATION_CODE:
+ location = "Failure when trying to send AMH reply";
+ break;
+ case TAO_RTCORBA_THREAD_CREATION_LOCATION_CODE:
+ location = "Failure in thread creation for RTCORBA thread pool";
+ break;
+ default:
+ location = "unknown location";
+ }
+
+ const char *errno_indication;
+ char unknown_errno [255];
+ CORBA::ULong minor_code = this->minor () & 0x7FU;
+ switch (minor_code)
+ {
+ case TAO_UNSPECIFIED_MINOR_CODE:
+ errno_indication = "unspecified errno";
+ break;
+ case TAO_ETIMEDOUT_MINOR_CODE:
+ errno_indication = "ETIMEOUT";
+ break;
+ case TAO_ENFILE_MINOR_CODE:
+ errno_indication = "ENFILE";
+ break;
+ case TAO_EMFILE_MINOR_CODE:
+ errno_indication = "EMFILE";
+ break;
+ case TAO_EPIPE_MINOR_CODE:
+ errno_indication = "EPIPE";
+ break;
+ case TAO_ECONNREFUSED_MINOR_CODE:
+ errno_indication = "ECONNREFUSED";
+ break;
+ case TAO_ENOENT_MINOR_CODE:
+ errno_indication = "ENOENT";
+ break;
+ case TAO_EBADF_MINOR_CODE:
+ errno_indication = "EBADF";
+ break;
+ case TAO_ENOSYS_MINOR_CODE:
+ errno_indication = "ENOSYS";
+ break;
+ case TAO_EPERM_MINOR_CODE:
+ errno_indication = "EPERM";
+ break;
+ case TAO_EAFNOSUPPORT_MINOR_CODE:
+ errno_indication = "EAFNOSUPPORT";
+ break;
+ case TAO_EAGAIN_MINOR_CODE:
+ errno_indication = "EAGAIN";
+ break;
+ case TAO_ENOMEM_MINOR_CODE:
+ errno_indication = "ENOMEM";
+ break;
+ case TAO_EACCES_MINOR_CODE:
+ errno_indication = "EACCES";
+ break;
+ case TAO_EFAULT_MINOR_CODE:
+ errno_indication = "EFAULT";
+ break;
+ case TAO_EBUSY_MINOR_CODE:
+ errno_indication = "EBUSY";
+ break;
+ case TAO_EEXIST_MINOR_CODE:
+ errno_indication = "EEXIST";
+ break;
+ case TAO_EINVAL_MINOR_CODE:
+ errno_indication = "EINVAL";
+ break;
+ case TAO_ECOMM_MINOR_CODE:
+ errno_indication = "ECOMM";
+ break;
+ case TAO_ECONNRESET_MINOR_CODE:
+ errno_indication = "ECONNRESET";
+ break;
+ case TAO_ENOTSUP_MINOR_CODE:
+ errno_indication = "ENOTSUP";
+ break;
+ default:
+ {
+ // 7 bits of some other errno.
+ ACE_OS::sprintf (unknown_errno,
+ "low 7 bits of errno: %3u %s",
+ minor_code, ACE_OS::strerror (minor_code));
+
+ errno_indication = unknown_errno;
+ }
+ }
+
+ char buffer[BUFSIZ];
+ ACE_OS::sprintf (buffer,
+ "TAO exception, "
+ "minor code = %x (%s; %s), "
+ "completed = %s\n",
+ minor_code,
+ location,
+ errno_indication,
+ (completed () == CORBA::COMPLETED_YES) ? "YES" :
+ (completed () == CORBA::COMPLETED_NO) ? "NO" :
+ (completed () == CORBA::COMPLETED_MAYBE) ? "MAYBE" :
+ "garbage");
+
+ info += buffer;
+ }
+ else if (VMCID == CORBA::OMGVMCID)
+ {
+ const CORBA::ULong minor_code = this->minor () & 0xFFFU;
+
+ const char *minor_description = 0;
+
+ if (minor_code > 0)
+ minor_description =
+ CORBA::SystemException::_tao_get_omg_exception_description (
+ *this,
+ minor_code);
+ else
+ minor_description = "*unknown description*";
+
+ char buffer[BUFSIZ];
+ ACE_OS::sprintf (buffer,
+ "OMG minor code (%d), "
+ "described as '%s', "
+ "completed = %s\n",
+ minor_code,
+ minor_description,
+ (completed () == CORBA::COMPLETED_YES) ? "YES" :
+ (completed () == CORBA::COMPLETED_NO) ? "NO" :
+ (completed () == CORBA::COMPLETED_MAYBE) ? "MAYBE" :
+ "garbage");
+
+ info += buffer;
+ }
+ else
+ {
+ char buffer[BUFSIZ];
+ ACE_OS::sprintf (buffer,
+ "Unknown vendor minor code id (%x), "
+ "minor code = %x, completed = %s\n",
+ VMCID,
+ this->minor (), // Use the raw minor code
+ (completed () == CORBA::COMPLETED_YES) ? "YES" :
+ (completed () == CORBA::COMPLETED_NO) ? "NO" :
+ (completed () == CORBA::COMPLETED_MAYBE) ? "MAYBE" :
+ "garbage");
+
+ info += buffer;
+ }
+
+ return info;
+}
+
+const char *
+CORBA::SystemException::_tao_get_omg_exception_description (
+ const CORBA::SystemException &exc,
+ CORBA::ULong minor_code)
+{
+#ifndef ACE_NDEBUG
+
+ static const char *UNKNOWN_TABLE[] =
+ {
+ "Unlisted user exception received by client.", // 1
+ "Non-standard SystemException not supported.", // 2
+ "An unknown user exception received by a portable interceptor." // 3
+ };
+
+ static const char *BAD_PARAM_TABLE[] =
+ {
+ "Failure to register, unregister, or lookup value factory.", // 1
+ "RID already defined in IFR.", // 2
+ "Name already used in the context in IFR.", // 3
+ "Target is not a valid container.", // 4
+ "Name clash in inherited context.", // 5
+ "Incorrect type for abstract interface.", // 6
+ "string_to_object conversion failed due to a bad scheme name.", // 7
+ "string_to_object conversion failed due to a bad address.", // 8
+ "string_to_object conversion failed due to a bad schema specific part.",// 9
+ "string_to_object conversion failed due to non specific reason.", // 10
+ "Attempt to derive abstract interface from non-abstract base interface in the Interface Repository.", // 11
+ "Attempt to let a ValueDef support more than one non-abstract interface in the Interface Repository.", // 12
+ "Attempt to use an incomplete TypeCode as a parameter.", // 13
+ "Invalid object id passed to POA::create_reference_by_id.", // 14
+ "Bad name argument in TypeCode operation.", // 15
+ "Bad RepositoryId argument in TypeCode operation.", // 16
+ "Invalid member name in TypeCode operation.", // 17
+ "Duplicate label value in create_union_tc.", // 18
+ "Incompatible TypeCode of label and discriminator in create_union_tc.", // 19
+ "Supplied discriminator type illegitimate in create_union_tc.", // 20
+ "Any passed to ServerRequest::set_exception does not contain an exception.", // 21
+ "Unlisted user exception passed to ServerRequest::set_exception", // 22
+ "wchar transmission code set not in service context.", // 23
+ "Service context is not in OMG-defined range.", // 24
+ "Enum value out of range.", // 25
+ "Invalid service context Id in portable interceptor.", // 26
+ "Attempt to call register_initial_reference with a null Object.", // 27
+ "Invalid component Id in portable interceptor.", // 28
+ "Invalid profile Id in portable interceptor.", // 29
+ "Two or more Policy objects with the same PolicyType value supplied to Object::set_policy_overrides or PolicyManager::set_policy_overrides." // 30
+ "Attempt to define a oneway operation with non-void result, out or inout parameters or user exceptions.", // 31
+ "DII asked to create request for an implicit operation.", // 32,
+ "An OTS/XA integration xa_ call returned XAER_INVAL.", // 33
+ "Union branch modifier called with bad case label discriminator.", // 34
+ "Illegal IDL context property name.", // 35
+ "Illegal IDL property search string.", // 36
+ "Illegal IDL context name.", // 37
+ "Non-empty IDL context.", // 38
+ "Unsupported RMI/IDL customer value type stream format.", // 39
+ "ORB output stream does not support ValueOutputStream interface.", // 40
+ "ORB input stream does not support ValueInputStream interface.", // 41
+ "Character support limited to ISO 8859-1 for this object reference", // 42
+ "Attempt to add a Pollable to a second PollableSet."
+ };
+
+ static const char *IMP_LIMIT_TABLE[] =
+ {
+ "Unable to use any profile in IOR." // 1
+ };
+
+ static const char *INITIALIZE_TABLE[] =
+ {
+ "Priority range too restricted for ORB." // 1
+ };
+
+
+ static const char *INV_OBJREF_TABLE[] =
+ {
+ "wchar Code Set support not specified.", // 1
+ "Codeset component required for type using wchar or wstring data." // 2
+ };
+
+ static const char *MARSHAL_TABLE[] =
+ {
+ "Unable to locate value factory.", // 1
+ "ServerRequest::set_result called before ServerRequest::ctx when the operation IDL contains a context clause.", // 2
+ "NVList passed to ServerRequest::arguments does not describe all parameters passed by client.", // 3
+ "Attempt to marshal Local object.", // 4
+ "wchar or wstring data erroneously sent by client over GIOP 1.0 connection.", // 5
+ "wchar or wstring data erroneously returned by server over GIOP 1.0 connection.", //6
+ "Unsupported RMI/IDL custom value type stream format.", // 7
+ "Custom data not compatible with ValueHandler read operation.", // 8
+ "Codeset service contexts with different values recieved on the same connection." // 9
+
+ };
+
+ static const char *BAD_TYPECODE_TABLE[] =
+ {
+ "Attempt to marshal incomplete TypeCode.", // 1
+ "Member type code illegitimate in TypeCode operation.", // 2
+ "Illegal parameter type." // 3
+ };
+
+ static const char *NO_IMPLEMENT_TABLE[] =
+ {
+ "Missing local value implementation.", // 1
+ "Incompatible value implementation version.", // 2
+ "Unable to use any profile in IOR.", // 3
+ "Attempt to use DII on Local object.", // 4
+ "Biomolecular Sequence Analysis iterator cannot be reset.", // 5
+ "Biomolecular Sequence Analysis metadata is not available as XML.", // 6
+ "Genomic Maps iterator cannot be rest.", // 7
+ "Operation not implemented in local object" // 8
+ };
+
+ static const char *NO_RESOURCES_TABLE[] =
+ {
+ "Portable Interceptor operation not support in this binding.", // 1
+ "No connection for request's priority." // 2
+ };
+
+ static const char *BAD_INV_ORDER_TABLE[] =
+ {
+ "Dependency exists in IFR preventing destruction of this object", // 1
+ "Attempt to destroy indestructible objects in IFR.", // 2
+ "Operation would deadlock.", // 3
+ "ORB has shutdown.", // 4
+ "Attempt to invoke \"send\" or \"invoke\" operation of the same \"Request\" object more than once.", // 5
+ "Attempt to set a servant manager after one has already been set.", // 6
+ "ServerRequest::arguments called more than once or after a call to ServerRequest::set_exception.", // 7
+ "ServerRequest::ctx called more than once or before ServerRequest::arguments or after ServerRequest::ctx, ServerRequest::set_result or ServerRequest::set_exception.", // 8
+ "ServerRequest::set_result called more than once or before ServerRequest::arguments or after ServerRequest::set_result or ServerRequest::set_exception.", // 9
+ "Attempt to send a DII request after it was sent previously.", // 10
+ "Attempt to poll a DII request or to retrieve its result before the request was sent.", // 11
+ "Attempt to poll a DII request or to retrieve its result after the result was retrieved previously.", // 12
+ "Attempt to poll a synchronous DII request or to retrieve results from a synchronous DII request.", // 13
+ "Invalid portable interceptor call", // 14
+ "Service context add failed in portable interceptor because a service context with the given id already exists.", // 15
+ "Registration of PolicyFactory failed because a factory already exists for the given type.", // 16
+ "POA cannot create POAs while undergoing destruction.", // 17
+ "Attempt to reassign priority.", // 18
+ "An OTS/XA integration xa_start call returned XAER_OUTSIDE.", // 19
+ "An OTS/XA integration xa_call returned XAER_PROTO.", // 20
+ "Transaction context of request & client threads do not match in interceptor.", // 21
+ "Poller has not returned any response yet.", // 22
+ "Registration of TaggedProfileFactory failed because a factory already exists for the given id.", // 23
+ "Registration of TaggedComponentFactory failed because a factory already exists for the given id.", // 24
+ "Iteration has no more elements.", // 25
+ "Invocation of this operation not allowed in post_init." // 26
+
+ };
+
+ static const char *TRANSIENT_TABLE[] =
+ {
+ "Request discarded because of resource exhaustion in POA, or because POA is in discarding state.", // 1
+ "No usable profile in IOR.", // 2
+ "Request cancelled.", // 3
+ "POA destroyed." // 4
+ };
+
+ static const char *OBJ_ADAPTER_TABLE[] =
+ {
+ "System exception in AdapterActivator::unknown_adapter.", // 1
+ "Incorrect servant type returned by servant manager", // 2
+ "No default servant available [POA policy].", // 3
+ "No servant manager available [POA policy].", // 4
+ "Violation of POA policy by ServantActivator::incarnate.",// 5
+ "Exception in PortableInterceptor::IORInterceptor.components_established.", // 6
+ "Null servant returned by servant manager." // 7
+ };
+
+ static const char *DATA_CONVERSION_TABLE[] =
+ {
+ "Character does not map to negotiated transmission code set.", // 1
+ "Failure of PriorityMapping object." // 2
+ };
+
+ static const char *OBJECT_NOT_EXIST_TABLE[] =
+ {
+ "Attempt to pass an unactivated (unregistered) value as an object reference.", // 1
+ "Failed to create or locate Object Adapter.", // 2
+ "Biomolecular Sequence Analysis Service is no longer available.", // 3
+ "Object Adapter inactive.", // 4
+ "This Poller has already delivered a reply to some client." // 5
+ };
+
+ static const char *INV_POLICY_TABLE[] =
+ {
+ "Unable to reconcile IOR specified policy with the effective policy override.", // 1
+ "Invalid PolicyType.", // 2
+ "No PolicyFactory has been registered for the given PolicyType." // 3
+ };
+
+ static const char *ACTIVITY_COMPLETED_TABLE[] =
+ {
+ "Activity context completed through timeout, or in some way other then requested." // 1
+ };
+
+ static const char *ACTIVITY_REQUIRED_TABLE[] =
+ {
+ "Calling thread lacks required activity context." // 1
+ };
+
+ static const char *BAD_OPERATION_TABLE[] =
+ {
+ "ServantManager returned wrong servant type.", // 1
+ "Operation or attribute not known to target object." // 2
+ };
+
+ static const char *BAD_CONTEXT_TABLE[] =
+ {
+ "IDL context not found.", // 1
+ "No matching IDL context property." // 2
+ };
+
+ static const char *CODESET_INCOMPATIBLE_TABLE[] =
+ {
+ "Codeset negotiation failed.", // 1
+ "Codeset delivered in CodeSetContext is not supported by server as transmission codeset." // 2
+ };
+
+ static const char *INTF_REPOS_TABLE[] =
+ {
+ "Interface Repository not available.", // 1
+ "No entry for requested interface in Interface Repository." // 2
+ };
+
+ if (minor_code == 0)
+ return "*unknown description*";
+
+ minor_code--; // Adjust to match table offset.
+
+ CORBA::UNKNOWN const * unknown_exception =
+ dynamic_cast <const CORBA::UNKNOWN *> (&exc);
+ if (unknown_exception != 0
+ && minor_code < sizeof UNKNOWN_TABLE / sizeof (char *))
+ return UNKNOWN_TABLE[minor_code];
+
+ CORBA::BAD_PARAM const * bad_param__exception =
+ dynamic_cast <const CORBA::BAD_PARAM *> (&exc);
+ if (bad_param__exception != 0
+ && minor_code < sizeof BAD_PARAM_TABLE / sizeof (char *))
+ return BAD_PARAM_TABLE[minor_code];
+
+ CORBA::IMP_LIMIT const * imp_limit_exception =
+ dynamic_cast <const CORBA::IMP_LIMIT *> (&exc);
+ if (imp_limit_exception != 0
+ && minor_code < sizeof IMP_LIMIT_TABLE / sizeof (char *))
+ return IMP_LIMIT_TABLE[minor_code];
+
+ CORBA::INITIALIZE const * initialize_exception =
+ dynamic_cast <const CORBA::INITIALIZE *> (&exc);
+ if (initialize_exception != 0
+ && minor_code < sizeof INITIALIZE_TABLE / sizeof (char *))
+ return INITIALIZE_TABLE[minor_code];
+
+ CORBA::INV_OBJREF const * inv_objref_exception =
+ dynamic_cast <const CORBA::INV_OBJREF *> (&exc);
+ if (inv_objref_exception != 0
+ && minor_code < sizeof INV_OBJREF_TABLE / sizeof (char *))
+ return INV_OBJREF_TABLE[minor_code];
+
+ CORBA::MARSHAL const * marshal_exception =
+ dynamic_cast <const CORBA::MARSHAL *> (&exc);
+ if (marshal_exception != 0
+ && minor_code < sizeof MARSHAL_TABLE / sizeof (char *))
+ return MARSHAL_TABLE[minor_code];
+
+ CORBA::BAD_TYPECODE const * bad_typecode_exception =
+ dynamic_cast <const CORBA::BAD_TYPECODE *> (&exc);
+ if (bad_typecode_exception != 0
+ && minor_code < sizeof BAD_TYPECODE_TABLE / sizeof (char *))
+ return BAD_TYPECODE_TABLE[minor_code];
+
+ CORBA::NO_IMPLEMENT const * no_implement_exception =
+ dynamic_cast <const CORBA::NO_IMPLEMENT *> (&exc);
+ if (no_implement_exception != 0
+ && minor_code < sizeof NO_IMPLEMENT_TABLE / sizeof (char *))
+ return NO_IMPLEMENT_TABLE[minor_code];
+
+ CORBA::NO_RESOURCES const * no_resource_exception =
+ dynamic_cast <const CORBA::NO_RESOURCES *> (&exc);
+ if (no_resource_exception != 0
+ && minor_code < sizeof NO_RESOURCES_TABLE / sizeof (char *))
+ return NO_RESOURCES_TABLE[minor_code];
+
+ CORBA::BAD_INV_ORDER const * bad_inv_order_exception =
+ dynamic_cast <const CORBA::BAD_INV_ORDER *> (&exc);
+ if (bad_inv_order_exception != 0
+ && minor_code < sizeof BAD_INV_ORDER_TABLE / sizeof (char *))
+ return BAD_INV_ORDER_TABLE[minor_code];
+
+ CORBA::TRANSIENT const * transient_exception =
+ dynamic_cast <const CORBA::TRANSIENT *> (&exc);
+ if (transient_exception != 0
+ && minor_code < sizeof TRANSIENT_TABLE / sizeof (char *))
+ return TRANSIENT_TABLE[minor_code];
+
+ CORBA::OBJ_ADAPTER const * obj_adapter_exception =
+ dynamic_cast <const CORBA::OBJ_ADAPTER *> (&exc);
+ if (obj_adapter_exception != 0
+ && minor_code < sizeof OBJ_ADAPTER_TABLE / sizeof (char *))
+ return OBJ_ADAPTER_TABLE[minor_code];
+
+ CORBA::DATA_CONVERSION const * data_conversion_exception =
+ dynamic_cast <const CORBA::DATA_CONVERSION *> (&exc);
+ if (data_conversion_exception != 0
+ && minor_code < sizeof DATA_CONVERSION_TABLE / sizeof (char *))
+ return DATA_CONVERSION_TABLE[minor_code];
+
+ CORBA::OBJECT_NOT_EXIST const * object_not_exist_exception =
+ dynamic_cast <const CORBA::OBJECT_NOT_EXIST *> (&exc);
+ if (object_not_exist_exception != 0
+ && minor_code < sizeof OBJECT_NOT_EXIST_TABLE / sizeof (char *))
+ return OBJECT_NOT_EXIST_TABLE[minor_code];
+
+ CORBA::INV_POLICY const * inv_policy_exception =
+ dynamic_cast <const CORBA::INV_POLICY *> (&exc);
+ if (inv_policy_exception != 0
+ && minor_code < sizeof INV_POLICY_TABLE / sizeof (char *))
+ return INV_POLICY_TABLE[minor_code];
+
+ CORBA::ACTIVITY_COMPLETED const * activity_completed_exception =
+ dynamic_cast <const CORBA::ACTIVITY_COMPLETED *> (&exc);
+ if (activity_completed_exception != 0
+ && minor_code < sizeof ACTIVITY_COMPLETED_TABLE / sizeof (char *))
+ return ACTIVITY_COMPLETED_TABLE[minor_code];
+
+ CORBA::ACTIVITY_REQUIRED const * activity_required_exception =
+ dynamic_cast <const CORBA::ACTIVITY_REQUIRED *> (&exc);
+ if (activity_required_exception != 0
+ && minor_code < sizeof ACTIVITY_REQUIRED_TABLE / sizeof (char *))
+ return ACTIVITY_REQUIRED_TABLE[minor_code];
+
+ CORBA::BAD_OPERATION const * bad_operation_exception =
+ dynamic_cast <const CORBA::BAD_OPERATION *> (&exc);
+ if (bad_operation_exception != 0
+ && minor_code < sizeof BAD_OPERATION_TABLE / sizeof (char *))
+ return BAD_OPERATION_TABLE[minor_code];
+
+ CORBA::BAD_CONTEXT const * bad_context_exception =
+ dynamic_cast <const CORBA::BAD_CONTEXT *> (&exc);
+ if (bad_context_exception != 0
+ && minor_code < sizeof BAD_CONTEXT_TABLE / sizeof (char *))
+ return BAD_CONTEXT_TABLE[minor_code];
+
+ CORBA::CODESET_INCOMPATIBLE const * codeset_incompatible_exception =
+ dynamic_cast <const CORBA::CODESET_INCOMPATIBLE *> (&exc);
+ if (codeset_incompatible_exception != 0
+ && minor_code < sizeof CODESET_INCOMPATIBLE_TABLE / sizeof (char *))
+ return CODESET_INCOMPATIBLE_TABLE[minor_code];
+
+ CORBA::INTF_REPOS const * intf_repos_exception =
+ dynamic_cast <const CORBA::INTF_REPOS *> (&exc);
+ if (intf_repos_exception != 0
+ && minor_code < sizeof INTF_REPOS_TABLE / sizeof (char *))
+ return INTF_REPOS_TABLE[minor_code];
+
+#else
+ ACE_UNUSED_ARG (exc);
+ ACE_UNUSED_ARG (minor_code);
+#endif /* !ACE_NDEBUG */
+
+ return "*unknown description*";
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (THREAD_CANCELLED)
+#undef THREAD_CANCELLED
+#endif /* THREAD_CANCELLED */
+
+// List of standard/system exceptions ... used to create static
+// storage for their typecodes, then later to initialize that storage
+// using the routine above. (It's just too painful to init these
+// typecodes statically in all cases!)
+
+#define STANDARD_EXCEPTION_LIST \
+ TAO_SYSTEM_EXCEPTION (UNKNOWN) \
+ TAO_SYSTEM_EXCEPTION (BAD_PARAM) \
+ TAO_SYSTEM_EXCEPTION (NO_MEMORY) \
+ TAO_SYSTEM_EXCEPTION (IMP_LIMIT) \
+ TAO_SYSTEM_EXCEPTION (COMM_FAILURE) \
+ TAO_SYSTEM_EXCEPTION (INV_OBJREF) \
+ TAO_SYSTEM_EXCEPTION (OBJECT_NOT_EXIST) \
+ TAO_SYSTEM_EXCEPTION (NO_PERMISSION) \
+ TAO_SYSTEM_EXCEPTION (INTERNAL) \
+ TAO_SYSTEM_EXCEPTION (MARSHAL) \
+ TAO_SYSTEM_EXCEPTION (INITIALIZE) \
+ TAO_SYSTEM_EXCEPTION (NO_IMPLEMENT) \
+ TAO_SYSTEM_EXCEPTION (BAD_TYPECODE) \
+ TAO_SYSTEM_EXCEPTION (BAD_OPERATION) \
+ TAO_SYSTEM_EXCEPTION (NO_RESOURCES) \
+ TAO_SYSTEM_EXCEPTION (NO_RESPONSE) \
+ TAO_SYSTEM_EXCEPTION (PERSIST_STORE) \
+ TAO_SYSTEM_EXCEPTION (BAD_INV_ORDER) \
+ TAO_SYSTEM_EXCEPTION (TRANSIENT) \
+ TAO_SYSTEM_EXCEPTION (FREE_MEM) \
+ TAO_SYSTEM_EXCEPTION (INV_IDENT) \
+ TAO_SYSTEM_EXCEPTION (INV_FLAG) \
+ TAO_SYSTEM_EXCEPTION (INTF_REPOS) \
+ TAO_SYSTEM_EXCEPTION (BAD_CONTEXT) \
+ TAO_SYSTEM_EXCEPTION (OBJ_ADAPTER) \
+ TAO_SYSTEM_EXCEPTION (DATA_CONVERSION) \
+ TAO_SYSTEM_EXCEPTION (INV_POLICY) \
+ TAO_SYSTEM_EXCEPTION (REBIND) \
+ TAO_SYSTEM_EXCEPTION (TIMEOUT) \
+ TAO_SYSTEM_EXCEPTION (TRANSACTION_UNAVAILABLE) \
+ TAO_SYSTEM_EXCEPTION (TRANSACTION_MODE) \
+ TAO_SYSTEM_EXCEPTION (TRANSACTION_REQUIRED) \
+ TAO_SYSTEM_EXCEPTION (TRANSACTION_ROLLEDBACK) \
+ TAO_SYSTEM_EXCEPTION (INVALID_TRANSACTION) \
+ TAO_SYSTEM_EXCEPTION (CODESET_INCOMPATIBLE) \
+ TAO_SYSTEM_EXCEPTION (BAD_QOS) \
+ TAO_SYSTEM_EXCEPTION (INVALID_ACTIVITY) \
+ TAO_SYSTEM_EXCEPTION (ACTIVITY_COMPLETED) \
+ TAO_SYSTEM_EXCEPTION (ACTIVITY_REQUIRED) \
+ TAO_SYSTEM_EXCEPTION (THREAD_CANCELLED)
+
+static const char *repo_id_array[] = {
+#define TAO_SYSTEM_EXCEPTION(name) \
+ (char *) "IDL:omg.org/CORBA/" #name ":1.0",
+ STANDARD_EXCEPTION_LIST
+#undef TAO_SYSTEM_EXCEPTION
+ 0
+ };
+
+// Since we add an extra element subtract 1
+static const CORBA::ULong array_sz =
+ (sizeof (repo_id_array) / sizeof (char const *)) - 1;
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO::excp_factory excp_array [] = {
+#define TAO_SYSTEM_EXCEPTION(name) \
+ &CORBA::name::_tao_create,
+ STANDARD_EXCEPTION_LIST
+#undef TAO_SYSTEM_EXCEPTION
+ 0
+};
+
+// Concrete SystemException constructors
+#define TAO_SYSTEM_EXCEPTION(name) \
+CORBA::name ::name (void) \
+ : CORBA::SystemException ("IDL:omg.org/CORBA/" #name ":1.0", \
+ #name, \
+ 0, \
+ CORBA::COMPLETED_NO) \
+{ \
+} \
+\
+CORBA::name ::name (CORBA::ULong code, CORBA::CompletionStatus completed) \
+ : CORBA::SystemException ("IDL:omg.org/CORBA/" #name ":1.0", \
+ #name, \
+ code, \
+ completed) \
+{ \
+}
+
+STANDARD_EXCEPTION_LIST
+#undef TAO_SYSTEM_EXCEPTION
+
+#define TAO_SYSTEM_EXCEPTION(name) \
+CORBA::TypeCode_ptr \
+CORBA::name ::_tao_type (void) const \
+{ \
+ TAO_AnyTypeCode_Adapter *adapter = \
+ ACE_Dynamic_Service<TAO_AnyTypeCode_Adapter>::instance ( \
+ "AnyTypeCode_Adapter" \
+ ); \
+ if (adapter != 0) \
+ return adapter->_tao_type_ ## name (); \
+ else \
+ { \
+ ACE_ERROR ((LM_ERROR, \
+ ACE_TEXT ("(%P|%t) %p\n"), \
+ ACE_TEXT ("Unable to find the ") \
+ ACE_TEXT ("AnyTypeCode Adapter instance"))); \
+ return 0; \
+ } \
+}
+
+STANDARD_EXCEPTION_LIST
+#undef TAO_SYSTEM_EXCEPTION
+
+CORBA::SystemException *
+TAO::create_system_exception (const char *id)
+{
+ for (CORBA::ULong i = 0; i < array_sz; ++i)
+ {
+ if (ACE_OS::strcmp (id, repo_id_array[i]) == 0)
+ return (*(excp_array[i])) ();
+ }
+
+ return 0;
+}
+
+#define TAO_SYSTEM_EXCEPTION(name) \
+void \
+CORBA::name ::_raise (void) const \
+{ \
+ TAO_RAISE (*this); \
+}
+
+STANDARD_EXCEPTION_LIST
+#undef TAO_SYSTEM_EXCEPTION
+
+#define TAO_SYSTEM_EXCEPTION(name) \
+CORBA::Exception * \
+CORBA::name ::_tao_duplicate (void) const \
+{ \
+ CORBA::Exception * result = 0; \
+ ACE_NEW_RETURN (result, CORBA::name (*this), 0); \
+ return result; \
+}
+
+STANDARD_EXCEPTION_LIST
+#undef TAO_SYSTEM_EXCEPTION
+
+#define TAO_SYSTEM_EXCEPTION(name) \
+CORBA::SystemException * \
+CORBA::name ::_tao_create (void) \
+{ \
+ CORBA::name *result = 0; \
+ ACE_NEW_RETURN (result, CORBA::name (), 0); \
+ return result; \
+}
+
+STANDARD_EXCEPTION_LIST
+#undef TAO_SYSTEM_EXCEPTION
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/SystemException.h b/TAO/tao/SystemException.h
new file mode 100644
index 00000000000..2a343346d3a
--- /dev/null
+++ b/TAO/tao/SystemException.h
@@ -0,0 +1,249 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file SystemException.h
+ *
+ * $Id$
+ *
+ * CORBA::SystemException class header.
+ *
+ * @author DOC Group at Vanderbilt U, Wash U, and UCI
+ * @author Ossama Othman <ossama@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_SYSTEM_EXCEPTION_H
+#define TAO_SYSTEM_EXCEPTION_H
+
+#include /**/ "ace/pre.h"
+
+// Do not try removing this. If you remove this for subsetting lots of
+// things go wrong in TAO.
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Exception.h"
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_OutputCDR;
+class TAO_InputCDR;
+
+#if defined (THREAD_CANCELLED)
+#undef THREAD_CANCELLED
+#endif /* THREAD_CANCELLED */
+
+// This is already done in orbconf.h. But this file is totally
+// decoupled from its contents that we have to do this here. Including
+// orbconf.h is probably going to be a overhead.
+#if defined (minor)
+#undef minor
+#endif /* minor */
+
+namespace CORBA
+{
+ class SystemException;
+}
+
+namespace TAO
+{
+ typedef CORBA::SystemException* (*excp_factory)(void);
+}
+
+namespace CORBA
+{
+ class Environment;
+
+ /**
+ * @enum CompletionStatus
+ *
+ * @brief Completion status for CORBA system exceptions
+ *
+ * Enumerations that denote how an operation was (not) completed
+ * when a @c CORBA::SystemException is thrown.
+ */
+ enum CompletionStatus
+ {
+ COMPLETED_YES, ///< Successful or exceptional completion.
+ COMPLETED_NO, ///< Didn't change any state; retry is OK.
+ COMPLETED_MAYBE ///< Can't say what happened; retry unsafe.
+ };
+
+ /**
+ * @class SystemException
+ *
+ * @brief SystemException
+ *
+ * System exceptions are those defined in the CORBA specification;
+ * OMG-IDL defines these.
+ */
+ class TAO_Export SystemException : public Exception
+ {
+ public:
+
+ /// Copy constructor.
+ SystemException (const SystemException & src);
+
+ /// Destructor.
+ virtual ~SystemException (void);
+
+ /// Get the minor status.
+ ULong minor (void) const;
+
+ /// Set the minor status.
+ void minor (ULong m);
+
+ /// Get the completion status.
+ CORBA::CompletionStatus completed (void) const;
+
+ /// Set the operation completion status.
+ void completed (CORBA::CompletionStatus c);
+
+ /// Narrow to a SystemException.
+ static SystemException *_downcast (CORBA::Exception *exception);
+
+ /// The const version of narrow operation to a SystemException
+ static const SystemException *_downcast(const CORBA::Exception *exception);
+
+ virtual void _raise (void) const = 0;
+
+ // = TAO-specific extension.
+
+ /// Print the system exception @c ex to output determined by @c f.
+ /// This function is not CORBA compliant.
+ void _tao_print_system_exception (FILE *f = stdout) const;
+
+ /// Returns a string containing information about the exception. This
+ /// function is not CORBA compliant.
+ virtual ACE_CString _info (void) const;
+
+ virtual void _tao_encode (TAO_OutputCDR &cdr
+ ACE_ENV_ARG_DECL) const;
+
+ virtual void _tao_decode (TAO_InputCDR &cdr
+ ACE_ENV_ARG_DECL);
+
+ /// Helper to create a minor status value.
+ static CORBA::ULong _tao_minor_code (u_int location,
+ int errno_value);
+
+ /// Helper to translate a platform-specific errno to a TAO errno
+ /// value.
+ static CORBA::ULong _tao_errno (int errno_value);
+
+ /// Deep copy
+ virtual CORBA::Exception *_tao_duplicate (void) const;
+
+ protected:
+
+ /// Default constructor.
+ SystemException (void);
+
+ /// Assignment operator.
+ SystemException & operator= (const SystemException &src);
+
+ /// Constructor using a repository id.
+ SystemException (CORBA::ULong code,
+ CORBA::CompletionStatus completed);
+
+ /// Constructor using a repository id.
+ SystemException (const char *repository_id,
+ const char *local_name,
+ CORBA::ULong code,
+ CORBA::CompletionStatus completed);
+
+ /// Return the exception description associated with the given OMG
+ /// minor code.
+ static const char *_tao_get_omg_exception_description (
+ const CORBA::SystemException &exc,
+ CORBA::ULong minor_code);
+
+ private:
+ /// Minor code.
+ CORBA::ULong minor_;
+
+ /// Completion status.
+ CORBA::CompletionStatus completed_;
+
+ };
+
+ // Declarations for all of the CORBA standard exceptions.
+ //
+ // @@ - shouldn't have a default minor code, at least for code that's
+ // inside the ORB. All minor codes should be symbolically catalogued.
+
+#define TAO_SYSTEM_EXCEPTION(name) \
+ class TAO_Export name : public SystemException \
+ { \
+ public: \
+ name (void); \
+ name (CORBA::ULong code, \
+ CORBA::CompletionStatus completed); \
+ static name * _downcast (CORBA::Exception* exception); \
+ static name const * _downcast (CORBA::Exception const * exception); \
+ virtual void _raise (void) const; \
+ virtual CORBA::TypeCode_ptr _tao_type (void) const; \
+ static void _tao_any_destructor (void*); \
+ virtual CORBA::Exception *_tao_duplicate (void) const; \
+ static CORBA::SystemException *_tao_create (void); \
+ }; \
+
+ TAO_SYSTEM_EXCEPTION(UNKNOWN) // the unknown exception
+ TAO_SYSTEM_EXCEPTION(BAD_PARAM) // an invalid parameter was passed
+ TAO_SYSTEM_EXCEPTION(NO_MEMORY) // memory allocation failure
+ TAO_SYSTEM_EXCEPTION(IMP_LIMIT) // violated implementation limit
+ TAO_SYSTEM_EXCEPTION(COMM_FAILURE) // communication failure
+ TAO_SYSTEM_EXCEPTION(INV_OBJREF) // invalid object reference
+ TAO_SYSTEM_EXCEPTION(OBJECT_NOT_EXIST) // no such object
+ TAO_SYSTEM_EXCEPTION(NO_PERMISSION) // no permission for operation
+ TAO_SYSTEM_EXCEPTION(INTERNAL) // ORB internal error
+ TAO_SYSTEM_EXCEPTION(MARSHAL) // error marshaling param/result
+ TAO_SYSTEM_EXCEPTION(INITIALIZE) // ORB initialization failure
+ TAO_SYSTEM_EXCEPTION(NO_IMPLEMENT) // implementation unavailable
+ TAO_SYSTEM_EXCEPTION(BAD_TYPECODE) // bad typecode
+ TAO_SYSTEM_EXCEPTION(BAD_OPERATION) // invalid operation
+ TAO_SYSTEM_EXCEPTION(NO_RESOURCES) // out of resources for request
+ TAO_SYSTEM_EXCEPTION(NO_RESPONSE) // response not yet available
+ TAO_SYSTEM_EXCEPTION(PERSIST_STORE) // persistent storage failure
+ TAO_SYSTEM_EXCEPTION(BAD_INV_ORDER) // routine invocations out of order
+ TAO_SYSTEM_EXCEPTION(TRANSIENT) // transient error, try again later
+ TAO_SYSTEM_EXCEPTION(FREE_MEM) // cannot free memory
+ TAO_SYSTEM_EXCEPTION(INV_IDENT) // invalid identifier syntax
+ TAO_SYSTEM_EXCEPTION(INV_FLAG) // invalid flag was specified
+ TAO_SYSTEM_EXCEPTION(INTF_REPOS) // interface repository unavailable
+ TAO_SYSTEM_EXCEPTION(BAD_CONTEXT) // error processing context object
+ TAO_SYSTEM_EXCEPTION(OBJ_ADAPTER) // object adapter failure
+ TAO_SYSTEM_EXCEPTION(DATA_CONVERSION) // data conversion error
+ TAO_SYSTEM_EXCEPTION(INV_POLICY) // invalid policies present
+ TAO_SYSTEM_EXCEPTION(REBIND) // rebind needed
+ TAO_SYSTEM_EXCEPTION(TIMEOUT) // operation timed out
+ TAO_SYSTEM_EXCEPTION(TRANSACTION_UNAVAILABLE) // no transaction
+ TAO_SYSTEM_EXCEPTION(TRANSACTION_MODE) // invalid transaction mode
+ TAO_SYSTEM_EXCEPTION(TRANSACTION_REQUIRED) // operation needs transaction
+ TAO_SYSTEM_EXCEPTION(TRANSACTION_ROLLEDBACK) // operation was a no-op
+ TAO_SYSTEM_EXCEPTION(INVALID_TRANSACTION) // invalid TP context passed
+ TAO_SYSTEM_EXCEPTION(CODESET_INCOMPATIBLE) // incompatible code set
+ TAO_SYSTEM_EXCEPTION(BAD_QOS) // bad quality of service
+ TAO_SYSTEM_EXCEPTION(INVALID_ACTIVITY)
+ TAO_SYSTEM_EXCEPTION(ACTIVITY_COMPLETED)
+ TAO_SYSTEM_EXCEPTION(ACTIVITY_REQUIRED)
+ TAO_SYSTEM_EXCEPTION(THREAD_CANCELLED)
+
+#undef TAO_SYSTEM_EXCEPTION
+
+} // End CORBA namespace
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/SystemException.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/"ace/post.h"
+
+#endif /* TAO_SYSTEM_EXCEPTION_H */
diff --git a/TAO/tao/SystemException.inl b/TAO/tao/SystemException.inl
new file mode 100644
index 00000000000..25409d98218
--- /dev/null
+++ b/TAO/tao/SystemException.inl
@@ -0,0 +1,116 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE CORBA::ULong
+CORBA::SystemException::minor (void) const
+{
+ return this->minor_;
+}
+
+ACE_INLINE void
+CORBA::SystemException::minor (CORBA::ULong m)
+{
+ this->minor_ = m;
+}
+
+ACE_INLINE CORBA::CompletionStatus
+CORBA::SystemException::completed (void) const
+{
+ return this->completed_;
+}
+
+ACE_INLINE void
+CORBA::SystemException::completed (CORBA::CompletionStatus c)
+{
+ this->completed_ = c;
+}
+
+ACE_INLINE CORBA::SystemException*
+CORBA::SystemException::_downcast (CORBA::Exception* exception)
+{
+ return dynamic_cast<CORBA::SystemException *> (exception);
+}
+
+ACE_INLINE const CORBA::SystemException*
+CORBA::SystemException::_downcast (const CORBA::Exception *exception)
+{
+ return dynamic_cast<const CORBA::SystemException *> (exception);
+}
+
+
+#define TAO_STANDARD_SYSTEM_EXCEPTION_LIST \
+ TAO_SYSTEM_EXCEPTION (UNKNOWN) \
+ TAO_SYSTEM_EXCEPTION (BAD_PARAM) \
+ TAO_SYSTEM_EXCEPTION (NO_MEMORY) \
+ TAO_SYSTEM_EXCEPTION (IMP_LIMIT) \
+ TAO_SYSTEM_EXCEPTION (COMM_FAILURE) \
+ TAO_SYSTEM_EXCEPTION (INV_OBJREF) \
+ TAO_SYSTEM_EXCEPTION (OBJECT_NOT_EXIST) \
+ TAO_SYSTEM_EXCEPTION (NO_PERMISSION) \
+ TAO_SYSTEM_EXCEPTION (INTERNAL) \
+ TAO_SYSTEM_EXCEPTION (MARSHAL) \
+ TAO_SYSTEM_EXCEPTION (INITIALIZE) \
+ TAO_SYSTEM_EXCEPTION (NO_IMPLEMENT) \
+ TAO_SYSTEM_EXCEPTION (BAD_TYPECODE) \
+ TAO_SYSTEM_EXCEPTION (BAD_OPERATION) \
+ TAO_SYSTEM_EXCEPTION (NO_RESOURCES) \
+ TAO_SYSTEM_EXCEPTION (NO_RESPONSE) \
+ TAO_SYSTEM_EXCEPTION (PERSIST_STORE) \
+ TAO_SYSTEM_EXCEPTION (BAD_INV_ORDER) \
+ TAO_SYSTEM_EXCEPTION (TRANSIENT) \
+ TAO_SYSTEM_EXCEPTION (FREE_MEM) \
+ TAO_SYSTEM_EXCEPTION (INV_IDENT) \
+ TAO_SYSTEM_EXCEPTION (INV_FLAG) \
+ TAO_SYSTEM_EXCEPTION (INTF_REPOS) \
+ TAO_SYSTEM_EXCEPTION (BAD_CONTEXT) \
+ TAO_SYSTEM_EXCEPTION (OBJ_ADAPTER) \
+ TAO_SYSTEM_EXCEPTION (DATA_CONVERSION) \
+ TAO_SYSTEM_EXCEPTION (INV_POLICY) \
+ TAO_SYSTEM_EXCEPTION (REBIND) \
+ TAO_SYSTEM_EXCEPTION (TIMEOUT) \
+ TAO_SYSTEM_EXCEPTION (TRANSACTION_UNAVAILABLE) \
+ TAO_SYSTEM_EXCEPTION (TRANSACTION_MODE) \
+ TAO_SYSTEM_EXCEPTION (TRANSACTION_REQUIRED) \
+ TAO_SYSTEM_EXCEPTION (TRANSACTION_ROLLEDBACK) \
+ TAO_SYSTEM_EXCEPTION (INVALID_TRANSACTION) \
+ TAO_SYSTEM_EXCEPTION (CODESET_INCOMPATIBLE) \
+ TAO_SYSTEM_EXCEPTION (BAD_QOS) \
+ TAO_SYSTEM_EXCEPTION (INVALID_ACTIVITY) \
+ TAO_SYSTEM_EXCEPTION (ACTIVITY_COMPLETED) \
+ TAO_SYSTEM_EXCEPTION (ACTIVITY_REQUIRED) \
+ TAO_SYSTEM_EXCEPTION (THREAD_CANCELLED)
+
+#define TAO_SYSTEM_EXCEPTION(name) \
+ACE_INLINE CORBA::name * \
+CORBA::name ::_downcast (CORBA::Exception* exception) \
+{ \
+ return dynamic_cast<CORBA::name *> (exception); \
+}
+
+TAO_STANDARD_SYSTEM_EXCEPTION_LIST
+#undef TAO_SYSTEM_EXCEPTION
+
+#define TAO_SYSTEM_EXCEPTION(name) \
+ACE_INLINE CORBA::name const * \
+CORBA::name ::_downcast (CORBA::Exception const * exception) \
+{ \
+ return dynamic_cast<CORBA::name const *> (exception); \
+}
+
+TAO_STANDARD_SYSTEM_EXCEPTION_LIST
+#undef TAO_SYSTEM_EXCEPTION
+
+#define TAO_SYSTEM_EXCEPTION(name) \
+ACE_INLINE void \
+CORBA::name ::_tao_any_destructor (void * x) \
+{ \
+ delete static_cast<CORBA::name *> (x); \
+}
+
+TAO_STANDARD_SYSTEM_EXCEPTION_LIST
+#undef TAO_SYSTEM_EXCEPTION
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/TAO.pc.in b/TAO/tao/TAO.pc.in
new file mode 100644
index 00000000000..ce8d342789c
--- /dev/null
+++ b/TAO/tao/TAO.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: TAO
+Description: The ACE ORB
+Requires: ACE
+Version: @VERSION@
+Libs: -L${libdir} -lTAO
+Cflags: -I${includedir}
diff --git a/TAO/tao/TAO.pidl b/TAO/tao/TAO.pidl
new file mode 100644
index 00000000000..db7dd9b348a
--- /dev/null
+++ b/TAO/tao/TAO.pidl
@@ -0,0 +1,74 @@
+// -*- IDL -*-
+
+// ================================================================
+/**
+ * @file TAO.pidl
+ *
+ * $Id$
+ *
+ * This file contains TAO-specific idl interfaces (not part of CORBA
+ * 2.6).
+ *
+ * The steps to regenerate the code are as follows:
+ *
+ * 1. Run the tao_idl compiler on the pidl file. The command used for
+ * this is:
+ *
+ * tao_idl
+ * -o orig -Gp -Gd -Ge 1 -GA -SS -Sci
+ * -Wb,export_macro=TAO_Export
+ * -Wb,pre_include="ace/pre.h"
+ * -Wb,post_include="ace/post.h"
+ * TAO.pidl
+ *
+ * 2. The files are ready to use
+ */
+// ================================================================
+
+#ifndef TAO_TAO_IDL
+#define TAO_TAO_IDL
+
+#include "tao/Policy.pidl"
+#include "tao/TimeBase.pidl"
+#include "tao/Messaging_SyncScope.pidl"
+
+#pragma prefix "tao"
+
+module TAO
+{
+
+ //
+ // Buffering constraint.
+ //
+ typedef unsigned short BufferingConstraintMode;
+ const BufferingConstraintMode BUFFER_FLUSH = 0x00;
+
+ // Note that timeout, message_count, and message_bytes can be or'd.
+ const BufferingConstraintMode BUFFER_TIMEOUT = 0x01;
+ const BufferingConstraintMode BUFFER_MESSAGE_COUNT = 0x02;
+ const BufferingConstraintMode BUFFER_MESSAGE_BYTES = 0x04;
+
+ struct BufferingConstraint
+ {
+ BufferingConstraintMode mode;
+ TimeBase::TimeT timeout;
+ unsigned long message_count;
+ unsigned long message_bytes;
+ };
+
+ const CORBA::PolicyType BUFFERING_CONSTRAINT_POLICY_TYPE = 0x54410001;
+
+ local interface BufferingConstraintPolicy : CORBA::Policy
+ {
+ readonly attribute BufferingConstraint buffering_constraint;
+ };
+
+ // = TAO specific.
+ const Messaging::SyncScope SYNC_EAGER_BUFFERING = Messaging::SYNC_NONE;
+ const Messaging::SyncScope SYNC_DELAYED_BUFFERING = -2;
+
+};
+
+#pragma prefix ""
+
+#endif /* TAO_TAO_IDL */
diff --git a/TAO/tao/TAO_Export.h b/TAO/tao/TAO_Export.h
new file mode 100644
index 00000000000..fc49ecbc163
--- /dev/null
+++ b/TAO/tao/TAO_Export.h
@@ -0,0 +1,40 @@
+
+// -*- C++ -*-
+// $Id$
+// Definition for Win32 Export directives.
+// This file is generated automatically by generate_export_file.pl
+// ------------------------------
+#ifndef TAO_EXPORT_H
+#define TAO_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if defined (TAO_AS_STATIC_LIBS)
+# if !defined (TAO_HAS_DLL)
+# define TAO_HAS_DLL 0
+# endif /* ! TAO_HAS_DLL */
+#else
+# if !defined (TAO_HAS_DLL)
+# define TAO_HAS_DLL 1
+# endif /* ! TAO_HAS_DLL */
+#endif
+
+#if defined (TAO_HAS_DLL) && (TAO_HAS_DLL == 1)
+# if defined (TAO_BUILD_DLL)
+# define TAO_Export ACE_Proper_Export_Flag
+# define TAO_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# define TAO_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# else /* TAO_BUILD_DLL */
+# define TAO_Export ACE_Proper_Import_Flag
+# define TAO_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# define TAO_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# endif /* TAO_BUILD_DLL */
+#else /* TAO_HAS_DLL == 1 */
+# define TAO_Export
+# define TAO_SINGLETON_DECLARATION(T)
+# define TAO_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+#endif /* TAO_HAS_DLL == 1 */
+
+#endif /* TAO_EXPORT_H */
+
+// End of auto generated file.
diff --git a/TAO/tao/TAO_Internal.cpp b/TAO/tao/TAO_Internal.cpp
new file mode 100644
index 00000000000..df39ae66321
--- /dev/null
+++ b/TAO/tao/TAO_Internal.cpp
@@ -0,0 +1,898 @@
+// $Id$
+
+#include "tao/TAO_Internal.h"
+#include "tao/TAO_Singleton.h"
+#include "tao/default_server.h"
+#include "tao/default_client.h"
+#include "tao/default_resource.h"
+#include "tao/IIOP_Factory.h"
+#include "tao/MCAST_Parser.h"
+#include "tao/CORBANAME_Parser.h"
+#include "tao/CORBALOC_Parser.h"
+#include "tao/FILE_Parser.h"
+#include "tao/DLL_Parser.h"
+#include "tao/ORB_Core.h"
+#include "tao/Adapter_Factory.h"
+#include "tao/Default_Stub_Factory.h"
+#include "tao/Default_Endpoint_Selector_Factory.h"
+#include "tao/Default_Protocols_Hooks.h"
+#include "tao/Default_Thread_Lane_Resources_Manager.h"
+#include "tao/Default_Collocation_Resolver.h"
+#include "tao/Codeset_Manager_Factory_Base.h"
+#include "tao/Codeset_Manager.h"
+#include "tao/debug.h"
+#include "tao/StringSeqC.h"
+
+#include "ace/Dynamic_Service.h"
+#include "ace/Arg_Shifter.h"
+#include "ace/Argv_Type_Converter.h"
+#include "ace/Env_Value_T.h"
+#include "ace/ACE.h"
+#include "ace/OS_NS_stdio.h"
+#include "ace/Static_Object_Lock.h"
+
+ACE_RCSID (tao,
+ TAO_Internal,
+ "$Id$")
+
+#ifndef TAO_DEFAULT_RESOURCE_FACTORY_ARGS
+# define TAO_DEFAULT_RESOURCE_FACTORY_ARGS 0
+#endif /* !TAO_DEFAULT_RESOURCE_FACTORY_ARGS */
+
+#ifndef TAO_DEFAULT_SERVER_STRATEGY_FACTORY_ARGS
+# define TAO_DEFAULT_SERVER_STRATEGY_FACTORY_ARGS 0
+#endif /* !TAO_DEFAULT_SERVER_STRATEGY_FACTORY_ARGS */
+
+#ifndef TAO_DEFAULT_CLIENT_STRATEGY_FACTORY_ARGS
+# define TAO_DEFAULT_CLIENT_STRATEGY_FACTORY_ARGS 0
+#endif /* !TAO_DEFAULT_RESOURCE_FACTORY_ARGS */
+
+
+namespace
+{
+ /**
+ * Parses the supplied command-line arguments to extract any that
+ * apply to the process (globally)
+ *
+ * @brief Modifies the argc to reflect any arguments it has
+ * "consumed"
+ *
+ * When multiple ORBs are being configured, the global options are
+ * only processed for the first ORB loaded. However subsequent ORBs
+ * may be supplied with some of these options, so they need to be
+ * eliminated as though they were processed. For this reason,
+ * this function is called for every ORB, but only the first call
+ * sets apply_values to true
+ *
+ */
+ int
+ parse_global_args_i (int &argc,
+ char **argv,
+ CORBA::StringSeq &svc_config_argv,
+ bool apply_values);
+
+ /**
+ * Parses the supplied command-line arguments to extract any that
+ * specify a Service Configurator file (-ORBSvcConf). This is done
+ * separately, because depending on the context, the configuration
+ * file may apply to the process-wide service repository, or to the
+ * orb-specific (private) one.
+ *
+ * @brief Modifies the argc to reflect any arguments it has
+ * "consumed"
+ */
+ int
+ parse_svcconf_args_i (int &argc,
+ char **argv,
+ CORBA::StringSeq &svc_config_argv);
+
+ /**
+ * Initialize the ACE Service Configurator with the process-global
+ * services (available to any ORB).
+ *
+ * @return @c 0 if successful, @c -1 with @c errno set if failure.
+ *
+ * @note You can provide your program a set of default `svc.conf'
+ * entries by setting @a ignore_default_svc_conf_file to
+ * non-zero and use @c default_svc_conf_entries() before
+ * calling @c open_global_services(). In addition, you can @a
+ * skip_service_config_open altogether, which used to be
+ * important when the ORB is linked in via the
+ * ACE_Service_Config, since the ACE_Service_Config was
+ * non-reentrant. However, the ACE_Service_Config is now
+ * reentrant meaning that it is really no longer necessary to
+ * do so.
+ */
+ void register_global_services_i (ACE_Service_Gestalt * pcfg);
+ void register_additional_services_i (ACE_Service_Gestalt * pcfg);
+
+ /**
+ * Parses the supplied command-line arguments to extract any
+ * instance-specific ones.
+ *
+ * @brief Modifies the argc to reflect any arguments it has
+ * "consumed"
+ */
+ int
+ parse_private_args_i (int &argc,
+ char **argv,
+ CORBA::StringSeq & svc_config_argv,
+ bool & skip_service_config_open);
+
+ /**
+ * Initialize ORB-local (private) ACE Service Configurator
+ * repository.
+ *
+ * @return @c 0 if successful, @c -1 with @c errno set if failure.
+ *
+ */
+ int open_private_services_i (ACE_Service_Gestalt* pcfg,
+ int & argc,
+ char ** argv,
+ bool skip_service_config_open = false,
+ bool ignore_default_svc_conf_file = false);
+
+ /**
+ * Number of times open_services() has been called. Incremented by
+ * open_global_services_i(), and decremented by close_services().
+ *
+ * @note In/decrement operations are atomic.
+ */
+ long service_open_count = 0;
+
+ /**
+ * Part of a condition variable, which helps to ensure non-default
+ * ORBs can not proceed with their initialization, until the globaly
+ * required services have been instantiated by the default
+ * ORB. Usually, the first ORB to be created is designated the
+ * default ORB (reference the CORBA spec)
+ */
+ bool is_ubergestalt_ready = false;
+
+ char const * resource_factory_args =
+ TAO_DEFAULT_RESOURCE_FACTORY_ARGS;
+ char const * server_strategy_factory_args =
+ TAO_DEFAULT_SERVER_STRATEGY_FACTORY_ARGS;
+ char const * client_strategy_factory_args =
+ TAO_DEFAULT_CLIENT_STRATEGY_FACTORY_ARGS;
+
+#if (TAO_NEGOTIATE_CODESETS == 1)
+ bool negotiate_codesets = true;
+#else
+ bool negotiate_codesets = false;
+#endif /* TAO_NEGOTIATE_CODESETS */
+} // anonymous namespace
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/// A little helper class to get around the TAO_Singleton::instance ()
+/// inability to pass default initialization arguments to the
+/// singleton ctor.
+
+#if defined (ACE_HAS_THREADS)
+class TAO_Ubergestalt_Ready_Condition
+ : public ACE_SYNCH_RECURSIVE_CONDITION
+{
+public:
+ TAO_Ubergestalt_Ready_Condition (void)
+ : ACE_SYNCH_RECURSIVE_CONDITION
+ (*ACE_Static_Object_Lock::instance())
+ {
+ };
+
+ static TAO_Ubergestalt_Ready_Condition* instance (void)
+ {
+ // The first thread to get here will initialize the static
+ // local. Any subsequent threads synchronizaton will be handled by
+ // TAO_Singleton
+ static TAO_Ubergestalt_Ready_Condition *i_ =
+ TAO_Singleton <TAO_Ubergestalt_Ready_Condition,
+ TAO_SYNCH_RECURSIVE_MUTEX>::instance ();
+
+ return i_;
+ };
+};
+#endif // ACE_HAS_THREADS
+
+int
+TAO::ORB::open_services (ACE_Service_Gestalt* pcfg,
+ int &argc,
+ ACE_TCHAR **argv)
+{
+ {
+ ACE_MT (ACE_GUARD_RETURN (TAO_SYNCH_RECURSIVE_MUTEX,
+ guard,
+ TAO_Ubergestalt_Ready_Condition::instance ()->mutex (),
+ -1));
+
+ // Wait in line, while the default ORB (which isn't us) completes
+ // initialization of the globaly reuired service objects
+ if (service_open_count == 1)
+ {
+ if (TAO_debug_level > 4)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) Waiting for the default ")
+ ACE_TEXT ("ORB to complete the global ")
+ ACE_TEXT ("initialization\n")));
+
+ ACE_MT (while (!is_ubergestalt_ready)
+ TAO_Ubergestalt_Ready_Condition::instance ()->wait ());
+
+ if (TAO_debug_level > 4)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) The default ")
+ ACE_TEXT ("ORB must have completed the global ")
+ ACE_TEXT ("initialization...\n")));
+
+ }
+ else
+ {
+ if (TAO_debug_level > 4)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) We are %sthe default ")
+ ACE_TEXT ("ORB ...\n"),
+ (service_open_count == 0) ? "" : "not "));
+ }
+
+ service_open_count++;
+ }
+
+ // Construct an argument vector specific to the Service
+ // Configurator.
+ CORBA::StringSeq svc_config_argv;
+
+ // Be certain to copy the program name so that service configurator
+ // has something to skip!
+ ACE_CString argv0 ("");
+
+ if (argc > 0 && argv != 0)
+ {
+ argv0 = ACE_TEXT_ALWAYS_CHAR (argv[0]);
+ }
+
+ svc_config_argv.length (1);
+ svc_config_argv[0] = argv0.c_str ();
+
+ // Should we skip the ACE_Service_Config::open() method, e.g., if we
+ // already being configured by the ACE Service Configurator.
+ //
+ // @@ This is no longer needed since the Service Configurator is now
+ // reentrant.(-Ossama)
+ // @@ Leaving it in, since the -ORBSkipServiceConfigOpen is still
+ // available. (-Iliyan)
+ bool skip_service_config_open = false;
+
+ // Extract any ORB options from the argument vector.
+ if (parse_private_args_i (argc,
+ argv,
+ svc_config_argv,
+ skip_service_config_open) == -1)
+ {
+ return -1;
+ }
+
+ // Construct an argument vector specific to the process-wide
+ // (global) Service Configurator instance.
+ CORBA::StringSeq global_svc_config_argv;
+
+ ACE_Service_Gestalt * theone = ACE_Service_Config::global ();
+
+ if (service_open_count == 1)
+ {
+ ACE_Service_Config_Guard config_guard (theone);
+
+ if (TAO_debug_level > 2)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) Initializing the ")
+ ACE_TEXT ("process-wide services\n")));
+ }
+
+ register_global_services_i (theone);
+
+ // Be certain to copy the program name so that service configurator
+ // has something to skip!
+ ACE_CString argv0 ("");
+
+ if (argc > 0 && argv != 0)
+ {
+ argv0 = ACE_TEXT_ALWAYS_CHAR (argv[0]);
+ }
+
+ global_svc_config_argv.length (1);
+ global_svc_config_argv[0] = argv0.c_str ();
+
+ if (parse_global_args_i (argc, argv, global_svc_config_argv, true) == -1)
+ {
+ return -1;
+ }
+
+ if (parse_svcconf_args_i (argc, argv, global_svc_config_argv) == -1)
+ {
+ return -1;
+ }
+
+ int global_svc_config_argc = global_svc_config_argv.length ();
+ int status =
+ open_private_services_i (theone,
+ global_svc_config_argc,
+ global_svc_config_argv.get_buffer (),
+ skip_service_config_open);
+
+ if (status == -1 && TAO_debug_level > 0)
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_ERROR_RETURN ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) Failed to ")
+ ACE_TEXT ("open process-wide service ")
+ ACE_TEXT ("configuration\n")),
+ -1);
+ }
+
+ return -1;
+ }
+
+ register_additional_services_i (theone);
+
+
+ if (TAO_debug_level > 4)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) Default ORB - global ")
+ ACE_TEXT ("initialization completed.\n")));
+
+ // Notify all other threads that may be waiting, that the global
+ // gestalt has been initialized.
+ {
+ ACE_MT (ACE_GUARD_RETURN (TAO_SYNCH_RECURSIVE_MUTEX,
+ guard,
+ TAO_Ubergestalt_Ready_Condition::instance ()->mutex (),
+ -1));
+
+ is_ubergestalt_ready = true;
+ ACE_MT (if (TAO_Ubergestalt_Ready_Condition::instance ()->
+ broadcast () == -1)
+ return -1);
+ }
+
+ }
+ else
+ {
+ int status =
+ parse_global_args_i(argc, argv,global_svc_config_argv, false);
+ if (status == -1 && TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) Skipping the process-wide ")
+ ACE_TEXT ("service configuration, service_open_count ")
+ ACE_TEXT ("= %d, status = %d\n"),
+ service_open_count,
+ status));
+ }
+
+ if (TAO_debug_level > 2)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) Initializing the ")
+ ACE_TEXT ("orb-specific services\n")));
+ }
+
+ if (parse_svcconf_args_i (argc, argv, svc_config_argv) == -1)
+ {
+ return -1;
+ }
+
+ int svc_config_argc = svc_config_argv.length ();
+ int status =
+ open_private_services_i (pcfg,
+ svc_config_argc,
+ svc_config_argv.get_buffer (),
+ skip_service_config_open);
+
+ if (status >= 0)
+ {
+ return 0;
+ }
+
+ if (TAO_debug_level > 0)
+ {
+ ACE_ERROR_RETURN ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) Failed to ")
+ ACE_TEXT ("open orb service configuration\n")),
+ -1);
+ }
+
+ return -1;
+}
+
+int
+TAO::ORB::close_services (ACE_Service_Gestalt* pcfg)
+{
+ ACE_MT (ACE_GUARD_RETURN (TAO_SYNCH_RECURSIVE_MUTEX,
+ guard,
+ *ACE_Static_Object_Lock::instance (),
+ -1));
+ service_open_count--;
+
+ return pcfg->close ();
+}
+
+void
+TAO::ORB::default_svc_conf_entries (char const * rf_args,
+ char const * ssf_args,
+ char const * csf_args)
+{
+ resource_factory_args = rf_args;
+ server_strategy_factory_args = ssf_args;
+ client_strategy_factory_args = csf_args;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+// -----------------------------------------------------
+namespace
+{
+ /// Open services, belonging to the gestalt instance.
+
+ int
+ open_private_services_i (ACE_Service_Gestalt * pcfg,
+ int & argc,
+ ACE_TCHAR ** argv,
+ bool skip_service_config_open,
+ bool ignore_default_svc_conf_file)
+ {
+
+ if (skip_service_config_open)
+ {
+ return 0;
+ }
+
+#if defined (TAO_PLATFORM_SVC_CONF_FILE_NOTSUP)
+ ignore_default_svc_conf_file = true;
+#endif /* TAO_PLATFORM_SVC_CONF_FILE_NOTSUP */
+
+ return pcfg->open (argc,
+ argv,
+ ACE_DEFAULT_LOGGER_KEY,
+ 0, // Don't ignore static services.
+ ignore_default_svc_conf_file);
+ }
+
+ /// @brief registers all process-wide (global) services, available
+ /// to all ORBs
+ void
+ register_global_services_i (ACE_Service_Gestalt * pcfg)
+ {
+ // This has to be done before intializing the resource
+ // factory. Codesets is a special library since its configuration
+ // is optional and it may be linked statically.
+ if (negotiate_codesets)
+ {
+ TAO_Codeset_Manager_Factory_Base *factory =
+ ACE_Dynamic_Service<TAO_Codeset_Manager_Factory_Base>::instance (
+ "TAO_Codeset");
+
+ if (factory == 0 || factory->is_default ())
+ {
+#if !defined (TAO_AS_STATIC_LIBS)
+ // only for dynamic libs, check to see if default factory
+ // and if so, remove it
+ ACE_Service_Config::process_directive (
+ ACE_REMOVE_SERVICE_DIRECTIVE ("TAO_Codeset"));
+
+ ACE_Service_Config::process_directive (
+ ACE_DYNAMIC_SERVICE_DIRECTIVE (
+ "TAO_Codeset",
+ "TAO_Codeset",
+ "_make_TAO_Codeset_Manager_Factory",
+ ""));
+
+ factory =
+ ACE_Dynamic_Service<
+ TAO_Codeset_Manager_Factory_Base
+ >::instance ("TAO_Codeset");
+#endif
+ }
+
+ if (factory == 0)
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) ORB_Core: ")
+ ACE_TEXT ("Unable to initialize ")
+ ACE_TEXT ("Codeset Manager\n")));
+ }
+ }
+ }
+
+ pcfg->process_directive (
+ ace_svc_desc_TAO_Default_Resource_Factory);
+ pcfg->process_directive (
+ ace_svc_desc_TAO_Default_Client_Strategy_Factory);
+ pcfg->process_directive (
+ ace_svc_desc_TAO_Default_Server_Strategy_Factory);
+
+ // Configure the IIOP factory. You do *NOT* need modify this
+ // code to add your own protocol, instead simply add the
+ // following to your svc.conf file:
+ //
+ // dynamic PN_Factory Service_Object * LIB:_make_PN_Protocol_Factory() ""
+ // static Resource_Factory "-ORBProtocolFactory PN_Factory"
+ //
+ // where PN is the name of your protocol and LIB is the base
+ // name of the shared library that implements the protocol.
+
+#if defined (TAO_HAS_IIOP) && (TAO_HAS_IIOP != 0)
+ pcfg->process_directive (ace_svc_desc_TAO_IIOP_Protocol_Factory);
+#endif /* TAO_HAS_IIOP && TAO_HAS_IIOP != 0 */
+
+ // add descriptor to list of static objects.
+ pcfg->process_directive (ace_svc_desc_TAO_MCAST_Parser);
+ pcfg->process_directive (ace_svc_desc_TAO_CORBANAME_Parser);
+ pcfg->process_directive (ace_svc_desc_TAO_CORBALOC_Parser);
+ pcfg->process_directive (ace_svc_desc_TAO_FILE_Parser);
+ pcfg->process_directive (ace_svc_desc_TAO_DLL_Parser);
+ pcfg->process_directive (ace_svc_desc_TAO_Default_Stub_Factory);
+ pcfg->process_directive (
+ ace_svc_desc_TAO_Default_Endpoint_Selector_Factory);
+ pcfg->process_directive (ace_svc_desc_TAO_Default_Protocols_Hooks);
+ pcfg->process_directive (
+ ace_svc_desc_TAO_Default_Thread_Lane_Resources_Manager_Factory);
+ pcfg->process_directive (ace_svc_desc_TAO_Default_Collocation_Resolver);
+
+ } /* register_global_services_i */
+
+ void
+ register_additional_services_i (ACE_Service_Gestalt * pcfg)
+ {
+ // @@ What the heck do these things do and do we need to avoid
+ // calling them if we're not invoking the svc.conf file?
+ // @@ They are needed for platforms that have no file system,
+ // like VxWorks.
+
+ if (resource_factory_args != 0)
+ {
+ pcfg->process_directive(
+ ACE_TEXT_CHAR_TO_TCHAR (resource_factory_args));
+ }
+
+ if (client_strategy_factory_args != 0)
+ {
+ pcfg->process_directive
+ (ACE_TEXT_CHAR_TO_TCHAR (client_strategy_factory_args));
+ }
+
+ if (server_strategy_factory_args != 0)
+ {
+ pcfg->process_directive
+ (ACE_TEXT_CHAR_TO_TCHAR (server_strategy_factory_args));
+ }
+
+ // If available, allow the Adapter Factory to setup.
+ ACE_Service_Object *adapter_factory =
+ ACE_Dynamic_Service<ACE_Service_Object>::instance (
+ pcfg,
+ TAO_ORB_Core::poa_factory_name ().c_str ());
+
+ if (adapter_factory != 0)
+ {
+ adapter_factory->init (0, 0);
+ }
+
+ ACE_Service_Object * const pi_server_loader =
+ ACE_Dynamic_Service<ACE_Service_Object>::instance (
+ pcfg,
+ "PI_Server_Loader");
+
+ if (pi_server_loader != 0)
+ {
+ pi_server_loader->init (0, 0);
+ }
+
+ ACE_Service_Object * const bidir_loader =
+ ACE_Dynamic_Service<ACE_Service_Object>::instance (
+ pcfg,
+ "BiDirGIOP_Loader");
+
+ if (bidir_loader != 0)
+ {
+ bidir_loader->init (0, 0);
+ }
+
+ ACE_Service_Object * const messaging_loader =
+ ACE_Dynamic_Service<ACE_Service_Object>::instance (
+ pcfg,
+ "Messaging_Loader");
+
+ if (messaging_loader != 0)
+ {
+ messaging_loader->init (0, 0);
+ }
+
+ // Handle RTCORBA library special case. Since RTCORBA needs
+ // its init method call to register several hooks, call it
+ // here if it hasn't already been called.
+ ACE_Service_Object * const rt_loader =
+ ACE_Dynamic_Service<ACE_Service_Object>::instance (
+ pcfg,
+ "RT_ORB_Loader");
+
+ if (rt_loader != 0)
+ {
+ rt_loader->init (0, 0);
+ }
+
+ ACE_Service_Object * const rtscheduler_loader =
+ ACE_Dynamic_Service<ACE_Service_Object>::instance (
+ pcfg,
+ "RTScheduler_Loader");
+
+ if (rtscheduler_loader != 0)
+ {
+ rtscheduler_loader->init (0, 0);
+ }
+
+ } /* register_additional_services_i */
+
+ int
+ parse_svcconf_args_i (int &argc,
+ char **argv,
+ CORBA::StringSeq &svc_config_argv)
+ {
+ // Extract the Service Configurator ORB options from the argument
+ // vector.
+ ACE_Arg_Shifter arg_shifter (argc, argv);
+ CORBA::ULong len = 0;
+
+ while (arg_shifter.is_anything_left ())
+ {
+ const ACE_TCHAR *current_arg =
+ arg_shifter.get_the_parameter (ACE_TEXT ("-ORBSvcConf"));
+
+ if (0 != current_arg)
+ {
+ // Specify the name of the svc.conf file to be used.
+
+ // Proceeds only if the configuration file exists.
+ FILE * const conf_file =
+ ACE_OS::fopen (current_arg, ACE_TEXT ("r"));
+
+ if (0 == conf_file)
+ {
+ // Assigning EINVAL to errno to make an exception
+ // thrown. calling code does not throw an exception if
+ // the errno is set to ENOENT for some reason.
+ errno = EINVAL;
+
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) Service ")
+ ACE_TEXT ("Configurator ")
+ ACE_TEXT ("unable to open file %s\n"),
+ current_arg),
+ -1);
+ }
+ else
+ {
+ ACE_OS::fclose (conf_file);
+ }
+
+ len = svc_config_argv.length ();
+ svc_config_argv.length (len + 2); // 2 arguments to add
+
+ svc_config_argv[len] = CORBA::string_dup ("-f");
+ svc_config_argv[len + 1] =
+ CORBA::string_dup (ACE_TEXT_ALWAYS_CHAR (current_arg));
+
+ arg_shifter.consume_arg ();
+ }
+ // Can't interpret this argument. Move on to the next argument.
+ else
+ {
+ // Any arguments that don't match are ignored so that the
+ // caller can still use them.
+ arg_shifter.ignore_arg ();
+ }
+ }
+
+ return 0;
+ } /* parse_svcconf_args_i */
+
+ int
+ parse_private_args_i (int &argc,
+ char **argv,
+ CORBA::StringSeq &svc_config_argv,
+ bool & skip_service_config_open)
+ {
+ // Extract the Service Configurator ORB options from the argument
+ // vector.
+ ACE_Arg_Shifter arg_shifter (argc, argv);
+ CORBA::ULong len = 0;
+
+ while (arg_shifter.is_anything_left ())
+ {
+ const ACE_TCHAR *current_arg = 0;
+ int result =
+ arg_shifter.cur_arg_strncasecmp (
+ ACE_TEXT ("-ORBSkipServiceConfigOpen"));
+
+ if (0 == result) // Start with the parameterless flags.
+ {
+ skip_service_config_open = true;
+
+ arg_shifter.consume_arg ();
+ }
+ else // Continue with flags that accept parameters.
+ {
+ current_arg =
+ arg_shifter.get_the_parameter (
+ ACE_TEXT ("-ORBSvcConfDirective"));
+
+ if (0 != current_arg)
+ {
+ len = svc_config_argv.length ();
+ svc_config_argv.length (len + 2); // 2 arguments to add
+
+ // This is used to pass arguments to the Service
+ // Configurator using the "command line" to provide
+ // configuration information rather than using a svc.conf
+ // file. Pass the "-S" to the service configurator.
+ svc_config_argv[len] = CORBA::string_dup ("-S");
+ svc_config_argv[len + 1] =
+ CORBA::string_dup (ACE_TEXT_ALWAYS_CHAR (current_arg));
+
+ arg_shifter.consume_arg ();
+ }
+ else
+ {
+ current_arg =
+ arg_shifter.get_the_parameter (
+ ACE_TEXT ("-ORBServiceConfigLoggerKey"));
+
+ if (0 != current_arg)
+ {
+ len = svc_config_argv.length ();
+ svc_config_argv.length (len + 2); // 2 arguments to add
+
+ svc_config_argv[len] = CORBA::string_dup ("-k");
+ svc_config_argv[len + 1] =
+ CORBA::string_dup (ACE_TEXT_ALWAYS_CHAR (current_arg));
+
+ arg_shifter.consume_arg ();
+ }
+ // Can't interpret this argument.
+ // Move on to the next argument.
+ else
+ {
+ // Any arguments that don't match are ignored so that
+ // the caller can still use them.
+ arg_shifter.ignore_arg ();
+ }
+ }
+ }
+ }
+
+ return 0;
+ } /* parse_private_args_i */
+
+ int
+ parse_global_args_i (int &argc,
+ char **argv,
+ CORBA::StringSeq &svc_config_argv,
+ bool apply_values)
+ {
+ // NOTE: When adding new global arguments, ensure they are only
+ // applied when apply_values is true, but that they are always
+ // consumed, if they need to be consumed.
+#if defined (TAO_DEBUG) && !defined (ACE_HAS_WINCE)
+ // Make it a little easier to debug programs using this code.
+ if (apply_values)
+ {
+ TAO_debug_level = ACE_Env_Value<u_int> ("TAO_ORB_DEBUG", 0);
+
+ char * const value = ACE_OS::getenv ("TAO_ORB_DEBUG");
+
+ if (value != 0)
+ {
+ TAO_debug_level = ACE_OS::atoi (value);
+
+ if (TAO_debug_level <= 0)
+ {
+ TAO_debug_level = 1;
+ }
+
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO_debug_level == %d\n"),
+ TAO_debug_level));
+ }
+ }
+#endif /* TAO_DEBUG && !ACE_HAS_WINCE */
+
+
+ // Extract the Service Configurator ORB options from the argument
+ // vector.
+ ACE_Arg_Shifter arg_shifter (argc, argv);
+ CORBA::ULong len = 0;
+
+ while (arg_shifter.is_anything_left ())
+ {
+ const ACE_TCHAR *current_arg = 0;
+ int strcmp_result =
+ arg_shifter.cur_arg_strncasecmp (ACE_TEXT ("-ORBDebug"));
+
+ if (0 == strcmp_result)
+ {
+ if (apply_values)
+ {
+ // Later, replace all of these
+ // warning this turns on a daemon.
+ ACE::debug (1);
+ }
+
+ arg_shifter.consume_arg ();
+ }
+ else
+ {
+ current_arg =
+ arg_shifter.get_the_parameter (
+ ACE_TEXT ("-ORBNegotiateCodesets"));
+
+ if (0 != current_arg)
+ {
+ if (apply_values)
+ {
+ // Don't consume, the ORB_Core::init will use it again.
+ negotiate_codesets = (ACE_OS::atoi (current_arg));
+ }
+ }
+ else
+ {
+ current_arg =
+ arg_shifter.get_the_parameter (
+ ACE_TEXT ("-ORBDebugLevel"));
+
+ if (0 != current_arg)
+ {
+ if (apply_values)
+ {
+ TAO_debug_level =
+ ACE_OS::atoi (current_arg);
+ }
+
+ arg_shifter.consume_arg ();
+ }
+ else
+ {
+ strcmp_result =
+ arg_shifter.cur_arg_strncasecmp (
+ ACE_TEXT ("-ORBDaemon"));
+
+ if (0 == strcmp_result)
+ {
+ // Be a daemon.
+ if (apply_values)
+ {
+ len = svc_config_argv.length ();
+ svc_config_argv.length (len + 1);
+
+ svc_config_argv[len] =
+ CORBA::string_dup ("-b");
+ }
+
+ arg_shifter.consume_arg ();
+ }
+ // Can't interpret this argument.
+ // Move on to the next argument.
+ else
+ {
+ // Any arguments that don't match are ignored so
+ // that the caller can still use them.
+ arg_shifter.ignore_arg ();
+ }
+ }
+ }
+ }
+ }
+
+ return 0;
+ } /* parse_global_args_i */
+} // anonymous namespace.
diff --git a/TAO/tao/TAO_Internal.h b/TAO/tao/TAO_Internal.h
new file mode 100644
index 00000000000..3a40ef07bd6
--- /dev/null
+++ b/TAO/tao/TAO_Internal.h
@@ -0,0 +1,81 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file TAO_Internal.h
+ *
+ * $Id$
+ *
+ * Structures and methods completely internal to TAO.
+ *
+ * @author Chris Cleeland
+ */
+//=============================================================================
+
+#ifndef TAO_INTERNAL_H
+#define TAO_INTERNAL_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+#include "tao/Versioned_Namespace.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+/// Forward declaration
+class ACE_Service_Gestalt;
+ACE_END_VERSIONED_NAMESPACE_DECL
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ /**
+ * @namespace ORB
+ *
+ * @brief This @c namespace encapsulates some private behaviors and
+ * global data structures used internal to TAO. No
+ * application should EVER see them which is why they are not
+ * exported.
+ */
+ namespace ORB
+ {
+ /**
+ * Extract ACE Service Configurator arguments from the given
+ * argument vector, and initialize the ACE Service Configurator.
+ *
+ * @note This method should be called before the ORB Core is
+ * initialized, and before any ORBInitializers are invoked.
+ */
+ int open_services (ACE_Service_Gestalt* cfg, int& argc, ACE_TCHAR** argv);
+
+ /**
+ * The complement to @c open_services(), this will perform
+ * appropriate ACE Service Configurator closure operations. It
+ * should be called as many times as @c open_services(), and will
+ * only actually close things down on the last call. It is fully
+ * thread-safe.
+ *
+ * @return @c 0 if successful, @c -1 with @c errno set if
+ * failure.
+ */
+ int close_services (ACE_Service_Gestalt* pcfg);
+
+ /**
+ * Set default @c `svc.conf' content.
+ * This function must be called before first ORB initialization.
+ */
+ void default_svc_conf_entries (char const * rf_args,
+ char const * ssf_args,
+ char const * csf_args);
+
+ }
+}
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_INTERNAL_H */
diff --git a/TAO/tao/TAO_Server_Request.cpp b/TAO/tao/TAO_Server_Request.cpp
new file mode 100644
index 00000000000..d2a06026561
--- /dev/null
+++ b/TAO/tao/TAO_Server_Request.cpp
@@ -0,0 +1,577 @@
+// $Id$
+
+#include "tao/TAO_Server_Request.h"
+#include "tao/ORB_Core.h"
+#include "tao/Timeprobe.h"
+#include "tao/debug.h"
+#include "tao/Pluggable_Messaging.h"
+#include "tao/GIOP_Utils.h"
+#include "tao/Stub.h"
+#include "tao/operation_details.h"
+#include "tao/Transport.h"
+#include "tao/CDR.h"
+#include "tao/SystemException.h"
+
+#if TAO_HAS_INTERCEPTORS == 1
+#include "tao/PortableInterceptorC.h"
+#include "tao/ServerRequestInterceptor_Adapter.h"
+#endif
+
+#if !defined (__ACE_INLINE__)
+# include "tao/TAO_Server_Request.i"
+#endif /* ! __ACE_INLINE__ */
+
+ACE_RCSID (tao,
+ TAO_Server_Request,
+ "$Id$")
+
+#if defined (ACE_ENABLE_TIMEPROBES)
+
+static const char * TAO_Server_Request_Timeprobe_Description[] =
+{
+ "TAO_ServerRequest::TAO_ServerRequest - start",
+ "TAO_ServerRequest::TAO_ServerRequest - end",
+};
+
+enum
+ {
+ // Timeprobe description table start key.
+ TAO_SERVER_REQUEST_START = 400,
+ TAO_SERVER_REQUEST_END
+ };
+
+// Setup Timeprobes
+ACE_TIMEPROBE_EVENT_DESCRIPTIONS (TAO_Server_Request_Timeprobe_Description,
+ TAO_SERVER_REQUEST_START);
+
+#endif /* ACE_ENABLE_TIMEPROBES */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_ServerRequest::TAO_ServerRequest (TAO_Pluggable_Messaging *mesg_base,
+ TAO_InputCDR &input,
+ TAO_OutputCDR &output,
+ TAO_Transport *transport,
+ TAO_ORB_Core *orb_core)
+ : mesg_base_ (mesg_base),
+ operation_ (0),
+ operation_len_ (0),
+ release_operation_ (false),
+ incoming_ (&input),
+ outgoing_ (&output),
+ // transport already duplicated in
+ // TAO_Transport::process_parsed_messages ()
+ transport_(transport),
+ response_expected_ (false),
+ deferred_reply_ (false),
+ sync_with_server_ (false),
+ is_dsi_ (false),
+ // @@ We shouldn't be using GIOP specific types here. Need to be revisited.
+ exception_type_ (TAO_GIOP_NO_EXCEPTION),
+ orb_core_ (orb_core),
+ request_id_ (0),
+ profile_ (orb_core),
+ requesting_principal_ (0),
+ dsi_nvlist_align_ (0),
+ operation_details_ (0),
+ argument_flag_ (1)
+#if TAO_HAS_INTERCEPTORS == 1
+ , interceptor_count_ (0)
+ , rs_pi_current_ (0)
+ , result_seq_ (0)
+ , caught_exception_ (0)
+ , reply_status_ (-1)
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+{
+ ACE_FUNCTION_TIMEPROBE (TAO_SERVER_REQUEST_START);
+ // No-op.
+}
+
+// This constructor is used, by the locate request code.
+TAO_ServerRequest::TAO_ServerRequest (TAO_Pluggable_Messaging *mesg_base,
+ CORBA::ULong request_id,
+ CORBA::Boolean response_expected,
+ CORBA::Boolean deferred_reply,
+ TAO::ObjectKey &object_key,
+ const char *operation,
+ TAO_OutputCDR &output,
+ TAO_Transport *transport,
+ TAO_ORB_Core *orb_core,
+ int &parse_error)
+ : mesg_base_ (mesg_base),
+ operation_ (CORBA::string_dup (operation)),
+ operation_len_ (operation == 0 ? 0 : ACE_OS::strlen (operation)),
+ release_operation_ (true),
+ incoming_ (0),
+ outgoing_ (&output),
+ // transport already duplicated in
+ // TAO_Transport::process_parsed_messages ()
+ transport_ (transport),
+ response_expected_ (response_expected),
+ deferred_reply_ (deferred_reply),
+ sync_with_server_ (false),
+ is_dsi_ (false),
+ exception_type_ (TAO_GIOP_NO_EXCEPTION),
+ orb_core_ (orb_core),
+ request_id_ (request_id),
+ profile_ (orb_core),
+ requesting_principal_ (0),
+ dsi_nvlist_align_ (0),
+ operation_details_ (0),
+ argument_flag_ (true)
+#if TAO_HAS_INTERCEPTORS == 1
+ , interceptor_count_ (0)
+ , rs_pi_current_ (0)
+ , result_seq_ (0)
+ , caught_exception_ (0)
+ , reply_status_ (-1)
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+{
+ this->profile_.object_key (object_key);
+ parse_error = 0;
+}
+
+// Constructor used in Thru-POA collocation code.
+TAO_ServerRequest::TAO_ServerRequest (TAO_ORB_Core * orb_core,
+ TAO_Operation_Details const & details,
+ CORBA::Object_ptr target)
+ : mesg_base_ (0),
+ operation_ (details.opname ()),
+ operation_len_ (details.opname_len ()),
+ release_operation_ (false),
+ incoming_ (0),
+ outgoing_ (0),
+ transport_ (0),
+ response_expected_ (details.response_flags () == TAO_TWOWAY_RESPONSE_FLAG
+ || details.response_flags () == static_cast<CORBA::Octet> (Messaging::SYNC_WITH_SERVER)
+ || details.response_flags () == static_cast<CORBA::Octet> (Messaging::SYNC_WITH_TARGET)),
+ deferred_reply_ (false),
+ sync_with_server_ (details.response_flags () == static_cast<CORBA::Octet> (Messaging::SYNC_WITH_SERVER)),
+ is_dsi_ (false),
+ exception_type_ (TAO_GIOP_NO_EXCEPTION),
+ orb_core_ (orb_core),
+ request_id_ (0),
+ profile_ (orb_core),
+ requesting_principal_ (0),
+ dsi_nvlist_align_ (0),
+ operation_details_ (&details),
+ argument_flag_ (false)
+#if TAO_HAS_INTERCEPTORS == 1
+ , interceptor_count_ (0)
+ , rs_pi_current_ (0)
+ , result_seq_ (0)
+ , caught_exception_ (0)
+ , reply_status_ (-1)
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+{
+ // Have to use a const_cast<>. *sigh*
+ this->profile_.object_key (
+ const_cast<TAO::ObjectKey &> (target->_stubobj ()->object_key ()));
+
+ // Shallow copy the request service context list. This way the operation
+ // details and server request share the request context.
+ IOP::ServiceContextList & dest_request_contexts =
+ this->request_service_context_.service_info ();
+
+ IOP::ServiceContextList & src_request_contexts =
+ (const_cast <TAO_Operation_Details&> (details)).request_service_info ();
+
+ dest_request_contexts.replace (src_request_contexts.maximum (),
+ src_request_contexts.length (),
+ src_request_contexts.get_buffer (),
+ false /* Do not release. */);
+
+ // Don't shallow copy the reply service context. It is probably empty,
+ // when then during the request it is used, the buffer gets allocated and
+ // then the operation details don't get the reply service context
+}
+
+TAO_ServerRequest::~TAO_ServerRequest (void)
+{
+#if TAO_HAS_INTERCEPTORS == 1
+ if (this->rs_pi_current_)
+ {
+ TAO::ServerRequestInterceptor_Adapter *interceptor_adapter =
+ this->orb_core_->serverrequestinterceptor_adapter ();
+
+ if (interceptor_adapter)
+ {
+ interceptor_adapter->deallocate_pi_current (
+ this->rs_pi_current_);
+ }
+ }
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+}
+
+CORBA::ORB_ptr
+TAO_ServerRequest::orb (void)
+{
+ return this->orb_core_->orb ();
+}
+
+TAO_Service_Context &
+TAO_ServerRequest::reply_service_context (void)
+{
+ if (!operation_details_)
+ {
+ return this->reply_service_context_;
+ }
+ else
+ {
+ return const_cast <TAO_Operation_Details*> (
+ this->operation_details_)->reply_service_context ();
+ }
+}
+
+
+void
+TAO_ServerRequest::init_reply (void)
+{
+ if (!this->outgoing_)
+ return; // Collocated
+
+ // Construct our reply generator.
+ TAO_Pluggable_Reply_Params_Base reply_params;
+
+ // We put all the info that we have in to this <reply_params> and
+ // call the <write_reply_header> in the
+ // pluggable_messaging_interface. One point to be noted however is
+ // that, it was the pluggable_messaging classes who created us and
+ // delegated us to do work on its behalf. But we would be calling
+ // back. As we don't have a LOCK or any such things we can call
+ // pluggable_messaging guys again. We would be on the same thread of
+ // invocation. So *theoretically* there should not be a problem.
+ reply_params.request_id_ = this->request_id_;
+ reply_params.is_dsi_ = this->is_dsi_;
+ reply_params.dsi_nvlist_align_ = this->dsi_nvlist_align_;
+
+ // Send back the reply service context.
+ reply_params.service_context_notowned (&this->reply_service_info ());
+
+ // Are we going to marshall any data with the reply?
+ reply_params.argument_flag_ = this->argument_flag_;
+
+ // Forward exception only.
+ if (!CORBA::is_nil (this->forward_location_.in ()))
+ {
+ CORBA::Boolean const permanent_forward_condition =
+ this->orb_core_->is_permanent_forward_condition (this->forward_location_.in (),
+ this->request_service_context ());
+
+ reply_params.reply_status_
+ = permanent_forward_condition
+ ? TAO_PLUGGABLE_MESSAGE_LOCATION_FORWARD_PERM
+ : TAO_PLUGGABLE_MESSAGE_LOCATION_FORWARD;
+ }
+ // Any exception at all.
+ else if (this->exception_type_ == TAO_GIOP_NO_EXCEPTION)
+ {
+ reply_params.reply_status_ = TAO_PLUGGABLE_MESSAGE_NO_EXCEPTION;
+ }
+ else
+ {
+ reply_params.reply_status_ = this->exception_type_;
+ }
+
+
+ this->outgoing_->message_attributes (this->request_id_,
+ 0,
+ TAO_Transport::TAO_REPLY,
+ 0);
+
+ // Construct a REPLY header.
+ this->mesg_base_->generate_reply_header (*this->outgoing_,
+ reply_params);
+
+ // Finish the GIOP Reply header, then marshal the exception.
+ if (reply_params.reply_status_ == TAO_PLUGGABLE_MESSAGE_LOCATION_FORWARD ||
+ reply_params.reply_status_ == TAO_PLUGGABLE_MESSAGE_LOCATION_FORWARD_PERM)
+ {
+ // Marshal the forward location pointer.
+ CORBA::Object_ptr object_ptr = this->forward_location_.in ();
+
+ if ((*this->outgoing_ << object_ptr) == 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - ServerRequest::init_reply, ")
+ ACE_TEXT ("TAO_GIOP_ServerRequest::marshal - ")
+ ACE_TEXT ("marshal encoding forwarded objref failed\n")));
+ }
+ }
+ this->transport_->assign_translators (0, this->outgoing_);
+}
+
+void
+TAO_ServerRequest::send_no_exception_reply (void)
+{
+ // Construct our reply generator.
+ TAO_Pluggable_Reply_Params_Base reply_params;
+ reply_params.request_id_ = this->request_id_;
+ reply_params.is_dsi_ = this->is_dsi_;
+ reply_params.dsi_nvlist_align_ = this->dsi_nvlist_align_;
+
+ // Change this to pass back the same thing we received, as well as
+ // leave a comment why this is important!
+ reply_params.svc_ctx_.length (0);
+
+ // Send back the reply service context.
+ reply_params.service_context_notowned (&this->reply_service_info ());
+
+ reply_params.reply_status_ = TAO_GIOP_NO_EXCEPTION;
+
+ // No data anyway.
+ reply_params.argument_flag_ = 0;
+
+ this->outgoing_->message_attributes (this->request_id_,
+ 0,
+ TAO_Transport::TAO_REPLY,
+ 0);
+
+ // Construct a REPLY header.
+ this->mesg_base_->generate_reply_header (*this->outgoing_,
+ reply_params);
+
+ this->outgoing_->more_fragments (false);
+
+ // Send the message.
+ int result = this->transport_->send_message (*this->outgoing_,
+ 0,
+ TAO_Transport::TAO_REPLY);
+
+ if (result == -1)
+ {
+ if (TAO_debug_level > 0)
+ {
+ // No exception but some kind of error, yet a response
+ // is required.
+ ACE_ERROR ((
+ LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) - ServerRequest::send_no_exception_reply, ")
+ ACE_TEXT ("cannot send NO_EXCEPTION reply\n")
+ ));
+ }
+ }
+}
+
+void
+TAO_ServerRequest::tao_send_reply (void)
+{
+ if (this->collocated ())
+ return; // No transport in the collocated case.
+
+ this->outgoing_->more_fragments (false);
+
+ int result = this->transport_->send_message (*this->outgoing_,
+ 0,
+ TAO_Transport::TAO_REPLY);
+ if (result == -1)
+ {
+ if (TAO_debug_level > 0)
+ {
+ // No exception but some kind of error, yet a response
+ // is required.
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) - ServerRequest::tao_send_reply, ")
+ ACE_TEXT ("cannot send reply\n")));
+ }
+ }
+}
+
+void
+TAO_ServerRequest::tao_send_reply_exception (CORBA::Exception &ex)
+{
+ if (this->response_expected_ && !this->collocated ())
+ {
+ // A copy of the reply parameters
+ TAO_Pluggable_Reply_Params_Base reply_params;
+
+ reply_params.request_id_ = this->request_id_;
+ reply_params.svc_ctx_.length (0);
+
+ // Send back the reply service context.
+ reply_params.service_context_notowned (&this->reply_service_info ());
+
+ // We are going to send some data
+ reply_params.argument_flag_ = 1;
+
+ // Make a default reply status
+ reply_params.reply_status_ = TAO_GIOP_USER_EXCEPTION;
+
+ // Check whether we are able to downcast the exception
+ if (CORBA::SystemException::_downcast (&ex) != 0)
+ {
+ reply_params.reply_status_ = TAO_GIOP_SYSTEM_EXCEPTION;
+ }
+
+ // Create a new output CDR stream
+#if defined(ACE_INITIALIZE_MEMORY_BEFORE_USE)
+ // Only inititialize the buffer if we're compiling with a profiler.
+ // Otherwise, there is no real need to do so, especially since
+ // we can avoid the initialization overhead at runtime if we
+ // are not compiling with memory profiler support.
+ char repbuf[ACE_CDR::DEFAULT_BUFSIZE] = { 0 };
+#else
+ char repbuf[ACE_CDR::DEFAULT_BUFSIZE];
+#endif /* ACE_INITIALIZE_MEMORY_BEFORE_USE */
+ TAO_OutputCDR output (repbuf,
+ sizeof repbuf,
+ TAO_ENCAP_BYTE_ORDER,
+ this->orb_core_->output_cdr_buffer_allocator (),
+ this->orb_core_->output_cdr_dblock_allocator (),
+ this->orb_core_->output_cdr_msgblock_allocator (),
+ this->orb_core_->orb_params ()->cdr_memcpy_tradeoff (),
+ this->mesg_base_->fragmentation_strategy (),
+ TAO_DEF_GIOP_MAJOR,
+ TAO_DEF_GIOP_MINOR);
+
+ this->transport_->assign_translators (0, &output);
+ // Make the reply message
+ if (this->mesg_base_->generate_exception_reply (*this->outgoing_,
+ reply_params,
+ ex) == -1)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) - ServerRequest::tao_send_reply_exception, ")
+ ACE_TEXT ("could not make exception reply\n")));
+
+ }
+
+ this->outgoing_->more_fragments (false);
+
+ // Send the message
+ if (this->transport_->send_message (*this->outgoing_,
+ 0,
+ TAO_Transport::TAO_REPLY) == -1)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) - ServerRequest::tao_send_reply_exception, ")
+ ACE_TEXT ("could not send exception reply\n")));
+ }
+ }
+ else if (TAO_debug_level > 0)
+ {
+ // It is unfortunate that an exception (probably a system
+ // exception) was thrown by the upcall code (even by the
+ // user) when the client was not expecting a response.
+ // However, in this case, we cannot close the connection
+ // down, since it really isn't the client's fault.
+
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) - ServerRequest::tao_send_reply_exception, ")
+ ACE_TEXT ("exception thrown ")
+ ACE_TEXT ("but client is not waiting a response\n")));
+ }
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+void
+TAO_ServerRequest::send_cached_reply (CORBA::OctetSeq &s)
+{
+ #if defined(ACE_HAS_PURIFY)
+ // Only inititialize the buffer if we're compiling with Purify.
+ // Otherwise, there is no real need to do so, especially since
+ // we can avoid the initialization overhead at runtime if we
+ // are not compiling with Purify support.
+ char repbuf[ACE_CDR::DEFAULT_BUFSIZE] = { 0 };
+#else
+ char repbuf[ACE_CDR::DEFAULT_BUFSIZE];
+#endif /* ACE_HAS_PURIFY */
+
+ TAO_OutputCDR output (repbuf,
+ sizeof repbuf,
+ TAO_ENCAP_BYTE_ORDER,
+ this->orb_core_->output_cdr_buffer_allocator (),
+ this->orb_core_->output_cdr_dblock_allocator (),
+ this->orb_core_->output_cdr_msgblock_allocator (),
+ this->orb_core_->orb_params ()->cdr_memcpy_tradeoff (),
+ this->mesg_base_->fragmentation_strategy (),
+ TAO_DEF_GIOP_MAJOR,
+ TAO_DEF_GIOP_MINOR);
+
+ this->transport_->assign_translators (0, &output);
+
+ // A copy of the reply parameters
+ TAO_Pluggable_Reply_Params_Base reply_params;
+
+ reply_params.request_id_ = this->request_id_;
+
+ reply_params.svc_ctx_.length (0);
+
+ // Send back the empty reply service context.
+ reply_params.service_context_notowned (&this->reply_service_info ());
+
+ // We are going to send some data
+ reply_params.argument_flag_ = 1;
+
+ // Make a default reply status
+ reply_params.reply_status_ = TAO_GIOP_NO_EXCEPTION;
+
+ this->outgoing_->message_attributes (this->request_id_,
+ 0,
+ TAO_Transport::TAO_REPLY,
+ 0);
+
+ // Make the reply message
+ if (this->mesg_base_->generate_reply_header (*this->outgoing_,
+ reply_params) == -1)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) - ServerRequest::send_cached_reply, ")
+ ACE_TEXT ("could not make cached reply\n")));
+
+ }
+
+ /// Append reply here....
+ this->outgoing_->write_octet_array (
+ s.get_buffer (),
+ s.length ());
+
+ if (!this->outgoing_->good_bit ())
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) - ServerRequest::send_cached_reply, ")
+ ACE_TEXT ("could not marshal reply\n")));
+
+ this->outgoing_->more_fragments (false);
+
+ // Send the message
+ if (this->transport_->send_message (*this->outgoing_,
+ 0,
+ TAO_Transport::TAO_REPLY) == -1)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) - ServerRequest::send_cached_reply, ")
+ ACE_TEXT ("could not send cached reply\n")));
+ }
+}
+
+void
+TAO_ServerRequest::caught_exception (CORBA::Exception *exception)
+{
+ if (CORBA::SystemException::_downcast (exception) != 0)
+ this->reply_status_ = PortableInterceptor::SYSTEM_EXCEPTION;
+ else if (CORBA::UserException::_downcast (exception) != 0)
+ this->reply_status_ = PortableInterceptor::USER_EXCEPTION;
+
+ this->caught_exception_ = exception;
+}
+
+TAO::PICurrent_Impl *
+TAO_ServerRequest::rs_pi_current (void)
+{
+ if (!this->rs_pi_current_)
+ {
+ TAO::ServerRequestInterceptor_Adapter *interceptor_adapter =
+ this->orb_core_->serverrequestinterceptor_adapter ();
+
+ if (interceptor_adapter)
+ {
+ this->rs_pi_current_ = interceptor_adapter->allocate_pi_current ();
+ }
+ }
+
+ return this->rs_pi_current_;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_INTERCEPTORS */
diff --git a/TAO/tao/TAO_Server_Request.h b/TAO/tao/TAO_Server_Request.h
new file mode 100644
index 00000000000..f1e065ba020
--- /dev/null
+++ b/TAO/tao/TAO_Server_Request.h
@@ -0,0 +1,388 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+* @file TAO_Server_Request.h
+*
+* $Id$
+*
+* Header file for CORBA's Server Skeleton Interface's
+* "Server Request" type.
+*
+*
+* @author Copyright 1994-1995 by Sun Microsystems Inc.
+* @author Chris Cleeland
+* @author Aniruddha Gokhale
+*/
+//=============================================================================
+
+#ifndef TAO_SERVER_REQUEST_H
+#define TAO_SERVER_REQUEST_H
+
+#include /**/ "ace/pre.h"
+#include "ace/SString.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Tagged_Profile.h"
+#include "tao/Service_Context.h"
+#include "tao/Object.h"
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ class PICurrent;
+ class PICurrent_Impl;
+}
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include "tao/PortableInterceptorC.h"
+
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Pluggable_Messaging;
+class TAO_Transport;
+class TAO_AMH_Response_Handler;
+
+namespace CORBA
+{
+ class ORB;
+ typedef ORB *ORB_ptr;
+
+ class Exception;
+}
+
+namespace TAO
+{
+ namespace CSD
+ {
+ class FW_Server_Request_Wrapper;
+ }
+}
+
+class TAO_Operation_Details;
+
+/**
+ * @class TAO_ServerRequest
+ *
+ * @brief Class representing a ServerRequest object.
+ *
+ * Encapsulates CDR, transport and pluggable messaging
+ * components on the server side.
+*/
+class TAO_Export TAO_ServerRequest
+{
+public:
+
+ /// Declare FW_Server_Request_Wrapper a friend
+ /// This friendship makes the FW_Server_Request_Wrapper be able to
+ /// clone the TAO_ServerRequest.
+ friend class TAO::CSD::FW_Server_Request_Wrapper;
+
+ /// Declare TAO_AMH_Response_Handler a friend
+ /**
+ * The TAO_AMH_Response_Handler class needs to copy part of the
+ * state in a TAO_ServerRequest, however, we do not want to expose
+ * that state as public members of this class, neither do we want to
+ * add modifiers to the TAO_AMH_Response_Handler class that would
+ * allow us (the TAO_ServerRequest class) to set the state.
+ *
+ * Lucky for us, C++ is a language for adult developers, and allow
+ * us to use the evil "friend" declaration.
+ *
+ */
+ friend class TAO_AMH_Response_Handler;
+
+ // Constructors.
+
+ TAO_ServerRequest (TAO_Pluggable_Messaging *mesg_base,
+ TAO_InputCDR &input,
+ TAO_OutputCDR &output,
+ TAO_Transport *transport,
+ TAO_ORB_Core *orb_core);
+
+ TAO_ServerRequest (TAO_Pluggable_Messaging *mesg_base,
+ CORBA::ULong request_id,
+ CORBA::Boolean response_expected,
+ CORBA::Boolean deferred_flag,
+ TAO::ObjectKey &object_key,
+ const char *operation,
+ TAO_OutputCDR &output,
+ TAO_Transport *transport,
+ TAO_ORB_Core *orb_core,
+ int &parse_error);
+
+ /// Constructor used by thru-POA collocated invocation path.
+ TAO_ServerRequest (TAO_ORB_Core * orb_core,
+ TAO_Operation_Details const & details,
+ CORBA::Object_ptr target);
+
+ /// Destructor.
+ ~TAO_ServerRequest (void);
+
+ /**
+ * @name Request attributes.
+ */
+ //@{
+ /// Return the operation name.
+ const char *operation (void) const;
+
+ /// Set the operation name.
+ void operation (const char *operation,
+ size_t length,
+ int release);
+
+ /// Return the length of the operation.
+ size_t operation_length (void) const;
+ //@}
+
+ /// Return the underlying ORB.
+ CORBA::ORB_ptr orb (void);
+
+ /// Return the ORB core pointer member.
+ TAO_ORB_Core *orb_core (void) const;
+
+ /// Start a Reply message.
+ void init_reply (void);
+
+ /// Retrieve the incoming stream.
+ TAO_InputCDR * incoming (void) const;
+
+ /// Retrieve the outgoing stream.
+ TAO_OutputCDR * outgoing (void) const;
+
+ /// Is the response expected?
+ CORBA::Boolean response_expected (void) const;
+
+ /// Should the reply be deferred?
+ CORBA::Boolean deferred_reply (void) const;
+
+ /// Set the response expected flag.
+ void response_expected (CORBA::Boolean response);
+
+ /// Should we return before dispatching the servant?
+ CORBA::Boolean sync_with_server (void) const;
+
+ /// Set the sync_with_server flag.
+ void sync_with_server (CORBA::Boolean sync_flag);
+
+ /// Used with reliable oneway requests.
+ void send_no_exception_reply (void);
+
+ TAO::ObjectKey &object_key (void);
+
+ /// Return the request TAO_Service_Context
+ TAO_Service_Context &request_service_context (void);
+
+ /// Return the reply TAO_Service_Context
+ TAO_Service_Context &reply_service_context (void);
+
+ IOP::ServiceContextList &reply_service_info (void);
+
+ IOP::ServiceContextList &request_service_info (void);
+
+ /// Return the underlying transport
+ TAO_Transport *transport ();
+
+ /// To handle System Exceptions at the lowest level, a method
+ /// returning the request_id_ is needed.
+ //@{
+ CORBA::ULong request_id (void);
+ void request_id (CORBA::ULong req);
+ //@}
+
+ /**
+ * Set the reference to the object the request should be forwarded
+ * to. This reference will only be used if set prior to calling
+ * init_reply().
+ */
+ void forward_location (CORBA::Object_ptr forward_reference);
+
+ /// Get the forward_location.
+ CORBA::Object_ptr forward_location (void);
+
+ /// Get the exception type.
+ CORBA::ULong exception_type (void);
+
+ /// Set the exception type.
+ void exception_type (CORBA::ULong except_type);
+
+ /// Set the requesting principal
+ void requesting_principal (const CORBA::OctetSeq & principal);
+
+ /// Return the reference to the tagged profile
+ TAO_Tagged_Profile &profile (void);
+
+ void tao_send_reply (void);
+
+ void tao_send_reply_exception (CORBA::Exception&);
+
+ /// Set the boolean member to 1.
+ void is_dsi (void);
+
+ /// Set the member.
+ void dsi_nvlist_align (ptrdiff_t alignment);
+
+ // Get the operation details for the current request.
+ TAO_Operation_Details const * operation_details (void) const;
+
+ /// Set the argument_flag
+ void argument_flag (CORBA::Boolean flag);
+
+ /// Get the argument_flag
+ CORBA::Boolean argument_flag (void);
+
+ /// Returns @c true if the current request is collocated.
+ bool collocated (void) const;
+
+#if TAO_HAS_INTERCEPTORS == 1
+ /// Send cached reply. Used in scenarios where the FTORB thinks that
+ /// this request is a duplicate
+ void send_cached_reply (CORBA::OctetSeq &ocs);
+
+ /// Return the octet sequence pointer through which the FTORB would
+ /// send the reply back.
+ void result_seq (CORBA::OctetSeq &ocs);
+
+ /// Check whether we got the result.
+ int got_result (void);
+
+ /// Return a reference to the number of interceptors pushed on to
+ /// the current interceptor flow stack.
+ /**
+ * @note It is a reference since the Portable Interceptor flow stack
+ * code must be able to modify this value and use that value
+ * at a later time without being forced to use TSS.
+ */
+ size_t & interceptor_count (void);
+
+ /// Return a reference to the "request scope" PICurrent object.
+ TAO::PICurrent_Impl *rs_pi_current (void);
+
+ CORBA::Exception *caught_exception (void);
+
+ void caught_exception (CORBA::Exception *exception);
+
+ /// Set the status of the received reply.
+ void reply_status (PortableInterceptor::ReplyStatus s);
+
+ /// Get the status of the received reply.
+ PortableInterceptor::ReplyStatus reply_status (void);
+
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+
+private:
+ /// Default ctor only used to create a TAO_ServerRequest that is about
+ /// to be the target of a clone operation.
+ TAO_ServerRequest (void);
+
+ TAO_Pluggable_Messaging *mesg_base_;
+
+ /// Operation name.
+ const char* operation_;
+
+ /// Operation length.
+ size_t operation_len_;
+
+ /// Do we own the memory associated with operation_?
+ bool release_operation_;
+
+ CORBA::Object_var forward_location_;
+
+ /// Incoming stream.
+ TAO_InputCDR *incoming_;
+
+ /// Outgoing stream.
+ TAO_OutputCDR *outgoing_;
+
+ /// Transport class.
+ TAO_Transport *transport_;
+
+ /// 0: oneway (SYNC_NONE or SYNC_WITH_TRANSPORT)
+ /// 1: twoway, or oneway (SYNC_WITH_SERVER or SYNC_WITH_TARGET)
+ CORBA::Boolean response_expected_;
+
+ /**
+ * 0: Reply would be sent by the object of this class which is the
+ * default.
+ * 1: Reply would not be prepared by this class and it would be
+ * deferred for somebody.
+ */
+ CORBA::Boolean deferred_reply_;
+
+ /// 1: oneway (SYNC_WITH_SERVER)
+ /// 0: anything else
+ CORBA::Boolean sync_with_server_;
+
+ /// Did we get passed to a CORBA::ServerRequest?
+ CORBA::Boolean is_dsi_;
+
+ /// Exception type (will be NO_EXCEPTION in the majority of the cases).
+ CORBA::ULong exception_type_;
+
+ /// A pointer to the ORB Core for the context where the request was
+ /// created.
+ TAO_ORB_Core *orb_core_;
+
+ /// Service Context info
+ TAO_Service_Context request_service_context_;
+ TAO_Service_Context reply_service_context_;
+
+ /// Unique identifier for a request.
+ CORBA::ULong request_id_;
+
+ /// The tagged profile that has the addressing information.
+ TAO_Tagged_Profile profile_;
+
+ /// Identifies the requester.
+ CORBA::OctetSeq_var requesting_principal_;
+
+ /// Used to pad CDR stream if we have used DSI.
+ ptrdiff_t dsi_nvlist_align_;
+
+ TAO_Operation_Details const * operation_details_;
+
+ /**
+ * An argument flag to indicate whether there is any data that is
+ * going to get marshaled along as a reply. The default will be 1
+ * which indicates that we have some data that needs to be sent back
+ * to the client.
+ */
+ CORBA::Boolean argument_flag_;
+
+#if TAO_HAS_INTERCEPTORS == 1
+ /// The number of interceptors pushed on to the current interceptor
+ /// flow stack.
+ size_t interceptor_count_;
+
+ /// The "Request Scope Current" (RSC) object, as required by
+ /// Portable Interceptors.
+ TAO::PICurrent_Impl *rs_pi_current_;
+
+ /// Used by the FTORB
+ CORBA::OctetSeq_var result_seq_;
+
+ /// Pointer to the caught exception.
+ CORBA::Exception * caught_exception_;
+
+ /// Reply status for the current request.
+ PortableInterceptor::ReplyStatus reply_status_;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/TAO_Server_Request.i"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_SERVER_REQUEST_H */
diff --git a/TAO/tao/TAO_Server_Request.i b/TAO/tao/TAO_Server_Request.i
new file mode 100644
index 00000000000..34d7096e65d
--- /dev/null
+++ b/TAO/tao/TAO_Server_Request.i
@@ -0,0 +1,274 @@
+// -*- C++ -*-
+//
+// $Id$
+
+#include "tao/GIOP_Utils.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// This constructor is used by the CSD clone.
+ACE_INLINE
+TAO_ServerRequest::TAO_ServerRequest (void)
+ : mesg_base_ (0),
+ operation_ (0),
+ operation_len_ (0),
+ release_operation_ (false),
+ incoming_ (0),
+ outgoing_ (0),
+ transport_(0),
+ response_expected_ (false),
+ deferred_reply_ (false),
+ sync_with_server_ (false),
+ is_dsi_ (false),
+ exception_type_ (TAO_GIOP_NO_EXCEPTION),
+ orb_core_ (0),
+ request_id_ (0),
+ profile_ (0),
+ requesting_principal_ (0),
+ dsi_nvlist_align_ (0),
+ operation_details_ (0),
+ argument_flag_ (1)
+#if TAO_HAS_INTERCEPTORS == 1
+ , interceptor_count_ (0)
+ , rs_pi_current_ ()
+ , result_seq_ (0)
+ , caught_exception_ (0)
+ , reply_status_ (-1)
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+{
+ if (this->release_operation_)
+ CORBA::string_free (const_cast<char*> (this->operation_));
+}
+
+ACE_INLINE TAO_ORB_Core *
+TAO_ServerRequest::orb_core (void) const
+{
+ return this->orb_core_;
+}
+
+ACE_INLINE TAO_InputCDR *
+TAO_ServerRequest::incoming (void) const
+{
+ return this->incoming_;
+}
+
+ACE_INLINE TAO_OutputCDR *
+TAO_ServerRequest::outgoing (void) const
+{
+ return this->outgoing_;
+}
+
+ACE_INLINE const char *
+TAO_ServerRequest::operation (void) const
+{
+ return (this->operation_ == 0 ? "" : this->operation_);
+}
+
+ACE_INLINE void
+TAO_ServerRequest::operation (const char *operation,
+ size_t length,
+ int release)
+{
+ if (this->release_operation_)
+ CORBA::string_free (const_cast <char*> (this->operation_));
+
+ this->operation_len_ = (length == 0 ? ACE_OS::strlen (operation) : length);
+ this->release_operation_ = release;
+ this->operation_ = operation;
+}
+
+ACE_INLINE size_t
+TAO_ServerRequest::operation_length (void) const
+{
+ return this->operation_len_;
+}
+
+ACE_INLINE CORBA::Boolean
+TAO_ServerRequest::response_expected (void) const
+{
+ return this->response_expected_;
+}
+
+ACE_INLINE CORBA::Boolean
+TAO_ServerRequest::deferred_reply (void) const
+{
+ return this->deferred_reply_;
+}
+
+ACE_INLINE void
+TAO_ServerRequest::response_expected (CORBA::Boolean response)
+{
+ this->response_expected_ = response;
+}
+
+ACE_INLINE CORBA::Boolean
+TAO_ServerRequest::sync_with_server (void) const
+{
+ return this->sync_with_server_;
+}
+
+ACE_INLINE void
+TAO_ServerRequest::sync_with_server (CORBA::Boolean sync_flag)
+{
+ this->sync_with_server_ = sync_flag;
+}
+
+ACE_INLINE TAO::ObjectKey &
+TAO_ServerRequest::object_key (void)
+{
+ return this->profile_.object_key ();
+}
+
+ACE_INLINE TAO_Service_Context &
+TAO_ServerRequest::request_service_context (void)
+{
+ return this->request_service_context_;
+}
+
+ACE_INLINE IOP::ServiceContextList &
+TAO_ServerRequest::reply_service_info (void)
+{
+ return this->reply_service_context ().service_info ();
+}
+
+ACE_INLINE IOP::ServiceContextList &
+TAO_ServerRequest::request_service_info (void)
+{
+ return this->request_service_context ().service_info ();
+}
+
+ACE_INLINE TAO_Transport *
+TAO_ServerRequest::transport (void)
+{
+ return this->transport_;
+}
+
+ACE_INLINE CORBA::ULong
+TAO_ServerRequest::request_id (void)
+{
+ return this->request_id_;
+}
+
+ACE_INLINE void
+TAO_ServerRequest::request_id (CORBA::ULong req)
+{
+ this->request_id_ = req;
+}
+
+ACE_INLINE void
+TAO_ServerRequest::requesting_principal (const CORBA::OctetSeq &principal)
+{
+ this->requesting_principal_ = principal;
+}
+
+ACE_INLINE TAO_Tagged_Profile &
+TAO_ServerRequest::profile (void)
+{
+ return this->profile_;
+}
+
+ACE_INLINE void
+TAO_ServerRequest::forward_location (CORBA::Object_ptr forward_reference)
+{
+ this->forward_location_ =
+ CORBA::Object::_duplicate (forward_reference);
+}
+
+ACE_INLINE CORBA::Object_ptr
+TAO_ServerRequest::forward_location (void)
+{
+ return CORBA::Object::_duplicate (this->forward_location_.in ());
+}
+
+ACE_INLINE CORBA::ULong
+TAO_ServerRequest::exception_type (void)
+{
+ return this->exception_type_;
+}
+
+ACE_INLINE void
+TAO_ServerRequest::exception_type (CORBA::ULong except_type)
+{
+ this->exception_type_ = except_type;
+}
+
+ACE_INLINE void
+TAO_ServerRequest::is_dsi (void)
+{
+ this->is_dsi_ = 1;
+}
+
+ACE_INLINE TAO_Operation_Details const *
+TAO_ServerRequest::operation_details (void) const
+{
+ return this->operation_details_;
+}
+
+ACE_INLINE void
+TAO_ServerRequest::dsi_nvlist_align (ptrdiff_t alignment)
+{
+ this->dsi_nvlist_align_ = alignment;
+}
+
+ACE_INLINE CORBA::Boolean
+TAO_ServerRequest::argument_flag (void)
+{
+ return this->argument_flag_;
+}
+
+ACE_INLINE void
+TAO_ServerRequest::argument_flag (CORBA::Boolean flag)
+{
+ this->argument_flag_ = flag;
+}
+
+ACE_INLINE bool
+TAO_ServerRequest::collocated (void) const
+{
+ return this->transport_ == 0;
+}
+
+
+#if TAO_HAS_INTERCEPTORS == 1
+ACE_INLINE size_t &
+TAO_ServerRequest::interceptor_count (void)
+{
+ return this->interceptor_count_;
+}
+
+ACE_INLINE int
+TAO_ServerRequest::got_result (void)
+{
+ if (this->result_seq_.ptr () == 0)
+ return 0;
+
+ return 1;
+}
+
+ACE_INLINE void
+TAO_ServerRequest::result_seq (CORBA::OctetSeq &ocs)
+{
+ this->result_seq_ = ocs;
+}
+
+ACE_INLINE CORBA::Exception *
+TAO_ServerRequest::caught_exception (void)
+{
+ return this->caught_exception_;
+}
+
+ACE_INLINE void
+TAO_ServerRequest::reply_status (PortableInterceptor::ReplyStatus s)
+{
+ this->reply_status_ = s;
+}
+
+ACE_INLINE PortableInterceptor::ReplyStatus
+TAO_ServerRequest::reply_status (void)
+{
+ return this->reply_status_;
+}
+
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/TAO_Singleton.cpp b/TAO/tao/TAO_Singleton.cpp
new file mode 100644
index 00000000000..dc8493856a9
--- /dev/null
+++ b/TAO/tao/TAO_Singleton.cpp
@@ -0,0 +1,209 @@
+// -*- C++ -*-
+//
+// $Id$
+
+#ifndef TAO_SINGLETON_CPP
+#define TAO_SINGLETON_CPP
+
+#include "tao/TAO_Singleton.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/TAO_Singleton_Manager.h"
+
+#include "ace/Guard_T.h"
+#include "ace/Object_Manager.h"
+#include "ace/Log_Msg.h"
+
+#if !defined (__ACE_INLINE__)
+#include "tao/TAO_Singleton.inl"
+#endif /* __ACE_INLINE__ */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template <class TYPE, class ACE_LOCK> void
+TAO_Singleton<TYPE, ACE_LOCK>::dump (void)
+{
+ ACE_TRACE ("TAO_Singleton<TYPE, ACE_LOCK>::dump");
+
+#if !defined (ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES)
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("instance_ = %x"),
+ TAO_Singleton<TYPE, ACE_LOCK>::instance_i ()));
+ ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
+#endif /* ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES */
+}
+
+template <class TYPE, class ACE_LOCK> TAO_Singleton<TYPE, ACE_LOCK> *&
+TAO_Singleton<TYPE, ACE_LOCK>::instance_i (void)
+{
+#if defined (ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES)
+ // Pointer to the Singleton instance. This works around a bug with
+ // G++ and it's (mis-)handling of templates and statics...
+ static TAO_Singleton<TYPE, ACE_LOCK> *singleton_ = 0;
+
+ return singleton_;
+#else
+ return TAO_Singleton<TYPE, ACE_LOCK>::singleton_;
+#endif /* ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES */
+}
+
+template <class TYPE, class ACE_LOCK> TYPE *
+TAO_Singleton<TYPE, ACE_LOCK>::instance (void)
+{
+ ACE_TRACE ("TAO_Singleton<TYPE, ACE_LOCK>::instance");
+
+ TAO_Singleton<TYPE, ACE_LOCK> *&singleton =
+ TAO_Singleton<TYPE, ACE_LOCK>::instance_i ();
+
+ // Perform the Double-Check pattern...
+ if (singleton == 0)
+ {
+ if (TAO_Singleton_Manager::starting_up () ||
+ TAO_Singleton_Manager::shutting_down ())
+ {
+ // The program is still starting up, and therefore assumed
+ // to be single threaded. There's no need to double-check.
+ // Or, the TAO_Singleton_Manager instance has been destroyed,
+ // so the preallocated lock is not available. Either way,
+ // don't register for destruction with the
+ // TAO_Singleton_Manager: we'll have to leak this instance.
+
+ ACE_NEW_RETURN (singleton, (TAO_Singleton<TYPE, ACE_LOCK>), 0);
+ }
+ else
+ {
+#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
+ // Obtain a lock from the ACE_Object_Manager. The pointer
+ // is static, so we only obtain one per TAO_Singleton
+ // instantiation.
+ static ACE_LOCK *lock = 0;
+ if (ACE_Object_Manager::get_singleton_lock (lock) != 0)
+ // Failed to acquire the lock!
+ return 0;
+
+ ACE_GUARD_RETURN (ACE_LOCK, ace_mon, *lock, 0);
+
+ if (singleton == 0)
+ {
+#endif /* ACE_MT_SAFE */
+ ACE_NEW_RETURN (singleton, (TAO_Singleton<TYPE, ACE_LOCK>), 0);
+
+ // Register for destruction with TAO_Singleton_Manager.
+ TAO_Singleton_Manager::at_exit (singleton);
+#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
+ }
+#endif /* ACE_MT_SAFE */
+ }
+ }
+
+ return &singleton->instance_;
+}
+
+template <class TYPE, class ACE_LOCK> void
+TAO_Singleton<TYPE, ACE_LOCK>::cleanup (void *)
+{
+ delete this;
+ TAO_Singleton<TYPE, ACE_LOCK>::instance_i () = 0;
+}
+
+#if !defined (ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES)
+// Pointer to the Singleton instance.
+template <class TYPE, class ACE_LOCK> TAO_Singleton<TYPE, ACE_LOCK> *
+TAO_Singleton<TYPE, ACE_LOCK>::singleton_ = 0;
+
+template <class TYPE, class ACE_LOCK> TAO_TSS_Singleton<TYPE, ACE_LOCK> *
+TAO_TSS_Singleton<TYPE, ACE_LOCK>::singleton_ = 0;
+#endif /* !defined (ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES) */
+
+
+template <class TYPE, class ACE_LOCK> void
+TAO_TSS_Singleton<TYPE, ACE_LOCK>::dump (void)
+{
+ ACE_TRACE ("TAO_TSS_Singleton<TYPE, ACE_LOCK>::dump");
+
+#if !defined (ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES)
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("instance_ = %x"),
+ TAO_TSS_Singleton<TYPE, ACE_LOCK>::instance_i ()));
+ ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
+#endif /* ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES */
+}
+
+template <class TYPE, class ACE_LOCK> TAO_TSS_Singleton<TYPE, ACE_LOCK> *&
+TAO_TSS_Singleton<TYPE, ACE_LOCK>::instance_i (void)
+{
+#if defined (ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES)
+ // Pointer to the Singleton instance. This works around a bug with
+ // G++ and it's (mis-)handling of templates and statics...
+ static TAO_TSS_Singleton<TYPE, ACE_LOCK> *singleton_ = 0;
+
+ return singleton_;
+#else
+ return TAO_TSS_Singleton<TYPE, ACE_LOCK>::singleton_;
+#endif /* ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES */
+}
+
+template <class TYPE, class ACE_LOCK> TYPE *
+TAO_TSS_Singleton<TYPE, ACE_LOCK>::instance (void)
+{
+ ACE_TRACE ("TAO_TSS_Singleton<TYPE, ACE_LOCK>::instance");
+
+ TAO_TSS_Singleton<TYPE, ACE_LOCK> *&singleton =
+ TAO_TSS_Singleton<TYPE, ACE_LOCK>::instance_i ();
+
+ // Perform the Double-Check pattern...
+ if (singleton == 0)
+ {
+ if (TAO_Singleton_Manager::starting_up () ||
+ TAO_Singleton_Manager::shutting_down ())
+ {
+ // The program is still starting up, and therefore assumed
+ // to be single threaded. There's no need to double-check.
+ // Or, the TAO_Singleton_Manager instance has been destroyed,
+ // so the preallocated lock is not available. Either way,
+ // don't register for destruction with the
+ // TAO_Singleton_Manager: we'll have to leak this instance.
+
+ ACE_NEW_RETURN (singleton, (TAO_TSS_Singleton<TYPE, ACE_LOCK>), 0);
+ }
+ else
+ {
+#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
+ // Obtain a lock from the ACE_Object_Manager. The pointer
+ // is static, so we only obtain one per TAO_Singleton
+ // instantiation.
+ static ACE_LOCK *lock = 0;
+ if (ACE_Object_Manager::get_singleton_lock (lock) != 0)
+ // Failed to acquire the lock!
+ return 0;
+
+ ACE_GUARD_RETURN (ACE_LOCK, ace_mon, *lock, 0);
+
+ if (singleton == 0)
+ {
+#endif /* ACE_MT_SAFE */
+ ACE_NEW_RETURN (singleton, (TAO_TSS_Singleton<TYPE, ACE_LOCK>),
+ 0);
+
+ // Register for destruction with TAO_Singleton_Manager.
+ TAO_Singleton_Manager::at_exit (singleton);
+#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
+ }
+#endif /* ACE_MT_SAFE */
+ }
+ }
+
+ return ACE_TSS_GET (&singleton->instance_, TYPE);
+}
+
+template <class TYPE, class ACE_LOCK> void
+TAO_TSS_Singleton<TYPE, ACE_LOCK>::cleanup (void *)
+{
+ delete this;
+ TAO_TSS_Singleton<TYPE, ACE_LOCK>::instance_i () = 0;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_SINGLETON_CPP */
diff --git a/TAO/tao/TAO_Singleton.h b/TAO/tao/TAO_Singleton.h
new file mode 100644
index 00000000000..41d27015cb8
--- /dev/null
+++ b/TAO/tao/TAO_Singleton.h
@@ -0,0 +1,142 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file TAO_Singleton.h
+ *
+ * $Id$
+ *
+ * Header file for the TAO-specific Singleton implementation.
+ * Based entirely on ace/Singleton.*.
+ *
+ * @author Ossama Othman <ossama@uci.edu>
+ */
+//=============================================================================
+
+
+#ifndef TAO_SINGLETON_H
+#define TAO_SINGLETON_H
+
+#include /**/ "ace/pre.h"
+
+#include "ace/TSS_T.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Versioned_Namespace.h"
+
+#include "ace/Cleanup.h"
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_Singleton
+ *
+ * @brief TAO-specific Singleton class
+ *
+ * TAO_Singletons are used by TAO to register TAO-specific
+ * singleton instances with the TAO_Object_Manager. This
+ * ensures that TAO singletons are isolated from ACE's
+ * Object_Manager, thus allowing TAO to be safely dynamically
+ * unloaded.
+ */
+template <class TYPE, class ACE_LOCK>
+class TAO_Singleton : public ACE_Cleanup
+{
+
+public:
+ /// Global access point to the Singleton.
+ static TYPE *instance (void);
+
+ /// Cleanup method, used by <ace_cleanup_destroyer> to destroy the
+ /// singleton.
+ virtual void cleanup (void *param = 0);
+
+ /// Dump the state of the object.
+ static void dump (void);
+
+protected:
+ /// Default constructor.
+ TAO_Singleton (void);
+
+ /// Contained instance.
+ TYPE instance_;
+
+#if !defined (ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES)
+ /// Pointer to the Singleton (ACE_Cleanup) instance.
+ static TAO_Singleton<TYPE, ACE_LOCK> *singleton_;
+#endif /* ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES */
+
+ /// Get pointer to the TAO Singleton instance.
+ static TAO_Singleton<TYPE, ACE_LOCK> *&instance_i (void);
+};
+
+/**
+ * @class TAO_TSS_Singleton
+ *
+ * @brief TAO-specific Singleton class
+ *
+ * TAO_Singletons are used by TAO to register TAO-specific
+ * singleton instances with the TAO_Object_Manager. This
+ * ensures that TAO singletons are isolated from ACE's
+ * Object_Manager, thus allowing TAO to be safely dynamically
+ * unloaded.
+ */
+template <class TYPE, class ACE_LOCK>
+class TAO_TSS_Singleton : public ACE_Cleanup
+{
+
+public:
+ /// Global access point to the Singleton.
+ static TYPE *instance (void);
+
+ /// Cleanup method, used by <ace_cleanup_destroyer> to destroy the
+ /// singleton.
+ virtual void cleanup (void *param = 0);
+
+ /// Dump the state of the object.
+ static void dump (void);
+
+protected:
+ /// Default constructor.
+ TAO_TSS_Singleton (void);
+
+ /// Contained instance.
+ ACE_TSS_TYPE (TYPE) instance_;
+
+#if !defined (ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES)
+ /// Pointer to the Singleton (ACE_Cleanup) instance.
+ static TAO_TSS_Singleton<TYPE, ACE_LOCK> *singleton_;
+#endif /* ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES */
+
+ /// Get pointer to the TAO TSS Singleton instance.
+ static TAO_TSS_Singleton<TYPE, ACE_LOCK> *&instance_i (void);
+
+private:
+
+ ACE_UNIMPLEMENTED_FUNC (void operator= (const TAO_TSS_Singleton<TYPE,ACE_LOCK> &))
+ ACE_UNIMPLEMENTED_FUNC (TAO_TSS_Singleton (const TAO_TSS_Singleton<TYPE,ACE_LOCK> &))
+
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+#include "tao/TAO_Singleton.inl"
+#endif /* __ACE_INLINE__ */
+
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+#include "tao/TAO_Singleton.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
+#pragma implementation ("TAO_Singleton.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_SINGLETON_H */
diff --git a/TAO/tao/TAO_Singleton.inl b/TAO/tao/TAO_Singleton.inl
new file mode 100644
index 00000000000..bacacea205e
--- /dev/null
+++ b/TAO/tao/TAO_Singleton.inl
@@ -0,0 +1,23 @@
+// -*- C++ -*-
+//
+// $Id$
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Default constructors.
+//
+// Note: don't explicitly initialize "instance_", because TYPE may not
+// have a default constructor. Let the compiler figure it out . . .
+
+template <class TYPE, class ACE_LOCK> ACE_INLINE
+TAO_Singleton<TYPE, ACE_LOCK>::TAO_Singleton (void)
+{
+}
+
+template <class TYPE, class ACE_LOCK> ACE_INLINE
+TAO_TSS_Singleton<TYPE, ACE_LOCK>::TAO_TSS_Singleton (void)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/TAO_Singleton_Manager.cpp b/TAO/tao/TAO_Singleton_Manager.cpp
new file mode 100644
index 00000000000..4438d66db11
--- /dev/null
+++ b/TAO/tao/TAO_Singleton_Manager.cpp
@@ -0,0 +1,363 @@
+// $Id$
+
+#include "tao/TAO_Singleton_Manager.h"
+#include "tao/Exception.h"
+
+#include "ace/Guard_T.h"
+#include "ace/Recursive_Thread_Mutex.h"
+#include "ace/Log_Msg.h"
+#include "ace/Object_Manager.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/TAO_Singleton_Manager.inl"
+#endif /* ! __ACE_INLINE__ */
+
+#if defined (ACE_HAS_EXCEPTIONS)
+# if defined (ACE_MVS)
+# include /**/ <unexpect.h>
+# else
+# if defined (ACE_HAS_STANDARD_CPP_LIBRARY)
+# include /**/ <exception>
+# else
+# include /**/ <exception.h>
+# endif /* ACE_HAS_STANDARD_CPP_LIBRARY */
+# endif /* ACE_MVS */
+#endif /* ACE_HAS_EXCEPTIONS */
+
+ACE_RCSID (tao,
+ TAO_Singleton_Manager,
+ "$Id$")
+
+
+namespace
+{
+ // Singleton instance pointer.
+ TAO_Singleton_Manager * the_instance = 0;
+}
+
+#if (defined (ACE_HAS_VERSIONED_NAMESPACE) && ACE_HAS_VERSIONED_NAMESPACE == 1)
+# define TAO_SINGLETON_MANAGER_CLEANUP_DESTROYER_NAME ACE_PREPROC_CONCATENATE(TAO_VERSIONED_NAMESPACE_NAME, _TAO_Singleton_Manager_cleanup_destroyer)
+#endif /* ACE_HAS_VERSIONED_NAMESPACE == 1 */
+
+// Adapter for cleanup, used to register cleanup function with the
+// ACE_Object_Manager.
+extern "C" void
+TAO_SINGLETON_MANAGER_CLEANUP_DESTROYER_NAME (void *, void *)
+{
+#if defined (TAO_HAS_VERSIONED_NAMESPACE) \
+ && TAO_HAS_VERSIONED_NAMESPACE == 1
+ using namespace TAO_VERSIONED_NAMESPACE_NAME;
+#endif /* TAO_HAS_VERSIONED_NAMESPACE */
+
+ if (the_instance)
+ {
+ (void) TAO_Singleton_Manager::instance ()->fini ();
+ }
+}
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Singleton_Manager::TAO_Singleton_Manager (void)
+ // default_mask_ isn't initialized, because it's defined by <init>.
+ : thread_hook_ (0),
+ exit_info_ (),
+ registered_with_object_manager_ (-1)
+#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
+ , internal_lock_ (0)
+# endif /* ACE_MT_SAFE */
+#if defined (ACE_HAS_EXCEPTIONS)
+ , old_unexpected_ (0)
+#endif /* ACE_HAS_EXCEPTIONS */
+{
+#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
+ ACE_NEW (this->internal_lock_,
+ TAO_SYNCH_RECURSIVE_MUTEX);
+# endif /* ACE_MT_SAFE */
+ // Be sure that no further instances are created via instance ().
+ if (the_instance == 0)
+ {
+ the_instance = this;
+ }
+
+ // @@ This is a hack. Allow the TAO_Singleton_Manager to be registered
+ // with the ACE_Object_Manager (or not) in an explicit call to
+ // TAO_Singleton_Manager::init(). However, once the explicit call is
+ // made, it will not be possible to alter the setting.
+ int register_with_object_manager = -1;
+ (void) this->init (register_with_object_manager);
+}
+
+TAO_Singleton_Manager::~TAO_Singleton_Manager (void)
+{
+ this->dynamically_allocated_ = 0; // Don't delete this again in fini()
+ (void) this->fini ();
+}
+
+sigset_t *
+TAO_Singleton_Manager::default_mask (void)
+{
+ return TAO_Singleton_Manager::instance ()->default_mask_;
+}
+
+ACE_Thread_Hook *
+TAO_Singleton_Manager::thread_hook (void)
+{
+ return TAO_Singleton_Manager::instance ()->thread_hook_;
+}
+
+ACE_Thread_Hook *
+TAO_Singleton_Manager::thread_hook (ACE_Thread_Hook *new_thread_hook)
+{
+ TAO_Singleton_Manager *tao_om = TAO_Singleton_Manager::instance ();
+ ACE_Thread_Hook *old_hook = tao_om->thread_hook_;
+ tao_om->thread_hook_ = new_thread_hook;
+ return old_hook;
+}
+
+TAO_Singleton_Manager *
+TAO_Singleton_Manager::instance (void)
+{
+ // This function should be called during construction of static
+ // instances, or before any other threads have been created in the
+ // process. So, it's not thread safe.
+
+ if (the_instance == 0)
+ {
+ TAO_Singleton_Manager *instance_pointer = 0;
+
+ ACE_NEW_RETURN (instance_pointer,
+ TAO_Singleton_Manager,
+ 0);
+ ACE_ASSERT (instance_pointer == the_instance);
+
+ instance_pointer->dynamically_allocated_ = 1;
+
+ return instance_pointer;
+ }
+ else
+ {
+ return the_instance;
+ }
+}
+
+int
+TAO_Singleton_Manager::init (void)
+{
+ if (this->registered_with_object_manager_ == -1)
+ {
+ // Register the TAO_Singleton_Manager with the
+ // ACE_Object_Manager.
+ int register_with_object_manager = 1;
+
+ return this->init (register_with_object_manager);
+ }
+
+ return 1; // Already initialized.
+}
+
+int
+TAO_Singleton_Manager::init (int register_with_object_manager)
+{
+ if (this->starting_up_i ())
+ {
+ // First, indicate that this TAO_Singleton_Manager instance is being
+ // initialized.
+ this->object_manager_state_ = OBJ_MAN_INITIALIZING;
+
+ if (this == the_instance)
+ {
+# if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
+ // @@ No MT-specific pre-allocated objects.
+# endif /* ACE_MT_SAFE */
+ }
+
+ ACE_NEW_RETURN (this->default_mask_, sigset_t, -1);
+ ACE_OS::sigfillset (this->default_mask_);
+
+ // Finally, indicate that the TAO_Singleton_Manager instance has
+ // been initialized.
+ this->object_manager_state_ = OBJ_MAN_INITIALIZED;
+
+ return 0;
+ }
+
+ // @@ This strange looking code is what provides the "register on
+ // explicit call to init()" semantics. This was needed since the
+ // TAO_Singleton_Manager constructor invokes init().
+ // Unfortunately, I couldn't get rid of that init() call without
+ // breaking things. The fact things broke needs to be
+ // investigated further.
+ if (this->registered_with_object_manager_ != -1
+ && register_with_object_manager != this->registered_with_object_manager_)
+ {
+ // An attempt was made to register the TAO_Singleton_Manager
+ // with a manager of a different type from the one it is
+ // currently registered with. This indicates a problem with the
+ // caller's logic.
+
+ errno = EINVAL;
+ return -1;
+ }
+
+ if (this->registered_with_object_manager_ == -1)
+ {
+ if (register_with_object_manager == 1
+ && ACE_Object_Manager::at_exit (
+ this,
+ (ACE_CLEANUP_FUNC) TAO_SINGLETON_MANAGER_CLEANUP_DESTROYER_NAME,
+ 0) != 0)
+ return -1;
+
+ this->registered_with_object_manager_ =
+ register_with_object_manager;
+ }
+
+ // Had already initialized.
+ return 1;
+}
+
+// Clean up a TAO_Singleton_Manager. There can be instances of this object
+// other than The Instance. This can happen if a user creates one for some
+// reason. All objects clean up their per-object information and managed
+// objects, but only The Instance cleans up the static preallocated objects.
+
+int
+TAO_Singleton_Manager::fini (void)
+{
+ if (the_instance == 0 || this->shutting_down_i ())
+ // Too late. Or, maybe too early. Either fini () has already
+ // been called, or init () was never called.
+ return this->object_manager_state_ == OBJ_MAN_SHUT_DOWN ? 1 : -1;
+
+ // No mutex here. Only the main thread should destroy the singleton
+ // TAO_Singleton_Manager instance.
+
+ // Indicate that the TAO_Singleton_Manager instance is being shut
+ // down. This object manager should be the last one to be shut
+ // down.
+ this->object_manager_state_ = OBJ_MAN_SHUTTING_DOWN;
+
+ // If another Object_Manager has registered for termination, do it.
+ if (this->next_)
+ {
+ this->next_->fini ();
+ this->next_ = 0; // Protect against recursive calls.
+ }
+
+ // Call all registered cleanup hooks, in reverse order of
+ // registration.
+ this->exit_info_.call_hooks ();
+
+// // Only clean up preallocated objects when the singleton Instance is being
+// // destroyed.
+// if (this == the_instance)
+// {
+// #if ! defined (ACE_HAS_STATIC_PREALLOCATION)
+// // Cleanup the dynamically preallocated objects.
+// # if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
+// // @@ No MT-specific preallocated objects yet.
+// # endif /* ACE_MT_SAFE */
+// // @@ No preallocated objects yet.
+// #endif /* ! ACE_HAS_STATIC_PREALLOCATION */
+// }
+
+ delete this-> default_mask_;
+ this->default_mask_ = 0;
+
+#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
+ delete this->internal_lock_;
+ this->internal_lock_ = 0;
+#endif /* ACE_MT_SAFE */
+
+#if defined (ACE_HAS_EXCEPTIONS)
+ // Restore the old unexpected exception handler since TAO will no
+ // longer be handling exceptions. Allow the application to once
+ // again handle unexpected exceptions.
+# if (!defined (_MSC_VER) \
+ && defined (ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB) \
+ && (ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB != 0)) || defined (ghs)
+ (void) std::set_unexpected (this->old_unexpected_);
+# else
+ (void) set_unexpected (this->old_unexpected_);
+# endif /* ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB */
+#endif /* ACE_HAS_EXCEPTIONS */
+
+ // Indicate that this TAO_Singleton_Manager instance has been shut down.
+ this->object_manager_state_ = OBJ_MAN_SHUT_DOWN;
+
+ if (this == the_instance)
+ the_instance = 0;
+
+ if (this->dynamically_allocated_)
+ {
+ delete this;
+ }
+
+ return 0;
+}
+
+int
+TAO_Singleton_Manager::starting_up (void)
+{
+ return
+ the_instance
+ ? the_instance->starting_up_i ()
+ : 1;
+}
+
+int
+TAO_Singleton_Manager::shutting_down (void)
+{
+ return
+ the_instance
+ ? the_instance->shutting_down_i ()
+ : 1;
+}
+
+#if defined (ACE_HAS_EXCEPTIONS)
+void
+TAO_Singleton_Manager::_set_unexpected (TAO_unexpected_handler u)
+{
+ // This must be done after the system TypeCodes and Exceptions have
+ // been initialized. An unexpected exception will cause TAO's
+ // unexpected exception handler to be called. That handler
+ // transforms all unexpected exceptions to CORBA::UNKNOWN, which of
+ // course requires the TypeCode constants and system exceptions to
+ // have been initialized.
+# if (!defined (_MSC_VER) \
+ && defined (ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB) \
+ && (ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB != 0)) || defined (ghs)
+ this->old_unexpected_ = std::set_unexpected (u);
+# else
+ this->old_unexpected_ = set_unexpected (u);
+# endif /* ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB */
+}
+#endif /* ACE_HAS_EXCEPTIONS */
+
+int
+TAO_Singleton_Manager::at_exit_i (void *object,
+ ACE_CLEANUP_FUNC cleanup_hook,
+ void *param)
+{
+ ACE_MT (ACE_GUARD_RETURN (TAO_SYNCH_RECURSIVE_MUTEX,
+ ace_mon,
+ *the_instance->internal_lock_,
+ -1));
+
+ if (this->shutting_down_i ())
+ {
+ errno = EAGAIN;
+ return -1;
+ }
+
+ if (this->exit_info_.find (object))
+ {
+ // The object has already been registered.
+ errno = EEXIST;
+ return -1;
+ }
+
+ return this->exit_info_.at_exit_i (object, cleanup_hook, param);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/TAO_Singleton_Manager.h b/TAO/tao/TAO_Singleton_Manager.h
new file mode 100644
index 00000000000..8d0313f6cb6
--- /dev/null
+++ b/TAO/tao/TAO_Singleton_Manager.h
@@ -0,0 +1,197 @@
+// -*- C++ -*-
+
+
+//=============================================================================
+/**
+ * @file TAO_Singleton_Manager.h
+ *
+ * $Id$
+ *
+ * Header file for the TAO-specific Singleton Manager. Based
+ * entirely on ace/Object_Manager.{h,i,cpp}.
+ *
+ * @author Ossama Othman <ossama@uci.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_SINGLETON_MANAGER_H
+#define TAO_SINGLETON_MANAGER_H
+
+#include /**/ "ace/pre.h"
+#include "ace/config-all.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/TAO_Export.h"
+#include "tao/orbconf.h"
+#include "ace/Object_Manager_Base.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+#if defined (ACE_HAS_EXCEPTIONS)
+typedef void (*TAO_unexpected_handler)(void);
+#endif /* ACE_HAS_EXCEPTIONS */
+
+/**
+ * @class TAO_Singleton_Manager
+ *
+ * @brief Manager for TAO library services and singleton cleanup.
+ *
+ * The TAO_Singleton_Manager is basically simplified version of the
+ * ACE_Object_Manager. It is designed specifically to manage
+ * singletons created by TAO. For example, singleton instances
+ * created by TAO will be automatically registered with the singleton
+ * instance of this Singleton Manager.
+ * @par
+ * This class is necessary to ensure that TAO-specific
+ * singletons are isolated to TAO itself, not ACE, for example. The
+ * idea is that destruction of the instance of the
+ * TAO_Singleton_Manager triggers destruction of all objects/services
+ * registered with it.
+ */
+class TAO_Export TAO_Singleton_Manager : public ACE_Object_Manager_Base
+{
+public:
+ /// Explicitly initialize.
+ virtual int init (void);
+
+ /**
+ * Explicitly initialize the TAO_Singleton_Manager, in addition to
+ * explicitly registering (or not registering) with the
+ * ACE_Object_Manager.
+ */
+ int init (int register_with_object_manager);
+
+ /// Explicitly destroy.
+ virtual int fini (void);
+
+ /**
+ * Returns 1 before the TAO_Singleton_Manager has been constructed.
+ * See ACE_Object_Manager::starting_up for more information.
+ */
+ static int starting_up (void);
+
+ /// Returns 1 after the TAO_Singleton_Manager has been destroyed.
+ /// See ACE_Object_Manager::shutting_down for more information.
+ static int shutting_down (void);
+
+ /// Accesses a default signal set used, for example, in
+ /// ACE_Sig_Guard methods.
+ static sigset_t *default_mask (void);
+
+ /// Returns the current thread hook for the process.
+ static ACE_Thread_Hook *thread_hook (void);
+
+ /// Returns the existing thread hook and assign a new_thread_hook.
+ static ACE_Thread_Hook *thread_hook (ACE_Thread_Hook *new_thread_hook);
+
+ /// Accessor to singleton instance.
+ static TAO_Singleton_Manager *instance (void);
+
+ /// Register an ACE_Cleanup object for cleanup at process
+ /// termination.
+ /**
+ * The object is deleted via the ace_cleanup_destroyer. If you need
+ * more flexiblity, see the other at_exit method below. For OS's
+ * that do not have processes, cleanup takes place at the end of
+ * main. Returns 0 on success. On failure, returns -1 and sets
+ * errno to: EAGAIN if shutting down, ENOMEM if insufficient virtual
+ * memory, or EEXIST if the object (or array) had already been
+ * registered.
+ */
+ static int at_exit (ACE_Cleanup *object, void *param = 0);
+
+ /// Register an object (or array) for cleanup at process
+ /// termination.
+ /**
+ * cleanup_hook points to a (global, or static member) function that
+ * is called for the object or array when it to be destroyed. It
+ * may perform any necessary cleanup specific for that object or its
+ * class. param is passed as the second parameter to the
+ * cleanup_hook function; the first parameter is the object (or
+ * array) to be destroyed. cleanup_hook, for example, may delete
+ * the object (or array). For OS's that do not have processes, this
+ * function is the same as <at_thread_exit>. Returns 0 on success.
+ * On failure, returns -1 and sets errno to: EAGAIN if shutting
+ * down, ENOMEM if insufficient virtual memory, or EEXIST if the
+ * object (or array) had already been registered.
+ */
+ static int at_exit (void *object,
+ ACE_CLEANUP_FUNC cleanup_hook,
+ void *param);
+
+#if defined (ACE_HAS_EXCEPTIONS)
+ /// Set a new unexpected exception handler.
+ /**
+ * The old one will be stored for restoration later on.
+ *
+ * @note Calling this method multiple times will cause the stored
+ * old unexpected exception handler pointer to be lost.
+ */
+ void _set_unexpected (TAO_unexpected_handler u);
+#endif /* ACE_HAS_EXCEPTIONS */
+
+protected:
+
+ /// Force allocation on the heap.
+ //@{
+ TAO_Singleton_Manager (void);
+ ~TAO_Singleton_Manager (void);
+ //@}
+
+private:
+
+ /// Disallow copying by not implementing the following ...
+ //@{
+ TAO_Singleton_Manager (const TAO_Singleton_Manager &);
+ TAO_Singleton_Manager &operator= (const TAO_Singleton_Manager &);
+ //@}
+
+ /// Register an object or array for deletion at program termination.
+ /// See description of static version above for return values.
+ int at_exit_i (void *object, ACE_CLEANUP_FUNC cleanup_hook, void *param);
+
+private:
+
+ /// Default signal set used, for example, in ACE_Sig_Guard.
+ sigset_t *default_mask_;
+
+ /// Thread hook that's used by this process.
+ ACE_Thread_Hook *thread_hook_;
+
+ /// For at_exit support.
+ ACE_OS_Exit_Info exit_info_;
+
+ /// Indicates if TAO_Singleton_Manager is registered with the
+ /// ACE_Object_Manager.
+ int registered_with_object_manager_;
+
+#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
+ /// Lock that is used to guard internal structures.
+ TAO_SYNCH_RECURSIVE_MUTEX *internal_lock_;
+#endif /* ACE_MT_SAFE */
+
+#if defined (ACE_HAS_EXCEPTIONS)
+ /// The old unexpected exception handler.
+ /**
+ * A pointer to the old unexpected exception handler is stored so
+ * that it can be restored when TAO is unloaded, for example.
+ * Otherwise, any unexpected exceptions will result in a call to
+ * TAO's unexpected exception handler which may no longer exist if
+ * TAO was unloaded.
+ */
+ TAO_unexpected_handler old_unexpected_;
+#endif /* ACE_HAS_EXCEPTIONS */
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/TAO_Singleton_Manager.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_SINGLETON_MANAGER_H */
diff --git a/TAO/tao/TAO_Singleton_Manager.inl b/TAO/tao/TAO_Singleton_Manager.inl
new file mode 100644
index 00000000000..a9c35b8fa13
--- /dev/null
+++ b/TAO/tao/TAO_Singleton_Manager.inl
@@ -0,0 +1,30 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+int
+TAO_Singleton_Manager::at_exit (ACE_Cleanup *object,
+ void *param)
+{
+ return TAO_Singleton_Manager::instance ()->at_exit_i (
+ object,
+ (ACE_CLEANUP_FUNC) ACE_CLEANUP_DESTROYER_NAME,
+ param);
+}
+
+ACE_INLINE
+int
+TAO_Singleton_Manager::at_exit (void *object,
+ ACE_CLEANUP_FUNC cleanup_hook,
+ void *param)
+{
+ return TAO_Singleton_Manager::instance ()->at_exit_i (
+ object,
+ cleanup_hook,
+ param);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/TAO_Utils.pc.in b/TAO/tao/TAO_Utils.pc.in
new file mode 100644
index 00000000000..5682422a2b6
--- /dev/null
+++ b/TAO/tao/TAO_Utils.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: TAO_Utils
+Description: TAO Utilities Library
+Requires: TAO_PI, TAO_CodecFactory, TAO_PortableServer, TAO_AnyTypeCode, TAO
+Version: @VERSION@
+Libs: -L${libdir} -lTAO_Utils
+Cflags: -I${includedir}
diff --git a/TAO/tao/TSS_Resources.cpp b/TAO/tao/TSS_Resources.cpp
new file mode 100644
index 00000000000..73ec7175070
--- /dev/null
+++ b/TAO/tao/TSS_Resources.cpp
@@ -0,0 +1,51 @@
+// $Id$
+
+#include "tao/TSS_Resources.h"
+#include "tao/GUIResource_Factory.h"
+#include "tao/TAO_Singleton.h"
+
+ACE_RCSID (tao,
+ TSS_Resources,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_TSS_Resources::TAO_TSS_Resources (void)
+ : poa_current_impl_ (0)
+ , rtscheduler_current_impl_ (0)
+ , rtscheduler_previous_current_impl_ (0)
+ , default_environment_ (&tss_environment_)
+
+#if (TAO_HAS_CORBA_MESSAGING == 1)
+
+ , policy_current_ (&initial_policy_current_)
+
+#endif /* TAO_HAS_CORBA_MESSAGING == 1 */
+ , gui_resource_factory_ (0)
+
+{
+}
+
+TAO_TSS_Resources::~TAO_TSS_Resources (void)
+{
+ delete this->gui_resource_factory_;
+}
+
+TAO_TSS_Resources *
+TAO_TSS_Resources::instance (void)
+{
+ // Hide the template instantiation to prevent multiple instances
+ // from being created.
+
+ return
+ TAO_TSS_Singleton<TAO_TSS_Resources, TAO_SYNCH_MUTEX>::instance ();
+}
+
+#if defined (ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION)
+template
+ TAO_TSS_Singleton<TAO_TSS_Resources, TAO_SYNCH_MUTEX> *
+ TAO_TSS_Singleton<TAO_TSS_Resources, TAO_SYNCH_MUTEX>::singleton_;
+#endif /* ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION */
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/TSS_Resources.h b/TAO/tao/TSS_Resources.h
new file mode 100644
index 00000000000..251c7a26837
--- /dev/null
+++ b/TAO/tao/TSS_Resources.h
@@ -0,0 +1,114 @@
+// -*- C++ -*-
+
+// ===================================================================
+/**
+ * @file TSS_Resources.h
+ *
+ * $Id$
+ *
+ * @author DOC Group - ISIS at Vanderbilt University
+ * @author DOC Center - Washington University at St. Louis
+ * @author DOC Laboratory - University of California at Irvine
+ */
+// ===================================================================
+
+#ifndef TAO_TAO_TSS_RESOURCES_H
+#define TAO_TAO_TSS_RESOURCES_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/TAO_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Environment.h"
+
+#include "tao/Policy_Current_Impl.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Forward declarations
+namespace TAO
+{
+ class GUIResource_Factory;
+}
+/**
+ * @class TAO_TSS_Resources
+ *
+ * @brief The TSS resoures shared by all the ORBs
+ *
+ * This class is used by TAO to store the resources that are
+ * thread-specific but are *not* ORB specific. The members are public
+ * because only the ORB Core is expected to access them.
+ */
+class TAO_Export TAO_TSS_Resources
+{
+public:
+
+ /// Constructor
+ TAO_TSS_Resources (void);
+
+ /// Destructor
+ ~TAO_TSS_Resources (void);
+
+ /// Return a singleton instance of this class.
+ static TAO_TSS_Resources * instance (void);
+
+private:
+
+ /// Do not copy TSS resources
+ //@{
+ TAO_TSS_Resources (const TAO_TSS_Resources&);
+ void operator= (const TAO_TSS_Resources&);
+ //@}
+
+public:
+
+ /**
+ * Points to structure containing state for the current upcall
+ * context in this thread. Note that it does not come from the
+ * resource factory because it must always be held in
+ * thread-specific storage. For now, since TAO_ORB_Core instances
+ * are TSS singletons, we simply ride along and don't allocate
+ * occupy another TSS slot since there are some platforms where
+ * those are precious commodities (e.g., NT).
+ */
+ void * poa_current_impl_;
+
+ void * rtscheduler_current_impl_;
+
+ void * rtscheduler_previous_current_impl_;
+
+ /// The default environment for the thread.
+ CORBA::Environment * default_environment_;
+
+ /// If the user (or library) provides no environment the ORB_Core
+ /// still holds one.
+ CORBA::Environment tss_environment_;
+
+#if (TAO_HAS_CORBA_MESSAGING == 1)
+
+ /// The initial PolicyCurrent for this thread. Should be a TSS
+ /// resource.
+ TAO_Policy_Current_Impl initial_policy_current_;
+
+ /// This pointer is reset by the POA on each upcall.
+ TAO_Policy_Current_Impl * policy_current_;
+
+#endif /* TAO_HAS_CORBA_MESSAGING == 1 */
+
+ /// A factory for creating GUIReactors.
+ /**
+ * @c GUIResource_Factory has to be stored in TSS, as GUIReactors
+ * are operational only in within the context of GUI event loops.
+ */
+ TAO::GUIResource_Factory * gui_resource_factory_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_TSS_RESOURCES_H */
diff --git a/TAO/tao/Tagged_Components.cpp b/TAO/tao/Tagged_Components.cpp
new file mode 100644
index 00000000000..172dde55018
--- /dev/null
+++ b/TAO/tao/Tagged_Components.cpp
@@ -0,0 +1,344 @@
+// $Id$
+
+#include "tao/Tagged_Components.h"
+#include "tao/CDR.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/Tagged_Components.i"
+#endif /* ! __ACE_INLINE__ */
+
+#include "ace/OS_NS_string.h"
+
+ACE_RCSID (tao,
+ Tagged_Components,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+void
+TAO_Tagged_Components::set_orb_type (CORBA::ULong orb_type)
+{
+ this->orb_type_ = orb_type;
+ this->orb_type_set_ = 1;
+
+ TAO_OutputCDR cdr;
+ cdr << ACE_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER);
+ cdr << this->orb_type_;
+
+ this->set_component_i (IOP::TAG_ORB_TYPE, cdr);
+}
+
+void
+TAO_Tagged_Components::set_code_sets (
+ const CONV_FRAME::CodeSetComponentInfo &ci)
+{
+ this->code_sets_ = ci;
+ this->code_sets_set_ = 1;
+
+ TAO_OutputCDR cdr;
+ cdr << ACE_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER);
+ cdr << this->code_sets_;
+
+ this->set_component_i (IOP::TAG_CODE_SETS, cdr);
+}
+
+void
+TAO_Tagged_Components::set_code_sets (CONV_FRAME::CodeSetComponentInfo &ci)
+{
+ this->set_code_sets_i (this->code_sets_.ForCharData,
+ ci.ForCharData);
+ this->set_code_sets_i (this->code_sets_.ForWcharData,
+ ci.ForWcharData);
+ this->code_sets_set_ = 1;
+
+ TAO_OutputCDR cdr;
+ cdr << ACE_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER);
+ cdr << this->code_sets_;
+
+ this->set_component_i (IOP::TAG_CODE_SETS, cdr);
+}
+
+void
+TAO_Tagged_Components::set_code_sets_i (
+ CONV_FRAME::CodeSetComponent &lhs,
+ CONV_FRAME::CodeSetComponent &rhs)
+{
+ lhs.native_code_set = rhs.native_code_set;
+ CORBA::ULong max = rhs.conversion_code_sets.maximum ();
+ CORBA::ULong len = rhs.conversion_code_sets.length ();
+ CONV_FRAME::CodeSetId *buffer = rhs.conversion_code_sets.get_buffer (1);
+ lhs.conversion_code_sets.replace (max, len, buffer, 1);
+}
+
+// ****************************************************************
+
+void
+TAO_Tagged_Components::set_component_i (IOP::ComponentId tag,
+ TAO_OutputCDR &cdr)
+{
+ IOP::TaggedComponent component;
+ component.tag = tag;
+
+ // Make a *copy* of the CDR stream...
+ size_t length = cdr.total_length ();
+ component.component_data.length (static_cast<CORBA::ULong> (length));
+ CORBA::Octet *buf = component.component_data.get_buffer ();
+
+ for (const ACE_Message_Block *i = cdr.begin ();
+ i != 0;
+ i = i->cont ())
+ {
+ ACE_OS::memcpy (buf, i->rd_ptr (), i->length ());
+ buf += i->length ();
+ }
+
+ this->set_component_i (component);
+}
+
+void
+TAO_Tagged_Components::set_component (const IOP::TaggedComponent& component)
+{
+ if (this->known_tag (component.tag))
+ {
+ this->set_known_component_i (component);
+ }
+
+ if (this->unique_tag (component.tag))
+ {
+ this->set_component_i (component);
+ }
+ else
+ {
+ this->add_component_i (component);
+ }
+}
+
+void
+TAO_Tagged_Components::set_component (IOP::TaggedComponent& component)
+{
+ if (this->known_tag (component.tag))
+ {
+ this->set_known_component_i (component);
+ }
+
+ if (this->unique_tag (component.tag))
+ {
+ this->set_component_i (component);
+ }
+ else
+ {
+ this->add_component_i (component);
+ }
+}
+
+void
+TAO_Tagged_Components::set_known_component_i (
+ const IOP::TaggedComponent& component)
+{
+ TAO_InputCDR cdr (reinterpret_cast<const char*> (
+ component.component_data.get_buffer ()),
+ component.component_data.length ());
+
+ CORBA::Boolean byte_order;
+
+ if ((cdr >> ACE_InputCDR::to_boolean (byte_order)) == 0)
+ {
+ return;
+ }
+
+ cdr.reset_byte_order (static_cast<int> (byte_order));
+
+ if (component.tag == IOP::TAG_ORB_TYPE)
+ {
+ CORBA::ULong orb_type;
+
+ if ((cdr >> orb_type) == 0)
+ {
+ return;
+ }
+
+ this->orb_type_ = orb_type;
+ this->orb_type_set_ = 1;
+ }
+ else if (component.tag == IOP::TAG_CODE_SETS)
+ {
+ CONV_FRAME::CodeSetComponentInfo ci;
+
+ if ((cdr >> ci) == 0)
+ {
+ return;
+ }
+
+ this->set_code_sets_i (this->code_sets_.ForCharData,
+ ci.ForCharData);
+ this->set_code_sets_i (this->code_sets_.ForWcharData,
+ ci.ForWcharData);
+ this->code_sets_set_ = 1;
+ }
+}
+
+void
+TAO_Tagged_Components::set_component_i (const IOP::TaggedComponent& component)
+{
+ // @@ TODO Some components can show up multiple times, others
+ // can't find out and take appropiate action.
+ for (CORBA::ULong i = 0; i != this->components_.length (); ++i)
+ {
+ if (component.tag == this->components_[i].tag)
+ {
+ this->components_[i] = component;
+ return;
+ }
+ }
+
+ this->add_component_i (component);
+}
+
+void
+TAO_Tagged_Components::set_component_i (IOP::TaggedComponent& component)
+{
+ for (CORBA::ULong i = 0; i != this->components_.length (); ++i)
+ {
+ if (component.tag == this->components_[i].tag)
+ {
+ CORBA::ULong max = component.component_data.maximum ();
+ CORBA::ULong len = component.component_data.length ();
+ CORBA::Octet* buf = component.component_data.get_buffer (1);
+ this->components_[i].component_data.replace (max, len, buf, 1);
+ return;
+ }
+ }
+
+ this->add_component_i (component);
+}
+
+void
+TAO_Tagged_Components::add_component_i (IOP::TaggedComponent& component)
+{
+ // @@ TODO Some components can show up multiple times, others
+ // can't find out and take appropiate action.
+ CORBA::ULong l = this->components_.length ();
+ this->components_.length (l + 1);
+ this->components_[l].tag = component.tag;
+ CORBA::ULong max = component.component_data.maximum ();
+ CORBA::ULong len = component.component_data.length ();
+ CORBA::Octet* buf = component.component_data.get_buffer (1);
+ this->components_[l].component_data.replace (max, len, buf, 1);
+}
+
+void
+TAO_Tagged_Components::add_component_i (const IOP::TaggedComponent& component)
+{
+ // @@ TODO Some components can show up multiple times, others
+ // can't find out and take appropiate action.
+ CORBA::ULong l = this->components_.length ();
+ this->components_.length (l + 1);
+ this->components_[l] = component;
+}
+
+int
+TAO_Tagged_Components::remove_component (IOP::ComponentId id)
+{
+ if (this->known_tag (id))
+ {
+ return this->remove_known_component_i (id);
+ }
+ else
+ {
+ return this->remove_component_i (id);
+ }
+}
+
+int
+TAO_Tagged_Components::remove_known_component_i (
+ IOP::ComponentId tag)
+{
+ if (tag == IOP::TAG_ORB_TYPE)
+ {
+ this->orb_type_ = 0;
+ this->orb_type_set_ = 0;
+ return 1;
+ }
+ else if (tag == IOP::TAG_CODE_SETS)
+ {
+ this->code_sets_set_ = 0;
+ return 1;
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+int
+TAO_Tagged_Components::remove_component_i (IOP::ComponentId tag)
+{
+ CORBA::ULong src = 0, dest = 0;
+ CORBA::ULong len = this->components_.length ();
+
+ for (;src != len;++src)
+ {
+ if ( tag != this->components_[src].tag)
+ {
+ this->components_[dest] = this->components_[src];
+ ++dest;
+ }
+ }
+
+ this->components_.length (dest);
+ return src - dest;
+}
+
+int
+TAO_Tagged_Components::get_component (IOP::TaggedComponent& component) const
+{
+ for (CORBA::ULong i = 0; i != this->components_.length (); ++i)
+ {
+ if (component.tag == this->components_[i].tag)
+ {
+ component = this->components_[i];
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
+// ****************************************************************
+
+int
+TAO_Tagged_Components::encode (TAO_OutputCDR& cdr) const
+{
+ return (cdr << this->components_);
+}
+
+int
+TAO_Tagged_Components::decode (TAO_InputCDR& cdr)
+{
+ // Mark the well-known components as removed
+ this->orb_type_set_ = 0;
+ this->code_sets_set_ = 0;
+
+ if ((cdr >> this->components_) == 0)
+ {
+ return 0;
+ }
+
+ CORBA::ULong l = this->components_.length ();
+
+ for (CORBA::ULong i = 0; i != l; ++i)
+ {
+ const IOP::TaggedComponent &component =
+ this->components_[i];
+
+ if (this->known_tag (component.tag))
+ {
+ this->set_known_component_i (component);
+ }
+ }
+
+ return 1;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Tagged_Components.h b/TAO/tao/Tagged_Components.h
new file mode 100644
index 00000000000..93f2a927bf3
--- /dev/null
+++ b/TAO/tao/Tagged_Components.h
@@ -0,0 +1,169 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Tagged_Components.h
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan (coryan@cs.wustl.edu)
+ */
+//=============================================================================
+
+#ifndef TAO_TAGGED_COMPONENTS_H
+#define TAO_TAGGED_COMPONENTS_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/IOP_IORC.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/CONV_FRAMEC.h"
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Profile;
+
+/// Tag for storing multiple endpoints within a single profile.
+/**
+ * This is TAO-specific, and is mostly used by TAO's RTCORBA support.
+ * The standard TAG_ALTERNATE_IIOP_ADDRESSES tagged component is the
+ * portable alternative.
+ */
+static const CORBA::ULong TAO_TAG_ENDPOINTS = 0x54414f02U;
+
+/**
+ * @class TAO_Tagged_Components
+ *
+ * @brief The policy manager implementation.
+ *
+ * This class is used to manipulate and access the <components>
+ * field of an IIOP profile (and other GIOP profiles).
+ * The definition for that field is simply a sequence of the
+ * following structures:
+ * typedef unsigned long ComponentId;
+ * struct TaggedComponent {
+ * ComponentId tag;
+ * sequence<octet> component_data;
+ * };
+ * the real motivation is to minimize the marshaling and
+ * demarshaling of the <component_data> field for certain critical
+ * components.
+ */
+class TAO_Export TAO_Tagged_Components
+{
+public:
+ /// Constructor
+ TAO_Tagged_Components (void);
+
+ // = Standard OMG that require fast access.
+ /// The the IOP::TAG_ORB_TYPE component value
+ void set_orb_type (CORBA::ULong orb_type);
+
+ /// Gets the IOP::TAG_ORB_TYPE component value, return 0 if the
+ /// component is not present.
+ int get_orb_type (CORBA::ULong& orb_type) const;
+
+ /**
+ * The the IOP::TAG_CODE_SETS component value, the first version
+ * copies the data, the second version steal all the sequence
+ * buffers.
+ */
+ void set_code_sets (const CONV_FRAME::CodeSetComponentInfo &);
+ void set_code_sets (CONV_FRAME::CodeSetComponentInfo &);
+
+ /// Gets a reference of the IOP::TAG_CODE_SETS component value,
+ /// return 0 if the component is not present.
+ int get_code_sets (const CONV_FRAME::CodeSetComponentInfo* &) const;
+
+ /// Gets a copy of the IOP::TAG_CODE_SETS component value, return 0
+ /// if the component is not present.
+ int get_code_sets (CONV_FRAME::CodeSetComponentInfo &) const;
+
+ // = Generic components
+
+ /// Insert the component into the list, making a copy of the octet
+ /// sequence.
+ void set_component (const IOP::TaggedComponent& component);
+
+ /// Insert the component into the list, but efficiently stealing the
+ /// contents of the octet sequence.
+ void set_component (IOP::TaggedComponent& component);
+
+ /// Get a copy of the component identified by <component.tag>, return
+ /// 0 if the component is not present.
+ int get_component (IOP::TaggedComponent& component) const;
+
+ /// Remove a component, if present. Return number of components
+ /// removed.
+ int remove_component (IOP::ComponentId id);
+
+ // = Marshaling and demarshaling
+
+ /// Marshal and demarshal the list.
+ int encode (TAO_OutputCDR& cdr) const;
+ int decode (TAO_InputCDR& cdr);
+
+ /**
+ * Read/Write access to the underlying
+ * MutipleComponentProfile. Added by request from Chris Hafey
+ * <chris@stentorsoft.com>
+ */
+ IOP::MultipleComponentProfile &components (void);
+
+private:
+ /// Helper method to implement set_code_sets()
+ void set_code_sets_i (CONV_FRAME::CodeSetComponent &lhs,
+ CONV_FRAME::CodeSetComponent &rhs);
+
+ /// Helper methods to implement set_component()
+ void set_known_component_i (const IOP::TaggedComponent& component);
+ void set_component_i (const IOP::TaggedComponent& component);
+ void set_component_i (IOP::TaggedComponent& component);
+ void add_component_i (const IOP::TaggedComponent& component);
+ void add_component_i (IOP::TaggedComponent& component);
+ void set_component_i (IOP::ComponentId tag, TAO_OutputCDR &cdr);
+
+ /// Helper methods to implement remove_component()
+ int remove_known_component_i (IOP::ComponentId tag);
+ int remove_component_i (IOP::ComponentId tag);
+
+ /// Helper methods to implement set_component()
+ int get_known_component_i (IOP::TaggedComponent& component) const;
+ int get_component_i (IOP::TaggedComponent& component) const;
+
+ /// Is <tag> a well-known component?
+ int known_tag (IOP::ComponentId tag) const;
+
+ /// Does <tag> show up only once?
+ int unique_tag (IOP::ComponentId tag) const;
+
+private:
+ /// The ORB_TYPE component value
+ CORBA::ULong orb_type_;
+
+ /// The ORB_TYPE component value
+ CONV_FRAME::CodeSetComponentInfo code_sets_;
+
+ /// The rest of the components, to be compliant we cannot drop a
+ /// bunch of them.
+ IOP::MultipleComponentProfile components_;
+
+ // A flag for each component...
+ CORBA::Octet orb_type_set_;
+ CORBA::Octet code_sets_set_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/Tagged_Components.i"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_TAGGED_COMPONENTS_H */
diff --git a/TAO/tao/Tagged_Components.i b/TAO/tao/Tagged_Components.i
new file mode 100644
index 00000000000..cb61b5235b4
--- /dev/null
+++ b/TAO/tao/Tagged_Components.i
@@ -0,0 +1,82 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO_Tagged_Components::TAO_Tagged_Components (void)
+ : orb_type_ (0),
+ orb_type_set_ (0),
+ code_sets_set_ (0)
+{
+}
+
+ACE_INLINE int
+TAO_Tagged_Components::get_orb_type (CORBA::ULong& orb_type) const
+{
+ if (this->orb_type_set_ == 1)
+ {
+ orb_type = this->orb_type_;
+ }
+
+ return this->orb_type_set_;
+}
+
+ACE_INLINE int
+TAO_Tagged_Components::get_code_sets (
+ const CONV_FRAME::CodeSetComponentInfo* &ci) const
+{
+ if (this->code_sets_set_ == 1)
+ {
+ ci = &this->code_sets_;
+ }
+
+ return this->code_sets_set_;
+}
+
+ACE_INLINE int
+TAO_Tagged_Components::get_code_sets (
+ CONV_FRAME::CodeSetComponentInfo &ci) const
+{
+ if (this->code_sets_set_ == 1)
+ {
+ ci = this->code_sets_;
+ }
+
+ return this->code_sets_set_;
+}
+
+ACE_INLINE int
+TAO_Tagged_Components::known_tag (IOP::ComponentId tag) const
+{
+ return (tag == IOP::TAG_ORB_TYPE
+ || tag == IOP::TAG_CODE_SETS);
+}
+
+
+ACE_INLINE int
+TAO_Tagged_Components::unique_tag (IOP::ComponentId tag) const
+{
+ return (tag == IOP::TAG_ORB_TYPE
+ || tag == IOP::TAG_CODE_SETS
+ || tag == IOP::TAG_POLICIES
+ || tag == TAO_TAG_ENDPOINTS
+ // || tag == IOP::TAG_ALTERNATE_IIOP_ADDRESS
+ || tag == IOP::TAG_COMPLETE_OBJECT_KEY
+ || tag == IOP::TAG_ENDPOINT_ID_POSITION
+ || tag == IOP::TAG_LOCATION_POLICY
+ || tag == IOP::TAG_FT_PRIMARY
+ || tag == IOP::TAG_FT_GROUP
+ || tag == IOP::TAG_DCE_STRING_BINDING
+ || tag == IOP::TAG_DCE_BINDING_NAME
+ || tag == IOP::TAG_DCE_NO_PIPES);
+}
+
+ACE_INLINE IOP::MultipleComponentProfile&
+TAO_Tagged_Components::components (void)
+{
+ return this->components_;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Tagged_Profile.cpp b/TAO/tao/Tagged_Profile.cpp
new file mode 100644
index 00000000000..b3886f8150b
--- /dev/null
+++ b/TAO/tao/Tagged_Profile.cpp
@@ -0,0 +1,197 @@
+// $Id$
+
+#include "tao/Tagged_Profile.h"
+#include "tao/ORB_Core.h"
+#include "tao/Acceptor_Registry.h"
+#include "tao/Transport_Acceptor.h"
+#include "tao/Thread_Lane_Resources.h"
+#include "tao/debug.h"
+#include "tao/target_specification.h"
+#include "tao/CDR.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/Tagged_Profile.i"
+#endif /* ! __ACE_INLINE__ */
+
+ACE_RCSID (tao,
+ Tagged_Profile,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+CORBA::Boolean
+TAO_Tagged_Profile::extract_object_key (IOP::TaggedProfile &profile)
+{
+ // Get our Acceptor registry
+ TAO_Acceptor_Registry &acceptor_registry =
+ this->orb_core_->lane_resources ().acceptor_registry ();
+
+ // Get the right acceptor for the tag in the TaggedProfile
+ TAO_Acceptor *acceptor =
+ acceptor_registry.get_acceptor (profile.tag);
+
+ if (acceptor)
+ {
+ // Get the object key
+ int retval =
+ acceptor->object_key (profile,
+ this->object_key_);
+ if (retval == -1)
+ {
+ return 0;
+ }
+ }
+ else
+ {
+ if (TAO_debug_level)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t)TAO_Tagged_Profile \n")));
+ }
+
+ return 0;
+ }
+
+ return 1;
+}
+
+CORBA::Boolean
+TAO_Tagged_Profile::unmarshall_target_address (TAO_InputCDR &cdr)
+{
+ CORBA::Boolean hdr_status = cdr.read_short (this->discriminator_);
+
+ if (hdr_status)
+ {
+ switch (this->discriminator_)
+ {
+ case TAO_Target_Specification::Key_Addr:
+ hdr_status = this->unmarshall_object_key_i (cdr);
+ break;
+
+ case TAO_Target_Specification::Profile_Addr:
+ hdr_status = this->unmarshall_iop_profile_i (cdr);
+ break;
+
+ case TAO_Target_Specification::Reference_Addr:
+ hdr_status = this->unmarshall_ref_addr_i (cdr);
+ break;
+
+ default:
+ hdr_status = 0;
+ break;
+ }
+ }
+
+ return hdr_status;
+}
+
+CORBA::Boolean
+TAO_Tagged_Profile::unmarshall_object_key (
+ TAO_InputCDR &input)
+{
+ this->discriminator_ = TAO_Target_Specification::Key_Addr;
+
+ return this->unmarshall_object_key_i (input);
+}
+
+
+CORBA::Boolean
+TAO_Tagged_Profile::unmarshall_object_key_i (
+ TAO_InputCDR &input)
+{
+ CORBA::Boolean hdr_status =
+ (CORBA::Boolean) input.good_bit ();
+
+ CORBA::Long key_length = 0;
+ hdr_status = hdr_status && input.read_long (key_length);
+
+ if (hdr_status)
+ {
+ this->object_key_.replace (key_length,
+ key_length,
+ (CORBA::Octet*)input.rd_ptr (),
+ 0);
+ input.skip_bytes (key_length);
+
+ this->object_key_extracted_ = 1;
+ }
+
+ return hdr_status;
+}
+
+
+CORBA::Boolean
+TAO_Tagged_Profile::unmarshall_iop_profile_i (
+ TAO_InputCDR &input)
+{
+ CORBA::Boolean hdr_status =
+ (CORBA::Boolean) input.good_bit ();
+
+ // Extract into the IOP::Tagged profile.
+ hdr_status &= input >> this->profile_;
+
+ return hdr_status;
+}
+
+CORBA::Boolean
+TAO_Tagged_Profile::unmarshall_ref_addr_i (
+ TAO_InputCDR &input)
+{
+ CORBA::Boolean hdr_status =
+ (CORBA::Boolean) input.good_bit ();
+
+ /*
+ * The GIOP::IORAddressingInfo is defined as follows
+ * struct IORAddressingInfo
+ * {
+ * unsigned long selected_profile_index;
+ * IOP::IOR ior;
+ * };
+ *
+ * and the IOP::IOR is defined to be
+ * struct IOR
+ * {
+ * string type_id;
+ * sequence<TaggedProfile> profiles;
+ * };
+ */
+
+ // First read the profile index
+ CORBA::ULong prof_index = 0;
+
+ hdr_status =
+ hdr_status && input.read_ulong (prof_index);
+
+ // Set the value in TAO_Tagged_Profile
+ if (hdr_status)
+ {
+ this->profile_index_ = prof_index;
+ }
+
+ // Get the length of the type_id
+ CORBA::Long id_length = 0;
+ hdr_status = hdr_status && input.read_long (id_length);
+
+ if (hdr_status)
+ {
+ // Set the type_id (it is not owned by this object)
+ this->type_id_ = input.rd_ptr ();
+
+ input.skip_bytes (id_length);
+ }
+
+ // Unmarshall the sequnce of TaggedProfiles
+ IOP::TaggedProfileSeq ior_profiles;
+
+ hdr_status &= input >> ior_profiles;
+
+ // Get the right TaggedProfile from the <ior_profiles>
+ if (hdr_status)
+ {
+ this->profile_ = ior_profiles [prof_index];
+ }
+
+ return hdr_status;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Tagged_Profile.h b/TAO/tao/Tagged_Profile.h
new file mode 100644
index 00000000000..3900de617c1
--- /dev/null
+++ b/TAO/tao/Tagged_Profile.h
@@ -0,0 +1,155 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Tagged_Profile.h
+ *
+ * $Id$
+ *
+ * @author Bala Natarajan <bala@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_TAGGED_PROFILE_H
+#define TAO_TAGGED_PROFILE_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/IOPC.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Object_KeyC.h"
+#include "tao/Versioned_Namespace.h"
+#include "ace/SString.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace CSD
+ {
+ class FW_Server_Request_Wrapper;
+ }
+}
+
+/**
+ * @class TAO_Tagged_Profile
+ *
+ * @brief This class is used to manipulate and access the target
+ * address field of a GIOP 1.2 request.
+ *
+ */
+class TAO_Export TAO_Tagged_Profile
+{
+public:
+
+ /// Declare FW_Server_Request_Wrapper a friend
+ /// This friendship makes the FW_Server_Request_Wrapper be able to
+ /// clone the TAO_Tagged_Profile data member in TAO_ServerRequest.
+ friend class TAO::CSD::FW_Server_Request_Wrapper;
+
+ /// Ctor
+ TAO_Tagged_Profile (TAO_ORB_Core *orb_core);
+
+ /// Unmarshall the GIOP 1.2 target address field.
+ CORBA::Boolean unmarshall_target_address (TAO_InputCDR &cdr);
+
+ /// Unmarshals the received object key for GIOP 1.0/1.1
+ CORBA::Boolean unmarshall_object_key (TAO_InputCDR &cdr);
+
+ /// Return the object key
+ TAO::ObjectKey &object_key (void);
+
+ /// Save the object key
+ void object_key (TAO::ObjectKey &object_key);
+
+ /// Return a const object key
+ const TAO::ObjectKey &object_key (void) const;
+
+ /// get the tagged_profile
+ const IOP::TaggedProfile &tagged_profile (void) const;
+
+ /// Get the profile index, that needs to be used in the
+ /// sequnce of TaggedProfiles contained IOP::IOR that is
+ /// receivedfrom the client.
+ CORBA::ULong profile_index (void) const;
+
+ /// Accessor to the type_id contained in the IOP::IOR received from
+ /// the client.
+ const char* type_id (void) const;
+
+ CORBA::Short discriminator (void) const;
+
+private:
+ /// Extract the object key from the TaggedProfile and store it in
+ /// <object_key_>
+ CORBA::Boolean extract_object_key (IOP::TaggedProfile &profile);
+
+ /// Unmarshals the received object key
+ CORBA::Boolean unmarshall_object_key_i (TAO_InputCDR &cdr);
+
+ /// Unmarshall the IOP::TaggedProfile
+ CORBA::Boolean unmarshall_iop_profile_i (TAO_InputCDR &cdr);
+
+ /// Unmarshalls the GIOP::IORAddressingInfo
+ CORBA::Boolean unmarshall_ref_addr_i (TAO_InputCDR &cdr);
+
+private:
+ /// Our ORB Core
+ TAO_ORB_Core *orb_core_;
+
+ /// Keep track of which kind of target profile that was extracted.
+ CORBA::Short discriminator_;
+
+ /// Flag to denote whether the object key has been extracted yet.
+ CORBA::Boolean object_key_extracted_;
+
+ /// The object key
+ TAO::ObjectKey object_key_;
+
+ /// The Tagged profile. This class would have the Tagged Profile
+ IOP::TaggedProfile profile_;
+
+ /*
+ * The GIOP::IORAddressingInfo is defined as follows
+ * struct IORAddressingInfo
+ * {
+ * unsigned long selected_profile_index;
+ * IOP::IOR ior;
+ * };
+ *
+ * and the IOP::IOR is defined to be
+ * struct IOR
+ * {
+ * string type_id;
+ * sequence<TaggedProfile> profiles;
+ * };
+ * The mapping for the type_id of type string is TAO::String_Manager
+ * which does lot of bad things like allocation on construction and
+ * a deallocation on destruction. This is bad along the critical
+ * path. So we will store this nested structure ripped open with the
+ * profile_index and the type_id with the TaggedProfile that is
+ * pointed to.
+ */
+
+ /// The profile index incase we receive a GIOP::IORAddressingInfo
+ /// information
+ CORBA::ULong profile_index_;
+
+ /// The type_id in the IOP::IOR in case we receive the
+ /// GIOP::IORAddressingInfo information.
+ const char* type_id_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/Tagged_Profile.i"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /*TAO_TAGGED_PROFILE_H*/
diff --git a/TAO/tao/Tagged_Profile.i b/TAO/tao/Tagged_Profile.i
new file mode 100644
index 00000000000..688bcd6a0ba
--- /dev/null
+++ b/TAO/tao/Tagged_Profile.i
@@ -0,0 +1,67 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO_Tagged_Profile::TAO_Tagged_Profile (TAO_ORB_Core *orb_core)
+ : orb_core_ (orb_core),
+ discriminator_ (0),
+ object_key_ (),
+ profile_ (),
+ profile_index_ (0),
+ type_id_ (0)
+{
+
+}
+
+ACE_INLINE TAO::ObjectKey &
+TAO_Tagged_Profile::object_key (void)
+{
+ if (this->object_key_extracted_ == 0)
+ this->object_key_extracted_ = this->extract_object_key (this->profile_);
+
+ return this->object_key_;
+}
+
+ACE_INLINE void
+TAO_Tagged_Profile::object_key (TAO::ObjectKey &object_key)
+{
+ this->object_key_.replace (object_key.length (),
+ object_key.length (),
+ object_key.get_buffer ());
+ this->object_key_extracted_ = 1;
+}
+
+ACE_INLINE const TAO::ObjectKey &
+TAO_Tagged_Profile::object_key (void) const
+{
+ return const_cast<TAO_Tagged_Profile *> (this)->object_key ();
+}
+
+ACE_INLINE const IOP::TaggedProfile &
+TAO_Tagged_Profile::tagged_profile (void) const
+{
+ return this->profile_;
+}
+
+ACE_INLINE CORBA::ULong
+TAO_Tagged_Profile::profile_index (void) const
+{
+ return this->profile_index_;
+}
+
+ACE_INLINE const char*
+TAO_Tagged_Profile::type_id (void) const
+{
+ return this->type_id_ == 0 ? "" : this->type_id_;
+}
+
+ACE_INLINE CORBA::Short
+TAO_Tagged_Profile::discriminator (void) const
+{
+ return this->discriminator_;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Thread_Lane_Resources.cpp b/TAO/tao/Thread_Lane_Resources.cpp
new file mode 100644
index 00000000000..9f639f4b6c4
--- /dev/null
+++ b/TAO/tao/Thread_Lane_Resources.cpp
@@ -0,0 +1,558 @@
+// $Id$
+
+#include "tao/Thread_Lane_Resources.h"
+
+ACE_RCSID (tao,
+ Thread_Lane_Resources,
+ "$Id$")
+
+#include "tao/Acceptor_Registry.h"
+#include "tao/LF_Follower.h"
+#include "tao/Leader_Follower.h"
+#include "tao/Connection_Handler.h"
+#include "tao/Transport.h"
+#include "tao/Connector_Registry.h"
+#include "tao/SystemException.h"
+#include "tao/ORB_Core.h"
+
+#include "ace/Reactor.h"
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Thread_Lane_Resources::TAO_Thread_Lane_Resources (
+ TAO_ORB_Core &orb_core,
+ TAO_New_Leader_Generator *new_leader_generator
+ )
+ : orb_core_ (orb_core),
+ acceptor_registry_ (0),
+ connector_registry_ (0),
+ transport_cache_ (0),
+ leader_follower_ (0),
+ new_leader_generator_ (new_leader_generator),
+ input_cdr_dblock_allocator_ (0),
+ input_cdr_buffer_allocator_ (0),
+ input_cdr_msgblock_allocator_ (0),
+ transport_message_buffer_allocator_ (0),
+ output_cdr_dblock_allocator_ (0),
+ output_cdr_buffer_allocator_ (0),
+ output_cdr_msgblock_allocator_ (0),
+ amh_response_handler_allocator_ (0),
+ ami_response_handler_allocator_ (0)
+{
+ // Create the transport cache.
+ ACE_NEW (this->transport_cache_,
+ TAO::Transport_Cache_Manager (orb_core));
+
+}
+
+TAO_Thread_Lane_Resources::~TAO_Thread_Lane_Resources (void)
+{
+
+}
+
+TAO::Transport_Cache_Manager &
+TAO_Thread_Lane_Resources::transport_cache (void)
+{
+ return *this->transport_cache_;
+}
+
+int
+TAO_Thread_Lane_Resources::has_acceptor_registry_been_created (void) const
+{
+ return this->acceptor_registry_ != 0;
+}
+
+int
+TAO_Thread_Lane_Resources::is_collocated (const TAO_MProfile& mprofile)
+{
+ if (!this->has_acceptor_registry_been_created ())
+ {
+ return 0;
+ }
+
+ return this->acceptor_registry ().is_collocated (mprofile);
+}
+
+TAO_Acceptor_Registry &
+TAO_Thread_Lane_Resources::acceptor_registry (void)
+{
+ // Double check.
+ if (this->acceptor_registry_ == 0)
+ {
+ // @@todo: Wouldnt this crash big time if you happen to
+ // dereference a null-pointer? Needs fixing.
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
+ ace_mon,
+ this->lock_,
+ *this->acceptor_registry_);
+
+ if (this->acceptor_registry_ == 0)
+ {
+ // @@ Not exception safe code
+ // Get the resource factory.
+ TAO_Resource_Factory &resource_factory =
+ *this->orb_core_.resource_factory ();
+
+ // Ask it to create a new acceptor registry.
+ this->acceptor_registry_ =
+ resource_factory.get_acceptor_registry ();
+ }
+ }
+
+ return *this->acceptor_registry_;
+}
+
+TAO_Connector_Registry *
+TAO_Thread_Lane_Resources::connector_registry (ACE_ENV_SINGLE_ARG_DECL)
+{
+ // Double check.
+ if (this->connector_registry_ == 0)
+ {
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
+ ace_mon,
+ this->lock_,
+ 0);
+
+ if (this->connector_registry_ == 0)
+ {
+ // Ask it to create a new acceptor registry.
+ TAO_Connector_Registry *connector_registry =
+ this->orb_core_.resource_factory ()->get_connector_registry ();
+
+ if (connector_registry == 0)
+ {
+ ACE_THROW_RETURN (
+ CORBA::INITIALIZE (
+ CORBA::SystemException::_tao_minor_code (
+ TAO_CONNECTOR_REGISTRY_INIT_LOCATION_CODE,
+ 0
+ ),
+ CORBA::COMPLETED_NO
+ ),
+ 0
+ );
+ }
+
+ if (connector_registry->open (&this->orb_core_) != 0)
+ {
+ ACE_THROW_RETURN (
+ CORBA::INITIALIZE (
+ CORBA::SystemException::_tao_minor_code (
+ TAO_CONNECTOR_REGISTRY_INIT_LOCATION_CODE,
+ 0
+ ),
+ CORBA::COMPLETED_NO
+ ),
+ 0
+ );
+ }
+
+ // Finally, everything is created and opened successfully:
+ // now we can assign to the member. Otherwise, the
+ // assignment would be premature.
+ this->connector_registry_ = connector_registry;
+ }
+ }
+
+ return this->connector_registry_;
+}
+
+
+TAO_Leader_Follower &
+TAO_Thread_Lane_Resources::leader_follower (void)
+{
+ // Double check.
+ if (this->leader_follower_ == 0)
+ {
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
+ ace_mon,
+ this->lock_,
+ *this->leader_follower_);
+
+ if (this->leader_follower_ == 0)
+ {
+ // Create a new Leader Follower object.
+ ACE_NEW_RETURN (this->leader_follower_,
+ TAO_Leader_Follower (&this->orb_core_,
+ this->new_leader_generator_),
+ *this->leader_follower_);
+ }
+ }
+
+ return *this->leader_follower_;
+}
+
+
+ACE_Allocator*
+TAO_Thread_Lane_Resources::input_cdr_dblock_allocator (void)
+{
+ if (this->input_cdr_dblock_allocator_ == 0)
+ {
+ // Double checked locking
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->lock_, 0);
+
+ if (this->input_cdr_dblock_allocator_ == 0)
+ {
+ this->input_cdr_dblock_allocator_ =
+ this->resource_factory ()->input_cdr_dblock_allocator ();
+ }
+ }
+
+ return this->input_cdr_dblock_allocator_;
+}
+
+
+ACE_Allocator*
+TAO_Thread_Lane_Resources::input_cdr_buffer_allocator (void)
+{
+ if (this->input_cdr_buffer_allocator_ == 0)
+ {
+ // Double checked locking
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->lock_, 0);
+
+ if (this->input_cdr_buffer_allocator_ == 0)
+ {
+ this->input_cdr_buffer_allocator_ =
+ this->resource_factory ()->input_cdr_buffer_allocator ();
+ }
+ }
+
+ return this->input_cdr_buffer_allocator_;
+}
+
+
+ACE_Allocator*
+TAO_Thread_Lane_Resources::input_cdr_msgblock_allocator (void)
+{
+ if (this->input_cdr_msgblock_allocator_ == 0)
+ {
+ // Double checked locking
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->lock_, 0);
+
+ if (this->input_cdr_msgblock_allocator_ == 0)
+ {
+ this->input_cdr_msgblock_allocator_ =
+ this->resource_factory ()->input_cdr_msgblock_allocator ();
+ }
+ }
+
+ return this->input_cdr_msgblock_allocator_;
+}
+
+ACE_Allocator*
+TAO_Thread_Lane_Resources::transport_message_buffer_allocator (void)
+{
+ if (this->transport_message_buffer_allocator_ == 0)
+ {
+ // Double checked locking
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->lock_, 0);
+
+ if (this->transport_message_buffer_allocator_ == 0)
+ {
+ this->transport_message_buffer_allocator_ =
+ this->resource_factory ()->input_cdr_dblock_allocator ();
+ }
+ }
+
+ return this->transport_message_buffer_allocator_;
+}
+
+
+ACE_Allocator*
+TAO_Thread_Lane_Resources::output_cdr_dblock_allocator (void)
+{
+ if (this->output_cdr_dblock_allocator_ == 0)
+ {
+ // Double checked locking
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->lock_, 0);
+
+ if (this->output_cdr_dblock_allocator_ == 0)
+ {
+ this->output_cdr_dblock_allocator_ =
+ this->resource_factory ()->output_cdr_dblock_allocator ();
+ }
+ }
+
+ return this->output_cdr_dblock_allocator_;
+}
+
+
+ACE_Allocator*
+TAO_Thread_Lane_Resources::output_cdr_buffer_allocator (void)
+{
+ if (this->output_cdr_buffer_allocator_ == 0)
+ {
+ // Double checked locking
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->lock_, 0);
+
+ if (this->output_cdr_buffer_allocator_ == 0)
+ {
+ this->output_cdr_buffer_allocator_ =
+ this->resource_factory ()->output_cdr_buffer_allocator ();
+ }
+ }
+
+ return this->output_cdr_buffer_allocator_;
+}
+
+
+ACE_Allocator*
+TAO_Thread_Lane_Resources::output_cdr_msgblock_allocator (void)
+{
+ if (this->output_cdr_msgblock_allocator_ == 0)
+ {
+ // Double checked locking
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->lock_, 0);
+
+ if (this->output_cdr_msgblock_allocator_ == 0)
+ {
+ this->output_cdr_msgblock_allocator_ =
+ this->resource_factory ()->output_cdr_msgblock_allocator ();
+ }
+ }
+
+ return this->output_cdr_msgblock_allocator_;
+}
+
+ACE_Allocator*
+TAO_Thread_Lane_Resources::amh_response_handler_allocator (void)
+{
+ if (this->amh_response_handler_allocator_ == 0)
+ {
+ // Double checked locking
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->lock_, 0);
+
+ if (this->amh_response_handler_allocator_ == 0)
+ {
+ this->amh_response_handler_allocator_ =
+ this->resource_factory ()->amh_response_handler_allocator ();
+ }
+ }
+
+ return this->amh_response_handler_allocator_;
+}
+
+ACE_Allocator*
+TAO_Thread_Lane_Resources::ami_response_handler_allocator (void)
+{
+ if (this->ami_response_handler_allocator_ == 0)
+ {
+ // Double checked locking
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->lock_, 0);
+
+ if (this->ami_response_handler_allocator_ == 0)
+ {
+ this->ami_response_handler_allocator_ =
+ this->resource_factory ()->ami_response_handler_allocator ();
+ }
+ }
+
+ return this->ami_response_handler_allocator_;
+}
+
+int
+TAO_Thread_Lane_Resources::open_acceptor_registry (const TAO_EndpointSet &endpoint_set,
+ bool ignore_address
+ ACE_ENV_ARG_DECL)
+{
+ // Access the acceptor registry.
+ TAO_Acceptor_Registry &ar = this->acceptor_registry ();
+
+ // Open it.
+ int result = ar.open (&this->orb_core_,
+ this->leader_follower ().reactor (),
+ endpoint_set,
+ ignore_address
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ return result;
+}
+
+TAO_Resource_Factory *
+TAO_Thread_Lane_Resources::resource_factory (void)
+{
+ return this->orb_core_.resource_factory ();
+}
+
+void
+TAO_Thread_Lane_Resources::finalize (void)
+{
+ // Close connectors before acceptors!
+ // Ask the registry to close all registered connectors.
+ if (this->connector_registry_ != 0)
+ {
+ this->connector_registry_->close_all ();
+ delete this->connector_registry_;
+ this->connector_registry_ = 0;
+ }
+
+ // Ask the registry to close all registered acceptors.
+ if (this->acceptor_registry_ != 0)
+ {
+ this->acceptor_registry_->close_all ();
+ delete this->acceptor_registry_;
+ this->acceptor_registry_ = 0;
+ }
+
+ // Set of handlers still in the connection cache.
+ TAO::Connection_Handler_Set handlers;
+
+ // Close the transport cache and return the handlers that were still
+ // registered. The cache will decrease the #REFCOUNT# on the
+ // handler when it removes the handler from cache. However,
+ // #REFCOUNT# is increased when the handler is placed in the handler
+ // set.
+ this->transport_cache_->close (handlers);
+
+ // Go through the handler set, closing the connections and removing
+ // the references.
+ TAO_Connection_Handler **handler = 0;
+
+ for (TAO::Connection_Handler_Set::iterator iter (handlers);
+ iter.next (handler);
+ iter.advance ())
+ {
+ // Connection is closed. Potential removal from the Reactor.
+ (*handler)->close_connection ();
+
+ // #REFCOUNT# related to the handler set decreases.
+ (*handler)->transport ()->remove_reference ();
+ }
+
+ delete this->transport_cache_;
+ this->transport_cache_ = 0;
+
+ delete this->leader_follower_;
+ this->leader_follower_ = 0;
+
+ // Delete all the allocators here.. They shouldnt be done earlier,
+ // lest some of the contents in the above, say reactor or acceptor
+ // may use memory from the pool..
+ if (this->input_cdr_dblock_allocator_ != 0)
+ {
+ this->input_cdr_dblock_allocator_->remove ();
+ delete this->input_cdr_dblock_allocator_;
+ this->input_cdr_dblock_allocator_ = 0;
+ }
+
+ if (this->input_cdr_buffer_allocator_ != 0)
+ {
+ this->input_cdr_buffer_allocator_->remove ();
+ delete this->input_cdr_buffer_allocator_;
+ this->input_cdr_buffer_allocator_ = 0;
+ }
+
+ if (this->input_cdr_msgblock_allocator_ != 0)
+ {
+ this->input_cdr_msgblock_allocator_->remove ();
+ delete this->input_cdr_msgblock_allocator_;
+ this->input_cdr_msgblock_allocator_ = 0;
+ }
+
+ if (this->transport_message_buffer_allocator_ != 0)
+ {
+ this->transport_message_buffer_allocator_->remove ();
+ delete this->transport_message_buffer_allocator_;
+ this->transport_message_buffer_allocator_ = 0;
+ }
+
+ if (this->output_cdr_dblock_allocator_ != 0)
+ {
+ this->output_cdr_dblock_allocator_->remove ();
+ delete this->output_cdr_dblock_allocator_;
+ this->output_cdr_dblock_allocator_ = 0;
+ }
+
+ if (this->output_cdr_buffer_allocator_ != 0)
+ {
+ this->output_cdr_buffer_allocator_->remove ();
+ delete this->output_cdr_buffer_allocator_;
+ this->output_cdr_buffer_allocator_ = 0;
+ }
+
+ if (this->output_cdr_msgblock_allocator_ != 0)
+ {
+ this->output_cdr_msgblock_allocator_->remove ();
+ delete this->output_cdr_msgblock_allocator_;
+ this->output_cdr_msgblock_allocator_ = 0;
+ }
+
+ if (this->amh_response_handler_allocator_ != 0)
+ {
+ this->amh_response_handler_allocator_->remove ();
+ delete this->amh_response_handler_allocator_;
+ this->amh_response_handler_allocator_ = 0;
+ }
+
+ if (this->ami_response_handler_allocator_ != 0)
+ {
+ this->ami_response_handler_allocator_->remove ();
+ delete this->ami_response_handler_allocator_;
+ this->ami_response_handler_allocator_ = 0;
+ }
+}
+
+void
+TAO_Thread_Lane_Resources::shutdown_reactor (void)
+{
+ TAO_Leader_Follower &leader_follower = this->leader_follower ();
+
+ ACE_GUARD (TAO_SYNCH_MUTEX,
+ ace_mon,
+ leader_follower.lock ());
+
+ ACE_Reactor *reactor = leader_follower.reactor ();
+
+ // Wakeup all the threads waiting blocked in the event loop, this
+ // does not guarantee that they will all go away, but reduces the
+ // load on the POA....
+
+ // If there are some client threads running we have to wait until
+ // they finish, when the last one does it will shutdown the reactor
+ // for us. Meanwhile no new requests will be accepted because the
+ // POA will not process them.
+ if (!this->orb_core_.resource_factory ()->drop_replies_during_shutdown () &&
+ leader_follower.has_clients ())
+ {
+ reactor->wakeup_all_threads ();
+ return;
+ }
+
+ // End the reactor if we want shutdown dropping replies along the
+ // way.
+ reactor->end_reactor_event_loop ();
+}
+
+void
+TAO_Thread_Lane_Resources::cleanup_rw_transports (void)
+{
+ // If we have no-drop-reply strategy or already fininalized simply return.
+ if (!this->orb_core_.resource_factory ()->drop_replies_during_shutdown () ||
+ this->transport_cache_ == 0)
+ return;
+
+ // Set of handlers still in the connection cache.
+ TAO::Connection_Handler_Set handlers;
+
+ this->transport_cache_->blockable_client_transports (handlers);
+
+ // Go through the handler set, closing the connections and removing
+ // the references.
+ TAO_Connection_Handler **handler = 0;
+
+ for (TAO::Connection_Handler_Set::iterator iter (handlers);
+ iter.next (handler);
+ iter.advance ())
+ {
+ // Connection is closed. There will be a double closure but that
+ // is okay.
+ (*handler)->release_os_resources ();
+
+ // #REFCOUNT# related to the handler set decreases.
+ (*handler)->transport ()->remove_reference ();
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Thread_Lane_Resources.h b/TAO/tao/Thread_Lane_Resources.h
new file mode 100644
index 00000000000..07ec9a50edc
--- /dev/null
+++ b/TAO/tao/Thread_Lane_Resources.h
@@ -0,0 +1,219 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Thread_Lane_Resources.h
+ *
+ * $Id$
+ *
+ * @author Irfan Pyarali
+ */
+// ===================================================================
+
+#ifndef TAO_THREAD_LANE_RESOURCES_H
+#define TAO_THREAD_LANE_RESOURCES_H
+
+#include /**/ "ace/pre.h"
+#include "ace/CORBA_macros.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/Thread_Mutex.h"
+
+#include "tao/TAO_Export.h"
+#include "tao/orbconf.h"
+#include "tao/params.h"
+
+ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+class ACE_Allocator;
+ACE_END_VERSIONED_NAMESPACE_DECL
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_ORB_Core;
+class TAO_Acceptor_Registry;
+class TAO_Leader_Follower;
+class TAO_MProfile;
+class TAO_New_Leader_Generator;
+class TAO_Connector_Registry;
+class TAO_Resource_Factory;
+
+namespace CORBA
+{
+ class Environment;
+}
+
+namespace TAO
+{
+ class Transport_Cache_Manager;
+}
+
+/**
+ * @class TAO_Thread_Lane_Resources
+ *
+ * @brief Class representing a thread lane's resources.
+ *
+ * \nosubgrouping
+ *
+ **/
+class TAO_Export TAO_Thread_Lane_Resources
+{
+public:
+ /// Constructor.
+ TAO_Thread_Lane_Resources (
+ TAO_ORB_Core &orb_core,
+ TAO_New_Leader_Generator *new_leader_generator = 0);
+
+ /// Destructor.
+ ~TAO_Thread_Lane_Resources (void);
+
+ // Does @a mprofile belong to us?
+ int is_collocated (const TAO_MProfile &mprofile);
+
+ /// Open the acceptor registry.
+ int open_acceptor_registry (const TAO_EndpointSet &endpoint_set,
+ bool ignore_address
+ ACE_ENV_ARG_DECL);
+
+ /// Finalize resources.
+ void finalize (void);
+
+ /// Shutdown the reactor.
+ void shutdown_reactor (void);
+
+ /// Certain ORB policies such as dropping replies on shutdown with
+ /// RW connection handlers would need cleanup of transports to wake
+ /// threads up.
+ void cleanup_rw_transports (void);
+
+ /// @named Accessors
+ //@{
+
+ TAO_Acceptor_Registry &acceptor_registry (void);
+
+ /*
+ * @note Returning a pointer helps to return 0 in case of
+ * exceptions.
+ */
+ TAO_Connector_Registry *connector_registry (ACE_ENV_SINGLE_ARG_DECL);
+
+ TAO::Transport_Cache_Manager &transport_cache (void);
+
+ TAO_Leader_Follower &leader_follower (void);
+
+ /* Allocator is intended for allocating the ACE_Data_Blocks used in
+ * incoming CDR streams. This allocator has locks.
+ */
+ ACE_Allocator *input_cdr_dblock_allocator (void);
+
+ /* Allocator is intended for allocating the buffers in the incoming
+ * CDR streams. This allocator has locks.
+ */
+ ACE_Allocator *input_cdr_buffer_allocator (void);
+
+ /* Allocator is intended for allocating the ACE_Message_Blocks used
+ * in incoming CDR streams. This allocator is global, and has locks.
+ */
+ ACE_Allocator *input_cdr_msgblock_allocator (void);
+
+ /* Allocator is intended for allocating the buffers used in the
+ * Transport object. This allocator has locks.
+ */
+ ACE_Allocator *transport_message_buffer_allocator (void);
+
+ /* Allocator is intended for allocating the ACE_Data_Blocks used in
+ * outgoing CDR streams. This allocator has locks.
+ */
+ ACE_Allocator *output_cdr_dblock_allocator (void);
+
+ /* Allocator is intended for allocating the buffers in the outgoing
+ * CDR streams. This allocator has locks.
+ */
+ ACE_Allocator *output_cdr_buffer_allocator (void);
+
+ /* Allocator is intended for allocating the ACE_Message_Blocks used
+ * in the outgoing CDR streams. This allocator is global, and has
+ * locks.
+ */
+ ACE_Allocator *output_cdr_msgblock_allocator (void);
+
+ /* Allocator is intended for allocating the AMH response handlers
+ * This allocator is global.
+ */
+ ACE_Allocator *amh_response_handler_allocator (void);
+
+ /* Allocator is intended for allocating the AMI response handlers
+ * This allocator is global.
+ */
+ ACE_Allocator *ami_response_handler_allocator (void);
+ //@}
+
+private:
+
+ /// Checks if the acceptor registry has been created.
+ int has_acceptor_registry_been_created (void) const;
+
+ /// Helper to get the resource factory in the ORB_Core
+ TAO_Resource_Factory *resource_factory (void);
+
+private:
+ /// ORB_Core related to this thread lane.
+ TAO_ORB_Core &orb_core_;
+
+ /// The registry which maintains a list of acceptor factories for
+ /// each loaded protocol.
+ TAO_Acceptor_Registry *acceptor_registry_;
+
+ /// The connector registry which all active connectors must register
+ /// themselves with.
+ TAO_Connector_Registry *connector_registry_;
+
+ /// Transport cache.
+ TAO::Transport_Cache_Manager *transport_cache_;
+
+ /// The leader/followers management class for this lane.
+ TAO_Leader_Follower *leader_follower_;
+
+ /// Synchronization.
+ TAO_SYNCH_MUTEX lock_;
+
+ /// Generator of new leader threads.
+ TAO_New_Leader_Generator *new_leader_generator_;
+
+ /// @name The allocators for the input CDR streams.
+ //@{
+ ACE_Allocator *input_cdr_dblock_allocator_;
+ ACE_Allocator *input_cdr_buffer_allocator_;
+ ACE_Allocator *input_cdr_msgblock_allocator_;
+ //@}
+
+ /// @name The allocators for the buffering messages in the transport.
+ //@{
+ ACE_Allocator *transport_message_buffer_allocator_;
+ //@}
+
+ /// @name The allocators for the output CDR streams.
+ //@{
+ ACE_Allocator *output_cdr_dblock_allocator_;
+ ACE_Allocator *output_cdr_buffer_allocator_;
+ ACE_Allocator *output_cdr_msgblock_allocator_;
+ //@}
+
+ /// @name The allocators for AMH.
+ //@{
+ ACE_Allocator *amh_response_handler_allocator_;
+ //@}
+
+ /// @name The allocators for AMI.
+ //@{
+ ACE_Allocator *ami_response_handler_allocator_;
+ //@}
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_THREAD_LANE_RESOURCES_H */
diff --git a/TAO/tao/Thread_Lane_Resources_Manager.cpp b/TAO/tao/Thread_Lane_Resources_Manager.cpp
new file mode 100644
index 00000000000..8a3465d2648
--- /dev/null
+++ b/TAO/tao/Thread_Lane_Resources_Manager.cpp
@@ -0,0 +1,38 @@
+// $Id$
+
+#include "tao/Thread_Lane_Resources_Manager.h"
+#include "tao/ORB_Core.h"
+#include "tao/LF_Strategy.h"
+
+#include "ace/Dynamic_Service.h"
+
+ACE_RCSID (tao,
+ Thread_Lane_Resources_Manager,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Thread_Lane_Resources_Manager::TAO_Thread_Lane_Resources_Manager (TAO_ORB_Core &orb_core)
+ : orb_core_ (&orb_core),
+ lf_strategy_ (0)
+{
+ this->lf_strategy_ =
+ this->orb_core_->resource_factory ()->create_lf_strategy ();
+}
+
+TAO_Thread_Lane_Resources_Manager::~TAO_Thread_Lane_Resources_Manager (void)
+{
+ delete this->lf_strategy_;
+}
+
+TAO_LF_Strategy &
+TAO_Thread_Lane_Resources_Manager::lf_strategy (void)
+{
+ return *this->lf_strategy_;
+}
+
+TAO_Thread_Lane_Resources_Manager_Factory::~TAO_Thread_Lane_Resources_Manager_Factory (void)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Thread_Lane_Resources_Manager.h b/TAO/tao/Thread_Lane_Resources_Manager.h
new file mode 100644
index 00000000000..e0637fbd23f
--- /dev/null
+++ b/TAO/tao/Thread_Lane_Resources_Manager.h
@@ -0,0 +1,120 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Thread_Lane_Resources_Manager.h
+ *
+ * $Id$
+ *
+ * @author Irfan Pyarali
+ */
+// ============================================================================
+
+#ifndef TAO_THREAD_LANE_RESOURCES_MANAGER_H
+#define TAO_THREAD_LANE_RESOURCES_MANAGER_H
+
+#include /**/ "ace/pre.h"
+#include "ace/CORBA_macros.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/Service_Object.h"
+
+#include "tao/TAO_Export.h"
+#include "tao/Versioned_Namespace.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_ORB_Core;
+class TAO_Thread_Lane_Resources;
+class TAO_LF_Strategy;
+class TAO_MProfile;
+
+namespace CORBA
+{
+ class Environment;
+}
+
+/**
+ * @class TAO_Thread_Lane_Resources_Manager
+ *
+ * @brief This class is a manager for thread resources.
+ *
+ * \nosubgrouping
+ *
+ **/
+class TAO_Export TAO_Thread_Lane_Resources_Manager
+{
+public:
+
+ /// Constructor.
+ TAO_Thread_Lane_Resources_Manager (TAO_ORB_Core &orb_core);
+
+ /// Destructor.
+ virtual ~TAO_Thread_Lane_Resources_Manager (void);
+
+ /// Finalize resources.
+ virtual void finalize (void) = 0;
+
+ /// Open default resources.
+ virtual int open_default_resources (ACE_ENV_SINGLE_ARG_DECL) = 0;
+
+ /// Shutdown reactor.
+ virtual void shutdown_reactor (void) = 0;
+
+ /// Cleanup transports that use the RW strategy since there are no
+ /// ways to wake threads up waiting on those sockets.
+ virtual void cleanup_rw_transports (void) = 0;
+
+ /// Does @a mprofile belong to us?
+ virtual int is_collocated (const TAO_MProfile& mprofile) = 0;
+
+ /// @name Accessors
+ // @{
+
+ virtual TAO_Thread_Lane_Resources &lane_resources (void) = 0;
+
+ virtual TAO_Thread_Lane_Resources &default_lane_resources (void) = 0;
+
+ TAO_LF_Strategy &lf_strategy (void);
+
+ // @}
+
+protected:
+ /// The ORB Core.
+ TAO_ORB_Core * const orb_core_;
+
+ /// The leader follower strategy
+ TAO_LF_Strategy *lf_strategy_;
+};
+
+/**
+ * @class TAO_Thread_Lane_Resources_Manager_Factory
+ *
+ * @brief This class is a factory for managers of thread resources.
+ *
+ * \nosubgrouping
+ *
+ **/
+class TAO_Export TAO_Thread_Lane_Resources_Manager_Factory
+ : public ACE_Service_Object
+{
+public:
+
+ /// Virtual destructor.
+ virtual ~TAO_Thread_Lane_Resources_Manager_Factory (void);
+
+ /// Factory method.
+ virtual TAO_Thread_Lane_Resources_Manager *
+ create_thread_lane_resources_manager (TAO_ORB_Core &core) = 0;
+
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_THREAD_LANE_RESOURCES_MANAGER_H */
diff --git a/TAO/tao/Thread_Per_Connection_Handler.cpp b/TAO/tao/Thread_Per_Connection_Handler.cpp
new file mode 100644
index 00000000000..9cf61f3bfc2
--- /dev/null
+++ b/TAO/tao/Thread_Per_Connection_Handler.cpp
@@ -0,0 +1,87 @@
+//$Id$
+#include "tao/Thread_Per_Connection_Handler.h"
+#include "tao/Connection_Handler.h"
+#include "tao/debug.h"
+#include "tao/Transport.h"
+#include "tao/ORB_Core.h"
+#include "ace/Flag_Manip.h"
+
+ACE_RCSID (tao,
+ Thread_Per_Connection_Handler,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Thread_Per_Connection_Handler::TAO_Thread_Per_Connection_Handler (
+ TAO_Connection_Handler *ch,
+ TAO_ORB_Core *oc)
+ : TAO_TPC_BASE (oc->thr_mgr ())
+ , ch_ (ch)
+{
+ this->ch_->transport ()->add_reference ();
+}
+
+TAO_Thread_Per_Connection_Handler::~TAO_Thread_Per_Connection_Handler (void)
+{
+ this->ch_->close_connection ();
+ this->ch_->transport ()->remove_reference ();
+}
+
+int
+TAO_Thread_Per_Connection_Handler::activate (long flags,
+ int n_threads,
+ int force_active,
+ long priority,
+ int grp_id,
+ ACE_Task_Base *task,
+ ACE_hthread_t thread_handles[],
+ void *stack[],
+ size_t stack_size[],
+ ACE_thread_t thread_names[])
+{
+ if (TAO_debug_level)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - Thread_Per_Connection_Handler::")
+ ACE_TEXT ("activate %d threads, flags = %d\n"),
+ n_threads,
+ flags));
+ }
+
+ return TAO_TPC_BASE::activate (flags,
+ n_threads,
+ force_active,
+ priority,
+ grp_id,
+ task,
+ thread_handles,
+ stack,
+ stack_size,
+ thread_names);
+}
+
+int
+TAO_Thread_Per_Connection_Handler::svc (void)
+{
+ ACE::clr_flags (this->ch_->transport ()->event_handler_i ()->get_handle (),
+ ACE_NONBLOCK);
+
+ // Call the implementation here
+ return this->ch_->svc_i ();
+}
+
+int
+TAO_Thread_Per_Connection_Handler::open (void*v)
+{
+ return this->ch_->open_handler (v);
+}
+
+int
+TAO_Thread_Per_Connection_Handler::close (u_long)
+{
+ delete this;
+
+ return 0;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Thread_Per_Connection_Handler.h b/TAO/tao/Thread_Per_Connection_Handler.h
new file mode 100644
index 00000000000..cf51317e646
--- /dev/null
+++ b/TAO/tao/Thread_Per_Connection_Handler.h
@@ -0,0 +1,87 @@
+//x -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Thread_Per_Connection_Handler.h
+ *
+ * $Id$
+ *
+ * Definition of a connection handler for the thread-per-connection
+ * strategy.
+ *
+ * @author Balachandran Natarajan <bala@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_THREAD_PER_CONNECTION_HANDLER_H
+#define TAO_THREAD_PER_CONNECTION_HANDLER_H
+
+#include /**/ "ace/pre.h"
+#include "ace/Task_T.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/TAO_Export.h"
+#include "tao/Versioned_Namespace.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Connection_Handler;
+class TAO_ORB_Core;
+
+typedef ACE_Task<ACE_NULL_SYNCH> TAO_TPC_BASE;
+
+/**
+ * @class TAO_Thread_Per_Connection_Handler
+ *
+ * @brief Definition for the thread-per-connection strategy.
+ *
+ * This object acts as an active object, encapsulating the protocol
+ * specific handler which the active thread uses to process incoming
+ * messages.
+ *
+ */
+class TAO_Export TAO_Thread_Per_Connection_Handler : public TAO_TPC_BASE
+{
+public:
+ TAO_Thread_Per_Connection_Handler (TAO_Connection_Handler *ch,
+ TAO_ORB_Core *oc);
+
+ ~TAO_Thread_Per_Connection_Handler (void);
+
+ /// = Active object activation method.
+ /**
+ * @todo This probably needs to go after x.4.1
+ */
+ virtual int activate (long flags = THR_NEW_LWP,
+ int n_threads = 1,
+ int force_active = 0,
+ long priority = ACE_DEFAULT_THREAD_PRIORITY,
+ int grp_id = -1,
+ ACE_Task_Base *task = 0,
+ ACE_hthread_t thread_handles[] = 0,
+ void *stack[] = 0,
+ size_t stack_size[] = 0,
+ ACE_thread_t thread_names[] = 0);
+
+ /// Template hook method that the thread uses...
+ /**
+ * Please see the documentation in ace/Task.h for details.
+ */
+ virtual int svc (void);
+ virtual int open (void *);
+ virtual int close (u_long);
+
+private:
+ /// Pointer to protocsol specific code that does the bunch of the
+ /// job.
+ TAO_Connection_Handler *ch_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /*TAO_THREAD_PER_CONNECTION_HANDLER_H*/
diff --git a/TAO/tao/TimeBase.pidl b/TAO/tao/TimeBase.pidl
new file mode 100644
index 00000000000..da4c27139c4
--- /dev/null
+++ b/TAO/tao/TimeBase.pidl
@@ -0,0 +1,96 @@
+// -*- IDL -*-
+
+//=============================================================================
+/**
+ * @file TimeBase.pidl
+ *
+ * $Id$
+ *
+ * This file was used to generate the code in TimeBase{C,S,S_T}.{h,i,cpp}
+ *
+ * The command used to generate code from this file is:
+ *
+ * tao_idl.exe
+ * -o orig -Ge 1 -GA -SS -Sci
+ * -Wb,export_macro=TAO_Export
+ * -Wb,export_include=tao/TAO_Export.h
+ * -Wb,pre_include="ace/pre.h"
+ * -Wb,post_include="ace/post.h"
+ * TimeBase.pidl
+ *
+ * After that the files are ready for use
+ */
+//=============================================================================
+
+#ifndef TIME_BASE_PIDL
+#define TIME_BASE_PIDL
+
+#pragma prefix "omg.org"
+
+/**
+ * @brief COS Time Service basic types.
+ *
+ *
+ * The standard CORBA Time Service defines a number of data structures
+ * to manipulate and express time.
+ * Over time these data structures have found their way into core
+ * components of CORBA, such as CORBA Messaging, RT CORBA, etc.
+ *
+ */
+module TimeBase
+{
+ /// Time in TimeT is expressed in units of 100 nano seconds
+ /**
+ * In other words each TimeT is 10^-7 seconds.
+ * When used for absolute time 0 is to October 15, 1582. Please read
+ * the spec for further details.
+ */
+ typedef unsigned long long TimeT;
+
+ /// To express an error estimate for time.
+ typedef TimeT InaccuracyT;
+
+ /// Minutes of displacement from the Greenwich time.
+ typedef short TdfT;
+
+ /**
+ * @brief A timestamp in UTC time
+ *
+ * The inaccuracy is packed into inacclo & inacchi.
+ * tdf holds the time displacement factor.
+ *
+ * There are a total of 16 octets in this struct.
+ *
+ * @todo What is exactly the range of time here?
+ * Is it [time-inacclo,time+inacchi]?
+ */
+ struct UtcT
+ {
+ /// The actual time
+ TimeT time;
+
+ /// The lowest bound for innacuracy
+ unsigned long inacclo;
+
+ /// The upper bound for the innacuracy
+ unsigned short inacchi;
+
+ /// @todo please document
+ TdfT tdf;
+ };
+
+ /**
+ * @brief An UTC time interval
+ *
+ */
+ struct IntervalT
+ {
+ /// Lower bound of the interval.
+ TimeT lower_bound;
+
+ /// Upper bound of the interval.
+ TimeT upper_bound;
+ };
+};
+
+#endif /* TIME_BASE_PIDL */
diff --git a/TAO/tao/Timeprobe.h b/TAO/tao/Timeprobe.h
new file mode 100644
index 00000000000..4d6efb6ad8b
--- /dev/null
+++ b/TAO/tao/Timeprobe.h
@@ -0,0 +1,100 @@
+
+//=============================================================================
+/**
+ * @file Timeprobe.h
+ *
+ * $Id$
+ *
+ * @author Irfan Pyarali <irfan@cs.wustl.edu>
+ */
+//=============================================================================
+
+
+#ifndef TAO_TIMEPROBE_H
+#define TAO_TIMEPROBE_H
+#include /**/ "ace/pre.h"
+
+#include "ace/config-all.h"
+
+// Please see ace/Timeprobe.h for details on these #defines.
+
+// #define TAO_ENABLE_TIMEPROBES
+// #define TAO_MT_TIMEPROBES
+// #define TAO_TSS_TIMEPROBES
+
+#if defined (TAO_ENABLE_TIMEPROBES)
+#define ACE_ENABLE_TIMEPROBES
+#endif /* TAO_ENABLE_TIMEPROBES */
+
+#if defined (TAO_MT_TIMEPROBES)
+#define ACE_MT_TIMEPROBES
+#endif /* TAO_MT_TIMEPROBES */
+
+#if defined (TAO_TSS_TIMEPROBES)
+#define ACE_TSS_TIMEPROBES
+#endif /* TAO_TSS_TIMEPROBES */
+
+#include "ace/Timeprobe.h"
+
+// The macro for turning off all timeprobes except
+// the ones that are pertinent to pluggable protocols.
+//#define TAO_SELECT_PP_TIMEPROBES
+
+// The macro for turning off all timeprobes except
+// four - 2 to measure client send time and 2 to measure
+// server upcall processing and return time.
+// NOTE: If both this and the pluggable protocols macro
+// above are defined, code below will undefine this macro.
+// They should not both be defined at the same time.
+//#define TAO_SELECT_MINIMAL_TIMEPROBES
+
+
+#if defined (ACE_ENABLE_TIMEPROBES)
+
+# define TAO_PP_TIMEPROBE(id) \
+ ACE_TIMEPROBE_SINGLETON::instance ()->timeprobe (id)
+# define TAO_FUNCTION_PP_TIMEPROBE(X) \
+ ACE_Function_Timeprobe<ACE_TIMEPROBE_WITH_LOCKING> \
+ function_timeprobe (*ACE_TIMEPROBE_SINGLETON::instance (), X)
+# define TAO_MINIMAL_TIMEPROBE(id)
+
+# if defined (TAO_SELECT_PP_TIMEPROBES)
+# if defined TAO_SELECT_MINIMAL_TIMEPROBES
+# undef TAO_SELECT_MINIMIAL_TIMEPROBES
+# endif /* TAO_SELECT_MINIMAL_TIMEPROBES */
+# undef ACE_TIMEPROBE
+# define ACE_TIMEPROBE(id)
+# undef ACE_FUNCTION_TIMEPROBE
+# define ACE_FUNCTION_TIMEPROBE(X)
+# define TAO_MINIMAL_TIMEPROBE(id)
+# endif /* TAO_SELECT_PP_TIMEPROBES */
+
+# if defined (TAO_SELECT_MINIMAL_TIMEPROBES)
+# undef TAO_MINIMAL_TIMEPROBE
+# define TAO_MINIMAL_TIMEPROBE(id) \
+ ACE_TIMEPROBE_SINGLETON::instance ()->timeprobe (id)
+# undef ACE_TIMEPROBE
+# define ACE_TIMEPROBE(id)
+# undef ACE_FUNCTION_TIMEPROBE
+# define ACE_FUNCTION_TIMEPROBE(X)
+# undef TAO_PP_TIMEPROBE
+# define TAO_PP_TIMEPROBE(id)
+# undef TAO_FUNCTION_PP_TIMEPROBE
+# define TAO_FUNCTION_PP_TIMEPROBE(X)
+# endif /* TAO_SELECT_MINIMAL_TIMEPROBES */
+
+#else /* ACE_ENABLE_TIMEPROBES */
+
+# define TAO_PP_TIMEPROBE(id)
+# define TAO_FUNCTION_PP_TIMEPROBE(X)
+# define TAO_MINIMAL_TIMEPROBE(id)
+
+#endif /* ACE_ENABLE_TIMEPROBES */
+
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_TIMEPROBE_H */
diff --git a/TAO/tao/TkResource.mpc b/TAO/tao/TkResource.mpc
new file mode 100644
index 00000000000..b658cc67f83
--- /dev/null
+++ b/TAO/tao/TkResource.mpc
@@ -0,0 +1,31 @@
+// -*- MPC -*- now wouldn't this be cool...
+// $Id$
+
+project(TAO_TkResource) : acelib, taolib, core, tao_output, taodefaults, ace_tkreactor, tao_versioning_idl_defaults {
+
+ sharedname = TAO_TkResource
+ dynamicflags += TAO_TKRESOURCE_BUILD_DLL
+
+ Source_Files {
+ TkResource
+ }
+
+ Header_Files {
+ TkResource
+ }
+
+ Inline_Files {
+ }
+
+ Template_Files {
+ }
+
+ Resource_Files {
+ }
+
+ PIDL_Files {
+ }
+
+ IDL_Files {
+ }
+}
diff --git a/TAO/tao/TkResource/TAO_TkResource_Export.h b/TAO/tao/TkResource/TAO_TkResource_Export.h
new file mode 100644
index 00000000000..34904a6d9af
--- /dev/null
+++ b/TAO/tao/TkResource/TAO_TkResource_Export.h
@@ -0,0 +1,58 @@
+
+// -*- C++ -*-
+// $Id$
+// Definition for Win32 Export directives.
+// This file is generated automatically by generate_export_file.pl -s TAO_TkResource
+// ------------------------------
+#ifndef TAO_TKRESOURCE_EXPORT_H
+#define TAO_TKRESOURCE_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if defined (ACE_AS_STATIC_LIBS) && !defined (TAO_TKRESOURCE_HAS_DLL)
+# define TAO_TKRESOURCE_HAS_DLL 0
+#endif /* ACE_AS_STATIC_LIBS && TAO_TKRESOURCE_HAS_DLL */
+
+#if !defined (TAO_TKRESOURCE_HAS_DLL)
+# define TAO_TKRESOURCE_HAS_DLL 1
+#endif /* ! TAO_TKRESOURCE_HAS_DLL */
+
+#if defined (TAO_TKRESOURCE_HAS_DLL) && (TAO_TKRESOURCE_HAS_DLL == 1)
+# if defined (TAO_TKRESOURCE_BUILD_DLL)
+# define TAO_TkResource_Export ACE_Proper_Export_Flag
+# define TAO_TKRESOURCE_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# define TAO_TKRESOURCE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# else /* TAO_TKRESOURCE_BUILD_DLL */
+# define TAO_TkResource_Export ACE_Proper_Import_Flag
+# define TAO_TKRESOURCE_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# define TAO_TKRESOURCE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# endif /* TAO_TKRESOURCE_BUILD_DLL */
+#else /* TAO_TKRESOURCE_HAS_DLL == 1 */
+# define TAO_TkResource_Export
+# define TAO_TKRESOURCE_SINGLETON_DECLARATION(T)
+# define TAO_TKRESOURCE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+#endif /* TAO_TKRESOURCE_HAS_DLL == 1 */
+
+// Set TAO_TKRESOURCE_NTRACE = 0 to turn on library specific tracing even if
+// tracing is turned off for ACE.
+#if !defined (TAO_TKRESOURCE_NTRACE)
+# if (ACE_NTRACE == 1)
+# define TAO_TKRESOURCE_NTRACE 1
+# else /* (ACE_NTRACE == 1) */
+# define TAO_TKRESOURCE_NTRACE 0
+# endif /* (ACE_NTRACE == 1) */
+#endif /* !TAO_TKRESOURCE_NTRACE */
+
+#if (TAO_TKRESOURCE_NTRACE == 1)
+# define TAO_TKRESOURCE_TRACE(X)
+#else /* (TAO_TKRESOURCE_NTRACE == 1) */
+# if !defined (ACE_HAS_TRACE)
+# define ACE_HAS_TRACE
+# endif /* ACE_HAS_TRACE */
+# define TAO_TKRESOURCE_TRACE(X) ACE_TRACE_IMPL(X)
+# include "ace/Trace.h"
+#endif /* (TAO_TKRESOURCE_NTRACE == 1) */
+
+#endif /* TAO_TKRESOURCE_EXPORT_H */
+
+// End of auto generated file.
diff --git a/TAO/tao/TkResource/TkResource_Factory.cpp b/TAO/tao/TkResource/TkResource_Factory.cpp
new file mode 100644
index 00000000000..622a0fb45cf
--- /dev/null
+++ b/TAO/tao/TkResource/TkResource_Factory.cpp
@@ -0,0 +1,41 @@
+//$Id$
+
+#include "tao/TkResource/TkResource_Factory.h"
+#include "tao/debug.h"
+#include "ace/TkReactor.h"
+
+ACE_RCSID( TAO_TkResource,
+ TkResource_Factory,
+ "$Id$");
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+
+ TkResource_Factory::TkResource_Factory (void)
+ : reactor_impl_ (0)
+ {
+ }
+
+ ACE_Reactor_Impl *
+ TkResource_Factory::reactor_impl (void)
+ {
+ // synchronized by external locks
+ if (!this->reactor_impl_)
+ {
+ ACE_NEW_RETURN (this->reactor_impl_,
+ ACE_TkReactor (),
+ 0);
+
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - ACE_TkReactor created \n"));
+ }
+
+ return this->reactor_impl_;
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/TkResource/TkResource_Factory.h b/TAO/tao/TkResource/TkResource_Factory.h
new file mode 100644
index 00000000000..f4aab08db60
--- /dev/null
+++ b/TAO/tao/TkResource/TkResource_Factory.h
@@ -0,0 +1,64 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file TkResource_Factory.h
+ *
+ * $Id$
+ *
+ * @author Balachandran Natarajan <bala@cs.wustl.edu>
+ * @author Marek Brudka <mbrudka@aster.pl>
+ */
+//=============================================================================
+#ifndef TAO_TKRESOURCE_FACTORY_H
+#define TAO_TKRESOURCE_FACTORY_H
+#include /**/ "ace/pre.h"
+#include "ace/TkReactor.h"
+#include "tao/TkResource/TAO_TkResource_Export.h"
+#include "tao/GUIResource_Factory.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+
+ /**
+ * @class TkResource_Factory
+ *
+ * @brief TAO_GUI_Resource_Factory for creating TkReactor.
+ *
+ * This factory is intended for creating TkReactor for ORB. This
+ * factory can be feed into ORB using
+ * TAO_ORB_Core::set_gui_resource_factory method which is usually
+ * done by TAO_TkResource_Loader.
+ */
+
+ class TAO_TkResource_Export TkResource_Factory : public GUIResource_Factory
+ {
+ public:
+
+ TkResource_Factory ();
+
+ protected:
+
+ /// Create or obtain current reactor implementation
+ virtual ACE_Reactor_Impl *reactor_impl (void);
+
+ private:
+
+ /// Reactor created by this factory.
+ ACE_TkReactor *reactor_impl_;
+
+ /// for internal locking.
+ TAO_SYNCH_MUTEX lock_;
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_TKRESOURCE_FACTORY_H */
diff --git a/TAO/tao/TkResource/TkResource_Loader.cpp b/TAO/tao/TkResource/TkResource_Loader.cpp
new file mode 100644
index 00000000000..cbe8fb79681
--- /dev/null
+++ b/TAO/tao/TkResource/TkResource_Loader.cpp
@@ -0,0 +1,31 @@
+//$Id$
+#include "tao/TkResource/TkResource_Loader.h"
+#include "tao/ORB_Core.h"
+#include "tao/TkResource/TkResource_Factory.h"
+
+ACE_RCSID( TAO_TkResource,
+ TkResource_Loader,
+ "$Id$");
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+
+ TkResource_Loader::TkResource_Loader (void)
+ {
+ TkResource_Factory *tmp = 0;
+
+ ACE_NEW (tmp,
+ TkResource_Factory ());
+
+ TAO_ORB_Core::set_gui_resource_factory( tmp );
+ }
+
+ TkResource_Loader::~TkResource_Loader (void)
+ {
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/TkResource/TkResource_Loader.h b/TAO/tao/TkResource/TkResource_Loader.h
new file mode 100644
index 00000000000..bdd3daeb0d2
--- /dev/null
+++ b/TAO/tao/TkResource/TkResource_Loader.h
@@ -0,0 +1,60 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file TkResource_Loader.h
+ *
+ * $Id$
+ *
+ * @author Balachandran Natarajan <bala@cs.wustl.edu>
+ * @author Marek Brudka <mbrudka@aster.pl>
+ */
+//=============================================================================
+
+#ifndef TAO_TKRESOURCE_LOADER_H
+#define TAO_TKRESOURCE_LOADER_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/TkResource/TAO_TkResource_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Versioned_Namespace.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ /**
+ * @class TkResource_Loader
+ *
+ * @brief Loads TAO resources related with Tk.
+ *
+ * This class changes the default reactor implementation into
+ * ACE_TkReactor one by calling TAO_ORB_Core::set_gui_resource_factory.
+ * User should create an instance of this class before ORB_init
+ * when the TAO server has has to be integrated within Tk event loop.
+ *
+ * Please notice, this class has to be created in the main Tk thread,
+ * because set_gui_resource_factory creates a variable in TSS. This way
+ * TkReactor is instantiated only in Tk event loop thread.
+ */
+ class TAO_TkResource_Export TkResource_Loader
+ {
+ public:
+
+ TkResource_Loader (void);
+
+ virtual ~TkResource_Loader (void);
+
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_TKRESOURCE_LOADER_H */
diff --git a/TAO/tao/Transport.cpp b/TAO/tao/Transport.cpp
new file mode 100644
index 00000000000..2fb6629f852
--- /dev/null
+++ b/TAO/tao/Transport.cpp
@@ -0,0 +1,2444 @@
+// $Id$
+
+#include "tao/Transport.h"
+
+#include "tao/LF_Follower.h"
+#include "tao/Leader_Follower.h"
+#include "tao/Client_Strategy_Factory.h"
+#include "tao/Wait_Strategy.h"
+#include "tao/Transport_Mux_Strategy.h"
+#include "tao/Stub.h"
+#include "tao/Transport_Queueing_Strategies.h"
+#include "tao/Connection_Handler.h"
+#include "tao/Pluggable_Messaging.h"
+#include "tao/Synch_Queued_Message.h"
+#include "tao/Asynch_Queued_Message.h"
+#include "tao/Flushing_Strategy.h"
+#include "tao/Thread_Lane_Resources.h"
+#include "tao/Resume_Handle.h"
+#include "tao/Codeset_Manager.h"
+#include "tao/Codeset_Translator_Base.h"
+#include "tao/debug.h"
+#include "tao/CDR.h"
+#include "tao/ORB_Core.h"
+#include "tao/MMAP_Allocator.h"
+
+#include "ace/OS_NS_sys_time.h"
+#include "ace/OS_NS_stdio.h"
+#include "ace/Reactor.h"
+#include "ace/os_include/sys/os_uio.h"
+
+/*
+ * Specialization hook to add include files from
+ * concrete transport implementation.
+ */
+//@@ TAO_TRANSPORT_SPL_INCLUDE_FORWARD_DECL_ADD_HOOK
+
+#if !defined (__ACE_INLINE__)
+# include "tao/Transport.inl"
+#endif /* __ACE_INLINE__ */
+
+
+ACE_RCSID (tao,
+ Transport,
+ "$Id$")
+
+/*
+ * Static function in file scope
+ */
+static void
+dump_iov (iovec *iov, int iovcnt, size_t id,
+ size_t current_transfer,
+ const char *location)
+{
+ ACE_Log_Msg::instance ()->acquire ();
+
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - Transport[%d]::%s, ")
+ ACE_TEXT ("sending %d buffers\n"),
+ id, ACE_TEXT_CHAR_TO_TCHAR (location), iovcnt));
+
+ for (int i = 0; i != iovcnt && 0 < current_transfer; ++i)
+ {
+ size_t iov_len = iov[i].iov_len;
+
+ // Possibly a partially sent iovec entry.
+ if (current_transfer < iov_len)
+ {
+ iov_len = current_transfer;
+ }
+
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - Transport[%d]::%s, ")
+ ACE_TEXT ("buffer %d/%d has %d bytes\n"),
+ id, ACE_TEXT_CHAR_TO_TCHAR(location),
+ i, iovcnt,
+ iov_len));
+
+ size_t len;
+
+ for (size_t offset = 0; offset < iov_len; offset += len)
+ {
+ ACE_TCHAR header[1024];
+ ACE_OS::sprintf (header,
+ ACE_TEXT("TAO - ")
+ ACE_TEXT("Transport[")
+ ACE_SIZE_T_FORMAT_SPECIFIER
+ ACE_TEXT("]::%s")
+ ACE_TEXT(" (")
+ ACE_SIZE_T_FORMAT_SPECIFIER ACE_TEXT("/")
+ ACE_SIZE_T_FORMAT_SPECIFIER ACE_TEXT(")"),
+ id, location, offset, iov_len);
+
+ len = iov_len - offset;
+
+ if (len > 512)
+ {
+ len = 512;
+ }
+
+ ACE_HEX_DUMP ((LM_DEBUG,
+ static_cast<char*> (iov[i].iov_base) + offset,
+ len,
+ header));
+ }
+ current_transfer -= iov_len;
+ }
+
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - Transport[%d]::%s, ")
+ ACE_TEXT ("end of data\n"),
+ id, ACE_TEXT_CHAR_TO_TCHAR(location)));
+
+ ACE_Log_Msg::instance ()->release ();
+}
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Transport::TAO_Transport (CORBA::ULong tag,
+ TAO_ORB_Core *orb_core)
+ : tag_ (tag)
+ , orb_core_ (orb_core)
+ , cache_map_entry_ (0)
+ , bidirectional_flag_ (-1)
+ , opening_connection_role_ (TAO::TAO_UNSPECIFIED_ROLE)
+ , head_ (0)
+ , tail_ (0)
+ , incoming_message_queue_ (orb_core)
+ , current_deadline_ (ACE_Time_Value::zero)
+ , flush_timer_id_ (-1)
+ , transport_timer_ (this)
+ , handler_lock_ (orb_core->resource_factory ()->create_cached_connection_lock ())
+ , id_ ((size_t) this)
+ , purging_order_ (0)
+ , recv_buffer_size_ (0)
+ , sent_byte_count_ (0)
+ , is_connected_ (false)
+ , char_translator_ (0)
+ , wchar_translator_ (0)
+ , tcs_set_ (0)
+ , first_request_ (1)
+ , partial_message_ (0)
+#ifdef ACE_HAS_SENDFILE
+ // The ORB has been configured to use the MMAP allocator, meaning
+ // we could/should use sendfile() to send data. Cast once rather
+ // here rather than during each send. This assumes that all
+ // TAO_OutputCDR instances are using the same TAO_MMAP_Allocator
+ // instance as the underlying output CDR buffer allocator.
+ , mmap_allocator_ (
+ dynamic_cast<TAO_MMAP_Allocator *> (
+ orb_core->output_cdr_buffer_allocator ()))
+#endif /* ACE_HAS_SENDFILE */
+{
+ TAO_Client_Strategy_Factory *cf =
+ this->orb_core_->client_factory ();
+
+ // Create WS now.
+ this->ws_ = cf->create_wait_strategy (this);
+
+ // Create TMS now.
+ this->tms_ = cf->create_transport_mux_strategy (this);
+
+ /*
+ * Hook to add code that initializes components that
+ * belong to the concrete protocol implementation.
+ * Further additions to this Transport class will
+ * need to add code *before* this hook.
+ */
+ //@@ TAO_TRANSPORT_SPL_CONSTRUCTOR_ADD_HOOK
+}
+
+TAO_Transport::~TAO_Transport (void)
+{
+ delete this->ws_;
+
+ delete this->tms_;
+
+ delete this->handler_lock_;
+
+ if (!this->is_connected_)
+ {
+ // When we have a not connected transport we could have buffered
+ // messages on this transport which we have to cleanup now.
+ this->cleanup_queue_i();
+
+ // Cleanup our cache entry
+ this->purge_entry();
+ }
+
+ // Release the partial message block, however we may
+ // have never allocated one.
+ ACE_Message_Block::release (this->partial_message_);
+
+ // By the time the destructor is reached here all the connection stuff
+ // *must* have been cleaned up.
+
+ // The following assert is needed for the test "Bug_2494_Regression".
+ // See the bugzilla bug #2494 for details.
+ ACE_ASSERT (this->head_ == 0);
+ ACE_ASSERT (this->cache_map_entry_ == 0);
+
+ /*
+ * Hook to add code that cleans up components
+ * belong to the concrete protocol implementation.
+ * Further additions to this Transport class will
+ * need to add code *before* this hook.
+ */
+ //@@ TAO_TRANSPORT_SPL_DESTRUCTOR_ADD_HOOK
+}
+
+void
+TAO_Transport::provide_handler (TAO::Connection_Handler_Set &handlers)
+{
+ (void) this->add_reference ();
+
+ handlers.insert (this->connection_handler_i ());
+}
+
+bool
+TAO_Transport::provide_blockable_handler (TAO::Connection_Handler_Set &h)
+{
+ if (this->ws_->non_blocking () ||
+ this->opening_connection_role_ == TAO::TAO_SERVER_ROLE)
+ return false;
+
+ (void) this->add_reference ();
+
+ h.insert (this->connection_handler_i ());
+
+ return true;
+}
+
+bool
+TAO_Transport::idle_after_send (void)
+{
+ return this->tms ()->idle_after_send ();
+}
+
+bool
+TAO_Transport::idle_after_reply (void)
+{
+ return this->tms ()->idle_after_reply ();
+}
+
+/*
+ * A concrete transport class specializes this
+ * method. This hook allows commenting this function
+ * when TAO's transport is specialized. Note: All
+ * functions that have an implementation that does
+ * nothing should be added within this hook to
+ * enable specialization.
+ */
+//@@ TAO_TRANSPORT_SPL_COMMENT_HOOK_START
+
+int
+TAO_Transport::tear_listen_point_list (TAO_InputCDR &)
+{
+ ACE_NOTSUP_RETURN (-1);
+}
+
+int
+TAO_Transport::send_message_shared (TAO_Stub *stub,
+ int message_semantics,
+ const ACE_Message_Block *message_block,
+ ACE_Time_Value *max_wait_time)
+{
+ int result = 0;
+
+ {
+ ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->handler_lock_, -1);
+
+ result =
+ this->send_message_shared_i (stub, message_semantics,
+ message_block, max_wait_time);
+ }
+
+ if (result == -1)
+ {
+ this->close_connection ();
+ }
+
+ return result;
+}
+
+//@@ TAO_TRANSPORT_SPL_COMMENT_HOOK_END
+
+bool
+TAO_Transport::post_connect_hook (void)
+{
+ return true;
+}
+
+void
+TAO_Transport::close_connection (void)
+{
+ this->connection_handler_i ()->close_connection ();
+}
+
+int
+TAO_Transport::register_handler (void)
+{
+ if (TAO_debug_level > 4)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - Transport[%d]::register_handler\n"),
+ this->id ()));
+ }
+
+ ACE_Reactor * const r = this->orb_core_->reactor ();
+
+ // @@note: This should be okay since the register handler call will
+ // not make a nested call into the transport.
+ ACE_GUARD_RETURN (ACE_Lock,
+ ace_mon,
+ *this->handler_lock_,
+ false);
+
+ if (r == this->event_handler_i ()->reactor ())
+ {
+ return 0;
+ }
+
+ // Set the flag in the Connection Handler and in the Wait Strategy
+ // @@Maybe we should set these flags after registering with the
+ // reactor. What if the registration fails???
+ this->ws_->is_registered (true);
+
+ // Register the handler with the reactor
+ return r->register_handler (this->event_handler_i (),
+ ACE_Event_Handler::READ_MASK);
+}
+
+#ifdef ACE_HAS_SENDFILE
+ssize_t
+TAO_Transport::sendfile (TAO_MMAP_Allocator * /* allocator */,
+ iovec * iov,
+ int iovcnt,
+ size_t &bytes_transferred,
+ ACE_Time_Value const * timeout)
+{
+ // Concrete pluggable transport doesn't implement sendfile().
+ // Fallback on TAO_Transport::send().
+
+ // @@ We can probably refactor the TAO_IIOP_Transport::sendfile()
+ // implementation to this base class method, and leave any TCP
+ // specific configuration out of this base class method.
+ // -Ossama
+ return this->send (iov, iovcnt, bytes_transferred, timeout);
+}
+#endif /* ACE_HAS_SENDFILE */
+
+int
+TAO_Transport::generate_locate_request (
+ TAO_Target_Specification &spec,
+ TAO_Operation_Details &opdetails,
+ TAO_OutputCDR &output)
+{
+ if (this->messaging_object ()->generate_locate_request_header (opdetails,
+ spec,
+ output)
+ == -1)
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - Transport[%d]::generate_locate_request, ")
+ ACE_TEXT ("error while marshalling the LocateRequest header\n"),
+ this->id ()));
+ }
+
+ return -1;
+ }
+
+ return 0;
+}
+
+int
+TAO_Transport::generate_request_header (
+ TAO_Operation_Details &opdetails,
+ TAO_Target_Specification &spec,
+ TAO_OutputCDR &output)
+{
+ // codeset service context is only supposed to be sent in the first request
+ // on a particular connection.
+ if (this->first_request_)
+ {
+ TAO_Codeset_Manager * const csm = this->orb_core ()->codeset_manager ();
+ if (csm)
+ csm->generate_service_context (opdetails,*this);
+ }
+
+ if (this->messaging_object ()->generate_request_header (opdetails,
+ spec,
+ output) == -1)
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("(%P|%t) - Transport[%d]::generate_request_header, ")
+ ACE_TEXT ("error while marshalling the Request header\n"),
+ this->id()));
+ }
+
+ return -1;
+ }
+
+ return 0;
+}
+
+/// @todo Ideally the following should be inline.
+/// @todo purge_entry has a return value, use it
+int
+TAO_Transport::recache_transport (TAO_Transport_Descriptor_Interface *desc)
+{
+ // First purge our entry
+ this->purge_entry ();
+
+ // Then add ourselves to the cache
+ return this->transport_cache_manager ().cache_transport (desc,
+ this);
+}
+
+int
+TAO_Transport::purge_entry (void)
+{
+ return this->transport_cache_manager ().purge_entry (this->cache_map_entry_);
+}
+
+int
+TAO_Transport::make_idle (void)
+{
+ if (TAO_debug_level > 3)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - Transport[%d]::make_idle\n"),
+ this->id ()));
+ }
+
+ return this->transport_cache_manager ().make_idle (this->cache_map_entry_);
+}
+
+int
+TAO_Transport::update_transport (void)
+{
+ return this->transport_cache_manager ().update_entry (this->cache_map_entry_);
+}
+
+/*
+ *
+ * Methods called and used in the output path of the ORB.
+ *
+ */
+int
+TAO_Transport::handle_output (void)
+{
+ if (TAO_debug_level > 3)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - Transport[%d]::handle_output\n"),
+ this->id ()));
+ }
+
+ // The flushing strategy (potentially via the Reactor) wants to send
+ // more data, first check if there is a current message that needs
+ // more sending...
+ int const retval = this->drain_queue ();
+
+ if (TAO_debug_level > 3)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - Transport[%d]::handle_output, ")
+ ACE_TEXT ("drain_queue returns %d/%d\n"),
+ this->id (),
+ retval, errno));
+ }
+
+ // Any errors are returned directly to the Reactor
+ return retval;
+}
+
+int
+TAO_Transport::format_queue_message (TAO_OutputCDR &stream)
+{
+ if (this->messaging_object ()->format_message (stream) != 0)
+ return -1;
+
+ return this->queue_message_i (stream.begin());
+}
+
+int
+TAO_Transport::send_message_block_chain (const ACE_Message_Block *mb,
+ size_t &bytes_transferred,
+ ACE_Time_Value *max_wait_time)
+{
+ ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->handler_lock_, -1);
+
+ return this->send_message_block_chain_i (mb,
+ bytes_transferred,
+ max_wait_time);
+}
+
+int
+TAO_Transport::send_message_block_chain_i (const ACE_Message_Block *mb,
+ size_t &bytes_transferred,
+ ACE_Time_Value *)
+{
+ size_t const total_length = mb->total_length ();
+
+ // We are going to block, so there is no need to clone
+ // the message block.
+ TAO_Synch_Queued_Message synch_message (mb,
+ this->orb_core_);
+
+ synch_message.push_back (this->head_, this->tail_);
+
+ int const n = this->drain_queue_i ();
+
+ if (n == -1)
+ {
+ synch_message.remove_from_list (this->head_, this->tail_);
+ return -1; // Error while sending...
+ }
+ else if (n == 1)
+ {
+ bytes_transferred = total_length;
+ return 1; // Empty queue, message was sent..
+ }
+
+ // Remove the temporary message from the queue...
+ synch_message.remove_from_list (this->head_, this->tail_);
+
+ bytes_transferred =
+ total_length - synch_message.message_length ();
+
+ return 0;
+}
+
+int
+TAO_Transport::send_synchronous_message_i (const ACE_Message_Block *mb,
+ ACE_Time_Value *max_wait_time)
+{
+ // We are going to block, so there is no need to clone
+ // the message block.
+ TAO_Synch_Queued_Message synch_message (mb, this->orb_core_);
+
+ // Push synch_message on to the back of the queue.
+ synch_message.push_back (this->head_, this->tail_);
+
+ int const n =
+ this->send_synch_message_helper_i (synch_message,
+ max_wait_time);
+
+ if (n == -1 || n == 1)
+ {
+ return n;
+ }
+
+ // @todo: Check for timeouts!
+ // if (max_wait_time != 0 && errno == ETIME) return -1;
+ TAO_Flushing_Strategy *flushing_strategy =
+ this->orb_core ()->flushing_strategy ();
+ (void) flushing_strategy->schedule_output (this);
+
+ // Release the mutex, other threads may modify the queue as we
+ // block for a long time writing out data.
+ int result;
+ {
+ typedef ACE_Reverse_Lock<ACE_Lock> TAO_REVERSE_LOCK;
+ TAO_REVERSE_LOCK reverse (*this->handler_lock_);
+ ACE_GUARD_RETURN (TAO_REVERSE_LOCK,
+ ace_mon,
+ reverse,
+ -1);
+
+ result = flushing_strategy->flush_message (this,
+ &synch_message,
+ max_wait_time);
+ }
+
+ if (result == -1)
+ {
+ synch_message.remove_from_list (this->head_, this->tail_);
+
+ if (errno == ETIME)
+ {
+ if (this->head_ == &synch_message)
+ {
+ // This is a timeout, there is only one nasty case: the
+ // message has been partially sent! We simply cannot take
+ // the message out of the queue, because that would corrupt
+ // the connection.
+ //
+ // What we do is replace the queued message with an
+ // asynchronous message, that contains only what remains of
+ // the timed out request. If you think about sending
+ // CancelRequests in this case: there is no much point in
+ // doing that: the receiving ORB would probably ignore it,
+ // and figuring out the request ID would be a bit of a
+ // nightmare.
+ //
+
+ synch_message.remove_from_list (this->head_, this->tail_);
+ TAO_Queued_Message *queued_message = 0;
+ ACE_NEW_RETURN (queued_message,
+ TAO_Asynch_Queued_Message (
+ synch_message.current_block (),
+ this->orb_core_,
+ 0,
+ 1),
+ -1);
+ queued_message->push_front (this->head_, this->tail_);
+ }
+ }
+
+ if (TAO_debug_level > 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) - Transport[%d]::send_synchronous_message_i, ")
+ ACE_TEXT ("error while flushing message - %m\n"),
+ this->id ()));
+ }
+
+ return -1;
+ }
+
+ return 1;
+}
+
+
+int
+TAO_Transport::send_reply_message_i (const ACE_Message_Block *mb,
+ ACE_Time_Value *max_wait_time)
+{
+ // Dont clone now.. We could be sent in one shot!
+ TAO_Synch_Queued_Message synch_message (mb, this->orb_core_);
+
+ synch_message.push_back (this->head_,
+ this->tail_);
+
+ int const n =
+ this->send_synch_message_helper_i (synch_message,
+ max_wait_time);
+
+ if (n == -1 || n == 1)
+ {
+ return n;
+ }
+
+ if (TAO_debug_level > 3)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - Transport[%d]::send_reply_message_i, ")
+ ACE_TEXT ("preparing to add to queue before leaving \n"),
+ this->id ()));
+ }
+
+ // Till this point we shouldn't have any copying and that is the
+ // point anyway. Now, remove the node from the list
+ synch_message.remove_from_list (this->head_,
+ this->tail_);
+
+ // Clone the node that we have.
+ TAO_Queued_Message *msg =
+ synch_message.clone (this->orb_core_->transport_message_buffer_allocator ());
+
+ // Stick it in the queue
+ msg->push_back (this->head_,
+ this->tail_);
+
+ TAO_Flushing_Strategy *flushing_strategy =
+ this->orb_core ()->flushing_strategy ();
+
+ int result = flushing_strategy->schedule_output (this);
+
+ if (result == -1)
+ {
+ if (TAO_debug_level > 5)
+ {
+ ACE_DEBUG ((LM_DEBUG, "TAO (%P|%t) - Transport[%d]::send_reply_"
+ "message_i dequeuing msg due to schedule_output "
+ "failure\n", this->id ()));
+ }
+ msg->remove_from_list (this->head_, this->tail_);
+ msg->destroy ();
+ }
+
+ return 1;
+}
+
+int
+TAO_Transport::send_synch_message_helper_i (TAO_Synch_Queued_Message &synch_message,
+ ACE_Time_Value * /*max_wait_time*/)
+{
+ // @@todo: Need to send timeouts for writing..
+ int const n = this->drain_queue_i ();
+
+ if (n == -1)
+ {
+ synch_message.remove_from_list (this->head_, this->tail_);
+ return -1; // Error while sending...
+ }
+ else if (n == 1)
+ {
+ return 1; // Empty queue, message was sent..
+ }
+
+ if (synch_message.all_data_sent ())
+ {
+ return 1;
+ }
+
+ return 0;
+}
+
+int
+TAO_Transport::queue_is_empty_i (void)
+{
+ return (this->head_ == 0);
+}
+
+
+int
+TAO_Transport::schedule_output_i (void)
+{
+ ACE_Event_Handler *eh = this->event_handler_i ();
+ ACE_Reactor *reactor = eh->reactor ();
+
+ // Check to see if our event handler is still registered with the
+ // reactor. It's possible for another thread to have run close_connection()
+ // since we last used the event handler.
+ ACE_Event_Handler * const found = reactor->find_handler (eh->get_handle ());
+ if (found != eh)
+ {
+ if(TAO_debug_level > 3)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - Transport[%d]::schedule_output_i "
+ "event handler not found in reactor, returning -1\n",
+ this->id ()));
+ }
+ if (found)
+ {
+ found->remove_reference ();
+ }
+ return -1;
+ }
+ found->remove_reference ();
+
+ if (TAO_debug_level > 3)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - Transport[%d]::schedule_output_i\n"),
+ this->id ()));
+ }
+
+ return reactor->schedule_wakeup (eh, ACE_Event_Handler::WRITE_MASK);
+}
+
+int
+TAO_Transport::cancel_output_i (void)
+{
+ ACE_Event_Handler * const eh = this->event_handler_i ();
+ ACE_Reactor *const reactor = eh->reactor ();
+
+ if (TAO_debug_level > 3)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - Transport[%d]::cancel_output_i\n"),
+ this->id ()));
+ }
+
+ return reactor->cancel_wakeup (eh, ACE_Event_Handler::WRITE_MASK);
+}
+
+int
+TAO_Transport::handle_timeout (const ACE_Time_Value & /* current_time */,
+ const void *act)
+{
+ if (TAO_debug_level > 6)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - TAO_Transport[%d]::handle_timeout, ")
+ ACE_TEXT ("timer expired\n"),
+ this->id ()));
+ }
+
+ /// This is the only legal ACT in the current configuration....
+ if (act != &this->current_deadline_)
+ {
+ return -1;
+ }
+
+ if (this->flush_timer_pending ())
+ {
+ // The timer is always a oneshot timer, so mark is as not
+ // pending.
+ this->reset_flush_timer ();
+
+ TAO_Flushing_Strategy *flushing_strategy =
+ this->orb_core ()->flushing_strategy ();
+ (void) flushing_strategy->schedule_output (this);
+ }
+
+ return 0;
+}
+
+int
+TAO_Transport::drain_queue (void)
+{
+ ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->handler_lock_, -1);
+ int const retval = this->drain_queue_i ();
+
+ if (retval == 1)
+ {
+ // ... there is no current message or it was completely
+ // sent, cancel output...
+ TAO_Flushing_Strategy *flushing_strategy =
+ this->orb_core ()->flushing_strategy ();
+
+ flushing_strategy->cancel_output (this);
+
+ return 0;
+ }
+
+ return retval;
+}
+
+int
+TAO_Transport::drain_queue_helper (int &iovcnt, iovec iov[])
+{
+ size_t byte_count = 0;
+
+ // ... send the message ...
+ ssize_t retval = -1;
+
+#ifdef ACE_HAS_SENDFILE
+ if (this->mmap_allocator_)
+ retval = this->sendfile (this->mmap_allocator_,
+ iov,
+ iovcnt,
+ byte_count);
+ else
+#endif /* ACE_HAS_SENDFILE */
+ retval = this->send (iov, iovcnt, byte_count);
+
+ if (TAO_debug_level == 5)
+ {
+ dump_iov (iov, iovcnt, this->id (),
+ byte_count, "drain_queue_helper");
+ }
+
+ // ... now we need to update the queue, removing elements
+ // that have been sent, and updating the last element if it
+ // was only partially sent ...
+ this->cleanup_queue (byte_count);
+ iovcnt = 0;
+
+ if (retval == 0)
+ {
+ if (TAO_debug_level > 4)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - Transport[%d]::drain_queue_helper, ")
+ ACE_TEXT ("send() returns 0\n"),
+ this->id ()));
+ }
+ return -1;
+ }
+ else if (retval == -1)
+ {
+ if (TAO_debug_level > 4)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - Transport[%d]::drain_queue_helper, ")
+ ACE_TEXT ("error during %p\n"),
+ this->id (), ACE_TEXT ("send()")));
+ }
+
+ if (errno == EWOULDBLOCK || errno == EAGAIN)
+ {
+ return 0;
+ }
+
+ return -1;
+ }
+
+ // ... start over, how do we guarantee progress? Because if
+ // no bytes are sent send() can only return 0 or -1
+
+ // Total no. of bytes sent for a send call
+ this->sent_byte_count_ += byte_count;
+
+ if (TAO_debug_level > 4)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - Transport[%d]::drain_queue_helper, ")
+ ACE_TEXT ("byte_count = %d, head_is_empty = %d\n"),
+ this->id(), byte_count, (this->head_ == 0)));
+ }
+
+ return 1;
+}
+
+int
+TAO_Transport::drain_queue_i (void)
+{
+ // This is the vector used to send data, it must be declared outside
+ // the loop because after the loop there may still be data to be
+ // sent
+ int iovcnt = 0;
+#if defined (ACE_INITIALIZE_MEMORY_BEFORE_USE)
+ iovec iov[ACE_IOV_MAX] = { 0 , 0 };
+#else
+ iovec iov[ACE_IOV_MAX];
+#endif /* ACE_INITIALIZE_MEMORY_BEFORE_USE */
+
+ // We loop over all the elements in the queue ...
+ TAO_Queued_Message *i = this->head_;
+
+ // Reset the value so that the counting is done for each new send
+ // call.
+ this->sent_byte_count_ = 0;
+
+ while (i != 0)
+ {
+ // ... each element fills the iovector ...
+ i->fill_iov (ACE_IOV_MAX, iovcnt, iov);
+
+ // ... the vector is full, no choice but to send some data out.
+ // We need to loop because a single message can span multiple
+ // IOV_MAX elements ...
+ if (iovcnt == ACE_IOV_MAX)
+ {
+ int const retval =
+ this->drain_queue_helper (iovcnt, iov);
+
+ if (TAO_debug_level > 4)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - Transport[%d]::drain_queue_i, ")
+ ACE_TEXT ("helper retval = %d\n"),
+ this->id (), retval));
+ }
+
+ if (retval != 1)
+ {
+ return retval;
+ }
+
+ i = this->head_;
+ continue;
+ }
+ // ... notice that this line is only reached if there is still
+ // room in the iovector ...
+ i = i->next ();
+ }
+
+ if (iovcnt != 0)
+ {
+ int const retval = this->drain_queue_helper (iovcnt, iov);
+
+ if (TAO_debug_level > 4)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - Transport[%d]::drain_queue_i, ")
+ ACE_TEXT ("helper retval = %d\n"),
+ this->id (), retval));
+ }
+
+ if (retval != 1)
+ {
+ return retval;
+ }
+ }
+
+ if (this->head_ == 0)
+ {
+ if (this->flush_timer_pending ())
+ {
+ ACE_Event_Handler *eh = this->event_handler_i ();
+ ACE_Reactor * const reactor = eh->reactor ();
+ reactor->cancel_timer (this->flush_timer_id_);
+ this->reset_flush_timer ();
+ }
+
+ return 1;
+ }
+
+ return 0;
+}
+
+void
+TAO_Transport::cleanup_queue_i ()
+{
+ if (TAO_debug_level > 4)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - Transport[%d]::cleanup_queue_i, ")
+ ACE_TEXT ("cleaning up complete queue\n"),
+ this->id ()));
+ }
+
+ // Cleanup all messages
+ while (this->head_ != 0)
+ {
+ TAO_Queued_Message *i = this->head_;
+
+ // @@ This is a good point to insert a flag to indicate that a
+ // CloseConnection message was successfully received.
+ i->state_changed (TAO_LF_Event::LFS_CONNECTION_CLOSED,
+ this->orb_core_->leader_follower ());
+
+ i->remove_from_list (this->head_, this->tail_);
+
+ i->destroy ();
+ }
+}
+
+void
+TAO_Transport::cleanup_queue (size_t byte_count)
+{
+ while (this->head_ != 0 && byte_count > 0)
+ {
+ TAO_Queued_Message *i = this->head_;
+
+ if (TAO_debug_level > 4)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - Transport[%d]::cleanup_queue, ")
+ ACE_TEXT ("byte_count = %d\n"),
+ this->id (), byte_count));
+ }
+
+ // Update the state of the first message
+ i->bytes_transferred (byte_count);
+
+ if (TAO_debug_level > 4)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - Transport[%d]::cleanup_queue, ")
+ ACE_TEXT ("after transfer, bc = %d, all_sent = %d, ml = %d\n"),
+ this->id (), byte_count, i->all_data_sent (),
+ i->message_length ()));
+ }
+
+ // ... if all the data was sent the message must be removed from
+ // the queue...
+ if (i->all_data_sent ())
+ {
+ i->remove_from_list (this->head_, this->tail_);
+ i->destroy ();
+ }
+ }
+}
+
+int
+TAO_Transport::check_buffering_constraints_i (TAO_Stub *stub,
+ bool &must_flush)
+{
+ // First let's compute the size of the queue:
+ size_t msg_count = 0;
+ size_t total_bytes = 0;
+
+ for (TAO_Queued_Message *i = this->head_; i != 0; i = i->next ())
+ {
+ ++msg_count;
+ total_bytes += i->message_length ();
+ }
+
+ bool set_timer;
+ ACE_Time_Value new_deadline;
+
+ bool constraints_reached =
+ stub->transport_queueing_strategy ().
+ buffering_constraints_reached (stub,
+ msg_count,
+ total_bytes,
+ must_flush,
+ this->current_deadline_,
+ set_timer,
+ new_deadline);
+
+ // ... set the new timer, also cancel any previous timers ...
+ if (set_timer)
+ {
+ ACE_Event_Handler *eh = this->event_handler_i ();
+ ACE_Reactor *reactor = eh->reactor ();
+ this->current_deadline_ = new_deadline;
+ ACE_Time_Value delay =
+ new_deadline - ACE_OS::gettimeofday ();
+
+ if (this->flush_timer_pending ())
+ {
+ reactor->cancel_timer (this->flush_timer_id_);
+ }
+
+ this->flush_timer_id_ =
+ reactor->schedule_timer (&this->transport_timer_,
+ &this->current_deadline_,
+ delay);
+ }
+
+ return constraints_reached;
+}
+
+void
+TAO_Transport::report_invalid_event_handler (const char *caller)
+{
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - Transport[%d]::report_invalid_event_handler")
+ ACE_TEXT ("(%s) no longer associated with handler [tag=%d]\n"),
+ this->id (), ACE_TEXT_CHAR_TO_TCHAR (caller), this->tag_));
+ }
+}
+
+void
+TAO_Transport::send_connection_closed_notifications (void)
+{
+ {
+ ACE_MT (ACE_GUARD (ACE_Lock, guard, *this->handler_lock_));
+
+ this->send_connection_closed_notifications_i ();
+ }
+
+ this->tms ()->connection_closed ();
+}
+
+void
+TAO_Transport::send_connection_closed_notifications_i (void)
+{
+ this->cleanup_queue_i ();
+
+ this->messaging_object ()->reset ();
+}
+
+int
+TAO_Transport::send_message_shared_i (TAO_Stub *stub,
+ int message_semantics,
+ const ACE_Message_Block *message_block,
+ ACE_Time_Value *max_wait_time)
+{
+ switch (message_semantics)
+ {
+ case TAO_Transport::TAO_TWOWAY_REQUEST:
+ return this->send_synchronous_message_i (message_block,
+ max_wait_time);
+ case TAO_Transport::TAO_REPLY:
+ return this->send_reply_message_i (message_block,
+ max_wait_time);
+ case TAO_Transport::TAO_ONEWAY_REQUEST:
+ return this->send_asynchronous_message_i (stub,
+ message_block,
+ max_wait_time);
+ }
+
+ return -1;
+}
+
+int
+TAO_Transport::send_asynchronous_message_i (TAO_Stub *stub,
+ const ACE_Message_Block *message_block,
+ ACE_Time_Value *max_wait_time)
+{
+ // Let's figure out if the message should be queued without trying
+ // to send first:
+ bool try_sending_first = true;
+
+ const bool queue_empty = (this->head_ == 0);
+
+ if (!queue_empty)
+ {
+ try_sending_first = false;
+ }
+ else if (stub->transport_queueing_strategy ().must_queue (queue_empty))
+ {
+ try_sending_first = false;
+ }
+
+ if (try_sending_first)
+ {
+ ssize_t n = 0;
+ size_t byte_count = 0;
+ // ... in this case we must try to send the message first ...
+
+ const size_t total_length = message_block->total_length ();
+
+ if (TAO_debug_level > 6)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - Transport[%d]::send_asynchronous_message_i, ")
+ ACE_TEXT ("trying to send the message (ml = %d)\n"),
+ this->id (), total_length));
+ }
+
+ // @@ I don't think we want to hold the mutex here, however if
+ // we release it we need to recheck the status of the transport
+ // after we return... once I understand the final form for this
+ // code I will re-visit this decision
+ n = this->send_message_block_chain_i (message_block,
+ byte_count,
+ max_wait_time);
+ if (n == -1)
+ {
+ // ... if this is just an EWOULDBLOCK we must schedule the
+ // message for later, if it is ETIME we still have to send
+ // the complete message, because cutting off the message at
+ // this point will destroy the synchronization with the
+ // server ...
+ if (errno != EWOULDBLOCK && errno != ETIME)
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) - Transport[%d]::send_asynchronous_message_i, ")
+ ACE_TEXT ("fatal error in ")
+ ACE_TEXT ("send_message_block_chain_i - %m\n"),
+ this->id ()));
+ }
+ return -1;
+ }
+ }
+
+ // ... let's figure out if the complete message was sent ...
+ if (total_length == byte_count)
+ {
+ // Done, just return. Notice that there are no allocations
+ // or copies up to this point (though some fancy calling
+ // back and forth).
+ // This is the common case for the critical path, it should
+ // be fast.
+ return 0;
+ }
+
+ if (TAO_debug_level > 6)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - Transport[%d]::send_asynchronous_message_i, ")
+ ACE_TEXT ("partial send %d / %d bytes\n"),
+ this->id (), byte_count, total_length));
+ }
+
+ // ... part of the data was sent, need to figure out what piece
+ // of the message block chain must be queued ...
+ while (message_block != 0 && message_block->length () == 0)
+ {
+ message_block = message_block->cont ();
+ }
+
+ // ... at least some portion of the message block chain should
+ // remain ...
+ }
+
+ // ... either the message must be queued or we need to queue it
+ // because it was not completely sent out ...
+
+ if (TAO_debug_level > 6)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - Transport[%d]::send_asynchronous_message_i, ")
+ ACE_TEXT ("message is queued\n"),
+ this->id ()));
+ }
+
+ if (this->queue_message_i(message_block) == -1)
+ {
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - Transport[%d]::send_asynchronous_message_i, ")
+ ACE_TEXT ("cannot queue message for ")
+ ACE_TEXT (" - %m\n"),
+ this->id ()));
+ return -1;
+ }
+
+ // ... if the queue is full we need to activate the output on the
+ // queue ...
+ bool must_flush = false;
+ const bool constraints_reached =
+ this->check_buffering_constraints_i (stub,
+ must_flush);
+
+ // ... but we also want to activate it if the message was partially
+ // sent.... Plus, when we use the blocking flushing strategy the
+ // queue is flushed as a side-effect of 'schedule_output()'
+
+ TAO_Flushing_Strategy *flushing_strategy =
+ this->orb_core ()->flushing_strategy ();
+
+ if (constraints_reached || try_sending_first)
+ {
+ (void) flushing_strategy->schedule_output (this);
+ }
+
+ if (must_flush)
+ {
+ typedef ACE_Reverse_Lock<ACE_Lock> TAO_REVERSE_LOCK;
+ TAO_REVERSE_LOCK reverse (*this->handler_lock_);
+ ACE_GUARD_RETURN (TAO_REVERSE_LOCK, ace_mon, reverse, -1);
+
+ (void) flushing_strategy->flush_transport (this);
+ }
+
+ return 0;
+}
+
+int
+TAO_Transport::queue_message_i(const ACE_Message_Block *message_block)
+{
+ TAO_Queued_Message *queued_message = 0;
+ ACE_NEW_RETURN (queued_message,
+ TAO_Asynch_Queued_Message (message_block,
+ this->orb_core_,
+ 0,
+ 1),
+ -1);
+ queued_message->push_back (this->head_, this->tail_);
+
+ return 0;
+}
+
+/*
+ *
+ * All the methods relevant to the incoming data path of the ORB are
+ * defined below
+ *
+ */
+int
+TAO_Transport::handle_input (TAO_Resume_Handle &rh,
+ ACE_Time_Value * max_wait_time,
+ int /* block */ /* deprecated parameter */ )
+{
+ if (TAO_debug_level > 3)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - Transport[%d]::handle_input\n"),
+ this->id ()));
+ }
+
+ // First try to process messages of the head of the incoming queue.
+ int const retval = this->process_queue_head (rh);
+
+ if (retval <= 0)
+ {
+ if (retval == -1)
+ {
+ if (TAO_debug_level > 2)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - Transport[%d]::handle_input, ")
+ ACE_TEXT ("error while parsing the head of the queue\n"),
+ this->id()));
+
+ }
+ return -1;
+ }
+ else
+ {
+ // retval == 0
+
+ // Processed a message in queue successfully. This
+ // thread must return to thread-pool now.
+ return 0;
+ }
+ }
+
+ TAO_Queued_Data *q_data = 0;
+
+ if (this->incoming_message_stack_.top (q_data) != -1
+ && q_data->missing_data_ != TAO_MISSING_DATA_UNDEFINED)
+ {
+ /* PRE: q_data->missing_data_ > 0 as all QD on stack must be incomplete */
+ if (this->handle_input_missing_data (rh, max_wait_time, q_data) == -1)
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) - Transport[%d]::handle_input, ")
+ ACE_TEXT ("error consolidating incoming message\n"),
+ this->id ()));
+ }
+ return -1;
+ }
+ }
+ else
+ {
+ if (this->handle_input_parse_data (rh, max_wait_time) == -1)
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) - Transport[%d]::handle_input, ")
+ ACE_TEXT ("error parsing incoming message\n"),
+ this->id ()));
+ }
+ return -1;
+ }
+ }
+
+ return 0;
+}
+
+int
+TAO_Transport::consolidate_process_message (TAO_Queued_Data *q_data,
+ TAO_Resume_Handle &rh)
+{
+ // paranoid check
+ if (q_data->missing_data_ != 0)
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) - Transport[%d]::consolidate_process_message, ")
+ ACE_TEXT ("missing data\n"),
+ this->id ()));
+ }
+ return -1;
+ }
+
+ if (q_data->more_fragments_ ||
+ q_data->msg_type_ == TAO_PLUGGABLE_MESSAGE_FRAGMENT)
+ {
+ // consolidate message on top of stack, only for fragmented messages
+ TAO_Queued_Data *new_q_data = 0;
+
+ switch (this->messaging_object()->consolidate_fragmented_message (q_data, new_q_data))
+ {
+ case -1: // error
+ return -1;
+
+ case 0: // returning consolidated message in q_data
+ if (!new_q_data)
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) - Transport[%d]::consolidate_process_message, ")
+ ACE_TEXT ("error, consolidated message is NULL\n"),
+ this->id ()));
+ }
+ return -1;
+ }
+
+
+ if (this->process_parsed_messages (new_q_data, rh) == -1)
+ {
+ TAO_Queued_Data::release (new_q_data);
+
+ if (TAO_debug_level > 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) - Transport[%d]::consolidate_process_message, ")
+ ACE_TEXT ("error processing consolidated message\n"),
+ this->id ()));
+ }
+ return -1;
+ }
+
+ TAO_Queued_Data::release (new_q_data);
+
+ break;
+
+ case 1: // fragment has been stored in messaging_oject()
+ break;
+ }
+ }
+ else
+ {
+ if (this->process_parsed_messages (q_data, rh) == -1)
+ {
+ TAO_Queued_Data::release (q_data);
+
+ if (TAO_debug_level > 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) - Transport[%d]::consolidate_process_message, ")
+ ACE_TEXT ("error processing message\n"),
+ this->id ()));
+ }
+ return -1;
+ }
+
+ TAO_Queued_Data::release (q_data);
+
+ }
+
+ return 0;
+}
+
+int
+TAO_Transport::consolidate_enqueue_message (TAO_Queued_Data *q_data)
+{
+ // consolidate message on top of stack, only for fragmented messages
+
+ // paranoid check
+ if (q_data->missing_data_ != 0)
+ {
+ return -1;
+ }
+
+ if (q_data->more_fragments_ ||
+ q_data->msg_type_ == TAO_PLUGGABLE_MESSAGE_FRAGMENT)
+ {
+ TAO_Queued_Data *new_q_data = 0;
+
+ switch (this->messaging_object()->consolidate_fragmented_message (q_data, new_q_data))
+ {
+ case -1: // error
+ return -1;
+
+ case 0: // returning consolidated message in new_q_data
+ if (!new_q_data)
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) - Transport[%d]::consolidate_enqueue_message, ")
+ ACE_TEXT ("error, consolidated message is NULL\n"),
+ this->id ()));
+ }
+ return -1;
+ }
+
+ if (this->incoming_message_queue_.enqueue_tail (new_q_data) != 0)
+ {
+ TAO_Queued_Data::release (new_q_data);
+ return -1;
+ }
+ break;
+
+ case 1: // fragment has been stored in messaging_oject()
+ break;
+ }
+ }
+ else
+ {
+ if (this->incoming_message_queue_.enqueue_tail (q_data) != 0)
+ {
+ TAO_Queued_Data::release (q_data);
+ return -1;
+ }
+ }
+
+ return 0; // success
+}
+
+int
+TAO_Transport::handle_input_missing_data (TAO_Resume_Handle &rh,
+ ACE_Time_Value * max_wait_time,
+ TAO_Queued_Data *q_data)
+{
+ // paranoid check
+ if (q_data == 0)
+ {
+ return -1;
+ }
+
+ if (TAO_debug_level > 3)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - Transport[%d]::handle_input_missing_data_message, ")
+ ACE_TEXT ("enter (missing data == %d)\n"),
+ this->id (), q_data->missing_data_));
+ }
+
+ size_t const recv_size = q_data->missing_data_;
+
+ // make sure the message_block has enough space
+ size_t const message_size = recv_size
+ + q_data->msg_block_->length();
+
+ if (q_data->msg_block_->space() < recv_size)
+ {
+ if (ACE_CDR::grow (q_data->msg_block_, message_size) == -1)
+ {
+ return -1;
+ }
+ }
+
+ // Saving the size of the received buffer in case any one needs to
+ // get the size of the message thats received in the
+ // context. Obviously the value will be changed for each recv call
+ // and the user is supposed to invoke the accessor only in the
+ // invocation context to get meaningful information.
+ this->recv_buffer_size_ = recv_size;
+
+ // Read the message into the existing message block on heap
+ ssize_t const n = this->recv (q_data->msg_block_->wr_ptr(),
+ recv_size,
+ max_wait_time);
+
+
+ if (n <= 0)
+ {
+ return n;
+ }
+
+ if (TAO_debug_level > 3)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - Transport[%d]::handle_input_missing_data_message, ")
+ ACE_TEXT ("read bytes %d\n"),
+ this->id (), n));
+ }
+
+ q_data->msg_block_->wr_ptr(n);
+ q_data->missing_data_ -= n;
+
+ if (q_data->missing_data_ == 0)
+ {
+ // paranoid check
+ if (this->incoming_message_stack_.pop (q_data) == -1)
+ {
+ return -1;
+ }
+
+ if (this->consolidate_process_message (q_data, rh) == -1)
+ {
+ return -1;
+ }
+ }
+
+ return 0;
+}
+
+
+int
+TAO_Transport::handle_input_parse_extra_messages (ACE_Message_Block &message_block)
+{
+
+ // store buffer status of last extraction: -1 parse error, 0
+ // incomplete message header in buffer, 1 complete messages header
+ // parsed
+ int buf_status = 0;
+
+ TAO_Queued_Data *q_data = 0; // init
+
+ // parse buffer until all messages have been extracted, consolidate
+ // and enqueue complete messages, if the last message being parsed
+ // has missin data, it is stays on top of incoming_message_stack.
+ while (message_block.length () > 0 &&
+ (buf_status = this->messaging_object ()->extract_next_message
+ (message_block, q_data)) != -1 &&
+ q_data != 0) // paranoid check
+ {
+ if (q_data->missing_data_ == 0)
+ {
+ if (this->consolidate_enqueue_message (q_data) == -1)
+ {
+ return -1;
+ }
+ }
+ else // incomplete message read, probably the last message in buffer
+ {
+ // can not fail
+ this->incoming_message_stack_.push (q_data);
+ }
+
+ q_data = 0; // reset
+ } // while
+
+ if (buf_status == -1)
+ {
+ return -1;
+ }
+
+ return 0;
+}
+
+int
+TAO_Transport::handle_input_parse_data (TAO_Resume_Handle &rh,
+ ACE_Time_Value * max_wait_time)
+{
+
+ if (TAO_debug_level > 3)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - Transport[%d]::handle_input_parse_data, ")
+ ACE_TEXT ("enter\n"),
+ this->id ()));
+ }
+
+
+ // The buffer on the stack which will be used to hold the input
+ // messages, ACE_CDR::MAX_ALIGNMENT compensates the
+ // memory-alignment. This improves performance with SUN-Java-ORB-1.4
+ // and higher that sends fragmented requests of size 1024 bytes.
+ char buf [TAO_MAXBUFSIZE + ACE_CDR::MAX_ALIGNMENT];
+
+#if defined (ACE_INITIALIZE_MEMORY_BEFORE_USE)
+ (void) ACE_OS::memset (buf,
+ '\0',
+ sizeof buf);
+#endif /* ACE_INITIALIZE_MEMORY_BEFORE_USE */
+
+ // Create a data block
+ ACE_Data_Block db (sizeof (buf),
+ ACE_Message_Block::MB_DATA,
+ buf,
+ this->orb_core_->input_cdr_buffer_allocator (),
+ this->orb_core_->locking_strategy (),
+ ACE_Message_Block::DONT_DELETE,
+ this->orb_core_->input_cdr_dblock_allocator ());
+
+ // Create a message block
+ ACE_Message_Block message_block (&db,
+ ACE_Message_Block::DONT_DELETE,
+ this->orb_core_->input_cdr_msgblock_allocator ());
+
+
+ // Align the message block
+ ACE_CDR::mb_align (&message_block);
+
+ size_t recv_size = 0; // Note: unsigned integer
+
+ // Pointer to newly parsed message
+ TAO_Queued_Data *q_data = 0;
+
+ // optimizing access of constants
+ const size_t header_length =
+ this->messaging_object ()->header_length ();
+
+ // paranoid check
+ if (header_length > message_block.space ())
+ {
+ return -1;
+ }
+
+ if (this->orb_core_->orb_params ()->single_read_optimization ())
+ {
+ recv_size =
+ message_block.space ();
+ }
+ else
+ {
+ // Single read optimization has been de-activated. That means
+ // that we need to read from transport the GIOP header first
+ // before the payload. This codes first checks the incoming
+ // stack for partial messages which needs to be
+ // consolidated. Otherwise we are in new cycle, reading complete
+ // GIOP header of new incoming message.
+ if (this->incoming_message_stack_.top (q_data) != -1
+ && q_data->missing_data_ == TAO_MISSING_DATA_UNDEFINED)
+ {
+ // There is a partial message on incoming_message_stack_
+ // whose length is unknown so far. We need to consolidate
+ // the GIOP header to get to know the payload size,
+ recv_size = header_length - q_data->msg_block_->length ();
+ }
+ else
+ {
+ // Read amount of data forming GIOP header of new incoming
+ // message.
+ recv_size = header_length;
+ }
+ // POST: 0 <= recv_size <= header_length
+ }
+ // POST: 0 <= recv_size <= message_block->space ()
+
+ // If we have a partial message, copy it into our message block and
+ // clear out the partial message.
+ if (this->partial_message_ != 0 && this->partial_message_->length () > 0)
+ {
+ // (*) Copy back the partial message into current read-buffer,
+ // verify that the read-strategy of "recv_size" bytes is not
+ // exceeded. The latter check guarantees that recv_size does not
+ // roll-over and keeps in range
+ // 0<=recv_size<=message_block->space()
+ if (this->partial_message_->length () <= recv_size &&
+ message_block.copy (this->partial_message_->rd_ptr (),
+ this->partial_message_->length ()) == 0)
+ {
+
+ recv_size -= this->partial_message_->length ();
+ this->partial_message_->reset ();
+ }
+ else
+ {
+ return -1;
+ }
+ }
+ // POST: 0 <= recv_size <= buffer_space
+
+ if (0 >= recv_size) // paranoid: the check above (*) guarantees recv_size>=0
+ {
+ // This event would cause endless looping, trying frequently to
+ // read zero bytes from stream. This might happen, if TAOs
+ // protocol implementation is not correct and tries to read data
+ // beyond header without "single_read_optimazation" being
+ // activated.
+ if (TAO_debug_level > 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) - Transport[%d]::handle_input_parse_data, ")
+ ACE_TEXT ("Error - endless loop detection, closing connection"),
+ this->id ()));
+ }
+ return -1;
+ }
+
+ // Saving the size of the received buffer in case any one needs to
+ // get the size of the message thats received in the
+ // context. Obviously the value will be changed for each recv call
+ // and the user is supposed to invoke the accessor only in the
+ // invocation context to get meaningful information.
+ this->recv_buffer_size_ = recv_size;
+
+ // Read the message into the message block that we have created on
+ // the stack.
+ const ssize_t n = this->recv (message_block.wr_ptr (),
+ recv_size,
+ max_wait_time);
+
+ // If there is an error return to the reactor..
+ if (n <= 0)
+ {
+ return n;
+ }
+
+ if (TAO_debug_level > 3)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - Transport[%d]::handle_input_parse_data, ")
+ ACE_TEXT ("read %d bytes\n"),
+ this->id (), n));
+ }
+
+ // Set the write pointer in the stack buffer
+ message_block.wr_ptr (n);
+
+ //
+ // STACK PROCESSING OR MESSAGE CONSOLIDATION
+ //
+
+ // PRE: data in buffer is aligned && message_block.length() > 0
+
+ if (this->incoming_message_stack_.top (q_data) != -1
+ && q_data->missing_data_ == TAO_MISSING_DATA_UNDEFINED)
+ {
+ //
+ // MESSAGE CONSOLIDATION
+ //
+
+ // Partial message on incoming_message_stack_ needs to be
+ // consolidated. The message header could not be parsed so far
+ // and therefor the message size is unknown yet. Consolidating
+ // the message destroys the memory alignment of succeeding
+ // messages sharing the buffer, for that reason consolidation
+ // and stack based processing are mutial exclusive.
+ if (this->messaging_object ()->consolidate_node (q_data,
+ message_block) == -1)
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) - Transport[%d]::handle_input_parse_data, ")
+ ACE_TEXT ("error consolidating message from input buffer\n"),
+ this->id () ));
+ }
+ return -1;
+ }
+
+ // Complete message are to be enqueued and later processed
+ if (q_data->missing_data_ == 0)
+ {
+ if (this->incoming_message_stack_.pop (q_data) == -1)
+ {
+ return -1;
+ }
+
+ if (this->consolidate_enqueue_message (q_data) == -1)
+ {
+ return -1;
+ }
+ }
+
+ if (message_block.length () > 0
+ && this->handle_input_parse_extra_messages (message_block) == -1)
+ {
+ return -1;
+ }
+
+ // In any case try to process the enqueued messages
+ if (this->process_queue_head (rh) == -1)
+ {
+ return -1;
+ }
+ }
+ else
+ {
+ //
+ // STACK PROCESSING (critical path)
+ //
+
+ // Process the first message in buffer on stack
+
+ // (PRE: first message resides in aligned memory) Make a node of
+ // the message-block..
+
+ TAO_Queued_Data qd (&message_block,
+ this->orb_core_->transport_message_buffer_allocator ());
+
+ size_t mesg_length = 0;
+
+ if (this->messaging_object ()->parse_next_message (message_block,
+ qd,
+ mesg_length) == -1
+ || (qd.missing_data_ == 0
+ && mesg_length > message_block.length ()) )
+ {
+ // extracting message failed
+ return -1;
+ }
+ // POST: qd.missing_data_ == 0 --> mesg_length <= message_block.length()
+ // This prevents seeking rd_ptr behind the wr_ptr
+
+ if (qd.missing_data_ != 0 ||
+ qd.more_fragments_ ||
+ qd.msg_type_ == TAO_PLUGGABLE_MESSAGE_FRAGMENT)
+ {
+ if (qd.missing_data_ == 0)
+ {
+ // Dealing with a fragment
+ TAO_Queued_Data *nqd =
+ TAO_Queued_Data::duplicate (qd);
+
+ if (nqd == 0)
+ {
+ return -1;
+ }
+
+ // mark the end of message in new buffer
+ char* end_mark = nqd->msg_block_->rd_ptr ()
+ + mesg_length;
+ nqd->msg_block_->wr_ptr (end_mark);
+
+ // move the read pointer forward in old buffer
+ message_block.rd_ptr (mesg_length);
+
+ // enqueue the message
+ if (this->consolidate_enqueue_message (nqd) == -1)
+ {
+ return -1;
+ }
+
+ if (message_block.length () > 0
+ && this->handle_input_parse_extra_messages (message_block) == -1)
+ {
+ return -1;
+ }
+
+ // In any case try to process the enqueued messages
+ if (this->process_queue_head (rh) == -1)
+ {
+ return -1;
+ }
+ }
+ else if (qd.missing_data_ != TAO_MISSING_DATA_UNDEFINED)
+ {
+ // Incomplete message, must be the last one in buffer
+
+ if (qd.missing_data_ != TAO_MISSING_DATA_UNDEFINED &&
+ qd.missing_data_ > message_block.space ())
+ {
+ // Re-Allocate correct size on heap
+ if (ACE_CDR::grow (qd.msg_block_,
+ message_block.length ()
+ + qd.missing_data_) == -1)
+ {
+ return -1;
+ }
+ }
+
+ TAO_Queued_Data *nqd =
+ TAO_Queued_Data::duplicate (qd);
+
+ if (nqd == 0)
+ {
+ return -1;
+ }
+
+ // move read-pointer to end of buffer
+ message_block.rd_ptr (message_block.length());
+
+ this->incoming_message_stack_.push (nqd);
+ }
+ }
+ else
+ {
+ //
+ // critical path
+ //
+
+ // We cant process the message on stack right now. First we
+ // have got to parse extra messages from message_block,
+ // putting them into queue. When this is done we can return
+ // to process this message, and notifying other threads to
+ // process the messages in queue.
+
+ char * end_marker = message_block.rd_ptr ()
+ + mesg_length;
+
+ if (message_block.length () > mesg_length)
+ {
+ // There are more message in data stream to be parsed.
+ // Safe the rd_ptr to restore later.
+ char *rd_ptr_stack_mesg = message_block.rd_ptr ();
+
+ // Skip parsed message, jump to next message in buffer
+ // PRE: mesg_length <= message_block.length ()
+ message_block.rd_ptr (mesg_length);
+
+ // Extract remaining messages and enqueue them for later
+ // heap processing
+ if (this->handle_input_parse_extra_messages (message_block) == -1)
+ {
+ return -1;
+ }
+
+ // correct the end_marker
+ end_marker = message_block.rd_ptr ();
+
+ // Restore rd_ptr
+ message_block.rd_ptr (rd_ptr_stack_mesg);
+ }
+
+ // The following if-else has been copied from
+ // process_queue_head(). While process_queue_head()
+ // processes message on heap, here we will process a message
+ // on stack.
+
+ // Now that we have one message on stack to be processed,
+ // check whether we have one more message in the queue...
+ if (this->incoming_message_queue_.queue_length () > 0)
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - Transport[%d]::handle_input_parse_data, ")
+ ACE_TEXT ("notify reactor\n"),
+ this->id ()));
+
+ }
+
+ const int retval = this->notify_reactor ();
+
+ if (retval == 1)
+ {
+ // Let the class know that it doesn't need to resume the
+ // handle..
+ rh.set_flag (TAO_Resume_Handle::TAO_HANDLE_LEAVE_SUSPENDED);
+ }
+ else if (retval < 0)
+ return -1;
+ }
+ else
+ {
+ // As there are no further messages in queue just resume
+ // the handle. Set the flag incase someone had reset the flag..
+ rh.set_flag (TAO_Resume_Handle::TAO_HANDLE_RESUMABLE);
+ }
+
+ // PRE: incoming_message_queue is empty
+ if (this->process_parsed_messages (&qd,
+ rh) == -1)
+ {
+ return -1;
+ }
+
+ // move the rd_ptr tp position of end_marker
+ message_block.rd_ptr (end_marker);
+ }
+ }
+
+ // Now that all cases have been processed, there might be kept some data
+ // in buffer that needs to be safed for next "handle_input" invocations.
+ if (message_block.length () > 0)
+ {
+ if (this->partial_message_ == 0)
+ {
+ this->allocate_partial_message_block ();
+ }
+
+ if (this->partial_message_ != 0 &&
+ this->partial_message_->copy (message_block.rd_ptr (),
+ message_block.length ()) == 0)
+ {
+ message_block.rd_ptr (message_block.length ());
+ }
+ else
+ {
+ return -1;
+ }
+ }
+
+ return 0;
+}
+
+
+int
+TAO_Transport::process_parsed_messages (TAO_Queued_Data *qd,
+ TAO_Resume_Handle &rh)
+{
+ if (TAO_debug_level > 7)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - Transport[%d]::process_parsed_messages, ")
+ ACE_TEXT ("entering (missing data == %d)\n"),
+ this->id(), qd->missing_data_));
+ }
+
+ // Get the <message_type> that we have received
+ const TAO_Pluggable_Message_Type t = qd->msg_type_;
+
+ // int result = 0;
+
+ if (t == TAO_PLUGGABLE_MESSAGE_CLOSECONNECTION)
+ {
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - Transport[%d]::process_parsed_messages, ")
+ ACE_TEXT ("received CloseConnection message - %m\n"),
+ this->id()));
+
+ // Return a "-1" so that the next stage can take care of
+ // closing connection and the necessary memory management.
+ return -1;
+ }
+ else if (t == TAO_PLUGGABLE_MESSAGE_REQUEST ||
+ t == TAO_PLUGGABLE_MESSAGE_LOCATEREQUEST)
+ {
+ // Let us resume the handle before we go ahead to process the
+ // request. This will open up the handle for other threads.
+ rh.resume_handle ();
+
+ if (this->messaging_object ()->process_request_message (
+ this,
+ qd) == -1)
+ {
+ // Return a "-1" so that the next stage can take care of
+ // closing connection and the necessary memory management.
+ return -1;
+ }
+ }
+ else if (t == TAO_PLUGGABLE_MESSAGE_REPLY ||
+ t == TAO_PLUGGABLE_MESSAGE_LOCATEREPLY)
+ {
+ rh.resume_handle ();
+
+ TAO_Pluggable_Reply_Params params (this);
+
+ if (this->messaging_object ()->process_reply_message (params,
+ qd) == -1)
+ {
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - Transport[%d]::process_parsed_messages, ")
+ ACE_TEXT ("error in process_reply_message - %m\n"),
+ this->id ()));
+
+ return -1;
+ }
+
+ }
+ else if (t == TAO_PLUGGABLE_MESSAGE_CANCELREQUEST)
+ {
+ // The associated request might be incomplpete residing
+ // fragmented in messaging object. We must make sure the
+ // resources allocated by fragments are released.
+
+ if (this->messaging_object ()->discard_fragmented_message (qd) == -1)
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) - Transport[%d]::process_parsed_messages, ")
+ ACE_TEXT ("error processing CancelRequest\n"),
+ this->id ()));
+ }
+ }
+
+ // We are not able to cancel requests being processed already;
+ // this is declared as optional feature by CORBA, and TAO does
+ // not support this currently.
+
+ // Just continue processing, CancelRequest does not mean to cut
+ // off the connection.
+ }
+ else if (t == TAO_PLUGGABLE_MESSAGE_MESSAGERROR)
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) - Transport[%d]::process_parsed_messages, ")
+ ACE_TEXT ("received MessageError, closing connection\n"),
+ this->id ()));
+ }
+ return -1;
+ }
+
+ // If not, just return back..
+ return 0;
+}
+
+int
+TAO_Transport::process_queue_head (TAO_Resume_Handle &rh)
+{
+ if (TAO_debug_level > 3)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - Transport[%d]::process_queue_head, %d enqueued\n"),
+ this->id (), this->incoming_message_queue_.queue_length () ));
+ }
+
+ // See if message in queue ...
+ if (this->incoming_message_queue_.queue_length () > 0)
+ {
+ // Get the message on the head of the queue..
+ TAO_Queued_Data *qd =
+ this->incoming_message_queue_.dequeue_head ();
+
+ if (TAO_debug_level > 3)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - Transport[%d]::process_queue_head, ")
+ ACE_TEXT ("the size of the queue is [%d]\n"),
+ this->id (),
+ this->incoming_message_queue_.queue_length()));
+ }
+ // Now that we have pulled out out one message out of the queue,
+ // check whether we have one more message in the queue...
+ if (this->incoming_message_queue_.queue_length () > 0)
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - Transport[%d]::process_queue_head, ")
+ ACE_TEXT ("notify reactor\n"),
+ this->id ()));
+
+ }
+
+ const int retval = this->notify_reactor ();
+
+ if (retval == 1)
+ {
+ // Let the class know that it doesn't need to resume the
+ // handle..
+ rh.set_flag (TAO_Resume_Handle::TAO_HANDLE_LEAVE_SUSPENDED);
+ }
+ else if (retval < 0)
+ return -1;
+ }
+ else
+ {
+ // As we are ready to process the last message just resume
+ // the handle. Set the flag incase someone had reset the flag..
+ rh.set_flag (TAO_Resume_Handle::TAO_HANDLE_RESUMABLE);
+ }
+
+ // Process the message...
+ if (this->process_parsed_messages (qd, rh) == -1)
+ {
+ return -1;
+ }
+
+ // Delete the Queued_Data..
+ TAO_Queued_Data::release (qd);
+
+ return 0;
+ }
+
+ return 1;
+}
+
+int
+TAO_Transport::notify_reactor (void)
+{
+ if (!this->ws_->is_registered ())
+ {
+ return 0;
+ }
+
+ ACE_Event_Handler *eh = this->event_handler_i ();
+
+ // Get the reactor associated with the event handler
+ ACE_Reactor *reactor = this->orb_core ()->reactor ();
+
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - Transport[%d]::notify_reactor, ")
+ ACE_TEXT ("notify to Reactor\n"),
+ this->id ()));
+ }
+
+
+ // Send a notification to the reactor...
+ const int retval = reactor->notify (eh,
+ ACE_Event_Handler::READ_MASK);
+
+ if (retval < 0 && TAO_debug_level > 2)
+ {
+ // @@todo: need to think about what is the action that
+ // we can take when we get here.
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - Transport[%d]::notify_reactor, ")
+ ACE_TEXT ("notify to the reactor failed..\n"),
+ this->id ()));
+ }
+
+ return 1;
+}
+
+TAO::Transport_Cache_Manager &
+TAO_Transport::transport_cache_manager (void)
+{
+ return this->orb_core_->lane_resources ().transport_cache ();
+}
+
+void
+TAO_Transport::assign_translators (TAO_InputCDR *inp, TAO_OutputCDR *outp)
+{
+ if (this->char_translator_)
+ {
+ this->char_translator_->assign (inp);
+ this->char_translator_->assign (outp);
+ }
+ if (this->wchar_translator_)
+ {
+ this->wchar_translator_->assign (inp);
+ this->wchar_translator_->assign (outp);
+ }
+}
+
+void
+TAO_Transport::clear_translators (TAO_InputCDR *inp, TAO_OutputCDR *outp)
+{
+ if (inp)
+ {
+ inp->char_translator (0);
+ inp->wchar_translator (0);
+ }
+ if (outp)
+ {
+ outp->char_translator (0);
+ outp->wchar_translator (0);
+ }
+}
+
+ACE_Event_Handler::Reference_Count
+TAO_Transport::add_reference (void)
+{
+ return this->event_handler_i ()->add_reference ();
+}
+
+ACE_Event_Handler::Reference_Count
+TAO_Transport::remove_reference (void)
+{
+ return this->event_handler_i ()->remove_reference ();
+}
+
+TAO_OutputCDR &
+TAO_Transport::out_stream (void)
+{
+ return this->messaging_object ()->out_stream ();
+}
+
+bool
+TAO_Transport::post_open (size_t id)
+{
+ this->id_ = id;
+
+ {
+ ACE_GUARD_RETURN (ACE_Lock,
+ ace_mon,
+ *this->handler_lock_,
+ false);
+ this->is_connected_ = true;
+ }
+
+ // When we have data in our outgoing queue schedule ourselves
+ // for output
+ if (this->queue_is_empty_i ())
+ return true;
+
+ // If the wait strategy wants us to be registered with the reactor
+ // then we do so. If registeration is required and it succeeds,
+ // #REFCOUNT# becomes two.
+ if (this->wait_strategy ()->register_handler () == 0)
+ {
+ TAO_Flushing_Strategy *flushing_strategy =
+ this->orb_core ()->flushing_strategy ();
+ (void) flushing_strategy->schedule_output (this);
+ }
+ else
+ {
+ // Registration failures.
+
+ // Purge from the connection cache, if we are not in the cache, this
+ // just does nothing.
+ (void) this->purge_entry ();
+
+ // Close the handler.
+ (void) this->close_connection ();
+
+ if (TAO_debug_level > 0)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) - Transport[%d]::post_connect , ")
+ ACE_TEXT ("could not register the transport ")
+ ACE_TEXT ("in the reactor.\n"),
+ this->id ()));
+
+ return false;
+ }
+
+ return true;
+}
+
+void
+TAO_Transport::allocate_partial_message_block (void)
+{
+ if (this->partial_message_ == 0)
+ {
+ // This value must be at least large enough to hold a GIOP message
+ // header plus a GIOP fragment header
+ const size_t partial_message_size =
+ this->messaging_object ()->header_length ();
+ // + this->messaging_object ()->fragment_header_length ();
+ // deprecated, conflicts with not-single_read_opt.
+
+ ACE_NEW (this->partial_message_,
+ ACE_Message_Block (partial_message_size));
+ }
+}
+
+/*
+ * Hook to add concrete implementations from the derived class onto
+ * TAO's transport.
+ */
+
+//@@ TAO_TRANSPORT_SPL_METHODS_ADD_HOOK
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Transport.h b/TAO/tao/Transport.h
new file mode 100644
index 00000000000..18d8ca2d89b
--- /dev/null
+++ b/TAO/tao/Transport.h
@@ -0,0 +1,1082 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Transport.h
+ *
+ * $Id$
+ *
+ * Define the interface for the Transport component in TAO's
+ * pluggable protocol framework.
+ *
+ * @author Fred Kuhns <fredk@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_TRANSPORT_H
+#define TAO_TRANSPORT_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Transport_Cache_Manager.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Transport_Timer.h"
+#include "tao/Incoming_Message_Queue.h"
+#include "tao/Incoming_Message_Stack.h"
+#include "ace/Time_Value.h"
+
+struct iovec;
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_ORB_Core;
+class TAO_Target_Specification;
+class TAO_Operation_Details;
+class TAO_Transport_Mux_Strategy;
+class TAO_Wait_Strategy;
+class TAO_Connection_Handler;
+class TAO_Pluggable_Messaging;
+class TAO_Codeset_Translator_Base;
+
+class TAO_Queued_Message;
+class TAO_Synch_Queued_Message;
+class TAO_Resume_Handle;
+class TAO_Stub;
+class TAO_MMAP_Allocator;
+
+namespace TAO
+{
+ /**
+ * @note Should this be in TAO namespace. Seems like a candidate
+ * that should be in the transport
+ */
+ enum Connection_Role
+ {
+ TAO_UNSPECIFIED_ROLE = 0,
+ TAO_SERVER_ROLE = 1,
+ TAO_CLIENT_ROLE = 2
+ };
+}
+
+/*
+ * Specialization hook for the TAO's transport implementation.
+ */
+//@@ TAO_TRANSPORT_SPL_INCLUDE_FORWARD_DECL_ADD_HOOK
+
+/**
+ * @class TAO_Transport
+ *
+ * @brief Generic definitions for the Transport class.
+ *
+ * The transport object is created in the Service handler
+ * constructor and deleted in the Service Handler's destructor!!
+ *
+ * The main responsability of a Transport object is to encapsulate a
+ * connection, and provide a transport independent way to send and
+ * receive data. Since TAO is heavily based on the Reactor for all if
+ * not all its I/O the Transport class is usually implemented with a
+ * helper Connection Handler that adapts the generic Transport
+ * interface to the Reactor types.
+ *
+ * <H3>The outgoing data path:</H3>
+ *
+ * One of the responsibilities of the TAO_Transport class is to send
+ * out GIOP messages as efficiently as possible. In most cases
+ * messages are put out in FIFO order, the transport object will put
+ * out the message using a single system call and return control to
+ * the application. However, for oneways and AMI requests it may be
+ * more efficient (or required if the SYNC_NONE policy is in effect)
+ * to queue the messages until a large enough data set is available.
+ * Another reason to queue is that some applications cannot block for
+ * I/O, yet they want to send messages so large that a single write()
+ * operation would not be able to cope with them. In such cases we
+ * need to queue the data and use the Reactor to drain the queue.
+ *
+ * Therefore, the Transport class may need to use a queue to
+ * temporarily hold the messages, and, in some configurations, it may
+ * need to use the Reactor to concurrently drain such queues.
+ *
+ * <H4>Out of order messages:</H4> TAO provides explicit policies to
+ * send 'urgent' messages. Such messages may put at the head of the
+ * queue. However, they cannot be sent immediately because the
+ * transport may already be sending another message in a reactive
+ * fashion.
+ *
+ * Consequently, the Transport must also know if the head of the queue
+ * has been partially sent. In that case new messages can only follow
+ * the head. Only once the head is completely sent we can start
+ * sending new messages.
+ *
+ * <H4>Waiting threads:</H4> One or more threads can be blocked
+ * waiting for the connection to completely send the message.
+ * The thread should return as soon as its message has been sent, so a
+ * per-thread condition is required. This suggest that simply using a
+ * ACE_Message_Queue would not be enough: there is a significant
+ * amount of ancillary information, to keep on each message that the
+ * Message_Block class does not provide room for.
+ *
+ * Blocking I/O is still attractive for some applications. First, my
+ * eliminating the Reactor overhead performance is improved when
+ * sending large blocks of data. Second, using the Reactor to send
+ * out data opens the door for nested upcalls, yet some applications
+ * cannot deal with the reentrancy issues in this case.
+ *
+ * <H4>Timeouts:</H4> Some or all messages could have a timeout period
+ * attached to them. The timeout source could either be some
+ * high-level policy or maybe some strategy to prevent denial of
+ * service attacks. In any case the timeouts are per-message, and
+ * later messages could have shorter timeouts.
+ * In fact, some kind of scheduling (such as EDF) could be required in
+ * a few applications.
+ *
+ * <H4>Conclusions:</H4> The outgoing data path consist in several
+ * components:
+ *
+ * - A queue of pending messages
+ * - A message currently being transmitted
+ * - A per-transport 'send strategy' to choose between blocking on
+ * write, blocking on the reactor or blockin on leader/follower.
+ * - A per-message 'waiting object'
+ * - A per-message timeout
+ *
+ * The Transport object provides a single method to send request
+ * messages (send_request_message ()).
+ *
+ * <H3>The incoming data path:</H3>
+ *
+ * One of the main responsibilities of the transport is to read and
+ * process the incoming GIOP message as quickly and efficiently as
+ * possible. There are other forces that needs to be given due
+ * consideration. They are
+ * - Multiple threads should be able to traverse along the same data
+ * path but should not be able to read from the same handle at the
+ * same time ie. the handle should not be shared between threads at
+ * any instant.
+ * - Reads on the handle could give one or more messages.
+ * - Minimise locking and copying overhead when trying to attack the
+ * above.
+ *
+ * <H3> Parsing messages (GIOP) & processing the message:</H3>
+ *
+ * The messages should be checked for validity and the right
+ * information should be sent to the higher layer for processing. The
+ * process of doing a sanity check and preparing the messages for the
+ * higher layers of the ORB are done by the messaging protocol.
+ *
+ * <H3> Design forces and Challenges </H3>
+ *
+ * To keep things as efficient as possible for medium sized requests,
+ * it would be good to minimise data copying and locking along the
+ * incoming path ie. from the time of reading the data from the handle
+ * to the application. We achieve this by creating a buffer on stack
+ * and reading the data from the handle into the buffer. We then pass
+ * the same data block (the buffer is encapsulated into a data block)
+ * to the higher layers of the ORB. The problems stem from the
+ * following
+ * (a) Data is bigger than the buffer that we have on stack
+ * (b) Transports like TCP do not guarantee availability of the whole
+ * chunk of data in one shot. Data could trickle in byte by byte.
+ * (c) Single read gives multiple messages
+ *
+ * We solve the problems as follows
+ *
+ * (a) First do a read with the buffer on stack. Query the underlying
+ * messaging object whether the message has any incomplete
+ * portion. If so, data will be copied into new buffer being able
+ * to hold full message and is queued; succeeding events will read
+ * data from socket and write directly into this buffer.
+ * Otherwise, if if the message in local buffer is complete, we free
+ * the handle and then send the message to the higher layers of the
+ * ORB for processing.
+ *
+ * (b) If buffer with incomplete message has been enqueued, while trying
+ * to do the above, the reactor will call us back when the handle
+ * becomes read ready. The read-operation will copy data directly
+ * into the enqueued buffer. If the message has bee read completely
+ * the message is sent to the higher layers of the ORB for processing.
+ *
+ * (c) If we get multiple messages (possible if the client connected
+ * to the server sends oneways or AMI requests), we parse and
+ * split the messages. Every message is put in the queue. Once
+ * the messages are queued, the thread picks up one message to
+ * send to the higher layers of the ORB. Before doing that, if
+ * it finds more messages, it sends a notify to the reactor
+ * without resuming the handle. The next thread picks up a
+ * message from the queue and processes that. Once the queue
+ * is drained the last thread resumes the handle.
+ *
+ * <H3> Sending Replies </H3>
+ *
+ * We could use the outgoing path of the ORB to send replies. This
+ * would allow us to reuse most of the code in the outgoing data
+ * path. We were doing this till TAO-1.2.3. We run in to
+ * problems. When writing the reply the ORB gets flow controlled, and the
+ * ORB tries to flush the message by going into the reactor. This
+ * resulted in unnecessary nesting. The thread that gets into the
+ * Reactor could potentially handle other messages (incoming or
+ * outgoing) and the stack starts growing leading to crashes.
+ *
+ * <H4> Solution to the nesting problem </H4>
+ *
+ * The solution that we (plan to) adopt is pretty straight
+ * forward. The thread sending replies will not block to send the
+ * replies but queue the replies and return to the Reactor. (Note the
+ * careful usages of the terms "blocking in the Reactor" as opposed to
+ * "return back to the Reactor".
+ *
+ *
+ * <B>See Also:</B>
+ *
+ * http://cvs.doc.wustl.edu/ace-latest.cgi/ACE_wrappers/TAO/docs/pluggable_protocols/index.html
+ *
+ */
+class TAO_Export TAO_Transport
+{
+public:
+
+ /// Default creator, requires the tag value be supplied.
+ TAO_Transport (CORBA::ULong tag,
+ TAO_ORB_Core *orb_core);
+
+ /// Destructor
+ virtual ~TAO_Transport (void);
+
+ /// Return the protocol tag.
+ /**
+ * The OMG assigns unique tags (a 32-bit unsigned number) to each
+ * protocol. New protocol tags can be obtained free of charge from
+ * the OMG, check the documents in corbafwd.h for more details.
+ */
+ CORBA::ULong tag (void) const;
+
+ /// Access the ORB that owns this connection.
+ TAO_ORB_Core *orb_core (void) const;
+
+ /// Get the TAO_Tranport_Mux_Strategy used by this object.
+ /**
+ * The role of the TAO_Transport_Mux_Strategy is described in more
+ * detail in that class' documentation. Enough is to say that the
+ * class is used to control how many threads can have pending
+ * requests over the same connection. Multiplexing multiple threads
+ * over the same connection conserves resources and is almost
+ * required for AMI, but having only one pending request per
+ * connection is more efficient and reduces the possibilities of
+ * priority inversions.
+ */
+ TAO_Transport_Mux_Strategy *tms (void) const;
+
+ /// Return the TAO_Wait_Strategy used by this object.
+ /**
+ * The role of the TAO_Wait_Strategy is described in more detail in
+ * that class' documentation. Enough is to say that the ORB can wait
+ * for a reply blocking on read(), using the Reactor to wait for
+ * multiple events concurrently or using the Leader/Followers
+ * protocol.
+ */
+ TAO_Wait_Strategy *wait_strategy (void) const;
+
+ /// Callback method to reactively drain the outgoing data queue
+ int handle_output (void);
+
+ /// Get the bidirectional flag
+ int bidirectional_flag (void) const;
+
+ /// Set the bidirectional flag
+ void bidirectional_flag (int flag);
+
+ /// Set the Cache Map entry
+ void cache_map_entry (TAO::Transport_Cache_Manager::HASH_MAP_ENTRY *entry);
+
+ /// Get the Cache Map entry
+ TAO::Transport_Cache_Manager::HASH_MAP_ENTRY *cache_map_entry (void);
+
+ /// Set and Get the identifier for this transport instance.
+ /**
+ * If not set, this will return an integer representation of
+ * the <code>this</code> pointer for the instance on which
+ * it's called.
+ */
+ size_t id (void) const;
+ void id (size_t id);
+
+ /**
+ * Methods dealing with the role of the connection, e.g., CLIENT or SERVER.
+ * See CORBA 2.6 Specification, Section 15.5.1 for origin of definitions.
+ */
+ TAO::Connection_Role opened_as (void) const;
+ void opened_as (TAO::Connection_Role);
+
+ /// Get and Set the purging order. The purging strategy uses the set
+ /// version to set the purging order.
+ unsigned long purging_order (void) const;
+ void purging_order(unsigned long value);
+
+ /// Check if there are messages pending in the queue
+ /**
+ * @return 1 if the queue is empty
+ */
+ int queue_is_empty (void);
+
+ /// Added event handler to the handlers set.
+ /**
+ * Called by the cache when the cache is closing.
+ *
+ * @param handlers The TAO_Connection_Handler_Set into which the
+ * transport should place its handler
+ */
+ void provide_handler (TAO::Connection_Handler_Set &handlers);
+
+ /// Add event handlers corresponding to transports that have RW wait
+ /// strategy to the handlers set.
+ /**
+ * Called by the cache when the ORB is shuting down.
+ *
+ * @param handlers The TAO_Connection_Handler_Set into which the
+ * transport should place its handler if the transport has RW
+ * strategy on.
+ *
+ * @return true indicates a handler was added to the handler set.
+ * false indocates that the transport did not have a
+ * blockable handler that could be added.
+ */
+ bool provide_blockable_handler (TAO::Connection_Handler_Set &handlers);
+
+ /// Register the handler with the reactor.
+ /**
+ * Register the handler with the reactor. This method is used by the
+ * Wait_On_Reactor strategy. The transport must register its event
+ * handler with the ORB's Reactor.
+ *
+ * @todo I think this method is pretty much useless, the
+ * connections are *always* registered with the Reactor, except in
+ * thread-per-connection mode. In that case putting the connection
+ * in the Reactor would produce unpredictable results anyway.
+ */
+ virtual int register_handler (void);
+
+ /// Write the complete Message_Block chain to the connection.
+ /**
+ * This method serializes on handler_lock_, guaranteeing that only
+ * thread can execute it on the same instance concurrently.
+ *
+ * Often the implementation simply forwards the arguments to the
+ * underlying ACE_Svc_Handler class. Using the code factored out
+ * into ACE.
+ *
+ * Be careful with protocols that perform non-trivial
+ * transformations of the data, such as SSLIOP or protocols that
+ * compress the stream.
+ *
+ * @param iov contains the data that must be sent.
+ *
+ * @param timeout is the maximum time that the application is
+ * willing to wait for the data to be sent, useful in platforms that
+ * implement timed writes.
+ * The timeout value is obtained from the policies set by the
+ * application.
+ *
+ * @param bytes_transferred should return the total number of bytes
+ * successfully transferred before the connection blocked. This is
+ * required because in some platforms and/or protocols multiple
+ * system calls may be required to send the chain of message
+ * blocks. The first few calls can work successfully, but the final
+ * one can fail or signal a flow control situation (via EAGAIN).
+ * In this case the ORB expects the function to return -1, errno to
+ * be appropriately set and this argument to return the number of
+ * bytes already on the OS I/O subsystem.
+ *
+ * This call can also fail if the transport instance is no longer
+ * associated with a connection (e.g., the connection handler closed
+ * down). In that case, it returns -1 and sets errno to
+ * <code>ENOENT</code>.
+ */
+ virtual ssize_t send (iovec *iov,
+ int iovcnt,
+ size_t &bytes_transferred,
+ const ACE_Time_Value *timeout = 0) = 0;
+
+#ifdef ACE_HAS_SENDFILE
+ /// Send data through zero-copy write mechanism, if available.
+ /**
+ * This method sends the data in the I/O vector through the platform
+ * sendfile() function to perform a zero-copy write, if available.
+ * Otherwise, the default fallback implementation simply delegates
+ * to the TAO_Transport::send() method.
+ *
+ * @note This method is best used when sending very large blocks of
+ * data.
+ */
+ virtual ssize_t sendfile (TAO_MMAP_Allocator * allocator,
+ iovec * iov,
+ int iovcnt,
+ size_t &bytes_transferred,
+ ACE_Time_Value const * timeout = 0);
+#endif /* ACE_HAS_SENDFILE */
+
+
+ /// Read len bytes from into buf.
+ /**
+ * This method serializes on handler_lock_, guaranteeing that only
+ * thread can execute it on the same instance concurrently.
+ *
+ * @param buffer ORB allocated buffer where the data should be
+ * @@ The ACE_Time_Value *s is just a place holder for now. It is
+ * not clear this this is the best place to specify this. The actual
+ * timeout values will be kept in the Policies.
+ */
+ virtual ssize_t recv (char *buffer,
+ size_t len,
+ const ACE_Time_Value *timeout = 0) = 0;
+
+ /**
+ * @name Control connection lifecycle
+ *
+ * These methods are routed through the TMS object. The TMS
+ * strategies implement them correctly.
+ */
+ //@{
+
+ /// Request has been just sent, but the reply is not received. Idle
+ /// the transport now.
+ bool idle_after_send (void);
+
+ /// Request is sent and the reply is received. Idle the transport
+ /// now.
+ bool idle_after_reply (void);
+
+ /// Call the implementation method after obtaining the lock.
+ virtual void close_connection (void);
+
+ //@}
+
+ /** @name Template methods
+ *
+ * The Transport class uses the Template Method Pattern to implement
+ * the protocol specific functionality.
+ * Implementors of a pluggable protocol should override the
+ * following methods with the semantics documented below.
+ */
+ /**
+ * Initialising the messaging object. This would be used by the
+ * connector side. On the acceptor side the connection handler
+ * would take care of the messaging objects.
+ */
+ virtual int messaging_init (CORBA::Octet major,
+ CORBA::Octet minor) = 0;
+
+ /// Extracts the list of listen points from the @a cdr stream. The
+ /// list would have the protocol specific details of the
+ /// ListenPoints
+ virtual int tear_listen_point_list (TAO_InputCDR &cdr);
+
+ /// Hooks that can be overridden in concrete transports.
+ /**
+ * These hooks are invoked just after connection establishment (or
+ * after a connection is fetched from cache). The
+ * return value signifies whether the invoker should proceed with
+ * post connection establishment activities. Protocols like SSLIOP
+ * need this to verify whether connections already established have
+ * valid certificates. There are no pre_connect_hooks () since the
+ * transport doesn't exist before a connection establishment. :-)
+ *
+ * @note The methods are not made const with a reason.
+ */
+ virtual bool post_connect_hook (void);
+
+ /// Memory management routines.
+ /*
+ * Forwards to event handler.
+ */
+ ACE_Event_Handler::Reference_Count add_reference (void);
+ ACE_Event_Handler::Reference_Count remove_reference (void);
+
+ /// Return the messaging object that is used to format the data that
+ /// needs to be sent.
+ virtual TAO_Pluggable_Messaging * messaging_object (void) = 0;
+
+ /** @name Template methods
+ *
+ * The Transport class uses the Template Method Pattern to implement
+ * the protocol specific functionality.
+ * Implementors of a pluggable protocol should override the
+ * following methods with the semantics documented below.
+ */
+ //@{
+
+ /// Return the event handler used to receive notifications from the
+ /// Reactor.
+ /**
+ * Normally a concrete TAO_Transport object has-a ACE_Event_Handler
+ * member that functions as an adapter between the ACE_Reactor
+ * framework and the TAO pluggable protocol framework.
+ * In all the protocols implemented so far this role is fullfilled
+ * by an instance of ACE_Svc_Handler.
+ *
+ * @todo Since we only use a limited functionality of
+ * ACE_Svc_Handler we could probably implement a generic
+ * adapter class (TAO_Transport_Event_Handler or something), this
+ * will reduce footprint and simplify the process of implementing a
+ * pluggable protocol.
+ *
+ * @todo This method has to be renamed to event_handler()
+ */
+ virtual ACE_Event_Handler * event_handler_i (void) = 0;
+
+ /// Is this transport really connected
+ bool is_connected (void) const;
+
+ /// Perform all the actions when this transport get opened
+ bool post_open (size_t id);
+
+ /// Get the connection handler for this transport
+ TAO_Connection_Handler * connection_handler (void);
+
+ /// Accessor for the output CDR stream
+ TAO_OutputCDR &out_stream (void);
+
+ /*
+ * Specialization hook to add public methods from
+ * concrete transport implementations to TAO's transport
+ * class
+ */
+ //@@ TAO_TRANSPORT_SPL_PUBLIC_METHODS_ADD_HOOK
+
+protected:
+
+ virtual TAO_Connection_Handler * connection_handler_i (void) = 0;
+
+public:
+
+ /// This is a request for the transport object to write a
+ /// LocateRequest header before it is sent out.
+ int generate_locate_request (TAO_Target_Specification &spec,
+ TAO_Operation_Details &opdetails,
+ TAO_OutputCDR &output);
+
+ /// This is a request for the transport object to write a request
+ /// header before it sends out the request
+ virtual int generate_request_header (TAO_Operation_Details &opd,
+ TAO_Target_Specification &spec,
+ TAO_OutputCDR &msg);
+
+ /// Recache ourselves in the cache
+ int recache_transport (TAO_Transport_Descriptor_Interface* desc);
+
+ /// Callback to read incoming data
+ /**
+ * The ACE_Event_Handler adapter invokes this method as part of its
+ * handle_input() operation.
+ *
+ * @todo the method name is confusing! Calling it handle_input()
+ * would probably make things easier to understand and follow!
+ *
+ * Once a complete message is read the Transport class delegates on
+ * the Messaging layer to invoke the right upcall (on the server) or
+ * the TAO_Reply_Dispatcher (on the client side).
+ *
+ * @param max_wait_time In some cases the I/O is synchronous, e.g. a
+ * thread-per-connection server or when Wait_On_Read is enabled. In
+ * those cases a maximum read time can be specified.
+ *
+ * @param block Is deprecated and ignored.
+ *
+ */
+ virtual int handle_input (TAO_Resume_Handle &rh,
+ ACE_Time_Value *max_wait_time = 0,
+ int block = 0);
+
+ enum
+ {
+ TAO_ONEWAY_REQUEST = 0,
+ TAO_TWOWAY_REQUEST = 1,
+ TAO_REPLY
+ };
+
+ /// Prepare the waiting and demuxing strategy to receive a reply for
+ /// a new request.
+ /**
+ * Preparing the ORB to receive the reply only once the request is
+ * completely sent opens the system to some subtle race conditions:
+ * suppose the ORB is running in a multi-threaded configuration,
+ * thread A makes a request while thread B is using the Reactor to
+ * process all incoming requests.
+ * Thread A could be implemented as follows:
+ * 1) send the request
+ * 2) setup the ORB to receive the reply
+ * 3) wait for the request
+ *
+ * but in this case thread B may receive the reply between step (1)
+ * and (2), and drop it as an invalid or unexpected message.
+ * Consequently the correct implementation is:
+ * 1) setup the ORB to receive the reply
+ * 2) send the request
+ * 3) wait for the reply
+ *
+ * The following method encapsulates this idiom.
+ *
+ * @todo This is generic code, it should be factored out into the
+ * Transport class.
+ */
+ // @nolock b/c this calls send_or_buffer
+ virtual int send_request (TAO_Stub *stub,
+ TAO_ORB_Core *orb_core,
+ TAO_OutputCDR &stream,
+ int message_semantics,
+ ACE_Time_Value *max_time_wait) = 0;
+
+
+
+ /// This method formats the stream and then sends the message on the
+ /// transport.
+ /**
+ * Once the ORB is prepared to receive a reply (see send_request()
+ * above), and all the arguments have been marshaled the CDR stream
+ * must be 'formatted', i.e. the message_size field in the GIOP
+ * header can finally be set to the proper value.
+ *
+ */
+ virtual int send_message (TAO_OutputCDR &stream,
+ TAO_Stub *stub = 0,
+ int message_semantics = TAO_Transport::TAO_TWOWAY_REQUEST,
+ ACE_Time_Value *max_time_wait = 0) = 0;
+
+
+ /// Sent the contents of @a message_block
+ /**
+ * @param stub The object reference used for this operation, useful
+ * to obtain the current policies.
+ * @param message_semantics If this is set to TAO_TWO_REQUEST
+ * this method will block until the operation is completely
+ * written on the wire. If it is set to other values this
+ * operation could return.
+ * @param message_block The CDR encapsulation of the GIOP message
+ * that must be sent. The message may consist of
+ * multiple Message Blocks chained through the cont()
+ * field.
+ * @param max_wait_time The maximum time that the operation can
+ * block, used in the implementation of timeouts.
+ */
+ virtual int send_message_shared (TAO_Stub *stub,
+ int message_semantics,
+ const ACE_Message_Block *message_block,
+ ACE_Time_Value *max_wait_time);
+
+protected:
+
+ /// Process the message by sending it to the higher layers of the
+ /// ORB.
+ int process_parsed_messages (TAO_Queued_Data *qd,
+ TAO_Resume_Handle &rh);
+
+ /// Implement send_message_shared() assuming the handler_lock_ is
+ /// held.
+ int send_message_shared_i (TAO_Stub *stub,
+ int message_semantics,
+ const ACE_Message_Block *message_block,
+ ACE_Time_Value *max_wait_time);
+
+ /// Queue a message for @a message_block
+ int queue_message_i (const ACE_Message_Block *message_block);
+
+public:
+ /// Format and queue a message for @a stream
+ int format_queue_message (TAO_OutputCDR &stream);
+
+ /// Send a message block chain,
+ int send_message_block_chain (const ACE_Message_Block *message_block,
+ size_t &bytes_transferred,
+ ACE_Time_Value *max_wait_time = 0);
+
+ /// Send a message block chain, assuming the lock is held
+ int send_message_block_chain_i (const ACE_Message_Block *message_block,
+ size_t &bytes_transferred,
+ ACE_Time_Value *max_wait_time);
+ /// Cache management
+ int purge_entry (void);
+
+ /// Cache management
+ int make_idle (void);
+
+ /// Cache management
+ int update_transport (void);
+
+ /// The timeout callback, invoked when any of the timers related to
+ /// this transport expire.
+ /**
+ * @param current_time The current time as reported from the Reactor
+ * @param act The Asynchronous Completion Token. Currently it is
+ * interpreted as follows:
+ * - If the ACT is the address of this->current_deadline_ the
+ * queueing timeout has expired and the queue should start
+ * flushing.
+ *
+ * @return Returns 0 if there are no problems, -1 if there is an
+ * error
+ *
+ * @todo In the future this function could be used to expire
+ * messages (oneways) that have been sitting for too long on
+ * the queue.
+ */
+ int handle_timeout (const ACE_Time_Value &current_time,
+ const void* act);
+
+ /// Accessor to recv_buffer_size_
+ size_t recv_buffer_size (void) const;
+
+ /// Accessor to sent_byte_count_
+ size_t sent_byte_count (void) const;
+
+ /// CodeSet Negotiation - Get the char codeset translator factory
+ TAO_Codeset_Translator_Base *char_translator (void) const;
+
+ /// CodeSet Negotiation - Get the wchar codeset translator factory
+ TAO_Codeset_Translator_Base *wchar_translator (void) const;
+
+ /// CodeSet negotiation - Set the char codeset translator factory
+ void char_translator (TAO_Codeset_Translator_Base *);
+
+ /// CodeSet negotiation - Set the wchar codeset translator factory
+ void wchar_translator (TAO_Codeset_Translator_Base *);
+
+ /// Use the Transport's codeset factories to set the translator for input
+ /// and output CDRs.
+ void assign_translators (TAO_InputCDR *, TAO_OutputCDR *);
+
+ /// It is necessary to clear the codeset translator when a CDR stream
+ /// is used for more than one GIOP message. This is required since the
+ /// header must not be translated, whereas the body must be.
+ void clear_translators (TAO_InputCDR *, TAO_OutputCDR *);
+
+ /// Return true if the tcs has been set
+ CORBA::Boolean is_tcs_set() const;
+
+ /// Set the state of the first_request_ flag to 0
+ void first_request_sent();
+
+ /// Notify all the components inside a Transport when the underlying
+ /// connection is closed.
+ void send_connection_closed_notifications (void);
+
+private:
+
+ /// Helper method that returns the Transport Cache Manager.
+ TAO::Transport_Cache_Manager &transport_cache_manager (void);
+
+ /// Send some of the data in the queue.
+ /**
+ * As the outgoing data is drained this method is invoked to send as
+ * much of the current message as possible.
+ *
+ * Returns 0 if there is more data to send, -1 if there was an error
+ * and 1 if the message was completely sent.
+ */
+ int drain_queue (void);
+
+ /// Implement drain_queue() assuming the lock is held
+ int drain_queue_i (void);
+
+ /// This class needs priviledged access to
+ /// - queue_is_empty_i()
+ /// - drain_queue_i()
+ friend class TAO_Block_Flushing_Strategy;
+
+ /// Check if there are messages pending in the queue
+ /**
+ * This version assumes that the lock is already held. Use with
+ * care!
+ *
+ * @return 1 if the queue is empty
+ */
+ int queue_is_empty_i (void);
+
+ /// A helper routine used in drain_queue_i()
+ int drain_queue_helper (int &iovcnt, iovec iov[]);
+
+ /// These classes need privileged access to:
+ /// - schedule_output_i()
+ /// - cancel_output_i()
+ friend class TAO_Reactive_Flushing_Strategy;
+ friend class TAO_Leader_Follower_Flushing_Strategy;
+
+ /// Needs priveleged access to
+ /// event_handler_i ()
+ friend class TAO_Thread_Per_Connection_Handler;
+
+ /// Schedule handle_output() callbacks
+ int schedule_output_i (void);
+
+ /// Cancel handle_output() callbacks
+ int cancel_output_i (void);
+
+ /// Cleanup the queue.
+ /**
+ * Exactly @a byte_count bytes have been sent, the queue must be
+ * cleaned up as potentially several messages have been completely
+ * sent out.
+ * It leaves on head_ the next message to send out.
+ */
+ void cleanup_queue (size_t byte_count);
+
+ /// Cleanup the complete queue
+ void cleanup_queue_i ();
+
+ /// Check if the buffering constraints have been reached
+ int check_buffering_constraints_i (TAO_Stub *stub, bool &must_flush);
+
+ /// Send a synchronous message, i.e. block until the message is on
+ /// the wire
+ int send_synchronous_message_i (const ACE_Message_Block *message_block,
+ ACE_Time_Value *max_wait_time);
+
+ /// Send a reply message, i.e. do not block until the message is on
+ /// the wire, but just return after adding them to the queue.
+ int send_reply_message_i (const ACE_Message_Block *message_block,
+ ACE_Time_Value *max_wait_time);
+
+ /// Send an asynchronous message, i.e. do not block until the message is on
+ /// the wire
+ int send_asynchronous_message_i (TAO_Stub *stub,
+ const ACE_Message_Block *message_block,
+ ACE_Time_Value *max_wait_time);
+
+ /// A helper method used by send_synchronous_message_i() and
+ /// send_reply_message_i(). Reusable code that could be used by both
+ /// the methods.
+ int send_synch_message_helper_i (TAO_Synch_Queued_Message &s,
+ ACE_Time_Value *max_wait_time);
+
+ /// Check if the flush timer is still pending
+ int flush_timer_pending (void) const;
+
+ /// The flush timer expired or was explicitly cancelled, mark it as
+ /// not pending
+ void reset_flush_timer (void);
+
+ /// Print out error messages if the event handler is not valid
+ void report_invalid_event_handler (const char *caller);
+
+ /// Is invoked by handle_input operation. It consolidate message on
+ /// top of incoming_message_stack. The amount of missing data is
+ /// known and recv operation copies data directly into message buffer,
+ /// as much as a single recv-invocation provides.
+ int handle_input_missing_data (TAO_Resume_Handle &rh,
+ ACE_Time_Value *max_wait_time,
+ TAO_Queued_Data *q_data);
+
+ /// Is invoked by handle_input operation. It parses new messages from input stream
+ /// or consolidates messages whose header has been partially read, the message
+ /// size being unknown so far. It parses as much data as a single recv-invocation provides.
+ int handle_input_parse_data (TAO_Resume_Handle &rh,
+ ACE_Time_Value *max_wait_time);
+
+ /// Is invoked by handle_input_parse_data. Parses all messages remaining
+ /// in @a message_block.
+ int handle_input_parse_extra_messages (ACE_Message_Block &message_block);
+
+ /// @return -1 error, otherwise 0
+ int consolidate_enqueue_message (TAO_Queued_Data *qd);
+
+ /// @return -1 error, otherwise 0
+ int consolidate_process_message (TAO_Queued_Data *qd, TAO_Resume_Handle &rh);
+
+ /*
+ * Process the message that is in the head of the incoming queue.
+ * If there are more messages in the queue, this method calls
+ * this->notify_reactor () to wake up a thread
+ * @retval -1 on error
+ * @retval 0 if successfully processing enqueued messages
+ * @retval 1 if no message present in queue
+ */
+ int process_queue_head (TAO_Resume_Handle &rh);
+
+ /*
+ * This call prepares a new handler for the notify call and sends a
+ * notify () call to the reactor.
+ */
+ int notify_reactor (void);
+
+ /// Assume the lock is held
+ void send_connection_closed_notifications_i (void);
+
+ /// Allocate a partial message block and store it in our
+ /// partial_message_ data member.
+ void allocate_partial_message_block (void);
+
+ // Disallow copying and assignment.
+ TAO_Transport (const TAO_Transport&);
+ void operator= (const TAO_Transport&);
+
+ /*
+ * Specialization hook to add concrete private methods from
+ * TAO's protocol implementation onto the base Transport class
+ */
+
+ //@@ TAO_TRANSPORT_SPL_PRIVATE_METHODS_ADD_HOOK
+
+protected:
+
+ /// IOP protocol tag.
+ CORBA::ULong const tag_;
+
+ /// Global orbcore resource.
+ TAO_ORB_Core * const orb_core_;
+
+ /// Our entry in the cache. We don't own this. It is here for our
+ /// convenience. We cannot just change things around.
+ TAO::Transport_Cache_Manager::HASH_MAP_ENTRY *cache_map_entry_;
+
+ /// Strategy to decide whether multiple requests can be sent over the
+ /// same connection or the connection is exclusive for a request.
+ TAO_Transport_Mux_Strategy *tms_;
+
+ /// Strategy for waiting for the reply after sending the request.
+ TAO_Wait_Strategy *ws_;
+
+ /// Use to check if bidirectional info has been synchronized with
+ /// the peer.
+ /**
+ * Have we sent any info on bidirectional information or have we
+ * received any info regarding making the connection served by this
+ * transport bidirectional.
+ * The flag is used as follows:
+ * + We dont want to send the bidirectional context info more than
+ * once on the connection. Why? Waste of marshalling and
+ * demarshalling time on the client.
+ * + On the server side -- once a client that has established the
+ * connection asks the server to use the connection both ways, we
+ * *dont* want the server to pack service info to the client. That
+ * is not allowed. We need a flag to prevent such a things from
+ * happening.
+ *
+ * The value of this flag will be 0 if the client sends info and 1
+ * if the server receives the info.
+ */
+ int bidirectional_flag_;
+
+ TAO::Connection_Role opening_connection_role_;
+
+ /// Implement the outgoing data queue
+ TAO_Queued_Message *head_;
+ TAO_Queued_Message *tail_;
+
+ /// Queue of the consolidated, incoming messages..
+ TAO_Incoming_Message_Queue incoming_message_queue_;
+
+ /// Stack of incoming fragments, consolidated messages
+ /// are going to be enqueued in "incoming_message_queue_"
+ TAO::Incoming_Message_Stack incoming_message_stack_;
+
+ /// The queue will start draining no later than <queeing_deadline_>
+ /// *if* the deadline is
+ ACE_Time_Value current_deadline_;
+
+ /// The timer ID
+ long flush_timer_id_;
+
+ /// The adapter used to receive timeout callbacks from the Reactor
+ TAO_Transport_Timer transport_timer_;
+
+ /// Lock that insures that activities that *might* use handler-related
+ /// resources (such as a connection handler) get serialized.
+ /**
+ * This is an <code>ACE_Lock</code> that gets initialized from
+ * @c TAO_ORB_Core::resource_factory()->create_cached_connection_lock().
+ * This way, one can use a lock appropriate for the type of system, i.e.,
+ * a null lock for single-threaded systems, and a real lock for
+ * multi-threaded systems.
+ */
+ mutable ACE_Lock *handler_lock_;
+
+ /// A unique identifier for the transport.
+ /**
+ * This never *never* changes over the lifespan, so we don't have to worry
+ * about locking it.
+ *
+ * HINT: Protocol-specific transports that use connection handler
+ * might choose to set this to the handle for their connection.
+ */
+ size_t id_;
+
+ /// Used by the LRU, LFU and FIFO Connection Purging Strategies.
+ unsigned long purging_order_;
+
+ /// Size of the buffer received.
+ size_t recv_buffer_size_;
+
+ /// Number of bytes sent.
+ size_t sent_byte_count_;
+
+ /// Is this transport really connected or not. In case of oneways with
+ /// SYNC_NONE Policy we don't wait until the connection is ready and we
+ /// buffer the requests in this transport until the connection is ready
+ bool is_connected_;
+
+private:
+
+ /// @@Phil, I think it would be nice if we could think of a way to
+ /// do the following.
+ /// We have been trying to use the transport for marking about
+ /// translator factories and such! IMHO this is a wrong encapulation
+ /// ie. trying to populate the transport object with these
+ /// details. We should probably have a class something like
+ /// TAO_Message_Property or TAO_Message_Translator or whatever (I am
+ /// sure you get the idea) and encapsulate all these
+ /// details. Coupling these seems odd. if I have to be more cynical
+ /// we can move this to the connection_handler and it may more sense
+ /// with the DSCP stuff around there. Do you agree?
+
+ /// Additional member values required to support codeset translation
+ TAO_Codeset_Translator_Base *char_translator_;
+ TAO_Codeset_Translator_Base *wchar_translator_;
+
+ /// The tcs_set_ flag indicates that negotiation has occured and so the
+ /// translators are correct, since a null translator is valid if both ends
+ /// are using the same codeset, whatever that codeset might be.
+ CORBA::Boolean tcs_set_;
+
+ /// First_request_ is true until the first request is sent or received. This
+ /// is necessary since codeset context information is necessary only on the
+ /// first request. After that, the translators are fixed for the life of the
+ /// connection.
+ CORBA::Boolean first_request_;
+
+ /// Holds the partial GIOP message (if there is one)
+ ACE_Message_Block* partial_message_;
+
+#ifdef ACE_HAS_SENDFILE
+ /// mmap()-based allocator used to allocator output CDR buffers.
+ /**
+ * If this pointer is non-zero, sendfile() will be used to send data
+ * in a TAO_OutputCDR stream instance.
+ */
+ TAO_MMAP_Allocator * const mmap_allocator_;
+#endif /* ACE_HAS_SENDFILE */
+
+ /*
+ * specialization hook to add class members from concrete
+ * transport class onto the base transport class. Please
+ * add any private members to this class *before* this hook.
+ */
+ //@@ TAO_TRANSPORT_SPL_DATA_MEMBERS_ADD_HOOK
+};
+
+/*
+ * Hook to add external typedefs and specializations to
+ * TAO's transport implementation.
+ */
+
+//@@ TAO_TRANSPORT_SPL_EXTERN_ADD_HOOK
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/Transport.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_TRANSPORT_H */
diff --git a/TAO/tao/Transport.inl b/TAO/tao/Transport.inl
new file mode 100644
index 00000000000..ef9faafb1ac
--- /dev/null
+++ b/TAO/tao/Transport.inl
@@ -0,0 +1,192 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE CORBA::ULong
+TAO_Transport::tag (void) const
+{
+ return this->tag_;
+}
+
+ACE_INLINE TAO_ORB_Core *
+TAO_Transport::orb_core (void) const
+{
+ return this->orb_core_;
+}
+
+ACE_INLINE TAO_Transport_Mux_Strategy *
+TAO_Transport::tms (void) const
+{
+ return tms_;
+}
+
+// Return the Wait strategy used by the Transport.
+ACE_INLINE TAO_Wait_Strategy *
+TAO_Transport::wait_strategy (void) const
+{
+ return this->ws_;
+}
+
+ACE_INLINE int
+TAO_Transport::bidirectional_flag (void) const
+{
+ return this->bidirectional_flag_;
+}
+
+ACE_INLINE void
+TAO_Transport::bidirectional_flag (int flag)
+{
+ this->bidirectional_flag_ = flag;
+}
+
+ACE_INLINE TAO::Connection_Role
+TAO_Transport::opened_as () const
+{
+ return this->opening_connection_role_;
+}
+
+ACE_INLINE void
+TAO_Transport::opened_as (TAO::Connection_Role role)
+{
+ this->opening_connection_role_ = role;
+}
+
+ACE_INLINE TAO::Transport_Cache_Manager::HASH_MAP_ENTRY *
+TAO_Transport::cache_map_entry (void)
+{
+ return this->cache_map_entry_;
+}
+
+ACE_INLINE void
+TAO_Transport::cache_map_entry (
+ TAO::Transport_Cache_Manager::HASH_MAP_ENTRY *entry)
+{
+ this->cache_map_entry_ = entry;
+}
+
+ACE_INLINE unsigned long
+TAO_Transport::purging_order (void) const
+{
+ return this->purging_order_;
+}
+
+ACE_INLINE void
+TAO_Transport::purging_order (unsigned long value)
+{
+ // This should only be called by the Transport Cache Manager when
+ // it is holding it's lock.
+ // The transport should still be here since the cache manager still
+ // has a reference to it.
+ this->purging_order_ = value;
+}
+
+ACE_INLINE size_t
+TAO_Transport::id (void) const
+{
+ return this->id_;
+}
+
+ACE_INLINE void
+TAO_Transport::id (size_t id)
+{
+ this->id_ = id;
+}
+
+ACE_INLINE int
+TAO_Transport::queue_is_empty (void)
+{
+ ACE_GUARD_RETURN (ACE_Lock,
+ ace_mon,
+ *this->handler_lock_,
+ -1);
+ return this->queue_is_empty_i ();
+}
+
+ACE_INLINE int
+TAO_Transport::flush_timer_pending (void) const
+{
+ return this->flush_timer_id_ != -1;
+}
+
+ACE_INLINE void
+TAO_Transport::reset_flush_timer (void)
+{
+ this->flush_timer_id_ = -1;
+ this->current_deadline_ = ACE_Time_Value::zero;
+}
+
+//********************************************************************
+// codeset related methods
+
+
+ACE_INLINE TAO_Codeset_Translator_Base *
+TAO_Transport::char_translator (void) const
+{
+ return this->char_translator_;
+}
+
+ACE_INLINE TAO_Codeset_Translator_Base *
+TAO_Transport::wchar_translator (void) const
+{
+ return this->wchar_translator_;
+}
+
+ACE_INLINE void
+TAO_Transport::char_translator (TAO_Codeset_Translator_Base *tf)
+{
+ this->char_translator_ = tf;
+ this->tcs_set_ = 1;
+}
+
+ACE_INLINE void
+TAO_Transport::wchar_translator (TAO_Codeset_Translator_Base *tf)
+{
+ this->wchar_translator_ = tf;
+ this->tcs_set_ = 1;
+}
+
+/// CodeSet negotiation
+ACE_INLINE CORBA::Boolean
+TAO_Transport::is_tcs_set(void) const
+{
+ return tcs_set_;
+}
+
+ACE_INLINE void
+TAO_Transport::first_request_sent (void)
+{
+ this->first_request_ = 0;
+}
+
+ACE_INLINE bool
+TAO_Transport::is_connected (void) const
+{
+ ACE_GUARD_RETURN (ACE_Lock,
+ ace_mon,
+ *this->handler_lock_,
+ false);
+
+ return this->is_connected_;
+}
+
+ACE_INLINE TAO_Connection_Handler *
+TAO_Transport::connection_handler (void)
+{
+ return this->connection_handler_i();
+}
+
+ACE_INLINE size_t
+TAO_Transport::recv_buffer_size (void) const
+{
+ return this->recv_buffer_size_;
+}
+
+ACE_INLINE size_t
+TAO_Transport::sent_byte_count (void) const
+{
+ return this->sent_byte_count_;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Transport_Acceptor.cpp b/TAO/tao/Transport_Acceptor.cpp
new file mode 100644
index 00000000000..5fd09d0c402
--- /dev/null
+++ b/TAO/tao/Transport_Acceptor.cpp
@@ -0,0 +1,29 @@
+// $Id$
+
+#include "tao/Transport_Acceptor.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/Transport_Acceptor.inl"
+#endif /* __ACE_INLINE__ */
+
+ACE_RCSID (tao,
+ Acceptor,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Acceptor::TAO_Acceptor (CORBA::ULong tag)
+ : tag_ (tag)
+{
+}
+
+TAO_Acceptor::~TAO_Acceptor (void)
+{
+
+ //@@ TAO_ACCEPTOR_DESTRUCTOR_ADD_HOOK
+}
+
+//@@ TAO_ACCEPTOR_SPL_METHODS_ADD_HOOK
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Transport_Acceptor.h b/TAO/tao/Transport_Acceptor.h
new file mode 100644
index 00000000000..f49ac1b4190
--- /dev/null
+++ b/TAO/tao/Transport_Acceptor.h
@@ -0,0 +1,166 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Transport_Acceptor.h
+ *
+ * $Id$
+ *
+ * Interface for the Acceptor component of the TAO pluggable protocol
+ * framework.
+ *
+ * @author Fred Kuhns <fredk@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_ACCEPTOR_H
+#define TAO_ACCEPTOR_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/TAO_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Basic_Types.h"
+
+// Forward declarations.
+ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+class ACE_Addr;
+class ACE_Reactor;
+ACE_END_VERSIONED_NAMESPACE_DECL
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_ORB_Core;
+class TAO_MProfile;
+class TAO_Endpoint;
+class TAO_Transport;
+
+namespace IOP
+{
+ struct TaggedProfile;
+}
+
+namespace TAO
+{
+ class ObjectKey;
+}
+
+//@@ TAO_ACCEPTOR_SPL_INCLUDE_FORWARD_DECL_ADD_HOOK
+
+// ****************************************************************
+
+/// The TAO-specific OMG assigned value for the TAG_ORB_TYPE tagged
+/// component.
+/**
+ * This number was assigned by the OMG. Do *NOT* change. The ASCII
+ * representation is "TA\x00". If necessary, we can request more ORB
+ * types later.
+ */
+const CORBA::ULong TAO_ORB_TYPE = 0x54414f00U;
+
+// ****************************************************************
+
+/**
+ * @class TAO_Acceptor
+ *
+ * @brief Abstract Acceptor class used for pluggable transports.
+ *
+ * Base class for the Acceptor bridge class.
+ *
+ * @todo Need to rename the class as TAO_Transport_Acceptor.
+ */
+class TAO_Export TAO_Acceptor
+{
+public:
+ TAO_Acceptor (CORBA::ULong tag);
+
+ /// Destructor
+ virtual ~TAO_Acceptor (void);
+
+ /// The tag, each concrete class will have a specific tag value.
+ CORBA::ULong tag (void) const;
+
+ /// Method to initialize acceptor for address.
+ virtual int open (TAO_ORB_Core *orb_core,
+ ACE_Reactor *reactor,
+ int version_major,
+ int version_minor,
+ const char *address,
+ const char *options = 0) = 0;
+
+ /**
+ * Open an acceptor with the given protocol version on a default
+ * endpoint
+ */
+ virtual int open_default (TAO_ORB_Core *,
+ ACE_Reactor *reactor,
+ int version_major,
+ int version_minor,
+ const char *options = 0) = 0;
+
+ /// Closes the acceptor
+ virtual int close (void) = 0;
+
+ /**
+ * Create the corresponding profile for this endpoint.
+ * If share_profile is set to true, the pluggable protocol
+ * implementation should try to add the endpoint to a profile
+ * in the mprofile that is of the same type. Currently, this
+ * is used when RT CORBA is enabled.
+ */
+ virtual int create_profile (const TAO::ObjectKey &object_key,
+ TAO_MProfile &mprofile,
+ CORBA::Short priority) = 0;
+
+ /// Return 1 if the @a endpoint has the same address as the acceptor.
+ virtual int is_collocated (const TAO_Endpoint* endpoint) = 0;
+
+ /**
+ * Returns the number of endpoints this acceptor is listening on. This
+ * is used for determining how many profiles will be generated
+ * for this acceptor.
+ */
+ virtual CORBA::ULong endpoint_count (void) = 0;
+
+ /**
+ * This method fetches the @a key from the @a profile. Protocols that
+ * are pluggable can send data that are specific in the
+ * @c profile_data field encapsulated as a octet stream. This method
+ * allows those protocols to get the object key from the
+ * encapsulation.
+ */
+ virtual int object_key (IOP::TaggedProfile &profile,
+ TAO::ObjectKey &key) = 0;
+
+ /*
+ * Hook to add public methods from derived acceptor classes onto
+ * this class.
+ */
+ //@@ TAO_ACCEPTOR_SPL_PUBLIC_METHODS_ADD_HOOK
+
+private:
+ /// IOP protocol tag.
+ CORBA::ULong const tag_;
+
+ /*
+ * Hook to add data members from concrete acceptor implementations onto
+ * the base class.
+ */
+ //@@ TAO_ACCEPTOR_SPL_DATA_MEMBERS_ADD_HOOK
+};
+
+//@@ TAO_ACCEPTOR_SPL_EXTERN_ADD_HOOK
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/Transport_Acceptor.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_ACCEPTOR_H */
diff --git a/TAO/tao/Transport_Acceptor.inl b/TAO/tao/Transport_Acceptor.inl
new file mode 100644
index 00000000000..7767ec6b43e
--- /dev/null
+++ b/TAO/tao/Transport_Acceptor.inl
@@ -0,0 +1,13 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE CORBA::ULong
+TAO_Acceptor::tag (void) const
+{
+ return this->tag_;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Transport_Cache_Manager.cpp b/TAO/tao/Transport_Cache_Manager.cpp
new file mode 100644
index 00000000000..270a0562088
--- /dev/null
+++ b/TAO/tao/Transport_Cache_Manager.cpp
@@ -0,0 +1,723 @@
+//$Id$
+#include "tao/Transport_Cache_Manager.h"
+#include "tao/Transport.h"
+#include "tao/debug.h"
+#include "tao/ORB_Core.h"
+#include "tao/Connection_Purging_Strategy.h"
+#include "tao/Client_Strategy_Factory.h"
+#include "tao/Condition.h"
+#include "tao/Wait_Strategy.h"
+#include "ace/ACE.h"
+#include "ace/Reactor.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/Transport_Cache_Manager.inl"
+#endif /* __ACE_INLINE__ */
+
+
+ACE_RCSID (tao,
+ Transport_Cache_Manager,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ Transport_Cache_Manager::Transport_Cache_Manager (TAO_ORB_Core &orb_core)
+ : percent_ (orb_core.resource_factory ()->purge_percentage ())
+ , purging_strategy_ (orb_core.resource_factory ()->create_purging_strategy ())
+ , cache_map_ (orb_core.resource_factory ()->cache_maximum ())
+ , condition_ (0)
+ , cache_lock_ (0)
+ , muxed_number_ (orb_core.resource_factory ()->max_muxed_connections ())
+ , no_waiting_threads_ (0)
+ , last_entry_returned_ (0)
+ {
+ if (orb_core.resource_factory ()->locked_transport_cache ())
+ {
+ ACE_NEW (this->condition_,
+ TAO_Condition <TAO_SYNCH_MUTEX>);
+
+ ACE_NEW (this->cache_lock_,
+ ACE_Lock_Adapter <TAO_SYNCH_MUTEX> (*this->condition_->mutex ()));
+ }
+ else
+ {
+ /// If the cache is not going to be locked then dont create a
+ /// condition variable. Make the <muxed_number_> to 0, else a
+ /// single thread could get into waiting mode
+ this->muxed_number_ = 0;
+ ACE_NEW (this->cache_lock_,
+ ACE_Lock_Adapter<ACE_SYNCH_NULL_MUTEX>);
+ }
+ }
+
+ Transport_Cache_Manager::~Transport_Cache_Manager (void)
+ {
+ // Wakeup all the waiting threads threads before we shutdown stuff
+ if (this->no_waiting_threads_)
+ {
+ this->condition_->broadcast ();
+ }
+
+ // Delete the lock that we have
+ if (this->cache_lock_)
+ {
+ delete this->cache_lock_;
+ this->cache_lock_ = 0;
+ }
+
+ // Delete the purging strategy
+ if (this->purging_strategy_)
+ {
+ delete this->purging_strategy_;
+ this->purging_strategy_ = 0;
+ }
+
+ // Delete the condition variable
+ if (this->condition_)
+ {
+ delete this->condition_;
+ this->condition_ = 0;
+ }
+ }
+
+
+ int
+ Transport_Cache_Manager::bind_i (Cache_ExtId &ext_id,
+ Cache_IntId &int_id)
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - Transport_Cache_Manager::bind_i, "
+ "0x%x -> 0x%x Transport[%d]\n",
+ ext_id.property (),
+ int_id.transport (),
+ int_id.transport ()->id ()));
+ }
+
+ // Get the entry too
+ HASH_MAP_ENTRY *entry = 0;
+
+ // Update the purging strategy information while we
+ // are holding our lock
+ this->purging_strategy_->update_item (int_id.transport ());
+
+ int retval = this->cache_map_.bind (ext_id,
+ int_id,
+ entry);
+ if (retval == 0)
+ {
+ // The entry has been added to cache succesfully
+ // Add the cache_map_entry to the transport
+ int_id.transport ()->cache_map_entry (entry);
+ }
+ else if (retval == 1)
+ {
+ if (TAO_debug_level > 4)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - Transport_Cache_Manager::bind_i, "
+ "unable to bind in the first attempt. "
+ "Trying with a new index\n"));
+ }
+
+ // There was an entry like this before, so let us do some
+ // minor adjustments and rebind
+ retval = this->get_last_index_bind (ext_id,
+ int_id,
+ entry);
+ if (retval == 0)
+ {
+ int_id.transport ()->cache_map_entry (entry);
+ }
+ }
+
+ if (TAO_debug_level > 5 && retval != 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "TAO (%P|%t) - Transport_Cache_Manager::bind_i, "
+ "unable to bind\n"));
+ }
+ else if (TAO_debug_level > 3)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - Transport_Cache_Manager::bind_i, "
+ "cache size is [%d]\n",
+ this->current_size ()));
+ }
+
+ return retval;
+ }
+
+ int
+ Transport_Cache_Manager::find_transport (
+ TAO_Transport_Descriptor_Interface *prop,
+ TAO_Transport *&transport)
+ {
+ if (prop == 0)
+ {
+ transport = 0;
+ return -1;
+ }
+
+ // Compose the ExternId
+ Cache_ExtId ext_id (prop);
+ Cache_IntId int_id;
+
+ int retval = this->find (ext_id,
+ int_id);
+ if (retval == 0)
+ {
+ transport = int_id.relinquish_transport ();
+
+ if (transport->wait_strategy ()->non_blocking () == 0 &&
+ transport->orb_core ()->client_factory ()->use_cleanup_options ())
+ {
+ ACE_Event_Handler *eh =
+ transport->event_handler_i ();
+
+ ACE_Reactor *r =
+ transport->orb_core ()->reactor ();
+
+ if (eh &&
+ r->remove_handler (eh,
+ ACE_Event_Handler::READ_MASK |
+ ACE_Event_Handler::DONT_CALL) == -1)
+ {
+ if (TAO_debug_level > 0)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) - TAO_Transport_Cache_Manager[%d]")
+ ACE_TEXT ("::find_transport, remove_handler failed \n"),
+ transport->id ()));
+ }
+ else
+ {
+ transport->wait_strategy ()->is_registered (false);
+ }
+ }
+ }
+
+ return retval;
+ }
+
+ int
+ Transport_Cache_Manager::find (const Cache_ExtId &key,
+ Cache_IntId &value)
+ {
+ ACE_MT (ACE_GUARD_RETURN (ACE_Lock,
+ guard,
+ *this->cache_lock_,
+ -1));
+
+ int status = this->find_i (key,
+ value);
+
+ if (status == 0)
+ {
+ // Update the purging strategy information while we
+ // are holding our lock
+ this->purging_strategy_->update_item (value.transport ());
+ }
+
+ return status;
+ }
+
+ int
+ Transport_Cache_Manager::find_i (const Cache_ExtId &key,
+ Cache_IntId &value)
+ {
+ HASH_MAP_ENTRY *entry = 0;
+
+ // Get the entry from the Hash Map
+ int retval = 0;
+
+ // Make a temporary object. It does not do a copy.
+ Cache_ExtId tmp_key (key.property ());
+
+ while (retval == 0)
+ {
+ // Wait for a connection..
+ this->wait_for_connection (tmp_key);
+
+ // Look for an entry in the map
+ retval = this->cache_map_.find (tmp_key,
+ entry);
+
+ // We have an entry in the map, check whether it is idle.
+ if (entry)
+ {
+ CORBA::Boolean idle =
+ this->is_entry_idle (entry);
+
+ if (idle)
+ {
+ // Successfully found a TAO_Transport.
+
+ entry->int_id_.recycle_state (ENTRY_BUSY);
+
+ // NOTE: This assignment operator indirectly incurs two
+ // lock operations since it duplicates and releases
+ // TAO_Transport objects.
+ value = entry->int_id_;
+
+ if (TAO_debug_level > 4)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT("TAO (%P|%t) - Transport_Cache_Manager::find_i, ")
+ ACE_TEXT("at index %d (Transport[%d]) - idle\n"),
+ entry->ext_id_.index (),
+ entry->int_id_.transport ()->id ()));
+ }
+
+ return 0;
+ }
+ else if (TAO_debug_level > 6)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT("TAO (%P|%t) - Transport_Cache_Manager::find_i, ")
+ ACE_TEXT("at index %d (Transport[%d]) - not idle\n"),
+ entry->ext_id_.index (),
+ entry->int_id_.transport ()->id ()));
+ }
+ }
+
+ // Bump the index up
+ tmp_key.incr_index ();
+ }
+
+ // If we are here then it is an error
+ if (TAO_debug_level > 4 && retval != 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "TAO (%P|%t) - Transport_Cache_Manager::find_i, "
+ "no idle transport is available\n"));
+ }
+
+ return retval;
+ }
+
+ int
+ Transport_Cache_Manager::make_idle_i (HASH_MAP_ENTRY *&entry)
+ {
+ if (entry == 0)
+ return -1;
+
+ entry->int_id_.recycle_state (ENTRY_IDLE_AND_PURGABLE);
+
+ // Does any one need waking?
+ if (this->no_waiting_threads_)
+ {
+ // We returned this entry to the map
+ this->last_entry_returned_ = &entry->ext_id_;
+
+ // Wake up a thread
+ this->condition_->signal ();
+ }
+
+ return 0;
+ }
+
+ int
+ Transport_Cache_Manager::update_entry (HASH_MAP_ENTRY *&entry)
+ {
+ if(entry == 0)
+ return -1;
+
+ ACE_MT (ACE_GUARD_RETURN (ACE_Lock,
+ guard,
+ *this->cache_lock_, -1));
+
+ if (entry == 0)
+ return -1;
+
+ TAO_Connection_Purging_Strategy *st = this->purging_strategy_;
+ (void) st->update_item (entry->int_id_.transport ());
+
+ return 0;
+ }
+
+ int
+ Transport_Cache_Manager::close_i (Connection_Handler_Set &handlers)
+ {
+ HASH_MAP_ITER end_iter = this->cache_map_.end ();
+
+ for (HASH_MAP_ITER iter = this->cache_map_.begin ();
+ iter != end_iter;
+ ++iter)
+ {
+ // Get the transport to fill its associated connection's handler.
+ (*iter).int_id_.transport ()->provide_handler (handlers);
+
+ // Inform the transport that has a reference to the entry in the
+ // map that we are *gone* now. So, the transport should not use
+ // the reference to the entry that he has, to acces us *at any
+ // time*.
+ (*iter).int_id_.transport ()->cache_map_entry (0);
+ }
+
+ // Unbind all the entries in the map
+ this->cache_map_.unbind_all ();
+
+ return 0;
+ }
+
+ bool
+ Transport_Cache_Manager::blockable_client_transports_i (
+ Connection_Handler_Set &h)
+ {
+ HASH_MAP_ITER end_iter = this->cache_map_.end ();
+
+ for (HASH_MAP_ITER iter = this->cache_map_.begin ();
+ iter != end_iter;
+ ++iter)
+ {
+ // Get the transport to fill its associated connection's
+ // handler.
+ bool retval =
+ (*iter).int_id_.transport ()->provide_blockable_handler (h);
+
+ // Do not mark the entry as closed if we don't have a
+ // blockable handler added
+ if (retval)
+ (*iter).int_id_.recycle_state (ENTRY_CLOSED);
+ }
+
+ return true;
+ }
+
+ int
+ Transport_Cache_Manager::purge_entry_i (HASH_MAP_ENTRY *&entry)
+ {
+ if (entry == 0)
+ {
+ return 0;
+ }
+
+ // Remove the entry from the Map
+ int retval = this->cache_map_.unbind (entry);
+
+ // Set the entry pointer to zero
+ entry = 0;
+
+ return retval;
+ }
+
+ void
+ Transport_Cache_Manager::mark_invalid_i (HASH_MAP_ENTRY *&entry)
+ {
+ if (entry == 0)
+ {
+ return;
+ }
+
+ // Mark the entry as not usable
+ entry->int_id_.recycle_state (ENTRY_PURGABLE_BUT_NOT_IDLE);
+ }
+
+ int
+ Transport_Cache_Manager::get_last_index_bind (Cache_ExtId &key,
+ Cache_IntId &val,
+ HASH_MAP_ENTRY *&entry)
+ {
+ CORBA::ULong ctr = entry->ext_id_.index ();
+ int retval = 0;
+
+ while (retval == 0)
+ {
+ // Set the index
+ key.index (++ctr);
+
+ // Check to see if an element exists in the Map. If it exists we
+ // loop, else we drop out of the loop
+ retval = this->cache_map_.find (key);
+ }
+
+ // Now do a bind again with the new index
+ return this->cache_map_.bind (key,
+ val,
+ entry);
+ }
+
+
+ bool
+ Transport_Cache_Manager::is_entry_idle (HASH_MAP_ENTRY *&entry)
+ {
+ Cache_Entries_State entry_state =
+ entry->int_id_.recycle_state ();
+
+ if (TAO_debug_level)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT("TAO (%P|%t) - Transport_Cache_Manager::is_entry_idle, ")
+ ACE_TEXT("state is [%d]\n"),
+ entry_state));
+ }
+
+ if (entry_state == ENTRY_IDLE_AND_PURGABLE ||
+ entry_state == ENTRY_IDLE_BUT_NOT_PURGABLE)
+ return true;
+
+ return false;
+ }
+
+#if !defined (ACE_LACKS_QSORT)
+ int
+ Transport_Cache_Manager::cpscmp(const void* a, const void* b)
+ {
+ const HASH_MAP_ENTRY** left = (const HASH_MAP_ENTRY**)a;
+ const HASH_MAP_ENTRY** right = (const HASH_MAP_ENTRY**)b;
+
+ if ((*left)->int_id_.transport ()->purging_order () <
+ (*right)->int_id_.transport ()->purging_order ())
+ return -1;
+
+ if ((*left)->int_id_.transport ()->purging_order () >
+ (*right)->int_id_.transport ()->purging_order ())
+ return 1;
+
+ return 0;
+ }
+#endif /* ACE_LACKS_QSORT */
+
+ int
+ Transport_Cache_Manager::purge (void)
+ {
+ ACE_Unbounded_Stack<TAO_Transport*> transports_to_be_closed;
+
+ {
+ ACE_MT (ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->cache_lock_, 0));
+
+ DESCRIPTOR_SET sorted_set = 0;
+ int sorted_size = this->fill_set_i (sorted_set);
+
+ // Only call close_entries () if sorted_set != 0. It takes
+ // control of sorted_set and cleans up any allocated memory. If
+ // sorted_set == 0, then there is nothing to de-allocate.
+ if (sorted_set != 0)
+ {
+ // BEGIN FORMER close_entries
+ // Calculate the number of entries to purge
+ const int amount = (sorted_size * this->percent_) / 100;
+
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - Transport_Cache_Manager::")
+ ACE_TEXT ("purge, purging %d of %d cache entries\n"),
+ amount,
+ sorted_size));
+ }
+
+ int count = 0;
+
+ for (int i = 0; count < amount && i < sorted_size; ++i)
+ {
+ if (this->is_entry_idle (sorted_set[i]))
+ {
+ sorted_set[i]->int_id_.recycle_state (ENTRY_BUSY);
+
+ TAO_Transport* transport =
+ sorted_set[i]->int_id_.transport ();
+ transport->add_reference ();
+
+ if (transports_to_be_closed.push (transport) != 0)
+ {
+ ACE_DEBUG ((LM_INFO,
+ ACE_TEXT ("TAO (%P|%t) - ")
+ ACE_TEXT ("Unable to push transport %u ")
+ ACE_TEXT ("on the to-be-closed stack, so ")
+ ACE_TEXT ("it will leak\n"),
+ transport->id ()));
+ }
+
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("TAO (%P|%t) - ")
+ ACE_TEXT ("Idle transport found in ")
+ ACE_TEXT ("cache: [%d] \n"),
+ transport->id ()));
+ }
+
+ // Count this as a successful purged entry
+ count++;
+ }
+ }
+
+ delete [] sorted_set;
+ sorted_set = 0;
+ // END FORMER close_entries
+ }
+ }
+
+ // Now, without the lock held, lets go through and close all the transports.
+ TAO_Transport *transport = 0;
+
+ while (! transports_to_be_closed.is_empty ())
+ {
+ if (transports_to_be_closed.pop (transport) == 0)
+ {
+ if (transport)
+ {
+ transport->close_connection ();
+ transport->remove_reference ();
+ }
+ }
+ }
+
+ return 0;
+ }
+
+
+ void
+ Transport_Cache_Manager::sort_set (DESCRIPTOR_SET& entries,
+ int current_size)
+ {
+#if defined (ACE_LACKS_QSORT)
+ // Use insertion sort if we don't have qsort
+ for(int i = 1; i < current_size; ++i)
+ {
+ if (entries[i]->int_id_.transport ()->purging_order () <
+ entries[i - 1]->int_id_.transport ()->purging_order ())
+ {
+ HASH_MAP_ENTRY* entry = entries[i];
+
+ for(int j = i; j > 0 &&
+ entries[j - 1]->int_id_.transport ()->purging_order () >
+ entry->int_id_.transport ()->purging_order (); --j)
+ {
+ HASH_MAP_ENTRY* holder = entries[j];
+ entries[j] = entries[j - 1];
+ entries[j - 1] = holder;
+ }
+ }
+ }
+#else
+ ACE_OS::qsort (entries, current_size,
+ sizeof (HASH_MAP_ENTRY*), (ACE_COMPARE_FUNC)cpscmp);
+#endif /* ACE_LACKS_QSORT */
+ }
+
+
+ int
+ Transport_Cache_Manager::fill_set_i (DESCRIPTOR_SET& sorted_set)
+ {
+ int current_size = 0;
+ int cache_maximum = this->purging_strategy_->cache_maximum ();
+
+ // set sorted_set to 0. This signifies nothing to purge.
+ sorted_set = 0;
+
+ // Do we need to worry about cache purging?
+ if (cache_maximum >= 0)
+ {
+ current_size = static_cast<int> (this->cache_map_.current_size ());
+
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT("TAO (%P|%t) - Transport_Cache_Manager::fill_set_i, ")
+ ACE_TEXT("current_size = %d, cache_maximum = %d\n"),
+ current_size, cache_maximum));
+ }
+
+ if (current_size >= cache_maximum)
+ {
+ ACE_NEW_RETURN (sorted_set, HASH_MAP_ENTRY*[current_size], 0);
+
+ HASH_MAP_ITER iter = this->cache_map_.begin ();
+
+ for (int i = 0; i < current_size; ++i)
+ {
+ sorted_set[i] = &(*iter);
+ iter++;
+ }
+
+ this->sort_set (sorted_set, current_size);
+ }
+ }
+
+ return current_size;
+ }
+
+
+ int
+ Transport_Cache_Manager::wait_for_connection (Cache_ExtId &extid)
+ {
+ if (this->muxed_number_ && this->muxed_number_ == extid.index ())
+ {
+ // If we have a limit on the number of muxed connections for
+ // a particular endpoint just wait to get the connection
+ ++this->no_waiting_threads_;
+
+ if (TAO_debug_level > 2)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT("TAO (%P|%t) - Transport_Cache_Manager")
+ ACE_TEXT("::wait_for_connection, ")
+ ACE_TEXT("entering wait loop\n")));
+ }
+
+ int ready_togo = 0;
+
+ while (ready_togo == 0)
+ {
+ this->condition_->wait ();
+
+ // Check whether we are waiting for this connection
+ ready_togo = this->is_wakeup_useful (extid);
+ }
+
+ if (TAO_debug_level > 2)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT("TAO (%P|%t) - Transport_Cache_Manager::wait_for_connection, ")
+ ACE_TEXT("left wait loop\n")));
+ }
+
+ // We are not waiting anymore
+ --this->no_waiting_threads_;
+ }
+
+ return 0;
+ }
+
+ int
+ Transport_Cache_Manager::is_wakeup_useful (Cache_ExtId &extid)
+ {
+ // Get the underlying property that we are looking for
+ TAO_Transport_Descriptor_Interface *prop = extid.property ();
+
+ // Just check the underlying property for equivalence. If the last
+ // connection that was returned had the same property just return
+ // 1.
+ if (this->last_entry_returned_ &&
+ prop->is_equivalent (this->last_entry_returned_->property ()))
+ {
+ // Set the index to be right so that we can pick teh connection
+ // right away..
+ extid.index (this->last_entry_returned_->index ());
+
+ // There is no more use for it ...
+ this->last_entry_returned_ = 0;
+
+ return 1;
+ }
+
+ // If there is an entry that was returned and if there are more
+ // threads just wake up the peer to check for the returned
+ // connection.
+ if (this->last_entry_returned_ &&
+ this->no_waiting_threads_ > 1)
+ {
+ this->condition_->signal ();
+ }
+
+ return 0;
+ }
+
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Transport_Cache_Manager.h b/TAO/tao/Transport_Cache_Manager.h
new file mode 100644
index 00000000000..37a3643fe3e
--- /dev/null
+++ b/TAO/tao/Transport_Cache_Manager.h
@@ -0,0 +1,276 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Transport_Cache_Manager.h
+ *
+ * $Id$
+ *
+ * @author Balachandran Natarajan <bala@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_CONNECTION_CACHE_MANAGER_H
+#define TAO_CONNECTION_CACHE_MANAGER_H
+
+#include /**/ "ace/pre.h"
+#include "ace/Null_Mutex.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+#define ACE_LACKS_PRAGMA_ONCE
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/Hash_Map_Manager_T.h"
+
+#include "tao/Cache_Entries.h"
+#include "tao/orbconf.h"
+
+ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+class ACE_Handle_Set;
+template <class T> class ACE_Unbounded_Set;
+template <class T> class ACE_Unbounded_Set_Iterator;
+ACE_END_VERSIONED_NAMESPACE_DECL
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Connection_Handler;
+class TAO_ORB_Core;
+class TAO_Resource_Factory;
+class TAO_Connection_Purging_Strategy;
+
+template <class ACE_COND_MUTEX> class TAO_Condition;
+
+namespace TAO
+{
+ typedef ACE_Unbounded_Set<TAO_Connection_Handler*> Connection_Handler_Set;
+ /**
+ * @class Transport_Cache_Manager
+ *
+ * @brief The Transport Cache Manager for TAO
+ *
+ * This class provides interfaces associating a TAO_Cache_ExtId
+ * & TAO_Cache_IntId. This class is wrapper around the
+ * ACE_Hash_Map_Manager class which is used as a container to Cache
+ * the connections. This class protects the entries with a lock. The
+ * map is updated only by holding the lock. The more compelling reason
+ * to have the lock in this class and not in the Hash_Map is that, we
+ * do quite a bit of work in this class for which we need a lock.
+ *
+ */
+ class TAO_Export Transport_Cache_Manager
+ {
+ public:
+ // Some useful typedef's
+ typedef ACE_Hash_Map_Manager_Ex <Cache_ExtId,
+ Cache_IntId,
+ ACE_Hash<Cache_ExtId>,
+ ACE_Equal_To<Cache_ExtId>,
+ ACE_Null_Mutex>
+ HASH_MAP;
+
+ typedef HASH_MAP::iterator HASH_MAP_ITER;
+
+ typedef ACE_Hash_Map_Entry <Cache_ExtId,
+ Cache_IntId>
+ HASH_MAP_ENTRY;
+
+ typedef TAO_Condition<TAO_SYNCH_MUTEX> CONDITION;
+
+ // == Public methods
+ /// Constructor
+ Transport_Cache_Manager (TAO_ORB_Core &orb_core);
+
+ /// Destructor
+ ~Transport_Cache_Manager (void);
+
+ /// Add the transport to the cache.
+ /**
+ * The transport has the property definition based on which caching
+ * can be done. This method marks the transport
+ * <CODE>ACE_RECYCLABLE_BUSY </CODE> which helps the threads
+ * opening up connections to use the transport immediately.
+ */
+ int cache_transport (TAO_Transport_Descriptor_Interface *prop,
+ TAO_Transport *transport);
+
+ /// Similar to the one above, but the transport is left in <CODE>
+ /// ENTRY_IDLE_AND_PURGABLE</CODE> state.
+ int cache_idle_transport (TAO_Transport_Descriptor_Interface *prop,
+ TAO_Transport *transport);
+
+ /// Check the Transport Cache to check whether the connection exists
+ /// in the Cache and return the connection
+ int find_transport (TAO_Transport_Descriptor_Interface *prop,
+ TAO_Transport *&transport);
+
+ /// Remove entries from the cache depending upon the strategy.
+ int purge (void);
+
+ /// Purge the entry from the Cache Map
+ int purge_entry (HASH_MAP_ENTRY *&);
+
+ /// Mark the entry as invalid for use but keep it in cache.
+ void mark_invalid (HASH_MAP_ENTRY *&);
+
+ /// Make the entry idle and ready for use.
+ int make_idle (HASH_MAP_ENTRY *&entry);
+
+ /// Mark the entry as touched. This call updates the purging
+ /// strategy policy information.
+ int update_entry (HASH_MAP_ENTRY *&entry);
+
+ /// Close the underlying hash map manager and return any handlers
+ /// still registered
+ int close (Connection_Handler_Set &handlers);
+
+ /// Return a set of connection handlers that belong to transports
+ /// that have a RW wait strategy.
+ /**
+ * This call is used for a specific use case by the ORB_Core
+ * during shutdown. The only way the ORB can wake up threads
+ * waiting on these sockstes for replies is to iterate over
+ * these blockable transports and close the socket
+ * handles. Without these the threads will continue to wait there
+ * for ever.
+ */
+ bool blockable_client_transports (Connection_Handler_Set &handlers);
+
+ /// Return the current size of the cache.
+ size_t current_size (void) const;
+
+ /// Return the total size of the cache.
+ size_t total_size (void) const;
+
+ /// Return the underlying cache map
+ HASH_MAP &map (void);
+
+ private:
+ /// Associate @a ext_id with @a int_id. Grabs the lock and calls the
+ /// implementation function bind_i.
+ int bind (Cache_ExtId &ext_id,
+ Cache_IntId &int_id);
+
+ /// Lookup entry<key,value> in the cache. Grabs the lock and calls the
+ /// implementation function find_i.
+ int find (const Cache_ExtId &key,
+ Cache_IntId &value);
+
+ /**
+ * Non-Locking version and actual implementation of bind ()
+ * call. Calls bind on the Hash_Map_Manager that it holds. If the
+ * bind succeeds, it adds the Hash_Map_Entry in to the
+ * Transport for its reference. If the bind fails because
+ * of an exiting entry, this method calls the get_last_index_bind
+ * ().
+ */
+ int bind_i (Cache_ExtId &ext_id,
+ Cache_IntId &int_id);
+
+ /**
+ * Non-locking version and actual implementation of find ()
+ * call. This calls the find () on the underlying
+ * Hash_Map_Manager. If the find succeeds, it calls the
+ * get_idle_transport ().
+ */
+ int find_i (const Cache_ExtId &key,
+ Cache_IntId &value);
+
+ /// Non-locking version and actual implementation of make_idle ().
+ int make_idle_i (HASH_MAP_ENTRY *&entry);
+
+ /// Non-locking version and actual implementation of close ()
+ int close_i (Connection_Handler_Set &handlers);
+
+ /// Purge the entry from the Cache Map
+ int purge_entry_i (HASH_MAP_ENTRY *&entry);
+
+ /// Mark the entry as invalid for use but keep it in cache.
+ void mark_invalid_i (HASH_MAP_ENTRY *&);
+
+ private:
+ /**
+ * This is called by the bind () call when a bind fails with a
+ * available entry. When a new connection is created in TAO with an
+ * already existing endpoint, in addition to an exisitng one, we
+ * mark the connections with an index. This method, finds out the
+ * last highest index and binds the entry with an index = (last
+ * highest index + 1).
+ */
+ int get_last_index_bind (Cache_ExtId &key,
+ Cache_IntId &val,
+ HASH_MAP_ENTRY *&entry);
+
+ /**
+ * Tries to find if the <int_id_> in entry is idle for use. If it is
+ * idle it is immediately markes as busy and returns a value of
+ * 1, else it returns a value of 0
+ */
+ bool is_entry_idle (HASH_MAP_ENTRY *&entry);
+
+#if !defined(ACE_LACKS_QSORT)
+ /// Used by qsort
+ static int cpscmp(const void* a, const void* b);
+#endif
+
+ typedef HASH_MAP_ENTRY** DESCRIPTOR_SET;
+
+ /// Sort the list of entries
+ void sort_set (DESCRIPTOR_SET& entries, int size);
+
+ /// Fill sorted_set in with the TAO_Transport_Descriptor_Interface's in
+ /// a sorted order.
+ int fill_set_i (DESCRIPTOR_SET& sorted_set);
+
+ /// Wait for connections if we have reached the limit on the number
+ /// of muxed connections. If not (ie. if we dont use a muxed
+ /// connection or if we have not reached the limit) this just
+ /// behaves as a no-op. <extid> has all the information about the
+ /// connection that is being searched.
+ int wait_for_connection (Cache_ExtId &extid);
+
+ /// Is the wakeup useful todo some work?
+ int is_wakeup_useful (Cache_ExtId &extid);
+
+ /// Non-locking version of blockable_client_transports ().
+ bool blockable_client_transports_i (Connection_Handler_Set &handlers);
+
+ private:
+ /// The percentage of the cache to purge at one time
+ int percent_;
+
+ /// The underlying connection purging strategy
+ TAO_Connection_Purging_Strategy *purging_strategy_;
+
+ /// The hash map that has the connections
+ HASH_MAP cache_map_;
+
+ /// The condition variable
+ CONDITION *condition_;
+
+ /// The lock that is used by the cache map
+ ACE_Lock *cache_lock_;
+
+ /// Number of allowed muxed connections
+ CORBA::ULong muxed_number_;
+
+ /// Number of threads waiting for connections
+ int no_waiting_threads_;
+
+ /// This is for optimization purposes. In a situation where number
+ /// of threads are waiting for connections, the last connection that
+ /// is put back is cached here. This should prevent all th threads
+ /// trying to search for their required entry.
+ Cache_ExtId *last_entry_returned_;
+ };
+
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/Transport_Cache_Manager.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /*TAO_CONNECTION_CACHE_MANAGER_H*/
diff --git a/TAO/tao/Transport_Cache_Manager.inl b/TAO/tao/Transport_Cache_Manager.inl
new file mode 100644
index 00000000000..ed53a1a4f90
--- /dev/null
+++ b/TAO/tao/Transport_Cache_Manager.inl
@@ -0,0 +1,157 @@
+// -*- C++ -*-
+//
+//$Id$
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ ACE_INLINE int
+ Transport_Cache_Manager::bind (Cache_ExtId &ext_id,
+ Cache_IntId &int_id)
+ {
+ ACE_MT (ACE_GUARD_RETURN (ACE_Lock,
+ guard,
+ *this->cache_lock_,
+ -1));
+
+ return this->bind_i (ext_id,
+ int_id);
+ }
+
+ ACE_INLINE int
+ Transport_Cache_Manager::cache_transport (
+ TAO_Transport_Descriptor_Interface *prop,
+ TAO_Transport *transport)
+ {
+ // Compose the ExternId & Intid
+ Cache_ExtId ext_id (prop);
+ Cache_IntId int_id (transport);
+
+ int retval = 0;
+ {
+ ACE_MT (ACE_GUARD_RETURN (ACE_Lock,
+ guard,
+ *this->cache_lock_,
+ -1));
+
+ // Do as the semantics of this method dictates
+ int_id.recycle_state (ENTRY_BUSY);
+
+ retval = this->bind_i (ext_id,
+ int_id);
+ }
+
+ return retval;
+ }
+
+ ACE_INLINE int
+ Transport_Cache_Manager::cache_idle_transport (
+ TAO_Transport_Descriptor_Interface *prop,
+ TAO_Transport *transport)
+ {
+ // Compose the ExternId & Intid
+ Cache_ExtId ext_id (prop);
+ Cache_IntId int_id (transport);
+
+ int retval = 0;
+ {
+ ACE_MT (ACE_GUARD_RETURN (ACE_Lock,
+ guard,
+ *this->cache_lock_,
+ -1));
+
+ // Do as the semantics of this method dictates
+ int_id.recycle_state (ENTRY_IDLE_AND_PURGABLE);
+ retval = this->bind_i (ext_id,
+ int_id);
+ }
+
+ return retval;
+ }
+
+ ACE_INLINE int
+ Transport_Cache_Manager::purge_entry (HASH_MAP_ENTRY *&entry)
+ {
+ // Double checked locking
+ if(entry == 0)
+ return 0;
+
+ ACE_MT (ACE_GUARD_RETURN (ACE_Lock, guard, *this->cache_lock_, -1));
+
+ return this->purge_entry_i (entry);
+ }
+
+ ACE_INLINE void
+ Transport_Cache_Manager::mark_invalid (HASH_MAP_ENTRY *&entry)
+ {
+ if(entry == 0)
+ return;
+
+ // Double checked locking
+ ACE_MT (ACE_GUARD (ACE_Lock, guard, *this->cache_lock_));
+
+ this->mark_invalid_i (entry);
+ }
+
+ ACE_INLINE int
+ Transport_Cache_Manager::make_idle (HASH_MAP_ENTRY *&entry)
+ {
+ if(entry == 0)
+ return -1;
+
+ ACE_MT (ACE_GUARD_RETURN (ACE_Lock, guard, *this->cache_lock_, -1));
+ return this->make_idle_i (entry);
+ }
+
+ ACE_INLINE int
+ Transport_Cache_Manager::close (Connection_Handler_Set &handlers)
+ {
+ // The cache lock pointer should only be zero if
+ // Transport_Cache_Manager::open() was never called. Note that
+ // only one thread opens the Transport_Cache_Manager at any given
+ // time, so it is safe to check for a non-zero lock pointer.
+ if (this->cache_lock_ == 0)
+ return -1;
+
+ ACE_MT (ACE_GUARD_RETURN (ACE_Lock,
+ guard,
+ *this->cache_lock_,
+ -1));
+
+ return this->close_i (handlers);
+ }
+
+ ACE_INLINE bool
+ Transport_Cache_Manager::blockable_client_transports (
+ Connection_Handler_Set &handlers)
+ {
+ ACE_MT (ACE_GUARD_RETURN (ACE_Lock,
+ guard,
+ *this->cache_lock_,
+ false));
+
+ return this->blockable_client_transports_i (handlers);
+ }
+
+ ACE_INLINE size_t
+ Transport_Cache_Manager::current_size (void) const
+ {
+ return this->cache_map_.current_size ();
+ }
+
+ ACE_INLINE size_t
+ Transport_Cache_Manager::total_size (void) const
+ {
+ return this->cache_map_.total_size ();
+ }
+
+ ACE_INLINE Transport_Cache_Manager::HASH_MAP &
+ Transport_Cache_Manager::map (void)
+ {
+ return this->cache_map_;
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Transport_Connector.cpp b/TAO/tao/Transport_Connector.cpp
new file mode 100644
index 00000000000..33313169d3c
--- /dev/null
+++ b/TAO/tao/Transport_Connector.cpp
@@ -0,0 +1,727 @@
+#include "tao/Transport_Connector.h"
+#include "tao/Transport.h"
+#include "tao/ORB_Core.h"
+#include "tao/MProfile.h"
+#include "tao/Profile.h"
+#include "tao/Environment.h"
+#include "tao/Thread_Lane_Resources.h"
+#include "tao/debug.h"
+#include "tao/Connect_Strategy.h"
+#include "tao/LF_Multi_Event.h"
+#include "tao/Client_Strategy_Factory.h"
+#include "tao/Connection_Handler.h"
+#include "tao/Profile_Transport_Resolver.h"
+#include "tao/Wait_Strategy.h"
+#include "tao/SystemException.h"
+#include "tao/Endpoint.h"
+#include "tao/Base_Transport_Property.h"
+
+#include "ace/OS_NS_string.h"
+
+//@@ TAO_CONNECTOR_SPL_INCLUDE_ADD_HOOK
+
+#if !defined (__ACE_INLINE__)
+# include "tao/Transport_Connector.inl"
+#endif /* __ACE_INLINE__ */
+
+ACE_RCSID (tao,
+ Connector,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Connector
+TAO_Connector::TAO_Connector (CORBA::ULong tag)
+ : active_connect_strategy_ (0),
+ tag_ (tag),
+ orb_core_ (0)
+{
+}
+
+TAO_Connector::~TAO_Connector (void)
+{
+ delete this->active_connect_strategy_;
+}
+
+TAO_Profile *
+TAO_Connector::corbaloc_scan (const char *str,
+ size_t &len
+ ACE_ENV_ARG_DECL)
+{
+ if (this->check_prefix (str) != 0)
+ return 0;
+ const char *comma_pos = ACE_OS::strchr (str,',');
+ const char *slash_pos = ACE_OS::strchr (str,'/');
+ if (comma_pos == 0 && slash_pos == 0)
+ {
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT("(%P|%t) TAO_CONNECTOR::corbaloc_scan warning: ")
+ ACE_TEXT("supplied string contains no comma or slash: %s\n"),
+ str));
+ len = ACE_OS::strlen (str);
+ }
+ else if (comma_pos == 0 || comma_pos > slash_pos)
+ len = (slash_pos - str);
+ else len = comma_pos - str;
+ return this->make_profile(ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+int
+TAO_Connector::make_mprofile (const char *string,
+ TAO_MProfile &mprofile
+ ACE_ENV_ARG_DECL)
+{
+ // This method utilizes the "Template Method" design pattern to
+ // parse the given URL style IOR for the protocol being used
+ // and create an mprofile from it.
+ //
+ // The methods that must be defined by all Connector sub-classes are:
+ // make_profile
+ // check_prefix
+
+ // Check for a valid string
+ if (!string || !*string)
+ {
+ ACE_THROW_RETURN (CORBA::INV_OBJREF (
+ CORBA::SystemException::_tao_minor_code (
+ 0,
+ EINVAL),
+ CORBA::COMPLETED_NO),
+ -1);
+ }
+
+ // Check for the proper prefix in the IOR. If the proper prefix isn't
+ // in the IOR then it is not an IOR we can use.
+ if (this->check_prefix (string) != 0)
+ {
+ return 1;
+ // Failure: not the correct IOR for this protocol.
+ // DO NOT throw an exception here since the Connector_Registry
+ // should be allowed the opportunity to continue looking for
+ // an appropriate connector.
+ }
+
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - TAO_Connector::make_mprofile ")
+ ACE_TEXT ("<%s>\n"),
+ ACE_TEXT_CHAR_TO_TCHAR (string)));
+ }
+
+ ACE_CString ior;
+
+ ior.set (string, ACE_OS::strlen (string), 1);
+
+ // Find out where the protocol ends
+ ACE_CString::size_type ior_index = ior.find ("://");
+
+ if (ior_index == ACE_CString::npos)
+ {
+ ACE_THROW_RETURN (CORBA::INV_OBJREF (), -1);
+ // No colon ':' in the IOR!
+ }
+ else
+ {
+ ior_index += 3;
+ // Add the length of the colon and the two forward slashes `://'
+ // to the IOR string index (i.e. 3)
+ }
+
+ // Find the object key
+ const ACE_CString::size_type objkey_index =
+ ior.find (this->object_key_delimiter (), ior_index);
+
+ if (objkey_index == 0 || objkey_index == ACE_CString::npos)
+ {
+ ACE_THROW_RETURN (CORBA::INV_OBJREF (), -1);
+ // Failure: No endpoints specified or no object key specified.
+ }
+
+ const char endpoint_delimiter = ',';
+ // The delimiter used to seperate inidividual addresses.
+
+ // Count the number of endpoints in the IOR. This will be the number
+ // of entries in the MProfile.
+
+ CORBA::ULong profile_count = 1;
+ // Number of endpoints in the IOR (initialized to 1).
+
+ // Only check for endpoints after the protocol specification and
+ // before the object key.
+ for (ACE_CString::size_type i = ior_index; i < objkey_index; ++i)
+ {
+ if (ior[i] == endpoint_delimiter)
+ ++profile_count;
+ }
+
+ // Tell the MProfile object how many Profiles it should hold.
+ // MProfile::set(size) returns the number profiles it can hold.
+ if (mprofile.set (profile_count) != static_cast<int> (profile_count))
+ {
+ ACE_THROW_RETURN (CORBA::INV_OBJREF (
+ CORBA::SystemException::_tao_minor_code (
+ TAO_MPROFILE_CREATION_ERROR,
+ 0),
+ CORBA::COMPLETED_NO),
+ -1);
+ // Error while setting the MProfile size!
+ }
+
+ // The idea behind the following loop is to split the IOR into several
+ // strings that can be parsed by each profile.
+ // For example,
+ // `1.3@moo,shu,1.1@chicken/arf'
+ // will be parsed into:
+ // `1.3@moo/arf'
+ // `shu/arf'
+ // `1.1@chicken/arf'
+
+ ACE_CString::size_type begin = 0;
+ ACE_CString::size_type end = ior_index - 1;
+ // Initialize the end of the endpoint index
+
+ for (CORBA::ULong j = 0; j < profile_count; ++j)
+ {
+ begin = end + 1;
+
+ if (j < profile_count - 1)
+ {
+ end = ior.find (endpoint_delimiter, begin);
+ }
+ else
+ {
+ end = objkey_index; // Handle last endpoint differently
+ }
+
+ if (end < ior.length () && end != ior.npos)
+ {
+ ACE_CString endpoint = ior.substring (begin, end - begin);
+
+ // Add the object key to the string.
+ endpoint += ior.substring (objkey_index);
+
+ // The endpoint should now be of the form:
+ // `N.n@endpoint/object_key'
+ // or
+ // `endpoint/object_key'
+
+ TAO_Profile *profile =
+ this->make_profile (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+ // Failure: Problem during profile creation
+
+ // Initialize a Profile using the individual endpoint
+ // string.
+ // @@ Not exception safe! We need a TAO_Profile_var!
+ profile->parse_string (endpoint.c_str ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ // Give up ownership of the profile.
+ if (mprofile.give_profile (profile) == -1)
+ {
+ profile->_decr_refcnt ();
+
+ ACE_THROW_RETURN (CORBA::INV_OBJREF (
+ CORBA::SystemException::_tao_minor_code (
+ TAO_MPROFILE_CREATION_ERROR,
+ 0),
+ CORBA::COMPLETED_NO),
+ -1);
+ // Failure presumably only occurs when MProfile is full!
+ // This should never happen.
+ }
+ }
+ else
+ {
+ ACE_THROW_RETURN (CORBA::INV_OBJREF (), -1);
+ // Unable to seperate endpoints
+ }
+ }
+
+ return 0; // Success
+}
+
+int
+TAO_Connector::supports_parallel_connects(void) const
+{
+ return 0; // by default, we don't support parallel connection attempts;
+}
+
+TAO_Transport*
+TAO_Connector::make_parallel_connection (TAO::Profile_Transport_Resolver *,
+ TAO_Transport_Descriptor_Interface &,
+ ACE_Time_Value *)
+{
+ return 0;
+}
+
+
+TAO_Transport*
+TAO_Connector::parallel_connect (TAO::Profile_Transport_Resolver *r,
+ TAO_Transport_Descriptor_Interface *desc,
+ ACE_Time_Value *timeout
+ ACE_ENV_ARG_DECL_NOT_USED)
+{
+ if (this->supports_parallel_connects() == 0)
+ {
+ errno = ENOTSUP;
+ return 0;
+ }
+
+ errno = 0; // need to clear errno to ensure a stale enotsup is not set
+ if (desc == 0)
+ return 0;
+ unsigned int endpoint_count = 0;
+ TAO_Endpoint *root_ep = desc->endpoint();
+ for (TAO_Endpoint *ep = root_ep->next_filtered (this->orb_core(),0);
+ ep != 0;
+ ep = ep->next_filtered(this->orb_core(),root_ep))
+ if (this->set_validate_endpoint (ep) == 0)
+ ++endpoint_count;
+ if (endpoint_count == 0)
+ return 0;
+
+ TAO_Transport *base_transport = 0;
+
+ TAO::Transport_Cache_Manager &tcm =
+ this->orb_core ()->lane_resources ().transport_cache ();
+
+ // Iterate through the endpoints. Since find_transport takes a
+ // Transport Descriptor rather than an endpoint, we must create a
+ // local TDI for each endpoint. The first one found will be used.
+ for (TAO_Endpoint *ep = root_ep->next_filtered (this->orb_core(),0);
+ ep != 0;
+ ep = ep->next_filtered(this->orb_core(),root_ep))
+ {
+ TAO_Base_Transport_Property desc2(ep,0);
+ if (tcm.find_transport (&desc2,
+ base_transport) == 0)
+ {
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("(%P|%t) TAO_Connector::parallel_connect: ")
+ ACE_TEXT ("found a transport [%d]\n"),
+ base_transport->id()));
+ return base_transport;
+ }
+ }
+
+ // Now we have searched the cache on all endpoints and come up
+ // empty. We need to initiate connections on each of the
+ // endpoints. Presumably only one will have a route and will succeed,
+ // and the rest will fail. This requires the use of asynch
+ // connection establishment. Maybe a custom wait strategy is needed
+ // at this point to register several potential transports so that
+ // when one succeeds the rest are cancelled or closed.
+
+ return this->make_parallel_connection (r,*desc,timeout);
+}
+
+TAO_Transport*
+TAO_Connector::connect (TAO::Profile_Transport_Resolver *r,
+ TAO_Transport_Descriptor_Interface *desc,
+ ACE_Time_Value *timeout
+ ACE_ENV_ARG_DECL)
+{
+ if (desc == 0 ||
+ (this->set_validate_endpoint (desc->endpoint ()) == -1))
+ return 0;
+
+ TAO_Transport *base_transport = 0;
+
+ TAO::Transport_Cache_Manager &tcm =
+ this->orb_core ()->lane_resources ().transport_cache ();
+
+ // Check the Cache first for connections
+ // If transport found, reference count is incremented on assignment
+ // @@todo: We need to send the timeout value to the cache registry
+ // too. That should be the next step!
+ if (tcm.find_transport (desc,
+ base_transport) != 0)
+ {
+ // @@TODO: This is not the right place for this!
+ // Purge connections (if necessary)
+ tcm.purge ();
+
+ TAO_Transport* t = this->make_connection (r,
+ *desc,
+ timeout);
+
+ if (t == 0)
+ return t;
+
+ t->opened_as (TAO::TAO_CLIENT_ROLE);
+
+ if (TAO_debug_level > 4)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT("(%P|%t) Transport_Connector::connect, ")
+ ACE_TEXT("opening Transport[%d] in TAO_CLIENT_ROLE\n"),
+ t->id ()));
+
+ // Call post connect hook. If the post_connect_hook () returns
+ // false, just purge the entry.
+ if (!t->post_connect_hook ())
+ {
+ (void) t->purge_entry ();
+
+ // Call connect again
+ return this->connect (r,
+ desc,
+ timeout
+ ACE_ENV_ARG_PARAMETER);
+ }
+
+ return t;
+ }
+
+ if (TAO_debug_level > 4)
+ {
+ TAO::Connection_Role cr =
+ base_transport->opened_as ();
+
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - Transport_Connector::connect, "
+ "got an existing %s Transport[%d] in role %s\n",
+ base_transport->is_connected () ? "connected" : "unconnected",
+ base_transport->id (),
+ cr == TAO::TAO_SERVER_ROLE ? "TAO_SERVER_ROLE" :
+ cr == TAO::TAO_CLIENT_ROLE ? "TAO_CLIENT_ROLE" :
+ "TAO_UNSPECIFIED_ROLE" ));
+ }
+
+
+ // If connected return.
+ if (base_transport->is_connected ())
+ return base_transport;
+
+ // It it possible to get a transport from the cache that is not
+ // connected? If not, then the following code is bogus. We cannot
+ // wait for a connection to complete on a transport in the cache.
+ //
+ // (mesnier_p@ociweb.com) It is indeed possible to reach this point.
+ // The AMI_Buffering test does. When using non-blocking connects and
+ // the first request(s) are asynch and may be queued, the connection
+ // establishment may not be completed by the time the invocation is
+ // done with it. In that case it is up to a subsequent invocation to
+ // handle the connection completion.
+
+ if (!this->wait_for_connection_completion (r,
+ base_transport,
+ timeout))
+ {
+ if (TAO_debug_level > 2)
+ ACE_ERROR ((LM_ERROR,
+ "TAO (%P|%t) - Transport_Connector::"
+ "connect, "
+ "wait for completion failed\n"));
+ return 0;
+ }
+
+ if (base_transport->is_connected () &&
+ base_transport->wait_strategy ()->register_handler () == 0)
+ {
+ // Registration failures.
+
+ // Purge from the connection cache, if we are not in the cache, this
+ // just does nothing.
+ (void) base_transport->purge_entry ();
+
+ // Close the handler.
+ (void) base_transport->close_connection ();
+
+ if (TAO_debug_level > 0)
+ ACE_ERROR ((LM_ERROR,
+ "TAO (%P|%t) - Transport_Connector [%d]::connect, "
+ "could not register the transport "
+ "in the reactor.\n",
+ base_transport->id ()));
+
+ return 0;
+ }
+
+ return base_transport;
+}
+
+bool
+TAO_Connector::wait_for_connection_completion (
+ TAO::Profile_Transport_Resolver *r,
+ TAO_Transport *&transport,
+ ACE_Time_Value *timeout)
+{
+ if (TAO_debug_level > 2)
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - Transport_Connector::"
+ "wait_for_connection_completion, "
+ "going to wait for connection completion on transport"
+ "[%d]\n",
+ transport->id ()));
+ // If we don't need to block for a transport just set the timeout to
+ // be zero.
+ ACE_Time_Value tmp_zero (ACE_Time_Value::zero);
+ if (!r->blocked_connect ())
+ {
+ timeout = &tmp_zero;
+ }
+
+ // Wait until the connection is ready, when non-blocking we just do a wait
+ // with zero time
+ int result =
+ this->active_connect_strategy_->wait (
+ transport,
+ timeout);
+
+ if (TAO_debug_level > 2)
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - Transport_Connector::"
+ "wait_for_connection_completion, "
+ "transport [%d], wait done result = %d\n",
+ transport->id (), result));
+
+ // There are three possibilities when wait() returns: (a)
+ // connection succeeded; (b) connection failed; (c) wait()
+ // failed because of some other error. It is easy to deal with
+ // (a) and (b). (c) is tricky since the connection is still
+ // pending and may get completed by some other thread. The
+ // following method deals with (c).
+
+ if (result == -1)
+ {
+ if (!r->blocked_connect () && errno == ETIME)
+ {
+ if (TAO_debug_level > 2)
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - Transport_Connector::"
+ "wait_for_connection_completion, "
+ "transport [%d], timeout, resetting state.\n",
+ transport->id ()));
+ transport->connection_handler()->
+ reset_state(TAO_LF_Event::LFS_CONNECTION_WAIT);
+ // If we did a non blocking connect, just ignore
+ // any timeout errors
+ result = 0;
+ }
+ else
+ {
+ // When we need to get a connected transport
+ result =
+ this->check_connection_closure (
+ transport->connection_handler ());
+ }
+
+ // In case of errors.
+ if (result == -1)
+ {
+ // Report that making the connection failed, don't print errno
+ // because we touched the reactor and errno could be changed
+ if (TAO_debug_level > 2)
+ ACE_ERROR ((LM_ERROR,
+ "TAO (%P|%t) - Transport_Connector::"
+ "wait_for_connection_completion, "
+ "transport [%d], wait for completion failed\n",
+ transport->id()));
+
+
+ // Set transport to zero, it is not usable, and the reference
+ // count we added above was decremented by the base connector
+ // handling the connection failure.
+ transport = 0;
+
+ return false;
+ }
+ }
+
+ // Connection not ready yet but we can use this transport, if
+ // we need a connected one we will block later to make sure
+ // it is connected
+ return true;
+}
+
+bool
+TAO_Connector::wait_for_connection_completion (
+ TAO::Profile_Transport_Resolver *r,
+ TAO_Transport *&the_winner,
+ TAO_Transport **transport,
+ unsigned int count,
+ TAO_LF_Multi_Event *mev,
+ ACE_Time_Value *timeout)
+{
+ if (TAO_debug_level > 2)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT("(%P|%t) Transport_Connector::")
+ ACE_TEXT("wait_for_connection_completion, ")
+ ACE_TEXT("waiting for connection completion on ")
+ ACE_TEXT("%d transports, ["),
+ count));
+ for (unsigned int i = 0; i < count; i++)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT("%d%s"),transport[i]->id(),
+ (i < (count -1) ? ", " : "]\n")));
+ }
+
+ // If we don't need to block for a transport just set the timeout to
+ // be zero.
+ ACE_Time_Value tmp_zero (ACE_Time_Value::zero);
+ if (!r->blocked_connect ())
+ {
+ timeout = &tmp_zero;
+ }
+
+ int result = this->active_connect_strategy_->wait (mev,timeout);
+ the_winner = 0;
+
+ if (result != -1)
+ {
+ the_winner = mev->winner()->transport();
+ if (TAO_debug_level > 2)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT("(%P|%t) Transport_Connector::")
+ ACE_TEXT("wait_for_connection_completion, ")
+ ACE_TEXT("transport [%d]\n"),
+ the_winner->id ()));
+ }
+ else if (errno == ETIME)
+ {
+ // this is the most difficult case. In this situation, there is no
+ // nominated by the Multi_Event. The best we can do is pick one of
+ // the pending connections.
+ // Of course, this shouldn't happen in any case, since the wait
+ // strategy is called with a timeout value of 0.
+ for (unsigned int i = 0; i < count; i++)
+ if (!transport[i]->connection_handler()->is_closed())
+ {
+ the_winner = transport[i];
+ break;
+ }
+ }
+
+ // It is possible that we have more than one connection that happened
+ // to complete, or that none completed. Therefore we need to traverse
+ // the list and ensure that all of the losers are closed.
+ for (unsigned int i = 0; i < count; i++)
+ {
+ if (transport[i] != the_winner)
+ this->check_connection_closure (transport[i]->connection_handler());
+ // since we are doing this on may connections, the result isn't
+ // particularly important.
+ }
+
+ // In case of errors.
+ if (the_winner == 0)
+ {
+ // Report that making the connection failed, don't print errno
+ // because we touched the reactor and errno could be changed
+ if (TAO_debug_level > 2)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) Transport_Connector::")
+ ACE_TEXT ("wait_for_connection_completion, failed\n")
+ ));
+
+ return false;
+ }
+
+ // Fix for a subtle problem. What happens if we are supposed to do
+ // blocked connect but the transport is NOT connected? Force close
+ // the connections
+ if (r->blocked_connect () && !the_winner->is_connected ())
+ {
+ if (TAO_debug_level > 2)
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - Transport_Connector::"
+ "wait_for_connection_completion, "
+ "no connected transport for a blocked connection, "
+ "cancelling connections and reverting things \n"));
+
+ // Forget the return value. We are busted anyway. Try our best
+ // here.
+ (void) this->cancel_svc_handler (the_winner->connection_handler ());
+ the_winner = 0;
+ return false;
+ }
+
+ // Connection may not ready for SYNC_NONE cases but we can use this
+ // transport, if we need a connected one we will block later to make
+ // sure it is connected
+ return true;
+}
+
+int
+TAO_Connector::create_connect_strategy (void)
+{
+ if (this->active_connect_strategy_ == 0)
+ {
+ this->active_connect_strategy_ =
+ this->orb_core_->client_factory ()->create_connect_strategy (
+ this->orb_core_);
+ }
+
+ if (this->active_connect_strategy_ == 0)
+ {
+ return -1;
+ }
+
+ return 0;
+}
+
+int
+TAO_Connector::check_connection_closure (
+ TAO_Connection_Handler *connection_handler)
+{
+ int result = -1;
+
+ // Check if the handler has been closed.
+ bool closed =
+ connection_handler->is_closed ();
+
+ // In case of failures and close() has not be called.
+ if (!closed)
+ {
+ // First, cancel from connector.
+ if (this->cancel_svc_handler (connection_handler) == -1)
+ return -1;
+
+ // Double check to make sure the handler has not been closed
+ // yet. This double check is required to ensure that the
+ // connection handler was not closed yet by some other
+ // thread since it was still registered with the connector.
+ // Once connector.cancel() has been processed, we are
+ // assured that the connector will no longer open/close this
+ // handler.
+ closed = connection_handler->is_closed ();
+
+
+ // If closed, there is nothing to do here. If not closed,
+ // it was either opened or is still pending.
+ if (!closed)
+ {
+ // Check if the handler has been opened.
+ const bool open = connection_handler->is_open ();
+
+ // Some other thread was able to open the handler even
+ // though wait failed for this thread.
+ if (open)
+ {
+ // Set the result to 0, we have an open connection
+ result = 0;
+ }
+ else
+ {
+ // Assert that it is still connecting.
+ ACE_ASSERT (connection_handler->is_connecting ());
+
+ // Force close the handler now.
+ connection_handler->close_handler ();
+ }
+ }
+ }
+
+ return result;
+}
+
+//@@ TAO_CONNECTOR_SPL_METHODS_ADD_HOOK
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Transport_Connector.h b/TAO/tao/Transport_Connector.h
new file mode 100644
index 00000000000..f457ee5ec9a
--- /dev/null
+++ b/TAO/tao/Transport_Connector.h
@@ -0,0 +1,243 @@
+// This may look like C, but it's really -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Transport_Connector.h
+ *
+ * $Id$
+ *
+ * Define the interface for the Connector component in TAO's
+ * pluggable protocol framework.
+ *
+ * @author Fred Kuhns <fredk@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_CONNECTOR_H
+#define TAO_CONNECTOR_H
+
+#include /**/ "ace/pre.h"
+#include "ace/CORBA_macros.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/TAO_Export.h"
+#include "tao/Basic_Types.h"
+
+ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+class ACE_Time_Value;
+ACE_END_VERSIONED_NAMESPACE_DECL
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Transport_Descriptor_Interface;
+class TAO_InputCDR;
+class TAO_Endpoint;
+class TAO_Profile;
+class TAO_MProfile;
+class TAO_ORB_Core;
+class TAO_Connect_Strategy;
+class TAO_Transport;
+class TAO_Connection_Handler;
+class TAO_LF_Multi_Event;
+
+namespace TAO
+{
+ class Profile_Transport_Resolver;
+}
+
+namespace CORBA
+{
+ class Environment;
+}
+
+/*
+ * Hook to add includes and forward declaration
+ * to the Connector class.
+ */
+//@@ TAO_CONNECTOR_SPL_INCLUDE_FORWARD_DECL_ADD_HOOK
+
+/**
+ * @class TAO_Connector
+ *
+ * @brief Generic Connector interface definitions.
+ *
+ * Base class for connector bridge object.
+ *
+ * @todo Need to rename the class as TAO_Transport_Connector.
+ */
+class TAO_Export TAO_Connector
+{
+public:
+
+ /// Default constructor.
+ TAO_Connector (CORBA::ULong tag);
+
+ /// The destructor.
+ virtual ~TAO_Connector (void);
+
+ /**
+ * The tag identifying the specific ORB transport layer protocol.
+ * For example IOP::TAG_INTERNET_IOP == 0. The tag is used in the
+ * IOR to identify the type of profile included. IOR -> {{tag0,
+ * profile0} {tag1, profile1} ...}. The IOP module defines the
+ * ProfileId typedef to be a CORBA::ULong.
+ */
+ CORBA::ULong tag (void) const;
+
+ /// Parse a string containing a URL style IOR and return an
+ /// MProfile. Verify that ior is in the correct format.
+ int make_mprofile (
+ const char *ior,
+ TAO_MProfile &mprofile
+ ACE_ENV_ARG_DECL);
+
+ /// Helper function to assist corbaloc parsing. The default simply validates
+ /// the protocol identifyier and scans up to the next comma or slash.
+ /// Any protocol that has a specific need, such as uiop, can override this
+ /// method to provide a custom scanner.
+ /// The profile returned is either null if this the ior does not match or an
+ /// empty profile of the correct type, obtained from make_profile().
+ virtual TAO_Profile * corbaloc_scan (const char *ior,
+ size_t &len
+ ACE_ENV_ARG_DECL);
+
+ /// Initialize object and register with reactor.
+ virtual int open (
+ TAO_ORB_Core *orb_core) = 0;
+
+ /// Shutdown Connector bridge and concrete Connector.
+ virtual int close (void) = 0;
+
+ /**
+ * To support pluggable we need to abstract away the details of the
+ * connect () method so it can be called from the invocation code
+ * independent of the actual transport protocol in use.
+ */
+ virtual TAO_Transport* connect (
+ TAO::Profile_Transport_Resolver *r,
+ TAO_Transport_Descriptor_Interface *desc,
+ ACE_Time_Value *timeout
+ ACE_ENV_ARG_DECL);
+
+ /// A variation on connect that will try simultanious connections
+ /// on all endpoints listed in the desc.
+ virtual TAO_Transport* parallel_connect (
+ TAO::Profile_Transport_Resolver *r,
+ TAO_Transport_Descriptor_Interface *desc,
+ ACE_Time_Value *timeout
+ ACE_ENV_ARG_DECL);
+
+ /// Create a profile for this protocol and initialize it based on the
+ /// encapsulation in @a cdr
+ virtual TAO_Profile *create_profile (
+ TAO_InputCDR& cdr) = 0;
+
+ /// Check that the prefix of the provided endpoint is valid for use
+ /// with a given pluggable protocol.
+ virtual int check_prefix (
+ const char *endpoint) = 0;
+
+ /// Return the object key delimiter to use or expect.
+ virtual char object_key_delimiter (void) const = 0;
+
+ //@@ TAO_CONNECTOR_SPL_PUBLIC_METHODS_ADD_HOOK
+
+protected:
+ /// A flag indicating the actual connector supports parallel connection
+ /// attempts. The base implementation alwayse returns 0. Override to return
+ /// non-zero if parallel connection attempts may be tried.
+ virtual int supports_parallel_connects (void) const;
+
+ /// Create a profile with a given endpoint.
+ virtual TAO_Profile *make_profile (ACE_ENV_SINGLE_ARG_DECL) = 0;
+
+ /// Set and validate endpoint. We need to do this to initialize our
+ /// remote *_Addr's which have not been done during IOR decode.
+ virtual int set_validate_endpoint (TAO_Endpoint *endpoint) = 0;
+
+ /// Make a connection
+ virtual TAO_Transport* make_connection (
+ TAO::Profile_Transport_Resolver *r,
+ TAO_Transport_Descriptor_Interface &desc,
+ ACE_Time_Value *timeout) = 0;
+
+ /// Make a connection using - not a pure virtual since not all
+ /// protocols support this.
+ virtual TAO_Transport* make_parallel_connection (
+ TAO::Profile_Transport_Resolver *r,
+ TAO_Transport_Descriptor_Interface &desc,
+ ACE_Time_Value *timeout);
+
+ /// Cancel the passed cvs handler from the connector
+ virtual int cancel_svc_handler (
+ TAO_Connection_Handler *svc_handler) = 0;
+
+ /// Check whether the connection is not closed
+ /**
+ * @retval 0 The connection happens to be not closed, but is now open
+ * because an other thread managed to open the handler
+ * @retval -1 The connection is closed
+ */
+ virtual int check_connection_closure (
+ TAO_Connection_Handler *connection_handler);
+
+ /**
+ * Wait for connection completion. We have a transport that is not
+ * connected yet, wait until it is connected.
+ * @retval true When we could use @a transport
+ * @return false When we can't use the @a transport
+ */
+ virtual bool wait_for_connection_completion(
+ TAO::Profile_Transport_Resolver *r,
+ TAO_Transport *&transport,
+ ACE_Time_Value *timeout);
+
+ /// In the case of a parallel connection attempt, we take an array of
+ /// transports, and wait on any of them. When the first one completes,
+ /// the rest are closed.
+ virtual bool wait_for_connection_completion(
+ TAO::Profile_Transport_Resolver *r,
+ TAO_Transport *&the_winner,
+ TAO_Transport **transport,
+ unsigned int count,
+ TAO_LF_Multi_Event *mev,
+ ACE_Time_Value *timeout);
+
+ /// Set the ORB Core pointer
+ void orb_core (TAO_ORB_Core *orb_core);
+
+ /// Create a connect strategy
+ int create_connect_strategy (void);
+
+ /// Return the TAO_ORB_Core pointer
+ TAO_ORB_Core *orb_core (void);
+
+protected:
+
+ /// The (a)synch connect strategy
+ TAO_Connect_Strategy *active_connect_strategy_;
+
+private:
+
+ /// IOP protocol tag.
+ CORBA::ULong const tag_;
+
+ /// Pointer to our ORB core
+ TAO_ORB_Core *orb_core_;
+
+ //@@ TAO_CONNECTOR_SPL_PRIVATE_DATA_ADD_HOOK
+};
+
+//@@ TAO_CONNECTOR_SPL_EXTERN_ADD_HOOK
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/Transport_Connector.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+#endif /*TAO_CONNECTOR_H*/
diff --git a/TAO/tao/Transport_Connector.inl b/TAO/tao/Transport_Connector.inl
new file mode 100644
index 00000000000..64683bc6a14
--- /dev/null
+++ b/TAO/tao/Transport_Connector.inl
@@ -0,0 +1,25 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE TAO_ORB_Core *
+TAO_Connector::orb_core (void)
+{
+ return this->orb_core_;
+}
+
+ACE_INLINE void
+TAO_Connector::orb_core (TAO_ORB_Core *orb_core)
+{
+ this->orb_core_ = orb_core;
+}
+
+ACE_INLINE CORBA::ULong
+TAO_Connector::tag (void) const
+{
+ return this->tag_;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Transport_Descriptor_Interface.cpp b/TAO/tao/Transport_Descriptor_Interface.cpp
new file mode 100644
index 00000000000..6aad3b7fd37
--- /dev/null
+++ b/TAO/tao/Transport_Descriptor_Interface.cpp
@@ -0,0 +1,42 @@
+#include "tao/Transport_Descriptor_Interface.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/Transport_Descriptor_Interface.inl"
+#endif /* __ACE_INLINE__ */
+
+#include "tao/Endpoint.h"
+
+ACE_RCSID (tao,
+ Transport_Descriptor_Interface,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Transport_Descriptor_Interface::~TAO_Transport_Descriptor_Interface (void)
+{
+ if (this->release_)
+ {
+ delete this->endpoint_;
+ }
+}
+
+CORBA::Boolean
+TAO_Transport_Descriptor_Interface::reset_endpoint (TAO_Endpoint *ep)
+{
+ // calling on a dynamically allocation descriptor is not allowed.
+ if (this->release_)
+ return 0;
+
+ for (TAO_Endpoint *ptr = this->endpoint_; ptr != 0; ptr = ptr->next())
+
+ if (ptr == ep)
+ {
+ this->endpoint_ = ep;
+ return 1;
+ }
+ return 0;
+}
+
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Transport_Descriptor_Interface.h b/TAO/tao/Transport_Descriptor_Interface.h
new file mode 100644
index 00000000000..33eebea6a1c
--- /dev/null
+++ b/TAO/tao/Transport_Descriptor_Interface.h
@@ -0,0 +1,104 @@
+// -*- C++ -*-
+
+// ===================================================================
+/**
+ * @file Transport_Descriptor_Interface.h
+ *
+ * $Id$
+ *
+ * @author Bala Natarajan <bala@cs.wustl.edu>
+ */
+// ===================================================================
+
+#ifndef TAO_CONNECTION_DESCRIPTOR_INTERFACE_H
+#define TAO_CONNECTION_DESCRIPTOR_INTERFACE_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/TAO_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Basic_Types.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Endpoint;
+
+/**
+ * @class TAO_Transport_Descriptor_Interface
+ *
+ * @brief An abstract base class for Transport Property
+ *
+ * This class provides an abstract interface and holds minimal info
+ * on which the Transport Caching scheme is based on. Concrete
+ * connection properties can be got by inheriting from this class and
+ * implementing the virtual functions.
+ * Note 1: Additional properties for connection like Qos,
+ * Priority that the RT folks would need, can be added by
+ * inheriting from this class and providing the following
+ * methods.
+ * 1. duplicate ()
+ * 2. is_equivalent ()
+ * 3. hash ()
+ */
+class TAO_Export TAO_Transport_Descriptor_Interface
+{
+public:
+ /// Destructor
+ virtual ~TAO_Transport_Descriptor_Interface (void);
+
+ /// This call allocates and copies the contents of this class and
+ /// returns the pointer
+ virtual TAO_Transport_Descriptor_Interface *duplicate (void) = 0;
+
+ /// Try to determine if this object is same as the @a other_prop.
+ virtual CORBA::Boolean is_equivalent (
+ const TAO_Transport_Descriptor_Interface *other_prop) = 0;
+
+ /// Generate hash value for our class
+ virtual u_long hash (void) const = 0;
+
+ /// Return the underlying endpoint object
+ TAO_Endpoint *endpoint (void);
+
+ /// Reset the endpoint pointer to point to another, if that one is
+ /// part of the chain based by the current endpoint. Although this
+ /// method is public it should only be used by the protocol specific
+ /// connector, right before caching, and only when a parallel
+ /// connect was attempted with more than one possible endpoints.
+ CORBA::Boolean reset_endpoint (TAO_Endpoint *ep);
+
+ /// Set the BiDir flag
+ void set_bidir_flag (CORBA::Boolean flag);
+
+protected:
+ /// Default Constructor
+ TAO_Transport_Descriptor_Interface (void);
+
+ /// Constructor
+ TAO_Transport_Descriptor_Interface (TAO_Endpoint *endpoint,
+ CORBA::Boolean take_ownership = 0);
+
+ /// The base property of the connection ie. the peer's endpoint
+ TAO_Endpoint *endpoint_;
+
+ /// Should the endpoint be used in either direction?
+ CORBA::Boolean bidir_flag_;
+
+ /// Is the endpoint allocated on the heap? If so, we will have to
+ /// delete it when we destruct ourselves.
+ CORBA::Boolean release_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/Transport_Descriptor_Interface.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /*TAO_CONNECTION_DESCRIPTOR_INTERFACE_H*/
diff --git a/TAO/tao/Transport_Descriptor_Interface.inl b/TAO/tao/Transport_Descriptor_Interface.inl
new file mode 100644
index 00000000000..4e667f946a9
--- /dev/null
+++ b/TAO/tao/Transport_Descriptor_Interface.inl
@@ -0,0 +1,39 @@
+// -*- C++ -*-
+//
+//$Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO_Transport_Descriptor_Interface::TAO_Transport_Descriptor_Interface (
+ TAO_Endpoint *endpoint,
+ CORBA::Boolean take_ownership)
+ : endpoint_ (endpoint),
+ bidir_flag_ (false),
+ release_ (take_ownership)
+{
+}
+
+ACE_INLINE
+TAO_Transport_Descriptor_Interface::TAO_Transport_Descriptor_Interface (void)
+ : endpoint_ (0),
+ bidir_flag_ (false),
+ release_ (false)
+{
+}
+
+
+ACE_INLINE TAO_Endpoint *
+TAO_Transport_Descriptor_Interface::endpoint (void)
+{
+ return this->endpoint_;
+}
+
+
+ACE_INLINE void
+TAO_Transport_Descriptor_Interface::set_bidir_flag (CORBA::Boolean flag)
+{
+ this->bidir_flag_ = flag;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Transport_Mux_Strategy.cpp b/TAO/tao/Transport_Mux_Strategy.cpp
new file mode 100644
index 00000000000..beb04aba840
--- /dev/null
+++ b/TAO/tao/Transport_Mux_Strategy.cpp
@@ -0,0 +1,23 @@
+// $Id$
+
+#include "tao/Transport_Mux_Strategy.h"
+
+ACE_RCSID (tao,
+ Transport_Mux_Strategy,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Transport_Mux_Strategy::TAO_Transport_Mux_Strategy (
+ TAO_Transport *transport)
+ : transport_ (transport)
+ , lock_ (0)
+{
+}
+
+TAO_Transport_Mux_Strategy::~TAO_Transport_Mux_Strategy (void)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Transport_Mux_Strategy.h b/TAO/tao/Transport_Mux_Strategy.h
new file mode 100644
index 00000000000..1dcc0f2ba11
--- /dev/null
+++ b/TAO/tao/Transport_Mux_Strategy.h
@@ -0,0 +1,105 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Transport_Mux_Strategy.h
+ *
+ * $Id$
+ *
+ * @author Alexander Babu Arulanthu <alex@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_TRANSPORT_MUX_STRATEGY_H
+#define TAO_TRANSPORT_MUX_STRATEGY_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/TAO_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Basic_Types.h"
+
+ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+class ACE_Lock;
+ACE_END_VERSIONED_NAMESPACE_DECL
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Reply_Dispatcher;
+class TAO_Transport;
+class TAO_Pluggable_Reply_Params;
+
+/**
+ * @class TAO_Transport_Mux_Strategy
+ *
+ * @brief Strategy to determine whether the connection should be
+ * multiplexed for multiple requests or it is exclusive for a
+ * single request at a time.
+ *
+ */
+class TAO_Export TAO_Transport_Mux_Strategy
+{
+
+public:
+ /// Base class constructor.
+ TAO_Transport_Mux_Strategy (TAO_Transport *transport);
+
+ /// Base class destructor.
+ virtual ~TAO_Transport_Mux_Strategy (void);
+
+ /// Generate and return an unique request id for the current
+ /// invocation.
+ virtual CORBA::ULong request_id (void) = 0;
+
+ // = Bind and Find methods for the <Request ID, ReplyDispatcher>
+ // pairs.
+
+ /// Bind the dispatcher with the request id. Commonalities in the
+ /// derived class implementations is kept here.
+ virtual int bind_dispatcher (CORBA::ULong request_id,
+ TAO_Reply_Dispatcher *rd) = 0;
+
+ /**
+ * Unbind the dispatcher, the client is no longer waiting for the
+ * request, for example, because the request timedout.
+ * The strategy can (must) cleanup any resources associated with the
+ * request.
+ * A later reply for that request should be ignored.
+ */
+ virtual int unbind_dispatcher (CORBA::ULong request_id) = 0;
+
+ /// Dispatch the reply for <request_id>, cleanup any resources
+ /// allocated for that request.
+ virtual int dispatch_reply (TAO_Pluggable_Reply_Params &params) = 0;
+
+ /// Request has been just sent, but the reply is not received. Idle
+ /// the transport now. The return value indicates whether idling was
+ /// successful or not.
+ virtual bool idle_after_send (void) = 0;
+
+ /// Request is sent and the reply is received. Idle the transport
+ /// now. The return value indicates whether idling was successful or
+ /// not.
+ virtual bool idle_after_reply (void) = 0;
+
+ /// The transport object has closed the connection, inform all Reply
+ /// dispatchers and waiting strategies.
+ virtual void connection_closed (void) = 0;
+
+protected:
+ /// Cache the transport reference.
+ TAO_Transport *transport_;
+
+ /// Lock to protect the state of the object
+ ACE_Lock *lock_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TRANSPORT_MUX_STRATEGY_H */
diff --git a/TAO/tao/Transport_Queueing_Strategies.cpp b/TAO/tao/Transport_Queueing_Strategies.cpp
new file mode 100644
index 00000000000..4de33f760dd
--- /dev/null
+++ b/TAO/tao/Transport_Queueing_Strategies.cpp
@@ -0,0 +1,231 @@
+// $Id$
+
+#include "tao/Transport_Queueing_Strategies.h"
+#include "tao/Buffering_Constraint_Policy.h"
+#include "tao/Stub.h"
+#include "tao/debug.h"
+
+#include "ace/Log_Msg.h"
+#include "ace/OS_NS_sys_time.h"
+
+ACE_RCSID (tao,
+ Transport_Queueing_Strategies,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ Transport_Queueing_Strategy::~Transport_Queueing_Strategy (void)
+ {
+ }
+
+// ****************************************************************
+
+ bool
+ Default_Transport_Queueing_Strategy::must_queue (bool) const
+ {
+ return false;
+ }
+
+ bool
+ Default_Transport_Queueing_Strategy::buffering_constraints_reached (
+ TAO_Stub *,
+ size_t ,
+ size_t ,
+ bool &must_flush,
+ const ACE_Time_Value &,
+ bool &set_timer,
+ ACE_Time_Value &) const
+ {
+ set_timer = false;
+ must_flush = false;
+ return true;
+ }
+
+// ****************************************************************
+
+ bool
+ Flush_Transport_Queueing_Strategy::must_queue (bool) const
+ {
+ return false;
+ }
+
+ bool
+ Flush_Transport_Queueing_Strategy::buffering_constraints_reached (
+ TAO_Stub *,
+ size_t ,
+ size_t ,
+ bool &must_flush,
+ const ACE_Time_Value &,
+ bool &set_timer,
+ ACE_Time_Value &) const
+ {
+ set_timer = false;
+ must_flush = true;
+ return true;
+ }
+
+// ****************************************************************
+
+ #if (TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1)
+
+ bool
+ Eager_Transport_Queueing_Strategy::must_queue (bool) const
+ {
+ return true;
+ }
+
+ bool
+ Eager_Transport_Queueing_Strategy::buffering_constraints_reached (
+ TAO_Stub *stub,
+ size_t msg_count,
+ size_t total_bytes,
+ bool &must_flush,
+ const ACE_Time_Value &current_deadline,
+ bool &set_timer,
+ ACE_Time_Value &new_deadline) const
+ {
+ must_flush = false;
+ set_timer = false;
+
+ TAO_Buffering_Constraint_Policy *buffering_constraint_policy = 0;
+
+ ACE_TRY_NEW_ENV
+ {
+ CORBA::Policy_var bcp_policy =
+ stub->get_cached_policy (TAO_CACHED_POLICY_BUFFERING_CONSTRAINT
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ TAO::BufferingConstraintPolicy_var bcp =
+ TAO::BufferingConstraintPolicy::_narrow (bcp_policy.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ buffering_constraint_policy =
+ dynamic_cast<TAO_Buffering_Constraint_Policy *> (bcp.in ());
+
+ if (buffering_constraint_policy == 0)
+ {
+ return true;
+ }
+ }
+ ACE_CATCHANY
+ {
+ return true;
+ }
+ ACE_ENDTRY;
+
+ TAO::BufferingConstraint buffering_constraint;
+ buffering_constraint_policy->get_buffering_constraint (buffering_constraint);
+
+ if (buffering_constraint.mode == TAO::BUFFER_FLUSH)
+ {
+ must_flush = true;
+ return true;
+ }
+
+ bool constraints_reached = false;
+
+ if (ACE_BIT_ENABLED (buffering_constraint.mode,
+ TAO::BUFFER_MESSAGE_COUNT)
+ && msg_count >= buffering_constraint.message_count)
+ {
+ constraints_reached = true;
+ }
+
+ if (ACE_BIT_ENABLED (buffering_constraint.mode,
+ TAO::BUFFER_MESSAGE_BYTES)
+ && total_bytes >= buffering_constraint.message_bytes)
+ {
+ constraints_reached = true;
+ }
+
+ if (this->timer_check (buffering_constraint,
+ current_deadline,
+ set_timer,
+ new_deadline))
+ {
+ constraints_reached = true;
+ }
+
+ return constraints_reached;
+ }
+
+ bool
+ Eager_Transport_Queueing_Strategy::timer_check (
+ const TAO::BufferingConstraint &buffering_constraint,
+ const ACE_Time_Value &current_deadline,
+ bool &set_timer,
+ ACE_Time_Value &new_deadline) const
+ {
+ set_timer = false;
+
+ if (!ACE_BIT_ENABLED (buffering_constraint.mode,
+ TAO::BUFFER_TIMEOUT))
+ {
+ return false;
+ }
+
+ // Compute the next deadline...
+ ACE_Time_Value now = ACE_OS::gettimeofday ();
+ ACE_Time_Value timeout =
+ this->time_conversion (buffering_constraint.timeout);
+ new_deadline = now + timeout;
+
+ // Check if the new deadline is more stringent, or if the deadline
+ // has expired and thus must be reset anyway.
+ if (current_deadline > new_deadline
+ || current_deadline < now)
+ {
+ set_timer = true;
+ }
+
+ // ... if there is no deadline we don't want to schedule output (the
+ // deadline will be set because set_timer is set to 1 in that case).
+ // If there is a deadline but but it has not been reached, we
+ // don't want to schedule any output either...
+ if (current_deadline == ACE_Time_Value::zero
+ || current_deadline >= now)
+ {
+ return false;
+ }
+
+ if (TAO_debug_level > 6)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - TAO_Eager_Buffering_Sync_Strategy::timer_check, "
+ "Now = %u, Current = %u, New = %u\n",
+ now.msec (), current_deadline.msec (),
+ new_deadline.msec ()));
+ }
+
+ return true;
+ }
+
+ ACE_Time_Value
+ Eager_Transport_Queueing_Strategy::time_conversion (
+ const TimeBase::TimeT &time) const
+ {
+ TimeBase::TimeT seconds = time / 10000000u;
+ TimeBase::TimeT microseconds = (time % 10000000u) / 10;
+ return ACE_Time_Value (ACE_U64_TO_U32 (seconds),
+ ACE_U64_TO_U32 (microseconds));
+ }
+
+// ****************************************************************
+
+ bool
+ Delayed_Transport_Queueing_Strategy::must_queue (bool queue_empty) const
+ {
+ // If the queue is empty we want to send immediately
+ return !queue_empty;
+ }
+
+ #endif /* TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1 */
+
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Transport_Queueing_Strategies.h b/TAO/tao/Transport_Queueing_Strategies.h
new file mode 100644
index 00000000000..56ba66149ee
--- /dev/null
+++ b/TAO/tao/Transport_Queueing_Strategies.h
@@ -0,0 +1,185 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Transport_Queueing_Strategies.h
+ *
+ * $Id$
+ *
+ * Queueing strategies for the ORB Messaging layer.
+ *
+ * @author Irfan Pyarali
+ */
+//=============================================================================
+
+
+#ifndef TAO_TRANSPORT_QUEUEING_STRATEGIES_H
+#define TAO_TRANSPORT_QUEUEING_STRATEGIES_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/TAO_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/orbconf.h"
+#include "tao/Basic_Types.h"
+
+ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+class ACE_Time_Value;
+ACE_END_VERSIONED_NAMESPACE_DECL
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Stub;
+
+namespace TAO
+{
+ struct BufferingConstraint;
+}
+
+namespace TimeBase
+{
+ typedef CORBA::ULongLong TimeT;
+}
+
+namespace TAO
+{
+ /// Define the interface for the Queueing Strategy
+ /**
+ * The low-level I/O components in the ORB use this strategy to
+ * determine when messages must be queued, immediately sent or
+ * flushed.
+ *
+ * The strategy isolates this low-level components from the higher
+ * level strategies used by the application developer.
+ */
+ class Transport_Queueing_Strategy
+ {
+ public:
+ /// Destructor
+ virtual ~Transport_Queueing_Strategy (void);
+
+ /// Return true if a message must be queued
+ virtual bool must_queue (bool queue_empty) const = 0;
+
+ /// Return true if it is time to start
+ /**
+ * @param stub The object used to make the request, this is used to
+ * obtain the policies currently in effect for the request
+ * @param msg_count The number of messages currently queued
+ * @param total_bytes Number of bytes currently queued
+ * @param set_timer Returns true if a timer should be set to drain the
+ * queue
+ * @param interval If set_timer returns 1, this parameter contains
+ * the timer interval
+ * @param must_flush Is set to true if things must be flushed at this
+ * moment
+ */
+ virtual bool buffering_constraints_reached (
+ TAO_Stub *stub,
+ size_t msg_count,
+ size_t total_bytes,
+ bool &must_flush,
+ const ACE_Time_Value &current_deadline,
+ bool &set_timer,
+ ACE_Time_Value &interval) const = 0;
+ };
+
+ class Default_Transport_Queueing_Strategy : public Transport_Queueing_Strategy
+ {
+ public:
+ virtual bool must_queue (bool queue_empty) const;
+
+ virtual bool buffering_constraints_reached (
+ TAO_Stub *stub,
+ size_t msg_count,
+ size_t total_bytes,
+ bool &must_flush,
+ const ACE_Time_Value &current_deadline,
+ bool &set_timer,
+ ACE_Time_Value &interval) const;
+ };
+
+ /**
+ * This strategy doesn't not queue by default, but when a message is queued
+ * we always flush it to the transport. This is used for oneways with
+ * SYNC_WITH_TRANSPORT, SYNC_WITH_SERVER and SYNC_WITH_TARGET
+ */
+ class Flush_Transport_Queueing_Strategy : public Transport_Queueing_Strategy
+ {
+ public:
+ virtual bool must_queue (bool queue_empty) const;
+
+ virtual bool buffering_constraints_reached (
+ TAO_Stub *stub,
+ size_t msg_count,
+ size_t total_bytes,
+ bool &must_flush,
+ const ACE_Time_Value &current_deadline,
+ bool &set_timer,
+ ACE_Time_Value &interval) const;
+ };
+
+ #if (TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1)
+
+ class Eager_Transport_Queueing_Strategy : public Transport_Queueing_Strategy
+ {
+ public:
+ virtual bool must_queue (bool queue_empty) const;
+
+ virtual bool buffering_constraints_reached (
+ TAO_Stub *stub,
+ size_t msg_count,
+ size_t total_bytes,
+ bool &must_flush,
+ const ACE_Time_Value &current_deadline,
+ bool &set_timer,
+ ACE_Time_Value &new_deadline) const;
+
+ private:
+ /// Check if the buffering constraint includes any timeouts and
+ /// compute the right timeout interval if needed.
+ /**
+ * @param buffering_constraint The constraints defined by the
+ * application
+ * @param current_deadline The current deadline
+ * @param set_timer Return true if the timer should be set
+ * @param new_deadline Return the timer interval value
+ *
+ * @return Returns true if the deadline has already expired and
+ * flushing must commence immediately. If the function
+ * returns false then flushing may need to be delayed, use @c
+ * set_timer and
+ */
+ bool timer_check (const TAO::BufferingConstraint &buffering_constraint,
+ const ACE_Time_Value &current_deadline,
+ bool &set_timer,
+ ACE_Time_Value &new_deadline) const;
+
+ /// Convert from standard CORBA time units to seconds/microseconds.
+ ACE_Time_Value time_conversion (const TimeBase::TimeT &time) const;
+ };
+
+ /// Delay the buffering decision until the transport blocks
+ /**
+ * If the queue is empty the transport will try to send immediately.
+ */
+ class Delayed_Transport_Queueing_Strategy
+ : public Eager_Transport_Queueing_Strategy
+ {
+ public:
+ virtual bool must_queue (bool queue_empty) const;
+ };
+
+ #endif /* TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1 */
+
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_TRANSPORT_QUEUEING_STRATEGY_H */
diff --git a/TAO/tao/Transport_Timer.cpp b/TAO/tao/Transport_Timer.cpp
new file mode 100644
index 00000000000..6a704fbd72f
--- /dev/null
+++ b/TAO/tao/Transport_Timer.cpp
@@ -0,0 +1,24 @@
+// $Id$
+
+#include "tao/Transport_Timer.h"
+#include "tao/Transport.h"
+
+ACE_RCSID (tao,
+ Transport_Timer,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Transport_Timer::TAO_Transport_Timer (TAO_Transport *transport)
+ : transport_ (transport)
+{
+}
+
+int
+TAO_Transport_Timer::handle_timeout (const ACE_Time_Value &current_time,
+ const void *act)
+{
+ return this->transport_->handle_timeout (current_time, act);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Transport_Timer.h b/TAO/tao/Transport_Timer.h
new file mode 100644
index 00000000000..ddd3e8d8b4d
--- /dev/null
+++ b/TAO/tao/Transport_Timer.h
@@ -0,0 +1,61 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Transport_Timer.h
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan <coryan@uci.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_TRANSPORT_TIMER_H
+#define TAO_TRANSPORT_TIMER_H
+
+#include /**/ "ace/pre.h"
+#include "ace/Event_Handler.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/TAO_Export.h"
+#include "tao/Versioned_Namespace.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Transport;
+
+/**
+ * @class TAO_Transport_Timer
+ *
+ * @brief Allows TAO_Transport instances to receive timeout
+ * notifications from the Reactor. In other words, implements
+ * the Adapter Role, of the Adapter Pattern, where the Adaptee
+ * is a TAO_Transport and the client is the Reactor.
+ *
+ */
+class TAO_Transport_Timer : public ACE_Event_Handler
+{
+public:
+ /// Constructor
+ /**
+ * @param transport The adaptee
+ */
+ TAO_Transport_Timer (TAO_Transport *transport);
+
+ /// Receive timeout events from the Reactor and forward them to the
+ /// TAO_Transport
+ virtual int handle_timeout (const ACE_Time_Value &current_time,
+ const void *act);
+private:
+ /// The Adaptee
+ TAO_Transport *transport_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_TRANSPORT_TIMER_H */
diff --git a/TAO/tao/TypeCodeFactory.mpc b/TAO/tao/TypeCodeFactory.mpc
new file mode 100644
index 00000000000..d6cf7fa82fe
--- /dev/null
+++ b/TAO/tao/TypeCodeFactory.mpc
@@ -0,0 +1,41 @@
+//$Id$
+project : taolib, core, ifr_client, tao_versioning_idl_defaults {
+ sharedname = TAO_TypeCodeFactory
+ dynamicflags = TAO_TYPECODEFACTORY_BUILD_DLL
+
+ Source_Files {
+ TypeCodeFactory
+ }
+
+ Header_Files {
+ TypeCodeFactory
+ }
+
+ Inline_Files {
+ TypeCodeFactory
+ }
+
+ Template_Files {
+ TypeCodeFactory
+ }
+
+ Resource_Files {
+ TypeCodeFactory
+ }
+
+ PIDL_Files {
+ }
+
+ IDL_Files {
+ idlflags += -SS -Sci -Ge 1 -Sorb \
+ -Wb,export_macro=TAO_TypeCodeFactory_Export \
+ -Wb,export_include=tao/TypeCodeFactory/typecodefactory_export.h \
+ -o TypeCodeFactory
+ idlflags -= -Sa -St
+ TypeCodeFactory/TypeCodeFactory.pidl
+ }
+
+ Pkgconfig_Files {
+ TypeCodeFactory/TAO_TypeCodeFactory.pc.in
+ }
+}
diff --git a/TAO/tao/TypeCodeFactory/README b/TAO/tao/TypeCodeFactory/README
new file mode 100644
index 00000000000..97d0b2546b2
--- /dev/null
+++ b/TAO/tao/TypeCodeFactory/README
@@ -0,0 +1,27 @@
+$Id$
+
+TypeCodeFactory -------
+
+This library is used by the Interface Repository and
+by CORBA::ORB to create typecodes. To minimize
+dependencies and footprint, this library need not be
+built or linked by an application. However, if an
+application needs to call CORBA::ORB::create_*_tc(),
+then it should #include the library's header file
+TypeCodeFactory_Adapter_Impl.h and link the library.
+This will automatically load the library, assuming
+it has been compiled. If an application is using the
+Interface Repository, nothing special need be done -
+the IFR will link the TypeCodeFactory library in its
+own build.
+
+Since the TypeCodeFactory must deal with Interface
+Repository data types, it depends on the
+TAO_IFR_Client library.
+
+Support has now been added for valuetypes, components,
+homes, eventtypes and recursive types. For an example
+of how to create a typecode for a recursive type, see
+the OMG CORBA specification section on typecode creation
+(in version 3.0, section 4.11.3).
+
diff --git a/TAO/tao/TypeCodeFactory/Recursive_TypeCode.cpp b/TAO/tao/TypeCodeFactory/Recursive_TypeCode.cpp
new file mode 100644
index 00000000000..3a8f77cdb6d
--- /dev/null
+++ b/TAO/tao/TypeCodeFactory/Recursive_TypeCode.cpp
@@ -0,0 +1,281 @@
+// $Id$
+
+#include "tao/TypeCodeFactory/Recursive_TypeCode.h"
+
+#ifndef __ACE_INLINE__
+# include "tao/TypeCodeFactory/Recursive_TypeCode.inl"
+#endif /* __ACE_INLINE__ */
+
+#include "tao/SystemException.h"
+#include "tao/ORB_Constants.h"
+
+
+ACE_RCSID (TypeCodeFactory,
+ Recursive_TypeCode,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+bool
+TAO::TypeCodeFactory::Recursive_TypeCode::tao_marshal (
+ TAO_OutputCDR & cdr,
+ CORBA::ULong offset) const
+{
+ ACE_DECLARE_NEW_CORBA_ENV;
+
+ if (CORBA::is_nil (this->the_typecode_.in ()))
+ {
+ // Marshaling an incomplete recursive TypeCode placeholder is
+ // not allowed.
+
+ ACE_THROW_RETURN (CORBA::BAD_TYPECODE (CORBA::OMGVMCID | 1,
+ CORBA::COMPLETED_NO),
+ false);
+ }
+
+ return this->the_typecode_->tao_marshal (cdr, offset);
+}
+
+bool
+TAO::TypeCodeFactory::Recursive_TypeCode::tao_marshal_kind (
+ TAO_OutputCDR & cdr) const
+{
+ ACE_DECLARE_NEW_CORBA_ENV;
+
+ if (CORBA::is_nil (this->the_typecode_.in ()))
+ {
+ // Marshaling an incomplete recursive TypeCode placeholder is
+ // not allowed.
+
+ ACE_THROW_RETURN (CORBA::BAD_TYPECODE (CORBA::OMGVMCID | 1,
+ CORBA::COMPLETED_NO),
+ false);
+ }
+
+ return this->the_typecode_->tao_marshal_kind (cdr);
+}
+
+void
+TAO::TypeCodeFactory::Recursive_TypeCode::tao_duplicate (void)
+{
+ this->add_ref ();
+}
+
+void
+TAO::TypeCodeFactory::Recursive_TypeCode::tao_release (void)
+{
+ this->remove_ref ();
+}
+
+CORBA::Boolean
+TAO::TypeCodeFactory::Recursive_TypeCode::equal_i (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const
+{
+ if (CORBA::is_nil (this->the_typecode_.in ()))
+ {
+ // Nothing to compare yet.
+
+ ACE_THROW_RETURN (CORBA::BAD_TYPECODE (0,
+ CORBA::COMPLETED_NO),
+ false);
+ }
+
+ return this->the_typecode_->equal (tc
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::Boolean
+TAO::TypeCodeFactory::Recursive_TypeCode::equivalent_i (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const
+{
+ if (CORBA::is_nil (this->the_typecode_.in ()))
+ {
+ // Nothing to compare yet.
+
+ ACE_THROW_RETURN (CORBA::BAD_TYPECODE (0,
+ CORBA::COMPLETED_NO),
+ false);
+ }
+
+ return this->the_typecode_->equivalent (tc
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::TypeCode_ptr
+TAO::TypeCodeFactory::Recursive_TypeCode::get_compact_typecode_i (
+ ACE_ENV_SINGLE_ARG_DECL) const
+{
+ if (CORBA::is_nil (this->the_typecode_.in ()))
+ {
+ // Nothing to compare yet.
+
+ ACE_THROW_RETURN (CORBA::BAD_TYPECODE (0,
+ CORBA::COMPLETED_NO),
+ CORBA::TypeCode::_nil ());
+ }
+
+ return
+ this->the_typecode_->get_compact_typecode (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+char const *
+TAO::TypeCodeFactory::Recursive_TypeCode::id_i (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED) const
+{
+ // Ownership is retained by the TypeCode, as required by the C++
+ // mapping.
+ return this->id_.in ();
+}
+
+char const *
+TAO::TypeCodeFactory::Recursive_TypeCode::name_i (
+ ACE_ENV_SINGLE_ARG_DECL) const
+{
+ if (CORBA::is_nil (this->the_typecode_.in ()))
+ {
+ ACE_THROW_RETURN (CORBA::BAD_TYPECODE (0,
+ CORBA::COMPLETED_NO),
+ 0);
+ }
+
+ return this->the_typecode_->name (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+CORBA::ULong
+TAO::TypeCodeFactory::Recursive_TypeCode::member_count_i (
+ ACE_ENV_SINGLE_ARG_DECL) const
+{
+ if (CORBA::is_nil (this->the_typecode_.in ()))
+ {
+ ACE_THROW_RETURN (CORBA::BAD_TYPECODE (0,
+ CORBA::COMPLETED_NO),
+ 0);
+ }
+
+ return this->the_typecode_->member_count (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+char const *
+TAO::TypeCodeFactory::Recursive_TypeCode::member_name_i (
+ CORBA::ULong index
+ ACE_ENV_ARG_DECL) const
+{
+ if (CORBA::is_nil (this->the_typecode_.in ()))
+ {
+ ACE_THROW_RETURN (CORBA::BAD_TYPECODE (0,
+ CORBA::COMPLETED_NO),
+ 0);
+ }
+
+ return this->the_typecode_->member_name (index
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::TypeCode_ptr
+TAO::TypeCodeFactory::Recursive_TypeCode::member_type_i (
+ CORBA::ULong index
+ ACE_ENV_ARG_DECL) const
+{
+ if (CORBA::is_nil (this->the_typecode_.in ()))
+ {
+ ACE_THROW_RETURN (CORBA::BAD_TYPECODE (0,
+ CORBA::COMPLETED_NO),
+ CORBA::TypeCode::_nil ());
+ }
+
+ return this->the_typecode_->member_type (index
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::Any *
+TAO::TypeCodeFactory::Recursive_TypeCode::member_label_i (
+ CORBA::ULong index
+ ACE_ENV_ARG_DECL) const
+{
+ if (CORBA::is_nil (this->the_typecode_.in ()))
+ {
+ ACE_THROW_RETURN (CORBA::BAD_TYPECODE (0,
+ CORBA::COMPLETED_NO),
+ 0);
+ }
+
+ return
+ this->the_typecode_->member_label (index
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::TypeCode_ptr
+TAO::TypeCodeFactory::Recursive_TypeCode::discriminator_type_i (
+ ACE_ENV_SINGLE_ARG_DECL) const
+{
+ if (CORBA::is_nil (this->the_typecode_.in ()))
+ {
+ ACE_THROW_RETURN (CORBA::BAD_TYPECODE (0,
+ CORBA::COMPLETED_NO),
+ CORBA::TypeCode::_nil ());
+ }
+
+ return
+ this->the_typecode_->discriminator_type (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+CORBA::Long
+TAO::TypeCodeFactory::Recursive_TypeCode::default_index_i (
+ ACE_ENV_SINGLE_ARG_DECL) const
+{
+ if (CORBA::is_nil (this->the_typecode_.in ()))
+ {
+ ACE_THROW_RETURN (CORBA::BAD_TYPECODE (0,
+ CORBA::COMPLETED_NO),
+ 0);
+ }
+
+ return this->the_typecode_->default_index (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+CORBA::Visibility
+TAO::TypeCodeFactory::Recursive_TypeCode::member_visibility_i (
+ CORBA::ULong index
+ ACE_ENV_ARG_DECL) const
+{
+ if (CORBA::is_nil (this->the_typecode_.in ()))
+ {
+ ACE_THROW_RETURN (CORBA::BAD_TYPECODE (0,
+ CORBA::COMPLETED_NO),
+ CORBA::PRIVATE_MEMBER);
+ }
+
+ return this->the_typecode_->member_visibility (index
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::ValueModifier
+TAO::TypeCodeFactory::Recursive_TypeCode::type_modifier_i (
+ ACE_ENV_SINGLE_ARG_DECL) const
+{
+ if (CORBA::is_nil (this->the_typecode_.in ()))
+ {
+ ACE_THROW_RETURN (CORBA::BAD_TYPECODE (0,
+ CORBA::COMPLETED_NO),
+ CORBA::VM_NONE);
+ }
+
+ return this->the_typecode_->type_modifier (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+CORBA::TypeCode_ptr
+TAO::TypeCodeFactory::Recursive_TypeCode::concrete_base_type_i (
+ ACE_ENV_SINGLE_ARG_DECL) const
+{
+ if (CORBA::is_nil (this->the_typecode_.in ()))
+ {
+ ACE_THROW_RETURN (CORBA::BAD_TYPECODE (0,
+ CORBA::COMPLETED_NO),
+ CORBA::TypeCode::_nil ());
+ }
+
+ return
+ this->the_typecode_->concrete_base_type (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/TypeCodeFactory/Recursive_TypeCode.h b/TAO/tao/TypeCodeFactory/Recursive_TypeCode.h
new file mode 100644
index 00000000000..0f92a9bdc8b
--- /dev/null
+++ b/TAO/tao/TypeCodeFactory/Recursive_TypeCode.h
@@ -0,0 +1,131 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Recursive_TypeCode.h
+ *
+ * $Id$
+ *
+ * Header file for a intermediate recursive CORBA::TypeCode.
+ *
+ * @author Ossama Othman
+ */
+//=============================================================================
+
+#ifndef TAO_RECURSIVE_TYPECODE_H
+#define TAO_RECURSIVE_TYPECODE_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/AnyTypeCode/TypeCode.h"
+#include "tao/AnyTypeCode/True_RefCount_Policy.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace TypeCodeFactory
+ {
+ /**
+ * @class Recursive_TypeCode
+ *
+ * @brief Recursive @c TypeCode placeholder.
+ *
+ * This class implements a placeholder for recursive TypeCodes.
+ * It is meant solely for use as an intermediate TypeCode, and
+ * merely forwards all operations to the actual recursive TypeCode
+ * that is set by the TypeCodeFactory.
+ *
+ * @note This class serves a purpose different than the one served
+ * by the @c TAO::TypeCode::Recursive class.
+ */
+ class Recursive_TypeCode
+ : public CORBA::TypeCode,
+ private TAO::True_RefCount_Policy
+ {
+ public:
+
+ /// Constructor.
+ Recursive_TypeCode (char const * id);
+
+ /// Set the actual recursive TypeCode to which all TypeCode
+ /// operations will be forwarded.
+ void the_typecode (CORBA::TypeCode_ptr tc);
+
+ /**
+ * @name TAO-specific @c CORBA::TypeCode Methods
+ *
+ * Methods required by TAO's implementation of the
+ * @c CORBA::TypeCode class.
+ *
+ * @see @c CORBA::TypeCode
+ */
+ //@{
+ virtual bool tao_marshal_kind (TAO_OutputCDR & cdr) const;
+ virtual bool tao_marshal (TAO_OutputCDR & cdr,
+ CORBA::ULong offset) const;
+ virtual void tao_duplicate (void);
+ virtual void tao_release (void);
+ //@}
+
+ protected:
+
+ /**
+ * @name TAO @c CORBA::TypeCode Template Methods
+ *
+ * Recursive type-capable (i.e. @c struct, @c union,
+ * @c valuetype and @c eventtype) @c CORBA::TypeCode -specific
+ * template methods
+ *
+ * @see @c CORBA::TypeCode
+ */
+ //@{
+ virtual CORBA::Boolean equal_i (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const;
+ virtual CORBA::Boolean equivalent_i (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL) const;
+ virtual CORBA::TypeCode_ptr get_compact_typecode_i (
+ ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual char const * id_i (ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual char const * name_i (ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual CORBA::ULong member_count_i (ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual char const * member_name_i (CORBA::ULong index
+ ACE_ENV_ARG_DECL) const;
+ virtual CORBA::TypeCode_ptr member_type_i (CORBA::ULong index
+ ACE_ENV_ARG_DECL) const;
+ virtual CORBA::Any * member_label_i (CORBA::ULong index
+ ACE_ENV_ARG_DECL) const;
+ virtual CORBA::TypeCode_ptr discriminator_type_i (
+ ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual CORBA::Long default_index_i (ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual CORBA::Visibility member_visibility_i (CORBA::ULong index
+ ACE_ENV_ARG_DECL) const;
+ virtual CORBA::ValueModifier type_modifier_i (
+ ACE_ENV_SINGLE_ARG_DECL) const;
+ virtual CORBA::TypeCode_ptr concrete_base_type_i (
+ ACE_ENV_SINGLE_ARG_DECL) const;
+
+ //@}
+
+ private:
+
+ /// Repository ID.
+ CORBA::String_var id_;
+
+ /// The actual recursive TypeCode.
+ CORBA::TypeCode_var the_typecode_;
+
+ };
+
+ } // End namespace TypeCodeFactory
+} // End namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#ifdef __ACE_INLINE__
+# include "tao/TypeCodeFactory/Recursive_TypeCode.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_RECURSIVE_TYPECODE_H */
diff --git a/TAO/tao/TypeCodeFactory/Recursive_TypeCode.inl b/TAO/tao/TypeCodeFactory/Recursive_TypeCode.inl
new file mode 100644
index 00000000000..2a425197aa7
--- /dev/null
+++ b/TAO/tao/TypeCodeFactory/Recursive_TypeCode.inl
@@ -0,0 +1,31 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO::TypeCodeFactory::Recursive_TypeCode::Recursive_TypeCode (char const * id)
+ : ::CORBA::TypeCode (CORBA::TAO_TC_KIND_COUNT)
+ , ::TAO::True_RefCount_Policy ()
+ , id_ (id)
+ , the_typecode_ ()
+{
+}
+
+ACE_INLINE void
+TAO::TypeCodeFactory::Recursive_TypeCode::the_typecode (CORBA::TypeCode_ptr tc)
+{
+ this->the_typecode_ = CORBA::TypeCode::_duplicate (tc);
+
+ ACE_DECLARE_NEW_CORBA_ENV;
+
+ // @@ Lazy, I know. :(
+ CORBA::TCKind & mutable_kind =
+ const_cast<CORBA::TCKind &> (this->kind_);
+
+ mutable_kind = tc->kind (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/TypeCodeFactory/TAO_TypeCodeFactory.pc.in b/TAO/tao/TypeCodeFactory/TAO_TypeCodeFactory.pc.in
new file mode 100644
index 00000000000..2f3b5d1bbf2
--- /dev/null
+++ b/TAO/tao/TypeCodeFactory/TAO_TypeCodeFactory.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: TAO_TypeCodeFactory
+Description: TAO TypeCode Factory Library
+Requires: TAO_IFR_Client, TAO_AnyTypeCode, TAO
+Version: @VERSION@
+Libs: -L${libdir} -lTAO_TypeCodeFactory
+Cflags: -I${includedir}
diff --git a/TAO/tao/TypeCodeFactory/TypeCodeFactory.pidl b/TAO/tao/TypeCodeFactory/TypeCodeFactory.pidl
new file mode 100644
index 00000000000..365decca637
--- /dev/null
+++ b/TAO/tao/TypeCodeFactory/TypeCodeFactory.pidl
@@ -0,0 +1,145 @@
+//
+// $Id$
+
+/**
+ * @file TypeCodeFactory.pidl
+ *
+ * It was originally part of Interface.idl, but since the TypeCodeFactory
+ * has been made into a separate library, and the TypeCodeFactory interface
+ * has been made local, it is simpler to generate the necessary stub
+ * code in TypeCodeFactoryC.* by splitting Interface.idl into two
+ * parts.
+ */
+
+// ================================================================
+
+#ifndef _TYPECODEFACTORY_IDL_
+#define _TYPECODEFACTORY_IDL_
+
+#include "tao/IFR_Client/IFR_Extended.pidl"
+
+#pragma prefix "omg.org"
+
+module CORBA
+{
+// These are pulled in from #includes.
+/*
+ typedef string Identifier;
+ typedef string RepositoryId;
+ typedef short ValueModifier;
+*/
+ local interface TypeCodeFactory
+ {
+ TypeCode create_struct_tc (
+ in RepositoryId id,
+ in Identifier name,
+ in StructMemberSeq members
+ );
+
+ TypeCode create_union_tc (
+ in RepositoryId id,
+ in Identifier name,
+ in TypeCode discriminator_type,
+ in UnionMemberSeq members
+ );
+
+ TypeCode create_enum_tc (
+ in RepositoryId id,
+ in Identifier name,
+ in EnumMemberSeq members
+ );
+
+ TypeCode create_alias_tc (
+ in RepositoryId id,
+ in Identifier name,
+ in TypeCode original_type
+ );
+
+ TypeCode create_exception_tc (
+ in RepositoryId id,
+ in Identifier name,
+ in StructMemberSeq members
+ );
+
+ TypeCode create_interface_tc (
+ in RepositoryId id,
+ in Identifier name
+ );
+
+ TypeCode create_string_tc (
+ in unsigned long bound
+ );
+
+ TypeCode create_wstring_tc (
+ in unsigned long bound
+ );
+
+ TypeCode create_fixed_tc (
+ in unsigned short digits,
+ in unsigned short scale
+ );
+
+ TypeCode create_sequence_tc (
+ in unsigned long bound,
+ in TypeCode element_type
+ );
+
+ TypeCode create_array_tc (
+ in unsigned long length,
+ in TypeCode element_type
+ );
+
+ TypeCode create_value_tc (
+ in RepositoryId id,
+ in Identifier name,
+ in ValueModifier type_modifier,
+ in TypeCode concrete_base,
+ in ValueMemberSeq members
+ );
+
+ TypeCode create_value_box_tc (
+ in RepositoryId id,
+ in Identifier name,
+ in TypeCode boxed_type
+ );
+
+ TypeCode create_native_tc (
+ in RepositoryId id,
+ in Identifier name
+ );
+
+ TypeCode create_recursive_tc (
+ in RepositoryId id
+ );
+
+ TypeCode create_abstract_interface_tc (
+ in RepositoryId id,
+ in Identifier name
+ );
+
+ TypeCode create_local_interface_tc (
+ in RepositoryId id,
+ in Identifier name
+ );
+
+ TypeCode create_component_tc (
+ in RepositoryId id,
+ in Identifier name
+ );
+
+ TypeCode create_home_tc (
+ in RepositoryId id,
+ in Identifier name
+ );
+
+ TypeCode create_event_tc (
+ in RepositoryId id,
+ in Identifier name,
+ in ValueModifier type_modifier,
+ in TypeCode concrete_base,
+ in ValueMemberSeq members
+ );
+ };
+};
+
+#endif // _TYPECODEFACTORY_IDL_
diff --git a/TAO/tao/TypeCodeFactory/TypeCodeFactory.rc b/TAO/tao/TypeCodeFactory/TypeCodeFactory.rc
new file mode 100644
index 00000000000..87bd0426914
--- /dev/null
+++ b/TAO/tao/TypeCodeFactory/TypeCodeFactory.rc
@@ -0,0 +1,30 @@
+#include "..\Version.h"
+
+1 VERSIONINFO
+ FILEVERSION TAO_MAJOR_VERSION,TAO_MINOR_VERSION,TAO_BETA_VERSION,0
+ PRODUCTVERSION TAO_MAJOR_VERSION,TAO_MINOR_VERSION,TAO_BETA_VERSION,0
+ FILEFLAGSMASK 0x3fL
+ FILEFLAGS 0x0L
+ FILEOS 0x4L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904B0"
+ BEGIN
+ VALUE "FileDescription", "TypeCodeFactory\0"
+ VALUE "FileVersion", TAO_VERSION "\0"
+ VALUE "InternalName", "TAO_TypeCodeFactoryDLL\0"
+ VALUE "LegalCopyright", "\0"
+ VALUE "LegalTrademarks", "\0"
+ VALUE "OriginalFilename", "TAO_TypeCodeFactory.DLL\0"
+ VALUE "ProductName", "TAO\0"
+ VALUE "ProductVersion", TAO_VERSION "\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
diff --git a/TAO/tao/TypeCodeFactory/TypeCodeFactory_Adapter_Impl.cpp b/TAO/tao/TypeCodeFactory/TypeCodeFactory_Adapter_Impl.cpp
new file mode 100644
index 00000000000..29fb9ac421f
--- /dev/null
+++ b/TAO/tao/TypeCodeFactory/TypeCodeFactory_Adapter_Impl.cpp
@@ -0,0 +1,423 @@
+// $Id$
+
+#include "tao/AnyTypeCode/AnyTypeCode_methods.h"
+#include "tao/TypeCodeFactory/TypeCodeFactory_Adapter_Impl.h"
+#include "tao/TypeCodeFactory/TypeCodeFactory_i.h"
+
+#include "tao/ORB_Core.h"
+
+
+ACE_RCSID (TypeCodeFactory,
+ TypeCodeFactory_Adapter_Impl,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_TypeCodeFactory_Adapter_Impl::~TAO_TypeCodeFactory_Adapter_Impl (void)
+{
+}
+
+CORBA::TypeCode_ptr
+TAO_TypeCodeFactory_Adapter_Impl::create_struct_tc (
+ const char * id,
+ const char * name,
+ const CORBA::StructMemberSeq & members
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ TAO_TypeCodeFactory_i tcf;
+
+ return tcf.create_struct_tc (id,
+ name,
+ members
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::TypeCode_ptr
+TAO_TypeCodeFactory_Adapter_Impl::create_union_tc (
+ const char * id,
+ const char * name,
+ CORBA::TypeCode_ptr discriminator_type,
+ const CORBA::UnionMemberSeq & members
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ TAO_TypeCodeFactory_i tcf;
+
+ return tcf.create_union_tc (id,
+ name,
+ discriminator_type,
+ members
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::TypeCode_ptr
+TAO_TypeCodeFactory_Adapter_Impl::create_enum_tc (
+ const char * id,
+ const char * name,
+ const CORBA::EnumMemberSeq & members
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ TAO_TypeCodeFactory_i tcf;
+
+ return tcf.create_enum_tc (id,
+ name,
+ members
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::TypeCode_ptr
+TAO_TypeCodeFactory_Adapter_Impl::create_alias_tc (
+ const char * id,
+ const char * name,
+ CORBA::TypeCode_ptr original_type
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ TAO_TypeCodeFactory_i tcf;
+
+ return tcf.create_alias_tc (id,
+ name,
+ original_type
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::TypeCode_ptr
+TAO_TypeCodeFactory_Adapter_Impl::create_exception_tc (
+ const char * id,
+ const char * name,
+ const CORBA::StructMemberSeq & members
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ TAO_TypeCodeFactory_i tcf;
+
+ return tcf.create_exception_tc (id,
+ name,
+ members
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::TypeCode_ptr
+TAO_TypeCodeFactory_Adapter_Impl::create_interface_tc (
+ const char * id,
+ const char * name
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ TAO_TypeCodeFactory_i tcf;
+
+ return tcf.create_interface_tc (id,
+ name
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::TypeCode_ptr
+TAO_TypeCodeFactory_Adapter_Impl::create_string_tc (
+ CORBA::ULong bound
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ TAO_TypeCodeFactory_i tcf;
+
+ return tcf.create_string_tc (bound
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::TypeCode_ptr
+TAO_TypeCodeFactory_Adapter_Impl::create_wstring_tc (
+ CORBA::ULong bound
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ TAO_TypeCodeFactory_i tcf;
+
+ return tcf.create_wstring_tc (bound
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::TypeCode_ptr
+TAO_TypeCodeFactory_Adapter_Impl::create_fixed_tc (
+ CORBA::UShort digits,
+ CORBA::UShort scale
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ TAO_TypeCodeFactory_i tcf;
+
+ return tcf.create_fixed_tc (digits,
+ scale
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::TypeCode_ptr
+TAO_TypeCodeFactory_Adapter_Impl::create_sequence_tc (
+ CORBA::ULong bound,
+ CORBA::TypeCode_ptr element_type
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ TAO_TypeCodeFactory_i tcf;
+
+ return tcf.create_sequence_tc (bound,
+ element_type
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::TypeCode_ptr
+TAO_TypeCodeFactory_Adapter_Impl::create_array_tc (
+ CORBA::ULong length,
+ CORBA::TypeCode_ptr element_type
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ TAO_TypeCodeFactory_i tcf;
+
+ return tcf.create_array_tc (length,
+ element_type
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::TypeCode_ptr
+TAO_TypeCodeFactory_Adapter_Impl::create_value_tc (
+ const char * id,
+ const char * name,
+ CORBA::ValueModifier type_modifier,
+ CORBA::TypeCode_ptr concrete_base,
+ const CORBA::ValueMemberSeq & members
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ TAO_TypeCodeFactory_i tcf;
+
+ return tcf.create_value_tc (id,
+ name,
+ type_modifier,
+ concrete_base,
+ members
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::TypeCode_ptr
+TAO_TypeCodeFactory_Adapter_Impl::create_value_box_tc (
+ const char * id,
+ const char * name,
+ CORBA::TypeCode_ptr boxed_type
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ TAO_TypeCodeFactory_i tcf;
+
+ return tcf.create_value_box_tc (id,
+ name,
+ boxed_type
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::TypeCode_ptr
+TAO_TypeCodeFactory_Adapter_Impl::create_native_tc (
+ const char * id,
+ const char * name
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ TAO_TypeCodeFactory_i tcf;
+
+ return tcf.create_native_tc (id,
+ name
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::TypeCode_ptr
+TAO_TypeCodeFactory_Adapter_Impl::create_recursive_tc (
+ const char * id
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ TAO_TypeCodeFactory_i tcf;
+
+ return tcf.create_recursive_tc (id
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::TypeCode_ptr
+TAO_TypeCodeFactory_Adapter_Impl::create_abstract_interface_tc (
+ const char * id,
+ const char * name
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ TAO_TypeCodeFactory_i tcf;
+
+ return tcf.create_abstract_interface_tc (id,
+ name
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::TypeCode_ptr
+TAO_TypeCodeFactory_Adapter_Impl::create_local_interface_tc (
+ const char * id,
+ const char * name
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ TAO_TypeCodeFactory_i tcf;
+
+ return tcf.create_local_interface_tc (id,
+ name
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::TypeCode_ptr
+TAO_TypeCodeFactory_Adapter_Impl::create_component_tc (
+ const char *id,
+ const char *name
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ TAO_TypeCodeFactory_i tcf;
+
+ return tcf.create_component_tc (id,
+ name
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::TypeCode_ptr
+TAO_TypeCodeFactory_Adapter_Impl::create_home_tc (
+ const char *id,
+ const char *name
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ TAO_TypeCodeFactory_i tcf;
+
+ return tcf.create_home_tc (id,
+ name
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::TypeCode_ptr
+TAO_TypeCodeFactory_Adapter_Impl::create_event_tc (
+ const char *id,
+ const char *name,
+ CORBA::ValueModifier type_modifier,
+ CORBA::TypeCode_ptr concrete_base,
+ const CORBA::ValueMemberSeq &members
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ TAO_TypeCodeFactory_i tcf;
+
+ return tcf.create_event_tc (id,
+ name,
+ type_modifier,
+ concrete_base,
+ members
+ ACE_ENV_ARG_PARAMETER);
+}
+
+// --
+
+CORBA::TypeCode_ptr
+TAO_TypeCodeFactory_Adapter_Impl::create_enum_tc (
+ char const * /* id */,
+ char const * /* name */,
+ ACE_Array_Base<CORBA::String_var> const & /* enumerators */,
+ CORBA::ULong /* ncases */
+ ACE_ENV_ARG_DECL)
+{
+ ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), CORBA::TypeCode::_nil ());
+}
+
+CORBA::TypeCode_ptr
+TAO_TypeCodeFactory_Adapter_Impl::create_struct_except_tc (
+ CORBA::TCKind /* kind */,
+ char const * /* id */,
+ char const * /* name */,
+ ACE_Array_Base<
+ TAO::TypeCode::Struct_Field<CORBA::String_var,
+ CORBA::TypeCode_var> > const & /* fields */,
+ CORBA::ULong /* nfields */
+ ACE_ENV_ARG_DECL)
+{
+ ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), CORBA::TypeCode::_nil ());
+}
+
+CORBA::TypeCode_ptr
+TAO_TypeCodeFactory_Adapter_Impl::create_union_tc (
+ char const * /* id */,
+ char const * /* name */,
+ CORBA::TypeCode_ptr /* discriminant_type */,
+ ACE_Array_Base<TAO::TypeCode::Case<CORBA::String_var,
+ CORBA::TypeCode_var> > const & /* cases */,
+ CORBA::ULong /* ncases */,
+ CORBA::Long /* default_index */,
+ char const * /* default_case_name */,
+ CORBA::TypeCode_ptr /* default_case_type */
+ ACE_ENV_ARG_DECL)
+{
+ ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), CORBA::TypeCode::_nil ());
+}
+
+CORBA::TypeCode_ptr
+TAO_TypeCodeFactory_Adapter_Impl::create_value_event_tc (
+ CORBA::TCKind /* kind */,
+ char const * /* id */,
+ char const * /* name */,
+ CORBA::ValueModifier /* modifier */,
+ CORBA::TypeCode_ptr /* concrete_base */,
+ ACE_Array_Base<
+ TAO::TypeCode::Value_Field<CORBA::String_var,
+ CORBA::TypeCode_var> > const & /* fields */,
+ CORBA::ULong /* nfields */
+ ACE_ENV_ARG_DECL)
+{
+ ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), CORBA::TypeCode::_nil ());
+}
+
+// *********************************************************************
+
+// Initialization and registration of dynamic service object.
+
+int
+TAO_TypeCodeFactory_Adapter_Impl::Initializer (void)
+{
+ TAO_ORB_Core::typecodefactory_adapter_name ("Concrete_TypeCodeFactory_Adapter");
+
+ return ACE_Service_Config::process_directive (ace_svc_desc_TAO_TypeCodeFactory_Adapter_Impl);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DEFINE (
+ TAO_TypeCodeFactory_Adapter_Impl,
+ ACE_TEXT ("Concrete_TypeCodeFactory_Adapter"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (TAO_TypeCodeFactory_Adapter_Impl),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0
+ )
+
+ACE_FACTORY_DEFINE (TAO_TypeCodeFactory, TAO_TypeCodeFactory_Adapter_Impl)
diff --git a/TAO/tao/TypeCodeFactory/TypeCodeFactory_Adapter_Impl.h b/TAO/tao/TypeCodeFactory/TypeCodeFactory_Adapter_Impl.h
new file mode 100644
index 00000000000..5f20f2af5b8
--- /dev/null
+++ b/TAO/tao/TypeCodeFactory/TypeCodeFactory_Adapter_Impl.h
@@ -0,0 +1,264 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file TypeCodeFactory_Adapter_Impl.h
+ *
+ * $Id$
+ *
+ * @author Jeff Parsons <parsons@cs.wustl.edu>
+ */
+//=============================================================================
+
+
+#ifndef TAO_TYPECODEFACTORY_ADAPTER_IMPL_H
+#define TAO_TYPECODEFACTORY_ADAPTER_IMPL_H
+#include /**/ "ace/pre.h"
+
+#include "tao/TypeCodeFactory/typecodefactory_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/TypeCodeFactory_Adapter.h"
+#include "ace/Service_Config.h"
+#include "tao/default_environment.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_TypeCodeFactory_Adapter_Impl
+ *
+ * @brief TAO_TypeCodeFactory_Adapter_Impl.
+ *
+ * Class that adapts the CORBA::ORB create_*_tc functions
+ * to use the TypeCodeFactory. This is the derived class
+ * that contains the actual implementations.
+ */
+class TAO_TypeCodeFactory_Export TAO_TypeCodeFactory_Adapter_Impl
+ : public TAO_TypeCodeFactory_Adapter
+{
+public:
+ virtual ~TAO_TypeCodeFactory_Adapter_Impl (void);
+
+ virtual CORBA::TypeCode_ptr create_struct_tc (
+ const char *id,
+ const char *name,
+ const CORBA::StructMemberSeq &members
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual CORBA::TypeCode_ptr create_union_tc (
+ const char *id,
+ const char *name,
+ CORBA::TypeCode_ptr discriminator_type,
+ const CORBA::UnionMemberSeq &members
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual CORBA::TypeCode_ptr create_enum_tc (
+ const char *id,
+ const char *name,
+ const CORBA::EnumMemberSeq &members
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual CORBA::TypeCode_ptr create_alias_tc (
+ const char *id,
+ const char *name,
+ CORBA::TypeCode_ptr original_type
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual CORBA::TypeCode_ptr create_exception_tc (
+ const char *id,
+ const char *name,
+ const CORBA::StructMemberSeq &members
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual CORBA::TypeCode_ptr create_interface_tc (
+ const char *id,
+ const char *name
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual CORBA::TypeCode_ptr create_string_tc (
+ CORBA::ULong bound
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual CORBA::TypeCode_ptr create_wstring_tc (
+ CORBA::ULong bound
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual CORBA::TypeCode_ptr create_fixed_tc (
+ CORBA::UShort digits,
+ CORBA::UShort scale
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual CORBA::TypeCode_ptr create_sequence_tc (
+ CORBA::ULong bound,
+ CORBA::TypeCode_ptr element_type
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual CORBA::TypeCode_ptr create_array_tc (
+ CORBA::ULong length,
+ CORBA::TypeCode_ptr element_type
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual CORBA::TypeCode_ptr create_value_tc (
+ const char *id,
+ const char *name,
+ CORBA::ValueModifier type_modifier,
+ CORBA::TypeCode_ptr concrete_base,
+ const CORBA::ValueMemberSeq &members
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual CORBA::TypeCode_ptr create_value_box_tc (
+ const char *id,
+ const char *name,
+ CORBA::TypeCode_ptr boxed_type
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual CORBA::TypeCode_ptr create_native_tc (
+ const char *id,
+ const char *name
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual CORBA::TypeCode_ptr create_recursive_tc (
+ const char *id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual CORBA::TypeCode_ptr create_abstract_interface_tc (
+ const char *id,
+ const char *name
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual CORBA::TypeCode_ptr create_local_interface_tc (
+ const char *id,
+ const char *name
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual CORBA::TypeCode_ptr create_component_tc (
+ const char *id,
+ const char *name
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual CORBA::TypeCode_ptr create_home_tc (
+ const char *id,
+ const char *name
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual CORBA::TypeCode_ptr create_event_tc (
+ const char *id,
+ const char *name,
+ CORBA::ValueModifier type_modifier,
+ CORBA::TypeCode_ptr concrete_base,
+ const CORBA::ValueMemberSeq &members
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /**
+ * @name TAO-specific TypeCode factory methods.
+ *
+ * Factory methods that has no corresponding TypeCodeFactory IDL,
+ * i.e. they are specific to TAO.
+ */
+ //@{
+ /// Create an enumeration TypeCode.
+ virtual CORBA::TypeCode_ptr create_enum_tc (
+ char const * id,
+ char const * name,
+ ACE_Array_Base<CORBA::String_var> const & enumerators,
+ CORBA::ULong ncases
+ ACE_ENV_ARG_DECL);
+
+ /// Create a structure or exception TypeCode.
+ virtual CORBA::TypeCode_ptr create_struct_except_tc (
+ CORBA::TCKind,
+ char const * id,
+ char const * name,
+ ACE_Array_Base<
+ TAO::TypeCode::Struct_Field<CORBA::String_var,
+ CORBA::TypeCode_var> > const & fields,
+ CORBA::ULong nfields
+ ACE_ENV_ARG_DECL);
+
+ /// Create a union TypeCode.
+ virtual CORBA::TypeCode_ptr create_union_tc (
+ char const * id,
+ char const * name,
+ CORBA::TypeCode_ptr discriminant_type,
+ ACE_Array_Base<TAO::TypeCode::Case<CORBA::String_var,
+ CORBA::TypeCode_var> > const & cases,
+ CORBA::ULong ncases,
+ CORBA::Long default_index,
+ char const * default_case_name,
+ CORBA::TypeCode_ptr default_case_type
+ ACE_ENV_ARG_DECL);
+
+ /// Create a valuetype or eventtype TypeCode.
+ virtual CORBA::TypeCode_ptr create_value_event_tc (
+ CORBA::TCKind,
+ char const * id,
+ char const * name,
+ CORBA::ValueModifier modifier,
+ CORBA::TypeCode_ptr concrete_base,
+ ACE_Array_Base<
+ TAO::TypeCode::Value_Field<CORBA::String_var,
+ CORBA::TypeCode_var> > const & fields,
+ CORBA::ULong nfields
+ ACE_ENV_ARG_DECL);
+ //@}
+
+
+ /// Used to force the initialization of the ORB code.
+ static int Initializer (void);
+};
+
+static int
+TAO_Requires_TypeCodeFactory_Initializer =
+ TAO_TypeCodeFactory_Adapter_Impl::Initializer ();
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE (TAO_TypeCodeFactory_Adapter_Impl)
+ACE_FACTORY_DECLARE (TAO_TypeCodeFactory, TAO_TypeCodeFactory_Adapter_Impl)
+
+
+#include /**/ "ace/post.h"
+#endif /* TAO_TYPECODEFACTORY_ADAPTER_IMPL_H */
diff --git a/TAO/tao/TypeCodeFactory/TypeCodeFactory_Loader.cpp b/TAO/tao/TypeCodeFactory/TypeCodeFactory_Loader.cpp
new file mode 100644
index 00000000000..36d20aeda87
--- /dev/null
+++ b/TAO/tao/TypeCodeFactory/TypeCodeFactory_Loader.cpp
@@ -0,0 +1,64 @@
+// -*- C++ -*-
+
+// $Id$
+
+// =================================================================
+//
+// = LIBRARY
+// TAO/tao/TypeCodeFactory
+//
+// = FILENAME
+// TypeCodeFactory_Loader.cpp
+//
+// = AUTHOR
+// Jeff Parsons <parsons@cs.wustl.edu>
+//
+// =================================================================
+
+#include "tao/TypeCodeFactory/TypeCodeFactory_Loader.h"
+#include "tao/TypeCodeFactory/TypeCodeFactory_i.h"
+#include "ace/Log_Msg.h"
+
+ACE_RCSID(TypeCodeFactory,
+ TypeCodeFactory_Loader,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_TypeCodeFactory_Loader::TAO_TypeCodeFactory_Loader (void)
+{
+}
+
+CORBA::Object_ptr
+TAO_TypeCodeFactory_Loader::create_object (CORBA::ORB_ptr,
+ int,
+ ACE_TCHAR * []
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ CORBA::Object_ptr obj;
+ ACE_NEW_RETURN (obj,
+ TAO_TypeCodeFactory_i,
+ CORBA::Object::_nil ());
+ return obj;
+}
+
+int
+TAO_TypeCodeFactory_Loader::Initializer (void)
+{
+ return ACE_Service_Config::process_directive (ace_svc_desc_TAO_TypeCodeFactory_Loader);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+
+ACE_STATIC_SVC_DEFINE (
+ TAO_TypeCodeFactory_Loader,
+ ACE_TEXT ("TypeCodeFactory_Loader"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (TAO_TypeCodeFactory_Loader),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0
+ )
+
+ACE_FACTORY_DEFINE (TAO_TypeCodeFactory, TAO_TypeCodeFactory_Loader)
diff --git a/TAO/tao/TypeCodeFactory/TypeCodeFactory_Loader.h b/TAO/tao/TypeCodeFactory/TypeCodeFactory_Loader.h
new file mode 100644
index 00000000000..55a524c32b8
--- /dev/null
+++ b/TAO/tao/TypeCodeFactory/TypeCodeFactory_Loader.h
@@ -0,0 +1,65 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file TypeCodeFactory_Loader.h
+ *
+ * $Id$
+ *
+ * @author Jeff Parsons <parsons@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_TYPECODEFACTORY_LOADER_H
+#define TAO_TYPECODEFACTORY_LOADER_H
+#include /**/ "ace/pre.h"
+
+#include "tao/TypeCodeFactory/typecodefactory_export.h"
+#include "tao/Object_Loader.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/Service_Config.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_TypeCodeFactory_Loader
+ *
+ * @brief Create an instance of TypeCodeFactory and return it to the caller.
+ */
+class TAO_TypeCodeFactory_Export TAO_TypeCodeFactory_Loader
+ : public TAO_Object_Loader
+{
+public:
+ /// Constructor.
+ TAO_TypeCodeFactory_Loader (void);
+
+ /// Overload the base class method to create a new instance
+ /// of a TypeCodeFactory object.
+ virtual CORBA::Object_ptr create_object (CORBA::ORB_ptr orb,
+ int argc,
+ ACE_TCHAR *argv []
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Used to force the initialization of the ORB code.
+ static int Initializer (void);
+};
+
+static int
+TAO_Requires_TCF_Initializer = TAO_TypeCodeFactory_Loader::Initializer ();
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE (TAO_TypeCodeFactory_Loader)
+ACE_FACTORY_DECLARE (TAO_TypeCodeFactory, TAO_TypeCodeFactory_Loader)
+
+#define TAO_TYPECODEFACTORY_SAFE_INCLUDE
+#include "tao/TypeCodeFactory/TypeCodeFactoryC.h"
+#undef TAO_TYPECODEFACTORY_SAFE_INCLUDE
+
+#include /**/ "ace/post.h"
+#endif /* TAO_TYPECODEFACTORY_LOADER_H */
diff --git a/TAO/tao/TypeCodeFactory/TypeCodeFactory_i.cpp b/TAO/tao/TypeCodeFactory/TypeCodeFactory_i.cpp
new file mode 100644
index 00000000000..6183754d39b
--- /dev/null
+++ b/TAO/tao/TypeCodeFactory/TypeCodeFactory_i.cpp
@@ -0,0 +1,2095 @@
+// $Id$
+
+#include "tao/TypeCodeFactory/Recursive_TypeCode.h"
+#include "tao/TypeCodeFactory/TypeCodeFactory_i.h"
+
+#include "tao/AnyTypeCode/Marshal.h"
+#include "tao/AnyTypeCode/Any_Unknown_IDL_Type.h"
+
+#include "tao/AnyTypeCode/Alias_TypeCode.h"
+#include "tao/AnyTypeCode/Enum_TypeCode.h"
+#include "tao/AnyTypeCode/Fixed_TypeCode.h"
+#include "tao/AnyTypeCode/Objref_TypeCode.h"
+#include "tao/AnyTypeCode/Sequence_TypeCode.h"
+#include "tao/AnyTypeCode/String_TypeCode.h"
+#include "tao/AnyTypeCode/Struct_TypeCode.h"
+#include "tao/AnyTypeCode/Union_TypeCode.h"
+#include "tao/AnyTypeCode/Value_TypeCode.h"
+
+#include "tao/AnyTypeCode/Recursive_Type_TypeCode.h"
+
+#include "tao/AnyTypeCode/TypeCode_Case_T.h"
+#include "tao/AnyTypeCode/TypeCode_Struct_Field.h"
+#include "tao/AnyTypeCode/TypeCode_Value_Field.h"
+
+#include "tao/AnyTypeCode/True_RefCount_Policy.h"
+
+#include "tao/IFR_Client/IFR_BasicC.h"
+
+#include "tao/ORB_Constants.h"
+#include "tao/CDR.h"
+#include "tao/SystemException.h"
+
+#include "ace/SString.h"
+#include "ace/Containers_T.h"
+#include "ace/Hash_Map_Manager_T.h"
+#include "ace/Null_Mutex.h"
+#include "ace/OS_NS_string.h"
+#include "ace/Value_Ptr.h"
+
+#include "ace/os_include/os_ctype.h"
+
+
+ACE_RCSID (TypeCodeFactory,
+ TypeCodeFactory_i,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TCF
+{
+ namespace Struct
+ {
+ typedef
+ ACE_Array_Base<TAO::TypeCode::Struct_Field<CORBA::String_var,
+ CORBA::TypeCode_var> >
+ field_array_type;
+
+ typedef TAO::TypeCode::Struct<CORBA::String_var,
+ CORBA::TypeCode_var,
+ field_array_type,
+ TAO::True_RefCount_Policy> typecode_type;
+
+ typedef TAO::TypeCode::Recursive_Type<typecode_type,
+ CORBA::TypeCode_var,
+ field_array_type>
+ recursive_typecode_type;
+
+ } // End namespace Struct
+
+ namespace Union
+ {
+ // Use an ACE::Value_Ptr to provide exception safety and proper
+ // copying semantics.
+ typedef ACE::Value_Ptr<TAO::TypeCode::Case_Dynamic> elem_type;
+ typedef ACE_Array_Base<elem_type> case_array_type;
+
+ typedef TAO::TypeCode::Union<CORBA::String_var,
+ CORBA::TypeCode_var,
+ case_array_type,
+ TAO::True_RefCount_Policy> typecode_type;
+
+ typedef TAO::TypeCode::Recursive_Type<
+ typecode_type,
+ CORBA::TypeCode_var,
+ case_array_type> recursive_typecode_type;
+ } // End namespace Union
+
+ namespace Value
+ {
+ typedef
+ ACE_Array_Base<TAO::TypeCode::Value_Field<CORBA::String_var,
+ CORBA::TypeCode_var> >
+ field_array_type;
+
+ typedef TAO::TypeCode::Value<CORBA::String_var,
+ CORBA::TypeCode_var,
+ field_array_type,
+ TAO::True_RefCount_Policy> typecode_type;
+
+ typedef TAO::TypeCode::Recursive_Type<typecode_type,
+ CORBA::TypeCode_var,
+ field_array_type>
+ recursive_typecode_type;
+ } // End namespace Value
+}
+
+
+TAO_TypeCodeFactory_i::TAO_TypeCodeFactory_i (void)
+{
+}
+
+TAO_TypeCodeFactory_i::~TAO_TypeCodeFactory_i (void)
+{
+}
+
+TAO_TypeCodeFactory_i *
+TAO_TypeCodeFactory_i::_narrow (CORBA::Object_ptr _tao_objref
+ ACE_ENV_ARG_DECL_NOT_USED)
+{
+ if (CORBA::is_nil (_tao_objref))
+ {
+ return 0;
+ }
+
+ return dynamic_cast<TAO_TypeCodeFactory_i *> (_tao_objref);
+}
+
+CORBA::TypeCode_ptr
+TAO_TypeCodeFactory_i::create_struct_tc (
+ const char *id,
+ const char *name,
+ const CORBA::StructMemberSeq &members
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return this->struct_except_tc_common (id,
+ name,
+ members,
+ CORBA::tk_struct
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::TypeCode_ptr
+TAO_TypeCodeFactory_i::create_union_tc (
+ const char *id,
+ const char *name,
+ CORBA::TypeCode_ptr discriminator_type,
+ const CORBA::UnionMemberSeq &members
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ CORBA::TypeCode_ptr tc = CORBA::TypeCode::_nil ();
+
+ if (name == 0 || !this->valid_name (name))
+ {
+ ACE_THROW_RETURN (CORBA::BAD_PARAM (CORBA::OMGVMCID | 15,
+ CORBA::COMPLETED_NO),
+ tc);
+ }
+
+ if (id == 0 || !this->valid_id (id))
+ {
+ ACE_THROW_RETURN (CORBA::BAD_PARAM (CORBA::OMGVMCID | 16,
+ CORBA::COMPLETED_NO),
+ tc);
+ }
+
+ CORBA::Boolean const good_disc_type =
+ this->valid_disc_type (discriminator_type
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (tc);
+
+ if (!good_disc_type)
+ {
+ ACE_THROW_RETURN (CORBA::BAD_PARAM (CORBA::OMGVMCID | 20,
+ CORBA::COMPLETED_NO),
+ tc);
+ }
+
+ CORBA::ULong const len = members.length ();
+ CORBA::ULong dups = 0;
+ CORBA::ULong raw_default_index = ACE_UINT32_MAX;
+ CORBA::Long default_index = -1;
+ CORBA::Octet value = ACE_OCTET_MAX;
+ ACE_Hash_Map_Manager<ACE_CString, int, ACE_Null_Mutex> map;
+
+ // No getting around iterating over the members twice. We have
+ // to do it once *before* the overall length is written to the
+ // CDR stream, to know by how much, if any, the number of members
+ // differs from the number of labels.
+ //
+ // @@ Now that the TypeCode implementation has been rewritten, do we
+ // still need to iterate over the members twice?
+ for (CORBA::ULong i = 0; i < len; ++i)
+ {
+ CORBA::UnionMember const & member = members[i];
+ char const * const member_name = member.name;
+
+ int trybind_status = 0;
+
+ if (i > 0)
+ {
+ // Is this a duplicate case label? If so, we have to adjust
+ // the 'length' we encode - a member gets encoded only once.
+ if (ACE_OS::strcmp (member_name, members[i - 1].name) == 0)
+ {
+ CORBA::Boolean const equiv =
+ member.type.in ()->equivalent (members[i - 1].type.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (tc);
+
+ // If adjacent names are the same and their types are
+ // equivalent, then they are duplicate case labels. If
+ // the types are not equivalent, then they are separate
+ // members with the same name, which is not allowed.
+ if (equiv)
+ {
+ ++dups;
+ }
+ else
+ {
+ ACE_THROW_RETURN (CORBA::BAD_PARAM (CORBA::OMGVMCID | 17,
+ CORBA::COMPLETED_NO),
+ tc);
+ }
+ }
+ else
+ {
+ // Only if we do not have a duplicate case label do we
+ // check for a duplicate member name.
+ ACE_CString ext_id (member_name);
+ int int_id = 0;
+
+ trybind_status = map.trybind (ext_id, int_id);
+ }
+ }
+ else
+ {
+ ACE_CString ext_id (member_name);
+ int int_id = 0;
+
+ trybind_status = map.trybind (ext_id, int_id);
+ }
+
+ // Duplicate member name?
+ if (trybind_status != 0)
+ {
+ ACE_THROW_RETURN (CORBA::BAD_PARAM (CORBA::OMGVMCID | 17,
+ CORBA::COMPLETED_NO),
+ tc);
+ }
+
+ CORBA::TypeCode_ptr const tc_holder = member.type.in ();
+
+ // Valid member type?
+ CORBA::Boolean const valid_member =
+ this->valid_content_type (tc_holder
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (tc);
+
+ if (!valid_member)
+ {
+ ACE_THROW_RETURN (CORBA::BAD_TYPECODE (CORBA::OMGVMCID | 2,
+ CORBA::COMPLETED_NO),
+ tc);
+ }
+
+ // Reset the default index, if we have a default case label.
+ if ((member.label >>= CORBA::Any::to_octet (value)) == 1)
+ {
+ if (value == 0)
+ {
+ raw_default_index = i;
+ // Only the multiple labels that come before the
+ // default label affect its adjusted value.
+ default_index = static_cast<CORBA::Long> (i - dups);
+ }
+ }
+ else
+ {
+ // Else check that the label type is equivalent to the
+ // given discriminator type.
+ CORBA::TypeCode_var const tmp = member.label.type ();
+
+ CORBA::Boolean const equiv =
+ discriminator_type->equivalent (tmp.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (tc);
+
+ if (!equiv)
+ {
+ ACE_THROW_RETURN (CORBA::BAD_PARAM (CORBA::OMGVMCID | 19,
+ CORBA::COMPLETED_NO),
+ tc);
+ }
+ }
+ }
+
+ CORBA::Boolean const unique_labels =
+ this->unique_label_values (members,
+ discriminator_type,
+ raw_default_index
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (tc);
+
+ if (!unique_labels)
+ {
+ ACE_THROW_RETURN (CORBA::BAD_PARAM (CORBA::OMGVMCID | 18,
+ CORBA::COMPLETED_NO),
+ CORBA::TypeCode::_nil ());
+ }
+
+ using namespace TCF::Union;
+
+ case_array_type cases (len - dups);
+
+ CORBA::TCKind const kind =
+ discriminator_type->kind (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (tc);
+
+ CORBA::ULong ci = 0; // Case array index.
+
+ bool is_recursive = false;
+ CORBA::TypeCode_var recursive_tc;
+
+ for (CORBA::ULong index = 0; index < len; ++index)
+ {
+ CORBA::UnionMember const & member = members[index];
+
+ if (index > 0)
+ {
+ // Is this a duplicate case label? If so, skip it - a member
+ // goes into the TypeCode only once.
+ if (ACE_OS::strcmp (member.name,
+ members[index - 1].name) == 0)
+ {
+ continue;
+ }
+ }
+
+ // Check if recursive.
+ bool const recursion_detected =
+ this->check_recursion (CORBA::tk_union,
+ id,
+ member.type.in (),
+ recursive_tc.inout ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (tc);
+
+ // Do not clobber previous positive detection.
+ if (recursion_detected)
+ is_recursive = true;
+
+ elem_type & element = cases[ci];
+
+ TAO::TypeCode::Case_Dynamic * the_case = 0;
+
+ if (index == raw_default_index)
+ {
+ // This is the default label - we have to find a legal value.
+ this->compute_default_label (kind,
+ index,
+ members,
+ the_case);
+
+ if (the_case == 0)
+ {
+ // Should never throw since label kind was
+ // verified earlier.
+ ACE_THROW_RETURN (CORBA::BAD_PARAM (CORBA::OMGVMCID | 19,
+ CORBA::COMPLETED_NO),
+ CORBA::TypeCode::_nil ());
+ }
+ }
+ else
+ {
+ // Ugly. *sigh*
+ switch (kind)
+ {
+ case CORBA::tk_enum:
+ {
+ TAO::Any_Impl * const impl = member.label.impl ();
+ TAO_InputCDR for_reading (
+ static_cast<ACE_Message_Block *> (0));
+
+ if (impl->encoded ())
+ {
+ TAO::Unknown_IDL_Type * const unk =
+ dynamic_cast<TAO::Unknown_IDL_Type *> (impl);
+
+ // We don't want unk's rd_ptr to move, in case we
+ // are shared by another Any, so we use this to
+ // copy the state, not the buffer.
+ for_reading = unk->_tao_get_cdr ();
+ }
+ else
+ {
+ TAO_OutputCDR out;
+ impl->marshal_value (out);
+ TAO_InputCDR tmp (out);
+ for_reading = tmp;
+ }
+
+ CORBA::ULong label;
+ for_reading.read_ulong (label);
+
+ typedef TAO::TypeCode::Case_T<CORBA::ULong,
+ CORBA::String_var,
+ CORBA::TypeCode_var> case_type;
+
+ ACE_NEW_THROW_EX (the_case,
+ case_type (label),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (CORBA::TypeCode::_nil ());
+ }
+ break;
+ case CORBA::tk_ulong:
+ {
+ CORBA::ULong label;
+ if (!(member.label >>= label))
+ {
+ // Should never throw since label kind was
+ // verified earlier.
+ ACE_THROW_RETURN (CORBA::BAD_PARAM (CORBA::OMGVMCID | 19,
+ CORBA::COMPLETED_NO),
+ CORBA::TypeCode::_nil ());
+ }
+
+ typedef TAO::TypeCode::Case_T<CORBA::ULong,
+ CORBA::String_var,
+ CORBA::TypeCode_var> case_type;
+
+ ACE_NEW_THROW_EX (the_case,
+ case_type (label),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (CORBA::TypeCode::_nil ());
+ }
+ break;
+ case CORBA::tk_long:
+ {
+ CORBA::Long label;
+ if (!(member.label >>= label))
+ {
+ // Should never throw since label kind was
+ // verified earlier.
+ ACE_THROW_RETURN (CORBA::BAD_PARAM (CORBA::OMGVMCID | 19,
+ CORBA::COMPLETED_NO),
+ CORBA::TypeCode::_nil ());
+ }
+
+ typedef TAO::TypeCode::Case_T<CORBA::Long,
+ CORBA::String_var,
+ CORBA::TypeCode_var> case_type;
+
+ ACE_NEW_THROW_EX (the_case,
+ case_type (label),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (CORBA::TypeCode::_nil ());
+ }
+ break;
+ case CORBA::tk_ushort:
+ {
+ CORBA::UShort label;
+ if (!(member.label >>= label))
+ {
+ // Should never throw since label kind was
+ // verified earlier.
+ ACE_THROW_RETURN (CORBA::BAD_PARAM (CORBA::OMGVMCID | 19,
+ CORBA::COMPLETED_NO),
+ CORBA::TypeCode::_nil ());
+ }
+
+ typedef TAO::TypeCode::Case_T<CORBA::UShort,
+ CORBA::String_var,
+ CORBA::TypeCode_var> case_type;
+
+ ACE_NEW_THROW_EX (the_case,
+ case_type (label),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (CORBA::TypeCode::_nil ());
+ }
+ break;
+ case CORBA::tk_short:
+ {
+ CORBA::Short label;
+ if (!(member.label >>= label))
+ {
+ // Should never throw since label kind was
+ // verified earlier.
+ ACE_THROW_RETURN (CORBA::BAD_PARAM (CORBA::OMGVMCID | 19,
+ CORBA::COMPLETED_NO),
+ CORBA::TypeCode::_nil ());
+ }
+
+ typedef TAO::TypeCode::Case_T<CORBA::Short,
+ CORBA::String_var,
+ CORBA::TypeCode_var> case_type;
+
+ ACE_NEW_THROW_EX (the_case,
+ case_type (label),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (CORBA::TypeCode::_nil ());
+ }
+ break;
+ case CORBA::tk_char:
+ {
+ CORBA::Char label;
+ if (!(member.label >>= CORBA::Any::to_char (label)))
+ {
+ // Should never throw since label kind was
+ // verified earlier.
+ ACE_THROW_RETURN (CORBA::BAD_PARAM (CORBA::OMGVMCID | 19,
+ CORBA::COMPLETED_NO),
+ CORBA::TypeCode::_nil ());
+ }
+
+ typedef TAO::TypeCode::Case_T<CORBA::Char,
+ CORBA::String_var,
+ CORBA::TypeCode_var> case_type;
+
+ ACE_NEW_THROW_EX (the_case,
+ case_type (label),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (CORBA::TypeCode::_nil ());
+ }
+ break;
+ case CORBA::tk_boolean:
+ {
+ CORBA::Boolean label;
+ if (!(member.label >>= CORBA::Any::to_boolean (label)))
+ {
+ // Should never throw since label kind was
+ // verified earlier.
+ ACE_THROW_RETURN (CORBA::BAD_PARAM (CORBA::OMGVMCID | 19,
+ CORBA::COMPLETED_NO),
+ CORBA::TypeCode::_nil ());
+ }
+
+ typedef TAO::TypeCode::Case_T<CORBA::Boolean,
+ CORBA::String_var,
+ CORBA::TypeCode_var> case_type;
+
+ ACE_NEW_THROW_EX (the_case,
+ case_type (label),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (CORBA::TypeCode::_nil ());
+ }
+ break;
+ case CORBA::tk_longlong:
+ {
+ CORBA::LongLong label;
+ if (!(member.label >>= label))
+ {
+ // Should never throw since label kind was
+ // verified earlier.
+ ACE_THROW_RETURN (CORBA::BAD_PARAM (CORBA::OMGVMCID | 19,
+ CORBA::COMPLETED_NO),
+ CORBA::TypeCode::_nil ());
+ }
+
+ typedef TAO::TypeCode::Case_T<CORBA::LongLong,
+ CORBA::String_var,
+ CORBA::TypeCode_var> case_type;
+
+ ACE_NEW_THROW_EX (the_case,
+ case_type (label),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (CORBA::TypeCode::_nil ());
+ }
+ break;
+#if !defined (ACE_LACKS_LONGLONG_T)
+ case CORBA::tk_ulonglong:
+ {
+ CORBA::ULongLong label;
+ if (!(member.label >>= label))
+ {
+ // Should never throw since label kind was
+ // verified earlier.
+ ACE_THROW_RETURN (CORBA::BAD_PARAM (CORBA::OMGVMCID | 19,
+ CORBA::COMPLETED_NO),
+ CORBA::TypeCode::_nil ());
+ }
+
+ typedef TAO::TypeCode::Case_T<CORBA::ULongLong,
+ CORBA::String_var,
+ CORBA::TypeCode_var> case_type;
+
+ ACE_NEW_THROW_EX (the_case,
+ case_type (label),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (CORBA::TypeCode::_nil ());
+ }
+ break;
+#endif /* !ACE_LACKS_LONGLONG_T */
+ default:
+ ACE_THROW_RETURN (CORBA::BAD_PARAM (CORBA::OMGVMCID | 20,
+ CORBA::COMPLETED_NO),
+ CORBA::TypeCode::_nil ());
+ }
+ }
+
+ ++ci;
+
+ elem_type case_value (the_case);
+ element.swap (case_value); // Exception-safe
+
+ element->name (member.name.in ());
+ element->type (member.type.in ());
+ }
+
+ // @@ Blame this on MSVC++ 6 workarounds. *sigh*
+ CORBA::TypeCode_var duped_disc_type (
+ CORBA::TypeCode::_duplicate (discriminator_type));
+
+ if (is_recursive)
+ {
+
+ recursive_typecode_type * const rtc =
+ dynamic_cast<recursive_typecode_type *> (recursive_tc.in ());
+
+ ACE_ASSERT (rtc);
+
+ rtc->union_parameters (name,
+ duped_disc_type,
+ cases, // Will be copied.
+ cases.size (),
+ default_index);
+
+ return recursive_tc._retn ();
+ }
+
+ ACE_NEW_THROW_EX (tc,
+ typecode_type (id,
+ name,
+ duped_disc_type,
+ cases, // Will be copied.
+ cases.size (),
+ default_index),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (CORBA::TypeCode::_nil ());
+
+ return tc;
+}
+
+CORBA::TypeCode_ptr
+TAO_TypeCodeFactory_i::create_enum_tc (
+ const char *id,
+ const char *name,
+ const CORBA::EnumMemberSeq &members
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ CORBA::TypeCode_ptr tc = CORBA::TypeCode::_nil ();
+
+ if (name == 0 || !this->valid_name (name))
+ {
+ ACE_THROW_RETURN (CORBA::BAD_PARAM (CORBA::OMGVMCID | 15,
+ CORBA::COMPLETED_NO),
+ tc);
+ }
+
+ if (id == 0 || !this->valid_id (id))
+ {
+ ACE_THROW_RETURN (CORBA::BAD_PARAM (CORBA::OMGVMCID | 16,
+ CORBA::COMPLETED_NO),
+ tc);
+ }
+
+ CORBA::ULong const len = members.length ();
+
+ ACE_Hash_Map_Manager<ACE_CString, int, ACE_Null_Mutex> map;
+
+ ACE_Array_Base<CORBA::String_var> enumerators (len);
+
+ for (CORBA::ULong index = 0; index < len; ++index)
+ {
+ ACE_CString ext_id (members[index]);
+ int int_id = 0;
+
+ // Is there a duplicate member name?
+ if (map.trybind (ext_id, int_id) != 0)
+ {
+ ACE_THROW_RETURN (CORBA::BAD_PARAM (CORBA::OMGVMCID | 17,
+ CORBA::COMPLETED_NO),
+ tc);
+ }
+
+ enumerators[index] = members[index];
+ }
+
+ typedef TAO::TypeCode::Enum<
+ CORBA::String_var,
+ ACE_Array_Base<CORBA::String_var>,
+ TAO::True_RefCount_Policy> typecode_type;
+
+ ACE_NEW_THROW_EX (tc,
+ typecode_type (id,
+ name,
+ enumerators,
+ len),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (tc);
+
+ return tc;
+}
+
+CORBA::TypeCode_ptr
+TAO_TypeCodeFactory_i::create_alias_tc (
+ const char *id,
+ const char *name,
+ CORBA::TypeCode_ptr original_type
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return this->alias_value_box_tc_common (id,
+ name,
+ original_type,
+ CORBA::tk_alias
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::TypeCode_ptr
+TAO_TypeCodeFactory_i::create_exception_tc (
+ const char *id,
+ const char *name,
+ const CORBA::StructMemberSeq &members
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return this->struct_except_tc_common (id,
+ name,
+ members,
+ CORBA::tk_except
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::TypeCode_ptr
+TAO_TypeCodeFactory_i::create_interface_tc (
+ const char *id,
+ const char *name
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return this->create_tc_common (id,
+ name,
+ CORBA::tk_objref
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::TypeCode_ptr
+TAO_TypeCodeFactory_i::create_string_tc (
+ CORBA::ULong bound
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return this->string_wstring_tc_common (bound,
+ CORBA::tk_string
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::TypeCode_ptr
+TAO_TypeCodeFactory_i::create_wstring_tc (
+ CORBA::ULong bound
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return this->string_wstring_tc_common (bound,
+ CORBA::tk_wstring
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::TypeCode_ptr
+TAO_TypeCodeFactory_i::create_fixed_tc (
+ CORBA::UShort digits,
+ CORBA::UShort scale
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ CORBA::TypeCode_ptr tc;
+ ACE_NEW_THROW_EX (tc,
+ TAO::TypeCode::Fixed<TAO::True_RefCount_Policy> (digits,
+ scale),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (tc);
+
+ return tc;
+}
+
+CORBA::TypeCode_ptr
+TAO_TypeCodeFactory_i::create_sequence_tc (
+ CORBA::ULong bound,
+ CORBA::TypeCode_ptr element_type
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return sequence_array_tc_common (bound,
+ element_type,
+ CORBA::tk_sequence
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::TypeCode_ptr
+TAO_TypeCodeFactory_i::create_array_tc (
+ CORBA::ULong length,
+ CORBA::TypeCode_ptr element_type
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return sequence_array_tc_common (length,
+ element_type,
+ CORBA::tk_array
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::TypeCode_ptr
+TAO_TypeCodeFactory_i::create_value_tc (
+ const char *id,
+ const char *name,
+ CORBA::ValueModifier type_modifier,
+ CORBA::TypeCode_ptr concrete_base,
+ const CORBA::ValueMemberSeq &members
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return this->value_event_tc_common (id,
+ name,
+ type_modifier,
+ concrete_base,
+ members,
+ CORBA::tk_value
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::TypeCode_ptr
+TAO_TypeCodeFactory_i::create_value_box_tc (
+ const char *id,
+ const char *name,
+ CORBA::TypeCode_ptr boxed_type
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return this->alias_value_box_tc_common (id,
+ name,
+ boxed_type,
+ CORBA::tk_value_box
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::TypeCode_ptr
+TAO_TypeCodeFactory_i::create_native_tc (
+ const char *id,
+ const char *name
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return this->create_tc_common (id,
+ name,
+ CORBA::tk_native
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::TypeCode_ptr
+TAO_TypeCodeFactory_i::create_recursive_tc (
+ const char *id
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ CORBA::TypeCode_ptr tc = CORBA::TypeCode::_nil ();
+
+ if (id == 0 || !this->valid_id (id))
+ {
+ ACE_THROW_RETURN (CORBA::BAD_PARAM (CORBA::OMGVMCID | 16,
+ CORBA::COMPLETED_NO),
+ tc);
+ }
+
+ ACE_NEW_THROW_EX (tc,
+ TAO::TypeCodeFactory::Recursive_TypeCode (id),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (tc);
+
+ return tc;
+}
+
+CORBA::TypeCode_ptr
+TAO_TypeCodeFactory_i::create_abstract_interface_tc (
+ const char *id,
+ const char *name
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return this->create_tc_common (id,
+ name,
+ CORBA::tk_abstract_interface
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::TypeCode_ptr
+TAO_TypeCodeFactory_i::create_local_interface_tc (
+ const char *id,
+ const char *name
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return this->create_tc_common (id,
+ name,
+ CORBA::tk_local_interface
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::TypeCode_ptr
+TAO_TypeCodeFactory_i::create_component_tc (
+ const char *id,
+ const char *name
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return this->create_tc_common (id,
+ name,
+ CORBA::tk_component
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::TypeCode_ptr
+TAO_TypeCodeFactory_i::create_home_tc (
+ const char *id,
+ const char *name
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return this->create_tc_common (id,
+ name,
+ CORBA::tk_home
+ ACE_ENV_ARG_PARAMETER);
+}
+
+CORBA::TypeCode_ptr
+TAO_TypeCodeFactory_i::create_event_tc (
+ const char *id,
+ const char *name,
+ CORBA::ValueModifier type_modifier,
+ CORBA::TypeCode_ptr concrete_base,
+ const CORBA::ValueMemberSeq &members
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return this->value_event_tc_common (id,
+ name,
+ type_modifier,
+ concrete_base,
+ members,
+ CORBA::tk_event
+ ACE_ENV_ARG_PARAMETER);
+}
+
+// =====================================================================
+
+void
+TAO_TypeCodeFactory_i::compute_default_label (
+ CORBA::TCKind kind,
+ CORBA::ULong skip_slot,
+ const CORBA::UnionMemberSeq &members,
+ TAO::TypeCode::Case_Dynamic *& the_case)
+{
+ // One to hold the current default value, one to
+ // hold the curent label's extracted value.
+ struct disc_types
+ {
+ CORBA::Char char_val;
+ CORBA::Boolean bool_val;
+ CORBA::Short short_val;
+ CORBA::UShort ushort_val;
+ CORBA::Long long_val;
+ CORBA::ULong ulong_val;
+#if !defined (ACE_LACKS_LONGLONG_T)
+ CORBA::ULongLong ulonglong_val;
+#endif /* ACE_LACKS_LONGLONG_T */
+ CORBA::ULong enum_val;
+ // TODO - handle (u)longlong types
+ } dv, u;
+
+ dv.char_val = 0;
+ dv.bool_val = 0;
+ dv.short_val = ACE_INT16_MIN;
+ dv.ushort_val = 0;
+ dv.long_val = ACE_INT32_MIN;
+ dv.ulong_val = 0;
+#if !defined (ACE_LACKS_LONGLONG_T)
+ dv.ulonglong_val = 0;
+#endif /* ACE_LACKS_LONGLONG_T */
+ dv.enum_val = 0;
+
+ CORBA::ULong const len = members.length ();
+ int success = 0;
+
+ // A collision forces us to start over, because the label
+ // values need not be in sorted order.
+ while (success == 0)
+ {
+ success = 1;
+
+ for (CORBA::ULong i = 0; i < len; ++i)
+ {
+ // This is the one we're trying to find a legal value for.
+ if (i == skip_slot)
+ {
+ continue;
+ }
+
+ // If there's a collision, we increment the default value.
+ switch (kind)
+ {
+ case CORBA::tk_char:
+ members[i].label >>= CORBA::Any::to_char (u.char_val);
+
+ if (u.char_val == dv.char_val)
+ {
+ dv.char_val++;
+ success = 0;
+ }
+ break;
+ case CORBA::tk_boolean:
+ members[i].label >>= CORBA::Any::to_boolean (u.bool_val);
+
+ if (u.bool_val == dv.bool_val)
+ {
+ dv.bool_val = !dv.bool_val;
+ success = 0;
+ }
+ break;
+ case CORBA::tk_short:
+ members[i].label >>= u.short_val;
+
+ if (u.short_val == dv.short_val)
+ {
+ dv.short_val++;
+ success = 0;
+ }
+ break;
+ case CORBA::tk_ushort:
+ members[i].label >>= u.ushort_val;
+
+ if (u.ushort_val == dv.ushort_val)
+ {
+ dv.ushort_val++;
+ success = 0;
+ }
+ break;
+ case CORBA::tk_long:
+ members[i].label >>= u.long_val;
+
+ if (u.long_val == dv.long_val)
+ {
+ dv.long_val++;
+ success = 0;
+ }
+ break;
+ case CORBA::tk_ulong:
+ members[i].label >>= u.ulong_val;
+
+ if (u.ulong_val == dv.ulong_val)
+ {
+ dv.ulong_val++;
+ success = 0;
+ }
+ break;
+#if !defined (ACE_LACKS_LONGLONG_T)
+ case CORBA::tk_ulonglong:
+ members[i].label >>= u.ulonglong_val;
+
+ if (u.ulonglong_val == dv.ulonglong_val)
+ {
+ dv.ulonglong_val++;
+ success = 0;
+ }
+ break;
+#endif /* ACE_LACKS_LONGLONG_T */
+ case CORBA::tk_enum:
+ {
+ TAO::Any_Impl *impl = members[i].label.impl ();
+ TAO_InputCDR for_reading (static_cast<ACE_Message_Block *> (0));
+
+ if (impl->encoded ())
+ {
+ TAO::Unknown_IDL_Type *unk =
+ dynamic_cast<TAO::Unknown_IDL_Type *> (impl);
+
+ // We don't want unk's rd_ptr to move, in case
+ // we are shared by another Any, so we use this
+ // to copy the state, not the buffer.
+ for_reading = unk->_tao_get_cdr ();
+ }
+ else
+ {
+ TAO_OutputCDR out;
+ impl->marshal_value (out);
+ TAO_InputCDR tmp (out);
+ for_reading = tmp;
+ }
+
+ for_reading.read_ulong (u.enum_val);
+
+ if (u.enum_val == dv.enum_val)
+ {
+ dv.enum_val++;
+ success = 0;
+ }
+ break;
+ }
+ default:
+ break;
+ }
+
+ // If there's been a collision, we should start over right away.
+ if (success == 0)
+ {
+ break;
+ }
+ }
+ }
+
+ // Add the default value to the encapsulation.
+ switch (kind)
+ {
+ case CORBA::tk_char:
+ {
+ typedef TAO::TypeCode::Case_T<CORBA::Char,
+ CORBA::String_var,
+ CORBA::TypeCode_var> case_type;
+
+ ACE_NEW (the_case,
+ case_type (dv.char_val));
+ }
+ break;
+ case CORBA::tk_boolean:
+ {
+ typedef TAO::TypeCode::Case_T<CORBA::Boolean,
+ CORBA::String_var,
+ CORBA::TypeCode_var> case_type;
+
+ ACE_NEW (the_case,
+ case_type (dv.bool_val));
+ }
+ break;
+ case CORBA::tk_short:
+ {
+ typedef TAO::TypeCode::Case_T<CORBA::Short,
+ CORBA::String_var,
+ CORBA::TypeCode_var> case_type;
+
+ ACE_NEW (the_case,
+ case_type (dv.short_val));
+ }
+ break;
+ case CORBA::tk_ushort:
+ {
+ typedef TAO::TypeCode::Case_T<CORBA::UShort,
+ CORBA::String_var,
+ CORBA::TypeCode_var> case_type;
+
+ ACE_NEW (the_case,
+ case_type (dv.ushort_val));
+ }
+ break;
+ case CORBA::tk_long:
+ {
+ typedef TAO::TypeCode::Case_T<CORBA::Long,
+ CORBA::String_var,
+ CORBA::TypeCode_var> case_type;
+
+ ACE_NEW (the_case,
+ case_type (dv.long_val));
+ }
+ break;
+ case CORBA::tk_ulong:
+ {
+ typedef TAO::TypeCode::Case_T<CORBA::ULong,
+ CORBA::String_var,
+ CORBA::TypeCode_var> case_type;
+
+ ACE_NEW (the_case,
+ case_type (dv.ulong_val));
+ }
+ break;
+#if !defined (ACE_LACKS_LONGLONG_T)
+ case CORBA::tk_ulonglong:
+ {
+ typedef TAO::TypeCode::Case_T<CORBA::ULongLong,
+ CORBA::String_var,
+ CORBA::TypeCode_var> case_type;
+
+ ACE_NEW (the_case,
+ case_type (dv.ulonglong_val));
+ }
+ break;
+#endif /* ACE_LACKS_LONGLONG_T */
+ case CORBA::tk_enum:
+ {
+ // Enumerators are encoded as CORBA::ULong.
+ typedef TAO::TypeCode::Case_T<CORBA::ULong,
+ CORBA::String_var,
+ CORBA::TypeCode_var> case_type;
+
+ ACE_NEW (the_case,
+ case_type (dv.enum_val));
+ }
+ break;
+ default:
+ break;
+ }
+}
+
+CORBA::TypeCode_ptr
+TAO_TypeCodeFactory_i::create_tc_common (
+ const char *id,
+ const char *name,
+ CORBA::TCKind kind
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ if (name == 0 || !this->valid_name (name))
+ {
+ ACE_THROW_RETURN (CORBA::BAD_PARAM (CORBA::OMGVMCID | 15,
+ CORBA::COMPLETED_NO),
+ CORBA::TypeCode::_nil ());
+ }
+
+ // Repo id may not be null for object or native type.
+ if (id == 0 || !this->valid_id (id))
+ {
+ ACE_THROW_RETURN (CORBA::BAD_PARAM (CORBA::OMGVMCID | 16,
+ CORBA::COMPLETED_NO),
+ CORBA::TypeCode::_nil ());
+ }
+
+ CORBA::TypeCode_ptr tc;
+
+ typedef TAO::TypeCode::Objref<CORBA::String_var,
+ TAO::True_RefCount_Policy> typecode_type;
+
+ ACE_NEW_THROW_EX (tc,
+ typecode_type (kind, id, name),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (tc);
+
+ return tc;
+}
+
+CORBA::TypeCode_ptr
+TAO_TypeCodeFactory_i::string_wstring_tc_common (
+ CORBA::ULong bound,
+ CORBA::TCKind kind
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ CORBA::TypeCode_ptr tc;
+ ACE_NEW_THROW_EX (tc,
+ TAO::TypeCode::String<TAO::True_RefCount_Policy> (kind,
+ bound),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (tc);
+
+ return tc;
+}
+
+CORBA::TypeCode_ptr
+TAO_TypeCodeFactory_i::sequence_array_tc_common (
+ CORBA::ULong bound,
+ CORBA::TypeCode_ptr element_type,
+ CORBA::TCKind kind
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ CORBA::TypeCode_ptr tc = CORBA::TypeCode::_nil ();
+
+ CORBA::Boolean const valid_element =
+ this->valid_content_type (element_type
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (tc);
+
+ if (!valid_element)
+ {
+ ACE_THROW_RETURN (CORBA::BAD_TYPECODE (CORBA::OMGVMCID | 2,
+ CORBA::COMPLETED_NO),
+ tc);
+ }
+
+ CORBA::TypeCode_var tmp (CORBA::TypeCode::_duplicate (element_type));
+
+ typedef TAO::TypeCode::Sequence<CORBA::TypeCode_var,
+ TAO::True_RefCount_Policy> typecode_type;
+
+ ACE_NEW_THROW_EX (tc,
+ typecode_type (kind, tmp, bound),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (tc);
+
+ return tc;
+}
+
+CORBA::TypeCode_ptr
+TAO_TypeCodeFactory_i::struct_except_tc_common (
+ const char *id,
+ const char *name,
+ const CORBA::StructMemberSeq & members,
+ CORBA::TCKind kind
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ CORBA::TypeCode_ptr tc = CORBA::TypeCode::_nil ();
+
+ if (name == 0 || !this->valid_name (name))
+ {
+ ACE_THROW_RETURN (CORBA::BAD_PARAM (CORBA::OMGVMCID | 15,
+ CORBA::COMPLETED_NO),
+ tc);
+ }
+
+ if (id == 0 || !this->valid_id (id))
+ {
+ ACE_THROW_RETURN (CORBA::BAD_PARAM (CORBA::OMGVMCID | 16,
+ CORBA::COMPLETED_NO),
+ tc);
+ }
+
+ CORBA::ULong const len = members.length ();
+
+ ACE_Hash_Map_Manager<ACE_CString, int, ACE_Null_Mutex> map;
+
+ using namespace TCF::Struct;
+
+ field_array_type fields (len);
+
+ bool is_recursive = false;
+
+ CORBA::TypeCode_var recursive_tc;
+
+ for (CORBA::ULong index = 0; index < len; ++index)
+ {
+ // Valid member type?
+ CORBA::TypeCode_ptr const member_tc = members[index].type.in ();
+
+ CORBA::Boolean const valid_member =
+ this->valid_content_type (member_tc
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (tc);
+
+ if (!valid_member)
+ {
+ ACE_THROW_RETURN (CORBA::BAD_TYPECODE (CORBA::OMGVMCID | 2,
+ CORBA::COMPLETED_NO),
+ tc);
+ }
+
+ char const * const member_name = members[index].name;
+
+ if (member_name == 0 || !this->valid_name (member_name))
+ {
+ ACE_THROW_RETURN (CORBA::BAD_PARAM (CORBA::OMGVMCID | 15,
+ CORBA::COMPLETED_NO),
+ tc);
+ }
+
+ ACE_CString ext_id (member_name);
+ int int_id = 0;
+
+ // Is there a duplicate member name?
+ if (map.trybind (ext_id, int_id) != 0)
+ {
+ ACE_THROW_RETURN (CORBA::BAD_PARAM (CORBA::OMGVMCID | 17,
+ CORBA::COMPLETED_NO),
+ tc);
+ }
+
+ TAO::TypeCode::Struct_Field<CORBA::String_var,
+ CORBA::TypeCode_var> & field = fields[index];
+
+ // Check if recursive.
+ bool const recursion_detected =
+ this->check_recursion (kind,
+ id,
+ member_tc,
+ recursive_tc.inout ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (tc);
+
+ // Do not clobber previous positive detection.
+ if (recursion_detected)
+ is_recursive = true;
+
+ field.name = member_name;
+ field.type = CORBA::TypeCode::_duplicate (member_tc);
+ }
+
+ if (is_recursive)
+ {
+ recursive_typecode_type * const rtc =
+ dynamic_cast<recursive_typecode_type *> (recursive_tc.in ());
+
+ ACE_ASSERT (rtc);
+
+ rtc->struct_parameters (name, fields, len);
+
+ return recursive_tc._retn ();
+ }
+
+ ACE_NEW_THROW_EX (tc,
+ typecode_type (kind,
+ id,
+ name,
+ fields,
+ len),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (tc);
+
+ return tc;
+}
+
+CORBA::TypeCode_ptr
+TAO_TypeCodeFactory_i::alias_value_box_tc_common (
+ const char *id,
+ const char *name,
+ CORBA::TypeCode_ptr underlying_type,
+ CORBA::TCKind kind
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ CORBA::TypeCode_ptr tc = CORBA::TypeCode::_nil ();
+
+ if (name == 0 || !this->valid_name (name))
+ {
+ ACE_THROW_RETURN (CORBA::BAD_PARAM (CORBA::OMGVMCID | 15,
+ CORBA::COMPLETED_NO),
+ tc);
+ }
+
+ if (id == 0 || !this->valid_id (id))
+ {
+ ACE_THROW_RETURN (CORBA::BAD_PARAM (CORBA::OMGVMCID | 16,
+ CORBA::COMPLETED_NO),
+ tc);
+ }
+
+ CORBA::Boolean const valid_content =
+ this->valid_content_type (underlying_type
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (tc);
+
+ if (!valid_content)
+ {
+ ACE_THROW_RETURN (CORBA::BAD_TYPECODE (CORBA::OMGVMCID | 2,
+ CORBA::COMPLETED_NO),
+ tc);
+ }
+
+ CORBA::TypeCode_var tmp (CORBA::TypeCode::_duplicate (underlying_type));
+
+ typedef TAO::TypeCode::Alias<CORBA::String_var,
+ CORBA::TypeCode_var,
+ TAO::True_RefCount_Policy> typecode_type;
+
+ ACE_NEW_THROW_EX (tc,
+ typecode_type (kind, id, name, tmp),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (tc);
+
+ return tc;
+}
+
+CORBA::TypeCode_ptr
+TAO_TypeCodeFactory_i::value_event_tc_common (
+ const char *id,
+ const char *name,
+ CORBA::ValueModifier type_modifier,
+ CORBA::TypeCode_ptr concrete_base,
+ const CORBA::ValueMemberSeq &members,
+ CORBA::TCKind kind
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ CORBA::TypeCode_ptr tc = CORBA::TypeCode::_nil ();
+
+ if (name == 0 || !this->valid_name (name))
+ {
+ ACE_THROW_RETURN (CORBA::BAD_PARAM (CORBA::OMGVMCID | 15,
+ CORBA::COMPLETED_NO),
+ tc);
+ }
+
+ if (id == 0 || !this->valid_id (id))
+ {
+ ACE_THROW_RETURN (CORBA::BAD_PARAM (CORBA::OMGVMCID | 16,
+ CORBA::COMPLETED_NO),
+ tc);
+ }
+
+ CORBA::ULong const len = members.length ();
+
+ using namespace TCF::Value;
+
+ field_array_type fields (len);
+
+ ACE_Hash_Map_Manager<ACE_CString, int, ACE_Null_Mutex> map;
+
+ bool is_recursive = false;
+ CORBA::TypeCode_var recursive_tc;
+
+ for (CORBA::ULong index = 0; index < len; ++index)
+ {
+ // Valid member type?
+ CORBA::TypeCode_ptr const member_tc = members[index].type.in ();
+
+ CORBA::Boolean const valid_member =
+ this->valid_content_type (member_tc
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (tc);
+
+ if (!valid_member)
+ {
+ ACE_THROW_RETURN (CORBA::BAD_TYPECODE (CORBA::OMGVMCID | 2,
+ CORBA::COMPLETED_NO),
+ tc);
+ }
+
+ const char * const member_name = members[index].name;
+
+ if (member_name == 0 || !this->valid_name (member_name))
+ {
+ ACE_THROW_RETURN (CORBA::BAD_PARAM (CORBA::OMGVMCID | 15,
+ CORBA::COMPLETED_NO),
+ tc);
+ }
+
+ ACE_CString ext_id (member_name);
+ int int_id = 0;
+
+ // Is there a duplicate member name?
+ if (map.trybind (ext_id, int_id) != 0)
+ {
+ ACE_THROW_RETURN (CORBA::BAD_PARAM (CORBA::OMGVMCID | 17,
+ CORBA::COMPLETED_NO),
+ tc);
+ }
+
+ // Check if recursive.
+ bool const recursion_detected =
+ this->check_recursion (kind,
+ id,
+ member_tc,
+ recursive_tc.inout ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (tc);
+
+ // Do not clobber previous positive detection.
+ if (recursion_detected)
+ is_recursive = true;
+
+ TAO::TypeCode::Value_Field<CORBA::String_var,
+ CORBA::TypeCode_var> & field = fields[index];
+
+ field.name = member_name;
+ field.type = CORBA::TypeCode::_duplicate (member_tc);
+ field.visibility = members[index].access;
+ }
+
+ CORBA::TypeCode_var tmp (
+ CORBA::TypeCode::_duplicate (CORBA::is_nil (concrete_base)
+ ? CORBA::_tc_null
+ : concrete_base));
+
+ if (is_recursive)
+ {
+ recursive_typecode_type * const rtc =
+ dynamic_cast<recursive_typecode_type *> (recursive_tc.in ());
+
+ ACE_ASSERT (rtc);
+
+ rtc->valuetype_parameters (name,
+ type_modifier,
+ tmp,
+ fields,
+ len);
+
+ return recursive_tc._retn ();
+ }
+
+ ACE_NEW_THROW_EX (tc,
+ typecode_type (kind,
+ id,
+ name,
+ type_modifier,
+ tmp,
+ fields,
+ len),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (tc);
+
+ return tc;
+}
+
+CORBA::Boolean
+TAO_TypeCodeFactory_i::valid_name (const char *name)
+{
+ // Empty string is valid for name.
+ if (*name == '\0')
+ {
+ return 1;
+ }
+
+ if (!isalpha (*name))
+ {
+ return 0;
+ }
+
+ const char *tmp = name + 1;
+
+ for (; *tmp; ++tmp)
+ {
+ if (isalnum (*tmp) || *tmp == '_')
+ {
+ continue;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+ return 1;
+}
+
+CORBA::Boolean
+TAO_TypeCodeFactory_i::valid_id (const char *id)
+{
+ ACE_CString safety (id,
+ 0,
+ 0);
+
+ ACE_CString::size_type const pos = safety.find (':');
+
+ if (pos == ACE_CString::npos)
+ {
+ return 0;
+ }
+
+ ACE_CString format (safety.substr (0, pos));
+
+ if (format == "IDL"
+ || format == "RMI"
+ || format == "DCE"
+ || format == "LOCAL")
+ {
+ return 1;
+ }
+
+ return 0;
+}
+
+CORBA::Boolean
+TAO_TypeCodeFactory_i::valid_content_type (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL)
+{
+ CORBA::TCKind const kind =
+ TAO::unaliased_kind (tc
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ switch (kind)
+ {
+ case CORBA::TAO_TC_KIND_COUNT:
+ return 1; // Recursive TypeCode.
+ case CORBA::tk_void:
+ case CORBA::tk_except:
+ return 0;
+ default:
+ return 1;
+ }
+}
+
+CORBA::Boolean
+TAO_TypeCodeFactory_i::unique_label_values (
+ const CORBA::UnionMemberSeq &members,
+ CORBA::TypeCode_ptr disc_tc,
+ CORBA::ULong default_index_slot
+ ACE_ENV_ARG_DECL)
+{
+ CORBA::TCKind disc_kind = disc_tc->kind (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ CORBA::ULong length = members.length ();
+
+ // We have already checked for valid discriminator type
+ // and valid label types, so we won't check for any of that here.
+
+ struct label_types
+ {
+ CORBA::Char char_val;
+ CORBA::Boolean bool_val;
+ CORBA::Short short_val;
+ CORBA::UShort ushort_val;
+ CORBA::Long long_val;
+ CORBA::ULong ulong_val;
+ CORBA::ULong enum_val;
+ CORBA::ULongLong ulonglong_val;
+ CORBA::LongLong longlong_val;
+ } s = {0, 0, 0, 0, 0, 0, 0, 0, ACE_CDR_LONGLONG_INITIALIZER };
+
+ // Two cases - one for signed and one for unsigned discriminator types.
+ if (disc_kind == CORBA::tk_long
+ || disc_kind == CORBA::tk_short)
+ {
+ ACE_Bounded_Set<CORBA::Long> checker (length);
+
+ for (CORBA::ULong i = 0; i < length; ++i)
+ {
+ if (i == default_index_slot)
+ {
+ continue;
+ }
+
+ switch (disc_kind)
+ {
+ case CORBA::tk_long:
+ members[i].label >>= s.long_val;
+
+ if (checker.insert (s.long_val) != 0)
+ {
+ return 0;
+ }
+
+ break;
+ case CORBA::tk_short:
+ members[i].label >>= s.short_val;
+
+ if (checker.insert (s.short_val) != 0)
+ {
+ return 0;
+ }
+
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ else
+ {
+ ACE_Bounded_Set<CORBA::ULong> checker (length);
+
+ for (CORBA::ULong i = 0; i < length; ++i)
+ {
+ if (i == default_index_slot)
+ {
+ continue;
+ }
+
+ switch (disc_kind)
+ {
+ case CORBA::tk_boolean:
+ members[i].label >>= CORBA::Any::to_boolean (s.bool_val);
+
+ if (checker.insert (s.bool_val) != 0)
+ {
+ return 0;
+ }
+
+ break;
+ case CORBA::tk_char:
+ members[i].label >>= CORBA::Any::to_char (s.char_val);
+
+ if (checker.insert (s.char_val) != 0)
+ {
+ return 0;
+ }
+
+ break;
+ case CORBA::tk_ushort:
+ members[i].label >>= s.ushort_val;
+
+ if (checker.insert (s.ushort_val) != 0)
+ {
+ return 0;
+ }
+
+ break;
+ case CORBA::tk_ulong:
+ members[i].label >>= s.ulong_val;
+
+ if (checker.insert (s.ulong_val) != 0)
+ {
+ return 0;
+ }
+
+ break;
+ case CORBA::tk_enum:
+ {
+ TAO::Any_Impl *impl = members[i].label.impl ();
+ TAO_InputCDR for_reading (static_cast<ACE_Message_Block *> (0));
+
+ if (impl->encoded ())
+ {
+ TAO::Unknown_IDL_Type *unk =
+ dynamic_cast<TAO::Unknown_IDL_Type *> (impl);
+
+ // We don't want unk's rd_ptr to move, in case
+ // we are shared by another Any, so we use this
+ // to copy the state, not the buffer.
+ for_reading = unk->_tao_get_cdr ();
+ }
+ else
+ {
+ TAO_OutputCDR out;
+ impl->marshal_value (out);
+ TAO_InputCDR tmp (out);
+ for_reading = tmp;
+ }
+
+ for_reading.read_ulong (s.enum_val);
+
+ if (checker.insert (s.enum_val) != 0)
+ {
+ return 0;
+ }
+
+ break;
+ }
+ default:
+ break;
+ }
+ }
+ }
+
+ return 1;
+}
+
+CORBA::Boolean
+TAO_TypeCodeFactory_i::valid_disc_type (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL)
+{
+ CORBA::TCKind const kind = tc->kind (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ return
+ (kind == CORBA::tk_enum
+ || kind == CORBA::tk_ulong
+ || kind == CORBA::tk_long
+ || kind == CORBA::tk_ushort
+ || kind == CORBA::tk_short
+ || kind == CORBA::tk_char
+ || kind == CORBA::tk_boolean
+ || kind == CORBA::tk_longlong
+ || kind == CORBA::tk_ulonglong);
+}
+
+bool
+TAO_TypeCodeFactory_i::check_recursion (CORBA::TCKind kind,
+ char const * id,
+ CORBA::TypeCode_ptr member,
+ CORBA::TypeCode_ptr & recursive_tc
+ ACE_ENV_ARG_DECL)
+{
+ if (kind != CORBA::tk_struct
+ && kind != CORBA::tk_union
+ && kind != CORBA::tk_value
+ && kind != CORBA::tk_event)
+ return false;
+
+ CORBA::TypeCode_var unaliased_member =
+ TAO::unaliased_typecode (member
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ CORBA::TCKind const unaliased_member_kind =
+ unaliased_member->kind (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ // Recursively iterate through the member and content types until
+ // we've exhausted all TypeCodes capable of containing other
+ // TypeCodes.
+ switch (unaliased_member_kind)
+ {
+ case CORBA::tk_struct:
+ case CORBA::tk_union:
+ case CORBA::tk_value:
+ case CORBA::tk_event:
+ {
+ CORBA::ULong const nfields =
+ unaliased_member->member_count (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ for (CORBA::ULong i = 0; i < nfields; ++i)
+ {
+ CORBA::TypeCode_var member_tc =
+ unaliased_member->member_type (i
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ CORBA::TCKind const member_tc_kind =
+ member_tc->kind (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ if (member_tc_kind == CORBA::TAO_TC_KIND_COUNT)
+ {
+ // Valuetypes can directly contain a recursive member
+ // (e.g. valuetype V { public V member; };). Check if
+ // the member TypeCode is the recursive TypeCode
+ // placeholder.
+ if (kind == CORBA::tk_value || kind == CORBA::tk_event)
+ {
+ char const * member_tc_id =
+ member_tc->id (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ if (ACE_OS::strcmp (id, member_tc_id) == 0)
+ {
+ TAO::TypeCodeFactory::Recursive_TypeCode * const rtc =
+ dynamic_cast<
+ TAO::TypeCodeFactory::Recursive_TypeCode *> (
+ member_tc.in ());
+
+ ACE_ASSERT (rtc);
+
+ if (CORBA::is_nil (recursive_tc))
+ {
+ recursive_tc =
+ this->make_recursive_tc (kind,
+ id
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+ }
+
+ // Set the actual recursive TypeCode.
+ rtc->the_typecode (recursive_tc);
+
+ return true;
+ }
+
+ // Different recursive TypeCode. Let it be.
+ }
+ else
+ {
+ // @@ structs and unions may not directly contain
+ // recursive members. They must be indirectly
+ // recursive through a member sequence (which
+ // itself may be contained inside a nested
+ // struct, union, etc).
+ ACE_THROW_RETURN (CORBA::BAD_TYPECODE (), false);
+ }
+ }
+ else
+ {
+ bool const recursion_detected =
+ this->check_recursion (kind,
+ id,
+ member_tc.in (),
+ recursive_tc
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ if (recursion_detected)
+ {
+ return true;
+ }
+ }
+
+ // Not recursive or not the recursive TypeCode we want.
+ // Try the next member.
+ }
+ }
+ break;
+
+ case CORBA::tk_sequence:
+ case CORBA::tk_array:
+ {
+ CORBA::TypeCode_var content_tc =
+ unaliased_member->content_type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ CORBA::TCKind const content_tc_kind =
+ content_tc->kind (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ if (content_tc_kind == CORBA::TAO_TC_KIND_COUNT)
+ {
+ char const * content_tc_id =
+ content_tc->id (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ if (ACE_OS::strcmp (id, content_tc_id) == 0)
+ {
+ TAO::TypeCodeFactory::Recursive_TypeCode * const rtc =
+ dynamic_cast<TAO::TypeCodeFactory::Recursive_TypeCode *>
+ (content_tc.in ());
+
+ ACE_ASSERT (rtc);
+
+ if (CORBA::is_nil (recursive_tc))
+ {
+ recursive_tc =
+ this->make_recursive_tc (kind,
+ id
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+ }
+
+ // Set the actual recursive TypeCode.
+ rtc->the_typecode (recursive_tc);
+
+ return true;
+ }
+
+ // Different recursive TypeCode. Let it be.
+ }
+
+ return this->check_recursion (kind,
+ id,
+ content_tc.in (),
+ recursive_tc
+ ACE_ENV_ARG_PARAMETER);
+ }
+
+ default:
+ break; // Not a recursion-capable TypeCode.
+ }
+
+ return false;
+}
+
+CORBA::TypeCode_ptr
+TAO_TypeCodeFactory_i::make_recursive_tc (CORBA::TCKind kind,
+ char const * id
+ ACE_ENV_ARG_DECL)
+{
+ CORBA::TypeCode_ptr tc = CORBA::TypeCode::_nil ();
+
+ switch (kind)
+ {
+ case CORBA::tk_struct:
+ ACE_NEW_THROW_EX (tc,
+ TCF::Struct::recursive_typecode_type (kind, id),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (tc);
+ break;
+
+ case CORBA::tk_union:
+ ACE_NEW_THROW_EX (tc,
+ TCF::Union::recursive_typecode_type (kind, id),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (tc);
+ break;
+
+ case CORBA::tk_value:
+ case CORBA::tk_event:
+ ACE_NEW_THROW_EX (tc,
+ TCF::Value::recursive_typecode_type (kind, id),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (tc);
+ break;
+
+ default: // Should never hit this case.
+ ACE_THROW_RETURN (CORBA::INTERNAL (),
+ tc);
+ }
+
+ return tc;
+}
+
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/TypeCodeFactory/TypeCodeFactory_i.h b/TAO/tao/TypeCodeFactory/TypeCodeFactory_i.h
new file mode 100644
index 00000000000..e463d0a4169
--- /dev/null
+++ b/TAO/tao/TypeCodeFactory/TypeCodeFactory_i.h
@@ -0,0 +1,323 @@
+// This may look like C, but it's really -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file TypeCodeFactory_i.h
+ *
+ * $Id$
+ *
+ * @author Jeff Parsons <parsons@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_TYPECODEFACTORY_I_H
+#define TAO_TYPECODEFACTORY_I_H
+
+#include /**/ "ace/pre.h"
+#include "tao/TypeCodeFactory/TypeCodeFactory_Loader.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/LocalObject.h"
+
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace TypeCode
+ {
+ template <typename StringType, typename TypeCodeType> class Case;
+
+ typedef Case<CORBA::String_var, CORBA::TypeCode_var> Case_Dynamic;
+ }
+}
+
+
+class TAO_TypeCodeFactory_Export TAO_TypeCodeFactory_i
+ : public virtual CORBA::TypeCodeFactory,
+ public virtual TAO_Local_RefCounted_Object
+{
+/**
+ * @class TAO_TypeCodeFactory_i
+ *
+ * @brief TAO_TypeCodeFactory_i.
+ *
+ * Implementation of the CORBA::TypeCodeFactory interface
+ */
+public:
+ /// ctor
+ TAO_TypeCodeFactory_i (void);
+
+ /// dtor
+ ~TAO_TypeCodeFactory_i (void);
+
+ /// = LocalObject methods
+ static TAO_TypeCodeFactory_i *_narrow (
+ CORBA::Object_ptr obj
+ ACE_ENV_ARG_DECL);
+
+ virtual CORBA::TypeCode_ptr create_struct_tc (
+ const char *id,
+ const char *name,
+ const CORBA::StructMemberSeq &members
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual CORBA::TypeCode_ptr create_union_tc (
+ const char *id,
+ const char *name,
+ CORBA::TypeCode_ptr discriminator_type,
+ const CORBA::UnionMemberSeq &members
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual CORBA::TypeCode_ptr create_enum_tc (
+ const char *id,
+ const char *name,
+ const CORBA::EnumMemberSeq &members
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual CORBA::TypeCode_ptr create_alias_tc (
+ const char *id,
+ const char *name,
+ CORBA::TypeCode_ptr original_type
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual CORBA::TypeCode_ptr create_exception_tc (
+ const char *id,
+ const char *name,
+ const CORBA::StructMemberSeq &members
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual CORBA::TypeCode_ptr create_interface_tc (
+ const char *id,
+ const char *name
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual CORBA::TypeCode_ptr create_string_tc (
+ CORBA::ULong bound
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual CORBA::TypeCode_ptr create_wstring_tc (
+ CORBA::ULong bound
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual CORBA::TypeCode_ptr create_fixed_tc (
+ CORBA::UShort digits,
+ CORBA::UShort scale
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual CORBA::TypeCode_ptr create_sequence_tc (
+ CORBA::ULong bound,
+ CORBA::TypeCode_ptr element_type
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual CORBA::TypeCode_ptr create_array_tc (
+ CORBA::ULong length,
+ CORBA::TypeCode_ptr element_type
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual CORBA::TypeCode_ptr create_value_tc (
+ const char *id,
+ const char *name,
+ CORBA::ValueModifier type_modifier,
+ CORBA::TypeCode_ptr concrete_base,
+ const CORBA::ValueMemberSeq &members
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual CORBA::TypeCode_ptr create_value_box_tc (
+ const char *id,
+ const char *name,
+ CORBA::TypeCode_ptr boxed_type
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual CORBA::TypeCode_ptr create_native_tc (
+ const char *id,
+ const char *name
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual CORBA::TypeCode_ptr create_recursive_tc (
+ const char *id
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual CORBA::TypeCode_ptr create_abstract_interface_tc (
+ const char *id,
+ const char *name
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual CORBA::TypeCode_ptr create_local_interface_tc (
+ const char *id,
+ const char *name
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual CORBA::TypeCode_ptr create_component_tc (
+ const char *id,
+ const char *name
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual CORBA::TypeCode_ptr create_home_tc (
+ const char *id,
+ const char *name
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual CORBA::TypeCode_ptr create_event_tc (
+ const char *id,
+ const char *name,
+ CORBA::ValueModifier type_modifier,
+ CORBA::TypeCode_ptr concrete_base,
+ const CORBA::ValueMemberSeq &members
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+private:
+ /// Finds a legal default label value.
+ void compute_default_label (CORBA::TCKind kind,
+ CORBA::ULong skip_slot,
+ const CORBA::UnionMemberSeq &members,
+ TAO::TypeCode::Case_Dynamic *& the_case);
+
+ /// Called for all types that take just an id and a name.
+ CORBA::TypeCode_ptr create_tc_common (
+ const char *id,
+ const char *name,
+ CORBA::TCKind kind
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Code for strings and wstrings is identical except for TCKind.
+ CORBA::TypeCode_ptr string_wstring_tc_common (
+ CORBA::ULong bound,
+ CORBA::TCKind kind
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Code for arrays and sequences is identical except for TCKind.
+ CORBA::TypeCode_ptr sequence_array_tc_common (
+ CORBA::ULong bound,
+ CORBA::TypeCode_ptr element_type,
+ CORBA::TCKind kind
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Code for structs and unions is identical except for TCKind.
+ CORBA::TypeCode_ptr struct_except_tc_common (
+ const char *id,
+ const char *name,
+ const CORBA::StructMemberSeq &members,
+ CORBA::TCKind kind
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// Code for aliases and boxed valuetypes is identical except for TCKind.
+ CORBA::TypeCode_ptr alias_value_box_tc_common (
+ const char *id,
+ const char *name,
+ CORBA::TypeCode_ptr underlying_type,
+ CORBA::TCKind kind
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ CORBA::TypeCode_ptr value_event_tc_common (
+ const char *id,
+ const char *name,
+ CORBA::ValueModifier type_modifier,
+ CORBA::TypeCode_ptr concrete_base,
+ const CORBA::ValueMemberSeq &members,
+ CORBA::TCKind kind
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /// If any of these fail, we raise a spec-defined minor code
+ /// of BAD_PARAM or BAD_TYPECODE.
+ CORBA::Boolean valid_name (const char *name);
+ CORBA::Boolean valid_id (const char *id);
+ CORBA::Boolean valid_content_type (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL);
+ CORBA::Boolean unique_label_values (const CORBA::UnionMemberSeq &members,
+ CORBA::TypeCode_ptr disc_tc,
+ CORBA::ULong default_index_slot
+ ACE_ENV_ARG_DECL);
+ CORBA::Boolean valid_disc_type (CORBA::TypeCode_ptr tc
+ ACE_ENV_ARG_DECL);
+
+ /// Check @a member for recursive @c TypeCode.
+ /**
+ * @return @c true if @a member contains a recursive @c TypeCode,
+ * and set @a recursive_tc to the actual recursive
+ * @c TypeCode that was represented by the recursive
+ * @c TypeCode placeholder.
+ */
+ bool check_recursion (CORBA::TCKind kind,
+ char const * id,
+ CORBA::TypeCode_ptr member,
+ CORBA::TypeCode_ptr & recursive_tc
+ ACE_ENV_ARG_DECL);
+
+ /// Make a recursive TypeCode with the given kind and repository ID.
+ CORBA::TypeCode_ptr make_recursive_tc (CORBA::TCKind kind,
+ char const * id
+ ACE_ENV_ARG_DECL);
+
+ /// Prohibited
+ TAO_TypeCodeFactory_i (const TAO_TypeCodeFactory_i &src);
+ TAO_TypeCodeFactory_i &operator= (const TAO_TypeCodeFactory_i &src);
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_TYPECODEFACTORY_I_H */
diff --git a/TAO/tao/TypeCodeFactory/typecodefactory_export.h b/TAO/tao/TypeCodeFactory/typecodefactory_export.h
new file mode 100644
index 00000000000..03bfa7334ab
--- /dev/null
+++ b/TAO/tao/TypeCodeFactory/typecodefactory_export.h
@@ -0,0 +1,40 @@
+
+// -*- C++ -*-
+// $Id$
+// Definition for Win32 Export directives.
+// This file is generated automatically by generate_export_file.pl
+// ------------------------------
+#ifndef TAO_TYPECODEFACTORY_EXPORT_H
+#define TAO_TYPECODEFACTORY_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if defined (TAO_AS_STATIC_LIBS)
+# if !defined (TAO_TYPECODEFACTORY_HAS_DLL)
+# define TAO_TYPECODEFACTORY_HAS_DLL 0
+# endif /* ! TAO_TYPECODEFACTORY_HAS_DLL */
+#else
+# if !defined (TAO_TYPECODEFACTORY_HAS_DLL)
+# define TAO_TYPECODEFACTORY_HAS_DLL 1
+# endif /* ! TAO_TYPECODEFACTORY_HAS_DLL */
+#endif
+
+#if defined (TAO_TYPECODEFACTORY_HAS_DLL) && (TAO_TYPECODEFACTORY_HAS_DLL == 1)
+# if defined (TAO_TYPECODEFACTORY_BUILD_DLL)
+# define TAO_TypeCodeFactory_Export ACE_Proper_Export_Flag
+# define TAO_TYPECODEFACTORY_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# define TAO_TYPECODEFACTORY_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# else /* TAO_TYPECODEFACTORY_BUILD_DLL */
+# define TAO_TypeCodeFactory_Export ACE_Proper_Import_Flag
+# define TAO_TYPECODEFACTORY_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# define TAO_TYPECODEFACTORY_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# endif /* TAO_TYPECODEFACTORY_BUILD_DLL */
+#else /* TAO_TYPECODEFACTORY_HAS_DLL == 1 */
+# define TAO_TypeCodeFactory_Export
+# define TAO_TYPECODEFACTORY_SINGLETON_DECLARATION(T)
+# define TAO_TYPECODEFACTORY_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+#endif /* TAO_TYPECODEFACTORY_HAS_DLL == 1 */
+
+#endif /* TAO_TYPECODEFACTORY_EXPORT_H */
+
+// End of auto generated file.
diff --git a/TAO/tao/TypeCodeFactory_Adapter.cpp b/TAO/tao/TypeCodeFactory_Adapter.cpp
new file mode 100644
index 00000000000..1dbec9f2dea
--- /dev/null
+++ b/TAO/tao/TypeCodeFactory_Adapter.cpp
@@ -0,0 +1,14 @@
+// @(#) $Id$
+
+#include "tao/TypeCodeFactory_Adapter.h"
+
+#include "ace/Dynamic_Service.h"
+
+ACE_RCSID (tao,
+ TypeCodeFactory_Adapter,
+ "$Id$")
+
+TAO_TypeCodeFactory_Adapter::~TAO_TypeCodeFactory_Adapter (void)
+{
+}
+
diff --git a/TAO/tao/TypeCodeFactory_Adapter.h b/TAO/tao/TypeCodeFactory_Adapter.h
new file mode 100644
index 00000000000..67353a5d2da
--- /dev/null
+++ b/TAO/tao/TypeCodeFactory_Adapter.h
@@ -0,0 +1,282 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file TypeCodeFactory_Adapter.h
+ *
+ * $Id$
+ *
+ * @author Jeff Parsons <parsons@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_TYPECODEFACTORY_ADAPTER_H
+#define TAO_TYPECODEFACTORY_ADAPTER_H
+
+#include /**/ "ace/pre.h"
+#include "ace/Service_Object.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/SystemException.h"
+#include "tao/Environment.h"
+#include "tao/Typecode_typesC.h"
+
+ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+template<class T> class ACE_Array_Base;
+ACE_END_VERSIONED_NAMESPACE_DECL
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace CORBA
+{
+ class EnumMemberSeq;
+ class StructMemberSeq;
+ class UnionMemberSeq;
+ class ValueMemberSeq;
+
+ typedef TAO_Pseudo_Var_T<TypeCode> TypeCode_var;
+ typedef TAO_Pseudo_Out_T<TypeCode> TypeCode_out;
+
+ typedef CORBA::Short ValueModifier;
+}
+
+namespace TAO
+{
+ namespace TypeCode
+ {
+ template<typename StringType, typename TypeCodeType> class Case;
+ template<typename StringType, typename TypeCodeType> struct Struct_Field;
+ template<typename StringType, typename TypeCodeType> struct Value_Field;
+ }
+}
+
+
+/**
+ * @class TAO_TypeCodeFactory_Adapter
+ *
+ * @brief TAO_TypeCodeFactory_Adapter.
+ *
+ * Class that adapts the CORBA::ORB create_*_tc functions
+ * to use the TypeCodeFactory. This is a base class for
+ * the actual implementation in the TypeCodeFactory_DLL library.
+ */
+class TAO_Export TAO_TypeCodeFactory_Adapter : public ACE_Service_Object
+{
+public:
+ virtual ~TAO_TypeCodeFactory_Adapter (void);
+
+ virtual CORBA::TypeCode_ptr create_struct_tc (
+ const char *id,
+ const char *name,
+ const CORBA::StructMemberSeq &members
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException)) = 0;
+
+ virtual CORBA::TypeCode_ptr create_union_tc (
+ const char *id,
+ const char *name,
+ CORBA::TypeCode_ptr discriminator_type,
+ const CORBA::UnionMemberSeq &members
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException)) = 0;
+
+ virtual CORBA::TypeCode_ptr create_enum_tc (
+ const char *id,
+ const char *name,
+ const CORBA::EnumMemberSeq &members
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException)) = 0;
+
+ virtual CORBA::TypeCode_ptr create_alias_tc (
+ const char *id,
+ const char *name,
+ CORBA::TypeCode_ptr original_type
+ ACE_ENV_ARG_DECL
+ )
+
+ ACE_THROW_SPEC ((CORBA::SystemException)) = 0;
+ virtual CORBA::TypeCode_ptr create_exception_tc (
+ const char *id,
+ const char *name,
+ const CORBA::StructMemberSeq &members
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException)) = 0;
+
+ virtual CORBA::TypeCode_ptr create_interface_tc (
+ const char *id,
+ const char *name
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException)) = 0;
+
+ virtual CORBA::TypeCode_ptr create_string_tc (
+ CORBA::ULong bound
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException)) = 0;
+
+ virtual CORBA::TypeCode_ptr create_wstring_tc (
+ CORBA::ULong bound
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException)) = 0;
+
+ virtual CORBA::TypeCode_ptr create_fixed_tc (
+ CORBA::UShort digits,
+ CORBA::UShort scale
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException)) = 0;
+
+ virtual CORBA::TypeCode_ptr create_sequence_tc (
+ CORBA::ULong bound,
+ CORBA::TypeCode_ptr element_type
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException)) = 0;
+
+ virtual CORBA::TypeCode_ptr create_array_tc (
+ CORBA::ULong length,
+ CORBA::TypeCode_ptr element_type
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException)) = 0;
+
+ virtual CORBA::TypeCode_ptr create_value_tc (
+ const char *id,
+ const char *name,
+ CORBA::ValueModifier type_modifier,
+ CORBA::TypeCode_ptr concrete_base,
+ const CORBA::ValueMemberSeq &members
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException)) = 0;
+
+ virtual CORBA::TypeCode_ptr create_value_box_tc (
+ const char *id,
+ const char *name,
+ CORBA::TypeCode_ptr boxed_type
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException)) = 0;
+
+ virtual CORBA::TypeCode_ptr create_native_tc (
+ const char *id,
+ const char *name
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException)) = 0;
+
+ virtual CORBA::TypeCode_ptr create_recursive_tc (
+ const char *id
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException)) = 0;
+
+ virtual CORBA::TypeCode_ptr create_abstract_interface_tc (
+ const char *id,
+ const char *name
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException)) = 0;
+
+ virtual CORBA::TypeCode_ptr create_local_interface_tc (
+ const char *id,
+ const char *name
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException)) = 0;
+
+ virtual CORBA::TypeCode_ptr create_component_tc (
+ const char *id,
+ const char *name
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException)) = 0;
+
+ virtual CORBA::TypeCode_ptr create_home_tc (
+ const char *id,
+ const char *name
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException)) = 0;
+
+ virtual CORBA::TypeCode_ptr create_event_tc (
+ const char *id,
+ const char *name,
+ CORBA::ValueModifier type_modifier,
+ CORBA::TypeCode_ptr concrete_base,
+ const CORBA::ValueMemberSeq &members
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException)) = 0;
+
+ // --
+
+ /**
+ * @name TAO-specific TypeCode factory methods.
+ *
+ * Factory methods that has no corresponding TypeCodeFactory IDL,
+ * i.e. they are specific to TAO.
+ */
+ //@{
+ /// Create an enumeration TypeCode.
+ virtual CORBA::TypeCode_ptr create_enum_tc (
+ char const * id,
+ char const * name,
+ ACE_Array_Base<CORBA::String_var> const & enumerators,
+ CORBA::ULong ncases
+ ACE_ENV_ARG_DECL) = 0;
+
+ /// Create a structure or exception TypeCode.
+ virtual CORBA::TypeCode_ptr create_struct_except_tc (
+ CORBA::TCKind,
+ char const * id,
+ char const * name,
+ ACE_Array_Base<
+ TAO::TypeCode::Struct_Field<CORBA::String_var,
+ CORBA::TypeCode_var> > const & fields,
+ CORBA::ULong nfields
+ ACE_ENV_ARG_DECL) = 0;
+
+ /// Create a union TypeCode.
+ virtual CORBA::TypeCode_ptr create_union_tc (
+ char const * id,
+ char const * name,
+ CORBA::TypeCode_ptr discriminant_type,
+ ACE_Array_Base<TAO::TypeCode::Case<CORBA::String_var,
+ CORBA::TypeCode_var> > const & cases,
+ CORBA::ULong ncases,
+ CORBA::Long default_index,
+ char const * default_case_name,
+ CORBA::TypeCode_ptr default_case_type
+ ACE_ENV_ARG_DECL) = 0;
+
+ /// Create a valuetype or eventtype TypeCode.
+ virtual CORBA::TypeCode_ptr create_value_event_tc (
+ CORBA::TCKind,
+ char const * id,
+ char const * name,
+ CORBA::ValueModifier modifier,
+ CORBA::TypeCode_ptr concrete_base,
+ ACE_Array_Base<
+ TAO::TypeCode::Value_Field<CORBA::String_var,
+ CORBA::TypeCode_var> > const & fields,
+ CORBA::ULong nfields
+ ACE_ENV_ARG_DECL) = 0;
+ //@}
+
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_TYPECODEFACTORY_ADAPTER_H */
diff --git a/TAO/tao/Typecode_types.pidl b/TAO/tao/Typecode_types.pidl
new file mode 100644
index 00000000000..af1802d6d9d
--- /dev/null
+++ b/TAO/tao/Typecode_types.pidl
@@ -0,0 +1,58 @@
+// -*- IDL -*-
+
+// $Id$
+
+// Typecode stuff, originall in orb.idl
+
+#ifndef TAO_TYPECODE_TYPES_IDL
+#define TAO_TYPECODE_TYPES_IDL
+
+#pragma prefix "omg.org"
+
+module CORBA
+{
+ interface TypeCode;
+
+ enum TCKind
+ {
+ tk_null,
+ tk_void,
+ tk_short,
+ tk_long,
+ tk_ushort,
+ tk_ulong,
+ tk_float,
+ tk_double,
+ tk_boolean,
+ tk_char,
+ tk_octet,
+ tk_any,
+ tk_TypeCode,
+ tk_Principal,
+ tk_objref,
+ tk_struct,
+ tk_union,
+ tk_enum,
+ tk_string,
+ tk_sequence,
+ tk_array,
+ tk_alias,
+ tk_except,
+ tk_longlong,
+ tk_ulonglong,
+ tk_longdouble,
+ tk_wchar,
+ tk_wstring,
+ tk_fixed,
+ tk_value,
+ tk_value_box,
+ tk_native,
+ tk_abstract_interface,
+ tk_local_interface,
+ tk_component,
+ tk_home,
+ tk_event
+ };
+};
+
+#endif /* TAO_TYPECODE_TYPES_IDL */
diff --git a/TAO/tao/Typecode_typesC.cpp b/TAO/tao/Typecode_typesC.cpp
new file mode 100644
index 00000000000..bf8cc72d22a
--- /dev/null
+++ b/TAO/tao/Typecode_typesC.cpp
@@ -0,0 +1,71 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:291
+
+
+#include "tao/Typecode_typesC.h"
+#include "tao/CDR.h"
+
+#if defined (__BORLANDC__)
+#pragma option -w-rvl -w-rch -w-ccc -w-aus -w-sig
+#endif /* __BORLANDC__ */
+
+// TAO_IDL - Generated from
+// be\be_visitor_arg_traits.cpp:70
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Arg traits specializations.
+namespace TAO
+{
+}
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_enum/cdr_op_cs.cpp:51
+
+CORBA::Boolean operator<< (TAO_OutputCDR & strm, CORBA::TCKind _tao_enumerator)
+{
+ return strm << static_cast<CORBA::ULong> (_tao_enumerator);
+}
+
+CORBA::Boolean operator>> (TAO_InputCDR & strm, CORBA::TCKind & _tao_enumerator)
+{
+ CORBA::ULong _tao_temp = 0;
+ CORBA::Boolean const _tao_success = strm >> _tao_temp;
+
+ if (_tao_success)
+ {
+ _tao_enumerator = static_cast<CORBA::TCKind> (_tao_temp);
+ }
+
+ return _tao_success;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Typecode_typesC.h b/TAO/tao/Typecode_typesC.h
new file mode 100644
index 00000000000..5c6dfd896d8
--- /dev/null
+++ b/TAO/tao/Typecode_typesC.h
@@ -0,0 +1,152 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:153
+
+#ifndef _TAO_IDL_ORIG_TYPECODE_TYPESC_H_
+#define _TAO_IDL_ORIG_TYPECODE_TYPESC_H_
+
+#include /**/ "ace/pre.h"
+
+#include "tao/TAO_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Basic_Types.h"
+
+#if defined (TAO_EXPORT_MACRO)
+#undef TAO_EXPORT_MACRO
+#endif
+#define TAO_EXPORT_MACRO TAO_Export
+
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+#if defined (__BORLANDC__)
+#pragma option push -w-rvl -w-rch -w-ccc -w-inl
+#endif /* __BORLANDC__ */
+
+// TAO_IDL - Generated from
+// be\be_visitor_module/module_ch.cpp:48
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace CORBA
+{
+
+ // TAO_IDL - Generated from
+ // be\be_interface.cpp:598
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_enum/enum_ch.cpp:57
+
+ enum TCKind
+ {
+ tk_null,
+ tk_void,
+ tk_short,
+ tk_long,
+ tk_ushort,
+ tk_ulong,
+ tk_float,
+ tk_double,
+ tk_boolean,
+ tk_char,
+ tk_octet,
+ tk_any,
+ tk_TypeCode,
+ tk_Principal,
+ tk_objref,
+ tk_struct,
+ tk_union,
+ tk_enum,
+ tk_string,
+ tk_sequence,
+ tk_array,
+ tk_alias,
+ tk_except,
+ tk_longlong,
+ tk_ulonglong,
+ tk_longdouble,
+ tk_wchar,
+ tk_wstring,
+ tk_fixed,
+ tk_value,
+ tk_value_box,
+ tk_native,
+ tk_abstract_interface,
+ tk_local_interface,
+ tk_component,
+ tk_home,
+ tk_event
+
+ // This symbol is not defined by CORBA 3.0. It's used to speed up
+ // dispatch based on TCKind values, and lets many important ones
+ // just be table lookups. It must always be the last enum value!!
+ , TAO_TC_KIND_COUNT
+ };
+
+ typedef TCKind &TCKind_out;
+
+// TAO_IDL - Generated from
+// be\be_visitor_module/module_ch.cpp:66
+
+} // module CORBA
+
+// TAO_IDL - Generated from
+// be\be_visitor_traits.cpp:61
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_enum/cdr_op_ch.cpp:50
+
+TAO_Export CORBA::Boolean operator<< (TAO_OutputCDR &, CORBA::TCKind);
+TAO_Export CORBA::Boolean operator>> (TAO_InputCDR &, CORBA::TCKind &);
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:955
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#if defined (__BORLANDC__)
+#pragma option pop
+#endif /* __BORLANDC__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* ifndef */
+
+
diff --git a/TAO/tao/Typecode_typesS.h b/TAO/tao/Typecode_typesS.h
new file mode 100644
index 00000000000..17b1360599e
--- /dev/null
+++ b/TAO/tao/Typecode_typesS.h
@@ -0,0 +1,28 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// Skeleton file generation suppressed with command line option -SS
diff --git a/TAO/tao/UB_String_Argument_T.cpp b/TAO/tao/UB_String_Argument_T.cpp
new file mode 100644
index 00000000000..9afe7216324
--- /dev/null
+++ b/TAO/tao/UB_String_Argument_T.cpp
@@ -0,0 +1,131 @@
+// $Id$
+
+#ifndef TAO_UB_STRING_ARGUMENT_T_CPP
+#define TAO_UB_STRING_ARGUMENT_T_CPP
+
+#include "tao/UB_String_Argument_T.h"
+#include "tao/CDR.h"
+
+#if !defined (__ACE_INLINE__)
+#include "tao/UB_String_Argument_T.inl"
+#endif /* __ACE_INLINE__ */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template<typename S_var,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::In_UB_String_Argument_T<S_var,Insert_Policy>::marshal (
+ TAO_OutputCDR &cdr
+ )
+{
+ return cdr << this->x_;
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S_var,
+ class Insert_Policy>
+void
+TAO::In_UB_String_Argument_T<S_var,Insert_Policy>::interceptor_value (
+ CORBA::Any *any
+ ) const
+{
+ Insert_Policy::any_insert (any, this->x_);
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+// ===========================================================
+
+template<typename S_var,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::Inout_UB_String_Argument_T<S_var,Insert_Policy>::marshal (
+ TAO_OutputCDR &cdr
+ )
+{
+ return cdr << this->x_;
+}
+
+template<typename S_var,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::Inout_UB_String_Argument_T<S_var,Insert_Policy>::demarshal (
+ TAO_InputCDR & cdr
+ )
+{
+ delete [] this->x_;
+ return cdr >> this->x_;
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S_var,
+ class Insert_Policy>
+void
+TAO::Inout_UB_String_Argument_T<S_var,Insert_Policy>::interceptor_value (
+ CORBA::Any *any
+ ) const
+{
+ Insert_Policy::any_insert (
+ any,
+ this->x_
+ );
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+// ==============================================================
+
+template<typename S_var,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::Out_UB_String_Argument_T<S_var,Insert_Policy>::demarshal (TAO_InputCDR & cdr)
+{
+ return cdr >> this->x_;
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S_var,
+ class Insert_Policy>
+void
+TAO::Out_UB_String_Argument_T<S_var,Insert_Policy>::interceptor_value (
+ CORBA::Any *any
+ ) const
+{
+ Insert_Policy::any_insert (
+ any,
+ this->x_
+ );
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+// ============================================================
+
+template<typename S_var,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::Ret_UB_String_Argument_T<S_var,Insert_Policy>::demarshal (TAO_InputCDR & cdr)
+{
+ return cdr >> this->x_.out ();
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S_var,
+ class Insert_Policy>
+void
+TAO::Ret_UB_String_Argument_T<S_var,Insert_Policy>::interceptor_value (
+ CORBA::Any *any) const
+{
+ Insert_Policy::any_insert (any, this->x_.in ());
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_UB_STRING_ARGUMENT_T_CPP */
diff --git a/TAO/tao/UB_String_Argument_T.h b/TAO/tao/UB_String_Argument_T.h
new file mode 100644
index 00000000000..68868fccd6e
--- /dev/null
+++ b/TAO/tao/UB_String_Argument_T.h
@@ -0,0 +1,162 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file UB_String_Argument_T.h
+ *
+ * $Id$
+ *
+ * @author Jeff Parsons
+ * @author Carlos O'Ryan
+ */
+//=============================================================================
+
+#ifndef TAO_UB_STRING_ARGUMENT_T_H
+#define TAO_UB_STRING_ARGUMENT_T_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Argument.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ /**
+ * @class In_UB_String_Argument_T
+ *
+ * @brief Template class for IN unbounded (w)string argument.
+ *
+ */
+ template<typename S_var,
+ class Insert_Policy>
+ class In_UB_String_Argument_T : public InArgument
+ {
+ public:
+ In_UB_String_Argument_T (const typename S_var::s_traits::char_type * x);
+
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ const typename S_var::s_traits::char_type * arg (void) const;
+
+ private:
+ typename S_var::s_traits::char_type const * x_;
+ };
+
+ /**
+ * @class Inout_UB_String_Argument_T
+ *
+ * @brief Template class for INOUT unbounded (w)string argument.
+ *
+ */
+ template<typename S_var,
+ class Insert_Policy>
+ class Inout_UB_String_Argument_T : public InoutArgument
+ {
+ public:
+ Inout_UB_String_Argument_T (typename S_var::s_traits::char_type *& x);
+
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+ virtual CORBA::Boolean demarshal (TAO_InputCDR &);
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ typename S_var::s_traits::char_type *& arg (void);
+
+ private:
+ typename S_var::s_traits::char_type *& x_;
+ };
+
+ /**
+ * @class Out_UB_String_Argument_T
+ *
+ * @brief Template class for OUT unbounded (w)string argument.
+ *
+ */
+ template<typename S_var,
+ class Insert_Policy>
+ class Out_UB_String_Argument_T : public OutArgument
+ {
+ public:
+ Out_UB_String_Argument_T (typename S_var::s_traits::string_out & x);
+
+ virtual CORBA::Boolean demarshal (TAO_InputCDR &);
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ typename S_var::s_traits::char_type *& arg (void);
+
+ private:
+ typename S_var::s_traits::char_type *& x_;
+ };
+
+ /**
+ * @class Ret_UB_String_Argument_T
+ *
+ * @brief Template class for return stub value of ub (w)string argument.
+ *
+ */
+ template<typename S_var,
+ class Insert_Policy>
+ class Ret_UB_String_Argument_T : public RetArgument
+ {
+ public:
+ Ret_UB_String_Argument_T (void);
+
+ virtual CORBA::Boolean demarshal (TAO_InputCDR &);
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ typename S_var::s_traits::char_type *& arg (void);
+ typename S_var::s_traits::char_type * excp (void);
+ typename S_var::s_traits::char_type * retn (void);
+
+ private:
+ S_var x_;
+ };
+
+ /**
+ * @struct UB_String_Arg_Traits_T
+ *
+ * @brief Template class for argument traits of unbounded (w)strings.
+ *
+ */
+ template<typename T_var,
+ class Insert_Policy>
+ struct UB_String_Arg_Traits_T
+ {
+ typedef typename T_var::s_traits::char_type * ret_type;
+ typedef typename T_var::s_traits::char_type const * in_type;
+ typedef typename T_var::s_traits::char_type *& inout_type;
+ typedef typename T_var::s_traits::string_out out_type;
+
+ typedef In_UB_String_Argument_T<T_var, Insert_Policy> in_arg_val;
+ typedef Inout_UB_String_Argument_T<T_var, Insert_Policy> inout_arg_val;
+ typedef Out_UB_String_Argument_T<T_var, Insert_Policy> out_arg_val;
+ typedef Ret_UB_String_Argument_T<T_var, Insert_Policy> ret_val;
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+#include "tao/UB_String_Argument_T.inl"
+#endif /* __ACE_INLINE__ */
+
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+#include "tao/UB_String_Argument_T.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
+#pragma implementation ("UB_String_Argument_T.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_UB_STRING_ARGUMENT_T_H */
diff --git a/TAO/tao/UB_String_Argument_T.inl b/TAO/tao/UB_String_Argument_T.inl
new file mode 100644
index 00000000000..d6944b69e28
--- /dev/null
+++ b/TAO/tao/UB_String_Argument_T.inl
@@ -0,0 +1,99 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template<typename S_var,
+ class Insert_Policy>
+ACE_INLINE
+TAO::In_UB_String_Argument_T<S_var,Insert_Policy>::In_UB_String_Argument_T (
+ const typename S_var::s_traits::char_type * x)
+ : x_ (x)
+{}
+
+template<typename S_var,
+ class Insert_Policy>
+ACE_INLINE
+const typename S_var::s_traits::char_type *
+TAO::In_UB_String_Argument_T<S_var,Insert_Policy>::arg (void) const
+{
+ return this->x_;
+}
+
+// ==========================================================================
+
+template<typename S_var,
+ class Insert_Policy>
+ACE_INLINE
+TAO::Inout_UB_String_Argument_T<S_var,Insert_Policy>::Inout_UB_String_Argument_T (
+ typename S_var::s_traits::char_type *& x
+ )
+ : x_ (x)
+{}
+
+template<typename S_var,
+ class Insert_Policy>
+ACE_INLINE
+typename S_var::s_traits::char_type *&
+TAO::Inout_UB_String_Argument_T<S_var,Insert_Policy>::arg (void)
+{
+ return this->x_;
+}
+
+// ==========================================================================
+
+template<typename S_var,
+ class Insert_Policy>
+ACE_INLINE
+TAO::Out_UB_String_Argument_T<S_var,Insert_Policy>::Out_UB_String_Argument_T (
+ typename S_var::s_traits::string_out & x
+ )
+ : x_ (x.ptr ())
+{}
+
+template<typename S_var,
+ class Insert_Policy>
+ACE_INLINE
+typename S_var::s_traits::char_type *&
+TAO::Out_UB_String_Argument_T<S_var,Insert_Policy>::arg (void)
+{
+ return this->x_;
+}
+
+// ==========================================================================
+
+template<typename S_var,
+ class Insert_Policy>
+ACE_INLINE
+TAO::Ret_UB_String_Argument_T<S_var,Insert_Policy>::Ret_UB_String_Argument_T (void)
+{}
+
+template<typename S_var,
+ class Insert_Policy>
+ACE_INLINE
+typename S_var::s_traits::char_type *&
+TAO::Ret_UB_String_Argument_T<S_var,Insert_Policy>::arg (void)
+{
+ return this->x_.out ();
+}
+
+template<typename S_var,
+ class Insert_Policy>
+ACE_INLINE
+typename S_var::s_traits::char_type *
+TAO::Ret_UB_String_Argument_T<S_var,Insert_Policy>::excp (void)
+{
+ return this->x_.ptr ();
+}
+
+template<typename S_var,
+ class Insert_Policy>
+ACE_INLINE
+typename S_var::s_traits::char_type *
+TAO::Ret_UB_String_Argument_T<S_var,Insert_Policy>::retn (void)
+{
+ return this->x_._retn ();
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/UB_String_Arguments.h b/TAO/tao/UB_String_Arguments.h
new file mode 100644
index 00000000000..35537abb630
--- /dev/null
+++ b/TAO/tao/UB_String_Arguments.h
@@ -0,0 +1,55 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file UB_String_Arguments.h
+ *
+ * $Id$
+ *
+ * @authors Jeff Parsons and Carlos O'Ryan
+ */
+//=============================================================================
+
+#ifndef TAO_UB_STRING_ARGUMENTS_H
+#define TAO_UB_STRING_ARGUMENTS_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/UB_String_Argument_T.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Arg_Traits_T.h"
+#include "tao/Any_Insert_Policy_T.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ /**
+ *
+ * @brief Specializatons for unbounded (w)strings.
+ *
+ */
+
+ template<>
+ class TAO_Export Arg_Traits<CORBA::Char *>
+ : public UB_String_Arg_Traits_T<CORBA::String_var,
+ TAO::Any_Insert_Policy_AnyTypeCode_Adapter <CORBA::Char const *> >
+ {
+ };
+
+ template<>
+ class TAO_Export Arg_Traits<CORBA::WChar *>
+ : public UB_String_Arg_Traits_T<CORBA::WString_var,
+ TAO::Any_Insert_Policy_AnyTypeCode_Adapter <CORBA::WChar const *> >
+ {
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_UB_STRING_ARGUMENTS_H */
diff --git a/TAO/tao/ULongLongSeq.pidl b/TAO/tao/ULongLongSeq.pidl
new file mode 100644
index 00000000000..319ecb57382
--- /dev/null
+++ b/TAO/tao/ULongLongSeq.pidl
@@ -0,0 +1,31 @@
+// -*- IDL -*-
+//
+// $Id$
+
+/**
+ * This file was used to generate the code in ULongLongSeqC.*
+ * The command used to generate code is:
+ *
+ * tao_idl
+ * -oA AnyTypeCode
+ * -Ge 1 -GA -SS -Sci
+ * -Wb,pre_include=ace/pre.h
+ * -Wb,post_include=ace/post.h
+ * -Wb,export_macro=TAO_Export
+ * -Wb,export_include=tao/TAO_Export.h
+ * -Wb,anyop_export_macro=TAO_AnyTypeCode_Export
+ * -Wb,anyop_export_include=tao/AnyTypeCode/TAO_AnyTypeCode_Export.h
+ * ULongLongSeq.pidl
+ */
+
+#ifndef TAO_CORBA_ULONGLONG_SEQ_IDL
+#define TAO_CORBA_ULONGLONG_SEQ_IDL
+
+#pragma prefix "omg.org"
+
+module CORBA
+{
+ typedef sequence<unsigned long long> ULongLongSeq;
+};
+
+#endif /* TAO_CORBA_ULONGLONG_SEQ_IDL */
diff --git a/TAO/tao/ULongSeq.pidl b/TAO/tao/ULongSeq.pidl
new file mode 100644
index 00000000000..1c026ceb332
--- /dev/null
+++ b/TAO/tao/ULongSeq.pidl
@@ -0,0 +1,33 @@
+// -*- IDL -*-
+//
+// $Id$
+
+// ================================================================
+/**
+ *
+ * This file was used to generate the code in ULongSeq*.*
+ * The command used to generate code is:
+ *
+ * tao_idl
+ * -o orig -Ge 1 -GA -SS -Sci
+ * -Wb,export_macro=TAO_Export
+ * -Wb,export_include=tao/TAO_Export.h
+ * -Wb,pre_include="ace/pre.h"
+ * -Wb,post_include="ace/post.h"
+ * ULongSeq.pidl
+ *
+ */
+// ================================================================
+
+
+#ifndef TAO_CORBA_ULONG_SEQ_IDL
+#define TAO_CORBA_ULONG_SEQ_IDL
+
+#pragma prefix "omg.org"
+
+module CORBA
+{
+ typedef sequence<unsigned long> ULongSeq;
+};
+
+#endif /* TAO_CORBA_ULONG_SEQ_IDL */
diff --git a/TAO/tao/UShortSeq.pidl b/TAO/tao/UShortSeq.pidl
new file mode 100644
index 00000000000..9a6e6bd9667
--- /dev/null
+++ b/TAO/tao/UShortSeq.pidl
@@ -0,0 +1,33 @@
+// -*- IDL -*-
+//
+// $Id$
+
+// ================================================================
+/**
+ * This file was used to generate the code in UShortSeq*.*
+ * The command used to generate code is:
+ *
+ * tao_idl
+ * -o orig -Ge 1 -GA -SS -Sci
+ * -Wb,export_macro=TAO_Export
+ * -Wb,export_include=tao/TAO_Export.h
+ * -Wb,pre_include="ace/pre.h"
+ * -Wb,post_include="ace/post.h"
+ * UShortSeq.pidl
+ *
+ * Patches for changes to the generated code are available in the
+ * `diffs' directory.
+ */
+// ================================================================
+
+#ifndef TAO_CORBA_USHORT_SEQ_IDL
+#define TAO_CORBA_USHORT_SEQ_IDL
+
+#pragma prefix "omg.org"
+
+module CORBA
+{
+ typedef sequence<unsigned short> UShortSeq;
+};
+
+#endif /* TAO_CORBA_U_SHORT_SEQ_IDL */
diff --git a/TAO/tao/UShortSeqC.cpp b/TAO/tao/UShortSeqC.cpp
new file mode 100644
index 00000000000..53db618d251
--- /dev/null
+++ b/TAO/tao/UShortSeqC.cpp
@@ -0,0 +1,127 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:291
+
+
+#include "tao/UShortSeqC.h"
+#include "tao/CDR.h"
+
+#if defined (__BORLANDC__)
+#pragma option -w-rvl -w-rch -w-ccc -w-aus -w-sig
+#endif /* __BORLANDC__ */
+
+// TAO_IDL - Generated from
+// be\be_visitor_arg_traits.cpp:70
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Arg traits specializations.
+namespace TAO
+{
+}
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_sequence/sequence_cs.cpp:65
+
+#if !defined (_CORBA_USHORTSEQ_CS_)
+#define _CORBA_USHORTSEQ_CS_
+
+CORBA::UShortSeq::UShortSeq (void)
+{}
+
+CORBA::UShortSeq::UShortSeq (
+ CORBA::ULong max
+ )
+ : TAO::unbounded_value_sequence<
+ CORBA::UShort
+ >
+ (max)
+{}
+
+CORBA::UShortSeq::UShortSeq (
+ CORBA::ULong max,
+ CORBA::ULong length,
+ CORBA::UShort * buffer,
+ CORBA::Boolean release
+ )
+ : TAO::unbounded_value_sequence<
+ CORBA::UShort
+ >
+ (max, length, buffer, release)
+{}
+
+CORBA::UShortSeq::UShortSeq (
+ const UShortSeq &seq
+ )
+ : TAO::unbounded_value_sequence<
+ CORBA::UShort
+ >
+ (seq)
+{}
+
+CORBA::UShortSeq::~UShortSeq (void)
+{}
+
+void CORBA::UShortSeq::_tao_any_destructor (
+ void * _tao_void_pointer
+ )
+{
+ UShortSeq * _tao_tmp_pointer =
+ static_cast<UShortSeq *> (_tao_void_pointer);
+ delete _tao_tmp_pointer;
+}
+
+#endif /* end #if !defined */
+
+// TAO_IDL - Generated from
+// be\be_visitor_sequence/cdr_op_cs.cpp:96
+
+#if !defined _TAO_CDR_OP_CORBA_UShortSeq_CPP_
+#define _TAO_CDR_OP_CORBA_UShortSeq_CPP_
+
+CORBA::Boolean operator<< (
+ TAO_OutputCDR &strm,
+ const CORBA::UShortSeq &_tao_sequence
+ )
+{
+ return TAO::marshal_sequence(strm, _tao_sequence);
+}
+
+CORBA::Boolean operator>> (
+ TAO_InputCDR &strm,
+ CORBA::UShortSeq &_tao_sequence
+ )
+{
+ return TAO::demarshal_sequence(strm, _tao_sequence);
+}
+
+#endif /* _TAO_CDR_OP_CORBA_UShortSeq_CPP_ */
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/UShortSeqC.h b/TAO/tao/UShortSeqC.h
new file mode 100644
index 00000000000..6be1c17efae
--- /dev/null
+++ b/TAO/tao/UShortSeqC.h
@@ -0,0 +1,177 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:153
+
+#ifndef _TAO_IDL_ORIG_USHORTSEQC_H_
+#define _TAO_IDL_ORIG_USHORTSEQC_H_
+
+#include /**/ "ace/pre.h"
+
+
+#include "ace/config-all.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/TAO_Export.h"
+#include "tao/ORB.h"
+#include "tao/Environment.h"
+#include "tao/Sequence_T.h"
+#include "tao/Seq_Var_T.h"
+#include "tao/Seq_Out_T.h"
+
+#if defined (TAO_EXPORT_MACRO)
+#undef TAO_EXPORT_MACRO
+#endif
+#define TAO_EXPORT_MACRO TAO_Export
+
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+#if defined (__BORLANDC__)
+#pragma option push -w-rvl -w-rch -w-ccc -w-inl
+#endif /* __BORLANDC__ */
+
+// TAO_IDL - Generated from
+// be\be_visitor_module/module_ch.cpp:48
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace CORBA
+{
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_sequence/sequence_ch.cpp:101
+
+#if !defined (_CORBA_USHORTSEQ_CH_)
+#define _CORBA_USHORTSEQ_CH_
+
+ class UShortSeq;
+
+ typedef
+ TAO_FixedSeq_Var_T<
+ UShortSeq
+ >
+ UShortSeq_var;
+
+ typedef
+ TAO_Seq_Out_T<
+ UShortSeq
+ >
+ UShortSeq_out;
+
+ class TAO_Export UShortSeq
+ : public
+ TAO::unbounded_value_sequence<
+ CORBA::UShort
+ >
+ {
+ public:
+ UShortSeq (void);
+ UShortSeq (CORBA::ULong max);
+ UShortSeq (
+ CORBA::ULong max,
+ CORBA::ULong length,
+ CORBA::UShort* buffer,
+ CORBA::Boolean release = false
+ );
+ UShortSeq (const UShortSeq &);
+ ~UShortSeq (void);
+
+ static void _tao_any_destructor (void *);
+
+ typedef UShortSeq_var _var_type;
+ typedef UShortSeq_out _out_type;
+ };
+
+#endif /* end #if !defined */
+
+// TAO_IDL - Generated from
+// be\be_visitor_module/module_ch.cpp:66
+
+} // module CORBA
+
+// TAO_IDL - Generated from
+// be\be_visitor_traits.cpp:61
+
+// Traits specializations.
+namespace TAO
+{
+}
+
+// Workaround for a Visual Studio .NET bug where this class is not
+// properly imported by an application if typedef'd or subclassed,
+// resulting in 'multiply defined' link errors. The export macro
+// here forces an explicit import by the application. Please see
+// http://support.microsoft.com/default.aspx?scid=kb;en-us;309801
+// The problem stems from use of the type below in DsLogAdmin,
+// but we put the instantiation here because the application will
+// need to see it in *C.h to avoid the error.
+#if defined ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT
+ template class TAO_Export TAO::unbounded_value_sequence<CORBA::UShortSeq>;
+#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT */
+
+// TAO_IDL - Generated from
+// be\be_visitor_sequence/cdr_op_ch.cpp:71
+
+#if !defined _TAO_CDR_OP_CORBA_UShortSeq_H_
+#define _TAO_CDR_OP_CORBA_UShortSeq_H_
+
+TAO_Export CORBA::Boolean operator<< (
+ TAO_OutputCDR &,
+ const CORBA::UShortSeq &
+ );
+TAO_Export CORBA::Boolean operator>> (
+ TAO_InputCDR &,
+ CORBA::UShortSeq &
+ );
+
+#endif /* _TAO_CDR_OP_CORBA_UShortSeq_H_ */
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:955
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#if defined (__BORLANDC__)
+#pragma option pop
+#endif /* __BORLANDC__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* ifndef */
+
+
diff --git a/TAO/tao/UShortSeqS.h b/TAO/tao/UShortSeqS.h
new file mode 100644
index 00000000000..17b1360599e
--- /dev/null
+++ b/TAO/tao/UShortSeqS.h
@@ -0,0 +1,28 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// Skeleton file generation suppressed with command line option -SS
diff --git a/TAO/tao/Unbounded_Array_Allocation_Traits_T.h b/TAO/tao/Unbounded_Array_Allocation_Traits_T.h
new file mode 100644
index 00000000000..283094749ba
--- /dev/null
+++ b/TAO/tao/Unbounded_Array_Allocation_Traits_T.h
@@ -0,0 +1,54 @@
+#ifndef guard_unbounded_array_allocation_traits_hpp
+#define guard_unbounded_array_allocation_traits_hpp
+/**
+ * @file
+ *
+ * @brief Details can be found in the documentation for
+ * TAO::details::generic_sequence
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan
+ */
+
+#include "tao/Basic_Types.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+namespace details
+{
+
+template<typename T, bool dummy>
+struct unbounded_array_allocation_traits
+{
+ typedef T value_type;
+
+ inline static CORBA::ULong default_maximum()
+ {
+ return 0;
+ }
+
+ inline static value_type * default_buffer_allocation()
+ {
+ return 0;
+ }
+
+ inline static value_type * allocbuf(CORBA::ULong maximum)
+ {
+ return new value_type[maximum];
+ }
+
+ inline static void freebuf(value_type * buffer)
+ {
+ delete[] buffer;
+ }
+};
+
+} // namespace details
+} // namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif // guard_unbounded_array_allocation_traits_hpp
diff --git a/TAO/tao/Unbounded_Array_Sequence_T.h b/TAO/tao/Unbounded_Array_Sequence_T.h
new file mode 100644
index 00000000000..ddd971ae18b
--- /dev/null
+++ b/TAO/tao/Unbounded_Array_Sequence_T.h
@@ -0,0 +1,155 @@
+#ifndef guard_unbounded_array_sequence_hpp
+#define guard_unbounded_array_sequence_hpp
+/**
+ * @file
+ *
+ * @brief Implement unbounded sequences for arrays.
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan
+ */
+#include "tao/Unbounded_Array_Allocation_Traits_T.h"
+#include "tao/Generic_Sequence_T.h"
+#include "tao/Array_Traits_T.h"
+#include "tao/SystemException.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+
+template<typename T_array, typename T_slice, typename T_tag>
+class unbounded_array_sequence
+{
+public:
+ typedef T_array * element_type;
+ typedef T_array value_type;
+ typedef T_slice * T_slice_ptr;
+ typedef T_slice * slice_type;
+ typedef T_slice_ptr * const_value_type;
+ typedef value_type & subscript_type;
+ typedef value_type const & const_subscript_type;
+
+ typedef details::unbounded_array_allocation_traits<value_type,true> allocation_traits;
+ typedef TAO_Array_Forany_T<T_array, T_slice, T_tag> forany;
+ typedef details::array_traits <forany> element_traits;
+ typedef details::generic_sequence<value_type, allocation_traits, element_traits> implementation_type;
+
+ inline unbounded_array_sequence()
+ : impl_()
+ {}
+ inline explicit unbounded_array_sequence(CORBA::ULong maximum)
+ : impl_(maximum)
+ {}
+ inline unbounded_array_sequence(
+ CORBA::ULong maximum,
+ CORBA::ULong length,
+ value_type * data,
+ CORBA::Boolean release = false)
+ : impl_(maximum, length, data, release)
+ {}
+ inline CORBA::ULong maximum() const {
+ return impl_.maximum();
+ }
+ inline CORBA::Boolean release() const {
+ return impl_.release();
+ }
+ inline CORBA::ULong length() const {
+ return impl_.length();
+ }
+ inline void length(CORBA::ULong length) {
+ impl_.length(length);
+ }
+ inline value_type const & operator[](CORBA::ULong i) const {
+ return impl_[i];
+ }
+ inline value_type & operator[](CORBA::ULong i) {
+ return impl_[i];
+ }
+ inline void replace(
+ CORBA::ULong maximum,
+ CORBA::ULong length,
+ value_type * data,
+ CORBA::Boolean release = false) {
+ impl_.replace(maximum, length, data, release);
+ }
+ inline value_type const * get_buffer() const {
+ return impl_.get_buffer();
+ }
+ inline value_type * get_buffer(CORBA::Boolean orphan = false) {
+ return impl_.get_buffer(orphan);
+ }
+ inline void swap(unbounded_array_sequence & rhs) throw() {
+ impl_.swap(rhs.impl_);
+ }
+ static value_type * allocbuf(CORBA::ULong maximum) {
+ return implementation_type::allocbuf(maximum);
+ }
+ static void freebuf(value_type * buffer) {
+ implementation_type::freebuf(buffer);
+ }
+
+private:
+ implementation_type impl_;
+};
+}
+
+namespace TAO
+{
+ template <typename stream, typename T_array, typename T_slice, typename T_tag>
+ bool demarshal_sequence(stream & strm, TAO::unbounded_array_sequence<T_array, T_slice, T_tag> & target) {
+ typedef TAO::unbounded_array_sequence<T_array, T_slice, T_tag> sequence;
+ typedef TAO_Array_Forany_T <T_array, T_slice, T_tag> forany;
+ typedef TAO::Array_Traits<forany> array_traits;
+
+ ::CORBA::ULong new_length = 0;
+ if (!(strm >> new_length)) {
+ return false;
+ }
+ if (new_length > strm.length()) {
+ return false;
+ }
+ sequence tmp(new_length);
+ tmp.length(new_length);
+ typename sequence::value_type * buffer = tmp.get_buffer();
+ for(CORBA::ULong i = 0; i < new_length; ++i) {
+ forany tmp (array_traits::alloc ());
+ bool const _tao_marshal_flag = (strm >> tmp);
+ if (_tao_marshal_flag) {
+ array_traits::copy (buffer[i], tmp.in ());
+ }
+ array_traits::free (tmp.inout ());
+ if (!_tao_marshal_flag) {
+ return false;
+ }
+ }
+ tmp.swap(target);
+ return true;
+ }
+
+ template <typename stream, typename T_array, typename T_slice, typename T_tag>
+ bool marshal_sequence(stream & strm, const TAO::unbounded_array_sequence<T_array, T_slice, T_tag> & source) {
+ if (0 == &source)
+ ACE_THROW_RETURN (::CORBA::BAD_PARAM(0, CORBA::COMPLETED_MAYBE), false);
+ typedef TAO_FixedArray_Var_T <T_array, T_slice, T_tag> fixed_array;
+ typedef TAO_Array_Forany_T <T_array, T_slice, T_tag> forany;
+ typedef TAO::Array_Traits<forany> array_traits;
+ ::CORBA::ULong const length = source.length ();
+ if (!(strm << length)) {
+ return false;
+ }
+ for(CORBA::ULong i = 0; i < length; ++i) {
+ fixed_array tmp_array = array_traits::dup (source[i]);
+ forany const tmp (tmp_array.inout ());
+ if (!(strm << tmp)) {
+ return false;
+ }
+ }
+ return true;
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif // guard_unbounded_array_sequence_hpp
diff --git a/TAO/tao/Unbounded_Basic_String_Sequence_T.h b/TAO/tao/Unbounded_Basic_String_Sequence_T.h
new file mode 100644
index 00000000000..79aed91cb64
--- /dev/null
+++ b/TAO/tao/Unbounded_Basic_String_Sequence_T.h
@@ -0,0 +1,112 @@
+#ifndef guard_unbounded_basic_string_sequence_hpp
+#define guard_unbounded_basic_string_sequence_hpp
+/**
+ * @file
+ *
+ * @brief Implement unbounded sequences for strings and wide-strings.
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan
+ */
+#include "tao/Unbounded_Reference_Allocation_Traits_T.h"
+#include "tao/String_Traits_T.h"
+#include "tao/Generic_Sequence_T.h"
+#include "tao/String_Sequence_Element_T.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+namespace details
+{
+
+template<typename charT>
+class unbounded_basic_string_sequence
+{
+public:
+ typedef charT character_type;
+ typedef character_type * value_type;
+ typedef character_type const * const_value_type;
+
+ typedef details::string_traits<character_type,true> element_traits;
+ typedef details::unbounded_reference_allocation_traits<value_type,element_traits,true> allocation_traits;
+
+ typedef details::string_sequence_element<element_traits> element_type;
+
+ typedef details::generic_sequence<value_type, allocation_traits, element_traits> implementation_type;
+
+ typedef element_type subscript_type;
+ typedef const_value_type const_subscript_type;
+
+ inline unbounded_basic_string_sequence()
+ : impl_()
+ {}
+ inline explicit unbounded_basic_string_sequence(CORBA::ULong maximum)
+ : impl_(maximum)
+ {}
+ inline unbounded_basic_string_sequence(
+ CORBA::ULong maximum,
+ CORBA::ULong length,
+ value_type * data,
+ CORBA::Boolean release)
+ : impl_(maximum, length, data, release)
+ {}
+
+ /* Use default ctor, operator= and dtor */
+ inline CORBA::ULong maximum() const {
+ return impl_.maximum();
+ }
+ inline CORBA::Boolean release() const {
+ return impl_.release();
+ }
+ inline CORBA::ULong length() const {
+ return impl_.length();
+ }
+
+ inline void length(CORBA::ULong length) {
+ impl_.length(length);
+ }
+ inline const_value_type operator[](CORBA::ULong i) const {
+ return impl_[i];
+ }
+ inline element_type operator[](CORBA::ULong i) {
+ return element_type(impl_[i], release());
+ }
+ inline const_value_type const * get_buffer() const {
+ return impl_.get_buffer();
+ }
+ inline void replace(
+ CORBA::ULong maximum,
+ CORBA::ULong length,
+ value_type * data,
+ CORBA::Boolean release = false) {
+ impl_.replace(maximum, length, data, release);
+ }
+ inline value_type * get_buffer(CORBA::Boolean orphan = false) {
+ return impl_.get_buffer(orphan);
+ }
+ inline void swap(unbounded_basic_string_sequence & rhs) throw() {
+ impl_.swap(rhs.impl_);
+ }
+
+ static value_type * allocbuf(CORBA::ULong maximum)
+ {
+ return implementation_type::allocbuf(maximum);
+ }
+ static void freebuf(value_type * buffer)
+ {
+ implementation_type::freebuf(buffer);
+ }
+
+
+private:
+ implementation_type impl_;
+};
+
+} // namespace details
+} // namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif // guard_unbounded_basic_string_sequence_hpp
diff --git a/TAO/tao/Unbounded_Object_Reference_Sequence_T.h b/TAO/tao/Unbounded_Object_Reference_Sequence_T.h
new file mode 100644
index 00000000000..37c1b73a251
--- /dev/null
+++ b/TAO/tao/Unbounded_Object_Reference_Sequence_T.h
@@ -0,0 +1,108 @@
+#ifndef guard_unbounded_object_reference_sequence_hpp
+#define guard_unbounded_object_reference_sequence_hpp
+/**
+ * @file
+ *
+ * @brief Implement unbounded sequences for object references.
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan
+ */
+#include "Unbounded_Reference_Allocation_Traits_T.h"
+#include "Object_Reference_Traits_T.h"
+#include "Generic_Sequence_T.h"
+#include "Object_Reference_Sequence_Element_T.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+
+template<typename object_t, typename object_t_var>
+class unbounded_object_reference_sequence
+{
+public:
+ typedef object_t object_type;
+ typedef object_type * value_type;
+ typedef value_type const const_value_type;
+
+ typedef details::object_reference_traits<object_type,object_t_var,true> element_traits;
+ typedef details::unbounded_reference_allocation_traits<value_type,element_traits,true> allocation_traits;
+
+ typedef details::object_reference_sequence_element<element_traits> element_type;
+ typedef element_type subscript_type;
+ typedef value_type const & const_subscript_type;
+
+ typedef details::generic_sequence<value_type, allocation_traits, element_traits> implementation_type;
+
+ inline unbounded_object_reference_sequence()
+ : impl_()
+ {}
+ inline explicit unbounded_object_reference_sequence(CORBA::ULong maximum)
+ : impl_(maximum)
+ {}
+ inline unbounded_object_reference_sequence(
+ CORBA::ULong maximum,
+ CORBA::ULong length,
+ value_type * data,
+ CORBA::Boolean release)
+ : impl_(maximum, length, data, release)
+ {}
+
+ /* Use default ctor, operator= and dtor */
+ inline CORBA::ULong maximum() const {
+ return impl_.maximum();
+ }
+ inline CORBA::Boolean release() const {
+ return impl_.release();
+ }
+ inline CORBA::ULong length() const {
+ return impl_.length();
+ }
+
+ inline void length(CORBA::ULong length) {
+ impl_.length(length);
+ }
+ inline value_type const & operator[](CORBA::ULong i) const {
+ return impl_[i];
+ }
+ inline element_type operator[](CORBA::ULong i) {
+ return element_type(impl_[i], release());
+ }
+ inline value_type const * get_buffer() const {
+ return impl_.get_buffer();
+ }
+ inline void replace(
+ CORBA::ULong maximum,
+ CORBA::ULong length,
+ value_type * data,
+ CORBA::Boolean release = false) {
+ impl_.replace(maximum, length, data, release);
+ }
+ inline value_type * get_buffer(CORBA::Boolean orphan = false) {
+ return impl_.get_buffer(orphan);
+ }
+ inline void swap(unbounded_object_reference_sequence & rhs) throw() {
+ impl_.swap(rhs.impl_);
+ }
+
+ static value_type * allocbuf(CORBA::ULong maximum)
+ {
+ return implementation_type::allocbuf(maximum);
+ }
+ static void freebuf(value_type * buffer)
+ {
+ implementation_type::freebuf(buffer);
+ }
+
+
+private:
+ implementation_type impl_;
+};
+
+} // namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif // guard_unbounded_object_reference_sequence_hpp
diff --git a/TAO/tao/Unbounded_Octet_Sequence_T.h b/TAO/tao/Unbounded_Octet_Sequence_T.h
new file mode 100644
index 00000000000..2c9ae1a86c5
--- /dev/null
+++ b/TAO/tao/Unbounded_Octet_Sequence_T.h
@@ -0,0 +1,365 @@
+#ifndef guard_unbounded_octet_sequence_hpp
+#define guard_unbounded_octet_sequence_hpp
+/**
+ * @file
+ *
+ * @brief Implement octet sequences
+ *
+ * $Id$
+ *
+ * @author Johnny Willemsen
+ */
+#include "tao/orbconf.h"
+
+#include "tao/Unbounded_Value_Sequence_T.h"
+
+#if (TAO_NO_COPY_OCTET_SEQUENCES == 1)
+
+#include "tao/Unbounded_Value_Allocation_Traits_T.h"
+#include "tao/Value_Traits_T.h"
+#include "tao/Range_Checking_T.h"
+
+#include "tao/Basic_Types.h"
+#include "ace/Message_Block.h"
+#include "ace/OS_Memory.h"
+#include "ace/OS_NS_string.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+template<>
+class unbounded_value_sequence<CORBA::Octet>
+{
+public:
+ typedef CORBA::Octet value_type;
+ typedef CORBA::Octet element_type;
+ typedef CORBA::Octet const const_value_type;
+ typedef value_type & subscript_type;
+ typedef value_type const & const_subscript_type;
+
+ typedef details::unbounded_value_allocation_traits<value_type,true> allocation_traits;
+ typedef details::value_traits<value_type,true> element_traits;
+ typedef details::generic_sequence<value_type, allocation_traits, element_traits> implementation_type;
+ typedef details::range_checking<value_type,true> range;
+
+ inline unbounded_value_sequence<CORBA::Octet>()
+ : maximum_ (allocation_traits::default_maximum())
+ , length_ (0)
+ , buffer_ (allocation_traits::default_buffer_allocation())
+ , release_ (true)
+ , mb_ (0)
+ {}
+ inline explicit unbounded_value_sequence<CORBA::Octet>(CORBA::ULong maximum)
+ : maximum_(maximum)
+ , length_(0)
+ , buffer_(allocbuf(maximum_))
+ , release_(true)
+ , mb_ (0)
+ {}
+ inline unbounded_value_sequence<CORBA::Octet>(
+ CORBA::ULong maximum,
+ CORBA::ULong length,
+ value_type * data,
+ CORBA::Boolean release = false)
+ : maximum_ (maximum),
+ length_ (length),
+ buffer_ (data),
+ release_ (release),
+ mb_ (0)
+ {}
+ inline ~unbounded_value_sequence<CORBA::Octet>() {
+ if (mb_)
+ ACE_Message_Block::release (mb_);
+ if (release_)
+ freebuf(buffer_);
+ }
+ /// Create a sequence of octets from a single message block (i.e. it
+ /// ignores any chaining in the meesage block).
+ inline unbounded_value_sequence<CORBA::Octet> (CORBA::ULong length,
+ const ACE_Message_Block* mb)
+ : maximum_ (length)
+ , length_ (length)
+ , buffer_ (reinterpret_cast <CORBA::Octet *>(mb->rd_ptr ()))
+ , release_ (false)
+ , mb_(0) {
+ // Get the message block flags.
+ ACE_Message_Block::Message_Flags const flg = mb->self_flags ();
+
+ // If the DONT_DELETE flag is disabled just a duplicate would
+ // help. If the DONT_DELETE flag is enabled a deep copy is needed as
+ // the contents would be on stack. Just incrementing the ref count
+ // on the stack based data block would only crash the program when
+ // the stack unwinds
+ if (ACE_BIT_DISABLED (flg,
+ ACE_Message_Block::DONT_DELETE))
+ {
+ this->mb_ = ACE_Message_Block::duplicate (mb);
+ }
+ else
+ {
+ // As we are in CORBA mode, all the data blocks would be aligned
+ // on an 8 byte boundary
+ ACE_Message_Block msgb (*mb,
+ ACE_CDR::MAX_ALIGNMENT);
+
+ // Get the base pointer of the incoming message block
+ char *start = ACE_ptr_align_binary (mb->base (),
+ ACE_CDR::MAX_ALIGNMENT);
+
+ // Get the read and write displacements in the incoming stream
+ size_t const rd_pos = mb->rd_ptr () - start;
+ size_t const wr_pos = mb->wr_ptr () - start;
+
+ this->mb_ = ACE_Message_Block::duplicate (&msgb);
+
+ this->mb_->rd_ptr (rd_pos);
+ this->mb_->wr_ptr (wr_pos);
+ }
+ }
+ inline CORBA::ULong maximum() const {
+ return maximum_;
+ }
+ inline CORBA::Boolean release() const {
+ return release_;
+ }
+ inline CORBA::ULong length() const {
+ return length_;
+ }
+ inline void length(CORBA::ULong length) {
+ if (length <= maximum_ || length <= length_)
+ {
+ if (this->mb_ == 0)
+ {
+ if (length_ < length)
+ {
+ // TODO This code does not provide the strong-exception
+ // guarantee, but it does provide the weak-exception
+ // guarantee. The problem would appear when
+ // initialize_range() raises an exception after several
+ // elements have been modified. One could argue that
+ // this problem is irrelevant, as the elements already
+ // modified are unreachable to conforming applications.
+ element_traits::initialize_range(
+ buffer_ + length_, buffer_ + length);
+ }
+ length_ = length;
+ }
+ else
+ {
+ unbounded_value_sequence<CORBA::Octet> tmp(length);
+ tmp.length_ = length;
+ element_traits::copy_range(
+ buffer_, buffer_ + length, tmp.buffer_);
+ swap(tmp);
+ }
+ return;
+ }
+
+ unbounded_value_sequence<CORBA::Octet> tmp(length);
+ tmp.length_ = length;
+ element_traits::copy_range(
+ buffer_, buffer_ + length_, tmp.buffer_);
+ element_traits::initialize_range(
+ tmp.buffer_ + length_, tmp.buffer_ + length);
+ swap(tmp);
+ }
+ inline value_type const & operator[](CORBA::ULong i) const {
+ range::check(i, length_, maximum_, "operator[]() const");
+ return buffer_[i];
+ }
+ inline value_type & operator[](CORBA::ULong i) {
+ range::check(i, length_, maximum_, "operator[]() non-const");
+ return buffer_[i];
+ }
+ inline void replace(
+ CORBA::ULong maximum,
+ CORBA::ULong length,
+ value_type * data,
+ CORBA::Boolean release = false) {
+ unbounded_value_sequence<CORBA::Octet> tmp(maximum, length, data, release);
+ swap(tmp);
+ }
+ inline value_type const * get_buffer() const {
+ if (buffer_ == 0)
+ {
+ buffer_ = allocbuf(maximum_);
+ }
+ return buffer_;
+ }
+ inline value_type * get_buffer(CORBA::Boolean orphan = false) {
+ if (orphan && !release_)
+ {
+ return 0;
+ }
+ if (buffer_ == 0)
+ {
+ buffer_ = allocbuf(maximum_);
+ }
+ if (!orphan)
+ {
+ return buffer_;
+ }
+
+ unbounded_value_sequence<CORBA::Octet> tmp;
+ swap(tmp);
+ tmp.release_ = false;
+
+ return tmp.buffer_;
+ }
+
+ // moved inside the class to resolve namespace lookup issues.
+ // This is a replacement for the commented block below.
+
+ inline bool operator== (const unbounded_value_sequence<CORBA::Octet> & rhs) const
+{
+ ::CORBA::ULong const rlen = rhs.length ();
+
+ if (rlen != this->length ())
+ {
+ return false;
+ }
+
+ for (::CORBA::ULong i = 0; i < rlen; ++i)
+ {
+ if (rhs[i] != this->buffer_[i])
+ {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+ inline bool operator!= (const unbounded_value_sequence<CORBA::Octet> & rhs) const
+{
+ return !this->operator==(rhs);
+}
+
+ inline void swap(unbounded_value_sequence & rhs) throw() {
+ std::swap (mb_, rhs.mb_);
+ std::swap (maximum_, rhs.maximum_);
+ std::swap (length_, rhs.length_);
+ std::swap (buffer_, rhs.buffer_);
+ std::swap (release_, rhs.release_);
+ }
+ static value_type * allocbuf(CORBA::ULong maximum) {
+ return allocation_traits::allocbuf(maximum);
+ }
+ static void freebuf(value_type * buffer) {
+ allocation_traits::freebuf(buffer);
+ }
+
+ /// Returns the underlying message block, the caller must *not*
+ /// release the copy.
+ inline ACE_Message_Block* mb (void) const {
+ return mb_;
+ }
+
+ /// Replaces the current buffer with <mb>, using only <length> bytes.
+ /// It takes a duplicate of <mb> so the user still owns it.
+ inline void replace (CORBA::ULong length, const ACE_Message_Block* mb) {
+ unbounded_value_sequence<CORBA::Octet> s (length, mb);
+ swap (s);
+ }
+
+ unbounded_value_sequence<CORBA::Octet> (
+ const unbounded_value_sequence<CORBA::Octet> &rhs)
+ : maximum_ (0)
+ , length_ (0)
+ , buffer_(0)
+ , release_(false)
+ , mb_ (0)
+ {
+ unbounded_value_sequence<CORBA::Octet> tmp(rhs.maximum_);
+ tmp.length_ = rhs.length_;
+ if (rhs.mb_ == 0)
+ {
+ ACE_OS::memcpy (tmp.buffer_,
+ rhs.buffer_,
+ rhs.length_);
+ }
+ else
+ {
+ size_t offset = 0;
+ for (const ACE_Message_Block *i = rhs.mb_; i != 0; i = i->cont ())
+ {
+ ACE_OS::memcpy (tmp.buffer_ + offset,
+ i->rd_ptr (),
+ i->length ());
+
+ offset += i->length ();
+ }
+ }
+ swap(tmp);
+ }
+
+ unbounded_value_sequence<CORBA::Octet> &
+ operator= (const unbounded_value_sequence<CORBA::Octet> & rhs)
+ {
+ unbounded_value_sequence<CORBA::Octet> tmp(rhs);
+ swap(tmp);
+ return * this;
+ }
+
+private:
+ /// The maximum number of elements the buffer can contain.
+ CORBA::ULong maximum_;
+
+ /// The current number of elements in the buffer.
+ CORBA::ULong length_;
+
+ /// The buffer with all the elements, casting must be done in derived
+ /// classes.
+ mutable value_type * buffer_;
+
+ /// If true then the sequence should release the buffer when it is
+ /// destroyed.
+ CORBA::Boolean release_;
+ ACE_Message_Block* mb_;
+};
+
+} // namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_NO_COPY_OCTET_SEQUENCES == 1 */
+
+#if 0
+// This doesn't work for an unexplained reason. At least
+// PortableServer::Active_Object_Map.cpp fails to compile.
+// But I'm keeping this in for the moment so that it may be
+// resurrected if need be
+inline
+bool
+operator== (const TAO_VERSIONED_NAMESPACE_NAME::TAO::unbounded_value_sequence<CORBA::Octet> & lhs,
+ const TAO_VERSIONED_NAMESPACE_NAME::TAO::unbounded_value_sequence<CORBA::Octet> & rhs)
+{
+ ::CORBA::ULong const rlen = rhs.length ();
+
+ if (rlen != lhs.length ())
+ {
+ return false;
+ }
+
+ for (::CORBA::ULong i = 0; i < rlen; ++i)
+ {
+ if (rhs[i] != lhs[i])
+ {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+inline
+bool
+operator!= (const TAO_VERSIONED_NAMESPACE_NAME::TAO::unbounded_value_sequence<CORBA::Octet> & lhs,
+ const TAO_VERSIONED_NAMESPACE_NAME::TAO::unbounded_value_sequence<CORBA::Octet> & rhs)
+{
+ return !(lhs == rhs);
+}
+#endif /* 0 */
+
+#endif // guard_unbounded_octet_sequence_hpp
diff --git a/TAO/tao/Unbounded_Reference_Allocation_Traits_T.h b/TAO/tao/Unbounded_Reference_Allocation_Traits_T.h
new file mode 100644
index 00000000000..193bcf7c2bc
--- /dev/null
+++ b/TAO/tao/Unbounded_Reference_Allocation_Traits_T.h
@@ -0,0 +1,69 @@
+#ifndef guard_unbounded_reference_allocation_traits_hpp
+#define guard_unbounded_reference_allocation_traits_hpp
+/**
+ * @file
+ *
+ * @brief Details can be found in the documentation for
+ * TAO::details::generic_sequence
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan
+ */
+
+#include "tao/Basic_Types.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+namespace details
+{
+
+template<typename T, class ref_traits, bool dummy>
+struct unbounded_reference_allocation_traits
+{
+ typedef T value_type;
+ typedef ref_traits reference_traits;
+
+ inline static CORBA::ULong default_maximum()
+ {
+ return 0;
+ }
+
+ inline static value_type * default_buffer_allocation()
+ {
+ return 0;
+ }
+
+ inline static value_type * allocbuf(CORBA::ULong maximum)
+ {
+ value_type * buffer = new value_type[maximum + 1];
+ reinterpret_cast<value_type**>(buffer)[0] = buffer + maximum + 1;
+
+ // no throw
+ reference_traits::zero_range(buffer + 1, buffer + maximum + 1);
+
+ return buffer + 1;
+ }
+
+ inline static void freebuf(value_type * buffer)
+ {
+ if(buffer != 0)
+ {
+ value_type * begin = buffer - 1;
+ value_type * end = reinterpret_cast<value_type*>(*begin);
+ reference_traits::release_range(buffer, end);
+
+ buffer = begin;
+ }
+ delete[] buffer;
+ }
+};
+
+} // namespace details
+} // namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif // guard_unbounded_reference_allocation_traits_hpp
diff --git a/TAO/tao/Unbounded_Sequence_CDR_T.h b/TAO/tao/Unbounded_Sequence_CDR_T.h
new file mode 100644
index 00000000000..05384621441
--- /dev/null
+++ b/TAO/tao/Unbounded_Sequence_CDR_T.h
@@ -0,0 +1,571 @@
+#ifndef guard_unbounded_sequence_cdr
+#define guard_unbounded_sequence_cdr
+/**
+ * @file
+ *
+ * @brief Extract the sequence
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan
+ * @author Johnny Willemsen
+ */
+
+#include "tao/orbconf.h"
+#include "tao/SystemException.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO {
+ template <typename stream>
+ bool demarshal_sequence(stream & strm, TAO::unbounded_value_sequence <CORBA::Short> & target) {
+ typedef TAO::unbounded_value_sequence <CORBA::Short> sequence;
+ ::CORBA::ULong new_length = 0;
+ if (!(strm >> new_length)) {
+ return false;
+ }
+ if (new_length > strm.length()) {
+ return false;
+ }
+ sequence tmp(new_length);
+ tmp.length(new_length);
+ typename sequence::value_type * buffer = tmp.get_buffer();
+ if (!strm.read_short_array (buffer, new_length)) {
+ return false;
+ }
+ tmp.swap(target);
+ return true;
+ }
+
+ template <typename stream>
+ bool demarshal_sequence(stream & strm, TAO::unbounded_value_sequence <CORBA::Long> & target) {
+ typedef TAO::unbounded_value_sequence <CORBA::Long> sequence;
+ ::CORBA::ULong new_length = 0;
+ if (!(strm >> new_length)) {
+ return false;
+ }
+ if (new_length > strm.length()) {
+ return false;
+ }
+ sequence tmp(new_length);
+ tmp.length(new_length);
+ typename sequence::value_type * buffer = tmp.get_buffer();
+ if (!strm.read_long_array (buffer, new_length)) {
+ return false;
+ }
+ tmp.swap(target);
+ return true;
+ }
+
+ template <typename stream>
+ bool demarshal_sequence(stream & strm, TAO::unbounded_value_sequence <CORBA::ULong> & target) {
+ typedef TAO::unbounded_value_sequence <CORBA::ULong> sequence;
+ ::CORBA::ULong new_length = 0;
+ if (!(strm >> new_length)) {
+ return false;
+ }
+ if (new_length > strm.length()) {
+ return false;
+ }
+ sequence tmp(new_length);
+ tmp.length(new_length);
+ typename sequence::value_type * buffer = tmp.get_buffer();
+ if (!strm.read_ulong_array (buffer, new_length)) {
+ return false;
+ }
+ tmp.swap(target);
+ return true;
+ }
+
+ template <typename stream>
+ bool demarshal_sequence(stream & strm, TAO::unbounded_value_sequence <CORBA::UShort> & target) {
+ typedef TAO::unbounded_value_sequence <CORBA::UShort> sequence;
+ ::CORBA::ULong new_length = 0;
+ if (!(strm >> new_length)) {
+ return false;
+ }
+ if (new_length > strm.length()) {
+ return false;
+ }
+ sequence tmp(new_length);
+ tmp.length(new_length);
+ typename sequence::value_type * buffer = tmp.get_buffer();
+ if (!strm.read_ushort_array (buffer, new_length)) {
+ return false;
+ }
+ tmp.swap(target);
+ return true;
+ }
+
+#if (TAO_NO_COPY_OCTET_SEQUENCES == 1)
+ template <typename stream>
+ bool demarshal_sequence(stream & strm, TAO::unbounded_value_sequence <CORBA::Octet> & target) {
+ typedef TAO::unbounded_value_sequence <CORBA::Octet> sequence;
+ ::CORBA::ULong new_length = 0;
+ if (!(strm >> new_length)) {
+ return false;
+ }
+ if (new_length > strm.length()) {
+ return false;
+ }
+ sequence tmp(new_length);
+ tmp.length(new_length);
+ if (ACE_BIT_DISABLED (strm.start ()->flags (), ACE_Message_Block::DONT_DELETE))
+ {
+ TAO_ORB_Core* orb_core = strm.orb_core ();
+ if (orb_core != 0 && strm.orb_core ()->resource_factory ()->
+ input_cdr_allocator_type_locked () == 1)
+ {
+ tmp.replace (new_length, strm.start ());
+ tmp.mb ()->wr_ptr (tmp.mb()->rd_ptr () + new_length);
+ strm.skip_bytes (new_length);
+ tmp.swap(target);
+ return true;
+ }
+ }
+ typename sequence::value_type * buffer = tmp.get_buffer();
+ if (!strm.read_octet_array (buffer, new_length)) {
+ return false;
+ }
+ tmp.swap(target);
+ return true;
+ }
+#else
+ template <typename stream>
+ bool demarshal_sequence(stream & strm, TAO::unbounded_value_sequence <CORBA::Octet> & target) {
+ typedef TAO::unbounded_value_sequence <CORBA::Octet> sequence;
+ ::CORBA::ULong new_length = 0;
+ if (!(strm >> new_length)) {
+ return false;
+ }
+ if (new_length > strm.length()) {
+ return false;
+ }
+ sequence tmp(new_length);
+ tmp.length(new_length);
+ typename sequence::value_type * buffer = tmp.get_buffer();
+ if (!strm.read_octet_array (buffer, new_length)) {
+ return false;
+ }
+ tmp.swap(target);
+ return true;
+ }
+#endif
+
+ template <typename stream>
+ bool demarshal_sequence(stream & strm, TAO::unbounded_value_sequence <CORBA::Char> & target) {
+ typedef TAO::unbounded_value_sequence <CORBA::Char> sequence;
+ ::CORBA::ULong new_length = 0;
+ if (!(strm >> new_length)) {
+ return false;
+ }
+ if (new_length > strm.length()) {
+ return false;
+ }
+ sequence tmp(new_length);
+ tmp.length(new_length);
+ typename sequence::value_type * buffer = tmp.get_buffer();
+ if (!strm.read_char_array (buffer, new_length)) {
+ return false;
+ }
+ tmp.swap(target);
+ return true;
+ }
+
+# if defined (ACE_HAS_WCHAR) || defined (ACE_HAS_XPG4_MULTIBYTE_CHAR)
+ template <typename stream>
+ bool demarshal_sequence(stream & strm, TAO::unbounded_value_sequence <CORBA::WChar> & target) {
+ typedef TAO::unbounded_value_sequence <CORBA::WChar> sequence;
+ ::CORBA::ULong new_length = 0;
+ if (!(strm >> new_length)) {
+ return false;
+ }
+ if (new_length > strm.length()) {
+ return false;
+ }
+ sequence tmp(new_length);
+ tmp.length(new_length);
+ typename sequence::value_type * buffer = tmp.get_buffer();
+ if (!strm.read_wchar_array (buffer, new_length)) {
+ return false;
+ }
+ tmp.swap(target);
+ return true;
+ }
+#endif
+
+ template <typename stream>
+ bool demarshal_sequence(stream & strm, TAO::unbounded_value_sequence <CORBA::Float> & target) {
+ typedef TAO::unbounded_value_sequence <CORBA::Float> sequence;
+ ::CORBA::ULong new_length = 0;
+ if (!(strm >> new_length)) {
+ return false;
+ }
+ if (new_length > strm.length()) {
+ return false;
+ }
+ sequence tmp(new_length);
+ tmp.length(new_length);
+ typename sequence::value_type * buffer = tmp.get_buffer();
+ if (!strm.read_float_array (buffer, new_length)) {
+ return false;
+ }
+ tmp.swap(target);
+ return true;
+ }
+
+ template <typename stream>
+ bool demarshal_sequence(stream & strm, TAO::unbounded_value_sequence <CORBA::Double> & target) {
+ typedef TAO::unbounded_value_sequence <CORBA::Double> sequence;
+ ::CORBA::ULong new_length = 0;
+ if (!(strm >> new_length)) {
+ return false;
+ }
+ if (new_length > strm.length()) {
+ return false;
+ }
+ sequence tmp(new_length);
+ tmp.length(new_length);
+ typename sequence::value_type * buffer = tmp.get_buffer();
+ if (!strm.read_double_array (buffer, new_length)) {
+ return false;
+ }
+ tmp.swap(target);
+ return true;
+ }
+
+ template <typename stream>
+ bool demarshal_sequence(stream & strm, TAO::unbounded_value_sequence <CORBA::ULongLong> & target) {
+ typedef TAO::unbounded_value_sequence <CORBA::ULongLong> sequence;
+ ::CORBA::ULong new_length = 0;
+ if (!(strm >> new_length)) {
+ return false;
+ }
+ if (new_length > strm.length()) {
+ return false;
+ }
+ sequence tmp(new_length);
+ tmp.length(new_length);
+ typename sequence::value_type * buffer = tmp.get_buffer();
+ if (!strm.read_ulonglong_array (buffer, new_length)) {
+ return false;
+ }
+ tmp.swap(target);
+ return true;
+ }
+
+ template <typename stream>
+ bool demarshal_sequence(stream & strm, TAO::unbounded_value_sequence <CORBA::LongDouble> & target) {
+ typedef TAO::unbounded_value_sequence <CORBA::LongDouble> sequence;
+ ::CORBA::ULong new_length = 0;
+ if (!(strm >> new_length)) {
+ return false;
+ }
+ if (new_length > strm.length()) {
+ return false;
+ }
+ sequence tmp(new_length);
+ tmp.length(new_length);
+ typename sequence::value_type * buffer = tmp.get_buffer();
+ if (!strm.read_longdouble_array (buffer, new_length)) {
+ return false;
+ }
+ tmp.swap(target);
+ return true;
+ }
+
+ template <typename stream>
+ bool demarshal_sequence(stream & strm, TAO::unbounded_value_sequence <CORBA::Boolean> & target) {
+ typedef TAO::unbounded_value_sequence <CORBA::Boolean> sequence;
+ ::CORBA::ULong new_length = 0;
+ if (!(strm >> new_length)) {
+ return false;
+ }
+ if (new_length > strm.length()) {
+ return false;
+ }
+ sequence tmp(new_length);
+ tmp.length(new_length);
+ typename sequence::value_type * buffer = tmp.get_buffer();
+ if (!strm.read_boolean_array (buffer, new_length)) {
+ return false;
+ }
+ tmp.swap(target);
+ return true;
+ }
+
+ template <typename stream, typename value_t>
+ bool demarshal_sequence(stream & strm, TAO::unbounded_value_sequence <value_t> & target) {
+ typedef TAO::unbounded_value_sequence <value_t> sequence;
+ ::CORBA::ULong new_length = 0;
+ if (!(strm >> new_length)) {
+ return false;
+ }
+ if (new_length > strm.length()) {
+ return false;
+ }
+ sequence tmp(new_length);
+ tmp.length(new_length);
+ typename sequence::value_type * buffer = tmp.get_buffer();
+ for(CORBA::ULong i = 0; i < new_length; ++i) {
+ if (!(strm >> buffer[i])) {
+ return false;
+ }
+ }
+ tmp.swap(target);
+ return true;
+ }
+
+ template <typename stream, typename charT>
+ bool demarshal_sequence(stream & strm, TAO::details::unbounded_basic_string_sequence <charT> & target) {
+ typedef TAO::details::unbounded_basic_string_sequence <charT> sequence;
+ typedef typename sequence::element_traits::string_var string_var;
+ ::CORBA::ULong new_length = 0;
+ if (!(strm >> new_length)) {
+ return false;
+ }
+ if (new_length > strm.length()) {
+ return false;
+ }
+ sequence tmp(new_length);
+ tmp.length(new_length);
+ for(CORBA::ULong i = 0; i < new_length; ++i) {
+ string_var string;
+ if (!(strm >> string.inout ())) {
+ return false;
+ }
+ else {
+ tmp[i] = string._retn ();
+ }
+ }
+ tmp.swap(target);
+ return true;
+ }
+
+ template <typename stream, typename object_t, typename object_t_var>
+ bool demarshal_sequence(stream & strm, TAO::unbounded_object_reference_sequence<object_t, object_t_var> & target) {
+ typedef TAO::unbounded_object_reference_sequence<object_t, object_t_var> sequence;
+ ::CORBA::ULong new_length = 0;
+ if (!(strm >> new_length)) {
+ return false;
+ }
+ if (new_length > strm.length()) {
+ return false;
+ }
+ sequence tmp(new_length);
+ tmp.length(new_length);
+ typename sequence::value_type * buffer = tmp.get_buffer();
+ for(CORBA::ULong i = 0; i < new_length; ++i) {
+ if (!(strm >> buffer[i])) {
+ return false;
+ }
+ }
+ tmp.swap(target);
+ return true;
+ }
+}
+
+namespace TAO {
+ template <typename stream>
+ bool marshal_sequence(stream & strm, const TAO::unbounded_value_sequence <CORBA::Short> & source) {
+ if (0 == &source)
+ ACE_THROW_RETURN (::CORBA::BAD_PARAM(0, CORBA::COMPLETED_MAYBE), false);
+ ::CORBA::ULong const length = source.length ();
+ if (!(strm << length)) {
+ return false;
+ }
+ return strm.write_short_array (source.get_buffer (), length);
+ }
+
+ template <typename stream>
+ bool marshal_sequence(stream & strm, const TAO::unbounded_value_sequence <CORBA::Long> & source) {
+ if (0 == &source)
+ ACE_THROW_RETURN (::CORBA::BAD_PARAM(0, CORBA::COMPLETED_MAYBE), false);
+ ::CORBA::ULong const length = source.length ();
+ if (!(strm << length)) {
+ return false;
+ }
+ return strm.write_long_array (source.get_buffer (), length);
+ }
+
+ template <typename stream>
+ bool marshal_sequence(stream & strm, const TAO::unbounded_value_sequence <CORBA::ULong> & source) {
+ if (0 == &source)
+ ACE_THROW_RETURN (::CORBA::BAD_PARAM(0, CORBA::COMPLETED_MAYBE), false);
+ ::CORBA::ULong const length = source.length ();
+ if (!(strm << length)) {
+ return false;
+ }
+ return strm.write_ulong_array (source.get_buffer (), length);
+ }
+
+ template <typename stream>
+ bool marshal_sequence(stream & strm, const TAO::unbounded_value_sequence <CORBA::UShort> & source) {
+ if (0 == &source)
+ ACE_THROW_RETURN (::CORBA::BAD_PARAM(0, CORBA::COMPLETED_MAYBE), false);
+ ::CORBA::ULong const length = source.length ();
+ if (!(strm << length)) {
+ return false;
+ }
+ return strm.write_ushort_array (source.get_buffer (), length);
+ }
+
+#if (TAO_NO_COPY_OCTET_SEQUENCES == 1)
+ template <typename stream>
+ bool marshal_sequence(stream & strm, const TAO::unbounded_value_sequence <CORBA::Octet> & source) {
+ if (0 == &source)
+ ACE_THROW_RETURN (::CORBA::BAD_PARAM(0, CORBA::COMPLETED_MAYBE), false);
+ ::CORBA::ULong const length = source.length ();
+ if (!(strm << length)) {
+ return false;
+ }
+ if (source.mb ()) {
+ return strm.write_octet_array_mb (source.mb ());
+ }
+ return strm.write_octet_array (source.get_buffer (), length);
+ }
+#else
+ template <typename stream>
+ bool marshal_sequence(stream & strm, const TAO::unbounded_value_sequence <CORBA::Octet> & source) {
+ if (0 == &source)
+ ACE_THROW_RETURN (::CORBA::BAD_PARAM(0, CORBA::COMPLETED_MAYBE), false);
+ ::CORBA::ULong const length = source.length ();
+ if (!(strm << length)) {
+ return false;
+ }
+ return strm.write_octet_array (source.get_buffer (), length);
+ }
+#endif
+
+ template <typename stream>
+ bool marshal_sequence(stream & strm, const TAO::unbounded_value_sequence <CORBA::Char> & source) {
+ if (0 == &source)
+ ACE_THROW_RETURN (::CORBA::BAD_PARAM(0, CORBA::COMPLETED_MAYBE), false);
+ ::CORBA::ULong const length = source.length ();
+ if (!(strm << length)) {
+ return false;
+ }
+ return strm.write_char_array (source.get_buffer (), length);
+ }
+
+# if defined (ACE_HAS_WCHAR) || defined (ACE_HAS_XPG4_MULTIBYTE_CHAR)
+ template <typename stream>
+ bool marshal_sequence(stream & strm, const TAO::unbounded_value_sequence <CORBA::WChar> & source) {
+ if (0 == &source)
+ ACE_THROW_RETURN (::CORBA::BAD_PARAM(0, CORBA::COMPLETED_MAYBE), false);
+ ::CORBA::ULong const length = source.length ();
+ if (!(strm << length)) {
+ return false;
+ }
+ return strm.write_wchar_array (source.get_buffer (), length);
+ }
+#endif
+
+ template <typename stream>
+ bool marshal_sequence(stream & strm, const TAO::unbounded_value_sequence <CORBA::Float> & source) {
+ if (0 == &source)
+ ACE_THROW_RETURN (::CORBA::BAD_PARAM(0, CORBA::COMPLETED_MAYBE), false);
+ ::CORBA::ULong const length = source.length ();
+ if (!(strm << length)) {
+ return false;
+ }
+ return strm.write_float_array (source.get_buffer (), length);
+ }
+
+ template <typename stream>
+ bool marshal_sequence(stream & strm, const TAO::unbounded_value_sequence <CORBA::Double> & source) {
+ if (0 == &source)
+ ACE_THROW_RETURN (::CORBA::BAD_PARAM(0, CORBA::COMPLETED_MAYBE), false);
+ ::CORBA::ULong const length = source.length ();
+ if (!(strm << length)) {
+ return false;
+ }
+ return strm.write_double_array (source.get_buffer (), length);
+ }
+
+ template <typename stream>
+ bool marshal_sequence(stream & strm, const TAO::unbounded_value_sequence <CORBA::ULongLong> & source) {
+ if (0 == &source)
+ ACE_THROW_RETURN (::CORBA::BAD_PARAM(0, CORBA::COMPLETED_MAYBE), false);
+ ::CORBA::ULong const length = source.length ();
+ if (!(strm << length)) {
+ return false;
+ }
+ return strm.write_ulonglong_array (source.get_buffer (), length);
+ }
+
+ template <typename stream>
+ bool marshal_sequence(stream & strm, const TAO::unbounded_value_sequence <CORBA::LongDouble> & source) {
+ if (0 == &source)
+ ACE_THROW_RETURN (::CORBA::BAD_PARAM(0, CORBA::COMPLETED_MAYBE), false);
+ ::CORBA::ULong const length = source.length ();
+ if (!(strm << length)) {
+ return false;
+ }
+ return strm.write_longdouble_array (source.get_buffer (), length);
+ }
+
+ template <typename stream>
+ bool marshal_sequence(stream & strm, const TAO::unbounded_value_sequence <CORBA::Boolean> & source) {
+ if (0 == &source)
+ ACE_THROW_RETURN (::CORBA::BAD_PARAM(0, CORBA::COMPLETED_MAYBE), false);
+ ::CORBA::ULong const length = source.length ();
+ if (!(strm << length)) {
+ return false;
+ }
+ return strm.write_boolean_array (source.get_buffer (), length);
+ }
+
+ template <typename stream, typename value_t>
+ bool marshal_sequence(stream & strm, const TAO::unbounded_value_sequence <value_t> & source) {
+ if (0 == &source)
+ ACE_THROW_RETURN (::CORBA::BAD_PARAM(0, CORBA::COMPLETED_MAYBE), false);
+ ::CORBA::ULong const length = source.length ();
+ if (!(strm << length)) {
+ return false;
+ }
+ for(CORBA::ULong i = 0; i < length; ++i) {
+ if (!(strm << source[i])) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ template <typename stream, typename charT>
+ bool marshal_sequence(stream & strm, const TAO::details::unbounded_basic_string_sequence <charT> & source) {
+ if (0 == &source)
+ ACE_THROW_RETURN (::CORBA::BAD_PARAM(0, CORBA::COMPLETED_MAYBE), false);
+ ::CORBA::ULong const length = source.length ();
+ if (!(strm << length)) {
+ return false;
+ }
+ for(CORBA::ULong i = 0; i < length; ++i) {
+ if (!(strm << source[i])) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ template <typename stream, typename object_t, typename object_t_var>
+ bool marshal_sequence(stream & strm, const TAO::unbounded_object_reference_sequence<object_t, object_t_var> & source) {
+ typedef typename TAO::unbounded_object_reference_sequence<object_t, object_t_var>::object_type objec_t;
+ if (0 == &source)
+ ACE_THROW_RETURN (::CORBA::BAD_PARAM(0, CORBA::COMPLETED_MAYBE), false);
+ ::CORBA::ULong const length = source.length ();
+ if (!(strm << length)) {
+ return false;
+ }
+ for(CORBA::ULong i = 0; i < length; ++i) {
+ if (!TAO::Objref_Traits<objec_t>::marshal (source[i], strm)) {
+ return false;
+ }
+ }
+ return true;
+ }
+} // namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* guard_unbounded_sequence_cdr */
diff --git a/TAO/tao/Unbounded_String_Sequence_T.h b/TAO/tao/Unbounded_String_Sequence_T.h
new file mode 100644
index 00000000000..9b126308dcd
--- /dev/null
+++ b/TAO/tao/Unbounded_String_Sequence_T.h
@@ -0,0 +1,43 @@
+#ifndef guard_unbounded_string_sequence_hpp
+#define guard_unbounded_string_sequence_hpp
+/**
+ * @file
+ *
+ * @brief Implement unbounded sequences for strings.
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan
+ */
+#include "tao/Unbounded_Basic_String_Sequence_T.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+
+class unbounded_string_sequence
+ : public details::unbounded_basic_string_sequence<char>
+{
+public:
+ inline unbounded_string_sequence()
+ : details::unbounded_basic_string_sequence<char>()
+ {}
+ inline explicit unbounded_string_sequence(CORBA::ULong maximum)
+ : details::unbounded_basic_string_sequence<char>(maximum)
+ {}
+ inline unbounded_string_sequence(
+ CORBA::ULong maximum,
+ CORBA::ULong length,
+ value_type * data,
+ CORBA::Boolean release = false)
+ : details::unbounded_basic_string_sequence<char>(
+ maximum, length, data, release)
+ {}
+};
+
+} // namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif // guard_unbounded_string_sequence_hpp
diff --git a/TAO/tao/Unbounded_Value_Allocation_Traits_T.h b/TAO/tao/Unbounded_Value_Allocation_Traits_T.h
new file mode 100644
index 00000000000..e435d0f1fbc
--- /dev/null
+++ b/TAO/tao/Unbounded_Value_Allocation_Traits_T.h
@@ -0,0 +1,54 @@
+#ifndef guard_unbounded_value_allocation_traits_hpp
+#define guard_unbounded_value_allocation_traits_hpp
+/**
+ * @file
+ *
+ * @brief Details can be found in the documentation for
+ * TAO::details::generic_sequence
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan
+ */
+
+#include "tao/Basic_Types.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+namespace details
+{
+
+template<typename T, bool dummy>
+struct unbounded_value_allocation_traits
+{
+ typedef T value_type;
+
+ inline static CORBA::ULong default_maximum()
+ {
+ return 0;
+ }
+
+ inline static value_type * default_buffer_allocation()
+ {
+ return 0;
+ }
+
+ inline static value_type * allocbuf(CORBA::ULong maximum)
+ {
+ return new value_type[maximum];
+ }
+
+ inline static void freebuf(value_type * buffer)
+ {
+ delete[] buffer;
+ }
+};
+
+} // namespace details
+} // namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif // guard_unbounded_value_allocation_traits_hpp
diff --git a/TAO/tao/Unbounded_Value_Sequence_T.h b/TAO/tao/Unbounded_Value_Sequence_T.h
new file mode 100644
index 00000000000..e39893e1f5c
--- /dev/null
+++ b/TAO/tao/Unbounded_Value_Sequence_T.h
@@ -0,0 +1,101 @@
+#ifndef guard_unbounded_value_sequence_hpp
+#define guard_unbounded_value_sequence_hpp
+/**
+ * @file
+ *
+ * @brief Implement unbounded sequences for types with value-like
+ * semantics.
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan
+ */
+
+#include "tao/Unbounded_Value_Allocation_Traits_T.h"
+#include "tao/Value_Traits_T.h"
+#include "tao/Generic_Sequence_T.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+
+template<class T>
+class unbounded_value_sequence
+{
+public:
+ typedef T value_type;
+ typedef T element_type;
+ typedef T const const_value_type;
+ typedef value_type & subscript_type;
+ typedef value_type const & const_subscript_type;
+
+ typedef details::unbounded_value_allocation_traits<value_type,true> allocation_traits;
+ typedef details::value_traits<value_type,true> element_traits;
+ typedef details::generic_sequence<value_type, allocation_traits, element_traits> implementation_type;
+
+ inline unbounded_value_sequence()
+ : impl_()
+ {}
+ inline explicit unbounded_value_sequence(CORBA::ULong maximum)
+ : impl_(maximum)
+ {}
+ inline unbounded_value_sequence(
+ CORBA::ULong maximum,
+ CORBA::ULong length,
+ value_type * data,
+ CORBA::Boolean release = false)
+ : impl_(maximum, length, data, release)
+ {}
+ /* Use default ctor, operator= and dtor */
+ inline CORBA::ULong maximum() const {
+ return impl_.maximum();
+ }
+ inline CORBA::Boolean release() const {
+ return impl_.release();
+ }
+ inline CORBA::ULong length() const {
+ return impl_.length();
+ }
+ inline void length(CORBA::ULong length) {
+ impl_.length(length);
+ }
+ inline value_type const & operator[](CORBA::ULong i) const {
+ return impl_[i];
+ }
+ inline value_type & operator[](CORBA::ULong i) {
+ return impl_[i];
+ }
+ inline void replace(
+ CORBA::ULong maximum,
+ CORBA::ULong length,
+ value_type * data,
+ CORBA::Boolean release = false) {
+ impl_.replace(maximum, length, data, release);
+ }
+ inline value_type const * get_buffer() const {
+ return impl_.get_buffer();
+ }
+ inline value_type * get_buffer(CORBA::Boolean orphan = false) {
+ return impl_.get_buffer(orphan);
+ }
+ inline void swap(unbounded_value_sequence & rhs) throw() {
+ impl_.swap(rhs.impl_);
+ }
+ static value_type * allocbuf(CORBA::ULong maximum) {
+ return implementation_type::allocbuf(maximum);
+ }
+ static void freebuf(value_type * buffer) {
+ implementation_type::freebuf(buffer);
+ }
+
+private:
+ implementation_type impl_;
+};
+
+} // namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif // guard_unbounded_string_sequence_hpp
+
diff --git a/TAO/tao/Unbounded_Wstring_Sequence_T.h b/TAO/tao/Unbounded_Wstring_Sequence_T.h
new file mode 100644
index 00000000000..fe8bd1d14b2
--- /dev/null
+++ b/TAO/tao/Unbounded_Wstring_Sequence_T.h
@@ -0,0 +1,43 @@
+#ifndef guard_unbounded_wstring_sequence_hpp
+#define guard_unbounded_wstring_sequence_hpp
+/**
+ * @file
+ *
+ * @brief Implement unbounded sequences for wide strings.
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan
+ */
+#include "tao/Unbounded_Basic_String_Sequence_T.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+
+class unbounded_wstring_sequence
+ : public details::unbounded_basic_string_sequence<CORBA::WChar>
+{
+public:
+ inline unbounded_wstring_sequence()
+ : details::unbounded_basic_string_sequence<CORBA::WChar>()
+ {}
+ inline /* explicit */ unbounded_wstring_sequence(CORBA::ULong maximum)
+ : details::unbounded_basic_string_sequence<CORBA::WChar>(maximum)
+ {}
+ inline unbounded_wstring_sequence(
+ CORBA::ULong maximum,
+ CORBA::ULong length,
+ value_type * data,
+ CORBA::Boolean release = false)
+ : details::unbounded_basic_string_sequence<CORBA::WChar>(
+ maximum, length, data, release)
+ {}
+};
+
+} // namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif // guard_unbounded_wstring_sequence_hpp
diff --git a/TAO/tao/UserException.cpp b/TAO/tao/UserException.cpp
new file mode 100644
index 00000000000..638f895b362
--- /dev/null
+++ b/TAO/tao/UserException.cpp
@@ -0,0 +1,50 @@
+// $Id$
+
+#include "tao/UserException.h"
+
+#include "ace/SString.h"
+#include "ace/OS_NS_string.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/UserException.inl"
+#endif /* __ACE_INLINE__ */
+
+ACE_RCSID (tao,
+ UserException,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Virtual. Do not inline.
+CORBA::UserException::~UserException (void)
+{
+}
+
+CORBA::UserException &
+CORBA::UserException::operator= (CORBA::UserException const & rhs)
+{
+ this->Exception::operator= (rhs);
+ return *this;
+}
+
+// Virtual. Do not inline.
+CORBA::TypeCode_ptr
+CORBA::UserException::_tao_type (void) const
+{
+ return 0;
+}
+
+ACE_CString
+CORBA::UserException::_info (void) const
+{
+ // @@ we can use the exception's typecode to dump all the data held
+ // within it ...
+
+ ACE_CString user_exception_info = "user exception, ID '";
+ user_exception_info += this->_rep_id ();
+ user_exception_info += "'";
+ return user_exception_info;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/UserException.h b/TAO/tao/UserException.h
new file mode 100644
index 00000000000..9fef2c2ea16
--- /dev/null
+++ b/TAO/tao/UserException.h
@@ -0,0 +1,90 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file UserException.h
+ *
+ * $Id$
+ *
+ * CORBA::UserException class header.
+ *
+ * @author DOC Group at Vanderbilt U, Wash U, and UCI
+ * @author Ossama Othman <ossama@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_USER_EXCEPTION_H
+#define TAO_USER_EXCEPTION_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/TAO_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Exception.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace CORBA
+{
+ /**
+ * @class UserException
+ *
+ * @brief Application- or OMG- defined CORBA exception sub-class.
+ *
+ * User exceptions can be defined in application OMG IDL or by the
+ * OMG itself for IDL interfaces and services it defines.
+ */
+ class TAO_Export UserException : public Exception
+ {
+ public:
+
+ /// Copy constructor.
+ UserException (UserException const & rhs);
+
+ /// Destructor.
+ virtual ~UserException (void);
+
+ /// Assignment operator.
+ UserException & operator= (UserException const & rhs);
+
+ /// The narrow operation.
+ static UserException * _downcast (CORBA::Exception * exception);
+
+ /// The const version of narrow operation
+ static const UserException * _downcast (
+ CORBA::Exception const * exception);
+
+ virtual void _raise (void) const = 0;
+
+ virtual CORBA::TypeCode_ptr _tao_type (void) const;
+
+ // = TAO specific extension.
+
+ /// Constructor from a repository id.
+ UserException (char const * repository_id,
+ char const * local_name);
+
+ /// Returns a string containing information about the exception. This
+ /// function is not CORBA compliant.
+ virtual ACE_CString _info (void) const;
+
+ protected:
+ /// Default constructor.
+ UserException (void);
+ };
+
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/UserException.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/"ace/post.h"
+
+#endif /* TAO_USER_EXCEPTION_H */
diff --git a/TAO/tao/UserException.inl b/TAO/tao/UserException.inl
new file mode 100644
index 00000000000..0e1d3295264
--- /dev/null
+++ b/TAO/tao/UserException.inl
@@ -0,0 +1,38 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+CORBA::UserException::UserException (void)
+{
+}
+
+ACE_INLINE
+CORBA::UserException::UserException (char const * repository_id,
+ char const * local_name)
+ : CORBA::Exception (repository_id,
+ local_name)
+{
+}
+
+ACE_INLINE
+CORBA::UserException::UserException (CORBA::UserException const & rhs)
+ : CORBA::Exception (rhs)
+{
+}
+
+ACE_INLINE CORBA::UserException *
+CORBA::UserException::_downcast (CORBA::Exception * exception)
+{
+ return dynamic_cast<CORBA::UserException *> (exception);
+}
+
+ACE_INLINE const CORBA::UserException *
+CORBA::UserException::_downcast (CORBA::Exception const * exception)
+{
+ return dynamic_cast<const CORBA::UserException *> (exception);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Utils.mpc b/TAO/tao/Utils.mpc
new file mode 100644
index 00000000000..d5f8308c9a6
--- /dev/null
+++ b/TAO/tao/Utils.mpc
@@ -0,0 +1,35 @@
+// $Id$
+project : taolib, core, portableserver, pi {
+ sharedname = TAO_Utils
+ dynamicflags = TAO_UTILS_BUILD_DLL
+
+ Source_Files {
+ Utils
+ }
+
+ Header_Files {
+ Utils
+ }
+
+ Inline_Files {
+ Utils
+ }
+
+ Template_Files {
+ Utils
+ }
+
+ Resource_Files {
+ Utils
+ }
+
+ PIDL_Files {
+ }
+
+ IDL_Files {
+ }
+
+ Pkgconfig_Files {
+ TAO_Utils.pc.in
+ }
+}
diff --git a/TAO/tao/Utils/Auto_Functor.h b/TAO/tao/Utils/Auto_Functor.h
new file mode 100644
index 00000000000..321938bd4b7
--- /dev/null
+++ b/TAO/tao/Utils/Auto_Functor.h
@@ -0,0 +1,34 @@
+// -*- C++ -*-
+//=============================================================================
+/**
+ * @file Auto_Functor.h
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan <coryan@atdesk.com>
+ */
+//=============================================================================
+#ifndef TAO_UTILS_AUTO_FUNCTOR_H
+#define TAO_UTILS_AUTO_FUNCTOR_H
+#include /**/ "ace/pre.h"
+
+#include "ace/config-all.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/Auto_Functor.h"
+
+namespace TAO
+{
+ namespace Utils
+ {
+
+ using namespace ACE_Utils;
+
+ }
+}
+
+#include /**/ "ace/post.h"
+#endif /* TAO_UTILS_AUTO_FUNCTOR_H */
diff --git a/TAO/tao/Utils/Encodable.cpp b/TAO/tao/Utils/Encodable.cpp
new file mode 100644
index 00000000000..c9c484f549c
--- /dev/null
+++ b/TAO/tao/Utils/Encodable.cpp
@@ -0,0 +1,11 @@
+// $Id$
+
+#include "tao/Utils/Encodable.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Encodable::~TAO_Encodable (void)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Utils/Encodable.h b/TAO/tao/Utils/Encodable.h
new file mode 100644
index 00000000000..15afe05370f
--- /dev/null
+++ b/TAO/tao/Utils/Encodable.h
@@ -0,0 +1,62 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Encodable.h
+ *
+ * $Id$
+ *
+ * Defines the interface for classes that wish to be
+ * encodable/decodable into/from a CDR representation.
+ *
+ * @author Angelo Corsaro <corsaro@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_ENCODABLE_H_
+#define TAO_ENCODABLE_H_
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Basic_Types.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Utils/utils_export.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_OutputCDR;
+class TAO_InputCDR;
+
+/**
+ * @class TAO_Encodable
+ *
+ * @brief TAO_Encodable Interface
+ *
+ * This interface should be inherited by classes that wish to be
+ * encoded/decoded into/from a CDR stream. Implementation of the
+ * streaming methods is deferred to the subclasses.
+ */
+class TAO_UTILS_Export TAO_Encodable
+{
+public:
+
+ virtual ~TAO_Encodable (void);
+
+ /// Encodes the object implementing this method into a CDR stream.
+ /// Returns true on success and false on failure.
+ virtual CORBA::Boolean _tao_encode (TAO_OutputCDR &out_cdr) = 0;
+
+ /// Decodes the object implementing this method from a CDR stream.
+ /// Returns true on success and false on failure.
+ virtual CORBA::Boolean _tao_decode (TAO_InputCDR &in_cdr) = 0;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_ENCODABLE_H_ */
diff --git a/TAO/tao/Utils/Implicit_Deactivator.cpp b/TAO/tao/Utils/Implicit_Deactivator.cpp
new file mode 100644
index 00000000000..9e0fb6444f9
--- /dev/null
+++ b/TAO/tao/Utils/Implicit_Deactivator.cpp
@@ -0,0 +1,38 @@
+#include "tao/Utils/Implicit_Deactivator.h"
+#include "tao/PortableServer/Servant_Base.h"
+
+ACE_RCSID (Utils,
+ Implicit_Deactivator,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+void
+TAO::Utils::Implicit_Deactivation_Functor::operator () (
+ PortableServer::ServantBase * servant)
+ ACE_THROW_SPEC (())
+{
+ ACE_DECLARE_NEW_CORBA_ENV;
+
+ ACE_TRY
+ {
+ PortableServer::POA_var poa (servant->_default_POA (
+ ACE_ENV_SINGLE_ARG_PARAMETER));
+ ACE_TRY_CHECK;
+
+ PortableServer::ObjectId_var id (poa->servant_to_id (servant
+ ACE_ENV_ARG_PARAMETER));
+ ACE_TRY_CHECK;
+
+ poa->deactivate_object (id.in()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHALL
+ {
+ // @@ Cannot let exceptions escape, yet we need to log them!
+ }
+ ACE_ENDTRY;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Utils/Implicit_Deactivator.h b/TAO/tao/Utils/Implicit_Deactivator.h
new file mode 100644
index 00000000000..68077296726
--- /dev/null
+++ b/TAO/tao/Utils/Implicit_Deactivator.h
@@ -0,0 +1,63 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Implicit_Deactivator.h
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan <coryan@atdesk.com>
+ */
+//=============================================================================
+#ifndef TAO_UTILS_IMPLICIT_DEACTIVATOR_H
+#define TAO_UTILS_IMPLICIT_DEACTIVATOR_H
+#include /**/ "ace/pre.h"
+#include "tao/Utils/utils_export.h"
+
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PortableServer/PortableServer.h"
+#include "ace/Auto_Functor.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Utils
+ {
+
+ /**
+ * @struct Implicit_Deactivation_Functor
+ *
+ * @brief Implements a functor for the Implicit_Deactivator class.
+ */
+ struct TAO_UTILS_Export Implicit_Deactivation_Functor
+ {
+ typedef PortableServer::ServantBase * argument;
+
+ // Deactivate an implicitly activated servant
+ void operator() (PortableServer::ServantBase * servant)
+ ACE_THROW_SPEC (());
+ };
+
+ /**
+ * @class Implicit_Deactivator
+ *
+ * @brief Helper class to deactivate implicitly activated servants.
+ *
+ */
+ typedef ACE_Utils::Auto_Functor<
+ PortableServer::ServantBase,
+ Implicit_Deactivation_Functor>
+ Implicit_Deactivator;
+
+ } // namespace Utils
+} // namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /*TAO_UTILS_IMPLICIT_DEACTIVATOR_H*/
diff --git a/TAO/tao/Utils/ORB_Destroyer.cpp b/TAO/tao/Utils/ORB_Destroyer.cpp
new file mode 100644
index 00000000000..8b8a74220ff
--- /dev/null
+++ b/TAO/tao/Utils/ORB_Destroyer.cpp
@@ -0,0 +1,27 @@
+#include "tao/Utils/ORB_Destroyer.h"
+
+
+ACE_RCSID (Utils,
+ ORB_Destroyer,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+void
+TAO::Utils::ORB_Destroyer_Functor::operator() (CORBA::ORB_ptr orb)
+ ACE_THROW_SPEC (())
+{
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ orb->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHALL
+ {
+ // @@ Cannot let exceptions escape, yet we need to log them!
+ }
+ ACE_ENDTRY;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Utils/ORB_Destroyer.h b/TAO/tao/Utils/ORB_Destroyer.h
new file mode 100644
index 00000000000..920ba64d3e5
--- /dev/null
+++ b/TAO/tao/Utils/ORB_Destroyer.h
@@ -0,0 +1,62 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file ORB_Destroyer.h
+ *
+ * $Id$
+ *
+ * @author Marina Spivak <marina@atdesk.com>
+ */
+//=============================================================================
+#ifndef TAO_UTILS_ORB_DESTROYER_H
+#define TAO_UTILS_ORB_DESTROYER_H
+#include /**/ "ace/pre.h"
+#include "tao/Utils/utils_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/ORB.h"
+#include "ace/Auto_Functor.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Utils
+ {
+
+ /**
+ * @struct ORB_Destroyer_Functor
+ *
+ * @brief Implements a functor for the ORB_Destroyer class.
+ */
+ struct TAO_UTILS_Export ORB_Destroyer_Functor
+ {
+ typedef CORBA::ORB_ptr argument;
+
+ /// Destroy the ORB
+ void operator() (CORBA::ORB_ptr orb)
+ ACE_THROW_SPEC (());
+ };
+
+ /**
+ * @class ORB_Destroyer
+ *
+ * @brief Helper class to destroy an ORB.
+ *
+ */
+ typedef ACE_Utils::Auto_Functor<
+ CORBA::ORB,
+ ORB_Destroyer_Functor>
+ ORB_Destroyer;
+
+ } // namespace Utils
+} // namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_UTILS_ORB_DESTROYER_H*/
diff --git a/TAO/tao/Utils/ORB_Manager.cpp b/TAO/tao/Utils/ORB_Manager.cpp
new file mode 100644
index 00000000000..7485985f09b
--- /dev/null
+++ b/TAO/tao/Utils/ORB_Manager.cpp
@@ -0,0 +1,371 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// tao
+//
+// = AUTHOR
+// Sumedh Mungee <sumedh@cs.wustl.edu>
+//
+// ============================================================================
+
+#include "tao/Utils/ORB_Manager.h"
+
+#include "tao/PortableServer/POAManagerC.h"
+#include "tao/PortableServer/IdAssignmentPolicyC.h"
+#include "tao/PortableServer/LifespanPolicyC.h"
+
+#include "tao/Environment.h"
+#include "tao/ORBInitializer_Registry.h"
+
+#include "ace/Log_Msg.h"
+
+ACE_RCSID (PortableServer,
+ ORB_Manager,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// constructor
+TAO_ORB_Manager::TAO_ORB_Manager (CORBA::ORB_ptr orb,
+ PortableServer::POA_ptr poa,
+ PortableServer::POAManager_ptr poa_manager)
+ : orb_ (orb),
+ poa_ (poa),
+ poa_manager_ (poa_manager)
+{
+}
+
+int
+TAO_ORB_Manager::init (int &argc,
+ char **argv
+ ACE_ENV_ARG_DECL)
+{
+ return this->init (argc,
+ argv,
+ 0
+ ACE_ENV_ARG_PARAMETER);
+}
+
+int
+TAO_ORB_Manager::init (int &argc,
+ char **argv,
+ const char *orb_name
+ ACE_ENV_ARG_DECL)
+{
+ if (CORBA::is_nil (this->orb_.in ()))
+ {
+ this->orb_ = CORBA::ORB_init (argc,
+ argv,
+ orb_name
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+ }
+
+ if (CORBA::is_nil (this->poa_.in ()))
+ {
+ // Get the POA from the ORB.
+ CORBA::Object_var poa_object =
+ this->orb_->resolve_initial_references (TAO_OBJID_ROOTPOA
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ if (CORBA::is_nil (poa_object.in ()))
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT (" (%P|%t) Unable to initialize the POA.\n")),
+ -1);
+
+ // Get the POA object.
+ this->poa_ =
+ PortableServer::POA::_narrow (poa_object.in ()
+ ACE_ENV_ARG_PARAMETER);
+
+ ACE_CHECK_RETURN (-1);
+ }
+
+ if (CORBA::is_nil (this->poa_manager_.in ()))
+ {
+ // Get the POA_Manager.
+ this->poa_manager_ =
+ this->poa_->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER);
+
+ ACE_CHECK_RETURN (-1);
+ }
+
+ return 0;
+}
+
+int
+TAO_ORB_Manager::init_child_poa (int& argc,
+ char **argv,
+ const char *poa_name
+ ACE_ENV_ARG_DECL)
+{
+ return this->init_child_poa (argc,
+ argv,
+ poa_name,
+ 0
+ ACE_ENV_ARG_PARAMETER);
+}
+
+int
+TAO_ORB_Manager::init_child_poa (int& argc,
+ char **argv,
+ const char *poa_name,
+ const char *orb_name
+ ACE_ENV_ARG_DECL)
+{
+ int init_result;
+
+ // check to see if root poa has to be created.
+ init_result = this->init (argc,
+ argv,
+ orb_name
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ if (init_result == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT (" (%P|%t) Error in init.\n")),
+ -1);
+
+ // Create the default policies - user-supplied ID, and persistent
+ // objects.
+ CORBA::PolicyList policies (2);
+ policies.length (2);
+
+ // Id Assignment policy
+ policies[0] =
+ this->poa_->create_id_assignment_policy (PortableServer::USER_ID
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ // Lifespan policy
+ policies[1] =
+ this->poa_->create_lifespan_policy (PortableServer::PERSISTENT
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ // We use a different POA, otherwise the user would have to change
+ // the object key each time it invokes the server.
+
+ this->child_poa_ =
+ this->poa_->create_POA (poa_name,
+ this->poa_manager_.in (),
+ policies
+ ACE_ENV_ARG_PARAMETER);
+ // Warning! If create_POA fails, then the policies won't be
+ // destroyed and there will be hell to pay in memory leaks!
+ ACE_CHECK_RETURN (-1);
+
+ // Creation of the new POAs over, so destroy the Policy_ptr's.
+ for (CORBA::ULong i = 0;
+ i < policies.length ();
+ ++i)
+ {
+ CORBA::Policy_ptr policy = policies[i];
+ policy->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+ }
+ return 0;
+}
+
+// Activate POA manager.
+
+int
+TAO_ORB_Manager::activate_poa_manager (ACE_ENV_SINGLE_ARG_DECL)
+{
+ this->poa_manager_->activate (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+ return 0;
+}
+
+// Activate servant in the POA.
+
+char *
+TAO_ORB_Manager::activate (PortableServer::Servant servant
+ ACE_ENV_ARG_DECL)
+{
+ PortableServer::ObjectId_var id =
+ this->poa_->activate_object (servant
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ CORBA::Object_var obj =
+ this->poa_->id_to_reference (id.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ CORBA::String_var str =
+ this->orb_->object_to_string (obj.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ return str._retn ();
+}
+
+void
+TAO_ORB_Manager::deactivate (const char *id
+ ACE_ENV_ARG_DECL)
+{
+ CORBA::Object_var object =
+ this->orb_->string_to_object (id
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ PortableServer::ObjectId_var object_id =
+ this->poa_->reference_to_id (object.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->poa_->deactivate_object (object_id.in ()
+ ACE_ENV_ARG_PARAMETER);
+}
+
+// Activate the object with the object_name under the child POA.
+
+char *
+TAO_ORB_Manager::activate_under_child_poa (const char *object_name,
+ PortableServer::Servant servant
+ ACE_ENV_ARG_DECL)
+{
+ if (object_name == 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("\n(%P|%t) TAO_ORB_Manager::register: ")
+ ACE_TEXT ("object_name is null!")),
+ 0);
+
+ PortableServer::ObjectId_var id =
+ PortableServer::string_to_ObjectId (object_name);
+
+ this->child_poa_->activate_object_with_id (id.in (),
+ servant
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ CORBA::Object_var obj =
+ this->child_poa_->id_to_reference (id.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ char * str =
+ this->orb_->object_to_string (obj.in ()
+ ACE_ENV_ARG_PARAMETER);
+
+ ACE_CHECK_RETURN (0);
+
+ return str;
+}
+
+void
+TAO_ORB_Manager::deactivate_under_child_poa (const char *id
+ ACE_ENV_ARG_DECL)
+{
+ CORBA::Object_var object =
+ this->orb_->string_to_object (id
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ PortableServer::ObjectId_var object_id =
+ this->child_poa_->reference_to_id (object.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->child_poa_->deactivate_object (object_id.in ()
+ ACE_ENV_ARG_PARAMETER);
+}
+
+// Enter the ORB event loop.
+
+int
+TAO_ORB_Manager::run (ACE_Time_Value &tv
+ ACE_ENV_ARG_DECL)
+{
+ this->poa_manager_->activate (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ this->orb_->run (tv ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ return 0;
+}
+
+int
+TAO_ORB_Manager::fini (ACE_ENV_SINGLE_ARG_DECL)
+{
+ this->poa_->destroy (1, 1 ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ this->poa_ = 0;
+
+ this->orb_->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ this->orb_ = 0;
+ return 0;
+}
+
+int
+TAO_ORB_Manager::run (ACE_ENV_SINGLE_ARG_DECL)
+{
+ this->poa_manager_->activate (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ this->orb_->run (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ return 0;
+}
+
+// Return the corba orb reference.
+
+CORBA::ORB_ptr
+TAO_ORB_Manager::orb (void)
+{
+ return CORBA::ORB::_duplicate (this->orb_.in ());
+}
+
+// Return the root POA reference
+PortableServer::POA_ptr
+TAO_ORB_Manager::root_poa (void)
+{
+ return PortableServer::POA::_duplicate (this->poa_.in ());
+}
+
+// Return the child POA reference
+PortableServer::POA_ptr
+TAO_ORB_Manager::child_poa (void)
+{
+ return PortableServer::POA::_duplicate (this->child_poa_.in ());
+}
+
+PortableServer::POAManager_ptr
+TAO_ORB_Manager::poa_manager (void)
+{
+ return PortableServer::POAManager::_duplicate (this->poa_manager_.in ());
+}
+
+// Destructor.
+
+TAO_ORB_Manager::~TAO_ORB_Manager (void)
+{
+ ACE_TRY_NEW_ENV
+ {
+ if (!CORBA::is_nil (this->poa_.in ()))
+ {
+ this->poa_->destroy (1,
+ 1
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ }
+ ACE_CATCHANY
+ {
+ // ignore any exceptions..
+ }
+ ACE_ENDTRY;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Utils/ORB_Manager.h b/TAO/tao/Utils/ORB_Manager.h
new file mode 100644
index 00000000000..520ca1af26e
--- /dev/null
+++ b/TAO/tao/Utils/ORB_Manager.h
@@ -0,0 +1,257 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file ORB_Manager.h
+ *
+ * $Id$
+ *
+ * @author Chris Cleeland <cleeland@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_ORB_MANAGER_H
+#define TAO_ORB_MANAGER_H
+#include /**/ "ace/pre.h"
+
+#include "tao/Utils/utils_export.h"
+#include "tao/PortableServer/PortableServer.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/ORB.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_ORB_Manager
+ *
+ * @brief Helper class for simple ORB/POA initialization and
+ * registering servants with the POA.
+ *
+ * This class is a TAO extension that makes it easier to write
+ * CORBA applications. It's just a wrapper and doesn't do
+ * anything special within the ORB itself.
+ */
+class TAO_UTILS_Export TAO_ORB_Manager
+{
+public:
+ // = Initialization and termination methods.
+ /** Constructor.
+ *
+ * @param orb pointer to an ORB which is duplicated an stored
+ * internally in an ORB_var. If pointer is 0,
+ * a new ORB pointer is created internally in the init()
+ * call.
+ *
+ * @param poa pointer to a POA which is duplicated and stored
+ * internally in a POA_var. If pointer is 0,
+ * a pointer to the Root POA is obtained from the ORB.
+ *
+ * @param poa_manager pointer to a POA Manager which is duplicated
+ * and stored internally in a POAManager_var.
+ * If pointer is 0, a new POAManager is created
+ * internally in the init() call.
+ */
+ TAO_ORB_Manager (CORBA::ORB_ptr orb = 0,
+ PortableServer::POA_ptr poa = 0,
+ PortableServer::POAManager_ptr poa_manager = 0);
+
+ /**
+ * Initialize the ORB/root POA, using the supplied command line
+ * arguments or the default ORB components.
+ *
+ * @retval -1 Failure
+ * @retval 0 Success
+ */
+ int init (int &argc,
+ char *argv[]
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ /**
+ * Initialize the ORB/root POA, using the supplied command line
+ * arguments or the default ORB components.
+ *
+ * @retval -1 Failure
+ * @retval 0 Success
+ */
+ int init (int &argc,
+ char *argv[],
+ const char *orb_name
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ /**
+ * Creates a child poa under the root poa with PERSISTENT and
+ * USER_ID policies. Call this if you want a @c child_poa with the
+ * above policies, otherwise call init.
+ *
+ * @retval -1 Failure
+ * @retval 0 Success
+ */
+ int init_child_poa (int &argc,
+ char *argv[],
+ const char *poa_name
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ /**
+ * Creates a child poa under the root poa with PERSISTENT and
+ * USER_ID policies. Call this if you want a @a child_poa with the
+ * above policies, otherwise call init.
+ *
+ * @retval -1 Failure
+ * @retval 0 Success
+ */
+ int init_child_poa (int &argc,
+ char *argv[],
+ const char *poa_name,
+ const char *orb_name
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ /**
+ * Shut down. Invoke the destroy() methods on the orb and poa.
+ *
+ * @retval -1 Failure
+ * @retval 0 Success
+ */
+ int fini (ACE_ENV_SINGLE_ARG_DECL);
+
+ /// Destructor.
+ ~TAO_ORB_Manager (void);
+
+ // = Accessor methods.
+
+ /**
+ * Put POA manager into the <Active> state, so that incoming corba
+ * requests are processed. This method is useful for clients,
+ * which are not going to enter "orb->run" loop, yet may want to
+ * service incoming requests while waiting for a result of CORBA
+ * call on a server.
+ *
+ * @retval -1 Failure
+ * @retval 0 Success
+ */
+ int activate_poa_manager (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS);
+
+ /**
+ * Activate <servant>, using the POA <activate_object> call. Users
+ * can call this method multiple times to activate multiple objects.
+ *
+ * @return 0 on failure, a string representation of the object ID if
+ * successful. Caller of this method is responsible for
+ * memory deallocation of the string.
+ */
+ char *activate (PortableServer::Servant servant
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ /** Deactivate object in RootPOA.
+ *
+ * @param id A string representation of the Object ID
+ * of the servant to deactivate in the POA
+ */
+ void deactivate (const char *id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ /**
+ * Precondition: init_child_poa has been called. Activate <servant>
+ * using the POA <activate_object_with_id> created from the string
+ * <object_name>. Users should call this to activate objects under
+ * the child_poa.
+ *
+ * @param object_name String name which will be used to create
+ * an Object ID for the servant.
+ * @param servant The servant to activate under the child POA.
+ *
+ * @return 0 on failure, a string representation of the object ID if
+ * successful. Caller of this method is responsible for
+ * memory deallocation of the string.
+ */
+ char *activate_under_child_poa (const char *object_name,
+ PortableServer::Servant servant
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ /**
+ * Deactivate object in child POA.
+ *
+ * @param id string representation of the object ID, which represents
+ * the object to deactivate in the POA
+ */
+ void deactivate_under_child_poa (const char *id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ /**
+ * Run the ORB event loop with the specified @a tv time value.
+ *
+ * @param tv the time interval for how long to run the ORB event loop.
+ * @retval -1 Failure
+ * @retval 0 Success
+ */
+ int run (ACE_Time_Value &tv
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ /**
+ * Run the ORB event loop.
+ */
+ int run (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS);
+
+ /**
+ * Accessor which returns the ORB pointer. Following the normal
+ * CORBA memory management rules of return values from functions,
+ * this function duplicates the orb return value before returning
+ * it.
+ *
+ * @return ORB pointer which has been duplicated, so caller
+ * must release pointer when done.
+ */
+ CORBA::ORB_ptr orb (void);
+
+ /**
+ * Accessor which returns the root poa. Following the normal CORBA
+ * memory management rules of return values from functions, this
+ * function duplicates the poa return value before returning it.
+ *
+ * @return Root POA pointer which has been duplicated. Caller
+ * must release pointer when done.
+ */
+ PortableServer::POA_ptr root_poa (void);
+
+ /**
+ * Accessor which returns the child poa. Following the normal CORBA
+ * memory management rules of return values from functions, this
+ * function duplicates the poa return value before returning it.
+ *
+ * @return Child POA pointer which has been duplicated. Caller
+ * must release pointer when done.
+ */
+ PortableServer::POA_ptr child_poa (void);
+
+ /**
+ * Accessor which returns the poa manager. Following the normal
+ * CORBA memory management rules of return values from functions,
+ * this function duplicates the poa manager return value before
+ * returning it.
+ *
+ * @return POAManager pointer which has been duplicated. Caller
+ * must release pointer when done.
+ */
+ PortableServer::POAManager_ptr poa_manager (void);
+
+protected:
+ /// The ORB.
+ CORBA::ORB_var orb_;
+
+ /// The POA for this ORB.
+ PortableServer::POA_var poa_;
+
+ /// Child poa under the root POA.
+ PortableServer::POA_var child_poa_;
+
+ /// The POA manager of poa_.
+ PortableServer::POAManager_var poa_manager_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_ORB_MANAGER_H */
diff --git a/TAO/tao/Utils/PolicyList_Destroyer.cpp b/TAO/tao/Utils/PolicyList_Destroyer.cpp
new file mode 100644
index 00000000000..426d841991c
--- /dev/null
+++ b/TAO/tao/Utils/PolicyList_Destroyer.cpp
@@ -0,0 +1,41 @@
+#include "tao/Utils/PolicyList_Destroyer.h"
+#include "tao/Environment.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/Utils/PolicyList_Destroyer.inl"
+#endif /* __ACE_INLINE__ */
+
+ACE_RCSID (Utils,
+ PolicyList_Deactivator,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO::Utils::PolicyList_Destroyer::~PolicyList_Destroyer()
+ ACE_THROW_SPEC (())
+{
+ ACE_DECLARE_NEW_CORBA_ENV;
+
+ for (CORBA::ULong i = 0; i != length(); ++i)
+ {
+ CORBA::Policy_ptr policy = (*this)[i];
+ if (CORBA::is_nil (policy))
+ {
+ continue;
+ }
+
+ ACE_TRY
+ {
+ policy->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHALL
+ {
+ }
+ ACE_ENDTRY;
+
+ (*this)[i] = CORBA::Policy::_nil();
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Utils/PolicyList_Destroyer.h b/TAO/tao/Utils/PolicyList_Destroyer.h
new file mode 100644
index 00000000000..ef2ef408805
--- /dev/null
+++ b/TAO/tao/Utils/PolicyList_Destroyer.h
@@ -0,0 +1,54 @@
+// -*- C++ -*-
+//=============================================================================
+/**
+ * @file PolicyList_Destroyer.h
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan <coryan@atdesk.com>
+ */
+//=============================================================================
+#ifndef TAO_UTILS_POLICYLIST_DESTROYER_H
+#define TAO_UTILS_POLICYLIST_DESTROYER_H
+#include /**/ "ace/pre.h"
+#include "tao/Utils/utils_export.h"
+
+#include "tao/PolicyC.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Utils
+ {
+
+ /**
+ * @class PolicyList_Destroyer
+ *
+ * @brief Automatically destroy all the policies set in a PolicyList
+ *
+ */
+ class TAO_UTILS_Export PolicyList_Destroyer
+ : public CORBA::PolicyList
+ {
+ public:
+ PolicyList_Destroyer(CORBA::ULong length_hint);
+ ~PolicyList_Destroyer()
+ ACE_THROW_SPEC (());
+ };
+
+ } // namespace Utils
+} // namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/Utils/PolicyList_Destroyer.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+#endif /*TAO_UTILS_POLICYLIST_DESTROYER_H*/
diff --git a/TAO/tao/Utils/PolicyList_Destroyer.inl b/TAO/tao/Utils/PolicyList_Destroyer.inl
new file mode 100644
index 00000000000..a93e6334c87
--- /dev/null
+++ b/TAO/tao/Utils/PolicyList_Destroyer.inl
@@ -0,0 +1,13 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO::Utils::PolicyList_Destroyer::PolicyList_Destroyer (CORBA::ULong length_hint)
+ : CORBA::PolicyList(length_hint)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Utils/RIR_Narrow.cpp b/TAO/tao/Utils/RIR_Narrow.cpp
new file mode 100644
index 00000000000..fad7ef86477
--- /dev/null
+++ b/TAO/tao/Utils/RIR_Narrow.cpp
@@ -0,0 +1,60 @@
+// $Id$
+
+#ifndef TAO_UTILS_RIR_NARROW_CPP
+#define TAO_UTILS_RIR_NARROW_CPP
+
+#include "tao/Utils/RIR_Narrow.h"
+#include "tao/SystemException.h"
+#if defined (ACE_HAS_EXCEPTIONS)
+ #include <stdexcept>
+#endif
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template<class T> typename TAO::Utils::RIR_Narrow<T>::_ptr_type
+TAO::Utils::RIR_Narrow<T>::narrow (CORBA::ORB_ptr orb,
+ char const * id
+ ACE_ENV_ARG_DECL)
+{
+ CORBA::Object_var object =
+ orb->resolve_initial_references (id
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (T::_nil ());
+
+ return RIR_Narrow<T>::narrow_object (object.in ()
+ ACE_ENV_ARG_PARAMETER);
+}
+
+template<class T> typename TAO::Utils::RIR_Narrow<T>::_ptr_type
+TAO::Utils::RIR_Narrow<T>::narrow (PortableInterceptor::ORBInitInfo_ptr info,
+ char const * id
+ ACE_ENV_ARG_DECL)
+{
+ CORBA::Object_var object =
+ info->resolve_initial_references (id
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (T::_nil ());
+
+ return RIR_Narrow<T>::narrow_object (object.in ()
+ ACE_ENV_ARG_PARAMETER);
+}
+
+template<class T> typename TAO::Utils::RIR_Narrow<T>::_ptr_type
+TAO::Utils::RIR_Narrow<T>::narrow_object (CORBA::Object_ptr object
+ ACE_ENV_ARG_DECL)
+{
+ _var_type narrowed_object = T::_narrow (object
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (T::_nil ());
+
+ if (CORBA::is_nil (narrowed_object.in ()))
+ {
+ ACE_THROW_RETURN (CORBA::INV_OBJREF (),
+ T::_nil ());
+ }
+ return narrowed_object._retn ();
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /*TAO_UTILS_RIR_NARROW_CPP*/
diff --git a/TAO/tao/Utils/RIR_Narrow.h b/TAO/tao/Utils/RIR_Narrow.h
new file mode 100644
index 00000000000..fdeba60f91e
--- /dev/null
+++ b/TAO/tao/Utils/RIR_Narrow.h
@@ -0,0 +1,75 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file RIR_Narrow.h
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan <coryan@atdesk.com>
+ */
+//=============================================================================
+
+#ifndef TAO_UTILS_RIR_NARROW_H
+#define TAO_UTILS_RIR_NARROW_H
+
+#include /**/ "ace/pre.h"
+
+#include "ace/config-all.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PI/PI.h"
+#include "tao/ORB.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Utils
+ {
+
+ /**
+ * @class RIR_Narrow
+ *
+ * @brief Helper class to obtain an initial reference and narrow it
+ * to the proper object reference.
+ */
+ template<class T> class RIR_Narrow
+ {
+ public:
+ typedef typename T::_ptr_type _ptr_type;
+ typedef typename T::_var_type _var_type;
+
+ /// Use resolve_initial_references to find an object and then
+ /// narrow it.
+ static _ptr_type narrow (CORBA::ORB_ptr orb,
+ char const * id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ /// Use resolve_initial_references to find an object and then
+ /// narrow it.
+ static _ptr_type narrow (PortableInterceptor::ORBInitInfo_ptr orb,
+ char const * id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ private:
+ static _ptr_type narrow_object (CORBA::Object_ptr object
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+ };
+
+ } // namespace Utils
+} // namespace TAO
+
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+# include "tao/Utils/RIR_Narrow.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#include /**/ "ace/post.h"
+
+#endif /*TAO_UTILS_RIR_NARROW_H*/
diff --git a/TAO/tao/Utils/Servant_Var.cpp b/TAO/tao/Utils/Servant_Var.cpp
new file mode 100644
index 00000000000..1506ae356bc
--- /dev/null
+++ b/TAO/tao/Utils/Servant_Var.cpp
@@ -0,0 +1,14 @@
+#ifndef TAO_UTILS_SERVANT_VAR_CPP
+#define TAO_UTILS_SERVANT_VAR_CPP
+
+#include "tao/Utils/Servant_Var.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/Utils/Servant_Var.inl"
+#endif /* __ACE_INLINE__ */
+
+ACE_RCSID (Utils,
+ Servant_Var,
+ "$Id$")
+
+#endif /*TAO_UTILS_SERVANT_VAR_CPP*/
diff --git a/TAO/tao/Utils/Servant_Var.h b/TAO/tao/Utils/Servant_Var.h
new file mode 100644
index 00000000000..ee6c34f4087
--- /dev/null
+++ b/TAO/tao/Utils/Servant_Var.h
@@ -0,0 +1,177 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Servant_Var.h
+ *
+ * $Id$
+ *
+ * @author Jody Hagins <jody@atdesk.com>
+ * @author Carlos O'Ryan <coryan@atdesk.com>
+ *
+ * @deprecated Use PortableServer::Servant_var instead.
+ */
+//=============================================================================
+
+#ifndef TAO_UTILS_SERVANT_VAR_H
+#define TAO_UTILS_SERVANT_VAR_H
+#include /**/ "ace/pre.h"
+#include "ace/config-all.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/CORBA_macros.h"
+#include "tao/Environment.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Utils
+ {
+
+ /**
+ * @class Servant_Var
+ *
+ * @brief Provides a type safe counted reference to servants.
+ *
+ * @author Jody Hagins
+ *
+ * @todo Life would be much easier if _add_ref() and _remove_ref() had
+ * throw specs of "throw ()", that can be hidden in static
+ * methods though.
+ */
+ template<class T>
+ class Servant_Var
+ {
+ public:
+ typedef T Servant_Type;
+
+ /// Constructor. Assumes ownership of @c p.
+ Servant_Var(T * p = 0);
+
+ /// Copy constructor. Adds reference to @c rhs.
+ Servant_Var(Servant_Var<T> const & rhs);
+
+ /// Assignment operator. Adds reference to @c rhs.
+ Servant_Var<T> & operator=(Servant_Var<T> const & rhs);
+
+ /// Destructor. Removes a reference from the underlying object,
+ /// possibly destroying it.
+ ~Servant_Var()
+ ACE_THROW_SPEC (());
+
+ /// Assignment operator. Assumes ownership of @c p.
+ Servant_Var<T> & operator=(T * p);
+
+# if !defined(ACE_LACKS_MEMBER_TEMPLATES)
+ /// Template member constructor from a pointer that will implicitly
+ /// cast to type T. Assumes ownership of @c p.
+ /// This constructor allows constructs such as:
+ /// Servant_Base<Base> p(new Derived);
+ template <class Y>
+ Servant_Var(Y * p);
+
+ /// Template member copy constructor from a Servant_Var<Y>, where
+ /// Y can be implicitly cast to type T.
+ template <class Y>
+ Servant_Var(Servant_Var<Y> const & rhs);
+
+ /// Template member assignment operator from a Servant_Var<Y>, where
+ /// Y can be implicitly cast to type T.
+ template <class Y>
+ Servant_Var<T> & operator=(Servant_Var<Y> const & rhs);
+
+ /// Template member assignment operator from a pointer to Y, where Y
+ /// can be implicitly cast to type T.
+ template <class Y>
+ Servant_Var<T> & operator=(Y * p);
+# endif /* ACE_LACKS_MEMBER_TEMPLATES */
+
+ /// Smart pointer operator-> provides access to the underlying object.
+ T const * operator->() const;
+
+ /// Smart pointer operator-> provides access to the underlying object.
+ T * operator->();
+
+ /// Dereference the underlying object.
+ T const & operator*() const;
+
+ /// Dereference the underlying object.
+ T & operator*();
+
+ /// Return a void pointer to the underlying object. This allows
+ /// it to be used in conditional code and tested against 0.
+ operator void const * () const;
+
+ /// As an IN parameter.
+ T * in() const;
+
+ /// As an INOUT parameter.
+ T *& inout();
+
+ /// As an OUT parameter.
+ T *& out();
+
+ // Return a pointer to the underlying object, and this counted
+ // reference will no longer own the object.
+ T * _retn();
+
+ /// Increment the reference count and return the servant.
+ /**
+ * It is safe to pass in a null pointer, the pointer is simply
+ * returned in that case.
+ *
+ * @todo We might want to add a throw spec and catch all (potential)
+ * exceptions in _add_ref()
+ *
+ * @todo It might be useful to add an _release() method that handles
+ * any potential exceptions...
+ */
+ static T * _duplicate (T *);
+
+ /// Swap the contents of a Servant_Var<T> with another
+ /// Servant_Var<T>
+ /**
+ * Often used to implement strong exception safety.
+ */
+ void swap(Servant_Var<T> & rhs)
+ ACE_THROW_SPEC(());
+
+ private:
+ T * ptr_;
+ };
+
+#ifndef ACE_LACKS_MEMBER_TEMPLATES
+ /// Compare two Servant_Vars for equivalence.
+ template <class X, class Y>
+ bool operator==(Servant_Var<X> const & x,
+ Servant_Var<Y> const & y);
+
+ /// Compare two Servant_Vars for non-equivalence.
+ template <class X, class Y>
+ bool operator!=(Servant_Var<X> const & x,
+ Servant_Var<Y> const & y);
+#endif /* ! ACE_LACKS_MEMBER_TEMPLATES */
+
+ } // namespace Utils
+} // namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/Utils/Servant_Var.inl"
+#endif /* __ACE_INLINE__ */
+
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+#include "tao/Utils/Servant_Var.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
+#pragma implementation ("Servant_Var.cpp")
+#endif
+
+#include /**/ "ace/post.h"
+#endif /*TAO_UTILS_SERVANT_VAR_H*/
diff --git a/TAO/tao/Utils/Servant_Var.inl b/TAO/tao/Utils/Servant_Var.inl
new file mode 100644
index 00000000000..be906d9982f
--- /dev/null
+++ b/TAO/tao/Utils/Servant_Var.inl
@@ -0,0 +1,226 @@
+// -*- C++ -*-
+//
+// $Id$
+
+#include "tao/Exception.h"
+#include "ace/Swap.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template <class T>
+ACE_INLINE T *
+TAO::Utils::Servant_Var<T>::_duplicate (T * p)
+{
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ if (p != 0)
+ {
+ p->_add_ref (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ }
+ ACE_CATCHALL
+ {
+ ACE_RE_THROW;
+ }
+ ACE_ENDTRY;
+ ACE_CHECK_RETURN (0);
+
+ return p;
+}
+
+template <class T>
+ACE_INLINE void
+TAO::Utils::Servant_Var<T>::swap (Servant_Var<T> & rhs) ACE_THROW_SPEC(())
+{
+ ACE_Swap<T*>::swap (this->ptr_, rhs.ptr_);
+}
+
+template <class T>
+ACE_INLINE TAO::Utils::Servant_Var<T>::Servant_Var (T * p)
+ : ptr_ (p)
+{
+}
+
+// If _add_ref throws, this object will not be completely constructed
+// so the destructor will not be called.
+template <class T>
+ACE_INLINE TAO::Utils::Servant_Var<T>::Servant_Var (Servant_Var<T> const & rhs)
+ : ptr_ (Servant_Var<T>::_duplicate(rhs.ptr_))
+{
+}
+
+template <class T>
+ACE_INLINE TAO::Utils::Servant_Var<T> &
+TAO::Utils::Servant_Var<T>::operator= (Servant_Var<T> const & rhs)
+{
+ TAO::Utils::Servant_Var<T> tmp (rhs);
+ this->swap (tmp);
+ return *this;
+}
+
+template <class T>
+ACE_INLINE typename TAO::Utils::Servant_Var<T> &
+TAO::Utils::Servant_Var<T>::operator= (T * p)
+{
+ if (this->ptr_ != p)
+ {
+ // This constructor doesn't increase the reference count so we
+ // we must check for self-assignment. Otherwise the reference
+ // count would be prematurely decremented upon exiting this
+ // scope.
+ TAO::Utils::Servant_Var<T> tmp (p);
+ this->swap (tmp);
+ }
+
+ return *this;
+}
+
+template <class T> ACE_INLINE
+TAO::Utils::Servant_Var<T>::~Servant_Var (void)
+ ACE_THROW_SPEC (())
+{
+ // Unfortunately, there is no throw spec on _remove_ref, so we
+ // can't assume that it will not throw. If it does, then we are in
+ // trouble. In any event, we can't let the exception escape our
+ // destructor.
+ ACE_TRY_NEW_ENV
+ {
+ if (ptr_ != 0)
+ {
+ ptr_->_remove_ref (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ }
+ ACE_CATCHALL
+ {
+ // Forget the exception..
+ }
+ ACE_ENDTRY;
+}
+
+#if !defined(ACE_LACKS_MEMBER_TEMPLATES)
+template <class T> template <class Y>
+ACE_INLINE TAO::Utils::Servant_Var<T>::Servant_Var (Y * p)
+ : ptr_ (p)
+{
+}
+
+template <class T> template <class Y>
+ACE_INLINE TAO::Utils::Servant_Var<T>::Servant_Var (Servant_Var<Y> const & rhs)
+ : ptr_ (Servant_Var<T>::_duplicate (rhs.in ()))
+{
+}
+
+template <class T> template <class Y>
+ACE_INLINE typename TAO::Utils::Servant_Var<T> &
+TAO::Utils::Servant_Var<T>::
+operator=(Servant_Var<Y> const & rhs)
+{
+ TAO::Utils::Servant_Var<T> tmp (rhs);
+ this->swap (tmp);
+ return *this;
+}
+
+template <class T> template <class Y>
+ACE_INLINE typename TAO::Utils::Servant_Var<T> &
+TAO::Utils::Servant_Var<T>::operator= (Y * p)
+{
+ if (this->ptr_ != p)
+ {
+ // This constructor doesn't increase the reference count so we
+ // we must check for self-assignment. Otherwise the reference
+ // count would be prematurely decremented upon exiting this
+ // scope.
+ TAO::Utils::Servant_Var<T> tmp (p);
+ this->swap (tmp);
+ }
+
+ return *this;
+}
+#endif /* ACE_LACKS_MEMBER_TEMPLATES */
+
+template <class T>
+ACE_INLINE T const *
+TAO::Utils::Servant_Var<T>::operator->() const
+{
+ return ptr_;
+}
+
+template <class T>
+ACE_INLINE T *
+TAO::Utils::Servant_Var<T>::operator->()
+{
+ return ptr_;
+}
+
+template <class T>
+ACE_INLINE T const & TAO::Utils::Servant_Var<T>::operator*() const
+{
+ return *ptr_;
+}
+
+template <class T>
+ACE_INLINE T & TAO::Utils::Servant_Var<T>::operator*()
+{
+ return *ptr_;
+}
+
+template <class T>
+ACE_INLINE TAO::Utils::Servant_Var<T>::operator void const * () const
+{
+ return ptr_;
+}
+
+template <class T>
+ACE_INLINE T *
+TAO::Utils::Servant_Var<T>::in (void) const
+{
+ return ptr_;
+}
+
+template <class T>
+ACE_INLINE T *&
+TAO::Utils::Servant_Var<T>::inout (void)
+{
+ return ptr_;
+}
+
+template <class T>
+ACE_INLINE T *&
+TAO::Utils::Servant_Var<T>::out (void)
+{
+ TAO::Utils::Servant_Var<T> tmp;
+ this->swap (tmp);
+ return ptr_;
+}
+
+template <class T>
+ACE_INLINE T *
+TAO::Utils::Servant_Var<T>::_retn (void)
+{
+ T * rval = ptr_;
+ ptr_ = 0;
+ return rval;
+}
+
+#ifndef ACE_LACKS_MEMBER_TEMPLATES
+template <class X, class Y>
+ACE_INLINE bool
+operator== (typename TAO::Utils::Servant_Var<X> const & x,
+ typename TAO::Utils::Servant_Var<Y> const & y)
+{
+ return x.in () == y.in ();
+}
+
+template <class X, class Y>
+ACE_INLINE bool
+operator!= (typename TAO::Utils::Servant_Var<X> const & x,
+ typename TAO::Utils::Servant_Var<Y> const & y)
+{
+ return x.in () != y.in ();
+}
+#endif /* ! ACE_LACKS_MEMBER_TEMPLATES */
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Utils/Server_Main.cpp b/TAO/tao/Utils/Server_Main.cpp
new file mode 100644
index 00000000000..a4dce4bb8eb
--- /dev/null
+++ b/TAO/tao/Utils/Server_Main.cpp
@@ -0,0 +1,135 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Server_Main.cpp
+ *
+ * $Id$
+ *
+ * Implements a generic object that acts as "main" for a CORBA server.
+ *
+ * @author Dale Wilson <wilson_d@ociweb.com>
+ */
+//=============================================================================
+
+#ifndef TAO_UTILS_SERVER_MAIN_T_CPP
+#define TAO_UTILS_SERVER_MAIN_T_CPP
+
+#include "tao/Utils/Server_Main.h"
+
+#include "tao/ORB.h"
+
+#include "ace/Argv_Type_Converter.h"
+#include "ace/Log_Msg.h"
+#include "ace/Time_Value.h"
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template <typename SERVANT>
+TAO::Utils::Server_Main<SERVANT>::Server_Main (const char * name)
+ : name_(name)
+{
+}
+
+template <typename SERVANT>
+TAO::Utils::Server_Main<SERVANT>::~Server_Main ()
+{
+}
+
+template <typename SERVANT>
+int
+TAO::Utils::Server_Main<SERVANT>::run (int argc, ACE_TCHAR *argv[])
+{
+ int result = 0;
+ // hide unicode if necessary.
+ ACE_Argv_Type_Converter command_line (argc, argv);
+
+ char ** asciiArgv = command_line.get_ASCII_argv ();
+
+ ACE_TRY_NEW_ENV
+ {
+ // Initialize the orb
+
+ CORBA::ORB_var orb =
+ CORBA::ORB_init (argc, asciiArgv, name_ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (! ::CORBA::is_nil(orb.in ()))
+ {
+ // create an instance of the servant object and give it a
+ // chance at the arguments.
+ SERVANT servant;
+ result = servant.parse_args (argc, asciiArgv);
+ if (result == 0)
+ {
+ //////////////////////////////////
+ // let the servant register itself
+ result = servant.init (orb.in () ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (result == 0)
+ {
+ ACE_ERROR ((LM_INFO,
+ "%T %s (%P|%t) Ready %s\n", name_, servant.identity ()
+ ));
+
+ //////////////////////////////////
+ // Run the event loop for the ORB.
+ // Initial run to initialize the orb
+ ACE_Time_Value tv (1,0);
+ orb->run (tv ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ // now run event loop
+ int quit = 0;
+ while (result == 0 && ! quit )
+ {
+ ACE_Time_Value work_tv (1,0);
+ orb->perform_work(work_tv ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ quit = servant.idle (result ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ servant.fini (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ orb->shutdown (1 ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ ACE_ERROR ((LM_INFO,
+ "%T %s (%P|%t) Terminated normally. %s\n",
+ name_,
+ servant.identity ()
+ ));
+ }
+ else
+ {
+ ACE_ERROR ((LM_ERROR,
+ "%T %s (%P|%t) Registration failed: %m\n", name_
+ ));
+ result = -1;
+ }
+ }
+ else
+ {
+ ACE_ERROR ((LM_ERROR,
+ "%T %s (%P|%t) ORB manager init failed\n", name_
+ ));
+ result = -1;
+ }
+ }
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ name_);
+ result = -1;
+ }
+ ACE_ENDTRY;
+ return result;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif //TAO_UTILS_SERVER_MAIN_T_CPP
diff --git a/TAO/tao/Utils/Server_Main.h b/TAO/tao/Utils/Server_Main.h
new file mode 100644
index 00000000000..c5d3ea2d825
--- /dev/null
+++ b/TAO/tao/Utils/Server_Main.h
@@ -0,0 +1,100 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Server_Main.h
+ *
+ * $Id$
+ *
+ * Declares a generic object that acts as "main" for a CORBA server.
+ * @author Dale Wilson <wilson_d@ociweb.com>
+ *
+ * This object supports creation of a relatively simple CORBA server.
+ * The object implements "main" for a process.
+ * A single servant is created and initialized as the process begins
+ * execution. The lifetime of this initial servant is the lifetime of
+ * the process.
+ * The servant is free to create other servants as necessary.
+ * The servant can capture command line options.
+ * A callback method in the ORB event loop allows the servant to act
+ * asynchronously if necessary.
+ * The callback method allows the servant to request process termination
+ * and specify the status to be returned from the process.
+ *
+ * The application should create a C/C++ main that looks something like:
+ * #include <tao/Utils/Server_Main.h>
+ * #include "Xyzzy_i.h"
+ * int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
+ * {
+ * Server_Main<Xyzzy_i> servant ("Xyzzy");
+ * return servant.run(argc, argv);
+ * }
+ *
+ * The servant implementation (Xyzzy_i in this case) must implement
+ * the following methods:
+ * Xyzzy_i (); // null constructor
+ * ~Xyzzy_i (); // destructor
+ * int parse_args (int argc, char * argv[]);
+ * int init (CORBA::ORB_ptr orb ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+ * int idle(int &result);
+ * int fini (ACE_ENV_SINGLE_ARG_DECL);
+ * const char * identity () const;
+ *
+ * parse_args, self_register, self_unregister return 0 if ok, nonzero for error.
+ * idle returns 0 to continue execution; nonzero to exit -- returning "result" from the process
+ * identity provides a string to identify this servant in log messages.
+ *
+ */
+//=============================================================================
+
+#ifndef TAO_UTILS_SERVANTMAIN_H
+#define TAO_UTILS_SERVANTMAIN_H
+
+#include /**/ "ace/pre.h"
+
+#include "ace/ACE.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/orbconf.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ namespace Utils
+ {
+ template <typename SERVANT>
+ class Server_Main
+ {
+ public:
+ Server_Main(const char * name);
+ ~Server_Main();
+
+ int run (int argc, ACE_TCHAR *argv[]);
+
+ private:
+ Server_Main( const Server_Main &);
+ Server_Main & operator = (const Server_Main &);
+
+ private:
+ const char * name_;
+ };
+ } // namespace UTILS
+} // namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+# include "tao/Utils/Server_Main.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
+# pragma implementation "Server_Main.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+#include /**/ "ace/post.h"
+
+#endif //TAO_UTILS_SERVANTMAIN_H
diff --git a/TAO/tao/Utils/Synch_Refcountable.cpp b/TAO/tao/Utils/Synch_Refcountable.cpp
new file mode 100644
index 00000000000..4b132799b70
--- /dev/null
+++ b/TAO/tao/Utils/Synch_Refcountable.cpp
@@ -0,0 +1,29 @@
+#include "tao/Utils/Synch_Refcountable.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/Utils/Synch_Refcountable.inl"
+#endif /* __ACE_INLINE__ */
+
+#include "ace/Log_Msg.h"
+
+ACE_RCSID (Utils,
+ Synch_Refcountable,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Synch_Refcountable::TAO_Synch_Refcountable (ACE_Lock *lock,
+ int refcount)
+ : ACE_Refcountable (refcount)
+ , refcount_lock_ (lock)
+{
+}
+
+TAO_Synch_Refcountable::~TAO_Synch_Refcountable (void)
+{
+ ACE_ASSERT (this->refcount_ == 0);
+ delete this->refcount_lock_;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Utils/Synch_Refcountable.h b/TAO/tao/Utils/Synch_Refcountable.h
new file mode 100644
index 00000000000..3e77a70c4c3
--- /dev/null
+++ b/TAO/tao/Utils/Synch_Refcountable.h
@@ -0,0 +1,63 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Synch_Refcountable.h
+ *
+ * $Id$
+ *
+ * Definition for a synchronised refcountable interface.
+ *
+ * @author Fred Kuhns <fredk@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_SYNCH_REFCOUNTABLE_H
+#define TAO_SYNCH_REFCOUNTABLE_H
+
+#include /**/ "ace/pre.h"
+#include "ace/Refcountable.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Utils/utils_export.h"
+#include "tao/Versioned_Namespace.h"
+
+ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+class ACE_Lock;
+ACE_END_VERSIONED_NAMESPACE_DECL
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_Synch_Refcountable
+ *
+ * @brief Definition for a synchronised refcountable interface.
+ */
+class TAO_UTILS_Export TAO_Synch_Refcountable : private ACE_Refcountable
+{
+public:
+ virtual ~TAO_Synch_Refcountable (void);
+
+ int increment (void);
+ int decrement (void);
+
+ int refcount (void) const;
+
+protected:
+ TAO_Synch_Refcountable (ACE_Lock *lock, int refcount);
+
+ ACE_Lock *refcount_lock_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/Utils/Synch_Refcountable.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /*TAO_SYNCH_REFCOUNTABLE*/
diff --git a/TAO/tao/Utils/Synch_Refcountable.inl b/TAO/tao/Utils/Synch_Refcountable.inl
new file mode 100644
index 00000000000..2139918ab50
--- /dev/null
+++ b/TAO/tao/Utils/Synch_Refcountable.inl
@@ -0,0 +1,29 @@
+// -*- C++ -*-
+//
+//$Id$
+
+#include "ace/Guard_T.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE int
+TAO_Synch_Refcountable::increment (void)
+{
+ ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->refcount_lock_, 0);
+ return ACE_Refcountable::increment ();
+}
+
+ACE_INLINE int
+TAO_Synch_Refcountable::decrement (void)
+{
+ ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->refcount_lock_, 0);
+ return ACE_Refcountable::decrement ();
+}
+
+ACE_INLINE int
+TAO_Synch_Refcountable::refcount (void) const
+{
+ return ACE_Refcountable::refcount ();
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Utils/utils_export.h b/TAO/tao/Utils/utils_export.h
new file mode 100644
index 00000000000..5cf8c0c40a0
--- /dev/null
+++ b/TAO/tao/Utils/utils_export.h
@@ -0,0 +1,60 @@
+
+// -*- C++ -*-
+// $Id$
+// Definition for Win32 Export directives.
+// This file is generated automatically by generate_export_file.pl TAO_UTILS
+// ------------------------------
+#ifndef TAO_UTILS_EXPORT_H
+#define TAO_UTILS_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if defined (TAO_AS_STATIC_LIBS)
+# if !defined (TAO_UTILS_HAS_DLL)
+# define TAO_UTILS_HAS_DLL 0
+# endif /* ! TAO_UTILS_HAS_DLL */
+#else
+# if !defined (TAO_UTILS_HAS_DLL)
+# define TAO_UTILS_HAS_DLL 1
+# endif /* ! TAO_UTILS_HAS_DLL */
+#endif
+
+#if defined (TAO_UTILS_HAS_DLL) && (TAO_UTILS_HAS_DLL == 1)
+# if defined (TAO_UTILS_BUILD_DLL)
+# define TAO_UTILS_Export ACE_Proper_Export_Flag
+# define TAO_UTILS_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# define TAO_UTILS_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# else /* TAO_UTILS_BUILD_DLL */
+# define TAO_UTILS_Export ACE_Proper_Import_Flag
+# define TAO_UTILS_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# define TAO_UTILS_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# endif /* TAO_UTILS_BUILD_DLL */
+#else /* TAO_UTILS_HAS_DLL == 1 */
+# define TAO_UTILS_Export
+# define TAO_UTILS_SINGLETON_DECLARATION(T)
+# define TAO_UTILS_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+#endif /* TAO_UTILS_HAS_DLL == 1 */
+
+// Set TAO_UTILS_NTRACE = 0 to turn on library specific tracing even if
+// tracing is turned off for ACE.
+#if !defined (TAO_UTILS_NTRACE)
+# if (ACE_NTRACE == 1)
+# define TAO_UTILS_NTRACE 1
+# else /* (ACE_NTRACE == 1) */
+# define TAO_UTILS_NTRACE 0
+# endif /* (ACE_NTRACE == 1) */
+#endif /* !TAO_UTILS_NTRACE */
+
+#if (TAO_UTILS_NTRACE == 1)
+# define TAO_UTILS_TRACE(X)
+#else /* (TAO_UTILS_NTRACE == 1) */
+# if !defined (ACE_HAS_TRACE)
+# define ACE_HAS_TRACE
+# endif /* ACE_HAS_TRACE */
+# define TAO_UTILS_TRACE(X) ACE_TRACE_IMPL(X)
+# include "ace/Trace.h"
+#endif /* (TAO_UTILS_NTRACE == 1) */
+
+#endif /* TAO_UTILS_EXPORT_H */
+
+// End of auto generated file.
diff --git a/TAO/tao/Value_Traits_T.h b/TAO/tao/Value_Traits_T.h
new file mode 100644
index 00000000000..a16c7a02d89
--- /dev/null
+++ b/TAO/tao/Value_Traits_T.h
@@ -0,0 +1,53 @@
+#ifndef guard_value_traits_hpp
+#define guard_value_traits_hpp
+/**
+ * @file
+ *
+ * @brief Implement the element manipulation traits for types with
+ * value-like semantics.
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan
+ */
+
+#include <algorithm>
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+namespace details
+{
+
+template<typename T, bool dummy>
+struct value_traits
+{
+ typedef T value_type;
+ typedef T const const_value_type;
+
+ inline static void zero_range(
+ value_type * begin , value_type * end)
+ {
+ std::fill(begin, end, value_type ());
+ }
+
+ inline static void initialize_range(
+ value_type * begin, value_type * end)
+ {
+ std::fill(begin, end, value_type ());
+ }
+
+ inline static void copy_range(
+ value_type * begin, value_type * end, value_type *dst)
+ {
+ std::copy(begin, end, dst);
+ }
+};
+
+} // namespace details
+} // namespace CORBA
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif // guard_value_traits_hpp
diff --git a/TAO/tao/Valuetype.mpc b/TAO/tao/Valuetype.mpc
new file mode 100644
index 00000000000..244d31c87ad
--- /dev/null
+++ b/TAO/tao/Valuetype.mpc
@@ -0,0 +1,41 @@
+//$Id$
+project : taolib, core, core_anytypecode, tao_versioning_idl_defaults {
+ sharedname = TAO_Valuetype
+ dynamicflags = TAO_VALUETYPE_BUILD_DLL
+
+ Source_Files {
+ Valuetype
+ }
+
+ Header_Files {
+ Valuetype
+ }
+
+ Inline_Files {
+ Valuetype
+ }
+
+ Template_Files {
+ Valuetype
+ }
+
+ Resource_Files {
+ Valuetype
+ }
+
+ PIDL_Files {
+ }
+
+ IDL_Files {
+ idlflags += -SS -Ge 1 -Sorb \
+ -Wb,export_macro=TAO_Valuetype_Export \
+ -Wb,export_include=tao/Valuetype/valuetype_export.h \
+ -o Valuetype
+ idlflags -= -St
+ Valuetype/StringValue.pidl
+ }
+
+ Pkgconfig_Files {
+ Valuetype/TAO_Valuetype.pc.in
+ }
+}
diff --git a/TAO/tao/Valuetype/AbstractBase.cpp b/TAO/tao/Valuetype/AbstractBase.cpp
new file mode 100644
index 00000000000..24e7347e7f0
--- /dev/null
+++ b/TAO/tao/Valuetype/AbstractBase.cpp
@@ -0,0 +1,436 @@
+// "$Id$"
+
+#include "tao/Valuetype/AbstractBase.h"
+#include "tao/Valuetype/ValueBase.h"
+#include "tao/Valuetype/ValueFactory.h"
+#include "tao/Stub.h"
+#include "tao/ORB_Core.h"
+#include "tao/Profile.h"
+#include "tao/debug.h"
+#include "tao/CDR.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/Valuetype/AbstractBase.inl"
+#endif /* ! __ACE_INLINE__ */
+
+ACE_RCSID (Valuetype,
+ AbstractBase,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// ************************************************************
+// These are in CORBA namespace
+
+void
+CORBA::release (CORBA::AbstractBase_ptr obj)
+{
+ if (obj)
+ {
+ obj->_remove_ref ();
+ }
+}
+
+CORBA::Boolean
+CORBA::is_nil (CORBA::AbstractBase_ptr obj)
+{
+ return (obj == 0);
+}
+
+// ************************************************************
+
+CORBA::AbstractBase::AbstractBase (void)
+ : is_objref_ (false)
+ , concrete_stubobj_ (0)
+ , is_collocated_ (false)
+ , servant_ (0)
+ , is_local_ (false)
+ , equivalent_obj_ (0)
+{
+}
+
+CORBA::AbstractBase::AbstractBase (const CORBA::AbstractBase &rhs)
+ : is_objref_ (rhs.is_objref_)
+ , concrete_stubobj_ (rhs.concrete_stubobj_)
+ , is_collocated_ (rhs.is_collocated_)
+ , servant_ (rhs.servant_)
+ , is_local_ (rhs.is_local_)
+ , equivalent_obj_ (0)
+{
+ if (rhs.concrete_stubobj_ != 0)
+ {
+ rhs.concrete_stubobj_->_incr_refcnt ();
+ }
+
+ if (!CORBA::is_nil (rhs.equivalent_obj_))
+ {
+ this->equivalent_obj_ =
+ CORBA::Object::_duplicate (rhs.equivalent_obj_);
+ }
+}
+
+CORBA::AbstractBase::AbstractBase (TAO_Stub * protocol_proxy,
+ CORBA::Boolean collocated,
+ TAO_Abstract_ServantBase * servant)
+ : is_objref_ (true)
+ , concrete_stubobj_ (protocol_proxy)
+ , is_collocated_ (collocated)
+ , servant_ (servant)
+ , is_local_ (protocol_proxy == 0 ? true : false)
+ , equivalent_obj_ (0)
+{
+ if (this->concrete_stubobj_ != 0)
+ {
+ TAO_Stub *stub = this->concrete_stubobj_;
+
+ stub->_incr_refcnt ();
+
+ this->equivalent_obj_ =
+ stub->orb_core ()->create_object (stub);
+ }
+
+}
+
+CORBA::AbstractBase::~AbstractBase (void)
+{
+ if (this->concrete_stubobj_ != 0)
+ {
+ this->concrete_stubobj_->_decr_refcnt ();
+ }
+}
+
+CORBA::AbstractBase_ptr
+CORBA::AbstractBase::_duplicate (CORBA::AbstractBase_ptr obj)
+{
+ if (obj)
+ {
+ obj->_add_ref ();
+ }
+
+ if (!CORBA::is_nil (obj->equivalent_obj_.in ()))
+ {
+ obj->equivalent_obj_->_add_ref ();
+ }
+
+ return obj;
+}
+
+// These are non-pure virtual no-ops so we can instantiate the
+// class in the CDR extraction operator. The actual management
+// of the refcount will always be done in the derived class.
+void
+CORBA::AbstractBase::_add_ref (void)
+{
+}
+
+void
+CORBA::AbstractBase::_remove_ref (void)
+{
+}
+
+void
+CORBA::AbstractBase::_tao_any_destructor (void *x)
+{
+ CORBA::AbstractBase_ptr tmp = static_cast<CORBA::AbstractBase_ptr> (x);
+ ::CORBA::release (tmp);
+}
+
+CORBA::Object_ptr
+CORBA::AbstractBase::_to_object (void)
+{
+ if (!CORBA::is_nil (this->equivalent_obj_.in ()))
+ return CORBA::Object::_duplicate (this->equivalent_obj_.in ());
+
+ if (this->concrete_stubobj_ == 0)
+ {
+ return CORBA::Object::_nil ();
+ }
+
+ TAO_ORB_Core *orb_core = this->concrete_stubobj_->orb_core ();
+ this->concrete_stubobj_->_incr_refcnt ();
+
+ return orb_core->create_object (this->concrete_stubobj_);
+}
+
+CORBA::ValueBase *
+CORBA::AbstractBase::_to_value (void)
+{
+ if (this->is_objref_)
+ {
+ return 0;
+ }
+
+ CORBA::ValueBase *retval = this->_tao_to_value ();
+
+ if (retval != 0)
+ {
+ retval->_add_ref ();
+ }
+
+ return retval;
+}
+
+CORBA::Boolean
+CORBA::AbstractBase::_is_a (const char *type_id
+ ACE_ENV_ARG_DECL_NOT_USED)
+{
+ return ! ACE_OS::strcmp (type_id,
+ "IDL:omg.org/CORBA/AbstractBase:1.0");
+}
+
+const char *
+CORBA::AbstractBase::_interface_repository_id (void) const
+{
+ return "IDL:omg.org/CORBA/AbstractBase:1.0";
+}
+
+const char *
+CORBA::AbstractBase::_tao_obv_repository_id (void) const
+{
+ return "IDL:omg.org/CORBA/AbstractBase:1.0";
+}
+
+CORBA::Boolean
+operator<< (TAO_OutputCDR &strm, const CORBA::AbstractBase_ptr abs)
+{
+ CORBA::Boolean discriminator = true;
+
+ // We marshal a null abstract interface ptr as a discriminator
+ // plus null object reference (see CORBA::Object::marshal()
+ // and operator << for CORBA::Object).
+ if (CORBA::is_nil (abs))
+ {
+ // Marshal discriminator, then empty type hint.
+ strm << ACE_OutputCDR::from_boolean (discriminator);
+ strm.write_ulong (1);
+ strm.write_char ('\0');
+ strm.write_ulong (0);
+ return (CORBA::Boolean) strm.good_bit ();
+ }
+
+ if (abs->_is_objref ())
+ {
+ if (strm << ACE_OutputCDR::from_boolean (discriminator))
+ {
+ TAO_Stub *stubobj = abs->_stubobj ();
+
+ if (stubobj == 0)
+ {
+ return false;
+ }
+
+ // STRING, a type ID hint
+ if ((strm << stubobj->type_id.in ()) == 0)
+ {
+ return false;
+ }
+
+ const TAO_MProfile& mprofile = stubobj->base_profiles ();
+
+ CORBA::ULong const profile_count = mprofile.profile_count ();
+
+ if ((strm << profile_count) == 0)
+ {
+ return false;
+ }
+
+ // @@ The MProfile should be locked during this iteration, is there
+ // anyway to achieve that?
+ for (CORBA::ULong i = 0; i < profile_count; ++i)
+ {
+ const TAO_Profile *p = mprofile.get_profile (i);
+
+ if (p->encode (strm) == 0)
+ {
+ return false;
+ }
+ }
+
+ return (CORBA::Boolean) strm.good_bit ();
+ }
+ }
+ else
+ {
+ discriminator = false;
+
+ if (strm << ACE_OutputCDR::from_boolean (discriminator))
+ {
+ CORBA::Boolean retval = true;
+
+ CORBA::ULong value_tag = TAO_OBV_GIOP_Flags::Value_tag_base
+ | TAO_OBV_GIOP_Flags::Type_info_single;
+
+ retval = strm.write_ulong (value_tag);
+
+ if (retval == 0)
+ {
+ return retval;
+ }
+
+ retval = strm << abs->_tao_obv_repository_id ();
+
+ if (retval == 0)
+ {
+ return retval;
+ }
+
+ return abs->_tao_marshal_v (strm);
+ }
+ }
+
+ return false;
+}
+
+CORBA::Boolean
+operator>> (TAO_InputCDR &strm, CORBA::AbstractBase_ptr &abs)
+{
+ abs = 0;
+ CORBA::Boolean discriminator = false;
+ ACE_InputCDR::to_boolean tb (discriminator);
+ TAO_ORB_Core *orb_core = 0;
+
+ if (strm >> tb)
+ {
+ if (discriminator == 0)
+ {
+ CORBA::ULong value_tag;
+
+ if (!strm.read_ulong (value_tag))
+ {
+ return false;
+ }
+
+ if (TAO_OBV_GIOP_Flags::is_null_ref (value_tag))
+ {
+ // Ok, null reference unmarshaled.
+ return true;
+ }
+
+ if (!TAO_OBV_GIOP_Flags::is_value_tag (value_tag))
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("operator>> CORBA::AbstractBase ")
+ ACE_TEXT ("not value_tag\n")));
+ return false;
+ }
+
+ CORBA::String_var repo_id_stream;
+
+ // It would be more efficient not to copy the string)
+ if (strm.read_string (repo_id_stream.inout ()) == 0)
+ {
+ return false;
+ }
+
+ orb_core = strm.orb_core ();
+
+ if (orb_core == 0)
+ {
+ orb_core = TAO_ORB_Core_instance ();
+
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_WARNING,
+ "TAO (%P|%t) WARNING: extracting "
+ "valuetype using default ORB_Core\n"));
+ }
+ }
+
+ CORBA::ValueFactory_var factory =
+ orb_core->orb ()->lookup_value_factory (repo_id_stream.in ());
+
+ // We should throw an exception, if there were an appropriate one.
+ if (factory.in() == 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%N:%l): The following unknown type was received: `%s'."),
+ repo_id_stream.in ()));
+ return false;
+ }
+
+ abs = factory->create_for_unmarshal_abstract ();
+
+ return abs->_tao_unmarshal_v (strm);
+ }
+ else
+ {
+ CORBA::Object_var generic_objref;
+
+ if (strm >> generic_objref.inout ())
+ {
+ TAO_Stub *concrete_stubobj = generic_objref->_stubobj ();
+
+ CORBA::Boolean const stores_orb =
+ ! CORBA::is_nil (concrete_stubobj->servant_orb_var ().in ());
+
+ if (stores_orb)
+ {
+ orb_core =
+ concrete_stubobj->servant_orb_var ()->orb_core ();
+ }
+
+ CORBA::Boolean const collocated =
+ orb_core != 0
+ && orb_core->optimize_collocation_objects ()
+ && generic_objref->_is_collocated ();
+
+ ACE_NEW_RETURN (abs,
+ CORBA::AbstractBase (
+ concrete_stubobj,
+ collocated,
+ generic_objref->_servant ()),
+ false);
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
+CORBA::Boolean
+CORBA::AbstractBase::_tao_marshal_v (TAO_OutputCDR &) const
+{
+ return false;
+}
+
+CORBA::Boolean
+CORBA::AbstractBase::_tao_unmarshal_v (TAO_InputCDR &)
+{
+ return false;
+}
+
+CORBA::Boolean
+CORBA::AbstractBase::_tao_match_formal_type (ptrdiff_t ) const
+{
+ return false;
+}
+
+CORBA::ValueBase *
+CORBA::AbstractBase::_tao_to_value (void)
+{
+ return 0;
+}
+
+CORBA::Object_ptr
+CORBA::AbstractBase::equivalent_objref (void)
+{
+ if (CORBA::is_nil (this->equivalent_obj_.in ()))
+ {
+ if (this->concrete_stubobj_ != 0)
+ {
+ TAO_ORB_Core *orb_core =
+ this->concrete_stubobj_->orb_core ();
+
+ this->concrete_stubobj_->_incr_refcnt ();
+
+ this->equivalent_obj_ =
+ orb_core->create_object (this->concrete_stubobj_);
+ }
+ }
+
+ return this->equivalent_obj_.in ();
+}
+
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Valuetype/AbstractBase.h b/TAO/tao/Valuetype/AbstractBase.h
new file mode 100644
index 00000000000..11e33d0419c
--- /dev/null
+++ b/TAO/tao/Valuetype/AbstractBase.h
@@ -0,0 +1,180 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file AbstractBase.h
+ *
+ * $Id$
+ *
+ * @author Jeff Parsons <parsons@cs.wust.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_ABSTRACTBASE_H
+#define TAO_ABSTRACTBASE_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Valuetype/valuetype_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Valuetype/Value_CORBA_methods.h"
+#include "tao/Object_Argument_T.h"
+#include "tao/Arg_Traits_T.h"
+#include "tao/Objref_VarOut_T.h"
+#include "tao/Object.h" /* For CORBA::Object_var */
+#include "tao/Pseudo_VarOut_T.h"
+#include "ace/CORBA_macros.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Stub;
+class TAO_Abstract_ServantBase;
+
+#if defined (TAO_EXPORT_MACRO)
+#undef TAO_EXPORT_MACRO
+#endif
+#define TAO_EXPORT_MACRO TAO_Valuetype_Export
+
+namespace CORBA
+{
+ class ValueBase;
+
+ typedef TAO_Pseudo_Var_T<AbstractBase> AbstractBase_var;
+ typedef TAO_Pseudo_Out_T<AbstractBase> AbstractBase_out;
+
+ /**
+ * @class AbstractBase
+ *
+ * @brief Abstract base class for Interfaces and Valuetypes
+ *
+ * Allows the determination of whether an object has been passed by
+ * reference or by value to be deferred until runtime.
+ */
+ class TAO_Valuetype_Export AbstractBase
+ {
+ public:
+
+ /// Constructor.
+ /**
+ * This constructor is only meant to be called by the
+ * corresponding CDR stream extraction operator.
+ */
+ AbstractBase (TAO_Stub *p,
+ CORBA::Boolean collocated,
+ TAO_Abstract_ServantBase *servant);
+
+ typedef CORBA::AbstractBase_ptr _ptr_type;
+ typedef CORBA::AbstractBase_var _var_type;
+ typedef CORBA::AbstractBase_out _out_type;
+
+ static CORBA::AbstractBase_ptr _narrow (CORBA::AbstractBase_ptr obj
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ static CORBA::AbstractBase_ptr _duplicate (CORBA::AbstractBase_ptr obj);
+ static CORBA::AbstractBase_ptr _nil (void);
+
+ /// Used in the implementation of CORBA::Any
+ static void _tao_any_destructor (void*);
+
+ /// Spec required conversion operations
+ CORBA::Object_ptr _to_object (void);
+ CORBA::ValueBase *_to_value (void);
+
+ virtual CORBA::Boolean _is_a (const char *type_id
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+ virtual const char* _interface_repository_id (void) const;
+
+ /// TAO specific operation
+ virtual const char* _tao_obv_repository_id (void) const;
+ virtual CORBA::Boolean _tao_marshal_v (TAO_OutputCDR &strm) const;
+ virtual CORBA::Boolean _tao_unmarshal_v (TAO_InputCDR &strm);
+ virtual CORBA::Boolean _tao_match_formal_type (ptrdiff_t ) const;
+
+ /// Memmory management operations
+ virtual void _add_ref (void);
+ virtual void _remove_ref (void);
+
+ CORBA::Boolean _is_objref (void) const;
+
+ /// Return the stub object
+ TAO_Stub *_stubobj (void) const;
+
+ /// Acessors
+ CORBA::Boolean _is_collocated (void) const;
+ TAO_Abstract_ServantBase *_servant (void) const;
+ CORBA::Boolean _is_local (void) const;
+
+ /// Return the equivalent object reference.
+ /**
+ * The object is not refcounted. The caler should not put this in
+ * a var or some such thing. The memory is owned by <this>
+ * object.
+ */
+ CORBA::Object_ptr equivalent_objref (void);
+
+ protected:
+
+ AbstractBase (void);
+ AbstractBase (const AbstractBase &);
+
+ virtual ~AbstractBase (void);
+
+ protected:
+
+ CORBA::Boolean is_objref_;
+
+ private:
+
+ AbstractBase & operator= (const AbstractBase &);
+
+ virtual CORBA::ValueBase *_tao_to_value (void);
+
+ private:
+
+ TAO_Stub *concrete_stubobj_;
+ CORBA::Boolean is_collocated_;
+ TAO_Abstract_ServantBase *servant_;
+ CORBA::Boolean is_local_;
+
+ /// Our equivalent CORBA::Object version
+ /// @todo We may at some point of time should probably cache a
+ /// version of CORBA::ValueBase
+ CORBA::Object_var equivalent_obj_;
+ };
+}
+
+TAO_Valuetype_Export CORBA::Boolean
+operator<< (TAO_OutputCDR &, const CORBA::AbstractBase_ptr);
+
+TAO_Valuetype_Export CORBA::Boolean
+operator>> (TAO_InputCDR &, CORBA::AbstractBase_ptr &);
+
+/// Used in generated code if CORBA::AbstractBase is an argument or return type.
+namespace TAO
+{
+ template<>
+ class TAO_Valuetype_Export Arg_Traits<CORBA::AbstractBase>
+ : public Object_Arg_Traits_T<
+ CORBA::AbstractBase_ptr,
+ CORBA::AbstractBase_var,
+ CORBA::AbstractBase_out,
+ TAO::Objref_Traits<CORBA::AbstractBase>,
+ TAO::Any_Insert_Policy_Stream <CORBA::AbstractBase_ptr>
+ >
+ {
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/Valuetype/AbstractBase.inl"
+#endif /* __ACE_INLINE__) */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_ABSTRACTBASE_H */
diff --git a/TAO/tao/Valuetype/AbstractBase.inl b/TAO/tao/Valuetype/AbstractBase.inl
new file mode 100644
index 00000000000..f3d4dfb60e6
--- /dev/null
+++ b/TAO/tao/Valuetype/AbstractBase.inl
@@ -0,0 +1,58 @@
+// -*- C++ -*-
+//
+// $Id$
+
+#include "ace/OS_NS_string.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+CORBA::AbstractBase_ptr
+CORBA::AbstractBase::_nil (void)
+{
+ return static_cast <CORBA::AbstractBase_ptr> (0);
+}
+
+ACE_INLINE CORBA::AbstractBase_ptr
+CORBA::AbstractBase::_narrow (CORBA::AbstractBase_ptr obj
+ ACE_ENV_ARG_DECL_NOT_USED)
+{
+ return CORBA::AbstractBase::_duplicate (obj);
+}
+
+ACE_INLINE
+CORBA::Boolean
+CORBA::AbstractBase::_is_objref (void) const
+{
+ return this->is_objref_;
+}
+
+ACE_INLINE
+TAO_Stub *
+CORBA::AbstractBase::_stubobj (void) const
+{
+ return this->concrete_stubobj_;
+}
+
+ACE_INLINE
+CORBA::Boolean
+CORBA::AbstractBase::_is_collocated (void) const
+{
+ return this->is_collocated_;
+}
+
+ACE_INLINE
+TAO_Abstract_ServantBase *
+CORBA::AbstractBase::_servant (void) const
+{
+ return this->servant_;
+}
+
+ACE_INLINE
+CORBA::Boolean
+CORBA::AbstractBase::_is_local (void) const
+{
+ return this->is_local_;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Valuetype/AbstractBase_Invocation_Adapter.cpp b/TAO/tao/Valuetype/AbstractBase_Invocation_Adapter.cpp
new file mode 100644
index 00000000000..a0212ddde94
--- /dev/null
+++ b/TAO/tao/Valuetype/AbstractBase_Invocation_Adapter.cpp
@@ -0,0 +1,34 @@
+//$Id$
+#include "tao/Valuetype/AbstractBase_Invocation_Adapter.h"
+#include "tao/Valuetype/AbstractBase.h"
+
+ACE_RCSID (Valuetype,
+ AbstractBase_Invocation_Adapter,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ AbstractBase_Invocation_Adapter::AbstractBase_Invocation_Adapter (
+ CORBA::AbstractBase_ptr target,
+ Argument **args,
+ int arg_number,
+ const char *operation,
+ size_t op_len,
+ Collocation_Proxy_Broker *p,
+ Invocation_Type type,
+ Invocation_Mode mode)
+ : Invocation_Adapter (target->equivalent_objref (),
+ args,
+ arg_number,
+ operation,
+ op_len,
+ p,
+ type,
+ mode)
+ {
+ }
+} // End namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Valuetype/AbstractBase_Invocation_Adapter.h b/TAO/tao/Valuetype/AbstractBase_Invocation_Adapter.h
new file mode 100644
index 00000000000..afac495a54f
--- /dev/null
+++ b/TAO/tao/Valuetype/AbstractBase_Invocation_Adapter.h
@@ -0,0 +1,74 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file AbstractBase_Invocation_Adapter.h
+ *
+ * $Id$
+ *
+ * @author Balachandran Natarajan <bala@dre.vanderbilt.edu>
+ */
+//=============================================================================
+#ifndef TAO_ABSTRACTBASE_INVOCATION_ADAPTER_H
+#define TAO_ABSTRACTBASE_INVOCATION_ADAPTER_H
+
+#include /**/ "ace/pre.h"
+#include "tao/Valuetype/valuetype_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Invocation_Adapter.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace CORBA
+{
+ class AbstractBase;
+
+ typedef AbstractBase *AbstractBase_ptr;
+}
+namespace TAO
+{
+ class Argument;
+
+ class Collocation_Proxy_Broker;
+ class Profile_Transport_Resolver;
+
+ /**
+ * @class AbstractBase_Invocation_Adapter
+ *
+ *
+ */
+ class TAO_Valuetype_Export AbstractBase_Invocation_Adapter
+ : public Invocation_Adapter
+ {
+ public:
+ AbstractBase_Invocation_Adapter (
+ CORBA::AbstractBase_ptr target,
+ Argument **args,
+ int arg_number,
+ const char *operation,
+ size_t op_len,
+ Collocation_Proxy_Broker *cpb,
+ TAO::Invocation_Type type = TAO_TWOWAY_INVOCATION,
+ TAO::Invocation_Mode mode = TAO_SYNCHRONOUS_INVOCATION);
+
+ private:
+ // Don't allow default initializations
+ AbstractBase_Invocation_Adapter (void);
+
+ // Disallow copying and assignment.
+ AbstractBase_Invocation_Adapter (const AbstractBase_Invocation_Adapter &);
+ AbstractBase_Invocation_Adapter & operator= (
+ const AbstractBase_Invocation_Adapter &);
+
+ };
+} // End namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_INVOCATION_ADAPTER_H */
diff --git a/TAO/tao/Valuetype/AbstractBase_T.cpp b/TAO/tao/Valuetype/AbstractBase_T.cpp
new file mode 100644
index 00000000000..ff9f03fa562
--- /dev/null
+++ b/TAO/tao/Valuetype/AbstractBase_T.cpp
@@ -0,0 +1,119 @@
+// $Id$
+
+#ifndef TAO_ABSTRACT_BASE_T_CPP
+#define TAO_ABSTRACT_BASE_T_CPP
+
+#include "tao/Valuetype/AbstractBase_T.h"
+#include "tao/Valuetype/AbstractBase.h"
+#include "tao/Stub.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ template<typename T> T *
+ AbstractBase_Narrow_Utils<T>::narrow (
+ CORBA::AbstractBase_ptr obj,
+ const char *repo_id,
+ Proxy_Broker_Factory pbf
+ ACE_ENV_ARG_DECL)
+ {
+ if (CORBA::is_nil (obj))
+ {
+ return T::_nil ();
+ }
+
+ CORBA::Boolean const is_it =
+ obj->_is_a (
+ repo_id
+ ACE_ENV_ARG_PARAMETER
+ );
+ ACE_CHECK_RETURN (T::_nil ());
+
+ if (is_it == false)
+ {
+ return T::_nil ();
+ }
+
+ return
+ AbstractBase_Narrow_Utils<T>::unchecked_narrow (obj,
+ repo_id,
+ pbf
+ ACE_ENV_ARG_PARAMETER);
+ }
+
+ template<typename T> T *
+ AbstractBase_Narrow_Utils<T>::unchecked_narrow (
+ CORBA::AbstractBase_ptr obj,
+ Proxy_Broker_Factory pbf)
+ {
+ T *proxy = 0;
+
+ ACE_DECLARE_NEW_CORBA_ENV;
+
+ ACE_TRY
+ {
+ proxy =
+ AbstractBase_Narrow_Utils<T>::unchecked_narrow (
+ obj,
+ 0,
+ pbf
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ }
+ ACE_CATCHANY
+ {
+ // Consume and return proxy
+ return proxy;
+ }
+ ACE_ENDTRY;
+ ACE_CHECK_RETURN (proxy);
+
+ return proxy;
+ }
+
+ template<typename T> T *
+ AbstractBase_Narrow_Utils<T>::unchecked_narrow (
+ CORBA::AbstractBase_ptr obj,
+ const char *,
+ Proxy_Broker_Factory pbf
+ ACE_ENV_ARG_DECL)
+ {
+ if (CORBA::is_nil (obj))
+ {
+ return T::_nil ();
+ }
+
+ T_ptr proxy = T::_nil ();
+
+ if (obj->_is_objref ())
+ {
+ TAO_Stub* stub = obj->_stubobj ();
+
+ bool const collocated =
+ !CORBA::is_nil (stub->servant_orb_var ().in ())
+ && stub->optimize_collocation_objects ()
+ && obj->_is_collocated ()
+ && pbf != 0;
+
+ ACE_NEW_THROW_EX (proxy,
+ T (obj->_stubobj (),
+ collocated ? 1 : 0,
+ obj->_servant ()),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (proxy);
+ }
+ else
+ {
+ proxy = dynamic_cast<T *> (obj);
+ proxy->_add_ref ();
+ }
+
+ return proxy;
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_ABSTRACT_BASE_T_CPP */
diff --git a/TAO/tao/Valuetype/AbstractBase_T.h b/TAO/tao/Valuetype/AbstractBase_T.h
new file mode 100644
index 00000000000..dced03cf334
--- /dev/null
+++ b/TAO/tao/Valuetype/AbstractBase_T.h
@@ -0,0 +1,65 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file AbstractBase_T.h
+ *
+ * $Id$
+ *
+ * @author Balachandran Natarajan <bala@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_ABSTRACTBASE_T_H
+#define TAO_ABSTRACTBASE_T_H
+#include /**/ "ace/pre.h"
+
+#include "tao/Object_T.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace CORBA
+{
+ class AbstractBase;
+ typedef AbstractBase *AbstractBase_ptr;
+}
+
+namespace TAO
+{
+ template<typename T>
+ class AbstractBase_Narrow_Utils
+ {
+ public:
+ typedef T *T_ptr;
+
+ static T_ptr narrow (CORBA::AbstractBase_ptr,
+ const char *repo_id,
+ Proxy_Broker_Factory
+ ACE_ENV_ARG_DECL);
+
+ static T_ptr unchecked_narrow (CORBA::AbstractBase_ptr,
+ Proxy_Broker_Factory);
+
+ static T_ptr unchecked_narrow (CORBA::AbstractBase_ptr,
+ const char *repo_id,
+ Proxy_Broker_Factory
+ ACE_ENV_ARG_DECL);
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+#include "tao/Valuetype/AbstractBase_T.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
+#pragma implementation ("AbstractBase_T.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+#include /**/ "ace/post.h"
+#endif /*TAO_ABSTRACTBASE_T_H*/
diff --git a/TAO/tao/Valuetype/Bounded_Valuetype_Allocation_Traits_T.h b/TAO/tao/Valuetype/Bounded_Valuetype_Allocation_Traits_T.h
new file mode 100644
index 00000000000..321fa834aba
--- /dev/null
+++ b/TAO/tao/Valuetype/Bounded_Valuetype_Allocation_Traits_T.h
@@ -0,0 +1,65 @@
+#ifndef guard_bounded_valuetype_allocation_traits_hpp
+#define guard_bounded_valuetype_allocation_traits_hpp
+/**
+ * @file
+ *
+ * @brief Details can be found in the documentation for
+ * TAO::details::generic_sequence
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan
+ */
+
+#include "tao/Basic_Types.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+namespace details
+{
+
+template<typename T, class ref_traits, CORBA::ULong MAX, bool dummy>
+struct bounded_valuetype_allocation_traits
+{
+ typedef T value_type;
+ typedef ref_traits valuetype_traits;
+
+ inline static CORBA::ULong default_maximum()
+ {
+ return MAX;
+ }
+
+ inline static value_type * default_buffer_allocation()
+ {
+ return allocbuf(MAX);
+ }
+
+ inline static value_type * allocbuf(CORBA::ULong /* maximum */)
+ {
+ value_type * buffer = new value_type[MAX];
+ // no throw
+ valuetype_traits::zero_range(buffer, buffer + MAX);
+
+ return buffer;
+ }
+
+ inline static void freebuf(value_type * buffer)
+ {
+ valuetype_traits::release_range(buffer, buffer + MAX);
+ delete[] buffer;
+ }
+
+ inline static CORBA::ULong maximum()
+ {
+ return MAX;
+ }
+};
+
+} // namespace details
+} // namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif // guard_bounded_valuetype_allocation_traits_hpp
diff --git a/TAO/tao/Valuetype/Bounded_Valuetype_Sequence_T.h b/TAO/tao/Valuetype/Bounded_Valuetype_Sequence_T.h
new file mode 100644
index 00000000000..ef96347f10e
--- /dev/null
+++ b/TAO/tao/Valuetype/Bounded_Valuetype_Sequence_T.h
@@ -0,0 +1,144 @@
+#ifndef guard_bounded_valuetype_sequence_hpp
+#define guard_bounded_valuetype_sequence_hpp
+/**
+ * @file
+ *
+ * @brief Implement bounded sequences for object references.
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan
+ */
+#include "Bounded_Valuetype_Allocation_Traits_T.h"
+#include "Valuetype_Traits_T.h"
+#include "tao/Generic_Sequence_T.h"
+#include "Valuetype_Sequence_Element_T.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+
+template<typename object_t, typename object_t_var, CORBA::ULong MAX>
+class bounded_valuetype_sequence
+{
+public:
+ typedef object_t object_type;
+ typedef object_type * value_type;
+ typedef value_type const const_value_type;
+ typedef object_t_var object_type_var;
+
+ typedef details::valuetype_traits<object_type,object_type_var,true> element_traits;
+ typedef details::bounded_reference_allocation_traits<value_type,element_traits,MAX,true> allocation_traits;
+
+ typedef details::valuetype_sequence_element<element_traits> element_type;
+ typedef element_type subscript_type;
+ typedef value_type const & const_subscript_type;
+
+ typedef details::generic_sequence<value_type, allocation_traits, element_traits> implementation_type;
+
+ inline bounded_valuetype_sequence()
+ : impl_()
+ {}
+ inline bounded_valuetype_sequence(
+ CORBA::ULong length,
+ value_type * data,
+ CORBA::Boolean release)
+ : impl_(MAX, length, data, release)
+ {}
+
+ /* Use default ctor, operator= and dtor */
+ inline CORBA::ULong maximum() const {
+ return impl_.maximum();
+ }
+ inline CORBA::Boolean release() const {
+ return impl_.release();
+ }
+ inline CORBA::ULong length() const {
+ return impl_.length();
+ }
+
+ inline void length(CORBA::ULong length) {
+ implementation_type::range::check_length(length, MAX);
+ impl_.length(length);
+ }
+ inline value_type const & operator[](CORBA::ULong i) const {
+ return impl_[i];
+ }
+ inline element_type operator[](CORBA::ULong i) {
+ return element_type(impl_[i], release());
+ }
+ inline value_type const * get_buffer() const {
+ return impl_.get_buffer();
+ }
+ inline void replace(
+ CORBA::ULong length,
+ value_type * data,
+ CORBA::Boolean release = false) {
+ impl_.replace(MAX, length, data, release);
+ }
+ inline value_type * get_buffer(CORBA::Boolean orphan = false) {
+ return impl_.get_buffer(orphan);
+ }
+ inline void swap(bounded_valuetype_sequence & rhs) throw() {
+ impl_.swap(rhs.impl_);
+ }
+
+ static value_type * allocbuf(CORBA::ULong maximum)
+ {
+ return implementation_type::allocbuf(maximum);
+ }
+ static void freebuf(value_type * buffer)
+ {
+ implementation_type::freebuf(buffer);
+ }
+
+
+private:
+ implementation_type impl_;
+};
+
+
+ template <typename stream, typename object_t, typename object_t_var, CORBA::ULong MAX>
+ bool marshal_sequence(stream & strm, const TAO::bounded_valuetype_sequence<object_t, object_t_var, MAX> & source) {
+ typedef typename TAO::bounded_valuetype_sequence<object_t, object_t_var, MAX>::object_type seq_object_t;
+ const ::CORBA::ULong length = source.length ();
+ if (!(strm << length)) {
+ return false;
+ }
+ for(CORBA::ULong i = 0; i < length; ++i) {
+ if (!TAO::Objref_Traits<seq_object_t>::marshal (source[i], strm)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ template <typename stream, typename object_t, typename object_t_var, CORBA::ULong MAX>
+ bool demarshal_sequence(stream & strm, TAO::bounded_valuetype_sequence<object_t, object_t_var, MAX> & target) {
+ typedef TAO::bounded_valuetype_sequence<object_t, object_t_var, MAX> sequence;
+ ::CORBA::ULong new_length = 0;
+ if (!(strm >> new_length)) {
+ return false;
+ }
+ if ((new_length > strm.length()) || (new_length > target.maximum ())) {
+ return false;
+ }
+ sequence tmp;
+ tmp.length(new_length);
+ typename sequence::value_type * buffer = tmp.get_buffer();
+ for(CORBA::ULong i = 0; i < new_length; ++i) {
+ if (!(strm >> buffer[i])) {
+ return false;
+ }
+ }
+ tmp.swap(target);
+ return true;
+ }
+
+} // namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+
+#endif // guard_bounded_valuetype_sequence_hpp
diff --git a/TAO/tao/Valuetype/Sequence_T.h b/TAO/tao/Valuetype/Sequence_T.h
new file mode 100644
index 00000000000..db9c2c48aa2
--- /dev/null
+++ b/TAO/tao/Valuetype/Sequence_T.h
@@ -0,0 +1,6 @@
+// $Id$
+//
+
+#include "tao/Valuetype/Bounded_Valuetype_Sequence_T.h"
+#include "tao/Valuetype/Unbounded_Valuetype_Sequence_T.h"
+
diff --git a/TAO/tao/Valuetype/StringValue.pidl b/TAO/tao/Valuetype/StringValue.pidl
new file mode 100644
index 00000000000..fd31cd3a930
--- /dev/null
+++ b/TAO/tao/Valuetype/StringValue.pidl
@@ -0,0 +1,23 @@
+// -*- IDL -*-
+//
+// $Id$
+
+// ================================================================
+// Standard Value Box Definitions
+// as specified in OMG document formal/01-12-35
+// ================================================================
+
+
+#ifndef TAO_CORBA_STRING_VALUE_IDL
+#define TAO_CORBA_STRING_VALUE_IDL
+
+#pragma prefix "omg.org"
+
+module CORBA
+{
+ valuetype StringValue string;
+ valuetype WStringValue wstring;
+
+};
+
+#endif /* TAO_CORBA_STRING_VALUE_IDL */
diff --git a/TAO/tao/Valuetype/TAO_Valuetype.pc.in b/TAO/tao/Valuetype/TAO_Valuetype.pc.in
new file mode 100644
index 00000000000..2358de06bdd
--- /dev/null
+++ b/TAO/tao/Valuetype/TAO_Valuetype.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: TAO_Valuetype
+Description: TAO Valuetype Library
+Requires: TAO_AnyTypeCode, TAO
+Version: @VERSION@
+Libs: -L${libdir} -lTAO_Valuetype
+Cflags: -I${includedir}
diff --git a/TAO/tao/Valuetype/TAO_Valuetype.rc b/TAO/tao/Valuetype/TAO_Valuetype.rc
new file mode 100644
index 00000000000..fe7afb3c6f9
--- /dev/null
+++ b/TAO/tao/Valuetype/TAO_Valuetype.rc
@@ -0,0 +1,30 @@
+#include "..\Version.h"
+
+1 VERSIONINFO
+ FILEVERSION TAO_MAJOR_VERSION,TAO_MINOR_VERSION,TAO_BETA_VERSION,0
+ PRODUCTVERSION TAO_MAJOR_VERSION,TAO_MINOR_VERSION,TAO_BETA_VERSION,0
+ FILEFLAGSMASK 0x3fL
+ FILEFLAGS 0x0L
+ FILEOS 0x4L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904B0"
+ BEGIN
+ VALUE "FileDescription", "Valuetype\0"
+ VALUE "FileVersion", TAO_VERSION "\0"
+ VALUE "InternalName", "TAO_ValuetypeDLL\0"
+ VALUE "LegalCopyright", "\0"
+ VALUE "LegalTrademarks", "\0"
+ VALUE "OriginalFilename", "TAO_Valuetype.DLL\0"
+ VALUE "ProductName", "TAO\0"
+ VALUE "ProductVersion", TAO_VERSION "\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
diff --git a/TAO/tao/Valuetype/Unbounded_Valuetype_Allocation_Traits_T.h b/TAO/tao/Valuetype/Unbounded_Valuetype_Allocation_Traits_T.h
new file mode 100644
index 00000000000..d407e683109
--- /dev/null
+++ b/TAO/tao/Valuetype/Unbounded_Valuetype_Allocation_Traits_T.h
@@ -0,0 +1,69 @@
+#ifndef guard_unbounded_valuetype_allocation_traits_hpp
+#define guard_unbounded_valuetype_allocation_traits_hpp
+/**
+ * @file
+ *
+ * @brief Details can be found in the documentation for
+ * TAO::details::generic_sequence
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan
+ */
+
+#include "tao/Basic_Types.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+namespace details
+{
+
+template<typename T, class ref_traits, bool dummy>
+struct unbounded_valuetype_allocation_traits
+{
+ typedef T value_type;
+ typedef ref_traits valuetype_traits;
+
+ inline static CORBA::ULong default_maximum()
+ {
+ return 0;
+ }
+
+ inline static value_type * default_buffer_allocation()
+ {
+ return 0;
+ }
+
+ inline static value_type * allocbuf(CORBA::ULong maximum)
+ {
+ value_type * buffer = new value_type[maximum + 1];
+ reinterpret_cast<value_type**>(buffer)[0] = buffer + maximum + 1;
+
+ // no throw
+ valuetype_traits::zero_range(buffer + 1, buffer + maximum + 1);
+
+ return buffer + 1;
+ }
+
+ inline static void freebuf(value_type * buffer)
+ {
+ if(buffer != 0)
+ {
+ value_type * begin = buffer - 1;
+ value_type * end = reinterpret_cast<value_type*>(*begin);
+ valuetype_traits::release_range(buffer, end);
+
+ buffer = begin;
+ }
+ delete[] buffer;
+ }
+};
+
+} // namespace details
+} // namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif // guard_unbounded_valuetype_allocation_traits_hpp
diff --git a/TAO/tao/Valuetype/Unbounded_Valuetype_Sequence_T.h b/TAO/tao/Valuetype/Unbounded_Valuetype_Sequence_T.h
new file mode 100644
index 00000000000..9695f8c940e
--- /dev/null
+++ b/TAO/tao/Valuetype/Unbounded_Valuetype_Sequence_T.h
@@ -0,0 +1,145 @@
+#ifndef guard_unbounded_valuetype_sequence_hpp
+#define guard_unbounded_valuetype_sequence_hpp
+/**
+ * @file
+ *
+ * @brief Implement unbounded sequences for value types.
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan
+ */
+#include "Unbounded_Valuetype_Allocation_Traits_T.h"
+#include "Valuetype_Traits_T.h"
+#include "tao/Generic_Sequence_T.h"
+#include "Valuetype_Sequence_Element_T.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+
+template<typename object_t, typename object_t_var>
+class unbounded_valuetype_sequence
+{
+public:
+ typedef object_t object_type;
+ typedef object_type * value_type;
+ typedef value_type const const_value_type;
+
+ typedef details::valuetype_traits<object_type,object_t_var,true> element_traits;
+ typedef details::unbounded_reference_allocation_traits<value_type,element_traits,true> allocation_traits;
+
+ typedef details::valuetype_sequence_element<element_traits> element_type;
+ typedef element_type subscript_type;
+ typedef value_type const & const_subscript_type;
+
+ typedef details::generic_sequence<value_type, allocation_traits, element_traits> implementation_type;
+
+ inline unbounded_valuetype_sequence()
+ : impl_()
+ {}
+ inline explicit unbounded_valuetype_sequence(CORBA::ULong maximum)
+ : impl_(maximum)
+ {}
+ inline unbounded_valuetype_sequence(
+ CORBA::ULong maximum,
+ CORBA::ULong length,
+ value_type * data,
+ CORBA::Boolean release)
+ : impl_(maximum, length, data, release)
+ {}
+
+ /* Use default ctor, operator= and dtor */
+ inline CORBA::ULong maximum() const {
+ return impl_.maximum();
+ }
+ inline CORBA::Boolean release() const {
+ return impl_.release();
+ }
+ inline CORBA::ULong length() const {
+ return impl_.length();
+ }
+
+ inline void length(CORBA::ULong length) {
+ impl_.length(length);
+ }
+ inline value_type const & operator[](CORBA::ULong i) const {
+ return impl_[i];
+ }
+ inline element_type operator[](CORBA::ULong i) {
+ return element_type(impl_[i], release());
+ }
+ inline value_type const * get_buffer() const {
+ return impl_.get_buffer();
+ }
+ inline void replace(
+ CORBA::ULong maximum,
+ CORBA::ULong length,
+ value_type * data,
+ CORBA::Boolean release = false) {
+ impl_.replace(maximum, length, data, release);
+ }
+ inline value_type * get_buffer(CORBA::Boolean orphan = false) {
+ return impl_.get_buffer(orphan);
+ }
+ inline void swap(unbounded_valuetype_sequence & rhs) throw() {
+ impl_.swap(rhs.impl_);
+ }
+
+ static value_type * allocbuf(CORBA::ULong maximum)
+ {
+ return implementation_type::allocbuf(maximum);
+ }
+ static void freebuf(value_type * buffer)
+ {
+ implementation_type::freebuf(buffer);
+ }
+
+
+private:
+ implementation_type impl_;
+};
+
+ template <typename stream, typename object_t, typename object_t_var>
+ bool marshal_sequence(stream & strm, const TAO::unbounded_valuetype_sequence<object_t, object_t_var> & source) {
+ ::CORBA::ULong const length = source.length ();
+ if (!(strm << length)) {
+ return false;
+ }
+ for(CORBA::ULong i = 0; i < length; ++i) {
+ if (!(strm << source[i])) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ template <typename stream, typename object_t, typename object_t_var>
+ bool demarshal_sequence(stream & strm, TAO::unbounded_valuetype_sequence <object_t, object_t_var> & target) {
+ typedef typename TAO::unbounded_valuetype_sequence <object_t, object_t_var> sequence;
+ ::CORBA::ULong new_length = 0;
+ if (!(strm >> new_length)) {
+ return false;
+ }
+ if (new_length > strm.length()) {
+ return false;
+ }
+ sequence tmp(new_length);
+ tmp.length(new_length);
+ typename sequence::value_type * buffer = tmp.get_buffer();
+ for(CORBA::ULong i = 0; i < new_length; ++i) {
+ if (!(strm >> buffer[i])) {
+ return false;
+ }
+ }
+ tmp.swap(target);
+ return true;
+ }
+
+} // namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+
+#endif // guard_unbounded_valuetype_sequence_hpp
diff --git a/TAO/tao/Valuetype/ValueBase.cpp b/TAO/tao/Valuetype/ValueBase.cpp
new file mode 100644
index 00000000000..dce7528a6f6
--- /dev/null
+++ b/TAO/tao/Valuetype/ValueBase.cpp
@@ -0,0 +1,918 @@
+// $Id$
+
+#include "tao/AnyTypeCode/Null_RefCount_Policy.h"
+#include "tao/AnyTypeCode/Alias_TypeCode_Static.h"
+#include "tao/AnyTypeCode/Value_TypeCode_Static.h"
+#include "tao/AnyTypeCode/TypeCode_Constants.h"
+
+#include "tao/Valuetype/ValueBase.h"
+#include "tao/Valuetype/ValueFactory.h"
+
+#include "tao/CDR.h"
+#include "tao/ORB.h"
+#include "tao/ORB_Core.h"
+#include "tao/debug.h"
+#include "ace/OS_NS_string.h"
+#include "ace/CORBA_macros.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/Valuetype/ValueBase.inl"
+#endif /* ! __ACE_INLINE__ */
+
+
+ACE_RCSID (Valuetype,
+ ValueBase,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Static operations in namespace CORBA.
+
+void
+CORBA::add_ref (CORBA::ValueBase *val)
+{
+ if (val)
+ {
+ val->_add_ref ();
+ }
+}
+
+void
+CORBA::remove_ref (CORBA::ValueBase *val)
+{
+ if (val)
+ {
+ val->_remove_ref ();
+ }
+}
+
+// ***********************************************************************
+
+TAO_ChunkInfo::TAO_ChunkInfo(CORBA::Boolean do_chunking,
+ CORBA::Long init_level)
+ : chunking_(do_chunking),
+ value_nesting_level_(init_level),
+ chunk_size_pos_ (0),
+ length_to_chunk_octets_pos_ (0),
+ chunk_octets_end_pos_ (0)
+{
+}
+
+CORBA::ValueBase::ValueBase (void)
+ : is_truncatable_(0),
+ chunking_(0)
+{
+}
+
+CORBA::ValueBase::ValueBase (const ValueBase& val)
+ : is_truncatable_(val.is_truncatable_),
+ chunking_(val.chunking_)
+{
+}
+
+CORBA::ValueBase::~ValueBase (void)
+{
+}
+
+CORBA::ValueBase*
+CORBA::ValueBase::_downcast (CORBA::ValueBase *vt)
+{
+ // Every vt is a CORBA::ValueBase :-).
+ return vt;
+}
+
+void
+CORBA::ValueBase::_tao_any_destructor (void *x)
+{
+ CORBA::ValueBase *tmp = static_cast<CORBA::ValueBase *> (x);
+ CORBA::remove_ref (tmp);
+}
+
+// OBV marshaling in principle:
+// _tao_marshal () is called from the CDR operator<< ()
+// to marshal a valuetype. To marshal the state
+// it calls (virtual) _tao_marshal_v () (IDL generated) on itself
+// which 'jumps' to the most derived valuetype class. This function
+// further calls (inline) _tao_marshal_state, which is generated from
+// IDL too and does the marshaling of state members and base classes
+// (before, if any) actually.
+// Fragmentation (chunking) needs some cooperation with the CDR stream.
+// It needs to keep track of the state we're in:
+// (outside chunk, beginning of chunk - no data, inside chunk and
+// the nesting level of valuetypes. (The chunks itself are not nested.))
+
+// (see CORBA 2.3 GIOP 15.3.4)
+
+// %! yet much to do ... look for +++ !
+
+
+ // 1. Is 'this' yet marshalled ? (->1a)
+ // If not then mark 'this' as marshalled. (->2) +++
+ // Or is it null ? (write null_ref and return ok)
+ // 1a. Put indirection and return successfull.
+
+ // 2. if (chunking) and we are in a chunk (look in strm),
+ // end the chunk by writing its length at its start.
+ // This is the responsibility of the CDR stream.
+ // But if nothing is writtern in this chunk yet,
+ // we want to overwrite the place of the dummy blocksize-tag
+ // with our <value-tag>.
+ // Increase the nesting level of valuetypes.
+
+ // 3. Build <value-tag>, which states if chunking is used
+ // and if type information ((list of) repository id(s))
+ // is provided. The latter is necessary if the formal_type_id
+ // is unequal the 'true derived' type of this object.
+
+ // 4. Marshal type information.
+
+ // 5. if (chunking) let room for a blocksize-tag. (i.e. write Long)
+
+ // 6. Now marshal state members. (%! Problem when state is empty
+ // and chunked encoding is used.)
+
+ // 7. if (chunking) let strm overwrite the last blocksize tag
+ // with its concrete value.
+
+ // 8. if (chunking) write an end tag, or (optimization) let the CDR
+ // care for collecting all end tags of nested values (e.g. linked
+ // list), so that only one end tag at all must be written.
+
+CORBA::Boolean
+CORBA::ValueBase::_tao_marshal (TAO_OutputCDR &strm,
+ const CORBA::ValueBase *this_,
+ ptrdiff_t formal_type_id)
+{
+ if ( ! write_special_value (strm, this_))
+ {
+ return write_value (strm, this_, formal_type_id);
+ }
+
+ return true;
+}
+
+
+CORBA::Boolean
+CORBA::ValueBase::_tao_unmarshal (TAO_InputCDR &strm,
+ CORBA::ValueBase *&new_object)
+{
+ // This is for the special case only that one unmarshals in order
+ // to assign the newly created object directly to a ValueBase pointer.
+ // Implementation is like a specialized one (in TC.cpp, if T.idl is source).
+ // basically do:
+ // ValueBase::_tao_unmarshal_pre ()
+ // (Gets factory or possible a null or an existing object.
+ // Then the job is done. On an existing (backreferenced) object
+ // do a cast and a type check)
+ // new_object = factory->create_for_unmarshal ()
+ // (with apropriate cast)
+ // new_object->_tao_unmarshal_v ()
+ // new_object->_tao_unmarshal_post ()
+
+ CORBA::Boolean const retval =
+ CORBA::ValueBase::_tao_unmarshal_pre (strm,
+ new_object,
+ 0);
+
+ if (!retval)
+ {
+ return false;
+ }
+
+ if (new_object != 0)
+ {
+ if (!new_object->_tao_unmarshal_v (strm))
+ return false;
+ }
+
+ return retval;
+}
+
+
+CORBA::Boolean
+CORBA::ValueBase::_tao_unmarshal_pre (TAO_InputCDR &strm,
+ CORBA::ValueBase *&valuetype,
+ const char * const repo_id)
+{
+ // Value factories are reference counted, when we get a new value factory
+ // from the ORB, its reference count is increased.
+ CORBA::ValueFactory_var factory;
+
+ // %! yet much to do ... look for +++ !
+
+ // 1. Get the <value-tag> (else it may be <indirection-tag> or <null-ref>).
+ // Is object yet unmarshalled (<indirection-tag> is set) ? (->1a)
+ // Is <null-ref> given ? Set 0 and return ok.
+ // 1a. Lookup the real address in memory, which should be aligned +++
+ // to CORBA::ValueBase. Its possible at this point that worse
+ // type mismatch gets by undetected, if the CDR stream fakes.
+ // So the type should be checked ... +++
+
+ // 2. Now at this point it must be a <value-tag> (error else).
+ // if (chunking) check that any last chunk ends with matching
+ // size. If not raise marshal exception.
+ // Increase the nesting level of valuetypes.
+
+ // 3. if (chunking) read and record the blocksize-tag.
+
+ // 4. Unmarshal type information and lookup factory.
+ // If no type information is given in the CDR encoding, as told
+ // from the <value-tag>, then use the repository id parameter
+ // (it _must_ be right).
+
+ CORBA::Long valuetag;
+ Repository_Id_List ids;
+
+ if (! strm.read_long(valuetag))
+ return false;
+
+ if (TAO_OBV_GIOP_Flags::is_indirection_tag (valuetag))
+ {
+ //@@TODO: read indirection value.
+ if (TAO_debug_level > 0)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO does not currently support valuetype indirecton\n")));
+ return false;
+ }
+ else if (TAO_OBV_GIOP_Flags::is_null_ref (valuetag))
+ {
+ // null reference is unmarshalled.
+ valuetype = 0;
+ return true;
+ }
+ else if (TAO_OBV_GIOP_Flags::has_single_type_info (valuetag))
+ {
+ ACE_CString id;
+ if (! strm.read_string(id))
+ return false;
+ ids.push_back (id);
+ }
+ else if (TAO_OBV_GIOP_Flags::has_list_type_info (valuetag))
+ {
+ if (! read_repository_ids(strm, ids))
+ return false;
+ }
+ else if (TAO_OBV_GIOP_Flags::has_no_type_info (valuetag))
+ {
+ ids.push_back (repo_id);
+ }
+ else
+ {
+ if (TAO_debug_level > 0)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) unknown value tag: %x\n"), valuetag));
+ return false;
+ }
+
+ TAO_ORB_Core *orb_core = strm.orb_core ();
+
+ if (orb_core == 0)
+ {
+ orb_core = TAO_ORB_Core_instance ();
+
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_WARNING,
+ "TAO (%P|%t) WARNING: extracting valuetype using "
+ "default ORB_Core\n"));
+ }
+ }
+
+ CORBA::Boolean require_truncation = false;
+ CORBA::Boolean const chunking = TAO_OBV_GIOP_Flags::is_chunked (valuetag);
+
+ CORBA::ULong const num_ids = ids.size ();
+ // Find the registered factory for this unmarshalling valuetype. If any
+ // factory for the valuetype in its truncatable derivation hierarchy
+ // is registered, the factory is used to create value for unmarshalling.
+ for (CORBA::ULong i = 0; i < num_ids; ++i)
+ {
+ factory = orb_core->orb ()->lookup_value_factory (ids[i].c_str ());
+ if (factory.in() != 0)
+ {
+ if (i != 0 && chunking)
+ {
+ require_truncation = true;
+ }
+ break;
+ }
+ }
+
+ if (factory.in() == 0)
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) OBV factory is null, id = %s\n"), repo_id));
+ }
+ ACE_THROW_RETURN (CORBA::MARSHAL (CORBA::OMGVMCID | 1,
+ CORBA::COMPLETED_MAYBE),
+ false);
+ }
+
+
+ valuetype = factory->create_for_unmarshal ();
+
+ if (require_truncation)
+ valuetype->truncation_hook ();
+
+ if (valuetype == 0)
+ {
+ return false; // %! except.?
+ }
+
+ valuetype->chunking_ = chunking;
+
+ return true;
+}
+
+CORBA::Boolean
+CORBA::ValueBase::_tao_unmarshal_post (TAO_InputCDR &)
+{
+ // (... called from T::_tao_unmarshal)
+ // 7. if (chunking) check the last blocksize tag for correct value. +++
+ // And if we're gonna to truncate, skip all the state of the more
+ // derived classes. (But it might need to be accessed again,
+ // if there are embedded objects which are referenced later
+ // in this CDR encoding stream.)
+
+ // 8. if (chunking) there must be some end tag. Let the CDR stream deal
+ // with this (and decrease the nesting level of valuetypes).
+ // Also the CDR stream must check for eventually outstanding end tags
+ // at the end of the stream which have to cause a marshal
+ // exception there.
+
+ return true;
+}
+
+
+CORBA::Boolean
+CORBA::ValueBase::_tao_validate_box_type (TAO_InputCDR &strm,
+ const char * const repo_id_expected,
+ CORBA::Boolean & null_object)
+{
+ CORBA::Long value_tag;
+
+ // todo: no handling for indirection yet
+
+ if (!strm.read_long (value_tag))
+ {
+ return false;
+ }
+
+ if (TAO_OBV_GIOP_Flags::is_null_ref (value_tag))
+ { // ok, null reference unmarshaled
+ null_object = true;
+ return true;
+ }
+ null_object = false;
+
+ if (!TAO_OBV_GIOP_Flags::is_value_tag (value_tag))
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("!CORBA::ValueBase::_tao_validate_box_type ")
+ ACE_TEXT ("not value_tag\n")));
+ return false;
+ }
+
+ if (TAO_OBV_GIOP_Flags::has_codebase_url (value_tag))
+ { // Demarshal the codebase url (but we won't be using it).
+
+ CORBA::String_var codebase_url;
+
+ if (!strm.read_string (codebase_url.inout ()))
+ {
+ return false;
+ }
+ }
+
+ if (TAO_OBV_GIOP_Flags::has_no_type_info (value_tag))
+ { // No type information so assume it is the correct type.
+ return true;
+ }
+
+ if (TAO_OBV_GIOP_Flags::has_single_type_info (value_tag))
+ { // Demarshal the repository id and check if it is the expected one.
+
+ CORBA::String_var repo_id_stream;
+
+ if (!strm.read_string (repo_id_stream.inout ()))
+ {
+ return false;
+ }
+
+ if (!ACE_OS::strcmp (repo_id_stream.in (), repo_id_expected))
+ { // Repository ids matched as expected
+ return true;
+ }
+ }
+
+ if (TAO_OBV_GIOP_Flags::has_list_type_info (value_tag))
+ { // Don't know how to handle a repository id list. It does not
+ // make sense for a value box anyway.
+ return false;
+ }
+
+ return false;
+}
+
+
+// =================== methods for chunking ====================
+
+
+CORBA::Boolean
+CORBA::ValueBase::write_special_value(TAO_OutputCDR &strm,
+ const CORBA::ValueBase *value)
+{
+ // If the 'value' is null then write the null value to the stream.
+ if (value == 0)
+ {
+ return strm.write_long (TAO_OBV_GIOP_Flags::Null_tag);
+ }
+ //@@TODO: Check if the value is already written to stream. If it is then
+ // put indirection and return successful, otherwise does nothing
+ // and returns false.
+ else
+ {
+ // value not handled by this method - other code will write the value.
+ return false;
+ }
+}
+
+
+CORBA::Boolean
+CORBA::ValueBase::write_value(TAO_OutputCDR &strm,
+ const CORBA::ValueBase * value,
+ ptrdiff_t formal_type_id)
+{
+ if (! value->write_value_header (strm, formal_type_id))
+ return false;
+
+ if (! value->_tao_marshal_v (strm))
+ return false;
+
+ return true;
+}
+
+
+CORBA::Boolean
+CORBA::ValueBase::write_value_header(TAO_OutputCDR &strm,
+ ptrdiff_t formal_type_id) const
+{
+#if defined (TAO_HAS_OPTIMIZED_VALUETYPE_MARSHALING)
+ // this case allows TAO to avoid marshaling the typeID for values
+ // where the actual type matches the formal type (ie not a derived
+ // type).
+ //
+ // I would much prefer that there be a way to have a -ORB option to
+ // control this behavior, but for now there is no reference to the
+ // ORB Core available during marshaling (there is during unmarshaling)
+ // and no other way to communicate such configuration values.
+
+ CORBA::Boolean const is_formal_type =
+ this->_tao_match_formal_type (formal_type_id);
+#else
+ // Unfortunately, all versions of tao prior to TAO 1.5.2 did not
+ // support unmarshaling of valuetypes that did not explicitly
+ // marshal the type id. At least it is benign to always encode the
+ // typecode value, even if it can be a little verbose.
+ CORBA::Boolean const is_formal_type =
+ false;
+ ACE_UNUSED_ARG (formal_type_id);
+#endif /* TAO_HAS_OPTIMIZED_VALUETYPE_MARSHALING */
+
+ // Get the list of repository ids for this valuetype.
+ Repository_Id_List repository_ids;
+ this->_tao_obv_truncatable_repo_ids (repository_ids);
+ CORBA::Long const num_ids = static_cast <CORBA::Long> (repository_ids.size ());
+
+ // Build <value-tag>, which states if chunking is used
+ // and if type information ((list of) repository id(s))
+ // is provided. The latter is necessary if the formal_type_id
+ // is unequal the 'true derived' type of this object.
+ CORBA::Long valuetag = TAO_OBV_GIOP_Flags::Value_tag_base;
+
+ // Truncatable value type, must use chunking and list all repository
+ // ids in its "truncatable" derivation hierarchy.
+ if (this->is_truncatable_ || this->chunking_)
+ valuetag |= TAO_OBV_GIOP_Flags::Chunking_tag_sigbits;
+
+ if (!is_formal_type || this->is_truncatable_)
+ valuetag |= TAO_OBV_GIOP_Flags::Type_info_single;
+
+ if (num_ids > 1)
+ valuetag |= TAO_OBV_GIOP_Flags::Type_info_list;
+
+ // Write <value-tag>.
+ if (!strm.write_long (valuetag))
+ return false;
+
+ if (num_ids > 1 && !strm.write_long (num_ids))
+ return false;
+
+ if (this->is_truncatable_ ||
+ !is_formal_type ||
+ num_ids > 1)
+ {
+ // Marshal type information.
+ for( CORBA::Long i = 0; i < num_ids; ++i )
+ {
+ if (! strm.write_string (repository_ids[i]))
+ return false;
+ }
+ }
+
+ return true;
+}
+
+// this method is called by the IDL generated _tao_marshal_state() method.
+CORBA::Boolean
+TAO_ChunkInfo::start_chunk(TAO_OutputCDR &strm)
+{
+ // If chunking, reserve the space for the chunk size of next chunk
+ // and increase the nesting level.
+ if (this->chunking_)
+ {
+ if (! reserve_chunk_size(strm))
+ return false;
+ this->value_nesting_level_ ++;
+ }
+ return true;
+}
+
+// this method is called by the IDL generated _tao_marshal_state() method.
+CORBA::Boolean
+TAO_ChunkInfo::end_chunk(TAO_OutputCDR &strm)
+{
+ if (this->chunking_)
+ {
+ // Write actual chunk size at the reserved chunk size place.
+ if (! this->write_previous_chunk_size(strm))
+ return false;
+
+ // Write an end tag which is negation of value_nesting_level_.
+ if (! strm.write_long(- this->value_nesting_level_))
+ return false;
+
+ // -- this->value_nesting_level_;
+ if ( -- this->value_nesting_level_ == 0 )
+ {
+ // ending chunk for outermost value
+ this->chunking_ = false;
+ }
+ }
+ return true;
+}
+
+
+CORBA::Boolean
+TAO_ChunkInfo::write_previous_chunk_size(TAO_OutputCDR &strm)
+{
+ if (this->chunk_size_pos_ != 0)
+ {
+ // Calculate the chunk size.
+ CORBA::Long const chunk_size = strm.total_length () - this->length_to_chunk_octets_pos_;
+
+ // This should not happen since this is called in end_chunk() and
+ // the idl generated code always have the matched start_chunk() and
+ // end_chunk() pair. There is always data written to the stream between
+ // the start_chunk() and end_chunk() calls.
+ if (chunk_size == 0)
+ return false;
+
+ // Write the actual chunk size to the reserved chunk size position
+ // in the stream.
+ if (!strm.replace (chunk_size, this->chunk_size_pos_))
+ return false;
+
+ // We finish writing the actual chunk size, now we need reset the state.
+ this->chunk_size_pos_ = 0;
+ this->length_to_chunk_octets_pos_ = 0;
+ }
+
+ return true;
+}
+
+
+CORBA::Boolean
+TAO_ChunkInfo::reserve_chunk_size(TAO_OutputCDR &strm)
+{
+ // This is called in the start_chunk().
+ // Reserve the chunk size the first time the start_chunk () is called
+ // if there are several start_chunk () called continuously without
+ // calling end_chunk (). This could happen in the _tao_marshal_state()
+ // in the most derived valuetype.
+
+ if (this->chunk_size_pos_ == 0)
+ {
+ // Align the wr_ptr before we reserve the space for chunk size.
+ strm.align_write_ptr (ACE_CDR::LONG_SIZE);
+ // Remember begin of the chunk (at chunk size position) that is needed
+ // when we write back actual chunk size to the stream.
+ this->chunk_size_pos_ = strm.current ()->wr_ptr ();
+
+ // Insert four bytes here as a place-holder, we need to go back
+ // later and write the actual size.
+ if (! strm.write_long (0))
+ return false;
+
+ // Remember length before writing chunk data. This is used to calculate
+ // the actual size of the chunk.
+ this->length_to_chunk_octets_pos_ = strm.total_length ();
+ }
+
+ return true;
+}
+
+CORBA::Boolean
+TAO_ChunkInfo::handle_chunking (TAO_InputCDR &strm)
+{
+ if (!this->chunking_)
+ return true;
+
+ char* the_rd_ptr = strm.start()->rd_ptr ();
+
+ //This case could happen if a handle_chunking() reads a chunk size
+ //and then calls the handle_chunking() again without reading the chunk data.
+ //The handle_chunking() called continuously without reading the chunk data
+ //only happens at the beginning of _tao_unmarshal_state() in a valuetype
+ //that has parents.
+ if (the_rd_ptr < this->chunk_octets_end_pos_)
+ {
+ this->value_nesting_level_ ++;
+ return true;
+ }
+
+ //Safty check if reading is out of range of current chunk.
+ if (this->chunk_octets_end_pos_ != 0 && the_rd_ptr > this->chunk_octets_end_pos_)
+ return false;
+
+ // Read a long value that might be an endtag, the chunk size or the value tag
+ // of the nested valuetype.
+ CORBA::Long tag;
+ if (!strm.read_long(tag))
+ return false;
+
+ if (tag < 0)
+ {
+ // tag is an end tag
+ if (-tag > this->value_nesting_level_)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("%P|%t) received end tag %d > value_nesting_level %d\n"),
+ -tag, this->value_nesting_level_),
+ false);
+ }
+ this->value_nesting_level_ = - tag;
+ this->value_nesting_level_--;
+
+
+ this->chunk_octets_end_pos_ = 0;
+
+ // Continue reading so that we can read the outmost endtag. This would
+ // simplify the implementation in the derived valuetype.
+ if (this->value_nesting_level_ > 0)
+ {
+ this->handle_chunking(strm);
+ }
+ }
+ else if (tag < TAO_OBV_GIOP_Flags::Value_tag_base)
+ {
+ // Read the chunk size of another chunk.
+ this->chunk_octets_end_pos_ = strm.rd_ptr () + tag;
+ this->value_nesting_level_ ++;
+ }
+ else // (tag >= 0x7fffff00)
+ {
+ // This should not happen since the valuetag of the nested values are always
+ // unmarshalled in the ValueBase::_tao_unmarshal_pre().
+ return false;
+ }
+
+ return true;
+}
+
+
+CORBA::Boolean
+TAO_ChunkInfo::skip_chunks (TAO_InputCDR &strm)
+{
+ if (!this->chunking_)
+ return true;
+
+ // This function is called after reading data of the truncated parent and
+ // skips the remaining chunks until the outmost endtag (-1).
+ // The tag read here is suppoused to be an endtag.
+ CORBA::Long tag;
+ if (!strm.read_long(tag))
+ return false;
+
+ // end of the whole valuetype.
+ if (tag == -1)
+ return true;
+ else if (tag < 0)
+ {
+ // continue skip the chunk.
+ return this->skip_chunks (strm);
+ }
+ else if (tag < TAO_OBV_GIOP_Flags::Value_tag_base)
+ {
+ // Read the chunk size and move forward to skip the data.
+ ACE_Message_Block* current = const_cast<ACE_Message_Block*>(strm.start ());
+ current->rd_ptr (tag);
+ return this->skip_chunks (strm);
+ }
+ else
+ return false;
+}
+
+CORBA::Boolean
+CORBA::ValueBase::read_repository_ids(ACE_InputCDR& strm, Repository_Id_List& ids)
+{
+ CORBA::Long num_ids;
+ if (!strm.read_long(num_ids))
+ return false;
+
+ if (num_ids == TAO_OBV_GIOP_Flags::Indirection_tag)
+ {
+ //@@TODO: read indirection repository ids and return true.
+ return false;
+ }
+ else
+ {
+ //@@TODO: map repository id for indirection
+ for (CORBA::Long i = 0; i < num_ids; i ++)
+ {
+ ACE_CString id;
+ if (! strm.read_string(id))
+ return false;
+ ids.push_back (id);
+ }
+ }
+
+ return true;
+}
+
+
+void
+CORBA::ValueBase::truncation_hook ()
+{
+#if defined (ACE_HAS_EXCEPTIONS)
+ ACE_THROW (CORBA::INTERNAL ());
+#else
+ ACE_OS::abort ();
+#endif /* ACE_HAS_EXCEPTIONS */
+}
+
+
+// ================== Typecode initializations ==================
+
+namespace TAO
+{
+ namespace TypeCode
+ {
+ char const tc_value_base_id[] = "IDL:omg.org/CORBA/ValueBase:1.0";
+ char const tc_value_base_name[] = "ValueBase";
+ Value<char const *,
+ CORBA::TypeCode_ptr const *,
+ Value_Field<char const *, CORBA::TypeCode_ptr const *> const *,
+ TAO::Null_RefCount_Policy> tc_ValueBase (CORBA::tk_value,
+ tc_value_base_id,
+ tc_value_base_name,
+ CORBA::VM_NONE,
+ &CORBA::_tc_null,
+ 0, // Field array
+ 0); // Field count
+
+ char const tc_event_base_id[] = "IDL:omg.org/CORBA/EventBase:1.0";
+ char const tc_event_base_name[] = "EventBase";
+ Value<char const *,
+ CORBA::TypeCode_ptr const *,
+ Value_Field<char const *, CORBA::TypeCode_ptr const *> const *,
+ TAO::Null_RefCount_Policy> tc_EventBase (CORBA::tk_event,
+ tc_event_base_id,
+ tc_event_base_name,
+ CORBA::VM_NONE,
+ &CORBA::_tc_null,
+ 0, // Field array
+ 0); // Field count
+ }
+}
+
+namespace CORBA
+{
+ TypeCode_ptr const _tc_ValueBase = &TAO::TypeCode::tc_ValueBase;
+ TypeCode_ptr const _tc_EventBase = &TAO::TypeCode::tc_EventBase;
+}
+
+// member functions for CORBA::DefaultValueRefCountBase ============
+
+// destructor
+CORBA::DefaultValueRefCountBase::~DefaultValueRefCountBase (void)
+{
+}
+
+void
+CORBA::DefaultValueRefCountBase::_add_ref (void)
+{
+ this->_tao_add_ref ();
+}
+
+void
+CORBA::DefaultValueRefCountBase::_remove_ref (void)
+{
+ this->_tao_remove_ref ();
+}
+
+CORBA::ULong
+CORBA::DefaultValueRefCountBase::_refcount_value (void)
+{
+ return this->_tao_refcount_value ();
+}
+
+// ===========================================================
+
+CORBA::DefaultValueRefCountBase::DefaultValueRefCountBase (void)
+ : refcount_ (1)
+{
+}
+
+
+// Copy constructor
+CORBA::DefaultValueRefCountBase::DefaultValueRefCountBase
+ (const DefaultValueRefCountBase& rhs)
+ : ValueBase (rhs),
+ refcount_ (1)
+
+{
+}
+
+
+void
+CORBA::DefaultValueRefCountBase::_tao_add_ref (void)
+{
+ ++this->refcount_;
+}
+
+void
+CORBA::DefaultValueRefCountBase::_tao_remove_ref (void)
+{
+ CORBA::ULong const new_count = --this->refcount_;
+
+ if (new_count == 0)
+ delete this;
+}
+
+CORBA::ULong
+CORBA::DefaultValueRefCountBase::_tao_refcount_value (void)
+{
+ return this->refcount_.value ();
+}
+
+// ===========================================================
+
+CORBA::Boolean
+operator<< (TAO_OutputCDR &strm,
+ CORBA::ValueBase *_tao_valuetype)
+{
+ return CORBA::ValueBase::_tao_marshal (
+ strm,
+ _tao_valuetype,
+ reinterpret_cast<ptrdiff_t> (&CORBA::ValueBase::_downcast)
+ );
+}
+
+CORBA::Boolean
+operator>> (TAO_InputCDR &strm,
+ CORBA::ValueBase *&_tao_valuetype)
+{
+ return CORBA::ValueBase::_tao_unmarshal (strm,
+ _tao_valuetype);
+}
+
+// =============== Template Specializations =====================
+namespace TAO
+{
+ void
+ Value_Traits<CORBA::ValueBase>::add_ref (
+ CORBA::ValueBase *p)
+ {
+ CORBA::add_ref (p);
+ }
+
+ void
+ Value_Traits<CORBA::ValueBase>::remove_ref (
+ CORBA::ValueBase * p)
+ {
+ CORBA::remove_ref (p);
+ }
+
+ void
+ Value_Traits<CORBA::ValueBase>::release (
+ CORBA::ValueBase * p)
+ {
+ CORBA::remove_ref (p);
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Valuetype/ValueBase.h b/TAO/tao/Valuetype/ValueBase.h
new file mode 100644
index 00000000000..6918787b738
--- /dev/null
+++ b/TAO/tao/Valuetype/ValueBase.h
@@ -0,0 +1,371 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file ValueBase.h
+ *
+ * $Id$
+ *
+ * @author Torsten Kuepper <kuepper2@lfa.uni-wuppertal.de>
+ */
+//=============================================================================
+
+#ifndef TAO_VALUEBASE_H
+#define TAO_VALUEBASE_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Valuetype/valuetype_export.h"
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Valuetype/Value_CORBA_methods.h"
+#include "tao/Valuetype/Value_VarOut_T.h"
+
+#include "tao/Object_Argument_T.h"
+#include "tao/Arg_Traits_T.h"
+#include "tao/Any_Insert_Policy_T.h"
+
+#include "ace/Basic_Types.h"
+#include "ace/CORBA_macros.h"
+#include "ace/Synch_Traits.h"
+#include "ace/Thread_Mutex.h"
+#include "ace/Atomic_Op.h"
+#include "ace/Null_Mutex.h"
+#include "ace/Vector_T.h"
+
+#if defined (TAO_EXPORT_MACRO)
+#undef TAO_EXPORT_MACRO
+#endif
+#define TAO_EXPORT_MACRO TAO_Valuetype_Export
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Valuetype_Export TAO_ChunkInfo
+{
+public:
+ TAO_ChunkInfo(CORBA::Boolean do_chunking = 0, CORBA::Long init_level = 0);
+
+ /// Methods to support chunking.
+ /// Note: These methods are called for both chunking and non-chunking
+ /// valuetype. These methods checks the chunking_ flag. If it's
+ /// set to be false the methods return true rightaway.
+
+ /// Methods for marshalling a valuetype.
+
+ /// This is called in the _tao_marshal_state (). This method reserves
+ /// space for the chunk size of the next chunk and also increments the
+ /// nesting level. The reservasion actually occurs the first time that
+ /// the start_chunk is called if there are multiple continuous start_chunk()
+ /// calls without the close_chunk() called in between.
+ CORBA::Boolean start_chunk(TAO_OutputCDR &strm);
+
+ /// This is called in the _tao_marshal_state (). This method writes the
+ /// actual chunk size to the reserved chunk size space and writes an end
+ /// tag with the negation value of current nesting level. A start_chunk()
+ /// needs an end_chunk() to close the current chunk. It's also needed for
+ /// writing the outmost endtag to the stream.
+ CORBA::Boolean end_chunk(TAO_OutputCDR &strm);
+
+ /// Methods for unmarshalling a valuetype.
+
+ /// This is called in the _tao_unmarshal_state () to read the chunk
+ /// size or an end tag.
+ CORBA::Boolean handle_chunking (TAO_InputCDR &strm);
+ /// This is called in the _tao_unmarshal_state () to skip the rest
+ /// chunks until the outmost endtag (-1) if the value is truncated
+ /// to its truncatable parent.
+ CORBA::Boolean skip_chunks (TAO_InputCDR &strm);
+ /// This is called in end_chunk(). It writes the actual chunk size to the
+ /// reserved chunk size space.
+ CORBA::Boolean write_previous_chunk_size(TAO_OutputCDR &strm);
+ /// Reserve space for chunk size. The memory in the stream will be
+ /// overwritten after all the chunk data is written. This method
+ /// only allows the reservasion being made once if the reserved
+ /// space has not been overwritten.
+ CORBA::Boolean reserve_chunk_size(TAO_OutputCDR &strm);
+
+ /// A flag to indicate that this instance is actually involved in a chunked
+ /// or truncatable valuetype.
+ CORBA::Boolean chunking_;
+
+ /// The level of nesting valuetypes.
+ CORBA::Long value_nesting_level_;
+ /// The starting position of the size of current chunk.
+ char* chunk_size_pos_;
+ /// The length of CDR stream from the begining to the current
+ /// chunk data starting position. Used to calculate the chunk size
+ /// across multiple chained ACE_Message_Blocks.
+ size_t length_to_chunk_octets_pos_;
+ /// The end position of current chunk.
+ char* chunk_octets_end_pos_;
+};
+
+namespace CORBA
+{
+ class ValueFactoryBase;
+ typedef ValueFactoryBase *ValueFactory;
+
+ class ValueBase;
+
+ typedef TAO_Value_Var_T<ValueBase> ValueBase_var;
+ typedef TAO_Value_Out_T<ValueBase> ValueBase_out;
+
+ /**
+ * @class ValueBase
+ *
+ * @brief Abstract baseclass for Valuetypes
+ *
+ * @see CORBA 2.3 - Section 20.17.5
+ */
+ class TAO_Valuetype_Export ValueBase
+ {
+ public:
+ friend class TAO_ChunkInfo;
+
+ typedef ValueBase* _ptr_type;
+ typedef ValueBase_var _var_type;
+ typedef ValueBase_out _out_type;
+
+ typedef ACE_Vector < ACE_CString > Repository_Id_List;
+
+ // Reference counting.
+ /// %! virtual CORBA::ValueBase* _copy_value (void) = 0;
+
+ virtual void _add_ref (void) = 0;
+ virtual void _remove_ref (void) = 0;
+ virtual CORBA::ULong _refcount_value (void) = 0;
+
+ // dynamic casting
+ static CORBA::ValueBase* _downcast (CORBA::ValueBase *);
+
+ /// Used in the implementation of CORBA::Any
+ static void _tao_any_destructor (void *);
+
+ /// TAO extension
+
+ /// Return the repository id of this valuetype.
+ virtual const char * _tao_obv_repository_id (void) const = 0;
+
+ /// Give the list of the RepositoryIds in the valuetype "truncatable"
+ /// inheritance hierarchy. List the id of this valuetype as first
+ /// RepositoryID and go up the "truncatable" derivation hierarchy.
+ /// Note the truncatable repo ids only list the truncatable base types
+ /// to which this type is safe to truncate, not all its parents.
+ virtual void _tao_obv_truncatable_repo_ids (Repository_Id_List &) const = 0;
+
+ // TAO internal --------------------------
+
+ /// Marshal a valuetype (see operator<< in tao_idl generated file
+ /// how it is called)
+ static CORBA::Boolean _tao_marshal (TAO_OutputCDR &strm,
+ const ValueBase *_this,
+ ptrdiff_t formal_type_id = 0);
+
+ /// Unmarshal a valuetype, if formal type is a pointer to
+ /// ValueBase
+ static CORBA::Boolean _tao_unmarshal (TAO_InputCDR &strm,
+ ValueBase *&new_object);
+
+ // static CORBA::Boolean
+ // T::_tao_unmarshal (TAO_InputCDR &, ValueBase *&_this)
+ // is typespecific for valuetype T and generated from tao_idl
+ // Use this for unmarshaling.
+
+ /// Both used internally and are called from T::_tao_unmarshal ()
+ static CORBA::Boolean _tao_unmarshal_pre (TAO_InputCDR &strm,
+ ValueBase *&,
+ const char * const repo_id);
+
+ CORBA::Boolean _tao_unmarshal_post (TAO_InputCDR &strm);
+
+ /// Check repository id for value box type against what is
+ /// in the CDR stream.
+ static CORBA::Boolean _tao_validate_box_type (
+ TAO_InputCDR &strm,
+ const char * const repo_id_expected,
+ CORBA::Boolean & null_object);
+
+ public: // otherwise these cannot be called from a static function
+
+ /// during marshal jump to the most derived part
+ virtual CORBA::Boolean _tao_marshal_v (TAO_OutputCDR &) const = 0;
+
+ /// called after obtaining the fresh object from create_for_unmarshal ()
+ virtual CORBA::Boolean _tao_unmarshal_v (TAO_InputCDR &) = 0;
+
+ /// Notify the truncated parent valuetype to skip the rest of the chunks
+ /// when unmarshalling a value from its derived valuetype.
+ /// This is called when the factory for the most derived valuetype (in
+ /// the repository id list) does not exist and a truncated parent factory
+ /// is registered.
+ virtual void truncation_hook ();
+
+ protected:
+ ValueBase (void);
+ ValueBase (const ValueBase&);
+ virtual ~ValueBase (void);
+
+ /// This flag is set to be true when the valuetype defined
+ /// in the idl has the truncatable parent.
+ CORBA::Boolean is_truncatable_;
+
+ /// This flag is set to be true when marshalling uses chunking.
+ /// According to spec, the truncatable valuetype should use chunking
+ /// and it can be used for marshalling large valuetype. In current
+ /// implementation, we just use chunking for the truncatable valuetype.
+ CORBA::Boolean chunking_;
+
+ /// Compare the supplied formal type identifier with our actual type.
+ /// This is used during marshaling of valuetypes to detect when it is
+ /// appropriate to not explicitly marshal the typecode for the value.
+ virtual CORBA::Boolean _tao_match_formal_type (ptrdiff_t ) const = 0;
+
+ private:
+ /// Write some special values such as null value or indirection value.
+ static CORBA::Boolean write_special_value(TAO_OutputCDR &strm, const CORBA::ValueBase * value);
+ /// Write whole value.
+ static CORBA::Boolean write_value(TAO_OutputCDR &strm,
+ const CORBA::ValueBase * value,
+ ptrdiff_t formal_type_id);
+
+ /// Write the header of the value which includes the valuetag, number of
+ /// repository ids and list of repository ids.
+ CORBA::Boolean write_value_header(TAO_OutputCDR &strm,
+ ptrdiff_t formal_type_id) const;
+
+ /// Read the repository ids from the CDR input stream.
+ static CORBA::Boolean read_repository_ids(ACE_InputCDR& strm, Repository_Id_List& ids);
+
+ private:
+ ValueBase & operator= (const ValueBase &);
+
+#ifdef SUN_CC_HAS_PVFC_BUG
+ // Need ugly fix for sun cc "pure virtual function called" bug.
+ private:
+ unsigned long tao_sun_cc_pvfc_bug_fix_;
+
+#endif /* SUN_CC_HAS_PVFC_BUG */
+
+ }; // ValueBase
+
+ /// Valuetype-related type codes.
+ extern TAO_Valuetype_Export TypeCode_ptr const _tc_ValueBase;
+ extern TAO_Valuetype_Export TypeCode_ptr const _tc_EventBase;
+
+ /**
+ * @class DefaultValueRefCountBase
+ *
+ * @brief Default mix-in for reference count of a valuetype.
+ *
+ * Default mix-in for reference count of a valuetype.
+ */
+ class TAO_Valuetype_Export DefaultValueRefCountBase
+ : public virtual ValueBase
+ {
+ public:
+ virtual void _add_ref (void);
+ virtual void _remove_ref (void);
+ virtual CORBA::ULong _refcount_value (void);
+
+ /// The _tao variants are inline for fast access from T_var
+ /// (if valuetype T is compiled with optimization for that.) %! (todo)
+ void _tao_add_ref (void);
+ void _tao_remove_ref (void);
+ CORBA::ULong _tao_refcount_value (void);
+
+ protected:
+ DefaultValueRefCountBase (void);
+ DefaultValueRefCountBase (const DefaultValueRefCountBase&);
+ virtual ~DefaultValueRefCountBase ();
+
+ private:
+ void operator= (const DefaultValueRefCountBase &);
+
+ private: // data
+ /// Reference counter.
+ ACE_Atomic_Op<TAO_SYNCH_MUTEX, unsigned long> refcount_;
+ }; // DefaultValueRefCountBase
+
+ // which lock has the lowest memory overhead ?
+ // %! todo refcountbase w/o locking (now memory overhead)
+ // $! todo: debug aids for refcounts
+
+} // End CORBA namespace
+
+/**
+ * @namespace TAO_OBV_GIOP_Flags
+ *
+ * @brief TAO_OBV_GIOP_Flags
+ *
+ * @see CORBA 2.3 -- Section 15.3.4
+ */
+namespace TAO_OBV_GIOP_Flags
+{
+ const CORBA::Long Value_tag_base = 0x7fffff00L;
+ const CORBA::Long Value_tag_sigbits = 0xffffff00L;
+ const CORBA::Long Codebase_url = 1;
+ const CORBA::Long Type_info_sigbits = 0x00000006L;
+ const CORBA::Long Type_info_none = 0;
+ const CORBA::Long Type_info_single = 2;
+ const CORBA::Long Type_info_list = 6;
+ const CORBA::Long Chunking_tag_sigbits = 0x00000008L;
+ const CORBA::Long Indirection_tag = 0x7fffffffL;
+ const CORBA::Long Null_tag = 0x00000000L;
+
+ TAO_NAMESPACE_INLINE_FUNCTION CORBA::Boolean is_null_ref (CORBA::Long);
+ TAO_NAMESPACE_INLINE_FUNCTION CORBA::Boolean is_value_tag (CORBA::Long);
+ TAO_NAMESPACE_INLINE_FUNCTION CORBA::Boolean has_codebase_url (CORBA::Long);
+ TAO_NAMESPACE_INLINE_FUNCTION CORBA::Boolean has_no_type_info (CORBA::Long);
+ TAO_NAMESPACE_INLINE_FUNCTION CORBA::Boolean has_single_type_info (CORBA::Long);
+ TAO_NAMESPACE_INLINE_FUNCTION CORBA::Boolean has_list_type_info (CORBA::Long);
+ TAO_NAMESPACE_INLINE_FUNCTION CORBA::Boolean is_chunked (CORBA::Long);
+ TAO_NAMESPACE_INLINE_FUNCTION CORBA::Boolean is_indirection_tag (CORBA::Long);
+ TAO_NAMESPACE_INLINE_FUNCTION CORBA::Boolean is_indirection (CORBA::Long);
+ TAO_NAMESPACE_INLINE_FUNCTION CORBA::Boolean is_block_size (CORBA::Long);
+ TAO_NAMESPACE_INLINE_FUNCTION CORBA::Boolean is_end_tag (CORBA::Long);
+}
+
+TAO_Valuetype_Export CORBA::Boolean
+operator<< (TAO_OutputCDR&, const CORBA::ValueBase *);
+
+TAO_Valuetype_Export CORBA::Boolean
+operator>> (TAO_InputCDR&, CORBA::ValueBase *&);
+
+/// Used in generated code if CORBA::ValueBase is an argument or return type.
+namespace TAO
+{
+ template<>
+ class TAO_Valuetype_Export Arg_Traits<CORBA::ValueBase>
+ : public Object_Arg_Traits_T<CORBA::ValueBase *,
+ CORBA::ValueBase_var,
+ CORBA::ValueBase_out,
+ TAO::Value_Traits<CORBA::ValueBase>,
+ TAO::Any_Insert_Policy_Stream <CORBA::ValueBase *> >
+ {
+ };
+
+ template<>
+ struct TAO_Valuetype_Export Value_Traits<CORBA::ValueBase>
+ {
+ static void add_ref (CORBA::ValueBase *);
+ static void remove_ref (CORBA::ValueBase *);
+
+ // For INOUT value type arguments, so they can use the same set
+ // of arg classes as interfaces.
+ static void release (CORBA::ValueBase *);
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/Valuetype/ValueBase.inl"
+#endif /* __ACE_INLINE__*/
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_VALUEBASE_H */
diff --git a/TAO/tao/Valuetype/ValueBase.inl b/TAO/tao/Valuetype/ValueBase.inl
new file mode 100644
index 00000000000..d51a47bab83
--- /dev/null
+++ b/TAO/tao/Valuetype/ValueBase.inl
@@ -0,0 +1,77 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// Detection of flags in the CDR Stream
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE CORBA::Boolean
+TAO_OBV_GIOP_Flags::is_null_ref (CORBA::Long tag)
+{
+ return (tag == Null_tag);
+}
+
+ACE_INLINE CORBA::Boolean
+TAO_OBV_GIOP_Flags::is_value_tag (CORBA::Long tag)
+{
+ return ((tag & Value_tag_sigbits) == 0x7FFFFF00L);
+}
+
+ACE_INLINE CORBA::Boolean
+TAO_OBV_GIOP_Flags:: has_codebase_url (CORBA::Long tag)
+{
+ return (CORBA::Boolean) (tag & Codebase_url);
+}
+
+ACE_INLINE CORBA::Boolean
+TAO_OBV_GIOP_Flags::has_no_type_info (CORBA::Long tag)
+{
+ return ((tag & Type_info_sigbits) == Type_info_none);
+}
+
+ACE_INLINE CORBA::Boolean
+TAO_OBV_GIOP_Flags::has_single_type_info (CORBA::Long tag)
+{
+ return ((tag & Type_info_sigbits) == Type_info_single);
+}
+
+ACE_INLINE CORBA::Boolean
+TAO_OBV_GIOP_Flags::has_list_type_info (CORBA::Long tag)
+{
+ return ((tag & Type_info_sigbits) == Type_info_list);
+}
+
+ACE_INLINE CORBA::Boolean
+TAO_OBV_GIOP_Flags:: is_chunked (CORBA::Long tag)
+{
+ return (CORBA::Boolean) (tag & 8);
+}
+
+ACE_INLINE CORBA::Boolean
+TAO_OBV_GIOP_Flags::is_indirection_tag (CORBA::Long tag)
+{
+ return (static_cast<unsigned>(tag) == 0xFFFFFFFFL);
+}
+
+ACE_INLINE CORBA::Boolean
+TAO_OBV_GIOP_Flags::is_indirection (CORBA::Long value)
+{
+ return (0x80000000L < static_cast<unsigned>(value) &&
+ static_cast<unsigned>(value) <= (0xFFFFFFFFL - 4));
+}
+
+ACE_INLINE CORBA::Boolean
+TAO_OBV_GIOP_Flags::is_block_size (CORBA::Long value)
+{
+ return (0 < static_cast<unsigned>(value) &&
+ static_cast<unsigned>(value) < 0x7FFFFF00L);
+}
+
+ACE_INLINE CORBA::Boolean
+TAO_OBV_GIOP_Flags::is_end_tag (CORBA::Long tag)
+{
+ return (0x80000000L < (unsigned)tag);
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Valuetype/ValueFactory.cpp b/TAO/tao/Valuetype/ValueFactory.cpp
new file mode 100644
index 00000000000..473780b8790
--- /dev/null
+++ b/TAO/tao/Valuetype/ValueFactory.cpp
@@ -0,0 +1,87 @@
+#include "tao/Valuetype/ValueFactory.h"
+#include "ace/Guard_T.h"
+
+ACE_RCSID (Valuetype,
+ ValueFactory,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Static operations in namespace CORBA.
+
+void
+CORBA::add_ref (CORBA::ValueFactoryBase *val)
+{
+ if (val)
+ {
+ val->_add_ref ();
+ }
+}
+
+void
+CORBA::remove_ref (CORBA::ValueFactoryBase *val)
+{
+ if (val)
+ {
+ val->_remove_ref ();
+ }
+}
+
+// ===========================================================
+
+CORBA::ValueFactoryBase::ValueFactoryBase (void)
+ : _tao_reference_count_ (1)
+{
+}
+
+CORBA::ValueFactoryBase::~ValueFactoryBase (void)
+{
+}
+
+void
+CORBA::ValueFactoryBase::_add_ref (void)
+{
+ ++this->_tao_reference_count_;
+}
+
+void
+CORBA::ValueFactoryBase::_remove_ref (void)
+{
+ const CORBA::ULong new_count = --this->_tao_reference_count_;
+
+ if (new_count == 0)
+ delete this;
+}
+
+// No-op. This should never be called, but it can't be pure virtual.
+CORBA::AbstractBase *
+CORBA::ValueFactoryBase::create_for_unmarshal_abstract (void)
+{
+ return 0;
+}
+
+// =============== Template Specializations =====================
+namespace TAO
+{
+ using namespace CORBA;
+
+ void
+ Value_Traits<ValueFactoryBase>::add_ref (ValueFactoryBase *p)
+ {
+ CORBA::add_ref (p);
+ }
+
+ void
+ Value_Traits<ValueFactoryBase>::remove_ref (ValueFactoryBase * p)
+ {
+ CORBA::remove_ref (p);
+ }
+
+ void
+ Value_Traits<ValueFactoryBase>::release (ValueFactoryBase * p)
+ {
+ CORBA::remove_ref (p);
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Valuetype/ValueFactory.h b/TAO/tao/Valuetype/ValueFactory.h
new file mode 100644
index 00000000000..0935bba77a4
--- /dev/null
+++ b/TAO/tao/Valuetype/ValueFactory.h
@@ -0,0 +1,134 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file ValueFactory.h
+ *
+ * $Id$
+ *
+ * @author Torsten Kuepper <kuepper2@lfa.uni-wuppertal.de>
+ */
+//=============================================================================
+
+#ifndef TAO_VALUEFACTORY_H
+#define TAO_VALUEFACTORY_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Valuetype/valuetype_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Valuetype/Value_VarOut_T.h"
+
+#include "tao/Environment.h"
+#include "tao/Basic_Types.h"
+#include "tao/orbconf.h"
+#include "ace/Synch_Traits.h"
+#include "ace/Thread_Mutex.h"
+#include "ace/Null_Mutex.h"
+#include "ace/CORBA_macros.h"
+#include "ace/Atomic_Op.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace CORBA
+{
+ class AbstractBase;
+ typedef AbstractBase *AbstractBase_ptr;
+
+ class ValueBase;
+
+ class ValueFactoryBase;
+
+ extern TAO_Valuetype_Export void add_ref (ValueFactoryBase *);
+ extern TAO_Valuetype_Export void remove_ref (ValueFactoryBase *);
+
+ typedef TAO_Value_Var_T<ValueFactoryBase>
+ ValueFactoryBase_var;
+
+ typedef ValueFactoryBase_var ValueFactory_var;
+
+ class TAO_Valuetype_Export ValueFactoryBase
+ {
+ public:
+ ValueFactoryBase (void);
+ virtual ~ValueFactoryBase (void);
+
+ // non-virtual is non-standard
+ void _add_ref (void);
+ void _remove_ref (void);
+
+ // private: %!
+ /// In a derived class T use return type TAO_OBV_CREATE_RETURN_TYPE (T)
+ /// (see at definition below)
+ virtual CORBA::ValueBase * create_for_unmarshal (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) = 0;
+
+ // Not pure virtual because this will be overridden only by valuetypes
+ // that support an abstract interface.
+ virtual CORBA::AbstractBase_ptr create_for_unmarshal_abstract (void);
+
+ private:
+ /// Reference counter.
+ ACE_Atomic_Op<TAO_SYNCH_MUTEX, CORBA::ULong> _tao_reference_count_;
+ };
+
+} // End CORBA namespace
+
+namespace TAO
+{
+ /**
+ * @brief Specializations needed for using with Value_Var_T
+ */
+ template<>
+ struct TAO_Valuetype_Export Value_Traits<CORBA::ValueFactoryBase>
+ {
+ static void add_ref (CORBA::ValueFactoryBase *);
+ static void remove_ref (CORBA::ValueFactoryBase *);
+
+ // For INOUT value type arguments, so they can use the same set
+ // of arg classes as interfaces.
+ static void release (CORBA::ValueFactoryBase *);
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+// Use this macro for writing code that is independent from
+// the compiler support of covariant return types of pointers to
+// virtual inherited classes.
+// (e.g. in egcs-2.90.29 980515 (egcs-1.0.3 release) its not yet implemented)
+// (But it is TAO specific and at the moment the covariant case is not
+// elaborated --- its just a suggestion.)
+
+#ifdef TAO_HAS_OBV_COVARIANT_RETURN
+# define TAO_OBV_CREATE_RETURN_TYPE(TYPE) TYPE *
+#else /* TAO_HAS_OBV_COVARIANT_RETURN */
+# define TAO_OBV_CREATE_RETURN_TYPE(TYPE) CORBA::ValueBase *
+#endif /* TAO_HAS_OBV_COVARIANT_RETURN */
+
+// (The obtaining of the repository id is currently not yet like the OMG way. %!)
+//
+// Macro for on the fly registration of a factory (with type Factory).
+// The repository id is taken from the static repository id of the
+// valuetype via tao_repository_id () of the specialized factory.
+// It forgets the pre-registered factory (if any) and the reference
+// to the newly created one. (A new reference could be obtained with
+// orb->lookup_value_factory (char * repo_id) .)
+
+#define TAO_OBV_REGISTER_FACTORY(FACTORY, VALUETYPE) \
+ { CORBA::ValueFactory factory = new FACTORY; \
+ CORBA::ValueFactory prev_factory = \
+ TAO_ORB_Core_instance ()->orb ()->register_value_factory (\
+ VALUETYPE::_tao_obv_static_repository_id (),\
+ factory); \
+ if (prev_factory) prev_factory->_remove_ref (); \
+ factory->_remove_ref (); }
+
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_VALUEFACTORY_H */
diff --git a/TAO/tao/Valuetype/ValueFactory_Map.cpp b/TAO/tao/Valuetype/ValueFactory_Map.cpp
new file mode 100644
index 00000000000..f33af298e5e
--- /dev/null
+++ b/TAO/tao/Valuetype/ValueFactory_Map.cpp
@@ -0,0 +1,108 @@
+#include "tao/Valuetype/ValueFactory_Map.h"
+#include "tao/Valuetype/ValueFactory.h"
+#include "tao/CORBA_String.h"
+#include "tao/TAO_Singleton.h"
+
+
+ACE_RCSID (Valuetype,
+ ValueFactory_Map,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_ValueFactory_Map::TAO_ValueFactory_Map (void)
+ : map_ (TAO_DEFAULT_VALUE_FACTORY_TABLE_SIZE)
+{
+}
+
+TAO_ValueFactory_Map::~TAO_ValueFactory_Map (void)
+{
+ // Initialize an iterator. We need to go thru each entry and free
+ // up storage allocated to hold the external ids and invoke
+ // _remove_ref () on the internal ids.
+ FACTORY_MAP_MANAGER::ITERATOR iterator (this->map_);
+
+ for (FACTORY_MAP_MANAGER::ENTRY *entry = 0;
+ iterator.next (entry) != 0;
+ iterator.advance ())
+ {
+ // We had allocated memory and stored the string. So we free the
+ // memory.
+ CORBA::string_free ((char *) entry->ext_id_);
+ entry->ext_id_ = 0;
+ entry->int_id_->_remove_ref ();
+ entry->int_id_ = 0;
+ }
+}
+
+int
+TAO_ValueFactory_Map::rebind (const char *repo_id,
+ CORBA::ValueFactory &factory)
+{
+ ACE_GUARD_RETURN(TAO_SYNCH_MUTEX, guard, this->mutex_, -1);
+
+ const char *prev_repo_id = 0;
+ CORBA::ValueFactory prev_factory = 0;
+ int const ret = this->map_.rebind (CORBA::string_dup (repo_id),
+ factory,
+ prev_repo_id,
+ prev_factory);
+
+ if (ret > -1) // ok, no error
+ {
+ factory->_add_ref (); // The map owns one reference.
+
+ if (ret == 1) // there was a previous factory
+ {
+ factory = prev_factory;
+ CORBA::string_free (const_cast<char*> (prev_repo_id));
+ }
+ }
+
+ return ret;
+}
+
+int
+TAO_ValueFactory_Map::unbind (const char *repo_id,
+ CORBA::ValueFactory &factory)
+{
+ ACE_GUARD_RETURN(TAO_SYNCH_MUTEX, guard, this->mutex_, -1);
+
+ FACTORY_MAP_MANAGER::ENTRY *prev_entry = 0;
+ int ret = this->map_.find (repo_id,
+ prev_entry);
+ if (ret == 0) // there was a matching factory
+ {
+ // set factory to the previous factory,
+ factory = prev_entry->int_id_;
+ char *temp = const_cast<char *> (prev_entry->ext_id_);
+ ret = this->map_.unbind (prev_entry);
+
+ if (ret == 0)
+ {
+ CORBA::string_free (temp);
+ }
+ }
+
+ return ret;
+}
+
+// %! perhaps inline
+int
+TAO_ValueFactory_Map::find (const char *repo_id,
+ CORBA::ValueFactory &factory)
+{
+ ACE_GUARD_RETURN(TAO_SYNCH_MUTEX, guard, this->mutex_, -1);
+
+ int const ret = this->map_.find (repo_id,
+ factory);
+ if (ret > -1)
+ {
+ factory->_add_ref (); // The caller gets one reference as gift.
+ }
+
+ return ret;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
diff --git a/TAO/tao/Valuetype/ValueFactory_Map.h b/TAO/tao/Valuetype/ValueFactory_Map.h
new file mode 100644
index 00000000000..af10d7c27ae
--- /dev/null
+++ b/TAO/tao/Valuetype/ValueFactory_Map.h
@@ -0,0 +1,92 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file ValueFactory_Map.h
+ *
+ * $Id$
+ *
+ * @author Torsten Kuepper <kuepper2@lfa.uni-wuppertal.de>
+ */
+//=============================================================================
+
+
+#ifndef TAO_VALUEFACTORY_MAP_H
+#define TAO_VALUEFACTORY_MAP_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/Hash_Map_Manager_T.h"
+#include "ace/Thread_Mutex.h"
+#include "ace/Null_Mutex.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace CORBA
+{
+ class ValueFactoryBase;
+ typedef ValueFactoryBase *ValueFactory;
+}
+
+class TAO_ValueFactory_Map
+{
+public:
+
+ TAO_ValueFactory_Map (void);
+ ~TAO_ValueFactory_Map (void);
+
+ /**
+ * Associate the factory (int_id) with the repo_id (ext_id).
+ * Invokes _add_ref () on the factory.
+ * If previous factory had been bind with this repo_id, this one is
+ * returned in factory (and the caller holds a reference).
+ * Returns -1 on failure, 0 on success and 1 if a previous factory
+ * is found (and returned in factory).
+ */
+ int rebind (const char *repo_id,
+ CORBA::ValueFactory &factory);
+
+ /// Removes entry for repo_id from the map and sets factory to
+ /// the tied one.
+ int unbind (const char *repo_id,
+ CORBA::ValueFactory &factory);
+
+ /**
+ * Lookup a matching factory for repo_id.
+ * Invokes _add_ref () on the factory if found.
+ * Returns -1 on failure and 0 on success.
+ */
+ int find (const char *repo_id,
+ CORBA::ValueFactory &factory);
+
+ void dump (void);
+
+ /// Return singleton instance of this class.
+ static TAO_ValueFactory_Map * instance (void);
+
+private:
+
+ /// The hash table data structure.
+ typedef ACE_Hash_Map_Manager_Ex<const char *,
+ CORBA::ValueFactory,
+ ACE_Hash<const char *>,
+ ACE_Equal_To<const char *>,
+ ACE_SYNCH_NULL_MUTEX>
+ FACTORY_MAP_MANAGER;
+ FACTORY_MAP_MANAGER map_;
+
+ /// synchronization of the map
+ TAO_SYNCH_MUTEX mutex_;
+}; /* TAO_ValueFactory_Map */
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_VALUEFACTORY_MAP_H */
diff --git a/TAO/tao/Valuetype/Value_CORBA_methods.h b/TAO/tao/Valuetype/Value_CORBA_methods.h
new file mode 100644
index 00000000000..dde1c2837b7
--- /dev/null
+++ b/TAO/tao/Valuetype/Value_CORBA_methods.h
@@ -0,0 +1,56 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Value_CORBA_methods.h
+ *
+ * $Id$
+ *
+ * Declarations of common ValueType methods in the CORBA namespace.
+ *
+ * @author Ossama Othman <ossama@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_VALUETYPE_CORBA_METHODS_H
+#define TAO_VALUETYPE_CORBA_METHODS_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Valuetype/valuetype_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Basic_Types.h"
+
+#if defined (TAO_EXPORT_MACRO)
+#undef TAO_EXPORT_MACRO
+#endif
+#define TAO_EXPORT_MACRO TAO_Valuetype_Export
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+
+namespace CORBA
+{
+ class ValueBase;
+
+ extern TAO_Valuetype_Export void add_ref (ValueBase *);
+ extern TAO_Valuetype_Export void remove_ref (ValueBase *);
+
+ class AbstractBase;
+ typedef AbstractBase *AbstractBase_ptr;
+
+ extern TAO_Valuetype_Export Boolean is_nil (AbstractBase_ptr);
+ extern TAO_Valuetype_Export void release (AbstractBase_ptr);
+
+
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_VALUETYPE_CORBA_METHODS_H */
diff --git a/TAO/tao/Valuetype/Value_VarOut_T.cpp b/TAO/tao/Valuetype/Value_VarOut_T.cpp
new file mode 100644
index 00000000000..feb061920c7
--- /dev/null
+++ b/TAO/tao/Valuetype/Value_VarOut_T.cpp
@@ -0,0 +1,187 @@
+// $Id$
+
+#ifndef TAO_VALUE_VAROUT_T_CPP
+#define TAO_VALUE_VAROUT_T_CPP
+
+#include "tao/Valuetype/Value_VarOut_T.h"
+#include "tao/Valuetype/Value_CORBA_methods.h"
+
+#include <algorithm> /* For std::swap<>() */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template <typename T>
+TAO_Value_Var_T<T>::TAO_Value_Var_T (void)
+ : ptr_ (0)
+{}
+
+template <typename T>
+TAO_Value_Var_T<T>::TAO_Value_Var_T (T * p)
+ : ptr_ (p)
+{}
+
+template <typename T>
+TAO_Value_Var_T<T>::TAO_Value_Var_T (const T * p)
+ : ptr_ (const_cast<T *> (p))
+{}
+
+template <typename T>
+TAO_Value_Var_T<T>::TAO_Value_Var_T (const TAO_Value_Var_T<T> & p)
+ : TAO_Base_var ()
+{
+ TAO::Value_Traits<T>::add_ref (p.ptr ());
+ this->ptr_ = p.ptr ();
+}
+
+template <typename T>
+TAO_Value_Var_T<T>::~TAO_Value_Var_T (void)
+{
+ TAO::Value_Traits<T>::remove_ref (this->ptr_);
+}
+
+template <typename T>
+TAO_Value_Var_T<T> &
+TAO_Value_Var_T<T>::operator= (T * p)
+{
+ if (this->ptr_ != p)
+ {
+ // This constructor doesn't increase the reference count so we
+ // we must check for self-assignment. Otherwise the reference
+ // count would be prematurely decremented upon exiting this
+ // scope.
+ TAO_Value_Var_T<T> tmp (p);
+ std::swap (this->ptr_, tmp.ptr_);
+ }
+
+ return *this;
+}
+
+template <typename T>
+TAO_Value_Var_T<T> &
+TAO_Value_Var_T<T>::operator= (const TAO_Value_Var_T<T> & p)
+{
+ TAO_Value_Var_T<T> tmp (p);
+ std::swap (this->ptr_, tmp.ptr_);
+
+ return *this;
+}
+
+template <typename T>
+TAO_Value_Var_T<T>::operator const T * () const
+{
+ return this->ptr_;
+}
+
+template <typename T>
+TAO_Value_Var_T<T>::operator T *& ()
+{
+ return this->ptr_;
+}
+
+template <typename T>
+T *
+TAO_Value_Var_T<T>::operator-> (void) const
+{
+ return this->ptr_;
+}
+
+template <typename T>
+T *
+TAO_Value_Var_T<T>::in (void) const
+{
+ return this->ptr_;
+}
+
+template <typename T>
+T *&
+TAO_Value_Var_T<T>::inout (void)
+{
+ return this->ptr_;
+}
+
+template <typename T>
+T *&
+TAO_Value_Var_T<T>::out (void)
+{
+ TAO::Value_Traits<T>::remove_ref (this->ptr_);
+ this->ptr_ = 0;
+ return this->ptr_;
+}
+
+template <typename T>
+T *
+TAO_Value_Var_T<T>::_retn (void)
+{
+ T * tmp = this->ptr_;
+ this->ptr_ = 0;
+ return tmp;
+}
+
+template <typename T>
+T *
+TAO_Value_Var_T<T>::ptr (void) const
+{
+ return this->ptr_;
+}
+
+// *************************************************************
+
+template <typename T>
+TAO_Value_Out_T<T>::TAO_Value_Out_T (T *& p)
+ : ptr_ (p)
+{
+ this->ptr_ = 0;
+}
+
+template <typename T>
+TAO_Value_Out_T<T>::TAO_Value_Out_T (TAO_Value_Var_T<T> & p)
+ : ptr_ (p.out ())
+{
+ TAO::Value_Traits<T>::remove_ref (this->ptr_);
+ this->ptr_ = 0;
+}
+
+template <typename T>
+TAO_Value_Out_T<T>::TAO_Value_Out_T (const TAO_Value_Out_T<T> & p)
+ : ptr_ (const_cast<TAO_Value_Out_T<T> &> (p).ptr_)
+{}
+
+template <typename T>
+TAO_Value_Out_T<T> &
+TAO_Value_Out_T<T>::operator= (const TAO_Value_Out_T<T> & p)
+{
+ this->ptr_ = const_cast<TAO_Value_Out_T<T> &> (p).ptr_;
+ return *this;
+}
+
+template <typename T>
+TAO_Value_Out_T<T> &
+TAO_Value_Out_T<T>::operator= (T * p)
+{
+ this->ptr_ = p;
+ return *this;
+}
+
+template <typename T>
+TAO_Value_Out_T<T>::operator T *& ()
+{
+ return this->ptr_;
+}
+
+template <typename T>
+T *&
+TAO_Value_Out_T<T>::ptr (void)
+{
+ return this->ptr_;
+}
+
+template <typename T>
+T *
+TAO_Value_Out_T<T>::operator-> (void)
+{
+ return this->ptr_;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_VALUE_VAROUT_T_CPP */
diff --git a/TAO/tao/Valuetype/Value_VarOut_T.h b/TAO/tao/Valuetype/Value_VarOut_T.h
new file mode 100644
index 00000000000..64ea98bd97e
--- /dev/null
+++ b/TAO/tao/Valuetype/Value_VarOut_T.h
@@ -0,0 +1,129 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Value_VarOut_T.h
+ *
+ * $Id$
+ *
+ * @author Jeff Parsons
+ */
+//=============================================================================
+
+#ifndef TAO_VALUE_VAROUT_T_H
+#define TAO_VALUE_VAROUT_T_H
+
+#include /**/ "ace/pre.h"
+
+#include "ace/config-all.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/varbase.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ /**
+ * struct Value_Traits
+ *
+ * @brief Specialized for each valuetype in generated code.
+ */
+ template<typename T> struct Value_Traits;
+}
+
+/**
+ * @class TAO_Value_Var_T
+ *
+ * @brief Parametrized implementation of _var class for valuetypes.
+ *
+ */
+template <typename T>
+class TAO_Value_Var_T : private TAO_Base_var
+{
+public:
+ TAO_Value_Var_T (void);
+ TAO_Value_Var_T (T *);
+ TAO_Value_Var_T (const TAO_Value_Var_T<T> &);
+
+ // (TAO extension)
+ TAO_Value_Var_T (const T *);
+
+ ~TAO_Value_Var_T (void);
+
+ TAO_Value_Var_T &operator= (T *);
+ TAO_Value_Var_T &operator= (const TAO_Value_Var_T<T> &);
+
+ T * operator-> (void) const;
+
+ operator const T * () const;
+ operator T *& ();
+
+ typedef T * _in_type;
+ typedef T *& _inout_type;
+ typedef T *& _out_type;
+ typedef T * _retn_type;
+
+ // in, inout, out, _retn
+ _in_type in (void) const;
+ _inout_type inout (void);
+ _out_type out (void);
+ _retn_type _retn (void);
+
+ // (TAO extension)
+ T * ptr (void) const;
+
+private:
+
+ // Prevent widening assignment.
+ TAO_Value_Var_T (const TAO_Base_var &);
+ void operator= (const TAO_Base_var &);
+
+private:
+ T * ptr_;
+};
+
+/**
+ * @class TAO_Value_Var_T
+ *
+ * @brief Parametrized implementation of _out class for valuetypes.
+ *
+ */
+template <typename T>
+class TAO_Value_Out_T
+{
+public:
+ TAO_Value_Out_T (T *&);
+ TAO_Value_Out_T (TAO_Value_Var_T<T> &);
+ TAO_Value_Out_T (const TAO_Value_Out_T<T> &);
+
+ TAO_Value_Out_T &operator= (const TAO_Value_Out_T<T> &);
+ TAO_Value_Out_T &operator= (T *);
+
+ operator T *& ();
+ T *& ptr (void);
+
+ T * operator-> (void);
+
+private:
+ T *& ptr_;
+ /// Assignment from _var not allowed.
+ TAO_Value_Out_T &operator= (const TAO_Value_Var_T<T> &);
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+#include "tao/Valuetype/Value_VarOut_T.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
+#pragma implementation ("Value_VarOut_T.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_VALUE_VAROUT_T_H */
diff --git a/TAO/tao/Valuetype/Valuetype_Adapter_Factory_Impl.cpp b/TAO/tao/Valuetype/Valuetype_Adapter_Factory_Impl.cpp
new file mode 100644
index 00000000000..0c58622685d
--- /dev/null
+++ b/TAO/tao/Valuetype/Valuetype_Adapter_Factory_Impl.cpp
@@ -0,0 +1,59 @@
+// $Id$
+
+#include "tao/Valuetype/Valuetype_Adapter_Impl.h"
+#include "tao/Valuetype/Valuetype_Adapter_Factory_Impl.h"
+
+#include "tao/ORB_Core.h"
+
+ACE_RCSID (ValueType,
+ Valuetype_Adapter_Factory_Impl,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Valuetype_Adapter_Factory_Impl::~TAO_Valuetype_Adapter_Factory_Impl (void)
+{
+}
+
+TAO_Valuetype_Adapter *
+TAO_Valuetype_Adapter_Factory_Impl::create (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ TAO_Valuetype_Adapter_Impl *nva = 0;
+ ACE_NEW_THROW_EX (nva,
+ TAO_Valuetype_Adapter_Impl (),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (nva);
+
+ return nva;
+}
+
+// *********************************************************************
+
+// Initialization and registration of dynamic service object.
+
+int
+TAO_Valuetype_Adapter_Factory_Impl::Initializer (void)
+{
+ TAO_ORB_Core::valuetype_adapter_factory_name (
+ "Concrete_Valuetype_Adapter_Factory"
+ );
+
+ return
+ ACE_Service_Config::process_directive (
+ ace_svc_desc_TAO_Valuetype_Adapter_Factory_Impl
+ );
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DEFINE (
+ TAO_Valuetype_Adapter_Factory_Impl,
+ ACE_TEXT ("Concrete_Valuetype_Adapter_Factory"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (TAO_Valuetype_Adapter_Factory_Impl),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0
+ )
+
+ACE_FACTORY_DEFINE (TAO_Valuetype, TAO_Valuetype_Adapter_Factory_Impl)
diff --git a/TAO/tao/Valuetype/Valuetype_Adapter_Factory_Impl.h b/TAO/tao/Valuetype/Valuetype_Adapter_Factory_Impl.h
new file mode 100644
index 00000000000..91b8cbe6e8c
--- /dev/null
+++ b/TAO/tao/Valuetype/Valuetype_Adapter_Factory_Impl.h
@@ -0,0 +1,70 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Valuetype_Adapter_Factory_Impl.h
+ *
+ * $Id$
+ *
+ * @author Kees van Marle <kvmarle@remedy.nl>
+ */
+//=============================================================================
+
+
+#ifndef TAO_VALUETYPE_ADAPTER_FACTORY_IMPL_H
+#define TAO_VALUETYPE_ADAPTER_FACTORY_IMPL_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Valuetype/valuetype_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Valuetype_Adapter_Factory.h"
+#include "ace/Service_Config.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Valuetype_Adapter;
+
+/**
+ * @class TAO_Valuetype_Adapter_Factory_Impl
+ *
+ * @brief TAO_Valuetype_Adapter_Factory_Impl.
+ *
+ * Class that creates instances of TAO_Valuetype_Adapter (one per ORB).
+ * This is the derived class that contains the actual implementations.
+ */
+class TAO_Valuetype_Export TAO_Valuetype_Adapter_Factory_Impl
+ : public TAO_Valuetype_Adapter_Factory
+{
+public:
+ virtual ~TAO_Valuetype_Adapter_Factory_Impl (void);
+
+ virtual TAO_Valuetype_Adapter * create (
+ ACE_ENV_SINGLE_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ // Used to force the initialization of the ORB code.
+ static int Initializer (void);
+};
+
+static int
+TAO_Requires_ValueType_Initializer =
+ TAO_Valuetype_Adapter_Factory_Impl::Initializer ();
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE (TAO_Valuetype_Adapter_Factory_Impl)
+ACE_FACTORY_DECLARE (TAO_Valuetype, TAO_Valuetype_Adapter_Factory_Impl)
+
+#define TAO_VALUETYPE_SAFE_INCLUDE
+// #include "tao/ValueType/ValueTypeC.h"
+#undef TAO_VALUETYPE_SAFE_INCLUDE
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_VALUETYPE_ADAPTER_FACTORY_IMPL_H */
diff --git a/TAO/tao/Valuetype/Valuetype_Adapter_Impl.cpp b/TAO/tao/Valuetype/Valuetype_Adapter_Impl.cpp
new file mode 100644
index 00000000000..b0a61220626
--- /dev/null
+++ b/TAO/tao/Valuetype/Valuetype_Adapter_Impl.cpp
@@ -0,0 +1,99 @@
+// $Id$
+
+#include "tao/Valuetype/Valuetype_Adapter_Impl.h"
+#include "tao/Valuetype/AbstractBase.h"
+#include "tao/Valuetype/ValueBase.h"
+#include "tao/Valuetype/ValueFactory_Map.h"
+
+#include "tao/ORB_Core.h"
+
+
+ACE_RCSID (Valuetype,
+ Valuetype_Adapter_Impl,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Valuetype_Adapter_Impl::~TAO_Valuetype_Adapter_Impl (void)
+{
+}
+
+CORBA::Object_ptr
+TAO_Valuetype_Adapter_Impl::abstractbase_to_object (
+ CORBA::AbstractBase_ptr p
+ )
+{
+ return p->_to_object ();
+}
+
+CORBA::Boolean
+TAO_Valuetype_Adapter_Impl::stream_to_value (TAO_InputCDR &cdr,
+ CORBA::ValueBase *& val)
+{
+ return cdr >> val;
+}
+
+CORBA::Boolean
+TAO_Valuetype_Adapter_Impl::stream_to_abstract_base (
+ TAO_InputCDR &cdr,
+ CORBA::AbstractBase_ptr & obj
+ )
+{
+ return cdr >> obj;
+}
+
+CORBA::Long
+TAO_Valuetype_Adapter_Impl::type_info_single (void) const
+{
+ return TAO_OBV_GIOP_Flags::Type_info_single;
+}
+
+CORBA::Boolean
+TAO_Valuetype_Adapter_Impl::is_type_info_implied (CORBA::Long vt) const
+{
+ return vt == TAO_OBV_GIOP_Flags::Value_tag_base;
+}
+
+CORBA::Boolean
+TAO_Valuetype_Adapter_Impl::is_type_info_single (CORBA::Long vt) const
+{
+ return ((vt | TAO_OBV_GIOP_Flags::Type_info_single) == vt) &&
+ ((vt | TAO_OBV_GIOP_Flags::Type_info_list) != vt);
+}
+
+CORBA::Boolean
+TAO_Valuetype_Adapter_Impl::is_type_info_list (CORBA::Long vt) const
+{
+ return (vt | TAO_OBV_GIOP_Flags::Type_info_list) == vt;
+}
+
+CORBA::Boolean
+TAO_Valuetype_Adapter_Impl::is_value_chunked (CORBA::Long vt) const
+{
+ return (vt | TAO_OBV_GIOP_Flags::Chunking_tag_sigbits) == vt;
+}
+
+int
+TAO_Valuetype_Adapter_Impl::vf_map_rebind (const char *repo_id,
+ CORBA::ValueFactory &factory)
+{
+ return map_.rebind (repo_id, factory);
+}
+
+int
+TAO_Valuetype_Adapter_Impl::vf_map_unbind (const char *repo_id)
+
+{
+ CORBA::ValueFactory fac;
+ return map_.unbind (repo_id, fac);
+}
+
+CORBA::ValueFactory
+TAO_Valuetype_Adapter_Impl::vf_map_find (const char *repo_id)
+{
+ CORBA::ValueFactory factory = 0;
+ (void) map_.find (repo_id, factory);
+ return factory;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Valuetype/Valuetype_Adapter_Impl.h b/TAO/tao/Valuetype/Valuetype_Adapter_Impl.h
new file mode 100644
index 00000000000..e24f2a5a70f
--- /dev/null
+++ b/TAO/tao/Valuetype/Valuetype_Adapter_Impl.h
@@ -0,0 +1,80 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Valuetype_Adapter_Impl.h
+ *
+ * $Id$
+ *
+ * @author Jeff Parsons <j.parsons@vanderbilt.edu>
+ */
+//=============================================================================
+
+
+#ifndef TAO_VALUETYPE_ADAPTER_IMPL_H
+#define TAO_VALUETYPE_ADAPTER_IMPL_H
+
+#include /**/ "ace/pre.h"
+
+#include "ace/Service_Config.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Valuetype/valuetype_export.h"
+#include "tao/Valuetype/ValueFactory_Map.h"
+#include "tao/Valuetype_Adapter.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_Valuetype_Adapter_Impl
+ *
+ * @brief TAO_Valuetype_Adapter_Impl.
+ *
+ * Class that adapts various functions involving the Valuetype,
+ * ValueFactory and AbstractInterface classes. This is a concrete class
+ * implementating the pure virtual methods of TAO_Valuetype_Adapter
+ */
+class TAO_Valuetype_Export TAO_Valuetype_Adapter_Impl
+ : public TAO_Valuetype_Adapter
+{
+public:
+
+ virtual ~TAO_Valuetype_Adapter_Impl (void);
+
+ virtual CORBA::Object_ptr abstractbase_to_object (
+ CORBA::AbstractBase_ptr
+ );
+
+ virtual CORBA::Boolean stream_to_value (TAO_InputCDR &,
+ CORBA::ValueBase *&);
+
+ virtual CORBA::Boolean stream_to_abstract_base (
+ TAO_InputCDR &,
+ CORBA::AbstractBase_ptr &
+ );
+
+ virtual CORBA::Long type_info_single (void) const;
+
+ virtual CORBA::Boolean is_type_info_implied (CORBA::Long) const;
+ virtual CORBA::Boolean is_type_info_single (CORBA::Long) const;
+ virtual CORBA::Boolean is_type_info_list (CORBA::Long) const;
+ virtual CORBA::Boolean is_value_chunked (CORBA::Long) const;
+
+ virtual int vf_map_rebind (const char *,
+ CORBA::ValueFactory &);
+
+ virtual int vf_map_unbind (const char *);
+
+ virtual CORBA::ValueFactory vf_map_find (const char *);
+
+private:
+ TAO_ValueFactory_Map map_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_VALUETYPE_ADAPTER_IMPL_H */
diff --git a/TAO/tao/Valuetype/Valuetype_Sequence_Element_T.h b/TAO/tao/Valuetype/Valuetype_Sequence_Element_T.h
new file mode 100644
index 00000000000..e9631236169
--- /dev/null
+++ b/TAO/tao/Valuetype/Valuetype_Sequence_Element_T.h
@@ -0,0 +1,127 @@
+#ifndef guard_valuetype_sequence_element_hpp
+#define guard_valuetype_sequence_element_hpp
+/**
+ * @file
+ *
+ * @brief Implement the type returned by operator[] in valuetype
+ * sequences.
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan
+ */
+#include "tao/Basic_Types.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+namespace details
+{
+
+template<typename obj_ref_traits>
+class valuetype_sequence_element
+{
+public:
+ typedef typename obj_ref_traits::object_type valuetype_type;
+ typedef valuetype_type * value_type;
+ typedef valuetype_type const * const_value_type;
+ typedef typename obj_ref_traits::object_type_var valuetype_var;
+
+private:
+ inline valuetype_sequence_element<obj_ref_traits> & pseudo_copy_swap(
+ valuetype_var & rhs)
+ {
+ if (release())
+ {
+ obj_ref_traits::release(*element_);
+ }
+ *element_ = rhs._retn();
+ return *this;
+ }
+
+public:
+ valuetype_sequence_element(
+ value_type & e, CORBA::Boolean release)
+ : element_(&e)
+ , release_(release)
+ {
+ }
+
+ valuetype_sequence_element(
+ valuetype_sequence_element const & rhs)
+ : element_(rhs.element_)
+ , release_(rhs.release_)
+ {
+ }
+
+ ~valuetype_sequence_element()
+ {
+ }
+
+ valuetype_sequence_element & operator=(
+ valuetype_var const & rhs)
+ {
+ valuetype_var tmp(rhs);
+ return pseudo_copy_swap(tmp);
+ }
+
+ valuetype_sequence_element & operator=(
+ valuetype_sequence_element const & rhs)
+ {
+ valuetype_var tmp(obj_ref_traits::duplicate(*rhs.element_));
+ return pseudo_copy_swap(tmp);
+ }
+
+ valuetype_sequence_element & operator=(value_type rhs)
+ {
+ valuetype_var tmp(rhs);
+ return pseudo_copy_swap(tmp);
+ }
+
+ inline operator value_type()
+ {
+ return *element_;
+ }
+
+ inline operator const_value_type() const
+ {
+ return *element_;
+ }
+
+ inline value_type operator->()
+ {
+ return *element_;
+ }
+
+ inline value_type operator->() const
+ {
+ return *element_;
+ }
+
+ void swap(valuetype_sequence_element & rhs)
+ {
+ std::swap(element_, rhs.element_);
+ std::swap(release_, rhs.release_);
+ }
+
+ inline CORBA::Boolean release() const
+ {
+ return release_;
+ }
+
+private:
+ // This function is not implemented
+ valuetype_sequence_element();
+
+private:
+ value_type * element_;
+ CORBA::Boolean release_;
+};
+
+} // namespace details
+} // namespace CORBA
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif // guard_valuetype_sequence_element_hpp
diff --git a/TAO/tao/Valuetype/Valuetype_Traits_Base_T.h b/TAO/tao/Valuetype/Valuetype_Traits_Base_T.h
new file mode 100644
index 00000000000..13dfe7ad06d
--- /dev/null
+++ b/TAO/tao/Valuetype/Valuetype_Traits_Base_T.h
@@ -0,0 +1,57 @@
+#ifndef valuetype_traits_base_hpp
+#define valuetype_traits_base_hpp
+/**
+ * @file
+ *
+ * @brief Base class for the valuetype traits.
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan
+ */
+
+#include "tao/Objref_VarOut_T.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+namespace details
+{
+
+template<typename object_t, typename object_t_var>
+struct valuetype_traits_base
+{
+ typedef object_t object_type;
+ typedef object_type * value_type;
+ typedef object_type const * const_value_type;
+ typedef object_t_var object_type_var;
+
+ inline static void release(object_type * object)
+ {
+ TAO::Value_Traits<object_type>::remove_ref(object);
+ }
+
+ inline static object_type * duplicate(object_type * object)
+ {
+ TAO::Value_Traits<object_type>::add_ref(object);
+ return object;
+ }
+
+ inline static object_type * nil()
+ {
+ return 0;
+ }
+
+ inline static object_type * default_initializer()
+ {
+ return nil();
+ }
+};
+
+} // namespace details
+} // namespace TAO
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif // valuetype_traits_base_hpp
diff --git a/TAO/tao/Valuetype/Valuetype_Traits_T.h b/TAO/tao/Valuetype/Valuetype_Traits_T.h
new file mode 100644
index 00000000000..f8b5ee460be
--- /dev/null
+++ b/TAO/tao/Valuetype/Valuetype_Traits_T.h
@@ -0,0 +1,82 @@
+#ifndef guard_valuetype_traits_hpp
+#define guard_valuetype_traits_hpp
+/**
+ * @file
+ *
+ * @brief Implement the element manipulation traits for valuetype types.
+ *
+ * $Id$
+ *
+ * @author Carlos O'Ryan
+ */
+#include "Valuetype_Traits_Base_T.h"
+
+#include <algorithm>
+#include <functional>
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+namespace details
+{
+
+template<class object_t, class object_t_var, class derived>
+struct valuetype_traits_decorator
+{
+ typedef object_t object_type;
+ typedef object_type * value_type;
+ typedef object_type const * const_value_type;
+ typedef object_t_var object_type_var;
+
+ inline static void zero_range(
+ object_type ** begin, object_type ** end)
+ {
+ std::fill(begin, end, derived::nil());
+ }
+
+ inline static void initialize_range(
+ object_type ** begin, object_type ** end)
+ {
+ std::generate(begin, end, &derived::default_initializer);
+ }
+
+ inline static void copy_range(
+ object_type ** begin, object_type ** end, object_type ** dst)
+ {
+ std::transform(begin, end, dst, &derived::duplicate);
+ }
+
+ inline static void release_range(
+ object_type ** begin, object_type ** end)
+ {
+ std::for_each(begin, end, &derived::release);
+ }
+
+ inline static object_type const * initialize_if_zero(object_type * & element)
+ {
+ if (element == 0)
+ {
+ element = derived::nil();
+ }
+ return element;
+ }
+};
+
+template<typename object_t, typename object_t_var, bool dummy>
+struct valuetype_traits
+ : public valuetype_traits_base<object_t, object_t_var>
+ , public valuetype_traits_decorator<object_t, object_t_var, valuetype_traits<object_t,object_t_var,dummy> >
+{
+ typedef object_t object_type;
+ typedef object_type * value_type;
+ typedef object_type const * const_value_type;
+ typedef object_t_var object_type_var;
+};
+
+} // namespace details
+} // namespace CORBA
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif // guard_valuetype_traits_hpp
diff --git a/TAO/tao/Valuetype/valuetype_export.h b/TAO/tao/Valuetype/valuetype_export.h
new file mode 100644
index 00000000000..851fa9a4ea2
--- /dev/null
+++ b/TAO/tao/Valuetype/valuetype_export.h
@@ -0,0 +1,40 @@
+
+// -*- C++ -*-
+// $Id$
+// Definition for Win32 Export directives.
+// This file is generated automatically by generate_export_file.pl
+// ------------------------------
+#ifndef TAO_VAULETYPE_EXPORT_H
+#define TAO_VAULETYPE_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if defined (TAO_AS_STATIC_LIBS)
+# if !defined (TAO_VALUETYPE_HAS_DLL)
+# define TAO_VALUETYPE_HAS_DLL 0
+# endif /* ! TAO_IORINTERCEPTOR_HAS_DLL */
+#else
+# if !defined (TAO_VALUETYPE_HAS_DLL)
+# define TAO_VALUETYPE_HAS_DLL 1
+# endif /* ! TAO_IORINTERCEPTOR_HAS_DLL */
+#endif
+
+#if defined (TAO_VALUETYPE_HAS_DLL) && (TAO_VALUETYPE_HAS_DLL == 1)
+# if defined (TAO_VALUETYPE_BUILD_DLL)
+# define TAO_Valuetype_Export ACE_Proper_Export_Flag
+# define TAO_VALUETYPE_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# define TAO_VALUETYPE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# else /* TAO_VALUETYPE_BUILD_DLL */
+# define TAO_Valuetype_Export ACE_Proper_Import_Flag
+# define TAO_VALUETYPE_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# define TAO_VALUETYPE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# endif /* TAO_IORINTERCEPTOR_BUILD_DLL */
+#else /* TAO_VALUETYPE_HAS_DLL == 1 */
+# define TAO_Valuetype_Export
+# define TAO_VALUETYPE_SINGLETON_DECLARATION(T)
+# define TAO_VALUETYPE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+#endif /* TAO_VALUETYPE_HAS_DLL == 1 */
+
+#endif /* TAO_VAULETYPE_EXPORT_H */
+
+// End of auto generated file.
diff --git a/TAO/tao/Valuetype_Adapter.cpp b/TAO/tao/Valuetype_Adapter.cpp
new file mode 100644
index 00000000000..42cf8207876
--- /dev/null
+++ b/TAO/tao/Valuetype_Adapter.cpp
@@ -0,0 +1,15 @@
+// $Id$
+
+#include "tao/Valuetype_Adapter.h"
+
+ACE_RCSID (tao,
+ Valuetype_Adapter,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Valuetype_Adapter::~TAO_Valuetype_Adapter (void)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Valuetype_Adapter.h b/TAO/tao/Valuetype_Adapter.h
new file mode 100644
index 00000000000..1e2b608329a
--- /dev/null
+++ b/TAO/tao/Valuetype_Adapter.h
@@ -0,0 +1,88 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Valuetype_Adapter.h
+ *
+ * $Id$
+ *
+ * @author Jeff Parsons <j.parsons@vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_VALUETYPE_ADAPTER_H
+#define TAO_VALUETYPE_ADAPTER_H
+
+#include /**/ "ace/pre.h"
+#include "ace/Service_Object.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/TAO_Export.h"
+#include "tao/Basic_Types.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace CORBA
+{
+ class Object;
+ typedef Object *Object_ptr;
+
+ class AbstractBase;
+ typedef AbstractBase *AbstractBase_ptr;
+
+ class ValueBase;
+
+ class ValueFactoryBase;
+ typedef ValueFactoryBase *ValueFactory;
+}
+
+class TAO_InputCDR;
+
+/**
+ * @class TAO_Valuetype_Adapter
+ *
+ * @brief TAO_Valuetype_Adapter.
+ *
+ * Class that adapts various functions involving the Valuetype,
+ * ValueFactory and AbstractInterface classes. This is a base class for
+ * the actual implementation in the TAO_Valuetype library.
+ */
+class TAO_Export TAO_Valuetype_Adapter : public ACE_Service_Object
+{
+public:
+ virtual ~TAO_Valuetype_Adapter (void);
+
+ virtual CORBA::Object_ptr abstractbase_to_object (
+ CORBA::AbstractBase_ptr p
+ ) = 0;
+
+ virtual CORBA::Boolean stream_to_value (TAO_InputCDR &,
+ CORBA::ValueBase *&) = 0;
+
+ virtual CORBA::Boolean stream_to_abstract_base (
+ TAO_InputCDR &,
+ CORBA::AbstractBase_ptr &
+ ) = 0;
+
+ virtual CORBA::Long type_info_single (void) const = 0;
+
+ virtual CORBA::Boolean is_type_info_implied (CORBA::Long) const = 0;
+ virtual CORBA::Boolean is_type_info_single (CORBA::Long) const = 0;
+ virtual CORBA::Boolean is_type_info_list (CORBA::Long) const = 0;
+ virtual CORBA::Boolean is_value_chunked (CORBA::Long) const = 0;
+
+ virtual int vf_map_rebind (const char *,
+ CORBA::ValueFactory &) = 0;
+
+ virtual int vf_map_unbind (const char *) = 0;
+
+ virtual CORBA::ValueFactory vf_map_find (const char *) = 0;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_VALUETYPE_ADAPTER_H */
diff --git a/TAO/tao/Valuetype_Adapter_Factory.cpp b/TAO/tao/Valuetype_Adapter_Factory.cpp
new file mode 100644
index 00000000000..5cee721f6af
--- /dev/null
+++ b/TAO/tao/Valuetype_Adapter_Factory.cpp
@@ -0,0 +1,14 @@
+// $Id$
+#include "tao/Valuetype_Adapter_Factory.h"
+
+ACE_RCSID (tao,
+ Valuetype_Adapter_Factory,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Valuetype_Adapter_Factory::~TAO_Valuetype_Adapter_Factory (void)
+{
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Valuetype_Adapter_Factory.h b/TAO/tao/Valuetype_Adapter_Factory.h
new file mode 100644
index 00000000000..dabd7e7159a
--- /dev/null
+++ b/TAO/tao/Valuetype_Adapter_Factory.h
@@ -0,0 +1,55 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Valuetype_Adapter_Factory.h
+ *
+ * $Id$
+ *
+ * @author Kees van Marle <kvmarle@remedy.nl>
+ */
+//=============================================================================
+
+
+#ifndef TAO_VALUETYPE_ADAPTER_FACTORY_H
+#define TAO_VALUETYPE_ADAPTER_FACTORY_H
+
+#include /**/ "ace/pre.h"
+#include "ace/Service_Object.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/SystemException.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Valuetype_Adapter;
+
+/**
+ * @class TAO_Valuetype_Adapter_Factory
+ *
+ * @brief TAO_Valuetype_Adapter_Factory.
+ *
+ * Class that creates one instance of TAO_Valuetype_Adapter per
+ * ORB on the ORB's first usage of its valuetype_adapter_. This is a base
+ * class for the actual implementation in the TAO_Valuetype library.
+ */
+class TAO_Export TAO_Valuetype_Adapter_Factory
+ : public ACE_Service_Object
+{
+public:
+ virtual ~TAO_Valuetype_Adapter_Factory (void);
+
+ virtual TAO_Valuetype_Adapter * create (
+ ACE_ENV_SINGLE_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException)) = 0;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_VALUETYPE_ADAPTER_FACTORY_H */
diff --git a/TAO/tao/VarOut_T.cpp b/TAO/tao/VarOut_T.cpp
new file mode 100644
index 00000000000..85a31f687e4
--- /dev/null
+++ b/TAO/tao/VarOut_T.cpp
@@ -0,0 +1,72 @@
+// $Id$
+
+#ifndef TAO_VAROUT_T_CPP
+#define TAO_VAROUT_T_CPP
+
+#include "tao/VarOut_T.h"
+
+#if !defined (__ACE_INLINE__)
+#include "tao/VarOut_T.inl"
+#endif /* __ACE_INLINE__ */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template<typename T>
+TAO_Var_Base_T<T>::TAO_Var_Base_T (const TAO_Var_Base_T<T> & p)
+ : ptr_ (p.ptr_ ? new T (*p.ptr_) : 0)
+{
+}
+
+// *************************************************************
+
+template<typename T>
+TAO_Fixed_Var_T<T> &
+TAO_Fixed_Var_T<T>::operator= (const TAO_Fixed_Var_T<T> & p)
+{
+ // Strongly exception safe assignment using copy and non-throwing
+ // swap technique.
+ TAO_Fixed_Var_T<T> tmp (p);
+
+ T * old_ptr = this->ptr_;
+ this->ptr_ = tmp.ptr_;
+ tmp.ptr_ = old_ptr;
+
+ return *this;
+}
+
+// Fixed-size types only.
+template<typename T>
+TAO_Fixed_Var_T<T> &
+TAO_Fixed_Var_T<T>::operator= (const T & p)
+{
+ // Strongly exception safe assignment using copy and non-throwing
+ // swap technique.
+ TAO_Fixed_Var_T<T> tmp (p);
+
+ T * old_ptr = this->ptr_;
+ this->ptr_ = tmp.ptr_;
+ tmp.ptr_ = old_ptr;
+
+ return *this;
+}
+
+// *************************************************************
+
+template<typename T>
+TAO_Var_Var_T<T> &
+TAO_Var_Var_T<T>::operator= (const TAO_Var_Var_T<T> & p)
+{
+ // Strongly exception safe assignment using copy and non-throwing
+ // swap technique.
+ TAO_Var_Var_T<T> tmp (p);
+
+ T * old_ptr = this->ptr_;
+ this->ptr_ = tmp.ptr_;
+ tmp.ptr_ = old_ptr;
+
+ return *this;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_VAROUT_T_CPP */
diff --git a/TAO/tao/VarOut_T.h b/TAO/tao/VarOut_T.h
new file mode 100644
index 00000000000..358d7371b26
--- /dev/null
+++ b/TAO/tao/VarOut_T.h
@@ -0,0 +1,172 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file VarOut_T.h
+ *
+ * $Id$
+ *
+ * @author Jeff Parsons
+ */
+//=============================================================================
+
+#ifndef TAO_VAROUT_T_H
+#define TAO_VAROUT_T_H
+
+#include /**/ "ace/pre.h"
+
+#include "ace/OS_Memory.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_Var_Base_T
+ *
+ * @brief Parametrized implementation of _var base class for structs,
+ * unions and exceptions.
+ *
+ */
+template<typename T>
+class TAO_Var_Base_T
+{
+public:
+ TAO_Var_Base_T (void);
+ TAO_Var_Base_T (T *);
+ TAO_Var_Base_T (const TAO_Var_Base_T<T> &);
+
+ ~TAO_Var_Base_T (void);
+
+ T * operator-> (void);
+ const T * operator-> (void) const;
+
+ operator const T & () const;
+ operator T & ();
+ operator T & () const;
+
+ typedef const T & _in_type;
+ typedef T & _inout_type;
+
+ // Common mapping for fixed and variable size types.
+ _in_type in (void) const;
+ _inout_type inout (void);
+
+ // TAO extension.
+ T * ptr (void) const;
+
+protected:
+ T * ptr_;
+};
+
+/**
+ * @class TAO_Fixed_Var_T
+ *
+ * @brief Parametrized implementation of _var class for structs, unions,
+ * and exceptions with members of fixed size.
+ *
+ */
+template<typename T>
+class TAO_Fixed_Var_T : public TAO_Var_Base_T<T>
+{
+public:
+ TAO_Fixed_Var_T (void);
+ TAO_Fixed_Var_T (T *);
+ TAO_Fixed_Var_T (const TAO_Fixed_Var_T<T> &);
+
+ // Fixed-size types only.
+ TAO_Fixed_Var_T (const T &);
+
+ TAO_Fixed_Var_T & operator= (T *);
+ TAO_Fixed_Var_T & operator= (const TAO_Fixed_Var_T<T> &);
+
+ // Fixed-size types only.
+ TAO_Fixed_Var_T & operator= (const T &);
+
+ typedef T & _out_type;
+ typedef T _retn_type;
+
+ // Mapping for fixed size types.
+ _out_type out (void);
+ _retn_type _retn (void);
+};
+
+/**
+ * @class TAO_Var_Var_T
+ *
+ * @brief Parametrized implementation of _var class for structs, unions,
+ * and exceptions with members of variable size.
+ *
+ */
+template<typename T>
+class TAO_Var_Var_T : public TAO_Var_Base_T<T>
+{
+public:
+ TAO_Var_Var_T (void);
+ TAO_Var_Var_T (T *);
+ TAO_Var_Var_T (const TAO_Var_Var_T<T> &);
+
+ TAO_Var_Var_T & operator= (T *);
+ TAO_Var_Var_T & operator= (const TAO_Var_Var_T<T> &);
+
+ // Variable size types only.
+ operator T *& ();
+
+ typedef T *& _out_type;
+ typedef T * _retn_type;
+
+ // Mapping for variable size types.
+ _out_type out (void);
+ _retn_type _retn (void);
+};
+
+/**
+ * @class TAO_Out_T
+ *
+ * @brief Parametrized implementation of _out class for structs, unions
+ * and exceptions..
+ *
+ */
+template<typename T>
+class TAO_Out_T
+{
+public:
+ typedef typename T::_var_type T_var;
+
+ TAO_Out_T (T *&);
+ TAO_Out_T (T_var &);
+ TAO_Out_T (const TAO_Out_T<T> &);
+
+ TAO_Out_T &operator= (const TAO_Out_T<T> &);
+ TAO_Out_T &operator= (T *);
+
+ operator T *& ();
+ T *& ptr (void);
+ T * operator-> (void);
+
+private:
+ T *& ptr_;
+
+ // Assignment from T_var not allowed.
+ void operator= (const T_var &);
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+#include "tao/VarOut_T.inl"
+#endif /* __ACE_INLINE__ */
+
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+#include "tao/VarOut_T.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
+#pragma implementation ("VarOut_T.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_VAROUT_T_H */
diff --git a/TAO/tao/VarOut_T.inl b/TAO/tao/VarOut_T.inl
new file mode 100644
index 00000000000..3f7bc1c5450
--- /dev/null
+++ b/TAO/tao/VarOut_T.inl
@@ -0,0 +1,271 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template<typename T>
+ACE_INLINE
+TAO_Var_Base_T<T>::TAO_Var_Base_T (void)
+ : ptr_ (0)
+{}
+
+template<typename T>
+ACE_INLINE
+TAO_Var_Base_T<T>::TAO_Var_Base_T (T * p)
+ : ptr_ (p)
+{}
+
+template<typename T>
+ACE_INLINE
+TAO_Var_Base_T<T>::~TAO_Var_Base_T (void)
+{
+ delete this->ptr_;
+}
+
+template<typename T>
+ACE_INLINE
+const T *
+TAO_Var_Base_T<T>::operator-> (void) const
+{
+ return this->ptr_;
+}
+
+template<typename T>
+ACE_INLINE
+T *
+TAO_Var_Base_T<T>::operator-> (void)
+{
+ return this->ptr_;
+}
+
+template<typename T>
+ACE_INLINE
+TAO_Var_Base_T<T>::operator const T & () const
+{
+ return *this->ptr_;
+}
+
+template<typename T>
+ACE_INLINE
+TAO_Var_Base_T<T>::operator T & ()
+{
+ return *this->ptr_;
+}
+
+template<typename T>
+ACE_INLINE
+TAO_Var_Base_T<T>::operator T & () const
+{
+ return *this->ptr_;
+}
+
+template<typename T>
+ACE_INLINE
+const T &
+TAO_Var_Base_T<T>::in (void) const
+{
+ return *this->ptr_;
+}
+
+template<typename T>
+ACE_INLINE
+T &
+TAO_Var_Base_T<T>::inout (void)
+{
+ return *this->ptr_;
+}
+
+template<typename T>
+ACE_INLINE
+T *
+TAO_Var_Base_T<T>::ptr (void) const
+{
+ return this->ptr_;
+}
+// *************************************************************
+
+template<typename T>
+ACE_INLINE
+TAO_Fixed_Var_T<T>::TAO_Fixed_Var_T (void)
+{}
+
+template<typename T>
+ACE_INLINE
+TAO_Fixed_Var_T<T>::TAO_Fixed_Var_T (T * p)
+ : TAO_Var_Base_T<T> (p)
+{}
+
+template<typename T>
+ACE_INLINE
+TAO_Fixed_Var_T<T>::TAO_Fixed_Var_T (const TAO_Fixed_Var_T<T> & p)
+ : TAO_Var_Base_T<T> (p)
+{}
+
+// Fixed-size types only.
+template<typename T>
+ACE_INLINE
+TAO_Fixed_Var_T<T>::TAO_Fixed_Var_T (const T & p)
+{
+ ACE_NEW (this->ptr_,
+ T (p));
+}
+
+template<typename T>
+ACE_INLINE
+TAO_Fixed_Var_T<T> &
+TAO_Fixed_Var_T<T>::operator= (T * p)
+{
+ delete this->ptr_;
+ this->ptr_ = p;
+ return *this;
+}
+
+// Mapping for fixed size.
+template<typename T>
+ACE_INLINE
+T &
+TAO_Fixed_Var_T<T>::out (void)
+{
+ // Use plain new, using the ACE_NEW macros will mean we dereference a
+ // nil pointer and crash which is more bad then plain new which could
+ // lead to a bad_alloc exception
+ if (this->ptr_ == 0)
+ this->ptr_ = new T;
+
+ return *this->ptr_;
+}
+
+template<typename T>
+ACE_INLINE
+T
+TAO_Fixed_Var_T<T>::_retn (void)
+{
+ return *this->ptr_;
+}
+
+// *************************************************************
+
+template<typename T>
+ACE_INLINE
+TAO_Var_Var_T<T>::TAO_Var_Var_T (void)
+{}
+
+template<typename T>
+ACE_INLINE
+TAO_Var_Var_T<T>::TAO_Var_Var_T (T * p)
+ : TAO_Var_Base_T<T> (p)
+{}
+
+template<typename T>
+ACE_INLINE
+TAO_Var_Var_T<T>::TAO_Var_Var_T (const TAO_Var_Var_T<T> & p)
+ : TAO_Var_Base_T<T> (p)
+{}
+
+template<typename T>
+ACE_INLINE
+TAO_Var_Var_T<T> &
+TAO_Var_Var_T<T>::operator= (T * p)
+{
+ delete this->ptr_;
+ this->ptr_ = p;
+ return *this;
+}
+
+// Variable-size types only.
+template<typename T>
+ACE_INLINE
+TAO_Var_Var_T<T>::operator T *& ()
+{
+ return this->ptr_;
+}
+
+// Mapping for variable size.
+template<typename T>
+ACE_INLINE
+T *&
+TAO_Var_Var_T<T>::out (void)
+{
+ delete this->ptr_;
+ this->ptr_ = 0;
+ return this->ptr_;
+}
+
+template<typename T>
+ACE_INLINE
+T *
+TAO_Var_Var_T<T>::_retn (void)
+{
+ T * tmp = this->ptr_;
+ this->ptr_ = 0;
+ return tmp;
+}
+
+// *************************************************************
+
+template<typename T>
+ACE_INLINE
+TAO_Out_T<T>::TAO_Out_T (T *& p)
+ : ptr_ (p)
+{
+ this->ptr_ = 0;
+}
+
+template<typename T>
+ACE_INLINE
+TAO_Out_T<T>::TAO_Out_T (T_var & p)
+ : ptr_ (p.out ())
+{
+ delete this->ptr_;
+ this->ptr_ = 0;
+}
+
+template<typename T>
+ACE_INLINE
+TAO_Out_T<T>::TAO_Out_T (const TAO_Out_T<T> & p)
+ : ptr_ (p.ptr_)
+{}
+
+template<typename T>
+ACE_INLINE
+TAO_Out_T<T> &
+TAO_Out_T<T>::operator= (const TAO_Out_T<T> & p)
+{
+ this->ptr_ = p.ptr_;
+ return *this;
+}
+
+template<typename T>
+ACE_INLINE
+TAO_Out_T<T> &
+TAO_Out_T<T>::operator= (T * p)
+{
+ this->ptr_ = p;
+ return *this;
+}
+
+template<typename T>
+ACE_INLINE
+TAO_Out_T<T>::operator T *& ()
+{
+ return this->ptr_;
+}
+
+template<typename T>
+ACE_INLINE
+T *&
+TAO_Out_T<T>::ptr (void)
+{
+ return this->ptr_;
+}
+
+template<typename T>
+ACE_INLINE
+T *
+TAO_Out_T<T>::operator-> (void)
+{
+ return this->ptr_;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Var_Array_Argument_T.cpp b/TAO/tao/Var_Array_Argument_T.cpp
new file mode 100644
index 00000000000..eccb201ae85
--- /dev/null
+++ b/TAO/tao/Var_Array_Argument_T.cpp
@@ -0,0 +1,141 @@
+// $Id$
+
+#ifndef TAO_VAR_ARRAY_ARGUMENT_T_CPP
+#define TAO_VAR_ARRAY_ARGUMENT_T_CPP
+
+#include "tao/Var_Array_Argument_T.h"
+
+#if !defined (__ACE_INLINE__)
+#include "tao/Var_Array_Argument_T.inl"
+#endif /* __ACE_INLINE__ */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template<typename S_forany,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::In_Var_Array_Argument_T<S_forany,Insert_Policy>::marshal (
+ TAO_OutputCDR & cdr
+ )
+{
+ return cdr << this->x_;
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S_forany,
+ class Insert_Policy>
+void
+TAO::In_Var_Array_Argument_T<S_forany,Insert_Policy>::interceptor_value (
+ CORBA::Any *any) const
+{
+ Insert_Policy::any_insert (any, this->x_);
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+// ===========================================================
+
+template<typename S_forany,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::Inout_Var_Array_Argument_T<S_forany,Insert_Policy>::marshal (
+ TAO_OutputCDR & cdr
+ )
+{
+ return cdr << this->x_;
+}
+
+template<typename S_forany,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::Inout_Var_Array_Argument_T<S_forany,Insert_Policy>::demarshal (
+ TAO_InputCDR & cdr
+ )
+{
+ return cdr >> this->x_;
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S_forany,
+ class Insert_Policy>
+void
+TAO::Inout_Var_Array_Argument_T<S_forany,Insert_Policy>::interceptor_value (
+ CORBA::Any *any) const
+{
+ Insert_Policy::any_insert (any, this->x_);
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+// ==============================================================
+
+template<typename S_out,
+ typename S_forany,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::Out_Var_Array_Argument_T<S_out,S_forany,Insert_Policy>::demarshal (
+ TAO_InputCDR & cdr
+ )
+{
+ typedef TAO::Array_Traits<S_forany> ARRAY_TRAITS;
+ ACE_ALLOCATOR_RETURN (this->x_,
+ ARRAY_TRAITS::alloc (),
+ 0);
+ S_forany tmp (this->x_);
+ return cdr >> tmp;
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S_out,
+ typename S_forany,
+ class Insert_Policy>
+void
+TAO::Out_Var_Array_Argument_T<S_out,S_forany,Insert_Policy>::
+interceptor_value (CORBA::Any *any) const
+{
+ S_forany tmp (this->x_);
+ Insert_Policy::any_insert (any, tmp);
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+// ============================================================
+
+template<typename S_var,
+ typename S_forany,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::Ret_Var_Array_Argument_T<S_var,S_forany,Insert_Policy>::demarshal (
+ TAO_InputCDR & cdr
+ )
+{
+ typedef TAO::Array_Traits<S_forany> ARRAY_TRAITS;
+ typename S_forany::_slice_type * tmp_ptr = 0;
+ ACE_ALLOCATOR_RETURN (tmp_ptr,
+ ARRAY_TRAITS::alloc (),
+ 0);
+ this->x_ = tmp_ptr;
+ S_forany tmp (this->x_.ptr ());
+ return cdr >> tmp;
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S_var,
+ typename S_forany,
+ class Insert_Policy>
+void
+TAO::Ret_Var_Array_Argument_T<S_var,S_forany,Insert_Policy>::
+interceptor_value (CORBA::Any *any) const
+{
+ Insert_Policy::any_insert (any, S_forany (this->x_.ptr ()));
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_VAR_ARRAY_ARGUMENT_T_CPP */
diff --git a/TAO/tao/Var_Array_Argument_T.h b/TAO/tao/Var_Array_Argument_T.h
new file mode 100644
index 00000000000..951b983630b
--- /dev/null
+++ b/TAO/tao/Var_Array_Argument_T.h
@@ -0,0 +1,171 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Var_Array_Argument_T.h
+ *
+ * $Id$
+ *
+ * @authors Jeff Parsons and Carlos O'Ryan
+ */
+//=============================================================================
+
+#ifndef TAO_VAR_ARRAY_ARGUMENT_T_H
+#define TAO_VAR_ARRAY_ARGUMENT_T_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Argument.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ /**
+ * @class In_Var_Array_Argument_T
+ *
+ * @brief IN stub argument of variable size element array.
+ *
+ */
+ template<typename S_forany,
+ class Insert_Policy>
+ class In_Var_Array_Argument_T : public InArgument
+ {
+ public:
+ In_Var_Array_Argument_T (const typename S_forany::_slice_type * x);
+
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ typename S_forany::_slice_type const * arg (void) const;
+
+ private:
+ S_forany x_;
+ };
+
+ /**
+ * @class Inout_Var_Array_Argument_T
+ *
+ * @brief INOUT stub argument of variable size element array.
+ *
+ */
+ template<typename S_forany,
+ class Insert_Policy>
+ class Inout_Var_Array_Argument_T : public InoutArgument
+ {
+ public:
+ Inout_Var_Array_Argument_T (typename S_forany::_slice_type *&x);
+
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+ virtual CORBA::Boolean demarshal (TAO_InputCDR &);
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ typename S_forany::_slice_type * arg (void);
+
+ private:
+ S_forany x_;
+ };
+
+ /**
+ * @class Out_Var_Array_Argument_T
+ *
+ * @brief OUT stub argument of variable size element array.
+ *
+ */
+ template<typename S_out,
+ typename S_forany,
+ class Insert_Policy>
+ class Out_Var_Array_Argument_T : public OutArgument
+ {
+ public:
+ Out_Var_Array_Argument_T (S_out x);
+
+ virtual CORBA::Boolean demarshal (TAO_InputCDR &);
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ typename S_forany::_slice_type *& arg (void);
+
+ private:
+ typename S_forany::_slice_type *& x_;
+ };
+
+ /**
+ * @class Ret_Var_Array_Argument_T
+ *
+ * @brief Return stub value of variable size element array.
+ *
+ */
+ template<typename S_var,
+ typename S_forany,
+ class Insert_Policy>
+ class Ret_Var_Array_Argument_T : public RetArgument
+ {
+ public:
+ Ret_Var_Array_Argument_T (void);
+
+ virtual CORBA::Boolean demarshal (TAO_InputCDR &);
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ typename S_forany::_slice_type *& arg (void);
+
+ typename S_forany::_slice_type * excp (void);
+ typename S_forany::_slice_type * retn (void);
+
+ private:
+ S_var x_;
+ };
+
+ /**
+ * @struct Var_Array_Arg_Traits_T
+ *
+ * @brief Argument traits of variable size element array.
+ *
+ */
+ template<typename T_out,
+ typename T_forany,
+ class Insert_Policy>
+ struct Var_Array_Arg_Traits_T
+ {
+ typedef typename T_forany::_slice_type * ret_type;
+ typedef const typename T_forany::_array_type in_type;
+ typedef typename T_forany::_array_type inout_type;
+ typedef T_out out_type;
+
+ typedef In_Var_Array_Argument_T<T_forany,
+ Insert_Policy> in_arg_val;
+ typedef Inout_Var_Array_Argument_T<T_forany,
+ Insert_Policy> inout_arg_val;
+ typedef Out_Var_Array_Argument_T<T_out,
+ T_forany,
+ Insert_Policy> out_arg_val;
+ typedef Ret_Var_Array_Argument_T<typename T_out::_var_type,
+ T_forany,
+ Insert_Policy> ret_val;
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+#include "tao/Var_Array_Argument_T.inl"
+#endif /* __ACE_INLINE__ */
+
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+#include "tao/Var_Array_Argument_T.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
+#pragma implementation ("Var_Array_Argument_T.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_VAR_ARRAY_ARGUMENT_T_H */
diff --git a/TAO/tao/Var_Array_Argument_T.inl b/TAO/tao/Var_Array_Argument_T.inl
new file mode 100644
index 00000000000..49ae7c5f813
--- /dev/null
+++ b/TAO/tao/Var_Array_Argument_T.inl
@@ -0,0 +1,107 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template<typename S_forany,
+ class Insert_Policy>
+ACE_INLINE
+TAO::In_Var_Array_Argument_T<S_forany,Insert_Policy>::
+In_Var_Array_Argument_T (const typename S_forany::_slice_type * x)
+ : x_ (const_cast<typename S_forany::_slice_type *> (x))
+{
+}
+
+template<typename S_forany,
+ class Insert_Policy>
+ACE_INLINE
+typename S_forany::_slice_type const *
+TAO::In_Var_Array_Argument_T<S_forany,Insert_Policy>::arg (void) const
+{
+ return this->x_.in ();
+}
+
+// ==========================================================================
+
+template<typename S_forany,
+ class Insert_Policy>
+ACE_INLINE
+TAO::Inout_Var_Array_Argument_T<S_forany,Insert_Policy>::
+Inout_Var_Array_Argument_T (typename S_forany::_slice_type *&x)
+ : x_ (x)
+{
+}
+
+template<typename S_forany,
+ class Insert_Policy>
+ACE_INLINE
+typename S_forany::_slice_type *
+TAO::Inout_Var_Array_Argument_T<S_forany,Insert_Policy>::arg (void)
+{
+ return this->x_.inout ();
+}
+
+// ==========================================================================
+
+template<typename S_out,
+ typename S_forany,
+ class Insert_Policy>
+ACE_INLINE
+TAO::Out_Var_Array_Argument_T<S_out,S_forany,Insert_Policy>::
+Out_Var_Array_Argument_T (S_out x)
+ : x_ (x.ptr ())
+{
+}
+
+template<typename S_out,
+ typename S_forany,
+ class Insert_Policy>
+ACE_INLINE
+typename S_forany::_slice_type *&
+TAO::Out_Var_Array_Argument_T<S_out,S_forany,Insert_Policy>::arg (void)
+{
+ return this->x_;
+}
+
+// ==========================================================================
+
+template<typename S_var,
+ typename S_forany,
+ class Insert_Policy>
+ACE_INLINE
+TAO::Ret_Var_Array_Argument_T<S_var,S_forany,Insert_Policy>::
+Ret_Var_Array_Argument_T (void)
+{}
+
+template<typename S_var,
+ typename S_forany,
+ class Insert_Policy>
+ACE_INLINE
+typename S_forany::_slice_type *&
+TAO::Ret_Var_Array_Argument_T<S_var,S_forany,Insert_Policy>::arg (void)
+{
+ return this->x_.out ();
+}
+
+template<typename S_var,
+ typename S_forany,
+ class Insert_Policy>
+ACE_INLINE
+typename S_forany::_slice_type *
+TAO::Ret_Var_Array_Argument_T<S_var,S_forany,Insert_Policy>::excp (void)
+{
+ return this->x_.ptr ();
+}
+
+template<typename S_var,
+ typename S_forany,
+ class Insert_Policy>
+ACE_INLINE
+typename S_forany::_slice_type *
+TAO::Ret_Var_Array_Argument_T<S_var,S_forany,Insert_Policy>::retn (void)
+{
+ return this->x_._retn ();
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Var_Size_Argument_T.cpp b/TAO/tao/Var_Size_Argument_T.cpp
new file mode 100644
index 00000000000..a185d49ed28
--- /dev/null
+++ b/TAO/tao/Var_Size_Argument_T.cpp
@@ -0,0 +1,136 @@
+// $Id$
+
+#ifndef TAO_VAR_SIZE_ARGUMENT_T_CPP
+#define TAO_VAR_SIZE_ARGUMENT_T_CPP
+
+#include "tao/Var_Size_Argument_T.h"
+
+#if !defined (__ACE_INLINE__)
+#include "tao/Var_Size_Argument_T.inl"
+#endif /* __ACE_INLINE__ */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template<typename S,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::In_Var_Size_Argument_T<S,Insert_Policy>::marshal (TAO_OutputCDR &cdr)
+{
+ return cdr << *this->x_;
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S,
+ class Insert_Policy>
+void
+TAO::In_Var_Size_Argument_T<S,Insert_Policy>::interceptor_value (
+ CORBA::Any *any
+ ) const
+{
+ Insert_Policy::any_insert (any, *this->x_);
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+// ===========================================================
+
+template<typename S,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::Inout_Var_Size_Argument_T<S,Insert_Policy>::marshal (
+ TAO_OutputCDR &cdr
+ )
+{
+ return cdr << *this->x_;
+}
+
+template<typename S,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::Inout_Var_Size_Argument_T<S,Insert_Policy>::demarshal (
+ TAO_InputCDR & cdr
+ )
+{
+ return cdr >> *this->x_;
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S,
+ class Insert_Policy>
+void
+TAO::Inout_Var_Size_Argument_T<S,Insert_Policy>::interceptor_value (
+ CORBA::Any *any
+ ) const
+{
+ Insert_Policy::any_insert (any, *this->x_);
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+// ==============================================================
+
+template<typename S,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::Out_Var_Size_Argument_T<S,Insert_Policy>::demarshal (
+ TAO_InputCDR & cdr
+ )
+{
+#if defined (ACE_HAS_NEW_NOTHROW)
+ this->x_ = new (ACE_nothrow) S;
+#else
+ this->x_ = new S;
+#endif /* ACE_HAS_NEW_NOTHROW */
+ return cdr >> *this->x_;
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S,
+ class Insert_Policy>
+void
+TAO::Out_Var_Size_Argument_T<S,Insert_Policy>::interceptor_value (
+ CORBA::Any *any
+ ) const
+{
+ Insert_Policy::any_insert (any, *this->x_);
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+// ============================================================
+
+template<typename S,
+ class Insert_Policy>
+CORBA::Boolean
+TAO::Ret_Var_Size_Argument_T<S,Insert_Policy>::demarshal (
+ TAO_InputCDR & cdr
+ )
+{
+ S * tmp = 0;
+ ACE_NEW_RETURN (tmp,
+ S (),
+ 0);
+ this->x_ = tmp;
+ return cdr >> this->x_.inout ();
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+
+template<typename S,
+ class Insert_Policy>
+void
+TAO::Ret_Var_Size_Argument_T<S,Insert_Policy>::interceptor_value (
+ CORBA::Any *any
+ ) const
+{
+ Insert_Policy::any_insert (any, this->x_.in ());
+}
+
+#endif /* TAO_HAS_INTERCEPTORS */
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_VAR_SIZE_ARGUMENT_T_CPP */
diff --git a/TAO/tao/Var_Size_Argument_T.h b/TAO/tao/Var_Size_Argument_T.h
new file mode 100644
index 00000000000..86493326ad9
--- /dev/null
+++ b/TAO/tao/Var_Size_Argument_T.h
@@ -0,0 +1,163 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Var_Size_Argument_T.h
+ *
+ * $Id$
+ *
+ * @authors Jeff Parsons and Carlos O'Ryan
+ */
+//=============================================================================
+
+#ifndef TAO_VAR_SIZE_ARGUMENT_T_H
+#define TAO_VAR_SIZE_ARGUMENT_T_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Argument.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ /**
+ * @class In_Var_Size_Argument_T
+ *
+ * @brief Template class for IN stub argument of fixed size IDL types.
+ *
+ */
+ template<typename S,
+ class Insert_Policy>
+ class In_Var_Size_Argument_T : public InArgument
+ {
+ public:
+ In_Var_Size_Argument_T (S const & x);
+
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ S const & arg (void) const;
+
+ private:
+ const S * x_;
+ };
+
+ /**
+ * @class Inout_Var_Size_Argument_T
+ *
+ * @brief Template class for INOUT stub argument of fixed size IDL types.
+ *
+ */
+ template<typename S,
+ class Insert_Policy>
+ class Inout_Var_Size_Argument_T : public InoutArgument
+ {
+ public:
+ Inout_Var_Size_Argument_T (S & x);
+
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
+ virtual CORBA::Boolean demarshal (TAO_InputCDR &);
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ S & arg (void);
+
+ private:
+ S * x_;
+ };
+
+ /**
+ * @class Out_Var_Size_Argument_T
+ *
+ * @brief Template class for OUT stub argument of fixed size IDL types.
+ *
+ */
+ template<typename S,
+ class Insert_Policy>
+ class Out_Var_Size_Argument_T : public OutArgument
+ {
+ public:
+ Out_Var_Size_Argument_T (typename S::_out_type x);
+
+ virtual CORBA::Boolean demarshal (TAO_InputCDR &);
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ S *& arg (void);
+
+ private:
+ S *& x_;
+ };
+
+ /**
+ * @class Ret_Var_Size_Argument_T
+ *
+ * @brief Template class for return stub value of fixed size IDL types.
+ *
+ */
+ template<typename S,
+ class Insert_Policy>
+ class Ret_Var_Size_Argument_T : public RetArgument
+ {
+ public:
+ Ret_Var_Size_Argument_T (void);
+
+ virtual CORBA::Boolean demarshal (TAO_InputCDR &);
+#if TAO_HAS_INTERCEPTORS == 1
+ virtual void interceptor_value (CORBA::Any *any) const;
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+ S *& arg (void);
+
+ S * excp (void);
+ S * retn (void);
+
+ protected:
+ typename S::_var_type x_;
+ };
+
+ /**
+ * @struct Var_Size_Arg_Traits_T
+ *
+ * @brief Template class for stub argument traits of
+ * variable size IDL types.
+ *
+ */
+ template<typename T,
+ class Insert_Policy>
+ struct Var_Size_Arg_Traits_T
+ {
+ typedef T * ret_type;
+ typedef T const & in_type;
+ typedef T & inout_type;
+ typedef typename T::_out_type out_type;
+
+ typedef In_Var_Size_Argument_T<T, Insert_Policy> in_arg_val;
+ typedef Inout_Var_Size_Argument_T<T, Insert_Policy> inout_arg_val;
+ typedef Out_Var_Size_Argument_T<T, Insert_Policy> out_arg_val;
+ typedef Ret_Var_Size_Argument_T<T, Insert_Policy> ret_val;
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+#include "tao/Var_Size_Argument_T.inl"
+#endif /* __ACE_INLINE__ */
+
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+#include "tao/Var_Size_Argument_T.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
+#pragma implementation ("Var_Size_Argument_T.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_VAR_SIZE_ARGUMENT_T_H */
diff --git a/TAO/tao/Var_Size_Argument_T.inl b/TAO/tao/Var_Size_Argument_T.inl
new file mode 100644
index 00000000000..331564d2eaf
--- /dev/null
+++ b/TAO/tao/Var_Size_Argument_T.inl
@@ -0,0 +1,99 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+template<typename S,
+ class Insert_Policy>
+ACE_INLINE
+TAO::In_Var_Size_Argument_T<S,Insert_Policy>::In_Var_Size_Argument_T (S const & x)
+ : x_ (&x)
+{
+}
+
+template<typename S,
+ class Insert_Policy>
+ACE_INLINE
+const S &
+TAO::In_Var_Size_Argument_T<S,Insert_Policy>::arg (void) const
+{
+ return *this->x_;
+}
+
+// ==========================================================================
+
+template<typename S,
+ class Insert_Policy>
+ACE_INLINE
+TAO::Inout_Var_Size_Argument_T<S,Insert_Policy>::Inout_Var_Size_Argument_T (S & x)
+ : x_ (&x)
+{
+}
+
+template<typename S,
+ class Insert_Policy>
+ACE_INLINE
+S &
+TAO::Inout_Var_Size_Argument_T<S,Insert_Policy>::arg (void)
+{
+ return *this->x_;
+}
+
+// ==========================================================================
+
+template<typename S,
+ class Insert_Policy>
+ACE_INLINE
+TAO::Out_Var_Size_Argument_T<S,Insert_Policy>::Out_Var_Size_Argument_T (
+ typename S::_out_type x
+ )
+ : x_ (x.ptr ())
+{}
+
+template<typename S,
+ class Insert_Policy>
+ACE_INLINE
+S *&
+TAO::Out_Var_Size_Argument_T<S,Insert_Policy>::arg (void)
+{
+ return this->x_;
+}
+
+// ==========================================================================
+
+template<typename S,
+ class Insert_Policy>
+ACE_INLINE
+TAO::Ret_Var_Size_Argument_T<S,Insert_Policy>::Ret_Var_Size_Argument_T (void)
+{
+}
+
+template<typename S,
+ class Insert_Policy>
+ACE_INLINE
+S *&
+TAO::Ret_Var_Size_Argument_T<S,Insert_Policy>::arg (void)
+{
+ return this->x_.out ();
+}
+
+template<typename S,
+ class Insert_Policy>
+ACE_INLINE
+S *
+TAO::Ret_Var_Size_Argument_T<S,Insert_Policy>::excp (void)
+{
+ return this->x_.ptr ();
+}
+
+template<typename S,
+ class Insert_Policy>
+ACE_INLINE
+S *
+TAO::Ret_Var_Size_Argument_T<S,Insert_Policy>::retn (void)
+{
+ return this->x_._retn ();
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Version.h b/TAO/tao/Version.h
new file mode 100644
index 00000000000..0a144b9102a
--- /dev/null
+++ b/TAO/tao/Version.h
@@ -0,0 +1,9 @@
+// -*- C++ -*-
+// $Id$
+
+// This is file was automatically generated by $ACE_ROOT/bin/make_release.
+
+#define TAO_MAJOR_VERSION 1
+#define TAO_MINOR_VERSION 5
+#define TAO_BETA_VERSION 2
+#define TAO_VERSION "1.5.2"
diff --git a/TAO/tao/Versioned_Namespace.h b/TAO/tao/Versioned_Namespace.h
new file mode 100644
index 00000000000..4e23f8c4421
--- /dev/null
+++ b/TAO/tao/Versioned_Namespace.h
@@ -0,0 +1,58 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Versioned_Namespace.h
+ *
+ * $Id$
+ *
+ * Versioned namespace support.
+ *
+ * Useful for preventing conflicts when using a third party library.
+ *
+ * @author Ossama Othman <ossama@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_VERSIONED_NAMESPACE_H
+#define TAO_VERSIONED_NAMESPACE_H
+
+#if !defined (TAO_ORBCONF_H) && !defined (ACE_CONFIG_MACROS_H)
+# error This header is only meant to be included after "tao/orbconf.h".
+#endif /* !TAO_ORBCONF_H */
+
+
+#if !defined (TAO_HAS_VERSIONED_NAMESPACE) \
+ && defined (ACE_HAS_VERSIONED_NAMESPACE) \
+ && ACE_HAS_VERSIONED_NAMESPACE == 1
+# define TAO_HAS_VERSIONED_NAMESPACE 1
+#endif /* !TAO_HAS_VERSIONED_NAMESPACE
+ && ACE_HAS_VERSIONED_NAMESPACE == 1*/
+
+#if defined (TAO_HAS_VERSIONED_NAMESPACE) && TAO_HAS_VERSIONED_NAMESPACE == 1
+
+# ifndef TAO_VERSIONED_NAMESPACE_NAME
+# include "tao/Version.h"
+
+// Preprocessor symbols will not be expanded if they are
+// concatenated. Force the preprocessor to expand them during the
+// argument prescan by calling a macro that itself calls another that
+// performs the actual concatenation.
+# define TAO_MAKE_VERSIONED_NAMESPACE_NAME_IMPL(MAJOR,MINOR,BETA) TAO_ ## MAJOR ## _ ## MINOR ## _ ## BETA
+# define TAO_MAKE_VERSIONED_NAMESPACE_NAME(MAJOR,MINOR,BETA) TAO_MAKE_VERSIONED_NAMESPACE_NAME_IMPL(MAJOR,MINOR,BETA)
+# define TAO_VERSIONED_NAMESPACE_NAME TAO_MAKE_VERSIONED_NAMESPACE_NAME(TAO_MAJOR_VERSION,TAO_MINOR_VERSION,TAO_BETA_VERSION)
+# endif /* !TAO_VERSIONED_NAMESPACE_NAME */
+
+# define TAO_BEGIN_VERSIONED_NAMESPACE_DECL namespace TAO_VERSIONED_NAMESPACE_NAME {
+# define TAO_END_VERSIONED_NAMESPACE_DECL } \
+ using namespace TAO_VERSIONED_NAMESPACE_NAME;
+
+#else
+
+# define TAO_VERSIONED_NAMESPACE_NAME
+# define TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+# define TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* TAO_HAS_VERSIONED_NAMESPACE */
+
+#endif /* !TAO_VERSIONED_NAMESPACE_H */
diff --git a/TAO/tao/WCharSeq.pidl b/TAO/tao/WCharSeq.pidl
new file mode 100644
index 00000000000..d10333981c1
--- /dev/null
+++ b/TAO/tao/WCharSeq.pidl
@@ -0,0 +1,31 @@
+// -*- IDL -*-
+//
+// $Id$
+
+/**
+ * This file was used to generate the code in WCharSeqC.*
+ * The command used to generate code is:
+ *
+ * tao_idl
+ * -oA AnyTypeCode
+ * -Ge 1 -GA -SS -Sci
+ * -Wb,pre_include=ace/pre.h
+ * -Wb,post_include=ace/post.h
+ * -Wb,export_macro=TAO_Export
+ * -Wb,export_include=tao/TAO_Export.h
+ * -Wb,anyop_export_macro=TAO_AnyTypeCode_Export
+ * -Wb,anyop_export_include=tao/AnyTypeCode/TAO_AnyTypeCode_Export.h
+ * WCharSeq.pidl
+ */
+
+#ifndef TAO_CORBA_WCHAR_SEQ_IDL
+#define TAO_CORBA_WCHAR_SEQ_IDL
+
+#pragma prefix "omg.org"
+
+module CORBA
+{
+ typedef sequence<wchar> WCharSeq;
+};
+
+#endif /* TAO_CORBA_WCHAR_SEQ_IDL */
diff --git a/TAO/tao/WStringSeq.pidl b/TAO/tao/WStringSeq.pidl
new file mode 100644
index 00000000000..392d7e9854e
--- /dev/null
+++ b/TAO/tao/WStringSeq.pidl
@@ -0,0 +1,31 @@
+// -*- IDL -*-
+//
+// $Id$
+
+/**
+ * This file was used to generate the code in WStringSeqC.*
+ * The command used to generate code is:
+ *
+ * tao_idl
+ * -oA AnyTypeCode
+ * -Ge 1 -GA -SS -Sci
+ * -Wb,pre_include=ace/pre.h
+ * -Wb,post_include=ace/post.h
+ * -Wb,export_macro=TAO_Export
+ * -Wb,export_include=tao/TAO_Export.h
+ * -Wb,anyop_export_macro=TAO_AnyTypeCode_Export
+ * -Wb,anyop_export_include=tao/AnyTypeCode/TAO_AnyTypeCode_Export.h
+ * WStringSeq.pidl
+ */
+
+#ifndef TAO_CORBA_WSTRING_SEQ_IDL
+#define TAO_CORBA_WSTRING_SEQ_IDL
+
+#pragma prefix "omg.org"
+
+module CORBA
+{
+ typedef sequence<wstring> WStringSeq;
+};
+
+#endif /* TAO_CORBA_WSTRING_SEQ_IDL */
diff --git a/TAO/tao/Wait_On_LF_No_Upcall.cpp b/TAO/tao/Wait_On_LF_No_Upcall.cpp
new file mode 100644
index 00000000000..1a039a0b089
--- /dev/null
+++ b/TAO/tao/Wait_On_LF_No_Upcall.cpp
@@ -0,0 +1,109 @@
+// $Id$
+
+#include "tao/Wait_On_LF_No_Upcall.h"
+
+#include "tao/Transport.h"
+#include "tao/ORB_Core.h"
+#include "tao/ORB_Core_TSS_Resources.h"
+#include "tao/debug.h"
+
+ACE_RCSID(tao,
+ Wait_On_LF_No_Upcall,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Transport;
+namespace TAO
+{
+ /**
+ * @class Nested_Upcall_Guard
+ *
+ * @brief: Magic class that sets the status of the thread in the
+ * TSS.
+ *
+ */
+ class Nested_Upcall_Guard
+ {
+ public:
+ // Maybe we should instead just take in a ptr to
+ // TAO_ORB_Core_TSS_Resources? Or at least ORB_Core*?
+ Nested_Upcall_Guard (TAO_Transport* t)
+ : t_ (t)
+ {
+ TAO_ORB_Core_TSS_Resources *tss =
+ t_->orb_core()->get_tss_resources ();
+
+ tss->upcalls_temporarily_suspended_on_this_thread_ = true;
+
+ if (TAO_debug_level > 6)
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - Wait_On_LF_No_Upcall::wait "
+ "disabling upcalls on thread %t\n"));
+ }
+
+ ~Nested_Upcall_Guard (void)
+ {
+ TAO_ORB_Core_TSS_Resources *tss =
+ t_->orb_core()->get_tss_resources ();
+
+ tss->upcalls_temporarily_suspended_on_this_thread_ =
+ false;
+
+ if (TAO_debug_level > 6)
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - Wait_On_LF_No_Upcall::wait "
+ "re-enabling upcalls on thread %t\n"));
+ }
+
+ private:
+
+ Nested_Upcall_Guard (void) {}
+
+ /// Disallow copying and assignment.
+ Nested_Upcall_Guard (const Nested_Upcall_Guard&);
+ Nested_Upcall_Guard & operator= (const Nested_Upcall_Guard&);
+
+ private:
+
+ /// Pointer to the transport that we plan to use.
+ TAO_Transport* t_;
+ };
+
+
+ //=================================================================
+
+ Wait_On_LF_No_Upcall::Wait_On_LF_No_Upcall (TAO_Transport *t)
+ : base (t)
+ {
+ }
+
+ Wait_On_LF_No_Upcall::~Wait_On_LF_No_Upcall (void)
+ {
+ }
+
+ int
+ Wait_On_LF_No_Upcall::wait (ACE_Time_Value *max_wait_time,
+ TAO_Synch_Reply_Dispatcher &rd)
+ {
+ Nested_Upcall_Guard upcall_guard (this->transport_);
+
+ return base::wait (max_wait_time, rd);
+ }
+
+ bool
+ Wait_On_LF_No_Upcall::can_process_upcalls (void) const
+ {
+ TAO_ORB_Core_TSS_Resources *tss =
+ this->transport_->orb_core()->get_tss_resources ();
+
+ if ((this->transport_->opened_as () == TAO::TAO_CLIENT_ROLE) &&
+ (this->transport_->bidirectional_flag () == 0) &&
+ (tss->upcalls_temporarily_suspended_on_this_thread_ == true))
+ return false;
+
+ return true;
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Wait_On_LF_No_Upcall.h b/TAO/tao/Wait_On_LF_No_Upcall.h
new file mode 100644
index 00000000000..8c839eba3bc
--- /dev/null
+++ b/TAO/tao/Wait_On_LF_No_Upcall.h
@@ -0,0 +1,64 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Wait_On_LF_No_Upcall.h
+ *
+ * $Id$
+ *
+ * @author Chris Cleeland <cleeland@ociweb.com>
+ */
+//=============================================================================
+
+
+#ifndef TAO_WAIT_ON_LF_NO_UPCALL_H
+#define TAO_WAIT_ON_LF_NO_UPCALL_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Wait_On_Leader_Follower.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ /**
+ * @class TAO_Wait_On_LF_No_Upcall
+ *
+ * @brief Wait according to the Leader-Follower model (like
+ * TAO_Wait_On_Leader_Follower), but do not allow nested upcalls.
+ *
+ * This implementation sets a thread-specific flag on entering wait()
+ * that indicates that the thread is unavailable to service upcalls.
+ * Connection handler that are acting in a server role cooperate by
+ * checking this flag in their handle_input, and returning if they're
+ * in a thread that is currently suspending upcalls. The flag gets
+ * reset once the reply is received.
+ */
+
+ class Wait_On_LF_No_Upcall : public TAO_Wait_On_Leader_Follower
+ {
+ public:
+
+ typedef TAO_Wait_On_Leader_Follower base;
+
+ Wait_On_LF_No_Upcall (TAO_Transport *t);
+
+ virtual ~Wait_On_LF_No_Upcall (void);
+
+ virtual int wait (ACE_Time_Value *max_wait_time,
+ TAO_Synch_Reply_Dispatcher &rd);
+
+ virtual bool can_process_upcalls (void) const;
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_WAIT_ON_LF_NO_UPCALL_H */
diff --git a/TAO/tao/Wait_On_Leader_Follower.cpp b/TAO/tao/Wait_On_Leader_Follower.cpp
new file mode 100644
index 00000000000..90b9d41df88
--- /dev/null
+++ b/TAO/tao/Wait_On_Leader_Follower.cpp
@@ -0,0 +1,74 @@
+// $Id$
+
+#include "tao/Wait_On_Leader_Follower.h"
+#include "tao/LF_Follower.h"
+#include "tao/Leader_Follower.h"
+#include "tao/Transport.h"
+#include "tao/Synch_Reply_Dispatcher.h"
+#include "tao/ORB_Core.h"
+
+ACE_RCSID (tao,
+ Wait_On_Leader_Follower,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Wait_On_Leader_Follower::TAO_Wait_On_Leader_Follower (TAO_Transport *transport)
+ : TAO_Wait_Strategy (transport)
+{
+}
+
+TAO_Wait_On_Leader_Follower::~TAO_Wait_On_Leader_Follower (void)
+{
+}
+
+int
+TAO_Wait_On_Leader_Follower::register_handler (void)
+{
+ if (!this->is_registered_)
+ {
+ return this->transport_->register_handler ();
+ }
+
+ return 1;
+}
+
+bool
+TAO_Wait_On_Leader_Follower::non_blocking (void) const
+{
+ return true;
+}
+
+int
+TAO_Wait_On_Leader_Follower::sending_request (TAO_ORB_Core *orb_core,
+ int two_way)
+{
+ // Register the handler.
+ if (!this->is_registered_)
+ {
+ this->transport_->register_handler ();
+ }
+
+ // Send the request.
+ return this->TAO_Wait_Strategy::sending_request (orb_core,
+ two_way);
+}
+
+int
+TAO_Wait_On_Leader_Follower::wait (ACE_Time_Value *max_wait_time,
+ TAO_Synch_Reply_Dispatcher &rd)
+{
+ TAO_Leader_Follower& leader_follower =
+ this->transport_->orb_core ()->leader_follower ();
+ return leader_follower.wait_for_event (&rd,
+ this->transport_,
+ max_wait_time);
+}
+
+bool
+TAO_Wait_On_Leader_Follower::can_process_upcalls (void) const
+{
+ return true;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Wait_On_Leader_Follower.h b/TAO/tao/Wait_On_Leader_Follower.h
new file mode 100644
index 00000000000..f775c66d9c0
--- /dev/null
+++ b/TAO/tao/Wait_On_Leader_Follower.h
@@ -0,0 +1,64 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Wait_On_Leader_Follower.h
+ *
+ * $Id$
+ *
+ * @author Alexander Babu Arulanthu <alex@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_WAIT_ON_LEADER_FOLLOWER_H
+#define TAO_WAIT_ON_LEADER_FOLLOWER_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Wait_Strategy.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_Wait_On_Leader_Follower
+ *
+ * @brief Wait according to the Leader-Follower model. Leader does the
+ * event loop of the Reactor and the Followers wait on the
+ * condition variable.
+ *
+ * This implementation is to work with the Muxed Transport
+ * Mechanism. Here the state variables such as <Condition
+ * Variable> etc cannot be kept in the Wait Strategy, since the
+ * Wait Strategy is per Transport object and here the Transport
+ * is Muxed and hence there are multiple threads running in the
+ * same Transport context.
+ */
+class TAO_Wait_On_Leader_Follower : public TAO_Wait_Strategy
+{
+
+public:
+ /// Constructor.
+ TAO_Wait_On_Leader_Follower (TAO_Transport *transport);
+
+ /// Destructor.
+ virtual ~TAO_Wait_On_Leader_Follower (void);
+
+ // = Documented in TAO_Wait_Strategy.
+ virtual int sending_request (TAO_ORB_Core *orb_core,
+ int two_way);
+ virtual int wait (ACE_Time_Value *max_wait_time,
+ TAO_Synch_Reply_Dispatcher &rd);
+ virtual int register_handler (void);
+ virtual bool non_blocking (void) const;
+ virtual bool can_process_upcalls (void) const;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_WAIT_ON_LEADER_FOLLOWER_H */
diff --git a/TAO/tao/Wait_On_Reactor.cpp b/TAO/tao/Wait_On_Reactor.cpp
new file mode 100644
index 00000000000..23c5d59df66
--- /dev/null
+++ b/TAO/tao/Wait_On_Reactor.cpp
@@ -0,0 +1,121 @@
+// $Id$
+
+#include "tao/Wait_On_Reactor.h"
+#include "tao/ORB_Core.h"
+#include "tao/Transport.h"
+#include "tao/Synch_Reply_Dispatcher.h"
+
+#include "ace/Reactor.h"
+#include "ace/Countdown_Time.h"
+
+ACE_RCSID (tao,
+ Wait_On_Reactor,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Wait_On_Reactor::TAO_Wait_On_Reactor (TAO_Transport *transport)
+ : TAO_Wait_Strategy (transport)
+{
+}
+
+TAO_Wait_On_Reactor::~TAO_Wait_On_Reactor (void)
+{
+}
+
+int
+TAO_Wait_On_Reactor::wait (ACE_Time_Value *max_wait_time,
+ TAO_Synch_Reply_Dispatcher &rd)
+{
+ // Start the count down timer to account for the time spent in this
+ // method.
+ ACE_Countdown_Time countdown (max_wait_time);
+
+ // Reactor does not change inside the loop.
+ ACE_Reactor* const reactor =
+ this->transport_->orb_core ()->reactor ();
+
+ // Do the event loop, till we fully receive a reply.
+ int result = 0;
+
+ while (1)
+ {
+ // Run the event loop.
+ result = reactor->handle_events (max_wait_time);
+
+ // If we got our reply, no need to run the event loop any
+ // further.
+ if (!rd.keep_waiting ())
+ {
+ break;
+ }
+
+ // Did we timeout? If so, stop running the loop.
+ if (result == 0
+ && max_wait_time != 0
+ && *max_wait_time == ACE_Time_Value::zero)
+ {
+ break;
+ }
+
+ // Other errors? If so, stop running the loop.
+ if (result == -1)
+ {
+ break;
+ }
+
+ // Otherwise, keep going...
+ }
+
+ if (result == -1 || rd.error_detected ())
+ {
+ return -1;
+ }
+
+ // Return an error if there was a problem receiving the reply.
+ if (max_wait_time != 0)
+ {
+ if (rd.successful () && *max_wait_time == ACE_Time_Value::zero)
+ {
+ result = -1;
+ errno = ETIME;
+ }
+ }
+ else
+ {
+ result = 0;
+
+ if (rd.error_detected ())
+ {
+ result = -1;
+ }
+ }
+
+ return result;
+}
+
+// Register the handler with the Reactor.
+int
+TAO_Wait_On_Reactor::register_handler (void)
+{
+ if (!this->is_registered_)
+ {
+ return this->transport_->register_handler ();
+ }
+
+ return 1;
+}
+
+bool
+TAO_Wait_On_Reactor::non_blocking (void) const
+{
+ return true;
+}
+
+bool
+TAO_Wait_On_Reactor::can_process_upcalls (void) const
+{
+ return true;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Wait_On_Reactor.h b/TAO/tao/Wait_On_Reactor.h
new file mode 100644
index 00000000000..212590b4d56
--- /dev/null
+++ b/TAO/tao/Wait_On_Reactor.h
@@ -0,0 +1,56 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Wait_On_Reactor.h
+ *
+ * $Id$
+ *
+ * @author Alexander Babu Arulanthu <alex@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_WAIT_ON_REACTOR_H
+#define TAO_WAIT_ON_REACTOR_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Wait_Strategy.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_Wait_On_Reactor
+ *
+ * @brief Wait on the Reactor. Happens in s Single Threaded client
+ * environment.
+ *
+ */
+class TAO_Wait_On_Reactor : public TAO_Wait_Strategy
+{
+
+public:
+ /// Constructor.
+ TAO_Wait_On_Reactor (TAO_Transport *transport);
+
+ /// Destructor.
+ virtual ~TAO_Wait_On_Reactor (void);
+
+ // = Documented in TAO_Wait_Strategy.
+
+ virtual int wait (ACE_Time_Value *max_wait_time,
+ TAO_Synch_Reply_Dispatcher &rd);
+ virtual int register_handler (void);
+ virtual bool non_blocking (void) const;
+ virtual bool can_process_upcalls (void) const;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_WAIT_ON_REACTOR_H */
diff --git a/TAO/tao/Wait_On_Read.cpp b/TAO/tao/Wait_On_Read.cpp
new file mode 100644
index 00000000000..a3c641d9579
--- /dev/null
+++ b/TAO/tao/Wait_On_Read.cpp
@@ -0,0 +1,142 @@
+// $Id$
+
+#include "tao/Wait_On_Read.h"
+#include "tao/Transport.h"
+#include "tao/Resume_Handle.h"
+#include "tao/Synch_Reply_Dispatcher.h"
+#include "tao/Client_Strategy_Factory.h"
+#include "tao/ORB_Core.h"
+#include "ace/Reactor.h"
+#include "ace/Countdown_Time.h"
+
+ACE_RCSID (tao,
+ Wait_On_Read,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Constructor.
+TAO_Wait_On_Read::TAO_Wait_On_Read (TAO_Transport *transport)
+ : TAO_Wait_Strategy (transport)
+{
+}
+
+// Destructor.
+TAO_Wait_On_Read::~TAO_Wait_On_Read (void)
+{
+}
+
+/*
+ * Hook to specialize the wait strategy when the concrete strategy is
+ * a simple "rw" strategy. Add all public/protected/private methods
+ * within the *COPY* hooks.
+ */
+
+//@@ WAIT_STRATEGY_SPL_COPY_HOOK_START
+
+// Wait on the read operation.
+int
+TAO_Wait_On_Read::wait (ACE_Time_Value * max_wait_time,
+ TAO_Synch_Reply_Dispatcher &rd)
+{
+ // Start the count down timer to account for the time spent in this
+ // method.
+ ACE_Countdown_Time countdown (max_wait_time);
+
+ rd.state_changed (TAO_LF_Event::LFS_ACTIVE,
+ this->transport_->orb_core ()->leader_follower ());
+
+ // Do the same sort of looping that is done in other wait
+ // strategies.
+ int retval = 0;
+ TAO_Resume_Handle rh;
+ while (1)
+ {
+ retval =
+ this->transport_->handle_input (rh,
+ max_wait_time,
+ 1);
+
+ // If we got our reply, no need to run the loop any
+ // further.
+ if (!rd.keep_waiting ())
+ break;
+
+ // @@ We are not checking for timeouts here...
+
+ // If we got an error just break
+ if (retval == -1)
+ break;
+ }
+
+ if (rd.error_detected () == -1 || retval == -1)
+ {
+ this->transport_->close_connection ();
+ }
+
+ if (rd.successful ())
+ {
+ TAO_ORB_Core *oc =
+ this->transport_->orb_core ();
+
+ if (!oc->client_factory ()->use_cleanup_options ())
+ return 0;
+
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - TAO_Wait_On_Read[%d]::wait (), ")
+ ACE_TEXT ("registering handle for cleanup \n"),
+ this->transport_->id ()));
+
+ ACE_Event_Handler * const eh =
+ this->transport_->event_handler_i ();
+
+ ACE_Reactor * const r =
+ this->transport_->orb_core ()->reactor ();
+
+ if (r->register_handler (eh,
+ ACE_Event_Handler::READ_MASK) == -1)
+ {
+ if (TAO_debug_level > 0)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) - TAO_Wait_On_Read[%d]::wait (), ")
+ ACE_TEXT ("registration with reactor returned an error \n"),
+ this->transport_->id ()));
+ }
+
+ this->is_registered_ = true;
+
+ return 0;
+ }
+
+ if (rd.error_detected ())
+ return -1;
+
+ return 1;
+}
+
+// No-op.
+int
+TAO_Wait_On_Read::register_handler (void)
+{
+ return 0;
+}
+
+bool
+TAO_Wait_On_Read::non_blocking (void) const
+{
+ return false;
+}
+
+bool
+TAO_Wait_On_Read::can_process_upcalls (void) const
+{
+ return true;
+}
+
+//@@ WAIT_STRATEGY_SPL_COPY_HOOK_END
+/*
+ * End copy hook.
+ */
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Wait_On_Read.h b/TAO/tao/Wait_On_Read.h
new file mode 100644
index 00000000000..c691a668200
--- /dev/null
+++ b/TAO/tao/Wait_On_Read.h
@@ -0,0 +1,55 @@
+// This may look like C, but it's really -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Wait_On_Read.h
+ *
+ * $Id$
+ *
+ * @author Alexander Babu Arulanthu <alex@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_WAIT_ON_READ_H
+#define TAO_WAIT_ON_READ_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Wait_Strategy.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_Wait_On_Read
+ *
+ *
+ * Simply block on read() to wait for the reply.
+ */
+class TAO_Wait_On_Read : public TAO_Wait_Strategy
+{
+
+public:
+ /// Constructor.
+ TAO_Wait_On_Read (TAO_Transport *transport);
+
+ /// Destructor.
+ virtual ~TAO_Wait_On_Read (void);
+
+ // = Documented in TAO_Wait_Strategy.
+
+ virtual int wait (ACE_Time_Value *max_wait_time,
+ TAO_Synch_Reply_Dispatcher &rd);
+ virtual int register_handler (void);
+ virtual bool non_blocking (void) const;
+ virtual bool can_process_upcalls (void) const;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_WAIT_ON_READ_H */
diff --git a/TAO/tao/Wait_Strategy.cpp b/TAO/tao/Wait_Strategy.cpp
new file mode 100644
index 00000000000..73fda58a00f
--- /dev/null
+++ b/TAO/tao/Wait_Strategy.cpp
@@ -0,0 +1,41 @@
+// $Id$
+
+#include "tao/Wait_Strategy.h"
+
+ACE_RCSID (tao,
+ Wait_Strategy,
+ "$Id$")
+
+#if !defined (__ACE_INLINE__)
+# include "tao/Wait_Strategy.inl"
+#endif /* __ACE_INLINE__ */
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Constructor.
+TAO_Wait_Strategy::TAO_Wait_Strategy (TAO_Transport *transport)
+ : transport_ (transport),
+ is_registered_ (false)
+
+{
+}
+
+// Destructor.
+TAO_Wait_Strategy::~TAO_Wait_Strategy (void)
+{
+}
+
+int
+TAO_Wait_Strategy::sending_request (TAO_ORB_Core * /* orb_core */,
+ int /* two_way */)
+{
+ return 0;
+}
+
+/*
+ * Hook to specialize the Wait Strategy
+ */
+//@@ TAO_WAIT_STRATEGY_SPL_ADD_HOOK
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Wait_Strategy.h b/TAO/tao/Wait_Strategy.h
new file mode 100644
index 00000000000..d88c5e258bd
--- /dev/null
+++ b/TAO/tao/Wait_Strategy.h
@@ -0,0 +1,108 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Wait_Strategy.h
+ *
+ * $Id$
+ *
+ * @author Alexander Babu Arulanthu <alex@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_WAIT_STRATEGY_H
+#define TAO_WAIT_STRATEGY_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/TAO_Export.h"
+
+ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+class ACE_Time_Value;
+ACE_END_VERSIONED_NAMESPACE_DECL
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_ORB_Core;
+class TAO_Transport;
+class TAO_Synch_Reply_Dispatcher;
+
+/**
+ * @class TAO_Wait_Strategy
+ *
+ * @brief Strategy for waiting for the reply.
+ *
+ */
+class TAO_Export TAO_Wait_Strategy
+{
+
+public:
+ /// Constructor.
+ TAO_Wait_Strategy (TAO_Transport *transport);
+
+ /// Destructor.
+ virtual ~TAO_Wait_Strategy (void);
+
+ /**
+ * The user is going to send a request, prepare any internal
+ * variables because the reply may arrive *before* the user calls
+ * wait.
+ */
+ virtual int sending_request (TAO_ORB_Core *orb_core,
+ int two_way);
+
+ /// Base class virtual method. Wait till the @c reply_received flag is
+ /// true or the time expires.
+ virtual int wait (ACE_Time_Value *max_wait_time,
+ TAO_Synch_Reply_Dispatcher &rd) = 0;
+
+ /// Register the handler needs with the reactor provided that it makes
+ /// sense for the strategy.
+ virtual int register_handler (void) = 0;
+
+ /// Returns a value to indicate whether the transport needs to set
+ /// the socket on which it is waiting to non-blocking mode or not.
+ virtual bool non_blocking (void) const = 0;
+
+ /// Flag that indicates whether we can process requests while
+ /// waiting for the reply.
+ /**
+ * This flag is to check whether the thread can process upcalls
+ * while waiting for the reply. Some wait strategies, like
+ * Wait_On_LF_No_Upcall does not allow the client threads to process
+ * requests while waiting for the reply.
+ */
+ virtual bool can_process_upcalls (void) const = 0;
+
+ /// Get method for the flag
+ bool is_registered (void) const;
+
+ /// Set method for the flag
+ void is_registered (bool flag);
+
+protected:
+ /// Transport object.
+ TAO_Transport *transport_;
+
+ /// Flag to indicate whether the service handler that created the
+ /// above transport has been registered with the reactor or not. The
+ /// default is false.
+ bool is_registered_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+
+#if defined (__ACE_INLINE__)
+# include "tao/Wait_Strategy.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_WAIT_STRATEGY_H */
diff --git a/TAO/tao/Wait_Strategy.inl b/TAO/tao/Wait_Strategy.inl
new file mode 100644
index 00000000000..c39b083c95e
--- /dev/null
+++ b/TAO/tao/Wait_Strategy.inl
@@ -0,0 +1,17 @@
+//$Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE bool
+TAO_Wait_Strategy::is_registered (void) const
+{
+ return this->is_registered_;
+}
+
+ACE_INLINE void
+TAO_Wait_Strategy::is_registered (bool flag)
+{
+ this->is_registered_ = flag;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/WrongTransaction.pidl b/TAO/tao/WrongTransaction.pidl
new file mode 100644
index 00000000000..6fa5bf56a6d
--- /dev/null
+++ b/TAO/tao/WrongTransaction.pidl
@@ -0,0 +1,45 @@
+/**
+ * @file WrongTransaction.pidl
+ *
+ * $Id$
+ *
+ * @brief Pre-compiled IDL source for the CORBA::WrongTransaction
+ * exception.
+ *
+ * This file is used to generate WrongTransactionC.*, using the
+ * following command:
+ *
+ * tao_idl
+ * -o orig -Ge 1 -GA -Sci -SS
+ * -Wb,export_macro=TAO_Export
+ * -Wb,export_include=tao/TAO_Export.h
+ * -Wb,pre_include="ace/pre.h"
+ * -Wb,post_include="ace/post.h"
+ * WrongTransaction.pidl
+ *
+ * and then:
+ *
+ * cp orig/WrongTransactionC.{h,inl,cpp} .
+ * cp orig/WrongTransactionS.h .
+ *
+ */
+#ifndef TAO_CORBA_WRONGTRANSACTION_PIDL
+#define TAO_CORBA_WRONGTRANSACTION_PIDL
+
+#pragma prefix "omg.org"
+
+module CORBA
+{
+ /**
+ * @exception WrongTransaction
+ *
+ * @brief UserException for DII requests.
+ *
+ * This exception is thrown if a CORBA Request is implicitly
+ * associated with a transaction and is found to have an
+ * error in its parameters when checked at runtime (invocation).
+ */
+ exception WrongTransaction {};
+};
+
+#endif /* TAO_CORBA_WRONGTRANSACTION_PIDL */
diff --git a/TAO/tao/WrongTransactionC.cpp b/TAO/tao/WrongTransactionC.cpp
new file mode 100644
index 00000000000..8c7368c54cf
--- /dev/null
+++ b/TAO/tao/WrongTransactionC.cpp
@@ -0,0 +1,193 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:291
+
+
+#include "tao/WrongTransactionC.h"
+#include "tao/CDR.h"
+#include "tao/SystemException.h"
+#include "ace/OS_NS_string.h"
+#include "tao/AnyTypeCode_Adapter.h"
+#include "ace/Dynamic_Service.h"
+#include "ace/Log_Msg.h"
+
+#if defined (__BORLANDC__)
+#pragma option -w-rvl -w-rch -w-ccc -w-aus -w-sig
+#endif /* __BORLANDC__ */
+
+// TAO_IDL - Generated from
+// be\be_visitor_arg_traits.cpp:70
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Arg traits specializations.
+namespace TAO
+{
+}
+
+
+// TAO_IDL - Generated from
+// be\be_visitor_exception/exception_cs.cpp:63
+
+CORBA::WrongTransaction::WrongTransaction (void)
+ : CORBA::UserException (
+ "IDL:omg.org/CORBA/WrongTransaction:1.0",
+ "WrongTransaction"
+ )
+{
+}
+
+CORBA::WrongTransaction::~WrongTransaction (void)
+{
+}
+
+CORBA::WrongTransaction::WrongTransaction (const ::CORBA::WrongTransaction &_tao_excp)
+ : CORBA::UserException (
+ _tao_excp._rep_id (),
+ _tao_excp._name ()
+ )
+{
+}
+
+CORBA::WrongTransaction&
+CORBA::WrongTransaction::operator= (const ::CORBA::WrongTransaction &_tao_excp)
+{
+ this->::CORBA::UserException::operator= (_tao_excp);
+ return *this;
+}
+
+void CORBA::WrongTransaction::_tao_any_destructor (void *_tao_void_pointer)
+{
+ WrongTransaction *_tao_tmp_pointer =
+ static_cast<WrongTransaction *> (_tao_void_pointer);
+ delete _tao_tmp_pointer;
+}
+
+CORBA::WrongTransaction *
+CORBA::WrongTransaction::_downcast (CORBA::Exception *_tao_excp)
+{
+ return dynamic_cast<WrongTransaction *> (_tao_excp);
+}
+
+const CORBA::WrongTransaction *
+CORBA::WrongTransaction::_downcast (CORBA::Exception const *_tao_excp)
+{
+ return dynamic_cast<const WrongTransaction *> (_tao_excp);
+}
+
+CORBA::Exception *CORBA::WrongTransaction::_alloc (void)
+{
+ CORBA::Exception *retval = 0;
+ ACE_NEW_RETURN (retval, ::CORBA::WrongTransaction, 0);
+ return retval;
+}
+
+CORBA::Exception *
+CORBA::WrongTransaction::_tao_duplicate (void) const
+{
+ CORBA::Exception *result = 0;
+ ACE_NEW_RETURN (
+ result,
+ ::CORBA::WrongTransaction (*this),
+ 0
+ );
+ return result;
+}
+
+void CORBA::WrongTransaction::_raise (void) const
+{
+ TAO_RAISE (*this);
+}
+
+void CORBA::WrongTransaction::_tao_encode (
+ TAO_OutputCDR &cdr
+ ACE_ENV_ARG_DECL
+ ) const
+{
+ if (cdr << *this)
+ {
+ return;
+ }
+
+ ACE_THROW (CORBA::MARSHAL ());
+}
+
+void CORBA::WrongTransaction::_tao_decode (
+ TAO_InputCDR &cdr
+ ACE_ENV_ARG_DECL
+ )
+{
+ if (cdr >> *this)
+ {
+ return;
+ }
+
+ ACE_THROW (CORBA::MARSHAL ());
+}
+
+// TAO extension - the virtual _type method.
+CORBA::TypeCode_ptr CORBA::WrongTransaction::_tao_type (void) const
+{
+ TAO_AnyTypeCode_Adapter *adapter =
+ ACE_Dynamic_Service<TAO_AnyTypeCode_Adapter>::instance (
+ "AnyTypeCode_Adapter"
+ );
+ if (adapter != 0)
+ return adapter->_tao_type_WrongTransaction ();
+ else
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) %p\n"),
+ ACE_TEXT ("Unable to find the ")
+ ACE_TEXT ("AnyTypeCode Adapter instance")));
+ return 0;
+ }
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_exception/cdr_op_cs.cpp:60
+
+CORBA::Boolean operator<< (
+ TAO_OutputCDR &strm,
+ const CORBA::WrongTransaction &_tao_aggregate
+ )
+{
+ // Marshal the repository ID.
+ return (strm << _tao_aggregate._rep_id ());
+}
+
+CORBA::Boolean operator>> (
+ TAO_InputCDR &,
+ CORBA::WrongTransaction&
+ )
+{
+ return true;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/WrongTransactionC.h b/TAO/tao/WrongTransactionC.h
new file mode 100644
index 00000000000..e64c9dedb4d
--- /dev/null
+++ b/TAO/tao/WrongTransactionC.h
@@ -0,0 +1,150 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:153
+
+#ifndef _TAO_IDL_ORIG_WRONGTRANSACTIONC_H_
+#define _TAO_IDL_ORIG_WRONGTRANSACTIONC_H_
+
+#include /**/ "ace/pre.h"
+
+
+#include "ace/config-all.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/TAO_Export.h"
+#include "tao/ORB.h"
+#include "tao/Environment.h"
+
+#if defined (TAO_EXPORT_MACRO)
+#undef TAO_EXPORT_MACRO
+#endif
+#define TAO_EXPORT_MACRO TAO_Export
+
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+#if defined (__BORLANDC__)
+#pragma option push -w-rvl -w-rch -w-ccc -w-inl
+#endif /* __BORLANDC__ */
+
+// TAO_IDL - Generated from
+// be\be_visitor_module/module_ch.cpp:48
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace CORBA
+{
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_exception/exception_ch.cpp:53
+
+#if !defined (_CORBA_WRONGTRANSACTION_CH_)
+#define _CORBA_WRONGTRANSACTION_CH_
+
+ class TAO_Export WrongTransaction : public CORBA::UserException
+ {
+ public:
+
+ WrongTransaction (void);
+ WrongTransaction (const WrongTransaction &);
+ ~WrongTransaction (void);
+
+ WrongTransaction &operator= (const WrongTransaction &);
+
+ static void _tao_any_destructor (void *);
+
+ static WrongTransaction *_downcast (CORBA::Exception *);
+ static const WrongTransaction *_downcast (CORBA::Exception const *);
+
+ static CORBA::Exception *_alloc (void);
+
+ virtual CORBA::Exception *_tao_duplicate (void) const;
+
+ virtual void _raise (void) const;
+
+ virtual void _tao_encode (
+ TAO_OutputCDR &
+ ACE_ENV_ARG_DECL
+ ) const;
+
+ virtual void _tao_decode (
+ TAO_InputCDR &
+ ACE_ENV_ARG_DECL
+ );
+
+ // TAO_IDL - Generated from
+ // be\be_visitor_exception/exception_ch.cpp:129
+
+ virtual CORBA::TypeCode_ptr _tao_type (void) const;
+ };
+
+#endif /* end #if !defined */
+
+// TAO_IDL - Generated from
+// be\be_visitor_module/module_ch.cpp:66
+
+} // module CORBA
+
+// TAO_IDL - Generated from
+// be\be_visitor_traits.cpp:61
+
+// Traits specializations.
+namespace TAO
+{
+}
+
+// TAO_IDL - Generated from
+// be\be_visitor_exception/cdr_op_ch.cpp:52
+
+TAO_Export CORBA::Boolean operator<< (TAO_OutputCDR &, const CORBA::WrongTransaction &);
+TAO_Export CORBA::Boolean operator>> (TAO_InputCDR &, CORBA::WrongTransaction &);
+
+// TAO_IDL - Generated from
+// be\be_codegen.cpp:955
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#if defined (__BORLANDC__)
+#pragma option pop
+#endif /* __BORLANDC__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* ifndef */
+
+
diff --git a/TAO/tao/WrongTransactionS.h b/TAO/tao/WrongTransactionS.h
new file mode 100644
index 00000000000..17b1360599e
--- /dev/null
+++ b/TAO/tao/WrongTransactionS.h
@@ -0,0 +1,28 @@
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// Skeleton file generation suppressed with command line option -SS
diff --git a/TAO/tao/XtResource.mpc b/TAO/tao/XtResource.mpc
new file mode 100644
index 00000000000..158da848ec9
--- /dev/null
+++ b/TAO/tao/XtResource.mpc
@@ -0,0 +1,31 @@
+// -*- MPC -*- now wouldn't this be cool...
+// $Id$
+
+project(TAO_XtResource) : acelib, taolib, core, tao_output, taodefaults, ace_xtreactor, tao_versioning_idl_defaults {
+
+ sharedname = TAO_XtResource
+ dynamicflags += TAO_XTRESOURCE_BUILD_DLL
+
+ Source_Files {
+ XtResource
+ }
+
+ Header_Files {
+ XtResource
+ }
+
+ Inline_Files {
+ }
+
+ Template_Files {
+ }
+
+ Resource_Files {
+ }
+
+ PIDL_Files {
+ }
+
+ IDL_Files {
+ }
+}
diff --git a/TAO/tao/XtResource/TAO_XtResource_Export.h b/TAO/tao/XtResource/TAO_XtResource_Export.h
new file mode 100644
index 00000000000..5cc41d8da11
--- /dev/null
+++ b/TAO/tao/XtResource/TAO_XtResource_Export.h
@@ -0,0 +1,58 @@
+
+// -*- C++ -*-
+// $Id$
+// Definition for Win32 Export directives.
+// This file is generated automatically by generate_export_file.pl -s TAO_XtResource
+// ------------------------------
+#ifndef TAO_XTRESOURCE_EXPORT_H
+#define TAO_XTRESOURCE_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if defined (ACE_AS_STATIC_LIBS) && !defined (TAO_XTRESOURCE_HAS_DLL)
+# define TAO_XTRESOURCE_HAS_DLL 0
+#endif /* ACE_AS_STATIC_LIBS && TAO_XTRESOURCE_HAS_DLL */
+
+#if !defined (TAO_XTRESOURCE_HAS_DLL)
+# define TAO_XTRESOURCE_HAS_DLL 1
+#endif /* ! TAO_XTRESOURCE_HAS_DLL */
+
+#if defined (TAO_XTRESOURCE_HAS_DLL) && (TAO_XTRESOURCE_HAS_DLL == 1)
+# if defined (TAO_XTRESOURCE_BUILD_DLL)
+# define TAO_XtResource_Export ACE_Proper_Export_Flag
+# define TAO_XTRESOURCE_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# define TAO_XTRESOURCE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# else /* TAO_XTRESOURCE_BUILD_DLL */
+# define TAO_XtResource_Export ACE_Proper_Import_Flag
+# define TAO_XTRESOURCE_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# define TAO_XTRESOURCE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# endif /* TAO_XTRESOURCE_BUILD_DLL */
+#else /* TAO_XTRESOURCE_HAS_DLL == 1 */
+# define TAO_XtResource_Export
+# define TAO_XTRESOURCE_SINGLETON_DECLARATION(T)
+# define TAO_XTRESOURCE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+#endif /* TAO_XTRESOURCE_HAS_DLL == 1 */
+
+// Set TAO_XTRESOURCE_NTRACE = 0 to turn on library specific tracing even if
+// tracing is turned off for ACE.
+#if !defined (TAO_XTRESOURCE_NTRACE)
+# if (ACE_NTRACE == 1)
+# define TAO_XTRESOURCE_NTRACE 1
+# else /* (ACE_NTRACE == 1) */
+# define TAO_XTRESOURCE_NTRACE 0
+# endif /* (ACE_NTRACE == 1) */
+#endif /* !TAO_XTRESOURCE_NTRACE */
+
+#if (TAO_XTRESOURCE_NTRACE == 1)
+# define TAO_XTRESOURCE_TRACE(X)
+#else /* (TAO_XTRESOURCE_NTRACE == 1) */
+# if !defined (ACE_HAS_TRACE)
+# define ACE_HAS_TRACE
+# endif /* ACE_HAS_TRACE */
+# define TAO_XTRESOURCE_TRACE(X) ACE_TRACE_IMPL(X)
+# include "ace/Trace.h"
+#endif /* (TAO_XTRESOURCE_NTRACE == 1) */
+
+#endif /* TAO_XTRESOURCE_EXPORT_H */
+
+// End of auto generated file.
diff --git a/TAO/tao/XtResource/XtResource_Factory.cpp b/TAO/tao/XtResource/XtResource_Factory.cpp
new file mode 100644
index 00000000000..0bd2f417292
--- /dev/null
+++ b/TAO/tao/XtResource/XtResource_Factory.cpp
@@ -0,0 +1,45 @@
+//$Id$
+
+#include "tao/XtResource/XtResource_Factory.h"
+#include "tao/debug.h"
+#include "ace/XtReactor.h"
+
+ACE_RCSID( TAO_XtResource,
+ XtResource_Factory,
+ "$Id$");
+
+namespace TAO
+{
+
+ XtResource_Factory::XtResource_Factory (XtAppContext p_context):
+ reactor_impl_( 0 ),
+ context_( p_context )
+ {
+ }
+
+ ACE_Reactor_Impl *
+ XtResource_Factory::reactor_impl (void)
+ {
+ // synchronized by external locks
+ if (this->context_ == 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT("TAO (%P|%t) - XtAppContext is undefined.")
+ ACE_TEXT(" Cannot create ACE_XtReactor \n")));
+ return 0;
+ }
+
+ if (!this->reactor_impl_)
+ {
+ ACE_NEW_RETURN (this->reactor_impl_,
+ ACE_XtReactor (this->context_),
+ 0);
+
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - ACE_XtReactor created \n"));
+ }
+
+ return this->reactor_impl_;
+ }
+}
diff --git a/TAO/tao/XtResource/XtResource_Factory.h b/TAO/tao/XtResource/XtResource_Factory.h
new file mode 100644
index 00000000000..5099969e25c
--- /dev/null
+++ b/TAO/tao/XtResource/XtResource_Factory.h
@@ -0,0 +1,61 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file XtResource_Factory.h
+ *
+ * $Id$
+ *
+ * @author Balachandran Natarajan <bala@cs.wustl.edu>
+ * @author Marek Brudka <mbrudka@aster.pl>
+ */
+//=============================================================================
+#ifndef TAO_XTRESOURCE_FACTORY_H
+#define TAO_XTRESOURCE_FACTORY_H
+#include /**/ "ace/pre.h"
+#include /**/ <X11/Intrinsic.h>
+#include "tao/XtResource/TAO_XtResource_Export.h"
+#include "ace/XtReactor.h"
+#include "tao/GUIResource_Factory.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+namespace TAO
+{
+
+ /**
+ * @class XtResource_Factory
+ *
+ * @brief TAO_GUI_Resource_Factory for creating XtReactor.
+ *
+ * This factory is intended for creating XtReactor for ORB. This
+ * factory can be feed into ORB using
+ * TAO_ORB_Core::set_gui_resource_factory method which is usually
+ * done by TAO_XtResource_Loader.
+ */
+
+ class TAO_XtResource_Export XtResource_Factory : public GUIResource_Factory
+ {
+ public:
+ XtResource_Factory (XtAppContext context);
+
+ /// Create or obtain current reactor implementation
+ virtual ACE_Reactor_Impl *reactor_impl (void);
+
+ private:
+
+ /// Reactor created by this factory.
+ ACE_XtReactor *reactor_impl_;
+
+ /// Xt context for XtReactor
+ XtAppContext context_;
+
+ /// for internal locking
+ TAO_SYNCH_MUTEX lock_;
+ };
+}
+
+#include /**/ "ace/post.h"
+#endif /* TAO_XTRESOURCE_FACTORY_H */
diff --git a/TAO/tao/XtResource/XtResource_Loader.cpp b/TAO/tao/XtResource/XtResource_Loader.cpp
new file mode 100644
index 00000000000..fb24c916b04
--- /dev/null
+++ b/TAO/tao/XtResource/XtResource_Loader.cpp
@@ -0,0 +1,26 @@
+//$Id$
+#include "tao/XtResource/XtResource_Loader.h"
+#include "tao/ORB_Core.h"
+#include "tao/XtResource/XtResource_Factory.h"
+
+ACE_RCSID( TAO_XtResource,
+ XtResource_Loader,
+ "$Id$");
+
+namespace TAO
+{
+
+ XtResource_Loader::XtResource_Loader (XtAppContext context)
+ {
+ XtResource_Factory *tmp = 0;
+
+ ACE_NEW (tmp,
+ XtResource_Factory (context));
+
+ TAO_ORB_Core::set_gui_resource_factory( tmp );
+ }
+
+ XtResource_Loader::~XtResource_Loader ()
+ {
+ }
+}
diff --git a/TAO/tao/XtResource/XtResource_Loader.h b/TAO/tao/XtResource/XtResource_Loader.h
new file mode 100644
index 00000000000..37fe91406a2
--- /dev/null
+++ b/TAO/tao/XtResource/XtResource_Loader.h
@@ -0,0 +1,50 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file XtResource_Loader.h
+ *
+ * $Id$
+ *
+ * @author Marek Brudka <mbrudka@aster.pl>
+ * @author Balachandran Natarajan <bala@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_XTRESOURCE_LOADER_H
+#define TAO_XTRESOURCE_LOADER_H
+#include /**/ "ace/pre.h"
+#include /**/ <X11/Intrinsic.h>
+#include "tao/XtResource/TAO_XtResource_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+namespace TAO
+{
+ /**
+ * @class XtResource_Loader
+ *
+ * @brief Loads TAO resources related with Xt.
+ *
+ * This class changes the default reactor implementation into
+ * ACE_XtReactor one by calling TAO_ORB_Core::set_gui_resource_factory.
+ * User should create an instance of this class before ORB_init
+ * when the TAO server has has to be integrated within Xt event loop.
+ *
+ * Please notice, this class has to be created in the main Xt thread,
+ * because set_gui_resource_factory creates a variable in TSS. This way
+ * XtReactor is instantiated only in Xt event loop thread.
+ */
+ class TAO_XtResource_Export XtResource_Loader
+ {
+
+ public:
+ XtResource_Loader (XtAppContext context);
+
+ virtual ~XtResource_Loader ();
+ };
+}
+#include /**/ "ace/post.h"
+#endif /* TAO_XTRESOURCE_LOADER_H */
diff --git a/TAO/tao/corba.h b/TAO/tao/corba.h
new file mode 100644
index 00000000000..1fbb3357d66
--- /dev/null
+++ b/TAO/tao/corba.h
@@ -0,0 +1,80 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file corba.h
+ *
+ * $Id$
+ *
+ * Master header file for all TAO stubs.
+ *
+ * @note This header should not be included in any core TAO library
+ * files. Include the necessary individual headers instead.
+ *
+ * @author Copyright 1994-1995 by Sun Microsystems Inc.
+ * @author Chris Cleeland
+ * @author Douglas C. Schmidt
+ */
+//=============================================================================
+
+
+#ifndef TAO_MASTER_CORBA_H
+#define TAO_MASTER_CORBA_H
+
+#include /**/ "ace/pre.h"
+
+// ACE specific includes
+#include "ace/config-all.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/corbafwd.h"
+
+#include "tao/Environment.h"
+#include "tao/SystemException.h"
+#include "tao/UserException.h"
+
+#include "tao/Object.h"
+#include "tao/LocalObject.h"
+#include "tao/Principal.h"
+#include "tao/ORB.h"
+
+#include "tao/CurrentC.h"
+#include "tao/PolicyC.h"
+#include "tao/ServicesC.h"
+#include "tao/DomainC.h"
+#include "tao/WrongTransactionC.h"
+
+#include "tao/ObjectIdListC.h"
+
+#include "tao/BooleanSeqC.h"
+#include "tao/CharSeqC.h"
+#include "tao/DoubleSeqC.h"
+#include "tao/FloatSeqC.h"
+#include "tao/LongDoubleSeqC.h"
+#include "tao/LongLongSeqC.h"
+#include "tao/LongSeqC.h"
+#include "tao/OctetSeqC.h"
+#include "tao/ShortSeqC.h"
+#include "tao/StringSeqC.h"
+#include "tao/ULongLongSeqC.h"
+#include "tao/ULongSeqC.h"
+#include "tao/UShortSeqC.h"
+#include "tao/WCharSeqC.h"
+#include "tao/WStringSeqC.h"
+
+// TAO specific files, avoid them as much as possible.
+
+#include "tao/CDR.h"
+#include "tao/Object_KeyC.h"
+#include "tao/String_Manager_T.h"
+
+#if TAO_HAS_INTERCEPTORS == 1
+#include "tao/PortableInterceptorC.h"
+#endif /* TAO_HAS_INTERCEPTORS == 1 */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_MASTER_CORBA_H */
diff --git a/TAO/tao/corbafwd.h b/TAO/tao/corbafwd.h
new file mode 100644
index 00000000000..80a9dc3b318
--- /dev/null
+++ b/TAO/tao/corbafwd.h
@@ -0,0 +1,38 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file corbafwd.h
+ *
+ * $Id$
+ *
+ * Forward declare the basic types used in the ORB
+ * implementation. Regular users of the ORB should only include
+ * tao/corba.h (generally through the stub/skeleton headers), but the
+ * implementation of the ORB itself should include this file. That
+ * reduces interdependency and speeds up compilations and
+ * recompilations.
+ *
+ * @author Carlos O'Ryan
+ * @author Ossama Othman
+ * @author Chris Cleeland
+ * @author Douglas C. Schmidt
+ */
+//=============================================================================
+
+#ifndef TAO_CORBAFWD_H
+#define TAO_CORBAFWD_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/ORB_Constants.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/CORBA_methods.h"
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_CORBAFWD_H */
diff --git a/TAO/tao/debug.cpp b/TAO/tao/debug.cpp
new file mode 100644
index 00000000000..3b2fdad7cb4
--- /dev/null
+++ b/TAO/tao/debug.cpp
@@ -0,0 +1,18 @@
+// THREADING NOTE: the global values here (debug_{level,filter,stream)
+// are assumed to be modified "safely", e.g. in the main thread as
+// part of process initialization. They are treated as immutable
+// values through all of this debuging package.
+//
+// XXX on Windows, make it always use OutputDebugString () instead of stdio.
+
+#include "tao/debug.h"
+
+ACE_RCSID (tao,
+ debug,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Export unsigned int TAO_debug_level = 0;
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/debug.h b/TAO/tao/debug.h
new file mode 100644
index 00000000000..6bd37a2341c
--- /dev/null
+++ b/TAO/tao/debug.h
@@ -0,0 +1,44 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file debug.h
+ *
+ * $Id$
+ *
+ * @author DOC Group - Wash U and UCI
+ */
+//=============================================================================
+
+
+#ifndef TAO_DEBUG_H
+#define TAO_DEBUG_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/TAO_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Versioned_Namespace.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// These are global to simplify is use by other code, very much in
+// particular by getopt and related argument-parsing code
+//
+// THREADING NOTE: don't set them except in an unthreaded environment
+// such as process initialization. They're treated as immutable.
+
+// 0 to ??; higher == more
+extern TAO_Export unsigned int TAO_debug_level;
+
+// debug messages on (1) or off (0)
+extern TAO_Export unsigned int TAO_orbdebug;
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_DEBUG_H */
diff --git a/TAO/tao/default_client.cpp b/TAO/tao/default_client.cpp
new file mode 100644
index 00000000000..b2c7aad11c5
--- /dev/null
+++ b/TAO/tao/default_client.cpp
@@ -0,0 +1,426 @@
+// $Id$
+
+#include "tao/default_client.h"
+#include "tao/Wait_On_Read.h"
+#include "tao/Wait_On_Reactor.h"
+#include "tao/Wait_On_Leader_Follower.h"
+#include "tao/Wait_On_LF_No_Upcall.h"
+#include "tao/Exclusive_TMS.h"
+#include "tao/Muxed_TMS.h"
+#include "tao/Blocked_Connect_Strategy.h"
+#include "tao/Reactive_Connect_Strategy.h"
+#include "tao/LF_Connect_Strategy.h"
+#include "tao/orbconf.h"
+
+#include "ace/Lock_Adapter_T.h"
+#include "ace/Recursive_Thread_Mutex.h"
+
+#include "ace/OS_NS_strings.h"
+#include "ace/OS_NS_string.h"
+
+ACE_RCSID (tao,
+ default_client,
+ "$Id$")
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Default_Client_Strategy_Factory::TAO_Default_Client_Strategy_Factory (void)
+ : profile_lock_type_ (TAO_THREAD_LOCK)
+ , transport_mux_strategy_ (TAO_MUXED_TMS)
+ , wait_strategy_ (TAO_WAIT_ON_LEADER_FOLLOWER)
+ , connect_strategy_ (TAO_LEADER_FOLLOWER_CONNECT)
+ , rd_table_size_ (TAO_RD_TABLE_SIZE)
+ , muxed_strategy_lock_type_ (TAO_THREAD_LOCK)
+ , use_cleanup_options_ (false)
+{
+ // Use single thread client connection handler
+#if defined (TAO_USE_ST_CLIENT_CONNECTION_HANDLER)
+ this->wait_strategy_ = TAO_WAIT_ON_REACTOR;
+#else
+ this->wait_strategy_ = TAO_WAIT_ON_LEADER_FOLLOWER;
+#endif /* TAO_USE_ST_CLIENT_CONNECTION_HANDLER */
+
+#if TAO_USE_MUXED_TRANSPORT_MUX_STRATEGY == 1
+ this->transport_mux_strategy_ = TAO_MUXED_TMS;
+#else
+ this->transport_mux_strategy_ = TAO_EXCLUSIVE_TMS;
+#endif /* TAO_USE_MUXED_TRANSPORT_MUX_STRATEGY */
+
+ // @@todo: will be changed when other strategies are implemented.
+ this->connect_strategy_ = TAO_LEADER_FOLLOWER_CONNECT;
+}
+
+TAO_Default_Client_Strategy_Factory::~TAO_Default_Client_Strategy_Factory (void)
+{
+}
+
+int
+TAO_Default_Client_Strategy_Factory::init (int argc, ACE_TCHAR* argv[])
+{
+ return this->parse_args (argc, argv);
+}
+
+int
+TAO_Default_Client_Strategy_Factory::parse_args (int argc, ACE_TCHAR* argv[])
+{
+ ACE_TRACE ("TAO_Default_Client_Strategy_Factory::parse_args");
+
+ int curarg;
+
+ for (curarg = 0; curarg < argc && argv[curarg]; ++curarg)
+ {
+ if (ACE_OS::strcasecmp (argv[curarg],
+ ACE_TEXT("-ORBProfileLock")) == 0)
+ {
+ curarg++;
+ if (curarg < argc)
+ {
+ ACE_TCHAR* name = argv[curarg];
+
+ if (ACE_OS::strcasecmp (name,
+ ACE_TEXT("thread")) == 0)
+ this->profile_lock_type_ = TAO_THREAD_LOCK;
+ else if (ACE_OS::strcasecmp (name,
+ ACE_TEXT("null")) == 0)
+ this->profile_lock_type_ = TAO_NULL_LOCK;
+ else
+ this->report_option_value_error (ACE_TEXT("-ORBProfileLock"), name);
+ }
+ }
+ else if (ACE_OS::strcasecmp (argv[curarg],
+ ACE_TEXT("-ORBIIOPProfileLock")) == 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("WARNING: The -ORBIIOPProfileLock option")
+ ACE_TEXT (" is deprecated and will be removed.\n")
+ ACE_TEXT (" Please use -ORBProfileLock instead\n")));
+ curarg++;
+ if (curarg < argc)
+ {
+ ACE_TCHAR* name = argv[curarg];
+
+ if (ACE_OS::strcasecmp (name,
+ ACE_TEXT("thread")) == 0)
+ this->profile_lock_type_ = TAO_THREAD_LOCK;
+ else if (ACE_OS::strcasecmp (name,
+ ACE_TEXT("null")) == 0)
+ this->profile_lock_type_ = TAO_NULL_LOCK;
+ else
+ this->report_option_value_error (ACE_TEXT("-ORBIIOPProfileLock"), name);
+ }
+ }
+
+ else if (ACE_OS::strcasecmp (argv[curarg],
+ ACE_TEXT("-ORBClientConnectionHandler")) == 0
+ ||
+ ACE_OS::strcasecmp (argv[curarg],
+ ACE_TEXT("-ORBWaitStrategy")) == 0)
+ {
+ curarg++;
+ if (curarg < argc)
+ {
+ ACE_TCHAR* name = argv[curarg];
+
+ if (ACE_OS::strcasecmp (name,
+ ACE_TEXT("MT")) == 0)
+ this->wait_strategy_ = TAO_WAIT_ON_LEADER_FOLLOWER;
+ else if (ACE_OS::strcasecmp (name,
+ ACE_TEXT("ST")) == 0)
+ this->wait_strategy_ = TAO_WAIT_ON_REACTOR;
+ else if (ACE_OS::strcasecmp (name,
+ ACE_TEXT("RW")) == 0)
+ this->wait_strategy_ = TAO_WAIT_ON_READ;
+ else if (ACE_OS::strcasecmp (name,
+ ACE_TEXT("MT_NOUPCALL")) == 0)
+ this->wait_strategy_ = TAO_WAIT_ON_LF_NO_UPCALL;
+ else
+ this->report_option_value_error (ACE_TEXT("-ORBClientConnectionHandler"), name);
+ }
+ }
+ else if (ACE_OS::strcasecmp (argv[curarg],
+ ACE_TEXT("-ORBTransportMuxStrategy")) == 0)
+ {
+ curarg++;
+ if (curarg < argc)
+ {
+ ACE_TCHAR* name = argv[curarg];
+
+ if (ACE_OS::strcasecmp (name,
+ ACE_TEXT("MUXED")) == 0)
+ this->transport_mux_strategy_ = TAO_MUXED_TMS;
+ else if (ACE_OS::strcasecmp (name,
+ ACE_TEXT("EXCLUSIVE")) == 0)
+ this->transport_mux_strategy_ = TAO_EXCLUSIVE_TMS;
+ else
+ this->report_option_value_error (ACE_TEXT("-ORBTransportMuxStrategy"), name);
+ }
+ }
+ else if (ACE_OS::strcasecmp (argv[curarg],
+ ACE_TEXT("-ORBTransportMuxStrategyLock")) == 0)
+ {
+ curarg++;
+ if (curarg < argc)
+ {
+ ACE_TCHAR* name = argv[curarg];
+
+ if (ACE_OS::strcasecmp (name,
+ ACE_TEXT("null")) == 0)
+ this->muxed_strategy_lock_type_ = TAO_NULL_LOCK;
+ else if (ACE_OS::strcasecmp (name,
+ ACE_TEXT("thread")) == 0)
+ this->muxed_strategy_lock_type_ = TAO_THREAD_LOCK;
+ else
+ this->report_option_value_error (ACE_TEXT("-ORBTransportMuxStrategyLock"), name);
+ }
+ }
+ else if (ACE_OS::strcasecmp (argv[curarg],
+ ACE_TEXT("-ORBConnectStrategy")) == 0)
+ {
+ curarg++;
+ if (curarg < argc)
+ {
+ ACE_TCHAR* name = argv[curarg];
+
+ if (ACE_OS::strcasecmp (name,
+ ACE_TEXT("Blocked")) == 0)
+ this->connect_strategy_ = TAO_BLOCKED_CONNECT;
+ else if (ACE_OS::strcasecmp (name,
+ ACE_TEXT("Reactive")) == 0)
+ this->connect_strategy_ = TAO_REACTIVE_CONNECT;
+ else if (ACE_OS::strcasecmp (name,
+ ACE_TEXT("LF")) == 0)
+ this->connect_strategy_ = TAO_LEADER_FOLLOWER_CONNECT;
+ else
+ this->report_option_value_error (ACE_TEXT("-ORBConnectStrategy"), name);
+ }
+ }
+ else if (ACE_OS::strcasecmp (argv[curarg],
+ ACE_TEXT("-ORBReplyDispatcherTableSize")) == 0)
+ {
+ curarg++;
+ if (curarg < argc)
+ {
+ this->rd_table_size_ = ACE_OS::atoi (argv[curarg]);
+ }
+ }
+ else if (ACE_OS::strcmp (argv[curarg],
+ ACE_TEXT("-ORBConnectionHandlerCleanup")) == 0)
+ {
+ curarg++;
+ if (curarg < argc)
+ {
+ ACE_TCHAR* name = argv[curarg];
+
+ if (ACE_OS::strcmp (name, ACE_TEXT("0")) == 0 ||
+ ACE_OS::strcasecmp (name, ACE_TEXT("false")) == 0)
+ this->use_cleanup_options_ = false;
+ else if (ACE_OS::strcmp (name, ACE_TEXT("1")) == 0 ||
+ ACE_OS::strcasecmp (name, ACE_TEXT("true")) == 0)
+ this->use_cleanup_options_ = true;
+ else
+ this->report_option_value_error (ACE_TEXT("-ORBConnectionHandlerCleanup"), name);
+ }
+ }
+ else if (ACE_OS::strncmp (argv[curarg], ACE_TEXT("-ORB"), 4) == 0)
+ {
+ // Can we assume there is an argument after the option?
+ // curarg++;
+ ACE_ERROR ((LM_ERROR,
+ "Client_Strategy_Factory - "
+ "unknown option <%s>\n",
+ argv[curarg]));
+ }
+ else
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "Client_Strategy_Factory - "
+ "ignoring option <%s>\n",
+ argv[curarg]));
+ }
+
+
+ }
+ return 0;
+}
+
+ACE_Lock *
+TAO_Default_Client_Strategy_Factory::create_profile_lock (void)
+{
+ ACE_Lock *the_lock = 0;
+
+ if (this->profile_lock_type_ == TAO_NULL_LOCK)
+ ACE_NEW_RETURN (the_lock,
+ ACE_Lock_Adapter<ACE_SYNCH_NULL_MUTEX> (),
+ 0);
+ else
+ ACE_NEW_RETURN (the_lock,
+ ACE_Lock_Adapter<TAO_SYNCH_MUTEX> (),
+ 0);
+
+ return the_lock;
+}
+
+TAO_Configurable_Refcount
+TAO_Default_Client_Strategy_Factory::create_profile_refcount (void)
+{
+ switch (this->profile_lock_type_)
+ {
+ case TAO_NULL_LOCK:
+ return TAO_Configurable_Refcount (
+ TAO_Configurable_Refcount::TAO_NULL_LOCK);
+ case TAO_THREAD_LOCK:
+ default:
+ return TAO_Configurable_Refcount (
+ TAO_Configurable_Refcount::TAO_THREAD_LOCK);
+ }
+}
+
+// Create the correct client transport muxing strategy.
+TAO_Transport_Mux_Strategy *
+TAO_Default_Client_Strategy_Factory::create_transport_mux_strategy (TAO_Transport *transport)
+{
+ TAO_Transport_Mux_Strategy *tms = 0;
+
+ if (this->transport_mux_strategy_ == TAO_MUXED_TMS)
+ ACE_NEW_RETURN (tms,
+ TAO_Muxed_TMS (transport),
+ 0);
+ else
+ ACE_NEW_RETURN (tms,
+ TAO_Exclusive_TMS (transport),
+ 0);
+
+ return tms;
+}
+
+ACE_Lock *
+TAO_Default_Client_Strategy_Factory::create_transport_mux_strategy_lock (void)
+{
+ ACE_Lock *the_lock = 0;
+
+ if (this->muxed_strategy_lock_type_ == TAO_NULL_LOCK)
+ ACE_NEW_RETURN (the_lock,
+ ACE_Lock_Adapter<ACE_SYNCH_NULL_MUTEX> (),
+ 0);
+ else
+ ACE_NEW_RETURN (the_lock,
+ ACE_Lock_Adapter<TAO_SYNCH_RECURSIVE_MUTEX> (),
+ 0);
+
+ return the_lock;
+}
+
+int
+TAO_Default_Client_Strategy_Factory::reply_dispatcher_table_size (void) const
+{
+ return this->rd_table_size_;
+}
+
+TAO_Wait_Strategy *
+TAO_Default_Client_Strategy_Factory::create_wait_strategy (TAO_Transport *transport)
+{
+ TAO_Wait_Strategy *ws = 0;
+
+ if (this->wait_strategy_ == TAO_WAIT_ON_READ)
+ ACE_NEW_RETURN (ws,
+ TAO_Wait_On_Read (transport),
+ 0);
+ else if (this->wait_strategy_ == TAO_WAIT_ON_REACTOR)
+ ACE_NEW_RETURN (ws,
+ TAO_Wait_On_Reactor (transport),
+ 0);
+ else if (this->wait_strategy_ == TAO_WAIT_ON_LF_NO_UPCALL)
+ ACE_NEW_RETURN (ws,
+ TAO::Wait_On_LF_No_Upcall (transport),
+ 0);
+ else
+ {
+ // = Leader follower model.
+
+ ACE_NEW_RETURN (ws,
+ TAO_Wait_On_Leader_Follower (transport),
+ 0);
+ }
+
+ return ws;
+}
+
+TAO_Client_Strategy_Factory::Connect_Strategy
+TAO_Default_Client_Strategy_Factory::connect_strategy (void) const
+{
+ return this->connect_strategy_;
+}
+
+TAO_Connect_Strategy *
+TAO_Default_Client_Strategy_Factory::create_connect_strategy (TAO_ORB_Core *orb_core)
+{
+ TAO_Connect_Strategy *cs = 0;
+
+ if (this->connect_strategy_ == TAO_BLOCKED_CONNECT)
+ ACE_NEW_RETURN (cs,
+ TAO_Blocked_Connect_Strategy (orb_core),
+ 0);
+ else if (this->connect_strategy_ == TAO_REACTIVE_CONNECT)
+ ACE_NEW_RETURN (cs,
+ TAO_Reactive_Connect_Strategy (orb_core),
+ 0);
+ else
+ {
+ // = Leader follower model.
+
+ ACE_NEW_RETURN (cs,
+ TAO_LF_Connect_Strategy (orb_core),
+ 0);
+ }
+
+ return cs;
+}
+
+
+int
+TAO_Default_Client_Strategy_Factory::allow_callback (void)
+{
+ return (this->wait_strategy_ != TAO_WAIT_ON_READ);
+}
+
+ACE_Lock *
+TAO_Default_Client_Strategy_Factory::create_ft_service_retention_id_lock (void)
+{
+ ACE_Lock *the_lock = 0;
+
+ ACE_NEW_RETURN (the_lock,
+ ACE_Lock_Adapter<TAO_SYNCH_MUTEX>,
+ 0);
+
+ return the_lock;
+}
+
+void
+TAO_Default_Client_Strategy_Factory::report_option_value_error (
+ const ACE_TCHAR* option_name,
+ const ACE_TCHAR* option_value)
+{
+ ACE_DEBUG((LM_DEBUG,
+ ACE_TEXT ("Client_Strategy_Factory - unknown argument")
+ ACE_TEXT (" <%s> for <%s>\n"),
+ option_value, option_name));
+}
+
+bool
+TAO_Default_Client_Strategy_Factory::use_cleanup_options (void) const
+{
+ return this->use_cleanup_options_;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+// ****************************************************************
+
+ACE_STATIC_SVC_DEFINE (TAO_Default_Client_Strategy_Factory,
+ ACE_TEXT ("Client_Strategy_Factory"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (TAO_Default_Client_Strategy_Factory),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0)
+ACE_FACTORY_DEFINE (TAO, TAO_Default_Client_Strategy_Factory)
diff --git a/TAO/tao/default_client.h b/TAO/tao/default_client.h
new file mode 100644
index 00000000000..3fd00513949
--- /dev/null
+++ b/TAO/tao/default_client.h
@@ -0,0 +1,121 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file default_client.h
+ *
+ * $Id$
+ *
+ * @author Chris Cleeland
+ */
+//=============================================================================
+
+
+#ifndef TAO_DEFAULT_CLIENT_H
+#define TAO_DEFAULT_CLIENT_H
+
+#include /**/ "ace/pre.h"
+#include "ace/Service_Config.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Client_Strategy_Factory.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_Default_Client_Strategy_Factory
+ *
+ * @brief This is the "default" client strategy factor for TAO. It
+ * includes strategies that are configured through command-line
+ * options so that everything operates as if there were no
+ * dynamically-linkable strategies.
+ */
+class TAO_Export TAO_Default_Client_Strategy_Factory
+ : public TAO_Client_Strategy_Factory
+{
+public:
+ // = Initialization and termination methods.
+ /// Constructor.
+ TAO_Default_Client_Strategy_Factory (void);
+
+ /// Destructor.
+ virtual ~TAO_Default_Client_Strategy_Factory (void);
+
+ // = Service Configurator hooks.
+ /// Dynamic linking hook
+ virtual int init (int argc, ACE_TCHAR* argv[]);
+
+ /// Parse svc.conf arguments
+ int parse_args (int argc, ACE_TCHAR* argv[]);
+
+ // = Check Client_Strategy_Factory.h for the documentation of the
+ // following methods.
+ virtual ACE_Lock* create_profile_lock (void);
+ virtual TAO_Configurable_Refcount create_profile_refcount (void);
+ virtual TAO_Transport_Mux_Strategy *create_transport_mux_strategy (TAO_Transport *transport);
+ virtual ACE_Lock *create_transport_mux_strategy_lock (void);
+ virtual int reply_dispatcher_table_size (void) const;
+ virtual int allow_callback (void);
+ virtual TAO_Wait_Strategy *create_wait_strategy (TAO_Transport *transport);
+ virtual TAO_Connect_Strategy *create_connect_strategy (TAO_ORB_Core *);
+ virtual ACE_Lock *create_ft_service_retention_id_lock (void);
+ virtual bool use_cleanup_options (void) const;
+ virtual Connect_Strategy connect_strategy (void) const;
+
+protected:
+ void report_option_value_error (const ACE_TCHAR* option_name,
+ const ACE_TCHAR* option_value);
+
+private:
+ enum Lock_Type
+ {
+ TAO_NULL_LOCK,
+ TAO_THREAD_LOCK
+ };
+
+ /// the lock type for forwarding IIOP Profile
+ Lock_Type profile_lock_type_;
+
+ enum Transport_Mux_Strategy
+ {
+ TAO_MUXED_TMS,
+ TAO_EXCLUSIVE_TMS
+ };
+
+ /// The client Request Mux Strategy.
+ Transport_Mux_Strategy transport_mux_strategy_;
+
+ enum Wait_Strategy
+ {
+ TAO_WAIT_ON_LEADER_FOLLOWER,
+ TAO_WAIT_ON_REACTOR,
+ TAO_WAIT_ON_READ,
+ TAO_WAIT_ON_LF_NO_UPCALL
+ };
+
+ /// The wait-for-reply strategy.
+ Wait_Strategy wait_strategy_;
+
+ /// The connection initiation strategy.
+ Connect_Strategy connect_strategy_;
+
+ /// Size of the reply dispatcher table
+ int rd_table_size_;
+
+ /// Type of lock for the muxed_strategy
+ Lock_Type muxed_strategy_lock_type_;
+
+ /// Cleanupoptions for RW strategy
+ bool use_cleanup_options_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE_EXPORT (TAO, TAO_Default_Client_Strategy_Factory)
+ACE_FACTORY_DECLARE (TAO, TAO_Default_Client_Strategy_Factory)
+
+#include /**/ "ace/post.h"
+#endif /* TAO_DEFAULT_CLIENT_H */
diff --git a/TAO/tao/default_environment.h b/TAO/tao/default_environment.h
new file mode 100644
index 00000000000..a535b1fa05a
--- /dev/null
+++ b/TAO/tao/default_environment.h
@@ -0,0 +1,43 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file default_environment.h
+ *
+ * $Id$
+ *
+ * @author Balachandran Natarajan <bala@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_DEFAULT_ENVIRONMENT_H
+#define TAO_DEFAULT_ENVIRONMENT_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/TAO_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace CORBA
+{
+ class Environment;
+}
+
+/// Provide a simple function to access the TSS default
+/// environment. This will be used in TAO wherever we have a default
+/// environment.
+/**
+ * @note We tried with CORBA::default_environment() and others.
+ */
+TAO_Export CORBA::Environment& TAO_default_environment (void);
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_DEFAULT_ENVIRONMENT_H */
diff --git a/TAO/tao/default_ports.h b/TAO/tao/default_ports.h
new file mode 100644
index 00000000000..c9ef066ea64
--- /dev/null
+++ b/TAO/tao/default_ports.h
@@ -0,0 +1,77 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file default_ports.h
+ *
+ * $Id$
+ *
+ * Port reservation details for all the services.
+ *
+ * @author Copyright 1995 by Sun Microsystems, Inc.
+ * @author Chris Cleeland
+ * @author Douglas C. Schmidt
+ */
+//=============================================================================
+
+#ifndef TAO_DEFAULT_PORTS_H
+#define TAO_DEFAULT_PORTS_H
+#include /**/ "ace/pre.h"
+
+#include "ace/config-all.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+
+// The default UDP multicast port number for locating the TAO Naming
+// Service.
+#if !defined (TAO_DEFAULT_NAME_SERVER_REQUEST_PORT)
+#define TAO_DEFAULT_NAME_SERVER_REQUEST_PORT 10013
+#endif /* TAO_DEFAULT_NAME_SERVER_REQUEST_PORT */
+
+// The default UDP port number for replying to a location request to
+// the TAO Naming Service.
+#if !defined (TAO_DEFAULT_NAME_SERVER_REPLY_PORT)
+#define TAO_DEFAULT_NAME_SERVER_REPLY_PORT 10014
+#endif /* TAO_DEFAULT_NAME_SERVER_REPLY_PORT */
+
+// The default UDP multicast port number for locating the TAO Trading
+// Service.
+#if !defined (TAO_DEFAULT_TRADING_SERVER_REQUEST_PORT)
+#define TAO_DEFAULT_TRADING_SERVER_REQUEST_PORT 10016
+#endif /* TAO_DEFAULT_TRADING_SERVER_REQUEST_PORT */
+
+// The default UDP port number for replying to a location request to
+// the TAO Trading Service.
+#if !defined (TAO_DEFAULT_TRADING_SERVER_REPLY_PORT)
+#define TAO_DEFAULT_TRADING_SERVER_REPLY_PORT 10017
+#endif /* TAO_DEFAULT_TRADING_SERVER_REPLY_PORT */
+
+// The default UDP multicast port number for locating the TAO
+// Implementation Repository Service.
+#if !defined (TAO_DEFAULT_IMPLREPO_SERVER_REQUEST_PORT)
+#define TAO_DEFAULT_IMPLREPO_SERVER_REQUEST_PORT 10018
+#endif /* TAO_DEFAULT_IMPLREPO_SERVER_REQUEST_PORT */
+
+// The default UDP port number for replying to a location request to
+// the TAO Implementation Repository Service.
+#if !defined (TAO_DEFAULT_IMPLREPO_SERVER_REPLY_PORT)
+#define TAO_DEFAULT_IMPLREPO_SERVER_REPLY_PORT 10019
+#endif /* TAO_DEFAULT_IMPLREPO_SERVER_REPLY_PORT */
+
+// The default UDP multicast port number for locating the TAO
+// Interface Repository Service.
+#if !defined (TAO_DEFAULT_INTERFACEREPO_SERVER_REQUEST_PORT)
+#define TAO_DEFAULT_INTERFACEREPO_SERVER_REQUEST_PORT 10020
+#endif /* TAO_DEFAULT_INTERFACEREPO_SERVER_REQUEST_PORT */
+
+// The default UDP port number for replying to a location request to
+// the TAO Interface Repository Service.
+#if !defined (TAO_DEFAULT_INTERFACEREPO_SERVER_REPLY_PORT)
+#define TAO_DEFAULT_INTERFACEREPO_SERVER_REPLY_PORT 10021
+#endif /* TAO_DEFAULT_INTERFACEREPO_SERVER_REPLY_PORT */
+
+#include /**/ "ace/post.h"
+#endif /*TAO_DEFAULT_PORTS_H*/
diff --git a/TAO/tao/default_resource.cpp b/TAO/tao/default_resource.cpp
new file mode 100644
index 00000000000..e77480caef3
--- /dev/null
+++ b/TAO/tao/default_resource.cpp
@@ -0,0 +1,1230 @@
+// $Id$
+
+#include "tao/default_resource.h"
+
+#include "tao/debug.h"
+#include "tao/IIOP_Factory.h"
+#include "tao/Acceptor_Registry.h"
+#include "tao/Connector_Registry.h"
+#include "tao/Reactive_Flushing_Strategy.h"
+#include "tao/Block_Flushing_Strategy.h"
+#include "tao/Leader_Follower_Flushing_Strategy.h"
+#include "tao/LRU_Connection_Purging_Strategy.h"
+#include "tao/LF_Strategy_Complete.h"
+#include "tao/Codeset_Descriptor_Base.h"
+#include "tao/Codeset_Manager_Factory_Base.h"
+#include "tao/Codeset_Manager.h"
+#include "tao/Null_Fragmentation_Strategy.h"
+#include "tao/On_Demand_Fragmentation_Strategy.h"
+#include "tao/MMAP_Allocator.h"
+#include "tao/Load_Protocol_Factory_T.h"
+
+#include "ace/TP_Reactor.h"
+#include "ace/Malloc.h"
+#include "ace/Reactor.h"
+#include "ace/Malloc_T.h"
+#include "ace/Local_Memory_Pool.h"
+#include "ace/OS_NS_string.h"
+#include "ace/OS_NS_strings.h"
+
+ACE_RCSID (tao,
+ default_resource,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Default_Resource_Factory::TAO_Default_Resource_Factory (void)
+ : use_locked_data_blocks_ (1)
+ , parser_names_count_ (0)
+ , parser_names_ (0)
+ , protocol_factories_ ()
+ , connection_purging_type_ (TAO_CONNECTION_PURGING_STRATEGY)
+ , cache_maximum_ (TAO_CONNECTION_CACHE_MAXIMUM)
+ , purge_percentage_ (TAO_PURGE_PERCENT)
+ , max_muxed_connections_ (0)
+ , reactor_mask_signals_ (1)
+ , dynamically_allocated_reactor_ (0)
+ , options_processed_ (0)
+ , factory_disabled_ (0)
+#if TAO_USE_OUTPUT_CDR_MMAP_MEMORY_POOL == 1
+ , output_cdr_allocator_type_ (MMAP_ALLOCATOR)
+#else
+ , output_cdr_allocator_type_ (DEFAULT)
+#endif
+#if TAO_USE_LOCAL_MEMORY_POOL == 1
+ , use_local_memory_pool_ (true)
+#else
+ , use_local_memory_pool_ (false)
+#endif
+ , cached_connection_lock_type_ (TAO_THREAD_LOCK)
+ , object_key_table_lock_type_ (TAO_THREAD_LOCK)
+ , corba_object_lock_type_ (TAO_THREAD_LOCK)
+ , flushing_strategy_type_ (TAO_LEADER_FOLLOWER_FLUSHING)
+ , codeset_manager_ (0)
+ , char_codeset_descriptor_ (0)
+ , wchar_codeset_descriptor_ (0)
+ , resource_usage_strategy_ (TAO_Resource_Factory::TAO_EAGER)
+ , drop_replies_ (true)
+ , principal_(0)
+{
+#if TAO_USE_LAZY_RESOURCE_USAGE_STRATEGY == 1
+ this->resource_usage_strategy_ =
+ TAO_Resource_Factory::TAO_LAZY;
+#endif /*TAO_USE_LAZY_RESOURCE_USAGE_STRATEGY*/
+
+
+}
+
+TAO_Default_Resource_Factory::~TAO_Default_Resource_Factory (void)
+{
+ const TAO_ProtocolFactorySetItor end = this->protocol_factories_.end ();
+
+ for (TAO_ProtocolFactorySetItor iterator =
+ this->protocol_factories_.begin ();
+ iterator != end;
+ ++iterator)
+ {
+ delete *iterator;
+ }
+
+ this->protocol_factories_.reset ();
+
+ for (int i = 0; i < this->parser_names_count_; ++i)
+ CORBA::string_free (this->parser_names_[i]);
+
+ delete [] this->parser_names_;
+
+ delete codeset_manager_;
+ codeset_manager_ = 0;
+
+ delete principal_;
+}
+
+int
+TAO_Default_Resource_Factory::init (int argc, ACE_TCHAR *argv[])
+{
+ ACE_TRACE ("TAO_Default_Resource_Factory::init");
+
+ // If this factory has already been disabled then
+ // print a warning and exit because any options
+ // are useless
+ if (this->factory_disabled_) {
+ ACE_DEBUG ((LM_WARNING,
+ ACE_TEXT ("TAO (%P|%t) Warning: Resource_Factory options ")
+ ACE_TEXT ("ignored\n")
+ ACE_TEXT ("Default Resource Factory is disabled\n")));
+ return 0;
+ }
+ this->options_processed_ = 1;
+
+ this->parser_names_count_ = 0;
+
+ int curarg = 0;
+
+ for (curarg = 0; curarg < argc; ++curarg)
+ {
+ // Parse thro' and find the number of Parsers to be loaded.
+ if (ACE_OS::strcasecmp (argv[curarg],
+ ACE_TEXT("-ORBIORParser")) == 0)
+ ++this->parser_names_count_;
+
+ ++curarg;
+
+ if (curarg == (argc-1) && this->parser_names_count_ != 0)
+ {
+ // This is the last loop..
+ ACE_NEW_RETURN (this->parser_names_,
+ char *[this->parser_names_count_],
+ -1);
+
+ for (int i = 0;
+ i < this->parser_names_count_;
+ ++i)
+ this->parser_names_[i] = 0;
+
+ this->index_ = 0;
+ }
+ }
+
+ for (curarg = 0; curarg < argc; ++curarg)
+ {
+ if (ACE_OS::strcasecmp (argv[curarg],
+ ACE_TEXT("-ORBReactorMaskSignals")) == 0)
+ {
+ ++curarg;
+ if (curarg < argc)
+ {
+ ACE_TCHAR* name = argv[curarg];
+
+ if (ACE_OS::strcasecmp (name, ACE_TEXT("0")) == 0)
+ this->reactor_mask_signals_ = 0;
+ else if (ACE_OS::strcasecmp (name, ACE_TEXT("1")) == 0)
+ this->reactor_mask_signals_= 1;
+ else
+ this->report_option_value_error (ACE_TEXT("-ORBReactorMaskSignals"), name);
+ }
+ }
+
+ else if (ACE_OS::strcasecmp (argv[curarg],
+ ACE_TEXT("-ORBProtocolFactory")) == 0)
+ {
+ TAO_ProtocolFactorySet *pset = this->get_protocol_factories ();
+ ++curarg;
+ if (curarg < argc)
+ {
+ TAO_Protocol_Item *item = 0;
+ ACE_NEW_RETURN (item,
+ TAO_Protocol_Item (ACE_TEXT_ALWAYS_CHAR(argv[curarg])),
+ -1);
+ if (pset->insert (item) == -1)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) Unable to add protocol factories ")
+ ACE_TEXT ("for %s: %m\n"),
+ argv[curarg]));
+ }
+ }
+
+ /// CodeSet Translators
+ else if (ACE_OS::strcasecmp (argv[curarg],
+ ACE_TEXT("-ORBNativeCharCodeSet")) == 0)
+ {
+ ++curarg;
+ if (curarg < argc)
+ {
+ if (this->char_codeset_descriptor_ == 0)
+ this->init_codeset_descriptors();
+ if (this->char_codeset_descriptor_)
+ this->char_codeset_descriptor_->ncs (argv[curarg]);
+ }
+ }
+
+ else if (ACE_OS::strcasecmp (argv[curarg],
+ ACE_TEXT("-ORBNativeWCharCodeSet")) == 0)
+ {
+ ++curarg;
+ if (curarg < argc)
+ {
+ if (this->wchar_codeset_descriptor_ == 0)
+ this->init_codeset_descriptors();
+ if (this->wchar_codeset_descriptor_)
+ this->wchar_codeset_descriptor_->ncs (argv[curarg]);
+ }
+ }
+
+ else if (ACE_OS::strcasecmp (argv[curarg],
+ ACE_TEXT("-ORBCharCodesetTranslator")) == 0)
+ {
+ ++curarg;
+ if (curarg < argc)
+ {
+ if (this->char_codeset_descriptor_ == 0)
+ this->init_codeset_descriptors();
+ if (this->char_codeset_descriptor_)
+ this->char_codeset_descriptor_->add_translator (argv[curarg]);
+ }
+ }
+
+ /// CodeSet Translators
+ else if (ACE_OS::strcasecmp (argv[curarg],
+ ACE_TEXT("-ORBWCharCodesetTranslator")) == 0)
+ {
+ ++curarg;
+ if (curarg < argc)
+ {
+ if (this->wchar_codeset_descriptor_ == 0)
+ this->init_codeset_descriptors();
+ if (this->wchar_codeset_descriptor_)
+ this->wchar_codeset_descriptor_->add_translator (argv[curarg]);
+ }
+ }
+
+ else if (ACE_OS::strcasecmp (argv[curarg],
+ ACE_TEXT("-ORBConnectionCachingStrategy")) == 0)
+ {
+ ++curarg;
+
+ // @@todo: This needs to be removed after a few betas. The
+ // note is being written during 1.2.3 timeframe.
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("(%P|%t) This option would be deprecated \n")
+ ACE_TEXT ("(%P|%t) Please use -ORBConnectionPurgingStrategy ")
+ ACE_TEXT ("instead \n")));
+
+ if (curarg < argc)
+ {
+ ACE_TCHAR* name = argv[curarg];
+
+ if (ACE_OS::strcasecmp (name,
+ ACE_TEXT ("lru")) == 0)
+ this->connection_purging_type_ =
+ TAO_Resource_Factory::LRU;
+ else if (ACE_OS::strcasecmp (name,
+ ACE_TEXT ("lfu")) == 0)
+ this->connection_purging_type_ =
+ TAO_Resource_Factory::LFU;
+ else if (ACE_OS::strcasecmp (name,
+ ACE_TEXT ("fifo")) == 0)
+ this->connection_purging_type_ =
+ TAO_Resource_Factory::FIFO;
+ else if (ACE_OS::strcasecmp (name,
+ ACE_TEXT ("null")) == 0)
+ this->connection_purging_type_ =
+ TAO_Resource_Factory::NOOP;
+ else
+ this->report_option_value_error (ACE_TEXT ("-ORBConnectionCachingStrategy"), name);
+ }
+ }
+ else if (ACE_OS::strcasecmp (argv[curarg],
+ ACE_TEXT("-ORBConnectionPurgingStrategy")) == 0)
+ {
+ ++curarg;
+
+ if (curarg < argc)
+ {
+ ACE_TCHAR* name = argv[curarg];
+
+ if (ACE_OS::strcasecmp (name,
+ ACE_TEXT("lru")) == 0)
+ this->connection_purging_type_ =
+ TAO_Resource_Factory::LRU;
+ else if (ACE_OS::strcasecmp (name,
+ ACE_TEXT("lfu")) == 0)
+ this->connection_purging_type_ =
+ TAO_Resource_Factory::LFU;
+ else if (ACE_OS::strcasecmp (name,
+ ACE_TEXT("fifo")) == 0)
+ this->connection_purging_type_ =
+ TAO_Resource_Factory::FIFO;
+ else if (ACE_OS::strcasecmp (name,
+ ACE_TEXT("null")) == 0)
+ this->connection_purging_type_ =
+ TAO_Resource_Factory::NOOP;
+ else
+ this->report_option_value_error (ACE_TEXT("-ORBConnectionPurgingStrategy"), name);
+ }
+ }
+ else if (ACE_OS::strcasecmp (argv[curarg],
+ ACE_TEXT("-ORBConnectionCacheMax")) == 0)
+ {
+ ++curarg;
+ if (curarg < argc)
+ this->cache_maximum_ = ACE_OS::atoi (argv[curarg]);
+ else
+ this->report_option_value_error (ACE_TEXT("-ORBConnectionCacheMax"), argv[curarg]);
+ }
+
+ else if (ACE_OS::strcasecmp (argv[curarg],
+ ACE_TEXT("-ORBConnectionCachePurgePercentage")) == 0)
+ {
+ ++curarg;
+ if (curarg < argc)
+ this->purge_percentage_ = ACE_OS::atoi (argv[curarg]);
+ else
+ this->report_option_value_error (ACE_TEXT("-ORBConnectionCachePurgePercentage"),
+ argv[curarg]);
+ }
+ else if (ACE_OS::strcasecmp (argv[curarg],
+ ACE_TEXT("-ORBIORParser")) == 0)
+ {
+ ++curarg;
+
+ if (curarg < argc)
+ {
+ this->add_to_ior_parser_names (ACE_TEXT_ALWAYS_CHAR(argv[curarg]));
+ }
+ }
+
+ else if (ACE_OS::strcasecmp (argv[curarg],
+ ACE_TEXT("-ORBConnectionCacheLock")) == 0)
+ {
+ ++curarg;
+ if (curarg < argc)
+ {
+ ACE_TCHAR* name = argv[curarg];
+
+ if (ACE_OS::strcasecmp (name,
+ ACE_TEXT("thread")) == 0)
+ this->cached_connection_lock_type_ = TAO_THREAD_LOCK;
+ else if (ACE_OS::strcasecmp (name,
+ ACE_TEXT("null")) == 0)
+ {
+ // @@ Bug 940 :This is a sort of hack now. We need to put
+ // this in a common place once we get the common
+ // switch that is documented in bug 940...
+ this->use_locked_data_blocks_ = 0;
+ this->cached_connection_lock_type_ = TAO_NULL_LOCK;
+ }
+ else
+ this->report_option_value_error (ACE_TEXT("-ORBConnectionCacheLock"), name);
+ }
+ }
+ else if (ACE_OS::strcasecmp (argv[curarg],
+ ACE_TEXT("-ORBObjectKeyTableLock")) == 0)
+ {
+ ++curarg;
+ if (curarg < argc)
+ {
+ ACE_TCHAR* name = argv[curarg];
+
+ if (ACE_OS::strcasecmp (name,
+ ACE_TEXT("thread")) == 0)
+ this->object_key_table_lock_type_ = TAO_THREAD_LOCK;
+ else if (ACE_OS::strcasecmp (name,
+ ACE_TEXT("null")) == 0)
+ {
+ // @@ Bug 940 :This is a sort of hack now. We need to put
+ // this in a common place once we get the common
+ // switch that is documented in bug 940...
+ this->object_key_table_lock_type_ = TAO_NULL_LOCK;
+ }
+ else
+ this->report_option_value_error (ACE_TEXT("-ORBObjectKeyTableLock"), name);
+ }
+ }
+ else if (ACE_OS::strcasecmp (argv[curarg],
+ ACE_TEXT("-ORBCorbaObjectLock")) == 0)
+ {
+ ++curarg;
+ if (curarg < argc)
+ {
+ ACE_TCHAR* name = argv[curarg];
+
+ if (ACE_OS::strcasecmp (name,
+ ACE_TEXT("thread")) == 0)
+ this->corba_object_lock_type_ = TAO_THREAD_LOCK;
+ else if (ACE_OS::strcasecmp (name,
+ ACE_TEXT("null")) == 0)
+ {
+ // @@ Bug 940 :This is a sort of hack now. We need to put
+ // this in a common place once we get the common
+ // switch that is documented in bug 940...
+ this->corba_object_lock_type_ = TAO_NULL_LOCK;
+ }
+ else
+ this->report_option_value_error (ACE_TEXT("-ORBCorbaObjectLock"), name);
+ }
+ }
+ else if (ACE_OS::strcasecmp (argv[curarg],
+ ACE_TEXT("-ORBResourceUsage")) == 0)
+ {
+ ++curarg;
+ if (curarg < argc)
+ {
+ ACE_TCHAR* name = argv[curarg];
+
+ if (ACE_OS::strcasecmp (name,
+ ACE_TEXT("eager")) == 0)
+ this->resource_usage_strategy_ = TAO_EAGER;
+ else if (ACE_OS::strcasecmp (name,
+ ACE_TEXT("lazy")) == 0)
+ {
+ this->resource_usage_strategy_ = TAO_LAZY;
+ }
+ else
+ this->report_option_value_error (ACE_TEXT("-ORBResourceUsage"), name);
+ }
+ }
+ else if (ACE_OS::strcasecmp (argv[curarg],
+ ACE_TEXT("-ORBFlushingStrategy")) == 0)
+ {
+ ++curarg;
+ /*
+ * Hook to specialize TAO's Flushing strategy implementations
+ */
+//@@ FLUSHING_STRATEGY_SPL_COMMENT_HOOK_START
+ if (curarg < argc)
+ {
+ ACE_TCHAR* name = argv[curarg];
+
+ if (ACE_OS::strcasecmp (name,
+ ACE_TEXT("leader_follower")) == 0)
+ this->flushing_strategy_type_ = TAO_LEADER_FOLLOWER_FLUSHING;
+ else if (ACE_OS::strcasecmp (name,
+ ACE_TEXT("reactive")) == 0)
+ this->flushing_strategy_type_ = TAO_REACTIVE_FLUSHING;
+ else if (ACE_OS::strcasecmp (name,
+ ACE_TEXT("blocking")) == 0)
+ this->flushing_strategy_type_ = TAO_BLOCKING_FLUSHING;
+ else
+ this->report_option_value_error (ACE_TEXT("-ORBFlushingStrategy"), name);
+ }
+//@@ FLUSHING_STRATEGY_SPL_COMMENT_HOOK_END
+ }
+ else if (ACE_OS::strcasecmp (argv[curarg],
+ ACE_TEXT ("-ORBMuxedConnectionMax")) == 0)
+ {
+ ++curarg;
+ if (curarg < argc)
+ this->max_muxed_connections_ =
+ ACE_OS::atoi (argv[curarg]);
+ else
+ this->report_option_value_error (ACE_TEXT("-ORBMuxedConnectionMax"),
+ argv[curarg]);
+ }
+ else if (ACE_OS::strcasecmp (argv[curarg],
+ ACE_TEXT("-ORBDropRepliesDuringShutdown")) == 0)
+ {
+ ++curarg;
+ if (curarg < argc)
+ {
+ int tmp = ACE_OS::atoi (argv[curarg]);
+
+ if (tmp == 0)
+ this->drop_replies_ = false;
+ else
+ this->drop_replies_ = true;
+ }
+ else
+ this->report_option_value_error (ACE_TEXT("-ORBDropRepliesDuringShutdown"),
+ argv[curarg]);
+ }
+ else if (0 == ACE_OS::strcasecmp (argv[curarg],
+ ACE_TEXT("-ORBOutputCDRAllocator")))
+ {
+ ++curarg;
+
+ if (curarg < argc)
+ {
+ ACE_TCHAR const * const current_arg = argv[curarg];
+
+ if (ACE_OS::strcasecmp (current_arg,
+ ACE_TEXT("mmap")) == 0)
+ {
+#ifdef ACE_HAS_SENDFILE
+ this->output_cdr_allocator_type_ = MMAP_ALLOCATOR;
+#else
+ ACE_DEBUG ((LM_WARNING,
+ ACE_TEXT ("MMAP allocator unsupport on this platform")));
+#endif /* ACE_HAS_SENDFILE */
+ }
+ else if (ACE_OS::strcasecmp (current_arg,
+ ACE_TEXT("local_memory_pool")) == 0
+ && this->output_cdr_allocator_type_ != DEFAULT)
+ {
+ this->output_cdr_allocator_type_ = LOCAL_MEMORY_POOL;
+ }
+ else if (ACE_OS::strcasecmp (current_arg,
+ ACE_TEXT("default")) == 0)
+ {
+ this->output_cdr_allocator_type_ = DEFAULT;
+ }
+ else
+ {
+ this->report_option_value_error (
+ ACE_TEXT("-ORBOutputCDRAllocator"), current_arg);
+ }
+ }
+ }
+ else if (0 == ACE_OS::strcasecmp (argv[curarg],
+ ACE_TEXT("-ORBZeroCopyWrite")))
+ {
+#ifdef ACE_HAS_SENDFILE
+ this->output_cdr_allocator_type_ = MMAP_ALLOCATOR;
+#else
+ ACE_DEBUG ((LM_WARNING,
+ ACE_TEXT ("Zero copy writes unsupported on this platform\n")));
+#endif /* ACE_HAS_SENDFILE */
+ }
+ else if (ACE_OS::strncmp (argv[curarg],
+ ACE_TEXT ("-ORB"),
+ 4) == 0)
+ {
+ // Can we assume there is an argument after the option?
+ // ++curarg;
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("Default_Resource_Factory - ")
+ ACE_TEXT ("unknown option <%s>\n"),
+ argv[curarg]));
+ }
+ else
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("Default_Resource_Factory - ")
+ ACE_TEXT ("ignoring option <%s>\n"),
+ argv[curarg]));
+ }
+ }
+
+ return 0;
+}
+
+int
+TAO_Default_Resource_Factory::get_parser_names (char **&names,
+ int &number_of_names)
+{
+ if (this->parser_names_count_ != 0)
+ {
+ // The user used some -ORBIORParser options, just return those.
+ names = this->parser_names_;
+ number_of_names = this->parser_names_count_;
+
+ return 0;
+ }
+
+ // OK fallback on the hardcoded ones....
+ this->parser_names_count_ = 5; // HOW MANY DO WE HAVE?
+ ACE_NEW_RETURN (this->parser_names_,
+ char *[this->parser_names_count_],
+ -1);
+
+ CORBA::ULong index = 0;
+
+ this->parser_names_[index] = CORBA::string_dup ("DLL_Parser");
+ ++index;
+
+ this->parser_names_[index] = CORBA::string_dup ("FILE_Parser");
+ ++index;
+
+ this->parser_names_[index] = CORBA::string_dup ("CORBALOC_Parser");
+ ++index;
+
+ this->parser_names_[index] = CORBA::string_dup ("CORBANAME_Parser");
+ ++index;
+
+ this->parser_names_[index] = CORBA::string_dup ("MCAST_Parser");
+ ++index;
+
+ names = this->parser_names_;
+
+ number_of_names = index;
+
+ return 0;
+}
+
+int
+TAO_Default_Resource_Factory::add_to_ior_parser_names (const char *curarg)
+{
+ this->parser_names_[this->index_] = CORBA::string_dup (curarg);
+
+ ++this->index_;
+
+ return 0;
+}
+
+// This is virtual and protected...
+int
+TAO_Default_Resource_Factory::load_default_protocols (void)
+{
+#if defined (TAO_HAS_IIOP) && (TAO_HAS_IIOP != 0)
+ // If the user did not list any protocols in her svc.conf file
+ // then default to TAO's basic protocols.
+ // You do *NOT* need modify this code to add your own protocol,
+ // instead simply add the following to your svc.conf file:
+ //
+ // dynamic PP_Factory Service_Object * LIB:_make_PP_Protocol_Factory() ""
+ // static Resource_Factory "-ORBProtocolFactory PP_Factory"
+ //
+ // where "PP_Factory" is the name of your protocol, i.e. the
+ // second argument passed to the ACE_STATIC_SVC_DEFINE macro:
+ //
+ // ACE_STATIC_SVC_DEFINE (PP_Protocol_Factory,
+ // ACE_TEXT ("PP_Factory"), ...)
+ //
+ // "PP_Protocol_Factory" is the name of your protocol factory
+ // class. A "_make_" is prepended to your protocol factory
+ // class name by the ACE_FACTORY_DECLARE macro. The resulting
+ // factory function "_make_PP_Protocol_Factory()" is what should
+ // be used in the "dynamic" line in your svc.conf file.
+ //
+ // LIB is the base name of the shared library that implements
+ // the protocol. The directory containing your library must be
+ // in your library search path, typically defined by the
+ // LD_LIBRARY_PATH environment variable on UNIX systems, and/or
+ // the `/etc/ld.so.conf' file on some UNIX systems. Remember to
+ // run "ldconfig" if you modify `/etc/ld.so.conf'.
+
+ if (TAO::details::load_protocol_factory <TAO_IIOP_Protocol_Factory> (
+ this->protocol_factories_, "IIOP_Factory") == -1)
+ return -1;
+#endif /* TAO_HAS_IIOP && TAO_HAS_IIOP != 0 */
+
+ return 0;
+}
+
+int
+TAO_Default_Resource_Factory::init_protocol_factories (void)
+{
+ const TAO_ProtocolFactorySetItor end = protocol_factories_.end ();
+ TAO_ProtocolFactorySetItor factory = protocol_factories_.begin ();
+
+ if (factory == end)
+ {
+ return this->load_default_protocols ();
+ }
+
+ for (; factory != end; ++factory)
+ {
+ const ACE_CString &name = (*factory)->protocol_name ();
+ (*factory)->factory (
+ ACE_Dynamic_Service<TAO_Protocol_Factory>::instance (name.c_str ()));
+ if ((*factory)->factory () == 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) Unable to load ")
+ ACE_TEXT ("protocol <%s>, %p\n"),
+ ACE_TEXT_CHAR_TO_TCHAR(name.c_str ()),
+ ACE_TEXT ("")),
+ -1);
+ }
+
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) Loaded protocol <%s>\n"),
+ ACE_TEXT_CHAR_TO_TCHAR(name.c_str ())));
+ }
+ }
+
+ return 0;
+}
+
+int
+TAO_Default_Resource_Factory::use_locked_data_blocks (void) const
+{
+ return this->use_locked_data_blocks_;
+}
+
+TAO_ProtocolFactorySet *
+TAO_Default_Resource_Factory::get_protocol_factories (void)
+{
+ return &protocol_factories_;
+}
+
+TAO_Acceptor_Registry *
+TAO_Default_Resource_Factory::get_acceptor_registry (void)
+{
+ TAO_Acceptor_Registry *ar = 0;
+
+ ACE_NEW_RETURN(ar,
+ TAO_Acceptor_Registry,
+ 0);
+
+ return ar;
+}
+
+TAO_Connector_Registry *
+TAO_Default_Resource_Factory::get_connector_registry (void)
+{
+ TAO_Connector_Registry *cr = 0;
+
+ ACE_NEW_RETURN(cr,
+ TAO_Connector_Registry,
+ 0);
+
+ return cr;
+}
+
+ACE_Reactor_Impl*
+TAO_Default_Resource_Factory::allocate_reactor_impl (void) const
+{
+ ACE_Reactor_Impl *impl = 0;
+ /*
+ * Hook to specialize TAO's reactor implementation.
+ */
+//@@ TAO_REACTOR_SPL_COMMENT_HOOK_START
+ ACE_NEW_RETURN (impl,
+ ACE_TP_Reactor (ACE::max_handles (),
+ 1,
+ (ACE_Sig_Handler*)0,
+ (ACE_Timer_Queue*)0,
+ this->reactor_mask_signals_,
+ ACE_Select_Reactor_Token::LIFO),
+ 0);
+//@@ TAO_REACTOR_SPL_COMMENT_HOOK_END
+ return impl;
+}
+
+ACE_Reactor *
+TAO_Default_Resource_Factory::get_reactor (void)
+{
+ ACE_Reactor *reactor = 0;
+ ACE_NEW_RETURN (reactor,
+ ACE_Reactor (this->allocate_reactor_impl (), 1),
+ 0);
+
+ if (reactor->initialized () == 0)
+ {
+ delete reactor;
+ reactor = 0;
+ }
+ else
+ this->dynamically_allocated_reactor_ = 1;
+
+ return reactor;
+}
+
+void
+TAO_Default_Resource_Factory::reclaim_reactor (ACE_Reactor *reactor)
+{
+ if (this->dynamically_allocated_reactor_ == 1)
+ delete reactor;
+}
+
+
+typedef ACE_Malloc<ACE_LOCAL_MEMORY_POOL,TAO_SYNCH_MUTEX> LOCKED_MALLOC;
+typedef ACE_Allocator_Adapter<LOCKED_MALLOC> LOCKED_ALLOCATOR_POOL;
+typedef ACE_New_Allocator LOCKED_ALLOCATOR_NO_POOL;
+
+void
+TAO_Default_Resource_Factory::use_local_memory_pool (bool flag)
+{
+ this->use_local_memory_pool_ = flag;
+
+ if (this->output_cdr_allocator_type_ == DEFAULT)
+ this->output_cdr_allocator_type_ = LOCAL_MEMORY_POOL;
+}
+
+ACE_Allocator *
+TAO_Default_Resource_Factory::input_cdr_dblock_allocator (void)
+{
+ ACE_Allocator *allocator = 0;
+ if (use_local_memory_pool_)
+ {
+ ACE_NEW_RETURN (allocator,
+ LOCKED_ALLOCATOR_POOL,
+ 0);
+ }
+ else
+ {
+ ACE_NEW_RETURN (allocator,
+ LOCKED_ALLOCATOR_NO_POOL,
+ 0);
+ }
+
+ return allocator;
+}
+
+ACE_Allocator *
+TAO_Default_Resource_Factory::input_cdr_buffer_allocator (void)
+{
+ ACE_Allocator *allocator = 0;
+ if (use_local_memory_pool_)
+ {
+ ACE_NEW_RETURN (allocator,
+ LOCKED_ALLOCATOR_POOL,
+ 0);
+ }
+ else
+ {
+ ACE_NEW_RETURN (allocator,
+ LOCKED_ALLOCATOR_NO_POOL,
+ 0);
+ }
+
+ return allocator;
+}
+
+ACE_Allocator *
+TAO_Default_Resource_Factory::input_cdr_msgblock_allocator (void)
+{
+ ACE_Allocator *allocator = 0;
+ if (use_local_memory_pool_)
+ {
+ ACE_NEW_RETURN (allocator,
+ LOCKED_ALLOCATOR_POOL,
+ 0);
+ }
+ else
+ {
+ ACE_NEW_RETURN (allocator,
+ LOCKED_ALLOCATOR_NO_POOL,
+ 0);
+ }
+
+ return allocator;
+}
+
+int
+TAO_Default_Resource_Factory::input_cdr_allocator_type_locked (void)
+{
+ return 1;
+}
+
+ACE_Allocator*
+TAO_Default_Resource_Factory::output_cdr_dblock_allocator (void)
+{
+ ACE_Allocator *allocator = 0;
+ if (use_local_memory_pool_)
+ {
+ ACE_NEW_RETURN (allocator,
+ LOCKED_ALLOCATOR_POOL,
+ 0);
+ }
+ else
+ {
+ ACE_NEW_RETURN (allocator,
+ LOCKED_ALLOCATOR_NO_POOL,
+ 0);
+ }
+
+ return allocator;
+}
+
+ACE_Allocator *
+TAO_Default_Resource_Factory::output_cdr_buffer_allocator (void)
+{
+ ACE_Allocator *allocator = 0;
+
+ switch (this->output_cdr_allocator_type_)
+ {
+ case LOCAL_MEMORY_POOL:
+ ACE_NEW_RETURN (allocator,
+ LOCKED_ALLOCATOR_POOL,
+ 0);
+
+ break;
+
+#ifdef ACE_HAS_SENDFILE
+ case MMAP_ALLOCATOR:
+ ACE_NEW_RETURN (allocator,
+ TAO_MMAP_Allocator,
+ 0);
+
+ break;
+#endif /* ACE_HAS_SENDFILE */
+
+ case DEFAULT:
+ default:
+ ACE_NEW_RETURN (allocator,
+ LOCKED_ALLOCATOR_NO_POOL,
+ 0);
+
+ break;
+ }
+
+ return allocator;
+}
+
+ACE_Allocator*
+TAO_Default_Resource_Factory::output_cdr_msgblock_allocator (void)
+{
+ ACE_Allocator *allocator = 0;
+ if (use_local_memory_pool_)
+ {
+ ACE_NEW_RETURN (allocator,
+ LOCKED_ALLOCATOR_POOL,
+ 0);
+ }
+ else
+ {
+ ACE_NEW_RETURN (allocator,
+ LOCKED_ALLOCATOR_NO_POOL,
+ 0);
+ }
+
+ return allocator;
+}
+
+ACE_Allocator*
+TAO_Default_Resource_Factory::amh_response_handler_allocator (void)
+{
+ ACE_Allocator *allocator = 0;
+ if (use_local_memory_pool_)
+ {
+ ACE_NEW_RETURN (allocator,
+ LOCKED_ALLOCATOR_POOL,
+ 0);
+ }
+ else
+ {
+ ACE_NEW_RETURN (allocator,
+ LOCKED_ALLOCATOR_NO_POOL,
+ 0);
+ }
+
+ return allocator;
+}
+
+ACE_Allocator*
+TAO_Default_Resource_Factory::ami_response_handler_allocator (void)
+{
+ ACE_Allocator *allocator = 0;
+ if (use_local_memory_pool_)
+ {
+ ACE_NEW_RETURN (allocator,
+ LOCKED_ALLOCATOR_POOL,
+ 0);
+ }
+ else
+ {
+ ACE_NEW_RETURN (allocator,
+ LOCKED_ALLOCATOR_NO_POOL,
+ 0);
+ }
+
+ return allocator;
+}
+
+int
+TAO_Default_Resource_Factory::cache_maximum (void) const
+{
+ return this->cache_maximum_;
+}
+
+int
+TAO_Default_Resource_Factory::purge_percentage (void) const
+{
+ return this->purge_percentage_;
+}
+
+int
+TAO_Default_Resource_Factory::max_muxed_connections (void) const
+{
+ return this->max_muxed_connections_;
+}
+
+
+ACE_Lock *
+TAO_Default_Resource_Factory::create_cached_connection_lock (void)
+{
+ ACE_Lock *the_lock = 0;
+
+ if (this->cached_connection_lock_type_ == TAO_NULL_LOCK)
+ ACE_NEW_RETURN (the_lock,
+ ACE_Lock_Adapter<ACE_SYNCH_NULL_MUTEX>,
+ 0);
+ else
+ ACE_NEW_RETURN (the_lock,
+ ACE_Lock_Adapter<TAO_SYNCH_MUTEX>,
+ 0);
+
+ return the_lock;
+}
+
+int
+TAO_Default_Resource_Factory::locked_transport_cache (void)
+{
+ if (this->cached_connection_lock_type_ == TAO_NULL_LOCK)
+ return 0;
+
+ return 1;
+}
+
+
+ACE_Lock *
+TAO_Default_Resource_Factory::create_object_key_table_lock (void)
+{
+ ACE_Lock *the_lock = 0;
+
+ if (this->object_key_table_lock_type_ == TAO_NULL_LOCK)
+ ACE_NEW_RETURN (the_lock,
+ ACE_Lock_Adapter<ACE_SYNCH_NULL_MUTEX>,
+ 0);
+ else
+ ACE_NEW_RETURN (the_lock,
+ ACE_Lock_Adapter<TAO_SYNCH_MUTEX>,
+ 0);
+
+ return the_lock;
+}
+
+ACE_Lock *
+TAO_Default_Resource_Factory::create_corba_object_lock (void)
+{
+ ACE_Lock *the_lock = 0;
+
+ if (this->corba_object_lock_type_ == TAO_NULL_LOCK)
+ ACE_NEW_RETURN (the_lock,
+ ACE_Lock_Adapter<ACE_SYNCH_NULL_MUTEX>,
+ 0);
+ else
+ ACE_NEW_RETURN (the_lock,
+ ACE_Lock_Adapter<TAO_SYNCH_MUTEX>,
+ 0);
+
+ return the_lock;
+}
+
+TAO_Configurable_Refcount
+TAO_Default_Resource_Factory::create_corba_object_refcount (void)
+{
+ switch (this->corba_object_lock_type_)
+ {
+ case TAO_NULL_LOCK:
+ return TAO_Configurable_Refcount (
+ TAO_Configurable_Refcount::TAO_NULL_LOCK);
+ case TAO_THREAD_LOCK:
+ default:
+ return TAO_Configurable_Refcount (
+ TAO_Configurable_Refcount::TAO_THREAD_LOCK);
+ }
+}
+
+TAO_Flushing_Strategy *
+TAO_Default_Resource_Factory::create_flushing_strategy (void)
+{
+ TAO_Flushing_Strategy *strategy = 0;
+ if (this->flushing_strategy_type_ == TAO_LEADER_FOLLOWER_FLUSHING)
+ ACE_NEW_RETURN (strategy,
+ TAO_Leader_Follower_Flushing_Strategy,
+ 0);
+ else if (this->flushing_strategy_type_ == TAO_REACTIVE_FLUSHING)
+ ACE_NEW_RETURN (strategy,
+ TAO_Reactive_Flushing_Strategy,
+ 0);
+ else
+ ACE_NEW_RETURN (strategy,
+ TAO_Block_Flushing_Strategy,
+ 0);
+ return strategy;
+}
+
+TAO_Connection_Purging_Strategy *
+TAO_Default_Resource_Factory::create_purging_strategy (void)
+{
+ TAO_Connection_Purging_Strategy *strategy = 0;
+
+ if (this->connection_purging_type_ == TAO_Resource_Factory::LRU)
+ {
+ ACE_NEW_RETURN (strategy,
+ TAO_LRU_Connection_Purging_Strategy (
+ this->cache_maximum ()),
+ 0);
+ }
+ else
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) - ")
+ ACE_TEXT ("no usable purging strategy ")
+ ACE_TEXT ("was found.\n")));
+ }
+
+ return strategy;
+}
+
+TAO_LF_Strategy *
+TAO_Default_Resource_Factory::create_lf_strategy (void)
+{
+ TAO_LF_Strategy *strategy = 0;
+
+ ACE_NEW_RETURN (strategy,
+ TAO_LF_Strategy_Complete,
+ 0);
+
+ return strategy;
+}
+
+auto_ptr<TAO_GIOP_Fragmentation_Strategy>
+TAO_Default_Resource_Factory::create_fragmentation_strategy (
+ TAO_Transport * transport,
+ CORBA::ULong max_message_size) const
+{
+ auto_ptr<TAO_GIOP_Fragmentation_Strategy> strategy (0);
+
+ TAO_GIOP_Fragmentation_Strategy * tmp = 0;
+
+ // Minimum GIOP message size is 24 (a multiple of 8):
+ // 12 GIOP Message Header
+ // 4 GIOP Fragment Header (request ID)
+ // + 8 Smallest payload, including padding.
+ // ---
+ // 24
+ static CORBA::ULong const min_message_size = 24;
+
+ // GIOP fragments are supported in GIOP 1.1 and better, but TAO only
+ // supports them in 1.2 or better since GIOP 1.1 fragments do not
+ // have a fragment message header.
+
+
+ if (transport) // No transport. Cannot fragment.
+ {
+ if (max_message_size < min_message_size
+ || (TAO_DEF_GIOP_MAJOR == 1 && TAO_DEF_GIOP_MINOR < 2))
+ {
+ // No maximum was set by the user.
+ ACE_NEW_RETURN (tmp,
+ TAO_Null_Fragmentation_Strategy,
+ strategy);
+
+ }
+ else
+ {
+ ACE_NEW_RETURN (tmp,
+ TAO_On_Demand_Fragmentation_Strategy (
+ transport,
+ max_message_size),
+ strategy);
+ }
+ }
+
+ ACE_AUTO_PTR_RESET (strategy,
+ tmp,
+ TAO_GIOP_Fragmentation_Strategy);
+
+ return strategy;
+}
+
+void
+TAO_Default_Resource_Factory::report_option_value_error (
+ const ACE_TCHAR* option_name,
+ const ACE_TCHAR* option_value)
+{
+ ACE_DEBUG((LM_DEBUG,
+ ACE_TEXT ("Default_Resource_Factory - unknown argument")
+ ACE_TEXT (" <%s> for <%s>\n"),
+ option_value, option_name));
+}
+
+void
+TAO_Default_Resource_Factory::disable_factory (void)
+{
+ this->factory_disabled_ = 1;
+ if (this->options_processed_)
+ {
+ ACE_DEBUG ((LM_WARNING,
+ ACE_TEXT ("TAO (%P|%t) Warning: Resource_Factory options ignored\n")
+ ACE_TEXT ("Default Resource Factory is disabled\n")));
+ }
+}
+
+TAO_Codeset_Manager *
+TAO_Default_Resource_Factory::codeset_manager(void)
+{
+ if (this->codeset_manager_)
+ return this->codeset_manager_;
+
+ TAO_Codeset_Manager_Factory_Base *factory =
+ ACE_Dynamic_Service<TAO_Codeset_Manager_Factory_Base>::instance ("TAO_Codeset");
+ this->codeset_manager_ = factory->create ();
+
+ return this->codeset_manager_;
+}
+
+void
+TAO_Default_Resource_Factory::init_codeset_descriptors(void)
+{
+ if (this->char_codeset_descriptor_)
+ return;
+ if (this->codeset_manager() == 0)
+ return;
+
+ this->char_codeset_descriptor_ =
+ this->codeset_manager_->char_codeset_descriptor();
+ this->wchar_codeset_descriptor_ =
+ this->codeset_manager_->wchar_codeset_descriptor();
+}
+
+TAO_Resource_Factory::Resource_Usage
+TAO_Default_Resource_Factory::resource_usage_strategy (void) const
+{
+ return this->resource_usage_strategy_;
+}
+
+bool
+TAO_Default_Resource_Factory::drop_replies_during_shutdown (void) const
+{
+ return this->drop_replies_;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+// ****************************************************************
+
+ACE_STATIC_SVC_DEFINE (TAO_Default_Resource_Factory,
+ ACE_TEXT ("Resource_Factory"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (TAO_Default_Resource_Factory),
+ ACE_Service_Type::DELETE_THIS
+ | ACE_Service_Type::DELETE_OBJ,
+ 0)
+ACE_FACTORY_DEFINE (TAO, TAO_Default_Resource_Factory)
diff --git a/TAO/tao/default_resource.h b/TAO/tao/default_resource.h
new file mode 100644
index 00000000000..924364b681c
--- /dev/null
+++ b/TAO/tao/default_resource.h
@@ -0,0 +1,288 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file default_resource.h
+ *
+ * $Id$
+ *
+ * @author Chris Cleeland
+ * @author Carlos O'Ryan
+ */
+//=============================================================================
+
+
+#ifndef TAO_DEFAULT_RESOURCE_H
+#define TAO_DEFAULT_RESOURCE_H
+
+#include /**/ "ace/pre.h"
+#include "ace/Service_Config.h"
+#include "ace/Dynamic_Service_Dependency.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Resource_Factory.h"
+
+ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+class ACE_Reactor_Impl;
+ACE_END_VERSIONED_NAMESPACE_DECL
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+class TAO_Object_Adapter;
+class TAO_IOR_Parser;
+class TAO_LF_Strategy;
+class TAO_Codeset_Descriptor_Base;
+
+/**
+ * @class TAO_Default_Resource_Factory
+ *
+ * @brief TAO's default resource factory
+ *
+ * Using a <{resource source specifier}> as a discriminator, the
+ * factory can return resource instances which are, e.g., global,
+ * stored in thread-specific storage, stored in shared memory,
+ * etc.
+ *
+ * @note When using an ORB created by a dynamically loaded object, it
+ * is generally necessary to pre-load a "Resource_Factory" prior
+ * to initializing the ORB. In the case of the
+ * TAO_Default_Resource_Factory, this can be done by adding the
+ * following Service Configurator directive to your `svc.conf'
+ * file before your the directive that loads the object that
+ * initialized your ORB:
+ * @par
+ * static Resource_Factory ""
+ * @par
+ * Alternatively, explicitly pre-load the Resource_Factory using
+ * the following in your code:
+ * @par
+ * ACE_Service_Config::process_directive (
+ * ACE_TEXT ("static Resource_Factory \"\"") );
+ * @par
+ * In both cases, place the appropriate resource factory
+ * arguments, if any, between the quotes immediately following
+ * "Resource_Factory."
+ */
+class TAO_Export TAO_Default_Resource_Factory
+ : public TAO_Resource_Factory
+{
+public:
+
+ /// Constructor.
+ TAO_Default_Resource_Factory (void);
+
+ /// Destructor.
+ virtual ~TAO_Default_Resource_Factory (void);
+
+ /**
+ * @name Service Configurator Hooks
+ */
+ //@{
+ /// Dynamic linking hook
+ virtual int init (int argc, ACE_TCHAR *argv[]);
+
+ /// Parse svc.conf arguments
+ int parse_args (int argc, ACE_TCHAR* argv[]);
+ //@}
+
+ /**
+ * @name Member Accessors
+ */
+ //@{
+
+ int get_parser_names (char **&names,
+ int &number_of_names);
+ enum
+ {
+ TAO_ALLOCATOR_THREAD_LOCK
+ };
+
+ /// Modify and get the source for the CDR allocators
+ int cdr_allocator_source (void);
+
+ // = Resource Retrieval
+ virtual int use_locked_data_blocks (void) const;
+ virtual ACE_Reactor *get_reactor (void);
+ virtual void reclaim_reactor (ACE_Reactor *);
+ virtual TAO_Acceptor_Registry *get_acceptor_registry (void);
+ virtual TAO_Connector_Registry *get_connector_registry (void);
+ virtual void use_local_memory_pool (bool);
+ virtual ACE_Allocator* input_cdr_dblock_allocator (void);
+ virtual ACE_Allocator* input_cdr_buffer_allocator (void);
+ virtual ACE_Allocator* input_cdr_msgblock_allocator (void);
+ virtual int input_cdr_allocator_type_locked (void);
+ virtual ACE_Allocator* output_cdr_dblock_allocator (void);
+ virtual ACE_Allocator* output_cdr_buffer_allocator (void);
+ virtual ACE_Allocator* output_cdr_msgblock_allocator (void);
+ virtual ACE_Allocator* amh_response_handler_allocator (void);
+ virtual ACE_Allocator* ami_response_handler_allocator (void);
+ virtual TAO_ProtocolFactorySet *get_protocol_factories (void);
+
+ virtual int init_protocol_factories (void);
+
+ virtual TAO_Codeset_Manager * codeset_manager (void);
+
+ virtual int cache_maximum (void) const;
+ virtual int purge_percentage (void) const;
+ virtual int max_muxed_connections (void) const;
+ virtual ACE_Lock *create_cached_connection_lock (void);
+ virtual ACE_Lock *create_object_key_table_lock (void);
+ virtual TAO_Configurable_Refcount create_corba_object_refcount (void);
+ virtual ACE_Lock *create_corba_object_lock (void);
+ virtual int locked_transport_cache (void);
+ virtual TAO_Flushing_Strategy *create_flushing_strategy (void);
+ virtual TAO_Connection_Purging_Strategy *create_purging_strategy (void);
+ TAO_Resource_Factory::Resource_Usage resource_usage_strategy (void) const;
+ virtual TAO_LF_Strategy *create_lf_strategy (void);
+ virtual auto_ptr<TAO_GIOP_Fragmentation_Strategy>
+ create_fragmentation_strategy (TAO_Transport * transport,
+ CORBA::ULong max_message_size) const;
+ virtual void disable_factory (void);
+ virtual bool drop_replies_during_shutdown (void) const;
+ //@}
+
+protected:
+
+ /// Obtain the reactor implementation
+ virtual ACE_Reactor_Impl *allocate_reactor_impl (void) const;
+
+ /// Add a Parser name to the list of Parser names.
+ int add_to_ior_parser_names (const char *);
+
+ void report_option_value_error (const ACE_TCHAR* option_name,
+ const ACE_TCHAR* option_value);
+
+protected:
+
+ /// The type of data blocks that the ORB should use
+ int use_locked_data_blocks_;
+
+ /// The number of the different types of Parsers.
+ int parser_names_count_;
+
+ /// Array consisting of the names of the parsers
+ char **parser_names_;
+
+ /// Index of the current element in the parser_names_ array
+ int index_;
+
+ /// list of loaded protocol factories.
+ TAO_ProtocolFactorySet protocol_factories_;
+
+ /// Specifies the typeof purging strategy we should use for cleaning
+ /// up unused connections
+ TAO_Resource_Factory::Purging_Strategy connection_purging_type_;
+
+ /// Specifies the maximum number of connections which should get cached
+ /// in the ORB.
+ int cache_maximum_;
+
+ /// Specifies the percentage of entries which should get purged on
+ /// demand.
+ int purge_percentage_;
+
+ /// Specifies the limit on the number of muxed connections
+ /// allowed per-property for the ORB. A value of 0 indicates no
+ /// limit
+ int max_muxed_connections_;
+
+ /// If <0> then we create reactors with signal handling disabled.
+ int reactor_mask_signals_;
+
+ /**
+ * Flag that is set to 1 if the reactor obtained from the
+ * get_reactor() method is dynamically allocated. If this flag is
+ * set to 1, then the reclaim_reactor() method with call the delete
+ * operator on the given reactor. This flag is necessary to make
+ * sure that a reactor not allocated by the default resource factory
+ * is not reclaimed by the default resource factory. Such a
+ * situation can occur when a resource factory derived from the
+ * default one overrides the get_reactor() method but does not
+ * override the reclaim_reactor() method.
+ */
+ int dynamically_allocated_reactor_;
+
+ virtual int load_default_protocols (void);
+
+ /// This flag is used to determine whether options have been
+ /// processed via the init() function. It is necessary to
+ /// properly report errors when the default factory is replaced.
+ int options_processed_;
+
+ /// This flag specifies whether the factory has been disabled.
+ /// If it has been disabled we should print warnings if options
+ /// were processed before (or later).
+ int factory_disabled_;
+
+ enum Output_CDR_Allocator_Type
+ {
+ LOCAL_MEMORY_POOL,
+#ifdef ACE_HAS_SENDFILE
+ MMAP_ALLOCATOR,
+#endif /* ACE_HAS_SENDFILE */
+ DEFAULT
+ };
+
+ /// Type of allocator to use for output CDR buffers.
+ Output_CDR_Allocator_Type output_cdr_allocator_type_;
+
+ /// This flag is used to determine whether the CDR allocators
+ /// should use the local memory pool or not.
+ bool use_local_memory_pool_;
+
+private:
+ void init_codeset_descriptors (void);
+
+ enum Lock_Type
+ {
+ TAO_NULL_LOCK,
+ TAO_THREAD_LOCK
+ };
+
+ /// Type of lock used by the cached connector.
+ Lock_Type cached_connection_lock_type_;
+
+ /// Type of lock used by the corba object.
+ Lock_Type object_key_table_lock_type_;
+
+ /// Type of lock used by the corba object.
+ Lock_Type corba_object_lock_type_;
+
+ enum Flushing_Strategy_Type
+ {
+ TAO_LEADER_FOLLOWER_FLUSHING,
+ TAO_REACTIVE_FLUSHING,
+ TAO_BLOCKING_FLUSHING
+ };
+
+ /// Type of flushing strategy configured
+ Flushing_Strategy_Type flushing_strategy_type_;
+
+ TAO_Codeset_Manager *codeset_manager_;
+ TAO_Codeset_Descriptor_Base *char_codeset_descriptor_;
+ TAO_Codeset_Descriptor_Base * wchar_codeset_descriptor_;
+
+ /// Resource usage strategy
+ Resource_Usage resource_usage_strategy_;
+
+ /// Flag to indicate whether replies should be dropped during ORB
+ /// shutdown.
+ bool drop_replies_;
+
+ // Makes a dependency on a specific dynamic service ("TAO_Codeset") explicit.
+ // It helps to keep the corresponding DLL around until the last instance
+ // is destroyed. Note that failure to delete the instances will "pin" the
+ // DLL in memory, preventing it from being unloaded on demand.
+ ACE_Dynamic_Service_Dependency *principal_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE_EXPORT (TAO, TAO_Default_Resource_Factory)
+ACE_FACTORY_DECLARE (TAO, TAO_Default_Resource_Factory)
+
+#include /**/ "ace/post.h"
+#endif /* TAO_DEFAULT_CLIENT_H */
diff --git a/TAO/tao/default_server.cpp b/TAO/tao/default_server.cpp
new file mode 100644
index 00000000000..3ebc4dadc7f
--- /dev/null
+++ b/TAO/tao/default_server.cpp
@@ -0,0 +1,393 @@
+// $Id$
+
+#include "tao/default_server.h"
+#include "ace/Log_Msg.h"
+#include "ace/OS_NS_strings.h"
+#include "ace/OS_NS_string.h"
+
+ACE_RCSID (tao,
+ default_server,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_Default_Server_Strategy_Factory::TAO_Default_Server_Strategy_Factory (void)
+ : activate_server_connections_ (0),
+ thread_flags_ (THR_BOUND | THR_DETACHED),
+ poa_lock_type_ (TAO_THREAD_LOCK),
+ thread_per_connection_use_timeout_ (-1)
+{
+}
+
+TAO_Default_Server_Strategy_Factory::~TAO_Default_Server_Strategy_Factory (void)
+{
+ // Perform appropriate cleanup.
+}
+
+int
+TAO_Default_Server_Strategy_Factory::enable_poa_locking (void)
+{
+ switch (this->poa_lock_type_)
+ {
+ case TAO_NULL_LOCK:
+ return 0;
+ case TAO_THREAD_LOCK:
+ default:
+ return 1;
+ }
+}
+
+int
+TAO_Default_Server_Strategy_Factory::activate_server_connections (void)
+{
+ return this->activate_server_connections_;
+}
+
+int
+TAO_Default_Server_Strategy_Factory::thread_per_connection_timeout (ACE_Time_Value &timeout)
+{
+ timeout = this->thread_per_connection_timeout_;
+ return this->thread_per_connection_use_timeout_;
+}
+
+int
+TAO_Default_Server_Strategy_Factory::server_connection_thread_flags (void)
+{
+ return this->thread_flags_;
+}
+
+int
+TAO_Default_Server_Strategy_Factory::server_connection_thread_count (void)
+{
+ return 1;
+}
+
+// Evil macros b/c I'm lazy!
+#define TAO_BEGINCHECK if (0)
+#define TAO_CHECKANDSET(sym) \
+ else if (ACE_OS::strcmp (const_cast <const ACE_TCHAR *> ( flag), ACE_TEXT(#sym)) == 0) \
+ ACE_SET_BITS (this->thread_flags_, sym)
+#define TAO_ENDCHECK
+
+void
+TAO_Default_Server_Strategy_Factory::tokenize (ACE_TCHAR* flag_string)
+{
+ ACE_TCHAR* lasts = 0;
+
+ for (ACE_TCHAR* flag = ACE_OS::strtok_r (flag_string,
+ ACE_TEXT("|"),
+ &lasts);
+ flag != 0;
+ flag = ACE_OS::strtok_r (0,
+ ACE_TEXT("|"),
+ &lasts))
+ {
+ TAO_BEGINCHECK;
+ TAO_CHECKANDSET (THR_DETACHED);
+ TAO_CHECKANDSET (THR_BOUND);
+ TAO_CHECKANDSET (THR_NEW_LWP);
+ TAO_CHECKANDSET (THR_SUSPENDED);
+#if !defined (ACE_WIN32)
+ TAO_CHECKANDSET (THR_DAEMON);
+#endif /* ACE_WIN32 */
+ TAO_ENDCHECK;
+ }
+}
+
+int
+TAO_Default_Server_Strategy_Factory::init (int argc, ACE_TCHAR* argv[])
+{
+ return this->parse_args (argc, argv);
+}
+
+int
+TAO_Default_Server_Strategy_Factory::open (TAO_ORB_Core *)
+{
+ return 0;
+}
+
+int
+TAO_Default_Server_Strategy_Factory::parse_args (int argc, ACE_TCHAR* argv[])
+{
+ ACE_TRACE ("TAO_Default_Server_Strategy_Factory::parse_args");
+
+ int curarg;
+
+ for (curarg = 0; curarg < argc && argv[curarg]; ++curarg)
+ if (ACE_OS::strcasecmp (argv[curarg],
+ ACE_TEXT("-ORBConcurrency")) == 0)
+ {
+ ++curarg;
+ if (curarg < argc)
+ {
+ ACE_TCHAR* name = argv[curarg];
+
+ if (ACE_OS::strcasecmp (name,
+ ACE_TEXT("reactive")) == 0)
+ this->activate_server_connections_ = 0;
+ else if (ACE_OS::strcasecmp (name,
+ ACE_TEXT("thread-per-connection")) == 0)
+ this->activate_server_connections_ = 1;
+ else
+ this->report_option_value_error (ACE_TEXT("-ORBConcurrency"), name);
+ }
+ }
+
+ else if (ACE_OS::strcasecmp (argv[curarg],
+ ACE_TEXT("-ORBThreadPerConnectionTimeout")) == 0)
+ {
+ ++curarg;
+ if (curarg < argc)
+ {
+ ACE_TCHAR* name = argv[curarg];
+
+ if (ACE_OS::strcasecmp (name,
+ ACE_TEXT("infinite")) == 0)
+ {
+ this->thread_per_connection_use_timeout_ = 0;
+ }
+ else
+ {
+ this->thread_per_connection_use_timeout_ = 1;
+ int milliseconds = ACE_OS::atoi (name);
+ this->thread_per_connection_timeout_.set (0,
+ 1000 * milliseconds);
+ }
+ }
+ }
+
+ else if (ACE_OS::strcasecmp (argv[curarg],
+ ACE_TEXT("-ORBTableSize")) == 0
+ || ACE_OS::strcasecmp (argv[curarg],
+ ACE_TEXT("-ORBActiveObjectMapSize")) == 0)
+ {
+ ++curarg;
+ if (curarg < argc)
+ this->active_object_map_creation_parameters_.active_object_map_size_ =
+ ACE_OS::strtoul (argv[curarg],
+ 0,
+ 10);
+ }
+ else if (ACE_OS::strcasecmp (argv[curarg],
+ ACE_TEXT("-ORBPOAMapSize")) == 0)
+ {
+ ++curarg;
+ if (curarg < argc)
+ this->active_object_map_creation_parameters_.poa_map_size_ =
+ ACE_OS::strtoul (argv[curarg],
+ 0,
+ 10);
+ }
+ else if (ACE_OS::strcasecmp (argv[curarg],
+ ACE_TEXT("-ORBActiveHintInIds")) == 0)
+ {
+ ++curarg;
+ if (curarg < argc)
+ {
+ ACE_TCHAR* value = argv[curarg];
+
+ this->active_object_map_creation_parameters_.use_active_hint_in_ids_ =
+ ACE_OS::atoi (value);
+ }
+ }
+ else if (ACE_OS::strcasecmp (argv[curarg],
+ ACE_TEXT("-ORBActiveHintInPOANames")) == 0)
+ {
+ ++curarg;
+ if (curarg < argc)
+ {
+ ACE_TCHAR* value = argv[curarg];
+
+ this->active_object_map_creation_parameters_.use_active_hint_in_poa_names_ =
+ ACE_OS::atoi (value);
+ }
+ }
+ else if (ACE_OS::strcasecmp (argv[curarg],
+ ACE_TEXT("-ORBAllowReactivationOfSystemids")) == 0)
+ {
+ ++curarg;
+ if (curarg < argc)
+ {
+ ACE_TCHAR* value = argv[curarg];
+
+ this->active_object_map_creation_parameters_.allow_reactivation_of_system_ids_ =
+ ACE_OS::atoi (value);
+ }
+ }
+ else if (ACE_OS::strcasecmp (argv[curarg],
+ ACE_TEXT("-ORBUseridPolicyDemuxStrategy")) == 0)
+ {
+ ++curarg;
+ if (curarg < argc)
+ {
+ ACE_TCHAR* name = argv[curarg];
+
+ // Active demux not supported with user id policy.
+ if (ACE_OS::strcasecmp (name,
+ ACE_TEXT("dynamic")) == 0)
+ this->active_object_map_creation_parameters_.object_lookup_strategy_for_user_id_policy_ =
+ TAO_DYNAMIC_HASH;
+ else if (ACE_OS::strcasecmp (name,
+ ACE_TEXT("linear")) == 0)
+ this->active_object_map_creation_parameters_.object_lookup_strategy_for_user_id_policy_ =
+ TAO_LINEAR;
+ else
+ this->report_option_value_error (ACE_TEXT("-ORBUseridPolicyDemuxStrategy"), name);
+ }
+ }
+ else if (ACE_OS::strcasecmp (argv[curarg],
+ ACE_TEXT("-ORBSystemidPolicyDemuxStrategy")) == 0)
+ {
+ ++curarg;
+ if (curarg < argc)
+ {
+ ACE_TCHAR* name = argv[curarg];
+
+ if (ACE_OS::strcasecmp (name,
+ ACE_TEXT("dynamic")) == 0)
+ this->active_object_map_creation_parameters_.object_lookup_strategy_for_system_id_policy_ =
+ TAO_DYNAMIC_HASH;
+ else if (ACE_OS::strcasecmp (name,
+ ACE_TEXT("linear")) == 0)
+ this->active_object_map_creation_parameters_.object_lookup_strategy_for_system_id_policy_ =
+ TAO_LINEAR;
+ else if (ACE_OS::strcasecmp (name,
+ ACE_TEXT("active")) == 0)
+ this->active_object_map_creation_parameters_.object_lookup_strategy_for_system_id_policy_ =
+ TAO_ACTIVE_DEMUX;
+ else
+ this->report_option_value_error (ACE_TEXT("-ORBSystemidPolicyDemuxStrategy"), name);
+ }
+ }
+ else if (ACE_OS::strcasecmp (argv[curarg],
+ ACE_TEXT("-ORBPersistentidPolicyDemuxStrategy")) == 0)
+ {
+ ++curarg;
+ if (curarg < argc)
+ {
+ ACE_TCHAR* name = argv[curarg];
+
+ // Active demux not supported with user id policy.
+ if (ACE_OS::strcasecmp (name,
+ ACE_TEXT("dynamic")) == 0)
+ this->active_object_map_creation_parameters_.poa_lookup_strategy_for_persistent_id_policy_ =
+ TAO_DYNAMIC_HASH;
+ else if (ACE_OS::strcasecmp (name,
+ ACE_TEXT("linear")) == 0)
+ this->active_object_map_creation_parameters_.poa_lookup_strategy_for_persistent_id_policy_ =
+ TAO_LINEAR;
+ else
+ this->report_option_value_error (ACE_TEXT("-ORBPersistentidPolicyDemuxStrategy"), name);
+ }
+ }
+ else if (ACE_OS::strcasecmp (argv[curarg],
+ ACE_TEXT("-ORBTransientidPolicyDemuxStrategy")) == 0)
+ {
+ ++curarg;
+ if (curarg < argc)
+ {
+ ACE_TCHAR* name = argv[curarg];
+
+ if (ACE_OS::strcasecmp (name,
+ ACE_TEXT("dynamic")) == 0)
+ this->active_object_map_creation_parameters_.poa_lookup_strategy_for_transient_id_policy_ =
+ TAO_DYNAMIC_HASH;
+ else if (ACE_OS::strcasecmp (name,
+ ACE_TEXT("linear")) == 0)
+ this->active_object_map_creation_parameters_.poa_lookup_strategy_for_transient_id_policy_ =
+ TAO_LINEAR;
+ else if (ACE_OS::strcasecmp (name,
+ ACE_TEXT("active")) == 0)
+ this->active_object_map_creation_parameters_.poa_lookup_strategy_for_transient_id_policy_ =
+ TAO_ACTIVE_DEMUX;
+ else
+ this->report_option_value_error (ACE_TEXT("-ORBTransientidPolicyDemuxStrategy"), name);
+ }
+ }
+ else if (ACE_OS::strcasecmp (argv[curarg],
+ ACE_TEXT("-ORBUniqueidPolicyReverseDemuxStrategy")) == 0)
+ {
+ ++curarg;
+ if (curarg < argc)
+ {
+ ACE_TCHAR* name = argv[curarg];
+
+ if (ACE_OS::strcasecmp (name,
+ ACE_TEXT("dynamic")) == 0)
+ this->active_object_map_creation_parameters_.reverse_object_lookup_strategy_for_unique_id_policy_ =
+ TAO_DYNAMIC_HASH;
+ else if (ACE_OS::strcasecmp (name,
+ ACE_TEXT("linear")) == 0)
+ this->active_object_map_creation_parameters_.reverse_object_lookup_strategy_for_unique_id_policy_ =
+ TAO_LINEAR;
+ else
+ this->report_option_value_error (ACE_TEXT("-ORBUniqueidPolicyReverseDemuxStrategy"), name);
+ }
+ }
+ else if (ACE_OS::strcasecmp (argv[curarg],
+ ACE_TEXT("-ORBPOALock")) == 0)
+ {
+ ++curarg;
+ if (curarg < argc)
+ {
+ ACE_TCHAR* name = argv[curarg];
+
+ if (ACE_OS::strcasecmp (name,
+ ACE_TEXT("thread")) == 0)
+ this->poa_lock_type_ = TAO_THREAD_LOCK;
+ else if (ACE_OS::strcasecmp (name,
+ ACE_TEXT("null")) == 0)
+ this->poa_lock_type_ = TAO_NULL_LOCK;
+ else
+ this->report_option_value_error (ACE_TEXT("-ORBPOALock"), name);
+ }
+ }
+ else if (ACE_OS::strcasecmp (argv[curarg],
+ ACE_TEXT("-ORBThreadFlags")) == 0)
+ {
+ ++curarg;
+
+ if (curarg < argc)
+ this->tokenize (argv[curarg]);
+ }
+
+ else if (ACE_OS::strncmp (argv[curarg], ACE_TEXT("-ORB"), 4) == 0)
+ {
+ // Can we assume there is an argument after the option?
+ // ++curarg;
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT("Server_Strategy_Factory - ")
+ ACE_TEXT("unknown option <%s>\n"),
+ argv[curarg]));
+ }
+ else
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT("Server_Strategy_Factory - ")
+ ACE_TEXT("ignoring option <%s>\n"),
+ argv[curarg]));
+ }
+
+ return 0;
+}
+
+void
+TAO_Default_Server_Strategy_Factory::report_option_value_error (
+ const ACE_TCHAR* option_name,
+ const ACE_TCHAR* option_value)
+{
+ ACE_DEBUG((LM_DEBUG,
+ ACE_TEXT ("Server_Strategy_Factory - unknown argument")
+ ACE_TEXT (" <%s> for <%s>\n"),
+ option_value, option_name));
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DEFINE (TAO_Default_Server_Strategy_Factory,
+ ACE_TEXT ("Server_Strategy_Factory"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (TAO_Default_Server_Strategy_Factory),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0)
+ACE_FACTORY_DEFINE (TAO, TAO_Default_Server_Strategy_Factory)
diff --git a/TAO/tao/default_server.h b/TAO/tao/default_server.h
new file mode 100644
index 00000000000..e346b7eaca2
--- /dev/null
+++ b/TAO/tao/default_server.h
@@ -0,0 +1,95 @@
+// This may look like C, but it's really -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file default_server.h
+ *
+ * $Id$
+ *
+ * @author Chris Cleeland
+ */
+//=============================================================================
+
+
+#ifndef TAO_DEFAULT_SERVER_FACTORY_H
+#define TAO_DEFAULT_SERVER_FACTORY_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/Server_Strategy_Factory.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/Service_Config.h"
+#include "ace/Time_Value.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_Default_Server_Strategy_Factory
+ *
+ * @brief This is the default strategy factory for CORBA servers. It
+ * allows developers to choose strategies via argument flags.
+ * This design gives substantial freedom for experimentation.
+ *
+ */
+class TAO_Export TAO_Default_Server_Strategy_Factory
+ : public TAO_Server_Strategy_Factory
+{
+public:
+ // = Initialization and termination methods.
+ TAO_Default_Server_Strategy_Factory (void);
+ virtual ~TAO_Default_Server_Strategy_Factory (void);
+
+ // = Service Configurator hooks.
+ virtual int init (int argc, ACE_TCHAR* argv[]);
+
+ // = The TAO_Server_Strategy_Factory methods, please read the
+ // documentation in "tao/Server_Strategy_Factory.h"
+ virtual int open (TAO_ORB_Core*);
+ virtual int enable_poa_locking (void);
+ virtual int activate_server_connections (void);
+ virtual int thread_per_connection_timeout (ACE_Time_Value &timeout);
+ virtual int server_connection_thread_flags (void);
+ virtual int server_connection_thread_count (void);
+
+ /// Parse the arguments, check the documentation in
+ /// $TAO_ROOT/docs/Options.html for details
+ int parse_args (int argc, ACE_TCHAR* argv[]);
+
+protected:
+ void tokenize (ACE_TCHAR* flag_string);
+
+ void report_option_value_error (const ACE_TCHAR* option_name,
+ const ACE_TCHAR* option_value);
+
+protected:
+ /// Should the server connection handlers run in their own thread?
+ int activate_server_connections_;
+
+ /// Default thread flags passed to thr_create().
+ int thread_flags_;
+
+ enum Lock_Type
+ {
+ TAO_NULL_LOCK,
+ TAO_THREAD_LOCK
+ };
+
+ /// The type of lock to be returned by <create_poa_lock()>.
+ Lock_Type poa_lock_type_;
+
+ /// The timeout flag and value for the thread-per-connection model
+ int thread_per_connection_use_timeout_;
+ ACE_Time_Value thread_per_connection_timeout_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+ACE_STATIC_SVC_DECLARE_EXPORT (TAO, TAO_Default_Server_Strategy_Factory)
+ACE_FACTORY_DECLARE (TAO, TAO_Default_Server_Strategy_Factory)
+
+#include /**/ "ace/post.h"
+#endif /* TAO_DEFAULT_SERVER_FACTORY_H */
diff --git a/TAO/tao/diffs/Domain.diff b/TAO/tao/diffs/Domain.diff
new file mode 100644
index 00000000000..411a5e08b8d
--- /dev/null
+++ b/TAO/tao/diffs/Domain.diff
@@ -0,0 +1,88 @@
+--- orig/DomainC.cpp 2005-04-23 20:41:36.569843200 +0200
++++ DomainC.cpp 2005-04-23 20:42:48.202846400 +0200
+@@ -1,6 +1,6 @@
+ // -*- C++ -*-
+ //
+-// $Id$
++// $Id$
+
+ // **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+ // TAO and the TAO IDL Compiler have been developed by:
+@@ -39,6 +39,10 @@
+ #include "tao/Special_Basic_Arguments.h"
+ #include "ace/OS_NS_string.h"
+
++#include "tao/ORB_Core.h"
++#include "tao/IFR_Client_Adapter.h"
++#include "ace/Dynamic_Service.h"
++
+ #if defined (__BORLANDC__)
+ #pragma option -w-rvl -w-rch -w-ccc -w-aus -w-sig
+ #endif /* __BORLANDC__ */
+@@ -50,6 +54,48 @@
+ // TAO_IDL - Generated from
+ // be\be_visitor_arg_traits.cpp:69
+
++// TAO specific stuff.
++namespace CORBA
++{
++ class InterfaceDef;
++ typedef InterfaceDef *InterfaceDef_ptr;
++ typedef TAO_Objref_Var_T<InterfaceDef> InterfaceDef_var;
++ typedef TAO_Objref_Out_T<InterfaceDef> InterfaceDef_out;
++}
++
++namespace TAO
++{
++
++#if TAO_HAS_INTERCEPTORS == 1
++
++ template<>
++ void
++ In_Object_Argument_T<CORBA::InterfaceDef_ptr>::interceptor_param (Dynamic::Parameter & p)
++ {
++ TAO_IFR_Client_Adapter *adapter =
++ ACE_Dynamic_Service<TAO_IFR_Client_Adapter>::instance (
++ TAO_ORB_Core::ifr_client_adapter_name ()
++ );
++
++ adapter->interfacedef_any_insert (p.argument, this->x_);
++ p.mode = CORBA::PARAM_IN;
++ }
++
++#endif /* TAO_HAS_INTERCEPTORS */
++
++ template<>
++ CORBA::Boolean
++ In_Object_Argument_T<CORBA::InterfaceDef_ptr>::marshal (TAO_OutputCDR & cdr)
++ {
++ TAO_IFR_Client_Adapter *adapter =
++ ACE_Dynamic_Service<TAO_IFR_Client_Adapter>::instance (
++ TAO_ORB_Core::ifr_client_adapter_name ()
++ );
++
++ return adapter->interfacedef_cdr_insert (cdr, this->x_);
++ }
++}
++
+ // Arg traits specializations.
+ namespace TAO
+ {
+--- orig/DomainC.h 2005-04-23 20:41:36.569843200 +0200
++++ DomainC.h 2005-04-15 09:13:18.957705600 +0200
+@@ -1,6 +1,6 @@
+ // -*- C++ -*-
+ //
+-// $Id$
++// $Id$
+
+ // **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+ // TAO and the TAO IDL Compiler have been developed by:
+@@ -51,7 +51,6 @@
+ #include "tao/Seq_Out_T.h"
+
+ #include "tao/PolicyC.h"
+-#include "tao/InterfaceDefC.h"
+
+ #if defined (TAO_EXPORT_MACRO)
+ #undef TAO_EXPORT_MACRO
diff --git a/TAO/tao/diffs/Object_Key.diff b/TAO/tao/diffs/Object_Key.diff
new file mode 100644
index 00000000000..bb632ec4c49
--- /dev/null
+++ b/TAO/tao/diffs/Object_Key.diff
@@ -0,0 +1,190 @@
+--- orig/Object_KeyC.cpp 2005-04-08 10:17:40.978604800 +0200
++++ Object_KeyC.cpp 2005-04-08 10:17:41.879900800 +0200
+@@ -37,6 +37,10 @@
+ #pragma option -w-rvl -w-rch -w-ccc -w-aus -w-sig
+ #endif /* __BORLANDC__ */
+
++#include "ace/ACE.h"
++#include "ace/OS_NS_string.h"
++#include "ace/os_include/os_ctype.h"
++
+ // TAO_IDL - Generated from
+ // be\be_visitor_arg_traits.cpp:69
+
+@@ -88,6 +92,150 @@
+ TAO::ObjectKey::~ObjectKey (void)
+ {}
+
++// Hand crafted.
++
++void
++TAO::ObjectKey::encode_sequence_to_string (char * &str,
++ const TAO::unbounded_value_sequence<CORBA::Octet> &seq)
++{
++ // We must allocate a buffer which is (gag) 3 times the length
++ // of the sequence, which is the length required in the worst-case
++ // scenario of all non-printable characters.
++ //
++ // There are two strategies here...we could allocate all that space here,
++ // fill it up, then copy-allocate new space of just the right length.
++ // OR, we could just return this space. The classic time-space tradeoff,
++ // and for now we'll let time win out, which means that we only do the
++ // allocation once.
++ u_int len = 3 * seq.length (); /* space for zero termination not needed */;
++ str = CORBA::string_alloc (len);
++
++ char *cp = str;
++
++ for (u_int i = 0;
++ cp < (str + len) && i < seq.length();
++ ++i)
++ {
++ u_char bt = seq[i];
++ if (is_legal (bt))
++ {
++ *cp++ = (char) bt;
++ continue;
++ }
++
++ *cp++ = '%';
++ *cp++ = ACE::nibble2hex ((bt >> 4) & 0x0f);
++ *cp++ = ACE::nibble2hex (bt & 0x0f);
++ }
++ // Zero terminate
++ *cp = '\0';
++}
++
++int TAO::ObjectKey::is_legal (u_char & c)
++{
++ if (isalnum(c))
++ {
++ return 1;
++ }
++ else
++ {
++ return ( c == ';' || c == '/' ||c == ':' || c == '?' ||
++ c == '@' || c == '&' ||c == '=' || c == '+' ||
++ c == '$' || c == ',' ||c == '_' || c == '.' ||
++ c == '!' || c == '~' ||c == '*' || c == '\'' ||
++ c == '-' || c == '(' || c == ')' );
++ }
++}
++
++void
++TAO::ObjectKey::decode_string_to_sequence (TAO::unbounded_value_sequence<CORBA::Octet> &seq,
++ const char *str)
++{
++ if (str == 0)
++ {
++ seq.length (0);
++ return;
++ }
++
++ u_int length = ACE_OS::strlen (str);
++ const char *eos = str + length;
++ const char *cp = str;
++
++ // Set the length of the sequence to be as long as
++ // we'll possibly need...we'll reset it to the actual
++ // length later.
++ seq.length (length);
++
++ u_int i = 0;
++ for (;
++ cp < eos && i < seq.length ();
++ ++i)
++ {
++ if (*cp == '%' || *cp == '\\')
++ {
++ // This is an escaped non-printable,
++ // so we decode the hex values into
++ // the sequence's octet
++ seq[i] = (u_char) (ACE::hex2byte (cp[1]) << 4);
++ seq[i] |= (u_char) ACE::hex2byte (cp[2]);
++ cp += 3;
++ }
++ else
++ // Copy it in
++ seq[i] = *cp++;
++ }
++
++ // Set the length appropriately
++ seq.length (i);
++}
++
++/*static*/ CORBA::Boolean
++TAO::ObjectKey::demarshal_key (TAO::ObjectKey &key,
++ TAO_InputCDR &strm)
++{
++ CORBA::ULong _tao_seq_len;
++
++ if (strm >> _tao_seq_len)
++ {
++ // Add a check to the length of the sequence
++ // to make sure it does not exceed the length
++ // of the stream. (See bug 58.)
++ if (_tao_seq_len > strm.length ())
++ {
++ return 0;
++ }
++
++ // Set the length of the sequence.
++ key.length (_tao_seq_len);
++
++ // If length is 0 we return true.
++ if (0 >= _tao_seq_len)
++ {
++ return 1;
++ }
++
++ // Retrieve all the elements.
++#if (TAO_NO_COPY_OCTET_SEQUENCES == 1)
++ if (ACE_BIT_DISABLED (strm.start ()->flags (),
++ ACE_Message_Block::DONT_DELETE))
++ {
++ key.replace (_tao_seq_len, strm.start ());
++ key.mb ()->wr_ptr (key.mb()->rd_ptr () + _tao_seq_len);
++ strm.skip_bytes (_tao_seq_len);
++ return 1;
++ }
++ return strm.read_octet_array (key.get_buffer (),
++ _tao_seq_len);
++#else /* TAO_NO_COPY_OCTET_SEQUENCES == 0 */
++ return strm.read_octet_array (key.get_buffer (), key.length ());
++#endif /* TAO_NO_COPY_OCTET_SEQUENCES == 0 */
++
++ }
++ return 0;
++}
++
+ #endif /* end #if !defined */
+
+ // TAO_IDL - Generated from
+--- orig/Object_KeyC.h 2005-04-08 10:17:40.978604800 +0200
++++ Object_KeyC.h 2005-04-08 10:17:41.879900800 +0200
+@@ -117,6 +117,25 @@
+ )
+ : TAO_Unbounded_Sequence<CORBA::Octet> (length, mb) {}
+ #endif /* TAO_NO_COPY_OCTET_SEQUENCE == 1 */
++
++ // Hand crafted.
++
++ static void encode_sequence_to_string (
++ char * &str,
++ const TAO::unbounded_value_sequence<CORBA::Octet> &seq
++ );
++ static void decode_string_to_sequence (
++ TAO::unbounded_value_sequence<CORBA::Octet> &seq,
++ const char *str
++ );
++ static int is_legal (u_char & c);
++
++ /// A special method that gives no regard to how the ORB has
++ /// configured the resource factory. This will be used only
++ /// during Profile decoding and should be safe. This is a solution
++ /// for the bug report [BUG 1616]
++ static CORBA::Boolean demarshal_key (ObjectKey &key,
++ TAO_InputCDR &cdr);
+ };
+
+ #endif /* end #if !defined */
diff --git a/TAO/tao/diffs/OctetSeq.diff b/TAO/tao/diffs/OctetSeq.diff
new file mode 100644
index 00000000000..fb15f742a61
--- /dev/null
+++ b/TAO/tao/diffs/OctetSeq.diff
@@ -0,0 +1,21 @@
+--- orig/OctetSeqC.h 2005-04-08 10:17:34.108726400 +0200
++++ OctetSeqC.h 2005-04-08 10:17:41.829828800 +0200
+@@ -141,6 +141,18 @@
+ {
+ }
+
++// Workaround for a Visual Studio .NET bug where this class is not
++// properly imported by an application if typedef'd or subclassed,
++// resulting in 'multiply defined' link errors. The export macro
++// here forces an explicit import by the application. Please see
++// http://support.microsoft.com/default.aspx?scid=kb;en-us;309801
++// The problem stems from use of the type below in PortableServer,
++// but we put the instantiation here because the application will
++// need to see it in *C.h to avoid the error.
++#if defined ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT
++ template class TAO_Export TAO::unbounded_value_sequence<CORBA::OctetSeq>;
++#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT */
++
+ // TAO_IDL - Generated from
+ // be\be_visitor_sequence/any_op_ch.cpp:52
+
diff --git a/TAO/tao/diffs/Policy.diff b/TAO/tao/diffs/Policy.diff
new file mode 100644
index 00000000000..adaaf03825f
--- /dev/null
+++ b/TAO/tao/diffs/Policy.diff
@@ -0,0 +1,55 @@
+--- orig/PolicyC.h 2005-04-08 10:17:37.633795200 +0200
++++ PolicyC.h 2005-04-08 10:17:41.709656000 +0200
+@@ -331,6 +331,15 @@
+
+ virtual const char* _interface_repository_id (void) const;
+ virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr);
++
++ // Handcrafted
++ // ****************************************************************
++ virtual CORBA::Boolean _tao_encode (TAO_OutputCDR &);
++ virtual CORBA::Boolean _tao_decode (TAO_InputCDR &);
++ virtual TAO_Cached_Policy_Type _tao_cached_type (void) const;
++ virtual TAO_Policy_Scope _tao_scope (void) const;
++ // ****************************************************************
++
+ private:
+ TAO::Collocation_Proxy_Broker *the_TAO_Policy_Proxy_Broker_;
+
+--- orig/PolicyC.cpp 2005-04-08 10:17:37.633795200 +0200
++++ PolicyC.cpp 2005-04-08 10:17:41.719670400 +0200
+@@ -953,6 +953,34 @@
+ );
+ }
+
++// Hand crafted.
++//
++// ****************************************************************
++CORBA::Boolean
++CORBA::Policy::_tao_encode (TAO_OutputCDR &)
++{
++ return false;
++}
++
++CORBA::Boolean
++CORBA::Policy::_tao_decode (TAO_InputCDR &)
++{
++ return false;
++}
++
++TAO_Cached_Policy_Type
++CORBA::Policy::_tao_cached_type (void) const
++{
++ return TAO_CACHED_POLICY_UNCACHED;
++}
++
++TAO_Policy_Scope
++CORBA::Policy::_tao_scope (void) const
++{
++ return TAO_POLICY_DEFAULT_SCOPE;
++}
++// ****************************************************************
++
+ // TAO_IDL - Generated from
+ // be\be_visitor_interface/cdr_op_cs.cpp:63
+
diff --git a/TAO/tao/diffs/Typecode_types.diff b/TAO/tao/diffs/Typecode_types.diff
new file mode 100644
index 00000000000..55d5c076583
--- /dev/null
+++ b/TAO/tao/diffs/Typecode_types.diff
@@ -0,0 +1,55 @@
+--- orig/Typecode_typesC.h 2005-04-08 10:17:37.123060800 +0200
++++ Typecode_typesC.h 2005-04-08 10:17:41.739699200 +0200
+@@ -68,26 +68,6 @@
+ // TAO_IDL - Generated from
+ // be\be_interface.cpp:598
+
+-#if !defined (_CORBA_TYPECODE__VAR_OUT_CH_)
+-#define _CORBA_TYPECODE__VAR_OUT_CH_
+-
+- class TypeCode;
+- typedef TypeCode *TypeCode_ptr;
+-
+- typedef
+- TAO_Objref_Var_T<
+- TypeCode
+- >
+- TypeCode_var;
+-
+- typedef
+- TAO_Objref_Out_T<
+- TypeCode
+- >
+- TypeCode_out;
+-
+-#endif /* end #if !defined */
+-
+ // TAO_IDL - Generated from
+ // be\be_visitor_enum/enum_ch.cpp:57
+
+@@ -130,6 +110,11 @@
+ tk_component,
+ tk_home,
+ tk_event
++
++ // This symbol is not defined by CORBA 3.0. It's used to speed up
++ // dispatch based on TCKind values, and lets many important ones
++ // just be table lookups. It must always be the last enum value!!
++ , TAO_TC_KIND_COUNT
+ };
+
+ typedef TCKind &TCKind_out;
+@@ -148,13 +133,6 @@
+ }
+
+ // TAO_IDL - Generated from
+-// be\be_visitor_interface_fwd/cdr_op_ch.cpp:66
+-
+-TAO_Export CORBA::Boolean operator<< (TAO_OutputCDR &, const CORBA::TypeCode_ptr );
+-TAO_Export CORBA::Boolean operator>> (TAO_InputCDR &, CORBA::TypeCode_ptr &);
+-
+-
+-// TAO_IDL - Generated from
+ // be\be_visitor_enum/cdr_op_ch.cpp:50
+
+ TAO_Export CORBA::Boolean operator<< (TAO_OutputCDR &, CORBA::TCKind);
diff --git a/TAO/tao/diffs/UShortSeq.diff b/TAO/tao/diffs/UShortSeq.diff
new file mode 100644
index 00000000000..1938744506a
--- /dev/null
+++ b/TAO/tao/diffs/UShortSeq.diff
@@ -0,0 +1,21 @@
+--- orig/UShortSeqC.h 2005-04-08 10:17:34.909878400 +0200
++++ UShortSeqC.h 2005-04-08 10:17:41.759728000 +0200
+@@ -133,6 +133,18 @@
+ {
+ }
+
++// Workaround for a Visual Studio .NET bug where this class is not
++// properly imported by an application if typedef'd or subclassed,
++// resulting in 'multiply defined' link errors. The export macro
++// here forces an explicit import by the application. Please see
++// http://support.microsoft.com/default.aspx?scid=kb;en-us;309801
++// The problem stems from use of the type below in DsLogAdmin,
++// but we put the instantiation here because the application will
++// need to see it in *C.h to avoid the error.
++#if defined ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT
++ template class TAO_Export TAO_Unbounded_Sequence<CORBA::UShortSeq>;
++#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT */
++
+ // TAO_IDL - Generated from
+ // be\be_visitor_sequence/any_op_ch.cpp:52
+
diff --git a/TAO/tao/extra_anytypecode.mpb b/TAO/tao/extra_anytypecode.mpb
new file mode 100755
index 00000000000..ece5169967e
--- /dev/null
+++ b/TAO/tao/extra_anytypecode.mpb
@@ -0,0 +1,8 @@
+// -*- MPC -*-
+// $Id$
+
+feature(!minimum_corba) {
+ Source_Files(TAO_ANYTYPECODE_COMPONENTS) {
+ AnyTypeCode/ServicesA.cpp
+ }
+}
diff --git a/TAO/tao/extra_core.mpb b/TAO/tao/extra_core.mpb
new file mode 100644
index 00000000000..8f9fcf5b15c
--- /dev/null
+++ b/TAO/tao/extra_core.mpb
@@ -0,0 +1,16 @@
+// -*- MPC -*-
+// $Id$
+
+feature(!minimum_corba) {
+ Source_Files(TAO_COMPONENTS) {
+ Dynamic_Adapter.cpp
+ }
+}
+
+feature(corba_messaging) {
+ Source_Files(TAO_COMPONENTS) {
+ Policy_Manager.cpp
+ Buffering_Constraint_Policy.cpp
+ Messaging_PolicyValueC.cpp
+ }
+}
diff --git a/TAO/tao/objectid.h b/TAO/tao/objectid.h
new file mode 100644
index 00000000000..40d8f6cad7d
--- /dev/null
+++ b/TAO/tao/objectid.h
@@ -0,0 +1,113 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file objectid.h
+ *
+ * $Id$
+ *
+ * ObjectIds redefined for TAO and recognized by CORBA
+ *
+ * @author Chris Cleeland
+ * @author Douglas C. Schmidt
+ */
+//=============================================================================
+
+#ifndef TAO_OBJECTID_H
+#define TAO_OBJECTID_H
+#include /**/ "ace/pre.h"
+
+#include "ace/config-all.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Versioned_Namespace.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/*
+ *
+ * This file is a break away from orbconf.h. Basically orbconf.h is
+ * going the OS.h way. Too many things cluttered in other than the
+ * configuration details. Hence this breakway group.
+ *
+ * This file has the TAO specific objectid definitions for the
+ * services that are recognized by resolve_initial_references (),
+ * list_initiial_services () etc. They have no place in the ORB
+ * configuration.
+ */
+
+// ObjectIds recognized by CORBA::ORB::resolve_initial_references()...
+// of course, no guarantees are made that the call will return
+// something useful.
+#define TAO_OBJID_NAMESERVICE "NameService"
+#define TAO_OBJID_TRADINGSERVICE "TradingService"
+#define TAO_OBJID_IMPLREPOSERVICE "ImplRepoService"
+#define TAO_OBJID_ROOTPOA "RootPOA"
+#define TAO_OBJID_POACURRENT "POACurrent"
+#define TAO_OBJID_INTERFACEREP "InterfaceRepository"
+#define TAO_OBJID_POLICYMANAGER "ORBPolicyManager"
+#define TAO_OBJID_POLICYCURRENT "PolicyCurrent"
+#define TAO_OBJID_IORMANIPULATION "IORManipulation"
+#define TAO_OBJID_IORTABLE "IORTable"
+#define TAO_OBJID_DYNANYFACTORY "DynAnyFactory"
+#define TAO_OBJID_TYPECODEFACTORY "TypeCodeFactory"
+#define TAO_OBJID_RTORB "RTORB"
+#define TAO_OBJID_RTCURRENT "RTCurrent"
+#define TAO_OBJID_PRIORITYMAPPINGMANAGER "PriorityMappingManager"
+#define TAO_OBJID_NETWORKPRIORITYMAPPINGMANAGER "NetworkPriorityMappingManager"
+#define TAO_OBJID_SECURITYCURRENT "SecurityCurrent"
+#define TAO_OBJID_SECURITYMANAGER "SecurityManager"
+#define TAO_OBJID_TRANSACTIONCURRENT "TransactionCurrent"
+#define TAO_OBJID_NOTIFICATIONSERVICE "NotificationService"
+#define TAO_OBJID_TYPEDNOTIFICATIONSERVICE "TypedNotificationService"
+#define TAO_OBJID_COMPONENTHOMEFINDER "ComponentHomeFinder"
+#define TAO_OBJID_PSS "PSS"
+#define TAO_OBJID_CODECFACTORY "CodecFactory"
+#define TAO_OBJID_PICurrent "PICurrent"
+#define TAO_OBJID_POAMANAGERFACTORY "POAManagerFactory"
+
+// Comma separated list of the above ObjectIDs.
+// DO NOT include unimplemented services!
+// The CORBA::ORB::list_initial_services () method iterates through
+// this list to determine which initial services are available.
+#define TAO_LIST_OF_INITIAL_SERVICES \
+ TAO_OBJID_NAMESERVICE, \
+ TAO_OBJID_TRADINGSERVICE, \
+ TAO_OBJID_IMPLREPOSERVICE, \
+ TAO_OBJID_ROOTPOA, \
+ TAO_OBJID_POACURRENT, \
+ TAO_OBJID_INTERFACEREP, \
+ TAO_OBJID_POLICYMANAGER, \
+ TAO_OBJID_POLICYCURRENT, \
+ TAO_OBJID_IORMANIPULATION, \
+ TAO_OBJID_IORTABLE, \
+ TAO_OBJID_DYNANYFACTORY, \
+ TAO_OBJID_TYPECODEFACTORY
+// @@ Some initial references are added via other means, such as
+// ORBInitInfo::register_initial_references(). Those should not be
+// placed in the above list. Ideally, we should no longer need the
+// above list once the above services register their references
+// dynamically.
+
+/// Service IDs for the services that are located through Multicast.
+namespace TAO
+{
+ enum MCAST_SERVICEID
+ {
+ MCAST_NAMESERVICE,
+ MCAST_TRADINGSERVICE,
+ MCAST_IMPLREPOSERVICE,
+ MCAST_INTERFACEREPOSERVICE
+ };
+}
+
+/// No. of services locatable through multicast.
+#define TAO_NO_OF_MCAST_SERVICES 4
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /*TAO_OBJECTID_H*/
diff --git a/TAO/tao/operation_details.cpp b/TAO/tao/operation_details.cpp
new file mode 100644
index 00000000000..7e505f26c58
--- /dev/null
+++ b/TAO/tao/operation_details.cpp
@@ -0,0 +1,86 @@
+//$Id$
+
+#include "tao/operation_details.h"
+#include "tao/Stub.h"
+#include "tao/ORB_Constants.h"
+#include "tao/Exception_Data.h"
+#include "tao/SystemException.h"
+#include "tao/Argument.h"
+#include "tao/CDR.h"
+
+#include "ace/OS_NS_string.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/operation_details.i"
+#endif /* ! __ACE_INLINE__ */
+
+ACE_RCSID (tao,
+ operation_details,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+CORBA::Exception *
+TAO_Operation_Details::corba_exception (const char *id
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ for (CORBA::ULong i = 0; i != this->ex_count_; ++i)
+ {
+ if (ACE_OS::strcmp (id,
+ this->ex_data_[i].id) != 0)
+ {
+ continue;
+ }
+
+ // Create an exception object
+ CORBA::Exception *exception =
+ this->ex_data_[i].alloc ();
+
+ if (exception == 0)
+ {
+ ACE_THROW_RETURN (CORBA::NO_MEMORY (0,
+ CORBA::COMPLETED_YES),
+ 0);
+ }
+
+ // Return the exception object that we just created.
+ return exception;
+ }
+
+ // If there are no matches return an unknown exception.
+ ACE_THROW_RETURN (CORBA::UNKNOWN (0,
+ CORBA::COMPLETED_YES),
+ 0);
+}
+
+bool
+TAO_Operation_Details::marshal_args (TAO_OutputCDR &cdr)
+{
+ for (CORBA::ULong i = 0; i != this->num_args_; ++i)
+ {
+ if (!((*this->args_[i]).marshal (cdr)))
+ return false;
+ }
+
+ // Nothing else to fragment. We're also guaranteed to have
+ // data in the CDR stream since the operation was a marshaling
+ // operation, not a fragmentation operation.
+ cdr.more_fragments (false);
+
+ return true;
+}
+
+bool
+TAO_Operation_Details::demarshal_args (TAO_InputCDR &cdr)
+{
+ for (CORBA::ULong i = 0; i != this->num_args_; ++i)
+ {
+ if (!((*this->args_[i]).demarshal (cdr)))
+ return false;
+ }
+
+ return true;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/operation_details.h b/TAO/tao/operation_details.h
new file mode 100644
index 00000000000..48e95f73f27
--- /dev/null
+++ b/TAO/tao/operation_details.h
@@ -0,0 +1,227 @@
+// -*- C++ -*-
+//=============================================================================
+/**
+ * @file operation_details.h
+ *
+ * $Id$
+ *
+ * @author Bala Natarajan <bala@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_OPERATION_DETAILS_H
+#define TAO_OPERATION_DETAILS_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/SystemException.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Service_Context.h"
+#include "tao/TimeBaseC.h"
+#include "tao/target_specification.h"
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/// Forward declarations
+namespace Dynamic
+{
+ class ParameterList;
+ class ExceptionList;
+}
+
+namespace TAO
+{
+ class Argument;
+ struct Exception_Data;
+}
+
+namespace TAO
+{
+ namespace CSD
+ {
+ class FW_Server_Request_Wrapper;
+ }
+}
+
+/**
+ * @class TAO_Operation_Details
+ *
+ * @brief Class with operation details
+ *
+ * This class stores some of the "operation" details that would be
+ * required by the invocation classes. This class is in its
+ * infancy now but I expect this one to grow as we come with
+ * different varieties of use cases.
+ *
+ * @todo Put this in namespace TAO.
+ */
+class TAO_Export TAO_Operation_Details
+{
+public:
+
+ /// Declare FW_Server_Request_Wrapper a friend
+ /// This friendship makes the FW_Server_Request_Wrapper be able to
+ /// clone the TAO_Operation_Details data member in TAO_ServerRequest.
+ friend class TAO::CSD::FW_Server_Request_Wrapper;
+
+ /// Constructor
+ TAO_Operation_Details (const char *name,
+ CORBA::ULong len,
+ CORBA::Boolean argument_flag,
+ TAO::Argument **args = 0,
+ CORBA::ULong num_args = 0,
+ TAO::Exception_Data *ex_data = 0,
+ CORBA::ULong ex_count = 0);
+
+ /// Operation name
+ const char* opname (void) const;
+
+ /// Length of the operation name
+ CORBA::ULong opname_len (void) const;
+
+ /// Return the flag that indicates whether the operation has any
+ /// arguments
+ CORBA::Boolean argument_flag (void) const;
+
+ /// Set the response flags
+ void response_flags (CORBA::Octet flags);
+
+ /// Get the response flags
+ CORBA::Octet response_flags (void) const;
+
+ /// Accessors for the service context list
+ IOP::ServiceContextList &request_service_info (void);
+ const IOP::ServiceContextList &request_service_info (void) const;
+ IOP::ServiceContextList &reply_service_info (void);
+ const IOP::ServiceContextList &reply_service_info (void) const;
+
+ /// Access the TAO_Service_Context
+ TAO_Service_Context &request_service_context (void);
+ const TAO_Service_Context &request_service_context (void) const;
+ TAO_Service_Context &reply_service_context (void);
+ const TAO_Service_Context &reply_service_context (void) const;
+
+ /// Reset the contents of the service context lists that we
+ /// hold.
+ void reset_request_service_info (void);
+ void reset_reply_service_info (void);
+
+ /// Cache the request id.
+ void request_id (CORBA::ULong id);
+
+ /// Return the request ID associated with the operation
+ CORBA::ULong request_id (void) const;
+
+ /// Accessor method for the addressing mode
+ TAO_Target_Specification::TAO_Target_Address addressing_mode (void) const;
+
+ /// Set method for the addressing mode
+ void addressing_mode (CORBA::Short addr);
+
+ /// Creates and returns a CORBA::Exception object whose repository
+ /// id \a ex matches the exception list that this operation
+ /// specified.
+ /**
+ * This step is important to decode the exception that the client
+ * got from the server. If the exception received from the server
+ * is not found in the list of exceptions specified by the operation
+ * this call would raise an UNKNOWN exception.
+ */
+ CORBA::Exception *corba_exception (const char *ex
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ /**
+ * @name Helper methods used by the Invocation classes.
+ */
+ //@{
+
+ /// Marshals the list of <this->arg_> into the \a cdr.
+ bool marshal_args (TAO_OutputCDR &cdr);
+
+ /// Demarshals the list of <this->arg_> into the \a cdr.
+ bool demarshal_args (TAO_InputCDR &cdr);
+
+ /// Accessors for the argument list
+ TAO::Argument ** args (void) const;
+ CORBA::ULong args_num (void) const ;
+
+ /// Exception count
+ CORBA::ULong ex_count (void) const;
+
+ TAO::Exception_Data const * ex_data (void) const;
+
+ void ft_expiration_time (TimeBase::TimeT time);
+ TimeBase::TimeT ft_expiration_time (void) const;
+
+ void ft_retention_id (CORBA::Long request_id);
+ CORBA::Long ft_retention_id (void) const;
+
+private:
+
+ /// Name of the operation being invoked.
+ const char *opname_;
+
+ /// Precalculated length of opname_.
+ CORBA::ULong opname_len_;
+
+ /// Request ID of this operation.
+ CORBA::ULong request_id_;
+
+ /**
+ * Flag that indicates whether the operation has any arguments. If
+ * there are arguments this flag is true, else false.
+ */
+ CORBA::Boolean argument_flag_;
+
+ /// Response flags
+ CORBA::Octet response_flags_;
+
+ /// The ServiceContextList sent to the server side. Only valid
+ /// when sending a request.
+ TAO_Service_Context request_service_info_;
+
+ /// The ServiceContextList received from the server side. Only
+ /// valid when sending a request.
+ TAO_Service_Context reply_service_info_;
+
+ /// Addressing mode for this request.
+ TAO_Target_Specification::TAO_Target_Address addressing_mode_;
+
+ /**
+ * The arguments of this operation. Note that the return value is also
+ * an argument
+ */
+ TAO::Argument **args_;
+
+ /// Number of arguments including the return value
+ CORBA::ULong num_args_;
+
+ /// The type of exceptions that the operations can throw.
+ TAO::Exception_Data *ex_data_;
+
+ /// Count of the exceptions that operations can throw.
+ CORBA::ULong ex_count_;
+#if TAO_HAS_INTERCEPTORS == 1
+ /// FT request expiration time (absolute gregorian)
+ TimeBase::TimeT ft_expiration_time_;
+
+ /// FT request retention id
+ CORBA::Long ft_retention_id_;
+#endif /*TAO_HAS_INTERCEPTORS == 1*/
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/operation_details.i"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_OPERATION_DETAILS_H */
diff --git a/TAO/tao/operation_details.i b/TAO/tao/operation_details.i
new file mode 100644
index 00000000000..a65462899cd
--- /dev/null
+++ b/TAO/tao/operation_details.i
@@ -0,0 +1,200 @@
+// -*- C++ -*-
+//
+//$Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO_Operation_Details::TAO_Operation_Details (const char *name,
+ CORBA::ULong len,
+ CORBA::Boolean argument_flag,
+ TAO::Argument **args,
+ CORBA::ULong num,
+ TAO::Exception_Data *data,
+ CORBA::ULong count)
+ : opname_ (name)
+ , opname_len_ (len)
+ , request_id_ (0)
+ , argument_flag_ (argument_flag)
+ , response_flags_ (0)
+ , addressing_mode_ (TAO_Target_Specification::Key_Addr)
+ , args_ (args)
+ , num_args_ (num)
+ , ex_data_ (data)
+ , ex_count_ (count)
+#if TAO_HAS_INTERCEPTORS == 1
+ , ft_expiration_time_ (0)
+ , ft_retention_id_ (0)
+#endif /*TAO_HAS_INTERCEPTORS == 1*/
+{
+}
+
+ACE_INLINE const char*
+TAO_Operation_Details::opname (void) const
+{
+ return this->opname_;
+}
+
+ACE_INLINE CORBA::ULong
+TAO_Operation_Details::opname_len (void) const
+{
+ return this->opname_len_;
+}
+
+ACE_INLINE CORBA::Boolean
+TAO_Operation_Details::argument_flag (void) const
+{
+ return this->argument_flag_;
+}
+
+ACE_INLINE TAO_Service_Context &
+TAO_Operation_Details::request_service_context (void)
+{
+ return this->request_service_info_;
+}
+
+ACE_INLINE const TAO_Service_Context &
+TAO_Operation_Details::request_service_context (void) const
+{
+ return this->request_service_info_;
+}
+
+ACE_INLINE IOP::ServiceContextList &
+TAO_Operation_Details::request_service_info (void)
+{
+ return this->request_service_context ().service_info ();
+}
+
+ACE_INLINE const IOP::ServiceContextList &
+TAO_Operation_Details::request_service_info (void) const
+{
+ return this->request_service_context ().service_info ();
+}
+
+ACE_INLINE TAO_Service_Context &
+TAO_Operation_Details::reply_service_context (void)
+{
+ return this->reply_service_info_;
+}
+
+ACE_INLINE const TAO_Service_Context &
+TAO_Operation_Details::reply_service_context (void) const
+{
+ return this->reply_service_info_;
+}
+
+ACE_INLINE IOP::ServiceContextList &
+TAO_Operation_Details::reply_service_info (void)
+{
+ return this->reply_service_context ().service_info ();
+}
+
+ACE_INLINE const IOP::ServiceContextList &
+TAO_Operation_Details::reply_service_info (void) const
+{
+ return this->reply_service_context ().service_info ();
+}
+
+ACE_INLINE void
+TAO_Operation_Details::reset_request_service_info (void)
+{
+ this->request_service_context ().service_info ().length (0);
+}
+ACE_INLINE void
+TAO_Operation_Details::reset_reply_service_info (void)
+{
+ this->reply_service_context ().service_info ().length (0);
+}
+
+ACE_INLINE void
+TAO_Operation_Details::request_id (CORBA::ULong id)
+{
+ this->request_id_ = id;
+}
+
+ACE_INLINE CORBA::ULong
+TAO_Operation_Details::request_id (void) const
+{
+ return this->request_id_;
+}
+
+ACE_INLINE void
+TAO_Operation_Details::response_flags (CORBA::Octet flags)
+{
+ this->response_flags_ = flags;
+}
+
+ACE_INLINE CORBA::ULong
+TAO_Operation_Details::ex_count (void) const
+{
+ return this->ex_count_;
+}
+
+ACE_INLINE TAO::Exception_Data const *
+TAO_Operation_Details::ex_data (void) const
+{
+ return this->ex_data_;
+}
+
+ACE_INLINE CORBA::Octet
+TAO_Operation_Details::response_flags (void) const
+{
+ return this->response_flags_;
+}
+
+ACE_INLINE TAO_Target_Specification::TAO_Target_Address
+TAO_Operation_Details::addressing_mode (void) const
+{
+ return this->addressing_mode_;
+}
+
+ACE_INLINE void
+TAO_Operation_Details::addressing_mode (CORBA::Short mode)
+{
+ if (mode == 0)
+ this->addressing_mode_ = TAO_Target_Specification::Key_Addr;
+ else if (mode == 1)
+ this->addressing_mode_ = TAO_Target_Specification::Profile_Addr;
+ else if (mode == 2)
+ this->addressing_mode_ = TAO_Target_Specification::Reference_Addr;
+}
+
+ACE_INLINE TAO::Argument **
+TAO_Operation_Details::args (void) const
+{
+ return this->args_;
+}
+
+ACE_INLINE CORBA::ULong
+TAO_Operation_Details::args_num (void) const
+{
+ return this->num_args_;
+}
+
+#if TAO_HAS_INTERCEPTORS == 1
+ACE_INLINE void
+TAO_Operation_Details::ft_expiration_time (TimeBase::TimeT time)
+{
+ this->ft_expiration_time_ = time;
+}
+
+ACE_INLINE TimeBase::TimeT
+TAO_Operation_Details::ft_expiration_time (void) const
+{
+ return this->ft_expiration_time_;
+}
+
+ACE_INLINE void
+TAO_Operation_Details::ft_retention_id (CORBA::Long request_id)
+{
+ this->ft_retention_id_ = request_id;
+}
+
+ACE_INLINE CORBA::Long
+TAO_Operation_Details::ft_retention_id (void) const
+{
+ return this->ft_retention_id_;
+}
+#endif /*TAO_HAS_INTERCEPTORS == 1*/
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/orb.idl b/TAO/tao/orb.idl
new file mode 100644
index 00000000000..f6a164cf67c
--- /dev/null
+++ b/TAO/tao/orb.idl
@@ -0,0 +1,62 @@
+// -*- IDL -*-
+
+// $Id$
+
+// Included for compatibility with the CORBA 2 specification.
+
+#ifndef TAO_ORB_IDL
+#define TAO_ORB_IDL
+
+///FUZZ: disable check_for_include/
+#include <tao/BooleanSeq.pidl>
+#include <tao/CharSeq.pidl>
+#include <tao/DoubleSeq.pidl>
+#include <tao/FloatSeq.pidl>
+#include <tao/LongDoubleSeq.pidl>
+#include <tao/LongSeq.pidl>
+#include <tao/OctetSeq.pidl>
+#include <tao/ShortSeq.pidl>
+#include <tao/StringSeq.pidl>
+#include <tao/ULongSeq.pidl>
+#include <tao/UShortSeq.pidl>
+#include <tao/WCharSeq.pidl>
+#include <tao/WStringSeq.pidl>
+
+#if ! defined (ACE_LACKS_LONGLONG_T)
+#include <tao/LongLongSeq.pidl>
+#endif /* ! defined (ACE_LACKS_LONGLONG_T) */
+
+#if ! defined (ACE_LACKS_U_LONGLONG_T)
+#include <tao/ULongLongSeq.pidl>
+#endif /* ! defined (ACE_LACKS_U_LONGLONG_T) */
+
+#include <tao/Policy.pidl>
+#include <tao/Services.pidl>
+#include <tao/ParameterMode.pidl>
+#include <tao/orb_types.pidl>
+#include <tao/Typecode_types.pidl>
+#include <tao/WrongTransaction.pidl>
+
+#pragma prefix "omg.org"
+
+module CORBA
+{
+ struct NamedValue
+ {
+ Identifier name;
+ any argument;
+ long len;
+ Flags arg_modes;
+ };
+
+ enum exception_type
+ {
+ NO_EXCEPTION,
+ USER_EXCEPTION,
+ SYSTEM_EXCEPTION
+ };
+
+ native ValueFactory;
+};
+
+#endif /* TAO_ORB_IDL */
diff --git a/TAO/tao/orb_types.pidl b/TAO/tao/orb_types.pidl
new file mode 100644
index 00000000000..d879b3bd40a
--- /dev/null
+++ b/TAO/tao/orb_types.pidl
@@ -0,0 +1,38 @@
+// -*- IDL -*-
+
+// ================================================================
+/**
+ * @file orb_types.pidl
+ *
+ * $Id$
+ *
+ * This file was used to generate the code in orb_typesC.* The command
+ * used to generate code is:
+ *
+ * tao_idl
+ * -o orig -SS -Ge 1 -Sci
+ * -Wb,export_macro=TAO_Export
+ * -Wb,export_include="tao/TAO_Export.h"
+ * -Wb,pre_include="ace/pre.h"
+ * -Wb,post_include="ace/post.h"
+ * orb_types.pidl
+ */
+// ================================================================
+// -*- IDL -*-
+
+// Basic types
+
+#ifndef TAO_ORB_TYPES_IDL
+#define TAO_ORB_TYPES_IDL
+
+#pragma prefix "omg.org"
+
+module CORBA
+{
+ typedef string ORBid;
+ typedef unsigned long Flags;
+ typedef string Identifier;
+ typedef string RepositoryId;
+};
+
+#endif /* TAO_ORB_TYPES_IDL */
diff --git a/TAO/tao/orbconf.h b/TAO/tao/orbconf.h
new file mode 100644
index 00000000000..a8ab7fcec9c
--- /dev/null
+++ b/TAO/tao/orbconf.h
@@ -0,0 +1,832 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file orbconf.h
+ *
+ * $Id$
+ *
+ * Build configuration file.
+ *
+ * @author Copyright 1995 by Sun Microsystems, Inc.
+ * @author Chris Cleeland
+ * @author Douglas C. Schmidt
+ */
+//=============================================================================
+
+#ifndef TAO_ORBCONF_H
+#define TAO_ORBCONF_H
+
+#include /**/ "ace/pre.h"
+
+#include "ace/Basic_Types.h"
+#include "ace/Global_Macros.h"
+#include "ace/Synch_Traits.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Versioned_Namespace.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+#define TAO_INVALID_PRIORITY -1
+
+#if !defined (TAO_REACTOR)
+#define TAO_REACTOR ACE_Select_Reactor
+#endif /* TAO_REACTOR */
+
+#if !defined (TAO_NULL_LOCK_REACTOR)
+#define TAO_NULL_LOCK_REACTOR ACE_Select_Reactor_T< ACE_Reactor_Token_T<ACE_Noop_Token> >
+#endif /* TAO_NULL_LOCK_REACTOR */
+
+// Define this to modify the default mutex type used throughout TAO.
+#if !defined (TAO_SYNCH_MUTEX)
+#define TAO_SYNCH_MUTEX ACE_SYNCH_MUTEX
+#endif /* TAO_SYNCH_MUTEX */
+
+#if !defined (TAO_SYNCH_RECURSIVE_MUTEX)
+#define TAO_SYNCH_RECURSIVE_MUTEX ACE_SYNCH_RECURSIVE_MUTEX
+#endif /* TAO_SYNCH_RECURSIVE_MUTEX */
+
+#if !defined (TAO_SYNCH_RW_MUTEX)
+#define TAO_SYNCH_RW_MUTEX ACE_SYNCH_RW_MUTEX
+#endif /* TAO_SYNCH_RW_MUTEX */
+
+#if !defined (TAO_SYNCH_CONDITION)
+#define TAO_SYNCH_CONDITION ACE_SYNCH_CONDITION
+#endif /* TAO_SYNCH_CONDITION */
+
+// Define this if you don't want POA timestamps in the IOR. Remember,
+// without timestamps, transient and persistent POA cannot be
+// distinguished.
+#if !defined (POA_NO_TIMESTAMP)
+# define POA_NO_TIMESTAMP 0
+#endif /* POA_NO_TIMESTAMP */
+
+// If set the ORB will use dotted decimal addresses in the IIOP IORs
+// it exports. This is useful for platforms or environments that
+// cannot depend on a DNS being available. This macro only affects
+// the server side of a TAO-based CORBA application. If we are on Win32
+// the DNS is perenially broken. Set it to 1 regardless.
+#if !defined (TAO_USE_DOTTED_DECIMAL_ADDRESSES) && defined (ACE_WIN32)
+# define TAO_USE_DOTTED_DECIMAL_ADDRESSES 1
+#endif /*TAO_USE_DOTTED_DECIMAL_ADDRESSES*/
+
+#if !defined (TAO_USE_DOTTED_DECIMAL_ADDRESSES)
+# define TAO_USE_DOTTED_DECIMAL_ADDRESSES 0
+#endif /* TAO_USE_DOTTED_DECIMAL_ADDRESSES */
+
+// If set the ORB will use codeset negotiation. This means adding a
+// Codeset component to each profile in an IOR, and a codeset context
+// to the first request. The use of codeset negotiation also causes
+// libTAO_Codeset to be linked in.
+#if !defined (TAO_NEGOTIATE_CODESETS)
+# define TAO_NEGOTIATE_CODESETS 1
+#endif /*TAO_NEGOTIATE_CODESETS*/
+
+// The default size of TAO's ORB table, i.e. the one used as the
+// underlying implementation for the CORBA::ORB_init() function.
+#if !defined (TAO_DEFAULT_ORB_TABLE_SIZE)
+const size_t TAO_DEFAULT_ORB_TABLE_SIZE = 16;
+#endif /* !TAO_DEFAULT_ORB_TABLE_SIZE */
+
+// The default size of the reply dispatcher table, ie. if the reply
+// dispatcher strategy needs a table to maintain association between
+// request id's and reply dispatchers
+#if !defined (TAO_RD_TABLE_SIZE)
+const size_t TAO_RD_TABLE_SIZE = 16;
+#endif /* !TAO_RD_TABLE_SIZE */
+
+// The default size of TAO's policy factory registry, i.e. the map
+// used as the underlying implementation for the
+// PortableInterceptor::ORBInitInfo::register_policy_factory() method.
+#if !defined (TAO_DEFAULT_POLICY_FACTORY_REGISTRY_SIZE)
+const size_t TAO_DEFAULT_POLICY_FACTORY_REGISTRY_SIZE = 64;
+#endif /* !TAO_DEFAULT_ORB_TABLE_SIZE */
+
+// The default size of TAO's initial object reference table, i.e. the
+// one used as the underlying implementation for the
+// CORBA::ORB::register_initial_reference() and
+// PortableInterceptor::ORBInitInfo::register_initial_reference()
+// methods.
+#if !defined (TAO_DEFAULT_OBJECT_REF_TABLE_SIZE)
+const size_t TAO_DEFAULT_OBJECT_REF_TABLE_SIZE = 256;
+#endif /* !TAO_DEFAULT_ORB_TABLE_SIZE */
+
+// The default size of TAO's ValueFactory table, i.e. the
+// one used as the underlying implementation for the
+// CORBA::ORB::register_value_factory() method.
+#if !defined (TAO_DEFAULT_VALUE_FACTORY_TABLE_SIZE)
+const size_t TAO_DEFAULT_VALUE_FACTORY_TABLE_SIZE = 128;
+#endif /* !TAO_DEFAULT_ORB_TABLE_SIZE */
+
+
+// The default size of TAO's server active object map.
+#if !defined (TAO_DEFAULT_SERVER_ACTIVE_OBJECT_MAP_SIZE)
+# if defined (TAO_DEFAULT_SERVER_OBJECT_TABLE_SIZE)
+//
+// TAO_DEFAULT_SERVER_OBJECT_TABLE_SIZE is deprecated. Please use
+// TAO_DEFAULT_SERVER_ACTIVE_OBJECT_MAP_SIZE.
+//
+# define TAO_DEFAULT_SERVER_ACTIVE_OBJECT_MAP_SIZE TAO_DEFAULT_SERVER_OBJECT_TABLE_SIZE
+# else
+# define TAO_DEFAULT_SERVER_ACTIVE_OBJECT_MAP_SIZE 64
+# endif /* TAO_DEFAULT_SERVER_OBJECT_TABLE_SIZE */
+#endif /* ! TAO_DEFAULT_SERVER_ACTIVE_OBJECT_MAP_SIZE */
+
+// The default size of TAO's server poa map.
+#if !defined (TAO_DEFAULT_SERVER_POA_MAP_SIZE)
+# define TAO_DEFAULT_SERVER_POA_MAP_SIZE 24
+#endif /* ! TAO_DEFAULT_SERVER_POA_MAP_SIZE */
+
+// The default timeout receiving the location request to the TAO
+// Naming, Trading and other servicesService.
+#if !defined (TAO_DEFAULT_SERVICE_RESOLUTION_TIMEOUT)
+#define TAO_DEFAULT_SERVICE_RESOLUTION_TIMEOUT 10
+#endif /* TAO_DEFAULT_SERVICE_RESOLUTION_TIMEOUT */
+
+// The default starting port number for TAO servers.
+// @@ This assumes we are using one or more protocols that will all
+// @@ 1) know what to do with a port number and
+// @@ 2) use the same default port number.
+// @@ This shou8ld go away!
+#if !defined (TAO_DEFAULT_SERVER_PORT)
+#define TAO_DEFAULT_SERVER_PORT 0
+#endif /* TAO_DEFAULT_SERVER_PORT */
+
+// TAO's max buffer size
+#if !defined (TAO_MAXBUFSIZE)
+#define TAO_MAXBUFSIZE 1024
+#endif /* TAO_MAXBUFSIZE */
+
+#if !defined (TAO_CONNECTION_PURGING_STRATEGY)
+# define TAO_CONNECTION_PURGING_STRATEGY TAO_Resource_Factory::LRU
+#endif /* TAO_CONNECTION_PURGING_STRATEGY */
+
+#if !defined (TAO_PURGE_PERCENT)
+# define TAO_PURGE_PERCENT 20
+#endif /* TAO_PURGE_PERCENT */
+
+#if !defined (TAO_CONNECTION_CACHE_MAXIMUM)
+// If for some reason you configure the maximum number of handles in
+// your OS to some astronomical value, then you should override this
+// macro to be a smaller value, e.g., NOFILES or FD_SETSIZE.
+# define TAO_CONNECTION_CACHE_MAXIMUM (ACE::max_handles () / 2)
+#endif /* TAO_CONNECTION_CACHE_MAXIMUM */
+
+// This definition theoretically is not required. Just leaving it here
+// for backward compatibility
+#define TAO_NAMESPACE_STORAGE_CLASS extern TAO_EXPORT_MACRO
+
+# if defined (_MSC_VER) && defined (__ACE_INLINE__)
+# define TAO_NAMESPACE_INLINE_FUNCTION inline
+# else
+# define TAO_NAMESPACE_INLINE_FUNCTION TAO_NAMESPACE_STORAGE_CLASS
+# endif
+
+#if !defined(TAO_NO_COPY_OCTET_SEQUENCES)
+# define TAO_NO_COPY_OCTET_SEQUENCES 1
+#endif /* TAO_NO_COPY_OCTET_SEQUENCES */
+
+#if defined (ACE_HAS_EXCEPTIONS)
+# define TAO_HAS_EXCEPTIONS
+// TAO_USE_EXCEPTIONS is only here for backwards compatibility and
+// will go away shortly so don't use it...
+# define TAO_USE_EXCEPTIONS
+#elif (defined (TAO_HAS_EXCEPTIONS) || defined (TAO_USE_EXCEPTIONS)) && !defined (ACE_HAS_EXCEPTIONS)
+# error "tao/orbconf.h: You can only use exceptions in TAO if ACE supports them"
+#endif /* TAO_HAS_EXCEPTIONS */
+
+// BC++ seems to have a different convention for detecting Win32 than
+// VC++.
+
+#if defined (__WIN32__)
+# if !defined(_WIN32)
+# define _WIN32
+# endif /* !defined(_WIN32) */
+#endif /* __WIN32__ */
+
+// Define to `int' if <sys/types.h> doesn't define.
+/* #undef pid_t */
+
+// Define if your processor does not store words with the most significant
+// byte first.
+
+// @todo It seems to be that this definition of TAO_ENCAP_BYTE_ORDER
+// should be removed. We have an equivalent ACE definition in
+// ACE_CDR_BYTE_ORDER. Today both of them are consistent. It would be
+// a havoc if oneday this consistency is gone..
+#if defined (ACE_LITTLE_ENDIAN)
+# define TAO_ENCAP_BYTE_ORDER 1 /* little endian encapsulation byte order has
+ the value = 1 */
+#else /* ! ACE_LITTLE_ENDIAN */
+# define TAO_ENCAP_BYTE_ORDER 0 /* big endian encapsulation byte order has
+ the value = 0 */
+#endif /* ! ACE_LITTLE_ENDIAN */
+
+// Define as the return type of signal handlers (int or void).
+#define RETSIGTYPE void
+
+// Define if you don't have vprintf but do have _doprnt.
+/* #undef HAVE_DOPRNT */
+
+// Define if you have the vprintf function.
+#define HAVE_VPRINTF 1
+
+// Avoid namespace pollution that's common on older UNIXes...
+#if defined (minor)
+#undef minor
+#endif /* minor */
+
+#if defined (major)
+#undef major
+#endif /* major*/
+
+#if !defined (TAO_EXPORT_NESTED_CLASSES) \
+ && defined (ACE_EXPORT_NESTED_CLASSES)
+#define TAO_EXPORT_NESTED_CLASSES
+#endif /* !defined TAO_EXPORT_NESTED_CLASSES */
+
+#if !defined (TAO_EXPORT_NESTED_MACRO)
+#define TAO_EXPORT_NESTED_MACRO
+#endif /* !defined (TAO_EXPORT_NESTED_MACRO) */
+
+// Assume DOS/Windows if "configure" didn't get run.
+
+#if defined (_MSC_VER)
+// "C4355: 'this' : used in base member initializer list"
+# pragma warning (disable:4355) /* disable C4355 warning */
+#endif /* defined (_MSC_VER) */
+
+// The Root POA default name.
+#if !defined (TAO_DEFAULT_ROOTPOA_NAME)
+#define TAO_DEFAULT_ROOTPOA_NAME "RootPOA"
+#endif /* TAO_DEFAULT_ROOTPOA_NAME */
+
+#if !defined (TAO_DEFAULT_ROOTPOAMANAGER_NAME)
+#define TAO_DEFAULT_ROOTPOAMANAGER_NAME "RootPOAManager"
+#endif /* TAO_DEFAULT_ROOTPOAMANAGER_NAME */
+
+// The default lane name used when storing endpoints.
+#if !defined (TAO_DEFAULT_LANE)
+#define TAO_DEFAULT_LANE "default lane"
+#endif /* TAO_DEFAULT_LANE */
+
+// Minimum CORBA
+#if !defined (TAO_HAS_MINIMUM_CORBA)
+# define TAO_HAS_MINIMUM_CORBA 0
+#endif /* TAO_HAS_MINIMUM_CORBA */
+
+/// Default IIOP settings
+#if !defined (TAO_HAS_IIOP)
+# define TAO_HAS_IIOP 1
+#endif /* !TAO_HAS_IIOP */
+
+/// Default DIOP settings
+#if !defined (TAO_HAS_DIOP)
+# define TAO_HAS_DIOP 1
+#endif /* !TAO_HAS_DIOP */
+
+/// Default SCIOP Settings
+/// SCIOP is disabled by default (i.e. TAO_HAS_SCIOP is undef)
+/// to enable SCIOP, make with sctp=openss7 option on command line.
+/// See $ACE_ROOT/performance-tests/SCTP/README for more info.
+#if !defined (TAO_HAS_SCIOP)
+# if defined (ACE_HAS_SCTP)
+# define TAO_HAS_SCIOP 1
+# define TAO_DEF_SCIOP_MAJOR 1
+# define TAO_DEF_SCIOP_MINOR 0
+# else
+# define TAO_HAS_SCIOP 0
+# endif /* ACE_HAS_SCTP */
+#endif /* !TAO_HAS_SCIOP */
+
+// UIOP support is enabled by default if the platform supports UNIX
+// domain sockets, and TAO is not configured for minimum CORBA.
+// If TAO is configured for minimum CORBA, then UIOP will be disabled
+// by default.
+// To explicitly enable UIOP support uncomment the following
+// #define TAO_HAS_UIOP 1
+// To explicitly disable UIOP support uncomment the following
+// #define TAO_HAS_UIOP 0
+
+// Default UIOP settings
+#if !defined (TAO_HAS_UIOP)
+# if defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS)
+# define TAO_HAS_UIOP 0
+# else
+# define TAO_HAS_UIOP 1
+# endif /* ACE_LACKS_UNIX_DOMAIN_SOCKETS */
+#endif /* !TAO_HAS_UIOP */
+
+// NSKPW and NSKFS are Pluggable Protocols used on the Tandem
+// platform. These are disabled by default.
+
+#if defined (TAO_HAS_NSKPW)
+#define TAO_DEF_NSKPW_MAJOR 1
+#define TAO_DEF_NSKPW_MINOR 2
+#endif
+
+#if defined (TAO_HAS_NSKFS)
+#define TAO_DEF_NSKFS_MAJOR 1
+#define TAO_DEF_NSKFS_MINOR 2
+#endif
+
+#if (ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1)
+# if !defined (TAO_HAS_SHMIOP)
+# define TAO_HAS_SHMIOP 1
+# endif /* TAO_HAS_SHMIOP */
+#else
+# if defined (TAO_HAS_SHMIOP)
+# undef TAO_HAS_SHMIOP
+# endif /* TAO_HAS_SHMIOP */
+# define TAO_HAS_SHMIOP 0
+#endif /* ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1 */
+
+// NAMED_RT_MUTEX support is disabled by default.
+// To explicitly enable NAMED_RT_MUTEX support uncomment the following
+// #define TAO_HAS_NAMED_RT_MUTEXES 1
+// To explicitly disable NAMED_RT_MUTEX support uncomment the following
+// #define TAO_HAS_NAMED_RT_MUTEXES 0
+
+// Default NAMED_RT_MUTEX settings
+#if !defined (TAO_HAS_NAMED_RT_MUTEXES)
+# define TAO_HAS_NAMED_RT_MUTEXES 0
+#endif /* !TAO_HAS_NAMED_RT_MUTEXES */
+
+// MINIMUM_POA support is disabled by default if TAO is not
+// configured for minimum CORBA. If TAO is configured for minimum
+// CORBA, then MINIMUM_POA will be enabled by default.
+// To explicitly enable MINIMUM_POA support uncomment the following
+// #define TAO_HAS_MINIMUM_POA 1
+// To explicitly disable MINIMUM_POA support uncomment the following
+// #define TAO_HAS_MINIMUM_POA 0
+
+// Default MINIMUM_POA settings
+#if !defined (TAO_HAS_MINIMUM_POA)
+# if (TAO_HAS_MINIMUM_CORBA == 1)
+# define TAO_HAS_MINIMUM_POA 1
+# else
+# define TAO_HAS_MINIMUM_POA 0
+# endif /* TAO_HAS_MINIMUM_CORBA */
+#endif /* !TAO_HAS_MINIMUM_POA */
+
+// MINIMUM_POA_MAPS support is disabled by default if TAO is not
+// configured for minimum POA. If TAO is configured for minimum
+// POA, then MINIMUM_POA_MAPS will be enabled by default.
+// To explicitly enable MINIMUM_POA_MAPS support uncomment the following
+// #define TAO_HAS_MINIMUM_POA_MAPS 1
+// To explicitly disable MINIMUM_POA_MAPS support uncomment the following
+// #define TAO_HAS_MINIMUM_POA_MAPS 0
+
+// Default MINIMUM_POA_MAPS settings
+#if !defined (TAO_HAS_MINIMUM_POA_MAPS)
+# if (TAO_HAS_MINIMUM_POA == 1)
+# define TAO_HAS_MINIMUM_POA_MAPS 1
+# else
+# define TAO_HAS_MINIMUM_POA_MAPS 0
+# endif /* TAO_HAS_MINIMUM_POA */
+#endif /* !TAO_HAS_MINIMUM_POA_MAPS */
+
+// CORBA_MESSAGING support is enabled by default if TAO is not
+// configured for minimum CORBA. If TAO is configured for minimum
+// CORBA, then CORBA_MESSAGING will be disabled by default.
+// To explicitly enable CORBA_MESSAGING support uncomment the following
+// #define TAO_HAS_CORBA_MESSAGING 1
+// To explicitly disable CORBA_MESSAGING support uncomment the following
+// #define TAO_HAS_CORBA_MESSAGING 0
+
+// Default CORBA_MESSAGING settings
+#if !defined (TAO_HAS_CORBA_MESSAGING)
+# define TAO_HAS_CORBA_MESSAGING 1
+#endif /* !TAO_HAS_CORBA_MESSAGING */
+
+// For all the policies, support is enabled by default if TAO is
+// configured for CORBA Messaging. If TAO is not configured for CORBA
+// Messaging, then policies cannot be enabled. Default support can be
+// turned off by setting TAO_DISABLE_CORBA_MESSAGING_POLICIES to 1.
+
+#if !defined (TAO_DISABLE_CORBA_MESSAGING_POLICIES)
+# define TAO_DISABLE_CORBA_MESSAGING_POLICIES 0
+#endif /* !TAO_DISABLE_CORBA_MESSAGING_POLICIES */
+
+// To explicitly disable REBIND_POLICY support uncomment the following
+// #define TAO_HAS_REBIND_POLICY 0
+
+// Default REBIND_POLICY settings
+#if !defined (TAO_HAS_REBIND_POLICY)
+# if (TAO_HAS_CORBA_MESSAGING == 1) && \
+ (TAO_DISABLE_CORBA_MESSAGING_POLICIES == 0)
+# define TAO_HAS_REBIND_POLICY 1
+# else
+# define TAO_HAS_REBIND_POLICY 0
+# endif /* TAO_HAS_CORBA_MESSAGING == 1 &&
+ TAO_DISABLE_CORBA_MESSAGING_POLICIES == 0 */
+#endif /* !TAO_HAS_REBIND_POLICY */
+
+// To explicitly disable SYNC_SCOPE_POLICY support uncomment the following
+// #define TAO_HAS_SYNC_SCOPE_POLICY 0
+
+// Default SYNC_SCOPE_POLICY settings
+#if !defined (TAO_HAS_SYNC_SCOPE_POLICY)
+# if (TAO_HAS_CORBA_MESSAGING == 1) && \
+ (TAO_DISABLE_CORBA_MESSAGING_POLICIES == 0)
+# define TAO_HAS_SYNC_SCOPE_POLICY 1
+# else
+# define TAO_HAS_SYNC_SCOPE_POLICY 0
+# endif /* TAO_HAS_CORBA_MESSAGING == 1 &&
+ TAO_DISABLE_CORBA_MESSAGING_POLICIES == 0 */
+#endif /* !TAO_HAS_SYNC_SCOPE_POLICY */
+
+// To explicitly disable PRIORITY_POLICIES support uncomment the following
+// #define TAO_HAS_PRIORITY_POLICIES 0
+
+// Default PRIORITY_POLICIES settings
+#if !defined (TAO_HAS_PRIORITY_POLICIES)
+# if (TAO_HAS_CORBA_MESSAGING == 1) && \
+ (TAO_DISABLE_CORBA_MESSAGING_POLICIES == 0)
+# define TAO_HAS_PRIORITY_POLICIES 1
+# else
+# define TAO_HAS_PRIORITY_POLICIES 0
+# endif /* TAO_HAS_CORBA_MESSAGING == 1 &&
+ TAO_DISABLE_CORBA_MESSAGING_POLICIES == 0 */
+#endif /* !TAO_HAS_PRIORITY_POLICIES */
+
+// To explicitly disable REQUEST_START_TIME_POLICY support uncomment the following
+// #define TAO_HAS_REQUEST_START_TIME_POLICY 0
+
+// Default REQUEST_START_TIME_POLICY settings
+#if !defined (TAO_HAS_REQUEST_START_TIME_POLICY)
+# if (TAO_HAS_CORBA_MESSAGING == 1) && \
+ (TAO_DISABLE_CORBA_MESSAGING_POLICIES == 0)
+# define TAO_HAS_REQUEST_START_TIME_POLICY 1
+# else
+# define TAO_HAS_REQUEST_START_TIME_POLICY 0
+# endif /* TAO_HAS_CORBA_MESSAGING == 1 &&
+ TAO_DISABLE_CORBA_MESSAGING_POLICIES == 0 */
+#endif /* !TAO_HAS_REQUEST_START_TIME_POLICY */
+
+// To explicitly disable REQUEST_END_TIME_POLICY support uncomment the following
+// #define TAO_HAS_REQUEST_END_TIME_POLICY 0
+
+// Default REQUEST_END_TIME_POLICY settings
+#if !defined (TAO_HAS_REQUEST_END_TIME_POLICY)
+# if (TAO_HAS_CORBA_MESSAGING == 1) && \
+ (TAO_DISABLE_CORBA_MESSAGING_POLICIES == 0)
+# define TAO_HAS_REQUEST_END_TIME_POLICY 1
+# else
+# define TAO_HAS_REQUEST_END_TIME_POLICY 0
+# endif /* TAO_HAS_CORBA_MESSAGING == 1 &&
+ TAO_DISABLE_CORBA_MESSAGING_POLICIES == 0 */
+#endif /* !TAO_HAS_REQUEST_END_TIME_POLICY */
+
+// To explicitly disable REPLY_START_TIME_POLICY support uncomment the following
+// #define TAO_HAS_REPLY_START_TIME_POLICY 0
+
+// Default REPLY_START_TIME_POLICY settings
+#if !defined (TAO_HAS_REPLY_START_TIME_POLICY)
+# if (TAO_HAS_CORBA_MESSAGING == 1) && \
+ (TAO_DISABLE_CORBA_MESSAGING_POLICIES == 0)
+# define TAO_HAS_REPLY_START_TIME_POLICY 1
+# else
+# define TAO_HAS_REPLY_START_TIME_POLICY 0
+# endif /* TAO_HAS_CORBA_MESSAGING == 1 &&
+ TAO_DISABLE_CORBA_MESSAGING_POLICIES == 0 */
+#endif /* !TAO_HAS_REPLY_START_TIME_POLICY */
+
+// To explicitly disable REPLY_END_TIME_POLICY support uncomment the following
+// #define TAO_HAS_REPLY_END_TIME_POLICY 0
+
+// Default REPLY_END_TIME_POLICY settings
+#if !defined (TAO_HAS_REPLY_END_TIME_POLICY)
+# if (TAO_HAS_CORBA_MESSAGING == 1) && \
+ (TAO_DISABLE_CORBA_MESSAGING_POLICIES == 0)
+# define TAO_HAS_REPLY_END_TIME_POLICY 1
+# else
+# define TAO_HAS_REPLY_END_TIME_POLICY 0
+# endif /* TAO_HAS_CORBA_MESSAGING == 1 &&
+ TAO_DISABLE_CORBA_MESSAGING_POLICIES == 0 */
+#endif /* !TAO_HAS_REPLY_END_TIME_POLICY */
+
+// To explicitly disable RELATIVE_REQUEST_TIMEOUT_POLICY support uncomment the following
+// #define TAO_HAS_RELATIVE_REQUEST_TIMEOUT_POLICY 0
+
+// Default RELATIVE_REQUEST_TIMEOUT_POLICY settings
+#if !defined (TAO_HAS_RELATIVE_REQUEST_TIMEOUT_POLICY)
+# if (TAO_HAS_CORBA_MESSAGING == 1) && \
+ (TAO_DISABLE_CORBA_MESSAGING_POLICIES == 0)
+# define TAO_HAS_RELATIVE_REQUEST_TIMEOUT_POLICY 1
+# else
+# define TAO_HAS_RELATIVE_REQUEST_TIMEOUT_POLICY 0
+# endif /* TAO_HAS_CORBA_MESSAGING == 1 &&
+ TAO_DISABLE_CORBA_MESSAGING_POLICIES == 0 */
+#endif /* !TAO_HAS_RELATIVE_REQUEST_TIMEOUT_POLICY */
+
+// To explicitly disable RELATIVE_ROUNDTRIP_TIMEOUT_POLICY support uncomment the following
+// #define TAO_HAS_RELATIVE_ROUNDTRIP_TIMEOUT_POLICY 0
+
+// Default RELATIVE_ROUNDTRIP_TIMEOUT_POLICY settings
+#if !defined (TAO_HAS_RELATIVE_ROUNDTRIP_TIMEOUT_POLICY)
+# if (TAO_HAS_CORBA_MESSAGING == 1) && \
+ (TAO_DISABLE_CORBA_MESSAGING_POLICIES == 0)
+# define TAO_HAS_RELATIVE_ROUNDTRIP_TIMEOUT_POLICY 1
+# else
+# define TAO_HAS_RELATIVE_ROUNDTRIP_TIMEOUT_POLICY 0
+# endif /* TAO_HAS_CORBA_MESSAGING == 1 &&
+ TAO_DISABLE_CORBA_MESSAGING_POLICIES == 0 */
+#endif /* !TAO_HAS_RELATIVE_ROUNDTRIP_TIMEOUT_POLICY */
+
+// Default CONNECTION_TIMEOUT_POLICY settings. This is a proprietary
+// TAO policy.
+#if !defined (TAO_HAS_CONNECTION_TIMEOUT_POLICY)
+# if (TAO_HAS_CORBA_MESSAGING == 1) && \
+ (TAO_DISABLE_CORBA_MESSAGING_POLICIES == 0)
+# define TAO_HAS_CONNECTION_TIMEOUT_POLICY 1
+# else
+# define TAO_HAS_CONNECTION_TIMEOUT_POLICY 0
+# endif /* TAO_HAS_CORBA_MESSAGING == 1 &&
+ TAO_DISABLE_CORBA_MESSAGING_POLICIES == 0 */
+#endif /* !TAO_HAS_CONNECTION_TIMEOUT_POLICY */
+
+
+// To explicitly disable ROUTING_POLICY support uncomment the following
+// #define TAO_HAS_ROUTING_POLICY 0
+
+// Default ROUTING_POLICY settings
+#if !defined (TAO_HAS_ROUTING_POLICY)
+# if (TAO_HAS_CORBA_MESSAGING == 1) && \
+ (TAO_DISABLE_CORBA_MESSAGING_POLICIES == 0)
+# define TAO_HAS_ROUTING_POLICY 1
+# else
+# define TAO_HAS_ROUTING_POLICY 0
+# endif /* TAO_HAS_CORBA_MESSAGING == 1 &&
+ TAO_DISABLE_CORBA_MESSAGING_POLICIES == 0 */
+#endif /* !TAO_HAS_ROUTING_POLICY */
+
+// To explicitly disable MAX_HOPS_POLICY support uncomment the following
+// #define TAO_HAS_MAX_HOPS_POLICY 0
+
+// Default MAX_HOPS_POLICY settings
+#if !defined (TAO_HAS_MAX_HOPS_POLICY)
+# if (TAO_HAS_CORBA_MESSAGING == 1) && \
+ (TAO_DISABLE_CORBA_MESSAGING_POLICIES == 0)
+# define TAO_HAS_MAX_HOPS_POLICY 1
+# else
+# define TAO_HAS_MAX_HOPS_POLICY 0
+# endif /* TAO_HAS_CORBA_MESSAGING == 1 &&
+ TAO_DISABLE_CORBA_MESSAGING_POLICIES == 0 */
+#endif /* !TAO_HAS_MAX_HOPS_POLICY */
+
+// To explicitly disable QUEUE_ORDER_POLICY support uncomment the following
+// #define TAO_HAS_QUEUE_ORDER_POLICY 0
+
+// Default QUEUE_ORDER_POLICY settings
+#if !defined (TAO_HAS_QUEUE_ORDER_POLICY)
+# if (TAO_HAS_CORBA_MESSAGING == 1) && \
+ (TAO_DISABLE_CORBA_MESSAGING_POLICIES == 0)
+# define TAO_HAS_QUEUE_ORDER_POLICY 1
+# else
+# define TAO_HAS_QUEUE_ORDER_POLICY 0
+# endif /* TAO_HAS_CORBA_MESSAGING == 1 &&
+ TAO_DISABLE_CORBA_MESSAGING_POLICIES == 0 */
+#endif /* !TAO_HAS_QUEUE_ORDER_POLICY */
+
+// To explicitly disable BUFFERING_CONSTRAINT_POLICY support uncomment the following
+// #define TAO_HAS_BUFFERING_CONSTRAINT_POLICY 0
+
+// Default BUFFERING_CONSTRAINT_POLICY settings
+#if !defined (TAO_HAS_BUFFERING_CONSTRAINT_POLICY)
+# if (TAO_HAS_CORBA_MESSAGING == 1) && \
+ (TAO_DISABLE_CORBA_MESSAGING_POLICIES == 0)
+# define TAO_HAS_BUFFERING_CONSTRAINT_POLICY 1
+# else
+# define TAO_HAS_BUFFERING_CONSTRAINT_POLICY 0
+# endif /* TAO_HAS_CORBA_MESSAGING == 1 &&
+ TAO_DISABLE_CORBA_MESSAGING_POLICIES == 0 */
+#endif /* !TAO_HAS_BUFFERING_CONSTRAINT_POLICY */
+
+// AMI support is enabled by default, unless TAO is compiled with
+// Minimum CORBA. In that case AMI is disabled by default.
+// If disabled you can also disable the CORBA MESSAGING support.
+// To explicitly enable AMI support uncomment the following
+// #define TAO_HAS_AMI 1
+// To explicitly disable AMI support uncomment the following
+// #define TAO_HAS_AMI 0
+
+// Default AMI settings
+#if !defined (TAO_HAS_AMI)
+# if (TAO_HAS_MINIMUM_CORBA == 1)
+# define TAO_HAS_AMI 0
+# else
+# define TAO_HAS_AMI 1
+# endif /* TAO_HAS_MINIMUM_CORBA */
+#else
+# if (TAO_HAS_AMI == 1) && \
+ (TAO_HAS_CORBA_MESSAGING == 0)
+# error "tao/orbconf.h: You need CORBA_MESSAGING for AMI support"
+# endif /* TAO_HAS_AMI == 1 &&
+ TAO_HAS_CORBA_MESSAGING == 0 */
+#endif /* !TAO_HAS_AMI */
+
+// We dont have AMI_POLLER support in TAO. Just prevent anyone from
+// using it.
+
+/***********************************************************/
+// All these are for future use. Commenting it..
+
+// #if !defined (TAO_HAS_AMI_POLLER)
+// # if (TAO_HAS_AMI == 1)
+// # define TAO_HAS_AMI_POLLER 1
+// # else
+// # define TAO_HAS_AMI_POLLER 0
+// # endif /* TAO_HAS_AMI == 1 */
+// #else
+// # if (TAO_HAS_AMI_POLLER == 1) && (TAO_HAS_CORBA_MESSAGING == 0)
+// # error "tao/orbconf.h: You need CORBA_MESSAGING for AMI support"
+// # endif /* TAO_HAS_AMI_POLLER == 1 &&
+// TAO_HAS_CORBA_MESSAGING == 0 */
+// #endif /* !TAO_HAS_AMI_POLLER */
+/***********************************************************/
+
+// AMI_CALLBACK support is disabled by default if TAO is not
+// configured for AMI. If TAO is configured for AMI, then
+// AMI_CALLBACK will be enabled by default. If enabled, it requires
+// CORBA_MESSAGING support.
+// To explicitly enable AMI_CALLBACK support uncomment the following
+// #define TAO_HAS_AMI_CALLBACK 1
+// To explicitly disable AMI_CALLBACK support uncomment the following
+// #define TAO_HAS_AMI_CALLBACK 0
+
+// Default AMI_CALLBACK settings
+#if !defined (TAO_HAS_AMI_CALLBACK)
+# if (TAO_HAS_AMI == 1)
+# define TAO_HAS_AMI_CALLBACK 1
+# else
+# define TAO_HAS_AMI_CALLBACK 0
+# endif /* TAO_HAS_AMI == 1 */
+#else
+# if (TAO_HAS_AMI_CALLBACK == 1) && \
+ (TAO_HAS_CORBA_MESSAGING == 0)
+# error "tao/orbconf.h: You need CORBA_MESSAGING for AMI support"
+# endif /* TAO_HAS_AMI_CALLBACK == 1 &&
+ TAO_HAS_CORBA_MESSAGING == 0 */
+#endif /* !TAO_HAS_AMI_CALLBACK */
+
+// Interceptors is supported by default if we are not building for
+// MinimumCORBA.
+#if !defined (TAO_HAS_INTERCEPTORS)
+# if (TAO_HAS_MINIMUM_CORBA == 1)
+# define TAO_HAS_INTERCEPTORS 0
+# else
+# define TAO_HAS_INTERCEPTORS 1
+# endif /* TAO_HAS_MINIMUM_CORBA */
+#endif
+
+// Proprietary FT interception-point support is disabled by default.
+#ifndef TAO_HAS_EXTENDED_FT_INTERCEPTORS
+# define TAO_HAS_EXTENDED_FT_INTERCEPTORS 0
+#endif /* !TAO_HAS_EXTENEDED_FT_INTERCEPTORS */
+
+// This is needed for a check in the Policy Set; Should really not be
+// here though; We should find a different way to handle the check in
+// the Policy Set.
+#define TAO_RT_SERVER_PROTOCOL_POLICY_TYPE 42
+
+/// Policies that are accessed on the critical path and need to be
+/// incur minimal retrieval overhead.
+enum TAO_Cached_Policy_Type
+{
+ TAO_CACHED_POLICY_UNCACHED = -1,
+ TAO_CACHED_POLICY_PRIORITY_MODEL = 0,
+ TAO_CACHED_POLICY_THREADPOOL,
+ TAO_CACHED_POLICY_RT_SERVER_PROTOCOL,
+ TAO_CACHED_POLICY_RT_CLIENT_PROTOCOL,
+ TAO_CACHED_POLICY_RT_PRIVATE_CONNECTION,
+ TAO_CACHED_POLICY_RT_PRIORITY_BANDED_CONNECTION,
+
+ TAO_CACHED_POLICY_LIFESPAN,
+ TAO_CACHED_POLICY_ID_UNIQUENESS,
+ TAO_CACHED_POLICY_ID_ASSIGNMENT,
+
+#if (TAO_HAS_MINIMUM_POA == 0)
+ TAO_CACHED_POLICY_THREAD,
+ TAO_CACHED_POLICY_IMPLICIT_ACTIVATION,
+ TAO_CACHED_POLICY_SERVANT_RETENTION,
+ TAO_CACHED_POLICY_REQUEST_PROCESSING,
+#endif /* TAO_HAS_MINIMUM_POA == 0 */
+
+#if (TAO_HAS_SYNC_SCOPE_POLICY == 1)
+ TAO_CACHED_POLICY_SYNC_SCOPE,
+#endif /* TAO_HAS_SYNC_SCOPE_POLICY == 1 */
+
+#if (TAO_HAS_RELATIVE_ROUNDTRIP_TIMEOUT_POLICY == 1)
+ TAO_CACHED_POLICY_RELATIVE_ROUNDTRIP_TIMEOUT,
+#endif /* TAO_HAS_RELATIVE_ROUNDTRIP_TIMEOUT_POLICY == 1 */
+
+#if (TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1)
+ TAO_CACHED_POLICY_BUFFERING_CONSTRAINT,
+#endif /* TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1 */
+
+#if (TAO_HAS_CONNECTION_TIMEOUT_POLICY == 1)
+ TAO_CACHED_POLICY_CONNECTION_TIMEOUT,
+#endif /* TAO_HAS_CONNECTION_TIMEOUT_POLICY == 1 */
+
+ TAO_CACHED_POLICY_BIDIRECTIONAL_GIOP,
+
+ TAO_CACHED_POLICY_MAX_CACHED,
+
+ TAO_CACHED_POLICY_ENDPOINT
+};
+
+// This enum provides a mask that represent the scope at which a given
+// policy can be applied
+enum TAO_Policy_Scope
+{
+ TAO_POLICY_OBJECT_SCOPE = 0x01,
+ TAO_POLICY_THREAD_SCOPE = 0x02,
+ TAO_POLICY_ORB_SCOPE = 0x04,
+ TAO_POLICY_POA_SCOPE = 0x08,
+ TAO_POLICY_CLIENT_EXPOSED = 0x10
+};
+
+#define TAO_POLICY_DEFAULT_SCOPE \
+ (static_cast<TAO_Policy_Scope> ( \
+ TAO_POLICY_OBJECT_SCOPE | \
+ TAO_POLICY_THREAD_SCOPE | \
+ TAO_POLICY_ORB_SCOPE | \
+ TAO_POLICY_POA_SCOPE))
+
+// Control the default version of GIOP used by TAO.
+// The ORB is always able to communicate with 1.0, 1.1 and 1.2
+// servers, and it creates 1.2 endpoints (and profiles). If you need
+// to talk to old clients that only understand 1.0 or 1.1 (and do not
+// attempt to use 1.0 or 1.1 with 1.2 servers), then change the values
+// below.
+#if !defined (TAO_DEF_GIOP_MAJOR)
+#define TAO_DEF_GIOP_MAJOR 1
+#endif /* TAO_DEF_GIOP_MAJOR */
+#if !defined (TAO_DEF_GIOP_MINOR)
+#define TAO_DEF_GIOP_MINOR 2
+#endif /* TAO_DEF_GIOP_MINOR */
+
+// Control the minimum required IIOP version for IPv6 support
+#if defined (ACE_HAS_IPV6)
+# if !defined (TAO_MIN_IPV6_IIOP_MAJOR)
+# define TAO_MIN_IPV6_IIOP_MAJOR 1
+# endif /* TAO_MIN_IPV6_IIOP_MAJOR */
+# if !defined (TAO_MIN_IPV6_IIOP_MINOR)
+# define TAO_MIN_IPV6_IIOP_MINOR 2
+# endif /* TAO_MIN_IPV6_IIOP_MINOR */
+#endif /* ACE_HAS_IPV6 */
+
+// @@todo this needs to be deprecated. Use TAO_MAXBUFSIZE instead.
+#if !defined (TAO_CONNECTION_HANDLER_STACK_BUF_SIZE)
+# define TAO_CONNECTION_HANDLER_STACK_BUF_SIZE 1024
+#endif /*TAO_CONNECTION_HANDLER_STACK_BUF_SIZE */
+
+// By default TAO generate the OMG standard profile components
+// (ORB_TYPE and CODE_SETS)
+#define TAO_STD_PROFILE_COMPONENTS
+
+#if !defined (TAO_DEFAULT_IOR_SIZE)
+// This is the default size of the buffer used for processing IORs.
+#define TAO_DEFAULT_IOR_SIZE 1024
+#endif /* TAO_DEFAULT_IOR_SIZE */
+
+#if !defined (TAO_DEFAULT_THREAD_PER_CONNECTION_TIMEOUT)
+// The default timeout value for the thread-per-connection model, in
+// milliseconds. The "INFINITE" value is magic and means blocking forever.
+#define TAO_DEFAULT_THREAD_PER_CONNECTION_TIMEOUT "5000"
+#endif /* TAO_DEFAULT_THREAD_PER_CONNECTION_TIMEOUT */
+
+/// By default we use Muxed Transports
+#if !defined (TAO_USE_MUXED_TRANSPORT_MUX_STRATEGY)
+# define TAO_USE_MUXED_TRANSPORT_MUX_STRATEGY 1
+#endif /* TAO_USE_MUXED_TRANSPORT_MUX_STRATEGY */
+
+/// By default we use multicast lookup
+#if !defined(TAO_DEFAULT_INIT_REFERENCE_INITIALIZER)
+# define TAO_DEFAULT_INIT_REFERENCE_INITIALIZER "mcast://:::"
+#endif /* TAO_DEFAULT_INIT_REFERENCE_INITIALIZER */
+
+/// By default we dont use lazy strategy
+#if !defined (TAO_USE_LAZY_RESOURCE_USAGE_STRATEGY)
+# define TAO_USE_LAZY_RESOURCE_USAGE_STRATEGY 0
+#endif /* TAO_USE_LAZY_RESOURCE_USAGE_STRATEGY*/
+
+#if !defined (TAO_USE_LOCAL_MEMORY_POOL)
+# define TAO_USE_LOCAL_MEMORY_POOL 1
+#endif /* TAO_USE_LOCAL_MEMORY_POOL */
+
+#if !defined (TAO_USE_OUTPUT_CDR_MMAP_MEMORY_POOL)
+# define TAO_USE_OUTPUT_CDR_MMAP_MEMORY_POOL 0
+#endif /* TAO_USE_LOCAL_MEMORY_POOL */
+
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_ORBCONF_H */
diff --git a/TAO/tao/params.cpp b/TAO/tao/params.cpp
new file mode 100644
index 00000000000..136f8261724
--- /dev/null
+++ b/TAO/tao/params.cpp
@@ -0,0 +1,312 @@
+// $Id$
+
+#include "tao/params.h"
+#include "tao/orbconf.h"
+
+#if !defined (__ACE_INLINE__)
+# include "tao/params.i"
+#endif /* __ACE_INLINE__ */
+
+#include "ace/OS_NS_Thread.h"
+
+
+ACE_RCSID (tao,
+ params,
+ "$Id$")
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+TAO_ORB_Parameters::TAO_ORB_Parameters (void)
+ : endpoints_map_ (10)
+ , mcast_discovery_endpoint_ ()
+ , default_init_ref_ (TAO_DEFAULT_INIT_REFERENCE_INITIALIZER)
+ , sock_rcvbuf_size_ (ACE_DEFAULT_MAX_SOCKET_BUFSIZ)
+ , sock_sndbuf_size_ (ACE_DEFAULT_MAX_SOCKET_BUFSIZ)
+ , nodelay_ (1)
+ , sock_keepalive_ (0)
+ , sock_dontroute_ (0)
+ , cdr_memcpy_tradeoff_ (ACE_DEFAULT_CDR_MEMCPY_TRADEOFF)
+ , max_message_size_ (0) // Disable outgoing GIOP fragments by default
+ , use_lite_protocol_ (0)
+ , use_dotted_decimal_addresses_ (0)
+ , cache_incoming_by_dotted_decimal_address_ (0)
+ , linger_ (-1)
+ , std_profile_components_ (1)
+ , ace_sched_policy_ (ACE_SCHED_OTHER)
+ , sched_policy_ (THR_SCHED_DEFAULT)
+ , scope_policy_ (THR_SCOPE_PROCESS)
+ , single_read_optimization_ (1)
+ , shared_profile_ (0)
+ , use_parallel_connects_ (false)
+ , parallel_connect_delay_ (0)
+ , pref_network_ ()
+ , disable_rt_collocation_resolver_ (false)
+ , enforce_preferred_interfaces_ (false)
+#if defined (ACE_HAS_IPV6)
+ , prefer_ipv6_interfaces_ (false)
+ , connect_ipv6_only_ (false)
+#endif /* ACE_HAS_IPV6 */
+ , negotiate_codesets_ (true)
+{
+ for (int i = 0; i != TAO_NO_OF_MCAST_SERVICES; ++i)
+ {
+ this->service_port_[i] = 0;
+ }
+}
+
+void
+TAO_ORB_Parameters::get_endpoint_set (const ACE_CString &lane,
+ TAO_EndpointSet &endpoint_set)
+{
+ // Look for the lane in the endpoints map.
+ endpoints_map_type::iterator const endpoints =
+ this->endpoints_map_.find (lane);
+
+ // If lane is not in the map, <endpoint_set> remains empty
+ if (endpoints == this->endpoints_map_.end ())
+ return;
+
+ // At this point, the parsing should not fail since they have been
+ // parsed successfully before.
+ int const result =
+ this->parse_and_add_endpoints ((*endpoints).second,
+ endpoint_set);
+
+ ACE_ASSERT (result == 0);
+ ACE_UNUSED_ARG (result);
+}
+
+int
+TAO_ORB_Parameters::add_endpoints (const ACE_CString &lane,
+ const ACE_CString &additional_endpoints)
+{
+ TAO_EndpointSet endpoint_set;
+
+ // Parse the additional endpoints.
+ int const result =
+ this->parse_and_add_endpoints (additional_endpoints,
+ endpoint_set);
+
+ // Parse failure.
+ if (result != 0)
+ return result;
+
+ // Look for the lane in the endpoints map.
+ //
+ // Return reference to endpoints string corresponding to lane
+ // string. If none, a default constructed string is inserted into
+ // the map and returned.
+ ACE_CString & existing_endpoints = this->endpoints_map_[lane];
+
+ // Create the resulting endpoints string.
+ if (existing_endpoints.length () != 0)
+ {
+ existing_endpoints += ";";
+ }
+
+ existing_endpoints += additional_endpoints;
+
+ return 0;
+}
+
+int
+TAO_ORB_Parameters::parse_and_add_endpoints (const ACE_CString &endpoints,
+ TAO_EndpointSet &endpoint_set)
+{
+ // Parse the string into seperate endpoints, where `endpoints' is of
+ // the form:
+ //
+ // protocol1://V,v@addr1,...,addrN;protocol2://addr1,...,W.w@addrN;...
+ //
+ // A single endpoint, instead of several, can be added just as well.
+
+ static char const endpoints_delimiter = ';';
+
+ size_t const length = endpoints.length ();
+
+ if (endpoints[0] == endpoints_delimiter ||
+ endpoints[length - 1] == endpoints_delimiter)
+ {
+ return -1;
+ // Failure: endpoints string has an empty endpoint at the
+ // beginning or the end of the string
+ // (e.g. ";uiop://foo;iiop://1.3@bar")
+ }
+
+ int status = 0;
+ // Return code: 0 = success, -1 = failure
+
+ if (length > 0)
+ {
+ int endpoints_count = 1;
+
+ for (size_t j = 0; j != length; ++j)
+ {
+ if (endpoints[j] == endpoints_delimiter)
+ {
+ ++endpoints_count;
+ }
+ }
+
+ ssize_t begin = 0;
+ ssize_t end = endpoints.find (endpoints_delimiter);
+
+ for (int i = 0; i < endpoints_count; ++i)
+ {
+ if (end == 0)
+ {
+ // Handle case where two consecutive endpoints `;;'
+ // delimiters are found within the endpoints set.
+ //
+ // Is it enough to just skip over it or should we return an
+ // error?
+ continue;
+ }
+
+ ACE_CString const endpt =
+ endpoints.substring (begin, end - begin);
+ // The substring call will work even if `end' is equal to
+ // ACE_CString::npos since that will just extract the substring
+ // from the offset `begin' to the end of the string.
+
+ // Check for a valid URL style endpoint set
+ ACE_CString::size_type const check_offset = endpt.find ("://");
+
+ if (check_offset > 0 &&
+ check_offset != endpt.npos)
+ {
+ endpoint_set.enqueue_tail (endpt);
+ // Insert endpoint into list
+ }
+ else
+ {
+ status = -1; // Error: invalid URL style endpoint set
+ }
+
+ begin = end + 1;
+ end = endpoints.find (endpoints_delimiter, begin);
+ }
+ }
+ else
+ {
+ status = -1;
+ // Failure: Empty string
+ }
+
+ return status;
+}
+
+bool
+TAO_ORB_Parameters::preferred_interfaces (const char *s)
+{
+ // Validates that s contains one or more comma separated
+ // interfaces each consisting of a string with a single
+ // assignment separator ('=' or ':')
+ // Any other char is legal, although '*' and '?' will be
+ // treated as wildcards.
+ const char* p = s;
+ bool expect_assign = false;
+ bool expect_comma = false;
+ bool expect_char = true;
+ bool expect_wild = true;
+ bool found_remote = false;
+ while (*p != 0)
+ {
+ switch (*p)
+ {
+#if !defined (ACE_HAS_IPV6)
+ // Can't use this as assignment operator when IPv6 decimal
+ // addresses may be involved.
+ case ':':
+#endif /* ACE_HAS_IPV6 */
+ case '=':
+ if (! expect_assign)
+ return false;
+ found_remote = true;
+ expect_assign = false;
+ expect_char = true;
+ expect_comma = false;
+ expect_wild = true;
+ break;
+ case ',':
+ if (! expect_comma)
+ return false;
+ found_remote = false;
+ expect_assign = false;
+ expect_char = true;
+ expect_comma = false;
+ expect_wild = true;
+ break;
+ case '*':
+ case '?':
+ if (! expect_wild)
+ return false;
+ expect_assign = ! found_remote;
+ expect_char = true;
+ expect_comma = found_remote;
+ expect_wild = false;
+ break;
+ default:
+ if (! expect_char)
+ return false;
+ expect_assign = ! found_remote;
+ expect_char = true;
+ expect_comma = found_remote;
+ expect_wild = true;
+ break;
+ }
+ ++p;
+ }
+ if (!expect_comma || expect_assign)
+ return false;
+
+ this->pref_network_ = s;
+
+ return true;
+}
+
+const char *
+TAO_ORB_Parameters::preferred_interfaces (void) const
+{
+ return this->pref_network_.c_str ();
+}
+
+void
+TAO_ORB_Parameters::enforce_pref_interfaces (bool p)
+{
+ this->enforce_preferred_interfaces_ = p;
+}
+
+bool
+TAO_ORB_Parameters::enforce_pref_interfaces (void) const
+{
+ return this->enforce_preferred_interfaces_;
+}
+
+#if defined (ACE_HAS_IPV6)
+void
+TAO_ORB_Parameters::prefer_ipv6_interfaces (bool p)
+{
+ this->prefer_ipv6_interfaces_ = p;
+}
+
+bool
+TAO_ORB_Parameters::prefer_ipv6_interfaces (void) const
+{
+ return this->prefer_ipv6_interfaces_;
+}
+
+void
+TAO_ORB_Parameters::connect_ipv6_only (bool p)
+{
+ this->connect_ipv6_only_ = p;
+}
+
+bool
+TAO_ORB_Parameters::connect_ipv6_only (void) const
+{
+ return this->connect_ipv6_only_;
+}
+#endif /* ACE_HAS_IPV6 */
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/params.h b/TAO/tao/params.h
new file mode 100644
index 00000000000..efefb62845f
--- /dev/null
+++ b/TAO/tao/params.h
@@ -0,0 +1,375 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file params.h
+ *
+ * $Id$
+ *
+ * @author Chris Cleeland
+ */
+//=============================================================================
+
+#ifndef TAO_PARAMS_H
+#define TAO_PARAMS_H
+
+#include /**/ "ace/pre.h"
+#include "ace/Unbounded_Queue.h"
+#include "ace/Array_Map.h"
+#include "ace/Synch.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/SString.h"
+
+#include "tao/objectid.h"
+#include "tao/CORBA_String.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+// Forward decls.
+
+// @@ Using an ACE_Unbounded_Queue to contain the endpoints and
+// preconnects may not be the best container to use. However, it
+// will only be used during ORB bootstrapping. Also, a template
+// instantiation of ACE_Unbounded_Queue<ACE_CString> already exists
+// in ACE so we do not have to worry about increasing TAO's
+// footprint by using this container.
+typedef ACE_Unbounded_Queue<ACE_CString> TAO_EndpointSet;
+typedef ACE_Unbounded_Queue_Const_Iterator<ACE_CString> TAO_EndpointSetIterator;
+
+// -------------------------------------------------------------------
+
+/**
+ * @class TAO_ORB_Parameters
+ *
+ * @brief Parameters that are specific to the ORB. These parameters can
+ * be for the client, the server, or for both.
+ */
+class TAO_Export TAO_ORB_Parameters
+{
+public:
+
+ typedef ACE_Array_Map<ACE_CString, ACE_CString> endpoints_map_type;
+
+ /// Constructor.
+ TAO_ORB_Parameters (void);
+
+ /// Specifies the endpoints on which this server is willing to
+ /// listen for requests.
+ int add_endpoints (const ACE_CString &lane,
+ const ACE_CString &endpoints);
+ void get_endpoint_set (const ACE_CString &lane,
+ TAO_EndpointSet &endpoint_set);
+
+ /// Set/Get the port of services locatable through multicast.
+ CORBA::UShort service_port (TAO::MCAST_SERVICEID service_id) const;
+ void service_port (TAO::MCAST_SERVICEID service_id, CORBA::UShort port);
+
+ /// Get/Set address:port for Multicast Discovery Protocol for
+ /// the Naming Service.
+ const char *mcast_discovery_endpoint (void) const;
+ void mcast_discovery_endpoint (const char *mde);
+
+ /// Set/Get the size to be used for a socket's receive buffer.
+ int sock_rcvbuf_size (void) const;
+ void sock_rcvbuf_size (int);
+
+ /// Set/Get the size to be used for a socket's send buffer.
+ int sock_sndbuf_size (void) const;
+ void sock_sndbuf_size (int);
+
+ /// Set/Get the status of whether to use TCP_NODELAY or not.
+ int nodelay (void) const;
+ void nodelay (int);
+
+ /// Set/Get whether we should set SO_KEEPALIVE on the socket or not.
+ int sock_keepalive (void);
+ void sock_keepalive (int);
+
+ /// Set/Get whether we should set SO_DONTROUTE on the socket or not.
+ int sock_dontroute (void);
+ void sock_dontroute (int);
+
+ /**
+ * Octet sequences are marshalled without doing any copies, we
+ * simply append a block to the CDR message block chain. When the
+ * octet sequence is small enough and there is room in the current
+ * message block it is more efficient just to copy the buffer.
+ */
+ int cdr_memcpy_tradeoff (void) const;
+ void cdr_memcpy_tradeoff (int);
+
+ /**
+ * Maximum size of a GIOP message before outgoing fragmentation
+ * kicks in.
+ */
+ //@{
+ ACE_CDR::ULong max_message_size (void) const;
+ void max_message_size (ACE_CDR::ULong size);
+ //@}
+
+ /// The ORB will use the dotted decimal notation for addresses. By
+ /// default we use the full ascii names.
+ int use_dotted_decimal_addresses (void) const;
+ void use_dotted_decimal_addresses (int);
+
+ /// The ORB will cache incoming connections against the dotted
+ /// decimal form of the peer's address
+ int cache_incoming_by_dotted_decimal_address (void) const;
+ void cache_incoming_by_dotted_decimal_address (int);
+
+ /// The ORB will turn off SO_LINGER if this is zero.
+ int linger (void) const;
+ void linger (int);
+
+ /// Set/Get the Init Reference of an arbitrary ObjectID.
+ char *default_init_ref (void) const;
+ void default_init_ref (const char *default_init_ref);
+
+ /// Disable the OMG standard profile components, useful for
+ /// homogenous environments.
+ int std_profile_components (void) const;
+ void std_profile_components (int x);
+
+ /// Scheduling policy.
+ /**
+ * Scheduling policy specified by the user through the
+ * -ORBSchedPolicy option. This value is typically used by
+ * functions like ACE_OS::thr_setprio() and
+ * ACE_Sched_Params::priority_min(). Legal values are ACE_SCHED_RR,
+ * ACE_SCHED_FIFO, and ACE_SCHED_OTHER.
+ */
+ int ace_sched_policy (void) const;
+ void ace_sched_policy (int x);
+
+ /// Scheduling policy flag.
+ /**
+ * Scheduling policy specified by the user through the
+ * -ORBSchedPolicy option. This value is typically used by ACE
+ * thread creation functions. Legal values are THR_SCHED_RR,
+ * THR_SCHED_FIFO, and THR_SCHED_DEFAULT.
+ */
+ long sched_policy (void) const;
+ void sched_policy (long x);
+
+ /// Scheduling scope flag.
+ /**
+ * Scheduling policy specified by the user through the
+ * -ORBScopePolicy option. This value is typically used by ACE
+ * thread creation functions. Legal values are THR_SCOPE_SYSTEM and
+ * THR_SCOPE_PROCESS.
+ */
+ long scope_policy (void) const;
+ void scope_policy (long x);
+
+ /// Thread creation flags.
+ /**
+ * Shorthand for OR'ing together the scope_policy and sched_policy.
+ */
+ long thread_creation_flags (void) const;
+
+ /// Single read optimization.
+ int single_read_optimization (void) const;
+ void single_read_optimization (int x);
+
+ /// Create shared profiles without priority
+ int shared_profile (void) const;
+ void shared_profile (int x);
+
+ /// Want to use parallel connection attempts when profiles have multiple
+ /// endpoints.
+ bool use_parallel_connects(void) const;
+ void use_parallel_connects (bool x);
+
+ /// The milliseconds delay used to stagger individual connection starts
+ /// when using parallel connects.
+ unsigned long parallel_connect_delay (void) const;
+ void parallel_connect_delay (unsigned long x);
+
+ /// Mutators and accessors for rt_collocation_resolver
+ bool disable_rt_collocation_resolver (void) const;
+ void disable_rt_collocation_resolver (bool);
+
+ /// Accepts the list of preferred interfaces and does a simple
+ /// semantic check on the string
+ bool preferred_interfaces (const char *s);
+ const char *preferred_interfaces (void) const;
+
+ void enforce_pref_interfaces (bool p);
+ bool enforce_pref_interfaces (void) const;
+
+#if defined (ACE_HAS_IPV6)
+ void prefer_ipv6_interfaces (bool p);
+ bool prefer_ipv6_interfaces (void) const;
+
+ void connect_ipv6_only (bool p);
+ bool connect_ipv6_only (void) const;
+#endif /* ACE_HAS_IPV6 */
+
+ void negotiate_codesets (bool c);
+ bool negotiate_codesets (void) const;
+
+private:
+ // Each "endpoint" is of the form:
+ //
+ // protocol://V.v@addr1,...,W.w@addrN/
+ //
+ // or:
+ //
+ // protocol://addr1,addr2,...,addrN/
+ //
+ // where "V.v" and "W.w" are optional versions.
+ //
+ // Multiple sets of endpoints may be seperated by a semi-colon `;'.
+ // For example:
+ //
+ // iiop://space:2001,odyssey:2010;uiop://foo,bar
+ //
+ // All preconnect or endpoint strings should be of the above form(s).
+ int parse_and_add_endpoints (const ACE_CString &endpoints,
+ TAO_EndpointSet &endpoint_set);
+
+ /// Map of endpoints this server is willing to accept requests on.
+ endpoints_map_type endpoints_map_;
+
+ /// Port numbers of the configured services.
+ CORBA::UShort service_port_[TAO_NO_OF_MCAST_SERVICES];
+
+ /// Address:port for Multicast Discovery Protocol for the Naming
+ /// Service.
+ CORBA::String_var mcast_discovery_endpoint_;
+
+ /// List of comma separated prefixes from ORBDefaultInitRef.
+ ACE_CString default_init_ref_;
+
+ /// Size to be used for a socket's receive buffer.
+ int sock_rcvbuf_size_;
+
+ /// Size to be used for a socket's send buffer.
+ int sock_sndbuf_size_;
+
+ /// 1 if we're using TCP_NODELAY and 0 otherwise.
+ int nodelay_;
+
+ /// 1 if we're using SO_KEEPALIVE and 0 otherwise (default 0).
+ int sock_keepalive_;
+
+ /// 1 if we're using SO_DONTROUTE and 0 otherwise (default 0).
+ int sock_dontroute_;
+
+ /// Control the strategy for copying vs. appeding octet sequences in
+ /// CDR streams.
+ int cdr_memcpy_tradeoff_;
+
+ /// Maximum GIOP message size to be sent over a given transport.
+ /**
+ * Setting a maximum message size will cause outgoing GIOP
+ * fragmentation to be enabled.
+ */
+ ACE_CDR::ULong max_message_size_;
+
+ /// For selecting a liteweight version of the GIOP protocol.
+ int use_lite_protocol_;
+
+ /// For selecting a address notation
+ int use_dotted_decimal_addresses_;
+
+ /// If incoming connections should be cached against IP (true) or
+ /// hostname (false).
+ int cache_incoming_by_dotted_decimal_address_;
+
+ /// For setting the SO_LINGER option
+ int linger_;
+
+ /// If true then the standard OMG components are not generated.
+ int std_profile_components_;
+
+ /// Scheduling policy.
+ /**
+ * Scheduling policy specified by the user through the
+ * -ORBSchedPolicy option. This value is typically used by
+ * functions like ACE_OS::thr_setprio() and
+ * ACE_Sched_Params::priority_min(). Legal values are ACE_SCHED_RR,
+ * ACE_SCHED_FIFO, and ACE_SCHED_OTHER.
+ */
+ int ace_sched_policy_;
+
+ /// Scheduling policy flag.
+ /**
+ * Scheduling policy specified by the user through the
+ * -ORBSchedPolicy option. This value is typically used by ACE
+ * thread creation functions. Legal values are THR_SCHED_RR,
+ * THR_SCHED_FIFO, and THR_SCHED_DEFAULT.
+ */
+ long sched_policy_;
+
+ /// Scheduling scope flag.
+ /**
+ * Scheduling policy specified by the user through the
+ * -ORBScopePolicy option. This value is typically used by ACE
+ * thread creation functions. Legal values are THR_SCOPE_SYSTEM and
+ * THR_SCOPE_PROCESS.
+ */
+ long scope_policy_;
+
+ /// Single read optimization.
+ int single_read_optimization_;
+
+ /// Shared Profile - Use the same profile for multiple endpoints
+ int shared_profile_;
+
+ /// Use Parallel Connects - Try to connect to all endpoints in a
+ /// shared profile at once, use the first to complete.
+ int use_parallel_connects_;
+
+ /// When using parallel connects, this delay is used to stagger connection
+ /// attempts. This gives a trade-off between opening more potential
+ /// connections than necessary vs increasing the potential time before
+ /// a good connection is discovered. Time is expressed in milliseconds.
+ unsigned long parallel_connect_delay_;
+
+ /// Preferred network interfaces as a string
+ ACE_CString pref_network_;
+
+ /// Default collocation resolver
+ /**
+ * The vanilla ORB has only one collocation resolver. But if the
+ * RTORB is in place, the RTORB can get in a new collocation
+ * resolver. There are some applications that would like to use the
+ * default collocation resolver with the RTORB. This boolean is the
+ * value of the option that the application passes in to enable/disable
+ * the use of RT collocation resolver with the RTORB. The default value
+ * is false to indicate that the RT_Collocation_Resolver will be
+ * loaded if the RTORB is used.
+ */
+ bool disable_rt_collocation_resolver_;
+
+ bool enforce_preferred_interfaces_;
+
+#if defined (ACE_HAS_IPV6)
+ /// Prefer to connect IPv6 over IPv4 Yes or No.
+ bool prefer_ipv6_interfaces_;
+
+ /**
+ * Only connect to (client) or listen on and accept from (server)
+ * IPv6 interfaces Yes or No.
+ */
+ bool connect_ipv6_only_;
+#endif /* ACE_HAS_IPV6 */
+
+ /// Enable the use of codeset negotiation
+ bool negotiate_codesets_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+# include "tao/params.i"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_PARAMS_H */
diff --git a/TAO/tao/params.i b/TAO/tao/params.i
new file mode 100644
index 00000000000..04e3f7575ec
--- /dev/null
+++ b/TAO/tao/params.i
@@ -0,0 +1,294 @@
+// -*- C++ -*-
+//
+// $Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE int
+TAO_ORB_Parameters::sock_rcvbuf_size (void) const
+{
+ return sock_rcvbuf_size_;
+}
+
+ACE_INLINE void
+TAO_ORB_Parameters::sock_rcvbuf_size (int s)
+{
+ sock_rcvbuf_size_ = s;
+}
+
+ACE_INLINE int
+TAO_ORB_Parameters::sock_sndbuf_size (void) const
+{
+ return sock_sndbuf_size_;
+}
+
+ACE_INLINE void
+TAO_ORB_Parameters::sock_sndbuf_size (int s)
+{
+ sock_sndbuf_size_ = s;
+}
+
+ACE_INLINE int
+TAO_ORB_Parameters::cdr_memcpy_tradeoff (void) const
+{
+ return this->cdr_memcpy_tradeoff_;
+}
+
+ACE_INLINE void
+TAO_ORB_Parameters::cdr_memcpy_tradeoff (int x)
+{
+ this->cdr_memcpy_tradeoff_ = x;
+}
+
+ACE_INLINE ACE_CDR::ULong
+TAO_ORB_Parameters::max_message_size (void) const
+{
+ return this->max_message_size_;
+}
+
+ACE_INLINE void
+TAO_ORB_Parameters::max_message_size (ACE_CDR::ULong size)
+{
+ this->max_message_size_ = size;
+}
+
+ACE_INLINE int
+TAO_ORB_Parameters::use_dotted_decimal_addresses (void) const
+{
+ return this->use_dotted_decimal_addresses_;
+}
+
+ACE_INLINE void
+TAO_ORB_Parameters::use_dotted_decimal_addresses (int x)
+{
+ this->use_dotted_decimal_addresses_ = x;
+}
+
+ACE_INLINE int
+TAO_ORB_Parameters::cache_incoming_by_dotted_decimal_address (void) const
+{
+ return this->cache_incoming_by_dotted_decimal_address_;
+}
+
+ACE_INLINE void
+TAO_ORB_Parameters::cache_incoming_by_dotted_decimal_address (int x)
+{
+ this->cache_incoming_by_dotted_decimal_address_ = x;
+}
+
+ACE_INLINE int
+TAO_ORB_Parameters::linger (void) const
+{
+ return this->linger_;
+}
+
+ACE_INLINE void
+TAO_ORB_Parameters::linger (int x)
+{
+ this->linger_ = x;
+}
+
+
+ACE_INLINE void
+TAO_ORB_Parameters::service_port (TAO::MCAST_SERVICEID service_id,
+ CORBA::UShort port)
+{
+ this->service_port_[service_id] = port;
+}
+
+ACE_INLINE CORBA::UShort
+TAO_ORB_Parameters::service_port (TAO::MCAST_SERVICEID service_id) const
+{
+ return this->service_port_[service_id];
+}
+
+ACE_INLINE void
+TAO_ORB_Parameters::mcast_discovery_endpoint (const char *mde)
+{
+ this->mcast_discovery_endpoint_ = CORBA::string_dup (mde);
+}
+
+ACE_INLINE const char *
+TAO_ORB_Parameters::mcast_discovery_endpoint (void) const
+{
+ return this->mcast_discovery_endpoint_.in ();
+}
+
+ACE_INLINE void
+TAO_ORB_Parameters::default_init_ref (const char *default_init_ref)
+{
+ this->default_init_ref_ = default_init_ref;
+}
+
+ACE_INLINE char *
+TAO_ORB_Parameters::default_init_ref (void) const
+{
+ return CORBA::string_dup (this->default_init_ref_.c_str ());
+}
+
+ACE_INLINE int
+TAO_ORB_Parameters::std_profile_components (void) const
+{
+ return this->std_profile_components_;
+}
+
+ACE_INLINE void
+TAO_ORB_Parameters::std_profile_components (int x)
+{
+ this->std_profile_components_ = x;
+}
+
+ACE_INLINE int
+TAO_ORB_Parameters::nodelay (void) const
+{
+ return this->nodelay_;
+}
+
+ACE_INLINE void
+TAO_ORB_Parameters::nodelay (int x)
+{
+ this->nodelay_ = x;
+}
+
+ACE_INLINE int
+TAO_ORB_Parameters::sock_keepalive (void)
+{
+ return this->sock_keepalive_;
+}
+
+ACE_INLINE void
+TAO_ORB_Parameters::sock_keepalive (int x)
+{
+ this->sock_keepalive_ = x;
+}
+
+ACE_INLINE int
+TAO_ORB_Parameters::sock_dontroute (void)
+{
+ return this->sock_dontroute_;
+}
+
+ACE_INLINE void
+TAO_ORB_Parameters::sock_dontroute (int x)
+{
+ this->sock_dontroute_ = x;
+}
+
+ACE_INLINE int
+TAO_ORB_Parameters::ace_sched_policy (void) const
+{
+ return this->ace_sched_policy_;
+}
+
+ACE_INLINE void
+TAO_ORB_Parameters::ace_sched_policy (int x)
+{
+ this->ace_sched_policy_ = x;
+}
+
+ACE_INLINE long
+TAO_ORB_Parameters::sched_policy (void) const
+{
+ return this->sched_policy_;
+}
+
+ACE_INLINE void
+TAO_ORB_Parameters::sched_policy (long x)
+{
+ this->sched_policy_ = x;
+}
+
+ACE_INLINE long
+TAO_ORB_Parameters::scope_policy (void) const
+{
+ return this->scope_policy_;
+}
+
+ACE_INLINE void
+TAO_ORB_Parameters::scope_policy (long x)
+{
+ this->scope_policy_ = x;
+}
+
+ACE_INLINE long
+TAO_ORB_Parameters::thread_creation_flags (void) const
+{
+ return
+ this->scope_policy () |
+ this->sched_policy ();
+}
+
+ACE_INLINE int
+TAO_ORB_Parameters::single_read_optimization (void) const
+{
+ return this->single_read_optimization_;
+}
+
+ACE_INLINE void
+TAO_ORB_Parameters::single_read_optimization (int x)
+{
+ this->single_read_optimization_ = x;
+}
+
+ACE_INLINE bool
+TAO_ORB_Parameters::use_parallel_connects (void) const
+{
+ return this->use_parallel_connects_;
+}
+
+ACE_INLINE void
+TAO_ORB_Parameters::use_parallel_connects (bool x)
+{
+ this->use_parallel_connects_ = x;
+}
+
+ACE_INLINE unsigned long
+TAO_ORB_Parameters::parallel_connect_delay (void) const
+{
+ return this->parallel_connect_delay_;
+}
+
+ACE_INLINE void
+TAO_ORB_Parameters::parallel_connect_delay (unsigned long x)
+{
+ this->parallel_connect_delay_ = x;
+}
+
+ACE_INLINE int
+TAO_ORB_Parameters::shared_profile (void) const
+{
+ return this->shared_profile_;
+}
+
+ACE_INLINE void
+TAO_ORB_Parameters::shared_profile (int x)
+{
+ this->shared_profile_ = x;
+}
+
+ACE_INLINE bool
+TAO_ORB_Parameters::disable_rt_collocation_resolver (void) const
+{
+ return this->disable_rt_collocation_resolver_;
+}
+
+ACE_INLINE void
+TAO_ORB_Parameters::disable_rt_collocation_resolver (bool x)
+{
+ this->disable_rt_collocation_resolver_ = x;
+}
+
+
+ACE_INLINE bool
+TAO_ORB_Parameters::negotiate_codesets (void) const
+{
+ return this->negotiate_codesets_;
+}
+
+ACE_INLINE void
+TAO_ORB_Parameters::negotiate_codesets (bool x)
+{
+ this->negotiate_codesets_ = x;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/tao.mpc b/TAO/tao/tao.mpc
new file mode 100644
index 00000000000..0e27e192668
--- /dev/null
+++ b/TAO/tao/tao.mpc
@@ -0,0 +1,638 @@
+//$Id$
+
+project(TAO) : acelib, core, tao_output, taodefaults, pidl, extra_core, tao_versioning_idl_defaults, corba_e_micro, corba_e_compact, core_minimum_corba, tao_no_iiop {
+ sharedname = TAO
+ dynamicflags = TAO_BUILD_DLL
+
+ Source_Files(TAO_COMPONENTS) {
+ Abstract_Servant_Base.cpp
+ Acceptor_Filter.cpp
+ Acceptor_Registry.cpp
+ Adapter.cpp
+ Adapter_Factory.cpp
+ Adapter_Registry.cpp
+ AnyTypeCode_Adapter.cpp
+ Argument.cpp
+ Asynch_Queued_Message.cpp
+ Asynch_Reply_Dispatcher_Base.cpp
+ Base_Transport_Property.cpp
+ BiDir_Adapter.cpp
+ Bind_Dispatcher_Guard.cpp
+ Block_Flushing_Strategy.cpp
+ Blocked_Connect_Strategy.cpp
+ BooleanSeqC.cpp
+ Cache_Entries.cpp
+ CDR.cpp
+ CharSeqC.cpp
+ Cleanup_Func_Registry.cpp
+ Client_Strategy_Factory.cpp
+ ClientRequestInterceptor_Adapter_Factory.cpp
+ ClientRequestInterceptor_Adapter.cpp
+ Codeset_Manager.cpp
+ Codeset_Manager_Factory_Base.cpp
+ Codeset_Translator_Base.cpp
+ Collocated_Invocation.cpp
+ Collocation_Proxy_Broker.cpp
+ Collocation_Resolver.cpp
+ Configurable_Refcount.cpp
+ Connect_Strategy.cpp
+ Connection_Handler.cpp
+ Connection_Purging_Strategy.cpp
+ Connector_Registry.cpp
+ CONV_FRAMEC.cpp
+ CORBA_String.cpp
+ CORBALOC_Parser.cpp
+ CORBANAME_Parser.cpp
+ CurrentC.cpp
+ debug.cpp
+ default_client.cpp
+ Default_Collocation_Resolver.cpp
+ Default_Endpoint_Selector_Factory.cpp
+ Default_Protocols_Hooks.cpp
+ default_resource.cpp
+ default_server.cpp
+ Default_Stub_Factory.cpp
+ Default_Thread_Lane_Resources_Manager.cpp
+ DLL_Parser.cpp
+ DomainC.cpp
+ DoubleSeqC.cpp
+ Dynamic_Adapter.cpp
+ Endpoint.cpp
+ Endpoint_Selector_Factory.cpp
+ Environment.cpp
+ Exception.cpp
+ Exclusive_TMS.cpp
+ Fault_Tolerance_Service.cpp
+ FILE_Parser.cpp
+ FloatSeqC.cpp
+ Flushing_Strategy.cpp
+ GIOP_Fragmentation_Strategy.cpp
+ GIOP_Message_Base.cpp
+ GIOP_Message_Generator_Parser.cpp
+ GIOP_Message_Generator_Parser_10.cpp
+ GIOP_Message_Generator_Parser_11.cpp
+ GIOP_Message_Generator_Parser_12.cpp
+ GIOP_Message_Generator_Parser_Impl.cpp
+ GIOP_Message_Lite.cpp
+ GIOP_Message_Locate_Header.cpp
+ GIOP_Message_State.cpp
+ GIOP_Message_Version.cpp
+ GIOP_Utils.cpp
+ GIOPC.cpp
+ IFR_Client_Adapter.cpp
+ IIOP_Acceptor.cpp
+ IIOP_Connection_Handler.cpp
+ IIOP_Connector.cpp
+ IIOP_Endpoint.cpp
+ IIOP_EndpointsC.cpp
+ IIOP_Factory.cpp
+ IIOP_Lite_Factory.cpp
+ IIOP_Profile.cpp
+ IIOP_Transport.cpp
+ IIOPC.cpp
+ Incoming_Message_Queue.cpp
+ Incoming_Message_Stack.cpp
+ Invocation_Adapter.cpp
+ Invocation_Base.cpp
+ Invocation_Endpoint_Selectors.cpp
+ IOP_IORC.cpp
+ IOPC.cpp
+ IOR_Parser.cpp
+ IORInterceptor_Adapter.cpp
+ IORInterceptor_Adapter_Factory.cpp
+ Leader_Follower.cpp
+ Leader_Follower_Flushing_Strategy.cpp
+ LF_CH_Event.cpp
+ LF_Connect_Strategy.cpp
+ LF_Event.cpp
+ LF_Event_Binder.cpp
+ LF_Event_Loop_Thread_Helper.cpp
+ LF_Follower.cpp
+ LF_Follower_Auto_Adder.cpp
+ LF_Follower_Auto_Ptr.cpp
+ LF_Invocation_Event.cpp
+ LF_Multi_Event.cpp
+ LF_Strategy.cpp
+ LF_Strategy_Complete.cpp
+ LocalObject.cpp
+ LocateRequest_Invocation.cpp
+ LocateRequest_Invocation_Adapter.cpp
+ LongDoubleSeqC.cpp
+ LongLongSeqC.cpp
+ LongSeqC.cpp
+ LRU_Connection_Purging_Strategy.cpp
+ MCAST_Parser.cpp
+ Messaging_PolicyValueC.cpp
+ Messaging_SyncScopeC.cpp
+ MMAP_Allocator.cpp
+ MProfile.cpp
+ Muxed_TMS.cpp
+ New_Leader_Generator.cpp
+ NVList_Adapter.cpp
+ Null_Fragmentation_Strategy.cpp
+ Object.cpp
+ Object_KeyC.cpp
+ Object_Loader.cpp
+ Object_Proxy_Broker.cpp
+ Object_Ref_Table.cpp
+ ObjectIdListC.cpp
+ ObjectKey_Table.cpp
+ OctetSeqC.cpp
+ On_Demand_Fragmentation_Strategy.cpp
+ operation_details.cpp
+ ORB.cpp
+ ORBInitializer_Registry.cpp
+ ORBInitializer_Registry_Adapter.cpp
+ orb_typesC.cpp
+ ORB_Core.cpp
+ ORB_Core_Auto_Ptr.cpp
+ ORB_Core_TSS_Resources.cpp
+ ORB_Table.cpp
+ ParameterModeC.cpp
+ params.cpp
+ Parser_Registry.cpp
+ PI_ForwardC.cpp
+ Pluggable_Messaging.cpp
+ Pluggable_Messaging_Utils.cpp
+ Policy_Current.cpp
+ Policy_Current_Impl.cpp
+ Policy_ForwardC.cpp
+ Policy_Manager.cpp
+ Policy_Set.cpp
+ Policy_Validator.cpp
+ PolicyC.cpp
+ PolicyFactory_Registry_Adapter.cpp
+ PolicyFactory_Registry_Factory.cpp
+ PortableInterceptorC.cpp
+ Principal.cpp
+ Profile.cpp
+ Profile_Transport_Resolver.cpp
+ Protocol_Factory.cpp
+ Protocols_Hooks.cpp
+ Queued_Message.cpp
+ Reactive_Connect_Strategy.cpp
+ Reactive_Flushing_Strategy.cpp
+ Refcounted_ObjectKey.cpp
+ Remote_Invocation.cpp
+ Remote_Object_Proxy_Broker.cpp
+ Reply_Dispatcher.cpp
+ Request_Dispatcher.cpp
+ Resource_Factory.cpp
+ Resume_Handle.cpp
+ Server_Strategy_Factory.cpp
+ ServerRequestInterceptor_Adapter.cpp
+ ServerRequestInterceptor_Adapter_Factory.cpp
+ Service_Callbacks.cpp
+ Service_Context.cpp
+ Services_Activate.cpp
+ ServicesC.cpp
+ ShortSeqC.cpp
+ String_Alloc.cpp
+ StringSeqC.cpp
+ Stub.cpp
+ Stub_Factory.cpp
+ Synch_Invocation.cpp
+ Synch_Queued_Message.cpp
+ Synch_Reply_Dispatcher.cpp
+ SystemException.cpp
+ Tagged_Components.cpp
+ Tagged_Profile.cpp
+ TAO_Internal.cpp
+ TAO_Server_Request.cpp
+ TAO_Singleton_Manager.cpp
+ TAOC.cpp
+ target_specification.cpp
+ Thread_Lane_Resources.cpp
+ Thread_Lane_Resources_Manager.cpp
+ Thread_Per_Connection_Handler.cpp
+ TimeBaseC.cpp
+ Transport.cpp
+ Transport_Acceptor.cpp
+ Transport_Cache_Manager.cpp
+ Transport_Connector.cpp
+ Transport_Descriptor_Interface.cpp
+ Transport_Mux_Strategy.cpp
+ Transport_Queueing_Strategies.cpp
+ Transport_Timer.cpp
+ TSS_Resources.cpp
+ TypeCodeFactory_Adapter.cpp
+ Typecode_typesC.cpp
+ ULongLongSeqC.cpp
+ ULongSeqC.cpp
+ UserException.cpp
+ UShortSeqC.cpp
+ Valuetype_Adapter.cpp
+ Valuetype_Adapter_Factory.cpp
+ Wait_On_Leader_Follower.cpp
+ Wait_On_LF_No_Upcall.cpp
+ Wait_On_Reactor.cpp
+ Wait_On_Read.cpp
+ Wait_Strategy.cpp
+ WCharSeqC.cpp
+ WrongTransactionC.cpp
+ WStringSeqC.cpp
+ GUIResource_Factory.cpp
+ }
+
+ Header_Files {
+ Array_Traits_T.h
+ Abstract_Servant_Base.h
+ Acceptor_Filter.h
+ Acceptor_Impl.h
+ Acceptor_Registry.h
+ Adapter.h
+ Adapter_Factory.h
+ Adapter_Registry.h
+ Allocator.h
+ AnyTypeCode_Adapter.h
+ Any_Insert_Policy_T.h
+ Arg_Traits_T.h
+ Argument.h
+ Array_VarOut_T.h
+ Asynch_Queued_Message.h
+ Asynch_Reply_Dispatcher_Base.h
+ Auto_Functor.h
+ Base_Transport_Property.h
+ Basic_Arguments.h
+ Basic_Argument_T.h
+ Basic_Types.h
+ BD_String_Argument_T.h
+ BiDir_Adapter.h
+ Bind_Dispatcher_Guard.h
+ Blocked_Connect_Strategy.h
+ Block_Flushing_Strategy.h
+ BooleanSeqC.h
+ BooleanSeqS.h
+ Bounded_Array_Allocation_Traits_T.h
+ Bounded_Array_Sequence_T.h
+ Bounded_Basic_String_Sequence_T.h
+ Bounded_Object_Reference_Sequence_T.h
+ Bounded_Reference_Allocation_Traits_T.h
+ Bounded_Sequence_CDR_T.h
+ Bounded_String_Sequence_T.h
+ Bounded_Value_Allocation_Traits_T.h
+ Bounded_Value_Sequence_T.h
+ Bounded_Wstring_Sequence_T.h
+ Buffer_Allocator_T.h
+ Buffering_Constraint_Policy.h
+ Cache_Entries.h
+ CDR.h
+ CharSeqC.h
+ CharSeqS.h
+ Cleanup_Func_Registry.h
+ ClientRequestInterceptor_Adapter.h
+ Client_Strategy_Factory.h
+ Codeset_Descriptor_Base.h
+ Codeset_Manager.h
+ Codeset_Manager_Factory_Base.h
+ Codeset_Translator_Base.h
+// Codeset_Translator_Factory.h *** file is for backwardscompatibility only
+// *** there should be no dependencies on it
+ Collocated_Invocation.h
+ Collocation_Proxy_Broker.h
+ Collocation_Resolver.h
+ Collocation_Strategy.h
+ Condition.h
+ Connection_Handler.h
+ Connection_Purging_Strategy.h
+ Connector_Impl.h
+ Connector_Registry.h
+ Connect_Strategy.h
+ CONV_FRAMEC.h
+ CONV_FRAMES.h
+ corbafwd.h
+ corba.h
+ CORBALOC_Parser.h
+ CORBA_methods.h
+ CORBANAME_Parser.h
+ CORBA_String.h
+ CurrentC.h
+ CurrentS.h
+ debug.h
+ default_client.h
+ Default_Collocation_Resolver.h
+ Default_Endpoint_Selector_Factory.h
+ default_environment.h
+ default_ports.h
+ Default_Protocols_Hooks.h
+ default_resource.h
+ default_server.h
+ Default_Stub_Factory.h
+ Default_Thread_Lane_Resources_Manager.h
+ DLL_Parser.h
+ DomainC.h
+ DoubleSeqC.h
+ DoubleSeqS.h
+ Dynamic_Adapter.h
+ Endpoint.h
+ Endpoint_Selector_Factory.h
+ Environment.h
+ Exception_Data.h
+ Exception.h
+ Exclusive_TMS.h
+ Fault_Tolerance_Service.h
+ FILE_Parser.h
+ Fixed_Array_Argument_T.h
+ Fixed_Size_Argument_T.h
+ FloatSeqC.h
+ FloatSeqS.h
+ Flushing_Strategy.h
+ Generic_Sequence_T.h
+ GIOPC.h
+ GIOP_Message_Base.h
+ GIOP_Message_Generator_Parser_10.h
+ GIOP_Message_Generator_Parser_11.h
+ GIOP_Message_Generator_Parser_12.h
+ GIOP_Message_Generator_Parser.h
+ GIOP_Message_Generator_Parser_Impl.h
+ GIOP_Message_Lite.h
+ GIOP_Message_Locate_Header.h
+ GIOP_Message_State.h
+ GIOP_Message_Version.h
+ GIOPS.h
+ GIOP_Utils.h
+ GUIResource_Factory.h
+ IFR_Client_Adapter.h
+ IIOP_Acceptor.h
+ IIOPC.h
+ IIOP_Connection_Handler.h
+ IIOP_Connector.h
+ IIOP_Endpoint.h
+ IIOP_EndpointsC.h
+ IIOP_EndpointsS.h
+ IIOP_Factory.h
+ IIOP_Lite_Factory.h
+ IIOP_Profile.h
+ IIOP_Transport.h
+ Incoming_Message_Queue.h
+ Incoming_Message_Stack.h
+ Invocation_Adapter.h
+ Invocation_Base.h
+ Invocation_Endpoint_Selectors.h
+ Invocation_Utils.h
+ IOPC.h
+ IOP_IORC.h
+ IOPS.h
+ IORInterceptor_Adapter_Factory.h
+ IORInterceptor_Adapter.h
+ IOR_Parser.h
+ Leader_Follower_Flushing_Strategy.h
+ Leader_Follower.h
+ LF_CH_Event.h
+ LF_Connect_Strategy.h
+ LF_Event_Binder.h
+ LF_Event.h
+ LF_Event_Loop_Thread_Helper.h
+ LF_Follower_Auto_Adder.h
+ LF_Follower_Auto_Ptr.h
+ LF_Follower.h
+ LF_Invocation_Event.h
+ LF_Strategy_Complete.h
+ LF_Strategy.h
+ Load_Protocol_Factory_T.h
+ LocalObject.h
+ LocateRequest_Invocation_Adapter.h
+ LocateRequest_Invocation.h
+ LongDoubleSeqC.h
+ LongDoubleSeqS.h
+ LongLongSeqC.h
+ LongLongSeqS.h
+ LongSeqC.h
+ LongSeqS.h
+ LRU_Connection_Purging_Strategy.h
+ MCAST_Parser.h
+ Messaging_PolicyValueC.h
+ Messaging_SyncScopeC.h
+ MMAP_Allocator.h
+ MProfile.h
+ Muxed_TMS.h
+ New_Leader_Generator.h
+ Object_Argument_T.h
+ Object.h
+ objectid.h
+ ObjectIdListC.h
+ Object_KeyC.h
+ ObjectKey_Table.h
+ Object_Loader.h
+ Object_Proxy_Broker.h
+ Object_Ref_Table.h
+ Object_T.h
+ Object_Reference_Sequence_Element_T.h
+ Objref_VarOut_T.h
+ Object_Reference_Traits_Base_T.h
+ Object_Reference_Traits_T.h
+ OctetSeqC.h
+ OctetSeqS.h
+ operation_details.h
+ orbconf.h
+ ORB_Constants.h
+ ORB_Core_Auto_Ptr.h
+ ORB_Core_TSS_Resources.h
+ ORB_Core.h
+ ORB.h
+ ORBInitializer_Registry.h
+ ORBInitializer_Registry_Adapter.h
+ ORB_Table.h
+ orb_typesC.h
+ orb_typesS.h
+ ParameterModeC.h
+ ParameterModeS.h
+ params.h
+ Parser_Registry.h
+ PI_ForwardC.h
+ Pluggable_Messaging.h
+ Pluggable_Messaging_Utils.h
+ PolicyC.h
+ PolicyFactory_Registry_Adapter.h
+ Policy_ForwardC.h
+ Policy_ForwardS.h
+ Policy_Current.h
+ Policy_Current_Impl.h
+ Policy_Manager.h
+ Policy_Set.h
+ PolicyS.h
+ Policy_Validator.h
+ PortableInterceptorC.h
+ PortableInterceptor.h
+ PortableInterceptorS.h
+ Principal.h
+ Profile.h
+ Profile_Transport_Resolver.h
+ Protocol_Factory.h
+ Protocols_Hooks.h
+ Pseudo_VarOut_T.h
+ Queued_Message.h
+ Range_Checking_T.h
+ Reactive_Connect_Strategy.h
+ Reactive_Flushing_Strategy.h
+ Refcounted_ObjectKey.h
+ Remote_Invocation.h
+ Remote_Object_Proxy_Broker.h
+ Reply_Dispatcher.h
+ Request_Dispatcher.h
+ Resource_Factory.h
+ Resume_Handle.h
+ Seq_Out_T.h
+ Seq_Var_T.h
+ Sequence_T.h
+ Server_Strategy_Factory.h
+ Service_Callbacks.h
+ Service_Context.h
+ Services_Activate.h
+ ServicesC.h
+ ServicesS.h
+ ShortSeqC.h
+ ShortSeqS.h
+ Special_Basic_Arguments.h
+ Special_Basic_Argument_T.h
+ StringSeqC.h
+ StringSeqS.h
+ String_Alloc.h
+ String_Manager_T.h
+ String_Sequence_Element_T.h
+ String_Traits_Base_T.h
+ String_Traits_T.h
+ Stub_Factory.h
+ Stub.h
+ Synch_Invocation.h
+ Synch_Queued_Message.h
+ Synch_Reply_Dispatcher.h
+ SystemException.h
+ Tagged_Components.h
+ Tagged_Profile.h
+ TAOC.h
+ TAO_Export.h
+ TAO_Internal.h
+ TAO_Server_Request.h
+ TAOS.h
+ TAO_Singleton.h
+ TAO_Singleton_Manager.h
+ target_specification.h
+ Thread_Lane_Resources.h
+ Thread_Lane_Resources_Manager.h
+ Thread_Per_Connection_Handler.h
+ TimeBaseC.h
+ TimeBaseS.h
+ Timeprobe.h
+ Transport_Acceptor.h
+ Transport_Cache_Manager.h
+ Transport_Connector.h
+ Transport_Descriptor_Interface.h
+ Transport.h
+ Transport_Mux_Strategy.h
+ Transport_Queueing_Strategies.h
+ Transport_Timer.h
+ TSS_Resources.h
+ TypeCodeFactory_Adapter.h
+ Typecode_typesC.h
+ Typecode_typesS.h
+ UB_String_Arguments.h
+ UB_String_Argument_T.h
+ ULongLongSeqC.h
+ ULongLongSeqS.h
+ ULongSeqC.h
+ ULongSeqS.h
+ Unbounded_Array_Allocation_Traits_T.h
+ Unbounded_Array_Sequence_T.h
+ Unbounded_Basic_String_Sequence_T.h
+ Unbounded_Object_Reference_Sequence_T.h
+ Unbounded_Octet_Sequence_T.h
+ Unbounded_Octet_Sequence_T.h
+ Unbounded_Reference_Allocation_Traits_T.h
+ Unbounded_Sequence_CDR_T.h
+ Unbounded_String_Sequence_T.h
+ Unbounded_Value_Allocation_Traits_T.h
+ Unbounded_Value_Sequence_T.h
+ Unbounded_Wstring_Sequence_T.h
+ UserException.h
+ UShortSeqC.h
+ UShortSeqS.h
+ Value_Traits_T.h
+ Valuetype_Adapter.h
+ Valuetype_Adapter_Factory.h
+ Var_Array_Argument_T.h
+ varbase.h
+ VarOut_T.h
+ Var_Size_Argument_T.h
+ Version.h
+ Versioned_Namespace.h
+ Wait_On_Leader_Follower.h
+ Wait_On_LF_No_Upcall.h
+ Wait_On_Reactor.h
+ Wait_On_Read.h
+ Wait_Strategy.h
+ WCharSeqC.h
+ WCharSeqS.h
+ WrongTransactionC.h
+ WrongTransactionS.h
+ WStringSeqC.h
+ WStringSeqS.h
+ }
+
+ Inline_Files {
+ *.i
+ *.inl
+ }
+
+ Template_Files {
+ *_T.cpp
+ Acceptor_Impl.cpp
+ Condition.cpp
+ Connector_Impl.cpp
+ TAO_Singleton.cpp
+ orb.idl
+ }
+
+ IDL_Files {
+ idlflags += -Gp -Gd -SS -Sorb -GA -Ge 1 -oA AnyTypeCode \
+ -Wb,export_macro=TAO_Export \
+ -Wb,export_include=tao/TAO_Export.h \
+ -Wb,anyop_export_macro=TAO_AnyTypeCode_Export \
+ -Wb,anyop_export_include=tao/AnyTypeCode/TAO_AnyTypeCode_Export.h
+ idlflags -= -Sa -St
+ GIOP.pidl >> AnyTypeCode/GIOPA.h AnyTypeCode/GIOPA.cpp
+ }
+
+ IDL_Files {
+ idlflags += -Gp -Gd -Sci -SS -Sorb -GA -Ge 1 -oA AnyTypeCode \
+ -Wb,export_macro=TAO_Export \
+ -Wb,export_include=tao/TAO_Export.h \
+ -Wb,anyop_export_macro=TAO_AnyTypeCode_Export \
+ -Wb,anyop_export_include=tao/AnyTypeCode/TAO_AnyTypeCode_Export.h
+ idlflags -= -Sa -St
+ BooleanSeq.pidl >> AnyTypeCode/BooleanSeqA.h AnyTypeCode/BooleanSeqA.cpp
+ CharSeq.pidl >> AnyTypeCode/CharSeqA.h AnyTypeCode/CharSeqA.cpp
+ CONV_FRAME.pidl >> AnyTypeCode/CONV_FRAMEA.h AnyTypeCode/CONV_FRAMEA.cpp
+ Current.pidl >> AnyTypeCode/CurrentA.h AnyTypeCode/CurrentA.cpp
+ DoubleSeq.pidl >> AnyTypeCode/DoubleSeqA.h AnyTypeCode/DoubleSeqA.cpp
+ FloatSeq.pidl >> AnyTypeCode/FloatSeqA.h AnyTypeCode/FloatSeqA.cpp
+ IIOP.pidl >> AnyTypeCode/IIOPA.h AnyTypeCode/IIOPA.cpp
+ IIOP_Endpoints.pidl >> AnyTypeCode/IIOP_EndpointsA.h AnyTypeCode/IIOP_EndpointsA.cpp
+ IOP.pidl >> AnyTypeCode/IOPA.h AnyTypeCode/IOPA.cpp
+ IOP_IOR.pidl >> AnyTypeCode/IOP_IORA.h AnyTypeCode/IOP_IORA.cpp
+ LongDoubleSeq.pidl >> AnyTypeCode/LongDoubleSeqA.h AnyTypeCode/LongDoubleSeqA.cpp
+ LongLongSeq.pidl >> AnyTypeCode/LongLongSeqA.h AnyTypeCode/LongLongSeqA.cpp
+ LongSeq.pidl >> AnyTypeCode/LongSeqA.h AnyTypeCode/LongSeqA.cpp
+ Messaging_PolicyValue.pidl >> AnyTypeCode/Messaging_PolicyValueA.h AnyTypeCode/Messaging_PolicyValueA.cpp
+ Messaging_SyncScope.pidl >> AnyTypeCode/Messaging_SyncScopeA.h AnyTypeCode/Messaging_SyncScopeA.cpp
+ ObjectIdList.pidl >> AnyTypeCode/ObjectIdListA.h AnyTypeCode/ObjectIdListA.cpp
+ orb_types.pidl >> AnyTypeCode/orb_typesA.h AnyTypeCode/orb_typesA.cpp
+ ParameterMode.pidl >> AnyTypeCode/ParameterModeA.h AnyTypeCode/ParameterModeA.cpp
+ Policy_Forward.pidl >> AnyTypeCode/Policy_ForwardA.h AnyTypeCode/Policy_ForwardA.cpp
+ PI_Forward.pidl >> AnyTypeCode/PI_ForwardA.h AnyTypeCode/PI_ForwardA.cpp
+ PortableInterceptor.pidl >> AnyTypeCode/PortableInterceptorA.h AnyTypeCode/PortableInterceptorA.cpp
+ Services.pidl >> AnyTypeCode/ServicesA.h AnyTypeCode/ServicesA.cpp
+ ShortSeq.pidl >> AnyTypeCode/ShortSeqA.h AnyTypeCode/ShortSeqA.cpp
+ StringSeq.pidl >> AnyTypeCode/StringSeqA.h AnyTypeCode/StringSeqA.cpp
+ TAO.pidl >> AnyTypeCode/TAOA.h AnyTypeCode/TAOA.cpp
+ TimeBase.pidl >> AnyTypeCode/TimeBaseA.h AnyTypeCode/TimeBaseA.cpp
+ ULongLongSeq.pidl >> AnyTypeCode/ULongLongSeqA.h AnyTypeCode/ULongLongSeqA.cpp
+ ULongSeq.pidl >> AnyTypeCode/ULongSeqA.h AnyTypeCode/ULongSeqA.cpp
+ WCharSeq.pidl >> AnyTypeCode/WCharSeqA.h AnyTypeCode/WCharSeqA.cpp
+ WStringSeq.pidl >> AnyTypeCode/WStringSeqA.h AnyTypeCode/WStringSeqA.cpp
+ }
+
+ Pkgconfig_Files {
+ TAO.pc.in
+ }
+}
diff --git a/TAO/tao/tao.mwc b/TAO/tao/tao.mwc
new file mode 100644
index 00000000000..01faf104b82
--- /dev/null
+++ b/TAO/tao/tao.mwc
@@ -0,0 +1,6 @@
+// -*- MPC -*-
+// $Id$
+
+workspace {
+}
+
diff --git a/TAO/tao/tao.rc b/TAO/tao/tao.rc
new file mode 100644
index 00000000000..998e9157f92
--- /dev/null
+++ b/TAO/tao/tao.rc
@@ -0,0 +1,30 @@
+#include "Version.h"
+
+1 VERSIONINFO
+ FILEVERSION TAO_MAJOR_VERSION,TAO_MINOR_VERSION,TAO_BETA_VERSION,0
+ PRODUCTVERSION TAO_MAJOR_VERSION,TAO_MINOR_VERSION,TAO_BETA_VERSION,0
+ FILEFLAGSMASK 0x3fL
+ FILEFLAGS 0x0L
+ FILEOS 0x4L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904B0"
+ BEGIN
+ VALUE "FileDescription", "TAO\0"
+ VALUE "FileVersion", TAO_VERSION "\0"
+ VALUE "InternalName", "TAODLL\0"
+ VALUE "LegalCopyright", "\0"
+ VALUE "LegalTrademarks", "\0"
+ VALUE "OriginalFilename", "TAO.DLL\0"
+ VALUE "ProductName", "TAO\0"
+ VALUE "ProductVersion", TAO_VERSION "\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
diff --git a/TAO/tao/target_specification.cpp b/TAO/tao/target_specification.cpp
new file mode 100644
index 00000000000..ca77495c883
--- /dev/null
+++ b/TAO/tao/target_specification.cpp
@@ -0,0 +1,12 @@
+
+//$Id$
+
+#include "tao/target_specification.h"
+
+#if !defined (__ACE_INLINE__)
+#include "tao/target_specification.i"
+#endif /* !defined INLINE */
+
+ACE_RCSID (tao,
+ target_specification,
+ "$Id$")
diff --git a/TAO/tao/target_specification.h b/TAO/tao/target_specification.h
new file mode 100644
index 00000000000..60c997f0e3c
--- /dev/null
+++ b/TAO/tao/target_specification.h
@@ -0,0 +1,139 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file target_specification.h
+ *
+ * $Id$
+ *
+ * A class that encapsulates the target identification details.
+ *
+ * @author Balachandran Natarajan <bala@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_TARGET_SPECIFICATION_H
+#define TAO_TARGET_SPECIFICATION_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/TAO_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Basic_Types.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if defined (HPUX) && defined (IOR)
+ /* HP-UX 11.11 defines IOR in /usr/include/pa/inline.h
+ and we don't want that definition. See IOP_IORC.h. */
+# undef IOR
+#endif /* HPUX && IOR */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace IOP
+{
+ struct IOR;
+ struct TaggedProfile;
+}
+
+namespace TAO
+{
+ class ObjectKey;
+}
+
+/**
+ * @class TAO_Target_Specification
+ *
+ * @brief A class to encapsulate all the ways of specifying targets.
+ *
+ */
+class TAO_Export TAO_Target_Specification
+{
+public:
+
+ /// Ctor
+ TAO_Target_Specification (void);
+ enum TAO_Target_Address
+ {
+ // Note that this could be extended for other protocols
+ Key_Addr = 0,
+ Profile_Addr,
+ Reference_Addr
+ };
+
+ // Note: Please do not pass in a identifiers that is allocated on
+ // stack. These methods does not make a copy but holds the pointer
+ // passed in.
+ /// Set the target specification by giving the object key.
+ void target_specifier (const TAO::ObjectKey &key);
+
+
+ /// Set the target specification by passing in an IOP::TaggedProfile.
+ void target_specifier (IOP::TaggedProfile &profile);
+
+ /**
+ * Specify the target by passing in the IOP::IOR with a profile
+ * index. Please see the header file IOPC.h on why a profile index
+ * is required.
+ */
+ void target_specifier (IOP::IOR &ior,
+ CORBA::ULong prof_index);
+
+
+ /**
+ * Returns the object key after a check of the stored specifier. If
+ * the stored specifier is not of the right type then this would
+ * return a NULL
+ */
+ const TAO::ObjectKey* object_key (void);
+
+ /**
+ * Returns the IOP::TaggedProfile after a check of the stored specifier. If
+ * the stored specifier is not of the right type then this would
+ * return a NULL
+ */
+ const IOP::TaggedProfile *profile (void);
+
+ /**
+ * Returns a pointer to IOP::IOR through the parameters and the
+ * index of the selected profile as a return parameter after a check
+ * of the stored specifier. If the stored specifier is not of the
+ * right type then this would return a NULL.
+ */
+ CORBA::ULong iop_ior (IOP::IOR *&ior);
+
+ /// Access the TArget_Address specifier
+ TAO_Target_Address specifier (void);
+
+private:
+ /// The union of all the possibilities
+ union
+ {
+ TAO::ObjectKey *object_key_;
+ IOP::TaggedProfile *profile_;
+ IOP::IOR *ior_;
+ } u_;
+
+ /// The enum identifier
+ TAO_Target_Address specifier_;
+
+ /// The profile index
+ CORBA::ULong profile_index_;
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#if defined (__ACE_INLINE__)
+#include "tao/target_specification.i"
+#endif /* defined INLINE */
+
+#include /**/ "ace/post.h"
+
+#endif /*TAO_TARGET_SPECIFICATION_H*/
diff --git a/TAO/tao/target_specification.i b/TAO/tao/target_specification.i
new file mode 100644
index 00000000000..dd1265bf0df
--- /dev/null
+++ b/TAO/tao/target_specification.i
@@ -0,0 +1,87 @@
+// -*- C++ -*-
+//
+//$Id$
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO_Target_Specification::TAO_Target_Specification (void)
+ :specifier_ (TAO_Target_Specification::Key_Addr),
+ profile_index_ (0)
+{
+ //no-op
+}
+
+ACE_INLINE void
+TAO_Target_Specification::target_specifier (const TAO::ObjectKey &key)
+{
+ this->specifier_ = TAO_Target_Specification::Key_Addr;
+ // @@ Bala: this is a good recipe for a crash, if the <key> was on
+ // the stack or is otherwise destroyed then you are in big
+ // trouble.
+ // @@ Carlos: As suggested by you I have documented that in the
+ // headerfile.
+ // @@ Bala: beware, documentation is good, code that works in
+ // general is better.... but you are probably right in this case, i
+ // suspect this stuff goes right in the critical path, right? So
+ // making a copy of the object key would be too expensive..
+ this->u_.object_key_ = const_cast<TAO::ObjectKey *> (&key);
+}
+
+ACE_INLINE void
+TAO_Target_Specification::target_specifier (IOP::TaggedProfile &profile)
+
+{
+ this->specifier_ = TAO_Target_Specification::Profile_Addr;
+ this->u_.profile_ = const_cast<IOP::TaggedProfile *> (&profile);
+
+}
+
+ACE_INLINE void
+TAO_Target_Specification::target_specifier (IOP::IOR &ior,
+ CORBA::ULong prof_index)
+{
+ this->specifier_ = TAO_Target_Specification::Reference_Addr;
+ this->u_.ior_ = const_cast<IOP::IOR *> (&ior);
+ this->profile_index_ = prof_index;
+
+}
+
+ACE_INLINE const TAO::ObjectKey*
+TAO_Target_Specification::object_key (void)
+{
+ if (this->specifier_ == TAO_Target_Specification::Key_Addr)
+ return this->u_.object_key_;
+
+ return 0;
+}
+
+ACE_INLINE const IOP::TaggedProfile *
+TAO_Target_Specification::profile (void)
+{
+ if (this->specifier_ == TAO_Target_Specification::Profile_Addr)
+ return this->u_.profile_;
+
+ return 0;
+}
+
+ACE_INLINE CORBA::ULong
+TAO_Target_Specification::iop_ior (IOP::IOR *& ior)
+{
+ if (this->specifier_ == TAO_Target_Specification::Reference_Addr)
+ {
+ ior = this->u_.ior_;
+ return this->profile_index_;
+ }
+
+ ior = 0;
+ return 0;
+}
+
+ACE_INLINE TAO_Target_Specification::TAO_Target_Address
+TAO_Target_Specification::specifier (void)
+{
+ return this->specifier_;
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/varbase.h b/TAO/tao/varbase.h
new file mode 100644
index 00000000000..58b1a595c87
--- /dev/null
+++ b/TAO/tao/varbase.h
@@ -0,0 +1,49 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file varbase.h
+ *
+ * $Id$
+ *
+ * Contains a base class for the object _var classes.
+ *
+ *
+ * @author Jeff Parsons.
+ */
+//=============================================================================
+
+#ifndef TAO_VARBASE_H
+#define TAO_VARBASE_H
+#include /**/ "ace/pre.h"
+
+#include "tao/Versioned_Namespace.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_Base_var
+ *
+ * @brief TAO_Base_var
+ *
+ * Base class for object _var classes. Used to prevent the
+ * _var class of a CORBA interface from accepting the _var
+ * of a more derived interface in its copy constructor or
+ * assignment operator.
+ */
+class TAO_Base_var
+{
+public:
+ TAO_Base_var (void) {}
+
+private:
+
+ TAO_Base_var (const TAO_Base_var &);
+ TAO_Base_var & operator= (const TAO_Base_var &);
+
+};
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_VARBASE_H */