zeroc-ice 3.6b1

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