zeroc-ice 3.6.5 → 3.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/BZIP2_LICENSE +42 -0
- data/ICE_LICENSE +17 -17
- data/LICENSE +12 -12
- data/bin/slice2rb +1 -1
- data/ext/Communicator.cpp +150 -53
- data/ext/Communicator.h +1 -1
- data/ext/Config.h +2 -12
- data/ext/Connection.cpp +89 -68
- data/ext/Connection.h +1 -1
- data/ext/Endpoint.cpp +16 -45
- data/ext/Endpoint.h +1 -1
- data/ext/ImplicitContext.cpp +1 -5
- data/ext/ImplicitContext.h +1 -1
- data/ext/Init.cpp +4 -1
- data/ext/Logger.cpp +1 -1
- data/ext/Logger.h +1 -1
- data/ext/Operation.cpp +33 -44
- data/ext/Operation.h +1 -1
- data/ext/Properties.cpp +1 -1
- data/ext/Properties.h +1 -1
- data/ext/Proxy.cpp +22 -57
- data/ext/Proxy.h +1 -1
- data/ext/Slice.cpp +5 -5
- data/ext/Slice.h +1 -1
- data/ext/Types.cpp +244 -171
- data/ext/Types.h +118 -66
- data/ext/Util.cpp +13 -9
- data/ext/Util.h +10 -10
- data/ext/ValueFactoryManager.cpp +445 -0
- data/ext/ValueFactoryManager.h +100 -0
- data/ext/extconf.rb +47 -45
- data/ext/ice/bzip2/blocksort.c +1094 -0
- data/ext/ice/bzip2/bzlib.c +1572 -0
- data/ext/ice/bzip2/bzlib.h +282 -0
- data/ext/ice/bzip2/bzlib_private.h +509 -0
- data/ext/ice/bzip2/compress.c +672 -0
- data/ext/ice/bzip2/crctable.c +104 -0
- data/ext/ice/bzip2/decompress.c +646 -0
- data/ext/ice/bzip2/huffman.c +205 -0
- data/ext/ice/bzip2/randtable.c +84 -0
- data/ext/ice/cpp/include/Ice/Application.h +77 -60
- data/ext/ice/cpp/include/Ice/AsyncResult.h +34 -318
- data/ext/ice/cpp/include/Ice/AsyncResultF.h +4 -2
- data/ext/ice/cpp/include/Ice/BatchRequestInterceptor.h +5 -10
- data/ext/ice/cpp/include/Ice/BatchRequestQueueF.h +1 -1
- data/ext/ice/cpp/include/Ice/Buffer.h +10 -10
- data/ext/ice/cpp/include/Ice/CommunicatorAsync.h +14 -12
- data/ext/ice/cpp/include/Ice/Comparable.h +130 -0
- data/ext/ice/cpp/include/Ice/Config.h +7 -36
- data/ext/ice/cpp/include/Ice/ConnectionAsync.h +107 -11
- data/ext/ice/cpp/include/Ice/ConnectionIF.h +5 -1
- data/ext/ice/cpp/include/Ice/ConsoleUtil.h +28 -0
- data/ext/ice/cpp/include/Ice/{DefaultObjectFactory.h → DefaultValueFactory.h} +28 -14
- data/ext/ice/cpp/include/Ice/DispatchInterceptor.h +4 -6
- data/ext/ice/cpp/include/Ice/Dispatcher.h +14 -13
- data/ext/ice/cpp/include/Ice/DynamicLibrary.h +7 -5
- data/ext/ice/cpp/include/Ice/DynamicLibraryF.h +1 -1
- data/ext/ice/cpp/include/Ice/Exception.h +66 -56
- data/ext/ice/cpp/include/Ice/ExceptionHelpers.h +69 -0
- data/ext/ice/cpp/include/Ice/FactoryTable.h +11 -12
- data/ext/ice/cpp/include/Ice/FactoryTableInit.h +27 -25
- data/ext/ice/cpp/include/Ice/Format.h +6 -1
- data/ext/ice/cpp/include/Ice/Functional.h +33 -33
- data/ext/ice/cpp/include/Ice/GCObject.h +9 -5
- data/ext/ice/cpp/include/Ice/Handle.h +6 -11
- data/ext/ice/cpp/include/Ice/Ice.h +9 -5
- data/ext/ice/cpp/include/{IceUtil → Ice}/IconvStringConverter.h +108 -62
- data/ext/ice/cpp/include/Ice/Incoming.h +109 -33
- data/ext/ice/cpp/include/Ice/IncomingAsync.h +63 -23
- data/ext/ice/cpp/include/Ice/IncomingAsyncF.h +7 -1
- data/ext/ice/cpp/include/Ice/Initialize.h +178 -38
- data/ext/ice/cpp/include/Ice/InputStream.h +994 -0
- data/ext/ice/cpp/include/Ice/InstanceF.h +1 -2
- data/ext/ice/cpp/include/Ice/InterfaceByValue.h +46 -0
- data/ext/ice/cpp/include/Ice/LocalObject.h +9 -9
- data/ext/ice/cpp/include/Ice/LocalObjectF.h +1 -1
- data/ext/ice/cpp/include/Ice/LoggerUtil.h +20 -14
- data/ext/ice/cpp/include/Ice/MetricsAdminI.h +114 -65
- data/ext/ice/cpp/include/Ice/MetricsFunctional.h +23 -5
- data/ext/ice/cpp/include/Ice/MetricsObserverI.h +99 -26
- data/ext/ice/cpp/include/Ice/NativePropertiesAdmin.h +17 -4
- data/ext/ice/cpp/include/Ice/Object.h +105 -56
- data/ext/ice/cpp/include/Ice/ObjectF.h +8 -3
- data/ext/ice/cpp/include/Ice/ObserverHelper.h +18 -8
- data/ext/ice/cpp/include/Ice/Optional.h +1084 -0
- data/ext/ice/cpp/include/Ice/OutgoingAsync.h +655 -84
- data/ext/ice/cpp/include/Ice/OutgoingAsyncF.h +12 -6
- data/ext/ice/cpp/include/Ice/OutputStream.h +753 -0
- data/ext/ice/cpp/include/Ice/Protocol.h +19 -12
- data/ext/ice/cpp/include/Ice/Proxy.h +1329 -717
- data/ext/ice/cpp/include/Ice/ProxyF.h +11 -33
- data/ext/ice/cpp/include/Ice/ProxyFactoryF.h +1 -1
- data/ext/ice/cpp/include/Ice/ProxyHandle.h +34 -50
- data/ext/ice/cpp/include/Ice/ReferenceF.h +1 -1
- data/ext/ice/cpp/include/Ice/RegisterPlugins.h +22 -3
- data/ext/ice/cpp/include/Ice/RequestHandlerF.h +10 -4
- data/ext/ice/cpp/include/Ice/ResponseHandlerF.h +6 -1
- data/ext/ice/cpp/include/{IceUtil → Ice}/SHA1.h +16 -16
- data/ext/ice/cpp/include/Ice/ServantManagerF.h +1 -1
- data/ext/ice/cpp/include/Ice/Service.h +13 -18
- data/ext/ice/cpp/include/Ice/SliceChecksums.h +1 -1
- data/ext/ice/cpp/include/Ice/SlicedData.h +46 -20
- data/ext/ice/cpp/include/Ice/SlicedDataF.h +14 -6
- data/ext/ice/cpp/include/Ice/StreamHelpers.h +159 -49
- data/ext/ice/cpp/include/Ice/StringConverter.h +52 -0
- data/ext/ice/cpp/include/Ice/ThreadPoolF.h +1 -1
- data/{slice/Ice/ObjectFactoryF.ice → ext/ice/cpp/include/Ice/UUID.h} +9 -7
- data/ext/ice/cpp/include/{IceUtil → Ice}/UniquePtr.h +21 -22
- data/ext/ice/cpp/include/Ice/UniqueRef.h +98 -0
- data/ext/ice/cpp/include/Ice/UserExceptionFactory.h +40 -8
- data/ext/ice/cpp/include/Ice/Value.h +104 -0
- data/{slice/Freeze/ConnectionF.ice → ext/ice/cpp/include/Ice/ValueF.h} +11 -7
- data/ext/ice/cpp/include/IceSSL/Config.h +8 -23
- data/ext/ice/cpp/include/IceSSL/IceSSL.h +17 -6
- data/ext/ice/cpp/include/IceSSL/OpenSSL.h +130 -0
- data/ext/ice/cpp/include/IceSSL/Plugin.h +172 -259
- data/ext/ice/cpp/include/IceSSL/SChannel.h +66 -0
- data/ext/ice/cpp/include/IceSSL/SecureTransport.h +66 -0
- data/ext/ice/cpp/include/IceSSL/UWP.h +58 -0
- data/ext/ice/cpp/include/IceUtil/Atomic.h +8 -10
- data/ext/ice/cpp/include/IceUtil/Cond.h +17 -18
- data/ext/ice/cpp/include/IceUtil/Config.h +138 -39
- data/ext/ice/cpp/include/IceUtil/ConsoleUtil.h +97 -0
- data/ext/ice/cpp/include/IceUtil/CountDownLatch.h +5 -5
- data/ext/ice/cpp/include/IceUtil/CtrlCHandler.h +23 -17
- data/ext/ice/cpp/include/IceUtil/DisableWarnings.h +1 -3
- data/ext/ice/cpp/include/IceUtil/Exception.h +157 -67
- data/ext/ice/cpp/include/IceUtil/FileUtil.h +148 -0
- data/ext/ice/cpp/include/IceUtil/Functional.h +1 -2
- data/ext/ice/cpp/include/IceUtil/Handle.h +11 -11
- data/ext/ice/cpp/include/IceUtil/IceUtil.h +4 -10
- data/ext/ice/cpp/include/IceUtil/InputUtil.h +3 -3
- data/ext/ice/cpp/include/IceUtil/Iterator.h +2 -2
- data/ext/ice/cpp/include/IceUtil/Lock.h +8 -10
- data/ext/ice/cpp/include/IceUtil/Monitor.h +1 -2
- data/ext/ice/cpp/include/IceUtil/Mutex.h +17 -11
- data/ext/ice/cpp/include/IceUtil/MutexProtocol.h +2 -2
- data/ext/ice/cpp/include/IceUtil/MutexPtrLock.h +4 -4
- data/ext/ice/cpp/include/IceUtil/MutexPtrTryLock.h +4 -4
- data/ext/ice/cpp/include/IceUtil/Optional.h +32 -18
- data/ext/ice/cpp/include/IceUtil/Options.h +17 -18
- data/ext/ice/cpp/include/IceUtil/OutputUtil.h +55 -29
- data/ext/ice/cpp/include/IceUtil/PopDisableWarnings.h +6 -6
- data/ext/ice/cpp/include/IceUtil/PushDisableWarnings.h +11 -10
- data/ext/ice/cpp/include/IceUtil/Random.h +3 -3
- data/ext/ice/cpp/include/IceUtil/RecMutex.h +7 -8
- data/ext/ice/cpp/include/IceUtil/ResourceConfig.h +58 -0
- data/ext/ice/cpp/include/IceUtil/ScannerConfig.h +1 -9
- data/ext/ice/cpp/include/IceUtil/ScopedArray.h +8 -2
- data/ext/ice/cpp/include/IceUtil/Shared.h +5 -7
- data/ext/ice/cpp/{src → include}/IceUtil/StopWatch.h +2 -2
- data/ext/ice/cpp/include/IceUtil/StringConverter.h +77 -72
- data/ext/ice/cpp/include/IceUtil/StringUtil.h +32 -21
- data/ext/ice/cpp/include/IceUtil/Thread.h +10 -12
- data/ext/ice/cpp/include/IceUtil/ThreadException.h +33 -42
- data/ext/ice/cpp/include/IceUtil/Time.h +3 -3
- data/ext/ice/cpp/include/IceUtil/Timer.h +14 -13
- data/ext/ice/cpp/include/IceUtil/UUID.h +2 -2
- data/ext/ice/cpp/include/IceUtil/UndefSysMacros.h +1 -1
- data/ext/ice/cpp/include/{Ice → generated/Ice}/BuiltinSequences.h +41 -8
- data/ext/ice/cpp/include/generated/Ice/Communicator.h +364 -0
- data/ext/ice/cpp/include/{Ice → generated/Ice}/CommunicatorF.h +40 -8
- data/ext/ice/cpp/include/generated/Ice/Connection.h +872 -0
- data/ext/ice/cpp/include/{Ice → generated/Ice}/ConnectionF.h +46 -8
- data/ext/ice/cpp/include/{Ice → generated/Ice}/Current.h +71 -8
- data/ext/ice/cpp/include/generated/Ice/Endpoint.h +582 -0
- data/ext/ice/cpp/include/{Ice → generated/Ice}/EndpointF.h +62 -8
- data/ext/ice/cpp/include/{Ice → generated/Ice}/EndpointTypes.h +31 -16
- data/ext/ice/cpp/include/{Ice → generated/Ice}/FacetMap.h +23 -8
- data/ext/ice/cpp/include/generated/Ice/Identity.h +221 -0
- data/ext/ice/cpp/include/{Ice → generated/Ice}/ImplicitContext.h +72 -13
- data/ext/ice/cpp/include/{Ice → generated/Ice}/ImplicitContextF.h +40 -8
- data/ext/ice/cpp/include/generated/Ice/Instrumentation.h +602 -0
- data/ext/ice/cpp/include/{Ice → generated/Ice}/InstrumentationF.h +54 -8
- data/ext/ice/cpp/include/generated/Ice/LocalException.h +2802 -0
- data/ext/ice/cpp/include/generated/Ice/Locator.h +2036 -0
- data/ext/ice/cpp/include/{Ice → generated/Ice}/LocatorF.h +53 -12
- data/ext/ice/cpp/include/{Ice → generated/Ice}/Logger.h +71 -13
- data/ext/ice/cpp/include/{Ice → generated/Ice}/LoggerF.h +40 -8
- data/ext/ice/cpp/include/generated/Ice/Metrics.h +2649 -0
- data/ext/ice/cpp/include/generated/Ice/ObjectAdapter.h +302 -0
- data/ext/ice/cpp/include/{Ice → generated/Ice}/ObjectAdapterF.h +40 -8
- data/ext/ice/cpp/include/generated/Ice/ObjectFactory.h +142 -0
- data/ext/ice/cpp/include/generated/Ice/Plugin.h +197 -0
- data/ext/ice/cpp/include/{Ice → generated/Ice}/PluginF.h +43 -8
- data/ext/ice/cpp/include/generated/Ice/Process.h +536 -0
- data/ext/ice/cpp/include/{Ice → generated/Ice}/ProcessF.h +45 -10
- data/ext/ice/cpp/include/{Ice → generated/Ice}/Properties.h +88 -21
- data/ext/ice/cpp/include/generated/Ice/PropertiesAdmin.h +749 -0
- data/ext/ice/cpp/include/{Ice → generated/Ice}/PropertiesF.h +48 -10
- data/ext/ice/cpp/include/generated/Ice/RemoteLogger.h +1449 -0
- data/ext/ice/cpp/include/generated/Ice/Router.h +1032 -0
- data/ext/ice/cpp/include/{Ice → generated/Ice}/RouterF.h +45 -10
- data/ext/ice/cpp/include/{Ice → generated/Ice}/ServantLocator.h +65 -13
- data/ext/ice/cpp/include/{Ice → generated/Ice}/ServantLocatorF.h +40 -8
- data/ext/ice/cpp/include/{Ice → generated/Ice}/SliceChecksumDict.h +23 -8
- data/ext/ice/cpp/include/generated/Ice/ValueFactory.h +169 -0
- data/ext/ice/cpp/include/generated/Ice/Version.h +334 -0
- data/ext/ice/cpp/include/generated/IceSSL/ConnectionInfo.h +172 -0
- data/ext/ice/cpp/include/generated/IceSSL/ConnectionInfoF.h +98 -0
- data/ext/ice/cpp/include/generated/IceSSL/EndpointInfo.h +156 -0
- data/ext/ice/cpp/src/Ice/ACM.cpp +18 -14
- data/ext/ice/cpp/src/Ice/ACM.h +9 -2
- data/ext/ice/cpp/{include → src}/Ice/ACMF.h +10 -5
- data/ext/ice/cpp/src/Ice/Acceptor.cpp +6 -1
- data/ext/ice/cpp/src/Ice/Acceptor.h +4 -3
- data/ext/ice/cpp/src/Ice/AcceptorF.h +1 -1
- data/ext/ice/cpp/src/{IceUtil → Ice}/ArgVector.cpp +9 -9
- data/ext/ice/cpp/src/{IceUtil → Ice}/ArgVector.h +7 -7
- data/ext/ice/cpp/src/Ice/AsyncResult.cpp +15 -538
- data/ext/ice/cpp/src/Ice/Base64.cpp +11 -11
- data/ext/ice/cpp/src/Ice/Base64.h +1 -1
- data/ext/ice/cpp/src/Ice/BatchRequestQueue.cpp +40 -12
- data/ext/ice/cpp/src/Ice/BatchRequestQueue.h +15 -10
- data/ext/ice/cpp/src/Ice/Buffer.cpp +74 -12
- data/ext/ice/cpp/src/Ice/BuiltinSequences.cpp +20 -6
- data/ext/ice/cpp/src/Ice/CollocatedRequestHandler.cpp +85 -190
- data/ext/ice/cpp/src/Ice/CollocatedRequestHandler.h +17 -18
- data/ext/ice/cpp/src/Ice/Communicator.cpp +39 -8
- data/ext/ice/cpp/src/Ice/CommunicatorF.cpp +27 -5
- data/ext/ice/cpp/src/Ice/CommunicatorI.cpp +271 -104
- data/ext/ice/cpp/src/Ice/CommunicatorI.h +84 -28
- data/ext/ice/cpp/src/{IceUtil → Ice}/Cond.cpp +3 -3
- data/ext/ice/cpp/src/Ice/ConnectRequestHandler.cpp +58 -125
- data/ext/ice/cpp/src/Ice/ConnectRequestHandler.h +11 -22
- data/ext/ice/cpp/src/Ice/ConnectRequestHandlerF.h +6 -2
- data/ext/ice/cpp/src/Ice/Connection.cpp +88 -8
- data/ext/ice/cpp/src/Ice/ConnectionF.cpp +27 -5
- data/ext/ice/cpp/src/Ice/ConnectionFactory.cpp +158 -80
- data/ext/ice/cpp/src/Ice/ConnectionFactory.h +41 -23
- data/ext/ice/cpp/{include → src}/Ice/ConnectionFactoryF.h +8 -3
- data/ext/ice/cpp/src/Ice/ConnectionI.cpp +707 -653
- data/ext/ice/cpp/src/Ice/ConnectionI.h +97 -69
- data/ext/ice/cpp/src/Ice/ConnectionRequestHandler.cpp +2 -15
- data/ext/ice/cpp/src/Ice/ConnectionRequestHandler.h +4 -3
- data/ext/ice/cpp/src/Ice/Connector.cpp +6 -1
- data/ext/ice/cpp/src/Ice/Connector.h +4 -3
- data/ext/ice/cpp/src/Ice/ConnectorF.h +1 -1
- data/ext/ice/cpp/src/{IceUtil → Ice}/CountDownLatch.cpp +4 -4
- data/ext/ice/cpp/src/Ice/Current.cpp +29 -6
- data/ext/ice/cpp/src/Ice/DefaultsAndOverrides.cpp +6 -5
- data/ext/ice/cpp/src/Ice/DefaultsAndOverrides.h +1 -1
- data/ext/ice/cpp/src/Ice/DefaultsAndOverridesF.h +1 -1
- data/ext/ice/cpp/src/Ice/DispatchInterceptor.cpp +5 -25
- data/ext/ice/cpp/src/Ice/DynamicLibrary.cpp +29 -19
- data/ext/ice/cpp/src/Ice/Endpoint.cpp +85 -6
- data/ext/ice/cpp/src/Ice/EndpointF.cpp +27 -5
- data/ext/ice/cpp/src/Ice/EndpointFactory.cpp +152 -1
- data/ext/ice/cpp/src/Ice/EndpointFactory.h +72 -6
- data/ext/ice/cpp/src/Ice/EndpointFactoryF.h +1 -1
- data/ext/ice/cpp/src/Ice/EndpointFactoryManager.cpp +35 -19
- data/ext/ice/cpp/src/Ice/EndpointFactoryManager.h +10 -4
- data/ext/ice/cpp/src/Ice/EndpointFactoryManagerF.h +1 -1
- data/ext/ice/cpp/src/Ice/EndpointI.cpp +17 -1
- data/ext/ice/cpp/src/Ice/EndpointI.h +35 -9
- data/ext/ice/cpp/src/Ice/EndpointIF.h +18 -5
- data/ext/ice/cpp/src/Ice/EndpointTypes.cpp +18 -6
- data/ext/ice/cpp/src/Ice/EventHandler.cpp +6 -4
- data/ext/ice/cpp/src/Ice/EventHandler.h +13 -8
- data/ext/ice/cpp/src/Ice/EventHandlerF.h +5 -2
- data/ext/ice/cpp/src/Ice/Exception.cpp +95 -86
- data/ext/ice/cpp/src/Ice/FacetMap.cpp +20 -6
- data/ext/ice/cpp/src/Ice/FactoryTable.cpp +37 -28
- data/ext/ice/cpp/src/Ice/FactoryTableInit.cpp +2 -4
- data/ext/ice/cpp/src/Ice/GCObject.cpp +28 -25
- data/ext/ice/cpp/src/Ice/HashUtil.h +2 -3
- data/ext/ice/cpp/src/Ice/HttpParser.cpp +1 -2
- data/ext/ice/cpp/src/Ice/HttpParser.h +1 -1
- data/ext/ice/cpp/src/Ice/IPEndpointI.cpp +92 -53
- data/ext/ice/cpp/src/Ice/IPEndpointI.h +19 -10
- data/ext/ice/cpp/src/Ice/IPEndpointIF.h +6 -2
- data/ext/ice/cpp/src/Ice/IconvStringConverter.cpp +56 -0
- data/ext/ice/cpp/src/Ice/Identity.cpp +24 -10
- data/ext/ice/cpp/src/Ice/ImplicitContext.cpp +37 -6
- data/ext/ice/cpp/src/Ice/ImplicitContextF.cpp +27 -5
- data/ext/ice/cpp/src/Ice/ImplicitContextI.cpp +14 -14
- data/ext/ice/cpp/src/Ice/ImplicitContextI.h +7 -5
- data/ext/ice/cpp/src/Ice/Incoming.cpp +276 -245
- data/ext/ice/cpp/src/Ice/IncomingAsync.cpp +104 -209
- data/ext/ice/cpp/src/Ice/IncomingRequest.h +5 -4
- data/ext/ice/cpp/src/Ice/Initialize.cpp +299 -172
- data/ext/ice/cpp/src/Ice/InputStream.cpp +2773 -0
- data/ext/ice/cpp/src/Ice/Instance.cpp +191 -231
- data/ext/ice/cpp/src/Ice/Instance.h +30 -18
- data/ext/ice/cpp/src/Ice/Instrumentation.cpp +106 -7
- data/ext/ice/cpp/src/Ice/InstrumentationF.cpp +27 -5
- data/ext/ice/cpp/src/Ice/InstrumentationI.cpp +117 -99
- data/ext/ice/cpp/src/Ice/InstrumentationI.h +30 -31
- data/ext/ice/cpp/src/Ice/LocalException.cpp +1190 -416
- data/ext/ice/cpp/src/Ice/LocalObject.cpp +1 -2
- data/ext/ice/cpp/src/Ice/Locator.cpp +1167 -1215
- data/ext/ice/cpp/src/Ice/LocatorF.cpp +29 -6
- data/ext/ice/cpp/src/Ice/LocatorInfo.cpp +129 -163
- data/ext/ice/cpp/src/Ice/LocatorInfo.h +29 -29
- data/ext/ice/cpp/src/Ice/LocatorInfoF.h +1 -1
- data/ext/ice/cpp/src/Ice/Logger.cpp +35 -5
- data/ext/ice/cpp/src/Ice/LoggerAdminI.cpp +178 -73
- data/ext/ice/cpp/src/Ice/LoggerAdminI.h +4 -4
- data/ext/ice/cpp/src/Ice/LoggerF.cpp +27 -5
- data/ext/ice/cpp/src/Ice/LoggerI.cpp +14 -44
- data/ext/ice/cpp/src/Ice/LoggerI.h +7 -13
- data/ext/ice/cpp/src/Ice/LoggerUtil.cpp +10 -12
- data/ext/ice/cpp/src/Ice/Metrics.cpp +1059 -1069
- data/ext/ice/cpp/src/Ice/MetricsAdminI.cpp +49 -19
- data/ext/ice/cpp/src/Ice/MetricsObserverI.cpp +1 -2
- data/ext/ice/cpp/src/Ice/Network.cpp +534 -170
- data/ext/ice/cpp/src/Ice/Network.h +100 -23
- data/ext/ice/cpp/src/Ice/NetworkF.h +2 -2
- data/ext/ice/cpp/src/Ice/NetworkProxy.cpp +21 -14
- data/ext/ice/cpp/src/Ice/NetworkProxy.h +5 -2
- data/ext/ice/cpp/src/Ice/NetworkProxyF.h +1 -1
- data/ext/ice/cpp/src/Ice/Object.cpp +217 -221
- data/ext/ice/cpp/src/Ice/ObjectAdapter.cpp +41 -6
- data/ext/ice/cpp/src/Ice/ObjectAdapterF.cpp +27 -5
- data/ext/ice/cpp/src/Ice/ObjectAdapterFactory.cpp +35 -14
- data/ext/ice/cpp/src/Ice/ObjectAdapterFactory.h +13 -7
- data/ext/ice/cpp/{include → src}/Ice/ObjectAdapterFactoryF.h +5 -1
- data/ext/ice/cpp/src/Ice/ObjectAdapterI.cpp +184 -58
- data/ext/ice/cpp/src/Ice/ObjectAdapterI.h +32 -26
- data/ext/ice/cpp/src/Ice/ObjectFactory.cpp +37 -6
- data/ext/ice/cpp/src/Ice/ObserverHelper.cpp +9 -32
- data/ext/ice/cpp/src/Ice/OpaqueEndpointI.cpp +40 -18
- data/ext/ice/cpp/src/Ice/OpaqueEndpointI.h +14 -5
- data/ext/ice/cpp/src/Ice/OutgoingAsync.cpp +803 -365
- data/ext/ice/cpp/src/Ice/OutputStream.cpp +1399 -0
- data/ext/ice/cpp/src/Ice/Plugin.cpp +45 -6
- data/ext/ice/cpp/src/Ice/PluginF.cpp +27 -5
- data/ext/ice/cpp/src/Ice/PluginManagerI.cpp +13 -13
- data/ext/ice/cpp/src/Ice/PluginManagerI.h +5 -6
- data/ext/ice/cpp/src/Ice/Process.cpp +256 -114
- data/ext/ice/cpp/src/Ice/ProcessF.cpp +29 -6
- data/ext/ice/cpp/src/Ice/Properties.cpp +38 -8
- data/ext/ice/cpp/src/Ice/PropertiesAdmin.cpp +340 -328
- data/ext/ice/cpp/src/Ice/PropertiesAdminI.cpp +81 -17
- data/ext/ice/cpp/src/Ice/PropertiesAdminI.h +29 -5
- data/ext/ice/cpp/src/Ice/PropertiesF.cpp +29 -6
- data/ext/ice/cpp/src/Ice/PropertiesI.cpp +25 -26
- data/ext/ice/cpp/src/Ice/PropertiesI.h +8 -11
- data/ext/ice/cpp/src/Ice/PropertyNames.cpp +107 -50
- data/ext/ice/cpp/src/Ice/PropertyNames.h +4 -2
- data/ext/ice/cpp/src/Ice/Protocol.cpp +2 -2
- data/ext/ice/cpp/src/Ice/ProtocolInstance.cpp +37 -2
- data/ext/ice/cpp/src/Ice/ProtocolInstance.h +9 -20
- data/ext/ice/cpp/src/Ice/ProtocolInstanceF.h +1 -1
- data/ext/ice/cpp/src/Ice/ProtocolPluginFacade.cpp +6 -1
- data/ext/ice/cpp/src/Ice/ProtocolPluginFacade.h +3 -1
- data/ext/ice/cpp/src/Ice/ProtocolPluginFacadeF.h +1 -1
- data/ext/ice/cpp/src/Ice/Proxy.cpp +690 -964
- data/ext/ice/cpp/src/Ice/ProxyFactory.cpp +23 -32
- data/ext/ice/cpp/src/Ice/ProxyFactory.h +16 -11
- data/ext/ice/cpp/src/Ice/Reference.cpp +75 -69
- data/ext/ice/cpp/src/Ice/Reference.h +27 -22
- data/ext/ice/cpp/src/Ice/ReferenceFactory.cpp +18 -21
- data/ext/ice/cpp/src/Ice/ReferenceFactory.h +12 -12
- data/ext/ice/cpp/src/Ice/ReferenceFactoryF.h +1 -1
- data/ext/ice/cpp/src/Ice/RegisterPluginsInit.cpp +18 -4
- data/ext/ice/cpp/src/Ice/RegisterPluginsInit.h +1 -1
- data/ext/ice/cpp/src/Ice/RemoteLogger.cpp +672 -552
- data/ext/ice/cpp/src/Ice/ReplyStatus.h +1 -1
- data/ext/ice/cpp/src/Ice/RequestHandler.cpp +5 -3
- data/ext/ice/cpp/src/Ice/RequestHandler.h +10 -13
- data/ext/ice/cpp/src/Ice/RequestHandlerFactory.cpp +10 -6
- data/ext/ice/cpp/src/Ice/RequestHandlerFactory.h +2 -2
- data/ext/ice/cpp/src/Ice/ResponseHandler.cpp +3 -6
- data/ext/ice/cpp/src/Ice/ResponseHandler.h +16 -7
- data/ext/ice/cpp/src/Ice/RetryQueue.cpp +6 -12
- data/ext/ice/cpp/src/Ice/RetryQueue.h +7 -6
- data/ext/ice/cpp/src/Ice/RetryQueueF.h +1 -1
- data/ext/ice/cpp/src/Ice/Router.cpp +523 -474
- data/ext/ice/cpp/src/Ice/RouterF.cpp +29 -6
- data/ext/ice/cpp/src/Ice/RouterInfo.cpp +91 -70
- data/ext/ice/cpp/src/Ice/RouterInfo.h +43 -32
- data/ext/ice/cpp/src/Ice/RouterInfoF.h +1 -1
- data/ext/ice/cpp/src/{IceUtil → Ice}/SHA1.cpp +21 -21
- data/ext/ice/cpp/src/Ice/Selector.cpp +989 -923
- data/ext/ice/cpp/src/Ice/Selector.h +100 -147
- data/ext/ice/cpp/src/Ice/ServantLocator.cpp +37 -6
- data/ext/ice/cpp/src/Ice/ServantLocatorF.cpp +27 -5
- data/ext/ice/cpp/src/Ice/ServantManager.cpp +9 -9
- data/ext/ice/cpp/src/Ice/ServantManager.h +1 -1
- data/ext/ice/cpp/src/Ice/SharedContext.h +2 -2
- data/ext/ice/cpp/src/Ice/SliceChecksumDict.cpp +20 -6
- data/ext/ice/cpp/src/Ice/SliceChecksums.cpp +2 -2
- data/ext/ice/cpp/src/Ice/SlicedData.cpp +72 -20
- data/ext/ice/cpp/src/Ice/StreamSocket.cpp +173 -18
- data/ext/ice/cpp/src/Ice/StreamSocket.h +13 -4
- data/ext/ice/cpp/src/Ice/StringConverterPlugin.cpp +48 -17
- data/ext/ice/cpp/src/Ice/StringUtil.h +35 -0
- data/ext/ice/cpp/src/Ice/SysLoggerI.cpp +8 -4
- data/ext/ice/cpp/src/Ice/SysLoggerI.h +2 -3
- data/ext/ice/cpp/src/Ice/TcpAcceptor.cpp +158 -32
- data/ext/ice/cpp/src/Ice/TcpAcceptor.h +12 -5
- data/ext/ice/cpp/src/Ice/TcpConnector.cpp +1 -7
- data/ext/ice/cpp/src/Ice/TcpConnector.h +1 -2
- data/ext/ice/cpp/src/Ice/TcpEndpointI.cpp +40 -32
- data/ext/ice/cpp/src/Ice/TcpEndpointI.h +11 -8
- data/ext/ice/cpp/src/Ice/TcpTransceiver.cpp +12 -27
- data/ext/ice/cpp/src/Ice/TcpTransceiver.h +7 -10
- data/ext/ice/cpp/src/{IceUtil → Ice}/Thread.cpp +24 -41
- data/ext/ice/cpp/src/Ice/ThreadPool.cpp +175 -267
- data/ext/ice/cpp/src/Ice/ThreadPool.h +38 -43
- data/ext/ice/cpp/src/{IceUtil → Ice}/Timer.cpp +28 -21
- data/ext/ice/cpp/src/Ice/TraceLevels.cpp +2 -2
- data/ext/ice/cpp/src/Ice/TraceLevels.h +1 -1
- data/ext/ice/cpp/src/Ice/TraceLevelsF.h +2 -2
- data/ext/ice/cpp/src/Ice/TraceUtil.cpp +53 -31
- data/ext/ice/cpp/src/Ice/TraceUtil.h +13 -6
- data/ext/ice/cpp/src/Ice/Transceiver.cpp +1 -2
- data/ext/ice/cpp/src/Ice/Transceiver.h +8 -7
- data/ext/ice/cpp/src/Ice/TransceiverF.h +1 -1
- data/ext/ice/cpp/src/Ice/UdpConnector.cpp +2 -8
- data/ext/ice/cpp/src/Ice/UdpConnector.h +1 -2
- data/ext/ice/cpp/src/Ice/UdpEndpointI.cpp +92 -31
- data/ext/ice/cpp/src/Ice/UdpEndpointI.h +12 -4
- data/ext/ice/cpp/src/Ice/UdpTransceiver.cpp +150 -179
- data/ext/ice/cpp/src/Ice/UdpTransceiver.h +15 -17
- data/ext/ice/cpp/src/Ice/Value.cpp +81 -0
- data/ext/ice/cpp/src/Ice/ValueFactory.cpp +84 -0
- data/ext/ice/cpp/src/Ice/ValueFactoryManagerI.cpp +70 -0
- data/ext/ice/cpp/src/Ice/ValueFactoryManagerI.h +42 -0
- data/ext/ice/cpp/src/Ice/Version.cpp +24 -14
- data/ext/ice/cpp/src/Ice/VirtualShared.h +43 -0
- data/ext/ice/cpp/src/Ice/WSAcceptor.cpp +3 -9
- data/ext/ice/cpp/src/Ice/WSAcceptor.h +3 -7
- data/ext/ice/cpp/src/Ice/WSConnector.cpp +5 -11
- data/ext/ice/cpp/src/Ice/WSConnector.h +3 -6
- data/ext/ice/cpp/src/Ice/WSEndpoint.cpp +185 -80
- data/ext/ice/cpp/src/Ice/WSEndpoint.h +21 -31
- data/ext/ice/cpp/src/Ice/WSTransceiver.cpp +41 -37
- data/ext/ice/cpp/src/Ice/WSTransceiver.h +7 -21
- data/ext/ice/cpp/src/IceDiscovery/IceDiscovery.cpp +526 -264
- data/ext/ice/cpp/src/IceDiscovery/IceDiscovery.h +341 -455
- data/ext/ice/cpp/src/IceDiscovery/LocatorI.cpp +86 -26
- data/ext/ice/cpp/src/IceDiscovery/LocatorI.h +59 -23
- data/ext/ice/cpp/src/IceDiscovery/LookupI.cpp +315 -61
- data/ext/ice/cpp/src/IceDiscovery/LookupI.h +83 -36
- data/ext/ice/cpp/src/IceDiscovery/PluginI.cpp +57 -59
- data/ext/ice/cpp/src/IceDiscovery/PluginI.h +3 -3
- data/ext/ice/cpp/src/IceLocatorDiscovery/IceLocatorDiscovery.cpp +396 -159
- data/ext/ice/cpp/src/IceLocatorDiscovery/IceLocatorDiscovery.h +251 -355
- data/ext/ice/cpp/src/IceLocatorDiscovery/Plugin.h +52 -0
- data/ext/ice/cpp/src/IceLocatorDiscovery/PluginI.cpp +526 -131
- data/ext/ice/cpp/src/IceSSL/AcceptorI.cpp +19 -165
- data/ext/ice/cpp/src/IceSSL/AcceptorI.h +8 -17
- data/ext/ice/cpp/src/IceSSL/CertificateI.cpp +284 -0
- data/ext/ice/cpp/src/IceSSL/CertificateI.h +69 -0
- data/ext/ice/cpp/src/IceSSL/ConnectionInfo.cpp +39 -11
- data/ext/ice/cpp/src/{Ice/ObjectFactoryF.cpp → IceSSL/ConnectionInfoF.cpp} +31 -9
- data/ext/ice/cpp/src/IceSSL/ConnectorI.cpp +14 -56
- data/ext/ice/cpp/src/IceSSL/ConnectorI.h +6 -13
- data/ext/ice/cpp/src/IceSSL/EndpointI.cpp +205 -197
- data/ext/ice/cpp/src/IceSSL/EndpointI.h +41 -33
- data/ext/ice/cpp/src/IceSSL/EndpointInfo.cpp +39 -10
- data/ext/ice/cpp/src/IceSSL/Instance.cpp +1 -6
- data/ext/ice/cpp/src/IceSSL/Instance.h +7 -7
- data/ext/ice/cpp/src/IceSSL/InstanceF.h +11 -7
- data/ext/ice/cpp/src/IceSSL/OpenSSLCertificateI.cpp +588 -0
- data/ext/ice/cpp/src/IceSSL/OpenSSLEngine.cpp +117 -152
- data/ext/ice/cpp/src/IceSSL/OpenSSLEngine.h +64 -0
- data/ext/ice/cpp/src/IceSSL/OpenSSLEngineF.h +32 -0
- data/ext/ice/cpp/src/IceSSL/OpenSSLPluginI.cpp +132 -0
- data/ext/ice/cpp/src/IceSSL/OpenSSLTransceiverI.cpp +400 -89
- data/ext/ice/cpp/src/IceSSL/OpenSSLTransceiverI.h +36 -21
- data/ext/ice/cpp/src/IceSSL/OpenSSLUtil.cpp +291 -0
- data/ext/ice/cpp/src/IceSSL/OpenSSLUtil.h +63 -0
- data/ext/ice/cpp/src/IceSSL/PluginI.cpp +71 -41
- data/ext/ice/cpp/src/IceSSL/PluginI.h +13 -18
- data/ext/ice/cpp/src/IceSSL/RFC2253.cpp +9 -54
- data/ext/ice/cpp/src/IceSSL/RFC2253.h +7 -7
- data/ext/ice/cpp/src/IceSSL/SChannelCertificateI.cpp +585 -0
- data/ext/ice/cpp/src/IceSSL/SChannelEngine.cpp +491 -75
- data/ext/ice/cpp/src/IceSSL/SChannelEngine.h +126 -0
- data/ext/ice/cpp/src/IceSSL/SChannelEngineF.h +32 -0
- data/ext/ice/cpp/src/IceSSL/SChannelPluginI.cpp +78 -0
- data/ext/ice/cpp/src/IceSSL/SChannelTransceiverI.cpp +126 -169
- data/ext/ice/cpp/src/IceSSL/SChannelTransceiverI.h +19 -22
- data/ext/ice/cpp/src/IceSSL/SSLEngine.cpp +79 -74
- data/ext/ice/cpp/src/IceSSL/SSLEngine.h +24 -187
- data/ext/ice/cpp/src/IceSSL/SSLEngineF.h +4 -19
- data/ext/ice/cpp/src/IceSSL/SecureTransportCertificateI.cpp +862 -0
- data/ext/ice/cpp/src/IceSSL/SecureTransportEngine.cpp +56 -214
- data/ext/ice/cpp/src/IceSSL/SecureTransportEngine.h +60 -0
- data/ext/ice/cpp/src/IceSSL/SecureTransportEngineF.h +31 -0
- data/ext/ice/cpp/src/IceSSL/SecureTransportPluginI.cpp +80 -0
- data/ext/ice/cpp/src/IceSSL/SecureTransportTransceiverI.cpp +137 -144
- data/ext/ice/cpp/src/IceSSL/SecureTransportTransceiverI.h +25 -28
- data/ext/ice/cpp/src/IceSSL/SecureTransportUtil.cpp +857 -0
- data/ext/ice/cpp/src/IceSSL/SecureTransportUtil.h +46 -0
- data/ext/ice/cpp/src/IceSSL/TrustManager.cpp +9 -13
- data/ext/ice/cpp/src/IceSSL/TrustManager.h +4 -4
- data/ext/ice/cpp/src/IceSSL/TrustManagerF.h +3 -3
- data/ext/ice/cpp/src/IceSSL/UWPCertificateI.cpp +271 -0
- data/ext/ice/cpp/src/IceSSL/UWPEngine.cpp +343 -0
- data/ext/ice/cpp/src/IceSSL/UWPEngine.h +46 -0
- data/ext/ice/cpp/{include/Ice/ObjectFactoryManagerF.h → src/IceSSL/UWPEngineF.h} +13 -8
- data/ext/ice/cpp/src/IceSSL/UWPPluginI.cpp +94 -0
- data/ext/ice/cpp/src/IceSSL/UWPTransceiverI.cpp +388 -0
- data/ext/ice/cpp/src/IceSSL/UWPTransceiverI.h +76 -0
- data/ext/ice/cpp/src/IceSSL/Util.cpp +66 -1256
- data/ext/ice/cpp/src/IceSSL/Util.h +48 -137
- data/ext/ice/cpp/src/IceUtil/ConsoleUtil.cpp +162 -0
- data/ext/ice/cpp/src/IceUtil/ConvertUTF.cpp +22 -22
- data/ext/ice/cpp/src/IceUtil/ConvertUTF.h +34 -26
- data/ext/ice/cpp/src/IceUtil/CtrlCHandler.cpp +20 -31
- data/ext/ice/cpp/src/IceUtil/FileUtil.cpp +25 -116
- data/ext/ice/cpp/src/IceUtil/InputUtil.cpp +1 -1
- data/ext/ice/cpp/src/IceUtil/MutexProtocol.cpp +1 -1
- data/ext/ice/cpp/src/IceUtil/Options.cpp +23 -46
- data/ext/ice/cpp/src/IceUtil/OutputUtil.cpp +7 -6
- data/ext/ice/cpp/src/IceUtil/Random.cpp +13 -13
- data/ext/ice/cpp/src/IceUtil/RecMutex.cpp +3 -9
- data/ext/ice/cpp/src/IceUtil/Shared.cpp +8 -3
- data/ext/ice/cpp/src/IceUtil/StringConverter.cpp +501 -264
- data/ext/ice/cpp/src/IceUtil/StringUtil.cpp +540 -235
- data/ext/ice/cpp/src/IceUtil/ThreadException.cpp +37 -74
- data/ext/ice/cpp/src/IceUtil/Time.cpp +1 -1
- data/ext/ice/cpp/src/IceUtil/UUID.cpp +10 -10
- data/ext/ice/cpp/src/IceUtil/Unicode.cpp +98 -97
- data/ext/ice/cpp/src/IceUtil/Unicode.h +21 -35
- data/ext/ice/cpp/src/IceUtil/UtilException.cpp +838 -0
- data/ext/ice/cpp/src/Slice/CPlusPlusUtil.cpp +815 -163
- data/ext/ice/cpp/src/Slice/CPlusPlusUtil.h +76 -0
- data/ext/ice/cpp/src/Slice/Checksum.cpp +2 -2
- data/ext/ice/cpp/{include → src}/Slice/Checksum.h +2 -2
- data/ext/ice/cpp/src/Slice/FileTracker.cpp +25 -78
- data/ext/ice/cpp/{include → src}/Slice/FileTracker.h +9 -9
- data/ext/ice/cpp/src/Slice/Grammar.cpp +1994 -1943
- data/ext/ice/cpp/src/Slice/Grammar.h +44 -24
- data/ext/ice/cpp/src/Slice/GrammarUtil.h +14 -14
- data/ext/ice/cpp/src/Slice/JavaUtil.cpp +2658 -1927
- data/ext/ice/cpp/{include → src}/Slice/JavaUtil.h +178 -59
- data/ext/ice/cpp/src/Slice/MD5.cpp +1 -1
- data/ext/ice/cpp/src/Slice/MD5.h +1 -1
- data/ext/ice/cpp/src/Slice/MD5I.cpp +0 -1
- data/ext/ice/cpp/src/Slice/MD5I.h +1 -1
- data/ext/ice/cpp/src/Slice/PHPUtil.cpp +12 -15
- data/ext/ice/cpp/{include → src}/Slice/PHPUtil.h +6 -15
- data/ext/ice/cpp/src/Slice/Parser.cpp +802 -307
- data/ext/ice/cpp/{include → src}/Slice/Parser.h +76 -84
- data/ext/ice/cpp/src/Slice/Preprocessor.cpp +43 -21
- data/ext/ice/cpp/{include → src}/Slice/Preprocessor.h +7 -12
- data/ext/ice/cpp/src/Slice/Python.cpp +207 -86
- data/ext/ice/cpp/src/Slice/PythonUtil.cpp +683 -679
- data/ext/ice/cpp/{include → src}/Slice/PythonUtil.h +19 -8
- data/ext/ice/cpp/src/Slice/Ruby.cpp +38 -34
- data/ext/ice/cpp/src/Slice/RubyUtil.cpp +177 -445
- data/ext/ice/cpp/{include → src}/Slice/RubyUtil.h +6 -6
- data/ext/ice/cpp/src/Slice/Scanner.cpp +218 -306
- data/ext/ice/cpp/src/Slice/{Util.cpp → SliceUtil.cpp} +37 -64
- data/ext/ice/cpp/src/Slice/StringLiteralUtil.cpp +374 -0
- data/ext/ice/cpp/src/Slice/Util.h +54 -0
- data/ext/ice/mcpp/Makefile +5 -2
- data/ice.gemspec +2 -7
- data/lib/Glacier2.rb +1 -1
- data/lib/Glacier2/Metrics.rb +7 -46
- data/lib/Glacier2/PermissionsVerifier.rb +24 -95
- data/lib/Glacier2/PermissionsVerifierF.rb +3 -3
- data/lib/Glacier2/Router.rb +32 -74
- data/lib/Glacier2/RouterF.rb +3 -3
- data/lib/Glacier2/SSLInfo.rb +4 -7
- data/lib/Glacier2/Session.rb +88 -307
- data/lib/Ice.rb +83 -52
- data/lib/Ice/BuiltinSequences.rb +4 -4
- data/lib/Ice/Communicator.rb +56 -58
- data/lib/Ice/CommunicatorF.rb +3 -3
- data/lib/Ice/Connection.rb +153 -162
- data/lib/Ice/ConnectionF.rb +3 -3
- data/lib/Ice/Current.rb +4 -11
- data/lib/Ice/Endpoint.rb +57 -133
- data/lib/Ice/EndpointF.rb +3 -3
- data/lib/Ice/EndpointTypes.rb +3 -7
- data/lib/Ice/FacetMap.rb +4 -4
- data/lib/Ice/Identity.rb +5 -8
- data/lib/Ice/ImplicitContext.rb +5 -34
- data/lib/Ice/ImplicitContextF.rb +3 -3
- data/lib/Ice/Instrumentation.rb +23 -275
- data/lib/Ice/InstrumentationF.rb +3 -3
- data/lib/Ice/LocalException.rb +95 -141
- data/lib/Ice/Locator.rb +51 -165
- data/lib/Ice/LocatorF.rb +3 -3
- data/lib/Ice/Logger.rb +5 -34
- data/lib/Ice/LoggerF.rb +3 -3
- data/lib/Ice/Metrics.rb +61 -416
- data/lib/Ice/ObjectAdapter.rb +34 -0
- data/lib/Ice/ObjectAdapterF.rb +3 -3
- data/lib/Ice/ObjectFactory.rb +5 -30
- data/lib/Ice/Plugin.rb +7 -60
- data/lib/Ice/PluginF.rb +3 -3
- data/lib/Ice/Process.rb +16 -52
- data/lib/Ice/ProcessF.rb +3 -3
- data/lib/Ice/Properties.rb +5 -41
- data/lib/Ice/PropertiesAdmin.rb +19 -56
- data/lib/Ice/PropertiesF.rb +3 -3
- data/lib/Ice/RemoteLogger.rb +34 -115
- data/lib/Ice/Router.rb +29 -101
- data/lib/Ice/RouterF.rb +3 -3
- data/lib/Ice/ServantLocator.rb +31 -0
- data/lib/Ice/{ObjectFactoryF.rb → ServantLocatorF.rb} +6 -6
- data/lib/Ice/SliceChecksumDict.rb +3 -3
- data/lib/Ice/ValueFactory.rb +33 -0
- data/lib/Ice/Version.rb +5 -11
- data/lib/IceBox.rb +1 -1
- data/lib/IceBox/IceBox.rb +44 -148
- data/lib/IceGrid.rb +1 -4
- data/lib/IceGrid/Admin.rb +551 -427
- data/lib/IceGrid/Descriptor.rb +62 -529
- data/lib/IceGrid/Exception.rb +24 -45
- data/lib/IceGrid/FileParser.rb +14 -50
- data/lib/IceGrid/PluginFacade.rb +40 -0
- data/lib/IceGrid/Registry.rb +151 -58
- data/lib/IceGrid/Session.rb +25 -64
- data/lib/IceGrid/UserAccountMapper.rb +14 -50
- data/lib/IcePatch2.rb +1 -1
- data/lib/IcePatch2/FileInfo.rb +5 -11
- data/lib/IcePatch2/FileServer.rb +33 -76
- data/lib/IceStorm.rb +1 -1
- data/lib/IceStorm/IceStorm.rb +79 -206
- data/lib/IceStorm/Metrics.rb +11 -89
- data/slice/Glacier2/Metrics.ice +8 -4
- data/slice/Glacier2/PermissionsVerifier.ice +10 -7
- data/slice/Glacier2/PermissionsVerifierF.ice +7 -4
- data/slice/Glacier2/Router.ice +10 -8
- data/slice/Glacier2/RouterF.ice +7 -4
- data/slice/Glacier2/SSLInfo.ice +8 -5
- data/slice/Glacier2/Session.ice +15 -13
- data/slice/Ice/BuiltinSequences.ice +7 -4
- data/slice/Ice/Communicator.ice +141 -66
- data/slice/Ice/CommunicatorF.ice +7 -4
- data/slice/Ice/Connection.ice +183 -86
- data/slice/Ice/ConnectionF.ice +7 -4
- data/slice/Ice/Current.ice +13 -9
- data/slice/Ice/Endpoint.ice +63 -14
- data/slice/Ice/EndpointF.ice +7 -4
- data/slice/Ice/EndpointTypes.ice +8 -6
- data/slice/Ice/FacetMap.ice +7 -4
- data/slice/Ice/Identity.ice +13 -5
- data/slice/Ice/ImplicitContext.ice +20 -18
- data/slice/Ice/ImplicitContextF.ice +7 -4
- data/slice/Ice/Instrumentation.ice +20 -19
- data/slice/Ice/InstrumentationF.ice +8 -5
- data/slice/Ice/LocalException.ice +87 -87
- data/slice/Ice/Locator.ice +19 -18
- data/slice/Ice/LocatorF.ice +7 -4
- data/slice/Ice/Logger.ice +9 -7
- data/slice/Ice/LoggerF.ice +7 -4
- data/slice/Ice/Metrics.ice +18 -14
- data/slice/Ice/ObjectAdapter.ice +30 -13
- data/slice/Ice/ObjectAdapterF.ice +7 -4
- data/slice/Ice/ObjectFactory.ice +15 -12
- data/slice/Ice/Plugin.ice +9 -6
- data/slice/Ice/PluginF.ice +8 -5
- data/slice/Ice/Process.ice +9 -6
- data/slice/Ice/ProcessF.ice +7 -4
- data/slice/Ice/Properties.ice +15 -12
- data/slice/Ice/PropertiesAdmin.ice +9 -5
- data/slice/Ice/PropertiesF.ice +7 -4
- data/slice/Ice/RemoteLogger.ice +33 -24
- data/slice/Ice/Router.ice +16 -7
- data/slice/Ice/RouterF.ice +7 -4
- data/slice/Ice/ServantLocator.ice +13 -10
- data/slice/Ice/ServantLocatorF.ice +7 -4
- data/slice/Ice/SliceChecksumDict.ice +7 -4
- data/slice/Ice/ValueFactory.ice +127 -0
- data/slice/Ice/Version.ice +9 -5
- data/slice/IceBT/ConnectionInfo.ice +53 -0
- data/slice/IceBT/EndpointInfo.ice +51 -0
- data/slice/IceBT/Types.ice +39 -0
- data/slice/IceBox/IceBox.ice +20 -21
- data/slice/IceDiscovery/IceDiscovery.ice +9 -5
- data/slice/IceGrid/Admin.ice +390 -30
- data/slice/IceGrid/Descriptor.ice +37 -29
- data/slice/IceGrid/Exception.ice +33 -27
- data/slice/IceGrid/FileParser.ice +9 -6
- data/slice/IceGrid/PluginFacade.ice +11 -9
- data/slice/IceGrid/Registry.ice +139 -16
- data/slice/IceGrid/Session.ice +10 -8
- data/slice/IceGrid/UserAccountMapper.ice +9 -6
- data/slice/IceIAP/ConnectionInfo.ice +70 -0
- data/slice/IceIAP/EndpointInfo.ice +64 -0
- data/slice/IceLocatorDiscovery/IceLocatorDiscovery.ice +9 -7
- data/slice/IcePatch2/FileInfo.ice +9 -8
- data/slice/IcePatch2/FileServer.ice +17 -13
- data/slice/IceSSL/ConnectionInfo.ice +14 -17
- data/slice/IceSSL/ConnectionInfoF.ice +24 -0
- data/slice/IceSSL/EndpointInfo.ice +9 -30
- data/slice/IceStorm/IceStorm.ice +22 -18
- data/slice/IceStorm/Metrics.ice +9 -5
- metadata +154 -120
- data/ext/ObjectFactory.cpp +0 -140
- data/ext/ObjectFactory.h +0 -50
- data/ext/ice/cpp/include/Ice/BasicStream.h +0 -1335
- data/ext/ice/cpp/include/Ice/Communicator.h +0 -200
- data/ext/ice/cpp/include/Ice/Connection.h +0 -497
- data/ext/ice/cpp/include/Ice/DeprecatedStringConverter.h +0 -62
- data/ext/ice/cpp/include/Ice/Endpoint.h +0 -341
- data/ext/ice/cpp/include/Ice/Identity.h +0 -168
- data/ext/ice/cpp/include/Ice/Instrumentation.h +0 -365
- data/ext/ice/cpp/include/Ice/LocalException.h +0 -1030
- data/ext/ice/cpp/include/Ice/Locator.h +0 -2193
- data/ext/ice/cpp/include/Ice/Metrics.h +0 -2974
- data/ext/ice/cpp/include/Ice/ObjectAdapter.h +0 -168
- data/ext/ice/cpp/include/Ice/ObjectFactory.h +0 -92
- data/ext/ice/cpp/include/Ice/ObjectFactoryF.h +0 -66
- data/ext/ice/cpp/include/Ice/Outgoing.h +0 -225
- data/ext/ice/cpp/include/Ice/Plugin.h +0 -125
- data/ext/ice/cpp/include/Ice/Process.h +0 -574
- data/ext/ice/cpp/include/Ice/PropertiesAdmin.h +0 -830
- data/ext/ice/cpp/include/Ice/RemoteLogger.h +0 -1500
- data/ext/ice/cpp/include/Ice/Router.h +0 -1159
- data/ext/ice/cpp/include/Ice/Stream.h +0 -447
- data/ext/ice/cpp/include/Ice/StreamF.h +0 -30
- data/ext/ice/cpp/include/Ice/Version.h +0 -262
- data/ext/ice/cpp/include/IceSSL/ConnectionInfo.h +0 -158
- data/ext/ice/cpp/include/IceSSL/EndpointInfo.h +0 -142
- data/ext/ice/cpp/include/IceUtil/AbstractMutex.h +0 -119
- data/ext/ice/cpp/include/IceUtil/Cache.h +0 -362
- data/ext/ice/cpp/include/Slice/CPlusPlusUtil.h +0 -65
- data/ext/ice/cpp/include/Slice/CsUtil.h +0 -92
- data/ext/ice/cpp/include/Slice/DotNetNames.h +0 -34
- data/ext/ice/cpp/include/Slice/ObjCUtil.h +0 -127
- data/ext/ice/cpp/include/Slice/Util.h +0 -56
- data/ext/ice/cpp/src/Ice/BasicStream.cpp +0 -3428
- data/ext/ice/cpp/src/Ice/DeprecatedStringConverter.cpp +0 -62
- data/ext/ice/cpp/src/Ice/ObjectFactoryManager.cpp +0 -139
- data/ext/ice/cpp/src/Ice/ObjectFactoryManager.h +0 -43
- data/ext/ice/cpp/src/Ice/Outgoing.cpp +0 -694
- data/ext/ice/cpp/src/Ice/Stream.cpp +0 -53
- data/ext/ice/cpp/src/Ice/StreamI.cpp +0 -832
- data/ext/ice/cpp/src/Ice/StreamI.h +0 -198
- data/ext/ice/cpp/src/IceSSL/Certificate.cpp +0 -1336
- data/ext/ice/cpp/src/IceUtil/Exception.cpp +0 -792
- data/ext/ice/cpp/src/IceUtil/FileUtil.h +0 -185
- data/ext/ice/cpp/src/Slice/CsUtil.cpp +0 -2660
- data/ext/ice/cpp/src/Slice/DotNetNames.cpp +0 -146
- data/ext/ice/cpp/src/Slice/ObjCUtil.cpp +0 -1310
- data/lib/IceGrid/Locator.rb +0 -106
- data/lib/IceGrid/Observer.rb +0 -572
- data/lib/IceGrid/Query.rb +0 -169
- data/slice/Freeze/BackgroundSaveEvictor.ice +0 -111
- data/slice/Freeze/CatalogData.ice +0 -49
- data/slice/Freeze/Connection.ice +0 -121
- data/slice/Freeze/DB.ice +0 -37
- data/slice/Freeze/Evictor.ice +0 -346
- data/slice/Freeze/EvictorF.ice +0 -22
- data/slice/Freeze/EvictorStorage.ice +0 -72
- data/slice/Freeze/Exception.ice +0 -100
- data/slice/Freeze/Transaction.ice +0 -58
- data/slice/Freeze/TransactionalEvictor.ice +0 -50
- data/slice/IceGrid/Locator.ice +0 -57
- data/slice/IceGrid/Observer.ice +0 -395
- data/slice/IceGrid/Query.ice +0 -131
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
// **********************************************************************
|
|
2
|
-
//
|
|
3
|
-
// Copyright (c) 2003-2018 ZeroC, Inc. All rights reserved.
|
|
4
|
-
//
|
|
5
|
-
// This copy of Ice is licensed to you under the terms described in the
|
|
6
|
-
// ICE_LICENSE file included in this distribution.
|
|
7
|
-
//
|
|
8
|
-
// **********************************************************************
|
|
9
|
-
|
|
10
|
-
#ifndef C_PLUS_PLUS_UTIL_H
|
|
11
|
-
#define C_PLUS_PLUS_UTIL_H
|
|
12
|
-
|
|
13
|
-
#include <Slice/Parser.h>
|
|
14
|
-
#include <IceUtil/OutputUtil.h>
|
|
15
|
-
|
|
16
|
-
namespace Slice
|
|
17
|
-
{
|
|
18
|
-
|
|
19
|
-
SLICE_API extern FeatureProfile featureProfile;
|
|
20
|
-
SLICE_API extern std::string paramPrefix;
|
|
21
|
-
|
|
22
|
-
struct ToIfdef
|
|
23
|
-
{
|
|
24
|
-
SLICE_API char operator()(char);
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
SLICE_API void printHeader(::IceUtilInternal::Output&);
|
|
28
|
-
SLICE_API void printVersionCheck(::IceUtilInternal::Output&);
|
|
29
|
-
SLICE_API void printDllExportStuff(::IceUtilInternal::Output&, const std::string&);
|
|
30
|
-
|
|
31
|
-
const int TypeContextInParam = 1;
|
|
32
|
-
const int TypeContextAMIEnd = 2;
|
|
33
|
-
const int TypeContextAMIPrivateEnd = 4;
|
|
34
|
-
const int TypeContextAMICallPrivateEnd = 8;
|
|
35
|
-
|
|
36
|
-
const int TypeContextUseWstring = 16;
|
|
37
|
-
|
|
38
|
-
SLICE_API std::string typeToString(const TypePtr&, const StringList& = StringList(), int = 0);
|
|
39
|
-
SLICE_API std::string typeToString(const TypePtr&, bool, const StringList& = StringList(), int = 0);
|
|
40
|
-
SLICE_API std::string returnTypeToString(const TypePtr&, bool, const StringList& = StringList(), int = 0);
|
|
41
|
-
SLICE_API std::string inputTypeToString(const TypePtr&, bool, const StringList& = StringList(), int = 0);
|
|
42
|
-
SLICE_API std::string outputTypeToString(const TypePtr&, bool, const StringList& = StringList(), int = 0);
|
|
43
|
-
SLICE_API std::string operationModeToString(Operation::Mode);
|
|
44
|
-
SLICE_API std::string opFormatTypeToString(const OperationPtr&);
|
|
45
|
-
|
|
46
|
-
SLICE_API std::string fixKwd(const std::string&);
|
|
47
|
-
|
|
48
|
-
SLICE_API void writeMarshalUnmarshalCode(::IceUtilInternal::Output&, const TypePtr&, bool, int, const std::string&,
|
|
49
|
-
bool, const StringList& = StringList(), int = 0, const std::string& = "",
|
|
50
|
-
bool = true);
|
|
51
|
-
|
|
52
|
-
SLICE_API void writeMarshalCode(::IceUtilInternal::Output&, const ParamDeclList&, const OperationPtr&, bool, int = 0);
|
|
53
|
-
SLICE_API void writeUnmarshalCode(::IceUtilInternal::Output&, const ParamDeclList&, const OperationPtr&, bool, int = 0);
|
|
54
|
-
SLICE_API void writeAllocateCode(::IceUtilInternal::Output&, const ParamDeclList&, const OperationPtr&, bool, int = 0);
|
|
55
|
-
|
|
56
|
-
SLICE_API std::string getEndArg(const TypePtr&, const StringList&, const std::string&);
|
|
57
|
-
SLICE_API void writeEndCode(::IceUtilInternal::Output&, const ParamDeclList&, const OperationPtr&, bool = false);
|
|
58
|
-
|
|
59
|
-
SLICE_API std::string findMetaData(const StringList&, int = 0);
|
|
60
|
-
SLICE_API bool inWstringModule(const SequencePtr&);
|
|
61
|
-
|
|
62
|
-
SLICE_API std::string getDataMemberRef(const DataMemberPtr&);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
#endif
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
// **********************************************************************
|
|
2
|
-
//
|
|
3
|
-
// Copyright (c) 2003-2018 ZeroC, Inc. All rights reserved.
|
|
4
|
-
//
|
|
5
|
-
// This copy of Ice is licensed to you under the terms described in the
|
|
6
|
-
// ICE_LICENSE file included in this distribution.
|
|
7
|
-
//
|
|
8
|
-
// **********************************************************************
|
|
9
|
-
|
|
10
|
-
#ifndef CS_UTIL_H
|
|
11
|
-
#define CS_UTIL_H
|
|
12
|
-
|
|
13
|
-
#include <Slice/Parser.h>
|
|
14
|
-
#include <IceUtil/OutputUtil.h>
|
|
15
|
-
|
|
16
|
-
namespace Slice
|
|
17
|
-
{
|
|
18
|
-
|
|
19
|
-
class SLICE_API CsGenerator : private ::IceUtil::noncopyable
|
|
20
|
-
{
|
|
21
|
-
public:
|
|
22
|
-
|
|
23
|
-
virtual ~CsGenerator() {};
|
|
24
|
-
|
|
25
|
-
//
|
|
26
|
-
// Convert a dimension-less array declaration to one with a dimension.
|
|
27
|
-
//
|
|
28
|
-
static std::string toArrayAlloc(const std::string& decl, const std::string& sz);
|
|
29
|
-
|
|
30
|
-
//
|
|
31
|
-
// Validate all metadata in the unit with a "cs:" prefix.
|
|
32
|
-
//
|
|
33
|
-
static void validateMetaData(const UnitPtr&);
|
|
34
|
-
|
|
35
|
-
protected:
|
|
36
|
-
static std::string fixId(const std::string&, int = 0, bool = false);
|
|
37
|
-
static std::string fixId(const ContainedPtr&, int = 0, bool = false);
|
|
38
|
-
static std::string getOptionalFormat(const TypePtr&);
|
|
39
|
-
static std::string getStaticId(const TypePtr&);
|
|
40
|
-
static std::string typeToString(const TypePtr&, bool = false);
|
|
41
|
-
static bool isValueType(const TypePtr&);
|
|
42
|
-
static bool isSerializable(const TypePtr&);
|
|
43
|
-
|
|
44
|
-
//
|
|
45
|
-
// Generate code to marshal or unmarshal a type
|
|
46
|
-
//
|
|
47
|
-
void writeMarshalUnmarshalCode(::IceUtilInternal::Output&, const TypePtr&, const std::string&, bool, bool);
|
|
48
|
-
void writeOptionalMarshalUnmarshalCode(::IceUtilInternal::Output&, const TypePtr&, const std::string&, int, bool,
|
|
49
|
-
bool);
|
|
50
|
-
void writeSequenceMarshalUnmarshalCode(::IceUtilInternal::Output&, const SequencePtr&, const std::string&,
|
|
51
|
-
bool, bool, bool);
|
|
52
|
-
void writeOptionalSequenceMarshalUnmarshalCode(::IceUtilInternal::Output&, const SequencePtr&, const std::string&,
|
|
53
|
-
int, bool, bool);
|
|
54
|
-
|
|
55
|
-
void writeSerializeDeserializeCode(::IceUtilInternal::Output&, const TypePtr&, const std::string&, bool, int, bool);
|
|
56
|
-
|
|
57
|
-
private:
|
|
58
|
-
|
|
59
|
-
class MetaDataVisitor : public ParserVisitor
|
|
60
|
-
{
|
|
61
|
-
public:
|
|
62
|
-
|
|
63
|
-
virtual bool visitUnitStart(const UnitPtr&);
|
|
64
|
-
virtual bool visitModuleStart(const ModulePtr&);
|
|
65
|
-
virtual void visitModuleEnd(const ModulePtr&);
|
|
66
|
-
virtual void visitClassDecl(const ClassDeclPtr&);
|
|
67
|
-
virtual bool visitClassDefStart(const ClassDefPtr&);
|
|
68
|
-
virtual void visitClassDefEnd(const ClassDefPtr&);
|
|
69
|
-
virtual bool visitExceptionStart(const ExceptionPtr&);
|
|
70
|
-
virtual void visitExceptionEnd(const ExceptionPtr&);
|
|
71
|
-
virtual bool visitStructStart(const StructPtr&);
|
|
72
|
-
virtual void visitStructEnd(const StructPtr&);
|
|
73
|
-
virtual void visitOperation(const OperationPtr&);
|
|
74
|
-
virtual void visitParamDecl(const ParamDeclPtr&);
|
|
75
|
-
virtual void visitDataMember(const DataMemberPtr&);
|
|
76
|
-
virtual void visitSequence(const SequencePtr&);
|
|
77
|
-
virtual void visitDictionary(const DictionaryPtr&);
|
|
78
|
-
virtual void visitEnum(const EnumPtr&);
|
|
79
|
-
virtual void visitConst(const ConstPtr&);
|
|
80
|
-
|
|
81
|
-
private:
|
|
82
|
-
|
|
83
|
-
void validate(const ContainedPtr&);
|
|
84
|
-
|
|
85
|
-
std::string _fileName;
|
|
86
|
-
StringSet _history;
|
|
87
|
-
};
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
#endif
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
// **********************************************************************
|
|
2
|
-
//
|
|
3
|
-
// Copyright (c) 2003-2018 ZeroC, Inc. All rights reserved.
|
|
4
|
-
//
|
|
5
|
-
// This copy of Ice is licensed to you under the terms described in the
|
|
6
|
-
// ICE_LICENSE file included in this distribution.
|
|
7
|
-
//
|
|
8
|
-
// **********************************************************************
|
|
9
|
-
|
|
10
|
-
#ifndef DOTNETNAMES_H
|
|
11
|
-
#define DOTNETNAMES_H
|
|
12
|
-
|
|
13
|
-
#include <string>
|
|
14
|
-
|
|
15
|
-
namespace Slice
|
|
16
|
-
{
|
|
17
|
-
|
|
18
|
-
namespace DotNet
|
|
19
|
-
{
|
|
20
|
-
|
|
21
|
-
enum BaseType
|
|
22
|
-
{
|
|
23
|
-
Object=1, ICloneable=2, Exception=4, END=8
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
extern const char * manglePrefix;
|
|
27
|
-
|
|
28
|
-
std::string mangleName(const std::string&, int baseTypes = 0);
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
#endif
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
// **********************************************************************
|
|
2
|
-
//
|
|
3
|
-
// Copyright (c) 2003-2018 ZeroC, Inc. All rights reserved.
|
|
4
|
-
//
|
|
5
|
-
// This copy of Ice is licensed to you under the terms described in the
|
|
6
|
-
// ICE_LICENSE file included in this distribution.
|
|
7
|
-
//
|
|
8
|
-
// **********************************************************************
|
|
9
|
-
|
|
10
|
-
#ifndef OBJC_UTIL_H
|
|
11
|
-
#define OBJC_UTIL_H
|
|
12
|
-
|
|
13
|
-
#include <Slice/Parser.h>
|
|
14
|
-
#include <IceUtil/OutputUtil.h>
|
|
15
|
-
|
|
16
|
-
namespace Slice
|
|
17
|
-
{
|
|
18
|
-
|
|
19
|
-
enum BaseType
|
|
20
|
-
{
|
|
21
|
-
BaseTypeNone,
|
|
22
|
-
BaseTypeObject,
|
|
23
|
-
BaseTypeException
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
class SLICE_API ObjCGenerator : private ::IceUtil::noncopyable
|
|
27
|
-
{
|
|
28
|
-
public:
|
|
29
|
-
|
|
30
|
-
virtual ~ObjCGenerator() {};
|
|
31
|
-
|
|
32
|
-
//
|
|
33
|
-
// Validate all metadata in the unit with an "objc:" prefix.
|
|
34
|
-
//
|
|
35
|
-
static void validateMetaData(const UnitPtr&);
|
|
36
|
-
|
|
37
|
-
protected:
|
|
38
|
-
struct ModulePrefix
|
|
39
|
-
{
|
|
40
|
-
ModulePtr m;
|
|
41
|
-
std::string name;
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
static bool addModule(const ModulePtr&, const std::string&);
|
|
45
|
-
static ModulePrefix modulePrefix(const ModulePtr&);
|
|
46
|
-
static std::string moduleName(const ModulePtr&);
|
|
47
|
-
static ModulePtr findModule(const ContainedPtr&, int = 0, bool = false);
|
|
48
|
-
static void modulePrefixError(const ModulePtr&, const std::string&);
|
|
49
|
-
static std::string fixId(const std::string&, int = 0, bool = false);
|
|
50
|
-
static std::string fixId(const ContainedPtr&, int = 0, bool = false);
|
|
51
|
-
static std::string fixName(const ContainedPtr&, int = 0, bool = false);
|
|
52
|
-
static std::string fixScoped(const ContainedPtr&, int = 0, bool = false);
|
|
53
|
-
static std::string getParamId(const ContainedPtr&);
|
|
54
|
-
static std::string getFactoryMethod(const ContainedPtr&, bool);
|
|
55
|
-
static std::string typeToString(const TypePtr&);
|
|
56
|
-
static std::string inTypeToString(const TypePtr&, bool, bool = false, bool = false);
|
|
57
|
-
static std::string outTypeToString(const TypePtr&, bool, bool = false, bool = false);
|
|
58
|
-
static std::string typeToObjCTypeString(const TypePtr&);
|
|
59
|
-
static bool isValueType(const TypePtr&);
|
|
60
|
-
static bool isString(const TypePtr&);
|
|
61
|
-
static bool isClass(const TypePtr&);
|
|
62
|
-
static bool mapsToPointerType(const TypePtr&);
|
|
63
|
-
static std::string getBuiltinName(const BuiltinPtr&);
|
|
64
|
-
static std::string getBuiltinSelector(const BuiltinPtr&, bool);
|
|
65
|
-
static std::string getOptionalHelperGetter(const TypePtr&);
|
|
66
|
-
static std::string getOptionalStreamHelper(const TypePtr&);
|
|
67
|
-
static StringList splitScopedName(const std::string&);
|
|
68
|
-
static std::string getOptionalFormat(const TypePtr&);
|
|
69
|
-
|
|
70
|
-
//
|
|
71
|
-
// Generate code to marshal or unmarshal a type
|
|
72
|
-
//
|
|
73
|
-
void writeMarshalUnmarshalCode(::IceUtilInternal::Output&, const TypePtr&, const std::string&, bool, bool) const;
|
|
74
|
-
void writeOptMemberMarshalUnmarshalCode(::IceUtilInternal::Output&, const TypePtr&, const std::string&, bool) const;
|
|
75
|
-
void writeOptParamMarshalUnmarshalCode(::IceUtilInternal::Output&, const TypePtr&, const std::string&, int,
|
|
76
|
-
bool) const;
|
|
77
|
-
|
|
78
|
-
private:
|
|
79
|
-
|
|
80
|
-
class MetaDataVisitor : public ParserVisitor
|
|
81
|
-
{
|
|
82
|
-
public:
|
|
83
|
-
MetaDataVisitor();
|
|
84
|
-
|
|
85
|
-
virtual bool visitUnitStart(const UnitPtr&);
|
|
86
|
-
virtual bool visitModuleStart(const ModulePtr&);
|
|
87
|
-
virtual void visitModuleEnd(const ModulePtr&);
|
|
88
|
-
virtual void visitClassDecl(const ClassDeclPtr&);
|
|
89
|
-
virtual bool visitClassDefStart(const ClassDefPtr&);
|
|
90
|
-
virtual void visitClassDefEnd(const ClassDefPtr&);
|
|
91
|
-
virtual bool visitExceptionStart(const ExceptionPtr&);
|
|
92
|
-
virtual void visitExceptionEnd(const ExceptionPtr&);
|
|
93
|
-
virtual bool visitStructStart(const StructPtr&);
|
|
94
|
-
virtual void visitStructEnd(const StructPtr&);
|
|
95
|
-
virtual void visitOperation(const OperationPtr&);
|
|
96
|
-
virtual void visitParamDecl(const ParamDeclPtr&);
|
|
97
|
-
virtual void visitDataMember(const DataMemberPtr&);
|
|
98
|
-
virtual void visitSequence(const SequencePtr&);
|
|
99
|
-
virtual void visitDictionary(const DictionaryPtr&);
|
|
100
|
-
virtual void visitEnum(const EnumPtr&);
|
|
101
|
-
virtual void visitConst(const ConstPtr&);
|
|
102
|
-
|
|
103
|
-
private:
|
|
104
|
-
|
|
105
|
-
void validate(const ContainedPtr&);
|
|
106
|
-
|
|
107
|
-
static Slice::StringList getMetaData(const ContainedPtr&);
|
|
108
|
-
static void modulePrefixError(const ModulePtr&, const std::string&);
|
|
109
|
-
|
|
110
|
-
static const std::string _objcPrefix; // "objc:"
|
|
111
|
-
static const std::string _msg; // "ignoring invalid metadata"
|
|
112
|
-
|
|
113
|
-
StringSet _history;
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
//
|
|
118
|
-
// Map of module scoped name to ModulePtr. Used to verify that objc:prefix metadata directives are consistent.
|
|
119
|
-
//
|
|
120
|
-
|
|
121
|
-
typedef std::map<std::string, ModulePrefix> ModuleMap;
|
|
122
|
-
static ModuleMap _modules;
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
#endif
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
// **********************************************************************
|
|
2
|
-
//
|
|
3
|
-
// Copyright (c) 2003-2018 ZeroC, Inc. All rights reserved.
|
|
4
|
-
//
|
|
5
|
-
// This copy of Ice is licensed to you under the terms described in the
|
|
6
|
-
// ICE_LICENSE file included in this distribution.
|
|
7
|
-
//
|
|
8
|
-
// **********************************************************************
|
|
9
|
-
|
|
10
|
-
#ifndef SLICE_UTIL_H
|
|
11
|
-
#define SLICE_UTIL_H
|
|
12
|
-
|
|
13
|
-
#include <Slice/Parser.h>
|
|
14
|
-
#include <IceUtil/OutputUtil.h>
|
|
15
|
-
|
|
16
|
-
#include <ostream>
|
|
17
|
-
#include <fstream>
|
|
18
|
-
|
|
19
|
-
namespace Slice
|
|
20
|
-
{
|
|
21
|
-
|
|
22
|
-
SLICE_API std::string fullPath(const std::string&);
|
|
23
|
-
SLICE_API std::string changeInclude(const std::string&, const std::vector<std::string>&);
|
|
24
|
-
SLICE_API void setErrorStream(std::ostream&);
|
|
25
|
-
SLICE_API std::ostream& getErrorStream();
|
|
26
|
-
SLICE_API void emitError(const std::string&, int, const std::string&);
|
|
27
|
-
SLICE_API void emitWarning(const std::string&, int, const std::string&);
|
|
28
|
-
SLICE_API void emitError(const std::string&, const std::string&, const std::string&);
|
|
29
|
-
SLICE_API void emitWarning(const std::string&, const std::string&, const std::string&);
|
|
30
|
-
SLICE_API void emitRaw(const char*);
|
|
31
|
-
SLICE_API std::vector<std::string> filterMcppWarnings(const std::string&);
|
|
32
|
-
SLICE_API void printGeneratedHeader(IceUtilInternal::Output& out, const std::string&, const std::string& commentStyle = "//");
|
|
33
|
-
#ifdef _WIN32
|
|
34
|
-
SLICE_API std::vector<std::string> argvToArgs(int argc, wchar_t* argv[]);
|
|
35
|
-
#else
|
|
36
|
-
SLICE_API std::vector<std::string> argvToArgs(int argc, char* argv[]);
|
|
37
|
-
#endif
|
|
38
|
-
|
|
39
|
-
class SLICE_API DependOutputUtil : IceUtil::noncopyable
|
|
40
|
-
{
|
|
41
|
-
public:
|
|
42
|
-
|
|
43
|
-
DependOutputUtil(std::string& file);
|
|
44
|
-
~DependOutputUtil();
|
|
45
|
-
void cleanup();
|
|
46
|
-
std::ostream& os();
|
|
47
|
-
|
|
48
|
-
private:
|
|
49
|
-
|
|
50
|
-
const std::string _file;
|
|
51
|
-
std::ofstream _os;
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
#endif
|
|
@@ -1,3428 +0,0 @@
|
|
|
1
|
-
// **********************************************************************
|
|
2
|
-
//
|
|
3
|
-
// Copyright (c) 2003-2018 ZeroC, Inc. All rights reserved.
|
|
4
|
-
//
|
|
5
|
-
// This copy of Ice is licensed to you under the terms described in the
|
|
6
|
-
// ICE_LICENSE file included in this distribution.
|
|
7
|
-
//
|
|
8
|
-
// **********************************************************************
|
|
9
|
-
|
|
10
|
-
#include <IceUtil/DisableWarnings.h>
|
|
11
|
-
#include <Ice/BasicStream.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/ObjectFactory.h>
|
|
18
|
-
#include <Ice/ObjectFactoryManager.h>
|
|
19
|
-
#include <Ice/UserExceptionFactory.h>
|
|
20
|
-
#include <Ice/LocalException.h>
|
|
21
|
-
#include <Ice/Protocol.h>
|
|
22
|
-
#include <Ice/FactoryTableInit.h>
|
|
23
|
-
#include <Ice/TraceUtil.h>
|
|
24
|
-
#include <Ice/TraceLevels.h>
|
|
25
|
-
#include <Ice/LoggerUtil.h>
|
|
26
|
-
#include <Ice/SlicedData.h>
|
|
27
|
-
#include <IceUtil/StringConverter.h>
|
|
28
|
-
#include <iterator>
|
|
29
|
-
|
|
30
|
-
using namespace std;
|
|
31
|
-
using namespace Ice;
|
|
32
|
-
using namespace IceInternal;
|
|
33
|
-
|
|
34
|
-
namespace
|
|
35
|
-
{
|
|
36
|
-
|
|
37
|
-
class StreamUTF8BufferI : public IceUtil::UTF8Buffer
|
|
38
|
-
{
|
|
39
|
-
public:
|
|
40
|
-
|
|
41
|
-
StreamUTF8BufferI(BasicStream& stream) :
|
|
42
|
-
_stream(stream)
|
|
43
|
-
{
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
Ice::Byte*
|
|
47
|
-
getMoreBytes(size_t howMany, Ice::Byte* firstUnused)
|
|
48
|
-
{
|
|
49
|
-
assert(howMany > 0);
|
|
50
|
-
|
|
51
|
-
if(firstUnused != 0)
|
|
52
|
-
{
|
|
53
|
-
//
|
|
54
|
-
// Return unused bytes
|
|
55
|
-
//
|
|
56
|
-
_stream.resize(firstUnused - _stream.b.begin());
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
//
|
|
60
|
-
// Index of first unused byte
|
|
61
|
-
//
|
|
62
|
-
Buffer::Container::size_type pos = _stream.b.size();
|
|
63
|
-
|
|
64
|
-
//
|
|
65
|
-
// Since resize may reallocate the buffer, when firstUnused != 0, the
|
|
66
|
-
// return value can be != firstUnused
|
|
67
|
-
//
|
|
68
|
-
_stream.resize(pos + howMany);
|
|
69
|
-
|
|
70
|
-
return &_stream.b[pos];
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
private:
|
|
74
|
-
|
|
75
|
-
BasicStream& _stream;
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
const Byte OPTIONAL_END_MARKER = 0xFF;
|
|
79
|
-
|
|
80
|
-
const Byte FLAG_HAS_TYPE_ID_STRING = (1<<0);
|
|
81
|
-
const Byte FLAG_HAS_TYPE_ID_INDEX = (1<<1);
|
|
82
|
-
const Byte FLAG_HAS_TYPE_ID_COMPACT = (1<<0) | (1<<1);
|
|
83
|
-
const Byte FLAG_HAS_OPTIONAL_MEMBERS = (1<<2);
|
|
84
|
-
const Byte FLAG_HAS_INDIRECTION_TABLE = (1<<3);
|
|
85
|
-
const Byte FLAG_HAS_SLICE_SIZE = (1<<4);
|
|
86
|
-
const Byte FLAG_IS_LAST_SLICE = (1<<5);
|
|
87
|
-
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
IceInternal::BasicStream::BasicStream(Instance* instance, const EncodingVersion& encoding) :
|
|
91
|
-
_instance(instance),
|
|
92
|
-
_closure(0),
|
|
93
|
-
_encoding(encoding),
|
|
94
|
-
_currentReadEncaps(0),
|
|
95
|
-
_currentWriteEncaps(0),
|
|
96
|
-
_sliceObjects(true),
|
|
97
|
-
_stringConverter(instance->getStringConverter()),
|
|
98
|
-
_wstringConverter(instance->getWstringConverter()),
|
|
99
|
-
_startSeq(-1),
|
|
100
|
-
_minSeqSize(0)
|
|
101
|
-
{
|
|
102
|
-
//
|
|
103
|
-
// Initialize the encoding members of our pre-allocated encapsulations, in case
|
|
104
|
-
// this stream is used without an explicit encapsulation.
|
|
105
|
-
//
|
|
106
|
-
_preAllocatedReadEncaps.encoding = encoding;
|
|
107
|
-
_preAllocatedWriteEncaps.encoding = encoding;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
IceInternal::BasicStream::BasicStream(Instance* instance, const EncodingVersion& encoding, const Byte* begin,
|
|
111
|
-
const Byte* end) :
|
|
112
|
-
IceInternal::Buffer(begin, end),
|
|
113
|
-
_instance(instance),
|
|
114
|
-
_closure(0),
|
|
115
|
-
_encoding(encoding),
|
|
116
|
-
_currentReadEncaps(0),
|
|
117
|
-
_currentWriteEncaps(0),
|
|
118
|
-
_sliceObjects(true),
|
|
119
|
-
_stringConverter(instance->getStringConverter()),
|
|
120
|
-
_wstringConverter(instance->getWstringConverter()),
|
|
121
|
-
_startSeq(-1),
|
|
122
|
-
_minSeqSize(0)
|
|
123
|
-
{
|
|
124
|
-
//
|
|
125
|
-
// Initialize the encoding members of our pre-allocated encapsulations, in case
|
|
126
|
-
// this stream is used without an explicit encapsulation.
|
|
127
|
-
//
|
|
128
|
-
_preAllocatedReadEncaps.encoding = encoding;
|
|
129
|
-
_preAllocatedWriteEncaps.encoding = encoding;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
void
|
|
133
|
-
IceInternal::BasicStream::clear()
|
|
134
|
-
{
|
|
135
|
-
while(_currentReadEncaps && _currentReadEncaps != &_preAllocatedReadEncaps)
|
|
136
|
-
{
|
|
137
|
-
ReadEncaps* oldEncaps = _currentReadEncaps;
|
|
138
|
-
_currentReadEncaps = _currentReadEncaps->previous;
|
|
139
|
-
delete oldEncaps;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
while(_currentWriteEncaps && _currentWriteEncaps != &_preAllocatedWriteEncaps)
|
|
143
|
-
{
|
|
144
|
-
WriteEncaps* oldEncaps = _currentWriteEncaps;
|
|
145
|
-
_currentWriteEncaps = _currentWriteEncaps->previous;
|
|
146
|
-
delete oldEncaps;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
_startSeq = -1;
|
|
150
|
-
_sliceObjects = true;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
void*
|
|
154
|
-
IceInternal::BasicStream::closure() const
|
|
155
|
-
{
|
|
156
|
-
return _closure;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
void*
|
|
160
|
-
IceInternal::BasicStream::closure(void* p)
|
|
161
|
-
{
|
|
162
|
-
void* prev = _closure;
|
|
163
|
-
_closure = p;
|
|
164
|
-
return prev;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
void
|
|
168
|
-
IceInternal::BasicStream::swap(BasicStream& other)
|
|
169
|
-
{
|
|
170
|
-
assert(_instance == other._instance);
|
|
171
|
-
|
|
172
|
-
swapBuffer(other);
|
|
173
|
-
|
|
174
|
-
std::swap(_closure, other._closure);
|
|
175
|
-
|
|
176
|
-
//
|
|
177
|
-
// Swap is never called for BasicStreams that have encapsulations being read/write. However,
|
|
178
|
-
// encapsulations might still be set in case marhsalling or un-marhsalling failed. We just
|
|
179
|
-
// reset the encapsulations if there are still some set.
|
|
180
|
-
//
|
|
181
|
-
resetEncaps();
|
|
182
|
-
other.resetEncaps();
|
|
183
|
-
|
|
184
|
-
std::swap(_startSeq, other._startSeq);
|
|
185
|
-
std::swap(_minSeqSize, other._minSeqSize);
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
void
|
|
189
|
-
IceInternal::BasicStream::resetEncaps()
|
|
190
|
-
{
|
|
191
|
-
while(_currentReadEncaps && _currentReadEncaps != &_preAllocatedReadEncaps)
|
|
192
|
-
{
|
|
193
|
-
ReadEncaps* oldEncaps = _currentReadEncaps;
|
|
194
|
-
_currentReadEncaps = _currentReadEncaps->previous;
|
|
195
|
-
delete oldEncaps;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
while(_currentWriteEncaps && _currentWriteEncaps != &_preAllocatedWriteEncaps)
|
|
199
|
-
{
|
|
200
|
-
WriteEncaps* oldEncaps = _currentWriteEncaps;
|
|
201
|
-
_currentWriteEncaps = _currentWriteEncaps->previous;
|
|
202
|
-
delete oldEncaps;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
_preAllocatedReadEncaps.reset();
|
|
206
|
-
_preAllocatedWriteEncaps.reset();
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
void
|
|
210
|
-
IceInternal::BasicStream::startWriteEncaps()
|
|
211
|
-
{
|
|
212
|
-
//
|
|
213
|
-
// If no encoding version is specified, use the current write
|
|
214
|
-
// encapsulation encoding version if there's a current write
|
|
215
|
-
// encapsulation, otherwise, use the stream encoding version.
|
|
216
|
-
//
|
|
217
|
-
|
|
218
|
-
if(_currentWriteEncaps)
|
|
219
|
-
{
|
|
220
|
-
startWriteEncaps(_currentWriteEncaps->encoding, _currentWriteEncaps->format);
|
|
221
|
-
}
|
|
222
|
-
else
|
|
223
|
-
{
|
|
224
|
-
startWriteEncaps(_encoding, Ice::DefaultFormat);
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
void
|
|
229
|
-
IceInternal::BasicStream::endWriteEncapsChecked()
|
|
230
|
-
{
|
|
231
|
-
if(!_currentWriteEncaps)
|
|
232
|
-
{
|
|
233
|
-
throw EncapsulationException(__FILE__, __LINE__, "not in an encapsulation");
|
|
234
|
-
}
|
|
235
|
-
endWriteEncaps();
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
void
|
|
239
|
-
IceInternal::BasicStream::endReadEncapsChecked()
|
|
240
|
-
{
|
|
241
|
-
if(!_currentReadEncaps)
|
|
242
|
-
{
|
|
243
|
-
throw EncapsulationException(__FILE__, __LINE__, "not in an encapsulation");
|
|
244
|
-
}
|
|
245
|
-
endReadEncaps();
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
Int
|
|
249
|
-
IceInternal::BasicStream::getReadEncapsSize()
|
|
250
|
-
{
|
|
251
|
-
assert(_currentReadEncaps);
|
|
252
|
-
return _currentReadEncaps->sz - static_cast<Int>(sizeof(Int)) - 2;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
EncodingVersion
|
|
256
|
-
IceInternal::BasicStream::skipEncaps()
|
|
257
|
-
{
|
|
258
|
-
Int sz;
|
|
259
|
-
read(sz);
|
|
260
|
-
if(sz < 6)
|
|
261
|
-
{
|
|
262
|
-
throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
|
|
263
|
-
}
|
|
264
|
-
if(i - sizeof(Int) + sz > b.end())
|
|
265
|
-
{
|
|
266
|
-
throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
|
|
267
|
-
}
|
|
268
|
-
EncodingVersion encoding;
|
|
269
|
-
read(encoding.major);
|
|
270
|
-
read(encoding.minor);
|
|
271
|
-
i += sz - sizeof(Int) - 2;
|
|
272
|
-
return encoding;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
void
|
|
276
|
-
IceInternal::BasicStream::readPendingObjects()
|
|
277
|
-
{
|
|
278
|
-
if(_currentReadEncaps && _currentReadEncaps->decoder)
|
|
279
|
-
{
|
|
280
|
-
_currentReadEncaps->decoder->readPendingObjects();
|
|
281
|
-
}
|
|
282
|
-
else if(getReadEncoding() == Ice::Encoding_1_0)
|
|
283
|
-
{
|
|
284
|
-
//
|
|
285
|
-
// If using the 1.0 encoding and no objects were read, we
|
|
286
|
-
// still read an empty sequence of pending objects if
|
|
287
|
-
// requested (i.e.: if this is called).
|
|
288
|
-
//
|
|
289
|
-
// This is required by the 1.0 encoding, even if no objects
|
|
290
|
-
// are written we do marshal an empty sequence if marshaled
|
|
291
|
-
// data types use classes.
|
|
292
|
-
//
|
|
293
|
-
skipSize();
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
void
|
|
298
|
-
IceInternal::BasicStream::writePendingObjects()
|
|
299
|
-
{
|
|
300
|
-
if(_currentWriteEncaps && _currentWriteEncaps->encoder)
|
|
301
|
-
{
|
|
302
|
-
_currentWriteEncaps->encoder->writePendingObjects();
|
|
303
|
-
}
|
|
304
|
-
else if(getWriteEncoding() == Ice::Encoding_1_0)
|
|
305
|
-
{
|
|
306
|
-
//
|
|
307
|
-
// If using the 1.0 encoding and no objects were written, we
|
|
308
|
-
// still write an empty sequence for pending objects if
|
|
309
|
-
// requested (i.e.: if this is called).
|
|
310
|
-
//
|
|
311
|
-
// This is required by the 1.0 encoding, even if no objects
|
|
312
|
-
// are written we do marshal an empty sequence if marshaled
|
|
313
|
-
// data types use classes.
|
|
314
|
-
//
|
|
315
|
-
writeSize(0);
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
Int
|
|
320
|
-
IceInternal::BasicStream::readAndCheckSeqSize(int minSize)
|
|
321
|
-
{
|
|
322
|
-
Int sz = readSize();
|
|
323
|
-
|
|
324
|
-
if(sz == 0)
|
|
325
|
-
{
|
|
326
|
-
return sz;
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
//
|
|
330
|
-
// The _startSeq variable points to the start of the sequence for which
|
|
331
|
-
// we expect to read at least _minSeqSize bytes from the stream.
|
|
332
|
-
//
|
|
333
|
-
// If not initialized or if we already read more data than _minSeqSize,
|
|
334
|
-
// we reset _startSeq and _minSeqSize for this sequence (possibly a
|
|
335
|
-
// top-level sequence or enclosed sequence it doesn't really matter).
|
|
336
|
-
//
|
|
337
|
-
// Otherwise, we are reading an enclosed sequence and we have to bump
|
|
338
|
-
// _minSeqSize by the minimum size that this sequence will require on
|
|
339
|
-
// the stream.
|
|
340
|
-
//
|
|
341
|
-
// The goal of this check is to ensure that when we start un-marshalling
|
|
342
|
-
// a new sequence, we check the minimal size of this new sequence against
|
|
343
|
-
// the estimated remaining buffer size. This estimatation is based on
|
|
344
|
-
// the minimum size of the enclosing sequences, it's _minSeqSize.
|
|
345
|
-
//
|
|
346
|
-
if(_startSeq == -1 || i > (b.begin() + _startSeq + _minSeqSize))
|
|
347
|
-
{
|
|
348
|
-
_startSeq = static_cast<int>(i - b.begin());
|
|
349
|
-
_minSeqSize = sz * minSize;
|
|
350
|
-
}
|
|
351
|
-
else
|
|
352
|
-
{
|
|
353
|
-
_minSeqSize += sz * minSize;
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
//
|
|
357
|
-
// If there isn't enough data to read on the stream for the sequence (and
|
|
358
|
-
// possibly enclosed sequences), something is wrong with the marshalled
|
|
359
|
-
// data: it's claiming having more data that what is possible to read.
|
|
360
|
-
//
|
|
361
|
-
if(_startSeq + _minSeqSize > static_cast<int>(b.size()))
|
|
362
|
-
{
|
|
363
|
-
throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
return sz;
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
void
|
|
370
|
-
IceInternal::BasicStream::writeBlob(const vector<Byte>& v)
|
|
371
|
-
{
|
|
372
|
-
if(!v.empty())
|
|
373
|
-
{
|
|
374
|
-
Container::size_type pos = b.size();
|
|
375
|
-
resize(pos + v.size());
|
|
376
|
-
memcpy(&b[pos], &v[0], v.size());
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
void
|
|
381
|
-
IceInternal::BasicStream::readBlob(vector<Byte>& v, Int sz)
|
|
382
|
-
{
|
|
383
|
-
if(sz > 0)
|
|
384
|
-
{
|
|
385
|
-
if(b.end() - i < sz)
|
|
386
|
-
{
|
|
387
|
-
throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
|
|
388
|
-
}
|
|
389
|
-
vector<Byte>(i, i + sz).swap(v);
|
|
390
|
-
i += sz;
|
|
391
|
-
}
|
|
392
|
-
else
|
|
393
|
-
{
|
|
394
|
-
v.clear();
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
void
|
|
399
|
-
IceInternal::BasicStream::write(const Byte* begin, const Byte* end)
|
|
400
|
-
{
|
|
401
|
-
Int sz = static_cast<Int>(end - begin);
|
|
402
|
-
writeSize(sz);
|
|
403
|
-
if(sz > 0)
|
|
404
|
-
{
|
|
405
|
-
Container::size_type pos = b.size();
|
|
406
|
-
resize(pos + sz);
|
|
407
|
-
memcpy(&b[pos], begin, sz);
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
void
|
|
412
|
-
IceInternal::BasicStream::read(std::vector<Ice::Byte>& v)
|
|
413
|
-
{
|
|
414
|
-
std::pair<const Ice::Byte*, const Ice::Byte*> p;
|
|
415
|
-
read(p);
|
|
416
|
-
if(p.first != p.second)
|
|
417
|
-
{
|
|
418
|
-
v.resize(static_cast<Ice::Int>(p.second - p.first));
|
|
419
|
-
copy(p.first, p.second, v.begin());
|
|
420
|
-
}
|
|
421
|
-
else
|
|
422
|
-
{
|
|
423
|
-
v.clear();
|
|
424
|
-
}
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
void
|
|
428
|
-
IceInternal::BasicStream::read(pair<const Byte*, const Byte*>& v)
|
|
429
|
-
{
|
|
430
|
-
Int sz = readAndCheckSeqSize(1);
|
|
431
|
-
if(sz > 0)
|
|
432
|
-
{
|
|
433
|
-
v.first = i;
|
|
434
|
-
v.second = i + sz;
|
|
435
|
-
i += sz;
|
|
436
|
-
}
|
|
437
|
-
else
|
|
438
|
-
{
|
|
439
|
-
v.first = v.second = i;
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
void
|
|
444
|
-
IceInternal::BasicStream::write(const vector<bool>& v)
|
|
445
|
-
{
|
|
446
|
-
Int sz = static_cast<Int>(v.size());
|
|
447
|
-
writeSize(sz);
|
|
448
|
-
if(sz > 0)
|
|
449
|
-
{
|
|
450
|
-
Container::size_type pos = b.size();
|
|
451
|
-
resize(pos + sz);
|
|
452
|
-
copy(v.begin(), v.end(), b.begin() + pos);
|
|
453
|
-
}
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
namespace
|
|
457
|
-
{
|
|
458
|
-
|
|
459
|
-
template<size_t boolSize>
|
|
460
|
-
struct BasicStreamWriteBoolHelper
|
|
461
|
-
{
|
|
462
|
-
static void write(const bool* begin, BasicStream::Container::size_type pos, BasicStream::Container& b, Int sz)
|
|
463
|
-
{
|
|
464
|
-
for(int idx = 0; idx < sz; ++idx)
|
|
465
|
-
{
|
|
466
|
-
b[pos + idx] = static_cast<Byte>(*(begin + idx));
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
};
|
|
470
|
-
|
|
471
|
-
template<>
|
|
472
|
-
struct BasicStreamWriteBoolHelper<1>
|
|
473
|
-
{
|
|
474
|
-
static void write(const bool* begin, BasicStream::Container::size_type pos, BasicStream::Container& b, Int sz)
|
|
475
|
-
{
|
|
476
|
-
memcpy(&b[pos], begin, sz);
|
|
477
|
-
}
|
|
478
|
-
};
|
|
479
|
-
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
void
|
|
483
|
-
IceInternal::BasicStream::write(const bool* begin, const bool* end)
|
|
484
|
-
{
|
|
485
|
-
Int sz = static_cast<Int>(end - begin);
|
|
486
|
-
writeSize(sz);
|
|
487
|
-
if(sz > 0)
|
|
488
|
-
{
|
|
489
|
-
Container::size_type pos = b.size();
|
|
490
|
-
resize(pos + sz);
|
|
491
|
-
BasicStreamWriteBoolHelper<sizeof(bool)>::write(begin, pos, b, sz);
|
|
492
|
-
}
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
void
|
|
496
|
-
IceInternal::BasicStream::read(vector<bool>& v)
|
|
497
|
-
{
|
|
498
|
-
Int sz = readAndCheckSeqSize(1);
|
|
499
|
-
if(sz > 0)
|
|
500
|
-
{
|
|
501
|
-
v.resize(sz);
|
|
502
|
-
copy(i, i + sz, v.begin());
|
|
503
|
-
i += sz;
|
|
504
|
-
}
|
|
505
|
-
else
|
|
506
|
-
{
|
|
507
|
-
v.clear();
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
namespace
|
|
512
|
-
{
|
|
513
|
-
|
|
514
|
-
template<size_t boolSize>
|
|
515
|
-
struct BasicStreamReadBoolHelper
|
|
516
|
-
{
|
|
517
|
-
static bool* read(pair<const bool*, const bool*>& v, Int sz, BasicStream::Container::iterator& i)
|
|
518
|
-
{
|
|
519
|
-
bool* array = new bool[sz];
|
|
520
|
-
for(int idx = 0; idx < sz; ++idx)
|
|
521
|
-
{
|
|
522
|
-
array[idx] = static_cast<bool>(*(i + idx));
|
|
523
|
-
}
|
|
524
|
-
v.first = array;
|
|
525
|
-
v.second = array + sz;
|
|
526
|
-
return array;
|
|
527
|
-
}
|
|
528
|
-
};
|
|
529
|
-
|
|
530
|
-
template<>
|
|
531
|
-
struct BasicStreamReadBoolHelper<1>
|
|
532
|
-
{
|
|
533
|
-
static bool* read(pair<const bool*, const bool*>& v, Int sz, BasicStream::Container::iterator& i)
|
|
534
|
-
{
|
|
535
|
-
v.first = reinterpret_cast<bool*>(i);
|
|
536
|
-
v.second = reinterpret_cast<bool*>(i) + sz;
|
|
537
|
-
return 0;
|
|
538
|
-
}
|
|
539
|
-
};
|
|
540
|
-
|
|
541
|
-
}
|
|
542
|
-
|
|
543
|
-
void
|
|
544
|
-
IceInternal::BasicStream::read(pair<const bool*, const bool*>& v, IceUtil::ScopedArray<bool>& result)
|
|
545
|
-
{
|
|
546
|
-
Int sz = readAndCheckSeqSize(1);
|
|
547
|
-
if(sz > 0)
|
|
548
|
-
{
|
|
549
|
-
result.reset(BasicStreamReadBoolHelper<sizeof(bool)>::read(v, sz, i));
|
|
550
|
-
i += sz;
|
|
551
|
-
}
|
|
552
|
-
else
|
|
553
|
-
{
|
|
554
|
-
result.reset();
|
|
555
|
-
v.first = v.second = reinterpret_cast<bool*>(i);
|
|
556
|
-
}
|
|
557
|
-
}
|
|
558
|
-
|
|
559
|
-
void
|
|
560
|
-
IceInternal::BasicStream::write(Short v)
|
|
561
|
-
{
|
|
562
|
-
Container::size_type pos = b.size();
|
|
563
|
-
resize(pos + sizeof(Short));
|
|
564
|
-
Byte* dest = &b[pos];
|
|
565
|
-
#ifdef ICE_BIG_ENDIAN
|
|
566
|
-
const Byte* src = reinterpret_cast<const Byte*>(&v) + sizeof(Short) - 1;
|
|
567
|
-
*dest++ = *src--;
|
|
568
|
-
*dest = *src;
|
|
569
|
-
#else
|
|
570
|
-
const Byte* src = reinterpret_cast<const Byte*>(&v);
|
|
571
|
-
*dest++ = *src++;
|
|
572
|
-
*dest = *src;
|
|
573
|
-
#endif
|
|
574
|
-
}
|
|
575
|
-
|
|
576
|
-
void
|
|
577
|
-
IceInternal::BasicStream::write(const Short* begin, const Short* end)
|
|
578
|
-
{
|
|
579
|
-
Int sz = static_cast<Int>(end - begin);
|
|
580
|
-
writeSize(sz);
|
|
581
|
-
if(sz > 0)
|
|
582
|
-
{
|
|
583
|
-
Container::size_type pos = b.size();
|
|
584
|
-
resize(pos + sz * sizeof(Short));
|
|
585
|
-
#ifdef ICE_BIG_ENDIAN
|
|
586
|
-
const Byte* src = reinterpret_cast<const Byte*>(begin) + sizeof(Short) - 1;
|
|
587
|
-
Byte* dest = &(*(b.begin() + pos));
|
|
588
|
-
for(int j = 0 ; j < sz ; ++j)
|
|
589
|
-
{
|
|
590
|
-
*dest++ = *src--;
|
|
591
|
-
*dest++ = *src--;
|
|
592
|
-
src += 2 * sizeof(Short);
|
|
593
|
-
}
|
|
594
|
-
#else
|
|
595
|
-
memcpy(&b[pos], reinterpret_cast<const Byte*>(begin), sz * sizeof(Short));
|
|
596
|
-
#endif
|
|
597
|
-
}
|
|
598
|
-
}
|
|
599
|
-
|
|
600
|
-
void
|
|
601
|
-
IceInternal::BasicStream::read(Short& v)
|
|
602
|
-
{
|
|
603
|
-
if(b.end() - i < static_cast<int>(sizeof(Short)))
|
|
604
|
-
{
|
|
605
|
-
throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
|
|
606
|
-
}
|
|
607
|
-
const Byte* src = &(*i);
|
|
608
|
-
i += sizeof(Short);
|
|
609
|
-
#ifdef ICE_BIG_ENDIAN
|
|
610
|
-
Byte* dest = reinterpret_cast<Byte*>(&v) + sizeof(Short) - 1;
|
|
611
|
-
*dest-- = *src++;
|
|
612
|
-
*dest = *src;
|
|
613
|
-
#else
|
|
614
|
-
Byte* dest = reinterpret_cast<Byte*>(&v);
|
|
615
|
-
*dest++ = *src++;
|
|
616
|
-
*dest = *src;
|
|
617
|
-
#endif
|
|
618
|
-
}
|
|
619
|
-
|
|
620
|
-
void
|
|
621
|
-
IceInternal::BasicStream::read(vector<Short>& v)
|
|
622
|
-
{
|
|
623
|
-
Int sz = readAndCheckSeqSize(static_cast<int>(sizeof(Short)));
|
|
624
|
-
if(sz > 0)
|
|
625
|
-
{
|
|
626
|
-
Container::iterator begin = i;
|
|
627
|
-
i += sz * static_cast<int>(sizeof(Short));
|
|
628
|
-
v.resize(sz);
|
|
629
|
-
#ifdef ICE_BIG_ENDIAN
|
|
630
|
-
const Byte* src = &(*begin);
|
|
631
|
-
Byte* dest = reinterpret_cast<Byte*>(&v[0]) + sizeof(Short) - 1;
|
|
632
|
-
for(int j = 0 ; j < sz ; ++j)
|
|
633
|
-
{
|
|
634
|
-
*dest-- = *src++;
|
|
635
|
-
*dest-- = *src++;
|
|
636
|
-
dest += 2 * sizeof(Short);
|
|
637
|
-
}
|
|
638
|
-
#else
|
|
639
|
-
copy(begin, i, reinterpret_cast<Byte*>(&v[0]));
|
|
640
|
-
#endif
|
|
641
|
-
}
|
|
642
|
-
else
|
|
643
|
-
{
|
|
644
|
-
v.clear();
|
|
645
|
-
}
|
|
646
|
-
}
|
|
647
|
-
|
|
648
|
-
void
|
|
649
|
-
IceInternal::BasicStream::read(pair<const Short*, const Short*>& v, IceUtil::ScopedArray<Short>& result)
|
|
650
|
-
{
|
|
651
|
-
Int sz = readAndCheckSeqSize(static_cast<int>(sizeof(Short)));
|
|
652
|
-
if(sz > 0)
|
|
653
|
-
{
|
|
654
|
-
#if defined(__i386) || defined(_M_IX86) || defined(__x86_64) || defined(_M_X64)
|
|
655
|
-
v.first = reinterpret_cast<Short*>(i);
|
|
656
|
-
i += sz * static_cast<int>(sizeof(Short));
|
|
657
|
-
v.second = reinterpret_cast<Short*>(i);
|
|
658
|
-
#else
|
|
659
|
-
result.reset(new Short[sz]);
|
|
660
|
-
v.first = result.get();
|
|
661
|
-
v.second = result.get() + sz;
|
|
662
|
-
|
|
663
|
-
Container::iterator begin = i;
|
|
664
|
-
i += sz * static_cast<int>(sizeof(Short));
|
|
665
|
-
# ifdef ICE_BIG_ENDIAN
|
|
666
|
-
const Byte* src = &(*begin);
|
|
667
|
-
Byte* dest = reinterpret_cast<Byte*>(&result[0]) + sizeof(Short) - 1;
|
|
668
|
-
for(int j = 0 ; j < sz ; ++j)
|
|
669
|
-
{
|
|
670
|
-
*dest-- = *src++;
|
|
671
|
-
*dest-- = *src++;
|
|
672
|
-
dest += 2 * sizeof(Short);
|
|
673
|
-
}
|
|
674
|
-
# else
|
|
675
|
-
copy(begin, i, reinterpret_cast<Byte*>(&result[0]));
|
|
676
|
-
# endif
|
|
677
|
-
#endif
|
|
678
|
-
}
|
|
679
|
-
else
|
|
680
|
-
{
|
|
681
|
-
result.reset();
|
|
682
|
-
v.first = v.second = 0;
|
|
683
|
-
}
|
|
684
|
-
}
|
|
685
|
-
|
|
686
|
-
void
|
|
687
|
-
IceInternal::BasicStream::write(const Int* begin, const Int* end)
|
|
688
|
-
{
|
|
689
|
-
Int sz = static_cast<Int>(end - begin);
|
|
690
|
-
writeSize(sz);
|
|
691
|
-
if(sz > 0)
|
|
692
|
-
{
|
|
693
|
-
Container::size_type pos = b.size();
|
|
694
|
-
resize(pos + sz * sizeof(Int));
|
|
695
|
-
#ifdef ICE_BIG_ENDIAN
|
|
696
|
-
const Byte* src = reinterpret_cast<const Byte*>(begin) + sizeof(Int) - 1;
|
|
697
|
-
Byte* dest = &(*(b.begin() + pos));
|
|
698
|
-
for(int j = 0 ; j < sz ; ++j)
|
|
699
|
-
{
|
|
700
|
-
*dest++ = *src--;
|
|
701
|
-
*dest++ = *src--;
|
|
702
|
-
*dest++ = *src--;
|
|
703
|
-
*dest++ = *src--;
|
|
704
|
-
src += 2 * sizeof(Int);
|
|
705
|
-
}
|
|
706
|
-
#else
|
|
707
|
-
memcpy(&b[pos], reinterpret_cast<const Byte*>(begin), sz * sizeof(Int));
|
|
708
|
-
#endif
|
|
709
|
-
}
|
|
710
|
-
}
|
|
711
|
-
|
|
712
|
-
void
|
|
713
|
-
IceInternal::BasicStream::read(vector<Int>& v)
|
|
714
|
-
{
|
|
715
|
-
Int sz = readAndCheckSeqSize(static_cast<int>(sizeof(Int)));
|
|
716
|
-
if(sz > 0)
|
|
717
|
-
{
|
|
718
|
-
Container::iterator begin = i;
|
|
719
|
-
i += sz * static_cast<int>(sizeof(Int));
|
|
720
|
-
v.resize(sz);
|
|
721
|
-
#ifdef ICE_BIG_ENDIAN
|
|
722
|
-
const Byte* src = &(*begin);
|
|
723
|
-
Byte* dest = reinterpret_cast<Byte*>(&v[0]) + sizeof(Int) - 1;
|
|
724
|
-
for(int j = 0 ; j < sz ; ++j)
|
|
725
|
-
{
|
|
726
|
-
*dest-- = *src++;
|
|
727
|
-
*dest-- = *src++;
|
|
728
|
-
*dest-- = *src++;
|
|
729
|
-
*dest-- = *src++;
|
|
730
|
-
dest += 2 * sizeof(Int);
|
|
731
|
-
}
|
|
732
|
-
#else
|
|
733
|
-
copy(begin, i, reinterpret_cast<Byte*>(&v[0]));
|
|
734
|
-
#endif
|
|
735
|
-
}
|
|
736
|
-
else
|
|
737
|
-
{
|
|
738
|
-
v.clear();
|
|
739
|
-
}
|
|
740
|
-
}
|
|
741
|
-
|
|
742
|
-
void
|
|
743
|
-
IceInternal::BasicStream::read(pair<const Int*, const Int*>& v, ::IceUtil::ScopedArray<Int>& result)
|
|
744
|
-
{
|
|
745
|
-
Int sz = readAndCheckSeqSize(static_cast<int>(sizeof(Int)));
|
|
746
|
-
if(sz > 0)
|
|
747
|
-
{
|
|
748
|
-
#if defined(__i386) || defined(_M_IX86) || defined(__x86_64) || defined(_M_X64)
|
|
749
|
-
v.first = reinterpret_cast<Int*>(i);
|
|
750
|
-
i += sz * static_cast<int>(sizeof(Int));
|
|
751
|
-
v.second = reinterpret_cast<Int*>(i);
|
|
752
|
-
#else
|
|
753
|
-
result.reset(new Int[sz]);
|
|
754
|
-
v.first = result.get();
|
|
755
|
-
v.second = result.get() + sz;
|
|
756
|
-
|
|
757
|
-
Container::iterator begin = i;
|
|
758
|
-
i += sz * static_cast<int>(sizeof(Int));
|
|
759
|
-
# ifdef ICE_BIG_ENDIAN
|
|
760
|
-
const Byte* src = &(*begin);
|
|
761
|
-
Byte* dest = reinterpret_cast<Byte*>(&result[0]) + sizeof(Int) - 1;
|
|
762
|
-
for(int j = 0 ; j < sz ; ++j)
|
|
763
|
-
{
|
|
764
|
-
*dest-- = *src++;
|
|
765
|
-
*dest-- = *src++;
|
|
766
|
-
*dest-- = *src++;
|
|
767
|
-
*dest-- = *src++;
|
|
768
|
-
dest += 2 * sizeof(Int);
|
|
769
|
-
}
|
|
770
|
-
# else
|
|
771
|
-
copy(begin, i, reinterpret_cast<Byte*>(&result[0]));
|
|
772
|
-
# endif
|
|
773
|
-
#endif
|
|
774
|
-
}
|
|
775
|
-
else
|
|
776
|
-
{
|
|
777
|
-
result.reset();
|
|
778
|
-
v.first = v.second = 0;
|
|
779
|
-
}
|
|
780
|
-
}
|
|
781
|
-
|
|
782
|
-
void
|
|
783
|
-
IceInternal::BasicStream::write(Long v)
|
|
784
|
-
{
|
|
785
|
-
Container::size_type pos = b.size();
|
|
786
|
-
resize(pos + sizeof(Long));
|
|
787
|
-
Byte* dest = &b[pos];
|
|
788
|
-
#ifdef ICE_BIG_ENDIAN
|
|
789
|
-
const Byte* src = reinterpret_cast<const Byte*>(&v) + sizeof(Long) - 1;
|
|
790
|
-
*dest++ = *src--;
|
|
791
|
-
*dest++ = *src--;
|
|
792
|
-
*dest++ = *src--;
|
|
793
|
-
*dest++ = *src--;
|
|
794
|
-
*dest++ = *src--;
|
|
795
|
-
*dest++ = *src--;
|
|
796
|
-
*dest++ = *src--;
|
|
797
|
-
*dest = *src;
|
|
798
|
-
#else
|
|
799
|
-
const Byte* src = reinterpret_cast<const Byte*>(&v);
|
|
800
|
-
*dest++ = *src++;
|
|
801
|
-
*dest++ = *src++;
|
|
802
|
-
*dest++ = *src++;
|
|
803
|
-
*dest++ = *src++;
|
|
804
|
-
*dest++ = *src++;
|
|
805
|
-
*dest++ = *src++;
|
|
806
|
-
*dest++ = *src++;
|
|
807
|
-
*dest = *src;
|
|
808
|
-
#endif
|
|
809
|
-
}
|
|
810
|
-
|
|
811
|
-
void
|
|
812
|
-
IceInternal::BasicStream::write(const Long* begin, const Long* end)
|
|
813
|
-
{
|
|
814
|
-
Int sz = static_cast<Int>(end - begin);
|
|
815
|
-
writeSize(sz);
|
|
816
|
-
if(sz > 0)
|
|
817
|
-
{
|
|
818
|
-
Container::size_type pos = b.size();
|
|
819
|
-
resize(pos + sz * sizeof(Long));
|
|
820
|
-
#ifdef ICE_BIG_ENDIAN
|
|
821
|
-
const Byte* src = reinterpret_cast<const Byte*>(begin) + sizeof(Long) - 1;
|
|
822
|
-
Byte* dest = &(*(b.begin() + pos));
|
|
823
|
-
for(int j = 0 ; j < sz ; ++j)
|
|
824
|
-
{
|
|
825
|
-
*dest++ = *src--;
|
|
826
|
-
*dest++ = *src--;
|
|
827
|
-
*dest++ = *src--;
|
|
828
|
-
*dest++ = *src--;
|
|
829
|
-
*dest++ = *src--;
|
|
830
|
-
*dest++ = *src--;
|
|
831
|
-
*dest++ = *src--;
|
|
832
|
-
*dest++ = *src--;
|
|
833
|
-
src += 2 * sizeof(Long);
|
|
834
|
-
}
|
|
835
|
-
#else
|
|
836
|
-
memcpy(&b[pos], reinterpret_cast<const Byte*>(begin), sz * sizeof(Long));
|
|
837
|
-
#endif
|
|
838
|
-
}
|
|
839
|
-
}
|
|
840
|
-
|
|
841
|
-
void
|
|
842
|
-
IceInternal::BasicStream::read(Long& v)
|
|
843
|
-
{
|
|
844
|
-
if(b.end() - i < static_cast<int>(sizeof(Long)))
|
|
845
|
-
{
|
|
846
|
-
throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
|
|
847
|
-
}
|
|
848
|
-
const Byte* src = &(*i);
|
|
849
|
-
i += sizeof(Long);
|
|
850
|
-
#ifdef ICE_BIG_ENDIAN
|
|
851
|
-
Byte* dest = reinterpret_cast<Byte*>(&v) + sizeof(Long) - 1;
|
|
852
|
-
*dest-- = *src++;
|
|
853
|
-
*dest-- = *src++;
|
|
854
|
-
*dest-- = *src++;
|
|
855
|
-
*dest-- = *src++;
|
|
856
|
-
*dest-- = *src++;
|
|
857
|
-
*dest-- = *src++;
|
|
858
|
-
*dest-- = *src++;
|
|
859
|
-
*dest = *src;
|
|
860
|
-
#else
|
|
861
|
-
Byte* dest = reinterpret_cast<Byte*>(&v);
|
|
862
|
-
*dest++ = *src++;
|
|
863
|
-
*dest++ = *src++;
|
|
864
|
-
*dest++ = *src++;
|
|
865
|
-
*dest++ = *src++;
|
|
866
|
-
*dest++ = *src++;
|
|
867
|
-
*dest++ = *src++;
|
|
868
|
-
*dest++ = *src++;
|
|
869
|
-
*dest = *src;
|
|
870
|
-
#endif
|
|
871
|
-
}
|
|
872
|
-
|
|
873
|
-
void
|
|
874
|
-
IceInternal::BasicStream::read(vector<Long>& v)
|
|
875
|
-
{
|
|
876
|
-
Int sz = readAndCheckSeqSize(static_cast<int>(sizeof(Long)));
|
|
877
|
-
if(sz > 0)
|
|
878
|
-
{
|
|
879
|
-
Container::iterator begin = i;
|
|
880
|
-
i += sz * static_cast<int>(sizeof(Long));
|
|
881
|
-
v.resize(sz);
|
|
882
|
-
#ifdef ICE_BIG_ENDIAN
|
|
883
|
-
const Byte* src = &(*begin);
|
|
884
|
-
Byte* dest = reinterpret_cast<Byte*>(&v[0]) + sizeof(Long) - 1;
|
|
885
|
-
for(int j = 0 ; j < sz ; ++j)
|
|
886
|
-
{
|
|
887
|
-
*dest-- = *src++;
|
|
888
|
-
*dest-- = *src++;
|
|
889
|
-
*dest-- = *src++;
|
|
890
|
-
*dest-- = *src++;
|
|
891
|
-
*dest-- = *src++;
|
|
892
|
-
*dest-- = *src++;
|
|
893
|
-
*dest-- = *src++;
|
|
894
|
-
*dest-- = *src++;
|
|
895
|
-
dest += 2 * sizeof(Long);
|
|
896
|
-
}
|
|
897
|
-
#else
|
|
898
|
-
copy(begin, i, reinterpret_cast<Byte*>(&v[0]));
|
|
899
|
-
#endif
|
|
900
|
-
}
|
|
901
|
-
else
|
|
902
|
-
{
|
|
903
|
-
v.clear();
|
|
904
|
-
}
|
|
905
|
-
}
|
|
906
|
-
|
|
907
|
-
void
|
|
908
|
-
IceInternal::BasicStream::read(pair<const Long*, const Long*>& v, IceUtil::ScopedArray<Long>& result)
|
|
909
|
-
{
|
|
910
|
-
Int sz = readAndCheckSeqSize(static_cast<int>(sizeof(Long)));
|
|
911
|
-
if(sz > 0)
|
|
912
|
-
{
|
|
913
|
-
#if defined(__i386) || defined(_M_IX86) || defined(__x86_64) || defined(_M_X64)
|
|
914
|
-
v.first = reinterpret_cast<Long*>(i);
|
|
915
|
-
i += sz * static_cast<int>(sizeof(Long));
|
|
916
|
-
v.second = reinterpret_cast<Long*>(i);
|
|
917
|
-
#else
|
|
918
|
-
result.reset(new Long[sz]);
|
|
919
|
-
v.first = result.get();
|
|
920
|
-
v.second = result.get() + sz;
|
|
921
|
-
|
|
922
|
-
Container::iterator begin = i;
|
|
923
|
-
i += sz * static_cast<int>(sizeof(Long));
|
|
924
|
-
# ifdef ICE_BIG_ENDIAN
|
|
925
|
-
const Byte* src = &(*begin);
|
|
926
|
-
Byte* dest = reinterpret_cast<Byte*>(&result[0]) + sizeof(Long) - 1;
|
|
927
|
-
for(int j = 0 ; j < sz ; ++j)
|
|
928
|
-
{
|
|
929
|
-
*dest-- = *src++;
|
|
930
|
-
*dest-- = *src++;
|
|
931
|
-
*dest-- = *src++;
|
|
932
|
-
*dest-- = *src++;
|
|
933
|
-
*dest-- = *src++;
|
|
934
|
-
*dest-- = *src++;
|
|
935
|
-
*dest-- = *src++;
|
|
936
|
-
*dest-- = *src++;
|
|
937
|
-
dest += 2 * sizeof(Long);
|
|
938
|
-
}
|
|
939
|
-
# else
|
|
940
|
-
copy(begin, i, reinterpret_cast<Byte*>(&result[0]));
|
|
941
|
-
# endif
|
|
942
|
-
#endif
|
|
943
|
-
}
|
|
944
|
-
else
|
|
945
|
-
{
|
|
946
|
-
result.reset();
|
|
947
|
-
v.first = v.second = 0;
|
|
948
|
-
}
|
|
949
|
-
}
|
|
950
|
-
|
|
951
|
-
void
|
|
952
|
-
IceInternal::BasicStream::write(Float v)
|
|
953
|
-
{
|
|
954
|
-
Container::size_type pos = b.size();
|
|
955
|
-
resize(pos + sizeof(Float));
|
|
956
|
-
Byte* dest = &b[pos];
|
|
957
|
-
#ifdef ICE_BIG_ENDIAN
|
|
958
|
-
const Byte* src = reinterpret_cast<const Byte*>(&v) + sizeof(Float) - 1;
|
|
959
|
-
*dest++ = *src--;
|
|
960
|
-
*dest++ = *src--;
|
|
961
|
-
*dest++ = *src--;
|
|
962
|
-
*dest = *src;
|
|
963
|
-
#else
|
|
964
|
-
const Byte* src = reinterpret_cast<const Byte*>(&v);
|
|
965
|
-
*dest++ = *src++;
|
|
966
|
-
*dest++ = *src++;
|
|
967
|
-
*dest++ = *src++;
|
|
968
|
-
*dest = *src;
|
|
969
|
-
#endif
|
|
970
|
-
}
|
|
971
|
-
|
|
972
|
-
void
|
|
973
|
-
IceInternal::BasicStream::write(const Float* begin, const Float* end)
|
|
974
|
-
{
|
|
975
|
-
Int sz = static_cast<Int>(end - begin);
|
|
976
|
-
writeSize(sz);
|
|
977
|
-
if(sz > 0)
|
|
978
|
-
{
|
|
979
|
-
Container::size_type pos = b.size();
|
|
980
|
-
resize(pos + sz * sizeof(Float));
|
|
981
|
-
#ifdef ICE_BIG_ENDIAN
|
|
982
|
-
const Byte* src = reinterpret_cast<const Byte*>(begin) + sizeof(Float) - 1;
|
|
983
|
-
Byte* dest = &(*(b.begin() + pos));
|
|
984
|
-
for(int j = 0 ; j < sz ; ++j)
|
|
985
|
-
{
|
|
986
|
-
*dest++ = *src--;
|
|
987
|
-
*dest++ = *src--;
|
|
988
|
-
*dest++ = *src--;
|
|
989
|
-
*dest++ = *src--;
|
|
990
|
-
src += 2 * sizeof(Float);
|
|
991
|
-
}
|
|
992
|
-
#else
|
|
993
|
-
memcpy(&b[pos], reinterpret_cast<const Byte*>(begin), sz * sizeof(Float));
|
|
994
|
-
#endif
|
|
995
|
-
}
|
|
996
|
-
}
|
|
997
|
-
|
|
998
|
-
void
|
|
999
|
-
IceInternal::BasicStream::read(Float& v)
|
|
1000
|
-
{
|
|
1001
|
-
if(b.end() - i < static_cast<int>(sizeof(Float)))
|
|
1002
|
-
{
|
|
1003
|
-
throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
|
|
1004
|
-
}
|
|
1005
|
-
const Byte* src = &(*i);
|
|
1006
|
-
i += sizeof(Float);
|
|
1007
|
-
#ifdef ICE_BIG_ENDIAN
|
|
1008
|
-
Byte* dest = reinterpret_cast<Byte*>(&v) + sizeof(Float) - 1;
|
|
1009
|
-
*dest-- = *src++;
|
|
1010
|
-
*dest-- = *src++;
|
|
1011
|
-
*dest-- = *src++;
|
|
1012
|
-
*dest = *src;
|
|
1013
|
-
#else
|
|
1014
|
-
Byte* dest = reinterpret_cast<Byte*>(&v);
|
|
1015
|
-
*dest++ = *src++;
|
|
1016
|
-
*dest++ = *src++;
|
|
1017
|
-
*dest++ = *src++;
|
|
1018
|
-
*dest = *src;
|
|
1019
|
-
#endif
|
|
1020
|
-
}
|
|
1021
|
-
|
|
1022
|
-
void
|
|
1023
|
-
IceInternal::BasicStream::read(vector<Float>& v)
|
|
1024
|
-
{
|
|
1025
|
-
Int sz = readAndCheckSeqSize(static_cast<int>(sizeof(Float)));
|
|
1026
|
-
if(sz > 0)
|
|
1027
|
-
{
|
|
1028
|
-
Container::iterator begin = i;
|
|
1029
|
-
i += sz * static_cast<int>(sizeof(Float));
|
|
1030
|
-
v.resize(sz);
|
|
1031
|
-
#ifdef ICE_BIG_ENDIAN
|
|
1032
|
-
const Byte* src = &(*begin);
|
|
1033
|
-
Byte* dest = reinterpret_cast<Byte*>(&v[0]) + sizeof(Float) - 1;
|
|
1034
|
-
for(int j = 0 ; j < sz ; ++j)
|
|
1035
|
-
{
|
|
1036
|
-
*dest-- = *src++;
|
|
1037
|
-
*dest-- = *src++;
|
|
1038
|
-
*dest-- = *src++;
|
|
1039
|
-
*dest-- = *src++;
|
|
1040
|
-
dest += 2 * sizeof(Float);
|
|
1041
|
-
}
|
|
1042
|
-
#else
|
|
1043
|
-
copy(begin, i, reinterpret_cast<Byte*>(&v[0]));
|
|
1044
|
-
#endif
|
|
1045
|
-
}
|
|
1046
|
-
else
|
|
1047
|
-
{
|
|
1048
|
-
v.clear();
|
|
1049
|
-
}
|
|
1050
|
-
}
|
|
1051
|
-
|
|
1052
|
-
void
|
|
1053
|
-
IceInternal::BasicStream::read(pair<const Float*, const Float*>& v, IceUtil::ScopedArray<Float>& result)
|
|
1054
|
-
{
|
|
1055
|
-
Int sz = readAndCheckSeqSize(static_cast<int>(sizeof(Float)));
|
|
1056
|
-
if(sz > 0)
|
|
1057
|
-
{
|
|
1058
|
-
#if defined(__i386) || defined(_M_IX86) || defined(__x86_64) || defined(_M_X64)
|
|
1059
|
-
v.first = reinterpret_cast<Float*>(i);
|
|
1060
|
-
i += sz * static_cast<int>(sizeof(Float));
|
|
1061
|
-
v.second = reinterpret_cast<Float*>(i);
|
|
1062
|
-
#else
|
|
1063
|
-
result.reset(new Float[sz]);
|
|
1064
|
-
v.first = result.get();
|
|
1065
|
-
v.second = result.get() + sz;
|
|
1066
|
-
|
|
1067
|
-
Container::iterator begin = i;
|
|
1068
|
-
i += sz * static_cast<int>(sizeof(Float));
|
|
1069
|
-
# ifdef ICE_BIG_ENDIAN
|
|
1070
|
-
const Byte* src = &(*begin);
|
|
1071
|
-
Byte* dest = reinterpret_cast<Byte*>(&result[0]) + sizeof(Float) - 1;
|
|
1072
|
-
for(int j = 0 ; j < sz ; ++j)
|
|
1073
|
-
{
|
|
1074
|
-
*dest-- = *src++;
|
|
1075
|
-
*dest-- = *src++;
|
|
1076
|
-
*dest-- = *src++;
|
|
1077
|
-
*dest-- = *src++;
|
|
1078
|
-
dest += 2 * sizeof(Float);
|
|
1079
|
-
}
|
|
1080
|
-
# else
|
|
1081
|
-
copy(begin, i, reinterpret_cast<Byte*>(&result[0]));
|
|
1082
|
-
# endif
|
|
1083
|
-
#endif
|
|
1084
|
-
}
|
|
1085
|
-
else
|
|
1086
|
-
{
|
|
1087
|
-
result.reset();
|
|
1088
|
-
v.first = v.second = 0;
|
|
1089
|
-
}
|
|
1090
|
-
}
|
|
1091
|
-
|
|
1092
|
-
void
|
|
1093
|
-
IceInternal::BasicStream::write(Double v)
|
|
1094
|
-
{
|
|
1095
|
-
Container::size_type pos = b.size();
|
|
1096
|
-
resize(pos + sizeof(Double));
|
|
1097
|
-
Byte* dest = &b[pos];
|
|
1098
|
-
#ifdef ICE_BIG_ENDIAN
|
|
1099
|
-
const Byte* src = reinterpret_cast<const Byte*>(&v) + sizeof(Double) - 1;
|
|
1100
|
-
*dest++ = *src--;
|
|
1101
|
-
*dest++ = *src--;
|
|
1102
|
-
*dest++ = *src--;
|
|
1103
|
-
*dest++ = *src--;
|
|
1104
|
-
*dest++ = *src--;
|
|
1105
|
-
*dest++ = *src--;
|
|
1106
|
-
*dest++ = *src--;
|
|
1107
|
-
*dest = *src;
|
|
1108
|
-
#else
|
|
1109
|
-
const Byte* src = reinterpret_cast<const Byte*>(&v);
|
|
1110
|
-
# if defined(ICE_LITTLEBYTE_BIGWORD)
|
|
1111
|
-
dest[4] = *src++;
|
|
1112
|
-
dest[5] = *src++;
|
|
1113
|
-
dest[6] = *src++;
|
|
1114
|
-
dest[7] = *src++;
|
|
1115
|
-
dest[0] = *src++;
|
|
1116
|
-
dest[1] = *src++;
|
|
1117
|
-
dest[2] = *src++;
|
|
1118
|
-
dest[3] = *src;
|
|
1119
|
-
# else
|
|
1120
|
-
*dest++ = *src++;
|
|
1121
|
-
*dest++ = *src++;
|
|
1122
|
-
*dest++ = *src++;
|
|
1123
|
-
*dest++ = *src++;
|
|
1124
|
-
*dest++ = *src++;
|
|
1125
|
-
*dest++ = *src++;
|
|
1126
|
-
*dest++ = *src++;
|
|
1127
|
-
*dest = *src;
|
|
1128
|
-
# endif
|
|
1129
|
-
#endif
|
|
1130
|
-
}
|
|
1131
|
-
|
|
1132
|
-
void
|
|
1133
|
-
IceInternal::BasicStream::write(const Double* begin, const Double* end)
|
|
1134
|
-
{
|
|
1135
|
-
Int sz = static_cast<Int>(end - begin);
|
|
1136
|
-
writeSize(sz);
|
|
1137
|
-
if(sz > 0)
|
|
1138
|
-
{
|
|
1139
|
-
Container::size_type pos = b.size();
|
|
1140
|
-
resize(pos + sz * sizeof(Double));
|
|
1141
|
-
#ifdef ICE_BIG_ENDIAN
|
|
1142
|
-
const Byte* src = reinterpret_cast<const Byte*>(begin) + sizeof(Double) - 1;
|
|
1143
|
-
Byte* dest = &(*(b.begin() + pos));
|
|
1144
|
-
for(int j = 0 ; j < sz ; ++j)
|
|
1145
|
-
{
|
|
1146
|
-
*dest++ = *src--;
|
|
1147
|
-
*dest++ = *src--;
|
|
1148
|
-
*dest++ = *src--;
|
|
1149
|
-
*dest++ = *src--;
|
|
1150
|
-
*dest++ = *src--;
|
|
1151
|
-
*dest++ = *src--;
|
|
1152
|
-
*dest++ = *src--;
|
|
1153
|
-
*dest++ = *src--;
|
|
1154
|
-
src += 2 * sizeof(Double);
|
|
1155
|
-
}
|
|
1156
|
-
#elif defined(ICE_LITTLEBYTE_BIGWORD)
|
|
1157
|
-
const Byte* src = reinterpret_cast<const Byte*>(begin);
|
|
1158
|
-
Byte* dest = &(*(b.begin() + pos));
|
|
1159
|
-
for(int j = 0 ; j < sz ; ++j)
|
|
1160
|
-
{
|
|
1161
|
-
dest[4] = *src++;
|
|
1162
|
-
dest[5] = *src++;
|
|
1163
|
-
dest[6] = *src++;
|
|
1164
|
-
dest[7] = *src++;
|
|
1165
|
-
dest[0] = *src++;
|
|
1166
|
-
dest[1] = *src++;
|
|
1167
|
-
dest[2] = *src++;
|
|
1168
|
-
dest[3] = *src++;
|
|
1169
|
-
dest += sizeof(Double);
|
|
1170
|
-
}
|
|
1171
|
-
#else
|
|
1172
|
-
memcpy(&b[pos], reinterpret_cast<const Byte*>(begin), sz * sizeof(Double));
|
|
1173
|
-
#endif
|
|
1174
|
-
}
|
|
1175
|
-
}
|
|
1176
|
-
|
|
1177
|
-
void
|
|
1178
|
-
IceInternal::BasicStream::read(Double& v)
|
|
1179
|
-
{
|
|
1180
|
-
if(b.end() - i < static_cast<int>(sizeof(Double)))
|
|
1181
|
-
{
|
|
1182
|
-
throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
|
|
1183
|
-
}
|
|
1184
|
-
const Byte* src = &(*i);
|
|
1185
|
-
i += sizeof(Double);
|
|
1186
|
-
#ifdef ICE_BIG_ENDIAN
|
|
1187
|
-
Byte* dest = reinterpret_cast<Byte*>(&v) + sizeof(Double) - 1;
|
|
1188
|
-
*dest-- = *src++;
|
|
1189
|
-
*dest-- = *src++;
|
|
1190
|
-
*dest-- = *src++;
|
|
1191
|
-
*dest-- = *src++;
|
|
1192
|
-
*dest-- = *src++;
|
|
1193
|
-
*dest-- = *src++;
|
|
1194
|
-
*dest-- = *src++;
|
|
1195
|
-
*dest = *src;
|
|
1196
|
-
#else
|
|
1197
|
-
Byte* dest = reinterpret_cast<Byte*>(&v);
|
|
1198
|
-
# if defined(ICE_LITTLEBYTE_BIGWORD)
|
|
1199
|
-
dest[4] = *src++;
|
|
1200
|
-
dest[5] = *src++;
|
|
1201
|
-
dest[6] = *src++;
|
|
1202
|
-
dest[7] = *src++;
|
|
1203
|
-
dest[0] = *src++;
|
|
1204
|
-
dest[1] = *src++;
|
|
1205
|
-
dest[2] = *src++;
|
|
1206
|
-
dest[3] = *src;
|
|
1207
|
-
# else
|
|
1208
|
-
*dest++ = *src++;
|
|
1209
|
-
*dest++ = *src++;
|
|
1210
|
-
*dest++ = *src++;
|
|
1211
|
-
*dest++ = *src++;
|
|
1212
|
-
*dest++ = *src++;
|
|
1213
|
-
*dest++ = *src++;
|
|
1214
|
-
*dest++ = *src++;
|
|
1215
|
-
*dest = *src;
|
|
1216
|
-
# endif
|
|
1217
|
-
#endif
|
|
1218
|
-
}
|
|
1219
|
-
|
|
1220
|
-
void
|
|
1221
|
-
IceInternal::BasicStream::read(vector<Double>& v)
|
|
1222
|
-
{
|
|
1223
|
-
Int sz = readAndCheckSeqSize(static_cast<int>(sizeof(Double)));
|
|
1224
|
-
if(sz > 0)
|
|
1225
|
-
{
|
|
1226
|
-
Container::iterator begin = i;
|
|
1227
|
-
i += sz * static_cast<int>(sizeof(Double));
|
|
1228
|
-
v.resize(sz);
|
|
1229
|
-
#ifdef ICE_BIG_ENDIAN
|
|
1230
|
-
const Byte* src = &(*begin);
|
|
1231
|
-
Byte* dest = reinterpret_cast<Byte*>(&v[0]) + sizeof(Double) - 1;
|
|
1232
|
-
for(int j = 0 ; j < sz ; ++j)
|
|
1233
|
-
{
|
|
1234
|
-
*dest-- = *src++;
|
|
1235
|
-
*dest-- = *src++;
|
|
1236
|
-
*dest-- = *src++;
|
|
1237
|
-
*dest-- = *src++;
|
|
1238
|
-
*dest-- = *src++;
|
|
1239
|
-
*dest-- = *src++;
|
|
1240
|
-
*dest-- = *src++;
|
|
1241
|
-
*dest-- = *src++;
|
|
1242
|
-
dest += 2 * sizeof(Double);
|
|
1243
|
-
}
|
|
1244
|
-
#elif defined(ICE_LITTLEBYTE_BIGWORD)
|
|
1245
|
-
const Byte* src = &(*begin);
|
|
1246
|
-
Byte* dest = reinterpret_cast<Byte*>(&v[0]);
|
|
1247
|
-
for(int j = 0 ; j < sz ; ++j)
|
|
1248
|
-
{
|
|
1249
|
-
dest[4] = *src++;
|
|
1250
|
-
dest[5] = *src++;
|
|
1251
|
-
dest[6] = *src++;
|
|
1252
|
-
dest[7] = *src++;
|
|
1253
|
-
dest[0] = *src++;
|
|
1254
|
-
dest[1] = *src++;
|
|
1255
|
-
dest[2] = *src++;
|
|
1256
|
-
dest[3] = *src++;
|
|
1257
|
-
dest += sizeof(Double);
|
|
1258
|
-
}
|
|
1259
|
-
#else
|
|
1260
|
-
copy(begin, i, reinterpret_cast<Byte*>(&v[0]));
|
|
1261
|
-
#endif
|
|
1262
|
-
}
|
|
1263
|
-
else
|
|
1264
|
-
{
|
|
1265
|
-
v.clear();
|
|
1266
|
-
}
|
|
1267
|
-
}
|
|
1268
|
-
|
|
1269
|
-
void
|
|
1270
|
-
IceInternal::BasicStream::read(pair<const Double*, const Double*>& v, IceUtil::ScopedArray<Double>& result)
|
|
1271
|
-
{
|
|
1272
|
-
Int sz = readAndCheckSeqSize(static_cast<int>(sizeof(Double)));
|
|
1273
|
-
if(sz > 0)
|
|
1274
|
-
{
|
|
1275
|
-
#if defined(__i386) || defined(_M_IX86) || defined(__x86_64) || defined(_M_X64)
|
|
1276
|
-
v.first = reinterpret_cast<Double*>(i);
|
|
1277
|
-
i += sz * static_cast<int>(sizeof(Double));
|
|
1278
|
-
v.second = reinterpret_cast<Double*>(i);
|
|
1279
|
-
#else
|
|
1280
|
-
result.reset(new Double[sz]);
|
|
1281
|
-
v.first = result.get();
|
|
1282
|
-
v.second = result.get() + sz;
|
|
1283
|
-
|
|
1284
|
-
Container::iterator begin = i;
|
|
1285
|
-
i += sz * static_cast<int>(sizeof(Double));
|
|
1286
|
-
# ifdef ICE_BIG_ENDIAN
|
|
1287
|
-
const Byte* src = &(*begin);
|
|
1288
|
-
Byte* dest = reinterpret_cast<Byte*>(&result[0]) + sizeof(Double) - 1;
|
|
1289
|
-
for(int j = 0 ; j < sz ; ++j)
|
|
1290
|
-
{
|
|
1291
|
-
*dest-- = *src++;
|
|
1292
|
-
*dest-- = *src++;
|
|
1293
|
-
*dest-- = *src++;
|
|
1294
|
-
*dest-- = *src++;
|
|
1295
|
-
*dest-- = *src++;
|
|
1296
|
-
*dest-- = *src++;
|
|
1297
|
-
*dest-- = *src++;
|
|
1298
|
-
*dest-- = *src++;
|
|
1299
|
-
dest += 2 * sizeof(Double);
|
|
1300
|
-
}
|
|
1301
|
-
# elif defined(ICE_LITTLEBYTE_BIGWORD)
|
|
1302
|
-
const Byte* src = &(*begin);
|
|
1303
|
-
Byte* dest = reinterpret_cast<Byte*>(&result[0]);
|
|
1304
|
-
for(int j = 0 ; j < sz ; ++j)
|
|
1305
|
-
{
|
|
1306
|
-
dest[4] = *src++;
|
|
1307
|
-
dest[5] = *src++;
|
|
1308
|
-
dest[6] = *src++;
|
|
1309
|
-
dest[7] = *src++;
|
|
1310
|
-
dest[0] = *src++;
|
|
1311
|
-
dest[1] = *src++;
|
|
1312
|
-
dest[2] = *src++;
|
|
1313
|
-
dest[3] = *src++;
|
|
1314
|
-
dest += sizeof(Double);
|
|
1315
|
-
}
|
|
1316
|
-
|
|
1317
|
-
# else
|
|
1318
|
-
copy(begin, i, reinterpret_cast<Byte*>(&result[0]));
|
|
1319
|
-
# endif
|
|
1320
|
-
#endif
|
|
1321
|
-
}
|
|
1322
|
-
else
|
|
1323
|
-
{
|
|
1324
|
-
result.reset();
|
|
1325
|
-
v.first = v.second = 0;
|
|
1326
|
-
}
|
|
1327
|
-
}
|
|
1328
|
-
|
|
1329
|
-
//
|
|
1330
|
-
// NOTE: This member function is intentionally omitted in order to
|
|
1331
|
-
// cause a link error if it is used. This is for efficiency reasons:
|
|
1332
|
-
// writing a const char * requires a traversal of the string to get
|
|
1333
|
-
// the string length first, which takes O(n) time, whereas getting the
|
|
1334
|
-
// string length from a std::string takes constant time.
|
|
1335
|
-
//
|
|
1336
|
-
/*
|
|
1337
|
-
void
|
|
1338
|
-
IceInternal::BasicStream::write(const char*)
|
|
1339
|
-
{
|
|
1340
|
-
}
|
|
1341
|
-
*/
|
|
1342
|
-
|
|
1343
|
-
void
|
|
1344
|
-
IceInternal::BasicStream::writeConverted(const char* vdata, size_t vsize)
|
|
1345
|
-
{
|
|
1346
|
-
//
|
|
1347
|
-
// What is the size of the resulting UTF-8 encoded string?
|
|
1348
|
-
// Impossible to tell, so we guess. If we don't guess correctly,
|
|
1349
|
-
// we'll have to fix the mistake afterwards
|
|
1350
|
-
//
|
|
1351
|
-
try
|
|
1352
|
-
{
|
|
1353
|
-
Int guessedSize = static_cast<Int>(vsize);
|
|
1354
|
-
writeSize(guessedSize); // writeSize() only writes the size; it does not reserve any buffer space.
|
|
1355
|
-
|
|
1356
|
-
size_t firstIndex = b.size();
|
|
1357
|
-
StreamUTF8BufferI buffer(*this);
|
|
1358
|
-
|
|
1359
|
-
Byte* lastByte = _stringConverter->toUTF8(vdata, vdata + vsize, buffer);
|
|
1360
|
-
if(lastByte != b.end())
|
|
1361
|
-
{
|
|
1362
|
-
resize(lastByte - b.begin());
|
|
1363
|
-
}
|
|
1364
|
-
size_t lastIndex = b.size();
|
|
1365
|
-
|
|
1366
|
-
Int actualSize = static_cast<Int>(lastIndex - firstIndex);
|
|
1367
|
-
|
|
1368
|
-
//
|
|
1369
|
-
// Check against the guess
|
|
1370
|
-
//
|
|
1371
|
-
if(guessedSize != actualSize)
|
|
1372
|
-
{
|
|
1373
|
-
if(guessedSize <= 254 && actualSize > 254)
|
|
1374
|
-
{
|
|
1375
|
-
//
|
|
1376
|
-
// Move the UTF-8 sequence 4 bytes further
|
|
1377
|
-
// Use memmove instead of memcpy since the source and destination typically overlap.
|
|
1378
|
-
//
|
|
1379
|
-
resize(b.size() + 4);
|
|
1380
|
-
memmove(b.begin() + firstIndex + 4, b.begin() + firstIndex, actualSize);
|
|
1381
|
-
}
|
|
1382
|
-
else if(guessedSize > 254 && actualSize <= 254)
|
|
1383
|
-
{
|
|
1384
|
-
//
|
|
1385
|
-
// Move the UTF-8 sequence 4 bytes back
|
|
1386
|
-
//
|
|
1387
|
-
memmove(b.begin() + firstIndex - 4, b.begin() + firstIndex, actualSize);
|
|
1388
|
-
resize(b.size() - 4);
|
|
1389
|
-
}
|
|
1390
|
-
|
|
1391
|
-
if(guessedSize <= 254)
|
|
1392
|
-
{
|
|
1393
|
-
rewriteSize(actualSize, b.begin() + firstIndex - 1);
|
|
1394
|
-
}
|
|
1395
|
-
else
|
|
1396
|
-
{
|
|
1397
|
-
rewriteSize(actualSize, b.begin() + firstIndex - 1 - 4);
|
|
1398
|
-
}
|
|
1399
|
-
}
|
|
1400
|
-
}
|
|
1401
|
-
catch(const IceUtil::IllegalConversionException& ex)
|
|
1402
|
-
{
|
|
1403
|
-
throw StringConversionException(__FILE__, __LINE__, ex.reason());
|
|
1404
|
-
}
|
|
1405
|
-
}
|
|
1406
|
-
|
|
1407
|
-
void
|
|
1408
|
-
IceInternal::BasicStream::write(const string* begin, const string* end, bool convert)
|
|
1409
|
-
{
|
|
1410
|
-
Int sz = static_cast<Int>(end - begin);
|
|
1411
|
-
writeSize(sz);
|
|
1412
|
-
if(sz > 0)
|
|
1413
|
-
{
|
|
1414
|
-
for(int i = 0; i < sz; ++i)
|
|
1415
|
-
{
|
|
1416
|
-
write(begin[i], convert);
|
|
1417
|
-
}
|
|
1418
|
-
}
|
|
1419
|
-
}
|
|
1420
|
-
|
|
1421
|
-
void
|
|
1422
|
-
IceInternal::BasicStream::readConverted(string& v, int sz)
|
|
1423
|
-
{
|
|
1424
|
-
try
|
|
1425
|
-
{
|
|
1426
|
-
_stringConverter->fromUTF8(i, i + sz, v);
|
|
1427
|
-
}
|
|
1428
|
-
catch(const IceUtil::IllegalConversionException& ex)
|
|
1429
|
-
{
|
|
1430
|
-
throw StringConversionException(__FILE__, __LINE__, ex.reason());
|
|
1431
|
-
}
|
|
1432
|
-
}
|
|
1433
|
-
|
|
1434
|
-
void
|
|
1435
|
-
IceInternal::BasicStream::read(vector<string>& v, bool convert)
|
|
1436
|
-
{
|
|
1437
|
-
Int sz = readAndCheckSeqSize(1);
|
|
1438
|
-
if(sz > 0)
|
|
1439
|
-
{
|
|
1440
|
-
v.resize(sz);
|
|
1441
|
-
for(int j = 0; j < sz; ++j)
|
|
1442
|
-
{
|
|
1443
|
-
read(v[j], convert);
|
|
1444
|
-
}
|
|
1445
|
-
}
|
|
1446
|
-
else
|
|
1447
|
-
{
|
|
1448
|
-
v.clear();
|
|
1449
|
-
}
|
|
1450
|
-
}
|
|
1451
|
-
|
|
1452
|
-
void
|
|
1453
|
-
IceInternal::BasicStream::write(const wstring& v)
|
|
1454
|
-
{
|
|
1455
|
-
if(v.empty())
|
|
1456
|
-
{
|
|
1457
|
-
writeSize(0);
|
|
1458
|
-
return;
|
|
1459
|
-
}
|
|
1460
|
-
|
|
1461
|
-
//
|
|
1462
|
-
// What is the size of the resulting UTF-8 encoded string?
|
|
1463
|
-
// Impossible to tell, so we guess. If we don't guess correctly,
|
|
1464
|
-
// we'll have to fix the mistake afterwards
|
|
1465
|
-
//
|
|
1466
|
-
try
|
|
1467
|
-
{
|
|
1468
|
-
Int guessedSize = static_cast<Int>(v.size());
|
|
1469
|
-
writeSize(guessedSize); // writeSize() only writes the size; it does not reserve any buffer space.
|
|
1470
|
-
|
|
1471
|
-
size_t firstIndex = b.size();
|
|
1472
|
-
StreamUTF8BufferI buffer(*this);
|
|
1473
|
-
|
|
1474
|
-
Byte* lastByte = _wstringConverter->toUTF8(v.data(), v.data() + v.size(), buffer);
|
|
1475
|
-
if(lastByte != b.end())
|
|
1476
|
-
{
|
|
1477
|
-
resize(lastByte - b.begin());
|
|
1478
|
-
}
|
|
1479
|
-
size_t lastIndex = b.size();
|
|
1480
|
-
|
|
1481
|
-
Int actualSize = static_cast<Int>(lastIndex - firstIndex);
|
|
1482
|
-
|
|
1483
|
-
//
|
|
1484
|
-
// Check against the guess
|
|
1485
|
-
//
|
|
1486
|
-
if(guessedSize != actualSize)
|
|
1487
|
-
{
|
|
1488
|
-
if(guessedSize <= 254 && actualSize > 254)
|
|
1489
|
-
{
|
|
1490
|
-
//
|
|
1491
|
-
// Move the UTF-8 sequence 4 bytes further
|
|
1492
|
-
// Use memmove instead of memcpy since the source and destination typically overlap.
|
|
1493
|
-
//
|
|
1494
|
-
resize(b.size() + 4);
|
|
1495
|
-
memmove(b.begin() + firstIndex + 4, b.begin() + firstIndex, actualSize);
|
|
1496
|
-
}
|
|
1497
|
-
else if(guessedSize > 254 && actualSize <= 254)
|
|
1498
|
-
{
|
|
1499
|
-
//
|
|
1500
|
-
// Move the UTF-8 sequence 4 bytes back
|
|
1501
|
-
//
|
|
1502
|
-
memmove(b.begin() + firstIndex - 4, b.begin() + firstIndex, actualSize);
|
|
1503
|
-
resize(b.size() - 4);
|
|
1504
|
-
}
|
|
1505
|
-
|
|
1506
|
-
if(guessedSize <= 254)
|
|
1507
|
-
{
|
|
1508
|
-
rewriteSize(actualSize, b.begin() + firstIndex - 1);
|
|
1509
|
-
}
|
|
1510
|
-
else
|
|
1511
|
-
{
|
|
1512
|
-
rewriteSize(actualSize, b.begin() + firstIndex - 1 - 4);
|
|
1513
|
-
}
|
|
1514
|
-
}
|
|
1515
|
-
}
|
|
1516
|
-
catch(const IceUtil::IllegalConversionException& ex)
|
|
1517
|
-
{
|
|
1518
|
-
throw StringConversionException(__FILE__, __LINE__, ex.reason());
|
|
1519
|
-
}
|
|
1520
|
-
}
|
|
1521
|
-
|
|
1522
|
-
void
|
|
1523
|
-
IceInternal::BasicStream::write(const wstring* begin, const wstring* end)
|
|
1524
|
-
{
|
|
1525
|
-
Int sz = static_cast<Int>(end - begin);
|
|
1526
|
-
writeSize(sz);
|
|
1527
|
-
if(sz > 0)
|
|
1528
|
-
{
|
|
1529
|
-
for(int i = 0; i < sz; ++i)
|
|
1530
|
-
{
|
|
1531
|
-
write(begin[i]);
|
|
1532
|
-
}
|
|
1533
|
-
}
|
|
1534
|
-
}
|
|
1535
|
-
|
|
1536
|
-
void
|
|
1537
|
-
IceInternal::BasicStream::read(wstring& v)
|
|
1538
|
-
{
|
|
1539
|
-
Int sz = readSize();
|
|
1540
|
-
if(sz > 0)
|
|
1541
|
-
{
|
|
1542
|
-
if(b.end() - i < sz)
|
|
1543
|
-
{
|
|
1544
|
-
throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
|
|
1545
|
-
}
|
|
1546
|
-
|
|
1547
|
-
try
|
|
1548
|
-
{
|
|
1549
|
-
_wstringConverter->fromUTF8(i, i + sz, v);
|
|
1550
|
-
i += sz;
|
|
1551
|
-
}
|
|
1552
|
-
catch(const IceUtil::IllegalConversionException& ex)
|
|
1553
|
-
{
|
|
1554
|
-
throw StringConversionException(__FILE__, __LINE__, ex.reason());
|
|
1555
|
-
}
|
|
1556
|
-
}
|
|
1557
|
-
else
|
|
1558
|
-
{
|
|
1559
|
-
v.clear();
|
|
1560
|
-
}
|
|
1561
|
-
}
|
|
1562
|
-
|
|
1563
|
-
void
|
|
1564
|
-
IceInternal::BasicStream::read(vector<wstring>& v)
|
|
1565
|
-
{
|
|
1566
|
-
Int sz = readAndCheckSeqSize(1);
|
|
1567
|
-
if(sz > 0)
|
|
1568
|
-
{
|
|
1569
|
-
v.resize(sz);
|
|
1570
|
-
for(int j = 0; j < sz; ++j)
|
|
1571
|
-
{
|
|
1572
|
-
read(v[j]);
|
|
1573
|
-
}
|
|
1574
|
-
}
|
|
1575
|
-
else
|
|
1576
|
-
{
|
|
1577
|
-
v.clear();
|
|
1578
|
-
}
|
|
1579
|
-
}
|
|
1580
|
-
|
|
1581
|
-
void
|
|
1582
|
-
IceInternal::BasicStream::write(const ObjectPrx& v)
|
|
1583
|
-
{
|
|
1584
|
-
_instance->proxyFactory()->proxyToStream(v, this);
|
|
1585
|
-
}
|
|
1586
|
-
|
|
1587
|
-
void
|
|
1588
|
-
IceInternal::BasicStream::read(ObjectPrx& v)
|
|
1589
|
-
{
|
|
1590
|
-
v = _instance->proxyFactory()->streamToProxy(this);
|
|
1591
|
-
}
|
|
1592
|
-
|
|
1593
|
-
Int
|
|
1594
|
-
IceInternal::BasicStream::readEnum(Int maxValue)
|
|
1595
|
-
{
|
|
1596
|
-
if(getReadEncoding() == Encoding_1_0)
|
|
1597
|
-
{
|
|
1598
|
-
if(maxValue < 127)
|
|
1599
|
-
{
|
|
1600
|
-
Byte value;
|
|
1601
|
-
read(value);
|
|
1602
|
-
return value;
|
|
1603
|
-
}
|
|
1604
|
-
else if(maxValue < 32767)
|
|
1605
|
-
{
|
|
1606
|
-
Short value;
|
|
1607
|
-
read(value);
|
|
1608
|
-
return value;
|
|
1609
|
-
}
|
|
1610
|
-
else
|
|
1611
|
-
{
|
|
1612
|
-
Int value;
|
|
1613
|
-
read(value);
|
|
1614
|
-
return value;
|
|
1615
|
-
}
|
|
1616
|
-
}
|
|
1617
|
-
else
|
|
1618
|
-
{
|
|
1619
|
-
return readSize();
|
|
1620
|
-
}
|
|
1621
|
-
}
|
|
1622
|
-
|
|
1623
|
-
void
|
|
1624
|
-
IceInternal::BasicStream::writeEnum(Int v, Int maxValue)
|
|
1625
|
-
{
|
|
1626
|
-
if(getWriteEncoding() == Encoding_1_0)
|
|
1627
|
-
{
|
|
1628
|
-
if(maxValue < 127)
|
|
1629
|
-
{
|
|
1630
|
-
write(static_cast<Byte>(v));
|
|
1631
|
-
}
|
|
1632
|
-
else if(maxValue < 32767)
|
|
1633
|
-
{
|
|
1634
|
-
write(static_cast<Short>(v));
|
|
1635
|
-
}
|
|
1636
|
-
else
|
|
1637
|
-
{
|
|
1638
|
-
write(v);
|
|
1639
|
-
}
|
|
1640
|
-
}
|
|
1641
|
-
else
|
|
1642
|
-
{
|
|
1643
|
-
writeSize(v);
|
|
1644
|
-
}
|
|
1645
|
-
}
|
|
1646
|
-
|
|
1647
|
-
void
|
|
1648
|
-
IceInternal::BasicStream::writeException(const UserException& e)
|
|
1649
|
-
{
|
|
1650
|
-
initWriteEncaps();
|
|
1651
|
-
_currentWriteEncaps->encoder->write(e);
|
|
1652
|
-
}
|
|
1653
|
-
|
|
1654
|
-
void
|
|
1655
|
-
IceInternal::BasicStream::throwException(const UserExceptionFactoryPtr& factory)
|
|
1656
|
-
{
|
|
1657
|
-
initReadEncaps();
|
|
1658
|
-
_currentReadEncaps->decoder->throwException(factory);
|
|
1659
|
-
}
|
|
1660
|
-
|
|
1661
|
-
void
|
|
1662
|
-
IceInternal::BasicStream::sliceObjects(bool doSlice)
|
|
1663
|
-
{
|
|
1664
|
-
_sliceObjects = doSlice;
|
|
1665
|
-
}
|
|
1666
|
-
|
|
1667
|
-
bool
|
|
1668
|
-
IceInternal::BasicStream::readOptImpl(Int readTag, OptionalFormat expectedFormat)
|
|
1669
|
-
{
|
|
1670
|
-
if(getReadEncoding() == Encoding_1_0)
|
|
1671
|
-
{
|
|
1672
|
-
return false; // Optional members aren't supported with the 1.0 encoding.
|
|
1673
|
-
}
|
|
1674
|
-
|
|
1675
|
-
while(true)
|
|
1676
|
-
{
|
|
1677
|
-
if(i >= b.begin() + _currentReadEncaps->start + _currentReadEncaps->sz)
|
|
1678
|
-
{
|
|
1679
|
-
return false; // End of encapsulation also indicates end of optionals.
|
|
1680
|
-
}
|
|
1681
|
-
|
|
1682
|
-
Byte v;
|
|
1683
|
-
read(v);
|
|
1684
|
-
if(v == OPTIONAL_END_MARKER)
|
|
1685
|
-
{
|
|
1686
|
-
--i; // Rewind
|
|
1687
|
-
return false;
|
|
1688
|
-
}
|
|
1689
|
-
|
|
1690
|
-
OptionalFormat format = static_cast<OptionalFormat>(v & 0x07); // First 3 bits.
|
|
1691
|
-
Int tag = static_cast<Int>(v >> 3);
|
|
1692
|
-
if(tag == 30)
|
|
1693
|
-
{
|
|
1694
|
-
tag = readSize();
|
|
1695
|
-
}
|
|
1696
|
-
|
|
1697
|
-
if(tag > readTag)
|
|
1698
|
-
{
|
|
1699
|
-
i -= tag < 30 ? 1 : (tag < 255 ? 2 : 6); // Rewind
|
|
1700
|
-
return false; // No optional data members with the requested tag.
|
|
1701
|
-
}
|
|
1702
|
-
else if(tag < readTag)
|
|
1703
|
-
{
|
|
1704
|
-
skipOpt(format); // Skip optional data members
|
|
1705
|
-
}
|
|
1706
|
-
else
|
|
1707
|
-
{
|
|
1708
|
-
if(format != expectedFormat)
|
|
1709
|
-
{
|
|
1710
|
-
ostringstream os;
|
|
1711
|
-
os << "invalid optional data member `" << tag << "': unexpected format";
|
|
1712
|
-
throw MarshalException(__FILE__, __LINE__, os.str());
|
|
1713
|
-
}
|
|
1714
|
-
return true;
|
|
1715
|
-
}
|
|
1716
|
-
}
|
|
1717
|
-
return true; // Keep the compiler happy.
|
|
1718
|
-
}
|
|
1719
|
-
|
|
1720
|
-
bool
|
|
1721
|
-
IceInternal::BasicStream::writeOptImpl(Int tag, OptionalFormat type)
|
|
1722
|
-
{
|
|
1723
|
-
if(getWriteEncoding() == Encoding_1_0)
|
|
1724
|
-
{
|
|
1725
|
-
return false; // Optional members aren't supported with the 1.0 encoding.
|
|
1726
|
-
}
|
|
1727
|
-
|
|
1728
|
-
Byte v = static_cast<Byte>(type);
|
|
1729
|
-
if(tag < 30)
|
|
1730
|
-
{
|
|
1731
|
-
v |= static_cast<Byte>(tag << 3);
|
|
1732
|
-
write(v);
|
|
1733
|
-
}
|
|
1734
|
-
else
|
|
1735
|
-
{
|
|
1736
|
-
v |= 0xF0; // tag = 30
|
|
1737
|
-
write(v);
|
|
1738
|
-
writeSize(tag);
|
|
1739
|
-
}
|
|
1740
|
-
return true;
|
|
1741
|
-
}
|
|
1742
|
-
|
|
1743
|
-
void
|
|
1744
|
-
IceInternal::BasicStream::skipOpt(OptionalFormat type)
|
|
1745
|
-
{
|
|
1746
|
-
switch(type)
|
|
1747
|
-
{
|
|
1748
|
-
case Ice::OptionalFormatF1:
|
|
1749
|
-
{
|
|
1750
|
-
skip(1);
|
|
1751
|
-
break;
|
|
1752
|
-
}
|
|
1753
|
-
case Ice::OptionalFormatF2:
|
|
1754
|
-
{
|
|
1755
|
-
skip(2);
|
|
1756
|
-
break;
|
|
1757
|
-
}
|
|
1758
|
-
case Ice::OptionalFormatF4:
|
|
1759
|
-
{
|
|
1760
|
-
skip(4);
|
|
1761
|
-
break;
|
|
1762
|
-
}
|
|
1763
|
-
case Ice::OptionalFormatF8:
|
|
1764
|
-
{
|
|
1765
|
-
skip(8);
|
|
1766
|
-
break;
|
|
1767
|
-
}
|
|
1768
|
-
case Ice::OptionalFormatSize:
|
|
1769
|
-
{
|
|
1770
|
-
skipSize();
|
|
1771
|
-
break;
|
|
1772
|
-
}
|
|
1773
|
-
case Ice::OptionalFormatVSize:
|
|
1774
|
-
{
|
|
1775
|
-
skip(readSize());
|
|
1776
|
-
break;
|
|
1777
|
-
}
|
|
1778
|
-
case Ice::OptionalFormatFSize:
|
|
1779
|
-
{
|
|
1780
|
-
Int sz;
|
|
1781
|
-
read(sz);
|
|
1782
|
-
skip(sz);
|
|
1783
|
-
break;
|
|
1784
|
-
}
|
|
1785
|
-
case Ice::OptionalFormatClass:
|
|
1786
|
-
{
|
|
1787
|
-
read(0, 0);
|
|
1788
|
-
break;
|
|
1789
|
-
}
|
|
1790
|
-
}
|
|
1791
|
-
}
|
|
1792
|
-
|
|
1793
|
-
void
|
|
1794
|
-
BasicStream::skipOpts()
|
|
1795
|
-
{
|
|
1796
|
-
//
|
|
1797
|
-
// Skip remaining un-read optional members.
|
|
1798
|
-
//
|
|
1799
|
-
while(true)
|
|
1800
|
-
{
|
|
1801
|
-
if(i >= b.begin() + _currentReadEncaps->start + _currentReadEncaps->sz)
|
|
1802
|
-
{
|
|
1803
|
-
return; // End of encapsulation also indicates end of optionals.
|
|
1804
|
-
}
|
|
1805
|
-
|
|
1806
|
-
Byte v;
|
|
1807
|
-
read(v);
|
|
1808
|
-
if(v == OPTIONAL_END_MARKER)
|
|
1809
|
-
{
|
|
1810
|
-
return;
|
|
1811
|
-
}
|
|
1812
|
-
|
|
1813
|
-
OptionalFormat format = static_cast<OptionalFormat>(v & 0x07); // Read first 3 bits.
|
|
1814
|
-
if(static_cast<Int>(v >> 3) == 30)
|
|
1815
|
-
{
|
|
1816
|
-
skipSize();
|
|
1817
|
-
}
|
|
1818
|
-
skipOpt(format);
|
|
1819
|
-
}
|
|
1820
|
-
}
|
|
1821
|
-
|
|
1822
|
-
void
|
|
1823
|
-
IceInternal::BasicStream::throwUnmarshalOutOfBoundsException(const char* file, int line)
|
|
1824
|
-
{
|
|
1825
|
-
throw UnmarshalOutOfBoundsException(file, line);
|
|
1826
|
-
}
|
|
1827
|
-
|
|
1828
|
-
void
|
|
1829
|
-
IceInternal::BasicStream::throwEncapsulationException(const char* file, int line)
|
|
1830
|
-
{
|
|
1831
|
-
throw EncapsulationException(file, line);
|
|
1832
|
-
}
|
|
1833
|
-
|
|
1834
|
-
void
|
|
1835
|
-
IceInternal::BasicStream::initReadEncaps()
|
|
1836
|
-
{
|
|
1837
|
-
if(!_currentReadEncaps) // Lazy initialization.
|
|
1838
|
-
{
|
|
1839
|
-
_currentReadEncaps = &_preAllocatedReadEncaps;
|
|
1840
|
-
_currentReadEncaps->sz = static_cast<Ice::Int>(b.size());
|
|
1841
|
-
}
|
|
1842
|
-
|
|
1843
|
-
if(!_currentReadEncaps->decoder) // Lazy initialization.
|
|
1844
|
-
{
|
|
1845
|
-
ObjectFactoryManagerPtr factoryManager = _instance->servantFactoryManager();
|
|
1846
|
-
size_t classGraphDepthMax = _instance->classGraphDepthMax();
|
|
1847
|
-
if(_currentReadEncaps->encoding == Encoding_1_0)
|
|
1848
|
-
{
|
|
1849
|
-
_currentReadEncaps->decoder = new EncapsDecoder10(this, _currentReadEncaps, _sliceObjects,
|
|
1850
|
-
classGraphDepthMax, factoryManager);
|
|
1851
|
-
}
|
|
1852
|
-
else
|
|
1853
|
-
{
|
|
1854
|
-
_currentReadEncaps->decoder = new EncapsDecoder11(this, _currentReadEncaps, _sliceObjects,
|
|
1855
|
-
classGraphDepthMax, factoryManager);
|
|
1856
|
-
}
|
|
1857
|
-
}
|
|
1858
|
-
}
|
|
1859
|
-
|
|
1860
|
-
void
|
|
1861
|
-
IceInternal::BasicStream::initWriteEncaps()
|
|
1862
|
-
{
|
|
1863
|
-
if(!_currentWriteEncaps) // Lazy initialization.
|
|
1864
|
-
{
|
|
1865
|
-
_currentWriteEncaps = &_preAllocatedWriteEncaps;
|
|
1866
|
-
_currentWriteEncaps->start = b.size();
|
|
1867
|
-
}
|
|
1868
|
-
|
|
1869
|
-
if(_currentWriteEncaps->format == Ice::DefaultFormat)
|
|
1870
|
-
{
|
|
1871
|
-
_currentWriteEncaps->format = _instance->defaultsAndOverrides()->defaultFormat;
|
|
1872
|
-
}
|
|
1873
|
-
|
|
1874
|
-
if(!_currentWriteEncaps->encoder) // Lazy initialization.
|
|
1875
|
-
{
|
|
1876
|
-
if(_currentWriteEncaps->encoding == Encoding_1_0)
|
|
1877
|
-
{
|
|
1878
|
-
_currentWriteEncaps->encoder = new EncapsEncoder10(this, _currentWriteEncaps);
|
|
1879
|
-
}
|
|
1880
|
-
else
|
|
1881
|
-
{
|
|
1882
|
-
_currentWriteEncaps->encoder = new EncapsEncoder11(this, _currentWriteEncaps);
|
|
1883
|
-
}
|
|
1884
|
-
}
|
|
1885
|
-
}
|
|
1886
|
-
|
|
1887
|
-
string
|
|
1888
|
-
IceInternal::BasicStream::EncapsDecoder::readTypeId(bool isIndex)
|
|
1889
|
-
{
|
|
1890
|
-
if(isIndex)
|
|
1891
|
-
{
|
|
1892
|
-
Int index = _stream->readSize();
|
|
1893
|
-
TypeIdReadMap::const_iterator k = _typeIdMap.find(index);
|
|
1894
|
-
if(k == _typeIdMap.end())
|
|
1895
|
-
{
|
|
1896
|
-
throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
|
|
1897
|
-
}
|
|
1898
|
-
return k->second;
|
|
1899
|
-
}
|
|
1900
|
-
else
|
|
1901
|
-
{
|
|
1902
|
-
string typeId;
|
|
1903
|
-
_stream->read(typeId, false);
|
|
1904
|
-
_typeIdMap.insert(make_pair(++_typeIdIndex, typeId));
|
|
1905
|
-
return typeId;
|
|
1906
|
-
}
|
|
1907
|
-
}
|
|
1908
|
-
|
|
1909
|
-
Ice::ObjectPtr
|
|
1910
|
-
IceInternal::BasicStream::EncapsDecoder::newInstance(const string& typeId)
|
|
1911
|
-
{
|
|
1912
|
-
Ice::ObjectPtr v;
|
|
1913
|
-
|
|
1914
|
-
//
|
|
1915
|
-
// Try to find a factory registered for the specific type.
|
|
1916
|
-
//
|
|
1917
|
-
ObjectFactoryPtr userFactory = _servantFactoryManager->find(typeId);
|
|
1918
|
-
if(userFactory)
|
|
1919
|
-
{
|
|
1920
|
-
v = userFactory->create(typeId);
|
|
1921
|
-
}
|
|
1922
|
-
|
|
1923
|
-
//
|
|
1924
|
-
// If that fails, invoke the default factory if one has been
|
|
1925
|
-
// registered.
|
|
1926
|
-
//
|
|
1927
|
-
if(!v)
|
|
1928
|
-
{
|
|
1929
|
-
userFactory = _servantFactoryManager->find("");
|
|
1930
|
-
if(userFactory)
|
|
1931
|
-
{
|
|
1932
|
-
v = userFactory->create(typeId);
|
|
1933
|
-
}
|
|
1934
|
-
}
|
|
1935
|
-
|
|
1936
|
-
//
|
|
1937
|
-
// Last chance: check the table of static factories (i.e.,
|
|
1938
|
-
// automatically generated factories for concrete classes).
|
|
1939
|
-
//
|
|
1940
|
-
if(!v)
|
|
1941
|
-
{
|
|
1942
|
-
ObjectFactoryPtr of = IceInternal::factoryTable->getObjectFactory(typeId);
|
|
1943
|
-
if(of)
|
|
1944
|
-
{
|
|
1945
|
-
v = of->create(typeId);
|
|
1946
|
-
assert(v);
|
|
1947
|
-
}
|
|
1948
|
-
}
|
|
1949
|
-
|
|
1950
|
-
return v;
|
|
1951
|
-
}
|
|
1952
|
-
|
|
1953
|
-
void
|
|
1954
|
-
IceInternal::BasicStream::EncapsDecoder::addPatchEntry(Int index, PatchFunc patchFunc, void* patchAddr)
|
|
1955
|
-
{
|
|
1956
|
-
assert(index > 0);
|
|
1957
|
-
|
|
1958
|
-
//
|
|
1959
|
-
// Check if already un-marshalled the object. If that's the case,
|
|
1960
|
-
// just patch the object smart pointer and we're done.
|
|
1961
|
-
//
|
|
1962
|
-
IndexToPtrMap::iterator p = _unmarshaledMap.find(index);
|
|
1963
|
-
if(p != _unmarshaledMap.end())
|
|
1964
|
-
{
|
|
1965
|
-
(*patchFunc)(patchAddr, p->second);
|
|
1966
|
-
return;
|
|
1967
|
-
}
|
|
1968
|
-
|
|
1969
|
-
//
|
|
1970
|
-
// Add patch entry if the object isn't un-marshalled yet, the
|
|
1971
|
-
// smart pointer will be patched when the instance is
|
|
1972
|
-
// un-marshalled.
|
|
1973
|
-
//
|
|
1974
|
-
|
|
1975
|
-
PatchMap::iterator q = _patchMap.find(index);
|
|
1976
|
-
if(q == _patchMap.end())
|
|
1977
|
-
{
|
|
1978
|
-
//
|
|
1979
|
-
// We have no outstanding instances to be patched for this
|
|
1980
|
-
// index, so make a new entry in the patch map.
|
|
1981
|
-
//
|
|
1982
|
-
q = _patchMap.insert(make_pair(index, PatchList())).first;
|
|
1983
|
-
}
|
|
1984
|
-
|
|
1985
|
-
//
|
|
1986
|
-
// Append a patch entry for this instance.
|
|
1987
|
-
//
|
|
1988
|
-
PatchEntry e;
|
|
1989
|
-
e.patchFunc = patchFunc;
|
|
1990
|
-
e.patchAddr = patchAddr;
|
|
1991
|
-
e.classGraphDepth = _classGraphDepth;
|
|
1992
|
-
q->second.push_back(e);
|
|
1993
|
-
}
|
|
1994
|
-
|
|
1995
|
-
void
|
|
1996
|
-
IceInternal::BasicStream::EncapsDecoder::unmarshal(Int index, const Ice::ObjectPtr& v)
|
|
1997
|
-
{
|
|
1998
|
-
//
|
|
1999
|
-
// Add the object to the map of un-marshalled objects, this must
|
|
2000
|
-
// be done before reading the objects (for circular references).
|
|
2001
|
-
//
|
|
2002
|
-
_unmarshaledMap.insert(make_pair(index, v));
|
|
2003
|
-
|
|
2004
|
-
//
|
|
2005
|
-
// Read the object.
|
|
2006
|
-
//
|
|
2007
|
-
v->__read(_stream);
|
|
2008
|
-
|
|
2009
|
-
//
|
|
2010
|
-
// Patch all instances now that the object is un-marshalled.
|
|
2011
|
-
//
|
|
2012
|
-
PatchMap::iterator patchPos = _patchMap.find(index);
|
|
2013
|
-
if(patchPos != _patchMap.end())
|
|
2014
|
-
{
|
|
2015
|
-
assert(patchPos->second.size() > 0);
|
|
2016
|
-
|
|
2017
|
-
//
|
|
2018
|
-
// Patch all pointers that refer to the instance.
|
|
2019
|
-
//
|
|
2020
|
-
for(PatchList::iterator k = patchPos->second.begin(); k != patchPos->second.end(); ++k)
|
|
2021
|
-
{
|
|
2022
|
-
(*k->patchFunc)(k->patchAddr, v);
|
|
2023
|
-
}
|
|
2024
|
-
|
|
2025
|
-
//
|
|
2026
|
-
// Clear out the patch map for that index -- there is nothing left
|
|
2027
|
-
// to patch for that index for the time being.
|
|
2028
|
-
//
|
|
2029
|
-
_patchMap.erase(patchPos);
|
|
2030
|
-
}
|
|
2031
|
-
|
|
2032
|
-
if(_objectList.empty() && _patchMap.empty())
|
|
2033
|
-
{
|
|
2034
|
-
try
|
|
2035
|
-
{
|
|
2036
|
-
if(_stream->instance()->collectObjects())
|
|
2037
|
-
{
|
|
2038
|
-
v->ice_collectable(true);
|
|
2039
|
-
}
|
|
2040
|
-
v->ice_postUnmarshal();
|
|
2041
|
-
}
|
|
2042
|
-
catch(const std::exception& ex)
|
|
2043
|
-
{
|
|
2044
|
-
Warning out(_stream->instance()->initializationData().logger);
|
|
2045
|
-
out << "std::exception raised by ice_postUnmarshal:\n" << ex;
|
|
2046
|
-
}
|
|
2047
|
-
catch(...)
|
|
2048
|
-
{
|
|
2049
|
-
Warning out(_stream->instance()->initializationData().logger);
|
|
2050
|
-
out << "unknown exception raised by ice_postUnmarshal";
|
|
2051
|
-
}
|
|
2052
|
-
}
|
|
2053
|
-
else
|
|
2054
|
-
{
|
|
2055
|
-
_objectList.push_back(v);
|
|
2056
|
-
|
|
2057
|
-
if(_patchMap.empty())
|
|
2058
|
-
{
|
|
2059
|
-
//
|
|
2060
|
-
// Iterate over the object list and invoke ice_postUnmarshal on
|
|
2061
|
-
// each object. We must do this after all objects have been
|
|
2062
|
-
// unmarshaled in order to ensure that any object data members
|
|
2063
|
-
// have been properly patched.
|
|
2064
|
-
//
|
|
2065
|
-
for(ObjectList::iterator p = _objectList.begin(); p != _objectList.end(); ++p)
|
|
2066
|
-
{
|
|
2067
|
-
try
|
|
2068
|
-
{
|
|
2069
|
-
if(_stream->instance()->collectObjects())
|
|
2070
|
-
{
|
|
2071
|
-
(*p)->ice_collectable(true);
|
|
2072
|
-
}
|
|
2073
|
-
(*p)->ice_postUnmarshal();
|
|
2074
|
-
}
|
|
2075
|
-
catch(const std::exception& ex)
|
|
2076
|
-
{
|
|
2077
|
-
Warning out(_stream->instance()->initializationData().logger);
|
|
2078
|
-
out << "std::exception raised by ice_postUnmarshal:\n" << ex;
|
|
2079
|
-
}
|
|
2080
|
-
catch(...)
|
|
2081
|
-
{
|
|
2082
|
-
Warning out(_stream->instance()->initializationData().logger);
|
|
2083
|
-
out << "unknown exception raised by ice_postUnmarshal";
|
|
2084
|
-
}
|
|
2085
|
-
}
|
|
2086
|
-
_objectList.clear();
|
|
2087
|
-
}
|
|
2088
|
-
}
|
|
2089
|
-
}
|
|
2090
|
-
|
|
2091
|
-
void
|
|
2092
|
-
IceInternal::BasicStream::EncapsDecoder10::read(PatchFunc patchFunc, void* patchAddr)
|
|
2093
|
-
{
|
|
2094
|
-
assert(patchFunc && patchAddr);
|
|
2095
|
-
|
|
2096
|
-
//
|
|
2097
|
-
// Object references are encoded as a negative integer in 1.0.
|
|
2098
|
-
//
|
|
2099
|
-
Int index;
|
|
2100
|
-
_stream->read(index);
|
|
2101
|
-
if(index > 0)
|
|
2102
|
-
{
|
|
2103
|
-
throw MarshalException(__FILE__, __LINE__, "invalid object id");
|
|
2104
|
-
}
|
|
2105
|
-
index = -index;
|
|
2106
|
-
|
|
2107
|
-
if(index == 0)
|
|
2108
|
-
{
|
|
2109
|
-
//
|
|
2110
|
-
// Calling the patch function for null instances is necessary for correct functioning of Ice for
|
|
2111
|
-
// Python and Ruby.
|
|
2112
|
-
//
|
|
2113
|
-
ObjectPtr nil;
|
|
2114
|
-
patchFunc(patchAddr, nil);
|
|
2115
|
-
}
|
|
2116
|
-
else
|
|
2117
|
-
{
|
|
2118
|
-
addPatchEntry(index, patchFunc, patchAddr);
|
|
2119
|
-
}
|
|
2120
|
-
}
|
|
2121
|
-
|
|
2122
|
-
void
|
|
2123
|
-
IceInternal::BasicStream::EncapsDecoder10::throwException(const UserExceptionFactoryPtr& factory)
|
|
2124
|
-
{
|
|
2125
|
-
assert(_sliceType == NoSlice);
|
|
2126
|
-
|
|
2127
|
-
//
|
|
2128
|
-
// User exception with the 1.0 encoding start with a boolean flag
|
|
2129
|
-
// that indicates whether or not the exception has classes.
|
|
2130
|
-
//
|
|
2131
|
-
// This allows reading the pending objects even if some part of
|
|
2132
|
-
// the exception was sliced.
|
|
2133
|
-
//
|
|
2134
|
-
bool usesClasses;
|
|
2135
|
-
_stream->read(usesClasses);
|
|
2136
|
-
|
|
2137
|
-
_sliceType = ExceptionSlice;
|
|
2138
|
-
_skipFirstSlice = false;
|
|
2139
|
-
|
|
2140
|
-
//
|
|
2141
|
-
// Read the first slice header.
|
|
2142
|
-
//
|
|
2143
|
-
startSlice();
|
|
2144
|
-
const string mostDerivedId = _typeId;
|
|
2145
|
-
UserExceptionFactoryPtr exceptionFactory = factory;
|
|
2146
|
-
while(true)
|
|
2147
|
-
{
|
|
2148
|
-
//
|
|
2149
|
-
// Look for a statically-generated factory for this ID.
|
|
2150
|
-
//
|
|
2151
|
-
if(!exceptionFactory)
|
|
2152
|
-
{
|
|
2153
|
-
exceptionFactory = factoryTable->getExceptionFactory(_typeId);
|
|
2154
|
-
}
|
|
2155
|
-
|
|
2156
|
-
//
|
|
2157
|
-
// We found a factory, we get out of this loop.
|
|
2158
|
-
//
|
|
2159
|
-
if(exceptionFactory)
|
|
2160
|
-
{
|
|
2161
|
-
//
|
|
2162
|
-
// Got factory -- ask the factory to instantiate the
|
|
2163
|
-
// exception, initialize the exception members, and throw
|
|
2164
|
-
// the exception.
|
|
2165
|
-
//
|
|
2166
|
-
try
|
|
2167
|
-
{
|
|
2168
|
-
exceptionFactory->createAndThrow(_typeId);
|
|
2169
|
-
}
|
|
2170
|
-
catch(UserException& ex)
|
|
2171
|
-
{
|
|
2172
|
-
ex.__read(_stream);
|
|
2173
|
-
if(usesClasses)
|
|
2174
|
-
{
|
|
2175
|
-
readPendingObjects();
|
|
2176
|
-
}
|
|
2177
|
-
throw;
|
|
2178
|
-
|
|
2179
|
-
// Never reached.
|
|
2180
|
-
}
|
|
2181
|
-
}
|
|
2182
|
-
|
|
2183
|
-
//
|
|
2184
|
-
// Slice off what we don't understand.
|
|
2185
|
-
//
|
|
2186
|
-
skipSlice();
|
|
2187
|
-
try
|
|
2188
|
-
{
|
|
2189
|
-
startSlice();
|
|
2190
|
-
}
|
|
2191
|
-
catch(UnmarshalOutOfBoundsException& ex)
|
|
2192
|
-
{
|
|
2193
|
-
//
|
|
2194
|
-
// An oversight in the 1.0 encoding means there is no marker to indicate
|
|
2195
|
-
// the last slice of an exception. As a result, we just try to read the
|
|
2196
|
-
// next type ID, which raises UnmarshalOutOfBoundsException when the
|
|
2197
|
-
// input buffer underflows.
|
|
2198
|
-
//
|
|
2199
|
-
// Set the reason member to a more helpful message.
|
|
2200
|
-
//
|
|
2201
|
-
ex.reason = "unknown exception type `" + mostDerivedId + "'";
|
|
2202
|
-
throw;
|
|
2203
|
-
}
|
|
2204
|
-
}
|
|
2205
|
-
}
|
|
2206
|
-
|
|
2207
|
-
void
|
|
2208
|
-
#ifndef NDEBUG
|
|
2209
|
-
IceInternal::BasicStream::EncapsDecoder10::startInstance(SliceType sliceType)
|
|
2210
|
-
#else
|
|
2211
|
-
IceInternal::BasicStream::EncapsDecoder10::startInstance(SliceType)
|
|
2212
|
-
#endif
|
|
2213
|
-
{
|
|
2214
|
-
assert(_sliceType == sliceType);
|
|
2215
|
-
_skipFirstSlice = true;
|
|
2216
|
-
}
|
|
2217
|
-
|
|
2218
|
-
SlicedDataPtr
|
|
2219
|
-
IceInternal::BasicStream::EncapsDecoder10::endInstance(bool)
|
|
2220
|
-
{
|
|
2221
|
-
//
|
|
2222
|
-
// Read the Ice::Object slice.
|
|
2223
|
-
//
|
|
2224
|
-
if(_sliceType == ObjectSlice)
|
|
2225
|
-
{
|
|
2226
|
-
startSlice();
|
|
2227
|
-
Int sz = _stream->readSize(); // For compatibility with the old AFM.
|
|
2228
|
-
if(sz != 0)
|
|
2229
|
-
{
|
|
2230
|
-
throw MarshalException(__FILE__, __LINE__, "invalid Object slice");
|
|
2231
|
-
}
|
|
2232
|
-
endSlice();
|
|
2233
|
-
}
|
|
2234
|
-
_sliceType = NoSlice;
|
|
2235
|
-
return 0;
|
|
2236
|
-
}
|
|
2237
|
-
|
|
2238
|
-
const std::string&
|
|
2239
|
-
IceInternal::BasicStream::EncapsDecoder10::startSlice()
|
|
2240
|
-
{
|
|
2241
|
-
//
|
|
2242
|
-
// If first slice, don't read the header, it was already read in
|
|
2243
|
-
// readInstance or throwException to find the factory.
|
|
2244
|
-
//
|
|
2245
|
-
if(_skipFirstSlice)
|
|
2246
|
-
{
|
|
2247
|
-
_skipFirstSlice = false;
|
|
2248
|
-
return _typeId;
|
|
2249
|
-
}
|
|
2250
|
-
|
|
2251
|
-
//
|
|
2252
|
-
// For objects, first read the type ID boolean which indicates
|
|
2253
|
-
// whether or not the type ID is encoded as a string or as an
|
|
2254
|
-
// index. For exceptions, the type ID is always encoded as a
|
|
2255
|
-
// string.
|
|
2256
|
-
//
|
|
2257
|
-
if(_sliceType == ObjectSlice)
|
|
2258
|
-
{
|
|
2259
|
-
bool isIndex;
|
|
2260
|
-
_stream->read(isIndex);
|
|
2261
|
-
_typeId = readTypeId(isIndex);
|
|
2262
|
-
}
|
|
2263
|
-
else
|
|
2264
|
-
{
|
|
2265
|
-
_stream->read(_typeId, false);
|
|
2266
|
-
}
|
|
2267
|
-
|
|
2268
|
-
_stream->read(_sliceSize);
|
|
2269
|
-
if(_sliceSize < 4)
|
|
2270
|
-
{
|
|
2271
|
-
throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
|
|
2272
|
-
}
|
|
2273
|
-
return _typeId;
|
|
2274
|
-
}
|
|
2275
|
-
|
|
2276
|
-
void
|
|
2277
|
-
IceInternal::BasicStream::EncapsDecoder10::endSlice()
|
|
2278
|
-
{
|
|
2279
|
-
}
|
|
2280
|
-
|
|
2281
|
-
void
|
|
2282
|
-
IceInternal::BasicStream::EncapsDecoder10::skipSlice()
|
|
2283
|
-
{
|
|
2284
|
-
if(_stream->instance()->traceLevels()->slicing > 0)
|
|
2285
|
-
{
|
|
2286
|
-
const Ice::LoggerPtr& logger = _stream->instance()->initializationData().logger;
|
|
2287
|
-
if(_sliceType == ExceptionSlice)
|
|
2288
|
-
{
|
|
2289
|
-
traceSlicing("exception", _typeId, _stream->instance()->traceLevels()->slicingCat, logger);
|
|
2290
|
-
}
|
|
2291
|
-
else
|
|
2292
|
-
{
|
|
2293
|
-
traceSlicing("object", _typeId, _stream->instance()->traceLevels()->slicingCat, logger);
|
|
2294
|
-
}
|
|
2295
|
-
}
|
|
2296
|
-
assert(_sliceSize >= 4);
|
|
2297
|
-
_stream->skip(_sliceSize - sizeof(Int));
|
|
2298
|
-
}
|
|
2299
|
-
|
|
2300
|
-
void
|
|
2301
|
-
IceInternal::BasicStream::EncapsDecoder10::readPendingObjects()
|
|
2302
|
-
{
|
|
2303
|
-
Int num;
|
|
2304
|
-
do
|
|
2305
|
-
{
|
|
2306
|
-
num = _stream->readSize();
|
|
2307
|
-
for(Int k = num; k > 0; --k)
|
|
2308
|
-
{
|
|
2309
|
-
readInstance();
|
|
2310
|
-
}
|
|
2311
|
-
}
|
|
2312
|
-
while(num);
|
|
2313
|
-
|
|
2314
|
-
if(!_patchMap.empty())
|
|
2315
|
-
{
|
|
2316
|
-
//
|
|
2317
|
-
// If any entries remain in the patch map, the sender has sent an index for an object, but failed
|
|
2318
|
-
// to supply the object.
|
|
2319
|
-
//
|
|
2320
|
-
throw MarshalException(__FILE__, __LINE__, "index for class received, but no instance");
|
|
2321
|
-
}
|
|
2322
|
-
}
|
|
2323
|
-
|
|
2324
|
-
void
|
|
2325
|
-
IceInternal::BasicStream::EncapsDecoder10::readInstance()
|
|
2326
|
-
{
|
|
2327
|
-
Int index;
|
|
2328
|
-
_stream->read(index);
|
|
2329
|
-
|
|
2330
|
-
if(index <= 0)
|
|
2331
|
-
{
|
|
2332
|
-
throw MarshalException(__FILE__, __LINE__, "invalid object id");
|
|
2333
|
-
}
|
|
2334
|
-
|
|
2335
|
-
_sliceType = ObjectSlice;
|
|
2336
|
-
_skipFirstSlice = false;
|
|
2337
|
-
|
|
2338
|
-
//
|
|
2339
|
-
// Read the first slice header.
|
|
2340
|
-
//
|
|
2341
|
-
startSlice();
|
|
2342
|
-
const string mostDerivedId = _typeId;
|
|
2343
|
-
ObjectPtr v;
|
|
2344
|
-
while(true)
|
|
2345
|
-
{
|
|
2346
|
-
//
|
|
2347
|
-
// For the 1.0 encoding, the type ID for the base Object class
|
|
2348
|
-
// marks the last slice.
|
|
2349
|
-
//
|
|
2350
|
-
if(_typeId == Object::ice_staticId())
|
|
2351
|
-
{
|
|
2352
|
-
throw NoObjectFactoryException(__FILE__, __LINE__, "", mostDerivedId);
|
|
2353
|
-
}
|
|
2354
|
-
|
|
2355
|
-
v = newInstance(_typeId);
|
|
2356
|
-
|
|
2357
|
-
//
|
|
2358
|
-
// We found a factory, we get out of this loop.
|
|
2359
|
-
//
|
|
2360
|
-
if(v)
|
|
2361
|
-
{
|
|
2362
|
-
break;
|
|
2363
|
-
}
|
|
2364
|
-
|
|
2365
|
-
//
|
|
2366
|
-
// If object slicing is disabled, stop un-marshalling.
|
|
2367
|
-
//
|
|
2368
|
-
if(!_sliceObjects)
|
|
2369
|
-
{
|
|
2370
|
-
throw NoObjectFactoryException(__FILE__, __LINE__, "no object factory found and object slicing is disabled",
|
|
2371
|
-
_typeId);
|
|
2372
|
-
}
|
|
2373
|
-
|
|
2374
|
-
//
|
|
2375
|
-
// Slice off what we don't understand.
|
|
2376
|
-
//
|
|
2377
|
-
skipSlice();
|
|
2378
|
-
startSlice(); // Read next Slice header for next iteration.
|
|
2379
|
-
}
|
|
2380
|
-
|
|
2381
|
-
//
|
|
2382
|
-
// Compute the biggest class graph depth of this object. To compute this,
|
|
2383
|
-
// we get the class graph depth of each ancestor from the patch map and
|
|
2384
|
-
// keep the biggest one.
|
|
2385
|
-
//
|
|
2386
|
-
_classGraphDepth = 0;
|
|
2387
|
-
PatchMap::iterator patchPos = _patchMap.find(index);
|
|
2388
|
-
if(patchPos != _patchMap.end())
|
|
2389
|
-
{
|
|
2390
|
-
assert(patchPos->second.size() > 0);
|
|
2391
|
-
for(PatchList::iterator k = patchPos->second.begin(); k != patchPos->second.end(); ++k)
|
|
2392
|
-
{
|
|
2393
|
-
if(k->classGraphDepth > _classGraphDepth)
|
|
2394
|
-
{
|
|
2395
|
-
_classGraphDepth = k->classGraphDepth;
|
|
2396
|
-
}
|
|
2397
|
-
}
|
|
2398
|
-
}
|
|
2399
|
-
|
|
2400
|
-
if(++_classGraphDepth > _classGraphDepthMax)
|
|
2401
|
-
{
|
|
2402
|
-
throw MarshalException(__FILE__, __LINE__, "maximum class graph depth reached");
|
|
2403
|
-
}
|
|
2404
|
-
|
|
2405
|
-
//
|
|
2406
|
-
// Un-marshal the object and add-it to the map of un-marshaled objects.
|
|
2407
|
-
//
|
|
2408
|
-
unmarshal(index, v);
|
|
2409
|
-
}
|
|
2410
|
-
|
|
2411
|
-
void
|
|
2412
|
-
IceInternal::BasicStream::EncapsDecoder11::read(PatchFunc patchFunc, void* patchAddr)
|
|
2413
|
-
{
|
|
2414
|
-
Int index = _stream->readSize();
|
|
2415
|
-
if(index < 0)
|
|
2416
|
-
{
|
|
2417
|
-
throw MarshalException(__FILE__, __LINE__, "invalid object id");
|
|
2418
|
-
}
|
|
2419
|
-
else if(index == 0)
|
|
2420
|
-
{
|
|
2421
|
-
//
|
|
2422
|
-
// Calling the patch function for null instances is necessary for correct functioning of Ice for
|
|
2423
|
-
// Python and Ruby.
|
|
2424
|
-
//
|
|
2425
|
-
if(patchFunc)
|
|
2426
|
-
{
|
|
2427
|
-
ObjectPtr nil;
|
|
2428
|
-
patchFunc(patchAddr, nil);
|
|
2429
|
-
}
|
|
2430
|
-
}
|
|
2431
|
-
else if(_current && _current->sliceFlags & FLAG_HAS_INDIRECTION_TABLE)
|
|
2432
|
-
{
|
|
2433
|
-
//
|
|
2434
|
-
// When reading an object within a slice and there's an
|
|
2435
|
-
// indirect object table, always read an indirect reference
|
|
2436
|
-
// that points to an object from the indirect object table
|
|
2437
|
-
// marshaled at the end of the Slice.
|
|
2438
|
-
//
|
|
2439
|
-
// Maintain a list of indirect references. Note that the
|
|
2440
|
-
// indirect index starts at 1, so we decrement it by one to
|
|
2441
|
-
// derive an index into the indirection table that we'll read
|
|
2442
|
-
// at the end of the slice.
|
|
2443
|
-
//
|
|
2444
|
-
if(patchFunc)
|
|
2445
|
-
{
|
|
2446
|
-
IndirectPatchEntry e;
|
|
2447
|
-
e.index = index - 1;
|
|
2448
|
-
e.patchFunc = patchFunc;
|
|
2449
|
-
e.patchAddr = patchAddr;
|
|
2450
|
-
_current->indirectPatchList.push_back(e);
|
|
2451
|
-
}
|
|
2452
|
-
}
|
|
2453
|
-
else
|
|
2454
|
-
{
|
|
2455
|
-
readInstance(index, patchFunc, patchAddr);
|
|
2456
|
-
}
|
|
2457
|
-
}
|
|
2458
|
-
|
|
2459
|
-
void
|
|
2460
|
-
IceInternal::BasicStream::EncapsDecoder11::throwException(const UserExceptionFactoryPtr& factory)
|
|
2461
|
-
{
|
|
2462
|
-
assert(!_current);
|
|
2463
|
-
|
|
2464
|
-
push(ExceptionSlice);
|
|
2465
|
-
|
|
2466
|
-
//
|
|
2467
|
-
// Read the first slice header.
|
|
2468
|
-
//
|
|
2469
|
-
startSlice();
|
|
2470
|
-
const string mostDerivedId = _current->typeId;
|
|
2471
|
-
UserExceptionFactoryPtr exceptionFactory = factory;
|
|
2472
|
-
while(true)
|
|
2473
|
-
{
|
|
2474
|
-
//
|
|
2475
|
-
// Look for a statically-generated factory for this ID.
|
|
2476
|
-
//
|
|
2477
|
-
if(!exceptionFactory)
|
|
2478
|
-
{
|
|
2479
|
-
exceptionFactory = factoryTable->getExceptionFactory(_current->typeId);
|
|
2480
|
-
}
|
|
2481
|
-
|
|
2482
|
-
//
|
|
2483
|
-
// We found a factory, we get out of this loop.
|
|
2484
|
-
//
|
|
2485
|
-
if(exceptionFactory)
|
|
2486
|
-
{
|
|
2487
|
-
//
|
|
2488
|
-
// Got factory -- ask the factory to instantiate the
|
|
2489
|
-
// exception, initialize the exception members, and throw
|
|
2490
|
-
// the exception.
|
|
2491
|
-
//
|
|
2492
|
-
try
|
|
2493
|
-
{
|
|
2494
|
-
exceptionFactory->createAndThrow(_current->typeId);
|
|
2495
|
-
}
|
|
2496
|
-
catch(UserException& ex)
|
|
2497
|
-
{
|
|
2498
|
-
ex.__read(_stream);
|
|
2499
|
-
throw;
|
|
2500
|
-
|
|
2501
|
-
// Never reached.
|
|
2502
|
-
}
|
|
2503
|
-
}
|
|
2504
|
-
|
|
2505
|
-
//
|
|
2506
|
-
// Slice off what we don't understand.
|
|
2507
|
-
//
|
|
2508
|
-
skipSlice();
|
|
2509
|
-
|
|
2510
|
-
//
|
|
2511
|
-
// If this is the last slice, raise an exception and stop un-marshalling.
|
|
2512
|
-
//
|
|
2513
|
-
if(_current->sliceFlags & FLAG_IS_LAST_SLICE)
|
|
2514
|
-
{
|
|
2515
|
-
if(mostDerivedId.length() > 2 && mostDerivedId[0] == ':' && mostDerivedId[1] == ':')
|
|
2516
|
-
{
|
|
2517
|
-
throw UnknownUserException(__FILE__, __LINE__, mostDerivedId.substr(2));
|
|
2518
|
-
}
|
|
2519
|
-
else
|
|
2520
|
-
{
|
|
2521
|
-
throw UnknownUserException(__FILE__, __LINE__, mostDerivedId);
|
|
2522
|
-
}
|
|
2523
|
-
}
|
|
2524
|
-
|
|
2525
|
-
startSlice();
|
|
2526
|
-
}
|
|
2527
|
-
}
|
|
2528
|
-
|
|
2529
|
-
void
|
|
2530
|
-
#ifndef NDEBUG
|
|
2531
|
-
IceInternal::BasicStream::EncapsDecoder11::startInstance(SliceType sliceType)
|
|
2532
|
-
#else
|
|
2533
|
-
IceInternal::BasicStream::EncapsDecoder11::startInstance(SliceType)
|
|
2534
|
-
#endif
|
|
2535
|
-
{
|
|
2536
|
-
assert(_current->sliceType == sliceType);
|
|
2537
|
-
_current->skipFirstSlice = true;
|
|
2538
|
-
}
|
|
2539
|
-
|
|
2540
|
-
SlicedDataPtr
|
|
2541
|
-
IceInternal::BasicStream::EncapsDecoder11::endInstance(bool preserve)
|
|
2542
|
-
{
|
|
2543
|
-
SlicedDataPtr slicedData;
|
|
2544
|
-
if(preserve)
|
|
2545
|
-
{
|
|
2546
|
-
slicedData = readSlicedData();
|
|
2547
|
-
}
|
|
2548
|
-
_current->slices.clear();
|
|
2549
|
-
_current->indirectionTables.clear();
|
|
2550
|
-
_current = _current->previous;
|
|
2551
|
-
return slicedData;
|
|
2552
|
-
}
|
|
2553
|
-
|
|
2554
|
-
const std::string&
|
|
2555
|
-
IceInternal::BasicStream::EncapsDecoder11::startSlice()
|
|
2556
|
-
{
|
|
2557
|
-
//
|
|
2558
|
-
// If first slice, don't read the header, it was already read in
|
|
2559
|
-
// readInstance or throwException to find the factory.
|
|
2560
|
-
//
|
|
2561
|
-
if(_current->skipFirstSlice)
|
|
2562
|
-
{
|
|
2563
|
-
_current->skipFirstSlice = false;
|
|
2564
|
-
return _current->typeId;
|
|
2565
|
-
}
|
|
2566
|
-
|
|
2567
|
-
_stream->read(_current->sliceFlags);
|
|
2568
|
-
|
|
2569
|
-
//
|
|
2570
|
-
// Read the type ID, for object slices the type ID is encoded as a
|
|
2571
|
-
// string or as an index, for exceptions it's always encoded as a
|
|
2572
|
-
// string.
|
|
2573
|
-
//
|
|
2574
|
-
if(_current->sliceType == ObjectSlice)
|
|
2575
|
-
{
|
|
2576
|
-
if((_current->sliceFlags & FLAG_HAS_TYPE_ID_COMPACT) == FLAG_HAS_TYPE_ID_COMPACT) // Must be checked first!
|
|
2577
|
-
{
|
|
2578
|
-
_current->typeId.clear();
|
|
2579
|
-
_current->compactId = _stream->readSize();
|
|
2580
|
-
}
|
|
2581
|
-
else if(_current->sliceFlags & (FLAG_HAS_TYPE_ID_STRING | FLAG_HAS_TYPE_ID_INDEX))
|
|
2582
|
-
{
|
|
2583
|
-
_current->typeId = readTypeId(_current->sliceFlags & FLAG_HAS_TYPE_ID_INDEX);
|
|
2584
|
-
_current->compactId = -1;
|
|
2585
|
-
}
|
|
2586
|
-
else
|
|
2587
|
-
{
|
|
2588
|
-
// Only the most derived slice encodes the type ID for the compact format.
|
|
2589
|
-
_current->typeId.clear();
|
|
2590
|
-
_current->compactId = -1;
|
|
2591
|
-
}
|
|
2592
|
-
}
|
|
2593
|
-
else
|
|
2594
|
-
{
|
|
2595
|
-
_stream->read(_current->typeId, false);
|
|
2596
|
-
}
|
|
2597
|
-
|
|
2598
|
-
//
|
|
2599
|
-
// Read the slice size if necessary.
|
|
2600
|
-
//
|
|
2601
|
-
if(_current->sliceFlags & FLAG_HAS_SLICE_SIZE)
|
|
2602
|
-
{
|
|
2603
|
-
_stream->read(_current->sliceSize);
|
|
2604
|
-
if(_current->sliceSize < 4)
|
|
2605
|
-
{
|
|
2606
|
-
throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
|
|
2607
|
-
}
|
|
2608
|
-
}
|
|
2609
|
-
else
|
|
2610
|
-
{
|
|
2611
|
-
_current->sliceSize = 0;
|
|
2612
|
-
}
|
|
2613
|
-
|
|
2614
|
-
return _current->typeId;
|
|
2615
|
-
}
|
|
2616
|
-
|
|
2617
|
-
void
|
|
2618
|
-
IceInternal::BasicStream::EncapsDecoder11::endSlice()
|
|
2619
|
-
{
|
|
2620
|
-
if(_current->sliceFlags & FLAG_HAS_OPTIONAL_MEMBERS)
|
|
2621
|
-
{
|
|
2622
|
-
_stream->skipOpts();
|
|
2623
|
-
}
|
|
2624
|
-
|
|
2625
|
-
//
|
|
2626
|
-
// Read the indirect object table if one is present.
|
|
2627
|
-
//
|
|
2628
|
-
if(_current->sliceFlags & FLAG_HAS_INDIRECTION_TABLE)
|
|
2629
|
-
{
|
|
2630
|
-
IndexList indirectionTable(_stream->readAndCheckSeqSize(1));
|
|
2631
|
-
for(IndexList::iterator p = indirectionTable.begin(); p != indirectionTable.end(); ++p)
|
|
2632
|
-
{
|
|
2633
|
-
*p = readInstance(_stream->readSize(), 0, 0);
|
|
2634
|
-
}
|
|
2635
|
-
|
|
2636
|
-
//
|
|
2637
|
-
// Sanity checks. If there are optional members, it's possible
|
|
2638
|
-
// that not all object references were read if they are from
|
|
2639
|
-
// unknown optional data members.
|
|
2640
|
-
//
|
|
2641
|
-
if(indirectionTable.empty())
|
|
2642
|
-
{
|
|
2643
|
-
throw MarshalException(__FILE__, __LINE__, "empty indirection table");
|
|
2644
|
-
}
|
|
2645
|
-
if(_current->indirectPatchList.empty() && !(_current->sliceFlags & FLAG_HAS_OPTIONAL_MEMBERS))
|
|
2646
|
-
{
|
|
2647
|
-
throw MarshalException(__FILE__, __LINE__, "no references to indirection table");
|
|
2648
|
-
}
|
|
2649
|
-
|
|
2650
|
-
//
|
|
2651
|
-
// Convert indirect references into direct references.
|
|
2652
|
-
//
|
|
2653
|
-
IndirectPatchList::iterator p;
|
|
2654
|
-
for(p = _current->indirectPatchList.begin(); p != _current->indirectPatchList.end(); ++p)
|
|
2655
|
-
{
|
|
2656
|
-
assert(p->index >= 0);
|
|
2657
|
-
if(p->index >= static_cast<Int>(indirectionTable.size()))
|
|
2658
|
-
{
|
|
2659
|
-
throw MarshalException(__FILE__, __LINE__, "indirection out of range");
|
|
2660
|
-
}
|
|
2661
|
-
addPatchEntry(indirectionTable[p->index], p->patchFunc, p->patchAddr);
|
|
2662
|
-
}
|
|
2663
|
-
_current->indirectPatchList.clear();
|
|
2664
|
-
}
|
|
2665
|
-
}
|
|
2666
|
-
|
|
2667
|
-
void
|
|
2668
|
-
IceInternal::BasicStream::EncapsDecoder11::skipSlice()
|
|
2669
|
-
{
|
|
2670
|
-
if(_stream->instance()->traceLevels()->slicing > 0)
|
|
2671
|
-
{
|
|
2672
|
-
const Ice::LoggerPtr& logger = _stream->instance()->initializationData().logger;
|
|
2673
|
-
if(_current->sliceType == ExceptionSlice)
|
|
2674
|
-
{
|
|
2675
|
-
traceSlicing("exception", _current->typeId, _stream->instance()->traceLevels()->slicingCat, logger);
|
|
2676
|
-
}
|
|
2677
|
-
else
|
|
2678
|
-
{
|
|
2679
|
-
traceSlicing("object", _current->typeId, _stream->instance()->traceLevels()->slicingCat, logger);
|
|
2680
|
-
}
|
|
2681
|
-
}
|
|
2682
|
-
|
|
2683
|
-
Container::iterator start = _stream->i;
|
|
2684
|
-
|
|
2685
|
-
if(_current->sliceFlags & FLAG_HAS_SLICE_SIZE)
|
|
2686
|
-
{
|
|
2687
|
-
assert(_current->sliceSize >= 4);
|
|
2688
|
-
_stream->skip(_current->sliceSize - sizeof(Int));
|
|
2689
|
-
}
|
|
2690
|
-
else
|
|
2691
|
-
{
|
|
2692
|
-
if(_current->sliceType == ObjectSlice)
|
|
2693
|
-
{
|
|
2694
|
-
throw NoObjectFactoryException(__FILE__, __LINE__,
|
|
2695
|
-
"no object factory found and compact format prevents "
|
|
2696
|
-
"slicing (the sender should use the sliced format instead)",
|
|
2697
|
-
_current->typeId);
|
|
2698
|
-
}
|
|
2699
|
-
else
|
|
2700
|
-
{
|
|
2701
|
-
if(_current->typeId.length() > 2 && _current->typeId[0] == ':' && _current->typeId[1] == ':')
|
|
2702
|
-
{
|
|
2703
|
-
throw UnknownUserException(__FILE__, __LINE__, _current->typeId.substr(2));
|
|
2704
|
-
}
|
|
2705
|
-
else
|
|
2706
|
-
{
|
|
2707
|
-
throw UnknownUserException(__FILE__, __LINE__, _current->typeId);
|
|
2708
|
-
}
|
|
2709
|
-
}
|
|
2710
|
-
}
|
|
2711
|
-
|
|
2712
|
-
//
|
|
2713
|
-
// Preserve this slice.
|
|
2714
|
-
//
|
|
2715
|
-
SliceInfoPtr info = new SliceInfo;
|
|
2716
|
-
info->typeId = _current->typeId;
|
|
2717
|
-
info->compactId = _current->compactId;
|
|
2718
|
-
info->hasOptionalMembers = _current->sliceFlags & FLAG_HAS_OPTIONAL_MEMBERS;
|
|
2719
|
-
info->isLastSlice = _current->sliceFlags & FLAG_IS_LAST_SLICE;
|
|
2720
|
-
if(info->hasOptionalMembers)
|
|
2721
|
-
{
|
|
2722
|
-
//
|
|
2723
|
-
// Don't include the optional member end marker. It will be re-written by
|
|
2724
|
-
// endSlice when the sliced data is re-written.
|
|
2725
|
-
//
|
|
2726
|
-
vector<Byte>(start, _stream->i - 1).swap(info->bytes);
|
|
2727
|
-
}
|
|
2728
|
-
else
|
|
2729
|
-
{
|
|
2730
|
-
vector<Byte>(start, _stream->i).swap(info->bytes);
|
|
2731
|
-
}
|
|
2732
|
-
|
|
2733
|
-
_current->indirectionTables.push_back(IndexList());
|
|
2734
|
-
|
|
2735
|
-
//
|
|
2736
|
-
// Read the indirect object table. We read the instances or their
|
|
2737
|
-
// IDs if the instance is a reference to an already un-marhsaled
|
|
2738
|
-
// object.
|
|
2739
|
-
//
|
|
2740
|
-
// The SliceInfo object sequence is initialized only if
|
|
2741
|
-
// readSlicedData is called.
|
|
2742
|
-
//
|
|
2743
|
-
if(_current->sliceFlags & FLAG_HAS_INDIRECTION_TABLE)
|
|
2744
|
-
{
|
|
2745
|
-
IndexList& table = _current->indirectionTables.back();
|
|
2746
|
-
table.resize(_stream->readAndCheckSeqSize(1));
|
|
2747
|
-
for(IndexList::iterator p = table.begin(); p != table.end(); ++p)
|
|
2748
|
-
{
|
|
2749
|
-
*p = readInstance(_stream->readSize(), 0, 0);
|
|
2750
|
-
}
|
|
2751
|
-
}
|
|
2752
|
-
|
|
2753
|
-
_current->slices.push_back(info);
|
|
2754
|
-
}
|
|
2755
|
-
|
|
2756
|
-
bool
|
|
2757
|
-
IceInternal::BasicStream::EncapsDecoder11::readOpt(Ice::Int readTag, Ice::OptionalFormat expectedFormat)
|
|
2758
|
-
{
|
|
2759
|
-
if(!_current)
|
|
2760
|
-
{
|
|
2761
|
-
return _stream->readOptImpl(readTag, expectedFormat);
|
|
2762
|
-
}
|
|
2763
|
-
else if(_current->sliceFlags & FLAG_HAS_OPTIONAL_MEMBERS)
|
|
2764
|
-
{
|
|
2765
|
-
return _stream->readOptImpl(readTag, expectedFormat);
|
|
2766
|
-
}
|
|
2767
|
-
return false;
|
|
2768
|
-
}
|
|
2769
|
-
|
|
2770
|
-
Int
|
|
2771
|
-
IceInternal::BasicStream::EncapsDecoder11::readInstance(Int index, PatchFunc patchFunc, void* patchAddr)
|
|
2772
|
-
{
|
|
2773
|
-
assert(index > 0);
|
|
2774
|
-
|
|
2775
|
-
if(index > 1)
|
|
2776
|
-
{
|
|
2777
|
-
if(patchFunc)
|
|
2778
|
-
{
|
|
2779
|
-
addPatchEntry(index, patchFunc, patchAddr);
|
|
2780
|
-
}
|
|
2781
|
-
return index;
|
|
2782
|
-
}
|
|
2783
|
-
|
|
2784
|
-
push(ObjectSlice);
|
|
2785
|
-
|
|
2786
|
-
//
|
|
2787
|
-
// Get the object ID before we start reading slices. If some
|
|
2788
|
-
// slices are skiped, the indirect object table are still read and
|
|
2789
|
-
// might read other objects.
|
|
2790
|
-
//
|
|
2791
|
-
index = ++_objectIdIndex;
|
|
2792
|
-
|
|
2793
|
-
//
|
|
2794
|
-
// Read the first slice header.
|
|
2795
|
-
//
|
|
2796
|
-
startSlice();
|
|
2797
|
-
const string mostDerivedId = _current->typeId;
|
|
2798
|
-
Ice::ObjectPtr v;
|
|
2799
|
-
const CompactIdResolverPtr& compactIdResolver = _stream->instance()->initializationData().compactIdResolver;
|
|
2800
|
-
while(true)
|
|
2801
|
-
{
|
|
2802
|
-
if(_current->compactId >= 0)
|
|
2803
|
-
{
|
|
2804
|
-
//
|
|
2805
|
-
// Translate a compact (numeric) type ID into a string type ID.
|
|
2806
|
-
//
|
|
2807
|
-
_current->typeId.clear();
|
|
2808
|
-
if(compactIdResolver)
|
|
2809
|
-
{
|
|
2810
|
-
try
|
|
2811
|
-
{
|
|
2812
|
-
_current->typeId = compactIdResolver->resolve(_current->compactId);
|
|
2813
|
-
}
|
|
2814
|
-
catch(const LocalException&)
|
|
2815
|
-
{
|
|
2816
|
-
throw;
|
|
2817
|
-
}
|
|
2818
|
-
catch(const std::exception& ex)
|
|
2819
|
-
{
|
|
2820
|
-
ostringstream ostr;
|
|
2821
|
-
ostr << "exception in CompactIdResolver for ID " << _current->compactId;
|
|
2822
|
-
string msg = ostr.str();
|
|
2823
|
-
string what = ex.what();
|
|
2824
|
-
if(!what.empty())
|
|
2825
|
-
{
|
|
2826
|
-
msg += ":\n" + what;
|
|
2827
|
-
}
|
|
2828
|
-
throw MarshalException(__FILE__, __LINE__, msg);
|
|
2829
|
-
}
|
|
2830
|
-
catch(...)
|
|
2831
|
-
{
|
|
2832
|
-
ostringstream ostr;
|
|
2833
|
-
ostr << "unknown exception in CompactIdResolver for ID " << _current->compactId;
|
|
2834
|
-
throw MarshalException(__FILE__, __LINE__, ostr.str());
|
|
2835
|
-
}
|
|
2836
|
-
}
|
|
2837
|
-
if(_current->typeId.empty())
|
|
2838
|
-
{
|
|
2839
|
-
_current->typeId = IceInternal::factoryTable->getTypeId(_current->compactId);
|
|
2840
|
-
}
|
|
2841
|
-
}
|
|
2842
|
-
|
|
2843
|
-
if(!_current->typeId.empty())
|
|
2844
|
-
{
|
|
2845
|
-
v = newInstance(_current->typeId);
|
|
2846
|
-
|
|
2847
|
-
//
|
|
2848
|
-
// We found a factory, we get out of this loop.
|
|
2849
|
-
//
|
|
2850
|
-
if(v)
|
|
2851
|
-
{
|
|
2852
|
-
break;
|
|
2853
|
-
}
|
|
2854
|
-
}
|
|
2855
|
-
|
|
2856
|
-
//
|
|
2857
|
-
// If object slicing is disabled, stop un-marshalling.
|
|
2858
|
-
//
|
|
2859
|
-
if(!_sliceObjects)
|
|
2860
|
-
{
|
|
2861
|
-
throw NoObjectFactoryException(__FILE__, __LINE__, "no object factory found and object slicing is disabled",
|
|
2862
|
-
_current->typeId);
|
|
2863
|
-
}
|
|
2864
|
-
|
|
2865
|
-
//
|
|
2866
|
-
// Slice off what we don't understand.
|
|
2867
|
-
//
|
|
2868
|
-
skipSlice();
|
|
2869
|
-
|
|
2870
|
-
//
|
|
2871
|
-
// If this is the last slice, keep the object as an opaque UnknownSlicedObject.
|
|
2872
|
-
//
|
|
2873
|
-
if(_current->sliceFlags & FLAG_IS_LAST_SLICE)
|
|
2874
|
-
{
|
|
2875
|
-
//
|
|
2876
|
-
// Provide a factory with an opportunity to supply the object.
|
|
2877
|
-
// We pass the "::Ice::Object" ID to indicate that this is the
|
|
2878
|
-
// last chance to preserve the object.
|
|
2879
|
-
//
|
|
2880
|
-
v = newInstance(Object::ice_staticId());
|
|
2881
|
-
if(!v)
|
|
2882
|
-
{
|
|
2883
|
-
v = new UnknownSlicedObject(mostDerivedId);
|
|
2884
|
-
}
|
|
2885
|
-
|
|
2886
|
-
break;
|
|
2887
|
-
}
|
|
2888
|
-
|
|
2889
|
-
startSlice(); // Read next Slice header for next iteration.
|
|
2890
|
-
}
|
|
2891
|
-
|
|
2892
|
-
if(++_classGraphDepth > _classGraphDepthMax)
|
|
2893
|
-
{
|
|
2894
|
-
throw MarshalException(__FILE__, __LINE__, "maximum class graph depth reached");
|
|
2895
|
-
}
|
|
2896
|
-
|
|
2897
|
-
//
|
|
2898
|
-
// Un-marshal the object
|
|
2899
|
-
//
|
|
2900
|
-
unmarshal(index, v);
|
|
2901
|
-
|
|
2902
|
-
--_classGraphDepth;
|
|
2903
|
-
|
|
2904
|
-
if(!_current && !_patchMap.empty())
|
|
2905
|
-
{
|
|
2906
|
-
//
|
|
2907
|
-
// If any entries remain in the patch map, the sender has sent an index for an object, but failed
|
|
2908
|
-
// to supply the object.
|
|
2909
|
-
//
|
|
2910
|
-
throw MarshalException(__FILE__, __LINE__, "index for class received, but no instance");
|
|
2911
|
-
}
|
|
2912
|
-
|
|
2913
|
-
if(patchFunc)
|
|
2914
|
-
{
|
|
2915
|
-
patchFunc(patchAddr, v);
|
|
2916
|
-
}
|
|
2917
|
-
return index;
|
|
2918
|
-
}
|
|
2919
|
-
|
|
2920
|
-
SlicedDataPtr
|
|
2921
|
-
IceInternal::BasicStream::EncapsDecoder11::readSlicedData()
|
|
2922
|
-
{
|
|
2923
|
-
if(_current->slices.empty()) // No preserved slices.
|
|
2924
|
-
{
|
|
2925
|
-
return 0;
|
|
2926
|
-
}
|
|
2927
|
-
|
|
2928
|
-
//
|
|
2929
|
-
// The indirectionTables member holds the indirection table for
|
|
2930
|
-
// each slice in slices.
|
|
2931
|
-
//
|
|
2932
|
-
assert(_current->slices.size() == _current->indirectionTables.size());
|
|
2933
|
-
for(SliceInfoSeq::size_type n = 0; n < _current->slices.size(); ++n)
|
|
2934
|
-
{
|
|
2935
|
-
//
|
|
2936
|
-
// We use the "objects" list in SliceInfo to hold references
|
|
2937
|
-
// to the target objects. Note that the objects might not have
|
|
2938
|
-
// been read yet in the case of a circular reference to an
|
|
2939
|
-
// enclosing object.
|
|
2940
|
-
//
|
|
2941
|
-
const IndexList& table = _current->indirectionTables[n];
|
|
2942
|
-
vector<ObjectPtr>& objects = _current->slices[n]->objects;
|
|
2943
|
-
objects.resize(table.size());
|
|
2944
|
-
IndexList::size_type j = 0;
|
|
2945
|
-
for(IndexList::const_iterator p = table.begin(); p != table.end(); ++p)
|
|
2946
|
-
{
|
|
2947
|
-
addPatchEntry(*p, &patchHandle<Object>, &objects[j++]);
|
|
2948
|
-
}
|
|
2949
|
-
}
|
|
2950
|
-
return new SlicedData(_current->slices);
|
|
2951
|
-
}
|
|
2952
|
-
|
|
2953
|
-
Int
|
|
2954
|
-
IceInternal::BasicStream::EncapsEncoder::registerTypeId(const string& typeId)
|
|
2955
|
-
{
|
|
2956
|
-
TypeIdWriteMap::const_iterator p = _typeIdMap.find(typeId);
|
|
2957
|
-
if(p != _typeIdMap.end())
|
|
2958
|
-
{
|
|
2959
|
-
return p->second;
|
|
2960
|
-
}
|
|
2961
|
-
else
|
|
2962
|
-
{
|
|
2963
|
-
_typeIdMap.insert(make_pair(typeId, ++_typeIdIndex));
|
|
2964
|
-
return -1;
|
|
2965
|
-
}
|
|
2966
|
-
}
|
|
2967
|
-
|
|
2968
|
-
void
|
|
2969
|
-
IceInternal::BasicStream::EncapsEncoder10::write(const ObjectPtr& v)
|
|
2970
|
-
{
|
|
2971
|
-
//
|
|
2972
|
-
// Object references are encoded as a negative integer in 1.0.
|
|
2973
|
-
//
|
|
2974
|
-
if(v)
|
|
2975
|
-
{
|
|
2976
|
-
_stream->write(-registerObject(v));
|
|
2977
|
-
}
|
|
2978
|
-
else
|
|
2979
|
-
{
|
|
2980
|
-
_stream->write(0);
|
|
2981
|
-
}
|
|
2982
|
-
}
|
|
2983
|
-
|
|
2984
|
-
void
|
|
2985
|
-
IceInternal::BasicStream::EncapsEncoder10::write(const UserException& v)
|
|
2986
|
-
{
|
|
2987
|
-
//
|
|
2988
|
-
// User exception with the 1.0 encoding start with a boolean
|
|
2989
|
-
// flag that indicates whether or not the exception uses
|
|
2990
|
-
// classes.
|
|
2991
|
-
//
|
|
2992
|
-
// This allows reading the pending objects even if some part of
|
|
2993
|
-
// the exception was sliced.
|
|
2994
|
-
//
|
|
2995
|
-
bool usesClasses = v.__usesClasses();
|
|
2996
|
-
_stream->write(usesClasses);
|
|
2997
|
-
v.__write(_stream);
|
|
2998
|
-
if(usesClasses)
|
|
2999
|
-
{
|
|
3000
|
-
writePendingObjects();
|
|
3001
|
-
}
|
|
3002
|
-
}
|
|
3003
|
-
|
|
3004
|
-
void
|
|
3005
|
-
IceInternal::BasicStream::EncapsEncoder10::startInstance(SliceType sliceType, const SlicedDataPtr&)
|
|
3006
|
-
{
|
|
3007
|
-
_sliceType = sliceType;
|
|
3008
|
-
}
|
|
3009
|
-
|
|
3010
|
-
void
|
|
3011
|
-
IceInternal::BasicStream::EncapsEncoder10::endInstance()
|
|
3012
|
-
{
|
|
3013
|
-
if(_sliceType == ObjectSlice)
|
|
3014
|
-
{
|
|
3015
|
-
//
|
|
3016
|
-
// Write the Object slice.
|
|
3017
|
-
//
|
|
3018
|
-
startSlice(Object::ice_staticId(), -1, true);
|
|
3019
|
-
_stream->writeSize(0); // For compatibility with the old AFM.
|
|
3020
|
-
endSlice();
|
|
3021
|
-
}
|
|
3022
|
-
_sliceType = NoSlice;
|
|
3023
|
-
}
|
|
3024
|
-
|
|
3025
|
-
void
|
|
3026
|
-
IceInternal::BasicStream::EncapsEncoder10::startSlice(const string& typeId, int, bool /*last*/)
|
|
3027
|
-
{
|
|
3028
|
-
//
|
|
3029
|
-
// For object slices, encode a boolean to indicate how the type ID
|
|
3030
|
-
// is encoded and the type ID either as a string or index. For
|
|
3031
|
-
// exception slices, always encode the type ID as a string.
|
|
3032
|
-
//
|
|
3033
|
-
if(_sliceType == ObjectSlice)
|
|
3034
|
-
{
|
|
3035
|
-
Int index = registerTypeId(typeId);
|
|
3036
|
-
if(index < 0)
|
|
3037
|
-
{
|
|
3038
|
-
_stream->write(false);
|
|
3039
|
-
_stream->write(typeId, false);
|
|
3040
|
-
}
|
|
3041
|
-
else
|
|
3042
|
-
{
|
|
3043
|
-
_stream->write(true);
|
|
3044
|
-
_stream->writeSize(index);
|
|
3045
|
-
}
|
|
3046
|
-
}
|
|
3047
|
-
else
|
|
3048
|
-
{
|
|
3049
|
-
_stream->write(typeId, false);
|
|
3050
|
-
}
|
|
3051
|
-
|
|
3052
|
-
_stream->write(Int(0)); // Placeholder for the slice length.
|
|
3053
|
-
|
|
3054
|
-
_writeSlice = _stream->b.size();
|
|
3055
|
-
}
|
|
3056
|
-
|
|
3057
|
-
void
|
|
3058
|
-
IceInternal::BasicStream::EncapsEncoder10::endSlice()
|
|
3059
|
-
{
|
|
3060
|
-
//
|
|
3061
|
-
// Write the slice length.
|
|
3062
|
-
//
|
|
3063
|
-
Int sz = static_cast<Int>(_stream->b.size() - _writeSlice + sizeof(Int));
|
|
3064
|
-
Byte* dest = &(*(_stream->b.begin() + _writeSlice - sizeof(Int)));
|
|
3065
|
-
_stream->write(sz, dest);
|
|
3066
|
-
}
|
|
3067
|
-
|
|
3068
|
-
void
|
|
3069
|
-
IceInternal::BasicStream::EncapsEncoder10::writePendingObjects()
|
|
3070
|
-
{
|
|
3071
|
-
while(!_toBeMarshaledMap.empty())
|
|
3072
|
-
{
|
|
3073
|
-
//
|
|
3074
|
-
// Consider the to be marshalled objects as marshalled now,
|
|
3075
|
-
// this is necessary to avoid adding again the "to be
|
|
3076
|
-
// marshalled objects" into _toBeMarshaledMap while writing
|
|
3077
|
-
// objects.
|
|
3078
|
-
//
|
|
3079
|
-
_marshaledMap.insert(_toBeMarshaledMap.begin(), _toBeMarshaledMap.end());
|
|
3080
|
-
|
|
3081
|
-
PtrToIndexMap savedMap;
|
|
3082
|
-
savedMap.swap(_toBeMarshaledMap);
|
|
3083
|
-
_stream->writeSize(static_cast<Int>(savedMap.size()));
|
|
3084
|
-
for(PtrToIndexMap::iterator p = savedMap.begin(); p != savedMap.end(); ++p)
|
|
3085
|
-
{
|
|
3086
|
-
//
|
|
3087
|
-
// Ask the instance to marshal itself. Any new class
|
|
3088
|
-
// instances that are triggered by the classes marshaled
|
|
3089
|
-
// are added to toBeMarshaledMap.
|
|
3090
|
-
//
|
|
3091
|
-
_stream->write(p->second);
|
|
3092
|
-
|
|
3093
|
-
try
|
|
3094
|
-
{
|
|
3095
|
-
p->first->ice_preMarshal();
|
|
3096
|
-
}
|
|
3097
|
-
catch(const std::exception& ex)
|
|
3098
|
-
{
|
|
3099
|
-
Warning out(_stream->instance()->initializationData().logger);
|
|
3100
|
-
out << "std::exception raised by ice_preMarshal:\n" << ex;
|
|
3101
|
-
}
|
|
3102
|
-
catch(...)
|
|
3103
|
-
{
|
|
3104
|
-
Warning out(_stream->instance()->initializationData().logger);
|
|
3105
|
-
out << "unknown exception raised by ice_preMarshal";
|
|
3106
|
-
}
|
|
3107
|
-
|
|
3108
|
-
p->first->__write(_stream);
|
|
3109
|
-
}
|
|
3110
|
-
}
|
|
3111
|
-
_stream->writeSize(0); // Zero marker indicates end of sequence of sequences of instances.
|
|
3112
|
-
}
|
|
3113
|
-
|
|
3114
|
-
Int
|
|
3115
|
-
IceInternal::BasicStream::EncapsEncoder10::registerObject(const ObjectPtr& v)
|
|
3116
|
-
{
|
|
3117
|
-
assert(v);
|
|
3118
|
-
|
|
3119
|
-
//
|
|
3120
|
-
// Look for this instance in the to-be-marshaled map.
|
|
3121
|
-
//
|
|
3122
|
-
PtrToIndexMap::const_iterator p = _toBeMarshaledMap.find(v);
|
|
3123
|
-
if(p != _toBeMarshaledMap.end())
|
|
3124
|
-
{
|
|
3125
|
-
return p->second;
|
|
3126
|
-
}
|
|
3127
|
-
|
|
3128
|
-
//
|
|
3129
|
-
// Didn't find it, try the marshaled map next.
|
|
3130
|
-
//
|
|
3131
|
-
PtrToIndexMap::const_iterator q = _marshaledMap.find(v);
|
|
3132
|
-
if(q != _marshaledMap.end())
|
|
3133
|
-
{
|
|
3134
|
-
return q->second;
|
|
3135
|
-
}
|
|
3136
|
-
|
|
3137
|
-
//
|
|
3138
|
-
// We haven't seen this instance previously, create a new
|
|
3139
|
-
// index, and insert it into the to-be-marshaled map.
|
|
3140
|
-
//
|
|
3141
|
-
_toBeMarshaledMap.insert(make_pair(v, ++_objectIdIndex));
|
|
3142
|
-
return _objectIdIndex;
|
|
3143
|
-
}
|
|
3144
|
-
|
|
3145
|
-
void
|
|
3146
|
-
IceInternal::BasicStream::EncapsEncoder11::write(const ObjectPtr& v)
|
|
3147
|
-
{
|
|
3148
|
-
if(!v)
|
|
3149
|
-
{
|
|
3150
|
-
_stream->writeSize(0); // Nil reference.
|
|
3151
|
-
}
|
|
3152
|
-
else if(_current && _encaps->format == SlicedFormat)
|
|
3153
|
-
{
|
|
3154
|
-
//
|
|
3155
|
-
// If writting an object within a slice and using the sliced
|
|
3156
|
-
// format, write an index from the object indirection
|
|
3157
|
-
// table. The indirect object table is encoded at the end of
|
|
3158
|
-
// each slice and is always read (even if the Slice is
|
|
3159
|
-
// unknown).
|
|
3160
|
-
//
|
|
3161
|
-
PtrToIndexMap::const_iterator p = _current->indirectionMap.find(v);
|
|
3162
|
-
if(p == _current->indirectionMap.end())
|
|
3163
|
-
{
|
|
3164
|
-
_current->indirectionTable.push_back(v);
|
|
3165
|
-
Int idx = static_cast<Int>(_current->indirectionTable.size()); // Position + 1 (0 is reserved for nil)
|
|
3166
|
-
_current->indirectionMap.insert(make_pair(v, idx));
|
|
3167
|
-
_stream->writeSize(idx);
|
|
3168
|
-
}
|
|
3169
|
-
else
|
|
3170
|
-
{
|
|
3171
|
-
_stream->writeSize(p->second);
|
|
3172
|
-
}
|
|
3173
|
-
}
|
|
3174
|
-
else
|
|
3175
|
-
{
|
|
3176
|
-
writeInstance(v); // Write the instance or a reference if already marshaled.
|
|
3177
|
-
}
|
|
3178
|
-
}
|
|
3179
|
-
|
|
3180
|
-
void
|
|
3181
|
-
IceInternal::BasicStream::EncapsEncoder11::write(const UserException& v)
|
|
3182
|
-
{
|
|
3183
|
-
v.__write(_stream);
|
|
3184
|
-
}
|
|
3185
|
-
|
|
3186
|
-
void
|
|
3187
|
-
IceInternal::BasicStream::EncapsEncoder11::startInstance(SliceType sliceType, const SlicedDataPtr& data)
|
|
3188
|
-
{
|
|
3189
|
-
if(!_current)
|
|
3190
|
-
{
|
|
3191
|
-
_current = &_preAllocatedInstanceData;
|
|
3192
|
-
}
|
|
3193
|
-
else
|
|
3194
|
-
{
|
|
3195
|
-
_current = _current->next ? _current->next : new InstanceData(_current);
|
|
3196
|
-
}
|
|
3197
|
-
_current->sliceType = sliceType;
|
|
3198
|
-
_current->firstSlice = true;
|
|
3199
|
-
|
|
3200
|
-
if(data)
|
|
3201
|
-
{
|
|
3202
|
-
writeSlicedData(data);
|
|
3203
|
-
}
|
|
3204
|
-
}
|
|
3205
|
-
|
|
3206
|
-
void
|
|
3207
|
-
IceInternal::BasicStream::EncapsEncoder11::endInstance()
|
|
3208
|
-
{
|
|
3209
|
-
_current = _current->previous;
|
|
3210
|
-
}
|
|
3211
|
-
|
|
3212
|
-
void
|
|
3213
|
-
IceInternal::BasicStream::EncapsEncoder11::startSlice(const string& typeId, int compactId, bool last)
|
|
3214
|
-
{
|
|
3215
|
-
assert(_current->indirectionTable.empty() && _current->indirectionMap.empty());
|
|
3216
|
-
|
|
3217
|
-
_current->sliceFlagsPos = _stream->b.size();
|
|
3218
|
-
|
|
3219
|
-
_current->sliceFlags = 0;
|
|
3220
|
-
if(_encaps->format == SlicedFormat)
|
|
3221
|
-
{
|
|
3222
|
-
_current->sliceFlags |= FLAG_HAS_SLICE_SIZE; // Encode the slice size if using the sliced format.
|
|
3223
|
-
}
|
|
3224
|
-
if(last)
|
|
3225
|
-
{
|
|
3226
|
-
_current->sliceFlags |= FLAG_IS_LAST_SLICE; // This is the last slice.
|
|
3227
|
-
}
|
|
3228
|
-
|
|
3229
|
-
_stream->write(Byte(0)); // Placeholder for the slice flags
|
|
3230
|
-
|
|
3231
|
-
//
|
|
3232
|
-
// For object slices, encode the flag and the type ID either as a
|
|
3233
|
-
// string or index. For exception slices, always encode the type
|
|
3234
|
-
// ID a string.
|
|
3235
|
-
//
|
|
3236
|
-
if(_current->sliceType == ObjectSlice)
|
|
3237
|
-
{
|
|
3238
|
-
//
|
|
3239
|
-
// Encode the type ID (only in the first slice for the compact
|
|
3240
|
-
// encoding).
|
|
3241
|
-
//
|
|
3242
|
-
if(_encaps->format == SlicedFormat || _current->firstSlice)
|
|
3243
|
-
{
|
|
3244
|
-
if(compactId >= 0)
|
|
3245
|
-
{
|
|
3246
|
-
_current->sliceFlags |= FLAG_HAS_TYPE_ID_COMPACT;
|
|
3247
|
-
_stream->writeSize(compactId);
|
|
3248
|
-
}
|
|
3249
|
-
else
|
|
3250
|
-
{
|
|
3251
|
-
Int index = registerTypeId(typeId);
|
|
3252
|
-
if(index < 0)
|
|
3253
|
-
{
|
|
3254
|
-
_current->sliceFlags |= FLAG_HAS_TYPE_ID_STRING;
|
|
3255
|
-
_stream->write(typeId, false);
|
|
3256
|
-
}
|
|
3257
|
-
else
|
|
3258
|
-
{
|
|
3259
|
-
_current->sliceFlags |= FLAG_HAS_TYPE_ID_INDEX;
|
|
3260
|
-
_stream->writeSize(index);
|
|
3261
|
-
}
|
|
3262
|
-
}
|
|
3263
|
-
}
|
|
3264
|
-
}
|
|
3265
|
-
else
|
|
3266
|
-
{
|
|
3267
|
-
_stream->write(typeId, false);
|
|
3268
|
-
}
|
|
3269
|
-
|
|
3270
|
-
if(_current->sliceFlags & FLAG_HAS_SLICE_SIZE)
|
|
3271
|
-
{
|
|
3272
|
-
_stream->write(Int(0)); // Placeholder for the slice length.
|
|
3273
|
-
}
|
|
3274
|
-
|
|
3275
|
-
_current->writeSlice = _stream->b.size();
|
|
3276
|
-
_current->firstSlice = false;
|
|
3277
|
-
}
|
|
3278
|
-
|
|
3279
|
-
void
|
|
3280
|
-
IceInternal::BasicStream::EncapsEncoder11::endSlice()
|
|
3281
|
-
{
|
|
3282
|
-
//
|
|
3283
|
-
// Write the optional member end marker if some optional members
|
|
3284
|
-
// were encoded. Note that the optional members are encoded before
|
|
3285
|
-
// the indirection table and are included in the slice size.
|
|
3286
|
-
//
|
|
3287
|
-
if(_current->sliceFlags & FLAG_HAS_OPTIONAL_MEMBERS)
|
|
3288
|
-
{
|
|
3289
|
-
_stream->write(OPTIONAL_END_MARKER);
|
|
3290
|
-
}
|
|
3291
|
-
|
|
3292
|
-
//
|
|
3293
|
-
// Write the slice length if necessary.
|
|
3294
|
-
//
|
|
3295
|
-
if(_current->sliceFlags & FLAG_HAS_SLICE_SIZE)
|
|
3296
|
-
{
|
|
3297
|
-
Int sz = static_cast<Int>(_stream->b.size() - _current->writeSlice + sizeof(Int));
|
|
3298
|
-
Byte* dest = &(*(_stream->b.begin() + _current->writeSlice - sizeof(Int)));
|
|
3299
|
-
_stream->write(sz, dest);
|
|
3300
|
-
}
|
|
3301
|
-
|
|
3302
|
-
//
|
|
3303
|
-
// Only write the indirection table if it contains entries.
|
|
3304
|
-
//
|
|
3305
|
-
if(!_current->indirectionTable.empty())
|
|
3306
|
-
{
|
|
3307
|
-
assert(_encaps->format == SlicedFormat);
|
|
3308
|
-
_current->sliceFlags |= FLAG_HAS_INDIRECTION_TABLE;
|
|
3309
|
-
|
|
3310
|
-
//
|
|
3311
|
-
// Write the indirection object table.
|
|
3312
|
-
//
|
|
3313
|
-
_stream->writeSize(static_cast<Int>(_current->indirectionTable.size()));
|
|
3314
|
-
ObjectList::const_iterator p;
|
|
3315
|
-
for(p = _current->indirectionTable.begin(); p != _current->indirectionTable.end(); ++p)
|
|
3316
|
-
{
|
|
3317
|
-
writeInstance(*p);
|
|
3318
|
-
}
|
|
3319
|
-
_current->indirectionTable.clear();
|
|
3320
|
-
_current->indirectionMap.clear();
|
|
3321
|
-
}
|
|
3322
|
-
|
|
3323
|
-
//
|
|
3324
|
-
// Finally, update the slice flags.
|
|
3325
|
-
//
|
|
3326
|
-
Byte* dest = &(*(_stream->b.begin() + _current->sliceFlagsPos));
|
|
3327
|
-
*dest = _current->sliceFlags;
|
|
3328
|
-
}
|
|
3329
|
-
|
|
3330
|
-
bool
|
|
3331
|
-
IceInternal::BasicStream::EncapsEncoder11::writeOpt(Ice::Int tag, Ice::OptionalFormat format)
|
|
3332
|
-
{
|
|
3333
|
-
if(!_current)
|
|
3334
|
-
{
|
|
3335
|
-
return _stream->writeOptImpl(tag, format);
|
|
3336
|
-
}
|
|
3337
|
-
else
|
|
3338
|
-
{
|
|
3339
|
-
if(_stream->writeOptImpl(tag, format))
|
|
3340
|
-
{
|
|
3341
|
-
_current->sliceFlags |= FLAG_HAS_OPTIONAL_MEMBERS;
|
|
3342
|
-
return true;
|
|
3343
|
-
}
|
|
3344
|
-
else
|
|
3345
|
-
{
|
|
3346
|
-
return false;
|
|
3347
|
-
}
|
|
3348
|
-
}
|
|
3349
|
-
}
|
|
3350
|
-
|
|
3351
|
-
void
|
|
3352
|
-
IceInternal::BasicStream::EncapsEncoder11::writeSlicedData(const SlicedDataPtr& slicedData)
|
|
3353
|
-
{
|
|
3354
|
-
assert(slicedData);
|
|
3355
|
-
|
|
3356
|
-
//
|
|
3357
|
-
// We only remarshal preserved slices if we are using the sliced
|
|
3358
|
-
// format. Otherwise, we ignore the preserved slices, which
|
|
3359
|
-
// essentially "slices" the object into the most-derived type
|
|
3360
|
-
// known by the sender.
|
|
3361
|
-
//
|
|
3362
|
-
if(_encaps->format != SlicedFormat)
|
|
3363
|
-
{
|
|
3364
|
-
return;
|
|
3365
|
-
}
|
|
3366
|
-
|
|
3367
|
-
for(SliceInfoSeq::const_iterator p = slicedData->slices.begin(); p != slicedData->slices.end(); ++p)
|
|
3368
|
-
{
|
|
3369
|
-
startSlice((*p)->typeId, (*p)->compactId, (*p)->isLastSlice);
|
|
3370
|
-
|
|
3371
|
-
//
|
|
3372
|
-
// Write the bytes associated with this slice.
|
|
3373
|
-
//
|
|
3374
|
-
_stream->writeBlob((*p)->bytes);
|
|
3375
|
-
|
|
3376
|
-
if((*p)->hasOptionalMembers)
|
|
3377
|
-
{
|
|
3378
|
-
_current->sliceFlags |= FLAG_HAS_OPTIONAL_MEMBERS;
|
|
3379
|
-
}
|
|
3380
|
-
|
|
3381
|
-
//
|
|
3382
|
-
// Make sure to also re-write the object indirection table.
|
|
3383
|
-
//
|
|
3384
|
-
_current->indirectionTable = (*p)->objects;
|
|
3385
|
-
|
|
3386
|
-
endSlice();
|
|
3387
|
-
}
|
|
3388
|
-
}
|
|
3389
|
-
|
|
3390
|
-
void
|
|
3391
|
-
IceInternal::BasicStream::EncapsEncoder11::writeInstance(const ObjectPtr& v)
|
|
3392
|
-
{
|
|
3393
|
-
assert(v);
|
|
3394
|
-
|
|
3395
|
-
//
|
|
3396
|
-
// If the instance was already marshaled, just write it's ID.
|
|
3397
|
-
//
|
|
3398
|
-
PtrToIndexMap::const_iterator q = _marshaledMap.find(v);
|
|
3399
|
-
if(q != _marshaledMap.end())
|
|
3400
|
-
{
|
|
3401
|
-
_stream->writeSize(q->second);
|
|
3402
|
-
return;
|
|
3403
|
-
}
|
|
3404
|
-
|
|
3405
|
-
//
|
|
3406
|
-
// We haven't seen this instance previously, create a new ID,
|
|
3407
|
-
// insert it into the marshaled map, and write the instance.
|
|
3408
|
-
//
|
|
3409
|
-
_marshaledMap.insert(make_pair(v, ++_objectIdIndex));
|
|
3410
|
-
|
|
3411
|
-
try
|
|
3412
|
-
{
|
|
3413
|
-
v->ice_preMarshal();
|
|
3414
|
-
}
|
|
3415
|
-
catch(const std::exception& ex)
|
|
3416
|
-
{
|
|
3417
|
-
Warning out(_stream->instance()->initializationData().logger);
|
|
3418
|
-
out << "std::exception raised by ice_preMarshal:\n" << ex;
|
|
3419
|
-
}
|
|
3420
|
-
catch(...)
|
|
3421
|
-
{
|
|
3422
|
-
Warning out(_stream->instance()->initializationData().logger);
|
|
3423
|
-
out << "unknown exception raised by ice_preMarshal";
|
|
3424
|
-
}
|
|
3425
|
-
|
|
3426
|
-
_stream->writeSize(1); // Object instance marker.
|
|
3427
|
-
v->__write(_stream);
|
|
3428
|
-
}
|