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