zeroc-ice 3.6.5 → 3.7.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (777) hide show
  1. checksums.yaml +5 -5
  2. data/ICE_LICENSE +17 -17
  3. data/LICENSE +12 -12
  4. data/bin/slice2rb +1 -6
  5. data/ext/Communicator.cpp +223 -61
  6. data/ext/Communicator.h +1 -6
  7. data/ext/Config.h +23 -7
  8. data/ext/Connection.cpp +108 -76
  9. data/ext/Connection.h +4 -6
  10. data/ext/Endpoint.cpp +16 -54
  11. data/ext/Endpoint.h +1 -6
  12. data/ext/ImplicitContext.cpp +1 -10
  13. data/ext/ImplicitContext.h +1 -6
  14. data/ext/Init.cpp +4 -6
  15. data/ext/Logger.cpp +1 -6
  16. data/ext/Logger.h +1 -6
  17. data/ext/Operation.cpp +38 -54
  18. data/ext/Operation.h +1 -6
  19. data/ext/Properties.cpp +3 -8
  20. data/ext/Properties.h +1 -6
  21. data/ext/Proxy.cpp +111 -70
  22. data/ext/Proxy.h +1 -6
  23. data/ext/Slice.cpp +5 -20
  24. data/ext/Slice.h +1 -6
  25. data/ext/Types.cpp +313 -224
  26. data/ext/Types.h +118 -71
  27. data/ext/Util.cpp +69 -36
  28. data/ext/Util.h +117 -42
  29. data/ext/ValueFactoryManager.cpp +440 -0
  30. data/ext/ValueFactoryManager.h +95 -0
  31. data/ext/extconf.rb +52 -48
  32. data/ext/ice/cpp/include/Ice/Application.h +275 -105
  33. data/ext/ice/cpp/include/Ice/AsyncResult.h +124 -337
  34. data/ext/ice/cpp/include/Ice/AsyncResultF.h +4 -7
  35. data/ext/ice/cpp/include/Ice/BatchRequestInterceptor.h +39 -16
  36. data/ext/ice/cpp/include/Ice/BatchRequestQueueF.h +1 -6
  37. data/ext/ice/cpp/include/Ice/Buffer.h +10 -15
  38. data/ext/ice/cpp/include/Ice/CommunicatorAsync.h +56 -17
  39. data/ext/ice/cpp/include/Ice/Comparable.h +205 -0
  40. data/ext/ice/cpp/include/Ice/Config.h +16 -39
  41. data/ext/ice/cpp/include/Ice/ConnectionAsync.h +203 -16
  42. data/ext/ice/cpp/include/Ice/ConnectionIF.h +7 -6
  43. data/ext/ice/cpp/include/Ice/ConsoleUtil.h +23 -0
  44. data/ext/ice/cpp/include/Ice/DefaultValueFactory.h +57 -0
  45. data/ext/ice/cpp/include/Ice/DispatchInterceptor.h +20 -12
  46. data/ext/ice/cpp/include/Ice/Dispatcher.h +35 -19
  47. data/ext/ice/cpp/include/Ice/DynamicLibrary.h +7 -10
  48. data/ext/ice/cpp/include/Ice/DynamicLibraryF.h +1 -6
  49. data/ext/ice/cpp/include/Ice/Exception.h +110 -63
  50. data/ext/ice/cpp/include/Ice/ExceptionHelpers.h +74 -0
  51. data/ext/ice/cpp/include/Ice/FactoryTable.h +22 -18
  52. data/ext/ice/cpp/include/Ice/FactoryTableInit.h +28 -31
  53. data/ext/ice/cpp/include/Ice/Format.h +17 -18
  54. data/ext/ice/cpp/include/Ice/Functional.h +38 -38
  55. data/ext/ice/cpp/include/Ice/GCObject.h +9 -10
  56. data/ext/ice/cpp/include/Ice/Handle.h +6 -16
  57. data/ext/ice/cpp/include/Ice/Ice.h +9 -10
  58. data/ext/ice/cpp/include/Ice/IconvStringConverter.h +377 -0
  59. data/ext/ice/cpp/include/Ice/Incoming.h +132 -38
  60. data/ext/ice/cpp/include/Ice/IncomingAsync.h +109 -31
  61. data/ext/ice/cpp/include/Ice/IncomingAsyncF.h +7 -6
  62. data/ext/ice/cpp/include/Ice/Initialize.h +872 -60
  63. data/ext/ice/cpp/include/Ice/InputStream.h +1514 -0
  64. data/ext/ice/cpp/include/Ice/InstanceF.h +1 -7
  65. data/ext/ice/cpp/include/Ice/InterfaceByValue.h +57 -0
  66. data/ext/ice/cpp/include/Ice/LocalObject.h +13 -14
  67. data/ext/ice/cpp/include/Ice/LocalObjectF.h +1 -6
  68. data/ext/ice/cpp/include/Ice/LoggerUtil.h +56 -24
  69. data/ext/ice/cpp/include/Ice/MetricsAdminI.h +124 -71
  70. data/ext/ice/cpp/include/Ice/MetricsFunctional.h +25 -10
  71. data/ext/ice/cpp/include/Ice/MetricsObserverI.h +116 -32
  72. data/ext/ice/cpp/include/Ice/NativePropertiesAdmin.h +61 -30
  73. data/ext/ice/cpp/include/Ice/Object.h +413 -78
  74. data/ext/ice/cpp/include/Ice/ObjectF.h +12 -8
  75. data/ext/ice/cpp/include/Ice/ObserverHelper.h +18 -13
  76. data/ext/ice/cpp/include/Ice/Optional.h +1114 -0
  77. data/ext/ice/cpp/include/Ice/OutgoingAsync.h +684 -89
  78. data/ext/ice/cpp/include/Ice/OutgoingAsyncF.h +12 -11
  79. data/ext/ice/cpp/include/Ice/OutputStream.h +1092 -0
  80. data/ext/ice/cpp/include/Ice/Protocol.h +49 -17
  81. data/ext/ice/cpp/include/Ice/Proxy.h +3438 -745
  82. data/ext/ice/cpp/include/Ice/ProxyF.h +13 -38
  83. data/ext/ice/cpp/include/Ice/ProxyFactoryF.h +1 -6
  84. data/ext/ice/cpp/include/Ice/ProxyHandle.h +43 -55
  85. data/ext/ice/cpp/include/Ice/ReferenceF.h +1 -6
  86. data/ext/ice/cpp/include/Ice/RegisterPlugins.h +84 -12
  87. data/ext/ice/cpp/include/Ice/RequestHandlerF.h +10 -9
  88. data/ext/ice/cpp/include/Ice/ResponseHandlerF.h +6 -6
  89. data/ext/ice/cpp/include/Ice/SHA1.h +42 -0
  90. data/ext/ice/cpp/include/Ice/ServantManagerF.h +1 -6
  91. data/ext/ice/cpp/include/Ice/Service.h +273 -154
  92. data/ext/ice/cpp/include/Ice/SliceChecksums.h +5 -6
  93. data/ext/ice/cpp/include/Ice/SlicedData.h +121 -53
  94. data/ext/ice/cpp/include/Ice/SlicedDataF.h +17 -11
  95. data/ext/ice/cpp/include/Ice/StreamHelpers.h +453 -140
  96. data/ext/ice/cpp/include/Ice/StringConverter.h +78 -0
  97. data/ext/ice/cpp/include/Ice/ThreadPoolF.h +1 -6
  98. data/ext/ice/cpp/include/Ice/UUID.h +19 -0
  99. data/ext/ice/cpp/include/{IceUtil → Ice}/UniquePtr.h +22 -28
  100. data/ext/ice/cpp/include/Ice/UniqueRef.h +97 -0
  101. data/ext/ice/cpp/include/Ice/UserExceptionFactory.h +45 -13
  102. data/ext/ice/cpp/include/Ice/Value.h +139 -0
  103. data/ext/ice/cpp/include/Ice/ValueF.h +21 -0
  104. data/ext/ice/cpp/include/IceSSL/Config.h +8 -28
  105. data/ext/ice/cpp/include/IceSSL/IceSSL.h +17 -11
  106. data/ext/ice/cpp/include/IceSSL/OpenSSL.h +147 -0
  107. data/ext/ice/cpp/include/IceSSL/Plugin.h +461 -448
  108. data/ext/ice/cpp/include/IceSSL/SChannel.h +72 -0
  109. data/ext/ice/cpp/include/IceSSL/SecureTransport.h +72 -0
  110. data/ext/ice/cpp/include/IceSSL/UWP.h +62 -0
  111. data/ext/ice/cpp/include/IceUtil/Atomic.h +7 -14
  112. data/ext/ice/cpp/include/IceUtil/Cond.h +17 -23
  113. data/ext/ice/cpp/include/IceUtil/Config.h +166 -46
  114. data/ext/ice/cpp/include/IceUtil/ConsoleUtil.h +92 -0
  115. data/ext/ice/cpp/include/IceUtil/CountDownLatch.h +5 -10
  116. data/ext/ice/cpp/include/IceUtil/CtrlCHandler.h +63 -41
  117. data/ext/ice/cpp/include/IceUtil/DisableWarnings.h +5 -13
  118. data/ext/ice/cpp/include/IceUtil/Exception.h +284 -75
  119. data/ext/ice/cpp/include/IceUtil/FileUtil.h +143 -0
  120. data/ext/ice/cpp/include/IceUtil/Functional.h +4 -6
  121. data/ext/ice/cpp/include/IceUtil/Handle.h +11 -16
  122. data/ext/ice/cpp/include/IceUtil/IceUtil.h +4 -15
  123. data/ext/ice/cpp/include/IceUtil/InputUtil.h +3 -8
  124. data/ext/ice/cpp/include/IceUtil/Iterator.h +2 -7
  125. data/ext/ice/cpp/include/IceUtil/Lock.h +8 -15
  126. data/ext/ice/cpp/include/IceUtil/Monitor.h +1 -7
  127. data/ext/ice/cpp/include/IceUtil/Mutex.h +19 -23
  128. data/ext/ice/cpp/include/IceUtil/MutexProtocol.h +2 -7
  129. data/ext/ice/cpp/include/IceUtil/MutexPtrLock.h +4 -9
  130. data/ext/ice/cpp/include/IceUtil/MutexPtrTryLock.h +4 -9
  131. data/ext/ice/cpp/include/IceUtil/Optional.h +134 -23
  132. data/ext/ice/cpp/include/IceUtil/Options.h +17 -23
  133. data/ext/ice/cpp/include/IceUtil/OutputUtil.h +61 -37
  134. data/ext/ice/cpp/include/IceUtil/PopDisableWarnings.h +6 -11
  135. data/ext/ice/cpp/include/IceUtil/PushDisableWarnings.h +18 -15
  136. data/ext/ice/cpp/include/IceUtil/Random.h +39 -8
  137. data/ext/ice/cpp/include/IceUtil/RecMutex.h +7 -13
  138. data/ext/ice/cpp/include/IceUtil/ResourceConfig.h +53 -0
  139. data/ext/ice/cpp/include/IceUtil/ScannerConfig.h +10 -15
  140. data/ext/ice/cpp/include/IceUtil/ScopedArray.h +8 -7
  141. data/ext/ice/cpp/include/IceUtil/Shared.h +5 -12
  142. data/ext/ice/cpp/{src → include}/IceUtil/StopWatch.h +2 -7
  143. data/ext/ice/cpp/include/IceUtil/StringConverter.h +146 -126
  144. data/ext/ice/cpp/include/IceUtil/StringUtil.h +32 -26
  145. data/ext/ice/cpp/include/IceUtil/Thread.h +10 -17
  146. data/ext/ice/cpp/include/IceUtil/ThreadException.h +33 -47
  147. data/ext/ice/cpp/include/IceUtil/Time.h +3 -8
  148. data/ext/ice/cpp/include/IceUtil/Timer.h +18 -18
  149. data/ext/ice/cpp/include/IceUtil/UUID.h +6 -7
  150. data/ext/ice/cpp/include/IceUtil/UndefSysMacros.h +1 -6
  151. data/ext/ice/cpp/include/generated/Ice/BuiltinSequences.h +170 -0
  152. data/ext/ice/cpp/include/generated/Ice/Communicator.h +1156 -0
  153. data/ext/ice/cpp/include/{Ice → generated/Ice}/CommunicatorF.h +51 -16
  154. data/ext/ice/cpp/include/generated/Ice/Connection.h +1660 -0
  155. data/ext/ice/cpp/include/generated/Ice/ConnectionF.h +119 -0
  156. data/ext/ice/cpp/include/generated/Ice/Current.h +322 -0
  157. data/ext/ice/cpp/include/generated/Ice/Endpoint.h +943 -0
  158. data/ext/ice/cpp/include/generated/Ice/EndpointF.h +166 -0
  159. data/ext/ice/cpp/include/generated/Ice/EndpointTypes.h +118 -0
  160. data/ext/ice/cpp/include/{Ice → generated/Ice}/FacetMap.h +31 -15
  161. data/ext/ice/cpp/include/generated/Ice/Identity.h +264 -0
  162. data/ext/ice/cpp/include/generated/Ice/ImplicitContext.h +278 -0
  163. data/ext/ice/cpp/include/{Ice → generated/Ice}/ImplicitContextF.h +51 -16
  164. data/ext/ice/cpp/include/generated/Ice/Instrumentation.h +1143 -0
  165. data/ext/ice/cpp/include/generated/Ice/InstrumentationF.h +128 -0
  166. data/ext/ice/cpp/include/generated/Ice/LocalException.h +7041 -0
  167. data/ext/ice/cpp/include/generated/Ice/Locator.h +3850 -0
  168. data/ext/ice/cpp/include/generated/Ice/LocatorF.h +147 -0
  169. data/ext/ice/cpp/include/generated/Ice/Logger.h +231 -0
  170. data/ext/ice/cpp/include/{Ice → generated/Ice}/LoggerF.h +51 -16
  171. data/ext/ice/cpp/include/generated/Ice/Metrics.h +4717 -0
  172. data/ext/ice/cpp/include/generated/Ice/ObjectAdapter.h +1175 -0
  173. data/ext/ice/cpp/include/{Ice → generated/Ice}/ObjectAdapterF.h +51 -16
  174. data/ext/ice/cpp/include/generated/Ice/ObjectFactory.h +197 -0
  175. data/ext/ice/cpp/include/generated/Ice/Plugin.h +306 -0
  176. data/ext/ice/cpp/include/generated/Ice/PluginF.h +110 -0
  177. data/ext/ice/cpp/include/generated/Ice/Process.h +971 -0
  178. data/ext/ice/cpp/include/generated/Ice/ProcessF.h +125 -0
  179. data/ext/ice/cpp/include/generated/Ice/Properties.h +446 -0
  180. data/ext/ice/cpp/include/generated/Ice/PropertiesAdmin.h +1360 -0
  181. data/ext/ice/cpp/include/generated/Ice/PropertiesF.h +134 -0
  182. data/ext/ice/cpp/include/generated/Ice/RemoteLogger.h +2689 -0
  183. data/ext/ice/cpp/include/generated/Ice/Router.h +1838 -0
  184. data/ext/ice/cpp/include/generated/Ice/RouterF.h +125 -0
  185. data/ext/ice/cpp/include/generated/Ice/ServantLocator.h +299 -0
  186. data/ext/ice/cpp/include/{Ice → generated/Ice}/ServantLocatorF.h +51 -16
  187. data/ext/ice/cpp/include/{Ice → generated/Ice}/SliceChecksumDict.h +34 -14
  188. data/ext/ice/cpp/include/generated/Ice/ValueFactory.h +318 -0
  189. data/ext/ice/cpp/include/generated/Ice/Version.h +357 -0
  190. data/ext/ice/cpp/include/generated/IceSSL/ConnectionInfo.h +223 -0
  191. data/ext/ice/cpp/include/generated/IceSSL/ConnectionInfoF.h +101 -0
  192. data/ext/ice/cpp/include/generated/IceSSL/EndpointInfo.h +181 -0
  193. data/ext/ice/cpp/src/Ice/ACM.cpp +38 -27
  194. data/ext/ice/cpp/src/Ice/ACM.h +9 -7
  195. data/ext/ice/cpp/src/Ice/ACMF.h +30 -0
  196. data/ext/ice/cpp/src/Ice/Acceptor.cpp +6 -6
  197. data/ext/ice/cpp/src/Ice/Acceptor.h +4 -8
  198. data/ext/ice/cpp/src/Ice/AcceptorF.h +1 -6
  199. data/ext/ice/cpp/src/Ice/ArgVector.cpp +59 -0
  200. data/ext/ice/cpp/src/Ice/ArgVector.h +36 -0
  201. data/ext/ice/cpp/src/Ice/AsyncResult.cpp +15 -544
  202. data/ext/ice/cpp/src/Ice/Base64.cpp +22 -28
  203. data/ext/ice/cpp/src/Ice/Base64.h +1 -6
  204. data/ext/ice/cpp/src/Ice/BatchRequestQueue.cpp +41 -18
  205. data/ext/ice/cpp/src/Ice/BatchRequestQueue.h +15 -15
  206. data/ext/ice/cpp/src/Ice/Buffer.cpp +75 -18
  207. data/ext/ice/cpp/src/Ice/BuiltinSequences.cpp +21 -12
  208. data/ext/ice/cpp/src/Ice/CollocatedRequestHandler.cpp +86 -197
  209. data/ext/ice/cpp/src/Ice/CollocatedRequestHandler.h +17 -23
  210. data/ext/ice/cpp/src/Ice/Communicator.cpp +43 -15
  211. data/ext/ice/cpp/src/Ice/CommunicatorF.cpp +28 -11
  212. data/ext/ice/cpp/src/Ice/CommunicatorI.cpp +318 -117
  213. data/ext/ice/cpp/src/Ice/CommunicatorI.h +95 -40
  214. data/ext/ice/cpp/src/{IceUtil → Ice}/Cond.cpp +3 -8
  215. data/ext/ice/cpp/src/Ice/ConnectRequestHandler.cpp +55 -122
  216. data/ext/ice/cpp/src/Ice/ConnectRequestHandler.h +15 -31
  217. data/ext/ice/cpp/src/Ice/ConnectRequestHandlerF.h +6 -7
  218. data/ext/ice/cpp/src/Ice/Connection.cpp +111 -20
  219. data/ext/ice/cpp/src/Ice/ConnectionF.cpp +28 -11
  220. data/ext/ice/cpp/src/Ice/ConnectionFactory.cpp +300 -107
  221. data/ext/ice/cpp/src/Ice/ConnectionFactory.h +44 -28
  222. data/ext/ice/cpp/src/Ice/ConnectionFactoryF.h +30 -0
  223. data/ext/ice/cpp/src/Ice/ConnectionI.cpp +785 -713
  224. data/ext/ice/cpp/src/Ice/ConnectionI.h +105 -80
  225. data/ext/ice/cpp/src/Ice/ConnectionRequestHandler.cpp +2 -20
  226. data/ext/ice/cpp/src/Ice/ConnectionRequestHandler.h +5 -9
  227. data/ext/ice/cpp/src/Ice/Connector.cpp +6 -6
  228. data/ext/ice/cpp/src/Ice/Connector.h +4 -8
  229. data/ext/ice/cpp/src/Ice/ConnectorF.h +1 -6
  230. data/ext/ice/cpp/src/{IceUtil → Ice}/CountDownLatch.cpp +4 -9
  231. data/ext/ice/cpp/src/Ice/Current.cpp +30 -12
  232. data/ext/ice/cpp/src/Ice/DefaultsAndOverrides.cpp +10 -16
  233. data/ext/ice/cpp/src/Ice/DefaultsAndOverrides.h +1 -6
  234. data/ext/ice/cpp/src/Ice/DefaultsAndOverridesF.h +1 -6
  235. data/ext/ice/cpp/src/Ice/DispatchInterceptor.cpp +13 -25
  236. data/ext/ice/cpp/src/Ice/DynamicLibrary.cpp +34 -28
  237. data/ext/ice/cpp/src/Ice/Endpoint.cpp +107 -19
  238. data/ext/ice/cpp/src/Ice/EndpointF.cpp +28 -11
  239. data/ext/ice/cpp/src/Ice/EndpointFactory.cpp +152 -6
  240. data/ext/ice/cpp/src/Ice/EndpointFactory.h +72 -11
  241. data/ext/ice/cpp/src/Ice/EndpointFactoryF.h +1 -6
  242. data/ext/ice/cpp/src/Ice/EndpointFactoryManager.cpp +41 -36
  243. data/ext/ice/cpp/src/Ice/EndpointFactoryManager.h +10 -9
  244. data/ext/ice/cpp/src/Ice/EndpointFactoryManagerF.h +1 -6
  245. data/ext/ice/cpp/src/Ice/EndpointI.cpp +18 -7
  246. data/ext/ice/cpp/src/Ice/EndpointI.h +39 -18
  247. data/ext/ice/cpp/src/Ice/EndpointIF.h +18 -10
  248. data/ext/ice/cpp/src/Ice/EndpointTypes.cpp +19 -12
  249. data/ext/ice/cpp/src/Ice/EventHandler.cpp +6 -9
  250. data/ext/ice/cpp/src/Ice/EventHandler.h +13 -13
  251. data/ext/ice/cpp/src/Ice/EventHandlerF.h +5 -7
  252. data/ext/ice/cpp/src/Ice/Exception.cpp +102 -98
  253. data/ext/ice/cpp/src/Ice/FacetMap.cpp +21 -12
  254. data/ext/ice/cpp/src/Ice/FactoryTable.cpp +37 -33
  255. data/ext/ice/cpp/src/Ice/FactoryTableInit.cpp +2 -9
  256. data/ext/ice/cpp/src/Ice/GCObject.cpp +29 -31
  257. data/ext/ice/cpp/src/Ice/HashUtil.h +3 -9
  258. data/ext/ice/cpp/src/Ice/HttpParser.cpp +1 -7
  259. data/ext/ice/cpp/src/Ice/HttpParser.h +1 -6
  260. data/ext/ice/cpp/src/Ice/IPEndpointI.cpp +128 -111
  261. data/ext/ice/cpp/src/Ice/IPEndpointI.h +23 -19
  262. data/ext/ice/cpp/src/Ice/IPEndpointIF.h +6 -7
  263. data/ext/ice/cpp/src/Ice/IconvStringConverter.cpp +51 -0
  264. data/ext/ice/cpp/src/Ice/Identity.cpp +25 -16
  265. data/ext/ice/cpp/src/Ice/ImplicitContext.cpp +41 -13
  266. data/ext/ice/cpp/src/Ice/ImplicitContextF.cpp +28 -11
  267. data/ext/ice/cpp/src/Ice/ImplicitContextI.cpp +11 -28
  268. data/ext/ice/cpp/src/Ice/ImplicitContextI.h +7 -10
  269. data/ext/ice/cpp/src/Ice/Incoming.cpp +284 -255
  270. data/ext/ice/cpp/src/Ice/IncomingAsync.cpp +104 -214
  271. data/ext/ice/cpp/src/Ice/IncomingRequest.h +5 -9
  272. data/ext/ice/cpp/src/Ice/Initialize.cpp +309 -193
  273. data/ext/ice/cpp/src/Ice/InputStream.cpp +2726 -0
  274. data/ext/ice/cpp/src/Ice/Instance.cpp +243 -262
  275. data/ext/ice/cpp/src/Ice/Instance.h +30 -23
  276. data/ext/ice/cpp/src/Ice/Instrumentation.cpp +137 -23
  277. data/ext/ice/cpp/src/Ice/InstrumentationF.cpp +28 -11
  278. data/ext/ice/cpp/src/Ice/InstrumentationI.cpp +118 -105
  279. data/ext/ice/cpp/src/Ice/InstrumentationI.h +30 -36
  280. data/ext/ice/cpp/src/Ice/LocalException.cpp +1191 -422
  281. data/ext/ice/cpp/src/Ice/LocalObject.cpp +1 -7
  282. data/ext/ice/cpp/src/Ice/Locator.cpp +1282 -1222
  283. data/ext/ice/cpp/src/Ice/LocatorF.cpp +30 -12
  284. data/ext/ice/cpp/src/Ice/LocatorInfo.cpp +150 -186
  285. data/ext/ice/cpp/src/Ice/LocatorInfo.h +31 -36
  286. data/ext/ice/cpp/src/Ice/LocatorInfoF.h +1 -6
  287. data/ext/ice/cpp/src/Ice/Logger.cpp +39 -12
  288. data/ext/ice/cpp/src/Ice/LoggerAdminI.cpp +182 -88
  289. data/ext/ice/cpp/src/Ice/LoggerAdminI.h +4 -9
  290. data/ext/ice/cpp/src/Ice/LoggerF.cpp +28 -11
  291. data/ext/ice/cpp/src/Ice/LoggerI.cpp +26 -55
  292. data/ext/ice/cpp/src/Ice/LoggerI.h +7 -18
  293. data/ext/ice/cpp/src/Ice/LoggerUtil.cpp +10 -17
  294. data/ext/ice/cpp/src/Ice/Metrics.cpp +1280 -1107
  295. data/ext/ice/cpp/src/Ice/MetricsAdminI.cpp +58 -33
  296. data/ext/ice/cpp/src/Ice/MetricsObserverI.cpp +1 -7
  297. data/ext/ice/cpp/src/Ice/Network.cpp +753 -408
  298. data/ext/ice/cpp/src/Ice/Network.h +99 -36
  299. data/ext/ice/cpp/src/Ice/NetworkF.h +2 -7
  300. data/ext/ice/cpp/src/Ice/NetworkProxy.cpp +20 -19
  301. data/ext/ice/cpp/src/Ice/NetworkProxy.h +5 -7
  302. data/ext/ice/cpp/src/Ice/NetworkProxyF.h +1 -6
  303. data/ext/ice/cpp/src/Ice/OSLogLoggerI.cpp +57 -0
  304. data/ext/ice/cpp/src/Ice/OSLogLoggerI.h +40 -0
  305. data/ext/ice/cpp/src/Ice/Object.cpp +227 -232
  306. data/ext/ice/cpp/src/Ice/ObjectAdapter.cpp +45 -13
  307. data/ext/ice/cpp/src/Ice/ObjectAdapterF.cpp +28 -11
  308. data/ext/ice/cpp/src/Ice/ObjectAdapterFactory.cpp +83 -33
  309. data/ext/ice/cpp/src/Ice/ObjectAdapterFactory.h +13 -12
  310. data/ext/ice/cpp/src/Ice/ObjectAdapterFactoryF.h +25 -0
  311. data/ext/ice/cpp/src/Ice/ObjectAdapterI.cpp +298 -191
  312. data/ext/ice/cpp/src/Ice/ObjectAdapterI.h +44 -39
  313. data/ext/ice/cpp/src/Ice/ObjectFactory.cpp +41 -13
  314. data/ext/ice/cpp/src/Ice/ObserverHelper.cpp +9 -37
  315. data/ext/ice/cpp/src/Ice/OpaqueEndpointI.cpp +67 -67
  316. data/ext/ice/cpp/src/Ice/OpaqueEndpointI.h +15 -11
  317. data/ext/ice/cpp/src/Ice/OutgoingAsync.cpp +801 -366
  318. data/ext/ice/cpp/src/Ice/OutputStream.cpp +1367 -0
  319. data/ext/ice/cpp/src/Ice/Plugin.cpp +52 -14
  320. data/ext/ice/cpp/src/Ice/PluginF.cpp +28 -11
  321. data/ext/ice/cpp/src/Ice/PluginManagerI.cpp +27 -51
  322. data/ext/ice/cpp/src/Ice/PluginManagerI.h +7 -13
  323. data/ext/ice/cpp/src/Ice/Process.cpp +294 -128
  324. data/ext/ice/cpp/src/Ice/ProcessF.cpp +30 -12
  325. data/ext/ice/cpp/src/Ice/Properties.cpp +42 -15
  326. data/ext/ice/cpp/src/Ice/PropertiesAdmin.cpp +382 -340
  327. data/ext/ice/cpp/src/Ice/PropertiesAdminI.cpp +83 -24
  328. data/ext/ice/cpp/src/Ice/PropertiesAdminI.h +29 -10
  329. data/ext/ice/cpp/src/Ice/PropertiesF.cpp +30 -12
  330. data/ext/ice/cpp/src/Ice/PropertiesI.cpp +46 -57
  331. data/ext/ice/cpp/src/Ice/PropertiesI.h +18 -26
  332. data/ext/ice/cpp/src/Ice/PropertyNames.cpp +112 -19
  333. data/ext/ice/cpp/src/Ice/PropertyNames.h +4 -7
  334. data/ext/ice/cpp/src/Ice/Protocol.cpp +6 -19
  335. data/ext/ice/cpp/src/Ice/ProtocolInstance.cpp +37 -7
  336. data/ext/ice/cpp/src/Ice/ProtocolInstance.h +9 -25
  337. data/ext/ice/cpp/src/Ice/ProtocolInstanceF.h +1 -6
  338. data/ext/ice/cpp/src/Ice/ProtocolPluginFacade.cpp +6 -6
  339. data/ext/ice/cpp/src/Ice/ProtocolPluginFacade.h +3 -6
  340. data/ext/ice/cpp/src/Ice/ProtocolPluginFacadeF.h +1 -6
  341. data/ext/ice/cpp/src/Ice/Proxy.cpp +729 -957
  342. data/ext/ice/cpp/src/Ice/ProxyFactory.cpp +33 -38
  343. data/ext/ice/cpp/src/Ice/ProxyFactory.h +16 -16
  344. data/ext/ice/cpp/src/Ice/Reference.cpp +190 -106
  345. data/ext/ice/cpp/src/Ice/Reference.h +39 -28
  346. data/ext/ice/cpp/src/Ice/ReferenceFactory.cpp +69 -118
  347. data/ext/ice/cpp/src/Ice/ReferenceFactory.h +12 -17
  348. data/ext/ice/cpp/src/Ice/ReferenceFactoryF.h +1 -6
  349. data/ext/ice/cpp/src/Ice/RegisterPluginsInit.cpp +19 -9
  350. data/ext/ice/cpp/src/Ice/RegisterPluginsInit.h +1 -6
  351. data/ext/ice/cpp/src/Ice/RemoteLogger.cpp +766 -565
  352. data/ext/ice/cpp/src/Ice/ReplyStatus.h +1 -6
  353. data/ext/ice/cpp/src/Ice/RequestHandler.cpp +5 -8
  354. data/ext/ice/cpp/src/Ice/RequestHandler.h +10 -18
  355. data/ext/ice/cpp/src/Ice/RequestHandlerFactory.cpp +10 -11
  356. data/ext/ice/cpp/src/Ice/RequestHandlerFactory.h +2 -7
  357. data/ext/ice/cpp/src/Ice/ResponseHandler.cpp +3 -11
  358. data/ext/ice/cpp/src/Ice/ResponseHandler.h +16 -12
  359. data/ext/ice/cpp/src/Ice/RetryQueue.cpp +12 -20
  360. data/ext/ice/cpp/src/Ice/RetryQueue.h +7 -11
  361. data/ext/ice/cpp/src/Ice/RetryQueueF.h +1 -6
  362. data/ext/ice/cpp/src/Ice/Router.cpp +614 -492
  363. data/ext/ice/cpp/src/Ice/RouterF.cpp +30 -12
  364. data/ext/ice/cpp/src/Ice/RouterInfo.cpp +93 -99
  365. data/ext/ice/cpp/src/Ice/RouterInfo.h +42 -38
  366. data/ext/ice/cpp/src/Ice/RouterInfoF.h +1 -6
  367. data/ext/ice/cpp/src/{IceUtil → Ice}/SHA1.cpp +23 -28
  368. data/ext/ice/cpp/src/Ice/Selector.cpp +948 -855
  369. data/ext/ice/cpp/src/Ice/Selector.h +100 -152
  370. data/ext/ice/cpp/src/Ice/ServantLocator.cpp +41 -13
  371. data/ext/ice/cpp/src/Ice/ServantLocatorF.cpp +28 -11
  372. data/ext/ice/cpp/src/Ice/ServantManager.cpp +24 -45
  373. data/ext/ice/cpp/src/Ice/ServantManager.h +1 -6
  374. data/ext/ice/cpp/src/Ice/SharedContext.h +2 -7
  375. data/ext/ice/cpp/src/Ice/SliceChecksumDict.cpp +21 -12
  376. data/ext/ice/cpp/src/Ice/SliceChecksums.cpp +2 -7
  377. data/ext/ice/cpp/src/Ice/SlicedData.cpp +72 -25
  378. data/ext/ice/cpp/src/Ice/StreamSocket.cpp +208 -76
  379. data/ext/ice/cpp/src/Ice/StreamSocket.h +13 -9
  380. data/ext/ice/cpp/src/Ice/StringConverterPlugin.cpp +57 -22
  381. data/ext/ice/cpp/src/Ice/StringUtil.h +30 -0
  382. data/ext/ice/cpp/src/Ice/SysLoggerI.cpp +6 -7
  383. data/ext/ice/cpp/src/Ice/SysLoggerI.h +2 -8
  384. data/ext/ice/cpp/src/Ice/SystemdJournalI.cpp +66 -0
  385. data/ext/ice/cpp/src/Ice/SystemdJournalI.h +39 -0
  386. data/ext/ice/cpp/src/Ice/TcpAcceptor.cpp +169 -49
  387. data/ext/ice/cpp/src/Ice/TcpAcceptor.h +12 -10
  388. data/ext/ice/cpp/src/Ice/TcpConnector.cpp +6 -12
  389. data/ext/ice/cpp/src/Ice/TcpConnector.h +1 -7
  390. data/ext/ice/cpp/src/Ice/TcpEndpointI.cpp +51 -46
  391. data/ext/ice/cpp/src/Ice/TcpEndpointI.h +12 -14
  392. data/ext/ice/cpp/src/Ice/TcpTransceiver.cpp +17 -32
  393. data/ext/ice/cpp/src/Ice/TcpTransceiver.h +7 -15
  394. data/ext/ice/cpp/src/{IceUtil → Ice}/Thread.cpp +41 -54
  395. data/ext/ice/cpp/src/Ice/ThreadPool.cpp +242 -274
  396. data/ext/ice/cpp/src/Ice/ThreadPool.h +46 -48
  397. data/ext/ice/cpp/src/{IceUtil → Ice}/Timer.cpp +38 -26
  398. data/ext/ice/cpp/src/Ice/TraceLevels.cpp +2 -7
  399. data/ext/ice/cpp/src/Ice/TraceLevels.h +1 -6
  400. data/ext/ice/cpp/src/Ice/TraceLevelsF.h +2 -7
  401. data/ext/ice/cpp/src/Ice/TraceUtil.cpp +53 -36
  402. data/ext/ice/cpp/src/Ice/TraceUtil.h +13 -11
  403. data/ext/ice/cpp/src/Ice/Transceiver.cpp +1 -7
  404. data/ext/ice/cpp/src/Ice/Transceiver.h +8 -12
  405. data/ext/ice/cpp/src/Ice/TransceiverF.h +3 -8
  406. data/ext/ice/cpp/src/Ice/UdpConnector.cpp +5 -13
  407. data/ext/ice/cpp/src/Ice/UdpConnector.h +1 -7
  408. data/ext/ice/cpp/src/Ice/UdpEndpointI.cpp +118 -60
  409. data/ext/ice/cpp/src/Ice/UdpEndpointI.h +13 -10
  410. data/ext/ice/cpp/src/Ice/UdpTransceiver.cpp +177 -236
  411. data/ext/ice/cpp/src/Ice/UdpTransceiver.h +15 -22
  412. data/ext/ice/cpp/src/Ice/Value.cpp +76 -0
  413. data/ext/ice/cpp/src/Ice/ValueFactory.cpp +83 -0
  414. data/ext/ice/cpp/src/Ice/ValueFactoryManagerI.cpp +61 -0
  415. data/ext/ice/cpp/src/Ice/ValueFactoryManagerI.h +37 -0
  416. data/ext/ice/cpp/src/Ice/Version.cpp +25 -20
  417. data/ext/ice/cpp/src/Ice/VirtualShared.h +38 -0
  418. data/ext/ice/cpp/src/Ice/WSAcceptor.cpp +3 -14
  419. data/ext/ice/cpp/src/Ice/WSAcceptor.h +3 -12
  420. data/ext/ice/cpp/src/Ice/WSConnector.cpp +5 -16
  421. data/ext/ice/cpp/src/Ice/WSConnector.h +3 -11
  422. data/ext/ice/cpp/src/Ice/WSEndpoint.cpp +188 -89
  423. data/ext/ice/cpp/src/Ice/WSEndpoint.h +22 -37
  424. data/ext/ice/cpp/src/Ice/WSTransceiver.cpp +65 -66
  425. data/ext/ice/cpp/src/Ice/WSTransceiver.h +7 -27
  426. data/ext/ice/cpp/src/IceDiscovery/IceDiscovery.cpp +596 -281
  427. data/ext/ice/cpp/src/IceDiscovery/IceDiscovery.h +1383 -543
  428. data/ext/ice/cpp/src/IceDiscovery/LocatorI.cpp +89 -32
  429. data/ext/ice/cpp/src/IceDiscovery/LocatorI.h +59 -28
  430. data/ext/ice/cpp/src/IceDiscovery/LookupI.cpp +315 -66
  431. data/ext/ice/cpp/src/IceDiscovery/LookupI.h +83 -41
  432. data/ext/ice/cpp/src/IceDiscovery/PluginI.cpp +57 -64
  433. data/ext/ice/cpp/src/IceDiscovery/PluginI.h +3 -8
  434. data/ext/ice/cpp/src/IceLocatorDiscovery/IceLocatorDiscovery.cpp +450 -172
  435. data/ext/ice/cpp/src/IceLocatorDiscovery/IceLocatorDiscovery.h +863 -406
  436. data/ext/ice/cpp/src/IceLocatorDiscovery/Plugin.h +47 -0
  437. data/ext/ice/cpp/src/IceLocatorDiscovery/PluginI.cpp +636 -144
  438. data/ext/ice/cpp/src/IceSSL/AcceptorI.cpp +20 -173
  439. data/ext/ice/cpp/src/IceSSL/AcceptorI.h +8 -22
  440. data/ext/ice/cpp/src/IceSSL/CertificateI.cpp +279 -0
  441. data/ext/ice/cpp/src/IceSSL/CertificateI.h +64 -0
  442. data/ext/ice/cpp/src/IceSSL/ConnectionInfo.cpp +42 -17
  443. data/ext/ice/cpp/src/IceSSL/ConnectionInfoF.cpp +61 -0
  444. data/ext/ice/cpp/src/IceSSL/ConnectorI.cpp +15 -64
  445. data/ext/ice/cpp/src/IceSSL/ConnectorI.h +6 -18
  446. data/ext/ice/cpp/src/IceSSL/EndpointI.cpp +207 -204
  447. data/ext/ice/cpp/src/IceSSL/EndpointI.h +43 -40
  448. data/ext/ice/cpp/src/IceSSL/EndpointInfo.cpp +42 -16
  449. data/ext/ice/cpp/src/IceSSL/Instance.cpp +1 -11
  450. data/ext/ice/cpp/src/IceSSL/Instance.h +7 -12
  451. data/ext/ice/cpp/src/IceSSL/InstanceF.h +11 -12
  452. data/ext/ice/cpp/src/IceSSL/OpenSSLCertificateI.cpp +583 -0
  453. data/ext/ice/cpp/src/IceSSL/OpenSSLEngine.cpp +134 -115
  454. data/ext/ice/cpp/src/IceSSL/OpenSSLEngine.h +59 -0
  455. data/ext/ice/cpp/src/IceSSL/OpenSSLEngineF.h +27 -0
  456. data/ext/ice/cpp/src/IceSSL/OpenSSLPluginI.cpp +127 -0
  457. data/ext/ice/cpp/src/IceSSL/OpenSSLTransceiverI.cpp +477 -182
  458. data/ext/ice/cpp/src/IceSSL/OpenSSLTransceiverI.h +32 -26
  459. data/ext/ice/cpp/src/IceSSL/OpenSSLUtil.cpp +286 -0
  460. data/ext/ice/cpp/src/IceSSL/OpenSSLUtil.h +58 -0
  461. data/ext/ice/cpp/src/IceSSL/PluginI.cpp +71 -46
  462. data/ext/ice/cpp/src/IceSSL/PluginI.h +13 -23
  463. data/ext/ice/cpp/src/IceSSL/RFC2253.cpp +9 -60
  464. data/ext/ice/cpp/src/IceSSL/RFC2253.h +7 -12
  465. data/ext/ice/cpp/src/IceSSL/SChannelCertificateI.cpp +580 -0
  466. data/ext/ice/cpp/src/IceSSL/SChannelEngine.cpp +523 -74
  467. data/ext/ice/cpp/src/IceSSL/SChannelEngine.h +123 -0
  468. data/ext/ice/cpp/src/IceSSL/SChannelEngineF.h +31 -0
  469. data/ext/ice/cpp/src/IceSSL/SChannelPluginI.cpp +73 -0
  470. data/ext/ice/cpp/src/IceSSL/SChannelTransceiverI.cpp +187 -221
  471. data/ext/ice/cpp/src/IceSSL/SChannelTransceiverI.h +24 -26
  472. data/ext/ice/cpp/src/IceSSL/SSLEngine.cpp +97 -94
  473. data/ext/ice/cpp/src/IceSSL/SSLEngine.h +26 -192
  474. data/ext/ice/cpp/src/IceSSL/SSLEngineF.h +4 -24
  475. data/ext/ice/cpp/src/IceSSL/SecureTransportCertificateI.cpp +868 -0
  476. data/ext/ice/cpp/src/IceSSL/SecureTransportEngine.cpp +69 -201
  477. data/ext/ice/cpp/src/IceSSL/SecureTransportEngine.h +59 -0
  478. data/ext/ice/cpp/src/IceSSL/SecureTransportEngineF.h +29 -0
  479. data/ext/ice/cpp/src/IceSSL/SecureTransportPluginI.cpp +75 -0
  480. data/ext/ice/cpp/src/IceSSL/SecureTransportTransceiverI.cpp +174 -161
  481. data/ext/ice/cpp/src/IceSSL/SecureTransportTransceiverI.h +29 -33
  482. data/ext/ice/cpp/src/IceSSL/SecureTransportUtil.cpp +864 -0
  483. data/ext/ice/cpp/src/IceSSL/SecureTransportUtil.h +45 -0
  484. data/ext/ice/cpp/src/IceSSL/TrustManager.cpp +12 -22
  485. data/ext/ice/cpp/src/IceSSL/TrustManager.h +4 -9
  486. data/ext/ice/cpp/src/IceSSL/TrustManagerF.h +3 -8
  487. data/ext/ice/cpp/src/IceSSL/UWPCertificateI.cpp +266 -0
  488. data/ext/ice/cpp/src/IceSSL/UWPEngine.cpp +338 -0
  489. data/ext/ice/cpp/src/IceSSL/UWPEngine.h +41 -0
  490. data/ext/ice/cpp/src/IceSSL/UWPEngineF.h +26 -0
  491. data/ext/ice/cpp/src/IceSSL/UWPPluginI.cpp +89 -0
  492. data/ext/ice/cpp/src/IceSSL/UWPTransceiverI.cpp +383 -0
  493. data/ext/ice/cpp/src/IceSSL/UWPTransceiverI.h +71 -0
  494. data/ext/ice/cpp/src/IceSSL/Util.cpp +71 -1260
  495. data/ext/ice/cpp/src/IceSSL/Util.h +48 -142
  496. data/ext/ice/cpp/src/IceUtil/ConsoleUtil.cpp +157 -0
  497. data/ext/ice/cpp/src/IceUtil/ConvertUTF.cpp +22 -27
  498. data/ext/ice/cpp/src/IceUtil/ConvertUTF.h +34 -31
  499. data/ext/ice/cpp/src/IceUtil/CtrlCHandler.cpp +22 -36
  500. data/ext/ice/cpp/src/IceUtil/FileUtil.cpp +30 -126
  501. data/ext/ice/cpp/src/IceUtil/InputUtil.cpp +1 -6
  502. data/ext/ice/cpp/src/IceUtil/MutexProtocol.cpp +1 -6
  503. data/ext/ice/cpp/src/IceUtil/Options.cpp +20 -33
  504. data/ext/ice/cpp/src/IceUtil/OutputUtil.cpp +47 -21
  505. data/ext/ice/cpp/src/IceUtil/Random.cpp +15 -20
  506. data/ext/ice/cpp/src/IceUtil/RecMutex.cpp +4 -19
  507. data/ext/ice/cpp/src/IceUtil/Shared.cpp +8 -8
  508. data/ext/ice/cpp/src/IceUtil/StringConverter.cpp +501 -269
  509. data/ext/ice/cpp/src/IceUtil/StringUtil.cpp +582 -244
  510. data/ext/ice/cpp/src/IceUtil/ThreadException.cpp +37 -79
  511. data/ext/ice/cpp/src/IceUtil/Time.cpp +6 -11
  512. data/ext/ice/cpp/src/IceUtil/UUID.cpp +17 -22
  513. data/ext/ice/cpp/src/IceUtil/Unicode.cpp +97 -101
  514. data/ext/ice/cpp/src/IceUtil/Unicode.h +21 -40
  515. data/ext/ice/cpp/src/IceUtil/UtilException.cpp +839 -0
  516. data/ext/ice/cpp/src/Slice/CPlusPlusUtil.cpp +894 -234
  517. data/ext/ice/cpp/src/Slice/CPlusPlusUtil.h +72 -0
  518. data/ext/ice/cpp/src/Slice/Checksum.cpp +2 -7
  519. data/ext/ice/cpp/src/Slice/Checksum.h +21 -0
  520. data/ext/ice/cpp/src/Slice/FileTracker.cpp +25 -83
  521. data/ext/ice/cpp/{include → src}/Slice/FileTracker.h +9 -14
  522. data/ext/ice/cpp/src/Slice/Grammar.cpp +1981 -1944
  523. data/ext/ice/cpp/src/Slice/Grammar.h +39 -19
  524. data/ext/ice/cpp/src/Slice/GrammarUtil.h +14 -20
  525. data/ext/ice/cpp/src/Slice/JavaUtil.cpp +2752 -1948
  526. data/ext/ice/cpp/src/Slice/JavaUtil.h +398 -0
  527. data/ext/ice/cpp/src/Slice/MD5.cpp +1 -6
  528. data/ext/ice/cpp/src/Slice/MD5.h +1 -6
  529. data/ext/ice/cpp/src/Slice/MD5I.cpp +8 -1
  530. data/ext/ice/cpp/src/Slice/MD5I.h +1 -1
  531. data/ext/ice/cpp/src/Slice/PHPUtil.cpp +17 -20
  532. data/ext/ice/cpp/src/Slice/PHPUtil.h +36 -0
  533. data/ext/ice/cpp/src/Slice/Parser.cpp +1190 -426
  534. data/ext/ice/cpp/{include → src}/Slice/Parser.h +143 -91
  535. data/ext/ice/cpp/src/Slice/Preprocessor.cpp +67 -36
  536. data/ext/ice/cpp/{include → src}/Slice/Preprocessor.h +8 -18
  537. data/ext/ice/cpp/src/Slice/Python.cpp +218 -111
  538. data/ext/ice/cpp/src/Slice/PythonUtil.cpp +787 -699
  539. data/ext/ice/cpp/src/Slice/PythonUtil.h +70 -0
  540. data/ext/ice/cpp/src/Slice/Ruby.cpp +42 -43
  541. data/ext/ice/cpp/src/Slice/RubyUtil.cpp +175 -445
  542. data/ext/ice/cpp/{include → src}/Slice/RubyUtil.h +6 -11
  543. data/ext/ice/cpp/src/Slice/Scanner.cpp +390 -399
  544. data/ext/ice/cpp/src/Slice/{Util.cpp → SliceUtil.cpp} +36 -69
  545. data/ext/ice/cpp/src/Slice/StringLiteralUtil.cpp +456 -0
  546. data/ext/ice/cpp/src/Slice/Util.h +50 -0
  547. data/ice.gemspec +2 -9
  548. data/lib/Glacier2.rb +1 -6
  549. data/lib/Glacier2/Metrics.rb +6 -50
  550. data/lib/Glacier2/PermissionsVerifier.rb +23 -99
  551. data/lib/Glacier2/PermissionsVerifierF.rb +2 -7
  552. data/lib/Glacier2/Router.rb +31 -78
  553. data/lib/Glacier2/RouterF.rb +2 -7
  554. data/lib/Glacier2/SSLInfo.rb +3 -11
  555. data/lib/Glacier2/Session.rb +87 -311
  556. data/lib/Ice.rb +84 -58
  557. data/lib/Ice/BuiltinSequences.rb +3 -8
  558. data/lib/Ice/Communicator.rb +54 -61
  559. data/lib/Ice/CommunicatorF.rb +2 -7
  560. data/lib/Ice/Connection.rb +152 -166
  561. data/lib/Ice/ConnectionF.rb +2 -7
  562. data/lib/Ice/Current.rb +3 -15
  563. data/lib/Ice/Endpoint.rb +56 -137
  564. data/lib/Ice/EndpointF.rb +2 -7
  565. data/lib/Ice/EndpointTypes.rb +2 -11
  566. data/lib/Ice/FacetMap.rb +3 -8
  567. data/lib/Ice/Identity.rb +4 -12
  568. data/lib/Ice/ImplicitContext.rb +4 -38
  569. data/lib/Ice/ImplicitContextF.rb +2 -7
  570. data/lib/Ice/Instrumentation.rb +22 -279
  571. data/lib/Ice/InstrumentationF.rb +2 -7
  572. data/lib/Ice/LocalException.rb +94 -145
  573. data/lib/Ice/Locator.rb +50 -169
  574. data/lib/Ice/LocatorF.rb +2 -7
  575. data/lib/Ice/Logger.rb +4 -38
  576. data/lib/Ice/LoggerF.rb +2 -7
  577. data/lib/Ice/Metrics.rb +60 -420
  578. data/lib/Ice/ObjectAdapter.rb +29 -0
  579. data/lib/Ice/ObjectAdapterF.rb +2 -7
  580. data/lib/Ice/ObjectFactory.rb +4 -34
  581. data/lib/Ice/Plugin.rb +6 -64
  582. data/lib/Ice/PluginF.rb +2 -7
  583. data/lib/Ice/Process.rb +15 -56
  584. data/lib/Ice/ProcessF.rb +2 -7
  585. data/lib/Ice/Properties.rb +4 -45
  586. data/lib/Ice/PropertiesAdmin.rb +18 -60
  587. data/lib/Ice/PropertiesF.rb +2 -7
  588. data/lib/Ice/RemoteLogger.rb +33 -119
  589. data/lib/Ice/Router.rb +28 -105
  590. data/lib/Ice/RouterF.rb +2 -7
  591. data/lib/Ice/ServantLocator.rb +26 -0
  592. data/lib/Ice/ServantLocatorF.rb +24 -0
  593. data/lib/Ice/SliceChecksumDict.rb +2 -7
  594. data/lib/Ice/ValueFactory.rb +28 -0
  595. data/lib/Ice/Version.rb +4 -15
  596. data/lib/IceBox.rb +1 -6
  597. data/lib/IceBox/IceBox.rb +43 -152
  598. data/lib/IceGrid.rb +1 -9
  599. data/lib/IceGrid/Admin.rb +550 -431
  600. data/lib/IceGrid/Descriptor.rb +61 -533
  601. data/lib/IceGrid/Exception.rb +23 -49
  602. data/lib/IceGrid/FileParser.rb +13 -54
  603. data/lib/IceGrid/PluginFacade.rb +35 -0
  604. data/lib/IceGrid/Registry.rb +150 -62
  605. data/lib/IceGrid/Session.rb +24 -68
  606. data/lib/IceGrid/UserAccountMapper.rb +13 -54
  607. data/lib/IcePatch2.rb +1 -6
  608. data/lib/IcePatch2/FileInfo.rb +4 -15
  609. data/lib/IcePatch2/FileServer.rb +32 -80
  610. data/lib/IceStorm.rb +1 -6
  611. data/lib/IceStorm/IceStorm.rb +78 -210
  612. data/lib/IceStorm/Metrics.rb +10 -93
  613. data/slice/Glacier2/Metrics.ice +20 -10
  614. data/slice/Glacier2/PermissionsVerifier.ice +19 -12
  615. data/slice/Glacier2/PermissionsVerifierF.ice +16 -9
  616. data/slice/Glacier2/Router.ice +19 -13
  617. data/slice/Glacier2/RouterF.ice +16 -9
  618. data/slice/Glacier2/SSLInfo.ice +17 -10
  619. data/slice/Glacier2/Session.ice +24 -18
  620. data/slice/Ice/BuiltinSequences.ice +18 -9
  621. data/slice/Ice/Communicator.ice +180 -64
  622. data/slice/Ice/CommunicatorF.ice +18 -9
  623. data/slice/Ice/Connection.ice +208 -75
  624. data/slice/Ice/ConnectionF.ice +18 -9
  625. data/slice/Ice/Current.ice +37 -28
  626. data/slice/Ice/Endpoint.ice +73 -21
  627. data/slice/Ice/EndpointF.ice +19 -10
  628. data/slice/Ice/EndpointTypes.ice +21 -13
  629. data/slice/Ice/FacetMap.ice +19 -10
  630. data/slice/Ice/Identity.ice +24 -10
  631. data/slice/Ice/ImplicitContext.ice +41 -33
  632. data/slice/Ice/ImplicitContextF.ice +17 -9
  633. data/slice/Ice/Instrumentation.ice +37 -30
  634. data/slice/Ice/InstrumentationF.ice +19 -10
  635. data/slice/Ice/LocalException.ice +118 -112
  636. data/slice/Ice/Locator.ice +28 -21
  637. data/slice/Ice/LocatorF.ice +18 -9
  638. data/slice/Ice/Logger.ice +26 -18
  639. data/slice/Ice/LoggerF.ice +18 -9
  640. data/slice/Ice/Metrics.ice +42 -30
  641. data/slice/Ice/ObjectAdapter.ice +88 -53
  642. data/slice/Ice/ObjectAdapterF.ice +18 -9
  643. data/slice/Ice/ObjectFactory.ice +28 -17
  644. data/slice/Ice/Plugin.ice +25 -13
  645. data/slice/Ice/PluginF.ice +22 -9
  646. data/slice/Ice/Process.ice +20 -11
  647. data/slice/Ice/ProcessF.ice +18 -9
  648. data/slice/Ice/Properties.ice +42 -28
  649. data/slice/Ice/PropertiesAdmin.ice +20 -10
  650. data/slice/Ice/PropertiesF.ice +18 -9
  651. data/slice/Ice/RemoteLogger.ice +23 -19
  652. data/slice/Ice/Router.ice +28 -13
  653. data/slice/Ice/RouterF.ice +18 -9
  654. data/slice/Ice/ServantLocator.ice +40 -29
  655. data/slice/Ice/ServantLocatorF.ice +18 -9
  656. data/slice/Ice/SliceChecksumDict.ice +18 -9
  657. data/slice/Ice/ValueFactory.ice +132 -0
  658. data/slice/Ice/Version.ice +20 -10
  659. data/slice/IceBT/ConnectionInfo.ice +58 -0
  660. data/slice/IceBT/EndpointInfo.ice +56 -0
  661. data/slice/IceBT/Types.ice +44 -0
  662. data/slice/IceBox/IceBox.ice +45 -27
  663. data/slice/IceDiscovery/IceDiscovery.ice +75 -10
  664. data/slice/IceGrid/Admin.ice +410 -44
  665. data/slice/IceGrid/Descriptor.ice +47 -34
  666. data/slice/IceGrid/Exception.ice +43 -32
  667. data/slice/IceGrid/FileParser.ice +21 -12
  668. data/slice/IceGrid/PluginFacade.ice +26 -18
  669. data/slice/IceGrid/Registry.ice +150 -21
  670. data/slice/IceGrid/Session.ice +25 -17
  671. data/slice/IceGrid/UserAccountMapper.ice +23 -14
  672. data/slice/IceIAP/ConnectionInfo.ice +73 -0
  673. data/slice/IceIAP/EndpointInfo.ice +67 -0
  674. data/slice/IceLocatorDiscovery/IceLocatorDiscovery.ice +19 -12
  675. data/slice/IcePatch2/FileInfo.ice +19 -13
  676. data/slice/IcePatch2/FileServer.ice +27 -18
  677. data/slice/IceSSL/ConnectionInfo.ice +27 -23
  678. data/slice/IceSSL/ConnectionInfoF.ice +30 -0
  679. data/slice/IceSSL/EndpointInfo.ice +21 -36
  680. data/slice/IceStorm/IceStorm.ice +33 -24
  681. data/slice/IceStorm/Metrics.ice +19 -11
  682. metadata +148 -120
  683. data/ext/ObjectFactory.cpp +0 -140
  684. data/ext/ObjectFactory.h +0 -50
  685. data/ext/ice/cpp/include/Ice/ACMF.h +0 -30
  686. data/ext/ice/cpp/include/Ice/BasicStream.h +0 -1335
  687. data/ext/ice/cpp/include/Ice/BuiltinSequences.h +0 -82
  688. data/ext/ice/cpp/include/Ice/Communicator.h +0 -200
  689. data/ext/ice/cpp/include/Ice/Connection.h +0 -497
  690. data/ext/ice/cpp/include/Ice/ConnectionF.h +0 -74
  691. data/ext/ice/cpp/include/Ice/ConnectionFactoryF.h +0 -30
  692. data/ext/ice/cpp/include/Ice/Current.h +0 -102
  693. data/ext/ice/cpp/include/Ice/DefaultObjectFactory.h +0 -48
  694. data/ext/ice/cpp/include/Ice/DeprecatedStringConverter.h +0 -62
  695. data/ext/ice/cpp/include/Ice/Endpoint.h +0 -341
  696. data/ext/ice/cpp/include/Ice/EndpointF.h +0 -93
  697. data/ext/ice/cpp/include/Ice/EndpointTypes.h +0 -82
  698. data/ext/ice/cpp/include/Ice/Identity.h +0 -168
  699. data/ext/ice/cpp/include/Ice/ImplicitContext.h +0 -102
  700. data/ext/ice/cpp/include/Ice/Instrumentation.h +0 -365
  701. data/ext/ice/cpp/include/Ice/InstrumentationF.h +0 -75
  702. data/ext/ice/cpp/include/Ice/LocalException.h +0 -1030
  703. data/ext/ice/cpp/include/Ice/Locator.h +0 -2193
  704. data/ext/ice/cpp/include/Ice/LocatorF.h +0 -93
  705. data/ext/ice/cpp/include/Ice/Logger.h +0 -100
  706. data/ext/ice/cpp/include/Ice/Metrics.h +0 -2974
  707. data/ext/ice/cpp/include/Ice/ObjectAdapter.h +0 -168
  708. data/ext/ice/cpp/include/Ice/ObjectAdapterFactoryF.h +0 -26
  709. data/ext/ice/cpp/include/Ice/ObjectFactory.h +0 -92
  710. data/ext/ice/cpp/include/Ice/ObjectFactoryF.h +0 -66
  711. data/ext/ice/cpp/include/Ice/ObjectFactoryManagerF.h +0 -26
  712. data/ext/ice/cpp/include/Ice/Outgoing.h +0 -225
  713. data/ext/ice/cpp/include/Ice/Plugin.h +0 -125
  714. data/ext/ice/cpp/include/Ice/PluginF.h +0 -70
  715. data/ext/ice/cpp/include/Ice/Process.h +0 -574
  716. data/ext/ice/cpp/include/Ice/ProcessF.h +0 -83
  717. data/ext/ice/cpp/include/Ice/Properties.h +0 -136
  718. data/ext/ice/cpp/include/Ice/PropertiesAdmin.h +0 -830
  719. data/ext/ice/cpp/include/Ice/PropertiesF.h +0 -87
  720. data/ext/ice/cpp/include/Ice/RemoteLogger.h +0 -1500
  721. data/ext/ice/cpp/include/Ice/Router.h +0 -1159
  722. data/ext/ice/cpp/include/Ice/RouterF.h +0 -83
  723. data/ext/ice/cpp/include/Ice/ServantLocator.h +0 -96
  724. data/ext/ice/cpp/include/Ice/Stream.h +0 -447
  725. data/ext/ice/cpp/include/Ice/StreamF.h +0 -30
  726. data/ext/ice/cpp/include/Ice/Version.h +0 -262
  727. data/ext/ice/cpp/include/IceSSL/ConnectionInfo.h +0 -158
  728. data/ext/ice/cpp/include/IceSSL/EndpointInfo.h +0 -142
  729. data/ext/ice/cpp/include/IceUtil/AbstractMutex.h +0 -119
  730. data/ext/ice/cpp/include/IceUtil/Cache.h +0 -362
  731. data/ext/ice/cpp/include/IceUtil/IconvStringConverter.h +0 -302
  732. data/ext/ice/cpp/include/IceUtil/SHA1.h +0 -47
  733. data/ext/ice/cpp/include/Slice/CPlusPlusUtil.h +0 -65
  734. data/ext/ice/cpp/include/Slice/Checksum.h +0 -26
  735. data/ext/ice/cpp/include/Slice/CsUtil.h +0 -92
  736. data/ext/ice/cpp/include/Slice/DotNetNames.h +0 -34
  737. data/ext/ice/cpp/include/Slice/JavaUtil.h +0 -279
  738. data/ext/ice/cpp/include/Slice/ObjCUtil.h +0 -127
  739. data/ext/ice/cpp/include/Slice/PHPUtil.h +0 -50
  740. data/ext/ice/cpp/include/Slice/PythonUtil.h +0 -64
  741. data/ext/ice/cpp/include/Slice/Util.h +0 -56
  742. data/ext/ice/cpp/src/Ice/BasicStream.cpp +0 -3428
  743. data/ext/ice/cpp/src/Ice/DeprecatedStringConverter.cpp +0 -62
  744. data/ext/ice/cpp/src/Ice/ObjectFactoryF.cpp +0 -44
  745. data/ext/ice/cpp/src/Ice/ObjectFactoryManager.cpp +0 -139
  746. data/ext/ice/cpp/src/Ice/ObjectFactoryManager.h +0 -43
  747. data/ext/ice/cpp/src/Ice/Outgoing.cpp +0 -694
  748. data/ext/ice/cpp/src/Ice/Stream.cpp +0 -53
  749. data/ext/ice/cpp/src/Ice/StreamI.cpp +0 -832
  750. data/ext/ice/cpp/src/Ice/StreamI.h +0 -198
  751. data/ext/ice/cpp/src/IceSSL/Certificate.cpp +0 -1336
  752. data/ext/ice/cpp/src/IceUtil/ArgVector.cpp +0 -64
  753. data/ext/ice/cpp/src/IceUtil/ArgVector.h +0 -41
  754. data/ext/ice/cpp/src/IceUtil/Exception.cpp +0 -792
  755. data/ext/ice/cpp/src/IceUtil/FileUtil.h +0 -185
  756. data/ext/ice/cpp/src/Slice/CsUtil.cpp +0 -2660
  757. data/ext/ice/cpp/src/Slice/DotNetNames.cpp +0 -146
  758. data/ext/ice/cpp/src/Slice/ObjCUtil.cpp +0 -1310
  759. data/lib/Ice/ObjectFactoryF.rb +0 -29
  760. data/lib/IceGrid/Locator.rb +0 -106
  761. data/lib/IceGrid/Observer.rb +0 -572
  762. data/lib/IceGrid/Query.rb +0 -169
  763. data/slice/Freeze/BackgroundSaveEvictor.ice +0 -111
  764. data/slice/Freeze/CatalogData.ice +0 -49
  765. data/slice/Freeze/Connection.ice +0 -121
  766. data/slice/Freeze/ConnectionF.ice +0 -20
  767. data/slice/Freeze/DB.ice +0 -37
  768. data/slice/Freeze/Evictor.ice +0 -346
  769. data/slice/Freeze/EvictorF.ice +0 -22
  770. data/slice/Freeze/EvictorStorage.ice +0 -72
  771. data/slice/Freeze/Exception.ice +0 -100
  772. data/slice/Freeze/Transaction.ice +0 -58
  773. data/slice/Freeze/TransactionalEvictor.ice +0 -50
  774. data/slice/Ice/ObjectFactoryF.ice +0 -21
  775. data/slice/IceGrid/Locator.ice +0 -57
  776. data/slice/IceGrid/Observer.ice +0 -395
  777. data/slice/IceGrid/Query.ice +0 -131
