zeroc-ice 3.6.5 → 3.7.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (777) hide show
  1. checksums.yaml +5 -5
  2. data/ICE_LICENSE +17 -17
  3. data/LICENSE +12 -12
  4. data/bin/slice2rb +1 -6
  5. data/ext/Communicator.cpp +223 -61
  6. data/ext/Communicator.h +1 -6
  7. data/ext/Config.h +23 -7
  8. data/ext/Connection.cpp +108 -76
  9. data/ext/Connection.h +4 -6
  10. data/ext/Endpoint.cpp +16 -54
  11. data/ext/Endpoint.h +1 -6
  12. data/ext/ImplicitContext.cpp +1 -10
  13. data/ext/ImplicitContext.h +1 -6
  14. data/ext/Init.cpp +4 -6
  15. data/ext/Logger.cpp +1 -6
  16. data/ext/Logger.h +1 -6
  17. data/ext/Operation.cpp +38 -54
  18. data/ext/Operation.h +1 -6
  19. data/ext/Properties.cpp +3 -8
  20. data/ext/Properties.h +1 -6
  21. data/ext/Proxy.cpp +111 -70
  22. data/ext/Proxy.h +1 -6
  23. data/ext/Slice.cpp +5 -20
  24. data/ext/Slice.h +1 -6
  25. data/ext/Types.cpp +313 -224
  26. data/ext/Types.h +118 -71
  27. data/ext/Util.cpp +69 -36
  28. data/ext/Util.h +117 -42
  29. data/ext/ValueFactoryManager.cpp +440 -0
  30. data/ext/ValueFactoryManager.h +95 -0
  31. data/ext/extconf.rb +52 -48
  32. data/ext/ice/cpp/include/Ice/Application.h +275 -105
  33. data/ext/ice/cpp/include/Ice/AsyncResult.h +124 -337
  34. data/ext/ice/cpp/include/Ice/AsyncResultF.h +4 -7
  35. data/ext/ice/cpp/include/Ice/BatchRequestInterceptor.h +39 -16
  36. data/ext/ice/cpp/include/Ice/BatchRequestQueueF.h +1 -6
  37. data/ext/ice/cpp/include/Ice/Buffer.h +10 -15
  38. data/ext/ice/cpp/include/Ice/CommunicatorAsync.h +56 -17
  39. data/ext/ice/cpp/include/Ice/Comparable.h +205 -0
  40. data/ext/ice/cpp/include/Ice/Config.h +16 -39
  41. data/ext/ice/cpp/include/Ice/ConnectionAsync.h +203 -16
  42. data/ext/ice/cpp/include/Ice/ConnectionIF.h +7 -6
  43. data/ext/ice/cpp/include/Ice/ConsoleUtil.h +23 -0
  44. data/ext/ice/cpp/include/Ice/DefaultValueFactory.h +57 -0
  45. data/ext/ice/cpp/include/Ice/DispatchInterceptor.h +20 -12
  46. data/ext/ice/cpp/include/Ice/Dispatcher.h +35 -19
  47. data/ext/ice/cpp/include/Ice/DynamicLibrary.h +7 -10
  48. data/ext/ice/cpp/include/Ice/DynamicLibraryF.h +1 -6
  49. data/ext/ice/cpp/include/Ice/Exception.h +110 -63
  50. data/ext/ice/cpp/include/Ice/ExceptionHelpers.h +74 -0
  51. data/ext/ice/cpp/include/Ice/FactoryTable.h +22 -18
  52. data/ext/ice/cpp/include/Ice/FactoryTableInit.h +28 -31
  53. data/ext/ice/cpp/include/Ice/Format.h +17 -18
  54. data/ext/ice/cpp/include/Ice/Functional.h +38 -38
  55. data/ext/ice/cpp/include/Ice/GCObject.h +9 -10
  56. data/ext/ice/cpp/include/Ice/Handle.h +6 -16
  57. data/ext/ice/cpp/include/Ice/Ice.h +9 -10
  58. data/ext/ice/cpp/include/Ice/IconvStringConverter.h +377 -0
  59. data/ext/ice/cpp/include/Ice/Incoming.h +132 -38
  60. data/ext/ice/cpp/include/Ice/IncomingAsync.h +109 -31
  61. data/ext/ice/cpp/include/Ice/IncomingAsyncF.h +7 -6
  62. data/ext/ice/cpp/include/Ice/Initialize.h +872 -60
  63. data/ext/ice/cpp/include/Ice/InputStream.h +1514 -0
  64. data/ext/ice/cpp/include/Ice/InstanceF.h +1 -7
  65. data/ext/ice/cpp/include/Ice/InterfaceByValue.h +57 -0
  66. data/ext/ice/cpp/include/Ice/LocalObject.h +13 -14
  67. data/ext/ice/cpp/include/Ice/LocalObjectF.h +1 -6
  68. data/ext/ice/cpp/include/Ice/LoggerUtil.h +56 -24
  69. data/ext/ice/cpp/include/Ice/MetricsAdminI.h +124 -71
  70. data/ext/ice/cpp/include/Ice/MetricsFunctional.h +25 -10
  71. data/ext/ice/cpp/include/Ice/MetricsObserverI.h +116 -32
  72. data/ext/ice/cpp/include/Ice/NativePropertiesAdmin.h +61 -30
  73. data/ext/ice/cpp/include/Ice/Object.h +413 -78
  74. data/ext/ice/cpp/include/Ice/ObjectF.h +12 -8
  75. data/ext/ice/cpp/include/Ice/ObserverHelper.h +18 -13
  76. data/ext/ice/cpp/include/Ice/Optional.h +1114 -0
  77. data/ext/ice/cpp/include/Ice/OutgoingAsync.h +684 -89
  78. data/ext/ice/cpp/include/Ice/OutgoingAsyncF.h +12 -11
  79. data/ext/ice/cpp/include/Ice/OutputStream.h +1092 -0
  80. data/ext/ice/cpp/include/Ice/Protocol.h +49 -17
  81. data/ext/ice/cpp/include/Ice/Proxy.h +3438 -745
  82. data/ext/ice/cpp/include/Ice/ProxyF.h +13 -38
  83. data/ext/ice/cpp/include/Ice/ProxyFactoryF.h +1 -6
  84. data/ext/ice/cpp/include/Ice/ProxyHandle.h +43 -55
  85. data/ext/ice/cpp/include/Ice/ReferenceF.h +1 -6
  86. data/ext/ice/cpp/include/Ice/RegisterPlugins.h +84 -12
  87. data/ext/ice/cpp/include/Ice/RequestHandlerF.h +10 -9
  88. data/ext/ice/cpp/include/Ice/ResponseHandlerF.h +6 -6
  89. data/ext/ice/cpp/include/Ice/SHA1.h +42 -0
  90. data/ext/ice/cpp/include/Ice/ServantManagerF.h +1 -6
  91. data/ext/ice/cpp/include/Ice/Service.h +273 -154
  92. data/ext/ice/cpp/include/Ice/SliceChecksums.h +5 -6
  93. data/ext/ice/cpp/include/Ice/SlicedData.h +121 -53
  94. data/ext/ice/cpp/include/Ice/SlicedDataF.h +17 -11
  95. data/ext/ice/cpp/include/Ice/StreamHelpers.h +453 -140
  96. data/ext/ice/cpp/include/Ice/StringConverter.h +78 -0
  97. data/ext/ice/cpp/include/Ice/ThreadPoolF.h +1 -6
  98. data/ext/ice/cpp/include/Ice/UUID.h +19 -0
  99. data/ext/ice/cpp/include/{IceUtil → Ice}/UniquePtr.h +22 -28
  100. data/ext/ice/cpp/include/Ice/UniqueRef.h +97 -0
  101. data/ext/ice/cpp/include/Ice/UserExceptionFactory.h +45 -13
  102. data/ext/ice/cpp/include/Ice/Value.h +139 -0
  103. data/ext/ice/cpp/include/Ice/ValueF.h +21 -0
  104. data/ext/ice/cpp/include/IceSSL/Config.h +8 -28
  105. data/ext/ice/cpp/include/IceSSL/IceSSL.h +17 -11
  106. data/ext/ice/cpp/include/IceSSL/OpenSSL.h +147 -0
  107. data/ext/ice/cpp/include/IceSSL/Plugin.h +461 -448
  108. data/ext/ice/cpp/include/IceSSL/SChannel.h +72 -0
  109. data/ext/ice/cpp/include/IceSSL/SecureTransport.h +72 -0
  110. data/ext/ice/cpp/include/IceSSL/UWP.h +62 -0
  111. data/ext/ice/cpp/include/IceUtil/Atomic.h +7 -14
  112. data/ext/ice/cpp/include/IceUtil/Cond.h +17 -23
  113. data/ext/ice/cpp/include/IceUtil/Config.h +166 -46
  114. data/ext/ice/cpp/include/IceUtil/ConsoleUtil.h +92 -0
  115. data/ext/ice/cpp/include/IceUtil/CountDownLatch.h +5 -10
  116. data/ext/ice/cpp/include/IceUtil/CtrlCHandler.h +63 -41
  117. data/ext/ice/cpp/include/IceUtil/DisableWarnings.h +5 -13
  118. data/ext/ice/cpp/include/IceUtil/Exception.h +284 -75
  119. data/ext/ice/cpp/include/IceUtil/FileUtil.h +143 -0
  120. data/ext/ice/cpp/include/IceUtil/Functional.h +4 -6
  121. data/ext/ice/cpp/include/IceUtil/Handle.h +11 -16
  122. data/ext/ice/cpp/include/IceUtil/IceUtil.h +4 -15
  123. data/ext/ice/cpp/include/IceUtil/InputUtil.h +3 -8
  124. data/ext/ice/cpp/include/IceUtil/Iterator.h +2 -7
  125. data/ext/ice/cpp/include/IceUtil/Lock.h +8 -15
  126. data/ext/ice/cpp/include/IceUtil/Monitor.h +1 -7
  127. data/ext/ice/cpp/include/IceUtil/Mutex.h +19 -23
  128. data/ext/ice/cpp/include/IceUtil/MutexProtocol.h +2 -7
  129. data/ext/ice/cpp/include/IceUtil/MutexPtrLock.h +4 -9
  130. data/ext/ice/cpp/include/IceUtil/MutexPtrTryLock.h +4 -9
  131. data/ext/ice/cpp/include/IceUtil/Optional.h +134 -23
  132. data/ext/ice/cpp/include/IceUtil/Options.h +17 -23
  133. data/ext/ice/cpp/include/IceUtil/OutputUtil.h +61 -37
  134. data/ext/ice/cpp/include/IceUtil/PopDisableWarnings.h +6 -11
  135. data/ext/ice/cpp/include/IceUtil/PushDisableWarnings.h +18 -15
  136. data/ext/ice/cpp/include/IceUtil/Random.h +39 -8
  137. data/ext/ice/cpp/include/IceUtil/RecMutex.h +7 -13
  138. data/ext/ice/cpp/include/IceUtil/ResourceConfig.h +53 -0
  139. data/ext/ice/cpp/include/IceUtil/ScannerConfig.h +10 -15
  140. data/ext/ice/cpp/include/IceUtil/ScopedArray.h +8 -7
  141. data/ext/ice/cpp/include/IceUtil/Shared.h +5 -12
  142. data/ext/ice/cpp/{src → include}/IceUtil/StopWatch.h +2 -7
  143. data/ext/ice/cpp/include/IceUtil/StringConverter.h +146 -126
  144. data/ext/ice/cpp/include/IceUtil/StringUtil.h +32 -26
  145. data/ext/ice/cpp/include/IceUtil/Thread.h +10 -17
  146. data/ext/ice/cpp/include/IceUtil/ThreadException.h +33 -47
  147. data/ext/ice/cpp/include/IceUtil/Time.h +3 -8
  148. data/ext/ice/cpp/include/IceUtil/Timer.h +18 -18
  149. data/ext/ice/cpp/include/IceUtil/UUID.h +6 -7
  150. data/ext/ice/cpp/include/IceUtil/UndefSysMacros.h +1 -6
  151. data/ext/ice/cpp/include/generated/Ice/BuiltinSequences.h +170 -0
  152. data/ext/ice/cpp/include/generated/Ice/Communicator.h +1156 -0
  153. data/ext/ice/cpp/include/{Ice → generated/Ice}/CommunicatorF.h +51 -16
  154. data/ext/ice/cpp/include/generated/Ice/Connection.h +1660 -0
  155. data/ext/ice/cpp/include/generated/Ice/ConnectionF.h +119 -0
  156. data/ext/ice/cpp/include/generated/Ice/Current.h +322 -0
  157. data/ext/ice/cpp/include/generated/Ice/Endpoint.h +943 -0
  158. data/ext/ice/cpp/include/generated/Ice/EndpointF.h +166 -0
  159. data/ext/ice/cpp/include/generated/Ice/EndpointTypes.h +118 -0
  160. data/ext/ice/cpp/include/{Ice → generated/Ice}/FacetMap.h +31 -15
  161. data/ext/ice/cpp/include/generated/Ice/Identity.h +264 -0
  162. data/ext/ice/cpp/include/generated/Ice/ImplicitContext.h +278 -0
  163. data/ext/ice/cpp/include/{Ice → generated/Ice}/ImplicitContextF.h +51 -16
  164. data/ext/ice/cpp/include/generated/Ice/Instrumentation.h +1143 -0
  165. data/ext/ice/cpp/include/generated/Ice/InstrumentationF.h +128 -0
  166. data/ext/ice/cpp/include/generated/Ice/LocalException.h +7041 -0
  167. data/ext/ice/cpp/include/generated/Ice/Locator.h +3850 -0
  168. data/ext/ice/cpp/include/generated/Ice/LocatorF.h +147 -0
  169. data/ext/ice/cpp/include/generated/Ice/Logger.h +231 -0
  170. data/ext/ice/cpp/include/{Ice → generated/Ice}/LoggerF.h +51 -16
  171. data/ext/ice/cpp/include/generated/Ice/Metrics.h +4717 -0
  172. data/ext/ice/cpp/include/generated/Ice/ObjectAdapter.h +1175 -0
  173. data/ext/ice/cpp/include/{Ice → generated/Ice}/ObjectAdapterF.h +51 -16
  174. data/ext/ice/cpp/include/generated/Ice/ObjectFactory.h +197 -0
  175. data/ext/ice/cpp/include/generated/Ice/Plugin.h +306 -0
  176. data/ext/ice/cpp/include/generated/Ice/PluginF.h +110 -0
  177. data/ext/ice/cpp/include/generated/Ice/Process.h +971 -0
  178. data/ext/ice/cpp/include/generated/Ice/ProcessF.h +125 -0
  179. data/ext/ice/cpp/include/generated/Ice/Properties.h +446 -0
  180. data/ext/ice/cpp/include/generated/Ice/PropertiesAdmin.h +1360 -0
  181. data/ext/ice/cpp/include/generated/Ice/PropertiesF.h +134 -0
  182. data/ext/ice/cpp/include/generated/Ice/RemoteLogger.h +2689 -0
  183. data/ext/ice/cpp/include/generated/Ice/Router.h +1838 -0
  184. data/ext/ice/cpp/include/generated/Ice/RouterF.h +125 -0
  185. data/ext/ice/cpp/include/generated/Ice/ServantLocator.h +299 -0
  186. data/ext/ice/cpp/include/{Ice → generated/Ice}/ServantLocatorF.h +51 -16
  187. data/ext/ice/cpp/include/{Ice → generated/Ice}/SliceChecksumDict.h +34 -14
  188. data/ext/ice/cpp/include/generated/Ice/ValueFactory.h +318 -0
  189. data/ext/ice/cpp/include/generated/Ice/Version.h +357 -0
  190. data/ext/ice/cpp/include/generated/IceSSL/ConnectionInfo.h +223 -0
  191. data/ext/ice/cpp/include/generated/IceSSL/ConnectionInfoF.h +101 -0
  192. data/ext/ice/cpp/include/generated/IceSSL/EndpointInfo.h +181 -0
  193. data/ext/ice/cpp/src/Ice/ACM.cpp +38 -27
  194. data/ext/ice/cpp/src/Ice/ACM.h +9 -7
  195. data/ext/ice/cpp/src/Ice/ACMF.h +30 -0
  196. data/ext/ice/cpp/src/Ice/Acceptor.cpp +6 -6
  197. data/ext/ice/cpp/src/Ice/Acceptor.h +4 -8
  198. data/ext/ice/cpp/src/Ice/AcceptorF.h +1 -6
  199. data/ext/ice/cpp/src/Ice/ArgVector.cpp +59 -0
  200. data/ext/ice/cpp/src/Ice/ArgVector.h +36 -0
  201. data/ext/ice/cpp/src/Ice/AsyncResult.cpp +15 -544
  202. data/ext/ice/cpp/src/Ice/Base64.cpp +22 -28
  203. data/ext/ice/cpp/src/Ice/Base64.h +1 -6
  204. data/ext/ice/cpp/src/Ice/BatchRequestQueue.cpp +41 -18
  205. data/ext/ice/cpp/src/Ice/BatchRequestQueue.h +15 -15
  206. data/ext/ice/cpp/src/Ice/Buffer.cpp +75 -18
  207. data/ext/ice/cpp/src/Ice/BuiltinSequences.cpp +21 -12
  208. data/ext/ice/cpp/src/Ice/CollocatedRequestHandler.cpp +86 -197
  209. data/ext/ice/cpp/src/Ice/CollocatedRequestHandler.h +17 -23
  210. data/ext/ice/cpp/src/Ice/Communicator.cpp +43 -15
  211. data/ext/ice/cpp/src/Ice/CommunicatorF.cpp +28 -11
  212. data/ext/ice/cpp/src/Ice/CommunicatorI.cpp +318 -117
  213. data/ext/ice/cpp/src/Ice/CommunicatorI.h +95 -40
  214. data/ext/ice/cpp/src/{IceUtil → Ice}/Cond.cpp +3 -8
  215. data/ext/ice/cpp/src/Ice/ConnectRequestHandler.cpp +55 -122
  216. data/ext/ice/cpp/src/Ice/ConnectRequestHandler.h +15 -31
  217. data/ext/ice/cpp/src/Ice/ConnectRequestHandlerF.h +6 -7
  218. data/ext/ice/cpp/src/Ice/Connection.cpp +111 -20
  219. data/ext/ice/cpp/src/Ice/ConnectionF.cpp +28 -11
  220. data/ext/ice/cpp/src/Ice/ConnectionFactory.cpp +300 -107
  221. data/ext/ice/cpp/src/Ice/ConnectionFactory.h +44 -28
  222. data/ext/ice/cpp/src/Ice/ConnectionFactoryF.h +30 -0
  223. data/ext/ice/cpp/src/Ice/ConnectionI.cpp +785 -713
  224. data/ext/ice/cpp/src/Ice/ConnectionI.h +105 -80
  225. data/ext/ice/cpp/src/Ice/ConnectionRequestHandler.cpp +2 -20
  226. data/ext/ice/cpp/src/Ice/ConnectionRequestHandler.h +5 -9
  227. data/ext/ice/cpp/src/Ice/Connector.cpp +6 -6
  228. data/ext/ice/cpp/src/Ice/Connector.h +4 -8
  229. data/ext/ice/cpp/src/Ice/ConnectorF.h +1 -6
  230. data/ext/ice/cpp/src/{IceUtil → Ice}/CountDownLatch.cpp +4 -9
  231. data/ext/ice/cpp/src/Ice/Current.cpp +30 -12
  232. data/ext/ice/cpp/src/Ice/DefaultsAndOverrides.cpp +10 -16
  233. data/ext/ice/cpp/src/Ice/DefaultsAndOverrides.h +1 -6
  234. data/ext/ice/cpp/src/Ice/DefaultsAndOverridesF.h +1 -6
  235. data/ext/ice/cpp/src/Ice/DispatchInterceptor.cpp +13 -25
  236. data/ext/ice/cpp/src/Ice/DynamicLibrary.cpp +34 -28
  237. data/ext/ice/cpp/src/Ice/Endpoint.cpp +107 -19
  238. data/ext/ice/cpp/src/Ice/EndpointF.cpp +28 -11
  239. data/ext/ice/cpp/src/Ice/EndpointFactory.cpp +152 -6
  240. data/ext/ice/cpp/src/Ice/EndpointFactory.h +72 -11
  241. data/ext/ice/cpp/src/Ice/EndpointFactoryF.h +1 -6
  242. data/ext/ice/cpp/src/Ice/EndpointFactoryManager.cpp +41 -36
  243. data/ext/ice/cpp/src/Ice/EndpointFactoryManager.h +10 -9
  244. data/ext/ice/cpp/src/Ice/EndpointFactoryManagerF.h +1 -6
  245. data/ext/ice/cpp/src/Ice/EndpointI.cpp +18 -7
  246. data/ext/ice/cpp/src/Ice/EndpointI.h +39 -18
  247. data/ext/ice/cpp/src/Ice/EndpointIF.h +18 -10
  248. data/ext/ice/cpp/src/Ice/EndpointTypes.cpp +19 -12
  249. data/ext/ice/cpp/src/Ice/EventHandler.cpp +6 -9
  250. data/ext/ice/cpp/src/Ice/EventHandler.h +13 -13
  251. data/ext/ice/cpp/src/Ice/EventHandlerF.h +5 -7
  252. data/ext/ice/cpp/src/Ice/Exception.cpp +102 -98
  253. data/ext/ice/cpp/src/Ice/FacetMap.cpp +21 -12
  254. data/ext/ice/cpp/src/Ice/FactoryTable.cpp +37 -33
  255. data/ext/ice/cpp/src/Ice/FactoryTableInit.cpp +2 -9
  256. data/ext/ice/cpp/src/Ice/GCObject.cpp +29 -31
  257. data/ext/ice/cpp/src/Ice/HashUtil.h +3 -9
  258. data/ext/ice/cpp/src/Ice/HttpParser.cpp +1 -7
  259. data/ext/ice/cpp/src/Ice/HttpParser.h +1 -6
  260. data/ext/ice/cpp/src/Ice/IPEndpointI.cpp +128 -111
  261. data/ext/ice/cpp/src/Ice/IPEndpointI.h +23 -19
  262. data/ext/ice/cpp/src/Ice/IPEndpointIF.h +6 -7
  263. data/ext/ice/cpp/src/Ice/IconvStringConverter.cpp +51 -0
  264. data/ext/ice/cpp/src/Ice/Identity.cpp +25 -16
  265. data/ext/ice/cpp/src/Ice/ImplicitContext.cpp +41 -13
  266. data/ext/ice/cpp/src/Ice/ImplicitContextF.cpp +28 -11
  267. data/ext/ice/cpp/src/Ice/ImplicitContextI.cpp +11 -28
  268. data/ext/ice/cpp/src/Ice/ImplicitContextI.h +7 -10
  269. data/ext/ice/cpp/src/Ice/Incoming.cpp +284 -255
  270. data/ext/ice/cpp/src/Ice/IncomingAsync.cpp +104 -214
  271. data/ext/ice/cpp/src/Ice/IncomingRequest.h +5 -9
  272. data/ext/ice/cpp/src/Ice/Initialize.cpp +309 -193
  273. data/ext/ice/cpp/src/Ice/InputStream.cpp +2726 -0
  274. data/ext/ice/cpp/src/Ice/Instance.cpp +243 -262
  275. data/ext/ice/cpp/src/Ice/Instance.h +30 -23
  276. data/ext/ice/cpp/src/Ice/Instrumentation.cpp +137 -23
  277. data/ext/ice/cpp/src/Ice/InstrumentationF.cpp +28 -11
  278. data/ext/ice/cpp/src/Ice/InstrumentationI.cpp +118 -105
  279. data/ext/ice/cpp/src/Ice/InstrumentationI.h +30 -36
  280. data/ext/ice/cpp/src/Ice/LocalException.cpp +1191 -422
  281. data/ext/ice/cpp/src/Ice/LocalObject.cpp +1 -7
  282. data/ext/ice/cpp/src/Ice/Locator.cpp +1282 -1222
  283. data/ext/ice/cpp/src/Ice/LocatorF.cpp +30 -12
  284. data/ext/ice/cpp/src/Ice/LocatorInfo.cpp +150 -186
  285. data/ext/ice/cpp/src/Ice/LocatorInfo.h +31 -36
  286. data/ext/ice/cpp/src/Ice/LocatorInfoF.h +1 -6
  287. data/ext/ice/cpp/src/Ice/Logger.cpp +39 -12
  288. data/ext/ice/cpp/src/Ice/LoggerAdminI.cpp +182 -88
  289. data/ext/ice/cpp/src/Ice/LoggerAdminI.h +4 -9
  290. data/ext/ice/cpp/src/Ice/LoggerF.cpp +28 -11
  291. data/ext/ice/cpp/src/Ice/LoggerI.cpp +26 -55
  292. data/ext/ice/cpp/src/Ice/LoggerI.h +7 -18
  293. data/ext/ice/cpp/src/Ice/LoggerUtil.cpp +10 -17
  294. data/ext/ice/cpp/src/Ice/Metrics.cpp +1280 -1107
  295. data/ext/ice/cpp/src/Ice/MetricsAdminI.cpp +58 -33
  296. data/ext/ice/cpp/src/Ice/MetricsObserverI.cpp +1 -7
  297. data/ext/ice/cpp/src/Ice/Network.cpp +753 -408
  298. data/ext/ice/cpp/src/Ice/Network.h +99 -36
  299. data/ext/ice/cpp/src/Ice/NetworkF.h +2 -7
  300. data/ext/ice/cpp/src/Ice/NetworkProxy.cpp +20 -19
  301. data/ext/ice/cpp/src/Ice/NetworkProxy.h +5 -7
  302. data/ext/ice/cpp/src/Ice/NetworkProxyF.h +1 -6
  303. data/ext/ice/cpp/src/Ice/OSLogLoggerI.cpp +57 -0
  304. data/ext/ice/cpp/src/Ice/OSLogLoggerI.h +40 -0
  305. data/ext/ice/cpp/src/Ice/Object.cpp +227 -232
  306. data/ext/ice/cpp/src/Ice/ObjectAdapter.cpp +45 -13
  307. data/ext/ice/cpp/src/Ice/ObjectAdapterF.cpp +28 -11
  308. data/ext/ice/cpp/src/Ice/ObjectAdapterFactory.cpp +83 -33
  309. data/ext/ice/cpp/src/Ice/ObjectAdapterFactory.h +13 -12
  310. data/ext/ice/cpp/src/Ice/ObjectAdapterFactoryF.h +25 -0
  311. data/ext/ice/cpp/src/Ice/ObjectAdapterI.cpp +298 -191
  312. data/ext/ice/cpp/src/Ice/ObjectAdapterI.h +44 -39
  313. data/ext/ice/cpp/src/Ice/ObjectFactory.cpp +41 -13
  314. data/ext/ice/cpp/src/Ice/ObserverHelper.cpp +9 -37
  315. data/ext/ice/cpp/src/Ice/OpaqueEndpointI.cpp +67 -67
  316. data/ext/ice/cpp/src/Ice/OpaqueEndpointI.h +15 -11
  317. data/ext/ice/cpp/src/Ice/OutgoingAsync.cpp +801 -366
  318. data/ext/ice/cpp/src/Ice/OutputStream.cpp +1367 -0
  319. data/ext/ice/cpp/src/Ice/Plugin.cpp +52 -14
  320. data/ext/ice/cpp/src/Ice/PluginF.cpp +28 -11
  321. data/ext/ice/cpp/src/Ice/PluginManagerI.cpp +27 -51
  322. data/ext/ice/cpp/src/Ice/PluginManagerI.h +7 -13
  323. data/ext/ice/cpp/src/Ice/Process.cpp +294 -128
  324. data/ext/ice/cpp/src/Ice/ProcessF.cpp +30 -12
  325. data/ext/ice/cpp/src/Ice/Properties.cpp +42 -15
  326. data/ext/ice/cpp/src/Ice/PropertiesAdmin.cpp +382 -340
  327. data/ext/ice/cpp/src/Ice/PropertiesAdminI.cpp +83 -24
  328. data/ext/ice/cpp/src/Ice/PropertiesAdminI.h +29 -10
  329. data/ext/ice/cpp/src/Ice/PropertiesF.cpp +30 -12
  330. data/ext/ice/cpp/src/Ice/PropertiesI.cpp +46 -57
  331. data/ext/ice/cpp/src/Ice/PropertiesI.h +18 -26
  332. data/ext/ice/cpp/src/Ice/PropertyNames.cpp +112 -19
  333. data/ext/ice/cpp/src/Ice/PropertyNames.h +4 -7
  334. data/ext/ice/cpp/src/Ice/Protocol.cpp +6 -19
  335. data/ext/ice/cpp/src/Ice/ProtocolInstance.cpp +37 -7
  336. data/ext/ice/cpp/src/Ice/ProtocolInstance.h +9 -25
  337. data/ext/ice/cpp/src/Ice/ProtocolInstanceF.h +1 -6
  338. data/ext/ice/cpp/src/Ice/ProtocolPluginFacade.cpp +6 -6
  339. data/ext/ice/cpp/src/Ice/ProtocolPluginFacade.h +3 -6
  340. data/ext/ice/cpp/src/Ice/ProtocolPluginFacadeF.h +1 -6
  341. data/ext/ice/cpp/src/Ice/Proxy.cpp +729 -957
  342. data/ext/ice/cpp/src/Ice/ProxyFactory.cpp +33 -38
  343. data/ext/ice/cpp/src/Ice/ProxyFactory.h +16 -16
  344. data/ext/ice/cpp/src/Ice/Reference.cpp +190 -106
  345. data/ext/ice/cpp/src/Ice/Reference.h +39 -28
  346. data/ext/ice/cpp/src/Ice/ReferenceFactory.cpp +69 -118
  347. data/ext/ice/cpp/src/Ice/ReferenceFactory.h +12 -17
  348. data/ext/ice/cpp/src/Ice/ReferenceFactoryF.h +1 -6
  349. data/ext/ice/cpp/src/Ice/RegisterPluginsInit.cpp +19 -9
  350. data/ext/ice/cpp/src/Ice/RegisterPluginsInit.h +1 -6
  351. data/ext/ice/cpp/src/Ice/RemoteLogger.cpp +766 -565
  352. data/ext/ice/cpp/src/Ice/ReplyStatus.h +1 -6
  353. data/ext/ice/cpp/src/Ice/RequestHandler.cpp +5 -8
  354. data/ext/ice/cpp/src/Ice/RequestHandler.h +10 -18
  355. data/ext/ice/cpp/src/Ice/RequestHandlerFactory.cpp +10 -11
  356. data/ext/ice/cpp/src/Ice/RequestHandlerFactory.h +2 -7
  357. data/ext/ice/cpp/src/Ice/ResponseHandler.cpp +3 -11
  358. data/ext/ice/cpp/src/Ice/ResponseHandler.h +16 -12
  359. data/ext/ice/cpp/src/Ice/RetryQueue.cpp +12 -20
  360. data/ext/ice/cpp/src/Ice/RetryQueue.h +7 -11
  361. data/ext/ice/cpp/src/Ice/RetryQueueF.h +1 -6
  362. data/ext/ice/cpp/src/Ice/Router.cpp +614 -492
  363. data/ext/ice/cpp/src/Ice/RouterF.cpp +30 -12
  364. data/ext/ice/cpp/src/Ice/RouterInfo.cpp +93 -99
  365. data/ext/ice/cpp/src/Ice/RouterInfo.h +42 -38
  366. data/ext/ice/cpp/src/Ice/RouterInfoF.h +1 -6
  367. data/ext/ice/cpp/src/{IceUtil → Ice}/SHA1.cpp +23 -28
  368. data/ext/ice/cpp/src/Ice/Selector.cpp +948 -855
  369. data/ext/ice/cpp/src/Ice/Selector.h +100 -152
  370. data/ext/ice/cpp/src/Ice/ServantLocator.cpp +41 -13
  371. data/ext/ice/cpp/src/Ice/ServantLocatorF.cpp +28 -11
  372. data/ext/ice/cpp/src/Ice/ServantManager.cpp +24 -45
  373. data/ext/ice/cpp/src/Ice/ServantManager.h +1 -6
  374. data/ext/ice/cpp/src/Ice/SharedContext.h +2 -7
  375. data/ext/ice/cpp/src/Ice/SliceChecksumDict.cpp +21 -12
  376. data/ext/ice/cpp/src/Ice/SliceChecksums.cpp +2 -7
  377. data/ext/ice/cpp/src/Ice/SlicedData.cpp +72 -25
  378. data/ext/ice/cpp/src/Ice/StreamSocket.cpp +208 -76
  379. data/ext/ice/cpp/src/Ice/StreamSocket.h +13 -9
  380. data/ext/ice/cpp/src/Ice/StringConverterPlugin.cpp +57 -22
  381. data/ext/ice/cpp/src/Ice/StringUtil.h +30 -0
  382. data/ext/ice/cpp/src/Ice/SysLoggerI.cpp +6 -7
  383. data/ext/ice/cpp/src/Ice/SysLoggerI.h +2 -8
  384. data/ext/ice/cpp/src/Ice/SystemdJournalI.cpp +66 -0
  385. data/ext/ice/cpp/src/Ice/SystemdJournalI.h +39 -0
  386. data/ext/ice/cpp/src/Ice/TcpAcceptor.cpp +169 -49
  387. data/ext/ice/cpp/src/Ice/TcpAcceptor.h +12 -10
  388. data/ext/ice/cpp/src/Ice/TcpConnector.cpp +6 -12
  389. data/ext/ice/cpp/src/Ice/TcpConnector.h +1 -7
  390. data/ext/ice/cpp/src/Ice/TcpEndpointI.cpp +51 -46
  391. data/ext/ice/cpp/src/Ice/TcpEndpointI.h +12 -14
  392. data/ext/ice/cpp/src/Ice/TcpTransceiver.cpp +17 -32
  393. data/ext/ice/cpp/src/Ice/TcpTransceiver.h +7 -15
  394. data/ext/ice/cpp/src/{IceUtil → Ice}/Thread.cpp +41 -54
  395. data/ext/ice/cpp/src/Ice/ThreadPool.cpp +242 -274
  396. data/ext/ice/cpp/src/Ice/ThreadPool.h +46 -48
  397. data/ext/ice/cpp/src/{IceUtil → Ice}/Timer.cpp +38 -26
  398. data/ext/ice/cpp/src/Ice/TraceLevels.cpp +2 -7
  399. data/ext/ice/cpp/src/Ice/TraceLevels.h +1 -6
  400. data/ext/ice/cpp/src/Ice/TraceLevelsF.h +2 -7
  401. data/ext/ice/cpp/src/Ice/TraceUtil.cpp +53 -36
  402. data/ext/ice/cpp/src/Ice/TraceUtil.h +13 -11
  403. data/ext/ice/cpp/src/Ice/Transceiver.cpp +1 -7
  404. data/ext/ice/cpp/src/Ice/Transceiver.h +8 -12
  405. data/ext/ice/cpp/src/Ice/TransceiverF.h +3 -8
  406. data/ext/ice/cpp/src/Ice/UdpConnector.cpp +5 -13
  407. data/ext/ice/cpp/src/Ice/UdpConnector.h +1 -7
  408. data/ext/ice/cpp/src/Ice/UdpEndpointI.cpp +118 -60
  409. data/ext/ice/cpp/src/Ice/UdpEndpointI.h +13 -10
  410. data/ext/ice/cpp/src/Ice/UdpTransceiver.cpp +177 -236
  411. data/ext/ice/cpp/src/Ice/UdpTransceiver.h +15 -22
  412. data/ext/ice/cpp/src/Ice/Value.cpp +76 -0
  413. data/ext/ice/cpp/src/Ice/ValueFactory.cpp +83 -0
  414. data/ext/ice/cpp/src/Ice/ValueFactoryManagerI.cpp +61 -0
  415. data/ext/ice/cpp/src/Ice/ValueFactoryManagerI.h +37 -0
  416. data/ext/ice/cpp/src/Ice/Version.cpp +25 -20
  417. data/ext/ice/cpp/src/Ice/VirtualShared.h +38 -0
  418. data/ext/ice/cpp/src/Ice/WSAcceptor.cpp +3 -14
  419. data/ext/ice/cpp/src/Ice/WSAcceptor.h +3 -12
  420. data/ext/ice/cpp/src/Ice/WSConnector.cpp +5 -16
  421. data/ext/ice/cpp/src/Ice/WSConnector.h +3 -11
  422. data/ext/ice/cpp/src/Ice/WSEndpoint.cpp +188 -89
  423. data/ext/ice/cpp/src/Ice/WSEndpoint.h +22 -37
  424. data/ext/ice/cpp/src/Ice/WSTransceiver.cpp +65 -66
  425. data/ext/ice/cpp/src/Ice/WSTransceiver.h +7 -27
  426. data/ext/ice/cpp/src/IceDiscovery/IceDiscovery.cpp +596 -281
  427. data/ext/ice/cpp/src/IceDiscovery/IceDiscovery.h +1383 -543
  428. data/ext/ice/cpp/src/IceDiscovery/LocatorI.cpp +89 -32
  429. data/ext/ice/cpp/src/IceDiscovery/LocatorI.h +59 -28
  430. data/ext/ice/cpp/src/IceDiscovery/LookupI.cpp +315 -66
  431. data/ext/ice/cpp/src/IceDiscovery/LookupI.h +83 -41
  432. data/ext/ice/cpp/src/IceDiscovery/PluginI.cpp +57 -64
  433. data/ext/ice/cpp/src/IceDiscovery/PluginI.h +3 -8
  434. data/ext/ice/cpp/src/IceLocatorDiscovery/IceLocatorDiscovery.cpp +450 -172
  435. data/ext/ice/cpp/src/IceLocatorDiscovery/IceLocatorDiscovery.h +863 -406
  436. data/ext/ice/cpp/src/IceLocatorDiscovery/Plugin.h +47 -0
  437. data/ext/ice/cpp/src/IceLocatorDiscovery/PluginI.cpp +636 -144
  438. data/ext/ice/cpp/src/IceSSL/AcceptorI.cpp +20 -173
  439. data/ext/ice/cpp/src/IceSSL/AcceptorI.h +8 -22
  440. data/ext/ice/cpp/src/IceSSL/CertificateI.cpp +279 -0
  441. data/ext/ice/cpp/src/IceSSL/CertificateI.h +64 -0
  442. data/ext/ice/cpp/src/IceSSL/ConnectionInfo.cpp +42 -17
  443. data/ext/ice/cpp/src/IceSSL/ConnectionInfoF.cpp +61 -0
  444. data/ext/ice/cpp/src/IceSSL/ConnectorI.cpp +15 -64
  445. data/ext/ice/cpp/src/IceSSL/ConnectorI.h +6 -18
  446. data/ext/ice/cpp/src/IceSSL/EndpointI.cpp +207 -204
  447. data/ext/ice/cpp/src/IceSSL/EndpointI.h +43 -40
  448. data/ext/ice/cpp/src/IceSSL/EndpointInfo.cpp +42 -16
  449. data/ext/ice/cpp/src/IceSSL/Instance.cpp +1 -11
  450. data/ext/ice/cpp/src/IceSSL/Instance.h +7 -12
  451. data/ext/ice/cpp/src/IceSSL/InstanceF.h +11 -12
  452. data/ext/ice/cpp/src/IceSSL/OpenSSLCertificateI.cpp +583 -0
  453. data/ext/ice/cpp/src/IceSSL/OpenSSLEngine.cpp +134 -115
  454. data/ext/ice/cpp/src/IceSSL/OpenSSLEngine.h +59 -0
  455. data/ext/ice/cpp/src/IceSSL/OpenSSLEngineF.h +27 -0
  456. data/ext/ice/cpp/src/IceSSL/OpenSSLPluginI.cpp +127 -0
  457. data/ext/ice/cpp/src/IceSSL/OpenSSLTransceiverI.cpp +477 -182
  458. data/ext/ice/cpp/src/IceSSL/OpenSSLTransceiverI.h +32 -26
  459. data/ext/ice/cpp/src/IceSSL/OpenSSLUtil.cpp +286 -0
  460. data/ext/ice/cpp/src/IceSSL/OpenSSLUtil.h +58 -0
  461. data/ext/ice/cpp/src/IceSSL/PluginI.cpp +71 -46
  462. data/ext/ice/cpp/src/IceSSL/PluginI.h +13 -23
  463. data/ext/ice/cpp/src/IceSSL/RFC2253.cpp +9 -60
  464. data/ext/ice/cpp/src/IceSSL/RFC2253.h +7 -12
  465. data/ext/ice/cpp/src/IceSSL/SChannelCertificateI.cpp +580 -0
  466. data/ext/ice/cpp/src/IceSSL/SChannelEngine.cpp +523 -74
  467. data/ext/ice/cpp/src/IceSSL/SChannelEngine.h +123 -0
  468. data/ext/ice/cpp/src/IceSSL/SChannelEngineF.h +31 -0
  469. data/ext/ice/cpp/src/IceSSL/SChannelPluginI.cpp +73 -0
  470. data/ext/ice/cpp/src/IceSSL/SChannelTransceiverI.cpp +187 -221
  471. data/ext/ice/cpp/src/IceSSL/SChannelTransceiverI.h +24 -26
  472. data/ext/ice/cpp/src/IceSSL/SSLEngine.cpp +97 -94
  473. data/ext/ice/cpp/src/IceSSL/SSLEngine.h +26 -192
  474. data/ext/ice/cpp/src/IceSSL/SSLEngineF.h +4 -24
  475. data/ext/ice/cpp/src/IceSSL/SecureTransportCertificateI.cpp +868 -0
  476. data/ext/ice/cpp/src/IceSSL/SecureTransportEngine.cpp +69 -201
  477. data/ext/ice/cpp/src/IceSSL/SecureTransportEngine.h +59 -0
  478. data/ext/ice/cpp/src/IceSSL/SecureTransportEngineF.h +29 -0
  479. data/ext/ice/cpp/src/IceSSL/SecureTransportPluginI.cpp +75 -0
  480. data/ext/ice/cpp/src/IceSSL/SecureTransportTransceiverI.cpp +174 -161
  481. data/ext/ice/cpp/src/IceSSL/SecureTransportTransceiverI.h +29 -33
  482. data/ext/ice/cpp/src/IceSSL/SecureTransportUtil.cpp +864 -0
  483. data/ext/ice/cpp/src/IceSSL/SecureTransportUtil.h +45 -0
  484. data/ext/ice/cpp/src/IceSSL/TrustManager.cpp +12 -22
  485. data/ext/ice/cpp/src/IceSSL/TrustManager.h +4 -9
  486. data/ext/ice/cpp/src/IceSSL/TrustManagerF.h +3 -8
  487. data/ext/ice/cpp/src/IceSSL/UWPCertificateI.cpp +266 -0
  488. data/ext/ice/cpp/src/IceSSL/UWPEngine.cpp +338 -0
  489. data/ext/ice/cpp/src/IceSSL/UWPEngine.h +41 -0
  490. data/ext/ice/cpp/src/IceSSL/UWPEngineF.h +26 -0
  491. data/ext/ice/cpp/src/IceSSL/UWPPluginI.cpp +89 -0
  492. data/ext/ice/cpp/src/IceSSL/UWPTransceiverI.cpp +383 -0
  493. data/ext/ice/cpp/src/IceSSL/UWPTransceiverI.h +71 -0
  494. data/ext/ice/cpp/src/IceSSL/Util.cpp +71 -1260
  495. data/ext/ice/cpp/src/IceSSL/Util.h +48 -142
  496. data/ext/ice/cpp/src/IceUtil/ConsoleUtil.cpp +157 -0
  497. data/ext/ice/cpp/src/IceUtil/ConvertUTF.cpp +22 -27
  498. data/ext/ice/cpp/src/IceUtil/ConvertUTF.h +34 -31
  499. data/ext/ice/cpp/src/IceUtil/CtrlCHandler.cpp +22 -36
  500. data/ext/ice/cpp/src/IceUtil/FileUtil.cpp +30 -126
  501. data/ext/ice/cpp/src/IceUtil/InputUtil.cpp +1 -6
  502. data/ext/ice/cpp/src/IceUtil/MutexProtocol.cpp +1 -6
  503. data/ext/ice/cpp/src/IceUtil/Options.cpp +20 -33
  504. data/ext/ice/cpp/src/IceUtil/OutputUtil.cpp +47 -21
  505. data/ext/ice/cpp/src/IceUtil/Random.cpp +15 -20
  506. data/ext/ice/cpp/src/IceUtil/RecMutex.cpp +4 -19
  507. data/ext/ice/cpp/src/IceUtil/Shared.cpp +8 -8
  508. data/ext/ice/cpp/src/IceUtil/StringConverter.cpp +501 -269
  509. data/ext/ice/cpp/src/IceUtil/StringUtil.cpp +582 -244
  510. data/ext/ice/cpp/src/IceUtil/ThreadException.cpp +37 -79
  511. data/ext/ice/cpp/src/IceUtil/Time.cpp +6 -11
  512. data/ext/ice/cpp/src/IceUtil/UUID.cpp +17 -22
  513. data/ext/ice/cpp/src/IceUtil/Unicode.cpp +97 -101
  514. data/ext/ice/cpp/src/IceUtil/Unicode.h +21 -40
  515. data/ext/ice/cpp/src/IceUtil/UtilException.cpp +839 -0
  516. data/ext/ice/cpp/src/Slice/CPlusPlusUtil.cpp +894 -234
  517. data/ext/ice/cpp/src/Slice/CPlusPlusUtil.h +72 -0
  518. data/ext/ice/cpp/src/Slice/Checksum.cpp +2 -7
  519. data/ext/ice/cpp/src/Slice/Checksum.h +21 -0
  520. data/ext/ice/cpp/src/Slice/FileTracker.cpp +25 -83
  521. data/ext/ice/cpp/{include → src}/Slice/FileTracker.h +9 -14
  522. data/ext/ice/cpp/src/Slice/Grammar.cpp +1981 -1944
  523. data/ext/ice/cpp/src/Slice/Grammar.h +39 -19
  524. data/ext/ice/cpp/src/Slice/GrammarUtil.h +14 -20
  525. data/ext/ice/cpp/src/Slice/JavaUtil.cpp +2752 -1948
  526. data/ext/ice/cpp/src/Slice/JavaUtil.h +398 -0
  527. data/ext/ice/cpp/src/Slice/MD5.cpp +1 -6
  528. data/ext/ice/cpp/src/Slice/MD5.h +1 -6
  529. data/ext/ice/cpp/src/Slice/MD5I.cpp +8 -1
  530. data/ext/ice/cpp/src/Slice/MD5I.h +1 -1
  531. data/ext/ice/cpp/src/Slice/PHPUtil.cpp +17 -20
  532. data/ext/ice/cpp/src/Slice/PHPUtil.h +36 -0
  533. data/ext/ice/cpp/src/Slice/Parser.cpp +1190 -426
  534. data/ext/ice/cpp/{include → src}/Slice/Parser.h +143 -91
  535. data/ext/ice/cpp/src/Slice/Preprocessor.cpp +67 -36
  536. data/ext/ice/cpp/{include → src}/Slice/Preprocessor.h +8 -18
  537. data/ext/ice/cpp/src/Slice/Python.cpp +218 -111
  538. data/ext/ice/cpp/src/Slice/PythonUtil.cpp +787 -699
  539. data/ext/ice/cpp/src/Slice/PythonUtil.h +70 -0
  540. data/ext/ice/cpp/src/Slice/Ruby.cpp +42 -43
  541. data/ext/ice/cpp/src/Slice/RubyUtil.cpp +175 -445
  542. data/ext/ice/cpp/{include → src}/Slice/RubyUtil.h +6 -11
  543. data/ext/ice/cpp/src/Slice/Scanner.cpp +390 -399
  544. data/ext/ice/cpp/src/Slice/{Util.cpp → SliceUtil.cpp} +36 -69
  545. data/ext/ice/cpp/src/Slice/StringLiteralUtil.cpp +456 -0
  546. data/ext/ice/cpp/src/Slice/Util.h +50 -0
  547. data/ice.gemspec +2 -9
  548. data/lib/Glacier2.rb +1 -6
  549. data/lib/Glacier2/Metrics.rb +6 -50
  550. data/lib/Glacier2/PermissionsVerifier.rb +23 -99
  551. data/lib/Glacier2/PermissionsVerifierF.rb +2 -7
  552. data/lib/Glacier2/Router.rb +31 -78
  553. data/lib/Glacier2/RouterF.rb +2 -7
  554. data/lib/Glacier2/SSLInfo.rb +3 -11
  555. data/lib/Glacier2/Session.rb +87 -311
  556. data/lib/Ice.rb +84 -58
  557. data/lib/Ice/BuiltinSequences.rb +3 -8
  558. data/lib/Ice/Communicator.rb +54 -61
  559. data/lib/Ice/CommunicatorF.rb +2 -7
  560. data/lib/Ice/Connection.rb +152 -166
  561. data/lib/Ice/ConnectionF.rb +2 -7
  562. data/lib/Ice/Current.rb +3 -15
  563. data/lib/Ice/Endpoint.rb +56 -137
  564. data/lib/Ice/EndpointF.rb +2 -7
  565. data/lib/Ice/EndpointTypes.rb +2 -11
  566. data/lib/Ice/FacetMap.rb +3 -8
  567. data/lib/Ice/Identity.rb +4 -12
  568. data/lib/Ice/ImplicitContext.rb +4 -38
  569. data/lib/Ice/ImplicitContextF.rb +2 -7
  570. data/lib/Ice/Instrumentation.rb +22 -279
  571. data/lib/Ice/InstrumentationF.rb +2 -7
  572. data/lib/Ice/LocalException.rb +94 -145
  573. data/lib/Ice/Locator.rb +50 -169
  574. data/lib/Ice/LocatorF.rb +2 -7
  575. data/lib/Ice/Logger.rb +4 -38
  576. data/lib/Ice/LoggerF.rb +2 -7
  577. data/lib/Ice/Metrics.rb +60 -420
  578. data/lib/Ice/ObjectAdapter.rb +29 -0
  579. data/lib/Ice/ObjectAdapterF.rb +2 -7
  580. data/lib/Ice/ObjectFactory.rb +4 -34
  581. data/lib/Ice/Plugin.rb +6 -64
  582. data/lib/Ice/PluginF.rb +2 -7
  583. data/lib/Ice/Process.rb +15 -56
  584. data/lib/Ice/ProcessF.rb +2 -7
  585. data/lib/Ice/Properties.rb +4 -45
  586. data/lib/Ice/PropertiesAdmin.rb +18 -60
  587. data/lib/Ice/PropertiesF.rb +2 -7
  588. data/lib/Ice/RemoteLogger.rb +33 -119
  589. data/lib/Ice/Router.rb +28 -105
  590. data/lib/Ice/RouterF.rb +2 -7
  591. data/lib/Ice/ServantLocator.rb +26 -0
  592. data/lib/Ice/ServantLocatorF.rb +24 -0
  593. data/lib/Ice/SliceChecksumDict.rb +2 -7
  594. data/lib/Ice/ValueFactory.rb +28 -0
  595. data/lib/Ice/Version.rb +4 -15
  596. data/lib/IceBox.rb +1 -6
  597. data/lib/IceBox/IceBox.rb +43 -152
  598. data/lib/IceGrid.rb +1 -9
  599. data/lib/IceGrid/Admin.rb +550 -431
  600. data/lib/IceGrid/Descriptor.rb +61 -533
  601. data/lib/IceGrid/Exception.rb +23 -49
  602. data/lib/IceGrid/FileParser.rb +13 -54
  603. data/lib/IceGrid/PluginFacade.rb +35 -0
  604. data/lib/IceGrid/Registry.rb +150 -62
  605. data/lib/IceGrid/Session.rb +24 -68
  606. data/lib/IceGrid/UserAccountMapper.rb +13 -54
  607. data/lib/IcePatch2.rb +1 -6
  608. data/lib/IcePatch2/FileInfo.rb +4 -15
  609. data/lib/IcePatch2/FileServer.rb +32 -80
  610. data/lib/IceStorm.rb +1 -6
  611. data/lib/IceStorm/IceStorm.rb +78 -210
  612. data/lib/IceStorm/Metrics.rb +10 -93
  613. data/slice/Glacier2/Metrics.ice +20 -10
  614. data/slice/Glacier2/PermissionsVerifier.ice +19 -12
  615. data/slice/Glacier2/PermissionsVerifierF.ice +16 -9
  616. data/slice/Glacier2/Router.ice +19 -13
  617. data/slice/Glacier2/RouterF.ice +16 -9
  618. data/slice/Glacier2/SSLInfo.ice +17 -10
  619. data/slice/Glacier2/Session.ice +24 -18
  620. data/slice/Ice/BuiltinSequences.ice +18 -9
  621. data/slice/Ice/Communicator.ice +180 -64
  622. data/slice/Ice/CommunicatorF.ice +18 -9
  623. data/slice/Ice/Connection.ice +208 -75
  624. data/slice/Ice/ConnectionF.ice +18 -9
  625. data/slice/Ice/Current.ice +37 -28
  626. data/slice/Ice/Endpoint.ice +73 -21
  627. data/slice/Ice/EndpointF.ice +19 -10
  628. data/slice/Ice/EndpointTypes.ice +21 -13
  629. data/slice/Ice/FacetMap.ice +19 -10
  630. data/slice/Ice/Identity.ice +24 -10
  631. data/slice/Ice/ImplicitContext.ice +41 -33
  632. data/slice/Ice/ImplicitContextF.ice +17 -9
  633. data/slice/Ice/Instrumentation.ice +37 -30
  634. data/slice/Ice/InstrumentationF.ice +19 -10
  635. data/slice/Ice/LocalException.ice +118 -112
  636. data/slice/Ice/Locator.ice +28 -21
  637. data/slice/Ice/LocatorF.ice +18 -9
  638. data/slice/Ice/Logger.ice +26 -18
  639. data/slice/Ice/LoggerF.ice +18 -9
  640. data/slice/Ice/Metrics.ice +42 -30
  641. data/slice/Ice/ObjectAdapter.ice +88 -53
  642. data/slice/Ice/ObjectAdapterF.ice +18 -9
  643. data/slice/Ice/ObjectFactory.ice +28 -17
  644. data/slice/Ice/Plugin.ice +25 -13
  645. data/slice/Ice/PluginF.ice +22 -9
  646. data/slice/Ice/Process.ice +20 -11
  647. data/slice/Ice/ProcessF.ice +18 -9
  648. data/slice/Ice/Properties.ice +42 -28
  649. data/slice/Ice/PropertiesAdmin.ice +20 -10
  650. data/slice/Ice/PropertiesF.ice +18 -9
  651. data/slice/Ice/RemoteLogger.ice +23 -19
  652. data/slice/Ice/Router.ice +28 -13
  653. data/slice/Ice/RouterF.ice +18 -9
  654. data/slice/Ice/ServantLocator.ice +40 -29
  655. data/slice/Ice/ServantLocatorF.ice +18 -9
  656. data/slice/Ice/SliceChecksumDict.ice +18 -9
  657. data/slice/Ice/ValueFactory.ice +132 -0
  658. data/slice/Ice/Version.ice +20 -10
  659. data/slice/IceBT/ConnectionInfo.ice +58 -0
  660. data/slice/IceBT/EndpointInfo.ice +56 -0
  661. data/slice/IceBT/Types.ice +44 -0
  662. data/slice/IceBox/IceBox.ice +45 -27
  663. data/slice/IceDiscovery/IceDiscovery.ice +75 -10
  664. data/slice/IceGrid/Admin.ice +410 -44
  665. data/slice/IceGrid/Descriptor.ice +47 -34
  666. data/slice/IceGrid/Exception.ice +43 -32
  667. data/slice/IceGrid/FileParser.ice +21 -12
  668. data/slice/IceGrid/PluginFacade.ice +26 -18
  669. data/slice/IceGrid/Registry.ice +150 -21
  670. data/slice/IceGrid/Session.ice +25 -17
  671. data/slice/IceGrid/UserAccountMapper.ice +23 -14
  672. data/slice/IceIAP/ConnectionInfo.ice +73 -0
  673. data/slice/IceIAP/EndpointInfo.ice +67 -0
  674. data/slice/IceLocatorDiscovery/IceLocatorDiscovery.ice +19 -12
  675. data/slice/IcePatch2/FileInfo.ice +19 -13
  676. data/slice/IcePatch2/FileServer.ice +27 -18
  677. data/slice/IceSSL/ConnectionInfo.ice +27 -23
  678. data/slice/IceSSL/ConnectionInfoF.ice +30 -0
  679. data/slice/IceSSL/EndpointInfo.ice +21 -36
  680. data/slice/IceStorm/IceStorm.ice +33 -24
  681. data/slice/IceStorm/Metrics.ice +19 -11
  682. metadata +148 -120
  683. data/ext/ObjectFactory.cpp +0 -140
  684. data/ext/ObjectFactory.h +0 -50
  685. data/ext/ice/cpp/include/Ice/ACMF.h +0 -30
  686. data/ext/ice/cpp/include/Ice/BasicStream.h +0 -1335
  687. data/ext/ice/cpp/include/Ice/BuiltinSequences.h +0 -82
  688. data/ext/ice/cpp/include/Ice/Communicator.h +0 -200
  689. data/ext/ice/cpp/include/Ice/Connection.h +0 -497
  690. data/ext/ice/cpp/include/Ice/ConnectionF.h +0 -74
  691. data/ext/ice/cpp/include/Ice/ConnectionFactoryF.h +0 -30
  692. data/ext/ice/cpp/include/Ice/Current.h +0 -102
  693. data/ext/ice/cpp/include/Ice/DefaultObjectFactory.h +0 -48
  694. data/ext/ice/cpp/include/Ice/DeprecatedStringConverter.h +0 -62
  695. data/ext/ice/cpp/include/Ice/Endpoint.h +0 -341
  696. data/ext/ice/cpp/include/Ice/EndpointF.h +0 -93
  697. data/ext/ice/cpp/include/Ice/EndpointTypes.h +0 -82
  698. data/ext/ice/cpp/include/Ice/Identity.h +0 -168
  699. data/ext/ice/cpp/include/Ice/ImplicitContext.h +0 -102
  700. data/ext/ice/cpp/include/Ice/Instrumentation.h +0 -365
  701. data/ext/ice/cpp/include/Ice/InstrumentationF.h +0 -75
  702. data/ext/ice/cpp/include/Ice/LocalException.h +0 -1030
  703. data/ext/ice/cpp/include/Ice/Locator.h +0 -2193
  704. data/ext/ice/cpp/include/Ice/LocatorF.h +0 -93
  705. data/ext/ice/cpp/include/Ice/Logger.h +0 -100
  706. data/ext/ice/cpp/include/Ice/Metrics.h +0 -2974
  707. data/ext/ice/cpp/include/Ice/ObjectAdapter.h +0 -168
  708. data/ext/ice/cpp/include/Ice/ObjectAdapterFactoryF.h +0 -26
  709. data/ext/ice/cpp/include/Ice/ObjectFactory.h +0 -92
  710. data/ext/ice/cpp/include/Ice/ObjectFactoryF.h +0 -66
  711. data/ext/ice/cpp/include/Ice/ObjectFactoryManagerF.h +0 -26
  712. data/ext/ice/cpp/include/Ice/Outgoing.h +0 -225
  713. data/ext/ice/cpp/include/Ice/Plugin.h +0 -125
  714. data/ext/ice/cpp/include/Ice/PluginF.h +0 -70
  715. data/ext/ice/cpp/include/Ice/Process.h +0 -574
  716. data/ext/ice/cpp/include/Ice/ProcessF.h +0 -83
  717. data/ext/ice/cpp/include/Ice/Properties.h +0 -136
  718. data/ext/ice/cpp/include/Ice/PropertiesAdmin.h +0 -830
  719. data/ext/ice/cpp/include/Ice/PropertiesF.h +0 -87
  720. data/ext/ice/cpp/include/Ice/RemoteLogger.h +0 -1500
  721. data/ext/ice/cpp/include/Ice/Router.h +0 -1159
  722. data/ext/ice/cpp/include/Ice/RouterF.h +0 -83
  723. data/ext/ice/cpp/include/Ice/ServantLocator.h +0 -96
  724. data/ext/ice/cpp/include/Ice/Stream.h +0 -447
  725. data/ext/ice/cpp/include/Ice/StreamF.h +0 -30
  726. data/ext/ice/cpp/include/Ice/Version.h +0 -262
  727. data/ext/ice/cpp/include/IceSSL/ConnectionInfo.h +0 -158
  728. data/ext/ice/cpp/include/IceSSL/EndpointInfo.h +0 -142
  729. data/ext/ice/cpp/include/IceUtil/AbstractMutex.h +0 -119
  730. data/ext/ice/cpp/include/IceUtil/Cache.h +0 -362
  731. data/ext/ice/cpp/include/IceUtil/IconvStringConverter.h +0 -302
  732. data/ext/ice/cpp/include/IceUtil/SHA1.h +0 -47
  733. data/ext/ice/cpp/include/Slice/CPlusPlusUtil.h +0 -65
  734. data/ext/ice/cpp/include/Slice/Checksum.h +0 -26
  735. data/ext/ice/cpp/include/Slice/CsUtil.h +0 -92
  736. data/ext/ice/cpp/include/Slice/DotNetNames.h +0 -34
  737. data/ext/ice/cpp/include/Slice/JavaUtil.h +0 -279
  738. data/ext/ice/cpp/include/Slice/ObjCUtil.h +0 -127
  739. data/ext/ice/cpp/include/Slice/PHPUtil.h +0 -50
  740. data/ext/ice/cpp/include/Slice/PythonUtil.h +0 -64
  741. data/ext/ice/cpp/include/Slice/Util.h +0 -56
  742. data/ext/ice/cpp/src/Ice/BasicStream.cpp +0 -3428
  743. data/ext/ice/cpp/src/Ice/DeprecatedStringConverter.cpp +0 -62
  744. data/ext/ice/cpp/src/Ice/ObjectFactoryF.cpp +0 -44
  745. data/ext/ice/cpp/src/Ice/ObjectFactoryManager.cpp +0 -139
  746. data/ext/ice/cpp/src/Ice/ObjectFactoryManager.h +0 -43
  747. data/ext/ice/cpp/src/Ice/Outgoing.cpp +0 -694
  748. data/ext/ice/cpp/src/Ice/Stream.cpp +0 -53
  749. data/ext/ice/cpp/src/Ice/StreamI.cpp +0 -832
  750. data/ext/ice/cpp/src/Ice/StreamI.h +0 -198
  751. data/ext/ice/cpp/src/IceSSL/Certificate.cpp +0 -1336
  752. data/ext/ice/cpp/src/IceUtil/ArgVector.cpp +0 -64
  753. data/ext/ice/cpp/src/IceUtil/ArgVector.h +0 -41
  754. data/ext/ice/cpp/src/IceUtil/Exception.cpp +0 -792
  755. data/ext/ice/cpp/src/IceUtil/FileUtil.h +0 -185
  756. data/ext/ice/cpp/src/Slice/CsUtil.cpp +0 -2660
  757. data/ext/ice/cpp/src/Slice/DotNetNames.cpp +0 -146
  758. data/ext/ice/cpp/src/Slice/ObjCUtil.cpp +0 -1310
  759. data/lib/Ice/ObjectFactoryF.rb +0 -29
  760. data/lib/IceGrid/Locator.rb +0 -106
  761. data/lib/IceGrid/Observer.rb +0 -572
  762. data/lib/IceGrid/Query.rb +0 -169
  763. data/slice/Freeze/BackgroundSaveEvictor.ice +0 -111
  764. data/slice/Freeze/CatalogData.ice +0 -49
  765. data/slice/Freeze/Connection.ice +0 -121
  766. data/slice/Freeze/ConnectionF.ice +0 -20
  767. data/slice/Freeze/DB.ice +0 -37
  768. data/slice/Freeze/Evictor.ice +0 -346
  769. data/slice/Freeze/EvictorF.ice +0 -22
  770. data/slice/Freeze/EvictorStorage.ice +0 -72
  771. data/slice/Freeze/Exception.ice +0 -100
  772. data/slice/Freeze/Transaction.ice +0 -58
  773. data/slice/Freeze/TransactionalEvictor.ice +0 -50
  774. data/slice/Ice/ObjectFactoryF.ice +0 -21
  775. data/slice/IceGrid/Locator.ice +0 -57
  776. data/slice/IceGrid/Observer.ice +0 -395
  777. data/slice/IceGrid/Query.ice +0 -131
