zeroc-ice 3.6.5 → 3.7.0

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