@@ -1,185 +0,0 @@
1
- // **********************************************************************
2
- //
3
- // Copyright (c) 2003-2018 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
- #ifndef ICE_FILE_UTIL_H
11
- #define ICE_FILE_UTIL_H
12
-
13
- #include <IceUtil/Config.h>
14
- #include <IceUtil/Shared.h>
15
- #include <IceUtil/Handle.h>
16
-
17
- #include <sys/stat.h>
18
- #include <fcntl.h>
19
- #include <stdio.h>
20
- #include <fstream>
21
-
22
- namespace IceUtilInternal
23
- {
24
-
25
- extern const ICE_UTIL_API std::string pathsep;
26
- extern const ICE_UTIL_API std::string separator;
27
-
28
- //
29
- // Detemine if path is an absolute path.
30
- //
31
- ICE_UTIL_API bool isAbsolutePath(const std::string&);
32
-
33
- //
34
- // Determine if a file exists.
35
- //
36
- ICE_UTIL_API bool fileExists(const std::string&);
37
-
38
- //
39
- // Determine if a directory exists.
40
- //
41
- ICE_UTIL_API bool directoryExists(const std::string&);
42
-
43
- //
44
- // Determine if a directory exists and is empty.
45
- //
46
- ICE_UTIL_API bool isEmptyDirectory(const std::string&);
47
-
48
- #ifdef _WIN32
49
-
50
- #if defined(__MINGW32__)
51
- typedef struct _stat structstat;
52
- #else
53
- typedef struct _stat64i32 structstat;
54
- #endif
55
-
56
- #ifdef _MSC_VER
57
- # define O_RDONLY _O_RDONLY
58
- # define O_BINARY _O_BINARY
59
-
60
- # define S_ISDIR(mode) ((mode) & _S_IFDIR)
61
- # define S_ISREG(mode) ((mode) & _S_IFREG)
62
- #endif
63
-
64
- #else
65
-
66
- typedef struct stat structstat;
67
- # define O_BINARY 0
68
-
69
- #endif
70
-
71
- //
72
- // OS stat
73
- //
74
- ICE_UTIL_API int stat(const std::string&, structstat*);
75
- ICE_UTIL_API int remove(const std::string&);
76
- ICE_UTIL_API int rename(const std::string&, const std::string&);
77
- ICE_UTIL_API int rmdir(const std::string&);
78
-
79
- ICE_UTIL_API int mkdir(const std::string&, int);
80
- ICE_UTIL_API FILE* fopen(const std::string&, const std::string&);
81
- ICE_UTIL_API FILE* freopen(const std::string&, const std::string&, FILE*);
82
- ICE_UTIL_API int open(const std::string&, int);
83
-
84
- #ifndef ICE_OS_WINRT
85
- ICE_UTIL_API int getcwd(std::string&);
86
- #endif
87
-
88
- ICE_UTIL_API int unlink(const std::string&);
89
- ICE_UTIL_API int close(int);
90
-
91
- //
92
- // This class is used to implement process file locking. This class
93
- // is not intended to do file locking within the same process.
94
- //
95
- class ICE_UTIL_API FileLock : public IceUtil::Shared, public IceUtil::noncopyable
96
- {
97
- public:
98
- //
99
- // The constructor opens the given file (eventually creating it)
100
- // and acquires a lock on the file or throws FileLockException if
101
- // the file couldn't be locked.
102
- //
103
- // If the lock can be acquired, the process pid is written to the
104
- // file.
105
- //
106
- FileLock(const std::string&);
107
-
108
- //
109
- // The destructor releases the lock and removes the file.
110
- //
111
- virtual ~FileLock();
112
-
113
- private:
114
-
115
- #ifdef _WIN32
116
- HANDLE _fd;
117
- #else
118
- int _fd;
119
- #endif
120
- std::string _path;
121
- };
122
-
123
- typedef IceUtil::Handle<FileLock> FileLockPtr;
124
-
125
- class ICE_UTIL_API ifstream : public std::ifstream
126
- {
127
- public:
128
-
129
- ifstream();
130
- ifstream(const std::string&, std::ios_base::openmode mode = std::ios_base::in);
131
- void open(const std::string&, std::ios_base::openmode mode = std::ios_base::in);
132
-
133
- #ifdef __SUNPRO_CC
134
- using std::ifstream::open;
135
- #endif
136
-
137
- #if defined(_MSC_VER) && (_MSC_VER >= 1900)
138
- ifstream(const ifstream&) = delete;
139
- #endif
140
-
141
- private:
142
-
143
- // Hide const char* definitions since they shouldn't be used.
144
- ifstream(const char*);
145
- void open(const char*, std::ios_base::openmode mode = std::ios_base::in);
146
- };
147
-
148
- class ICE_UTIL_API ofstream : public std::ofstream
149
- {
150
- public:
151
-
152
- ofstream();
153
- ofstream(const std::string&, std::ios_base::openmode mode = std::ios_base::out);
154
- void open(const std::string&, std::ios_base::openmode mode = std::ios_base::out);
155
-
156
- #ifdef __SUNPRO_CC
157
- using std::ofstream::open;
158
- #endif
159
-
160
- #if defined(_MSC_VER) && (_MSC_VER >= 1900)
161
- ofstream(const ofstream&) = delete;
162
- #endif
163
-
164
- private:
165
-
166
- // Hide const char* definitions since they shouldn't be used.
167
- ofstream(const char*);
168
- void open(const char*, std::ios_base::openmode mode = std::ios_base::out);
169
- };
170
-
171
- //
172
- // Use streamFilename to construct the filename given to std stream classes
173
- // like ifstream and ofstream.
174
- //
175
- #if defined(_WIN32) && !defined(__MINGW32__)
176
- ICE_UTIL_API std::wstring streamFilename(const std::string&);
177
- #else
178
- inline std::string streamFilename(const std::string& filename)
179
- {
180
- return filename;
181
- }
182
- #endif
183
-
184
- }
185
- #endif
@@ -1,2660 +0,0 @@
1
- // **********************************************************************
2
- //
3
- // Copyright (c) 2003-2018 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 <Slice/CsUtil.h>
11
- #include <Slice/DotNetNames.h>
12
- #include <Slice/Util.h>
13
- #include <IceUtil/Functional.h>
14
-
15
- #include <sys/types.h>
16
- #include <sys/stat.h>
17
-
18
- #ifdef _WIN32
19
- #include <direct.h>
20
- #endif
21
-
22
- #ifndef _WIN32
23
- #include <unistd.h>
24
- #endif
25
-
26
- using namespace std;
27
- using namespace Slice;
28
- using namespace IceUtil;
29
- using namespace IceUtilInternal;
30
-
31
- static string
32
- lookupKwd(const string& name, int baseTypes, bool mangleCasts = false)
33
- {
34
- //
35
- // Keyword list. *Must* be kept in alphabetical order.
36
- //
37
- static const string keywordList[] =
38
- {
39
- "abstract", "as", "base", "bool", "break", "byte", "case", "catch", "char", "checked", "class", "const",
40
- "continue", "decimal", "default", "delegate", "do", "double", "else", "enum", "event", "explicit", "extern",
41
- "false", "finally", "fixed", "float", "for", "foreach", "goto", "if", "implicit", "in", "int", "interface",
42
- "internal", "is", "lock", "long", "namespace", "new", "null", "object", "operator", "out", "override",
43
- "params", "private", "protected", "public", "readonly", "ref", "return", "sbyte", "sealed", "short",
44
- "sizeof", "stackalloc", "static", "string", "struct", "switch", "this", "throw", "true", "try", "typeof",
45
- "uint", "ulong", "unchecked", "unsafe", "ushort", "using", "virtual", "void", "volatile", "while"
46
- };
47
- bool found = binary_search(&keywordList[0],
48
- &keywordList[sizeof(keywordList) / sizeof(*keywordList)],
49
- name,
50
- Slice::CICompare());
51
- if(found)
52
- {
53
- return "@" + name;
54
- }
55
- if(mangleCasts && (name == "checkedCast" || name == "uncheckedCast"))
56
- {
57
- return string(DotNet::manglePrefix) + name;
58
- }
59
- return Slice::DotNet::mangleName(name, baseTypes);
60
- }
61
-
62
- //
63
- // Split a scoped name into its components and return the components as a list of (unscoped) identifiers.
64
- //
65
- static StringList
66
- splitScopedName(const string& scoped)
67
- {
68
- assert(scoped[0] == ':');
69
- StringList ids;
70
- string::size_type next = 0;
71
- string::size_type pos;
72
- while((pos = scoped.find("::", next)) != string::npos)
73
- {
74
- pos += 2;
75
- if(pos != scoped.size())
76
- {
77
- string::size_type endpos = scoped.find("::", pos);
78
- if(endpos != string::npos)
79
- {
80
- ids.push_back(scoped.substr(pos, endpos - pos));
81
- }
82
- }
83
- next = pos;
84
- }
85
- if(next != scoped.size())
86
- {
87
- ids.push_back(scoped.substr(next));
88
- }
89
- else
90
- {
91
- ids.push_back("");
92
- }
93
-
94
- return ids;
95
- }
96
-
97
- //
98
- // If the passed name is a scoped name, return the identical scoped name,
99
- // but with all components that are C# keywords replaced by
100
- // their "@"-prefixed version; otherwise, if the passed name is
101
- // not scoped, but a C# keyword, return the "@"-prefixed name;
102
- // otherwise, check if the name is one of the method names of baseTypes;
103
- // if so, prefix it with _Ice_; otherwise, return the name unchanged.
104
- //
105
- string
106
- Slice::CsGenerator::fixId(const string& name, int baseTypes, bool mangleCasts)
107
- {
108
- if(name.empty())
109
- {
110
- return name;
111
- }
112
- if(name[0] != ':')
113
- {
114
- return lookupKwd(name, baseTypes, mangleCasts);
115
- }
116
- StringList ids = splitScopedName(name);
117
- StringList newIds;
118
- for(StringList::const_iterator i = ids.begin(); i != ids.end(); ++i)
119
- {
120
- newIds.push_back(lookupKwd(*i, baseTypes));
121
- }
122
- stringstream result;
123
- for(StringList::const_iterator j = newIds.begin(); j != newIds.end(); ++j)
124
- {
125
- if(j != newIds.begin())
126
- {
127
- result << '.';
128
- }
129
- result << *j;
130
- }
131
- return result.str();
132
- }
133
-
134
- string
135
- Slice::CsGenerator::fixId(const ContainedPtr& cont, int baseTypes, bool mangleCasts)
136
- {
137
- ContainerPtr container = cont->container();
138
- ContainedPtr contained = ContainedPtr::dynamicCast(container);
139
- if(contained && contained->hasMetaData("clr:property") &&
140
- (contained->containedType() == Contained::ContainedTypeClass || contained->containedType() == Contained::ContainedTypeStruct))
141
- {
142
- return cont->name() + "__prop";
143
- }
144
- else
145
- {
146
- return fixId(cont->name(), baseTypes, mangleCasts);
147
- }
148
- }
149
-
150
- string
151
- Slice::CsGenerator::getOptionalFormat(const TypePtr& type)
152
- {
153
- BuiltinPtr bp = BuiltinPtr::dynamicCast(type);
154
- if(bp)
155
- {
156
- switch(bp->kind())
157
- {
158
- case Builtin::KindByte:
159
- case Builtin::KindBool:
160
- {
161
- return "Ice.OptionalFormat.F1";
162
- }
163
- case Builtin::KindShort:
164
- {
165
- return "Ice.OptionalFormat.F2";
166
- }
167
- case Builtin::KindInt:
168
- case Builtin::KindFloat:
169
- {
170
- return "Ice.OptionalFormat.F4";
171
- }
172
- case Builtin::KindLong:
173
- case Builtin::KindDouble:
174
- {
175
- return "Ice.OptionalFormat.F8";
176
- }
177
- case Builtin::KindString:
178
- {
179
- return "Ice.OptionalFormat.VSize";
180
- }
181
- case Builtin::KindObject:
182
- {
183
- return "Ice.OptionalFormat.Class";
184
- }
185
- case Builtin::KindObjectProxy:
186
- {
187
- return "Ice.OptionalFormat.FSize";
188
- }
189
- case Builtin::KindLocalObject:
190
- {
191
- assert(false);
192
- break;
193
- }
194
- }
195
- }
196
-
197
- if(EnumPtr::dynamicCast(type))
198
- {
199
- return "Ice.OptionalFormat.Size";
200
- }
201
-
202
- SequencePtr seq = SequencePtr::dynamicCast(type);
203
- if(seq)
204
- {
205
- return seq->type()->isVariableLength() ? "Ice.OptionalFormat.FSize" : "Ice.OptionalFormat.VSize";
206
- }
207
-
208
- DictionaryPtr d = DictionaryPtr::dynamicCast(type);
209
- if(d)
210
- {
211
- return (d->keyType()->isVariableLength() || d->valueType()->isVariableLength()) ?
212
- "Ice.OptionalFormat.FSize" : "Ice.OptionalFormat.VSize";
213
- }
214
-
215
- StructPtr st = StructPtr::dynamicCast(type);
216
- if(st)
217
- {
218
- return st->isVariableLength() ? "Ice.OptionalFormat.FSize" : "Ice.OptionalFormat.VSize";
219
- }
220
-
221
- if(ProxyPtr::dynamicCast(type))
222
- {
223
- return "Ice.OptionalFormat.FSize";
224
- }
225
-
226
- ClassDeclPtr cl = ClassDeclPtr::dynamicCast(type);
227
- assert(cl);
228
- return "Ice.OptionalFormat.Class";
229
- }
230
-
231
- string
232
- Slice::CsGenerator::getStaticId(const TypePtr& type)
233
- {
234
- BuiltinPtr b = BuiltinPtr::dynamicCast(type);
235
- ClassDeclPtr cl = ClassDeclPtr::dynamicCast(type);
236
-
237
- assert((b && b->kind() == Builtin::KindObject) || cl);
238
-
239
- if(b)
240
- {
241
- return "Ice.ObjectImpl.ice_staticId()";
242
- }
243
- else if(cl->isInterface())
244
- {
245
- ContainedPtr cont = ContainedPtr::dynamicCast(cl->container());
246
- assert(cont);
247
- return fixId(cont->scoped(), DotNet::ICloneable) + "." + cl->name() + "Disp_.ice_staticId()";
248
- }
249
- else
250
- {
251
- return fixId(cl->scoped(), DotNet::ICloneable) + ".ice_staticId()";
252
- }
253
- }
254
-
255
- string
256
- Slice::CsGenerator::typeToString(const TypePtr& type, bool optional)
257
- {
258
- if(!type)
259
- {
260
- return "void";
261
- }
262
-
263
- if(optional)
264
- {
265
- return "Ice.Optional<" + typeToString(type, false) + ">";
266
- }
267
-
268
- static const char* builtinTable[] =
269
- {
270
- "byte",
271
- "bool",
272
- "short",
273
- "int",
274
- "long",
275
- "float",
276
- "double",
277
- "string",
278
- "Ice.Object",
279
- "Ice.ObjectPrx",
280
- "_System.Object"
281
- };
282
-
283
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
284
- if(builtin)
285
- {
286
- return builtinTable[builtin->kind()];
287
- }
288
-
289
- ProxyPtr proxy = ProxyPtr::dynamicCast(type);
290
- if(proxy)
291
- {
292
- return fixId(proxy->_class()->scoped() + "Prx");
293
- }
294
-
295
- SequencePtr seq = SequencePtr::dynamicCast(type);
296
- if(seq)
297
- {
298
- if(seq->hasMetaData("clr:collection"))
299
- {
300
- return fixId(seq->scoped());
301
- }
302
-
303
- string prefix = "clr:generic:";
304
- string meta;
305
- if(seq->findMetaData(prefix, meta))
306
- {
307
- string type = meta.substr(prefix.size());
308
- if(type == "List" || type == "LinkedList" || type == "Queue" || type == "Stack")
309
- {
310
- return "_System.Collections.Generic." + type + "<" + typeToString(seq->type()) + ">";
311
- }
312
- else
313
- {
314
- return "global::" + type + "<" + typeToString(seq->type()) + ">";
315
- }
316
- }
317
-
318
- prefix = "clr:serializable:";
319
- if(seq->findMetaData(prefix, meta))
320
- {
321
- string type = meta.substr(prefix.size());
322
- return "global::" + type;
323
- }
324
-
325
- return typeToString(seq->type()) + "[]";
326
- }
327
-
328
- DictionaryPtr d = DictionaryPtr::dynamicCast(type);
329
- if(d)
330
- {
331
- if(d->hasMetaData("clr:collection"))
332
- {
333
- return fixId(d->scoped());
334
- }
335
-
336
- string prefix = "clr:generic:";
337
- string meta;
338
- string typeName;
339
- if(d->findMetaData(prefix, meta))
340
- {
341
- typeName = meta.substr(prefix.size());
342
- }
343
- else
344
- {
345
- typeName = "Dictionary";
346
- }
347
- return "_System.Collections.Generic." + typeName
348
- + "<" + typeToString(d->keyType()) + ", " + typeToString(d->valueType()) + ">";
349
- }
350
-
351
- ContainedPtr contained = ContainedPtr::dynamicCast(type);
352
- if(contained)
353
- {
354
- return fixId(contained->scoped());
355
- }
356
-
357
- return "???";
358
- }
359
-
360
- bool
361
- Slice::CsGenerator::isValueType(const TypePtr& type)
362
- {
363
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
364
- if(builtin)
365
- {
366
- switch(builtin->kind())
367
- {
368
- case Builtin::KindString:
369
- case Builtin::KindObject:
370
- case Builtin::KindObjectProxy:
371
- case Builtin::KindLocalObject:
372
- {
373
- return false;
374
- break;
375
- }
376
- default:
377
- {
378
- return true;
379
- break;
380
- }
381
- }
382
- }
383
- StructPtr s = StructPtr::dynamicCast(type);
384
- if(s)
385
- {
386
- if(s->hasMetaData("clr:class"))
387
- {
388
- return false;
389
- }
390
- DataMemberList dm = s->dataMembers();
391
- for(DataMemberList::const_iterator i = dm.begin(); i != dm.end(); ++i)
392
- {
393
- if(!isValueType((*i)->type()) || (*i)->defaultValueType())
394
- {
395
- return false;
396
- }
397
- }
398
- return true;
399
- }
400
- if(EnumPtr::dynamicCast(type))
401
- {
402
- return true;
403
- }
404
- return false;
405
- }
406
-
407
- bool
408
- Slice::CsGenerator::isSerializable(const TypePtr& type)
409
- {
410
- //
411
- // A proxy cannot be serialized because a communicator is required during deserialization.
412
- //
413
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
414
- ProxyPtr proxy = ProxyPtr::dynamicCast(type);
415
- if((builtin && builtin->kind() == Builtin::KindObjectProxy) || proxy)
416
- {
417
- return false;
418
- }
419
-
420
- SequencePtr seq = SequencePtr::dynamicCast(type);
421
- if(seq)
422
- {
423
- return isSerializable(seq->type());
424
- }
425
-
426
- DictionaryPtr d = DictionaryPtr::dynamicCast(type);
427
- if(d)
428
- {
429
- return isSerializable(d->keyType()) && isSerializable(d->valueType());
430
- }
431
-
432
- return true;
433
- }
434
-
435
- void
436
- Slice::CsGenerator::writeMarshalUnmarshalCode(Output &out,
437
- const TypePtr& type,
438
- const string& param,
439
- bool marshal,
440
- bool streamingAPI)
441
- {
442
- string stream;
443
-
444
- if(marshal)
445
- {
446
- stream = streamingAPI ? "outS__" : "os__";
447
- }
448
- else
449
- {
450
- stream = streamingAPI ? "inS__" : "is__";
451
- }
452
-
453
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
454
- if(builtin)
455
- {
456
- switch(builtin->kind())
457
- {
458
- case Builtin::KindByte:
459
- {
460
- if(marshal)
461
- {
462
- out << nl << stream << ".writeByte(" << param << ");";
463
- }
464
- else
465
- {
466
- out << nl << param << " = " << stream << ".readByte()" << ';';
467
- }
468
- break;
469
- }
470
- case Builtin::KindBool:
471
- {
472
- if(marshal)
473
- {
474
- out << nl << stream << ".writeBool(" << param << ");";
475
- }
476
- else
477
- {
478
- out << nl << param << " = " << stream << ".readBool()" << ';';
479
- }
480
- break;
481
- }
482
- case Builtin::KindShort:
483
- {
484
- if(marshal)
485
- {
486
- out << nl << stream << ".writeShort(" << param << ");";
487
- }
488
- else
489
- {
490
- out << nl << param << " = " << stream << ".readShort()" << ';';
491
- }
492
- break;
493
- }
494
- case Builtin::KindInt:
495
- {
496
- if(marshal)
497
- {
498
- out << nl << stream << ".writeInt(" << param << ");";
499
- }
500
- else
501
- {
502
- out << nl << param << " = " << stream << ".readInt()" << ';';
503
- }
504
- break;
505
- }
506
- case Builtin::KindLong:
507
- {
508
- if(marshal)
509
- {
510
- out << nl << stream << ".writeLong(" << param << ");";
511
- }
512
- else
513
- {
514
- out << nl << param << " = " << stream << ".readLong()" << ';';
515
- }
516
- break;
517
- }
518
- case Builtin::KindFloat:
519
- {
520
- if(marshal)
521
- {
522
- out << nl << stream << ".writeFloat(" << param << ");";
523
- }
524
- else
525
- {
526
- out << nl << param << " = " << stream << ".readFloat()" << ';';
527
- }
528
- break;
529
- }
530
- case Builtin::KindDouble:
531
- {
532
- if(marshal)
533
- {
534
- out << nl << stream << ".writeDouble(" << param << ");";
535
- }
536
- else
537
- {
538
- out << nl << param << " = " << stream << ".readDouble()" << ';';
539
- }
540
- break;
541
- }
542
- case Builtin::KindString:
543
- {
544
- if(marshal)
545
- {
546
- out << nl << stream << ".writeString(" << param << ");";
547
- }
548
- else
549
- {
550
- out << nl << param << " = " << stream << ".readString()" << ';';
551
- }
552
- break;
553
- }
554
- case Builtin::KindObject:
555
- {
556
- if(marshal)
557
- {
558
- out << nl << stream << ".writeObject(" << param << ");";
559
- }
560
- else
561
- {
562
- out << nl << stream << ".readObject(" << param << ");";
563
- }
564
- break;
565
- }
566
- case Builtin::KindObjectProxy:
567
- {
568
- string typeS = typeToString(type);
569
- if(marshal)
570
- {
571
- out << nl << stream << ".writeProxy(" << param << ");";
572
- }
573
- else
574
- {
575
- out << nl << param << " = " << stream << ".readProxy()" << ';';
576
- }
577
- break;
578
- }
579
- case Builtin::KindLocalObject:
580
- {
581
- assert(false);
582
- break;
583
- }
584
- }
585
- return;
586
- }
587
-
588
- ProxyPtr prx = ProxyPtr::dynamicCast(type);
589
- if(prx)
590
- {
591
- string typeS = typeToString(type);
592
- if(marshal)
593
- {
594
- out << nl << typeS << "Helper.write";
595
- if(!streamingAPI)
596
- {
597
- out << "__";
598
- }
599
- out << "(" << stream << ", " << param << ");";
600
- }
601
- else
602
- {
603
- out << nl << param << " = " << typeS << "Helper.read";
604
- if(!streamingAPI)
605
- {
606
- out << "__";
607
- }
608
- out << "(" << stream << ");";
609
- }
610
- return;
611
- }
612
-
613
- ClassDeclPtr cl = ClassDeclPtr::dynamicCast(type);
614
- if(cl)
615
- {
616
- if(marshal)
617
- {
618
- out << nl << stream << ".writeObject(" << param << ");";
619
- }
620
- else
621
- {
622
- out << nl << stream << ".readObject(" << param << ");";
623
- }
624
- return;
625
- }
626
-
627
- StructPtr st = StructPtr::dynamicCast(type);
628
- if(st)
629
- {
630
- if(marshal)
631
- {
632
- const string write = streamingAPI ? "ice_write" : "write__";
633
- if(!isValueType(st))
634
- {
635
- out << nl << typeToString(st) << "." << write << "(" << stream << ", " << param << ");";
636
- }
637
- else
638
- {
639
- out << nl << param << "." << write << "(" << stream << ");";
640
- }
641
- }
642
- else
643
- {
644
- if(!isValueType(st))
645
- {
646
- const string r = streamingAPI ? "ice_read" : "read__";
647
- out << nl << param << " = " << typeToString(type) << "." << r << "(" << stream << ", " << param << ");";
648
- }
649
- else
650
- {
651
- const string read = streamingAPI ? "ice_read" : "read__";
652
- out << nl << param << "." << read << "(" << stream << ");";
653
- }
654
- }
655
- return;
656
- }
657
-
658
- EnumPtr en = EnumPtr::dynamicCast(type);
659
- if(en)
660
- {
661
- if(marshal)
662
- {
663
- if(streamingAPI)
664
- {
665
- out << nl << "if((int)" << param << " < " << en->minValue()
666
- << " || (int)" << param << " > " << en->maxValue() << ")";
667
- out << sb;
668
- out << nl << "throw new Ice.MarshalException(\"enumerator out of range\");";
669
- out << eb;
670
- }
671
- out << nl << stream << ".writeEnum((int)" << param << ", " << en->maxValue() << ");";
672
- }
673
- else
674
- {
675
- out << nl << param << " = (" << fixId(en->scoped()) << ')' << stream << ".readEnum(" << en->maxValue()
676
- << ");";
677
- if(streamingAPI)
678
- {
679
- out << nl << "if((int)" << param << " < " << en->minValue() << " || (int)" << param << " > "
680
- << en->maxValue() << ")";
681
- out << sb;
682
- out << nl << "throw new Ice.MarshalException(\"enumerator out of range\");";
683
- out << eb;
684
- }
685
- }
686
- return;
687
- }
688
-
689
- SequencePtr seq = SequencePtr::dynamicCast(type);
690
- if(seq)
691
- {
692
- writeSequenceMarshalUnmarshalCode(out, seq, param, marshal, streamingAPI, true);
693
- return;
694
- }
695
-
696
- assert(ConstructedPtr::dynamicCast(type));
697
- string typeS;
698
- DictionaryPtr d = DictionaryPtr::dynamicCast(type);
699
- if(d)
700
- {
701
- typeS = fixId(d->scope()) + d->name();
702
- }
703
- else
704
- {
705
- typeS = typeToString(type);
706
- }
707
- if(marshal)
708
- {
709
- out << nl << typeS << "Helper.write(" << stream << ", " << param << ");";
710
- }
711
- else
712
- {
713
- out << nl << param << " = " << typeS << "Helper.read(" << stream << ')' << ';';
714
- }
715
- }
716
-
717
- void
718
- Slice::CsGenerator::writeOptionalMarshalUnmarshalCode(Output &out,
719
- const TypePtr& type,
720
- const string& param,
721
- int tag,
722
- bool marshal,
723
- bool streamingAPI)
724
- {
725
- string stream;
726
-
727
- if(marshal)
728
- {
729
- stream = streamingAPI ? "outS__" : "os__";
730
- }
731
- else
732
- {
733
- stream = streamingAPI ? "inS__" : "is__";
734
- }
735
-
736
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
737
- if(builtin)
738
- {
739
- switch(builtin->kind())
740
- {
741
- case Builtin::KindByte:
742
- {
743
- if(marshal)
744
- {
745
- out << nl << stream << ".writeByte(" << tag << ", " << param << ");";
746
- }
747
- else
748
- {
749
- out << nl << param << " = " << stream << ".readByte(" << tag << ");";
750
- }
751
- break;
752
- }
753
- case Builtin::KindBool:
754
- {
755
- if(marshal)
756
- {
757
- out << nl << stream << ".writeBool(" << tag << ", " << param << ");";
758
- }
759
- else
760
- {
761
- out << nl << param << " = " << stream << ".readBool(" << tag << ");";
762
- }
763
- break;
764
- }
765
- case Builtin::KindShort:
766
- {
767
- if(marshal)
768
- {
769
- out << nl << stream << ".writeShort(" << tag << ", " << param << ");";
770
- }
771
- else
772
- {
773
- out << nl << param << " = " << stream << ".readShort(" << tag << ");";
774
- }
775
- break;
776
- }
777
- case Builtin::KindInt:
778
- {
779
- if(marshal)
780
- {
781
- out << nl << stream << ".writeInt(" << tag << ", " << param << ");";
782
- }
783
- else
784
- {
785
- out << nl << param << " = " << stream << ".readInt(" << tag << ");";
786
- }
787
- break;
788
- }
789
- case Builtin::KindLong:
790
- {
791
- if(marshal)
792
- {
793
- out << nl << stream << ".writeLong(" << tag << ", " << param << ");";
794
- }
795
- else
796
- {
797
- out << nl << param << " = " << stream << ".readLong(" << tag << ");";
798
- }
799
- break;
800
- }
801
- case Builtin::KindFloat:
802
- {
803
- if(marshal)
804
- {
805
- out << nl << stream << ".writeFloat(" << tag << ", " << param << ");";
806
- }
807
- else
808
- {
809
- out << nl << param << " = " << stream << ".readFloat(" << tag << ");";
810
- }
811
- break;
812
- }
813
- case Builtin::KindDouble:
814
- {
815
- if(marshal)
816
- {
817
- out << nl << stream << ".writeDouble(" << tag << ", " << param << ");";
818
- }
819
- else
820
- {
821
- out << nl << param << " = " << stream << ".readDouble(" << tag << ");";
822
- }
823
- break;
824
- }
825
- case Builtin::KindString:
826
- {
827
- if(marshal)
828
- {
829
- out << nl << stream << ".writeString(" << tag << ", " << param << ");";
830
- }
831
- else
832
- {
833
- out << nl << param << " = " << stream << ".readString(" << tag << ");";
834
- }
835
- break;
836
- }
837
- case Builtin::KindObject:
838
- {
839
- if(marshal)
840
- {
841
- out << nl << stream << ".writeObject(" << tag << ", " << param << ");";
842
- }
843
- else
844
- {
845
- out << nl << stream << ".readObject(" << tag << ", " << param << ");";
846
- }
847
- break;
848
- }
849
- case Builtin::KindObjectProxy:
850
- {
851
- string typeS = typeToString(type);
852
- if(marshal)
853
- {
854
- out << nl << stream << ".writeProxy(" << tag << ", " << param << ");";
855
- }
856
- else
857
- {
858
- out << nl << param << " = new Ice.Optional<Ice.ObjectPrx>(" << stream << ".readProxy(" << tag
859
- << "));";
860
- }
861
- break;
862
- }
863
- case Builtin::KindLocalObject:
864
- {
865
- assert(false);
866
- break;
867
- }
868
- }
869
- return;
870
- }
871
-
872
- ProxyPtr prx = ProxyPtr::dynamicCast(type);
873
- if(prx)
874
- {
875
- if(marshal)
876
- {
877
- out << nl << "if(" << param << ".HasValue && " << stream << ".writeOpt(" << tag
878
- << ", Ice.OptionalFormat.FSize))";
879
- out << sb;
880
- out << nl << "int pos__ = " << stream << ".startSize();";
881
- writeMarshalUnmarshalCode(out, type, param + ".Value", marshal, streamingAPI);
882
- out << nl << stream << ".endSize(pos__);";
883
- out << eb;
884
- }
885
- else
886
- {
887
- out << nl << "if(" << stream << ".readOpt(" << tag << ", Ice.OptionalFormat.FSize))";
888
- out << sb;
889
- out << nl << stream << ".skip(4);";
890
- string tmp = "tmpVal__";
891
- string typeS = typeToString(type);
892
- out << nl << typeS << ' ' << tmp << ';';
893
- writeMarshalUnmarshalCode(out, type, tmp, marshal, streamingAPI);
894
- out << nl << param << " = new Ice.Optional<" << typeS << ">(" << tmp << ");";
895
- out << eb;
896
- out << nl << "else";
897
- out << sb;
898
- out << nl << param << " = new Ice.Optional<" << typeS << ">();";
899
- out << eb;
900
- }
901
- return;
902
- }
903
-
904
- ClassDeclPtr cl = ClassDeclPtr::dynamicCast(type);
905
- if(cl)
906
- {
907
- if(marshal)
908
- {
909
- out << nl << stream << ".writeObject(" << tag << ", " << param << ");";
910
- }
911
- else
912
- {
913
- out << nl << stream << ".readObject(" << tag << ", " << param << ");";
914
- }
915
- return;
916
- }
917
-
918
- StructPtr st = StructPtr::dynamicCast(type);
919
- if(st)
920
- {
921
- if(marshal)
922
- {
923
- out << nl << "if(" << param << ".HasValue && " << stream << ".writeOpt(" << tag << ", "
924
- << getOptionalFormat(st) << "))";
925
- out << sb;
926
- if(st->isVariableLength())
927
- {
928
- out << nl << "int pos__ = " << stream << ".startSize();";
929
- }
930
- else
931
- {
932
- out << nl << stream << ".writeSize(" << st->minWireSize() << ");";
933
- }
934
- writeMarshalUnmarshalCode(out, type, param + ".Value", marshal, streamingAPI);
935
- if(st->isVariableLength())
936
- {
937
- out << nl << stream << ".endSize(pos__);";
938
- }
939
- out << eb;
940
- }
941
- else
942
- {
943
- out << nl << "if(" << stream << ".readOpt(" << tag << ", " << getOptionalFormat(st) << "))";
944
- out << sb;
945
- if(st->isVariableLength())
946
- {
947
- out << nl << stream << ".skip(4);";
948
- }
949
- else
950
- {
951
- out << nl << stream << ".skipSize();";
952
- }
953
- string typeS = typeToString(type);
954
- string tmp = "tmpVal__";
955
- if(isValueType(st))
956
- {
957
- out << nl << typeS << ' ' << tmp << " = new " << typeS << "();";
958
- }
959
- else
960
- {
961
- out << nl << typeS << ' ' << tmp << " = null;";
962
- }
963
- writeMarshalUnmarshalCode(out, type, tmp, marshal, streamingAPI);
964
- out << nl << param << " = new Ice.Optional<" << typeS << ">(" << tmp << ");";
965
- out << eb;
966
- out << nl << "else";
967
- out << sb;
968
- out << nl << param << " = new Ice.Optional<" << typeS << ">();";
969
- out << eb;
970
- }
971
- return;
972
- }
973
-
974
- EnumPtr en = EnumPtr::dynamicCast(type);
975
- if(en)
976
- {
977
- size_t sz = en->getEnumerators().size();
978
- if(marshal)
979
- {
980
- out << nl << "if(" << param << ".HasValue)";
981
- out << sb;
982
- out << nl << stream << ".writeEnum(" << tag << ", (int)" << param << ".Value, " << sz << ");";
983
- out << eb;
984
- }
985
- else
986
- {
987
- out << nl << "if(" << stream << ".readOpt(" << tag << ", Ice.OptionalFormat.Size))";
988
- out << sb;
989
- string typeS = typeToString(type);
990
- string tmp = "tmpVal__";
991
- out << nl << typeS << ' ' << tmp << ';';
992
- writeMarshalUnmarshalCode(out, type, tmp, marshal, streamingAPI);
993
- out << nl << param << " = new Ice.Optional<" << typeS << ">(" << tmp << ");";
994
- out << eb;
995
- out << nl << "else";
996
- out << sb;
997
- out << nl << param << " = new Ice.Optional<" << typeS << ">();";
998
- out << eb;
999
- }
1000
- return;
1001
- }
1002
-
1003
- SequencePtr seq = SequencePtr::dynamicCast(type);
1004
- if(seq)
1005
- {
1006
- writeOptionalSequenceMarshalUnmarshalCode(out, seq, param, tag, marshal, streamingAPI);
1007
- return;
1008
- }
1009
-
1010
- DictionaryPtr d = DictionaryPtr::dynamicCast(type);
1011
- assert(d);
1012
- TypePtr keyType = d->keyType();
1013
- TypePtr valueType = d->valueType();
1014
- if(marshal)
1015
- {
1016
- out << nl << "if(" << param << ".HasValue && " << stream << ".writeOpt(" << tag << ", "
1017
- << getOptionalFormat(d) << "))";
1018
- out << sb;
1019
- if(keyType->isVariableLength() || valueType->isVariableLength())
1020
- {
1021
- out << nl << "int pos__ = " << stream << ".startSize();";
1022
- }
1023
- else
1024
- {
1025
- out << nl << stream << ".writeSize(" << param << ".Value == null ? 1 : " << param << ".Value.Count * "
1026
- << (keyType->minWireSize() + valueType->minWireSize()) << " + (" << param
1027
- << ".Value.Count > 254 ? 5 : 1));";
1028
- }
1029
- writeMarshalUnmarshalCode(out, type, param + ".Value", marshal, streamingAPI);
1030
- if(keyType->isVariableLength() || valueType->isVariableLength())
1031
- {
1032
- out << nl << stream << ".endSize(pos__);";
1033
- }
1034
- out << eb;
1035
- }
1036
- else
1037
- {
1038
- out << nl << "if(" << stream << ".readOpt(" << tag << ", " << getOptionalFormat(d) << "))";
1039
- out << sb;
1040
- if(keyType->isVariableLength() || valueType->isVariableLength())
1041
- {
1042
- out << nl << stream << ".skip(4);";
1043
- }
1044
- else
1045
- {
1046
- out << nl << stream << ".skipSize();";
1047
- }
1048
- string typeS = typeToString(type);
1049
- string tmp = "tmpVal__";
1050
- out << nl << typeS << ' ' << tmp << " = new " << typeS << "();";
1051
- writeMarshalUnmarshalCode(out, type, tmp, marshal, streamingAPI);
1052
- out << nl << param << " = new Ice.Optional<" << typeS << ">(" << tmp << ");";
1053
- out << eb;
1054
- out << nl << "else";
1055
- out << sb;
1056
- out << nl << param << " = new Ice.Optional<" << typeS << ">();";
1057
- out << eb;
1058
- }
1059
- }
1060
-
1061
- void
1062
- Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
1063
- const SequencePtr& seq,
1064
- const string& param,
1065
- bool marshal,
1066
- bool streamingAPI,
1067
- bool useHelper)
1068
- {
1069
- string stream;
1070
- if(marshal)
1071
- {
1072
- stream = streamingAPI ? "outS__" : "os__";
1073
- }
1074
- else
1075
- {
1076
- stream = streamingAPI ? "inS__" : "is__";
1077
- }
1078
-
1079
- if(useHelper)
1080
- {
1081
- ContainedPtr cont = ContainedPtr::dynamicCast(seq->container());
1082
- assert(cont);
1083
- string helperName = fixId(cont->scoped(), DotNet::ICloneable) + "." + seq->name() + "Helper";
1084
- if(marshal)
1085
- {
1086
- out << nl << helperName << ".write(" << stream << ", " << param << ");";
1087
- }
1088
- else
1089
- {
1090
- out << nl << param << " = " << helperName << ".read(" << stream << ");";
1091
- }
1092
- return;
1093
- }
1094
-
1095
- TypePtr type = seq->type();
1096
- string typeS = typeToString(type);
1097
-
1098
- const string genericPrefix = "clr:generic:";
1099
- string genericType;
1100
- string addMethod = "Add";
1101
- const bool isGeneric = seq->findMetaData(genericPrefix, genericType);
1102
- bool isStack = false;
1103
- bool isList = false;
1104
- bool isLinkedList = false;
1105
- bool isCustom = false;
1106
- if(isGeneric)
1107
- {
1108
- genericType = genericType.substr(genericPrefix.size());
1109
- if(genericType == "LinkedList")
1110
- {
1111
- addMethod = "AddLast";
1112
- isLinkedList = true;
1113
- }
1114
- else if(genericType == "Queue")
1115
- {
1116
- addMethod = "Enqueue";
1117
- }
1118
- else if(genericType == "Stack")
1119
- {
1120
- addMethod = "Push";
1121
- isStack = true;
1122
- }
1123
- else if(genericType == "List")
1124
- {
1125
- isList = true;
1126
- }
1127
- else
1128
- {
1129
- isCustom = true;
1130
- }
1131
- }
1132
- const bool isCollection = seq->hasMetaData("clr:collection");
1133
- const bool isArray = !isGeneric && !isCollection;
1134
- const string limitID = isArray ? "Length" : "Count";
1135
-
1136
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
1137
- if(builtin)
1138
- {
1139
- switch(builtin->kind())
1140
- {
1141
- case Builtin::KindObject:
1142
- case Builtin::KindObjectProxy:
1143
- {
1144
- if(marshal)
1145
- {
1146
- out << nl << "if(" << param << " == null)";
1147
- out << sb;
1148
- out << nl << stream << ".writeSize(0);";
1149
- out << eb;
1150
- out << nl << "else";
1151
- out << sb;
1152
- out << nl << stream << ".writeSize(" << param << '.' << limitID << ");";
1153
- if(isGeneric && !isList)
1154
- {
1155
- if(isStack)
1156
- {
1157
- //
1158
- // If the collection is a stack, write in top-to-bottom order. Stacks
1159
- // cannot contain Ice.Object.
1160
- //
1161
- out << nl << "Ice.ObjectPrx[] " << param << "_tmp = " << param << ".ToArray();";
1162
- out << nl << "for(int ix__ = 0; ix__ < " << param << "_tmp.Length; ++ix__)";
1163
- out << sb;
1164
- out << nl << stream << ".writeProxy(" << param << "_tmp[ix__]);";
1165
- out << eb;
1166
- }
1167
- else
1168
- {
1169
- out << nl << "_System.Collections.Generic.IEnumerator<" << typeS
1170
- << "> e__ = " << param << ".GetEnumerator();";
1171
- out << nl << "while(e__.MoveNext())";
1172
- out << sb;
1173
- string func = builtin->kind() == Builtin::KindObject ? "writeObject" : "writeProxy";
1174
- out << nl << stream << '.' << func << "(e__.Current);";
1175
- out << eb;
1176
- }
1177
- }
1178
- else
1179
- {
1180
- out << nl << "for(int ix__ = 0; ix__ < " << param << '.' << limitID << "; ++ix__)";
1181
- out << sb;
1182
- string func = builtin->kind() == Builtin::KindObject ? "writeObject" : "writeProxy";
1183
- out << nl << stream << '.' << func << '(' << param << "[ix__]);";
1184
- out << eb;
1185
- }
1186
- out << eb;
1187
- }
1188
- else
1189
- {
1190
- out << nl << "int " << param << "_lenx = " << stream << ".readAndCheckSeqSize("
1191
- << static_cast<unsigned>(builtin->minWireSize()) << ");";
1192
- if(!isStack)
1193
- {
1194
- out << nl << param << " = new ";
1195
- }
1196
- if(builtin->kind() == Builtin::KindObject)
1197
- {
1198
- if(isArray)
1199
- {
1200
- out << "Ice.Object[" << param << "_lenx];";
1201
- }
1202
- else if(isCustom)
1203
- {
1204
- out << "global::" << genericType << "<Ice.Object>();";
1205
- }
1206
- else if(isGeneric)
1207
- {
1208
- out << "_System.Collections.Generic." << genericType << "<Ice.Object>(";
1209
- if(!isLinkedList)
1210
- {
1211
- out << param << "_lenx";
1212
- }
1213
- out << ");";
1214
- }
1215
- else
1216
- {
1217
- out << typeToString(seq) << "(" << param << "_lenx);";
1218
- }
1219
- out << nl << "for(int ix__ = 0; ix__ < " << param << "_lenx; ++ix__)";
1220
- out << sb;
1221
- out << nl << stream << ".readObject(";
1222
- string patcherName;
1223
- if(isCustom)
1224
- {
1225
- patcherName = "CustomSeq";
1226
- }
1227
- else if(isList)
1228
- {
1229
- patcherName = "List";
1230
- }
1231
- else if(isArray)
1232
- {
1233
- patcherName = "Array";
1234
- }
1235
- else
1236
- {
1237
- patcherName = "Sequence";
1238
- }
1239
- out << "new IceInternal." << patcherName << "Patcher<Ice.Object>(\"::Ice::Object\", "
1240
- << param << ", ix__));";
1241
- }
1242
- else
1243
- {
1244
- if(isStack)
1245
- {
1246
- out << nl << "Ice.ObjectPrx[] " << param << "_tmp = new Ice.ObjectPrx[" << param << "_lenx];";
1247
- }
1248
- else if(isArray)
1249
- {
1250
- out << "Ice.ObjectPrx[" << param << "_lenx];";
1251
- }
1252
- else if(isGeneric)
1253
- {
1254
- out << "_System.Collections.Generic." << genericType << "<Ice.ObjectPrx>(";
1255
- if(!isLinkedList)
1256
- {
1257
- out << param << "_lenx";
1258
- }
1259
- out << ");";
1260
- }
1261
- else
1262
- {
1263
- out << typeToString(seq) << "(" << param << "_lenx);";
1264
- }
1265
- out << nl << "for(int ix__ = 0; ix__ < " << param << "_lenx; ++ix__)";
1266
- out << sb;
1267
- if(isArray || isStack)
1268
- {
1269
- string v = isArray ? param : param + "_tmp";
1270
- out << nl << v << "[ix__] = " << stream << ".readProxy();";
1271
- }
1272
- else
1273
- {
1274
- out << nl << "Ice.ObjectPrx val__ = new Ice.ObjectPrxHelperBase();";
1275
- out << nl << "val__ = " << stream << ".readProxy();";
1276
- out << nl << param << "." << addMethod << "(val__);";
1277
- }
1278
- }
1279
- out << eb;
1280
-
1281
- if(isStack)
1282
- {
1283
- out << nl << "_System.Array.Reverse(" << param << "_tmp);";
1284
- out << nl << param << " = new _System.Collections.Generic." << genericType << "<" << typeS << ">("
1285
- << param << "_tmp);";
1286
- }
1287
- }
1288
- break;
1289
- }
1290
- default:
1291
- {
1292
- string prefix = "clr:serializable:";
1293
- string meta;
1294
- if(seq->findMetaData(prefix, meta))
1295
- {
1296
- if(marshal)
1297
- {
1298
- out << nl << stream << ".writeSerializable(" << param << ");";
1299
- }
1300
- else
1301
- {
1302
- out << nl << param << " = (" << typeToString(seq) << ")" << stream << ".readSerializable();";
1303
- }
1304
- break;
1305
- }
1306
-
1307
- string func = typeS;
1308
- func[0] = toupper(static_cast<unsigned char>(typeS[0]));
1309
- if(marshal)
1310
- {
1311
- if(isArray)
1312
- {
1313
- out << nl << stream << ".write" << func << "Seq(" << param << ");";
1314
- }
1315
- else if(isCollection)
1316
- {
1317
- out << nl << stream << ".write" << func << "Seq(" << param << " == null ? null : "
1318
- << param << ".ToArray());";
1319
- }
1320
- else if(isCustom)
1321
- {
1322
- if(streamingAPI)
1323
- {
1324
- out << nl << stream << ".writeSize(" << param << '.' << limitID << ");";
1325
- out << nl << "_System.Collections.Generic.IEnumerator<" << typeS
1326
- << "> e__ = " << param << ".GetEnumerator();";
1327
- out << nl << "while(e__.MoveNext())";
1328
- out << sb;
1329
- out << nl << stream << ".write" << func << "(e__.Current);";
1330
- out << eb;
1331
- }
1332
- else
1333
- {
1334
- out << nl << stream << ".write" << func << "Seq(" << param << " == null ? 0 : "
1335
- << param << ".Count, " << param << ");";
1336
- }
1337
- }
1338
- else
1339
- {
1340
- assert(isGeneric);
1341
- if(!streamingAPI)
1342
- {
1343
- out << nl << stream << ".write" << func << "Seq(" << param << " == null ? 0 : "
1344
- << param << ".Count, " << param << ");";
1345
- }
1346
- else if(isLinkedList)
1347
- {
1348
- out << nl << stream << ".writeSize(" << param << '.' << limitID << ");";
1349
- out << nl << "_System.Collections.Generic.IEnumerator<" << typeS
1350
- << "> e__ = " << param << ".GetEnumerator();";
1351
- out << nl << "while(e__.MoveNext())";
1352
- out << sb;
1353
- out << nl << stream << ".write" << func << "(e__.Current);";
1354
- out << eb;
1355
- }
1356
- else
1357
- {
1358
- out << nl << stream << ".write" << func << "Seq(" << param << " == null ? null : "
1359
- << param << ".ToArray());";
1360
- }
1361
- }
1362
- }
1363
- else
1364
- {
1365
- if(isArray)
1366
- {
1367
- out << nl << param << " = " << stream << ".read" << func << "Seq();";
1368
- }
1369
- else if(isCustom)
1370
- {
1371
- out << sb;
1372
- out << nl << param << " = new " << "global::" << genericType << "<"
1373
- << typeToString(type) << ">();";
1374
- out << nl << "int szx__ = " << stream << ".readSize();";
1375
- out << nl << "for(int ix__ = 0; ix__ < szx__; ++ix__)";
1376
- out << sb;
1377
- out << nl << param << ".Add(" << stream << ".read" << func << "());";
1378
- out << eb;
1379
- out << eb;
1380
- }
1381
- else if(isCollection)
1382
- {
1383
- out << nl << param << " = new " << fixId(seq->scoped())
1384
- << '(' << stream << ".read" << func << "Seq());";
1385
- }
1386
- else
1387
- {
1388
- assert(isGeneric);
1389
- if(streamingAPI)
1390
- {
1391
- if(isStack)
1392
- {
1393
- //
1394
- // Stacks are marshaled in top-to-bottom order. The "Stack(type[])"
1395
- // constructor assumes the array is in bottom-to-top order, so we
1396
- // read the array first, then reverse it.
1397
- //
1398
- out << nl << typeS << "[] arr__ = " << stream << ".read" << func << "Seq();";
1399
- out << nl << "_System.Array.Reverse(arr__);";
1400
- out << nl << param << " = new " << typeToString(seq) << "(arr__);";
1401
- }
1402
- else
1403
- {
1404
- out << nl << param << " = new " << typeToString(seq) << '(' << stream
1405
- << ".read" << func << "Seq());";
1406
- }
1407
- }
1408
- else
1409
- {
1410
- out << nl << stream << ".read" << func << "Seq(out " << param << ");";
1411
- }
1412
- }
1413
- }
1414
- break;
1415
- }
1416
- }
1417
- return;
1418
- }
1419
-
1420
- ClassDeclPtr cl = ClassDeclPtr::dynamicCast(type);
1421
- if(cl)
1422
- {
1423
- if(marshal)
1424
- {
1425
- out << nl << "if(" << param << " == null)";
1426
- out << sb;
1427
- out << nl << stream << ".writeSize(0);";
1428
- out << eb;
1429
- out << nl << "else";
1430
- out << sb;
1431
- out << nl << stream << ".writeSize(" << param << '.' << limitID << ");";
1432
- if(isGeneric && !isList)
1433
- {
1434
- //
1435
- // Stacks cannot contain class instances, so there is no need to marshal a
1436
- // stack bottom-up here.
1437
- //
1438
- out << nl << "_System.Collections.Generic.IEnumerator<" << typeS
1439
- << "> e__ = " << param << ".GetEnumerator();";
1440
- out << nl << "while(e__.MoveNext())";
1441
- out << sb;
1442
- out << nl << stream << ".writeObject(e__.Current);";
1443
- out << eb;
1444
- }
1445
- else
1446
- {
1447
- out << nl << "for(int ix__ = 0; ix__ < " << param << '.' << limitID << "; ++ix__)";
1448
- out << sb;
1449
- out << nl << stream << ".writeObject(" << param << "[ix__]);";
1450
- out << eb;
1451
- }
1452
- out << eb;
1453
- }
1454
- else
1455
- {
1456
- out << sb;
1457
- out << nl << "int szx__ = " << stream << ".readAndCheckSeqSize("
1458
- << static_cast<unsigned>(type->minWireSize()) << ");";
1459
- out << nl << param << " = new ";
1460
- if(isArray)
1461
- {
1462
- out << toArrayAlloc(typeS + "[]", "szx__");
1463
- }
1464
- else if(isCustom)
1465
- {
1466
- out << "global::" << genericType << "<" << typeS << ">()";
1467
- }
1468
- else if(isGeneric)
1469
- {
1470
- out << "_System.Collections.Generic." << genericType << "<" << typeS << ">(";
1471
- if(!isLinkedList)
1472
- {
1473
- out << "szx__";
1474
- }
1475
- out << ")";
1476
- }
1477
- else
1478
- {
1479
- out << fixId(seq->scoped()) << "(szx__)";
1480
- }
1481
- out << ';';
1482
- out << nl << "for(int ix__ = 0; ix__ < szx__; ++ix__)";
1483
- out << sb;
1484
-
1485
- string patcherName;
1486
- if(isCustom)
1487
- {
1488
- patcherName = "CustomSeq";
1489
- }
1490
- else if(isList)
1491
- {
1492
- patcherName = "List";
1493
- }
1494
- else if(isArray)
1495
- {
1496
- patcherName = "Array";
1497
- }
1498
- else
1499
- {
1500
- patcherName = "Sequence";
1501
- }
1502
- string scoped = ContainedPtr::dynamicCast(type)->scoped();
1503
- out << nl << "IceInternal." << patcherName << "Patcher<" << typeS << "> spx = new IceInternal."
1504
- << patcherName << "Patcher<" << typeS << ">(\"" << scoped << "\", " << param << ", ix__);";
1505
- out << nl << stream << ".readObject(";
1506
- out << "spx);";
1507
- out << eb;
1508
- out << eb;
1509
- }
1510
- return;
1511
- }
1512
-
1513
- StructPtr st = StructPtr::dynamicCast(type);
1514
- if(st)
1515
- {
1516
- if(marshal)
1517
- {
1518
- out << nl << "if(" << param << " == null)";
1519
- out << sb;
1520
- out << nl << stream << ".writeSize(0);";
1521
- out << eb;
1522
- out << nl << "else";
1523
- out << sb;
1524
- out << nl << stream << ".writeSize(" << param << '.' << limitID << ");";
1525
- if(isGeneric && !isList)
1526
- {
1527
- //
1528
- // Stacks are marshaled top-down.
1529
- //
1530
- if(isStack)
1531
- {
1532
- out << nl << typeS << "[] " << param << "_tmp = " << param << ".ToArray();";
1533
- out << nl << "for(int ix__ = 0; ix__ < " << param << "_tmp.Length; ++ix__)";
1534
- }
1535
- else
1536
- {
1537
- out << nl << "_System.Collections.Generic.IEnumerator<" << typeS
1538
- << "> e__ = " << param << ".GetEnumerator();";
1539
- out << nl << "while(e__.MoveNext())";
1540
- }
1541
- }
1542
- else
1543
- {
1544
- out << nl << "for(int ix__ = 0; ix__ < " << param << '.' << limitID << "; ++ix__)";
1545
- }
1546
- out << sb;
1547
- string call;
1548
- if(isGeneric && !isList && !isStack)
1549
- {
1550
- if(isValueType(type))
1551
- {
1552
- call = "e__.Current";
1553
- }
1554
- else
1555
- {
1556
- call = "(e__.Current == null ? new ";
1557
- call += typeS + "() : e__.Current)";
1558
- }
1559
- }
1560
- else
1561
- {
1562
- if(isValueType(type))
1563
- {
1564
- call = param;
1565
- if(isStack)
1566
- {
1567
- call += "_tmp";
1568
- }
1569
- }
1570
- else
1571
- {
1572
- call = "(";
1573
- call += param;
1574
- if(isStack)
1575
- {
1576
- call += "_tmp";
1577
- }
1578
- call += "[ix__] == null ? new " + typeS + "() : " + param;
1579
- if(isStack)
1580
- {
1581
- call += "_tmp";
1582
- }
1583
- }
1584
- call += "[ix__]";
1585
- if(!isValueType(type))
1586
- {
1587
- call += ")";
1588
- }
1589
- }
1590
- call += ".";
1591
- call += streamingAPI ? "ice_write" : "write__";
1592
- call += "(" + stream + ");";
1593
- out << nl << call;
1594
- out << eb;
1595
- out << eb;
1596
- }
1597
- else
1598
- {
1599
- out << sb;
1600
- out << nl << "int szx__ = " << stream << ".readAndCheckSeqSize("
1601
- << static_cast<unsigned>(type->minWireSize()) << ");";
1602
- if(isArray)
1603
- {
1604
- out << nl << param << " = new " << toArrayAlloc(typeS + "[]", "szx__") << ";";
1605
- }
1606
- else if(isCustom)
1607
- {
1608
- out << nl << param << " = new global::" << genericType << "<" << typeS << ">();";
1609
- }
1610
- else if(isStack)
1611
- {
1612
- out << nl << typeS << "[] " << param << "__tmp = new " << toArrayAlloc(typeS + "[]", "szx__") << ";";
1613
- }
1614
- else if(isGeneric)
1615
- {
1616
- out << nl << param << " = new _System.Collections.Generic." << genericType << "<" << typeS << ">(";
1617
- if(!isLinkedList)
1618
- {
1619
- out << "szx__";
1620
- }
1621
- out << ");";
1622
- }
1623
- else
1624
- {
1625
- out << nl << param << " = new " << fixId(seq->scoped()) << "(szx__);";
1626
- }
1627
- out << nl << "for(int ix__ = 0; ix__ < szx__; ++ix__)";
1628
- out << sb;
1629
- if(isArray || isStack)
1630
- {
1631
- string v = isArray ? param : param + "__tmp";
1632
- if(!isValueType(st))
1633
- {
1634
- out << nl << v << "[ix__] = new " << typeS << "();";
1635
- }
1636
- if(streamingAPI)
1637
- {
1638
- out << nl << v << "[ix__].ice_read(" << stream << ");";
1639
- }
1640
- else
1641
- {
1642
- out << nl << v << "[ix__].read__(" << stream << ");";
1643
- }
1644
- }
1645
- else
1646
- {
1647
- out << nl << typeS << " val__ = new " << typeS << "();";
1648
- if(streamingAPI)
1649
- {
1650
- out << nl << "val__.ice_read(" << stream << ");";
1651
- }
1652
- else
1653
- {
1654
- out << nl << "val__.read__(" << stream << ");";
1655
- }
1656
- out << nl << param << "." << addMethod << "(val__);";
1657
- }
1658
- out << eb;
1659
- if(isStack)
1660
- {
1661
- out << nl << "_System.Array.Reverse(" << param << "__tmp);";
1662
- out << nl << param << " = new _System.Collections.Generic." << genericType << "<" << typeS << ">("
1663
- << param << "__tmp);";
1664
- }
1665
- out << eb;
1666
- }
1667
- return;
1668
- }
1669
-
1670
- EnumPtr en = EnumPtr::dynamicCast(type);
1671
- if(en)
1672
- {
1673
- if(marshal)
1674
- {
1675
- out << nl << "if(" << param << " == null)";
1676
- out << sb;
1677
- out << nl << stream << ".writeSize(0);";
1678
- out << eb;
1679
- out << nl << "else";
1680
- out << sb;
1681
- out << nl << stream << ".writeSize(" << param << '.'<< limitID << ");";
1682
- if(isGeneric && !isList)
1683
- {
1684
- //
1685
- // Stacks are marshaled top-down.
1686
- //
1687
- if(isStack)
1688
- {
1689
- out << nl << typeS << "[] " << param << "_tmp = " << param << ".ToArray();";
1690
- out << nl << "for(int ix__ = 0; ix__ < " << param << "_tmp.Length; ++ix__)";
1691
- out << sb;
1692
- out << nl << stream << ".writeEnum((int)" << param << "_tmp[ix__], " << en->maxValue() << ");";
1693
- out << eb;
1694
- }
1695
- else
1696
- {
1697
- out << nl << "_System.Collections.Generic.IEnumerator<" << typeS
1698
- << "> e__ = " << param << ".GetEnumerator();";
1699
- out << nl << "while(e__.MoveNext())";
1700
- out << sb;
1701
- out << nl << stream << ".writeEnum((int)e__.Current, " << en->maxValue() << ");";
1702
- out << eb;
1703
- }
1704
- }
1705
- else
1706
- {
1707
- out << nl << "for(int ix__ = 0; ix__ < " << param << '.' << limitID << "; ++ix__)";
1708
- out << sb;
1709
- out << nl << stream << ".writeEnum((int)" << param << "[ix__], " << en->maxValue() << ");";
1710
- out << eb;
1711
- }
1712
- out << eb;
1713
- }
1714
- else
1715
- {
1716
- out << sb;
1717
- out << nl << "int szx__ = " << stream << ".readAndCheckSeqSize(" <<
1718
- static_cast<unsigned>(type->minWireSize()) << ");";
1719
- if(isArray)
1720
- {
1721
- out << nl << param << " = new " << toArrayAlloc(typeS + "[]", "szx__") << ";";
1722
- }
1723
- else if(isCustom)
1724
- {
1725
- out << nl << param << " = new global::" << genericType << "<" << typeS << ">();";
1726
- }
1727
- else if(isStack)
1728
- {
1729
- out << nl << typeS << "[] " << param << "__tmp = new " << toArrayAlloc(typeS + "[]", "szx__") << ";";
1730
- }
1731
- else if(isGeneric)
1732
- {
1733
- out << nl << param << " = new _System.Collections.Generic." << genericType << "<" << typeS << ">(";
1734
- if(!isLinkedList)
1735
- {
1736
- out << "szx__";
1737
- }
1738
- out << ");";
1739
- }
1740
- else
1741
- {
1742
- out << nl << param << " = new " << fixId(seq->scoped()) << "(szx__);";
1743
- }
1744
- out << nl << "for(int ix__ = 0; ix__ < szx__; ++ix__)";
1745
- out << sb;
1746
- if(isArray || isStack)
1747
- {
1748
- string v = isArray ? param : param + "__tmp";
1749
- out << nl << v << "[ix__] = (" << typeS << ')' << stream << ".readEnum(" << en->maxValue() << ");";
1750
- }
1751
- else
1752
- {
1753
- out << nl << param << "." << addMethod << "((" << typeS << ')' << stream << ".readEnum("
1754
- << en->maxValue() << "));";
1755
- }
1756
- out << eb;
1757
- if(isStack)
1758
- {
1759
- out << nl << "_System.Array.Reverse(" << param << "__tmp);";
1760
- out << nl << param << " = new _System.Collections.Generic." << genericType << "<" << typeS << ">("
1761
- << param << "__tmp);";
1762
- }
1763
- out << eb;
1764
- }
1765
- return;
1766
- }
1767
-
1768
- string helperName;
1769
- if(ProxyPtr::dynamicCast(type))
1770
- {
1771
- helperName = fixId(ProxyPtr::dynamicCast(type)->_class()->scoped() + "PrxHelper");
1772
- }
1773
- else
1774
- {
1775
- helperName = fixId(ContainedPtr::dynamicCast(type)->scoped() + "Helper");
1776
- }
1777
-
1778
- string func;
1779
- if(marshal)
1780
- {
1781
- func = "write";
1782
- if(!streamingAPI && ProxyPtr::dynamicCast(type))
1783
- {
1784
- func += "__";
1785
- }
1786
- out << nl << "if(" << param << " == null)";
1787
- out << sb;
1788
- out << nl << stream << ".writeSize(0);";
1789
- out << eb;
1790
- out << nl << "else";
1791
- out << sb;
1792
- out << nl << stream << ".writeSize(" << param << '.' << limitID << ");";
1793
- if(isGeneric && !isList)
1794
- {
1795
- //
1796
- // Stacks are marshaled top-down.
1797
- //
1798
- if(isStack)
1799
- {
1800
- out << nl << typeS << "[] " << param << "_tmp = " << param << ".ToArray();";
1801
- out << nl << "for(int ix__ = 0; ix__ < " << param << "_tmp.Length; ++ix__)";
1802
- out << sb;
1803
- out << nl << helperName << '.' << func << '(' << stream << ", " << param << "_tmp[ix__]);";
1804
- out << eb;
1805
- }
1806
- else
1807
- {
1808
- out << nl << "_System.Collections.Generic.IEnumerator<" << typeS
1809
- << "> e__ = " << param << ".GetEnumerator();";
1810
- out << nl << "while(e__.MoveNext())";
1811
- out << sb;
1812
- out << nl << helperName << '.' << func << '(' << stream << ", e__.Current);";
1813
- out << eb;
1814
- }
1815
- }
1816
- else
1817
- {
1818
- out << nl << "for(int ix__ = 0; ix__ < " << param << '.' << limitID << "; ++ix__)";
1819
- out << sb;
1820
- out << nl << helperName << '.' << func << '(' << stream << ", " << param << "[ix__]);";
1821
- out << eb;
1822
- }
1823
- out << eb;
1824
- }
1825
- else
1826
- {
1827
- func = "read";
1828
- if(!streamingAPI && ProxyPtr::dynamicCast(type))
1829
- {
1830
- func += "__";
1831
- }
1832
- out << sb;
1833
- out << nl << "int szx__ = " << stream << ".readAndCheckSeqSize("
1834
- << static_cast<unsigned>(type->minWireSize()) << ");";
1835
- if(isArray)
1836
- {
1837
- out << nl << param << " = new " << toArrayAlloc(typeS + "[]", "szx__") << ";";
1838
- }
1839
- else if(isCustom)
1840
- {
1841
- out << nl << param << " = new global::" << genericType << "<" << typeS << ">();";
1842
- }
1843
- else if(isStack)
1844
- {
1845
- out << nl << typeS << "[] " << param << "__tmp = new " << toArrayAlloc(typeS + "[]", "szx__") << ";";
1846
- }
1847
- else if(isGeneric)
1848
- {
1849
- out << nl << param << " = new _System.Collections.Generic." << genericType << "<" << typeS << ">();";
1850
- }
1851
- else
1852
- {
1853
- out << nl << param << " = new " << fixId(seq->scoped()) << "(szx__);";
1854
- }
1855
- out << nl << "for(int ix__ = 0; ix__ < szx__; ++ix__)";
1856
- out << sb;
1857
- if(isArray || isStack)
1858
- {
1859
- string v = isArray ? param : param + "__tmp";
1860
- out << nl << v << "[ix__] = " << helperName << '.' << func << '(' << stream << ");";
1861
- }
1862
- else
1863
- {
1864
- out << nl << param << "." << addMethod << "(" << helperName << '.' << func << '(' << stream << "));";
1865
- }
1866
- out << eb;
1867
- if(isStack)
1868
- {
1869
- out << nl << "_System.Array.Reverse(" << param << "__tmp);";
1870
- out << nl << param << " = new _System.Collections.Generic." << genericType << "<" << typeS << ">("
1871
- << param << "__tmp);";
1872
- }
1873
- out << eb;
1874
- }
1875
-
1876
- return;
1877
- }
1878
-
1879
- void
1880
- Slice::CsGenerator::writeOptionalSequenceMarshalUnmarshalCode(Output& out,
1881
- const SequencePtr& seq,
1882
- const string& param,
1883
- int tag,
1884
- bool marshal,
1885
- bool streamingAPI)
1886
- {
1887
- string stream;
1888
- if(marshal)
1889
- {
1890
- stream = streamingAPI ? "outS__" : "os__";
1891
- }
1892
- else
1893
- {
1894
- stream = streamingAPI ? "inS__" : "is__";
1895
- }
1896
-
1897
- const TypePtr type = seq->type();
1898
- const string typeS = typeToString(type);
1899
- const string seqS = typeToString(seq);
1900
-
1901
- string meta;
1902
- const bool isArray = !seq->findMetaData("clr:generic:", meta) && !seq->hasMetaData("clr:collection");
1903
- const string length = isArray ? param + ".Value.Length" : param + ".Value.Count";
1904
-
1905
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
1906
- if(builtin)
1907
- {
1908
- switch(builtin->kind())
1909
- {
1910
- case Builtin::KindByte:
1911
- case Builtin::KindBool:
1912
- case Builtin::KindShort:
1913
- case Builtin::KindInt:
1914
- case Builtin::KindFloat:
1915
- case Builtin::KindLong:
1916
- case Builtin::KindDouble:
1917
- case Builtin::KindString:
1918
- {
1919
- string func = typeS;
1920
- func[0] = toupper(static_cast<unsigned char>(typeS[0]));
1921
- const bool isSerializable = seq->findMetaData("clr:serializable:", meta);
1922
-
1923
- if(marshal)
1924
- {
1925
- if(isSerializable)
1926
- {
1927
- out << nl << "if(" << param << ".HasValue && " << stream << ".writeOpt(" << tag
1928
- << ", Ice.OptionalFormat.VSize))";
1929
- out << sb;
1930
- out << nl << stream << ".writeSerializable(" << param << ".Value);";
1931
- out << eb;
1932
- }
1933
- else if(isArray)
1934
- {
1935
- out << nl << stream << ".write" << func << "Seq(" << tag << ", " << param << ");";
1936
- }
1937
- else
1938
- {
1939
- out << nl << "if(" << param << ".HasValue)";
1940
- out << sb;
1941
- out << nl << stream << ".write" << func << "Seq(" << tag << ", " << param
1942
- << ".Value == null ? 0 : " << param << ".Value.Count, " << param << ".Value);";
1943
- out << eb;
1944
- }
1945
- }
1946
- else
1947
- {
1948
- out << nl << "if(" << stream << ".readOpt(" << tag << ", " << getOptionalFormat(seq) << "))";
1949
- out << sb;
1950
- if(builtin->isVariableLength())
1951
- {
1952
- out << nl << stream << ".skip(4);";
1953
- }
1954
- else if(builtin->kind() != Builtin::KindByte && builtin->kind() != Builtin::KindBool)
1955
- {
1956
- out << nl << stream << ".skipSize();";
1957
- }
1958
- string tmp = "tmpVal__";
1959
- out << nl << seqS << ' ' << tmp << ';';
1960
- writeSequenceMarshalUnmarshalCode(out, seq, tmp, marshal, streamingAPI, true);
1961
- out << nl << param << " = new Ice.Optional<" << seqS << ">(" << tmp << ");";
1962
- out << eb;
1963
- out << nl << "else";
1964
- out << sb;
1965
- out << nl << param << " = new Ice.Optional<" << seqS << ">();";
1966
- out << eb;
1967
- }
1968
- break;
1969
- }
1970
-
1971
- case Builtin::KindObject:
1972
- case Builtin::KindObjectProxy:
1973
- {
1974
- if(marshal)
1975
- {
1976
- out << nl << "if(" << param << ".HasValue && " << stream << ".writeOpt(" << tag << ", "
1977
- << getOptionalFormat(seq) << "))";
1978
- out << sb;
1979
- out << nl << "int pos__ = " << stream << ".startSize();";
1980
- writeSequenceMarshalUnmarshalCode(out, seq, param + ".Value", marshal, streamingAPI, true);
1981
- out << nl << stream << ".endSize(pos__);";
1982
- out << eb;
1983
- }
1984
- else
1985
- {
1986
- out << nl << "if(" << stream << ".readOpt(" << tag << ", " << getOptionalFormat(seq) << "))";
1987
- out << sb;
1988
- out << nl << stream << ".skip(4);";
1989
- string tmp = "tmpVal__";
1990
- out << nl << seqS << ' ' << tmp << ';';
1991
- writeSequenceMarshalUnmarshalCode(out, seq, tmp, marshal, streamingAPI, true);
1992
- out << nl << param << " = new Ice.Optional<" << seqS << ">(" << tmp << ");";
1993
- out << eb;
1994
- out << nl << "else";
1995
- out << sb;
1996
- out << nl << param << " = new Ice.Optional<" << seqS << ">();";
1997
- out << eb;
1998
- }
1999
- break;
2000
- }
2001
-
2002
- case Builtin::KindLocalObject:
2003
- assert(false);
2004
- }
2005
-
2006
- return;
2007
- }
2008
-
2009
- StructPtr st = StructPtr::dynamicCast(type);
2010
- if(st)
2011
- {
2012
- if(marshal)
2013
- {
2014
- out << nl << "if(" << param << ".HasValue && " << stream << ".writeOpt(" << tag << ", "
2015
- << getOptionalFormat(seq) << "))";
2016
- out << sb;
2017
- if(st->isVariableLength())
2018
- {
2019
- out << nl << "int pos__ = " << stream << ".startSize();";
2020
- }
2021
- else if(st->minWireSize() > 1)
2022
- {
2023
- out << nl << stream << ".writeSize(" << param << ".Value == null ? 1 : " << length << " * "
2024
- << st->minWireSize() << " + (" << length << " > 254 ? 5 : 1));";
2025
- }
2026
- writeSequenceMarshalUnmarshalCode(out, seq, param + ".Value", marshal, streamingAPI, true);
2027
- if(st->isVariableLength())
2028
- {
2029
- out << nl << stream << ".endSize(pos__);";
2030
- }
2031
- out << eb;
2032
- }
2033
- else
2034
- {
2035
- out << nl << "if(" << stream << ".readOpt(" << tag << ", " << getOptionalFormat(seq) << "))";
2036
- out << sb;
2037
- if(st->isVariableLength())
2038
- {
2039
- out << nl << stream << ".skip(4);";
2040
- }
2041
- else if(st->minWireSize() > 1)
2042
- {
2043
- out << nl << stream << ".skipSize();";
2044
- }
2045
- string tmp = "tmpVal__";
2046
- out << nl << seqS << ' ' << tmp << ';';
2047
- writeSequenceMarshalUnmarshalCode(out, seq, tmp, marshal, streamingAPI, true);
2048
- out << nl << param << " = new Ice.Optional<" << seqS << ">(" << tmp << ");";
2049
- out << eb;
2050
- out << nl << "else";
2051
- out << sb;
2052
- out << nl << param << " = new Ice.Optional<" << seqS << ">();";
2053
- out << eb;
2054
- }
2055
- return;
2056
- }
2057
-
2058
- //
2059
- // At this point, all remaining element types have variable size.
2060
- //
2061
- if(marshal)
2062
- {
2063
- out << nl << "if(" << param << ".HasValue && " << stream << ".writeOpt(" << tag << ", "
2064
- << getOptionalFormat(seq) << "))";
2065
- out << sb;
2066
- out << nl << "int pos__ = " << stream << ".startSize();";
2067
- writeSequenceMarshalUnmarshalCode(out, seq, param + ".Value", marshal, streamingAPI, true);
2068
- out << nl << stream << ".endSize(pos__);";
2069
- out << eb;
2070
- }
2071
- else
2072
- {
2073
- out << nl << "if(" << stream << ".readOpt(" << tag << ", " << getOptionalFormat(seq) << "))";
2074
- out << sb;
2075
- out << nl << stream << ".skip(4);";
2076
- string tmp = "tmpVal__";
2077
- out << nl << seqS << ' ' << tmp << ';';
2078
- writeSequenceMarshalUnmarshalCode(out, seq, tmp, marshal, streamingAPI, true);
2079
- out << nl << param << " = new Ice.Optional<" << seqS << ">(" << tmp << ");";
2080
- out << eb;
2081
- out << nl << "else";
2082
- out << sb;
2083
- out << nl << param << " = new Ice.Optional<" << seqS << ">();";
2084
- out << eb;
2085
- }
2086
- }
2087
-
2088
- void
2089
- Slice::CsGenerator::writeSerializeDeserializeCode(Output &out,
2090
- const TypePtr& type,
2091
- const string& param,
2092
- bool optional,
2093
- int tag,
2094
- bool serialize)
2095
- {
2096
- if(!isSerializable(type))
2097
- {
2098
- return;
2099
- }
2100
-
2101
- if(optional)
2102
- {
2103
- const string typeName = typeToString(type, true);
2104
- if(serialize)
2105
- {
2106
- out << nl << "info__.AddValue(\"" << param << "\", " << param << ", typeof(" << typeName << "));";
2107
- }
2108
- else
2109
- {
2110
- out << nl << param << " = (" << typeName << ")info__.GetValue(\"" << param << "\", typeof(" << typeName
2111
- << "));";
2112
- }
2113
- return;
2114
- }
2115
-
2116
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
2117
- if(builtin)
2118
- {
2119
- switch(builtin->kind())
2120
- {
2121
- case Builtin::KindByte:
2122
- {
2123
- if(serialize)
2124
- {
2125
- out << nl << "info__.AddValue(\"" << param << "\", " << param << ");";
2126
- }
2127
- else
2128
- {
2129
- out << nl << param << " = " << "info__.GetByte(\"" << param << "\");";
2130
- }
2131
- break;
2132
- }
2133
- case Builtin::KindBool:
2134
- {
2135
- if(serialize)
2136
- {
2137
- out << nl << "info__.AddValue(\"" << param << "\", " << param << ");";
2138
- }
2139
- else
2140
- {
2141
- out << nl << param << " = " << "info__.GetBoolean(\"" << param << "\");";
2142
- }
2143
- break;
2144
- }
2145
- case Builtin::KindShort:
2146
- {
2147
- if(serialize)
2148
- {
2149
- out << nl << "info__.AddValue(\"" << param << "\", " << param << ");";
2150
- }
2151
- else
2152
- {
2153
- out << nl << param << " = " << "info__.GetInt16(\"" << param << "\");";
2154
- }
2155
- break;
2156
- }
2157
- case Builtin::KindInt:
2158
- {
2159
- if(serialize)
2160
- {
2161
- out << nl << "info__.AddValue(\"" << param << "\", " << param << ");";
2162
- }
2163
- else
2164
- {
2165
- out << nl << param << " = " << "info__.GetInt32(\"" << param << "\");";
2166
- }
2167
- break;
2168
- }
2169
- case Builtin::KindLong:
2170
- {
2171
- if(serialize)
2172
- {
2173
- out << nl << "info__.AddValue(\"" << param << "\", " << param << ");";
2174
- }
2175
- else
2176
- {
2177
- out << nl << param << " = " << "info__.GetInt64(\"" << param << "\");";
2178
- }
2179
- break;
2180
- }
2181
- case Builtin::KindFloat:
2182
- {
2183
- if(serialize)
2184
- {
2185
- out << nl << "info__.AddValue(\"" << param << "\", " << param << ");";
2186
- }
2187
- else
2188
- {
2189
- out << nl << param << " = " << "info__.GetSingle(\"" << param << "\");";
2190
- }
2191
- break;
2192
- }
2193
- case Builtin::KindDouble:
2194
- {
2195
- if(serialize)
2196
- {
2197
- out << nl << "info__.AddValue(\"" << param << "\", " << param << ");";
2198
- }
2199
- else
2200
- {
2201
- out << nl << param << " = " << "info__.GetDouble(\"" << param << "\");";
2202
- }
2203
- break;
2204
- }
2205
- case Builtin::KindString:
2206
- {
2207
- if(serialize)
2208
- {
2209
- out << nl << "info__.AddValue(\"" << param << "\", " << param << " == null ? \"\" : " << param
2210
- << ");";
2211
- }
2212
- else
2213
- {
2214
- out << nl << param << " = " << "info__.GetString(\"" << param << "\");";
2215
- }
2216
- break;
2217
- }
2218
- case Builtin::KindObject:
2219
- case Builtin::KindLocalObject:
2220
- {
2221
- const string typeName = typeToString(type, false);
2222
- if(serialize)
2223
- {
2224
- out << nl << "info__.AddValue(\"" << param << "\", " << param << ", typeof(" << typeName << "));";
2225
- }
2226
- else
2227
- {
2228
- out << nl << param << " = (" << typeName << ")info__.GetValue(\"" << param << "\", typeof("
2229
- << typeName << "));";
2230
- }
2231
- break;
2232
- }
2233
- case Builtin::KindObjectProxy:
2234
- {
2235
- //
2236
- // Proxies cannot be serialized.
2237
- //
2238
- break;
2239
- }
2240
- }
2241
- return;
2242
- }
2243
-
2244
- ProxyPtr prx = ProxyPtr::dynamicCast(type);
2245
- if(prx)
2246
- {
2247
- //
2248
- // Proxies cannot be serialized.
2249
- //
2250
- return;
2251
- }
2252
-
2253
- ClassDeclPtr cl = ClassDeclPtr::dynamicCast(type);
2254
- if(cl)
2255
- {
2256
- const string typeName = typeToString(type, false);
2257
- if(serialize)
2258
- {
2259
- out << nl << "info__.AddValue(\"" << param << "\", " << param << ", typeof(" << typeName << "));";
2260
- }
2261
- else
2262
- {
2263
- out << nl << param << " = (" << typeName << ")info__.GetValue(\"" << param << "\", typeof(" << typeName
2264
- << "));";
2265
- }
2266
- return;
2267
- }
2268
-
2269
- StructPtr st = StructPtr::dynamicCast(type);
2270
- if(st)
2271
- {
2272
- const string typeName = typeToString(type, false);
2273
- if(serialize)
2274
- {
2275
- out << nl << "info__.AddValue(\"" << param << "\", " << param << ", typeof(" << typeName << "));";
2276
- }
2277
- else
2278
- {
2279
- out << nl << param << " = (" << typeName << ")info__.GetValue(\"" << param << "\", typeof(" << typeName
2280
- << "));";
2281
- }
2282
- return;
2283
- }
2284
-
2285
- EnumPtr en = EnumPtr::dynamicCast(type);
2286
- if(en)
2287
- {
2288
- const string typeName = typeToString(type, false);
2289
- if(serialize)
2290
- {
2291
- out << nl << "info__.AddValue(\"" << param << "\", " << param << ", typeof(" << typeName << "));";
2292
- }
2293
- else
2294
- {
2295
- out << nl << param << " = (" << typeName << ")info__.GetValue(\"" << param << "\", typeof(" << typeName
2296
- << "));";
2297
- }
2298
- return;
2299
- }
2300
-
2301
- SequencePtr seq = SequencePtr::dynamicCast(type);
2302
- if(seq)
2303
- {
2304
- const string typeName = typeToString(type, false);
2305
- if(serialize)
2306
- {
2307
- out << nl << "info__.AddValue(\"" << param << "\", " << param << ", typeof(" << typeName << "));";
2308
- }
2309
- else
2310
- {
2311
- out << nl << param << " = (" << typeName << ")info__.GetValue(\"" << param << "\", typeof(" << typeName
2312
- << "));";
2313
- }
2314
- return;
2315
- }
2316
-
2317
- DictionaryPtr d = DictionaryPtr::dynamicCast(type);
2318
- assert(d);
2319
- const string typeName = typeToString(type, false);
2320
- if(serialize)
2321
- {
2322
- out << nl << "info__.AddValue(\"" << param << "\", " << param << ", typeof(" << typeName << "));";
2323
- }
2324
- else
2325
- {
2326
- out << nl << param << " = (" << typeName << ")info__.GetValue(\"" << param << "\", typeof(" << typeName
2327
- << "));";
2328
- }
2329
- }
2330
-
2331
- string
2332
- Slice::CsGenerator::toArrayAlloc(const string& decl, const string& sz)
2333
- {
2334
- int count = 0;
2335
- string::size_type pos = decl.size();
2336
- while(pos > 1 && decl.substr(pos - 2, 2) == "[]")
2337
- {
2338
- ++count;
2339
- pos -= 2;
2340
- }
2341
- assert(count > 0);
2342
-
2343
- ostringstream o;
2344
- o << decl.substr(0, pos) << '[' << sz << ']' << decl.substr(pos + 2);
2345
- return o.str();
2346
- }
2347
-
2348
- void
2349
- Slice::CsGenerator::validateMetaData(const UnitPtr& u)
2350
- {
2351
- MetaDataVisitor visitor;
2352
- u->visit(&visitor, true);
2353
- }
2354
-
2355
- bool
2356
- Slice::CsGenerator::MetaDataVisitor::visitUnitStart(const UnitPtr& p)
2357
- {
2358
- //
2359
- // Validate global metadata in the top-level file and all included files.
2360
- //
2361
- StringList files = p->allFiles();
2362
-
2363
- for(StringList::iterator q = files.begin(); q != files.end(); ++q)
2364
- {
2365
- string file = *q;
2366
- DefinitionContextPtr dc = p->findDefinitionContext(file);
2367
- assert(dc);
2368
- StringList globalMetaData = dc->getMetaData();
2369
- StringList newGlobalMetaData;
2370
-
2371
- static const string csPrefix = "cs:";
2372
- static const string clrPrefix = "clr:";
2373
- for(StringList::const_iterator r = globalMetaData.begin(); r != globalMetaData.end(); ++r)
2374
- {
2375
- string s = *r;
2376
-
2377
- if(s.find(csPrefix) == 0)
2378
- {
2379
- static const string csAttributePrefix = csPrefix + "attribute:";
2380
- if(s.find(csAttributePrefix) == 0 && s.size() > csAttributePrefix.size())
2381
- {
2382
- newGlobalMetaData.push_back(s);
2383
- continue;
2384
- }
2385
- emitWarning(file, -1, "ignoring invalid global metadata `" + s + "'");
2386
- }
2387
- else if(s.find(clrPrefix) == 0)
2388
- {
2389
- emitWarning(file, -1, "ignoring invalid global metadata `" + s + "'");
2390
- }
2391
- else
2392
- {
2393
- newGlobalMetaData.push_back(s);
2394
- }
2395
- }
2396
- dc->setMetaData(newGlobalMetaData);
2397
- }
2398
- return true;
2399
- }
2400
-
2401
- bool
2402
- Slice::CsGenerator::MetaDataVisitor::visitModuleStart(const ModulePtr& p)
2403
- {
2404
- validate(p);
2405
- return true;
2406
- }
2407
-
2408
- void
2409
- Slice::CsGenerator::MetaDataVisitor::visitModuleEnd(const ModulePtr&)
2410
- {
2411
- }
2412
-
2413
- void
2414
- Slice::CsGenerator::MetaDataVisitor::visitClassDecl(const ClassDeclPtr& p)
2415
- {
2416
- validate(p);
2417
- }
2418
-
2419
- bool
2420
- Slice::CsGenerator::MetaDataVisitor::visitClassDefStart(const ClassDefPtr& p)
2421
- {
2422
- validate(p);
2423
- return true;
2424
- }
2425
-
2426
- void
2427
- Slice::CsGenerator::MetaDataVisitor::visitClassDefEnd(const ClassDefPtr&)
2428
- {
2429
- }
2430
-
2431
- bool
2432
- Slice::CsGenerator::MetaDataVisitor::visitExceptionStart(const ExceptionPtr& p)
2433
- {
2434
- validate(p);
2435
- return true;
2436
- }
2437
-
2438
- void
2439
- Slice::CsGenerator::MetaDataVisitor::visitExceptionEnd(const ExceptionPtr&)
2440
- {
2441
- }
2442
-
2443
- bool
2444
- Slice::CsGenerator::MetaDataVisitor::visitStructStart(const StructPtr& p)
2445
- {
2446
- validate(p);
2447
- return true;
2448
- }
2449
-
2450
- void
2451
- Slice::CsGenerator::MetaDataVisitor::visitStructEnd(const StructPtr&)
2452
- {
2453
- }
2454
-
2455
- void
2456
- Slice::CsGenerator::MetaDataVisitor::visitOperation(const OperationPtr& p)
2457
- {
2458
- if(p->hasMetaData("UserException"))
2459
- {
2460
- ClassDefPtr cl = ClassDefPtr::dynamicCast(p->container());
2461
- if(!cl->isLocal())
2462
- {
2463
- ostringstream os;
2464
- os << "ignoring invalid metadata `UserException': directive applies only to local operations "
2465
- << "but enclosing " << (cl->isInterface() ? "interface" : "class") << "`" << cl->name()
2466
- << "' is not local";
2467
- emitWarning(p->file(), p->line(), os.str());
2468
- }
2469
- }
2470
- validate(p);
2471
-
2472
- ParamDeclList params = p->parameters();
2473
- for(ParamDeclList::const_iterator i = params.begin(); i != params.end(); ++i)
2474
- {
2475
- visitParamDecl(*i);
2476
- }
2477
- }
2478
-
2479
- void
2480
- Slice::CsGenerator::MetaDataVisitor::visitParamDecl(const ParamDeclPtr& p)
2481
- {
2482
- validate(p);
2483
- }
2484
-
2485
- void
2486
- Slice::CsGenerator::MetaDataVisitor::visitDataMember(const DataMemberPtr& p)
2487
- {
2488
- validate(p);
2489
- }
2490
-
2491
- void
2492
- Slice::CsGenerator::MetaDataVisitor::visitSequence(const SequencePtr& p)
2493
- {
2494
- validate(p);
2495
- }
2496
-
2497
- void
2498
- Slice::CsGenerator::MetaDataVisitor::visitDictionary(const DictionaryPtr& p)
2499
- {
2500
- validate(p);
2501
- }
2502
-
2503
- void
2504
- Slice::CsGenerator::MetaDataVisitor::visitEnum(const EnumPtr& p)
2505
- {
2506
- validate(p);
2507
- }
2508
-
2509
- void
2510
- Slice::CsGenerator::MetaDataVisitor::visitConst(const ConstPtr& p)
2511
- {
2512
- validate(p);
2513
- }
2514
-
2515
- void
2516
- Slice::CsGenerator::MetaDataVisitor::validate(const ContainedPtr& cont)
2517
- {
2518
- static set<string> collectionWarnings;
2519
- const string msg = "ignoring invalid metadata";
2520
-
2521
- StringList localMetaData = cont->getMetaData();
2522
- StringList newMetaData;
2523
-
2524
- for(StringList::const_iterator p = localMetaData.begin(); p != localMetaData.end(); ++p)
2525
- {
2526
- string s = *p;
2527
-
2528
- string prefix = "clr:";
2529
-
2530
- if(s.find(prefix) == 0)
2531
- {
2532
- SequencePtr seq = SequencePtr::dynamicCast(cont);
2533
- if(seq)
2534
- {
2535
- if(s.substr(prefix.size()) == "collection")
2536
- {
2537
- if(collectionWarnings.find(cont->file()) == collectionWarnings.end())
2538
- {
2539
- emitWarning(cont->file(), cont->line(), "the \"" + s + "\" metadata has been deprecated");
2540
- collectionWarnings.insert(cont->file());
2541
- }
2542
- newMetaData.push_back(s);
2543
- continue;
2544
- }
2545
- static const string clrGenericPrefix = prefix + "generic:";
2546
- if(s.find(clrGenericPrefix) == 0)
2547
- {
2548
- string type = s.substr(clrGenericPrefix.size());
2549
- if(type == "LinkedList" || type == "Queue" || type == "Stack")
2550
- {
2551
- ClassDeclPtr cd = ClassDeclPtr::dynamicCast(seq->type());
2552
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(seq->type());
2553
- if(!cd && !(builtin && builtin->kind() == Builtin::KindObject))
2554
- {
2555
- newMetaData.push_back(s);
2556
- continue;
2557
- }
2558
- }
2559
- else if(!type.empty())
2560
- {
2561
- newMetaData.push_back(s);
2562
- continue; // Custom type or List<T>
2563
- }
2564
- }
2565
- static const string clrSerializablePrefix = prefix + "serializable:";
2566
- if(s.find(clrSerializablePrefix) == 0)
2567
- {
2568
- string meta;
2569
- if(cont->findMetaData(prefix + "collection", meta) ||
2570
- cont->findMetaData(prefix + "generic:", meta))
2571
- {
2572
- emitWarning(cont->file(), cont->line(), msg + " `" + meta + "':\n" +
2573
- "serialization can only be used with the array mapping for byte sequences");
2574
- continue;
2575
- }
2576
- string type = s.substr(clrSerializablePrefix.size());
2577
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(seq->type());
2578
- if(!type.empty() && builtin && builtin->kind() == Builtin::KindByte)
2579
- {
2580
- newMetaData.push_back(s);
2581
- continue;
2582
- }
2583
- }
2584
- }
2585
- else if(StructPtr::dynamicCast(cont))
2586
- {
2587
- if(s.substr(prefix.size()) == "class")
2588
- {
2589
- newMetaData.push_back(s);
2590
- continue;
2591
- }
2592
- if(s.substr(prefix.size()) == "property")
2593
- {
2594
- newMetaData.push_back(s);
2595
- continue;
2596
- }
2597
- static const string clrImplementsPrefix = prefix + "implements:";
2598
- if(s.find(clrImplementsPrefix) == 0)
2599
- {
2600
- newMetaData.push_back(s);
2601
- continue;
2602
- }
2603
- }
2604
- else if(ClassDefPtr::dynamicCast(cont))
2605
- {
2606
- if(s.substr(prefix.size()) == "property")
2607
- {
2608
- newMetaData.push_back(s);
2609
- continue;
2610
- }
2611
- static const string clrImplementsPrefix = prefix + "implements:";
2612
- if(s.find(clrImplementsPrefix) == 0)
2613
- {
2614
- newMetaData.push_back(s);
2615
- continue;
2616
- }
2617
- }
2618
- else if(DictionaryPtr::dynamicCast(cont))
2619
- {
2620
- if(s.substr(prefix.size()) == "collection")
2621
- {
2622
- if(collectionWarnings.find(cont->file()) == collectionWarnings.end())
2623
- {
2624
- emitWarning(cont->file(), cont->line(), "the \"" + s + "\" metadata has been deprecated");
2625
- collectionWarnings.insert(cont->file());
2626
- }
2627
- newMetaData.push_back(s);
2628
- continue;
2629
- }
2630
- static const string clrGenericPrefix = prefix + "generic:";
2631
- if(s.find(clrGenericPrefix) == 0)
2632
- {
2633
- string type = s.substr(clrGenericPrefix.size());
2634
- if(type == "SortedDictionary" || type == "SortedList")
2635
- {
2636
- newMetaData.push_back(s);
2637
- continue;
2638
- }
2639
- }
2640
- }
2641
- emitWarning(cont->file(), cont->line(), msg + " `" + s + "'");
2642
- continue;
2643
- }
2644
-
2645
- prefix = "cs:";
2646
- if(s.find(prefix) == 0)
2647
- {
2648
- static const string csAttributePrefix = prefix + "attribute:";
2649
- if(s.find(csAttributePrefix) == 0 && s.size() > csAttributePrefix.size())
2650
- {
2651
- newMetaData.push_back(s);
2652
- continue;
2653
- }
2654
- emitWarning(cont->file(), cont->line(), msg + " `" + s + "'");
2655
- continue;
2656
- }
2657
- newMetaData.push_back(s);
2658
- }
2659
- cont->setMetaData(newMetaData);
2660
- }