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