@@ -0,0 +1,2726 @@
1
+ //
2
+ // Copyright (c) ZeroC, Inc. All rights reserved.
3
+ //
4
+
5
+ #include <IceUtil/DisableWarnings.h>
6
+ #include <Ice/InputStream.h>
7
+ #include <Ice/DefaultsAndOverrides.h>
8
+ #include <Ice/Instance.h>
9
+ #include <Ice/Object.h>
10
+ #include <Ice/Proxy.h>
11
+ #include <Ice/ProxyFactory.h>
12
+ #include <Ice/ValueFactory.h>
13
+ #include <Ice/UserExceptionFactory.h>
14
+ #include <Ice/LocalException.h>
15
+ #include <Ice/Protocol.h>
16
+ #include <Ice/FactoryTableInit.h>
17
+ #include <Ice/TraceUtil.h>
18
+ #include <Ice/TraceLevels.h>
19
+ #include <Ice/LoggerUtil.h>
20
+ #include <Ice/SlicedData.h>
21
+ #include <Ice/StringConverter.h>
22
+ #include <iterator>
23
+
24
+ #ifndef ICE_UNALIGNED
25
+ # if defined(__i386) || defined(_M_IX86) || defined(__x86_64) || defined(_M_X64)
26
+ # define ICE_UNALIGNED
27
+ # endif
28
+ #endif
29
+
30
+ using namespace std;
31
+ using namespace Ice;
32
+ using namespace IceInternal;
33
+
34
+ Ice::InputStream::InputStream()
35
+ {
36
+ initialize(currentEncoding);
37
+ }
38
+
39
+ Ice::InputStream::InputStream(const vector<Byte>& v) :
40
+ Buffer(v)
41
+ {
42
+ initialize(currentEncoding);
43
+ }
44
+
45
+ Ice::InputStream::InputStream(const pair<const Byte*, const Byte*>& p) :
46
+ Buffer(p.first, p.second)
47
+ {
48
+ initialize(currentEncoding);
49
+ }
50
+
51
+ Ice::InputStream::InputStream(Buffer& buf, bool adopt) :
52
+ Buffer(buf, adopt)
53
+ {
54
+ initialize(currentEncoding);
55
+ }
56
+
57
+ Ice::InputStream::InputStream(const CommunicatorPtr& communicator)
58
+ {
59
+ initialize(communicator);
60
+ }
61
+
62
+ Ice::InputStream::InputStream(const CommunicatorPtr& communicator, const vector<Byte>& v) :
63
+ Buffer(v)
64
+ {
65
+ initialize(communicator);
66
+ }
67
+
68
+ Ice::InputStream::InputStream(const CommunicatorPtr& communicator, const pair<const Byte*, const Byte*>& p) :
69
+ Buffer(p.first, p.second)
70
+ {
71
+ initialize(communicator);
72
+ }
73
+
74
+ Ice::InputStream::InputStream(const CommunicatorPtr& communicator, Buffer& buf, bool adopt) :
75
+ Buffer(buf, adopt)
76
+ {
77
+ initialize(communicator);
78
+ }
79
+
80
+ Ice::InputStream::InputStream(const EncodingVersion& encoding)
81
+ {
82
+ initialize(encoding);
83
+ }
84
+
85
+ Ice::InputStream::InputStream(const EncodingVersion& encoding, const vector<Byte>& v) :
86
+ Buffer(v)
87
+ {
88
+ initialize(encoding);
89
+ }
90
+
91
+ Ice::InputStream::InputStream(const EncodingVersion& encoding, const pair<const Byte*, const Byte*>& p) :
92
+ Buffer(p.first, p.second)
93
+ {
94
+ initialize(encoding);
95
+ }
96
+
97
+ Ice::InputStream::InputStream(const EncodingVersion& encoding, Buffer& buf, bool adopt) :
98
+ Buffer(buf, adopt)
99
+ {
100
+ initialize(encoding);
101
+ }
102
+
103
+ Ice::InputStream::InputStream(const CommunicatorPtr& communicator, const EncodingVersion& encoding)
104
+ {
105
+ initialize(communicator, encoding);
106
+ }
107
+
108
+ Ice::InputStream::InputStream(const CommunicatorPtr& communicator, const EncodingVersion& encoding,
109
+ const vector<Byte>& v) :
110
+ Buffer(v)
111
+ {
112
+ initialize(communicator, encoding);
113
+ }
114
+
115
+ Ice::InputStream::InputStream(const CommunicatorPtr& communicator, const EncodingVersion& encoding,
116
+ const pair<const Byte*, const Byte*>& p) :
117
+ Buffer(p.first, p.second)
118
+ {
119
+ initialize(communicator, encoding);
120
+ }
121
+
122
+ Ice::InputStream::InputStream(const CommunicatorPtr& communicator, const EncodingVersion& encoding,
123
+ Buffer& buf, bool adopt) :
124
+ Buffer(buf, adopt)
125
+ {
126
+ initialize(communicator, encoding);
127
+ }
128
+
129
+ Ice::InputStream::InputStream(Instance* instance, const EncodingVersion& encoding)
130
+ {
131
+ initialize(instance, encoding);
132
+ }
133
+
134
+ Ice::InputStream::InputStream(Instance* instance, const EncodingVersion& encoding, Buffer& buf, bool adopt) :
135
+ Buffer(buf, adopt)
136
+ {
137
+ initialize(instance, encoding);
138
+ }
139
+
140
+ void
141
+ Ice::InputStream::initialize(const CommunicatorPtr& communicator)
142
+ {
143
+ Instance* instance = getInstance(communicator).get();
144
+ initialize(instance, instance->defaultsAndOverrides()->defaultEncoding);
145
+ }
146
+
147
+ void
148
+ Ice::InputStream::initialize(const CommunicatorPtr& communicator, const EncodingVersion& encoding)
149
+ {
150
+ initialize(getInstance(communicator).get(), encoding);
151
+ }
152
+
153
+ void
154
+ Ice::InputStream::initialize(Instance* instance, const EncodingVersion& encoding)
155
+ {
156
+ initialize(encoding);
157
+
158
+ _instance = instance;
159
+
160
+ #ifndef ICE_CPP11_MAPPING
161
+ _collectObjects = _instance->collectObjects();
162
+ #endif
163
+ _traceSlicing = _instance->traceLevels()->slicing > 0;
164
+ _classGraphDepthMax = _instance->classGraphDepthMax();
165
+ }
166
+
167
+ void
168
+ Ice::InputStream::initialize(const EncodingVersion& encoding)
169
+ {
170
+ _instance = 0;
171
+ _encoding = encoding;
172
+ _currentEncaps = 0;
173
+ #ifndef ICE_CPP11_MAPPING
174
+ _collectObjects = false;
175
+ #endif
176
+ _traceSlicing = false;
177
+ _classGraphDepthMax = 0x7fffffff;
178
+ _closure = 0;
179
+ _sliceValues = true;
180
+ _startSeq = -1;
181
+ _minSeqSize = 0;
182
+ }
183
+
184
+ void
185
+ Ice::InputStream::clear()
186
+ {
187
+ while(_currentEncaps && _currentEncaps != &_preAllocatedEncaps)
188
+ {
189
+ Encaps* oldEncaps = _currentEncaps;
190
+ _currentEncaps = _currentEncaps->previous;
191
+ delete oldEncaps;
192
+ }
193
+
194
+ _startSeq = -1;
195
+ _sliceValues = true;
196
+ }
197
+
198
+ void
199
+ Ice::InputStream::setValueFactoryManager(const ValueFactoryManagerPtr& vfm)
200
+ {
201
+ _valueFactoryManager = vfm;
202
+ }
203
+
204
+ void
205
+ Ice::InputStream::setLogger(const LoggerPtr& logger)
206
+ {
207
+ _logger = logger;
208
+ }
209
+
210
+ void
211
+ #ifdef ICE_CPP11_MAPPING
212
+ Ice::InputStream::setCompactIdResolver(std::function<std::string(int)> r)
213
+ #else
214
+ Ice::InputStream::setCompactIdResolver(const CompactIdResolverPtr& r)
215
+ #endif
216
+ {
217
+ _compactIdResolver = r;
218
+ }
219
+
220
+ #ifndef ICE_CPP11_MAPPING
221
+ void
222
+ Ice::InputStream::setCollectObjects(bool on)
223
+ {
224
+ _collectObjects = on;
225
+ }
226
+ #endif
227
+
228
+ void
229
+ Ice::InputStream::setSliceValues(bool on)
230
+ {
231
+ _sliceValues = on;
232
+ }
233
+
234
+ void
235
+ Ice::InputStream::setTraceSlicing(bool on)
236
+ {
237
+ _traceSlicing = on;
238
+ }
239
+
240
+ void
241
+ Ice::InputStream::setClassGraphDepthMax(size_t classGraphDepthMax)
242
+ {
243
+ if(classGraphDepthMax < 1)
244
+ {
245
+ _classGraphDepthMax = 0x7fffffff;
246
+ }
247
+ else
248
+ {
249
+ _classGraphDepthMax = classGraphDepthMax;
250
+ }
251
+ }
252
+
253
+ void*
254
+ Ice::InputStream::getClosure() const
255
+ {
256
+ return _closure;
257
+ }
258
+
259
+ void*
260
+ Ice::InputStream::setClosure(void* p)
261
+ {
262
+ void* prev = _closure;
263
+ _closure = p;
264
+ return prev;
265
+ }
266
+
267
+ void
268
+ Ice::InputStream::swap(InputStream& other)
269
+ {
270
+ swapBuffer(other);
271
+
272
+ std::swap(_instance, other._instance);
273
+ std::swap(_encoding, other._encoding);
274
+ #ifndef ICE_CPP11_MAPPING
275
+ std::swap(_collectObjects, other._collectObjects);
276
+ #endif
277
+ std::swap(_traceSlicing, other._traceSlicing);
278
+ std::swap(_classGraphDepthMax, other._classGraphDepthMax);
279
+ std::swap(_closure, other._closure);
280
+ std::swap(_sliceValues, other._sliceValues);
281
+
282
+ //
283
+ // Swap is never called for streams that have encapsulations being read. However,
284
+ // encapsulations might still be set in case unmarshaling failed. We just
285
+ // reset the encapsulations if there are still some set.
286
+ //
287
+ resetEncapsulation();
288
+ other.resetEncapsulation();
289
+
290
+ std::swap(_startSeq, other._startSeq);
291
+ std::swap(_minSeqSize, other._minSeqSize);
292
+
293
+ std::swap(_valueFactoryManager, other._valueFactoryManager);
294
+ std::swap(_logger, other._logger);
295
+ std::swap(_compactIdResolver, other._compactIdResolver);
296
+ }
297
+
298
+ void
299
+ Ice::InputStream::resetEncapsulation()
300
+ {
301
+ while(_currentEncaps && _currentEncaps != &_preAllocatedEncaps)
302
+ {
303
+ Encaps* oldEncaps = _currentEncaps;
304
+ _currentEncaps = _currentEncaps->previous;
305
+ delete oldEncaps;
306
+ }
307
+
308
+ _preAllocatedEncaps.reset();
309
+ }
310
+
311
+ Int
312
+ Ice::InputStream::getEncapsulationSize()
313
+ {
314
+ assert(_currentEncaps);
315
+ return _currentEncaps->sz - static_cast<Int>(sizeof(Int)) - 2;
316
+ }
317
+
318
+ EncodingVersion
319
+ Ice::InputStream::skipEncapsulation()
320
+ {
321
+ Int sz;
322
+ read(sz);
323
+ if(sz < 6)
324
+ {
325
+ throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
326
+ }
327
+ if(i - sizeof(Int) + sz > b.end())
328
+ {
329
+ throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
330
+ }
331
+ EncodingVersion encoding;
332
+ read(encoding.major);
333
+ read(encoding.minor);
334
+ i += static_cast<size_t>(sz) - sizeof(Int) - 2;
335
+ return encoding;
336
+ }
337
+
338
+ void
339
+ Ice::InputStream::readPendingValues()
340
+ {
341
+ if(_currentEncaps && _currentEncaps->decoder)
342
+ {
343
+ _currentEncaps->decoder->readPendingValues();
344
+ }
345
+ else if(getEncoding() == Ice::Encoding_1_0)
346
+ {
347
+ //
348
+ // If using the 1.0 encoding and no instances were read, we
349
+ // still read an empty sequence of pending instances if
350
+ // requested (i.e.: if this is called).
351
+ //
352
+ // This is required by the 1.0 encoding, even if no instances
353
+ // are written we do marshal an empty sequence if marshaled
354
+ // data types use classes.
355
+ //
356
+ skipSize();
357
+ }
358
+ }
359
+
360
+ Int
361
+ Ice::InputStream::readAndCheckSeqSize(int minSize)
362
+ {
363
+ Int sz = readSize();
364
+
365
+ if(sz == 0)
366
+ {
367
+ return sz;
368
+ }
369
+
370
+ //
371
+ // The _startSeq variable points to the start of the sequence for which
372
+ // we expect to read at least _minSeqSize bytes from the stream.
373
+ //
374
+ // If not initialized or if we already read more data than _minSeqSize,
375
+ // we reset _startSeq and _minSeqSize for this sequence (possibly a
376
+ // top-level sequence or enclosed sequence it doesn't really matter).
377
+ //
378
+ // Otherwise, we are reading an enclosed sequence and we have to bump
379
+ // _minSeqSize by the minimum size that this sequence will require on
380
+ // the stream.
381
+ //
382
+ // The goal of this check is to ensure that when we start un-marshalling
383
+ // a new sequence, we check the minimal size of this new sequence against
384
+ // the estimated remaining buffer size. This estimatation is based on
385
+ // the minimum size of the enclosing sequences, it's _minSeqSize.
386
+ //
387
+ if(_startSeq == -1 || i > (b.begin() + _startSeq + _minSeqSize))
388
+ {
389
+ _startSeq = static_cast<int>(i - b.begin());
390
+ _minSeqSize = sz * minSize;
391
+ }
392
+ else
393
+ {
394
+ _minSeqSize += sz * minSize;
395
+ }
396
+
397
+ //
398
+ // If there isn't enough data to read on the stream for the sequence (and
399
+ // possibly enclosed sequences), something is wrong with the marshalled
400
+ // data: it's claiming having more data that what is possible to read.
401
+ //
402
+ if(_startSeq + _minSeqSize > static_cast<int>(b.size()))
403
+ {
404
+ throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
405
+ }
406
+
407
+ return sz;
408
+ }
409
+
410
+ void
411
+ Ice::InputStream::readBlob(vector<Byte>& v, Int sz)
412
+ {
413
+ if(sz > 0)
414
+ {
415
+ if(b.end() - i < sz)
416
+ {
417
+ throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
418
+ }
419
+ vector<Byte>(i, i + sz).swap(v);
420
+ i += sz;
421
+ }
422
+ else
423
+ {
424
+ v.clear();
425
+ }
426
+ }
427
+
428
+ void
429
+ Ice::InputStream::read(std::vector<Ice::Byte>& v)
430
+ {
431
+ std::pair<const Ice::Byte*, const Ice::Byte*> p;
432
+ read(p);
433
+ if(p.first != p.second)
434
+ {
435
+ v.resize(static_cast<size_t>(p.second - p.first));
436
+ copy(p.first, p.second, v.begin());
437
+ }
438
+ else
439
+ {
440
+ v.clear();
441
+ }
442
+ }
443
+
444
+ void
445
+ Ice::InputStream::read(pair<const Byte*, const Byte*>& v)
446
+ {
447
+ Int sz = readAndCheckSeqSize(1);
448
+ if(sz > 0)
449
+ {
450
+ v.first = i;
451
+ v.second = i + sz;
452
+ i += sz;
453
+ }
454
+ else
455
+ {
456
+ v.first = v.second = i;
457
+ }
458
+ }
459
+
460
+ void
461
+ Ice::InputStream::read(vector<bool>& v)
462
+ {
463
+ Int sz = readAndCheckSeqSize(1);
464
+ if(sz > 0)
465
+ {
466
+ v.resize(static_cast<size_t>(sz));
467
+ copy(i, i + sz, v.begin());
468
+ i += sz;
469
+ }
470
+ else
471
+ {
472
+ v.clear();
473
+ }
474
+ }
475
+
476
+ namespace
477
+ {
478
+
479
+ template<size_t boolSize>
480
+ struct ReadBoolHelper
481
+ {
482
+ static bool* read(pair<const bool*, const bool*>& v, Int sz, InputStream::Container::iterator& i)
483
+ {
484
+ bool* array = new bool[static_cast<size_t>(sz)];
485
+ for(int idx = 0; idx < sz; ++idx)
486
+ {
487
+ array[idx] = static_cast<bool>(*(i + idx));
488
+ }
489
+ v.first = array;
490
+ v.second = array + sz;
491
+ return array;
492
+ }
493
+ };
494
+
495
+ template<>
496
+ struct ReadBoolHelper<1>
497
+ {
498
+ static bool* read(pair<const bool*, const bool*>& v, Int sz, InputStream::Container::iterator& i)
499
+ {
500
+ v.first = reinterpret_cast<bool*>(i);
501
+ v.second = reinterpret_cast<bool*>(i) + sz;
502
+ return 0;
503
+ }
504
+ };
505
+
506
+ }
507
+
508
+ #ifdef ICE_CPP11_MAPPING
509
+ void
510
+ Ice::InputStream::read(pair<const bool*, const bool*>& v)
511
+ {
512
+ Int sz = readAndCheckSeqSize(1);
513
+ if(sz > 0)
514
+ {
515
+ auto boolArray = ReadBoolHelper<sizeof(bool)>::read(v, sz, i);
516
+ if(boolArray)
517
+ {
518
+ _deleters.push_back([boolArray] { delete[] boolArray; });
519
+ }
520
+ i += sz;
521
+ }
522
+ else
523
+ {
524
+ v.first = v.second = reinterpret_cast<bool*>(i);
525
+ }
526
+ }
527
+
528
+ #else
529
+ void
530
+ Ice::InputStream::read(pair<const bool*, const bool*>& v, IceUtil::ScopedArray<bool>& result)
531
+ {
532
+ Int sz = readAndCheckSeqSize(1);
533
+ if(sz > 0)
534
+ {
535
+ result.reset(ReadBoolHelper<sizeof(bool)>::read(v, sz, i));
536
+ i += sz;
537
+ }
538
+ else
539
+ {
540
+ result.reset();
541
+ v.first = v.second = reinterpret_cast<bool*>(i);
542
+ }
543
+ }
544
+ #endif
545
+
546
+ void
547
+ Ice::InputStream::read(Short& v)
548
+ {
549
+ if(b.end() - i < static_cast<int>(sizeof(Short)))
550
+ {
551
+ throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
552
+ }
553
+ const Byte* src = &(*i);
554
+ i += sizeof(Short);
555
+ #ifdef ICE_BIG_ENDIAN
556
+ Byte* dest = reinterpret_cast<Byte*>(&v) + sizeof(Short) - 1;
557
+ *dest-- = *src++;
558
+ *dest = *src;
559
+ #else
560
+ Byte* dest = reinterpret_cast<Byte*>(&v);
561
+ *dest++ = *src++;
562
+ *dest = *src;
563
+ #endif
564
+ }
565
+
566
+ void
567
+ Ice::InputStream::read(vector<Short>& v)
568
+ {
569
+ Int sz = readAndCheckSeqSize(static_cast<int>(sizeof(Short)));
570
+ if(sz > 0)
571
+ {
572
+ Container::iterator begin = i;
573
+ i += sz * static_cast<int>(sizeof(Short));
574
+ v.resize(static_cast<size_t>(sz));
575
+ #ifdef ICE_BIG_ENDIAN
576
+ const Byte* src = &(*begin);
577
+ Byte* dest = reinterpret_cast<Byte*>(&v[0]) + sizeof(Short) - 1;
578
+ for(int j = 0 ; j < sz ; ++j)
579
+ {
580
+ *dest-- = *src++;
581
+ *dest-- = *src++;
582
+ dest += 2 * sizeof(Short);
583
+ }
584
+ #else
585
+ copy(begin, i, reinterpret_cast<Byte*>(&v[0]));
586
+ #endif
587
+ }
588
+ else
589
+ {
590
+ v.clear();
591
+ }
592
+ }
593
+
594
+ #ifdef ICE_CPP11_MAPPING
595
+ void
596
+ Ice::InputStream::read(pair<const short*, const short*>& v)
597
+ #else
598
+ void
599
+ Ice::InputStream::read(pair<const Short*, const Short*>& v, IceUtil::ScopedArray<Short>& result)
600
+ #endif
601
+ {
602
+ Int sz = readAndCheckSeqSize(static_cast<int>(sizeof(Short)));
603
+ if(sz > 0)
604
+ {
605
+ #ifdef ICE_UNALIGNED
606
+ v.first = reinterpret_cast<Short*>(i);
607
+ i += sz * static_cast<int>(sizeof(Short));
608
+ v.second = reinterpret_cast<Short*>(i);
609
+ #else
610
+ # ifdef ICE_CPP11_MAPPING
611
+ auto result = new short[sz];
612
+ _deleters.push_back([result] { delete[] result; });
613
+ v.first = result;
614
+ v.second = result + sz;
615
+ # else
616
+ result.reset(new Short[sz]);
617
+ v.first = result.get();
618
+ v.second = result.get() + sz;
619
+ # endif
620
+
621
+ Container::iterator begin = i;
622
+ i += sz * static_cast<int>(sizeof(Short));
623
+ # ifdef ICE_BIG_ENDIAN
624
+ const Byte* src = &(*begin);
625
+ Byte* dest = reinterpret_cast<Byte*>(&result[0]) + sizeof(Short) - 1;
626
+ for(int j = 0 ; j < sz ; ++j)
627
+ {
628
+ *dest-- = *src++;
629
+ *dest-- = *src++;
630
+ dest += 2 * sizeof(Short);
631
+ }
632
+ # else
633
+ copy(begin, i, reinterpret_cast<Byte*>(&result[0]));
634
+ # endif
635
+ #endif
636
+ }
637
+ else
638
+ {
639
+ #ifndef ICE_CPP11_MAPPING
640
+ result.reset();
641
+ #endif
642
+ v.first = v.second = 0;
643
+ }
644
+ }
645
+
646
+ void
647
+ Ice::InputStream::read(vector<Int>& v)
648
+ {
649
+ Int sz = readAndCheckSeqSize(static_cast<int>(sizeof(Int)));
650
+ if(sz > 0)
651
+ {
652
+ Container::iterator begin = i;
653
+ i += sz * static_cast<int>(sizeof(Int));
654
+ v.resize(static_cast<size_t>(sz));
655
+ #ifdef ICE_BIG_ENDIAN
656
+ const Byte* src = &(*begin);
657
+ Byte* dest = reinterpret_cast<Byte*>(&v[0]) + sizeof(Int) - 1;
658
+ for(int j = 0 ; j < sz ; ++j)
659
+ {
660
+ *dest-- = *src++;
661
+ *dest-- = *src++;
662
+ *dest-- = *src++;
663
+ *dest-- = *src++;
664
+ dest += 2 * sizeof(Int);
665
+ }
666
+ #else
667
+ copy(begin, i, reinterpret_cast<Byte*>(&v[0]));
668
+ #endif
669
+ }
670
+ else
671
+ {
672
+ v.clear();
673
+ }
674
+ }
675
+
676
+ #ifdef ICE_CPP11_MAPPING
677
+ void
678
+ Ice::InputStream::read(pair<const Int*, const Int*>& v)
679
+ #else
680
+ void
681
+ Ice::InputStream::read(pair<const Int*, const Int*>& v, ::IceUtil::ScopedArray<Int>& result)
682
+ #endif
683
+ {
684
+ Int sz = readAndCheckSeqSize(static_cast<int>(sizeof(Int)));
685
+ if(sz > 0)
686
+ {
687
+ #ifdef ICE_UNALIGNED
688
+ v.first = reinterpret_cast<Int*>(i);
689
+ i += sz * static_cast<int>(sizeof(Int));
690
+ v.second = reinterpret_cast<Int*>(i);
691
+ #else
692
+
693
+ # ifdef ICE_CPP11_MAPPING
694
+ auto result = new int[sz];
695
+ _deleters.push_back([result] { delete[] result; });
696
+ v.first = result;
697
+ v.second = result + sz;
698
+ # else
699
+ result.reset(new Int[sz]);
700
+ v.first = result.get();
701
+ v.second = result.get() + sz;
702
+ # endif
703
+
704
+ Container::iterator begin = i;
705
+ i += sz * static_cast<int>(sizeof(Int));
706
+ # ifdef ICE_BIG_ENDIAN
707
+ const Byte* src = &(*begin);
708
+ Byte* dest = reinterpret_cast<Byte*>(&result[0]) + sizeof(Int) - 1;
709
+ for(int j = 0 ; j < sz ; ++j)
710
+ {
711
+ *dest-- = *src++;
712
+ *dest-- = *src++;
713
+ *dest-- = *src++;
714
+ *dest-- = *src++;
715
+ dest += 2 * sizeof(Int);
716
+ }
717
+ # else
718
+ copy(begin, i, reinterpret_cast<Byte*>(&result[0]));
719
+ # endif
720
+ #endif
721
+ }
722
+ else
723
+ {
724
+ #ifndef ICE_CPP11_MAPPING
725
+ result.reset();
726
+ #endif
727
+ v.first = v.second = 0;
728
+ }
729
+ }
730
+
731
+ void
732
+ Ice::InputStream::read(Long& v)
733
+ {
734
+ if(b.end() - i < static_cast<int>(sizeof(Long)))
735
+ {
736
+ throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
737
+ }
738
+ const Byte* src = &(*i);
739
+ i += sizeof(Long);
740
+ #ifdef ICE_BIG_ENDIAN
741
+ Byte* dest = reinterpret_cast<Byte*>(&v) + sizeof(Long) - 1;
742
+ *dest-- = *src++;
743
+ *dest-- = *src++;
744
+ *dest-- = *src++;
745
+ *dest-- = *src++;
746
+ *dest-- = *src++;
747
+ *dest-- = *src++;
748
+ *dest-- = *src++;
749
+ *dest = *src;
750
+ #else
751
+ Byte* dest = reinterpret_cast<Byte*>(&v);
752
+ *dest++ = *src++;
753
+ *dest++ = *src++;
754
+ *dest++ = *src++;
755
+ *dest++ = *src++;
756
+ *dest++ = *src++;
757
+ *dest++ = *src++;
758
+ *dest++ = *src++;
759
+ *dest = *src;
760
+ #endif
761
+ }
762
+
763
+ void
764
+ Ice::InputStream::read(vector<Long>& v)
765
+ {
766
+ Int sz = readAndCheckSeqSize(static_cast<int>(sizeof(Long)));
767
+ if(sz > 0)
768
+ {
769
+ Container::iterator begin = i;
770
+ i += sz * static_cast<int>(sizeof(Long));
771
+ v.resize(static_cast<size_t>(sz));
772
+ #ifdef ICE_BIG_ENDIAN
773
+ const Byte* src = &(*begin);
774
+ Byte* dest = reinterpret_cast<Byte*>(&v[0]) + sizeof(Long) - 1;
775
+ for(int j = 0 ; j < sz ; ++j)
776
+ {
777
+ *dest-- = *src++;
778
+ *dest-- = *src++;
779
+ *dest-- = *src++;
780
+ *dest-- = *src++;
781
+ *dest-- = *src++;
782
+ *dest-- = *src++;
783
+ *dest-- = *src++;
784
+ *dest-- = *src++;
785
+ dest += 2 * sizeof(Long);
786
+ }
787
+ #else
788
+ copy(begin, i, reinterpret_cast<Byte*>(&v[0]));
789
+ #endif
790
+ }
791
+ else
792
+ {
793
+ v.clear();
794
+ }
795
+ }
796
+
797
+ #ifdef ICE_CPP11_MAPPING
798
+ void
799
+ Ice::InputStream::read(pair<const Long*, const Long*>& v)
800
+ #else
801
+ void
802
+ Ice::InputStream::read(pair<const Long*, const Long*>& v, IceUtil::ScopedArray<Long>& result)
803
+ #endif
804
+ {
805
+ Int sz = readAndCheckSeqSize(static_cast<int>(sizeof(Long)));
806
+ if(sz > 0)
807
+ {
808
+ #ifdef ICE_UNALIGNED
809
+ v.first = reinterpret_cast<Long*>(i);
810
+ i += sz * static_cast<int>(sizeof(Long));
811
+ v.second = reinterpret_cast<Long*>(i);
812
+ #else
813
+
814
+ # ifdef ICE_CPP11_MAPPING
815
+ auto result = new long long[sz];
816
+ _deleters.push_back([result] { delete[] result; });
817
+ v.first = result;
818
+ v.second = result + sz;
819
+ # else
820
+ result.reset(new Long[sz]);
821
+ v.first = result.get();
822
+ v.second = result.get() + sz;
823
+ # endif
824
+
825
+ Container::iterator begin = i;
826
+ i += sz * static_cast<int>(sizeof(Long));
827
+ # ifdef ICE_BIG_ENDIAN
828
+ const Byte* src = &(*begin);
829
+ Byte* dest = reinterpret_cast<Byte*>(&result[0]) + sizeof(Long) - 1;
830
+ for(int j = 0 ; j < sz ; ++j)
831
+ {
832
+ *dest-- = *src++;
833
+ *dest-- = *src++;
834
+ *dest-- = *src++;
835
+ *dest-- = *src++;
836
+ *dest-- = *src++;
837
+ *dest-- = *src++;
838
+ *dest-- = *src++;
839
+ *dest-- = *src++;
840
+ dest += 2 * sizeof(Long);
841
+ }
842
+ # else
843
+ copy(begin, i, reinterpret_cast<Byte*>(&result[0]));
844
+ # endif
845
+ #endif
846
+ }
847
+ else
848
+ {
849
+ #ifndef ICE_CPP11_MAPPING
850
+ result.reset();
851
+ #endif
852
+ v.first = v.second = 0;
853
+ }
854
+ }
855
+
856
+ void
857
+ Ice::InputStream::read(Float& v)
858
+ {
859
+ if(b.end() - i < static_cast<int>(sizeof(Float)))
860
+ {
861
+ throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
862
+ }
863
+ const Byte* src = &(*i);
864
+ i += sizeof(Float);
865
+ #ifdef ICE_BIG_ENDIAN
866
+ Byte* dest = reinterpret_cast<Byte*>(&v) + sizeof(Float) - 1;
867
+ *dest-- = *src++;
868
+ *dest-- = *src++;
869
+ *dest-- = *src++;
870
+ *dest = *src;
871
+ #else
872
+ Byte* dest = reinterpret_cast<Byte*>(&v);
873
+ *dest++ = *src++;
874
+ *dest++ = *src++;
875
+ *dest++ = *src++;
876
+ *dest = *src;
877
+ #endif
878
+ }
879
+
880
+ void
881
+ Ice::InputStream::read(vector<Float>& v)
882
+ {
883
+ Int sz = readAndCheckSeqSize(static_cast<int>(sizeof(Float)));
884
+ if(sz > 0)
885
+ {
886
+ Container::iterator begin = i;
887
+ i += sz * static_cast<int>(sizeof(Float));
888
+ v.resize(static_cast<size_t>(sz));
889
+ #ifdef ICE_BIG_ENDIAN
890
+ const Byte* src = &(*begin);
891
+ Byte* dest = reinterpret_cast<Byte*>(&v[0]) + sizeof(Float) - 1;
892
+ for(int j = 0 ; j < sz ; ++j)
893
+ {
894
+ *dest-- = *src++;
895
+ *dest-- = *src++;
896
+ *dest-- = *src++;
897
+ *dest-- = *src++;
898
+ dest += 2 * sizeof(Float);
899
+ }
900
+ #else
901
+ copy(begin, i, reinterpret_cast<Byte*>(&v[0]));
902
+ #endif
903
+ }
904
+ else
905
+ {
906
+ v.clear();
907
+ }
908
+ }
909
+
910
+ #ifdef ICE_CPP11_MAPPING
911
+ void
912
+ Ice::InputStream::read(pair<const Float*, const Float*>& v)
913
+ #else
914
+ void
915
+ Ice::InputStream::read(pair<const Float*, const Float*>& v, IceUtil::ScopedArray<Float>& result)
916
+ #endif
917
+ {
918
+ Int sz = readAndCheckSeqSize(static_cast<int>(sizeof(Float)));
919
+ if(sz > 0)
920
+ {
921
+ #ifdef ICE_UNALIGNED
922
+ v.first = reinterpret_cast<Float*>(i);
923
+ i += sz * static_cast<int>(sizeof(Float));
924
+ v.second = reinterpret_cast<Float*>(i);
925
+ #else
926
+
927
+ # ifdef ICE_CPP11_MAPPING
928
+ auto result = new float[sz];
929
+ _deleters.push_back([result] { delete[] result; });
930
+ v.first = result;
931
+ v.second = result + sz;
932
+ # else
933
+ result.reset(new Float[sz]);
934
+ v.first = result.get();
935
+ v.second = result.get() + sz;
936
+ # endif
937
+
938
+ Container::iterator begin = i;
939
+ i += sz * static_cast<int>(sizeof(Float));
940
+ # ifdef ICE_BIG_ENDIAN
941
+ const Byte* src = &(*begin);
942
+ Byte* dest = reinterpret_cast<Byte*>(&result[0]) + sizeof(Float) - 1;
943
+ for(int j = 0 ; j < sz ; ++j)
944
+ {
945
+ *dest-- = *src++;
946
+ *dest-- = *src++;
947
+ *dest-- = *src++;
948
+ *dest-- = *src++;
949
+ dest += 2 * sizeof(Float);
950
+ }
951
+ # else
952
+ copy(begin, i, reinterpret_cast<Byte*>(&result[0]));
953
+ # endif
954
+ #endif
955
+ }
956
+ else
957
+ {
958
+ #ifndef ICE_CPP11_MAPPING
959
+ result.reset();
960
+ #endif
961
+ v.first = v.second = 0;
962
+ }
963
+ }
964
+
965
+ void
966
+ Ice::InputStream::read(Double& v)
967
+ {
968
+ if(b.end() - i < static_cast<int>(sizeof(Double)))
969
+ {
970
+ throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
971
+ }
972
+ const Byte* src = &(*i);
973
+ i += sizeof(Double);
974
+ #ifdef ICE_BIG_ENDIAN
975
+ Byte* dest = reinterpret_cast<Byte*>(&v) + sizeof(Double) - 1;
976
+ *dest-- = *src++;
977
+ *dest-- = *src++;
978
+ *dest-- = *src++;
979
+ *dest-- = *src++;
980
+ *dest-- = *src++;
981
+ *dest-- = *src++;
982
+ *dest-- = *src++;
983
+ *dest = *src;
984
+ #else
985
+ Byte* dest = reinterpret_cast<Byte*>(&v);
986
+ *dest++ = *src++;
987
+ *dest++ = *src++;
988
+ *dest++ = *src++;
989
+ *dest++ = *src++;
990
+ *dest++ = *src++;
991
+ *dest++ = *src++;
992
+ *dest++ = *src++;
993
+ *dest = *src;
994
+ #endif
995
+ }
996
+
997
+ void
998
+ Ice::InputStream::read(vector<Double>& v)
999
+ {
1000
+ Int sz = readAndCheckSeqSize(static_cast<int>(sizeof(Double)));
1001
+ if(sz > 0)
1002
+ {
1003
+ Container::iterator begin = i;
1004
+ i += sz * static_cast<int>(sizeof(Double));
1005
+ v.resize(static_cast<size_t>(sz));
1006
+ #ifdef ICE_BIG_ENDIAN
1007
+ const Byte* src = &(*begin);
1008
+ Byte* dest = reinterpret_cast<Byte*>(&v[0]) + sizeof(Double) - 1;
1009
+ for(int j = 0 ; j < sz ; ++j)
1010
+ {
1011
+ *dest-- = *src++;
1012
+ *dest-- = *src++;
1013
+ *dest-- = *src++;
1014
+ *dest-- = *src++;
1015
+ *dest-- = *src++;
1016
+ *dest-- = *src++;
1017
+ *dest-- = *src++;
1018
+ *dest-- = *src++;
1019
+ dest += 2 * sizeof(Double);
1020
+ }
1021
+ #else
1022
+ copy(begin, i, reinterpret_cast<Byte*>(&v[0]));
1023
+ #endif
1024
+ }
1025
+ else
1026
+ {
1027
+ v.clear();
1028
+ }
1029
+ }
1030
+
1031
+ #ifdef ICE_CPP11_MAPPING
1032
+ void
1033
+ Ice::InputStream::read(pair<const Double*, const Double*>& v)
1034
+ #else
1035
+ void
1036
+ Ice::InputStream::read(pair<const Double*, const Double*>& v, IceUtil::ScopedArray<Double>& result)
1037
+ #endif
1038
+ {
1039
+ Int sz = readAndCheckSeqSize(static_cast<int>(sizeof(Double)));
1040
+ if(sz > 0)
1041
+ {
1042
+ #ifdef ICE_UNALIGNED
1043
+ v.first = reinterpret_cast<Double*>(i);
1044
+ i += sz * static_cast<int>(sizeof(Double));
1045
+ v.second = reinterpret_cast<Double*>(i);
1046
+ #else
1047
+
1048
+ # ifdef ICE_CPP11_MAPPING
1049
+ auto result = new double[sz];
1050
+ _deleters.push_back([result] { delete[] result; });
1051
+ v.first = result;
1052
+ v.second = result + sz;
1053
+ # else
1054
+ result.reset(new Double[sz]);
1055
+ v.first = result.get();
1056
+ v.second = result.get() + sz;
1057
+ # endif
1058
+
1059
+ Container::iterator begin = i;
1060
+ i += sz * static_cast<int>(sizeof(Double));
1061
+ # ifdef ICE_BIG_ENDIAN
1062
+ const Byte* src = &(*begin);
1063
+ Byte* dest = reinterpret_cast<Byte*>(&result[0]) + sizeof(Double) - 1;
1064
+ for(int j = 0 ; j < sz ; ++j)
1065
+ {
1066
+ *dest-- = *src++;
1067
+ *dest-- = *src++;
1068
+ *dest-- = *src++;
1069
+ *dest-- = *src++;
1070
+ *dest-- = *src++;
1071
+ *dest-- = *src++;
1072
+ *dest-- = *src++;
1073
+ *dest-- = *src++;
1074
+ dest += 2 * sizeof(Double);
1075
+ }
1076
+ # else
1077
+ copy(begin, i, reinterpret_cast<Byte*>(&result[0]));
1078
+ # endif
1079
+ #endif
1080
+ }
1081
+ else
1082
+ {
1083
+ #ifndef ICE_CPP11_MAPPING
1084
+ result.reset();
1085
+ #endif
1086
+ v.first = v.second = 0;
1087
+ }
1088
+ }
1089
+
1090
+ void
1091
+ Ice::InputStream::read(std::string& v, bool convert)
1092
+ {
1093
+ Int sz = readSize();
1094
+ if(sz > 0)
1095
+ {
1096
+ if(b.end() - i < sz)
1097
+ {
1098
+ throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
1099
+ }
1100
+
1101
+ if(!convert || !readConverted(v, sz))
1102
+ {
1103
+ string(reinterpret_cast<const char*>(&*i), reinterpret_cast<const char*>(&*i) + sz).swap(v);
1104
+ }
1105
+ i += sz;
1106
+ }
1107
+ else
1108
+ {
1109
+ v.clear();
1110
+ }
1111
+ }
1112
+
1113
+ #ifdef ICE_CPP11_MAPPING
1114
+ void
1115
+ Ice::InputStream::read(const char*& vdata, size_t& vsize, bool convert)
1116
+ {
1117
+ int sz = readSize();
1118
+ if(sz > 0)
1119
+ {
1120
+ if(b.end() - i < sz)
1121
+ {
1122
+ throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
1123
+ }
1124
+
1125
+ if(convert == false)
1126
+ {
1127
+ vdata = reinterpret_cast<const char*>(&*i);
1128
+ vsize = static_cast<size_t>(sz);
1129
+ i += sz;
1130
+ }
1131
+ else
1132
+ {
1133
+ string converted;
1134
+ if(readConverted(converted, sz))
1135
+ {
1136
+ if(converted.size() <= static_cast<size_t>(sz))
1137
+ {
1138
+ //
1139
+ // Write converted string directly into buffer
1140
+ //
1141
+ std::memcpy(i, converted.data(), converted.size());
1142
+ vdata = reinterpret_cast<const char*>(&*i);
1143
+ vsize = converted.size();
1144
+ }
1145
+ else
1146
+ {
1147
+ auto holder = new string(std::move(converted));
1148
+ _deleters.push_back([holder] { delete holder; });
1149
+ vdata = holder->data();
1150
+ vsize = holder->size();
1151
+ }
1152
+ }
1153
+ else
1154
+ {
1155
+ vdata = reinterpret_cast<const char*>(&*i);
1156
+ vsize = static_cast<size_t>(sz);
1157
+ }
1158
+ i += sz;
1159
+ }
1160
+ }
1161
+ else
1162
+ {
1163
+ vdata = 0;
1164
+ vsize = 0;
1165
+ }
1166
+ }
1167
+
1168
+ #else
1169
+
1170
+ void
1171
+ Ice::InputStream::read(const char*& vdata, size_t& vsize)
1172
+ {
1173
+ Int sz = readSize();
1174
+ if(sz > 0)
1175
+ {
1176
+ if(b.end() - i < sz)
1177
+ {
1178
+ throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
1179
+ }
1180
+
1181
+ vdata = reinterpret_cast<const char*>(&*i);
1182
+ vsize = static_cast<size_t>(sz);
1183
+ i += sz;
1184
+ }
1185
+ else
1186
+ {
1187
+ vdata = 0;
1188
+ vsize = 0;
1189
+ }
1190
+ }
1191
+
1192
+ void
1193
+ Ice::InputStream::read(const char*& vdata, size_t& vsize, string& holder)
1194
+ {
1195
+ Int sz = readSize();
1196
+ if(sz > 0)
1197
+ {
1198
+ if(b.end() - i < sz)
1199
+ {
1200
+ throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
1201
+ }
1202
+
1203
+ if(readConverted(holder, sz))
1204
+ {
1205
+ vdata = holder.data();
1206
+ vsize = holder.size();
1207
+ }
1208
+ else
1209
+ {
1210
+ vdata = reinterpret_cast<const char*>(&*i);
1211
+ vsize = static_cast<size_t>(sz);
1212
+ }
1213
+ i += sz;
1214
+ }
1215
+ else
1216
+ {
1217
+ holder.clear();
1218
+ vdata = 0;
1219
+ vsize = 0;
1220
+ }
1221
+ }
1222
+ #endif
1223
+
1224
+ bool
1225
+ Ice::InputStream::readConverted(string& v, int sz)
1226
+ {
1227
+ try
1228
+ {
1229
+ bool converted = false;
1230
+
1231
+ //
1232
+ // NOTE: When using an _instance, we get a const& on the string reference to
1233
+ // not have to increment unecessarily its reference count.
1234
+ //
1235
+
1236
+ if(_instance)
1237
+ {
1238
+ const StringConverterPtr& stringConverter = _instance->getStringConverter();
1239
+ if(stringConverter)
1240
+ {
1241
+ stringConverter->fromUTF8(i, i + sz, v);
1242
+ converted = true;
1243
+ }
1244
+ }
1245
+ else
1246
+ {
1247
+ StringConverterPtr stringConverter = getProcessStringConverter();
1248
+ if(stringConverter)
1249
+ {
1250
+ stringConverter->fromUTF8(i, i + sz, v);
1251
+ converted = true;
1252
+ }
1253
+ }
1254
+
1255
+ return converted;
1256
+ }
1257
+ catch(const IllegalConversionException& ex)
1258
+ {
1259
+ throw StringConversionException(__FILE__, __LINE__, ex.reason());
1260
+ }
1261
+ }
1262
+
1263
+ void
1264
+ Ice::InputStream::read(vector<string>& v, bool convert)
1265
+ {
1266
+ Int sz = readAndCheckSeqSize(1);
1267
+ if(sz > 0)
1268
+ {
1269
+ v.resize(static_cast<size_t>(sz));
1270
+ for(size_t j = 0; j < static_cast<size_t>(sz); ++j)
1271
+ {
1272
+ read(v[j], convert);
1273
+ }
1274
+ }
1275
+ else
1276
+ {
1277
+ v.clear();
1278
+ }
1279
+ }
1280
+
1281
+ void
1282
+ Ice::InputStream::read(wstring& v)
1283
+ {
1284
+ Int sz = readSize();
1285
+ if(sz > 0)
1286
+ {
1287
+ if(b.end() - i < sz)
1288
+ {
1289
+ throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
1290
+ }
1291
+
1292
+ try
1293
+ {
1294
+ if(_instance)
1295
+ {
1296
+ const WstringConverterPtr& wstringConverter = _instance->getWstringConverter();
1297
+ wstringConverter->fromUTF8(i, i + sz, v);
1298
+ }
1299
+ else
1300
+ {
1301
+ WstringConverterPtr wstringConverter = getProcessWstringConverter();
1302
+ wstringConverter->fromUTF8(i, i + sz, v);
1303
+ }
1304
+
1305
+ i += sz;
1306
+ }
1307
+ catch(const IllegalConversionException& ex)
1308
+ {
1309
+ throw StringConversionException(__FILE__, __LINE__, ex.reason());
1310
+ }
1311
+ }
1312
+ else
1313
+ {
1314
+ v.clear();
1315
+ }
1316
+ }
1317
+
1318
+ void
1319
+ Ice::InputStream::read(vector<wstring>& v)
1320
+ {
1321
+ size_t sz = static_cast<size_t>(readAndCheckSeqSize(1));
1322
+ if(sz > 0)
1323
+ {
1324
+ v.resize(sz);
1325
+ for(size_t j = 0; j < sz; ++j)
1326
+ {
1327
+ read(v[j]);
1328
+ }
1329
+ }
1330
+ else
1331
+ {
1332
+ v.clear();
1333
+ }
1334
+ }
1335
+
1336
+ #ifdef ICE_CPP11_MAPPING
1337
+ shared_ptr<ObjectPrx>
1338
+ Ice::InputStream::readProxy()
1339
+ {
1340
+ if(!_instance)
1341
+ {
1342
+ throw MarshalException(__FILE__, __LINE__, "cannot unmarshal a proxy without a communicator");
1343
+ }
1344
+
1345
+ return _instance->proxyFactory()->streamToProxy(this);
1346
+ }
1347
+ #else
1348
+ void
1349
+ Ice::InputStream::read(ObjectPrx& v)
1350
+ {
1351
+ if(!_instance)
1352
+ {
1353
+ throw MarshalException(__FILE__, __LINE__, "cannot unmarshal a proxy without a communicator");
1354
+ }
1355
+
1356
+ v = _instance->proxyFactory()->streamToProxy(this);
1357
+ }
1358
+ #endif
1359
+
1360
+ Int
1361
+ Ice::InputStream::readEnum(Int maxValue)
1362
+ {
1363
+ if(getEncoding() == Encoding_1_0)
1364
+ {
1365
+ if(maxValue < 127)
1366
+ {
1367
+ Byte value;
1368
+ read(value);
1369
+ return value;
1370
+ }
1371
+ else if(maxValue < 32767)
1372
+ {
1373
+ Short value;
1374
+ read(value);
1375
+ return value;
1376
+ }
1377
+ else
1378
+ {
1379
+ Int value;
1380
+ read(value);
1381
+ return value;
1382
+ }
1383
+ }
1384
+ else
1385
+ {
1386
+ return readSize();
1387
+ }
1388
+ }
1389
+
1390
+ void
1391
+ Ice::InputStream::throwException(ICE_IN(ICE_DELEGATE(UserExceptionFactory)) factory)
1392
+ {
1393
+ initEncaps();
1394
+ _currentEncaps->decoder->throwException(factory);
1395
+ }
1396
+
1397
+ bool
1398
+ Ice::InputStream::readOptImpl(Int readTag, OptionalFormat expectedFormat)
1399
+ {
1400
+ if(getEncoding() == Encoding_1_0)
1401
+ {
1402
+ return false; // Optional members aren't supported with the 1.0 encoding.
1403
+ }
1404
+
1405
+ while(true)
1406
+ {
1407
+ if(i >= b.begin() + _currentEncaps->start + _currentEncaps->sz)
1408
+ {
1409
+ return false; // End of encapsulation also indicates end of optionals.
1410
+ }
1411
+
1412
+ Byte v;
1413
+ read(v);
1414
+ if(v == OPTIONAL_END_MARKER)
1415
+ {
1416
+ --i; // Rewind
1417
+ return false;
1418
+ }
1419
+
1420
+ OptionalFormat format = static_cast<OptionalFormat>(v & 0x07); // First 3 bits.
1421
+ Int tag = static_cast<Int>(v >> 3);
1422
+ if(tag == 30)
1423
+ {
1424
+ tag = readSize();
1425
+ }
1426
+
1427
+ if(tag > readTag)
1428
+ {
1429
+ i -= tag < 30 ? 1 : (tag < 255 ? 2 : 6); // Rewind
1430
+ return false; // No optional data members with the requested tag.
1431
+ }
1432
+ else if(tag < readTag)
1433
+ {
1434
+ skipOptional(format); // Skip optional data members
1435
+ }
1436
+ else
1437
+ {
1438
+ if(format != expectedFormat)
1439
+ {
1440
+ ostringstream os;
1441
+ os << "invalid optional data member `" << tag << "': unexpected format";
1442
+ throw MarshalException(__FILE__, __LINE__, os.str());
1443
+ }
1444
+ return true;
1445
+ }
1446
+ }
1447
+ return true; // Keep the compiler happy.
1448
+ }
1449
+
1450
+ void
1451
+ Ice::InputStream::skipOptional(OptionalFormat type)
1452
+ {
1453
+ switch(type)
1454
+ {
1455
+ case ICE_SCOPED_ENUM(OptionalFormat, F1):
1456
+ {
1457
+ skip(1);
1458
+ break;
1459
+ }
1460
+ case ICE_SCOPED_ENUM(OptionalFormat, F2):
1461
+ {
1462
+ skip(2);
1463
+ break;
1464
+ }
1465
+ case ICE_SCOPED_ENUM(OptionalFormat, F4):
1466
+ {
1467
+ skip(4);
1468
+ break;
1469
+ }
1470
+ case ICE_SCOPED_ENUM(OptionalFormat, F8):
1471
+ {
1472
+ skip(8);
1473
+ break;
1474
+ }
1475
+ case ICE_SCOPED_ENUM(OptionalFormat, Size):
1476
+ {
1477
+ skipSize();
1478
+ break;
1479
+ }
1480
+ case ICE_SCOPED_ENUM(OptionalFormat, VSize):
1481
+ {
1482
+ skip(static_cast<size_t>(readSize()));
1483
+ break;
1484
+ }
1485
+ case ICE_SCOPED_ENUM(OptionalFormat, FSize):
1486
+ {
1487
+ Int sz;
1488
+ read(sz);
1489
+ if(sz < 0)
1490
+ {
1491
+ throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
1492
+ }
1493
+ skip(static_cast<size_t>(sz));
1494
+ break;
1495
+ }
1496
+ case ICE_SCOPED_ENUM(OptionalFormat, Class):
1497
+ {
1498
+ read(0, 0);
1499
+ break;
1500
+ }
1501
+ }
1502
+ }
1503
+
1504
+ void
1505
+ Ice::InputStream::skipOptionals()
1506
+ {
1507
+ //
1508
+ // Skip remaining un-read optional members.
1509
+ //
1510
+ while(true)
1511
+ {
1512
+ if(i >= b.begin() + _currentEncaps->start + _currentEncaps->sz)
1513
+ {
1514
+ return; // End of encapsulation also indicates end of optionals.
1515
+ }
1516
+
1517
+ Byte v;
1518
+ read(v);
1519
+ if(v == OPTIONAL_END_MARKER)
1520
+ {
1521
+ return;
1522
+ }
1523
+
1524
+ OptionalFormat format = static_cast<OptionalFormat>(v & 0x07); // Read first 3 bits.
1525
+ if(static_cast<Int>(v >> 3) == 30)
1526
+ {
1527
+ skipSize();
1528
+ }
1529
+ skipOptional(format);
1530
+ }
1531
+ }
1532
+
1533
+ void
1534
+ Ice::InputStream::throwUnmarshalOutOfBoundsException(const char* file, int line)
1535
+ {
1536
+ throw UnmarshalOutOfBoundsException(file, line);
1537
+ }
1538
+
1539
+ void
1540
+ Ice::InputStream::throwEncapsulationException(const char* file, int line)
1541
+ {
1542
+ throw EncapsulationException(file, line);
1543
+ }
1544
+
1545
+ string
1546
+ Ice::InputStream::resolveCompactId(int id) const
1547
+ {
1548
+ string type;
1549
+
1550
+ #ifdef ICE_CPP11_MAPPING
1551
+ function<string(int)> resolver = compactIdResolver();
1552
+ #else
1553
+ CompactIdResolverPtr resolver = compactIdResolver();
1554
+ #endif
1555
+
1556
+ if(resolver)
1557
+ {
1558
+ try
1559
+ {
1560
+ #ifdef ICE_CPP11_MAPPING
1561
+ type = resolver(id);
1562
+ #else
1563
+ type = resolver->resolve(id);
1564
+ #endif
1565
+ }
1566
+ catch(const LocalException&)
1567
+ {
1568
+ throw;
1569
+ }
1570
+ catch(const std::exception& ex)
1571
+ {
1572
+ ostringstream ostr;
1573
+ ostr << "exception in CompactIdResolver for ID " << id;
1574
+ string msg = ostr.str();
1575
+ string what = ex.what();
1576
+ if(!what.empty())
1577
+ {
1578
+ msg += ":\n" + what;
1579
+ }
1580
+ throw MarshalException(__FILE__, __LINE__, msg);
1581
+ }
1582
+ catch(...)
1583
+ {
1584
+ ostringstream ostr;
1585
+ ostr << "unknown exception in CompactIdResolver for ID " << id;
1586
+ throw MarshalException(__FILE__, __LINE__, ostr.str());
1587
+ }
1588
+ }
1589
+
1590
+ return type;
1591
+ }
1592
+
1593
+ void
1594
+ Ice::InputStream::postUnmarshal(const ValuePtr& v) const
1595
+ {
1596
+ try
1597
+ {
1598
+ #ifndef ICE_CPP11_MAPPING
1599
+ if(_collectObjects)
1600
+ {
1601
+ v->ice_collectable(true);
1602
+ }
1603
+ #endif
1604
+ v->ice_postUnmarshal();
1605
+ }
1606
+ catch(const std::exception& ex)
1607
+ {
1608
+ if(logger())
1609
+ {
1610
+ Warning out(logger());
1611
+ out << "std::exception raised by ice_postUnmarshal:\n" << ex;
1612
+ }
1613
+ }
1614
+ catch(...)
1615
+ {
1616
+ if(logger())
1617
+ {
1618
+ Warning out(logger());
1619
+ out << "unknown exception raised by ice_postUnmarshal";
1620
+ }
1621
+ }
1622
+ }
1623
+
1624
+ void
1625
+ Ice::InputStream::traceSkipSlice(const string& typeId, SliceType sliceType) const
1626
+ {
1627
+ if(_traceSlicing && logger())
1628
+ {
1629
+ traceSlicing(sliceType == ExceptionSlice ? "exception" : "object", typeId, "Slicing", logger());
1630
+ }
1631
+ }
1632
+
1633
+ ValueFactoryManagerPtr
1634
+ Ice::InputStream::valueFactoryManager() const
1635
+ {
1636
+ if(_valueFactoryManager)
1637
+ {
1638
+ return _valueFactoryManager;
1639
+ }
1640
+ else if(_instance)
1641
+ {
1642
+ return _instance->initializationData().valueFactoryManager;
1643
+ }
1644
+
1645
+ return 0;
1646
+ }
1647
+
1648
+ LoggerPtr
1649
+ Ice::InputStream::logger() const
1650
+ {
1651
+ if(_logger)
1652
+ {
1653
+ return _logger;
1654
+ }
1655
+ else if(_instance)
1656
+ {
1657
+ return _instance->initializationData().logger;
1658
+ }
1659
+
1660
+ return 0;
1661
+ }
1662
+
1663
+ #ifdef ICE_CPP11_MAPPING
1664
+ function<string(int)>
1665
+ Ice::InputStream::compactIdResolver() const
1666
+ {
1667
+ if(_compactIdResolver)
1668
+ {
1669
+ return _compactIdResolver;
1670
+ }
1671
+ else if(_instance)
1672
+ {
1673
+ return _instance->initializationData().compactIdResolver;
1674
+ }
1675
+
1676
+ return nullptr;
1677
+ }
1678
+ #else
1679
+ CompactIdResolverPtr
1680
+ Ice::InputStream::compactIdResolver() const
1681
+ {
1682
+ if(_compactIdResolver)
1683
+ {
1684
+ return _compactIdResolver;
1685
+ }
1686
+ else if(_instance)
1687
+ {
1688
+ return _instance->initializationData().compactIdResolver;
1689
+ }
1690
+
1691
+ return 0;
1692
+ }
1693
+ #endif
1694
+
1695
+ void
1696
+ Ice::InputStream::initEncaps()
1697
+ {
1698
+ if(!_currentEncaps) // Lazy initialization.
1699
+ {
1700
+ _currentEncaps = &_preAllocatedEncaps;
1701
+ _currentEncaps->encoding = _encoding;
1702
+ _currentEncaps->sz = static_cast<Ice::Int>(b.size());
1703
+ }
1704
+
1705
+ if(!_currentEncaps->decoder) // Lazy initialization.
1706
+ {
1707
+ ValueFactoryManagerPtr vfm = valueFactoryManager();
1708
+ if(_currentEncaps->encoding == Encoding_1_0)
1709
+ {
1710
+ _currentEncaps->decoder = new EncapsDecoder10(this, _currentEncaps, _sliceValues, _classGraphDepthMax, vfm);
1711
+ }
1712
+ else
1713
+ {
1714
+ _currentEncaps->decoder = new EncapsDecoder11(this, _currentEncaps, _sliceValues, _classGraphDepthMax, vfm);
1715
+ }
1716
+ }
1717
+ }
1718
+
1719
+ Ice::InputStream::EncapsDecoder::~EncapsDecoder()
1720
+ {
1721
+ // Out of line to avoid weak vtable
1722
+ }
1723
+
1724
+ string
1725
+ Ice::InputStream::EncapsDecoder::readTypeId(bool isIndex)
1726
+ {
1727
+ if(isIndex)
1728
+ {
1729
+ Int index = _stream->readSize();
1730
+ TypeIdMap::const_iterator k = _typeIdMap.find(index);
1731
+ if(k == _typeIdMap.end())
1732
+ {
1733
+ throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
1734
+ }
1735
+ return k->second;
1736
+ }
1737
+ else
1738
+ {
1739
+ string typeId;
1740
+ _stream->read(typeId, false);
1741
+ _typeIdMap.insert(make_pair(++_typeIdIndex, typeId));
1742
+ return typeId;
1743
+ }
1744
+ }
1745
+
1746
+ Ice::ValuePtr
1747
+ Ice::InputStream::EncapsDecoder::newInstance(const string& typeId)
1748
+ {
1749
+ Ice::ValuePtr v;
1750
+
1751
+ //
1752
+ // Try to find a factory registered for the specific type.
1753
+ //
1754
+ #ifdef ICE_CPP11_MAPPING
1755
+ function<ValuePtr(const string&)> userFactory;
1756
+ if(_valueFactoryManager)
1757
+ {
1758
+ userFactory = _valueFactoryManager->find(typeId);
1759
+ if(userFactory)
1760
+ {
1761
+ v = userFactory(typeId);
1762
+ }
1763
+ }
1764
+ #else
1765
+ ValueFactoryPtr userFactory;
1766
+ if(_valueFactoryManager)
1767
+ {
1768
+ userFactory = _valueFactoryManager->find(typeId);
1769
+ if(userFactory)
1770
+ {
1771
+ v = userFactory->create(typeId);
1772
+ }
1773
+ }
1774
+ #endif
1775
+ //
1776
+ // If that fails, invoke the default factory if one has been registered.
1777
+ //
1778
+ if(!v && _valueFactoryManager)
1779
+ {
1780
+ userFactory = _valueFactoryManager->find("");
1781
+ if(userFactory)
1782
+ {
1783
+ #ifdef ICE_CPP11_MAPPING
1784
+ v = userFactory(typeId);
1785
+ #else
1786
+ v = userFactory->create(typeId);
1787
+ #endif
1788
+ }
1789
+ }
1790
+
1791
+ //
1792
+ // Last chance: check the table of static factories (i.e.,
1793
+ // automatically generated factories for concrete classes).
1794
+ //
1795
+ if(!v)
1796
+ {
1797
+ #ifdef ICE_CPP11_MAPPING
1798
+ function<ValuePtr(const string&)> of = IceInternal::factoryTable->getValueFactory(typeId);
1799
+ if(of)
1800
+ {
1801
+ v = of(typeId);
1802
+ assert(v);
1803
+ }
1804
+ #else
1805
+ ValueFactoryPtr of = IceInternal::factoryTable->getValueFactory(typeId);
1806
+ if(of)
1807
+ {
1808
+ v = of->create(typeId);
1809
+ assert(v);
1810
+ }
1811
+ #endif
1812
+ }
1813
+ return v;
1814
+ }
1815
+
1816
+ void
1817
+ Ice::InputStream::EncapsDecoder::addPatchEntry(Int index, PatchFunc patchFunc, void* patchAddr)
1818
+ {
1819
+ assert(index > 0);
1820
+
1821
+ //
1822
+ // Check if we already unmarshaled the object. If that's the case,
1823
+ // just patch the object smart pointer and we're done.
1824
+ //
1825
+ IndexToPtrMap::iterator p = _unmarshaledMap.find(index);
1826
+ if(p != _unmarshaledMap.end())
1827
+ {
1828
+ (*patchFunc)(patchAddr, p->second);
1829
+ return;
1830
+ }
1831
+
1832
+ //
1833
+ // Add a patch entry if the object isn't unmarshaled yet, the
1834
+ // smart pointer will be patched when the instance is
1835
+ // unmarshaled.
1836
+ //
1837
+
1838
+ PatchMap::iterator q = _patchMap.find(index);
1839
+ if(q == _patchMap.end())
1840
+ {
1841
+ //
1842
+ // We have no outstanding instances to be patched for this
1843
+ // index, so make a new entry in the patch map.
1844
+ //
1845
+ q = _patchMap.insert(make_pair(index, PatchList())).first;
1846
+ }
1847
+
1848
+ //
1849
+ // Append a patch entry for this instance.
1850
+ //
1851
+ PatchEntry e;
1852
+ e.patchFunc = patchFunc;
1853
+ e.patchAddr = patchAddr;
1854
+ e.classGraphDepth = _classGraphDepth;
1855
+ q->second.push_back(e);
1856
+ }
1857
+
1858
+ void
1859
+ Ice::InputStream::EncapsDecoder::unmarshal(Int index, const Ice::ValuePtr& v)
1860
+ {
1861
+ //
1862
+ // Add the object to the map of unmarshaled instances, this must
1863
+ // be done before reading the instances (for circular references).
1864
+ //
1865
+ _unmarshaledMap.insert(make_pair(index, v));
1866
+
1867
+ //
1868
+ // Read the object.
1869
+ //
1870
+ v->_iceRead(_stream);
1871
+
1872
+ //
1873
+ // Patch all instances now that the object is unmarshaled.
1874
+ //
1875
+ PatchMap::iterator patchPos = _patchMap.find(index);
1876
+ if(patchPos != _patchMap.end())
1877
+ {
1878
+ assert(patchPos->second.size() > 0);
1879
+
1880
+ //
1881
+ // Patch all pointers that refer to the instance.
1882
+ //
1883
+ for(PatchList::iterator k = patchPos->second.begin(); k != patchPos->second.end(); ++k)
1884
+ {
1885
+ (*k->patchFunc)(k->patchAddr, v);
1886
+ }
1887
+
1888
+ //
1889
+ // Clear out the patch map for that index -- there is nothing left
1890
+ // to patch for that index for the time being.
1891
+ //
1892
+ _patchMap.erase(patchPos);
1893
+ }
1894
+
1895
+ if(_valueList.empty() && _patchMap.empty())
1896
+ {
1897
+ _stream->postUnmarshal(v);
1898
+ }
1899
+ else
1900
+ {
1901
+ _valueList.push_back(v);
1902
+
1903
+ if(_patchMap.empty())
1904
+ {
1905
+ //
1906
+ // Iterate over the value list and invoke ice_postUnmarshal on
1907
+ // each value. We must do this after all values have been
1908
+ // unmarshaled in order to ensure that any value data members
1909
+ // have been properly patched.
1910
+ //
1911
+ for(ValueList::iterator p = _valueList.begin(); p != _valueList.end(); ++p)
1912
+ {
1913
+ _stream->postUnmarshal(*p);
1914
+ }
1915
+ _valueList.clear();
1916
+ }
1917
+ }
1918
+ }
1919
+
1920
+ void
1921
+ Ice::InputStream::EncapsDecoder10::read(PatchFunc patchFunc, void* patchAddr)
1922
+ {
1923
+ assert(patchFunc && patchAddr);
1924
+
1925
+ //
1926
+ // Object references are encoded as a negative integer in 1.0.
1927
+ //
1928
+ Int index;
1929
+ _stream->read(index);
1930
+ if(index > 0)
1931
+ {
1932
+ throw MarshalException(__FILE__, __LINE__, "invalid object id");
1933
+ }
1934
+ index = -index;
1935
+
1936
+ if(index == 0)
1937
+ {
1938
+ //
1939
+ // Calling the patch function for null instances is necessary for correct functioning of Ice for
1940
+ // Python and Ruby.
1941
+ //
1942
+ ValuePtr nil;
1943
+ patchFunc(patchAddr, nil);
1944
+ }
1945
+ else
1946
+ {
1947
+ addPatchEntry(index, patchFunc, patchAddr);
1948
+ }
1949
+ }
1950
+
1951
+ void
1952
+ Ice::InputStream::EncapsDecoder10::throwException(ICE_IN(ICE_DELEGATE(UserExceptionFactory)) factory)
1953
+ {
1954
+ assert(_sliceType == NoSlice);
1955
+
1956
+ //
1957
+ // User exception with the 1.0 encoding start with a boolean flag
1958
+ // that indicates whether or not the exception has classes.
1959
+ //
1960
+ // This allows reading the pending values even if some part of
1961
+ // the exception was sliced.
1962
+ //
1963
+ bool usesClasses;
1964
+ _stream->read(usesClasses);
1965
+
1966
+ _sliceType = ExceptionSlice;
1967
+ _skipFirstSlice = false;
1968
+
1969
+ //
1970
+ // Read the first slice header.
1971
+ //
1972
+ startSlice();
1973
+ const string mostDerivedId = _typeId;
1974
+ ICE_DELEGATE(UserExceptionFactory) exceptionFactory = factory;
1975
+ while(true)
1976
+ {
1977
+ //
1978
+ // Look for a statically-generated factory for this ID.
1979
+ //
1980
+ if(!exceptionFactory)
1981
+ {
1982
+ exceptionFactory = factoryTable->getExceptionFactory(_typeId);
1983
+ }
1984
+
1985
+ //
1986
+ // We found a factory, we get out of this loop.
1987
+ //
1988
+ if(exceptionFactory)
1989
+ {
1990
+ //
1991
+ // Got factory -- ask the factory to instantiate the
1992
+ // exception, initialize the exception members, and throw
1993
+ // the exception.
1994
+ //
1995
+ try
1996
+ {
1997
+ #ifdef ICE_CPP11_MAPPING
1998
+ exceptionFactory(_typeId);
1999
+ #else
2000
+ exceptionFactory->createAndThrow(_typeId);
2001
+ #endif
2002
+ }
2003
+ catch(UserException& ex)
2004
+ {
2005
+ ex._read(_stream);
2006
+ if(usesClasses)
2007
+ {
2008
+ readPendingValues();
2009
+ }
2010
+ throw;
2011
+
2012
+ // Never reached.
2013
+ }
2014
+ }
2015
+
2016
+ //
2017
+ // Slice off what we don't understand.
2018
+ //
2019
+ skipSlice();
2020
+ try
2021
+ {
2022
+ startSlice();
2023
+ }
2024
+ catch(UnmarshalOutOfBoundsException& ex)
2025
+ {
2026
+ //
2027
+ // An oversight in the 1.0 encoding means there is no marker to indicate
2028
+ // the last slice of an exception. As a result, we just try to read the
2029
+ // next type ID, which raises UnmarshalOutOfBoundsException when the
2030
+ // input buffer underflows.
2031
+ //
2032
+ // Set the reason member to a more helpful message.
2033
+ //
2034
+ ex.reason = "unknown exception type `" + mostDerivedId + "'";
2035
+ throw;
2036
+ }
2037
+ }
2038
+ }
2039
+
2040
+ void
2041
+ #ifndef NDEBUG
2042
+ Ice::InputStream::EncapsDecoder10::startInstance(SliceType sliceType)
2043
+ #else
2044
+ Ice::InputStream::EncapsDecoder10::startInstance(SliceType)
2045
+ #endif
2046
+ {
2047
+ assert(_sliceType == sliceType);
2048
+ _skipFirstSlice = true;
2049
+ }
2050
+
2051
+ SlicedDataPtr
2052
+ Ice::InputStream::EncapsDecoder10::endInstance(bool)
2053
+ {
2054
+ //
2055
+ // Read the Ice::Value slice.
2056
+ //
2057
+ if(_sliceType == ValueSlice)
2058
+ {
2059
+ startSlice();
2060
+ Int sz = _stream->readSize(); // For compatibility with the old AFM.
2061
+ if(sz != 0)
2062
+ {
2063
+ throw MarshalException(__FILE__, __LINE__, "invalid Object slice");
2064
+ }
2065
+ endSlice();
2066
+ }
2067
+ _sliceType = NoSlice;
2068
+ return 0;
2069
+ }
2070
+
2071
+ const std::string&
2072
+ Ice::InputStream::EncapsDecoder10::startSlice()
2073
+ {
2074
+ //
2075
+ // If first slice, don't read the header, it was already read in
2076
+ // readInstance or throwException to find the factory.
2077
+ //
2078
+ if(_skipFirstSlice)
2079
+ {
2080
+ _skipFirstSlice = false;
2081
+ return _typeId;
2082
+ }
2083
+
2084
+ //
2085
+ // For values, first read the type ID boolean which indicates
2086
+ // whether or not the type ID is encoded as a string or as an
2087
+ // index. For exceptions, the type ID is always encoded as a
2088
+ // string.
2089
+ //
2090
+ if(_sliceType == ValueSlice)
2091
+ {
2092
+ bool isIndex;
2093
+ _stream->read(isIndex);
2094
+ _typeId = readTypeId(isIndex);
2095
+ }
2096
+ else
2097
+ {
2098
+ _stream->read(_typeId, false);
2099
+ }
2100
+
2101
+ _stream->read(_sliceSize);
2102
+ if(_sliceSize < 4)
2103
+ {
2104
+ throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
2105
+ }
2106
+ return _typeId;
2107
+ }
2108
+
2109
+ void
2110
+ Ice::InputStream::EncapsDecoder10::endSlice()
2111
+ {
2112
+ }
2113
+
2114
+ void
2115
+ Ice::InputStream::EncapsDecoder10::skipSlice()
2116
+ {
2117
+ _stream->traceSkipSlice(_typeId, _sliceType);
2118
+ assert(_sliceSize >= 4);
2119
+ _stream->skip(static_cast<size_t>(_sliceSize) - sizeof(Int));
2120
+ }
2121
+
2122
+ void
2123
+ Ice::InputStream::EncapsDecoder10::readPendingValues()
2124
+ {
2125
+ Int num;
2126
+ do
2127
+ {
2128
+ num = _stream->readSize();
2129
+ for(Int k = num; k > 0; --k)
2130
+ {
2131
+ readInstance();
2132
+ }
2133
+ }
2134
+ while(num);
2135
+
2136
+ if(!_patchMap.empty())
2137
+ {
2138
+ //
2139
+ // If any entries remain in the patch map, the sender has sent an index for an object, but failed
2140
+ // to supply the object.
2141
+ //
2142
+ throw MarshalException(__FILE__, __LINE__, "index for class received, but no instance");
2143
+ }
2144
+ }
2145
+
2146
+ void
2147
+ Ice::InputStream::EncapsDecoder10::readInstance()
2148
+ {
2149
+ Int index;
2150
+ _stream->read(index);
2151
+
2152
+ if(index <= 0)
2153
+ {
2154
+ throw MarshalException(__FILE__, __LINE__, "invalid object id");
2155
+ }
2156
+
2157
+ _sliceType = ValueSlice;
2158
+ _skipFirstSlice = false;
2159
+
2160
+ //
2161
+ // Read the first slice header.
2162
+ //
2163
+ startSlice();
2164
+ const string mostDerivedId = _typeId;
2165
+ ValuePtr v;
2166
+ while(true)
2167
+ {
2168
+ //
2169
+ // For the 1.0 encoding, the type ID for the base Object class
2170
+ // marks the last slice.
2171
+ //
2172
+ if(_typeId == Object::ice_staticId())
2173
+ {
2174
+ throw NoValueFactoryException(__FILE__, __LINE__, "", mostDerivedId);
2175
+ }
2176
+
2177
+ v = newInstance(_typeId);
2178
+
2179
+ //
2180
+ // We found a factory, we get out of this loop.
2181
+ //
2182
+ if(v)
2183
+ {
2184
+ break;
2185
+ }
2186
+
2187
+ //
2188
+ // If value slicing is disabled, stop unmarshaling.
2189
+ //
2190
+ if(!_sliceValues)
2191
+ {
2192
+ throw NoValueFactoryException(__FILE__, __LINE__, "no value factory found and value slicing is disabled",
2193
+ _typeId);
2194
+ }
2195
+
2196
+ //
2197
+ // Slice off what we don't understand.
2198
+ //
2199
+ skipSlice();
2200
+ startSlice(); // Read next Slice header for next iteration.
2201
+ }
2202
+
2203
+ //
2204
+ // Compute the biggest class graph depth of this object. To compute this,
2205
+ // we get the class graph depth of each ancestor from the patch map and
2206
+ // keep the biggest one.
2207
+ //
2208
+ _classGraphDepth = 0;
2209
+ PatchMap::iterator patchPos = _patchMap.find(index);
2210
+ if(patchPos != _patchMap.end())
2211
+ {
2212
+ assert(patchPos->second.size() > 0);
2213
+ for(PatchList::iterator k = patchPos->second.begin(); k != patchPos->second.end(); ++k)
2214
+ {
2215
+ if(k->classGraphDepth > _classGraphDepth)
2216
+ {
2217
+ _classGraphDepth = k->classGraphDepth;
2218
+ }
2219
+ }
2220
+ }
2221
+
2222
+ if(++_classGraphDepth > _classGraphDepthMax)
2223
+ {
2224
+ throw MarshalException(__FILE__, __LINE__, "maximum class graph depth reached");
2225
+ }
2226
+
2227
+ //
2228
+ // Unmarshal the instance and add it to the map of unmarshaled instances.
2229
+ //
2230
+ unmarshal(index, v);
2231
+ }
2232
+
2233
+ void
2234
+ Ice::InputStream::EncapsDecoder11::read(PatchFunc patchFunc, void* patchAddr)
2235
+ {
2236
+ Int index = _stream->readSize();
2237
+ if(index < 0)
2238
+ {
2239
+ throw MarshalException(__FILE__, __LINE__, "invalid object id");
2240
+ }
2241
+ else if(index == 0)
2242
+ {
2243
+ //
2244
+ // Calling the patch function for null instances is necessary for correct functioning of Ice for
2245
+ // Python and Ruby.
2246
+ //
2247
+ if(patchFunc)
2248
+ {
2249
+ ValuePtr nil;
2250
+ patchFunc(patchAddr, nil);
2251
+ }
2252
+ }
2253
+ else if(_current && _current->sliceFlags & FLAG_HAS_INDIRECTION_TABLE)
2254
+ {
2255
+ //
2256
+ // When reading an object within a slice and there's an
2257
+ // indirect object table, always read an indirect reference
2258
+ // that points to an object from the indirect object table
2259
+ // marshaled at the end of the Slice.
2260
+ //
2261
+ // Maintain a list of indirect references. Note that the
2262
+ // indirect index starts at 1, so we decrement it by one to
2263
+ // derive an index into the indirection table that we'll read
2264
+ // at the end of the slice.
2265
+ //
2266
+ if(patchFunc)
2267
+ {
2268
+ IndirectPatchEntry e;
2269
+ e.index = index - 1;
2270
+ e.patchFunc = patchFunc;
2271
+ e.patchAddr = patchAddr;
2272
+ _current->indirectPatchList.push_back(e);
2273
+ }
2274
+ }
2275
+ else
2276
+ {
2277
+ readInstance(index, patchFunc, patchAddr);
2278
+ }
2279
+ }
2280
+
2281
+ void
2282
+ Ice::InputStream::EncapsDecoder11::throwException(ICE_IN(ICE_DELEGATE(UserExceptionFactory)) factory)
2283
+ {
2284
+ assert(!_current);
2285
+
2286
+ push(ExceptionSlice);
2287
+
2288
+ //
2289
+ // Read the first slice header.
2290
+ //
2291
+ startSlice();
2292
+ const string mostDerivedId = _current->typeId;
2293
+ ICE_DELEGATE(UserExceptionFactory) exceptionFactory = factory;
2294
+ while(true)
2295
+ {
2296
+ //
2297
+ // Look for a statically-generated factory for this ID.
2298
+ //
2299
+ if(!exceptionFactory)
2300
+ {
2301
+ exceptionFactory = factoryTable->getExceptionFactory(_current->typeId);
2302
+ }
2303
+
2304
+ //
2305
+ // We found a factory, we get out of this loop.
2306
+ //
2307
+ if(exceptionFactory)
2308
+ {
2309
+ //
2310
+ // Got factory -- ask the factory to instantiate the
2311
+ // exception, initialize the exception members, and throw
2312
+ // the exception.
2313
+ //
2314
+ try
2315
+ {
2316
+ #ifdef ICE_CPP11_MAPPING
2317
+ exceptionFactory(_current->typeId);
2318
+ #else
2319
+ exceptionFactory->createAndThrow(_current->typeId);
2320
+ #endif
2321
+ }
2322
+ catch(UserException& ex)
2323
+ {
2324
+ ex._read(_stream);
2325
+ throw;
2326
+
2327
+ // Never reached.
2328
+ }
2329
+ }
2330
+
2331
+ //
2332
+ // Slice off what we don't understand.
2333
+ //
2334
+ skipSlice();
2335
+
2336
+ //
2337
+ // If this is the last slice, raise an exception and stop un-marshalling.
2338
+ //
2339
+ if(_current->sliceFlags & FLAG_IS_LAST_SLICE)
2340
+ {
2341
+ throw UnknownUserException(__FILE__, __LINE__, mostDerivedId);
2342
+ }
2343
+
2344
+ startSlice();
2345
+ }
2346
+ }
2347
+
2348
+ void
2349
+ #ifndef NDEBUG
2350
+ Ice::InputStream::EncapsDecoder11::startInstance(SliceType sliceType)
2351
+ #else
2352
+ Ice::InputStream::EncapsDecoder11::startInstance(SliceType)
2353
+ #endif
2354
+ {
2355
+ assert(_current->sliceType == sliceType);
2356
+ _current->skipFirstSlice = true;
2357
+ }
2358
+
2359
+ SlicedDataPtr
2360
+ Ice::InputStream::EncapsDecoder11::endInstance(bool preserve)
2361
+ {
2362
+ SlicedDataPtr slicedData;
2363
+ if(preserve)
2364
+ {
2365
+ slicedData = readSlicedData();
2366
+ }
2367
+ _current->slices.clear();
2368
+ _current->indirectionTables.clear();
2369
+ _current = _current->previous;
2370
+ return slicedData;
2371
+ }
2372
+
2373
+ const std::string&
2374
+ Ice::InputStream::EncapsDecoder11::startSlice()
2375
+ {
2376
+ //
2377
+ // If first slice, don't read the header, it was already read in
2378
+ // readInstance or throwException to find the factory.
2379
+ //
2380
+ if(_current->skipFirstSlice)
2381
+ {
2382
+ _current->skipFirstSlice = false;
2383
+ return _current->typeId;
2384
+ }
2385
+
2386
+ _stream->read(_current->sliceFlags);
2387
+
2388
+ //
2389
+ // Read the type ID, for value slices the type ID is encoded as a
2390
+ // string or as an index, for exceptions it's always encoded as a
2391
+ // string.
2392
+ //
2393
+ if(_current->sliceType == ValueSlice)
2394
+ {
2395
+ if((_current->sliceFlags & FLAG_HAS_TYPE_ID_COMPACT) == FLAG_HAS_TYPE_ID_COMPACT) // Must be checked first!
2396
+ {
2397
+ _current->typeId.clear();
2398
+ _current->compactId = _stream->readSize();
2399
+ }
2400
+ else if(_current->sliceFlags & (FLAG_HAS_TYPE_ID_STRING | FLAG_HAS_TYPE_ID_INDEX))
2401
+ {
2402
+ _current->typeId = readTypeId(_current->sliceFlags & FLAG_HAS_TYPE_ID_INDEX);
2403
+ _current->compactId = -1;
2404
+ }
2405
+ else
2406
+ {
2407
+ // Only the most derived slice encodes the type ID for the compact format.
2408
+ _current->typeId.clear();
2409
+ _current->compactId = -1;
2410
+ }
2411
+ }
2412
+ else
2413
+ {
2414
+ _stream->read(_current->typeId, false);
2415
+ }
2416
+
2417
+ //
2418
+ // Read the slice size if necessary.
2419
+ //
2420
+ if(_current->sliceFlags & FLAG_HAS_SLICE_SIZE)
2421
+ {
2422
+ _stream->read(_current->sliceSize);
2423
+ if(_current->sliceSize < 4)
2424
+ {
2425
+ throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
2426
+ }
2427
+ }
2428
+ else
2429
+ {
2430
+ _current->sliceSize = 0;
2431
+ }
2432
+
2433
+ return _current->typeId;
2434
+ }
2435
+
2436
+ void
2437
+ Ice::InputStream::EncapsDecoder11::endSlice()
2438
+ {
2439
+ if(_current->sliceFlags & FLAG_HAS_OPTIONAL_MEMBERS)
2440
+ {
2441
+ _stream->skipOptionals();
2442
+ }
2443
+
2444
+ //
2445
+ // Read the indirect object table if one is present.
2446
+ //
2447
+ if(_current->sliceFlags & FLAG_HAS_INDIRECTION_TABLE)
2448
+ {
2449
+ IndexList indirectionTable(static_cast<size_t>(_stream->readAndCheckSeqSize(1)));
2450
+ for(IndexList::iterator p = indirectionTable.begin(); p != indirectionTable.end(); ++p)
2451
+ {
2452
+ *p = readInstance(_stream->readSize(), 0, 0);
2453
+ }
2454
+
2455
+ //
2456
+ // Sanity checks. If there are optional members, it's possible
2457
+ // that not all object references were read if they are from
2458
+ // unknown optional data members.
2459
+ //
2460
+ if(indirectionTable.empty())
2461
+ {
2462
+ throw MarshalException(__FILE__, __LINE__, "empty indirection table");
2463
+ }
2464
+ if(_current->indirectPatchList.empty() && !(_current->sliceFlags & FLAG_HAS_OPTIONAL_MEMBERS))
2465
+ {
2466
+ throw MarshalException(__FILE__, __LINE__, "no references to indirection table");
2467
+ }
2468
+
2469
+ //
2470
+ // Convert indirect references into direct references.
2471
+ //
2472
+ IndirectPatchList::iterator p;
2473
+ for(p = _current->indirectPatchList.begin(); p != _current->indirectPatchList.end(); ++p)
2474
+ {
2475
+ assert(p->index >= 0);
2476
+ if(p->index >= static_cast<Int>(indirectionTable.size()))
2477
+ {
2478
+ throw MarshalException(__FILE__, __LINE__, "indirection out of range");
2479
+ }
2480
+ addPatchEntry(indirectionTable[static_cast<size_t>(p->index)], p->patchFunc, p->patchAddr);
2481
+ }
2482
+ _current->indirectPatchList.clear();
2483
+ }
2484
+ }
2485
+
2486
+ void
2487
+ Ice::InputStream::EncapsDecoder11::skipSlice()
2488
+ {
2489
+ _stream->traceSkipSlice(_current->typeId, _current->sliceType);
2490
+
2491
+ Container::iterator start = _stream->i;
2492
+
2493
+ if(_current->sliceFlags & FLAG_HAS_SLICE_SIZE)
2494
+ {
2495
+ assert(_current->sliceSize >= 4);
2496
+ _stream->skip(static_cast<size_t>(_current->sliceSize) - sizeof(Int));
2497
+ }
2498
+ else
2499
+ {
2500
+ if(_current->sliceType == ValueSlice)
2501
+ {
2502
+ throw NoValueFactoryException(__FILE__, __LINE__,
2503
+ "no value factory found and compact format prevents "
2504
+ "slicing (the sender should use the sliced format instead)",
2505
+ _current->typeId);
2506
+ }
2507
+ else
2508
+ {
2509
+ throw UnknownUserException(__FILE__, __LINE__, _current->typeId);
2510
+ }
2511
+ }
2512
+
2513
+ //
2514
+ // Preserve this slice.
2515
+ //
2516
+ SliceInfoPtr info = ICE_MAKE_SHARED(SliceInfo);
2517
+ info->typeId = _current->typeId;
2518
+ info->compactId = _current->compactId;
2519
+ info->hasOptionalMembers = _current->sliceFlags & FLAG_HAS_OPTIONAL_MEMBERS;
2520
+ info->isLastSlice = _current->sliceFlags & FLAG_IS_LAST_SLICE;
2521
+ if(info->hasOptionalMembers)
2522
+ {
2523
+ //
2524
+ // Don't include the optional member end marker. It will be re-written by
2525
+ // endSlice when the sliced data is re-written.
2526
+ //
2527
+ vector<Byte>(start, _stream->i - 1).swap(info->bytes);
2528
+ }
2529
+ else
2530
+ {
2531
+ vector<Byte>(start, _stream->i).swap(info->bytes);
2532
+ }
2533
+
2534
+ _current->indirectionTables.push_back(IndexList());
2535
+
2536
+ //
2537
+ // Read the indirect object table. We read the instances or their
2538
+ // IDs if the instance is a reference to an already un-marhsaled
2539
+ // object.
2540
+ //
2541
+ // The SliceInfo object sequence is initialized only if
2542
+ // readSlicedData is called.
2543
+ //
2544
+ if(_current->sliceFlags & FLAG_HAS_INDIRECTION_TABLE)
2545
+ {
2546
+ IndexList& table = _current->indirectionTables.back();
2547
+ table.resize(static_cast<size_t>(_stream->readAndCheckSeqSize(1)));
2548
+ for(IndexList::iterator p = table.begin(); p != table.end(); ++p)
2549
+ {
2550
+ *p = readInstance(_stream->readSize(), 0, 0);
2551
+ }
2552
+ }
2553
+
2554
+ _current->slices.push_back(info);
2555
+ }
2556
+
2557
+ bool
2558
+ Ice::InputStream::EncapsDecoder11::readOptional(Ice::Int readTag, Ice::OptionalFormat expectedFormat)
2559
+ {
2560
+ if(!_current)
2561
+ {
2562
+ return _stream->readOptImpl(readTag, expectedFormat);
2563
+ }
2564
+ else if(_current->sliceFlags & FLAG_HAS_OPTIONAL_MEMBERS)
2565
+ {
2566
+ return _stream->readOptImpl(readTag, expectedFormat);
2567
+ }
2568
+ return false;
2569
+ }
2570
+
2571
+ Int
2572
+ Ice::InputStream::EncapsDecoder11::readInstance(Int index, PatchFunc patchFunc, void* patchAddr)
2573
+ {
2574
+ assert(index > 0);
2575
+
2576
+ if(index > 1)
2577
+ {
2578
+ if(patchFunc)
2579
+ {
2580
+ addPatchEntry(index, patchFunc, patchAddr);
2581
+ }
2582
+ return index;
2583
+ }
2584
+
2585
+ push(ValueSlice);
2586
+
2587
+ //
2588
+ // Get the object ID before we start reading slices. If some
2589
+ // slices are skiped, the indirect object table are still read and
2590
+ // might read other instances.
2591
+ //
2592
+ index = ++_valueIdIndex;
2593
+
2594
+ //
2595
+ // Read the first slice header.
2596
+ //
2597
+ startSlice();
2598
+ const string mostDerivedId = _current->typeId;
2599
+ Ice::ValuePtr v;
2600
+ while(true)
2601
+ {
2602
+ if(_current->compactId >= 0)
2603
+ {
2604
+ //
2605
+ // Translate a compact (numeric) type ID into a string type ID.
2606
+ //
2607
+ _current->typeId = _stream->resolveCompactId(_current->compactId);
2608
+ if(_current->typeId.empty())
2609
+ {
2610
+ _current->typeId = IceInternal::factoryTable->getTypeId(_current->compactId);
2611
+ }
2612
+ }
2613
+
2614
+ if(!_current->typeId.empty())
2615
+ {
2616
+ v = newInstance(_current->typeId);
2617
+
2618
+ //
2619
+ // We found a factory, we get out of this loop.
2620
+ //
2621
+ if(v)
2622
+ {
2623
+ break;
2624
+ }
2625
+ }
2626
+
2627
+ //
2628
+ // If value slicing is disabled, stop unmarshaling.
2629
+ //
2630
+ if(!_sliceValues)
2631
+ {
2632
+ throw NoValueFactoryException(__FILE__, __LINE__, "no value factory found and value slicing is disabled",
2633
+ _current->typeId);
2634
+ }
2635
+
2636
+ //
2637
+ // Slice off what we don't understand.
2638
+ //
2639
+ skipSlice();
2640
+
2641
+ //
2642
+ // If this is the last slice, keep the object as an opaque UnknownSlicedValue.
2643
+ //
2644
+ if(_current->sliceFlags & FLAG_IS_LAST_SLICE)
2645
+ {
2646
+ //
2647
+ // Provide a factory with an opportunity to supply the object.
2648
+ // We pass the "::Ice::Object" ID to indicate that this is the
2649
+ // last chance to preserve the object.
2650
+ //
2651
+ v = newInstance(Object::ice_staticId());
2652
+ if(!v)
2653
+ {
2654
+ v = ICE_MAKE_SHARED(UnknownSlicedValue, mostDerivedId);
2655
+ }
2656
+
2657
+ break;
2658
+ }
2659
+
2660
+ startSlice(); // Read next Slice header for next iteration.
2661
+ }
2662
+
2663
+ if(++_classGraphDepth > _classGraphDepthMax)
2664
+ {
2665
+ throw MarshalException(__FILE__, __LINE__, "maximum class graph depth reached");
2666
+ }
2667
+
2668
+ //
2669
+ // Unmarshal the object.
2670
+ //
2671
+ unmarshal(index, v);
2672
+
2673
+ --_classGraphDepth;
2674
+
2675
+ if(!_current && !_patchMap.empty())
2676
+ {
2677
+ //
2678
+ // If any entries remain in the patch map, the sender has sent an index for an object, but failed
2679
+ // to supply the object.
2680
+ //
2681
+ throw MarshalException(__FILE__, __LINE__, "index for class received, but no instance");
2682
+ }
2683
+
2684
+ if(patchFunc)
2685
+ {
2686
+ patchFunc(patchAddr, v);
2687
+ }
2688
+ return index;
2689
+ }
2690
+
2691
+ SlicedDataPtr
2692
+ Ice::InputStream::EncapsDecoder11::readSlicedData()
2693
+ {
2694
+ if(_current->slices.empty()) // No preserved slices.
2695
+ {
2696
+ return 0;
2697
+ }
2698
+
2699
+ //
2700
+ // The indirectionTables member holds the indirection table for
2701
+ // each slice in slices.
2702
+ //
2703
+ assert(_current->slices.size() == _current->indirectionTables.size());
2704
+ for(SliceInfoSeq::size_type n = 0; n < _current->slices.size(); ++n)
2705
+ {
2706
+ //
2707
+ // We use the "instances" list in SliceInfo to hold references
2708
+ // to the target instances. Note that the instances might not have
2709
+ // been read yet in the case of a circular reference to an
2710
+ // enclosing instance.
2711
+ //
2712
+ const IndexList& table = _current->indirectionTables[n];
2713
+ vector<ValuePtr>& instances = _current->slices[n]->instances;
2714
+ instances.resize(table.size());
2715
+ IndexList::size_type j = 0;
2716
+ for(IndexList::const_iterator p = table.begin(); p != table.end(); ++p)
2717
+ {
2718
+ #ifdef ICE_CPP11_MAPPING
2719
+ addPatchEntry(*p, &patchHandle<Value>, &instances[j++]);
2720
+ #else
2721
+ addPatchEntry(*p, &patchHandle<Object>, &instances[j++]);
2722
+ #endif
2723
+ }
2724
+ }
2725
+ return ICE_MAKE_SHARED(SlicedData, _current->slices);
2726
+ }